|
@@ -5,7 +5,9 @@ import java.io.ByteArrayOutputStream;
|
|
|
import java.io.ObjectInputStream;
|
|
|
import java.io.ObjectOutputStream;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -15,6 +17,7 @@ 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.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -211,6 +214,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
.userId(onsiteCalendarReq.getUserId())
|
|
|
.typeFlag(onsiteCalendarReq.getTypeFlag())
|
|
|
.shift(onsiteCalendarReq.getShift())
|
|
|
+ .effectFlag(false)
|
|
|
.build();
|
|
|
onsiteCalendarService.save(onsiteCalendar);
|
|
|
}
|
|
@@ -225,7 +229,8 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
+ Set<Integer> typeSet = new HashSet<>(4);
|
|
|
+
|
|
|
/* 添加工作站信息 */
|
|
|
List<OnsiteWorkshopReq> onsiteWorkshopList = req.getOnsiteWorkshopList();
|
|
|
for (OnsiteWorkshopReq onsiteWorkshopReq : onsiteWorkshopList) {
|
|
@@ -248,9 +253,11 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
.typeFlag(onsiteItemReq.getTypeFlag())
|
|
|
.inspectionFlag(onsiteItemReq.getInspectionFlag())
|
|
|
.build();
|
|
|
+ typeSet.add(onsiteItemReq.getTypeFlag());
|
|
|
onsiteItemService.save(onsiteItem);
|
|
|
}
|
|
|
}
|
|
|
+ this.checkCalendarEffect(plan.getId(),typeSet);
|
|
|
planService.updateById(BentelerPlan.builder()
|
|
|
.id(plan.getId())
|
|
|
.originalId(plan.getId())
|
|
@@ -467,6 +474,9 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
}
|
|
|
}
|
|
|
boolean clearApproval = false;
|
|
|
+
|
|
|
+ Set<Integer> typeSet = new HashSet<>(4);
|
|
|
+
|
|
|
if(oldPlan.getStatus()>=PlanStatus.APPROVAL_PASS.value) { // 审批通过
|
|
|
/* 添加防错计划 */
|
|
|
plan = BentelerPlan.builder()
|
|
@@ -495,6 +505,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
.userId(onsiteCalendarReq.getUserId())
|
|
|
.typeFlag(onsiteCalendarReq.getTypeFlag())
|
|
|
.shift(onsiteCalendarReq.getShift())
|
|
|
+ .effectFlag(false)
|
|
|
.build();
|
|
|
onsiteCalendarService.save(onsiteCalendar);
|
|
|
}
|
|
@@ -509,7 +520,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/* 添加工作站信息 */
|
|
|
List<OnsiteWorkshopReq> onsiteWorkshopList = req.getOnsiteWorkshopList();
|
|
|
for (OnsiteWorkshopReq onsiteWorkshopReq : onsiteWorkshopList) {
|
|
@@ -533,34 +544,12 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
.typeFlag(onsiteItemReq.getTypeFlag())
|
|
|
.inspectionFlag(onsiteItemReq.getInspectionFlag())
|
|
|
.build();
|
|
|
+ typeSet.add(onsiteItemReq.getTypeFlag());
|
|
|
onsiteItemService.save(onsiteItem);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
} else { // 没审批通过
|
|
|
|
|
|
-// /* 将之前的plan所有信息记到his中(暂时没记审批信息) */
|
|
|
-// int count = onsiteApprovalPlanService.count(
|
|
|
-// Wrappers.<OnsiteApprovalPlan> lambdaQuery()
|
|
|
-// .eq(OnsiteApprovalPlan::getBentelerPlanId, req.getBentelerPlanId())
|
|
|
-// .eq(OnsiteApprovalPlan::getStatus, 2));
|
|
|
-// if (count > 0) { // 当前审批状态为驳回
|
|
|
-// SearchPmPlanReq searchPmPlanReq = new SearchPmPlanReq();
|
|
|
-// searchPmPlanReq.setBentelerPlanId(req.getBentelerPlanId());
|
|
|
-// PmPlanRes pmPlanRes = this.getPmPlan(searchPmPlanReq);
|
|
|
-// try {
|
|
|
-// OnsitePlanHisBlob onsitePlanHisBlob = OnsitePlanHisBlob.builder()
|
|
|
-// .bentelerPlanId(req.getBentelerPlanId())
|
|
|
-// .hisContent(this.objectToByteArray(pmPlanRes))
|
|
|
-// .build();
|
|
|
-// onsitePlanHisBlobService.save(onsitePlanHisBlob);
|
|
|
-// } catch (Exception e) {
|
|
|
-// // TODO Auto-generated catch block
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
/* 修改防错计划 */
|
|
|
plan = BentelerPlan.builder()
|
|
|
.id(oldPlan.getId())
|
|
@@ -588,6 +577,7 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
.month(onsiteCalendarReq.getMonth())
|
|
|
.userId(onsiteCalendarReq.getUserId())
|
|
|
.typeFlag(onsiteCalendarReq.getTypeFlag())
|
|
|
+ .effectFlag(false)
|
|
|
.shift(onsiteCalendarReq.getShift())
|
|
|
.build();
|
|
|
onsiteCalendarService.save(onsiteCalendar);
|
|
@@ -641,15 +631,33 @@ public class PreventMistakeServiceImpl extends ServiceImpl<PreventMistakeMapper,
|
|
|
.typeFlag(onsiteItemReq.getTypeFlag())
|
|
|
.inspectionFlag(onsiteItemReq.getInspectionFlag())
|
|
|
.build();
|
|
|
+ typeSet.add(onsiteItemReq.getTypeFlag());
|
|
|
onsiteItemService.save(onsiteItem);
|
|
|
}
|
|
|
}
|
|
|
clearApproval = true;
|
|
|
}
|
|
|
+ this.checkCalendarEffect(plan.getId(),typeSet);
|
|
|
+
|
|
|
onsiteApprovalPlanService.setApprovalFirst(plan.getId(),clearApproval);
|
|
|
-
|
|
|
+
|
|
|
return ResponseBeanBuilder.ok();
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 设置有效性
|
|
|
+ * @param planId
|
|
|
+ * @param typeSet
|
|
|
+ */
|
|
|
+ private void checkCalendarEffect(Long planId,Set<Integer> typeSet) {
|
|
|
+ for(Integer type:typeSet) {
|
|
|
+ OnsiteCalendar onsiteCalendar = OnsiteCalendar.builder()
|
|
|
+ .bentelerPlanId(planId)
|
|
|
+ .typeFlag(type)
|
|
|
+ .effectFlag(true)
|
|
|
+ .build();
|
|
|
+ onsiteCalendarService.update(new UpdateWrapper<OnsiteCalendar>(onsiteCalendar));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|