Browse Source

防错-接口

wuzhenyue 3 years ago
parent
commit
219248a02e

+ 9 - 0
application-facade/src/main/java/com/factory/controller/web/PreventMistakeController.java

@@ -21,6 +21,7 @@ import com.factory.web.entity.pm.req.AddPmPlanReq;
 import com.factory.web.entity.pm.req.EditItemResultListReq;
 import com.factory.web.entity.pm.req.EditPmPlanReq;
 import com.factory.web.entity.pm.req.PmPlanPauseFlagReq;
+import com.factory.web.entity.pm.req.SearchAllWorkshopReq;
 import com.factory.web.entity.pm.req.SearchPmItemNoGoListReq;
 import com.factory.web.entity.pm.req.SearchPmItemResultListReq;
 import com.factory.web.entity.pm.req.SearchPmPlanCheckListReq;
@@ -30,6 +31,7 @@ import com.factory.web.entity.pm.req.SearchPmPlanReq;
 import com.factory.web.entity.pm.req.SearchPmWorkshopNoGoListReq;
 import com.factory.web.entity.pm.req.SearchTaskReq;
 import com.factory.web.entity.pm.req.SearchWorkshopReq;
+import com.factory.web.entity.pm.res.PmAllWorkshopListRes;
 import com.factory.web.entity.pm.res.PmCheckListRes;
 import com.factory.web.entity.pm.res.PmItemNoGoListRes;
 import com.factory.web.entity.pm.res.PmItemResultListRes;
@@ -199,6 +201,13 @@ public class PreventMistakeController {
 	public ResponseBean editItemResult(@RequestBody EditItemResultListReq req) {
 		return ResponseBeanBuilder.ok(preventMistakeService.editItemResult(req));
 	}
+	
+	@ApiOperation(value = "取得所有工作站")
+	@PostMapping("/getAllWorkshopList")
+	@ApiOperationSupport(order = 21)
+	public ResponseBean<List<PmAllWorkshopListRes>> getAllWorkshopList(@RequestBody SearchAllWorkshopReq req) {
+		return preventMistakeService.getAllWorkshopList(req);
+	}
 
 	// 计划审批、任务审批,都在小程序端做
 }

+ 29 - 0
application-facade/src/main/java/com/factory/web/entity/pm/req/SearchAllWorkshopReq.java

@@ -0,0 +1,29 @@
+package com.factory.web.entity.pm.req;
+
+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 SearchAllWorkshopReq {
+	
+	@ApiModelProperty(value = "工作站名称")
+	private String wsName;
+	
+}

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

@@ -0,0 +1,37 @@
+package com.factory.web.entity.pm.res;
+
+import java.io.Serializable;
+
+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 PmAllWorkshopListRes implements Serializable {
+	
+	@ApiModelProperty(value = "计划ID")
+	private Long bentelerPlanId;
+
+	@ApiModelProperty(value = "工作站id")
+	private Long workshopId;
+
+	@ApiModelProperty(value = "工作站名称")
+	private String wsName;
+	
+}

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

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -43,6 +44,7 @@ import com.factory.web.entity.pm.req.OnsiteCalendarReq;
 import com.factory.web.entity.pm.req.OnsiteItemReq;
 import com.factory.web.entity.pm.req.OnsiteWorkshopReq;
 import com.factory.web.entity.pm.req.PmPlanPauseFlagReq;
+import com.factory.web.entity.pm.req.SearchAllWorkshopReq;
 import com.factory.web.entity.pm.req.SearchApprovalUserReq;
 import com.factory.web.entity.pm.req.SearchPmItemNoGoListReq;
 import com.factory.web.entity.pm.req.SearchPmItemResultListReq;
@@ -54,6 +56,7 @@ import com.factory.web.entity.pm.req.SearchPmWorkshopNoGoListReq;
 import com.factory.web.entity.pm.req.SearchTaskReq;
 import com.factory.web.entity.pm.req.SearchWorkshopReq;
 import com.factory.web.entity.pm.res.ApprovalUserRes;
+import com.factory.web.entity.pm.res.PmAllWorkshopListRes;
 import com.factory.web.entity.pm.res.PmCheckListRes;
 import com.factory.web.entity.pm.res.PmItemNoGoListRes;
 import com.factory.web.entity.pm.res.PmItemResultListRes;
@@ -854,6 +857,32 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
 			e.printStackTrace();
 		}
 	}
