|
|
|
@ -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<ACheckQuatzRequest> 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<ACheckQuatzZichaRequest> 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");
|
|
|
|
|