| | |
| | | import org.jeecg.common.constant.DataBaseConstant; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.StrUtils; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; |
| | | import org.jeecg.modules.eam.constant.*; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | |
| | | private ISysDictService sysDictService; |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | @Resource |
| | | private IEamBaseHFCodeService eamBaseHFCodeService; |
| | | |
| | | @Override |
| | | public IPage<EamInspectionOrder> queryPageList(Page<EamInspectionOrder> page, EamInspectionOrderQuery query) { |
| | |
| | | */ |
| | | @Override |
| | | public JSONObject exportInspectionOrderBaseInfo(String equipmentCode, String inspectionDate) { |
| | | if (StrUtils.isEmpty(inspectionDate)) { |
| | | // 获取当前日期 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // 定义日期格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | // 格式化当前月份 |
| | | inspectionDate = currentDate.format(formatter); |
| | | } |
| | | // 创建结果对象 |
| | | JSONObject result = new JSONObject(); |
| | | EamInspectionOrderBaseResponse eamInspectionOrderBaseResponse = eamInspectionOrderMapper.findInsOrderBaseInfo(equipmentCode, inspectionDate); |
| | |
| | | */ |
| | | @Override |
| | | public JSONObject exportInspectionOrderDetailList(String equipmentCode, String inspectionDate) { |
| | | if (StrUtils.isEmpty(inspectionDate)) { |
| | | // 获取当前日期 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // 定义日期格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | // 格式化当前月份 |
| | | inspectionDate = currentDate.format(formatter); |
| | | } |
| | | // 创建结果对象 |
| | | JSONObject result = new JSONObject(); |
| | | List<EamInsOrderDetailResultResponse> eamInsOrderDetailResultResponseList = eamInspectionOrderMapper.findInsOrderDetailList(equipmentCode, inspectionDate); |
| | |
| | | */ |
| | | @Override |
| | | public JSONObject exportInspectionOrderDetailUserList(String equipmentCode, String inspectionDate) { |
| | | if (StrUtils.isEmpty(inspectionDate)) { |
| | | // 获取当前日期 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // 定义日期格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | // 格式化当前月份 |
| | | inspectionDate = currentDate.format(formatter); |
| | | } |
| | | // 创建结果对象 |
| | | JSONObject result = new JSONObject(); |
| | | List<EamInsOrderDetailUserResponse> eamInsOrderDetailUserResponseList = eamInspectionOrderMapper.findInspectionOrderDetailUserList(equipmentCode, inspectionDate); |
| | |
| | | */ |
| | | @Override |
| | | public JSONObject exportWeekInsDetailList(String equipmentCode, String inspectionDate) { |
| | | if (StrUtils.isEmpty(inspectionDate)) { |
| | | // 获取当前日期 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // 定义日期格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | // 格式化当前月份 |
| | | inspectionDate = currentDate.format(formatter); |
| | | } |
| | | // 创建结果对象 |
| | | JSONObject result = new JSONObject(); |
| | | List<EamWeekInsDetailResultResponse> eamWeekInsDetailResultResponseList = eamInspectionOrderMapper.findWeekInsDetailList(equipmentCode, inspectionDate); |
| | |
| | | */ |
| | | @Override |
| | | public JSONObject exportWeekInsOrderDetailUserList(String equipmentCode, String inspectionDate) { |
| | | if (StrUtils.isEmpty(inspectionDate)) { |
| | | // 获取当前日期 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | // 定义日期格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM"); |
| | | // 格式化当前月份 |
| | | inspectionDate = currentDate.format(formatter); |
| | | } |
| | | // 创建结果对象 |
| | | JSONObject result = new JSONObject(); |
| | | List<EamWeekInsDetailUserResponse> eamWeekInsDetailUserResponseList = eamInspectionOrderMapper.findWeekInsOrderDetailUserList(equipmentCode, inspectionDate); |
| | |
| | | //修改状态 |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.WAIT_INSPECTION.name()); |
| | | eamInspectionOrder.setDelFlag(CommonConstant.DEL_FLAG_0); |
| | | //HF码处理 |
| | | EamBaseHFCode eamBaseHFCode = eamBaseHFCodeService.selectByCategory(HfTemplateCategoryEnum.INSPECTION.name()); |
| | | if (eamBaseHFCode == null) { |
| | | return Result.error("添加失败,未配置点检HF编码!"); |
| | | } |
| | | eamInspectionOrder.setHfCode(eamBaseHFCode.getHfCode()); |
| | | save(eamInspectionOrder); |
| | | //处理日点检明细数据 |
| | | if (StrUtil.isNotBlank(eamInspectionOrderRequest.getStandardId())) { |
| | |
| | | throw new JeecgBootException("设备不存在,请检查!"); |
| | | } |
| | | |
| | | // 检查周保过期时间 |
| | | if (eamInspectionOrderRequest.getTableWeekDetailList() == null || eamInspectionOrderRequest.getTableWeekDetailList().isEmpty()) { |
| | | List<EamWeekInspectionDetail> weekInspectionDetailList = eamWeekInspectionDetailService.list(new LambdaQueryWrapper<EamWeekInspectionDetail>().eq(EamWeekInspectionDetail::getStandardId, eamInspectionOrderRequest.getStandardId()).between(EamWeekInspectionDetail::getPlanInspectionDate, DateUtils.getFirstDayOfWeek(eamInspectionOrderRequest.getInspectionDate()), DateUtils.getLastDayOfWeek(eamInspectionOrderRequest.getInspectionDate()))); |
| | | if (weekInspectionDetailList != null && !weekInspectionDetailList.isEmpty()) { |
| | | if (StrUtil.isEmpty(eamInspectionOrderRequest.getOperator())) { |
| | | Date lastDate = DateUtils.getLastDayOfWeek(eamInspectionOrderRequest.getInspectionDate()); |
| | | if (DateUtils.isSameDay(lastDate, new Date())) { |
| | | throw new JeecgBootException("本周点检未完成,请进行填报!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 设置流程变量 |
| | | setupProcessVariables(eamInspectionOrderRequest, eamInspectionOrder, user, equipment); |
| | | |
| | |
| | | values.put("organization", "点检人点检结束"); |
| | | values.put("comment", "点检人点检结束"); |
| | | // 获取下一步执行人 |
| | | List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), null, BusinessCodeConst.PCR0002); |
| | | List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | throw new JeecgBootException("设备未分配给维修工,无法进入下级审批!"); |
| | | } |
| | | List<String> userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | request.setComment("点检人点检结束"); |