|
@@ -60,9 +60,6 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private DfsConfig dfsConfig;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
private MajorProductionMapper majorProductionMapper;
|
|
private MajorProductionMapper majorProductionMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -78,9 +75,6 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
|
|
private IFinanceClaimService financeClaimService;
|
|
private IFinanceClaimService financeClaimService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private IFinanceRealFundService financeRealFundService;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
private OrderFundMapper orderFundMapper;
|
|
private OrderFundMapper orderFundMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -105,6 +99,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
|
|
private IBusinessProductionService businessProductionService;
|
|
private IBusinessProductionService businessProductionService;
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
public List<MajorProduction> selectPage(MajorProduction majorProduction){
|
|
public List<MajorProduction> selectPage(MajorProduction majorProduction){
|
|
@@ -385,70 +380,83 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
|
|
return Boolean.FALSE;
|
|
return Boolean.FALSE;
|
|
}
|
|
}
|
|
|
|
|
|
- //再校验产品分配金额是否大于订单认领金额
|
|
|
|
-// List<FinanceClaim> financeClaims = new ArrayList<>();
|
|
|
|
for (OrderReportDTO orderReportDTO : claimOrders){
|
|
for (OrderReportDTO orderReportDTO : claimOrders){
|
|
BigDecimal thisTimeAmount = orderReportDTO.getThisTimeAmount();
|
|
BigDecimal thisTimeAmount = orderReportDTO.getThisTimeAmount();
|
|
- BigDecimal realAmount = orderFundMapper.selectById(orderReportDTO.getOrderFundId()).getRealAmount();
|
|
|
|
- if (realAmount ==null){
|
|
|
|
- realAmount = BigDecimal.ZERO;
|
|
|
|
|
|
+ Long productionFundId = orderReportDTO.getProductionFundId();
|
|
|
|
+ if (productionFundId==null){
|
|
|
|
+ MajorProduction production = majorProductionMapper.selectOne(new LambdaQueryWrapper<MajorProduction>().eq(BaseEntity::getId,orderReportDTO.getId()).eq(BaseEntity::getDeleted, Boolean.FALSE)
|
|
|
|
+ .select(MajorProduction::getReportNo, MajorProduction::getMajorId, MajorProduction::getProduction, MajorProduction::getEvaluateAmount));
|
|
|
|
+ ProductionFund productionFund = new ProductionFund();
|
|
|
|
+ productionFund.setProductionType(production.getProduction());
|
|
|
|
+ productionFund.setBusinessType(MainBusinessEnum.MAJOR_BUSINESS.name());
|
|
|
|
+ productionFund.setOrderFundId(orderReportDTO.getOrderFundId());
|
|
|
|
+ productionFund.setBusinessId(production.getMajorId());
|
|
|
|
+ productionFund.setProductionNo(production.getReportNo());
|
|
|
|
+ productionFund.setRealAmount(orderReportDTO.getThisTimeAmount());
|
|
|
|
+ productionFund.setEvaluateAmount(production.getEvaluateAmount());
|
|
|
|
+ productionFundService.add(productionFund);
|
|
|
|
+ productionFundId = productionFund.getId();
|
|
|
|
+ }else {
|
|
|
|
+ productionFundMapper.updateRealAmount(productionFundId,orderReportDTO.getThisTimeAmount());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //更新订单实收款
|
|
Long orderFundId = orderReportDTO.getOrderFundId();
|
|
Long orderFundId = orderReportDTO.getOrderFundId();
|
|
|
|
+ orderFundMapper.updateRealAmount(orderFundId, thisTimeAmount);
|
|
|
|
|
|
//插入订单认领流水表
|
|
//插入订单认领流水表
|
|
FinanceClaim financeClaim = new FinanceClaim();
|
|
FinanceClaim financeClaim = new FinanceClaim();
|
|
- if (thisTimeAmount.compareTo(BigDecimal.ZERO)>0){
|
|
|
|
- Long userId = LoginContext.getCurrentUserId();
|
|
|
|
- financeClaim.setClaimUserId(userId);
|
|
|
|
- financeClaim.setRealFundId(financeFundId);
|
|
|
|
- financeClaim.setOrderFundId(orderFundId);
|
|
|
|
- financeClaim.setClaimAmount(thisTimeAmount);
|
|
|
|
- financeClaim.setClaimDatetime(LocalDateTime.now());
|
|
|
|
- //financeClaims.add(financeClaim);
|
|
|
|
- financeClaimService.add(financeClaim);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- BigDecimal targetAmount = realAmount.add(thisTimeAmount);
|
|
|
|
|
|
+ Long userId = LoginContext.getCurrentUserId();
|
|
|
|
+ financeClaim.setClaimUserId(userId);
|
|
|
|
+ financeClaim.setRealFundId(financeFundId);
|
|
|
|
+ financeClaim.setOrderFundId(orderFundId);
|
|
|
|
+ financeClaim.setClaimAmount(thisTimeAmount);
|
|
|
|
+ financeClaim.setClaimDatetime(LocalDateTime.now());
|
|
|
|
+ financeClaim.setProductionFundId(productionFundId);
|
|
|
|
+ financeClaimService.add(financeClaim);
|
|
|
|
+ }
|
|
|
|
+ return Boolean.TRUE;
|
|
|
|
+ }
|
|
|
|
+ return Boolean.FALSE;
|
|
|
|
+ }
|
|
|
|
|
|
- List<ReportDTO> reports = orderReportDTO.getReports();
|
|
|
|
|
|
|
|
- if (CollectionUtil.isNotEmpty(reports)){
|
|
|
|
- BigDecimal reduce = reports.stream().filter(x->x.getRealAmount()!=null).map(ReportDTO::getRealAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
- if (reduce.compareTo(targetAmount)>0){
|
|
|
|
- ErrorCode.throwBusinessException(ErrorCode.P_AMOUNT_BIGGER_O_AMOUNT,orderReportDTO.getOrderId());
|
|
|
|
- return Boolean.FALSE;
|
|
|
|
- }
|
|
|
|
- //创建产品收款记录
|
|
|
|
- for (ReportDTO reportDTO : reports){
|
|
|
|
- // if (reportDTO.getProductionFundId()==null){
|
|
|
|
- MajorProduction production = majorProductionMapper.selectOne(new LambdaQueryWrapper<MajorProduction>().eq(BaseEntity::getId,reportDTO.getId()).eq(BaseEntity::getDeleted, Boolean.FALSE)
|
|
|
|
- .select(MajorProduction::getReportNo, MajorProduction::getMajorId, MajorProduction::getProduction, MajorProduction::getEvaluateAmount));
|
|
|
|
- ProductionFund productionFund = new ProductionFund();
|
|
|
|
- productionFund.setProductionType(production.getProduction());
|
|
|
|
- productionFund.setBusinessType(MainBusinessEnum.MAJOR_BUSINESS.name());
|
|
|
|
- productionFund.setOrderFundId(orderReportDTO.getOrderFundId());
|
|
|
|
- productionFund.setBusinessId(production.getMajorId());
|
|
|
|
- productionFund.setProductionNo(production.getReportNo());
|
|
|
|
- productionFund.setRealAmount(reportDTO.getRealAmount());
|
|
|
|
- productionFund.setEvaluateAmount(reportDTO.getEvaluateAmount());
|
|
|
|
- productionFundService.add(productionFund);
|
|
|
|
- // }
|
|
|
|
-// else {
|
|
|
|
-// productionFundService.update(new LambdaUpdateWrapper<ProductionFund>().set(ProductionFund::getRealAmount,reportDTO.getRealAmount()).eq(BaseEntity::getId,reportDTO.getProductionFundId()));
|
|
|
|
-// }
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public synchronized Boolean allotRealAmountToOrder(List<OrderReportDTO> claimOrders) {
|
|
|
|
+ return majorProductionService.doAllotRealAmountToOrder(claimOrders);
|
|
|
|
+ }
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean doAllotRealAmountToOrder(List<OrderReportDTO> claimOrders) {
|
|
|
|
+ if (CollectionUtil.isNotEmpty(claimOrders)){
|
|
|
|
+ //先校验各订单此次认领金额之和是否大于这笔实收款的剩余金额
|
|
|
|
+ Long financeFundId = claimOrders.get(0).getFinanceFundId();
|
|
|
|
+ BigDecimal residueAmount = financeClaimService.checkFinanceFound(financeFundId);
|
|
|
|
+ BigDecimal thisTimeTotalAmount = claimOrders.stream().map(OrderReportDTO::getThisTimeAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
+ if (thisTimeTotalAmount.compareTo(residueAmount)>0){
|
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR,"本次订单认领之和大于实收款剩余金额,请检查后再认领。");
|
|
|
|
+ return Boolean.FALSE;
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
- //更新订单收款变实收款金额
|
|
|
|
|
|
+ for (OrderReportDTO orderReportDTO : claimOrders){
|
|
|
|
+ BigDecimal thisTimeAmount = orderReportDTO.getThisTimeAmount();
|
|
|
|
+ //更新订单实收款
|
|
|
|
+ Long orderFundId = orderReportDTO.getOrderFundId();
|
|
orderFundMapper.updateRealAmount(orderFundId, thisTimeAmount);
|
|
orderFundMapper.updateRealAmount(orderFundId, thisTimeAmount);
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ //插入订单认领流水表
|
|
|
|
+ FinanceClaim financeClaim = new FinanceClaim();
|
|
|
|
+ Long userId = LoginContext.getCurrentUserId();
|
|
|
|
+ financeClaim.setClaimUserId(userId);
|
|
|
|
+ financeClaim.setRealFundId(financeFundId);
|
|
|
|
+ financeClaim.setOrderFundId(orderFundId);
|
|
|
|
+ financeClaim.setClaimAmount(thisTimeAmount);
|
|
|
|
+ financeClaim.setClaimDatetime(LocalDateTime.now());
|
|
|
|
+ financeClaimService.add(financeClaim);
|
|
|
|
+ }
|
|
return Boolean.TRUE;
|
|
return Boolean.TRUE;
|
|
}
|
|
}
|
|
return Boolean.FALSE;
|
|
return Boolean.FALSE;
|
|
}
|
|
}
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public Page<TaskTodoVO> todoSaveFilePage(Page page, TaskTodoVO todoVO,String keyword) {
|
|
public Page<TaskTodoVO> todoSaveFilePage(Page page, TaskTodoVO todoVO,String keyword) {
|
|
todoVO.setHandlerId(LoginContext.getCurrentUserId());
|
|
todoVO.setHandlerId(LoginContext.getCurrentUserId());
|
|
@@ -537,6 +545,7 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
|
|
return Boolean.FALSE;
|
|
return Boolean.FALSE;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Page<MajorProductionPerformanceVO> performanceAllotPage(Page page, MajorProductionPerformanceVO productionPerformance) {
|
|
public Page<MajorProductionPerformanceVO> performanceAllotPage(Page page, MajorProductionPerformanceVO productionPerformance) {
|
|
Page<MajorProductionPerformanceVO> result = majorProductionMapper.performanceAllotPage(page,productionPerformance,LoginContext.getCurrentUserId());
|
|
Page<MajorProductionPerformanceVO> result = majorProductionMapper.performanceAllotPage(page,productionPerformance,LoginContext.getCurrentUserId());
|
|
@@ -550,6 +559,8 @@ public class MajorProductionServiceImpl extends ServiceImpl<MajorProductionMappe
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Boolean repertoryIn(TaskRecordDTO<Long> taskRecordDTO) {
|
|
public Boolean repertoryIn(TaskRecordDTO<Long> taskRecordDTO) {
|
|
Long productionId = taskRecordDTO.getTaskData();
|
|
Long productionId = taskRecordDTO.getTaskData();
|