This commit is contained in:
18792927508
2024-02-23 14:25:37 +08:00
parent ba20a9d807
commit e00d61949b
10 changed files with 136 additions and 57 deletions
@@ -4,12 +4,16 @@ import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.wisdomarbitrate.domain.dto.miniprogress.IdentityAuthentication;
import com.ruoyi.wisdomarbitrate.domain.vo.miniprogress.WeChatUserVO;
import com.ruoyi.wisdomarbitrate.service.miniprogress.WeChatUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author wangqiong
* @description 微信小程序用户注册登录
@@ -20,7 +24,8 @@ import org.springframework.web.bind.annotation.*;
public class WeChatUserController extends BaseController {
@Autowired
private WeChatUserService weChatUserService;
@Autowired
private SysRoleMapper roleMapper;
/**
* 小程序端获取手机验证码
* @param userVO
@@ -35,14 +40,22 @@ public class WeChatUserController extends BaseController {
}
return weChatUserService.sendCode(userVO);
}
@Anonymous
@GetMapping("/roles")
public AjaxResult roles()
{
List<SysRole> list = roleMapper.selectRoleAll();
return AjaxResult.success(list);
}
/**
* 小程序注册
*/
@Anonymous
@PostMapping("/registerUser")
public AjaxResult registerUser( @RequestBody IdentityAuthentication ientityAuthentication) {
if(ientityAuthentication.getId()==null
|| StrUtil.isEmpty(ientityAuthentication.getName())
if(
// ientityAuthentication.getId()==null ||
StrUtil.isEmpty(ientityAuthentication.getName())
|| StrUtil.isEmpty(ientityAuthentication.getIdentityNo())
|| StrUtil.isEmpty(ientityAuthentication.getPhone())
|| StrUtil.isEmpty(ientityAuthentication.getUserName())
@@ -102,6 +102,7 @@ public class MsCaseApplicationPayController extends BaseController {
|| dto.getCaseFlowId() == null) {
return error("参数校验失败");
}
dto.setApplicantConfirm(false);
return casePaymentService.confirmPaid(dto);
}
}
@@ -42,4 +42,8 @@ public class CacheConstants
*/
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
public static final String WE_CHAT_SMS_VERIFY_CODE_KEY="we_chat_sms_verify_code:";
/**
* 案件 redis key
*/
public static final String CASE_KEY = "case_codes:";
}
@@ -1,5 +1,10 @@
package com.ruoyi.framework.config;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
@@ -75,10 +80,32 @@ public class RedisConfig extends CachingConfigurerSupport
public ApplicationListener applicationListener() {
return (ApplicationListener<RedisKeyExpiredEvent>) event -> {
String key = new String(event.getSource());
// 根据key查询案件表
caseApplicationService.notAccept(key,"已超过案件受理期限五日,");
if(key.startsWith(CacheConstants.CASE_KEY)) {
String[] split = key.split(CacheConstants.CASE_KEY);
if(split.length>1 && StrUtil.isNotEmpty(split[1])) {
caseApplicationService.notAccept(split[1], "已超过案件受理期限五日,");
}
}
};
}
/**
* 获取字典缓存
*
* @param key 参数键
* @return dictDatas 字典数据列表
*/
public static String getCodeCache(String key)
{
String codeCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getVerifyCodeCacheKey(key));
if (StringUtils.isNotNull(codeCache))
{
return codeCache;
}
return null;
}
private static String getVerifyCodeCacheKey(String key) {
return CacheConstants.CASE_KEY + key;
}
/**
* 限流脚本
*/
@@ -103,6 +103,9 @@ public class MsCaseApplicationReq {
* 附件
*/
private List<MsCaseAttach> attachList;
/**
* 代理人电话
*/
private String contactTelphoneAgent;
}
@@ -46,10 +46,10 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
" AND c.mediator_id = #{req.mediatorId} " +
"</if> "
+
"<if test='req.applicantFlag != null and req.applicationOrganIds != null and req.applicationOrganIds.size() > 0 '> and a.application_id in" +
"<if test='req.applicantFlag != null and req.applicationOrganIds != null and req.applicationOrganIds.size() > 0 '> and (a.application_id in" +
"<foreach item='organId' index='index' collection='req.applicationOrganIds' open='(' separator=',' close=')'>" +
"#{organId}" +
"</foreach>" +
"</foreach> or a.contact_telphone_agent=#{req.contactTelphoneAgent} )" +
"</if> "
+
"<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and c.case_status_name in" +
@@ -100,10 +100,10 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"</if> "
+
"<if test='req.applicantFlag != null and req.applicationOrganIds != null and req.applicationOrganIds.size() > 0 '> and a.application_id in" +
"<if test='req.applicantFlag != null and req.applicationOrganIds != null and req.applicationOrganIds.size() > 0 '> and (a.application_id in" +
"<foreach item='organId' index='index' collection='req.applicationOrganIds' open='(' separator=',' close=')'>" +
"#{organId}" +
"</foreach>" +
"</foreach> or a.contact_telphone_agent=#{req.contactTelphoneAgent} )" +
"</if> "
+
"<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and c1.case_status_name in" +
@@ -168,7 +168,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
throw new ServiceException("该用户未指定角色");
}
req.setUserName(SecurityUtils.getUsername());
req.setContactTelphoneAgent(sysUser.getPhonenumber());
// 根据角色查询关联的案件状态
Example example = new Example(MsCaseFlowRoleRelated.class);
example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
@@ -491,7 +491,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 为null则不更新
msCaseApplicationMapper.updateByPrimaryKeySelective(caseApplication);
MsCaseAffiliate affiliate = caseApplication.getAffiliate();
if (affiliate != null) {
if (affiliate == null) {
return AjaxResult.error("案件相关人员未填写");
}
affiliate.setCaseAppliId(caseApplication.getId());
// 设置申请人
if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
@@ -510,7 +512,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
affiliate.setRespondentEmail(affiliate.getRespondentEmail().replace("\n", "").replaceAll("\\s", ""));
}
msCaseAffiliateMapper.updateByPrimaryKeySelective(affiliate);
}
if (CollectionUtil.isNotEmpty(caseApplication.getCaseAttachList())) {
for (MsCaseAttach caseAttach : caseApplication.getCaseAttachList()) {
caseAttach.setCaseAppliId(caseApplication.getId());
@@ -521,14 +523,29 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
columnValueMapper.batchUpdate(caseApplication.getColumnValueList());
}
Integer caseFlowId = caseApplication.getCaseFlowId();
// 查询当前流程节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseFlowId);
if (currentFlow == null) {
throw new ServiceException("未找到当前流程节点");
// 生成调解申请书
// 根据角色获取案件流程
List<MsCaseFlow> caseFlows= selectCaseFlows();
if (CollectionUtil.isEmpty(caseFlows)) {
throw new ServiceException("该角色为绑定案件流程");
}
MsCaseFlow caseFlow = caseFlows.get(0);
MsCaseApplication selectByPrimaryKey = msCaseApplicationMapper.selectByPrimaryKey(caseApplication.getId());
MsCaseApplicationReq req = new MsCaseApplicationReq();
req.setCaseFlowId(caseFlow.getId());
req.setId(caseApplication.getId());
if(affiliate.getOrganizeFlag()==0){
// 自然人
req.setTemplateType(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode());
}else {
// 机构
req.setTemplateType(TemplateTypeEnum.MEDIATION_APPLICATION.getCode());
}
req.setTemplateId(String.valueOf(selectByPrimaryKey.getTemplateId()));
caseApplicationService.generateApplication(req);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"修改案件");
CaseLogUtils.insertCaseLog(caseApplication.getId(), 0, "修改案件",null);
return AjaxResult.success("修改成功");
}
@@ -937,14 +954,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
for (MsCaseApplication application : list) {
MsCaseFlow caseFlow = caseApplicationService.nextFlow(application.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
}
}else {
MsCaseFlow caseFlow = caseApplicationService.nextFlow(req.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
CaseLogUtils.insertCaseLog(req.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
}
return AjaxResult.success("提交成功");
}
@@ -1105,15 +1118,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return AjaxResult.error("被申请人身份证为空");
}
// 判断被申请人信息查询案件预约表
isReservation( vo,userIds);
caseApplicationService. isReservation( vo,userIds);
} else {
// 被申请人预约
// 新增日志
CaseLogUtils.insertCaseLog(vo.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "被申请人选择调解员");
// if (StrUtil.isEmpty(msCaseAffiliate.getContactTelphoneAgent())|| StrUtil.isEmpty(msCaseAffiliate.getApplicationPhone())) {
// return AjaxResult.error("申请代理人手机号为空");
// }
// 判断申请人是否预约
caseApplicationService. isReservation( vo,userIds);
@@ -1194,13 +1204,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setCaseStatusName(nextFlow.getCaseStatusName());
application.setLockStatus(null);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// 新增日志
// if(vo.getMiniProgressFlag() == null || vo.getMiniProgressFlag().equals( YesOrNoEnum.NO.getCode())) {
// CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "申请人选择调解员");
// }else {
// CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "被申请人选择调解员");
//
// }
}
}
@@ -1221,12 +1224,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return AjaxResult.error("该批次号下未找到案件");
}
for (MsCaseApplication application : list) {
verifyMediator(application,vo);
caseApplicationService.verifyMediator(application,vo);
}
}else {
MsCaseApplication application = new MsCaseApplication();
application.setId(vo.getId());
verifyMediator(application,vo);
caseApplicationService.verifyMediator(application,vo);
}
return AjaxResult.success();
}
@@ -1271,19 +1274,19 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}else {
phone=affiliate.getContactTelphoneAgent();
}
caseApplication.setHearDate(application.getHearDate());
// 申请人发送开庭日期短信
sendHearDateSms(application,phone);
sendHearDateSms(caseApplication,phone);
// 被申发送开庭日期短信
sendHearDateSms(application,affiliate.getRespondentPhone());
sendHearDateSms(caseApplication,affiliate.getRespondentPhone());
// 调解员发送短信
// 根据调解员id查询用户
if(application.getMediatorId()!=null) {
SysUser sysUser = sysUserMapper.selectUserById(application.getMediatorId());
sendHearDateSms(application, sysUser.getPhonenumber());
if(caseApplication.getMediatorId()!=null) {
SysUser sysUser = sysUserMapper.selectUserById(caseApplication.getMediatorId());
sendHearDateSms(caseApplication, sysUser.getPhonenumber());
}
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
CaseLogUtils.insertCaseLog(caseApplication.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
}
@@ -1319,6 +1322,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(StrUtil.isEmpty(caseId)){
return;
}
// todo
Long id = Long.valueOf(caseId);
// 根据案件id查询案件
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id);
@@ -2082,7 +2086,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
req.setTemplateType(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode());
}
AjaxResult result = generateApplication(req);
AjaxResult result = caseApplicationService.generateApplication(req);
return AjaxResult.success();
}
@@ -2854,13 +2858,22 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth());
// todo
String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day;
Integer annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode();
Integer annexType = null;
if(templateType==null
|| templateType.equals(TemplateTypeEnum.MEDIATION_APPLICATION.getCode())
|| templateType.equals(TemplateTypeEnum.PERSON_MEDIATION_APPLICATION.getCode()) ){
// 调解申请书
annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode();
}else if(templateType.equals(TemplateTypeEnum.MEDIATION_AGREEMENT.getCode())
|| templateType.equals(TemplateTypeEnum.MEDIATE_BOOK.getCode()) ){
// 调解书和解协议
annexType = AnnexTypeEnum.MEDIATE_BOOK.getCode();
}
String orgFileName = "调解申请书";
if(templateType!=null&&templateType==3) {
if (annexType != null && annexType.equals(AnnexTypeEnum.MEDIATE_BOOK.getCode())) {
orgFileName = "调解书";
annexType=AnnexTypeEnum.MEDIATE_BOOK.getCode();
}
String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx";
String resultFilePath = saveFolderPath + "/" + fileName;
@@ -2874,10 +2887,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
.annexType(annexType)
.build();
//保存到附件表里,先删除之前的在保存
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), AnnexTypeEnum.MEDIATION_APPLICATION.getCode());
if (templateType!=null&&templateType==3) {
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), AnnexTypeEnum.MEDIATE_BOOK.getCode());
}
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(caseAttach.getCaseAppliId(), annexType);
msCaseAttachMapper.save(caseAttach);
}
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.ruoyi.ElegentPay;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
@@ -13,6 +14,7 @@ import com.ruoyi.common.enums.PaymentStatusEnum;
import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.dto.PayRequest;
import com.ruoyi.dto.PayResponse;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
@@ -342,7 +344,9 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
caseApplicationMapper.updateByPrimaryKeySelective(application);
if (dto.getApplicantConfirm() && dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
// 申请人确认缴费后将该案件存放到redis,5日之内如果案件状态还是待受理状态,则发送不受理通知书并自动结束
redisCache.setCacheObject(String.valueOf(application.getId()), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS);
// redisCache.setCacheObject(CacheConstants.CASE_KEY+application.getId(), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS);
SpringUtils.getBean(RedisCache.class).setCacheObject(getVerifyCodeCacheKey(String.valueOf(application.getId())), application, Constants.CASE_ACCEPT_EXPIRATION, TimeUnit.DAYS);
}
// 新增日志
if (dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
@@ -372,6 +376,11 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
}
private static String getVerifyCodeCacheKey(String key) {
return CacheConstants.CASE_KEY + key;
}
/**
* 被申请人确认已缴费
* @param dto
@@ -440,7 +449,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
smsSendRecord.setSendStatus(YesOrNoEnum.NO.getCode());
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
if(dto.getApplicantConfirm()&& dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
if(!dto.getApplicantConfirm()&& dto.getYesOrNo().equals(YesOrNoEnum.YES.getCode())) {
// 申请人发送受理短信
sendAcceptSms(dto, caseAppllication, userName, phone);
// 被申请人发送受理短信
@@ -639,6 +639,11 @@ public class MsSignSealServiceImpl implements MsSignSealService {
}
}
Integer caseFlowId = caseApplication1.getCaseFlowId();
// 查询当前节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseFlowId);
if(currentFlow==null){
return AjaxResult.error("未找到当前流程节点");
}
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
caseApplication1.setCaseFlowId(nextFlow.getId());
@@ -700,7 +705,8 @@ public class MsSignSealServiceImpl implements MsSignSealService {
if(!resEmailFlag){
throw new ServiceException("被申请人调解书发送失败");
}
CaseLogUtils.insertCaseLog(caseApplication1.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"归档");
CaseLogUtils.insertCaseLog(caseApplication1.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
}
@@ -708,7 +714,7 @@ public class MsSignSealServiceImpl implements MsSignSealService {
throw new ServiceException("调解书发送失败");
}
return AjaxResult.success("归档成功");
return AjaxResult.success("");
}
@Override
@@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.enums.AnnexTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PdfUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.mapper.SysRoleMapper;
@@ -178,11 +179,16 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
@Transactional
@Override
public String createRoomId(Long caseId) {
// 查询案件
MsCaseApplication caseApplication = caseApplicationMapper.selectByPrimaryKey(caseId);
if(null == caseApplication){
throw new ServiceException("未找到该案件");
}
long roomId = generateRoomId();
// 绑定案件与房间号
bindCaseId(caseId, String.valueOf(roomId));
// 新增预约会议表
ReservedConference conference = new ReservedConference(caseId, SecurityUtils.getUserId(), roomId,
ReservedConference conference = new ReservedConference(caseId,caseApplication.getMediatorId(), roomId,
null, null);
// 先删除之前的会议
reservedConferenceMapper.deletByCaseId(caseId);