ÎļþÃû´Ó cnas-require/src/main/java/com/ruoyi/require/service/impl/InsOrderPlanServiceImpl.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.require.service.impl; |
| | | package com.ruoyi.inspect.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.lang.UUID; |
| | |
| | | import com.ruoyi.basic.mapper.StandardProductListMapper; |
| | | import com.ruoyi.basic.service.StandardTemplateService; |
| | | import com.ruoyi.basic.vo.StandardProductVO; |
| | | import com.ruoyi.common.constant.ExchangeConstants; |
| | | import com.ruoyi.common.constant.RouterKeyConstants; |
| | | import com.ruoyi.common.core.domain.entity.Custom; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.JackSonUtil; |
| | | import com.ruoyi.common.utils.QueryWrappers; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.framework.util.MatrixToImageWriter; |
| | | import com.ruoyi.framework.util.RedisUtil; |
| | | import com.ruoyi.framework.util.SheetWriteHandlerUtil; |
| | | import com.ruoyi.inspect.amqp.constants.ExchangeConstants; |
| | | import com.ruoyi.inspect.amqp.constants.RouterKeyConstants; |
| | | import com.ruoyi.inspect.dto.*; |
| | | import com.ruoyi.inspect.handler.*; |
| | | import com.ruoyi.inspect.mapper.*; |
| | | import com.ruoyi.inspect.pojo.*; |
| | | import com.ruoyi.inspect.service.InsBushingService; |
| | | import com.ruoyi.inspect.service.InsOrderPlanService; |
| | | import com.ruoyi.inspect.service.InsOrderService; |
| | | import com.ruoyi.inspect.service.InsUnPassService; |
| | | import com.ruoyi.inspect.service.impl.InsOrderServiceImpl; |
| | | import com.ruoyi.framework.util.SheetWriteHandlerUtil; |
| | | import com.ruoyi.inspect.service.impl.InsReportServiceImpl; |
| | | import com.ruoyi.inspect.vo.*; |
| | | import com.ruoyi.performance.mapper.AuxiliaryOutputWorkingHoursMapper; |
| | | import com.ruoyi.performance.mapper.PerformanceShiftMapper; |
| | | import com.ruoyi.performance.mapper.ShiftTimeMapper; |
| | | import com.ruoyi.require.handler.*; |
| | | import com.ruoyi.require.pojo.InformationNotification; |
| | | import com.ruoyi.require.service.InformationNotificationService; |
| | | import com.ruoyi.require.service.InsOrderPlanService; |
| | | import com.ruoyi.notice.pojo.InformationNotification; |
| | | import com.ruoyi.notice.service.InformationNotificationService; |
| | | import com.ruoyi.system.mapper.CustomMapper; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import com.ruoyi.system.service.ISysDictTypeService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | private InsSampleMapper insSampleMapper; |
| | | @Resource |
| | | private InsSampleUserMapper insSampleUserMapper; |
| | | |
| | | @Resource |
| | | private InsOrderMapper insOrderMapper; |
| | | @Resource |
| | |
| | | private InsOrderStateMapper insOrderStateMapper; |
| | | @Resource |
| | | private InsProductMapper insProductMapper; |
| | | @Resource |
| | | private ShiftTimeMapper shiftTimeMapper; |
| | | @Resource |
| | | private PerformanceShiftMapper performanceShiftMapper; |
| | | |
| | | @Resource |
| | | private StandardProductListMapper standardProductListMapper; |
| | |
| | | private InsUnPassService insUnPassService; |
| | | |
| | | @Resource |
| | | AuxiliaryOutputWorkingHoursMapper auxiliaryOutputWorkingHoursMapper; |
| | | private ISysDictTypeService dictTypeService; |
| | | |
| | | @Resource |
| | | private InformationNotificationService informationNotificationService; |
| | |
| | | @Autowired |
| | | private RabbitTemplate rabbitTemplate; |
| | | |
| | | |
| | | |
| | | private ReentrantLock lock = new ReentrantLock(); |
| | | |
| | | @Resource |
| | | private ThreadPoolTaskExecutor threadPoolTaskExecutor; |
| | | |
| | | @Override |
| | | public void exportInsOrderPlanResult(Map<String, Object> data, HttpServletResponse response) { |
| | | public void exportInsOrderPlanResult(QueryResultDTO data, HttpServletResponse response) { |
| | | List<Map<String,Object>> dataList = new ArrayList<>(); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | Object o = getTabHeader(data.get("sonLaboratory").toString(), data.get("samples").toString()).get("tableHeader");// è·åå¨æè¡¨å¤´ |
| | | Object o = getTabHeader(data.getSonLaboratory(), data.getSampleType()).get("tableHeader");// è·åå¨æè¡¨å¤´ |
| | | List<Map<String, Object>> tableHeader = objectMapper.readValue(JSONUtil.toJsonStr(o), new TypeReference<List<Map<String, Object>>>() { |
| | | });// è¡¨å¤´æ°æ® |
| | | Map<String, Object> table = objectMapper.readValue(JSONUtil.toJsonStr(data.get("trendsTable")), new TypeReference<Map<String, Object>>() { |
| | | }); |
| | | List<Map<String, Object>> trendsTable = getInsOrderPlanList(table); // è¡¨æ ¼æ°æ® |
| | | // è¡¨å¤´æ°æ® |
| | | List<Map<String, Object>> trendsTable = getInsOrderPlanList(data); // è¡¨æ ¼æ°æ® |
| | | for (Map<String, Object> trend : trendsTable) { |
| | | Map<String, Object> addMap = new HashMap<>(); |
| | | addMap.put("å§æåå·", trend.get("entrustCode")); |
| | |
| | | |
| | | ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .registerWriteHandler(new SheetWriteHandlerUtil(data.get("samples").toString(),head.size())) |
| | | .registerWriteHandler(new SheetWriteHandlerUtil(data.getSampleType(),head.size())) |
| | | .useDefaultStyle(true).relativeHeadRowIndex(1) |
| | | .registerWriteHandler(horizontalCellStyleStrategy) |
| | | .build(); |
| | |
| | | return headWriteCellStyle; |
| | | } |
| | | @Override |
| | | public List<Map<String, Object>> getInsOrderPlanList(Map<String,Object> data) { |
| | | String sampleType = data.get("sampleType").toString(); |
| | | String sonLaboratory = data.get("sonLaboratory").toString(); |
| | | String entrustCode = data.get("entrustCode").toString(); |
| | | public List<Map<String, Object>> getInsOrderPlanList(QueryResultDTO data) { |
| | | String sampleType = data.getSampleType(); |
| | | String sonLaboratory = data.getSonLaboratory(); |
| | | String entrustCode = data.getEntrustCode(); |
| | | Integer createUser = null; |
| | | String name = ""; |
| | | if(StringUtils.isNotBlank(data.get("createUser").toString())) { |
| | | createUser = Integer.parseInt(data.get("createUser").toString()); |
| | | if(StringUtils.isNotBlank(data.getCreateUser())) { |
| | | createUser = Integer.parseInt(data.getCreateUser()); |
| | | name = userMapper.selectById(createUser).getName(); |
| | | } |
| | | String sampleCode = data.get("sampleCode").toString(); |
| | | String sampleCode = data.getSampleCode(); |
| | | String startTime = ""; |
| | | String endTime = ""; |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | | try { |
| | | if(StringUtils.isNotBlank(data.get("insTime").toString()) && !Objects.isNull(data.get("insTime"))) { |
| | | List insTime = objectMapper.readValue(JSONUtil.toJsonStr(data.get("insTime")), List.class); |
| | | startTime = insTime.get(0).toString(); |
| | | endTime = insTime.get(1).toString(); |
| | | if(CollectionUtils.isNotEmpty(data.getInsTime())) { |
| | | startTime = data.getInsTime().get(0); |
| | | endTime = data.getInsTime().get(1); |
| | | } |
| | | // è¡¨å¤´ä¿¡æ¯ |
| | | List<Map<String, Object>> headerS = objectMapper.readValue(JSONUtil.toJsonStr(data.get("headerS")), new TypeReference<List<Map<String, Object>>>() { |
| | | List<Map<String, Object>> headerS = objectMapper.readValue(JSONUtil.toJsonStr(data.getHeaderS()), new TypeReference<List<Map<String, Object>>>() { |
| | | }); |
| | | // 夿æ¯å¦æ¯æ¸©åº¦å¾ªç¯ |
| | | if(sampleType.equals("温度循ç¯")) { |
| | |
| | | */ |
| | | private String getCurrentUserLaboratory(){ |
| | | // è·åå½å人æå¨å®éªå®¤ |
| | | Integer userId = SecurityUtils.getUserId().intValue(); |
| | | String departLimsId = userMapper.selectById(userId).getDepartLimsId(); |
| | | String departLimsId = userMapper.selectById(SecurityUtils.getUserId()).getDepartLimsId(); |
| | | String laboratory = ""; |
| | | if(StringUtils.isNotBlank(departLimsId)) { |
| | | String[] split = departLimsId.split(","); |
| | |
| | | } |
| | | } |
| | | |
| | | if (samples.contains("温度循ç¯")){ |
| | | if (Objects.nonNull(samples)&&samples.contains("温度循ç¯")){ |
| | | addElementToMaps(maps, "å¾ªç¯æ¬¡æ°", "inspectionItems"); |
| | | addElementToMaps(maps, "温度ç¹", "inspectionItemSubclass"); |
| | | addElementToMaps(maps, "è¡°åç³»æ°1310", "attenuationCoefficient1310"); |
| | |
| | | @Override |
| | | public IPage<InsOrderPlanVO> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) { |
| | | User user = userMapper.selectById(SecurityUtils.getUserId());//å½åç»å½ç人 |
| | | |
| | | //è·åå½å人æå±å®éªå®¤id |
| | | String departLimsId = user.getDepartLimsId(); |
| | | String laboratory = null; |
| | |
| | | } |
| | | insOrderPlanDTO.setUserId(null); |
| | | } |
| | | InsOrderPlanDTO planDTO = new InsOrderPlanDTO(); |
| | | QueryWrapper<InsOrderPlanDTO> wrappers = QueryWrappers.queryWrappers(planDTO); |
| | | QueryWrapper<InsOrderPlanDTO> wrappers = QueryWrappers.queryWrappers(new InsOrderPlanDTO()); |
| | | IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder( |
| | | page, |
| | | userName, |
| | |
| | | |
| | | @Override |
| | | public IPage<InsOrderPlanTaskSwitchVo> inspectionOrderDetailsTaskSwitching(Page page, InsOrderPlanDTO insOrderPlanDTO) { |
| | | Integer userId = SecurityUtils.getUserId().intValue(); |
| | | User user = userMapper.selectById(userId);//å½åç»å½ç人 |
| | | User user = userMapper.selectById(SecurityUtils.getUserId());//å½åç»å½ç人 |
| | | |
| | | //è·åå½å人æå±å®éªå®¤id |
| | | String departLimsId = user.getDepartLimsId(); |
| | |
| | | } |
| | | } |
| | | if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) { |
| | | insOrderPlanDTO.setUserId(userId.longValue()); |
| | | insOrderPlanDTO.setUserId(Long.valueOf(user.getId())); |
| | | } |
| | | String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//è¯éªå®¤ |
| | | IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory); |
| | | return insOrderPage; |
| | | return insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), user.getId(), sonLaboratory, laboratory); |
| | | } |
| | | |
| | | //认é¢ä»»å¡ |
| | |
| | | |
| | | @Override |
| | | public Map<String, Object> doInsOrder(Integer id, String laboratory) { |
| | | // InsOrder insOrder = new InsOrder(); |
| | | // insOrder.setId(id); |
| | | |
| | | InsOrder order = insOrderMapper.selectById(id); |
| | | InsOrderState insOrderState = insOrderStateMapper.selectOne(new LambdaQueryWrapper<InsOrderState>() |
| | |
| | | public IPage<InsOrderFile> getFileList(Page page, InsOrderFile insOrderFile) { |
| | | Integer insOrderId = insOrderFile.getInsOrderId(); |
| | | insOrderFile.setInsOrderId(null); |
| | | IPage<InsOrderFile> insOrderFileIPage = insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile),insOrderId); |
| | | return insOrderFileIPage; |
| | | return insOrderFileMapper.getFileList(page, QueryWrappers.queryWrappers(insOrderFile),insOrderId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | .and(i->i.isNull(InsProduct::getInspectionItemClass).or().eq(InsProduct::getInspectionItemClass,"")) |
| | | );//ç¨æ£éªå项忮µåºå«å
纤é
ç½®ä¸æ¸©åº¦å¾ªç¯ |
| | | //æ¥è¯¢å
¨è²è°±ï¼è¿æ»¤è²æ å¹¶æåº |
| | | List<String> colorList = DictUtils.getDictCache("è²æ ").stream() |
| | | |
| | | List<String> colorList = dictTypeService.selectDictDataByType("fiber_color_type").stream() |
| | | .sorted(Comparator.comparing(SysDictData::getDictSort)) |
| | | .map(SysDictData::getDictValue) |
| | | .map(SysDictData::getDictLabel) |
| | | .collect(Collectors.toList()); |
| | | //æ¾å¥ç®¡éä»¶å¤ç |
| | | long piperCount = insProducts.stream().filter(f->!Objects.isNull(f.getInsBushId())).count(); |