Merge branch 'qtz5' of SH-Arbitrate/Arbitrate-Backend into dev

This commit was merged in pull request #329.
This commit is contained in:
qtz
2024-01-05 16:35:11 +08:00
committed by Gitea
3 changed files with 223 additions and 1 deletions
@@ -42,7 +42,7 @@ public class AdjudicationController extends BaseController {
/** /**
* 根据批号查询批量签名链接 * 根据批号查询批量签名链接
*/ */
@PostMapping("/selectBatchSignUrl") @PostMapping("/getSignUrlBatch")
public AjaxResult getSignUrlBatch(@RequestBody StringIdsReq idsReq) { public AjaxResult getSignUrlBatch(@RequestBody StringIdsReq idsReq) {
if(StrUtil.isEmpty(idsReq.getBatchNumber().toString())|| StrUtil.isEmpty(idsReq.getPsnAccount())){ if(StrUtil.isEmpty(idsReq.getBatchNumber().toString())|| StrUtil.isEmpty(idsReq.getPsnAccount())){
return error("参数校验失败"); return error("参数校验失败");
@@ -170,6 +170,19 @@ public class AdjudicationController extends BaseController {
return adjudicationService.caseFile(batchCaseApplication.getIds()); return adjudicationService.caseFile(batchCaseApplication.getIds());
} }
/**
* 批量归档(暂时只改案件状态)
* @param batchCaseApplication
* @return
*/
@PostMapping("/caseFileBatch")
public AjaxResult caseFileBatch(@RequestBody CaseApplication caseApplication){
if(StrUtil.isEmpty(caseApplication.getBatchNumber().toString())){
return error("参数校验失败");
}
return adjudicationService.caseFileBatch(caseApplication.getBatchNumber());
}
/** /**
* 送达(不包含发送电子邮件) * 送达(不包含发送电子邮件)
* @param bookSendVO * @param bookSendVO
@@ -180,6 +193,20 @@ public class AdjudicationController extends BaseController {
public AjaxResult service(@RequestBody BookSendVO bookSendVO){ public AjaxResult service(@RequestBody BookSendVO bookSendVO){
return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum()); return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum());
} }
/**
* 批量送达仲裁书
* @param caseApplication
* @return
*/
@PostMapping("/serviceBatch")
public AjaxResult serviceBatch( CaseApplication caseApplication){
if(StrUtil.isEmpty(caseApplication.getBatchNumber().toString())){
return error("参数校验失败");
}
return adjudicationService.serviceBatch(caseApplication.getBatchNumber());
}
/** /**
* 用印(暂时只改案件状态) * 用印(暂时只改案件状态)
* @param caseApplication * @param caseApplication
@@ -61,4 +61,8 @@ public interface IAdjudicationService {
SealSignRecord getSignUrlBatch(StringIdsReq idsReq); SealSignRecord getSignUrlBatch(StringIdsReq idsReq);
SealSignRecord getSealUrlBatch(StringIdsReq idsReq); SealSignRecord getSealUrlBatch(StringIdsReq idsReq);
AjaxResult caseFileBatch(Integer batchNumber);
AjaxResult serviceBatch(Integer batchNumber);
} }
@@ -744,6 +744,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
} }
@Override @Override
@Transactional
public AjaxResult signature(CaseApplication caseApplication) { public AjaxResult signature(CaseApplication caseApplication) {
//更改案件状态(暂时) //更改案件状态(暂时)
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL); caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
@@ -755,6 +756,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
} }
@Override @Override
@Transactional
public AjaxResult caseFile(List<Long> ids) { public AjaxResult caseFile(List<Long> ids) {
try { try {
for (Long id : ids) { for (Long id : ids) {
@@ -1529,6 +1531,195 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
return signRecord; return signRecord;
} }
@Override
@Transactional
public AjaxResult caseFileBatch(Integer batchNumber) {
CaseApplication caseApplicationsel = new CaseApplication();
caseApplicationsel.setBatchNumber(batchNumber);
caseApplicationsel.setCaseStatus(CaseApplicationConstants.CASE_FILING);
List<CaseApplication> caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
if (caseApplications1 != null && caseApplications1.size() > 0) {
List<Long> ids = caseApplications1.stream().map(CaseApplication::getId).collect(Collectors.toList());
try {
for (Long id : ids) {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
//更改案件状态(暂时)
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_ARCHIVED);
caseApplicationMapper.submitCaseApplication(caseApplication);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_ARCHIVED, "");
}
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}else{
throw new ServiceException("这个批号没有批量归档的案件");
}
return AjaxResult.success("归档成功");
}
@Override
@Transactional
public AjaxResult serviceBatch(Integer batchNumber) {
CaseApplication caseApplicationsel = new CaseApplication();
caseApplicationsel.setBatchNumber(batchNumber);
caseApplicationsel.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
List<CaseApplication> caseApplications1 = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
if (caseApplications1 != null && caseApplications1.size() > 0) {
List<Long> ids = caseApplications1.stream().map(CaseApplication::getId).collect(Collectors.toList());
for (Long id : ids) {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
if (caseApplication1 == null) {
return AjaxResult.error("未查询到相关案件");
}
List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication1);
if (caseAttachList != null && caseAttachList.size() > 0) {
for (CaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == 3) {
String annexName = caseAttach.getAnnexName();
String prefix = "/profile/upload/";
int startIndex = prefix.length();
String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
File file = new File(path);
// todo 部署放开
if (!file.exists()) {
return AjaxResult.error("未生成裁决书");
}
}
}
}
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.CASE_FILING);
caseApplicationMapper.submitCaseApplication(caseApplication1);
String appEmail = "";
String resEmail = "";
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(id);
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if (caseAffiliates != null && caseAffiliates.size() > 0) {
for (CaseAffiliate affiliate : caseAffiliates) {
if (affiliate.getIdentityType() == 1) { //申请人
appEmail = affiliate.getSendEmail();
} else {
resEmail = affiliate.getSendEmail();
}
}
}
//申请人发送邮件
boolean appEmailFlag = sendCaseEmail(caseApplication1, appEmail, caseAttachList);
SendMailRecord sendMailRecord = new SendMailRecord();
sendMailRecord.setCaseId(id);
sendMailRecord.setMailAddress(appEmail);
sendMailRecord.setMailContent("您好,审核后的裁决书在附件中请查阅");
// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
sendMailRecord.setMailName("签署后的裁决书");
sendMailRecord.setSendTime(new Date());
sendMailRecord.setCreateBy(getUsername());
if (appEmailFlag) {
sendMailRecord.setSendStatus(1);
} else {
sendMailRecord.setSendStatus(0);
}
sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
// 被申请人发送邮件
boolean resEmailFlag = sendCaseEmail(caseApplication1, resEmail, caseAttachList);
SendMailRecord sendMailRecord1 = new SendMailRecord();
sendMailRecord1.setCaseId(id);
sendMailRecord1.setMailAddress(resEmail);
// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
sendMailRecord1.setMailContent("您好,审核后的裁决书在附件中请查阅");
sendMailRecord1.setMailName("签署后的裁决书");
sendMailRecord1.setSendTime(new Date());
sendMailRecord1.setCreateBy(getUsername());
if (resEmailFlag) {
sendMailRecord1.setSendStatus(1);
}else {
sendMailRecord1.setSendStatus(0);
}
sendMailRecordMapper.saveSendMailRecord(sendMailRecord1);
if(!appEmailFlag&&!resEmailFlag){
throw new ServiceException("裁决书发送失败");
}
if(!appEmailFlag){
throw new ServiceException("申请人裁决书发送失败");
}
if(!resEmailFlag){
throw new ServiceException("被申请人裁决书发送失败");
}
// 发送短信
if (appEmailFlag||resEmailFlag) {
if (CollectionUtil.isNotEmpty(caseAffiliates)) {
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1990362");
for (CaseAffiliate affiliate : caseAffiliates) {
String telphone=null;
if(appEmailFlag&&affiliate.getIdentityType()==1){
telphone = affiliate.getContactTelphone();
}else if(resEmailFlag&&affiliate.getIdentityType()==2){
telphone = affiliate.getContactTelphone();
}
if(StrUtil.isEmpty(telphone)){
continue;
}
request.setPhone(telphone);
// if(affiliate.getIdentityType() == 1) {
// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), appEmail});
// }else {
// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), resEmail});
// }
request.setTemplateParamSet(new String[]{affiliate.getName(), caseApplication1.getCaseNum()});
Boolean aBoolean = SmsUtils.sendSms(request);
// 保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord();
smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId());
smsSendRecord.setCaseNum(caseApplication1.getCaseNum());
smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date());
// // 尊敬的{1}用户,您的{2}仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。
// if(affiliate.getIdentityType() == 1) {
// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +appEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。");
// }else {
// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +resEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。");
// }
smsSendRecord.setSendContent("尊敬的" + affiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。");
smsSendRecord.setCreateBy(getUsername());
if (aBoolean) {
smsSendRecord.setSendStatus(1);
} else {
smsSendRecord.setSendStatus(0);
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
}
}
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication1.getId(), CaseApplicationConstants.CASE_FILING, "");
}
}
}else{
throw new ServiceException("这个批号没有批量送达裁决书的案件");
}
return AjaxResult.success("仲裁文书送达成功");
}
/** /**
* 根据仲裁员手机号分页查询等待签署,签署中的裁决书 * 根据仲裁员手机号分页查询等待签署,签署中的裁决书
* *