|
|
@ -10,14 +10,15 @@ import com.djy.invoice.model.*;
|
|
|
|
import com.djy.invoice.model.mapper.*;
|
|
|
|
import com.djy.invoice.model.mapper.*;
|
|
|
|
import com.djy.invoice.service.InvLinkInfoService;
|
|
|
|
import com.djy.invoice.service.InvLinkInfoService;
|
|
|
|
import com.djy.invoice.service.UploadData;
|
|
|
|
import com.djy.invoice.service.UploadData;
|
|
|
|
import com.djy.invoice.util.SendEmailUtil;
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
import okhttp3.*;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
import java.text.DateFormat;
|
|
|
|
import java.text.DateFormat;
|
|
|
|
import java.text.ParseException;
|
|
|
|
import java.text.ParseException;
|
|
|
@ -52,6 +53,8 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
|
|
|
|
|
|
|
|
|
|
|
|
private static String subject;
|
|
|
|
private static String subject;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static String urlPath;
|
|
|
|
|
|
|
|
|
|
|
|
public static BigDecimal invoiceAmount;
|
|
|
|
public static BigDecimal invoiceAmount;
|
|
|
|
private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
|
|
|
|
private static final String dateFormat = "yyyy-MM-dd HH:mm:ss";
|
|
|
|
private static final DateFormat df = new SimpleDateFormat(dateFormat);
|
|
|
|
private static final DateFormat df = new SimpleDateFormat(dateFormat);
|
|
|
@ -1187,7 +1190,7 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
|
|
|
|
param.setList(listEmail);
|
|
|
|
param.setList(listEmail);
|
|
|
|
|
|
|
|
|
|
|
|
String str = JSONObject.toJSONString(param.getList());
|
|
|
|
String str = JSONObject.toJSONString(param.getList());
|
|
|
|
SendEmailUtil.sendEMail(str);
|
|
|
|
sendEMail(str);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
@ -1216,28 +1219,25 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
|
|
|
|
cxParams.setCriteria(criteria);
|
|
|
|
cxParams.setCriteria(criteria);
|
|
|
|
return cxParams;
|
|
|
|
return cxParams;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void sendEMail(String json){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
MediaType mediaType = MediaType.parse("application/json");
|
|
|
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, json);
|
|
|
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
|
|
|
.url(urlPath)
|
|
|
|
|
|
|
|
.method("POST", body)
|
|
|
|
|
|
|
|
.addHeader("Content-Type", "application/json")
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Response response = client.newCall(request).execute();
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 发起请求并显示响应报文
|
|
|
|
|
|
|
|
public void doPost(String cmdName, RequestData requestData) throws Exception {
|
|
|
|
|
|
|
|
// 生成请求报文
|
|
|
|
|
|
|
|
// String requestJson = JSON.toJSONStringWithDateFormat(requestData, dateFormat, SerializerFeature.NotWriteRootClassName);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 对请求报文签名,生成签名字符串
|
|
|
|
|
|
|
|
// String sign = CertificateUtils.signToBase64(requestJson.getBytes(encode), keyStorePath, keyStoreAbner, keyStorePassWord);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// // 发起请求并显示响应报文
|
|
|
|
|
|
|
|
// Map<String, String> vars = new HashMap<String, String>();
|
|
|
|
|
|
|
|
// vars.put("appCode", URLEncoder.encode(appCode, encode));
|
|
|
|
|
|
|
|
// vars.put("cmdName", URLEncoder.encode(cmdName, encode));
|
|
|
|
|
|
|
|
// vars.put("sign", URLEncoder.encode(sign, encode));
|
|
|
|
|
|
|
|
// String responseJson = HttpUtil.doPost(facadeUrl, vars, requestJson, 10000, 10000);
|
|
|
|
|
|
|
|
// System.out.println("响应报文:" + responseJson);
|
|
|
|
|
|
|
|
// ResponseData responseData = JSON.parseObject(responseJson, ResponseData.class);
|
|
|
|
|
|
|
|
// System.out.println("响应代码:" + responseData.getCode());
|
|
|
|
|
|
|
|
// System.out.println("响应消息:" + responseData.getMessage());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String getCmdName() {
|
|
|
|
public static String getCmdName() {
|
|
|
|
return cmdName;
|
|
|
|
return cmdName;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1290,4 +1290,10 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
|
|
|
|
public void setSubject(String subject) {
|
|
|
|
public void setSubject(String subject) {
|
|
|
|
InvLinkInfoServiceImpl.subject = subject;
|
|
|
|
InvLinkInfoServiceImpl.subject = subject;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${spring.mail.url}")
|
|
|
|
|
|
|
|
public void setUrlPath(String urlPath) {
|
|
|
|
|
|
|
|
InvLinkInfoServiceImpl.urlPath = urlPath;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|