src/main/java/com/ruoyi/project/tr/specialCheck/Test/ItemDangerReportScheduleTest.java
@@ -14,6 +14,7 @@ import com.ruoyi.project.tr.specialCheck.domin.DTO.SpecialCheckItemDangerLogReportDTO; import com.ruoyi.project.tr.specialCheck.domin.DTO.SpecialCheckTaskLogReportDTO; import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckItemDangerLog; import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckScoreAndDangerLog; import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckTaskLog; import com.ruoyi.project.tr.specialCheck.mapper.*; import org.apache.commons.lang3.ObjectUtils; @@ -43,7 +44,10 @@ private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private TbSpecialCheckItemDangerLogMapper itemDangerLogMapper; private TbSpecialCheckItemLogMapper itemLogMapper; @Autowired private TbSpecialCheckScoreAndDangerLogMapper scoreAndDangerLogMapper; String token = "GT6gGJV7JV"; String key = "Bv+NeBolwqg2Pbc1yVwrZA=="; @@ -104,17 +108,17 @@ * */ System.out.println("【2】检查项与隐患上报-处理数据..."); // List<TbSpecialCheckTaskLog> CJRiskAnaUnits = .listReportUnitDate(); List<TbSpecialCheckItemDangerLog> itemDangerLogLists = itemDangerLogMapper.listItemDangerReportTask(); if (ObjectUtils.isNotEmpty(itemDangerLogLists)){ List<TbSpecialCheckScoreAndDangerLog> scoreAndDangerLogs = scoreAndDangerLogMapper.listScoreAndDangerLogReportList(); if (ObjectUtils.isNotEmpty(scoreAndDangerLogs)){ //封装上报数据,时间格式化 List<SpecialCheckItemDangerLogReportDTO> list = new ArrayList<>(); for (TbSpecialCheckItemDangerLog itemDangerLog : itemDangerLogLists) { SpecialCheckItemDangerLogReportDTO specialCheckItemDangerLogReportDTO = BeanCopyUtils.copyBean(itemDangerLog, SpecialCheckItemDangerLogReportDTO.class); specialCheckItemDangerLogReportDTO.setCreateDate(dateFormat.format(itemDangerLog.getCreateDate())); specialCheckItemDangerLogReportDTO.setUpdateDate(dateFormat.format(itemDangerLog.getUpdateDate())); specialCheckItemDangerLogReportDTO.setCheckDate(dateFormatCheckData.format(itemDangerLog.getCheckDate())); specialCheckItemDangerLogReportDTO.setDeleted(itemDangerLog.getDeleted().toString()); for (TbSpecialCheckScoreAndDangerLog scoreAndDangerLog : scoreAndDangerLogs) { SpecialCheckItemDangerLogReportDTO specialCheckItemDangerLogReportDTO = BeanCopyUtils.copyBean(scoreAndDangerLog, SpecialCheckItemDangerLogReportDTO.class); specialCheckItemDangerLogReportDTO.setCreateDate(dateFormat.format(scoreAndDangerLog.getCreateDate())); specialCheckItemDangerLogReportDTO.setUpdateDate(dateFormat.format(scoreAndDangerLog.getUpdateDate())); specialCheckItemDangerLogReportDTO.setCheckDate(dateFormatCheckData.format(scoreAndDangerLog.getCheckDate())); specialCheckItemDangerLogReportDTO.setDeleted(scoreAndDangerLog.getDeleted().toString()); list.add(specialCheckItemDangerLogReportDTO); } // logger.info("【【原始数据】】" + JSONObject.toJSONString(list)); @@ -184,13 +188,13 @@ logger.info("【检查项与隐患】数据上报结果:" + CJOverhaulLogResult.getCode()); //设置所有数据上报成功 if (CJOverhaulLogResult.getCode().equals(CJReportEnum.SUCCESS.getCode()) || CJOverhaulLogResult.getCode().equals(CJReportEnum.SUCESS_AND_FAIL.getCode())){ for (TbSpecialCheckItemDangerLog itemDangerLo : itemDangerLogLists) { for (TbSpecialCheckScoreAndDangerLog itemDangerLo : scoreAndDangerLogs) { HandlerSpecialCheckReportParam handlerCJReportParam = new HandlerSpecialCheckReportParam(); //封装数据 handlerCJReportParam.setId(itemDangerLo.getId()); handlerCJReportParam.setReportStatus(SyncEnum.SYNC_EXEC_SUCCESS.getCode()); handlerCJReportParam.setReportTime(nowDate); itemDangerLogMapper.updateItemDangerReportStatusById(handlerCJReportParam); scoreAndDangerLogMapper.updateItemDangerReportStatusById(handlerCJReportParam); } } //设置上报失败的数据,上报失败 @@ -202,11 +206,9 @@ handlerCJReportParam.setId(failId); handlerCJReportParam.setReportStatus(SyncEnum.SYNC_EXEC_FAIL.getCode()); handlerCJReportParam.setReportTime(nowDate); itemDangerLogMapper.updateItemDangerReportStatusById(handlerCJReportParam); scoreAndDangerLogMapper.updateItemDangerReportStatusById(handlerCJReportParam); } } // logger.info("【1】安全风险分析单元-数据处理完成"); src/main/java/com/ruoyi/project/tr/specialCheck/Test/SpecialCheckTaskDownload.java
对比新文件 @@ -0,0 +1,335 @@ package com.ruoyi.project.tr.specialCheck.Test; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.ruoyi.project.tr.riskList.service.IRiskListService; import com.ruoyi.project.tr.specialCheck.domin.DownloadDTO.*; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckItem; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckScore; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask; import com.ruoyi.project.tr.specialCheck.domin.TbCheckConfig; import com.ruoyi.project.tr.specialCheck.mapper.*; import org.bouncycastle.crypto.engines.AESFastEngine; import org.bouncycastle.crypto.modes.GCMBlockCipher; import org.bouncycastle.crypto.params.AEADParameters; import org.bouncycastle.crypto.params.KeyParameter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.time.format.DateTimeFormatter; import java.util.*; @Component public class SpecialCheckTaskDownload { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private TbBaseCheckCompanyMapper companyTbRepository; @Autowired private TbBaseCheckItemMapper itemTbRepository; @Autowired private TbBaseCheckScoreMapper scoreTbRepository; @Autowired private TbBaseCheckTaskMapper taskTbRepository; @Autowired private TbSpecialCheckTaskLogMapper taskSpecialLogMapper; @Autowired private IRiskListService riskListService; @Autowired private TbCheckConfigMapper configMapper; String token = "GT6gGJV7JV"; String key = "Bv+NeBolwqg2Pbc1yVwrZA=="; String iv = "4QC9V8eAiB7tdlgBkMsTAw=="; public static final int MAC_BIT_SIZE = 128; public static String encrypt(String plainText, byte[] key, byte[] iv) { String sr; try { byte[] plainBytes = plainText.getBytes(StandardCharsets.UTF_8); GCMBlockCipher cipher = new GCMBlockCipher(new AESFastEngine()); AEADParameters parameters = new AEADParameters(new KeyParameter(key), MAC_BIT_SIZE, iv, null); cipher.init(true, parameters); byte[] encryptedBytes = new byte[cipher.getOutputSize(plainBytes.length)]; int retLen = cipher.processBytes(plainBytes, 0, plainBytes.length, encryptedBytes, 0); cipher.doFinal(encryptedBytes, retLen); sr = Base64.getEncoder().encodeToString(encryptedBytes); } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return sr; } @Transactional // @Scheduled(cron = "0 0 23 * * ?") //每天晚上23点执行一次0 0 22,23 * * ? // @Scheduled(cron = "0 0 22,23 * * ?") //每天晚上22、23点执行一次 // @Scheduled(cron = "0 0/1 * * * ? ") // 分钟 // @Scheduled(cron = "0 0/20 * * * ? ") // 分钟 // @Scheduled(cron = "0/5 * * * * ?") public void execReportDateSchedule() throws UnsupportedEncodingException { logger.info("【####】拉取专项检查数据开始..."); HttpURLConnection con = null; BufferedReader buffer = null; int responseCode = 200; DateTimeFormatter dateFormatCheckData = DateTimeFormatter.ofPattern("yyyy-MM-dd"); DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:MM:ss"); Date date = new Date(); //格式化时间,作为token的时间戳 SimpleDateFormat tokenDate= new SimpleDateFormat("yyyyMMddHHmmssSSS"); String formatDate = tokenDate.format(date); logger.info("【token时间】" + formatDate); /** * 1 * */ logger.info("【####】拉取专项任务数据开始..."); TbCheckConfig specialCheckConfig = configMapper.getSpecialCheckConfig(); if (specialCheckConfig.getStatus() == 2){ StringBuffer specialCheckBuffer = null; //上报数据 try { URL url = new URL("http://120.71.182.198:9999/v1/data/receive/getCheckTask"); //得到连接对象 con = (HttpURLConnection) url.openConnection(); //设置请求类型 con.setRequestMethod("POST"); //允许写出 con.setDoOutput(true); //允许读入 con.setDoInput(true); //不使用缓存 con.setUseCaches(false); con.setInstanceFollowRedirects(true); //设置请求头 con.setRequestProperty("X-Access-Token",token+formatDate.toString()); //设置Content-Type,此处根据实际情况确定 con.setRequestProperty("Content-Type", "application/json;charset=utf8"); OutputStream os = con.getOutputStream(); //本段日志,测试成功后,可注释掉 if (responseCode == HttpURLConnection.HTTP_OK) { //得到响应流 InputStream inputStream = con.getInputStream(); //将响应流转换成字符串 specialCheckBuffer = new StringBuffer(); String line; buffer = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); while ((line = buffer.readLine()) != null) { specialCheckBuffer.append(line); } // logger.info("result:" + unitResultBuffer.toString()); System.out.println("result:" + specialCheckBuffer.toString()); } } catch (Exception e) { e.printStackTrace(); } //接收返回值,保存返回值 TbBaseCheckTaskDownloadBO checkTaskDownloadDTO = JSONObject.parseObject(specialCheckBuffer.toString(), TbBaseCheckTaskDownloadBO.class); //接收返回值,保存返回值 CheckTaskData tasks = JSONObject.parseObject(checkTaskDownloadDTO.getData(), CheckTaskData.class); if (tasks.getCheckTaskLists().size() > 0){ for (TbBaseCheckTask checkTask : tasks.getCheckTaskLists()) { checkTask.setStatus(1); int insert = taskTbRepository.insert(checkTask); } } logger.info("【专项检查任务】-读取任务结果:" + checkTaskDownloadDTO.getCode()); System.out.println("【专项检查任务】-读取任务完成"); }else { System.out.println("【专项检查任务】- 不读取任务"); } /** * 2 * */ logger.info("【####】拉取检查项数据开始..."); if (specialCheckConfig.getStatus() == 2){ StringBuffer specialCheckBuffer = null; ItemDownloadRespDTO itemDownloadRespDTO = new ItemDownloadRespDTO(); TbBaseCheckTask baseCheckTask = taskTbRepository.getBaseCheckTaskByStatus(date); Page page = new Page(); page.setCurrent(String.valueOf(1)); page.setSize(String.valueOf(1000)); itemDownloadRespDTO.setTaskId(baseCheckTask.getId()); itemDownloadRespDTO.setPage(page); //加密请求数据 String AESReportUnitDate = encrypt(JSONObject.toJSONString(itemDownloadRespDTO), key.getBytes(), iv.getBytes()); //上报数据 try { URL url = new URL("http://120.71.182.198:9999/v1/data/receive/getCheckItem"); //得到连接对象 con = (HttpURLConnection) url.openConnection(); //设置请求类型 con.setRequestMethod("POST"); //允许写出 con.setDoOutput(true); //允许读入 con.setDoInput(true); //不使用缓存 con.setUseCaches(false); con.setInstanceFollowRedirects(true); //设置请求头 con.setRequestProperty("X-Access-Token",token+formatDate.toString()); //设置Content-Type,此处根据实际情况确定 con.setRequestProperty("Content-Type", "application/json;charset=utf8"); OutputStream os = con.getOutputStream(); Map paraMap = new HashMap(); paraMap.put("data", AESReportUnitDate); /**封装数据*/ System.out.println("【【加密请求体】】" + JSONArray.toJSON(paraMap).toString()); //组装入参,设置请求体 os.write(JSON.toJSONString(paraMap).getBytes()); //本段日志,测试成功后,可注释掉 if (responseCode == HttpURLConnection.HTTP_OK) { //得到响应流 InputStream inputStream = con.getInputStream(); //将响应流转换成字符串 specialCheckBuffer = new StringBuffer(); String line; buffer = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); while ((line = buffer.readLine()) != null) { specialCheckBuffer.append(line); } // logger.info("result:" + unitResultBuffer.toString()); System.out.println("result:" + specialCheckBuffer.toString()); } } catch (Exception e) { e.printStackTrace(); } //接收返回值,保存返回值 ItemDownloadRespBO itemDownloadRespBO = JSONObject.parseObject(specialCheckBuffer.toString(), ItemDownloadRespBO.class); //接收返回值,保存返回值 CheckItemData itemData = JSONObject.parseObject(itemDownloadRespBO.getData(), CheckItemData.class); if (itemData.getItemLists().size() > 0){ for (TbBaseCheckItem item : itemData.getItemLists()) { item.setStatus(1); int insert = itemTbRepository.insert(item); } } taskTbRepository.updateStatusById(baseCheckTask.getId()); logger.info("【专项任务检查项】-读取检查项结果:" + itemDownloadRespBO.getCode()); System.out.println("【专项任务检查项】-读取检查项完成"); }else { System.out.println("【专项任务检查项】- 不读取检查项"); } /** * 3 * */ logger.info("【####】拉取评分细则开始..."); if (specialCheckConfig.getStatus() == 2){ StringBuffer specialCheckBuffer = null; ScoreDownloadRespDTO scoreDownloadRespDTO = new ScoreDownloadRespDTO(); TbBaseCheckItem baseItemByStatus = itemTbRepository.getBaseItemByStatus(date); Page page = new Page(); page.setCurrent(String.valueOf(1)); page.setSize(String.valueOf(1000)); scoreDownloadRespDTO.setTaskId(baseItemByStatus.getTaskId()); scoreDownloadRespDTO.setCheckItemId(baseItemByStatus.getId()); scoreDownloadRespDTO.setPage(page); //加密请求数据 String AESReportUnitDate = encrypt(JSONObject.toJSONString(scoreDownloadRespDTO), key.getBytes(), iv.getBytes()); //上报数据 try { URL url = new URL("http://120.71.182.198:9999/v1/data/receive/getCheckItem"); //得到连接对象 con = (HttpURLConnection) url.openConnection(); //设置请求类型 con.setRequestMethod("POST"); //允许写出 con.setDoOutput(true); //允许读入 con.setDoInput(true); //不使用缓存 con.setUseCaches(false); con.setInstanceFollowRedirects(true); //设置请求头 con.setRequestProperty("X-Access-Token",token+formatDate.toString()); //设置Content-Type,此处根据实际情况确定 con.setRequestProperty("Content-Type", "application/json;charset=utf8"); OutputStream os = con.getOutputStream(); Map paraMap = new HashMap(); paraMap.put("data", AESReportUnitDate); /**封装数据*/ System.out.println("【【加密请求体】】" + JSONArray.toJSON(paraMap).toString()); //组装入参,设置请求体 os.write(JSON.toJSONString(paraMap).getBytes()); //本段日志,测试成功后,可注释掉 if (responseCode == HttpURLConnection.HTTP_OK) { //得到响应流 InputStream inputStream = con.getInputStream(); //将响应流转换成字符串 specialCheckBuffer = new StringBuffer(); String line; buffer = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); while ((line = buffer.readLine()) != null) { specialCheckBuffer.append(line); } // logger.info("result:" + unitResultBuffer.toString()); System.out.println("result:" + specialCheckBuffer.toString()); } } catch (Exception e) { e.printStackTrace(); } //接收返回值,保存返回值 ScoreDownloadRespBO scoreDownloadRespBO = JSONObject.parseObject(specialCheckBuffer.toString(), ScoreDownloadRespBO.class); //接收返回值,保存返回值 CheckScoreData scoreData = JSONObject.parseObject(scoreDownloadRespBO.getData(), CheckScoreData.class); if (scoreData.getScoreLists().size() > 0){ for (TbBaseCheckScore score : scoreData.getScoreLists()) { int insert = scoreTbRepository.insert(score); } } itemTbRepository.updateStatusById(baseItemByStatus.getId()); logger.info("【评分细则】-读取结果:" + scoreDownloadRespBO.getCode()); System.out.println("【评分细则】-读取完成"); }else { System.out.println("【评分细则】- 不读取"); } } } src/main/java/com/ruoyi/project/tr/specialCheck/domin/DownloadDTO/CheckItemData.java
对比新文件 @@ -0,0 +1,20 @@ package com.ruoyi.project.tr.specialCheck.domin.DownloadDTO; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckItem; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask; import lombok.Data; import java.util.List; @Data public class CheckItemData { private String total; private String current; private String size; private List<TbBaseCheckItem> itemLists; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/DownloadDTO/CheckScoreData.java
对比新文件 @@ -0,0 +1,20 @@ package com.ruoyi.project.tr.specialCheck.domin.DownloadDTO; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckItem; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckScore; import lombok.Data; import java.util.List; @Data public class CheckScoreData { private String total; private String current; private String size; private List<TbBaseCheckScore> scoreLists; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/DownloadDTO/CheckTaskData.java
对比新文件 @@ -0,0 +1,13 @@ package com.ruoyi.project.tr.specialCheck.domin.DownloadDTO; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask; import lombok.Data; import java.util.List; @Data public class CheckTaskData { private List<TbBaseCheckTask> checkTaskLists; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/DownloadDTO/ItemDownloadRespBO.java
对比新文件 @@ -0,0 +1,17 @@ package com.ruoyi.project.tr.specialCheck.domin.DownloadDTO; import lombok.Data; @Data public class ItemDownloadRespBO { /** * 返回code * */ private String code; /** * * */ private String data; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/DownloadDTO/ItemDownloadRespDTO.java
对比新文件 @@ -0,0 +1,11 @@ package com.ruoyi.project.tr.specialCheck.domin.DownloadDTO; import lombok.Data; @Data public class ItemDownloadRespDTO { private String taskId; private Page page; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/DownloadDTO/Page.java
对比新文件 @@ -0,0 +1,13 @@ package com.ruoyi.project.tr.specialCheck.domin.DownloadDTO; import lombok.Data; @Data public class Page { //分页页码 private String current; //分页大小,最小10最大1000 private String size; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/DownloadDTO/ScoreDownloadRespBO.java
对比新文件 @@ -0,0 +1,17 @@ package com.ruoyi.project.tr.specialCheck.domin.DownloadDTO; import lombok.Data; @Data public class ScoreDownloadRespBO { /** * 返回code * */ private String code; /** * * */ private String data; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/DownloadDTO/ScoreDownloadRespDTO.java
对比新文件 @@ -0,0 +1,13 @@ package com.ruoyi.project.tr.specialCheck.domin.DownloadDTO; import lombok.Data; @Data public class ScoreDownloadRespDTO { private String taskId; private String checkItemId; private Page page; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/DownloadDTO/TbBaseCheckTaskDownloadBO.java
对比新文件 @@ -0,0 +1,17 @@ package com.ruoyi.project.tr.specialCheck.domin.DownloadDTO; import lombok.Data; @Data public class TbBaseCheckTaskDownloadBO { /** * 返回code * */ private String code; /** * * */ private String data; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/TbBaseCheckItem.java
@@ -35,4 +35,6 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime updateDate; private Integer status; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/TbBaseCheckTask.java
@@ -36,4 +36,5 @@ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime updateDate; private Integer status; } src/main/java/com/ruoyi/project/tr/specialCheck/domin/TbCheckConfig.java
对比新文件 @@ -0,0 +1,22 @@ package com.ruoyi.project.tr.specialCheck.domin; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.time.LocalDateTime; @Data @TableName("tb_check_config") public class TbCheckConfig { @TableId(type = IdType.AUTO) private Long id; //1-不上报;2-上报 private Integer status; } src/main/java/com/ruoyi/project/tr/specialCheck/mapper/TbBaseCheckItemMapper.java
@@ -6,6 +6,7 @@ import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckItem; import org.springframework.stereotype.Repository; import java.util.Date; import java.util.List; @Repository @@ -14,4 +15,8 @@ List<TbBaseCheckItem> selectTbBaseCheckItemPage(TbBaseCheckItemBO tbBaseCheckItemBO); TbBaseCheckItem getBaseCheckItemByItemId(String checkItemId); TbBaseCheckItem getBaseItemByStatus(Date date); int updateStatusById(String id); } src/main/java/com/ruoyi/project/tr/specialCheck/mapper/TbBaseCheckTaskMapper.java
@@ -5,6 +5,7 @@ import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask; import org.springframework.stereotype.Repository; import java.util.Date; import java.util.List; @Repository @@ -15,4 +16,8 @@ TbBaseCheckTask getBaseCheckTaskByTaskId(String taskId); List<TbBaseCheckTask> listTbBaseCheckTask(); TbBaseCheckTask getBaseCheckTaskByStatus(Date date); int updateStatusById(String id); } src/main/java/com/ruoyi/project/tr/specialCheck/mapper/TbCheckConfigMapper.java
对比新文件 @@ -0,0 +1,12 @@ package com.ruoyi.project.tr.specialCheck.mapper; import com.ruoyi.project.tr.specialCheck.domin.TbCheckConfig; import org.springframework.stereotype.Repository; @Repository public interface TbCheckConfigMapper { TbCheckConfig getSpecialCheckConfig(); } src/main/java/com/ruoyi/project/tr/specialCheck/mapper/TbSpecialCheckItemLogMapper.java
@@ -24,7 +24,7 @@ List<TbSpecialCheckItemLog> listItemDangerReportTask(); void updateItemDangerReportStatusById(HandlerSpecialCheckReportParam handlerCJReportParam); int updateItemDangerReportStatusById(HandlerSpecialCheckReportParam handlerCJReportParam); TbSpecialCheckItemLog getSpecialCheckItemDangerLogById(String id); } src/main/java/com/ruoyi/project/tr/specialCheck/mapper/TbSpecialCheckScoreAndDangerLogMapper.java
@@ -28,4 +28,6 @@ void updateItemDangerReportStatusById(HandlerSpecialCheckReportParam handlerCJReportParam); TbSpecialCheckScoreAndDangerLog getSpecialCheckScoreAndDangerLogById(String id); List<TbSpecialCheckScoreAndDangerLog> listScoreAndDangerLogReportList(); } src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckScoreAndDangerLogServiceImpl.java
@@ -9,12 +9,10 @@ import com.ruoyi.doublePrevention.repository.PreventCJReportDangerInfoRepository; import com.ruoyi.doublePrevention.vo.ResultVO; import com.ruoyi.project.system.user.domain.User; import com.ruoyi.project.tr.specialCheck.domin.*; import com.ruoyi.project.tr.specialCheck.domin.BO.HandlerSpecialCheckReportParam; import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckScoreAndDangerLogEditBO; import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckScoreAndDangerLogQueryBO; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckItem; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckScore; import com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask; import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckScoreAndDangerLog; import com.ruoyi.project.tr.specialCheck.mapper.*; import com.ruoyi.project.tr.specialCheck.service.SpecialCheckScoreAndDangerDangerLogService; import org.springframework.beans.factory.annotation.Autowired; @@ -45,6 +43,9 @@ @Autowired private PreventCJReportDangerInfoRepository preventCJReportDangerInfoRepository; @Autowired private TbSpecialCheckItemLogMapper specialCheckItemLogMapper; @@ -149,6 +150,15 @@ resultVO.setMsg(ResultCodes.SERVER_ADD_ERROR.getDesc()); return resultVO; } HandlerSpecialCheckReportParam specialCheckItemLog = new HandlerSpecialCheckReportParam(); specialCheckItemLog.setReportStatus((byte) 2); specialCheckItemLog.setReportTime(dateTime); int i = specialCheckItemLogMapper.updateItemDangerReportStatusById(specialCheckItemLog); if (i == 0){ resultVO.setCode(ResultCodes.SERVER_ADD_ERROR.getCode()); resultVO.setMsg("修改检查项状态失败"); return resultVO; } resultVO.setCode(ResultCodes.OK.getCode()); resultVO.setMsg("新增检查成功"); return resultVO; src/main/resources/mybatis/tr/TbBaseCheckItemMapper.xml
@@ -19,6 +19,7 @@ <result property="createDate" column="create_date"/> <result property="updateBy" column="update_by"/> <result property="updateDate" column="update_date"/> <result property="status" column="status"/> </resultMap> <!-- List<TbBaseCheckItem> selectTbBaseCheckItemPage(TbBaseCheckItemBO tbBaseCheckItemBO);--> @@ -43,4 +44,17 @@ select * from tb_base_check_item where id = #{checkItemId} </select> <!-- TbBaseCheckItem getBaseItemByStatus(Date date);--> <select id="getBaseItemByStatus" resultMap="BaseResultMap"> select * from tb_base_check_item where deleted = 0 and status = 1 limit 1 </select> <!-- int updateStatusById(String id);--> <update id="updateStatusById" parameterType="com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckItem"> update tb_base_check_item set status = 2 where id = #{id} </update> </mapper> src/main/resources/mybatis/tr/TbBaseCheckTaskMapper.xml
@@ -16,6 +16,7 @@ <result property="createDate" column="create_date"/> <result property="updateBy" column="update_by"/> <result property="updateDate" column="update_date"/> <result property="status" column="status"/> </resultMap> <!-- List<TbBaseCheckTaskMapper> selectTbBaseCheckTaskPage(TbBaseCheckTaskDTO tbBaseCheckTaskDTO);--> @@ -45,4 +46,17 @@ select * from tb_base_check_task where deleted = 0 </select> <!-- TbBaseCheckTask getBaseCheckTaskByTime(Date date);--> <select id="getBaseCheckTaskByStatus" resultMap="BaseResultMap"> select * from tb_base_check_task where deleted = 0 and status = 1 limit 1 </select> <!-- int updateStatusById(String id);--> <update id="updateStatusById" parameterType="com.ruoyi.project.tr.specialCheck.domin.TbBaseCheckTask"> update tb_base_check_task set status = 2 where id = #{id} </update> </mapper> src/main/resources/mybatis/tr/TbCheckConfigMapper.xml
对比新文件 @@ -0,0 +1,16 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.project.tr.specialCheck.mapper.TbCheckConfigMapper"> <resultMap id="BaseResultMap" type="com.ruoyi.project.tr.specialCheck.domin.TbCheckConfig"> <id property="id" column="id"/> <result property="status" column="status"/> </resultMap> <select id="getSpecialCheckConfig" resultMap="BaseResultMap"> select * from tb_check_config </select> </mapper> src/main/resources/mybatis/tr/TbSpecialCheckItemLogMapper.xml
@@ -38,7 +38,7 @@ <if test="reportStatus != null"> and report_status = #{reportStatus} </if> order by create_date desc order by report_status desc,check_name asc </where> </select> <!-- TbSpecialCheckItemDangerLog getSpecialCheckItemDangerLogByIndexId(Long indexId);;--> src/main/resources/mybatis/tr/TbSpecialCheckScoreAndDangerLogMapper.xml
@@ -203,4 +203,10 @@ select * from tb_special_check_score_and_danger_log where deleted = 0 and id = #{id} </select> <!-- List<TbSpecialCheckScoreAndDangerLog> listScoreAndDangerLogReportList();--> <select id="listScoreAndDangerLogReportList" resultMap="BaseResultMap"> select * from tb_special_check_score_and_danger_log where deleted = 0 and report_status = 1 </select> </mapper>