定时任务统计

main
dongdingding 11 months ago
parent 9655ef7820
commit 5c0f1f863a

@ -3,45 +3,20 @@ package com.mudu.quartz;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.mudu.entity.ACheckQuatzEntity; import com.mudu.entity.*;
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.dto.request.ACheckQuatzRequest; import com.mudu.entity.dto.request.ACheckQuatzRequest;
import com.mudu.entity.dto.request.ACheckQuatzZichaRequest; import com.mudu.entity.dto.request.ACheckQuatzZichaRequest;
import com.mudu.entity.dto.response.ACheckXcTpResponse; import com.mudu.entity.dto.response.ACheckXcTpResponse;
import com.mudu.entity.dto.response.RwzqUuidResponse; import com.mudu.entity.dto.response.RwzqUuidResponse;
import com.mudu.service.ASafeQyjcxxService; import com.mudu.service.*;
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.impl.LoginService; import com.mudu.service.impl.LoginService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
@ -62,14 +37,14 @@ import java.util.UUID;
* @author dong * @author dong
* @since 2024/3/12 16:37 * @since 2024/3/12 16:37
*/ */
@RestController //@RestController
@RequestMapping("pharmaceuticals/aCheck") //@RequestMapping("pharmaceuticals/aCheck")
@Api(tags = "新增") //@Api(tags = "新增")
//@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
//@Configuration @Configuration
//@EnableScheduling @EnableScheduling
public class AcheckTaskQuartz { public class AcheckTaskQuartz {
Logger logger = LoggerFactory.getLogger(AcheckTaskQuartz.class);
/** /**
* *
*/ */
@ -168,10 +143,10 @@ public class AcheckTaskQuartz {
* *
* @Param qymc * @Param qymc
*/ */
// @Scheduled(cron = "0 0 4 * * ? ") @Scheduled(cron = "0 0 4 * * ? ")
// @Scheduled(cron = "0 0/5 * * * ?") // @Scheduled(cron = "0 0/5 * * * ?")
@PostMapping("/insert") // @PostMapping("/insert")
@ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") // @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据")
public void selectAll() throws ParseException { public void selectAll() throws ParseException {
// 获取token // 获取token
@ -185,12 +160,17 @@ public class AcheckTaskQuartz {
.header("Authorization", token) .header("Authorization", token)
.execute().body(); .execute().body();
JSONObject jsonResponseList = JSON.parseObject(responseList); JSONObject jsonResponseList = JSON.parseObject(responseList);
logger.info(responseList);
String dataList = jsonResponseList.getString("data"); String dataList = jsonResponseList.getString("data");
if (StrUtil.isEmpty(dataList)) { if (StrUtil.isEmpty(dataList)) {
logger.info("dataList没有数据");
return; return;
} }
logger.info(dataList);
List<ACheckQuatzRequest> list = JSON.parseArray(dataList, ACheckQuatzRequest.class); List<ACheckQuatzRequest> list = JSON.parseArray(dataList, ACheckQuatzRequest.class);
if (CollectionUtil.isEmpty(list)) { if (CollectionUtil.isEmpty(list)) {
logger.info("list没有数据");
logger.info(list.toString());
return; return;
} }
for (ACheckQuatzRequest a : list) { for (ACheckQuatzRequest a : list) {
@ -206,7 +186,8 @@ public class AcheckTaskQuartz {
// todo 查询巡查任务主表2月是否有记录就不推 // todo 查询巡查任务主表2月是否有记录就不推
Integer xcrwNum = aSafeXcrwService.xcrwNum(enterPriseId); Integer xcrwNum = aSafeXcrwService.xcrwNum(enterPriseId);
if (xcrwNum > 0) { if (xcrwNum > 0) {
return; logger.info("查任务主表2月是否有记录就不推");
continue;
} }
// todo 来自新表查询 根据企业xxbh 以及周期编号 // todo 来自新表查询 根据企业xxbh 以及周期编号
JSONObject xcjsonObject = new JSONObject(); JSONObject xcjsonObject = new JSONObject();
@ -266,7 +247,12 @@ public class AcheckTaskQuartz {
/** /**
* a_safe_xcrw * 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()) { for (ACheckQuatzEntity b : a.getList()) {
String xcrwjcxUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); 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 0/5 * * * ?")
//@Scheduled(cron = "0 58 18 * * ?") // @PostMapping("/zicha")
@PostMapping("/zicha") // @ApiOperation(value = "自查")
@ApiOperation(value = "自查")
public void zicha() throws ParseException { public void zicha() throws ParseException {
// 获取token
getToken();
//自己查任务周期id //自己查任务周期id
RwzqUuidResponse rwzqUuidResponse = aSafeRwzqService.getZcUuid(); RwzqUuidResponse rwzqUuidResponse = aSafeRwzqService.getZcUuid();
String rwzqUuid = rwzqUuidResponse.getXxbh(); String rwzqUuid = rwzqUuidResponse.getXxbh();
@ -682,7 +668,9 @@ public class AcheckTaskQuartz {
.execute().body(); .execute().body();
JSONObject jsonResponseList = JSON.parseObject(responseList); JSONObject jsonResponseList = JSON.parseObject(responseList);
String dataList = jsonResponseList.getString("data"); String dataList = jsonResponseList.getString("data");
logger.info(JSONUtil.toJsonStr(responseList));
if (StrUtil.isEmpty(dataList)) { if (StrUtil.isEmpty(dataList)) {
logger.info("dataList没有数据");
return; return;
} }
List<ACheckQuatzZichaRequest> list = JSON.parseArray(dataList, ACheckQuatzZichaRequest.class); List<ACheckQuatzZichaRequest> list = JSON.parseArray(dataList, ACheckQuatzZichaRequest.class);
@ -693,20 +681,24 @@ public class AcheckTaskQuartz {
// todo 查询自查任务主表本月是否有记录 有就不推 // todo 查询自查任务主表本月是否有记录 有就不推
Integer zcrwNum = aSafeZcrwService.zcrwNum(a.getEnterpriseID()); Integer zcrwNum = aSafeZcrwService.zcrwNum(a.getEnterpriseID());
if (zcrwNum > 0) { if (zcrwNum > 0) {
return; logger.info("查询自查任务主表本月是否有记录 有就不推");
continue;
} }
if (a.getEnterpriseID() == null) { if (a.getEnterpriseID() == null) {
logger.info("getEnterpriseID为空");
continue; continue;
} }
JSONObject zcjsonObject = new JSONObject(); JSONObject zcjsonObject = new JSONObject();
zcjsonObject.put("qybh", a.getEnterpriseID()); zcjsonObject.put("qybh", a.getEnterpriseID());
zcjsonObject.put("zqbh", rwzqUuid); zcjsonObject.put("zqbh", rwzqUuid);
logger.info(JSONUtil.toJsonStr(zcjsonObject));
String zcresponse = HttpRequest.post(zczqUrl) String zcresponse = HttpRequest.post(zczqUrl)
.contentType("application/x-www-form-urlencoded;charset=UTF-8") .contentType("application/x-www-form-urlencoded;charset=UTF-8")
.header("Authorization", token) .header("Authorization", token)
.body(zcjsonObject.toJSONString()) .body(zcjsonObject.toJSONString())
.execute().body(); .execute().body();
JSONObject zcjsonResponse = JSON.parseObject(zcresponse); JSONObject zcjsonResponse = JSON.parseObject(zcresponse);
logger.info(JSONUtil.toJsonStr(zcjsonResponse));
if (zcjsonResponse.getString("msg") == null) { if (zcjsonResponse.getString("msg") == null) {
continue; continue;
} }
@ -1064,11 +1056,13 @@ public class AcheckTaskQuartz {
/** /**
* *
*/ */
// @Scheduled(cron = "0 0 4 * * ? ") @Scheduled(cron = "0 0 4 * * ? ")
// @Scheduled(cron = "0 0/5 * * * ?") // @Scheduled(cron = "0 0/5 * * * ?")
@PostMapping("/tfg") // @PostMapping("/tfg")
@ApiOperation(value = "停复工表") // @ApiOperation(value = "停复工表")
public void tfg() { public void tfg() {
// 获取token
getToken();
//当前时间 //当前时间
Date currentDate = new Date(); Date currentDate = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

@ -47,7 +47,8 @@ import java.util.List;
@Configuration @Configuration
@EnableScheduling @EnableScheduling
public class BqbhTszyQuartz { public class BqbhTszyQuartz {
@Resource
private LoginService loginService;
@Resource @Resource
private ASafeBqbhpxService safeBqbhpxService; private ASafeBqbhpxService safeBqbhpxService;
@ -74,6 +75,10 @@ public class BqbhTszyQuartz {
*/ */
private String token; 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 1 * * ? ")
// @Scheduled(cron = "0 0/5 * * * ?") // @Scheduled(cron = "0 0/5 * * * ?")
public void saveBqbh() { public void saveBqbh() {
getToken();
String res = HttpRequest.get(bqbhUrl) String res = HttpRequest.get(bqbhUrl)
.contentType("application/x-www-form-urlencoded;charset=UTF-8") .contentType("application/x-www-form-urlencoded;charset=UTF-8")
.header("Authorization", token) .header("Authorization", token)
@ -132,6 +138,7 @@ public class BqbhTszyQuartz {
@Scheduled(cron = "0 0 1 * * ? ") @Scheduled(cron = "0 0 1 * * ? ")
// @Scheduled(cron = "0 0/5 * * * ?") // @Scheduled(cron = "0 0/5 * * * ?")
public void saveTszy() { public void saveTszy() {
getToken();
String res = HttpRequest.get(tszyUrl) String res = HttpRequest.get(tszyUrl)
.contentType("application/x-www-form-urlencoded;charset=UTF-8") .contentType("application/x-www-form-urlencoded;charset=UTF-8")
.header("Authorization", token) .header("Authorization", token)

@ -4,7 +4,7 @@ spring:
datasource: datasource:
url: jdbc:mysql://localhost:3306/mudu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://localhost:3306/mudu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: 123456 password: adminadmin
#公司本地 #公司本地
# url: jdbc:mysql://localhost:3307/mudu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://localhost:3307/mudu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root # username: root
@ -72,11 +72,11 @@ zcUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/zctp
api: http://mdapi.junln.net/api/ 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: https://www.jichuanglanhai.com:88/csapi/mudu/aSafeBqbhpx/findAll
bqbhUrl: http://localhost:9028/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 tfgUrl: http://localhost:9028/mudu/aSafeTfg
#自查周期url #自查周期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 #巡查周期url
xczqUrl: https://www.jichuanglanhai.com:88/csapi/mudu/aSafeXcrwRead/getByxxbh xczqUrl: https://www.jichuanglanhai.com:88/csapi/mudu/aSafeXcrwRead/getByxxbh

@ -37,7 +37,7 @@ improveUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/xctp
zcUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/zctp 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 imUrl: https://www.jichuanglanhai.com:88/csapi/mudu/quatz/get

Loading…
Cancel
Save