|
@@ -19,12 +19,15 @@ import com.platform.dao.dto.check.CheckProjectPlanRelationDTO;
|
|
|
import com.platform.dao.dto.sb.SbInfoDTO;
|
|
|
import com.platform.dao.entity.check.*;
|
|
|
import com.platform.dao.entity.sb.SbInfo;
|
|
|
+import com.platform.dao.entity.sb.SbPosition;
|
|
|
import com.platform.dao.entity.sqarepartmanage.SparePartInfo;
|
|
|
import com.platform.dao.entity.upms.SysConfig;
|
|
|
import com.platform.dao.entity.upms.SysFile;
|
|
|
import com.platform.dao.entity.upms.SysUser;
|
|
|
import com.platform.dao.enums.*;
|
|
|
import com.platform.dao.mapper.check.*;
|
|
|
+import com.platform.dao.mapper.sb.SbInfoMapper;
|
|
|
+import com.platform.dao.mapper.sb.SbPositionMapper;
|
|
|
import com.platform.dao.mapper.upms.SysFileMapper;
|
|
|
import com.platform.dao.util.CustomExcelImportUtil;
|
|
|
import com.platform.dao.vo.SysUserVO;
|
|
@@ -35,6 +38,7 @@ import com.platform.dao.vo.report.CheckJobReportWeekHoursVO;
|
|
|
import com.platform.dao.vo.report.RepairReport24VO;
|
|
|
import com.platform.dao.vo.report.RepairReportMttr;
|
|
|
import com.platform.dao.vo.sb.SbInfoVO;
|
|
|
+import com.platform.dao.vo.sb.SbPositionVO;
|
|
|
import com.platform.dao.vo.tuicalendar.ScheduleInfo;
|
|
|
import com.platform.dao.vo.tuicalendar.TuiCalendar;
|
|
|
import com.platform.dao.vo.tuicalendar.TuiCalendarUtil;
|
|
@@ -59,9 +63,12 @@ import java.time.DayOfWeek;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collector;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @Description 点检记录 service 实现类
|
|
@@ -81,6 +88,80 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
private SbInfoService sbInfoService;
|
|
|
private SysConfigService sysConfigService;
|
|
|
private final SysFileMapper sysFileMapper;
|
|
|
+ private SbInfoMapper sbInfoMapper;
|
|
|
+ private SbPositionMapper sbPositionMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public CheckJobVO getCheckJobVODetail(CheckJobDTO checkJobDTO) {
|
|
|
+ CheckJobVO checkJobVO = new CheckJobVO();
|
|
|
+ //车间id,userid
|
|
|
+ List<CheckJobVO> checkJobVOS = getJobVO(checkJobDTO);
|
|
|
+ checkJobVO.setSbNum(checkJobVOS.stream().distinct().map(CheckJobVO::getSbId).collect(Collectors.toList()).size());
|
|
|
+ checkJobVO.setCountNum(checkJobVOS.size());
|
|
|
+ List<String> sbIds = checkJobVOS.stream().distinct().map(CheckJobVO::getSbId).collect(Collectors.toList());
|
|
|
+ List<String> sbNames = checkJobVOS.stream().distinct().map(CheckJobVO::getSbName).collect(Collectors.toList());
|
|
|
+ Integer waitNum = 0;
|
|
|
+ Integer compaleteNum = 0;
|
|
|
+ List<SbInfoVO> sbInfoVOS = new ArrayList<>();
|
|
|
+
|
|
|
+ for (int i=0;i< sbIds.size();i++){
|
|
|
+ Integer checkNums = 0;
|
|
|
+ SbInfoVO info = new SbInfoVO();
|
|
|
+ for (CheckJobVO vo:checkJobVOS){
|
|
|
+ if (vo.getSbId().equals(sbIds.get(i))){
|
|
|
+ checkNums++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info.setCheckNum(checkNums);
|
|
|
+ info.setName(sbNames.get(i));
|
|
|
+ sbInfoVOS.add(info);
|
|
|
+ }
|
|
|
+ if (checkJobVOS.size()>0) {
|
|
|
+ for (CheckJobVO vo : checkJobVOS) {
|
|
|
+ if (vo.getStatus()!=null && vo.getStatus()==1||vo.getStatus()==2){
|
|
|
+// SbInfoVO vo1 = new SbInfoVO();
|
|
|
+// vo1.setName(vo.getSbName());
|
|
|
+// vo1.setId(vo.getSbId());
|
|
|
+
|
|
|
+ //待执行
|
|
|
+ waitNum++;
|
|
|
+ }else if (vo.getStatus()!=null && vo.getStatus()==3){
|
|
|
+ compaleteNum++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ checkJobVO.setSbNum(sbIds.size());
|
|
|
+ checkJobVO.setWaitNum(waitNum);
|
|
|
+ checkJobVO.setCompaleteNum(compaleteNum);
|
|
|
+ checkJobVO.setSbInfoVOS(sbInfoVOS);
|
|
|
+ return checkJobVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<CheckJobVO> getCheckJobVO() {
|
|
|
+ CheckJobDTO checkJobDTO = new CheckJobDTO();
|
|
|
+ List<CheckJobVO> checkJobVOS = getJobVO(checkJobDTO);
|
|
|
+ List<String> sbIds = checkJobVOS.stream().map(CheckJobVO::getSbId).distinct().collect(Collectors.toList());
|
|
|
+ //查出所有的设备
|
|
|
+ List<SbInfoVO> sbInfoVOS = sbInfoMapper.getByIds(sbIds);
|
|
|
+ List<String> positionIds = sbInfoVOS.stream().map(SbInfoVO::getPositionId).distinct().collect(Collectors.toList());
|
|
|
+ List<CheckJobVO> checkJobVOS1 = sbPositionMapper.getByIds(positionIds);
|
|
|
+ return checkJobVOS1;
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<CheckJobVO> getJobVO(CheckJobDTO checkJobDTO){
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ LocalDate date = LocalDate.now();
|
|
|
+ String lastDay = date.with(TemporalAdjusters.lastDayOfMonth()).toString()+" 23:59:59";
|
|
|
+ String firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).toString()+" 00:00:01";
|
|
|
+ DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ checkJobDTO.setActualEndTimeStart(LocalDateTime.parse(firstDay,df));
|
|
|
+ checkJobDTO.setActualEndTimeStart(LocalDateTime.parse(lastDay,df));
|
|
|
+ checkJobDTO.setCheckUserId(userInfo.getUserId());
|
|
|
+ List<CheckJobVO> checkJobVOS = mapper.selectList(checkJobDTO);
|
|
|
+ return checkJobVOS;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public int batchDelete(List<String> ids) {
|