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