|
|
|
@ -2,9 +2,15 @@ package com.logpm.factorydata.jinpai.job;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.http.HttpUtil; |
|
|
|
|
import cn.hutool.json.JSONObject; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.factorydata.jinpai.entity.CustomPushEntity; |
|
|
|
|
import com.logpm.factorydata.jinpai.entity.FactoryNodePushEntity; |
|
|
|
|
import com.logpm.factorydata.jinpai.pros.JinPaiProperties; |
|
|
|
|
import com.logpm.factorydata.jinpai.service.CustomPushService; |
|
|
|
|
import com.logpm.factorydata.jinpai.service.FactoryNodePushService; |
|
|
|
|
import com.xxl.job.core.biz.model.ReturnT; |
|
|
|
|
import com.xxl.job.core.handler.annotation.XxlJob; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
@ -29,6 +35,8 @@ public class AuthPushJob {
|
|
|
|
|
|
|
|
|
|
private final CustomPushService customPushService; |
|
|
|
|
private final RabbitTemplate rabbitTemplate; |
|
|
|
|
private final FactoryNodePushService factoryNodePushService; |
|
|
|
|
private final JinPaiProperties jinPaiProperties; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 自定义回传工厂节点作业数据 |
|
|
|
@ -59,4 +67,49 @@ public class AuthPushJob {
|
|
|
|
|
return ReturnT.SUCCESS; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 字段缺失重新推送 |
|
|
|
|
* |
|
|
|
|
* @param param |
|
|
|
|
* @return |
|
|
|
|
* @throws Exception |
|
|
|
|
*/ |
|
|
|
|
@XxlJob("rePush") |
|
|
|
|
public ReturnT<String> rePush(String param) throws Exception { |
|
|
|
|
// 查出数据,回推工厂
|
|
|
|
|
List<FactoryNodePushEntity> list = factoryNodePushService.list(Wrappers.<FactoryNodePushEntity>lambdaQuery() |
|
|
|
|
.eq(FactoryNodePushEntity::getReserve1, "0").last(" limit 1")); |
|
|
|
|
if (CollUtil.isNotEmpty(list)) { |
|
|
|
|
FactoryNodePushEntity factoryNodePushEntity = list.get(0); |
|
|
|
|
String content = factoryNodePushEntity.getContent(); |
|
|
|
|
JSONObject entries = JSONUtil.parseObj(content); |
|
|
|
|
entries.set("passSite", entries.getStr("endSite")); |
|
|
|
|
String url = jinPaiProperties.getOldSystemHost() + jinPaiProperties.getOldSystemArrivedUrl(); |
|
|
|
|
log.info("字段缺失重新推送:{}", JSONUtil.toJsonStr(entries)); |
|
|
|
|
String result = HttpUtil.post(url, JSONUtil.toJsonStr(entries)); |
|
|
|
|
FactoryNodePushEntity factoryNodePushEntity1 = new FactoryNodePushEntity(); |
|
|
|
|
factoryNodePushEntity1.setContent(JSONUtil.toJsonStr(entries)); |
|
|
|
|
factoryNodePushEntity1.setId(factoryNodePushEntity.getId()); |
|
|
|
|
factoryNodePushEntity1.setReserve1("1"); |
|
|
|
|
factoryNodePushEntity1.setResultContent(result); |
|
|
|
|
factoryNodePushService.updateById(factoryNodePushEntity1); |
|
|
|
|
List<FactoryNodePushEntity> list1 = factoryNodePushService.list(Wrappers.<FactoryNodePushEntity>lambdaQuery() |
|
|
|
|
.eq(FactoryNodePushEntity::getTransportNo, factoryNodePushEntity.getTransportNo()) |
|
|
|
|
.eq(FactoryNodePushEntity::getOrderCode, factoryNodePushEntity.getOrderCode())); |
|
|
|
|
if(CollUtil.isNotEmpty(list1)){ |
|
|
|
|
for (FactoryNodePushEntity nodePushEntity : list1) { |
|
|
|
|
String content1 = nodePushEntity.getContent(); |
|
|
|
|
String url1 = jinPaiProperties.getOldSystemHost() + jinPaiProperties.getOldSystemArrivedUrl(); |
|
|
|
|
log.info("字段缺失重新推送:{}", JSONUtil.toJsonStr(entries)); |
|
|
|
|
String result1 = HttpUtil.post(url1, content1); |
|
|
|
|
FactoryNodePushEntity factoryNodePushEntity2 = new FactoryNodePushEntity(); |
|
|
|
|
factoryNodePushEntity2.setResultContent(result1); |
|
|
|
|
factoryNodePushEntity2.setId(nodePushEntity.getId()); |
|
|
|
|
factoryNodePushService.updateById(factoryNodePushEntity2); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return ReturnT.SUCCESS; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|