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