Commit af00c02f47dc219fde383b21a1137c6785f49a37

Authored by chenhang4442024
1 parent 5c716366

feat:1.对于提成配置添加年份,为每一年的客户编码都添加配置,不再采用之前的,每一年的客户编码都采用同一个,例如:A06-2403,A06-2303以前都是…

…采用A06的提成配置,现在给每一个年份都有各自的提成配置,通过项目号A06-2303的第五位和第六位共同决定是属于哪一年,确定年之后再去查找对应的客户编码的提成配置。而在系统配置中,systemSettingDO表中是relationName来存储年份。

fix:1.业务研发净利润计算不正确的问题
      1.1综合收益不再需要汇率收益计算。
      1.2不在需要实际汇率参与计算
Showing 22 changed files with 328 additions and 183 deletions
src/main/java/com/order/erp/common/constant/Constant.java
... ... @@ -163,7 +163,7 @@ public class Constant {
163 163 public static final int FOURTEEN= 14;
164 164 public static final Integer THIRTY = 30;
165 165  
166   - public static final int SIXTY = 60;
  166 + public static final Integer SIXTY = 60;
167 167 public static final int TWENTY_FIRST = 21;
168 168  
169 169  
... ...
src/main/java/com/order/erp/controller/OrderCostController.java
... ... @@ -73,15 +73,15 @@ public class OrderCostController {
73 73  
74 74 @PostMapping("/setPackStatus")
75 75 @ApiOperation("设置包装费用明细表的状态")
76   - public void setPackStatus(@RequestBody OrderCostInfoVO vo) {
77   - orderCostInfoService.setPackStatus(vo);
  76 + public ServerResult setPackStatus(@RequestBody OrderCostInfoVO vo) {
  77 + return orderCostInfoService.setPackStatus(vo);
78 78 }
79 79  
80 80  
81 81 @PostMapping("/setInnerStatus")
82 82 @ApiOperation("设置内部生产明细表的状态")
83   - public void setInnerProduceStatus(@RequestBody OrderCostInfoVO vo) {
84   - orderCostInfoService.setInnerProduceStatus(vo);
  83 + public ServerResult setInnerProduceStatus(@RequestBody OrderCostInfoVO vo) {
  84 + return orderCostInfoService.setInnerProduceStatus(vo);
85 85 }
86 86  
87 87 }
... ...
src/main/java/com/order/erp/controller/ProjectController.java
... ... @@ -9,6 +9,7 @@ import com.order.erp.service.order.IProjectBaseInfoService;
9 9 import com.order.erp.service.order.OrderProfitAnalysisService;
10 10 import io.swagger.annotations.Api;
11 11 import io.swagger.annotations.ApiOperation;
  12 +import org.apache.catalina.Server;
12 13 import org.springframework.beans.factory.annotation.Autowired;
13 14 import org.springframework.validation.annotation.Validated;
14 15 import org.springframework.web.bind.annotation.*;
... ... @@ -96,14 +97,14 @@ public class ProjectController {
96 97  
97 98 @PostMapping("/businessProfit/setStatus")
98 99 @ApiOperation("业务研发净利润分析表审核状态设置")
99   - public void setProjectBaseInfoDevelopmentStatus(@RequestBody OrderBaseInfoVO vo) {
100   - projectBaseInfoService.setProjectBaseInfoDevelopmentStatus(vo);
  100 + public ServerResult setProjectBaseInfoDevelopmentStatus(@RequestBody OrderBaseInfoVO vo) {
  101 + return projectBaseInfoService.setProjectBaseInfoDevelopmentStatus(vo);
101 102 }
102 103 //直接通过查询传递多个projectNo去查询。
103 104 @PostMapping("/innerProfitInfo/setStatus")
104 105 @ApiOperation("内部生产净利润分析表审核状态设置")
105   - public void setInnerProductionStatus(@RequestBody OrderBaseInfoVO vo) {
106   - projectBaseInfoService.setInnerProductionStatus(vo);
  106 + public ServerResult setInnerProductionStatus(@RequestBody OrderBaseInfoVO vo) {
  107 + return projectBaseInfoService.setInnerProductionStatus(vo);
107 108 }
108 109  
109 110 }
... ...
src/main/java/com/order/erp/domain/ApplyTypeEnum.java
... ... @@ -28,6 +28,11 @@ public enum ApplyTypeEnum {
28 28 INVOICE_DEDUCT_URL(60,"INVOICE扣款单申请"),
29 29  
30 30 CHECK_DEDUCT_URL(70,"CHECK扣款单申请"),
  31 +
  32 + ORDER_PACKET_COST_FIELD_EDIT_APPLY(80,"订单包装费用明细字段申请"),
  33 + ORDER_PACKET_COST_PASS(81,"订单包装费用明细表申请通过"),
  34 + ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY(90,"订单生产费用明细字段申请"),
  35 + ORDER_PRODUCTION_COST_APPLY(91,"订单生产费用明细申请通过"),
31 36 ;
32 37 private Integer type;
33 38  
... ...
src/main/java/com/order/erp/domain/OrderOptTypeEnum.java
... ... @@ -35,12 +35,14 @@ public enum OrderOptTypeEnum {
35 35 // PROJECT_DEVELOPMENT_FIELD_EDIT_APPLY(77,"业务研发净利润字段编辑申请"),
36 36 PROJECT_COST_EDIT(80,"包装费用明细编辑"),
37 37 PROJECT_COST_ADD(85,"包装费用明细创建"),
  38 + PROJECT_COST_PASS(87,"包装费用明细表审核通过"),
38 39 // PROJECT_COST_FIELD_EDIT_APPLY(87,"包装费用明细表字段编辑申请"),
39 40 PROJECT_INNER_PRODUCE_EDIT(90,"内部生产净利润编辑"),
40 41 PROJECT_INNER_PRODUCE_ADD(95,"内部生产净利润创建"),
41 42 // PROJECT_INNER_PRODUCE_FIELD_EDIT_APPLY(97,"内部生产净利润字段编辑申请"),
42 43 PROJECT_INNER_PRODUCE_PROFIT_EDIT(100,"内部生产明细表编辑"),
43 44 PROJECT_INNER_PRODUCE_PROFIT_ADD(105,"内部生产明细表创建"),
  45 + PROJECT_INNER_PRODUCE_PROFIT_PASS(107,"内部生产明细表审核通过"),
44 46 // PROJECT_INNER_PRODUCE_PROFIT_FIELD_EDIT_APPLY(107,"内部研发净明细表字段编辑申请"),
45 47  
46 48  
... ...
src/main/java/com/order/erp/domain/ProjectApplyTypeEnum.java
1 1 package com.order.erp.domain;
2 2  
3   -import com.baomidou.mybatisplus.annotation.EnumValue;
4   -import com.fasterxml.jackson.annotation.JsonValue;
  3 +
5 4 import lombok.AllArgsConstructor;
6 5 import lombok.Getter;
7 6  
... ... @@ -17,6 +16,8 @@ public enum ProjectApplyTypeEnum {
17 16  
18 17 FIELD_EDIT_APPLY(0, "业务利润字段编辑申请"),
19 18 INNER_PROFIT_FIELD_EDIT_APPLY(1, "内部利润字段编辑申请"),
  19 + PROJECT_APPLY_PASS(2, "业务研发净利润申请通过"),
  20 + INNER_PROJECT_APPLY_PASS(3, "内部研发净利润申请通过"),
20 21 ;
21 22  
22 23 private Integer type;
... ...
src/main/java/com/order/erp/domain/dto/order/OrderCostInfoDO.java
... ... @@ -43,6 +43,8 @@ public class OrderCostInfoDO extends BaseDO implements Serializable {
43 43 private BigDecimal productionActualPrice;
44 44  
45 45 private BigDecimal packetActualRmbTotalPrice;
  46 + //生产科预算单价
  47 + private BigDecimal productionDepartmentPredictUnitPrice;
46 48 //包装费用明细表状态。
47 49 private Integer packStatus;
48 50 //内部生产明细表状态。
... ...
src/main/java/com/order/erp/domain/dto/order/ProjectBaseAfterReviewSettingDO.java
... ... @@ -22,6 +22,10 @@ public class ProjectBaseAfterReviewSettingDO {
22 22 * */
23 23 private String projectNoPrefix;
24 24 /**
  25 + * 存储年份
  26 + * */
  27 + private String year;
  28 + /**
25 29 * type=1代表为提成成本配置,type=2代表为生产科固定成本配置
26 30 * */
27 31 private Integer type;
... ...
src/main/java/com/order/erp/domain/vo/order/InnerProfitDetailVO.java
... ... @@ -68,7 +68,7 @@ public class InnerProfitDetailVO implements Serializable {
68 68 * 生产科预算单价,由生产科预算金额/数量。
69 69 */
70 70 @ApiModelProperty(value = "生产科预算金额")
71   - private BigDecimal productionDepartmentPredictUnitprice;
  71 + private BigDecimal productionDepartmentPredictUnitPrice;
72 72  
73 73  
74 74 /**
... ...
src/main/java/com/order/erp/domain/vo/order/OrderCostDetailedOptedLogQueryVO.java
... ... @@ -26,5 +26,5 @@ public class OrderCostDetailedOptedLogQueryVO extends BasePageVO implements Ser
26 26 /**
27 27 * 业务类型 20:包装费用明细表创建/编辑 40:对应内部生产明细表创建/编辑
28 28 * */
29   - private Integer type;
  29 + private List<Integer> type;
30 30 }
... ...
src/main/java/com/order/erp/domain/vo/order/ProjectApplyVO.java
... ... @@ -52,7 +52,7 @@ public class ProjectApplyVO extends BaseDO implements Serializable {
52 52 private String type;
53 53  
54 54 @ApiModelProperty(value = "锁定字段 json字符串")
55   - private String fields;
  55 + private ProjectBaseInfoLockFieldVO fields;
56 56  
57 57 @ApiModelProperty(value = "状态:0 待审批,1 通过,2 拒绝")
58 58 private Integer status;
... ...
src/main/java/com/order/erp/domain/vo/order/ProjectOptLogQueryVO.java
... ... @@ -26,5 +26,5 @@ public class ProjectOptLogQueryVO extends BasePageVO implements Serializable {
26 26 /**
27 27 * 业务类型 10:对应业务研发净利润创建/编辑 30:对应内部生产净利润创建/编辑
28 28 * */
29   - private Integer type;
  29 + private List<Integer> type;
30 30 }
... ...
src/main/java/com/order/erp/service/impl/SystemSettingServiceImpl.java
... ... @@ -105,11 +105,16 @@ public class SystemSettingServiceImpl extends ServiceImpl&lt;SystemSettingMapper, S
105 105 * @return
106 106 */
107 107 private LambdaQueryWrapper<SystemSettingDO> buildQueryByParam(SystemSettingQueryVO queryVO) {
108   - return new LambdaQueryWrapper<SystemSettingDO>()
  108 + LambdaQueryWrapper<SystemSettingDO> settingDOLambdaQueryWrapper = new LambdaQueryWrapper<SystemSettingDO>()
109 109 .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
110 110 .eq(StringUtils.isNotBlank(queryVO.getSettingCode()), SystemSettingDO::getSettingCode, queryVO.getSettingCode())
111 111 .eq(Objects.nonNull(queryVO.getSettingType()), SystemSettingDO::getSettingType, queryVO.getSettingType())
112 112 .eq(StringUtils.isNotBlank(queryVO.getRelationCode()), SystemSettingDO::getRelationCode, queryVO.getRelationCode());
  113 + //针对于客户提成配置和生产科固定成本单独进行筛选,因为需要年份筛选。
  114 + if(StringUtils.isNotBlank(queryVO.getRelationCode()) && (queryVO.getRelationCode().equals("costSettingItem") || queryVO.getRelationCode().equals("ProduceSettingItem"))){
  115 + settingDOLambdaQueryWrapper.eq(StringUtils.isNotBlank(queryVO.getRelationName()), SystemSettingDO::getRelationName, queryVO.getRelationName());
  116 + }
  117 + return settingDOLambdaQueryWrapper;
113 118 }
114 119  
115 120 @Override
... ... @@ -143,9 +148,10 @@ public class SystemSettingServiceImpl extends ServiceImpl&lt;SystemSettingMapper, S
143 148 SystemSettingDO systemSettingDO = getOne(new LambdaQueryWrapper<SystemSettingDO>()
144 149 .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
145 150 .eq(SystemSettingDO::getSettingValue, systemSettingVO.getSettingValue())
146   - .eq(SystemSettingDO::getSettingType,systemSettingVO.getSettingType()));
  151 + .eq(SystemSettingDO::getSettingType,systemSettingVO.getSettingType())
  152 + .eq(SystemSettingDO::getRelationName,systemSettingVO.getRelationName()));
147 153 if(Objects.nonNull(systemSettingDO)){
148   - throw new BusinessException("已配置"+systemSettingVO.getSettingValue()+"的提成数据!");
  154 + throw new BusinessException("已配置"+systemSettingVO.getSettingValue()+"对应"+systemSettingDO.getRelationName()+"年份的提成数据!");
149 155 }
150 156 }
151 157 // systemSettingVO.setRelationCode("costSettingItem");
... ...
src/main/java/com/order/erp/service/order/IOrderCostInfoService.java
... ... @@ -30,6 +30,6 @@ public interface IOrderCostInfoService extends IService&lt;OrderCostInfoDO&gt; {
30 30 ServerResult listBusinessProfitDetailByPage(OrderBaseInfoQueryVO queryVO);
31 31 void exportBusinessProfitDetailExcel(HttpServletResponse response,ProjectBaseInfoQueryVO queryVO) throws Exception;
32 32 void exportInnerProfitDetailExcel(HttpServletResponse response,ProjectBaseInfoQueryVO queryVO) throws Exception;
33   - void setPackStatus(OrderCostInfoVO vo);
34   - void setInnerProduceStatus(OrderCostInfoVO vo);
  33 + ServerResult setPackStatus(OrderCostInfoVO vo);
  34 + ServerResult setInnerProduceStatus(OrderCostInfoVO vo);
35 35 }
... ...
src/main/java/com/order/erp/service/order/IProjectBaseInfoService.java
... ... @@ -36,6 +36,6 @@ public interface IProjectBaseInfoService extends IService&lt;ProjectBaseInfoDO&gt; {
36 36 void exportBusinessProfitExcel(HttpServletResponse response, ProjectBaseInfoQueryVO queryVO) throws Exception;
37 37 void exportInnerProfitInfoExcel(HttpServletResponse response, ProjectBaseInfoQueryVO queryVO) throws Exception;
38 38  
39   - void setProjectBaseInfoDevelopmentStatus(OrderBaseInfoVO vo);
40   - void setInnerProductionStatus(OrderBaseInfoVO vo);
  39 + ServerResult setProjectBaseInfoDevelopmentStatus(OrderBaseInfoVO vo);
  40 + ServerResult setInnerProductionStatus(OrderBaseInfoVO vo);
41 41 }
... ...
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
... ... @@ -41,6 +41,7 @@ import com.order.erp.service.admin.AdminUserRoleService;
41 41 import com.order.erp.service.admin.AdminUserService;
42 42 import com.order.erp.service.order.*;
43 43 import lombok.extern.slf4j.Slf4j;
  44 +import org.joda.time.DateTime;
44 45 import org.springframework.beans.BeanUtils;
45 46 import org.springframework.beans.factory.annotation.Autowired;
46 47 import org.springframework.beans.factory.annotation.Value;
... ...
src/main/java/com/order/erp/service/order/impl/OrderCostDetailedOptLogServiceImpl.java
... ... @@ -68,7 +68,7 @@ public class OrderCostDetailedOptLogServiceImpl extends ServiceImpl&lt;OrderCostDet
68 68 return new LambdaQueryWrapper<OrderCostDetailedOptLogDO>()
69 69 .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
70 70 .eq(Objects.nonNull(queryVO.getOrderId()), OrderCostDetailedOptLogDO::getOrderId, queryVO.getOrderId())
71   - .eq(Objects.nonNull(queryVO.getType()), OrderCostDetailedOptLogDO::getType, queryVO.getType())
  71 + .in(CollectionUtils.isNotEmpty(queryVO.getType()), OrderCostDetailedOptLogDO::getType, queryVO.getType())
72 72 .orderByDesc(OrderCostDetailedOptLogDO::getId);
73 73 }
74 74  
... ...
src/main/java/com/order/erp/service/order/impl/OrderCostInfoServiceImpl.java
... ... @@ -17,6 +17,7 @@ import com.order.erp.common.constant.Constant;
17 17 import com.order.erp.common.constant.ServerResult;
18 18 import com.order.erp.common.constant.ServerResultCode;
19 19 import com.order.erp.common.exception.BusinessException;
  20 +import com.order.erp.common.utils.*;
20 21 import com.order.erp.config.DataScope;
21 22 import com.order.erp.domain.*;
22 23 import com.order.erp.domain.dto.BaseDO;
... ... @@ -31,6 +32,7 @@ import com.order.erp.service.IOrderCostFieldLockRecordService;
31 32 import com.order.erp.service.SystemSettingService;
32 33 import com.order.erp.service.order.*;
33 34 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  35 +import org.joda.time.DateTime;
34 36 import org.springframework.beans.BeanUtils;
35 37 import org.springframework.beans.factory.annotation.Autowired;
36 38 import org.springframework.stereotype.Service;
... ... @@ -39,9 +41,14 @@ import org.springframework.transaction.annotation.Transactional;
39 41 import javax.annotation.Resource;
40 42 import javax.servlet.http.HttpServletResponse;
41 43 import java.io.IOException;
  44 +import java.io.InputStream;
42 45 import java.math.BigDecimal;
43 46 import java.math.RoundingMode;
  47 +
  48 +import java.net.MalformedURLException;
  49 +import java.net.URL;
44 50 import java.util.*;
  51 +import java.util.concurrent.TimeUnit;
45 52 import java.util.stream.Collectors;
46 53  
47 54 /**
... ... @@ -66,6 +73,10 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
66 73 private SystemSettingService systemSettingService;
67 74 @Autowired
68 75 private OrderCostDetailedOptLogService orderCostDetailedOptLogService;
  76 + @Autowired
  77 + private RedisUtils redisUtils;
  78 + @Autowired
  79 + private TransactionHelper transactionHelper;
69 80  
70 81 @Override
71 82 @Transactional(rollbackFor = Exception.class)
... ... @@ -111,16 +122,14 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
111 122 //编辑包装费用实际金额之后状态为待审核
112 123 /*需要考虑一个问题,假如状态为已通过,但是没有进行任何的修改而点击了确认,那么它的状态会由已审核变为待审核,所以需要进行判断一下,此次传递来的数据是否与上一次的数据一致,如果不一致则需要进行状态设置*/
113 124 if(isUpdate && ProfitStatusEnum.APPROVED.getStatus().equals(oldOrderCostInfoDO.getPackStatus())
114   - && oldOrderCostInfoDO.getPacketActualRmbTotalPrice().compareTo(vo.getPacketActualRmbTotalPrice()) == 0){
  125 + && vo.getPacketActualRmbTotalPrice().compareTo(oldOrderCostInfoDO.getPacketActualRmbTotalPrice()) == 0){
115 126 }else{
116 127 orderCostInfoDO.setPackStatus(ProfitStatusEnum.PENDING_APPROVAL.getStatus());
117 128 }
118   - }else if(Objects.nonNull(vo.getProductionActualPrice())||Objects.nonNull(vo.getProductionDepartmentPredictUnitPrice())) {
119   - //todo 以前是直接填写总价,现在是填写单价,然后乘以数量自动计算总价,需要前端传递一个数量参数过来。
120   - vo.setProductionDepartmentPredictPrice(vo.getProductionDepartmentPredictUnitPrice().multiply(BigDecimal.valueOf(vo.getOrderCount())));
121   - orderCostInfoDO.setProductionDepartmentPredictPrice(vo.getProductionDepartmentPredictPrice());
  129 + }else if(Objects.nonNull(vo.getProductionActualPrice())||Objects.nonNull(vo.getProductionDepartmentPredictPrice()) || Objects.nonNull(vo.getProductionDepartmentPredictUnitPrice())) {
122 130 originOrderCostInfolockFieldVO.setProductionActualPrice(OrderLockFieldEnum.LOCKED.name());
123 131 originOrderCostInfolockFieldVO.setProductionDepartmentPredictPrice(OrderLockFieldEnum.LOCKED.name());
  132 + originOrderCostInfolockFieldVO.setProductionDepartmentPredictUnitPrice(OrderLockFieldEnum.LOCKED.name());
124 133 type=ProjectOptTypeEnum.INTERNAL_PRODUCE_DETAILS_TYPE.getType();
125 134 operationDesc = isUpdate
126 135 ? OrderOptTypeEnum.PROJECT_INNER_PRODUCE_PROFIT_EDIT.getDesc()
... ... @@ -128,9 +137,9 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
128 137 //编辑生产科预算金额和实际发生费用之后状态为待审核
129 138 /*也需要考虑问题,假如状态为已通过,但是没有进行任何修改二点击了确认,那么它的状态会由已审核变为待审核*/
130 139 if(isUpdate && ProfitStatusEnum.APPROVED.getStatus().equals(oldOrderCostInfoDO.getInnerProduceStatus()) &&
131   - oldOrderCostInfoDO.getProductionActualPrice().compareTo(vo.getProductionActualPrice()) ==0 &&
132   - //前端传递的是单价和数量,但是后端只是保存了总价,所以需要进行判断一下,此次传递来的数据和上一次的数据是否一致,如果不一致则需要进行状态设置
133   - oldOrderCostInfoDO.getProductionDepartmentPredictPrice().compareTo(vo.getProductionDepartmentPredictUnitPrice().multiply(BigDecimal.valueOf(vo.getOrderCount()))) ==0){
  140 + vo.getProductionActualPrice().compareTo(oldOrderCostInfoDO.getProductionActualPrice()) ==0 &&
  141 + vo.getProductionDepartmentPredictPrice().compareTo(oldOrderCostInfoDO.getProductionDepartmentPredictPrice()) ==0 &&
  142 + vo.getProductionDepartmentPredictUnitPrice().compareTo(oldOrderCostInfoDO.getProductionDepartmentPredictUnitPrice()) == 0){
134 143 }else{
135 144 orderCostInfoDO.setInnerProduceStatus(ProfitStatusEnum.PENDING_APPROVAL.getStatus());
136 145 }
... ... @@ -165,20 +174,22 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
165 174 OrderFieldLockApplyDO build = OrderFieldLockApplyDO.builder()
166 175 .orderId(vo.getOrderId())
167 176 .applyUserId(dataScope.getLoginUserId())
  177 + //无论是订单生产费用明细字段申请还是订单生产费用明细字段申请,都是管理员审批,但是这里加上财务人员的目的是为财务人员能够在待审核列表中查看到申请,而不是给财务人员审批的。
  178 + .auditRoleCodes(RoleEnum.ADMIN.getCode()+Constant.COMMA_CHARACTER+RoleEnum.FINANCE_USER.getCode())
168 179 .applyRemark(vo.getApplyRemark())
169 180 .fields(JSONObject.toJSONString(lockField))
170 181 .status(ApplyStatusEnum.WAIT_AUDIT.getStatus())
171 182 .type(vo.getType())
172   - .remark(OrderCostApplyTpeEnum.getNameByType(vo.getType()))
  183 + .remark(ApplyTypeEnum.getNameByType(vo.getType()))
173 184 .build();
174 185 orderFieldLockApplyService.save(build);
175 186 //进行审批记录的保存。需要前端在申请字段申请时传递这条数据的id。
176   - if(OrderCostApplyTpeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY.getType().equals(vo.getType())){
177   - applyType=OrderCostApplyTpeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY.getType();
  187 + if(ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY.getType().equals(vo.getType())){
  188 + applyType=ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY.getType();
178 189 }else{
179   - applyType=OrderCostApplyTpeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY.getType();
  190 + applyType=ApplyTypeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY.getType();
180 191 }
181   - orderCostDetailedOptLogService.save(buildOrderConstOptLogDo(vo.getOrderId(), dataScope.getLoginUserId(),applyType,OrderCostApplyTpeEnum.getNameByType(applyType),JSONObject.toJSONString(lockField)));
  192 + orderCostDetailedOptLogService.save(buildOrderConstOptLogDo(vo.getOrderId(), dataScope.getLoginUserId(),applyType,ApplyTypeEnum.getNameByType(applyType),JSONObject.toJSONString(lockField)));
182 193 return ServerResult.success();
183 194 }
184 195  
... ... @@ -212,17 +223,25 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
212 223 OrderCostInfolockFieldVO lockFields = Optional.ofNullable(orderId2fieldMapMap.get(record.getId()))
213 224 .orElse(new OrderCostInfolockFieldVO()
214 225 );
215   - if(Objects.isNull(lockFields.getPacketActualRmbTotalPrice())){
216   - lockFields.setPacketActualRmbTotalPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
217   - }
218   - if(Objects.isNull(lockFields.getProductionActualPrice())){
219   - lockFields.setProductionActualPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
220   - }
221   - if(Objects.isNull(lockFields.getProductionDepartmentPredictPrice())){
222   - lockFields.setProductionDepartmentPredictPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
223   - }
224   - if(Objects.isNull(lockFields.getProductionDepartmentPredictUnitPrice())){
225   - lockFields.setProductionDepartmentPredictUnitPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictUnitPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  226 + if(Objects.nonNull(orderCostInfo)&& ProfitStatusEnum.APPROVED.getStatus().equals(orderCostInfo.getInnerProduceStatus())){
  227 + if(Objects.isNull(lockFields.getPacketActualRmbTotalPrice())){
  228 + lockFields.setPacketActualRmbTotalPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  229 + }
  230 + if(Objects.isNull(lockFields.getProductionActualPrice())){
  231 + lockFields.setProductionActualPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  232 + }
  233 + if(Objects.isNull(lockFields.getProductionDepartmentPredictPrice())){
  234 + lockFields.setProductionDepartmentPredictPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  235 + }
  236 + if(Objects.isNull(lockFields.getProductionDepartmentPredictUnitPrice())){
  237 + lockFields.setProductionDepartmentPredictUnitPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictUnitPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  238 + }
  239 + }else{
  240 + lockFields.setPacketActualRmbTotalPrice(OrderLockFieldEnum.UN_LOCKED.name());
  241 + lockFields.setProductionActualPrice(OrderLockFieldEnum.UN_LOCKED.name());
  242 + lockFields.setProductionDepartmentPredictPrice(OrderLockFieldEnum.UN_LOCKED.name());
  243 + lockFields.setProductionDepartmentPredictUnitPrice(OrderLockFieldEnum.UN_LOCKED.name());
  244 +
226 245 }
227 246 InnerProfitDetailVO vo = InnerProfitDetailVO.builder()
228 247 .orderId(record.getId())
... ... @@ -235,6 +254,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
235 254 .productionDepartmentPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getProductionDepartmentPrice())
236 255 .productionDepartmentTotalPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getProductionDepartmentTotalPrice())
237 256 .productionDepartmentPredictPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionDepartmentPredictPrice())
  257 + .productionDepartmentPredictUnitPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionDepartmentPredictUnitPrice())
238 258 .productionActualPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionActualPrice())
239 259 .innerProduceStatus((Objects.isNull(record.getOrderCostInfo()) || Objects.isNull(record.getOrderCostInfo().getInnerProduceStatus())) ? ProfitStatusEnum.Not_COMPLETED.getStatus() : record.getOrderCostInfo().getInnerProduceStatus())
240 260 .lockFields(lockFields)
... ... @@ -268,9 +288,9 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
268 288 vo.setGrossProfitRate(vo.getGrossProfit().divide(BigDecimal.valueOf(vo.getProductionDepartmentTotalPrice()), 4, RoundingMode.HALF_UP));
269 289 }
270 290 }
271   - if(Objects.nonNull(vo.getProductionDepartmentPredictPrice())){
272   - vo.setProductionDepartmentPredictUnitprice(vo.getProductionDepartmentPredictPrice().divide(BigDecimal.valueOf(record.getOrderCount()), 2, RoundingMode.HALF_UP));
273   - }
  291 +// if(Objects.nonNull(vo.getProductionDepartmentPredictPrice())){
  292 +// vo.setProductionDepartmentPredictUnitPrice(vo.getProductionDepartmentPredictPrice().divide(BigDecimal.valueOf(record.getOrderCount()), 2, RoundingMode.HALF_UP));
  293 +// }
274 294 return vo;
275 295 }).collect(Collectors.toList());
276 296 Page<InnerProfitDetailVO> webVOPage = new Page<>();
... ... @@ -312,14 +332,20 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
312 332 OrderCostInfolockFieldVO lockFields = Optional.ofNullable(orderId2fieldMapMap.get(record.getId())).orElse(
313 333 new OrderCostInfolockFieldVO()
314 334 );
315   - if(Objects.isNull(lockFields.getPacketActualRmbTotalPrice())){
316   - lockFields.setPacketActualRmbTotalPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
317   - }
318   - if(Objects.isNull(lockFields.getProductionActualPrice())){
319   - lockFields.setProductionActualPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
320   - }
321   - if(Objects.isNull(lockFields.getProductionDepartmentPredictPrice())){
322   - lockFields.setProductionDepartmentPredictPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  335 + if(Objects.nonNull(orderCostInfo) && ProfitStatusEnum.APPROVED.getStatus().equals(orderCostInfo.getPackStatus())){
  336 + if(Objects.isNull(lockFields.getPacketActualRmbTotalPrice())){
  337 + lockFields.setPacketActualRmbTotalPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  338 + }
  339 + if(Objects.isNull(lockFields.getProductionActualPrice())){
  340 + lockFields.setProductionActualPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  341 + }
  342 + if(Objects.isNull(lockFields.getProductionDepartmentPredictPrice())){
  343 + lockFields.setProductionDepartmentPredictPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  344 + }
  345 + }else{
  346 + lockFields.setPacketActualRmbTotalPrice(OrderLockFieldEnum.UN_LOCKED.name());
  347 + lockFields.setProductionActualPrice(OrderLockFieldEnum.UN_LOCKED.name());
  348 + lockFields.setProductionDepartmentPredictPrice(OrderLockFieldEnum.UN_LOCKED.name());
323 349 }
324 350 BusinessProfitDetailVO vo = BusinessProfitDetailVO.builder()
325 351 .orderId(record.getId())
... ... @@ -423,6 +449,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
423 449 throw new BusinessException(ServerResultCode.PARAM_ERROR);
424 450 }
425 451 OrderBaseInfoQueryVO.OrderBaseInfoQueryVOBuilder builder = OrderBaseInfoQueryVO.builder()
  452 + .productionDepartment(Collections.singletonList("内部"))
