|
@@ -2,8 +2,11 @@ package com.platform.service.check.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.platform.common.bean.AbstractPageResultBean;
|
|
|
+import com.platform.common.cache.ConfigCache;
|
|
|
import com.platform.common.enums.DataFilterTypeEnum;
|
|
|
import com.platform.common.exception.BusinessException;
|
|
|
import com.platform.common.model.OauthUser;
|
|
@@ -16,6 +19,8 @@ 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.sqarepartmanage.SparePartInfo;
|
|
|
+import com.platform.dao.entity.upms.SysConfig;
|
|
|
import com.platform.dao.entity.upms.SysFile;
|
|
|
import com.platform.dao.enums.*;
|
|
|
import com.platform.dao.mapper.check.*;
|
|
@@ -33,6 +38,7 @@ import com.platform.dao.vo.tuicalendar.TuiCalendarUtil;
|
|
|
import com.platform.service.base.impl.BaseServiceImpl;
|
|
|
import com.platform.service.check.CheckJobService;
|
|
|
import com.platform.service.sb.SbInfoService;
|
|
|
+import com.platform.service.upms.SysConfigService;
|
|
|
import com.platform.service.upms.SysUserDeptService;
|
|
|
import com.platform.service.util.SysFileUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -42,6 +48,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
import tk.mybatis.mapper.weekend.Weekend;
|
|
|
import tk.mybatis.mapper.weekend.WeekendCriteria;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.time.DayOfWeek;
|
|
@@ -50,10 +57,7 @@ import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
import java.time.temporal.TemporalAdjusters;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @Description 点检记录 service 实现类
|
|
@@ -71,7 +75,7 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
private CheckStandardMapper standardMapper;
|
|
|
private SysUserDeptService sysUserDeptService;
|
|
|
private SbInfoService sbInfoService;
|
|
|
-
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
private final SysFileMapper sysFileMapper;
|
|
|
|
|
|
@Override
|
|
@@ -1112,17 +1116,6 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) throws IOException {
|
|
|
- FileInputStream inputStream = new FileInputStream("C:\\Users\\cyz\\Desktop\\需要被删除的id.txt");
|
|
|
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
|
|
-
|
|
|
- String str = null;
|
|
|
- while((str = bufferedReader.readLine()) != null)
|
|
|
- {
|
|
|
- System.out.println(str+"',");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 查询任务
|
|
|
* 未登录查询当日任务
|
|
@@ -1301,6 +1294,7 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
for(Map<String, LocalDateTime> map: monthStartAndEndList){
|
|
|
CheckJobReportWeekHoursVO vo = new CheckJobReportWeekHoursVO();
|
|
|
List<CheckJobVO> detailList = new ArrayList<CheckJobVO>();
|
|
|
+ vo.setYear(searchYear+"");
|
|
|
vo.setWeek((i++) + "周");
|
|
|
double totalHours = 0;
|
|
|
for(CheckJobVO checkJob: list){
|
|
@@ -1318,9 +1312,78 @@ public class CheckJobServiceImpl extends BaseServiceImpl<CheckJobMapper, CheckJo
|
|
|
vo.setDetailList(detailList);
|
|
|
result.add(vo);
|
|
|
}
|
|
|
+
|
|
|
+ SysConfig sysConfig = sysConfigService.getByCode(SysConfigEnum.CHECK_JOB_WORK.toString());
|
|
|
+ if(sysConfig != null) {
|
|
|
+ List<CheckJobReportWeekHoursVO> voList = JSONArray.parseArray(sysConfig.getContent(), CheckJobReportWeekHoursVO.class);
|
|
|
+ for(CheckJobReportWeekHoursVO r: result){
|
|
|
+ for(CheckJobReportWeekHoursVO v: voList){
|
|
|
+ if(r.getYear().equals(v.getYear()) && r.getWeek().equals(v.getWeek())){
|
|
|
+ r.setUseHours(v.getUseHours());
|
|
|
+ r.setUsePeople(v.getUsePeople());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
/* for(CheckJobReportWeekHoursVO r: result){
|
|
|
System.out.println(r.toString());
|
|
|
}*/
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void saveWorkHour(CheckJobReportWeekHoursVO dto) {
|
|
|
+ SysConfig sysConfig = sysConfigService.getByCode(SysConfigEnum.CHECK_JOB_WORK.toString());
|
|
|
+ if(sysConfig != null){
|
|
|
+ List<CheckJobReportWeekHoursVO> list = JSONArray.parseArray(sysConfig.getContent(), CheckJobReportWeekHoursVO.class);
|
|
|
+ boolean find = false;
|
|
|
+ Iterator<CheckJobReportWeekHoursVO> it = list.iterator();
|
|
|
+ while(it.hasNext()){
|
|
|
+ CheckJobReportWeekHoursVO vo = it.next();
|
|
|
+ if(vo.getYear().equals(dto.getYear()) && vo.getWeek().equals(dto.getWeek())){
|
|
|
+ find = true;
|
|
|
+ it.remove();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(dto);
|
|
|
+ list.sort(Comparator.comparing(CheckJobReportWeekHoursVO::getYear).thenComparing(CheckJobReportWeekHoursVO::getWeek));
|
|
|
+ sysConfig.setContent(JSONObject.toJSONString(list));
|
|
|
+ sysConfigService.modModelByPrimaryKey(sysConfig);
|
|
|
+ }else{
|
|
|
+ throw new BusinessException("系统参数未配置,请先配置:CHECK_JOB_WORK,每周工作负荷");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) throws IOException {
|
|
|
+ List<CheckJobReportWeekHoursVO> list = new ArrayList<CheckJobReportWeekHoursVO>();
|
|
|
+ CheckJobReportWeekHoursVO vo = new CheckJobReportWeekHoursVO();
|
|
|
+ vo.setYear("2021");
|
|
|
+ vo.setWeek("12");
|
|
|
+ vo.setUseHours(3.0);
|
|
|
+ vo.setUsePeople(3.5);
|
|
|
+ list.add(vo);
|
|
|
+
|
|
|
+ CheckJobReportWeekHoursVO vo2 = new CheckJobReportWeekHoursVO();
|
|
|
+ vo2.setYear("2020");
|
|
|
+ vo2.setWeek("1");
|
|
|
+ vo2.setUseHours(5.0);
|
|
|
+ vo2.setUsePeople(4.5);
|
|
|
+ list.add(vo2);
|
|
|
+
|
|
|
+ CheckJobReportWeekHoursVO vo3 = new CheckJobReportWeekHoursVO();
|
|
|
+ vo3.setYear("2020");
|
|
|
+ vo3.setWeek("3");
|
|
|
+ vo3.setUseHours(3.0);
|
|
|
+ vo3.setUsePeople(4.3);
|
|
|
+ list.add(vo3);
|
|
|
+ list.sort(Comparator.comparing(CheckJobReportWeekHoursVO::getYear).thenComparing(CheckJobReportWeekHoursVO::getWeek));
|
|
|
+ System.out.println(JSONObject.toJSONString(list));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void modWorkHour(CheckJobReportWeekHoursVO dto) {
|
|
|
+
|
|
|
+ }
|
|
|
}
|