Commit f02036f9ce8134f0889067e6f45578f4087b3b6d

Authored by yeqianyong
1 parent 97016964

楚江ERP-订货单规格变更逻辑调整

Showing 24 changed files with 1386 additions and 954 deletions
  1 +package com.lframework.xingyun.sc.bo.order.change;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.xingyun.sc.entity.OrderInfoChangeRecord;
  5 +import com.lframework.starter.common.constants.StringPool;
  6 +import com.lframework.starter.web.core.bo.BaseBo;
  7 +import java.time.LocalDate;
  8 +import java.time.LocalDateTime;
  9 +import java.util.List;
  10 +
  11 +import com.lframework.xingyun.sc.entity.PurchaseOrderLine;
  12 +import io.swagger.annotations.ApiModelProperty;
  13 +
  14 +import lombok.Data;
  15 +
  16 +/**
  17 + * <p>
  18 + * 订货单变更记录 Bo
  19 + * </p>
  20 + *
  21 + */
  22 +@Data
  23 +public class OrderChangeRecordBo extends BaseBo<OrderInfoChangeRecord> {
  24 +
  25 + /**
  26 + * ID
  27 + */
  28 + @ApiModelProperty("ID")
  29 + private String id;
  30 +
  31 + /**
  32 + * 订货单ID
  33 + */
  34 + @ApiModelProperty(value = "订货单ID")
  35 + private String orderId;
  36 +
  37 + /**
  38 + * 订单编号
  39 + */
  40 + @ApiModelProperty("订单编号")
  41 + private String orderNo;
  42 +
  43 + /**
  44 + * 供货单位:安徽楚江高精铜带有限公司(GJ)、安徽楚江科技新材料股份有限公司(XC)
  45 + */
  46 + @ApiModelProperty("供货单位")
  47 + private String supplyUnit;
  48 +
  49 + /**
  50 + * 订货单位ID
  51 + */
  52 + @ApiModelProperty("订货单位ID")
  53 + private String orderingUnit;
  54 +
  55 + /**
  56 + * 订货日期
  57 + */
  58 + @ApiModelProperty("订货日期")
  59 + @JsonFormat(pattern = StringPool.DATE_PATTERN)
  60 + private LocalDate orderDate;
  61 +
  62 + /**
  63 + * 结算方式或期限
  64 + */
  65 + @ApiModelProperty("结算方式或期限")
  66 + private String settlementTerms;
  67 +
  68 + /**
  69 + * 交货方式
  70 + */
  71 + @ApiModelProperty("交货方式")
  72 + private String deliveryMethod;
  73 +
  74 + /**
  75 + * 价格表编号
  76 + */
  77 + @ApiModelProperty("价格表编号")
  78 + private String priceListNo;
  79 +
  80 + /**
  81 + * 执行标准
  82 + */
  83 + @ApiModelProperty("执行标准")
  84 + private String executionStandard;
  85 +
  86 + /**
  87 + * 开票情况
  88 + */
  89 + @ApiModelProperty("开票情况")
  90 + private String invoicingStatus;
  91 +
  92 + /**
  93 + * 运费
  94 + */
  95 + @ApiModelProperty("运费")
  96 + private String shippingCost;
  97 +
  98 + /**
  99 + * 件重条头
  100 + */
  101 + @ApiModelProperty("件重条头")
  102 + private String pieceWeightHeader;
  103 +
  104 + /**
  105 + * 表面
  106 + */
  107 + @ApiModelProperty("表面")
  108 + private String surface;
  109 +
  110 + /**
  111 + * 公差
  112 + */
  113 + @ApiModelProperty("公差")
  114 + private String tolerance;
  115 +
  116 + /**
  117 + * 性能
  118 + */
  119 + @ApiModelProperty("性能")
  120 + private String performance;
  121 +
  122 + /**
  123 + * 成分
  124 + */
  125 + @ApiModelProperty("成分")
  126 + private String element;
  127 +
  128 + /**
  129 + * 包装
  130 + */
  131 + @ApiModelProperty("包装")
  132 + private String packaging;
  133 +
  134 + /**
  135 + * 备注
  136 + */
  137 + @ApiModelProperty("备注")
  138 + private String remarks;
  139 +
  140 + /**
  141 + * 审核状态
  142 + */
  143 + @ApiModelProperty("审核状态")
  144 + private String examineStatus;
  145 +
  146 + /**
  147 + * 生产工艺
  148 + */
  149 + @ApiModelProperty("生产工艺")
  150 + private String productionProcess;
  151 +
  152 + /**
  153 + * 办事处
  154 + */
  155 + @ApiModelProperty("办事处")
  156 + private String deptId;
  157 +
  158 + /**
  159 + * 办事处名称(非持久化字段)
  160 + */
  161 + @ApiModelProperty("办事处名称")
  162 + private String deptName;
  163 +
  164 + /**
  165 + * 生产厂
  166 + */
  167 + @ApiModelProperty("生产厂")
  168 + private String workshopId;
  169 +
  170 + /**
  171 + * 生产厂名称(非持久化字段)
  172 + */
  173 + @ApiModelProperty("生产厂名称")
  174 + private String workshopName;
  175 +
  176 + /**
  177 + * 客户资信Id
  178 + */
  179 + @ApiModelProperty("客户资信Id")
  180 + private String customerCreditId;
  181 +
  182 + /**
  183 + * 客户资信等级(非持久化字段)
  184 + */
  185 + @ApiModelProperty("客户资信等级")
  186 + private String customerTier;
  187 +
  188 + /**
  189 + * 总数量
  190 + */
  191 + @ApiModelProperty("总数量")
  192 + private String sumNumber;
  193 +
  194 + /**
  195 + * 变更前规格数据
  196 + */
  197 + @ApiModelProperty("变更前规格数据")
  198 + private List<PurchaseOrderLine> beforeChangeSpecList;
  199 +
  200 + /**
  201 + * 变更后规格数据
  202 + */
  203 + @ApiModelProperty("变更后规格数据")
  204 + private List<PurchaseOrderLine> afterChangeSpecList;
  205 +
  206 +
  207 + public OrderChangeRecordBo() {
  208 +
  209 + }
  210 +
  211 + public OrderChangeRecordBo(OrderInfoChangeRecord dto) {
  212 + super(dto);
  213 + }
  214 +
  215 + @Override
  216 + public BaseBo<OrderInfoChangeRecord> convert(OrderInfoChangeRecord dto) {
  217 + return super.convert(dto);
  218 + }
  219 +
  220 + @Override
  221 + protected void afterInit(OrderInfoChangeRecord dto) {
  222 +
  223 + }
  224 +}
1 -package com.lframework.xingyun.sc.bo.order.change;  
2 -  
3 -import com.fasterxml.jackson.annotation.JsonFormat;  
4 -import com.lframework.xingyun.sc.entity.OrderSpecificationChangeRecord;  
5 -import com.lframework.starter.common.constants.StringPool;  
6 -import com.lframework.starter.web.core.bo.BaseBo;  
7 -import java.time.LocalDate;  
8 -import java.time.LocalDateTime;  
9 -import java.util.List;  
10 -  
11 -import com.lframework.xingyun.sc.entity.PurchaseOrderLine;  
12 -import io.swagger.annotations.ApiModelProperty;  
13 -  
14 -import lombok.Data;  
15 -  
16 -/**  
17 - * <p>  
18 - * 订货单规格变更记录 Bo  
19 - * </p>  
20 - *  
21 - */  
22 -@Data  
23 -public class OrderSpecificationChangeRecordBo extends BaseBo<OrderSpecificationChangeRecord> {  
24 -  
25 - /**  
26 - * ID  
27 - */  
28 - @ApiModelProperty("ID")  
29 - private String id;  
30 -  
31 - /**  
32 - * 订货单ID  
33 - */  
34 - @ApiModelProperty("订货单ID")  
35 - private String orderId;  
36 -  
37 - /**  
38 - * 订货单位名称  
39 - */  
40 - @ApiModelProperty("订货单位名称")  
41 - private String orderingUnitName;  
42 -  
43 - /**  
44 - * 订货单编号  
45 - */  
46 - @ApiModelProperty("订货单编号")  
47 - private String orderNo;  
48 -  
49 - /**  
50 - * 订货日期  
51 - */  
52 - @ApiModelProperty("订货日期")  
53 - private LocalDate orderDate;  
54 -  
55 - /**  
56 - * 订货数量  
57 - */  
58 - @ApiModelProperty("订货数量")  
59 - private Double orderQuantity;  
60 -  
61 - /**  
62 - * 交货日期  
63 - */  
64 - @ApiModelProperty("交货日期")  
65 - @JsonFormat(pattern = StringPool.DATE_PATTERN)  
66 - private LocalDate deliveryDate;  
67 -  
68 - /**  
69 - * 状态  
70 - */  
71 - @ApiModelProperty("状态")  
72 - private String status;  
73 -  
74 - /**  
75 - * 创建人ID  
76 - */  
77 - @ApiModelProperty("创建人ID")  
78 - private String createById;  
79 -  
80 - /**  
81 - * 创建人  
82 - */  
83 - @ApiModelProperty("创建人")  
84 - private String createBy;  
85 -  
86 - /**  
87 - * 更新人ID  
88 - */  
89 - @ApiModelProperty("更新人ID")  
90 - private String updateById;  
91 -  
92 - /**  
93 - * 更新人  
94 - */  
95 - @ApiModelProperty("更新人")  
96 - private String updateBy;  
97 -  
98 - /**  
99 - * 创建时间  
100 - */  
101 - @ApiModelProperty("创建时间")  
102 - @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)  
103 - private LocalDateTime createTime;  
104 -  
105 - /**  
106 - * 更新时间  
107 - */  
108 - @ApiModelProperty("更新时间")  
109 - @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)  
110 - private LocalDateTime updateTime;  
111 -  
112 - /**  
113 - * 变更前规格数据  
114 - */  
115 - @ApiModelProperty("变更前规格数据")  
116 - private List<PurchaseOrderLine> beforeChangeSpecList;  
117 -  
118 - /**  
119 - * 变更后规格数据  
120 - */  
121 - @ApiModelProperty("变更后规格数据")  
122 - private List<PurchaseOrderLine> afterChangeSpecList;  
123 -  
124 -  
125 - public OrderSpecificationChangeRecordBo() {  
126 -  
127 - }  
128 -  
129 - public OrderSpecificationChangeRecordBo(OrderSpecificationChangeRecord dto) {  
130 - super(dto);  
131 - }  
132 -  
133 - @Override  
134 - public BaseBo<OrderSpecificationChangeRecord> convert(OrderSpecificationChangeRecord dto) {  
135 - return super.convert(dto);  
136 - }  
137 -  
138 - @Override  
139 - protected void afterInit(OrderSpecificationChangeRecord dto) {  
140 -  
141 - }  
142 -}  
xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/order/OrderChangeRecordController.java renamed from xingyun-sc/src/main/java/com/lframework/xingyun/sc/controller/order/OrderSpecificationChangeRecordController.java
@@ -4,16 +4,16 @@ import cn.hutool.core.io.resource.ClassPathResource; @@ -4,16 +4,16 @@ import cn.hutool.core.io.resource.ClassPathResource;
4 import com.lframework.starter.web.core.annotations.security.HasPermission; 4 import com.lframework.starter.web.core.annotations.security.HasPermission;
5 import com.lframework.starter.web.core.controller.DefaultBaseController; 5 import com.lframework.starter.web.core.controller.DefaultBaseController;
6 import com.lframework.starter.web.core.utils.JsonUtil; 6 import com.lframework.starter.web.core.utils.JsonUtil;
7 -import com.lframework.xingyun.sc.bo.order.change.OrderSpecificationChangeRecordBo; 7 +import com.lframework.xingyun.sc.bo.order.change.OrderChangeRecordBo;
  8 +import com.lframework.xingyun.sc.entity.OrderInfoChangeRecord;
8 import com.lframework.xingyun.sc.entity.PurchaseOrderLine; 9 import com.lframework.xingyun.sc.entity.PurchaseOrderLine;
9 import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus; 10 import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus;
10 import com.lframework.xingyun.sc.utils.ExcelUtil; 11 import com.lframework.xingyun.sc.utils.ExcelUtil;
11 import com.lframework.xingyun.sc.utils.ResponseUtil; 12 import com.lframework.xingyun.sc.utils.ResponseUtil;
12 -import com.lframework.xingyun.sc.vo.order.change.QueryOrderSpecificationChangeRecordVo;  
13 -import com.lframework.xingyun.sc.service.order.OrderSpecificationChangeRecordService;  
14 -import com.lframework.xingyun.sc.vo.order.change.CreateOrderSpecificationChangeRecordVo;  
15 -import com.lframework.xingyun.sc.vo.order.change.UpdateOrderSpecificationChangeRecordVo;  
16 -import com.lframework.xingyun.sc.entity.OrderSpecificationChangeRecord; 13 +import com.lframework.xingyun.sc.service.order.OrderChangeRecordService;
  14 +import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo;
  15 +import com.lframework.xingyun.sc.vo.order.change.CreateOrderChangeRecordVo;
  16 +import com.lframework.xingyun.sc.vo.order.change.UpdateOrderChangeRecordVo;
