|
@@ -107,81 +107,102 @@ public class ContractAppServiceImpl implements ContractAppService {
|
|
List<TaskDTO> taskDTOList = new ArrayList<>();
|
|
List<TaskDTO> taskDTOList = new ArrayList<>();
|
|
List<TaskDTO> taskDTOList1 = new ArrayList<>();
|
|
List<TaskDTO> taskDTOList1 = new ArrayList<>();
|
|
Double sumTotal = 0.00;
|
|
Double sumTotal = 0.00;
|
|
|
|
+ Double sumTotalClose = 0.00;
|
|
Float sumNet = 0f;
|
|
Float sumNet = 0f;
|
|
Double payMoney = 0.00;
|
|
Double payMoney = 0.00;
|
|
Float sumNetClose = 0f;
|
|
Float sumNetClose = 0f;
|
|
|
|
+ Float payNotMoneyClose = 0f;
|
|
Double payMoneyClose = 0.00;
|
|
Double payMoneyClose = 0.00;
|
|
// 采购交易
|
|
// 采购交易
|
|
if (tradeDO.getType() == 1) {
|
|
if (tradeDO.getType() == 1) {
|
|
|
|
|
|
List<BuyReportDO> buyReportDOS = buyReportMapper.selectList(new EntityWrapper<BuyReportDO>().eq("contract_no", contractNo));
|
|
List<BuyReportDO> buyReportDOS = buyReportMapper.selectList(new EntityWrapper<BuyReportDO>().eq("contract_no", contractNo));
|
|
for(BuyReportDO buyReportDO : buyReportDOS){
|
|
for(BuyReportDO buyReportDO : buyReportDOS){
|
|
- if(buyReportDO.getBuy() > 0){
|
|
|
|
- // 查询任务表
|
|
|
|
- List<TaskDO> taskDOList = taskMapper.selectList(new EntityWrapper<TaskDO>().eq("report_id", buyReportDO.getReportId()));
|
|
|
|
- if (CollectionUtils.isNotEmpty(taskDOList)) {
|
|
|
|
- for (TaskDO taskDO : taskDOList) {
|
|
|
|
- TaskDTO taskDTO = new TaskDTO();
|
|
|
|
- // 查询统计表
|
|
|
|
- BuyReportDO buyReportDO = buyReportMapper.selectById(taskDO.getReportId());
|
|
|
|
- if (buyReportDO != null) {
|
|
|
|
- // 结算单价
|
|
|
|
- Double sumTotalSingal = Double.valueOf(buyReportDO.getUnitPrice1() - taskDO.getDeduction()) * taskDO.getNetWeight();
|
|
|
|
- sumTotal = sumTotal + sumTotalSingal;
|
|
|
|
- taskDTO.setSumPrice(sumTotalSingal);
|
|
|
|
- payMoney = payMoney + (buyReportDO.getMoney() - buyReportDO.getNotMoney());
|
|
|
|
- if (buyReportDO.getBuy() != null && buyReportDO.getBuy() != 0) {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- taskDTO.setCarNo(taskDO.getCarNo());
|
|
|
|
- taskDTO.setNetWeight(taskDO.getNetWeight());
|
|
|
|
- sumNet = sumNet + taskDO.getNetWeight();
|
|
|
|
- taskDTOList.add(taskDTO);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ if(buyReportDO.getBuy() == 0){
|
|
|
|
+ TaskDTO taskDTO = new TaskDTO();
|
|
|
|
+ // 结算单价
|
|
|
|
+ Double sumTotalSingal = Double.valueOf(buyReportDO.getMoney()) ;
|
|
|
|
+ sumTotal = sumTotal + sumTotalSingal;
|
|
|
|
+ taskDTO.setSumPrice(sumTotalSingal);
|
|
|
|
+ payMoney = payMoney + (buyReportDO.getMoney() - buyReportDO.getNotMoney());
|
|
|
|
+ taskDTO.setCarNo(buyReportDO.getCarNo());
|
|
|
|
+ taskDTO.setNetWeight(buyReportDO.getNetWeight());
|
|
|
|
+ taskDTO.setNotPay(Double.valueOf(buyReportDO.getNotMoney()));
|
|
|
|
+ sumNet = sumNet + buyReportDO.getNetWeight();
|
|
|
|
+ taskDTOList.add(taskDTO);
|
|
|
|
+// // 查询任务表
|
|
|
|
+// List<TaskDO> taskDOList = taskMapper.selectList(new EntityWrapper<TaskDO>().eq("report_id", buyReportDO.getId()).eq("task_type", "入库任务").eq("task_status",TaskStatusType.STATUS2.getCode()));
|
|
|
|
+// if (CollectionUtils.isNotEmpty(taskDOList)) {
|
|
|
|
+// for (TaskDO taskDO : taskDOList) {
|
|
|
|
+// TaskDTO taskDTO = new TaskDTO();
|
|
|
|
+// // 结算单价
|
|
|
|
+// Double sumTotalSingal = Double.valueOf(buyReportDO.getMoney()) ;
|
|
|
|
+// sumTotal = sumTotal + sumTotalSingal;
|
|
|
|
+// taskDTO.setSumPrice(sumTotalSingal);
|
|
|
|
+// payMoney = payMoney + (buyReportDO.getMoney() - buyReportDO.getNotMoney());
|
|
|
|
+// taskDTO.setCarNo(taskDO.getCarNo());
|
|
|
|
+// taskDTO.setNetWeight(taskDO.getNetWeight());
|
|
|
|
+// taskDTO.setNotPay(Double.valueOf(buyReportDO.getNotMoney()));
|
|
|
|
+// sumNet = sumNet + taskDO.getNetWeight();
|
|
|
|
+// taskDTOList.add(taskDTO);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
// 平仓
|
|
// 平仓
|
|
TaskDTO taskDTO1 = new TaskDTO();
|
|
TaskDTO taskDTO1 = new TaskDTO();
|
|
taskDTO1.setCloseTon(buyReportDO.getNetWeight());
|
|
taskDTO1.setCloseTon(buyReportDO.getNetWeight());
|
|
- taskDTO1.setSumPriceClose(Double.valueOf(buyReportDO.getUnitPrice1() + buyReportDO.getBasis()) * buyReportDO.getBuy());
|
|
|
|
|
|
+ taskDTO1.setSumPriceClose(Double.valueOf(buyReportDO.getMoney()));
|
|
sumNetClose = sumNetClose + buyReportDO.getNetWeight();
|
|
sumNetClose = sumNetClose + buyReportDO.getNetWeight();
|
|
- payMoneyClose = payMoneyClose + taskDTO1.getSumPriceClose();
|
|
|
|
|
|
+ sumTotalClose = sumTotalClose + taskDTO1.getSumPriceClose();
|
|
|
|
+ payNotMoneyClose = payNotMoneyClose + (buyReportDO.getMoney() - buyReportDO.getNotMoney());
|
|
|
|
+ taskDTO1.setNotPayClose(Double.valueOf(buyReportDO.getNotMoney()));
|
|
taskDTOList1.add(taskDTO1);
|
|
taskDTOList1.add(taskDTO1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- // 查询任务表
|
|
|
|
- List<TaskDO> taskDOList = taskMapper.selectList(new EntityWrapper<TaskDO>().eq("order_no", tradeDO.getOrderNo()).eq("task_type", "出库任务").eq("task_status", TaskStatusType.STATUS2.getCode()));
|
|
|
|
- if (CollectionUtils.isNotEmpty(taskDOList)) {
|
|
|
|
- for (TaskDO taskDO : taskDOList) {
|
|
|
|
|
|
+
|
|
|
|
+ List<SaleReportDO> saleReportDOS = saleReportMapper.selectList(new EntityWrapper<SaleReportDO>().eq("contract_no", contractNo));
|
|
|
|
+ for(SaleReportDO saleReportDO:saleReportDOS){
|
|
|
|
+ if(saleReportDO.getBuy() == 0){
|
|
TaskDTO taskDTO = new TaskDTO();
|
|
TaskDTO taskDTO = new TaskDTO();
|
|
- // 查询统计表
|
|
|
|
- SaleReportDO saleReportDO = saleReportMapper.selectById(taskDO.getReportId());
|
|
|
|
- if (saleReportDO != null) {
|
|
|
|
- // 结算单价
|
|
|
|
- Double sumTotalSingal = Double.valueOf(saleReportDO.getUnitPrice1()) * taskDO.getNetWeight();
|
|
|
|
- sumTotal = sumTotal + sumTotalSingal;
|
|
|
|
- taskDTO.setSumPrice(sumTotalSingal);
|
|
|
|
- payMoney = payMoney + (saleReportDO.getMoney());
|
|
|
|
- // 平仓
|
|
|
|
- if (saleReportDO.getBuy() != null && saleReportDO.getBuy() != 0) {
|
|
|
|
- TaskDTO taskDTO1 = new TaskDTO();
|
|
|
|
- taskDTO1.setCloseTon(saleReportDO.getNetWeight());
|
|
|
|
- taskDTO1.setSumPriceClose(Double.valueOf(saleReportDO.getUnitPrice1() + saleReportDO.getBasis()) * saleReportDO.getBuy());
|
|
|
|
- sumNetClose = sumNetClose + saleReportDO.getNetWeight();
|
|
|
|
- payMoneyClose = payMoneyClose + taskDTO1.getSumPriceClose();
|
|
|
|
- taskDTOList1.add(taskDTO1);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- taskDTO.setCarNo(taskDO.getCarNo());
|
|
|
|
- taskDTO.setNetWeight(taskDO.getNetWeight());
|
|
|
|
- sumNet = sumNet + taskDO.getNetWeight();
|
|
|
|
|
|
+ // 结算单价
|
|
|
|
+ Double sumTotalSingal = Double.valueOf(saleReportDO.getMoney()) ;
|
|
|
|
+ sumTotal = sumTotal + sumTotalSingal;
|
|
|
|
+ taskDTO.setSumPrice(sumTotalSingal);
|
|
|
|
+ payMoney = payMoney + (saleReportDO.getMoney());
|
|
|
|
+ taskDTO.setCarNo(saleReportDO.getCarNo());
|
|
|
|
+ taskDTO.setNetWeight(saleReportDO.getNetWeight());
|
|
|
|
+ taskDTO.setNotPay(0d);
|
|
|
|
+ sumNet = sumNet + saleReportDO.getNetWeight();
|
|
taskDTOList.add(taskDTO);
|
|
taskDTOList.add(taskDTO);
|
|
|
|
+// // 查询任务表
|
|
|
|
+// List<TaskDO> taskDOList = taskMapper.selectList(new EntityWrapper<TaskDO>().eq("report_id", saleReportDO.getId()).eq("task_type", "出库任务").eq("task_status",TaskStatusType.STATUS2.getCode()));
|
|
|
|
+// if (CollectionUtils.isNotEmpty(taskDOList)) {
|
|
|
|
+// for (TaskDO taskDO : taskDOList) {
|
|
|
|
+// TaskDTO taskDTO = new TaskDTO();
|
|
|
|
+// // 结算单价
|
|
|
|
+// Double sumTotalSingal = Double.valueOf(saleReportDO.getMoney()) ;
|
|
|
|
+// sumTotal = sumTotal + sumTotalSingal;
|
|
|
|
+// taskDTO.setSumPrice(sumTotalSingal);
|
|
|
|
+// payMoney = payMoney + (saleReportDO.getMoney());
|
|
|
|
+// taskDTO.setCarNo(taskDO.getCarNo());
|
|
|
|
+// taskDTO.setNetWeight(taskDO.getNetWeight());
|
|
|
|
+// sumNet = sumNet + taskDO.getNetWeight();
|
|
|
|
+// taskDTOList.add(taskDTO);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ TaskDTO taskDTO1 = new TaskDTO();
|
|
|
|
+ taskDTO1.setCloseTon(saleReportDO.getNetWeight());
|
|
|
|
+ taskDTO1.setSumPriceClose(Double.valueOf(saleReportDO.getPayMoney()));
|
|
|
|
+ taskDTO1.setNotPayClose(Double.valueOf(saleReportDO.getNotPayMoney()));
|
|
|
|
+ sumNetClose = sumNetClose + saleReportDO.getNetWeight();
|
|
|
|
+ sumTotalClose = sumTotalClose + taskDTO1.getSumPriceClose();
|
|
|
|
+ payNotMoneyClose = payNotMoneyClose + (saleReportDO.getNotPayMoney());
|
|
|
|
+ taskDTOList1.add(taskDTO1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -192,8 +213,10 @@ public class ContractAppServiceImpl implements ContractAppService {
|
|
map.put("sumNet", sumNet);
|
|
map.put("sumNet", sumNet);
|
|
map.put("taskDTOList", taskDTOList);
|
|
map.put("taskDTOList", taskDTOList);
|
|
|
|
|
|
|
|
+ map.put("sumTotalClose", sumTotalClose);
|
|
map.put("sumNetClose", sumNetClose);
|
|
map.put("sumNetClose", sumNetClose);
|
|
- map.put("payMoneyClose", payMoneyClose);
|
|
|
|
|
|
+ map.put("payMoneyClose", sumTotalClose - payNotMoneyClose);
|
|
|
|
+ map.put("notPayMoneyClose", payNotMoneyClose);
|
|
map.put("taskDTOList1", taskDTOList1);
|
|
map.put("taskDTOList1", taskDTOList1);
|
|
|
|
|
|
|
|
|