|
|
@ -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,27 +1219,24 @@ public class InvLinkInfoServiceImpl implements InvLinkInfoService {
|
|
|
|
cxParams.setCriteria(criteria);
|
|
|
|
cxParams.setCriteria(criteria);
|
|
|
|
return cxParams;
|
|
|
|
return cxParams;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void sendEMail(String json){
|
|
|
|
// 发起请求并显示响应报文
|
|
|
|
|
|
|
|
public void doPost(String cmdName, RequestData requestData) throws Exception {
|
|
|
|
OkHttpClient client = new OkHttpClient().newBuilder()
|
|
|
|
// 生成请求报文
|
|
|
|
.build();
|
|
|
|
// String requestJson = JSON.toJSONStringWithDateFormat(requestData, dateFormat, SerializerFeature.NotWriteRootClassName);
|
|
|
|
MediaType mediaType = MediaType.parse("application/json");
|
|
|
|
//
|
|
|
|
RequestBody body = RequestBody.create(mediaType, json);
|
|
|
|
// // 对请求报文签名,生成签名字符串
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
// String sign = CertificateUtils.signToBase64(requestJson.getBytes(encode), keyStorePath, keyStoreAbner, keyStorePassWord);
|
|
|
|
.url(urlPath)
|
|
|
|
//
|
|
|
|
.method("POST", body)
|
|
|
|
// // 发起请求并显示响应报文
|
|
|
|
.addHeader("Content-Type", "application/json")
|
|
|
|
// Map<String, String> vars = new HashMap<String, String>();
|
|
|
|
.build();
|
|
|
|
// vars.put("appCode", URLEncoder.encode(appCode, encode));
|
|
|
|
try {
|
|
|
|
// vars.put("cmdName", URLEncoder.encode(cmdName, encode));
|
|
|
|
Response response = client.newCall(request).execute();
|
|
|
|
// vars.put("sign", URLEncoder.encode(sign, encode));
|
|
|
|
} catch (IOException e) {
|
|
|
|
// String responseJson = HttpUtil.doPost(facadeUrl, vars, requestJson, 10000, 10000);
|
|
|
|
e.printStackTrace();
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|