修改数据同步

main
吴顺杰 4 days ago
parent 65006ee20b
commit c2245af1df

@ -1,19 +1,17 @@
package com.mudu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mudu.entity.Enterprise;
import com.mudu.entity.dto.response.EnterpriseResponse;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (Enterprise)访
*
* @author wu
* @since 2024-02-22 16:14:23
*/
public interface EnterpriseMapper extends BaseMapper<Enterprise> {

@ -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());
//更新人员

@ -88,6 +88,9 @@ public class BqbhTszyQuartz {
}
List<ASafeBqbhpx> aSafeBqbhpxes = new ArrayList<>();
List<ASafeBqbhpxRequest> list = JSON.parseArray(dataList, ASafeBqbhpxRequest.class);
if (CollectionUtil.isEmpty(list)) {
return;
}
for (ASafeBqbhpxRequest x : list) {
ASafeBqbhpx aSafeBqbhpx = BeanUtil.copyProperties(x, ASafeBqbhpx.class);
XcTpResponse xcTpResponse = new XcTpResponse();

@ -12,6 +12,7 @@ import com.mudu.service.ASafeQyjcxxMdLogService;
import com.mudu.service.ASafeQyjcxxService;
import com.mudu.service.ASafeWgcyService;
import com.mudu.service.impl.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
@ -34,6 +35,7 @@ import java.util.stream.Collectors;
//@RestController
//@RequestMapping("pharmaceuticals/ent")
//@Api(tags = "新增")
@Slf4j
public class EntQuartz {
@Resource
@ -69,6 +71,7 @@ public class EntQuartz {
*
*/
@Scheduled(cron = "0 30 19 * * ? ")
// @PostMapping("/insert")
public void addqyjcxxAndWgcy() {
// 获取token
String token = getToken();
@ -83,6 +86,7 @@ public class EntQuartz {
return;
}
List<ASafeQyjcxx> qyjcxxList = JSON.parseArray(dataList, ASafeQyjcxx.class);
log.error("===============qyjcxxList.size(): {}========", qyjcxxList.size());
for (ASafeQyjcxx x : qyjcxxList) {
ASafeQyjcxx entity = qyjcxxService.findOneByqymcOrXybm(null, x.getTyshxybm());
if (BeanUtil.isNotEmpty(entity)) {
@ -92,9 +96,11 @@ public class EntQuartz {
ASafeQyjcxxMdLog qyjcxxMdLog = BeanUtil.copyProperties(entity, ASafeQyjcxxMdLog.class);
qyjcxxMdLog.setGxorxz(0);
qyjcxxMdLogService.save(qyjcxxMdLog);
log.error("===============编辑 {},{}========", entity.getQtmc(), entity.getTyshxybm());
}
} else {
qyjcxxService.save(x);
log.error("===============保存 {},{}========", x.getQtmc(), x.getTyshxybm());
// 添加新增日志
ASafeQyjcxxMdLog qyjcxxMdLog = BeanUtil.copyProperties(x, ASafeQyjcxxMdLog.class);
qyjcxxMdLog.setGxorxz(1);

@ -1,16 +1,12 @@
package com.mudu.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mudu.entity.Enterprise;
import com.mudu.entity.dto.response.EnterpriseResponse;
import com.mudu.mapper.EnterpriseMapper;
import com.mudu.service.EnterpriseService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* (Enterprise)
*
@ -18,7 +14,6 @@ import java.util.List;
* @since 2024-02-22 16:14:24
*/
@Service("enterpriseService")
public class EnterpriseServiceImpl extends ServiceImpl<EnterpriseMapper, Enterprise> implements EnterpriseService {

@ -14,6 +14,7 @@
and zqbh = #{req.zqbh}
</if>
</where>
order by rksj desc limit 1
</select>
</mapper>

Loading…
Cancel
Save