Commit 3182e5d7598e49b3a7a9873f67ec6446bd5d0b29

Authored by 谢茂盛
1 parent 90083703

fix: 补齐利润分析字段

sql/table.sql
@@ -39,10 +39,13 @@ CREATE TABLE `order_profit_analysis` ( @@ -39,10 +39,13 @@ CREATE TABLE `order_profit_analysis` (
39 `order_id` bigint NOT NULL COMMENT '订单id', 39 `order_id` bigint NOT NULL COMMENT '订单id',
40 `customer_price` DOUBLE DEFAULT 0 COMMENT '客户单价$', 40 `customer_price` DOUBLE DEFAULT 0 COMMENT '客户单价$',
41 `customer_total_price` DOUBLE DEFAULT 0 COMMENT '客户总价$', 41 `customer_total_price` DOUBLE DEFAULT 0 COMMENT '客户总价$',
  42 + `customer_currency` varchar(32) DEFAULT NULL COMMENT '客户价格货币',
42 `production_department_price` DOUBLE DEFAULT 0 COMMENT '生成科单价¥', 43 `production_department_price` DOUBLE DEFAULT 0 COMMENT '生成科单价¥',
43 `production_department_total_price` DOUBLE DEFAULT 0 COMMENT '生成科总价¥', 44 `production_department_total_price` DOUBLE DEFAULT 0 COMMENT '生成科总价¥',
  45 + `production_department_currency` varchar(32) DEFAULT NULL COMMENT '生成科货币',
44 `packet_price` DOUBLE DEFAULT 0 COMMENT '包装费用¥', 46 `packet_price` DOUBLE DEFAULT 0 COMMENT '包装费用¥',
45 `packet_total_price` DOUBLE DEFAULT 0 COMMENT '包装费用合计¥', 47 `packet_total_price` DOUBLE DEFAULT 0 COMMENT '包装费用合计¥',
  48 + `packet_currency` varchar(32) DEFAULT NULL COMMENT '包装费货币',
46 `exchange_rate` DOUBLE DEFAULT 0 COMMENT '汇率', 49 `exchange_rate` DOUBLE DEFAULT 0 COMMENT '汇率',
47 `profit_rate` DOUBLE DEFAULT 0 COMMENT '利润率', 50 `profit_rate` DOUBLE DEFAULT 0 COMMENT '利润率',
48 `order_status` INT NOT NULL COMMENT '订单状态', 51 `order_status` INT NOT NULL COMMENT '订单状态',
src/main/java/com/order/erp/domain/dto/order/OrderProfitAnalysisDO.java
@@ -36,6 +36,12 @@ public class OrderProfitAnalysisDO extends BaseDO implements Serializable { @@ -36,6 +36,12 @@ public class OrderProfitAnalysisDO extends BaseDO implements Serializable {
36 * 客户总价$ 36 * 客户总价$
37 */ 37 */
38 private Double customerTotalPrice; 38 private Double customerTotalPrice;
  39 +
  40 + /**
  41 + * 客户价格货币
  42 + */
  43 + private String customerCurrency;
  44 +
39 /** 45 /**
40 * 生成科单价¥ 46 * 生成科单价¥
41 */ 47 */
@@ -44,6 +50,12 @@ public class OrderProfitAnalysisDO extends BaseDO implements Serializable { @@ -44,6 +50,12 @@ public class OrderProfitAnalysisDO extends BaseDO implements Serializable {
44 * 生成科总价¥ 50 * 生成科总价¥
45 */ 51 */
46 private Double productionDepartmentTotalPrice; 52 private Double productionDepartmentTotalPrice;
  53 +
  54 + /**
  55 + * 生成科货币
  56 + */
  57 + private String productionDepartmentCurrency;
  58 +
47 /** 59 /**
48 * 包装费用¥ 60 * 包装费用¥
49 */ 61 */
@@ -52,6 +64,12 @@ public class OrderProfitAnalysisDO extends BaseDO implements Serializable { @@ -52,6 +64,12 @@ public class OrderProfitAnalysisDO extends BaseDO implements Serializable {
52 * 包装费用合计¥ 64 * 包装费用合计¥
53 */ 65 */
54 private Double packetTotalPrice; 66 private Double packetTotalPrice;
  67 +
  68 + /**
  69 + * 包装费货币
  70 + */
  71 + private String packetCurrency;
  72 +
55 /** 73 /**
56 * 汇率 74 * 汇率
57 */ 75 */
src/main/java/com/order/erp/domain/vo/order/OrderProfitAnalysisVO.java
@@ -33,6 +33,12 @@ public class OrderProfitAnalysisVO implements Serializable { @@ -33,6 +33,12 @@ public class OrderProfitAnalysisVO implements Serializable {
33 * 客户总价$ 33 * 客户总价$
34 */ 34 */
35 private Double customerTotalPrice; 35 private Double customerTotalPrice;
  36 +
  37 + /**
  38 + * 客户价格货币
  39 + */
  40 + private String customerCurrency;
  41 +
36 /** 42 /**
37 * 生成科单价¥ 43 * 生成科单价¥
38 */ 44 */
@@ -41,6 +47,12 @@ public class OrderProfitAnalysisVO implements Serializable { @@ -41,6 +47,12 @@ public class OrderProfitAnalysisVO implements Serializable {
41 * 生成科总价¥ 47 * 生成科总价¥
42 */ 48 */
43 private Double productionDepartmentTotalPrice; 49 private Double productionDepartmentTotalPrice;
  50 +
  51 + /**
  52 + * 生成科货币
  53 + */
  54 + private String productionDepartmentCurrency;
  55 +
44 /** 56 /**
45 * 包装费用¥ 57 * 包装费用¥
46 */ 58 */
@@ -49,6 +61,12 @@ public class OrderProfitAnalysisVO implements Serializable { @@ -49,6 +61,12 @@ public class OrderProfitAnalysisVO implements Serializable {
49 * 包装费用合计¥ 61 * 包装费用合计¥
50 */ 62 */
51 private Double packetTotalPrice; 63 private Double packetTotalPrice;
  64 +
  65 + /**
  66 + * 包装费货币
  67 + */
  68 + private String packetCurrency;
  69 +
52 /** 70 /**
53 * 汇率 71 * 汇率
54 */ 72 */
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
@@ -546,11 +546,17 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O @@ -546,11 +546,17 @@ public class OrderBaseInfoServiceImpl extends ServiceImpl<OrderBaseInfoMapper, O
546 BeanUtils.copyProperties(profitAnalysisVO, profitAnalysisDO); 546 BeanUtils.copyProperties(profitAnalysisVO, profitAnalysisDO);
547 profitAnalysisDO.setOrderId(baseInfoDO.getId()); 547 profitAnalysisDO.setOrderId(baseInfoDO.getId());
548 profitAnalysisDO.setOrderStatus(OrderStatusEnum.PROFIT_WAIT_AUDIT.getStatus()); 548 profitAnalysisDO.setOrderStatus(OrderStatusEnum.PROFIT_WAIT_AUDIT.getStatus());
549 - profitAnalysisDO.setProfitRate(ProfitUtils.calculateProfitRate(ProfitCalculateVO.builder()  
550 - .customerTotalPrice(profitAnalysisDO.getCustomerTotalPrice())  
551 - .exchangeRate(profitAnalysisDO.getExchangeRate())  
552 - .packetTotalPrice(profitAnalysisDO.getPacketTotalPrice())  
553 - .productionDepartmentTotalPrice(profitAnalysisDO.getProductionDepartmentTotalPrice()).build())); 549 + if (Objects.nonNull(profitAnalysisDO.getCustomerTotalPrice())
  550 + && Objects.nonNull(profitAnalysisDO.getExchangeRate())
  551 + && Objects.nonNull(profitAnalysisDO.getPacketTotalPrice())
  552 + && Objects.nonNull(profitAnalysisDO.getProductionDepartmentTotalPrice())) {
  553 + profitAnalysisDO.setProfitRate(ProfitUtils.calculateProfitRate(ProfitCalculateVO.builder()
  554 + .customerTotalPrice(profitAnalysisDO.getCustomerTotalPrice())
  555 + .exchangeRate(profitAnalysisDO.getExchangeRate())
  556 + .packetTotalPrice(profitAnalysisDO.getPacketTotalPrice())
  557 + .productionDepartmentTotalPrice(profitAnalysisDO.getProductionDepartmentTotalPrice()).build()));
  558 + }
  559 +
554 profitAnalysisService.save(profitAnalysisDO); 560 profitAnalysisService.save(profitAnalysisDO);
555 } 561 }
556 562