Commit 8c31cb74bab92ce268f5a158bce2c29916eec90c
1 parent
8e2b3476
feat: ERP升级
1、财务分支
Showing
15 changed files
with
829 additions
and
21 deletions
sql/dml_erp_bill_v2.sql
@@ -2,10 +2,11 @@ DROP TABLE IF EXISTS `invoice_bill_order`; | @@ -2,10 +2,11 @@ DROP TABLE IF EXISTS `invoice_bill_order`; | ||
2 | CREATE TABLE `invoice_bill_order` ( | 2 | CREATE TABLE `invoice_bill_order` ( |
3 | `id` bigint NOT NULL AUTO_INCREMENT, | 3 | `id` bigint NOT NULL AUTO_INCREMENT, |
4 | `invoice_no` varchar(64) NOT NULL COMMENT '发票单号', | 4 | `invoice_no` varchar(64) NOT NULL COMMENT '发票单号', |
5 | - `bg_url` varchar(256) NOT NULL COMMENT '报关单url地址', | ||
6 | - `back_refund_date` varchar(64) NOT null COMMENT '必须回款日期', | 5 | + `bg_url` varchar(512) default NULL COMMENT '报关单url地址', |
6 | + `back_refund_date` varchar(64) default null COMMENT '必须回款日期', | ||
7 | + `actual_refund_date` varchar(64) default null COMMENT '实际回款日期', | ||
7 | `deduct_amount` decimal(20,6) DEFAULT NULL COMMENT '发生扣款金额', | 8 | `deduct_amount` decimal(20,6) DEFAULT NULL COMMENT '发生扣款金额', |
8 | - `deduct_url` varchar(256) NOT NULL COMMENT '扣款单url地址', | 9 | + `deduct_url` varchar(512) default NULL COMMENT '扣款单url地址', |
9 | `actual_receivable_amount` decimal(20,6) DEFAULT NULL COMMENT '实际应收金额', | 10 | `actual_receivable_amount` decimal(20,6) DEFAULT NULL COMMENT '实际应收金额', |
10 | `actual_payed_amount1` decimal(20,6) DEFAULT NULL COMMENT '实际应付金额1', | 11 | `actual_payed_amount1` decimal(20,6) DEFAULT NULL COMMENT '实际应付金额1', |
11 | `actual_payed_amount2` decimal(20,6) DEFAULT NULL COMMENT '实际应付金额2', | 12 | `actual_payed_amount2` decimal(20,6) DEFAULT NULL COMMENT '实际应付金额2', |
@@ -41,10 +42,10 @@ DROP TABLE IF EXISTS `produce_payment_check_bill_order`; | @@ -41,10 +42,10 @@ DROP TABLE IF EXISTS `produce_payment_check_bill_order`; | ||
41 | CREATE TABLE `produce_payment_check_bill_order` ( | 42 | CREATE TABLE `produce_payment_check_bill_order` ( |
42 | `id` bigint NOT NULL AUTO_INCREMENT, | 43 | `id` bigint NOT NULL AUTO_INCREMENT, |
43 | `check_no` varchar(64) NOT NULL COMMENT '生产科对账单', | 44 | `check_no` varchar(64) NOT NULL COMMENT '生产科对账单', |
44 | - `invoice_url` varchar(256) NOT NULL COMMENT '发票url地址', | ||
45 | - `deduct_pdf_url` varchar(256) NOT NULL COMMENT '扣款单url地址', | ||
46 | - `payed_date` varchar(64) NOT null COMMENT '生产科应付款日期', | ||
47 | - `deduct_dept` varchar(64) NOT null COMMENT '生产科扣款责任部门', | 45 | + `invoice_url` varchar(512) default NULL COMMENT '发票url地址', |
46 | + `deduct_pdf_url` varchar(512) default NULL COMMENT '扣款单url地址', | ||
47 | + `payed_date` varchar(64) default null COMMENT '生产科应付款日期', | ||
48 | + `deduct_dept` varchar(64) default null COMMENT '生产科扣款责任部门', | ||
48 | `deduct_amount` decimal(20,6) DEFAULT NULL COMMENT '生产科扣款金额', | 49 | `deduct_amount` decimal(20,6) DEFAULT NULL COMMENT '生产科扣款金额', |
49 | `actual_payed_amount` decimal(20,6) DEFAULT NULL COMMENT '实际应付金额', | 50 | `actual_payed_amount` decimal(20,6) DEFAULT NULL COMMENT '实际应付金额', |
50 | `status` INT NOT NULL COMMENT '总经理审核状态 0:待审核、1:审核通过,2:审核驳回', | 51 | `status` INT NOT NULL COMMENT '总经理审核状态 0:待审核、1:审核通过,2:审核驳回', |
src/main/java/com/order/erp/controller/InvoiceBillOrderController.java
1 | package com.order.erp.controller; | 1 | package com.order.erp.controller; |
2 | 2 | ||
3 | +import com.order.erp.common.annotation.AnonymousAccess; | ||
3 | import com.order.erp.common.constant.ServerResult; | 4 | import com.order.erp.common.constant.ServerResult; |
5 | +import com.order.erp.common.excel4j.exceptions.Excel4JException; | ||
4 | import com.order.erp.common.jsr303.OperateGroup; | 6 | import com.order.erp.common.jsr303.OperateGroup; |
5 | import com.order.erp.domain.vo.order.*; | 7 | import com.order.erp.domain.vo.order.*; |
6 | import com.order.erp.service.order.InvoiceBillOrderService; | 8 | import com.order.erp.service.order.InvoiceBillOrderService; |
9 | +import io.swagger.annotations.ApiOperation; | ||
7 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; |
8 | import org.springframework.web.bind.annotation.PostMapping; | 11 | import org.springframework.web.bind.annotation.PostMapping; |
9 | import org.springframework.web.bind.annotation.RequestBody; | 12 | import org.springframework.web.bind.annotation.RequestBody; |
@@ -11,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -11,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
11 | import org.springframework.web.bind.annotation.RestController; | 14 | import org.springframework.web.bind.annotation.RestController; |
12 | 15 | ||
13 | import javax.annotation.Resource; | 16 | import javax.annotation.Resource; |
17 | +import javax.servlet.http.HttpServletResponse; | ||
18 | +import java.io.IOException; | ||
14 | 19 | ||
15 | /** | 20 | /** |
16 | * 应收款账单表(InvoiceBillOrder)表控制层 | 21 | * 应收款账单表(InvoiceBillOrder)表控制层 |
@@ -45,10 +50,33 @@ public class InvoiceBillOrderController { | @@ -45,10 +50,33 @@ public class InvoiceBillOrderController { | ||
45 | * @return 查询结果 | 50 | * @return 查询结果 |
46 | */ | 51 | */ |
47 | @PostMapping("/list_base_order_info_by") | 52 | @PostMapping("/list_base_order_info_by") |
48 | - public ServerResult listBaseOrderInfoBy(@RequestBody @Validated({OperateGroup.List.class}) InvoiceBaseOrderQueryVO queryVO) { | 53 | + public ServerResult listBaseOrderInfoBy(@RequestBody @Validated InvoiceBaseOrderQueryVO queryVO) { |
49 | return invoiceBillOrderService.listBaseOrderInfoBy(queryVO); | 54 | return invoiceBillOrderService.listBaseOrderInfoBy(queryVO); |
50 | } | 55 | } |
51 | 56 | ||
57 | + /** | ||
58 | + * 分析列表 | ||
59 | + * | ||
60 | + * @param queryVO 查询条件 | ||
61 | + * @return 查询结果 | ||
62 | + */ | ||
63 | + @PostMapping("/list_analysis_by") | ||
64 | + public ServerResult listAnalysisBy(@RequestBody @Validated({OperateGroup.List.class}) InvoiceBillAnalysisVO queryVO) { | ||
65 | + return invoiceBillOrderService.listAnalysisBy(queryVO); | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * 导出分析列表 | ||
70 | + * | ||
71 | + * @param queryVO 查询条件 | ||
72 | + * @return 查询结果 | ||
73 | + */ | ||
74 | + @PostMapping(value = "/export") | ||
75 | + @ApiOperation("导出分析列表") | ||
76 | + @AnonymousAccess | ||
77 | + public void export(HttpServletResponse response, @RequestBody @Validated InvoiceBillAnalysisVO queryVO) throws IOException, Excel4JException { | ||
78 | + invoiceBillOrderService.export(response, queryVO); | ||
79 | + } | ||
52 | 80 | ||
53 | /** | 81 | /** |
54 | * 创建invoice单据 | 82 | * 创建invoice单据 |
@@ -62,6 +90,17 @@ public class InvoiceBillOrderController { | @@ -62,6 +90,17 @@ public class InvoiceBillOrderController { | ||
62 | } | 90 | } |
63 | 91 | ||
64 | /** | 92 | /** |
93 | + * 获取必须回款日期 | ||
94 | + * | ||
95 | + * @param createVO 数据VO | ||
96 | + * @return 新增结果 | ||
97 | + */ | ||
98 | + @PostMapping("/get_back_refund_date") | ||
99 | + public ServerResult getBackRefundDate(@RequestBody InvoiceBillCreateVO createVO) { | ||
100 | + return invoiceBillOrderService.getBackRefundDate(createVO); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
65 | * 更新扣款信息 | 104 | * 更新扣款信息 |
66 | * | 105 | * |
67 | * @param deductInfoVO 数据VO | 106 | * @param deductInfoVO 数据VO |
@@ -84,6 +123,17 @@ public class InvoiceBillOrderController { | @@ -84,6 +123,17 @@ public class InvoiceBillOrderController { | ||
84 | } | 123 | } |
85 | 124 | ||
86 | /** | 125 | /** |
126 | + * 提交审核 | ||
127 | + * | ||
128 | + * @param commitApplyVO 数据VO | ||
129 | + * @return 编辑结果 | ||
130 | + */ | ||
131 | + @PostMapping("/commit_apply") | ||
132 | + public ServerResult commitApply(@RequestBody InvoiceBillCommitApplyVO commitApplyVO) { | ||
133 | + return invoiceBillOrderService.commitApply(commitApplyVO); | ||
134 | + } | ||
135 | + | ||
136 | + /** | ||
87 | * 删除数据 | 137 | * 删除数据 |
88 | * | 138 | * |
89 | * @param invoiceBillOrderQueryVO 查询条件 | 139 | * @param invoiceBillOrderQueryVO 查询条件 |
src/main/java/com/order/erp/domain/ApplyStatusEnum.java
@@ -13,6 +13,8 @@ import lombok.Getter; | @@ -13,6 +13,8 @@ import lombok.Getter; | ||
13 | @AllArgsConstructor | 13 | @AllArgsConstructor |
14 | public enum ApplyStatusEnum { | 14 | public enum ApplyStatusEnum { |
15 | 15 | ||
16 | + NO_COMMIT(-1, "未提交审核"), | ||
17 | + | ||
16 | WAIT_AUDIT(0, "待审批"), | 18 | WAIT_AUDIT(0, "待审批"), |
17 | 19 | ||
18 | AUDIT_PASS(10, "已通过"), | 20 | AUDIT_PASS(10, "已通过"), |
src/main/java/com/order/erp/domain/ApplyTypeEnum.java
@@ -18,6 +18,10 @@ public enum ApplyTypeEnum { | @@ -18,6 +18,10 @@ public enum ApplyTypeEnum { | ||
18 | ORDER_PROFIT_APPLY(10, "利润分析申请"), | 18 | ORDER_PROFIT_APPLY(10, "利润分析申请"), |
19 | 19 | ||
20 | ORDER_REPORT_APPLY(20, "项目报告书申请"), | 20 | ORDER_REPORT_APPLY(20, "项目报告书申请"), |
21 | + | ||
22 | + INVOICE_BILL_APPLY(30, "应收账单申请"), | ||
23 | + | ||
24 | + CHECK_BILL_APPLY(40, "应付账单申请"), | ||
21 | ; | 25 | ; |
22 | private Integer type; | 26 | private Integer type; |
23 | 27 |
src/main/java/com/order/erp/domain/dto/order/InvoiceBillOrderDO.java
@@ -37,6 +37,11 @@ public class InvoiceBillOrderDO extends BaseDO implements Serializable { | @@ -37,6 +37,11 @@ public class InvoiceBillOrderDO extends BaseDO implements Serializable { | ||
37 | */ | 37 | */ |
38 | private String backRefundDate; | 38 | private String backRefundDate; |
39 | /** | 39 | /** |
40 | + * 实际回款日期 | ||
41 | + */ | ||
42 | + private String actualRefundDate; | ||
43 | + | ||
44 | + /** | ||
40 | * 发生扣款金额 | 45 | * 发生扣款金额 |
41 | */ | 46 | */ |
42 | private BigDecimal deductAmount; | 47 | private BigDecimal deductAmount; |
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 | + */ | ||
65 | + private BigDecimal otherTotalAmount; | ||
66 | + | ||
67 | + /** | ||
68 | + * 必须回款日期 | ||
69 | + */ | ||
70 | + private String backRefundDate; | ||
71 | + | ||
72 | + /** | ||
73 | + * 实际回款日期 | ||
74 | + */ | ||
75 | + private String actualRefundDate; | ||
76 | + | ||
77 | +} |
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 | + * 实际应收金额 | ||
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 | + */ | ||
64 | + private BigDecimal otherTotalAmount; | ||
65 | + | ||
66 | + /** | ||
67 | + * 合计数据 | ||
68 | + */ | ||
69 | + | ||
70 | +} |
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.*; | ||
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 | +@EqualsAndHashCode(callSuper = false) | ||
18 | +@SuperBuilder | ||
19 | +public class InvoiceBillAnalysisVO extends InvoiceBillOrderQueryVO implements Serializable { | ||
20 | + | ||
21 | +} |
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 | + | ||
24 | +} |
src/main/java/com/order/erp/domain/vo/order/InvoiceBillOrderQueryVO.java
@@ -29,7 +29,7 @@ public class InvoiceBillOrderQueryVO extends BasePageVO implements Serializable | @@ -29,7 +29,7 @@ public class InvoiceBillOrderQueryVO extends BasePageVO implements Serializable | ||
29 | private String invoiceNo; | 29 | private String invoiceNo; |
30 | 30 | ||
31 | /** | 31 | /** |
32 | - * 总经理审核状态 0:待审核、1:审核通过,2:审核驳回 | 32 | + * 总经理审核状态 -1,未提交审核,0:待审核、1:审核通过,2:审核驳回 |
33 | */ | 33 | */ |
34 | private Integer status; | 34 | private Integer status; |
35 | 35 | ||
@@ -57,5 +57,15 @@ public class InvoiceBillOrderQueryVO extends BasePageVO implements Serializable | @@ -57,5 +57,15 @@ public class InvoiceBillOrderQueryVO extends BasePageVO implements Serializable | ||
57 | * 客户po号 | 57 | * 客户po号 |
58 | */ | 58 | */ |
59 | private String customerPo; | 59 | private String customerPo; |
60 | + | ||
61 | + /** | ||
62 | + * 开始时间 | ||
63 | + */ | ||
64 | + private String startTime; | ||
65 | + | ||
66 | + /** | ||
67 | + * 结束时间 | ||
68 | + */ | ||
69 | + private String endTime; | ||
60 | } | 70 | } |
61 | 71 |
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/service/order/InvoiceBillOrderService.java
@@ -5,6 +5,9 @@ import com.order.erp.common.constant.ServerResult; | @@ -5,6 +5,9 @@ import com.order.erp.common.constant.ServerResult; | ||
5 | import com.order.erp.domain.dto.order.InvoiceBillOrderDO; | 5 | import com.order.erp.domain.dto.order.InvoiceBillOrderDO; |
6 | import com.order.erp.domain.vo.order.*; | 6 | import com.order.erp.domain.vo.order.*; |
7 | 7 | ||
8 | +import javax.servlet.http.HttpServletResponse; | ||
9 | +import java.io.IOException; | ||
10 | + | ||
8 | /** | 11 | /** |
9 | * 应收款账单表(InvoiceBillOrder)表服务接口 | 12 | * 应收款账单表(InvoiceBillOrder)表服务接口 |
10 | * | 13 | * |
@@ -28,6 +31,18 @@ public interface InvoiceBillOrderService extends IService<InvoiceBillOrderDO> { | @@ -28,6 +31,18 @@ public interface InvoiceBillOrderService extends IService<InvoiceBillOrderDO> { | ||
28 | ServerResult listBaseOrderInfoBy(InvoiceBaseOrderQueryVO queryVO); | 31 | ServerResult listBaseOrderInfoBy(InvoiceBaseOrderQueryVO queryVO); |
29 | 32 | ||
30 | /** | 33 | /** |
34 | + * @param queryVO | ||
35 | + * @return | ||
36 | + */ | ||
37 | + ServerResult listAnalysisBy(InvoiceBillAnalysisVO queryVO); | ||
38 | + | ||
39 | + /** | ||
40 | + * @param queryVO | ||
41 | + * @return | ||
42 | + */ | ||
43 | + ServerResult export(HttpServletResponse response, InvoiceBillAnalysisVO queryVO) throws IOException; | ||
44 | + | ||
45 | + /** | ||
31 | * 新增数据 | 46 | * 新增数据 |
32 | * | 47 | * |
33 | * @param createVO 数据VO | 48 | * @param createVO 数据VO |
@@ -36,6 +51,13 @@ public interface InvoiceBillOrderService extends IService<InvoiceBillOrderDO> { | @@ -36,6 +51,13 @@ public interface InvoiceBillOrderService extends IService<InvoiceBillOrderDO> { | ||
36 | ServerResult create(InvoiceBillCreateVO createVO); | 51 | ServerResult create(InvoiceBillCreateVO createVO); |
37 | 52 | ||
38 | /** | 53 | /** |
54 | + * | ||
55 | + * @param createVO | ||
56 | + * @return | ||
57 | + */ | ||
58 | + ServerResult getBackRefundDate(InvoiceBillCreateVO createVO); | ||
59 | + | ||
60 | + /** | ||
39 | * 更新扣款信息 | 61 | * 更新扣款信息 |
40 | * | 62 | * |
41 | * @param deductInfoVO 数据VO | 63 | * @param deductInfoVO 数据VO |
@@ -52,6 +74,14 @@ public interface InvoiceBillOrderService extends IService<InvoiceBillOrderDO> { | @@ -52,6 +74,14 @@ public interface InvoiceBillOrderService extends IService<InvoiceBillOrderDO> { | ||
52 | ServerResult updateAmountInfo(InvoiceBillAmountInfoVO amountInfoVO); | 74 | ServerResult updateAmountInfo(InvoiceBillAmountInfoVO amountInfoVO); |
53 | 75 | ||
54 | /** | 76 | /** |
77 | + * 提交审核 | ||
78 | + * | ||
79 | + * @param commitApplyVO | ||
80 | + * @return | ||
81 | + */ | ||
82 | + ServerResult commitApply(InvoiceBillCommitApplyVO commitApplyVO); | ||
83 | + | ||
84 | + /** | ||
55 | * 通过主键删除数据 | 85 | * 通过主键删除数据 |
56 | * | 86 | * |
57 | * @param invoiceBillOrderQueryVO 筛选条件 | 87 | * @param invoiceBillOrderQueryVO 筛选条件 |
src/main/java/com/order/erp/service/order/impl/InvoiceBillOrderServiceImpl.java
1 | package com.order.erp.service.order.impl; | 1 | package com.order.erp.service.order.impl; |
2 | 2 | ||
3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
4 | +import com.alibaba.fastjson.JSONObject; | ||
4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
5 | import com.baomidou.mybatisplus.core.metadata.IPage; | 6 | import com.baomidou.mybatisplus.core.metadata.IPage; |
6 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | 7 | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
7 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 8 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 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; | ||
9 | import com.order.erp.common.constant.Constant; | 13 | import com.order.erp.common.constant.Constant; |
10 | import com.order.erp.common.constant.ServerResult; | 14 | import com.order.erp.common.constant.ServerResult; |
15 | +import com.order.erp.common.constant.ServerResultCode; | ||
11 | import com.order.erp.common.exception.BusinessException; | 16 | import com.order.erp.common.exception.BusinessException; |
17 | +import com.order.erp.common.utils.DateUtils; | ||
12 | import com.order.erp.common.utils.StringUtils; | 18 | import com.order.erp.common.utils.StringUtils; |
13 | import com.order.erp.common.utils.TransactionHelper; | 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; | ||
14 | import com.order.erp.domain.dto.BaseDO; | 23 | import com.order.erp.domain.dto.BaseDO; |
15 | -import com.order.erp.domain.dto.order.InvoiceBillMappingDO; | ||
16 | -import com.order.erp.domain.dto.order.InvoiceBillOrderDO; | ||
17 | -import com.order.erp.domain.dto.order.OrderBaseInfoDO; | 24 | +import com.order.erp.domain.dto.SystemSettingDO; |
25 | +import com.order.erp.domain.dto.order.*; | ||
18 | import com.order.erp.domain.vo.order.*; | 26 | import com.order.erp.domain.vo.order.*; |
19 | import com.order.erp.mapper.order.InvoiceBillOrderMapper; | 27 | import com.order.erp.mapper.order.InvoiceBillOrderMapper; |
20 | -import com.order.erp.service.order.InvoiceBillMappingService; | ||
21 | -import com.order.erp.service.order.InvoiceBillOrderService; | ||
22 | -import com.order.erp.service.order.OrderBaseInfoService; | 28 | +import com.order.erp.service.SystemSettingService; |
29 | +import com.order.erp.service.order.*; | ||
23 | import lombok.extern.slf4j.Slf4j; | 30 | import lombok.extern.slf4j.Slf4j; |
31 | +import org.springframework.beans.BeanUtils; | ||
24 | import org.springframework.stereotype.Service; | 32 | import org.springframework.stereotype.Service; |
25 | 33 | ||
26 | import javax.annotation.Resource; | 34 | import javax.annotation.Resource; |
35 | +import javax.servlet.http.HttpServletResponse; | ||
36 | +import java.io.IOException; | ||
37 | +import java.math.BigDecimal; | ||
38 | +import java.time.LocalDateTime; | ||
27 | import java.util.*; | 39 | import java.util.*; |
40 | +import java.util.function.Function; | ||
28 | import java.util.stream.Collectors; | 41 | import java.util.stream.Collectors; |
29 | 42 | ||
30 | /** | 43 | /** |
@@ -42,9 +55,21 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | @@ -42,9 +55,21 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | ||
42 | private OrderBaseInfoService orderBaseInfoService; | 55 | private OrderBaseInfoService orderBaseInfoService; |
43 | 56 | ||
44 | @Resource | 57 | @Resource |
58 | + private OrderProfitAnalysisService profitAnalysisService; | ||
59 | + | ||
60 | + @Resource | ||
45 | private InvoiceBillMappingService invoiceBillMappingService; | 61 | private InvoiceBillMappingService invoiceBillMappingService; |
46 | 62 | ||
47 | @Resource | 63 | @Resource |
64 | + private OrderFieldLockApplyService orderFieldLockApplyService; | ||
65 | + | ||
66 | + @Resource | ||
67 | + private SystemSettingService systemSettingService; | ||
68 | + | ||
69 | + @Resource | ||
70 | + private DataScope dataScope; | ||
71 | + | ||
72 | + @Resource | ||
48 | private TransactionHelper transactionHelper; | 73 | private TransactionHelper transactionHelper; |
49 | 74 | ||
50 | 75 | ||
@@ -56,17 +81,26 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | @@ -56,17 +81,26 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | ||
56 | */ | 81 | */ |
57 | @Override | 82 | @Override |
58 | public ServerResult listByPage(InvoiceBillOrderQueryVO queryVO) { | 83 | public ServerResult listByPage(InvoiceBillOrderQueryVO queryVO) { |
59 | - Set<Long> billOrderIds = filterBillOrderIdsBy(queryVO); | 84 | + LambdaQueryWrapper<InvoiceBillOrderDO> queryWrapper = getQueryWrapper(queryVO); |
85 | + Page page = new Page<>(queryVO.getPage(), queryVO.getPageSize()); | ||
86 | + IPage<InvoiceBillOrderDO> iPage = page(page, queryWrapper); | ||
87 | + return ServerResult.success(iPage); | ||
88 | + } | ||
60 | 89 | ||
61 | - LambdaQueryWrapper<InvoiceBillOrderDO> queryWrapper = new LambdaQueryWrapper<InvoiceBillOrderDO>() | 90 | + /** |
91 | + * @param queryVO | ||
92 | + * @return | ||
93 | + */ | ||
94 | + private LambdaQueryWrapper<InvoiceBillOrderDO> getQueryWrapper(InvoiceBillOrderQueryVO queryVO) { | ||
95 | + Set<Long> billOrderIds = filterBillOrderIdsBy(queryVO); | ||
96 | + return new LambdaQueryWrapper<InvoiceBillOrderDO>() | ||
62 | .eq(InvoiceBillOrderDO::getEnableFlag, Constant.ENABLE_TEN) | 97 | .eq(InvoiceBillOrderDO::getEnableFlag, Constant.ENABLE_TEN) |
63 | .in(CollectionUtils.isNotEmpty(billOrderIds), InvoiceBillOrderDO::getId, billOrderIds) | 98 | .in(CollectionUtils.isNotEmpty(billOrderIds), InvoiceBillOrderDO::getId, billOrderIds) |
64 | .eq(StringUtils.isNotBlank(queryVO.getInvoiceNo()), InvoiceBillOrderDO::getInvoiceNo, queryVO.getInvoiceNo()) | 99 | .eq(StringUtils.isNotBlank(queryVO.getInvoiceNo()), InvoiceBillOrderDO::getInvoiceNo, queryVO.getInvoiceNo()) |
65 | .eq(Objects.nonNull(queryVO.getStatus()), InvoiceBillOrderDO::getStatus, queryVO.getStatus()) | 100 | .eq(Objects.nonNull(queryVO.getStatus()), InvoiceBillOrderDO::getStatus, queryVO.getStatus()) |
101 | + .ge(StringUtils.isNotBlank(queryVO.getStartTime()), InvoiceBillOrderDO::getCreateTime, queryVO.getStartTime()) | ||
102 | + .le(StringUtils.isNotBlank(queryVO.getEndTime()), InvoiceBillOrderDO::getCreateTime, queryVO.getEndTime()) | ||
66 | .orderByDesc(InvoiceBillOrderDO::getId); | 103 | .orderByDesc(InvoiceBillOrderDO::getId); |
67 | - Page page = new Page<>(queryVO.getPage(), queryVO.getPageSize()); | ||
68 | - IPage<InvoiceBillOrderDO> iPage = page(page, queryWrapper); | ||
69 | - return ServerResult.success(iPage); | ||
70 | } | 104 | } |
71 | 105 | ||
72 | @Override | 106 | @Override |
@@ -81,6 +115,250 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | @@ -81,6 +115,250 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | ||
81 | return ServerResult.success(orderBaseInfoService.listByIds(orderIds)); | 115 | return ServerResult.success(orderBaseInfoService.listByIds(orderIds)); |
82 | } | 116 | } |
83 | 117 | ||
118 | + @Override | ||
119 | + public ServerResult listAnalysisBy(InvoiceBillAnalysisVO queryVO) { | ||
120 | + return ServerResult.success(getAnalysisResult(queryVO)); | ||
121 | + } | ||
122 | + | ||
123 | + @Override | ||
124 | + public ServerResult export(HttpServletResponse response, InvoiceBillAnalysisVO queryVO) throws IOException { | ||
125 | + InvoiceBillAnalysisResultVO resultVO = getAnalysisResult(queryVO); | ||
126 | + if (Objects.isNull(resultVO)) { | ||
127 | + throw new BusinessException("数据为空,不能导出!"); | ||
128 | + } | ||
129 | + List<Map<String, Object>> list = buildExportMapVOS(resultVO); | ||
130 | + if (CollectionUtils.isNotEmpty(list)) { | ||
131 | + List<String> keys = new ArrayList<>(list.get(Constant.ZERO).keySet()); | ||
132 | + | ||
133 | + ExcelHelper.opsExport(PoiWorkbookType.XLSX) | ||
134 | + .opsSheet(list) | ||
135 | + .opsHeader().simple().texts(keys).done() | ||
136 | + .opsColumn().fields(keys).done() | ||
137 | + .height(CellPosition.CELL, 750) | ||
138 | + .done() | ||
139 | + .export(response.getOutputStream()); | ||
140 | + } | ||
141 | + return ServerResult.success(); | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * @param resultVO | ||
146 | + * @return | ||
147 | + */ | ||
148 | + private List<Map<String, Object>> buildExportMapVOS(InvoiceBillAnalysisResultVO resultVO) throws IOException { | ||
149 | + List<InvoiceBillAnalysisExportVO> exportVOS = resultVO.getExportVOS(); | ||
150 | + List<Map<String, Object>> list = new ArrayList<>(); | ||
151 | + int i = 0; | ||
152 | + for (InvoiceBillAnalysisExportVO exportVO : exportVOS) { | ||
153 | + Map<String, Object> map = new LinkedHashMap<>(); | ||
154 | + map.put("编号", i++); | ||
155 | + map.put("客户编码", exportVO.getCustomerCode()); | ||
156 | + map.put("INVOICE编码", exportVO.getInvoiceNo()); | ||
157 | + map.put("客户总金额汇总", exportVO.getCustomerTotalPrice()); | ||
158 | + map.put("客户扣款金额汇总", exportVO.getDeductAmount()); | ||
159 | + map.put("实际应收金额", exportVO.getActualReceivableAmount()); | ||
160 | + map.put("实际收款金额汇总", exportVO.getActualPayedAmount()); | ||
161 | + map.put("其他费用金额汇总", exportVO.getOtherAmount()); | ||
162 | + map.put("其他费用合计", exportVO.getOtherTotalAmount()); | ||
163 | + map.put("必须回款日期", exportVO.getBackRefundDate()); | ||
164 | + map.put("实际回款日期", exportVO.getActualRefundDate()); | ||
165 | + list.add(map); | ||
166 | + } | ||
167 | + Map<String, Object> map = new LinkedHashMap<>(); | ||
168 | + map.put("编号", "合计"); | ||
169 | + map.put("客户编码", ""); | ||
170 | + map.put("INVOICE编码", ""); | ||
171 | + map.put("客户总金额汇总", resultVO.getCustomerTotalPrice()); | ||
172 | + map.put("客户扣款金额汇总", resultVO.getDeductAmount()); | ||
173 | + map.put("实际应收金额", resultVO.getActualReceivableAmount()); | ||
174 | + map.put("实际收款金额汇总", resultVO.getActualPayedAmount()); | ||
175 | + map.put("其他费用金额汇总", resultVO.getOtherAmount()); | ||
176 | + map.put("其他费用合计", resultVO.getOtherTotalAmount()); | ||
177 | + map.put("必须回款日期", ""); | ||
178 | + map.put("实际回款日期", ""); | ||
179 | + list.add(map); | ||
180 | + return list; | ||
181 | + } | ||
182 | + | ||
183 | + /** | ||
184 | + * @param queryVO | ||
185 | + * @return | ||
186 | + */ | ||
187 | + private InvoiceBillAnalysisResultVO getAnalysisResult(InvoiceBillAnalysisVO queryVO) { | ||
188 | + LambdaQueryWrapper<InvoiceBillOrderDO> queryWrapper = getQueryWrapper(queryVO); | ||
189 | + List<InvoiceBillOrderDO> invoiceBillOrderDOS = list(queryWrapper); | ||
190 | + if (CollectionUtils.isEmpty(invoiceBillOrderDOS)) { | ||
191 | + return null; | ||
192 | + } | ||
193 | + Set<Long> ids = invoiceBillOrderDOS.stream().map(InvoiceBillOrderDO::getId).collect(Collectors.toSet()); | ||
194 | + List<InvoiceBillMappingDO> invoiceBillMappingDOS = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(InvoiceBillMappingDO::getInvoiceBillId, ids)); | ||
195 | + if (CollectionUtils.isEmpty(invoiceBillMappingDOS)) { | ||
196 | + return null; | ||
197 | + } | ||
198 | + Map<Long, InvoiceBillMappingDO> orderBillMap = invoiceBillMappingDOS.stream().collect(Collectors.toMap(InvoiceBillMappingDO::getOrderId, Function.identity(), (x, y) -> x)); | ||
199 | + List<InvoiceOrderBaseItemVO> itemVOS = getInvoiceOrderBaseItems(orderBillMap); | ||
200 | + Map<String, InvoiceBillOrderDO> invoiceBillOrderDOMap = invoiceBillOrderDOS.stream().collect(Collectors.toMap(InvoiceBillOrderDO::getInvoiceNo, Function.identity(), (x, y) -> x)); | ||
201 | + Map<String, List<InvoiceOrderBaseItemVO>> baseItemMap = itemVOS.stream().collect(Collectors.groupingBy(InvoiceOrderBaseItemVO::getInvoiceCode)); | ||
202 | + List<InvoiceBillAnalysisExportVO> exportVOS = wrapperAnalysisExport(invoiceBillOrderDOMap, baseItemMap); | ||
203 | + return wrapperAnalysisResultVO(exportVOS); | ||
204 | + } | ||
205 | + | ||
206 | + /** | ||
207 | + * @param exportVOS | ||
208 | + * @return | ||
209 | + */ | ||
210 | + private InvoiceBillAnalysisResultVO wrapperAnalysisResultVO(List<InvoiceBillAnalysisExportVO> exportVOS) { | ||
211 | + if (CollectionUtils.isEmpty(exportVOS)) { | ||
212 | + return null; | ||
213 | + } | ||
214 | + InvoiceBillAnalysisResultVO resultVO = InvoiceBillAnalysisResultVO.builder().exportVOS(exportVOS).build(); | ||
215 | + BigDecimal customerTotalPrice = new BigDecimal(Constant.ZERO); | ||
216 | + BigDecimal deductAmount = new BigDecimal(Constant.ZERO); | ||
217 | + BigDecimal actualReceivableAmount = new BigDecimal(Constant.ZERO); | ||
218 | + BigDecimal actualPayedAmount = new BigDecimal(Constant.ZERO); | ||
219 | + BigDecimal otherAmount = new BigDecimal(Constant.ZERO); | ||
220 | + BigDecimal otherTotalAmount = new BigDecimal(Constant.ZERO); | ||
221 | + for (InvoiceBillAnalysisExportVO exportVO : exportVOS) { | ||
222 | + if (Objects.nonNull(exportVO.getCustomerTotalPrice())) { | ||
223 | + customerTotalPrice = customerTotalPrice.add(exportVO.getCustomerTotalPrice()); | ||
224 | + } | ||
225 | + if (Objects.nonNull(exportVO.getDeductAmount())) { | ||
226 | + deductAmount = deductAmount.add(exportVO.getDeductAmount()); | ||
227 | + } | ||
228 | + if (Objects.nonNull(exportVO.getActualReceivableAmount())) { | ||
229 | + actualReceivableAmount = actualReceivableAmount.add(exportVO.getActualReceivableAmount()); | ||
230 | + } | ||
231 | + if (Objects.nonNull(exportVO.getActualPayedAmount())) { | ||
232 | + actualPayedAmount = actualPayedAmount.add(exportVO.getActualPayedAmount()); | ||
233 | + } | ||
234 | + if (Objects.nonNull(exportVO.getOtherAmount())) { | ||
235 | + otherAmount = customerTotalPrice.add(exportVO.getOtherAmount()); | ||
236 | + } | ||
237 | + if (Objects.nonNull(exportVO.getOtherTotalAmount())) { | ||
238 | + otherTotalAmount = otherTotalAmount.add(exportVO.getOtherTotalAmount()); | ||
239 | + } | ||
240 | + } | ||
241 | + resultVO.setCustomerTotalPrice(customerTotalPrice); | ||
242 | + resultVO.setDeductAmount(deductAmount); | ||
243 | + resultVO.setActualReceivableAmount(actualReceivableAmount); | ||
244 | + resultVO.setActualPayedAmount(actualPayedAmount); | ||
245 | + resultVO.setOtherAmount(otherAmount); | ||
246 | + resultVO.setOtherTotalAmount(otherTotalAmount); | ||
247 | + return resultVO; | ||
248 | + } | ||
249 | + | ||
250 | + /** | ||
251 | + * @param invoiceBillOrderDOMap | ||
252 | + * @param baseItemMap | ||
253 | + * @return | ||
254 | + */ | ||
255 | + private List<InvoiceBillAnalysisExportVO> wrapperAnalysisExport(Map<String, InvoiceBillOrderDO> invoiceBillOrderDOMap, Map<String, List<InvoiceOrderBaseItemVO>> baseItemMap) { | ||
256 | + if (CollectionUtils.isEmpty(invoiceBillOrderDOMap)) { | ||
257 | + return Collections.emptyList(); | ||
258 | + } | ||
259 | + List<InvoiceBillAnalysisExportVO> results = new ArrayList<>(); | ||
260 | + for (Map.Entry<String, InvoiceBillOrderDO> entry : invoiceBillOrderDOMap.entrySet()) { | ||
261 | + InvoiceBillOrderDO invoiceBillOrderDO = entry.getValue(); | ||
262 | + List<InvoiceBillAnalysisExportVO> exportVOS = transfer2analysisExportVO(invoiceBillOrderDO, baseItemMap); | ||
263 | + if (CollectionUtils.isNotEmpty(exportVOS)) { | ||
264 | + results.addAll(exportVOS); | ||
265 | + } | ||
266 | + } | ||
267 | + return results; | ||
268 | + } | ||
269 | + | ||
270 | + /** | ||
271 | + * @param invoiceBillOrderDO | ||
272 | + * @param baseItemMap | ||
273 | + * @return | ||
274 | + */ | ||
275 | + private List<InvoiceBillAnalysisExportVO> transfer2analysisExportVO(InvoiceBillOrderDO invoiceBillOrderDO, Map<String, List<InvoiceOrderBaseItemVO>> baseItemMap) { | ||
276 | + List<InvoiceBillAnalysisExportVO> results = new ArrayList<>(); | ||
277 | + String invoiceNo = invoiceBillOrderDO.getInvoiceNo(); | ||
278 | + if (baseItemMap.containsKey(invoiceNo)) { | ||
279 | + List<InvoiceOrderBaseItemVO> baseItemVOS = baseItemMap.get(invoiceNo); | ||
280 | + Map<String, List<InvoiceOrderBaseItemVO>> listMap = baseItemVOS.stream().collect(Collectors.groupingBy(InvoiceOrderBaseItemVO::getCustomerCode)); | ||
281 | + for (Map.Entry<String, List<InvoiceOrderBaseItemVO>> entry : listMap.entrySet()) { | ||
282 | + String customerCode = entry.getKey(); | ||
283 | + List<InvoiceOrderBaseItemVO> itemVOS = entry.getValue(); | ||
284 | + InvoiceBillAnalysisExportVO exportVO = buildAnalysisExportVO(invoiceBillOrderDO); | ||
285 | + exportVO.setCustomerCode(customerCode); | ||
286 | + if (CollectionUtils.isEmpty(itemVOS)) { | ||
287 | + exportVO.setCustomerTotalPrice(new BigDecimal(Constant.ZERO)); | ||
288 | + } else { | ||
289 | + BigDecimal customerTotalPrice = new BigDecimal(Constant.ZERO); | ||
290 | + for (InvoiceOrderBaseItemVO itemVO : itemVOS) { | ||
291 | + customerTotalPrice = customerTotalPrice.add(Objects.nonNull(itemVO.getCustomerTotalPrice()) ? itemVO.getCustomerTotalPrice() : new BigDecimal(Constant.ZERO)); | ||
292 | + } | ||
293 | + exportVO.setCustomerTotalPrice(customerTotalPrice); | ||
294 | + } | ||
295 | + results.add(exportVO); | ||
296 | + } | ||
297 | + } | ||
298 | + return results; | ||
299 | + } | ||
300 | + | ||
301 | + /** | ||
302 | + * @param invoiceBillOrderDO | ||
303 | + * @return | ||
304 | + */ | ||
305 | + private InvoiceBillAnalysisExportVO buildAnalysisExportVO(InvoiceBillOrderDO invoiceBillOrderDO) { | ||
306 | + InvoiceBillAnalysisExportVO exportVO = new InvoiceBillAnalysisExportVO(); | ||
307 | + BeanUtils.copyProperties(invoiceBillOrderDO, exportVO); | ||
308 | + BigDecimal actualPayedAmount = new BigDecimal(Constant.ZERO); | ||
309 | + if (Objects.nonNull(invoiceBillOrderDO.getActualPayedAmount1())) { | ||
310 | + actualPayedAmount = actualPayedAmount.add(invoiceBillOrderDO.getActualPayedAmount1()); | ||
311 | + } | ||
312 | + if (Objects.nonNull(invoiceBillOrderDO.getActualPayedAmount2())) { | ||
313 | + actualPayedAmount = actualPayedAmount.add(invoiceBillOrderDO.getActualPayedAmount2()); | ||
314 | + } | ||
315 | + if (Objects.nonNull(invoiceBillOrderDO.getActualPayedAmount3())) { | ||
316 | + actualPayedAmount = actualPayedAmount.add(invoiceBillOrderDO.getActualPayedAmount3()); | ||
317 | + } | ||
318 | + exportVO.setActualPayedAmount(actualPayedAmount); | ||
319 | + BigDecimal otherAmount = (Objects.nonNull(invoiceBillOrderDO.getActualReceivableAmount()) ? invoiceBillOrderDO.getActualReceivableAmount() : new BigDecimal(Constant.ZERO)) | ||
320 | + .subtract(exportVO.getActualPayedAmount()); | ||
321 | + exportVO.setOtherAmount(otherAmount); | ||
322 | + BigDecimal otherTotalAmount = (Objects.nonNull(invoiceBillOrderDO.getActualReceivableAmount()) ? invoiceBillOrderDO.getActualReceivableAmount() : new BigDecimal(Constant.ZERO)) | ||
323 | + .subtract(exportVO.getActualPayedAmount()).subtract(otherAmount); | ||
324 | + exportVO.setOtherTotalAmount(otherTotalAmount); | ||
325 | + return exportVO; | ||
326 | + } | ||
327 | + | ||
328 | + /** | ||
329 | + * @param mappingDOMap | ||
330 | + * @return | ||
331 | + */ | ||
332 | + private List<InvoiceOrderBaseItemVO> getInvoiceOrderBaseItems(Map<Long, InvoiceBillMappingDO> mappingDOMap) { | ||
333 | + Set<Long> orderIds = mappingDOMap.keySet(); | ||
334 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(orderIds); | ||
335 | + List<OrderProfitAnalysisDO> profitAnalysisDOS = profitAnalysisService.list(new LambdaQueryWrapper<OrderProfitAnalysisDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN).in(OrderProfitAnalysisDO::getOrderId, orderIds)); | ||
336 | + Map<Long, OrderBaseInfoDO> orderBaseInfoDOMap = orderBaseInfoDOList.stream().collect(Collectors.toMap(OrderBaseInfoDO::getId, Function.identity(), (x, y) -> x)); | ||
337 | + Map<Long, OrderProfitAnalysisDO> profitAnalysisDOMap = profitAnalysisDOS.stream().collect(Collectors.toMap(OrderProfitAnalysisDO::getOrderId, Function.identity(), (x, y) -> x)); | ||
338 | + List<InvoiceOrderBaseItemVO> baseItemVOS = new ArrayList<>(); | ||
339 | + for (Map.Entry<Long, OrderBaseInfoDO> entry : orderBaseInfoDOMap.entrySet()) { | ||
340 | + Long orderId = entry.getKey(); | ||
341 | + OrderBaseInfoDO baseInfoDO = entry.getValue(); | ||
342 | + InvoiceOrderBaseItemVO itemVO = InvoiceOrderBaseItemVO.builder() | ||
343 | + .orderId(orderId) | ||
344 | + .customerCode(baseInfoDO.getCustomerCode()) | ||
345 | + .build(); | ||
346 | + if (profitAnalysisDOMap.containsKey(orderId)) { | ||
347 | + OrderProfitAnalysisDO profitAnalysisDO = profitAnalysisDOMap.get(orderId); | ||
348 | + itemVO.setCustomerTotalPrice(Objects.isNull(profitAnalysisDO.getCustomerTotalPrice()) ? new BigDecimal(Constant.ZERO) : new BigDecimal(profitAnalysisDO.getCustomerTotalPrice())); | ||
349 | + } else { | ||
350 | + itemVO.setCustomerTotalPrice(new BigDecimal(Constant.ZERO)); | ||
351 | + } | ||
352 | + | ||
353 | + if (mappingDOMap.containsKey(orderId)) { | ||
354 | + InvoiceBillMappingDO mappingDO = mappingDOMap.get(orderId); | ||
355 | + itemVO.setInvoiceCode(mappingDO.getInvoiceNo()); | ||
356 | + } | ||
357 | + baseItemVOS.add(itemVO); | ||
358 | + } | ||
359 | + return baseItemVOS; | ||
360 | + } | ||
361 | + | ||
84 | /** | 362 | /** |
85 | * @param queryVO | 363 | * @param queryVO |
86 | * @return | 364 | * @return |
@@ -165,6 +443,74 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | @@ -165,6 +443,74 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | ||
165 | return ServerResult.success(); | 443 | return ServerResult.success(); |
166 | } | 444 | } |
167 | 445 | ||
446 | + @Override | ||
447 | + public ServerResult getBackRefundDate(InvoiceBillCreateVO createVO) { | ||
448 | + List<OrderBaseInfoDO> orderBaseInfoDOList = orderBaseInfoService.listByIds(createVO.getOrderIds()); | ||
449 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | ||
450 | + throw new BusinessException("勾选的订单信息不存在!"); | ||
451 | + } | ||
452 | + | ||
453 | + InvoiceHoldTimeItemVO invoiceHoldTimeItemVO = getCustomerHoldTime(orderBaseInfoDOList); | ||
454 | + | ||
455 | + return ServerResult.success(calculateBackRefundDate(invoiceHoldTimeItemVO)); | ||
456 | + } | ||
457 | + | ||
458 | + /** | ||
459 | + * @param invoiceHoldTimeItemVO | ||
460 | + * @return | ||
461 | + */ | ||
462 | + private String calculateBackRefundDate(InvoiceHoldTimeItemVO invoiceHoldTimeItemVO) { | ||
463 | + Integer holdDays = getHoldTimeByCustomerCode(invoiceHoldTimeItemVO.getCustomerCode()); | ||
464 | + LocalDateTime holdTime = DateUtils.parse(invoiceHoldTimeItemVO.getHoldTime(), DateUtils.DATE_TIME).plusDays(holdDays); | ||
465 | + return DateUtils.format(holdTime, DateUtils.DATE); | ||
466 | + } | ||
467 | + | ||
468 | + /** | ||
469 | + * @param customerCode | ||
470 | + * @return | ||
471 | + */ | ||
472 | + private Integer getHoldTimeByCustomerCode(String customerCode) { | ||
473 | + SystemSettingDO systemSettingDO = systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | ||
474 | + .eq(SystemSettingDO::getSettingCode, "customerCode").eq(SystemSettingDO::getSettingValue, customerCode) | ||
475 | + .eq(SystemSettingDO::getRelationCode, "orderHodTime").last("limit 1")); | ||
476 | + String holdTime = systemSettingDO.getRelationValue(); | ||
477 | + return StringUtils.isBlank(holdTime) ? Constant.ZERO : Integer.parseInt(holdTime); | ||
478 | + } | ||
479 | + | ||
480 | + /** | ||
481 | + * @param orderBaseInfoDOList | ||
482 | + * @return | ||
483 | + */ | ||
484 | + private InvoiceHoldTimeItemVO getCustomerHoldTime(List<OrderBaseInfoDO> orderBaseInfoDOList) { | ||
485 | + if (CollectionUtils.isEmpty(orderBaseInfoDOList)) { | ||
486 | + return null; | ||
487 | + } | ||
488 | + | ||
489 | + Map<String, OrderBaseInfoDO> holdTimeMap = new HashMap<String, OrderBaseInfoDO>(); | ||
490 | + String maxHoldTime = null; | ||
491 | + for (OrderBaseInfoDO baseInfoDO : orderBaseInfoDOList) { | ||
492 | + if (StringUtils.isNotBlank(baseInfoDO.getOrderHodTime())) { | ||
493 | + holdTimeMap.put(baseInfoDO.getOrderHodTime(), baseInfoDO); | ||
494 | + if (StringUtils.isBlank(maxHoldTime)) { | ||
495 | + maxHoldTime = baseInfoDO.getOrderHodTime(); | ||
496 | + } else if (maxHoldTime.compareTo(baseInfoDO.getOrderHodTime()) <= 0) { | ||
497 | + maxHoldTime = baseInfoDO.getOrderHodTime(); | ||
498 | + } | ||
499 | + } | ||
500 | + } | ||
501 | + if (StringUtils.isBlank(maxHoldTime)) { | ||
502 | + return null; | ||
503 | + } | ||
504 | + InvoiceHoldTimeItemVO itemVO = new InvoiceHoldTimeItemVO(); | ||
505 | + if (holdTimeMap.containsKey(maxHoldTime)) { | ||
506 | + OrderBaseInfoDO baseInfoDO = holdTimeMap.get(maxHoldTime); | ||
507 | + itemVO.setCustomerCode(baseInfoDO.getCustomerCode()); | ||
508 | + itemVO.setHoldTime(maxHoldTime); | ||
509 | + itemVO.setBaseInfoDO(baseInfoDO); | ||
510 | + } | ||
511 | + return itemVO; | ||
512 | + } | ||
513 | + | ||
168 | /** | 514 | /** |
169 | * @param createVO | 515 | * @param createVO |
170 | * @return | 516 | * @return |
@@ -174,6 +520,7 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | @@ -174,6 +520,7 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | ||
174 | .invoiceNo(createVO.getInvoiceNo()) | 520 | .invoiceNo(createVO.getInvoiceNo()) |
175 | .bgUrl(createVO.getBgUrl()) | 521 | .bgUrl(createVO.getBgUrl()) |
176 | .backRefundDate(createVO.getBackRefundDate()) | 522 | .backRefundDate(createVO.getBackRefundDate()) |
523 | + .status(ApplyStatusEnum.NO_COMMIT.getStatus()) | ||
177 | .build(); | 524 | .build(); |
178 | } | 525 | } |
179 | 526 | ||
@@ -218,6 +565,10 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | @@ -218,6 +565,10 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | ||
218 | throw new BusinessException("存在相同的invoice订单!"); | 565 | throw new BusinessException("存在相同的invoice订单!"); |
219 | } | 566 | } |
220 | 567 | ||
568 | + List<InvoiceBillMappingDO> invoiceBillMappingDOList = invoiceBillMappingService.list(new LambdaQueryWrapper<InvoiceBillMappingDO>().eq(BaseDO::getEnableFlag,Constant.ENABLE_TEN).in(InvoiceBillMappingDO::getOrderId,createVO.getOrderIds())); | ||
569 | + if (CollectionUtils.isNotEmpty(invoiceBillMappingDOList)) { | ||
570 | + throw new BusinessException("该勾选的订单已经绑定其他账单了!"); | ||
571 | + } | ||
221 | } | 572 | } |
222 | 573 | ||
223 | /** | 574 | /** |
@@ -235,6 +586,9 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | @@ -235,6 +586,9 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | ||
235 | if (Objects.isNull(invoiceBillOrderDo)) { | 586 | if (Objects.isNull(invoiceBillOrderDo)) { |
236 | throw new BusinessException("应收款单据不存在"); | 587 | throw new BusinessException("应收款单据不存在"); |
237 | } | 588 | } |
589 | + | ||
590 | + checkCommitApply(invoiceBillOrderDo.getId()); | ||
591 | + | ||
238 | invoiceBillOrderDo.setDeductUrl(deductInfoVO.getDeductUrl()); | 592 | invoiceBillOrderDo.setDeductUrl(deductInfoVO.getDeductUrl()); |
239 | invoiceBillOrderDo.setDeductAmount(deductInfoVO.getDeductAmount()); | 593 | invoiceBillOrderDo.setDeductAmount(deductInfoVO.getDeductAmount()); |
240 | updateById(invoiceBillOrderDo); | 594 | updateById(invoiceBillOrderDo); |
@@ -250,6 +604,9 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | @@ -250,6 +604,9 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | ||
250 | if (Objects.isNull(invoiceBillOrderDo)) { | 604 | if (Objects.isNull(invoiceBillOrderDo)) { |
251 | throw new BusinessException("应收款单据不存在"); | 605 | throw new BusinessException("应收款单据不存在"); |
252 | } | 606 | } |
607 | + | ||
608 | + checkCommitApply(invoiceBillOrderDo.getId()); | ||
609 | + | ||
253 | invoiceBillOrderDo.setBgUrl(amountInfoVO.getBgUrl()); | 610 | invoiceBillOrderDo.setBgUrl(amountInfoVO.getBgUrl()); |
254 | invoiceBillOrderDo.setActualReceivableAmount(amountInfoVO.getActualReceivableAmount()); | 611 | invoiceBillOrderDo.setActualReceivableAmount(amountInfoVO.getActualReceivableAmount()); |
255 | invoiceBillOrderDo.setActualPayedAmount1(amountInfoVO.getActualPayedAmount1()); | 612 | invoiceBillOrderDo.setActualPayedAmount1(amountInfoVO.getActualPayedAmount1()); |
@@ -261,6 +618,73 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | @@ -261,6 +618,73 @@ public class InvoiceBillOrderServiceImpl extends ServiceImpl<InvoiceBillOrderMap | ||
261 | } | 618 | } |
262 | 619 | ||
263 | /** | 620 | /** |
621 | + * @param id | ||
622 | + */ | ||
623 | + private void checkCommitApply(Long id) { | ||
624 | + OrderFieldLockApplyDO applyDO = orderFieldLockApplyService.getOne(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | ||
625 | + .eq(OrderFieldLockApplyDO::getEnableFlag, Constant.ENABLE_TEN) | ||
626 | + .eq(OrderFieldLockApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus()) | ||
627 | + .eq(OrderFieldLockApplyDO::getOrderId, id).last("limit 1")); | ||
628 | + if (Objects.nonNull(applyDO)) { | ||
629 | + throw new BusinessException("该账单还在审批中,请联系总经理审批后操作!"); | ||
630 | + } | ||
631 | + } | ||
632 | + | ||
633 | + @Override | ||
634 | + public ServerResult commitApply(InvoiceBillCommitApplyVO commitApplyVO) { | ||
635 | + InvoiceBillOrderDO invoiceBillOrderDO = getById(commitApplyVO.getId()); | ||
636 | + if (Objects.isNull(invoiceBillOrderDO)) { | ||
637 | + throw new BusinessException("账单不存在!"); | ||
638 | + } | ||
639 | + Long userId = dataScope.getLoginUserId(); | ||
640 | + checkApply(commitApplyVO, userId); | ||
641 | + | ||
642 | + OrderFieldLockApplyDO applyDO = initOrderFieldLockApplyDO(invoiceBillOrderDO, userId); | ||
643 | + transactionHelper.run(() -> { | ||
644 | + orderFieldLockApplyService.save(applyDO); | ||
645 | + invoiceBillOrderDO.setStatus(ApplyStatusEnum.WAIT_AUDIT.getStatus()); | ||
646 | + invoiceBillOrderDO.setActualRefundDate(DateUtils.format(LocalDateTime.now(), DateUtils.DATE)); | ||
647 | + updateById(invoiceBillOrderDO); | ||
648 | + }); | ||
649 | + return ServerResult.success(); | ||
650 | + } | ||
651 | + | ||
652 | + /** | ||
653 | + * @param commitApplyVO | ||
654 | + * @param userId | ||
655 | + */ | ||
656 | + private void checkApply(InvoiceBillCommitApplyVO commitApplyVO, Long userId) { | ||
657 | + List<OrderFieldLockApplyDO> applyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | ||
658 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | ||
659 | + .eq(OrderFieldLockApplyDO::getOrderId, commitApplyVO.getId()) | ||
660 | + .eq(OrderFieldLockApplyDO::getApplyUserId, userId) | ||
661 | + .eq(OrderFieldLockApplyDO::getType, ApplyTypeEnum.INVOICE_BILL_APPLY.getType()) | ||
662 | + .eq(OrderFieldLockApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus())); | ||
663 | + if (CollectionUtils.isNotEmpty(applyDOS)) { | ||
664 | + throw new BusinessException(ServerResultCode.APPLY_UNLOCK_FIELD_EXIST); | ||
665 | + } | ||
666 | + } | ||
667 | + | ||
668 | + /** | ||
669 | + * @param invoiceBillOrderDO | ||
670 | + * @param userId | ||
671 | + * @return | ||
672 | + */ | ||
673 | + private OrderFieldLockApplyDO initOrderFieldLockApplyDO(InvoiceBillOrderDO invoiceBillOrderDO, Long userId) { | ||
674 | + OrderLockFieldVO lockFieldVO = new OrderLockFieldVO(); | ||
675 | + BeanUtils.copyProperties(invoiceBillOrderDO, lockFieldVO); | ||
676 | + return OrderFieldLockApplyDO.builder() | ||
677 | + .applyUserId(userId) | ||
678 | + .auditUserId(null) | ||
679 | + .fields(JSONObject.toJSONString(lockFieldVO)) | ||
680 | + .orderId(invoiceBillOrderDO.getId()) | ||
681 | + .type(ApplyTypeEnum.INVOICE_BILL_APPLY.getType()) | ||
682 | + .remark(ApplyTypeEnum.INVOICE_BILL_APPLY.getDesc()) | ||
683 | + .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) | ||
684 | + .build(); | ||
685 | + } | ||
686 | + | ||
687 | + /** | ||
264 | * 通过主键删除数据 | 688 | * 通过主键删除数据 |
265 | * | 689 | * |
266 | * @param invoiceBillOrderQueryVO 筛选条件 | 690 | * @param invoiceBillOrderQueryVO 筛选条件 |
src/main/java/com/order/erp/service/order/impl/OrderFieldLockApplyServiceImpl.java
@@ -72,6 +72,9 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp | @@ -72,6 +72,9 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp | ||
72 | @Resource | 72 | @Resource |
73 | private OrderInspectionStageService inspectionStageService; | 73 | private OrderInspectionStageService inspectionStageService; |
74 | 74 | ||
75 | + @Resource | ||
76 | + private InvoiceBillOrderService invoiceBillOrderService; | ||
77 | + | ||
75 | /** | 78 | /** |
76 | * 通过ID查询单条数据 | 79 | * 通过ID查询单条数据 |
77 | * <p> | 80 | * <p> |
@@ -336,7 +339,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp | @@ -336,7 +339,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp | ||
336 | .in(CollectionUtils.isNotEmpty(orderIds), OrderFieldLockApplyDO::getOrderId, orderIds); | 339 | .in(CollectionUtils.isNotEmpty(orderIds), OrderFieldLockApplyDO::getOrderId, orderIds); |
337 | if (Objects.isNull(roleSelect)) { | 340 | if (Objects.isNull(roleSelect)) { |
338 | queryWrapper.like(Objects.nonNull(roleEnum), OrderFieldLockApplyDO::getAuditRoleCodes, roleEnum.getCode()); | 341 | queryWrapper.like(Objects.nonNull(roleEnum), OrderFieldLockApplyDO::getAuditRoleCodes, roleEnum.getCode()); |
339 | - }else { | 342 | + } else { |
340 | queryWrapper.eq(Objects.nonNull(roleSelect), OrderFieldLockApplyDO::getAuditRoleCodes, roleSelect.getCode()); | 343 | queryWrapper.eq(Objects.nonNull(roleSelect), OrderFieldLockApplyDO::getAuditRoleCodes, roleSelect.getCode()); |
341 | 344 | ||
342 | } | 345 | } |
@@ -395,7 +398,12 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp | @@ -395,7 +398,12 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp | ||
395 | } else if (ApplyTypeEnum.ORDER_PROFIT_APPLY.getType().equals(applyDO.getType())) { | 398 | } else if (ApplyTypeEnum.ORDER_PROFIT_APPLY.getType().equals(applyDO.getType())) { |
396 | orderBaseInfoDO.setOrderStatus(OrderStatusEnum.PROFIT_AUDIT_REFUSE.getStatus()); | 399 | orderBaseInfoDO.setOrderStatus(OrderStatusEnum.PROFIT_AUDIT_REFUSE.getStatus()); |
397 | orderBaseInfoService.updateById(orderBaseInfoDO); | 400 | orderBaseInfoService.updateById(orderBaseInfoDO); |
401 | + } else if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType())) { | ||
402 | + InvoiceBillOrderDO invoiceBillOrderDO = JSONObject.parseObject(applyDO.getFields(), InvoiceBillOrderDO.class); | ||
403 | + invoiceBillOrderDO.setStatus(ApplyStatusEnum.AUDIT_REFUSE.getStatus()); | ||
404 | + invoiceBillOrderService.updateById(invoiceBillOrderDO); | ||
398 | } | 405 | } |
406 | + | ||
399 | OrderAuditLogDO auditLogDO = OrderAuditLogDO.builder().applyId(applyDO.getId()).orderId(applyDO.getOrderId()).optType(ApplyStatusEnum.AUDIT_REFUSE.getDesc()).build(); | 407 | OrderAuditLogDO auditLogDO = OrderAuditLogDO.builder().applyId(applyDO.getId()).orderId(applyDO.getOrderId()).optType(ApplyStatusEnum.AUDIT_REFUSE.getDesc()).build(); |
400 | 408 | ||
401 | applyService.updateById(applyDO); | 409 | applyService.updateById(applyDO); |
@@ -516,6 +524,10 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp | @@ -516,6 +524,10 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl<OrderFieldLockAp | ||
516 | } | 524 | } |
517 | orderBaseInfoDO.setOrderStatus(OrderStatusEnum.PROFIT_AUDIT_PASS.getStatus()); | 525 | orderBaseInfoDO.setOrderStatus(OrderStatusEnum.PROFIT_AUDIT_PASS.getStatus()); |
518 | orderBaseInfoService.updateById(orderBaseInfoDO); | 526 | orderBaseInfoService.updateById(orderBaseInfoDO); |
527 | + } else if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType())) { | ||
528 | + InvoiceBillOrderDO invoiceBillOrderDO = JSONObject.parseObject(applyDO.getFields(), InvoiceBillOrderDO.class); | ||
529 | + invoiceBillOrderDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus()); | ||
530 | + invoiceBillOrderService.updateById(invoiceBillOrderDO); | ||
519 | } | 531 | } |
520 | 532 | ||
521 | OrderAuditLogDO auditLogDO = OrderAuditLogDO.builder().applyId(applyDO.getId()).orderId(applyDO.getOrderId()).optType(ApplyStatusEnum.AUDIT_PASS.getDesc()).build(); | 533 | OrderAuditLogDO auditLogDO = OrderAuditLogDO.builder().applyId(applyDO.getId()).orderId(applyDO.getOrderId()).optType(ApplyStatusEnum.AUDIT_PASS.getDesc()).build(); |