Showing
7 changed files
with
89 additions
and
34 deletions
| ... | ... | @@ -14,23 +14,16 @@ import java.util.List; |
| 14 | 14 | @Slf4j |
| 15 | 15 | public class MessageHandler { |
| 16 | 16 | |
| 17 | - @Resource | |
| 18 | - private SysUserDeptService userDeptService; | |
| 19 | - @Resource | |
| 20 | - private SysUserRoleMapper sysUserRoleMapper; | |
| 21 | - @Resource | |
| 22 | - private WorkshopService workshopService; | |
| 23 | - | |
| 24 | 17 | |
| 25 | 18 | /** |
| 26 | - * 根据角色code获取办理人 | |
| 19 | + * 消息通知 | |
| 27 | 20 | * |
| 28 | - * @param roleCode 角色编号 | |
| 29 | - * @param userId 业务数据创建人/更新人ID | |
| 21 | + * @param roleCodes 角色编号集合 | |
| 22 | + * @param userId 人员ID | |
| 30 | 23 | * @return List<String> |
| 31 | 24 | */ |
| 32 | - public List<String> sendMsg(String userId, List<String> roleCode) { | |
| 33 | - log.info("================== MessageHandler sendMsg invoke start, userId:{}, roleCode:{}", userId, JsonUtil.toJsonString(roleCode)); | |
| 25 | + public List<String> sendMsg(String userId, List<String> roleCodes) { | |
| 26 | + log.info("================== MessageHandler sendMsg invoke start, userId:{}, roleCodes:{}", userId, JsonUtil.toJsonString(roleCodes)); | |
| 34 | 27 | |
| 35 | 28 | return null; |
| 36 | 29 | } | ... | ... |
| ... | ... | @@ -18,6 +18,7 @@ import com.lframework.starter.common.utils.ObjectUtil; |
| 18 | 18 | import com.lframework.starter.web.core.annotations.oplog.OpLog; |
| 19 | 19 | import com.lframework.starter.common.utils.Assert; |
| 20 | 20 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 21 | +import com.lframework.xingyun.sc.entity.PurchaseOrderInfo; | |
| 21 | 22 | import com.lframework.xingyun.sc.entity.PurchaseOrderLine; |
| 22 | 23 | import com.lframework.xingyun.sc.enums.OrderSpecChangeStatus; |
| 23 | 24 | import com.lframework.xingyun.sc.service.customer.CustomerCreditService; |
| ... | ... | @@ -85,13 +86,8 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
| 85 | 86 | } |
| 86 | 87 | // 获取规格数据 |
| 87 | 88 | // 变更前 |
| 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()); | |
| 89 | + Object obj = redisHandler.get(changeRecord.getOrderId() + "_order_line_info"); | |
| 90 | + List<PurchaseOrderLine> beforeChangeList = JsonUtil.parseList(obj.toString(), PurchaseOrderLine.class); | |
| 95 | 91 | changeRecord.setBeforeChangeSpecList(beforeChangeList); |
| 96 | 92 | // 变更后 |
| 97 | 93 | List<PurchaseOrderLine> afterChangeList = purchaseOrderLineService.listByOrderIds(Collections.singletonList(id)); |
| ... | ... | @@ -181,8 +177,7 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
| 181 | 177 | purchaseOrderLineService.create(orderLineVo); |
| 182 | 178 | } |
| 183 | 179 | // 缓存订货单物料行数据 |
| 184 | - String redisKey = vo.getOrderId() + "_order_line_info"; | |
| 185 | - redisHandler.set(redisKey, JsonUtil.toJsonString(orderLineVoList)); | |
| 180 | + redisHandler.set(vo.getOrderId() + "_order_line_info", JsonUtil.toJsonString(orderLineVoList)); | |
| 186 | 181 | // 更新订货单变更状态 |
| 187 | 182 | purchaseOrderInfoService.updateSpecChangeStatus(vo.getOrderId(), OrderSpecChangeStatus.IN_PROGRESS.getCode()); |
| 188 | 183 | // 发起流程 |
| ... | ... | @@ -272,10 +267,12 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
| 272 | 267 | updateWrapper.set(OrderInfoChangeRecord::getExamineStatus, status) |
| 273 | 268 | .eq(OrderInfoChangeRecord::getId, id); |
| 274 | 269 | getBaseMapper().update(updateWrapper); |
| 275 | - if (OrderSpecChangeStatus.CANCEL.getCode().equals(status) | |
| 276 | - || OrderSpecChangeStatus.COMPLETED.getCode().equals(status)) { | |
| 270 | + if (OrderSpecChangeStatus.CANCEL.getCode().equals(status)) { | |
| 277 | 271 | // 更新订货单变更状态 |
| 278 | 272 | purchaseOrderInfoService.updateSpecChangeStatus(record.getOrderId(), status); |
| 273 | + } else if ("PASS".equals(status)) { | |
| 274 | + // 更新订货单变更状态 | |
| 275 | + purchaseOrderInfoService.updateSpecChangeStatus(record.getOrderId(), OrderSpecChangeStatus.COMPLETED.getCode()); | |
| 279 | 276 | } |
| 280 | 277 | } |
| 281 | 278 | |
| ... | ... | @@ -291,7 +288,9 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
| 291 | 288 | // 更新状态 |
| 292 | 289 | updateStatus(id, "PASS"); |
| 293 | 290 | // 更新订货单数据 |
| 294 | - purchaseOrderLineService.updateByChangeId(id, record.getOrderId()); | |
| 291 | + purchaseOrderInfoService.update(JsonUtil.parseObject(JsonUtil.toJsonString(record), PurchaseOrderInfo.class)); | |
| 292 | + // 更新订货单物料行数据 | |
| 293 | + purchaseOrderLineService.update(record.getOrderId(), record.getAfterChangeSpecList()); | |
| 295 | 294 | } |
| 296 | 295 | |
| 297 | 296 | @Override | ... | ... |
| ... | ... | @@ -342,6 +342,38 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | @Override |
| 345 | + public void update(PurchaseOrderInfo orderInfo) { | |
| 346 | + if (StringUtils.isBlank(orderInfo.getId())) { | |
| 347 | + log.error("PurchaseOrderInfoService update orderInfo is null!"); | |
| 348 | + return; | |
| 349 | + } | |
| 350 | + LambdaUpdateWrapper<PurchaseOrderInfo> updateWrapper = Wrappers.lambdaUpdate(PurchaseOrderInfo.class) | |
| 351 | + .set(PurchaseOrderInfo::getOrderNo, StringUtil.isBlank(orderInfo.getOrderNo()) ? null : orderInfo.getOrderNo()) | |
| 352 | + .set(PurchaseOrderInfo::getSupplyUnit, StringUtil.isBlank(orderInfo.getSupplyUnit()) ? null : orderInfo.getSupplyUnit()) | |
| 353 | + .set(PurchaseOrderInfo::getOrderingUnit, StringUtil.isBlank(orderInfo.getOrderingUnit()) ? null : orderInfo.getOrderingUnit()) | |
| 354 | + .set(PurchaseOrderInfo::getOrderDate, orderInfo.getOrderDate() == null ? null : orderInfo.getOrderDate()) | |
| 355 | + .set(PurchaseOrderInfo::getSettlementTerms, StringUtil.isBlank(orderInfo.getSettlementTerms()) ? null : orderInfo.getSettlementTerms()) | |
| 356 | + .set(PurchaseOrderInfo::getDeliveryMethod, StringUtil.isBlank(orderInfo.getDeliveryMethod()) ? null : orderInfo.getDeliveryMethod()) | |
| 357 | + .set(PurchaseOrderInfo::getPriceListNo, StringUtil.isBlank(orderInfo.getPriceListNo()) ? null : orderInfo.getPriceListNo()) | |
| 358 | + .set(PurchaseOrderInfo::getExecutionStandard, StringUtil.isBlank(orderInfo.getExecutionStandard()) ? null : orderInfo.getExecutionStandard()) | |
| 359 | + .set(PurchaseOrderInfo::getInvoicingStatus, StringUtil.isBlank(orderInfo.getInvoicingStatus()) ? null : orderInfo.getInvoicingStatus()) | |
| 360 | + .set(PurchaseOrderInfo::getShippingCost, StringUtil.isBlank(orderInfo.getShippingCost()) ? null : orderInfo.getShippingCost()) | |
| 361 | + .set(PurchaseOrderInfo::getPieceWeightHeader, StringUtil.isBlank(orderInfo.getPieceWeightHeader()) ? null : orderInfo.getPieceWeightHeader()) | |
| 362 | + .set(PurchaseOrderInfo::getSurface, StringUtil.isBlank(orderInfo.getSurface()) ? null : orderInfo.getSurface()) | |
| 363 | + .set(PurchaseOrderInfo::getTolerance, StringUtil.isBlank(orderInfo.getTolerance()) ? null : orderInfo.getTolerance()) | |
| 364 | + .set(PurchaseOrderInfo::getPerformance, StringUtil.isBlank(orderInfo.getPerformance()) ? null : orderInfo.getPerformance()) | |
| 365 | + .set(PurchaseOrderInfo::getElement, StringUtil.isBlank(orderInfo.getElement()) ? null : orderInfo.getElement()) | |
| 366 | + .set(PurchaseOrderInfo::getPackaging, StringUtil.isBlank(orderInfo.getPackaging()) ? null : orderInfo.getPackaging()) | |
| 367 | + .set(PurchaseOrderInfo::getRemarks, StringUtil.isBlank(orderInfo.getRemarks()) ? null : orderInfo.getRemarks()) | |
| 368 | + .set(PurchaseOrderInfo::getProductionProcess, StringUtil.isBlank(orderInfo.getProductionProcess()) ? null : orderInfo.getProductionProcess()) | |
| 369 | + .set(PurchaseOrderInfo::getDeptId, StringUtil.isBlank(orderInfo.getDeptId()) ? null : orderInfo.getDeptId()) | |
| 370 | + .set(PurchaseOrderInfo::getWorkshopId, StringUtil.isBlank(orderInfo.getWorkshopId()) ? null : orderInfo.getWorkshopId()) | |
| 371 | + .set(PurchaseOrderInfo::getCustomerCreditId, StringUtil.isBlank(orderInfo.getCustomerCreditId()) ? null : orderInfo.getCustomerCreditId()) | |
| 372 | + .eq(PurchaseOrderInfo::getId, orderInfo.getId()); | |
| 373 | + getBaseMapper().update(updateWrapper); | |
| 374 | + } | |
| 375 | + | |
| 376 | + @Override | |
| 345 | 377 | public void cleanCacheByKey(Serializable key) { |
| 346 | 378 | |
| 347 | 379 | } | ... | ... |
| ... | ... | @@ -25,6 +25,7 @@ import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; |
| 25 | 25 | import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; |
| 26 | 26 | import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderLineVo; |
| 27 | 27 | import org.apache.commons.collections4.CollectionUtils; |
| 28 | +import org.apache.commons.lang3.StringUtils; | |
| 28 | 29 | import org.springframework.transaction.annotation.Transactional; |
| 29 | 30 | import org.springframework.stereotype.Service; |
| 30 | 31 | |
| ... | ... | @@ -235,16 +236,32 @@ public class PurchaseOrderLineServiceImpl extends BaseMpServiceImpl<PurchaseOrde |
| 235 | 236 | } |
| 236 | 237 | |
| 237 | 238 | /** |
| 238 | - * 根据变更记录ID更新 | |
| 239 | + * 更新 | |
| 239 | 240 | * |
| 240 | - * @param changeId 变更记录ID | |
| 241 | + * @param specList 数据集合 | |
| 241 | 242 | */ |
| 242 | 243 | @Override |
| 243 | - public void updateByChangeId(String changeId, String orderId) { | |
| 244 | - if (StringUtil.isBlank(changeId)) { | |
| 244 | + public void update(String orderId, List<PurchaseOrderLine> specList) { | |
| 245 | + if (StringUtils.isEmpty(orderId) || CollectionUtils.isEmpty(specList)) { | |
| 246 | + return; | |
| 247 | + } | |
| 248 | + // 先删再增 | |
| 249 | + deleteByOrderId(orderId); | |
| 250 | + for (PurchaseOrderLine spec : specList) { | |
| 251 | + spec.setId(IdUtil.getId()); | |
| 252 | + spec.setPurchaseOrderId(orderId); | |
| 253 | + } | |
| 254 | + batchAdd(specList); | |
| 255 | + } | |
| 256 | + | |
| 257 | + @Override | |
| 258 | + public void deleteByOrderId(String orderId) { | |
| 259 | + if (StringUtils.isEmpty(orderId)) { | |
| 245 | 260 | return; |
| 246 | 261 | } |
| 247 | - // todo 更新订货单数据 | |
| 262 | + LambdaUpdateWrapper<PurchaseOrderLine> updateWrapper = Wrappers.lambdaUpdate(PurchaseOrderLine.class); | |
| 263 | + updateWrapper.eq(PurchaseOrderLine::getPurchaseOrderId, orderId); | |
| 264 | + getBaseMapper().delete(updateWrapper); | |
| 248 | 265 | } |
| 249 | 266 | |
| 250 | 267 | @Override | ... | ... |
| ... | ... | @@ -96,4 +96,11 @@ public interface PurchaseOrderInfoService extends BaseMpService<PurchaseOrderInf |
| 96 | 96 | * @param status 状态 |
| 97 | 97 | */ |
| 98 | 98 | void updateSpecChangeStatus(String id, String status); |
| 99 | + | |
| 100 | + /** | |
| 101 | + * 更新订货单信息 | |
| 102 | + * | |
| 103 | + * @param orderInfo 订货单数据 | |
| 104 | + */ | |
| 105 | + void update(PurchaseOrderInfo orderInfo); | |
| 99 | 106 | } | ... | ... |
| ... | ... | @@ -86,9 +86,16 @@ public interface PurchaseOrderLineService extends BaseMpService<PurchaseOrderLin |
| 86 | 86 | void batchUpdate(List<PurchaseOrderLine> specList); |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * 根据变更记录ID更新 | |
| 89 | + * 更新 | |
| 90 | 90 | * |
| 91 | - * @param changeId 变更记录ID | |
| 91 | + * @param specList 数据集合 | |
| 92 | + */ | |
| 93 | + void update(String orderId, List<PurchaseOrderLine> specList); | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * 根据订货单ID删除 | |
| 97 | + * | |
| 98 | + * @param orderId 订货单ID | |
| 92 | 99 | */ |
| 93 | - void updateByChangeId(String changeId, String orderId); | |
| 100 | + void deleteByOrderId(String orderId); | |
| 94 | 101 | } | ... | ... |
| ... | ... | @@ -83,7 +83,7 @@ |
| 83 | 83 | |
| 84 | 84 | <insert id="batchAdd" parameterType="java.util.List"> |
| 85 | 85 | INSERT INTO tbl_purchase_order_line ( |
| 86 | - id, purchase_order_id, change_id, industry, quality, brand, | |
| 86 | + id, purchase_order_id, industry, quality, brand, | |
| 87 | 87 | thickness, thickness_tol_pos, thickness_tol_neg, |
| 88 | 88 | width, width_tol_pos, width_tol_neg, |
| 89 | 89 | length, length_tol_pos, length_tol_neg, |
| ... | ... | @@ -92,7 +92,7 @@ |
| 92 | 92 | ) VALUES |
| 93 | 93 | <foreach collection="specList" item="item" separator=","> |
| 94 | 94 | ( |
| 95 | - #{item.id}, #{item.purchaseOrderId}, #{item.changeId}, #{item.industry}, #{item.quality}, #{item.brand}, | |
| 95 | + #{item.id}, #{item.purchaseOrderId}, #{item.industry}, #{item.quality}, #{item.brand}, | |
| 96 | 96 | #{item.thickness}, #{item.thicknessTolPos}, #{item.thicknessTolNeg}, |
| 97 | 97 | #{item.width}, #{item.widthTolPos}, #{item.widthTolNeg}, |
| 98 | 98 | #{item.length}, #{item.lengthTolPos}, #{item.lengthTolNeg}, | ... | ... |