17 import com.lframework.starter.web.core.utils.PageResultUtil; 17 import com.lframework.starter.web.core.utils.PageResultUtil;
18 import com.lframework.starter.web.core.components.resp.PageResult; 18 import com.lframework.starter.web.core.components.resp.PageResult;
19 import com.lframework.starter.web.core.components.resp.InvokeResult; 19 import com.lframework.starter.web.core.components.resp.InvokeResult;
@@ -46,18 +46,18 @@ import java.util.Map; @@ -46,18 +46,18 @@ import java.util.Map;
46 import java.util.stream.Collectors; 46 import java.util.stream.Collectors;
47 47
48 /** 48 /**
49 - * 订货单规格变更记录 Controller 49 + * 订货单变更记录 Controller
50 * 50 *
51 */ 51 */
52 -@Api(tags = "订货单规格变更记录") 52 +@Api(tags = "订货单变更记录")
53 @Validated 53 @Validated
54 @Slf4j 54 @Slf4j
55 @RestController 55 @RestController
56 @RequestMapping("/order/change") 56 @RequestMapping("/order/change")
57 -public class OrderSpecificationChangeRecordController extends DefaultBaseController { 57 +public class OrderChangeRecordController extends DefaultBaseController {
58 58
59 @Resource 59 @Resource
60 - private OrderSpecificationChangeRecordService orderSpecificationChangeRecordService; 60 + private OrderChangeRecordService orderChangeRecordService;
61 61
62 /** 62 /**
63 * 查询列表 63 * 查询列表
@@ -65,12 +65,12 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl @@ -65,12 +65,12 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl
65 @ApiOperation("查询列表") 65 @ApiOperation("查询列表")
66 @HasPermission({"order:change:query"}) 66 @HasPermission({"order:change:query"})
67 @GetMapping("/query") 67 @GetMapping("/query")
68 - public InvokeResult<PageResult<OrderSpecificationChangeRecordBo>> query(@Valid QueryOrderSpecificationChangeRecordVo vo) {  
69 - PageResult<OrderSpecificationChangeRecord> pageResult = orderSpecificationChangeRecordService.query(getPageIndex(vo), getPageSize(vo), vo);  
70 - List<OrderSpecificationChangeRecord> dataList = pageResult.getDatas();  
71 - List<OrderSpecificationChangeRecordBo> results = null; 68 + public InvokeResult<PageResult<OrderChangeRecordBo>> query(@Valid QueryPurchaseOrderInfoVo vo) {
  69 + PageResult<OrderInfoChangeRecord> pageResult = orderChangeRecordService.query(getPageIndex(vo), getPageSize(vo), vo);
  70 + List<OrderInfoChangeRecord> dataList = pageResult.getDatas();
  71 + List<OrderChangeRecordBo> results = null;
72 if (!CollectionUtil.isEmpty(dataList)) { 72 if (!CollectionUtil.isEmpty(dataList)) {
73 - results = dataList.stream().map(OrderSpecificationChangeRecordBo::new).collect(Collectors.toList()); 73 + results = dataList.stream().map(OrderChangeRecordBo::new).collect(Collectors.toList());
74 } 74 }
75 return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results)); 75 return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
76 } 76 }
@@ -82,12 +82,12 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl @@ -82,12 +82,12 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl
82 @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true) 82 @ApiImplicitParam(value = "id", name = "id", paramType = "query", required = true)
83 @HasPermission({"order:change:query"}) 83 @HasPermission({"order:change:query"})
84 @GetMapping 84 @GetMapping
85 - public InvokeResult<OrderSpecificationChangeRecordBo> get(@NotBlank(message = "id不能为空!") String id) {  
86 - OrderSpecificationChangeRecord data = orderSpecificationChangeRecordService.findById(id); 85 + public InvokeResult<OrderChangeRecordBo> get(@NotBlank(message = "id不能为空!") String id) {
  86 + OrderInfoChangeRecord data = orderChangeRecordService.findById(id);
87 if (data == null) { 87 if (data == null) {
88 - throw new DefaultClientException("订货单规格变更记录不存在!"); 88 + throw new DefaultClientException("订货单变更记录不存在!");
89 } 89 }
90 - OrderSpecificationChangeRecordBo result = new OrderSpecificationChangeRecordBo(data); 90 + OrderChangeRecordBo result = new OrderChangeRecordBo(data);
91 91
92 return InvokeResultBuilder.success(result); 92 return InvokeResultBuilder.success(result);
93 } 93 }
@@ -98,8 +98,8 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl @@ -98,8 +98,8 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl
98 @ApiOperation("新增") 98 @ApiOperation("新增")
99 @HasPermission({"order:change:add"}) 99 @HasPermission({"order:change:add"})
100 @PostMapping 100 @PostMapping
101 - public InvokeResult<Void> create(@Valid @RequestBody CreateOrderSpecificationChangeRecordVo vo) {  
102 - orderSpecificationChangeRecordService.create(vo); 101 + public InvokeResult<Void> create(@Valid @RequestBody CreateOrderChangeRecordVo vo) {
  102 + orderChangeRecordService.create(vo);
103 return InvokeResultBuilder.success(); 103 return InvokeResultBuilder.success();
104 } 104 }
105 105
@@ -109,8 +109,8 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl @@ -109,8 +109,8 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl
109 @ApiOperation("修改") 109 @ApiOperation("修改")
110 @HasPermission({"order:change:modify"}) 110 @HasPermission({"order:change:modify"})
111 @PutMapping 111 @PutMapping
112 - public InvokeResult<Void> update(@Valid @RequestBody UpdateOrderSpecificationChangeRecordVo vo) {  
113 - orderSpecificationChangeRecordService.update(vo); 112 + public InvokeResult<Void> update(@Valid @RequestBody UpdateOrderChangeRecordVo vo) {
  113 + orderChangeRecordService.update(vo);
114 return InvokeResultBuilder.success(); 114 return InvokeResultBuilder.success();
115 } 115 }
116 116
@@ -122,7 +122,7 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl @@ -122,7 +122,7 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl
122 @HasPermission({"order:change:delete"}) 122 @HasPermission({"order:change:delete"})
123 @DeleteMapping 123 @DeleteMapping
124 public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) { 124 public InvokeResult<Void> deleteById(@NotBlank(message = "id不能为空!") String id) {
125 - orderSpecificationChangeRecordService.deleteById(id); 125 + orderChangeRecordService.deleteById(id);
126 return InvokeResultBuilder.success(); 126 return InvokeResultBuilder.success();
127 } 127 }
128 128
@@ -134,7 +134,7 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl @@ -134,7 +134,7 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl
134 @HasPermission({"order:change:cancel"}) 134 @HasPermission({"order:change:cancel"})
135 @GetMapping("/cancel") 135 @GetMapping("/cancel")
136 public InvokeResult<Void> cancelById(@NotBlank(message = "id不能为空!") String id) { 136 public InvokeResult<Void> cancelById(@NotBlank(message = "id不能为空!") String id) {
137 - orderSpecificationChangeRecordService.updateStatus(id, OrderSpecChangeStatus.CANCEL.getCode()); 137 + orderChangeRecordService.updateStatus(id, OrderSpecChangeStatus.CANCEL.getCode());
138 return InvokeResultBuilder.success(); 138 return InvokeResultBuilder.success();
139 } 139 }
140 140
@@ -146,13 +146,16 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl @@ -146,13 +146,16 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl
146 @ApiOperation("规格变更打印") 146 @ApiOperation("规格变更打印")
147 @GetMapping("/printOrderSpecChangeRecord") 147 @GetMapping("/printOrderSpecChangeRecord")
148 public void printOrderSpecChangeRecord(@NotBlank(message = "id不能为空") String id, HttpServletResponse response) { 148 public void printOrderSpecChangeRecord(@NotBlank(message = "id不能为空") String id, HttpServletResponse response) {
149 - OrderSpecificationChangeRecord data = orderSpecificationChangeRecordService.findById(id); 149 + OrderInfoChangeRecord data = orderChangeRecordService.findById(id);
  150 + if (data == null) {
  151 + throw new DefaultClientException("规格变更记录不存在!");
  152 + }
150 // 加载模板文件 153 // 加载模板文件
151 ClassPathResource templateResource = new ClassPathResource("templates/orderSpecChangeTemplate.xlsx"); 154 ClassPathResource templateResource = new ClassPathResource("templates/orderSpecChangeTemplate.xlsx");
152 try (InputStream inputStream = templateResource.getStream(); 155 try (InputStream inputStream = templateResource.getStream();
153 Workbook workbook = new XSSFWorkbook(inputStream)) { 156 Workbook workbook = new XSSFWorkbook(inputStream)) {
154 // 设置响应头 157 // 设置响应头
155 - ResponseUtil.setResponseHead(response, data.getOrderNo() + "-订货单规格变更记录.xlsx"); 158 + ResponseUtil.setResponseHead(response, data.getOrderNo() + "-订货单变更记录.xlsx");
156 159
157 Sheet sheet = workbook.getSheetAt(0); 160 Sheet sheet = workbook.getSheetAt(0);
158 // 规格变更开始行 161 // 规格变更开始行
@@ -192,9 +195,7 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl @@ -192,9 +195,7 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl
192 } 195 }
193 Map<String, Object> dataMap = JsonUtil.parseMap(JsonUtil.toJsonString(data), String.class, Object.class); 196 Map<String, Object> dataMap = JsonUtil.parseMap(JsonUtil.toJsonString(data), String.class, Object.class);
194 dataMap.put("orderDate", data.getOrderDate() == null ? "" : data.getOrderDate().format(dateFormatter)); 197 dataMap.put("orderDate", data.getOrderDate() == null ? "" : data.getOrderDate().format(dateFormatter));
195 - dataMap.put("deliveryDate", data.getDeliveryDate() == null ? "" : data.getDeliveryDate().format(dateFormatter));  
196 dataMap.put("createTime", data.getCreateTime().format(dateFormatter)); 198 dataMap.put("createTime", data.getCreateTime().format(dateFormatter));
197 - dataMap.put("description", StringUtils.isBlank(data.getDescription()) ? "" : data.getDescription());  
198 // 供货单位 199 // 供货单位
199 String supplyUnit = data.getSupplyUnit(); 200 String supplyUnit = data.getSupplyUnit();
200 if (StringUtils.isNotBlank(supplyUnit)) { 201 if (StringUtils.isNotBlank(supplyUnit)) {
@@ -204,19 +205,18 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl @@ -204,19 +205,18 @@ public class OrderSpecificationChangeRecordController extends DefaultBaseControl
204 dataMap.put("supplyUnit", "安徽楚江科技新材料股份有限公司"); 205 dataMap.put("supplyUnit", "安徽楚江科技新材料股份有限公司");
205 } 206 }
206 } 207 }
207 -  
208 ExcelUtil.processTemplate(workbook, dataMap); 208 ExcelUtil.processTemplate(workbook, dataMap);
209 // 写入响应流 209 // 写入响应流
210 workbook.write(response.getOutputStream()); 210 workbook.write(response.getOutputStream());
211 response.getOutputStream().flush(); 211 response.getOutputStream().flush();
212 } catch (FileNotFoundException e) { 212 } catch (FileNotFoundException e) {
213 - log.error("订货单规格变更模版打印失败: ", e); 213 + log.error("订货单变更模版打印失败: ", e);
214 throw new DefaultClientException("模板文件不存在: templates/orderSpecChangeTemplate.xlsx"); 214 throw new DefaultClientException("模板文件不存在: templates/orderSpecChangeTemplate.xlsx");
215 } catch (IOException e) { 215 } catch (IOException e) {
216 - log.error("订货单规格变更模版打印失败: ", e); 216 + log.error("订货单变更模版打印失败: ", e);
217 throw new DefaultClientException("无法读取模板文件: templates/orderSpecChangeTemplate.xlsx"); 217 throw new DefaultClientException("无法读取模板文件: templates/orderSpecChangeTemplate.xlsx");
218 } catch (Exception e) { 218 } catch (Exception e) {
219 - log.error("订货单规格变更模版打印失败: ", e); 219 + log.error("订货单变更模版打印失败: ", e);
220 throw new DefaultClientException(e.getMessage()); 220 throw new DefaultClientException(e.getMessage());
221 } 221 }
222 } 222 }
  1 +package com.lframework.xingyun.sc.entity;
  2 +
  3 +import com.baomidou.mybatisplus.annotation.FieldFill;
  4 +import com.baomidou.mybatisplus.annotation.TableField;
  5 +import com.baomidou.mybatisplus.annotation.TableName;
  6 +import com.lframework.starter.web.core.dto.BaseDto;
  7 +import com.lframework.starter.web.core.entity.BaseEntity;
  8 +import lombok.Data;
  9 +
  10 +import java.time.LocalDate;
  11 +import java.time.LocalDateTime;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * <p>
  16 + * 订货单变更记录表
  17 + * </p>
  18 + *
  19 + */
  20 +@Data
  21 +@TableName("order_info_change_record")
  22 +public class OrderInfoChangeRecord extends BaseEntity implements BaseDto {
  23 +
  24 +
  25 + private static final long serialVersionUID = 1L;
  26 +
  27 +
  28 + /**
  29 + * ID
  30 + */
  31 + private String id;
  32 +
  33 + /**
  34 + * 订单编号
  35 + */
  36 + private String orderNo;
  37 +
  38 + /**
  39 + * 供货单位:安徽楚江高精铜带有限公司(GJ)、安徽楚江科技新材料股份有限公司(XC)
  40 + */
  41 + private String supplyUnit;
  42 +
  43 + /**
  44 + * 订货单位ID
  45 + */
  46 + private String orderingUnit;
  47 +
  48 + /**
  49 + * 订货单位名称(非持久化字段)
  50 + */
  51 + @TableField(exist = false)
  52 + private String orderingUnitName;
  53 +
  54 + /**
  55 + * 订货日期
  56 + */
  57 + private LocalDate orderDate;
  58 +
  59 + /**
  60 + * 结算方式或期限
  61 + */
  62 + private String settlementTerms;
  63 +
  64 + /**
  65 + * 交货方式
  66 + */
  67 + private String deliveryMethod;
  68 +
  69 + /**
  70 + * 价格表编号
  71 + */
  72 + private String priceListNo;
  73 +
  74 + /**
  75 + * 执行标准
  76 + */
  77 + private String executionStandard;
  78 +
  79 + /**
  80 + * 开票情况
  81 + */
  82 + private String invoicingStatus;
  83 +
  84 + /**
  85 + * 运费
  86 + */
  87 + private String shippingCost;
  88 +
  89 + /**
  90 + * 件重条头
  91 + */
  92 + private String pieceWeightHeader;
  93 +
  94 + /**
  95 + * 表面
  96 + */
  97 + private String surface;
  98 +
  99 + /**
  100 + * 公差
  101 + */
  102 + private String tolerance;
  103 +
  104 + /**
  105 + * 性能
  106 + */
  107 + private String performance;
  108 +
  109 + /**
  110 + * 元素
  111 + */
  112 + private String element;
  113 +
  114 + /**
  115 + * 包装
  116 + */
  117 + private String packaging;
  118 +
  119 + /**
  120 + * 备注
  121 + */
  122 + private String remarks;
  123 +
  124 + /**
  125 + * 审核状态
  126 + */
  127 + private String examineStatus;
  128 +
  129 + /**
  130 + * 生产工艺
  131 + */
  132 + private String productionProcess;
  133 +
  134 + /**
  135 + * 办事处
  136 + */
  137 + private String deptId;
  138 +
  139 + /**
  140 + * 办事处名称(非持久化字段)
  141 + */
  142 + @TableField(exist = false)
  143 + private String deptName;
  144 +
  145 + /**
  146 + * 生产厂
  147 + */
  148 + private String workshopId;
  149 +
  150 + /**
  151 + * 生产厂名称(非持久化字段)
  152 + */
  153 + @TableField(exist = false)
  154 + private String workshopName;
  155 +
  156 + /**
  157 + * 客户资信Id
  158 + */
  159 + private String customerCreditId;
  160 +
  161 + /**
  162 + * 客户资信等级(非持久化字段)
  163 + */
  164 + @TableField(exist = false)
  165 + private String customerTier;
  166 +
  167 + /**
  168 + * 订货单ID
  169 + */
  170 + private String orderId;
  171 +
  172 + /**
  173 + * 是否已产出
  174 + */
  175 + private Boolean output;
  176 +
  177 + /**
  178 + * 变更前规格数据
  179 + * 非持久化字段
  180 + */
  181 + @TableField(exist = false)
  182 + private List<PurchaseOrderLine> beforeChangeSpecList;
  183 +
  184 + /**
  185 + * 变更后规格数据
  186 + * 非持久化字段
  187 + */
  188 + @TableField(exist = false)
  189 + private List<PurchaseOrderLine> afterChangeSpecList;
  190 +
  191 + /**
  192 + * 创建人ID
  193 + */
  194 + @TableField(fill = FieldFill.INSERT)
  195 + private String createById;
  196 +
  197 + /**
  198 + * 创建人
  199 + */
  200 + @TableField(fill = FieldFill.INSERT)
  201 + private String createBy;
  202 +
  203 + /**
  204 + * 更新人ID
  205 + */
  206 + @TableField(fill = FieldFill.INSERT_UPDATE)
  207 + private String updateById;
  208 +
  209 + /**
  210 + * 更新人
  211 + */
  212 + @TableField(fill = FieldFill.INSERT_UPDATE)
  213 + private String updateBy;
  214 +
  215 + /**
  216 + * 创建时间
  217 + */
  218 + @TableField(fill = FieldFill.INSERT)
  219 + private LocalDateTime createTime;
  220 +
  221 + /**
  222 + * 更新时间
  223 + */
  224 + @TableField(fill = FieldFill.INSERT_UPDATE)
  225 + private LocalDateTime updateTime;
  226 +
  227 +}
@@ -35,11 +35,6 @@ public class PurchaseOrderLine extends BaseEntity implements BaseDto { @@ -35,11 +35,6 @@ public class PurchaseOrderLine extends BaseEntity implements BaseDto {
35 private String purchaseOrderId; 35 private String purchaseOrderId;
36 36
37 /** 37 /**
38 - * 规格变更记录ID  
39 - */  
40 - private String changeId;  
41 -  
42 - /**  
43 * 行业 38 * 行业
44 */ 39 */
45 private String industry; 40 private String industry;
@@ -64,7 +64,7 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -64,7 +64,7 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
64 @Resource 64 @Resource
65 private PurchaseOrderRevokeLineService purchaseOrderRevokeLineService; 65 private PurchaseOrderRevokeLineService purchaseOrderRevokeLineService;
66 @Resource 66 @Resource
67 - private OrderSpecificationChangeRecordService orderSpecificationChangeRecordService; 67 + private OrderChangeRecordService orderChangeRecordService;
68 @Resource 68 @Resource
69 private MqProducerService mqProducerService; 69 private MqProducerService mqProducerService;
70 @Resource 70 @Resource
@@ -348,7 +348,7 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -348,7 +348,7 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
348 } 348 }
349 349
350 /** 350 /**
351 - * 处理订货单规格变更相关数据 351 + * 处理订货单变更相关数据
352 * 352 *
353 * @param flowStatus 审核结果 353 * @param flowStatus 审核结果
354 * @param businessId 业务ID 354 * @param businessId 业务ID
@@ -356,15 +356,15 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -356,15 +356,15 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
356 private void handleOrderSpecChangeData(String flowStatus, String businessId, Boolean output, boolean notice) { 356 private void handleOrderSpecChangeData(String flowStatus, String businessId, Boolean output, boolean notice) {
357 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) 357 if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus)
358 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { 358 || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) {
359 - orderSpecificationChangeRecordService.reviewPass(businessId); 359 + orderChangeRecordService.reviewPass(businessId);
360 } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) 360 } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus)
361 || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus)) { 361 || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus)) {
362 - orderSpecificationChangeRecordService.reviewRefuse(businessId, output); 362 + orderChangeRecordService.reviewRefuse(businessId, output);
363 if (notice) { 363 if (notice) {
364 // todo 消息通知 364 // todo 消息通知
365 } 365 }
366 } else if (FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) { 366 } else if (FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) {
367 - orderSpecificationChangeRecordService.updateStatus(businessId, "REFUSE"); 367 + orderChangeRecordService.updateStatus(businessId, "REFUSE");
368 } 368 }
369 } 369 }
370 } 370 }
  1 +package com.lframework.xingyun.sc.handlers;
  2 +
  3 +import com.lframework.starter.web.core.utils.JsonUtil;
  4 +import com.lframework.starter.web.inner.mappers.system.SysUserRoleMapper;
  5 +import com.lframework.starter.web.inner.service.system.SysUserDeptService;
  6 +import com.lframework.xingyun.basedata.service.workshop.WorkshopService;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import javax.annotation.Resource;
  11 +import java.util.List;
  12 +
  13 +@Component
  14 +@Slf4j
  15 +public class MessageHandler {
  16 +
  17 + @Resource
  18 + private SysUserDeptService userDeptService;
  19 + @Resource
  20 + private SysUserRoleMapper sysUserRoleMapper;
  21 + @Resource
  22 + private WorkshopService workshopService;
  23 +
  24 +
  25 + /**
  26 + * 根据角色code获取办理人
  27 + *
  28 + * @param roleCode 角色编号
  29 + * @param userId 业务数据创建人/更新人ID
  30 + * @return List<String>
  31 + */
  32 + public List<String> sendMsg(String userId, List<String> roleCode) {
  33 + log.info("================== MessageHandler sendMsg invoke start, userId:{}, roleCode:{}", userId, JsonUtil.toJsonString(roleCode));
  34 +
  35 + return null;
  36 + }
  37 +}
1 package com.lframework.xingyun.sc.impl.customer; 1 package com.lframework.xingyun.sc.impl.customer;
2 2
  3 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
3 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 4 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
4 import com.baomidou.mybatisplus.core.toolkit.Wrappers; 5 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
5 import com.fasterxml.jackson.core.JsonProcessingException; 6 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -1346,6 +1347,26 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM @@ -1346,6 +1347,26 @@ public class CustomerCreditServiceImpl extends BaseMpServiceImpl<CustomerCreditM
1346 return fileName; 1347 return fileName;
1347 } 1348 }
1348 1349
  1350 + /**
  1351 + * 根据客户ID获取有效的客户资信数据
  1352 + *
  1353 + * @param customerId 客户ID
  1354 + */
  1355 + @Override
  1356 + public CustomerCredit getByCustomerId(String customerId) {
  1357 + if (StringUtils.isEmpty(customerId)) {
  1358 + return null;
  1359 + }
  1360 + LambdaQueryWrapper<CustomerCredit> queryWrapper = Wrappers.lambdaQuery(CustomerCredit.class);
  1361 + queryWrapper.eq(CustomerCredit::getCompanyId, customerId)
  1362 + .ne(CustomerCredit::getStatus, "CANCEL")
  1363 + .orderByDesc(CustomerCredit::getCreateTime)
  1364 + .last("LIMIT 1");;
  1365 +
  1366 + return getOne(queryWrapper);
  1367 + }
  1368 +
  1369 +
