仲裁系统bug修复

This commit is contained in:
18792927508
2024-05-08 17:28:22 +08:00
parent fbcf91a592
commit 5b24d0f522
17 changed files with 735 additions and 293 deletions
@@ -20,6 +20,12 @@ public interface ISysUserService
* @return 用户信息集合信息
*/
public List<SysUser> selectUserList(SysUser user);
/**
* 查询仲裁员
* @param arbitrator
* @return
*/
public List<SysUser> selectUserListByAdRole(Arbitrator arbitrator);
/**
@@ -6,11 +6,14 @@ import java.util.List;
import java.util.stream.Collectors;
import javax.validation.Validator;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.mapper.*;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,6 +68,8 @@ public class SysUserServiceImpl implements ISysUserService {
@Autowired
private CaseApplicationMapper caseApplicationMapper;
@Autowired
private CaseAffiliateMapper caseAffiliateMapper;
@Autowired
protected Validator validator;
@@ -81,21 +86,45 @@ public class SysUserServiceImpl implements ISysUserService {
return userMapper.selectUserList(user);
}
/**
* 查询仲裁员
* @param arbitrator
* @return
*/
@Override
public List<SysUser> selectUserListByAdRole(Arbitrator arbitrator) {
// 根据案件id查询案件
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(arbitrator.getCaseId());
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
List<String> phoneList=new ArrayList<>();
if(CollectionUtil.isNotEmpty(caseAffiliates)){
for (CaseAffiliate affiliate : caseAffiliates) {
if(StrUtil.isNotEmpty(affiliate.getContactTelphone())) {
phoneList.add(affiliate.getContactTelphone());
}
if(StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
phoneList.add(affiliate.getContactTelphoneAgent());
}
}
}
List<SysUser> sysUsers = userMapper.selectUserListByAdRole(arbitrator);
if(sysUsers!=null&&sysUsers.size()>0){
List<SysUser> arbitrators = new ArrayList<>();
if(CollectionUtil.isNotEmpty(sysUsers)){
for(SysUser sysUser: sysUsers){
Long userId = sysUser.getUserId();
int casenum = caseApplicationMapper.selectCasenum(userId.toString());
String nickName = sysUser.getNickName();
String nickNamenew = nickName + "(待办案件数量" + casenum + "个)";
sysUser.setNickNameAndNum(nickNamenew);
if(!phoneList.contains(sysUser.getPhonenumber())) {
Long userId = sysUser.getUserId();
int todoCount = caseApplicationMapper.selectCasenum(userId.toString());
String nickName = sysUser.getNickName();
String nickNamenew = nickName + "(待办案件数量" + todoCount + "个)";
sysUser.setNickNameAndNum(nickNamenew);
arbitrators.add(sysUser);
}
}
}
return sysUsers;
return arbitrators;
}
/**
@@ -9,6 +9,10 @@ public class Arbitrator extends BaseEntity {
/** ID */
private Long id;
/**
* 案件id
*/
private Long caseId;
/** 仲裁员姓名 */
private String arbitratorName;
/** 职称 */
@@ -47,6 +51,14 @@ public class Arbitrator extends BaseEntity {
/** 已结案数量 */
private int closedCaseNum;
public Long getCaseId() {
return caseId;
}
public void setCaseId(Long caseId) {
this.caseId = caseId;
}
public Long getId() {
return id;
}
@@ -193,6 +193,10 @@ public class CaseApplication extends BaseEntity {
* 登录用户用户名
*/
private String loginUserName;
/**
* 登录人电话
*/
private String loginUserPhone;
private List<Long> deptIds;
/**
* 部门长状态
@@ -428,4 +432,8 @@ public class CaseApplication extends BaseEntity {
private String userName;
// 缴费确认驳回原因
private String payRejectReason;
/**
* 仲裁员确认裁决书驳回
*/
private String arbitrateReject;
}
@@ -67,7 +67,9 @@ public interface CaseApplicationMapper {
ToDoCount selectAdminCaseToDoCount();
ToDoCount selectTodoCountByRole(CaseApplication caseApplication);
ToDoCount selectTodoCountByRole(@Param("caseApplication") CaseApplication caseApplication,
@Param("caseStatusList") List<Integer> caseStatusList,
@Param("roleNames") List<String> roleNames);
/**
* 修改案件锁定状态
@@ -138,4 +140,13 @@ public interface CaseApplicationMapper {
List<CaseApplication> listCaseApplicationByBatchNumber(CaseApplication caseApplication);
List<CaseApplication> selectAdminCaseApplicationListBatch1(CaseApplication caseApplication);
/**
* 案件列表查询
* @param caseApplication
* @return
*/
List<CaseApplication> list(@Param("caseApplication") CaseApplication caseApplication,
@Param("caseStatusList") List<Integer> caseStatusList,
@Param("roleNames") List<String> roleNames);
}
@@ -67,4 +67,20 @@ public interface IAdjudicationService {
AjaxResult caseFileBatch(Integer batchNumber);
AjaxResult serviceBatch(Integer batchNumber) throws EsignDemoException, IOException;
/**
* 开庭审理,确定审理结果,生成裁决书
* @param caseApplication
* @return
*/
AjaxResult caseJudgment(CaseApplication caseApplication);
/**
* 案件状态改变
* @param id 案件id
* @param caseStatus 案件状态
* @return
*/
AjaxResult changeCaseStatus(Long id, Integer caseStatus);
}
@@ -139,6 +139,8 @@ public interface ICaseApplicationService {
CaseAttach downloadCaseZipFile(CaseApplication caseApplication);
List<CaseApplication> selectCaseApplicationListBatchByRole(CaseApplication caseApplication);
public List<CaseApplication> page(CaseApplication caseApplication) ;
int submitCaseApplicationBatch(String batchNumber);
@@ -132,13 +132,18 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
// 日期格式化年月日
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
/**
* 生成裁决书
* @param caseApplicationReq
* @return
*/
@Override
@Transactional
public AjaxResult createDocument(CaseApplication caseApplicationReq) {
// todo 生成裁决书单独出接口,即确定审理结果接口,提交按钮只改变案件状态和生成签名链接
String templatePath = "";
String templateName = "";
String agentName = "";
String resName = "";
try {
Map<String, Object> datas = new HashMap<>();
Long id = caseApplicationReq.getId();
@@ -214,7 +219,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
// 遍历书签,给书签赋值
replaceBookmark(bookmarkList, datas, valueMap);
// 根据条件替换书签
conditionReplaceBookmark(caseApplicationById, datas, agentName, resName, arbitrateRecordSelect);
conditionReplaceBookmark(caseApplicationById, datas, "", "", arbitrateRecordSelect);
// 裁决书生成时间
LocalDate now = LocalDate.now();
String year = Integer.toString(now.getYear());
@@ -250,7 +255,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
// 保存裁决书附件
saveArbitorFile(id, saveName, savePath, caseApplicationById, arbitrateRecordSelect);
saveArbitorFile(id, saveName, savePath, caseApplicationById, arbitrateRecordSelect,CaseApplicationConstants.VERPRIF_ARBITRATION);
return AjaxResult.success("裁决书已生成");
} catch (IOException e) {
@@ -565,8 +570,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
* @param savePath 保存路径
* @param caseApplicationById 案件基本信息
* @param arbitrateRecordSelect 出裁决书生成记录
* @param caseStatus 案件状态,不为空则更新案件状态
*/
private void saveArbitorFile(Long id, String saveName, String savePath, CaseApplication caseApplicationById, ArbitrateRecord arbitrateRecordSelect) {
private void saveArbitorFile(Long id, String saveName, String savePath, CaseApplication caseApplicationById, ArbitrateRecord arbitrateRecordSelect,Integer caseStatus) {
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id).annexName(saveName).annexPath(savePath).annexType(3).build();
//保存到附件表里,先判断之前有没有,有的话更新,没有的话新增
List<CaseAttach> caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach);
@@ -586,7 +592,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
}
//修改案件状态
caseApplicationById.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
if(caseStatus!=null) {
caseApplicationById.setCaseStatus(caseStatus);
}
Integer arbitratMethod = caseApplicationById.getArbitratMethod();
if (arbitratMethod == 1) {
caseApplicationById.setLockStatus(1);
@@ -1769,6 +1777,145 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
throw new ServiceException("这个批号没有批量送达裁决书的案件");
}
return AjaxResult.success("裁决书送达成功");
}
/**
* 开庭审理,确定审理结果,生成裁决书
* @param req
* @return
*/
@Override
public AjaxResult caseJudgment(CaseApplication req) {
//获取案件详细信息
CaseApplication caseApplicationById = caseApplicationService.selectCaseApplication(req);
if (caseApplicationById == null) {
return AjaxResult.error("案件不存在");
}
if (caseApplicationById.getTemplateId() == null) {
return AjaxResult.error("请先指定裁决书模板");
}
// 根据模板id查找对应的模板
TemplateManage templateManage = new TemplateManage();
templateManage.setId(caseApplicationById.getTemplateId());
List<TemplateManage> templateManages = templateManageMapper.selectTemplateList(templateManage);
if (CollectionUtil.isEmpty(templateManages)) {
return AjaxResult.error("请先指定裁决书模板");
}
String templatePath = templateManages.get(0).getTemOrigPath();
if (StrUtil.isEmpty(templatePath)) {
return AjaxResult.error("未找到该模板");
}
templatePath = "/home/ruoyi/" + templatePath;
try {
File file = new File(templatePath);
} catch (Exception e) {
return AjaxResult.error("未找到该模板");
}
// 查询案件相关表信息
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(req.getId());
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if(CollectionUtil.isEmpty(caseAffiliates)){
return AjaxResult.error("未找到案件相关人员");
}
// 在系统表中查询案件内置字段
SysDictData sysDictData = new SysDictData();
sysDictData.setDictType("case_built_type");
List<SysDictData> dictDataList = dictDataMapper.selectDictDataList(sysDictData);
// 根据模板id查询抓取规则,判断从主表取值还是从columnValue值取
List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(caseApplicationById.getTemplateId());
// 抓取规则,0-内置字段,1-自定义字段
Map<Integer, List<FatchRule>> fatchRuleMap = new HashMap<>();
// 裁决书需要的字段和内容,占位符需要配置成中文
Map<String, String> valueMap = new HashMap<>();
// 如果未设置抓取规则,则从主表取数据,设置内置字段值
if (CollectionUtil.isNotEmpty(fatchRuleList)) {
fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getIsDefault));
}
// 自定义字段,从columnValue值取
if (fatchRuleMap.size() > 0 && fatchRuleMap.containsKey(1)) {
// 根据案件id查询key-value表
List<ColumnValue> columnValueList = columnValueMapper.listByCaseId(req.getId());
if (CollectionUtil.isNotEmpty(columnValueList)) {
columnValueList.forEach(columnValue -> valueMap.put(columnValue.getName(), columnValue.getValue()));
}
}
// 组装内置字段,在主表中查出内容
buildDefaultColumnValue(dictDataList, caseAffiliates, valueMap, caseApplicationById);
// 获取模板中的占位符key
List<String> bookmarkList = getBookmarkByDocx(templatePath);
if (CollectionUtil.isEmpty(bookmarkList)) {
return AjaxResult.success("请检查模板是否配置正确,未获取到占位符");
}
//获取仲裁记录表里的相关信息
ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
arbitrateRecord.setCaseAppliId(req.getId());
ArbitrateRecord arbitrateRecordSelect = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
Map<String, Object> datas = new HashMap<>();
// 遍历书签,给书签赋值
replaceBookmark(bookmarkList, datas, valueMap);
// 根据条件替换书签
conditionReplaceBookmark(caseApplicationById, datas,"", "", arbitrateRecordSelect);
// 裁决书生成时间
LocalDate now = LocalDate.now();
String year = Integer.toString(now.getYear());
datas.put("裁决书生成时间", year);
//生成编码
String equipmentNo = getNewEquipmentNo();
// 裁决书编号
datas.put("裁决书编号", equipmentNo);
// 仲裁费
datas.put("仲裁费", caseApplicationById.getFeePayable() != null ? caseApplicationById.getFeePayable().toString() : "");
// 案件创建时间
Date createTime = caseApplicationById.getCreateTime();
// 将日期格式化为字符串
String createTimeStr = sdf.format(createTime);
datas.put("案件创建时间", createTimeStr);
// 立案日期
Date registerDate = caseApplicationById.getRegisterDate();
String registerDateStr = sdf.format(registerDate);
datas.put("立案日期", registerDateStr);
String month = String.format("%02d", now.getMonthValue());
String day = String.format("%02d", now.getDayOfMonth());
// todo
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
// String saveFolderPath = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
// todo
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// 将word中的标签替换掉,生成新的word
String docFilePath = null;
try {
docFilePath = wordChangeText(templatePath, datas, saveFolderPath, fileName);
} catch (IOException e) {
throw new ServiceException("生成裁决书失败");
}
String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
// 保存裁决书附件
saveArbitorFile(req.getId(), saveName, savePath, caseApplicationById, arbitrateRecordSelect,null);
return AjaxResult.success("裁决书已生成");
}
@Transactional
@Override
public AjaxResult changeCaseStatus(Long id, Integer caseStatus) {
if (id == null || caseStatus == null) {
return AjaxResult.error("参数校验失败");
}
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
caseApplication.setCaseStatus(caseStatus);
caseApplicationMapper.submitCaseApplication(caseApplication);
return AjaxResult.success();
}
/**
@@ -369,81 +369,274 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
@Override
public ToDoCount selectToDoCount() {
/**
* 分页查询
* 数据权限:1.每个人不同的角色,而每个角色可以操作不同的案件状态
* 2.申请人,被申请人:可以看到自己相关的案件(案件有被申请人相关的信息)
* 3.仲裁员:案件选定了某个仲裁员后,该仲裁员就可以查看该案件
* 4.超级管理员,法律顾问秘书,仲裁委(部门长):可以查看所有案件
*
* @param caseApplication
* @return
*/
public List<CaseApplication> page(CaseApplication caseApplication) {
List<CaseApplication> caseApplications= new ArrayList<>();
// todo 案件列表查询Bug修复,需要看见已办案件
// 获取登录用户
LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser();
Long userId = user.getUserId();
// 查询登录人信息
// 查询登录人,根据邮箱查询
SysUser sysUser = sysUserMapper.selectUserById(userId);
if(sysUser==null){
throw new ServiceException("未获取到登录用户信息");
}
List<SysRole> roles = sysUser.getRoles();
// 没有角色不能查看案件列表
if (CollectionUtil.isEmpty(roles)) {
throw new ServiceException("该用户没有角色权限");
}
CaseApplication caseApplication = new CaseApplication();
List<Integer> caseStatusList = new ArrayList<>();
List<String> roleNames = roles.stream().map(SysRole::getRoleName).collect(Collectors.toList());
startPage();
for (SysRole role : roles) {
if (StrUtil.isEmpty(role.getRoleName())) {
if(StrUtil.isEmpty(role.getRoleName())){
continue;
}
// 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
if (role.getRoleName().equals("超级管理员")
) {
return caseApplicationMapper.selectAdminCaseToDoCount();
// 查看所有权限
if("超级管理员".equals(role.getRoleName())){
caseApplications = caseApplicationMapper.list(caseApplication,caseStatusList,null);
setArbitorMethod(caseApplications);
return caseApplications;
}
caseApplication.setLoginUserName(sysUser.getUserName());
caseApplication.setLoginUserPhone(sysUser.getPhonenumber());
if("申请人".equals(role.getRoleName())){
// 申请人在生成裁决书之前都可以修改案件
Integer[] array = {0,-1,1,2,3,4,5,6,7,8,9,10,31};
caseStatusList.addAll(Arrays.asList(array));
}
if("被申请人".equals(role.getRoleName())) {
// 案件质证,开庭审理,书面审理
caseStatusList.add(4);
caseStatusList.add(8);
caseStatusList.add(9);
}
if("仲裁员".equals(role.getRoleName())){
Integer[] array = {7,8,9,13,18};
caseStatusList.addAll(Arrays.asList(array));
caseApplication.setArbitratorId(String.valueOf(sysUser.getUserId()));
}
if ("仲裁委".equals(role.getRoleName())
|| "部门长".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
// 组庭确定,部门长审核裁决书
caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION);
// caseStatusList.add(CaseApplicationConstants.ARBITRATED_SEAL);
caseApplication.setDeptHeadStatus(caseStatusList);
}
if ("仲裁员".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
caseApplication.setUserId(String.valueOf(userId));
}
if ("财务".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
caseApplication.setFinanceStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
caseStatusList.add(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
}
if ("法律顾问".equals(role.getRoleName())) {
// 查询角色有关的用户部门
// List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
List<Long> deptIds = new ArrayList<>();
deptIds.add(sysUser.getDeptId());
caseApplication.setDeptIds(deptIds);
if ("法律顾问".equals(role.getRoleName()) || "秘书".equals(role.getRoleName()) ) {
Integer[] array = {1,5,8,9,11,14,15,16,31};
caseStatusList.addAll(Arrays.asList(array));
}
if ("申请人".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
// 查询角色有关的用户部门
caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
}
if ("被申请人".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
//
caseApplication.setIdCard(String.valueOf(sysUser.getIdCard()));
}
if ("代理人".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
// 查询角色有关的用户部门
// List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
List<Long> agentDeptIds = new ArrayList<>();
agentDeptIds.add(sysUser.getDeptId());
caseApplication.setAgentDeptIds(agentDeptIds);
}
caseApplications = caseApplicationMapper.list(caseApplication,caseStatusList, roleNames);
setArbitorMethod(caseApplications);
return caseApplications;
}
/**
* 设置仲裁方式
* @param caseApplications
*/
private void setArbitorMethod(List<CaseApplication> caseApplications) {
if(CollectionUtil.isEmpty(caseApplications)){
return;
}
for(CaseApplication caseApplicationsel : caseApplications){
Integer caseStatus = caseApplicationsel.getCaseStatus();
if(caseStatus.intValue() == CaseApplicationConstants.CHECK_ARBITRATION_METHOD){
Integer applicantIsWrittenHear = caseApplicationsel.getApplicantIsWrittenHear();
Integer respondentIsWrittenHear = caseApplicationsel.getRespondentIsWrittenHear();
if(applicantIsWrittenHear!=null&&respondentIsWrittenHear!=null){
if(applicantIsWrittenHear.intValue()==respondentIsWrittenHear.intValue()){
caseApplicationsel.setArbitraMethodIssame(1);
if(applicantIsWrittenHear.intValue()==1&&respondentIsWrittenHear.intValue()==1){
caseApplicationsel.setArbitratMethod(2);
}else {
caseApplicationsel.setArbitratMethod(1);
}
}else {
caseApplicationsel.setArbitraMethodIssame(2);
String applicantarbitratMethod = "";
String respondentbitratMethod = "";
if(applicantIsWrittenHear.intValue()==1){
applicantarbitratMethod = "书面审理";
}else {
applicantarbitratMethod = "开庭审理";
}
if(respondentIsWrittenHear.intValue()==1){
respondentbitratMethod = "书面审理";
}else {
respondentbitratMethod = "开庭审理";
}
String arbitratMethodIllustrate = "当前案件开庭方式:申请人选择开庭方式为"+applicantarbitratMethod+
"被申请人选择开庭方式为"+respondentbitratMethod+",请确定开庭方式。";
caseApplicationsel.setArbitratMethodIllustrate(arbitratMethodIllustrate);
}
}
}
}
}
@Override
public ToDoCount selectToDoCount() {
// // 获取登录用户
// LoginUser loginUser = getLoginUser();
// SysUser user = loginUser.getUser();
// Long userId = user.getUserId();
//
// // 查询登录人信息
// SysUser sysUser = sysUserMapper.selectUserById(userId);
// List<SysRole> roles = sysUser.getRoles();
// // 没有角色不能查看案件列表
// if (CollectionUtil.isEmpty(roles)) {
// throw new ServiceException("该用户没有角色权限");
// }
// CaseApplication caseApplication = new CaseApplication();
// List<Integer> caseStatusList = new ArrayList<>();
// for (SysRole role : roles) {
// if (StrUtil.isEmpty(role.getRoleName())) {
// continue;
// }
// // 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
// if (role.getRoleName().equals("超级管理员")
// ) {
// return caseApplicationMapper.selectAdminCaseToDoCount();
// }
// if ("仲裁委".equals(role.getRoleName())
// || "部门长".equals(role.getRoleName())) {
// caseApplication.setIsOtherRole(1);
// caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
// caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION);
// // caseStatusList.add(CaseApplicationConstants.ARBITRATED_SEAL);
// caseApplication.setDeptHeadStatus(caseStatusList);
// }
// if ("仲裁员".equals(role.getRoleName())) {
// caseApplication.setIsOtherRole(1);
// caseApplication.setUserId(String.valueOf(userId));
// }
// if ("财务".equals(role.getRoleName())) {
// caseApplication.setIsOtherRole(1);
// caseApplication.setFinanceStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
// }
// if ("法律顾问".equals(role.getRoleName())) {
// // 查询角色有关的用户部门
// // List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
// List<Long> deptIds = new ArrayList<>();
// deptIds.add(sysUser.getDeptId());
// caseApplication.setDeptIds(deptIds);
// }
// if ("申请人".equals(role.getRoleName())) {
// caseApplication.setIsOtherRole(1);
// // 查询角色有关的用户部门
// caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
// }
// if ("被申请人".equals(role.getRoleName())) {
// caseApplication.setIsOtherRole(1);
// //
// caseApplication.setIdCard(String.valueOf(sysUser.getIdCard()));
// }
// if ("代理人".equals(role.getRoleName())) {
// caseApplication.setIsOtherRole(1);
// // 查询角色有关的用户部门
// // List<Long> agentDeptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
// List<Long> agentDeptIds = new ArrayList<>();
// agentDeptIds.add(sysUser.getDeptId());
// caseApplication.setAgentDeptIds(agentDeptIds);
// }
// }
//
//
// // 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
// ToDoCount toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication);
// if (toDoCount == null) {
// return new ToDoCount();
// }
LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser();
Long userId = user.getUserId();
// 查询登录人,根据邮箱查询
SysUser sysUser = sysUserMapper.selectUserById(userId);
if(sysUser==null){
throw new ServiceException("未获取到登录用户信息");
}
// 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
ToDoCount toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication);
if (toDoCount == null) {
return new ToDoCount();
List<SysRole> roles = sysUser.getRoles();
// 没有角色不能查看案件列表
if (CollectionUtil.isEmpty(roles)) {
throw new ServiceException("该用户没有角色权限");
}
List<Integer> caseStatusList = new ArrayList<>();
List<String> roleNames = roles.stream().map(SysRole::getRoleName).collect(Collectors.toList());
ToDoCount toDoCount=null;
CaseApplication caseApplication = new CaseApplication();
for (SysRole role : roles) {
if(StrUtil.isEmpty(role.getRoleName())){
continue;
}
// 查看所有权限
if("超级管理员".equals(role.getRoleName())){
toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication,caseStatusList,null);
if(toDoCount==null){
toDoCount=new ToDoCount();
}
return toDoCount;
}
caseApplication.setLoginUserName(sysUser.getUserName());
caseApplication.setLoginUserPhone(sysUser.getPhonenumber());
if("申请人".equals(role.getRoleName())){
// 申请人在生成裁决书之前都可以修改案件
Integer[] array = {0,-1,1,2,3,4,5,6,7,8,9,10,31};
caseStatusList.addAll(Arrays.asList(array));
}
if("被申请人".equals(role.getRoleName())) {
// 案件质证,开庭审理,书面审理
caseStatusList.add(4);
caseStatusList.add(8);
caseStatusList.add(9);
}
if("仲裁员".equals(role.getRoleName())){
Integer[] array = {7,8,9,13,18};
caseStatusList.addAll(Arrays.asList(array));
caseApplication.setArbitratorId(String.valueOf(sysUser.getUserId()));
}
if ("仲裁委".equals(role.getRoleName())
|| "部门长".equals(role.getRoleName())) {
// 组庭确定,部门长审核裁决书
caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
caseStatusList.add(CaseApplicationConstants.CHECK_ARBITRATION);
}
if ("财务".equals(role.getRoleName())) {
caseStatusList.add(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
}
if ("法律顾问".equals(role.getRoleName()) || "秘书".equals(role.getRoleName()) ) {
Integer[] array = {1,5,8,9,11,14,15,16,31};
caseStatusList.addAll(Arrays.asList(array));
}
}
toDoCount = caseApplicationMapper.selectTodoCountByRole(caseApplication,caseStatusList,roleNames);
if(toDoCount==null){
toDoCount=new ToDoCount();
}
return toDoCount;
}
@@ -456,6 +649,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseLogRecord.setCaseAppliId(id);
List<CaseLogRecord> records = caseLogRecordMapper.selectCaseLogRecordList(caseLogRecord);
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
// 当前案件节点
Integer caseStatus = caseApplicationselect.getCaseStatus();
if (caseStatus.intValue() != 0) {
CaseLogRecord caseLogRecordin = getInCasenode(caseStatus);
@@ -733,7 +927,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
CaseLogRecord caseLogRecord9 = new CaseLogRecord();
caseLogRecord8.setCaseNode(9);
caseLogRecord8.setCaseNodeName("开庭审理");
caseLogRecord8.setContent("仲裁员将进行开庭审理");
caseLogRecord8.setContent("仲裁员,申请人,被申请人,法律顾问将进行开庭审理");
CaseLogRecord caseLogRecord11 = new CaseLogRecord();
caseLogRecord9.setCaseNode(11);
caseLogRecord9.setCaseNodeName("书面审理");
@@ -758,7 +952,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseLogRecord15.setCaseNode(16);
caseLogRecord15.setCaseNodeName("裁决书送达");
caseLogRecord15.setContent("法律顾问将进行裁决书送达");
CaseLogRecord caseLogRecord17 = new CaseLogRecord();
caseLogRecord16.setCaseNode(17);
caseLogRecord16.setCaseNodeName("案件归档");
caseLogRecord16.setContent("法律顾问将进行案件归档");
@@ -1021,8 +1214,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseLogRecord.setContent("法律顾问正在进行案件归档");
break;
default:
caseLogRecord.setCaseNodeName("无案件状态");
caseLogRecord.setContent("无操作内容");
caseLogRecord.setCaseNodeName("");
caseLogRecord.setContent("");
}
return caseLogRecord;
@@ -1416,11 +1609,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
maxVersion = 1;
}
caseApplication.setVersion(maxVersion + 1);
LoginUser loginUser = getLoginUser();
// 异步新增案件日志
ThreadPoolUtil.execute(() -> {
try {
//新增案件日志记录
insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_EDIT, "修改案件信息");
insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_EDIT, "修改案件信息",loginUser);
caseApplication.setCaseAppliId(caseApplication.getId());
caseApplication.setCaseLogId(IdWorkerUtil.getId());
int insertRow = caseApplicationLogMapper.insert(caseApplication);
@@ -1723,6 +1917,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplicationselect.setArbitrateRecord(arbitrateRecordselect);
if(arbitrateRecordselect!=null){
caseApplicationselect.setPayRejectReason(arbitrateRecordselect.getPayRejectReason());
// 仲裁员审核驳回原因
caseApplicationselect.setArbitrateReject(arbitrateRecordselect.getArbitrateReject());
}
}
@@ -1877,43 +2073,30 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Override
@Transactional
public AjaxResult pendTralCheck(CaseApplication caseApplication) {
// todo 需要传仲裁员id
Integer isAgreePendTral = caseApplication.getIsAgreePendTral();
caseApplication.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
int rows = 0;
//同意组庭
if (isAgreePendTral != null && isAgreePendTral == 1) {
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
if(caseApplicationselect==null){
throw new ServiceException("案件不存在");
}
String arbitratorId = caseApplicationselect.getArbitratorId();
String arbitratorName = caseApplicationselect.getArbitratorName();
List<Arbitrator> arbitrators = caseApplication.getArbitrators();
if(arbitrators != null && arbitrators.size() > 0 && StringUtils.isEmpty(arbitratorId) && StringUtils.isEmpty(arbitratorName)){
List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
List<String> arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList());
String idstr = ids.stream().map(Object::toString).collect(Collectors.joining(","));
String arbitratorNamestr = arbitratorNames.stream().map(Object::toString).collect(Collectors.joining(","));
caseApplication.setArbitratorId(idstr);
caseApplication.setArbitratorName(arbitratorNamestr);
caseApplication.setLockStatus(1);
rows = caseApplicationMapper.submitCaseApplication(caseApplication);
}
} else {
List<Arbitrator> arbitrators = caseApplication.getArbitrators();
// 仲裁员信息
if (arbitrators != null && arbitrators.size() > 0) {
List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
List<String> arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList());
String idstr = ids.stream().map(Object::toString).collect(Collectors.joining(","));
String arbitratorNamestr = arbitratorNames.stream().map(Object::toString).collect(Collectors.joining(","));
caseApplication.setArbitratorId(idstr);
caseApplication.setArbitratorName(arbitratorNamestr);
caseApplication.setLockStatus(1);
rows = caseApplicationMapper.submitCaseApplication(caseApplication);
}
}
caseApplication.setLockStatus(1);
rows = caseApplicationMapper.submitCaseApplication(caseApplication);
// List<Arbitrator> arbitrators = caseApplication.getArbitrators();
// if( StringUtils.isEmpty(arbitratorId) && StringUtils.isEmpty(arbitratorName)){
// List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
// List<String> arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList());
// String idstr = ids.stream().map(Object::toString).collect(Collectors.joining(","));
// String arbitratorNamestr = arbitratorNames.stream().map(Object::toString).collect(Collectors.joining(","));
// caseApplication.setArbitratorId(idstr);
// caseApplication.setArbitratorName(arbitratorNamestr);
// caseApplication.setLockStatus(1);
// rows = caseApplicationMapper.submitCaseApplication(caseApplication);
// }
// 新增日志
insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL, "");
return success();
@@ -164,21 +164,6 @@ public class CaseZipImportImpl {
}
File[] files = directory.listFiles();
// List<CaseApplication> caseApplications = new ArrayList<>();
// for (File file1 : files) {
// if (file1.isDirectory() && file1.listFiles() != null) {
//
// for (File file2 : file1.listFiles()) {
// CaseApplication caseApplication = buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, deptMap, SecurityUtils.getLoginUser());
// if (caseApplication != null) {
// caseApplications.add(caseApplication);
// }
// }
// }
// }
// if(caseApplications.size()>0){
// return success("导入成功");
// }
CaseZipImportTask caseZipImportTask = null;
try {
caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchRuleMap, userMap, dictDataList, files , deptMap, SecurityUtils.getLoginUser());
@@ -318,6 +303,8 @@ public class CaseZipImportImpl {
ThreadPoolUtil.execute(() -> {
try {
caseApplicationMapper.insertCaseApplication(caseApplication);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
caseApplicationLogMapper.insert(caseApplication);
// 多线程执行
if (CollectionUtil.isNotEmpty(addUsers)) {
@@ -347,28 +334,7 @@ public class CaseZipImportImpl {
columnValueMapper.batchSave(columnValueList);
columnValueLogMapper.batchSave(columnValueList);
}
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
// 发送短信
// if (CollectionUtil.isNotEmpty(smsRequestList)) {
// Map<Long, SmsSendRecord> sendRecordMap = null;
// if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
// sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
// for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
// Boolean aBoolean = SmsUtils.sendSms(request);
// if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
// if (aBoolean) {
// sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
// } else {
// sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
// }
// }
// }
// smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
// }
//
//
// }
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("导入失败,请检查抓取规则是否正确");