Commit 1691c6bf729036bd6cde58e725155e5ebe98feec
1 parent
a3b7a347
fix:跟单和业务能够看到自己负责的应收款和应付款审核情况
Showing
17 changed files
with
237 additions
and
334 deletions
src/main/java/com/order/erp/common/constant/Constant.java
src/main/java/com/order/erp/common/utils/OrderFieldUtils.java
... | ... | @@ -38,9 +38,10 @@ public class OrderFieldUtils { |
38 | 38 | * @param orderId |
39 | 39 | * @return |
40 | 40 | */ |
41 | - public static OrderFieldLockApplyDO generatorBaseInfoFieldLockApplyDO(OrderUnlockFieldApplyVO fieldVO, Long userId, Long orderId) { | |
41 | + public static OrderFieldLockApplyDO generatorProfitAnalysisFieldLockApplyDO(OrderUnlockFieldApplyVO fieldVO, Long userId, Long orderId) { | |
42 | 42 | OrderLockFieldVO lockFieldVO = new OrderLockFieldVO(); |
43 | - lockFieldVO.setBaseFields(fieldVO.getBaseFields()); | |
43 | + lockFieldVO.setProfitAnalysisFields(fieldVO.getProfitAnalysisFields()); | |
44 | + lockFieldVO.setReportFields(fieldVO.getReportFields()); | |
44 | 45 | OrderFieldLockApplyDO applyDO = OrderFieldLockApplyDO.builder() |
45 | 46 | .applyUserId(userId) |
46 | 47 | .auditUserId(null) |
... | ... | @@ -49,15 +50,13 @@ public class OrderFieldUtils { |
49 | 50 | .remark(ApplyTypeEnum.FIELD_EDIT_APPLY.getDesc()) |
50 | 51 | .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) |
51 | 52 | .build(); |
52 | - if (Objects.nonNull(fieldVO.getBaseFields()) && checkOrderBaseField4apply(fieldVO.getBaseFields())) { | |
53 | + if (Objects.nonNull(fieldVO.getProfitAnalysisFields()) && checkProfitAnalysisField4apply(fieldVO.getProfitAnalysisFields()) | |
54 | + || (Objects.nonNull(fieldVO.getReportFields()) && checkReportField4apply(fieldVO.getReportFields()))) { | |
55 | + lockFieldVO.setBaseFields(initOrderBaseField(OrderLockFieldEnum.LOCKED)); | |
53 | 56 | lockFieldVO.setInspectionStageFields(initInspectionStageField(OrderLockFieldEnum.LOCKED)); |
54 | - lockFieldVO.setProfitAnalysisFields(initProfitAnalysisField(OrderLockFieldEnum.LOCKED)); | |
55 | - lockFieldVO.setReportFields(initReportField(OrderLockFieldEnum.LOCKED)); | |
56 | 57 | lockFieldVO.setTrackStageFields(initTrackStageField(OrderLockFieldEnum.LOCKED)); |
57 | 58 | applyDO.setFields(JSONObject.toJSONString(lockFieldVO)); |
58 | - //在这里增加字段的描述。 applyDO.setXxxx("xxxx原因。"); | |
59 | - applyDO.setApplyRemark(fieldVO.getApplyRemark()); | |
60 | - applyDO.setAuditRoleCodes(RoleEnum.BUSINESS_USER.getCode() + Constant.COMMA_CHARACTER + RoleEnum.ADMIN.getCode()); | |
59 | + applyDO.setAuditRoleCodes(RoleEnum.ADMIN.getCode()); | |
61 | 60 | return applyDO; |
62 | 61 | } else { |
63 | 62 | return null; |
... | ... | @@ -70,21 +69,23 @@ public class OrderFieldUtils { |
70 | 69 | * @return |
71 | 70 | */ |
72 | 71 | public static OrderFieldLockApplyDO generatorOtherInfoFieldLockApplyDO(OrderUnlockFieldApplyVO fieldVO, Long userId) { |
73 | - if ((Objects.nonNull(fieldVO.getInspectionStageFields()) && checkInspectionStageField4apply(fieldVO.getInspectionStageFields())) | |
74 | - || (Objects.nonNull(fieldVO.getProfitAnalysisFields()) && checkProfitAnalysisField4apply(fieldVO.getProfitAnalysisFields())) | |
75 | - || (Objects.nonNull(fieldVO.getReportFields()) && checkReportField4apply(fieldVO.getReportFields())) | |
76 | - || (Objects.nonNull(fieldVO.getTrackStageFields()) && checkTrackStageField4apply(fieldVO.getTrackStageFields()))) { | |
72 | + if ( (Objects.nonNull(fieldVO.getInspectionStageFields()) && checkInspectionStageField4apply(fieldVO.getInspectionStageFields())) | |
73 | + || (Objects.nonNull(fieldVO.getTrackStageFields()) && checkTrackStageField4apply(fieldVO.getTrackStageFields())) | |
74 | + || (Objects.nonNull(fieldVO.getBaseFields()) && checkOrderBaseField4apply(fieldVO.getBaseFields()))) { | |
77 | 75 | OrderLockFieldVO lockFieldVO = new OrderLockFieldVO(); |
78 | - fieldVO.setBaseFields(initOrderBaseField(OrderLockFieldEnum.LOCKED)); | |
76 | + fieldVO.setProfitAnalysisFields(initProfitAnalysisField(OrderLockFieldEnum.LOCKED)); | |
77 | + fieldVO.setReportFields( initReportField(OrderLockFieldEnum.LOCKED)); | |
79 | 78 | BeanUtils.copyProperties(fieldVO, lockFieldVO); |
80 | 79 | return OrderFieldLockApplyDO.builder() |
81 | 80 | .applyUserId(userId) |
82 | 81 | .auditUserId(null) |
83 | 82 | .fields(JSONObject.toJSONString(lockFieldVO)) |
84 | - .auditRoleCodes(RoleEnum.ADMIN.getCode()) | |
83 | + .auditRoleCodes(RoleEnum.ADMIN.getCode()+Constant.COMMA_CHARACTER+RoleEnum.BUSINESS_USER.getCode()) | |
85 | 84 | .orderId(fieldVO.getOrderId()) |
86 | 85 | .type(ApplyTypeEnum.FIELD_EDIT_APPLY.getType()) |
87 | 86 | .remark(ApplyTypeEnum.FIELD_EDIT_APPLY.getDesc()) |
87 | + //在这里增加字段的描述。 applyDO.setXxxx("xxxx原因。"); | |
88 | + .applyRemark(fieldVO.getApplyRemark()) | |
88 | 89 | .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) |
89 | 90 | .build(); |
90 | 91 | } else { |
... | ... | @@ -99,10 +100,11 @@ public class OrderFieldUtils { |
99 | 100 | */ |
100 | 101 | public static List<OrderFieldLockApplyDO> initOrderFieldLockApplyDOS(OrderUnlockFieldApplyVO fieldVO, Long userId) { |
101 | 102 | List<OrderFieldLockApplyDO> resultList = new ArrayList<>(); |
102 | - OrderFieldLockApplyDO baseLockApply = generatorBaseInfoFieldLockApplyDO(fieldVO, userId, fieldVO.getOrderId()); | |
103 | + OrderFieldLockApplyDO baseLockApply = generatorProfitAnalysisFieldLockApplyDO(fieldVO, userId, fieldVO.getOrderId()); | |
103 | 104 | if (Objects.nonNull(baseLockApply)) { |
104 | 105 | resultList.add(baseLockApply); |
105 | 106 | } |
107 | + //跟单,项目报告书由管理员审核转化为管理员和业务员都能审核。 | |
106 | 108 | OrderFieldLockApplyDO otherLockApply = generatorOtherInfoFieldLockApplyDO(fieldVO, userId); |
107 | 109 | if (Objects.nonNull(otherLockApply)) { |
108 | 110 | resultList.add(otherLockApply); | ... | ... |
src/main/java/com/order/erp/controller/InvoiceBillOrderController.java
... | ... | @@ -175,6 +175,14 @@ public class InvoiceBillOrderController { |
175 | 175 | public void exportReceipt(HttpServletResponse response, @RequestBody InvoiceBillOrderDO queryVO) throws IOException { |
176 | 176 | invoiceBillOrderService.exportReceipt(response,queryVO); |
177 | 177 | } |
178 | - | |
178 | + /** | |
179 | + * 设置必须回款日期 | |
180 | + * @param createVO 必须回款日期 | |
181 | + * @return | |
182 | + */ | |
183 | + @PostMapping("/setBackRefundDate") | |
184 | + public void setBackRefundDate(@RequestBody InvoiceBillCreateVO createVO) { | |
185 | + invoiceBillOrderService.setBackRefundDate(createVO); | |
186 | + } | |
179 | 187 | } |
180 | 188 | ... | ... |
src/main/java/com/order/erp/controller/ProducePaymentCheckBillOrderController.java
... | ... | @@ -187,5 +187,10 @@ public class ProducePaymentCheckBillOrderController { |
187 | 187 | public void exportReceipt(HttpServletResponse response, @RequestBody ProducePaymentCheckBillOrderDO queryVO) throws IOException { |
188 | 188 | producePaymentCheckBillOrderService.exportReceipt(response,queryVO); |
189 | 189 | } |
190 | + | |
191 | + @PostMapping("/setPayedDate") | |
192 | + public void setPayedDate(@RequestBody ProducePaymentCheckBillCreateVO producePaymentCheckBillCreatevo) { | |
193 | + producePaymentCheckBillOrderService.setPayedDate(producePaymentCheckBillCreatevo); | |
194 | + } | |
190 | 195 | } |
191 | 196 | ... | ... |
src/main/java/com/order/erp/domain/dto/order/InvoiceBillOrderDO.java
src/main/java/com/order/erp/domain/dto/order/ProducePaymentCheckBillOrderDO.java
src/main/java/com/order/erp/domain/vo/order/BusinessProfitRatioResultVO.java
... | ... | @@ -52,7 +52,7 @@ public class BusinessProfitRatioResultVO implements Serializable { |
52 | 52 | private String produceEndTime; |
53 | 53 | |
54 | 54 | /** |
55 | - * 客户总价$ | |
55 | + * 客户总价¥ | |
56 | 56 | */ |
57 | 57 | private BigDecimal customerTotalPrice; |
58 | 58 | |
... | ... | @@ -159,5 +159,18 @@ public class BusinessProfitRatioResultVO implements Serializable { |
159 | 159 | * 实际跟单费用 |
160 | 160 | */ |
161 | 161 | private BigDecimal actualdocumentaryPrice; |
162 | + /** | |
163 | + * 客户总价$ | |
164 | + */ | |
165 | + private BigDecimal customerTotalPriceUsd; | |
166 | + | |
167 | + /** | |
168 | + * 生成科总价$ | |
169 | + */ | |
170 | + private BigDecimal productionDepartmentTotalPriceUsd; | |
171 | + /** | |
172 | + * 包装费用合计$ | |
173 | + */ | |
174 | + private BigDecimal packetTotalPriceUsd; | |
162 | 175 | } |
163 | 176 | ... | ... |
src/main/java/com/order/erp/domain/vo/order/OrderFieldLockApplyQueryVO.java
... | ... | @@ -87,6 +87,14 @@ public class OrderFieldLockApplyQueryVO extends BasePageVO implements Serializab |
87 | 87 | * 0 管理员,1:业务员 |
88 | 88 | */ |
89 | 89 | private Integer auditType; |
90 | + /** | |
91 | + * invoice编号 | |
92 | + */ | |
93 | + private String invoiceNo; | |
94 | + /** | |
95 | + * checkNo编号 | |
96 | + */ | |
97 | + private String checkNo; | |
90 | 98 | |
91 | 99 | } |
92 | 100 | ... | ... |
src/main/java/com/order/erp/job/FinanceJob.java
... | ... | @@ -44,10 +44,10 @@ public class FinanceJob { |
44 | 44 | @Resource |
45 | 45 | private RedisUtils redisService; |
46 | 46 | //每天的7:15执行一次 |
47 | -// @Scheduled(cron = "0 15 7 * * ?", zone = "Asia/Shanghai") | |
47 | + @Scheduled(cron = "0 15 7 * * ?", zone = "Asia/Shanghai") | |
48 | 48 | |
49 | 49 | //每分钟执行一次 |
50 | - @Scheduled(cron = "0 * * * * ?", zone = "Asia/Shanghai") | |
50 | +// @Scheduled(cron = "0 * * * * ?", zone = "Asia/Shanghai") | |
51 | 51 | public void financeJob() { |
52 | 52 | List<InvoiceBillOrderDO> eventInvoiceBillOrderDO=invoiceBillOrderService.getOverEvnetList(); |
53 | 53 | List<ProducePaymentCheckBillOrderDO> eventProducePaymentCheckBillOrderDO= producePaymentCheckBillOrderService.getOverEventList(); |
... | ... | @@ -84,7 +84,7 @@ public class FinanceJob { |
84 | 84 | emailList.addAll(financeEmailList); |
85 | 85 | } |
86 | 86 | Set<String> userSet = new HashSet<>(); |
87 | - userSet.add(invoiceBillOrderDO.getCreateBy()); | |
87 | + userSet.add(invoiceBillOrderDO.getTrackerUser()); | |
88 | 88 | userSet.add(invoiceBillOrderDO.getBusinesPerson()); |
89 | 89 | List<String> emails = userSet.stream() |
90 | 90 | .map(userName::get) |
... | ... | @@ -98,9 +98,9 @@ public class FinanceJob { |
98 | 98 | FinanceEventJobVO eventJobVO = new FinanceEventJobVO(); |
99 | 99 | eventJobVO.setInvoiceBillOrderDO(invoiceBillOrderDO); |
100 | 100 | emailSendUtils.sendEmail(FinanceOverEnum.INVOICE_OVERTIME, new ArrayList<>(emailList), eventJobVO); |
101 | - boolean set = redisService.set(redisKey, invoiceBillOrderDO, Constant.TWENTY_FIRST, TimeUnit.DAYS);// 设置为21天后过期 | |
101 | + boolean set = redisService.set(redisKey, invoiceBillOrderDO, Constant.HUNDREDANDFIVE, TimeUnit.DAYS);// 设置为21天后过期 | |
102 | 102 | if(set){ |
103 | - redisService.saddWithExpiry(Constant.REDISKEY,redisKey, Constant.TWENTY_FIRST, TimeUnit.DAYS); | |
103 | + redisService.saddWithExpiry(Constant.REDISKEY,redisKey, Constant.HUNDREDANDFIVE, TimeUnit.DAYS); | |
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
... | ... | @@ -120,7 +120,7 @@ public class FinanceJob { |
120 | 120 | //发送邮件 |
121 | 121 | Set<String> userSet = new HashSet<>(); |
122 | 122 | //获取业务,财务,管理员 |
123 | - userSet.add(producePaymentCheckBillOrderDO.getCreateBy()); | |
123 | + userSet.add(producePaymentCheckBillOrderDO.getTrackerUser()); | |
124 | 124 | userSet.add(producePaymentCheckBillOrderDO.getBusinesPerson()); |
125 | 125 | List<String> emails = userSet.stream() |
126 | 126 | .map(userName::get) |
... | ... | @@ -135,9 +135,9 @@ public class FinanceJob { |
135 | 135 | FinanceEventJobVO eventJobVO = new FinanceEventJobVO(); |
136 | 136 | eventJobVO.setProducePaymentCheckBillOrderDO(producePaymentCheckBillOrderDO); |
137 | 137 | emailSendUtils.sendEmail(FinanceOverEnum.PRODUCE_PAYMENT_CHECK_OVERTIME, new ArrayList<>(emailList), eventJobVO); |
138 | - boolean set = redisService.set(redisKey, producePaymentCheckBillOrderDO, Constant.TWENTY_FIRST, TimeUnit.DAYS);// 设置为21天后过期 | |
138 | + boolean set = redisService.set(redisKey, producePaymentCheckBillOrderDO, Constant.HUNDREDANDFIVE, TimeUnit.DAYS);// 设置为21天后过期 | |
139 | 139 | if(set){ |
140 | - redisService.saddWithExpiry(Constant.REDISKEY,redisKey, Constant.TWENTY_FIRST, TimeUnit.DAYS); | |
140 | + redisService.saddWithExpiry(Constant.REDISKEY,redisKey, Constant.HUNDREDANDFIVE, TimeUnit.DAYS); | |
141 | 141 | } |
142 | 142 | } |
143 | 143 | } |
... | ... | @@ -217,8 +217,8 @@ public class FinanceJob { |
217 | 217 | |
218 | 218 | if (expireTime != null && expireTime > 0) { // 确保 expireTime 有值且大于 0 |
219 | 219 | long daysRemaining = TimeUnit.SECONDS.toDays(expireTime); |
220 | - // 如果剩余时间为14天7天或1天,则符合条件 | |
221 | - if (daysRemaining==14 || daysRemaining == 7 || daysRemaining == 1) { | |
220 | + // 每隔7天检查一下,如果是7的倍数,则获取里面的值,查看 | |
221 | + if (Constant.ZERO==daysRemaining % 7) { | |
222 | 222 | validKeys.add(key); // 满足条件,加入有效的 keys 列表 |
223 | 223 | } |
224 | 224 | } | ... | ... |
src/main/java/com/order/erp/service/order/InvoiceBillOrderService.java
src/main/java/com/order/erp/service/order/ProducePaymentCheckBillOrderService.java
... | ... | @@ -108,4 +108,5 @@ public interface ProducePaymentCheckBillOrderService extends IService<ProducePay |
108 | 108 | ServerResult exportReceipt(HttpServletResponse response, ProducePaymentCheckBillOrderDO queryVO) throws IOException; |
109 | 109 | |
110 | 110 | List<ProducePaymentCheckBillOrderDO> getOverEventList(); |
111 | + ServerResult setPayedDate(ProducePaymentCheckBillCreateVO createVO); | |
111 | 112 | } | ... | ... |
src/main/java/com/order/erp/service/order/impl/CalculateProfitServiceImpl.java
... | ... | @@ -114,15 +114,15 @@ public class CalculateProfitServiceImpl { |
114 | 114 | //第六行 |
115 | 115 | createMergedCell(sheet, workbook, 12, 0, 12, 13, 0, 4, "客户总金额计算"); |
116 | 116 | createMergedCell(sheet, workbook, 12, 5, 12, 13, 5, 6, "¥"+resultVO.getCustomerTotalPrice()); |
117 | - createMergedCell(sheet, workbook, 12, 9, 12, 13, 7, 9, ""); | |
117 | + createMergedCell(sheet, workbook, 12, 7, 12, 13, 7, 9, "$"+resultVO.getCustomerTotalPriceUsd()); | |
118 | 118 | ////第七行 |
119 | 119 | createMergedCell(sheet, workbook, 14, 0, 14, 15, 0, 4, "生产科总价合计"); |
120 | 120 | createMergedCell(sheet, workbook, 14, 5, 14, 15, 5, 6, "¥"+resultVO.getProductionDepartmentTotalPrice()); |
121 | - createMergedCell(sheet, workbook, 14, 7, 14, 15, 7, 9, ""); | |
121 | + createMergedCell(sheet, workbook, 14, 7, 14, 15, 7, 9, "$"+resultVO.getProductionDepartmentTotalPriceUsd()); | |
122 | 122 | ////第八行 |
123 | 123 | createMergedCell(sheet, workbook, 16, 0, 16, 17, 0, 4, "包装费用合计"); |
124 | 124 | createMergedCell(sheet, workbook, 16, 5, 16, 17, 5, 6, "¥"+resultVO.getPacketTotalPrice()); |
125 | - createMergedCell(sheet, workbook, 16, 7, 16, 17, 7, 9, ""); | |
125 | + createMergedCell(sheet, workbook, 16, 7, 16, 17, 7, 9, "$"+resultVO.getPacketTotalPriceUsd()); | |
126 | 126 | ////第九行 |
127 | 127 | createMergedCell(sheet, workbook, 18, 0, 18, 19, 0, 4, "研发开发费合计"); |
128 | 128 | createMergedCell(sheet, workbook, 18, 5, 18, 19, 5, 6, "¥"+resultVO.getDevelopTotalPrice().setScale(2, RoundingMode.HALF_UP)); |
... | ... | @@ -371,11 +371,6 @@ public class CalculateProfitServiceImpl { |
371 | 371 | if(CollectionUtils.isEmpty(profitAnalysisList) ||orderIds.size()!= profitAnalysisDOS.size()){ |
372 | 372 | throw new BusinessException("勾选订单的利润信息未填写!"); |
373 | 373 | } |
374 | -// for(OrderProfitAnalysisDO analysisDO : profitAnalysisList){ | |
375 | -// if(analysisDO.getCustomerPrice()==null){ | |
376 | -// throw new BusinessException("勾选订单的利润信息未填写!"); | |
377 | -// } | |
378 | -// } | |
379 | 374 | int sumCount = orderBaseInfoDOList.stream().mapToInt(OrderBaseInfoDO::getOrderCount).sum(); |
380 | 375 | Set<String> projectList = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getProjectNo).collect(Collectors.toSet()); |
381 | 376 | //得到当前汇率。 |
... | ... | @@ -429,7 +424,7 @@ public class CalculateProfitServiceImpl { |
429 | 424 | chinaRatioProfitPrice = chainRatioValue.multiply(customerRmbTotalPrice); |
430 | 425 | BigDecimal dailyCostValue = new BigDecimal(dailyCost); |
431 | 426 | fixCost = dailyCostValue.multiply(new BigDecimal(getProjectDays(queryVO))); |
432 | - BigDecimal outTotalPrice = customerRmbTotalPrice.add(productionDepartmentTotalPrice).add(packetTotalPrice) | |
427 | + BigDecimal outTotalPrice = productionDepartmentTotalPrice.add(packetTotalPrice) | |
433 | 428 | .add(queryVO.getDevelopTotalPrice()).add(queryVO.getCopyTotalPrice()) |
434 | 429 | .add(fixCost).add(spainRatioProfitPrice).add(chinaRatioProfitPrice); |
435 | 430 | BigDecimal developProfit = customerRmbTotalPrice.subtract(outTotalPrice); |
... | ... | @@ -469,6 +464,9 @@ public class CalculateProfitServiceImpl { |
469 | 464 | //12 |
470 | 465 | resultVO.setGrossProfit(customerRmbTotalPrice.subtract(productionDepartmentTotalPrice).subtract(packetTotalPrice).setScale(2, BigDecimal.ROUND_HALF_UP)); |
471 | 466 | resultVO.setProjectNo(String.join(",",projectList)); |
467 | + resultVO.setPacketTotalPriceUsd(packetTotalPrice.divide(exchangeRate, 2, RoundingMode.HALF_UP)); | |
468 | + resultVO.setCustomerTotalPriceUsd(customerTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
469 | + resultVO.setProductionDepartmentTotalPriceUsd(productionDepartmentTotalPrice.divide(exchangeRate, 2, RoundingMode.HALF_UP)); | |
472 | 470 | return resultVO; |
473 | 471 | } |
474 | 472 | |
... | ... | @@ -566,7 +564,7 @@ public class CalculateProfitServiceImpl { |
566 | 564 | if(queryVO.getProductionDepartmentPredictPrice().compareTo(BigDecimal.ZERO) == 0){ |
567 | 565 | }else{ |
568 | 566 | predictRatio = queryVO.getProductionActualPrice() |
569 | - .divide(queryVO.getProductionDepartmentPredictPrice(),2,BigDecimal.ROUND_HALF_UP); | |
567 | + .divide(queryVO.getProductionDepartmentPredictPrice(),4,BigDecimal.ROUND_HALF_UP); | |
570 | 568 | } |
571 | 569 | } |
572 | 570 | //如果大于1.05则就把内部生产提成变为0 | ... | ... |
src/main/java/com/order/erp/service/order/impl/InvoiceBillOrderServiceImpl.java
... | ... | @@ -92,7 +92,7 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
92 | 92 | LambdaQueryWrapper<InvoiceBillOrderDO> queryWrapper = getQueryWrapper(queryVO); |
93 | 93 | //跟单也只能看到自己创建的 业务只能看到自己的 |
94 | 94 | if(Objects.nonNull(role) && role.getId().equals(RoleEnum.TRACKER_USER.getId())){ |
95 | - queryWrapper.eq(InvoiceBillOrderDO::getCreateBy, dataScope.getLoginUserName()); | |
95 | + queryWrapper.eq(InvoiceBillOrderDO::getTrackerUser, dataScope.getLoginUserName()); | |
96 | 96 | } |
97 | 97 | if(Objects.nonNull(role) && role.getId().equals(RoleEnum.BUSINESS_USER.getId())){ |
98 | 98 | queryWrapper.eq(InvoiceBillOrderDO::getBusinesPerson, dataScope.getLoginUserName()); |
... | ... | @@ -197,45 +197,6 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
197 | 197 | // private List<Map<String, Object>> buildExportMapVOS(InvoiceBillAnalysisResultVO resultVO) { |
198 | 198 | //第二版 |
199 | 199 | private List<Map<String, Object>> buildExportMapVOS(List<InvoiceBillAnalysisResultVO> resultVO) { |
200 | -/* List<InvoiceBillAnalysisExportVO> exportVOS = resultVO.getExportVOS(); | |
201 | - List<Map<String, Object>> list = new ArrayList<>(); | |
202 | - int i = 0; | |
203 | - for (InvoiceBillAnalysisExportVO exportVO : exportVOS) { | |
204 | - Map<String, Object> map = new LinkedHashMap<>(); | |
205 | - map.put("编号", i++); | |
206 | - map.put("客户编码", exportVO.getCustomerCode()); | |
207 | - map.put("INVOICE编码", exportVO.getInvoiceNo()); | |
208 | - map.put("客户总金额汇总", exportVO.getCustomerTotalPrice()); | |
209 | - map.put("客户扣款金额汇总", exportVO.getDeductAmount()); | |
210 | - map.put("实际应收金额", exportVO.getActualReceivableAmount()); | |
211 | - map.put("实际收款金额汇总", exportVO.getActualPayedAmount()); | |
212 | - map.put("其他费用金额汇总", exportVO.getOtherAmount()); | |
213 | - map.put("其他费用合计", exportVO.getOtherTotalAmount()); | |
214 | - map.put("必须回款日期", exportVO.getBackRefundDate()); | |
215 | - map.put("实际回款日期", exportVO.getActualRefundDate()); | |
216 | - list.add(map); | |
217 | - } | |
218 | - Map<String, Object> map = new LinkedHashMap<>(); | |
219 | - map.put("编号", "合计"); | |
220 | - map.put("客户编码", ""); | |
221 | - map.put("INVOICE编码", ""); | |
222 | - map.put("客户总金额汇总", resultVO.getCustomerTotalPrice()); | |
223 | - map.put("客户扣款金额汇总", resultVO.getDeductAmount()); | |
224 | - map.put("实际应收金额", resultVO.getActualReceivableAmount()); | |
225 | - map.put("实际收款金额汇总", resultVO.getActualPayedAmount()); | |
226 | - map.put("其他费用金额汇总", resultVO.getOtherAmount()); | |
227 | - map.put("其他费用合计", resultVO.getOtherTotalAmount()); | |
228 | - map.put("必须回款日期", ""); | |
229 | - map.put("实际回款日期", ""); | |
230 | - list.add(map); | |
231 | - return list;*/ | |
232 | - | |
233 | - | |
234 | - | |
235 | - | |
236 | - | |
237 | - | |
238 | -// List<InvoiceBillAnalysisExportVO> exportVOS = resultVO.getExportVOS(); | |
239 | 200 | //第二版开始 |
240 | 201 | List<InvoiceBillAnalysisExportVO> exportVOS = resultVO.stream() |
241 | 202 | .flatMap(X -> X.getExportVOS().stream()) // 展开每个 resultVO 的 exportVOS 列表 |
... | ... | @@ -340,7 +301,6 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
340 | 301 | * @param queryVO |
341 | 302 | * @return |
342 | 303 | */ |
343 | -// private InvoiceBillAnalysisResultVO getAnalysisResult(InvoiceBillAnalysisVO queryVO) { | |
344 | 304 | //第二版 |
345 | 305 | private List<InvoiceBillAnalysisResultVO> getAnalysisResult(InvoiceBillAnalysisVO queryVO) { |
346 | 306 | LambdaQueryWrapper<InvoiceBillOrderDO> queryWrapper = getQueryWrapper(queryVO); |
... | ... | @@ -365,57 +325,6 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
365 | 325 | * @param exportVOS |
366 | 326 | * @return |
367 | 327 | */ |
368 | -// private InvoiceBillAnalysisResultVO wrapperAnalysisResultVO(List<InvoiceBillAnalysisExportVO> exportVOS) { | |
369 | -// if (CollectionUtils.isEmpty(exportVOS)) { | |
370 | -// return null; | |
371 | -// } | |
372 | -// InvoiceBillAnalysisResultVO resultVO = InvoiceBillAnalysisResultVO.builder().exportVOS(exportVOS).build(); | |
373 | -// BigDecimal customerTotalPrice = new BigDecimal(Constant.ZERO); | |
374 | -// BigDecimal deductAmount = new BigDecimal(Constant.ZERO); | |
375 | -//// BigDecimal actualReceivableAmount = new BigDecimal(Constant.ZERO); | |
376 | -// BigDecimal actualPayedAmount = new BigDecimal(Constant.ZERO); | |
377 | -//// BigDecimal otherAmount = new BigDecimal(Constant.ZERO); | |
378 | -// BigDecimal otherTotalAmount = new BigDecimal(Constant.ZERO); | |
379 | -// for (InvoiceBillAnalysisExportVO exportVO : exportVOS) { | |
380 | -// if (Objects.nonNull(exportVO.getCustomerTotalPrice())) { | |
381 | -// customerTotalPrice = customerTotalPrice.add(exportVO.getCustomerTotalPrice()); | |
382 | -// } | |
383 | -// if (Objects.nonNull(exportVO.getDeductAmount())) { | |
384 | -// deductAmount = deductAmount.add(exportVO.getDeductAmount()); | |
385 | -// } | |
386 | -//// if (Objects.nonNull(exportVO.getActualReceivableAmount())) { | |
387 | -//// actualReceivableAmount = actualReceivableAmount.add(exportVO.getActualReceivableAmount()); | |
388 | -//// } | |
389 | -// if (Objects.nonNull(exportVO.getActualPayedAmount())) { | |
390 | -// actualPayedAmount = actualPayedAmount.add(exportVO.getActualPayedAmount()); | |
391 | -// } | |
392 | -//// if (Objects.nonNull(exportVO.getOtherAmount())) { | |
393 | -//// otherAmount = customerTotalPrice.add(exportVO.getOtherAmount()); | |
394 | -//// } | |
395 | -// if (Objects.nonNull(exportVO.getOtherTotalAmount())) { | |
396 | -// otherTotalAmount = otherTotalAmount.add(exportVO.getOtherTotalAmount()); | |
397 | -// } | |
398 | -// } | |
399 | -// //5889---1 正确 | |
400 | -// resultVO.setCustomerTotalPrice(customerTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
401 | -// //2---2 正确 | |
402 | -// resultVO.setDeductAmount(deductAmount.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
403 | -// //3003---4 错误 | |
404 | -//// resultVO.setActualReceivableAmount(actualReceivableAmount.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
405 | -// resultVO.setActualReceivableAmount(actualPayedAmount.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
406 | -// //0---5 错误 每个订单的合计的其他费用。 (已改正) | |
407 | -// resultVO.setOtherTotalAmount(otherTotalAmount.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
408 | -// //5890---3 错误 1-2得到 | |
409 | -//// resultVO.setOtherAmount(otherAmount); | |
410 | -// //改正后 | |
411 | -// resultVO.setOtherAmount(resultVO.getCustomerTotalPrice().subtract(resultVO.getDeductAmount()).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
412 | -// //2997---wu | |
413 | -//// resultVO.setActualPayedAmount(actualPayedAmount); | |
414 | -// //已改正 | |
415 | -// resultVO.setActualPayedAmount(resultVO.getOtherAmount().subtract(resultVO.getActualReceivableAmount()).subtract(resultVO.getOtherTotalAmount()).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
416 | -// return resultVO; | |
417 | -// } | |
418 | - | |
419 | 328 | //第二版 |
420 | 329 | private List<InvoiceBillAnalysisResultVO> wrapperAnalysisResultVO(List<InvoiceBillAnalysisExportVO> exportVOS) { |
421 | 330 | if (CollectionUtils.isEmpty(exportVOS)) { |
... | ... | @@ -798,6 +707,7 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
798 | 707 | .backRefundDate(createVO.getBackRefundDate()) |
799 | 708 | .status(ApplyStatusEnum.NO_COMMIT.getStatus()) |
800 | 709 | .businesPerson(orderBaseInfoDOList.get(0).getBusinessPerson()) |
710 | + .trackerUser(orderBaseInfoDOList.get(0).getCreateBy()) | |
801 | 711 | .build(); |
802 | 712 | } |
803 | 713 | |
... | ... | @@ -893,19 +803,6 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
893 | 803 | } |
894 | 804 | |
895 | 805 | checkCommitApply(invoiceBillOrderDo.getId()); |
896 | - | |
897 | -// Set<String> deductUrlSet = new HashSet<>(Arrays.asList( | |
898 | -// org.apache.commons.lang3.StringUtils.defaultString(invoiceBillOrderDo.getDeductUrl()).split(",") | |
899 | -// )); | |
900 | -// String newDeductUrl = deductInfoVO.getDeductUrl(); | |
901 | -// if (StringUtils.isNotBlank(newDeductUrl)) { | |
902 | -// // 如果新 URL 不为空且不在现有 URL 中,则添加到 Set 中 | |
903 | -// if (!deductUrlSet.contains(newDeductUrl)) { | |
904 | -// deductUrlSet.add(newDeductUrl); | |
905 | -// } | |
906 | -// } | |
907 | -// String updatedDeductUrl = String.join(",", deductUrlSet); | |
908 | -// invoiceBillOrderDo.setDeductUrl(updatedDeductUrl); | |
909 | 806 | if(StringUtils.isNotBlank(invoiceBillOrderDo.getDeductUrl())){ |
910 | 807 | //记住:需要修改数据表对应的字段deduct_url的varchar数据范围,修改为1000左右。 |
911 | 808 | if(StringUtils.isNotBlank(deductInfoVO.getDeductUrl())){ |
... | ... | @@ -981,32 +878,9 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
981 | 878 | String loginUserName = dataScope.getLoginUserName(); |
982 | 879 | checkApply(commitApplyVO.getId(), userId); |
983 | 880 | |
984 | - /*List<InvoiceBillMappingDO> invoiceBillMappingDOS = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>() | |
985 | - .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
986 | - .eq(InvoiceBillMappingDO::getInvoiceNo, invoiceBillOrderDO.getInvoiceNo())); | |
987 | - if(CollectionUtils.isNotEmpty(invoiceBillMappingDOS)){ | |
988 | - List<Long> orderIds = invoiceBillMappingDOS.stream().map(InvoiceBillMappingDO::getOrderId).collect(Collectors.toList()); | |
989 | - List<OrderProfitAnalysisDO> orderProfitAnalysisDOS = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
990 | - .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
991 | - .in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
992 | - if(CollectionUtils.isNotEmpty(orderProfitAnalysisDOS)){ | |
993 | - List<Double> totalPrice = orderProfitAnalysisDOS.stream().map(OrderProfitAnalysisDO::getCustomerTotalPrice).collect(Collectors.toList()); | |
994 | - if(CollectionUtils.isNotEmpty(totalPrice)){ | |
995 | - double totalSum = totalPrice.stream() | |
996 | - .reduce(0.00, Double::sum); | |
997 | - BigDecimal bigDecimalValue = BigDecimal.valueOf(totalSum); | |
998 | - //客户总价金额汇总。 美元 | |
999 | - invoiceBillOrderDO.setTotalCustomerAmount(bigDecimalValue); | |
1000 | - }else { | |
1001 | - invoiceBillOrderDO.setTotalCustomerAmount( BigDecimal.ZERO); | |
1002 | - } | |
1003 | - } | |
1004 | - } | |
1005 | - if(Objects.isNull(invoiceBillOrderDO.getDeductAmount())){ | |
1006 | - invoiceBillOrderDO.setDeductAmount(BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP)); | |
1007 | - }*/ | |
1008 | 881 | invoiceBillOrderDO.setActualRefundDate(commitApplyVO.getActualRefundDate()); |
1009 | 882 | invoiceBillOrderDO.setPayee(commitApplyVO.getPayee()); |
883 | + //这里设置财务人员,是因为他们最后是点击提交审核的人员,所以当时候申请人就是获取FinancePerson这个变量。 | |
1010 | 884 | invoiceBillOrderDO.setFinancePerson(loginUserName); |
1011 | 885 | OrderFieldLockApplyDO applyDO = initOrderFieldLockApplyDO(invoiceBillOrderDO, userId); |
1012 | 886 | transactionHelper.run(() -> { |
... | ... | @@ -1065,7 +939,7 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
1065 | 939 | .type(ApplyTypeEnum.INVOICE_BILL_APPLY.getType()) |
1066 | 940 | .remark(ApplyTypeEnum.INVOICE_BILL_APPLY.getDesc()) |
1067 | 941 | .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) |
1068 | - .auditRoleCodes(RoleEnum.ADMIN.getCode()) | |
942 | + .auditRoleCodes(RoleEnum.ADMIN.getCode() + Constant.COMMA_CHARACTER + RoleEnum.FINANCE_USER.getCode()) | |
1069 | 943 | .build(); |
1070 | 944 | } |
1071 | 945 | |
... | ... | @@ -1212,6 +1086,20 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap |
1212 | 1086 | return baseMapper.getOverEventList(); |
1213 | 1087 | } |
1214 | 1088 | |
1089 | + @Override | |
1090 | + public ServerResult setBackRefundDate(InvoiceBillCreateVO createVO) { | |
1091 | + if(Objects.isNull(createVO.getId())){ | |
1092 | + return ServerResult.fail(); | |
1093 | + } | |
1094 | + InvoiceBillOrderDO invoiceBillOrderDO = getById(createVO.getId()); | |
1095 | + if(Objects.isNull(invoiceBillOrderDO)){ | |
1096 | + throw new BusinessException("应收款单不存在!"); | |
1097 | + } | |
1098 | + invoiceBillOrderDO.setBackRefundDate(createVO.getBackRefundDate()); | |
1099 | + updateById(invoiceBillOrderDO); | |
1100 | + return ServerResult.success(); | |
1101 | + } | |
1102 | + | |
1215 | 1103 | |
1216 | 1104 | public void createMergedCell(Sheet sheet, Workbook workbook, int rowIndex, int colIndex, int startRow, int endRow, int startCol, int endCol, String value) { |
1217 | 1105 | // 创建或获取当前行 | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... | ... | @@ -2007,7 +2007,7 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
2007 | 2007 | orderOpinionLogService.saveBatch(orderOpinionLogDOList); |
2008 | 2008 | return ServerResult.success(); |
2009 | 2009 | } |
2010 | -//这个方法的作用就是:她们反应对于内部编号相同的订单,就不需要发送四个测试结果的产品意见信息,不然创建一个订单就发送四个测试结果,太麻烦了,所以这里根据项目号和测试结果进行区分。 | |
2010 | +//这个方法的作用就是:她们反应对于内部编号相同的订单,就不需要发送四个测试结果的产品意见信息,不然创建一个订单选择测试结果后就发送四个测试结果,太麻烦了,所以这里根据项目号和测试结果进行区分。 | |
2011 | 2011 | public void setEmailSendUtilsRedis(OrderBaseInfoDO orderBaseInfoDo,String resultText,String productionComment){ |
2012 | 2012 | if(!redisUtils.hasKey(orderBaseInfoDo.getInnerNo()+Constant.CROSS_BAR_CHARACTER+resultText)){ |
2013 | 2013 | sendProductionCommentEmail(orderBaseInfoDo,productionComment); | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderFieldLockApplyServiceImpl.java
... | ... | @@ -113,7 +113,9 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
113 | 113 | |
114 | 114 | @Override |
115 | 115 | public ServerResult listByPage(OrderFieldLockApplyQueryVO queryVO) { |
116 | - LambdaQueryWrapper<OrderFieldLockApplyDO> queryWrapper = buildQueryByParam(queryVO); | |
116 | + RoleEnum roleEnum = dataScope.getRole(); | |
117 | + String loginUserName = dataScope.getLoginUserName(); | |
118 | + LambdaQueryWrapper<OrderFieldLockApplyDO> queryWrapper = buildQueryByParam(queryVO,roleEnum); | |
117 | 119 | Page page = new Page<>(queryVO.getPage(), queryVO.getPageSize()); |
118 | 120 | IPage<OrderFieldLockApplyDO> iPage = page(page, queryWrapper); |
119 | 121 | |
... | ... | @@ -139,7 +141,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
139 | 141 | resultVO.setFieldInfos(fieldVO); |
140 | 142 | } |
141 | 143 | if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(x.getType())) { |
142 | - //自定义。 解决待审批列表中的应收款要显示内部编码。 | |
144 | + // 解决待审批列表中的应收款要显示内部编码。 这里开始 | |
143 | 145 | OrderLockFieldVO orderLockFieldVO = JSONObject.parseObject(fields, OrderLockFieldVO.class); |
144 | 146 | if(Objects.nonNull(orderLockFieldVO.getInvoiceBillOrderDO()) && StringUtils.isNotBlank(orderLockFieldVO.getInvoiceBillOrderDO().getInvoiceNo())){ |
145 | 147 | List<InvoiceBillMappingDO> invoiceBillMappingDOList= invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>() |
... | ... | @@ -159,12 +161,26 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
159 | 161 | } |
160 | 162 | } |
161 | 163 | } |
164 | + } //这里结束 上述为待审核列表中应收款要显示内部编码。 | |
165 | + //这部分的目的是,对于跟单员和业务员他们也能查看到应收款和应付款中各自负责订单的审核情况。 而财务和admin则会执行else{},会看到所有的审核订单信息。 | |
166 | + if(RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode())){ | |
167 | + if(Objects.nonNull(orderLockFieldVO.getInvoiceBillOrderDO()) && orderLockFieldVO.getInvoiceBillOrderDO().getBusinesPerson().equals(loginUserName)){ | |
168 | + resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
169 | + } | |
170 | + } else if (RoleEnum.TRACKER_USER.getCode().equals(roleEnum.getCode())) { | |
171 | + if(Objects.nonNull(orderLockFieldVO.getInvoiceBillOrderDO()) && orderLockFieldVO.getInvoiceBillOrderDO().getTrackerUser().equals(loginUserName)){ | |
172 | + resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
173 | + } | |
174 | + } else{ | |
175 | + resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
176 | + } | |
177 | + if(Objects.isNull(resultVO.getFieldInfos())){ | |
178 | + resultVO=null; | |
162 | 179 | } |
163 | - resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
164 | 180 | } |
165 | 181 | if (ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(x.getType()) || ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(x.getType())) { |
166 | - | |
167 | 182 | OrderLockFieldVO orderLockFieldVO = JSONObject.parseObject(fields, OrderLockFieldVO.class); |
183 | + // 解决待审批列表中的应付款要显示内部编码。 这里开始 | |
168 | 184 | if(Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && StringUtils.isNotBlank(orderLockFieldVO.getCheckBillOrderDO().getCheckNo())){ |
169 | 185 | List<CheckBillMappingDO> checkBillMappingDOList= checkBillMappingService.list(new LambdaQueryWrapper<CheckBillMappingDO>() |
170 | 186 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
... | ... | @@ -183,15 +199,31 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
183 | 199 | } |
184 | 200 | } |
185 | 201 | } |
202 | + }//这里结束 上述为待审核列表中应收款要显示内部编码。 | |
203 | + //这部分的目的是,对于跟单员和业务员他们也能查看到应收款和应付款中各自负责订单的审核情况。 而财务和admin则会执行else{},会看到所有的审核订单信息。 | |
204 | + if(RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode())){ | |
205 | + if(Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && orderLockFieldVO.getCheckBillOrderDO().getBusinesPerson().equals(loginUserName)){ | |
206 | + resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
207 | + } | |
208 | + } else if (RoleEnum.TRACKER_USER.getCode().equals(roleEnum.getCode())) { | |
209 | + if(Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && orderLockFieldVO.getCheckBillOrderDO().getTrackerUser().equals(loginUserName)){ | |
210 | + resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
211 | + } | |
212 | + } else{ | |
213 | + resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
214 | + } | |
215 | + if(Objects.isNull(resultVO.getFieldInfos())){ | |
216 | + resultVO=null; | |
186 | 217 | } |
187 | - | |
188 | - resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
189 | 218 | } |
190 | 219 | } |
191 | 220 | return resultVO; |
192 | - }).collect(Collectors.toList()); | |
193 | - | |
194 | - fillOrderInfo(resultVOList); | |
221 | + }).filter(result->result!=null).collect(Collectors.toList()); | |
222 | + if (resultVOList != null && resultVOList.stream().noneMatch(x -> ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(x.getType()) | |
223 | + || ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(x.getType()) | |
224 | + || ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(x.getType()))) { | |
225 | + fillOrderInfo(resultVOList); | |
226 | + } | |
195 | 227 | webVOPage.setRecords(resultVOList); |
196 | 228 | } |
197 | 229 | BeanUtils.copyProperties(page, webVOPage, "records"); |
... | ... | @@ -355,8 +387,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
355 | 387 | * @param queryVO |
356 | 388 | * @return |
357 | 389 | */ |
358 | - private LambdaQueryWrapper<OrderFieldLockApplyDO> buildQueryByParam(OrderFieldLockApplyQueryVO queryVO) { | |
359 | - RoleEnum roleEnum = dataScope.getRole(); | |
390 | + private LambdaQueryWrapper<OrderFieldLockApplyDO> buildQueryByParam(OrderFieldLockApplyQueryVO queryVO,RoleEnum roleEnum) { | |
360 | 391 | RoleEnum roleSelect = null; |
361 | 392 | if (RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode())) { |
362 | 393 | queryVO.setBusinessPerson(dataScope.getLoginUserName()); |
... | ... | @@ -369,21 +400,29 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
369 | 400 | roleSelect = RoleEnum.ADMIN; |
370 | 401 | } |
371 | 402 | } |
372 | - //这里是否还u需要添加财务角色权限的逻辑。 | |
373 | 403 | Set<Long> orderIds = new HashSet<>(); |
374 | - if (StringUtils.isNotBlank(queryVO.getBusinessPerson()) || CollectionUtils.isNotEmpty(queryVO.getCustomerCode()) || CollectionUtils.isNotEmpty(queryVO.getInnerNo()) | |
375 | - || CollectionUtils.isNotEmpty(queryVO.getProductionDepartment()) || CollectionUtils.isNotEmpty(queryVO.getProjectNo())) { | |
376 | - List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.list(new LambdaQueryWrapper<OrderBaseInfoDO>() | |
377 | - .eq(StringUtils.isNotBlank(queryVO.getBusinessPerson()), OrderBaseInfoDO::getBusinessPerson, queryVO.getBusinessPerson()) | |
378 | - .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
379 | - .in(CollectionUtils.isNotEmpty(queryVO.getCustomerCode()), OrderBaseInfoDO::getCustomerCode, queryVO.getCustomerCode()) | |
380 | - .in(CollectionUtils.isNotEmpty(queryVO.getInnerNo()), OrderBaseInfoDO::getInnerNo, queryVO.getInnerNo()) | |
381 | - .in(CollectionUtils.isNotEmpty(queryVO.getProductionDepartment()), OrderBaseInfoDO::getProductionDepartment, queryVO.getProductionDepartment()) | |
382 | - .in(CollectionUtils.isNotEmpty(queryVO.getProjectNo()), OrderBaseInfoDO::getProjectNo, queryVO.getProjectNo())); | |
383 | - if (CollectionUtils.isNotEmpty(orderBaseInfoDOList)) { | |
384 | - orderIds = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getId).collect(Collectors.toSet()); | |
385 | - } else { | |
386 | - orderIds.add(-1L); | |
404 | + //由于下面是原始的代码,怕改出错了,所以我只对我需要的需求进行判断,我只针对我需要的这种情况,其他情况下就不走这种情况。 限制情况为跟单业务,对应收款,应付款,发票审核请求时。 | |
405 | + if(RoleEnum.TRACKER_USER.getCode().equals(roleEnum.getCode()) && (queryVO.getType()==Constant.THIRTY || queryVO.getType()==4050)){ | |
406 | + | |
407 | + }else if(RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode()) && (queryVO.getType()==Constant.THIRTY || queryVO.getType()==4050)){ | |
408 | + | |
409 | + }else{ | |
410 | + /** 这部分代码是之前的,每台看懂,就先不修改了,保留*/ | |
411 | + //这里是否还u需要添加财务角色权限的逻辑。 | |
412 | + if (StringUtils.isNotBlank(queryVO.getBusinessPerson()) || CollectionUtils.isNotEmpty(queryVO.getCustomerCode()) || CollectionUtils.isNotEmpty(queryVO.getInnerNo()) | |
413 | + || CollectionUtils.isNotEmpty(queryVO.getProductionDepartment()) || CollectionUtils.isNotEmpty(queryVO.getProjectNo())) { | |
414 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.list(new LambdaQueryWrapper<OrderBaseInfoDO>() | |
415 | + .eq(StringUtils.isNotBlank(queryVO.getBusinessPerson()), OrderBaseInfoDO::getBusinessPerson, queryVO.getBusinessPerson()) | |
416 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
417 | + .in(CollectionUtils.isNotEmpty(queryVO.getCustomerCode()), OrderBaseInfoDO::getCustomerCode, queryVO.getCustomerCode()) | |
418 | + .in(CollectionUtils.isNotEmpty(queryVO.getInnerNo()), OrderBaseInfoDO::getInnerNo, queryVO.getInnerNo()) | |
419 | + .in(CollectionUtils.isNotEmpty(queryVO.getProductionDepartment()), OrderBaseInfoDO::getProductionDepartment, queryVO.getProductionDepartment()) | |
420 | + .in(CollectionUtils.isNotEmpty(queryVO.getProjectNo()), OrderBaseInfoDO::getProjectNo, queryVO.getProjectNo())); | |
421 | + if (CollectionUtils.isNotEmpty(orderBaseInfoDOList)) { | |
422 | + orderIds = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getId).collect(Collectors.toSet()); | |
423 | + } else { | |
424 | + orderIds.add(-1L); | |
425 | + } | |
387 | 426 | } |
388 | 427 | } |
389 | 428 | LambdaQueryWrapper<OrderFieldLockApplyDO> queryWrapper = new LambdaQueryWrapper<OrderFieldLockApplyDO>() |
... | ... | @@ -392,6 +431,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
392 | 431 | .eq(Objects.nonNull(queryVO.getStatus()), OrderFieldLockApplyDO::getStatus, queryVO.getStatus()) |
393 | 432 | .in(CollectionUtils.isNotEmpty(queryVO.getStatusList()), OrderFieldLockApplyDO::getStatus, queryVO.getStatusList()) |
394 | 433 | .in(CollectionUtils.isNotEmpty(orderIds), OrderFieldLockApplyDO::getOrderId, orderIds); |
434 | + //这里应该加上应收款待审核,应付款待审核,应付款已审核,应收款已审核已审核的一个条件。 | |
395 | 435 | if(Objects.nonNull(queryVO.getType())){ |
396 | 436 | if(Constant.FOUR == String.valueOf(queryVO.getType()).length()){ |
397 | 437 | int firstTwoDigits = queryVO.getType() / 100; |
... | ... | @@ -401,11 +441,50 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
401 | 441 | queryWrapper.eq(Objects.nonNull(queryVO.getType()), OrderFieldLockApplyDO::getType, queryVO.getType()); |
402 | 442 | } |
403 | 443 | } |
404 | - if (Objects.isNull(roleSelect)) { | |
405 | - queryWrapper.like(Objects.nonNull(roleEnum), OrderFieldLockApplyDO::getAuditRoleCodes, roleEnum.getCode()); | |
406 | - }else { | |
407 | - queryWrapper.eq(Objects.nonNull(roleSelect), OrderFieldLockApplyDO::getAuditRoleCodes, roleSelect.getCode()); | |
444 | + /* //只针对于应收款的过滤信息。这两个搜索框只会在应收款和应付款中进行展示。 还没有测试行不行。 | |
445 | + if (StringUtils.isNotBlank(queryVO.getInvoiceNo())) { | |
446 | + String invoiceNos = queryVO.getInvoiceNo(); | |
447 | + // 防止空值或分割后的数组为空 | |
448 | + if (invoiceNos != null && !invoiceNos.trim().isEmpty()) { | |
449 | + String[] invoiceNoArray = invoiceNos.split(","); | |
450 | + // 确保数组不为空并过滤空白元素 | |
451 | + String condition = Arrays.stream(invoiceNoArray) | |
452 | + .filter(StringUtils::isNotBlank) // 过滤掉空白字符串 | |
453 | + .map(val -> "'" + val.trim() + "'") // 去掉多余空格并加单引号 | |
454 | + .collect(Collectors.joining(",")); | |
455 | + if (!condition.isEmpty()) { // 防止最终拼接的条件为空 | |
456 | + queryWrapper.apply("JSON_UNQUOTE(JSON_EXTRACT(fields, '$.invoiceNo')) IN (" + condition + ")"); | |
457 | + } | |
458 | + } | |
459 | + } | |
460 | +//只针对于应付款的过滤信息。 | |
461 | + if (StringUtils.isNotBlank(queryVO.getCheckNo())) { | |
462 | + String checkNos = queryVO.getCheckNo(); | |
463 | + // 防止空值或分割后的数组为空 | |
464 | + if (checkNos != null && !checkNos.trim().isEmpty()) { | |
465 | + String[] checkNoArray = checkNos.split(","); | |
466 | + // 确保数组不为空并过滤空白元素 | |
467 | + String condition = Arrays.stream(checkNoArray) | |
468 | + .filter(StringUtils::isNotBlank) // 过滤掉空白字符串 | |
469 | + .map(val -> "'" + val.trim() + "'") // 去掉多余空格并加单引号 | |
470 | + .collect(Collectors.joining(",")); | |
471 | + if (!condition.isEmpty()) { // 防止最终拼接的条件为空 | |
472 | + queryWrapper.apply("JSON_UNQUOTE(JSON_EXTRACT(fields, '$.invoiceNo')) IN (" + condition + ")"); | |
473 | + } | |
474 | + } | |
475 | + }*/ | |
476 | + //由于不懂下面的代码,所以我只对我需要的需求进行判断,我只针对我需要的这种情况,其他情况下就不走这种情况。 | |
477 | + if(RoleEnum.TRACKER_USER.getCode().equals(roleEnum.getCode()) && (queryVO.getType()==Constant.THIRTY || queryVO.getType()==4050)){ | |
408 | 478 | |
479 | + }else if(RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode()) && (queryVO.getType()==Constant.THIRTY || queryVO.getType()==4050)){ | |
480 | + | |
481 | + }else{ | |
482 | + if (Objects.isNull(roleSelect)) { | |
483 | + queryWrapper.like(Objects.nonNull(roleEnum), OrderFieldLockApplyDO::getAuditRoleCodes, roleEnum.getCode()); | |
484 | + }else { | |
485 | + queryWrapper.eq(Objects.nonNull(roleSelect), OrderFieldLockApplyDO::getAuditRoleCodes, roleSelect.getCode()); | |
486 | + | |
487 | + } | |
409 | 488 | } |
410 | 489 | return queryWrapper; |
411 | 490 | } |
... | ... | @@ -545,12 +624,12 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
545 | 624 | if (Objects.nonNull(recordDO)) { |
546 | 625 | if (applyDO.getAuditRoleCodes().contains(RoleEnum.BUSINESS_USER.getCode())) { |
547 | 626 | recordField.setBaseFields(applyField.getBaseFields()); |
627 | + recordField.setTrackStageFields(applyField.getTrackStageFields()); | |
628 | + recordField.setInspectionStageFields(applyField.getInspectionStageFields()); | |
548 | 629 | recordDO.setFields(JSONObject.toJSONString(recordField)); |
549 | 630 | } else { |
550 | - recordField.setTrackStageFields(applyField.getTrackStageFields()); | |
551 | 631 | recordField.setReportFields(applyField.getReportFields()); |
552 | 632 | recordField.setProfitAnalysisFields(applyField.getProfitAnalysisFields()); |
553 | - recordField.setInspectionStageFields(applyField.getInspectionStageFields()); | |
554 | 633 | recordDO.setFields(JSONObject.toJSONString(recordField)); |
555 | 634 | } |
556 | 635 | } else { | ... | ... |
src/main/java/com/order/erp/service/order/impl/ProducePaymentCheckBillOrderServiceImpl.java
... | ... | @@ -95,7 +95,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
95 | 95 | } |
96 | 96 | //跟单也只能看到自己创建的,业务只能看到自己的 |
97 | 97 | if(Objects.nonNull(role) && role.getId().equals(RoleEnum.TRACKER_USER.getId())){ |
98 | - queryWrapper.eq(ProducePaymentCheckBillOrderDO::getCreateBy, dataScope.getLoginUserName()); | |
98 | + queryWrapper.eq(ProducePaymentCheckBillOrderDO::getTrackerUser, dataScope.getLoginUserName()); | |
99 | 99 | } |
100 | 100 | if(Objects.nonNull(role) && role.getId().equals(RoleEnum.BUSINESS_USER.getId())){ |
101 | 101 | queryWrapper.eq(ProducePaymentCheckBillOrderDO::getBusinesPerson, dataScope.getLoginUserName()); |
... | ... | @@ -177,40 +177,6 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
177 | 177 | * @param exportVOS |
178 | 178 | * @return |
179 | 179 | */ |
180 | -// private CheckBillAnalysisResultVO wrapperAnalysisResultVO(List<CheckBillAnalysisExportVO> exportVOS) { | |
181 | -// if (CollectionUtils.isEmpty(exportVOS)) { | |
182 | -// return null; | |
183 | -// } | |
184 | -// CheckBillAnalysisResultVO resultVO = CheckBillAnalysisResultVO.builder().exportVOS(exportVOS).build(); | |
185 | -// BigDecimal productionDepartmentTotalPrice = new BigDecimal(Constant.ZERO); | |
186 | -// BigDecimal deductAmount = new BigDecimal(Constant.ZERO); | |
187 | -// BigDecimal actualPayedAmount = new BigDecimal(Constant.ZERO); | |
188 | -// BigDecimal calculateActualPayedAmount = new BigDecimal(Constant.ZERO); | |
189 | -// BigDecimal unPayedAmount = new BigDecimal(Constant.ZERO); | |
190 | -// for (CheckBillAnalysisExportVO exportVO : exportVOS) { | |
191 | -// if (Objects.nonNull(exportVO.getProductionDepartmentTotalPrice())) { | |
192 | -// productionDepartmentTotalPrice = productionDepartmentTotalPrice.add(exportVO.getProductionDepartmentTotalPrice()); | |
193 | -// } | |
194 | -// if (Objects.nonNull(exportVO.getDeductAmount())) { | |
195 | -// deductAmount = deductAmount.add(exportVO.getDeductAmount()); | |
196 | -// } | |
197 | -// if (Objects.nonNull(exportVO.getActualPayedAmount())) { | |
198 | -// actualPayedAmount = actualPayedAmount.add(exportVO.getActualPayedAmount()); | |
199 | -// } | |
200 | -// if (Objects.nonNull(exportVO.getCalculateActualPayedAmount())) { | |
201 | -// calculateActualPayedAmount = calculateActualPayedAmount.add(exportVO.getCalculateActualPayedAmount()); | |
202 | -// } | |
203 | -// if (Objects.nonNull(exportVO.getUnPayedAmount())) { | |
204 | -// unPayedAmount = unPayedAmount.add(exportVO.getUnPayedAmount()); | |
205 | -// } | |
206 | -// } | |
207 | -// resultVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.setScale(2, RoundingMode.HALF_UP)); | |
208 | -// resultVO.setDeductAmount(deductAmount.setScale(2, RoundingMode.HALF_UP)); | |
209 | -// resultVO.setActualPayedAmount(actualPayedAmount.setScale(2, RoundingMode.HALF_UP)); | |
210 | -// resultVO.setCalculateActualPayedAmount(calculateActualPayedAmount.setScale(2, RoundingMode.HALF_UP)); | |
211 | -// resultVO.setUnPayedAmount(unPayedAmount.setScale(2, RoundingMode.HALF_UP)); | |
212 | -// return resultVO; | |
213 | -// } | |
214 | 180 | |
215 | 181 | //第二版开始。 |
216 | 182 | private List<CheckBillAnalysisResultVO> wrapperAnalysisResultVO(List<CheckBillAnalysisExportVO> exportVOS) { |
... | ... | @@ -237,12 +203,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
237 | 203 | if (Objects.nonNull(exportVO.getActualPayedAmount())) { |
238 | 204 | actualPayedAmount = actualPayedAmount.add(exportVO.getActualPayedAmount()); |
239 | 205 | } |
240 | -// if (Objects.nonNull(exportVO.getCalculateActualPayedAmount())) { | |
241 | -// calculateActualPayedAmount = calculateActualPayedAmount.add(exportVO.getCalculateActualPayedAmount()); | |
242 | -// } | |
243 | -// if (Objects.nonNull(exportVO.getUnPayedAmount())) { | |
244 | -// unPayedAmount = unPayedAmount.add(exportVO.getUnPayedAmount()); | |
245 | -// } | |
206 | + | |
246 | 207 | } |
247 | 208 | resultVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.setScale(2, RoundingMode.HALF_UP)); |
248 | 209 | resultVO.setDeductAmount(deductAmount.setScale(2, RoundingMode.HALF_UP)); |
... | ... | @@ -397,40 +358,6 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
397 | 358 | // private List<Map<String, Object>> buildExportMapVOS(CheckBillAnalysisResultVO resultVO) throws IOException { |
398 | 359 | //第二版开始。 |
399 | 360 | private List<Map<String, Object>> buildExportMapVOS(List<CheckBillAnalysisResultVO> resultVO) throws IOException { |
400 | - //第二版结束。 | |
401 | - | |
402 | - /* List<CheckBillAnalysisExportVO> exportVOS = resultVO.getExportVOS(); | |
403 | - List<Map<String, Object>> list = new ArrayList<>(); | |
404 | - int i = 0; | |
405 | - for (CheckBillAnalysisExportVO exportVO : exportVOS) { | |
406 | - Map<String, Object> map = new LinkedHashMap<>(); | |
407 | - map.put("编号", i++); | |
408 | - map.put("生产科名称", exportVO.getProductionDepartment()); | |
409 | - map.put("生产科对账单号码", exportVO.getCheckNo()); | |
410 | - map.put("生产科总价汇总", exportVO.getProductionDepartmentTotalPrice()); | |
411 | - map.put("生产科扣款金额汇总", exportVO.getDeductAmount()); | |
412 | - map.put("生产科实际应付金额", exportVO.getCalculateActualPayedAmount()); | |
413 | - map.put("实际付款金额汇总", exportVO.getActualPayedAmount()); | |
414 | - map.put("未付金额金额", exportVO.getUnPayedAmount()); | |
415 | - map.put("生产科应付款日期", exportVO.getPayedDate()); | |
416 | - map.put("实际付款日期", exportVO.getActualPayedDate()); | |
417 | - list.add(map); | |
418 | - } | |
419 | - Map<String, Object> map = new LinkedHashMap<>(); | |
420 | - map.put("编号", i++); | |
421 | - map.put("生产科名称", ""); | |
422 | - map.put("生产科对账单号码", ""); | |
423 | - map.put("生产科总价汇总", resultVO.getProductionDepartmentTotalPrice()); | |
424 | - map.put("生产科扣款金额汇总", resultVO.getDeductAmount()); | |
425 | - map.put("生产科实际应付金额", resultVO.getCalculateActualPayedAmount()); | |
426 | - map.put("实际付款金额汇总", resultVO.getActualPayedAmount()); | |
427 | - map.put("未付金额金额", resultVO.getUnPayedAmount()); | |
428 | - map.put("生产科应付款日期", ""); | |
429 | - map.put("实际付款日期", ""); | |
430 | - list.add(map);*/ | |
431 | - | |
432 | - | |
433 | -// List<CheckBillAnalysisExportVO> exportVOS = resultVO.getExportVOS(); | |
434 | 361 | |
435 | 362 | //第二版开始。 |
436 | 363 | List<CheckBillAnalysisExportVO> exportVOS = resultVO.stream().flatMap(x -> x.getExportVOS().stream()) |
... | ... | @@ -465,7 +392,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
465 | 392 | map.put("生产科扣款金额汇总", "¥"+exportVO.getDeductAmount()); |
466 | 393 | map.put("生产科实际应付金额", "¥"+exportVO.getCalculateActualPayedAmount()); |
467 | 394 | map.put("实际付款金额汇总", "¥"+exportVO.getActualPayedAmount()); |
468 | - map.put("未付金额金额","¥"+exportVO.getUnPayedAmount()); | |
395 | + map.put("未付金额汇总","¥"+exportVO.getUnPayedAmount()); | |
469 | 396 | map.put("生产科应付款日期", exportVO.getPayedDate()); |
470 | 397 | map.put("实际付款日期", exportVO.getActualPayedDate()); |
471 | 398 | list.add(map); |
... | ... | @@ -486,7 +413,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
486 | 413 | subTotalMap.put("生产科扣款金额汇总", "¥"+subTotalDeductAmount); |
487 | 414 | subTotalMap.put("生产科实际应付金额", "¥"+subTotalActualReceivableAmount); |
488 | 415 | subTotalMap.put("实际付款金额汇总", "¥"+subTotalActualPayedAmount); |
489 | - subTotalMap.put("未付金额金额", "¥"+subTotalOtherAmount); | |
416 | + subTotalMap.put("未付金额汇总", "¥"+subTotalOtherAmount); | |
490 | 417 | subTotalMap.put("生产科应付款日期", ""); |
491 | 418 | subTotalMap.put("实际付款日期", ""); |
492 | 419 | list.add(subTotalMap); |
... | ... | @@ -508,7 +435,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
508 | 435 | totalMap.put("生产科扣款金额汇总", "¥"+totalDeductAmount); |
509 | 436 | totalMap.put("生产科实际应付金额", "¥"+totalActualReceivableAmount); |
510 | 437 | totalMap.put("实际付款金额汇总", "¥"+totalActualPayedAmount); |
511 | - totalMap.put("未付金额金额", "¥"+totalOtherAmount); | |
438 | + totalMap.put("未付金额汇总", "¥"+totalOtherAmount); | |
512 | 439 | totalMap.put("生产科应付款日期", ""); |
513 | 440 | totalMap.put("实际付款日期", ""); |
514 | 441 | list.add(totalMap); |
... | ... | @@ -759,6 +686,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
759 | 686 | .status(ApplyStatusEnum.NO_COMMIT.getStatus()) |
760 | 687 | .productionName(orderBaseInfoDOList.get(0).getProductionDepartment()) |
761 | 688 | .businesPerson(orderBaseInfoDOList.get(0).getBusinessPerson()) |
689 | + .trackerUser(orderBaseInfoDOList.get(0).getCreateBy()) | |
762 | 690 | .build(); |
763 | 691 | } |
764 | 692 | |
... | ... | @@ -848,21 +776,6 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
848 | 776 | |
849 | 777 | checkCommitApply(checkBillOrderDO.getId()); |
850 | 778 | //需要判断一下是否为空?不然知己以逗号分隔会报错。 |
851 | -// if(StringUtils.isNotBlank(deductInfoVO.getDeductUrl())){ | |
852 | -// List<String> deductUrlList = new ArrayList<>(Arrays.asList( | |
853 | -// org.apache.commons.lang3.StringUtils.defaultString(deductInfoVO.getDeductUrl()).split(",") | |
854 | -// )); | |
855 | -// String lastElement = deductUrlList.get(deductUrlList.size() - 1); | |
856 | -// if(StringUtils.isNotBlank(lastElement)){ | |
857 | -// if(!deductUrlList.contains(lastElement)){ | |
858 | -// deductUrlList.add(lastElement); | |
859 | -// } | |
860 | -// } | |
861 | -// String updatedDeductUrl = String.join(",", deductUrlList); | |
862 | -// checkBillOrderDO.setDeductUrl(updatedDeductUrl); | |
863 | -// }else{ | |
864 | -// checkBillOrderDO.setDeductUrl(deductInfoVO.getDeductUrl()); | |
865 | -// } | |
866 | 779 | if(StringUtils.isNotBlank(checkBillOrderDO.getDeductUrl())){ |
867 | 780 | //记住:需要修改数据表对应的字段deduct_url的varchar数据范围,修改为1000左右。 |
868 | 781 | if(StringUtils.isNotBlank(deductInfoVO.getDeductUrl())){ |
... | ... | @@ -938,21 +851,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
938 | 851 | //校验是否有处于待审核的订单。 |
939 | 852 | checkCommitApply(checkBillOrderDO.getId()); |
940 | 853 | OrderLockFieldVO locakFieldVO = new OrderLockFieldVO(); |
941 | -// if(StringUtils.isNotBlank(checkBillOrderDO.getInvoiceUrl())){ | |
942 | -// if(StringUtils.isNotBlank(invoiceInfoVO.getInvoiceUrl())){ | |
943 | -// Set<String> deductUrlSet = new HashSet<>(Arrays.asList( | |
944 | -// org.apache.commons.lang3.StringUtils.defaultString(checkBillOrderDO.getInvoiceUrl()).split(","))); | |
945 | -// if(!deductUrlSet.contains(invoiceInfoVO.getInvoiceUrl())){ | |
946 | -// deductUrlSet.add(invoiceInfoVO.getInvoiceUrl()); | |
947 | -// String updateDeductUrl=String.join(",",deductUrlSet); | |
948 | -// checkBillOrderDO.setInvoiceUrl(updateDeductUrl); | |
949 | -// } | |
950 | -// } | |
951 | -// }else { | |
952 | -// if(StringUtils.isNotBlank(invoiceInfoVO.getInvoiceUrl())){ | |
953 | -// checkBillOrderDO.setInvoiceUrl(invoiceInfoVO.getInvoiceUrl()); | |
954 | -// } | |
955 | -// } | |
854 | + | |
956 | 855 | //事务:待审核,设置为admin和财务才有权限审批。 |
957 | 856 | transactionHelper.run(() -> { |
958 | 857 | checkBillOrderDO.setDepartmentInvoiceStatus(ApplyStatusEnum.WAIT_AUDIT.getStatus()); |
... | ... | @@ -989,30 +888,6 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
989 | 888 | String loginUserName = dataScope.getLoginUserName(); |
990 | 889 | checkApply(commitApplyVO.getId(), userId,ApplyTypeEnum.CHECK_BILL_APPLY.getType()); |
991 | 890 | |
992 | - /* List<CheckBillMappingDO> checkBillMappingDOS = checkBillMappingService.list(new LambdaQueryWrapper<CheckBillMappingDO>() | |
993 | - .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
994 | - .eq(CheckBillMappingDO::getCheckNo, checkBillOrderDO.getCheckNo())); | |
995 | - if(CollectionUtils.isNotEmpty(checkBillMappingDOS)){ | |
996 | - List<Long> orderIds = checkBillMappingDOS.stream().map(CheckBillMappingDO::getOrderId).collect(Collectors.toList()); | |
997 | - List<OrderProfitAnalysisDO> orderProfitAnalysisDOS = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
998 | - .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
999 | - .in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
1000 | - if(CollectionUtils.isNotEmpty(orderProfitAnalysisDOS)){ | |
1001 | -// List<Double> totalPrice = orderProfitAnalysisDOS.stream().map(OrderProfitAnalysisDO::getProductionDepartmentTotalPrice).collect(Collectors.toList()); | |
1002 | - BigDecimal totalConvertedAmount = orderProfitAnalysisDOS.stream().map(order -> BigDecimal.valueOf(order.getProductionDepartmentTotalPrice())) | |
1003 | - .reduce(BigDecimal.ZERO, BigDecimal::add); | |
1004 | - BigDecimal formattedSum = totalConvertedAmount.setScale(2, BigDecimal.ROUND_HALF_UP); | |
1005 | - if(Objects.nonNull(formattedSum)){ | |
1006 | - //客户总价金额汇总。 | |
1007 | - checkBillOrderDO.setTotalProductionAmount(formattedSum); | |
1008 | - }else { | |
1009 | - checkBillOrderDO.setTotalProductionAmount( BigDecimal.ZERO); | |
1010 | - } | |
1011 | - } | |
1012 | - } | |
1013 | - if(Objects.isNull(checkBillOrderDO.getDeductAmount())){ | |
1014 | - checkBillOrderDO.setDeductAmount(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
1015 | - }*/ | |
1016 | 891 | checkBillOrderDO.setActualPayedDate(commitApplyVO.getActualPayedDate()); |
1017 | 892 | checkBillOrderDO.setFinancePerson(loginUserName); |
1018 | 893 | OrderFieldLockApplyDO applyDO = initOrderFieldLockApplyDO(checkBillOrderDO, userId); |
... | ... | @@ -1041,7 +916,7 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
1041 | 916 | .type(ApplyTypeEnum.CHECK_BILL_APPLY.getType()) |
1042 | 917 | .remark(ApplyTypeEnum.CHECK_BILL_APPLY.getDesc()) |
1043 | 918 | .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) |
1044 | - .auditRoleCodes(RoleEnum.ADMIN.getCode()) | |
919 | + .auditRoleCodes(RoleEnum.ADMIN.getCode() + Constant.COMMA_CHARACTER + RoleEnum.FINANCE_USER.getCode()) | |
1045 | 920 | .build(); |
1046 | 921 | } |
1047 | 922 | |
... | ... | @@ -1186,6 +1061,21 @@ public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<Produce |
1186 | 1061 | public List<ProducePaymentCheckBillOrderDO> getOverEventList(){ |
1187 | 1062 | return baseMapper.getOverEventList(); |
1188 | 1063 | } |
1064 | + | |
1065 | + @Override | |
1066 | + public ServerResult setPayedDate(ProducePaymentCheckBillCreateVO createVO) { | |
1067 | + if(Objects.isNull(createVO.getId())){ | |
1068 | + return ServerResult.fail(); | |
1069 | + } | |
1070 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = getById(createVO.getId()); | |
1071 | + if(Objects.isNull(checkBillOrderDO)){ | |
1072 | + throw new BusinessException("生产科对账单不存在!"); | |
1073 | + } | |
1074 | + checkBillOrderDO.setPayedDate(createVO.getPayedDate()); | |
1075 | + updateById(checkBillOrderDO); | |
1076 | + return ServerResult.success(); | |
1077 | + } | |
1078 | + | |
1189 | 1079 | @Override |
1190 | 1080 | public ServerResult exportReceipt(HttpServletResponse response,ProducePaymentCheckBillOrderDO queryVO) throws IOException { |
1191 | 1081 | XSSFWorkbook workbook = new XSSFWorkbook(); | ... | ... |