调解系统初始化版本
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
|
||||
|
||||
/**
|
||||
* @author wangqiong
|
||||
* @description 案件日志
|
||||
* @date 2023-11-17 13:58
|
||||
*/
|
||||
public interface CaseApplicationLogService {
|
||||
/**
|
||||
* 新增案件日志
|
||||
* @param caseApplicationLog
|
||||
* @return
|
||||
*/
|
||||
int insert(CaseApplication caseApplicationLog);
|
||||
|
||||
/**
|
||||
* 根据案件日志id删除案件日志
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int delete(Long id);
|
||||
|
||||
/**
|
||||
* 根据案件id和版本号查询案件日志
|
||||
* @param id
|
||||
* @param version
|
||||
* @return
|
||||
*/
|
||||
CaseApplication selectByCaseIdAndVersion(Long id, int version);
|
||||
|
||||
/**
|
||||
* 修改的案件提交到秘书
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult submit(UpdateSubmitVO vo);
|
||||
|
||||
/**
|
||||
* 修改撤销申请
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult revoke(UpdateSubmitVO vo);
|
||||
|
||||
/**
|
||||
* 秘书审核修改的案件
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult updateAudit(UpdateSubmitVO vo);
|
||||
|
||||
|
||||
AjaxResult selectCompareCase(UpdateSubmitVO vo);
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.StringIdsReq;
|
||||
import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IAdjudicationService {
|
||||
AjaxResult createDocument(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail ,String apptrackingNum,String restrackingNum);
|
||||
|
||||
List<LogisticsInfoVO> getLogisticsInfo(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult signature(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult caseFile( List<Long> ids);
|
||||
|
||||
AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum);
|
||||
|
||||
AjaxResult stamp(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult getArchivesDetail(Long id);
|
||||
|
||||
AjaxResult regenerationDocument(CaseApplication caseApplication);
|
||||
|
||||
/**
|
||||
* 根据案件id查询邮箱
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
AjaxResult emailByCaseId(Long id);
|
||||
|
||||
/**
|
||||
* 批量生成裁决书
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
AjaxResult batchDocument(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据签署流程id查询批量签名链接
|
||||
* @param idsReq
|
||||
* @return
|
||||
*/
|
||||
SealSignRecord selectBatchSignUrl( StringIdsReq idsReq);
|
||||
|
||||
/**
|
||||
* 根据仲裁员手机号分页查询等待签署,签署中的裁决书
|
||||
* @param personAccount
|
||||
* @return
|
||||
*/
|
||||
List<CaseApplication> selectSealSigning(String personAccount,Integer caseStatus);
|
||||
|
||||
SealSignRecord selectBatchSealUrl(StringIdsReq idsReq);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IArbitratorService {
|
||||
List<Arbitrator> selectArbitratorList(Arbitrator arbitrator);
|
||||
|
||||
|
||||
|
||||
}
|
||||
+154
@@ -0,0 +1,154 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.exception.EsignDemoException;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ICaseApplicationService {
|
||||
List<CaseApplication> selectCaseApplicationList(CaseApplication caseApplication);
|
||||
List<CaseApplication> selectCaseApplicationListByRole(CaseApplication caseApplication);
|
||||
|
||||
|
||||
int insertcaseApplication(CaseApplication caseApplication);
|
||||
|
||||
int selectCaseApplicationCount(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult editCaseApplication(CaseApplication caseApplication);
|
||||
|
||||
int submitCaseApplication( List<Long> ids);
|
||||
|
||||
int deletecaseApplicationByIds(List<Long> ids);
|
||||
|
||||
CaseApplication selectCaseApplication(CaseApplication caseApplication);
|
||||
|
||||
String importCaseApplication(List<CaseApplication> caseApplicationList, String operName);
|
||||
|
||||
int pendTral(CaseApplication caseApplication);
|
||||
|
||||
int pendingAppointArbotrar(CaseApplication caseApplication);
|
||||
|
||||
int pendTralCheck(CaseApplication caseApplication);
|
||||
|
||||
int pendTralSure(CaseApplication caseApplication);
|
||||
|
||||
int verificationArbitrateRecord(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult checkArbitrateRecord(CaseApplication caseApplication);
|
||||
|
||||
int submitCaseApplicationCheck(List<Long> ids, Integer agreeOrNotCheck,String caseCheckReject);
|
||||
|
||||
CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication);
|
||||
|
||||
String sendRoomNoMessage(SendRoomNoMessageVO messageVO);
|
||||
|
||||
SealSignRecord selectSignUrl(CaseApplication caseApplication) throws EsignDemoException;
|
||||
|
||||
SealSignRecord selectSealUrl(CaseApplication caseApplication) throws EsignDemoException;
|
||||
|
||||
AjaxResult creatTrialRecord(ArbitrateRecord arbitrateRecord);
|
||||
|
||||
CaseApplication selectSignSealUrl(CaseApplication caseApplication) throws EsignDemoException;
|
||||
|
||||
/**
|
||||
* 查询待办数量
|
||||
* @return
|
||||
*/
|
||||
ToDoCount selectToDoCount();
|
||||
|
||||
AjaxResult selectCaseProgress(CaseApplication caseApplication);
|
||||
|
||||
int updateHeardate(CaseApplication caseApplication);
|
||||
|
||||
/**
|
||||
* 修改案件锁定状态
|
||||
* @param caseApplication
|
||||
* @return
|
||||
*/
|
||||
int updateCaseLockStatus(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult uploadZipFile(MultipartFile file, Long id, String username, Long userId);
|
||||
/**
|
||||
* 查询短信发送记录
|
||||
* @param smsSendRecord
|
||||
* @return
|
||||
*/
|
||||
List<SmsSendRecord> getSmsSendRecord(SmsSendRecord smsSendRecord);
|
||||
|
||||
/**
|
||||
* 获取userSign
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
String generateUserSign(String userId);
|
||||
|
||||
/**
|
||||
* 预约会议
|
||||
* @param reservedConferenceVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) throws Exception;
|
||||
|
||||
/**
|
||||
* 腾讯云销毁房间回调
|
||||
* @return
|
||||
*/
|
||||
long createRoomId(Long caseId);
|
||||
|
||||
/**
|
||||
* 根据案件id查询已预约的会议
|
||||
* @param caseId
|
||||
* @return
|
||||
*/
|
||||
List<ReservedConference> reserveConferenceList(Long caseId);
|
||||
|
||||
AjaxResult deleteRoom( String roomId);
|
||||
|
||||
AjaxResult uploadCaseZipFile(MultipartFile file,Long templateId);
|
||||
|
||||
/**
|
||||
* 根据附件id修改案件id
|
||||
* @param caseAttach
|
||||
* @return
|
||||
*/
|
||||
AjaxResult updateCaseIdByAnnexId(CaseAttach caseAttach);
|
||||
|
||||
/**
|
||||
* 仲裁员审核裁决书
|
||||
* @param caseApplication
|
||||
* @return
|
||||
*/
|
||||
AjaxResult arbitratorCheckArbitrateRecord(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult creatTrialRecordnew(ArbitrateRecord arbitrateRecord);
|
||||
|
||||
AjaxResult editCaseApplicationDefineval(CaseApplication caseApplication);
|
||||
|
||||
CaseAttach downloadCaseZipFile(CaseApplication caseApplication);
|
||||
|
||||
List<CaseApplication> selectCaseApplicationListBatchByRole(CaseApplication caseApplication);
|
||||
|
||||
int submitCaseApplicationBatch(String batchNumber);
|
||||
|
||||
int submitCaseApplicationCheckBatch(String batchNumber, Integer agreeOrNotCheck, String caseCheckReject);
|
||||
|
||||
int pendTralCheckBatch(CaseApplication caseApplication);
|
||||
|
||||
int pendTralSureBatch(CaseApplication caseApplication);
|
||||
|
||||
int verificationArbitrateRecordBatch(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult arbitratorCheckArbitrateRecordBatch(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult checkArbitrateRecordBatch(CaseApplication caseApplication);
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
|
||||
import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseIds;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICaseArbitrateService {
|
||||
|
||||
|
||||
AjaxResult writtenHear(CaseIds caseIds);
|
||||
|
||||
AjaxResult examineArbitrateMethod(CaseApplication caseApplication, Integer opinion, Integer arbitratMethod);
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseEvidenceDirectory;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.CaseEvidenceDTO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceDirectoryVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICaseEvidenceService {
|
||||
|
||||
AjaxResult getCaseDetailsById(Long id,String userName);
|
||||
|
||||
AjaxResult uploadEvidence(MultipartFile file, Integer annexType, Long id,String userName,Long userId);
|
||||
|
||||
List<CaseEvidenceVO> getCaseListAll(Integer caseStatus);
|
||||
|
||||
AjaxResult evidenceConfirmation(CaseApplication caseApplication);
|
||||
|
||||
AjaxResult caseCrossexamination(CaseEvidenceDTO caseEvidenceDTO);
|
||||
|
||||
/**
|
||||
* 批量上传文件
|
||||
* @param file
|
||||
* @param annexType
|
||||
* @param id
|
||||
* @param username
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
AjaxResult batchUpload(MultipartFile[] file, Integer annexType, Long id, String username, Long userId);
|
||||
|
||||
AjaxResult fileList(Long caseAppliId, List<Integer> annexTypeList);
|
||||
|
||||
int deleteFile( List<Integer> fileIds);
|
||||
|
||||
List<CaseEvidenceDirectoryVO> selectEvidenceTreeList(CaseEvidenceDirectory caseEvidenceDirectory);
|
||||
|
||||
|
||||
/**
|
||||
* 查询证据目录数据
|
||||
*
|
||||
* @param caseEvidenceDirectory 证据目录信息
|
||||
* @return 证据目录信息集合
|
||||
*/
|
||||
List<CaseEvidenceDirectory> selectCaseEvidenceList(CaseEvidenceDirectory caseEvidenceDirectory);
|
||||
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
* @param caseEvidenceDirectorys 证据列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
List<CaseEvidenceDirectory> buildCaseEvidenceTree(List<CaseEvidenceDirectory> caseEvidenceDirectorys);
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
* @param caseEvidenceDirectorys 证据目录列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
List<CaseEvidenceDirectoryVO> buildCaseEvidenceTreeSelect(List<CaseEvidenceDirectory> caseEvidenceDirectorys);
|
||||
|
||||
AjaxResult uploadRecord(MultipartFile file, Integer annexType, Long id, String username, Long userId);
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICaseLogRecordService {
|
||||
|
||||
|
||||
List<CaseLogRecord> selectCaseLogRecordList(CaseLogRecord caseLogRecord);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseNumRule;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICaseNumRuleService {
|
||||
AjaxResult insertCaseNumRule(CaseNumRule caseNumRule);
|
||||
|
||||
|
||||
AjaxResult updateCaseNumRule(CaseNumRule caseNumRule);
|
||||
|
||||
|
||||
AjaxResult deleteCaseNumRule(CaseNumRule caseNumRule);
|
||||
|
||||
List<CaseNumRule> selectCaseNumRule(CaseNumRule caseNumRule);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.dto.PayRequest;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ICasePaymentService {
|
||||
/**
|
||||
* 案件缴费
|
||||
*/
|
||||
AjaxResult casePay(CasePayDTO casePayDTO);
|
||||
|
||||
AjaxResult confirmPayment( List<Long> ids);
|
||||
|
||||
/**
|
||||
* 确认缴费
|
||||
* @param payDTO
|
||||
* @return
|
||||
*/
|
||||
AjaxResult confirmPay(CaseConfirmPayDTO payDTO);
|
||||
|
||||
|
||||
AjaxResult casePayList(CasePayDTO casePayDTO);
|
||||
|
||||
AjaxResult confirmPayBatch(CasePayDTO payDTO);
|
||||
|
||||
AjaxResult casePayListBatch(CasePayDTO casePayDTO);
|
||||
|
||||
AjaxResult confirmPaymentBatch(String batchNumber);
|
||||
|
||||
AjaxResult casePayBatch(CasePayDTO casePayDTO);
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.exception.EsignDemoException;
|
||||
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
|
||||
import com.ruoyi.wisdomarbitrate.domain.FatchRule;
|
||||
import com.ruoyi.wisdomarbitrate.domain.SealManage;
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManage;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IDeptIdentifyService {
|
||||
|
||||
|
||||
List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify);
|
||||
|
||||
|
||||
DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException;
|
||||
|
||||
AjaxResult enableDept(DeptIdentify deptIdentify);
|
||||
|
||||
AjaxResult sealUpload(Long id,String sealName ,MultipartFile file);
|
||||
|
||||
|
||||
AjaxResult receiveNotify(String body);
|
||||
|
||||
List<SealManage> getSealList(DeptIdentify deptIdentify);
|
||||
|
||||
AjaxResult updateSealLockStatus(SealManage sealManage);
|
||||
|
||||
|
||||
AjaxResult insertDeptIdentify(DeptIdentify deptIdentify);
|
||||
|
||||
AjaxResult deleteDeptIdentify(Long id);
|
||||
|
||||
AjaxResult updateDeptIdentify(DeptIdentify deptIdentify);
|
||||
|
||||
AjaxResult insertTemplate(TemplateManage templateManage , MultipartFile file);
|
||||
|
||||
AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file);
|
||||
|
||||
AjaxResult deleteTemplate(Long id);
|
||||
|
||||
List<TemplateManage> getTemplateList(DeptIdentify deptIdentify);
|
||||
|
||||
|
||||
List<SysUser> selectPostUserByDeptId(DeptIdentify deptIdentify);
|
||||
|
||||
|
||||
AjaxResult bindHandler(DeptIdentify deptIdentify);
|
||||
|
||||
List<FatchRule> getFatchRuleByTemplateid(TemplateManage templateManage);
|
||||
|
||||
AjaxResult saveFatchRules(TemplateManage templateManage);
|
||||
|
||||
List<FatchRule> selectColumnandComment();
|
||||
|
||||
FatchRule selectColumnbycomment(FatchRule fatchRule);
|
||||
|
||||
/**
|
||||
* 根据模板id查询模板字段列表
|
||||
* @param templateManage
|
||||
* @return
|
||||
*/
|
||||
List<FatchRule> getTemplateInfoById(TemplateManage templateManage);
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.SendMailRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISendMailRecordService {
|
||||
|
||||
|
||||
List<SendMailRecord> selectSendMailRecordList(SendMailRecord sendMailRecord);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ITemplateService {
|
||||
AjaxResult insertTemplate(TemplateManual templateManual);
|
||||
|
||||
AjaxResult deleteTemplate(Long id);
|
||||
|
||||
AjaxResult updateTemplate(TemplateManual templateManual);
|
||||
|
||||
List<TemplateManual> selectTemplate(TemplateManual templateManual);
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
|
||||
public interface IdentityAuthenticationService {
|
||||
|
||||
|
||||
IdentityAuthentication selectIdentityAuthentication(IdentityAuthentication identityAuthentication);
|
||||
|
||||
/**
|
||||
* 检查是否已经认证的用户
|
||||
*
|
||||
* @param identityAuthentication
|
||||
* @return
|
||||
*/
|
||||
String checkIsAuthentication(IdentityAuthentication identityAuthentication);
|
||||
|
||||
/**
|
||||
* 获取Eidtoken
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
JSONObject selectIdentityAuthenticaEIDtoken();
|
||||
|
||||
/**
|
||||
* 小程序人脸核身后查询身份认证结果
|
||||
*
|
||||
* @param ientityAuthentication
|
||||
* @return
|
||||
*/
|
||||
AjaxResult selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication);
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 视频录制
|
||||
*/
|
||||
public interface VideoService {
|
||||
|
||||
|
||||
void videoRollBack(String body, HttpServletRequest request) ;
|
||||
|
||||
AjaxResult bindCaseId(Long caseId, String roomId);
|
||||
|
||||
AjaxResult videoList(Long caseId);
|
||||
|
||||
/**
|
||||
* 开启腾讯云录制
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
AjaxResult openCloudRecording(long caseId,long roomId);
|
||||
|
||||
AjaxResult closeDeleteCloudRecording(String taskId);
|
||||
|
||||
/**
|
||||
* 解散房间
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
AjaxResult dissolveRoom( Long roomId);
|
||||
/**
|
||||
* 根据userId查询该用户是否是秘书
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
AjaxResult secretaryRoleByUserId(Long userId);
|
||||
|
||||
/**
|
||||
* 根据html字符串转pdf并和案件关联
|
||||
* @param reservedConferenceVO
|
||||
* @return
|
||||
*/
|
||||
AjaxResult htmlToPDF(ReservedConferenceVO reservedConferenceVO);
|
||||
|
||||
/**
|
||||
* 根据案件id和类型查询附件
|
||||
* @param caseAppliId
|
||||
* @param annexType
|
||||
* @return
|
||||
*/
|
||||
AjaxResult attachListByCaseId(Long caseAppliId, Integer annexType);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi.wisdomarbitrate.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
|
||||
|
||||
/**
|
||||
* 微信小程序用户注册登录
|
||||
*/
|
||||
public interface WeChatUserService {
|
||||
|
||||
|
||||
AjaxResult sendCode(WeChatUserVO userVO);
|
||||
|
||||
|
||||
AjaxResult registerUser(IdentityAuthentication ientityAuthentication);
|
||||
}
|
||||
+1513
File diff suppressed because it is too large
Load Diff
+28
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.ArbitratorMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.IArbitratorService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ArbitratorServiceImpl implements IArbitratorService {
|
||||
@Autowired
|
||||
private ArbitratorMapper arbitratorMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<Arbitrator> selectArbitratorList(Arbitrator arbitrator) {
|
||||
return arbitratorMapper.selectArbitratorList(arbitrator);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import com.ruoyi.CallBackService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 业务回调处理
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CallBackHandleServiceImpl implements CallBackService {
|
||||
@Autowired
|
||||
private CasePaymentServiceImpl casePaymentService;
|
||||
|
||||
@Override
|
||||
public void successPay(String orderSn) {
|
||||
casePaymentService.callback(orderSn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failPay(String orderSn) {
|
||||
log.info("支付失败回调!"+orderSn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void successRefund(String orderSn) {
|
||||
log.info("退款成功回调!"+orderSn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void failRefund(String orderSn) {
|
||||
log.info("退款失败回调!"+orderSn);
|
||||
}
|
||||
}
|
||||
+512
@@ -0,0 +1,512 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
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.common.enums.UpdateSubmitStatus;
|
||||
import com.ruoyi.common.enums.YesOrNoEnum;
|
||||
import com.ruoyi.common.utils.ObjectFieldUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
|
||||
import com.ruoyi.wisdomarbitrate.domain.SmsSendRecord;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CompareCaseVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.service.CaseApplicationLogService;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
/**
|
||||
* @author wangqiong
|
||||
* @description 案件日志
|
||||
* @date 2023-11-17 14:05
|
||||
*/
|
||||
@Service
|
||||
public class CaseApplicationLogServiceImpl implements CaseApplicationLogService {
|
||||
@Autowired
|
||||
private CaseApplicationLogMapper caseApplicationLogMapper;
|
||||
@Autowired
|
||||
private CaseApplicationMapper caseApplicationMapper;
|
||||
@Autowired
|
||||
private CaseAffiliateLogMapper caseAffiliateLogMapper;
|
||||
@Autowired
|
||||
private CaseAffiliateMapper caseAffiliateMapper;
|
||||
@Autowired
|
||||
private CaseAttachMapper caseAttachMapper;
|
||||
@Autowired
|
||||
private CaseAttachLogMapper caseAttachLogMapper;
|
||||
@Autowired
|
||||
private SmsRecordMapper smsRecordMapper;
|
||||
@Autowired
|
||||
private ICaseApplicationService caseApplicationService;
|
||||
@Autowired
|
||||
private ColumnValueLogMapper columnValueLogMapper;
|
||||
// 对比两个版本修改的字段,基本字段对比
|
||||
private static final String[] columns = {"caseName","caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
|
||||
"claimPrinciOwed","arbitratClaims","properPreser","requestRule","facts"};
|
||||
// 人员字段对比
|
||||
private static final String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAddress","workTelphone","workAddress","email",
|
||||
"nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent","residenAffili","compLegalPerson",
|
||||
"compLegalperPost","responSex","responBirth"};
|
||||
@Override
|
||||
public int insert(CaseApplication caseApplicationLog) {
|
||||
return caseApplicationLogMapper.insert(caseApplicationLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id) {
|
||||
return caseApplicationLogMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public CaseApplication selectByCaseIdAndVersion(Long id, int version) {
|
||||
return caseApplicationLogMapper.selectByCaseIdAndVersion(id,version);
|
||||
}
|
||||
/**
|
||||
* 修改的案件提交到秘书
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult submit(UpdateSubmitVO vo) {
|
||||
vo.setUpdateSubmitStatus(UpdateSubmitStatus.COMMITTED.getCode());
|
||||
// 修改日志表提交状态
|
||||
caseApplicationLogMapper.updateStatus(vo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult revoke(UpdateSubmitVO vo) {
|
||||
// 根据案件id和版本号查询改案件
|
||||
CaseApplication caseApplication = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
|
||||
if(caseApplication == null){
|
||||
return AjaxResult.error("案件不存在");
|
||||
}
|
||||
// 如果秘书没有审核,将撤销状态改为同意撤销,否则改为撤销
|
||||
if(caseApplication.getUpdateSubmitStatus()!=null && !caseApplication.getUpdateSubmitStatus().equals(UpdateSubmitStatus.AGREE.getCode())){
|
||||
agreeRevoke(vo);
|
||||
|
||||
}else {
|
||||
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REVOKE.getCode());
|
||||
// 修改日志表提交状态
|
||||
caseApplicationLogMapper.updateStatus(vo);
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 秘书审核修改的案件
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult updateAudit(UpdateSubmitVO vo) {
|
||||
if (Objects.equals(vo.getUpdateSubmitStatus(), UpdateSubmitStatus.COMMITTED.getCode())) {
|
||||
// 审核修改提交状态
|
||||
if (Objects.equals(vo.getIsAgree(), YesOrNoEnum.YES.getCode())) {
|
||||
// 如果版本号为1,则直接返回
|
||||
if(vo.getVersion() <= 1){
|
||||
vo.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE.getCode());
|
||||
caseApplicationLogMapper.updateStatus(vo);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
// 同意,查询日志记录表本版本数据,将数据更新到主表,并将日志表改版本的状态改为同意
|
||||
// 查询日志记录表本版本数据
|
||||
CaseApplication caseApplicationLog = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
|
||||
if (caseApplicationLog == null) {
|
||||
return AjaxResult.error("未找到该案件");
|
||||
}
|
||||
// 将日志表改版本的状态改为同意
|
||||
vo.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE.getCode());
|
||||
caseApplicationLogMapper.updateStatus(vo);
|
||||
// 根据caseLogId查询相关人员表
|
||||
List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationLog.getCaseLogId());
|
||||
// 更新案件主表
|
||||
caseApplicationMapper.updataCaseApplication(caseApplicationLog);
|
||||
|
||||
// 更新相关人员主表
|
||||
if(CollectionUtil.isNotEmpty(affiliateLogList)){
|
||||
caseAffiliateMapper.deleteByCaseId(vo.getCaseId());
|
||||
for (CaseAffiliate caseAffiliate : affiliateLogList) {
|
||||
caseAffiliate.setCaseAppliId(vo.getCaseId());
|
||||
|
||||
}
|
||||
caseAffiliateMapper.batchCaseAffiliate(affiliateLogList);
|
||||
}
|
||||
// // 根据caseLogId查询案件记录附件表
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setCaseLogId(caseApplicationLog.getCaseLogId());
|
||||
caseApplication.setAnnexType(2);
|
||||
List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication);
|
||||
// 更新记录附件表
|
||||
if(CollectionUtil.isNotEmpty(attachLogList)){
|
||||
for (CaseAttach caseAttach : attachLogList) {
|
||||
caseAttach.setCaseAppliId(vo.getCaseId());
|
||||
caseAttachMapper.updateCaseAttach(caseAttach);
|
||||
}
|
||||
}
|
||||
// 更新自定义字段表
|
||||
// 根据caseLogId查询自定义字段表
|
||||
List<ColumnValue> columnValueList = columnValueLogMapper.listBycaseAppliLogId(caseApplicationLog.getCaseLogId());
|
||||
if(CollectionUtil.isNotEmpty(columnValueList)){
|
||||
for (ColumnValue columnValue : columnValueList) {
|
||||
columnValue.setCaseAppliLogId(vo.getCaseId());
|
||||
|
||||
}
|
||||
columnValueLogMapper.batchUpdate(columnValueList);
|
||||
}
|
||||
} else {
|
||||
// 拒绝,将日志表改版本的状态改为拒绝
|
||||
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE.getCode());
|
||||
caseApplicationLogMapper.updateStatus(vo);
|
||||
return sendAuditMessage(vo);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
} else if (Objects.equals(vo.getUpdateSubmitStatus(), UpdateSubmitStatus.REVOKE.getCode())) {
|
||||
// 审核修改撤销状态
|
||||
if (Objects.equals(vo.getIsAgree(), YesOrNoEnum.YES.getCode())) {
|
||||
// 同意撤销
|
||||
agreeRevoke(vo);
|
||||
} else {
|
||||
// 拒绝撤销,将日志表改版本的状态改为拒绝撤销
|
||||
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REFUSE_REVOKE.getCode());
|
||||
caseApplicationLogMapper.updateStatus(vo);
|
||||
return sendAuditMessage(vo);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 给申请人发送短信
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
private AjaxResult sendAuditMessage(UpdateSubmitVO vo) {
|
||||
// 查询申请人
|
||||
CaseApplication logCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
|
||||
if(logCase == null){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
CaseAffiliate caseAffiliate = caseAffiliateLogMapper.selectCaseAffiliateByIdentityType(logCase.getCaseLogId(), 1);
|
||||
if(caseAffiliate == null){
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
request.setTemplateId("1996949");
|
||||
request.setPhone(caseAffiliate.getContactTelphone());
|
||||
request.setTemplateParamSet(new String[]{caseAffiliate.getName(), logCase.getCaseNum(),vo.getReason()});
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
//保存短信发送记录
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord();
|
||||
smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId());
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseAffiliate.getCaseAppliId());
|
||||
caseApplication = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
smsSendRecord.setCaseNum(caseApplication.getCaseNum());
|
||||
smsSendRecord.setPhone(request.getPhone());
|
||||
smsSendRecord.setSendTime(new Date());
|
||||
// 1996949 审核案件结果通知 尊敬的{1}用户,您的{2}仲裁案件,审核未通过,理由为{3},请知晓,如非本人操作,请忽略本短信
|
||||
String content = "尊敬的" + caseAffiliate.getName() + ",您的"+logCase.getCaseNum()+"仲裁案件,审核未通过,理由为"+vo.getReason()+",请知晓,如非本人操作,请忽略本短信。";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean) {
|
||||
smsSendRecord.setSendStatus(1);
|
||||
} else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectCompareCase(UpdateSubmitVO vo) {
|
||||
// 查询当前版本号和主表的案件
|
||||
CaseApplication afterCase = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion());
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setCaseAppliId(vo.getCaseId());
|
||||
caseApplication.setId(vo.getCaseId());
|
||||
CaseApplication beforeCase = caseApplicationService.selectCaseApplication(caseApplication);
|
||||
|
||||
// 查询案件关联人员
|
||||
afterCase.setCaseAffiliates(caseAffiliateLogMapper.selectCaseAffiliate(afterCase.getCaseLogId()));
|
||||
// 查询自定义字段表
|
||||
afterCase.setColumnValues(columnValueLogMapper.listBycaseAppliLogId(afterCase.getCaseLogId()));
|
||||
// 查询附件
|
||||
CaseAttach caseAttach = new CaseAttach();
|
||||
caseAttach.setCaseAppliLogId(beforeCase.getCaseLogId());
|
||||
caseAttach.setAnnexType(2);
|
||||
caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
|
||||
caseAttach.setCaseAppliLogId(afterCase.getCaseLogId());
|
||||
List<CaseAttach> afterAttachList = caseAttachLogMapper.getCaseAttachByCaseIdAndType(caseAttach);
|
||||
if (CollectionUtil.isNotEmpty(afterAttachList)) {
|
||||
for (CaseAttach attach : afterAttachList) {
|
||||
String annexName = attach.getAnnexName();
|
||||
String prefix = "/profile";
|
||||
int startIndex = annexName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
||||
attach.setAnnexPath(annexPath);
|
||||
int startIndexnew = annexName.lastIndexOf("/");
|
||||
if (startIndexnew != -1) {
|
||||
String annexNamenew = annexName.substring(startIndexnew + 1);
|
||||
attach.setAnnexName(annexNamenew);
|
||||
}
|
||||
}
|
||||
afterCase.setCaseAttachList(afterAttachList);
|
||||
}
|
||||
afterCase.setCaseAttachList(afterAttachList);
|
||||
CompareCaseVO compareCaseVO = new CompareCaseVO();
|
||||
compareCaseVO.setBeforeCase(beforeCase);
|
||||
compareCaseVO.setAfterCase(afterCase);
|
||||
|
||||
StringBuilder changeColumn = new StringBuilder();
|
||||
// 对比基本字段
|
||||
for (String column : columns) {
|
||||
String beforeValue = ObjectFieldUtils.getValue(beforeCase, column);
|
||||
String afterValue = ObjectFieldUtils.getValue(afterCase, column);
|
||||
if (StrUtil.isEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue)) {
|
||||
changeColumn.append(column).append(",");
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isEmpty(afterValue)) {
|
||||
changeColumn.append(column).append(",");
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue) && !Objects.equals(beforeValue, afterValue)) {
|
||||
changeColumn.append(column).append(",");
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 对比案件人员字段
|
||||
compareAffilate(beforeCase, afterCase);
|
||||
// 对比申请人证据资料
|
||||
compareCaseVO.setChangeColumn(compareApplicantFile(beforeCase, afterCase, changeColumn).toString());
|
||||
// 对比自定义字段
|
||||
//
|
||||
List<ColumnValue> beforeColumnValues = beforeCase.getColumnValues();
|
||||
List<ColumnValue> afterColumnValues = afterCase.getColumnValues();
|
||||
StringBuilder columnValueChange = new StringBuilder();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(beforeColumnValues) && CollectionUtil.isNotEmpty(afterColumnValues)) {
|
||||
Map<String, String> beforeColumnValueMap = beforeColumnValues.stream().collect(Collectors.toMap(ColumnValue::getColumn, ColumnValue::getValue, (n1, n2) -> n2));
|
||||
for (ColumnValue afterColumnValue : afterColumnValues) {
|
||||
// 改变前字段不包含改变后字段
|
||||
if (!beforeColumnValueMap.containsKey(afterColumnValue.getColumn())) {
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
} else {
|
||||
// 都有这个字段,比较内容是否相同
|
||||
// 修改后为空,修改前不为空
|
||||
if (StrUtil.isEmpty(afterColumnValue.getValue()) && StrUtil.isNotEmpty(beforeColumnValueMap.get(afterColumnValue.getColumn()))) {
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
} else if (StrUtil.isNotEmpty(afterColumnValue.getValue()) && StrUtil.isEmpty(beforeColumnValueMap.get(afterColumnValue.getColumn()))) {
|
||||
// 修改前为空,修改后不为空
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
} else if (StrUtil.isNotEmpty(afterColumnValue.getValue()) && StrUtil.isNotEmpty(beforeColumnValueMap.get(afterColumnValue.getColumn()))
|
||||
&& !afterColumnValue.getValue().equals(beforeColumnValueMap.get(afterColumnValue.getColumn()))) {
|
||||
// 修改前不为空,修改后不为空,内容不同
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else if (CollectionUtil.isEmpty(beforeColumnValues) && CollectionUtil.isNotEmpty(afterColumnValues)) {
|
||||
for (ColumnValue afterColumnValue : afterColumnValues) {
|
||||
columnValueChange.append(afterColumnValue.getColumn()).append(",");
|
||||
}
|
||||
|
||||
} else if (CollectionUtil.isNotEmpty(beforeColumnValues) && CollectionUtil.isEmpty(afterColumnValues)) {
|
||||
for (ColumnValue beforeColumn : beforeColumnValues) {
|
||||
columnValueChange.append(beforeColumn.getColumn()).append(",");
|
||||
}
|
||||
|
||||
}
|
||||
compareCaseVO.setColumnValueChangeColumn(columnValueChange.toString());
|
||||
|
||||
return AjaxResult.success(compareCaseVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 对比申请人证据资料
|
||||
* @param beforeCase
|
||||
* @param afterCase
|
||||
* @param changeColumn
|
||||
* @return
|
||||
*/
|
||||
private StringBuilder compareApplicantFile(CaseApplication beforeCase, CaseApplication afterCase, StringBuilder changeColumn) {
|
||||
List<CaseAttach> beforeAttachFilter =new ArrayList<>();
|
||||
List<CaseAttach> afterAttachFilter =new ArrayList<>();
|
||||
if(CollectionUtil.isNotEmpty(beforeCase.getCaseAttachList())){
|
||||
beforeAttachFilter = beforeCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList());
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(afterCase.getCaseAttachList())){
|
||||
afterAttachFilter = afterCase.getCaseAttachList().stream().filter(n -> n.getAnnexType() == 2).collect(Collectors.toList());
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(beforeAttachFilter)&& CollectionUtil.isNotEmpty(afterAttachFilter)){
|
||||
if(beforeAttachFilter.size()!=afterAttachFilter.size()){
|
||||
changeColumn.append("fileColumn");
|
||||
}else {
|
||||
Map<String, CaseAttach> afterAttachMap = afterAttachFilter.stream().collect(Collectors.toMap(CaseAttach::getAnnexPath, Function.identity(), (n1, n2) -> n2));
|
||||
for (CaseAttach beforeCaseAttach : beforeAttachFilter) {
|
||||
if(!afterAttachMap.containsKey(beforeCaseAttach.getAnnexPath())) {
|
||||
changeColumn.append("fileColumn");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return changeColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对比案件人员字段
|
||||
* @param beforeCase
|
||||
* @param afterCase
|
||||
*/
|
||||
private void compareAffilate(CaseApplication beforeCase, CaseApplication afterCase) {
|
||||
// 对比人员字段
|
||||
List<CaseAffiliate> beforeCaseCaseAffiliates = beforeCase.getCaseAffiliates();
|
||||
List<CaseAffiliate> afterCaseCaseAffiliates = afterCase.getCaseAffiliates();
|
||||
Map<Integer, CaseAffiliate> beforeCaseCaseAffiliateMap = null;
|
||||
if (CollectionUtil.isNotEmpty(beforeCaseCaseAffiliates)) {
|
||||
// 转为map
|
||||
beforeCaseCaseAffiliateMap = beforeCaseCaseAffiliates.stream().collect(Collectors.toMap(CaseAffiliate::getIdentityType, v -> v, (n1, n2) -> n2));
|
||||
}
|
||||
StringBuilder affiliateChangeColumn;
|
||||
// 如果上一个版本和现版本有一个为空,那么所有字段都修改
|
||||
if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates == null) {
|
||||
affiliateChangeColumn = new StringBuilder();
|
||||
for (String column : affiliateColumns) {
|
||||
|
||||
affiliateChangeColumn.append(column).append(",");
|
||||
}
|
||||
|
||||
} else if (beforeCaseCaseAffiliates == null && afterCaseCaseAffiliates != null) {
|
||||
affiliateChangeColumn = new StringBuilder();
|
||||
for (String column : affiliateColumns) {
|
||||
|
||||
affiliateChangeColumn.append(column).append(",");
|
||||
}
|
||||
} else if (beforeCaseCaseAffiliates != null && afterCaseCaseAffiliates != null) {
|
||||
for (CaseAffiliate afterCaseCaseAffiliate : afterCaseCaseAffiliates) {
|
||||
// 找到相同身份类型的数据,进行对比
|
||||
affiliateChangeColumn = new StringBuilder();
|
||||
int identityType = afterCaseCaseAffiliate.getIdentityType();
|
||||
if (beforeCaseCaseAffiliateMap != null && beforeCaseCaseAffiliateMap.containsKey(identityType)) {
|
||||
CaseAffiliate beforeCaseCaseAffiliate = beforeCaseCaseAffiliateMap.get(identityType);
|
||||
for (String column : affiliateColumns) {
|
||||
String beforeValue = ObjectFieldUtils.getValue(beforeCaseCaseAffiliate, column);
|
||||
String afterValue = ObjectFieldUtils.getValue(afterCaseCaseAffiliate, column);
|
||||
if (StrUtil.isEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue)) {
|
||||
affiliateChangeColumn.append(column).append(",");
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isEmpty(afterValue)) {
|
||||
affiliateChangeColumn.append(column).append(",");
|
||||
continue;
|
||||
}
|
||||
if (StrUtil.isNotEmpty(beforeValue) && StrUtil.isNotEmpty(afterValue) && !Objects.equals(beforeValue, afterValue)) {
|
||||
affiliateChangeColumn.append(column).append(",");
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
for (String column : affiliateColumns) {
|
||||
|
||||
affiliateChangeColumn.append(column).append(",");
|
||||
}
|
||||
}
|
||||
afterCaseCaseAffiliate.setChangeColumn(affiliateChangeColumn.toString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同意撤销
|
||||
* @param vo
|
||||
*/
|
||||
private void agreeRevoke(UpdateSubmitVO vo) {
|
||||
CaseApplication caseApplicationLog;
|
||||
// 查询日志记录表上个版本未被拒绝数据
|
||||
if(vo.getVersion()<=1){
|
||||
caseApplicationLog = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() );
|
||||
|
||||
}else {
|
||||
caseApplicationLog = caseApplicationLogMapper.selectBeforeCase(vo.getCaseId(), vo.getVersion() );
|
||||
}
|
||||
if (caseApplicationLog == null) {
|
||||
return;
|
||||
}
|
||||
// 将日志表改版本的状态改为拒绝
|
||||
vo.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE_REVOKE.getCode());
|
||||
caseApplicationLogMapper.updateStatus(vo);
|
||||
// 根据caseLogId查询相关人员表
|
||||
List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationLog.getCaseLogId());
|
||||
|
||||
|
||||
// 更新案件主表
|
||||
caseApplicationMapper.updataCaseApplication(caseApplicationLog);
|
||||
|
||||
// 更新相关人员主表
|
||||
if(CollectionUtil.isNotEmpty(affiliateLogList)){
|
||||
caseAffiliateMapper.deleteByCaseId(vo.getCaseId());
|
||||
for (CaseAffiliate caseAffiliate : affiliateLogList) {
|
||||
caseAffiliate.setCaseAppliId(vo.getCaseId());
|
||||
|
||||
}
|
||||
caseAffiliateMapper.batchCaseAffiliate(affiliateLogList);
|
||||
}
|
||||
// // 根据caseLogId查询案件记录附件表
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setCaseLogId(caseApplicationLog.getCaseLogId());
|
||||
caseApplication.setAnnexType(2);
|
||||
List<CaseAttach> attachLogList = caseAttachLogMapper.queryCaseAttachList(caseApplication);
|
||||
// 更新记录附件表
|
||||
if(CollectionUtil.isNotEmpty(attachLogList)){
|
||||
for (CaseAttach caseAttach : attachLogList) {
|
||||
caseAttach.setCaseAppliId(vo.getCaseId());
|
||||
caseAttachMapper.updateCaseAttach(caseAttach);
|
||||
}
|
||||
}
|
||||
// 根据caseLogId查询自定义字段表
|
||||
List<ColumnValue> columnValueList = columnValueLogMapper.listBycaseAppliLogId(caseApplicationLog.getCaseLogId());
|
||||
|
||||
// 更新相关人员主表
|
||||
if(CollectionUtil.isNotEmpty(columnValueList)){
|
||||
for (ColumnValue columnValue : columnValueList) {
|
||||
columnValue.setCaseAppliLogId(vo.getCaseId());
|
||||
|
||||
}
|
||||
columnValueLogMapper.batchUpdate(columnValueList);
|
||||
}
|
||||
}
|
||||
}
|
||||
+3703
File diff suppressed because it is too large
Load Diff
+533
@@ -0,0 +1,533 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.deepoove.poi.data.PictureRenderData;
|
||||
import com.ruoyi.common.constant.CaseApplicationConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.WordUtil;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
||||
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
@Service
|
||||
public class CaseArbitrateServiceImpl implements ICaseArbitrateService {
|
||||
@Autowired
|
||||
private CaseApplicationMapper caseApplicationMapper;
|
||||
@Autowired
|
||||
private CaseAffiliateMapper caseAffiliateMapper;
|
||||
@Autowired
|
||||
private CaseLogRecordMapper caseLogRecordMapper;
|
||||
@Autowired
|
||||
private ArbitrateRecordMapper arbitrateRecordMapper;
|
||||
@Autowired
|
||||
private CaseAttachMapper caseAttachMapper;
|
||||
@Autowired
|
||||
private SmsRecordMapper smsRecordMapper;
|
||||
@Autowired
|
||||
private IAdjudicationService adjudicationService;
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
@Autowired
|
||||
private ICaseApplicationService caseApplicationService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult examineArbitrateMethod(CaseApplication caseApplication, Integer opinion, Integer arbitratMethodNow) {
|
||||
//查询案件详细信息
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
if (caseApplication1 == null) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
Integer arbitratMethodOriral = caseApplication.getArbitratMethod();
|
||||
|
||||
String caseNum = caseApplication1.getCaseNum();
|
||||
if (opinion == 0) { //拒绝
|
||||
if (arbitratMethodOriral == 2) {
|
||||
caseApplication1.setArbitratMethod(1); // 更改仲裁方式
|
||||
//修改案件状态修改开庭时间
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE);
|
||||
//修改案件状态为待修改开庭时间
|
||||
// caseApplication1.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.MODIFY_HEARDATE, "");
|
||||
|
||||
} else {
|
||||
caseApplication1.setArbitratMethod(2);
|
||||
//修改案件状态为待书面审理
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_WRIITEN_HEAR, "");
|
||||
|
||||
}
|
||||
} else if (opinion == 1 ) {
|
||||
if (arbitratMethodOriral == 2) {
|
||||
//修改案件状态为待书面审理
|
||||
caseApplication1.setArbitratMethod(2);
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_WRIITEN_HEAR, "");
|
||||
|
||||
} else {
|
||||
//修改案件状态为待修改开庭时间
|
||||
caseApplication1.setArbitratMethod(1);
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE);
|
||||
//修改案件状态为待修改开庭时间
|
||||
// caseApplication1.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.MODIFY_HEARDATE, "");
|
||||
|
||||
}
|
||||
}else if (opinion == 2) {
|
||||
if (arbitratMethodNow == 2) {
|
||||
//修改案件状态为待书面审理
|
||||
caseApplication1.setArbitratMethod(2);
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_WRIITEN_HEAR, "");
|
||||
|
||||
} else {
|
||||
//修改案件状态为待修改开庭时间
|
||||
caseApplication1.setArbitratMethod(1);
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE);
|
||||
//修改案件状态为待修改开庭时间
|
||||
// caseApplication1.setCaseStatus(CaseApplicationConstants.MODIFY_HEARDATE);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.MODIFY_HEARDATE, "");
|
||||
|
||||
}
|
||||
}
|
||||
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
|
||||
if (i > 0) {
|
||||
String arbitratMethodStr = caseApplication1.getArbitratMethod() == 1 ? "开庭审理" : "书面审理";
|
||||
//发送短信通知
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
|
||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||
caseAffiliate.setCaseAppliId(caseApplication1.getId());
|
||||
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息
|
||||
if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
||||
for (CaseAffiliate affiliate : caseAffiliates) {
|
||||
request.setTemplateId("1931000");
|
||||
request.setPhone(affiliate.getContactTelphone());
|
||||
// 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置
|
||||
// 1931000 尊敬的{1}用户,您的{2}仲裁案件,仲裁方式已确定为{3},请知晓,如非本人操作,请忽略本短信。
|
||||
String name = affiliate.getName();
|
||||
request.setTemplateParamSet(new String[]{name, caseNum, arbitratMethodStr});
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
//保存短信发送记录
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord();
|
||||
smsSendRecord.setCaseId(caseApplication.getId());
|
||||
smsSendRecord.setCaseNum(caseApplication1.getCaseNum());
|
||||
smsSendRecord.setPhone(request.getPhone());
|
||||
smsSendRecord.setSendTime(new Date());
|
||||
String content = "尊敬的" + name + "用户,您的" + caseNum + "仲裁案件,仲裁方式已确定为" + arbitratMethodStr + ",请知晓,如非本人操作,请忽略本短信。";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean){
|
||||
smsSendRecord.setSendStatus(1);
|
||||
}else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success("审核成功");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult writtenHear(CaseIds caseIds) {
|
||||
if (caseIds!=null){
|
||||
List<Long> ids = caseIds.getIds();
|
||||
for (Long caseId : ids) {
|
||||
//查询案件详情
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseId);
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
//先判断案件是否已经提交过仲裁结果
|
||||
ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
|
||||
arbitrateRecord.setCaseAppliId(caseId);
|
||||
ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
||||
if (arbitrateRecord1 != null) {
|
||||
int i = arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
|
||||
if (i > 0) {
|
||||
//案件日志表里添加数据
|
||||
CaseLogRecord caseLogRecord = new CaseLogRecord();
|
||||
caseLogRecord.setCaseAppliId(caseApplication1.getId());
|
||||
caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
|
||||
caseLogRecord.setCreateBy(getUsername());
|
||||
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
|
||||
|
||||
}
|
||||
} else {
|
||||
//提交仲裁结果
|
||||
int i = arbitrateRecordMapper.insertArbitrateRecord(arbitrateRecord);
|
||||
if (i > 0) {
|
||||
//案件日志表里添加数据
|
||||
CaseLogRecord caseLogRecord = new CaseLogRecord();
|
||||
caseLogRecord.setCaseAppliId(caseApplication1.getId());
|
||||
caseLogRecord.setCaseNode(caseApplication1.getCaseStatus());
|
||||
caseLogRecord.setCreateBy(getUsername());
|
||||
caseLogRecordMapper.insertCaseLogRecord(caseLogRecord);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.GENERATED_ARBITRATION, "");
|
||||
}
|
||||
}
|
||||
// 生成裁决书
|
||||
CaseApplication application = new CaseApplication();
|
||||
application.setId(caseId);
|
||||
adjudicationService.createDocument(application);
|
||||
//修改案件状态
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION);
|
||||
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
|
||||
|
||||
}
|
||||
return AjaxResult.success("审理成功");
|
||||
}
|
||||
return AjaxResult.error("请检查参数");
|
||||
}
|
||||
|
||||
//生成仲裁文书
|
||||
private Boolean generateAward(Long id) {
|
||||
try {
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
//获取案件详细信息
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(id);
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
//生成编码
|
||||
String equipmentNo = getNewEquipmentNo();
|
||||
datas.put("num", equipmentNo);
|
||||
//获取仲裁记录表里的相关信息
|
||||
ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
|
||||
arbitrateRecord.setCaseAppliId(id);
|
||||
ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord);
|
||||
//获取案件关联人信息
|
||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||
caseAffiliate.setCaseAppliId(id);
|
||||
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
||||
List<String> nameAgentList = new ArrayList<>();
|
||||
if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
||||
for (CaseAffiliate affiliate : caseAffiliates) {
|
||||
//获取身份类型
|
||||
int identityType = affiliate.getIdentityType();
|
||||
if (identityType == 1) { //申请人
|
||||
datas.put("appName", affiliate.getName());
|
||||
datas.put("appAddress", affiliate.getResidenAffili());
|
||||
datas.put("appContactAddress", affiliate.getContactAddress());
|
||||
datas.put("appLegalPerson", affiliate.getCompLegalPerson());
|
||||
datas.put("appLegalPersonTitle", affiliate.getCompLegalperPost());
|
||||
datas.put("appAgentName", affiliate.getNameAgent());
|
||||
datas.put("appAgentTitle", affiliate.getAppliAgentTitle());
|
||||
nameAgentList.add(affiliate.getNameAgent());
|
||||
} else if (identityType == 2) { //被申请人
|
||||
datas.put("resName", affiliate.getName());
|
||||
datas.put("resAddress", affiliate.getResidenAffili());
|
||||
String responSex = affiliate.getResponSex();
|
||||
if (responSex.equals("0")) {
|
||||
datas.put("resSex", "男");
|
||||
} else if (responSex.equals("1")){
|
||||
datas.put("resSex", "女");
|
||||
}else {
|
||||
datas.put("resSex", "未知");
|
||||
}
|
||||
Date responBirth = affiliate.getResponBirth();
|
||||
if (responBirth != null) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String responBirthStr = sdf.format(responBirth);
|
||||
datas.put("resDateOfBirth", responBirthStr);
|
||||
|
||||
}
|
||||
|
||||
datas.put("resContactAddress", affiliate.getContactAddress());
|
||||
nameAgentList.add(affiliate.getNameAgent());
|
||||
}
|
||||
}
|
||||
}
|
||||
Date createTime = caseApplication1.getCreateTime();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// 将日期格式化为字符串
|
||||
String createTimeStr = sdf.format(createTime);
|
||||
datas.put("submissionDate", createTimeStr);
|
||||
Date registerDate = caseApplication1.getRegisterDate();
|
||||
String registerDateStr = sdf.format(registerDate);
|
||||
datas.put("acceptDate", registerDateStr);
|
||||
//反请求
|
||||
Integer adjudicaCounter = caseApplication1.getAdjudicaCounter();
|
||||
String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" +
|
||||
"《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" +
|
||||
"仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。";
|
||||
if (adjudicaCounter == null) {
|
||||
datas.put("counterclaim", null);
|
||||
} else if (adjudicaCounter == 1) {
|
||||
datas.put("counterclaim", counterclaim);
|
||||
} else {
|
||||
datas.put("counterclaim", null);
|
||||
}
|
||||
//财产保全
|
||||
Integer properPreser = caseApplication1.getProperPreser();
|
||||
String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" +
|
||||
"第二十八条之规定,将该申请提交至法院。";
|
||||
if (properPreser == null) {
|
||||
datas.put("preservation", null);
|
||||
} else if (properPreser == 1) {
|
||||
datas.put("preservation", preservation);
|
||||
} else {
|
||||
datas.put("preservation", null);
|
||||
}
|
||||
//管辖权异议
|
||||
Integer objectiJuris = caseApplication1.getObjectiJuris();
|
||||
String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《XX管辖异议申请书》,认为XXXXXX" +
|
||||
",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。";
|
||||
if (objectiJuris == null) {
|
||||
datas.put("jurisdictionalObjection", null);
|
||||
} else if (objectiJuris == 1) {
|
||||
datas.put("jurisdictionalObjection", jurisdictionalObjection);
|
||||
} else {
|
||||
datas.put("jurisdictionalObjection", null);
|
||||
}
|
||||
String arbitratorName = caseApplication1.getArbitratorName();
|
||||
datas.put("arbitratorName", arbitratorName);
|
||||
Integer arbitratMethod = caseApplication1.getArbitratMethod();
|
||||
Date hearDate = caseApplication1.getHearDate();
|
||||
if (hearDate != null) {
|
||||
String hearDateStr = sdf.format(hearDate);
|
||||
//线上开庭时
|
||||
if (arbitratMethod == 1) {
|
||||
String onLine1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于";
|
||||
String onLine2 = "通过仲裁委智慧仲裁平台开庭审理了本案。";
|
||||
datas.put("onLine1", onLine1);
|
||||
datas.put("hearDate", hearDateStr);
|
||||
datas.put("onLine2", onLine2);
|
||||
} else {
|
||||
//书面仲裁时
|
||||
String written1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于";
|
||||
String written2 = "在仲裁委所在地开庭审理了本案。";
|
||||
datas.put("written1", written1);
|
||||
datas.put("hearDate1", hearDateStr);
|
||||
datas.put("written2", written2);
|
||||
}
|
||||
}
|
||||
Integer isAbsence = caseApplication1.getIsAbsence();
|
||||
if (isAbsence == null) {
|
||||
datas.put("absent1", null);
|
||||
datas.put("absent2", null);
|
||||
datas.put("absent3", null);
|
||||
datas.put("absent4", null);
|
||||
datas.put("absent5", null);
|
||||
datas.put("attend1", null);
|
||||
datas.put("attend2", null);
|
||||
datas.put("attend3", null);
|
||||
datas.put("attend4", null);
|
||||
datas.put("attend5", null);
|
||||
datas.put("attend6", null);
|
||||
datas.put("attend7", null);
|
||||
datas.put("appAgentName1", null);
|
||||
datas.put("appAgentName2", null);
|
||||
datas.put("resAgentName", null);
|
||||
} else if (isAbsence == 1) {
|
||||
//缺席审理
|
||||
String absent1 = "申请人的特别授权委托代理人";
|
||||
String absent2 = "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" +
|
||||
"《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。";
|
||||
String absent3 = "庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明," +
|
||||
"发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。";
|
||||
String absent4 = "(二/三)当事人提供的证据材料\n" +
|
||||
"申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:";
|
||||
String absent5 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" +
|
||||
"第四十条第(二)项、第五十一条的规定,缺席裁决如下:";
|
||||
datas.put("absent1", absent1);
|
||||
datas.put("absent2", absent2);
|
||||
datas.put("absent3", absent3);
|
||||
datas.put("absent4", absent4);
|
||||
datas.put("absent5", absent5);
|
||||
datas.put("appAgentName1", nameAgentList.get(0));
|
||||
} else {
|
||||
//出席审理
|
||||
String attend1 = "申请人的特别授权委托代理人";
|
||||
String attend2 = "和被申请人本人/的特别授权委托代理人";
|
||||
String attend3 = "出席了庭审。";
|
||||
String attend4 = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;" +
|
||||
"双方当事人均出示了证据材料并对对方的证据材料进行了质证;申请人出示了证据材料," +
|
||||
"被申请人对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论," +
|
||||
"并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。";
|
||||
String attend5 = "(二)被申请人的答辩意见";
|
||||
String attend6 = "(二/三)当事人提供的证据材料及对方的质证意见\n" +
|
||||
"申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:";
|
||||
String attend7 = "被申请人对上述材料的质证意见为:";
|
||||
datas.put("attend1", attend1);
|
||||
datas.put("attend2", attend2);
|
||||
datas.put("attend3", attend3);
|
||||
datas.put("attend4", attend4);
|
||||
datas.put("attend5", attend5);
|
||||
datas.put("attend6", attend6);
|
||||
datas.put("attend7", attend7);
|
||||
datas.put("responCrossOpin", caseApplication1.getResponCrossOpin());
|
||||
datas.put("appAgentName2", nameAgentList.get(0));
|
||||
datas.put("resAgentName", nameAgentList.get(1));
|
||||
if (arbitratMethod == 1) {
|
||||
//被申出席+开庭
|
||||
String attend8 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" +
|
||||
"第五十一条的规定,裁决如下:";
|
||||
datas.put("attend8", attend8);
|
||||
} else {
|
||||
//被申出席+书面
|
||||
String attend9 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" +
|
||||
"第五十一条、第五十八条的规定,裁决如下:";
|
||||
datas.put("attend9", attend9);
|
||||
}
|
||||
}
|
||||
datas.put("claims", caseApplication1.getArbitratClaims());
|
||||
datas.put("request", caseApplication1.getRequestRule());
|
||||
CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
|
||||
List<CaseAttach> caseAttachList1 = caseApplication2.getCaseAttachList();
|
||||
if (caseAttachList1 != null && caseAttachList1.size() > 0) {
|
||||
for (CaseAttach caseAttach : caseAttachList1) {
|
||||
if (caseAttach.getAnnexType() == 6) { //被申请人证据材料
|
||||
String annexName = caseAttach.getAnnexName();
|
||||
boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
|
||||
if (isImageFile) {
|
||||
String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath();
|
||||
System.out.println("路径是===========" + annexPath);
|
||||
PictureRenderData pictureRenderData = WordUtil
|
||||
.rebuildImageContent(100, 100, null, annexPath);
|
||||
datas.put("resEvidenceMaterial", pictureRenderData);
|
||||
}
|
||||
} else if (caseAttach.getAnnexType() == 2) { //申请人证据材料
|
||||
String annexName = caseAttach.getAnnexName();
|
||||
boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName);
|
||||
if (isImageFile) {
|
||||
String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath();
|
||||
System.out.println("路径是===========" + annexPath);
|
||||
PictureRenderData pictureRenderData = WordUtil
|
||||
.rebuildImageContent(100, 100, null, annexPath);
|
||||
//申请人证据材料
|
||||
datas.put("appEvidenceMaterial", pictureRenderData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
datas.put("applicaCrossOpin", "被申请人证据不足,无法说明事实");
|
||||
datas.put("factDetermi", "被申请人欠款属实");
|
||||
datas.put("arbitrateThink", " 被申请人应按约定还款");
|
||||
datas.put("rulingFollows", "被申请人依法偿还申请人欠款");
|
||||
LocalDate now = LocalDate.now();
|
||||
String year = Integer.toString(now.getYear());
|
||||
datas.put("year", year);
|
||||
String month = String.format("%02d", now.getMonthValue());
|
||||
String day = String.format("%02d", now.getDayOfMonth());
|
||||
String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx";
|
||||
//String modalFilePath = "D:/develop/新裁决书模板.docx";
|
||||
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||
//String saveFolderPath = "D:/data/" + year + "/" + month + "/" + day;
|
||||
String fileName = UUID.randomUUID().toString().replace("-", "") + ".docx";
|
||||
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||
String resultFilePath = saveFolderPath + "/" + fileName;
|
||||
// 创建日期目录
|
||||
File saveFolder = new File(saveFolderPath);
|
||||
if (!saveFolder.exists()) {
|
||||
saveFolder.mkdirs();
|
||||
}
|
||||
Path sourcePath = new File(modalFilePath).toPath();
|
||||
Path destinationPath = new File(resultFilePath).toPath();
|
||||
Files.copy(sourcePath, destinationPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
String docFilePath = WordUtil.getDocFilePath(datas, modalFilePath, resultFilePath);
|
||||
File file = new File(docFilePath);
|
||||
if (file.exists()) {
|
||||
InputStream in = new FileInputStream(file);
|
||||
XWPFDocument xwpfDocument = new XWPFDocument(in);
|
||||
WordUtil.changeText(xwpfDocument);
|
||||
}
|
||||
String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
|
||||
CaseAttach caseAttach = CaseAttach.builder()
|
||||
.caseAppliId(id)
|
||||
.annexName(saveName)
|
||||
.annexPath(savePath)
|
||||
.annexType(3)
|
||||
.build();
|
||||
//保存到附件表里,先判断之前有没有,有的话更新,没有的话新增
|
||||
CaseAttach caseAttach1 = new CaseAttach();
|
||||
caseAttach1.setAnnexType(3);
|
||||
caseAttach1.setCaseAppliId(id);
|
||||
List<CaseAttach> caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach1);
|
||||
if (caseAttachList != null && caseAttachList.size() > 0) {
|
||||
//之前已经生成过了,更新
|
||||
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
|
||||
} else {
|
||||
//之前没生成过,新增
|
||||
int i = caseAttachMapper.save(caseAttach);
|
||||
if (i > 0) {
|
||||
if (arbitrateRecord1 != null) {
|
||||
Integer annexId = caseAttach.getAnnexId();
|
||||
//将附件id保存到仲裁记录表里面
|
||||
arbitrateRecord1.setAnnexId(annexId);
|
||||
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
} catch (IOException e) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
public String getNewEquipmentNo() {
|
||||
Object awardNum = redisCache.getCacheObject("awardNum");
|
||||
if (awardNum == null) {
|
||||
redisCache.setCacheObject("awardNum", "00001");
|
||||
String s = redisCache.getCacheObject("awardNum").toString();
|
||||
// 字符串数字解析为整数
|
||||
int no = Integer.parseInt(s);
|
||||
// 最新设备编号自增1
|
||||
int newEquipment = ++no;
|
||||
// 将整数格式化为5位数字
|
||||
s = String.format("%05d", newEquipment);
|
||||
redisCache.setCacheObject("awardNum", s);
|
||||
return s;
|
||||
} else {
|
||||
String s = awardNum.toString();
|
||||
// 字符串数字解析为整数
|
||||
int no = Integer.parseInt(s);
|
||||
// 最新设备编号自增1
|
||||
int newEquipment = ++no;
|
||||
// 将整数格式化为5位数字
|
||||
s = String.format("%05d", newEquipment);
|
||||
redisCache.setCacheObject("awardNum", s);
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
+511
@@ -0,0 +1,511 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.CaseApplicationConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceDirectoryVO;
|
||||
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.CaseEvidenceDTO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CaseDetailVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceVO;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseEvidenceService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
@Service
|
||||
public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
|
||||
@Autowired
|
||||
private CaseEvidenceMapper caseEvidenceMapper;
|
||||
@Autowired
|
||||
private CaseAffiliateMapper caseAffiliateMapper;
|
||||
@Autowired
|
||||
private CaseApplicationMapper caseApplicationMapper;
|
||||
@Autowired
|
||||
private CaseAttachMapper caseAttachMapper;
|
||||
@Autowired
|
||||
private CaseEvidenceDirectoryMapper caseEvidenceDirectoryMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private SmsRecordMapper smsRecordMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult getCaseDetailsById(Long id, String userName) {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(id);
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
if (caseApplication1 != null) {
|
||||
CaseDetailVO caseDetailVO = new CaseDetailVO();
|
||||
BeanUtils.copyProperties(caseApplication1, caseDetailVO);
|
||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||
caseAffiliate.setCaseAppliId(id);
|
||||
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
||||
for (CaseAffiliate affiliate : caseAffiliates) {
|
||||
if (affiliate.getName() != null) {
|
||||
String name = affiliate.getName();
|
||||
//判断当前登录人和案件关联人姓名是否一致
|
||||
if (name.equals(userName)) { //一致,将案件关联人的身份类型赋给当前登录人
|
||||
caseDetailVO.setIdentityType(affiliate.getIdentityType());
|
||||
}
|
||||
}
|
||||
if (affiliate.getIdentityType() == 1) { //申请人
|
||||
caseDetailVO.setApplicantName(affiliate.getName());
|
||||
} else {
|
||||
caseDetailVO.setRespondentName(affiliate.getName());
|
||||
}
|
||||
//根据案件id查询案件证据材料
|
||||
List<CaseAttach> evidenceMaterialList = caseAttachMapper.queryAnnexPathByCaseId(id);
|
||||
if (evidenceMaterialList != null && evidenceMaterialList.size() > 0) {
|
||||
// for (CaseAttach caseAttach : evidenceMaterialList) {
|
||||
// //根据附件类型决定返回的路径
|
||||
// Integer annexType = caseAttach.getAnnexType();
|
||||
// if (annexType != 1){
|
||||
// String path = caseAttach.getAnnexName();
|
||||
// String prefix = "/profile";
|
||||
// int startIndex = path.indexOf(prefix);
|
||||
// startIndex += prefix.length();
|
||||
// String extractedPath = "/uploadPath" + path.substring(startIndex);
|
||||
// caseAttach.setAnnexPath(extractedPath);
|
||||
// }else {
|
||||
// String annexPath = caseAttach.getAnnexPath();
|
||||
// String result = annexPath.replace("/home/ruoyi", "");
|
||||
// caseAttach.setAnnexPath(result);
|
||||
// }
|
||||
// }
|
||||
|
||||
for (CaseAttach caseAttach : evidenceMaterialList) {
|
||||
String annexName = caseAttach.getAnnexName();
|
||||
String prefix = "/profile";
|
||||
int startIndex = annexName.indexOf(prefix);
|
||||
if(startIndex!=-1) {
|
||||
startIndex += prefix.length();
|
||||
|
||||
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
||||
caseAttach.setAnnexPath(annexPath);
|
||||
}
|
||||
int startIndexnew = annexName.lastIndexOf("/");
|
||||
if (startIndexnew != -1) {
|
||||
String annexNamenew = annexName.substring(startIndexnew + 1);
|
||||
caseAttach.setAnnexName(annexNamenew);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
caseDetailVO.setEvidenceMaterialList(evidenceMaterialList);
|
||||
}
|
||||
return AjaxResult.success(caseDetailVO);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult uploadEvidence(MultipartFile file, Integer annexType, Long id, String userName, Long userId) {
|
||||
|
||||
if (file.isEmpty()) {
|
||||
return AjaxResult.error("请选择要上传的文件");
|
||||
}
|
||||
try {
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id)
|
||||
.annexName(fileName)
|
||||
.annexPath(filePath)
|
||||
.annexType(annexType)
|
||||
.userId(userId)
|
||||
.userName(userName)
|
||||
.build();
|
||||
int count = caseAttachMapper.save(caseAttach);
|
||||
if (count > 0 && annexType != null && annexType != 8) {
|
||||
if (id != null) {
|
||||
//修改案件状态
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(id);
|
||||
caseApplication.setCaseStatus(4);
|
||||
caseApplicationMapper.submitCaseApplication(caseApplication);
|
||||
}
|
||||
}
|
||||
CaseAttach caseAttachselect = new CaseAttach();
|
||||
caseAttachselect.setAnnexId(caseAttach.getAnnexId());
|
||||
String annexName = caseAttach.getAnnexName();
|
||||
if(StrUtil.isNotEmpty(annexName)) {
|
||||
int startIndexnew = annexName.lastIndexOf("/");
|
||||
if (startIndexnew != -1) {
|
||||
String annexNamenew = annexName.substring(startIndexnew + 1);
|
||||
caseAttach.setAnnexName(annexNamenew);
|
||||
}
|
||||
}
|
||||
caseAttachselect.setAnnexType(caseAttach.getAnnexType());
|
||||
return AjaxResult.success("上传成功", caseAttachselect);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return AjaxResult.error("上传失败");
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
IdentityAuthenticationMapper identityAuthenticationMapper;
|
||||
|
||||
@Override
|
||||
public List<CaseEvidenceVO> getCaseListAll(Integer caseStatus) {
|
||||
// 是否为超级管理员
|
||||
int adMinFlag=0;
|
||||
String identityNum = "";
|
||||
IdentityAuthentication authentication = new IdentityAuthentication();
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
// 查询该用户的角色
|
||||
// 查询登录人身份证号
|
||||
SysUser sysUser = sysUserMapper.selectUserById(loginUser.getUserId());
|
||||
String username = sysUser.getUserName();
|
||||
List<SysRole> roles = sysUser.getRoles();
|
||||
if(CollectionUtil.isNotEmpty(roles)){
|
||||
for (SysRole role : roles) {
|
||||
if(role.getRoleName().equals("超级管理员")
|
||||
){
|
||||
// 超级管理员可查看所有待案件质证的案件
|
||||
adMinFlag=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(adMinFlag!=1) {
|
||||
authentication.setUserName(username);
|
||||
IdentityAuthentication authentication1 = identityAuthenticationMapper.selectIdentityAuthentication(authentication);
|
||||
if (authentication1 != null) {
|
||||
identityNum = authentication1.getIdentityNo();
|
||||
}
|
||||
}
|
||||
|
||||
List<Integer> caseStatusList = Arrays.asList(caseStatus);
|
||||
return getCaseEvidenceVOList(identityNum, caseStatusList, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult evidenceConfirmation(CaseApplication caseApplication) {
|
||||
caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_TRIAL);
|
||||
int i = caseApplicationMapper.submitCaseApplication(caseApplication);
|
||||
if (i > 0) {
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_TRIAL, "");
|
||||
|
||||
return AjaxResult.success("证据确认成功");
|
||||
}
|
||||
return AjaxResult.error("暂无需要确认的证据");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult caseCrossexamination(CaseEvidenceDTO caseEvidenceDTO) {
|
||||
//查询案件详细信息
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseEvidenceDTO.getCaseId());
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
if (caseApplication1 != null) {
|
||||
caseApplication1.setAdjudicaCounterReason(caseEvidenceDTO.getAdjudicaCounterReason());
|
||||
int caseStatus = caseApplication1.getCaseStatus();
|
||||
caseApplication1.setObjectionAddEviden(caseEvidenceDTO.getObjectionAddEviden());
|
||||
caseApplication1.setPendingAppointArbotrar(caseEvidenceDTO.getPendingAppointArbotrar());
|
||||
caseApplication1.setAdjudicaCounter(caseEvidenceDTO.getAdjudicaCounter());
|
||||
caseApplication1.setObjectiJuris(caseEvidenceDTO.getObjectiJuris());
|
||||
caseApplication1.setRespondentIsWrittenHear(caseEvidenceDTO.getRespondentIsWrittenHear());
|
||||
List<Arbitrator> arbitrators = caseEvidenceDTO.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(","));
|
||||
caseApplication1.setArbitratorId(idstr);
|
||||
caseApplication1.setArbitratorName(arbitratorNamestr);
|
||||
}
|
||||
//修改案件状态
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL_SUBMMIT);
|
||||
|
||||
|
||||
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
|
||||
if (i > 0) {
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL_SUBMMIT, "");
|
||||
|
||||
return AjaxResult.success("提交成功");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult batchUpload(MultipartFile[] files, Integer annexType, Long id, String userName, Long userId) {
|
||||
List<CaseAttach> successList = new ArrayList<>();
|
||||
try {
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
for (MultipartFile file : files) {
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id)
|
||||
.annexName(fileName)
|
||||
.annexPath(filePath)
|
||||
.annexType(annexType)
|
||||
.userId(userId)
|
||||
.userName(userName)
|
||||
.isBatchUpload(1)
|
||||
.build();
|
||||
int count = caseAttachMapper.save(caseAttach);
|
||||
if (count > 0 && annexType != null && annexType != 8) {
|
||||
CaseAttach caseAttachselect = new CaseAttach();
|
||||
caseAttachselect.setAnnexId(caseAttach.getAnnexId());
|
||||
caseAttachselect.setAnnexName(caseAttach.getAnnexName());
|
||||
caseAttachselect.setAnnexType(caseAttach.getAnnexType());
|
||||
successList.add(caseAttachselect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return AjaxResult.error("上传失败");
|
||||
}
|
||||
// 给秘书发送短信
|
||||
// 根据caseid查询该案件的法律顾问,根据案件id查申请表,查到申请机构id,然后拿申请机构id查询在哪个人下并且角色要是法律顾问
|
||||
CaseAffiliate caseAffiliate = caseAffiliateMapper.selectCaseAffiliateByIdentityType(id, 1);
|
||||
if(caseAffiliate!= null && StrUtil.isNotEmpty(caseAffiliate.getApplicationOrganId())){
|
||||
List<SysUser> userList= sysUserMapper.selectByDeptIdAndRole(caseAffiliate.getApplicationOrganId(),"法律顾问");
|
||||
if(CollectionUtil.isNotEmpty(userList)){
|
||||
// 新增短信记录
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
// 1992106 普通短信 修改证据资料通知 尊敬的{1}用户,您的{2}仲裁案件,有新的证据上传,请知晓,如非本人操作,请忽略本短信。
|
||||
request.setTemplateId("1992106");
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(id);
|
||||
caseApplication = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
for (SysUser user : userList) {
|
||||
request.setPhone(user.getPhonenumber());
|
||||
request.setTemplateParamSet(new String[]{user.getNickName(),caseApplication.getCaseNum()});
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
//保存短信发送记录
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord();
|
||||
smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId());
|
||||
|
||||
smsSendRecord.setCaseNum(caseApplication.getCaseNum());
|
||||
smsSendRecord.setPhone(request.getPhone());
|
||||
smsSendRecord.setSendTime(new Date());
|
||||
String content = "尊敬的" + user.getNickName() + ",您的"+caseApplication.getCaseNum()+"仲裁案件,有新的证据上传,请知晓,如非本人操作,请忽略本短信。";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean) {
|
||||
smsSendRecord.setSendStatus(1);
|
||||
} else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.success("上传成功", successList);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult fileList(Long caseAppliId, List<Integer> annexTypeList) {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseAppliId);
|
||||
caseApplication.setAnnexTypeList(annexTypeList);
|
||||
List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication);
|
||||
if (CollectionUtil.isNotEmpty(caseAttachList)) {
|
||||
for (CaseAttach caseAttach : caseAttachList) {
|
||||
String annexName = caseAttach.getAnnexName();
|
||||
String prefix = "/profile";
|
||||
int startIndex = annexName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
||||
caseAttach.setAnnexPath(annexPath);
|
||||
int startIndexnew = annexName.lastIndexOf("/");
|
||||
if (startIndexnew != -1) {
|
||||
String annexNamenew = annexName.substring(startIndexnew + 1);
|
||||
caseAttach.setAnnexName(annexNamenew);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(caseAttachList);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteFile(List<Integer> fileIds) {
|
||||
return caseAttachMapper.deleteByFileIds(fileIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaseEvidenceDirectoryVO> selectEvidenceTreeList(CaseEvidenceDirectory caseEvidenceDirectory) {
|
||||
List<CaseEvidenceDirectory> caseEvidenceDirectorys = SpringUtils.getAopProxy(this).selectCaseEvidenceList(caseEvidenceDirectory);
|
||||
return buildCaseEvidenceTreeSelect(caseEvidenceDirectorys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaseEvidenceDirectory> selectCaseEvidenceList(CaseEvidenceDirectory caseEvidenceDirectory) {
|
||||
return caseEvidenceDirectoryMapper.selectList(caseEvidenceDirectory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaseEvidenceDirectory> buildCaseEvidenceTree(List<CaseEvidenceDirectory> caseEvidenceDirectorys) {
|
||||
List<CaseEvidenceDirectory> returnList = new ArrayList<>();
|
||||
List<Long> tempList = caseEvidenceDirectorys.stream().map(CaseEvidenceDirectory::getId).collect(Collectors.toList());
|
||||
for (CaseEvidenceDirectory caseEvidenceDirectory : caseEvidenceDirectorys) {
|
||||
String annexName = caseEvidenceDirectory.getAnnexName();
|
||||
if (annexName!=null){
|
||||
String prefix = "/profile";
|
||||
int startIndex = annexName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
||||
caseEvidenceDirectory.setAnnexPath(annexPath);
|
||||
int startIndexnew = annexName.lastIndexOf("/");
|
||||
if(startIndexnew!=-1){
|
||||
String annexNamenew = annexName.substring(startIndexnew+1);
|
||||
caseEvidenceDirectory.setAnnexName(annexNamenew);
|
||||
}
|
||||
}
|
||||
// 如果是顶级节点, 遍历该父节点的所有子节点
|
||||
if (!tempList.contains(caseEvidenceDirectory.getParentId())) {
|
||||
recursionFn(caseEvidenceDirectorys, caseEvidenceDirectory);
|
||||
returnList.add(caseEvidenceDirectory);
|
||||
}
|
||||
}
|
||||
if (returnList.isEmpty())
|
||||
{
|
||||
returnList = caseEvidenceDirectorys;
|
||||
}
|
||||
return returnList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaseEvidenceDirectoryVO> buildCaseEvidenceTreeSelect(List<CaseEvidenceDirectory> caseEvidenceDirectorys) {
|
||||
List<CaseEvidenceDirectory> caseEvidenceDirectories = buildCaseEvidenceTree(caseEvidenceDirectorys);
|
||||
return caseEvidenceDirectories.stream().map(CaseEvidenceDirectoryVO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult uploadRecord(MultipartFile file, Integer annexType, Long id, String username, Long userId) {
|
||||
if (file.isEmpty()) {
|
||||
return AjaxResult.error("请选择要上传的文件");
|
||||
}
|
||||
try {
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id)
|
||||
.annexName(fileName)
|
||||
.annexPath(filePath)
|
||||
.annexType(annexType)
|
||||
.userId(userId)
|
||||
.userName(username)
|
||||
.build();
|
||||
|
||||
CaseApplication caseApplicationsel = new CaseApplication();
|
||||
caseApplicationsel.setId(id);
|
||||
caseApplicationsel.setAnnexType(7);
|
||||
List<CaseAttach> caseAttachs = caseAttachMapper.queryCaseAttachList(caseApplicationsel);
|
||||
if(caseAttachs!=null&&caseAttachs.size()>0){
|
||||
caseAttachMapper.deleteCaseAttachByCasedIdAndType(id,7);
|
||||
int count = caseAttachMapper.save(caseAttach);
|
||||
}else {
|
||||
int count = caseAttachMapper.save(caseAttach);
|
||||
}
|
||||
|
||||
return AjaxResult.success("上传成功");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return AjaxResult.error("上传失败");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*/
|
||||
private void recursionFn(List<CaseEvidenceDirectory> list, CaseEvidenceDirectory t) {
|
||||
// 得到子节点列表
|
||||
List<CaseEvidenceDirectory> childList = getChildList(list, t);
|
||||
t.setChildren(childList);
|
||||
for (CaseEvidenceDirectory tChild : childList) {
|
||||
if (hasChild(list, tChild)) {
|
||||
recursionFn(list, tChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到子节点列表
|
||||
*/
|
||||
private List<CaseEvidenceDirectory> getChildList(List<CaseEvidenceDirectory> list, CaseEvidenceDirectory t) {
|
||||
List<CaseEvidenceDirectory> tlist = new ArrayList<>();
|
||||
Iterator<CaseEvidenceDirectory> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
CaseEvidenceDirectory n = it.next();
|
||||
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue()) {
|
||||
tlist.add(n);
|
||||
}
|
||||
}
|
||||
return tlist;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否有子节点
|
||||
*/
|
||||
private boolean hasChild(List<CaseEvidenceDirectory> list, CaseEvidenceDirectory t) {
|
||||
return getChildList(list, t).size() > 0;
|
||||
}
|
||||
|
||||
private List<CaseEvidenceVO> getCaseEvidenceVOList(String identityNum, List<Integer> caseStatusList, Integer identityType) {
|
||||
List<CaseEvidenceVO> caseListByRespondent = caseEvidenceMapper.getCaseListByRespondent(identityNum, caseStatusList, identityType);
|
||||
// todo 返回房间号和开庭时间
|
||||
if (caseListByRespondent != null && caseListByRespondent.size() > 0) {
|
||||
for (CaseEvidenceVO caseEvidenceVO : caseListByRespondent) {
|
||||
//根据案件id查询姓名
|
||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||
caseAffiliate.setCaseAppliId(caseEvidenceVO.getId());
|
||||
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
|
||||
for (CaseAffiliate affiliate : caseAffiliates) {
|
||||
if (affiliate.getIdentityType() == 1) { //申请人
|
||||
caseEvidenceVO.setApplicantName(affiliate.getName());
|
||||
} else {
|
||||
caseEvidenceVO.setRespondentName(affiliate.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return caseListByRespondent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+328
@@ -0,0 +1,328 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdcardUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.SpringUtil;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author wangqiong
|
||||
* @description excel导入校验
|
||||
* @date 2023-12-11 11:45
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CaseImportValid {
|
||||
private CaseApplication caseApplication;
|
||||
private Map<String, Long> deptMap;
|
||||
// 手机号正则
|
||||
private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
|
||||
// 邮箱正则
|
||||
private static final Pattern EMAIL_PATTERN = Pattern.compile("^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$");
|
||||
private static SysUserMapper sysUserMapper= SpringUtil.getBean(SysUserMapper.class);
|
||||
|
||||
/**
|
||||
* 导入校验
|
||||
*
|
||||
* @param caseApplication
|
||||
* @param
|
||||
*/
|
||||
public void importValid(CaseApplication caseApplication, Map<String, Long> deptMap) {
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
caseApplication.setErrorMsg(failureMsg);
|
||||
// 校验基本字段
|
||||
validBaseColumn(caseApplication, failureMsg);
|
||||
// 校验申请人信息
|
||||
validApplicationColumn(caseApplication, failureMsg);
|
||||
// 校验申请人代理信息
|
||||
validApplicationAgentColumn(caseApplication, failureMsg, deptMap);
|
||||
// 校验被申请人信息
|
||||
validDebtorApplicationColumn(caseApplication, failureMsg);
|
||||
// 校验被申请人代理信息
|
||||
validDebtorApplicationAgentColumn(caseApplication, failureMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验被申请人代理信息
|
||||
*
|
||||
* @param caseApplication
|
||||
* @param failureMsg
|
||||
*/
|
||||
private void validDebtorApplicationAgentColumn(CaseApplication caseApplication, StringBuilder failureMsg) {
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorNameAgent())) {
|
||||
failureMsg.append("【被申请人主体信息-代理人姓名】字段不能为空;");
|
||||
} else if (caseApplication.getDebtorNameAgent().length() > 50) {
|
||||
failureMsg.append("【被申请人主体信息-代理人姓名】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNumAgent())) {
|
||||
failureMsg.append("【被申请人主体信息-代理人身份证号】字段不能为空;");
|
||||
} else if (!IdcardUtil.isValidCard((caseApplication.getDebtorIdentityNumAgent()))) {
|
||||
failureMsg.append("【被申请人主体信息-代理人身份证号】不合法;");
|
||||
}
|
||||
String debtorContactTelphoneAgent = caseApplication.getDebtorContactTelphoneAgent();
|
||||
if (StrUtil.isEmpty(debtorContactTelphoneAgent)) {
|
||||
failureMsg.append("【被申请人主体信息-代理人联系电话】字段不能为空;");
|
||||
} else if (!TELEPHONE_REGX.matcher(debtorContactTelphoneAgent).matches()) {
|
||||
failureMsg.append("【被申请人主体信息-代理人联系电话】字段不合法;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorContactAddressAgent())) {
|
||||
failureMsg.append("【被申请人主体信息-代理人联系地址】字段不能为空;");
|
||||
} else if (caseApplication.getDebtorContactAddressAgent().length() > 50) {
|
||||
failureMsg.append("【被申请人主体信息-代理人联系地址】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验被申请人信息
|
||||
*
|
||||
* @param caseApplication
|
||||
* @param failureMsg
|
||||
*/
|
||||
private void validDebtorApplicationColumn(CaseApplication caseApplication, StringBuilder failureMsg) {
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorName())) {
|
||||
failureMsg.append("【被申请人主体信息-申请人姓名】字段不能为空;");
|
||||
} else if (caseApplication.getDebtorName().length() > 50) {
|
||||
failureMsg.append("【被申请人主体信息-申请人姓名】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorIdentityNum())) {
|
||||
failureMsg.append("【被申请人主体信息-身份证号】字段不能为空;");
|
||||
} else if (!IdcardUtil.isValidCard(caseApplication.getDebtorIdentityNum())) {
|
||||
failureMsg.append("【被申请人主体信息-身份证号】不合法;");
|
||||
}
|
||||
String debtorContactTelphone = caseApplication.getDebtorContactTelphone();
|
||||
if (StrUtil.isEmpty(debtorContactTelphone)) {
|
||||
failureMsg.append("【被申请人主体信息-联系电话】字段不能为空;");
|
||||
} else if (!TELEPHONE_REGX.matcher(debtorContactTelphone).matches()) {
|
||||
failureMsg.append("【被申请人主体信息-联系电话】字段不合法;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorContactAddress())) {
|
||||
failureMsg.append("【被申请人主体信息-联系地址】字段不能为空;");
|
||||
} else if (caseApplication.getDebtorContactAddress().length() > 50) {
|
||||
failureMsg.append("【被申请人主体信息-联系地址】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
String debtorWorkTelphone = caseApplication.getDebtorWorkTelphone();
|
||||
if (StrUtil.isEmpty(debtorWorkTelphone)) {
|
||||
failureMsg.append("【被申请人主体信息-单位电话】字段不能为空;");
|
||||
} else if (!TELEPHONE_REGX.matcher(debtorWorkTelphone).matches()) {
|
||||
failureMsg.append("【被申请人主体信息-单位电话】字段不合法;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorWorkAddress())) {
|
||||
failureMsg.append("【被申请人主体信息-单位地址】字段不能为空;");
|
||||
} else if (caseApplication.getDebtorWorkAddress().length() > 50) {
|
||||
failureMsg.append("【被申请人主体信息-单位地址】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getResponSex())) {
|
||||
failureMsg.append("【被申请人主体信息-性别】字段不能为空;");
|
||||
} else if (caseApplication.getResponSex().length() > 1) {
|
||||
failureMsg.append("【被申请人主体信息-性别】字段超出指定长度,最大长度为1;");
|
||||
}
|
||||
if (caseApplication.getResponBirth() == null) {
|
||||
failureMsg.append("【被申请人主体信息-出生年月日】字段不合法;");
|
||||
} else if (caseApplication.getResponBirth().after(new Date())) {
|
||||
failureMsg.append("【被申请人主体信息-出生年月日】字段不合法,不能超过当前日期;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getDebtorEmail())) {
|
||||
failureMsg.append("【被申请人主体信息-邮箱】字段不能为空;");
|
||||
} else if (!EMAIL_PATTERN.matcher(caseApplication.getDebtorEmail()).matches()) {
|
||||
|
||||
failureMsg.append("【被申请人主体信息-邮箱】字段不合法;");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验申请人代理信息
|
||||
*
|
||||
* @param caseApplication
|
||||
* @param failureMsg
|
||||
*/
|
||||
private void validApplicationAgentColumn(CaseApplication caseApplication, StringBuilder failureMsg, Map<String, Long> deptMap) {
|
||||
if (StrUtil.isEmpty(caseApplication.getNameAgent())) {
|
||||
failureMsg.append("【申请人主体信息-代理人姓名】字段不能为空;");
|
||||
} else if (caseApplication.getNameAgent().length() > 50) {
|
||||
failureMsg.append("【申请人主体信息-代理人姓名】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getIdentityNumAgent())) {
|
||||
failureMsg.append("【申请人主体信息-代理人身份证号】字段不能为空;");
|
||||
} else if (!IdcardUtil.isValidCard(caseApplication.getIdentityNumAgent())) {
|
||||
failureMsg.append("【申请人主体信息-代理人身份证号】不合法;");
|
||||
}
|
||||
validAgentInfo(caseApplication, failureMsg, deptMap);
|
||||
String contactTelphoneAgent = caseApplication.getContactTelphoneAgent();
|
||||
if (StrUtil.isEmpty(contactTelphoneAgent)) {
|
||||
failureMsg.append("【申请人主体信息-代理人联系电话】字段不能为空;");
|
||||
} else if (!TELEPHONE_REGX.matcher(contactTelphoneAgent).matches()) {
|
||||
failureMsg.append("【申请人主体信息-代理人联系电话】字段不合法;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getContactAddressAgent())) {
|
||||
failureMsg.append("【申请人主体信息-代理人联系地址】字段不能为空;");
|
||||
} else if (caseApplication.getContactAddressAgent().length() > 50) {
|
||||
failureMsg.append("【申请人主体信息-代理人联系地址】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验代理人与组织机构关系
|
||||
*
|
||||
* @param caseApplication
|
||||
* @param failureMsg
|
||||
* @return
|
||||
*/
|
||||
private void validAgentInfo(CaseApplication caseApplication, StringBuilder failureMsg, Map<String, Long> deptMap) {
|
||||
// 申请机构与代理人都不为空,校验代理人与组织机构关系(代理人必须在该部门下)
|
||||
if (StrUtil.isNotEmpty(caseApplication.getName()) && StrUtil.isNotEmpty(caseApplication.getNameAgent())) {
|
||||
String applicationOrganId = "";
|
||||
// 申请机构已经存在
|
||||
if (deptMap.containsKey(caseApplication.getName())) {
|
||||
applicationOrganId = String.valueOf(deptMap.get(caseApplication.getName()));
|
||||
}
|
||||
// 根据代理人身份证去用户表查询
|
||||
SysUser agentUser = sysUserMapper.selectUserByIdCard(caseApplication.getIdentityNumAgent());
|
||||
// 代理人的部门和申请机构不匹配
|
||||
if (null != agentUser && null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(applicationOrganId)) {
|
||||
// return "该申请代理人已在"+agentUser.getDeptName()+"申请机构下存在,请检查填写信息是否正确";
|
||||
if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) {
|
||||
failureMsg.append("该申请代理人已在【").append(agentUser.getDept().getDeptName()).append("】申请机构下存在,请检查填写信息是否正确");
|
||||
} else {
|
||||
failureMsg.append("该申请代理人已存在,与申请机构不匹配,请检查填写信息是否正确");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验申请人主题信息
|
||||
*
|
||||
* @param caseApplication
|
||||
* @param failureMsg
|
||||
*/
|
||||
private void validApplicationColumn(CaseApplication caseApplication, StringBuilder failureMsg) {
|
||||
if (StrUtil.isEmpty(caseApplication.getName())) {
|
||||
failureMsg.append("【申请人主体信息-申请人(机构)】字段不能为空;");
|
||||
} else if (caseApplication.getName().length() > 20) {
|
||||
failureMsg.append("【申请人主体信息-申请人(机构)】字段超出指定长度,最大长度为20;");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(caseApplication.getIdentityNum()) && caseApplication.getIdentityNum().length() > 50) {
|
||||
failureMsg.append("【申请人主体信息-代码】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
String contactTelphone = caseApplication.getContactTelphone();
|
||||
if (StrUtil.isEmpty(contactTelphone)) {
|
||||
failureMsg.append("【申请人主体信息-联系电话】字段不能为空;");
|
||||
} else if (!TELEPHONE_REGX.matcher(contactTelphone).matches()) {
|
||||
failureMsg.append("【申请人主体信息-联系电话】字段不合法;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getContactAddress())) {
|
||||
failureMsg.append("【申请人主体信息-联系地址】字段不能为空;");
|
||||
} else if (caseApplication.getName().length() > 50) {
|
||||
failureMsg.append("【申请人主体信息-联系地址】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
String workTelphone = caseApplication.getWorkTelphone();
|
||||
if (StrUtil.isEmpty(workTelphone)) {
|
||||
failureMsg.append("【申请人主体信息-单位电话】字段不能为空;");
|
||||
} else if (!TELEPHONE_REGX.matcher(workTelphone).matches()) {
|
||||
failureMsg.append("【申请人主体信息-单位电话】字段不合法;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getWorkAddress())) {
|
||||
failureMsg.append("【申请人主体信息-单位地址】字段不能为空;");
|
||||
} else if (caseApplication.getWorkAddress().length() > 50) {
|
||||
failureMsg.append("【申请人主体信息-单位地址】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getEmail())) {
|
||||
failureMsg.append("【申请人主体信息-邮箱】字段不能为空;");
|
||||
} else if (!EMAIL_PATTERN.matcher(caseApplication.getEmail()).matches()) {
|
||||
|
||||
failureMsg.append("【申请人主体信息-邮箱】字段不合法;");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验基本字段
|
||||
*
|
||||
* @param caseApplication
|
||||
* @param failureMsg
|
||||
*/
|
||||
private void validBaseColumn(CaseApplication caseApplication, StringBuilder failureMsg) {
|
||||
if (StrUtil.isEmpty(caseApplication.getCaseName())) {
|
||||
failureMsg.append("【案件名称】字段不能为空;");
|
||||
} else if (caseApplication.getCaseName().length() > 50) {
|
||||
failureMsg.append("【案件名称】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
BigDecimal caseSubjectAmount = caseApplication.getCaseSubjectAmount();
|
||||
if (null == caseSubjectAmount) {
|
||||
failureMsg.append("【案件标的】字段不合法;");
|
||||
} else {
|
||||
if (caseSubjectAmount.compareTo(new BigDecimal("0")) < 0 || caseSubjectAmount.compareTo(new BigDecimal("99999999.99")) > 0) {
|
||||
failureMsg.append("【案件标的】字段超出范围,范围为[0,100000000);");
|
||||
}
|
||||
if (caseSubjectAmount.scale() > 2) {
|
||||
failureMsg.append("【案件标的】字段超出指定精度(10^-2);");
|
||||
}
|
||||
}
|
||||
if (caseApplication.getLoanStartDate() == null) {
|
||||
failureMsg.append("【借款开始日期】字段不合法;");
|
||||
}
|
||||
if (caseApplication.getLoanEndDate() == null) {
|
||||
failureMsg.append("【借款结束日期】字段不合法;");
|
||||
}
|
||||
if (caseApplication.getLoanStartDate() != null && caseApplication.getLoanEndDate() != null && caseApplication.getLoanStartDate().after(caseApplication.getLoanEndDate())) {
|
||||
failureMsg.append("【借款结束日期】不能早于【借款开始日期】;");
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getContractNumber())) {
|
||||
failureMsg.append("【合同编号】字段不能为空;");
|
||||
} else if (caseApplication.getContractNumber().length() > 50) {
|
||||
failureMsg.append("【合同编号】字段超出指定长度,最大长度为50;");
|
||||
}
|
||||
BigDecimal claimPrinciOwed = caseApplication.getClaimPrinciOwed();
|
||||
if (null == claimPrinciOwed) {
|
||||
failureMsg.append("【申请人主张欠本金】字段不合法;");
|
||||
} else {
|
||||
if (claimPrinciOwed.compareTo(new BigDecimal("0")) < 0 || claimPrinciOwed.compareTo(new BigDecimal("99999999.99")) > 0) {
|
||||
failureMsg.append("【申请人主张欠本金】字段超出范围,范围为[0,100000000);");
|
||||
}
|
||||
if (claimPrinciOwed.scale() > 2) {
|
||||
failureMsg.append("【申请人主张欠本金】字段超出指定精度(10^-2);");
|
||||
}
|
||||
}
|
||||
BigDecimal claimInterestOwed = caseApplication.getClaimInterestOwed();
|
||||
if (null == claimInterestOwed) {
|
||||
failureMsg.append("【申请人主张欠利息】字段不合法;");
|
||||
} else {
|
||||
if (claimInterestOwed.compareTo(new BigDecimal("0")) < 0 || claimInterestOwed.compareTo(new BigDecimal("99999999.99")) > 0) {
|
||||
failureMsg.append("【申请人主张欠利息】字段超出范围,范围为[0,100000000);");
|
||||
}
|
||||
if (claimInterestOwed.scale() > 2) {
|
||||
failureMsg.append("【申请人主张欠利息】字段超出指定精度(10^-2);");
|
||||
}
|
||||
}
|
||||
BigDecimal claimLiquidDamag = caseApplication.getClaimLiquidDamag();
|
||||
if (null == claimLiquidDamag) {
|
||||
failureMsg.append("【申请人主张违约金】字段不合法;");
|
||||
} else {
|
||||
if (claimLiquidDamag.compareTo(new BigDecimal("0")) < 0 || claimLiquidDamag.compareTo(new BigDecimal("99999999.99")) > 0) {
|
||||
failureMsg.append("【申请人主张违约金】字段超出范围,范围为[0,100000000);");
|
||||
}
|
||||
if (claimLiquidDamag.scale() > 2) {
|
||||
failureMsg.append("【申请人主张违约金】字段超出指定精度(10^-2);");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isEmpty(caseApplication.getArbitratClaims())) {
|
||||
failureMsg.append("【申请人仲裁请求及事实和理由】字段不能为空;");
|
||||
} else if (caseApplication.getArbitratClaims().length() > 10000) {
|
||||
failureMsg.append("【申请人仲裁请求及事实和理由】字段超出指定长度,最大长度为10000;");
|
||||
}
|
||||
if (StrUtil.isNotEmpty(caseApplication.getArbitratClaims()) && caseApplication.getArbitratClaims().length() > 10000) {
|
||||
failureMsg.append("【申请人请求仲裁庭裁决】字段超出指定长度,最大长度为10000;");
|
||||
}
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseLogRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class CaseLogRecordServiceImpl implements ICaseLogRecordService {
|
||||
@Autowired
|
||||
private CaseLogRecordMapper caseLogRecordMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CaseLogRecord> selectCaseLogRecordList(CaseLogRecord caseLogRecord) {
|
||||
List<CaseLogRecord> records = caseLogRecordMapper.selectCaseLogRecordList(caseLogRecord);
|
||||
if(CollectionUtil.isNotEmpty(records)){
|
||||
records.forEach(record->{
|
||||
StringBuilder contentBuilder = new StringBuilder();
|
||||
String caseNodeTime="";
|
||||
if(record.getCaseNodeTime()!=null){
|
||||
caseNodeTime= DateUtil.format(record.getCaseNodeTime(), DatePattern.NORM_DATETIME_FORMATTER);
|
||||
}
|
||||
|
||||
contentBuilder.append(Optional.ofNullable(record.getCreateNickName()).orElse("")).append("(").append(record.getCreateBy()).append(")").append("于").append(caseNodeTime);
|
||||
if(StrUtil.isNotEmpty(record.getContent())){
|
||||
contentBuilder.append(record.getContent());
|
||||
}
|
||||
if(StrUtil.isNotEmpty(record.getNotes())){
|
||||
contentBuilder.append(",").append(record.getNotes());
|
||||
}
|
||||
record.setContent(contentBuilder.toString());
|
||||
|
||||
});
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseNumRule;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseNumRuleMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseNumRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class CaseNumRuleServiceImpl implements ICaseNumRuleService {
|
||||
@Autowired
|
||||
private CaseNumRuleMapper caseNumRuleMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult insertCaseNumRule(CaseNumRule caseNumRule) {
|
||||
int countCaseNumRule = caseNumRuleMapper.countCaseNumRule(caseNumRule);
|
||||
if (countCaseNumRule>0){
|
||||
return AjaxResult.error("不能新增相同案件编号规则");
|
||||
}
|
||||
int i = caseNumRuleMapper.insertCaseNumRule(caseNumRule);
|
||||
if (i>0){
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
return AjaxResult.error("新增失败");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult updateCaseNumRule(CaseNumRule caseNumRule) {
|
||||
int countCaseNumRule = caseNumRuleMapper.countCaseNumRule(caseNumRule);
|
||||
if (countCaseNumRule>0){
|
||||
return AjaxResult.error("不能修改相同案件编号规则");
|
||||
}
|
||||
int i = caseNumRuleMapper.updateCaseNumRule(caseNumRule);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
return AjaxResult.error("新增失败");
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult deleteCaseNumRule(CaseNumRule caseNumRule) {
|
||||
int i = caseNumRuleMapper.deleteCaseNumRule(caseNumRule);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaseNumRule> selectCaseNumRule(CaseNumRule caseNumRule) {
|
||||
return caseNumRuleMapper.selectCaseNumRules(caseNumRule);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+491
@@ -0,0 +1,491 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ruoyi.ElegentPay;
|
||||
import com.ruoyi.common.constant.CaseApplicationConstants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CasePayListVO;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
||||
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.dto.PayRequest;
|
||||
import com.ruoyi.dto.PayResponse;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICasePaymentService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
@Service
|
||||
public class CasePaymentServiceImpl implements ICasePaymentService {
|
||||
private final ElegentPay elegentPay;
|
||||
private final CaseApplicationMapper caseApplicationMapper;
|
||||
private final CasePaymentRecordMapper casePaymentRecordMapper;
|
||||
private final CaseAffiliateMapper caseAffiliateMapper;
|
||||
@Autowired
|
||||
private CaseAttachMapper caseAttachMapper;
|
||||
@Autowired
|
||||
private SmsRecordMapper smsRecordMapper;
|
||||
|
||||
@Autowired
|
||||
public CasePaymentServiceImpl(ElegentPay elegentPay
|
||||
, CaseApplicationMapper caseApplicationMapper
|
||||
, CasePaymentRecordMapper casePaymentRecordMapper
|
||||
, CaseAffiliateMapper caseAffiliateMapper
|
||||
) {
|
||||
this.elegentPay = elegentPay;
|
||||
this.caseApplicationMapper = caseApplicationMapper;
|
||||
this.casePaymentRecordMapper = casePaymentRecordMapper;
|
||||
this.caseAffiliateMapper = caseAffiliateMapper;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ICaseApplicationService caseApplicationService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult casePay(CasePayDTO casePayDTO) {
|
||||
PayRequest payRequest = new PayRequest();
|
||||
payRequest.setBody("案件缴费");
|
||||
payRequest.setOrderSn(System.currentTimeMillis() + "");
|
||||
payRequest.setTotalFee(casePayDTO.getTotalFee());
|
||||
PayResponse response = elegentPay.requestPay(payRequest, casePayDTO.getTradeType(), casePayDTO.getPlatform());
|
||||
if (response.getCode_url() == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
List<Long> caseIds = casePayDTO.getCaseIds();
|
||||
if (CollectionUtil.isEmpty(caseIds)) {
|
||||
return AjaxResult.error("请检查参数是否有误");
|
||||
}
|
||||
for (Long caseId : caseIds) {
|
||||
//缴费记录表里新增数据
|
||||
CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
||||
casePaymentRecord.setCaseId(caseId);
|
||||
casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
|
||||
casePaymentRecord.setPaymentStatus(0);
|
||||
casePaymentRecord.setCreateTime(new Date());
|
||||
int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
|
||||
if (count < 1) {
|
||||
return AjaxResult.error("请检查参数是否有误");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(response);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public AjaxResult callback(String orderNumber) {
|
||||
//查询记录
|
||||
List<CasePaymentRecord> casePaymentRecords = casePaymentRecordMapper.queryRecord(orderNumber);
|
||||
if(casePaymentRecords!=null&&casePaymentRecords.size()>0){
|
||||
for (CasePaymentRecord casePaymentRecord:casePaymentRecords){
|
||||
Long caseId = casePaymentRecord.getCaseId();
|
||||
//更改记录表里的支付状态和支付时间
|
||||
casePaymentRecord.setPaymentStatus(1);
|
||||
casePaymentRecord.setPaymentTime(new Date());
|
||||
casePaymentRecord.setUpdateTime(new Date());
|
||||
casePaymentRecordMapper.update(casePaymentRecord);
|
||||
}
|
||||
}else {
|
||||
return AjaxResult.error("未查询到相关记录");
|
||||
}
|
||||
return AjaxResult.success("支付成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult confirmPayment( List<Long> ids) {
|
||||
for (Long id : ids) {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(id);
|
||||
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CROSSEXAMI);
|
||||
caseApplicationMapper.submitCaseApplication(caseApplication);
|
||||
//发送短信通知
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||
caseAffiliate.setCaseAppliId(caseApplication.getId());
|
||||
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息
|
||||
if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
||||
for (CaseAffiliate affiliate : caseAffiliates) {
|
||||
//获取身份类型
|
||||
int identityType = affiliate.getIdentityType();
|
||||
//查询案件详细信息
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
if (caseApplication1 == null) {
|
||||
continue;
|
||||
}
|
||||
String caseName = "仲裁"; //这里案件名称表里未定义,暂时写死
|
||||
String caseNum = caseApplication1.getCaseNum();
|
||||
if (identityType == 1) { //申请人
|
||||
request.setPhone(affiliate.getContactTelphone());
|
||||
request.setTemplateId("1928003"); //传入申请人模板id
|
||||
// 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置
|
||||
// 模板id:1928003 普通短信 案件受理通知
|
||||
String name = affiliate.getName();
|
||||
request.setTemplateParamSet(new String[]{name, caseName, caseNum});
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
//保存短信发送记录
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord();
|
||||
smsSendRecord.setCaseId(caseApplication.getId());
|
||||
smsSendRecord.setCaseNum(caseNum);
|
||||
smsSendRecord.setPhone(request.getPhone());
|
||||
smsSendRecord.setSendTime(new Date());
|
||||
String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理。";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean) {
|
||||
smsSendRecord.setSendStatus(1);
|
||||
} else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
} else { //被申请人
|
||||
|
||||
request.setPhone(affiliate.getContactTelphone());
|
||||
request.setTemplateId("1952840");
|
||||
// 1952840 尊敬的{1}用户,您的{2}案件{3}已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信
|
||||
String name = affiliate.getName();
|
||||
request.setTemplateParamSet(new String[]{name, caseName, caseNum});
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
//保存短信发送记录
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord();
|
||||
smsSendRecord.setCaseId(caseApplication.getId());
|
||||
smsSendRecord.setCaseNum(caseNum);
|
||||
smsSendRecord.setPhone(request.getPhone());
|
||||
smsSendRecord.setSendTime(new Date());
|
||||
String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean) {
|
||||
smsSendRecord.setSendStatus(1);
|
||||
} else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
}
|
||||
}
|
||||
//更改记录表里的支付状态和支付时间
|
||||
CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
||||
casePaymentRecord.setPaymentStatus(1);
|
||||
casePaymentRecord.setPaymentTime(new Date());
|
||||
casePaymentRecord.setUpdateTime(new Date());
|
||||
casePaymentRecordMapper.update(casePaymentRecord);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_CROSSEXAMI, "");
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult confirmPay(CaseConfirmPayDTO payDTO) {
|
||||
List<Long> caseIds = payDTO.getCaseIds();
|
||||
if (caseIds == null || caseIds.size() == 0) {
|
||||
return AjaxResult.error("案件id参数有误");
|
||||
}
|
||||
if (payDTO.getPayType() != null) {
|
||||
// 修改支付方式
|
||||
caseApplicationMapper.updatePayType(payDTO);
|
||||
}
|
||||
for (Long caseId : caseIds) {
|
||||
if (CollectionUtil.isNotEmpty(payDTO.getPayOrderList())) {
|
||||
for (CaseAttach caseAttach : payDTO.getPayOrderList()) {
|
||||
caseAttach.setCaseAppliId(caseId);
|
||||
caseAttachMapper.updateCaseAttach(caseAttach);
|
||||
}
|
||||
}
|
||||
// 修改节点状态
|
||||
//根据案件id查询案件信息
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseId);
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
|
||||
//修改案件状态
|
||||
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
|
||||
if (i > 0) {
|
||||
// 修改支付状态
|
||||
CasePaymentRecord paymentRecord = new CasePaymentRecord();
|
||||
paymentRecord.setPayType(payDTO.getPayType());
|
||||
paymentRecord.setCaseId(caseId);
|
||||
paymentRecord.setPaymentStatus(1);
|
||||
casePaymentRecordMapper.saveRecord(paymentRecord);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT_CONFIRM, "");
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success("确认缴费成功");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult casePayList(CasePayDTO casePayDTO) {
|
||||
//参数校验
|
||||
List<Long> caseIds = casePayDTO.getCaseIds();
|
||||
if (caseIds == null || caseIds.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
BigDecimal totalCost = new BigDecimal(0);
|
||||
BigDecimal sum = totalCost;
|
||||
CasePayListVO listVO = new CasePayListVO();
|
||||
listVO.setCaseTotal(caseIds.size());
|
||||
List<CaseApplicationPay> caseApplicationList = new ArrayList<>();
|
||||
for (Long caseId : caseIds) {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
CaseApplicationPay caseApplicationPay = new CaseApplicationPay();
|
||||
caseApplication.setId(caseId);
|
||||
CaseApplication caseApplication1 = caseApplicationService.selectCaseApplication(caseApplication);
|
||||
BigDecimal feePayable = caseApplication1.getFeePayable();
|
||||
sum = sum.add(feePayable);
|
||||
listVO.setTotalFee(sum);
|
||||
caseApplicationPay.setCaseAppName(caseApplication1.getApplicantName());
|
||||
caseApplicationPay.setCaseResName(caseApplication1.getRespondentName());
|
||||
caseApplicationPay.setCaseNum(caseApplication1.getCaseNum());
|
||||
caseApplicationPay.setCaseStatus(caseApplication1.getCaseStatus());
|
||||
caseApplicationPay.setCaseSubjectAmount(caseApplication1.getCaseSubjectAmount());
|
||||
caseApplicationPay.setFeePayable(caseApplication1.getFeePayable());
|
||||
caseApplicationList.add(caseApplicationPay);
|
||||
listVO.setCaseApplicationList(caseApplicationList);
|
||||
}
|
||||
|
||||
if (sum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return AjaxResult.error("没有可支付的费用");
|
||||
}
|
||||
return AjaxResult.success(listVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult confirmPayBatch(CasePayDTO payDTO) {
|
||||
|
||||
String batchNumber = payDTO.getBatchNumber();
|
||||
CaseApplication caseApplicationsel = new CaseApplication();
|
||||
caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber));
|
||||
caseApplicationsel.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT);
|
||||
List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
|
||||
List<Long> caseIds = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList());
|
||||
if(caseApplications!=null&&caseApplications.size()>0){
|
||||
if (payDTO.getPayType() != null) {
|
||||
payDTO.setCaseIds(caseIds);
|
||||
// 修改支付方式
|
||||
CaseConfirmPayDTO caseConfirmPayDTO = new CaseConfirmPayDTO();
|
||||
BeanUtils.copyProperties(payDTO, caseConfirmPayDTO);
|
||||
caseApplicationMapper.updatePayType(caseConfirmPayDTO);
|
||||
}
|
||||
for (Long caseId : caseIds) {
|
||||
if (CollectionUtil.isNotEmpty(payDTO.getPayOrderList())) {
|
||||
for (CaseAttach caseAttach : payDTO.getPayOrderList()) {
|
||||
caseAttach.setCaseAppliId(caseId);
|
||||
caseAttachMapper.updateCaseAttach(caseAttach);
|
||||
}
|
||||
}
|
||||
|
||||
// 修改节点状态
|
||||
//根据案件id查询案件信息
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseId);
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
|
||||
//修改案件状态
|
||||
int i = caseApplicationMapper.submitCaseApplication(caseApplication1);
|
||||
if (i > 0) {
|
||||
// 修改支付状态
|
||||
CasePaymentRecord paymentRecord = new CasePaymentRecord();
|
||||
paymentRecord.setPayType(payDTO.getPayType());
|
||||
paymentRecord.setCaseId(caseId);
|
||||
paymentRecord.setPaymentStatus(1);
|
||||
casePaymentRecordMapper.saveRecord(paymentRecord);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.PENDING_PAYMENT_CONFIRM, "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
throw new ServiceException("这个批号没有批量缴费的案件");
|
||||
}
|
||||
|
||||
return AjaxResult.success("确认缴费成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult casePayListBatch(CasePayDTO casePayDTO) {
|
||||
String batchNumber = casePayDTO.getBatchNumber();
|
||||
CaseApplication caseApplicationsel = new CaseApplication();
|
||||
caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber));
|
||||
// caseApplicationsel.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT);
|
||||
List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
|
||||
CasePayListVO listVO = new CasePayListVO();
|
||||
BigDecimal sum = new BigDecimal(0);
|
||||
if(caseApplications!=null&&caseApplications.size()>0){
|
||||
for(CaseApplication caseApplication:caseApplications){
|
||||
BigDecimal feePayable = caseApplication.getFeePayable();
|
||||
sum = sum.add(feePayable);
|
||||
}
|
||||
listVO.setTotalFee(sum);
|
||||
}
|
||||
if (sum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return AjaxResult.error("没有可支付的费用");
|
||||
}
|
||||
return AjaxResult.success(listVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult confirmPaymentBatch(String batchNumber) {
|
||||
CaseApplication caseApplicationsel = new CaseApplication();
|
||||
caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber));
|
||||
caseApplicationsel.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
|
||||
List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
|
||||
|
||||
if (caseApplications != null && caseApplications.size() > 0) {
|
||||
List<Long> caseIds = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList());
|
||||
for (Long caseId : caseIds) {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseId);
|
||||
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CROSSEXAMI);
|
||||
caseApplicationMapper.submitCaseApplication(caseApplication);
|
||||
//发送短信通知
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
CaseAffiliate caseAffiliate = new CaseAffiliate();
|
||||
caseAffiliate.setCaseAppliId(caseApplication.getId());
|
||||
List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息
|
||||
if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
||||
for (CaseAffiliate affiliate : caseAffiliates) {
|
||||
//获取身份类型
|
||||
int identityType = affiliate.getIdentityType();
|
||||
//查询案件详细信息
|
||||
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
||||
if (caseApplication1 == null) {
|
||||
continue;
|
||||
}
|
||||
String caseName = "仲裁"; //这里案件名称表里未定义,暂时写死
|
||||
String caseNum = caseApplication1.getCaseNum();
|
||||
if (identityType == 1) { //申请人
|
||||
request.setPhone(affiliate.getContactTelphone());
|
||||
request.setTemplateId("1928003"); //传入申请人模板id
|
||||
// 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置
|
||||
// 模板id:1928003 普通短信 案件受理通知
|
||||
String name = affiliate.getName();
|
||||
request.setTemplateParamSet(new String[]{name, caseName, caseNum});
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
//保存短信发送记录
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord();
|
||||
smsSendRecord.setCaseId(caseApplication.getId());
|
||||
smsSendRecord.setCaseNum(caseNum);
|
||||
smsSendRecord.setPhone(request.getPhone());
|
||||
smsSendRecord.setSendTime(new Date());
|
||||
String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理。";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean) {
|
||||
smsSendRecord.setSendStatus(1);
|
||||
} else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
} else { //被申请人
|
||||
|
||||
request.setPhone(affiliate.getContactTelphone());
|
||||
request.setTemplateId("1952840");
|
||||
// 1952840 尊敬的{1}用户,您的{2}案件{3}已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信
|
||||
String name = affiliate.getName();
|
||||
request.setTemplateParamSet(new String[]{name, caseName, caseNum});
|
||||
Boolean aBoolean = SmsUtils.sendSms(request);
|
||||
//保存短信发送记录
|
||||
SmsSendRecord smsSendRecord = new SmsSendRecord();
|
||||
smsSendRecord.setCaseId(caseApplication.getId());
|
||||
smsSendRecord.setCaseNum(caseNum);
|
||||
smsSendRecord.setPhone(request.getPhone());
|
||||
smsSendRecord.setSendTime(new Date());
|
||||
String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean) {
|
||||
smsSendRecord.setSendStatus(1);
|
||||
} else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
}
|
||||
}
|
||||
//更改记录表里的支付状态和支付时间
|
||||
CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
||||
casePaymentRecord.setPaymentStatus(1);
|
||||
casePaymentRecord.setCaseId(caseId);
|
||||
casePaymentRecord.setPaymentTime(new Date());
|
||||
casePaymentRecord.setUpdateTime(new Date());
|
||||
casePaymentRecordMapper.update(casePaymentRecord);
|
||||
// 新增日志
|
||||
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_CROSSEXAMI, "");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
throw new ServiceException("这个批号没有批量缴费确认的案件");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult casePayBatch(CasePayDTO casePayDTO) {
|
||||
PayRequest payRequest = new PayRequest();
|
||||
payRequest.setBody("案件缴费");
|
||||
payRequest.setOrderSn(System.currentTimeMillis() + "");
|
||||
payRequest.setTotalFee(casePayDTO.getTotalFee());
|
||||
PayResponse response = elegentPay.requestPay(payRequest, casePayDTO.getTradeType(), casePayDTO.getPlatform());
|
||||
if (response.getCode_url() == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
String batchNumber = casePayDTO.getBatchNumber();
|
||||
if(StringUtils.isEmpty(batchNumber) ){
|
||||
return AjaxResult.error("请检查参数是否有误");
|
||||
}
|
||||
CaseApplication caseApplicationsel = new CaseApplication();
|
||||
caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber));
|
||||
caseApplicationsel.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT);
|
||||
List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
|
||||
if(caseApplications!=null&&caseApplications.size()>0){
|
||||
List<Long> caseIds = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList());
|
||||
for (Long caseId : caseIds) {
|
||||
//缴费记录表里新增数据
|
||||
CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
||||
casePaymentRecord.setCaseId(caseId);
|
||||
casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
|
||||
casePaymentRecord.setPaymentStatus(0);
|
||||
casePaymentRecord.setCreateTime(new Date());
|
||||
int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
|
||||
if (count < 1) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return AjaxResult.success(response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+1035
File diff suppressed because it is too large
Load Diff
+652
@@ -0,0 +1,652 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.FileTransformation;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
|
||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||
import com.ruoyi.common.core.domain.entity.SysDictData;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.exception.EsignDemoException;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SealUtil;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.system.domain.SysUserPost;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysDictDataMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.TemplateFatchRule;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
|
||||
import com.ruoyi.wisdomarbitrate.utils.SignAward;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.TemplateFatchRuleMapper;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.ruoyi.common.utils.PageUtils.startPage;
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
||||
@Service
|
||||
public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
||||
|
||||
@Autowired
|
||||
private DeptIdentifyMapper deptIdentifyMapper;
|
||||
@Autowired
|
||||
private CaseAttachMapper caseAttachMapper;
|
||||
@Autowired
|
||||
private SealManageMapper sealManageMapper;
|
||||
@Autowired
|
||||
private SysDeptMapper sysDeptMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private TemplateManageMapper templateManageMapper;
|
||||
@Autowired
|
||||
private SysUserPostMapper sysUserPostMapper;
|
||||
@Autowired
|
||||
private TemplateFatchRuleMapper templateFatchRuleMapper;
|
||||
@Autowired
|
||||
private FatchRuleMapper fatchRuleMapper;
|
||||
@Autowired
|
||||
private SysDictDataMapper dictDataMapper;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
|
||||
return deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException {
|
||||
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
DeptIdentify deptIdentifynew = new DeptIdentify();
|
||||
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
|
||||
Gson gson = new Gson();
|
||||
DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
|
||||
EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
|
||||
JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
|
||||
int code = signUrlJsonObject.get("code").getAsInt();
|
||||
if (code == 0) {
|
||||
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
|
||||
String url = signUrlData.get("authUrl").getAsString();
|
||||
//获取本次认证授权流程ID
|
||||
String authFlowId = signUrlData.get("authFlowId").getAsString();
|
||||
deptIdentify.setAuthFlowId(authFlowId);
|
||||
deptIdentifynew.setIdentifyUrl(url);
|
||||
deptIdentify.setIdentifyDate(new Date());
|
||||
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
|
||||
}
|
||||
}
|
||||
return deptIdentifynew;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult enableDept(DeptIdentify deptIdentify) {
|
||||
//参数校验
|
||||
if (deptIdentify.getId() == null) {
|
||||
return AjaxResult.error("请检查参数");
|
||||
}
|
||||
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
|
||||
Integer identifyStatus = deptIdentifyselect.getIdentifyStatus();
|
||||
if (identifyStatus != 1) {
|
||||
return AjaxResult.error("这个认证数据未进行认证,不能启用");
|
||||
}
|
||||
deptIdentifyselect.setIsUse(1);
|
||||
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
|
||||
if (i > 0) {
|
||||
//把其他认证数据置为未使用
|
||||
DeptIdentify deptIdentify2 = new DeptIdentify();
|
||||
deptIdentify2.setIsUse(1);
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify2);
|
||||
for (DeptIdentify deptIdentify3 : deptIdentifies) {
|
||||
if (deptIdentify3.equals(deptIdentifyselect)) {
|
||||
continue;
|
||||
}
|
||||
deptIdentify3.setIsUse(0);
|
||||
deptIdentifyMapper.updateDeptIdentify(deptIdentify3);
|
||||
}
|
||||
return AjaxResult.success("启用成功");
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult sealUpload(Long id, String sealName, MultipartFile file) {
|
||||
try {
|
||||
if (file.isEmpty()) {
|
||||
return AjaxResult.error("请选择要上传的文件");
|
||||
}
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
DeptIdentify deptIdentify = new DeptIdentify();
|
||||
deptIdentify.setId(id);
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
||||
for (DeptIdentify identify : deptIdentifies) {
|
||||
//先判断企业用户是否授予资源管理权限
|
||||
String authFlowId = identify.getAuthFlowId();
|
||||
if (authFlowId == null) {
|
||||
return AjaxResult.error("改机构尚未认证,不能上传自定义公章");
|
||||
}
|
||||
EsignHttpResponse response1 = SealUtil.queryAuthProcess(authFlowId);
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
|
||||
int authorizedStatus = jsonObject1.getJSONObject("data").getIntValue("authorizedStatus");
|
||||
if (authorizedStatus == 1) {//授权流程状态 0流程过期失效 1已授权 2授权中 3审批未通过
|
||||
String prefix = "/profile";
|
||||
int startIndex = fileName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
|
||||
//创建机构图片印章
|
||||
//String annexPath = "D:\\develop\\2.jpg";
|
||||
|
||||
EsignHttpResponse response = SignAward.createOrgByImage(identify, sealName, annexPath);
|
||||
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
|
||||
int code = jsonObject.getIntValue("code");
|
||||
if (code == 0) { //业务码,0表示成功,非0表示异常。
|
||||
String sealId = jsonObject.getJSONObject("data").getString("sealId");
|
||||
//保存到表里
|
||||
SealManage sealManage = new SealManage();
|
||||
sealManage.setIdentifyId(identify.getId());
|
||||
sealManage.setSealName(sealName);
|
||||
sealManage.setSealId(sealId);
|
||||
sealManage.setSealStatus(0); //默认为未审核
|
||||
sealManage.setIsUse(0); //默认为禁用
|
||||
int i = sealManageMapper.insertSealManage(sealManage);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("上传成功");
|
||||
}
|
||||
}
|
||||
return AjaxResult.error(jsonObject.getString("message"));
|
||||
}
|
||||
return AjaxResult.error("企业用户未授予资源管理权限");
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (EsignDemoException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult receiveNotify(String body) {
|
||||
/* 请求Body数据格式如下:
|
||||
{
|
||||
"action":"SEAL_AUDIT",
|
||||
"auditStatus":1,
|
||||
"psnId":"c7e00294**41e7",
|
||||
"rejectReason":"",
|
||||
"sealBizType":"COMMON",
|
||||
"sealId":"af80ba0f-xx-xx-xx-a2da292d7f7f",
|
||||
"sealName":"赵四的图片印章",
|
||||
"statusDescription":"通过"
|
||||
}*/
|
||||
//解析body数据
|
||||
try {
|
||||
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||
String action = jsonObject.getString("action");
|
||||
if (action.equals("SEAL_AUDIT")) { //SEAL_AUDIT表示图片印章审核结果通知
|
||||
String auditStatus = jsonObject.getString("auditStatus");
|
||||
if (auditStatus.equals("1")) { //图片印章审核结果 1通过 ,0驳回
|
||||
//审核通过,拿到印章id和机构账号ID
|
||||
String orgId = jsonObject.getString("orgId");
|
||||
String sealId = jsonObject.getString("sealId");
|
||||
//查询指定印章详情(机构)
|
||||
EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId);
|
||||
JSONObject jsonObject1 = JSONObject.parseObject(response.getBody());
|
||||
if (jsonObject1.getIntValue("code") == 0) { //业务码,0表示成功,非0表示异常。
|
||||
int sealStatus = jsonObject1.getJSONObject("data").getIntValue("sealStatus");
|
||||
if (sealStatus == 1) { //印章状态 1已启用,2待审核,3审核不通过,4 挂起
|
||||
String sealImageDownloadUrl = jsonObject1.getString("sealImageDownloadUrl");
|
||||
LocalDate now = LocalDate.now();
|
||||
String year = Integer.toString(now.getYear());
|
||||
String month = String.format("%02d", now.getMonthValue());
|
||||
String day = String.format("%02d", now.getDayOfMonth());
|
||||
String saveFolderPath = "/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day;
|
||||
String fileName = UUID.randomUUID().toString().replace("-", "") + ".pdf";
|
||||
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
|
||||
String savePath = "/home/ruoyi/uploadPath/upload/";
|
||||
// 创建日期目录
|
||||
File saveFolder = new File(saveFolderPath);
|
||||
if (!saveFolder.exists()) {
|
||||
saveFolder.mkdirs();
|
||||
}
|
||||
String resultFilePath = saveFolderPath + "/" + fileName;
|
||||
File resultFilePathFile = new File(resultFilePath);
|
||||
if (!resultFilePathFile.exists()) {
|
||||
resultFilePathFile.createNewFile();
|
||||
}
|
||||
boolean downLoadFile = FileTransformation.downLoadFileByUrl(sealImageDownloadUrl, resultFilePath);
|
||||
if (downLoadFile) {
|
||||
CaseAttach caseAttach = new CaseAttach();
|
||||
caseAttach.setAnnexType(10); //10代表印章图片
|
||||
caseAttach.setAnnexPath(savePath);
|
||||
caseAttach.setAnnexName(saveName);
|
||||
int i1 = caseAttachMapper.save(caseAttach);
|
||||
if (i1 > 0) {
|
||||
//将附件id保存到公章管理表里
|
||||
Integer annexId1 = caseAttach.getAnnexId();
|
||||
SealManage sealManage = new SealManage();
|
||||
sealManage.setSealId(sealId);
|
||||
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
|
||||
if (selectSealList != null && selectSealList.size() > 0) {
|
||||
SealManage sealManage1 = selectSealList.get(0);
|
||||
sealManage1.setAnnexId(annexId1);
|
||||
sealManage1.setSealStatus(1); //启用
|
||||
sealManageMapper.updateSealManage(sealManage1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (EsignDemoException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new AjaxResult(200, "success");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SealManage> getSealList(DeptIdentify deptIdentify) {
|
||||
if (deptIdentify.getId() == null) {
|
||||
return null;
|
||||
}
|
||||
SealManage sealManage = new SealManage();
|
||||
sealManage.setIdentifyId(deptIdentify.getId());
|
||||
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
|
||||
if (selectSealList != null && selectSealList.size() > 0) {
|
||||
for (SealManage sealManage1 : selectSealList) {
|
||||
Integer annexId = sealManage1.getAnnexId();
|
||||
if (annexId != null) {
|
||||
//根据附件id查询路径
|
||||
CaseAttach caseAttach = caseAttachMapper.queryAnnexById(annexId);
|
||||
String annexName = caseAttach.getAnnexName();
|
||||
String prefix = "/profile";
|
||||
int startIndex = annexName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
||||
sealManage1.setAnnexPath(annexPath);
|
||||
} else {
|
||||
sealManage1.setAnnexPath(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return selectSealList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateSealLockStatus(SealManage sealManage) {
|
||||
sealManageMapper.updateSealManage(sealManage);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult insertDeptIdentify(DeptIdentify deptIdentify) {
|
||||
//参数校验
|
||||
String identifyName = deptIdentify.getIdentifyName();
|
||||
if (identifyName == null) {
|
||||
AjaxResult.error("请检查参数是否完整");
|
||||
}
|
||||
Integer identifyType = deptIdentify.getIdentifyType();
|
||||
if (identifyType == null) {
|
||||
deptIdentify.setIdentifyType(1); // 设置机构默认为仲裁机构
|
||||
}
|
||||
deptIdentify.setIdentifyStatus(0); //设置认证状态默认为未认证
|
||||
deptIdentify.setIsUse(0); //设置机构默认为未启用
|
||||
//将机构名称保存到部门表里
|
||||
SysDept sysDept = new SysDept();
|
||||
sysDept.setDeptName(identifyName);
|
||||
sysDept.setParentId(0L);
|
||||
sysDept.setDeptType(1);
|
||||
int i1 = sysDeptMapper.insertDept(sysDept);
|
||||
if (i1 > 0) {
|
||||
/* //将经办人信息存入到用户表里
|
||||
Long deptId = sysDept.getDeptId();
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setDeptId(deptId);
|
||||
sysUser.setUserName(deptIdentify.getOperUserName());
|
||||
sysUser.setNickName(operName);
|
||||
sysUser.setPhonenumber(operPhone);
|
||||
SysUser sysUser1 = sysUserMapper.selectUserByUserName(deptIdentify.getOperUserName());
|
||||
if (sysUser1== null) {
|
||||
sysUserMapper.insertUser(sysUser);
|
||||
}
|
||||
Long userId = sysUser.getUserId();
|
||||
deptIdentify.setDeptId(deptId);
|
||||
deptIdentify.setUserId(userId);
|
||||
List<SysUserPost> sysUserPosts = new ArrayList<>();
|
||||
SysUserPost sysUserPost = new SysUserPost();
|
||||
sysUserPost.setUserId(userId);
|
||||
sysUserPost.setPostId(5L);
|
||||
sysUserPosts.add(sysUserPost);
|
||||
sysUserPostMapper.batchUserPost(sysUserPosts);*/
|
||||
Long deptId = sysDept.getDeptId();
|
||||
deptIdentify.setDeptId(deptId);
|
||||
}
|
||||
|
||||
int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult deleteDeptIdentify(Long id) {
|
||||
DeptIdentify deptIdentify = new DeptIdentify();
|
||||
deptIdentify.setId(id);
|
||||
deptIdentify.setDelFlag(2);
|
||||
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
|
||||
if (i > 0) {
|
||||
//删除部门表数据
|
||||
sysDeptMapper.deleteDeptById(id);
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateDeptIdentify(DeptIdentify deptIdentify) {
|
||||
Long id = deptIdentify.getId();
|
||||
if (id == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
DeptIdentify deptIdentifyNew = new DeptIdentify();
|
||||
deptIdentifyNew.setId(id);
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentifyNew);
|
||||
if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
||||
DeptIdentify deptIdentify1 = deptIdentifies.get(0);
|
||||
if (deptIdentify1.getIdentifyStatus() == 1) {
|
||||
return AjaxResult.error("已认证的机构不允许修改");
|
||||
}
|
||||
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
|
||||
if (i > 0) {
|
||||
//修改部门表数据
|
||||
SysDept sysDept = new SysDept();
|
||||
sysDept.setDeptId(deptIdentify1.getDeptId());
|
||||
sysDept.setDeptName(deptIdentify.getIdentifyName());
|
||||
sysDeptMapper.updateDept(sysDept);
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult insertTemplate(TemplateManage templateManage, MultipartFile file) {
|
||||
//参数校验
|
||||
if (templateManage.getIdentifyId() == null || file == null || templateManage.getTemName() == null) {
|
||||
return AjaxResult.error("请检查参数是否完整");
|
||||
}
|
||||
if (templateManage.getTemType() == null) {
|
||||
templateManage.setTemType(1); //默认模板类型为1(裁决书)
|
||||
}
|
||||
try {
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String prefix = "/profile";
|
||||
int startIndex = fileName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "uploadPath" + fileName.substring(startIndex);
|
||||
templateManage.setTemOrigPath(annexPath);
|
||||
String format = getFileExtension(fileName);
|
||||
templateManage.setTemFormat(format);
|
||||
String subFileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
||||
templateManage.setFileName(subFileName);
|
||||
templateManage.setCreateBy(getUsername());
|
||||
int i = templateManageMapper.insertTemplateManage(templateManage);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateTemplate(TemplateManage templateManage, MultipartFile file) {
|
||||
Long id = templateManage.getId();
|
||||
if (id == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
try {
|
||||
if (file != null && file.getSize() > 0) {
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String prefix = "/profile";
|
||||
int startIndex = fileName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "uploadPath" + fileName.substring(startIndex);
|
||||
templateManage.setTemOrigPath(annexPath);
|
||||
String subFileName = fileName.substring(fileName.lastIndexOf("/") + 1);
|
||||
templateManage.setFileName(subFileName);
|
||||
String format = getFileExtension(fileName);
|
||||
templateManage.setTemFormat(format);
|
||||
}
|
||||
templateManage.setUpdateBy(getUsername());
|
||||
int i = templateManageMapper.updateTemplateManage(templateManage);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult deleteTemplate(Long id) {
|
||||
TemplateManage templateManage = new TemplateManage();
|
||||
templateManage.setId(id);
|
||||
templateManage.setDelFlag(2);
|
||||
int i = templateManageMapper.updateTemplateManage(templateManage);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TemplateManage> getTemplateList(DeptIdentify deptIdentify) {
|
||||
TemplateManage templateManage = new TemplateManage();
|
||||
templateManage.setIdentifyId(deptIdentify.getId());
|
||||
List<TemplateManage> templateManages = templateManageMapper.selectTemplateList(templateManage);
|
||||
if (templateManages != null && templateManages.size() > 0) {
|
||||
for (TemplateManage manage : templateManages) {
|
||||
//根据机构id查询机构名称
|
||||
Long identifyId = manage.getIdentifyId();
|
||||
if (identifyId != null) {
|
||||
deptIdentify.setId(identifyId);
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
||||
manage.setIdentifyName(deptIdentifies.get(0).getIdentifyName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return templateManages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectPostUserByDeptId(DeptIdentify deptIdentify) {
|
||||
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
|
||||
if (deptIdentifies != null && deptIdentifies.size() > 0) {
|
||||
deptIdentify = deptIdentifies.get(0);
|
||||
if (deptIdentify.getDeptId() != null) {
|
||||
//默认查询经办人的
|
||||
Long roleId = 106L;
|
||||
List<SysUser> sysUserList = sysUserMapper.selectRoleUserByDeptId(deptIdentify.getDeptId(), roleId);
|
||||
return sysUserList;
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult bindHandler(DeptIdentify deptIdentify) {
|
||||
if (deptIdentify.getId() == null || deptIdentify.getUserId() == null) {
|
||||
return AjaxResult.error("请检查参数是否完整");
|
||||
}
|
||||
//根据userid查询用户信息
|
||||
SysUser sysUser = sysUserMapper.selectUserById(deptIdentify.getUserId());
|
||||
if (sysUser != null) {
|
||||
deptIdentify.setOperName(sysUser.getNickName());
|
||||
deptIdentify.setOperPhone(sysUser.getPhonenumber());
|
||||
deptIdentify.setOperUserName(sysUser.getUserName());
|
||||
deptIdentify.setUserId(deptIdentify.getUserId());
|
||||
//更新
|
||||
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("绑定成功");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FatchRule> getFatchRuleByTemplateid(TemplateManage templateManage) {
|
||||
|
||||
FatchRule fatchRule = new FatchRule();
|
||||
fatchRule.setTemplateId(templateManage.getId());
|
||||
return fatchRuleMapper.selectFatchRuleList(fatchRule);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult saveFatchRules(TemplateManage templateManage) {
|
||||
TemplateFatchRule templateFatchRule = new TemplateFatchRule();
|
||||
templateFatchRule.setTemplateId(templateManage.getId());
|
||||
templateFatchRuleMapper.deleteTemplateFatchRule(templateManage.getId());
|
||||
|
||||
List<FatchRule> fatchRules = templateManage.getFatchRules();
|
||||
|
||||
Map<Object, Long> columnmap = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumn(), Collectors.counting()));
|
||||
Stream<Object> columnStream = columnmap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey());
|
||||
List<String> strlist1 = new ArrayList<>();
|
||||
columnStream.forEach(column -> {
|
||||
strlist1.add(column.toString());
|
||||
});
|
||||
if(strlist1!=null&&strlist1.size()>0){
|
||||
throw new ServiceException("字段' " + String.join(",", strlist1) + " '重复");
|
||||
}
|
||||
|
||||
Map<Object, Long> columnNamemap = fatchRules.stream().collect(Collectors.groupingBy(fatchRule -> fatchRule.getColumnName(), Collectors.counting()));
|
||||
Stream<Object> columnNameStream = columnNamemap.entrySet().stream().filter(entry -> entry.getValue() > 1).map(entry -> entry.getKey());
|
||||
List<String> strlist2 = new ArrayList<>();
|
||||
columnNameStream.forEach(column -> {
|
||||
strlist2.add(column.toString());
|
||||
});
|
||||
if(strlist2!=null&&strlist2.size()>0){
|
||||
throw new ServiceException("字段' " + String.join(",", strlist2) + " '重复");
|
||||
}
|
||||
|
||||
if(fatchRules!=null&&fatchRules.size()>0){
|
||||
for (FatchRule fatchRule : fatchRules) {
|
||||
//保存抓取规则数据
|
||||
fatchRuleMapper.insertFatchRule(fatchRule);
|
||||
//保存模板抓取规则关联关系
|
||||
Long fatchRuleId = fatchRule.getId();
|
||||
if(fatchRuleId!=null){
|
||||
templateFatchRule.setFatchRuleId(fatchRuleId);
|
||||
templateFatchRuleMapper.insertTemplateFatchRule(templateFatchRule);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FatchRule> selectColumnandComment() {
|
||||
List<FatchRule> fatchRules = new ArrayList<>();
|
||||
FatchRule fatchRuleselect = new FatchRule();
|
||||
fatchRuleselect.setDatabaseName("test_smart_arbitration");
|
||||
fatchRules = fatchRuleMapper.selectColumnandComment(fatchRuleselect);
|
||||
return fatchRules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FatchRule selectColumnbycomment(FatchRule fatchRule) {
|
||||
fatchRule.setDatabaseName("test_smart_arbitration");
|
||||
FatchRule fatchRulesel = fatchRuleMapper.selectColumnbycomment(fatchRule);
|
||||
return fatchRulesel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模板id查询模板字段列表
|
||||
* @param templateManage
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FatchRule> getTemplateInfoById(TemplateManage templateManage) {
|
||||
FatchRule fatchRule = new FatchRule();
|
||||
fatchRule.setTemplateId(templateManage.getId());
|
||||
List<FatchRule> fatchRuleList = fatchRuleMapper.selectFatchRuleList(fatchRule);
|
||||
if(CollectionUtil.isEmpty(fatchRuleList)){
|
||||
fatchRuleList=new ArrayList<>();
|
||||
}
|
||||
List<String> columnNameList = fatchRuleList.stream().map(FatchRule::getColumnName).collect(Collectors.toList());
|
||||
// 在系统表中查询案件内置字段
|
||||
SysDictData sysDictData = new SysDictData();
|
||||
sysDictData.setDictType("case_built_type");
|
||||
List<SysDictData> dictDataList = dictDataMapper.selectDictDataList(sysDictData);
|
||||
if(CollectionUtil.isNotEmpty(dictDataList)){
|
||||
for (SysDictData dictData : dictDataList) {
|
||||
if(StrUtil.isEmpty(dictData.getDictLabel())||columnNameList.contains(dictData.getDictLabel())){
|
||||
continue;
|
||||
}
|
||||
FatchRule rule=new FatchRule();
|
||||
rule.setColumn(dictData.getDictValue());
|
||||
rule.setColumnName(dictData.getDictLabel());
|
||||
fatchRuleList.add(rule);
|
||||
}
|
||||
}
|
||||
|
||||
return fatchRuleList;
|
||||
}
|
||||
|
||||
private String getFileExtension(String fileName) {
|
||||
int lastDotIndex = fileName.lastIndexOf(".");
|
||||
if (lastDotIndex > 0 && lastDotIndex < fileName.length() - 1) {
|
||||
return fileName.substring(lastDotIndex + 1);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
+233
@@ -0,0 +1,233 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.crypto.SmUtil;
|
||||
import cn.hutool.crypto.asymmetric.SM2;
|
||||
import cn.hutool.crypto.symmetric.SymmetricCrypto;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.IdentityAuthenticationService;
|
||||
import com.tencentcloudapi.common.Credential;
|
||||
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||
import com.tencentcloudapi.common.profile.ClientProfile;
|
||||
import com.tencentcloudapi.common.profile.HttpProfile;
|
||||
import com.tencentcloudapi.faceid.v20180301.FaceidClient;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.GetEidResultRequest;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.GetEidResultResponse;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenRequest;
|
||||
import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class IdentityAuthenticationServiceImpl implements IdentityAuthenticationService {
|
||||
|
||||
@Value("${identityAuthentication.credentialSecretId}")
|
||||
private String credentialSecretId;
|
||||
@Value("${identityAuthentication.credentialSecretKey}")
|
||||
private String credentialSecretKey;
|
||||
@Value("${identityAuthentication.merchantId}")
|
||||
private String merchantId;
|
||||
@Value("${identityAuthentication.privateKeyHexDecodeinfo}")
|
||||
private String privateKeyHexDecodeinfo;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IdentityAuthenticationMapper identityAuthenticationMapper;
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(IdentityAuthenticationServiceImpl.class);
|
||||
|
||||
|
||||
@Override
|
||||
public IdentityAuthentication selectIdentityAuthentication(IdentityAuthentication identityAuthentication) {
|
||||
IdentityAuthentication identityAuthenticationselect = identityAuthenticationMapper.selectIdentityAuthentication(identityAuthentication);
|
||||
if (identityAuthenticationselect != null) {
|
||||
identityAuthenticationselect.setCertificationStatusName("已身份认证");
|
||||
} else {
|
||||
IdentityAuthentication identityAuthenticationselectnew = new IdentityAuthentication();
|
||||
identityAuthenticationselectnew.setCertificationStatusName("未身份认证");
|
||||
identityAuthenticationselectnew.setCertificationStatus(0);
|
||||
return identityAuthenticationselectnew;
|
||||
}
|
||||
return identityAuthenticationselect;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否已经认证的用户
|
||||
*
|
||||
* @param identityAuthentication
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkIsAuthentication(IdentityAuthentication identityAuthentication) {
|
||||
IdentityAuthentication identityAuthenticationselect = identityAuthenticationMapper.selectIdentityAuthentication(identityAuthentication);
|
||||
if (identityAuthenticationselect != null) {
|
||||
return "1";
|
||||
} else {
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取EIDtoken
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public JSONObject selectIdentityAuthenticaEIDtoken() {
|
||||
JSONObject objJSON = new JSONObject();
|
||||
objJSON.put("EidToken", "");
|
||||
try {
|
||||
Credential cred = new Credential(credentialSecretId, credentialSecretKey);
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
FaceidClient client = new FaceidClient(cred, "", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
GetEidTokenRequest req = new GetEidTokenRequest();
|
||||
req.setMerchantId(merchantId);
|
||||
// 返回的resp是一个GetEidTokenResponse的实例,与请求对象对应
|
||||
GetEidTokenResponse resp = client.GetEidToken(req);
|
||||
// 输出json格式的字符串回包
|
||||
String respJSON = GetEidTokenResponse.toJsonString(resp);
|
||||
objJSON = JSON.parseObject(respJSON);
|
||||
} catch (TencentCloudSDKException e) {
|
||||
System.out.println(e.toString());
|
||||
System.out.println("获取Eidtoken失败");
|
||||
}
|
||||
return objJSON;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密用户信息
|
||||
*/
|
||||
public JSONObject DecodeUserInfo(String deskey, String userInfo) {
|
||||
JSONObject parse = null;
|
||||
try {
|
||||
byte[] desKeyBytes = Base64.decode(deskey);
|
||||
final SM2 sm2 = new SM2(privateKeyHexDecodeinfo, null, null);
|
||||
sm2.usePlainEncoding();
|
||||
byte[] sm4KeyBytes = sm2.decrypt(desKeyBytes);
|
||||
SymmetricCrypto sm4 = SmUtil.sm4(sm4KeyBytes);
|
||||
byte[] plaintext = sm4.decrypt(Base64.decode(userInfo));
|
||||
if (plaintext != null && plaintext.length > 0) {
|
||||
String s = new String(plaintext);
|
||||
parse = JSON.parseObject(s);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
return parse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序人脸核身后查询身份认证结果
|
||||
*
|
||||
* @param ientityAuthentication
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication) {
|
||||
String eidToken = ientityAuthentication.getEidToken();
|
||||
IdentityAuthentication authentication = new IdentityAuthentication();
|
||||
try {
|
||||
Credential cred = new Credential(credentialSecretId, credentialSecretKey);
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
FaceidClient client = new FaceidClient(cred, "", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
GetEidResultRequest req = new GetEidResultRequest();
|
||||
req.setEidToken(eidToken);
|
||||
// 返回的resp是一个GetEidResultResponse的实例,与请求对象对应
|
||||
GetEidResultResponse resp = client.GetEidResult(req);
|
||||
// 输出json格式的字符串回包
|
||||
String s = GetEidResultResponse.toJsonString(resp);
|
||||
JSONObject objJSON = JSON.parseObject(s);
|
||||
//查看是否核验成功
|
||||
JSONObject text = objJSON.getJSONObject("Text");
|
||||
if (text != null) {
|
||||
Integer comparestatus = text.getInteger("Comparestatus");
|
||||
if (comparestatus != null && comparestatus == 0) {
|
||||
JSONObject eidInfo = objJSON.getJSONObject("EidInfo");
|
||||
if (eidInfo != null) {
|
||||
String desKey = eidInfo.getString("DesKey");
|
||||
String userInfo = eidInfo.getString("UserInfo");
|
||||
//1.解密用户的信息
|
||||
JSONObject info = DecodeUserInfo(desKey, userInfo);
|
||||
if (info != null) {
|
||||
String idcardno = info.getString("idnum");
|
||||
String name = info.getString("name");
|
||||
//2.在用户认证表中插入用户认证记录
|
||||
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
* 用户名id
|
||||
* 姓名
|
||||
* 身份证号
|
||||
* 认证时间
|
||||
* 认证状态0表示成功
|
||||
* 请求id
|
||||
*/
|
||||
// authentication.setUserName(loginUser.getUsername());
|
||||
// authentication.setUserId(loginUser.getUserId());
|
||||
|
||||
authentication.setIdentityNo(idcardno);
|
||||
// 查询认证表是否已存在该身份证信息的认证,不存在则新增,存在不处理
|
||||
IdentityAuthentication identityAuthentication = identityAuthenticationMapper.selectIdentityAuthentication(authentication);
|
||||
if(identityAuthentication!=null) {
|
||||
return AjaxResult.success(identityAuthentication);
|
||||
}
|
||||
authentication.setName(name);
|
||||
authentication.setCertificationTime(new Date());
|
||||
authentication.setCertificationStatus(0);
|
||||
authentication.setCreateBy(name);
|
||||
// authentication.setCreateBy(loginUser.getUsername());
|
||||
try {
|
||||
identityAuthenticationMapper.insertIdentityAuthentication(authentication);
|
||||
authentication.setId(authentication.getId());
|
||||
} catch (Exception e) {
|
||||
System.out.println("认证记录新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(authentication);
|
||||
} catch (TencentCloudSDKException e) {
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
|
||||
import com.ruoyi.wisdomarbitrate.domain.SendMailRecord;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.SendMailRecordMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.ISendMailRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SendMailRecordServiceImpl implements ISendMailRecordService {
|
||||
@Autowired
|
||||
private SendMailRecordMapper sendMailRecordMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<SendMailRecord> selectSendMailRecordList(SendMailRecord sendMailRecord) {
|
||||
List<SendMailRecord> records = sendMailRecordMapper.selectSendMailRecord(sendMailRecord);
|
||||
return records;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
|
||||
import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.TemplateManualMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.ITemplateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@Service
|
||||
public class TemplateServiceImpl implements ITemplateService {
|
||||
@Autowired
|
||||
private TemplateManualMapper templateManualMapper;
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult insertTemplate(TemplateManual templateManual) {
|
||||
int i = templateManualMapper.insertTemplateManual(templateManual);
|
||||
if (i>0){
|
||||
return AjaxResult.success("新增成功");
|
||||
}
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult deleteTemplate(Long id) {
|
||||
TemplateManual templateManual = new TemplateManual();
|
||||
templateManual.setId(id);
|
||||
templateManual.setDelFlag(2);
|
||||
int i = templateManualMapper.updateTemplateManual(templateManual);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public AjaxResult updateTemplate(TemplateManual templateManual) {
|
||||
int i = templateManualMapper.updateTemplateManual(templateManual);
|
||||
if (i > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TemplateManual> selectTemplate(TemplateManual templateManual) {
|
||||
return templateManualMapper.selectTemplateManual(templateManual);
|
||||
}
|
||||
}
|
||||
+485
@@ -0,0 +1,485 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.config.RuoYiConfig;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.PdfUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.file.FileUploadUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
|
||||
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.WeChatUserMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.VideoService;
|
||||
import com.ruoyi.wisdomarbitrate.service.WeChatUserService;
|
||||
import com.tencentcloudapi.common.Credential;
|
||||
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
|
||||
import com.tencentcloudapi.common.profile.ClientProfile;
|
||||
import com.tencentcloudapi.common.profile.HttpProfile;
|
||||
import com.tencentcloudapi.trtc.v20190722.TrtcClient;
|
||||
import com.tencentcloudapi.trtc.v20190722.models.*;
|
||||
import com.tencentcloudapi.vod.v20180717.VodClient;
|
||||
import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosRequest;
|
||||
import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosResponse;
|
||||
import com.tencentyun.TLSSigAPIv2;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.ruoyi.common.core.domain.AjaxResult.success;
|
||||
import static com.ruoyi.common.utils.file.FileUploadUtils.getAbsoluteFile;
|
||||
import static com.ruoyi.common.utils.file.FileUploadUtils.getPathFileName;
|
||||
|
||||
/**
|
||||
* @author wangqiong
|
||||
* @description 视频录制
|
||||
* @date 2023-10-26 11:45
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class VideoServiceImpl implements VideoService {
|
||||
// 腾讯云即时通信sdkAppId
|
||||
@Value("${imConfig.sdkAppId}")
|
||||
private long sdkAppId;
|
||||
// 腾讯云即时通信密钥
|
||||
@Value("${imConfig.sdkSecretKey}")
|
||||
private String sdkSecretKey;
|
||||
// 腾讯云个人账户secretId
|
||||
@Value("${imConfig.secretId}")
|
||||
private String secretId;
|
||||
// 腾讯云个人账户密钥
|
||||
@Value("${imConfig.secretKey}")
|
||||
private String secretKey;
|
||||
@Autowired
|
||||
private CaseApplicationMapper caseApplicationMapper;
|
||||
@Autowired
|
||||
private CaseAttachMapper caseAttachMapper;
|
||||
@Autowired
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
/**
|
||||
* 功能:第三方回调sign校验
|
||||
* 参数:
|
||||
* key:控制台配置的密钥key
|
||||
* body:腾讯云回调返回的body体
|
||||
* sign:腾讯云回调返回的签名值sign
|
||||
* 返回值:
|
||||
* Status:OK 表示校验通过,FAIL 表示校验失败,具体原因参考Info
|
||||
* Info:成功/失败信息
|
||||
* @param body
|
||||
* @param request
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void videoRollBack(String body, HttpServletRequest request) {
|
||||
String key = "key";
|
||||
String sdkAppId = request.getHeader("SdkAppId");
|
||||
String sign = request.getHeader("Sign");
|
||||
// String resultSign = getResultSign(key,body);
|
||||
// log.info("resultSign:"+resultSign);
|
||||
// if (resultSign.equals(sign)) {
|
||||
JSONObject jsonObject = (JSONObject) JSON.parse(body);
|
||||
Integer eventType = jsonObject.getInteger("EventType"); // 事件类型
|
||||
String eventInfo = jsonObject.getString("EventInfo"); // 事件信息
|
||||
JSONObject jsonObject1 = (JSONObject) JSON.parse(eventInfo);
|
||||
String roomId = jsonObject1.getString("RoomId");
|
||||
String taskId = jsonObject1.getString("TaskId"); // 任务ID
|
||||
String payload = jsonObject1.getString("Payload"); // 根据不同事件类型定义不同
|
||||
JSONObject jsonObject2 = (JSONObject) JSON.parse(payload);
|
||||
String tencentVod = jsonObject2.getString("TencentVod"); // 点播平台信息
|
||||
JSONObject jsonObject3 = (JSONObject) JSON.parse(tencentVod);
|
||||
// 录制视频上传成功
|
||||
if (eventType == 311) {
|
||||
// 点播平台的唯一 ID
|
||||
String fileId = jsonObject3.getString("FileId");
|
||||
// 点播平台的播放地址
|
||||
String videoUrl = jsonObject3.getString("VideoUrl");
|
||||
// 主辅流标识,main 代表主流(摄像头),aux 代表辅流(屏幕分享),mix 代表混流录制
|
||||
String mediaId = jsonObject3.getString("MediaId");
|
||||
// 建立相关的数据库用来存储音视频录制地址并和相关的业务ID绑定,用于后续下载
|
||||
try {
|
||||
downloadImage(fileId,videoUrl,roomId);
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult bindCaseId(Long caseId, String roomId) {
|
||||
caseApplicationMapper .bindCaseId(caseId,roomId);
|
||||
return success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult videoList(Long caseId) {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseId);
|
||||
caseApplication.setAnnexType(9);
|
||||
List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication);
|
||||
if(CollectionUtil.isEmpty(caseAttachList)){
|
||||
return success();
|
||||
}
|
||||
for (CaseAttach caseAttach : caseAttachList) {
|
||||
String annexName = caseAttach.getAnnexName();
|
||||
String prefix = "/profile";
|
||||
int startIndex = annexName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
||||
caseAttach.setAnnexPath(annexPath);
|
||||
int startIndexnew = annexName.lastIndexOf("/");
|
||||
if (startIndexnew != -1) {
|
||||
String annexNamenew = annexName.substring(startIndexnew + 1);
|
||||
caseAttach.setAnnexName(annexNamenew);
|
||||
}
|
||||
}
|
||||
return success(caseAttachList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启腾讯云录制
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult openCloudRecording(long caseId,long roomId) {
|
||||
try {
|
||||
String userId="recorder_"+roomId;
|
||||
|
||||
Credential cred = new Credential(secretId, secretKey);
|
||||
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("trtc.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
TrtcClient client = new TrtcClient(cred, "ap-beijing", clientProfile);
|
||||
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
CreateCloudRecordingRequest req = new CreateCloudRecordingRequest();
|
||||
req.setSdkAppId(sdkAppId); // SdkAppId – TRTC的[SdkAppId](https://cloud.tencent.com/document/product/647/46351#sdkappid),和录制的房间所对应的SdkAppId相同
|
||||
req.setRoomId(String.valueOf(roomId)); // RoomId – TRTC的[RoomId](https://cloud.tencent.com/document/product/647/46351#roomid),录制的TRTC房间所对应的RoomId
|
||||
req.setRoomIdType(1L);
|
||||
/**
|
||||
* 录制机器人用于进入TRTC房间拉流的[UserId](https://cloud.tencent.com/document/product/647/46351#userid),
|
||||
* 注意这个UserId不能与其他TRTC房间内的主播或者其他录制任务等已经使用的UserId重复,建议可以把房间ID作为userId的标识的一部分,
|
||||
* 即录制机器人进入房间的userid应保证独立且唯一
|
||||
*/
|
||||
req.setUserId(userId);
|
||||
|
||||
TLSSigAPIv2 api = new TLSSigAPIv2(sdkAppId, sdkSecretKey);
|
||||
String userSign = api.genUserSig(userId, 60 * 60 * 10);
|
||||
req.setUserSig(userSign); // 录制机器人用于进入TRTC房间拉流的用户签名,当前 UserId 对应的验证签名,相当于登录密码
|
||||
RecordParams recordParams = new RecordParams();
|
||||
// 混流录制
|
||||
recordParams.setMaxIdleTime(60L*5); // 5分钟内房间里面没有主播,自动停止录制
|
||||
recordParams.setStreamType(0L); // 0:录制音频+视频流(默认); 1:仅录制音频流; 2:仅录制视频流
|
||||
recordParams.setRecordMode(2L); // 1:单流录制,分别录制房间的订阅UserId的音频和视频,将录制文件上传至云存储; 2:混流录制,将房间内订阅UserId的音视频混录成一个音视频文件,将录制文件上传至云存储;
|
||||
recordParams.setOutputFormat(0L); // 0:(默认)输出文件为hls格式。1:输出文件格式为hls+mp4。2:输出文件格式为hls+aac
|
||||
MixLayoutParams mixLayoutParams = new MixLayoutParams();
|
||||
// 布局模式: 1:悬浮布局;2:屏幕分享布局;3:九宫格布局(默认);4:自定义布局;
|
||||
mixLayoutParams.setMixLayoutMode(3L);
|
||||
req.setMixLayoutParams(mixLayoutParams);
|
||||
|
||||
StorageParams storageParams1 = new StorageParams();
|
||||
CloudVod cloudVod = new CloudVod();
|
||||
TencentVod tencentVod = new TencentVod();
|
||||
tencentVod.setSubAppId(1304001529L);
|
||||
// 录制的文件永久保存
|
||||
tencentVod.setExpireTime(0L);
|
||||
// 录制文件名拼接前缀
|
||||
tencentVod.setUserDefineRecordId(caseId+"");
|
||||
cloudVod.setTencentVod(tencentVod); // 腾讯云点播相关参数。
|
||||
storageParams1.setCloudVod(cloudVod); // 必填】腾讯云云点播的账号信息,目前仅支持存储至腾讯云点播VOD。
|
||||
req.setRecordParams(recordParams); // 云端录制控制参数
|
||||
req.setStorageParams(storageParams1); // 云端录制文件上传到云存储的参数(目前只支持使用腾讯云点播作为存储)
|
||||
// 返回的resp是一个CreateCloudRecordingResponse的实例,与请求对象对应
|
||||
CreateCloudRecordingResponse resp = client.CreateCloudRecording(req);
|
||||
|
||||
return success((JSONObject) JSON.toJSON(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
return AjaxResult.error(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult closeDeleteCloudRecording(String taskId) {
|
||||
|
||||
try {
|
||||
if (taskId != null) {
|
||||
taskId = taskId.replaceAll(" ", "+");
|
||||
}
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||
Credential cred = new Credential(secretId, secretKey);
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("trtc.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
TrtcClient client = new TrtcClient(cred, "ap-beijing", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
DeleteCloudRecordingRequest req = new DeleteCloudRecordingRequest();
|
||||
req.setSdkAppId(sdkAppId); // SdkAppId – TRTC的SDKAppId,和录制的房间所对应的SDKAppId相同
|
||||
req.setTaskId(taskId); // TaskId – 录制任务的唯一Id,在启动录制成功后会返回
|
||||
// 返回的resp是一个DeleteCloudRecordingResponse的实例,与请求对象对应
|
||||
DeleteCloudRecordingResponse resp = client.DeleteCloudRecording(req);
|
||||
// 输出json格式的字符串回包
|
||||
return success((JSONObject) JSON.toJSON(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
return AjaxResult.error(e.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult dissolveRoom( Long roomId) {
|
||||
Credential cred = new Credential(secretId, secretKey);
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("trtc.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
TrtcClient client = new TrtcClient(cred, "ap-beijing", clientProfile);
|
||||
DismissRoomRequest req = new DismissRoomRequest();
|
||||
req.setSdkAppId(sdkAppId);
|
||||
req.setRoomId(roomId);
|
||||
try {
|
||||
DismissRoomResponse resp = client.DismissRoom(req);
|
||||
return success((JSONObject) JSON.toJSON(resp));
|
||||
} catch (TencentCloudSDKException e) {
|
||||
return AjaxResult.error("解散房间失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult secretaryRoleByUserId(Long userId) {
|
||||
List<SysRole> roles = roleMapper.selectRolePermissionByUserId(userId);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
boolean isSecretaryRole=false;
|
||||
if(CollectionUtil.isNotEmpty(roles)){
|
||||
for (SysRole role : roles) {
|
||||
if("法律顾问".equals(role.getRoleName()) || "秘书".equals(role.getRoleName())){
|
||||
isSecretaryRole=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
jsonObject.put("isSecretaryRole",isSecretaryRole);
|
||||
return success(jsonObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据html字符串转pdf并和案件关联
|
||||
* @param reservedConferenceVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult htmlToPDF(ReservedConferenceVO reservedConferenceVO) {
|
||||
String currentFileName = System.currentTimeMillis() + ".pdf";
|
||||
String fileName = null;
|
||||
try {
|
||||
fileName = getPathFileName(RuoYiConfig.getHtml2PDFPath(), currentFileName);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
String htmlContent = "<html><head> <title>庭审笔录</title></head><body style=\"font-size:12.0pt; font-family:SimSun;\"><h1 align=\"center\">庭审笔录</h1>" +reservedConferenceVO.getHtmlContent()+"</body></html>";
|
||||
// html转pdf并上传到服务器
|
||||
boolean convertFlag = PdfUtils.htmlStringConvertToPDF(RuoYiConfig.getHtml2PDFPath() +"/"+ currentFileName, htmlContent);
|
||||
|
||||
// 绑定案件
|
||||
if(convertFlag){
|
||||
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(reservedConferenceVO.getCaseId())
|
||||
.annexName(fileName)
|
||||
.annexPath(RuoYiConfig.getHtml2PDFPath())
|
||||
.annexType(7)
|
||||
.build();
|
||||
caseAttachMapper.save(caseAttach);
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
return AjaxResult.error("pdf转换失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult attachListByCaseId(Long caseAppliId, Integer annexType) {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
caseApplication.setId(caseAppliId);
|
||||
caseApplication.setAnnexType(annexType);
|
||||
List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication);
|
||||
if(CollectionUtil.isEmpty(caseAttachList)){
|
||||
return success(caseAttachList);
|
||||
}
|
||||
|
||||
// 附件转换
|
||||
if (caseAttachList != null && caseAttachList.size() > 0) {
|
||||
for (CaseAttach caseAttach : caseAttachList) {
|
||||
String annexName = caseAttach.getAnnexName();
|
||||
String prefix = "/profile";
|
||||
int startIndex = annexName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "/uploadPath" + annexName.substring(startIndex);
|
||||
caseAttach.setAnnexPath(annexPath);
|
||||
int startIndexnew = annexName.lastIndexOf("/");
|
||||
if (startIndexnew != -1) {
|
||||
String annexNamenew = annexName.substring(startIndexnew + 1);
|
||||
caseAttach.setAnnexName(annexNamenew);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return success(caseAttachList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询出音视频集合,并下载,在将云点播上面的音视频删除
|
||||
* @param fileIds 点播平台唯一ID集合
|
||||
* @throws Exception
|
||||
*/
|
||||
private void downloadVideo(String [] fileIds) throws Exception {
|
||||
try{
|
||||
//创建文件对象
|
||||
Properties properties = new Properties();
|
||||
//加载文件获取数据 文件带后缀
|
||||
properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream
|
||||
("application.properties"));
|
||||
//根据key来获取value
|
||||
String secretId = properties.getProperty("secretid");
|
||||
String secretKey = properties.getProperty("secretkey");
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||
Credential cred = new Credential(secretId, secretKey);
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("vod.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
VodClient client = new VodClient(cred, "ap-beijing", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
DescribeMediaInfosRequest req = new DescribeMediaInfosRequest();
|
||||
req.setFileIds(fileIds);
|
||||
String[] basicInfos = {"basicInfo"};
|
||||
req.setFilters(basicInfos);
|
||||
// 返回的resp是一个DescribeMediaInfosResponse的实例,与请求对象对应
|
||||
DescribeMediaInfosResponse resp = client.DescribeMediaInfos(req);
|
||||
// 输出json格式的字符串回包
|
||||
log.info(DescribeMediaInfosResponse.toJsonString(resp));
|
||||
String json = DescribeMediaInfosResponse.toJsonString(resp);
|
||||
JSONObject jsonObject = (JSONObject) JSON.parse(json);
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("MediaInfoSet"); // 媒体文件信息列表。
|
||||
for (int i = 0; i < jsonArray.size(); i++) {
|
||||
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
|
||||
String fileId = jsonObject1.getString("FileId"); // 点播平台的唯一 ID
|
||||
String basicInfo = jsonObject1.getString("BasicInfo"); // 基础信息
|
||||
JSONObject jsonObject2 = (JSONObject) JSON.parse(basicInfo);
|
||||
String mediaUrl = jsonObject2.getString("MediaUrl"); // 文件地址
|
||||
String downPath = downloadImage(null,null,mediaUrl); // 下载音视频(返回本地下载地址)
|
||||
// 将未下载的音视频列表查询出来,进行下载到服务器上面,并更新数据库数据
|
||||
log.info(downPath); // 本地地址
|
||||
}
|
||||
log.info("下载音视频成功");
|
||||
} catch (TencentCloudSDKException e) {
|
||||
log.info(e.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
log.info("腾讯云测试成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 将视频下载到本地
|
||||
* @param fileUrl 视频路径
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
public String downloadImage(String fileId,String fileUrl,String roomId) throws IOException {
|
||||
String staticAndMksDir = null;
|
||||
if (fileUrl != null) {
|
||||
//下载时文件名称
|
||||
String fileName = fileUrl.substring(fileUrl.lastIndexOf("/"));
|
||||
fileName = fileName.replace("/", "");
|
||||
fileName=fileId+fileName;
|
||||
String absPath = getAbsoluteFile(RuoYiConfig.getVideoUploadPath(), fileName).getAbsolutePath();
|
||||
staticAndMksDir = Paths.get(absPath).toFile().toString();
|
||||
long downloadFile = HttpUtil.downloadFile(fileUrl, staticAndMksDir);
|
||||
if(downloadFile>0) {
|
||||
Long caseId = caseApplicationMapper.selectCaseIdByRoomId(roomId);
|
||||
String annexName = getPathFileName(RuoYiConfig.getVideoUploadPath(), fileName);
|
||||
// 存入数据库
|
||||
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(caseId)
|
||||
.annexName(annexName)
|
||||
.annexPath(RuoYiConfig.getVideoUploadPath())
|
||||
.annexType(9)
|
||||
.build();
|
||||
caseAttachMapper.save(caseAttach);
|
||||
return annexName;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
/**
|
||||
* @param key 回调秘钥
|
||||
* @param body 入参
|
||||
* @return 签名 Sign 计算公式中 key 为计算签名 Sign 用的加密密钥。
|
||||
* @throws Exception
|
||||
*/
|
||||
private static String getResultSign(String key, String body) throws Exception {
|
||||
Mac hmacSha256 = Mac.getInstance("HmacSHA256");
|
||||
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes(), "HmacSHA256");
|
||||
hmacSha256.init(secret_key);
|
||||
return Base64.getEncoder().encodeToString(hmacSha256.doFinal(body.getBytes()));
|
||||
}
|
||||
|
||||
}
|
||||
+146
@@ -0,0 +1,146 @@
|
||||
package com.ruoyi.wisdomarbitrate.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.system.mapper.SysUserMapper;
|
||||
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper;
|
||||
import com.ruoyi.wisdomarbitrate.service.WeChatUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author wangqiong
|
||||
* @description 微信小程序用户注册登录
|
||||
* @date 2023-10-16 11:45
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class WeChatUserServiceImpl implements WeChatUserService {
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private IdentityAuthenticationMapper identityAuthenticationMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult sendCode(WeChatUserVO userVO) {
|
||||
|
||||
Random random = new Random();
|
||||
String code = "";
|
||||
for (int i = 0; i < 6; i++) {
|
||||
|
||||
code += random.nextInt(10);
|
||||
}
|
||||
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
||||
request.setTemplateId("1955047");
|
||||
// 1954926 普通短信 短信验证码 验证码:,为了保证您的账户安全,请勿想他人泄露验证码信息。如非本人操作,请忽略本短信。
|
||||
request.setPhone(userVO.getPhone());
|
||||
request.setTemplateParamSet(new String[]{ code});
|
||||
Boolean flag = SmsUtils.sendSms(request);
|
||||
if(flag){
|
||||
setCodeCache(userVO.getPhone(),code);
|
||||
return AjaxResult.success("短信发送成功");
|
||||
}else {
|
||||
return AjaxResult.warn("短信发送失败");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 设置验证码缓存
|
||||
*
|
||||
* @param key 参数键
|
||||
* @param code 验证码
|
||||
*/
|
||||
public static void setCodeCache(String key, String code)
|
||||
{
|
||||
SpringUtils.getBean(RedisCache.class).setCacheObject(getVerifyCodeCacheKey(key), code, 5,TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典缓存
|
||||
*
|
||||
* @param key 参数键
|
||||
* @return dictDatas 字典数据列表
|
||||
*/
|
||||
public static String getCodeCache(String key)
|
||||
{
|
||||
String codeCache = SpringUtils.getBean(RedisCache.class).getCacheObject(getVerifyCodeCacheKey(key));
|
||||
if (StringUtils.isNotNull(codeCache))
|
||||
{
|
||||
return codeCache;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getVerifyCodeCacheKey(String key) {
|
||||
return CacheConstants.WE_CHAT_SMS_VERIFY_CODE_KEY + key;
|
||||
}
|
||||
@Transactional
|
||||
@Override
|
||||
public AjaxResult registerUser(IdentityAuthentication ientityAuthentication) {
|
||||
String codeCache = getCodeCache(ientityAuthentication.getPhone());
|
||||
// 校验短信验证码
|
||||
if(StrUtil.isEmpty(codeCache)){
|
||||
return AjaxResult.warn("验证码校验失败");
|
||||
}else if(!codeCache.equals(ientityAuthentication.getVerifyCode())){
|
||||
return AjaxResult.warn("验证码校验失败");
|
||||
}
|
||||
SysUser sysUserName=sysUserMapper.checkUserNameUnique(ientityAuthentication.getUserName());
|
||||
if(sysUserName!=null){
|
||||
return AjaxResult.warn("账号已存在");
|
||||
}
|
||||
SysUser checkPhoneUnique = sysUserMapper.checkPhoneUnique(ientityAuthentication.getPhone());
|
||||
if(checkPhoneUnique!=null){
|
||||
return AjaxResult.warn("手机号已存在");
|
||||
}
|
||||
SysUser checkEmailUnique = sysUserMapper.checkEmailUnique(ientityAuthentication.getEmail());
|
||||
if(checkEmailUnique!=null){
|
||||
return AjaxResult.warn("邮箱已存在");
|
||||
}
|
||||
|
||||
// 根据身份证查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增
|
||||
SysUser sysUser=sysUserMapper.selectUserByIdCard(ientityAuthentication.getIdentityNo());
|
||||
if(sysUser!=null){
|
||||
sysUser.setIdCard(ientityAuthentication.getIdentityNo());
|
||||
sysUser.setNickName(ientityAuthentication.getName());
|
||||
sysUser.setUserName(ientityAuthentication.getUserName());
|
||||
sysUser.setPhonenumber(ientityAuthentication.getPhone());
|
||||
sysUser.setEmail(ientityAuthentication.getEmail());
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord()));
|
||||
sysUserMapper.updateUser(sysUser);
|
||||
ientityAuthentication.setUserId(sysUser.getUserId());
|
||||
}else {
|
||||
sysUser=new SysUser();
|
||||
sysUser.setIdCard(ientityAuthentication.getIdentityNo());
|
||||
sysUser.setNickName(ientityAuthentication.getName());
|
||||
sysUser.setUserName(ientityAuthentication.getUserName());
|
||||
sysUser.setPhonenumber(ientityAuthentication.getPhone());
|
||||
sysUser.setEmail(ientityAuthentication.getEmail());
|
||||
sysUser.setCreateBy(ientityAuthentication.getUserName());
|
||||
sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord()));
|
||||
int row = sysUserMapper.insertUser(sysUser);
|
||||
if(row<1) {
|
||||
return AjaxResult.warn("注册失败");
|
||||
}
|
||||
}
|
||||
|
||||
ientityAuthentication.setUserId(sysUser.getUserId());
|
||||
ientityAuthentication.setUserName(sysUser.getUserName());
|
||||
// 已经认证过的用户才能注册,认证表中已经有该数据
|
||||
identityAuthenticationMapper.updateIdentityAuthentication(ientityAuthentication);
|
||||
return AjaxResult.success("注册成功");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user