Commit 8cfa8abd5d9791e1c494f7a1e53770c38cec73c6
1 parent
50ce9682
feat:1.包装费用表添加提成,提成状态,已发提成。
2.系统配置中的提成成本配置添加包装费用提成。
Showing
11 changed files
with
398 additions
and
169 deletions
src/main/java/com/order/erp/controller/OrderCostController.java
@@ -84,4 +84,10 @@ public class OrderCostController { | @@ -84,4 +84,10 @@ public class OrderCostController { | ||
84 | return orderCostInfoService.setInnerProduceStatus(vo); | 84 | return orderCostInfoService.setInnerProduceStatus(vo); |
85 | } | 85 | } |
86 | 86 | ||
87 | + | ||
88 | + @PostMapping("/setCommissionStatus") | ||
89 | + @ApiOperation("设置包装费用明细表的提成发放状态") | ||
90 | + public ServerResult setCommissionStatus(@RequestBody OrderCostInfoVO vo) { | ||
91 | + return orderCostInfoService.setCommissionStatus(vo); | ||
92 | + } | ||
87 | } | 93 | } |
src/main/java/com/order/erp/domain/ApplyTypeEnum.java
@@ -31,6 +31,7 @@ public enum ApplyTypeEnum { | @@ -31,6 +31,7 @@ public enum ApplyTypeEnum { | ||
31 | 31 | ||
32 | ORDER_PACKET_COST_FIELD_EDIT_APPLY(80,"订单包装费用明细字段申请"), | 32 | ORDER_PACKET_COST_FIELD_EDIT_APPLY(80,"订单包装费用明细字段申请"), |
33 | ORDER_PACKET_COST_PASS(81,"订单包装费用明细表申请通过"), | 33 | ORDER_PACKET_COST_PASS(81,"订单包装费用明细表申请通过"), |
34 | + ORDER_PACKET_COST_COMMISSION_PASS(82,"提成发放通过"), | ||
34 | ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY(90,"订单生产费用明细字段申请"), | 35 | ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY(90,"订单生产费用明细字段申请"), |
35 | ORDER_PRODUCTION_COST_APPLY(91,"订单生产费用明细申请通过"), | 36 | ORDER_PRODUCTION_COST_APPLY(91,"订单生产费用明细申请通过"), |
36 | ; | 37 | ; |
src/main/java/com/order/erp/domain/CommissionStatusEnum.java
0 → 100644
src/main/java/com/order/erp/domain/dto/order/OrderCostInfoDO.java
@@ -49,6 +49,14 @@ public class OrderCostInfoDO extends BaseDO implements Serializable { | @@ -49,6 +49,14 @@ public class OrderCostInfoDO extends BaseDO implements Serializable { | ||
49 | private BigDecimal productionDepartmentPredictUnitPrice; | 49 | private BigDecimal productionDepartmentPredictUnitPrice; |
50 | //包装费用明细表状态。 | 50 | //包装费用明细表状态。 |
51 | private Integer packStatus; | 51 | private Integer packStatus; |
52 | + //包装费用明细表中的提成发放状态。 | ||
53 | + private Integer orderCommissionStatus; | ||
54 | + //包装费用表的已发提成。 | ||
55 | + private BigDecimal issuedCommission; | ||
56 | + //包装费用明细表中的备注信息。 | ||
57 | + private String packNotes; | ||
58 | + //包装费用表的已通过的包装费用提成总金额。 需要把已通过的包装提成总金额存储起来,下次再查询时使用已通过的包装提成总金额进行计算,而不再采用系统配置中的包装提成总金额进行计算,这样做的目的主要是为了避免更改系统配置中包装提成总金额后,即使已通过也会被改变,所以存储通过时的包装提成金额。 | ||
59 | + private BigDecimal passedCopyCommission ; | ||
52 | //内部生产明细表状态。 | 60 | //内部生产明细表状态。 |
53 | private Integer innerProduceStatus; | 61 | private Integer innerProduceStatus; |
54 | 62 |
src/main/java/com/order/erp/domain/vo/order/BusinessProfitDetailVO.java
@@ -128,6 +128,24 @@ public class BusinessProfitDetailVO implements Serializable { | @@ -128,6 +128,24 @@ public class BusinessProfitDetailVO implements Serializable { | ||
128 | private Integer packStatus; | 128 | private Integer packStatus; |
129 | 129 | ||
130 | /** | 130 | /** |
131 | + * 包装费用明细表的提成发放状态 | ||
132 | + */ | ||
133 | + @ApiModelProperty(value = "包装费用明细表的提成发放状态") | ||
134 | + private Integer orderCommissionStatus; | ||
135 | + | ||
136 | + /** | ||
137 | + * 包装费用明细表的已发提成 | ||
138 | + */ | ||
139 | + @ApiModelProperty(value = "包装费用明细表的已发提成") | ||
140 | + private BigDecimal issuedCommission; | ||
141 | + /** | ||
142 | + * 包装费用明细表的备注 | ||
143 | + */ | ||
144 | + @ApiModelProperty(value = "包装费用明细表的备注") | ||
145 | + private String packNotes; | ||
146 | + | ||
147 | + | ||
148 | + /** | ||
131 | * 锁定字段信息 | 149 | * 锁定字段信息 |
132 | */ | 150 | */ |
133 | @ApiModelProperty(value = "锁定字段信息") | 151 | @ApiModelProperty(value = "锁定字段信息") |
src/main/java/com/order/erp/domain/vo/order/OrderBaseInfoQueryVO.java
@@ -26,11 +26,6 @@ public class OrderBaseInfoQueryVO extends BasePageVO implements Serializable { | @@ -26,11 +26,6 @@ public class OrderBaseInfoQueryVO extends BasePageVO implements Serializable { | ||
26 | private List<Long> ids; | 26 | private List<Long> ids; |
27 | 27 | ||
28 | private Set<Long> orderIds; | 28 | private Set<Long> orderIds; |
29 | - /** | ||
30 | - * 查询不通过的订单。 | ||
31 | - * */ | ||
32 | - private Set<Long> notInOrderIds; | ||
33 | - | ||
34 | 29 | ||
35 | private Long id; | 30 | private Long id; |
36 | 31 | ||
@@ -225,6 +220,10 @@ public class OrderBaseInfoQueryVO extends BasePageVO implements Serializable { | @@ -225,6 +220,10 @@ public class OrderBaseInfoQueryVO extends BasePageVO implements Serializable { | ||
225 | * */ | 220 | * */ |
226 | private Integer packStatus; | 221 | private Integer packStatus; |
227 | /** | 222 | /** |
223 | + * 包装费用明细表的提成发放状态 | ||
224 | + * */ | ||
225 | + private Integer OrderCommissionStatus; | ||
226 | + /** | ||
228 | * 内部生产净利润分析表状态 | 227 | * 内部生产净利润分析表状态 |
229 | * */ | 228 | * */ |
230 | private Integer innerProductionStatus; | 229 | private Integer innerProductionStatus; |
@@ -241,5 +240,14 @@ public class OrderBaseInfoQueryVO extends BasePageVO implements Serializable { | @@ -241,5 +240,14 @@ public class OrderBaseInfoQueryVO extends BasePageVO implements Serializable { | ||
241 | * 控制mapper.xml文件中查询分支的判断依据。 | 240 | * 控制mapper.xml文件中查询分支的判断依据。 |
242 | * */ | 241 | * */ |
243 | private Boolean isFinish; | 242 | private Boolean isFinish; |
243 | + | ||
244 | + /** | ||
245 | + * 查询订单明细表中状态为未完成的订单。 | ||
246 | + * */ | ||
247 | + private Set<Long> notInOrderIds; | ||
248 | + /** | ||
249 | + * 查询订单明细表中提成状态为未发放的订单。 | ||
250 | + * */ | ||
251 | + private Set<Long> unissuedOrderIds; | ||
244 | } | 252 | } |
245 | 253 |
src/main/java/com/order/erp/domain/vo/order/OrderCostInfoVO.java
@@ -12,6 +12,7 @@ import lombok.experimental.SuperBuilder; | @@ -12,6 +12,7 @@ import lombok.experimental.SuperBuilder; | ||
12 | 12 | ||
13 | import java.io.Serializable; | 13 | import java.io.Serializable; |
14 | import java.math.BigDecimal; | 14 | import java.math.BigDecimal; |
15 | +import java.util.List; | ||
15 | 16 | ||
16 | /** | 17 | /** |
17 | * <p> | 18 | * <p> |
@@ -26,13 +27,10 @@ import java.math.BigDecimal; | @@ -26,13 +27,10 @@ import java.math.BigDecimal; | ||
26 | @SuperBuilder | 27 | @SuperBuilder |
27 | @AllArgsConstructor | 28 | @AllArgsConstructor |
28 | @NoArgsConstructor | 29 | @NoArgsConstructor |
29 | -@TableName("order_cost_info") | ||
30 | -@ApiModel(value="OrderCostDetail对象", description="") | ||
31 | public class OrderCostInfoVO implements Serializable { | 30 | public class OrderCostInfoVO implements Serializable { |
32 | 31 | ||
33 | private static final long serialVersionUID = 1L; | 32 | private static final long serialVersionUID = 1L; |
34 | 33 | ||
35 | - @TableId(value = "id", type = IdType.AUTO) | ||
36 | private Long id; | 34 | private Long id; |
37 | 35 | ||
38 | private Long orderId; | 36 | private Long orderId; |
@@ -47,9 +45,17 @@ public class OrderCostInfoVO implements Serializable { | @@ -47,9 +45,17 @@ public class OrderCostInfoVO implements Serializable { | ||
47 | private BigDecimal productionDepartmentPredictUnitPrice; | 45 | private BigDecimal productionDepartmentPredictUnitPrice; |
48 | //包装费用明细表中的跟单评分。 (1-100分) | 46 | //包装费用明细表中的跟单评分。 (1-100分) |
49 | private Integer orderScore; | 47 | private Integer orderScore; |
48 | + //包装费用明细表中的已发提成。 | ||
49 | + private BigDecimal issuedCommission; | ||
50 | + //包装费用表的已通过的包装费用提成总金额。 需要把已通过的包装提成总金额存储起来,下次再查询时使用已通过的包装提成总金额进行计算,而不再采用系统配置中的包装提成总金额进行计算,这样做的目的主要是为了避免更改系统配置中包装提成总金额后,即使已通过也会被改变,所以存储通过时的包装提成金额。 | ||
51 | + private BigDecimal passedCopyCommission ; | ||
52 | + //包装费用明细表中的备注。 | ||
53 | + private String packNotes; | ||
50 | //内部生产费用明细表状态。 | 54 | //内部生产费用明细表状态。 |
51 | private Integer innerProduceStatus; | 55 | private Integer innerProduceStatus; |
52 | //包装费用费用明细表状态。 | 56 | //包装费用费用明细表状态。 |
53 | private Integer packStatus; | 57 | private Integer packStatus; |
58 | + //包装费用明细表中的提成发放状态 | ||
59 | + private Integer orderCommissionStatus; | ||
54 | 60 | ||
55 | } | 61 | } |
src/main/java/com/order/erp/domain/vo/order/OrderCostInfolockFieldVO.java
@@ -45,6 +45,10 @@ public class OrderCostInfolockFieldVO implements Serializable { | @@ -45,6 +45,10 @@ public class OrderCostInfolockFieldVO implements Serializable { | ||
45 | * */ | 45 | * */ |
46 | private String orderScore; | 46 | private String orderScore; |
47 | /** | 47 | /** |
48 | + * 已发提成 | ||
49 | + * */ | ||
50 | + private String issuedCommission; | ||
51 | + /** | ||
48 | * 生产科预算单价。 | 52 | * 生产科预算单价。 |
49 | * */ | 53 | * */ |
50 | private String productionDepartmentPredictUnitPrice; | 54 | private String productionDepartmentPredictUnitPrice; |
src/main/java/com/order/erp/service/order/IOrderCostInfoService.java
@@ -32,4 +32,5 @@ public interface IOrderCostInfoService extends IService<OrderCostInfoDO> { | @@ -32,4 +32,5 @@ public interface IOrderCostInfoService extends IService<OrderCostInfoDO> { | ||
32 | void exportInnerProfitDetailExcel(HttpServletResponse response,ProjectBaseInfoQueryVO queryVO) throws Exception; | 32 | void exportInnerProfitDetailExcel(HttpServletResponse response,ProjectBaseInfoQueryVO queryVO) throws Exception; |
33 | ServerResult setPackStatus(OrderCostInfoVO vo); | 33 | ServerResult setPackStatus(OrderCostInfoVO vo); |
34 | ServerResult setInnerProduceStatus(OrderCostInfoVO vo); | 34 | ServerResult setInnerProduceStatus(OrderCostInfoVO vo); |
35 | + ServerResult setCommissionStatus(OrderCostInfoVO vo); | ||
35 | } | 36 | } |
src/main/java/com/order/erp/service/order/impl/OrderBaseInfoServiceImpl.java
@@ -1608,6 +1608,7 @@ end | @@ -1608,6 +1608,7 @@ end | ||
1608 | .le(StringUtils.isNotBlank(queryVO.getOrderHodEndTime()), OrderBaseInfoDO::getOrderHodTime, queryVO.getOrderHodEndTime()) | 1608 | .le(StringUtils.isNotBlank(queryVO.getOrderHodEndTime()), OrderBaseInfoDO::getOrderHodTime, queryVO.getOrderHodEndTime()) |
1609 | .in(CollectionUtils.isNotEmpty(queryVO.getOrderIds()), OrderBaseInfoDO::getId, queryVO.getOrderIds()) | 1609 | .in(CollectionUtils.isNotEmpty(queryVO.getOrderIds()), OrderBaseInfoDO::getId, queryVO.getOrderIds()) |
1610 | .notIn(CollectionUtils.isNotEmpty(queryVO.getNotInOrderIds()), OrderBaseInfoDO::getId, queryVO.getNotInOrderIds()) | 1610 | .notIn(CollectionUtils.isNotEmpty(queryVO.getNotInOrderIds()), OrderBaseInfoDO::getId, queryVO.getNotInOrderIds()) |
1611 | + .notIn(CollectionUtils.isNotEmpty(queryVO.getUnissuedOrderIds()), OrderBaseInfoDO::getId, queryVO.getUnissuedOrderIds()) | ||
1611 | .in(CollectionUtils.isNotEmpty(queryVO.getInvoiceNo()),OrderBaseInfoDO::getInvoiceNo,queryVO.getInvoiceNo()) | 1612 | .in(CollectionUtils.isNotEmpty(queryVO.getInvoiceNo()),OrderBaseInfoDO::getInvoiceNo,queryVO.getInvoiceNo()) |
1612 | .in(CollectionUtils.isNotEmpty(queryVO.getCheckNo()),OrderBaseInfoDO::getCheckNo,queryVO.getCheckNo()) | 1613 | .in(CollectionUtils.isNotEmpty(queryVO.getCheckNo()),OrderBaseInfoDO::getCheckNo,queryVO.getCheckNo()) |
1613 | .eq(Objects.nonNull(queryVO.getInvoiceStatus()), OrderBaseInfoDO::getInvoiceStatus, queryVO.getInvoiceStatus()) | 1614 | .eq(Objects.nonNull(queryVO.getInvoiceStatus()), OrderBaseInfoDO::getInvoiceStatus, queryVO.getInvoiceStatus()) |
src/main/java/com/order/erp/service/order/impl/OrderCostInfoServiceImpl.java
@@ -82,8 +82,8 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -82,8 +82,8 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
82 | @Override | 82 | @Override |
83 | @Transactional(rollbackFor = Exception.class) | 83 | @Transactional(rollbackFor = Exception.class) |
84 | public ServerResult edit(OrderCostInfoVO vo) { | 84 | public ServerResult edit(OrderCostInfoVO vo) { |
85 | - Integer type=null; | ||
86 | - String operationDesc=null; | 85 | + Integer type = null; |
86 | + String operationDesc = null; | ||
87 | Long id = vo.getOrderId(); | 87 | Long id = vo.getOrderId(); |
88 | Optional<OrderCostInfoDO> orderCostInfoDOOpt = this.lambdaQuery() | 88 | Optional<OrderCostInfoDO> orderCostInfoDOOpt = this.lambdaQuery() |
89 | .eq(OrderCostInfoDO::getOrderId, id) | 89 | .eq(OrderCostInfoDO::getOrderId, id) |
@@ -97,7 +97,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -97,7 +97,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
97 | orderCostInfoDO = BeanUtil.copyProperties(vo, OrderCostInfoDO.class); | 97 | orderCostInfoDO = BeanUtil.copyProperties(vo, OrderCostInfoDO.class); |
98 | } else { | 98 | } else { |
99 | orderCostInfoDO = orderCostInfoDOOpt.get(); | 99 | orderCostInfoDO = orderCostInfoDOOpt.get(); |
100 | - oldOrderCostInfoDO = BeanUtil.copyProperties(orderCostInfoDO, OrderCostInfoDO.class,"id","orderId","createTime","createBy","modifyTime","modifyBy","enableFlag"); | 100 | + oldOrderCostInfoDO = BeanUtil.copyProperties(orderCostInfoDO, OrderCostInfoDO.class, "id", "orderId", "createTime", "createBy", "modifyTime", "modifyBy", "enableFlag"); |
101 | BeanUtil.copyProperties(vo, orderCostInfoDO, CopyOptions.create().ignoreNullValue()); | 101 | BeanUtil.copyProperties(vo, orderCostInfoDO, CopyOptions.create().ignoreNullValue()); |
102 | } | 102 | } |
103 | // 如果对于新旧数据一致时,则不会进行状态设置。 但是对于第一次创建数据应该怎么办呢? 通过isUpdate来进行判断。 对象不存在时,就不需要判断数据是否一致,对象存在时,就需要进行判断数据是否一致。如果一致,则不要进行状态设置,反之则需要进行状态设置。 | 103 | // 如果对于新旧数据一致时,则不会进行状态设置。 但是对于第一次创建数据应该怎么办呢? 通过isUpdate来进行判断。 对象不存在时,就不需要判断数据是否一致,对象存在时,就需要进行判断数据是否一致。如果一致,则不要进行状态设置,反之则需要进行状态设置。 |
@@ -114,37 +114,43 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -114,37 +114,43 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
114 | .build() | 114 | .build() |
115 | ); | 115 | ); |
116 | OrderCostInfolockFieldVO originOrderCostInfolockFieldVO = JSONObject.parseObject(Optional.ofNullable(orderCostFieldLockRecord.getFields()).orElse("{}"), OrderCostInfolockFieldVO.class); | 116 | OrderCostInfolockFieldVO originOrderCostInfolockFieldVO = JSONObject.parseObject(Optional.ofNullable(orderCostFieldLockRecord.getFields()).orElse("{}"), OrderCostInfolockFieldVO.class); |
117 | - if(Objects.nonNull(vo.getPacketActualRmbTotalPrice())){ | 117 | + if (Objects.nonNull(vo.getPacketActualRmbTotalPrice()) || Objects.nonNull(vo.getOrderScore()) || Objects.nonNull(vo.getIssuedCommission())) { |
118 | originOrderCostInfolockFieldVO.setPacketActualRmbTotalPrice(OrderLockFieldEnum.LOCKED.name()); | 118 | originOrderCostInfolockFieldVO.setPacketActualRmbTotalPrice(OrderLockFieldEnum.LOCKED.name()); |
119 | originOrderCostInfolockFieldVO.setOrderScore(OrderLockFieldEnum.LOCKED.name()); | 119 | originOrderCostInfolockFieldVO.setOrderScore(OrderLockFieldEnum.LOCKED.name()); |
120 | - type=ProjectOptTypeEnum.PACKAGING_COST_TYPE.getType(); | 120 | + originOrderCostInfolockFieldVO.setIssuedCommission(OrderLockFieldEnum.LOCKED.name()); |
121 | + type = ProjectOptTypeEnum.PACKAGING_COST_TYPE.getType(); | ||
121 | operationDesc = isUpdate | 122 | operationDesc = isUpdate |
122 | ? OrderOptTypeEnum.PROJECT_COST_EDIT.getDesc() | 123 | ? OrderOptTypeEnum.PROJECT_COST_EDIT.getDesc() |
123 | : OrderOptTypeEnum.PROJECT_COST_ADD.getDesc(); | 124 | : OrderOptTypeEnum.PROJECT_COST_ADD.getDesc(); |
124 | //编辑包装费用实际金额之后状态为待审核 | 125 | //编辑包装费用实际金额之后状态为待审核 |
125 | /*需要考虑一个问题,假如状态为已通过,但是没有进行任何的修改而点击了确认,那么它的状态会由已审核变为待审核,所以需要进行判断一下,此次传递来的数据是否与上一次的数据一致,如果不一致则需要进行状态设置*/ | 126 | /*需要考虑一个问题,假如状态为已通过,但是没有进行任何的修改而点击了确认,那么它的状态会由已审核变为待审核,所以需要进行判断一下,此次传递来的数据是否与上一次的数据一致,如果不一致则需要进行状态设置*/ |
126 | - if(isUpdate && ProfitStatusEnum.APPROVED.getStatus().equals(oldOrderCostInfoDO.getPackStatus()) | 127 | + if (isUpdate && ProfitStatusEnum.APPROVED.getStatus().equals(oldOrderCostInfoDO.getPackStatus()) |
127 | && vo.getPacketActualRmbTotalPrice().compareTo(oldOrderCostInfoDO.getPacketActualRmbTotalPrice()) == 0 | 128 | && vo.getPacketActualRmbTotalPrice().compareTo(oldOrderCostInfoDO.getPacketActualRmbTotalPrice()) == 0 |
128 | - && ( vo.getOrderScore().equals(oldOrderCostInfoDO.getOrderScore())) | ||
129 | - ){ | ||
130 | - }else{ | 129 | + && (vo.getOrderScore().equals(oldOrderCostInfoDO.getOrderScore())) |
130 | + ) { | ||
131 | + } else { | ||
131 | orderCostInfoDO.setPackStatus(ProfitStatusEnum.PENDING_APPROVAL.getStatus()); | 132 | orderCostInfoDO.setPackStatus(ProfitStatusEnum.PENDING_APPROVAL.getStatus()); |
132 | } | 133 | } |
133 | - }else if(Objects.nonNull(vo.getProductionActualPrice())||Objects.nonNull(vo.getProductionDepartmentPredictPrice()) || Objects.nonNull(vo.getProductionDepartmentPredictUnitPrice())) { | 134 | + if(isUpdate && CommissionStatusEnum.ISSUED.getStatus().equals(oldOrderCostInfoDO.getOrderCommissionStatus()) |
135 | + && vo.getIssuedCommission().compareTo(oldOrderCostInfoDO.getIssuedCommission()) == 0){ | ||
136 | + }else{ | ||
137 | + orderCostInfoDO.setOrderCommissionStatus(CommissionStatusEnum.UN_ISSUED.getStatus()); | ||
138 | + } | ||
139 | + } else if (Objects.nonNull(vo.getProductionActualPrice()) || Objects.nonNull(vo.getProductionDepartmentPredictPrice()) || Objects.nonNull(vo.getProductionDepartmentPredictUnitPrice())) { | ||
134 | originOrderCostInfolockFieldVO.setProductionActualPrice(OrderLockFieldEnum.LOCKED.name()); | 140 | originOrderCostInfolockFieldVO.setProductionActualPrice(OrderLockFieldEnum.LOCKED.name()); |
135 | originOrderCostInfolockFieldVO.setProductionDepartmentPredictPrice(OrderLockFieldEnum.LOCKED.name()); | 141 | originOrderCostInfolockFieldVO.setProductionDepartmentPredictPrice(OrderLockFieldEnum.LOCKED.name()); |
136 | originOrderCostInfolockFieldVO.setProductionDepartmentPredictUnitPrice(OrderLockFieldEnum.LOCKED.name()); | 142 | originOrderCostInfolockFieldVO.setProductionDepartmentPredictUnitPrice(OrderLockFieldEnum.LOCKED.name()); |
137 | - type=ProjectOptTypeEnum.INTERNAL_PRODUCE_DETAILS_TYPE.getType(); | 143 | + type = ProjectOptTypeEnum.INTERNAL_PRODUCE_DETAILS_TYPE.getType(); |
138 | operationDesc = isUpdate | 144 | operationDesc = isUpdate |
139 | ? OrderOptTypeEnum.PROJECT_INNER_PRODUCE_PROFIT_EDIT.getDesc() | 145 | ? OrderOptTypeEnum.PROJECT_INNER_PRODUCE_PROFIT_EDIT.getDesc() |
140 | : OrderOptTypeEnum.PROJECT_INNER_PRODUCE_PROFIT_ADD.getDesc(); | 146 | : OrderOptTypeEnum.PROJECT_INNER_PRODUCE_PROFIT_ADD.getDesc(); |
141 | //编辑生产科预算金额和实际发生费用之后状态为待审核 | 147 | //编辑生产科预算金额和实际发生费用之后状态为待审核 |
142 | /*也需要考虑问题,假如状态为已通过,但是没有进行任何修改二点击了确认,那么它的状态会由已审核变为待审核*/ | 148 | /*也需要考虑问题,假如状态为已通过,但是没有进行任何修改二点击了确认,那么它的状态会由已审核变为待审核*/ |
143 | - if(isUpdate && ProfitStatusEnum.APPROVED.getStatus().equals(oldOrderCostInfoDO.getInnerProduceStatus()) && | ||
144 | - vo.getProductionActualPrice().compareTo(oldOrderCostInfoDO.getProductionActualPrice()) ==0 && | ||
145 | - vo.getProductionDepartmentPredictPrice().compareTo(oldOrderCostInfoDO.getProductionDepartmentPredictPrice()) ==0 && | ||
146 | - vo.getProductionDepartmentPredictUnitPrice().compareTo(oldOrderCostInfoDO.getProductionDepartmentPredictUnitPrice()) == 0){ | ||
147 | - }else{ | 149 | + if (isUpdate && ProfitStatusEnum.APPROVED.getStatus().equals(oldOrderCostInfoDO.getInnerProduceStatus()) && |
150 | + vo.getProductionActualPrice().compareTo(oldOrderCostInfoDO.getProductionActualPrice()) == 0 && | ||
151 | + vo.getProductionDepartmentPredictPrice().compareTo(oldOrderCostInfoDO.getProductionDepartmentPredictPrice()) == 0 && | ||
152 | + vo.getProductionDepartmentPredictUnitPrice().compareTo(oldOrderCostInfoDO.getProductionDepartmentPredictUnitPrice()) == 0) { | ||
153 | + } else { | ||
148 | orderCostInfoDO.setInnerProduceStatus(ProfitStatusEnum.PENDING_APPROVAL.getStatus()); | 154 | orderCostInfoDO.setInnerProduceStatus(ProfitStatusEnum.PENDING_APPROVAL.getStatus()); |
149 | } | 155 | } |
150 | } | 156 | } |
@@ -153,13 +159,13 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -153,13 +159,13 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
153 | this.saveOrUpdate(orderCostInfoDO); | 159 | this.saveOrUpdate(orderCostInfoDO); |
154 | //进行日志记录。 | 160 | //进行日志记录。 |
155 | OrderCostInfoVO orderCostInfoVO = buildOrderConstInfoVO(vo, id); | 161 | OrderCostInfoVO orderCostInfoVO = buildOrderConstInfoVO(vo, id); |
156 | - OrderCostDetailedOptLogDO orderConstOptLogDo = buildOrderConstOptLogDo(id, dataScope.getLoginUserId(),type ,operationDesc,JSONObject.toJSONString(orderCostInfoVO)); | 162 | + OrderCostDetailedOptLogDO orderConstOptLogDo = buildOrderConstOptLogDo(id, dataScope.getLoginUserId(), type, operationDesc, JSONObject.toJSONString(orderCostInfoVO)); |
157 | return ServerResult.success(orderCostDetailedOptLogService.save(orderConstOptLogDo)); | 163 | return ServerResult.success(orderCostDetailedOptLogService.save(orderConstOptLogDo)); |
158 | } | 164 | } |
159 | 165 | ||
160 | @Override | 166 | @Override |
161 | public ServerResult applyEditFileds(OrderCostInfolockFieldVO vo) { | 167 | public ServerResult applyEditFileds(OrderCostInfolockFieldVO vo) { |
162 | - Integer applyType=null; | 168 | + Integer applyType = null; |
163 | List<OrderFieldLockApplyDO> applyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>() | 169 | List<OrderFieldLockApplyDO> applyDOS = orderFieldLockApplyService.list(new LambdaQueryWrapper<OrderFieldLockApplyDO>() |
164 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | 170 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
165 | .eq(OrderFieldLockApplyDO::getOrderId, vo.getOrderId()) | 171 | .eq(OrderFieldLockApplyDO::getOrderId, vo.getOrderId()) |
@@ -172,6 +178,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -172,6 +178,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
172 | OrderCostInfolockFieldVO lockField = OrderCostInfolockFieldVO.builder() | 178 | OrderCostInfolockFieldVO lockField = OrderCostInfolockFieldVO.builder() |
173 | .packetActualRmbTotalPrice(vo.getPacketActualRmbTotalPrice()) | 179 | .packetActualRmbTotalPrice(vo.getPacketActualRmbTotalPrice()) |
174 | .orderScore(vo.getOrderScore()) | 180 | .orderScore(vo.getOrderScore()) |
181 | + .issuedCommission(vo.getIssuedCommission()) | ||
175 | .productionActualPrice(vo.getProductionActualPrice()) | 182 | .productionActualPrice(vo.getProductionActualPrice()) |
176 | .productionDepartmentPredictPrice(vo.getProductionDepartmentPredictPrice()) | 183 | .productionDepartmentPredictPrice(vo.getProductionDepartmentPredictPrice()) |
177 | .productionDepartmentPredictUnitPrice(vo.getProductionDepartmentPredictUnitPrice()) | 184 | .productionDepartmentPredictUnitPrice(vo.getProductionDepartmentPredictUnitPrice()) |
@@ -180,7 +187,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -180,7 +187,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
180 | .orderId(vo.getOrderId()) | 187 | .orderId(vo.getOrderId()) |
181 | .applyUserId(dataScope.getLoginUserId()) | 188 | .applyUserId(dataScope.getLoginUserId()) |
182 | //无论是订单生产费用明细字段申请还是订单生产费用明细字段申请,都是管理员审批,但是这里加上财务人员的目的是为财务人员能够在待审核列表中查看到申请,而不是给财务人员审批的。 | 189 | //无论是订单生产费用明细字段申请还是订单生产费用明细字段申请,都是管理员审批,但是这里加上财务人员的目的是为财务人员能够在待审核列表中查看到申请,而不是给财务人员审批的。 |
183 | - .auditRoleCodes(RoleEnum.ADMIN.getCode()+Constant.COMMA_CHARACTER+RoleEnum.FINANCE_USER.getCode()) | 190 | + .auditRoleCodes(RoleEnum.ADMIN.getCode() + Constant.COMMA_CHARACTER + RoleEnum.FINANCE_USER.getCode()) |
184 | .applyRemark(vo.getApplyRemark()) | 191 | .applyRemark(vo.getApplyRemark()) |
185 | .fields(JSONObject.toJSONString(lockField)) | 192 | .fields(JSONObject.toJSONString(lockField)) |
186 | .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) | 193 | .status(ApplyStatusEnum.WAIT_AUDIT.getStatus()) |
@@ -189,12 +196,12 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -189,12 +196,12 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
189 | .build(); | 196 | .build(); |
190 | orderFieldLockApplyService.save(build); | 197 | orderFieldLockApplyService.save(build); |
191 | //进行审批记录的保存。需要前端在申请字段申请时传递这条数据的id。 | 198 | //进行审批记录的保存。需要前端在申请字段申请时传递这条数据的id。 |
192 | - if(ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY.getType().equals(vo.getType())){ | ||
193 | - applyType=ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY.getType(); | ||
194 | - }else{ | ||
195 | - applyType=ApplyTypeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY.getType(); | 199 | + if (ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY.getType().equals(vo.getType())) { |
200 | + applyType = ApplyTypeEnum.ORDER_PRODUCTION_COST_FIELD_EDIT_APPLY.getType(); | ||
201 | + } else { | ||
202 | + applyType = ApplyTypeEnum.ORDER_PACKET_COST_FIELD_EDIT_APPLY.getType(); | ||
196 | } | 203 | } |
197 | - orderCostDetailedOptLogService.save(buildOrderConstOptLogDo(vo.getOrderId(), dataScope.getLoginUserId(),applyType,ApplyTypeEnum.getNameByType(applyType),JSONObject.toJSONString(lockField))); | 204 | + orderCostDetailedOptLogService.save(buildOrderConstOptLogDo(vo.getOrderId(), dataScope.getLoginUserId(), applyType, ApplyTypeEnum.getNameByType(applyType), JSONObject.toJSONString(lockField))); |
198 | return ServerResult.success(); | 205 | return ServerResult.success(); |
199 | } | 206 | } |
200 | 207 | ||
@@ -202,14 +209,14 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -202,14 +209,14 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
202 | public ServerResult<Page<InnerProfitDetailVO>> listInnerProfitDetailByPage(OrderBaseInfoQueryVO queryVO) { | 209 | public ServerResult<Page<InnerProfitDetailVO>> listInnerProfitDetailByPage(OrderBaseInfoQueryVO queryVO) { |
203 | Set<Long> orderIds = null; | 210 | Set<Long> orderIds = null; |
204 | Long loginUserId = dataScope.getLoginUserId(); | 211 | Long loginUserId = dataScope.getLoginUserId(); |
205 | - if(Objects.nonNull(queryVO.getInnerProduceStatus())){ | 212 | + if (Objects.nonNull(queryVO.getInnerProduceStatus())) { |
206 | List<OrderCostInfoDO> list; | 213 | List<OrderCostInfoDO> list; |
207 | - if(ProfitStatusEnum.Not_COMPLETED.getStatus().equals(queryVO.getInnerProduceStatus())){ | ||
208 | - list = list(new LambdaQueryWrapper<OrderCostInfoDO>() | 214 | + if (ProfitStatusEnum.Not_COMPLETED.getStatus().equals(queryVO.getInnerProduceStatus())) { |
215 | + list = list(new LambdaQueryWrapper<OrderCostInfoDO>() | ||
209 | .select(OrderCostInfoDO::getOrderId).eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | 216 | .select(OrderCostInfoDO::getOrderId).eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
210 | .in(OrderCostInfoDO::getInnerProduceStatus, ProfitStatusEnum.PENDING_APPROVAL.getStatus(), ProfitStatusEnum.APPROVED.getStatus())); | 217 | .in(OrderCostInfoDO::getInnerProduceStatus, ProfitStatusEnum.PENDING_APPROVAL.getStatus(), ProfitStatusEnum.APPROVED.getStatus())); |
211 | - }else{ | ||
212 | - list = list(new LambdaQueryWrapper<OrderCostInfoDO>() | 218 | + } else { |
219 | + list = list(new LambdaQueryWrapper<OrderCostInfoDO>() | ||
213 | .select(OrderCostInfoDO::getOrderId).eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | 220 | .select(OrderCostInfoDO::getOrderId).eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
214 | .eq(OrderCostInfoDO::getInnerProduceStatus, queryVO.getInnerProduceStatus())); | 221 | .eq(OrderCostInfoDO::getInnerProduceStatus, queryVO.getInnerProduceStatus())); |
215 | } | 222 | } |
@@ -220,12 +227,12 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -220,12 +227,12 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
220 | .filter(Objects::nonNull) | 227 | .filter(Objects::nonNull) |
221 | .collect(Collectors.toSet()); | 228 | .collect(Collectors.toSet()); |
222 | } | 229 | } |
223 | - if(CollectionUtils.isNotEmpty(orderIds)){ | ||
224 | - if(ProfitStatusEnum.Not_COMPLETED.getStatus().equals(queryVO.getInnerProduceStatus())){ | ||
225 | - queryVO.setNotInOrderIds(orderIds); | ||
226 | - }else{ | ||
227 | - queryVO.setOrderIds(orderIds); | ||
228 | - } | 230 | + if (CollectionUtils.isNotEmpty(orderIds)) { |
231 | + if (ProfitStatusEnum.Not_COMPLETED.getStatus().equals(queryVO.getInnerProduceStatus())) { | ||
232 | + queryVO.setNotInOrderIds(orderIds); | ||
233 | + } else { | ||
234 | + queryVO.setOrderIds(orderIds); | ||
235 | + } | ||
229 | } | 236 | } |
230 | ServerResult serverResult = orderBaseInfoService.listByPage(queryVO); | 237 | ServerResult serverResult = orderBaseInfoService.listByPage(queryVO); |
231 | Page<OrderInfoResultVO> page = (Page<OrderInfoResultVO>) serverResult.getData(); | 238 | Page<OrderInfoResultVO> page = (Page<OrderInfoResultVO>) serverResult.getData(); |
@@ -249,26 +256,26 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -249,26 +256,26 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
249 | } catch (JsonProcessingException e) { | 256 | } catch (JsonProcessingException e) { |
250 | throw new RuntimeException(e); | 257 | throw new RuntimeException(e); |
251 | } | 258 | } |
252 | - },(v1, v2) -> v2)); | 259 | + }, (v1, v2) -> v2)); |
253 | List<InnerProfitDetailVO> innerProfitRatioResultVOs = records.stream().map(record -> { | 260 | List<InnerProfitDetailVO> innerProfitRatioResultVOs = records.stream().map(record -> { |
254 | OrderCostInfoVO orderCostInfo = record.getOrderCostInfo(); | 261 | OrderCostInfoVO orderCostInfo = record.getOrderCostInfo(); |
255 | OrderCostInfolockFieldVO lockFields = Optional.ofNullable(orderId2fieldMapMap.get(record.getId())) | 262 | OrderCostInfolockFieldVO lockFields = Optional.ofNullable(orderId2fieldMapMap.get(record.getId())) |
256 | .orElse(new OrderCostInfolockFieldVO() | 263 | .orElse(new OrderCostInfolockFieldVO() |
257 | ); | 264 | ); |
258 | - if(Objects.nonNull(orderCostInfo)&& ProfitStatusEnum.APPROVED.getStatus().equals(orderCostInfo.getInnerProduceStatus())){ | ||
259 | - if(Objects.isNull(lockFields.getPacketActualRmbTotalPrice())){ | 265 | + if (Objects.nonNull(orderCostInfo) && ProfitStatusEnum.APPROVED.getStatus().equals(orderCostInfo.getInnerProduceStatus())) { |
266 | + if (Objects.isNull(lockFields.getPacketActualRmbTotalPrice())) { | ||
260 | lockFields.setPacketActualRmbTotalPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); | 267 | lockFields.setPacketActualRmbTotalPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); |
261 | } | 268 | } |
262 | - if(Objects.isNull(lockFields.getProductionActualPrice())){ | 269 | + if (Objects.isNull(lockFields.getProductionActualPrice())) { |
263 | lockFields.setProductionActualPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); | 270 | lockFields.setProductionActualPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); |
264 | } | 271 | } |
265 | - if(Objects.isNull(lockFields.getProductionDepartmentPredictPrice())){ | 272 | + if (Objects.isNull(lockFields.getProductionDepartmentPredictPrice())) { |
266 | lockFields.setProductionDepartmentPredictPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); | 273 | lockFields.setProductionDepartmentPredictPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); |
267 | } | 274 | } |
268 | - if(Objects.isNull(lockFields.getProductionDepartmentPredictUnitPrice())){ | 275 | + if (Objects.isNull(lockFields.getProductionDepartmentPredictUnitPrice())) { |
269 | lockFields.setProductionDepartmentPredictUnitPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictUnitPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); | 276 | lockFields.setProductionDepartmentPredictUnitPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictUnitPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); |
270 | } | 277 | } |
271 | - }else{ | 278 | + } else { |
272 | lockFields.setPacketActualRmbTotalPrice(OrderLockFieldEnum.UN_LOCKED.name()); | 279 | lockFields.setPacketActualRmbTotalPrice(OrderLockFieldEnum.UN_LOCKED.name()); |
273 | lockFields.setProductionActualPrice(OrderLockFieldEnum.UN_LOCKED.name()); | 280 | lockFields.setProductionActualPrice(OrderLockFieldEnum.UN_LOCKED.name()); |
274 | lockFields.setProductionDepartmentPredictPrice(OrderLockFieldEnum.UN_LOCKED.name()); | 281 | lockFields.setProductionDepartmentPredictPrice(OrderLockFieldEnum.UN_LOCKED.name()); |
@@ -281,14 +288,14 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -281,14 +288,14 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
281 | .projectNo(record.getProjectNo()) | 288 | .projectNo(record.getProjectNo()) |
282 | .productionDepartment(record.getProductionDepartment()) | 289 | .productionDepartment(record.getProductionDepartment()) |
283 | .innerNo(record.getInnerNo()) | 290 | .innerNo(record.getInnerNo()) |
284 | - .picUrl(record.getPicUrl()) | 291 | + .picUrl(record.getSmallPicUrl()) |
285 | .orderCount(record.getOrderCount()) | 292 | .orderCount(record.getOrderCount()) |
286 | .productionDepartmentPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getProductionDepartmentPrice()) | 293 | .productionDepartmentPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getProductionDepartmentPrice()) |
287 | .productionDepartmentTotalPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getProductionDepartmentTotalPrice()) | 294 | .productionDepartmentTotalPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getProductionDepartmentTotalPrice()) |
288 | .productionDepartmentPredictPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionDepartmentPredictPrice()) | 295 | .productionDepartmentPredictPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionDepartmentPredictPrice()) |
289 | .productionDepartmentPredictUnitPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionDepartmentPredictUnitPrice()) | 296 | .productionDepartmentPredictUnitPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionDepartmentPredictUnitPrice()) |
290 | .productionActualPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionActualPrice()) | 297 | .productionActualPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getProductionActualPrice()) |
291 | - .innerProduceStatus((Objects.isNull(record.getOrderCostInfo()) || Objects.isNull(record.getOrderCostInfo().getInnerProduceStatus())) ? ProfitStatusEnum.Not_COMPLETED.getStatus() : record.getOrderCostInfo().getInnerProduceStatus()) | 298 | + .innerProduceStatus((Objects.isNull(record.getOrderCostInfo()) || Objects.isNull(record.getOrderCostInfo().getInnerProduceStatus())) ? ProfitStatusEnum.Not_COMPLETED.getStatus() : record.getOrderCostInfo().getInnerProduceStatus()) |
292 | .lockFields(lockFields) | 299 | .lockFields(lockFields) |
293 | .build(); | 300 | .build(); |
294 | 301 | ||
@@ -334,8 +341,9 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -334,8 +341,9 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
334 | 341 | ||
335 | @Override | 342 | @Override |
336 | public ServerResult<Page<BusinessProfitDetailVO>> listBusinessProfitDetailByPage(OrderBaseInfoQueryVO queryVO) { | 343 | public ServerResult<Page<BusinessProfitDetailVO>> listBusinessProfitDetailByPage(OrderBaseInfoQueryVO queryVO) { |
337 | - Long loginUserId = dataScope.getLoginUserId(); | 344 | + /*Long loginUserId = dataScope.getLoginUserId(); |
338 | Set<Long> orderIds=null; | 345 | Set<Long> orderIds=null; |
346 | + Set<Long> issueOrderIds=null; | ||
339 | if(Objects.nonNull(queryVO.getPackStatus())){ | 347 | if(Objects.nonNull(queryVO.getPackStatus())){ |
340 | List<OrderCostInfoDO> list; | 348 | List<OrderCostInfoDO> list; |
341 | if(ProfitStatusEnum.Not_COMPLETED.getStatus().equals(queryVO.getPackStatus())){ | 349 | if(ProfitStatusEnum.Not_COMPLETED.getStatus().equals(queryVO.getPackStatus())){ |
@@ -361,6 +369,87 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -361,6 +369,87 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
361 | queryVO.setOrderIds(orderIds); | 369 | queryVO.setOrderIds(orderIds); |
362 | } | 370 | } |
363 | } | 371 | } |
372 | + if(Objects.nonNull(queryVO.getOrderCommissionStatus())){ | ||
373 | + List<OrderCostInfoDO> issuedOrderCostInfoDOS; | ||
374 | + issuedOrderCostInfoDOS = list(new LambdaQueryWrapper<OrderCostInfoDO>().select(OrderCostInfoDO::getOrderId) | ||
375 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | ||
376 | + .eq(OrderCostInfoDO::getOrderCommissionStatus, CommissionStatusEnum.ISSUED.getStatus())); | ||
377 | + issueOrderIds = CollectionUtils.isEmpty(issuedOrderCostInfoDOS) | ||
378 | + ? new HashSet<>() | ||
379 | + : issuedOrderCostInfoDOS.stream() | ||
380 | + .map(OrderCostInfoDO::getOrderId) | ||
381 | + .filter(Objects::nonNull) | ||
382 | + .collect(Collectors.toSet()); | ||
383 | + } | ||
384 | + if(CollectionUtils.isNotEmpty(issueOrderIds)){ | ||
385 | + //筛选提成发放状态为未发放的订单。 | ||
386 | + if(CommissionStatusEnum.UN_ISSUED.getStatus().equals(queryVO.getOrderCommissionStatus())){ | ||
387 | + queryVO.setUnissuedOrderIds(issueOrderIds); | ||
388 | + }else{ | ||
389 | + //筛选提成发放状态为发放的订单。 | ||
390 | + orderIds.addAll(issueOrderIds); | ||
391 | + queryVO.setOrderIds(orderIds); | ||
392 | + } | ||
393 | + }*/ | ||
394 | + | ||
395 | + Long loginUserId = dataScope.getLoginUserId(); | ||
396 | + | ||
397 | + Set<Long> orderIds = new HashSet<>(); | ||
398 | + Set<Long> issueOrderIds = new HashSet<>(); | ||
399 | + | ||
400 | +// 处理打包状态 | ||
401 | + Integer packStatus = queryVO.getPackStatus(); | ||
402 | + if (Objects.nonNull(packStatus)) { | ||
403 | + LambdaQueryWrapper<OrderCostInfoDO> wrapper = new LambdaQueryWrapper<OrderCostInfoDO>() | ||
404 | + .select(OrderCostInfoDO::getOrderId) | ||
405 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN); | ||
406 | + | ||
407 | + if (ProfitStatusEnum.Not_COMPLETED.getStatus().equals(packStatus)) { | ||
408 | + wrapper.in(OrderCostInfoDO::getPackStatus, | ||
409 | + ProfitStatusEnum.PENDING_APPROVAL.getStatus(), | ||
410 | + ProfitStatusEnum.APPROVED.getStatus()); | ||
411 | + } else { | ||
412 | + wrapper.eq(OrderCostInfoDO::getPackStatus, packStatus); | ||
413 | + } | ||
414 | + | ||
415 | + List<Long> ids = list(wrapper).stream() | ||
416 | + .map(OrderCostInfoDO::getOrderId) | ||
417 | + .filter(Objects::nonNull) | ||
418 | + .collect(Collectors.toList()); | ||
419 | + orderIds.addAll(ids); | ||
420 | + | ||
421 | + if (!orderIds.isEmpty()) { | ||
422 | + if (ProfitStatusEnum.Not_COMPLETED.getStatus().equals(packStatus)) { | ||
423 | + queryVO.setNotInOrderIds(orderIds); | ||
424 | + } else { | ||
425 | + queryVO.setOrderIds(orderIds); | ||
426 | + } | ||
427 | + } | ||
428 | + } | ||
429 | + | ||
430 | +// 处理提成发放状态 | ||
431 | + Integer commissionStatus = queryVO.getOrderCommissionStatus(); | ||
432 | + if (Objects.nonNull(commissionStatus)) { | ||
433 | + List<Long> issuedIds = list(new LambdaQueryWrapper<OrderCostInfoDO>() | ||
434 | + .select(OrderCostInfoDO::getOrderId) | ||
435 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | ||
436 | + .eq(OrderCostInfoDO::getOrderCommissionStatus, CommissionStatusEnum.ISSUED.getStatus())) | ||
437 | + .stream() | ||
438 | + .map(OrderCostInfoDO::getOrderId) | ||
439 | + .filter(Objects::nonNull) | ||
440 | + .collect(Collectors.toList()); | ||
441 | + issueOrderIds.addAll(issuedIds); | ||
442 | + | ||
443 | + if (!issueOrderIds.isEmpty()) { | ||
444 | + if (CommissionStatusEnum.UN_ISSUED.getStatus().equals(commissionStatus)) { | ||
445 | + queryVO.setUnissuedOrderIds(issueOrderIds); | ||
446 | + } else { | ||
447 | + orderIds.addAll(issueOrderIds); // 已存在 packStatus 时收集的 orderIds | ||
448 | + queryVO.setOrderIds(issueOrderIds); | ||
449 | + } | ||
450 | + } | ||
451 | + } | ||
452 | + | ||
364 | ServerResult serverResult = orderBaseInfoService.listByPage(queryVO); | 453 | ServerResult serverResult = orderBaseInfoService.listByPage(queryVO); |
365 | Page<OrderInfoResultVO> page = (Page<OrderInfoResultVO>) serverResult.getData(); | 454 | Page<OrderInfoResultVO> page = (Page<OrderInfoResultVO>) serverResult.getData(); |
366 | List<OrderInfoResultVO> records = page.getRecords(); | 455 | List<OrderInfoResultVO> records = page.getRecords(); |
@@ -384,7 +473,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -384,7 +473,7 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
384 | } catch (JsonProcessingException e) { | 473 | } catch (JsonProcessingException e) { |
385 | throw new RuntimeException(e); | 474 | throw new RuntimeException(e); |
386 | } | 475 | } |
387 | - },(v1, v2) -> v2)); | 476 | + }, (v1, v2) -> v2)); |
388 | BigDecimal exchangeRate = systemSettingService.getExchangeRate(); | 477 | BigDecimal exchangeRate = systemSettingService.getExchangeRate(); |
389 | //获取所有的客户提成提成配置。 | 478 | //获取所有的客户提成提成配置。 |
390 | List<SystemSettingDO> systemSettingDOS = systemSettingService.list(new LambdaQueryWrapper<SystemSettingDO>() | 479 | List<SystemSettingDO> systemSettingDOS = systemSettingService.list(new LambdaQueryWrapper<SystemSettingDO>() |
@@ -396,39 +485,50 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -396,39 +485,50 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
396 | OrderCostInfolockFieldVO lockFields = Optional.ofNullable(orderId2fieldMapMap.get(record.getId())).orElse( | 485 | OrderCostInfolockFieldVO lockFields = Optional.ofNullable(orderId2fieldMapMap.get(record.getId())).orElse( |
397 | new OrderCostInfolockFieldVO() | 486 | new OrderCostInfolockFieldVO() |
398 | ); | 487 | ); |
399 | - if(Objects.nonNull(orderCostInfo) && ProfitStatusEnum.APPROVED.getStatus().equals(orderCostInfo.getPackStatus())){ | ||
400 | - if(Objects.isNull(lockFields.getPacketActualRmbTotalPrice())){ | 488 | + if (Objects.nonNull(orderCostInfo) && ProfitStatusEnum.APPROVED.getStatus().equals(orderCostInfo.getPackStatus())) { |
489 | + if (Objects.isNull(lockFields.getPacketActualRmbTotalPrice())) { | ||
401 | lockFields.setPacketActualRmbTotalPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); | 490 | lockFields.setPacketActualRmbTotalPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getPacketActualRmbTotalPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); |
402 | } | 491 | } |
403 | //跟单评分。 | 492 | //跟单评分。 |
404 | - if(Objects.isNull(lockFields.getOrderScore())){ | 493 | + if (Objects.isNull(lockFields.getOrderScore())) { |
405 | lockFields.setOrderScore(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getOrderScore()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); | 494 | lockFields.setOrderScore(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getOrderScore()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); |
406 | 495 | ||
407 | } | 496 | } |
408 | - if(Objects.isNull(lockFields.getProductionActualPrice())){ | 497 | + if (Objects.isNull(lockFields.getProductionActualPrice())) { |
409 | lockFields.setProductionActualPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); | 498 | lockFields.setProductionActualPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionActualPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); |
410 | } | 499 | } |
411 | - if(Objects.isNull(lockFields.getProductionDepartmentPredictPrice())){ | 500 | + if (Objects.isNull(lockFields.getProductionDepartmentPredictPrice())) { |
412 | lockFields.setProductionDepartmentPredictPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); | 501 | lockFields.setProductionDepartmentPredictPrice(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getProductionDepartmentPredictPrice()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); |
413 | } | 502 | } |
414 | - }else{ | 503 | + } else { |
415 | lockFields.setPacketActualRmbTotalPrice(OrderLockFieldEnum.UN_LOCKED.name()); | 504 | lockFields.setPacketActualRmbTotalPrice(OrderLockFieldEnum.UN_LOCKED.name()); |
416 | lockFields.setProductionActualPrice(OrderLockFieldEnum.UN_LOCKED.name()); | 505 | lockFields.setProductionActualPrice(OrderLockFieldEnum.UN_LOCKED.name()); |
417 | lockFields.setProductionDepartmentPredictPrice(OrderLockFieldEnum.UN_LOCKED.name()); | 506 | lockFields.setProductionDepartmentPredictPrice(OrderLockFieldEnum.UN_LOCKED.name()); |
418 | lockFields.setOrderScore(OrderLockFieldEnum.UN_LOCKED.name()); | 507 | lockFields.setOrderScore(OrderLockFieldEnum.UN_LOCKED.name()); |
419 | } | 508 | } |
509 | + if(Objects.nonNull(orderCostInfo) && CommissionStatusEnum.ISSUED.getStatus().equals(orderCostInfo.getOrderCommissionStatus())){ | ||
510 | + // 已发提成 | ||
511 | + if(Objects.isNull(lockFields.getIssuedCommission())){ | ||
512 | + lockFields.setIssuedCommission(Objects.isNull(orderCostInfo) || Objects.isNull(orderCostInfo.getIssuedCommission()) ? OrderLockFieldEnum.UN_LOCKED.name() : OrderLockFieldEnum.LOCKED.name()); | ||
513 | + } | ||
514 | + }else{ | ||
515 | + lockFields.setIssuedCommission(OrderLockFieldEnum.UN_LOCKED.name()); | ||
516 | + } | ||
420 | BusinessProfitDetailVO vo = BusinessProfitDetailVO.builder() | 517 | BusinessProfitDetailVO vo = BusinessProfitDetailVO.builder() |
421 | .orderId(record.getId()) | 518 | .orderId(record.getId()) |
422 | .customerCode(record.getCustomerCode()) | 519 | .customerCode(record.getCustomerCode()) |
423 | .projectNo(record.getProjectNo()) | 520 | .projectNo(record.getProjectNo()) |
424 | .productionDepartment(record.getProductionDepartment()) | 521 | .productionDepartment(record.getProductionDepartment()) |
425 | .innerNo(record.getInnerNo()) | 522 | .innerNo(record.getInnerNo()) |
426 | - .picUrl(record.getPicUrl()) | 523 | + .picUrl(record.getSmallPicUrl()) |
427 | .orderCount(record.getOrderCount()) | 524 | .orderCount(record.getOrderCount()) |
428 | .packetPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getPacketPrice()) | 525 | .packetPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getPacketPrice()) |
429 | .packetTotalPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getPacketTotalPrice()) | 526 | .packetTotalPrice(Objects.isNull(record.getProfitAnalysisInfo()) ? null : record.getProfitAnalysisInfo().getPacketTotalPrice()) |
430 | .packetActualRmbTotalPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getPacketActualRmbTotalPrice()) | 527 | .packetActualRmbTotalPrice(Objects.isNull(record.getOrderCostInfo()) ? null : record.getOrderCostInfo().getPacketActualRmbTotalPrice()) |
431 | .packStatus((Objects.isNull(record.getOrderCostInfo()) || Objects.isNull(record.getOrderCostInfo().getPackStatus())) ? ProfitStatusEnum.Not_COMPLETED.getStatus() : record.getOrderCostInfo().getPackStatus()) | 528 | .packStatus((Objects.isNull(record.getOrderCostInfo()) || Objects.isNull(record.getOrderCostInfo().getPackStatus())) ? ProfitStatusEnum.Not_COMPLETED.getStatus() : record.getOrderCostInfo().getPackStatus()) |
529 | + .orderCommissionStatus((Objects.isNull(record.getOrderCostInfo()) || Objects.isNull(record.getOrderCostInfo().getOrderCommissionStatus())) ? CommissionStatusEnum.UN_ISSUED.getStatus() : record.getOrderCostInfo().getOrderCommissionStatus()) | ||
530 | + .issuedCommission((Objects.isNull(record.getOrderCostInfo()) || Objects.isNull(record.getOrderCostInfo().getIssuedCommission())) ? null : record.getOrderCostInfo().getIssuedCommission()) | ||
531 | + .packNotes((Objects.isNull(record.getOrderCostInfo()) || Objects.isNull(record.getOrderCostInfo().getPackNotes())) ? null : record.getOrderCostInfo().getPackNotes()) | ||
432 | .lockFields(lockFields) | 532 | .lockFields(lockFields) |
433 | .build(); | 533 | .build(); |
434 | if (Objects.nonNull(vo.getPacketTotalPrice())) { | 534 | if (Objects.nonNull(vo.getPacketTotalPrice())) { |
@@ -449,34 +549,39 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -449,34 +549,39 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
449 | //包装费用净利润率 = 包装费用收益/包装费用合计 | 549 | //包装费用净利润率 = 包装费用收益/包装费用合计 |
450 | vo.setPacketProfitRate(vo.getPacketProfitRmbPrice().divide(BigDecimal.valueOf(vo.getPacketRmbTotalPrice()), 4, RoundingMode.HALF_UP)); | 550 | vo.setPacketProfitRate(vo.getPacketProfitRmbPrice().divide(BigDecimal.valueOf(vo.getPacketRmbTotalPrice()), 4, RoundingMode.HALF_UP)); |
451 | } | 551 | } |
452 | - if(Objects.nonNull(orderCostInfo) && Objects.nonNull(orderCostInfo.getOrderScore())){ | 552 | + if (Objects.nonNull(orderCostInfo) && Objects.nonNull(orderCostInfo.getOrderScore())) { |
453 | vo.setOrderScore(orderCostInfo.getOrderScore()); | 553 | vo.setOrderScore(orderCostInfo.getOrderScore()); |
454 | - String projectFix = ProjectNoUtils.extractProjectNoPrefix(record.getProjectNo()); | ||
455 | - String substring = projectFix.substring(projectFix.lastIndexOf("-") + 1).substring(0, 2); | ||
456 | - Optional<SystemSettingDO> optionalSetting = systemSettingDOSMap.values().stream() | ||
457 | - .flatMap(List::stream) | ||
458 | - .filter(setting -> setting.getSettingValue().equals(record.getCustomerCode())) | ||
459 | - .filter(setting -> setting.getRelationName().substring(2, 4).equals(substring)) | ||
460 | - .findFirst(); | ||
461 | - if(optionalSetting.isPresent()){ | ||
462 | - SystemSettingDO systemSettingDO = optionalSetting.get(); | ||
463 | - List<Map<String,String>> relations=null; | ||
464 | - try { | ||
465 | - relations= objectMapper.readValue(systemSettingDO.getRelationValue(),objectMapper.getTypeFactory().constructType(List.class, Map.class)); | ||
466 | - } catch (JsonProcessingException e) { | ||
467 | - throw new RuntimeException(e); | ||
468 | - } | ||
469 | - String copyCommission= null; | ||
470 | - for(Map<String,String> relation:relations){ | ||
471 | - if("copyCommission".equals(relation.get("relationCode"))){ | ||
472 | - copyCommission = relation.get("relationValue"); | 554 | + if(CommissionStatusEnum.ISSUED.getStatus().equals(vo.getOrderCommissionStatus()) && Objects.nonNull(orderCostInfo.getPassedCopyCommission())){ |
555 | + //提成金额 = 跟单评分 * 跟单提成计算。 | ||
556 | + vo.setCopyCommission(orderCostInfo.getPassedCopyCommission().multiply(BigDecimal.valueOf(orderCostInfo.getOrderScore()).divide(BigDecimal.valueOf(100))).setScale( 2, RoundingMode.HALF_UP)); | ||
557 | + }else{ | ||
558 | + String projectFix = ProjectNoUtils.extractProjectNoPrefix(record.getProjectNo()); | ||
559 | + String substring = projectFix.substring(projectFix.lastIndexOf("-") + 1).substring(0, 2); | ||
560 | + Optional<SystemSettingDO> optionalSetting = systemSettingDOSMap.values().stream() | ||
561 | + .flatMap(List::stream) | ||
562 | + .filter(setting -> setting.getSettingValue().equals(record.getCustomerCode())) | ||
563 | + .filter(setting -> setting.getRelationName().substring(2, 4).equals(substring)) | ||
564 | + .findFirst(); | ||
565 | + if (optionalSetting.isPresent()) { | ||
566 | + SystemSettingDO systemSettingDO = optionalSetting.get(); | ||
567 | + List<Map<String, String>> relations = null; | ||
568 | + try { | ||
569 | + relations = objectMapper.readValue(systemSettingDO.getRelationValue(), objectMapper.getTypeFactory().constructType(List.class, Map.class)); | ||
570 | + } catch (JsonProcessingException e) { | ||
571 | + throw new RuntimeException(e); | ||
572 | + } | ||
573 | + String copyCommission = null; | ||
574 | + for (Map<String, String> relation : relations) { | ||
575 | + if ("copyCommission".equals(relation.get("relationCode"))) { | ||
576 | + copyCommission = relation.get("relationValue"); | ||
577 | + } | ||
578 | + } | ||
579 | + if (StringUtils.isNotBlank(copyCommission)) { | ||
580 | + //提成金额 = 跟单评分 * 跟单提成计算。 | ||
581 | + vo.setCopyCommission(new BigDecimal(copyCommission).multiply(BigDecimal.valueOf(orderCostInfo.getOrderScore()).divide(BigDecimal.valueOf(100))).setScale(2, RoundingMode.HALF_UP)); | ||
473 | } | 582 | } |
474 | } | 583 | } |
475 | - if(StringUtils.isNotBlank(copyCommission)){ | ||
476 | - //提成金额 = 跟单评分 * 跟单提成计算。 | ||
477 | - vo.setCopyCommission(new BigDecimal(copyCommission) .multiply(BigDecimal.valueOf(orderCostInfo.getOrderScore()).divide(BigDecimal.valueOf(100))).setScale(2, RoundingMode.HALF_UP)); | ||
478 | - } | ||
479 | - } | 584 | + } |
480 | } | 585 | } |
481 | return vo; | 586 | return vo; |
482 | }).collect(Collectors.toList()); | 587 | }).collect(Collectors.toList()); |
@@ -487,19 +592,19 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -487,19 +592,19 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
487 | } | 592 | } |
488 | 593 | ||
489 | @Override | 594 | @Override |
490 | - public void exportBusinessProfitDetailExcel(HttpServletResponse response,ProjectBaseInfoQueryVO queryVO) throws Exception { | ||
491 | - if(CollectionUtils.isEmpty(queryVO.getOrderIds()) && | ||
492 | - CollectionUtils.isEmpty(queryVO.getProjectNo()) && | ||
493 | - CollectionUtils.isEmpty(queryVO.getCustomerCode()) && | ||
494 | - CollectionUtils.isEmpty(queryVO.getInnerNo()) && | ||
495 | - CollectionUtils.isEmpty(queryVO.getProductionDepartment())){ | 595 | + public void exportBusinessProfitDetailExcel(HttpServletResponse response, ProjectBaseInfoQueryVO queryVO) throws Exception { |
596 | + if (CollectionUtils.isEmpty(queryVO.getOrderIds()) && | ||
597 | + CollectionUtils.isEmpty(queryVO.getProjectNo()) && | ||
598 | + CollectionUtils.isEmpty(queryVO.getCustomerCode()) && | ||
599 | + CollectionUtils.isEmpty(queryVO.getInnerNo()) && | ||
600 | + CollectionUtils.isEmpty(queryVO.getProductionDepartment())) { | ||
496 | throw new BusinessException(ServerResultCode.PARAM_ERROR); | 601 | throw new BusinessException(ServerResultCode.PARAM_ERROR); |
497 | } | 602 | } |
498 | OrderBaseInfoQueryVO.OrderBaseInfoQueryVOBuilder builder = OrderBaseInfoQueryVO.builder() | 603 | OrderBaseInfoQueryVO.OrderBaseInfoQueryVOBuilder builder = OrderBaseInfoQueryVO.builder() |
499 | .page(1) | 604 | .page(1) |
500 | .pageSize(200); // 设置大一点,确保导出数据不遗漏 | 605 | .pageSize(200); // 设置大一点,确保导出数据不遗漏 |
501 | 606 | ||
502 | - // 根据传入条件设置筛选字段 | 607 | + // 根据传入条件设置筛选字段 |
503 | if (CollectionUtils.isNotEmpty(queryVO.getOrderIds())) { | 608 | if (CollectionUtils.isNotEmpty(queryVO.getOrderIds())) { |
504 | builder.orderIds(queryVO.getOrderIds()); | 609 | builder.orderIds(queryVO.getOrderIds()); |
505 | } else { | 610 | } else { |
@@ -520,10 +625,9 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -520,10 +625,9 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
520 | ServerResult serverResult = listBusinessProfitDetailByPage(builder.build()); | 625 | ServerResult serverResult = listBusinessProfitDetailByPage(builder.build()); |
521 | Page<BusinessProfitDetailVO> page = (Page<BusinessProfitDetailVO>) serverResult.getData(); | 626 | Page<BusinessProfitDetailVO> page = (Page<BusinessProfitDetailVO>) serverResult.getData(); |
522 | List<BusinessProfitDetailVO> businessProfitDetailVOS = page.getRecords(); | 627 | List<BusinessProfitDetailVO> businessProfitDetailVOS = page.getRecords(); |
523 | - System.out.println("订单数量:"+businessProfitDetailVOS.size()); | ||
524 | - if(CollectionUtils.isNotEmpty(businessProfitDetailVOS)){ | 628 | + if (CollectionUtils.isNotEmpty(businessProfitDetailVOS)) { |
525 | List<Map<String, Object>> list = buildBusinessProfitExportExcel(businessProfitDetailVOS, queryVO); | 629 | List<Map<String, Object>> list = buildBusinessProfitExportExcel(businessProfitDetailVOS, queryVO); |
526 | - if(CollectionUtils.isNotEmpty(list)){ | 630 | + if (CollectionUtils.isNotEmpty(list)) { |
527 | List<String> keys = new ArrayList<>(list.get(Constant.ZERO).keySet()); | 631 | List<String> keys = new ArrayList<>(list.get(Constant.ZERO).keySet()); |
528 | ExcelHelper.opsExport(PoiWorkbookType.XLSX) | 632 | ExcelHelper.opsExport(PoiWorkbookType.XLSX) |
529 | .opsSheet(list) | 633 | .opsSheet(list) |
@@ -532,50 +636,47 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -532,50 +636,47 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
532 | .height(CellPosition.CELL, 750) | 636 | .height(CellPosition.CELL, 750) |
533 | .done() | 637 | .done() |
534 | .export(response.getOutputStream()); | 638 | .export(response.getOutputStream()); |
535 | - System.out.println("导出成功"); | ||
536 | } | 639 | } |
537 | } | 640 | } |
538 | - System.out.println(businessProfitDetailVOS); | ||
539 | } | 641 | } |
540 | 642 | ||
541 | @Override | 643 | @Override |
542 | public void exportInnerProfitDetailExcel(HttpServletResponse response, ProjectBaseInfoQueryVO queryVO) throws Exception { | 644 | public void exportInnerProfitDetailExcel(HttpServletResponse response, ProjectBaseInfoQueryVO queryVO) throws Exception { |
543 | - if(CollectionUtils.isEmpty(queryVO.getOrderIds()) && | 645 | + if (CollectionUtils.isEmpty(queryVO.getOrderIds()) && |
544 | CollectionUtils.isEmpty(queryVO.getProjectNo()) && | 646 | CollectionUtils.isEmpty(queryVO.getProjectNo()) && |
545 | CollectionUtils.isEmpty(queryVO.getCustomerCode()) && | 647 | CollectionUtils.isEmpty(queryVO.getCustomerCode()) && |
546 | CollectionUtils.isEmpty(queryVO.getInnerNo()) && | 648 | CollectionUtils.isEmpty(queryVO.getInnerNo()) && |
547 | - CollectionUtils.isEmpty(queryVO.getProductionDepartment())){ | 649 | + CollectionUtils.isEmpty(queryVO.getProductionDepartment())) { |
548 | throw new BusinessException(ServerResultCode.PARAM_ERROR); | 650 | throw new BusinessException(ServerResultCode.PARAM_ERROR); |
549 | } | 651 | } |
550 | OrderBaseInfoQueryVO.OrderBaseInfoQueryVOBuilder builder = OrderBaseInfoQueryVO.builder() | 652 | OrderBaseInfoQueryVO.OrderBaseInfoQueryVOBuilder builder = OrderBaseInfoQueryVO.builder() |
551 | .productionDepartment(Collections.singletonList("内部")) | 653 | .productionDepartment(Collections.singletonList("内部")) |
552 | .page(1) | 654 | .page(1) |
553 | .pageSize(200); //设置大一点,确保导出数据不遗漏 | 655 | .pageSize(200); //设置大一点,确保导出数据不遗漏 |
554 | - if(CollectionUtils.isNotEmpty(queryVO.getOrderIds())){ | 656 | + if (CollectionUtils.isNotEmpty(queryVO.getOrderIds())) { |
555 | builder.orderIds(queryVO.getOrderIds()); | 657 | builder.orderIds(queryVO.getOrderIds()); |
556 | - }else{ | 658 | + } else { |
557 | //如果orderIds为空就代表传递的是筛选条件。 | 659 | //如果orderIds为空就代表传递的是筛选条件。 |
558 | - if(CollectionUtils.isNotEmpty(queryVO.getProjectNo())){ | 660 | + if (CollectionUtils.isNotEmpty(queryVO.getProjectNo())) { |
559 | builder.projectNo(queryVO.getProjectNo()); | 661 | builder.projectNo(queryVO.getProjectNo()); |
560 | } | 662 | } |
561 | - if(CollectionUtils.isNotEmpty(queryVO.getCustomerCode())){ | 663 | + if (CollectionUtils.isNotEmpty(queryVO.getCustomerCode())) { |
562 | builder.customerCode(queryVO.getCustomerCode()); | 664 | builder.customerCode(queryVO.getCustomerCode()); |
563 | } | 665 | } |
564 | - if(CollectionUtils.isNotEmpty(queryVO.getProductionDepartment())){ | 666 | + if (CollectionUtils.isNotEmpty(queryVO.getProductionDepartment())) { |
565 | builder.productionDepartment(queryVO.getProductionDepartment()); | 667 | builder.productionDepartment(queryVO.getProductionDepartment()); |
566 | } | 668 | } |
567 | - if(CollectionUtils.isNotEmpty(queryVO.getInnerNo())){ | 669 | + if (CollectionUtils.isNotEmpty(queryVO.getInnerNo())) { |
568 | builder.innerNo(queryVO.getInnerNo()); | 670 | builder.innerNo(queryVO.getInnerNo()); |
569 | } | 671 | } |
570 | } | 672 | } |
571 | //这里设置为100是故意设置大一点,防止导出多条数据。 | 673 | //这里设置为100是故意设置大一点,防止导出多条数据。 |
572 | - ServerResult<Page<InnerProfitDetailVO>> serverResult= listInnerProfitDetailByPage(builder.build()); | ||
573 | - Page<InnerProfitDetailVO> page=(Page<InnerProfitDetailVO>) serverResult.getData(); | 674 | + ServerResult<Page<InnerProfitDetailVO>> serverResult = listInnerProfitDetailByPage(builder.build()); |
675 | + Page<InnerProfitDetailVO> page = (Page<InnerProfitDetailVO>) serverResult.getData(); | ||
574 | List<InnerProfitDetailVO> innerProfitDetailVOS = page.getRecords(); | 676 | List<InnerProfitDetailVO> innerProfitDetailVOS = page.getRecords(); |
575 | - System.out.println("订单数量"+innerProfitDetailVOS.size()); | ||
576 | - if(CollectionUtils.isNotEmpty(innerProfitDetailVOS)){ | 677 | + if (CollectionUtils.isNotEmpty(innerProfitDetailVOS)) { |
577 | List<Map<String, Object>> list = buildInnerProfitDetailExcel(innerProfitDetailVOS, queryVO); | 678 | List<Map<String, Object>> list = buildInnerProfitDetailExcel(innerProfitDetailVOS, queryVO); |
578 | - if(CollectionUtils.isNotEmpty(list)){ | 679 | + if (CollectionUtils.isNotEmpty(list)) { |
579 | List<String> keys = new ArrayList<>(list.get(Constant.ZERO).keySet()); | 680 | List<String> keys = new ArrayList<>(list.get(Constant.ZERO).keySet()); |
580 | ExcelHelper.opsExport(PoiWorkbookType.XLSX) | 681 | ExcelHelper.opsExport(PoiWorkbookType.XLSX) |
581 | .opsSheet(list) | 682 | .opsSheet(list) |
@@ -584,7 +685,6 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -584,7 +685,6 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
584 | .height(CellPosition.CELL, 750) | 685 | .height(CellPosition.CELL, 750) |
585 | .done() | 686 | .done() |
586 | .export(response.getOutputStream()); | 687 | .export(response.getOutputStream()); |
587 | - System.out.println("导出成功"); | ||
588 | } | 688 | } |
589 | } | 689 | } |
590 | } | 690 | } |
@@ -592,25 +692,25 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -592,25 +692,25 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
592 | @Override | 692 | @Override |
593 | public ServerResult setPackStatus(OrderCostInfoVO vo) { | 693 | public ServerResult setPackStatus(OrderCostInfoVO vo) { |
594 | //首先判断orderId是否为空。 | 694 | //首先判断orderId是否为空。 |
595 | - if(Objects.isNull(vo.getOrderId())){ | 695 | + if (Objects.isNull(vo.getOrderId())) { |
596 | throw new BusinessException(ServerResultCode.PARAM_ERROR); | 696 | throw new BusinessException(ServerResultCode.PARAM_ERROR); |
597 | } | 697 | } |
598 | OrderCostInfoDO orderCostInfoDO = getOne(new LambdaQueryWrapper<OrderCostInfoDO>() | 698 | OrderCostInfoDO orderCostInfoDO = getOne(new LambdaQueryWrapper<OrderCostInfoDO>() |
599 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | 699 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
600 | .eq(OrderCostInfoDO::getOrderId, vo.getOrderId()) | 700 | .eq(OrderCostInfoDO::getOrderId, vo.getOrderId()) |
601 | .last("limit 1")); | 701 | .last("limit 1")); |
602 | - if(Objects.isNull(orderCostInfoDO)){ | 702 | + if (Objects.isNull(orderCostInfoDO)) { |
603 | throw new BusinessException(ServerResultCode.EMPTY_LIST); | 703 | throw new BusinessException(ServerResultCode.EMPTY_LIST); |
604 | } | 704 | } |
605 | orderCostInfoDO.setPackStatus(ProfitStatusEnum.APPROVED.getStatus()); | 705 | orderCostInfoDO.setPackStatus(ProfitStatusEnum.APPROVED.getStatus()); |
606 | //还需要对审核通过也进行记录 81 91 | 706 | //还需要对审核通过也进行记录 81 91 |
607 | - OrderCostInfoVO orderCostInfoVO=new OrderCostInfoVO(); | ||
608 | - BeanUtils.copyProperties(orderCostInfoDO,orderCostInfoVO); | 707 | + OrderCostInfoVO orderCostInfoVO = new OrderCostInfoVO(); |
708 | + BeanUtils.copyProperties(orderCostInfoDO, orderCostInfoVO); | ||
609 | transactionHelper.run(() -> { | 709 | transactionHelper.run(() -> { |
610 | - orderCostDetailedOptLogService.save(buildOrderConstOptLogDo((vo.getOrderId()),dataScope.getLoginUserId() | ||
611 | - ,ApplyTypeEnum.ORDER_PACKET_COST_PASS.getType() | ||
612 | - ,ApplyTypeEnum.ORDER_PACKET_COST_PASS.getDesc() | ||
613 | - ,JSONObject.toJSONString(orderCostInfoVO))); | 710 | + orderCostDetailedOptLogService.save(buildOrderConstOptLogDo((vo.getOrderId()), dataScope.getLoginUserId() |
711 | + , ApplyTypeEnum.ORDER_PACKET_COST_PASS.getType() | ||
712 | + , ApplyTypeEnum.ORDER_PACKET_COST_PASS.getDesc() | ||
713 | + , JSONObject.toJSONString(orderCostInfoVO))); | ||
614 | updateById(orderCostInfoDO); | 714 | updateById(orderCostInfoDO); |
615 | }); | 715 | }); |
616 | return ServerResult.success(); | 716 | return ServerResult.success(); |
@@ -618,30 +718,90 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -618,30 +718,90 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
618 | 718 | ||
619 | @Override | 719 | @Override |
620 | public ServerResult setInnerProduceStatus(OrderCostInfoVO vo) { | 720 | public ServerResult setInnerProduceStatus(OrderCostInfoVO vo) { |
621 | - if(Objects.isNull(vo.getOrderId())){ | 721 | + if (Objects.isNull(vo.getOrderId())) { |
622 | throw new BusinessException(ServerResultCode.PARAM_ERROR); | 722 | throw new BusinessException(ServerResultCode.PARAM_ERROR); |
623 | } | 723 | } |
624 | OrderCostInfoDO orderCostInfoDO = getOne(new LambdaQueryWrapper<OrderCostInfoDO>() | 724 | OrderCostInfoDO orderCostInfoDO = getOne(new LambdaQueryWrapper<OrderCostInfoDO>() |
625 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | 725 | .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) |
626 | .eq(OrderCostInfoDO::getOrderId, vo.getOrderId()) | 726 | .eq(OrderCostInfoDO::getOrderId, vo.getOrderId()) |
627 | .last("limit 1")); | 727 | .last("limit 1")); |
628 | - if(Objects.isNull(orderCostInfoDO)){ | 728 | + if (Objects.isNull(orderCostInfoDO)) { |
629 | throw new BusinessException(ServerResultCode.EMPTY_LIST); | 729 | throw new BusinessException(ServerResultCode.EMPTY_LIST); |
630 | } | 730 | } |
631 | - orderCostInfoDO.setInnerProduceStatus(ProfitStatusEnum.APPROVED.getStatus()); | 731 | + orderCostInfoDO.setInnerProduceStatus(ProfitStatusEnum.APPROVED.getStatus()); |
632 | OrderCostInfoVO orderCostInfoVO = new OrderCostInfoVO(); | 732 | OrderCostInfoVO orderCostInfoVO = new OrderCostInfoVO(); |
633 | BeanUtils.copyProperties(orderCostInfoDO, orderCostInfoVO); | 733 | BeanUtils.copyProperties(orderCostInfoDO, orderCostInfoVO); |
634 | - orderCostDetailedOptLogService.save(buildOrderConstOptLogDo((vo.getOrderId()),dataScope.getLoginUserId() | ||
635 | - ,ApplyTypeEnum.ORDER_PRODUCTION_COST_APPLY.getType() | ||
636 | - ,ApplyTypeEnum.ORDER_PRODUCTION_COST_APPLY.getDesc() | ||
637 | - ,JSONObject.toJSONString(orderCostInfoVO))); | ||
638 | - updateById(orderCostInfoDO); | 734 | + transactionHelper.run(() -> { |
735 | + orderCostDetailedOptLogService.save(buildOrderConstOptLogDo((vo.getOrderId()), dataScope.getLoginUserId() | ||
736 | + , ApplyTypeEnum.ORDER_PRODUCTION_COST_APPLY.getType() | ||
737 | + , ApplyTypeEnum.ORDER_PRODUCTION_COST_APPLY.getDesc() | ||
738 | + , JSONObject.toJSONString(orderCostInfoVO))); | ||
639 | updateById(orderCostInfoDO); | 739 | updateById(orderCostInfoDO); |
740 | + }); | ||
640 | return ServerResult.success(); | 741 | return ServerResult.success(); |
641 | } | 742 | } |
642 | 743 | ||
744 | + @Override | ||
745 | + public ServerResult setCommissionStatus(OrderCostInfoVO vo) { | ||
746 | + //首先判断orderId是否为空。 | ||
747 | + if (Objects.isNull(vo.getOrderId())) { | ||
748 | + throw new BusinessException(ServerResultCode.PARAM_ERROR); | ||
749 | + } | ||
750 | + OrderCostInfoDO orderCostInfoDO = getOne(new LambdaQueryWrapper<OrderCostInfoDO>() | ||
751 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | ||
752 | + .eq(OrderCostInfoDO::getOrderId, vo.getOrderId()) | ||
753 | + .last("limit 1")); | ||
754 | + if (Objects.isNull(orderCostInfoDO)) { | ||
755 | + throw new BusinessException(ServerResultCode.EMPTY_LIST); | ||
756 | + } | ||
757 | + orderCostInfoDO.setOrderCommissionStatus(CommissionStatusEnum.ISSUED.getStatus()); | ||
758 | + //需要把已通过的包装提成总金额存储起来,下次再查询时使用已通过的包装提成总金额进行计算,而不再采用系统配置中的包装提成总金额进行计算,这样做的目的主要是为了避免更改系统配置中包装提成总金额后,即使已通过也会被改变,所以存储通过时的包装提成金额。 | ||
759 | + ObjectMapper objectMapper = new ObjectMapper(); | ||
760 | + List<SystemSettingDO> systemSettingDOS = systemSettingService.list(new LambdaQueryWrapper<SystemSettingDO>() | ||
761 | + .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | ||
762 | + .eq(SystemSettingDO::getRelationCode, "costSettingItem")); | ||
763 | + Map<String, List<SystemSettingDO>> systemSettingDOSMap = systemSettingDOS.stream().collect(Collectors.groupingBy(SystemSettingDO::getSettingValue)); | ||
764 | + OrderBaseInfoDO orderBaseInfoDO = orderBaseInfoService.getById(orderCostInfoDO.getOrderId()); | ||
765 | + String projectFix = ProjectNoUtils.extractProjectNoPrefix(orderBaseInfoDO.getProjectNo()); | ||
766 | + String substring = projectFix.substring(projectFix.lastIndexOf("-") + 1).substring(0, 2); | ||
767 | + Optional<SystemSettingDO> optionalSetting = systemSettingDOSMap.values().stream() | ||
768 | + .flatMap(List::stream) | ||
769 | + .filter(setting -> setting.getSettingValue().equals(orderBaseInfoDO.getCustomerCode())) | ||
770 | + .filter(setting -> setting.getRelationName().substring(2, 4).equals(substring)) | ||
771 | + .findFirst(); | ||
772 | + if (optionalSetting.isPresent()) { | ||
773 | + SystemSettingDO systemSettingDO = optionalSetting.get(); | ||
774 | + List<Map<String, String>> relations = null; | ||
775 | + try { | ||
776 | + relations = objectMapper.readValue(systemSettingDO.getRelationValue(), objectMapper.getTypeFactory().constructType(List.class, Map.class)); | ||
777 | + } catch (JsonProcessingException e) { | ||
778 | + throw new RuntimeException(e); | ||
779 | + } | ||
780 | + String copyCommission = null; | ||
781 | + for (Map<String, String> relation : relations) { | ||
782 | + if ("copyCommission".equals(relation.get("relationCode"))) { | ||
783 | + copyCommission = relation.get("relationValue"); | ||
784 | + } | ||
785 | + } | ||
786 | + if (StringUtils.isNotBlank(copyCommission)) { | ||
787 | + orderCostInfoDO.setPassedCopyCommission(new BigDecimal(copyCommission)); | ||
788 | + } | ||
789 | + } | ||
790 | + //还需要对审核通过也进行记录 81 91 | ||
791 | + OrderCostInfoVO orderCostInfoVO = new OrderCostInfoVO(); | ||
792 | + BeanUtils.copyProperties(orderCostInfoDO, orderCostInfoVO); | ||
793 | + transactionHelper.run(() -> { | ||
794 | + orderCostDetailedOptLogService.save(buildOrderConstOptLogDo((vo.getOrderId()), dataScope.getLoginUserId() | ||
795 | + , ApplyTypeEnum.ORDER_PACKET_COST_COMMISSION_PASS.getType() | ||
796 | + , ApplyTypeEnum.ORDER_PACKET_COST_COMMISSION_PASS.getDesc() | ||
797 | + , JSONObject.toJSONString(orderCostInfoVO))); | ||
798 | + updateById(orderCostInfoDO); | ||
799 | + }); | ||
800 | + return ServerResult.success(); | ||
801 | + } | ||
643 | 802 | ||
644 | - private OrderCostDetailedOptLogDO buildOrderConstOptLogDo(Long orderId, Long userId , Integer type, String optType, String field){ | 803 | + |
804 | + private OrderCostDetailedOptLogDO buildOrderConstOptLogDo(Long orderId, Long userId, Integer type, String optType, String field) { | ||
645 | return OrderCostDetailedOptLogDO.builder() | 805 | return OrderCostDetailedOptLogDO.builder() |
646 | .orderId(orderId) | 806 | .orderId(orderId) |
647 | .userId(userId) | 807 | .userId(userId) |
@@ -650,39 +810,42 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -650,39 +810,42 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
650 | .fields(field) | 810 | .fields(field) |
651 | .build(); | 811 | .build(); |
652 | } | 812 | } |
653 | - private OrderCostInfoVO buildOrderConstInfoVO(OrderCostInfoVO vo,Long orderId){ | 813 | + |
814 | + private OrderCostInfoVO buildOrderConstInfoVO(OrderCostInfoVO vo, Long orderId) { | ||
654 | OrderCostInfoVO orderCostInfoVO = new OrderCostInfoVO(); | 815 | OrderCostInfoVO orderCostInfoVO = new OrderCostInfoVO(); |
655 | BeanUtils.copyProperties(vo, orderCostInfoVO, "id"); | 816 | BeanUtils.copyProperties(vo, orderCostInfoVO, "id"); |
656 | orderCostInfoVO.setId(orderId); | 817 | orderCostInfoVO.setId(orderId); |
657 | return orderCostInfoVO; | 818 | return orderCostInfoVO; |
658 | } | 819 | } |
659 | 820 | ||
660 | - private List<Map<String,Object>> buildBusinessProfitExportExcel(List<BusinessProfitDetailVO> businessProfitDetailVOS,ProjectBaseInfoQueryVO queryVO) throws IOException { | ||
661 | - List<Map<String,Object>> list= new ArrayList<>(); | ||
662 | - for(BusinessProfitDetailVO vo:businessProfitDetailVOS){ | 821 | + private List<Map<String, Object>> buildBusinessProfitExportExcel(List<BusinessProfitDetailVO> businessProfitDetailVOS, ProjectBaseInfoQueryVO queryVO) throws IOException { |
822 | + List<Map<String, Object>> list = new ArrayList<>(); | ||
823 | + for (BusinessProfitDetailVO vo : businessProfitDetailVOS) { | ||
663 | Map<String, Object> map = new LinkedHashMap<>(); | 824 | Map<String, Object> map = new LinkedHashMap<>(); |
664 | - map.put("客户编码",Objects.nonNull(vo.getCustomerCode()) ? vo.getCustomerCode() : ""); | ||
665 | - map.put("项目号",Objects.nonNull(vo.getProjectNo()) ? vo.getProjectNo() : ""); | ||
666 | - map.put("生产科",Objects.nonNull(vo.getProductionDepartment()) ? vo.getProductionDepartment() : ""); | ||
667 | - map.put("内部编号",Objects.nonNull(vo.getInnerNo()) ? vo.getInnerNo() : ""); | ||
668 | - /* 不要图片,影响导出效率。 | 825 | + map.put("客户编码", Objects.nonNull(vo.getCustomerCode()) ? vo.getCustomerCode() : ""); |
826 | + map.put("项目号", Objects.nonNull(vo.getProjectNo()) ? vo.getProjectNo() : ""); | ||
827 | + map.put("生产科", Objects.nonNull(vo.getProductionDepartment()) ? vo.getProductionDepartment() : ""); | ||
828 | + map.put("内部编号", Objects.nonNull(vo.getInnerNo()) ? vo.getInnerNo() : ""); | ||
829 | +// 不要图片,影响导出效率。 | ||
669 | if(StringUtils.isNotBlank(vo.getPicUrl())){ | 830 | if(StringUtils.isNotBlank(vo.getPicUrl())){ |
670 | URL url = new URL(vo.getPicUrl()); | 831 | URL url = new URL(vo.getPicUrl()); |
671 | InputStream inputStream = url.openStream(); | 832 | InputStream inputStream = url.openStream(); |
672 | map.put("订单图片", FileUtil.imageParseBytes(inputStream)); | 833 | map.put("订单图片", FileUtil.imageParseBytes(inputStream)); |
673 | }else{ | 834 | }else{ |
674 | map.put("订单图片", ""); | 835 | map.put("订单图片", ""); |
675 | - }*/ | ||
676 | - map.put("订单数量",Objects.nonNull(vo.getOrderCount()) ? vo.getOrderCount() : ""); | ||
677 | - map.put("包装费用$",Objects.nonNull(vo.getPacketPrice()) ? String.format("%.2f",vo.getPacketPrice()) : ""); | ||
678 | - map.put("包装费用合计$",Objects.nonNull(vo.getPacketTotalPrice()) ? String.format("%.2f",vo.getPacketTotalPrice()) : ""); | ||
679 | - map.put("包装费用合计¥",Objects.nonNull(vo.getPacketRmbTotalPrice()) ? String.format("%.2f",vo.getPacketRmbTotalPrice()) : ""); | ||
680 | - map.put("包装费用实际金额¥",Objects.nonNull(vo.getPacketActualRmbTotalPrice()) ? vo.getPacketActualRmbTotalPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
681 | - map.put("实际跟单单价¥",Objects.nonNull(vo.getPacketActualRmbPrice()) ? vo.getPacketActualRmbPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
682 | - map.put("实际跟单单价$",Objects.nonNull(vo.getPacketActualPrice()) ? vo.getPacketActualPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
683 | - map.put("包装费用净利润率",Objects.nonNull(vo.getPacketProfitRate()) ? vo.getPacketProfitRate().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | ||
684 | - map.put("跟单评分",Objects.nonNull(vo.getOrderScore()) ? vo.getOrderScore() : ""); | ||
685 | - map.put("跟单提成¥",Objects.nonNull(vo.getCopyCommission()) ? vo.getCopyCommission().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | 836 | + } |
837 | + map.put("订单数量", Objects.nonNull(vo.getOrderCount()) ? vo.getOrderCount() : ""); | ||
838 | + map.put("包装费用$", Objects.nonNull(vo.getPacketPrice()) ? String.format("%.2f", vo.getPacketPrice()) : ""); | ||
839 | + map.put("包装费用合计$", Objects.nonNull(vo.getPacketTotalPrice()) ? String.format("%.2f", vo.getPacketTotalPrice()) : ""); | ||
840 | + map.put("包装费用合计¥", Objects.nonNull(vo.getPacketRmbTotalPrice()) ? String.format("%.2f", vo.getPacketRmbTotalPrice()) : ""); | ||
841 | + map.put("包装费用实际金额¥", Objects.nonNull(vo.getPacketActualRmbTotalPrice()) ? vo.getPacketActualRmbTotalPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
842 | + map.put("实际跟单单价¥", Objects.nonNull(vo.getPacketActualRmbPrice()) ? vo.getPacketActualRmbPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
843 | + map.put("实际跟单单价$", Objects.nonNull(vo.getPacketActualPrice()) ? vo.getPacketActualPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
844 | + map.put("包装费用净利润率", Objects.nonNull(vo.getPacketProfitRate()) ? vo.getPacketProfitRate().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | ||
845 | + map.put("跟单评分", Objects.nonNull(vo.getOrderScore()) ? vo.getOrderScore() : ""); | ||
846 | + map.put("跟单提成¥", Objects.nonNull(vo.getCopyCommission()) ? vo.getCopyCommission().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
847 | + map.put("已发提成¥", Objects.nonNull(vo.getIssuedCommission()) ? vo.getIssuedCommission().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
848 | + map.put("提成状态", Objects.nonNull(vo.getOrderCommissionStatus()) ? (CommissionStatusEnum.ISSUED.getStatus().equals(vo.getOrderCommissionStatus()) ? "已发放" : "未发放") : "未发放"); | ||
686 | // if(StringUtils.isNotBlank(queryVO.getBusinessCostExportSelect().getPacketPrice()) && | 849 | // if(StringUtils.isNotBlank(queryVO.getBusinessCostExportSelect().getPacketPrice()) && |
687 | // OrderLockFieldEnum.SELECTED.name().equals(queryVO.getBusinessCostExportSelect().getPacketPrice())){ | 850 | // OrderLockFieldEnum.SELECTED.name().equals(queryVO.getBusinessCostExportSelect().getPacketPrice())){ |
688 | // | 851 | // |
@@ -692,33 +855,32 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | @@ -692,33 +855,32 @@ public class OrderCostInfoServiceImpl extends ServiceImpl<OrderCostInfoMapper, O | ||
692 | return list; | 855 | return list; |
693 | } | 856 | } |
694 | 857 | ||
695 | - private List<Map<String,Object>> buildInnerProfitDetailExcel(List<InnerProfitDetailVO> innerProfitDetailVOS, ProjectBaseInfoQueryVO queryVO) throws IOException { | ||
696 | - List<Map<String,Object>> list = new ArrayList<>(); | ||
697 | - for (InnerProfitDetailVO vo:innerProfitDetailVOS){ | 858 | + private List<Map<String, Object>> buildInnerProfitDetailExcel(List<InnerProfitDetailVO> innerProfitDetailVOS, ProjectBaseInfoQueryVO queryVO) throws IOException { |
859 | + List<Map<String, Object>> list = new ArrayList<>(); | ||
860 | + for (InnerProfitDetailVO vo : innerProfitDetailVOS) { | ||
698 | Map<String, Object> hashMap = new LinkedHashMap<>(); | 861 | Map<String, Object> hashMap = new LinkedHashMap<>(); |
699 | - hashMap.put("客户编码",Objects.nonNull(vo.getCustomerCode()) ? vo.getCustomerCode() : ""); | ||
700 | - hashMap.put("项目号",Objects.nonNull(vo.getProjectNo()) ? vo.getProjectNo() : ""); | ||
701 | - hashMap.put("生产科",Objects.nonNull(vo.getProductionDepartment()) ? vo.getProductionDepartment() : ""); | ||
702 | - hashMap.put("内部编号",Objects.nonNull(vo.getInnerNo()) ? vo.getInnerNo() : ""); | ||
703 | - /* 不要图片,影响到处效率。 | 862 | + hashMap.put("客户编码", Objects.nonNull(vo.getCustomerCode()) ? vo.getCustomerCode() : ""); |
863 | + hashMap.put("项目号", Objects.nonNull(vo.getProjectNo()) ? vo.getProjectNo() : ""); | ||
864 | + hashMap.put("生产科", Objects.nonNull(vo.getProductionDepartment()) ? vo.getProductionDepartment() : ""); | ||
865 | + hashMap.put("内部编号", Objects.nonNull(vo.getInnerNo()) ? vo.getInnerNo() : ""); | ||
704 | if(StringUtils.isNotBlank(vo.getPicUrl())){ | 866 | if(StringUtils.isNotBlank(vo.getPicUrl())){ |
705 | URL url = new URL(vo.getPicUrl()); | 867 | URL url = new URL(vo.getPicUrl()); |
706 | InputStream inputStream = url.openStream(); | 868 | InputStream inputStream = url.openStream(); |
707 | hashMap.put("订单图片", FileUtil.imageParseBytes(inputStream)); | 869 | hashMap.put("订单图片", FileUtil.imageParseBytes(inputStream)); |
708 | }else{ | 870 | }else{ |
709 | hashMap.put("订单图片", ""); | 871 | hashMap.put("订单图片", ""); |
710 | - }*/ | ||
711 | - hashMap.put("订单数量",Objects.nonNull(vo.getOrderCount()) ? vo.getOrderCount() : ""); | ||
712 | - hashMap.put("生产科单价¥",Objects.nonNull(vo.getProductionDepartmentPrice()) ? String.format("%.2f",vo.getProductionDepartmentPrice()) : ""); | ||
713 | - hashMap.put("生产科总价¥",Objects.nonNull(vo.getProductionDepartmentTotalPrice()) ? String.format("%.2f",vo.getProductionDepartmentTotalPrice()) : ""); | ||
714 | - hashMap.put("生产科预算金额¥",Objects.nonNull(vo.getProductionDepartmentPredictPrice()) ? vo.getProductionDepartmentPredictPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
715 | - hashMap.put("实际发生费用¥",Objects.nonNull(vo.getProductionActualPrice()) ? vo.getProductionActualPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
716 | - hashMap.put("预算占比",Objects.nonNull(vo.getPredictRatio()) ? vo.getPredictRatio().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | ||
717 | - hashMap.put("预算占比与实际占比差",Objects.nonNull(vo.getPredictAndActualRatio()) ? vo.getPredictAndActualRatio().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | ||
718 | - hashMap.put("事前毛利润",Objects.nonNull(vo.getBeforeGrossProfit()) ? vo.getBeforeGrossProfit().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
719 | - hashMap.put("事前毛利率",Objects.nonNull(vo.getBeforeGrossProfitRate()) ? vo.getBeforeGrossProfitRate().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | ||
720 | - hashMap.put("事后毛利润",Objects.nonNull(vo.getGrossProfit()) ? vo.getGrossProfit().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
721 | - hashMap.put("事后毛利率",Objects.nonNull(vo.getGrossProfitRate()) ? vo.getGrossProfitRate().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | 872 | + } |
873 | + hashMap.put("订单数量", Objects.nonNull(vo.getOrderCount()) ? vo.getOrderCount() : ""); | ||
874 | + hashMap.put("生产科单价¥", Objects.nonNull(vo.getProductionDepartmentPrice()) ? String.format("%.2f", vo.getProductionDepartmentPrice()) : ""); | ||
875 | + hashMap.put("生产科总价¥", Objects.nonNull(vo.getProductionDepartmentTotalPrice()) ? String.format("%.2f", vo.getProductionDepartmentTotalPrice()) : ""); | ||
876 | + hashMap.put("生产科预算金额¥", Objects.nonNull(vo.getProductionDepartmentPredictPrice()) ? vo.getProductionDepartmentPredictPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
877 | + hashMap.put("实际发生费用¥", Objects.nonNull(vo.getProductionActualPrice()) ? vo.getProductionActualPrice().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
878 | + hashMap.put("预算占比", Objects.nonNull(vo.getPredictRatio()) ? vo.getPredictRatio().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | ||
879 | + hashMap.put("预算占比与实际占比差", Objects.nonNull(vo.getPredictAndActualRatio()) ? vo.getPredictAndActualRatio().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | ||
880 | + hashMap.put("事前毛利润", Objects.nonNull(vo.getBeforeGrossProfit()) ? vo.getBeforeGrossProfit().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
881 | + hashMap.put("事前毛利率", Objects.nonNull(vo.getBeforeGrossProfitRate()) ? vo.getBeforeGrossProfitRate().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | ||
882 | + hashMap.put("事后毛利润", Objects.nonNull(vo.getGrossProfit()) ? vo.getGrossProfit().setScale(2, RoundingMode.HALF_UP).toPlainString() : ""); | ||
883 | + hashMap.put("事后毛利率", Objects.nonNull(vo.getGrossProfitRate()) ? vo.getGrossProfitRate().multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%" : ""); | ||
722 | /*if(StringUtils.isNotBlank(queryVO.getInnerProfitDetailExportSelect().getProductionDepartmentPrice()) && | 884 | /*if(StringUtils.isNotBlank(queryVO.getInnerProfitDetailExportSelect().getProductionDepartmentPrice()) && |
723 | OrderLockFieldEnum.SELECTED.name().equals(queryVO.getInnerProfitDetailExportSelect().getProductionDepartmentPrice())){ | 885 | OrderLockFieldEnum.SELECTED.name().equals(queryVO.getInnerProfitDetailExportSelect().getProductionDepartmentPrice())){ |
724 | 886 |