|
|
|
|
package com.shxy.i2.Tool;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
|
import cn.hutool.json.XML;
|
|
|
|
|
import com.shxy.i2.constant.CommonStatus;
|
|
|
|
|
import com.shxy.i2.constant.Constant;
|
|
|
|
|
import com.shxy.i2.dao.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.cxf.endpoint.Client;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.math.BigInteger;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Component
|
|
|
|
|
public class AsyncMethod {
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_Dlq_JbfdDao data_dlq_jbfdDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_Byq_JbfdDao data_byq_jbfdDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_SF6_QtylDao data_sf6_qtylDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_YspDao data_yspDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_WsDao data_wsDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_TxDao data_txDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_DcywDao data_dcywDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_Dr_JyjcDao data_dr_jyjcDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_Jsyhw_JyjcDao data_jsyhw_jyjcDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_FhzxqDao data_fhzxqDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_FhdlbxDao data_fhdlbxDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_SF6_QtsfDao data_sf6_qtsfDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_MicroclimateDao data_microclimateDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Data_CnjDao data_cnjDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private Upload_checkDao upload_checkDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Async(value = "asyncServiceExecutor")
|
|
|
|
|
public void sendData(Client client, List<BigInteger> idlist, String xml, String type) throws Exception {
|
|
|
|
|
Object[] objects = client.invoke("uploadCACData", xml);
|
|
|
|
|
String threadId = Thread.currentThread().getName();
|
|
|
|
|
log.info("线程序号: " + threadId + "当前时间:" + new Date());
|
|
|
|
|
if (objects != null && objects.length > 0) {
|
|
|
|
|
String string = String.valueOf(objects[0]);
|
|
|
|
|
log.info("返回的长度 : " + objects.length + " 返回的对象 : " + string);
|
|
|
|
|
JSONObject jsonObject = XML.toJSONObject(string);
|
|
|
|
|
if (jsonObject != null) {
|
|
|
|
|
JSONObject response = (JSONObject) jsonObject.get("response");
|
|
|
|
|
if (response != null) {
|
|
|
|
|
JSONObject result = (JSONObject) response.get("result");
|
|
|
|
|
if (result != null) {
|
|
|
|
|
Integer code = (Integer) result.get("code");
|
|
|
|
|
if (code != null && code.intValue() == 0) {
|
|
|
|
|
log.info("上传成功");
|
|
|
|
|
log.info("修改的id: " + idlist.toString());
|
|
|
|
|
if (CollectionUtil.isNotEmpty(idlist)) {
|
|
|
|
|
if (StrUtil.equals(type, Constant.SF6_QTYL)) {
|
|
|
|
|
data_sf6_qtylDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.BYQ_JBFD)) {
|
|
|
|
|
data_byq_jbfdDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.DLQJBFD)) {
|
|
|
|
|
data_dlq_jbfdDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.YSP)) {
|
|
|
|
|
data_yspDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.WS)) {
|
|
|
|
|
data_wsDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.TX)) {
|
|
|
|
|
data_txDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.DCYW)) {
|
|
|
|
|
data_dcywDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.DRJYJC)) {
|
|
|
|
|
data_dr_jyjcDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.JSYHW)) {
|
|
|
|
|
data_jsyhw_jyjcDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.FHZXQ)) {
|
|
|
|
|
data_fhzxqDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.FHDLBX)) {
|
|
|
|
|
data_fhdlbxDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.CNJ)) {
|
|
|
|
|
data_cnjDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.SF6_QTSF)) {
|
|
|
|
|
data_sf6_qtsfDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.WQX)) {
|
|
|
|
|
data_microclimateDao.updateList(CommonStatus.UPLOAD.value(), idlist, new Date());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log.info("上传失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Async(value = "asyncServiceExecutor")
|
|
|
|
|
public void sendJBFDData2(Client client, BigInteger maxid, ArrayList<Integer> list1, String xml, String type) throws Exception {
|
|
|
|
|
Object[] objects = client.invoke("uploadCACData", xml);
|
|
|
|
|
String threadId = Thread.currentThread().getName();
|
|
|
|
|
log.info("线程序号: " + threadId + "当前时间:" + new Date());
|
|
|
|
|
// log.info("上传的油色谱数据: " + xml);
|
|
|
|
|
if (objects != null && objects.length > 0) {
|
|
|
|
|
String string = String.valueOf(objects[0]);
|
|
|
|
|
log.info("返回的长度 : " + objects.length + " 返回的对象 : " + string);
|
|
|
|
|
JSONObject jsonObject = XML.toJSONObject(string);
|
|
|
|
|
if (jsonObject != null) {
|
|
|
|
|
JSONObject response = (JSONObject) jsonObject.get("response");
|
|
|
|
|
if (response != null) {
|
|
|
|
|
JSONObject result = (JSONObject) response.get("result");
|
|
|
|
|
if (result != null) {
|
|
|
|
|
Integer code = (Integer) result.get("code");
|
|
|
|
|
if (code != null && code.intValue() == 0) {
|
|
|
|
|
log.info("上传成功");
|
|
|
|
|
log.info("修改的id: " + list1.toString());
|
|
|
|
|
if (CollectionUtil.isNotEmpty(list1)) {
|
|
|
|
|
if (StrUtil.equals(type, Constant.BYQ_JBFD)) {
|
|
|
|
|
data_byq_jbfdDao.updateDataList2(CommonStatus.UPLOAD.value(), maxid, list1, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.DLQJBFD)) {
|
|
|
|
|
data_dlq_jbfdDao.updateDataList2(CommonStatus.UPLOAD.value(), maxid, list1, new Date());
|
|
|
|
|
} else if (StrUtil.equals(type, Constant.YSP)) {
|
|
|
|
|
data_yspDao.updateDataList2(CommonStatus.UPLOAD.value(), maxid, list1, new Date());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log.info("上传失败");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Async(value = "asyncServiceExecutor")
|
|
|
|
|
public void sendData2(Client client, String xml) throws Exception {
|
|
|
|
|
// Object[] objects = client.invoke("uploadCACData", xml);
|
|
|
|
|
// String threadId = Thread.currentThread().getName();
|
|
|
|
|
// log.info("线程序号: " + threadId + "当前时间:" + new Date());
|
|
|
|
|
// if (objects != null && objects.length > 0) {
|
|
|
|
|
// String string = String.valueOf(objects[0]);
|
|
|
|
|
// log.info("返回的长度 : " + objects.length + " 返回的对象 : " + string);
|
|
|
|
|
// JSONObject jsonObject = XML.toJSONObject(string);
|
|
|
|
|
// if (jsonObject != null) {
|
|
|
|
|
// JSONObject response = (JSONObject) jsonObject.get("response");
|
|
|
|
|
// if (response != null) {
|
|
|
|
|
// JSONObject result = (JSONObject) response.get("result");
|
|
|
|
|
// if (result != null) {
|
|
|
|
|
// Integer code = (Integer) result.get("code");
|
|
|
|
|
// if (code != null && code.intValue() == 0) {
|
|
|
|
|
// log.info("上传成功");
|
|
|
|
|
// } else {
|
|
|
|
|
// log.info("上传失败");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Async(value = "asyncServiceExecutor")
|
|
|
|
|
public void sendYxData(Client client, BigInteger maxid, String xml) throws Exception {
|
|
|
|
|
// Object[] objects = client.invoke("uploadCACData", xml);
|
|
|
|
|
// if (objects != null && objects.length > 0) {
|
|
|
|
|
// String string = String.valueOf(objects[0]);
|
|
|
|
|
// log.info("返回的长度 : " + objects.length + " 返回的对象 : " + string);
|
|
|
|
|
// JSONObject jsonObject = XML.toJSONObject(string);
|
|
|
|
|
// if (jsonObject != null) {
|
|
|
|
|
// JSONObject response = (JSONObject) jsonObject.get("response");
|
|
|
|
|
// if (response != null) {
|
|
|
|
|
// JSONObject result = (JSONObject) response.get("result");
|
|
|
|
|
// if (result != null) {
|
|
|
|
|
// Integer code = (Integer) result.get("code");
|
|
|
|
|
// if (code != null && code.intValue() == 0) {
|
|
|
|
|
// log.info("上传成功");
|
|
|
|
|
if (maxid != null && maxid.longValue() > 0) {
|
|
|
|
|
upload_checkDao.updateByPrimaryKey(Constant.YXID, maxid, new Date());
|
|
|
|
|
}
|
|
|
|
|
// } else {
|
|
|
|
|
// log.info("上传失败");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void updateRecordId(BigInteger maxid,String type) {
|
|
|
|
|
if (maxid != null && maxid.longValue() > 0) {
|
|
|
|
|
upload_checkDao.updateByPrimaryKey(type, maxid, new Date());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|