diff --git a/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java b/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java index f6f98b0..2600358 100644 --- a/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java +++ b/src/main/java/com/mudu/quartz/AcheckTaskQuartz.java @@ -3,45 +3,20 @@ package com.mudu.quartz; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; -import com.mudu.entity.ACheckQuatzEntity; -import com.mudu.entity.ACheckQuatzZichaEntity; -import com.mudu.entity.ASafeQyjcxx; -import com.mudu.entity.ASafeRwfj; -import com.mudu.entity.ASafeRwzq; -import com.mudu.entity.ASafeTfg; -import com.mudu.entity.ASafeTfgsh; -import com.mudu.entity.ASafeXcrw; -import com.mudu.entity.ASafeXcrwjcx; -import com.mudu.entity.ASafeXcrwjcxzgxx; -import com.mudu.entity.ASafeXcrwwz; -import com.mudu.entity.ASafeYhzgxx; -import com.mudu.entity.ASafeZcrw; -import com.mudu.entity.ASafeZcrwjl; -import com.mudu.entity.ASafeZcrwwz; -import com.mudu.entity.SzsASafeZcyhxx; +import com.mudu.entity.*; import com.mudu.entity.dto.request.ACheckQuatzRequest; import com.mudu.entity.dto.request.ACheckQuatzZichaRequest; import com.mudu.entity.dto.response.ACheckXcTpResponse; import com.mudu.entity.dto.response.RwzqUuidResponse; -import com.mudu.service.ASafeQyjcxxService; -import com.mudu.service.ASafeRwfjService; -import com.mudu.service.ASafeRwzqService; -import com.mudu.service.ASafeTfgService; -import com.mudu.service.ASafeTfgshService; -import com.mudu.service.ASafeXcrwService; -import com.mudu.service.ASafeXcrwjcxService; -import com.mudu.service.ASafeXcrwjcxzgxxService; -import com.mudu.service.ASafeXcrwwzService; -import com.mudu.service.ASafeYhzgxxService; -import com.mudu.service.ASafeZcrwService; -import com.mudu.service.ASafeZcrwjlService; -import com.mudu.service.ASafeZcrwwzService; -import com.mudu.service.SzsASafeZcyhxxService; +import com.mudu.service.*; import com.mudu.service.impl.LoginService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; @@ -62,14 +37,14 @@ import java.util.UUID; * @author dong * @since 2024/3/12 16:37 */ -@RestController -@RequestMapping("pharmaceuticals/aCheck") -@Api(tags = "新增") -//@Transactional(rollbackFor = Exception.class) -//@Configuration -//@EnableScheduling +//@RestController +//@RequestMapping("pharmaceuticals/aCheck") +//@Api(tags = "新增") +@Transactional(rollbackFor = Exception.class) +@Configuration +@EnableScheduling public class AcheckTaskQuartz { - + Logger logger = LoggerFactory.getLogger(AcheckTaskQuartz.class); /** * 服务对象 */ @@ -168,10 +143,10 @@ public class AcheckTaskQuartz { * * @Param qymc 企业名称 */ -// @Scheduled(cron = "0 0 4 * * ? ") + @Scheduled(cron = "0 0 4 * * ? ") // @Scheduled(cron = "0 0/5 * * * ?") - @PostMapping("/insert") - @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") +// @PostMapping("/insert") +// @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") public void selectAll() throws ParseException { // 获取token @@ -185,12 +160,17 @@ public class AcheckTaskQuartz { .header("Authorization", token) .execute().body(); JSONObject jsonResponseList = JSON.parseObject(responseList); + logger.info(responseList); String dataList = jsonResponseList.getString("data"); if (StrUtil.isEmpty(dataList)) { + logger.info("dataList没有数据"); return; } + logger.info(dataList); List list = JSON.parseArray(dataList, ACheckQuatzRequest.class); if (CollectionUtil.isEmpty(list)) { + logger.info("list没有数据"); + logger.info(list.toString()); return; } for (ACheckQuatzRequest a : list) { @@ -206,7 +186,8 @@ public class AcheckTaskQuartz { // todo 查询巡查任务主表2月是否有记录就不推 Integer xcrwNum = aSafeXcrwService.xcrwNum(enterPriseId); if (xcrwNum > 0) { - return; + logger.info("查任务主表2月是否有记录就不推"); + continue; } // todo 来自新表查询 根据企业xxbh 以及周期编号 JSONObject xcjsonObject = new JSONObject(); @@ -266,7 +247,12 @@ public class AcheckTaskQuartz { /** * 新增巡查信息表 a_safe_xcrw */ - saveXcrw(list, a, xcrwuuid, enterPriseId, rwzqUuid); + try { + saveXcrw(list, a, xcrwuuid, enterPriseId, rwzqUuid); + } catch (Exception e) { + continue; + } + for (ACheckQuatzEntity b : a.getList()) { String xcrwjcxUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); @@ -666,13 +652,13 @@ public class AcheckTaskQuartz { } -// @Scheduled(cron = "0 0 4 * * ? ") + @Scheduled(cron = "0 0 4 * * ? ") // @Scheduled(cron = "0 0/5 * * * ?") -//@Scheduled(cron = "0 58 18 * * ?") - @PostMapping("/zicha") - @ApiOperation(value = "自查") +// @PostMapping("/zicha") +// @ApiOperation(value = "自查") public void zicha() throws ParseException { - + // 获取token + getToken(); //自己查任务周期id RwzqUuidResponse rwzqUuidResponse = aSafeRwzqService.getZcUuid(); String rwzqUuid = rwzqUuidResponse.getXxbh(); @@ -682,7 +668,9 @@ public class AcheckTaskQuartz { .execute().body(); JSONObject jsonResponseList = JSON.parseObject(responseList); String dataList = jsonResponseList.getString("data"); + logger.info(JSONUtil.toJsonStr(responseList)); if (StrUtil.isEmpty(dataList)) { + logger.info("dataList没有数据"); return; } List list = JSON.parseArray(dataList, ACheckQuatzZichaRequest.class); @@ -693,20 +681,24 @@ public class AcheckTaskQuartz { // todo 查询自查任务主表本月是否有记录 有就不推 Integer zcrwNum = aSafeZcrwService.zcrwNum(a.getEnterpriseID()); if (zcrwNum > 0) { - return; + logger.info("查询自查任务主表本月是否有记录 有就不推"); + continue; } if (a.getEnterpriseID() == null) { + logger.info("getEnterpriseID为空"); continue; } JSONObject zcjsonObject = new JSONObject(); zcjsonObject.put("qybh", a.getEnterpriseID()); zcjsonObject.put("zqbh", rwzqUuid); + logger.info(JSONUtil.toJsonStr(zcjsonObject)); String zcresponse = HttpRequest.post(zczqUrl) .contentType("application/x-www-form-urlencoded;charset=UTF-8") .header("Authorization", token) .body(zcjsonObject.toJSONString()) .execute().body(); JSONObject zcjsonResponse = JSON.parseObject(zcresponse); + logger.info(JSONUtil.toJsonStr(zcjsonResponse)); if (zcjsonResponse.getString("msg") == null) { continue; } @@ -1064,11 +1056,13 @@ public class AcheckTaskQuartz { /** * 停复工表 */ -// @Scheduled(cron = "0 0 4 * * ? ") + @Scheduled(cron = "0 0 4 * * ? ") // @Scheduled(cron = "0 0/5 * * * ?") - @PostMapping("/tfg") - @ApiOperation(value = "停复工表") +// @PostMapping("/tfg") +// @ApiOperation(value = "停复工表") public void tfg() { + // 获取token + getToken(); //当前时间 Date currentDate = new Date(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); diff --git a/src/main/java/com/mudu/quartz/BqbhTszyQuartz.java b/src/main/java/com/mudu/quartz/BqbhTszyQuartz.java index 61ede0b..c50d8bd 100644 --- a/src/main/java/com/mudu/quartz/BqbhTszyQuartz.java +++ b/src/main/java/com/mudu/quartz/BqbhTszyQuartz.java @@ -47,7 +47,8 @@ import java.util.List; @Configuration @EnableScheduling public class BqbhTszyQuartz { - + @Resource + private LoginService loginService; @Resource private ASafeBqbhpxService safeBqbhpxService; @@ -74,6 +75,10 @@ public class BqbhTszyQuartz { */ private String token; + private void getToken() { + token = "Bearer " + loginService.getToken(); + } + /** * 保存班前班后数据 */ @@ -82,6 +87,7 @@ public class BqbhTszyQuartz { @Scheduled(cron = "0 0 1 * * ? ") // @Scheduled(cron = "0 0/5 * * * ?") public void saveBqbh() { + getToken(); String res = HttpRequest.get(bqbhUrl) .contentType("application/x-www-form-urlencoded;charset=UTF-8") .header("Authorization", token) @@ -132,6 +138,7 @@ public class BqbhTszyQuartz { @Scheduled(cron = "0 0 1 * * ? ") // @Scheduled(cron = "0 0/5 * * * ?") public void saveTszy() { + getToken(); String res = HttpRequest.get(tszyUrl) .contentType("application/x-www-form-urlencoded;charset=UTF-8") .header("Authorization", token) diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index c9d2295..4817bd6 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -4,7 +4,7 @@ spring: datasource: url: jdbc:mysql://localhost:3306/mudu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: 123456 + password: adminadmin #公司本地 # url: jdbc:mysql://localhost:3307/mudu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # username: root @@ -72,11 +72,11 @@ zcUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/zctp api: http://mdapi.junln.net/api/ #获取工单信息 -imUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/get - +#imUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/get +imUrl: http://localhost:9028/mudu/quatz/get #获取自查信息 -zcXxUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/zicha - +#zcXxUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/zicha +zcXxUrl: http://localhost:9028/mudu/quatz/zicha # 班前班后 #bqbhUrl: https://www.jichuanglanhai.com:88/csapi/mudu/aSafeBqbhpx/findAll bqbhUrl: http://localhost:9028/mudu/aSafeBqbhpx/findAll @@ -89,8 +89,8 @@ tszyUrl: http://localhost:9028/mudu/aSafeQyzypgl/findAll tfgUrl: http://localhost:9028/mudu/aSafeTfg #自查周期url -zczqUrl: https://www.jichuanglanhai.com:88/csapi/mudu/aSafeZcrwRead/getByxxbh - +#zczqUrl: https://www.jichuanglanhai.com:88/csapi/mudu/aSafeZcrwRead/getByxxbh +zczqUrl: http://localhost:9028/mudu/aSafeZcrwRead/getByxxbh #巡查周期url xczqUrl: https://www.jichuanglanhai.com:88/csapi/mudu/aSafeXcrwRead/getByxxbh \ No newline at end of file diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 23f9f06..a968185 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -37,7 +37,7 @@ improveUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/xctp zcUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/zctp #图片路径 -api: http://221.229.220.83:8007/api/ +api: https://www.jichuanglanhai.com:88/img/ #获取工单信息 imUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/get