This commit is contained in:
qitz
2024-01-24 10:19:10 +08:00
8 changed files with 139 additions and 91 deletions
@@ -76,5 +76,9 @@ public class MsCaseApplicationReq {
* 是否在线开庭,空-书面
*/
private Integer hearDateFlag ;
/**
* 是否小程序,1-是
*/
private Integer miniProgressFlag ;
}
@@ -61,7 +61,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"</if> "
+
"<if test=\"req.hearDateFlag != null \">" +
" AND a.mediation_method = '1'" +
" AND c.mediation_method = '1'" +
"</if> "
+
"<if test=\"req.startTime != null and req.startTime != ''\">" +
@@ -99,7 +99,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"</if> "
+
"<if test=\"req.hearDateFlag != null \">" +
" AND a.mediation_method = '1'" +
" AND c.mediation_method = '1'" +
"</if> "
+
@@ -133,7 +133,7 @@ public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
"</if> "
+
"<if test=\"req.hearDateFlag != null \">" +
" AND a.mediation_method = '1'" +
" AND c.mediation_method = '1'" +
"</if> "
+
@@ -1,10 +1,19 @@
package com.ruoyi.wisdomarbitrate.mapper.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseMediator;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
/**
* 案件预约表
*/
public interface MsCaseMediatorMapper extends Mapper<MsCaseMediator> {
/**
* 查询最新一条申请人的预约信息
* @param id
* @return
*/
@Select("SELECT id,case_appli_id caseAppliId,mediator_id mediatorId, mediator_name mediatorName,hear_date hearDate from ms_case_mediator where case_appli_id=#{id} and type is null order by id desc limit 1")
MsCaseMediator selectLastApplicant(@Param("id") Long id);
}
@@ -145,13 +145,20 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
public List<MsCaseApplicationVO> list(MsCaseApplicationReq req) {
// admin查询所有案件
if (StrUtil.equals(SecurityUtils.getUsername(), "admin")) {
if(req.getHearDateFlag()!=null){
// todo 暂时写死
req.setCaseFlowId(9);
}
startPage();
return msCaseApplicationMapper.list(req, null);
}
// 根据用户查询角色
LoginUser loginUser = SecurityUtils.getLoginUser();
SysUser sysUser = loginUser.getUser();
List<SysRole> roles = sysUser.getRoles();
// 根据id查询用户
SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId());
List<SysRole> roles = loginUser.getUser().getRoles();
if (CollectionUtil.isEmpty(roles)) {
throw new ServiceException("该用户未指定角色");
}
@@ -170,21 +177,42 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (CollectionUtil.isEmpty(caseFlows)) {
throw new ServiceException("该角色为绑定案件流程");
}
Map<String, MsCaseFlow> flowMap = caseFlows.stream().collect(Collectors.toMap(MsCaseFlow::getButtonAuthFlag, Function.identity()));
List<String> caseStatusNames = caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList());
for (SysRole role : roles) {
if(StrUtil.isNotEmpty(role.getRoleName())&&StrUtil.equals(role.getRoleName(),"申请人")){
if(loginUser.getDeptId()!=null) {
req.setApplicationOrganId(String.valueOf(loginUser.getDeptId()));
if(sysUser.getDeptId()!=null) {
req.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
}
req.setApplicantFlag(1);
break;
}
if(StrUtil.isNotEmpty(role.getRoleName())&&StrUtil.equals(role.getRoleName(),"被申请人")){
caseStatusNames=new ArrayList<>();
// todo 被申请人案件根据被申请人身份证号查询案件列表
req.setRespondentIdentityNum(sysUser.getIdCard());
MsCaseFlow caseFlow =null;
// todo 查询待调解流程id被申请人暂时写死
if(req.getMiniProgressFlag()!=null) {
if (req.getHearDateFlag() != null) {
// caseFlow = flowMap.get("caseManagement:list:mediate");
caseStatusNames.add("待调解");
} else {
// 待选择调解员
caseStatusNames.add("待选择调解员");
}
}else {
// PC端
caseStatusNames.add("待被申请人签收");
}
break;
}
}
startPage();
// 查询案件列表
List<MsCaseApplicationVO> caseApplicationList = msCaseApplicationMapper.list(req, caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList()));
List<MsCaseApplicationVO> caseApplicationList = msCaseApplicationMapper.list(req, caseStatusNames);
return caseApplicationList;
}
@@ -571,7 +599,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(templateManage==null||StrUtil.isEmpty(templateManage.getTemOrigPath())){
throw new ServiceException("未找到模板");
}
String templatePath = "/home/ruoyi/" + templateManage.getTemOrigPath();
String templatePath = "/home/ruoyi" + templateManage.getTemOrigPath();
templatePath=templatePath.replace("/profile","/uploadPath");
try {
@@ -948,7 +976,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
criteria.andIsNull("type");
}
criteria.andEqualTo("caseAppliId", vo.getId());
criteria.andEqualTo("mediatorId", user.getUserId());
// criteria.andEqualTo("mediatorId", user.getUserId());
int count = msCaseMediatorMapper.selectCountByExample(example);
if (count > 0) {
// 申请人已预约,更新主表流程节点
@@ -1029,12 +1057,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
// todo 返回申请人预约信息,预约信息查预约表
Example example = new Example(MsCaseMediator.class);
Example.Criteria criteria = example.createCriteria();
criteria.andIsNull("type");
criteria.andEqualTo("caseAppliId", id);
// criteria.andEqualTo("mediatorId", SecurityUtils.getUserId());
MsCaseMediator msCaseMediator = msCaseMediatorMapper.selectOneByExample(example);
MsCaseMediator msCaseMediator = msCaseMediatorMapper.selectLastApplicant(id);
if(msCaseMediator==null){
return AjaxResult.success(result);
}
@@ -2100,7 +2124,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId()));
userMapper.insertUser(agentUser);
userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
} else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) {
} else if (null == agentUser.getDeptId() ) {
// todo 未关联部门,关联部门
agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId()));
userMapper.updateUser(agentUser);
}else if (null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) {
if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) {
throw new ServiceException("该申请代理人已在【" + agentUser.getDept().getDeptName() + "】申请机构下存在,请检查填写信息是否正确");
} else {