This commit is contained in:
qitz
2024-01-29 14:25:40 +08:00
18 changed files with 307 additions and 253 deletions
@@ -20,24 +20,30 @@ public class MsCaseAffiliate {
@Id
@Column(name = "case_appli_id")
private Long caseAppliId;
/**
* 是否机构申请,0-自然人,1-申请机构,默认0
*/
@Column(name = "organize_flag")
private Integer organizeFlag;
/**
* 申请机构
* 申请人id
*/
@Column(name = "application_organ_id")
private String applicationOrganId;
@Column(name = "application_id")
private String applicationId;
/**
* 申请机构名称
* 申请人名称
*/
@Column(name = "application_organ_name")
private String applicationOrganName;
@Column(name = "application_name")
private String applicationName;
/**
* 统一社会信用代码
* 代码(统一社会信用代码或者身份证号)
*/
@Column(name = "credit_code")
private String creditCode;
@Column(name = "code")
private String code;
/**
* 法定代表人
@@ -51,7 +51,7 @@ public class MsCaseApplication {
private BigDecimal caseSubjectAmount;
/**
* 调解方式,1-开庭调解,2-书面调解
* 调解方式,1-线上调解,2-线下调解
*/
@Column(name = "mediation_method")
private String mediationMethod;
@@ -84,7 +84,7 @@ public class MsCaseApplication {
* 调解员id
*/
@Column(name = "mediator_id")
private String mediatorId;
private Long mediatorId;
/**
* 调解员名称
@@ -92,23 +92,12 @@ public class MsCaseApplication {
@Column(name = "mediator_name")
private String mediatorName;
/**
* 是否同意组庭,0否,1是
*/
@Column(name = "is_agree_pend_tral")
private Integer isAgreePendTral;
/**
* 支付方式(0线上支付,1线下支付)
*/
@Column(name = "pay_type")
private String payType;
/**
* 是否仲裁反请求,1是,0否
*/
@Column(name = "adjudica_counter")
private Integer adjudicaCounter;
/**
* 被申请人是否缺席,1是,0否
@@ -192,17 +181,6 @@ public class MsCaseApplication {
*/
private String facts;
/**
* 申请人请求仲裁庭裁决
*/
@Column(name = "request_rule")
private String requestRule;
/**
* 案件描述
*/
@Column(name = "case_describe")
private String caseDescribe;
/**
* 调解书URL
@@ -210,11 +188,7 @@ public class MsCaseApplication {
@Column(name = "mediation_url")
private String mediationUrl;
/**
* 仲裁反请求原因
*/
@Column(name = "adjudica_counter_reason")
private String adjudicaCounterReason;
/**
* 调解内容
@@ -31,7 +31,7 @@ public class MsCaseMediator {
* 调解员id
*/
@Column(name = "mediator_id")
private String mediatorId;
private Long mediatorId;
/**
* 调解员名称
@@ -1,6 +1,7 @@
package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseMediator;
import lombok.Data;
import java.util.List;
@@ -15,13 +16,17 @@ import java.util.List;
@Data
public class BookingVO {
/**
* 调解员列表
* 申请人调解员列表
*/
private List<SysUser> userList;
/**
* 调解员列表
* 申请人调解员列表
*/
private List<MediatorVO> mediatorList;
private List<MsCaseMediator> mediatorList;
/**
* 被申请人调解员列表
*/
private List<MsCaseMediator>resMediatorList;
/**
* 开庭日期集合
*/
@@ -38,6 +43,14 @@ public class BookingVO {
* 批次
*/
private String batchNumber;
/**
* 调解员id
*/
private Long mediatorId;
/**
* 调解员
*/
private String mediatorName;
/**
* 是否被申请人,1-被申请人,空为申请人
*/
@@ -35,7 +35,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
* @return
*/
@Select("<script> select t.* from (select c.id,c.room_id roomId,c.mediation_method mediationMethod,0 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
"a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"a.application_name applicationName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_application c " +
"join ms_case_affiliate a on c.id=a.case_appli_id <where> " +
"<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and c.case_status_name in" +
@@ -54,7 +54,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"</if> " +
"<if test=\"req.applicantFlag != null \">" +
" AND a.application_organ_id = #{req.applicationOrganId} " +
" AND a.application_id = #{req.applicationId} " +
"</if> "
+ "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
" AND a.respondent_identity_num = #{req.respondentIdentityNum} " +
@@ -70,13 +70,13 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"and c.create_time &lt;= #{req.endTime}</if>" +
" </where> " +
"union select c.id id,c.room_id roomId,c.mediation_method mediationMethod,1 AS pendingStatus,c.case_flow_id caseFlowId,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
"a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"a.application_name applicationName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_log_record r " +
"join ms_case_application c on r.case_appli_id=c.id and r.case_status_name!=c.case_status_name " +
"join ms_case_application c on r.case_appli_id=c.id " +
"join ms_case_affiliate a on c.id=a.case_appli_id <where> r.create_by=#{req.userName} and c.id not in (" +
"select c1.id from ms_case_application c1 JOIN ms_case_affiliate a1 ON a1.case_appli_id = c1.id"
+
"<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and c.case_status_name in" +
"<if test='caseStatusNames != null and caseStatusNames.size() > 0 '> and c1.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusNames' open='(' separator=',' close=')'>" +
"#{caseStatus}" +
"</foreach>" +
@@ -92,14 +92,14 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
" AND c1.case_num = #{req.caseNum} " +
"</if> " +
"<if test=\"req.applicantFlag != null \">" +
" AND a1.application_organ_id = #{req.applicationOrganId} " +
" AND a1.application_id = #{req.applicationId} " +
"</if> "
+ "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
" AND a.respondent_identity_num = #{req.respondentIdentityNum} " +
" AND a1.respondent_identity_num = #{req.respondentIdentityNum} " +
"</if> "
+
"<if test=\"req.hearDateFlag != null \">" +
" AND c.mediation_method = '1'" +
" AND c1.mediation_method = '1'" +
"</if> "
+
@@ -126,7 +126,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
" AND c.case_num = #{req.caseNum} " +
"</if> " +
"<if test=\"req.applicantFlag != null \">" +
" AND a.application_organ_id = #{req.applicationOrganId} " +
" AND a.application_id = #{req.applicationId} " +
"</if> "
+ "<if test=\"req.respondentIdentityNum != null and req.respondentIdentityNum != ''\">" +
" AND a.respondent_identity_num = #{req.respondentIdentityNum} " +
@@ -18,7 +18,8 @@ public interface MsCaseLogRecordMapper extends Mapper<MsCaseLogRecord> {
@Select("<script> select cl.case_node caseNode ,cl.case_node_time caseNodeTime ,cl.notes ,cl.id ,cl.case_appli_id caseAppliId," +
" cl.create_by createBy,cl.create_nick_name createNickName,cl.create_time createTime, " +
" CASE cl.case_node when 1 then '提交案件' when 2 then '缴费' " +
" CASE cl.case_node when 0 then '新增案件' " +
"when 1 then '提交案件' when 2 then '缴费' " +
" when 3 then '确认缴费' when 4 then '受理分配' when 5 then '选择调解员' " +
" when 6 then '核实调解员' when 7 then '确认调解员' when 8 then '确定调解时间' " +
" when 9 then '调解' when 10 then '确认调解书' when 11 then '签名' " +
@@ -24,7 +24,4 @@ public interface FatchRuleMapper {
int insertFatchRule(FatchRule fatchRule);
List<FatchRule> selectColumnandComment(FatchRule fatchRuleselect);
FatchRule selectColumnbycomment(FatchRule fatchRule);
}
@@ -55,9 +55,6 @@ public interface IDeptIdentifyService {
AjaxResult saveFatchRules(TemplateManage templateManage);
List<FatchRule> selectColumnandComment();
FatchRule selectColumnbycomment(FatchRule fatchRule);
/**
* 根据模板id查询模板字段列表
@@ -586,21 +586,6 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
return AjaxResult.error();
}
@Override
public List<FatchRule> selectColumnandComment() {
List<FatchRule> fatchRules = new ArrayList<>();
FatchRule fatchRuleselect = new FatchRule();
fatchRuleselect.setDatabaseName("test_smart_arbitration");
fatchRules = fatchRuleMapper.selectColumnandComment(fatchRuleselect);
return fatchRules;
}
@Override
public FatchRule selectColumnbycomment(FatchRule fatchRule) {
fatchRule.setDatabaseName("test_smart_arbitration");
FatchRule fatchRulesel = fatchRuleMapper.selectColumnbycomment(fatchRule);
return fatchRulesel;
}
/**
* 根据模板id查询模板字段列表
@@ -13,6 +13,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.*;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.AnnexTypeEnum;
import com.ruoyi.common.enums.MediatorTypeEnum;
import com.ruoyi.common.enums.YesOrNoEnum;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.exception.ServiceException;
@@ -271,7 +272,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 保存案件相关人员
if (affiliate != null) {
// 设置申请人
if (StrUtil.isNotEmpty(affiliate.getApplicationOrganName())) {
if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
// 组装申请机构
insertDept(affiliate);
// 新增申请机构代理人
@@ -344,7 +345,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
columnValueMapper.batchSave(columnValueList);
}
// todo 发送短信
CaseLogUtils.insertCaseLog(caseApplication.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "");
CaseLogUtils.insertCaseLog(caseApplication.getId(), 0, "新增案件", "");
return 1;
}
@@ -410,7 +411,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (affiliate != null) {
affiliate.setCaseAppliId(caseApplication.getId());
// 设置申请人
if (StrUtil.isNotEmpty(affiliate.getApplicationOrganName())) {
if (StrUtil.isNotEmpty(affiliate.getApplicationName())&&affiliate.getOrganizeFlag()==1) {
// 组装申请机构
insertDept(affiliate);
// 新增申请机构代理人
@@ -786,6 +787,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
* @param affiliateMap
*/
private void accept(MsCaseApplication application, MsCaseApplication req, Map<Long, MsCaseAffiliate> affiliateMap) {
application.setPaperFlag(req.getPaperFlag());
application.setArbitrateConfirm(req.getArbitrateConfirm());
application.setMediationMethod(req.getMediationMethod());
application.setUpdateBy(SecurityUtils.getUsername());
application.setUpdateTime(new Date());
application.setBatchNumber(null);
@@ -866,8 +870,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return AjaxResult.error("暂无调解员");
}
List<Long> userIds = users.stream().map(SysUser::getUserId).collect(Collectors.toList());
// todo 状态为未结束的是待办数量,结束的是已办数量
Map<String, List<MsCaseApplication>> caseMap=null;
// 状态为未结束的是待办数量,结束的是已办数量
Map<Long, List<MsCaseApplication>> caseMap=null;
List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds);
if (CollectionUtil.isNotEmpty(caseApplicationList)) {
@@ -879,9 +883,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
mediatorVO.setMediatorId(user.getUserId());
mediatorVO.setMediatorName(user.getNickName());
mediatorVO.setSpecialty(user.getSpecialty());
if(caseMap!=null&&caseMap.containsKey(String.valueOf(user.getUserId()))) {
List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
if(caseMap==null){
mediatorVO.setTodoAmount(0L);
mediatorVO.setCompleteAmount(0L);
} else if(caseMap.containsKey(user.getUserId())) {
List<MsCaseApplication> applications = caseMap.get(user.getUserId());
// 已办案件
long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
mediatorVO.setTodoAmount(applications.size()-count);
@@ -909,14 +915,18 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (currentFlow == null) {
return AjaxResult.error("当前流程不存在");
}
// 获取选择的调解员id
List<Long> userIds = vo.getUserList().stream().map(SysUser::getUserId).collect(Collectors.toList());
// 新增案件预约表
MsCaseMediator mediator = new MsCaseMediator();
mediator.setCaseAppliId(vo.getId());
mediator.setMediatorId(String.valueOf(vo.getUserList().get(0).getUserId()));
mediator.setMediatorName(String.valueOf(vo.getUserList().get(0).getUserName()));
mediator.setHearDate(String.valueOf(vo.getHerDates().get(0)));
mediator.setType(vo.getMiniProgressFlag());
msCaseMediatorMapper.insert(mediator);
for (SysUser sysUser : vo.getUserList()) {
MsCaseMediator mediator = new MsCaseMediator();
mediator.setCaseAppliId(vo.getId());
mediator.setMediatorId(sysUser.getUserId());
mediator.setMediatorName(sysUser.getNickName());
mediator.setType(vo.getMiniProgressFlag()==null?MediatorTypeEnum.PC.getCode() : vo.getMiniProgressFlag());
msCaseMediatorMapper.insert(mediator);
}
// 申请人预约
if (vo.getMiniProgressFlag() == null) {
// 新增日志
@@ -926,12 +936,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return AjaxResult.error("被申请人身份证为空");
}
SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
// SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
// 被申请人存在
if (user != null) {
// if (user != null) {
// 判断被申请人信息查询案件预约表
isReservation( vo,user);
}
isReservation( vo,userIds);
// }
} else {
// 被申请人预约
@@ -941,11 +951,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return AjaxResult.error("申请代理人手机号为空");
}
SysUser user = userMapper.selectUserByPhone(msCaseAffiliate.getContactTelphoneAgent());
if(user!=null){
// SysUser user = userMapper.selectUserByPhone(msCaseAffiliate.getContactTelphoneAgent());
// if(user!=null){
// 判断申请人是否预约
isReservation( vo,user);
}
isReservation( vo,userIds);
// }
}
return AjaxResult.success();
@@ -954,9 +964,15 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
/**
* 判断申请人/被申请人是否预约
* @param vo
* @param user
* @param userIds 选择的调解员ids
*/
private void isReservation( BookingVO vo, SysUser user) {
private void isReservation( BookingVO vo, List<Long> userIds ) {
// 查询所有调解员
List<SysUser> mediatorUsers = sysUserMapper.selectUserByRole("调解员");
if (CollectionUtil.isEmpty(mediatorUsers)) {
throw new ServiceException("暂无调解员");
}
Map<Long, SysUser> userMap = mediatorUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity()));
Example example = new Example(MsCaseMediator.class);
Example.Criteria criteria = example.createCriteria();
if(vo.getMiniProgressFlag() == null) {
@@ -968,14 +984,50 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
criteria.andEqualTo("caseAppliId", vo.getId());
// criteria.andEqualTo("mediatorId", user.getUserId());
int count = msCaseMediatorMapper.selectCountByExample(example);
if (count > 0) {
// 申请人已预约,更新主表流程节点
List<MsCaseMediator> msCaseMediators = msCaseMediatorMapper.selectByExample(example);
if (CollectionUtil.isNotEmpty(msCaseMediators)) {
MsCaseApplication application = new MsCaseApplication();
// 申请人或者被申请人已预约,更新主表流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
if (nextFlow == null) {
throw new ServiceException("未找到下一个流程");
}
MsCaseApplication application = new MsCaseApplication();
// 取出另一方的调解员id
List<Long> mediatorIds = msCaseMediators.stream().map(MsCaseMediator::getMediatorId).collect(Collectors.toList());
// 取出申请人和被申请人选择调解员交集,交集>1,根据优先级确定调解员(优先级查调解员已结束的案件)
List<Long> intersectionWithoutModifyOriginal = new ArrayList<>(userIds);
// 交集
List<Long> intersection = new ArrayList<>(intersectionWithoutModifyOriginal);
intersection.retainAll(mediatorIds);
// 有一个交集,则直接更新主表调解员
if(intersection.size()==1){
application.setMediatorId(intersection.get(0));
application.setMediatorName(userMap.get(intersection.get(0)).getNickName());
}else if(intersection.size()>1){
// 查询调解员的案件,有多个交集,根据优先级获取
List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(userIds);
if (CollectionUtil.isNotEmpty(caseApplicationList)) {
Map<Long, List<MsCaseApplication>> caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
long maxCount=0;
for (Long userId : intersection) {
if (caseMap.containsKey(userId)) {
List<MsCaseApplication> applications = caseMap.get(userId);
// 已办案件
long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
if(count>=maxCount){
maxCount=count;
application.setMediatorId(userId);
application.setMediatorName(userMap.get(userId).getNickName());
}
}
}
}else {
// 没有案件,则随机取一个调解员
application.setMediatorId(intersection.get(0));
application.setMediatorName(userMap.get(intersection.get(0)).getNickName());
}
}
application.setId(vo.getId());
application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName());
@@ -997,21 +1049,21 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
* @param application
* @param vo
*/
private void setMediatorAndDate(MsCaseApplication application, BookingVO vo) {
if(CollectionUtil.isNotEmpty(vo.getUserList())) {
List<SysUser> userList = vo.getUserList();
List<Long> userIds = userList.stream().map(SysUser::getUserId).collect(Collectors.toList());
List<String> userNames = userList.stream().map(SysUser::getUserName).collect(Collectors.toList());
String mediatorIds = StrUtil.join(",", userIds);
String mediatorNames = StrUtil.join(",", userNames);
application.setMediatorId(mediatorIds);
application.setMediatorName(mediatorNames);
}
if(CollectionUtil.isNotEmpty( vo.getHerDates())) {
String herDates = StrUtil.join(",", vo.getHerDates());
application.setHearDate(herDates);
}
}
// private void setMediatorAndDate(MsCaseApplication application, BookingVO vo) {
// if(CollectionUtil.isNotEmpty(vo.getUserList())) {
// List<SysUser> userList = vo.getUserList();
// List<Long> userIds = userList.stream().map(SysUser::getUserId).collect(Collectors.toList());
// List<String> userNames = userList.stream().map(SysUser::getUserName).collect(Collectors.toList());
// String mediatorIds = StrUtil.join(",", userIds);
// String mediatorNames = StrUtil.join(",", userNames);
// application.setMediatorId(mediatorIds);
// application.setMediatorName(mediatorNames);
// }
// if(CollectionUtil.isNotEmpty( vo.getHerDates())) {
// String herDates = StrUtil.join(",", vo.getHerDates());
// application.setHearDate(herDates);
// }
// }
/**
* 核实调解员
@@ -1044,56 +1096,58 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
*/
@Override
public AjaxResult selectReservation(Long id) {
// 查询案件主表
MsCaseApplication application = msCaseApplicationMapper.selectByPrimaryKey(id);
if (application == null) {
return AjaxResult.error("该案件不存在");
}
BookingVO result = new BookingVO();
// MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
// todo 返回申请人预约信息,预约信息查预约表
// criteria.andEqualTo("mediatorId", SecurityUtils.getUserId());
MsCaseMediator msCaseMediator = msCaseMediatorMapper.selectLastApplicant(id);
if(msCaseMediator==null){
result.setMediatorId(application.getMediatorId());
result.setMediatorName(application.getMediatorName());
Example example = new Example(MsCaseAffiliate.class);
example.createCriteria().andEqualTo("caseAppliId", id);
List<MsCaseMediator> msCaseMediators = msCaseMediatorMapper.selectByExample(example);
if(CollectionUtil.isEmpty(msCaseMediators)){
return AjaxResult.success(result);
}
// if(caseApplication == null){
// return AjaxResult.error("该案件不存在");
// }
Map<Integer, List<MsCaseMediator>> mediatorMap = msCaseMediators.stream().collect(Collectors.groupingBy(MsCaseMediator::getType));
// 申请人
result.setMediatorList(mediatorMap.get(MediatorTypeEnum.PC.getCode()));
result.setResMediatorList(mediatorMap.get(MediatorTypeEnum.MI_NI_PROGRESS.getCode()));
// 调解员是一个的处理
if( StrUtil.isNotEmpty(msCaseMediator.getMediatorId()) && StrUtil.isNotEmpty(msCaseMediator.getMediatorName())){
// 查询用户
SysUser user = userMapper.selectUserById(Long.valueOf(msCaseMediator.getMediatorId()));
if(user==null){
return AjaxResult.error("调解员已被删除");
}
// 查询待办数量
List<Long> mediatorIds = new ArrayList<>();
mediatorIds.add(user.getUserId());
Map<String, List<MsCaseApplication>> caseMap=null;
List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(mediatorIds);
if (CollectionUtil.isNotEmpty(caseApplicationList)) {
caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
// SysUser user = userMapper.selectUserById(Long.valueOf(msCaseMediator.getMediatorId()));
// if(user==null){
// return AjaxResult.error("调解员已被删除");
// }
// // 查询待办数量
// List<Long> mediatorIds = new ArrayList<>();
// mediatorIds.add(user.getUserId());
// Map<Long, List<MsCaseApplication>> caseMap=null;
// List<MsCaseApplication> caseApplicationList = msCaseApplicationMapper.listMediator(mediatorIds);
// if (CollectionUtil.isNotEmpty(caseApplicationList)) {
// caseMap = caseApplicationList.stream().collect(Collectors.groupingBy(MsCaseApplication::getMediatorId, Collectors.toList()));
//
// }
// MediatorVO mediatorVO = new MediatorVO();
// mediatorVO.setMediatorId(user.getUserId());
// mediatorVO.setMediatorName(user.getNickName());
// mediatorVO.setSpecialty(user.getSpecialty());
// if(caseMap==null){
// mediatorVO.setTodoAmount(0L);
// mediatorVO.setCompleteAmount(0L);
// }
//
// else if(caseMap.containsKey(String.valueOf(user.getUserId()))) {
// List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
// // 已办案件
// long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
// mediatorVO.setTodoAmount(applications.size()-count);
// mediatorVO.setCompleteAmount(count);
// }
}
MediatorVO mediatorVO = new MediatorVO();
mediatorVO.setMediatorId(user.getUserId());
mediatorVO.setMediatorName(user.getNickName());
mediatorVO.setSpecialty(user.getSpecialty());
if(caseMap!=null&&caseMap.containsKey(String.valueOf(user.getUserId()))) {
List<MsCaseApplication> applications = caseMap.get(String.valueOf(user.getUserId()));
// 已办案件
long count = applications.stream().filter(caseApplication -> !caseApplication.getCaseStatusName().equals("结束")).count();
mediatorVO.setTodoAmount(applications.size()-count);
mediatorVO.setCompleteAmount(count);
}
List<MediatorVO> mediatorVOS = new ArrayList<>();
mediatorVOS.add(mediatorVO);
result.setMediatorList(mediatorVOS);
}
if(StrUtil.isNotEmpty(msCaseMediator.getHearDate())){
List<String> herdates = new ArrayList<>();
herdates.add(msCaseMediator.getHearDate());
result.setHerDates(herdates);
}
return AjaxResult.success(result);
}
@@ -1211,9 +1265,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
//发起签署
sealSignRecord.setFilename(fileName);
String arbitratorId = caseApplication.getMediatorId();
if (StringUtils.isNotEmpty(arbitratorId)) {
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
Long arbitratorId = caseApplication.getMediatorId();
if (null!=arbitratorId) {
SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
if (sysUser == null) {
return AjaxResult.error();
}
@@ -1537,9 +1591,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
//发起签署
sealSignRecord.setFilename(fileName);
String arbitratorId = caseApplication.getMediatorId();
if (StringUtils.isNotEmpty(arbitratorId)) {
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
Long arbitratorId = caseApplication.getMediatorId();
if (arbitratorId!=null) {
SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
if (sysUser == null) {
return AjaxResult.error();
}
@@ -1781,7 +1835,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (nextFlow == null) {
throw new ServiceException("未找到下一个流程节点");
}
setMediatorAndDate(application,vo);
// setMediatorAndDate(application,vo);
application.setMediatorId(vo.getUserList().get(0).getUserId());
application.setMediatorName(vo.getUserList().get(0).getNickName());
application.setCaseFlowId(nextFlow.getNodeId());
application.setCaseStatusName(nextFlow.getCaseStatusName());
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
@@ -1802,6 +1858,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
*/
@Override
public MsCaseFlow nextFlow(Long caseId,Integer caseFlowId,Integer lockStatus) {
// 查询当前流程节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(caseFlowId);
if (currentFlow == null) {
throw new ServiceException("未找到当前流程节点");
}
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(caseFlowId);
if (nextFlow == null) {
throw new ServiceException("未找到下一个流程节点");
@@ -1815,7 +1876,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setLockStatus(lockStatus);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"");
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"");
return nextFlow;
}
@@ -2126,20 +2187,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
agentUser.setNickName(affiliate.getNameAgent());
agentUser.setPhonenumber(affiliate.getContactTelphoneAgent());
agentUser.setPassword(SecurityUtils.encryptPassword("abc123456"));
agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId()));
agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
userMapper.insertUser(agentUser);
userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
} else if (null == agentUser.getDeptId() ) {
// todo 未关联部门,关联部门
agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId()));
agentUser.setDeptId(Long.valueOf(affiliate.getApplicationId()));
userMapper.updateUser(agentUser);
}else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) {
}else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationId())) {
if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) {
throw new ServiceException("该申请代理人已在【" + agentUser.getDept().getDeptName() + "】申请机构下存在,请检查填写信息是否正确");
} else {
throw new ServiceException("该申请代理人已存在,与申请机构不匹配,请检查填写信息是否正确");
}
} else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) {
} else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationId())) {
// 同步用户表和案件关联人表的手机号和名称
affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber()) ? agentUser.getPhonenumber() : affiliate.getContactTelphoneAgent());
affiliate.setNameAgent(agentUser.getNickName());
@@ -2173,13 +2234,13 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV));
// 将组织机构id设为申请人名称
if (deptMap.containsKey(affiliate.getApplicationOrganName())) {
affiliate.setApplicationOrganId(String.valueOf(deptMap.get(affiliate.getApplicationOrganName())));
if (deptMap.containsKey(affiliate.getApplicationName())) {
affiliate.setApplicationId(String.valueOf(deptMap.get(affiliate.getApplicationName())));
} else {
// 如果不存在则新增
SysDept dept = new SysDept();
dept.setParentId(0L);
dept.setDeptName(affiliate.getApplicationOrganName());
dept.setDeptName(affiliate.getApplicationName());
dept.setAncestors("0");
dept.setOrderNum(1);
dept.setStatus("0");
@@ -2188,7 +2249,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
dept.setUpdateBy(getUsername());
sysDeptMapper.insertDept(dept);
deptMap.put(dept.getDeptName(), dept.getDeptId());
affiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
affiliate.setApplicationId(String.valueOf(dept.getDeptId()));
}
}
@@ -143,6 +143,11 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
@Transactional
@Override
public AjaxResult confirmPayment(CaseConfirmPayDTO dto) {
// 根据流程id查找当前流程节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(dto.getCaseFlowId());
if (currentFlow == null) {
return AjaxResult.error("未找到当前流程节点");
}
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(dto.getCaseFlowId());
if (nextFlow == null) {
@@ -156,7 +161,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
return AjaxResult.error("该批号下未找到案件");
}
for (MsCaseApplication application : applicationList) {
confirmPayment(nextFlow, application, dto);
confirmPayment(currentFlow,nextFlow, application, dto);
}
} else {
@@ -164,7 +169,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
MsCaseApplication application = new MsCaseApplication();
application.setId(dto.getCaseId());
application.setLockStatus(YesOrNoEnum.YES.getCode());
confirmPayment(nextFlow, application, dto);
confirmPayment(currentFlow,nextFlow, application, dto);
}
return AjaxResult.success("确认缴费成功");
@@ -213,7 +218,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
}
JSONObject jsonObject = new JSONObject();
jsonObject.set("totalFee", totalFee);
jsonObject.set("applicationOrganName", affiliate.getApplicationOrganName());
jsonObject.set("applicationOrganName", affiliate.getApplicationName());
return AjaxResult.success(jsonObject);
}
@@ -237,7 +242,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
result.setCaseStatusName(application.getCaseStatusName());
MsCaseAffiliate affiliate = caseAffiliateMapper.selectByPrimaryKey(application.getId());
if(affiliate != null) {
result.setApplicationOrganName(affiliate.getApplicationOrganName());
result.setApplicationOrganName(affiliate.getApplicationName());
}
// 查询缴费单
result.setCaseAttachList(caseAttachMapper.listCaseAttachByCaseIdAndType(id, AnnexTypeEnum.PAYMENT_RECEIPT.getCode()));
@@ -253,6 +258,12 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
@Transactional
@Override
public AjaxResult confirmPaid(CaseConfirmPayDTO dto) {
// 根据流程id查找当前流程节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(dto.getCaseFlowId());
if (currentFlow == null) {
return AjaxResult.error("未找到当前流程节点");
}
// 根据流程id查找下一个流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(dto.getCaseFlowId());
if (nextFlow == null) {
@@ -266,13 +277,13 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
return AjaxResult.error("该批号下未找到案件");
}
for (MsCaseApplication application : applicationList) {
confirmPaid(nextFlow, application);
confirmPaid(currentFlow,nextFlow, application);
}
}else {
MsCaseApplication caseApplication=new MsCaseApplication();
caseApplication.setId(dto.getCaseId());
caseApplication.setLockStatus(YesOrNoEnum.YES.getCode());
confirmPaid(nextFlow,caseApplication );
confirmPaid(currentFlow,nextFlow,caseApplication );
}
@@ -285,7 +296,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
* @param application
* @param
*/
private void confirmPaid(MsCaseFlow nextFlow, MsCaseApplication application) {
private void confirmPaid(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application) {
//更改记录表里的支付状态和支付时间
MsCasePaymentRecord casePaymentRecord = new MsCasePaymentRecord();
casePaymentRecord.setPaymentStatus(1);
@@ -300,7 +311,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
application.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(application);
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"确认已缴费");
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认已缴费");
// todo 发送短信
@@ -314,7 +325,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
* @param dto
*/
private void confirmPayment(MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) {
private void confirmPayment(MsCaseFlow currentFlow,MsCaseFlow nextFlow, MsCaseApplication application, CaseConfirmPayDTO dto) {
application.setPayType(dto.getPayType());
// 修改缴费附件
if (CollectionUtil.isNotEmpty(dto.getPayOrderList())) {
@@ -327,7 +338,7 @@ public class MsCasePaymentServiceImpl implements MsCasePaymentService {
application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName());
caseApplicationMapper.updateByPrimaryKeySelective(application);
CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(),"确认缴费");
CaseLogUtils.insertCaseLog(application.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(),"确认缴费");
}
@@ -10,7 +10,6 @@ import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.constant.FileTransformation;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
@@ -21,7 +20,6 @@ import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.EmailOutUtil;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.mapper.SysUserMapper;
@@ -31,9 +29,11 @@ import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseLogRecord;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.MsSignSealDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SendMailRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseLogRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseLogRecordVO;
import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
@@ -53,13 +53,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
import javax.annotation.Resource;
import java.io.File;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
import static com.ruoyi.common.core.domain.AjaxResult.success;
@@ -151,9 +148,9 @@ public class MsSignSealServiceImpl implements MsSignSealService {
//发起签署
sealSignRecord.setFilename(fileName);
String arbitratorId = caseApplication.getMediatorId();
if (StringUtils.isNotEmpty(arbitratorId)) {
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(arbitratorId));
Long arbitratorId = caseApplication.getMediatorId();
if (arbitratorId!=null) {
SysUser sysUser = sysUserMapper.selectUserById(arbitratorId);
if (sysUser == null) {
return AjaxResult.error();
}
@@ -186,6 +186,8 @@ public class VideoConferenceServiceImpl implements VideoConferenceService {
null, null);
// 先删除之前的会议
reservedConferenceMapper.deletByCaseId(caseId);
// 新增会议
reservedConferenceMapper.insert(conference);
return String.valueOf(roomId);
}
@@ -17,9 +17,7 @@
<result column="fee_payable" jdbcType="DECIMAL" property="feePayable" />
<result column="mediator_id" jdbcType="BIGINT" property="mediatorId" />
<result column="mediator_name" jdbcType="VARCHAR" property="mediatorName" />
<result column="is_agree_pend_tral" jdbcType="INTEGER" property="isAgreePendTral" />
<result column="pay_type" jdbcType="CHAR" property="payType" />
<result column="adjudica_counter" jdbcType="INTEGER" property="adjudicaCounter" />
<result column="is_absence" jdbcType="INTEGER" property="isAbsence" />
<result column="lock_status" jdbcType="INTEGER" property="lockStatus" />
<result column="room_id" jdbcType="VARCHAR" property="roomId" />
@@ -32,10 +30,7 @@
<result column="version" jdbcType="INTEGER" property="version" />
<result column="arbitrat_claims" jdbcType="LONGVARCHAR" property="arbitratClaims" />
<result column="facts" jdbcType="LONGVARCHAR" property="facts" />
<result column="request_rule" jdbcType="LONGVARCHAR" property="requestRule" />
<result column="case_describe" jdbcType="LONGVARCHAR" property="caseDescribe" />
<result column="mediation_url" jdbcType="LONGVARCHAR" property="mediationUrl" />
<result column="adjudica_counter_reason" jdbcType="LONGVARCHAR" property="adjudicaCounterReason" />
<result column="mediation_agreement" jdbcType="LONGVARCHAR" property="mediationAgreement" />
<result column="is_reconci" jdbcType="INTEGER" property="isReconci" />
</resultMap>
@@ -36,39 +36,6 @@
</where>
</select>
<select id="selectColumnandComment" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule" resultMap="BaseResultMap">
select
a.COLUMN_name as `column`,
a.COLumn_comment as column_name
from
information_schema.COLUMNS a
where
TABLE_schema = #{databaseName}
and TABLE_name in('case_application','case_affiliate')
and COLUMN_NAME not in('id','case_appli_id','case_num','case_subject_amount',
'register_date','arbitrat_method','case_status','hear_date','begin_video_date',
'online_video_person','create_time','update_by','update_time','create_by',
'arbitrator_id','arbitrator_name','pended_trial_arbitorid','pending_appoint_arbotrar',
'case_name','case_result','is_agree_pend_tral','objection_add_eviden','open_court_hear',
'paid_expenses','filearbitra_url','pay_type','adjudica_counter','proper_preser','objecti_juris',
'is_absence','respon_cross_opin','applica_cross_opin','respon_defen_opini','appli_is_absen',
'lock_status','room_id','import_flag','version','batch_number','template_id','applicant_agent_user_id','contract_number','identity_type','application_organ_id')
</select>
<select id="selectColumnbycomment" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule" resultMap="BaseResultMap">
select
COLUMN_NAME
from
information_schema.COLUMNS
where
TABLE_schema = #{databaseName}
and TABLE_name in('case_application','case_affiliate')
and COLumn_comment = #{columnName}
</select>
<select id="selectFatchRuleListIsDefault" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule" resultMap="BaseResultMap">
SELECT f.id ,f.file_name ,f.start_content ,f.end_content ,
f.`column` ,f.is_default ,f.`column_name`