Showing
10 changed files
with
115 additions
and
22 deletions
| ... | ... | @@ -175,9 +175,15 @@ public class GetDraftRequestCarTicketBo extends BaseBo<DraftRequestCarTicket> { |
| 175 | 175 | /** |
| 176 | 176 | * 是否展示审核按钮 |
| 177 | 177 | */ |
| 178 | - @TableField(exist = false) | |
| 178 | + @ApiModelProperty("是否展示审核按钮") | |
| 179 | 179 | private boolean showExamine; |
| 180 | 180 | |
| 181 | + /** | |
| 182 | + * 来源 | |
| 183 | + */ | |
| 184 | + @ApiModelProperty("来源") | |
| 185 | + private String source; | |
| 186 | + | |
| 181 | 187 | public GetDraftRequestCarTicketBo() { |
| 182 | 188 | |
| 183 | 189 | } | ... | ... |
| ... | ... | @@ -19,6 +19,7 @@ import com.lframework.xingyun.sc.service.customer.CustomerCreditService; |
| 19 | 19 | import com.lframework.xingyun.sc.service.customer.CustomerDevelopPlanService; |
| 20 | 20 | import com.lframework.xingyun.sc.service.order.*; |
| 21 | 21 | import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService; |
| 22 | +import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService; | |
| 22 | 23 | import com.lframework.xingyun.sc.service.shipments.car.RequestCarTicketService; |
| 23 | 24 | import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService; |
| 24 | 25 | import com.lframework.xingyun.sc.service.shipments.delay.DelayedShipmentDetailService; |
| ... | ... | @@ -27,6 +28,8 @@ import com.lframework.xingyun.sc.vo.customer.credit.QueryCorePersonnelHistoryVo; |
| 27 | 28 | import com.lframework.xingyun.sc.vo.customer.credit.UpdateCustomerCreditVo; |
| 28 | 29 | import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderLineVo; |
| 29 | 30 | import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderRevokeLineVo; |
| 31 | +import com.lframework.xingyun.sc.vo.shipments.car.CreateCarRequestPlanVo; | |
| 32 | +import com.lframework.xingyun.sc.vo.shipments.car.CreateRequestCarTicketVo; | |
| 30 | 33 | import com.lframework.xingyun.sc.vo.shipments.delay.QueryDelayedShipmentDetailVo; |
| 31 | 34 | import lombok.extern.slf4j.Slf4j; |
| 32 | 35 | import org.apache.commons.collections.CollectionUtils; |
| ... | ... | @@ -39,6 +42,7 @@ import org.springframework.stereotype.Component; |
| 39 | 42 | |
| 40 | 43 | import javax.annotation.Resource; |
| 41 | 44 | import java.math.BigDecimal; |
| 45 | +import java.time.LocalDate; | |
| 42 | 46 | import java.util.ArrayList; |
| 43 | 47 | import java.util.List; |
| 44 | 48 | import java.util.Map; |
| ... | ... | @@ -86,6 +90,8 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic |
| 86 | 90 | private DelayedShipmentService delayedShipmentService; |
| 87 | 91 | @Resource |
| 88 | 92 | private DelayedShipmentDetailService delayedShipmentDetailService; |
| 93 | + @Resource | |
| 94 | + private CarRequestPlanService carRequestPlanService; | |
| 89 | 95 | |
| 90 | 96 | |
| 91 | 97 | |
| ... | ... | @@ -439,6 +445,18 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic |
| 439 | 445 | draftRequestCarTicketService.updateStatus(businessId, "PASS"); |
| 440 | 446 | //更新外办审核人 |
| 441 | 447 | draftRequestCarTicketService.updateExamineUser(businessId, SecurityUtil.getCurrentUser().getId(), null, null); |
| 448 | + //如果是发货计划生成的草稿要车单-需要生成要车单和要车计划 | |
| 449 | + DraftRequestCarTicket draftRequestCarTicket = draftRequestCarTicketService.findById(businessId); | |
| 450 | + if (StringUtils.isNotEmpty(draftRequestCarTicket.getSource()) && "SHIPMENTSPLAN".equals(draftRequestCarTicket.getSource())) { | |
| 451 | + // 生成要车计划 | |
| 452 | + CreateCarRequestPlanVo planCreateVo = new CreateCarRequestPlanVo(); | |
| 453 | + planCreateVo.setRequestCarDate(LocalDate.now()); | |
| 454 | + planCreateVo.setWorkshopId(draftRequestCarTicket.getWorkshopId()); | |
| 455 | + String requestCarPlanId = carRequestPlanService.create(planCreateVo); | |
| 456 | + // 生成要车单 | |
| 457 | + CreateRequestCarTicketVo ticketCreateVo = packRequestCarTicket(draftRequestCarTicket,requestCarPlanId); | |
| 458 | + requestCarTicketService.create(ticketCreateVo); | |
| 459 | + } | |
| 442 | 460 | } else if (FlowInstanceStatus.REVOKE.getCode().equals(flowStatus) |
| 443 | 461 | || FlowInstanceStatus.REFUSE.getCode().equals(flowStatus) |
| 444 | 462 | || FlowInstanceStatus.TERMINATION.getCode().equals(flowStatus)) { |
| ... | ... | @@ -448,6 +466,35 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic |
| 448 | 466 | } |
| 449 | 467 | } |
| 450 | 468 | |
| 469 | + /** | |
| 470 | + * 封装要车单数据 | |
| 471 | + * | |
| 472 | + * @param draftRequestCarTicket 草稿要车单 | |
| 473 | + * @return CreateRequestCarTicketVo | |
| 474 | + */ | |
| 475 | + private CreateRequestCarTicketVo packRequestCarTicket(DraftRequestCarTicket draftRequestCarTicket, String requestCarPlanId) { | |
| 476 | + CreateRequestCarTicketVo ticketVo = new CreateRequestCarTicketVo(); | |
| 477 | + PurchaseOrderInfo orderInfo = purchaseOrderInfoService.findById(draftRequestCarTicket.getId()); | |
| 478 | + ticketVo.setDraftId(draftRequestCarTicket.getId()); | |
| 479 | + ticketVo.setPlanId(requestCarPlanId); | |
| 480 | + ticketVo.setPurchaseOrderId(draftRequestCarTicket.getPurchaseOrderId()); | |
| 481 | + ticketVo.setRequestCarDate(LocalDate.now()); | |
| 482 | + ticketVo.setDeptId(draftRequestCarTicket.getDeptId()); | |
| 483 | + ticketVo.setDeliveryDate(draftRequestCarTicket.getDeliveryDate()); | |
| 484 | + ticketVo.setWorkshopId(draftRequestCarTicket.getWorkshopId()); | |
| 485 | + ticketVo.setOrderNo(draftRequestCarTicket.getOrderNo()); | |
| 486 | + ticketVo.setOrderingUnit(draftRequestCarTicket.getOrderingUnit()); | |
| 487 | + if (orderInfo.getTotalQuantity() != null) { | |
| 488 | + BigDecimal result = orderInfo.getTotalQuantity().divide(new BigDecimal(1000), 4, BigDecimal.ROUND_HALF_UP); | |
| 489 | + ticketVo.setQuantity(result); | |
| 490 | + } | |
| 491 | + //外办审核人(草稿要车单审核人) | |
| 492 | + ticketVo.setExternalAuditor(SecurityUtil.getCurrentUser().getId()); | |
| 493 | + //经营办审核人(发货计划提交人) | |
| 494 | + ticketVo.setBusinessOfficeAuditor(draftRequestCarTicket.getBusinessOfficeAuditor()); | |
| 495 | + return ticketVo; | |
| 496 | + } | |
| 497 | + | |
| 451 | 498 | private void handleDelayedShipmentData(String flowStatus, String businessId) { |
| 452 | 499 | if (FlowInstanceStatus.APPROVE_PASS.getCode().equals(flowStatus) |
| 453 | 500 | || FlowInstanceStatus.FINISH.getCode().equals(flowStatus)) { | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/ShipmentsOrderInfoServiceImpl.java
| ... | ... | @@ -529,7 +529,8 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 529 | 529 | planCreateVo.setWorkshopId(orderInfo.getWorkshopId()); |
| 530 | 530 | String requestCarPlanId = carRequestPlanService.create(planCreateVo); |
| 531 | 531 | // 生成要车单 |
| 532 | - CreateRequestCarTicketVo ticketCreateVo = packRequestCarTicket(orderInfo, requestCarPlanId, draftTicket.getId(), plan.getTomoPreShipDate()); | |
| 532 | + CreateRequestCarTicketVo ticketCreateVo = packRequestCarTicket(orderInfo, requestCarPlanId, | |
| 533 | + draftTicket.getId(), plan.getTomoPreShipDate(), draftTicket.getExternalAuditor()); | |
| 533 | 534 | requestCarTicketService.create(ticketCreateVo); |
| 534 | 535 | } else { |
| 535 | 536 | throw new DefaultClientException("请先补充草稿要车单数据!"); |
| ... | ... | @@ -557,6 +558,10 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 557 | 558 | BigDecimal result = orderInfo.getTotalQuantity().divide(new BigDecimal(1000), 4, BigDecimal.ROUND_HALF_UP); |
| 558 | 559 | draftTicketVo.setQuantity(result); |
| 559 | 560 | } |
| 561 | + //经营办审核人(发货计划提交人) | |
| 562 | + draftTicketVo.setBusinessOfficeAuditor(SecurityUtil.getCurrentUser().getId()); | |
| 563 | + //发货计划 | |
| 564 | + draftTicketVo.setSource("SHIPMENTSPLAN"); | |
| 560 | 565 | return draftTicketVo; |
| 561 | 566 | } |
| 562 | 567 | |
| ... | ... | @@ -564,12 +569,13 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 564 | 569 | * 封装要车单数据 |
| 565 | 570 | * |
| 566 | 571 | * @param orderInfo 订货单数据 |
| 567 | - * @return CreateRequestCarTicketVo | |
| 572 | + * @return CreateRequestCarTicketVo | |
| 568 | 573 | */ |
| 569 | - private CreateRequestCarTicketVo packRequestCarTicket(PurchaseOrderInfo orderInfo, String planId, String draftId, LocalDate shipmentsDate) { | |
| 574 | + private CreateRequestCarTicketVo packRequestCarTicket(PurchaseOrderInfo orderInfo, String planId, String draftId, | |
| 575 | + LocalDate shipmentsDate, String externalAuditor) { | |
| 570 | 576 | CreateRequestCarTicketVo ticketVo = new CreateRequestCarTicketVo(); |
| 571 | 577 | ticketVo.setDraftId(draftId); |
| 572 | - ticketVo.setPlanId(draftId); | |
| 578 | + ticketVo.setPlanId(planId); | |
| 573 | 579 | ticketVo.setPurchaseOrderId(orderInfo.getId()); |
| 574 | 580 | ticketVo.setRequestCarDate(LocalDate.now()); |
| 575 | 581 | ticketVo.setDeptId(orderInfo.getDeptId()); |
| ... | ... | @@ -581,6 +587,10 @@ public class ShipmentsOrderInfoServiceImpl extends BaseMpServiceImpl<ShipmentsOr |
| 581 | 587 | BigDecimal result = orderInfo.getTotalQuantity().divide(new BigDecimal(1000), 4, BigDecimal.ROUND_HALF_UP); |
| 582 | 588 | ticketVo.setQuantity(result); |
| 583 | 589 | } |
| 590 | + //外办审核人(草稿要车单审核人) | |
| 591 | + ticketVo.setExternalAuditor(externalAuditor); | |
| 592 | + //经营办审核人(发货计划提交人) | |
| 593 | + ticketVo.setBusinessOfficeAuditor(SecurityUtil.getCurrentUser().getId()); | |
| 584 | 594 | return ticketVo; |
| 585 | 595 | } |
| 586 | 596 | } | ... | ... |
xingyun-sc/src/main/java/com/lframework/xingyun/sc/impl/shipments/car/CarRequestPlanServiceImpl.java
| ... | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | 5 | import com.github.pagehelper.PageInfo; |
| 6 | 6 | import com.lframework.starter.common.utils.CollectionUtil; |
| 7 | +import com.lframework.starter.web.core.components.security.SecurityUtil; | |
| 7 | 8 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 8 | 9 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| 9 | 10 | import com.lframework.starter.web.core.components.resp.PageResult; |
| ... | ... | @@ -18,22 +19,26 @@ import com.lframework.starter.web.core.utils.PageHelperUtil; |
| 18 | 19 | import com.lframework.starter.common.utils.Assert; |
| 19 | 20 | import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
| 20 | 21 | import com.lframework.xingyun.sc.entity.CarRequestPlan; |
| 22 | +import com.lframework.xingyun.sc.entity.RequestCarTicket; | |
| 21 | 23 | import com.lframework.xingyun.sc.mappers.CarRequestPlanMapper; |
| 22 | 24 | import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService; |
| 25 | +import com.lframework.xingyun.sc.service.shipments.car.RequestCarTicketService; | |
| 23 | 26 | import com.lframework.xingyun.sc.vo.shipments.car.CreateCarRequestPlanVo; |
| 24 | 27 | import com.lframework.xingyun.sc.vo.shipments.car.QueryCarRequestPlanVo; |
| 28 | +import com.lframework.xingyun.sc.vo.shipments.car.QueryRequestCarTicketVo; | |
| 25 | 29 | import com.lframework.xingyun.sc.vo.shipments.car.UpdateCarRequestPlanVo; |
| 26 | 30 | import org.springframework.transaction.annotation.Transactional; |
| 27 | 31 | import org.springframework.stereotype.Service; |
| 28 | - | |
| 29 | -import java.text.SimpleDateFormat; | |
| 32 | +import javax.annotation.Resource; | |
| 30 | 33 | import java.time.LocalDate; |
| 31 | 34 | import java.time.format.DateTimeFormatter; |
| 32 | -import java.util.Date; | |
| 33 | 35 | import java.util.List; |
| 36 | +import java.util.stream.Collectors; | |
| 34 | 37 | |
| 35 | 38 | @Service |
| 36 | 39 | public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanMapper, CarRequestPlan> implements CarRequestPlanService { |
| 40 | + @Resource | |
| 41 | + private RequestCarTicketService requestCarTicketService; | |
| 37 | 42 | |
| 38 | 43 | @Override |
| 39 | 44 | public PageResult<CarRequestPlan> query(Integer pageIndex, Integer pageSize, QueryCarRequestPlanVo vo) { |
| ... | ... | @@ -115,6 +120,18 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM |
| 115 | 120 | |
| 116 | 121 | getBaseMapper().update(updateWrapper); |
| 117 | 122 | |
| 123 | + //更新要车单运作科审核人 | |
| 124 | + QueryRequestCarTicketVo vo1 = new QueryRequestCarTicketVo(); | |
| 125 | + vo1.setPlanId(vo.getId()); | |
| 126 | + List<RequestCarTicket> query = requestCarTicketService.query(vo1); | |
| 127 | + if (CollectionUtil.isNotEmpty(query)) { | |
| 128 | + List<String> ids = query.stream() | |
| 129 | + .map(RequestCarTicket::getId) | |
| 130 | + .collect(Collectors.toList()); | |
| 131 | + String currentUserId = SecurityUtil.getCurrentUser().getId(); | |
| 132 | + requestCarTicketService.updateExamineUserBatch(ids, null, null, currentUserId); | |
| 133 | + } | |
| 134 | + | |
| 118 | 135 | OpLogUtil.setVariable("id", data.getId()); |
| 119 | 136 | OpLogUtil.setExtra(vo); |
| 120 | 137 | } | ... | ... |
| ... | ... | @@ -157,6 +157,9 @@ public class DraftRequestCarTicketServiceImpl extends BaseMpServiceImpl<DraftReq |
| 157 | 157 | } else { |
| 158 | 158 | data.setStatus("AUDIT"); |
| 159 | 159 | } |
| 160 | + if (!StringUtil.isBlank(vo.getSource())) { | |
| 161 | + data.setSource(vo.getSource()); | |
| 162 | + } | |
| 160 | 163 | |
| 161 | 164 | getBaseMapper().insert(data); |
| 162 | 165 | ... | ... |
| ... | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 5 | 5 | import com.github.pagehelper.PageInfo; |
| 6 | 6 | import com.lframework.starter.bpm.service.FlowInstanceWrapperService; |
| 7 | +import com.lframework.starter.common.utils.CollectionUtil; | |
| 7 | 8 | import com.lframework.starter.web.core.impl.BaseMpServiceImpl; |
| 8 | 9 | import com.lframework.starter.web.core.utils.PageResultUtil; |
| 9 | 10 | import com.lframework.starter.web.core.components.resp.PageResult; |
| ... | ... | @@ -197,19 +198,15 @@ public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTic |
| 197 | 198 | OpLogUtil.setExtra(id); |
| 198 | 199 | } |
| 199 | 200 | |
| 200 | - @OpLog(type = OtherOpLogType.class, name = "更新要车单审核人,ID:{}", params = {"#id"}) | |
| 201 | + @OpLog(type = OtherOpLogType.class, name = "批量更新要车单审核人,ID:{}", params = {"#id"}) | |
| 201 | 202 | @Transactional(rollbackFor = Exception.class) |
| 202 | 203 | @Override |
| 203 | - public void updateExamineUser(String id, String externalAuditor, String businessOfficeAuditor, String operationsDepartmentAuditor) { | |
| 204 | - if (StringUtils.isBlank(id)) { | |
| 204 | + public void updateExamineUserBatch(List<String> ids, String externalAuditor, String businessOfficeAuditor, String operationsDepartmentAuditor) { | |
| 205 | + if (CollectionUtil.isEmpty(ids)) { | |
| 205 | 206 | return; |
| 206 | 207 | } |
| 207 | - RequestCarTicket data = getBaseMapper().findById(id); | |
| 208 | - if (ObjectUtil.isNull(data)) { | |
| 209 | - throw new DefaultClientException("要车单不存在!"); | |
| 210 | - } | |
| 211 | 208 | LambdaUpdateWrapper<RequestCarTicket> updateWrapper = Wrappers.lambdaUpdate(RequestCarTicket.class) |
| 212 | - .eq(RequestCarTicket::getId, id); | |
| 209 | + .in(RequestCarTicket::getId, ids); | |
| 213 | 210 | if (externalAuditor != null) { |
| 214 | 211 | updateWrapper.set(RequestCarTicket::getExternalAuditor, externalAuditor); |
| 215 | 212 | } |
| ... | ... | @@ -222,8 +219,8 @@ public class RequestCarTicketServiceImpl extends BaseMpServiceImpl<RequestCarTic |
| 222 | 219 | |
| 223 | 220 | getBaseMapper().update(updateWrapper); |
| 224 | 221 | |
| 225 | - OpLogUtil.setVariable("id", data.getId()); | |
| 226 | - OpLogUtil.setExtra(id); | |
| 222 | + OpLogUtil.setVariable("id", ids); | |
| 223 | + OpLogUtil.setExtra(ids); | |
| 227 | 224 | } |
| 228 | 225 | |
| 229 | 226 | @OpLog(type = OtherOpLogType.class, name = "删除要车单表,ID:{}", params = {"#id"}) | ... | ... |
| ... | ... | @@ -57,12 +57,12 @@ public interface RequestCarTicketService extends BaseMpService<RequestCarTicket> |
| 57 | 57 | /** |
| 58 | 58 | * 更新审核人 |
| 59 | 59 | * |
| 60 | - * @param id 主键 | |
| 61 | - * @param externalAuditor 外办审核人 | |
| 62 | - * @param businessOfficeAuditor 经营办审核人 | |
| 60 | + * @param ids 主键集合 | |
| 61 | + * @param externalAuditor 外办审核人 | |
| 62 | + * @param businessOfficeAuditor 经营办审核人 | |
| 63 | 63 | * @param operationsDepartmentAuditor 运作科审核人 |
| 64 | 64 | */ |
| 65 | - void updateExamineUser(String id, String externalAuditor, String businessOfficeAuditor, String operationsDepartmentAuditor); | |
| 65 | + void updateExamineUserBatch(List<String> ids, String externalAuditor, String businessOfficeAuditor, String operationsDepartmentAuditor); | |
| 66 | 66 | |
| 67 | 67 | /** |
| 68 | 68 | * 根据ID删除 | ... | ... |
| ... | ... | @@ -27,6 +27,7 @@ |
| 27 | 27 | <result column="operations_department_auditor" property="operationsDepartmentAuditor"/> |
| 28 | 28 | <result column="operations_department_auditor_name" property="operationsDepartmentAuditorName"/> |
| 29 | 29 | <result column="status" property="status"/> |
| 30 | + <result column="source" property="source"/> | |
| 30 | 31 | <result column="create_by_id" property="createById"/> |
| 31 | 32 | <result column="create_by" property="createBy"/> |
| 32 | 33 | <result column="update_by_id" property="updateById"/> |
| ... | ... | @@ -61,6 +62,7 @@ |
| 61 | 62 | tb.operations_department_auditor, |
| 62 | 63 | su2.name AS operations_department_auditor_name, |
| 63 | 64 | tb.status, |
| 65 | + tb.source, | |
| 64 | 66 | tb.create_by_id, |
| 65 | 67 | tb.create_by, |
| 66 | 68 | tb.update_by_id, | ... | ... |