Merge branch 'wq' of SH-Arbitrate/Arbitrate-Backend into dev

This commit was merged in pull request #44.
This commit is contained in:
2023-10-10 16:02:05 +08:00
committed by Gitea
10 changed files with 178 additions and 56 deletions
@@ -8,6 +8,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -218,5 +219,14 @@ public class CaseApplicationController extends BaseController {
/**
* 确认缴费查询立案信息
*/
@PostMapping("/sendRoomNoMessage")
public AjaxResult sendRoomNoMessage(@Validated @RequestBody SendRoomNoMessageVO messageVO)
{
String result = caseApplicationService.sendRoomNoMessage(messageVO);
return success(result);
}
}
@@ -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
@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<insert id="insertDept" parameterType="SysDept">
<insert id="insertDept" parameterType="SysDept" useGeneratedKeys="true" keyColumn="dept_id" keyProperty="deptId">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
);
</insert>
<update id="updateDept" parameterType="SysDept">
@@ -36,22 +36,21 @@
</where>
</select>
<select id="selectArbitratorById" resultMap="ArbitratorResult">
select a.id ,a.arbitrator_name ,a.title ,a.career ,a.professi_classifi ,
a.education ,a.area ,a.telephone ,a.current_case_num ,a.closed_case_num
from arbitrator a
<where>
<if test="caseAppliId != null and caseAppliId != ''">
AND ca.ase_appliId=#{caseAppliId}
</if>
<if test="identityType != null and identityType != ''">
a.identity_type=#{identityType}
</if>
</where>
</select>
</mapper>
@@ -55,8 +55,10 @@
c.hear_date ,c.arbitrat_claims ,
c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,
c.update_by ,c.update_time , c.arbitrator_name
c.update_by ,c.update_time , c.arbitrator_name,d.dept_name as name
from case_application c
LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
LEFT JOIN sys_dept d ON ca.NAME = d.dept_id
<where>
<if test="caseStatus != null">
AND c.case_status = #{caseStatus}
@@ -64,6 +66,9 @@
<if test="caseNum != null and caseNum != ''">
AND c.case_num = #{caseNum}
</if>
<if test="name != null and name != ''">
AND d.dept_name like CONCAT( '%',#{name},'%') AND ca.identity_type=1 and ca.name=d.dept_id
</if>
<if test="caseStatusList != null and caseStatusList.size() > 0">
and c.case_status in
<foreach item="caseStatus" collection="caseStatusList" open="(" separator="," close=")">