Commit 10fec827cb954d4067ea5f0b6d7da4d1695cd35c

Authored by 曾国涛
1 parent b0abec23

feat(order): 增加订单成本信息字段锁定功能

- 新增订单包装费用明细字段锁定和订单生产费用明细字段锁定类型- 实现订单成本信息字段锁定的申请、审核和展示功能- 优化项目基本信息字段锁定相关代码
src/main/java/com/order/erp/domain/ApplyTypeEnum.java
... ... @@ -25,9 +25,20 @@ public enum ApplyTypeEnum {
25 25  
26 26 DEPARTMENT_INVOICE_APPLY(50,"生产科发票申请"),
27 27  
28   - ORDER_COST_FIELD_EDIT_APPLY(60,"订单费用字段申请"),
  28 + ORDER_PACKET_COST_FIELD_EDIT_APPLY(60,"订单包装费用明细字段申请"),
  29 +
  30 + ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY(70,"订单生产费用明细字段申请"),
29 31 ;
30 32 private Integer type;
31 33  
32 34 private String desc;
  35 +
  36 + public static String getNameByType(Integer type) {
  37 + for (ApplyTypeEnum value : ApplyTypeEnum.values()) {
  38 + if (value.getType().equals(type)) {
  39 + return value.getDesc();
  40 + }
  41 + }
  42 + return null;
  43 + }
33 44 }
... ...
src/main/java/com/order/erp/domain/vo/order/AuditVO.java
... ... @@ -18,7 +18,7 @@ import java.io.Serializable;
18 18 @NoArgsConstructor
19 19 @EqualsAndHashCode(callSuper = false)
20 20 @SuperBuilder
21   -public class AuditVO extends BasePageVO implements Serializable {
  21 +public class AuditVO implements Serializable {
22 22  
23 23 /**
24 24 * 申请id
... ...
src/main/java/com/order/erp/domain/vo/order/InnerProfitInfoVO.java
... ... @@ -134,5 +134,7 @@ public class InnerProfitInfoVO implements Serializable {
134 134 @ApiModelProperty(value = "项目结束时间")
135 135 private LocalDateTime produceEndTime;
136 136  
  137 + private ProjectBaseInfoLockFieldVO lockFields;
  138 +
137 139 }
138 140  
... ...
src/main/java/com/order/erp/domain/vo/order/OrderCostInfolockFieldVO.java
... ... @@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
8 8 import lombok.NoArgsConstructor;
9 9 import lombok.experimental.SuperBuilder;
10 10  
  11 +import javax.validation.constraints.NotNull;
11 12 import java.io.Serializable;
12 13  
13 14 /**
... ... @@ -29,6 +30,9 @@ public class OrderCostInfolockFieldVO implements Serializable {
29 30  
30 31 private static final long serialVersionUID = 1L;
31 32  
  33 + @NotNull
  34 + private Integer type;
  35 + @NotNull
32 36 private Long orderId;
33 37  
34 38 private String productionDepartmentPredictPrice;
... ...
src/main/java/com/order/erp/domain/vo/order/ProjectBaseInfoLockFieldVO.java
... ... @@ -6,9 +6,12 @@ import com.baomidou.mybatisplus.annotation.TableName;
6 6 import com.order.erp.domain.dto.BaseDO;
7 7 import io.swagger.annotations.ApiModel;
8 8 import io.swagger.annotations.ApiModelProperty;
  9 +import lombok.AllArgsConstructor;
9 10 import lombok.Data;
10 11 import lombok.EqualsAndHashCode;
  12 +import lombok.NoArgsConstructor;
11 13 import lombok.experimental.Accessors;
  14 +import lombok.experimental.SuperBuilder;
12 15  
13 16 import java.io.Serializable;
14 17 import java.math.BigDecimal;
... ... @@ -24,7 +27,9 @@ import java.time.LocalDateTime;
24 27 */
25 28 @Data
26 29 @EqualsAndHashCode(callSuper = false)
27   -@Accessors(chain = true)
  30 +@SuperBuilder
  31 +@AllArgsConstructor
  32 +@NoArgsConstructor
28 33 @ApiModel(value="ProjectFieldLockApply对象", description="项目-字段锁定申请表")
29 34 public class ProjectBaseInfoLockFieldVO implements Serializable {
30 35  
... ...
src/main/java/com/order/erp/domain/vo/order/QueryProjectLockFieldVO.java
... ... @@ -31,6 +31,16 @@ public class QueryProjectLockFieldVO extends BasePageVO implements Serializable
31 31 private static final long serialVersionUID = 1L;
32 32  
33 33 private Long orderId;
  34 + /**
  35 + * NO_COMMIT(-1, "未提交审核"),
  36 + *
  37 + * WAIT_AUDIT(0, "待审批"),
  38 + *
  39 + * AUDIT_PASS(10, "已通过"),
  40 + *
  41 + * AUDIT_REFUSE(20, "已驳回")
  42 + */
  43 + private String status;
34 44  
35 45 private String productionDepartmentPredictPrice;
36 46  
... ...
src/main/java/com/order/erp/service/order/impl/OrderCostInfoServiceImpl.java
... ... @@ -16,6 +16,7 @@ import com.order.erp.common.exception.BusinessException;
16 16 import com.order.erp.config.DataScope;
17 17 import com.order.erp.domain.ApplyStatusEnum;
18 18 import com.order.erp.domain.ApplyTypeEnum;
  19 +import com.order.erp.domain.OrderLockFieldEnum;
19 20 import com.order.erp.domain.ProjectApplyTypeEnum;
20 21 import com.order.erp.domain.dto.BaseDO;
21 22 import com.order.erp.domain.dto.order.OrderCostInfoDO;
... ... @@ -42,7 +43,7 @@ import java.util.stream.Collectors;
42 43  
43 44 /**
44 45 * <p>
45   - * 服务实现类
  46 + * 服务实现类
46 47 * </p>
47 48 *
48 49 * @author author
... ... @@ -73,32 +74,36 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
73 74 OrderCostInfoDO orderCostInfoDO = null;
74 75 if (!orderCostInfoDOOpt.isPresent()) {
75 76 orderCostInfoDO = BeanUtil.copyProperties(vo, OrderCostInfoDO.class);
76   - }else {
  77 + } else {
77 78 orderCostInfoDO = orderCostInfoDOOpt.get();
78 79 BeanUtil.copyProperties(vo, orderCostInfoDO, CopyOptions.create().ignoreNullValue());
79 80 }
80 81 return ServerResult.success(this.saveOrUpdate(orderCostInfoDO));
81 82 }
  83 +
82 84 @Override
83 85 public ServerResult applyEditFileds(OrderCostInfolockFieldVO vo) {
84 86 List<OrderFieldLockApplyDO> applyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>()
85 87 .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
86 88 .eq(OrderFieldLockApplyDO::getOrderId, vo.getOrderId())
87 89 .eq(OrderFieldLockApplyDO::getApplyUserId, dataScope.getLoginUserId())
88   - .eq(OrderFieldLockApplyDO::getType, ProjectApplyTypeEnum.FIELD_EDIT_APPLY.getType())
  90 + .eq(OrderFieldLockApplyDO::getType, vo.getType())
89 91 .eq(OrderFieldLockApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus()));
90 92 if (CollectionUtils.isNotEmpty(applyDOS)) {
91 93 throw new BusinessException(ServerResultCode.APPLY_UNLOCK_FIELD_EXIST);
92 94 }
93   - Long orderId = vo.getOrderId();
94   - vo.setOrderId(null);
  95 + OrderCostInfolockFieldVO lockField = OrderCostInfolockFieldVO.builder()
  96 + .packetActualRmbTotalPrice(vo.getPacketActualRmbTotalPrice())
  97 + .productionActualPrice(vo.getProductionActualPrice())
  98 + .productionDepartmentPredictPrice(vo.getProductionDepartmentPredictPrice())
  99 + .build();
95 100 OrderFieldLockApplyDO build = OrderFieldLockApplyDO.builder()
96   - .orderId(orderId)
  101 + .orderId(vo.getOrderId())
97 102 .applyUserId(dataScope.getLoginUserId())
98   - .fields(JSONObject.toJSONString(vo))
  103 + .fields(JSONObject.toJSONString(lockField))
99 104 .status(ApplyStatusEnum.WAIT_AUDIT.getStatus())
100   - .type(ApplyTypeEnum.ORDER_COST_FIELD_EDIT_APPLY.getType())
101   - .remark(ApplyTypeEnum.ORDER_COST_FIELD_EDIT_APPLY.getDesc())
  105 + .type(vo.getType())
  106 + .remark(ApplyTypeEnum.getNameByType(vo.getType()))
102 107 .build();
103 108 orderFieldLockApplyService.save(build);
104 109 return ServerResult.success();
... ... @@ -113,16 +118,16 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
113 118 .lambdaQuery()
114 119 .func(query -> {
115 120 Set<Long> collect = records.stream().map(OrderInfoResultVO::getId).collect(Collectors.toSet());
116   - if(CollUtil.isNotEmpty(collect)){
117   - query.in(OrderCostFieldLockRecord::getOrderId,collect);
  121 + if (CollUtil.isNotEmpty(collect)) {
  122 + query.in(OrderCostFieldLockRecord::getOrderId, collect);
118 123  
119   - }else {
  124 + } else {
120 125 query.apply("1!=1");
121 126 }
122 127 })
123 128 .list();
124 129 ObjectMapper objectMapper = new ObjectMapper();
125   - Map<Long,OrderCostInfolockFieldVO> orderId2fieldMapMap = lockRecords.stream().collect(Collectors.toMap(OrderCostFieldLockRecord::getOrderId, record -> {
  130 + Map<Long, OrderCostInfolockFieldVO> orderId2fieldMapMap = lockRecords.stream().collect(Collectors.toMap(OrderCostFieldLockRecord::getOrderId, record -> {
126 131 try {
127 132 return objectMapper.readValue(record.getFields(), OrderCostInfolockFieldVO.class);
128 133 } catch (JsonProcessingException e) {
... ... @@ -130,6 +135,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
130 135 }
131 136 }));
132 137 List<InnerProfitDetailVO> innerProfitRatioResultVOs = records.stream().map(record -> {
  138 + OrderCostInfoVO orderCostInfo = record.getOrderCostInfo();
133 139 InnerProfitDetailVO vo = InnerProfitDetailVO.builder()
134 140 .orderId(record.getId())
135 141 .customerCode(record.getCustomerCode())
... ... @@ -142,6 +148,14 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
142 148 .productionDepartmentTotalPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getProductionDepartmentTotalPrice())
143 149 .productionDepartmentPredictPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionDepartmentPredictPrice())
144 150 .productionActualPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionActualPrice())
  151 + .lockFields(Optional.ofNullable(orderId2fieldMapMap.get(record.getId()))
  152 + .orElse(OrderCostInfolockFieldVO
  153 + .builder()
  154 + .packetActualRmbTotalPrice(Objects.isNull(orderCostInfo)||Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  155 + .productionActualPrice(Objects.isNull(orderCostInfo)||Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  156 + .productionDepartmentPredictPrice(Objects.isNull(orderCostInfo)||Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  157 + .build()
  158 + ))
145 159 .build();
146 160  
147 161 if (Objects.nonNull(vo.getProductionDepartmentPredictPrice())
... ... @@ -190,16 +204,16 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
190 204 .lambdaQuery()
191 205 .func(query -> {
192 206 Set<Long> collect = records.stream().map(OrderInfoResultVO::getId).collect(Collectors.toSet());
193   - if(CollUtil.isNotEmpty(collect)){
194   - query.in(OrderCostFieldLockRecord::getOrderId,collect);
  207 + if (CollUtil.isNotEmpty(collect)) {
  208 + query.in(OrderCostFieldLockRecord::getOrderId, collect);
195 209  
196   - }else {
  210 + } else {
197 211 query.apply("1!=1");
198 212 }
199 213 })
200 214 .list();
201 215 ObjectMapper objectMapper = new ObjectMapper();
202   - Map<Long,OrderCostInfolockFieldVO> orderId2fieldMapMap = lockRecords.stream().collect(Collectors.toMap(OrderCostFieldLockRecord::getOrderId,record -> {
  216 + Map<Long, OrderCostInfolockFieldVO> orderId2fieldMapMap = lockRecords.stream().collect(Collectors.toMap(OrderCostFieldLockRecord::getOrderId, record -> {
203 217 try {
204 218 return objectMapper.readValue(record.getFields(), OrderCostInfolockFieldVO.class);
205 219 } catch (JsonProcessingException e) {
... ... @@ -208,6 +222,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
208 222 }));
209 223 BigDecimal exchangeRate = systemSettingService.getExchangeRate();
210 224 List<BusinessProfitDetailVO> innerProfitRatioResultVOs = records.stream().map(record -> {
  225 + OrderCostInfoVO orderCostInfo = record.getOrderCostInfo();
211 226 BusinessProfitDetailVO vo = BusinessProfitDetailVO.builder()
212 227 .orderId(record.getId())
213 228 .customerCode(record.getCustomerCode())
... ... @@ -219,7 +234,12 @@ public class OrderCostInfoServiceImpl extends ServiceImpl&lt;OrderCostInfoMapper, O
219 234 .packetPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getPacketPrice())
220 235 .packetTotalPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getPacketTotalPrice())
221 236 .packetActualRmbTotalPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getPacketActualRmbTotalPrice())
222   - .lockFields(orderId2fieldMapMap.get(record.getId()))
  237 + .lockFields(Optional.ofNullable(orderId2fieldMapMap.get(record.getId())).orElse(OrderCostInfolockFieldVO.builder()
  238 + .packetActualRmbTotalPrice(Objects.isNull(orderCostInfo)||Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  239 + .productionActualPrice(Objects.isNull(orderCostInfo)||Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  240 + .productionDepartmentPredictPrice(Objects.isNull(orderCostInfo)||Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  241 + .build()
  242 + ))
223 243 .build();
224 244 if (Objects.nonNull(vo.getPacketTotalPrice())) {
225 245 //包装费用合计 = 包装费合计*汇率
... ...
src/main/java/com/order/erp/service/order/impl/OrderFieldLockApplyServiceImpl.java
1 1 package com.order.erp.service.order.impl;
2 2  
3 3 import cn.hutool.core.bean.BeanUtil;
  4 +import cn.hutool.core.bean.copier.CopyOptions;
4 5 import cn.hutool.core.collection.CollUtil;
5 6 import com.alibaba.fastjson.JSONObject;
6 7 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
... ... @@ -35,6 +36,7 @@ import javax.annotation.Resource;
35 36 import java.util.*;
36 37 import java.util.function.Function;
37 38 import java.util.stream.Collectors;
  39 +import java.util.stream.Stream;
38 40  
39 41 /**
40 42 * 用户订单-字段锁定申请表(OrderFieldLockApply)表服务实现类
... ... @@ -117,7 +119,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
117 119 public ServerResult listByPage(OrderFieldLockApplyQueryVO queryVO) {
118 120 RoleEnum roleEnum = dataScope.getRole();
119 121 String loginUserName = dataScope.getLoginUserName();
120   - LambdaQueryWrapper<OrderFieldLockApplyDO> queryWrapper = buildQueryByParam(queryVO,roleEnum);
  122 + LambdaQueryWrapper<OrderFieldLockApplyDO> queryWrapper = buildQueryByParam(queryVO, roleEnum);
121 123 Page page = new Page<>(queryVO.getPage(), queryVO.getPageSize());
122 124 IPage<OrderFieldLockApplyDO> iPage = page(page, queryWrapper);
123 125  
... ... @@ -129,10 +131,13 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
129 131 BeanUtils.copyProperties(x, resultVO);
130 132 String fields = x.getFields();
131 133 if (StringUtils.isNotBlank(fields)) {
132   - if (ApplyTypeEnum.FIELD_EDIT_APPLY.getType() .equals(x.getType())) {
  134 + if (ApplyTypeEnum.FIELD_EDIT_APPLY.getType().equals(x.getType())) {
133 135 resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class));
134 136 }
135   - if(ApplyTypeEnum.ORDER_COST_FIELD_EDIT_APPLY.getType().equals(x.getType())){
  137 + if (Stream.of(ApplyTypeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY,
  138 + ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY)
  139 + .map(ApplyTypeEnum::getType)
  140 + .anyMatch(type -> type.equals(x.getType()))) {
136 141 OrderCostInfolockFieldVO orderCostInfolockFieldVO = JSONObject.parseObject(fields, OrderCostInfolockFieldVO.class);
137 142 resultVO.setFieldInfos(OrderLockFieldVO.builder().costInfolockFieldVO(orderCostInfolockFieldVO).build());
138 143 }
... ... @@ -141,61 +146,61 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
141 146 fieldVO.setReportFields(JSONObject.parseObject(fields, OrderCompletionReportFieldVO.class));
142 147 resultVO.setFieldInfos(fieldVO);
143 148 }
144   - if (ApplyTypeEnum.ORDER_PROFIT_APPLY.getType() .equals(x.getType())) {
  149 + if (ApplyTypeEnum.ORDER_PROFIT_APPLY.getType().equals(x.getType())) {
145 150 OrderLockFieldVO fieldVO = new OrderLockFieldVO();
146 151 fieldVO.setProfitAnalysisFields(JSONObject.parseObject(fields, OrderProfitAnalysisFieldVO.class));
147 152 resultVO.setFieldInfos(fieldVO);
148 153 }
149 154 if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(x.getType())) {
150 155 OrderLockFieldVO orderLockFieldVO = JSONObject.parseObject(fields, OrderLockFieldVO.class);
151   - if(RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode())){
152   - if(Objects.nonNull(orderLockFieldVO.getInvoiceFieldVO()) && orderLockFieldVO.getInvoiceFieldVO().getBusinesPerson().equals(loginUserName)){
  156 + if (RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode())) {
  157 + if (Objects.nonNull(orderLockFieldVO.getInvoiceFieldVO()) && orderLockFieldVO.getInvoiceFieldVO().getBusinesPerson().equals(loginUserName)) {
153 158 resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class));
154 159 }
155 160 } else if (RoleEnum.TRACKER_USER.getCode().equals(roleEnum.getCode())) {
156   - if(Objects.nonNull(orderLockFieldVO.getInvoiceFieldVO()) && orderLockFieldVO.getInvoiceFieldVO().getTrackerUser().equals(loginUserName)){
  161 + if (Objects.nonNull(orderLockFieldVO.getInvoiceFieldVO()) && orderLockFieldVO.getInvoiceFieldVO().getTrackerUser().equals(loginUserName)) {
157 162 resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class));
158 163 }
159   - } else{
  164 + } else {
160 165 resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class));
161 166 }
162   - if(Objects.isNull(resultVO.getFieldInfos())){
163   - resultVO=null;
  167 + if (Objects.isNull(resultVO.getFieldInfos())) {
  168 + resultVO = null;
164 169 }
165 170 }
166 171 if (ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(x.getType()) || ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(x.getType())) {
167 172 OrderLockFieldVO orderLockFieldVO = JSONObject.parseObject(fields, OrderLockFieldVO.class);
168 173 // 解决待审批列表中的应付款要显示内部编码。 这里开始
169 174 //对于生产科发票特殊处理。
170   - if(ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(x.getType())){
171   - if(Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && StringUtils.isNotBlank(orderLockFieldVO.getCheckBillOrderDO().getCheckNo())){
172   - Long orderId = orderLockFieldVO.getCheckBillOrderDO().getOrderId();
173   - if(Objects.nonNull(orderId)){
  175 + if (ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(x.getType())) {
  176 + if (Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && StringUtils.isNotBlank(orderLockFieldVO.getCheckBillOrderDO().getCheckNo())) {
  177 + Long orderId = orderLockFieldVO.getCheckBillOrderDO().getOrderId();
  178 + if (Objects.nonNull(orderId)) {
174 179 OrderBaseInfoDO orderBaseInfoDO = orderBaseInfoService.getById(orderId);
175   - if(Objects.nonNull(orderBaseInfoDO)){
176   - if(StringUtils.isNotBlank(orderBaseInfoDO.getInnerNo())){
  180 + if (Objects.nonNull(orderBaseInfoDO)) {
  181 + if (StringUtils.isNotBlank(orderBaseInfoDO.getInnerNo())) {
177 182 OrderBaseInfoVO orderBaseInfoVO = new OrderBaseInfoVO();
178 183 resultVO.setOrderBaseInfo(orderBaseInfoVO);
179 184 orderBaseInfoVO.setInnerNo(orderBaseInfoDO.getInnerNo());
180 185 }
181 186 }
182 187 }
183   - }
  188 + }
184 189 }//这里结束 上述为待审核列表中应收款要显示内部编码。 //这部分不需要了。
185 190 //这部分的目的是,对于跟单员和业务员他们也能查看到应收款和应付款中各自负责订单的审核情况。 而财务和admin则会执行else{},会看到所有的审核订单信息。
186   - if(RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode())){
187   - if((Objects.nonNull(orderLockFieldVO.getProducePaymentCheckBillFieldVO()) && orderLockFieldVO.getProducePaymentCheckBillFieldVO().getBusinesPerson().equals(loginUserName))||(Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && orderLockFieldVO.getCheckBillOrderDO().getBusinesPerson().equals(loginUserName))){
  191 + if (RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode())) {
  192 + if ((Objects.nonNull(orderLockFieldVO.getProducePaymentCheckBillFieldVO()) && orderLockFieldVO.getProducePaymentCheckBillFieldVO().getBusinesPerson().equals(loginUserName)) || (Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && orderLockFieldVO.getCheckBillOrderDO().getBusinesPerson().equals(loginUserName))) {
188 193 resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class));
189 194 }
190 195 } else if (RoleEnum.TRACKER_USER.getCode().equals(roleEnum.getCode())) {
191   - if((Objects.nonNull(orderLockFieldVO.getProducePaymentCheckBillFieldVO()) && orderLockFieldVO.getProducePaymentCheckBillFieldVO().getTrackerUser().equals(loginUserName))||(Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && orderLockFieldVO.getCheckBillOrderDO().getTrackerUser().equals(loginUserName))){
  196 + if ((Objects.nonNull(orderLockFieldVO.getProducePaymentCheckBillFieldVO()) && orderLockFieldVO.getProducePaymentCheckBillFieldVO().getTrackerUser().equals(loginUserName)) || (Objects.nonNull(orderLockFieldVO.getCheckBillOrderDO()) && orderLockFieldVO.getCheckBillOrderDO().getTrackerUser().equals(loginUserName))) {
192 197 resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class));
193 198 }
194   - } else{
  199 + } else {
195 200 resultVO.setFieldInfos(JSONObject.parseObject(fields, OrderLockFieldVO.class));
196 201 }
197   - if(Objects.isNull(resultVO.getFieldInfos())){
198   - resultVO=null;
  202 + if (Objects.isNull(resultVO.getFieldInfos())) {
  203 + resultVO = null;
199 204 }
200 205 }
201 206 }
... ... @@ -369,7 +374,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
369 374 * @param queryVO
370 375 * @return
371 376 */
372   - private LambdaQueryWrapper<OrderFieldLockApplyDO> buildQueryByParam(OrderFieldLockApplyQueryVO queryVO,RoleEnum roleEnum) {
  377 + private LambdaQueryWrapper<OrderFieldLockApplyDO> buildQueryByParam(OrderFieldLockApplyQueryVO queryVO, RoleEnum roleEnum) {
373 378 RoleEnum roleSelect = null;
374 379 if (RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode())) {
375 380 queryVO.setBusinessPerson(dataScope.getLoginUserName());
... ... @@ -384,9 +389,9 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
384 389 }
385 390 Set<Long> orderIds = new HashSet<>();
386 391 //由于下面是原始的代码,怕改出错了,所以我只对我需要的需求进行判断,我只针对我需要的这种情况,其他情况下就不走这种情况。 限制情况为跟单业务,对应收款,应付款,发票审核请求时。
387   - if(Constant.THIRTY.equals(queryVO.getType()) ||Integer.valueOf(4050).equals(queryVO.getType())){
  392 + if (Constant.THIRTY.equals(queryVO.getType()) || Integer.valueOf(4050).equals(queryVO.getType())) {
388 393  
389   - }else{
  394 + } else {
390 395 /** 这部分代码是之前的,每台看懂,就先不修改了,保留*/
391 396 //这里是否还u需要添加财务角色权限的逻辑。
392 397 if (StringUtils.isNotBlank(queryVO.getBusinessPerson()) || CollectionUtils.isNotEmpty(queryVO.getCustomerCode()) || CollectionUtils.isNotEmpty(queryVO.getInnerNo())
... ... @@ -412,26 +417,26 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
412 417 .in(CollectionUtils.isNotEmpty(queryVO.getStatusList()), OrderFieldLockApplyDO::getStatus, queryVO.getStatusList())
413 418 .in(CollectionUtils.isNotEmpty(orderIds), OrderFieldLockApplyDO::getOrderId, orderIds);
414 419 //这里应该加上应收款待审核,应付款待审核,应付款已审核,应收款已审核已审核的一个条件。 目前只支持单个字符串搜索,不支持多个。
415   - if(Objects.nonNull(queryVO.getType())){
  420 + if (Objects.nonNull(queryVO.getType())) {
416 421 //发票,应付款审核。
417   - if(Constant.FOUR == String.valueOf(queryVO.getType()).length()){
  422 + if (Constant.FOUR == String.valueOf(queryVO.getType()).length()) {
418 423 int firstTwoDigits = queryVO.getType() / 100;
419 424 int lastTwoDigits = queryVO.getType() % 100;
420   - queryWrapper.in(OrderFieldLockApplyDO::getType,firstTwoDigits,lastTwoDigits);
  425 + queryWrapper.in(OrderFieldLockApplyDO::getType, firstTwoDigits, lastTwoDigits);
421 426 //目前是只能通过内部编号查询出应付款审核,无法查询出发票信息。
422   - if(CollectionUtils.isNotEmpty(queryVO.getInnerNo())){
  427 + if (CollectionUtils.isNotEmpty(queryVO.getInnerNo())) {
423 428 String queryInnerNo = queryVO.getInnerNo().get(0).trim();
424 429 queryWrapper.apply(
425 430 "JSON_CONTAINS(JSON_EXTRACT(fields, '$.producePaymentCheckBillFieldVO.innerNo'), JSON_QUOTE({0}))",
426 431 queryInnerNo
427 432 );
428 433 }
429   - }else{
  434 + } else {
430 435 //应收款审核。
431   - if(Objects.nonNull(queryVO.getType()) && queryVO.getType().equals(ApplyTypeEnum.INVOICE_BILL_APPLY.getType())){
  436 + if (Objects.nonNull(queryVO.getType()) && queryVO.getType().equals(ApplyTypeEnum.INVOICE_BILL_APPLY.getType())) {
432 437 queryWrapper.eq(Objects.nonNull(queryVO.getType()), OrderFieldLockApplyDO::getType, queryVO.getType());
433 438 //这个内部编号单独针对于应付款申请设置的。
434   - if(CollectionUtils.isNotEmpty(queryVO.getInnerNo())){
  439 + if (CollectionUtils.isNotEmpty(queryVO.getInnerNo())) {
435 440 String queryInnerNo = queryVO.getInnerNo().get(0).trim();
436 441 queryWrapper.apply(
437 442 "JSON_CONTAINS(JSON_EXTRACT(fields, '$.invoiceFieldVO.innerNo'), JSON_QUOTE({0}))",
... ... @@ -451,7 +456,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
451 456 if (!invoiceNos.isEmpty()) {
452 457 // 使用参数化查询避免 SQL 拼接问题
453 458 queryWrapper.apply(
454   - "JSON_UNQUOTE(JSON_EXTRACT(fields, '$.invoiceFieldVO.invoiceNo')) = {0}",
  459 + "JSON_UNQUOTE(JSON_EXTRACT(fields, '$.invoiceFieldVO.invoiceNo')) = {0}",
455 460 invoiceNos
456 461 );
457 462 }
... ... @@ -472,23 +477,23 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
472 477 }
473 478 }
474 479 //由于不懂下面的代码,所以我只对我需要的需求进行判断,我只针对我需要的这种情况,其他情况下就不走这种情况。
475   - if(RoleEnum.TRACKER_USER.getCode().equals(roleEnum.getCode()) && (queryVO.getType()==Constant.THIRTY || queryVO.getType()==4050)){
  480 + if (RoleEnum.TRACKER_USER.getCode().equals(roleEnum.getCode()) && (queryVO.getType() == Constant.THIRTY || queryVO.getType() == 4050)) {
476 481  
477   - }else if(RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode()) && (queryVO.getType()==Constant.THIRTY || queryVO.getType()==4050)){
  482 + } else if (RoleEnum.BUSINESS_USER.getCode().equals(roleEnum.getCode()) && (queryVO.getType() == Constant.THIRTY || queryVO.getType() == 4050)) {
478 483  
479   - }else{
  484 + } else {
480 485 if (Objects.isNull(roleSelect)) {
481 486 queryWrapper.like(Objects.nonNull(roleEnum), OrderFieldLockApplyDO::getAuditRoleCodes, roleEnum.getCode());
482   - }else {
  487 + } else {
483 488 queryWrapper.eq(Objects.nonNull(roleSelect), OrderFieldLockApplyDO::getAuditRoleCodes, roleSelect.getCode());
484 489  
485 490 }
486 491 }
487 492 return queryWrapper
488   - .func(Objects.nonNull(queryVO.getTypeIn()),query-> {
489   - if(CollUtil.isNotEmpty(queryVO.getTypeIn())){
  493 + .func(Objects.nonNull(queryVO.getTypeIn()), query -> {
  494 + if (CollUtil.isNotEmpty(queryVO.getTypeIn())) {
490 495 query.in(OrderFieldLockApplyDO::getType, queryVO.getTypeIn());
491   - }else {
  496 + } else {
492 497 query.apply("1!=1");
493 498 }
494 499 });
... ... @@ -537,21 +542,21 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
537 542 applyDO.setRefuseRemark(refuseRemark);
538 543 //应收款和应付款的申请,没有把orderId作为OrderFieldLockApplyDO的orderId,而是把InvoiceBillOrdeDO.getId()作为orderId来存储的。所以肯定查找不到。
539 544 OrderBaseInfoDO orderBaseInfoDO = orderBaseInfoService.getById(applyDO.getOrderId());
540   - if(!ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType()) && !ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(applyDO.getType()) && !ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())){
  545 + if (!ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType()) && !ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(applyDO.getType()) && !ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())) {
541 546 if (Objects.isNull(orderBaseInfoDO)) {
542 547 throw new BusinessException(ServerResultCode.ORDER_BASE_INFO_EMPTY);
543 548 }
544 549 }
545   - if(ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType())){
546   - InvoiceBillOrderDO invoiceBillOrderDO= invoiceBillOrderService.getById(applyDO.getOrderId());
547   - if(Objects.isNull(invoiceBillOrderDO)){
548   - throw new BusinessException(ServerResultCode. APPLY_NOT_EXIST);
  550 + if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType())) {
  551 + InvoiceBillOrderDO invoiceBillOrderDO = invoiceBillOrderService.getById(applyDO.getOrderId());
  552 + if (Objects.isNull(invoiceBillOrderDO)) {
  553 + throw new BusinessException(ServerResultCode.APPLY_NOT_EXIST);
549 554 }
550 555 }
551   - if(ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(applyDO.getType()) || ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())){
552   - ProducePaymentCheckBillOrderDO checkBillOrderDO= checkBillOrderService.getById(applyDO.getOrderId());
553   - if(Objects.isNull(checkBillOrderDO)){
554   - throw new BusinessException(ServerResultCode. APPLY_NOT_EXIST);
  556 + if (ApplyTypeEnum.CHECK_BILL_APPLY.getType().equals(applyDO.getType()) || ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())) {
  557 + ProducePaymentCheckBillOrderDO checkBillOrderDO = checkBillOrderService.getById(applyDO.getOrderId());
  558 + if (Objects.isNull(checkBillOrderDO)) {
  559 + throw new BusinessException(ServerResultCode.APPLY_NOT_EXIST);
555 560 }
556 561 }
557 562 if (ApplyTypeEnum.ORDER_REPORT_APPLY.getType().equals(applyDO.getType())) {
... ... @@ -562,10 +567,10 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
562 567 orderBaseInfoDO.setOrderStatus(OrderStatusEnum.PROFIT_AUDIT_REFUSE.getStatus());
563 568 orderBaseInfoService.updateById(orderBaseInfoDO);
564 569 } else if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType())) {
565   - OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class);
  570 + OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class);
566 571 InvoiceFieldVO invoiceBillOrderDO = lockFieldVO.getInvoiceFieldVO();
567 572 List<InvoiceBillOrderDO> invoiceBillOrderDOList = invoiceBillOrderService.listByIds(invoiceBillOrderDO.getInvoiceId());
568   - if(CollectionUtils.isNotEmpty(invoiceBillOrderDOList)){
  573 + if (CollectionUtils.isNotEmpty(invoiceBillOrderDOList)) {
569 574 List<InvoiceBillOrderDO> invoiceBillOrderDOS = invoiceBillOrderDOList.stream().filter(Objects::nonNull).map(x -> {
570 575 x.setStatus(FinanceEnum.UNPAID_PAYMENTS.getStatus());
571 576 return x;
... ... @@ -590,8 +595,8 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
590 595 ProducePaymentCheckBillFieldVO checkBillOrderDO = lockFieldVO.getProducePaymentCheckBillFieldVO();
591 596 List<Long> producePaymentCheckBillId = checkBillOrderDO.getProducePaymentCheckBillId();
592 597 List<ProducePaymentCheckBillOrderDO> producePaymentCheckBillOrderDOList = checkBillOrderService.listByIds(producePaymentCheckBillId);
593   - if(CollectionUtils.isNotEmpty(producePaymentCheckBillOrderDOList)){
594   - List<ProducePaymentCheckBillOrderDO> producePaymentCheckBillOrderDOS= producePaymentCheckBillOrderDOList.stream().filter(Objects::nonNull).map(x -> {
  598 + if (CollectionUtils.isNotEmpty(producePaymentCheckBillOrderDOList)) {
  599 + List<ProducePaymentCheckBillOrderDO> producePaymentCheckBillOrderDOS = producePaymentCheckBillOrderDOList.stream().filter(Objects::nonNull).map(x -> {
595 600 x.setStatus(FinanceEnum.UNPAID_PAYMENTS.getStatus());
596 601 return x;
597 602 }).collect(Collectors.toList());
... ... @@ -610,7 +615,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
610 615 });
611 616 }
612 617  
613   - } else if(ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())){
  618 + } else if (ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())) {
614 619 OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class);
615 620 ProducePaymentCheckBillOrderDO checkBillOrderDO = lockFieldVO.getCheckBillOrderDO();
616 621  
... ... @@ -618,9 +623,9 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
618 623 ProducePaymentCheckBillOrderDO invoiceInfoDO = checkBillOrderService.getById(checkBillOrderDO.getId());
619 624 invoiceInfoDO.setDepartmentInvoiceStatus(ApplyStatusEnum.AUDIT_REFUSE.getStatus());
620 625 //传递给审核一直都是最新的发票。
621   - if(com.order.erp.common.utils.StringUtils.isNotBlank(invoiceInfoDO.getInvoiceUrl())){
  626 + if (com.order.erp.common.utils.StringUtils.isNotBlank(invoiceInfoDO.getInvoiceUrl())) {
622 627 log.info("checkBillOrderDO.getInvoiceUrl() 极有可能为空: {}", checkBillOrderDO.getInvoiceUrl());
623   - if(Arrays.stream(invoiceInfoDO.getInvoiceUrl().split(",")).anyMatch(item->item.equals(checkBillOrderDO.getInvoiceUrl()))){
  628 + if (Arrays.stream(invoiceInfoDO.getInvoiceUrl().split(",")).anyMatch(item -> item.equals(checkBillOrderDO.getInvoiceUrl()))) {
624 629 // 将 invoiceUrls 分割成 List 并删除相同项
625 630 List<String> urlList = new ArrayList<>(Arrays.asList(invoiceInfoDO.getInvoiceUrl().split(",")));
626 631 urlList.removeIf(url -> url.equals(checkBillOrderDO.getInvoiceUrl()));
... ... @@ -629,7 +634,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
629 634 String updatedInvoiceUrls = String.join(",", urlList);
630 635 invoiceInfoDO.setInvoiceUrl(updatedInvoiceUrls);
631 636 }
632   - }else{
  637 + } else {
633 638 invoiceInfoDO.setInvoiceUrl(null);
634 639 }
635 640 checkBillOrderService.updateById(invoiceInfoDO);
... ... @@ -758,11 +763,11 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
758 763 } else if (ApplyTypeEnum.INVOICE_BILL_APPLY.getType().equals(applyDO.getType())) {
759 764 applyDO.setAuditUserId(auditUserId);
760 765 applyDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus());
761   - OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class);
  766 + OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class);
762 767 InvoiceFieldVO invoiceBillOrderDO = lockFieldVO.getInvoiceFieldVO();
763 768 List<Long> invoiceId = invoiceBillOrderDO.getInvoiceId();
764 769 List<InvoiceBillOrderDO> invoiceBillOrderDOS = invoiceBillOrderService.listByIds(invoiceId);
765   - if(CollectionUtils.isNotEmpty(invoiceBillOrderDOS)){
  770 + if (CollectionUtils.isNotEmpty(invoiceBillOrderDOS)) {
766 771 List<InvoiceBillOrderDO> invoiceeBillOrderDOs = invoiceBillOrderDOS.stream().filter(Objects::nonNull).map(x -> {
767 772 x.setStatus(FinanceEnum.RECEIVED_PAYMENT.getStatus());
768 773 return x;
... ... @@ -788,7 +793,7 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
788 793 ProducePaymentCheckBillFieldVO checkBillOrderDO = lockFieldVO.getProducePaymentCheckBillFieldVO();
789 794 List<Long> producePaymentCheckBillId = checkBillOrderDO.getProducePaymentCheckBillId();
790 795 List<ProducePaymentCheckBillOrderDO> checkBillOrderDOS = checkBillOrderService.listByIds(producePaymentCheckBillId);
791   - if(CollectionUtils.isNotEmpty(checkBillOrderDOS)){
  796 + if (CollectionUtils.isNotEmpty(checkBillOrderDOS)) {
792 797 List<ProducePaymentCheckBillOrderDO> producePaymentCheckBillOrderDOS = checkBillOrderDOS.stream().filter(Objects::nonNull).map(x -> {
793 798 x.setStatus(FinanceEnum.RECEIVED_PAYMENT.getStatus());
794 799 return x;
... ... @@ -802,12 +807,12 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
802 807 x.setCheckStatus(FinanceEnum.RECEIVED_PAYMENT.getStatus());
803 808 return x;
804 809 }).collect(Collectors.toList());
805   - transactionHelper.run(() ->{
  810 + transactionHelper.run(() -> {
806 811 orderBaseInfoService.updateBatchById(orderBaseInfoDOS);
807 812 checkBillOrderService.updateBatchById(producePaymentCheckBillOrderDOS);
808 813 });
809 814 }
810   - } else if (ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())) {
  815 + } else if (ApplyTypeEnum.DEPARTMENT_INVOICE_APPLY.getType().equals(applyDO.getType())) {
811 816 applyDO.setAuditUserId(auditUserId);
812 817 applyDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus());
813 818 OrderLockFieldVO lockFieldVO = JSONObject.parseObject(applyDO.getFields(), OrderLockFieldVO.class);
... ... @@ -816,23 +821,26 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
816 821 ProducePaymentCheckBillOrderDO invoiceInfoDO = checkBillOrderService.getById(checkBillOrderDO.getId());
817 822 invoiceInfoDO.setDepartmentInvoiceStatus(ApplyStatusEnum.AUDIT_PASS.getStatus());
818 823 //传递给审核一直都是最新的发票。
819   - if(com.order.erp.common.utils.StringUtils.isNotBlank(invoiceInfoDO.getInvoiceUrl())){
820   - if(com.order.erp.common.utils.StringUtils.isNotBlank(checkBillOrderDO.getInvoiceUrl())){
  824 + if (com.order.erp.common.utils.StringUtils.isNotBlank(invoiceInfoDO.getInvoiceUrl())) {
  825 + if (com.order.erp.common.utils.StringUtils.isNotBlank(checkBillOrderDO.getInvoiceUrl())) {
821 826 Set<String> deductUrlSet = new HashSet<>(Arrays.asList(
822 827 org.apache.commons.lang3.StringUtils.defaultString(invoiceInfoDO.getInvoiceUrl()).split(",")));
823   - if(!deductUrlSet.contains(checkBillOrderDO.getInvoiceUrl())){
  828 + if (!deductUrlSet.contains(checkBillOrderDO.getInvoiceUrl())) {
824 829 deductUrlSet.add(checkBillOrderDO.getInvoiceUrl());
825   - String updateDeductUrl=String.join(",",deductUrlSet);
  830 + String updateDeductUrl = String.join(",", deductUrlSet);
826 831 invoiceInfoDO.setInvoiceUrl(updateDeductUrl);
827 832 }
828 833 }
829   - }else{
830   - if(com.order.erp.common.utils.StringUtils.isNotBlank(checkBillOrderDO.getInvoiceUrl())){
  834 + } else {
  835 + if (com.order.erp.common.utils.StringUtils.isNotBlank(checkBillOrderDO.getInvoiceUrl())) {
831 836 invoiceInfoDO.setInvoiceUrl(checkBillOrderDO.getInvoiceUrl());
832 837 }
833 838 }
834 839 checkBillOrderService.updateById(invoiceInfoDO);
835   - } else if (ApplyTypeEnum.ORDER_COST_FIELD_EDIT_APPLY.getType().equals(applyDO.getType())){
  840 + } else if (Stream.of(ApplyTypeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY,
  841 + ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY)
  842 + .map(ApplyTypeEnum::getType)
  843 + .anyMatch(x -> x.equals(applyDO.getType()))) {
836 844 applyDO.setAuditUserId(auditUserId);
837 845 applyDO.setStatus(ApplyStatusEnum.AUDIT_PASS.getStatus());
838 846  
... ... @@ -846,9 +854,16 @@ public class OrderFieldLockApplyServiceImpl extends ServiceImpl&lt;OrderFieldLockAp
846 854 recordDO = OrderCostFieldLockRecord.builder()
847 855 .orderId(applyDO.getOrderId())
848 856 .userId(applyDO.getApplyUserId())
  857 + .fields(applyDO.getFields())
849 858 .build();
  859 + } else {
  860 + String originFields = recordDO.getFields();
  861 + OrderCostInfolockFieldVO originOrderCostInfolockFieldVO = JSONObject.parseObject(originFields, OrderCostInfolockFieldVO.class);
  862 + String fields = applyDO.getFields();
  863 + OrderCostInfolockFieldVO orderCostInfolockFieldVO = JSONObject.parseObject(fields, OrderCostInfolockFieldVO.class);
  864 + BeanUtil.copyProperties(orderCostInfolockFieldVO, originOrderCostInfolockFieldVO, CopyOptions.create().ignoreNullValue());
  865 + recordDO.setFields(JSONObject.toJSONString(originOrderCostInfolockFieldVO));
850 866 }
851   - recordDO.setFields(applyDO.getFields());
852 867 if (Objects.isNull(recordDO.getId())) {
853 868 orderCostFieldLockRecordService.save(recordDO);
854 869 } else {
... ...
src/main/java/com/order/erp/service/order/impl/ProjectBaseInfoServiceImpl.java
... ... @@ -15,6 +15,7 @@ import com.order.erp.common.constant.ServerResultCode;
15 15 import com.order.erp.common.exception.BusinessException;
16 16 import com.order.erp.config.DataScope;
17 17 import com.order.erp.domain.ApplyStatusEnum;
  18 +import com.order.erp.domain.OrderLockFieldEnum;
18 19 import com.order.erp.domain.ProjectApplyTypeEnum;
19 20 import com.order.erp.domain.dto.BaseDO;
20 21 import com.order.erp.domain.dto.SystemSettingDO;
... ... @@ -32,6 +33,7 @@ import com.order.erp.service.order.IProjectBaseInfoService;
32 33 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
33 34 import com.order.erp.service.order.OrderBaseInfoService;
34 35 import com.order.erp.service.order.OrderProfitAnalysisService;
  36 +import org.apache.commons.lang3.StringUtils;
35 37 import org.apache.poi.ss.usermodel.*;
36 38 import org.apache.poi.ss.util.CellRangeAddress;
37 39 import org.apache.poi.xssf.usermodel.XSSFFont;
... ... @@ -122,7 +124,7 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
122 124 Page<ProjectApplyDO> page = projectFieldLockApplyService.lambdaQuery()
123 125 .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
124 126 .eq(ProjectApplyDO::getType, ProjectApplyTypeEnum.FIELD_EDIT_APPLY.getType())
125   - .eq(ProjectApplyDO::getStatus, ApplyStatusEnum.WAIT_AUDIT.getStatus())
  127 + .eq(ProjectApplyDO::getStatus, StringUtils.isNotBlank(vo.getStatus())? ApplyStatusEnum.WAIT_AUDIT.getStatus():vo.getStatus())
126 128 .orderByDesc(ProjectApplyDO::getCreateTime)
127 129 .page(new Page<>(vo.getPage(), vo.getPageSize()));
128 130 List<ProjectApplyDO> records = page.getRecords();
... ... @@ -237,6 +239,9 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
237 239 }
238 240  
239 241 private List<InnerProfitInfoVO> buildInnerProfitInfos(List<OrderInfoResultVO> orderInfoResultVOS) {
  242 + if(CollUtil.isEmpty(orderInfoResultVOS)){
  243 + return Collections.emptyList();
  244 + }
240 245 Map<String, List<OrderInfoResultVO>> orderBaseInfoDOSGroupByProjectNoPre = orderInfoResultVOS.stream()
241 246 .collect(Collectors.groupingBy(
242 247 order -> order.getProjectNo().substring(0, 8)
... ... @@ -417,7 +422,13 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
417 422 List<SystemSettingDO> systemSettingDOS = systemSettingService.lambdaQuery()
418 423 .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN)
419 424 .eq(SystemSettingDO::getRelationCode, "costSettingItem")
420   - .in(SystemSettingDO::getSettingValue, collect)
  425 + .func(query -> {
  426 + if (CollUtil.isNotEmpty(collect)) {
  427 + query.in(SystemSettingDO::getSettingValue, collect);
  428 + } else {
  429 + query.apply("1!=1");
  430 + }
  431 + })
421 432 .list();
422 433 Map<String, SystemSettingDO> systemSettingDOSMap = systemSettingDOS.stream()
423 434 .collect(Collectors.toMap(SystemSettingDO::getSettingValue, Function.identity(), (x, y) -> x));
... ... @@ -446,10 +457,18 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
446 457 BigDecimal exchangeRate = systemSettingService.getExchangeRate();
447 458 List<BusinessProfitInfoVO> businessProfitInfoVOs = orderBaseInfoDOSGroupByProjectNoPre.entrySet().stream().map(entry -> {
448 459 List<OrderInfoResultVO> details = entry.getValue();
  460 + ProjectBaseInfoDO projectBaseInfoDO = noPrefix2ProjectProfitAnalysisDOMap.get(entry.getKey());
449 461 BusinessProfitInfoVO businessProfitInfoVO = BusinessProfitInfoVO.builder()
450 462 .customerCode(details.get(0).getCustomerCode())
451 463 .projectNoPrefix(entry.getKey())
452   - .lockFields(prjectNo2LockRecordMap.get(entry.getKey()))
  464 + .lockFields(Optional.ofNullable(prjectNo2LockRecordMap.get(entry.getKey())).orElse(ProjectBaseInfoLockFieldVO.builder()
  465 + .actualExchangeRate( Objects.isNull(projectBaseInfoDO)|| Objects.isNull(projectBaseInfoDO.getActualExchangeRate()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  466 + .developmentCopyRmbTotalPrice(Objects.isNull(projectBaseInfoDO)|| Objects.isNull(projectBaseInfoDO.getDevelopmentCopyRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  467 + .paidRmbCommission(Objects.isNull(projectBaseInfoDO)|| Objects.isNull(projectBaseInfoDO.getPaidRmbCommission()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  468 + .projectEndTime(Objects.isNull(projectBaseInfoDO)|| Objects.isNull(projectBaseInfoDO.getProjectEndTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  469 + .projectStartTime(Objects.isNull(projectBaseInfoDO)|| Objects.isNull(projectBaseInfoDO.getProjectStartTime()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  470 + .spainPaidRmbCommission(Objects.isNull(projectBaseInfoDO)|| Objects.isNull(projectBaseInfoDO.getSpainPaidRmbCommission()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name())
  471 + .build()))
453 472 .build();
454 473  
455 474 //客户总金额¥
... ... @@ -540,7 +559,6 @@ public class ProjectBaseInfoServiceImpl extends ServiceImpl&lt;ProjectBaseInfoMappe
540 559 businessProfitInfoVO.setProduceEndTime(latest);
541 560 //研发复制费合计¥ 固定成本¥ 西班牙已发提成¥ 已发提成¥ 实际汇率¥
542 561 if (Objects.nonNull(noPrefix2ProjectProfitAnalysisDOMap.get(entry.getKey()))) {
543   - ProjectBaseInfoDO projectBaseInfoDO = noPrefix2ProjectProfitAnalysisDOMap.get(entry.getKey());
544 562 //研发复制费用
545 563 businessProfitInfoVO.setDevelopmentCopyRmbTotalPrice(projectBaseInfoDO.getDevelopmentCopyRmbTotalPrice());
546 564 //西班牙已付提成
... ...