|
@@ -75,34 +75,17 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
|
|
|
abnormalPlanReq.setMonth(month);
|
|
|
|
|
|
List<AbnormalPlanRes> releasedAbnormalPlans = new ArrayList<>();
|
|
|
- //已放行
|
|
|
- if (abnormalPlanReq.getAbnormalType() == 2) {
|
|
|
- releasedAbnormalPlans.addAll(abnormalStatisticsMapper.getReleasedAbnormalPlans(abnormalPlanReq));
|
|
|
- }
|
|
|
//已重检
|
|
|
if (abnormalPlanReq.getAbnormalType() == 1) {
|
|
|
releasedAbnormalPlans.addAll(abnormalStatisticsMapper.getRecheckedAbnormalPlans(abnormalPlanReq));
|
|
|
}
|
|
|
+ //已放行
|
|
|
+ if (abnormalPlanReq.getAbnormalType() == 2) {
|
|
|
+ releasedAbnormalPlans.addAll(abnormalStatisticsMapper.getReleasedAbnormalPlans(abnormalPlanReq));
|
|
|
+ }
|
|
|
return releasedAbnormalPlans;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 取得检查结果
|
|
|
- *
|
|
|
- * @param taskId
|
|
|
- * @param itemId
|
|
|
- * @param typeFlag 0表示首件 1表示200件 2表示中断
|
|
|
- * @return 检查结果
|
|
|
- */
|
|
|
- private List<AbnormalItemResultRes> getAbnormalItemResultList(long taskId, long itemId, int typeFlag) {
|
|
|
- SearchAbnormalReq searchReq = new SearchAbnormalReq();
|
|
|
- searchReq.setTaskId(taskId);
|
|
|
- searchReq.setItemId(itemId);
|
|
|
- searchReq.setTypeFlag(typeFlag);
|
|
|
- List<AbnormalItemResultRes> abnormalItemResultList = preventMistakeMapper.getFaAbnormalItemResultList(searchReq);
|
|
|
- return abnormalItemResultList;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 异常放行详情
|
|
|
*
|
|
@@ -116,14 +99,17 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
|
|
|
abnormalDetailRes.setPlanId(bentelerPlan.getId());
|
|
|
abnormalDetailRes.setPlanName(bentelerPlan.getName());
|
|
|
|
|
|
- //获取title
|
|
|
if (abnormalDetailReq.getCheckType() == 1) {
|
|
|
+ //获取title
|
|
|
FirstArticleTitle title = firstArticleService.getFaTitle(abnormalDetailReq.getPlanId());
|
|
|
//判断是否有附件
|
|
|
int attrCount = fileMapper.selectCount(Wrappers.<FileEntry>lambdaQuery()
|
|
|
.eq(FileEntry::getId, title.getUploadAttachmentId()));
|
|
|
abnormalDetailRes.setFirstArticleTitle(title);
|
|
|
abnormalDetailRes.setAttachment(attrCount == 0 ? 0 : 1);
|
|
|
+ //取放行信息
|
|
|
+ List<AbnormalTaskInfoRes> abnormalTaskInfoResList = getFaAbnormalTaskInfoRes(abnormalDetailReq);
|
|
|
+ abnormalDetailRes.setAbnormalTaskInfos(abnormalTaskInfoResList);
|
|
|
}
|
|
|
if (abnormalDetailReq.getCheckType() == 2) {
|
|
|
//获取title
|
|
@@ -133,15 +119,8 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
|
|
|
.eq(FileEntry::getId, title.getUploadAttachmentId()));
|
|
|
abnormalDetailRes.setTitleInfo(title);
|
|
|
abnormalDetailRes.setAttachment(attrCount == 0 ? 0 : 1);
|
|
|
- }
|
|
|
-
|
|
|
- //取放行信息
|
|
|
- if (abnormalDetailReq.getCheckType() == 1) {
|
|
|
- List<AbnormalTaskInfoRes> abnormalTaskInfoResList = getFaAbnormalTaskInfoRes(abnormalDetailReq.getPlanId());
|
|
|
- abnormalDetailRes.setAbnormalTaskInfos(abnormalTaskInfoResList);
|
|
|
- }
|
|
|
- if (abnormalDetailReq.getCheckType() == 2) {
|
|
|
- List<AbnormalTaskInfoRes> abnormalTaskInfoResList = getPMAbnormalTaskInfoRes(abnormalDetailReq.getPlanId());
|
|
|
+ //取放行信息
|
|
|
+ List<AbnormalTaskInfoRes> abnormalTaskInfoResList = getPMAbnormalTaskInfoRes(abnormalDetailReq);
|
|
|
abnormalDetailRes.setAbnormalTaskInfos(abnormalTaskInfoResList);
|
|
|
}
|
|
|
|
|
@@ -151,11 +130,19 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
|
|
|
/**
|
|
|
* 获取首件放行信息
|
|
|
*
|
|
|
- * @param planId
|
|
|
+ * @param abnormalDetailReq
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<AbnormalTaskInfoRes> getFaAbnormalTaskInfoRes(Long planId) {
|
|
|
- List<AbnormalTaskInfoRes> faList = abnormalStatisticsMapper.getFaReleaseListByPlanId(planId);
|
|
|
+ private List<AbnormalTaskInfoRes> getFaAbnormalTaskInfoRes(AbnormalDetailReq abnormalDetailReq) {
|
|
|
+ List<AbnormalTaskInfoRes> faList = new ArrayList<>();
|
|
|
+ if (abnormalDetailReq.getAbnormalType() == 1) {
|
|
|
+ //重检内容
|
|
|
+ faList = abnormalStatisticsMapper.getFaRecheckedListByPlanId(abnormalDetailReq.getPlanId());
|
|
|
+ }
|
|
|
+ if (abnormalDetailReq.getAbnormalType() == 2) {
|
|
|
+ //放行内容
|
|
|
+ faList = abnormalStatisticsMapper.getFaReleaseListByPlanId(abnormalDetailReq.getPlanId());
|
|
|
+ }
|
|
|
|
|
|
for (AbnormalTaskInfoRes faInfo : faList) {
|
|
|
List<FirstArticleWorkshop> firstArticleWorkshopList = firstArticleWorkshopService.list(Wrappers.<FirstArticleWorkshop>lambdaQuery()
|
|
@@ -174,9 +161,15 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
|
|
|
|
|
|
SearchAbnormalReq searchReq = new SearchAbnormalReq();
|
|
|
searchReq.setWorkshopId(abnormalWorkshopList.get(i).getWorkshopId());
|
|
|
- List<AbnormalItemRes> abnormalItemList = preventMistakeMapper.getFaAbnormalItemList(searchReq);
|
|
|
+ List<AbnormalItemRes> abnormalItemList = abnormalStatisticsMapper.getFaAbnormalItemResultList(searchReq);
|
|
|
|
|
|
for (AbnormalItemRes abnormalItemInfo : abnormalItemList) {
|
|
|
+
|
|
|
+ Long userId = abnormalItemInfo.getItemResultUserId();
|
|
|
+ if (null != userId) {
|
|
|
+ String userName = wxPlanService.getUserNameById(abnormalItemInfo.getItemResultUserId());
|
|
|
+ abnormalItemInfo.setItemResultUser(userName);
|
|
|
+ }
|
|
|
List<AbnormalItemResultRes> firstItemResultList = this.getAbnormalItemResultList(faInfo.getTaskId(), abnormalItemInfo.getItemId(), 0);
|
|
|
abnormalItemInfo.setFirstItemResultList(firstItemResultList);
|
|
|
|
|
@@ -188,7 +181,7 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
|
|
|
}
|
|
|
|
|
|
abnormalWorkshopList.get(i).setAbnormalItemList(abnormalItemList);
|
|
|
- faInfo.setAbnormalWorkshopList(abnormalWorkshopList);
|
|
|
+ faInfo.setAbnormalWorkshopList(abnormalWorkshopList.stream().filter(workshop -> null != workshop.getAbnormalItemList() && workshop.getAbnormalItemList().size() > 0).collect(Collectors.toList()));
|
|
|
}
|
|
|
}
|
|
|
return faList;
|
|
@@ -197,11 +190,20 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
|
|
|
/**
|
|
|
* 获取防错放行信息
|
|
|
*
|
|
|
- * @param planId
|
|
|
+ * @param abnormalDetailReq
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<AbnormalTaskInfoRes> getPMAbnormalTaskInfoRes(Long planId) {
|
|
|
- List<AbnormalTaskInfoRes> pmList = abnormalStatisticsMapper.getPmReleaseListByPlanId(planId);
|
|
|
+ private List<AbnormalTaskInfoRes> getPMAbnormalTaskInfoRes(AbnormalDetailReq abnormalDetailReq) {
|
|
|
+ List<AbnormalTaskInfoRes> pmList = new ArrayList<>();
|
|
|
+ if (abnormalDetailReq.getAbnormalType() == 1) {
|
|
|
+ //重检内容
|
|
|
+ pmList = abnormalStatisticsMapper.getPmRecheckedListByPlanId(abnormalDetailReq.getPlanId());
|
|
|
+ }
|
|
|
+ if (abnormalDetailReq.getAbnormalType() == 2) {
|
|
|
+ //放行内容
|
|
|
+ pmList = abnormalStatisticsMapper.getPmReleaseListByPlanId(abnormalDetailReq.getPlanId());
|
|
|
+ }
|
|
|
+
|
|
|
for (AbnormalTaskInfoRes pmInfo : pmList) {
|
|
|
List<OnsiteWorkshop> onsiteWorkshopList = onsiteWorkshopService.list(Wrappers.<OnsiteWorkshop>lambdaQuery()
|
|
|
.eq(OnsiteWorkshop::getBentelerPlanId, pmInfo.getBentelerPlanId()));
|
|
@@ -219,7 +221,7 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
|
|
|
SearchAbnormalReq searchReq = new SearchAbnormalReq();
|
|
|
searchReq.setWorkshopId(abnormalWorkshopList.get(i).getWorkshopId());
|
|
|
searchReq.setTaskId(pmInfo.getTaskId());
|
|
|
- List<AbnormalItemRes> abnormalItemList = preventMistakeMapper.getPmAbnormalItemList(searchReq).stream().filter(abnormalItemRes -> abnormalItemRes.getResult() > 0).collect(Collectors.toList());
|
|
|
+ List<AbnormalItemRes> abnormalItemList = abnormalStatisticsMapper.getPmAbnormalItemResultList(searchReq).stream().filter(abnormalItemRes -> abnormalItemRes.getResult() > 0).collect(Collectors.toList());
|
|
|
for (AbnormalItemRes abnormalItemRes : abnormalItemList) {
|
|
|
Long userId = abnormalItemRes.getItemResultUserId();
|
|
|
if (null != userId) {
|
|
@@ -235,6 +237,23 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
|
|
|
return pmList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 取得检查结果
|
|
|
+ *
|
|
|
+ * @param taskId
|
|
|
+ * @param itemId
|
|
|
+ * @param typeFlag 0表示首件 1表示200件 2表示中断
|
|
|
+ * @return 检查结果
|
|
|
+ */
|
|
|
+ private List<AbnormalItemResultRes> getAbnormalItemResultList(long taskId, long itemId, int typeFlag) {
|
|
|
+ SearchAbnormalReq searchReq = new SearchAbnormalReq();
|
|
|
+ searchReq.setTaskId(taskId);
|
|
|
+ searchReq.setItemId(itemId);
|
|
|
+ searchReq.setTypeFlag(typeFlag);
|
|
|
+ List<AbnormalItemResultRes> abnormalItemResultList = preventMistakeMapper.getFaAbnormalItemResultList(searchReq);
|
|
|
+ return abnormalItemResultList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 验证日期格式
|
|
|
*
|