调节系统类整理

This commit is contained in:
18792927508
2024-01-05 11:54:46 +08:00
parent fee63623ad
commit d0c94dc287
105 changed files with 423 additions and 14673 deletions
@@ -20,7 +20,6 @@ public interface ISysUserService
* @return 用户信息集合信息
*/
public List<SysUser> selectUserList(SysUser user);
public List<SysUser> selectUserListByAdRole(Arbitrator arbitrator);
/**
* 根据条件分页查询已分配用户角色列表
@@ -9,8 +9,6 @@ import javax.validation.Validator;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.mapper.*;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -62,8 +60,6 @@ public class SysUserServiceImpl implements ISysUserService {
@Autowired
private ISysConfigService configService;
@Autowired
private CaseApplicationMapper caseApplicationMapper;
@Autowired
protected Validator validator;
@@ -80,23 +76,6 @@ public class SysUserServiceImpl implements ISysUserService {
return userMapper.selectUserList(user);
}
@Override
public List<SysUser> selectUserListByAdRole(Arbitrator arbitrator) {
List<SysUser> sysUsers = userMapper.selectUserListByAdRole(arbitrator);
if(sysUsers!=null&&sysUsers.size()>0){
for(SysUser sysUser: sysUsers){
Long userId = sysUser.getUserId();
int casenum = caseApplicationMapper.selectCasenum(userId.toString());
String nickName = sysUser.getNickName();
String nickNamenew = nickName + "(待办案件数量" + casenum + "个)";
sysUser.setNickNameAndNum(nickNamenew);
}
}
return sysUsers;
}
/**
* 根据条件分页查询已分配用户角色列表
*
@@ -0,0 +1,76 @@
package com.ruoyi.wisdomarbitrate.domain.dto;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Entity
@Data
@Table(name="ms_case_log_record")
public class MsCaseLogRecordDTO implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "Id")
@GeneratedValue(generator = "JDBC")
private Long id;
/**
* 案件申请id
*/
@Column(name="case_appli_id")
private Long caseAppliId;
/**
* 案件节点
*/
@Column(name="case_node")
private Integer caseNode;
/**
* 案件节点时间
*/
@Column(name="case_node_time")
private Date caseNodeTime;
/**
* 备注
*/
@Column(name="notes")
private String notes;
/**
* 操作人用户名
*/
@Column(name="create_by")
private String createBy;
/**
* 操作人用户昵称
*/
@Column(name="create_nick_name")
private String createNickName;
/**
* 创建时间
*/
@Column(name="create_time")
private Date createTime;
/**
* 更新者
*/
@Column(name="update_by")
private String updateBy;
/**
* 更新时间
*/
@Column(name="update_time")
private Date updateTime;
}
@@ -1,4 +1,4 @@
package com.ruoyi.wisdomarbitrate;
package com.ruoyi.wisdomarbitrate.domain.vo;
import lombok.Data;
@@ -1,17 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import java.util.List;
public interface ArbitrateRecordMapper {
int insertArbitrateRecord(ArbitrateRecord arbitrateRecord);
int updataArbitrateRecord(ArbitrateRecord arbitrateRecord);
ArbitrateRecord selectArbitrateRecord(ArbitrateRecord arbitrateRecord);
}
@@ -1,12 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ArbitratorMapper {
List<Arbitrator> selectArbitratorList(Arbitrator arbitrator);
}
@@ -1,25 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CaseAffiliateLogMapper {
int batchCaseAffiliate(List<CaseAffiliate> caseAffiliates);
void deletecaseAffiliate(CaseApplication caseApplication);
void batchDeletecaseAffiliate(@Param("ids") List<Long> ids);
List<CaseAffiliate> selectCaseAffiliate(@Param("caseAppliLogId") Long caseAppliLogId);
CaseAffiliate selectCaseAffiliateByIdentityType(@Param("caseAppliLogId") Long caseAppliLogId, @Param("identityType")int identityType);
int updataCaseAffiliate(CaseAffiliate caseAffiliate);
}
@@ -1,45 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CaseAffiliateMapper {
int batchCaseAffiliate(List<CaseAffiliate> caseAffiliates);
void deletecaseAffiliate(CaseApplication caseApplication);
void batchDeletecaseAffiliate(@Param("ids") List<Long> ids);
List<CaseAffiliate> selectCaseAffiliate(CaseAffiliate caseAffiliate);
List<CaseAffiliate> selectCaseAffiliateByCaseIds(@Param("ids") List<Long> ids);
CaseAffiliate selectCaseAffiliateByIdentityType(@Param("caseAppliId") Long caseAppliId, @Param("identityType")int identityType);
int updataCaseAffiliate(CaseAffiliate caseAffiliate);
/**
* 根据案件查询邮箱
* @param id
* @return
*/
List<CaseAffiliate> emailByCaseId(@Param("caseAppliId")Long id);
/**
* 批量修改
* @param affiliateLogList
*/
void updateCaseAffiliateByCaseId(@Param("caseAppliId")Long caseAppliId,@Param("list") List<CaseAffiliate> affiliateLogList);
/**
* 根据案件id删除
* @param caseId
*/
void deleteByCaseId(@Param("caseAppliId") Long caseId);
}
@@ -1,56 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.UpdateSubmitVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author wangqiong
* @description 案件日志
* @date 2023-11-17 14:05
*/
@Repository
public interface CaseApplicationLogMapper {
int insert(CaseApplication caseApplicationLog);
int deleteById(Long id);
CaseApplication selectByCaseIdAndVersion(@Param("caseAppliId")long caseAppliId,@Param("version") int version);
Integer selectMaxVersionByCaseId(@Param("caseAppliId")long caseAppliId);
/**
* 修改日志表状态
* @param vo
*/
void updateStatus(UpdateSubmitVO vo);
/**
* 根据案件id查询秘书角色最新版本号
* @param id
* @return
*/
Integer selectMaxVersionBySecret(@Param("caseAppliId")Long id);
/**
* 删除日志
* @param ids
*/
void batchDeleteLog(@Param("ids") List<Long> ids);
CaseApplication selectBeforeCase(@Param("caseId") Long caseId, @Param("version")Integer version);
Integer batchSave(@Param("list")List<CaseApplication> caseApplications);
/**
* 根据案件id查询所有的日志id
* @param ids
* @return
*/
List<Long> selectLogsByCaseIds(@Param("ids")List<Long> ids);
}
@@ -1,140 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CaseApplicationMapper {
List<CaseApplication> selectCaseApplicationList(CaseApplication caseApplication);
List<CaseApplication> selectCaseApplicationList1(CaseApplication caseApplication);
int selectCaseApplicationCount(CaseApplication caseApplication);
/**
* 查询超级管理员案件
* @param caseApplication
* @return
*/
List<CaseApplication> selectAdminCaseApplicationList(CaseApplication caseApplication);
int insertCaseApplication(CaseApplication caseApplication);
int updataCaseApplication(CaseApplication caseApplication);
int submitCaseApplication(CaseApplication caseApplication);
int deletecaseApplication(CaseApplication caseApplication);
CaseApplication selectCaseApplication(CaseApplication caseApplication);
/**
* 根据案件id查询案件信息
* @param ids
* @return
*/
List<CaseApplication> listCaseApplicationByIds(@Param("ids")List<Long> ids);
CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication);
/**
* 查询最大编号
* @param caseNum
* @param length
* @return
*/
Integer selectCaseNumLike(@Param("caseNum") String caseNum, @Param("length") int length);
/**
* 查询仲裁员根据案件id
* @param id
* @return
*/
String selectArbitratorList(@Param("id") String id);
/**
* 修改支付方式
* @param payDTO
*/
void updatePayType(CaseConfirmPayDTO payDTO);
ToDoCount selectAdminCaseToDoCount();
ToDoCount selectTodoCountByRole(CaseApplication caseApplication);
/**
* 修改案件锁定状态
* @param id
* @param lockStatus
* @return
*/
int updateCaseLockStatus(@Param("id")Long id,@Param("lockStatus") Integer lockStatus);
/**
* 批量删除案件
* @param ids
* @return
*/
int batchDeletecaseApplication(@Param("ids") List<Long> ids);
/**
* 绑定房间号
* @param caseId
* @param roomId
*/
void bindCaseId(@Param("caseId")Long caseId,@Param("roomId") String roomId);
/**
* 根据房间号查询案件id
* @param roomId
* @return
*/
Long selectCaseIdByRoomId(@Param("roomId")String roomId);
/**
* 查询已办案件
* @param caseApplication
* @return
*/
List<CaseApplication> selectHandledCase(CaseApplication caseApplication);
/**
* 查询最大房间号
* @return
*/
Long selectMaxRoomId();
/**
* 修改案件版本号
* @param id
* @param version
*/
void updateVersionById(@Param("id")Long id, @Param("version")Integer version);
/**
* 查询最大批号
* @return
*/
Integer selectBatchNumberLike();
/**
* 批量新增案件
* @param caseApplications
* @return
*/
int batchSave(@Param("list")List<CaseApplication> caseApplications);
int selectCasenum(@Param("userId") String userId);
List<CaseApplication> selectAdminCaseApplicationListBatch(CaseApplication caseApplication);
List<CaseApplication> listCaseApplicationByBatchNumber(CaseApplication caseApplication);
}
@@ -1,29 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.wisdomarbitrate.domain.CaseEvidenceDirectory;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface CaseEvidenceDirectoryMapper {
int save(CaseEvidenceDirectory caseEvidenceDirectory);
/**
* 查询证据目录信息
*
* @param caseEvidenceDirectory 目录信息
* @return 目录信息集合
*/
List<CaseEvidenceDirectory> selectList(CaseEvidenceDirectory caseEvidenceDirectory);
/**
* 根据证据名称查询证据目录树信息
* @param evidenceName 证据名称
* @param deptCheckStrictly 目录树选择项是否关联显示
*/
List<Integer> selectDeptListByEvidenceName(@Param("evidenceName") String evidenceName, @Param("deptCheckStrictly") boolean deptCheckStrictly);
}
@@ -1,16 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface CaseEvidenceMapper {
List<CaseEvidenceVO> getCaseListByRespondent(@Param(value = "identityNum" ) String identityNum
, @Param(value = "caseStatusList") List<Integer> caseStatusList
, @Param(value = "identityType" ) Integer identityType
);
}
@@ -1,14 +1,13 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord;
import org.apache.ibatis.annotations.Mapper;
import com.ruoyi.wisdomarbitrate.domain.dto.MsCaseLogRecordDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
@Mapper
public interface CaseLogRecordMapper {
public interface CaseLogRecordMapper extends Mapper<MsCaseLogRecordDTO> {
List<CaseLogRecord> selectCaseLogRecordList(CaseLogRecord caseLogRecord);
@@ -1,15 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CasePaymentRecord;
import java.util.List;
public interface CasePaymentRecordMapper {
int saveRecord(CasePaymentRecord casePaymentRecord);
List<CasePaymentRecord> queryRecord(String orderNumber);
void update(CasePaymentRecord casePaymentRecord);
CasePaymentRecord selectRecordByCaseId(Long id);
}
@@ -1,32 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SealSignRecordMapper {
List<SealSignRecord> selectSealSignRecord(SealSignRecord sealSignRecord);
/**
* 查询已签署和签署中的文件
* @param sealSignRecord
* @return
*/
List<SealSignRecord> selectSealSignRecordbyStat(SealSignRecord sealSignRecord);
/**
* 差询等待签署,签署中的案件
* @param penSonAccount 签署人员
* @return
*/
List<CaseApplication> selectSealSigning(@Param("penSonAccount") String penSonAccount, @Param("caseStatus") Integer caseStatus);
int updataSealSignRecord(SealSignRecord sealSignRecord);
void insertSealSignRecord(SealSignRecord sealSignRecord);
}
@@ -1,16 +0,0 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.TemplateManual;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TemplateManualMapper {
int insertTemplateManual(TemplateManual templateManual);
int updateTemplateManual(TemplateManual templateManual);
List<TemplateManual> selectTemplateManual(TemplateManual templateManual);
}
@@ -1,58 +0,0 @@
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);
}
@@ -1,60 +0,0 @@
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);
}
@@ -1,12 +0,0 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import java.util.List;
public interface IArbitratorService {
List<Arbitrator> selectArbitratorList(Arbitrator arbitrator);
}
@@ -1,154 +0,0 @@
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);
}
@@ -1,17 +0,0 @@
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);
}
@@ -1,70 +0,0 @@
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);
}
@@ -1,36 +0,0 @@
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);
}
@@ -1,28 +0,0 @@
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);
}
}
@@ -11,12 +11,13 @@ import org.springframework.stereotype.Component;
@Component
@Slf4j
public class CallBackHandleServiceImpl implements CallBackService {
@Autowired
private CasePaymentServiceImpl casePaymentService;
// todo
// @Autowired
// private CasePaymentServiceImpl casePaymentService;
@Override
public void successPay(String orderSn) {
casePaymentService.callback(orderSn);
// casePaymentService.callback(orderSn);
}
@Override
@@ -1,512 +0,0 @@
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);
}
}
}
@@ -1,533 +0,0 @@
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;
}
}
}
@@ -1,511 +0,0 @@
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;
}
}
@@ -1,328 +0,0 @@
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;");
}
}
}
@@ -1,491 +0,0 @@
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);
}
}
@@ -1,485 +0,0 @@
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()));
}
}
@@ -1,72 +0,0 @@
package com.ruoyi.wisdomarbitrate.task;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.FatchRule;
import com.ruoyi.wisdomarbitrate.service.impl.CaseZipImportImpl;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
/**
* @description rbd调用xfta计算任务类
* @Author mingYang
* @Date 2021/11/12 15:35
* @Version V1.0
**/
public class CaseZipImportTask implements Callable<List<CaseApplication>> {
private CaseZipImportImpl caseZipImportImpl;
private Long templateId;
private List<FatchRule> fatchRuleList;
private Map<String, String> fatchMap;
private Map<String, List<FatchRule>> fatchRuleMap;
private Map<String, SysUser> userMap;
private List<SysDictData> dictDataList;
private File[] files;
private Map<String, Long> deptMap;
private LoginUser loginUser;
private Integer maxBatchNumber;
public CaseZipImportTask(CaseZipImportImpl caseZipImportImpl, Long templateId, List<FatchRule> fatchRuleList, Map<String, String> fatchMap, Map<String, List<FatchRule>> fatchRuleMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, File[] files, Map<String, Long> deptMap, LoginUser loginUser,Integer maxBatchNumber) {
this.caseZipImportImpl = caseZipImportImpl;
this.templateId = templateId;
this.fatchRuleList = fatchRuleList;
this.fatchMap = fatchMap;
this.fatchRuleMap = fatchRuleMap;
this.userMap = userMap;
this.dictDataList = dictDataList;
this.files = files;
this.deptMap = deptMap;
this.loginUser = loginUser;
this.maxBatchNumber = maxBatchNumber;
}
@Override
public List<CaseApplication> call() {
List<CaseApplication> caseApplications = new ArrayList<>();
try {
for (File file1 : files) {
if (file1.isDirectory() && file1.listFiles() != null) {
for (File file2 : file1.listFiles()) {
CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser,maxBatchNumber);
if (caseApplication != null) {
caseApplications.add(caseApplication);
}
}
}
}
} catch (Exception e) {
throw new RuntimeException("导入失败");
}
return caseApplications;
}
}
@@ -1,362 +0,0 @@
package com.ruoyi.wisdomarbitrate.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.constant.FileTransformation;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.utils.SealUtil;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.wisdomarbitrate.domain.*;
import com.ruoyi.wisdomarbitrate.mapper.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.IOException;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Component
public class FixSelectFlowDetailUtils {
@Autowired
private CaseApplicationMapper caseApplicationMapper;
@Autowired
private SealSignRecordMapper sealSignRecordMapper;
@Autowired
private CaseAttachMapper caseAttachMapper;
@Autowired
private DeptIdentifyMapper deptIdentifyMapper;
@Autowired
private SealManageMapper sealManageMapper;
/*
定时查询签署流程详情
*/
@Scheduled(cron = "0/10 * * * * ?")
@Transactional
public void fixExecuteSelectFlowDetailUtils() {
Gson gson = new Gson();
SealSignRecord sealSignRecordselect = new SealSignRecord();
// sealSignRecordselect.setSignFlowStatus(1);
List<SealSignRecord> sealSignRecords = sealSignRecordMapper.selectSealSignRecordbyStat(sealSignRecordselect);
try {
if (sealSignRecords != null && sealSignRecords.size() > 0) {
for (int i = 0; i < sealSignRecords.size(); i++) {
SealSignRecord sealSignRecord = sealSignRecords.get(i);
EsignHttpResponse signFlowDetail = SignAward.signFlowDetail(sealSignRecord);
JsonObject signFlowDetailJsonObject = gson.fromJson(signFlowDetail.getBody(), JsonObject.class);
JsonObject flowDetailData = signFlowDetailJsonObject.getAsJsonObject("data");
JsonArray signersArray = flowDetailData.get("signers").getAsJsonArray();
Integer psnsignStatus = null;
Integer orgsignStatus = null;
for (int j = 0; j < signersArray.size(); j++) {
JsonObject signerObject = (JsonObject) signersArray.get(j);
if (!(signerObject.get("psnSigner").toString()).equals("null")) {
JsonObject psnSignerData = signerObject.getAsJsonObject("psnSigner");
if (psnSignerData != null) {
psnsignStatus = signerObject.get("signStatus").getAsInt();
}
}
if (!(signerObject.get("orgSigner").toString()).equals("null")) {
JsonObject orgSignerData = signerObject.getAsJsonObject("orgSigner");
if (orgSignerData != null) {
orgsignStatus = signerObject.get("signStatus").getAsInt();
}
}
}
if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 1)) {
//更新立案申请状态为待用印
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(sealSignRecord.getCaseAppliId());
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
if (caseApplicationselect != null) {
if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.SIGN_ARBITRATION)) {
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL);
caseApplicationMapper.submitCaseApplication(caseApplication);
//修改"签署用印记录表"的状态为待用印
sealSignRecord.setSignFlowStatus(2);
sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
}
}
}
if ((psnsignStatus.intValue() == 2) && (orgsignStatus.intValue() == 2)) {
//更新立案申请状态为待送达
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(sealSignRecord.getCaseAppliId());
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
if (caseApplicationselect != null) {
if ((caseApplicationselect.getCaseStatus() != null) && (caseApplicationselect.getCaseStatus().intValue() == CaseApplicationConstants.ARBITRATED_SEAL)) {
caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY);
//下载审核完成的裁决书,
String signFlowId = sealSignRecord.getSignFlowid();
EsignHttpResponse fileDownload = SaaSAPIFileUtils.fileDownloadUrl(signFlowId);
JsonObject fileDownloadJsonObject = gson.fromJson(fileDownload.getBody(), JsonObject.class);
JsonObject fileDownloadData = fileDownloadJsonObject.getAsJsonObject("data");
JsonArray filesArray = fileDownloadData.get("files").getAsJsonArray();
if (filesArray != null && filesArray.size() > 0) {
JsonObject fileObject = (JsonObject) filesArray.get(0);
String fileDownloadUrl = fileObject.get("downloadUrl").toString();
//修改"签署用印记录表"的状态为签署完成
sealSignRecord.setSignFlowStatus(3);
sealSignRecord.setFileDownloadUrl(fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1));
sealSignRecordMapper.updataSealSignRecord(sealSignRecord);
String filearbitraUrl = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
caseApplication.setFilearbitraUrl(filearbitraUrl);
caseApplicationMapper.submitCaseApplication(caseApplication);
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();
}
String fileDownloadUrlnew = fileDownloadUrl.substring(1, fileDownloadUrl.length() - 1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, resultFilePath);
if (downLoadFile) {
Long caseAppliId = sealSignRecord.getCaseAppliId();
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseAppliId);
caseAttach.setAnnexType(3);
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
caseAttachMapper.updateCaseAttachBycaseid(caseAttach);
}
}
}
}
}
}
}
} catch (EsignDemoException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 定时查询企业认证状态
*
* @throws Exception
*/
@Scheduled(cron = "*/30 * * * * *")
@Transactional
public void fixExecuteSelectDeptIndentifyUtils() throws Exception {
Gson gson = new Gson();
DeptIdentify deptIdentify = new DeptIdentify();
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
for (int i = 0; i < deptIdentifysnew.size(); i++) {
DeptIdentify deptIdentify1 = deptIdentifysnew.get(i);
Integer identifyStatus = deptIdentify1.getIdentifyStatus();
if (identifyStatus!=1){
String authFlowId = deptIdentify1.getAuthFlowId();
if (authFlowId != null) {
EsignHttpResponse identifyInfo = SignAward.getDeptIdentifyInfo(deptIdentify1);
JsonObject identifyInfoJsonObject = gson.fromJson(identifyInfo.getBody(), JsonObject.class);
int code = identifyInfoJsonObject.get("code").getAsInt();
if (code == 0) {
JsonObject identifyInfoData = identifyInfoJsonObject.getAsJsonObject("data");
int realnameStatus = identifyInfoData.get("realnameStatus").getAsInt();
if (realnameStatus == 1) {
String orgId = identifyInfoData.get("orgId").getAsString();
//查询企业内部印章
EsignHttpResponse response = SignAward.deptIdentifySealList(orgId);
JsonObject jsonObject = gson.fromJson(response.getBody(), JsonObject.class);
int code1 = jsonObject.get("code").getAsInt();
if (code1 == 0) {
JsonObject data = jsonObject.getAsJsonObject("data");
JsonArray seals = data.get("seals").getAsJsonArray();
if (seals.size() > 0) {
for (int j = 0; j < seals.size(); j++) {
//保存印章信息到数据库
JsonObject asJsonObject = seals.get(j).getAsJsonObject();
SealManage sealManage = new SealManage();
String sealName = asJsonObject.get("sealName").toString();
String sealId = asJsonObject.get("sealId").toString();
String url = asJsonObject.get("sealImageDownloadUrl").toString();
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("-", "") + ".jpg";
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();
}
String fileDownloadUrlnew = url.substring(1, url.length() - 1);
boolean downLoadFile = FileTransformation.downLoadFileByUrl(fileDownloadUrlnew, 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) {
//将印章信息保存到公章管理表里
String sealName1 = sealName.substring(1, sealName.length() - 1);
String sealId1 = sealId.substring(1, sealId.length() - 1);
Integer annexId1 = caseAttach.getAnnexId();
sealManage.setAnnexId(annexId1);
sealManage.setSealId(sealId1);
sealManage.setSealName(sealName1);
sealManage.setIdentifyId(deptIdentify1.getId());
sealManage.setSealStatus(1);
sealManage.setIsUse(1);
sealManageMapper.insertSealManage(sealManage);
}
}
}
}
}
//将orgId保存到数据库里
deptIdentify1.setOrgId(orgId);
deptIdentify1.setIdentifyStatus(1);
deptIdentify1.setIsUse(0); //默认机构为未启用
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
}
}else {
deptIdentify1.setIdentifyStatus(2);
deptIdentifyMapper.updateDeptIdentify(deptIdentify1);
}
}
}
}
}
}
/**
* 定时查询印章审核状态
*/
@Scheduled(cron = "0/30 * * * * ?")
@Transactional
public void searchForInstitutionalSeal() {
try {
SealManage sealManage = new SealManage();
sealManage.setSealStatus(0);
List<SealManage> sealManageList = sealManageMapper.selectSealList(sealManage);
if (sealManageList != null && sealManageList.size() > 0) {
for (SealManage sealManage1 : sealManageList) {
//查询企业内部印章
Integer annexId = sealManage1.getAnnexId();
String sealId = sealManage1.getSealId();
DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setId(sealManage1.getIdentifyId());
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
if (deptIdentifies != null && deptIdentifies.size() > 0) {
DeptIdentify deptIdentify1 = deptIdentifies.get(0);
String orgId = deptIdentify1.getOrgId();
if (orgId == null) {
continue;
}
if (annexId == null) {
//说明之前没有下载过
EsignHttpResponse response = SignAward.getOrgSeal(orgId, sealId);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
int code = jsonObject.getIntValue("code");
if (code == 0) {
JSONObject data = jsonObject.getJSONObject("data");
int sealStatus = data.getIntValue("sealStatus");
if (sealStatus == 1) {//印章状态 1已启用,2待审核,3审核不通过,4 挂起
//已启用证明审核通过,下载到数据库
String sealImageDownloadUrl = data.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("-", "") + ".jpg";
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();
sealManage1.setAnnexId(annexId1);
sealManage1.setSealStatus(1);
sealManage1.setIsUse(0);
sealManageMapper.updateSealManage(sealManage1);
}
}
}
}
}
}
}
}
} catch (EsignDemoException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@@ -17,14 +17,4 @@ public class ImageToBase64Converter {
String base64Image = Base64.getEncoder().encodeToString(imageBytes);
return base64Image;
}
public static void main(String[] args) {
String imagePath = "D:\\develop\\2.jpg";
try {
String base64Image = imageToBase64(imagePath);
System.out.println(base64Image);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@@ -1,27 +1,20 @@
package com.ruoyi.wisdomarbitrate.utils;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.enums.EsignRequestType;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.EsignApplicaConfig;
import com.ruoyi.common.utils.EsignHttpHelper;
import com.ruoyi.common.utils.SealUtil;
import com.ruoyi.wisdomarbitrate.StringIdsReq;
import com.ruoyi.wisdomarbitrate.domain.vo.StringIdsReq;
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public class SignAward {
@@ -16,12 +16,6 @@ import java.util.zip.ZipFile;
@Slf4j
public class UnZipFileUtils {
public static void main(String[] args) {
File file = new File("D:\\home\\ruoyi\\仲裁委项目-测试单.zip");
String targetPath = "D:\\home\\unzip\\";
unZipFile(file,targetPath);
}
public static boolean unZipFile(File aboriginalFile, String targetPath) {
if (!aboriginalFile.exists()) {
log.error("此文件不存在:", aboriginalFile.getPath());
@@ -10,27 +10,6 @@ import java.util.zip.ZipOutputStream;
public class ZipFileUtils {
public static void main(String[] args) {
String file1 = "F:\\testZip\\123.pdf";
String file2 = "F:\\testZip\\456.png";
String zipFileOutPath = "F:\\testZip\\outputfile123.zip";
try {
FileOutputStream zfous = new FileOutputStream(zipFileOutPath);
ZipOutputStream zipFileOutstream = new ZipOutputStream(zfous);
FileInputStream fis1 = new FileInputStream(file1);
FileInputStream fis2 = new FileInputStream(file2);
zipFile(file1, fis1, zipFileOutstream);
zipFile(file2, fis2, zipFileOutstream);
zipFileOutstream.close();
zfous.close();
System.out.println("文件成功打包成ZIP文件!");
} catch (IOException e) {
e.printStackTrace();
}
}
public static void zipFile(String zipfilePath, FileInputStream zipFileinsteam, ZipOutputStream zipfileOut)
throws IOException {
ZipEntry zipfileEntry = new ZipEntry(new File(zipfilePath).getName());