| | |
| | | package com.ruoyi.process.service.impl; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.YearMonth; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | |
| | | |
| | | // 查询上一个月第一条的记录信息, 判断被监督人去另外一个 |
| | | if (detailsRecord == null) { |
| | | |
| | | // 查询详情信息 |
| | | QualitySuperviseDetails qualitySuperviseDetails = qualitySuperviseDetailsMapper.selectById(superviseDetailsId); |
| | | // 查询上一个月第一条的记录信息, 判断被监督人去另外一个 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.M"); |
| | | YearMonth yearMonth = YearMonth.parse(qualitySuperviseDetails.getSuperviseTime(), formatter); |
| | | YearMonth previousYearMonth = yearMonth.minusMonths(1); |
| | | |
| | | LocalDate startDate = previousYearMonth.atDay(1); |
| | | LocalDate endDate = previousYearMonth.atEndOfMonth(); |
| | | |
| | | LocalDateTime startDateTime = startDate.atStartOfDay(); |
| | | LocalDateTime endDateTime = endDate.atTime(23, 59, 59); |
| | | |
| | | DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | // 获取开始时间和结束时间 |
| | | String startDateTimeStr = startDateTime.format(outputFormatter); |
| | | String endDateTimeStr = endDateTime.format(outputFormatter); |
| | | |
| | | QualitySuperviseDetailsRecord laseRecord = qualitySuperviseDetailsRecordMapper.selectOne(Wrappers.<QualitySuperviseDetailsRecord>lambdaQuery() |
| | | .between(QualitySuperviseDetailsRecord::getCreateTime, startDateTimeStr, endDateTimeStr) |
| | | .isNotNull(QualitySuperviseDetailsRecord::getSupervisor) |
| | | .last("limit 1")); |
| | | |
| | | String supervisor = null; |
| | | |
| | | if (laseRecord != null) { |
| | | // 查询计划获取另一个监督员 |
| | | QualitySupervise qualitySupervise = baseMapper.selectById(qualitySuperviseDetails.getSuperviseId()); |
| | | if (StringUtils.isNotBlank(qualitySupervise.getRecordUserIds())) { |
| | | List<String> recordUserIds = StrUtil.split(qualitySupervise.getRecordUserIds(), ','); |
| | | List<User> users = userMapper.selectList(Wrappers.<User>lambdaQuery() |
| | | .in(User::getId, recordUserIds)); |
| | | if (CollectionUtils.isNotEmpty(users) && users.size() == 2) { |
| | | // 判断是否一样, 一样获取另外一个 |
| | | if (users.get(0).getName().equals(laseRecord.getSupervisor())) { |
| | | supervisor = users.get(1).getName(); |
| | | } else { |
| | | supervisor = users.get(0).getName(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | detailsRecord = new QualitySuperviseDetailsRecord(); |
| | | detailsRecord.setSuperviseDetailsId(superviseDetailsId); |
| | | detailsRecord.setTestMember(qualitySuperviseDetails.getSupervisee()); |
| | | detailsRecord.setSupervisor(null); |
| | | detailsRecord.setSupervisor(supervisor); |
| | | |
| | | detailsRecord.setPersonnel("()有相应检测员的上岗证"); |
| | | detailsRecord.setPersonnel(SecurityUtils.getLoginUser().getUser().getNickName() + "有相应检测员的上岗证"); |
| | | detailsRecord.setEnvironment("温度:()℃ 湿度:()%"); |
| | | detailsRecord.setInspectionRecord("检测人员()进行检测记录,记录内容真实有效"); |
| | | detailsRecord.setExaminingReport("由()黄秋实出示的检测报告符合规范要求"); |
| | | detailsRecord.setInspectionRecord("检测人员" + SecurityUtils.getLoginUser().getUser().getNickName() + "进行检测记录,记录内容真实有效"); |
| | | detailsRecord.setExaminingReport("由" + SecurityUtils.getLoginUser().getUser().getNickName() + "出示的检测报告符合规范要求"); |
| | | detailsRecord.setSupervisionEvaluation("检测按照要求进行,判定为满意"); |
| | | detailsRecord.setHandlingAdvice("/"); |
| | | |