| | |
| | | REPORT_CONFIG_TASK_FROM_WORK((byte) 4, "隐患排查任务配置"), |
| | | REPORT_CONFIG__CHECK_RECORD((byte) 5, "隐患排查任务记录"), |
| | | REPORT_CONFIG_DANGER_INFO((byte) 6, "隐患信息"), |
| | | OVERHAUL_LOG_DANGER_INFO((byte) 7, "隐患信息"), |
| | | OVERHAUL_LOG_DANGER_INFO((byte) 8, "检修记录"), |
| | | ; |
| | | byte code; |
| | | @JsonValue |
| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import java.io.*;
|
| | | import java.lang.reflect.Array;
|
| | | import java.net.HttpURLConnection;
|
| | | import java.net.URL;
|
| | | import java.nio.charset.StandardCharsets;
|
| | |
| | |
|
| | |
|
| | | @Transactional
|
| | | // @Scheduled(cron = "0 0 23 * * ?") //每天晚上23点执行一次
|
| | | // @Scheduled(cron = "0 0/2 * * * ? ") // 分钟
|
| | | @Scheduled(cron = "0 0 23 * * ?") //每天晚上23点执行一次
|
| | | // @Scheduled(cron = "0 0/1 * * * ? ") // 分钟
|
| | | //@Scheduled(cron = "0/30 * * * * ?")
|
| | | public void execReportDateSchedule() throws UnsupportedEncodingException {
|
| | | logger.info("【####】上报数据开始...");
|
| | |
| | | con.setRequestProperty("X-Access-Token",token+formatDate.toString());
|
| | | OutputStream os = con.getOutputStream();
|
| | | Map paraMap = new HashMap();
|
| | | paraMap.put("data", AESReportTaskFromWork); /**封装数据*/
|
| | | paraMap.put("data", AESReportTaskFromWork);
|
| | | //组装入参,设置请求体
|
| | | os.write(JSON.toJSONString(paraMap).getBytes());
|
| | | //得到响应码
|
| | |
| | | cjReportCheckRecordFromTaskDTO.setIsDefend(cjRecordFromTask.getDefend());
|
| | | reportRecordFromTaskList.add(cjReportCheckRecordFromTaskDTO);
|
| | | }
|
| | | System.out.println(Arrays.toString(reportRecordFromTaskList.toArray()));
|
| | | //数据加密
|
| | | String AESReportRecordFromTask = encrypt(JSONObject.toJSONString(reportRecordFromTaskList), key.getBytes(), iv.getBytes());
|
| | |
|
| | |
| | | @Transactional
|
| | | // @Scheduled(cron = "0 0/1 * * * ? ") // 分钟
|
| | | // @Scheduled(cron = "0/30 * * * * ?") // 30秒
|
| | | // @Scheduled(cron = "0 0 0/2 * * ?") // 小时
|
| | | @Scheduled(cron = "0 0 0/2 * * ?") // 小时
|
| | |
|
| | | public void searchReportDate(){
|
| | |
|
| | |
| | | //获取上报数据对象
|
| | | PreventCJReportRiskControlMeasure CJReportMeasure = new PreventCJReportRiskControlMeasure();
|
| | | //转换数据
|
| | | // todo 逻辑改变
|
| | | PreventRiskControlTemplate controlTemplateById = preventRiskControlTemplateService.getControlTemplateById(measure.getClassify2());
|
| | | String classify2 = measure.getClassify1() + "-" + controlTemplateById.getOrderIndex();
|
| | |
|
| | |
| | |
|
| | | /**
|
| | | * 4、检索 任务配置 数据 prevent_report_check_record_from_task
|
| | | * 本数据以 todo
|
| | | * */
|
| | | //读取任务配置数据上报主配置信息
|
| | | PreventReportConfig workReportConfig = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_TASK_FROM_WORK.getCode());
|
| | |
| | | //获取上报数据对象
|
| | | List<PreventCJReportCheckRecordFromTask> CJRecordFromTaskLists = new ArrayList<>();
|
| | | HandlerReportParam handlerReportParam = new HandlerReportParam();
|
| | |
|
| | | if (ObjectUtils.isNotEmpty(tasks)){
|
| | | //遍历,封装数据
|
| | | for (PreventRiskDangerCheckLog task : tasks) {
|
| | |
| | | //获取任务附属表信息
|
| | | PreventRiskJobAndMeasure jobAndMeasureByJobId = preventRiskJobAndMeasureService.getJobAndMeasureByJobId(task.getJobId());
|
| | | //转换检查结果
|
| | | /**
|
| | | * examineUserName,checkTime 任务执行后,不为空 不使用;
|
| | | * tr_hidden_danger_check 的 scheduleCheckStatus 0 未排查, 1已排查
|
| | | * 结果暂时不写入,需要后续处理 ---检查源任务相关的检查点结果
|
| | | * 1.找到每个点的提交接口,进行数据处理
|
| | | * 2.写一个定时任务处理(备用)
|
| | | * */
|
| | | /**
|
| | | * todo 排查后的任务才上报
|
| | | * examineUserName,checkTime 任务执行后,不为空 不使用;
|
| | | * tr_hidden_danger_check 的 scheduleCheckStatus 0 未排查, 1已排查
|
| | | * todo 先找到所有已经排查的任务,然后查询 tr_hidden_danger_check_point ,whether_danger 是否为隐患(0为正常 1为隐患) ,未处理的任务,该值为空
|
| | | * 部分查询结果为空,需要对tr_hidden_danger_check_point结果做判空
|
| | | * */
|
| | | //如果已经执行过,进入方法
|
| | | if (Integer.valueOf(hiddenDangerCheckById.getScheduleCheckStatus()) == 1){
|
| | |
|
| | |
| | | }
|
| | | User updateUser = trUserService.getUserByLoginName(hiddenDangerCheckById.getUpdateBy());
|
| | |
|
| | | //封装上报昌吉州的任务数据 todo taskUUid
|
| | | //封装上报昌吉州的任务数据
|
| | | // String taskUuid = UUID.randomUUID().toString();
|
| | | CJRecordFromTask.setId(UUID.randomUUID().toString());
|
| | | CJRecordFromTask.setCompanyCode(companyCode);
|
| | |
| | | CJRecordFromTaskLists.add(CJRecordFromTask);
|
| | | }
|
| | | }
|
| | |
|
| | | //设置原始数据上报状态
|
| | | handlerReportParam.setId(task.getId());
|
| | | handlerReportParam.setReportTime(new Date());
|
| | |
| | | CJDangerInfo.setCheckAcceptComment(hiddenDanger.getAcceptOpinion());//验收情况
|
| | | CJDangerInfo.setCheckAcceptTime(hiddenDanger.getAcceptCreateTime());//验收时间
|
| | | }
|
| | |
|
| | | //如果排查任务正常存在,封装任务相关数据
|
| | | if (Integer.parseInt(hiddenDanger.getDangerSources()) != 2){
|
| | | HiddenDangerCheck dangerCheckById = trHiddenDangerCheckService.getHiddenDangerCheckById(hiddenDanger.getCheckId());
|
| | |
| | | controlMeasure.setCreateByUserName(sysUser.getUserName());
|
| | | controlMeasure.setRiskEventUuid(riskEvent.getUuid());
|
| | |
|
| | | //todo 对所属企业id和uuid没有进行设置
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_RISK_ANA_UNIT.getCode());
|
| | | //设置上报时间为空
|
| | | controlMeasure.setReportTime(null);
|
| | |
| | | jobAndMeasure.setJobId(jobId);
|
| | | jobAndMeasure.setJobUuid(jobUuid);
|
| | | jobAndMeasure.setMeasureId(checkUnit.getControlMeasureId());
|
| | | jobAndMeasure.setMeasureUuid(preventRiskControlMeasureById.getUuid());//todo 如果删除了措施 此处可能为空,后续处理
|
| | | jobAndMeasure.setMeasureUuid(preventRiskControlMeasureById.getUuid());//如果删除了措施 此处可能为空,后续处理
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_TASK_FROM_WORK.getCode());
|
| | | //设置上报时间为空
|
| | |
| | | //使用保存下来的uuid,再次添加关联关系
|
| | | jobAndMeasure.setJobUuid(jobUuid);
|
| | | jobAndMeasure.setMeasureId(checkUnit.getControlMeasureId());
|
| | | jobAndMeasure.setMeasureUuid(preventRiskControlMeasureById.getUuid());//todo 如果删除了措施 此处可能为空,后续处理
|
| | | jobAndMeasure.setMeasureUuid(preventRiskControlMeasureById.getUuid());//如果删除了措施 此处可能为空,后续处理
|
| | |
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_TASK_FROM_WORK.getCode());
|
| | |
| | | return listQueryRespDTOs;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 管控措施-不分页查询
|
| | | */
|
| | |
| | | ResultVO<List<PreventRiskControlMeasureListQueryRespDTO>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 通过排查点,查找管控措施id
|
| | | */
|
| | |
| | | public PreventRiskCheckUnit getRiskControlMeasureByCheckPointId(Long checkPointId) {
|
| | | return preventRiskCheckUnitService.getUnitByBaseCheckPointId(checkPointId);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询管控措施信息
|
| | | */
|
| | |
| | |
|
| | |
|
| | | // /**
|
| | | // * 全流程隐患上报-附属表信息插入
|
| | | // * 全流程 隐患上报-附属表信息插入
|
| | | // * */
|
| | | // @Override
|
| | | // public int insertAllDangerInfo(Long id, HiddenDangerCheckPoint hdcp) {
|
| | |
| | | |
| | | |
| | | /** |
| | | * 定时隐患排查保存 -- todo |
| | | * 定时隐患排查保存 |
| | | */ |
| | | public ApiResult editDangerScheduleSave(String str, ApiRequestHeader header) { |
| | | //验证userId,loginName,token,deviceType,deviceId,appType 是否一致 |
| | |
| | | } |
| | | }); |
| | | |
| | | |
| | | hiddenDangerCheckService.updateHiddenDangerCheck(hiddenDangerCheck); |
| | | |
| | | hdcpService.getTaskCountTotal(Long.valueOf(header.userId));//查询未执行任务总数量并推送 |
| | |
| | | |
| | | |
| | | /** |
| | | * 设置为记录正常 // todo |
| | | * 设置为记录正常 |
| | | */ |
| | | public ApiResult editPointScheduleSetNormal(String str, ApiRequestHeader header) { |
| | | //验证userId,loginName,token,deviceType,deviceId,appType 是否一致 |
| | |
| | | hdcpService.updateHiddenDangerCheckPoint(hdcp); |
| | | |
| | | PreventRiskDangerCheckAndMeasure dangerCheckPointInfo = preventRiskDangerCheckAndMeasureService.getByDangerCheckPointId(hdcp.getId()); |
| | | int result = riskService.updateCheckLog(dangerCheckPointInfo.getCheckId(), hdcp);// todo |
| | | int result = riskService.updateCheckLog(dangerCheckPointInfo.getCheckId(), hdcp); |
| | | if (result < 1){ |
| | | return ApiResult.error("隐患排查记录附属表:写入手机识别码错误"); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 定时隐患排查---隐患登记 |
| | | * todo-2022 手机端-暂时未改动 |
| | | */ |
| | | @Transactional |
| | | public ApiResult editPointScheduleDangerRegisterSave(String str, ApiRequestHeader header) { |
| | |
| | | hdcp.setExamineStatus(TrHiddenDangerCheckConstants.EXAMINE_STATUS_NOT_EXAMINE);//核查状态(待核查) |
| | | hdcp.setStage(TrHiddenDangerCheckConstants.DANGER_STAGE_PLAN_EXAMINE);//隐患核查阶段(数据进入到隐患核查阶段) |
| | | hdcp.setDangerSources(TrHiddenDangerCheckConstants.DANGER_SOURCES_SCHEDULE_PRODUCE); //隐患来源(定时器任务生成) |
| | | |
| | | |
| | | HiddenDangerCheckPoint queryExist = new HiddenDangerCheckPoint(); |
| | | queryExist.setWhetherDanger(TrHiddenDangerCheckConstants.WHETHER_DANGER_YES);//是否为隐患(是隐患) |
| | |
| | | throw new RuntimeException("添加隐患附属信息失败"); |
| | | } |
| | | |
| | | // todo-2022 此处插入附属表 |
| | | //获取Id返回值 |
| | | hdcp.getId(); |
| | | int result = riskService.insertDangerInfo(hdcp.getId(), hdcp); |
| | |
| | | hdcp.setUpdateTime(DateUtils.getNowDate()); |
| | | i = hdcpService.updateHiddenDangerCheckPoint(hdcp); |
| | | |
| | | // todo-2022 此处修改附属表,注释: |
| | | // todo-2022 此处修改附属表 |
| | | // int result = riskService.updateDangerInfo(hdcp); |
| | | // if (result < 1){ |
| | | // throw new RuntimeException("修改失败"); |
| | |
| | | where id = #{id}
|
| | | </select>
|
| | |
|
| | |
|
| | | <!-- int insertCJOverhaulLists(PreventOverhaulLog preventOverhaulLog);-->
|
| | | <insert id="insertCJOverhaulLists" parameterType="com.ruoyi.doublePrevention.entity.CJReport.PreventCJReportOverhaulLog">
|
| | | insert into prevent_overhaul_log
|
| | |
| | | |
| | | <select id="selectHiddenDangerCheckList" parameterType="HiddenDangerCheck" resultMap="HiddenDangerCheckResult"> |
| | | <include refid="selectHiddenDangerCheckVo"/> |
| | | |
| | | <where> |
| | | <if test="checkId != null and checkId != ''"> and a.check_id = #{checkId}</if> |
| | | <if test="planCreateUserId != null and planCreateUserId != ''"> and a.plan_create_user_id = #{planCreateUserId}</if> |
| | |
| | | where check_id = #{checkId} |
| | | </select> |
| | | |
| | | <update id="getHiddenDangerCheckByIdOld" parameterType="Long"> |
| | | update tr_hidden_danger_check set |
| | | create_by = #{createBy}, |
| | | update_by = #{updateBy}, |
| | | create_time = #{createTime}, |
| | | update_time = #{updateTime} |
| | | |
| | | where id = #{checkId} |
| | | </update> |
| | | |
| | | |
| | | <!-- <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>--> |
| | | <!-- <if test="createTime != null ">create_time = #{createTime},</if>--> |
| | | <!-- <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>--> |
| | | <!-- <if test="updateTime != null ">update_time = #{updateTime},</if>--> |
| | | <!-- <if test="remark != null and remark != ''">remark = #{remark},</if>--> |
| | | <!-- <if test="planCreateUserId != null and planCreateUserId != ''">plan_create_user_id = #{planCreateUserId},</if>--> |
| | | |
| | | |
| | | </mapper> |