Commit 8856aa063748417bf582ed2349fc06060b3df242

Authored by 谢茂盛
1 parent e13bd966

fix: 利润率计算公式修复/导出勾选项修复

src/main/java/com/order/erp/common/utils/ProfitUtils.java
@@ -73,7 +73,7 @@ public class ProfitUtils { @@ -73,7 +73,7 @@ public class ProfitUtils {
73 if (v.intValue() <= 0) { 73 if (v.intValue() <= 0) {
74 return 0; 74 return 0;
75 } 75 }
76 -  
77 - return new BigDecimal(1).subtract((productionDepartmentTotalPrice.divide(exchangeRate, 4, BigDecimal.ROUND_HALF_UP).divide(v))).doubleValue(); 76 + BigDecimal result = productionDepartmentTotalPrice.divide(exchangeRate, 4, BigDecimal.ROUND_HALF_UP).divide(v, 4, BigDecimal.ROUND_HALF_UP);
  77 + return new BigDecimal(1).subtract(result).doubleValue();
78 } 78 }
79 } 79 }
src/main/java/com/order/erp/domain/vo/OrderProfitAnalysisVo.java
@@ -34,5 +34,5 @@ public class OrderProfitAnalysisVo implements Serializable { @@ -34,5 +34,5 @@ public class OrderProfitAnalysisVo implements Serializable {
34 * 汇率 34 * 汇率
35 */ 35 */
36 @NotNull(message = "请选择当天汇率进行计算") 36 @NotNull(message = "请选择当天汇率进行计算")
37 - private Double exchangeRate; 37 + private String exchangeRate;
38 } 38 }
src/main/java/com/order/erp/domain/vo/order/ProfitCalculateVO.java
@@ -39,7 +39,7 @@ public class ProfitCalculateVO implements Serializable { @@ -39,7 +39,7 @@ public class ProfitCalculateVO implements Serializable {
39 /** 39 /**
40 * 默认 0 公式1,1 公式2 40 * 默认 0 公式1,1 公式2
41 */ 41 */
42 - private int profitType; 42 + private Integer profitType;
43 43
44 44
45 } 45 }
src/main/java/com/order/erp/service/order/impl/OrderProfitAnalysisServiceImpl.java
@@ -179,8 +179,8 @@ public class OrderProfitAnalysisServiceImpl extends ServiceImpl&lt;OrderProfitAnaly @@ -179,8 +179,8 @@ public class OrderProfitAnalysisServiceImpl extends ServiceImpl&lt;OrderProfitAnaly
179 profitAnalysisVO.setCustomerTotalPrice(customerTotalPrice.doubleValue()); 179 profitAnalysisVO.setCustomerTotalPrice(customerTotalPrice.doubleValue());
180 profitAnalysisVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.doubleValue()); 180 profitAnalysisVO.setProductionDepartmentTotalPrice(productionDepartmentTotalPrice.doubleValue());
181 profitAnalysisVO.setProfitRate(ProfitUtils.calculateProfitRate(ProfitCalculateVO.builder() 181 profitAnalysisVO.setProfitRate(ProfitUtils.calculateProfitRate(ProfitCalculateVO.builder()
182 - .profitType(StringUtils.isBlank(profitAnalysisVo.getProfitType()) ? Constant.ZERO : Integer.parseInt(profitAnalysisVO.getProfitType()))  
183 - .exchangeRate(profitAnalysisVo.getExchangeRate()) 182 + .profitType(StringUtils.isBlank(profitAnalysisVo.getProfitType()) ? Constant.ZERO : Integer.parseInt(profitAnalysisVo.getProfitType()))
  183 + .exchangeRate(Double.parseDouble(profitAnalysisVo.getExchangeRate()))
184 .productionDepartmentTotalPrice(productionDepartmentTotalPrice.doubleValue()) 184 .productionDepartmentTotalPrice(productionDepartmentTotalPrice.doubleValue())
185 .packetTotalPrice(packetTotalPrice.doubleValue()) 185 .packetTotalPrice(packetTotalPrice.doubleValue())
186 .customerTotalPrice(customerTotalPrice.doubleValue()).build())); 186 .customerTotalPrice(customerTotalPrice.doubleValue()).build()));