| | |
| | | if (ObjectUtils.isNotEmpty(sampleId)) { |
| | | insOrderFile.setInsSampleId(sampleId); |
| | | } |
| | | if (ObjectUtils.isNotEmpty(sonLaboratory)) { |
| | | insOrderFile.setSonLaboratory(sonLaboratory); |
| | | } |
| | | insOrderFile.setFileName(filename); |
| | | if (contentType != null && contentType.startsWith("image/")) { |
| | | // 是图片 |
| | |
| | | } else { |
| | | InsOrderState insOrderState = new InsOrderState(); |
| | | insOrderState.setInsOrderId(insSample.getInsOrderId()); |
| | | insOrderState.setInsOrderId(insSample.getId()); |
| | | insOrderState.setInsSampleId(insSample.getId()); |
| | | insOrderState.setLaboratory(sonLaboratory); |
| | | insOrderState.setInsState(0); |
| | | insOrderState.setNum(1);//初始是第一次 |
| | |
| | | throw new ErrorException("频率不能为空"); |
| | | } |
| | | Integer userId = getLook.selectPowerByMethodAndUserId(null).get("userId"); |
| | | //查询样品信息 |
| | | InsSample insSample = insSampleMapper.selectById(insProductResultDtos.getSampleId()); |
| | | //查询检验单信息 |
| | | InsOrder insOrder = insOrderMapper.selectById(insProductResultDtos.getOrderId()); |
| | | InsOrderState orderState = insOrderStateMapper.selectOne(Wrappers.<InsOrderState>lambdaQuery() |
| | | .eq(InsOrderState::getInsOrderId, insProductResultDtos.getOrderId()) |
| | | .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId()) |
| | | .eq(InsOrderState::getInsSampleId, insProductResultDtos.getSampleId()) |
| | | .eq(InsOrderState::getLaboratory, insProductResultDtos.getSonLaboratory()) |
| | | .orderByDesc(InsOrderState::getId) |
| | | .last("LIMIT 1"));// 确保只取一条记录 |
| | | //查询样品信息 |
| | | InsSample insSample = insSampleMapper.selectById(insProductResultDtos.getSampleId()); |
| | | List<Integer> list = new ArrayList<>(); |
| | | /*新增检验项目检验值记录表(采取先删后增)*/ |
| | | insProductResult2Mapper.delete(Wrappers.<InsProductResult2>lambdaQuery() |
| | |
| | | insSampleMapper.updateById(insSample); |
| | | } |
| | | /*判断该站点的检验项目是否全部已检*/ |
| | | int count = insProductMapper.selectInsProductCountByOrderId(insProductResultDtos.getOrderId()); |
| | | int count = insProductMapper.selectInsProductCountByOrderId(insSample.getInsOrderId()); |
| | | if (count == 0) { |
| | | insOrderStateMapper.update(new InsOrderState(), Wrappers.<InsOrderState>lambdaUpdate() |
| | | .eq(InsOrderState::getInsOrderId, insProductResultDtos.getOrderId()) |
| | | .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId()) |
| | | .eq(InsOrderState::getInsSampleId, insProductResultDtos.getSampleId()) |
| | | .eq(InsOrderState::getLaboratory, insProductResultDtos.getSonLaboratory()) |
| | | .set(InsOrderState::getInsState, 2)); |
| | |
| | | .set(InsOrderState::getCreateTime, LocalDateTime.now())); |
| | | break; |
| | | case 1: |
| | | //继续试验:该站点任务结束(可以再次扫码检验); |
| | | //继续试验:该样品该站点任务结束(可以再次扫码检验); |
| | | insOrderStateMapper.update(null, Wrappers.<InsOrderState>lambdaUpdate() |
| | | .eq(InsOrderState::getInsOrderId, insSample.getInsOrderId()) |
| | | .eq(InsOrderState::getInsSampleId, sampleId) |
| | |
| | | List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery() |
| | | .eq(InsProduct::getInsSampleId, insSample.getId()) |
| | | .eq(InsProduct::getSonLaboratory, submitPlanDto.getLaboratory()) |
| | | .and(wrapper -> wrapper |
| | | .isNull(InsProduct::getInsResult) |
| | | .or() |
| | | .eq(InsProduct::getInsResult, 2) |
| | | ) |
| | | .eq(InsProduct::getState, 1)); |
| | | if (insProducts.size() > 0) { |
| | | String str = ""; |
| | |
| | | map.put("safe", 0);//是否保密消息.0否 |
| | | map.put("enable_id_trans", 0);//是否开启id转译.0否 |
| | | map.put("enable_duplicate_check", 0);//是否开启重复消息检查.0否 |
| | | qywxApi.send(map); |
| | | //qywxApi.send(map); |
| | | //复核人--检验单相关负责人 |
| | | InsSampleUser insSampleUser = new InsSampleUser(); |
| | | insSampleUser.setUserId(submitPlanDto.getVerifyUser()); |
| | |
| | | } |
| | | for (AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours : submitPlanDto.getAuxiliaryOutputWorkingHoursList()) { |
| | | InsProduct insProduct = insProductMapper.selectById(auxiliaryOutputWorkingHours.getInsProductId()); |
| | | if (isWithinRange) { |
| | | //在时间内就是正常上班 |
| | | auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//非加班委托单号 |
| | | auxiliaryOutputWorkingHours.setWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//非加班工时 |
| | | auxiliaryOutputWorkingHours.setAmount(1);//非加班数量 |
| | | } else { |
| | | //加班 |
| | | auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//加班委托单号 |
| | | auxiliaryOutputWorkingHours.setOvertimeWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//加班工时 |
| | | auxiliaryOutputWorkingHours.setOvertimeAmount(1);//加班数量 |
| | | } |
| | | auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//工时分组 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//日期 |
| | | LocalDateTime localDateTime = LocalDateTime.now(); |
| | | DateTime parse = DateUtil.parse(localDateTime.format(formatter)); |
| | | auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//星期 |
| | | auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//周次 |
| | | auxiliaryOutputWorkingHours.setCheck(userId);//todo 检测人(后面要去掉由前端传入) |
| | | auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); |
| | | if (isWithinRange) { |
| | | //在时间内就是正常上班 |
| | | auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//非加班委托单号 |
| | | auxiliaryOutputWorkingHours.setWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//非加班工时 |
| | | auxiliaryOutputWorkingHours.setAmount(1);//非加班数量 |
| | | } else { |
| | | //加班 |
| | | auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//加班委托单号 |
| | | auxiliaryOutputWorkingHours.setOvertimeWorkTime(auxiliaryOutputWorkingHours.getOutputWorkTime());//加班工时 |
| | | auxiliaryOutputWorkingHours.setOvertimeAmount(1);//加班数量 |
| | | } |
| | | auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//工时分组 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | auxiliaryOutputWorkingHours.setDateTime(LocalDateTime.now().toLocalDate().atStartOfDay().format(formatters));//日期 |
| | | LocalDateTime localDateTime = LocalDateTime.now(); |
| | | DateTime parse = DateUtil.parse(localDateTime.format(formatter)); |
| | | auxiliaryOutputWorkingHours.setWeekDay(getWeek(localDateTime.format(formatters)));//星期 |
| | | auxiliaryOutputWorkingHours.setWeek(String.valueOf(DateUtil.weekOfYear(DateUtil.offsetDay(parse, 1))));//周次 |
| | | auxiliaryOutputWorkingHoursMapper.insert(auxiliaryOutputWorkingHours); |
| | | } |
| | | } |
| | | } |