申请书

This commit is contained in:
18792927508
2024-01-22 15:08:25 +08:00
parent 4ad79ff910
commit e2f956beac
4 changed files with 206 additions and 25 deletions
@@ -0,0 +1,53 @@
package com.ruoyi.wisdomarbitrate.domain.entity.mscase;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 案件预约表
*/
@Getter
@Setter
@ToString
@Table(name = "ms_case_mediator")
public class MsCaseMediator {
@Id
@GeneratedValue(generator = "JDBC")
private Long id;
/**
* 案件主表id
*/
@Column(name = "case_appli_id")
private Long caseAppliId;
/**
* 调解员id
*/
@Column(name = "mediator_id")
private String mediatorId;
/**
* 调解员名称
*/
@Column(name = "mediator_name")
private String mediatorName;
/**
* 调解时间
*/
@Column(name = "hear_date")
private String hearDate;
/**
* 身份类别,1申请人,2被申请人
*/
@Column(name = "type")
private Integer type;
}
@@ -38,4 +38,8 @@ public class BookingVO {
* 批次
*/
private String batchNumber;
/**
* 是否被申请人,1-被申请人,空为申请人
*/
private Integer miniProgressFlag;
}
@@ -0,0 +1,10 @@
package com.ruoyi.wisdomarbitrate.mapper.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseMediator;
import tk.mybatis.mapper.common.Mapper;
/**
* 案件预约表
*/
public interface MsCaseMediatorMapper extends Mapper<MsCaseMediator> {
}
@@ -30,6 +30,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.mscase.SealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.dto.sendrecord.SmsSendRecord;
import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.*;
import com.ruoyi.wisdomarbitrate.domain.entity.dept.MsSealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
@@ -121,6 +122,8 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
@Autowired
private MsCaseLogRecordMapper caseLogRecordMapper;
@Autowired
private MsCaseMediatorMapper msCaseMediatorMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private DeptIdentifyMapper deptIdentifyMapper;
@@ -300,6 +303,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
columnValueMapper.batchSave(columnValueList);
}
// todo 发送短信
CaseLogUtils.insertCaseLog(caseApplication.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "");
return 1;
}
@@ -584,9 +588,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 案件ids
List<Long> caseIds = caseApplicationList.stream().map(MsCaseApplication::getId).collect(Collectors.toList());
// 根据ids查询案件关联人员
Example afflicateExample = new Example(MsCaseFlow.class);
Example afflicateExample = new Example(MsCaseAffiliate.class);
afflicateExample.createCriteria().andIn("case_appli_id", caseIds);
List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(caseIds);
List<MsCaseAffiliate> affiliateList = msCaseAffiliateMapper.selectByExample(afflicateExample);
if(CollectionUtil.isEmpty(affiliateList)){
throw new ServiceException("该批次号下未找到案件关联人员");
}
@@ -628,11 +632,11 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
*/
public List<MsCaseApplication> listByBatchNumber(String batchNumber,Integer caseFlowId) {
Example example = new Example(MsCaseFlow.class);
example.createCriteria().andEqualTo("batch_number", batchNumber);
example.createCriteria().andEqualTo("lock_status", 0);
Example example = new Example(MsCaseApplication.class);
example.createCriteria().andEqualTo("batchNumber", batchNumber);
example.createCriteria().andEqualTo("lockStatus", 0);
if(caseFlowId!=null){
example.createCriteria().andEqualTo("case_flow_id",caseFlowId);
example.createCriteria().andEqualTo("caseFlowId",caseFlowId);
}
return msCaseApplicationMapper.selectByExample(example);
@@ -749,10 +753,12 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
}
for (MsCaseApplication application : list) {
MsCaseFlow caseFlow = nextFlow(application.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
// todo 发送短信
CaseLogUtils.insertCaseLog(application.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
}
}else {
MsCaseFlow caseFlow = nextFlow(req.getId(), req.getCaseFlowId(), YesOrNoEnum.NO.getCode());
// todo 发送短信
CaseLogUtils.insertCaseLog(req.getId(), caseFlow.getNodeId(), caseFlow.getCaseStatusName(), "提交成功");
}
@@ -804,8 +810,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
return AjaxResult.success(mediatorVOS);
}
@Transactional
@Override
public AjaxResult updateBooking(BookingVO vo) {
public AjaxResult updateBooking1(BookingVO vo) {
// 查询被申请人是否预约过(从日志表查),否则不更新流程节点
MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId());
if(msCaseAffiliate==null) {
@@ -818,7 +823,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
if(applicantCount<1){
return AjaxResult.error("保存失败");
}
// 新增申请人签署日志
// 查询当前节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId());
if(currentFlow==null){
return AjaxResult.error("当前流程不存在");
@@ -848,18 +853,113 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setCaseStatusName(nextFlow.getCaseStatusName());
application.setLockStatus(null);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// todo 发送短信
}
// else {
// return AjaxResult.error("被申请人未选择调解员");
// }
}
// else {
// return AjaxResult.error("被申请人未选择调解员");
// }
}
return AjaxResult.success();
}
/**
* 申请人/被申请人预约
* @param vo
* @return
*/
@Transactional
public AjaxResult updateBooking(BookingVO vo) {
// 查询案件相关人员
MsCaseAffiliate msCaseAffiliate = msCaseAffiliateMapper.selectByPrimaryKey(vo.getId());
if (msCaseAffiliate == null) {
return AjaxResult.error("该案件不存在");
}
// 查询当前节点
MsCaseFlow currentFlow = caseFlowMapper.selectByPrimaryKey(vo.getCaseFlowId());
if (currentFlow == null) {
return AjaxResult.error("当前流程不存在");
}
// 新增案件预约表
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);
// 申请人预约
if (vo.getMiniProgressFlag() == null) {
// 新增日志
CaseLogUtils.insertCaseLog(vo.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "申请人选择调解员");
if (StrUtil.isEmpty(msCaseAffiliate.getRespondentIdentityNum())) {
return AjaxResult.error("被申请人身份证为空");
}
SysUser user = userMapper.selectUserByIdCard(msCaseAffiliate.getRespondentIdentityNum());
// 被申请人存在
if (user != null) {
// 判断被申请人信息查询案件预约表
isReservation( vo,user);
}
} else {
// 被申请人预约
// 新增日志
CaseLogUtils.insertCaseLog(vo.getId(), currentFlow.getNodeId(), currentFlow.getCaseStatusName(), "被申请人选择调解员");
if (StrUtil.isEmpty(msCaseAffiliate.getContactTelphoneAgent())) {
return AjaxResult.error("申请代理人手机号为空");
}
SysUser user = userMapper.selectUserByPhone(msCaseAffiliate.getContactTelphoneAgent());
if(user!=null){
// 判断申请人是否预约
isReservation( vo,user);
}
}
return AjaxResult.success();
}
/**
* 判断申请人/被申请人是否预约
* @param vo
* @param user
*/
private void isReservation( BookingVO vo, SysUser user) {
Example example = new Example(MsCaseMediator.class);
Example.Criteria criteria = example.createCriteria();
if(vo.getMiniProgressFlag() == null) {
// 申请人预约,需要查询被申请人是否预约,identity_type不为空
criteria.andIsNotNull("type");
}else {
// 被申请人预约,需要查询申请人是否预约,identity_type为空
criteria.andIsNull("type");
}
criteria.andEqualTo("caseAppliId", vo.getId());
criteria.andEqualTo("mediatorId", user.getUserId());
int count = msCaseMediatorMapper.selectCountByExample(example);
if (count > 0) {
// 申请人已预约,更新主表流程节点
MsCaseFlow nextFlow = caseFlowMapper.nextFlow(vo.getCaseFlowId());
if (nextFlow == null) {
throw new ServiceException("未找到下一个流程");
}
MsCaseApplication application = new MsCaseApplication();
application.setId(vo.getId());
application.setCaseFlowId(nextFlow.getId());
application.setCaseStatusName(nextFlow.getCaseStatusName());
application.setLockStatus(null);
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// 新增日志
if(vo.getMiniProgressFlag() == null) {
CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "申请人选择调解员");
}else {
CaseLogUtils.insertCaseLog(vo.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "被申请人选择调解员");
}
// todo 发送短信
}
}
/**
* 设置调解员调解时间
* @param application
@@ -912,16 +1012,27 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
*/
@Override
public AjaxResult selectReservation(Long id) {
MsCaseApplication caseApplication = msCaseApplicationMapper.selectByPrimaryKey(id);
if(caseApplication == null){
return AjaxResult.error("该案件不存在");
}
BookingVO result = new BookingVO();
// 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);
if(msCaseMediator==null){
return AjaxResult.success(result);
}
// if(caseApplication == null){
// return AjaxResult.error("该案件不存在");
// }
// 调解员是一个的处理
if( StrUtil.isNotEmpty(caseApplication.getMediatorId()) && StrUtil.isNotEmpty(caseApplication.getMediatorName())){
if( StrUtil.isNotEmpty(msCaseMediator.getMediatorId()) && StrUtil.isNotEmpty(msCaseMediator.getMediatorName())){
// 查询用户
SysUser user = userMapper.selectUserById(Long.valueOf(caseApplication.getMediatorId()));
SysUser user = userMapper.selectUserById(Long.valueOf(msCaseMediator.getMediatorId()));
if(user==null){
return AjaxResult.error("调解员已被删除");
}
@@ -959,9 +1070,9 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
mediatorVOS.add(mediatorVO);
result.setMediatorList(mediatorVOS);
}
if(StrUtil.isNotEmpty(caseApplication.getHearDate())){
if(StrUtil.isNotEmpty(msCaseMediator.getHearDate())){
List<String> herdates = new ArrayList<>();
herdates.add(caseApplication.getHearDate());
herdates.add(msCaseMediator.getHearDate());
result.setHerDates(herdates);
}
return AjaxResult.success(result);
@@ -979,7 +1090,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 批量
if(StrUtil.isNotEmpty(req.getBatchNumber())){
// 查询调解书模板是否存在
Example example = new Example(MsCaseFlow.class);
Example example = new Example(MsCaseApplication.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("batch_number", req.getBatchNumber());
criteria.andIsNotNull("template_id");
@@ -1036,6 +1147,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
msCaseAttachMapper.deleteCaseAttachByCasedIdAndType(attach.getCaseAppliId(),AnnexTypeEnum.MEDIATE_BOOK.getCode());
msCaseAttachMapper.updateCaseAttach(attach);
}
// todo 发送短信
// 更新流程节点
nextFlow(attach.getCaseAppliId(),attach.getCaseFlowId(),YesOrNoEnum.YES.getCode());
@@ -1328,6 +1440,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
application.setCaseFlowId(nextFlow.getNodeId());
application.setCaseStatusName(nextFlow.getCaseStatusName());
msCaseApplicationMapper.updateByPrimaryKeySelective(application);
// todo 发送短信
// 新增日志
CaseLogUtils.insertCaseLog(application.getId(), nextFlow.getNodeId(), nextFlow.getCaseStatusName(), "");
@@ -1470,6 +1583,7 @@ public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
// 生成调解书成功,需要更新流程节点
if (templateType!=null&&templateType==1) {
nextFlow(application.getId(), application.getCaseFlowId(), application.getLockStatus());
// todo 发送短信
}
}