订单变更问题修改

This commit is contained in:
z 2025-01-15 09:28:49 +08:00
parent 21b00913ed
commit 83a96ad0bd

View File

@ -194,16 +194,16 @@ public class ProjectOrderServiceImpl implements ProjectOrderService {
LambdaQueryWrapper<OrderYsDO> eq = new LambdaQueryWrapper<OrderYsDO>().eq(OrderYsDO::getCode, updateReqVO.getCode()); LambdaQueryWrapper<OrderYsDO> eq = new LambdaQueryWrapper<OrderYsDO>().eq(OrderYsDO::getCode, updateReqVO.getCode());
OrderYsDO orderYsDO = orderYsMapper.selectOne(eq); 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 = new OrderYsDO();
orderYsDO.setCode(updateReqVO.getCode()); orderYsDO.setCode(updateReqVO.getCode());
orderYsDO.setProjectName(updateReqVO.getProjectName()); orderYsDO.setProjectName(updateReqVO.getProjectName());
orderYsDO.setCgTime(LocalDateTime.now()); orderYsDO.setCgTime(LocalDateTime.now());
orderYsDO.setCgKhname(customerService.getCustomer(updateReqVO.getCustomerId()).getName()); orderYsDO.setCgKhname(customerService.getCustomer(updateReqVO.getCustomerId()).getName());
if(updateReqVO.getPrice()==null){ if (updateReqVO.getPrice() == null) {
orderYsDO.setCgYs(new BigDecimal(0)); orderYsDO.setCgYs(new BigDecimal(0));
}else { } else {
orderYsDO.setCgYs(updateReqVO.getPrice()); orderYsDO.setCgYs(updateReqVO.getPrice());
LocalDateTime[] paymentTimes = { LocalDateTime[] paymentTimes = {
updateReqVO.getSixFuKuanTime(), updateReqVO.getSixFuKuanTime(),
@ -220,28 +220,30 @@ public class ProjectOrderServiceImpl implements ProjectOrderService {
} }
} }
} }
} orderYsMapper.insert(orderYsDO);
orderYsMapper.insert(orderYsDO); } else {
}else { orderYsDO.setCgYs(updateReqVO.getPrice());
orderYsDO.setCgYs(updateReqVO.getPrice()); LocalDateTime[] paymentTimes = {
LocalDateTime[] paymentTimes = { updateReqVO.getSixFuKuanTime(),
updateReqVO.getSixFuKuanTime(), updateReqVO.getFiveFuKuanTime(),
updateReqVO.getFiveFuKuanTime(), updateReqVO.getFourFuKuanTime(),
updateReqVO.getFourFuKuanTime(), updateReqVO.getThreeFuKuanTime(),
updateReqVO.getThreeFuKuanTime(), updateReqVO.getTwoFuKuanTime(),
updateReqVO.getTwoFuKuanTime(), updateReqVO.getShouFuKuanTime()
updateReqVO.getShouFuKuanTime() };
}; for (LocalDateTime paymentTime : paymentTimes) {
for (LocalDateTime paymentTime : paymentTimes) { if (!ObjectUtil.isEmpty(paymentTime)) {
if (!ObjectUtil.isEmpty(paymentTime)) { orderYsDO.setPaymentDate(paymentTime);
orderYsDO.setPaymentDate(paymentTime); break;
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 @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -516,6 +518,7 @@ public class ProjectOrderServiceImpl implements ProjectOrderService {
}else{ }else{
if ("ALTER".equals(operateReqVO.getActive())){ if ("ALTER".equals(operateReqVO.getActive())){
updateProjectOrderPrice(operateReqVO); updateProjectOrderPrice(operateReqVO);
updateProjectOrder(operateReqVO);
}else { }else {
updateProjectOrder(operateReqVO); updateProjectOrder(operateReqVO);
} }