优化身份认证接口 #43

Merged
qtz merged 2 commits from qtz into dev 2023-10-10 04:15:41 +00:00
16 changed files with 573 additions and 150 deletions
Showing only changes of commit 07704327ab - Show all commits
@@ -26,4 +26,6 @@ public class RegisterController {
public AjaxResult createDocument(@Validated @RequestBody PersonRegisterVO personRegisterVO) {
return signRegisterService.registerPerson(personRegisterVO);
}
// @PostMapping("/registerEnterprise")
// public AjaxResult
}
@@ -3,6 +3,7 @@ package com.ruoyi.web.controller.wisdomarbitrate;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO;
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -41,12 +42,41 @@ 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(CaseApplication caseApplication){
return adjudicationService.getLogisticsInfo(caseApplication);
}
/**
* 签名(暂时只改案件状态)
* @param caseApplication
* @return
*/
@PostMapping("/signature")
public AjaxResult signature(@Validated @RequestBody CaseApplication caseApplication){
return adjudicationService.signature(caseApplication);
}
/**
* 归档(暂时只改案件状态)
* @param caseApplication
* @return
*/
@PostMapping("/caseFile")
public AjaxResult caseFile(@Validated @RequestBody CaseApplication caseApplication){
return adjudicationService.caseFile(caseApplication);
}
/**
* 送达(不包含发送电子邮件)
* @param bookSendVO
* @return
*/
@PostMapping("/service")
public AjaxResult service(@RequestBody BookSendVO bookSendVO){
return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum());
}
}
@@ -6,7 +6,7 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://121.40.189.20:3306/arbitrate?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&useSSL=false
url: jdbc:mysql://121.40.189.20:3306/arbitrate?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai&useSSL=false
username: root
password: root123456
# 从库数据源
@@ -37,12 +37,13 @@ public class CaseApplicationConstants {
/**待仲裁文书签名*/
public static final int SIGN_ARBITRATION = 13;
/** 待仲裁文书用印 */
public static final int ARBITRATED_SEAL = 14;
public static final int ARBITRATED_SEAL = 14;
/** 待仲裁文书送达 */
public static final int ARBITRATION_DELIVERY = 15;
/** 待案件归档*/
public static final int CASE_FILING = 16;
/** 已归档*/
public static final int CASE_ARCHIVED = 17;
@@ -1,118 +1,117 @@
package com.ruoyi.common.core.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* Entity基类
*
*
* @author ruoyi
*/
public class BaseEntity implements Serializable
{
public class BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/** 搜索值 */
/**
* 搜索值
*/
@JsonIgnore
private String searchValue;
/** 创建者 */
/**
* 创建者
*/
private String createBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private Date createTime;
/** 更新者 */
/**
* 更新者
*/
private String updateBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
/**
* 更新时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private Date updateTime;
/** 备注 */
/**
* 备注
*/
private String remark;
/** 请求参数 */
/**
* 请求参数
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
public String getSearchValue()
{
public String getSearchValue() {
return searchValue;
}
public void setSearchValue(String searchValue)
{
public void setSearchValue(String searchValue) {
this.searchValue = searchValue;
}
public String getCreateBy()
{
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy)
{
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime()
{
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime)
{
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateBy()
{
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy)
{
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateTime()
{
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getRemark()
{
public String getRemark() {
return remark;
}
public void setRemark(String remark)
{
public void setRemark(String remark) {
this.remark = remark;
}
public Map<String, Object> getParams()
{
if (params == null)
{
public Map<String, Object> getParams() {
if (params == null) {
params = new HashMap<>();
}
return params;
}
public void setParams(Map<String, Object> params)
{
public void setParams(Map<String, Object> params) {
this.params = params;
}
}
@@ -25,6 +25,7 @@ public class ApplicationConfig
@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization()
{
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
// return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone("Asia/Shanghai");
}
}
@@ -13,7 +13,7 @@ public class CaseApplication extends BaseEntity {
/** ID */
private Long id;
/** 案件编号 */
@Excel(name = "案件编号")
// @Excel(name = "案件编号")
private String caseNum;
/** 案件标的 */
@Excel(name = "案件标的")
@@ -58,8 +58,7 @@ public class CaseApplication extends BaseEntity {
/** 开庭日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date hearDate;
/** 申请人仲裁诉求 */
private String arbitratClaims;
/** 借款开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "借款开始日期")
@@ -80,6 +79,9 @@ public class CaseApplication extends BaseEntity {
/** 申请人主张违约金 */
@Excel(name = "申请人主张违约金")
private BigDecimal claimLiquidDamag;
/** 申请人仲裁诉求 */
@Excel(name = "申请人仲裁诉求")
private String arbitratClaims;
/** 仲裁应缴费用 */
private BigDecimal feePayable;
@@ -324,36 +326,78 @@ public class CaseApplication extends BaseEntity {
}
/** 身份类型 */
@Excel(name = "身份类型")
// @Excel(name = "身份类型")
private int identityType;
/**
* 申请人主体信息
*/
/** 姓名 */
@Excel(name = "姓名")
@Excel(name = "申请人主体信息-申请人姓名",width = 26)
private String name;
/** 身份证号 */
@Excel(name = "身份证号")
@Excel(name = "申请人主体信息-身份证号",width = 26)
private String identityNum;
/** 单位电话 */
@Excel(name = "单位电话")
private String workTelphone;
/** 联系电话 */
@Excel(name = "联系电话")
@Excel(name = "申请人主体信息-联系电话",width = 26)
private String contactTelphone;
/** 联系地址 */
@Excel(name = "联系地址")
@Excel(name = "申请人主体信息-联系地址",width = 26)
private String contactAddress;
/** 单位电话 */
@Excel(name = "申请人主体信息-单位电话",width = 26)
private String workTelphone;
/** 单位地址 */
@Excel(name = "单位地址")
@Excel(name = "申请人主体信息-单位地址",width = 26)
private String workAddress;
/** 代理人姓名 */
@Excel(name = "代理人姓名")
@Excel(name = "申请人主体信息-代理人姓名",width = 26)
private String nameAgent;
/** 身份证号 */
@Excel(name = "代理人身份证号")
@Excel(name = "申请人主体信息-代理人身份证号",width = 26)
private String identityNumAgent;
/** 联系电话 */
@Excel(name = "代理人联系电话")
@Excel(name = "申请人主体信息-代理人联系电话",width = 26)
private String contactTelphoneAgent;
/** 联系地址 */
@Excel(name = "申请人主体信息-代理人联系地址",width = 26)
private String contactAddressAgent;
/**
* 被申请人主体信息
*/
/** 姓名 */
@Excel(name = "被申请人主体信息-申请人姓名",width = 26)
private String debtorName;
/** 身份证号 */
@Excel(name = "被申请人主体信息-身份证号",width = 26)
private String debtorIdentityNum;
/** 联系电话 */
@Excel(name = "被申请人主体信息-联系电话",width = 26)
private String debtorContactTelphone;
/** 联系地址 */
@Excel(name = "被申请人主体信息-联系地址",width = 26)
private String debtorContactAddress;
/** 单位电话 */
@Excel(name = "被申请人主体信息-单位电话",width = 26)
private String debtorWorkTelphone;
/** 单位地址 */
@Excel(name = "被申请人主体信息-单位地址",width = 26)
private String debtorWorkAddress;
/** 代理人姓名 */
@Excel(name = "被申请人主体信息-代理人姓名",width = 26)
private String debtorNameAgent;
/** 身份证号 */
@Excel(name = "被申请人主体信息-代理人身份证号",width = 26)
private String debtorIdentityNumAgent;
/** 联系电话 */
@Excel(name = "被申请人主体信息-代理人联系电话",width = 26)
private String debtorContactTelphoneAgent;
/** 联系地址 */
@Excel(name = "被申请人主体信息-代理人联系地址",width = 26)
private String debtorContactAddressAgent;
public int getIdentityType() {
return identityType;
@@ -443,12 +487,86 @@ public class CaseApplication extends BaseEntity {
this.contactAddressAgent = contactAddressAgent;
}
/** 联系地址 */
@Excel(name = "代理人联系地址")
private String contactAddressAgent;
public String getDebtorName() {
return debtorName;
}
public void setDebtorName(String debtorName) {
this.debtorName = debtorName;
}
public String getDebtorIdentityNum() {
return debtorIdentityNum;
}
public void setDebtorIdentityNum(String debtorIdentityNum) {
this.debtorIdentityNum = debtorIdentityNum;
}
public String getDebtorContactTelphone() {
return debtorContactTelphone;
}
public void setDebtorContactTelphone(String debtorContactTelphone) {
this.debtorContactTelphone = debtorContactTelphone;
}
public String getDebtorContactAddress() {
return debtorContactAddress;
}
public void setDebtorContactAddress(String debtorContactAddress) {
this.debtorContactAddress = debtorContactAddress;
}
public String getDebtorWorkTelphone() {
return debtorWorkTelphone;
}
public void setDebtorWorkTelphone(String debtorWorkTelphone) {
this.debtorWorkTelphone = debtorWorkTelphone;
}
public String getDebtorWorkAddress() {
return debtorWorkAddress;
}
public void setDebtorWorkAddress(String debtorWorkAddress) {
this.debtorWorkAddress = debtorWorkAddress;
}
public String getDebtorNameAgent() {
return debtorNameAgent;
}
public void setDebtorNameAgent(String debtorNameAgent) {
this.debtorNameAgent = debtorNameAgent;
}
public String getDebtorIdentityNumAgent() {
return debtorIdentityNumAgent;
}
public void setDebtorIdentityNumAgent(String debtorIdentityNumAgent) {
this.debtorIdentityNumAgent = debtorIdentityNumAgent;
}
public String getDebtorContactTelphoneAgent() {
return debtorContactTelphoneAgent;
}
public void setDebtorContactTelphoneAgent(String debtorContactTelphoneAgent) {
this.debtorContactTelphoneAgent = debtorContactTelphoneAgent;
}
public String getDebtorContactAddressAgent() {
return debtorContactAddressAgent;
}
public void setDebtorContactAddressAgent(String debtorContactAddressAgent) {
this.debtorContactAddressAgent = debtorContactAddressAgent;
}
public Long getId() {
return id;
@@ -0,0 +1,26 @@
package com.ruoyi.wisdomarbitrate.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BookSendVO {
/**
* 案件id
* 申请人邮箱
* 被申请人邮箱
* 申请人快递编号
* 被申请人快递编号
*/
private Long id;
private String appEmail;
private String resEmail;
private String apptrackingNum;
private String restrackingNum;
}
@@ -0,0 +1,29 @@
package com.ruoyi.wisdomarbitrate.domain.vo;
import lombok.Data;
import java.util.Date;
/**
* @description 案件操作日志实体
* @Author wangqiong
* @Date 2023/10/09 15:18
* @Version V1.0
**/
@Data
public class CaseLogVO {
/**日志id*/
private String logId;
/**操作人id*/
private String operatorId;
/**操作人名称*/
private String operatorName;
/**操作人ip*/
private String ip;
/**操作时间*/
private Date operateTime;
/**操作明细*/
private String operateDetail;
/**操作类型*/
private String operateType;
}
@@ -0,0 +1,16 @@
package com.ruoyi.wisdomarbitrate.domain.vo;
import lombok.Data;
@Data
public class LogisticsInfoVO {
/**
* 案件关联人身份类型
*/
private Integer identityType;
/**
* 物流信息
*/
private String logisticsInfo;
}
@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -22,4 +23,12 @@ public interface CaseApplicationMapper {
CaseApplication selectCaseApplication(CaseApplication caseApplication);
CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication);
/**
* 查询最大编号
* @param caseNum
* @param length
* @return
*/
Integer selectCaseNumLike(@Param("caseNum") String caseNum, @Param("length") int length);
}
@@ -8,5 +8,12 @@ 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);
AjaxResult signature(CaseApplication caseApplication);
AjaxResult caseFile(CaseApplication caseApplication);
AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum);
}
@@ -1,16 +1,21 @@
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;
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.xwpf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSendException;
@@ -31,6 +36,7 @@ import java.time.format.DateTimeFormatter;
import java.util.*;
@Service
@Slf4j
public class AdjudicationServiceImpl implements IAdjudicationService {
private final String apiUrl = "http://api.cainiaoapi.com/api/exp/v1/index";
@@ -44,6 +50,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
private CaseAttachMapper caseAttachMapper;
@Autowired
private EmailOutUtil emailOutUtil;
@Autowired
private ICaseApplicationService caseApplicationService;
@Override
public AjaxResult createDocument(CaseApplication caseApplication) {
@@ -123,14 +131,18 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("arbitratorName2", secondName);
}
LocalDate now = LocalDate.now();
datas.put("year", now.getYear());
datas.put("months", now.getMonthValue());
datas.put("day", now.getDayOfMonth());
String year = Integer.toString(now.getYear());
String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth());
datas.put("year", year);
datas.put("months", month);
datas.put("day", day);
String modalFilePath = "/data/arbitrate-document/template/仲裁裁决书模板.docx";
//String modalFilePath = "D:/develop/仲裁裁决书模板 (2).docx";
String saveFolderPath = "/data/arbitrate-document/formal/" + now.getYear() + "/" + now.getMonthValue() + "/" + now.getDayOfMonth();
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 resultFilePath = saveFolderPath + "/" + fileName;
// 创建日期目录
File saveFolder = new File(saveFolderPath);
@@ -141,14 +153,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
Path destinationPath = new File(resultFilePath).toPath();
Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
caseApplicationMapper.submitCaseApplication(caseApplication1);
//将裁决书保存到附件表里
CaseAttach caseAttach = CaseAttach.builder()
.caseAppliId(id)
.annexName(fileName)
.annexPath(docFilePath)
.annexName(saveName)
.annexPath(savePath)
.annexType(3)
.build();
int i = caseAttachMapper.save(caseAttach);
@@ -169,7 +182,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);
@@ -180,16 +193,21 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
//根据案件id查询裁决书
try {
List<File> fileList = new ArrayList<>();
List<CaseAttach> caseAttachList = caseAttachMapper.queryAnnexPathByCaseId(id);
CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
List<CaseAttach> caseAttachList = caseApplication2.getCaseAttachList();
if (caseAttachList != null && caseAttachList.size() > 0) {
for (CaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == 3) {
String annexPath = caseAttach.getAnnexPath();
fileList.add(new File(annexPath));
//File file = new File("/home/ruoyi/" + annexPath);
String path = "/home/ruoyi/" + annexPath;
File file = new File(path);
System.out.println("文件是:" + file);
fileList.add(file);
}
}
}
if (fileList.size()<1){
if (fileList.size() < 1) {
return AjaxResult.error("未查询到裁决书");
}
File file = fileList.get(0);
@@ -210,13 +228,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);
@@ -230,40 +248,124 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
@Override
public AjaxResult getLogisticsInfo(String trackingNum, Integer phoneLastFour) {
public AjaxResult getLogisticsInfo(CaseApplication caseApplication) {
try {
//快递单号查询
String key = "70ba5c7b327f71fccd5924f70e3e7b7f";
String key = "729437f92468910aee6c12dbfeaee3c1";
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();
}
return null;
}
@Override
public AjaxResult signature(CaseApplication caseApplication) {
//更改案件状态(暂时)
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
caseApplicationMapper.submitCaseApplication(caseApplication);
return AjaxResult.success("签名成功,案件状态已改为待仲裁文书用印");
}
@Override
public AjaxResult caseFile(CaseApplication caseApplication) {
//更改案件状态(暂时)
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_ARCHIVED);
caseApplicationMapper.submitCaseApplication(caseApplication);
return AjaxResult.success("归档成功,案件状态已改为已归档");
}
@Override
public AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
if (caseApplication1 == null) {
return AjaxResult.error("未查询到相关案件");
}
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
caseApplicationMapper.submitCaseApplication(caseApplication1);
//保存邮箱信息和快递单号到关联人表
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(id);
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if (caseAffiliates != null && caseAffiliates.size() > 0) {
for (CaseAffiliate affiliate : caseAffiliates) {
if (affiliate.getIdentityType() == 1) { //申请人
affiliate.setSendEmail(appEmail);
affiliate.setTrackNum(apptrackingNum);
caseAffiliateMapper.updataCaseAffiliate(affiliate);
} else {
affiliate.setSendEmail(resEmail);
affiliate.setTrackNum(restrackingNum);
caseAffiliateMapper.updataCaseAffiliate(affiliate);
}
}
}
return AjaxResult.success("仲裁文书送达成功");
}
public static void main(String[] args) {
try {
List<File> fileList = new ArrayList<>();
fileList.add(new File("D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx"));
File file = fileList.get(0);
//电子邮件送达
EmailOutUtil emailOutUtil = new EmailOutUtil();
JavaMailSender javaMailSender = emailOutUtil.rebuildMailSender();
if (javaMailSender != null) {
emailOutUtil.sendMessageCarryFile("1154956315@qq.com", "案件裁决书", "您的裁决书已送达,详情请查阅附件", file
, "hjbjava@163.com", javaMailSender);
}
} catch (MailSendException e) {
e.printStackTrace();
}
}
}
@@ -1,5 +1,6 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
@@ -12,16 +13,11 @@ import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.ruoyi.common.core.domain.AjaxResult.error;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toCollection;
@Service
public class CaseApplicationServiceImpl implements ICaseApplicationService {
@@ -58,7 +54,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
BigDecimal feeRate = new BigDecimal(0.01);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
// 获取自动编码
String caseNum = generateCaseNum();
caseApplication.setCaseNum(caseNum);
@@ -83,15 +79,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
return rows;
}
/**
* 获取自动编码
* @return
*/
private String generateCaseNum() {
String currentday = DateUtils.dateTime();
String caseNum = "zc"+ currentday;
//查询出当天的案件编号的最大值 ,如等于1
Integer caseNumMax = 1;
if(caseNumMax!=null){
//根据查询到的caseNumMax拼接一个案件编号
// 自动编码格式 zc+yyyyMMdd+001
String currentDay = DateUtils.dateTime();
String caseNum = "zc"+ currentDay;
//查询出当天的案件编号的最大值
Integer maxCaseNum = caseApplicationMapper.selectCaseNumLike(caseNum,caseNum.length());
if(null == maxCaseNum){
caseNum = caseNum + "001";
}else {
caseNum += "001";
caseNum = caseNum + String.format("%03d", maxCaseNum);
}
return caseNum;
@@ -105,13 +107,28 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Override
@Transactional
public int editCaseApplication(CaseApplication caseApplication) {
//根据仲裁费用计费规则计算应缴费用
//暂时设置计费比率为0.01
BigDecimal feeRate = new BigDecimal(0.01);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
int rows = caseApplicationMapper.updataCaseApplication(caseApplication);
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
if(caseAffiliates!=null&&caseAffiliates.size()>0){
for (CaseAffiliate caseAffiliate : caseAffiliates){
caseAffiliate.setCaseAppliId(caseApplication.getId());
caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
}
}
List<CaseAttach> caseAttachList = caseApplication.getCaseAttachList();
if(caseAttachList!=null&&caseAttachList.size()>0){
for (CaseAttach caseAttach : caseAttachList){
caseAttach.setCaseAppliId(caseApplication.getId());
caseAttachMapper.updateCaseAttach(caseAttach);
}
}
return rows;
}
@@ -191,38 +208,49 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Override
@Transactional
public String importCaseApplication(List<CaseApplication> caseApplicationList, String operName) {
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
StringBuilder successMsg = new StringBuilder();
int successNum = 0;
int failureNum = 0;
if(caseApplicationList!=null&&caseApplicationList.size()>0){
List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
for (int i = 0; i < caseApplicationList.size(); i++){
CaseApplication caseApplication = caseApplicationList.get(i);
//根据仲裁费用计费规则计算应缴费用
//暂时设置计费比率为0.01
BigDecimal feeRate = new BigDecimal(0.01);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
//赋值CaseApplication的案件关联人信息
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
int caseApplicationCount = selectCaseApplicationCount(caseApplication);
if(caseApplicationCount>0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
}else {
caseApplicationListinsert.add(caseApplication);
}
// int caseApplicationCount = selectCaseApplicationCount(caseApplication);
// if(caseApplicationCount>0){
// failureNum++;
// failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
// }else {
// caseApplicationListinsert.add(caseApplication);
// }
caseApplicationListinsert.add(caseApplication);
}
if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
collectingAndThen(
toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
ArrayList::new));
// List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
// collectingAndThen(
// toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
// ArrayList::new));
//对不重复的立案对象集合的立案对象重新组装对应的案件关联人信息
if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
List<CaseApplication> caseApplicationNewList = new ArrayList<>();
for (int i = 0; i < caseApplicationListinsertDiffer.size(); i++){
CaseApplication caseApplicationinsertDiffer = caseApplicationListinsertDiffer.get(i);
// if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
List<CaseApplication> caseApplicationNewList = null;
for (int i = 0; i < caseApplicationListinsert.size(); i++){
caseApplicationNewList = new ArrayList<>();
CaseApplication caseApplicationinsertDiffer = caseApplicationListinsert.get(i);
// 设置自动编码
caseApplicationinsertDiffer.setCaseNum(generateCaseNum());
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
CaseApplication caseApplicationNew = new CaseApplication();
copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew);
@@ -244,6 +272,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
CaseApplication caseApplicationItera = caseApplicationNewList.get(k);
// 新增立案信息
caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
List<CaseAffiliate> caseAffiliates = caseApplicationItera.getCaseAffiliates();
if(caseAffiliates!=null&&caseAffiliates.size()>0){
@@ -256,7 +285,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
successMsg.append("<br/>" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功");
}
}
// }
}
@@ -265,8 +294,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}else {
throw new ServiceException("导入立案申请数据不能为空!");
}
// 编号存在不导入
if(StringUtils.isNotEmpty(failureMsg)){
return failureMsg.append(successMsg).toString();
}else {
return successMsg.toString();
return successMsg.toString();
}
}
@Override
@@ -362,7 +396,22 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Override
public CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication) {
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplicationConfirm(caseApplication);
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(caseApplication.getId());
List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if(caseAffiliatListeselect!=null){
StringBuffer applicantName = new StringBuffer();
for (int i = 0; i < caseAffiliatListeselect.size(); i++){
CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i);
int identityType = caseAffiliateselect.getIdentityType();
if(identityType==1){
applicantName.append(caseAffiliateselect.getName()).append(",");;
}
}
caseApplicationselect.setApplicantName(applicantName.toString());
}
return caseApplicationselect;
}
@@ -374,7 +423,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
//发送短信通知
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1931000");
request.setTemplateId("1947342");
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
String caseNum = caseApplicationselect.getCaseNum();
@@ -398,7 +447,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
Arbitrator arbitratorselect = arbitratorList.get(i);
//给仲裁员发送短信通知
request.setPhone(arbitratorselect.getTelephone());
// 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
// 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
String name = arbitratorselect.getArbitratorName();
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
SmsUtils.sendSms(request);
@@ -415,7 +464,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
int identityType = caseAffiliateselect.getIdentityType();
//给申请人、被申请人发送短信通知
request.setPhone(caseAffiliateselect.getContactTelphone());
// 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
// 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
String name = caseAffiliateselect.getName();
request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
SmsUtils.sendSms(request);
@@ -462,12 +511,41 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew) {
CaseAffiliate caseAffiliate = new CaseAffiliate();
// BeanUtils.copyBeanProp(caseApplication,caseAffiliate);
BeanUtils.copyBeanProp(caseAffiliate,caseApplication);
caseAffiliate.setIdentityType(1);
caseAffiliatesnew.add(caseAffiliate);
// 组装被申请人信息
caseAffiliatesnew.add( buildDebtorInfo(caseApplication));
caseApplication.setCaseAffiliates(caseAffiliatesnew);
}
/**
* 组装被申请人信息
* @param caseApplication
* @return
*/
private CaseAffiliate buildDebtorInfo(CaseApplication caseApplication) {
// 被申请人信息
CaseAffiliate debtorCaseAffiliate = new CaseAffiliate();
debtorCaseAffiliate.setCaseAppliId(caseApplication.getId());
debtorCaseAffiliate.setIdentityType(2);
debtorCaseAffiliate.setName(caseApplication.getDebtorName());
debtorCaseAffiliate.setIdentityNum(caseApplication.getDebtorIdentityNum());
debtorCaseAffiliate.setContactTelphone(caseApplication.getDebtorContactTelphone());
debtorCaseAffiliate.setContactAddress(caseApplication.getDebtorContactAddress());
debtorCaseAffiliate.setWorkTelphone(caseApplication.getDebtorWorkTelphone());
debtorCaseAffiliate.setWorkAddress(caseApplication.getDebtorWorkAddress());
debtorCaseAffiliate.setNameAgent(caseApplication.getDebtorNameAgent());
debtorCaseAffiliate.setIdentityNumAgent(caseApplication.getDebtorIdentityNumAgent());
debtorCaseAffiliate.setContactTelphoneAgent(caseApplication.getDebtorContactTelphoneAgent());
debtorCaseAffiliate.setContactAddressAgent(caseApplication.getDebtorContactAddressAgent());
return debtorCaseAffiliate;
}
private void copyCaseApplication(CaseApplication caseApplicationinsertDiffer, CaseApplication caseApplicationNew) {
caseApplicationNew.setArbitratClaims(caseApplicationinsertDiffer.getArbitratClaims());
caseApplicationNew.setCaseNum(caseApplicationinsertDiffer.getCaseNum());
@@ -478,6 +556,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplicationNew.setClaimInterestOwed(caseApplicationinsertDiffer.getClaimInterestOwed());
caseApplicationNew.setClaimPrinciOwed(caseApplicationinsertDiffer.getClaimPrinciOwed());
caseApplicationNew.setClaimLiquidDamag(caseApplicationinsertDiffer.getClaimLiquidDamag());
caseApplicationNew.setFeePayable(caseApplicationinsertDiffer.getFeePayable());
}
@@ -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 ">
@@ -49,6 +51,7 @@
<update id="updataCaseAffiliate" parameterType="CaseAffiliate">
update case_affiliate
set
case_appli_id=#{caseAppliId},
identity_type= #{identityType},
name = #{name},
identity_num = #{identityNum},
@@ -71,7 +71,7 @@
</foreach>
</if>
</where>
order by c.create_time desc
order by c.create_time desc,c.case_num desc
</select>
<select id="selectCaseApplicationCount" parameterType="CaseApplication" resultType="int">
@@ -237,9 +237,10 @@
AND c.id = #{id}
</select>
<select id="selectCaseNumLike" resultType="java.lang.Integer">
select max(substring(case_num, #{length}+1,12)+1) as maxCaseNum
from case_application where case_num like CONCAT(#{caseNum},'%') ;
</select>
</mapper>