This commit is contained in:
qitz
2024-01-23 14:01:50 +08:00
5 changed files with 121 additions and 22 deletions
@@ -150,7 +150,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
// 根据用户查询角色
LoginUser loginUser = SecurityUtils.getLoginUser();
List<SysRole> roles = loginUser.getUser().getRoles();
SysUser sysUser = loginUser.getUser();
List<SysRole> roles = sysUser.getRoles();
if (CollectionUtil.isEmpty(roles)) {
throw new ServiceException("该用户未指定角色");
}
@@ -169,6 +170,18 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (CollectionUtil.isEmpty(caseFlows)) {
throw new ServiceException("该角色为绑定案件流程");
}
for (SysRole role : roles) {
if(StrUtil.isNotEmpty(role.getRoleName())&&StrUtil.equals(role.getRoleName(),"申请人")){
if(loginUser.getDeptId()!=null) {
req.setApplicationOrganId(String.valueOf(loginUser.getDeptId()));
}
req.setApplicantFlag(1);
}
if(StrUtil.isNotEmpty(role.getRoleName())&&StrUtil.equals(role.getRoleName(),"被申请人")){
// todo 被申请人案件根据被申请人身份证号查询案件列表
req.setRespondentIdentityNum(sysUser.getIdCard());
}
}
startPage();
// 查询案件列表
List<MsCaseApplicationVO> caseApplicationList = msCaseApplicationMapper.list(req, caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList()));
@@ -264,7 +277,6 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
affiliate.setCaseAppliId(caseApplication.getId());
msCaseAffiliateMapper.insert(affiliate);
// 生成调解申请书
// 查询调解申请书模板id
TemplateManage templateManage=templateManageMapper.selectByType(2);
if(templateManage!=null) {
@@ -277,6 +289,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 压缩包导入
req.setBatchNumber(caseApplication.getBatchNumber());
}
// 生成调解申请书
req.setTemplateId(String.valueOf(templateManage.getId()));
generateApplication(req);
@@ -589,7 +602,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
List<Long> caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList());
// 根据ids查询案件关联人员
Example afflicateExample = new Example(MsCaseAffiliate.class);
afflicateExample.createCriteria().andIn("case_appli_id", caseIds);
afflicateExample.createCriteria().andIn("caseAppliId", caseIds);
List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(afflicateExample);
if(CollectionUtil.isEmpty(affiliateList)){
throw new ServiceException("该批次号下未找到案件关联人员");
@@ -712,7 +725,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
// 查询案件关联人员
Example example = new Example(MsCaseAffiliate.class);
example.createCriteria().andIn("case_appli_id", applicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList()));
example.createCriteria().andIn("caseAppliId", applicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList()));
List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(example);
if (CollectionUtil.isEmpty(affiliateList)) {
return AjaxResult.error("该批次号下未找到案件");
@@ -841,10 +854,10 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 查询日志中是否有该节点的被申请人操作
Example example = new Example(MsCaseLogRecord.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("case_appli_id", vo.getId());
criteria.andEqualTo("case_node", nextFlow.getNodeId());
criteria.andEqualTo("case_status_name", nextFlow.getCaseStatusName());
criteria.andEqualTo("create_by", user.getUserName());
criteria.andEqualTo("caseAppliId", vo.getId());
criteria.andEqualTo("caseNode", nextFlow.getNodeId());
criteria.andEqualTo("caseStatusName", nextFlow.getCaseStatusName());
criteria.andEqualTo("createBy", user.getUserName());
int count = caseLogRecordMapper.selectCountByExample(example);
if(count>0){
// 被申请人已预约,更新流程节点
@@ -1092,8 +1105,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 查询调解书模板是否存在
Example example = new Example(MsCaseApplication.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("batch_number", req.getBatchNumber());
criteria.andIsNotNull("template_id");
criteria.andEqualTo("batchNumber", req.getBatchNumber());
criteria.andIsNotNull("templateId");
MsCaseApplication caseApplication = msCaseApplicationMapper.selectOneByExample(example);
if(caseApplication==null||caseApplication.getTemplateId()==null){
return AjaxResult.error("未找到模板");
@@ -1815,9 +1828,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// todo
String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day;
Integer annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode();
String orgFileName = "调解申请书.docx";
String orgFileName = "调解申请书";
if(templateType!=null&&templateType==1) {
orgFileName = "调解书.docx";
orgFileName = "调解书";
annexType=AnnexTypeEnum.MEDIATE_BOOK.getCode();
}
String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx";
@@ -1827,7 +1840,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
MsCaseAttach caseAttach = MsCaseAttach.builder()
.caseAppliId(application.getId())
.annexName(orgFileName)
.annexName(orgFileName+".docx")
.annexPath(resultFilePath.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX))
.annexType(annexType)
.build();
@@ -1910,7 +1923,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// String filePath = RuoYiConfig.getUploadPath();
MsCaseAttach caseAttach = new MsCaseAttach();
caseAttach.setCaseAppliId(caseApplication.getId());
caseAttach.setAnnexPath(entry.getValue());
caseAttach.setAnnexPath(fileUrl.replace(RuoYiConfig.getProfile(),Constants.RESOURCE_PREFIX));
caseAttach.setAnnexName(entry.getKey());
// todo
// if (StrUtil.isNotEmpty(fileUrl)) {