| | |
| | | import org.jeecg.modules.eam.mapper.EamInspectionOrderMapper; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.eam.util.DateUtils; |
| | | import org.jeecg.modules.eam.vo.InspectionVo; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; |
| | |
| | | import org.jeecg.modules.flowable.service.IFlowDefinitionService; |
| | | import org.jeecg.modules.flowable.service.IFlowTaskService; |
| | | import org.jeecg.modules.system.service.ISysDictService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.jeecg.modules.system.vo.UserSelector; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.IntStream; |
| | | |
| | | /** |
| | | * @Description: 点检工单 |
| | |
| | | private IEamMaintenanceStandardDetailService eamMaintenanceStandardDetailService; |
| | | @Resource |
| | | private ISysDictService sysDictService; |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Override |
| | | public IPage<EamInspectionOrder> queryPageList(Page<EamInspectionOrder> page, EamInspectionOrderQuery query) { |
| | |
| | | // 合并函数:当同一“天”有多个对象时,如何处理(这里示例取第一个) |
| | | (existing, replacement) -> existing // 若有重复键,保留已存在的对象 |
| | | )); |
| | | List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | Map<String, Object> resultMap = new LinkedHashMap<>(); |
| | | for (int i = 1; i <= 31; i++) { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | if (groupMap.containsKey(i)) { |
| | | EamInsOrderDetailUserResponse eamInsOrderDetailUserResponse = groupMap.get(i); |
| | | resultMap.put("operator" + i, sysDictService.queryTableDictTextByKey("sys_user", "realname", "username", eamInsOrderDetailUserResponse.getOperator())); |
| | |
| | | resultMap.put("operator" + i, ""); |
| | | resultMap.put("confirmUser" + i, ""); |
| | | } |
| | | resultList.add(resultMap); |
| | | } |
| | | result.put("data", resultList); |
| | | result.put("data", Collections.singletonList(resultMap)); |
| | | return result; |
| | | } |
| | | |
| | |
| | | // 合并函数:当同一“天”有多个对象时,如何处理(这里示例取第一个) |
| | | (existing, replacement) -> existing // 若有重复键,保留已存在的对象 |
| | | )); |
| | | List<Map<String, Object>> resultList = new ArrayList<>(); |
| | | Map<String, Object> resultMap = new LinkedHashMap<>(); |
| | | for (int i = 1; i <= 5; i++) { |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | if (groupMap.containsKey(i)) { |
| | | EamWeekInsDetailUserResponse eamWeekInsDetailUserResponse = groupMap.get(i); |
| | | resultMap.put("operator" + i, sysDictService.queryTableDictTextByKey("sys_user", "realname", "username", eamWeekInsDetailUserResponse.getInspector())); |
| | |
| | | resultMap.put("operator" + i, ""); |
| | | resultMap.put("confirmUser" + i, ""); |
| | | } |
| | | resultList.add(resultMap); |
| | | } |
| | | result.put("data", resultList); |
| | | result.put("data", Collections.singletonList(resultMap)); |
| | | |
| | | return result; |
| | | } |
| | | |
| | |
| | | throw new JeecgBootException("任务不存在、已完成或已被他人认领"); |
| | | } |
| | | |
| | | EamEquipment equipment = eamEquipmentService.getById(eamInspectionOrder.getEquipmentId()); |
| | | if (equipment == null) { |
| | | throw new JeecgBootException("设备不存在,请检查!"); |
| | | } |
| | | |
| | | // 设置流程变量 |
| | | setupProcessVariables(eamInspectionOrderRequest, eamInspectionOrder, user); |
| | | setupProcessVariables(eamInspectionOrderRequest, eamInspectionOrder, user, equipment); |
| | | |
| | | // 完成流程任务 |
| | | Result result = flowTaskService.complete(eamInspectionOrderRequest); |
| | |
| | | return true; |
| | | } |
| | | |
| | | private void setupProcessVariables(EamInspectionOrderRequest request, EamInspectionOrder order, LoginUser user) { |
| | | private void setupProcessVariables(EamInspectionOrderRequest request, EamInspectionOrder order, LoginUser user, EamEquipment equipment) { |
| | | Map<String, Object> values = new HashMap<>(); |
| | | if (InspectionStatus.UNDER_INSPECTION.name().equals(order.getInspectionStatus()) && user.getUsername().equals(order.getOperator())) { |
| | | // 点检人点检结束 |
| | | values.put("dataId", order.getId()); |
| | | values.put("organization", "点检人点检结束"); |
| | | values.put("comment", "点检人点检结束"); |
| | | // 获取下一步执行人 |
| | | List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), null, BusinessCodeConst.PCR0002); |
| | | List<String> userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList()); |
| | | values.put("NextAssignee", userApprovalList); |
| | | request.setComment("点检人点检结束"); |
| | | } else { |
| | | // 维修工确认 |
| | |
| | | eamInspectionOrderDetailService.remove(new QueryWrapper<EamInspectionOrderDetail>().eq("order_id", order.getId())); |
| | | eamInspectionOrderDetailService.saveBatch(request.getTableDetailList()); |
| | | |
| | | //设置周点检 |
| | | if (request.getTableWeekDetailList() != null && !request.getTableWeekDetailList().isEmpty()) { |
| | | // 设置周点检 |
| | | // eamWeekInspectionDetailService.remove(new QueryWrapper<EamWeekInspectionDetail>().eq("order_id", order.getId())); |
| | | eamWeekInspectionDetailService.saveOrUpdateBatch(request.getTableWeekDetailList()); |
| | | List<EamWeekInspectionDetail> tableWeekDetailList = request.getTableWeekDetailList(); |
| | | for (EamWeekInspectionDetail eamWeekInspectionDetail : tableWeekDetailList) { |
| | | if (StringUtils.isEmpty(eamWeekInspectionDetail.getInspectionResult())) { |
| | | break; |
| | | } |
| | | eamWeekInspectionDetail.setInspector(user.getUsername()); |
| | | eamWeekInspectionDetail.setInspectTime(new Date()); |
| | | } |
| | | eamWeekInspectionDetailService.saveOrUpdateBatch(tableWeekDetailList); |
| | | } |
| | | } else if (InspectionStatus.WAIT_CONFIRM.name().equals(order.getInspectionStatus()) && StrUtil.isNotEmpty(request.getConfirmDealType())) { |
| | | // 班组长确认任务 |
| | |
| | | */ |
| | | private void updateEamInspectionOrderDetail(EamInspectionOrder eamInspectionOrder) { |
| | | List<EamInspectionOrderDetail> eamInspectionOrderDetails = eamInspectionOrderDetailService |
| | | .list(new QueryWrapper<EamInspectionOrderDetail>() |
| | | .eq("order_id", eamInspectionOrder.getId()).eq("report_flag", "1").eq("inspection_result", "2")); |
| | | .list(new LambdaQueryWrapper<EamInspectionOrderDetail>() |
| | | .eq(EamInspectionOrderDetail::getOrderId, eamInspectionOrder.getId()).eq(EamInspectionOrderDetail::getReportFlag, "1")); |
| | | |
| | | // TODO 点检完成后自动保修 |
| | | eamReportRepairService.reportRepairFromInspection(eamInspectionOrder.getEquipmentId(), eamInspectionOrder.getOperator(), eamInspectionOrderDetails); |
| | | } |
| | | |