Commit a3b7a347ff264236a5e48919c2f5ba5d5e148dda
1 parent
25b987be
添加财务模块,main分支为完整的未添加财务模块之前的线上正常代码
Showing
82 changed files
with
7273 additions
and
32 deletions
src/main/java/com/order/erp/common/constant/Constant.java
... | ... | @@ -185,6 +185,8 @@ public class Constant { |
185 | 185 | |
186 | 186 | public static final String DELETE_SUCCESS_RESULT_CHARACTER = "删除成功"; |
187 | 187 | |
188 | + public static final String REDISKEY = "REDISKEY"; | |
189 | + | |
188 | 190 | |
189 | 191 | /** |
190 | 192 | * token rediskey |
... | ... | @@ -335,4 +337,6 @@ public class Constant { |
335 | 337 | */ |
336 | 338 | public static final long REDIS_EMAIL_TIME = 90; |
337 | 339 | |
340 | + public static final String FINANCE_EVENT_TIME = "请自行去系统中查询!"; | |
341 | + | |
338 | 342 | } | ... | ... |
src/main/java/com/order/erp/common/utils/EasyPdfUtils.java
... | ... | @@ -63,7 +63,8 @@ public class EasyPdfUtils { |
63 | 63 | public List<OrderProducePdfVO> build(List<Long> ids) { |
64 | 64 | List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.list(new LambdaQueryWrapper<OrderBaseInfoDO>() |
65 | 65 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
66 | - .in(OrderBaseInfoDO::getId, ids)); | |
66 | + .in(OrderBaseInfoDO::getId, ids) | |
67 | + .orderByAsc(OrderBaseInfoDO::getInnerNo)); | |
67 | 68 | Set<String> productionDepartments = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getProductionDepartment).filter(Objects::nonNull) |
68 | 69 | .filter(department -> !department.trim().isEmpty()).collect(Collectors.toSet()); |
69 | 70 | if (productionDepartments.size() > 1) { |
... | ... | @@ -79,7 +80,7 @@ public class EasyPdfUtils { |
79 | 80 | List<String> personList= new ArrayList<>(setPerson); |
80 | 81 | Set<Long> orderIds = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getId).collect(Collectors.toSet()); |
81 | 82 | List<OrderProfitAnalysisDO> profitAnalysisDOS = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>().in(OrderProfitAnalysisDO::getOrderId, orderIds)); |
82 | - Map<Long, OrderProfitAnalysisDO> profitAnalysisDOMap = profitAnalysisDOS.stream().collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity())); | |
83 | + Map<Long, OrderProfitAnalysisDO> profitAnalysisDOMap = profitAnalysisDOS.stream().collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(),(x,y)->x)); | |
83 | 84 | return orderBaseInfoDOList.stream().map(x -> { |
84 | 85 | OrderProducePdfVO producePdfVO = new OrderProducePdfVO(); |
85 | 86 | BeanUtils.copyProperties(x, producePdfVO); | ... | ... |
src/main/java/com/order/erp/common/utils/EmailSendUtils.java
1 | 1 | package com.order.erp.common.utils; |
2 | 2 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
3 | 3 | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
4 | +import com.order.erp.common.constant.Constant; | |
4 | 5 | import com.order.erp.common.constant.ServerResultCode; |
5 | 6 | import com.order.erp.common.exception.BusinessException; |
6 | 7 | import com.order.erp.domain.EmailTemplateEnum; |
8 | +import com.order.erp.domain.FinanceOverEnum; | |
9 | +import com.order.erp.domain.vo.order.FinanceEventJobVO; | |
7 | 10 | import com.order.erp.domain.vo.order.OrderEventJobVO; |
8 | 11 | import freemarker.template.Template; |
9 | 12 | import freemarker.template.TemplateException; |
... | ... | @@ -107,4 +110,41 @@ public class EmailSendUtils { |
107 | 110 | } |
108 | 111 | javaMailSender.send(mimeMessage); |
109 | 112 | } |
113 | + | |
114 | + | |
115 | + /** | |
116 | + * @Description: 发送财务应收款,应付款过期时间的单据 | |
117 | + * @param emailTemplateEnum 应收款,应付款邮件事件类型 | |
118 | + * @param receiveemailList 收件人邮箱 | |
119 | + * @param orderEventJobVO 应收款,应付款订单。 | |
120 | + * @throws IOException | |
121 | + */ | |
122 | + | |
123 | + public void sendEmail(FinanceOverEnum emailTemplateEnum, List<String> receiveemailList, FinanceEventJobVO orderEventJobVO) { | |
124 | + if(CollectionUtils.isEmpty(receiveemailList) && emailTemplateEnum ==null && ObjectUtils.isNull(orderEventJobVO)){ | |
125 | + throw new BusinessException(ServerResultCode.PARAM_ERROR); | |
126 | + } | |
127 | + MimeMessage mimeMessage = javaMailSender.createMimeMessage(); | |
128 | + MimeMessageHelper helper= null; | |
129 | + //设置收件人 | |
130 | + String[] receiveemailListArray = receiveemailList.toArray(new String[receiveemailList.size()]); | |
131 | + try { | |
132 | + helper = new MimeMessageHelper(mimeMessage); | |
133 | + //设置邮件的主题 | |
134 | + helper.setSubject(emailTemplateEnum.getTitle()); | |
135 | + //设置发件人 | |
136 | + helper.setFrom(sendEmail); | |
137 | + helper.setTo(receiveemailListArray); | |
138 | + helper.setSentDate(new Date()); | |
139 | + if(FinanceOverEnum.INVOICE_OVERTIME==emailTemplateEnum){ | |
140 | + helper.setText(emailTemplateEnum.getDesc()+orderEventJobVO.getInvoiceBillOrderDO().getInvoiceNo()+" "+ Constant.FINANCE_EVENT_TIME); | |
141 | + }else if(FinanceOverEnum.PRODUCE_PAYMENT_CHECK_OVERTIME==emailTemplateEnum){ | |
142 | + helper.setText(emailTemplateEnum.getDesc()+orderEventJobVO.getProducePaymentCheckBillOrderDO().getCheckNo()+" "+Constant.FINANCE_EVENT_TIME); | |
143 | + } | |
144 | + } catch ( MessagingException e) { | |
145 | + throw new RuntimeException("邮件发送失败!", e); | |
146 | + } | |
147 | + javaMailSender.send(mimeMessage); | |
148 | + } | |
149 | + | |
110 | 150 | } |
111 | 151 | \ No newline at end of file | ... | ... |
src/main/java/com/order/erp/common/utils/OrderFieldUtils.java
... | ... | @@ -38,9 +38,9 @@ public class OrderFieldUtils { |
38 | 38 | * @param orderId |
39 | 39 | * @return |
40 | 40 | */ |
41 | - public static OrderFieldLockApplyDO generatorBaseInfoFieldLockApplyDO(OrderBaseFieldVO baseFields, Long userId, Long orderId) { | |
41 | + public static OrderFieldLockApplyDO generatorBaseInfoFieldLockApplyDO(OrderUnlockFieldApplyVO fieldVO, Long userId, Long orderId) { | |
42 | 42 | OrderLockFieldVO lockFieldVO = new OrderLockFieldVO(); |
43 | - lockFieldVO.setBaseFields(baseFields); | |
43 | + lockFieldVO.setBaseFields(fieldVO.getBaseFields()); | |
44 | 44 | OrderFieldLockApplyDO applyDO = OrderFieldLockApplyDO.builder() |
45 | 45 | .applyUserId(userId) |
46 | 46 | .auditUserId(null) |
... | ... | @@ -49,12 +49,14 @@ public class OrderFieldUtils { |
49 | 49 | .remark(ApplyTypeEnum.FIELD_EDIT_APPLY.getDesc()) |
50 | 50 | .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) |
51 | 51 | .build(); |
52 | - if (Objects.nonNull(baseFields) && checkOrderBaseField4apply(baseFields)) { | |
52 | + if (Objects.nonNull(fieldVO.getBaseFields()) && checkOrderBaseField4apply(fieldVO.getBaseFields())) { | |
53 | 53 | lockFieldVO.setInspectionStageFields(initInspectionStageField(OrderLockFieldEnum.LOCKED)); |
54 | 54 | lockFieldVO.setProfitAnalysisFields(initProfitAnalysisField(OrderLockFieldEnum.LOCKED)); |
55 | 55 | lockFieldVO.setReportFields(initReportField(OrderLockFieldEnum.LOCKED)); |
56 | 56 | lockFieldVO.setTrackStageFields(initTrackStageField(OrderLockFieldEnum.LOCKED)); |
57 | 57 | applyDO.setFields(JSONObject.toJSONString(lockFieldVO)); |
58 | + //在这里增加字段的描述。 applyDO.setXxxx("xxxx原因。"); | |
59 | + applyDO.setApplyRemark(fieldVO.getApplyRemark()); | |
58 | 60 | applyDO.setAuditRoleCodes(RoleEnum.BUSINESS_USER.getCode() + Constant.COMMA_CHARACTER + RoleEnum.ADMIN.getCode()); |
59 | 61 | return applyDO; |
60 | 62 | } else { |
... | ... | @@ -97,7 +99,7 @@ public class OrderFieldUtils { |
97 | 99 | */ |
98 | 100 | public static List<OrderFieldLockApplyDO> initOrderFieldLockApplyDOS(OrderUnlockFieldApplyVO fieldVO, Long userId) { |
99 | 101 | List<OrderFieldLockApplyDO> resultList = new ArrayList<>(); |
100 | - OrderFieldLockApplyDO baseLockApply = generatorBaseInfoFieldLockApplyDO(fieldVO.getBaseFields(), userId, fieldVO.getOrderId()); | |
102 | + OrderFieldLockApplyDO baseLockApply = generatorBaseInfoFieldLockApplyDO(fieldVO, userId, fieldVO.getOrderId()); | |
101 | 103 | if (Objects.nonNull(baseLockApply)) { |
102 | 104 | resultList.add(baseLockApply); |
103 | 105 | } | ... | ... |
src/main/java/com/order/erp/common/utils/RedisUtils.java
... | ... | @@ -167,11 +167,17 @@ public class RedisUtils { |
167 | 167 | * @param keys |
168 | 168 | * @return |
169 | 169 | */ |
170 | - public List<Object> multiGet(List<String> keys) { | |
171 | - Object obj = redisTemplate.opsForValue().multiGet(Collections.singleton(keys)); | |
172 | - return null; | |
170 | + public List<Object> multiGet(List<Object> keys) { | |
171 | + try { | |
172 | + List<Object> values = redisTemplate.opsForValue().multiGet(keys); | |
173 | + return values != null ? values : Collections.emptyList(); | |
174 | + } catch (Exception e) { | |
175 | + e.printStackTrace(); | |
176 | + return Collections.emptyList(); | |
177 | + } | |
173 | 178 | } |
174 | 179 | |
180 | + | |
175 | 181 | /** |
176 | 182 | * 普通缓存放入 |
177 | 183 | * |
... | ... | @@ -643,4 +649,41 @@ public class RedisUtils { |
643 | 649 | return 0; |
644 | 650 | } |
645 | 651 | } |
652 | + /** | |
653 | + * set方式设置值 | |
654 | + * | |
655 | + * @param key 键 | |
656 | + * @param count 移除多少个 | |
657 | + * @param value 值 | |
658 | + * @return 移除的个数 | |
659 | + */ | |
660 | + public boolean saddWithExpiry(String key, Object value, long time, TimeUnit timeUnit) { | |
661 | + try { | |
662 | + redisTemplate.opsForSet().add(key, value); | |
663 | + if (time > 0) { | |
664 | + redisTemplate.expire(key, time, timeUnit); | |
665 | + } | |
666 | + return true; | |
667 | + } catch (Exception e) { | |
668 | + e.printStackTrace(); | |
669 | + return false; | |
670 | + } | |
671 | + } | |
672 | + /** | |
673 | + * set方式获取多个值 | |
674 | + * | |
675 | + * @param key 键 | |
676 | + * @param count 移除多少个 | |
677 | + * @param value 值 | |
678 | + * @return 移除的个数 | |
679 | + */ | |
680 | + public Set<Object> getSetValues(String key) { | |
681 | + try { | |
682 | + return redisTemplate.opsForSet().members(key); | |
683 | + } catch (Exception e) { | |
684 | + e.printStackTrace(); | |
685 | + return null; | |
686 | + } | |
687 | + } | |
688 | + | |
646 | 689 | } | ... | ... |
src/main/java/com/order/erp/controller/CalculateProfitController.java
0 → 100644
1 | +package com.order.erp.controller; | |
2 | + | |
3 | +import com.order.erp.common.constant.ServerResult; | |
4 | +import com.order.erp.domain.vo.order.BusinessProfitRatioQueryVO; | |
5 | +import com.order.erp.domain.vo.order.InnerProfitRatioQueryVO; | |
6 | +import com.order.erp.service.order.impl.CalculateProfitServiceImpl; | |
7 | +import org.springframework.validation.annotation.Validated; | |
8 | +import org.springframework.web.bind.annotation.PostMapping; | |
9 | +import org.springframework.web.bind.annotation.RequestBody; | |
10 | +import org.springframework.web.bind.annotation.RequestMapping; | |
11 | +import org.springframework.web.bind.annotation.RestController; | |
12 | + | |
13 | +import javax.annotation.Resource; | |
14 | +import javax.servlet.http.HttpServletResponse; | |
15 | +import java.io.IOException; | |
16 | + | |
17 | +/** | |
18 | + * 应收款账单表(InvoiceBillOrder)表控制层 | |
19 | + * | |
20 | + * @author makejava | |
21 | + * @since 2024-08-05 16:26:34 | |
22 | + */ | |
23 | +@RestController | |
24 | +@RequestMapping("/order/erp/calculate_profit") | |
25 | +public class CalculateProfitController { | |
26 | + /** | |
27 | + * 服务对象 | |
28 | + */ | |
29 | + @Resource | |
30 | + private CalculateProfitServiceImpl calculateProfitService; | |
31 | + | |
32 | + /** | |
33 | + * 业务/研发净利润分析 | |
34 | + * | |
35 | + * @param queryVO 查询条件 | |
36 | + * @return 查询结果 | |
37 | + */ | |
38 | + @PostMapping("/business_profit_ratio") | |
39 | + public ServerResult businessProfitRatio(@RequestBody @Validated BusinessProfitRatioQueryVO queryVO) { | |
40 | + return calculateProfitService.businessProfitRatio(queryVO); | |
41 | + } | |
42 | + | |
43 | + /** | |
44 | + * 业务/研发净利润分析-导出 | |
45 | + * | |
46 | + * @param queryVO 查询条件 | |
47 | + * @return 查询结果 | |
48 | + */ | |
49 | + @PostMapping("/business_profit_ratio_export") | |
50 | + public void businessProfitRatioExport(HttpServletResponse response, @RequestBody @Validated BusinessProfitRatioQueryVO queryVO) throws IOException { | |
51 | + calculateProfitService.businessProfitRatioExport(response, queryVO); | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 内部生产净利润分析表 | |
56 | + * | |
57 | + * @param queryVO 查询条件 | |
58 | + * @return 查询结果 | |
59 | + */ | |
60 | + @PostMapping("/inner_profit_ratio") | |
61 | + public ServerResult innerProfitRatio(@RequestBody @Validated InnerProfitRatioQueryVO queryVO) { | |
62 | + return calculateProfitService.innerProfitRatio(queryVO); | |
63 | + } | |
64 | + | |
65 | + /** | |
66 | + * 内部生产净利润分析表-导出 | |
67 | + * | |
68 | + * @param queryVO 查询条件 | |
69 | + * @return 查询结果 | |
70 | + */ | |
71 | + @PostMapping("/inner_profit_ratio_export") | |
72 | + public void innerProfitRatioExport(HttpServletResponse response,@RequestBody @Validated InnerProfitRatioQueryVO queryVO) throws IOException { | |
73 | + calculateProfitService.innerProfitRatioExport(response,queryVO); | |
74 | + } | |
75 | +} | |
76 | + | ... | ... |
src/main/java/com/order/erp/controller/InvoiceBillOrderController.java
0 → 100644
1 | +package com.order.erp.controller; | |
2 | + | |
3 | +import com.order.erp.common.annotation.AnonymousAccess; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.common.excel4j.exceptions.Excel4JException; | |
6 | +import com.order.erp.common.jsr303.OperateGroup; | |
7 | +import com.order.erp.domain.dto.order.InvoiceBillOrderDO; | |
8 | +import com.order.erp.domain.vo.order.*; | |
9 | +import com.order.erp.service.order.InvoiceBillOrderService; | |
10 | +import io.swagger.annotations.ApiOperation; | |
11 | +import org.springframework.validation.annotation.Validated; | |
12 | +import org.springframework.web.bind.annotation.PostMapping; | |
13 | +import org.springframework.web.bind.annotation.RequestBody; | |
14 | +import org.springframework.web.bind.annotation.RequestMapping; | |
15 | +import org.springframework.web.bind.annotation.RestController; | |
16 | + | |
17 | +import javax.annotation.Resource; | |
18 | +import javax.servlet.http.HttpServletResponse; | |
19 | +import java.io.IOException; | |
20 | + | |
21 | +/** | |
22 | + * 应收款账单表(InvoiceBillOrder)表控制层 | |
23 | + * | |
24 | + * @author makejava | |
25 | + * @since 2024-08-05 16:26:34 | |
26 | + */ | |
27 | +@RestController | |
28 | +@RequestMapping("/order/erp/invoice_bill") | |
29 | +public class InvoiceBillOrderController { | |
30 | + /** | |
31 | + * 服务对象 | |
32 | + */ | |
33 | + @Resource | |
34 | + private InvoiceBillOrderService invoiceBillOrderService; | |
35 | + | |
36 | + /** | |
37 | + * 分页查询 | |
38 | + * | |
39 | + * @param invoiceBillOrderQueryVO 查询条件 | |
40 | + * @return 查询结果 | |
41 | + */ | |
42 | + @PostMapping("/list_by_page") | |
43 | + public ServerResult listByPage(@RequestBody @Validated({OperateGroup.List.class}) InvoiceBillOrderQueryVO invoiceBillOrderQueryVO) { | |
44 | + return invoiceBillOrderService.listByPage(invoiceBillOrderQueryVO); | |
45 | + } | |
46 | + | |
47 | + /** | |
48 | + * 基础订单查询 | |
49 | + * | |
50 | + * @param queryVO 查询条件 | |
51 | + * @return 查询结果 | |
52 | + */ | |
53 | + @PostMapping("/list_base_order_info_by") | |
54 | + public ServerResult listBaseOrderInfoBy(@RequestBody @Validated InvoiceBaseOrderQueryVO queryVO) { | |
55 | + return invoiceBillOrderService.listBaseOrderInfoBy(queryVO); | |
56 | + } | |
57 | + | |
58 | + /** | |
59 | + * 分析列表 | |
60 | + * | |
61 | + * @param queryVO 查询条件 | |
62 | + * @return 查询结果 | |
63 | + */ | |
64 | + @PostMapping("/list_analysis_by") | |
65 | + public ServerResult listAnalysisBy(@RequestBody @Validated({OperateGroup.List.class}) InvoiceBillAnalysisVO queryVO) { | |
66 | + return invoiceBillOrderService.listAnalysisBy(queryVO); | |
67 | + } | |
68 | + | |
69 | + /** | |
70 | + * 导出分析列表 | |
71 | + * | |
72 | + * @param queryVO 查询条件 | |
73 | + * @return 查询结果 | |
74 | + */ | |
75 | + @PostMapping(value = "/export") | |
76 | + @ApiOperation("导出分析列表") | |
77 | + @AnonymousAccess | |
78 | + public void export(HttpServletResponse response, @RequestBody @Validated InvoiceBillAnalysisVO queryVO) throws IOException, Excel4JException { | |
79 | + invoiceBillOrderService.export(response, queryVO); | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * 创建invoice单据 | |
84 | + * | |
85 | + * @param createVO 数据VO | |
86 | + * @return 新增结果 | |
87 | + */ | |
88 | + @PostMapping("/create") | |
89 | + public ServerResult create(@RequestBody InvoiceBillCreateVO createVO) { | |
90 | + return invoiceBillOrderService.create(createVO); | |
91 | + } | |
92 | + | |
93 | + /** | |
94 | + * 获取必须回款日期 | |
95 | + * | |
96 | + * @param createVO 数据VO | |
97 | + * @return 新增结果 | |
98 | + */ | |
99 | + @PostMapping("/get_back_refund_date") | |
100 | + public ServerResult getBackRefundDate(@RequestBody InvoiceBillCreateVO createVO) { | |
101 | + return invoiceBillOrderService.getBackRefundDate(createVO); | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * 更新扣款信息 | |
106 | + * | |
107 | + * @param deductInfoVO 数据VO | |
108 | + * @return 编辑结果 | |
109 | + */ | |
110 | + @PostMapping("/update_deduct_info") | |
111 | + public ServerResult updateDeductInfo(@RequestBody InvoiceBillDeductInfoVO deductInfoVO) { | |
112 | + return invoiceBillOrderService.updateDeductInfo(deductInfoVO); | |
113 | + } | |
114 | + | |
115 | + /** | |
116 | + * 更新其他金额信息 | |
117 | + * | |
118 | + * @param amountInfoVO 数据VO | |
119 | + * @return 编辑结果 | |
120 | + */ | |
121 | + @PostMapping("/update_amount_info") | |
122 | + public ServerResult updateAmountInfo(@RequestBody InvoiceBillAmountInfoVO amountInfoVO) { | |
123 | + return invoiceBillOrderService.updateAmountInfo(amountInfoVO); | |
124 | + } | |
125 | + | |
126 | + /** | |
127 | + * 提交审核 | |
128 | + * | |
129 | + * @param commitApplyVO 数据VO | |
130 | + * @return 编辑结果 | |
131 | + */ | |
132 | + @PostMapping("/commit_apply") | |
133 | + public ServerResult commitApply(@RequestBody InvoiceBillCommitApplyVO commitApplyVO) { | |
134 | + return invoiceBillOrderService.commitApply(commitApplyVO); | |
135 | + } | |
136 | + | |
137 | + /** | |
138 | + * 删除数据 | |
139 | + * | |
140 | + * @param invoiceBillOrderQueryVO 查询条件 | |
141 | + * @return 删除是否成功 | |
142 | + */ | |
143 | + @PostMapping("/delete_by_id") | |
144 | + public ServerResult deleteById(@RequestBody InvoiceBillOrderQueryVO invoiceBillOrderQueryVO) { | |
145 | + return invoiceBillOrderService.deleteById(invoiceBillOrderQueryVO); | |
146 | + } | |
147 | + /** | |
148 | + * 获取扣款单 | |
149 | + * | |
150 | + * @param invoiceBillOrderQueryVO 查询条件 | |
151 | + * @return 扣款单 | |
152 | + */ | |
153 | + @PostMapping("/getDeductUrl_by_id") | |
154 | + public ServerResult getDeductUrl(@RequestBody InvoiceBillOrderQueryVO invoiceBillOrderQueryVO) { | |
155 | + return invoiceBillOrderService.getDeductUrlById(invoiceBillOrderQueryVO); | |
156 | + } | |
157 | + /** | |
158 | + * 重新上传报关单 | |
159 | + * | |
160 | + * @param bgUrl 报关单 | |
161 | + * @return | |
162 | + */ | |
163 | + @PostMapping("/reUploadBgUrl") | |
164 | + public ServerResult getDeductUrl(@RequestBody InvoiceBillCreateVO bgUrl) { | |
165 | + return invoiceBillOrderService.reUploadBgurl(bgUrl); | |
166 | + } | |
167 | + | |
168 | + /** | |
169 | + * 审核时导出的付款单 | |
170 | + * @param queryVO 报关单 | |
171 | + * @return | |
172 | + */ | |
173 | + @PostMapping("/exportReceipt") | |
174 | + @AnonymousAccess | |
175 | + public void exportReceipt(HttpServletResponse response, @RequestBody InvoiceBillOrderDO queryVO) throws IOException { | |
176 | + invoiceBillOrderService.exportReceipt(response,queryVO); | |
177 | + } | |
178 | + | |
179 | +} | |
180 | + | ... | ... |
src/main/java/com/order/erp/controller/ProducePaymentCheckBillOrderController.java
0 → 100644
1 | +package com.order.erp.controller; | |
2 | + | |
3 | +import com.order.erp.common.annotation.AnonymousAccess; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.common.excel4j.exceptions.Excel4JException; | |
6 | +import com.order.erp.common.jsr303.OperateGroup; | |
7 | +import com.order.erp.domain.dto.order.ProducePaymentCheckBillOrderDO; | |
8 | +import com.order.erp.domain.vo.order.*; | |
9 | +import com.order.erp.service.order.ProducePaymentCheckBillOrderService; | |
10 | +import io.swagger.annotations.ApiOperation; | |
11 | +import org.springframework.validation.annotation.Validated; | |
12 | +import org.springframework.web.bind.annotation.PostMapping; | |
13 | +import org.springframework.web.bind.annotation.RequestBody; | |
14 | +import org.springframework.web.bind.annotation.RequestMapping; | |
15 | +import org.springframework.web.bind.annotation.RestController; | |
16 | + | |
17 | +import javax.annotation.Resource; | |
18 | +import javax.servlet.http.HttpServletResponse; | |
19 | +import java.io.IOException; | |
20 | + | |
21 | +/** | |
22 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)表控制 | |
23 | + * | |
24 | + * @author makejava | |
25 | + * @since 2024-08-05 16:26:35 | |
26 | + */ | |
27 | +@RestController | |
28 | +@RequestMapping("/order/erp/check_bill/") | |
29 | +public class ProducePaymentCheckBillOrderController { | |
30 | + /** | |
31 | + * 服务对象 | |
32 | + */ | |
33 | + @Resource | |
34 | + private ProducePaymentCheckBillOrderService producePaymentCheckBillOrderService; | |
35 | + | |
36 | + /** | |
37 | + * 分页查询 | |
38 | + * | |
39 | + * @param queryVO 查询条件 | |
40 | + * @return 查询结果 | |
41 | + */ | |
42 | + @PostMapping("/list_by_page") | |
43 | + public ServerResult listByPage(@RequestBody @Validated({OperateGroup.List.class}) ProducePaymentCheckBillOrderQueryVO queryVO) { | |
44 | + return producePaymentCheckBillOrderService.listByPage(queryVO); | |
45 | + } | |
46 | + | |
47 | + /** | |
48 | + * 基础订单查询 | |
49 | + * | |
50 | + * @param queryVO 查询条件 | |
51 | + * @return 查询结果 | |
52 | + */ | |
53 | + @PostMapping("/list_base_order_info_by") | |
54 | + public ServerResult listBaseOrderInfoBy(@RequestBody @Validated ProducePaymentBaseOrderQueryVO queryVO) { | |
55 | + return producePaymentCheckBillOrderService.listBaseOrderInfoBy(queryVO); | |
56 | + } | |
57 | + | |
58 | + /** | |
59 | + * 分析列表 | |
60 | + * | |
61 | + * @param queryVO 查询条件 | |
62 | + * @return 查询结果 | |
63 | + */ | |
64 | + @PostMapping("/list_analysis_by") | |
65 | + public ServerResult listAnalysisBy(@RequestBody @Validated({OperateGroup.List.class}) ProducePaymentCheckBillOrderQueryVO queryVO) { | |
66 | + return producePaymentCheckBillOrderService.listAnalysisBy(queryVO); | |
67 | + } | |
68 | + | |
69 | + /** | |
70 | + * 导出分析列表 | |
71 | + * | |
72 | + * @param queryVO 查询条件 | |
73 | + * @return 查询结果 | |
74 | + */ | |
75 | + @PostMapping(value = "/export") | |
76 | + @ApiOperation("导出分析列表") | |
77 | + @AnonymousAccess | |
78 | + public void export(HttpServletResponse response, @RequestBody @Validated ProducePaymentCheckBillOrderQueryVO queryVO) throws IOException, Excel4JException { | |
79 | + producePaymentCheckBillOrderService.export(response, queryVO); | |
80 | + } | |
81 | + | |
82 | + /** | |
83 | + * 创建生产科应付单据 | |
84 | + * | |
85 | + * @param createVO 数据VO | |
86 | + * @return 新增结果 | |
87 | + */ | |
88 | + @PostMapping("/create") | |
89 | + public ServerResult create(@RequestBody ProducePaymentCheckBillCreateVO createVO) { | |
90 | + return producePaymentCheckBillOrderService.create(createVO); | |
91 | + } | |
92 | + | |
93 | + /** | |
94 | + * 获取生产科应回款日期 | |
95 | + * | |
96 | + * @param createVO 数据VO | |
97 | + * @return 新增结果 | |
98 | + */ | |
99 | + @PostMapping("/get_payed_date") | |
100 | + public ServerResult getPayedDate(@RequestBody ProducePaymentCheckBillCreateVO createVO) { | |
101 | + return producePaymentCheckBillOrderService.getPayedDate(createVO); | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * 更新扣款信息 | |
106 | + * | |
107 | + * @param deductInfoVO 数据VO | |
108 | + * @return 编辑结果 | |
109 | + */ | |
110 | + @PostMapping("/update_deduct_info") | |
111 | + public ServerResult updateDeductInfo(@RequestBody ProducePaymentCheckBillDeductInfoVO deductInfoVO) { | |
112 | + return producePaymentCheckBillOrderService.updateDeductInfo(deductInfoVO); | |
113 | + } | |
114 | + | |
115 | + /** | |
116 | + * 更新其他金额信息 | |
117 | + * | |
118 | + * @param amountInfoVO 数据VO | |
119 | + * @return 编辑结果 | |
120 | + */ | |
121 | + @PostMapping("/update_amount_info") | |
122 | + public ServerResult updateAmountInfo(@RequestBody ProducePaymentCheckBillAmountInfoVO amountInfoVO) { | |
123 | + return producePaymentCheckBillOrderService.updateAmountInfo(amountInfoVO); | |
124 | + } | |
125 | + | |
126 | + /** | |
127 | + * 更新发票信息 | |
128 | + * | |
129 | + * @param invoiceInfoVO 数据VO | |
130 | + * @return 编辑结果 | |
131 | + */ | |
132 | + @PostMapping("/update_invoice_info") | |
133 | + public ServerResult updateInvoiceInfo(@RequestBody ProducePaymentCheckBillInvoiceInfoVO invoiceInfoVO) { | |
134 | + return producePaymentCheckBillOrderService.updateInvoiceInfo(invoiceInfoVO); | |
135 | + } | |
136 | + | |
137 | + /** | |
138 | + * 提交审核 | |
139 | + * | |
140 | + * @param commitApplyVO 数据VO | |
141 | + * @return 编辑结果 | |
142 | + */ | |
143 | + @PostMapping("/commit_apply") | |
144 | + public ServerResult commitApply(@RequestBody ProducePaymentCheckBillCommitApplyVO commitApplyVO) { | |
145 | + return producePaymentCheckBillOrderService.commitApply(commitApplyVO); | |
146 | + } | |
147 | + | |
148 | + /** | |
149 | + * 删除数据 | |
150 | + * | |
151 | + * @param producePaymentCheckBillOrderQueryVO 查询条件 | |
152 | + * @return 删除是否成功 | |
153 | + */ | |
154 | + @PostMapping("/delete_by_id") | |
155 | + public ServerResult deleteById(@RequestBody ProducePaymentCheckBillOrderQueryVO producePaymentCheckBillOrderQueryVO) { | |
156 | + return producePaymentCheckBillOrderService.deleteById(producePaymentCheckBillOrderQueryVO); | |
157 | + } | |
158 | + /** | |
159 | + * 获取扣款单 | |
160 | + * | |
161 | + * @param producePaymentCheckBillOrderQueryVO 查询条件 | |
162 | + * @return 扣款单 | |
163 | + */ | |
164 | + @PostMapping("/getDeductUrl_by_id") | |
165 | + public ServerResult getDeductUrl(@RequestBody ProducePaymentCheckBillOrderQueryVO producePaymentCheckBillOrderQueryVO) { | |
166 | + //一定要保证文件中包含?和/.这样才不会报错。 | |
167 | + return producePaymentCheckBillOrderService.getDeductUrlById(producePaymentCheckBillOrderQueryVO); | |
168 | + } | |
169 | + /** | |
170 | + * 获取生产科发票 | |
171 | + * | |
172 | + * @param producePaymentCheckBillOrderQueryVO 查询条件 | |
173 | + * @return 扣款单 | |
174 | + */ | |
175 | + @PostMapping("/getInvoiceUrl_by_id") | |
176 | + public ServerResult getInvoiceUrl(@RequestBody ProducePaymentCheckBillOrderQueryVO producePaymentCheckBillOrderQueryVO) { | |
177 | + return producePaymentCheckBillOrderService.getInvoiceUrlById(producePaymentCheckBillOrderQueryVO); | |
178 | + } | |
179 | + /** | |
180 | + * 审核付款单导出 | |
181 | + * | |
182 | + * @param queryVO 查询条件 | |
183 | + * @return 扣款单 | |
184 | + */ | |
185 | + @PostMapping("/exportReceipt") | |
186 | + @AnonymousAccess | |
187 | + public void exportReceipt(HttpServletResponse response, @RequestBody ProducePaymentCheckBillOrderDO queryVO) throws IOException { | |
188 | + producePaymentCheckBillOrderService.exportReceipt(response,queryVO); | |
189 | + } | |
190 | +} | |
191 | + | ... | ... |
src/main/java/com/order/erp/domain/ApplyStatusEnum.java
src/main/java/com/order/erp/domain/ApplyTypeEnum.java
... | ... | @@ -18,6 +18,12 @@ public enum ApplyTypeEnum { |
18 | 18 | ORDER_PROFIT_APPLY(10, "利润分析申请"), |
19 | 19 | |
20 | 20 | ORDER_REPORT_APPLY(20, "项目报告书申请"), |
21 | + | |
22 | + INVOICE_BILL_APPLY(30, "应收账单申请"), | |
23 | + | |
24 | + CHECK_BILL_APPLY(40, "应付账单申请"), | |
25 | + | |
26 | + DEPARTMENT_INVOICE_APPLY(50,"生产科发票申请"), | |
21 | 27 | ; |
22 | 28 | private Integer type; |
23 | 29 | ... | ... |
src/main/java/com/order/erp/domain/FinanceOverEnum.java
0 → 100644
1 | +package com.order.erp.domain; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Getter; | |
5 | + | |
6 | +@Getter | |
7 | +@AllArgsConstructor | |
8 | +public enum FinanceOverEnum { | |
9 | + INVOICE_OVERTIME("你有invoice应收款未提交,请查收","Hi All 你以下invoice已超过回款日期,仍未生成应收款对账单提交审核,麻烦财务查询是否已打款,如未打款请业务员及时跟进\n。Invoice号为:"), | |
10 | + PRODUCE_PAYMENT_CHECK_OVERTIME("你有生产科对账单未提交,请查收","Hi All 你以下生产科对账单已超过应付款日期,麻烦财务查询是否已打款,如未打款请说明原因,如未收到发票,请业务员及时跟进\n。生产科对账单号为:"), | |
11 | + ; | |
12 | + | |
13 | + private String title; | |
14 | + private String desc; | |
15 | + | |
16 | +} | ... | ... |
src/main/java/com/order/erp/domain/RoleEnum.java
src/main/java/com/order/erp/domain/dto/order/CheckBillMappingDO.java
0 → 100644
1 | +package com.order.erp.domain.dto.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.TableName; | |
4 | +import com.order.erp.domain.dto.BaseDO; | |
5 | +import lombok.*; | |
6 | +import lombok.experimental.SuperBuilder; | |
7 | + | |
8 | +import java.io.Serializable; | |
9 | + | |
10 | +/** | |
11 | + * 生产科对账单应收账单映射表(CheckBillMapping)实体类 | |
12 | + * | |
13 | + * @author makejava | |
14 | + * @since 2024-08-05 16:26:36 | |
15 | + */ | |
16 | +@TableName("check_bill_mapping") | |
17 | +@Data | |
18 | +@AllArgsConstructor | |
19 | +@ToString | |
20 | +@NoArgsConstructor | |
21 | +@EqualsAndHashCode(callSuper = false) | |
22 | +@SuperBuilder | |
23 | +public class CheckBillMappingDO extends BaseDO implements Serializable { | |
24 | + private static final long serialVersionUID = 199786248752278040L; | |
25 | + | |
26 | + private Long id; | |
27 | + /** | |
28 | + * 生产科对账单号 | |
29 | + */ | |
30 | + private String checkNo; | |
31 | + /** | |
32 | + * check账单id | |
33 | + */ | |
34 | + private Long checkBillId; | |
35 | + /** | |
36 | + * 订单id | |
37 | + */ | |
38 | + private Long orderId; | |
39 | + | |
40 | +} | ... | ... |
src/main/java/com/order/erp/domain/dto/order/InvoiceBillMappingDO.java
0 → 100644
1 | +package com.order.erp.domain.dto.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.TableName; | |
4 | +import com.order.erp.domain.dto.BaseDO; | |
5 | +import lombok.*; | |
6 | +import lombok.experimental.SuperBuilder; | |
7 | + | |
8 | +import java.io.Serializable; | |
9 | + | |
10 | +/** | |
11 | + * 应收款账单关联订单映射表(InvoiceBillMapping)实体类 | |
12 | + * | |
13 | + * @author makejava | |
14 | + * @since 2024-08-05 16:26:36 | |
15 | + */ | |
16 | +@TableName("invoice_bill_mapping") | |
17 | +@Data | |
18 | +@AllArgsConstructor | |
19 | +@ToString | |
20 | +@NoArgsConstructor | |
21 | +@EqualsAndHashCode(callSuper = false) | |
22 | +@SuperBuilder | |
23 | +public class InvoiceBillMappingDO extends BaseDO implements Serializable { | |
24 | + | |
25 | + private Long id; | |
26 | + /** | |
27 | + * 发票单号 | |
28 | + */ | |
29 | + private String invoiceNo; | |
30 | + /** | |
31 | + * invoice账单id | |
32 | + */ | |
33 | + private Long invoiceBillId; | |
34 | + /** | |
35 | + * 订单id | |
36 | + */ | |
37 | + private Long orderId; | |
38 | + | |
39 | +} | ... | ... |
src/main/java/com/order/erp/domain/dto/order/InvoiceBillOrderDO.java
0 → 100644
1 | +package com.order.erp.domain.dto.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.TableName; | |
4 | +import com.order.erp.domain.dto.BaseDO; | |
5 | +import lombok.*; | |
6 | +import lombok.experimental.SuperBuilder; | |
7 | + | |
8 | +import java.io.Serializable; | |
9 | +import java.math.BigDecimal; | |
10 | + | |
11 | +/** | |
12 | + * 应收款账单表(InvoiceBillOrder)实体类 | |
13 | + * | |
14 | + * @author makejava | |
15 | + * @since 2024-08-05 16:26:33 | |
16 | + */ | |
17 | +@TableName("invoice_bill_order") | |
18 | +@Data | |
19 | +@AllArgsConstructor | |
20 | +@ToString | |
21 | +@NoArgsConstructor | |
22 | +@EqualsAndHashCode(callSuper = false) | |
23 | +@SuperBuilder | |
24 | +public class InvoiceBillOrderDO extends BaseDO implements Serializable { | |
25 | + | |
26 | + private Long id; | |
27 | + /** | |
28 | + * 发票单号 | |
29 | + */ | |
30 | + private String invoiceNo; | |
31 | + /** | |
32 | + * 报关单url地址 | |
33 | + */ | |
34 | + private String bgUrl; | |
35 | + /** | |
36 | + * 必须回款日期 | |
37 | + */ | |
38 | + private String backRefundDate; | |
39 | + /** | |
40 | + * 实际回款日期 | |
41 | + */ | |
42 | + private String actualRefundDate; | |
43 | + | |
44 | + /** | |
45 | + * 发生扣款金额 | |
46 | + */ | |
47 | + private BigDecimal deductAmount; | |
48 | + /** | |
49 | + * 扣款单url地址 | |
50 | + */ | |
51 | + private String deductUrl; | |
52 | + /** | |
53 | + * 实际应收金额 | |
54 | + */ | |
55 | + private BigDecimal actualReceivableAmount; | |
56 | + /** | |
57 | + * 实际应付金额1 | |
58 | + */ | |
59 | + private BigDecimal actualPayedAmount1; | |
60 | + /** | |
61 | + * 实际应付金额2 | |
62 | + */ | |
63 | + private BigDecimal actualPayedAmount2; | |
64 | + /** | |
65 | + * 实际应付金额3 | |
66 | + */ | |
67 | + private BigDecimal actualPayedAmount3; | |
68 | + /** | |
69 | + * 其他费用金额 | |
70 | + */ | |
71 | + private BigDecimal otherAmount; | |
72 | + /** | |
73 | + * 总经理审核状态 0:待审核、1:审核通过,2:审核驳回 | |
74 | + */ | |
75 | + private Integer status; | |
76 | + //需要在表中添加字段。 | |
77 | + /** | |
78 | + * 客户总价金额汇总 | |
79 | + * */ | |
80 | + private BigDecimal totalCustomerAmount; | |
81 | + | |
82 | + /** | |
83 | + * 实际付款金额汇总 | |
84 | + * */ | |
85 | + private BigDecimal totalPayAmount; | |
86 | + /** | |
87 | + * 业务员 | |
88 | + * */ | |
89 | + private String businesPerson; | |
90 | + /** | |
91 | + * 收款单位 | |
92 | + * */ | |
93 | + private String payee; | |
94 | + /** | |
95 | + * 财务 --审核时使用。 | |
96 | + * */ | |
97 | + private String financePerson; | |
98 | + | |
99 | +} | ... | ... |
src/main/java/com/order/erp/domain/dto/order/OrderFieldLockApplyDO.java
src/main/java/com/order/erp/domain/dto/order/OrderProfitAnalysisDO.java
src/main/java/com/order/erp/domain/dto/order/ProducePaymentCheckBillOrderDO.java
0 → 100644
1 | +package com.order.erp.domain.dto.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.TableName; | |
4 | +import com.order.erp.domain.dto.BaseDO; | |
5 | +import lombok.*; | |
6 | +import lombok.experimental.SuperBuilder; | |
7 | + | |
8 | +import java.io.Serializable; | |
9 | +import java.math.BigDecimal; | |
10 | + | |
11 | +/** | |
12 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
13 | + * | |
14 | + * @author makejava | |
15 | + * @since 2024-08-05 16:26:35 | |
16 | + */ | |
17 | +@TableName("produce_payment_check_bill_order") | |
18 | +@Data | |
19 | +@AllArgsConstructor | |
20 | +@ToString | |
21 | +@NoArgsConstructor | |
22 | +@EqualsAndHashCode(callSuper = false) | |
23 | +@SuperBuilder | |
24 | +public class ProducePaymentCheckBillOrderDO extends BaseDO implements Serializable { | |
25 | + | |
26 | + private Long id; | |
27 | + /** | |
28 | + * 生产科对账单 | |
29 | + */ | |
30 | + private String checkNo; | |
31 | + /** | |
32 | + * 发票url地址 | |
33 | + */ | |
34 | + private String invoiceUrl; | |
35 | + /** | |
36 | + * 扣款单url地址 | |
37 | + */ | |
38 | + private String deductUrl; | |
39 | + /** | |
40 | + * 生产科应付款日期 | |
41 | + */ | |
42 | + private String payedDate; | |
43 | + | |
44 | + /** | |
45 | + * 生产科实际付款日期 | |
46 | + */ | |
47 | + private String actualPayedDate; | |
48 | + | |
49 | + /** | |
50 | + * 生产科扣款责任部门 | |
51 | + */ | |
52 | + private String deductDept; | |
53 | + /** | |
54 | + * 生产科扣款金额 | |
55 | + */ | |
56 | + private BigDecimal deductAmount; | |
57 | + /** | |
58 | + * 实际应付金额 | |
59 | + */ | |
60 | + private BigDecimal actualPayedAmount; | |
61 | + /** | |
62 | + * 实际应付金额1 | |
63 | + */ | |
64 | + private BigDecimal actualPayedAmount1; | |
65 | + /** | |
66 | + * 实际应付金额2 | |
67 | + */ | |
68 | + private BigDecimal actualPayedAmount2; | |
69 | + /** | |
70 | + * 实际应付金额3 | |
71 | + */ | |
72 | + private BigDecimal actualPayedAmount3; | |
73 | + /** | |
74 | + * 总经理审核状态 0:待审核、1:审核通过,2:审核驳回 | |
75 | + */ | |
76 | + private Integer status; | |
77 | + //需要在表中添加三个字段。 | |
78 | + /** | |
79 | + * 生产科发票审核状态 0:待审核、1:审核通过,2:审核驳回 | |
80 | + */ | |
81 | + private Integer departmentInvoiceStatus; | |
82 | + | |
83 | + /** | |
84 | + * 生产科总金额汇总 | |
85 | + * */ | |
86 | + private BigDecimal totalProductionAmount; | |
87 | + /** | |
88 | + * 实际付款金额汇总 | |
89 | + * */ | |
90 | + private BigDecimal totalActualPayedAmount; | |
91 | + /** | |
92 | + * 创建生产科对账单号选择的生产科 | |
93 | + * */ | |
94 | + private String productionName; | |
95 | + /** | |
96 | + * 未付金额 | |
97 | + * */ | |
98 | + private BigDecimal unPayedAmount; | |
99 | + /** | |
100 | + * 业务员 | |
101 | + * */ | |
102 | + private String businesPerson; | |
103 | + /** | |
104 | + * 财务 --审核时使用。 | |
105 | + * */ | |
106 | + private String financePerson; | |
107 | + | |
108 | + | |
109 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/CostSettingItemVO.java
0 → 100644
1 | +package com.order.erp.domain.vo; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | + | |
8 | +/** | |
9 | + * 系统配置(SystemSetting)实体类 | |
10 | + * | |
11 | + * @author makejava | |
12 | + * @since 2023-12-05 13:44:01 | |
13 | + */ | |
14 | +@Data | |
15 | +@AllArgsConstructor | |
16 | +@ToString | |
17 | +@NoArgsConstructor | |
18 | +@EqualsAndHashCode(callSuper = false) | |
19 | +@SuperBuilder | |
20 | +public class CostSettingItemVO implements Serializable { | |
21 | + | |
22 | + /** | |
23 | + * 关联code | |
24 | + */ | |
25 | + private String relationCode; | |
26 | + /** | |
27 | + * 名称 | |
28 | + */ | |
29 | + private String relationName; | |
30 | + /** | |
31 | + * 值 | |
32 | + */ | |
33 | + private String relationValue; | |
34 | + | |
35 | + | |
36 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/SystemSettingResultVO.java
... | ... | @@ -4,6 +4,7 @@ import lombok.*; |
4 | 4 | import lombok.experimental.SuperBuilder; |
5 | 5 | |
6 | 6 | import java.io.Serializable; |
7 | +import java.util.List; | |
7 | 8 | |
8 | 9 | /** |
9 | 10 | * @author makejava |
... | ... | @@ -47,5 +48,9 @@ public class SystemSettingResultVO implements Serializable { |
47 | 48 | */ |
48 | 49 | private String relationValue; |
49 | 50 | |
51 | + /** | |
52 | + * 成本配置 | |
53 | + */ | |
54 | + private List<CostSettingItemVO> costSettingItemVOS; | |
50 | 55 | |
51 | 56 | } | ... | ... |
src/main/java/com/order/erp/domain/vo/SystemSettingVO.java
... | ... | @@ -4,6 +4,7 @@ import lombok.*; |
4 | 4 | import lombok.experimental.SuperBuilder; |
5 | 5 | |
6 | 6 | import java.io.Serializable; |
7 | +import java.util.List; | |
7 | 8 | |
8 | 9 | /** |
9 | 10 | * 系统配置(SystemSetting)实体类 |
... | ... | @@ -49,5 +50,8 @@ public class SystemSettingVO implements Serializable { |
49 | 50 | */ |
50 | 51 | private String relationValue; |
51 | 52 | |
52 | - | |
53 | + /** | |
54 | + * 成本配置 | |
55 | + */ | |
56 | + private List<CostSettingItemVO> costSettingItemVOS; | |
53 | 57 | } | ... | ... |
src/main/java/com/order/erp/domain/vo/order/BusinessProfitRatioQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.vo.BasePageVO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import javax.validation.constraints.NotEmpty; | |
8 | +import javax.validation.constraints.NotNull; | |
9 | +import java.io.Serializable; | |
10 | +import java.math.BigDecimal; | |
11 | +import java.util.List; | |
12 | + | |
13 | +/** | |
14 | + * 业务/研发净利润分析 | |
15 | + * | |
16 | + * @author makejava | |
17 | + * @since 2024-08-05 16:26:34 | |
18 | + */ | |
19 | +@Data | |
20 | +@AllArgsConstructor | |
21 | +@ToString | |
22 | +@NoArgsConstructor | |
23 | +@EqualsAndHashCode(callSuper = false) | |
24 | +@SuperBuilder | |
25 | +public class BusinessProfitRatioQueryVO extends BasePageVO implements Serializable { | |
26 | + /** | |
27 | + * ids | |
28 | + */ | |
29 | + @NotEmpty(message = "选择订单不能为空") | |
30 | + private List<Long> ids; | |
31 | + | |
32 | + /** | |
33 | + * 客户编码 | |
34 | + */ | |
35 | + @NotEmpty(message = "客户编码不能为空") | |
36 | + private String customerCode; | |
37 | + | |
38 | + /** | |
39 | + * 项目号 | |
40 | + */ | |
41 | + @NotEmpty(message = "项目号不能为空") | |
42 | + private List<String> projectNo; | |
43 | + | |
44 | + /** | |
45 | + * 项目开发开始时间 | |
46 | + */ | |
47 | + @NotEmpty(message = "项目开发开始时间不能为空") | |
48 | + private String projectStartTime; | |
49 | + | |
50 | + /** | |
51 | + * 项目开发结束时间 | |
52 | + */ | |
53 | + @NotEmpty(message = "项目开发结束时间不能为空") | |
54 | + private String projectEndTime; | |
55 | + | |
56 | + /** | |
57 | + * 生产进行开始时间 这个没有使用过,应该不需要,所以应该不需要校验。 | |
58 | + */ | |
59 | + @NotEmpty(message = "生产进行开始时间不能为空") | |
60 | + private String produceStartTime; | |
61 | + | |
62 | + /** | |
63 | + * 生产进行结束时间 这个没有使用过,应该不需要,所以应该不需要校验。 | |
64 | + */ | |
65 | + @NotEmpty(message = "生产进行结束时间不能为空") | |
66 | + private String produceEndTime; | |
67 | + | |
68 | + | |
69 | + /** | |
70 | + * 研发开发费合计 | |
71 | + */ | |
72 | + @NotNull(message = "研发开发费合计不能为空") | |
73 | + private BigDecimal developTotalPrice; | |
74 | + | |
75 | + /** | |
76 | + * 复制费合计 | |
77 | + */ | |
78 | + @NotNull(message = "复制费合计不能为空") | |
79 | + private BigDecimal copyTotalPrice; | |
80 | + | |
81 | + | |
82 | + /** | |
83 | + * 西班牙提成比例 这个没有使用过,采用的是从系统中取出来的值。 应该可以删除。 | |
84 | + */ | |
85 | +// @NotNull(message = "西班牙提成比例不能为空") | |
86 | + private Double spainRatio; | |
87 | + | |
88 | + /** | |
89 | + * 中国团队提成比例 这个没有使用过,采用的是从系统中取出来的值。 应该可以删除。 | |
90 | + */ | |
91 | +// @NotNull(message = "中国团队提成比例不能为空") | |
92 | + private Double chinaRatio; | |
93 | + | |
94 | + | |
95 | + /** | |
96 | + * 包装费用实际金额由财务手动输入 | |
97 | + */ | |
98 | + @NotNull(message = "包装费用实际金额不能为空") | |
99 | + private BigDecimal packetActualTotalPrice; | |
100 | + | |
101 | + | |
102 | + /** | |
103 | + * 实际跟单单价=实际跟单费用/件数(人民币格式) | |
104 | + */ | |
105 | +// @NotNull(message = "实际跟单单价不能为空") | |
106 | + private Double actualRmbPrice; | |
107 | + | |
108 | + /** | |
109 | + * 实际跟单单价折算美金:人民币单价/汇率(6.2) | |
110 | + */ | |
111 | +// @NotNull(message = "实际跟单单价折算美金不能为空") | |
112 | + private Double actualPrice; | |
113 | + | |
114 | + /** | |
115 | + * 实际汇率(财务手动输入) | |
116 | + */ | |
117 | + @NotNull(message = "实际汇率不能为空") | |
118 | + private BigDecimal actualRatio; | |
119 | + /** | |
120 | + * 实际跟单费用(财务手动输入) | |
121 | + */ | |
122 | +// @NotNull(message = "实际跟单费用不能为空") | |
123 | + private Double actualdocumentaryPrice; | |
124 | + | |
125 | +} | |
126 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/BusinessProfitRatioResultVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 业务/研发净利润分析 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:34 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class BusinessProfitRatioResultVO implements Serializable { | |
22 | + | |
23 | + | |
24 | + /** | |
25 | + * 客户编码 | |
26 | + */ | |
27 | + private String customerCode; | |
28 | + | |
29 | + /** | |
30 | + * 项目号 | |
31 | + */ | |
32 | + private String projectNo; | |
33 | + | |
34 | + /** | |
35 | + * 项目开发开始时间 | |
36 | + */ | |
37 | + private String projectStartTime; | |
38 | + | |
39 | + /** | |
40 | + * 项目开发结束时间 | |
41 | + */ | |
42 | + private String projectEndTime; | |
43 | + | |
44 | + /** | |
45 | + * 生产进行开始时间 | |
46 | + */ | |
47 | + private String produceStartTime; | |
48 | + | |
49 | + /** | |
50 | + * 生产进行结束时间 | |
51 | + */ | |
52 | + private String produceEndTime; | |
53 | + | |
54 | + /** | |
55 | + * 客户总价$ | |
56 | + */ | |
57 | + private BigDecimal customerTotalPrice; | |
58 | + | |
59 | + /** | |
60 | + * 生成科总价¥ | |
61 | + */ | |
62 | + private BigDecimal productionDepartmentTotalPrice; | |
63 | + | |
64 | + /** | |
65 | + * 包装费用合计¥ | |
66 | + */ | |
67 | + private BigDecimal packetTotalPrice; | |
68 | + | |
69 | + /** | |
70 | + * 研发开发费合计 | |
71 | + */ | |
72 | + private BigDecimal developTotalPrice; | |
73 | + | |
74 | + /** | |
75 | + * 复制费合计 | |
76 | + */ | |
77 | + private BigDecimal copyTotalPrice; | |
78 | + | |
79 | + /** | |
80 | + * 固定成本 | |
81 | + * 开发持续时间*日固定成本(日固定成本需要从系统配置读取) | |
82 | + */ | |
83 | + private BigDecimal fixCost; | |
84 | + | |
85 | + /** | |
86 | + * 西班牙提成比例 | |
87 | + */ | |
88 | + private BigDecimal spainRatioProfitPrice; | |
89 | + | |
90 | + /** | |
91 | + * 中国团队提成比例 | |
92 | + */ | |
93 | + private BigDecimal chinaRatioProfitPrice; | |
94 | + | |
95 | + /** | |
96 | + * 支出合计计算:客户总金额+生产科总价+包装费用+研发开发费+复制费用+固定成本+西班牙提成+中国团队提成 | |
97 | + */ | |
98 | + private BigDecimal outTotalPrice; | |
99 | + | |
100 | + /** | |
101 | + * 毛利润 | |
102 | + * 订单收入-Loca费用-跟单费用(正数黑色字体、负数红色字体并加上-号) | |
103 | + */ | |
104 | + private BigDecimal grossProfit; | |
105 | + | |
106 | + /** | |
107 | + * 研发贸易利润 | |
108 | + * 客户金额合计-支出合计(正数黑色字体、负数红色字体并加上-号) | |
109 | + */ | |
110 | + private BigDecimal developProfit; | |
111 | + | |
112 | + /** | |
113 | + * 包装费用实际金额由财务手动输入 | |
114 | + */ | |
115 | + private BigDecimal packetActualTotalPrice; | |
116 | + | |
117 | + /** | |
118 | + * 订单总数量 | |
119 | + * 订单总数量计算项目号的数量合计 | |
120 | + */ | |
121 | + private Integer orderCount; | |
122 | + | |
123 | + /** | |
124 | + * 实际跟单单价=实际跟单费用/件数(人民币格式) | |
125 | + */ | |
126 | + private BigDecimal actualRmbPrice; | |
127 | + | |
128 | + /** | |
129 | + * 实际跟单单价折算美金:人民币单价/汇率(6.2) | |
130 | + */ | |
131 | + private BigDecimal actualPrice; | |
132 | + | |
133 | + /** | |
134 | + * 包装费用收益计算:包装费用合计金额-包装费用实际金额 | |
135 | + */ | |
136 | + private BigDecimal packetProfitPrice; | |
137 | + | |
138 | + /** | |
139 | + * 实际汇率(财务手动输入) | |
140 | + */ | |
141 | + private BigDecimal actualRatio; | |
142 | + | |
143 | + /** | |
144 | + * 汇率收益计算:实际汇率(财务手动输入)-固定汇率(取系统汇率)*客户金额合计(基础信息汇总) | |
145 | + */ | |
146 | + private BigDecimal actualRatioProfitPrice; | |
147 | + | |
148 | + /** | |
149 | + * 综合收益计算 | |
150 | + * 易研发净利润+包装费用收益+汇率收益 | |
151 | + */ | |
152 | + private BigDecimal totalProfitPrice; | |
153 | + /** | |
154 | + * 包装费用合计金额 | |
155 | + * 包装费用 * 汇率 (6.2) | |
156 | + */ | |
157 | + private BigDecimal packetTotalPriceCount; | |
158 | + /** | |
159 | + * 实际跟单费用 | |
160 | + */ | |
161 | + private BigDecimal actualdocumentaryPrice; | |
162 | +} | |
163 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/CheckBillAnalysisExportVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 应付款账单表(InvoiceBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class CheckBillAnalysisExportVO implements Serializable { | |
22 | + | |
23 | + private Long id; | |
24 | + | |
25 | + /** | |
26 | + * checkNo | |
27 | + */ | |
28 | + private String checkNo; | |
29 | + | |
30 | + | |
31 | + /** | |
32 | + * 生产科 | |
33 | + */ | |
34 | + private String productionDepartment; | |
35 | + | |
36 | + /** | |
37 | + * 生产科总价汇总 | |
38 | + */ | |
39 | + private BigDecimal productionDepartmentTotalPrice; | |
40 | + | |
41 | + /** | |
42 | + * 生产科扣款金额汇总 | |
43 | + */ | |
44 | + private BigDecimal deductAmount; | |
45 | + | |
46 | + | |
47 | + /** | |
48 | + * 实际付款金额汇总 | |
49 | + */ | |
50 | + private BigDecimal actualPayedAmount; | |
51 | + | |
52 | + /** | |
53 | + * 应付金额 - 扣款金额 | |
54 | + * 生产科实际应付金额 | |
55 | + */ | |
56 | + private BigDecimal calculateActualPayedAmount; | |
57 | + | |
58 | + /** | |
59 | + * 实际应付金额 - 实际付款金额 | |
60 | + * 未付金额金额 | |
61 | + */ | |
62 | + private BigDecimal unPayedAmount; | |
63 | + | |
64 | + /** | |
65 | + * 生产科应付款日期 | |
66 | + */ | |
67 | + private String payedDate; | |
68 | + | |
69 | + /** | |
70 | + * 生产科实际付款日期 | |
71 | + */ | |
72 | + private String actualPayedDate; | |
73 | + | |
74 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/CheckBillAnalysisResultVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | +import java.util.List; | |
9 | + | |
10 | +/** | |
11 | + * 应付款账单表(InvoiceBillOrder)实体类 | |
12 | + * | |
13 | + * @author makejava | |
14 | + * @since 2024-08-05 16:26:33 | |
15 | + */ | |
16 | +@Data | |
17 | +@AllArgsConstructor | |
18 | +@ToString | |
19 | +@NoArgsConstructor | |
20 | +@EqualsAndHashCode(callSuper = false) | |
21 | +@SuperBuilder | |
22 | +public class CheckBillAnalysisResultVO implements Serializable { | |
23 | + | |
24 | + | |
25 | + /** | |
26 | + * 导出列表 | |
27 | + */ | |
28 | + private List<CheckBillAnalysisExportVO> exportVOS; | |
29 | + | |
30 | + /** | |
31 | + * 合计数据 | |
32 | + */ | |
33 | + | |
34 | + /** | |
35 | + * 生产科总价汇总 | |
36 | + */ | |
37 | + private BigDecimal productionDepartmentTotalPrice; | |
38 | + | |
39 | + /** | |
40 | + * 生产科扣款金额汇总 | |
41 | + */ | |
42 | + private BigDecimal deductAmount; | |
43 | + | |
44 | + | |
45 | + /** | |
46 | + * 实际付款金额汇总 | |
47 | + */ | |
48 | + private BigDecimal actualPayedAmount; | |
49 | + | |
50 | + /** | |
51 | + * 应付金额 - 扣款金额 | |
52 | + * 生产科实际应付金额 | |
53 | + */ | |
54 | + private BigDecimal calculateActualPayedAmount; | |
55 | + | |
56 | + /** | |
57 | + * 实际应付金额 - 实际付款金额 | |
58 | + * 未付金额金额 | |
59 | + */ | |
60 | + private BigDecimal unPayedAmount; | |
61 | + | |
62 | + /** | |
63 | + * 合计数据 | |
64 | + */ | |
65 | + | |
66 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/CheckBillMappingQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.vo.BasePageVO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | +import java.util.List; | |
9 | + | |
10 | +/** | |
11 | + * 生产科对账单应收账单映射表(CheckBillMapping)实体类 | |
12 | + * | |
13 | + * @author makejava | |
14 | + * @since 2024-08-05 16:26:37 | |
15 | + */ | |
16 | +@Data | |
17 | +@AllArgsConstructor | |
18 | +@ToString | |
19 | +@NoArgsConstructor | |
20 | +@EqualsAndHashCode(callSuper = false) | |
21 | +@SuperBuilder | |
22 | +public class CheckBillMappingQueryVO extends BasePageVO implements Serializable { | |
23 | + | |
24 | + private List<Long> ids; | |
25 | + | |
26 | + | |
27 | + private Long id; | |
28 | + /** | |
29 | + * 生产科对账单号 | |
30 | + */ | |
31 | + private String checkNo; | |
32 | + /** | |
33 | + * check账单id | |
34 | + */ | |
35 | + private Long checkBillId; | |
36 | + /** | |
37 | + * 订单id | |
38 | + */ | |
39 | + private Long orderId; | |
40 | + | |
41 | + | |
42 | +} | |
43 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/CheckBillMappingVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | + | |
8 | +/** | |
9 | + * 生产科对账单应收账单映射表(CheckBillMapping)实体类 | |
10 | + * | |
11 | + * @author makejava | |
12 | + * @since 2024-08-05 16:26:37 | |
13 | + */ | |
14 | +@Data | |
15 | +@AllArgsConstructor | |
16 | +@ToString | |
17 | +@NoArgsConstructor | |
18 | +@EqualsAndHashCode(callSuper = false) | |
19 | +@SuperBuilder | |
20 | +public class CheckBillMappingVO implements Serializable { | |
21 | + | |
22 | + private Long id; | |
23 | + /** | |
24 | + * 生产科对账单号 | |
25 | + */ | |
26 | + private String checkNo; | |
27 | + /** | |
28 | + * check账单id | |
29 | + */ | |
30 | + private Long checkBillId; | |
31 | + /** | |
32 | + * 订单id | |
33 | + */ | |
34 | + private Long orderId; | |
35 | + | |
36 | + | |
37 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/CheckBillOrdeBaseResultVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +@Data | |
7 | +@AllArgsConstructor | |
8 | +@ToString | |
9 | +@NoArgsConstructor | |
10 | +@EqualsAndHashCode(callSuper = false) | |
11 | +@SuperBuilder | |
12 | +public class CheckBillOrdeBaseResultVO { | |
13 | + /** | |
14 | + * 客户编码 | |
15 | + */ | |
16 | + private String customerCode; | |
17 | + /** | |
18 | + * 项目号 | |
19 | + */ | |
20 | + private String projectNo; | |
21 | + /** | |
22 | + * 内部编号 | |
23 | + */ | |
24 | + private String innerNo; | |
25 | + /** | |
26 | + * 客户po号 | |
27 | + */ | |
28 | + private String customerPo; | |
29 | + /** | |
30 | + * 客户STYLE# | |
31 | + */ | |
32 | + private String customerStyle; | |
33 | + /** | |
34 | + * Modelo(REFERENCE) | |
35 | + */ | |
36 | + private String modeleLo; | |
37 | + /** | |
38 | + * 缩略图片地址 这里不确认前端拿到的数据是缩略图url还是图片url,先采用缩略图url。 | |
39 | + */ | |
40 | + private String smallPicUrl; | |
41 | + /** | |
42 | + * 数量 | |
43 | + */ | |
44 | + private Integer orderCount; | |
45 | + /** | |
46 | + * 生产科单价 | |
47 | + */ | |
48 | + private Double productionDepartmentPrice; | |
49 | + /** | |
50 | + * 生产科总价 | |
51 | + */ | |
52 | + private Double productionDepartmentTotalPrice; | |
53 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/CheckHoldTimeItemVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.dto.order.OrderBaseInfoDO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | + | |
9 | +/** | |
10 | + * 应付账单 -- holdTime | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class CheckHoldTimeItemVO implements Serializable { | |
22 | + | |
23 | + /** | |
24 | + * 生产科 | |
25 | + */ | |
26 | + private String productionDepartment; | |
27 | + | |
28 | + /** | |
29 | + * 订单hold时间 | |
30 | + */ | |
31 | + private String holdTime; | |
32 | + | |
33 | + /** | |
34 | + * 基础订单信息 | |
35 | + */ | |
36 | + private OrderBaseInfoDO baseInfoDO; | |
37 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/CheckOrderBaseItemVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 应付款账单表(InvoiceBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class CheckOrderBaseItemVO implements Serializable { | |
22 | + | |
23 | + private Long orderId; | |
24 | + | |
25 | + /** | |
26 | + * checkNo编码 | |
27 | + */ | |
28 | + private String checkNo; | |
29 | + | |
30 | + /** | |
31 | + * 生产科 | |
32 | + */ | |
33 | + private String productionDepartment; | |
34 | + | |
35 | + /** | |
36 | + * 生成科总价 | |
37 | + */ | |
38 | + private BigDecimal productionDepartmentTotalPrice; | |
39 | + | |
40 | + | |
41 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/FinanceEventJobVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.dto.order.InvoiceBillOrderDO; | |
4 | +import com.order.erp.domain.dto.order.ProducePaymentCheckBillOrderDO; | |
5 | +import lombok.*; | |
6 | +import lombok.experimental.SuperBuilder; | |
7 | + | |
8 | +@Data | |
9 | +@AllArgsConstructor | |
10 | +@ToString | |
11 | +@NoArgsConstructor | |
12 | +@EqualsAndHashCode(callSuper = false) | |
13 | +@SuperBuilder | |
14 | +public class FinanceEventJobVO { | |
15 | + | |
16 | + //应收款。 | |
17 | + private InvoiceBillOrderDO invoiceBillOrderDO; | |
18 | + //未收款。 | |
19 | + private ProducePaymentCheckBillOrderDO producePaymentCheckBillOrderDO; | |
20 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InnerProfitRatioQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.vo.BasePageVO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import javax.validation.constraints.NotEmpty; | |
8 | +import javax.validation.constraints.NotNull; | |
9 | +import java.io.Serializable; | |
10 | +import java.math.BigDecimal; | |
11 | +import java.util.List; | |
12 | + | |
13 | +/** | |
14 | + * 内部生产净利润分析表 | |
15 | + * | |
16 | + * @author makejava | |
17 | + * @since 2024-08-05 16:26:34 | |
18 | + */ | |
19 | +@Data | |
20 | +@AllArgsConstructor | |
21 | +@ToString | |
22 | +@NoArgsConstructor | |
23 | +@EqualsAndHashCode(callSuper = false) | |
24 | +@SuperBuilder | |
25 | +public class InnerProfitRatioQueryVO extends BasePageVO implements Serializable { | |
26 | + | |
27 | + /** | |
28 | + * ids | |
29 | + */ | |
30 | + @NotEmpty(message = "选择订单不能为空") | |
31 | + private List<Long> ids; | |
32 | + /** | |
33 | + * 客户编码 | |
34 | + */ | |
35 | + @NotEmpty(message = "客户编码不能为空") | |
36 | + private String customerCode; | |
37 | + | |
38 | + /** | |
39 | + * 项目号 | |
40 | + */ | |
41 | + @NotEmpty(message = "项目号不能为空") | |
42 | + private List<String> projectNo; | |
43 | + | |
44 | + /** | |
45 | + * 项目开发开始时间 | |
46 | + */ | |
47 | + @NotEmpty(message = "项目开发开始时间不能为空") | |
48 | + private String projectStartTime; | |
49 | + | |
50 | + /** | |
51 | + * 项目开发结束时间 | |
52 | + */ | |
53 | + @NotEmpty(message = "项目开发结束时间不能为空") | |
54 | + private String projectEndTime; | |
55 | + | |
56 | + /** | |
57 | + * 生产科预算金额由财务手动输入 | |
58 | + */ | |
59 | + @NotNull(message = "生产科预算金额不能为空") | |
60 | + private BigDecimal productionDepartmentPredictPrice; | |
61 | + | |
62 | + | |
63 | + /** | |
64 | + * 实际发生费用 手动输入 | |
65 | + */ | |
66 | + @NotNull(message = "实际发生费用不能为空") | |
67 | + private BigDecimal productionActualPrice; | |
68 | +} | |
69 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InnerProfitRatioResultVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 业务/研发净利润分析 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:34 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class InnerProfitRatioResultVO implements Serializable { | |
22 | + | |
23 | + | |
24 | + /** | |
25 | + * 客户编码 | |
26 | + */ | |
27 | + private String customerCode; | |
28 | + | |
29 | + /** | |
30 | + * 项目号 | |
31 | + */ | |
32 | + private String projectNo; | |
33 | + | |
34 | + /** | |
35 | + * 项目开发开始时间 | |
36 | + */ | |
37 | + private String projectStartTime; | |
38 | + | |
39 | + /** | |
40 | + * 项目开发结束时间 | |
41 | + */ | |
42 | + private String projectEndTime; | |
43 | + | |
44 | + /** | |
45 | + * 生产持续时间 | |
46 | + */ | |
47 | + private Integer projectDays; | |
48 | + | |
49 | + /** | |
50 | + * 订单数量 | |
51 | + */ | |
52 | + private Integer orderCount; | |
53 | + | |
54 | + /** | |
55 | + * 客户总价$ | |
56 | + */ | |
57 | + private Double customerTotalPrice; | |
58 | + | |
59 | + | |
60 | + /** | |
61 | + * 生产科预算金额由财务手动输入 | |
62 | + */ | |
63 | + private BigDecimal productionDepartmentPredictPrice; | |
64 | + | |
65 | + | |
66 | + /** | |
67 | + * 实际发生费用 手动输入 | |
68 | + */ | |
69 | + private BigDecimal productionActualPrice; | |
70 | + | |
71 | + /** | |
72 | + * 生产科总价合计 | |
73 | + */ | |
74 | + private BigDecimal productionDepartmentTotalPrice; | |
75 | + | |
76 | + | |
77 | + /** | |
78 | + * 预算占比 | |
79 | + * 预算占比计算(实际发生费用/预算金额 | |
80 | + */ | |
81 | + private BigDecimal predictRatio; | |
82 | + | |
83 | + /** | |
84 | + * 预算占比与实际占比差 | |
85 | + * 预算占比与实际占比差计算(1-预算占比) | |
86 | + */ | |
87 | + private BigDecimal predictAndActualRatio; | |
88 | + | |
89 | + | |
90 | + /** | |
91 | + * 内部生产毛利润计算:生产科总价-实际发生费用就是得出 | |
92 | + */ | |
93 | + private BigDecimal grossProfit; | |
94 | + | |
95 | + /** | |
96 | + * 内部生产固定成本 | |
97 | + * 内部生产固定成本计算:生产持续时间*每天的固定成本(固定成本从系统配置中进行获取) | |
98 | + */ | |
99 | + private BigDecimal innerProduceFixProfit; | |
100 | + | |
101 | + /** | |
102 | + * 内部生产提成计算:订单数量*单价(单价从系统配置中进行获取) | |
103 | + */ | |
104 | + private BigDecimal innerProduceTotalPrice; | |
105 | + | |
106 | + /** | |
107 | + * 内部生产净利润计算:生产科总价-实际发生费用-内部生产提成 | |
108 | + */ | |
109 | + private BigDecimal innerProduceTotalProfit; | |
110 | + | |
111 | +} | |
112 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBaseOrderQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.vo.BasePageVO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import javax.validation.constraints.NotBlank; | |
8 | +import java.io.Serializable; | |
9 | + | |
10 | +/** | |
11 | + * 应收款账单表(InvoiceBillOrder)实体类 | |
12 | + * | |
13 | + * @author makejava | |
14 | + * @since 2024-08-05 16:26:34 | |
15 | + */ | |
16 | +@Data | |
17 | +@AllArgsConstructor | |
18 | +@ToString | |
19 | +@NoArgsConstructor | |
20 | +@EqualsAndHashCode(callSuper = false) | |
21 | +@SuperBuilder | |
22 | +public class InvoiceBaseOrderQueryVO extends BasePageVO implements Serializable { | |
23 | + | |
24 | + /** | |
25 | + * 发票单号 | |
26 | + */ | |
27 | + @NotBlank(message = "发票单号不能为空") | |
28 | + private String invoiceNo; | |
29 | +} | |
30 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillAmountInfoVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 应收款账单 -- 其他金额信息 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class InvoiceBillAmountInfoVO implements Serializable { | |
22 | + | |
23 | + private Long id; | |
24 | + | |
25 | + /** | |
26 | + * 报关单url地址 | |
27 | + */ | |
28 | + private String bgUrl; | |
29 | + | |
30 | + /** | |
31 | + * 实际应收金额 | |
32 | + */ | |
33 | + private BigDecimal actualReceivableAmount; | |
34 | + /** | |
35 | + * 实际应付金额1 | |
36 | + */ | |
37 | + private BigDecimal actualPayedAmount1; | |
38 | + /** | |
39 | + * 实际应付金额2 | |
40 | + */ | |
41 | + private BigDecimal actualPayedAmount2; | |
42 | + /** | |
43 | + * 实际应付金额3 | |
44 | + */ | |
45 | + private BigDecimal actualPayedAmount3; | |
46 | + /** | |
47 | + * 其他费用金额 | |
48 | + */ | |
49 | + private BigDecimal otherAmount; | |
50 | + | |
51 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillAnalysisExportVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 应收款账单表(InvoiceBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class InvoiceBillAnalysisExportVO implements Serializable { | |
22 | + | |
23 | + private Long id; | |
24 | + | |
25 | + /** | |
26 | + * 客户编码 | |
27 | + */ | |
28 | + private String customerCode; | |
29 | + | |
30 | + /** | |
31 | + * 发票单号 | |
32 | + */ | |
33 | + private String invoiceNo; | |
34 | + | |
35 | + /** | |
36 | + * 客户总价$ | |
37 | + */ | |
38 | + private BigDecimal customerTotalPrice; | |
39 | + | |
40 | + /** | |
41 | + * 发生扣款金额 | |
42 | + */ | |
43 | + private BigDecimal deductAmount; | |
44 | + | |
45 | + /** | |
46 | + * 实际应收金额 | |
47 | + */ | |
48 | + private BigDecimal actualReceivableAmount; | |
49 | + | |
50 | + /** | |
51 | + * 实际应付金额 | |
52 | + */ | |
53 | + private BigDecimal actualPayedAmount; | |
54 | + | |
55 | + /** | |
56 | + * 实际应收 - 实际应付 | |
57 | + * 其他费用金额汇总 | |
58 | + */ | |
59 | + private BigDecimal otherAmount; | |
60 | + | |
61 | + /** | |
62 | + * 未付金额 | |
63 | + */ | |
64 | + private BigDecimal otherTotalAmount; | |
65 | + | |
66 | + /** | |
67 | + * 必须回款日期 | |
68 | + */ | |
69 | + private String backRefundDate; | |
70 | + | |
71 | + /** | |
72 | + * 实际回款日期 | |
73 | + */ | |
74 | + private String actualRefundDate; | |
75 | +// | |
76 | +// /** | |
77 | +// * 其他金额汇总 | |
78 | +// */ | |
79 | +// private BigDecimal unPayedAmount; | |
80 | + | |
81 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillAnalysisResultVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | +import java.util.List; | |
9 | + | |
10 | +/** | |
11 | + * 应收款账单表(InvoiceBillOrder)实体类 | |
12 | + * | |
13 | + * @author makejava | |
14 | + * @since 2024-08-05 16:26:33 | |
15 | + */ | |
16 | +@Data | |
17 | +@AllArgsConstructor | |
18 | +@ToString | |
19 | +@NoArgsConstructor | |
20 | +@EqualsAndHashCode(callSuper = false) | |
21 | +@SuperBuilder | |
22 | +public class InvoiceBillAnalysisResultVO implements Serializable { | |
23 | + | |
24 | + | |
25 | + /** | |
26 | + * 导出列表 | |
27 | + */ | |
28 | + private List<InvoiceBillAnalysisExportVO> exportVOS; | |
29 | + | |
30 | + /** | |
31 | + * 合计数据 | |
32 | + */ | |
33 | + | |
34 | + /** | |
35 | + * 客户总价$ | |
36 | + */ | |
37 | + private BigDecimal customerTotalPrice; | |
38 | + | |
39 | + /** | |
40 | + * 发生扣款金额 | |
41 | + */ | |
42 | + private BigDecimal deductAmount; | |
43 | + | |
44 | + /** | |
45 | + * 实际应收金额总计 实际应收1+2+3 | |
46 | + */ | |
47 | + private BigDecimal actualReceivableAmount; | |
48 | + | |
49 | + /** | |
50 | + * 未收金额合计 实际应收-发生扣款金额总计 | |
51 | + */ | |
52 | + private BigDecimal actualPayedAmount; | |
53 | + | |
54 | + /** | |
55 | + * 客户总金额-发生扣款金额总计 | |
56 | + * 实际应收 | |
57 | + */ | |
58 | + private BigDecimal otherAmount; | |
59 | + | |
60 | + /** | |
61 | + * 未付金额合计 | |
62 | + */ | |
63 | + private BigDecimal otherTotalAmount; | |
64 | + | |
65 | + /** | |
66 | + * 合计数据 | |
67 | + */ | |
68 | + | |
69 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillAnalysisVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Data; | |
5 | +import lombok.EqualsAndHashCode; | |
6 | +import lombok.ToString; | |
7 | +import lombok.experimental.SuperBuilder; | |
8 | + | |
9 | +import java.io.Serializable; | |
10 | + | |
11 | +/** | |
12 | + * 应收款账单 -- 分析 | |
13 | + * | |
14 | + * @author makejava | |
15 | + * @since 2024-08-05 16:26:33 | |
16 | + */ | |
17 | +@Data | |
18 | +@AllArgsConstructor | |
19 | +@ToString | |
20 | +@EqualsAndHashCode(callSuper = false) | |
21 | +@SuperBuilder | |
22 | +public class InvoiceBillAnalysisVO extends InvoiceBillOrderQueryVO implements Serializable { | |
23 | + | |
24 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillCommitApplyVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | + | |
8 | +/** | |
9 | + * 应收款账单 -- 提交审核 | |
10 | + * | |
11 | + * @author makejava | |
12 | + * @since 2024-08-05 16:26:33 | |
13 | + */ | |
14 | +@Data | |
15 | +@AllArgsConstructor | |
16 | +@ToString | |
17 | +@NoArgsConstructor | |
18 | +@EqualsAndHashCode(callSuper = false) | |
19 | +@SuperBuilder | |
20 | +public class InvoiceBillCommitApplyVO implements Serializable { | |
21 | + | |
22 | + private Long id; | |
23 | + private String actualRefundDate; | |
24 | + private String payee; | |
25 | + | |
26 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillCreateVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.util.List; | |
8 | + | |
9 | +/** | |
10 | + * 应收款账单表(InvoiceBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class InvoiceBillCreateVO implements Serializable { | |
22 | + private static final long serialVersionUID = 543899167451834300L; | |
23 | + | |
24 | + private Long id; | |
25 | + | |
26 | + /** | |
27 | + * 发票单号 | |
28 | + */ | |
29 | + private String invoiceNo; | |
30 | + | |
31 | + /** | |
32 | + * 报关单url地址 | |
33 | + */ | |
34 | + private String bgUrl; | |
35 | + | |
36 | + /** | |
37 | + * 必须回款日期 | |
38 | + */ | |
39 | + private String backRefundDate; | |
40 | + | |
41 | + /** | |
42 | + * 订单id集合 | |
43 | + */ | |
44 | + private List<Long> orderIds; | |
45 | + | |
46 | + | |
47 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillDeductInfoVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 应收款账单 -- 扣款信息 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class InvoiceBillDeductInfoVO implements Serializable { | |
22 | + | |
23 | + private Long id; | |
24 | + | |
25 | + /** | |
26 | + * 发票单号 | |
27 | + */ | |
28 | + private String invoiceNo; | |
29 | + | |
30 | + /** | |
31 | + * 发生扣款金额 | |
32 | + */ | |
33 | + private BigDecimal deductAmount; | |
34 | + | |
35 | + /** | |
36 | + * 扣款单url地址 | |
37 | + */ | |
38 | + private String deductUrl; | |
39 | + | |
40 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillMappingQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.vo.BasePageVO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | +import java.util.List; | |
9 | + | |
10 | +/** | |
11 | + * 应收款账单关联订单映射表(InvoiceBillMapping)实体类 | |
12 | + * | |
13 | + * @author makejava | |
14 | + * @since 2024-08-05 16:26:36 | |
15 | + */ | |
16 | +@Data | |
17 | +@AllArgsConstructor | |
18 | +@ToString | |
19 | +@NoArgsConstructor | |
20 | +@EqualsAndHashCode(callSuper = false) | |
21 | +@SuperBuilder | |
22 | +public class InvoiceBillMappingQueryVO extends BasePageVO implements Serializable { | |
23 | + private static final long serialVersionUID = -10772282327497511L; | |
24 | + | |
25 | + private List<Long> ids; | |
26 | + | |
27 | + | |
28 | + private Long id; | |
29 | + /** | |
30 | + * 发票单号 | |
31 | + */ | |
32 | + private String invoiceNo; | |
33 | + /** | |
34 | + * invoice账单id | |
35 | + */ | |
36 | + private Long invoiceBillId; | |
37 | + /** | |
38 | + * 订单id | |
39 | + */ | |
40 | + private Long orderId; | |
41 | + | |
42 | + | |
43 | +} | |
44 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillMappingVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | + | |
8 | +/** | |
9 | + * 应收款账单关联订单映射表(InvoiceBillMapping)实体类 | |
10 | + * | |
11 | + * @author makejava | |
12 | + * @since 2024-08-05 16:26:36 | |
13 | + */ | |
14 | +@Data | |
15 | +@AllArgsConstructor | |
16 | +@ToString | |
17 | +@NoArgsConstructor | |
18 | +@EqualsAndHashCode(callSuper = false) | |
19 | +@SuperBuilder | |
20 | +public class InvoiceBillMappingVO implements Serializable { | |
21 | + private static final long serialVersionUID = -55765026730369748L; | |
22 | + | |
23 | + private Long id; | |
24 | + /** | |
25 | + * 发票单号 | |
26 | + */ | |
27 | + private String invoiceNo; | |
28 | + /** | |
29 | + * invoice账单id | |
30 | + */ | |
31 | + private Long invoiceBillId; | |
32 | + /** | |
33 | + * 订单id | |
34 | + */ | |
35 | + private Long orderId; | |
36 | + | |
37 | + | |
38 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillOrdeBaserResultVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +@Data | |
7 | +@AllArgsConstructor | |
8 | +@ToString | |
9 | +@NoArgsConstructor | |
10 | +@EqualsAndHashCode(callSuper = false) | |
11 | +@SuperBuilder | |
12 | +public class InvoiceBillOrdeBaserResultVO { | |
13 | + | |
14 | + /** | |
15 | + * 客户编码 | |
16 | + */ | |
17 | + private String customerCode; | |
18 | + /** | |
19 | + * 项目号 | |
20 | + */ | |
21 | + private String projectNo; | |
22 | + /** | |
23 | + * 内部编号 | |
24 | + */ | |
25 | + private String innerNo; | |
26 | + /** | |
27 | + * 客户po号 | |
28 | + */ | |
29 | + private String customerPo; | |
30 | + /** | |
31 | + * 客户STYLE# | |
32 | + */ | |
33 | + private String customerStyle; | |
34 | + /** | |
35 | + * Modelo(REFERENCE) | |
36 | + */ | |
37 | + private String modeleLo; | |
38 | + /** | |
39 | + * 缩略图片地址 这里不确认前端拿到的数据是缩略图url还是图片url,先采用缩略图url。 | |
40 | + */ | |
41 | + private String smallPicUrl; | |
42 | + /** | |
43 | + * 数量 | |
44 | + */ | |
45 | + private Integer orderCount; | |
46 | + /** | |
47 | + * 客户单价 $ | |
48 | + */ | |
49 | + private Double customerPrice; | |
50 | + /** | |
51 | + * 客户总价 $ | |
52 | + */ | |
53 | + private Double customerTotalPrice; | |
54 | + | |
55 | + | |
56 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillOrderQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.vo.BasePageVO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | +import java.util.List; | |
9 | + | |
10 | +/** | |
11 | + * 应收款账单表(InvoiceBillOrder)实体类 | |
12 | + * | |
13 | + * @author makejava | |
14 | + * @since 2024-08-05 16:26:34 | |
15 | + */ | |
16 | +@Data | |
17 | +@AllArgsConstructor | |
18 | +@ToString | |
19 | +@NoArgsConstructor | |
20 | +@EqualsAndHashCode(callSuper = false) | |
21 | +@SuperBuilder | |
22 | +public class InvoiceBillOrderQueryVO extends BasePageVO implements Serializable { | |
23 | + | |
24 | + private List<Long> ids; | |
25 | + private Long id; | |
26 | + | |
27 | + /** | |
28 | + * 发票单号 | |
29 | + */ | |
30 | + private String invoiceNo; | |
31 | + | |
32 | + /** | |
33 | + * 总经理审核状态 -1,未提交审核,0:待审核、1:审核通过,2:审核驳回 | |
34 | + */ | |
35 | + private Integer status; | |
36 | + | |
37 | + /** | |
38 | + * 客户编码 | |
39 | + */ | |
40 | + private String customerCode; | |
41 | + | |
42 | + /** | |
43 | + * 项目号 | |
44 | + */ | |
45 | + private String projectNo; | |
46 | + | |
47 | + /** | |
48 | + * 生产科 | |
49 | + */ | |
50 | + private String productionDepartment; | |
51 | + | |
52 | + /** | |
53 | + * 内部编号 | |
54 | + */ | |
55 | + private String innerNo; | |
56 | + | |
57 | + /** | |
58 | + * 客户po号 | |
59 | + */ | |
60 | + private String customerPo; | |
61 | + | |
62 | + /** | |
63 | + * 开始时间 | |
64 | + */ | |
65 | + private String startTime; | |
66 | + | |
67 | + /** | |
68 | + * 结束时间 | |
69 | + */ | |
70 | + private String endTime; | |
71 | +} | |
72 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillOrderVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 应收款账单表(InvoiceBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class InvoiceBillOrderVO implements Serializable { | |
22 | + private static final long serialVersionUID = 543899167451834300L; | |
23 | + | |
24 | + private Long id; | |
25 | + | |
26 | + /** | |
27 | + * 发票单号 | |
28 | + */ | |
29 | + private String invoiceNo; | |
30 | + | |
31 | + /** | |
32 | + * 报关单url地址 | |
33 | + */ | |
34 | + private String bgUrl; | |
35 | + | |
36 | + /** | |
37 | + * 必须回款日期 | |
38 | + */ | |
39 | + private String backRefundDate; | |
40 | + | |
41 | + /** | |
42 | + * 发生扣款金额 | |
43 | + */ | |
44 | + private BigDecimal deductAmount; | |
45 | + | |
46 | + /** | |
47 | + * 扣款单url地址 | |
48 | + */ | |
49 | + private String deductUrl; | |
50 | + | |
51 | + /** | |
52 | + * 实际应收金额 | |
53 | + */ | |
54 | + private BigDecimal actualReceivableAmount; | |
55 | + | |
56 | + /** | |
57 | + * 实际应付金额1 | |
58 | + */ | |
59 | + private BigDecimal actualPayedAmount1; | |
60 | + | |
61 | + /** | |
62 | + * 实际应付金额2 | |
63 | + */ | |
64 | + private BigDecimal actualPayedAmount2; | |
65 | + | |
66 | + /** | |
67 | + * 实际应付金额3 | |
68 | + */ | |
69 | + private BigDecimal actualPayedAmount3; | |
70 | + | |
71 | + /** | |
72 | + * 其他费用金额 | |
73 | + */ | |
74 | + private BigDecimal otherAmount; | |
75 | + | |
76 | + /** | |
77 | + * 总经理审核状态 0:待审核、1:审核通过,2:审核驳回 | |
78 | + */ | |
79 | + private Integer status; | |
80 | + | |
81 | + | |
82 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceHoldTimeItemVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.dto.order.OrderBaseInfoDO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | + | |
9 | +/** | |
10 | + * 应收款账单 -- holdTime | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class InvoiceHoldTimeItemVO implements Serializable { | |
22 | + | |
23 | + /** | |
24 | + * 客户编码 | |
25 | + */ | |
26 | + private String customerCode; | |
27 | + | |
28 | + /** | |
29 | + * 订单hold时间 | |
30 | + */ | |
31 | + private String holdTime; | |
32 | + | |
33 | + /** | |
34 | + * 基础订单信息 | |
35 | + */ | |
36 | + private OrderBaseInfoDO baseInfoDO; | |
37 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/InvoiceOrderBaseItemVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 应收款账单表(InvoiceBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:33 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class InvoiceOrderBaseItemVO implements Serializable { | |
22 | + | |
23 | + private Long orderId; | |
24 | + | |
25 | + /** | |
26 | + * invoice编码 | |
27 | + */ | |
28 | + private String invoiceCode; | |
29 | + | |
30 | + /** | |
31 | + * 客户编码 | |
32 | + */ | |
33 | + private String customerCode; | |
34 | + | |
35 | + /** | |
36 | + * 客户总价$ | |
37 | + */ | |
38 | + private BigDecimal customerTotalPrice; | |
39 | + | |
40 | + | |
41 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/OrderApplyResultVO.java
src/main/java/com/order/erp/domain/vo/order/OrderLockFieldVO.java
1 | 1 | package com.order.erp.domain.vo.order; |
2 | 2 | |
3 | +import com.order.erp.domain.dto.order.InvoiceBillOrderDO; | |
4 | +import com.order.erp.domain.dto.order.ProducePaymentCheckBillOrderDO; | |
3 | 5 | import lombok.*; |
4 | 6 | import lombok.experimental.SuperBuilder; |
5 | 7 | |
... | ... | @@ -44,6 +46,16 @@ public class OrderLockFieldVO implements Serializable { |
44 | 46 | private OrderInspectionStageFieldVO inspectionStageFields; |
45 | 47 | |
46 | 48 | /** |
49 | + * 应收款账单字段 | |
50 | + */ | |
51 | + private InvoiceBillOrderDO invoiceBillOrderDO; | |
52 | + | |
53 | + /** | |
54 | + * 应付款账单字段 | |
55 | + */ | |
56 | + private ProducePaymentCheckBillOrderDO checkBillOrderDO; | |
57 | + | |
58 | + /** | |
47 | 59 | * 导出指定订单id集合 |
48 | 60 | */ |
49 | 61 | private List<Long> orderIds; | ... | ... |
src/main/java/com/order/erp/domain/vo/order/OrderUnlockFieldApplyVO.java
src/main/java/com/order/erp/domain/vo/order/ProducePaymentBaseOrderQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.vo.BasePageVO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | + | |
9 | +/** | |
10 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:35 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class ProducePaymentBaseOrderQueryVO extends BasePageVO implements Serializable { | |
22 | + | |
23 | + /** | |
24 | + * 生产科对账单 | |
25 | + */ | |
26 | + private String checkNo; | |
27 | + | |
28 | +} | |
29 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/ProducePaymentBillOrderAnalysisVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.vo.BasePageVO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | + | |
9 | +/** | |
10 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:35 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class ProducePaymentBillOrderAnalysisVO extends BasePageVO implements Serializable { | |
22 | + | |
23 | + /** | |
24 | + * 生产科对账单 | |
25 | + */ | |
26 | + private String checkNo; | |
27 | + | |
28 | +} | |
29 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/ProducePaymentCheckBillAmountInfoVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:35 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class ProducePaymentCheckBillAmountInfoVO implements Serializable { | |
22 | + | |
23 | + private Long id; | |
24 | + | |
25 | + /** | |
26 | + * 实际应收金额 | |
27 | + */ | |
28 | + private BigDecimal actualPayedAmount; | |
29 | + /** | |
30 | + * 实际应付金额1 | |
31 | + */ | |
32 | + private BigDecimal actualPayedAmount1; | |
33 | + /** | |
34 | + * 实际应付金额2 | |
35 | + */ | |
36 | + private BigDecimal actualPayedAmount2; | |
37 | + /** | |
38 | + * 实际应付金额3 | |
39 | + */ | |
40 | + private BigDecimal actualPayedAmount3; | |
41 | + | |
42 | + | |
43 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/ProducePaymentCheckBillCommitApplyVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | + | |
8 | +/** | |
9 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
10 | + * | |
11 | + * @author makejava | |
12 | + * @since 2024-08-05 16:26:35 | |
13 | + */ | |
14 | +@Data | |
15 | +@AllArgsConstructor | |
16 | +@ToString | |
17 | +@NoArgsConstructor | |
18 | +@EqualsAndHashCode(callSuper = false) | |
19 | +@SuperBuilder | |
20 | +public class ProducePaymentCheckBillCommitApplyVO implements Serializable { | |
21 | + | |
22 | + private Long id; | |
23 | + | |
24 | + private String actualPayedDate; | |
25 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/ProducePaymentCheckBillCreateVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.util.List; | |
8 | + | |
9 | +/** | |
10 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:35 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class ProducePaymentCheckBillCreateVO implements Serializable { | |
22 | + | |
23 | + private Long id; | |
24 | + /** | |
25 | + * 生产科对账单 | |
26 | + */ | |
27 | + private String checkNo; | |
28 | + | |
29 | + /** | |
30 | + * 生产科应付款日期 | |
31 | + */ | |
32 | + private String payedDate; | |
33 | + | |
34 | + /** | |
35 | + * 订单id集合 | |
36 | + */ | |
37 | + private List<Long> orderIds; | |
38 | + | |
39 | + | |
40 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/ProducePaymentCheckBillDeductInfoVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.math.BigDecimal; | |
8 | + | |
9 | +/** | |
10 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:35 | |
14 | + */ | |
15 | +@Data | |
16 | +@AllArgsConstructor | |
17 | +@ToString | |
18 | +@NoArgsConstructor | |
19 | +@EqualsAndHashCode(callSuper = false) | |
20 | +@SuperBuilder | |
21 | +public class ProducePaymentCheckBillDeductInfoVO implements Serializable { | |
22 | + | |
23 | + private Long id; | |
24 | + /** | |
25 | + * 生产科对账单 | |
26 | + */ | |
27 | + private String checkNo; | |
28 | + | |
29 | + /** | |
30 | + * 生产科扣款责任部门 | |
31 | + */ | |
32 | + private String deductDept; | |
33 | + | |
34 | + /** | |
35 | + * 发生扣款金额 | |
36 | + */ | |
37 | + private BigDecimal deductAmount; | |
38 | + | |
39 | + /** | |
40 | + * 扣款单url地址 | |
41 | + */ | |
42 | + private String deductUrl; | |
43 | + | |
44 | + | |
45 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/ProducePaymentCheckBillInvoiceInfoVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | + | |
8 | +/** | |
9 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
10 | + * | |
11 | + * @author makejava | |
12 | + * @since 2024-08-05 16:26:35 | |
13 | + */ | |
14 | +@Data | |
15 | +@AllArgsConstructor | |
16 | +@ToString | |
17 | +@NoArgsConstructor | |
18 | +@EqualsAndHashCode(callSuper = false) | |
19 | +@SuperBuilder | |
20 | +public class ProducePaymentCheckBillInvoiceInfoVO implements Serializable { | |
21 | + | |
22 | + private Long id; | |
23 | + | |
24 | + /** | |
25 | + * 发票url地址 | |
26 | + */ | |
27 | + private String invoiceUrl; | |
28 | + | |
29 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/order/ProducePaymentCheckBillOrderQueryVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import com.order.erp.domain.vo.BasePageVO; | |
4 | +import lombok.*; | |
5 | +import lombok.experimental.SuperBuilder; | |
6 | + | |
7 | +import java.io.Serializable; | |
8 | +import java.util.List; | |
9 | + | |
10 | +/** | |
11 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
12 | + * | |
13 | + * @author makejava | |
14 | + * @since 2024-08-05 16:26:35 | |
15 | + */ | |
16 | +@Data | |
17 | +@AllArgsConstructor | |
18 | +@ToString | |
19 | +@NoArgsConstructor | |
20 | +@EqualsAndHashCode(callSuper = false) | |
21 | +@SuperBuilder | |
22 | +public class ProducePaymentCheckBillOrderQueryVO extends BasePageVO implements Serializable { | |
23 | + | |
24 | + private List<Long> ids; | |
25 | + | |
26 | + | |
27 | + private Long id; | |
28 | + /** | |
29 | + * 生产科对账单 | |
30 | + */ | |
31 | + private String checkNo; | |
32 | + /** | |
33 | + * 总经理审核状态 -1,未提交审核,0:待审核、1:审核通过,2:审核驳回 | |
34 | + */ | |
35 | + private Integer status; | |
36 | + | |
37 | + /** | |
38 | + * 客户编码 | |
39 | + */ | |
40 | + private String customerCode; | |
41 | + | |
42 | + /** | |
43 | + * 项目号 | |
44 | + */ | |
45 | + private String projectNo; | |
46 | + | |
47 | + /** | |
48 | + * 生产科 | |
49 | + */ | |
50 | + private String productionDepartment; | |
51 | + | |
52 | + /** | |
53 | + * 内部编号 | |
54 | + */ | |
55 | + private String innerNo; | |
56 | + | |
57 | + /** | |
58 | + * 客户po号 | |
59 | + */ | |
60 | + private String customerPo; | |
61 | + | |
62 | + /** | |
63 | + * 开始时间 | |
64 | + */ | |
65 | + private String startTime; | |
66 | + | |
67 | + /** | |
68 | + * 结束时间 | |
69 | + */ | |
70 | + private String endTime; | |
71 | + | |
72 | +} | |
73 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/order/ProducePaymentCheckBillOrderVO.java
0 → 100644
1 | +package com.order.erp.domain.vo.order; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | + | |
8 | +/** | |
9 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)实体类 | |
10 | + * | |
11 | + * @author makejava | |
12 | + * @since 2024-08-05 16:26:35 | |
13 | + */ | |
14 | +@Data | |
15 | +@AllArgsConstructor | |
16 | +@ToString | |
17 | +@NoArgsConstructor | |
18 | +@EqualsAndHashCode(callSuper = false) | |
19 | +@SuperBuilder | |
20 | +public class ProducePaymentCheckBillOrderVO implements Serializable { | |
21 | + private static final long serialVersionUID = 239047702576286556L; | |
22 | + | |
23 | + private Long id; | |
24 | + /** | |
25 | + * 生产科对账单 | |
26 | + */ | |
27 | + private String checkNo; | |
28 | + /** | |
29 | + * 发票url地址 | |
30 | + */ | |
31 | + private String invoiceUrl; | |
32 | + /** | |
33 | + * 扣款单url地址 | |
34 | + */ | |
35 | + private String deductPdfUrl; | |
36 | + /** | |
37 | + * 生产科应付款日期 | |
38 | + */ | |
39 | + private String payedDate; | |
40 | + /** | |
41 | + * 生产科扣款责任部门 | |
42 | + */ | |
43 | + private String deductDept; | |
44 | + /** | |
45 | + * 生产科扣款金额 | |
46 | + */ | |
47 | + private Double deductAmount; | |
48 | + /** | |
49 | + * 实际应付金额 | |
50 | + */ | |
51 | + private Double actualPayedAmount; | |
52 | + /** | |
53 | + * 总经理审核状态 0:待审核、1:审核通过,2:审核驳回 | |
54 | + */ | |
55 | + private Integer status; | |
56 | + | |
57 | + | |
58 | +} | ... | ... |
src/main/java/com/order/erp/job/FinanceJob.java
0 → 100644
1 | +package com.order.erp.job; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
5 | +import com.order.erp.common.constant.Constant; | |
6 | +import com.order.erp.common.utils.EmailSendUtils; | |
7 | +import com.order.erp.common.utils.RedisUtils; | |
8 | +import com.order.erp.domain.ApplyStatusEnum; | |
9 | +import com.order.erp.domain.FinanceOverEnum; | |
10 | +import com.order.erp.domain.dto.BaseDO; | |
11 | +import com.order.erp.domain.dto.admin.AdminUserDO; | |
12 | +import com.order.erp.domain.dto.admin.AdminUserRoleDO; | |
13 | +import com.order.erp.domain.dto.order.InvoiceBillOrderDO; | |
14 | +import com.order.erp.domain.dto.order.ProducePaymentCheckBillOrderDO; | |
15 | +import com.order.erp.domain.vo.order.FinanceEventJobVO; | |
16 | +import com.order.erp.service.admin.AdminUserRoleService; | |
17 | +import com.order.erp.service.admin.AdminUserService; | |
18 | +import com.order.erp.service.order.InvoiceBillOrderService; | |
19 | +import com.order.erp.service.order.ProducePaymentCheckBillOrderService; | |
20 | +import lombok.extern.slf4j.Slf4j; | |
21 | +import org.apache.logging.log4j.util.Strings; | |
22 | +import org.springframework.scheduling.annotation.Scheduled; | |
23 | +import org.springframework.stereotype.Component; | |
24 | + | |
25 | +import javax.annotation.Resource; | |
26 | +import java.time.LocalDate; | |
27 | +import java.util.*; | |
28 | +import java.util.concurrent.TimeUnit; | |
29 | +import java.util.stream.Collectors; | |
30 | + | |
31 | +@Slf4j | |
32 | +@Component | |
33 | +public class FinanceJob { | |
34 | + @Resource | |
35 | + private EmailSendUtils emailSendUtils; | |
36 | + @Resource | |
37 | + private InvoiceBillOrderService invoiceBillOrderService; | |
38 | + @Resource | |
39 | + private ProducePaymentCheckBillOrderService producePaymentCheckBillOrderService; | |
40 | + @Resource | |
41 | + private AdminUserRoleService adminUserRoleService; | |
42 | + @Resource | |
43 | + private AdminUserService adminUserService; | |
44 | + @Resource | |
45 | + private RedisUtils redisService; | |
46 | + //每天的7:15执行一次 | |
47 | +// @Scheduled(cron = "0 15 7 * * ?", zone = "Asia/Shanghai") | |
48 | + | |
49 | + //每分钟执行一次 | |
50 | + @Scheduled(cron = "0 * * * * ?", zone = "Asia/Shanghai") | |
51 | + public void financeJob() { | |
52 | + List<InvoiceBillOrderDO> eventInvoiceBillOrderDO=invoiceBillOrderService.getOverEvnetList(); | |
53 | + List<ProducePaymentCheckBillOrderDO> eventProducePaymentCheckBillOrderDO= producePaymentCheckBillOrderService.getOverEventList(); | |
54 | + LocalDate today = LocalDate.now(); | |
55 | + List<InvoiceBillOrderDO> invoiceBillOrderDOList = eventInvoiceBillOrderDO.stream().filter(invoice -> invoice.getBackRefundDate() != null && Strings.isNotEmpty(invoice.getBackRefundDate())) | |
56 | + .collect(Collectors.toList()); | |
57 | + Set<String> emailList= new HashSet<>(); | |
58 | + Set<String> twoEmail = new HashSet<>(); | |
59 | + //获取所有用户。 | |
60 | + List<AdminUserDO> allUser = adminUserService.list(new LambdaQueryWrapper<AdminUserDO>() | |
61 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)); | |
62 | + Map<Long, AdminUserDO> adminUserDOMap = allUser.stream().collect(Collectors.toMap(AdminUserDO::getId, AdminUserDO -> AdminUserDO, (existing, replacement) -> existing)); | |
63 | + Map<String, AdminUserDO> userName = allUser.stream().collect(Collectors.toMap(AdminUserDO::getUserName, AdminUserDO -> AdminUserDO, (existing, replacement) -> existing)); | |
64 | + //获取财务邮箱。 | |
65 | + List<AdminUserRoleDO> list = adminUserRoleService.list(new LambdaQueryWrapper<AdminUserRoleDO>() | |
66 | + .eq(AdminUserRoleDO::getRoleId, Constant.SEVEN)); | |
67 | + Set<Long> userIds= list.stream().map(AdminUserRoleDO::getUserId).collect(Collectors.toSet()); | |
68 | + List<String> financeEmailList = userIds.stream() | |
69 | + .map(userId -> Optional.ofNullable(adminUserDOMap.get(userId)) | |
70 | + .map(AdminUserDO::getEmail) | |
71 | + .filter(Strings::isNotEmpty) | |
72 | + .orElse(null)) | |
73 | + .filter(Objects::nonNull) | |
74 | + .collect(Collectors.toList()); | |
75 | + | |
76 | + if(CollectionUtils.isNotEmpty(invoiceBillOrderDOList)){ | |
77 | + invoiceBillOrderDOList.forEach(invoiceBillOrderDO -> { | |
78 | + if(today.toString().equals(invoiceBillOrderDO.getBackRefundDate())) { | |
79 | + emailList.clear(); | |
80 | + String redisKey = "invoice:" + invoiceBillOrderDO.getId()+invoiceBillOrderDO.getInvoiceNo(); | |
81 | + //判断redis中是否有这个值,如果没有就发送邮件,如果有的话就不用发送邮件。 | |
82 | + if(!redisService.hasKey(redisKey)){ | |
83 | + if (CollectionUtils.isNotEmpty(financeEmailList)) { | |
84 | + emailList.addAll(financeEmailList); | |
85 | + } | |
86 | + Set<String> userSet = new HashSet<>(); | |
87 | + userSet.add(invoiceBillOrderDO.getCreateBy()); | |
88 | + userSet.add(invoiceBillOrderDO.getBusinesPerson()); | |
89 | + List<String> emails = userSet.stream() | |
90 | + .map(userName::get) | |
91 | + .filter(Objects::nonNull) // 确保 AdminUserDO 不为 null | |
92 | + .map(AdminUserDO::getEmail) // 获取邮箱 | |
93 | + .filter(Strings::isNotEmpty) // 确保邮箱不为空 | |
94 | + .collect(Collectors.toList()); | |
95 | + if (CollectionUtils.isNotEmpty(emails)) { | |
96 | + emailList.addAll(emails); | |
97 | + } | |
98 | + FinanceEventJobVO eventJobVO = new FinanceEventJobVO(); | |
99 | + eventJobVO.setInvoiceBillOrderDO(invoiceBillOrderDO); | |
100 | + emailSendUtils.sendEmail(FinanceOverEnum.INVOICE_OVERTIME, new ArrayList<>(emailList), eventJobVO); | |
101 | + boolean set = redisService.set(redisKey, invoiceBillOrderDO, Constant.TWENTY_FIRST, TimeUnit.DAYS);// 设置为21天后过期 | |
102 | + if(set){ | |
103 | + redisService.saddWithExpiry(Constant.REDISKEY,redisKey, Constant.TWENTY_FIRST, TimeUnit.DAYS); | |
104 | + } | |
105 | + } | |
106 | + } | |
107 | + }); | |
108 | + } | |
109 | + List<ProducePaymentCheckBillOrderDO> producePaymentCheckBillOrderDOList= eventProducePaymentCheckBillOrderDO.stream().filter(producePaymentCheckBillOrderDO -> producePaymentCheckBillOrderDO.getPayedDate()!=null && Strings.isNotEmpty(producePaymentCheckBillOrderDO.getPayedDate())) | |
110 | + .collect(Collectors.toList()); | |
111 | + if(CollectionUtils.isNotEmpty(producePaymentCheckBillOrderDOList)){ | |
112 | + producePaymentCheckBillOrderDOList.forEach(producePaymentCheckBillOrderDO -> { | |
113 | + if(today.toString().equals(producePaymentCheckBillOrderDO.getPayedDate())){ | |
114 | + emailList.clear(); // 每次清除 uniqueEmails | |
115 | + String redisKey = "check:" + producePaymentCheckBillOrderDO.getId()+producePaymentCheckBillOrderDO.getCheckNo(); | |
116 | + if(!redisService.hasKey(redisKey)) { | |
117 | + if (CollectionUtils.isNotEmpty(financeEmailList)) { | |
118 | + emailList.addAll(financeEmailList); | |
119 | + } | |
120 | + //发送邮件 | |
121 | + Set<String> userSet = new HashSet<>(); | |
122 | + //获取业务,财务,管理员 | |
123 | + userSet.add(producePaymentCheckBillOrderDO.getCreateBy()); | |
124 | + userSet.add(producePaymentCheckBillOrderDO.getBusinesPerson()); | |
125 | + List<String> emails = userSet.stream() | |
126 | + .map(userName::get) | |
127 | + .filter(Objects::nonNull) // 确保 AdminUserDO 不为 null | |
128 | + .map(AdminUserDO::getEmail) // 获取邮箱 | |
129 | + .filter(Strings::isNotEmpty) // 确保邮箱不为空 | |
130 | + .collect(Collectors.toList()); | |
131 | + | |
132 | + if (CollectionUtils.isNotEmpty(emails)) { | |
133 | + emailList.addAll(emails); | |
134 | + } | |
135 | + FinanceEventJobVO eventJobVO = new FinanceEventJobVO(); | |
136 | + eventJobVO.setProducePaymentCheckBillOrderDO(producePaymentCheckBillOrderDO); | |
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天后过期 | |
139 | + if(set){ | |
140 | + redisService.saddWithExpiry(Constant.REDISKEY,redisKey, Constant.TWENTY_FIRST, TimeUnit.DAYS); | |
141 | + } | |
142 | + } | |
143 | + } | |
144 | + }); | |
145 | + } | |
146 | + | |
147 | + Map<String, List<Long>> stringListMap = byKeysGetValue(); | |
148 | + if (stringListMap != null) { | |
149 | + // 获取 InvoiceBillOrderDO 类型的 ID 列表 | |
150 | + List<Long> invoiceBillOrderIds = stringListMap.get("InvoiceBillOrderDO"); | |
151 | + if (invoiceBillOrderIds != null && !invoiceBillOrderIds.isEmpty()) { | |
152 | + List<InvoiceBillOrderDO> invoiceBillOrderDOS = invoiceBillOrderService.listByIds(invoiceBillOrderIds); | |
153 | + invoiceBillOrderDOS.forEach(x->{ | |
154 | + if(ApplyStatusEnum.NO_COMMIT.getStatus()==x.getStatus() || ApplyStatusEnum.AUDIT_REFUSE.getStatus()==x.getStatus()){ | |
155 | + twoEmail.clear(); | |
156 | + twoEmail.addAll(financeEmailList); | |
157 | + Set<String> userSet = new HashSet<>(); | |
158 | + userSet.add(x.getCreateBy()); | |
159 | + userSet.add(x.getBusinesPerson()); | |
160 | + List<String> emails = userSet.stream() | |
161 | + .map(userName::get) | |
162 | + .filter(Objects::nonNull) // 确保 AdminUserDO 不为 null | |
163 | + .map(AdminUserDO::getEmail) // 获取邮箱 | |
164 | + .filter(Strings::isNotEmpty) // 确保邮箱不为空 | |
165 | + .collect(Collectors.toList()); | |
166 | + | |
167 | + if (CollectionUtils.isNotEmpty(emails)) { | |
168 | + twoEmail.addAll(emails); | |
169 | + } | |
170 | + FinanceEventJobVO eventJobVO = new FinanceEventJobVO(); | |
171 | + eventJobVO.setInvoiceBillOrderDO(x); | |
172 | + emailSendUtils.sendEmail(FinanceOverEnum.INVOICE_OVERTIME, new ArrayList<>(twoEmail), eventJobVO); | |
173 | + } | |
174 | + }); | |
175 | + } | |
176 | + // 获取 ProducePaymentCheckBillOrderDO 类型的 ID 列表 | |
177 | + List<Long> producePaymentCheckBillIds = stringListMap.get("ProducePaymentCheckBillOrderDO"); | |
178 | + if (producePaymentCheckBillIds != null && !producePaymentCheckBillIds.isEmpty()) { | |
179 | + List<ProducePaymentCheckBillOrderDO> producePaymentCheckBillOrderDOS = producePaymentCheckBillOrderService.listByIds(producePaymentCheckBillIds); | |
180 | + producePaymentCheckBillOrderDOS.forEach(x->{ | |
181 | + if(ApplyStatusEnum.NO_COMMIT.getStatus()==x.getStatus() || ApplyStatusEnum.AUDIT_REFUSE.getStatus()==x.getStatus()){ | |
182 | + twoEmail.clear(); | |
183 | + twoEmail.addAll(financeEmailList); | |
184 | + Set<String> userSet = new HashSet<>(); | |
185 | + userSet.add(x.getCreateBy()); | |
186 | + userSet.add(x.getBusinesPerson()); | |
187 | + List<String> emails = userSet.stream() | |
188 | + .map(userName::get) | |
189 | + .filter(Objects::nonNull) // 确保 AdminUserDO 不为 null | |
190 | + .map(AdminUserDO::getEmail) // 获取邮箱 | |
191 | + .filter(Strings::isNotEmpty) // 确保邮箱不为空 | |
192 | + .collect(Collectors.toList()); | |
193 | + if (CollectionUtils.isNotEmpty(emails)) { | |
194 | + twoEmail.addAll(emails); | |
195 | + } | |
196 | + FinanceEventJobVO eventJobVO = new FinanceEventJobVO(); | |
197 | + eventJobVO.setProducePaymentCheckBillOrderDO(x); | |
198 | + emailSendUtils.sendEmail(FinanceOverEnum.PRODUCE_PAYMENT_CHECK_OVERTIME, new ArrayList<>(twoEmail), eventJobVO); | |
199 | + } | |
200 | + }); | |
201 | + } | |
202 | + } | |
203 | + } | |
204 | + | |
205 | + public Map<String, List<Long>> byKeysGetValue() { | |
206 | + Map<String, List<Long>> resultMap = new HashMap<>(); | |
207 | + List<Long> producePaymentCheckBillIds = new ArrayList<>(); | |
208 | + List<Long> invoiceBillOrderIds = new ArrayList<>(); | |
209 | + // 获取所有的 keys对应的value。 | |
210 | + Set<Object> redisKeySet = redisService.getSetValues(Constant.REDISKEY); | |
211 | + if (CollectionUtils.isNotEmpty(redisKeySet)) { | |
212 | + List<Object> validKeys = new ArrayList<>(); | |
213 | + | |
214 | + // 遍历所有 keys,检查每个 key 的过期时间 | |
215 | + for (Object key :redisKeySet) { | |
216 | + Long expireTime = redisService.getExpire(key); // 获取过期时间(单位:秒) | |
217 | + | |
218 | + if (expireTime != null && expireTime > 0) { // 确保 expireTime 有值且大于 0 | |
219 | + long daysRemaining = TimeUnit.SECONDS.toDays(expireTime); | |
220 | + // 如果剩余时间为14天7天或1天,则符合条件 | |
221 | + if (daysRemaining==14 || daysRemaining == 7 || daysRemaining == 1) { | |
222 | + validKeys.add(key); // 满足条件,加入有效的 keys 列表 | |
223 | + } | |
224 | + } | |
225 | + } | |
226 | + // 如果存在有效的 keys,获取其对应的值 | |
227 | + if (CollectionUtils.isNotEmpty(validKeys)) { | |
228 | + List<Object> values = redisService.multiGet(validKeys); | |
229 | + if (CollectionUtils.isNotEmpty(values)) { | |
230 | + // 遍历每个 value,按类型分别收集 ID | |
231 | + for (Object item : values) { | |
232 | + if (item instanceof ProducePaymentCheckBillOrderDO) { | |
233 | + ProducePaymentCheckBillOrderDO producePaymentCheckBillOrderDO = (ProducePaymentCheckBillOrderDO) item; | |
234 | + producePaymentCheckBillIds.add(producePaymentCheckBillOrderDO.getId()); | |
235 | + } else if (item instanceof InvoiceBillOrderDO) { | |
236 | + InvoiceBillOrderDO invoiceBillOrderDO = (InvoiceBillOrderDO) item; | |
237 | + invoiceBillOrderIds.add(invoiceBillOrderDO.getId()); | |
238 | + } | |
239 | + } | |
240 | + } | |
241 | + // 将结果放入 resultMap | |
242 | + resultMap.put("ProducePaymentCheckBillOrderDO", producePaymentCheckBillIds); | |
243 | + resultMap.put("InvoiceBillOrderDO", invoiceBillOrderIds); | |
244 | + } | |
245 | + } | |
246 | + return resultMap; | |
247 | + } | |
248 | + | |
249 | +} | ... | ... |
src/main/java/com/order/erp/mapper/order/CheckBillMappingMapper.java
0 → 100644
1 | +package com.order.erp.mapper.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | +import com.order.erp.domain.dto.order.CheckBillMappingDO; | |
5 | + | |
6 | +/** | |
7 | + * 生产科对账单应收账单映射表(CheckBillMapping)表数据库访问层 | |
8 | + * | |
9 | + * @author makejava | |
10 | + * @since 2024-08-05 16:26:37 | |
11 | + */ | |
12 | +public interface CheckBillMappingMapper extends BaseMapper<CheckBillMappingDO> { | |
13 | + | |
14 | + | |
15 | +} | |
16 | + | ... | ... |
src/main/java/com/order/erp/mapper/order/InvoiceBillMappingMapper.java
0 → 100644
1 | +package com.order.erp.mapper.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | +import com.order.erp.domain.dto.order.InvoiceBillMappingDO; | |
5 | + | |
6 | +/** | |
7 | + * 应收款账单关联订单映射表(InvoiceBillMapping)表数据库访问层 | |
8 | + * | |
9 | + * @author makejava | |
10 | + * @since 2024-08-05 16:26:36 | |
11 | + */ | |
12 | +public interface InvoiceBillMappingMapper extends BaseMapper<InvoiceBillMappingDO> { | |
13 | + | |
14 | + | |
15 | +} | |
16 | + | ... | ... |
src/main/java/com/order/erp/mapper/order/InvoiceBillOrderMapper.java
0 → 100644
1 | +package com.order.erp.mapper.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | +import com.order.erp.domain.dto.order.InvoiceBillOrderDO; | |
5 | +import org.apache.ibatis.annotations.Select; | |
6 | + | |
7 | +import java.util.List; | |
8 | + | |
9 | +/** | |
10 | + * 应收款账单表(InvoiceBillOrder)表数据库访问层 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:34 | |
14 | + */ | |
15 | +public interface InvoiceBillOrderMapper extends BaseMapper<InvoiceBillOrderDO> { | |
16 | +@Select("SELECT * FROM invoice_bill_order WHERE status in('-1','20') and enable_flag=10 and DATE_SUB(CURDATE(), INTERVAL 1 YEAR) <= date(create_time);") | |
17 | +List<InvoiceBillOrderDO> getOverEventList(); | |
18 | + | |
19 | +} | |
20 | + | ... | ... |
src/main/java/com/order/erp/mapper/order/ProducePaymentCheckBillOrderMapper.java
0 → 100644
1 | +package com.order.erp.mapper.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | +import com.order.erp.domain.dto.order.ProducePaymentCheckBillOrderDO; | |
5 | +import org.apache.ibatis.annotations.Select; | |
6 | + | |
7 | +import java.util.List; | |
8 | + | |
9 | +/** | |
10 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)表数据库访问层 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:35 | |
14 | + */ | |
15 | +public interface ProducePaymentCheckBillOrderMapper extends BaseMapper<ProducePaymentCheckBillOrderDO> { | |
16 | + @Select("SELECT * FROM produce_payment_check_bill_order WHERE status in('-1','20') and enable_flag=10 and DATE_SUB(CURDATE(), INTERVAL 1 YEAR) <= date(create_time);") | |
17 | + List<ProducePaymentCheckBillOrderDO> getOverEventList(); | |
18 | + | |
19 | + | |
20 | +} | |
21 | + | ... | ... |
src/main/java/com/order/erp/service/admin/impl/AdminUserServiceImpl.java
... | ... | @@ -346,6 +346,9 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser |
346 | 346 | if(RoleEnum.PRODUCE_USER.getId().equals(x.getRoleId())){ |
347 | 347 | result.set(RoleEnum.PRODUCE_USER); |
348 | 348 | } |
349 | + if (RoleEnum.FINANCE_USER.getId().equals(x.getRoleId())) { | |
350 | + result.set(RoleEnum.FINANCE_USER); | |
351 | + } | |
349 | 352 | }); |
350 | 353 | return ServerResult.success(result.get()); |
351 | 354 | } | ... | ... |
src/main/java/com/order/erp/service/impl/SystemSettingServiceImpl.java
... | ... | @@ -2,6 +2,7 @@ package com.order.erp.service.impl; |
2 | 2 | |
3 | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | +import com.alibaba.fastjson.JSONArray; | |
5 | 6 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
6 | 7 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
7 | 8 | import com.baomidou.mybatisplus.core.metadata.IPage; |
... | ... | @@ -11,8 +12,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
11 | 12 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
12 | 13 | import com.order.erp.common.constant.Constant; |
13 | 14 | import com.order.erp.common.constant.ServerResult; |
15 | +import com.order.erp.common.exception.BusinessException; | |
14 | 16 | import com.order.erp.domain.dto.BaseDO; |
15 | 17 | import com.order.erp.domain.dto.SystemSettingDO; |
18 | +import com.order.erp.domain.vo.CostSettingItemVO; | |
16 | 19 | import com.order.erp.domain.vo.SystemSettingQueryVO; |
17 | 20 | import com.order.erp.domain.vo.SystemSettingResultVO; |
18 | 21 | import com.order.erp.domain.vo.SystemSettingVO; |
... | ... | @@ -84,6 +87,9 @@ public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, S |
84 | 87 | List<SystemSettingResultVO> queryVos = systemSettingDOS.stream().map(x -> { |
85 | 88 | SystemSettingResultVO resultVO = new SystemSettingResultVO(); |
86 | 89 | BeanUtils.copyProperties(x, resultVO); |
90 | + if (x.getSettingType() == Constant.THREE && StringUtils.isNotBlank(x.getRelationValue())) { | |
91 | + resultVO.setCostSettingItemVOS(JSONArray.parseArray(x.getRelationValue(), CostSettingItemVO.class)); | |
92 | + } | |
87 | 93 | return resultVO; |
88 | 94 | }).collect(Collectors.toList()); |
89 | 95 | webVOPage.setRecords(queryVos); |
... | ... | @@ -117,6 +123,23 @@ public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, S |
117 | 123 | if (Objects.nonNull(systemSettingVO.getId())) { |
118 | 124 | systemSettingVO.setId(null); |
119 | 125 | } |
126 | + if (systemSettingVO.getSettingType() == Constant.THREE || systemSettingVO.getSettingType() == Constant.FOUR) { | |
127 | + if (CollectionUtils.isEmpty(systemSettingVO.getCostSettingItemVOS())) { | |
128 | + throw new BusinessException("成本配置项不能为空"); | |
129 | + } | |
130 | + if(StringUtils.isNotBlank(systemSettingVO.getSettingValue())){ | |
131 | + SystemSettingDO systemSettingDO = getOne(new LambdaQueryWrapper<SystemSettingDO>() | |
132 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
133 | + .eq(SystemSettingDO::getSettingValue, systemSettingVO.getSettingValue()) | |
134 | + .eq(SystemSettingDO::getSettingType,systemSettingVO.getSettingType())); | |
135 | + if(Objects.nonNull(systemSettingDO)){ | |
136 | + throw new BusinessException("已配置"+systemSettingVO.getSettingValue()+"的提成数据!"); | |
137 | + } | |
138 | + } | |
139 | +// systemSettingVO.setRelationCode("costSettingItem"); | |
140 | +// systemSettingVO.setRelationName("成本配置项集合"); | |
141 | + systemSettingVO.setRelationValue(JSONArray.toJSONString(systemSettingVO.getCostSettingItemVOS())); | |
142 | + } | |
120 | 143 | SystemSettingDO systemSettingDo = BeanUtil.copyProperties(systemSettingVO, SystemSettingDO.class); |
121 | 144 | |
122 | 145 | save(systemSettingDo); |
... | ... | @@ -136,6 +159,14 @@ public class SystemSettingServiceImpl extends ServiceImpl<SystemSettingMapper, S |
136 | 159 | if (Objects.isNull(systemSettingVO.getId())) { |
137 | 160 | return ServerResult.fail("id 不能为空"); |
138 | 161 | } |
162 | + if (Objects.nonNull(systemSettingVO.getSettingType()) && (systemSettingVO.getSettingType() == Constant.THREE || systemSettingVO.getSettingType() == Constant.FOUR)) { | |
163 | + if (CollectionUtils.isEmpty(systemSettingVO.getCostSettingItemVOS())) { | |
164 | + throw new BusinessException("成本配置项不能为空"); | |
165 | + } | |
166 | +// systemSettingVO.setRelationCode("costSettingItem"); | |
167 | +// systemSettingVO.setRelationName("成本配置项集合"); | |
168 | + systemSettingVO.setRelationValue(JSONArray.toJSONString(systemSettingVO.getCostSettingItemVOS())); | |
169 | + } | |
139 | 170 | SystemSettingDO systemSettingDo = BeanUtil.copyProperties(systemSettingVO, SystemSettingDO.class); |
140 | 171 | |
141 | 172 | updateById(systemSettingDo); | ... | ... |
src/main/java/com/order/erp/service/order/CheckBillMappingService.java
0 → 100644
1 | +package com.order.erp.service.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.order.CheckBillMappingDO; | |
6 | +import com.order.erp.domain.vo.order.CheckBillMappingQueryVO; | |
7 | +import com.order.erp.domain.vo.order.CheckBillMappingVO; | |
8 | + | |
9 | +/** | |
10 | + * 生产科对账单应收账单映射表(CheckBillMapping)表服务接口 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:37 | |
14 | + */ | |
15 | +public interface CheckBillMappingService extends IService<CheckBillMappingDO> { | |
16 | + | |
17 | + /** | |
18 | + * 通过ID查询单条数据 | |
19 | + * | |
20 | + * @param checkBillMappingQueryVO 主键 | |
21 | + * @return 实例对象 | |
22 | + */ | |
23 | + ServerResult queryById(CheckBillMappingQueryVO checkBillMappingQueryVO); | |
24 | + | |
25 | + /** | |
26 | + * 分页查询 | |
27 | + * | |
28 | + * @param checkBillMappingQueryVO 筛选条件 | |
29 | + * @return 查询结果 | |
30 | + */ | |
31 | + ServerResult list(CheckBillMappingQueryVO checkBillMappingQueryVO); | |
32 | + | |
33 | + /** | |
34 | + * 新增数据 | |
35 | + * | |
36 | + * @param checkBillMappingVO 数据VO | |
37 | + * @return 新增结果 | |
38 | + */ | |
39 | + ServerResult add(CheckBillMappingVO checkBillMappingVO); | |
40 | + | |
41 | + /** | |
42 | + * 修改数据 | |
43 | + * | |
44 | + * @param checkBillMappingVO 数据VO | |
45 | + * @return 编辑结果 | |
46 | + */ | |
47 | + ServerResult edit(CheckBillMappingVO checkBillMappingVO); | |
48 | + | |
49 | + /** | |
50 | + * 通过主键删除数据 | |
51 | + * | |
52 | + * @param checkBillMappingQueryVO 筛选条件 | |
53 | + * @return 是否成功 | |
54 | + */ | |
55 | + ServerResult deleteById(CheckBillMappingQueryVO checkBillMappingQueryVO); | |
56 | + | |
57 | +} | ... | ... |
src/main/java/com/order/erp/service/order/InvoiceBillMappingService.java
0 → 100644
1 | +package com.order.erp.service.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.order.InvoiceBillMappingDO; | |
6 | +import com.order.erp.domain.vo.order.InvoiceBillMappingQueryVO; | |
7 | +import com.order.erp.domain.vo.order.InvoiceBillMappingVO; | |
8 | + | |
9 | +/** | |
10 | + * 应收款账单关联订单映射表(InvoiceBillMapping)表服务接口 | |
11 | + * | |
12 | + * @author makejava | |
13 | + * @since 2024-08-05 16:26:36 | |
14 | + */ | |
15 | +public interface InvoiceBillMappingService extends IService<InvoiceBillMappingDO> { | |
16 | + | |
17 | + /** | |
18 | + * 通过ID查询单条数据 | |
19 | + * | |
20 | + * @param invoiceBillMappingQueryVO 主键 | |
21 | + * @return 实例对象 | |
22 | + */ | |
23 | + ServerResult queryById(InvoiceBillMappingQueryVO invoiceBillMappingQueryVO); | |
24 | + | |
25 | + /** | |
26 | + * 分页查询 | |
27 | + * | |
28 | + * @param invoiceBillMappingQueryVO 筛选条件 | |
29 | + * @return 查询结果 | |
30 | + */ | |
31 | + ServerResult list(InvoiceBillMappingQueryVO invoiceBillMappingQueryVO); | |
32 | + | |
33 | + /** | |
34 | + * 新增数据 | |
35 | + * | |
36 | + * @param invoiceBillMappingVO 数据VO | |
37 | + * @return 新增结果 | |
38 | + */ | |
39 | + ServerResult add(InvoiceBillMappingVO invoiceBillMappingVO); | |
40 | + | |
41 | + /** | |
42 | + * 修改数据 | |
43 | + * | |
44 | + * @param invoiceBillMappingVO 数据VO | |
45 | + * @return 编辑结果 | |
46 | + */ | |
47 | + ServerResult edit(InvoiceBillMappingVO invoiceBillMappingVO); | |
48 | + | |
49 | + /** | |
50 | + * 通过主键删除数据 | |
51 | + * | |
52 | + * @param invoiceBillMappingQueryVO 筛选条件 | |
53 | + * @return 是否成功 | |
54 | + */ | |
55 | + ServerResult deleteById(InvoiceBillMappingQueryVO invoiceBillMappingQueryVO); | |
56 | + | |
57 | +} | ... | ... |
src/main/java/com/order/erp/service/order/InvoiceBillOrderService.java
0 → 100644
1 | +package com.order.erp.service.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.order.InvoiceBillOrderDO; | |
6 | +import com.order.erp.domain.vo.order.*; | |
7 | + | |
8 | +import javax.servlet.http.HttpServletResponse; | |
9 | +import java.io.IOException; | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * 应收款账单表(InvoiceBillOrder)表服务接口 | |
14 | + * | |
15 | + * @author makejava | |
16 | + * @since 2024-08-05 16:26:34 | |
17 | + */ | |
18 | +public interface InvoiceBillOrderService extends IService<InvoiceBillOrderDO> { | |
19 | + | |
20 | + /** | |
21 | + * 分页查询 | |
22 | + * | |
23 | + * @param invoiceBillOrderQueryVO 筛选条件 | |
24 | + * @return 查询结果 | |
25 | + */ | |
26 | + ServerResult listByPage(InvoiceBillOrderQueryVO invoiceBillOrderQueryVO); | |
27 | + | |
28 | + /** | |
29 | + * @param queryVO | |
30 | + * @return | |
31 | + */ | |
32 | + ServerResult listBaseOrderInfoBy(InvoiceBaseOrderQueryVO queryVO); | |
33 | + | |
34 | + /** | |
35 | + * @param queryVO | |
36 | + * @return | |
37 | + */ | |
38 | + ServerResult listAnalysisBy(InvoiceBillAnalysisVO queryVO); | |
39 | + | |
40 | + /** | |
41 | + * @param queryVO | |
42 | + * @return | |
43 | + */ | |
44 | + ServerResult export(HttpServletResponse response, InvoiceBillAnalysisVO queryVO) throws IOException; | |
45 | + | |
46 | + /** | |
47 | + * 新增数据 | |
48 | + * | |
49 | + * @param createVO 数据VO | |
50 | + * @return 新增结果 | |
51 | + */ | |
52 | + ServerResult create(InvoiceBillCreateVO createVO); | |
53 | + | |
54 | + /** | |
55 | + * | |
56 | + * @param createVO | |
57 | + * @return | |
58 | + */ | |
59 | + ServerResult getBackRefundDate(InvoiceBillCreateVO createVO); | |
60 | + | |
61 | + /** | |
62 | + * 更新扣款信息 | |
63 | + * | |
64 | + * @param deductInfoVO 数据VO | |
65 | + * @return 编辑结果 | |
66 | + */ | |
67 | + ServerResult updateDeductInfo(InvoiceBillDeductInfoVO deductInfoVO); | |
68 | + | |
69 | + /** | |
70 | + * 更新其他金额信息 | |
71 | + * | |
72 | + * @param amountInfoVO | |
73 | + * @return | |
74 | + */ | |
75 | + ServerResult updateAmountInfo(InvoiceBillAmountInfoVO amountInfoVO); | |
76 | + | |
77 | + /** | |
78 | + * 提交审核 | |
79 | + * | |
80 | + * @param commitApplyVO | |
81 | + * @return | |
82 | + */ | |
83 | + ServerResult commitApply(InvoiceBillCommitApplyVO commitApplyVO); | |
84 | + | |
85 | + /** | |
86 | + * 通过主键删除数据 | |
87 | + * | |
88 | + * @param invoiceBillOrderQueryVO 筛选条件 | |
89 | + * @return 是否成功 | |
90 | + */ | |
91 | + ServerResult deleteById(InvoiceBillOrderQueryVO invoiceBillOrderQueryVO); | |
92 | + | |
93 | + /** | |
94 | + * 通过主键得到扣款信息。 | |
95 | + * | |
96 | + * @param invoiceBillOrderQueryVO 筛选条件 | |
97 | + * @return 是否成功 | |
98 | + */ | |
99 | + ServerResult getDeductUrlById(InvoiceBillOrderQueryVO invoiceBillOrderQueryVO); | |
100 | + /** | |
101 | + * 重新更新报关单 | |
102 | + * | |
103 | + * @param bgUrl | |
104 | + * @return 是否成功 | |
105 | + */ | |
106 | + ServerResult reUploadBgurl(InvoiceBillCreateVO bgUrl); | |
107 | + | |
108 | + /** | |
109 | + * 导出审核收款单数据。 | |
110 | + * | |
111 | + * @param queryVO | |
112 | + * @return 是否成功 | |
113 | + */ | |
114 | + ServerResult exportReceipt(HttpServletResponse response,InvoiceBillOrderDO queryVO) throws IOException; | |
115 | + | |
116 | + List<InvoiceBillOrderDO> getOverEvnetList(); | |
117 | + | |
118 | +} | ... | ... |
src/main/java/com/order/erp/service/order/ProducePaymentCheckBillOrderService.java
0 → 100644
1 | +package com.order.erp.service.order; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.order.ProducePaymentCheckBillOrderDO; | |
6 | +import com.order.erp.domain.vo.order.*; | |
7 | + | |
8 | +import javax.servlet.http.HttpServletResponse; | |
9 | +import java.io.IOException; | |
10 | +import java.util.List; | |
11 | + | |
12 | +/** | |
13 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)表服务接口 | |
14 | + * | |
15 | + * @author makejava | |
16 | + * @since 2024-08-05 16:26:35 | |
17 | + */ | |
18 | +public interface ProducePaymentCheckBillOrderService extends IService<ProducePaymentCheckBillOrderDO> { | |
19 | + | |
20 | + /** | |
21 | + * 分页查询 | |
22 | + * | |
23 | + * @param queryVO 筛选条件 | |
24 | + * @return 查询结果 | |
25 | + */ | |
26 | + ServerResult listByPage(ProducePaymentCheckBillOrderQueryVO queryVO); | |
27 | + | |
28 | + /** | |
29 | + * 基础订单查询 | |
30 | + * | |
31 | + * @param queryVO | |
32 | + * @return | |
33 | + */ | |
34 | + ServerResult listBaseOrderInfoBy(ProducePaymentBaseOrderQueryVO queryVO); | |
35 | + | |
36 | + /** | |
37 | + * 分析列表 | |
38 | + * | |
39 | + * @param analysisVO | |
40 | + * @return | |
41 | + */ | |
42 | + ServerResult listAnalysisBy(ProducePaymentCheckBillOrderQueryVO analysisVO); | |
43 | + | |
44 | + /** | |
45 | + * | |
46 | + * @param analysisVO | |
47 | + * @return | |
48 | + */ | |
49 | + ServerResult export(HttpServletResponse response, ProducePaymentCheckBillOrderQueryVO analysisVO) throws IOException; | |
50 | + | |
51 | + /** | |
52 | + * 创建生产科应付单据 | |
53 | + * | |
54 | + * @param createVO 数据VO | |
55 | + * @return 新增结果 | |
56 | + */ | |
57 | + ServerResult create(ProducePaymentCheckBillCreateVO createVO); | |
58 | + | |
59 | + /** | |
60 | + * 获取生产科应回款日期 | |
61 | + * | |
62 | + * @param createVO | |
63 | + * @return | |
64 | + */ | |
65 | + ServerResult getPayedDate(ProducePaymentCheckBillCreateVO createVO); | |
66 | + | |
67 | + /** | |
68 | + * 更新扣款信息 | |
69 | + * | |
70 | + * @param deductInfoVO 数据VO | |
71 | + * @return 编辑结果 | |
72 | + */ | |
73 | + ServerResult updateDeductInfo(ProducePaymentCheckBillDeductInfoVO deductInfoVO); | |
74 | + | |
75 | + /** | |
76 | + * 更新其他金额信息 | |
77 | + * | |
78 | + * @param amountInfoVO | |
79 | + * @return | |
80 | + */ | |
81 | + ServerResult updateAmountInfo(ProducePaymentCheckBillAmountInfoVO amountInfoVO); | |
82 | + | |
83 | + /** | |
84 | + * 更新发票信息 | |
85 | + * | |
86 | + * @param invoiceInfoVO | |
87 | + * @return | |
88 | + */ | |
89 | + ServerResult updateInvoiceInfo(ProducePaymentCheckBillInvoiceInfoVO invoiceInfoVO); | |
90 | + | |
91 | + /** | |
92 | + * @param commitApplyVO | |
93 | + * @return | |
94 | + */ | |
95 | + ServerResult commitApply(ProducePaymentCheckBillCommitApplyVO commitApplyVO); | |
96 | + | |
97 | + /** | |
98 | + * 通过主键删除数据 | |
99 | + * | |
100 | + * @param producePaymentCheckBillOrderQueryVO 筛选条件 | |
101 | + * @return 是否成功 | |
102 | + */ | |
103 | + ServerResult deleteById(ProducePaymentCheckBillOrderQueryVO producePaymentCheckBillOrderQueryVO); | |
104 | + | |
105 | + ServerResult getDeductUrlById(ProducePaymentCheckBillOrderQueryVO producePaymentCheckBillOrderQueryVO); | |
106 | + | |
107 | + ServerResult getInvoiceUrlById(ProducePaymentCheckBillOrderQueryVO producePaymentCheckBillOrderQueryVO); | |
108 | + ServerResult exportReceipt(HttpServletResponse response, ProducePaymentCheckBillOrderDO queryVO) throws IOException; | |
109 | + | |
110 | + List<ProducePaymentCheckBillOrderDO> getOverEventList(); | |
111 | +} | ... | ... |
src/main/java/com/order/erp/service/order/impl/CalculateProfitServiceImpl.java
0 → 100644
1 | +package com.order.erp.service.order.impl; | |
2 | + | |
3 | +import com.alibaba.fastjson.JSONObject; | |
4 | +import com.alibaba.fastjson.TypeReference; | |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
6 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
7 | +import com.order.erp.common.constant.Constant; | |
8 | +import com.order.erp.common.constant.ServerResult; | |
9 | +import com.order.erp.common.exception.BusinessException; | |
10 | +import com.order.erp.common.utils.DateUtils; | |
11 | +import com.order.erp.common.utils.EasyPdfUtils; | |
12 | +import com.order.erp.domain.dto.BaseDO; | |
13 | +import com.order.erp.domain.dto.SystemSettingDO; | |
14 | +import com.order.erp.domain.dto.order.OrderBaseInfoDO; | |
15 | +import com.order.erp.domain.dto.order.OrderProfitAnalysisDO; | |
16 | +import com.order.erp.domain.vo.CostSettingItemVO; | |
17 | +import com.order.erp.domain.vo.order.BusinessProfitRatioQueryVO; | |
18 | +import com.order.erp.domain.vo.order.BusinessProfitRatioResultVO; | |
19 | +import com.order.erp.domain.vo.order.InnerProfitRatioQueryVO; | |
20 | +import com.order.erp.domain.vo.order.InnerProfitRatioResultVO; | |
21 | +import com.order.erp.service.SystemSettingService; | |
22 | +import com.order.erp.service.order.OrderBaseInfoService; | |
23 | +import lombok.extern.slf4j.Slf4j; | |
24 | +import org.apache.poi.ss.usermodel.*; | |
25 | +import org.apache.poi.ss.util.CellRangeAddress; | |
26 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
27 | +import org.springframework.beans.BeanUtils; | |
28 | +import org.springframework.stereotype.Service; | |
29 | + | |
30 | +import javax.annotation.Resource; | |
31 | +import javax.servlet.http.HttpServletResponse; | |
32 | +import java.io.IOException; | |
33 | +import java.math.BigDecimal; | |
34 | +import java.math.RoundingMode; | |
35 | +import java.util.List; | |
36 | +import java.util.Objects; | |
37 | +import java.util.Set; | |
38 | +import java.util.function.Function; | |
39 | +import java.util.stream.Collectors; | |
40 | + | |
41 | +/** | |
42 | + * @author: xms | |
43 | + * @description: TODO | |
44 | + * @date: 2024/8/26 16:17 | |
45 | + * @version: 1.0 | |
46 | + */ | |
47 | +@Slf4j | |
48 | +@Service | |
49 | +public class CalculateProfitServiceImpl { | |
50 | + | |
51 | + | |
52 | + @Resource | |
53 | + private OrderBaseInfoService orderBaseInfoService; | |
54 | + | |
55 | + @Resource | |
56 | + private OrderProfitAnalysisServiceImpl orderProfitAnalysisService; | |
57 | + | |
58 | + @Resource | |
59 | + private EasyPdfUtils pdfUtils; | |
60 | + @Resource | |
61 | + private SystemSettingService systemSettingService; | |
62 | + | |
63 | + /** | |
64 | + * @param response | |
65 | + * @param queryVO | |
66 | + * @return | |
67 | + */ | |
68 | + public ServerResult businessProfitRatioExport(HttpServletResponse response, BusinessProfitRatioQueryVO queryVO) throws IOException { | |
69 | + BusinessProfitRatioResultVO resultVO = buildBusinessProfitRatioResultVO(queryVO); | |
70 | +// File file = pdfUtils.createBusinessProfitResultPdf(resultVO, "business_profit_ratio.pdf"); | |
71 | +// FileUtil.downloadFile(request, response, file, true); | |
72 | + //开始 | |
73 | + Workbook workbook = new XSSFWorkbook(); | |
74 | + Sheet sheet = workbook.createSheet("业务净利润分析表"); | |
75 | + Row row = sheet.createRow(0); | |
76 | + Cell cell = row.createCell(0); | |
77 | + cell.setCellValue("业务净利润分析表"); | |
78 | + sheet.setMargin(sheet.LeftMargin,0.5); | |
79 | + sheet.setMargin(sheet.RightMargin,0.5); | |
80 | + | |
81 | + CellStyle titleStyle = workbook.createCellStyle(); | |
82 | + Font titleFont = workbook.createFont(); | |
83 | + titleFont.setFontHeightInPoints((short) 26); // 字体大小 | |
84 | + titleFont.setBold(true); // 加粗 | |
85 | + titleFont.setFontName("等线"); | |
86 | + titleStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中 | |
87 | + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中 | |
88 | + // 合并单元格(第一行的第一列到第三列) | |
89 | + sheet.addMergedRegion(new CellRangeAddress(0, 3, 0, 9)); | |
90 | + titleStyle.setFont(titleFont); | |
91 | + cell.setCellStyle(titleStyle); | |
92 | + | |
93 | + // 第二行 | |
94 | + createMergedCell(sheet, workbook, 4, 0, 4, 5, 0, 1, "项目号"); | |
95 | + createMergedCell(sheet, workbook, 4, 2, 4, 5, 2, 4, String.join(",",resultVO.getProjectNo())); | |
96 | + createMergedCell(sheet, workbook, 4, 5, 4, 5, 5, 6, "开始时间"); | |
97 | + createMergedCell(sheet, workbook, 4, 7, 4, 5, 7, 9, "结束时间"); | |
98 | +// 第三行 | |
99 | + createMergedCell(sheet, workbook, 6, 0, 6, 7, 0, 1, ""); | |
100 | + createMergedCell(sheet, workbook, 6, 2, 6, 7, 2, 4, "项目开始时间"); | |
101 | + createMergedCell(sheet, workbook, 6, 5, 6, 7, 5, 6, resultVO.getProjectStartTime()); | |
102 | + createMergedCell(sheet, workbook, 6, 7, 6, 7, 7, 9, resultVO.getProjectEndTime()); | |
103 | + | |
104 | +// 第四行 | |
105 | + createMergedCell(sheet, workbook, 8, 0, 8, 9, 0, 1, ""); | |
106 | + createMergedCell(sheet, workbook, 8, 2, 8, 9, 2, 4, "生产进行时间"); | |
107 | + createMergedCell(sheet, workbook, 8, 5, 8, 9, 5, 6, resultVO.getProduceStartTime()); | |
108 | + createMergedCell(sheet, workbook, 8, 7, 8, 9, 7, 9, resultVO.getProduceEndTime()); | |
109 | +//第五行 | |
110 | + createMergedCell(sheet, workbook, 10, 0, 10, 11, 0, 1, "客户编码"); | |
111 | + createMergedCell(sheet, workbook, 10, 2, 10, 11, 2, 4, resultVO.getCustomerCode()); | |
112 | + createMergedCell(sheet, workbook, 10, 5, 10, 11, 5, 6, ""); | |
113 | + createMergedCell(sheet, workbook, 10, 7, 10, 11, 7, 9, "备注"); | |
114 | +//第六行 | |
115 | + createMergedCell(sheet, workbook, 12, 0, 12, 13, 0, 4, "客户总金额计算"); | |
116 | + createMergedCell(sheet, workbook, 12, 5, 12, 13, 5, 6, "¥"+resultVO.getCustomerTotalPrice()); | |
117 | + createMergedCell(sheet, workbook, 12, 9, 12, 13, 7, 9, ""); | |
118 | +////第七行 | |
119 | + createMergedCell(sheet, workbook, 14, 0, 14, 15, 0, 4, "生产科总价合计"); | |
120 | + createMergedCell(sheet, workbook, 14, 5, 14, 15, 5, 6, "¥"+resultVO.getProductionDepartmentTotalPrice()); | |
121 | + createMergedCell(sheet, workbook, 14, 7, 14, 15, 7, 9, ""); | |
122 | +////第八行 | |
123 | + createMergedCell(sheet, workbook, 16, 0, 16, 17, 0, 4, "包装费用合计"); | |
124 | + createMergedCell(sheet, workbook, 16, 5, 16, 17, 5, 6, "¥"+resultVO.getPacketTotalPrice()); | |
125 | + createMergedCell(sheet, workbook, 16, 7, 16, 17, 7, 9, ""); | |
126 | +////第九行 | |
127 | + createMergedCell(sheet, workbook, 18, 0, 18, 19, 0, 4, "研发开发费合计"); | |
128 | + createMergedCell(sheet, workbook, 18, 5, 18, 19, 5, 6, "¥"+resultVO.getDevelopTotalPrice().setScale(2, RoundingMode.HALF_UP)); | |
129 | + createMergedCell(sheet, workbook, 18, 7, 18, 19, 7, 9, ""); | |
130 | +////第十行 | |
131 | + createMergedCell(sheet, workbook, 20, 0, 20, 21, 0, 4, "复制费用合计"); | |
132 | + createMergedCell(sheet, workbook, 20, 5, 20, 21, 5, 6, "¥"+resultVO.getCopyTotalPrice().setScale(2, RoundingMode.HALF_UP)); | |
133 | + createMergedCell(sheet, workbook, 20, 7, 20, 21, 7, 9, ""); | |
134 | +//第十一行 | |
135 | + createMergedCell(sheet, workbook, 22, 0, 22, 23, 0, 4, "固定成本"); | |
136 | + createMergedCell(sheet, workbook, 22, 5, 22, 23, 5, 6, "¥"+resultVO.getFixCost()); | |
137 | + createMergedCell(sheet, workbook, 22, 7, 22, 23, 7, 9, ""); | |
138 | +//第十二行 | |
139 | + createMergedCell(sheet, workbook, 24, 0, 24, 25, 0, 4, "西班牙提成"); | |
140 | + createMergedCell(sheet, workbook, 24, 5, 24, 25, 5, 6, "¥"+resultVO.getSpainRatioProfitPrice()); | |
141 | + createMergedCell(sheet, workbook, 24, 7, 24, 25, 7, 9, ""); | |
142 | +//第十三行 | |
143 | + createMergedCell(sheet, workbook, 26, 0, 26, 27, 0, 4, "中国团队提成"); | |
144 | + createMergedCell(sheet, workbook, 26, 5, 26, 27, 5, 6, "¥"+resultVO.getChinaRatioProfitPrice()); | |
145 | + createMergedCell(sheet, workbook, 26, 7, 26, 27, 7, 9, ""); | |
146 | + //第十四行 | |
147 | + createMergedCell(sheet, workbook, 28, 0, 28, 29, 0, 4, "支出合计"); | |
148 | + createMergedCell(sheet, workbook, 28, 5, 28, 29, 5, 6, "¥"+resultVO.getOutTotalPrice()); | |
149 | + createMergedCell(sheet, workbook, 28, 7, 28, 29, 7, 9, ""); | |
150 | +//第十五行 | |
151 | + createMergedCell(sheet, workbook, 30, 0, 30, 31, 0, 4, "毛利润"); | |
152 | + createMergedCell(sheet, workbook, 30, 5, 30, 31, 5, 6, "¥"+resultVO.getGrossProfit()); | |
153 | + createMergedCell(sheet, workbook, 30, 7, 30, 31, 7, 9, ""); | |
154 | +////第十六行 | |
155 | + createMergedCell(sheet, workbook, 32, 0, 32, 33, 0, 4, "研发贸易净利润"); | |
156 | + createMergedCell(sheet, workbook, 32, 5, 32, 33, 5, 6, "¥"+resultVO.getDevelopProfit()); | |
157 | + createMergedCell(sheet, workbook, 32, 7, 32, 33, 7, 9, ""); | |
158 | +////第十七行 | |
159 | + createMergedCell(sheet, workbook, 34, 0, 34, 35, 0, 4, "包装费用合计金额"); | |
160 | + createMergedCell(sheet, workbook, 34, 5, 34, 35, 5, 6, "¥"+resultVO.getPacketTotalPrice()); | |
161 | + createMergedCell(sheet, workbook, 34, 7, 34, 35, 7, 9, ""); | |
162 | +////第十八行 | |
163 | + createMergedCell(sheet, workbook, 36, 0, 36, 37, 0, 4, "包装费用实际金额"); | |
164 | + createMergedCell(sheet, workbook, 36, 5, 36, 37, 5, 6, "¥"+resultVO.getPacketActualTotalPrice().setScale(2, RoundingMode.HALF_UP)); | |
165 | + createMergedCell(sheet, workbook, 36, 7, 36, 37, 7, 9, ""); | |
166 | +////第十九行 | |
167 | + createMergedCell(sheet, workbook, 38, 0, 38, 39, 0, 4, "订单总数量"); | |
168 | + createMergedCell(sheet, workbook, 38, 5, 38, 39, 5, 6, String.valueOf(resultVO.getOrderCount())); | |
169 | + createMergedCell(sheet, workbook, 38, 7, 38, 39, 7, 9, ""); | |
170 | +////第二十行 | |
171 | + createMergedCell(sheet, workbook, 40, 0, 40, 41, 0, 4, "实际跟单单价=实际跟单费用/件数"); | |
172 | + createMergedCell(sheet, workbook, 40, 5, 40, 41, 5, 6, "¥"+resultVO.getActualRmbPrice()); | |
173 | + createMergedCell(sheet, workbook, 40, 7, 40, 41, 7, 9, ""); | |
174 | +//第二十一行 | |
175 | + createMergedCell(sheet, workbook, 42, 0, 42, 43, 0, 4, "实际跟单单价折算美金"); | |
176 | + createMergedCell(sheet, workbook, 42, 5, 42, 43, 5, 6, "$"+resultVO.getActualPrice()); | |
177 | + createMergedCell(sheet, workbook, 42, 7, 42, 43, 7, 9, ""); | |
178 | +//第二十二行 | |
179 | + createMergedCell(sheet, workbook, 44, 0, 44, 45, 0, 4, "包装费用收益"); | |
180 | + createMergedCell(sheet, workbook, 44, 5, 44, 45, 5, 6, "¥"+resultVO.getPacketProfitPrice()); | |
181 | + createMergedCell(sheet, workbook, 44, 7, 44, 45, 7, 9, ""); | |
182 | +//第二十三行 | |
183 | + createMergedCell(sheet, workbook, 46, 0, 46, 47, 0, 4, "实际汇率"); | |
184 | + createMergedCell(sheet, workbook, 46, 5, 46, 47, 5, 6, "¥"+resultVO.getActualRatio().setScale(2, RoundingMode.HALF_UP)); | |
185 | + createMergedCell(sheet, workbook, 46, 7, 46, 47, 7, 9, ""); | |
186 | +//第二十四行 | |
187 | + createMergedCell(sheet, workbook, 48, 0, 48, 49, 0, 4, "汇率收益"); | |
188 | + createMergedCell(sheet, workbook, 48, 5, 48, 49, 5, 6, "¥"+resultVO.getActualRatioProfitPrice()); | |
189 | + createMergedCell(sheet, workbook, 48, 7, 48, 49, 7, 9, ""); | |
190 | +//第二十五行 | |
191 | + createMergedCell(sheet, workbook, 50, 0, 50, 51, 0, 4, "综合收益"); | |
192 | + createMergedCell(sheet, workbook, 50, 5, 50, 51, 5, 6, "¥"+resultVO.getTotalProfitPrice()); | |
193 | + createMergedCell(sheet, workbook, 50, 7, 50, 51, 7, 9, ""); | |
194 | + response.setHeader("Content-Disposition", "attachment; filename=\"-.xlsx\""); | |
195 | + workbook.write(response.getOutputStream()); | |
196 | + workbook.close(); | |
197 | + //结束 | |
198 | + return ServerResult.success(); | |
199 | + } | |
200 | + | |
201 | + /** | |
202 | + * @param response | |
203 | + * @param queryVO | |
204 | + * @return | |
205 | + */ | |
206 | + public ServerResult innerProfitRatioExport(HttpServletResponse response,InnerProfitRatioQueryVO queryVO) throws IOException { | |
207 | + InnerProfitRatioResultVO resultVO = buildInnerProfitRatioResultVO(queryVO); | |
208 | +// File file = pdfUtils.createInnerProfitResultPdf(resultVO, "inner_profit_ratio.pdf"); | |
209 | +// FileUtil.downloadFile(request, response, file, true); | |
210 | +////开始 | |
211 | +//结束 | |
212 | + Workbook workbook = new XSSFWorkbook(); | |
213 | + Sheet sheet = workbook.createSheet("内部生产净利润分析表"); | |
214 | + Row row = sheet.createRow(0); | |
215 | + Cell cell = row.createCell(0); | |
216 | + cell.setCellValue("内部生产净利润分析表"); | |
217 | + | |
218 | + CellStyle titleStyle = workbook.createCellStyle(); | |
219 | + Font titleFont = workbook.createFont(); | |
220 | + titleFont.setFontHeightInPoints((short) 26); // 字体大小 | |
221 | + titleFont.setBold(true); // 加粗 | |
222 | + titleFont.setFontName("等线"); | |
223 | + titleStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中 | |
224 | + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中 | |
225 | + // 合并单元格(第一行的第一列到第三列) | |
226 | + sheet.addMergedRegion(new CellRangeAddress(0, 3, 0, 10)); | |
227 | + titleStyle.setFont(titleFont); | |
228 | + cell.setCellStyle(titleStyle); | |
229 | + | |
230 | + // 第二行 | |
231 | + createMergedCell(sheet, workbook, 4, 0, 4, 5, 0, 1, "项目号"); | |
232 | + createMergedCell(sheet, workbook, 4, 2, 4, 5, 2, 3, resultVO.getProjectNo()); | |
233 | + createMergedCell(sheet, workbook, 4, 4, 4, 5, 4, 5, "开始时间"); | |
234 | + createMergedCell(sheet, workbook, 4, 6, 4, 5, 6, 7, "结束时间"); | |
235 | + createMergedCell(sheet, workbook, 4, 8,4, 5, 8, 10, "生产持续时间"); | |
236 | +// 第三行 | |
237 | + createMergedCell(sheet, workbook, 6, 0, 6, 7, 0, 1, ""); | |
238 | + createMergedCell(sheet, workbook, 6, 2, 6, 7, 2, 3, "项目开发时间"); | |
239 | + createMergedCell(sheet, workbook, 6, 4, 6, 7, 4, 5, resultVO.getProjectStartTime()); | |
240 | + createMergedCell(sheet, workbook, 6, 6, 6, 7, 6, 7, resultVO.getProjectEndTime()); | |
241 | + createMergedCell(sheet, workbook, 6, 8, 6, 7, 8, 10, String.valueOf(resultVO.getProjectDays())); | |
242 | + | |
243 | +// 第四行 | |
244 | + createMergedCell(sheet, workbook, 8, 0, 8, 9, 0, 1, "客户编码"); | |
245 | + createMergedCell(sheet, workbook, 8, 2, 8, 9, 2, 3, resultVO.getCustomerCode()); | |
246 | + createMergedCell(sheet, workbook, 8, 4, 8, 9, 4, 5, "明细"); | |
247 | + createMergedCell(sheet, workbook, 8, 6, 8, 9, 6, 7, "金额"); | |
248 | + createMergedCell(sheet, workbook, 8, 8, 8, 9, 8, 10, "订单数量"); | |
249 | +//第五行 | |
250 | + createMergedCell(sheet, workbook, 10, 0, 10, 11, 0, 3, "生产科总价合计"); | |
251 | + createMergedCell(sheet, workbook, 10, 4, 10, 11, 4, 5, "¥"+ resultVO.getProductionDepartmentTotalPrice()); | |
252 | + createMergedCell(sheet, workbook, 10, 6, 10, 11, 6, 7, "¥"+ resultVO.getProductionDepartmentTotalPrice()); | |
253 | + createMergedCell(sheet, workbook, 10, 8, 10, 11, 8, 10, String.valueOf(resultVO.getOrderCount())); | |
254 | +//第六行 | |
255 | + createMergedCell(sheet, workbook, 12, 0, 12, 13, 0, 3, "生产科预算金额"); | |
256 | + createMergedCell(sheet, workbook, 12, 4, 12, 13, 4, 5, "¥"+ resultVO.getProductionDepartmentPredictPrice().setScale(2, BigDecimal.ROUND_HALF_UP)); | |
257 | + createMergedCell(sheet, workbook, 12, 6, 12, 13, 6, 7, "预算占比"); | |
258 | + createMergedCell(sheet, workbook, 12, 8, 12, 13, 8, 10, "预算占比与实际占比差"); | |
259 | +//第七行 | |
260 | + createMergedCell(sheet, workbook, 14, 0, 14, 15, 0, 3, "实际发生费用"); | |
261 | + createMergedCell(sheet, workbook, 14, 4, 14, 15, 4, 5, "¥"+ resultVO.getProductionActualPrice().setScale(2, BigDecimal.ROUND_HALF_UP)); | |
262 | + createMergedCell(sheet, workbook, 14, 6, 14, 15, 6, 7, (resultVO.getPredictRatio())+"%"); | |
263 | + createMergedCell(sheet, workbook, 14, 8, 14, 15, 8, 10, (resultVO.getPredictAndActualRatio())+"%"); | |
264 | +//第八行 | |
265 | + createMergedCell(sheet, workbook, 16, 0, 16, 17, 0, 3, "内部生产毛利润"); | |
266 | + createMergedCell(sheet, workbook, 16, 4, 16, 17, 4, 5, "¥"+ resultVO.getGrossProfit()); | |
267 | + createMergedCell(sheet, workbook, 16, 6, 16, 17, 6, 7, ""); | |
268 | + createMergedCell(sheet, workbook, 16, 8, 16, 17, 8, 10, ""); | |
269 | +//第九行 | |
270 | + createMergedCell(sheet, workbook, 18, 0, 18, 19, 0, 3, "内部生产固定成本"); | |
271 | + createMergedCell(sheet, workbook, 18, 4, 18, 19, 4, 5, "¥"+ resultVO.getInnerProduceFixProfit()); | |
272 | + createMergedCell(sheet, workbook, 18, 6, 18, 19, 6, 7, ""); | |
273 | + createMergedCell(sheet, workbook, 18, 8, 18, 19, 8, 10, ""); | |
274 | +//第十行 | |
275 | + createMergedCell(sheet, workbook, 20, 0, 20, 21, 0, 3, "内部生产提成"); | |
276 | + createMergedCell(sheet, workbook, 20, 4, 20, 21, 4, 5, "¥"+ resultVO.getInnerProduceTotalPrice()); | |
277 | + createMergedCell(sheet, workbook, 20, 6, 20, 21, 6, 7, ""); | |
278 | + createMergedCell(sheet, workbook, 20, 8, 20, 21, 8, 10, ""); | |
279 | + //第十一行 | |
280 | + createMergedCell(sheet, workbook, 22, 0, 22, 23, 0, 3, "内部生产净利润"); | |
281 | + createMergedCell(sheet, workbook, 22, 4, 22, 23, 4, 5, "¥"+ resultVO.getInnerProduceTotalProfit()); | |
282 | + createMergedCell(sheet, workbook, 22, 6, 22, 23, 6, 7, ""); | |
283 | + createMergedCell(sheet, workbook, 22, 8, 22, 23, 8, 10, ""); | |
284 | + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8"); | |
285 | + response.setHeader("Content-Disposition", "attachment; filename=\"-.xlsx\""); | |
286 | + workbook.write(response.getOutputStream()); | |
287 | + workbook.close(); | |
288 | + return ServerResult.success(); | |
289 | + } | |
290 | + public void createMergedCell(Sheet sheet, Workbook workbook, int rowIndex, int colIndex, int startRow, int endRow, int startCol, int endCol, String value) { | |
291 | + // 创建或获取当前行 | |
292 | + Row row = sheet.getRow(rowIndex); | |
293 | + if (row == null) { | |
294 | + row = sheet.createRow(rowIndex); | |
295 | + } | |
296 | + | |
297 | + // 创建第一个单元格并设置值 | |
298 | + Cell cell = row.createCell(colIndex); | |
299 | + cell.setCellValue(value); | |
300 | + | |
301 | + // 创建边框样式 | |
302 | + CellStyle titleStyle = workbook.createCellStyle(); | |
303 | + Font titleFont = workbook.createFont(); | |
304 | + titleFont.setFontHeightInPoints((short) 14); // 字体大小 | |
305 | + titleFont.setBold(true); // 加粗 | |
306 | + titleFont.setFontName("等线"); | |
307 | + titleStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中 | |
308 | + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中 | |
309 | + titleStyle.setFont(titleFont); | |
310 | + | |
311 | + // 设置边框样式 | |
312 | + titleStyle.setBorderTop(BorderStyle.THIN); | |
313 | + titleStyle.setBorderBottom(BorderStyle.THIN); | |
314 | + titleStyle.setBorderLeft(BorderStyle.THIN); | |
315 | + titleStyle.setBorderRight(BorderStyle.THIN); | |
316 | + | |
317 | + // 应用样式到第一个单元格 | |
318 | + cell.setCellStyle(titleStyle); | |
319 | + | |
320 | + // 合并单元格 | |
321 | + sheet.addMergedRegion(new CellRangeAddress(startRow, endRow, startCol, endCol)); | |
322 | + | |
323 | + // 为合并区域的每个单元格设置相同的样式 | |
324 | + for (int rowIndexCurrent = startRow; rowIndexCurrent <= endRow; rowIndexCurrent++) { | |
325 | + for (int colIndexCurrent = startCol; colIndexCurrent <= endCol; colIndexCurrent++) { | |
326 | + Row currentRow = sheet.getRow(rowIndexCurrent); | |
327 | + if (currentRow == null) { | |
328 | + currentRow = sheet.createRow(rowIndexCurrent); | |
329 | + } | |
330 | + Cell currentCell = currentRow.getCell(colIndexCurrent); | |
331 | + if (currentCell == null) { | |
332 | + currentCell = currentRow.createCell(colIndexCurrent); | |
333 | + } | |
334 | + // 只为合并区域内的单元格设置样式 | |
335 | + if (rowIndexCurrent == startRow && colIndexCurrent == colIndex) { | |
336 | + currentCell.setCellStyle(titleStyle); // 为合并的单元格设置样式 | |
337 | + } else { | |
338 | + currentCell.setCellStyle(titleStyle); // 为其他合并的单元格设置样式 | |
339 | + } | |
340 | + } | |
341 | + } | |
342 | + } | |
343 | + | |
344 | + | |
345 | + | |
346 | + /** | |
347 | + * 业务/研发净利润分析 | |
348 | + * | |
349 | + * @param queryVO | |
350 | + * @return | |
351 | + */ | |
352 | + public ServerResult businessProfitRatio(BusinessProfitRatioQueryVO queryVO) { | |
353 | + BusinessProfitRatioResultVO resultVO = buildBusinessProfitRatioResultVO(queryVO); | |
354 | + return ServerResult.success(resultVO); | |
355 | + } | |
356 | + //都为人民币。 | |
357 | + private BusinessProfitRatioResultVO buildBusinessProfitRatioResultVO(BusinessProfitRatioQueryVO queryVO) { | |
358 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(queryVO.getIds()); | |
359 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
360 | + throw new BusinessException("订单数量为空"); | |
361 | + } | |
362 | + Set<Long> orderIds = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getId).collect(Collectors.toSet()); | |
363 | + List<OrderProfitAnalysisDO> profitAnalysisList = orderProfitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
364 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
365 | + .in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
366 | + List<OrderProfitAnalysisDO> profitAnalysisDOS = profitAnalysisList.stream() | |
367 | + .collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (existing, replacement) -> existing)) | |
368 | + .values() | |
369 | + .stream() | |
370 | + .collect(Collectors.toList()); | |
371 | + if(CollectionUtils.isEmpty(profitAnalysisList) ||orderIds.size()!= profitAnalysisDOS.size()){ | |
372 | + throw new BusinessException("勾选订单的利润信息未填写!"); | |
373 | + } | |
374 | +// for(OrderProfitAnalysisDO analysisDO : profitAnalysisList){ | |
375 | +// if(analysisDO.getCustomerPrice()==null){ | |
376 | +// throw new BusinessException("勾选订单的利润信息未填写!"); | |
377 | +// } | |
378 | +// } | |
379 | + int sumCount = orderBaseInfoDOList.stream().mapToInt(OrderBaseInfoDO::getOrderCount).sum(); | |
380 | + Set<String> projectList = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getProjectNo).collect(Collectors.toSet()); | |
381 | + //得到当前汇率。 | |
382 | + BigDecimal exchangeRate = new BigDecimal(systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>() | |
383 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
384 | + .eq(SystemSettingDO::getSettingCode,"exchangeRate") | |
385 | + .last("limit 1")).getSettingValue()); | |
386 | + BigDecimal spainRatioProfitPrice=new BigDecimal(Constant.ZERO); | |
387 | + BigDecimal chinaRatioProfitPrice=new BigDecimal(Constant.ZERO); | |
388 | + BigDecimal customerRmbTotalPrice = new BigDecimal(Constant.ZERO); | |
389 | + BigDecimal productionDepartmentTotalPrice = new BigDecimal(Constant.ZERO); | |
390 | + BigDecimal packetTotalPrice = new BigDecimal(Constant.ZERO); | |
391 | + BigDecimal fixCost = new BigDecimal(Constant.ZERO); | |
392 | + BigDecimal customerTotalPrice = new BigDecimal(Constant.ZERO); | |
393 | + String spainRatio = Constant.ZERO_STRING; | |
394 | + String chainRatio= Constant.ZERO_STRING; | |
395 | + String dailyCost=Constant.ZERO_STRING; | |
396 | + for (OrderProfitAnalysisDO profitAnalysisDO : profitAnalysisDOS) { | |
397 | + customerRmbTotalPrice = customerRmbTotalPrice.add(new BigDecimal(profitAnalysisDO.getCustomerRmbTotalPrice())); | |
398 | + customerTotalPrice=customerTotalPrice.add(new BigDecimal(profitAnalysisDO.getCustomerTotalPrice())); | |
399 | + productionDepartmentTotalPrice = productionDepartmentTotalPrice.add(new BigDecimal(profitAnalysisDO.getProductionDepartmentTotalPrice())); | |
400 | + //这里的包装费用好像为美元。需要采用人民币。 | |
401 | + packetTotalPrice = packetTotalPrice.add(new BigDecimal(profitAnalysisDO.getPacketTotalPrice()).multiply(exchangeRate)); | |
402 | + } | |
403 | + | |
404 | + //根据客户编码得到提成配置。 | |
405 | + SystemSettingDO systemSettingServiceOne = systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>() | |
406 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
407 | + .eq(SystemSettingDO::getSettingType, Constant.THREE) | |
408 | + .eq(SystemSettingDO::getSettingValue, queryVO.getCustomerCode()) | |
409 | + .last("limit 1")); | |
410 | + if(Objects.nonNull(systemSettingServiceOne)){ | |
411 | + //json反序列化。 | |
412 | + List<CostSettingItemVO> costSettingItemVOList = JSONObject.parseObject(systemSettingServiceOne.getRelationValue(), new TypeReference<List<CostSettingItemVO>>() {}); | |
413 | + if( CollectionUtils.isNotEmpty(costSettingItemVOList)){ | |
414 | + for (CostSettingItemVO relation : costSettingItemVOList) { | |
415 | + if ("ratio".equals(relation.getRelationCode())) { | |
416 | + chainRatio = relation.getRelationValue(); | |
417 | + }if ("spainRatio".equals(relation.getRelationCode())) { | |
418 | + spainRatio = relation.getRelationValue(); | |
419 | + }if("fixCost".equals(relation.getRelationCode())){ | |
420 | + dailyCost=relation.getRelationValue(); | |
421 | + } | |
422 | + } | |
423 | + } | |
424 | + } | |
425 | + BigDecimal spainRatioValue = new BigDecimal(spainRatio); | |
426 | + BigDecimal chainRatioValue = new BigDecimal(chainRatio); | |
427 | + //当前系统配置中的提成比例没有配置时,中国和西班牙的金额就会为对应的o。 | |
428 | + spainRatioProfitPrice = spainRatioValue.multiply(customerRmbTotalPrice); | |
429 | + chinaRatioProfitPrice = chainRatioValue.multiply(customerRmbTotalPrice); | |
430 | + BigDecimal dailyCostValue = new BigDecimal(dailyCost); | |
431 | + fixCost = dailyCostValue.multiply(new BigDecimal(getProjectDays(queryVO))); | |
432 | + BigDecimal outTotalPrice = customerRmbTotalPrice.add(productionDepartmentTotalPrice).add(packetTotalPrice) | |
433 | + .add(queryVO.getDevelopTotalPrice()).add(queryVO.getCopyTotalPrice()) | |
434 | + .add(fixCost).add(spainRatioProfitPrice).add(chinaRatioProfitPrice); | |
435 | + BigDecimal developProfit = customerRmbTotalPrice.subtract(outTotalPrice); | |
436 | + BigDecimal packetProfitPrice = packetTotalPrice.subtract(queryVO.getPacketActualTotalPrice()); | |
437 | + BigDecimal actualRatioProfitPrice = queryVO.getActualRatio().subtract(exchangeRate).multiply(customerTotalPrice).setScale(2, BigDecimal.ROUND_HALF_UP); | |
438 | + BigDecimal totalProfitPrice = developProfit.add(actualRatioProfitPrice).add(packetProfitPrice); | |
439 | + BusinessProfitRatioResultVO resultVO = new BusinessProfitRatioResultVO(); | |
440 | + BeanUtils.copyProperties(queryVO, resultVO); | |
441 | + //5 | |
442 | + resultVO.setCustomerTotalPrice(customerRmbTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
443 | + //6 | |
444 | + resultVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
445 | +// resultVO.setPacketTotalPrice(packetTotalPrice.multiply(new BigDecimal(10 )).doubleValue()); | |
446 | + //7 | |
447 | + resultVO.setPacketTotalPrice(packetTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
448 | + resultVO.setPacketTotalPriceCount(packetTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
449 | + //9 如果没有配置固定成本,就会得到0。 | |
450 | + resultVO.setFixCost(fixCost.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
451 | + //10.1 | |
452 | + resultVO.setSpainRatioProfitPrice(spainRatioProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
453 | + //10.2 | |
454 | + resultVO.setChinaRatioProfitPrice(chinaRatioProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
455 | + //11 | |
456 | + resultVO.setOutTotalPrice(outTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
457 | + //13 | |
458 | + resultVO.setDevelopProfit(developProfit.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
459 | + //18 | |
460 | + resultVO.setPacketProfitPrice(packetProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
461 | + //19 | |
462 | + resultVO.setActualRatioProfitPrice(actualRatioProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
463 | + //20 | |
464 | + resultVO.setTotalProfitPrice(totalProfitPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
465 | + // 16 | |
466 | + resultVO.setActualRmbPrice(queryVO.getPacketActualTotalPrice().divide(new BigDecimal(sumCount), 2, BigDecimal.ROUND_HALF_UP)); | |
467 | + resultVO.setActualPrice((resultVO.getActualRmbPrice().divide(exchangeRate,2, BigDecimal.ROUND_HALF_UP))); | |
468 | + resultVO.setOrderCount(sumCount); | |
469 | + //12 | |
470 | + resultVO.setGrossProfit(customerRmbTotalPrice.subtract(productionDepartmentTotalPrice).subtract(packetTotalPrice).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
471 | + resultVO.setProjectNo(String.join(",",projectList)); | |
472 | + return resultVO; | |
473 | + } | |
474 | + | |
475 | + /** | |
476 | + * @param queryVO | |
477 | + * @return | |
478 | + */ | |
479 | + private int getProjectDays(BusinessProfitRatioQueryVO queryVO) { | |
480 | + String projectStartTime = queryVO.getProjectStartTime(); | |
481 | + | |
482 | + String projectEndTime = queryVO.getProjectEndTime(); | |
483 | + | |
484 | + return DateUtils.parseDate(projectEndTime, DateUtils.DATE).getDayOfYear() - DateUtils.parseDate(projectStartTime, DateUtils.DATE).getDayOfYear() + 1; | |
485 | + } | |
486 | + | |
487 | + /** | |
488 | + * @param queryVO | |
489 | + * @return | |
490 | + */ | |
491 | + private int getProjectDays(InnerProfitRatioQueryVO queryVO) { | |
492 | + String projectStartTime = queryVO.getProjectStartTime(); | |
493 | + | |
494 | + String projectEndTime = queryVO.getProjectEndTime(); | |
495 | + | |
496 | + return DateUtils.parseDate(projectEndTime, DateUtils.DATE).getDayOfYear() - DateUtils.parseDate(projectStartTime, DateUtils.DATE).getDayOfYear() + 1; | |
497 | + } | |
498 | + | |
499 | + /** | |
500 | + * | |
501 | + * @param queryVO | |
502 | + * @return | |
503 | + */ | |
504 | + private InnerProfitRatioResultVO buildInnerProfitRatioResultVO(InnerProfitRatioQueryVO queryVO) { | |
505 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(queryVO.getIds()); | |
506 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
507 | + throw new BusinessException("订单数量为空"); | |
508 | + } | |
509 | + Set<Long> orderIds = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getId).collect(Collectors.toSet()); | |
510 | + List<OrderProfitAnalysisDO> profitAnalysisList = orderProfitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
511 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
512 | + .in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
513 | + //避免,订单重复,有多个orderid重复。 | |
514 | + List<OrderProfitAnalysisDO> profitAnalysisDOS = profitAnalysisList.stream() | |
515 | + .collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (existing, replacement) -> existing)) | |
516 | + .values() | |
517 | + .stream() | |
518 | + .collect(Collectors.toList()); | |
519 | + if(CollectionUtils.isEmpty(profitAnalysisList) || orderIds.size()!=profitAnalysisDOS.size()){ | |
520 | + throw new BusinessException("勾选订单的利润信息未填写!"); | |
521 | + } | |
522 | + int sumCount = orderBaseInfoDOList.stream().mapToInt(OrderBaseInfoDO::getOrderCount).sum(); | |
523 | + Set<String> projectNoSet = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getProjectNo).collect(Collectors.toSet()); | |
524 | + BigDecimal customerTotalPrice = new BigDecimal(Constant.ZERO); | |
525 | + BigDecimal productionDepartmentTotalPrice = new BigDecimal(Constant.ZERO); | |
526 | + String dailyCost=Constant.ZERO_STRING; | |
527 | + String price=Constant.ZERO_STRING; | |
528 | + BigDecimal dailyCostValue = new BigDecimal(Constant.ZERO); | |
529 | + BigDecimal priceValue = new BigDecimal(Constant.ZERO); | |
530 | + for (OrderProfitAnalysisDO profitAnalysisDO : profitAnalysisDOS) { | |
531 | + customerTotalPrice = customerTotalPrice.add(new BigDecimal(profitAnalysisDO.getCustomerRmbTotalPrice())); | |
532 | + productionDepartmentTotalPrice = productionDepartmentTotalPrice.add(new BigDecimal(profitAnalysisDO.getProductionDepartmentTotalPrice())); | |
533 | + } | |
534 | + | |
535 | + SystemSettingDO systemSettingServiceOne = systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>() | |
536 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
537 | + .eq(SystemSettingDO::getSettingType, Constant.FOUR) | |
538 | + .eq(SystemSettingDO::getSettingValue, queryVO.getCustomerCode()) | |
539 | + .last("limit 1")); | |
540 | + if(Objects.nonNull(systemSettingServiceOne)){ | |
541 | + //json反序列化。 | |
542 | + List<CostSettingItemVO> costSettingItemVOList = JSONObject.parseObject(systemSettingServiceOne.getRelationValue(), new TypeReference<List<CostSettingItemVO>>() {}); | |
543 | + if( CollectionUtils.isNotEmpty(costSettingItemVOList)){ | |
544 | + for (CostSettingItemVO relation : costSettingItemVOList) { | |
545 | + //这里是系统配置中的得到的,应该是从系统配置中的生产科中得到。 固定成本。 | |
546 | + if("fixCost".equals(relation.getRelationCode())){ | |
547 | + dailyCost=relation.getRelationValue(); | |
548 | + } | |
549 | + //生产提成单价 | |
550 | + if("ratio".equals(relation.getRelationCode())){ | |
551 | + price=relation.getRelationValue(); | |
552 | + } | |
553 | + } | |
554 | + } | |
555 | + } | |
556 | + dailyCostValue = new BigDecimal(dailyCost); | |
557 | + priceValue = new BigDecimal(price); | |
558 | + Integer projectDays = getProjectDays(queryVO); | |
559 | + BigDecimal innerProduceFixProfit = dailyCostValue.multiply(new BigDecimal(projectDays)); | |
560 | + BigDecimal predictRatio=new BigDecimal(Constant.ZERO); | |
561 | + BigDecimal bigDecimal = new BigDecimal("1.05"); | |
562 | + // 10 | |
563 | + BigDecimal innerProduceTotalPrice = new BigDecimal(sumCount).multiply(priceValue); | |
564 | + // 7.1 | |
565 | + if(Objects.nonNull(queryVO.getProductionDepartmentPredictPrice()) ){ | |
566 | + if(queryVO.getProductionDepartmentPredictPrice().compareTo(BigDecimal.ZERO) == 0){ | |
567 | + }else{ | |
568 | + predictRatio = queryVO.getProductionActualPrice() | |
569 | + .divide(queryVO.getProductionDepartmentPredictPrice(),2,BigDecimal.ROUND_HALF_UP); | |
570 | + } | |
571 | + } | |
572 | + //如果大于1.05则就把内部生产提成变为0 | |
573 | + if(predictRatio.compareTo(bigDecimal)>0){ | |
574 | + innerProduceTotalPrice=BigDecimal.ZERO; | |
575 | + } | |
576 | + // 7.2 | |
577 | + BigDecimal predictAndActualRatio = new BigDecimal(Constant.ONE).subtract(predictRatio); | |
578 | + BigDecimal grossProfit = productionDepartmentTotalPrice.subtract(queryVO.getProductionActualPrice()); | |
579 | + BigDecimal innerProduceTotalProfit = productionDepartmentTotalPrice.subtract(queryVO.getProductionActualPrice()).subtract(innerProduceTotalPrice).subtract(innerProduceFixProfit); | |
580 | + | |
581 | + | |
582 | + InnerProfitRatioResultVO resultVO = new InnerProfitRatioResultVO(); | |
583 | + BeanUtils.copyProperties(queryVO, resultVO); | |
584 | + resultVO.setProjectDays(projectDays); | |
585 | + resultVO.setOrderCount(sumCount); | |
586 | + resultVO.setCustomerTotalPrice(customerTotalPrice.setScale(2, RoundingMode.HALF_UP).doubleValue()); | |
587 | + // 5 | |
588 | + resultVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.setScale(2, RoundingMode.HALF_UP)); | |
589 | + // 9 | |
590 | + resultVO.setInnerProduceFixProfit(innerProduceFixProfit.setScale(2, RoundingMode.HALF_UP)); | |
591 | + // 7.1 | |
592 | + resultVO.setPredictRatio(predictRatio.multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)); | |
593 | + // 将计算结果乘以 100,并四舍五入到整数 | |
594 | + resultVO.setPredictAndActualRatio(predictAndActualRatio.multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP)); | |
595 | + // 8 | |
596 | + resultVO.setGrossProfit(grossProfit.setScale(2, RoundingMode.HALF_UP)); | |
597 | + // 10 | |
598 | + resultVO.setInnerProduceTotalPrice(innerProduceTotalPrice.setScale(2, RoundingMode.HALF_UP)); | |
599 | + // 11 | |
600 | + resultVO.setInnerProduceTotalProfit(innerProduceTotalProfit.setScale(2, RoundingMode.HALF_UP)); | |
601 | + //项目号 | |
602 | + resultVO.setProjectNo(String.join(", ", projectNoSet)); | |
603 | + return resultVO; | |
604 | + } | |
605 | + | |
606 | + /** | |
607 | + * 内部生产净利润分析表 | |
608 | + * | |
609 | + * @param queryVO | |
610 | + * @return | |
611 | + */ | |
612 | + public ServerResult innerProfitRatio(InnerProfitRatioQueryVO queryVO) { | |
613 | + InnerProfitRatioResultVO resultVO = buildInnerProfitRatioResultVO(queryVO); | |
614 | + return ServerResult.success(resultVO); | |
615 | + } | |
616 | +} | ... | ... |
src/main/java/com/order/erp/service/order/impl/CheckBillMappingServiceImpl.java
0 → 100644
1 | +package com.order.erp.service.order.impl; | |
2 | + | |
3 | +import cn.hutool.core.bean.BeanUtil; | |
4 | +import cn.hutool.core.collection.CollUtil; | |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
6 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
7 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
8 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
9 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
10 | +import com.order.erp.common.constant.Constant; | |
11 | +import com.order.erp.common.constant.ServerResult; | |
12 | +import com.order.erp.common.utils.PageUtils; | |
13 | +import com.order.erp.domain.dto.order.CheckBillMappingDO; | |
14 | +import com.order.erp.domain.vo.order.CheckBillMappingQueryVO; | |
15 | +import com.order.erp.domain.vo.order.CheckBillMappingVO; | |
16 | +import com.order.erp.mapper.order.CheckBillMappingMapper; | |
17 | +import com.order.erp.service.order.CheckBillMappingService; | |
18 | +import lombok.extern.slf4j.Slf4j; | |
19 | +import org.springframework.stereotype.Service; | |
20 | + | |
21 | +import java.util.List; | |
22 | +import java.util.Objects; | |
23 | + | |
24 | +/** | |
25 | + * 生产科对账单应收账单映射表(CheckBillMapping)表服务实现类 | |
26 | + * | |
27 | + * @author makejava | |
28 | + * @since 2024-08-05 16:26:37 | |
29 | + */ | |
30 | +@Slf4j | |
31 | +@Service | |
32 | +public class CheckBillMappingServiceImpl extends ServiceImpl<CheckBillMappingMapper, CheckBillMappingDO> implements CheckBillMappingService { | |
33 | + | |
34 | + | |
35 | + /** | |
36 | + * 通过ID查询单条数据 | |
37 | + * <p> | |
38 | + * checkBillMappingQueryVO 主键 | |
39 | + * | |
40 | + * @return 实例对象 | |
41 | + */ | |
42 | + @Override | |
43 | + public ServerResult queryById(CheckBillMappingQueryVO checkBillMappingQueryVO) { | |
44 | + if (Objects.isNull(checkBillMappingQueryVO.getId())) { | |
45 | + return ServerResult.fail("id 不能为空"); | |
46 | + } | |
47 | + CheckBillMappingDO CheckBillMappingDo = getById(checkBillMappingQueryVO.getId()); | |
48 | + if (Objects.isNull(CheckBillMappingDo)) { | |
49 | + return ServerResult.success(null); | |
50 | + } | |
51 | + return ServerResult.success(BeanUtil.copyProperties(CheckBillMappingDo, CheckBillMappingVO.class)); | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 分页查询 | |
56 | + * | |
57 | + * @param checkBillMappingQueryVO 筛选条件 | |
58 | + * @return 查询结果 | |
59 | + */ | |
60 | + @Override | |
61 | + public ServerResult list(CheckBillMappingQueryVO checkBillMappingQueryVO) { | |
62 | + | |
63 | + LambdaQueryWrapper<CheckBillMappingDO> queryWapper = new LambdaQueryWrapper<CheckBillMappingDO>() | |
64 | + .eq(CheckBillMappingDO::getEnableFlag, Constant.ENABLE_TEN) | |
65 | + .orderByDesc(CheckBillMappingDO::getId); | |
66 | + Page page = new Page<>(checkBillMappingQueryVO.getPage(), checkBillMappingQueryVO.getPageSize()); | |
67 | + IPage<CheckBillMappingDO> iPage = page(page, queryWapper); | |
68 | + checkBillMappingQueryVO.setTotal(Long.valueOf(iPage.getTotal()).intValue()); | |
69 | + return ServerResult.success(PageUtils.getPageReturn(null, checkBillMappingQueryVO)); | |
70 | + } | |
71 | + | |
72 | + /** | |
73 | + * 新增数据 | |
74 | + * | |
75 | + * @param checkBillMappingVO 实例对象 | |
76 | + * @return 实例对象 | |
77 | + */ | |
78 | + @Override | |
79 | + public ServerResult add(CheckBillMappingVO checkBillMappingVO) { | |
80 | + //todo 校验 | |
81 | + if (Objects.nonNull(checkBillMappingVO.getId())) { | |
82 | + checkBillMappingVO.setId(null); | |
83 | + } | |
84 | + CheckBillMappingDO checkBillMappingDo = BeanUtil.copyProperties(checkBillMappingVO, CheckBillMappingDO.class); | |
85 | + | |
86 | + save(checkBillMappingDo); | |
87 | + | |
88 | + return ServerResult.success(); | |
89 | + } | |
90 | + | |
91 | + /** | |
92 | + * 修改数据 | |
93 | + * | |
94 | + * @param checkBillMappingVO 实例对象 | |
95 | + * @return 实例对象 | |
96 | + */ | |
97 | + @Override | |
98 | + public ServerResult edit(CheckBillMappingVO checkBillMappingVO) { | |
99 | + //todo 校验 | |
100 | + if (Objects.isNull(checkBillMappingVO.getId())) { | |
101 | + return ServerResult.fail("id 不能为空"); | |
102 | + } | |
103 | + CheckBillMappingDO checkBillMappingDo = BeanUtil.copyProperties(checkBillMappingVO, CheckBillMappingDO.class); | |
104 | + | |
105 | + updateById(checkBillMappingDo); | |
106 | + | |
107 | + return ServerResult.success(); | |
108 | + } | |
109 | + | |
110 | + /** | |
111 | + * 通过主键删除数据 | |
112 | + * | |
113 | + * @param checkBillMappingQueryVO 筛选条件 | |
114 | + * @return 是否成功 | |
115 | + */ | |
116 | + @Override | |
117 | + public ServerResult deleteById(CheckBillMappingQueryVO checkBillMappingQueryVO) { | |
118 | + List<Long> ids = checkBillMappingQueryVO.getIds(); | |
119 | + if (CollUtil.isEmpty(ids)) { | |
120 | + return ServerResult.fail("ids 参数不能为空"); | |
121 | + } | |
122 | + List<CheckBillMappingDO> checkBillMappingList = listByIds(ids); | |
123 | + if (CollUtil.isEmpty(checkBillMappingList)) { | |
124 | + return ServerResult.success(); | |
125 | + } | |
126 | + //todo 校验是否可以逻辑删除 | |
127 | + LambdaUpdateWrapper<CheckBillMappingDO> updateWrapper = new LambdaUpdateWrapper<CheckBillMappingDO>() | |
128 | + .in(CheckBillMappingDO::getId, ids) | |
129 | + .set(CheckBillMappingDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
130 | + update(updateWrapper); | |
131 | + return ServerResult.success(); | |
132 | + } | |
133 | +} | ... | ... |
src/main/java/com/order/erp/service/order/impl/InvoiceBillMappingServiceImpl.java
0 → 100644
1 | +package com.order.erp.service.order.impl; | |
2 | + | |
3 | +import cn.hutool.core.bean.BeanUtil; | |
4 | +import cn.hutool.core.collection.CollUtil; | |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
6 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
7 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
8 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
9 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
10 | +import com.order.erp.common.constant.Constant; | |
11 | +import com.order.erp.common.constant.ServerResult; | |
12 | +import com.order.erp.common.utils.PageUtils; | |
13 | +import com.order.erp.domain.dto.order.InvoiceBillMappingDO; | |
14 | +import com.order.erp.domain.vo.order.InvoiceBillMappingQueryVO; | |
15 | +import com.order.erp.domain.vo.order.InvoiceBillMappingVO; | |
16 | +import com.order.erp.mapper.order.InvoiceBillMappingMapper; | |
17 | +import com.order.erp.service.order.InvoiceBillMappingService; | |
18 | +import lombok.extern.slf4j.Slf4j; | |
19 | +import org.springframework.stereotype.Service; | |
20 | + | |
21 | +import java.util.List; | |
22 | +import java.util.Objects; | |
23 | + | |
24 | +/** | |
25 | + * 应收款账单关联订单映射表(InvoiceBillMapping)表服务实现类 | |
26 | + * | |
27 | + * @author makejava | |
28 | + * @since 2024-08-05 16:26:36 | |
29 | + */ | |
30 | +@Slf4j | |
31 | +@Service | |
32 | +public class InvoiceBillMappingServiceImpl extends ServiceImpl<InvoiceBillMappingMapper, InvoiceBillMappingDO> implements InvoiceBillMappingService { | |
33 | + | |
34 | + | |
35 | + /** | |
36 | + * 通过ID查询单条数据 | |
37 | + * <p> | |
38 | + * invoiceBillMappingQueryVO 主键 | |
39 | + * | |
40 | + * @return 实例对象 | |
41 | + */ | |
42 | + @Override | |
43 | + public ServerResult queryById(InvoiceBillMappingQueryVO invoiceBillMappingQueryVO) { | |
44 | + if (Objects.isNull(invoiceBillMappingQueryVO.getId())) { | |
45 | + return ServerResult.fail("id 不能为空"); | |
46 | + } | |
47 | + InvoiceBillMappingDO InvoiceBillMappingDo = getById(invoiceBillMappingQueryVO.getId()); | |
48 | + if (Objects.isNull(InvoiceBillMappingDo)) { | |
49 | + return ServerResult.success(null); | |
50 | + } | |
51 | + return ServerResult.success(BeanUtil.copyProperties(InvoiceBillMappingDo, InvoiceBillMappingVO.class)); | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 分页查询 | |
56 | + * | |
57 | + * @param invoiceBillMappingQueryVO 筛选条件 | |
58 | + * @return 查询结果 | |
59 | + */ | |
60 | + @Override | |
61 | + public ServerResult list(InvoiceBillMappingQueryVO invoiceBillMappingQueryVO) { | |
62 | + | |
63 | + LambdaQueryWrapper<InvoiceBillMappingDO> queryWapper = new LambdaQueryWrapper<InvoiceBillMappingDO>() | |
64 | + .eq(InvoiceBillMappingDO::getEnableFlag, Constant.ENABLE_TEN) | |
65 | + .orderByDesc(InvoiceBillMappingDO::getId); | |
66 | + Page page = new Page<>(invoiceBillMappingQueryVO.getPage(), invoiceBillMappingQueryVO.getPageSize()); | |
67 | + IPage<InvoiceBillMappingDO> iPage = page(page, queryWapper); | |
68 | + invoiceBillMappingQueryVO.setTotal(Long.valueOf(iPage.getTotal()).intValue()); | |
69 | + return ServerResult.success(PageUtils.getPageReturn(null, invoiceBillMappingQueryVO)); | |
70 | + } | |
71 | + | |
72 | + /** | |
73 | + * 新增数据 | |
74 | + * | |
75 | + * @param invoiceBillMappingVO 实例对象 | |
76 | + * @return 实例对象 | |
77 | + */ | |
78 | + @Override | |
79 | + public ServerResult add(InvoiceBillMappingVO invoiceBillMappingVO) { | |
80 | + //todo 校验 | |
81 | + if (Objects.nonNull(invoiceBillMappingVO.getId())) { | |
82 | + invoiceBillMappingVO.setId(null); | |
83 | + } | |
84 | + InvoiceBillMappingDO invoiceBillMappingDo = BeanUtil.copyProperties(invoiceBillMappingVO, InvoiceBillMappingDO.class); | |
85 | + | |
86 | + save(invoiceBillMappingDo); | |
87 | + | |
88 | + return ServerResult.success(); | |
89 | + } | |
90 | + | |
91 | + /** | |
92 | + * 修改数据 | |
93 | + * | |
94 | + * @param invoiceBillMappingVO 实例对象 | |
95 | + * @return 实例对象 | |
96 | + */ | |
97 | + @Override | |
98 | + public ServerResult edit(InvoiceBillMappingVO invoiceBillMappingVO) { | |
99 | + //todo 校验 | |
100 | + if (Objects.isNull(invoiceBillMappingVO.getId())) { | |
101 | + return ServerResult.fail("id 不能为空"); | |
102 | + } | |
103 | + InvoiceBillMappingDO invoiceBillMappingDo = BeanUtil.copyProperties(invoiceBillMappingVO, InvoiceBillMappingDO.class); | |
104 | + | |
105 | + updateById(invoiceBillMappingDo); | |
106 | + | |
107 | + return ServerResult.success(); | |
108 | + } | |
109 | + | |
110 | + /** | |
111 | + * 通过主键删除数据 | |
112 | + * | |
113 | + * @param invoiceBillMappingQueryVO 筛选条件 | |
114 | + * @return 是否成功 | |
115 | + */ | |
116 | + @Override | |
117 | + public ServerResult deleteById(InvoiceBillMappingQueryVO invoiceBillMappingQueryVO) { | |
118 | + List<Long> ids = invoiceBillMappingQueryVO.getIds(); | |
119 | + if (CollUtil.isEmpty(ids)) { | |
120 | + return ServerResult.fail("ids 参数不能为空"); | |
121 | + } | |
122 | + List<InvoiceBillMappingDO> invoiceBillMappingList = listByIds(ids); | |
123 | + if (CollUtil.isEmpty(invoiceBillMappingList)) { | |
124 | + return ServerResult.success(); | |
125 | + } | |
126 | + //todo 校验是否可以逻辑删除 | |
127 | + LambdaUpdateWrapper<InvoiceBillMappingDO> updateWrapper = new LambdaUpdateWrapper<InvoiceBillMappingDO>() | |
128 | + .in(InvoiceBillMappingDO::getId, ids) | |
129 | + .set(InvoiceBillMappingDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
130 | + update(updateWrapper); | |
131 | + return ServerResult.success(); | |
132 | + } | |
133 | +} | ... | ... |
src/main/java/com/order/erp/service/order/impl/InvoiceBillOrderServiceImpl.java
0 → 100644
1 | +package com.order.erp.service.order.impl; | |
2 | + | |
3 | +import cn.hutool.core.collection.CollUtil; | |
4 | +import com.alibaba.fastjson.JSONObject; | |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
6 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
7 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
8 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
9 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
10 | +import com.github.stupdit1t.excel.common.PoiWorkbookType; | |
11 | +import com.github.stupdit1t.excel.core.ExcelHelper; | |
12 | +import com.github.stupdit1t.excel.style.CellPosition; | |
13 | +import com.order.erp.common.constant.Constant; | |
14 | +import com.order.erp.common.constant.ServerResult; | |
15 | +import com.order.erp.common.constant.ServerResultCode; | |
16 | +import com.order.erp.common.exception.BusinessException; | |
17 | +import com.order.erp.common.utils.DateUtils; | |
18 | +import com.order.erp.common.utils.StringUtils; | |
19 | +import com.order.erp.common.utils.TransactionHelper; | |
20 | +import com.order.erp.config.DataScope; | |
21 | +import com.order.erp.domain.ApplyStatusEnum; | |
22 | +import com.order.erp.domain.ApplyTypeEnum; | |
23 | +import com.order.erp.domain.RoleEnum; | |
24 | +import com.order.erp.domain.dto.BaseDO; | |
25 | +import com.order.erp.domain.dto.SystemSettingDO; | |
26 | +import com.order.erp.domain.dto.order.*; | |
27 | +import com.order.erp.domain.vo.order.*; | |
28 | +import com.order.erp.mapper.order.InvoiceBillOrderMapper; | |
29 | +import com.order.erp.service.SystemSettingService; | |
30 | +import com.order.erp.service.order.*; | |
31 | +import lombok.extern.slf4j.Slf4j; | |
32 | +import org.apache.poi.ss.usermodel.*; | |
33 | +import org.apache.poi.ss.util.CellRangeAddress; | |
34 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
35 | +import org.springframework.beans.BeanUtils; | |
36 | +import org.springframework.stereotype.Service; | |
37 | + | |
38 | +import javax.annotation.Resource; | |
39 | +import javax.servlet.http.HttpServletResponse; | |
40 | +import java.io.IOException; | |
41 | +import java.math.BigDecimal; | |
42 | +import java.math.RoundingMode; | |
43 | +import java.net.URLDecoder; | |
44 | +import java.nio.charset.StandardCharsets; | |
45 | +import java.time.LocalDateTime; | |
46 | +import java.util.*; | |
47 | +import java.util.function.Function; | |
48 | +import java.util.stream.Collectors; | |
49 | + | |
50 | +/** | |
51 | + * 应收款账单表(InvoiceBillOrder)表服务实现类 | |
52 | + * | |
53 | + * @author makejava | |
54 | + * @since 2024-08-05 16:26:34 | |
55 | + */ | |
56 | +@Slf4j | |
57 | +@Service | |
58 | +public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMapper, InvoiceBillOrderDO> implements InvoiceBillOrderService { | |
59 | + | |
60 | + | |
61 | + @Resource | |
62 | + private OrderBaseInfoService orderBaseInfoService; | |
63 | + | |
64 | + @Resource | |
65 | + private OrderProfitAnalysisService profitAnalysisService; | |
66 | + | |
67 | + @Resource | |
68 | + private InvoiceBillMappingService invoiceBillMappingService; | |
69 | + | |
70 | + @Resource | |
71 | + private OrderFieldLockApplyService orderFieldLockApplyService; | |
72 | + | |
73 | + @Resource | |
74 | + private SystemSettingService systemSettingService; | |
75 | + | |
76 | + @Resource | |
77 | + private DataScope dataScope; | |
78 | + | |
79 | + @Resource | |
80 | + private TransactionHelper transactionHelper; | |
81 | + | |
82 | + | |
83 | + /** | |
84 | + * 分页查询 | |
85 | + * | |
86 | + * @param queryVO 筛选条件 | |
87 | + * @return 查询结果 | |
88 | + */ | |
89 | + @Override | |
90 | + public ServerResult listByPage(InvoiceBillOrderQueryVO queryVO) { | |
91 | + RoleEnum role = dataScope.getRole(); | |
92 | + LambdaQueryWrapper<InvoiceBillOrderDO> queryWrapper = getQueryWrapper(queryVO); | |
93 | + //跟单也只能看到自己创建的 业务只能看到自己的 | |
94 | + if(Objects.nonNull(role) && role.getId().equals(RoleEnum.TRACKER_USER.getId())){ | |
95 | + queryWrapper.eq(InvoiceBillOrderDO::getCreateBy, dataScope.getLoginUserName()); | |
96 | + } | |
97 | + if(Objects.nonNull(role) && role.getId().equals(RoleEnum.BUSINESS_USER.getId())){ | |
98 | + queryWrapper.eq(InvoiceBillOrderDO::getBusinesPerson, dataScope.getLoginUserName()); | |
99 | + } | |
100 | + Page page = new Page<>(queryVO.getPage(), queryVO.getPageSize()); | |
101 | + IPage<InvoiceBillOrderDO> iPage = page(page, queryWrapper); | |
102 | + return ServerResult.success(iPage); | |
103 | + } | |
104 | + | |
105 | + /** | |
106 | + * @param queryVO | |
107 | + * @return | |
108 | + */ | |
109 | + private LambdaQueryWrapper<InvoiceBillOrderDO> getQueryWrapper(InvoiceBillOrderQueryVO queryVO) { | |
110 | + LambdaQueryWrapper<InvoiceBillOrderDO> queryWrapper = new LambdaQueryWrapper<InvoiceBillOrderDO>() | |
111 | + .eq(InvoiceBillOrderDO::getEnableFlag, Constant.ENABLE_TEN) | |
112 | + .eq(StringUtils.isNotBlank(queryVO.getInvoiceNo()), InvoiceBillOrderDO::getInvoiceNo, queryVO.getInvoiceNo()) | |
113 | + .eq(Objects.nonNull(queryVO.getStatus()), InvoiceBillOrderDO::getStatus, queryVO.getStatus()) | |
114 | + .ge(StringUtils.isNotBlank(queryVO.getStartTime()), InvoiceBillOrderDO::getCreateTime, queryVO.getStartTime()) | |
115 | + .le(StringUtils.isNotBlank(queryVO.getEndTime()), InvoiceBillOrderDO::getCreateTime, queryVO.getEndTime()) | |
116 | + .orderByDesc(InvoiceBillOrderDO::getId); | |
117 | + if (CollectionUtils.isNotEmpty(queryVO.getIds())) { | |
118 | + queryWrapper.in(InvoiceBillOrderDO::getId, queryVO.getIds()); | |
119 | + } else { | |
120 | + Set<Long> billOrderIds = filterBillOrderIdsBy(queryVO); | |
121 | + queryWrapper.in(CollectionUtils.isNotEmpty(billOrderIds), InvoiceBillOrderDO::getId, billOrderIds); | |
122 | + } | |
123 | + return queryWrapper; | |
124 | + } | |
125 | + | |
126 | + @Override | |
127 | + public ServerResult listBaseOrderInfoBy(InvoiceBaseOrderQueryVO queryVO) { | |
128 | + List<InvoiceBillMappingDO> mappingDOS = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>() | |
129 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
130 | + .eq(InvoiceBillMappingDO::getInvoiceNo, queryVO.getInvoiceNo())); | |
131 | + if (CollectionUtils.isEmpty(mappingDOS)) { | |
132 | + return ServerResult.success(); | |
133 | + } | |
134 | + Set<Long> orderIds = mappingDOS.stream().map(InvoiceBillMappingDO::getOrderId).collect(Collectors.toSet()); | |
135 | + //返回数据包含利润信息。 | |
136 | + //创建返回的数据,里面包含订单信息和利润信息,然后放到list集合中。 | |
137 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(orderIds); | |
138 | + List<OrderProfitAnalysisDO> orderProfitAnalysisDOList = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
139 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
140 | + .in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
141 | + Map<Long, OrderBaseInfoDO> orderBaseInfoDOMap = orderBaseInfoDOList.stream().collect(Collectors.toMap(OrderBaseInfoDO::getId, Function.identity(), (x, y) -> x)); | |
142 | + Map<Long, OrderProfitAnalysisDO> orderProfitAnalysisDOMap = orderProfitAnalysisDOList.stream().collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (x, y) -> x)); | |
143 | + List<InvoiceBillOrdeBaserResultVO> list = orderBaseInfoDOList.stream().map(x -> { | |
144 | + if (orderBaseInfoDOMap.containsKey(x.getId()) && orderProfitAnalysisDOMap.containsKey(x.getId())) { | |
145 | + InvoiceBillOrdeBaserResultVO resultVO = new InvoiceBillOrdeBaserResultVO(); | |
146 | + resultVO.setCustomerCode(orderBaseInfoDOMap.get(x.getId()).getCustomerCode()); | |
147 | + resultVO.setProjectNo(orderBaseInfoDOMap.get(x.getId()).getProjectNo()); | |
148 | + resultVO.setInnerNo(orderBaseInfoDOMap.get(x.getId()).getInnerNo()); | |
149 | + resultVO.setCustomerPo(orderBaseInfoDOMap.get(x.getId()).getCustomerPo()); | |
150 | + resultVO.setCustomerStyle(orderBaseInfoDOMap.get(x.getId()).getCustomerStyle()); | |
151 | + resultVO.setModeleLo(orderBaseInfoDOMap.get(x.getId()).getModeleLo()); | |
152 | + resultVO.setSmallPicUrl(orderBaseInfoDOMap.get(x.getId()).getSmallPicUrl()); | |
153 | + resultVO.setOrderCount(orderBaseInfoDOMap.get(x.getId()).getOrderCount()); | |
154 | + resultVO.setCustomerPrice(orderProfitAnalysisDOMap.get(x.getId()).getCustomerPrice()); | |
155 | + resultVO.setCustomerTotalPrice(orderProfitAnalysisDOMap.get(x.getId()).getCustomerTotalPrice()); | |
156 | + return resultVO; | |
157 | + }else{ | |
158 | + return null; | |
159 | + } | |
160 | + }).filter(Objects::nonNull).collect(Collectors.toList()); | |
161 | + return ServerResult.success(list); | |
162 | + } | |
163 | + | |
164 | + @Override | |
165 | + public ServerResult listAnalysisBy(InvoiceBillAnalysisVO queryVO) { | |
166 | + return ServerResult.success(getAnalysisResult(queryVO)); | |
167 | + } | |
168 | + | |
169 | + @Override | |
170 | + public ServerResult export(HttpServletResponse response, InvoiceBillAnalysisVO queryVO) throws IOException { | |
171 | +// InvoiceBillAnalysisResultVO resultVO = getAnalysisResult(queryVO); | |
172 | + //第二版 | |
173 | + List<InvoiceBillAnalysisResultVO> resultVO = getAnalysisResult(queryVO); | |
174 | + //第二版截止。 | |
175 | + if (Objects.isNull(resultVO)) { | |
176 | + throw new BusinessException("数据为空,不能导出!"); | |
177 | + } | |
178 | + List<Map<String, Object>> list = buildExportMapVOS(resultVO); | |
179 | + if (CollectionUtils.isNotEmpty(list)) { | |
180 | + List<String> keys = new ArrayList<>(list.get(Constant.ZERO).keySet()); | |
181 | + | |
182 | + ExcelHelper.opsExport(PoiWorkbookType.XLSX) | |
183 | + .opsSheet(list) | |
184 | + .opsHeader().simple().texts(keys).done() | |
185 | + .opsColumn().fields(keys).done() | |
186 | + .height(CellPosition.CELL, 750) | |
187 | + .done() | |
188 | + .export(response.getOutputStream()); | |
189 | + } | |
190 | + return ServerResult.success(); | |
191 | + } | |
192 | + | |
193 | + /** | |
194 | + * @param resultVO | |
195 | + * @return | |
196 | + */ | |
197 | +// private List<Map<String, Object>> buildExportMapVOS(InvoiceBillAnalysisResultVO resultVO) { | |
198 | + //第二版 | |
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 | + //第二版开始 | |
240 | + List<InvoiceBillAnalysisExportVO> exportVOS = resultVO.stream() | |
241 | + .flatMap(X -> X.getExportVOS().stream()) // 展开每个 resultVO 的 exportVOS 列表 | |
242 | + .collect(Collectors.toList()); // 将所有结果收集到一个列表中 | |
243 | + //第二版截止 | |
244 | + List<Map<String, Object>> list = new ArrayList<>(); | |
245 | + int i = 1; // Start index from 1 | |
246 | + | |
247 | + // 根据客户编码分组 | |
248 | + Map<String, List<InvoiceBillAnalysisExportVO>> customerGroupedMap = exportVOS.stream() | |
249 | + .collect(Collectors.groupingBy(InvoiceBillAnalysisExportVO::getCustomerCode)); | |
250 | + | |
251 | + boolean multipleCustomerCodes = customerGroupedMap.size() > 1; | |
252 | + | |
253 | + BigDecimal totalCustomerTotalPrice = BigDecimal.ZERO; | |
254 | + BigDecimal totalDeductAmount = BigDecimal.ZERO; | |
255 | + BigDecimal totalActualReceivableAmount = BigDecimal.ZERO; | |
256 | + BigDecimal totalActualPayedAmount = BigDecimal.ZERO; | |
257 | + BigDecimal totalOtherAmount = BigDecimal.ZERO; | |
258 | + BigDecimal totalOtherTotalAmount = BigDecimal.ZERO; | |
259 | + | |
260 | + for (Map.Entry<String, List<InvoiceBillAnalysisExportVO>> entry : customerGroupedMap.entrySet()) { | |
261 | + String customerCode = entry.getKey(); | |
262 | + List<InvoiceBillAnalysisExportVO> customerItems = entry.getValue(); | |
263 | + | |
264 | + BigDecimal subTotalCustomerTotalPrice = BigDecimal.ZERO; | |
265 | + BigDecimal subTotalDeductAmount = BigDecimal.ZERO; | |
266 | + BigDecimal subTotalActualReceivableAmount = BigDecimal.ZERO; | |
267 | + BigDecimal subTotalActualPayedAmount = BigDecimal.ZERO; | |
268 | + BigDecimal subTotalOtherAmount = BigDecimal.ZERO; | |
269 | + BigDecimal subTotalOtherTotalAmount = BigDecimal.ZERO; | |
270 | + | |
271 | + for (InvoiceBillAnalysisExportVO exportVO : customerItems) { | |
272 | + Map<String, Object> map = new LinkedHashMap<>(); | |
273 | + map.put("编号", i++); | |
274 | + map.put("客户编码", exportVO.getCustomerCode()); | |
275 | + map.put("INVOICE编码", exportVO.getInvoiceNo()); | |
276 | + map.put("客户总金额汇总", "$"+exportVO.getCustomerTotalPrice()); | |
277 | + map.put("客户扣款金额汇总", "$"+exportVO.getDeductAmount()); | |
278 | + map.put("实际应收金额", "$"+exportVO.getActualReceivableAmount()); | |
279 | + map.put("实际收款金额汇总", "$"+exportVO.getActualPayedAmount()); | |
280 | + map.put("其他费用金额汇总","$"+exportVO.getOtherAmount()); | |
281 | + map.put("未收金额合计", "$"+exportVO.getOtherTotalAmount()); | |
282 | + map.put("必须回款日期", exportVO.getBackRefundDate()); | |
283 | + map.put("实际回款日期", exportVO.getActualRefundDate()); | |
284 | + list.add(map); | |
285 | + | |
286 | + // 初始化数据 | |
287 | + subTotalCustomerTotalPrice = subTotalCustomerTotalPrice.add(exportVO.getCustomerTotalPrice() == null ? BigDecimal.ZERO : exportVO.getCustomerTotalPrice()); | |
288 | + subTotalDeductAmount = subTotalDeductAmount.add(exportVO.getDeductAmount() == null ? BigDecimal.ZERO : exportVO.getDeductAmount()); | |
289 | + subTotalActualReceivableAmount = subTotalActualReceivableAmount.add(exportVO.getActualReceivableAmount() == null ? BigDecimal.ZERO : exportVO.getActualReceivableAmount()); | |
290 | + subTotalActualPayedAmount = subTotalActualPayedAmount.add(exportVO.getActualPayedAmount() == null ? BigDecimal.ZERO : exportVO.getActualPayedAmount()); | |
291 | + subTotalOtherAmount = subTotalOtherAmount.add(exportVO.getOtherAmount() == null ? BigDecimal.ZERO : exportVO.getOtherAmount()); | |
292 | + subTotalOtherTotalAmount = subTotalOtherTotalAmount.add(exportVO.getOtherTotalAmount() == null ? BigDecimal.ZERO : exportVO.getOtherTotalAmount()); | |
293 | + } | |
294 | + | |
295 | + // 如果客户编码有多个就添加小计。 | |
296 | + if (multipleCustomerCodes) { | |
297 | + Map<String, Object> subTotalMap = new LinkedHashMap<>(); | |
298 | + subTotalMap.put("编号", "小计"); | |
299 | + subTotalMap.put("客户编码", ""); | |
300 | + subTotalMap.put("INVOICE编码", ""); | |
301 | + subTotalMap.put("客户总金额汇总", "$"+subTotalCustomerTotalPrice); | |
302 | + subTotalMap.put("客户扣款金额汇总", "$"+subTotalDeductAmount); | |
303 | + subTotalMap.put("实际应收金额", "$"+subTotalActualReceivableAmount); | |
304 | + subTotalMap.put("实际收款金额汇总", "$"+subTotalActualPayedAmount); | |
305 | + subTotalMap.put("其他费用金额汇总", "$"+subTotalOtherAmount); | |
306 | + subTotalMap.put("未收金额合计", "$"+subTotalOtherTotalAmount); | |
307 | + subTotalMap.put("必须回款日期", ""); | |
308 | + subTotalMap.put("实际回款日期", ""); | |
309 | + list.add(subTotalMap); | |
310 | + } | |
311 | + | |
312 | + // Calculate totals | |
313 | + totalCustomerTotalPrice = totalCustomerTotalPrice.add(subTotalCustomerTotalPrice); | |
314 | + totalDeductAmount = totalDeductAmount.add(subTotalDeductAmount); | |
315 | + totalActualReceivableAmount = totalActualReceivableAmount.add(subTotalActualReceivableAmount); | |
316 | + totalActualPayedAmount = totalActualPayedAmount.add(subTotalActualPayedAmount); | |
317 | + totalOtherAmount = totalOtherAmount.add(subTotalOtherAmount); | |
318 | + totalOtherTotalAmount = totalOtherTotalAmount.add(subTotalOtherTotalAmount); | |
319 | + } | |
320 | + | |
321 | + // 计算总数据。 | |
322 | + Map<String, Object> totalMap = new LinkedHashMap<>(); | |
323 | + totalMap.put("编号", "合计"); | |
324 | + totalMap.put("客户编码", ""); | |
325 | + totalMap.put("INVOICE编码", ""); | |
326 | + totalMap.put("客户总金额汇总", "$"+totalCustomerTotalPrice); | |
327 | + totalMap.put("客户扣款金额汇总", "$"+totalDeductAmount); | |
328 | + totalMap.put("实际应收金额", "$"+totalActualReceivableAmount); | |
329 | + totalMap.put("实际收款金额汇总", "$"+totalActualPayedAmount); | |
330 | + totalMap.put("其他费用金额汇总", "$"+totalOtherAmount); | |
331 | + totalMap.put("未收金额合计", "$"+totalOtherTotalAmount); | |
332 | + totalMap.put("必须回款日期", ""); | |
333 | + totalMap.put("实际回款日期", ""); | |
334 | + list.add(totalMap); | |
335 | + | |
336 | + return list; | |
337 | + } | |
338 | + | |
339 | + /** | |
340 | + * @param queryVO | |
341 | + * @return | |
342 | + */ | |
343 | +// private InvoiceBillAnalysisResultVO getAnalysisResult(InvoiceBillAnalysisVO queryVO) { | |
344 | + //第二版 | |
345 | + private List<InvoiceBillAnalysisResultVO> getAnalysisResult(InvoiceBillAnalysisVO queryVO) { | |
346 | + LambdaQueryWrapper<InvoiceBillOrderDO> queryWrapper = getQueryWrapper(queryVO); | |
347 | + List<InvoiceBillOrderDO> invoiceBillOrderDOS = list(queryWrapper); | |
348 | + if (CollectionUtils.isEmpty(invoiceBillOrderDOS)) { | |
349 | + return null; | |
350 | + } | |
351 | + Set<Long> ids = invoiceBillOrderDOS.stream().map(InvoiceBillOrderDO::getId).collect(Collectors.toSet()); | |
352 | + List<InvoiceBillMappingDO> invoiceBillMappingDOS = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(InvoiceBillMappingDO::getInvoiceBillId, ids)); | |
353 | + if (CollectionUtils.isEmpty(invoiceBillMappingDOS)) { | |
354 | + return null; | |
355 | + } | |
356 | + Map<Long, InvoiceBillMappingDO> orderBillMap = invoiceBillMappingDOS.stream().collect(Collectors.toMap(InvoiceBillMappingDO::getOrderId, Function.identity(), (x, y) -> x)); | |
357 | + List<InvoiceOrderBaseItemVO> itemVOS = getInvoiceOrderBaseItems(orderBillMap); | |
358 | + Map<String, InvoiceBillOrderDO> invoiceBillOrderDOMap = invoiceBillOrderDOS.stream().collect(Collectors.toMap(InvoiceBillOrderDO::getInvoiceNo, Function.identity(), (x, y) -> x)); | |
359 | + Map<String, List<InvoiceOrderBaseItemVO>> baseItemMap = itemVOS.stream().collect(Collectors.groupingBy(InvoiceOrderBaseItemVO::getInvoiceCode)); | |
360 | + List<InvoiceBillAnalysisExportVO> exportVOS = wrapperAnalysisExport(invoiceBillOrderDOMap, baseItemMap); | |
361 | + return wrapperAnalysisResultVO(exportVOS); | |
362 | + } | |
363 | + | |
364 | + /** | |
365 | + * @param exportVOS | |
366 | + * @return | |
367 | + */ | |
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 | + //第二版 | |
420 | + private List<InvoiceBillAnalysisResultVO> wrapperAnalysisResultVO(List<InvoiceBillAnalysisExportVO> exportVOS) { | |
421 | + if (CollectionUtils.isEmpty(exportVOS)) { | |
422 | + return Collections.emptyList(); | |
423 | + } | |
424 | + | |
425 | + // 按 customerCode 进行分组 | |
426 | + Map<String, List<InvoiceBillAnalysisExportVO>> groupedByCustomerCode = exportVOS.stream() | |
427 | + .collect(Collectors.groupingBy(InvoiceBillAnalysisExportVO::getCustomerCode)); | |
428 | + | |
429 | + List<InvoiceBillAnalysisResultVO> resultList = new ArrayList<>(); | |
430 | + | |
431 | + // 遍历分组后的数据 | |
432 | + groupedByCustomerCode.forEach((customerCode, exportVOList) -> { | |
433 | + InvoiceBillAnalysisResultVO resultVO = InvoiceBillAnalysisResultVO.builder().exportVOS(exportVOList).build(); | |
434 | + BigDecimal customerTotalPrice = new BigDecimal(Constant.ZERO); | |
435 | + BigDecimal deductAmount = new BigDecimal(Constant.ZERO); | |
436 | + BigDecimal actualPayedAmount = new BigDecimal(Constant.ZERO); | |
437 | + BigDecimal otherTotalAmount = new BigDecimal(Constant.ZERO); | |
438 | + | |
439 | + // 对每个 customerCode 对应的 InvoiceBillAnalysisExportVO 列表进行处理 | |
440 | + for (InvoiceBillAnalysisExportVO exportVO : exportVOList) { | |
441 | + if (Objects.nonNull(exportVO.getCustomerTotalPrice())) { | |
442 | + customerTotalPrice = customerTotalPrice.add(exportVO.getCustomerTotalPrice()); | |
443 | + } | |
444 | + if (Objects.nonNull(exportVO.getDeductAmount())) { | |
445 | + deductAmount = deductAmount.add(exportVO.getDeductAmount()); | |
446 | + } | |
447 | + if (Objects.nonNull(exportVO.getActualPayedAmount())) { | |
448 | + actualPayedAmount = actualPayedAmount.add(exportVO.getActualPayedAmount()); | |
449 | + } | |
450 | + if (Objects.nonNull(exportVO.getOtherTotalAmount())) { | |
451 | + otherTotalAmount = otherTotalAmount.add(exportVO.getOtherAmount()); | |
452 | + } | |
453 | + } | |
454 | + // 设置计算后的结果 | |
455 | + resultVO.setCustomerTotalPrice(customerTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
456 | + resultVO.setDeductAmount(deductAmount.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
457 | + resultVO.setActualReceivableAmount(actualPayedAmount.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
458 | + resultVO.setOtherTotalAmount(otherTotalAmount.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
459 | + resultVO.setOtherAmount(resultVO.getCustomerTotalPrice().subtract(resultVO.getDeductAmount()).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
460 | + //未收金额汇总。 | |
461 | + resultVO.setActualPayedAmount(resultVO.getOtherAmount().subtract(resultVO.getActualReceivableAmount()).subtract(resultVO.getOtherTotalAmount()).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
462 | + | |
463 | + // 添加到结果列表 | |
464 | + resultList.add(resultVO); | |
465 | + }); | |
466 | + | |
467 | + return resultList; | |
468 | + } | |
469 | + | |
470 | + | |
471 | + /** | |
472 | + * @param invoiceBillOrderDOMap | |
473 | + * @param baseItemMap | |
474 | + * @return | |
475 | + */ | |
476 | + private List<InvoiceBillAnalysisExportVO> wrapperAnalysisExport(Map<String, InvoiceBillOrderDO> invoiceBillOrderDOMap, Map<String, List<InvoiceOrderBaseItemVO>> baseItemMap) { | |
477 | + if (CollectionUtils.isEmpty(invoiceBillOrderDOMap)) { | |
478 | + return Collections.emptyList(); | |
479 | + } | |
480 | + List<InvoiceBillAnalysisExportVO> results = new ArrayList<>(); | |
481 | + for (Map.Entry<String, InvoiceBillOrderDO> entry : invoiceBillOrderDOMap.entrySet()) { | |
482 | + InvoiceBillOrderDO invoiceBillOrderDO = entry.getValue(); | |
483 | + List<InvoiceBillAnalysisExportVO> exportVOS = transfer2analysisExportVO(invoiceBillOrderDO, baseItemMap); | |
484 | + if (CollectionUtils.isNotEmpty(exportVOS)) { | |
485 | + results.addAll(exportVOS); | |
486 | + } | |
487 | + } | |
488 | + return results; | |
489 | + } | |
490 | + | |
491 | + /** | |
492 | + * @param invoiceBillOrderDO | |
493 | + * @param baseItemMap | |
494 | + * @return | |
495 | + */ | |
496 | + private List<InvoiceBillAnalysisExportVO> transfer2analysisExportVO(InvoiceBillOrderDO invoiceBillOrderDO, Map<String, List<InvoiceOrderBaseItemVO>> baseItemMap) { | |
497 | + List<InvoiceBillAnalysisExportVO> results = new ArrayList<>(); | |
498 | + String invoiceNo = invoiceBillOrderDO.getInvoiceNo(); | |
499 | + if (baseItemMap.containsKey(invoiceNo)) { | |
500 | + List<InvoiceOrderBaseItemVO> baseItemVOS = baseItemMap.get(invoiceNo); | |
501 | + Map<String, List<InvoiceOrderBaseItemVO>> listMap = baseItemVOS.stream().collect(Collectors.groupingBy(InvoiceOrderBaseItemVO::getCustomerCode)); | |
502 | + for (Map.Entry<String, List<InvoiceOrderBaseItemVO>> entry : listMap.entrySet()) { | |
503 | + String customerCode = entry.getKey(); | |
504 | + List<InvoiceOrderBaseItemVO> itemVOS = entry.getValue(); | |
505 | + InvoiceBillAnalysisExportVO exportVO = buildAnalysisExportVO(invoiceBillOrderDO); | |
506 | + exportVO.setCustomerCode(customerCode); | |
507 | + if (CollectionUtils.isEmpty(itemVOS)) { | |
508 | + exportVO.setCustomerTotalPrice(new BigDecimal(Constant.ZERO).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
509 | + } else { | |
510 | + BigDecimal customerTotalPrice = new BigDecimal(Constant.ZERO); | |
511 | + for (InvoiceOrderBaseItemVO itemVO : itemVOS) { | |
512 | + customerTotalPrice = customerTotalPrice.add(Objects.nonNull(itemVO.getCustomerTotalPrice()) ? itemVO.getCustomerTotalPrice() : new BigDecimal(Constant.ZERO)); | |
513 | + } | |
514 | + exportVO.setCustomerTotalPrice(customerTotalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
515 | + } | |
516 | + results.add(exportVO); | |
517 | + } | |
518 | + } | |
519 | + return results; | |
520 | + } | |
521 | + | |
522 | + /** | |
523 | + * @param invoiceBillOrderDO | |
524 | + * @return | |
525 | + */ | |
526 | + private InvoiceBillAnalysisExportVO buildAnalysisExportVO(InvoiceBillOrderDO invoiceBillOrderDO) { | |
527 | + InvoiceBillAnalysisExportVO exportVO = new InvoiceBillAnalysisExportVO(); | |
528 | + BeanUtils.copyProperties(invoiceBillOrderDO, exportVO); | |
529 | + BigDecimal actualPayedAmount = new BigDecimal(Constant.ZERO); | |
530 | + if (Objects.nonNull(invoiceBillOrderDO.getActualPayedAmount1())) { | |
531 | + actualPayedAmount = actualPayedAmount.add(invoiceBillOrderDO.getActualPayedAmount1()); | |
532 | + } | |
533 | + if (Objects.nonNull(invoiceBillOrderDO.getActualPayedAmount2())) { | |
534 | + actualPayedAmount = actualPayedAmount.add(invoiceBillOrderDO.getActualPayedAmount2()); | |
535 | + } | |
536 | + if (Objects.nonNull(invoiceBillOrderDO.getActualPayedAmount3())) { | |
537 | + actualPayedAmount = actualPayedAmount.add(invoiceBillOrderDO.getActualPayedAmount3()); | |
538 | + } | |
539 | + // 实际收款总金额(补) | |
540 | + exportVO.setActualPayedAmount(actualPayedAmount.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
541 | + //这一段不需要。 | |
542 | +// BigDecimal otherAmount = (Objects.nonNull(invoiceBillOrderDO.getActualReceivableAmount()) ? invoiceBillOrderDO.getActualReceivableAmount() : new BigDecimal(Constant.ZERO)) | |
543 | +// .subtract(exportVO.getActualPayedAmount()); | |
544 | +// exportVO.setOtherAmount(otherAmount); | |
545 | + //改为获取订单的其他费用,而不是计算。 | |
546 | +// BigDecimal otherTotalAmount = (Objects.nonNull(invoiceBillOrderDO.getActualReceivableAmount()) ? invoiceBillOrderDO.getActualReceivableAmount() : new BigDecimal(Constant.ZERO)) | |
547 | +// .subtract(exportVO.getActualPayedAmount()).subtract(otherAmount); | |
548 | +// exportVO.setOtherTotalAmount(otherTotalAmount); | |
549 | + //应收金额 实际应收款(补) | |
550 | + exportVO.setActualReceivableAmount(invoiceBillOrderDO.getTotalCustomerAmount().subtract(exportVO.getDeductAmount()).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
551 | + //确实是这个 未收 注意这里是采用了actualReceivableAmount。 千万要改。 未收金额合计(补) | |
552 | +// exportVO.setOtherTotalAmount(invoiceBillOrderDO.getActualReceivableAmount().subtract(exportVO.getActualPayedAmount()).subtract(exportVO.getOtherAmount()).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
553 | + exportVO.setOtherTotalAmount( exportVO.getActualReceivableAmount().subtract(exportVO.getActualPayedAmount()).subtract(exportVO.getOtherAmount()).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
554 | + //目的是保留小数点后两位。 用户扣款金额(补) | |
555 | + exportVO.setDeductAmount(exportVO.getDeductAmount().setScale(2, BigDecimal.ROUND_HALF_UP)); | |
556 | + exportVO.setActualReceivableAmount(exportVO.getActualReceivableAmount().setScale(2, BigDecimal.ROUND_HALF_UP)); | |
557 | + // | |
558 | + exportVO.setOtherAmount(exportVO.getOtherAmount().setScale(2, BigDecimal.ROUND_HALF_UP)); | |
559 | + return exportVO; | |
560 | + } | |
561 | + | |
562 | + /** | |
563 | + * @param mappingDOMap | |
564 | + * @return | |
565 | + */ | |
566 | + private List<InvoiceOrderBaseItemVO> getInvoiceOrderBaseItems(Map<Long, InvoiceBillMappingDO> mappingDOMap) { | |
567 | + Set<Long> orderIds = mappingDOMap.keySet(); | |
568 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(orderIds); | |
569 | + List<OrderProfitAnalysisDO> profitAnalysisDOS = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
570 | + Map<Long, OrderBaseInfoDO> orderBaseInfoDOMap = orderBaseInfoDOList.stream().collect(Collectors.toMap(OrderBaseInfoDO::getId, Function.identity(), (x, y) -> x)); | |
571 | + Map<Long, OrderProfitAnalysisDO> profitAnalysisDOMap = profitAnalysisDOS.stream().collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (x, y) -> x)); | |
572 | + List<InvoiceOrderBaseItemVO> baseItemVOS = new ArrayList<>(); | |
573 | + for (Map.Entry<Long, OrderBaseInfoDO> entry : orderBaseInfoDOMap.entrySet()) { | |
574 | + Long orderId = entry.getKey(); | |
575 | + OrderBaseInfoDO baseInfoDO = entry.getValue(); | |
576 | + InvoiceOrderBaseItemVO itemVO = InvoiceOrderBaseItemVO.builder() | |
577 | + .orderId(orderId) | |
578 | + .customerCode(baseInfoDO.getCustomerCode()) | |
579 | + .build(); | |
580 | + if (profitAnalysisDOMap.containsKey(orderId)) { | |
581 | + OrderProfitAnalysisDO profitAnalysisDO = profitAnalysisDOMap.get(orderId); | |
582 | + itemVO.setCustomerTotalPrice(Objects.isNull(profitAnalysisDO.getCustomerTotalPrice()) ? new BigDecimal(Constant.ZERO) : new BigDecimal(profitAnalysisDO.getCustomerTotalPrice())); | |
583 | + } else { | |
584 | + itemVO.setCustomerTotalPrice(new BigDecimal(Constant.ZERO)); | |
585 | + } | |
586 | + | |
587 | + if (mappingDOMap.containsKey(orderId)) { | |
588 | + InvoiceBillMappingDO mappingDO = mappingDOMap.get(orderId); | |
589 | + itemVO.setInvoiceCode(mappingDO.getInvoiceNo()); | |
590 | + } | |
591 | + baseItemVOS.add(itemVO); | |
592 | + } | |
593 | + return baseItemVOS; | |
594 | + } | |
595 | + | |
596 | + /** | |
597 | + * @param queryVO | |
598 | + * @return | |
599 | + */ | |
600 | + private Set<Long> filterBillOrderIdsBy(InvoiceBillOrderQueryVO queryVO) { | |
601 | + List<Long> orderIds = filterOrderIdsBy(queryVO); | |
602 | + if (CollectionUtils.isEmpty(orderIds)) { | |
603 | + return null; | |
604 | + } | |
605 | + List<InvoiceBillMappingDO> mappingDOS = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
606 | + .in(CollectionUtils.isNotEmpty(orderIds), InvoiceBillMappingDO::getOrderId, orderIds)); | |
607 | + if (CollectionUtils.isEmpty(mappingDOS)) { | |
608 | + Set<Long> ids = new HashSet<>(); | |
609 | + ids.add(-1L); | |
610 | + return ids; | |
611 | + } | |
612 | + return mappingDOS.stream().map(InvoiceBillMappingDO::getInvoiceBillId).collect(Collectors.toSet()); | |
613 | + } | |
614 | + | |
615 | + /** | |
616 | + * @param queryVO | |
617 | + * @return | |
618 | + */ | |
619 | + private List<Long> filterOrderIdsBy(InvoiceBillOrderQueryVO queryVO) { | |
620 | + Boolean flag = false; | |
621 | + if (StringUtils.isNotBlank(queryVO.getCustomerCode())) { | |
622 | + flag = flag | true; | |
623 | + } | |
624 | + if (StringUtils.isNotBlank(queryVO.getProductionDepartment())) { | |
625 | + flag = flag | true; | |
626 | + } | |
627 | + if (StringUtils.isNotBlank(queryVO.getCustomerPo())) { | |
628 | + flag = flag | true; | |
629 | + } | |
630 | + if (StringUtils.isNotBlank(queryVO.getInnerNo())) { | |
631 | + flag = flag | true; | |
632 | + } | |
633 | + if (StringUtils.isNotBlank(queryVO.getProjectNo())) { | |
634 | + flag = flag | true; | |
635 | + } | |
636 | + if (!flag) { | |
637 | + return null; | |
638 | + } | |
639 | + LambdaQueryWrapper<OrderBaseInfoDO> queryWrapper = new LambdaQueryWrapper<OrderBaseInfoDO>() | |
640 | + .eq(OrderBaseInfoDO::getEnableFlag, Constant.ENABLE_TEN) | |
641 | + .eq(StringUtils.isNotBlank(queryVO.getCustomerCode()), OrderBaseInfoDO::getCustomerCode, queryVO.getCustomerCode()) | |
642 | + .eq(StringUtils.isNotBlank(queryVO.getProductionDepartment()), OrderBaseInfoDO::getProductionDepartment, queryVO.getProductionDepartment()) | |
643 | + .eq(StringUtils.isNotBlank(queryVO.getCustomerPo()), OrderBaseInfoDO::getCustomerPo, queryVO.getCustomerPo()) | |
644 | + .eq(StringUtils.isNotBlank(queryVO.getInnerNo()), OrderBaseInfoDO::getInnerNo, queryVO.getInnerNo()) | |
645 | + .eq(StringUtils.isNotBlank(queryVO.getProjectNo()), OrderBaseInfoDO::getProjectNo, queryVO.getProjectNo()); | |
646 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.list(queryWrapper); | |
647 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
648 | + List<Long> orderIds = new ArrayList<>(); | |
649 | + orderIds.add(-1L); | |
650 | + return orderIds; | |
651 | + } | |
652 | + return orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getId).collect(Collectors.toList()); | |
653 | + } | |
654 | + | |
655 | + /** | |
656 | + * 创建invoice单据 | |
657 | + * | |
658 | + * @param createVO 实例对象 | |
659 | + * @return 实例对象 | |
660 | + */ | |
661 | + @Override | |
662 | + public ServerResult create(InvoiceBillCreateVO createVO) { | |
663 | + if (Objects.nonNull(createVO.getId())) { | |
664 | + createVO.setId(null); | |
665 | + } | |
666 | + | |
667 | + validaBillOrder(createVO); | |
668 | + | |
669 | + InvoiceBillOrderDO invoiceBillOrderDO = buildInvoiceBillOrderDO(createVO); | |
670 | + | |
671 | + boolean success= transactionHelper.run(() -> { | |
672 | + save(invoiceBillOrderDO); | |
673 | + | |
674 | + invoiceBillMappingService.saveBatch(buildInvoiceBillMappingDOS(createVO, invoiceBillOrderDO)); | |
675 | + return true; | |
676 | + }); | |
677 | + if(success) { | |
678 | + //在创建时获取到客户总金额。 | |
679 | + List<InvoiceBillMappingDO> invoiceBillMappingDOS = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>() | |
680 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
681 | + .eq(InvoiceBillMappingDO::getInvoiceNo, invoiceBillOrderDO.getInvoiceNo())); | |
682 | + if (CollectionUtils.isNotEmpty(invoiceBillMappingDOS)) { | |
683 | + List<Long> orderIds = invoiceBillMappingDOS.stream().map(InvoiceBillMappingDO::getOrderId).collect(Collectors.toList()); | |
684 | + List<OrderProfitAnalysisDO> orderProfitAnalysisList = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
685 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
686 | + .in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
687 | + List<OrderProfitAnalysisDO> orderProfitAnalysisDOS = orderProfitAnalysisList.stream() | |
688 | + .collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (existing, replacement) -> existing)) | |
689 | + .values() | |
690 | + .stream() | |
691 | + .collect(Collectors.toList()); | |
692 | + if (CollectionUtils.isNotEmpty(orderProfitAnalysisDOS)) { | |
693 | + BigDecimal totalPrice = orderProfitAnalysisDOS.stream().map(order->BigDecimal.valueOf(order.getCustomerTotalPrice())) | |
694 | + .reduce(BigDecimal.ZERO,BigDecimal::add); | |
695 | + if(Objects.nonNull(totalPrice)){ | |
696 | + //客户总价金额汇总。 美元 | |
697 | + invoiceBillOrderDO.setTotalCustomerAmount(totalPrice.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
698 | + //设置实际应收金额汇总,要是没有发生扣款,也会被设置。 | |
699 | + invoiceBillOrderDO.setActualReceivableAmount(invoiceBillOrderDO.getTotalCustomerAmount()); | |
700 | + }else{ | |
701 | + invoiceBillOrderDO.setTotalCustomerAmount(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
702 | + invoiceBillOrderDO.setActualReceivableAmount(invoiceBillOrderDO.getTotalCustomerAmount()); | |
703 | + } | |
704 | + | |
705 | + } | |
706 | + } | |
707 | + //设置发生扣款金额汇总,避免没有发生扣款金额,也能在审核界面有对应的值。 | |
708 | + invoiceBillOrderDO.setDeductAmount(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
709 | + //设置其他费用汇总,避免没有发生扣款金额,也能在审核界面有对应的值。 | |
710 | + invoiceBillOrderDO.setOtherAmount(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
711 | + //设置实际付款金额。 | |
712 | + invoiceBillOrderDO.setTotalPayAmount(BigDecimal.ZERO.setScale(2,BigDecimal.ROUND_HALF_UP)); | |
713 | + updateById(invoiceBillOrderDO); | |
714 | + } | |
715 | + return ServerResult.success(); | |
716 | + } | |
717 | + | |
718 | + @Override | |
719 | + public ServerResult getBackRefundDate(InvoiceBillCreateVO createVO) { | |
720 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(createVO.getOrderIds()); | |
721 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
722 | + throw new BusinessException("勾选的订单信息不存在!"); | |
723 | + } | |
724 | + | |
725 | + InvoiceHoldTimeItemVO invoiceHoldTimeItemVO = getCustomerHoldTime(orderBaseInfoDOList); | |
726 | + | |
727 | + return ServerResult.success(calculateBackRefundDate(invoiceHoldTimeItemVO)); | |
728 | + } | |
729 | + | |
730 | + /** | |
731 | + * @param invoiceHoldTimeItemVO | |
732 | + * @return | |
733 | + */ | |
734 | + private String calculateBackRefundDate(InvoiceHoldTimeItemVO invoiceHoldTimeItemVO) { | |
735 | + Integer holdDays = getHoldTimeByCustomerCode(invoiceHoldTimeItemVO.getCustomerCode()); | |
736 | + LocalDateTime holdTime = DateUtils.parse(invoiceHoldTimeItemVO.getHoldTime(), DateUtils.DATE_TIME).plusDays(holdDays); | |
737 | + return DateUtils.format(holdTime, DateUtils.DATE); | |
738 | + } | |
739 | + | |
740 | + /** | |
741 | + * @param customerCode | |
742 | + * @return | |
743 | + */ | |
744 | + private Integer getHoldTimeByCustomerCode(String customerCode) { | |
745 | + SystemSettingDO systemSettingDO = systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
746 | + .eq(SystemSettingDO::getSettingCode, "customerCode").eq(SystemSettingDO::getSettingValue, customerCode) | |
747 | + .eq(SystemSettingDO::getRelationCode, "orderHodTime").last("limit 1")); | |
748 | + if (Objects.isNull(systemSettingDO)) { | |
749 | + return Constant.ZERO; | |
750 | + } | |
751 | + String holdTime = systemSettingDO.getRelationValue(); | |
752 | + return StringUtils.isBlank(holdTime) ? Constant.ZERO : Integer.parseInt(holdTime); | |
753 | + } | |
754 | + | |
755 | + /** | |
756 | + * @param orderBaseInfoDOList | |
757 | + * @return | |
758 | + */ | |
759 | + private InvoiceHoldTimeItemVO getCustomerHoldTime(List<OrderBaseInfoDO> orderBaseInfoDOList) { | |
760 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
761 | + return null; | |
762 | + } | |
763 | + | |
764 | + Map<String, OrderBaseInfoDO> holdTimeMap = new HashMap<String, OrderBaseInfoDO>(); | |
765 | + String maxHoldTime = null; | |
766 | + for (OrderBaseInfoDO baseInfoDO : orderBaseInfoDOList) { | |
767 | + if (StringUtils.isNotBlank(baseInfoDO.getOrderHodTime())) { | |
768 | + holdTimeMap.put(baseInfoDO.getOrderHodTime(), baseInfoDO); | |
769 | + if (StringUtils.isBlank(maxHoldTime)) { | |
770 | + maxHoldTime = baseInfoDO.getOrderHodTime(); | |
771 | + } else if (maxHoldTime.compareTo(baseInfoDO.getOrderHodTime()) <= 0) { | |
772 | + maxHoldTime = baseInfoDO.getOrderHodTime(); | |
773 | + } | |
774 | + } | |
775 | + } | |
776 | + if (StringUtils.isBlank(maxHoldTime)) { | |
777 | + return null; | |
778 | + } | |
779 | + InvoiceHoldTimeItemVO itemVO = new InvoiceHoldTimeItemVO(); | |
780 | + if (holdTimeMap.containsKey(maxHoldTime)) { | |
781 | + OrderBaseInfoDO baseInfoDO = holdTimeMap.get(maxHoldTime); | |
782 | + itemVO.setCustomerCode(baseInfoDO.getCustomerCode()); | |
783 | + itemVO.setHoldTime(maxHoldTime); | |
784 | + itemVO.setBaseInfoDO(baseInfoDO); | |
785 | + } | |
786 | + return itemVO; | |
787 | + } | |
788 | + | |
789 | + /** | |
790 | + * @param createVO | |
791 | + * @return | |
792 | + */ | |
793 | + private InvoiceBillOrderDO buildInvoiceBillOrderDO(InvoiceBillCreateVO createVO) { | |
794 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(createVO.getOrderIds()); | |
795 | + return InvoiceBillOrderDO.builder() | |
796 | + .invoiceNo(createVO.getInvoiceNo()) | |
797 | + .bgUrl(createVO.getBgUrl()) | |
798 | + .backRefundDate(createVO.getBackRefundDate()) | |
799 | + .status(ApplyStatusEnum.NO_COMMIT.getStatus()) | |
800 | + .businesPerson(orderBaseInfoDOList.get(0).getBusinessPerson()) | |
801 | + .build(); | |
802 | + } | |
803 | + | |
804 | + /** | |
805 | + * @param createVO | |
806 | + * @param invoiceBillOrderDO | |
807 | + * @return | |
808 | + */ | |
809 | + private List<InvoiceBillMappingDO> buildInvoiceBillMappingDOS(InvoiceBillCreateVO createVO, InvoiceBillOrderDO invoiceBillOrderDO) { | |
810 | + return createVO.getOrderIds().stream().map(x -> { | |
811 | + return InvoiceBillMappingDO.builder() | |
812 | + .orderId(x) | |
813 | + .invoiceBillId(invoiceBillOrderDO.getId()) | |
814 | + .invoiceNo(invoiceBillOrderDO.getInvoiceNo()) | |
815 | + .build(); | |
816 | + }).collect(Collectors.toList()); | |
817 | + } | |
818 | + | |
819 | + /** | |
820 | + * @param createVO | |
821 | + */ | |
822 | + private void validaBillOrder(InvoiceBillCreateVO createVO) { | |
823 | + if (CollectionUtils.isEmpty(createVO.getOrderIds())) { | |
824 | + throw new BusinessException("请勾选订单!"); | |
825 | + } | |
826 | + | |
827 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(createVO.getOrderIds()); | |
828 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
829 | + throw new BusinessException("勾选的订单信息不存在!"); | |
830 | + } | |
831 | + | |
832 | + if (orderBaseInfoDOList.size() != createVO.getOrderIds().size()) { | |
833 | + throw new BusinessException("勾选的订单信息有误!"); | |
834 | + } | |
835 | + //如果利润信息没有填写或者该订单的利润处于审核中也无法创建。 | |
836 | + List<OrderProfitAnalysisDO> orderProfitAnalysisDOS = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
837 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
838 | + .in(OrderProfitAnalysisDO::getOrderId, createVO.getOrderIds())); | |
839 | + List<OrderProfitAnalysisDO> profitAnalysisDOS = orderProfitAnalysisDOS.stream() | |
840 | + .collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (existing, replacement) -> existing)) | |
841 | + .values() | |
842 | + .stream() | |
843 | + .collect(Collectors.toList()); | |
844 | + if(CollectionUtils.isEmpty(orderProfitAnalysisDOS) || createVO.getOrderIds().size()!=profitAnalysisDOS.size()){ | |
845 | + throw new BusinessException("勾选的订单利润信息未填写!"); | |
846 | + } | |
847 | +// for (OrderProfitAnalysisDO analysisDO : orderProfitAnalysisDOS) { | |
848 | +// if (analysisDO.getCustomerPrice() == null ) { | |
849 | +// throw new BusinessException("勾选订单的利润信息未填写!"); | |
850 | +// } | |
851 | +// } | |
852 | + List<OrderFieldLockApplyDO> orderFieldLockApplyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | |
853 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
854 | + .in(OrderFieldLockApplyDO::getOrderId, createVO.getOrderIds()) | |
855 | + .eq(OrderFieldLockApplyDO::getType, ApplyTypeEnum.ORDER_PROFIT_APPLY.getType()) | |
856 | + .eq(OrderFieldLockApplyDO::getStatus,ApplyStatusEnum.WAIT_AUDIT.getStatus())); | |
857 | + if(CollectionUtils.isNotEmpty(orderFieldLockApplyDOS)){ | |
858 | + throw new BusinessException("订单中包含利润未审批的订单,无法创建!"); | |
859 | + } | |
860 | + | |
861 | + String invoiceNo = createVO.getInvoiceNo(); | |
862 | + | |
863 | + List<InvoiceBillOrderDO> invoiceBillOrderDOS = list(new LambdaQueryWrapper<InvoiceBillOrderDO>() | |
864 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
865 | + .eq(InvoiceBillOrderDO::getInvoiceNo, invoiceNo)); | |
866 | + if (CollectionUtils.isNotEmpty(invoiceBillOrderDOS)) { | |
867 | + throw new BusinessException("存在相同的invoice订单!"); | |
868 | + } | |
869 | + | |
870 | + List<InvoiceBillMappingDO> invoiceBillMappingDOList = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(InvoiceBillMappingDO::getOrderId, createVO.getOrderIds())); | |
871 | + if (CollectionUtils.isNotEmpty(invoiceBillMappingDOList)) { | |
872 | + throw new BusinessException("该勾选的订单已经绑定其他账单了!"); | |
873 | + } | |
874 | + } | |
875 | + | |
876 | + /** | |
877 | + * 修改数据 | |
878 | + * | |
879 | + * @param deductInfoVO 实例对象 | |
880 | + * @return 实例对象 | |
881 | + */ | |
882 | + @Override | |
883 | + public ServerResult updateDeductInfo(InvoiceBillDeductInfoVO deductInfoVO) { | |
884 | + if (Objects.isNull(deductInfoVO.getId())) { | |
885 | + throw new BusinessException("id 不能为空"); | |
886 | + } | |
887 | + InvoiceBillOrderDO invoiceBillOrderDo = getById(deductInfoVO.getId()); | |
888 | + if (Objects.isNull(invoiceBillOrderDo)) { | |
889 | + throw new BusinessException("应收款单据不存在"); | |
890 | + } | |
891 | + if(Objects.nonNull(invoiceBillOrderDo.getStatus()) && Constant.ENABLE_TEN==invoiceBillOrderDo.getStatus()){ | |
892 | + throw new BusinessException("应收款单据已审核通过,无法编辑"); | |
893 | + } | |
894 | + | |
895 | + 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 | + if(StringUtils.isNotBlank(invoiceBillOrderDo.getDeductUrl())){ | |
910 | +//记住:需要修改数据表对应的字段deduct_url的varchar数据范围,修改为1000左右。 | |
911 | + if(StringUtils.isNotBlank(deductInfoVO.getDeductUrl())){ | |
912 | + Set<String> deductUrlSet = new HashSet<>(Arrays.asList( | |
913 | + org.apache.commons.lang3.StringUtils.defaultString(invoiceBillOrderDo.getDeductUrl()).split(",") | |
914 | + )); | |
915 | + if(!deductUrlSet.contains(deductInfoVO.getDeductUrl())){ | |
916 | + deductUrlSet.add(deductInfoVO.getDeductUrl()); | |
917 | + String updateDeductUrl = String.join(",",deductUrlSet); | |
918 | + invoiceBillOrderDo.setDeductUrl(updateDeductUrl); | |
919 | + } | |
920 | + } | |
921 | + }else{ | |
922 | + if(StringUtils.isNotBlank(deductInfoVO.getDeductUrl())){ | |
923 | + invoiceBillOrderDo.setDeductUrl(deductInfoVO.getDeductUrl()); | |
924 | + } | |
925 | + } | |
926 | + invoiceBillOrderDo.setDeductAmount((deductInfoVO.getDeductAmount()==null?BigDecimal.ZERO:deductInfoVO.getDeductAmount()).setScale(2, RoundingMode.HALF_UP)); | |
927 | + //客户总金额减去发生扣款金额。 | |
928 | + invoiceBillOrderDo.setActualReceivableAmount((invoiceBillOrderDo.getTotalCustomerAmount().subtract(deductInfoVO.getDeductAmount()==null?BigDecimal.ZERO:deductInfoVO.getDeductAmount())).setScale(2, RoundingMode.HALF_UP)); | |
929 | + updateById(invoiceBillOrderDo); | |
930 | + return ServerResult.success(); | |
931 | + } | |
932 | + | |
933 | + @Override | |
934 | + public ServerResult updateAmountInfo(InvoiceBillAmountInfoVO amountInfoVO) { | |
935 | + if (Objects.isNull(amountInfoVO.getId())) { | |
936 | + throw new BusinessException("id 不能为空"); | |
937 | + } | |
938 | + InvoiceBillOrderDO invoiceBillOrderDo = getById(amountInfoVO.getId()); | |
939 | + if (Objects.isNull(invoiceBillOrderDo)) { | |
940 | + throw new BusinessException("应收款单据不存在"); | |
941 | + } | |
942 | + | |
943 | + checkCommitApply(invoiceBillOrderDo.getId()); | |
944 | + | |
945 | + | |
946 | + invoiceBillOrderDo.setActualPayedAmount1(amountInfoVO.getActualPayedAmount1() !=null ? amountInfoVO.getActualPayedAmount1() : BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP)); | |
947 | + invoiceBillOrderDo.setActualPayedAmount2(amountInfoVO.getActualPayedAmount2() !=null ? amountInfoVO.getActualPayedAmount2() : BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP)); | |
948 | + invoiceBillOrderDo.setActualPayedAmount3(amountInfoVO.getActualPayedAmount3() !=null ? amountInfoVO.getActualPayedAmount3() : BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP)); | |
949 | + invoiceBillOrderDo.setOtherAmount(amountInfoVO.getOtherAmount() !=null ? amountInfoVO.getOtherAmount() : BigDecimal.ZERO.setScale(2, RoundingMode.HALF_UP)); | |
950 | +// invoiceBillOrderDo.setActualReceivableAmount((invoiceBillOrderDo.getTotalCustomerAmount().subtract(invoiceBillOrderDo.getDeductAmount()).subtract(amountInfoVO.getOtherAmount() !=null ? amountInfoVO.getOtherAmount() : BigDecimal.ZERO)).setScale(2, RoundingMode.HALF_UP)); | |
951 | + //审核时让前端后获取这个参数,不再获取ActualReceivableAmount对应实际收款金额汇总 | |
952 | + invoiceBillOrderDo.setTotalPayAmount(invoiceBillOrderDo.getActualPayedAmount1().add(invoiceBillOrderDo.getActualPayedAmount2()).add(invoiceBillOrderDo.getActualPayedAmount3()).setScale(2, RoundingMode.HALF_UP)); | |
953 | + updateById(invoiceBillOrderDo); | |
954 | + return ServerResult.success(); | |
955 | + } | |
956 | + | |
957 | + /** | |
958 | + * @param id | |
959 | + */ | |
960 | + private void checkCommitApply(Long id) { | |
961 | + OrderFieldLockApplyDO applyDO = orderFieldLockApplyService.getOne(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | |
962 | + .eq(OrderFieldLockApplyDO::getEnableFlag, Constant.ENABLE_TEN) | |
963 | + .eq(OrderFieldLockApplyDO::getType, ApplyTypeEnum.INVOICE_BILL_APPLY.getType()) | |
964 | + .eq(OrderFieldLockApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus()) | |
965 | + .eq(OrderFieldLockApplyDO::getOrderId, id).last("limit 1")); | |
966 | + if (Objects.nonNull(applyDO)) { | |
967 | + throw new BusinessException("该账单还在审批中,请联系总经理审批后操作!"); | |
968 | + } | |
969 | + } | |
970 | + | |
971 | + @Override | |
972 | + public ServerResult commitApply(InvoiceBillCommitApplyVO commitApplyVO) { | |
973 | + InvoiceBillOrderDO invoiceBillOrderDO = getById(commitApplyVO.getId()); | |
974 | + if (Objects.isNull(invoiceBillOrderDO)) { | |
975 | + throw new BusinessException("账单不存在!"); | |
976 | + } | |
977 | + if(Constant.ENABLE_TEN==invoiceBillOrderDO.getStatus()){ | |
978 | + throw new BusinessException("该订单已通过审核!"); | |
979 | + } | |
980 | + Long userId = dataScope.getLoginUserId(); | |
981 | + String loginUserName = dataScope.getLoginUserName(); | |
982 | + checkApply(commitApplyVO.getId(), userId); | |
983 | + | |
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 | + invoiceBillOrderDO.setActualRefundDate(commitApplyVO.getActualRefundDate()); | |
1009 | + invoiceBillOrderDO.setPayee(commitApplyVO.getPayee()); | |
1010 | + invoiceBillOrderDO.setFinancePerson(loginUserName); | |
1011 | + OrderFieldLockApplyDO applyDO = initOrderFieldLockApplyDO(invoiceBillOrderDO, userId); | |
1012 | + transactionHelper.run(() -> { | |
1013 | + orderFieldLockApplyService.save(applyDO); | |
1014 | + invoiceBillOrderDO.setStatus(ApplyStatusEnum.WAIT_AUDIT.getStatus()); | |
1015 | + updateById(invoiceBillOrderDO); | |
1016 | + }); | |
1017 | + return ServerResult.success(); | |
1018 | + } | |
1019 | + | |
1020 | + /** | |
1021 | + * @param id | |
1022 | + * @param userId | |
1023 | + */ | |
1024 | + private void checkApply(Long id, Long userId) { | |
1025 | + List<OrderFieldLockApplyDO> applyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | |
1026 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
1027 | + .eq(OrderFieldLockApplyDO::getOrderId, id) | |
1028 | + .eq(OrderFieldLockApplyDO::getApplyUserId, userId) | |
1029 | + .eq(OrderFieldLockApplyDO::getType, ApplyTypeEnum.INVOICE_BILL_APPLY.getType()) | |
1030 | + .eq(OrderFieldLockApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus())); | |
1031 | + if (CollectionUtils.isNotEmpty(applyDOS)) { | |
1032 | + throw new BusinessException(ServerResultCode.APPLY_UNLOCK_FIELD_EXIST); | |
1033 | + } | |
1034 | + } | |
1035 | + | |
1036 | + /** | |
1037 | + * @param ids | |
1038 | + * @param userId | |
1039 | + */ | |
1040 | + private void checkApplyByIds(List<Long> ids, Long userId) { | |
1041 | + List<OrderFieldLockApplyDO> applyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | |
1042 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
1043 | + .in(OrderFieldLockApplyDO::getOrderId, ids) | |
1044 | + .eq(OrderFieldLockApplyDO::getApplyUserId, userId) | |
1045 | + .eq(OrderFieldLockApplyDO::getType, ApplyTypeEnum.INVOICE_BILL_APPLY.getType()) | |
1046 | + .eq(OrderFieldLockApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus())); | |
1047 | + if (CollectionUtils.isNotEmpty(applyDOS)) { | |
1048 | + throw new BusinessException(ServerResultCode.APPLY_UNLOCK_FIELD_EXIST); | |
1049 | + } | |
1050 | + } | |
1051 | + | |
1052 | + /** | |
1053 | + * @param invoiceBillOrderDO | |
1054 | + * @param userId | |
1055 | + * @return | |
1056 | + */ | |
1057 | + private OrderFieldLockApplyDO initOrderFieldLockApplyDO(InvoiceBillOrderDO invoiceBillOrderDO, Long userId) { | |
1058 | + OrderLockFieldVO lockFieldVO = new OrderLockFieldVO(); | |
1059 | + lockFieldVO.setInvoiceBillOrderDO(invoiceBillOrderDO); | |
1060 | + return OrderFieldLockApplyDO.builder() | |
1061 | + .applyUserId(userId) | |
1062 | + .auditUserId(null) | |
1063 | + .fields(JSONObject.toJSONString(lockFieldVO)) | |
1064 | + .orderId(invoiceBillOrderDO.getId()) | |
1065 | + .type(ApplyTypeEnum.INVOICE_BILL_APPLY.getType()) | |
1066 | + .remark(ApplyTypeEnum.INVOICE_BILL_APPLY.getDesc()) | |
1067 | + .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) | |
1068 | + .auditRoleCodes(RoleEnum.ADMIN.getCode()) | |
1069 | + .build(); | |
1070 | + } | |
1071 | + | |
1072 | + /** | |
1073 | + * 通过主键删除数据 | |
1074 | + * | |
1075 | + * @param invoiceBillOrderQueryVO 筛选条件 | |
1076 | + * @return 是否成功 | |
1077 | + */ | |
1078 | + @Override | |
1079 | + public ServerResult deleteById(InvoiceBillOrderQueryVO invoiceBillOrderQueryVO) { | |
1080 | + List<Long> ids = invoiceBillOrderQueryVO.getIds(); | |
1081 | + if (CollUtil.isEmpty(ids)) { | |
1082 | + return ServerResult.fail("ids 参数不能为空"); | |
1083 | + } | |
1084 | + List<InvoiceBillOrderDO> invoiceBillOrderList = listByIds(ids); | |
1085 | + if (CollUtil.isEmpty(invoiceBillOrderList)) { | |
1086 | + return ServerResult.success(); | |
1087 | + } | |
1088 | + checkApplyByIds(ids, dataScope.getLoginUserId()); | |
1089 | + invoiceBillOrderList.stream().forEach(invoiceBillOrderDO -> { | |
1090 | + if(Constant.ENABLE_TEN==invoiceBillOrderDO.getStatus()){ | |
1091 | + throw new BusinessException("该订单已通过审核,无法删除!"); | |
1092 | + } | |
1093 | + }); | |
1094 | + transactionHelper.run(() -> { | |
1095 | + removeByIds(ids); | |
1096 | + invoiceBillMappingService.remove(new LambdaQueryWrapper<InvoiceBillMappingDO>().in(InvoiceBillMappingDO::getInvoiceBillId, ids)); | |
1097 | + }); | |
1098 | + | |
1099 | + return ServerResult.success(); | |
1100 | + } | |
1101 | + | |
1102 | + @Override | |
1103 | + public ServerResult getDeductUrlById(InvoiceBillOrderQueryVO invoiceBillOrderQueryVO) { | |
1104 | + Long id = invoiceBillOrderQueryVO.getId(); | |
1105 | + if (Objects.isNull(id)) { | |
1106 | + return ServerResult.fail("id 参数不能为空"); | |
1107 | + } | |
1108 | + InvoiceBillOrderDO InvoiceBillOrderDO = getById(id); | |
1109 | + if(Objects.isNull( InvoiceBillOrderDO)){ | |
1110 | + return ServerResult.fail("invoice账单不存在!"); | |
1111 | + } | |
1112 | + if(StringUtils.isEmpty( InvoiceBillOrderDO.getDeductUrl())){ | |
1113 | + return ServerResult.fail("扣款单未上传!"); | |
1114 | + } | |
1115 | + Map<String, String> hashMap = new HashMap<>(); | |
1116 | + //获取每一个url的文件名称 | |
1117 | + Arrays.stream( InvoiceBillOrderDO.getDeductUrl().split(",")).forEach(x->{ | |
1118 | + try{ | |
1119 | + String preUrl = x.split("\\?")[0]; | |
1120 | + String fileName = preUrl.substring(preUrl.lastIndexOf("/") + 1); | |
1121 | + String decodUrle = URLDecoder.decode(fileName, StandardCharsets.UTF_8.name()); | |
1122 | + hashMap.put(decodUrle,x); | |
1123 | + }catch (Exception e){ | |
1124 | + throw new BusinessException("文件名错误!"); | |
1125 | + } | |
1126 | + }); | |
1127 | + return ServerResult.success(hashMap); | |
1128 | + } | |
1129 | + | |
1130 | + @Override | |
1131 | + public ServerResult reUploadBgurl(InvoiceBillCreateVO bgUrl) { | |
1132 | + Long id=bgUrl.getId(); | |
1133 | + if(Objects.isNull(id)){ | |
1134 | + return ServerResult.fail("id 参数不能为空"); | |
1135 | + } | |
1136 | + InvoiceBillOrderDO invoiceBillOrderDO = getById(id); | |
1137 | + if(Objects.isNull(invoiceBillOrderDO)){ | |
1138 | + return ServerResult.fail("invoice账单不存在!"); | |
1139 | + } | |
1140 | + if(StringUtils.isBlank(bgUrl.getBgUrl())){ | |
1141 | + return ServerResult.fail("上传报关单不能为空"); | |
1142 | + } | |
1143 | + //重新上传报关单 | |
1144 | + invoiceBillOrderDO.setBgUrl(bgUrl.getBgUrl()); | |
1145 | + updateById(invoiceBillOrderDO); | |
1146 | + return ServerResult.success(); | |
1147 | + } | |
1148 | + | |
1149 | + @Override | |
1150 | + public ServerResult exportReceipt(HttpServletResponse response,InvoiceBillOrderDO queryVO) throws IOException { | |
1151 | + | |
1152 | + XSSFWorkbook workbook = new XSSFWorkbook(); | |
1153 | + Sheet sheet = workbook.createSheet("收款单"); | |
1154 | + Row row = sheet.createRow(0); | |
1155 | + Cell cell = row.createCell(0); | |
1156 | + cell.setCellValue("收款单"); | |
1157 | + sheet.setMargin(sheet.LeftMargin,0.5); | |
1158 | + sheet.setMargin(sheet.RightMargin,0.5); | |
1159 | + | |
1160 | + | |
1161 | + CellStyle titleStyle = workbook.createCellStyle(); | |
1162 | + Font titleFont = workbook.createFont(); | |
1163 | + titleFont.setFontHeightInPoints((short) 20); // 字体大小 | |
1164 | + titleFont.setBold(true); // 加粗 | |
1165 | + titleFont.setFontName("宋体"); | |
1166 | + titleStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中 | |
1167 | + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中 | |
1168 | + // 合并单元格(第一行的第一列到第三列) | |
1169 | + sheet.addMergedRegion(new CellRangeAddress(0, 2, 0, 9)); | |
1170 | + titleStyle.setFont(titleFont); | |
1171 | + cell.setCellStyle(titleStyle); | |
1172 | + //第二行 | |
1173 | + Row row2 = sheet.createRow(3); | |
1174 | + Cell cell2 = row2.createCell(0); | |
1175 | + cell2.setCellValue("提交人:"); | |
1176 | + sheet.addMergedRegion(new CellRangeAddress(3, 4, 0, 1)); | |
1177 | + Cell cell3 = row2.createCell(2); | |
1178 | + cell3.setCellValue(""); | |
1179 | + sheet.addMergedRegion(new CellRangeAddress(3, 4, 2, 7)); | |
1180 | + Cell cell4 = row2.createCell(8); | |
1181 | + cell4.setCellValue("日期:"); | |
1182 | + sheet.addMergedRegion(new CellRangeAddress(3, 4, 8, 9)); | |
1183 | + //第三行 | |
1184 | + createMergedCell(sheet, workbook, 5, 0, 5, 6, 0, 1, "INVOICE编号"); | |
1185 | + createMergedCell(sheet, workbook, 5, 2, 5, 6, 2, 3, "客户总价金额汇总"); | |
1186 | + createMergedCell(sheet, workbook, 5, 4, 5, 6, 4, 4, "扣款金额汇总"); | |
1187 | + createMergedCell(sheet, workbook, 5, 5, 5, 6, 5, 6, "实际收款金额汇总"); | |
1188 | + createMergedCell(sheet, workbook, 5, 7, 5, 6, 7, 7, "其他费用汇总"); | |
1189 | + createMergedCell(sheet, workbook, 5, 8, 5, 6, 8, 8, "必须回款日期"); | |
1190 | + createMergedCell(sheet, workbook, 5, 9, 5, 6, 9, 9, "实际回款日期"); | |
1191 | + //第四行 | |
1192 | + createMergedCell(sheet, workbook, 7, 0, 7, 8, 0, 1, queryVO.getInvoiceNo() != null ? queryVO.getInvoiceNo() : ""); | |
1193 | + createMergedCell(sheet, workbook, 7, 2, 7, 8, 2, 3, queryVO.getTotalCustomerAmount()!= null ? "$"+queryVO.getTotalCustomerAmount().setScale(2, BigDecimal.ROUND_HALF_UP) : ""); | |
1194 | + createMergedCell(sheet, workbook, 7, 4, 7, 8, 4, 4, queryVO.getDeductAmount()!= null ? "$"+queryVO.getDeductAmount().setScale(2, BigDecimal.ROUND_HALF_UP) : ""); | |
1195 | + createMergedCell(sheet, workbook, 7, 5, 7, 8, 5, 6, queryVO.getTotalPayAmount()!=null ? "$"+queryVO.getTotalPayAmount().setScale(2, BigDecimal.ROUND_HALF_UP) : ""); | |
1196 | + createMergedCell(sheet, workbook, 7, 7, 7, 8, 7, 7, queryVO.getOtherAmount() != null ? "$"+queryVO.getOtherAmount().setScale(2, BigDecimal.ROUND_HALF_UP) : ""); | |
1197 | + createMergedCell(sheet, workbook, 7, 8, 7, 8, 8, 8, queryVO.getBackRefundDate() != null ? queryVO.getBackRefundDate() : ""); | |
1198 | + createMergedCell(sheet, workbook, 7, 9, 7, 8, 9, 9, queryVO.getActualRefundDate() != null ? queryVO.getActualRefundDate() : ""); | |
1199 | + //第五行 | |
1200 | + createMergedCell(sheet, workbook, 9, 0, 9, 10, 0, 1, "收款单位"); | |
1201 | + createMergedCell(sheet, workbook, 9, 2, 9, 10, 2, 9, queryVO.getPayee()); | |
1202 | + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8"); | |
1203 | + response.setHeader("Content-Disposition", "attachment; filename=\"-.xlsx\""); | |
1204 | + workbook.write(response.getOutputStream()); | |
1205 | + workbook.close(); | |
1206 | + return ServerResult.success(); | |
1207 | + | |
1208 | + } | |
1209 | + | |
1210 | + @Override | |
1211 | + public List<InvoiceBillOrderDO> getOverEvnetList() { | |
1212 | + return baseMapper.getOverEventList(); | |
1213 | + } | |
1214 | + | |
1215 | + | |
1216 | + public void createMergedCell(Sheet sheet, Workbook workbook, int rowIndex, int colIndex, int startRow, int endRow, int startCol, int endCol, String value) { | |
1217 | + // 创建或获取当前行 | |
1218 | + Row row = sheet.getRow(rowIndex); | |
1219 | + if (row == null) { | |
1220 | + row = sheet.createRow(rowIndex); | |
1221 | + } | |
1222 | + | |
1223 | + // 创建第一个单元格并设置值 | |
1224 | + Cell cell = row.createCell(colIndex); | |
1225 | + cell.setCellValue(value); | |
1226 | + | |
1227 | + // 创建边框样式 | |
1228 | + CellStyle titleStyle = workbook.createCellStyle(); | |
1229 | + Font titleFont = workbook.createFont(); | |
1230 | + titleFont.setFontHeightInPoints((short) 8.5); // 字体大小 | |
1231 | + titleFont.setBold(true); // 加粗 | |
1232 | + titleFont.setFontName("宋体"); | |
1233 | + titleStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中 | |
1234 | + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中 | |
1235 | + titleStyle.setFont(titleFont); | |
1236 | + | |
1237 | + // 设置边框样式 | |
1238 | + titleStyle.setBorderTop(BorderStyle.THIN); | |
1239 | + titleStyle.setBorderBottom(BorderStyle.THIN); | |
1240 | + titleStyle.setBorderLeft(BorderStyle.THIN); | |
1241 | + titleStyle.setBorderRight(BorderStyle.THIN); | |
1242 | + | |
1243 | + // 应用样式到第一个单元格 | |
1244 | + cell.setCellStyle(titleStyle); | |
1245 | + | |
1246 | + // 合并单元格 | |
1247 | + sheet.addMergedRegion(new CellRangeAddress(startRow, endRow, startCol, endCol)); | |
1248 | + | |
1249 | + // 为合并区域的每个单元格设置相同的样式 | |
1250 | + for (int rowIndexCurrent = startRow; rowIndexCurrent <= endRow; rowIndexCurrent++) { | |
1251 | + for (int colIndexCurrent = startCol; colIndexCurrent <= endCol; colIndexCurrent++) { | |
1252 | + Row currentRow = sheet.getRow(rowIndexCurrent); | |
1253 | + if (currentRow == null) { | |
1254 | + currentRow = sheet.createRow(rowIndexCurrent); | |
1255 | + } | |
1256 | + Cell currentCell = currentRow.getCell(colIndexCurrent); | |
1257 | + if (currentCell == null) { | |
1258 | + currentCell = currentRow.createCell(colIndexCurrent); | |
1259 | + } | |
1260 | + // 只为合并区域内的单元格设置样式 | |
1261 | + if (rowIndexCurrent == startRow && colIndexCurrent == colIndex) { | |
1262 | + currentCell.setCellStyle(titleStyle); // 为合并的单元格设置样式 | |
1263 | + } else { | |
1264 | + currentCell.setCellStyle(titleStyle); // 为其他合并的单元格设置样式 | |
1265 | + } | |
1266 | + } | |
1267 | + } | |
1268 | + } | |
1269 | +} | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... | ... | @@ -141,6 +141,11 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
141 | 141 | private ReceiveEmailMappingService receiveEmailMappingService; |
142 | 142 | @Resource |
143 | 143 | private AdminUserRoleService adminUserRoleService; |
144 | + @Resource | |
145 | + private InvoiceBillMappingService invoiceBillMappingService; | |
146 | + | |
147 | + @Resource | |
148 | + private CheckBillMappingService checkBillMappingService; | |
144 | 149 | |
145 | 150 | |
146 | 151 | /** |
... | ... | @@ -224,6 +229,9 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
224 | 229 | // 填充质检信息 |
225 | 230 | fillInspectionStageInfo(resultVOList); |
226 | 231 | |
232 | + // 填充发票信息 | |
233 | + fillInvoiceNo(resultVOList); | |
234 | + | |
227 | 235 | |
228 | 236 | if (locked) { |
229 | 237 | // 填充字段锁定信息 |
... | ... | @@ -867,7 +875,26 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
867 | 875 | /** |
868 | 876 | * @param orderInfoResultVOList |
869 | 877 | */ |
878 | + private void fillInvoiceNo(List<OrderInfoResultVO> orderInfoResultVOList) { | |
879 | + if (CollectionUtils.isEmpty(orderInfoResultVOList)) { | |
880 | + return; | |
881 | + } | |
870 | 882 | |
883 | + Set<Long> orderIds = orderInfoResultVOList.stream().map(OrderInfoResultVO::getId).collect(Collectors.toSet()); | |
884 | + List<InvoiceBillMappingDO> invoiceBillMappingDOS = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>() | |
885 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
886 | + .in(InvoiceBillMappingDO::getOrderId, orderIds)); | |
887 | + if (CollectionUtils.isEmpty(invoiceBillMappingDOS)) { | |
888 | + return; | |
889 | + } | |
890 | + Map<Long, InvoiceBillMappingDO> invoiceBillMappingDOMap = invoiceBillMappingDOS.stream().collect(Collectors.toMap(InvoiceBillMappingDO::getOrderId, Function.identity(), (v1, v2) -> v1)); | |
891 | + orderInfoResultVOList.forEach(result -> { | |
892 | + if (invoiceBillMappingDOMap.containsKey(result.getId())) { | |
893 | + InvoiceBillMappingDO invoiceBillMappingDO = invoiceBillMappingDOMap.get(result.getId()); | |
894 | + result.setInvoiceNo(invoiceBillMappingDO.getInvoiceNo()); | |
895 | + } | |
896 | + }); | |
897 | + } | |
871 | 898 | |
872 | 899 | /** |
873 | 900 | * @param orderInfoResultVOList |
... | ... | @@ -2115,6 +2142,19 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O |
2115 | 2142 | if (CollUtil.isEmpty(orderBaseInfoList)) { |
2116 | 2143 | return ServerResult.success(); |
2117 | 2144 | } |
2145 | + //判断是否存在invoice和订单应付款。 | |
2146 | + List<InvoiceBillMappingDO> InvoiceBillMappingDOS = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>() | |
2147 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
2148 | + .in(InvoiceBillMappingDO::getOrderId, ids)); | |
2149 | + if(CollectionUtils.isNotEmpty(InvoiceBillMappingDOS)){ | |
2150 | + throw new BusinessException("该订单已绑定Invoice账单,请先删除对应的Invoice账单!"); | |
2151 | + } | |
2152 | + List<CheckBillMappingDO> checkBillMappingDOList = checkBillMappingService.list(new LambdaQueryWrapper<CheckBillMappingDO>() | |
2153 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
2154 | + .in(CheckBillMappingDO::getOrderId, ids)); | |
2155 | + if(CollectionUtils.isNotEmpty(checkBillMappingDOList)){ | |
2156 | + throw new BusinessException("该订单已绑定生产科对账单号,请先删除对应的生产科对账单!"); | |
2157 | + } | |
2118 | 2158 | //todo 校验是否可以逻辑删除 |
2119 | 2159 | //订单基本信息 |
2120 | 2160 | LambdaUpdateWrapper<OrderBaseInfoDO> updateWrapper = new LambdaUpdateWrapper<OrderBaseInfoDO>() | ... | ... |
src/main/java/com/order/erp/service/order/impl/OrderFieldLockApplyServiceImpl.java
... | ... | @@ -71,6 +71,15 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
71 | 71 | |
72 | 72 | @Resource |
73 | 73 | private OrderInspectionStageService inspectionStageService; |
74 | + @Resource | |
75 | + private InvoiceBillOrderService invoiceBillOrderService; | |
76 | + | |
77 | + @Resource | |
78 | + private ProducePaymentCheckBillOrderService checkBillOrderService; | |
79 | + @Resource | |
80 | + private InvoiceBillMappingService invoiceBillMappingService; | |
81 | + @Resource | |
82 | + private CheckBillMappingService checkBillMappingService; | |
74 | 83 | |
75 | 84 | /** |
76 | 85 | * 通过ID查询单条数据 |
... | ... | @@ -116,19 +125,68 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
116 | 125 | BeanUtils.copyProperties(x, resultVO); |
117 | 126 | String fields = x.getFields(); |
118 | 127 | if (StringUtils.isNotBlank(fields)) { |
119 | - if (ApplyTypeEnum.FIELD_EDIT_APPLY.getType() == x.getType()) { | |
128 | + if (ApplyTypeEnum.FIELD_EDIT_APPLY.getType() .equals(x.getType())) { | |
120 | 129 | resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); |
121 | 130 | } |
122 | - if (ApplyTypeEnum.ORDER_REPORT_APPLY.getType() == x.getType()) { | |
131 | + if (ApplyTypeEnum.ORDER_REPORT_APPLY.getType().equals(x.getType())) { | |
123 | 132 | OrderLockFieldVO fieldVO = new OrderLockFieldVO(); |
124 | 133 | fieldVO.setReportFields(JSONObject.parseObject(fields, OrderCompletionReportFieldVO.class)); |
125 | 134 | resultVO.setFieldInfos(fieldVO); |
126 | 135 | } |
127 | - if (ApplyTypeEnum.ORDER_PROFIT_APPLY.getType() == x.getType()) { | |
136 | + if (ApplyTypeEnum.ORDER_PROFIT_APPLY.getType() .equals(x.getType())) { | |
128 | 137 | OrderLockFieldVO fieldVO = new OrderLockFieldVO(); |
129 | 138 | fieldVO.setProfitAnalysisFields(JSONObject.parseObject(fields, OrderProfitAnalysisFieldVO.class)); |
130 | 139 | resultVO.setFieldInfos(fieldVO); |
131 | 140 | } |
141 | + if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(x.getType())) { | |
142 | + //自定义。 解决待审批列表中的应收款要显示内部编码。 | |
143 | + OrderLockFieldVO orderLockFieldVO = JSONObject.parseObject(fields, OrderLockFieldVO.class); | |
144 | + if(Objects.nonNull(orderLockFieldVO.getInvoiceBillOrderDO()) && StringUtils.isNotBlank(orderLockFieldVO.getInvoiceBillOrderDO().getInvoiceNo())){ | |
145 | + List<InvoiceBillMappingDO> invoiceBillMappingDOList= invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>() | |
146 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
147 | + .eq(InvoiceBillMappingDO::getInvoiceNo, orderLockFieldVO.getInvoiceBillOrderDO().getInvoiceNo())); | |
148 | + if(CollectionUtils.isNotEmpty(invoiceBillMappingDOList)){ | |
149 | + Set<Long> orderIds = invoiceBillMappingDOList.stream().map(InvoiceBillMappingDO::getOrderId).filter(Objects::nonNull).collect(Collectors.toSet()); | |
150 | + if(CollectionUtils.isNotEmpty(orderIds)){ | |
151 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(orderIds); | |
152 | + if(CollectionUtils.isNotEmpty(orderBaseInfoDOList)){ | |
153 | + Set<String> innerNoList = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getInnerNo).filter(Objects::nonNull).collect(Collectors.toSet()); | |
154 | + if(CollectionUtils.isNotEmpty(innerNoList)){ | |
155 | + OrderBaseInfoVO orderBaseInfoVO = new OrderBaseInfoVO(); | |
156 | + resultVO.setOrderBaseInfo(orderBaseInfoVO); | |
157 | + orderBaseInfoVO.setInnerNo(resultVO.getOrderBaseInfo().getInnerNo().join(",", innerNoList)); | |
158 | + } | |
159 | + } | |
160 | + } | |
161 | + } | |
162 | + } | |
163 | + resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
164 | + } | |
165 | + if (ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(x.getType()) || ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(x.getType())) { | |
166 | + | |
167 | + OrderLockFieldVO orderLockFieldVO = JSONObject.parseObject(fields, OrderLockFieldVO.class); | |
168 | + if(Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && StringUtils.isNotBlank(orderLockFieldVO.getCheckBillOrderDO().getCheckNo())){ | |
169 | + List<CheckBillMappingDO> checkBillMappingDOList= checkBillMappingService.list(new LambdaQueryWrapper<CheckBillMappingDO>() | |
170 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
171 | + .eq(CheckBillMappingDO::getCheckNo, orderLockFieldVO.getCheckBillOrderDO().getCheckNo())); | |
172 | + if(CollectionUtils.isNotEmpty(checkBillMappingDOList)){ | |
173 | + Set<Long> orderIds = checkBillMappingDOList.stream().map(CheckBillMappingDO::getOrderId).filter(Objects::nonNull).collect(Collectors.toSet()); | |
174 | + if(CollectionUtils.isNotEmpty(orderIds)){ | |
175 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(orderIds); | |
176 | + if(CollectionUtils.isNotEmpty(orderBaseInfoDOList)){ | |
177 | + Set<String> innerNoList = orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getInnerNo).filter(Objects::nonNull).collect(Collectors.toSet()); | |
178 | + if(CollectionUtils.isNotEmpty(innerNoList)){ | |
179 | + OrderBaseInfoVO orderBaseInfoVO = new OrderBaseInfoVO(); | |
180 | + resultVO.setOrderBaseInfo(orderBaseInfoVO); | |
181 | + orderBaseInfoVO.setInnerNo(resultVO.getOrderBaseInfo().getInnerNo().join(",", innerNoList)); | |
182 | + } | |
183 | + } | |
184 | + } | |
185 | + } | |
186 | + } | |
187 | + | |
188 | + resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class)); | |
189 | + } | |
132 | 190 | } |
133 | 191 | return resultVO; |
134 | 192 | }).collect(Collectors.toList()); |
... | ... | @@ -311,6 +369,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
311 | 369 | roleSelect = RoleEnum.ADMIN; |
312 | 370 | } |
313 | 371 | } |
372 | + //这里是否还u需要添加财务角色权限的逻辑。 | |
314 | 373 | Set<Long> orderIds = new HashSet<>(); |
315 | 374 | if (StringUtils.isNotBlank(queryVO.getBusinessPerson()) || CollectionUtils.isNotEmpty(queryVO.getCustomerCode()) || CollectionUtils.isNotEmpty(queryVO.getInnerNo()) |
316 | 375 | || CollectionUtils.isNotEmpty(queryVO.getProductionDepartment()) || CollectionUtils.isNotEmpty(queryVO.getProjectNo())) { |
... | ... | @@ -331,9 +390,17 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
331 | 390 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
332 | 391 | .eq(Objects.nonNull(queryVO.getApplyUserId()), OrderFieldLockApplyDO::getApplyUserId, queryVO.getApplyUserId()) |
333 | 392 | .eq(Objects.nonNull(queryVO.getStatus()), OrderFieldLockApplyDO::getStatus, queryVO.getStatus()) |
334 | - .eq(Objects.nonNull(queryVO.getType()), OrderFieldLockApplyDO::getType, queryVO.getType()) | |
335 | 393 | .in(CollectionUtils.isNotEmpty(queryVO.getStatusList()), OrderFieldLockApplyDO::getStatus, queryVO.getStatusList()) |
336 | 394 | .in(CollectionUtils.isNotEmpty(orderIds), OrderFieldLockApplyDO::getOrderId, orderIds); |
395 | + if(Objects.nonNull(queryVO.getType())){ | |
396 | + if(Constant.FOUR == String.valueOf(queryVO.getType()).length()){ | |
397 | + int firstTwoDigits = queryVO.getType() / 100; | |
398 | + int lastTwoDigits = queryVO.getType() % 100; | |
399 | + queryWrapper.in(OrderFieldLockApplyDO::getType,firstTwoDigits,lastTwoDigits); | |
400 | + }else{ | |
401 | + queryWrapper.eq(Objects.nonNull(queryVO.getType()), OrderFieldLockApplyDO::getType, queryVO.getType()); | |
402 | + } | |
403 | + } | |
337 | 404 | if (Objects.isNull(roleSelect)) { |
338 | 405 | queryWrapper.like(Objects.nonNull(roleEnum), OrderFieldLockApplyDO::getAuditRoleCodes, roleEnum.getCode()); |
339 | 406 | }else { |
... | ... | @@ -384,9 +451,24 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
384 | 451 | applyDO.setAuditUserId(auditUserId); |
385 | 452 | applyDO.setStatus(ApplyStatusEnum.AUDIT_REFUSE.getStatus()); |
386 | 453 | applyDO.setRefuseRemark(refuseRemark); |
454 | + //应收款和应付款的申请,没有把orderId作为OrderFieldLockApplyDO的orderId,而是把InvoiceBillOrdeDO.getId()作为orderId来存储的。所以肯定查找不到。 | |
387 | 455 | OrderBaseInfoDO orderBaseInfoDO = orderBaseInfoService.getById(applyDO.getOrderId()); |
388 | - if (Objects.isNull(orderBaseInfoDO)) { | |
389 | - throw new BusinessException(ServerResultCode.ORDER_BASE_INFO_EMPTY); | |
456 | + if(!ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType()) && !ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(applyDO.getType()) && !ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())){ | |
457 | + if (Objects.isNull(orderBaseInfoDO)) { | |
458 | + throw new BusinessException(ServerResultCode.ORDER_BASE_INFO_EMPTY); | |
459 | + } | |
460 | + } | |
461 | + if(ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType())){ | |
462 | + InvoiceBillOrderDO invoiceBillOrderDO= invoiceBillOrderService.getById(applyDO.getOrderId()); | |
463 | + if(Objects.isNull(invoiceBillOrderDO)){ | |
464 | + throw new BusinessException(ServerResultCode. APPLY_NOT_EXIST); | |
465 | + } | |
466 | + } | |
467 | + if(ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(applyDO.getType()) || ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())){ | |
468 | + ProducePaymentCheckBillOrderDO checkBillOrderDO= checkBillOrderService.getById(applyDO.getOrderId()); | |
469 | + if(Objects.isNull(checkBillOrderDO)){ | |
470 | + throw new BusinessException(ServerResultCode. APPLY_NOT_EXIST); | |
471 | + } | |
390 | 472 | } |
391 | 473 | if (ApplyTypeEnum.ORDER_REPORT_APPLY.getType().equals(applyDO.getType())) { |
392 | 474 | |
... | ... | @@ -395,7 +477,40 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
395 | 477 | } else if (ApplyTypeEnum.ORDER_PROFIT_APPLY.getType().equals(applyDO.getType())) { |
396 | 478 | orderBaseInfoDO.setOrderStatus(OrderStatusEnum.PROFIT_AUDIT_REFUSE.getStatus()); |
397 | 479 | orderBaseInfoService.updateById(orderBaseInfoDO); |
480 | + } else if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType())) { | |
481 | + OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class); | |
482 | + InvoiceBillOrderDO invoiceBillOrderDO = lockFieldVO.getInvoiceBillOrderDO(); | |
483 | + invoiceBillOrderDO.setStatus(ApplyStatusEnum.AUDIT_REFUSE.getStatus()); | |
484 | + invoiceBillOrderService.updateById(invoiceBillOrderDO); | |
485 | + } else if (ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(applyDO.getType())) { | |
486 | + OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class); | |
487 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = lockFieldVO.getCheckBillOrderDO(); | |
488 | + checkBillOrderDO.setStatus(ApplyStatusEnum.AUDIT_REFUSE.getStatus()); | |
489 | + checkBillOrderService.updateById(checkBillOrderDO); | |
490 | + } else if(ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())){ | |
491 | + OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class); | |
492 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = lockFieldVO.getCheckBillOrderDO(); | |
493 | + checkBillOrderDO.setDepartmentInvoiceStatus(ApplyStatusEnum.AUDIT_REFUSE.getStatus()); | |
494 | + | |
495 | + ProducePaymentCheckBillOrderDO invoiceInfoDO = checkBillOrderService.getById(checkBillOrderDO.getId()); | |
496 | + //传递给审核一直都是最新的发票。 | |
497 | + if(com.order.erp.common.utils.StringUtils.isNotBlank(invoiceInfoDO.getInvoiceUrl())){ | |
498 | + log.info("checkBillOrderDO.getInvoiceUrl() 极有可能为空: {}", checkBillOrderDO.getInvoiceUrl()); | |
499 | + if(Arrays.stream(invoiceInfoDO.getInvoiceUrl().split(",")).anyMatch(item->item.equals(checkBillOrderDO.getInvoiceUrl()))){ | |
500 | + // 将 invoiceUrls 分割成 List 并删除相同项 | |
501 | + List<String> urlList = new ArrayList<>(Arrays.asList(invoiceInfoDO.getInvoiceUrl().split(","))); | |
502 | + urlList.removeIf(url -> url.equals(checkBillOrderDO.getInvoiceUrl())); | |
503 | + | |
504 | + // 将更新后的 List 转换回逗号分隔的字符串并重新设置 | |
505 | + String updatedInvoiceUrls = String.join(",", urlList); | |
506 | + checkBillOrderDO.setInvoiceUrl(updatedInvoiceUrls); | |
507 | + } | |
508 | + }else{ | |
509 | + checkBillOrderDO.setInvoiceUrl(null); | |
510 | + } | |
511 | + checkBillOrderService.updateById(checkBillOrderDO); | |
398 | 512 | } |
513 | + | |
399 | 514 | OrderAuditLogDO auditLogDO = OrderAuditLogDO.builder().applyId(applyDO.getId()).orderId(applyDO.getOrderId()).optType(ApplyStatusEnum.AUDIT_REFUSE.getDesc()).build(); |
400 | 515 | |
401 | 516 | applyService.updateById(applyDO); |
... | ... | @@ -516,6 +631,45 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp |
516 | 631 | } |
517 | 632 | orderBaseInfoDO.setOrderStatus(OrderStatusEnum.PROFIT_AUDIT_PASS.getStatus()); |
518 | 633 | orderBaseInfoService.updateById(orderBaseInfoDO); |
634 | + } else if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType())) { | |
635 | + applyDO.setAuditUserId(auditUserId); | |
636 | + applyDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus()); | |
637 | + OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class); | |
638 | + InvoiceBillOrderDO invoiceBillOrderDO = lockFieldVO.getInvoiceBillOrderDO(); | |
639 | + invoiceBillOrderDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus()); | |
640 | + invoiceBillOrderService.updateById(invoiceBillOrderDO); | |
641 | + } else if (ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(applyDO.getType())) { | |
642 | + applyDO.setAuditUserId(auditUserId); | |
643 | + applyDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus()); | |
644 | + OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class); | |
645 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = lockFieldVO.getCheckBillOrderDO(); | |
646 | + checkBillOrderDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus()); | |
647 | + checkBillOrderService.updateById(checkBillOrderDO); | |
648 | + } else if (ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())) { | |
649 | + applyDO.setAuditUserId(auditUserId); | |
650 | + applyDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus()); | |
651 | + OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class); | |
652 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = lockFieldVO.getCheckBillOrderDO(); | |
653 | + checkBillOrderDO.setDepartmentInvoiceStatus(ApplyStatusEnum.AUDIT_PASS.getStatus()); | |
654 | + //查询旧的。 | |
655 | + ProducePaymentCheckBillOrderDO invoiceInfoDO = checkBillOrderService.getById(checkBillOrderDO.getId()); | |
656 | + //传递给审核一直都是最新的发票。 | |
657 | + if(com.order.erp.common.utils.StringUtils.isNotBlank(invoiceInfoDO.getInvoiceUrl())){ | |
658 | + if(com.order.erp.common.utils.StringUtils.isNotBlank(checkBillOrderDO.getInvoiceUrl())){ | |
659 | + Set<String> deductUrlSet = new HashSet<>(Arrays.asList( | |
660 | + org.apache.commons.lang3.StringUtils.defaultString(invoiceInfoDO.getInvoiceUrl()).split(","))); | |
661 | + if(!deductUrlSet.contains(checkBillOrderDO.getInvoiceUrl())){ | |
662 | + deductUrlSet.add(checkBillOrderDO.getInvoiceUrl()); | |
663 | + String updateDeductUrl=String.join(",",deductUrlSet); | |
664 | + checkBillOrderDO.setInvoiceUrl(updateDeductUrl); | |
665 | + } | |
666 | + } | |
667 | + }else{ | |
668 | + if(com.order.erp.common.utils.StringUtils.isNotBlank(checkBillOrderDO.getInvoiceUrl())){ | |
669 | + checkBillOrderDO.setInvoiceUrl(checkBillOrderDO.getInvoiceUrl()); | |
670 | + } | |
671 | + } | |
672 | + checkBillOrderService.updateById(checkBillOrderDO); | |
519 | 673 | } |
520 | 674 | |
521 | 675 | OrderAuditLogDO auditLogDO = OrderAuditLogDO.builder().applyId(applyDO.getId()).orderId(applyDO.getOrderId()).optType(ApplyStatusEnum.AUDIT_PASS.getDesc()).build(); | ... | ... |
src/main/java/com/order/erp/service/order/impl/ProducePaymentCheckBillOrderServiceImpl.java
0 → 100644
1 | +package com.order.erp.service.order.impl; | |
2 | + | |
3 | +import cn.hutool.core.collection.CollUtil; | |
4 | +import com.alibaba.fastjson.JSONObject; | |
5 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
6 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
7 | +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
8 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
9 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
10 | +import com.github.stupdit1t.excel.common.PoiWorkbookType; | |
11 | +import com.github.stupdit1t.excel.core.ExcelHelper; | |
12 | +import com.github.stupdit1t.excel.style.CellPosition; | |
13 | +import com.order.erp.common.constant.Constant; | |
14 | +import com.order.erp.common.constant.ServerResult; | |
15 | +import com.order.erp.common.constant.ServerResultCode; | |
16 | +import com.order.erp.common.exception.BusinessException; | |
17 | +import com.order.erp.common.utils.DateUtils; | |
18 | +import com.order.erp.common.utils.StringUtils; | |
19 | +import com.order.erp.common.utils.TransactionHelper; | |
20 | +import com.order.erp.config.DataScope; | |
21 | +import com.order.erp.domain.ApplyStatusEnum; | |
22 | +import com.order.erp.domain.ApplyTypeEnum; | |
23 | +import com.order.erp.domain.RoleEnum; | |
24 | +import com.order.erp.domain.dto.BaseDO; | |
25 | +import com.order.erp.domain.dto.SystemSettingDO; | |
26 | +import com.order.erp.domain.dto.order.*; | |
27 | +import com.order.erp.domain.vo.order.*; | |
28 | +import com.order.erp.mapper.order.ProducePaymentCheckBillOrderMapper; | |
29 | +import com.order.erp.service.SystemSettingService; | |
30 | +import com.order.erp.service.order.*; | |
31 | +import lombok.extern.slf4j.Slf4j; | |
32 | +import org.apache.poi.ss.usermodel.*; | |
33 | +import org.apache.poi.ss.util.CellRangeAddress; | |
34 | +import org.apache.poi.xssf.usermodel.XSSFWorkbook; | |
35 | +import org.springframework.beans.BeanUtils; | |
36 | +import org.springframework.stereotype.Service; | |
37 | + | |
38 | +import javax.annotation.Resource; | |
39 | +import javax.servlet.http.HttpServletResponse; | |
40 | +import java.io.IOException; | |
41 | +import java.math.BigDecimal; | |
42 | +import java.math.RoundingMode; | |
43 | +import java.net.URLDecoder; | |
44 | +import java.nio.charset.StandardCharsets; | |
45 | +import java.time.LocalDateTime; | |
46 | +import java.util.*; | |
47 | +import java.util.function.Function; | |
48 | +import java.util.stream.Collectors; | |
49 | + | |
50 | +/** | |
51 | + * 生产科对账单应收账单(ProducePaymentCheckBillOrder)表服务实现类 | |
52 | + * | |
53 | + * @author makejava | |
54 | + * @since 2024-08-05 16:26:35 | |
55 | + */ | |
56 | +@Slf4j | |
57 | +@Service | |
58 | +public class ProducePaymentCheckBillOrderServiceImpl extends ServiceImpl<ProducePaymentCheckBillOrderMapper, ProducePaymentCheckBillOrderDO> implements ProducePaymentCheckBillOrderService { | |
59 | + | |
60 | + @Resource | |
61 | + private CheckBillMappingService checkBillMappingService; | |
62 | + | |
63 | + @Resource | |
64 | + private OrderBaseInfoService orderBaseInfoService; | |
65 | + | |
66 | + @Resource | |
67 | + private OrderProfitAnalysisService profitAnalysisService; | |
68 | + | |
69 | + @Resource | |
70 | + private SystemSettingService systemSettingService; | |
71 | + | |
72 | + @Resource | |
73 | + private OrderFieldLockApplyService orderFieldLockApplyService; | |
74 | + | |
75 | + @Resource | |
76 | + private DataScope dataScope; | |
77 | + | |
78 | + @Resource | |
79 | + private TransactionHelper transactionHelper; | |
80 | + | |
81 | + | |
82 | + /** | |
83 | + * 分页查询 | |
84 | + * | |
85 | + * @param queryVO 筛选条件 | |
86 | + * @return 查询结果 | |
87 | + */ | |
88 | + @Override | |
89 | + public ServerResult listByPage(ProducePaymentCheckBillOrderQueryVO queryVO) { | |
90 | + RoleEnum role = dataScope.getRole(); | |
91 | + LambdaQueryWrapper<ProducePaymentCheckBillOrderDO> queryWrapper = getQueryWrapper(queryVO); | |
92 | + //生产科,生产科只能看到属于自己的订单。 | |
93 | + if(Objects.nonNull(role) && role.getId().equals(RoleEnum.PRODUCE_USER.getId())){ | |
94 | + queryWrapper.eq(ProducePaymentCheckBillOrderDO::getProductionName, dataScope.getLoginUserName()); | |
95 | + } | |
96 | + //跟单也只能看到自己创建的,业务只能看到自己的 | |
97 | + if(Objects.nonNull(role) && role.getId().equals(RoleEnum.TRACKER_USER.getId())){ | |
98 | + queryWrapper.eq(ProducePaymentCheckBillOrderDO::getCreateBy, dataScope.getLoginUserName()); | |
99 | + } | |
100 | + if(Objects.nonNull(role) && role.getId().equals(RoleEnum.BUSINESS_USER.getId())){ | |
101 | + queryWrapper.eq(ProducePaymentCheckBillOrderDO::getBusinesPerson, dataScope.getLoginUserName()); | |
102 | + } | |
103 | + Page page = new Page<>(queryVO.getPage(), queryVO.getPageSize()); | |
104 | + IPage<ProducePaymentCheckBillOrderDO> iPage = page(page, queryWrapper); | |
105 | + return ServerResult.success(iPage); | |
106 | + } | |
107 | + | |
108 | + @Override | |
109 | + public ServerResult listBaseOrderInfoBy(ProducePaymentBaseOrderQueryVO queryVO) { | |
110 | + List<CheckBillMappingDO> mappingDOS = checkBillMappingService.list(new LambdaQueryWrapper<CheckBillMappingDO>() | |
111 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
112 | + .eq(CheckBillMappingDO::getCheckNo, queryVO.getCheckNo())); | |
113 | + if (CollectionUtils.isEmpty(mappingDOS)) { | |
114 | + return ServerResult.success(); | |
115 | + } | |
116 | + Set<Long> orderIds = mappingDOS.stream().map(CheckBillMappingDO::getOrderId).collect(Collectors.toSet()); | |
117 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(orderIds); | |
118 | + List<OrderProfitAnalysisDO> profitAnalysisDOList = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
119 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
120 | + .in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
121 | + Map<Long, OrderBaseInfoDO> orderBaseInfoDOMap = orderBaseInfoDOList.stream().collect(Collectors.toMap(OrderBaseInfoDO::getId, Function.identity(), (x, y) -> x)); | |
122 | + Map<Long, OrderProfitAnalysisDO> profitAnalysisDOMap = profitAnalysisDOList.stream().collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (x, y) -> x)); | |
123 | + List<CheckBillOrdeBaseResultVO> list = orderBaseInfoDOList.stream().map(x -> { | |
124 | + if (orderBaseInfoDOMap.containsKey(x.getId()) && profitAnalysisDOMap.containsKey(x.getId())) { | |
125 | + CheckBillOrdeBaseResultVO resultVO = new CheckBillOrdeBaseResultVO(); | |
126 | + resultVO.setCustomerCode(orderBaseInfoDOMap.get(x.getId()).getCustomerCode()); | |
127 | + resultVO.setProjectNo(orderBaseInfoDOMap.get(x.getId()).getProjectNo()); | |
128 | + resultVO.setInnerNo(orderBaseInfoDOMap.get(x.getId()).getInnerNo()); | |
129 | + resultVO.setCustomerPo(orderBaseInfoDOMap.get(x.getId()).getCustomerPo()); | |
130 | + resultVO.setCustomerStyle(orderBaseInfoDOMap.get(x.getId()).getCustomerStyle()); | |
131 | + resultVO.setModeleLo(orderBaseInfoDOMap.get(x.getId()).getModeleLo()); | |
132 | + resultVO.setSmallPicUrl(orderBaseInfoDOMap.get(x.getId()).getSmallPicUrl()); | |
133 | + resultVO.setOrderCount(orderBaseInfoDOMap.get(x.getId()).getOrderCount()); | |
134 | + resultVO.setProductionDepartmentPrice(profitAnalysisDOMap.get(x.getId()).getProductionDepartmentPrice()); | |
135 | + resultVO.setProductionDepartmentTotalPrice(profitAnalysisDOMap.get(x.getId()).getProductionDepartmentTotalPrice()); | |
136 | + return resultVO; | |
137 | + } else { | |
138 | + return null; | |
139 | + } | |
140 | + }).filter(Objects::nonNull).collect(Collectors.toList()); | |
141 | + return ServerResult.success(list); | |
142 | + } | |
143 | + | |
144 | + @Override | |
145 | + public ServerResult listAnalysisBy(ProducePaymentCheckBillOrderQueryVO queryVO) { | |
146 | + return ServerResult.success(getAnalysisResult(queryVO)); | |
147 | + } | |
148 | + | |
149 | + /** | |
150 | + * @param queryVO | |
151 | + * @return | |
152 | + */ | |
153 | + | |
154 | +// private CheckBillAnalysisResultVO getAnalysisResult(ProducePaymentCheckBillOrderQueryVO queryVO) { | |
155 | + //第二版开始。 | |
156 | + private List<CheckBillAnalysisResultVO> getAnalysisResult(ProducePaymentCheckBillOrderQueryVO queryVO) { | |
157 | + //第二版截止。 | |
158 | + LambdaQueryWrapper<ProducePaymentCheckBillOrderDO> queryWrapper = getQueryWrapper(queryVO); | |
159 | + List<ProducePaymentCheckBillOrderDO> checkBillOrderDOS = list(queryWrapper); | |
160 | + if (CollectionUtils.isEmpty(checkBillOrderDOS)) { | |
161 | + return null; | |
162 | + } | |
163 | + Set<Long> ids = checkBillOrderDOS.stream().map(ProducePaymentCheckBillOrderDO::getId).collect(Collectors.toSet()); | |
164 | + List<CheckBillMappingDO> checkBillMappingDOS = checkBillMappingService.list(new LambdaQueryWrapper<CheckBillMappingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(CheckBillMappingDO::getCheckBillId, ids)); | |
165 | + if (CollectionUtils.isEmpty(checkBillMappingDOS)) { | |
166 | + return null; | |
167 | + } | |
168 | + Map<Long, CheckBillMappingDO> orderBillMap = checkBillMappingDOS.stream().collect(Collectors.toMap(CheckBillMappingDO::getOrderId, Function.identity(), (x, y) -> x)); | |
169 | + List<CheckOrderBaseItemVO> itemVOS = getCheckOrderBaseItems(orderBillMap); | |
170 | + Map<String, ProducePaymentCheckBillOrderDO> checkBillOrderDOMap = checkBillOrderDOS.stream().collect(Collectors.toMap(ProducePaymentCheckBillOrderDO::getCheckNo, Function.identity(), (x, y) -> x)); | |
171 | + Map<String, List<CheckOrderBaseItemVO>> baseItemMap = itemVOS.stream().collect(Collectors.groupingBy(CheckOrderBaseItemVO::getCheckNo)); | |
172 | + List<CheckBillAnalysisExportVO> exportVOS = wrapperAnalysisExport(checkBillOrderDOMap, baseItemMap); | |
173 | + return wrapperAnalysisResultVO(exportVOS); | |
174 | + } | |
175 | + | |
176 | + /** | |
177 | + * @param exportVOS | |
178 | + * @return | |
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 | + | |
215 | + //第二版开始。 | |
216 | + private List<CheckBillAnalysisResultVO> wrapperAnalysisResultVO(List<CheckBillAnalysisExportVO> exportVOS) { | |
217 | + if (CollectionUtils.isEmpty(exportVOS)) { | |
218 | + return null; | |
219 | + } | |
220 | + Map<String,List<CheckBillAnalysisExportVO>> groupedByProductionDepartment =exportVOS.stream() | |
221 | + .collect(Collectors.groupingBy(CheckBillAnalysisExportVO::getProductionDepartment)); | |
222 | + List<CheckBillAnalysisResultVO> resultVOList=new ArrayList<>(); | |
223 | + groupedByProductionDepartment.forEach((productionDepartment,exportVOList) -> { | |
224 | + CheckBillAnalysisResultVO resultVO = CheckBillAnalysisResultVO.builder().exportVOS(exportVOList).build(); | |
225 | + BigDecimal productionDepartmentTotalPrice = new BigDecimal(Constant.ZERO); | |
226 | + BigDecimal deductAmount = new BigDecimal(Constant.ZERO); | |
227 | + BigDecimal actualPayedAmount = new BigDecimal(Constant.ZERO); | |
228 | +// BigDecimal calculateActualPayedAmount = new BigDecimal(Constant.ZERO); | |
229 | +// BigDecimal unPayedAmount = new BigDecimal(Constant.ZERO); | |
230 | + for (CheckBillAnalysisExportVO exportVO : exportVOList) { | |
231 | + if (Objects.nonNull(exportVO.getProductionDepartmentTotalPrice())) { | |
232 | + productionDepartmentTotalPrice = productionDepartmentTotalPrice.add(exportVO.getProductionDepartmentTotalPrice()); | |
233 | + } | |
234 | + if (Objects.nonNull(exportVO.getDeductAmount())) { | |
235 | + deductAmount = deductAmount.add(exportVO.getDeductAmount()); | |
236 | + } | |
237 | + if (Objects.nonNull(exportVO.getActualPayedAmount())) { | |
238 | + actualPayedAmount = actualPayedAmount.add(exportVO.getActualPayedAmount()); | |
239 | + } | |
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 | +// } | |
246 | + } | |
247 | + resultVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.setScale(2, RoundingMode.HALF_UP)); | |
248 | + resultVO.setDeductAmount(deductAmount.setScale(2, RoundingMode.HALF_UP)); | |
249 | + resultVO.setActualPayedAmount(actualPayedAmount.setScale(2, RoundingMode.HALF_UP)); | |
250 | + resultVO.setCalculateActualPayedAmount(resultVO.getProductionDepartmentTotalPrice().subtract(resultVO.getDeductAmount()).setScale(2, RoundingMode.HALF_UP)); | |
251 | + resultVO.setUnPayedAmount(resultVO.getCalculateActualPayedAmount().subtract(resultVO.getActualPayedAmount()).setScale(2, RoundingMode.HALF_UP)); | |
252 | + resultVOList.add(resultVO); | |
253 | + }); | |
254 | + return resultVOList; | |
255 | + } | |
256 | +//第二版结束。 | |
257 | + | |
258 | + /** | |
259 | + * @param checkBillOrderDOMap | |
260 | + * @param baseItemMap | |
261 | + * @return | |
262 | + */ | |
263 | + private List<CheckBillAnalysisExportVO> wrapperAnalysisExport(Map<String, ProducePaymentCheckBillOrderDO> checkBillOrderDOMap, Map<String, List<CheckOrderBaseItemVO>> baseItemMap) { | |
264 | + if (CollectionUtils.isEmpty(checkBillOrderDOMap)) { | |
265 | + return Collections.emptyList(); | |
266 | + } | |
267 | + List<CheckBillAnalysisExportVO> results = new ArrayList<>(); | |
268 | + for (Map.Entry<String, ProducePaymentCheckBillOrderDO> entry : checkBillOrderDOMap.entrySet()) { | |
269 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = entry.getValue(); | |
270 | + List<CheckBillAnalysisExportVO> exportVOS = transfer2analysisExportVO(checkBillOrderDO, baseItemMap); | |
271 | + if (CollectionUtils.isNotEmpty(exportVOS)) { | |
272 | + results.addAll(exportVOS); | |
273 | + } | |
274 | + } | |
275 | + return results; | |
276 | + } | |
277 | + | |
278 | + /** | |
279 | + * @param checkBillOrderDO | |
280 | + * @param baseItemMap | |
281 | + * @return | |
282 | + */ | |
283 | + private List<CheckBillAnalysisExportVO> transfer2analysisExportVO(ProducePaymentCheckBillOrderDO checkBillOrderDO, Map<String, List<CheckOrderBaseItemVO>> baseItemMap) { | |
284 | + List<CheckBillAnalysisExportVO> results = new ArrayList<>(); | |
285 | + String checkNo = checkBillOrderDO.getCheckNo(); | |
286 | + if (baseItemMap.containsKey(checkNo)) { | |
287 | + List<CheckOrderBaseItemVO> baseItemVOS = baseItemMap.get(checkNo); | |
288 | + Map<String, List<CheckOrderBaseItemVO>> listMap = baseItemVOS.stream().collect(Collectors.groupingBy(CheckOrderBaseItemVO::getProductionDepartment)); | |
289 | + for (Map.Entry<String, List<CheckOrderBaseItemVO>> entry : listMap.entrySet()) { | |
290 | + String productionDepartment = entry.getKey(); | |
291 | + List<CheckOrderBaseItemVO> itemVOS = entry.getValue(); | |
292 | + CheckBillAnalysisExportVO exportVO = buildAnalysisExportVO(checkBillOrderDO); | |
293 | + exportVO.setProductionDepartment(productionDepartment); | |
294 | + if (CollectionUtils.isEmpty(itemVOS)) { | |
295 | + exportVO.setProductionDepartmentTotalPrice(new BigDecimal(Constant.ZERO)); | |
296 | + } else { | |
297 | + BigDecimal productionDepartmentTotalPrice = new BigDecimal(Constant.ZERO); | |
298 | + for (CheckOrderBaseItemVO itemVO : itemVOS) { | |
299 | + productionDepartmentTotalPrice = productionDepartmentTotalPrice.add(Objects.nonNull(itemVO.getProductionDepartmentTotalPrice()) ? itemVO.getProductionDepartmentTotalPrice() : new BigDecimal(Constant.ZERO)); | |
300 | + } | |
301 | + exportVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.setScale(2, RoundingMode.HALF_UP)); | |
302 | + } | |
303 | + results.add(exportVO); | |
304 | + } | |
305 | + } | |
306 | + return results; | |
307 | + } | |
308 | + | |
309 | + /** | |
310 | + * @param checkBillOrderDO | |
311 | + * @return | |
312 | + */ | |
313 | + private CheckBillAnalysisExportVO buildAnalysisExportVO(ProducePaymentCheckBillOrderDO checkBillOrderDO) { | |
314 | + CheckBillAnalysisExportVO exportVO = new CheckBillAnalysisExportVO(); | |
315 | + BeanUtils.copyProperties(checkBillOrderDO, exportVO); | |
316 | + // 应付 | |
317 | + BigDecimal actualPayedAmount = Objects.nonNull(checkBillOrderDO.getActualPayedAmount()) ? checkBillOrderDO.getActualPayedAmount() : new BigDecimal(Constant.ZERO); | |
318 | + BigDecimal deductAmount = Objects.nonNull(checkBillOrderDO.getDeductAmount()) ? checkBillOrderDO.getDeductAmount() : new BigDecimal(Constant.ZERO); | |
319 | + BigDecimal totalActualPayedAmount = Objects.nonNull(checkBillOrderDO.getTotalActualPayedAmount()) ? checkBillOrderDO.getTotalActualPayedAmount() : new BigDecimal(Constant.ZERO); | |
320 | + // 返回 实付 | |
321 | + exportVO.setActualPayedAmount(totalActualPayedAmount.setScale(2, RoundingMode.HALF_UP)); | |
322 | +// BigDecimal calculateActualPayedAmount = actualPayedAmount.subtract(deductAmount); | |
323 | + //第二版 可删 应付减去实付 | |
324 | + BigDecimal calculateActualPayedAmount = actualPayedAmount.subtract(totalActualPayedAmount); | |
325 | + //返回应付 | |
326 | + exportVO.setCalculateActualPayedAmount(actualPayedAmount.setScale(2, RoundingMode.HALF_UP)); | |
327 | + // 返回未付 | |
328 | + exportVO.setUnPayedAmount(calculateActualPayedAmount.setScale(2, RoundingMode.HALF_UP)); | |
329 | + //保留小数点后两位。 | |
330 | + exportVO.setDeductAmount(exportVO.getDeductAmount().setScale(2, RoundingMode.HALF_UP)); | |
331 | + return exportVO; | |
332 | + } | |
333 | + | |
334 | + /** | |
335 | + * @param mappingDOMap | |
336 | + * @return | |
337 | + */ | |
338 | + private List<CheckOrderBaseItemVO> getCheckOrderBaseItems(Map<Long, CheckBillMappingDO> mappingDOMap) { | |
339 | + Set<Long> orderIds = mappingDOMap.keySet(); | |
340 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(orderIds); | |
341 | + List<OrderProfitAnalysisDO> profitAnalysisDOS = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
342 | + Map<Long, OrderBaseInfoDO> orderBaseInfoDOMap = orderBaseInfoDOList.stream().collect(Collectors.toMap(OrderBaseInfoDO::getId, Function.identity(), (x, y) -> x)); | |
343 | + Map<Long, OrderProfitAnalysisDO> profitAnalysisDOMap = profitAnalysisDOS.stream().collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (x, y) -> x)); | |
344 | + List<CheckOrderBaseItemVO> baseItemVOS = new ArrayList<>(); | |
345 | + for (Map.Entry<Long, OrderBaseInfoDO> entry : orderBaseInfoDOMap.entrySet()) { | |
346 | + Long orderId = entry.getKey(); | |
347 | + OrderBaseInfoDO baseInfoDO = entry.getValue(); | |
348 | + CheckOrderBaseItemVO itemVO = CheckOrderBaseItemVO.builder() | |
349 | + .orderId(orderId) | |
350 | + .productionDepartment(baseInfoDO.getProductionDepartment()) | |
351 | + .build(); | |
352 | + if (profitAnalysisDOMap.containsKey(orderId)) { | |
353 | + OrderProfitAnalysisDO profitAnalysisDO = profitAnalysisDOMap.get(orderId); | |
354 | + itemVO.setProductionDepartmentTotalPrice(Objects.isNull(profitAnalysisDO.getProductionDepartmentTotalPrice()) ? new BigDecimal(Constant.ZERO) : new BigDecimal(profitAnalysisDO.getProductionDepartmentTotalPrice())); | |
355 | + } else { | |
356 | + itemVO.setProductionDepartmentTotalPrice(new BigDecimal(Constant.ZERO)); | |
357 | + } | |
358 | + | |
359 | + if (mappingDOMap.containsKey(orderId)) { | |
360 | + CheckBillMappingDO mappingDO = mappingDOMap.get(orderId); | |
361 | + itemVO.setCheckNo(mappingDO.getCheckNo()); | |
362 | + } | |
363 | + baseItemVOS.add(itemVO); | |
364 | + } | |
365 | + return baseItemVOS; | |
366 | + } | |
367 | + | |
368 | + | |
369 | + @Override | |
370 | + public ServerResult export(HttpServletResponse response, ProducePaymentCheckBillOrderQueryVO queryVO) throws IOException { | |
371 | +// CheckBillAnalysisResultVO resultVO = getAnalysisResult(queryVO); | |
372 | + //第二版开始 | |
373 | + List<CheckBillAnalysisResultVO> resultVO = getAnalysisResult(queryVO); | |
374 | + //第二版结束 | |
375 | + if (Objects.isNull(resultVO)) { | |
376 | + throw new BusinessException("数据为空,不能导出!"); | |
377 | + } | |
378 | + List<Map<String, Object>> list = buildExportMapVOS(resultVO); | |
379 | + if (CollectionUtils.isNotEmpty(list)) { | |
380 | + List<String> keys = new ArrayList<>(list.get(Constant.ZERO).keySet()); | |
381 | + | |
382 | + ExcelHelper.opsExport(PoiWorkbookType.XLSX) | |
383 | + .opsSheet(list) | |
384 | + .opsHeader().simple().texts(keys).done() | |
385 | + .opsColumn().fields(keys).done() | |
386 | + .height(CellPosition.CELL, 750) | |
387 | + .done() | |
388 | + .export(response.getOutputStream()); | |
389 | + } | |
390 | + return ServerResult.success(); | |
391 | + } | |
392 | + | |
393 | + /** | |
394 | + * @param resultVO | |
395 | + * @return | |
396 | + */ | |
397 | +// private List<Map<String, Object>> buildExportMapVOS(CheckBillAnalysisResultVO resultVO) throws IOException { | |
398 | + //第二版开始。 | |
399 | + 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 | + | |
435 | + //第二版开始。 | |
436 | + List<CheckBillAnalysisExportVO> exportVOS = resultVO.stream().flatMap(x -> x.getExportVOS().stream()) | |
437 | + .collect(Collectors.toList()); | |
438 | + //第二版结束。 | |
439 | + | |
440 | + List<Map<String, Object>> list = new ArrayList<>(); | |
441 | + int i = 1; // Start index from 1 | |
442 | + // 根据生产科分组 | |
443 | + Map<String, List<CheckBillAnalysisExportVO>> customerGroupedMap = exportVOS.stream() | |
444 | + .collect(Collectors.groupingBy(CheckBillAnalysisExportVO::getProductionDepartment)); | |
445 | + boolean multipleCustomerCodes = customerGroupedMap.size() > 1; | |
446 | + BigDecimal totalCustomerTotalPrice = BigDecimal.ZERO; | |
447 | + BigDecimal totalDeductAmount = BigDecimal.ZERO; | |
448 | + BigDecimal totalActualReceivableAmount = BigDecimal.ZERO; | |
449 | + BigDecimal totalActualPayedAmount = BigDecimal.ZERO; | |
450 | + BigDecimal totalOtherAmount = BigDecimal.ZERO; | |
451 | + for (Map.Entry<String, List<CheckBillAnalysisExportVO>> entry : customerGroupedMap.entrySet()) { | |
452 | + String customerCode = entry.getKey(); | |
453 | + List<CheckBillAnalysisExportVO> customerItems = entry.getValue(); | |
454 | + BigDecimal subTotalCustomerTotalPrice = BigDecimal.ZERO; | |
455 | + BigDecimal subTotalDeductAmount = BigDecimal.ZERO; | |
456 | + BigDecimal subTotalActualReceivableAmount = BigDecimal.ZERO; | |
457 | + BigDecimal subTotalActualPayedAmount = BigDecimal.ZERO; | |
458 | + BigDecimal subTotalOtherAmount = BigDecimal.ZERO; | |
459 | + for (CheckBillAnalysisExportVO exportVO : customerItems) { | |
460 | + Map<String, Object> map = new LinkedHashMap<>(); | |
461 | + map.put("编号", i++); | |
462 | + map.put("生产科名称", exportVO.getProductionDepartment()); | |
463 | + map.put("生产科对账单号码", exportVO.getCheckNo()); | |
464 | + map.put("生产科总价汇总", "¥"+exportVO.getProductionDepartmentTotalPrice()); | |
465 | + map.put("生产科扣款金额汇总", "¥"+exportVO.getDeductAmount()); | |
466 | + map.put("生产科实际应付金额", "¥"+exportVO.getCalculateActualPayedAmount()); | |
467 | + map.put("实际付款金额汇总", "¥"+exportVO.getActualPayedAmount()); | |
468 | + map.put("未付金额金额","¥"+exportVO.getUnPayedAmount()); | |
469 | + map.put("生产科应付款日期", exportVO.getPayedDate()); | |
470 | + map.put("实际付款日期", exportVO.getActualPayedDate()); | |
471 | + list.add(map); | |
472 | + // 初始化数据 | |
473 | + subTotalCustomerTotalPrice = subTotalCustomerTotalPrice.add(exportVO.getProductionDepartmentTotalPrice() == null ? BigDecimal.ZERO : exportVO.getProductionDepartmentTotalPrice()); | |
474 | + subTotalDeductAmount = subTotalDeductAmount.add(exportVO.getDeductAmount() == null ? BigDecimal.ZERO : exportVO.getDeductAmount()); | |
475 | + subTotalActualReceivableAmount = subTotalActualReceivableAmount.add(exportVO.getCalculateActualPayedAmount() == null ? BigDecimal.ZERO : exportVO.getCalculateActualPayedAmount()); | |
476 | + subTotalActualPayedAmount = subTotalActualPayedAmount.add(exportVO.getActualPayedAmount() == null ? BigDecimal.ZERO : exportVO.getActualPayedAmount()); | |
477 | + subTotalOtherAmount = subTotalOtherAmount.add(exportVO.getUnPayedAmount() == null ? BigDecimal.ZERO : exportVO.getUnPayedAmount()); | |
478 | + } | |
479 | + // 如果客户编码有多个就添加小计。 | |
480 | + if (multipleCustomerCodes) { | |
481 | + Map<String, Object> subTotalMap = new LinkedHashMap<>(); | |
482 | + subTotalMap.put("编号", "小计"); | |
483 | + subTotalMap.put("生产科名称", ""); | |
484 | + subTotalMap.put("生产科对账单号码", ""); | |
485 | + subTotalMap.put("生产科总价汇总", "¥"+subTotalCustomerTotalPrice); | |
486 | + subTotalMap.put("生产科扣款金额汇总", "¥"+subTotalDeductAmount); | |
487 | + subTotalMap.put("生产科实际应付金额", "¥"+subTotalActualReceivableAmount); | |
488 | + subTotalMap.put("实际付款金额汇总", "¥"+subTotalActualPayedAmount); | |
489 | + subTotalMap.put("未付金额金额", "¥"+subTotalOtherAmount); | |
490 | + subTotalMap.put("生产科应付款日期", ""); | |
491 | + subTotalMap.put("实际付款日期", ""); | |
492 | + list.add(subTotalMap); | |
493 | + } | |
494 | + // Calculate totals | |
495 | + totalCustomerTotalPrice = totalCustomerTotalPrice.add(subTotalCustomerTotalPrice); | |
496 | + totalDeductAmount = totalDeductAmount.add(subTotalDeductAmount); | |
497 | + totalActualReceivableAmount = totalActualReceivableAmount.add(subTotalActualReceivableAmount); | |
498 | + totalActualPayedAmount = totalActualPayedAmount.add(subTotalActualPayedAmount); | |
499 | + totalOtherAmount = totalOtherAmount.add(subTotalOtherAmount); | |
500 | + | |
501 | + } | |
502 | + // 计算总数据。 | |
503 | + Map<String, Object> totalMap = new LinkedHashMap<>(); | |
504 | + totalMap.put("编号", "合计"); | |
505 | + totalMap.put("生产科名称", ""); | |
506 | + totalMap.put("生产科对账单号码", ""); | |
507 | + totalMap.put("生产科总价汇总", "¥"+totalCustomerTotalPrice); | |
508 | + totalMap.put("生产科扣款金额汇总", "¥"+totalDeductAmount); | |
509 | + totalMap.put("生产科实际应付金额", "¥"+totalActualReceivableAmount); | |
510 | + totalMap.put("实际付款金额汇总", "¥"+totalActualPayedAmount); | |
511 | + totalMap.put("未付金额金额", "¥"+totalOtherAmount); | |
512 | + totalMap.put("生产科应付款日期", ""); | |
513 | + totalMap.put("实际付款日期", ""); | |
514 | + list.add(totalMap); | |
515 | + return list; | |
516 | + } | |
517 | + | |
518 | + /** | |
519 | + * @param queryVO | |
520 | + * @return | |
521 | + */ | |
522 | + private LambdaQueryWrapper<ProducePaymentCheckBillOrderDO> getQueryWrapper(ProducePaymentCheckBillOrderQueryVO queryVO) { | |
523 | + LambdaQueryWrapper<ProducePaymentCheckBillOrderDO> queryWrapper = new LambdaQueryWrapper<ProducePaymentCheckBillOrderDO>() | |
524 | + .eq(ProducePaymentCheckBillOrderDO::getEnableFlag, Constant.ENABLE_TEN) | |
525 | + .eq(StringUtils.isNotBlank(queryVO.getCheckNo()), ProducePaymentCheckBillOrderDO::getCheckNo, queryVO.getCheckNo()) | |
526 | + .eq(Objects.nonNull(queryVO.getStatus()), ProducePaymentCheckBillOrderDO::getStatus, queryVO.getStatus()) | |
527 | + .ge(StringUtils.isNotBlank(queryVO.getStartTime()), ProducePaymentCheckBillOrderDO::getCreateTime, queryVO.getStartTime()) | |
528 | + .le(StringUtils.isNotBlank(queryVO.getEndTime()), ProducePaymentCheckBillOrderDO::getCreateTime, queryVO.getEndTime()) | |
529 | + .orderByDesc(ProducePaymentCheckBillOrderDO::getId); | |
530 | + if (CollectionUtils.isNotEmpty(queryVO.getIds())) { | |
531 | + queryWrapper.in(ProducePaymentCheckBillOrderDO::getId, queryVO.getIds()); | |
532 | + } else { | |
533 | + Set<Long> billOrderIds = filterBillOrderIdsBy(queryVO); | |
534 | + queryWrapper.in(CollectionUtils.isNotEmpty(billOrderIds), ProducePaymentCheckBillOrderDO::getId, billOrderIds); | |
535 | + } | |
536 | + return queryWrapper; | |
537 | + } | |
538 | + | |
539 | + /** | |
540 | + * @param queryVO | |
541 | + * @return | |
542 | + */ | |
543 | + private Set<Long> filterBillOrderIdsBy(ProducePaymentCheckBillOrderQueryVO queryVO) { | |
544 | + List<Long> orderIds = filterOrderIdsBy(queryVO); | |
545 | + if (CollectionUtils.isEmpty(orderIds)) { | |
546 | + return null; | |
547 | + } | |
548 | + List<CheckBillMappingDO> mappingDOS = checkBillMappingService.list(new LambdaQueryWrapper<CheckBillMappingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
549 | + .in(CollectionUtils.isNotEmpty(orderIds), CheckBillMappingDO::getOrderId, orderIds)); | |
550 | + if (CollectionUtils.isEmpty(mappingDOS)) { | |
551 | + Set<Long> ids = new HashSet<>(); | |
552 | + ids.add(-1L); | |
553 | + return ids; | |
554 | + } | |
555 | + return mappingDOS.stream().map(CheckBillMappingDO::getCheckBillId).collect(Collectors.toSet()); | |
556 | + } | |
557 | + | |
558 | + /** | |
559 | + * @param queryVO | |
560 | + * @return | |
561 | + */ | |
562 | + private List<Long> filterOrderIdsBy(ProducePaymentCheckBillOrderQueryVO queryVO) { | |
563 | + Boolean flag = false; | |
564 | + if (StringUtils.isNotBlank(queryVO.getCustomerCode())) { | |
565 | + flag = flag | true; | |
566 | + } | |
567 | + if (StringUtils.isNotBlank(queryVO.getProductionDepartment())) { | |
568 | + flag = flag | true; | |
569 | + } | |
570 | + if (StringUtils.isNotBlank(queryVO.getCustomerPo())) { | |
571 | + flag = flag | true; | |
572 | + } | |
573 | + if (StringUtils.isNotBlank(queryVO.getInnerNo())) { | |
574 | + flag = flag | true; | |
575 | + } | |
576 | + if (StringUtils.isNotBlank(queryVO.getProjectNo())) { | |
577 | + flag = flag | true; | |
578 | + } | |
579 | + if (!flag) { | |
580 | + return null; | |
581 | + } | |
582 | + LambdaQueryWrapper<OrderBaseInfoDO> queryWrapper = new LambdaQueryWrapper<OrderBaseInfoDO>() | |
583 | + .eq(OrderBaseInfoDO::getEnableFlag, Constant.ENABLE_TEN) | |
584 | + .eq(StringUtils.isNotBlank(queryVO.getCustomerCode()), OrderBaseInfoDO::getCustomerCode, queryVO.getCustomerCode()) | |
585 | + .eq(StringUtils.isNotBlank(queryVO.getProductionDepartment()), OrderBaseInfoDO::getProductionDepartment, queryVO.getProductionDepartment()) | |
586 | + .eq(StringUtils.isNotBlank(queryVO.getCustomerPo()), OrderBaseInfoDO::getCustomerPo, queryVO.getCustomerPo()) | |
587 | + .eq(StringUtils.isNotBlank(queryVO.getInnerNo()), OrderBaseInfoDO::getInnerNo, queryVO.getInnerNo()) | |
588 | + .eq(StringUtils.isNotBlank(queryVO.getProjectNo()), OrderBaseInfoDO::getProjectNo, queryVO.getProjectNo()); | |
589 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.list(queryWrapper); | |
590 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
591 | + List<Long> orderIds = new ArrayList<>(); | |
592 | + orderIds.add(-1L); | |
593 | + return orderIds; | |
594 | + } | |
595 | + return orderBaseInfoDOList.stream().map(OrderBaseInfoDO::getId).collect(Collectors.toList()); | |
596 | + } | |
597 | + | |
598 | + /** | |
599 | + * 创建生产科应付单据 | |
600 | + * | |
601 | + * @param createVO 实例对象 | |
602 | + * @return 实例对象 | |
603 | + */ | |
604 | + @Override | |
605 | + public ServerResult create(ProducePaymentCheckBillCreateVO createVO) { | |
606 | + if (Objects.nonNull(createVO.getId())) { | |
607 | + createVO.setId(null); | |
608 | + } | |
609 | + validaBillOrder(createVO); | |
610 | + | |
611 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = buildCheckBillOrderDO(createVO); | |
612 | + | |
613 | + Boolean success = transactionHelper.run(() -> { | |
614 | + save(checkBillOrderDO); | |
615 | + | |
616 | + checkBillMappingService.saveBatch(buildCheckBillMappingDOS(createVO, checkBillOrderDO)); | |
617 | + return true; | |
618 | + }); | |
619 | + if(success){ | |
620 | + List<CheckBillMappingDO> checkBillMappingDOS = checkBillMappingService.list(new LambdaQueryWrapper<CheckBillMappingDO>() | |
621 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
622 | + .eq(CheckBillMappingDO::getCheckNo, checkBillOrderDO.getCheckNo())); | |
623 | + if(CollectionUtils.isNotEmpty(checkBillMappingDOS)){ | |
624 | + List<Long> orderIds = checkBillMappingDOS.stream().map(CheckBillMappingDO::getOrderId).collect(Collectors.toList()); | |
625 | + List<OrderProfitAnalysisDO> orderProfitAnalysisList = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
626 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
627 | + .in(OrderProfitAnalysisDO::getOrderId, orderIds)); | |
628 | + List<OrderProfitAnalysisDO> orderProfitAnalysisDOS = orderProfitAnalysisList.stream() | |
629 | + .collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (existing, replacement) -> existing)) | |
630 | + .values() | |
631 | + .stream() | |
632 | + .collect(Collectors.toList()); | |
633 | + if(CollectionUtils.isNotEmpty(orderProfitAnalysisDOS)){ | |
634 | + BigDecimal totalConvertedAmount = orderProfitAnalysisDOS.stream().map(order -> BigDecimal.valueOf(order.getProductionDepartmentTotalPrice())) | |
635 | + .reduce(BigDecimal.ZERO, BigDecimal::add); | |
636 | + BigDecimal formattedSum = totalConvertedAmount.setScale(2, BigDecimal.ROUND_HALF_UP); | |
637 | + if(Objects.nonNull(formattedSum)){ | |
638 | + //客户总价金额汇总。 | |
639 | + checkBillOrderDO.setTotalProductionAmount(formattedSum); | |
640 | + //设置实际应付金额汇总。 | |
641 | + checkBillOrderDO.setActualPayedAmount(checkBillOrderDO.getTotalProductionAmount()); | |
642 | + }else { | |
643 | + checkBillOrderDO.setTotalProductionAmount( BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
644 | + checkBillOrderDO.setActualPayedAmount(checkBillOrderDO.getTotalProductionAmount()); | |
645 | + } | |
646 | + } | |
647 | + } | |
648 | + //设置实际付款金额汇总,避免没有填写直接审核时没有数据。 | |
649 | + checkBillOrderDO.setTotalActualPayedAmount(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
650 | + //设置生产科扣款金额汇总,避免没有填写扣款金额时,到时候审核没有数据。 | |
651 | + checkBillOrderDO.setDeductAmount(BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
652 | + //设置未付金额 | |
653 | + checkBillOrderDO.setUnPayedAmount(checkBillOrderDO.getTotalProductionAmount().subtract(checkBillOrderDO.getTotalActualPayedAmount()).subtract(checkBillOrderDO.getDeductAmount()).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
654 | + updateById(checkBillOrderDO); | |
655 | + } | |
656 | + return ServerResult.success(); | |
657 | + } | |
658 | + | |
659 | + /** | |
660 | + * 获取生产科应回款日期 | |
661 | + * | |
662 | + * @param createVO | |
663 | + * @return | |
664 | + */ | |
665 | + @Override | |
666 | + public ServerResult getPayedDate(ProducePaymentCheckBillCreateVO createVO) { | |
667 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(createVO.getOrderIds()); | |
668 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
669 | + throw new BusinessException("勾选的订单信息不存在!"); | |
670 | + } | |
671 | + | |
672 | + CheckHoldTimeItemVO checkHoldTimeItemVO = getProductionDepartmentHoldTime(orderBaseInfoDOList); | |
673 | + return ServerResult.success(calculatePayedDate(checkHoldTimeItemVO)); | |
674 | + } | |
675 | + | |
676 | + /** | |
677 | + * @param checkHoldTimeItemVO | |
678 | + * @return | |
679 | + */ | |
680 | + private String calculatePayedDate(CheckHoldTimeItemVO checkHoldTimeItemVO) { | |
681 | + Integer holdDays = getHoldTimeByProductionDepartment(checkHoldTimeItemVO.getProductionDepartment()); | |
682 | + LocalDateTime holdTime = DateUtils.parse(checkHoldTimeItemVO.getHoldTime(), DateUtils.DATE_TIME).plusDays(holdDays); | |
683 | + return DateUtils.format(holdTime, DateUtils.DATE); | |
684 | + } | |
685 | + | |
686 | + /** | |
687 | + * @param productionDepartment | |
688 | + * @return | |
689 | + */ | |
690 | + private Integer getHoldTimeByProductionDepartment(String productionDepartment) { | |
691 | + SystemSettingDO systemSettingDO = systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
692 | + .eq(SystemSettingDO::getSettingCode, "customerCode").eq(SystemSettingDO::getSettingValue, productionDepartment) | |
693 | + .eq(SystemSettingDO::getRelationCode, "produHodTime").last("limit 1")); | |
694 | + if (Objects.isNull(systemSettingDO)) { | |
695 | + return Constant.ZERO; | |
696 | + } | |
697 | + String holdTime = systemSettingDO.getRelationValue(); | |
698 | + return StringUtils.isBlank(holdTime) ? Constant.ZERO : Integer.parseInt(holdTime); | |
699 | + } | |
700 | + | |
701 | + /** | |
702 | + * @param orderBaseInfoDOList | |
703 | + * @return | |
704 | + */ | |
705 | + private CheckHoldTimeItemVO getProductionDepartmentHoldTime(List<OrderBaseInfoDO> orderBaseInfoDOList) { | |
706 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
707 | + return null; | |
708 | + } | |
709 | + | |
710 | + Map<String, OrderBaseInfoDO> holdTimeMap = new HashMap<String, OrderBaseInfoDO>(); | |
711 | + String maxHoldTime = null; | |
712 | + for (OrderBaseInfoDO baseInfoDO : orderBaseInfoDOList) { | |
713 | + if (StringUtils.isNotBlank(baseInfoDO.getOrderHodTime())) { | |
714 | + holdTimeMap.put(baseInfoDO.getOrderHodTime(), baseInfoDO); | |
715 | + if (StringUtils.isBlank(maxHoldTime)) { | |
716 | + maxHoldTime = baseInfoDO.getOrderHodTime(); | |
717 | + } else if (maxHoldTime.compareTo(baseInfoDO.getOrderHodTime()) <= 0) { | |
718 | + maxHoldTime = baseInfoDO.getOrderHodTime(); | |
719 | + } | |
720 | + } | |
721 | + } | |
722 | + if (StringUtils.isBlank(maxHoldTime)) { | |
723 | + return null; | |
724 | + } | |
725 | + CheckHoldTimeItemVO itemVO = new CheckHoldTimeItemVO(); | |
726 | + if (holdTimeMap.containsKey(maxHoldTime)) { | |
727 | + OrderBaseInfoDO baseInfoDO = holdTimeMap.get(maxHoldTime); | |
728 | + itemVO.setProductionDepartment(baseInfoDO.getProductionDepartment()); | |
729 | + itemVO.setHoldTime(maxHoldTime); | |
730 | + itemVO.setBaseInfoDO(baseInfoDO); | |
731 | + } | |
732 | + return itemVO; | |
733 | + } | |
734 | + | |
735 | + /** | |
736 | + * @param createVO | |
737 | + * @param checkBillOrderDO | |
738 | + * @return | |
739 | + */ | |
740 | + private List<CheckBillMappingDO> buildCheckBillMappingDOS(ProducePaymentCheckBillCreateVO createVO, ProducePaymentCheckBillOrderDO checkBillOrderDO) { | |
741 | + return createVO.getOrderIds().stream().map(x -> { | |
742 | + return CheckBillMappingDO.builder() | |
743 | + .orderId(x) | |
744 | + .checkBillId(checkBillOrderDO.getId()) | |
745 | + .checkNo(checkBillOrderDO.getCheckNo()) | |
746 | + .build(); | |
747 | + }).collect(Collectors.toList()); | |
748 | + } | |
749 | + | |
750 | + /** | |
751 | + * @param createVO | |
752 | + * @return | |
753 | + */ | |
754 | + private ProducePaymentCheckBillOrderDO buildCheckBillOrderDO(ProducePaymentCheckBillCreateVO createVO) { | |
755 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(createVO.getOrderIds()); | |
756 | + return ProducePaymentCheckBillOrderDO.builder() | |
757 | + .checkNo(createVO.getCheckNo()) | |
758 | + .payedDate(createVO.getPayedDate()) | |
759 | + .status(ApplyStatusEnum.NO_COMMIT.getStatus()) | |
760 | + .productionName(orderBaseInfoDOList.get(0).getProductionDepartment()) | |
761 | + .businesPerson(orderBaseInfoDOList.get(0).getBusinessPerson()) | |
762 | + .build(); | |
763 | + } | |
764 | + | |
765 | + /** | |
766 | + * @param createVO | |
767 | + */ | |
768 | + private void validaBillOrder(ProducePaymentCheckBillCreateVO createVO) { | |
769 | + if (CollectionUtils.isEmpty(createVO.getOrderIds())) { | |
770 | + throw new BusinessException("请勾选订单!"); | |
771 | + } | |
772 | + | |
773 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(createVO.getOrderIds()); | |
774 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | |
775 | + throw new BusinessException("勾选的订单信息不存在!"); | |
776 | + } | |
777 | + | |
778 | + if (orderBaseInfoDOList.size() != createVO.getOrderIds().size()) { | |
779 | + throw new BusinessException("勾选的订单信息有误!"); | |
780 | + } | |
781 | + //如果利润信息没有填写或者该订单的利润处于审核中也无法创建。 | |
782 | + List<OrderProfitAnalysisDO> orderProfitAnalysisDOS = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>() | |
783 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
784 | + .in(OrderProfitAnalysisDO::getOrderId, createVO.getOrderIds())); | |
785 | + List<OrderProfitAnalysisDO> profitAnalysisDOList = orderProfitAnalysisDOS.stream() | |
786 | + .collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (existing, replacement) -> existing)) | |
787 | + .values() | |
788 | + .stream() | |
789 | + .collect(Collectors.toList()); | |
790 | + if(CollectionUtils.isEmpty(orderProfitAnalysisDOS) || createVO.getOrderIds().size()!=profitAnalysisDOList.size()){ | |
791 | + throw new BusinessException("勾选订单的利润信息未填写!"); | |
792 | + } | |
793 | +// for (OrderProfitAnalysisDO analysisDO : orderProfitAnalysisDOS) { | |
794 | +// if (analysisDO.getCustomerPrice() == null ) { | |
795 | +// throw new BusinessException("勾选订单的利润信息未填写!"); | |
796 | +// } | |
797 | +// } | |
798 | + List<OrderFieldLockApplyDO> orderFieldLockApplyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | |
799 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
800 | + .in(OrderFieldLockApplyDO::getOrderId, createVO.getOrderIds()) | |
801 | + .eq(OrderFieldLockApplyDO::getType, ApplyTypeEnum.ORDER_PROFIT_APPLY.getType()) | |
802 | + .eq(OrderFieldLockApplyDO::getStatus,ApplyStatusEnum.WAIT_AUDIT.getStatus())); | |
803 | + if(CollectionUtils.isNotEmpty(orderFieldLockApplyDOS)){ | |
804 | + throw new BusinessException("订单中包含利润未审批的订单,无法创建!"); | |
805 | + } | |
806 | + | |
807 | + String checkNo = createVO.getCheckNo(); | |
808 | + | |
809 | + List<ProducePaymentCheckBillOrderDO> checkBillOrderDOS = list(new LambdaQueryWrapper<ProducePaymentCheckBillOrderDO>() | |
810 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
811 | + .eq(ProducePaymentCheckBillOrderDO::getCheckNo, checkNo)); | |
812 | + if (CollectionUtils.isNotEmpty(checkBillOrderDOS)) { | |
813 | + throw new BusinessException("存在相同的生产科对账单号!"); | |
814 | + } | |
815 | + | |
816 | + List<CheckBillMappingDO> checkBillMappingDOS = checkBillMappingService.list(new LambdaQueryWrapper<CheckBillMappingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(CheckBillMappingDO::getOrderId, createVO.getOrderIds())); | |
817 | + if (CollectionUtils.isNotEmpty(checkBillMappingDOS)) { | |
818 | + throw new BusinessException("该勾选的订单已经绑定其他账单了!"); | |
819 | + } | |
820 | + if(StringUtils.isNotEmpty(orderBaseInfoDOList.get(0).getProductionDepartment())){ | |
821 | + String firstProductionDepartment = orderBaseInfoDOList.get(0).getProductionDepartment(); | |
822 | + boolean allSame = orderBaseInfoDOList.stream() | |
823 | + .allMatch(order -> order.getProductionDepartment().equals(firstProductionDepartment)); | |
824 | + if(!allSame){ | |
825 | + throw new BusinessException("勾选订单的生产科不一致!"); | |
826 | + } | |
827 | + } | |
828 | + } | |
829 | + | |
830 | + /** | |
831 | + * 更新扣款信息 | |
832 | + * | |
833 | + * @param deductInfoVO 实例对象 | |
834 | + * @return 实例对象 | |
835 | + */ | |
836 | + @Override | |
837 | + public ServerResult updateDeductInfo(ProducePaymentCheckBillDeductInfoVO deductInfoVO) { | |
838 | + if (Objects.isNull(deductInfoVO.getId())) { | |
839 | + throw new BusinessException("id 不能为空"); | |
840 | + } | |
841 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = getById(deductInfoVO.getId()); | |
842 | + if (Objects.isNull(checkBillOrderDO)) { | |
843 | + throw new BusinessException("应付款单据不存在"); | |
844 | + } | |
845 | + if(Objects.nonNull(checkBillOrderDO.getStatus()) && Constant.ENABLE_TEN==checkBillOrderDO.getStatus()){ | |
846 | + throw new BusinessException("应付款单据已审核通过,无法编辑"); | |
847 | + } | |
848 | + | |
849 | + checkCommitApply(checkBillOrderDO.getId()); | |
850 | + //需要判断一下是否为空?不然知己以逗号分隔会报错。 | |
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 | + if(StringUtils.isNotBlank(checkBillOrderDO.getDeductUrl())){ | |
867 | +//记住:需要修改数据表对应的字段deduct_url的varchar数据范围,修改为1000左右。 | |
868 | + if(StringUtils.isNotBlank(deductInfoVO.getDeductUrl())){ | |
869 | + Set<String> deductUrlSet = new HashSet<>(Arrays.asList( | |
870 | + org.apache.commons.lang3.StringUtils.defaultString(checkBillOrderDO.getDeductUrl()).split(",") | |
871 | + )); | |
872 | + if(!deductUrlSet.contains(deductInfoVO.getDeductUrl())){ | |
873 | + deductUrlSet.add(deductInfoVO.getDeductUrl()); | |
874 | + String updatedDeductUrl = String.join(",", deductUrlSet); | |
875 | + checkBillOrderDO.setDeductUrl(updatedDeductUrl); | |
876 | + } | |
877 | + } | |
878 | + }else{ | |
879 | + if(StringUtils.isNotBlank(deductInfoVO.getDeductUrl())){ | |
880 | + checkBillOrderDO.setDeductUrl(deductInfoVO.getDeductUrl()); | |
881 | + } | |
882 | + } | |
883 | + checkBillOrderDO.setDeductDept(deductInfoVO.getDeductDept()); | |
884 | + checkBillOrderDO.setDeductAmount((deductInfoVO.getDeductAmount()==null? BigDecimal.ZERO:deductInfoVO.getDeductAmount()).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
885 | + checkBillOrderDO.setActualPayedAmount((checkBillOrderDO.getTotalProductionAmount().subtract(deductInfoVO.getDeductAmount()==null? BigDecimal.ZERO:deductInfoVO.getDeductAmount())).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
886 | + checkBillOrderDO.setUnPayedAmount((checkBillOrderDO.getTotalProductionAmount().subtract(checkBillOrderDO.getDeductAmount()).subtract(checkBillOrderDO.getTotalActualPayedAmount())).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
887 | + updateById(checkBillOrderDO); | |
888 | + return ServerResult.success(); | |
889 | + } | |
890 | + | |
891 | + /** | |
892 | + * 更新其他金额信息 | |
893 | + * | |
894 | + * @param amountInfoVO | |
895 | + * @return | |
896 | + */ | |
897 | + @Override | |
898 | + public ServerResult updateAmountInfo(ProducePaymentCheckBillAmountInfoVO amountInfoVO) { | |
899 | + if (Objects.isNull(amountInfoVO.getId())) { | |
900 | + throw new BusinessException("id 不能为空"); | |
901 | + } | |
902 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = getById(amountInfoVO.getId()); | |
903 | + if (Objects.isNull(checkBillOrderDO)) { | |
904 | + throw new BusinessException("应付款单据不存在"); | |
905 | + } | |
906 | + | |
907 | + checkCommitApply(checkBillOrderDO.getId()); | |
908 | + | |
909 | + checkBillOrderDO.setActualPayedAmount1(amountInfoVO.getActualPayedAmount1() != null ? amountInfoVO.getActualPayedAmount1().setScale(2, BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
910 | + checkBillOrderDO.setActualPayedAmount2(amountInfoVO.getActualPayedAmount2() != null ? amountInfoVO.getActualPayedAmount2().setScale(2, BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
911 | + checkBillOrderDO.setActualPayedAmount3(amountInfoVO.getActualPayedAmount3() != null ? amountInfoVO.getActualPayedAmount3().setScale(2, BigDecimal.ROUND_HALF_UP) : BigDecimal.ZERO.setScale(2, BigDecimal.ROUND_HALF_UP)); | |
912 | + checkBillOrderDO.setTotalActualPayedAmount(checkBillOrderDO.getActualPayedAmount1().add(checkBillOrderDO.getActualPayedAmount2().add(checkBillOrderDO.getActualPayedAmount3())).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
913 | + checkBillOrderDO.setUnPayedAmount((checkBillOrderDO.getTotalProductionAmount().subtract(checkBillOrderDO.getDeductAmount()).subtract(checkBillOrderDO.getTotalActualPayedAmount())).setScale(2, BigDecimal.ROUND_HALF_UP)); | |
914 | + updateById(checkBillOrderDO); | |
915 | + return ServerResult.success(); | |
916 | + } | |
917 | + | |
918 | + @Override | |
919 | + public ServerResult updateInvoiceInfo(ProducePaymentCheckBillInvoiceInfoVO invoiceInfoVO) { | |
920 | + Long loginUserId = dataScope.getLoginUserId(); | |
921 | + | |
922 | + Long id = invoiceInfoVO.getId(); | |
923 | + if (Objects.isNull(id)) { | |
924 | + return ServerResult.fail("id 参数不能为空"); | |
925 | + } | |
926 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = getById(id); | |
927 | + if(Objects.isNull(checkBillOrderDO)){ | |
928 | + return ServerResult.fail("生产科对账单号不存在!"); | |
929 | + } | |
930 | + if(Constant.ENABLE_TEN==checkBillOrderDO.getStatus()){ | |
931 | + throw new BusinessException("该订单已通过审核无法继续上传发票!"); | |
932 | + } | |
933 | + if(StringUtils.isBlank(invoiceInfoVO.getInvoiceUrl())){ | |
934 | + return ServerResult.success(); | |
935 | + } | |
936 | + //校验是否有处于待审核的发票。 | |
937 | + checkApply(id,loginUserId,ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType()); | |
938 | + //校验是否有处于待审核的订单。 | |
939 | + checkCommitApply(checkBillOrderDO.getId()); | |
940 | + 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 | +// } | |
956 | + //事务:待审核,设置为admin和财务才有权限审批。 | |
957 | + transactionHelper.run(() -> { | |
958 | + checkBillOrderDO.setDepartmentInvoiceStatus(ApplyStatusEnum.WAIT_AUDIT.getStatus()); | |
959 | + updateById(checkBillOrderDO); | |
960 | + //不保存,仅仅只是做一个审核,千万不要保存。目的是传递给审核的是最新的发票,审核通过才保存,不通过则不保存。 | |
961 | + checkBillOrderDO.setInvoiceUrl(invoiceInfoVO.getInvoiceUrl()); | |
962 | + //上述不保存,上述仅仅只是让审批时获取最新的一个审批发票记录。 | |
963 | + locakFieldVO.setCheckBillOrderDO(checkBillOrderDO); | |
964 | + OrderFieldLockApplyDO applyDO = OrderFieldLockApplyDO.builder() | |
965 | + .applyUserId(loginUserId) | |
966 | + .auditUserId(null) | |
967 | + .fields(JSONObject.toJSONString(locakFieldVO)) | |
968 | + .orderId(checkBillOrderDO.getId()) | |
969 | + .type(ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType()) | |
970 | + .remark(ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getDesc()) | |
971 | + .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) | |
972 | + .auditRoleCodes(RoleEnum.ADMIN.getCode() + Constant.COMMA_CHARACTER + RoleEnum.FINANCE_USER.getCode()) | |
973 | + .build(); | |
974 | + orderFieldLockApplyService.save(applyDO); | |
975 | + }); | |
976 | + return ServerResult.success(); | |
977 | + } | |
978 | + | |
979 | + @Override | |
980 | + public ServerResult commitApply(ProducePaymentCheckBillCommitApplyVO commitApplyVO) { | |
981 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = getById(commitApplyVO.getId()); | |
982 | + if (Objects.isNull(checkBillOrderDO)) { | |
983 | + throw new BusinessException("账单不存在!"); | |
984 | + } | |
985 | + if(checkBillOrderDO.getStatus()==Constant.ENABLE_TEN){ | |
986 | + throw new BusinessException("该订单已通过审核!"); | |
987 | + } | |
988 | + Long userId = dataScope.getLoginUserId(); | |
989 | + String loginUserName = dataScope.getLoginUserName(); | |
990 | + checkApply(commitApplyVO.getId(), userId,ApplyTypeEnum.CHECK_BILL_APPLY.getType()); | |
991 | + | |
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 | + checkBillOrderDO.setActualPayedDate(commitApplyVO.getActualPayedDate()); | |
1017 | + checkBillOrderDO.setFinancePerson(loginUserName); | |
1018 | + OrderFieldLockApplyDO applyDO = initOrderFieldLockApplyDO(checkBillOrderDO, userId); | |
1019 | + transactionHelper.run(() -> { | |
1020 | + orderFieldLockApplyService.save(applyDO); | |
1021 | + checkBillOrderDO.setStatus(ApplyStatusEnum.WAIT_AUDIT.getStatus()); | |
1022 | +// checkBillOrderDO.setActualPayedDate(DateUtils.format(LocalDateTime.now(), DateUtils.DATE)); | |
1023 | + updateById(checkBillOrderDO); | |
1024 | + }); | |
1025 | + return ServerResult.success(); | |
1026 | + } | |
1027 | + | |
1028 | + /** | |
1029 | + * @param checkBillOrderDO | |
1030 | + * @param userId | |
1031 | + * @return | |
1032 | + */ | |
1033 | + private OrderFieldLockApplyDO initOrderFieldLockApplyDO(ProducePaymentCheckBillOrderDO checkBillOrderDO, Long userId) { | |
1034 | + OrderLockFieldVO lockFieldVO = new OrderLockFieldVO(); | |
1035 | + lockFieldVO.setCheckBillOrderDO(checkBillOrderDO); | |
1036 | + return OrderFieldLockApplyDO.builder() | |
1037 | + .applyUserId(userId) | |
1038 | + .auditUserId(null) | |
1039 | + .fields(JSONObject.toJSONString(lockFieldVO)) | |
1040 | + .orderId(checkBillOrderDO.getId()) | |
1041 | + .type(ApplyTypeEnum.CHECK_BILL_APPLY.getType()) | |
1042 | + .remark(ApplyTypeEnum.CHECK_BILL_APPLY.getDesc()) | |
1043 | + .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) | |
1044 | + .auditRoleCodes(RoleEnum.ADMIN.getCode()) | |
1045 | + .build(); | |
1046 | + } | |
1047 | + | |
1048 | + /** | |
1049 | + * @param id | |
1050 | + * @param userId | |
1051 | + */ | |
1052 | + private void checkApply(Long id, Long userId,Integer applyType) { | |
1053 | + List<OrderFieldLockApplyDO> applyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | |
1054 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
1055 | + .eq(OrderFieldLockApplyDO::getOrderId, id) | |
1056 | + .eq(OrderFieldLockApplyDO::getApplyUserId, userId) | |
1057 | + .eq(OrderFieldLockApplyDO::getType, applyType) | |
1058 | + .eq(OrderFieldLockApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus())); | |
1059 | + if (CollectionUtils.isNotEmpty(applyDOS)) { | |
1060 | + throw new BusinessException(ServerResultCode.APPLY_UNLOCK_FIELD_EXIST); | |
1061 | + } | |
1062 | + } | |
1063 | + | |
1064 | + /** | |
1065 | + * @param id | |
1066 | + */ | |
1067 | + private void checkCommitApply(Long id) { | |
1068 | + OrderFieldLockApplyDO applyDO = orderFieldLockApplyService.getOne(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | |
1069 | + .eq(OrderFieldLockApplyDO::getEnableFlag, Constant.ENABLE_TEN) | |
1070 | + .eq(OrderFieldLockApplyDO::getType, ApplyTypeEnum.CHECK_BILL_APPLY.getType()) | |
1071 | + .eq(OrderFieldLockApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus()) | |
1072 | + .eq(OrderFieldLockApplyDO::getOrderId, id).last("limit 1")); | |
1073 | + if (Objects.nonNull(applyDO)) { | |
1074 | + throw new BusinessException("该账单还在审批中,请联系总经理审批后操作!"); | |
1075 | + } | |
1076 | + } | |
1077 | + | |
1078 | + /** | |
1079 | + * @param ids | |
1080 | + * @param userId | |
1081 | + */ | |
1082 | + private void checkApplyByIds(List<Long> ids, Long userId) { | |
1083 | + List<OrderFieldLockApplyDO> applyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | |
1084 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
1085 | + .in(OrderFieldLockApplyDO::getOrderId, ids) | |
1086 | + .eq(OrderFieldLockApplyDO::getApplyUserId, userId) | |
1087 | + .eq(OrderFieldLockApplyDO::getType, ApplyTypeEnum.CHECK_BILL_APPLY.getType()) | |
1088 | + .eq(OrderFieldLockApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus())); | |
1089 | + if (CollectionUtils.isNotEmpty(applyDOS)) { | |
1090 | + throw new BusinessException(ServerResultCode.APPLY_UNLOCK_FIELD_EXIST); | |
1091 | + } | |
1092 | + } | |
1093 | + | |
1094 | + /** | |
1095 | + * 通过主键删除数据 | |
1096 | + * | |
1097 | + * @param producePaymentCheckBillOrderQueryVO 筛选条件 | |
1098 | + * @return 是否成功 | |
1099 | + */ | |
1100 | + @Override | |
1101 | + public ServerResult deleteById(ProducePaymentCheckBillOrderQueryVO producePaymentCheckBillOrderQueryVO) { | |
1102 | + List<Long> ids = producePaymentCheckBillOrderQueryVO.getIds(); | |
1103 | + if (CollUtil.isEmpty(ids)) { | |
1104 | + return ServerResult.fail("ids 参数不能为空"); | |
1105 | + } | |
1106 | + List<ProducePaymentCheckBillOrderDO> checkBillOrderDOS = listByIds(ids); | |
1107 | + if (CollUtil.isEmpty(checkBillOrderDOS)) { | |
1108 | + return ServerResult.success(); | |
1109 | + } | |
1110 | + checkBillOrderDOS.stream().forEach(checkBillOrderDO ->{ | |
1111 | + if(Constant.ENABLE_TEN==checkBillOrderDO.getStatus()){ | |
1112 | + throw new BusinessException("该订单已通过审核,无法删除!"); | |
1113 | + } | |
1114 | + }); | |
1115 | + checkApplyByIds(ids, dataScope.getLoginUserId()); | |
1116 | + transactionHelper.run(() -> { | |
1117 | + removeByIds(ids); | |
1118 | + checkBillMappingService.remove(new LambdaQueryWrapper<CheckBillMappingDO>().in(CheckBillMappingDO::getCheckBillId, ids)); | |
1119 | + }); | |
1120 | + | |
1121 | + return ServerResult.success(); | |
1122 | + } | |
1123 | + | |
1124 | + @Override | |
1125 | + public ServerResult getDeductUrlById(ProducePaymentCheckBillOrderQueryVO producePaymentCheckBillOrderQueryVO) { | |
1126 | + Long id = producePaymentCheckBillOrderQueryVO.getId(); | |
1127 | + if (Objects.isNull(id)) { | |
1128 | + return ServerResult.fail("id 参数不能为空"); | |
1129 | + } | |
1130 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = getById(id); | |
1131 | + if(Objects.isNull(checkBillOrderDO)){ | |
1132 | + return ServerResult.fail("生产科对账单号不存在!"); | |
1133 | + } | |
1134 | + if(StringUtils.isBlank(checkBillOrderDO.getDeductUrl())){ | |
1135 | + return ServerResult.fail("扣款单未上传!"); | |
1136 | + } | |
1137 | + Map<String, String> hashMap = new HashMap<>(); | |
1138 | + if(StringUtils.isBlank(checkBillOrderDO.getDeductUrl())){ | |
1139 | + return ServerResult.success(); | |
1140 | + } | |
1141 | + //获取每一个url的文件名称 | |
1142 | + Arrays.stream(checkBillOrderDO.getDeductUrl().split(",")).forEach(x->{ | |
1143 | + try{ | |
1144 | + String preUrl = x.contains("?") ? x.split("\\?")[0] : x; | |
1145 | + String fileName = preUrl.substring(preUrl.lastIndexOf("/") + 1); | |
1146 | + String decodeUrl = URLDecoder.decode(fileName, StandardCharsets.UTF_8.name()); | |
1147 | + hashMap.put(decodeUrl,x); | |
1148 | + }catch(Exception e){ | |
1149 | + throw new BusinessException("文件名错误!"); | |
1150 | + } | |
1151 | + }); | |
1152 | + return ServerResult.success(hashMap); | |
1153 | + } | |
1154 | + | |
1155 | + @Override | |
1156 | + public ServerResult getInvoiceUrlById(ProducePaymentCheckBillOrderQueryVO producePaymentCheckBillOrderQueryVO) { | |
1157 | + Long id = producePaymentCheckBillOrderQueryVO.getId(); | |
1158 | + if (Objects.isNull(id)) { | |
1159 | + return ServerResult.fail("id 参数不能为空"); | |
1160 | + } | |
1161 | + ProducePaymentCheckBillOrderDO checkBillOrderDO = getById(id); | |
1162 | + if(Objects.isNull(checkBillOrderDO)){ | |
1163 | + return ServerResult.fail("生产科对账单号不存在!"); | |
1164 | + } | |
1165 | + if(StringUtils.isBlank(checkBillOrderDO.getInvoiceUrl())){ | |
1166 | + return ServerResult.fail("生产科发票未上传或者处于审核状态!"); | |
1167 | + } | |
1168 | + Map<String, String> hashMap = new HashMap<>(); | |
1169 | + if(StringUtils.isBlank(checkBillOrderDO.getInvoiceUrl())){ | |
1170 | + return ServerResult.success(); | |
1171 | + } | |
1172 | + //获取每一个url的文件名称 | |
1173 | + Arrays.stream(checkBillOrderDO.getInvoiceUrl().split(",")).forEach(x->{ | |
1174 | + try{ | |
1175 | + String preUrl = x.contains("?") ? x.split("\\?")[0] : x; | |
1176 | + String fileName = preUrl.substring(preUrl.lastIndexOf("/") + 1); | |
1177 | + String decodeUrl = URLDecoder.decode(fileName, StandardCharsets.UTF_8.name()); | |
1178 | + hashMap.put(decodeUrl,x); | |
1179 | + }catch(Exception e){ | |
1180 | + throw new BusinessException("文件名错误!"); | |
1181 | + } | |
1182 | + }); | |
1183 | + return ServerResult.success(hashMap); | |
1184 | + } | |
1185 | + | |
1186 | + public List<ProducePaymentCheckBillOrderDO> getOverEventList(){ | |
1187 | + return baseMapper.getOverEventList(); | |
1188 | + } | |
1189 | + @Override | |
1190 | + public ServerResult exportReceipt(HttpServletResponse response,ProducePaymentCheckBillOrderDO queryVO) throws IOException { | |
1191 | + XSSFWorkbook workbook = new XSSFWorkbook(); | |
1192 | + Sheet sheet = workbook.createSheet("付款单"); | |
1193 | + Row row = sheet.createRow(0); | |
1194 | + Cell cell = row.createCell(0); | |
1195 | + cell.setCellValue("付款单"); | |
1196 | + sheet.setMargin(sheet.LeftMargin,0.5); | |
1197 | + sheet.setMargin(sheet.RightMargin,0.5); | |
1198 | + | |
1199 | + | |
1200 | + CellStyle titleStyle = workbook.createCellStyle(); | |
1201 | + Font titleFont = workbook.createFont(); | |
1202 | + titleFont.setFontHeightInPoints((short) 20); // 字体大小 | |
1203 | + titleFont.setBold(true); // 加粗 | |
1204 | + titleFont.setFontName("宋体"); | |
1205 | + titleStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中 | |
1206 | + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中 | |
1207 | + // 合并单元格(第一行的第一列到第三列) | |
1208 | + sheet.addMergedRegion(new CellRangeAddress(0, 2, 0, 9)); | |
1209 | + titleStyle.setFont(titleFont); | |
1210 | + cell.setCellStyle(titleStyle); | |
1211 | + //第二行 | |
1212 | + Row row2 = sheet.createRow(3); | |
1213 | + Cell cell2 = row2.createCell(0); | |
1214 | + cell2.setCellValue("提交人:"); | |
1215 | + sheet.addMergedRegion(new CellRangeAddress(3, 4, 0, 1)); | |
1216 | + Cell cell3 = row2.createCell(2); | |
1217 | + cell3.setCellValue(""); | |
1218 | + sheet.addMergedRegion(new CellRangeAddress(3, 4, 2, 7)); | |
1219 | + Cell cell4 = row2.createCell(8); | |
1220 | + cell4.setCellValue("日期:"); | |
1221 | + sheet.addMergedRegion(new CellRangeAddress(3, 4, 8, 9)); | |
1222 | + //第三行 | |
1223 | + createMergedCell(sheet, workbook, 5, 0, 5, 6, 0, 1, "生产科对账单号"); | |
1224 | + createMergedCell(sheet, workbook, 5, 2, 5, 6, 2, 3, "实际应付金额"); | |
1225 | + createMergedCell(sheet, workbook, 5, 4, 5, 6, 4, 4, "扣款金额"); | |
1226 | + createMergedCell(sheet, workbook, 5, 5, 5, 6, 5, 6, "实际付款金额"); | |
1227 | + createMergedCell(sheet, workbook, 5, 7, 5, 6, 7, 7, "未付金额"); | |
1228 | + createMergedCell(sheet, workbook, 5, 8, 5, 6, 8, 8, "必须付款日期"); | |
1229 | + createMergedCell(sheet, workbook, 5, 9, 5, 6, 9, 9, "实际付款日期"); | |
1230 | + //第四行 | |
1231 | + createMergedCell(sheet, workbook, 7, 0, 7, 8, 0, 1, queryVO.getCheckNo()!=null ? queryVO.getCheckNo() :""); | |
1232 | + createMergedCell(sheet, workbook, 7, 2, 7, 8, 2, 3,queryVO.getActualPayedAmount()!=null ? "¥"+queryVO.getActualPayedAmount().setScale(2, BigDecimal.ROUND_HALF_UP):""); | |
1233 | + createMergedCell(sheet, workbook, 7, 4, 7, 8, 4, 4, queryVO.getDeductAmount()!=null? "¥"+queryVO.getDeductAmount().setScale(2, BigDecimal.ROUND_HALF_UP):""); | |
1234 | + createMergedCell(sheet, workbook, 7, 5, 7, 8, 5, 6, queryVO.getTotalActualPayedAmount()!=null? "¥"+queryVO.getTotalActualPayedAmount().setScale(2, BigDecimal.ROUND_HALF_UP):""); | |
1235 | + createMergedCell(sheet, workbook, 7, 7, 7, 8, 7, 7, queryVO.getUnPayedAmount()!=null? "¥"+queryVO.getUnPayedAmount().setScale(2, BigDecimal.ROUND_HALF_UP):""); | |
1236 | + createMergedCell(sheet, workbook, 7, 8, 7, 8, 8, 8, queryVO.getPayedDate()!=null?queryVO.getPayedDate():""); | |
1237 | + createMergedCell(sheet, workbook, 7, 9, 7, 8, 9, 9, queryVO.getActualPayedDate()!=null?queryVO.getActualPayedDate():""); | |
1238 | + //第五行 | |
1239 | + createMergedCell(sheet, workbook, 9, 0, 9, 10, 0, 1, "部门经理审核"); | |
1240 | + createMergedCell(sheet, workbook, 9, 2, 9, 10, 2, 4, "财务审核"); | |
1241 | + createMergedCell(sheet, workbook, 9, 5, 9, 10, 5, 7, "总经理审核"); | |
1242 | + createMergedCell(sheet, workbook, 9, 8, 9, 10, 8, 9, "出纳审核"); | |
1243 | + //第六行 | |
1244 | + createMergedCell(sheet, workbook, 11, 0, 11, 13, 0, 1, ""); | |
1245 | + createMergedCell(sheet, workbook, 11, 2, 11, 13, 2, 4, ""); | |
1246 | + createMergedCell(sheet, workbook, 11, 5, 11, 13, 5, 7, ""); | |
1247 | + createMergedCell(sheet, workbook, 11, 8, 11, 13, 8, 9, ""); | |
1248 | + //第七行 | |
1249 | + createMergedCell(sheet, workbook, 14, 0, 14, 15, 0, 4, "收款人"); | |
1250 | + createMergedCell(sheet, workbook, 14, 5, 14, 15, 5, 9, "付款金额"); | |
1251 | + //第八行 | |
1252 | + createMergedCell(sheet, workbook, 16, 0, 16, 17, 0, 4, ""); | |
1253 | + createMergedCell(sheet, workbook, 16, 5, 16, 17, 5, 9, ""); | |
1254 | + //第九行 | |
1255 | + createMergedCell(sheet, workbook, 18, 0, 18, 19, 0, 4, ""); | |
1256 | + createMergedCell(sheet, workbook, 18, 5, 18, 19, 5, 9, ""); | |
1257 | + //第十行 | |
1258 | + createMergedCell(sheet, workbook, 20, 0, 20, 21, 0, 4, ""); | |
1259 | + createMergedCell(sheet, workbook, 20, 5, 20, 21, 5, 9, ""); | |
1260 | + //第十一行 | |
1261 | + createMergedCell(sheet, workbook, 22, 0, 22, 23, 0, 4, ""); | |
1262 | + createMergedCell(sheet, workbook, 22, 5, 22, 23, 5, 9, ""); | |
1263 | + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=UTF-8"); | |
1264 | + response.setHeader("Content-Disposition", "attachment; filename=\"-.xlsx\""); | |
1265 | + workbook.write(response.getOutputStream()); | |
1266 | + workbook.close(); | |
1267 | + return ServerResult.success(); | |
1268 | + } | |
1269 | + | |
1270 | + public void createMergedCell(Sheet sheet, Workbook workbook, int rowIndex, int colIndex, int startRow, int endRow, int startCol, int endCol, String value) { | |
1271 | + // 创建或获取当前行 | |
1272 | + Row row = sheet.getRow(rowIndex); | |
1273 | + if (row == null) { | |
1274 | + row = sheet.createRow(rowIndex); | |
1275 | + } | |
1276 | + | |
1277 | + // 创建第一个单元格并设置值 | |
1278 | + Cell cell = row.createCell(colIndex); | |
1279 | + cell.setCellValue(value); | |
1280 | + | |
1281 | + // 创建边框样式 | |
1282 | + CellStyle titleStyle = workbook.createCellStyle(); | |
1283 | + Font titleFont = workbook.createFont(); | |
1284 | + titleFont.setFontHeightInPoints((short) 8.5); // 字体大小 | |
1285 | + titleFont.setBold(true); // 加粗 | |
1286 | + titleFont.setFontName("宋体"); | |
1287 | + titleStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中 | |
1288 | + titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 垂直居中 | |
1289 | + titleStyle.setFont(titleFont); | |
1290 | + | |
1291 | + // 设置边框样式 | |
1292 | + titleStyle.setBorderTop(BorderStyle.THIN); | |
1293 | + titleStyle.setBorderBottom(BorderStyle.THIN); | |
1294 | + titleStyle.setBorderLeft(BorderStyle.THIN); | |
1295 | + titleStyle.setBorderRight(BorderStyle.THIN); | |
1296 | + | |
1297 | + // 应用样式到第一个单元格 | |
1298 | + cell.setCellStyle(titleStyle); | |
1299 | + | |
1300 | + // 合并单元格 | |
1301 | + sheet.addMergedRegion(new CellRangeAddress(startRow, endRow, startCol, endCol)); | |
1302 | + | |
1303 | + // 为合并区域的每个单元格设置相同的样式 | |
1304 | + for (int rowIndexCurrent = startRow; rowIndexCurrent <= endRow; rowIndexCurrent++) { | |
1305 | + for (int colIndexCurrent = startCol; colIndexCurrent <= endCol; colIndexCurrent++) { | |
1306 | + Row currentRow = sheet.getRow(rowIndexCurrent); | |
1307 | + if (currentRow == null) { | |
1308 | + currentRow = sheet.createRow(rowIndexCurrent); | |
1309 | + } | |
1310 | + Cell currentCell = currentRow.getCell(colIndexCurrent); | |
1311 | + if (currentCell == null) { | |
1312 | + currentCell = currentRow.createCell(colIndexCurrent); | |
1313 | + } | |
1314 | + // 只为合并区域内的单元格设置样式 | |
1315 | + if (rowIndexCurrent == startRow && colIndexCurrent == colIndex) { | |
1316 | + currentCell.setCellStyle(titleStyle); // 为合并的单元格设置样式 | |
1317 | + } else { | |
1318 | + currentCell.setCellStyle(titleStyle); // 为其他合并的单元格设置样式 | |
1319 | + } | |
1320 | + } | |
1321 | + } | |
1322 | + } | |
1323 | +} | ... | ... |
src/main/resources/application-pre-prod.yml
... | ... | @@ -76,21 +76,26 @@ spring: |
76 | 76 | timeout: 2000 |
77 | 77 | mail: |
78 | 78 | # 配置 SMTP 服务器地址 |
79 | - host: xxx | |
79 | +# host: smtp.qiye.aliyun.com | |
80 | + host: smtp.163.com | |
80 | 81 | # 发送者邮箱,已开通POP3/SMTP服务的邮箱,也就是你自己的 |
81 | - username: xxxx | |
82 | +# username: information@alterego.xin | |
83 | + username: chenhang4442024@163.com | |
82 | 84 | # 配置密码,注意不是真正的密码,而是刚刚申请到的授权码 |
83 | - password: xxx | |
85 | +# password: AlterEgo1608ITf31 | |
86 | + password: ACHWYJSXRITHTMGA | |
84 | 87 | # 邮件接收者 |
85 | 88 | mailRecipient: #邮件接收者邮箱 |
86 | 89 | # 端口号465或587(QQ邮箱发送邮件仅支持587端口协议) |
87 | - port: 587 | |
90 | + port: 465 | |
88 | 91 | # 默认的邮件编码为UTF-8 |
89 | 92 | default-encoding: UTF-8 |
90 | 93 | # 配置SSL 加密工厂 |
91 | 94 | properties: |
92 | 95 | mail: |
93 | 96 | smtp: |
97 | + ssl: | |
98 | + enable: true | |
94 | 99 | socketFactoryClass: javax.net.ssl.SSLSocketFactory |
95 | 100 | #表示开启 DEBUG 模式,这样,邮件发送过程的日志会在控制台打印出来,方便排查错误 |
96 | 101 | debug: true |
... | ... | @@ -173,7 +178,7 @@ oss: |
173 | 178 | endpoint: https://oss-cn-qingdao.aliyuncs.com |
174 | 179 | accessKeyId: LTAI5t7u1gXR2vm82sd6CkVz |
175 | 180 | accessKeySecret: m4NzHZZsZiauKmRO8y7DihmcGNdQk4 |
176 | - bucket: alterego | |
181 | + bucket: test-alterego | |
177 | 182 | |
178 | 183 | |
179 | 184 | db: | ... | ... |
src/main/resources/application-prod.yml
... | ... | @@ -76,11 +76,11 @@ spring: |
76 | 76 | timeout: 2000 |
77 | 77 | mail: |
78 | 78 | # 配置 SMTP 服务器地址 |
79 | - host: smtp.163.com | |
79 | + host: smtp.qiye.aliyun.com | |
80 | 80 | # 发送者邮箱,已开通POP3/SMTP服务的邮箱,也就是你自己的 |
81 | - username: chenhang4442024@163.com | |
81 | + username: information@alterego.xin | |
82 | 82 | # 配置密码,注意不是真正的密码,而是刚刚申请到的授权码 |
83 | - password: ACHWYJSXRITHTMGA | |
83 | + password: AlterEgo1608ITf31 | |
84 | 84 | # 邮件接收者 |
85 | 85 | mailRecipient: #邮件接收者邮箱 |
86 | 86 | # 端口号465或587(QQ邮箱发送邮件仅支持587端口协议) |
... | ... | @@ -164,8 +164,8 @@ openai: |
164 | 164 | # 文件存储路径 |
165 | 165 | file: |
166 | 166 | path: /home/canrd/order-erp/files/ |
167 | -# host: http://47.104.8.35 | |
168 | - host: http://39.108.227.113 | |
167 | + host: http://47.104.8.35 | |
168 | +# host: http://39.108.227.113 | |
169 | 169 | avatar: /home/order-erp/avatar/ |
170 | 170 | # 文件大小 /M |
171 | 171 | maxSize: 100 | ... | ... |
src/main/resources/application-test.yml
... | ... | @@ -175,9 +175,9 @@ file: |
175 | 175 | # 阿里pss图片服务 |
176 | 176 | oss: |
177 | 177 | endpoint: https://oss-cn-qingdao.aliyuncs.com |
178 | - accessKeyId: LTAIZCPI7OaWud0m | |
179 | - accessKeySecret: nvtGeScBwRztGeoj8WSp5OWalalgpK | |
180 | - bucket: order-erp | |
178 | + accessKeyId: LTAI5t7u1gXR2vm82sd6CkVz | |
179 | + accessKeySecret: m4NzHZZsZiauKmRO8y7DihmcGNdQk4 | |
180 | + bucket: test-alterego | |
181 | 181 | |
182 | 182 | |
183 | 183 | db: | ... | ... |