Merge branch 'wq1' of SH-Arbitrate/Mediation-Backend into dev

This commit was merged in pull request #160.
This commit is contained in:
2024-05-17 15:57:12 +08:00
committed by Gitea
14 changed files with 130 additions and 37 deletions
@@ -391,7 +391,7 @@ public class WxPayElegentTrade implements ElegentTrade {
private CloseableHttpClient getWxHttpClient() {
try {
//这里对秘钥进行加密使用的完全是官网上的代码
//TODO 参考官网代码 https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2_6_2.shtml
// 参考官网代码 https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter2_6_2.shtml
// 加载商户私钥(privateKey:私钥字符串)
String key = FileUtil.readToStr("wxpay_private.key");
@@ -143,6 +143,7 @@ public interface SysUserMapper
* @return
*/
SysUser selectUserByIdCard(@Param("idCard")String identityNo);
SysUser selectUserByPhone(@Param("phonenumber")String phonenumber);
/**
* 根据邮箱查询用户信息
* @param email
@@ -4,7 +4,7 @@ import com.ruoyi.system.domain.entity.log.MsRequestLog;
/**
* @Classname MsRequestLogService
* @Description TODO
* @Description
* @Version 1.0.0
* @Date 2024/4/2 14:18
* @Created wangqiong
@@ -10,7 +10,7 @@ import org.springframework.transaction.annotation.Transactional;
/**
* @Classname MsRequestLogServiceImpl
* @Description TODO
* @Description
* @Version 1.0.0
* @Date 2024/4/2 14:19
* @Created wangqiong
@@ -2,7 +2,7 @@ package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
/**
* @Classname MsCaseAffiliateParent
* @Description TODO
* @Description
* @Version 1.0.0
* @Date 2024/3/27 16:05
* @Created wangqiong
@@ -115,6 +115,10 @@ public class MsCaseApplicationReq {
* 申请人邮箱
*/
private String email;
/**
* 创建人
*/
private String createBy;
/**
* 角色类别
*/
@@ -127,6 +131,5 @@ public class MsCaseApplicationReq {
/**
* 是否需要用印,0-不需要,1-需要
*/
// todo 等会放开
private Integer sealFlag=1;
}
@@ -29,6 +29,10 @@ public class MsCaseApplicationVO extends MsCaseApplication {
* 被申请人姓名
*/
private String respondentName;
/**
* 创建者
*/
private String creatBy;
/**
* 案件相关人员
@@ -95,6 +99,14 @@ public class MsCaseApplicationVO extends MsCaseApplication {
* 是否财务,部门长,秘书,0-否,1-是
*/
private Integer otherFlag;
/**
* 第三方代理人,0-否,1-是
*/
private Integer agentFlag;
/**
* 调解员,0-否,1-是
*/
private Integer mediatorFlag;
/**
* 调解书上传下载按钮权限,调解员,顾问在调节之后,送达之前显示,0-否,1-是
*/
@@ -232,7 +232,6 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication
@Override
public AjaxResult selectPCEIDtokenStatus(String eidToken) {
// todo 送达时需要判断是否有pdf版的调解书,没有则不送达,签名完后下载pdf时不删除之前的doc调解书,上传调解书时,pdf的需要将类型设为13,异步发送短信邮件时将登录用户传参过来
// todo E证通审核过后将PC端的机器id在YML文件中改掉
JSONObject objJSON = null;
IdentityAuthentication authentication = new IdentityAuthentication();
@@ -211,7 +211,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
startPage();
List<MsCaseApplicationVO> list = msCaseApplicationMapper.list(req, null,null);
// 设置申请人被申请人及签名按钮限
setAfflicate(new HashMap<>(),list,loginUser.getUserId(),roles);
setAfflicate(new HashMap<>(),list,loginUser,roles,false);
return list;
}
if(CollectionUtil.isEmpty(roles) ){
@@ -238,6 +238,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 是否查询所有
boolean isSelectAll = false;
// 是否嗲三方代理人
boolean agentFlag = false;
for (SysRole role : roles) {
if(StrUtil.isNotEmpty(role.getRoleName())){
@@ -251,6 +253,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(StrUtil.equals(role.getRoleName(),"调解员")) {
req.setMediatorId(String.valueOf(sysUser.getUserId()));
}
if(StrUtil.contains(role.getRoleName(),"代理")) {
req.setCreateBy(String.valueOf(sysUser.getUserName()));
agentFlag=true;
}
}
}
if(!isSelectAll){
@@ -265,7 +271,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 查询案件列表
List<MsCaseApplicationVO> list = msCaseApplicationMapper.list(req, caseFlowIds,roleIds);
// 设置申请人被申请人及签名按钮限
setAfflicate(flowNameMap,list,loginUser.getUserId(),roles);
setAfflicate(flowNameMap,list,loginUser,roles,agentFlag);
return list;
}
@@ -273,9 +279,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
* 设置申请人被申请人及签名按钮限
* @param
* @param list
* @param loginUserId 当前登录用户id
* @param loginUser 当前登录用户
*/
private void setAfflicate( Map<String, Integer> flowNameMap,List<MsCaseApplicationVO> list,Long loginUserId, List<SysRole> roles ) {
private void setAfflicate( Map<String, Integer> flowNameMap,List<MsCaseApplicationVO> list,LoginUser loginUser, List<SysRole> roles , boolean agentFlag) {
if(CollectionUtil.isEmpty(list)){
return;
}
@@ -294,8 +300,25 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
for (MsCaseApplicationVO vo : list) {
if(vo.getMediatorId()!=null&&vo.getMediatorId().equals(loginUserId)){
if(vo.getMediatorId()!=null&&vo.getMediatorId().equals(loginUser.getUserId())){
isMediatorRole=true;
vo.setMediatorFlag(1);
}else {
vo.setMediatorFlag(0);
}
// 第三方代理人标志
if(StrUtil.isNotEmpty(vo.getCreatBy())){
if(StrUtil.isEmpty(loginUser.getUsername())){
vo.setAgentFlag(0);
}else {
if(StrUtil.equals(loginUser.getUsername(),vo.getCreatBy()) && agentFlag){
vo.setAgentFlag(1);
}else {
vo.setAgentFlag(0);
}
}
}else {
vo.setAgentFlag(0);
}
// 设置申请人和被申请人
if(affiliateMap!=null && affiliateMap.containsKey(vo.getId())){
@@ -308,34 +331,34 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (affiliate.getUserId()!=null && affiliate.getRoleType() != null && affiliate.getOperatorFlag() != null && affiliate.getOperatorFlag() == 1) {
if (vo.getAppOperatorFlag() == null && (affiliate.getRoleType() == 1 || affiliate.getRoleType() == 2)) {
// 申请人操作人
if(affiliate.getUserId().equals(loginUserId) &&!vo.getCaseStatusName().equals("待签名")){
if(affiliate.getUserId().equals(loginUser.getUserId()) &&!vo.getCaseStatusName().equals("待签名")){
vo.setAppOperatorFlag(1);
}else if(vo.getCaseStatusName().equals("待签名")) {
if(affiliate.getUserId().equals(loginUserId)){
if(affiliate.getUserId().equals(loginUser.getUserId())){
vo.setAppOperatorFlag(1);
}else {
vo.setAppOperatorFlag(0);
}
}
// 签收按钮权限
if(affiliate.getUserId().equals(loginUserId) &&vo.getCaseStatusName().equals("待申请人签收")){
if(affiliate.getUserId().equals(loginUser.getUserId()) &&vo.getCaseStatusName().equals("待申请人签收")){
vo.setSignFlag(1);
}
}
if (vo.getResOperatorFlag() == null && (affiliate.getRoleType() == 3 || affiliate.getRoleType() == 4)) {
// 被申请人操作人
if(Objects.equals(affiliate.getUserId(), loginUserId) &&!vo.getCaseStatusName().equals("待签名")){
if(Objects.equals(affiliate.getUserId(), loginUser.getUserId()) &&!vo.getCaseStatusName().equals("待签名")){
vo.setResOperatorFlag(1);
}else if(vo.getCaseStatusName().equals("待签名")) {
if(Objects.equals(affiliate.getUserId(), loginUserId)){
if(Objects.equals(affiliate.getUserId(), loginUser.getUserId())){
vo.setResOperatorFlag(1);
}else {
vo.setResOperatorFlag(0);
}
}
// 签收按钮权限
if(affiliate.getUserId().equals(loginUserId) &&vo.getCaseStatusName().equals("待被申请人签收")){
if(affiliate.getUserId().equals(loginUser.getUserId()) &&vo.getCaseStatusName().equals("待被申请人签收")){
vo.setSignFlag(1);
}
}
@@ -402,7 +425,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(StrUtil.contains(role.getRoleName(),"财务")
||StrUtil.contains(role.getRoleName(),"法律顾问")
||StrUtil.contains(role.getRoleName(),"部门长")
||StrUtil.contains(role.getRoleName(),"调解员")
// ||StrUtil.contains(role.getRoleName(),"调解员")
){
vo.setOtherFlag(1);
}
@@ -483,6 +506,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 查询案件列表
for (SysRole role : roles) {
if (StrUtil.isEmpty(role.getRoleName())) {
continue;
}
if(StrUtil.contains(role.getRoleName(),"财务")
||StrUtil.contains(role.getRoleName(),"法律顾问")
||StrUtil.contains(role.getRoleName(),"部门长")
@@ -491,14 +517,17 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
roleIds=null;
}
if (StrUtil.isNotEmpty(role.getRoleName())) {
if (StrUtil.equals(role.getRoleName(), "调解员")) {
req.setMediatorId(String.valueOf(sysUser.getUserId()));
}
}
if(StrUtil.contains(role.getRoleName(),"代理")) {
req.setCreateBy(String.valueOf(sysUser.getUserName()));
}
}
// 如果多个角色中有财务,顾问,部门长,则调解员查询所有
// 如果多个角色中有财务,顾问,部门长查询所有
if(!isSelectAll){
req.setUserId(loginUser.getUserId());
}
@@ -2464,8 +2493,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
application.setRejectReason(reason);
if(application.getCaseFlowId()!=null && application.getCaseFlowId()==4){
// todo 超过五日还没有受理,给申请操作人发送不受理通知,有手机号发短信,没有手机号发邮箱
// 申请人不受理分配通知 // todo 短信异步
// 超过五日还没有受理,给申请操作人发送不受理通知,有手机号发短信,没有手机号发邮箱
// 申请人不受理分配通知 // 短信异步
ExecutorService executor = ThreadUtil.createThreadPool();
CompletableFuture.runAsync(() -> {
String rejectReason = application.getRejectReason() == null ? "" : application.getRejectReason();
@@ -2588,6 +2617,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (CollectionUtil.isEmpty(affiliates)) {
throw new ServiceException("未找到案件人员");
}
// 签名时取用户为申请人角色并且是申请操作人
// 申请操作人
Optional<MsCaseAffiliate> applicantAffiliateOpt = affiliates.stream().filter(affiliate -> affiliate.getOperatorFlag() == 1 && StrUtil.isNotEmpty(affiliate.getPhone()) && (affiliate.getRoleType().equals(1) || affiliate.getRoleType().equals(2))).findFirst();
// 被申请操作人
@@ -181,6 +181,11 @@ public class MsSignSealServiceImpl implements MsSignSealService {
@Override
public SealSignRecord selectSealUrl(MsSignSealDTO dto) throws EsignDemoException {
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(dto.getCaseId());
if(application == null){
throw new ServiceException("未找到当前案件");
}
Example example = new Example(MsSealSignRecord.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("caseAppliId", dto.getCaseId());
@@ -201,6 +206,23 @@ public class MsSignSealServiceImpl implements MsSignSealService {
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String url = signUrlData.get("shortUrl").getAsString();
sealSignRecordReslt.setSealUrl(url);
MsCaseLogRecord operLog = new MsCaseLogRecord();
if(StrUtil.isEmpty(SecurityUtils.getUsername())){
throw new ServiceException("未获取到当前登录用户");
}
SysUser sysUser = sysUserMapper.selectUserByUserName(SecurityUtils.getUsername());
if(sysUser==null){
throw new ServiceException("未获取到当前登录用户");
}
// 新增用印日志
operLog.setCreateBy(sysUser.getUserName());
operLog.setCreateNickName(sysUser.getNickName());
operLog.setCaseStatusName(application.getCaseStatusName());
operLog.setCaseAppliId(application.getId());
operLog.setCaseNode(application.getCaseFlowId());
operLog.setCreateTime(new Date());
caseLogRecordMapper.insert(operLog);
}
return sealSignRecordReslt;
}
@@ -675,6 +697,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
JSONObject operator = jsonObjectCallback.getJSONObject("operator");
JSONObject psnAccount = operator.getJSONObject("psnAccount");
String accountMobile = psnAccount.getString("accountMobile");
// 根据电话查询用户名
SysUser sysUser = sysUserMapper.selectUserByPhone(accountMobile);
Example msSealSignRecordExample = new Example(MsSealSignRecord.class);
msSealSignRecordExample.createCriteria().andEqualTo("signFlowId", signFlowId);
@@ -711,6 +735,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordsel.setSignStatusApply(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
MsCaseLogRecord operLog = new MsCaseLogRecord();
if(sysUser!=null){
operLog.setCreateBy(sysUser.getUserName());
}
operLog.setCreateNickName(pensonName);
operLog.setCaseStatusName(caseStatusName);
operLog.setCaseAppliId(caseAppliId);
@@ -752,6 +779,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordsel.setSignStatusResponse(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
MsCaseLogRecord operLog = new MsCaseLogRecord();
if(sysUser!=null){
operLog.setCreateBy(sysUser.getUserName());
}
operLog.setCreateNickName(pensonNameRes);
operLog.setCaseStatusName(caseStatusName);
operLog.setCaseAppliId(caseAppliId);
@@ -794,6 +824,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordsel.setSignStatusMediator(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
MsCaseLogRecord operLog = new MsCaseLogRecord();
if(sysUser!=null){
operLog.setCreateBy(sysUser.getUserName());
}
operLog.setCreateNickName(pensonNameMedi);
operLog.setCaseStatusName(caseStatusName);
operLog.setCaseAppliId(caseAppliId);
@@ -836,13 +869,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordsel.setSealStatus(1);
sealSignRecordsel.setSignFlowStatus(3);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
MsCaseLogRecord operLog = new MsCaseLogRecord();
operLog.setCreateNickName(orgnNamePsnName);
operLog.setCaseStatusName(caseStatusName);
operLog.setCaseAppliId(caseAppliId);
operLog.setCaseNode(caseNode);
operLog.setCreateTime(dateOperate);
caseLogRecordMapper.insert(operLog);
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseApplicationselect.getCaseFlowId());
@@ -864,6 +891,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordsel.setSignStatusApply(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
MsCaseLogRecord operLog = new MsCaseLogRecord();
if(sysUser!=null){
operLog.setCreateBy(sysUser.getUserName());
}
operLog.setCreateNickName(pensonName);
operLog.setCaseStatusName(caseStatusName);
operLog.setCaseAppliId(caseAppliId);
@@ -891,6 +921,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
sealSignRecordsel.setSignStatusResponse(1);
sealSignRecordMapper.updateByPrimaryKeySelective(sealSignRecordsel);
MsCaseLogRecord operLog = new MsCaseLogRecord();
if(sysUser!=null){
operLog.setCreateBy(sysUser.getUserName());
}
operLog.setCreateNickName(pensonNameRes);
operLog.setCaseStatusName(caseStatusName);
operLog.setCaseAppliId(caseAppliId);
@@ -7,7 +7,7 @@ import java.util.List;
/**
* @Classname SMSTemplateService
* @Description TODO
* @Description
* @Version 1.0.0
* @Date 2024/4/16 11:39
* @Created wangqiong
@@ -17,7 +17,7 @@ import java.util.stream.Collectors;
/**
* @Classname SMSTemplateServiceImpl
* @Description TODO
* @Description
* @Version 1.0.0
* @Date 2024/4/16 11:40
* @Created wangqiong
@@ -68,7 +68,7 @@ public class SMSTemplateServiceImpl implements SMSTemplateService {
for (MsSmsTemplateParam templateParam : template.getTemplateParams()) {
templateParam.setSmsTemplateId(template.getId());
}
// todo 先删除
// 先删除
Example paramExam = new Example(MsSmsTemplateParam.class);
paramExam.createCriteria().andEqualTo("smsTemplateId", template.getId());
templateParamMapper.deleteByExample(paramExam);
@@ -180,6 +180,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join ms_sys_role r on r.role_id = ur.role_id
where u.id_card = #{idCard} and u.del_flag = '0' and u.status='0' order by u.create_time limit 1
</select>
<select id="selectUserByPhone" parameterType="String" resultMap="SysUserResult">
select u.*
from ms_sys_user u
where u.phonenumber = #{phonenumber} order by u.create_time limit 1
</select>
<select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult">
select u.*,ur.role_id
from ms_sys_user u
@@ -48,10 +48,20 @@
<if test = 'req.mediatorId != null and req.userId!=null'>
AND (c.mediator_id = #{req.mediatorId} or a.user_id=#{req.userId})
</if>
<!-- admin,财务,顾问,部门长查看所有案件,申请人,被申,代理人根据userId查-->
<if test = 'req.mediatorId == null and req.userId != null'>
AND (a.user_id=#{req.userId} )
</if>
<!-- 第三方代理人,调解员-->
<if test = 'req.createBy != null and req.mediatorId == null '>
or (c.create_by = #{req.createBy})
</if>
<if test = 'req.createBy != null and req.mediatorId != null '>
or (c.create_by = #{req.createBy} or c.mediator_id = #{req.mediatorId})
</if>
<!-- 根据角色查询-->
<if test='roleIds != null and roleIds.size() > 0 '>
and r.role_id in
@@ -75,7 +85,7 @@
</if>
<!-- 案件编号-->
<if test = 'req.caseNum != null and req.caseNum != "" '>
AND c.case_num = #{req.caseNum}
AND c.case_num like concat('%',#{req.caseNum},'%')
</if>
<!-- 时间-->
<if test = 'req.startTime != null and req.startTime != "" '>
@@ -113,7 +123,7 @@
<select id="list" resultType="com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO">
select t.* from(
SELECT
c.id,c.seal_flag sealFlag,c.mediator_id mediatorId,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus,
c.id,c.create_by creatBy,c.seal_flag sealFlag,c.mediator_id mediatorId,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,0 AS pendingStatus,
c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,
u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime,
c.mediation_method mediationMethod,
@@ -123,7 +133,7 @@
c.id
union
SELECT
c.id,c.seal_flag sealFlag,c.mediator_id mediatorId,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus,
c.id,c.create_by creatBy,c.seal_flag sealFlag,c.mediator_id mediatorId,c.case_source caseSource,c.media_result mediaResult,c.room_id roomId,1 AS pendingStatus,
c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,
u1.nick_name mediatorName,c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime,
c.mediation_method mediationMethod,
@@ -149,7 +159,7 @@
</if>
<!-- 案件编号-->
<if test = 'req.caseNum != null and req.caseNum != "" '>
AND c.case_num = #{req.caseNum}
AND c.case_num like concat('%',#{req.caseNum},'%')
</if>
<!-- 时间-->
<if test = 'req.startTime != null and req.startTime != "" '>