From c57e232dfbf1b0e3617f5f741f609d413623efea Mon Sep 17 00:00:00 2001 From: anthonywj Date: Thu, 8 Jun 2023 18:22:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E7=A5=A8=E9=97=AE=E9=A2=98=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inout/IoOrderDetailBizController.java | 11 ++----- .../service/inout/IoChangeInoutService.java | 1 - .../service/inout/IoCheckInoutService.java | 8 ++++- .../service/inout/IoOrderInvoiceService.java | 4 +++ .../inout/impl/IoOrderInvoiceServiceImpl.java | 30 +++++++++++++++++++ .../mapper/inout/IoOrderDetailBizDao.xml | 24 +++++++-------- .../mapper/inout/IoOrderInvoiceMapper.xml | 12 +++----- 7 files changed, 59 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java index 0860edec..5f78b08a 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderDetailBizController.java @@ -590,7 +590,7 @@ public class IoOrderDetailBizController extends BaseController { List ioOrderInvoiceResponses = orderDetailBizService.filterListInv(filterOrderDetailBizRequest1); if (list.size() == 0) { ioOrderDetailBizEntity.setRegStatus(false); - }else{ + } else { ioOrderDetailBizEntity.setRegStatus(true); } orderDetailCodeService.updateOrderDetailBiz(ioOrderDetailBizEntity); @@ -683,12 +683,7 @@ public class IoOrderDetailBizController extends BaseController { public BaseResponse updateorderBiz(@RequestBody InvoiceRequest invoiceRequest) { String billNo = null; for (IoOrderDetailCodeEntity ioOrderDetailBizEntity : invoiceRequest.getList()) { - if("key".equals(invoiceRequest.getKey())){ - ioOrderDetailBizEntity.setRegStatus(false); - }else{ - ioOrderDetailBizEntity.setRegStatus(true); - } - orderDetailCodeService.updateOrderDetailBiz(ioOrderDetailBizEntity); + ioOrderInvoiceService.updateRegStatus(ioOrderDetailBizEntity); billNo = ioOrderDetailBizEntity.getOrderIdFk(); } IoOrderEntity orderEntity = orderService.findByBillNo(billNo); @@ -707,7 +702,7 @@ public class IoOrderDetailBizController extends BaseController { */ @GetMapping("/udiwms/inout/bizDetail/filterBizOrderList") public BaseResponse filterBizOrderList(FilterOrderDetailCodeRequest orderDetailBizRequest) { - List ioOrderDetailCodeResponses = orderDetailBizService.getfilterList(orderDetailBizRequest); + List ioOrderDetailCodeResponses = orderDetailBizService.getfilterOrderList(orderDetailBizRequest); for (IoOrderDetailCodeResponse ioOrderDetailCodeRespons : ioOrderDetailCodeResponses) { if (ioOrderDetailCodeRespons.getReCount() != 0 && ioOrderDetailCodeRespons.getPrice() != null) { ioOrderDetailCodeRespons.setAmount(new BigDecimal(ioOrderDetailCodeRespons.getReCount()).multiply(ioOrderDetailCodeRespons.getPrice())); diff --git a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java index 6748597f..b9b4c649 100644 --- a/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoChangeInoutService.java @@ -281,7 +281,6 @@ public class IoChangeInoutService { } } } - //根据单据设置状态 1:草稿 if (bussinessChangeTypeEntity.getAuditStatus() == 1) { orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE); diff --git a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java index 2cfdc022..28a84ce7 100644 --- a/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoCheckInoutService.java @@ -350,6 +350,9 @@ public class IoCheckInoutService { checkThird(orderEntity); } + @Resource + IoOrderInvoiceService orderInvoiceService; + //一次校验完成 public void checkFirstFinish(IoOrderEntity orderEntity) { @@ -420,6 +423,7 @@ public class IoCheckInoutService { bizEntity.setCheckSuccess(true); codeEntity.setCheckSuccess(true); codeEntity.setPrice(bizEntity.getPrice()); + orderInvoiceService.updateRegStatus(codeEntity); } break; } @@ -448,7 +452,7 @@ public class IoCheckInoutService { orderDetailResultService.insert(orderDetailResultEntity); } - orderDetailCodeDao.updateBatchById(orderDetailCodeEntities); +// orderDetailCodeDao.updateBatchById(orderDetailCodeEntities); //临时表转正式表 List codeTempEntities = codeTempService.findByOrderId(orderEntity.getBillNo()); @@ -1029,4 +1033,6 @@ public class IoCheckInoutService { } return bizEntity.getCoName() + "数量不匹配!"; } + + } diff --git a/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java b/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java index ed597467..74dc0e40 100644 --- a/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java +++ b/src/main/java/com/glxp/api/service/inout/IoOrderInvoiceService.java @@ -2,6 +2,7 @@ package com.glxp.api.service.inout; import com.baomidou.mybatisplus.extension.service.IService; import com.glxp.api.entity.inout.IoCodeRelEntity; +import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; import com.glxp.api.entity.inout.IoOrderInvoiceEntity; import com.glxp.api.req.inout.IoOrderInvoiceRequest; @@ -20,5 +21,8 @@ public interface IoOrderInvoiceService extends IService { List selectOrderInvoice(IoOrderInvoiceRequest ioOrderInvoiceRequest); + // 更新发票状态 + boolean updateRegStatus(IoOrderDetailCodeEntity orderDetailCodeEntity); + } diff --git a/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java b/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java index 1e626ac5..b3b0a0dd 100644 --- a/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java +++ b/src/main/java/com/glxp/api/service/inout/impl/IoOrderInvoiceServiceImpl.java @@ -1,10 +1,13 @@ package com.glxp.api.service.inout.impl; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.glxp.api.dao.inout.IoCodeRelMapper; +import com.glxp.api.dao.inout.IoOrderDetailCodeDao; import com.glxp.api.dao.inout.IoOrderInvoiceMapper; import com.glxp.api.entity.inout.IoCodeRelEntity; +import com.glxp.api.entity.inout.IoOrderDetailCodeEntity; import com.glxp.api.entity.inout.IoOrderInvoiceEntity; import com.glxp.api.req.inout.IoOrderInvoiceRequest; import org.springframework.beans.BeanUtils; @@ -14,6 +17,7 @@ import com.glxp.api.service.inout.IoOrderInvoiceService; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.math.BigDecimal; import java.util.Date; import java.util.List; @@ -22,6 +26,8 @@ import java.util.List; public class IoOrderInvoiceServiceImpl extends ServiceImpl implements IoOrderInvoiceService { @Resource IoOrderInvoiceMapper ioOrderInvoiceMapper; + @Resource + IoOrderDetailCodeDao orderDetailCodeDao; @Override public List findByBillNo(String orderIdFk) { @@ -51,4 +57,28 @@ public class IoOrderInvoiceServiceImpl extends ServiceImpl selectOrderInvoice(IoOrderInvoiceRequest ioOrderInvoiceRequest) { return ioOrderInvoiceMapper.selectOrderInvoice(ioOrderInvoiceRequest); } + + @Override + public boolean updateRegStatus(IoOrderDetailCodeEntity orderDetailCodeEntity) { + IoOrderInvoiceRequest orderInvoiceRequest = new IoOrderInvoiceRequest(); + orderInvoiceRequest.setBatchNo(orderDetailCodeEntity.getBatchNo()); + orderInvoiceRequest.setBindRlFk(orderDetailCodeEntity.getBindRlFk() + ""); + List orderInvoiceEntities = selectOrderInvoice(orderInvoiceRequest); + if (CollUtil.isNotEmpty(orderInvoiceEntities)) { +// BigDecimal amount = new BigDecimal(0.00); +// for (IoOrderInvoiceEntity orderInvoiceEntity : orderInvoiceEntities) { +// amount = amount.add(new BigDecimal(orderInvoiceEntity.getPrice())); +// } +// if (amount.compareTo(orderDetailCodeEntity.getPrice()) == 0) { +// orderDetailCodeEntity.setRegStatus(true); +// } else { +// orderDetailCodeEntity.setRegStatus(false); +// } + orderDetailCodeEntity.setRegStatus(true); + } else { + orderDetailCodeEntity.setRegStatus(false); + } + orderDetailCodeDao.updateById(orderDetailCodeEntity); + return true; + } } diff --git a/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml b/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml index 6da20521..90dec082 100644 --- a/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml +++ b/src/main/resources/mybatis/mapper/inout/IoOrderDetailBizDao.xml @@ -50,10 +50,10 @@ - + select * + from io_order_invoice + where id = #{id} select io_order_detail_code.*, - (select count(*) - FROM io_order_invoice - where io_order_invoice.orderIdFk = io_order_detail_code.orderIdFk) as sucCount + (select count(*) + FROM io_order_invoice + where io_order_invoice.orderIdFk = io_order_detail_code.orderIdFk) as sucCount from io_order_detail_code @@ -126,11 +128,7 @@ AND batchNo = #{batchNo} - - AND bp.cpmctymc like concat('%', #{productName}, '%') - group by io_order_detail_code.id - diff --git a/src/main/resources/mybatis/mapper/inout/IoOrderInvoiceMapper.xml b/src/main/resources/mybatis/mapper/inout/IoOrderInvoiceMapper.xml index f60f7cf2..3cc52948 100644 --- a/src/main/resources/mybatis/mapper/inout/IoOrderInvoiceMapper.xml +++ b/src/main/resources/mybatis/mapper/inout/IoOrderInvoiceMapper.xml @@ -12,15 +12,11 @@