Commit 85f7983127db023486f1f37be1a52e1f8339cc08

Authored by 房远帅
1 parent 1652e74d

发货:要车单经营办审核人问题处理

@@ -641,6 +641,9 @@ create table if not exists shipments_plan ( @@ -641,6 +641,9 @@ create table if not exists shipments_plan (
641 update_time datetime default now() comment '更新时间' 641 update_time datetime default now() comment '更新时间'
642 ); 642 );
643 643
  644 +ALTER TABLE `shipments_plan`
  645 + ADD COLUMN `business_office_auditor` varchar(32) DEFAULT NULL COMMENT '经营办审核人(发货计划提交人)';
  646 +
644 -- 发货明细 647 -- 发货明细
645 drop table if exists `shipments_plan_detail`; 648 drop table if exists `shipments_plan_detail`;
646 create table if not exists `shipments_plan_detail` ( 649 create table if not exists `shipments_plan_detail` (
@@ -249,6 +249,7 @@ public class ShipmentsOrderInfoController extends DefaultBaseController { @@ -249,6 +249,7 @@ public class ShipmentsOrderInfoController extends DefaultBaseController {
249 @Scheduled(cron = "0 8 0 * * ?") 249 @Scheduled(cron = "0 8 0 * * ?")
250 public InvokeResult<Void> dataHandler() { 250 public InvokeResult<Void> dataHandler() {
251 // 只处理今日应该发货但状态仍是未发货的数据,避免已签收/已发货的数据被重复处理 251 // 只处理今日应该发货但状态仍是未发货的数据,避免已签收/已发货的数据被重复处理
  252 + log.info("=========定时任务开始执行========");
252 List<ShipmentsOrderInfo> shipmentsOrderInfoList = shipmentsOrderInfoService.queryUnShipmentsByShipmentDate(LocalDate.now()); 253 List<ShipmentsOrderInfo> shipmentsOrderInfoList = shipmentsOrderInfoService.queryUnShipmentsByShipmentDate(LocalDate.now());
253 if (CollectionUtils.isNotEmpty(shipmentsOrderInfoList)) { 254 if (CollectionUtils.isNotEmpty(shipmentsOrderInfoList)) {
254 for (ShipmentsOrderInfo orderInfo : shipmentsOrderInfoList) { 255 for (ShipmentsOrderInfo orderInfo : shipmentsOrderInfoList) {
@@ -58,6 +58,11 @@ public class ShipmentsPlan extends BaseEntity implements BaseDto { @@ -58,6 +58,11 @@ public class ShipmentsPlan extends BaseEntity implements BaseDto {
58 private Boolean autoGenerate; 58 private Boolean autoGenerate;
59 59
60 /** 60 /**
  61 + * 经营办审核人(发货计划提交人)
  62 + */
  63 + private String businessOfficeAuditor;
  64 +
  65 + /**
61 * 创建人ID 66 * 创建人ID
62 */ 67 */
63 @TableField(fill = FieldFill.INSERT) 68 @TableField(fill = FieldFill.INSERT)
@@ -116,6 +116,10 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap @@ -116,6 +116,10 @@ public class ShipmentsPlanServiceImpl extends BaseMpServiceImpl<ShipmentsPlanMap
116 LambdaUpdateWrapper<ShipmentsPlan> updateWrapper = Wrappers.lambdaUpdate(ShipmentsPlan.class) 116 LambdaUpdateWrapper<ShipmentsPlan> updateWrapper = Wrappers.lambdaUpdate(ShipmentsPlan.class)
117 .set(ShipmentsPlan::getStatus, vo.getStatus()) 117 .set(ShipmentsPlan::getStatus, vo.getStatus())
118 .eq(ShipmentsPlan::getId, vo.getId()); 118 .eq(ShipmentsPlan::getId, vo.getId());
  119 + // 状态为审核中(CHECKING)时,记录当前提交人作为经营办审核人
  120 + if ("CHECKING".equals(vo.getStatus())) {
  121 + updateWrapper.set(ShipmentsPlan::getBusinessOfficeAuditor, SecurityUtil.getCurrentUser().getId());
  122 + }
119 123
120 getBaseMapper().update(updateWrapper); 124 getBaseMapper().update(updateWrapper);
121 125
@@ -20,6 +20,7 @@ import com.lframework.starter.common.utils.Assert; @@ -20,6 +20,7 @@ import com.lframework.starter.common.utils.Assert;
20 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; 20 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
21 import com.lframework.xingyun.sc.entity.*; 21 import com.lframework.xingyun.sc.entity.*;
22 import com.lframework.xingyun.sc.mappers.CarRequestPlanMapper; 22 import com.lframework.xingyun.sc.mappers.CarRequestPlanMapper;
  23 +import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService;
23 import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService; 24 import com.lframework.xingyun.sc.service.shipments.car.CarRequestPlanService;
24 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService; 25 import com.lframework.xingyun.sc.service.shipments.car.DraftRequestCarTicketService;
25 import com.lframework.xingyun.sc.service.shipments.car.RequestCarTicketService; 26 import com.lframework.xingyun.sc.service.shipments.car.RequestCarTicketService;
@@ -44,6 +45,8 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM @@ -44,6 +45,8 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM
44 private RequestCarTicketService requestCarTicketService; 45 private RequestCarTicketService requestCarTicketService;
45 @Resource 46 @Resource
46 private DraftRequestCarTicketService draftRequestCarTicketService; 47 private DraftRequestCarTicketService draftRequestCarTicketService;
  48 + @Resource
  49 + private ShipmentsPlanService shipmentsPlanService;
47 50
48 @Override 51 @Override
49 public PageResult<CarRequestPlan> query(Integer pageIndex, Integer pageSize, QueryCarRequestPlanVo vo) { 52 public PageResult<CarRequestPlan> query(Integer pageIndex, Integer pageSize, QueryCarRequestPlanVo vo) {
@@ -157,6 +160,11 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM @@ -157,6 +160,11 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM
157 List<DraftRequestCarTicket> draftTickets = draftRequestCarTicketService.listByOrderId(orderIds); 160 List<DraftRequestCarTicket> draftTickets = draftRequestCarTicketService.listByOrderId(orderIds);
158 Map<String, DraftRequestCarTicket> draftTicketMap = draftTickets.stream().collect(Collectors.toMap(DraftRequestCarTicket::getPurchaseOrderId, Function.identity() 161 Map<String, DraftRequestCarTicket> draftTicketMap = draftTickets.stream().collect(Collectors.toMap(DraftRequestCarTicket::getPurchaseOrderId, Function.identity()
159 , (v1, v2) -> v2)); 162 , (v1, v2) -> v2));
  163 + // 获取发货计划,取经营办审核人(发货计划提交人)
  164 + ShipmentsPlan shipmentsPlan = null;
  165 + if (StringUtil.isNotBlank(shipmentsOrderInfo.getPlanId())) {
  166 + shipmentsPlan = shipmentsPlanService.findById(shipmentsOrderInfo.getPlanId());
  167 + }
160 for (PurchaseOrderInfo orderInfo : orderInfoList) { 168 for (PurchaseOrderInfo orderInfo : orderInfoList) {
161 // 生成要车计划 169 // 生成要车计划
162 LocalDate requestCarDate = shipmentsOrderInfo.getShipmentsDate(); 170 LocalDate requestCarDate = shipmentsOrderInfo.getShipmentsDate();
@@ -185,8 +193,8 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM @@ -185,8 +193,8 @@ public class CarRequestPlanServiceImpl extends BaseMpServiceImpl<CarRequestPlanM
185 ticketVo.setShipmentsOrderId(shipmentsOrderInfo.getId()); 193 ticketVo.setShipmentsOrderId(shipmentsOrderInfo.getId());
186 // 外办审核人(草稿要车单审核人) 194 // 外办审核人(草稿要车单审核人)
187 ticketVo.setExternalAuditor(draftTicket.getExternalAuditor()); 195 ticketVo.setExternalAuditor(draftTicket.getExternalAuditor());
188 - // 经营办审核人(发货计划提交人)  
189 - ticketVo.setBusinessOfficeAuditor(SecurityUtil.getCurrentUser().getId()); 196 + // 经营办审核人(发货计划提交人,取自发货计划)
  197 + ticketVo.setBusinessOfficeAuditor(shipmentsPlan != null ? shipmentsPlan.getBusinessOfficeAuditor() : null);
190 ticketVo.setDestination(draftTicket.getDestination()); 198 ticketVo.setDestination(draftTicket.getDestination());
191 ticketVo.setConsignee(draftTicket.getConsignee()); 199 ticketVo.setConsignee(draftTicket.getConsignee());
192 ticketVo.setPhone(draftTicket.getPhone()); 200 ticketVo.setPhone(draftTicket.getPhone());
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 <result column="tomo_pre_ship_date" property="tomoPreShipDate"/> 10 <result column="tomo_pre_ship_date" property="tomoPreShipDate"/>
11 <result column="af_tomo_pre_ship_date" property="afTomoPreShipDate"/> 11 <result column="af_tomo_pre_ship_date" property="afTomoPreShipDate"/>
12 <result column="auto_generate" property="autoGenerate"/> 12 <result column="auto_generate" property="autoGenerate"/>
  13 + <result column="business_office_auditor" property="businessOfficeAuditor"/>
13 <result column="create_by_id" property="createById"/> 14 <result column="create_by_id" property="createById"/>
14 <result column="update_by_id" property="updateById"/> 15 <result column="update_by_id" property="updateById"/>
15 <result column="create_time" property="createTime"/> 16 <result column="create_time" property="createTime"/>
@@ -25,6 +26,7 @@ @@ -25,6 +26,7 @@
25 tb.tomo_pre_ship_date, 26 tb.tomo_pre_ship_date,
26 tb.af_tomo_pre_ship_date, 27 tb.af_tomo_pre_ship_date,
27 tb.auto_generate, 28 tb.auto_generate,
  29 + tb.business_office_auditor,
28 tb.create_by_id, 30 tb.create_by_id,
29 tb.update_by_id, 31 tb.update_by_id,
30 tb.create_time, 32 tb.create_time,
@@ -58,7 +60,7 @@ @@ -58,7 +60,7 @@
58 ORDER BY tb.create_time DESC 60 ORDER BY tb.create_time DESC
59 </select> 61 </select>
60 62
61 - <select id="getById" resultType="com.lframework.xingyun.sc.entity.ShipmentsPlan"> 63 + <select id="getById" resultMap="ShipmentsPlan">
62 <include refid="ShipmentsPlan_sql"/> 64 <include refid="ShipmentsPlan_sql"/>
63 <where> 65 <where>
64 AND tb.id = #{id} 66 AND tb.id = #{id}