426 453 .page(1)
427 454 .pageSize(200); //设置大一点,确保导出数据不遗漏
428 455 if(CollectionUtils.isNotEmpty(queryVO.getOrderIds())){
... ... @@ -464,7 +491,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
464 491 }
465 492  
466 493 @Override
467   - public void setPackStatus(OrderCostInfoVO vo) {
  494 + public ServerResult setPackStatus(OrderCostInfoVO vo) {
468 495 //首先判断orderId是否为空。
469 496 if(Objects.isNull(vo.getOrderId())){
470 497 throw new BusinessException(ServerResultCode.PARAM_ERROR);
... ... @@ -477,11 +504,21 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
477 504 throw new BusinessException(ServerResultCode.EMPTY_LIST);
478 505 }
479 506 orderCostInfoDO.setPackStatus(ProfitStatusEnum.APPROVED.getStatus());
480   - updateById(orderCostInfoDO);
  507 + //还需要对审核通过也进行记录 81 91
  508 + OrderCostInfoVO orderCostInfoVO=new OrderCostInfoVO();
  509 + BeanUtils.copyProperties(orderCostInfoDO,orderCostInfoVO);
  510 + transactionHelper.run(() -> {
  511 + orderCostDetailedOptLogService.save(buildOrderConstOptLogDo((vo.getOrderId()),dataScope.getLoginUserId()
  512 + ,ApplyTypeEnum.ORDER_PACKET_COST_PASS.getType()
  513 + ,ApplyTypeEnum.ORDER_PACKET_COST_PASS.getDesc()
  514 + ,JSONObject.toJSONString(orderCostInfoVO)));
  515 + updateById(orderCostInfoDO);
  516 + });
  517 + return ServerResult.success();
481 518 }
482 519  
483 520 @Override
484   - public void setInnerProduceStatus(OrderCostInfoVO vo) {
  521 + public ServerResult setInnerProduceStatus(OrderCostInfoVO vo) {
485 522 if(Objects.isNull(vo.getOrderId())){
486 523 throw new BusinessException(ServerResultCode.PARAM_ERROR);
487 524 }
... ... @@ -493,7 +530,15 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
493 530 throw new BusinessException(ServerResultCode.EMPTY_LIST);
494 531 }
495 532 orderCostInfoDO.setInnerProduceStatus(ProfitStatusEnum.APPROVED.getStatus());
  533 + OrderCostInfoVO orderCostInfoVO = new OrderCostInfoVO();
  534 + BeanUtils.copyProperties(orderCostInfoDO, orderCostInfoVO);
  535 + orderCostDetailedOptLogService.save(buildOrderConstOptLogDo((vo.getOrderId()),dataScope.getLoginUserId()
  536 + ,ApplyTypeEnum.ORDER_PRODUCTION_COST_APPLY.getType()
  537 + ,ApplyTypeEnum.ORDER_PRODUCTION_COST_APPLY.getDesc()
  538 + ,JSONObject.toJSONString(orderCostInfoVO)));
  539 + updateById(orderCostInfoDO);
496 540 updateById(orderCostInfoDO);
  541 + return ServerResult.success();
497 542 }
498 543  
499 544  
... ... @@ -513,7 +558,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
513 558 return orderCostInfoVO;
514 559 }
515 560  
516   - private List<Map<String,Object>> buildBusinessProfitExportExcel(List<BusinessProfitDetailVO> businessProfitDetailVOS,ProjectBaseInfoQueryVO queryVO){
  561 + private List<Map<String,Object>> buildBusinessProfitExportExcel(List<BusinessProfitDetailVO> businessProfitDetailVOS,ProjectBaseInfoQueryVO queryVO) throws IOException {
517 562 List<Map<String,Object>> list= new ArrayList<>();
518 563 for(BusinessProfitDetailVO vo:businessProfitDetailVOS){
519 564 Map<String, Object> map = new LinkedHashMap<>();
... ... @@ -521,7 +566,13 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
521 566 map.put("项目号",Objects.nonNull(vo.getProjectNo()) ? vo.getProjectNo() : "");
522 567 map.put("生产科",Objects.nonNull(vo.getProductionDepartment()) ? vo.getProductionDepartment() : "");
523 568 map.put("内部编号",Objects.nonNull(vo.getInnerNo()) ? vo.getInnerNo() : "");
524   - map.put("图片地址",Objects.nonNull(vo.getPicUrl()) ? vo.getPicUrl() : "");
  569 + if(StringUtils.isNotBlank(vo.getPicUrl())){
  570 + URL url = new URL(vo.getPicUrl());
  571 + InputStream inputStream = url.openStream();
  572 + map.put("订单图片", FileUtil.imageParseBytes(inputStream));
  573 + }else{
  574 + map.put("订单图片", "");
  575 + }
525 576 map.put("订单数量",Objects.nonNull(vo.getOrderCount()) ? vo.getOrderCount() : "");
526 577 map.put("包装费用$",Objects.nonNull(vo.getPacketPrice()) ? String.format("%.2f",vo.getPacketPrice()) : "");
527 578 map.put("包装费用合计$",Objects.nonNull(vo.getPacketTotalPrice()) ? String.format("%.2f",vo.getPacketTotalPrice()) : "");
... ... @@ -539,7 +590,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
539 590 return list;
540 591 }
541 592  
542   - private List<Map<String,Object>> buildInnerProfitDetailExcel(List<InnerProfitDetailVO> innerProfitDetailVOS, ProjectBaseInfoQueryVO queryVO){
  593 + private List<Map<String,Object>> buildInnerProfitDetailExcel(List<InnerProfitDetailVO> innerProfitDetailVOS, ProjectBaseInfoQueryVO queryVO) throws IOException {
543 594 List<Map<String,Object>> list = new ArrayList<>();
544 595 for (InnerProfitDetailVO vo:innerProfitDetailVOS){
545 596 Map<String, Object> hashMap = new LinkedHashMap<>();
... ... @@ -547,7 +598,13 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
547 598 hashMap.put("项目号",Objects.nonNull(vo.getProjectNo()) ? vo.getProjectNo() : "");
548 599 hashMap.put("生产科",Objects.nonNull(vo.getProductionDepartment()) ? vo.getProductionDepartment() : "");
549 600 hashMap.put("内部编号",Objects.nonNull(vo.getInnerNo()) ? vo.getInnerNo() : "");
550   - hashMap.put("图片地址",Objects.nonNull(vo.getPicUrl()) ? vo.getPicUrl() : "");
  601 + if(StringUtils.isNotBlank(vo.getPicUrl())){
  602 + URL url = new URL(vo.getPicUrl());
  603 + InputStream inputStream = url.openStream();
  604 + hashMap.put("订单图片", FileUtil.imageParseBytes(inputStream));
  605 + }else{
  606 + hashMap.put("订单图片", "");
  607 + }
551 608 hashMap.put("订单数量",Objects.nonNull(vo.getOrderCount()) ? vo.getOrderCount() : "");
552 609 hashMap.put("生产科单价¥",Objects.nonNull(vo.getProductionDepartmentPrice()) ? String.format("%.2f",vo.getProductionDepartmentPrice()) : "");
553 610 hashMap.put("生产科总价¥",Objects.nonNull(vo.getProductionDepartmentTotalPrice()) ? String.format("%.2f",vo.getProductionDepartmentTotalPrice()) : "");
... ...
src/main/java/com/order/erp/service/order/impl/OrderFieldLockApplyServiceImpl.java
... ... @@ -133,9 +133,9 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
133 133 resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class));
134 134 }
135 135 // todo
136   - if (Stream.of(OrderCostApplyTpeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY,
137   - OrderCostApplyTpeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY)
138   - .map(OrderCostApplyTpeEnum::getType)
  136 + if (Stream.of(ApplyTypeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY,
  137 + ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY)
  138 + .map(ApplyTypeEnum::getType)
139 139 .anyMatch(type -> type.equals(x.getType()))) {
140 140 OrderCostInfolockFieldVO orderCostInfolockFieldVO = JSONObject.parseObject(fields, OrderCostInfolockFieldVO.class);
141 141 resultVO.setFieldInfos(OrderLockFieldVO.builder().costInfolockFieldVO(orderCostInfolockFieldVO).build());
... ... @@ -436,9 +436,10 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
436 436 }
437 437 }
438 438 Set<Long> orderIds = new HashSet<>();
  439 +// List<Integer> typeIn = Arrays.asList(ApplyTypeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY.getType(), ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY.getType());
439 440 //由于下面是原始的代码,怕改出错了,所以我只对我需要的需求进行判断,我只针对我需要的这种情况,其他情况下就不走这种情况。 限制情况为跟单业务,对应收款,应付款,发票审核请求时。
440 441 // queryVO.getType==Constant.SIXTY完全是为了跟单和业务对于应收账单类型请求时,屏蔽掉应收账单,只展示invoice扣款单申请数据。
441   - if(queryVO.getType()==Constant.THIRTY || queryVO.getType()==4050 || queryVO.getType()==Constant.SIXTY){
  442 + if(Constant.THIRTY.equals(queryVO.getType()) || Integer.valueOf(4050).equals(queryVO.getType()) || Constant.SIXTY.equals(queryVO.getType()) ){
442 443  
443 444 } else {
444 445 /** 这部分代码是之前的,每台看懂,就先不修改了,保留*/
... ... @@ -1190,9 +1191,9 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
1190 1191 invoiceAndCheckBillSendEmailVO.setDeductionUrlFieldVO(deductionUrlFieldVO);
1191 1192 emailSendUtils.sendInvoiceAndCheckEmail(FinanceOverEnum.CHECK_DEDUCTURL_PASS,invoiceAndCheckBillSendEmailVO,true);
1192 1193 //todo
1193   - } else if (Stream.of(OrderCostApplyTpeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY,
1194   - OrderCostApplyTpeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY)
1195   - .map(OrderCostApplyTpeEnum::getType)
  1194 + } else if (Stream.of(ApplyTypeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY,
  1195 + ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY)
  1196 + .map(ApplyTypeEnum::getType)
1196 1197 .anyMatch(x -> x.equals(applyDO.getType()))) {
1197 1198 applyDO.setAuditUserId(auditUserId);
1198 1199 applyDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus());
... ...
src/main/java/com/order/erp/service/order/impl/ProjectBaseDevelopOptLogServiceImpl.java
... ... @@ -66,7 +66,7 @@ public class ProjectBaseDevelopOptLogServiceImpl extends ServiceImpl&lt;ProjectBase
66 66 return new LambdaQueryWrapper<ProjectBaseDevelopOptLogDO>()
67 67 .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
68 68 .eq(Objects.nonNull(queryVO.getProjectNoPrefix()), ProjectBaseDevelopOptLogDO::getProjectNoPrefix, queryVO.getProjectNoPrefix())
69   - .eq(Objects.nonNull(queryVO.getType()), ProjectBaseDevelopOptLogDO::getType, queryVO.getType())
  69 + .in(CollectionUtils.isNotEmpty(queryVO.getType()), ProjectBaseDevelopOptLogDO::getType, queryVO.getType())
70 70 .orderByDesc(ProjectBaseDevelopOptLogDO::getId);
71 71 }
72 72 }
73 73 \ No newline at end of file
... ...
src/main/java/com/order/erp/service/order/impl/ProjectBaseInfoServiceImpl.java
... ... @@ -139,14 +139,14 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
139 139 ? OrderOptTypeEnum.PROJECT_DEVELOPMENT_PROFIT_EDIT.getDesc()
140 140 : OrderOptTypeEnum.PROJECT_DEVELOPMENT_PROFIT_ADD.getDesc();
141 141 /*这里还需要考虑一下,对于状态已经是已审批的状态,但是在编辑数据时没有发生任何改变,也需要重新设置为待审核状态吗?不需要,这里处理一下,对于这种情况就不需要重新设置状态*/
142   - if(isUpdate && oldProjectBaseInfoDO.getDevelopmentStatus().equals(ProfitStatusEnum.APPROVED.getStatus()) &&
143   - oldProjectBaseInfoDO.getProjectStartTime().isEqual(vo.getProjectStartTime()) &&
144   - oldProjectBaseInfoDO.getProjectEndTime().isEqual(vo.getProjectEndTime()) &&
145   - oldProjectBaseInfoDO.getDevelopmentCopyRmbTotalPrice().compareTo(vo.getDevelopmentCopyRmbTotalPrice()) == 0 &&
146   - oldProjectBaseInfoDO.getSpainPaidRmbCommission().compareTo(vo.getSpainPaidRmbCommission()) == 0 &&
147   - oldProjectBaseInfoDO.getPaidRmbCommission().compareTo(vo.getPaidRmbCommission()) == 0 &&
  142 + if(isUpdate && ProfitStatusEnum.APPROVED.getStatus().equals(oldProjectBaseInfoDO.getDevelopmentStatus()) &&
  143 + vo.getProjectStartTime().toLocalDate().isEqual(oldProjectBaseInfoDO.getProjectStartTime().toLocalDate()) &&
  144 + vo.getProjectEndTime().toLocalDate().isEqual(oldProjectBaseInfoDO.getProjectEndTime().toLocalDate()) &&
  145 + vo.getDevelopmentCopyRmbTotalPrice().compareTo(oldProjectBaseInfoDO.getDevelopmentCopyRmbTotalPrice()) == 0 &&
  146 + vo.getSpainPaidRmbCommission().compareTo(oldProjectBaseInfoDO.getSpainPaidRmbCommission()) == 0 &&
  147 + vo.getPaidRmbCommission().compareTo(oldProjectBaseInfoDO.getPaidRmbCommission()) == 0
148 148 //todo 这个实际汇率是否需要,需要讨论。
149   - oldProjectBaseInfoDO.getActualExchangeRate().compareTo(vo.getActualExchangeRate()) == 0
  149 +// vo.getActualExchangeRate().compareTo(oldProjectBaseInfoDO.getActualExchangeRate()) == 0
150 150 ){
151 151 }else{
152 152 projectBaseInfoDO.setDevelopmentStatus(ProfitStatusEnum.PENDING_APPROVAL.getStatus());
... ... @@ -158,9 +158,9 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
158 158 operationDesc = isUpdate
159 159 ? OrderOptTypeEnum.PROJECT_INNER_PRODUCE_EDIT.getDesc()
160 160 : OrderOptTypeEnum.PROJECT_INNER_PRODUCE_ADD.getDesc();
161   - if(isUpdate && oldProjectBaseInfoDO.getInnerProductionStatus().equals(ProfitStatusEnum.APPROVED.getStatus()) &&
162   - oldProjectBaseInfoDO.getProjectInnerProfitInfoStartTime().isEqual(vo.getProjectInnerProfitInfoStartTime()) &&
163   - oldProjectBaseInfoDO.getProjectInnerProfitInfoEndTime().isEqual(vo.getProjectInnerProfitInfoEndTime())){
  161 + if(isUpdate && ProfitStatusEnum.APPROVED.getStatus().equals(oldProjectBaseInfoDO.getInnerProductionStatus()) &&
  162 + vo.getProjectInnerProfitInfoStartTime().toLocalDate().isEqual(oldProjectBaseInfoDO.getProjectInnerProfitInfoStartTime().toLocalDate()) &&
  163 + vo.getProjectInnerProfitInfoEndTime().toLocalDate().isEqual(oldProjectBaseInfoDO.getProjectInnerProfitInfoEndTime().toLocalDate())){
164 164 }else{
165 165 projectBaseInfoDO.setInnerProductionStatus(ProfitStatusEnum.PENDING_APPROVAL.getStatus());
166 166 }
... ... @@ -215,7 +215,6 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
215 215 }else{
216 216 applyType=ProjectApplyTypeEnum.INNER_PROFIT_FIELD_EDIT_APPLY.getType();
217 217 }
218   - String descByName = ProjectApplyTypeEnum.getDescByName(vo.getType());
219 218 // ProjectBaseInfoLockFieldVO projectBaseInfoLockFieldVO = buildProjectBaseInfoLockFieldVO(vo);
220 219 projectBaseDevelopOptLogService.save(buildProjectOptLogDo(vo.getProjectNoPrefix(), dataScope.getLoginUserId(),applyType,ProjectApplyTypeEnum.getDescByName(vo.getType()),JSONObject.toJSONString(projectBaseInfoLockFieldVO)));
221 220 return ServerResult.success();
... ... @@ -235,7 +234,8 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
235 234 return buildPageResult(page, Collections.emptyList());
236 235 }
237 236 List<ProjectApplyVO> collect = records.stream().map(e -> {
238   - ProjectApplyVO projectApplyVO = BeanUtil.copyProperties(e, ProjectApplyVO.class);
  237 + ProjectApplyVO projectApplyVO = BeanUtil.copyProperties(e, ProjectApplyVO.class,"fields");
  238 + projectApplyVO.setFields(JSON.parseObject(e.getFields(), ProjectBaseInfoLockFieldVO.class));
239 239 return projectApplyVO;
240 240 }).collect(Collectors.toList());
241 241 return ServerResult.success(buildPageResult(page, collect));
... ... @@ -423,8 +423,8 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
423 423 .eq(SystemSettingDO::getRelationCode, "ProduceSettingItem")
424 424 .in(SystemSettingDO::getSettingValue, collect)
425 425 .list();
426   - Map<String, SystemSettingDO> systemSettingDOSMap = systemSettingDOS.stream()
427   - .collect(Collectors.toMap(SystemSettingDO::getSettingValue, Function.identity(), (x, y) -> x));
  426 + Map<String, List<SystemSettingDO>> systemSettingDOSMap = systemSettingDOS.stream()
  427 + .collect(Collectors.groupingBy(SystemSettingDO::getSettingValue));
428 428 List<ProjectFieldLockRecord> lockRecords = projectionFieldLockRecordService
429 429 .lambdaQuery()
430 430 .func(query -> {
... ... @@ -452,20 +452,27 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
452 452 .in(ProjectBaseAfterReviewSettingDO::getProjectNoPrefix, orderInfoResultVOS.stream()
453 453 .map(OrderBaseInfoVO::getProjectNo)
454 454 .collect(Collectors.toSet())));
455   - Map<String, ProjectBaseAfterReviewSettingDO> projectBaseAfterReviewSettingDOMap = projectBaseAfterReviewSettingDOS
  455 + Map<String, List<ProjectBaseAfterReviewSettingDO>> projectBaseAfterReviewSettingDOMap = projectBaseAfterReviewSettingDOS
456 456 .stream()
457   - .collect(Collectors.toMap(ProjectBaseAfterReviewSettingDO::getProjectNoPrefix, Function.identity(), (x, y) -> x));
  457 + .collect(Collectors.groupingBy(ProjectBaseAfterReviewSettingDO::getProjectNoPrefix));
458 458 return orderBaseInfoDOSGroupByProjectNoPre.entrySet().stream().map(entry -> {
459 459 ProjectBaseInfoDO projectBaseInfoDO = no2ProjectInfoMap.get(entry.getKey());
460 460 List<OrderInfoResultVO> details = entry.getValue();
  461 + //当状态为未审批时,就一直为UNLOCKED,能够一直修改。当通过之后就需要进行申请了。
461 462 ProjectBaseInfoLockFieldVO lockFields = Optional.ofNullable(prjectNo2LockRecordMap.get(entry.getKey())).orElse(
462 463 new ProjectBaseInfoLockFieldVO());
463   - if(Objects.isNull(lockFields.getProjectInnerProfitInfoStartTime())){
464   - lockFields.setProjectInnerProfitInfoStartTime(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getProjectInnerProfitInfoStartTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
465   - }
466   - if(Objects.isNull(lockFields.getProjectInnerProfitInfoEndTime())){
467   - lockFields.setProjectInnerProfitInfoEndTime(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getProjectInnerProfitInfoEndTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  464 + if(Objects.nonNull(projectBaseInfoDO) && ProfitStatusEnum.APPROVED.getStatus().equals(projectBaseInfoDO.getInnerProductionStatus())){
  465 + if(Objects.isNull(lockFields.getProjectInnerProfitInfoStartTime())){
  466 + lockFields.setProjectInnerProfitInfoStartTime(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getProjectInnerProfitInfoStartTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  467 + }
  468 + if(Objects.isNull(lockFields.getProjectInnerProfitInfoEndTime())){
  469 + lockFields.setProjectInnerProfitInfoEndTime(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getProjectInnerProfitInfoEndTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  470 + }
  471 + }else{
  472 + lockFields.setProjectInnerProfitInfoStartTime( OrderLockFieldEnum.UN_LOCKED.name() );
  473 + lockFields.setProjectInnerProfitInfoEndTime( OrderLockFieldEnum.UN_LOCKED.name());
468 474 }
  475 +
469 476 InnerProfitInfoVO innerProfitInfoVO = InnerProfitInfoVO.builder()
470 477 .customerCode(details.get(0).getCustomerCode())
471 478 .projectNoPrefix(entry.getKey())
... ... @@ -556,9 +563,14 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
556 563 ;
557 564 innerProfitInfoVO.setProduceStartTime(earliest);
558 565 innerProfitInfoVO.setProduceEndTime(latest);
559   - SystemSettingDO systemSettingDO = systemSettingDOSMap.get(innerProfitInfoVO.getCustomerCode());
560   - if (Objects.nonNull(systemSettingDO)) {
561   - String relationValue = systemSettingDO.getRelationValue();
  566 + Optional<SystemSettingDO> systemSettingDO = systemSettingDOSMap.values().stream()
  567 + .flatMap(List::stream)
  568 + .filter(setting -> setting.getSettingValue().equals(details.get(0).getCustomerCode()))
  569 + .filter(setting -> setting.getRelationName().substring(2, 4).equals(entry.getKey().substring(4, 6)))
  570 + .findFirst();
  571 +
  572 + if (systemSettingDO.isPresent()) {
  573 + String relationValue = systemSettingDO.get().getRelationValue();
562 574 try {
563 575 // 将 JSON 字符串解析为 List<Map<String, String>>
564 576 List<Map<String, String>> relations = objectMapper.readValue(relationValue, objectMapper.getTypeFactory().constructCollectionType(List.class, Map.class));
... ... @@ -573,10 +585,15 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
573 585 ratioValue = relation.get("relationValue");
574 586 }
575 587 }
576   - //在这里进行覆盖
577   - if(Objects.nonNull(projectBaseAfterReviewSettingDOMap.get(entry.getKey()))){
578   - fixCostValue=projectBaseAfterReviewSettingDOMap.get(entry.getKey()).getFixedCost().toString();
579   - ratioValue=projectBaseAfterReviewSettingDOMap.get(entry.getKey()).getCommissionUnitPrice().toString();
  588 +// 在这里进行覆盖
  589 + Optional<ProjectBaseAfterReviewSettingDO> first = projectBaseAfterReviewSettingDOMap.values().stream()
  590 + .flatMap(List::stream)
  591 + .filter(item -> item.getProjectNoPrefix().equals(entry.getKey()))
  592 + .filter(item -> item.getYear().equals("20" + entry.getKey().substring(4, 6)))
  593 + .findFirst();
  594 + if(first.isPresent()){
  595 + fixCostValue=first.get().getFixedCost().toString();
  596 + ratioValue=first.get().getCommissionUnitPrice().toString();
580 597 }
581 598 if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(fixCostValue)
582 599 && Objects.nonNull(earliest)
... ... @@ -585,6 +602,8 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
585 602 //内部生产固定成本¥
586 603 innerProfitInfoVO.setInnerProductionFixedCost(BigDecimal.valueOf((duration.toDays() + 1) * Double.parseDouble(fixCostValue)));
587 604 }
  605 + //如果超出预算5%就没有提成,就需要设置为0
  606 + innerProfitInfoVO.setInnerProductionCommission(BigDecimal.ZERO);
588 607 if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(ratioValue)
589 608 && Objects.nonNull(innerProfitInfoVO.getPredictRatio())
590 609 && innerProfitInfoVO.getPredictRatio().compareTo(BigDecimal.valueOf(1.05)) < 0) {
... ... @@ -661,8 +680,8 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
661 680 }
662 681 })
663 682 .list();
664   - Map<String, SystemSettingDO> systemSettingDOSMap = systemSettingDOS.stream()
665   - .collect(Collectors.toMap(SystemSettingDO::getSettingValue, Function.identity(), (x, y) -> x));
  683 + Map<String, List<SystemSettingDO>> systemSettingDOSMap = systemSettingDOS.stream()
  684 + .collect(Collectors.groupingBy(SystemSettingDO::getSettingValue));
666 685 ObjectMapper objectMapper = new ObjectMapper();
667 686 BigDecimal systemExchangeRate = systemSettingService.getExchangeRate();
668 687 List<ProjectFieldLockRecord> lockRecords = projectionFieldLockRecordService
... ... @@ -686,11 +705,12 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
686 705 }
687 706 }));
688 707 BigDecimal exchangeRate = systemSettingService.getExchangeRate();
689   - //查询永久已保存的配置。
  708 + //查询永久已保存的配置。 如果永久保存配置没有,就去查询系统配置进行显示。
690 709 List<ProjectBaseAfterReviewSettingDO> projectBaseAfterReviewSettingDOS = projectBaseAfterReviewSettingService.list(new LambdaQueryWrapper<ProjectBaseAfterReviewSettingDO>()
691 710 .eq(ProjectBaseAfterReviewSettingDO::getType, ProjectBaseSettingTypeEnum.COMMISSION_COST.getType())
692 711 .in(ProjectBaseAfterReviewSettingDO::getProjectNoPrefix,projectNoPrefix));
693   - Map<String, ProjectBaseAfterReviewSettingDO> projectBaseAfterReviewSettingDOMap = projectBaseAfterReviewSettingDOS.stream().collect(Collectors.toMap(ProjectBaseAfterReviewSettingDO::getProjectNoPrefix, Function.identity(), (x, y) -> x));
  712 + Map<String, List<ProjectBaseAfterReviewSettingDO>> projectBaseAfterReviewSettingDOMap = projectBaseAfterReviewSettingDOS.stream()
  713 + .collect(Collectors.groupingBy(ProjectBaseAfterReviewSettingDO::getProjectNoPrefix));
694 714 return orderBaseInfoDOSGroupByProjectNoPre.entrySet().stream().map(entry -> {
695 715 List<OrderInfoResultVO> details = entry.getValue();
696 716 ProjectBaseInfoDO projectBaseInfoDO = noPrefix2ProjectProfitAnalysisDOMap.get(entry.getKey());
... ... @@ -701,16 +721,36 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
701 721 .detailProjectNo(detailProjectNoMap.get(entry.getKey()))
702 722 //返回状态。
703 723 .developmentStatus((Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getDevelopmentStatus())) ? ProfitStatusEnum.Not_COMPLETED.getStatus() : projectBaseInfoDO.getDevelopmentStatus())
704   - .lockFields(Optional.ofNullable(prjectNo2LockRecordMap.get(entry.getKey())).orElse(ProjectBaseInfoLockFieldVO.builder()
705   - .actualExchangeRate(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getActualExchangeRate()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
706   - .developmentCopyRmbTotalPrice(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getDevelopmentCopyRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
707   - .paidRmbCommission(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getPaidRmbCommission()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
708   - .projectEndTime(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getProjectEndTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
709   - .projectStartTime(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getProjectStartTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
710   - .spainPaidRmbCommission(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getSpainPaidRmbCommission()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
711   - .build()))
712 724 .build();
713   -
  725 + ProjectBaseInfoLockFieldVO lockFields = Optional.ofNullable(prjectNo2LockRecordMap.get(entry.getKey())).orElse(new ProjectBaseInfoLockFieldVO());
  726 + if(Objects.nonNull(projectBaseInfoDO) && ProfitStatusEnum.APPROVED.getStatus().equals(projectBaseInfoDO.getDevelopmentStatus())){
  727 + if(Objects.isNull(lockFields.getActualExchangeRate())){
  728 + lockFields.setActualExchangeRate(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getActualExchangeRate()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  729 + }
  730 + if(Objects.isNull(lockFields.getDevelopmentCopyRmbTotalPrice())){
  731 + lockFields.setDevelopmentCopyRmbTotalPrice(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getDevelopmentCopyRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() :OrderLockFieldEnum.LOCKED.name());
  732 + }
  733 + if(Objects.isNull(lockFields.getPaidRmbCommission())){
  734 + lockFields.setPaidRmbCommission(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getPaidRmbCommission()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  735 + }
  736 + if(Objects.isNull(lockFields.getProjectEndTime())){
  737 + lockFields.setProjectEndTime(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getProjectEndTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  738 + }
  739 + if(Objects.isNull(lockFields.getProjectStartTime())){
  740 + lockFields.setProjectStartTime(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getProjectStartTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  741 + }
  742 + if(Objects.isNull(lockFields.getSpainPaidRmbCommission())){
  743 + lockFields.setSpainPaidRmbCommission(Objects.isNull(projectBaseInfoDO) || Objects.isNull(projectBaseInfoDO.getSpainPaidRmbCommission()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name());
  744 + }
  745 + }else{
  746 + lockFields.setActualExchangeRate(OrderLockFieldEnum.UN_LOCKED.name());
  747 + lockFields.setDevelopmentCopyRmbTotalPrice(OrderLockFieldEnum.UN_LOCKED.name());
  748 + lockFields.setPaidRmbCommission(OrderLockFieldEnum.UN_LOCKED.name());
  749 + lockFields.setProjectEndTime(OrderLockFieldEnum.UN_LOCKED.name());
  750 + lockFields.setProjectStartTime(OrderLockFieldEnum.UN_LOCKED.name());
  751 + lockFields.setSpainPaidRmbCommission(OrderLockFieldEnum.UN_LOCKED.name());
  752 + }
  753 + businessProfitInfoVO.setLockFields(lockFields);
714 754 //客户总金额¥
715 755 details.stream()
716 756 .map(OrderInfoResultVO::getProfitAnalysisInfo)
... ... @@ -806,19 +846,23 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
806 846 //已付提成
807 847 businessProfitInfoVO.setPaidRmbCommission(projectBaseInfoDO.getPaidRmbCommission());
808 848 //实际汇率
809   - businessProfitInfoVO.setActualExchangeRate(projectBaseInfoDO.getActualExchangeRate());
  849 +// businessProfitInfoVO.setActualExchangeRate(projectBaseInfoDO.getActualExchangeRate());
810 850 //项目开始时间
811 851 businessProfitInfoVO.setProjectStartTime(projectBaseInfoDO.getProjectStartTime());
812 852 //项目结束时间
813 853 businessProfitInfoVO.setProjectEndTime(projectBaseInfoDO.getProjectEndTime());
814 854 //生产开始时间
  855 + Optional<SystemSettingDO> optionalSetting = systemSettingDOSMap.values().stream()
  856 + .flatMap(List::stream)
  857 + .filter(setting -> setting.getSettingValue().equals(details.get(0).getCustomerCode()))
  858 + .filter(setting -> setting.getRelationName().substring(2, 4).equals(entry.getKey().substring(4, 6)))
  859 + .findFirst();
815 860 if (Objects.nonNull(projectBaseInfoDO.getProjectStartTime())
816   - && Objects.nonNull(projectBaseInfoDO.getProjectEndTime())
817   - && Objects.nonNull(systemSettingDOSMap.get(details.get(0).getCustomerCode()))) {
818   -
  861 + && Objects.nonNull(projectBaseInfoDO.getProjectEndTime()) &&
  862 + optionalSetting.isPresent()){
819 863 //获取固定成本、提成比率、西班牙提成比例
820 864 long between = ChronoUnit.DAYS.between(projectBaseInfoDO.getProjectStartTime(), projectBaseInfoDO.getProjectEndTime());
821   - SystemSettingDO systemSettingDO = systemSettingDOSMap.get(details.get(0).getCustomerCode());
  865 + SystemSettingDO systemSettingDO = optionalSetting.get();
822 866 String relationValue = systemSettingDO.getRelationValue();
823 867 List<Map<String, String>> relations = null;
824 868 try {
... ... @@ -839,11 +883,20 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
839 883 }
840 884 }
841 885 //在这里进行判断,能够对上述的配置进行覆盖,如果永久已保存的配置中包含这个项目号的数据,则采用永久已保存的配置中,否则采用当前配置(对于已审核的数据,如果采用当前配置肯定会出错。)。
842   - if(Objects.nonNull(projectBaseAfterReviewSettingDOMap.get(entry.getKey()))){
843   - fixCostValue=projectBaseAfterReviewSettingDOMap.get(entry.getKey()).getFixedCost().toString();
844   - ratio=projectBaseAfterReviewSettingDOMap.get(entry.getKey()).getCommissionRate().toString();
845   - spainRatio=projectBaseAfterReviewSettingDOMap.get(entry.getKey()).getSpainCommissionRate().toString();
  886 + Optional<ProjectBaseAfterReviewSettingDO> first = projectBaseAfterReviewSettingDOMap.values().stream()
  887 + .flatMap(List::stream)
  888 + .filter(item -> item.getProjectNoPrefix().equals(entry.getKey()))
  889 + .filter(item -> item.getYear().equals("20" + entry.getKey().substring(4, 6)))
  890 + .findFirst();
  891 +
  892 + if(first.isPresent()){
  893 + fixCostValue=first.get().getFixedCost().toString();
  894 + ratio=first.get().getCommissionRate().toString();
  895 + spainRatio=first.get().getSpainCommissionRate().toString();
846 896 }
  897 + //上述代码不确定对不对。
  898 +
  899 +
847 900 //固定成本
848 901 businessProfitInfoVO.setFixedCost(BigDecimal.valueOf((between + 1) * Double.parseDouble(fixCostValue)).setScale(2, RoundingMode.HALF_UP));
849 902 if (Objects.nonNull(spainRatio)
... ... @@ -868,15 +921,16 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
868 921 businessProfitInfoVO.setUnpaidRmbCommission(businessProfitInfoVO.getRmbCommission().subtract(projectBaseInfoDO.getPaidRmbCommission()).setScale(2, RoundingMode.HALF_UP));
869 922 }
870 923 }
871   - if (Objects.nonNull(businessProfitInfoVO.getActualExchangeRate())
  924 + //不需要汇率收益参与计算了。
  925 + /* if (Objects.nonNull(businessProfitInfoVO.getActualExchangeRate())
872 926 && Objects.nonNull(businessProfitInfoVO.getCustomerTotalPrice())) {
873 927 businessProfitInfoVO.setExchangeRateProfit(BigDecimal.valueOf(businessProfitInfoVO.getCustomerTotalPrice())
874 928 .multiply(businessProfitInfoVO.getActualExchangeRate().subtract(systemExchangeRate)));
875   - }
  929 + }*/
876 930 }
877 931 //支出合计
878   - businessProfitInfoVO.setRmbTotalExpense(Optional.ofNullable(businessProfitInfoVO.getSpainPaidRmbCommission()).orElse(BigDecimal.ZERO)
879   - .add(Optional.ofNullable(businessProfitInfoVO.getPaidRmbCommission()).orElse(BigDecimal.ZERO))
  932 + businessProfitInfoVO.setRmbTotalExpense(Optional.ofNullable(businessProfitInfoVO.getSpainRmbCommission()).orElse(BigDecimal.ZERO)
  933 + .add(Optional.ofNullable(businessProfitInfoVO.getRmbCommission()).orElse(BigDecimal.ZERO))
880 934 .add(Optional.ofNullable(businessProfitInfoVO.getFixedCost()).orElse(BigDecimal.ZERO))
881 935 .add(Optional.ofNullable(businessProfitInfoVO.getDevelopmentCopyRmbTotalPrice()).orElse(BigDecimal.ZERO))
882 936 .add(BigDecimal.valueOf(Optional.ofNullable(businessProfitInfoVO.getPacketRmbTotalPrice()).orElse(0.0)))
... ... @@ -909,7 +963,7 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
909 963 businessProfitInfoVO.setComprehensiveProfit(Optional.ofNullable(businessProfitInfoVO.getDevelopmentProfit()).orElse(BigDecimal.ZERO)
910 964 //综合收益不需要汇率收益计算。
911 965 // .add(Optional.ofNullable(businessProfitInfoVO.getExchangeRateProfit()).orElse(BigDecimal.ZERO))
912   - .add(Optional.ofNullable(businessProfitInfoVO.getActualOrderRmbPrice()).orElse(BigDecimal.ZERO)).setScale(2, RoundingMode.HALF_UP));
  966 + .add(Optional.ofNullable(businessProfitInfoVO.getPacketProfitRmbPrice()).orElse(BigDecimal.ZERO)).setScale(2, RoundingMode.HALF_UP));
913 967 return businessProfitInfoVO;
914 968 }).collect(Collectors.toList());
915 969 }
... ... @@ -988,13 +1042,13 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
988 1042 createMergedRow(sheet, cellStyle, 28, 29, 5, 6, Optional.ofNullable(businessProfitInfoVO.getProfit()).map(price -> "¥" + price).orElse("-"));
989 1043 createMergedRow(sheet, cellStyle, 28, 29, 7, 9, "");
990 1044 createMergedRow(sheet, cellStyle, 30, 31, 0, 4, "毛利率");
991   - createMergedRow(sheet, cellStyle, 30, 31, 5, 6, Optional.ofNullable(businessProfitInfoVO.getProfitRate()).map(rate -> rate.multiply(new BigDecimal(100)) + "%").orElse("-"));
  1045 + createMergedRow(sheet, cellStyle, 30, 31, 5, 6, Optional.ofNullable(businessProfitInfoVO.getProfitRate()).map(rate -> rate.multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%").orElse("-"));
992 1046 createMergedRow(sheet, cellStyle, 30, 31, 7, 9, "");
993 1047 createMergedRow(sheet, cellStyle, 32, 33, 0, 4, "研发贸易净利润");
994 1048 createMergedRow(sheet, cellStyle, 32, 33, 5, 6, Optional.ofNullable(businessProfitInfoVO.getDevelopmentProfit()).map(price -> "¥" + price).orElse("-"));
995 1049 createMergedRow(sheet, cellStyle, 32, 33, 7, 9, "");
996 1050 createMergedRow(sheet, cellStyle, 34, 35, 0, 4, "研发贸易净利润率");
997   - createMergedRow(sheet, cellStyle, 34, 35, 5, 6, Optional.ofNullable(businessProfitInfoVO.getDevelopmentProfitRate()).map(rate -> rate.multiply(new BigDecimal(100)) + "%").orElse("-"));
  1051 + createMergedRow(sheet, cellStyle, 34, 35, 5, 6, Optional.ofNullable(businessProfitInfoVO.getDevelopmentProfitRate()).map(rate -> rate.multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_UP) + "%").orElse("-"));
998 1052 createMergedRow(sheet, cellStyle, 34, 35, 7, 9, "");
999 1053 createMergedRow(sheet, cellStyle, 36, 37, 0, 4, "包装费用合计金额");
1000 1054 createMergedRow(sheet, cellStyle, 36, 37, 5, 6, Optional.ofNullable(businessProfitInfoVO.getPacketRmbTotalPrice()).map(price -> "¥" + price).orElse("-"));
... ... @@ -1019,7 +1073,7 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
1019 1073 Optional.ofNullable(businessProfitInfoVO.getPacketRmbTotalPrice())
1020 1074 .map(totalPrice -> Optional.ofNullable(businessProfitInfoVO.getPacketProfitRmbPrice())
1021 1075 .orElse(BigDecimal.valueOf(0))
1022   - .divide(BigDecimal.valueOf(totalPrice), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)) + "%").orElse("-"));
  1076 + .divide(BigDecimal.valueOf(totalPrice), 4, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%").orElse("-"));
1023 1077 createMergedRow(sheet, cellStyle, 48, 49, 7, 9, "");
1024 1078 //导出不再需要实际汇率和汇率收益
1025 1079 // createMergedRow(sheet, cellStyle, 50, 51, 0, 4, "实际汇率");
... ... @@ -1094,7 +1148,7 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
1094 1148 }
1095 1149  
1096 1150 @Override
1097   - public void setProjectBaseInfoDevelopmentStatus(OrderBaseInfoVO vo) {
  1151 + public ServerResult setProjectBaseInfoDevelopmentStatus(OrderBaseInfoVO vo) {
1098 1152  
1099 1153 //中国团队提成比例。
1100 1154 String chainRatio = null;
... ... @@ -1114,18 +1168,24 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
1114 1168 throw new BusinessException(ServerResultCode.EMPTY_LIST);
1115 1169 }
1116 1170 projectBaseInfoDO.setDevelopmentStatus(ProfitStatusEnum.APPROVED.getStatus());
1117   - //把审核通过时的计算数据时的系统配置保存到永久配置中。防止后续更改系统配置后,正确的数据会被更新掉。
  1171 + //把审核通过时的计算数据时的系统配置保存到永久配置中。防止后续更改系统配置后,正确的数据会被更新掉。
1118 1172 //获取当前的系统配置。
1119 1173 ProjectBaseAfterReviewSettingDO projectBaseAfterReviewSettingDO = projectBaseAfterReviewSettingService.getOne(new LambdaQueryWrapper<ProjectBaseAfterReviewSettingDO>()
1120 1174 .eq(ProjectBaseAfterReviewSettingDO::getProjectNoPrefix, vo.getProjectNo())
  1175 + //根据年份查询。
  1176 + .eq(ProjectBaseAfterReviewSettingDO::getYear,"20"+vo.getProjectNo().substring(4, 6))
1121 1177 .eq(ProjectBaseAfterReviewSettingDO::getType, ProjectBaseSettingTypeEnum.COMMISSION_COST.getType())
1122 1178 .last("limit 1"));
1123   - SystemSettingDO systemSettingDO = systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
1124   - .eq(SystemSettingDO::getSettingValue, vo.getCustomerCode())
1125   - .eq(SystemSettingDO::getRelationCode, "costSettingItem"));
1126   - if(Objects.isNull(systemSettingDO) || StringUtils.isBlank(systemSettingDO.getRelationValue())){
1127   - throw new BusinessException("该项目编号的提成配置未配置,请先配置提成配置。");
1128   - }
  1179 + //如果projectBaseAfterReviewSettingDowSettingDO为空,则说明没有设置过。则去设置当前系统配置中的提成设置到projectBaseAfterReviewSettingDo表中。
  1180 + if(Objects.isNull(projectBaseAfterReviewSettingDO)){
  1181 + SystemSettingDO systemSettingDO = systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
  1182 + .eq(SystemSettingDO::getSettingValue, vo.getCustomerCode())
  1183 + .eq(SystemSettingDO::getRelationCode, "costSettingItem")
  1184 + //这里还需要进行年份判断。
  1185 + .eq(SystemSettingDO::getRelationName, "20" + vo.getProjectNo().substring(4, 6)));
  1186 + if(Objects.isNull(systemSettingDO) || StringUtils.isBlank(systemSettingDO.getRelationValue())){
  1187 + throw new BusinessException("该项目编号的提成配置未配置,请先配置提成配置。");
  1188 + }
1129 1189 //json反序列化。
1130 1190 List<CostSettingItemVO> costSettingItemVOList = JSONObject.parseObject(systemSettingDO.getRelationValue(), new TypeReference<List<CostSettingItemVO>>() {});
1131 1191 if( CollectionUtils.isNotEmpty(costSettingItemVOList)){
... ... @@ -1138,29 +1198,32 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
1138 1198 dailyCost=relation.getRelationValue();
1139 1199 }
1140 1200 }
1141   - }
1142   - if(Objects.isNull(projectBaseAfterReviewSettingDO)){
1143   - projectBaseAfterReviewSettingDO = projectBaseAfterReviewSettingDO.builder().projectNoPrefix(vo.getProjectNo())
1144   - .type(ProjectBaseSettingTypeEnum.COMMISSION_COST.getType())
1145   - .fixedCost(new BigDecimal(dailyCost))
1146   - .commissionRate(new BigDecimal(chainRatio))
1147   - .spainCommissionRate(new BigDecimal(spainRatio)).build();
1148   - }else{
1149   - projectBaseAfterReviewSettingDO.setProjectNoPrefix(vo.getProjectNo());
1150   - projectBaseAfterReviewSettingDO.setType(ProjectBaseSettingTypeEnum.COMMISSION_COST.getType());
1151   - projectBaseAfterReviewSettingDO.setFixedCost(new BigDecimal(dailyCost));
1152   - projectBaseAfterReviewSettingDO.setCommissionRate(new BigDecimal(chainRatio));
1153   - projectBaseAfterReviewSettingDO.setSpainCommissionRate(new BigDecimal(spainRatio));
1154 1201 }
  1202 + projectBaseAfterReviewSettingDO = projectBaseAfterReviewSettingDO.builder().projectNoPrefix(vo.getProjectNo())
  1203 + .year(systemSettingDO.getRelationName())
  1204 + .type(ProjectBaseSettingTypeEnum.COMMISSION_COST.getType())
  1205 + .fixedCost(new BigDecimal(dailyCost))
  1206 + .commissionRate(new BigDecimal(chainRatio))
  1207 + .spainCommissionRate(new BigDecimal(spainRatio)).build();
  1208 + }
1155 1209 ProjectBaseAfterReviewSettingDO finalProjectBaseAfterReviewSettingDO = projectBaseAfterReviewSettingDO;
  1210 + //创建审批记录对象 对于通过之后也需要对记录进行记录。
  1211 + ProjectBaseInfoVO projectBaseInfoVO =new ProjectBaseInfoVO();
  1212 + BeanUtils.copyProperties(projectBaseInfoDO, projectBaseInfoVO);
1156 1213 transactionHelper.run(() -> {
1157 1214 projectBaseAfterReviewSettingService.saveOrUpdate(finalProjectBaseAfterReviewSettingDO);
1158 1215 updateById(projectBaseInfoDO);
  1216 + //添加审核记录。
  1217 + projectBaseDevelopOptLogService.save(buildProjectOptLogDo(vo.getProjectNo(),dataScope.getLoginUserId(),
  1218 + ProjectApplyTypeEnum.PROJECT_APPLY_PASS.getType(),
  1219 + ProjectApplyTypeEnum.PROJECT_APPLY_PASS.getDesc(),
  1220 + JSONObject.toJSONString(projectBaseInfoVO)));
1159 1221 });
  1222 + return ServerResult.success();
1160 1223 }
1161 1224  
1162 1225 @Override
1163   - public void setInnerProductionStatus(OrderBaseInfoVO vo) {
  1226 + public ServerResult setInnerProductionStatus(OrderBaseInfoVO vo) {
1164 1227 String dailyCost = null;
1165 1228 String price = null;
1166 1229 //去表中设置状态,然后记录数据到永久配置中。
... ... @@ -1178,44 +1241,46 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
1178 1241 //获取当前的系统配置。
1179 1242 ProjectBaseAfterReviewSettingDO projectBaseAfterReviewSettingDO = projectBaseAfterReviewSettingService.getOne(new LambdaQueryWrapper<ProjectBaseAfterReviewSettingDO>()
1180 1243 .eq(ProjectBaseAfterReviewSettingDO::getProjectNoPrefix, vo.getProjectNo())
  1244 + .eq(ProjectBaseAfterReviewSettingDO::getYear,"20"+vo.getProjectNo().substring(4, 6))
1181 1245 .eq(ProjectBaseAfterReviewSettingDO::getType, ProjectBaseSettingTypeEnum.FIXED_COST_OF_PRODUCTION_DEPARTMENT.getType())
1182 1246 .last("limit 1"));
1183   - SystemSettingDO systemSettingDO = systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
1184   - .eq(SystemSettingDO::getSettingValue, vo.getCustomerCode())
1185   - .eq(SystemSettingDO::getRelationCode, "ProduceSettingItem"));
1186   - if(Objects.isNull(systemSettingDO) || StringUtils.isBlank(systemSettingDO.getRelationValue())){
1187   - throw new BusinessException("该项目编号的提成配置未配置,请先配置提成配置。");
1188   - }
1189   - //json反序列化。
1190   - List<CostSettingItemVO> costSettingItemVOList = JSONObject.parseObject(systemSettingDO.getRelationValue(), new TypeReference<List<CostSettingItemVO>>() {});
1191   - if( CollectionUtils.isNotEmpty(costSettingItemVOList)){
1192   - for (CostSettingItemVO relation : costSettingItemVOList) {
1193   - //这里是系统配置中的得到的,应该是从系统配置中的生产科中得到。 固定成本。
1194   - if("fixCost".equals(relation.getRelationCode())){
1195   - dailyCost=relation.getRelationValue();
1196   - }
1197   - //生产提成单价
1198   - if("ratio".equals(relation.getRelationCode())){
1199   - price=relation.getRelationValue();
  1247 + if(Objects.isNull(projectBaseAfterReviewSettingDO)){
  1248 + SystemSettingDO systemSettingDO = systemSettingService.getOne(new LambdaQueryWrapper<SystemSettingDO>().eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
  1249 + .eq(SystemSettingDO::getSettingValue, vo.getCustomerCode())
  1250 + .eq(SystemSettingDO::getRelationName, "20" + vo.getProjectNo().substring(4, 6))
  1251 + .eq(SystemSettingDO::getRelationCode, "ProduceSettingItem"));
  1252 + if(Objects.isNull(systemSettingDO) || StringUtils.isBlank(systemSettingDO.getRelationValue())){
  1253 + throw new BusinessException("该项目编号的提成配置未配置,请先配置提成配置。");
  1254 + }
  1255 + //json反序列化。
  1256 + List<CostSettingItemVO> costSettingItemVOList = JSONObject.parseObject(systemSettingDO.getRelationValue(), new TypeReference<List<CostSettingItemVO>>() {});
  1257 + if( CollectionUtils.isNotEmpty(costSettingItemVOList)){
  1258 + for (CostSettingItemVO relation : costSettingItemVOList) {
  1259 + //这里是系统配置中的得到的,应该是从系统配置中的生产科中得到。 固定成本。
  1260 + if("fixCost".equals(relation.getRelationCode())){
  1261 + dailyCost=relation.getRelationValue();
  1262 + }
  1263 + //生产提成单价
  1264 + if("ratio".equals(relation.getRelationCode())){
  1265 + price=relation.getRelationValue();
  1266 + }
1200 1267 }
1201 1268 }
1202   - }
1203   - if(Objects.isNull(projectBaseAfterReviewSettingDO)){
1204 1269 projectBaseAfterReviewSettingDO= projectBaseAfterReviewSettingDO.builder().projectNoPrefix(vo.getProjectNo())
  1270 + .year(systemSettingDO.getRelationName())
1205 1271 .type(ProjectBaseSettingTypeEnum.FIXED_COST_OF_PRODUCTION_DEPARTMENT.getType())
1206 1272 .fixedCost(new BigDecimal(dailyCost))
1207 1273 .commissionUnitPrice(new BigDecimal(price)).build();
1208   - }else{
1209   - projectBaseAfterReviewSettingDO.setProjectNoPrefix(vo.getProjectNo());
1210   - projectBaseAfterReviewSettingDO.setType(ProjectBaseSettingTypeEnum.FIXED_COST_OF_PRODUCTION_DEPARTMENT.getType());
1211   - projectBaseAfterReviewSettingDO.setFixedCost(new BigDecimal(dailyCost));
1212   - projectBaseAfterReviewSettingDO.setCommissionUnitPrice(new BigDecimal(price));
1213 1274 }
1214 1275 ProjectBaseAfterReviewSettingDO finalProjectBaseAfterReviewSettingDO = projectBaseAfterReviewSettingDO;
  1276 + ProjectBaseInfoVO projectBaseInfoVO =new ProjectBaseInfoVO();
  1277 + BeanUtils.copyProperties(projectBaseInfoDO, projectBaseInfoVO);
1215 1278 transactionHelper.run(() -> {
1216 1279 projectBaseAfterReviewSettingService.saveOrUpdate(finalProjectBaseAfterReviewSettingDO);
1217 1280 updateById(projectBaseInfoDO);
  1281 + projectBaseDevelopOptLogService.save(buildProjectOptLogDo(vo.getProjectNo(),dataScope.getLoginUserId(),ProjectApplyTypeEnum.INNER_PROJECT_APPLY_PASS.getType(),ProjectApplyTypeEnum.INNER_PROJECT_APPLY_PASS.getDesc(),JSONObject.toJSONString(projectBaseInfoVO)));
1218 1282 });
  1283 + return ServerResult.success();
1219 1284 }
1220 1285  
1221 1286 public void exportInnerProfitExcel(HttpServletResponse response, InnerProfitInfoVO vo) throws Exception {
... ... @@ -1277,8 +1342,8 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
1277 1342  
1278 1343 createMergedRow(sheet, cellStyle, 14, 15, 0, 3, "生产科实际花费总金额");
1279 1344 createMergedRow(sheet, cellStyle, 14, 15, 4, 5, "¥" + Optional.ofNullable(vo.getProductionActualPrice()).orElse(BigDecimal.ZERO));
1280   - createMergedRow(sheet, cellStyle, 14, 15, 6, 7, Optional.ofNullable(vo.getPredictRatio()).map(r -> r.multiply(BigDecimal.valueOf(100)) + "%").orElse("-"));
1281   - createMergedRow(sheet, cellStyle, 14, 15, 8, 9, Optional.ofNullable(vo.getPredictAndActualRatio()).map(r -> r.multiply(BigDecimal.valueOf(100)) + "%").orElse("-"));
  1345 + createMergedRow(sheet, cellStyle, 14, 15, 6, 7, Optional.ofNullable(vo.getPredictRatio()).map(r -> r.multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%").orElse("-"));
  1346 + createMergedRow(sheet, cellStyle, 14, 15, 8, 9, Optional.ofNullable(vo.getPredictAndActualRatio()).map(r -> r.multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%").orElse("-"));
1282 1347  
1283 1348 // 第六部分:毛利润
1284 1349 createMergedRow(sheet, cellStyle, 16, 17, 0, 3, "内部生产毛利润");
... ... @@ -1286,7 +1351,7 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
1286 1351 createMergedRow(sheet, cellStyle, 16, 16, 6, 7, "事前毛利润");
1287 1352 createMergedRow(sheet, cellStyle, 16, 16, 8, 9, "事前毛利率");
1288 1353 createMergedRow(sheet, cellStyle, 17, 17, 6, 7, Optional.ofNullable(vo.getBeforeGrossProfit()).orElse(BigDecimal.ZERO).toString());
1289   - createMergedRow(sheet, cellStyle, 17, 17, 8, 9, Optional.ofNullable(vo.getBeforeGrossProfitRate()).map(r -> r.multiply(BigDecimal.valueOf(100)) + "%").orElse("-"));
  1354 + createMergedRow(sheet, cellStyle, 17, 17, 8, 9, Optional.ofNullable(vo.getBeforeGrossProfitRate()).map(r -> r.multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%").orElse("-"));
1290 1355  
1291 1356 // 第七部分:固定成本与净利润
1292 1357 createMergedRow(sheet, cellStyle, 18, 19, 0, 3, "内部生产固定成本");
... ... @@ -1294,7 +1359,7 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
1294 1359 createMergedRow(sheet, cellStyle, 18, 18, 6, 7, "事后毛利润");
1295 1360 createMergedRow(sheet, cellStyle, 18, 18, 8, 9, "事后毛利率");
1296 1361 createMergedRow(sheet, cellStyle, 19, 19, 6, 7, Optional.ofNullable(vo.getGrossProfit()).orElse(BigDecimal.ZERO).toString());
1297   - createMergedRow(sheet, cellStyle, 19, 19, 8, 9, Optional.ofNullable(vo.getGrossProfitRate()).map(r -> r.multiply(BigDecimal.valueOf(100)) + "%").orElse("-"));
  1362 + createMergedRow(sheet, cellStyle, 19, 19, 8, 9, Optional.ofNullable(vo.getGrossProfitRate()).map(r -> r.multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%").orElse("-"));
1298 1363  
1299 1364 // 第八部分:提成与净利润
1300 1365 createMergedRow(sheet, cellStyle, 20, 21, 0, 3, "内部生产提成");
... ... @@ -1304,7 +1369,7 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
1304 1369  
1305 1370 createMergedRow(sheet, cellStyle, 22, 23, 0, 3, "内部生产净利润");
1306 1371 createMergedRow(sheet, cellStyle, 22, 23, 4, 5, "¥" + Optional.ofNullable(vo.getInnerProductionProfit()).orElse(BigDecimal.ZERO));
1307   - createMergedRow(sheet, cellStyle, 22, 23, 6, 7, Optional.ofNullable(vo.getInnerProductionProfitRate()).map(r -> r.multiply(BigDecimal.valueOf(100)) + "%").orElse("-"));
  1372 + createMergedRow(sheet, cellStyle, 22, 23, 6, 7, Optional.ofNullable(vo.getInnerProductionProfitRate()).map(r -> r.multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%").orElse("-"));
1308 1373 createMergedRow(sheet, cellStyle, 22, 23, 8, 9, "");
1309 1374  
1310 1375 // 设置响应头
... ...
src/main/resources/application-test.yml
... ... @@ -76,7 +76,7 @@ spring:
76 76 timeout: 2000
77 77 mail:
78 78 # 配置 SMTP 服务器地址
79   -# host: smtp.mxhichina.com
  79 + # host: smtp.mxhichina.com
80 80 host: smtp.163.com
81 81 # 发送者邮箱,已开通POP3/SMTP服务的邮箱,也就是你自己的
82 82 username: chenhang4442024@163.com
... ...