|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.glxp.api.controller.inout;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
@ -9,15 +10,21 @@ import com.glxp.api.annotation.Log;
|
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
|
import com.glxp.api.constant.BusinessType;
|
|
|
|
|
import com.glxp.api.entity.auth.AuthAdmin;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderDetailBizEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderDetailCodeEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderEntity;
|
|
|
|
|
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
|
|
|
|
|
import com.glxp.api.req.inout.FilterOrderDetailCodeRequest;
|
|
|
|
|
import com.glxp.api.req.inout.IoOrderInvoiceRequest;
|
|
|
|
|
import com.glxp.api.req.inout.RefreshInoiceRequest;
|
|
|
|
|
import com.glxp.api.req.system.DeleteRequest;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderDetailCodeResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderInvoiceResponse;
|
|
|
|
|
import com.glxp.api.res.inout.IoOrderResponse;
|
|
|
|
|
import com.glxp.api.res.inout.RefreshInoiceResponse;
|
|
|
|
|
import com.glxp.api.service.auth.CustomerService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderDetailBizService;
|
|
|
|
|
import com.glxp.api.service.inout.IoOrderDetailCodeService;
|
|
|
|
|
import com.glxp.api.service.inout.impl.IoOrderInvoiceService;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
@ -27,6 +34,9 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
@ -35,7 +45,10 @@ public class IoOrderInvoiceController {
|
|
|
|
|
IoOrderInvoiceService ioOrderInvoiceService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoOrderDetailCodeService orderDetailCodeService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
CustomerService customerService;
|
|
|
|
|
@Resource
|
|
|
|
|
IoOrderDetailBizService orderDetailBizService;
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/order/refrshInvoice")
|
|
|
|
@ -64,13 +77,22 @@ public class IoOrderInvoiceController {
|
|
|
|
|
return ResultVOUtils.page(pageInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//发票对应产品信息汇总
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@GetMapping("/udiwms/inout/invoice/product/detail")
|
|
|
|
|
public BaseResponse productDetail(IoOrderInvoiceRequest orderInvoiceRequest) {
|
|
|
|
|
if (StrUtil.isEmpty(orderInvoiceRequest.getInvoiceEncode()))
|
|
|
|
|
return ResultVOUtils.error(500, "发票编码不能为空!");
|
|
|
|
|
List<IoOrderInvoiceResponse> orderInvoiceEntities = ioOrderInvoiceService.filterGroupBy(orderInvoiceRequest);
|
|
|
|
|
List<IoOrderInvoiceResponse> orderInvoiceEntities = ioOrderInvoiceService.filterInvoice(orderInvoiceRequest);
|
|
|
|
|
|
|
|
|
|
//计算金额
|
|
|
|
|
for (IoOrderInvoiceResponse orderInvoiceEntity : orderInvoiceEntities) {
|
|
|
|
|
if (orderInvoiceEntity.getPrice() != null && orderInvoiceEntity.getReCount() != 0) {
|
|
|
|
|
orderInvoiceEntity.setAmout(new BigDecimal(orderInvoiceEntity.getPrice()).multiply(new BigDecimal(orderInvoiceEntity.getReCount())));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageInfo<IoOrderInvoiceResponse> pageInfo = new PageInfo<>(orderInvoiceEntities);
|
|
|
|
|
return ResultVOUtils.page(pageInfo);
|
|
|
|
|
}
|
|
|
|
@ -80,6 +102,9 @@ public class IoOrderInvoiceController {
|
|
|
|
|
@GetMapping("/udiwms/inout/invoice/order/detail")
|
|
|
|
|
public BaseResponse orderDetail(IoOrderInvoiceRequest orderInvoiceRequest) {
|
|
|
|
|
List<IoOrderResponse> orderInvoiceEntities = ioOrderInvoiceService.filterByInvoiceCode(orderInvoiceRequest);
|
|
|
|
|
for (IoOrderResponse orderInvoiceEntity : orderInvoiceEntities) {
|
|
|
|
|
ioOrderInvoiceService.findRegStausByBillNo(orderInvoiceEntity);
|
|
|
|
|
}
|
|
|
|
|
PageInfo<IoOrderResponse> pageInfo = new PageInfo<>(orderInvoiceEntities);
|
|
|
|
|
return ResultVOUtils.page(pageInfo);
|
|
|
|
|
}
|
|
|
|
@ -98,5 +123,74 @@ public class IoOrderInvoiceController {
|
|
|
|
|
return ResultVOUtils.error(500, "删除失败!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/invoice/saveInvoice")
|
|
|
|
|
@Log(title = "发票增加", businessType = BusinessType.INSERT)
|
|
|
|
|
public BaseResponse saveInvoice(@RequestBody IoOrderInvoiceRequest ioOrderInvoiceRequest) {
|
|
|
|
|
|
|
|
|
|
List<String> orderFkList = ioOrderInvoiceRequest.getOrderFkList();
|
|
|
|
|
List<IoOrderInvoiceEntity> ioOrderInvoiceEntityList = new ArrayList<>();
|
|
|
|
|
for (String orderFk : orderFkList) {
|
|
|
|
|
//查询单据详情
|
|
|
|
|
FilterOrderDetailCodeRequest orderDetailBizRequest = new FilterOrderDetailCodeRequest();
|
|
|
|
|
orderDetailBizRequest.setOrderIdFk(orderFk);
|
|
|
|
|
List<IoOrderDetailCodeResponse> ioOrderDetailCodeResponses = orderDetailBizService.getfilterOrderList(orderDetailBizRequest);
|
|
|
|
|
for (IoOrderDetailCodeResponse ioOrderDetailCodeRespons : ioOrderDetailCodeResponses) {
|
|
|
|
|
IoOrderInvoiceEntity ioOrderInvoiceEntity = new IoOrderInvoiceEntity();
|
|
|
|
|
BeanUtils.copyProperties(ioOrderInvoiceRequest, ioOrderInvoiceEntity);
|
|
|
|
|
ioOrderInvoiceEntity.setId(IdUtil.getSnowflakeNextId());
|
|
|
|
|
ioOrderInvoiceEntity.setOrderIdFk(orderFk);
|
|
|
|
|
ioOrderInvoiceEntity.setUpdateTime(new Date());
|
|
|
|
|
ioOrderInvoiceEntity.setCreateTime(new Date());
|
|
|
|
|
ioOrderInvoiceEntity.setCreateUser(customerService.getUserId() + "");
|
|
|
|
|
ioOrderInvoiceEntity.setUpdateUser(customerService.getUserId() + "");
|
|
|
|
|
ioOrderInvoiceEntity.setBindRlFk(ioOrderDetailCodeRespons.getBindRlFk() + "");
|
|
|
|
|
ioOrderInvoiceEntity.setBatchNo(ioOrderDetailCodeRespons.getBatchNo());
|
|
|
|
|
ioOrderInvoiceEntity.setProductDate(ioOrderDetailCodeRespons.getProductDate());
|
|
|
|
|
ioOrderInvoiceEntity.setExpireDate(ioOrderDetailCodeRespons.getExpireDate());
|
|
|
|
|
ioOrderInvoiceEntityList.add(ioOrderInvoiceEntity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean b = ioOrderInvoiceService.saveBatch(ioOrderInvoiceEntityList);
|
|
|
|
|
if (b)
|
|
|
|
|
return ResultVOUtils.success("选入成功!");
|
|
|
|
|
else
|
|
|
|
|
return ResultVOUtils.error(500, "选入失败!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inout/invoice/uploadInvoice")
|
|
|
|
|
@Log(title = "发票管理", businessType = BusinessType.UPDATE)
|
|
|
|
|
public BaseResponse uploadInvoice(@RequestBody IoOrderInvoiceEntity ioOrderInvoice) {
|
|
|
|
|
|
|
|
|
|
List<IoOrderInvoiceEntity> ioOrderInvoiceEntityList=ioOrderInvoiceService.list(new QueryWrapper<IoOrderInvoiceEntity>().eq("invoiceEncode",ioOrderInvoice.getInvoiceEncode()));
|
|
|
|
|
for (IoOrderInvoiceEntity ioOrderInvoiceEntity : ioOrderInvoiceEntityList) {
|
|
|
|
|
ioOrderInvoiceEntity.setInvoiceDate(ioOrderInvoice.getInvoiceDate());
|
|
|
|
|
ioOrderInvoiceEntity.setPrice(ioOrderInvoice.getPrice());
|
|
|
|
|
ioOrderInvoiceEntity.setLicenseUrl(ioOrderInvoice.getLicenseUrl());
|
|
|
|
|
ioOrderInvoiceEntity.setRemark(ioOrderInvoice.getRemark());
|
|
|
|
|
ioOrderInvoiceEntity.setMachineNo(ioOrderInvoice.getMachineNo());
|
|
|
|
|
ioOrderInvoiceEntity.setInvoiceCode(ioOrderInvoice.getInvoiceCode());
|
|
|
|
|
ioOrderInvoiceEntity.setUpdateTime(new Date());
|
|
|
|
|
}
|
|
|
|
|
ioOrderInvoiceService.updateBatchById(ioOrderInvoiceEntityList);
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success("成功");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
|
|
|
@PostMapping("/udiwms/inout/invoice/deleteInvoiceByOrderFk")
|
|
|
|
|
@Log(title = "发票删除", businessType = BusinessType.DELETE)
|
|
|
|
|
public BaseResponse deleteInvoiceByOrderFk(@RequestBody DeleteRequest deleteRequest) {
|
|
|
|
|
if (StrUtil.isEmpty(deleteRequest.getInvoiceEncode()))
|
|
|
|
|
return ResultVOUtils.error(500, "发票编码不能为空");
|
|
|
|
|
|
|
|
|
|
boolean b = ioOrderInvoiceService.remove(new QueryWrapper<IoOrderInvoiceEntity>().eq("invoiceEncode", deleteRequest.getInvoiceEncode()).eq("orderIdFk",deleteRequest.getBillNo()));
|
|
|
|
|
if (b)
|
|
|
|
|
return ResultVOUtils.success("删除成功!");
|
|
|
|
|
else
|
|
|
|
|
return ResultVOUtils.error(500, "删除失败!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|