+	
+	/**
+	 * 取得所有工作站
+	 * 
+	 * @param req
+	 * @return 所有工作站
+	 */
+	public ResponseBean<List<PmAllWorkshopListRes>> getAllWorkshopList(SearchAllWorkshopReq req) {
+		QueryWrapper<OnsiteWorkshop> queryWrapper = new QueryWrapper<>();
+		if (req.getWsName() != null && !"".equals(req.getWsName())) {
+			queryWrapper.lambda().like(OnsiteWorkshop::getWsName, req.getWsName());
+		}
+		List<OnsiteWorkshop> onsiteWorkshopList = onsiteWorkshopService.list(queryWrapper);
+		
+		List<PmAllWorkshopListRes> pmAllWorkshopList = new ArrayList<PmAllWorkshopListRes>();
+		PmAllWorkshopListRes pmAllWorkshop = null;
+		for (OnsiteWorkshop onsiteWorkshop : onsiteWorkshopList) {
+			pmAllWorkshop = new PmAllWorkshopListRes();
+			pmAllWorkshop.setBentelerPlanId(onsiteWorkshop.getBentelerPlanId());			
+			pmAllWorkshop.setWorkshopId(onsiteWorkshop.getId());
+			pmAllWorkshop.setWsName(onsiteWorkshop.getWsName());
+			
+			pmAllWorkshopList.add(pmAllWorkshop);
+		}		
+		return ResponseBeanBuilder.ok(pmAllWorkshopList, Function.identity());
+	}
     
     
     /**

+ 10 - 0
application-facade/src/main/java/com/factory/web/service/pm/PreventMistakeService.java

@@ -16,6 +16,7 @@ import com.factory.web.entity.pm.req.AddPmPlanReq;
 import com.factory.web.entity.pm.req.EditItemResultListReq;
 import com.factory.web.entity.pm.req.EditPmPlanReq;
 import com.factory.web.entity.pm.req.PmPlanPauseFlagReq;
+import com.factory.web.entity.pm.req.SearchAllWorkshopReq;
 import com.factory.web.entity.pm.req.SearchApprovalUserReq;
 import com.factory.web.entity.pm.req.SearchPmItemNoGoListReq;
 import com.factory.web.entity.pm.req.SearchPmItemResultListReq;
@@ -27,6 +28,7 @@ import com.factory.web.entity.pm.req.SearchPmWorkshopNoGoListReq;
 import com.factory.web.entity.pm.req.SearchTaskReq;
 import com.factory.web.entity.pm.req.SearchWorkshopReq;
 import com.factory.web.entity.pm.res.ApprovalUserRes;
+import com.factory.web.entity.pm.res.PmAllWorkshopListRes;
 import com.factory.web.entity.pm.res.PmCheckListRes;
 import com.factory.web.entity.pm.res.PmItemNoGoListRes;
 import com.factory.web.entity.pm.res.PmItemResultListRes;
@@ -258,5 +260,13 @@ public interface PreventMistakeService extends IService<BentelerPlan> {
 	 * @return
 	 */
 	public void setOnsiteTaskHis(Long onsiteTaskId);
+	
+	/**
+	 * 取得所有工作站
+	 * 
+	 * @param req
+	 * @return 所有工作站
+	 */
+	public ResponseBean<List<PmAllWorkshopListRes>> getAllWorkshopList(SearchAllWorkshopReq req);
 
 }

+ 3 - 2
application-facade/src/main/resources/mapper/PreventMistakeMapper.xml

@@ -133,7 +133,7 @@
 		AND     bp.id = #{req.bentelerPlanId}
     </select>
     
-    <!--取得检查记录 -->
+    <!--取得检查记录 --><!-- 暂时取onsite_task得时间,如果取onsite_item_result的时间,会不会有第二天才处理头一天的任务的 -->
     <select id="getPmItemResultList" resultType="com.factory.web.entity.pm.res.PmItemResultListRes">
         SELECT oi.workshop_id,
 		       ow.ws_name,
@@ -152,7 +152,8 @@
 		AND    ow.benteler_plan_id = #{req.bentelerPlanId}
 		AND    oc.type_flag = #{req.typeFlag}
 		<if test="req.yearMonth != null and req.yearMonth != ''">
-		AND    DATE_FORMAT(oir.created_time,'%Y-%m') = #{req.yearMonth}
+		AND    DATE_FORMAT(ot.task_time,'%Y-%m') = #{req.yearMonth}
+		-- AND    DATE_FORMAT(oir.created_time,'%Y-%m') = #{req.yearMonth}
 		</if>
 		<!-- 
 		<if test="req.year != null and req.year != ''">