案件导入修改

发送房间号短信接口
This commit is contained in:
18792927508
2023-10-10 16:00:34 +08:00
parent 7b6bca31ba
commit 62f1e3111d
10 changed files with 178 additions and 56 deletions
@@ -332,10 +332,10 @@ public class CaseApplication extends BaseEntity {
* 申请人主体信息
*/
/** 姓名 */
@Excel(name = "申请人主体信息-申请人姓名",width = 26)
@Excel(name = "申请人主体信息-申请人(机构)",width = 26)
private String name;
/** 身份证号 */
@Excel(name = "申请人主体信息-身份证号",width = 26)
@Excel(name = "申请人主体信息-代码",width = 26)
private String identityNum;
/** 联系电话 */
@@ -1,29 +0,0 @@
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,23 @@
package com.ruoyi.wisdomarbitrate.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
/**
* @author wangqiong
* @description 发送房间号短信入参类
* @date 2023-10-10 15:20
*/
@Data
public class SendRoomNoMessageVO implements Serializable {
private static final long serialVersionUID = 1L;
@NotEmpty(message = "案件id不能为空")
private Long id;
@NotEmpty(message = "房间号不能为空")
private String roomNo;
}
@@ -1,10 +1,19 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ArbitratorMapper {
List<Arbitrator> selectArbitratorList(Arbitrator arbitrator);
/**
* 根据案件id和身份类型查询案件关联人
* @param caseAppliId
* @param identityType
* @return
*/
Arbitrator selectArbitratorById(@Param("caseAppliId") Long caseAppliId,@Param("identityType") Integer identityType);
}
@@ -1,6 +1,7 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
import java.util.List;
@@ -37,4 +38,6 @@ public interface ICaseApplicationService {
int submitCaseApplicationCheck(CaseApplication caseApplication);
CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication);
String sendRoomNoMessage(SendRoomNoMessageVO messageVO);
}
@@ -1,13 +1,18 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.wisdomarbitrate.domain.*;
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
import com.ruoyi.wisdomarbitrate.mapper.*;
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +23,8 @@ import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
@Service
public class CaseApplicationServiceImpl implements ICaseApplicationService {
@@ -34,6 +41,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Autowired
private CaseAttachMapper caseAttachMapper;
@Autowired
private SysDeptMapper sysDeptMapper;
@@ -52,7 +61,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
//根据仲裁费用计费规则计算应缴费用
//暂时设置计费比率为0.01
BigDecimal feeRate = new BigDecimal(0.01);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
// 获取自动编码
String caseNum = generateCaseNum();
@@ -60,16 +69,43 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
if(caseAffiliates!=null&&caseAffiliates.size()>0){
for (CaseAffiliate caseAffiliate : caseAffiliates){
caseAffiliate.setCaseAppliId(caseApplication.getId());
if (caseAffiliates != null && caseAffiliates.size() > 0) {
// 查询所有的组织机构,组装成map
List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
if (CollectionUtil.isEmpty(deptList)) {
deptList = new ArrayList<>();
}
Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId));
for (CaseAffiliate caseAffiliate : caseAffiliates) {
caseAffiliate.setCaseAppliId(caseApplication.getId());
// 将组织机构id设为申请人名称
if (deptMap.containsKey(caseApplication.getName())) {
caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName())));
} else {
// 如果不存在则新增
SysDept dept = new SysDept();
dept.setParentId(0L);
dept.setDeptName(caseApplication.getName());
dept.setAncestors("0");
dept.setOrderNum(1);
dept.setStatus("0");
dept.setDelFlag("0");
dept.setCreateBy(getUsername());
dept.setUpdateBy(getUsername());
sysDeptMapper.insertDept(dept);
caseAffiliate.setName(String.valueOf(dept.getDeptId()));
}
}
caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
}
List<CaseAttach> caseAttachList = caseApplication.getCaseAttachList();
if(caseAttachList!=null&&caseAttachList.size()>0){
for (CaseAttach caseAttach : caseAttachList){
if (caseAttachList != null && caseAttachList.size() > 0) {
for (CaseAttach caseAttach : caseAttachList) {
caseAttach.setCaseAppliId(caseApplication.getId());
caseAttachMapper.updateCaseAttach(caseAttach);
}
@@ -213,6 +249,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
int successNum = 0;
int failureNum = 0;
if(caseApplicationList!=null&&caseApplicationList.size()>0){
// 1,查询所有的组织机构,组装成map
List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
for (int i = 0; i < caseApplicationList.size(); i++){
CaseApplication caseApplication = caseApplicationList.get(i);
@@ -224,7 +262,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
//赋值CaseApplication的案件关联人信息
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
// 组装案件关联人信息
assignmentCaseAffiliates(caseApplication,caseAffiliatesnew,deptList);
// int caseApplicationCount = selectCaseApplicationCount(caseApplication);
// if(caseApplicationCount>0){
@@ -415,6 +454,32 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
return caseApplicationselect;
}
/**
* 给被申请人发送房间号短信
* @param messageVO
* @return
*/
@Override
public String sendRoomNoMessage(SendRoomNoMessageVO messageVO) {
Arbitrator arbitrator = arbitratorMapper.selectArbitratorById(messageVO.getId(), 2);
if(null==arbitrator){
return "被申请人不存在";
}
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(messageVO.getId());
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
//发送短信通知
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1948332");
// 1948332 普通短信 开庭审理房间号通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请知晓,如非本人操作,请忽略本短信。
request.setPhone(arbitrator.getTelephone());
request.setTemplateParamSet(new String[]{arbitrator.getArbitratorName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()});
return "短信发送成功";
}
@Override
@Transactional
public int pendTralSure(CaseApplication caseApplication) {
@@ -509,12 +574,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew) {
private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew,List<SysDept> deptList) {
// 申请人信息
CaseAffiliate caseAffiliate = new CaseAffiliate();
// BeanUtils.copyBeanProp(caseApplication,caseAffiliate);
BeanUtils.copyBeanProp(caseAffiliate,caseApplication);
caseAffiliate.setIdentityType(1);
// 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构
setApplicantOrganization(caseAffiliate,caseApplication,deptList);
caseAffiliatesnew.add(caseAffiliate);
// 组装被申请人信息
@@ -522,6 +590,40 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplication.setCaseAffiliates(caseAffiliatesnew);
}
/**
* 设置申请人的组织机构
* @param caseAffiliate
* @param caseApplication
*/
@DataScope(deptAlias = "d")
private void setApplicantOrganization(CaseAffiliate caseAffiliate, CaseApplication caseApplication, List<SysDept> deptList ) {
if(CollectionUtil.isNotEmpty(deptList)){
Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId));
// 将组织机构id设为申请人名称
if(deptMap.containsKey(caseApplication.getName())){
caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName())));
}else {
// 如果不存在则新增
SysDept dept = new SysDept();
dept.setParentId(0L);
dept.setDeptName(caseApplication.getName());
dept.setAncestors("0");
dept.setOrderNum(1);
dept.setStatus("0");
dept.setDelFlag("0");
dept.setCreateBy(getUsername());
dept.setUpdateBy(getUsername());
sysDeptMapper.insertDept(dept);
caseAffiliate.setName(String.valueOf(dept.getDeptId()));
}
}
}
/**
* 组装被申请人信息
* @param caseApplication