|
|
@@ -1189,7 +1189,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
}
|
|
|
|
|
|
//增加审批类型
|
|
|
- auditProecessDTO.setProcessType("退单审批");
|
|
|
+ auditProecessDTO.setProcessType("销售退单");
|
|
|
|
|
|
LambdaQueryWrapper<OrderItems> orderItemsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
orderItemsLambdaQueryWrapper
|
|
|
@@ -1533,11 +1533,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
throw new SecurityException("撤销失败: " + oneStock.getCode() + "更新库存失败");
|
|
|
}
|
|
|
|
|
|
- //删除明细
|
|
|
- int res = orderItemsMapper.deleteById(e.getId());
|
|
|
- if (res != 1) {
|
|
|
- throw new SecurityException("撤销失败,明细错误");
|
|
|
- }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -1555,32 +1550,28 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
basicCorpsProfitChange.setCreateUser(AuthUtil.getUserId());
|
|
|
// 有返利
|
|
|
if (orderMessage.getThisUsedProfit() != null && orderMessage.getThisUsedProfit().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- // 增加客户的已用返利
|
|
|
+ // 减少客户的已用返利
|
|
|
basicCorpsProfitChange.setChangeUsedProfit(orderMessage.getThisUsedProfit());
|
|
|
- // 减少客户的可用返利
|
|
|
+ // 增加客户的可用返利
|
|
|
basicCorpsProfitChange.setChangeSurplusProfit(orderMessage.getThisUsedProfit().negate());
|
|
|
}
|
|
|
// 检查是否含有产生返利,如果有, 需要增加客户的本月待到账返利
|
|
|
if (orderMessage.getCreateProfit() != null && orderMessage.getCreateProfit().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- // 增加客户的月返利
|
|
|
+ // 减少客户的月返利
|
|
|
basicCorpsProfitChange.setChangeMonthProfit(orderMessage.getCreateProfit());
|
|
|
|
|
|
}
|
|
|
- // 新增返利变动记录
|
|
|
- R save = corpsProfitChangeClient.save(basicCorpsProfitChange);
|
|
|
- if (!save.isSuccess()) {
|
|
|
- throw new SecurityException("保存返利变动记录失败");
|
|
|
- }
|
|
|
+
|
|
|
// 修改客户返利
|
|
|
R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(orderMessage.getCorpId());
|
|
|
if (!corpMessage.isSuccess() || corpMessage.getData() == null) {
|
|
|
throw new SecurityException("未查到客户记录");
|
|
|
}
|
|
|
CorpsDesc corpsDesc = corpMessage.getData();
|
|
|
- corpsDesc.setProfitReturn(basicCorpsProfitChange.getChangeProfitReturn() == null ? new BigDecimal("0").subtract(corpsDesc.getProfitReturn()) : basicCorpsProfitChange.getChangeProfitReturn().subtract(corpsDesc.getProfitReturn()));
|
|
|
- corpsDesc.setUsedProfit(basicCorpsProfitChange.getChangeUsedProfit() == null ? new BigDecimal("0").subtract(corpsDesc.getUsedProfit()) : basicCorpsProfitChange.getChangeUsedProfit().subtract(corpsDesc.getUsedProfit()));
|
|
|
- corpsDesc.setSurplusProfit(basicCorpsProfitChange.getChangeSurplusProfit() == null ? new BigDecimal("0").subtract(corpsDesc.getSurplusProfit()) : basicCorpsProfitChange.getChangeSurplusProfit().subtract(corpsDesc.getSurplusProfit()));
|
|
|
- corpsDesc.setMonthProfit(basicCorpsProfitChange.getChangeMonthProfit() == null ? new BigDecimal("0").subtract(corpsDesc.getMonthProfit()) : basicCorpsProfitChange.getChangeMonthProfit().subtract(corpsDesc.getMonthProfit()));
|
|
|
+ corpsDesc.setProfitReturn(basicCorpsProfitChange.getChangeProfitReturn() == null ? corpsDesc.getProfitReturn().subtract(new BigDecimal("0")) : corpsDesc.getProfitReturn().subtract(basicCorpsProfitChange.getChangeProfitReturn()));
|
|
|
+ corpsDesc.setUsedProfit(basicCorpsProfitChange.getChangeUsedProfit() == null ? corpsDesc.getUsedProfit().subtract(new BigDecimal("0")) : corpsDesc.getUsedProfit().subtract(basicCorpsProfitChange.getChangeUsedProfit()));
|
|
|
+ corpsDesc.setSurplusProfit(basicCorpsProfitChange.getChangeSurplusProfit() == null ? corpsDesc.getSurplusProfit().subtract(new BigDecimal("0")) : corpsDesc.getSurplusProfit().subtract(basicCorpsProfitChange.getChangeSurplusProfit()));
|
|
|
+ corpsDesc.setMonthProfit(basicCorpsProfitChange.getChangeMonthProfit() == null ? corpsDesc.getMonthProfit().subtract(new BigDecimal("0")) : corpsDesc.getMonthProfit().subtract(basicCorpsProfitChange.getChangeMonthProfit()));
|
|
|
|
|
|
if (corpsDesc.getProfitReturn().compareTo(new BigDecimal("0")) < 0) {
|
|
|
throw new SecurityException("修改客户返利失败:总返利不能为负数");
|
|
|
@@ -1599,12 +1590,36 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
if (!corpsUpdate.isSuccess()) {
|
|
|
throw new SecurityException("更新客户返利信息失败");
|
|
|
}
|
|
|
+
|
|
|
+ basicCorpsProfitChange.setChangeUsedProfit(orderMessage.getThisUsedProfit().negate());
|
|
|
+ basicCorpsProfitChange.setChangeSurplusProfit(orderMessage.getThisUsedProfit());
|
|
|
+ basicCorpsProfitChange.setChangeMonthProfit(orderMessage.getCreateProfit().negate());
|
|
|
+
|
|
|
+ // 新增返利变动记录
|
|
|
+ R save = corpsProfitChangeClient.save(basicCorpsProfitChange);
|
|
|
+ if (!save.isSuccess()) {
|
|
|
+ throw new SecurityException("保存返利变动记录失败");
|
|
|
+ }
|
|
|
}
|
|
|
/**===========================End撤销操作返利信息=============================*/
|
|
|
|
|
|
+ //删除账单明细
|
|
|
+ Acc acc = financeClient.selectByParentId(orderMessage.getId());
|
|
|
+ if (ObjectUtil.isNotEmpty(acc)){
|
|
|
+ financeClient.remove(acc.getId().toString());
|
|
|
+ }
|
|
|
+
|
|
|
//删除审批记录
|
|
|
iCheckClient.deteleByBillId(orderMessage.getId());
|
|
|
orderMessage.setStatus(0);
|
|
|
+ orderMessage.setCreatePurchase(0);
|
|
|
+ orderMessage.setCreatePurchaseName("否");
|
|
|
+ orderMessage.setCreatePurchaseUser("");
|
|
|
+ orderMessage.setCreatePurchaseTime(null);
|
|
|
+ orderMessage.setCreateFreight(0);
|
|
|
+ orderMessage.setCreateFreightName("否");
|
|
|
+ orderMessage.setCreateFreightUser("");
|
|
|
+ orderMessage.setCreateFreightTime(null);
|
|
|
orderMessage.setOrderStatus(OrderStatusEnum.ENTERING.getType());
|
|
|
orderMessage.setChargebackStatus(3);
|
|
|
baseMapper.updateById(orderMessage);
|