Commit 92bb728c67d635e00affb26cef13c1fbbc012bc5

Authored by 房远帅
1 parent 865555c1

采购计划:保存审核通过时间

... ... @@ -1942,6 +1942,7 @@ CREATE TABLE `procurement_plan`
1942 1942 `supply_manager_name` VARCHAR(50) DEFAULT NULL COMMENT '供应部主管',
1943 1943 `management_dept_name` VARCHAR(50) DEFAULT NULL COMMENT '供应管理科主管',
1944 1944 `purchase_dept_name` VARCHAR(50) DEFAULT NULL COMMENT '采购处主管',
  1945 + `approval_pass_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '审核通过时间',
1945 1946 `create_by_id` varchar(32) DEFAULT NULL COMMENT '创建人ID',
1946 1947 `create_by` varchar(64) DEFAULT NULL COMMENT '创建人',
1947 1948 `update_by_id` varchar(32) DEFAULT NULL COMMENT '更新人ID',
... ... @@ -1958,7 +1959,8 @@ CREATE TABLE `procurement_plan`
1958 1959 KEY `idx_pp_process_status` (`process_status`),
1959 1960 KEY `idx_pp_process_node` (`process_node`),
1960 1961 KEY `idx_pp_workshop_id` (`workshop_id`),
1961   - KEY `idx_pp_salesman_quotation_id` (`salesman_quotation_id`)
  1962 + KEY `idx_pp_salesman_quotation_id` (`salesman_quotation_id`),
  1963 + KEY `idx_pp_approval_pass_time` (`approval_pass_time`)
1962 1964 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='采购计划主表';
1963 1965
1964 1966 CREATE TABLE `procurement_plan_line`
... ...
... ... @@ -430,6 +430,13 @@ public class GetProcurementPlanBo extends BaseBo<ProcurementPlan> {
430 430 private String purchaseDeptName;
431 431
432 432 /**
  433 + * 审核通过时间(精确到时分秒)
  434 + */
  435 + @ApiModelProperty("审核通过时间")
  436 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  437 + private LocalDateTime approvalPassTime;
  438 +
  439 + /**
433 440 * 创建人ID
434 441 */
435 442 @ApiModelProperty("创建人ID")
... ...
... ... @@ -355,6 +355,11 @@ public class ProcurementPlan extends BaseEntity implements BaseDto {
355 355 private String purchaseDeptName;
356 356
357 357 /**
  358 + * 审核通过时间(精确到时分秒,流程 APPROVE_PASS / FINISH 时写入)
  359 + */
  360 + private LocalDateTime approvalPassTime;
  361 +
  362 + /**
358 363 * 是否展示审核按钮(非持久化字段)
359 364 */
360 365 @TableField(exist = false)
... ...
... ... @@ -46,6 +46,7 @@ import com.lframework.xingyun.sc.procurement.vo.change.UpdateProcurementPlanChan
46 46 import com.lframework.xingyun.sc.procurement.vo.plan.CreateProcurementPlanVo;
47 47 import com.lframework.xingyun.sc.procurement.vo.plan.ProcurementPlanLineVo;
48 48 import java.math.BigDecimal;
  49 +import java.time.LocalDateTime;
49 50 import java.util.*;
50 51 import java.util.stream.Collectors;
51 52 import javax.annotation.Resource;
... ... @@ -491,6 +492,7 @@ public class ProcurementPlanChangeServiceImpl extends
491 492 // 变更完成状态
492 493 updatedMain.setChangeStatus("CHANGED");
493 494 updatedMain.setProcessNode(null);
  495 + updatedMain.setApprovalPassTime(LocalDateTime.now());
494 496 procurementPlanService.update(Wrappers.lambdaUpdate(ProcurementPlan.class)
495 497 .setEntity(updatedMain)
496 498 .eq(ProcurementPlan::getId, planId));
... ... @@ -580,6 +582,7 @@ public class ProcurementPlanChangeServiceImpl extends
580 582 subVo.setManagementDeptName(procurementPlanChange.getManagementDeptName());
581 583 subVo.setSupplyManagerName(procurementPlanChange.getSupplyManagerName());
582 584 subVo.setMarketingManagerName(procurementPlanChange.getMarketingManagerName());
  585 + subVo.setApprovalPassTime(LocalDateTime.now());
583 586
584 587 List<ProcurementPlanLineVo> subLineVos = new ArrayList<>();
585 588 for (ProcurementPlanChangeLine cl : wLines) {
... ... @@ -610,6 +613,7 @@ public class ProcurementPlanChangeServiceImpl extends
610 613 .set(ProcurementPlan::getManagementDeptName, procurementPlanChange.getManagementDeptName())
611 614 .set(ProcurementPlan::getSupplyManagerName, procurementPlanChange.getSupplyManagerName())
612 615 .set(ProcurementPlan::getMarketingManagerName, procurementPlanChange.getMarketingManagerName())
  616 + .set(ProcurementPlan::getApprovalPassTime, LocalDateTime.now())
613 617 .eq(ProcurementPlan::getId, planId));
614 618
615 619 //todo 废弃原合同;生成新合同
... ...
... ... @@ -49,6 +49,7 @@ import com.lframework.xingyun.sc.procurement.vo.plan.QueryProcurementPlanVo;
49 49 import com.lframework.xingyun.sc.procurement.vo.plan.UpdateProcurementPlanVo;
50 50 import java.math.BigDecimal;
51 51 import java.time.LocalDate;
  52 +import java.time.LocalDateTime;
52 53 import java.time.format.DateTimeFormatter;
53 54 import java.util.*;
54 55 import java.util.stream.Collectors;
... ... @@ -490,6 +491,7 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
490 491 .set(ProcurementPlan::getApprovalStatus, approvalStatus)
491 492 .set(ProcurementPlan::getProcessStatus, approvalStatus.equals("PASS") ? "COMPLETED" : "REFUSE")
492 493 .set(ProcurementPlan::getProcessNode, approvalStatus.equals("PASS") ? null : "GYGLKZG")
  494 + .set(approvalStatus.equals("PASS"), ProcurementPlan::getApprovalPassTime, LocalDateTime.now())
493 495 .set(approvalStatus.equals("REFUSE"), ProcurementPlan::getPurchaseDeptName, null)
494 496 .set(approvalStatus.equals("REFUSE"), ProcurementPlan::getManagementDeptName, null)
495 497 .set(approvalStatus.equals("REFUSE"), ProcurementPlan::getSupplyManagerName, null)
... ... @@ -513,9 +515,10 @@ public class ProcurementPlanServiceImpl extends BaseMpServiceImpl<ProcurementPla
513 515
514 516 // 如果未通过的数量为0,说明所有子计划都已审核通过
515 517 if (unApprovedCount == 0) {
516   - // 更新主计划的流程状态为 COMPLETED
  518 + // 更新主计划的流程状态为 COMPLETED,同时写入审核通过时间(防止主计划自身未触发到PASS回调)
517 519 Wrapper<ProcurementPlan> parentWrapper = Wrappers.lambdaUpdate(ProcurementPlan.class)
518 520 .set(ProcurementPlan::getProcessStatus, "COMPLETED")
  521 + .set(ProcurementPlan::getApprovalPassTime, LocalDateTime.now())
519 522 .eq(ProcurementPlan::getId, parentId);
520 523 getBaseMapper().update(parentWrapper);
521 524 }
... ...
... ... @@ -44,6 +44,8 @@ import com.lframework.xingyun.sc.procurement.vo.replenish.CreateProcurementPlanR
44 44 import com.lframework.xingyun.sc.procurement.vo.replenish.QueryProcurementPlanReplenishVo;
45 45 import com.lframework.xingyun.sc.procurement.vo.replenish.UpdateProcurementPlanReplenishLineVo;
46 46 import com.lframework.xingyun.sc.procurement.vo.replenish.UpdateProcurementPlanReplenishVo;
  47 +
  48 +import java.time.LocalDateTime;
47 49 import java.util.*;
48 50 import java.util.stream.Collectors;
49 51 import javax.annotation.Resource;
... ... @@ -417,6 +419,7 @@ public class ProcurementPlanReplenishServiceImpl
417 419 archivedMain.setManagementDeptName(procurementPlanReplenish.getManagementDeptName());
418 420 archivedMain.setSupplyManagerName(procurementPlanReplenish.getSupplyManagerName());
419 421 archivedMain.setMarketingManagerName(procurementPlanReplenish.getMarketingManagerName());
  422 + archivedMain.setApprovalPassTime(LocalDateTime.now());
420 423 procurementPlanService.save(archivedMain);
421 424
422 425 //生成买断操作申请单
... ... @@ -490,6 +493,7 @@ public class ProcurementPlanReplenishServiceImpl
490 493 subVo.setMarketingManagerName(procurementPlanReplenish.getMarketingManagerName());
491 494 // 子计划的分厂就是当前组的明细分厂(同组内 workshopId 一样),直接赋值
492 495 subVo.setWorkshopId(CollectionUtil.isNotEmpty(factoryLines) ? factoryLines.get(0).getWorkshopId() : null);
  496 + subVo.setApprovalPassTime(LocalDateTime.now());
493 497
494 498 // 子明细:只保留当前分厂,workshopId 保持原明细的,其它字段按原明细 copy
495 499 List<ProcurementPlanLineVo> subLineVoList = new ArrayList<>();
... ...
1 1 package com.lframework.xingyun.sc.procurement.vo.plan;
2 2
  3 +import com.fasterxml.jackson.annotation.JsonFormat;
  4 +import com.lframework.starter.common.constants.StringPool;
3 5 import com.lframework.starter.common.exceptions.impl.InputErrorException;
4 6 import com.lframework.starter.common.utils.StringUtil;
5 7 import com.lframework.starter.web.core.vo.BaseVo;
... ... @@ -7,6 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
7 9 import java.io.Serializable;
8 10 import java.math.BigDecimal;
9 11 import java.time.LocalDate;
  12 +import java.time.LocalDateTime;
10 13 import java.util.List;
11 14 import javax.validation.Valid;
12 15 import javax.validation.constraints.NotBlank;
... ... @@ -363,6 +366,10 @@ public class CreateProcurementPlanVo implements BaseVo, Serializable {
363 366 @ApiModelProperty("采购处主管")
364 367 private String purchaseDeptName;
365 368
  369 + @ApiModelProperty("审核通过时间")
  370 + @JsonFormat(pattern = StringPool.DATE_TIME_PATTERN)
  371 + private LocalDateTime approvalPassTime;
  372 +
366 373 /**
367 374 * 明细信息
368 375 */
... ...
... ... @@ -69,6 +69,7 @@
69 69 <result column="supply_manager_name" property="supplyManagerName"/>
70 70 <result column="management_dept_name" property="managementDeptName"/>
71 71 <result column="purchase_dept_name" property="purchaseDeptName"/>
  72 + <result column="approval_pass_time" property="approvalPassTime"/>
72 73 <result column="create_by_id" property="createById"/>
73 74 <result column="create_by" property="createBy"/>
74 75 <result column="update_by_id" property="updateById"/>
... ... @@ -145,6 +146,7 @@
145 146 pp.supply_manager_name,
146 147 pp.management_dept_name,
147 148 pp.purchase_dept_name,
  149 + pp.approval_pass_time,
148 150 pp.create_by_id,
149 151 pp.create_by,
150 152 pp.update_by_id,
... ...