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

This commit was merged in pull request #33.
This commit is contained in:
2024-01-22 10:02:40 +08:00
committed by Gitea
3 changed files with 77 additions and 21 deletions
@@ -14,4 +14,11 @@ public interface TemplateManageMapper {
int updateTemplateManage(TemplateManage templateManage); int updateTemplateManage(TemplateManage templateManage);
TemplateManage selectById(@Param("id") String id); TemplateManage selectById(@Param("id") String id);
/**
* 根据模板类型查找模板
* @param type 模板类型(1-调解书,2-调解申请书)
* @return
*/
TemplateManage selectByType(@Param("type") int type);
} }
@@ -182,28 +182,14 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if (caseApplication.getId() == null) { if (caseApplication.getId() == null) {
caseApplication.setId(IdWorkerUtil.getId()); caseApplication.setId(IdWorkerUtil.getId());
} }
// 根据用户查询角色 // 根据角色获取案件流程
LoginUser loginUser = SecurityUtils.getLoginUser(); List<MsCaseFlow> caseFlows= selectCaseFlows();
List<SysRole> roles = loginUser.getUser().getRoles(); if (CollectionUtil.isEmpty(caseFlows)) {
if (CollectionUtil.isEmpty(roles)) {
throw new ServiceException("该用户未指定角色");
}
// 根据角色查询关联的案件状态
Example example = new Example(MsCaseFlowRoleRelated.class);
example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
List<MsCaseFlowRoleRelated> caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example);
if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) {
throw new ServiceException("该角色为绑定案件流程"); throw new ServiceException("该角色为绑定案件流程");
} }
Example flowExample = new Example(MsCaseFlow.class);
flowExample.setOrderByClause("sort asc");
flowExample.createCriteria().andIn("id", caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList()));
List<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
MsCaseFlow caseFlow = caseFlows.get(0); MsCaseFlow caseFlow = caseFlows.get(0);
if (CollectionUtil.isNotEmpty(caseFlows)) { caseApplication.setCaseStatusName(caseFlow.getCaseStatusName());
caseApplication.setCaseStatusName(caseFlow.getCaseStatusName()); caseApplication.setCaseFlowId(caseFlow.getId());
caseApplication.setCaseFlowId(caseFlow.getId());
}
caseApplication.setCreateTime(new Date()); caseApplication.setCreateTime(new Date());
// 计算仲裁费用 // 计算仲裁费用
setFeePayableMethod(caseApplication); setFeePayableMethod(caseApplication);
@@ -256,6 +242,23 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
affiliate.setCaseAppliId(caseApplication.getId()); affiliate.setCaseAppliId(caseApplication.getId());
msCaseAffiliateMapper.insert(affiliate); msCaseAffiliateMapper.insert(affiliate);
// 生成调解申请书
// 查询调解申请书模板id
TemplateManage templateManage=templateManageMapper.selectByType(2);
if(templateManage!=null) {
// 批量生成调解申请书
MsCaseApplicationReq req = new MsCaseApplicationReq();
req.setCaseFlowId(caseFlow.getId());
if(!caseApplication.isImportFlag()) {
req.setId(caseApplication.getId());
}else {
// 压缩包导入
req.setBatchNumber(caseApplication.getBatchNumber());
}
req.setTemplateId(String.valueOf(templateManage.getId()));
generateApplication(req);
}
} }
// 保存案件附件 // 保存案件附件
@@ -285,6 +288,33 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return 0; return 0;
} }
/**
* 查询案件流程
* @return
*/
private List<MsCaseFlow> selectCaseFlows() {
// 根据用户查询角色
LoginUser loginUser = SecurityUtils.getLoginUser();
List<SysRole> roles = loginUser.getUser().getRoles();
if (CollectionUtil.isEmpty(roles)) {
throw new ServiceException("该用户未指定角色");
}
// 根据角色查询关联的案件状态
Example example = new Example(MsCaseFlowRoleRelated.class);
example.createCriteria().andIn("roleid", roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
List<MsCaseFlowRoleRelated> caseFlowRoleRelatedList = caseFlowRoleRelatedMapper.selectByExample(example);
if (CollectionUtil.isEmpty(caseFlowRoleRelatedList)) {
throw new ServiceException("该角色为绑定案件流程");
}
Example flowExample = new Example(MsCaseFlow.class);
flowExample.setOrderByClause("sort asc");
flowExample.createCriteria().andIn("id", caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList()));
List<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
return caseFlows;
}
/** /**
* 计算仲裁费用 * 计算仲裁费用
* *
@@ -471,6 +501,21 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
} }
if(caseCount>0) { if(caseCount>0) {
// // 查询调解申请书模板id
// TemplateManage templateManage=templateManageMapper.selectByType(2);
// if(templateManage!=null) {
// List<MsCaseFlow> caseFlows = selectCaseFlows();
// // 批量生成调解申请书
// MsCaseApplicationReq req = new MsCaseApplicationReq();
// if (CollectionUtil.isNotEmpty(caseFlows)) {
// MsCaseFlow caseFlow = caseFlows.get(0);
// req.setCaseFlowId(caseFlow.getId());
// req.setBatchNumber(batchNumber);
// req.setTemplateId(String.valueOf(templateManage.getId()));
// generateApplication(req);
// }
// }
return AjaxResult.success(); return AjaxResult.success();
}else { }else {
return AjaxResult.error("请检查压缩包!"); return AjaxResult.error("请检查压缩包!");
@@ -1109,9 +1154,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// todo // todo
String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day; String saveFolderPath = RuoYiConfig.getUploadPath()+"/"+ year + "/" + month + "/" + day;
Integer annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode(); Integer annexType = AnnexTypeEnum.MEDIATION_APPLICATION.getCode();
String orgFileName = "调解申请书"; String orgFileName = "调解申请书.docx";
if(templateType!=null&&templateType==1) { if(templateType!=null&&templateType==1) {
orgFileName = "调解书"; orgFileName = "调解书.docx";
annexType=AnnexTypeEnum.MEDIATE_BOOK.getCode(); annexType=AnnexTypeEnum.MEDIATE_BOOK.getCode();
} }
String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx"; String fileName = UUID.randomUUID().toString().replace("-", "")+orgFileName + ".docx";
@@ -85,4 +85,8 @@
<select id="selectById" resultMap="TemplateManageResult"> <select id="selectById" resultMap="TemplateManageResult">
select * from ms_template_manage where id=#{id} select * from ms_template_manage where id=#{id}
</select> </select>
<select id="selectByType" resultMap="TemplateManageResult">
select * from ms_template_manage where tem_type=#{type}
</select>
</mapper> </mapper>