| | |
| | | import org.jeecg.modules.eam.request.EamWeekMaintenanceQuery; |
| | | import org.jeecg.modules.eam.request.EamWeekMaintenanceRequest; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.eam.vo.EquipmentInspectionStatistics; |
| | | import org.jeecg.modules.eam.vo.EquipmentMaintenanceStatistics; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCommonService; |
| | | import org.jeecg.modules.flowable.service.IFlowDefinitionService; |
| | | import org.jeecg.modules.flowable.service.IFlowTaskService; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.jeecg.modules.system.vo.UserSelector; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private IEamReportRepairService eamReportRepairService; |
| | | @Autowired |
| | | private IEamEquipmentExtendService eamEquipmentExtendService; |
| | | @Autowired |
| | | private IMdcProductionService mdcProductionService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | } |
| | | if (query.getMaintenanceDateBegin() != null && query.getMaintenanceDateEnd() != null) { |
| | | queryWrapper.between("wmo.maintenance_date", query.getMaintenanceDateBegin(), query.getMaintenanceDateEnd()); |
| | | } |
| | | if(StringUtils.isNotBlank(query.getRandomInspectionFlag())) { |
| | | if(CommonConstant.DEFAULT_1.equals(query.getRandomInspectionFlag())) { |
| | | queryWrapper.eq("wmo.random_inspection_flag", CommonConstant.DEFAULT_1); |
| | | }else { |
| | | queryWrapper.and(q -> q.eq("wmo.random_inspection_flag", CommonConstant.DEFAULT_0).or().isNull("wmo.random_inspection_flag")); |
| | | } |
| | | } |
| | | if(StringUtils.isNotBlank(query.getFinalRandomInspectionFlag())) { |
| | | if(CommonConstant.DEFAULT_1.equals(query.getFinalRandomInspectionFlag())) { |
| | | queryWrapper.eq("wmo.final_random_inspection_flag", CommonConstant.DEFAULT_1); |
| | | }else { |
| | | queryWrapper.and(q -> q.eq("wmo.final_random_inspection_flag", CommonConstant.DEFAULT_0).or().isNull("wmo.final_random_inspection_flag")); |
| | | } |
| | | } |
| | | //排序 |
| | | if (StringUtils.isNotBlank(query.getColumn()) && StringUtils.isNotBlank(query.getOrder())) { |
| | |
| | | entity.setInitialAcceptanceUser(user.getUsername()); |
| | | entity.setInitialAcceptanceComment(request.getInitialAcceptanceComment()); |
| | | entity.setInitialAcceptanceTime(new Date()); |
| | | entity.setRandomInspectionFlag(request.getRandomInspectionFlag()); |
| | | //处理附件 |
| | | if (CollectionUtil.isNotEmpty(request.getInitialAcceptanceFilesResult())) { |
| | | List<FileUploadResult> fileUploadResultList = request.getInitialAcceptanceFilesResult(); |
| | |
| | | entity.setFinalAcceptanceUser(user.getUsername()); |
| | | entity.setFinalAcceptanceComment(request.getFinalAcceptanceComment()); |
| | | entity.setFinalAcceptanceTime(new Date()); |
| | | entity.setFinalRandomInspectionFlag(request.getFinalRandomInspectionFlag()); |
| | | //处理附件 |
| | | if (CollectionUtil.isNotEmpty(request.getFinalAcceptanceFilesResult())) { |
| | | List<FileUploadResult> fileUploadResultList = request.getFinalAcceptanceFilesResult(); |
| | |
| | | return eamWeekMaintenanceOrderMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<EquipmentMaintenanceStatistics> equipmentMaintenanceStatistics(String productionId, LocalDate firstOfMonth, LocalDate today) { |
| | | if (StringUtils.isNotBlank(productionId)) { |
| | | //车间编码不为空 |
| | | List<String> productIds = mdcProductionService.recursionChildren(productionId); |
| | | if (CollectionUtil.isEmpty(productIds)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<EquipmentMaintenanceStatistics> list = this.baseMapper.equipmentMaintenanceStatistics(productIds, firstOfMonth.toString(), today.plusDays(1).toString()); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return list; |
| | | } |
| | | List<EquipmentMaintenanceStatistics> list = this.baseMapper.equipmentMaintenanceStatistics(null, firstOfMonth.toString(), today.plusDays(1).toString()); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | private boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user) { |
| | | List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); |
| | | return todoUsers != null && todoUsers.contains(user.getUsername()); |