You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.2 KiB
Java

2 years ago
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.stereotype.Component;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Slf4j
@Component
//@EnableAsync
2 years ago
public class AsyncMethod {
@Autowired
private Upload_checkDao upload_checkDao;
@Autowired
private Client createDynamicClient;
2 years ago
// @Async(value = "asyncServiceExecutor")
public void sendData2(String xml) throws Exception {
Object[] objects = createDynamicClient.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("上传失败");
}
}
}
}
}
1 year ago
}
// @Async(value = "asyncServiceExecutor")
1 year ago
public void updateRecordId(BigInteger maxid,String type) {
if (maxid != null && maxid.longValue() > 0) {
upload_checkDao.updateByPrimaryKey(type, maxid, new Date());
}
2 years ago
}
}