1349 public void rebuildDocx(String templatePathInClasspath, String processedXml, String outputPath) throws IOException { 1370 public void rebuildDocx(String templatePathInClasspath, String processedXml, String outputPath) throws IOException {
1350 // 1. 确保输出目录存在 1371 // 1. 确保输出目录存在
1351 Path output = Paths.get(outputPath); 1372 Path output = Paths.get(outputPath);
  1 +package com.lframework.xingyun.sc.impl.order;
  2 +
  3 +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  4 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
  5 +import com.github.pagehelper.PageInfo;
  6 +import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
  7 +import com.lframework.starter.common.utils.StringUtil;
  8 +import com.lframework.starter.web.core.components.redis.RedisHandler;
  9 +import com.lframework.starter.web.core.utils.*;
  10 +import com.lframework.starter.web.inner.service.system.SysUserService;
  11 +import com.lframework.xingyun.basedata.service.customer.CustomerService;
  12 +import com.lframework.xingyun.sc.entity.CustomerCredit;
  13 +import com.lframework.xingyun.sc.entity.OrderInfoChangeRecord;
  14 +import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
  15 +import com.lframework.starter.web.core.components.resp.PageResult;
  16 +import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  17 +import com.lframework.starter.common.utils.ObjectUtil;
  18 +import com.lframework.starter.web.core.annotations.oplog.OpLog;
  19 +import com.lframework.starter.common.utils.Assert;
  20 +import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  21 +import com.lframework.xingyun.sc.entity.PurchaseOrderLine;
  22 +import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus;
  23 +import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
  24 +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
  25 +import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
  26 +import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo;
  27 +import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo;
  28 +import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderLineVo;
  29 +import com.lframework.xingyun.sc.vo.order.change.*;
  30 +import org.apache.commons.lang3.BooleanUtils;
  31 +import org.apache.commons.lang3.StringUtils;
  32 +import org.springframework.transaction.annotation.Transactional;
  33 +import com.lframework.xingyun.sc.mappers.OrderChangeRecordMapper;
  34 +import com.lframework.xingyun.sc.service.order.OrderChangeRecordService;
  35 +import org.springframework.stereotype.Service;
  36 +
  37 +import javax.annotation.Resource;
  38 +import java.util.*;
  39 +import java.util.stream.Collectors;
  40 +
  41 +@Service
  42 +public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeRecordMapper, OrderInfoChangeRecord> implements OrderChangeRecordService {
  43 +
  44 +
  45 + private static final String BPM_FLAG = "SPEC_CHANGE_SUBMIT";
  46 +
  47 +
  48 + @Resource
  49 + private PurchaseOrderLineService purchaseOrderLineService;
  50 + @Resource
  51 + private SysUserService sysUserService;
  52 + @Resource
  53 + private PurchaseOrderInfoService purchaseOrderInfoService;
  54 + @Resource
  55 + private FlowInstanceWrapperService flowInstanceWrapperService;
  56 + @Resource
  57 + private CustomerService customerService;
  58 + @Resource
  59 + private CustomerCreditService customerCreditService;
  60 + @Resource
  61 + private RedisHandler redisHandler;
  62 +
  63 +
  64 + @Override
  65 + public PageResult<OrderInfoChangeRecord> query(Integer pageIndex, Integer pageSize, QueryPurchaseOrderInfoVo vo) {
  66 + Assert.greaterThanZero(pageIndex);
  67 + Assert.greaterThanZero(pageSize);
  68 +
  69 + PageHelperUtil.startPage(pageIndex, pageSize);
  70 + List<OrderInfoChangeRecord> dataList = this.query(vo);
  71 +
  72 + return PageResultUtil.convert(new PageInfo<>(dataList));
  73 + }
  74 +
  75 + @Override
  76 + public List<OrderInfoChangeRecord> query(QueryPurchaseOrderInfoVo vo) {
  77 + return getBaseMapper().query(vo);
  78 + }
  79 +
  80 + @Override
  81 + public OrderInfoChangeRecord findById(String id) {
  82 + OrderInfoChangeRecord changeRecord = getBaseMapper().selectById(id);
  83 + if (changeRecord == null) {
  84 + throw new DefaultClientException("订货单变更记录不存在!");
  85 + }
  86 + // 获取规格数据
  87 + // 变更前
  88 + String redisKey = changeRecord.getOrderId() + "_order_line_info";
  89 + long size = redisHandler.lGetListSize(redisKey);
  90 + List<Object> objectList = redisHandler.lGet(redisKey, 0, size);
  91 + List<PurchaseOrderLine> beforeChangeList = objectList.stream()
  92 + .filter(PurchaseOrderLine.class::isInstance)
  93 + .map(PurchaseOrderLine.class::cast)
  94 + .collect(Collectors.toList());
  95 + changeRecord.setBeforeChangeSpecList(beforeChangeList);
  96 + // 变更后
  97 + List<PurchaseOrderLine> afterChangeList = purchaseOrderLineService.listByOrderIds(Collections.singletonList(id));
  98 + changeRecord.setAfterChangeSpecList(afterChangeList);
  99 +
  100 + return changeRecord;
  101 + }
  102 +
  103 + @OpLog(type = OtherOpLogType.class, name = "新增订货单变更记录,ID:{}", params = {"#id"})
  104 + @Transactional(rollbackFor = Exception.class)
  105 + @Override
  106 + public String create(CreateOrderChangeRecordVo vo) {
  107 + OrderInfoChangeRecord data = new OrderInfoChangeRecord();
  108 + data.setId(IdUtil.getId());
  109 + data.setOrderId(vo.getOrderId());
  110 + data.setExamineStatus("AUDIT");
  111 + if (!StringUtil.isBlank(vo.getOrderNo())) {
  112 + data.setOrderNo(vo.getOrderNo());
  113 + }
  114 + if (!StringUtil.isBlank(vo.getSupplyUnit())) {
  115 + data.setSupplyUnit(vo.getSupplyUnit());
  116 + }
  117 + if (!StringUtil.isBlank(vo.getOrderingUnit())) {
  118 + data.setOrderingUnit(vo.getOrderingUnit());
  119 + //根据客户id查出客户资信,资信状态不为取消
  120 + CustomerCredit credit = customerCreditService.getByCustomerId(vo.getOrderingUnit());
  121 + if (credit != null) {
  122 + data.setCustomerCreditId(credit.getId());
  123 + }
  124 + }
  125 + if (vo.getOrderDate() != null) {
  126 + data.setOrderDate(vo.getOrderDate());
  127 + }
  128 + if (!StringUtil.isBlank(vo.getSettlementTerms())) {
  129 + data.setSettlementTerms(vo.getSettlementTerms());
  130 + }
  131 + if (!StringUtil.isBlank(vo.getDeliveryMethod())) {
  132 + data.setDeliveryMethod(vo.getDeliveryMethod());
  133 + }
  134 + if (!StringUtil.isBlank(vo.getPriceListNo())) {
  135 + data.setPriceListNo(vo.getPriceListNo());
  136 + }
  137 + if (!StringUtil.isBlank(vo.getExecutionStandard())) {
  138 + data.setExecutionStandard(vo.getExecutionStandard());
  139 + }
  140 + if (!StringUtil.isBlank(vo.getInvoicingStatus())) {
  141 + data.setInvoicingStatus(vo.getInvoicingStatus());
  142 + }
  143 + if (!StringUtil.isBlank(vo.getShippingCost())) {
  144 + data.setShippingCost(vo.getShippingCost());
  145 + }
  146 + if (!StringUtil.isBlank(vo.getPieceWeightHeader())) {
  147 + data.setPieceWeightHeader(vo.getPieceWeightHeader());
  148 + }
  149 + if (!StringUtil.isBlank(vo.getSurface())) {
  150 + data.setSurface(vo.getSurface());
  151 + }
  152 + if (!StringUtil.isBlank(vo.getTolerance())) {
  153 + data.setTolerance(vo.getTolerance());
  154 + }
  155 + if (!StringUtil.isBlank(vo.getPerformance())) {
  156 + data.setPerformance(vo.getPerformance());
  157 + }
  158 + if (!StringUtil.isBlank(vo.getElement())) {
  159 + data.setElement(vo.getElement());
  160 + }
  161 + if (!StringUtil.isBlank(vo.getPackaging())) {
  162 + data.setPackaging(vo.getPackaging());
  163 + }
  164 + if (!StringUtil.isBlank(vo.getRemarks())) {
  165 + data.setRemarks(vo.getRemarks());
  166 + }
  167 + if (!StringUtil.isBlank(vo.getProductionProcess())) {
  168 + data.setProductionProcess(vo.getProductionProcess());
  169 + }
  170 + if (!StringUtil.isBlank(vo.getDeptId())) {
  171 + data.setDeptId(vo.getDeptId());
  172 + }
  173 + if (!StringUtil.isBlank(vo.getWorkshopId())) {
  174 + data.setWorkshopId(vo.getWorkshopId());
  175 + }
  176 + getBaseMapper().insert(data);
  177 + // 处理订货单订货单物料行
  178 + List<CreatePurchaseOrderLineVo> orderLineVoList = vo.getOrderSpecList();
  179 + for (CreatePurchaseOrderLineVo orderLineVo : orderLineVoList) {
  180 + orderLineVo.setPurchaseOrderId(data.getId());
  181 + purchaseOrderLineService.create(orderLineVo);
  182 + }
  183 + // 缓存订货单物料行数据
  184 + String redisKey = vo.getOrderId() + "_order_line_info";
  185 + redisHandler.set(redisKey, JsonUtil.toJsonString(orderLineVoList));
  186 + // 更新订货单变更状态
  187 + purchaseOrderInfoService.updateSpecChangeStatus(vo.getOrderId(), OrderSpecChangeStatus.IN_PROGRESS.getCode());
  188 + // 发起流程
  189 + flowInstanceWrapperService.startInstance("SPEC_CHANGE_SUBMIT", data.getId(), BPM_FLAG, data);
  190 +
  191 + OpLogUtil.setVariable("id", data.getId());
  192 + OpLogUtil.setExtra(vo);
  193 +
  194 + return data.getId();
  195 + }
  196 +
  197 + @OpLog(type = OtherOpLogType.class, name = "修改订货单变更记录,ID:{}", params = {"#id"})
  198 + @Transactional(rollbackFor = Exception.class)
  199 + @Override
  200 + public void update(UpdateOrderChangeRecordVo vo) {
  201 + OrderInfoChangeRecord data = getBaseMapper().selectById(vo.getId());
  202 + if (ObjectUtil.isNull(data)) {
  203 + throw new DefaultClientException("订货单变更记录不存在!");
  204 + }
  205 + LambdaUpdateWrapper<OrderInfoChangeRecord> updateWrapper = Wrappers.lambdaUpdate(OrderInfoChangeRecord.class)
  206 + .set(OrderInfoChangeRecord::getOrderNo, StringUtil.isBlank(vo.getOrderNo()) ? null : vo.getOrderNo())
  207 + .set(OrderInfoChangeRecord::getSupplyUnit, StringUtil.isBlank(vo.getSupplyUnit()) ? null : vo.getSupplyUnit())
  208 + .set(OrderInfoChangeRecord::getOrderingUnit, StringUtil.isBlank(vo.getOrderingUnit()) ? null : vo.getOrderingUnit())
  209 + .set(OrderInfoChangeRecord::getOrderDate, vo.getOrderDate() == null ? null : vo.getOrderDate())
  210 + .set(OrderInfoChangeRecord::getSettlementTerms, StringUtil.isBlank(vo.getSettlementTerms()) ? null : vo.getSettlementTerms())
  211 + .set(OrderInfoChangeRecord::getDeliveryMethod, StringUtil.isBlank(vo.getDeliveryMethod()) ? null : vo.getDeliveryMethod())
  212 + .set(OrderInfoChangeRecord::getPriceListNo, StringUtil.isBlank(vo.getPriceListNo()) ? null : vo.getPriceListNo())
  213 + .set(OrderInfoChangeRecord::getExecutionStandard, StringUtil.isBlank(vo.getExecutionStandard()) ? null : vo.getExecutionStandard())
  214 + .set(OrderInfoChangeRecord::getInvoicingStatus, StringUtil.isBlank(vo.getInvoicingStatus()) ? null : vo.getInvoicingStatus())
  215 + .set(OrderInfoChangeRecord::getShippingCost, StringUtil.isBlank(vo.getShippingCost()) ? null : vo.getShippingCost())
  216 + .set(OrderInfoChangeRecord::getPieceWeightHeader, StringUtil.isBlank(vo.getPieceWeightHeader()) ? null : vo.getPieceWeightHeader())
  217 + .set(OrderInfoChangeRecord::getSurface, StringUtil.isBlank(vo.getSurface()) ? null : vo.getSurface())
  218 + .set(OrderInfoChangeRecord::getTolerance, StringUtil.isBlank(vo.getTolerance()) ? null : vo.getTolerance())
  219 + .set(OrderInfoChangeRecord::getPerformance, StringUtil.isBlank(vo.getPerformance()) ? null : vo.getPerformance())
  220 + .set(OrderInfoChangeRecord::getElement, StringUtil.isBlank(vo.getElement()) ? null : vo.getElement())
  221 + .set(OrderInfoChangeRecord::getPackaging, StringUtil.isBlank(vo.getPackaging()) ? null : vo.getPackaging())
  222 + .set(OrderInfoChangeRecord::getRemarks, StringUtil.isBlank(vo.getRemarks()) ? null : vo.getRemarks())
  223 + .set(OrderInfoChangeRecord::getExamineStatus, "AUDIT")
  224 + .set(OrderInfoChangeRecord::getProductionProcess, StringUtil.isBlank(vo.getProductionProcess()) ? null : vo.getProductionProcess())
  225 + .set(OrderInfoChangeRecord::getDeptId, StringUtil.isBlank(vo.getDeptId()) ? null : vo.getDeptId())
  226 + .set(OrderInfoChangeRecord::getWorkshopId, StringUtil.isBlank(vo.getWorkshopId()) ? null : vo.getWorkshopId())
  227 + .set(OrderInfoChangeRecord::getCustomerCreditId, StringUtil.isBlank(vo.getCustomerCreditId()) ? null : vo.getCustomerCreditId())
  228 + .eq(OrderInfoChangeRecord::getId, vo.getId());
  229 + getBaseMapper().update(updateWrapper);
  230 + // 更新订货单物料行
  231 + List<UpdatePurchaseOrderLineVo> lineVoList = vo.getOrderSpecList();
  232 + for (UpdatePurchaseOrderLineVo updatePurchaseOrderLineVo : lineVoList) {
  233 + purchaseOrderLineService.update(updatePurchaseOrderLineVo);
  234 + }
  235 + // 更新订货单物料行缓存数据
  236 + redisHandler.set(vo.getOrderId() + "_order_line_info", JsonUtil.toJsonString(lineVoList));
  237 + // 重新发起流程
  238 + Boolean output = data.getOutput();
  239 + if (BooleanUtils.isTrue(output)) {
  240 + flowInstanceWrapperService.startInstance("SPEC_CHANGE_CONFIRM", vo.getId(), BPM_FLAG, data);
  241 + } else {
  242 + flowInstanceWrapperService.startInstance("SPEC_CHANGE_SUBMIT", vo.getId(), BPM_FLAG, data);
  243 + }
  244 +
  245 + OpLogUtil.setVariable("id", data.getId());
  246 + OpLogUtil.setExtra(vo);
  247 + }
  248 +
  249 + @OpLog(type = OtherOpLogType.class, name = "删除订货单变更记录,ID:{}", params = {"#id"})
  250 + @Transactional(rollbackFor = Exception.class)
  251 + @Override
  252 + public void deleteById(String id) {
  253 + getBaseMapper().deleteById(id);
  254 + }
  255 +
  256 + /**
  257 + * 更新状态
  258 + *
  259 + * @param id 主键ID
  260 + * @param status 状态
  261 + */
  262 + @Override
  263 + public void updateStatus(String id, String status) {
  264 + if (StringUtils.isBlank(id) || StringUtils.isBlank(status)) {
  265 + return;
  266 + }
  267 + OrderInfoChangeRecord record = getById(id);
  268 + if (record == null) {
  269 + throw new DefaultClientException("规格变更记录不存在!");
  270 + }
  271 + LambdaUpdateWrapper<OrderInfoChangeRecord> updateWrapper = Wrappers.lambdaUpdate(OrderInfoChangeRecord.class);
  272 + updateWrapper.set(OrderInfoChangeRecord::getExamineStatus, status)
  273 + .eq(OrderInfoChangeRecord::getId, id);
  274 + getBaseMapper().update(updateWrapper);
  275 + if (OrderSpecChangeStatus.CANCEL.getCode().equals(status)
  276 + || OrderSpecChangeStatus.COMPLETED.getCode().equals(status)) {
  277 + // 更新订货单变更状态
  278 + purchaseOrderInfoService.updateSpecChangeStatus(record.getOrderId(), status);
  279 + }
  280 + }
  281 +
  282 + @Override
  283 + public void reviewPass(String id) {
  284 + if (StringUtils.isBlank(id)) {
  285 + return;
  286 + }
  287 + OrderInfoChangeRecord record = findById(id);
  288 + if (record == null) {
  289 + throw new DefaultClientException("规格变更记录不存在!");
  290 + }
  291 + // 更新状态
  292 + updateStatus(id, "PASS");
  293 + // 更新订货单数据
  294 + purchaseOrderLineService.updateByChangeId(id, record.getOrderId());
  295 + }
  296 +
  297 + @Override
  298 + public void reviewRefuse(String id, Boolean output) {
  299 + if (StringUtils.isBlank(id)) {
  300 + return;
  301 + }
  302 + OrderInfoChangeRecord record = findById(id);
  303 + if (record == null) {
  304 + throw new DefaultClientException("规格变更记录不存在!");
  305 + }
  306 + // 更新状态
  307 + LambdaUpdateWrapper<OrderInfoChangeRecord> updateWrapper = Wrappers.lambdaUpdate(OrderInfoChangeRecord.class);
  308 + updateWrapper.set(OrderInfoChangeRecord::getExamineStatus, "REFUSE")
  309 + .eq(OrderInfoChangeRecord::getId, id);
  310 + if (output != null) {
  311 + updateWrapper.set(OrderInfoChangeRecord::getOutput, output);
  312 + }
  313 + getBaseMapper().update(updateWrapper);
  314 + }
  315 +}
1 -package com.lframework.xingyun.sc.impl.order;  
2 -  
3 -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;  
4 -import com.baomidou.mybatisplus.core.toolkit.Wrappers;  
5 -import com.github.pagehelper.PageInfo;  
6 -import com.lframework.starter.bpm.service.FlowInstanceWrapperService;  
7 -import com.lframework.starter.web.core.components.security.SecurityUtil;  
8 -import com.lframework.starter.web.core.utils.*;  
9 -import com.lframework.starter.web.inner.entity.SysUser;  
10 -import com.lframework.starter.web.inner.service.system.SysUserService;  
11 -import com.lframework.xingyun.basedata.entity.Customer;  
12 -import com.lframework.xingyun.basedata.service.customer.CustomerService;  
13 -import com.lframework.xingyun.sc.entity.OrderSpecificationChangeRecord;  
14 -import com.lframework.starter.web.core.impl.BaseMpServiceImpl;  
15 -import com.lframework.starter.web.core.components.resp.PageResult;  
16 -import com.lframework.starter.common.exceptions.impl.DefaultClientException;  
17 -import com.lframework.starter.common.utils.ObjectUtil;  
18 -import com.lframework.starter.web.core.annotations.oplog.OpLog;  
19 -import com.lframework.starter.common.utils.Assert;  
20 -import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;  
21 -import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;  
22 -import com.lframework.xingyun.sc.entity.PurchaseOrderLine;  
23 -import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus;  
24 -import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;  
25 -import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;  
26 -import com.lframework.xingyun.sc.vo.order.change.*;  
27 -import org.apache.commons.collections4.CollectionUtils;  
28 -import org.apache.commons.lang3.BooleanUtils;  
29 -import org.apache.commons.lang3.StringUtils;  
30 -import org.springframework.transaction.annotation.Transactional;  
31 -import com.lframework.xingyun.sc.mappers.OrderSpecificationChangeRecordMapper;  
32 -import com.lframework.xingyun.sc.service.order.OrderSpecificationChangeRecordService;  
33 -import org.springframework.stereotype.Service;  
34 -  
35 -import javax.annotation.Resource;  
36 -import java.math.BigDecimal;  
37 -import java.util.*;  
38 -  
39 -@Service  
40 -public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl<OrderSpecificationChangeRecordMapper, OrderSpecificationChangeRecord> implements OrderSpecificationChangeRecordService {  
41 -  
42 -  
43 - private static final String BPM_FLAG = "SPEC_CHANGE_SUBMIT";  
44 -  
45 -  
46 - @Resource  
47 - private PurchaseOrderLineService purchaseOrderLineService;  
48 - @Resource  
49 - private SysUserService sysUserService;  
50 - @Resource  
51 - private PurchaseOrderInfoService purchaseOrderInfoService;  
52 - @Resource  
53 - private FlowInstanceWrapperService flowInstanceWrapperService;  
54 - @Resource  
55 - private CustomerService customerService;  
56 -  
57 -  
58 - @Override  
59 - public PageResult<OrderSpecificationChangeRecord> query(Integer pageIndex, Integer pageSize, QueryOrderSpecificationChangeRecordVo vo) {  
60 - Assert.greaterThanZero(pageIndex);  
61 - Assert.greaterThanZero(pageSize);  
62 -  
63 - PageHelperUtil.startPage(pageIndex, pageSize);  
64 - List<OrderSpecificationChangeRecord> dataList = this.query(vo);  
65 -  
66 - return PageResultUtil.convert(new PageInfo<>(dataList));  
67 - }  
68 -  
69 - @Override  
70 - public List<OrderSpecificationChangeRecord> query(QueryOrderSpecificationChangeRecordVo vo) {  
71 - List<OrderSpecificationChangeRecord> changeRecords = getBaseMapper().query(vo);  
72 - if (CollectionUtils.isEmpty(changeRecords)) {  
73 - return Collections.emptyList();  
74 - }  
75 - // 处理规格数据  
76 - List<String> orderIds = new ArrayList<>();  
77 - List<String> changeIds = new ArrayList<>();  
78 - for (OrderSpecificationChangeRecord record : changeRecords) {  
79 - String orderId = record.getOrderId();  
80 - String id = record.getId();  
81 - if (!orderIds.contains(orderId)) {  
82 - orderIds.add(orderId);  
83 - }  
84 - if (!changeIds.contains(id)) {  
85 - changeIds.add(id);  
86 - }  
87 - }  
88 - // 变更前  
89 - Map<String, List<PurchaseOrderLine>> beforeChangeMap = new HashMap<>(orderIds.size());  
90 - List<PurchaseOrderLine> beforeChangeList = purchaseOrderLineService.listByOrderIds(orderIds);  
91 - for (PurchaseOrderLine purchaseOrderLine : beforeChangeList) {  
92 - String purchaseOrderId = purchaseOrderLine.getPurchaseOrderId();  
93 - List<PurchaseOrderLine> list = beforeChangeMap.computeIfAbsent(purchaseOrderId, k -> new ArrayList<>());  
94 - list.add(purchaseOrderLine);  
95 - }  
96 - // 变更后  
97 - Map<String, List<PurchaseOrderLine>> afterChangeMap = new HashMap<>(orderIds.size());  
98 - List<PurchaseOrderLine> afterChangeList = purchaseOrderLineService.listByChangeIds(changeIds);  
99 - for (PurchaseOrderLine purchaseOrderLine : afterChangeList) {  
100 - String changeId = purchaseOrderLine.getChangeId();  
101 - List<PurchaseOrderLine> list = afterChangeMap.computeIfAbsent(changeId, k -> new ArrayList<>());  
102 - list.add(purchaseOrderLine);  
103 - }  
104 - for (OrderSpecificationChangeRecord record : changeRecords) {  
105 - String orderId = record.getOrderId();  
106 - String id = record.getId();  
107 -  
108 - record.setBeforeChangeSpecList(beforeChangeMap.get(orderId));  
109 - record.setAfterChangeSpecList(afterChangeMap.get(id));  
110 - }  
111 - return changeRecords;  
112 - }  
113 -  
114 - @Override  
115 - public OrderSpecificationChangeRecord findById(String id) {  
116 - OrderSpecificationChangeRecord changeRecord = getBaseMapper().selectById(id);  
117 - if (changeRecord == null) {  
118 - throw new DefaultClientException("订货单规格变更记录不存在!");  
119 - }  
120 - // 获取订货单相关数据  
121 - PurchaseOrderInfo orderInfo = purchaseOrderInfoService.findById(changeRecord.getOrderId());  
122 - if (orderInfo != null) {  
123 - changeRecord.setOrderNo(orderInfo.getOrderNo());  
124 - changeRecord.setOrderDate(orderInfo.getOrderDate());  
125 - changeRecord.setSupplyUnit(orderInfo.getSupplyUnit());  
126 - // 订货公司数据  
127 - Customer customer = customerService.findById(orderInfo.getOrderingUnit());  
128 - changeRecord.setOrderingUnitName(customer.getName());  
129 - }  
130 - // 获取规格数据  
131 - // 变更前  
132 - List<PurchaseOrderLine> beforeChangeList = purchaseOrderLineService.listByOrderIds(Collections.singletonList(changeRecord.getOrderId()));  
133 - changeRecord.setBeforeChangeSpecList(beforeChangeList);  
134 - // 变更后  
135 - List<PurchaseOrderLine> afterChangeList = purchaseOrderLineService.listByChangeIds(Collections.singletonList(id));  
136 - changeRecord.setAfterChangeSpecList(afterChangeList);  
137 -  
138 - return changeRecord;  
139 - }  
140 -  
141 - @OpLog(type = OtherOpLogType.class, name = "新增订货单规格变更记录,ID:{}", params = {"#id"})  
142 - @Transactional(rollbackFor = Exception.class)  
143 - @Override  
144 - public String create(CreateOrderSpecificationChangeRecordVo vo) {  
145 - OrderSpecificationChangeRecord data = new OrderSpecificationChangeRecord();  
146 - String id = IdUtil.getId();  
147 - data.setId(id);  
148 - data.setOrderId(vo.getOrderId());  
149 - data.setOrderQuantity(vo.getOrderQuantity());  
150 - data.setDeliveryDate(vo.getDeliveryDate());  
151 - // 审核中  
152 - data.setStatus("AUDIT");  
153 -  
154 - // 获取当前人员信息  
155 - String userId = SecurityUtil.getCurrentUser().getId();  
156 - SysUser user = sysUserService.findById(userId);  
157 - // 处理规格数据  
158 - BigDecimal totalQuantity = new BigDecimal(0);  
159 - List<PurchaseOrderLine> orderLineList = new ArrayList<>();  
160 - List<CreateOrderSpecificationInfoVo> orderSpecList = vo.getOrderSpecList();  
161 - for (int i = 0; i < orderSpecList.size(); i++) {  
162 - CreateOrderSpecificationInfoVo createSpecVo = orderSpecList.get(i);  
163 - PurchaseOrderLine orderLine = JsonUtil.parseObject(JsonUtil.toJsonString(createSpecVo), PurchaseOrderLine.class);  
164 - orderLine.setId(IdUtil.getId());  
165 - orderLine.setChangeId(id);  
166 - orderLine.setCreateById(userId);  
167 - orderLine.setCreateBy(user.getName());  
168 - orderLine.setUpdateById(userId);  
169 - orderLine.setUpdateBy(user.getName());  
170 - if (orderLine.getShowOrder() == null) {  
171 - orderLine.setShowOrder(i + 1);  
172 - }  
173 - totalQuantity = totalQuantity.add(orderLine.getQuantity());  
174 -  
175 - orderLineList.add(orderLine);  
176 - }  
177 - if (data.getOrderQuantity() == null) {  
178 - data.setOrderQuantity(totalQuantity.doubleValue());  
179 - }  
180 - getBaseMapper().insert(data);  
181 - purchaseOrderLineService.batchAdd(orderLineList);  
182 - // 更新订货单规格变更状态  
183 - purchaseOrderInfoService.updateSpecChangeStatus(vo.getOrderId(), OrderSpecChangeStatus.IN_PROGRESS.getCode());  
184 - // 发起流程  
185 - flowInstanceWrapperService.startInstance("SPEC_CHANGE_SUBMIT", id, BPM_FLAG, data);  
186 -  
187 - OpLogUtil.setVariable("id", data.getId());  
188 - OpLogUtil.setExtra(vo);  
189 -  
190 - return data.getId();  
191 - }  
192 -  
193 - @OpLog(type = OtherOpLogType.class, name = "修改订货单规格变更记录,ID:{}", params = {"#id"})  
194 - @Transactional(rollbackFor = Exception.class)  
195 - @Override  
196 - public void update(UpdateOrderSpecificationChangeRecordVo vo) {  
197 - OrderSpecificationChangeRecord data = getBaseMapper().selectById(vo.getId());  
198 - if (ObjectUtil.isNull(data)) {  
199 - throw new DefaultClientException("订货单规格变更记录不存在!");  
200 - }  
201 - LambdaUpdateWrapper<OrderSpecificationChangeRecord> updateWrapper = Wrappers.lambdaUpdate(OrderSpecificationChangeRecord.class)  
202 - .set(OrderSpecificationChangeRecord::getOrderId, vo.getOrderId())  
203 - .set(OrderSpecificationChangeRecord::getOrderQuantity, vo.getOrderQuantity())  
204 - .set(OrderSpecificationChangeRecord::getDeliveryDate, vo.getDeliveryDate())  
205 - .set(OrderSpecificationChangeRecord::getStatus, "AUDIT")  
206 - .eq(OrderSpecificationChangeRecord::getId, vo.getId());  
207 - // 获取当前人员信息  
208 - String userId = SecurityUtil.getCurrentUser().getId();  
209 - SysUser user = sysUserService.findById(userId);  
210 - // 更新规格数据  
211 - BigDecimal totalQuantity = new BigDecimal(0);  
212 - List<PurchaseOrderLine> orderLineList = new ArrayList<>();  
213 - List<UpdateOrderSpecificationInfoVo> orderSpecList = vo.getOrderSpecList();  
214 - for (UpdateOrderSpecificationInfoVo updateSpecVo : orderSpecList) {  
215 - PurchaseOrderLine orderLine = JsonUtil.parseObject(JsonUtil.toJsonString(updateSpecVo), PurchaseOrderLine.class);  
216 - orderLine.setUpdateById(userId);  
217 - orderLine.setUpdateBy(user.getName());  
218 - totalQuantity = totalQuantity.add(orderLine.getQuantity());  
219 -  
220 - orderLineList.add(orderLine);  
221 - }  
222 - if (vo.getOrderQuantity() == null) {  
223 - updateWrapper.set(OrderSpecificationChangeRecord::getOrderQuantity, totalQuantity.doubleValue());  
224 - } else {  
225 - updateWrapper.set(OrderSpecificationChangeRecord::getOrderQuantity, vo.getOrderQuantity());  
226 - }  
227 - getBaseMapper().update(updateWrapper);  
228 - purchaseOrderLineService.batchUpdate(orderLineList);  
229 - // 重新发起流程  
230 - JsonUtil.parseObject(JsonUtil.toJsonString(data), PurchaseOrderLine.class);  
231 - Boolean output = data.getOutput();  
232 - if (BooleanUtils.isTrue(output)) {  
233 - flowInstanceWrapperService.startInstance("SPEC_CHANGE_CONFIRM", vo.getId(), BPM_FLAG, data);  
234 - } else {  
235 - flowInstanceWrapperService.startInstance("SPEC_CHANGE_SUBMIT", vo.getId(), BPM_FLAG, data);  
236 - }  
237 -  
238 - OpLogUtil.setVariable("id", data.getId());  
239 - OpLogUtil.setExtra(vo);  
240 - }  
241 -  
242 - @OpLog(type = OtherOpLogType.class, name = "删除订货单规格变更记录,ID:{}", params = {"#id"})  
243 - @Transactional(rollbackFor = Exception.class)  
244 - @Override  
245 - public void deleteById(String id) {  
246 - getBaseMapper().deleteById(id);  
247 - }  
248 -  
249 - /**  
250 - * 更新状态  
251 - *  
252 - * @param id 主键ID  
253 - * @param status 状态  
254 - */  
255 - @Override  
256 - public void updateStatus(String id, String status) {  
257 - if (StringUtils.isBlank(id) || StringUtils.isBlank(status)) {  
258 - return;  
259 - }  
260 - OrderSpecificationChangeRecord record = getById(id);  
261 - if (record == null) {  
262 - throw new DefaultClientException("规格变更记录不存在!");  
263 - }  
264 - LambdaUpdateWrapper<OrderSpecificationChangeRecord> updateWrapper = Wrappers.lambdaUpdate(OrderSpecificationChangeRecord.class);  
265 - updateWrapper.set(OrderSpecificationChangeRecord::getStatus, status)  
266 - .eq(OrderSpecificationChangeRecord::getId, id);  
267 - getBaseMapper().update(updateWrapper);  
268 - if (OrderSpecChangeStatus.CANCEL.getCode().equals(status)  
269 - || OrderSpecChangeStatus.COMPLETED.getCode().equals(status)) {  
270 - // 更新订货单规格变更状态  
271 - purchaseOrderInfoService.updateSpecChangeStatus(record.getOrderId(), status);  
272 - }  
273 - }  
274 -  
275 - @Override  
276 - public void reviewPass(String id) {  
277 - if (StringUtils.isBlank(id)) {  
278 - return;  
279 - }  
280 - OrderSpecificationChangeRecord record = findById(id);  
281 - if (record == null) {  
282 - throw new DefaultClientException("规格变更记录不存在!");  
283 - }  
284 - // 更新状态  
285 - updateStatus(id, "PASS");  
286 - // 更新订货单规格数据  
287 - purchaseOrderLineService.updateByChangeId(id, record.getOrderId());  
288 - }  
289 -  
290 - @Override  
291 - public void reviewRefuse(String id, Boolean output) {  
292 - if (StringUtils.isBlank(id)) {  
293 - return;  
294 - }  
295 - OrderSpecificationChangeRecord record = findById(id);  
296 - if (record == null) {  
297 - throw new DefaultClientException("规格变更记录不存在!");  
298 - }  
299 - // 更新状态  
300 - LambdaUpdateWrapper<OrderSpecificationChangeRecord> updateWrapper = Wrappers.lambdaUpdate(OrderSpecificationChangeRecord.class);  
301 - updateWrapper.set(OrderSpecificationChangeRecord::getStatus, "REFUSE")  
302 - .eq(OrderSpecificationChangeRecord::getId, id);  
303 - if (output != null) {  
304 - updateWrapper.set(OrderSpecificationChangeRecord::getOutput, output);  
305 - }  
306 - getBaseMapper().update(updateWrapper);  
307 - }  
308 -}  
@@ -197,18 +197,6 @@ public class PurchaseOrderLineServiceImpl extends BaseMpServiceImpl<PurchaseOrde @@ -197,18 +197,6 @@ public class PurchaseOrderLineServiceImpl extends BaseMpServiceImpl<PurchaseOrde
197 } 197 }
198 198
199 @Override 199 @Override
200 - public List<PurchaseOrderLine> listByChangeIds(List<String> changeIds) {  
201 - if (CollectionUtil.isEmpty(changeIds)) {  
202 - return Collections.emptyList();  
203 - }  
204 - LambdaQueryWrapper<PurchaseOrderLine> queryWrapper = Wrappers.lambdaQuery(PurchaseOrderLine.class);  
205 - queryWrapper.in(PurchaseOrderLine::getChangeId, changeIds)  
206 - .orderByAsc(PurchaseOrderLine::getShowOrder);  
207 -  
208 - return getBaseMapper().selectList(queryWrapper);  
209 - }  
210 -  
211 - @Override  
212 public List<PurchaseOrderLine> listByOrderIds(List<String> orderIds) { 200 public List<PurchaseOrderLine> listByOrderIds(List<String> orderIds) {
213 if (CollectionUtils.isEmpty(orderIds)) { 201 if (CollectionUtils.isEmpty(orderIds)) {
214 return Collections.emptyList(); 202 return Collections.emptyList();
@@ -256,7 +244,7 @@ public class PurchaseOrderLineServiceImpl extends BaseMpServiceImpl<PurchaseOrde @@ -256,7 +244,7 @@ public class PurchaseOrderLineServiceImpl extends BaseMpServiceImpl<PurchaseOrde
256 if (StringUtil.isBlank(changeId)) { 244 if (StringUtil.isBlank(changeId)) {
257 return; 245 return;
258 } 246 }
259 - // todo 更新订货单规格数据 247 + // todo 更新订货单数据
260 } 248 }
261 249
262 @Override 250 @Override
xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/OrderChangeRecordMapper.java renamed from xingyun-sc/src/main/java/com/lframework/xingyun/sc/mappers/OrderSpecificationChangeRecordMapper.java
1 package com.lframework.xingyun.sc.mappers; 1 package com.lframework.xingyun.sc.mappers;
2 2
3 -import com.lframework.xingyun.sc.entity.OrderSpecificationChangeRecord; 3 +import com.lframework.xingyun.sc.entity.OrderInfoChangeRecord;
4 import com.lframework.starter.web.core.mapper.BaseMapper; 4 import com.lframework.starter.web.core.mapper.BaseMapper;
5 -import com.lframework.xingyun.sc.vo.order.change.QueryOrderSpecificationChangeRecordVo; 5 +import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo;
6 import org.apache.ibatis.annotations.Param; 6 import org.apache.ibatis.annotations.Param;
7 7
8 import java.util.List; 8 import java.util.List;
9 9
10 /** 10 /**
11 * <p> 11 * <p>
12 - * 订货单规格变更记录 Mapper 接口 12 + * 订货单变更记录 Mapper 接口
13 * </p> 13 * </p>
14 * 14 *
15 */ 15 */
16 -public interface OrderSpecificationChangeRecordMapper extends BaseMapper<OrderSpecificationChangeRecord> { 16 +public interface OrderChangeRecordMapper extends BaseMapper<OrderInfoChangeRecord> {
17 17
18 /** 18 /**
19 * 查询列表 19 * 查询列表
@@ -21,5 +21,5 @@ public interface OrderSpecificationChangeRecordMapper extends BaseMapper<OrderSp @@ -21,5 +21,5 @@ public interface OrderSpecificationChangeRecordMapper extends BaseMapper<OrderSp
21 * @param vo 查询条件 21 * @param vo 查询条件
22 * @return List<OrderSpecificationChangeRecord> 22 * @return List<OrderSpecificationChangeRecord>
23 */ 23 */
24 - List<OrderSpecificationChangeRecord> query(@Param("vo") QueryOrderSpecificationChangeRecordVo vo); 24 + List<OrderInfoChangeRecord> query(@Param("vo") QueryPurchaseOrderInfoVo vo);
25 } 25 }
@@ -116,4 +116,10 @@ public interface CustomerCreditService extends BaseMpService<CustomerCredit> { @@ -116,4 +116,10 @@ public interface CustomerCreditService extends BaseMpService<CustomerCredit> {
116 */ 116 */
117 String export(String id) throws IOException, TemplateException; 117 String export(String id) throws IOException, TemplateException;
118 118
  119 + /**
  120 + * 根据客户ID获取有效的客户资信数据
  121 + *
  122 + * @param customerId 客户ID
  123 + */
  124 + CustomerCredit getByCustomerId(String customerId);
119 } 125 }
xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/order/OrderChangeRecordService.java renamed from xingyun-sc/src/main/java/com/lframework/xingyun/sc/service/order/OrderSpecificationChangeRecordService.java
1 package com.lframework.xingyun.sc.service.order; 1 package com.lframework.xingyun.sc.service.order;
2 2
3 -import com.lframework.xingyun.sc.vo.order.change.CreateOrderSpecificationChangeRecordVo;  
4 -import com.lframework.xingyun.sc.vo.order.change.QueryOrderSpecificationChangeRecordVo;  
5 -import com.lframework.xingyun.sc.vo.order.change.UpdateOrderSpecificationChangeRecordVo;  
6 -import com.lframework.xingyun.sc.entity.OrderSpecificationChangeRecord; 3 +import com.lframework.xingyun.sc.entity.OrderInfoChangeRecord;
  4 +import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo;
  5 +import com.lframework.xingyun.sc.vo.order.change.CreateOrderChangeRecordVo;
  6 +import com.lframework.xingyun.sc.vo.order.change.UpdateOrderChangeRecordVo;
7 import com.lframework.starter.web.core.service.BaseMpService; 7 import com.lframework.starter.web.core.service.BaseMpService;
8 import com.lframework.starter.web.core.components.resp.PageResult; 8 import com.lframework.starter.web.core.components.resp.PageResult;
9 import java.util.List; 9 import java.util.List;
10 10
11 /** 11 /**
12 - * 订货单规格变更记录 Service 12 + * 订货单变更记录 Service
13 */ 13 */
14 -public interface OrderSpecificationChangeRecordService extends BaseMpService<OrderSpecificationChangeRecord> { 14 +public interface OrderChangeRecordService extends BaseMpService<OrderInfoChangeRecord> {
15 15
16 /** 16 /**
17 * 查询列表 17 * 查询列表
18 * 18 *
19 - * @return PageResult<OrderSpecificationChangeRecord> 19 + * @return PageResult<OrderInfoChangeRecord>
20 */ 20 */
21 - PageResult<OrderSpecificationChangeRecord> query(Integer pageIndex, Integer pageSize, QueryOrderSpecificationChangeRecordVo vo); 21 + PageResult<OrderInfoChangeRecord> query(Integer pageIndex, Integer pageSize, QueryPurchaseOrderInfoVo vo);
22 22
23 /** 23 /**
24 * 查询列表 24 * 查询列表
25 * 25 *
26 * @param vo 差查询条件 26 * @param vo 差查询条件
27 - * @return List<OrderSpecificationChangeRecord> 27 + * @return List<OrderInfoChangeRecord>
28 */ 28 */
29 - List<OrderSpecificationChangeRecord> query(QueryOrderSpecificationChangeRecordVo vo); 29 + List<OrderInfoChangeRecord> query(QueryPurchaseOrderInfoVo vo);
30 30
31 /** 31 /**
32 * 根据ID查询 32 * 根据ID查询
33 * 33 *
34 * @param id 主键ID 34 * @param id 主键ID
35 - * @return OrderSpecificationChangeRecord 35 + * @return OrderInfoChangeRecord
36 */ 36 */
37 - OrderSpecificationChangeRecord findById(String id); 37 + OrderInfoChangeRecord findById(String id);
38 38
39 /** 39 /**
40 * 创建 40 * 创建
@@ -42,14 +42,14 @@ public interface OrderSpecificationChangeRecordService extends BaseMpService<Ord @@ -42,14 +42,14 @@ public interface OrderSpecificationChangeRecordService extends BaseMpService<Ord
42 * @param vo 数据实体 42 * @param vo 数据实体
43 * @return String 43 * @return String
44 */ 44 */
45 - String create(CreateOrderSpecificationChangeRecordVo vo); 45 + String create(CreateOrderChangeRecordVo vo);
46 46
47 /** 47 /**
48 * 修改 48 * 修改
49 * 49 *
50 * @param vo 数据实体 50 * @param vo 数据实体
51 */ 51 */
52 - void update(UpdateOrderSpecificationChangeRecordVo vo); 52 + void update(UpdateOrderChangeRecordVo vo);
53 53
54 /** 54 /**
55 * 根据ID删除 55 * 根据ID删除
@@ -63,15 +63,6 @@ public interface PurchaseOrderLineService extends BaseMpService<PurchaseOrderLin @@ -63,15 +63,6 @@ public interface PurchaseOrderLineService extends BaseMpService<PurchaseOrderLin
63 */ 63 */
64 void deleteById(String id); 64 void deleteById(String id);
65 65
66 -  
67 - /**  
68 - * 根据规格变更记录ID查询  
69 - *  
70 - * @param changeIds 变更记录主键ID集合  
71 - * @return List<PurchaseOrderLine>  
72 - */  
73 - List<PurchaseOrderLine> listByChangeIds(List<String> changeIds);  
74 -  
75 /** 66 /**
76 * 根据订货单ID查询 67 * 根据订货单ID查询
77 * 68 *
  1 +package com.lframework.xingyun.sc.vo.order.change;
  2 +
  3 +
  4 +import javax.validation.Valid;
  5 +import java.time.LocalDate;
  6 +import com.lframework.starter.web.core.vo.BaseVo;
  7 +
  8 +import javax.validation.constraints.NotBlank;
  9 +import javax.validation.constraints.NotEmpty;
  10 +import javax.validation.constraints.NotNull;
  11 +
  12 +import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo;
  13 +import io.swagger.annotations.ApiModelProperty;
  14 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  15 +import org.hibernate.validator.constraints.Length;
  16 +import java.io.Serializable;
  17 +import java.util.List;
  18 +
  19 +import lombok.Data;
  20 +
  21 +@Data
  22 +public class CreateOrderChangeRecordVo implements BaseVo, Serializable {
  23 +
  24 + private static final long serialVersionUID = 1L;
  25 +
  26 +
  27 + /**
  28 + * 订货单ID
  29 + */
  30 + @ApiModelProperty(value = "订货单ID", required = true)
  31 + @NotBlank(message = "订货单ID不能为空!")
  32 + private String orderId;
  33 +
  34 + /**
  35 + * 订单编号
  36 + */
  37 + @ApiModelProperty(value = "订单编号", required = true)
  38 + @NotBlank(message = "订单编号不能为空!")
  39 + @Length(message = "订单编号最多允许50个字符!")
  40 + private String orderNo;
  41 +
  42 + /**
  43 + * 供货单位:安徽楚江高精铜带有限公司(GJ)、安徽楚江科技新材料股份有限公司(XC)
  44 + */
  45 + @ApiModelProperty(value = "供货单位", required = true)
  46 + @NotBlank(message = "供货单位不能为空!")
  47 + @Length(message = "供货单位最多允许100个字符!")
  48 + private String supplyUnit;
  49 +
  50 + /**
  51 + * 订货单位ID
  52 + */
  53 + @ApiModelProperty(value = "订货单位ID", required = true)
  54 + @NotBlank(message = "订货单位不能为空!")
  55 + @Length(message = "订货单位ID最多允许100个字符!")
  56 + private String orderingUnit;
  57 +
  58 + /**
  59 + * 订货日期
  60 + */
  61 + @ApiModelProperty(value = "订货日期", required = true)
  62 + @NotNull(message = "订货日期不能为空!")
  63 + @TypeMismatch(message = "订货日期格式有误!")
  64 + private LocalDate orderDate;
  65 +
  66 + /**
  67 + * 结算方式或期限
  68 + */
  69 + @ApiModelProperty("结算方式或期限")
  70 + @Length(message = "结算方式或期限最多允许100个字符!")
  71 + private String settlementTerms;
  72 +
  73 + /**
  74 + * 交货方式
  75 + */
  76 + @ApiModelProperty("交货方式")
  77 + @Length(message = "交货方式最多允许50个字符!")
  78 + private String deliveryMethod;
  79 +
  80 + /**
  81 + * 价格表编号
  82 + */
  83 + @ApiModelProperty("价格表编号")
  84 + @Length(message = "价格表编号最多允许50个字符!")
  85 + private String priceListNo;
  86 +
  87 + /**
  88 + * 执行标准
  89 + */
  90 + @ApiModelProperty("执行标准")
  91 + @Length(message = "执行标准最多允许100个字符!")
  92 + private String executionStandard;
  93 +
  94 + /**
  95 + * 开票情况
  96 + */
  97 + @ApiModelProperty("开票情况")
  98 + @Length(message = "开票情况最多允许50个字符!")
  99 + private String invoicingStatus;
  100 +
  101 + /**
  102 + * 运费
  103 + */
  104 + @ApiModelProperty("运费")
  105 + @Length(message = "运费最多允许20个字符!")
  106 + private String shippingCost;
  107 +
  108 + /**
  109 + * 件重条头
  110 + */
  111 + @ApiModelProperty("件重条头")
  112 + @Length(message = "件重条头最多允许500个字符!")
  113 + private String pieceWeightHeader;
  114 +
  115 + /**
  116 + * 表面
  117 + */
  118 + @ApiModelProperty("表面")
  119 + @Length(message = "表面最多允许500个字符!")
  120 + private String surface;
  121 +
  122 + /**
  123 + * 公差
  124 + */
  125 + @ApiModelProperty("公差")
  126 + @Length(message = "公差最多允许500个字符!")
  127 + private String tolerance;
  128 +
  129 + /**
  130 + * 性能
  131 + */
  132 + @ApiModelProperty("性能")
  133 + @Length(message = "性能最多允许500个字符!")
  134 + private String performance;
  135 +
  136 + /**
  137 + * 成分
  138 + */
  139 + @ApiModelProperty("成分")
  140 + @Length(message = "成分最多允许500个字符!")
  141 + private String element;
  142 +
  143 + /**
  144 + * 包装
  145 + */
  146 + @ApiModelProperty("包装")
  147 + @Length(message = "包装最多允许500个字符!")
  148 + private String packaging;
  149 +
  150 + /**
  151 + * 备注
  152 + */
  153 + @ApiModelProperty("备注")
  154 + @Length(message = "备注最多允许500个字符!")
  155 + private String remarks;
  156 +
  157 + /**
  158 + * 生产工艺
  159 + */
  160 + @ApiModelProperty("生产工艺")
  161 + private String productionProcess;
  162 +
  163 + /**
  164 + * 办事处
  165 + */
  166 + @ApiModelProperty("办事处")
  167 + private String deptId;
  168 +
  169 + /**
  170 + * 生产厂
  171 + */
  172 + @ApiModelProperty("生产厂")
  173 + private String workshopId;
  174 +
  175 + /**
  176 + * 客户资信Id
  177 + */
  178 + @ApiModelProperty("客户资信Id")
  179 + private String customerCreditId;
  180 +
  181 + /**
  182 + * 规格变更记录
  183 + */
  184 + @ApiModelProperty(value = "规格变更记录", required = true)
  185 + @NotEmpty(message = "请输入规格变更记录!")
  186 + List<CreatePurchaseOrderLineVo> orderSpecList;
  187 +}
1 -package com.lframework.xingyun.sc.vo.order.change;  
2 -  
3 -  
4 -import javax.validation.Valid;  
5 -import javax.validation.constraints.NotBlank;  
6 -import java.time.LocalDate;  
7 -import com.lframework.starter.web.core.vo.BaseVo;  
8 -  
9 -import javax.validation.constraints.NotEmpty;  
10 -import javax.validation.constraints.NotNull;  
11 -  
12 -import io.swagger.annotations.ApiModelProperty;  
13 -import com.lframework.starter.web.core.components.validation.TypeMismatch;  
14 -import org.hibernate.validator.constraints.Length;  
15 -import java.io.Serializable;  
16 -import java.util.List;  
17 -  
18 -import lombok.Data;  
19 -  
20 -@Data  
21 -public class CreateOrderSpecificationChangeRecordVo implements BaseVo, Serializable {  
22 -  
23 - private static final long serialVersionUID = 1L;  
24 -  
25 - /**  
26 - * 订货单ID  
27 - */  
28 - @ApiModelProperty(value = "订货单ID", required = true)  
29 - @NotBlank(message = "请输入订货单ID!")  
30 - @Length(message = "订货单ID最多允许32个字符!")  
31 - private String orderId;  
32 -  
33 - /**  
34 - * 订货数量  
35 - */  
36 - @ApiModelProperty(value = "订货数量", required = true)  
37 - @NotNull(message = "请输入订货数量!")  
38 - @TypeMismatch(message = "订货数量格式有误!")  
39 - private Double orderQuantity;  
40 -  
41 - /**  
42 - * 交货日期  
43 - */  
44 - @ApiModelProperty(value = "交货日期", required = true)  
45 - @NotNull(message = "请输入交货日期!")  
46 - @TypeMismatch(message = "交货日期格式有误!")  
47 - private LocalDate deliveryDate;  
48 -  
49 - /**  
50 - * 变更原因及变更后的质量要求  
51 - */  
52 - @ApiModelProperty(value = "变更原因及变更后的质量要求")  
53 - private String description;  
54 -  
55 - /**  
56 - * 规格变更记录  
57 - */  
58 - @Valid  
59 - @ApiModelProperty(value = "规格变更记录", required = true)  
60 - @NotEmpty(message = "请输入规格变更记录!")  
61 - List<CreateOrderSpecificationInfoVo> orderSpecList;  
62 -}  
1 -package com.lframework.xingyun.sc.vo.order.change;  
2 -  
3 -import com.lframework.starter.web.core.components.validation.IsNumberPrecision;  
4 -import com.lframework.starter.web.core.components.validation.TypeMismatch;  
5 -import com.lframework.starter.web.core.vo.BaseVo;  
6 -import io.swagger.annotations.ApiModelProperty;  
7 -import lombok.Data;  
8 -import org.hibernate.validator.constraints.Length;  
9 -  
10 -import java.io.Serializable;  
11 -import java.math.BigDecimal;  
12 -import java.time.LocalDate;  
13 -  
14 -@Data  
15 -public class CreateOrderSpecificationInfoVo implements BaseVo, Serializable {  
16 -  
17 - private static final long serialVersionUID = 1L;  
18 -  
19 - /**  
20 - * 变更记录ID  
21 - */  
22 - @ApiModelProperty(value = "变更记录ID", required = true)  
23 - @Length(message = "变更记录ID最多允许32个字符!")  
24 - private String changeId;  
25 -  
26 - /**  
27 - * 牌号  
28 - */  
29 - @ApiModelProperty("牌号")  
30 - @Length(message = "牌号最多允许100个字符!")  
31 - private String brand;  
32 -  
33 - /**  
34 - * 厚度  
35 - */  
36 - @ApiModelProperty("厚度")  
37 - @TypeMismatch(message = "厚度格式有误!")  
38 - @IsNumberPrecision(message = "厚度最多允许4位小数!", value = 4)  
39 - private BigDecimal thickness;  
40 -  
41 - /**  
42 - * 宽度  
43 - */  
44 - @ApiModelProperty("宽度")  
45 - @TypeMismatch(message = "宽度格式有误!")  
46 - @IsNumberPrecision(message = "宽度最多允许4位小数!", value = 4)  
47 - private BigDecimal width;  
48 -  
49 -  
50 - /**  
51 - * 长度  
52 - */  
53 - @ApiModelProperty("长度")  
54 - @TypeMismatch(message = "长度格式有误!")  
55 - @IsNumberPrecision(message = "长度最多允许4位小数!", value = 4)  
56 - private BigDecimal length;  
57 -  
58 - /**  
59 - * 状态  
60 - */  
61 - @ApiModelProperty("状态")  
62 - @Length(message = "状态最多允许50个字符!")  
63 - private String status;  
64 -  
65 - /**  
66 - * 数量  
67 - */  
68 - @ApiModelProperty("数量")  
69 - @TypeMismatch(message = "数量格式有误!")  
70 - @IsNumberPrecision(message = "数量最多允许4位小数!", value = 4)  
71 - private BigDecimal quantity;  
72 -  
73 - /**  
74 - * 价格  
75 - */  
76 - @ApiModelProperty("价格")  
77 - @TypeMismatch(message = "价格格式有误!")  
78 - private Double salesPrice;  
79 -  
80 - /**  
81 - * 现计划发货日期  
82 - */  
83 - @ApiModelProperty("现计划发货日期")  
84 - @TypeMismatch(message = "现计划发货日期格式有误!")  
85 - private LocalDate deliveryDate;  
86 -  
87 - /**  
88 - * 排序  
89 - */  
90 - @ApiModelProperty("排序")  
91 - @TypeMismatch(message = "排序格式有误!")  
92 - private Integer showOrder;  
93 -}  
1 -package com.lframework.xingyun.sc.vo.order.change;  
2 -  
3 -import lombok.Data;  
4 -import com.lframework.starter.web.core.vo.PageVo;  
5 -import com.lframework.starter.web.core.vo.BaseVo;  
6 -import io.swagger.annotations.ApiModelProperty;  
7 -import java.io.Serializable;  
8 -import java.time.LocalDateTime;  
9 -  
10 -@Data  
11 -public class QueryOrderSpecificationChangeRecordVo extends PageVo implements BaseVo, Serializable {  
12 -  
13 - private static final long serialVersionUID = 1L;  
14 -  
15 - /**  
16 - * 订货单位名称  
17 - */  
18 - @ApiModelProperty("订货单位名称")  
19 - private String orderingUnitName;  
20 -  
21 - /**  
22 - * 订货单编号  
23 - */  
24 - @ApiModelProperty("订货单编号")  
25 - private String orderNo;  
26 -  
27 - /**  
28 - * 制单日期范围  
29 - */  
30 - @ApiModelProperty("制单日期范围")  
31 - private LocalDateTime createStartTime;  
32 - private LocalDateTime createEndTime;  
33 -}  
  1 +package com.lframework.xingyun.sc.vo.order.change;
  2 +
  3 +import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderLineVo;
  4 +import lombok.Data;
  5 +
  6 +import javax.validation.Valid;
  7 +import javax.validation.constraints.NotBlank;
  8 +import java.time.LocalDate;
  9 +import com.lframework.starter.web.core.vo.BaseVo;
  10 +
  11 +import javax.validation.constraints.NotEmpty;
  12 +import javax.validation.constraints.NotNull;
  13 +import com.lframework.starter.web.core.components.validation.TypeMismatch;
  14 +import io.swagger.annotations.ApiModelProperty;
  15 +import org.hibernate.validator.constraints.Length;
  16 +import java.io.Serializable;
  17 +import java.util.List;
  18 +
  19 +@Data
  20 +public class UpdateOrderChangeRecordVo implements BaseVo, Serializable {
  21 +
  22 + private static final long serialVersionUID = 1L;
  23 +
  24 + /**
  25 + * ID
  26 + */
  27 + @ApiModelProperty(value = "ID", required = true)
  28 + @NotBlank(message = "id不能为空!")
  29 + private String id;
  30 +
  31 + /**
  32 + * 订货单ID
  33 + */
  34 + @ApiModelProperty(value = "订货单ID", required = true)
  35 + @NotBlank(message = "订货单ID不能为空!")
  36 + private String orderId;
  37 +
  38 + /**
  39 + * 订单编号
  40 + */
  41 + @ApiModelProperty(value = "订单编号", required = true)
  42 + @NotBlank(message = "订单编号不能为空!")
  43 + @Length(message = "订单编号最多允许50个字符!")
  44 + private String orderNo;
  45 +
  46 + /**
  47 + * 供货单位:安徽楚江高精铜带有限公司(GJ)、安徽楚江科技新材料股份有限公司(XC)
  48 + */
  49 + @ApiModelProperty(value = "供货单位", required = true)
  50 + @NotBlank(message = "供货单位不能为空!")
  51 + @Length(message = "供货单位最多允许100个字符!")
  52 + private String supplyUnit;
  53 +
  54 + /**
  55 + * 订货单位ID
  56 + */
  57 + @ApiModelProperty(value = "订货单位ID", required = true)
  58 + @NotBlank(message = "订货单位不能为空!")
  59 + @Length(message = "订货单位ID最多允许100个字符!")
  60 + private String orderingUnit;
  61 +
  62 + /**
  63 + * 订货日期
  64 + */
  65 + @ApiModelProperty(value = "订货日期", required = true)
  66 + @NotNull(message = "订货日期不能为空!")
  67 + @TypeMismatch(message = "订货日期格式有误!")
  68 + private LocalDate orderDate;
  69 +
  70 + /**
  71 + * 结算方式或期限
  72 + */
  73 + @ApiModelProperty("结算方式或期限")
  74 + @Length(message = "结算方式或期限最多允许100个字符!")
  75 + private String settlementTerms;
  76 +
  77 + /**
  78 + * 交货方式
  79 + */
  80 + @ApiModelProperty("交货方式")
  81 + @Length(message = "交货方式最多允许50个字符!")
  82 + private String deliveryMethod;
  83 +
  84 + /**
  85 + * 价格表编号
  86 + */
  87 + @ApiModelProperty("价格表编号")
  88 + @Length(message = "价格表编号最多允许50个字符!")
  89 + private String priceListNo;
  90 +
  91 + /**
  92 + * 执行标准
  93 + */
  94 + @ApiModelProperty("执行标准")
  95 + @Length(message = "执行标准最多允许100个字符!")
  96 + private String executionStandard;
  97 +
  98 + /**
  99 + * 开票情况
  100 + */
  101 + @ApiModelProperty("开票情况")
  102 + @Length(message = "开票情况最多允许50个字符!")
  103 + private String invoicingStatus;
  104 +
  105 + /**
  106 + * 运费
  107 + */
  108 + @ApiModelProperty("运费")
  109 + @Length(message = "运费最多允许20个字符!")
  110 + private String shippingCost;
  111 +
  112 + /**
  113 + * 件重条头
  114 + */
  115 + @ApiModelProperty("件重条头")
  116 + @Length(message = "件重条头最多允许500个字符!")
  117 + private String pieceWeightHeader;
  118 +
  119 + /**
  120 + * 表面
  121 + */
  122 + @ApiModelProperty("表面")
  123 + @Length(message = "表面最多允许500个字符!")
  124 + private String surface;
  125 +
  126 + /**
  127 + * 公差
  128 + */
  129 + @ApiModelProperty("公差")
  130 + @Length(message = "公差最多允许500个字符!")
  131 + private String tolerance;
  132 +
  133 + /**
  134 + * 性能
  135 + */
  136 + @ApiModelProperty("性能")
  137 + @Length(message = "性能最多允许500个字符!")
  138 + private String performance;
  139 +
  140 + /**
  141 + * 成分
  142 + */
  143 + @ApiModelProperty("成分")
  144 + @Length(message = "成分最多允许500个字符!")
  145 + private String element;
  146 +
  147 + /**
  148 + * 包装
  149 + */
  150 + @ApiModelProperty("包装")
  151 + @Length(message = "包装最多允许500个字符!")
  152 + private String packaging;
  153 +
  154 + /**
  155 + * 备注
  156 + */
  157 + @ApiModelProperty("备注")
  158 + @Length(message = "备注最多允许500个字符!")
  159 + private String remarks;
  160 +
  161 + /**
  162 + * 生产工艺
  163 + */
  164 + @ApiModelProperty("生产工艺")
  165 + @Length(message = "生产工艺最多允许500个字符!")
  166 + private String productionProcess;
  167 +
  168 + /**
  169 + * 办事处
  170 + */
  171 + @ApiModelProperty("办事处")
  172 + private String deptId;
  173 +
  174 + /**
  175 + * 生产厂
  176 + */
  177 + @ApiModelProperty("生产厂")
  178 + private String workshopId;
  179 +
  180 + /**
  181 + * 客户资信Id
  182 + */
  183 + @ApiModelProperty("客户资信Id")
  184 + private String customerCreditId;
  185 +
  186 + /**
  187 + * 规格变更记录
  188 + */
  189 + @Valid
  190 + @ApiModelProperty(value = "规格变更记录", required = true)
  191 + @NotEmpty(message = "请输入规格变更记录!")
  192 + List<UpdatePurchaseOrderLineVo> orderSpecList;
  193 +}
1 -package com.lframework.xingyun.sc.vo.order.change;  
2 -  
3 -import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderLineVo;  
4 -import lombok.Data;  
5 -  
6 -import javax.validation.Valid;  
7 -import javax.validation.constraints.NotBlank;  
8 -import java.time.LocalDate;  
9 -import com.lframework.starter.web.core.vo.BaseVo;  
10 -  
11 -import javax.validation.constraints.NotEmpty;  
12 -import javax.validation.constraints.NotNull;  
13 -import com.lframework.starter.web.core.components.validation.TypeMismatch;  
14 -import io.swagger.annotations.ApiModelProperty;  
15 -import org.hibernate.validator.constraints.Length;  
16 -import java.io.Serializable;  
17 -import java.util.List;  
18 -  
19 -@Data  
20 -public class UpdateOrderSpecificationChangeRecordVo implements BaseVo, Serializable {  
21 -  
22 - private static final long serialVersionUID = 1L;  
23 -  
24 - /**  
25 - * ID  
26 - */  
27 - @ApiModelProperty(value = "ID", required = true)  
28 - @NotBlank(message = "id不能为空!")  
29 - private String id;  
30 -  
31 - /**  
32 - * 订货单ID  
33 - */  
34 - @ApiModelProperty(value = "订货单ID", required = true)  
35 - @NotBlank(message = "请输入订货单ID!")  
36 - @Length(message = "订货单ID最多允许32个字符!")  
37 - private String orderId;  
38 -  
39 - /**  
40 - * 订货数量  
41 - */  
42 - @ApiModelProperty(value = "订货数量", required = true)  
43 - @TypeMismatch(message = "订货数量格式有误!")  
44 - @NotNull(message = "请输入订货数量!")  
45 - private Double orderQuantity;  
46 -  
47 - /**  
48 - * 交货日期  
49 - */  
50 - @ApiModelProperty(value = "交货日期", required = true)  
51 - @TypeMismatch(message = "交货日期格式有误!")  
52 - @NotNull(message = "请输入交货日期!")  
53 - private LocalDate deliveryDate;  
54 -  
55 - /**  
56 - * 变更原因及变更后的质量要求  
57 - */  
58 - @ApiModelProperty(value = "变更原因及变更后的质量要求")  
59 - private String description;  
60 -  
61 - /**  
62 - * 规格变更记录  
63 - */  
64 - @Valid  
65 - @ApiModelProperty(value = "规格变更记录", required = true)  
66 - @NotEmpty(message = "请输入规格变更记录!")  
67 - List<UpdateOrderSpecificationInfoVo> orderSpecList;  
68 -}  
1 -package com.lframework.xingyun.sc.vo.order.change;  
2 -  
3 -import com.lframework.starter.web.core.components.validation.IsNumberPrecision;  
4 -import com.lframework.starter.web.core.components.validation.TypeMismatch;  
5 -import com.lframework.starter.web.core.vo.BaseVo;  
6 -import io.swagger.annotations.ApiModelProperty;  
7 -import lombok.Data;  
8 -import org.hibernate.validator.constraints.Length;  
9 -  
10 -import javax.validation.constraints.NotBlank;  
11 -import java.io.Serializable;  
12 -import java.math.BigDecimal;  
13 -import java.time.LocalDate;  
14 -  
15 -@Data  
16 -public class UpdateOrderSpecificationInfoVo implements BaseVo, Serializable {  
17 -  
18 - private static final long serialVersionUID = 1L;  
19 -  
20 -  
21 - /**  
22 - * ID  
23 - */  
24 - @ApiModelProperty(value = "ID", required = true)  
25 - @NotBlank(message = "id不能为空!")  
26 - private String id;  
27 -  
28 - /**  
29 - * 变更记录ID  
30 - */  
31 - @ApiModelProperty(value = "变更记录ID", required = true)  
32 - @Length(message = "变更记录ID最多允许32个字符!")  
33 - private String changeId;  
34 -  
35 - /**  
36 - * 牌号  
37 - */  
38 - @ApiModelProperty("牌号")  
39 - @Length(message = "牌号最多允许100个字符!")  
40 - private String brand;  
41 -  
42 - /**  
43 - * 厚度  
44 - */  
45 - @ApiModelProperty("厚度")  
46 - @TypeMismatch(message = "厚度格式有误!")  
47 - @IsNumberPrecision(message = "厚度最多允许4位小数!", value = 4)  
48 - private BigDecimal thickness;  
49 -  
50 - /**  
51 - * 宽度  
52 - */  
53 - @ApiModelProperty("宽度")  
54 - @TypeMismatch(message = "宽度格式有误!")  
55 - @IsNumberPrecision(message = "宽度最多允许4位小数!", value = 4)  
56 - private BigDecimal width;  
57 -  
58 -  
59 - /**  
60 - * 长度  
61 - */  
62 - @ApiModelProperty("长度")  
63 - @TypeMismatch(message = "长度格式有误!")  
64 - @IsNumberPrecision(message = "长度最多允许4位小数!", value = 4)  
65 - private BigDecimal length;  
66 -  
67 - /**  
68 - * 状态  
69 - */  
70 - @ApiModelProperty("状态")  
71 - @Length(message = "状态最多允许50个字符!")  
72 - private String status;  
73 -  
74 - /**  
75 - * 数量  
76 - */  
77 - @ApiModelProperty("数量")  
78 - @TypeMismatch(message = "数量格式有误!")  
79 - @IsNumberPrecision(message = "数量最多允许4位小数!", value = 4)  
80 - private BigDecimal quantity;  
81 -  
82 - /**  
83 - * 价格  
84 - */  
85 - @ApiModelProperty("价格")  
86 - @TypeMismatch(message = "价格格式有误!")  
87 - private Double salesPrice;  
88 -  
89 - /**  
90 - * 现计划发货日期  
91 - */  
92 - @ApiModelProperty("现计划发货日期")  
93 - @TypeMismatch(message = "现计划发货日期格式有误!")  
94 - private LocalDate deliveryDate;  
95 -  
96 - /**  
97 - * 排序  
98 - */  
99 - @ApiModelProperty("排序")  
100 - @TypeMismatch(message = "排序格式有误!")  
101 - private Integer showOrder;  
102 -}  
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.lframework.xingyun.sc.mappers.OrderChangeRecordMapper">
  4 +
  5 + <resultMap id="OrderChangeRecord" type="com.lframework.xingyun.sc.entity.OrderInfoChangeRecord">
  6 + <id column="id" property="id"/>
  7 + <result column="order_no" property="orderNo"/>
  8 + <result column="supply_unit" property="supplyUnit"/>
  9 + <result column="ordering_unit" property="orderingUnit"/>
  10 + <result column="ordering_unit_name" property="orderingUnitName"/>
  11 + <result column="order_date" property="orderDate"/>
  12 + <result column="settlement_terms" property="settlementTerms"/>
  13 + <result column="delivery_method" property="deliveryMethod"/>
  14 + <result column="price_list_no" property="priceListNo"/>
  15 + <result column="execution_standard" property="executionStandard"/>
  16 + <result column="invoicing_status" property="invoicingStatus"/>
  17 + <result column="shipping_cost" property="shippingCost"/>
  18 + <result column="piece_weight_header" property="pieceWeightHeader"/>
  19 + <result column="surface" property="surface"/>
  20 + <result column="tolerance" property="tolerance"/>
  21 + <result column="performance" property="performance"/>
  22 + <result column="element" property="element"/>
  23 + <result column="packaging" property="packaging"/>
  24 + <result column="remarks" property="remarks"/>
  25 + <result column="examine_status" property="examineStatus"/>
  26 + <result column="production_process" property="productionProcess"/>
  27 + <result column="dept_id" property="deptId"/>
  28 + <result column="dept_name" property="deptName"/>
  29 + <result column="workshop_id" property="workshopId"/>
  30 + <result column="workshop_name" property="workshopName"/>
  31 + <result column="customer_credit_id" property="customerCreditId"/>
  32 + <result column="customer_tier" property="customerTier"/>
  33 + <result column="create_by_id" property="createById"/>
  34 + <result column="create_by" property="createBy"/>
  35 + <result column="update_by_id" property="updateById"/>
  36 + <result column="update_by" property="updateBy"/>
  37 + <result column="create_time" property="createTime"/>
  38 + <result column="update_time" property="updateTime"/>
  39 + </resultMap>
  40 +
  41 + <sql id="OrderChangeRecord_sql">
  42 + SELECT
  43 + tb.id,
  44 + tb.order_no,
  45 + tb.supply_unit,
  46 + tb.ordering_unit,
  47 + cu.name AS ordering_unit_name,
  48 + tb.order_date,
  49 + tb.settlement_terms,
  50 + tb.delivery_method,
  51 + tb.price_list_no,
  52 + tb.execution_standard,
  53 + tb.invoicing_status,
  54 + tb.shipping_cost,
  55 + tb.piece_weight_header,
  56 + tb.surface,
  57 + tb.tolerance,
  58 + tb.performance,
  59 + tb.element,
  60 + tb.packaging,
  61 + tb.remarks,
  62 + tb.examine_status,
  63 + tb.production_process,
  64 + tb.dept_id,
  65 + sd.name AS dept_name,
  66 + tb.workshop_id,
  67 + ws.name AS workshop_name,
  68 + tb.customer_credit_id,
  69 + cc.company_suggested_category AS customer_tier,
  70 + tb.create_by_id,
  71 + tb.create_by,
  72 + tb.update_by_id,
  73 + tb.update_by,
  74 + tb.create_time,
  75 + tb.update_time
  76 + FROM order_info_change_record AS tb
  77 + left join base_data_customer as cu on cu.id = tb.ordering_unit
  78 + left join sys_dept as sd on sd.id = tb.dept_id
  79 + left join base_data_workshop as ws on ws.id = tb.workshop_id
  80 + left join customer_credit as cc on cc.id = tb.customer_credit_id
  81 + </sql>
  82 +
  83 + <select id="query" resultMap="OrderChangeRecord">
  84 + <include refid="OrderChangeRecord_sql"/>
  85 + <where>
  86 + <if test="vo.orderNo != null and vo.orderNo != ''">
  87 + AND tb.order_no = #{vo.orderNo}
  88 + </if>
  89 + <if test="vo.orderingUnitName != null and vo.orderingUnitName != ''">
  90 + AND cu.name LIKE CONCAT('%', #{vo.orderingUnitName},'%')
  91 + </if>
  92 + <if test="vo.orderDateStart != null">
  93 + AND tb.order_date >= #{vo.orderDateStart}
  94 + </if>
  95 + <if test="vo.orderDateEnd != null">
  96 + <![CDATA[
  97 + AND tb.order_date <= #{vo.orderDateEnd}
  98 + ]]>
  99 + </if>
  100 + <if test="vo.status != null and vo.status != ''">
  101 + AND tb.status = #{vo.status}
  102 + </if>
  103 + <if test="vo.examineStatus != null and vo.examineStatus != ''">
  104 + AND tb.examine_status = #{vo.examineStatus}
  105 + </if>
  106 + <if test="vo.revokeStatus != null and vo.revokeStatus != ''">
  107 + AND tb.revoke_status = #{vo.revokeStatus}
  108 + </if>
  109 + <if test="vo.deptId != null and vo.deptId != ''">
  110 + AND tb.dept_id = #{vo.deptId}
  111 + </if>
  112 + <if test="vo.workshopId != null and vo.workshopId != ''">
  113 + AND tb.workshop_id = #{vo.workshopId}
  114 + </if>
  115 + </where>
  116 + ORDER BY tb.update_time DESC
  117 + </select>
  118 +</mapper>
1 -<?xml version="1.0" encoding="UTF-8"?>  
2 -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">  
3 -<mapper namespace="com.lframework.xingyun.sc.mappers.OrderSpecificationChangeRecordMapper">  
4 -  
5 - <resultMap id="OrderSpecificationChangeRecord" type="com.lframework.xingyun.sc.entity.OrderSpecificationChangeRecord">  
6 - <id column="id" property="id"/>  
7 - <result column="order_id" property="orderId"/>  
8 - <result column="order_no" property="orderNo"/>  
9 - <result column="ordering_unit_name" property="orderingUnitName"/>  
10 - <result column="order_date" property="orderDate"/>  
11 - <result column="order_quantity" property="orderQuantity"/>  
12 - <result column="delivery_date" property="deliveryDate"/>  
13 - <result column="output" property="output"/>  
14 - <result column="status" property="status"/>  
15 - <result column="create_by_id" property="createById"/>  
16 - <result column="create_by" property="createBy"/>  
17 - <result column="update_by_id" property="updateById"/>  
18 - <result column="update_by" property="updateBy"/>  
19 - <result column="create_time" property="createTime"/>  
20 - <result column="update_time" property="updateTime"/>  
21 - </resultMap>  
22 -  
23 - <sql id="OrderSpecificationChangeRecord_sql">  
24 - SELECT  
25 - tb.id,  
26 - tb.order_id,  
27 - o.order_no,  
28 - c.name as ordering_unit_name,  
29 - o.order_date,  
30 - tb.order_quantity,  
31 - tb.delivery_date,  
32 - tb.output,  
33 - tb.status,  
34 - tb.create_by_id,  
35 - tb.create_by,  
36 - tb.update_by_id,  
37 - tb.update_by,  
38 - tb.create_time,  
39 - tb.update_time  
40 - FROM order_specification_change_record AS tb  
41 - LEFT JOIN purchase_order_info o ON tb.order_id = o.id  
42 - LEFT JOIN base_data_customer c ON o.ordering_unit = c.id  
43 - </sql>  
44 -  
45 - <select id="query" resultMap="OrderSpecificationChangeRecord">  
46 - <include refid="OrderSpecificationChangeRecord_sql"/>  
47 - <where>  
48 - <if test="vo.orderingUnitName != null and vo.orderingUnitName != ''">  
49 - AND c.name LIKE CONCAT('%', #{vo.orderingUnitName}, '%')  
50 - </if>  
51 - <if test="vo.orderNo != null and vo.orderNo != ''">  
52 - AND o.order_no LIKE CONCAT('%', #{vo.orderNo}, '%')  
53 - </if>  
54 - <if test="vo.createStartTime != null">  
55 - AND tb.create_time >= #{vo.createStartTime}  
56 - </if>  
57 - <if test="vo.createEndTime != null">  
58 - AND tb.create_time &lt;= #{vo.createEndTime}  
59 - </if>  
60 - </where>  
61 - </select>  
62 -</mapper>