瀏覽代碼

防错-接口-待审批接话列表

wuzhenyue 3 年之前
父節點
當前提交
59b9efc79e

+ 3 - 2
application-facade/src/main/java/com/factory/controller/web/PreventMistakeController.java

@@ -36,6 +36,7 @@ import com.factory.web.entity.pm.res.PmCheckListRes;
 import com.factory.web.entity.pm.res.PmCheckRecordListRes;
 import com.factory.web.entity.pm.res.PmItemNoGoListRes;
 import com.factory.web.entity.pm.res.PmNoGoTaskAapprovalRes;
+import com.factory.web.entity.pm.res.PmPlanCheckListRes;
 import com.factory.web.entity.pm.res.PmPlanListForPadRes;
 import com.factory.web.entity.pm.res.PmPlanListRes;
 import com.factory.web.entity.pm.res.PmPlanRes;
@@ -71,11 +72,11 @@ public class PreventMistakeController {
 	@ApiOperation(value = "取得Web端防错计划点检列表")
 	@ApiOperationSupport(order = 2)
 	@PostMapping("/getPmPlanCheckList")
-	public ResponseBean<PageBean<PmPlanListRes>> getPmPlanCheckList(@RequestBody SearchPmPlanCheckListReq req) {
+	public ResponseBean<PageBean<PmPlanCheckListRes>> getPmPlanCheckList(@RequestBody SearchPmPlanCheckListReq req) {
 		return preventMistakeService.getPmPlanCheckList(req);
 	}
 
-	@ApiOperation(value = "取得Web端防错计划列表")
+	@ApiOperation(value = "取得Web端待审批计划列表")
 	@ApiOperationSupport(order = 3)
 	@PostMapping("/getPmPlanlist")
 	public ResponseBean<PageBean<PmPlanListRes>> getPmPlanlist(@RequestBody SearchPmPlanListReq req) {

+ 5 - 2
application-facade/src/main/java/com/factory/web/entity/pm/req/SearchPmPlanListReq.java

@@ -27,7 +27,10 @@ public class SearchPmPlanListReq extends BasePageReq {
 	@ApiModelProperty(value = "计划名称")
 	private String bentelerPlanName;
 	
-	@ApiModelProperty(value = "计划状态 0待质量经理审批、1待生产经理审批、2已驳回待修改、3审批通过")
-	private Integer planStatus;
+//	@ApiModelProperty(value = "计划状态 0待质量经理审批、1待生产经理审批、2已驳回待修改、3审批通过")
+//	private Integer planStatus;
+	
+	@ApiModelProperty(value = "计划类型 1首件 2防错")
+    private Integer planType;
 	
 }

+ 47 - 0
application-facade/src/main/java/com/factory/web/entity/pm/res/PmPlanCheckListRes.java

@@ -0,0 +1,47 @@
+package com.factory.web.entity.pm.res;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 防错计划
+ *
+ * @author wzy
+ * @date 2021-07-09 12:00:00
+ */
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonInclude()
+@ApiModel("")
+public class PmPlanCheckListRes implements Serializable {
+
+	@ApiModelProperty(value = "计划ID")
+	private Long bentelerPlanId;
+
+	@ApiModelProperty(value = "计划名称")
+	private String bentelerPlanName;
+
+	@ApiModelProperty(value = "检验负责人")
+	private String checkPerson;
+
+	@ApiModelProperty(value = "计划状态 0未完成 1已完成 2待重检")
+	private Integer planStatus;
+
+	@ApiModelProperty(value = "计划创建日期")
+	private LocalDateTime createdTime;
+	
+	@ApiModelProperty(value = "0解禁、1禁用")
+	private Integer pauseFlag;
+
+}

+ 19 - 2
application-facade/src/main/java/com/factory/web/entity/pm/res/PmPlanListRes.java

@@ -3,6 +3,8 @@ package com.factory.web.entity.pm.res;
 import java.io.Serializable;
 import java.time.LocalDateTime;
 
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonInclude;
 
 import io.swagger.annotations.ApiModel;
@@ -32,8 +34,8 @@ public class PmPlanListRes implements Serializable {
 	@ApiModelProperty(value = "计划名称")
 	private String bentelerPlanName;
 
-	@ApiModelProperty(value = "检验负责人")
-	private String checkPerson;
+	@ApiModelProperty(value = "计划类型 1首件 2防错")
+    private Integer planType;
 
 	@ApiModelProperty(value = "计划状态 0未完成 1已完成 2待重检")
 	private Integer planStatus;
@@ -44,4 +46,19 @@ public class PmPlanListRes implements Serializable {
 	@ApiModelProperty(value = "0解禁、1禁用")
 	private Integer pauseFlag;
 
+	@ApiModelProperty(value = "1质量经理审批 2生产经理审批")
+	private Integer approvalLevel;
+
+	@ApiModelProperty(value = "审批人")
+	private Long approvalUserId;
+	
+	@ApiModelProperty(value = "审批状态 0未审批 1审批通过 2驳回")
+	private Integer status;
+	
+	@ApiModelProperty(value = "审批意见")
+	private String reason;
+
+    @ApiModelProperty(value = "审批时间")
+    private LocalDateTime updatedTime;
+
 }

+ 10 - 1
application-facade/src/main/java/com/factory/web/mapper/pm/PreventMistakeMapper.java

@@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Param;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.factory.base.entity.po.benteler.BentelerPlan;
+import com.factory.web.entity.pm.OnsiteApprovalPlan;
 import com.factory.web.entity.pm.req.SearchApprovalUserReq;
 import com.factory.web.entity.pm.req.SearchCheckRecordReq;
 import com.factory.web.entity.pm.req.SearchPmItemNoGoListReq;
@@ -23,6 +24,7 @@ import com.factory.web.entity.pm.res.PmCheckRecordListRes;
 import com.factory.web.entity.pm.res.PmCheckRecordRes;
 import com.factory.web.entity.pm.res.PmItemNoGoListRes;
 import com.factory.web.entity.pm.res.PmNoGoTaskAapprovalRes;
+import com.factory.web.entity.pm.res.PmPlanCheckListRes;
 import com.factory.web.entity.pm.res.PmPlanListForPadRes;
 import com.factory.web.entity.pm.res.PmPlanListRes;
 import com.factory.web.entity.pm.res.PmTaskListRes;
@@ -43,7 +45,7 @@ public interface PreventMistakeMapper extends BaseMapper<BentelerPlan> {
      * @param req
      * @return 防错计划点检列表
      */
-    public Page<PmPlanListRes> getPmPlanCheckList(@Param("page") Page page, @Param("req") SearchPmPlanCheckListReq req);
+    public Page<PmPlanCheckListRes> getPmPlanCheckList(@Param("page") Page page, @Param("req") SearchPmPlanCheckListReq req);
 
 	/**
      * 取得防错计划列表
@@ -115,4 +117,11 @@ public interface PreventMistakeMapper extends BaseMapper<BentelerPlan> {
      * @return 不放行任务对应的审批人、审批意见、审批时间
      */
     public PmNoGoTaskAapprovalRes getPmNoGoTaskAapproval(@Param("req") SearchTaskReq req);
+    
+    /**
+     * 取得计划的最新审批信息
+     * @param req
+     * @return 计划的最新审批信息
+     */
+    public OnsiteApprovalPlan getLatestApprovalInfo(@Param("req") SearchPmPlanReq req);
 }

+ 30 - 3
application-facade/src/main/java/com/factory/web/service/impl/pm/PreventMistakeServiceImpl.java

@@ -4,6 +4,7 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.function.Function;
@@ -63,6 +64,7 @@ import com.factory.web.entity.pm.res.PmCheckRecordListRes;
 import com.factory.web.entity.pm.res.PmCheckRecordRes;
 import com.factory.web.entity.pm.res.PmItemNoGoListRes;
 import com.factory.web.entity.pm.res.PmNoGoTaskAapprovalRes;
+import com.factory.web.entity.pm.res.PmPlanCheckListRes;
 import com.factory.web.entity.pm.res.PmPlanListForPadRes;
 import com.factory.web.entity.pm.res.PmPlanListRes;
 import com.factory.web.entity.pm.res.PmPlanRes;
@@ -83,6 +85,8 @@ import com.factory.web.service.pm.OnsiteTitleBlobService;
 import com.factory.web.service.pm.OnsiteWorkshopService;
 import com.factory.web.service.pm.PreventMistakeService;
 
+import io.swagger.annotations.ApiModelProperty;
+
 
 /**
  * 防错计划
@@ -264,9 +268,9 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
      * @return 防错计划点检列表
      */
 	@Override
-    public ResponseBean<PageBean<PmPlanListRes>> getPmPlanCheckList(SearchPmPlanCheckListReq req) {
-    	Page<PmPlanListRes> page = new Page<>(req.getPage(), req.getSize());
-		Page<PmPlanListRes> listResPage = preventMistakeMapper.getPmPlanCheckList(page, req);
+    public ResponseBean<PageBean<PmPlanCheckListRes>> getPmPlanCheckList(SearchPmPlanCheckListReq req) {
+    	Page<PmPlanCheckListRes> page = new Page<>(req.getPage(), req.getSize());
+		Page<PmPlanCheckListRes> listResPage = preventMistakeMapper.getPmPlanCheckList(page, req);
 		return ResponseBeanBuilder.ok(listResPage, Function.identity());
     }
 
@@ -280,6 +284,19 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 	public ResponseBean<PageBean<PmPlanListRes>> getPmPlanList(SearchPmPlanListReq req) {
 		Page<PmPlanListRes> page = new Page<>(req.getPage(), req.getSize());
 		Page<PmPlanListRes> listResPage = preventMistakeMapper.getPmPlanList(page, req);
+		
+		SearchPmPlanReq searchPmPlanReq = null;
+		for (PmPlanListRes pmPlan : listResPage.getRecords()) {
+			searchPmPlanReq = new SearchPmPlanReq();
+			searchPmPlanReq.setBentelerPlanId(pmPlan.getBentelerPlanId());
+			OnsiteApprovalPlan latestApprovalInfo = this.getLatestApprovalInfo(searchPmPlanReq);
+			
+			pmPlan.setApprovalLevel(latestApprovalInfo.getApprovalLevel());
+			pmPlan.setApprovalUserId(latestApprovalInfo.getApprovalUserId());
+			pmPlan.setStatus(latestApprovalInfo.getStatus());
+			pmPlan.setReason(latestApprovalInfo.getReason());
+			pmPlan.setUpdatedTime(latestApprovalInfo.getUpdatedTime());
+		}
 
 //		// TODO 测一下status值是都设置成功
 //		SearchPmPlanReq searchPmPlanReq = null;
@@ -915,6 +932,16 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 		}
 		return ResponseBeanBuilder.ok(pmAllWorkshopList, Function.identity());
 	}
+	
+	/**
+     * 取得计划的最新审批信息
+     * @param req
+     * @return 计划的最新审批信息
+     */
+    public OnsiteApprovalPlan getLatestApprovalInfo(SearchPmPlanReq req) {
+		OnsiteApprovalPlan onsiteApprovalPlan = preventMistakeMapper.getLatestApprovalInfo(req);
+        return onsiteApprovalPlan;
+    }
 
 
     /**

+ 11 - 1
application-facade/src/main/java/com/factory/web/service/pm/PreventMistakeService.java

@@ -2,6 +2,8 @@ package com.factory.web.service.pm;
 
 import java.util.List;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.factory.base.entity.aggregates.PageBean;
 import com.factory.base.entity.aggregates.ResponseBean;
@@ -33,6 +35,7 @@ import com.factory.web.entity.pm.res.PmCheckListRes;
 import com.factory.web.entity.pm.res.PmCheckRecordListRes;
 import com.factory.web.entity.pm.res.PmItemNoGoListRes;
 import com.factory.web.entity.pm.res.PmNoGoTaskAapprovalRes;
+import com.factory.web.entity.pm.res.PmPlanCheckListRes;
 import com.factory.web.entity.pm.res.PmPlanListForPadRes;
 import com.factory.web.entity.pm.res.PmPlanListRes;
 import com.factory.web.entity.pm.res.PmPlanRes;
@@ -77,7 +80,7 @@ public interface PreventMistakeService extends IService<BentelerPlan> {
 	 * @param req
 	 * @return 防错计划点检列表
 	 */
-	public ResponseBean<PageBean<PmPlanListRes>> getPmPlanCheckList(SearchPmPlanCheckListReq req);
+	public ResponseBean<PageBean<PmPlanCheckListRes>> getPmPlanCheckList(SearchPmPlanCheckListReq req);
 
 	/**
 	 * 取得防错计划列表
@@ -277,5 +280,12 @@ public interface PreventMistakeService extends IService<BentelerPlan> {
 	 * @return 所有工作站
 	 */
 	public ResponseBean<List<PmAllWorkshopListRes>> getAllWorkshopList(SearchAllWorkshopReq req);
+	
+	/**
+     * 取得计划的最新审批信息
+     * @param req
+     * @return 计划的最新审批信息
+     */
+    public OnsiteApprovalPlan getLatestApprovalInfo(SearchPmPlanReq req);
 
 }

+ 27 - 13
application-facade/src/main/resources/mapper/PreventMistakeMapper.xml

@@ -4,7 +4,7 @@
 <mapper namespace="com.factory.web.mapper.pm.PreventMistakeMapper">
 
     <!--取得防错计划点检列表(审批通过的   防错计划)(计划当天点检状态,plan_status,0未完成 1已完成 2待重检) -->
-    <select id="getPmPlanCheckList" resultType="com.factory.web.entity.pm.res.PmPlanListRes">
+    <select id="getPmPlanCheckList" resultType="com.factory.web.entity.pm.res.PmPlanCheckListRes">
         SELECT
 			bp.id AS benteler_plan_id,
 			bp.`name` AS benteler_plan_name,
@@ -67,14 +67,12 @@
         SELECT
 			bp.id AS benteler_plan_id,
 			bp.`name` AS benteler_plan_name,
-			GROUP_CONCAT( uu.`name` ) AS check_person,
 			bp.created_time,
 			bp.pause_flag,
+			bp.plan_type,
 			ps.plan_status
 		FROM
 			benteler_plan bp,
-			onsite_calendar oc,
-			us_user uu,
 			(
 			    SELECT a.id,
 						 a.benteler_plan_id,
@@ -98,7 +96,7 @@
 									onsite_approval_plan oap 
 								WHERE
 									bp.id = oap.benteler_plan_id 
-									AND bp.plan_type = 2 
+									 
 								GROUP BY
 									bp.id
 							 ) b
@@ -106,18 +104,14 @@
 				AND    a.approval_level = b.approval_level
 			) ps
 		WHERE
-			bp.id = oc.benteler_plan_id 
-			AND oc.user_id = uu.id
-		    AND bp.id = ps.benteler_plan_id 	
-			AND bp.plan_type = 2 
+			bp.id = ps.benteler_plan_id
+		    AND ps.plan_status in (0, 1, 2)
 			<if test="req.bentelerPlanName != null and req.bentelerPlanName != ''">
 		    AND bp.`name` LIKE CONCAT('%', #{req.bentelerPlanName}, '%')
 		    </if>
-		    <if test="req.planStatus != null and req.planStatus != ''">
-		    AND ps.plan_status = #{req.planStatus}
+		    <if test="req.planType != null">
+		    AND bp.plan_type = #{req.planType}
 		    </if>
-		GROUP BY
-			bp.id
     </select>
     
     <!--取得防错计划当天任务信息-->
@@ -301,4 +295,24 @@
 		AND     oir.onsite_task_id = #{req.onsiteTaskId}
     </select>
      -->
+    
+    <!--取得审批人 -->
+    <select id="getLatestApprovalInfo" resultType="com.factory.web.entity.pm.OnsiteApprovalPlan">
+        SELECT  oap.benteler_plan_id,
+		        oap.approval_level,
+		        oap.approval_user_id,
+		        oap.`status`,
+		        oap.reason,
+		        oap.updated_time
+		FROM    onsite_approval_plan oap,
+		(
+		SELECT  oap.benteler_plan_id ,
+		        MAX(oap.approval_level) AS approval_level
+		FROM    onsite_approval_plan oap
+		WHERE   oap.benteler_plan_id = #{req.bentelerPlanId}
+		) a
+		WHERE   oap.benteler_plan_id = a.benteler_plan_id
+		AND     oap.approval_level = a.approval_level
+		AND     oap.benteler_plan_id = #{req.bentelerPlanId}
+    </select>
 </mapper>