diff --git a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java index 2b6d774..b5c75b4 100644 --- a/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java +++ b/mes-module-heli/mes-module-heli-biz/src/main/java/com/chanko/yunxi/mes/module/heli/service/projectorder/ProjectOrderServiceImpl.java @@ -194,16 +194,16 @@ public class ProjectOrderServiceImpl implements ProjectOrderService { LambdaQueryWrapper eq = new LambdaQueryWrapper().eq(OrderYsDO::getCode, updateReqVO.getCode()); OrderYsDO orderYsDO = orderYsMapper.selectOne(eq); - if (ObjectUtil.isEmpty(orderYsDO)){ - if (updateReqVO.getHasPrice().equals(1)) { + if (updateReqVO.getHasPrice().equals(1)) { + if (ObjectUtil.isEmpty(orderYsDO)) { orderYsDO = new OrderYsDO(); orderYsDO.setCode(updateReqVO.getCode()); orderYsDO.setProjectName(updateReqVO.getProjectName()); orderYsDO.setCgTime(LocalDateTime.now()); orderYsDO.setCgKhname(customerService.getCustomer(updateReqVO.getCustomerId()).getName()); - if(updateReqVO.getPrice()==null){ + if (updateReqVO.getPrice() == null) { orderYsDO.setCgYs(new BigDecimal(0)); - }else { + } else { orderYsDO.setCgYs(updateReqVO.getPrice()); LocalDateTime[] paymentTimes = { updateReqVO.getSixFuKuanTime(), @@ -220,28 +220,30 @@ public class ProjectOrderServiceImpl implements ProjectOrderService { } } } - } - orderYsMapper.insert(orderYsDO); - }else { - orderYsDO.setCgYs(updateReqVO.getPrice()); - LocalDateTime[] paymentTimes = { - updateReqVO.getSixFuKuanTime(), - updateReqVO.getFiveFuKuanTime(), - updateReqVO.getFourFuKuanTime(), - updateReqVO.getThreeFuKuanTime(), - updateReqVO.getTwoFuKuanTime(), - updateReqVO.getShouFuKuanTime() - }; - for (LocalDateTime paymentTime : paymentTimes) { - if (!ObjectUtil.isEmpty(paymentTime)) { - orderYsDO.setPaymentDate(paymentTime); - break; + orderYsMapper.insert(orderYsDO); + } else { + orderYsDO.setCgYs(updateReqVO.getPrice()); + LocalDateTime[] paymentTimes = { + updateReqVO.getSixFuKuanTime(), + updateReqVO.getFiveFuKuanTime(), + updateReqVO.getFourFuKuanTime(), + updateReqVO.getThreeFuKuanTime(), + updateReqVO.getTwoFuKuanTime(), + updateReqVO.getShouFuKuanTime() + }; + for (LocalDateTime paymentTime : paymentTimes) { + if (!ObjectUtil.isEmpty(paymentTime)) { + orderYsDO.setPaymentDate(paymentTime); + break; + } } + orderYsMapper.updateById(orderYsDO); + } + }else{ + if (ObjectUtil.isNotEmpty(orderYsDO)) { + orderYsMapper.deleteById(orderYsDO.getId()); } - orderYsMapper.updateById(orderYsDO); } - ProjectOrderDO updateObj = BeanUtils.toBean(updateReqVO, ProjectOrderDO.class); - projectOrderMapper.updateById(updateObj); } @Override @Transactional(rollbackFor = Exception.class) @@ -516,6 +518,7 @@ public class ProjectOrderServiceImpl implements ProjectOrderService { }else{ if ("ALTER".equals(operateReqVO.getActive())){ updateProjectOrderPrice(operateReqVO); + updateProjectOrder(operateReqVO); }else { updateProjectOrder(operateReqVO); }