10.8开发

This commit is contained in:
hejinbo
2023-10-08 16:56:30 +08:00
parent 80e9814cd6
commit 848581e155
5 changed files with 81 additions and 40 deletions
@@ -41,12 +41,11 @@ public class AdjudicationController extends BaseController {
/**
* 根据快递单号查询物流信息
* @param trackingNum 单号
* @param phoneLastFour 收/寄件人手机号后四位,顺丰快递需填写本字段。
* @param caseApplication
* @return
*/
@GetMapping("/logistics")
public AjaxResult getLogisticsInfo(String trackingNum,Integer phoneLastFour){
return adjudicationService.getLogisticsInfo(trackingNum,phoneLastFour);
public AjaxResult getLogisticsInfo(@Validated @RequestBody CaseApplication caseApplication){
return adjudicationService.getLogisticsInfo(caseApplication);
}
}
@@ -0,0 +1,16 @@
package com.ruoyi.wisdomarbitrate.domain.vo;
import lombok.Data;
@Data
public class LogisticsInfoVO {
/**
* 案件关联人身份类型
*/
private Integer identityType;
/**
* 物流信息
*/
private String logisticsInfo;
}
@@ -8,5 +8,5 @@ public interface IAdjudicationService {
AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail ,String apptrackingNum,String restrackingNum);
AjaxResult getLogisticsInfo(String trackingNum,Integer phoneLastFour);
AjaxResult getLogisticsInfo(CaseApplication caseApplication);
}
@@ -1,11 +1,14 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.deepoove.poi.config.Configure;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.EmailOutUtil;
import com.ruoyi.common.utils.WordUtil;
import com.ruoyi.wisdomarbitrate.domain.*;
import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO;
import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
@@ -47,6 +50,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
private EmailOutUtil emailOutUtil;
@Autowired
private ICaseApplicationService caseApplicationService;
@Override
public AjaxResult createDocument(CaseApplication caseApplication) {
try {
@@ -133,10 +137,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("day", day);
String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
//String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" +year + "/" + month + "/" + day;
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
//String saveFolderPath = "D:/data/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
String saveName = "/profile/upload/"+year + "/" + month + "/" + day +"/" +fileName;
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
String resultFilePath = saveFolderPath + "/" + fileName;
// 创建日期目录
File saveFolder = new File(saveFolderPath);
@@ -176,7 +180,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
@Override
@Transactional
public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail ,String apptrackingNum,String restrackingNum) {
public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
@@ -189,15 +193,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
List<File> fileList = new ArrayList<>();
CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
List<CaseAttach> caseAttachList = caseApplication2.getCaseAttachList();
if (caseAttachList!=null&& caseAttachList.size()>0){
if (caseAttachList != null && caseAttachList.size() > 0) {
for (CaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == 3){
if (caseAttach.getAnnexType() == 3) {
String annexPath = caseAttach.getAnnexPath();
fileList.add(new File(annexPath));
}
}
}
if (fileList.size()<1){
if (fileList.size() < 1) {
return AjaxResult.error("未查询到裁决书");
}
File file = fileList.get(0);
@@ -218,13 +222,13 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(id);
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if (caseAffiliates!=null&&caseAffiliates.size()>0){
if (caseAffiliates != null && caseAffiliates.size() > 0) {
for (CaseAffiliate affiliate : caseAffiliates) {
if (affiliate.getIdentityType() == 1){ //申请人
if (affiliate.getIdentityType() == 1) { //申请人
affiliate.setSendEmail(appEmail);
affiliate.setTrackNum(apptrackingNum);
caseAffiliateMapper.updataCaseAffiliate(affiliate);
}else {
} else {
affiliate.setSendEmail(resEmail);
affiliate.setTrackNum(restrackingNum);
caseAffiliateMapper.updataCaseAffiliate(affiliate);
@@ -238,36 +242,56 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
@Override
public AjaxResult getLogisticsInfo(String trackingNum, Integer phoneLastFour) {
public AjaxResult getLogisticsInfo(CaseApplication caseApplication) {
try {
//快递单号查询
String key = "70ba5c7b327f71fccd5924f70e3e7b7f";
String com = "auto";
// 构造查询字符串参数
String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d",
URLEncoder.encode(key, "UTF-8"),
URLEncoder.encode(com, "UTF-8"),
URLEncoder.encode(trackingNum, "UTF-8"),
phoneLastFour);
// 拼接到API URL中
String fullUrl = apiUrl + "?" + queryParameters;
URL url = new URL(fullUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
StringBuilder response = new StringBuilder();
while ((line = reader.readLine()) != null) {
response.append(line);
//根据案件id查询单号信息
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(caseApplication.getId());
List<LogisticsInfoVO> logisticsInfoVOList = new ArrayList<>();
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if (caseAffiliates != null && caseAffiliates.size() > 0) {
for (CaseAffiliate affiliate : caseAffiliates) {
LogisticsInfoVO logisticsInfoVO = new LogisticsInfoVO();
String trackNum = affiliate.getTrackNum();
if (trackNum != null) {
// 构造查询字符串参数
String queryParameters = String.format("key=%s&com=%s&no=%s&phone=%d",
URLEncoder.encode(key, "UTF-8"),
URLEncoder.encode(com, "UTF-8"),
URLEncoder.encode(trackNum, "UTF-8"), null);
// 拼接到API URL中
String fullUrl = apiUrl + "?" + queryParameters;
URL url = new URL(fullUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
StringBuilder response = new StringBuilder();
while ((line = reader.readLine()) != null) {
response.append(line);
}
reader.close();
// 处理返回的响应数据\
JSONObject jsonObject = JSON.parseObject(response.toString());
// 提取 "data" 字段并转换为字符串
String data = jsonObject.getString("data");
if (data != null) {
logisticsInfoVO.setIdentityType(affiliate.getIdentityType());
logisticsInfoVO.setLogisticsInfo(data);
logisticsInfoVOList.add(logisticsInfoVO);
}
} else {
// 请求失败
return AjaxResult.error("请求失败,错误码:" + responseCode);
}
}
}
reader.close();
// 处理返回的响应数据
return AjaxResult.success(response);
} else {
// 请求失败
return AjaxResult.error("请求失败,错误码:" + responseCode);
return AjaxResult.success(logisticsInfoVOList);
}
} catch (IOException e) {
e.printStackTrace();
@@ -18,12 +18,14 @@
<result property="identityNumAgent" column="identity_num_agent" />
<result property="contactTelphoneAgent" column="contact_telphone_agent" />
<result property="contactAddressAgent" column="contact_address_agent" />
<result property="trackNum" column="track_num" />
</resultMap>
<select id="selectCaseAffiliate" parameterType="CaseAffiliate" resultMap="CaseAffiliateResult">
select c.id ,c.case_appli_id ,c.identity_type ,c.name ,c.identity_num ,c.contact_telphone ,c.contact_address ,
c.work_address ,c.work_telphone ,c.name_agent, c.identity_num_agent ,c.contact_telphone_agent ,c.contact_address_agent
c.work_address ,c.work_telphone ,c.name_agent, c.identity_num_agent ,c.contact_telphone_agent ,c.contact_address_agent,
c.track_num
from case_affiliate c
<where>
<if test="caseAppliId != null ">