|
|
|
@ -4,7 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
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;
|
|
|
|
@ -55,6 +54,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.sql.SQLIntegrityConstraintViolationException;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.Date;
|
|
|
|
@ -189,19 +189,22 @@ public class AcheckTaskQuartz {
|
|
|
|
|
JSONObject jsonResponseList = JSON.parseObject(responseList);
|
|
|
|
|
String dataList = jsonResponseList.getString("data");
|
|
|
|
|
if (StrUtil.isEmpty(dataList)) {
|
|
|
|
|
logger.error("=====================================");
|
|
|
|
|
logger.error("没有巡查数据同步");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ACheckQuatzRequest> list = JSON.parseArray(dataList, ACheckQuatzRequest.class);
|
|
|
|
|
if (CollectionUtil.isEmpty(list)) {
|
|
|
|
|
return;
|
|
|
|
|
logger.error("=====================================");
|
|
|
|
|
logger.error("没有巡查数据可以转换同步");
|
|
|
|
|
}
|
|
|
|
|
for (ACheckQuatzRequest a : list) {
|
|
|
|
|
//获取企业编号
|
|
|
|
|
ASafeQyjcxx oneByqymcOrXybm = aSafeQyjcxxService.findOneByqymcOrXybm(a.getName(), a.getEntCode());
|
|
|
|
|
String enterPriseId;
|
|
|
|
|
if (BeanUtil.isEmpty(oneByqymcOrXybm)) {
|
|
|
|
|
logger.error(a.getName() + "企业不存在吴中-----------------" + a.getEntCode());
|
|
|
|
|
logger.error("{}企业不存在吴中-----------------{}", a.getName(), a.getEntCode());
|
|
|
|
|
continue;
|
|
|
|
|
} else {
|
|
|
|
|
a.setXxbh(oneByqymcOrXybm.getXxbh());
|
|
|
|
@ -212,15 +215,10 @@ public class AcheckTaskQuartz {
|
|
|
|
|
XcRequest xcRequest = new XcRequest();
|
|
|
|
|
xcRequest.setQybh(a.getXxbh());
|
|
|
|
|
xcRequest.setZqbh(rwzqUuid);
|
|
|
|
|
String xcrwuuid = null;
|
|
|
|
|
try {
|
|
|
|
|
xcrwuuid = xcrwMdService.getByxxbh(xcRequest);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("周期编号重复-----------------" + JSONUtil.toJsonStr(xcRequest));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String xcrwuuid = xcrwMdService.getByxxbh(xcRequest);
|
|
|
|
|
if (StrUtil.isEmpty(xcrwuuid)) {
|
|
|
|
|
logger.error("=====================================");
|
|
|
|
|
logger.error("{} ,没有找到巡查任务的uuid", a.getXxbh());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
//根据工单获取巡查图片
|
|
|
|
@ -247,6 +245,10 @@ public class AcheckTaskQuartz {
|
|
|
|
|
// 新增巡查信息表 a_safe_xcrw
|
|
|
|
|
saveXcrw(list, a, xcrwuuid, enterPriseId, rwzqUuid);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
if (e.getCause() instanceof SQLIntegrityConstraintViolationException) {
|
|
|
|
|
logger.error("{} ,存在重复数据", rwzqUuidResponse.getXxbh());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
logger.error("============巡查任务: " + a.getImprovingNo() + "==============" + "============" + rwzqUuidResponse.getXxbh() + "==============保存失败");
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -651,7 +653,7 @@ public class AcheckTaskQuartz {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 30 19 * * ? ")
|
|
|
|
|
@Scheduled(cron = "0 30 19 * * ? ")
|
|
|
|
|
// @PostMapping("/zicha")
|
|
|
|
|
// @ApiOperation(value = "自查")
|
|
|
|
|
public void zicha() throws ParseException {
|
|
|
|
@ -667,17 +669,21 @@ public class AcheckTaskQuartz {
|
|
|
|
|
JSONObject jsonResponseList = JSON.parseObject(responseList);
|
|
|
|
|
String dataList = jsonResponseList.getString("data");
|
|
|
|
|
if (StrUtil.isEmpty(dataList)) {
|
|
|
|
|
logger.error("=====================================");
|
|
|
|
|
logger.error("没有自查数据同步");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
List<ACheckQuatzZichaRequest> list = JSON.parseArray(dataList, ACheckQuatzZichaRequest.class);
|
|
|
|
|
if (CollectionUtil.isEmpty(list)) {
|
|
|
|
|
logger.error("=====================================");
|
|
|
|
|
logger.error("没有自查数据可以转换同步");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//获取企业编号
|
|
|
|
|
for (ACheckQuatzZichaRequest a : list) {
|
|
|
|
|
ASafeQyjcxx oneByqymcOrXybm = aSafeQyjcxxService.findOneByqymcOrXybm(null, a.getEnterpriseID());
|
|
|
|
|
if (BeanUtil.isEmpty(oneByqymcOrXybm)) {
|
|
|
|
|
logger.error(a.getEnterpriseID() + "企业信用代码在吴中不存在-----------------");
|
|
|
|
|
logger.error("{}企业信用代码在吴中不存在-----------------", a.getEnterpriseID());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
a.setEnterpriseID(oneByqymcOrXybm.getXxbh());
|
|
|
|
@ -690,13 +696,19 @@ public class AcheckTaskQuartz {
|
|
|
|
|
zcRequest.setZqbh(rwzqUuid);
|
|
|
|
|
String zcrwUuid = zcrwMdService.getByxxbh(zcRequest);
|
|
|
|
|
if (StrUtil.isEmpty(zcrwUuid)) {
|
|
|
|
|
logger.error("=====================================");
|
|
|
|
|
logger.error("{}企业 ,没有找到自查任务的uuid", a.getEnterpriseID());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 自查任务 a_safe_zcrw
|
|
|
|
|
try {
|
|
|
|
|
saveZcrw(a, zcrwUuid, rwzqUuid);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("============自查任务: " + a.getEnterpriseID() + "==============" + "============" + rwzqUuidResponse.getXxbh() + "==============保存失败");
|
|
|
|
|
if (e.getCause() instanceof SQLIntegrityConstraintViolationException) {
|
|
|
|
|
logger.error("{}企业 ,存在重复数据", a.getEnterpriseID());
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
logger.error("============自查任务: {}=========================={}==============保存失败", a.getEnterpriseID(), rwzqUuidResponse.getXxbh(), e);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -943,7 +955,7 @@ public class AcheckTaskQuartz {
|
|
|
|
|
//入库人员
|
|
|
|
|
aSafeZcrw.setRkry(a.getRybh());
|
|
|
|
|
//入库时间
|
|
|
|
|
aSafeZcrw.setRksj(new Date());
|
|
|
|
|
aSafeZcrw.setRksj(a.getEndDateTime());
|
|
|
|
|
//更新时间
|
|
|
|
|
aSafeZcrw.setGxsj(a.getEndDateTime());
|
|
|
|
|
//更新人员
|
|
|
|
|