案件新增,查询

This commit is contained in:
18792927508
2024-01-10 11:34:33 +08:00
parent c0ac1d92e9
commit 164612c08a
21 changed files with 739 additions and 570 deletions
@@ -1,13 +1,15 @@
package com.ruoyi.web.controller.common;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.config.ServerConfig;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -15,13 +17,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.framework.config.ServerConfig;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
* 通用请求处理
@@ -108,12 +108,12 @@ public class CommonController
* @param originalFilename
*/
private void saveCaseAttach(Long id, Integer annexType, String fileName, String originalFilename) {
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(id)
MsCaseAttach caseAttach = MsCaseAttach.builder().caseAppliId(id)
.annexName(originalFilename)
.annexPath(fileName)
.annexType(annexType)
.userId(SecurityUtils.getUserId())
.userName(SecurityUtils.getUsername())
.useId(SecurityUtils.getUserId())
.useAccount(SecurityUtils.getUsername())
.build();
msCaseAttachMapper.save(caseAttach);
}
@@ -132,7 +132,7 @@ public class CommonController
MsCaseApplicationVO msCaseApplicationVO = new MsCaseApplicationVO();
msCaseApplicationVO.setId(caseAppliId);
msCaseApplicationVO.setAnnexTypeList(annexTypeList);
List<CaseAttach> caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO);
List<MsCaseAttach> caseAttachList = msCaseAttachMapper.queryCaseAttachList(msCaseApplicationVO);
return AjaxResult.success(caseAttachList);
}
@@ -1,14 +1,12 @@
package com.ruoyi.web.controller.wisdomarbitrate.mscase;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@@ -27,15 +25,22 @@ public class MsCaseApplicationController extends BaseController {
/**
* 分页查询案件列表
*/
@PreAuthorize("@ss.hasPermi('caseApplication:list')")
@GetMapping("/page")
public TableDataInfo list(MsCaseApplicationReq req)
@GetMapping("/list")
public TableDataInfo page(MsCaseApplicationReq req)
{
startPage();
List<MsCaseApplication> list = caseApplicationService.list(req);
List<MsCaseApplicationVO> list = caseApplicationService.list(req);
return getDataTable(list);
}
/**
* 新增案件
*/
@PostMapping("/insert")
public AjaxResult insert(@RequestBody MsCaseApplicationVO caseApplication )
{
return success(caseApplicationService.insert(caseApplication));
}
@@ -1,33 +1,28 @@
package com.ruoyi.common.utils;
import com.ruoyi.common.utils.uuid.UUID;
import com.sun.net.ssl.internal.ssl.Provider;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;
import javax.activation.DataHandler;
import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.search.*;
import javax.mail.util.ByteArrayDataSource;
import javax.mail.search.SearchTerm;
import javax.mail.search.SubjectTerm;
import javax.validation.constraints.NotNull;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.Security;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
/**
* @ClassName EmailInUtil
@@ -103,7 +98,6 @@ public class EmailOutUtil {
MimeBodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent(messageContent, "text/html;charset=utf-8");
messageBodyPart.setContentID(UUID.randomUUID().toString());
Security.addProvider(new Provider());
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
//设置邮件会话参数
Properties props = new Properties();
@@ -1,8 +1,9 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.SysUserRole;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户与角色关联表 数据层
@@ -59,4 +60,11 @@ public interface SysUserRoleMapper
* @return 结果
*/
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
/**
* 新增
* @param userId
* @param roleId
*/
void insertUserRole(@Param("userId")Long userId, @Param("roleId")Long roleId);
}
@@ -1,6 +1,5 @@
package com.ruoyi.wisdomarbitrate.domain.dto.casenumrule;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
@@ -13,7 +12,7 @@ public class CaseNumRule extends BaseEntity {
/** 前缀 */
private String prefixstr;
/** 时间格式 */
private Integer dateFormat;
private String dateFormat;
/** 机构名称 */
private String deptName;
/** 机构名称首字符拼写 */
@@ -29,7 +29,7 @@ public class SealManage extends BaseEntity {
/**
* 附件id
*/
private Integer annexId;
private Long annexId;
/**
* 印章审核状态(0未通过,1通过)
@@ -1,58 +0,0 @@
package com.ruoyi.wisdomarbitrate.domain.dto.mscase;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CaseAttach {
/**
* 附件id
*/
private Integer annexId;
/**
* 案件申请id
*/
private Long caseAppliId;
/**
* 案件记录id
*/
private Long caseAppliLogId;
/**
* 附件名称
*/
private String annexName;
/**
* 附件路径
*/
private String annexPath;
/**
* 附件类型,立案申请书(1)、申请人证据材料(2)、仲裁文书(3)、案件视频(4)、身份证件(5)、被申请人证据材料 (6)、庭审笔录(7)、缴费凭证(8)'
*/
private Integer annexType;
/**
* 备注
*/
private String note;
/**
* 用户id
*/
private Long userId;
/**
* 用户账户
*/
private String userName;
/**
* 印章状态(0未启用,1已启用)
*/
private Integer sealStatus;
/**
* 是否是证据上传,0-否,1-是
*/
private Integer isBatchUpload;
}
@@ -1,12 +1,16 @@
package com.ruoyi.wisdomarbitrate.domain.entity.mscase;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
@Getter
@Setter
@ToString
@@ -23,7 +27,7 @@ public class MsCaseApplication {
* 批次
*/
@Column(name = "batch_number")
private Integer batchNumber;
private String batchNumber;
/**
* 模板id
@@ -50,10 +54,15 @@ public class MsCaseApplication {
private String mediationMethod;
/**
* 案件状态,字典
* 案件状态
*/
@Column(name = "case_status")
private Integer caseStatus;
@Column(name = "case_status_name")
private String caseStatusName;
/**
* 案件流程id
*/
@Column(name = "case_flow_id")
private Integer caseFlowId;
/**
* 开庭日期
@@ -1,13 +1,17 @@
package com.ruoyi.wisdomarbitrate.domain.entity.mscase;
import javax.persistence.*;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Table(name = "ms_case_attach")
public class MsCaseAttach {
/**
@@ -22,6 +26,10 @@ public class MsCaseAttach {
*/
@Column(name = "case_appli_id")
private Long caseAppliId;
/**
* 案件日志id
*/
private Long caseAppliLogId;
/**
* 附件名称
@@ -4,8 +4,6 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@NoArgsConstructor
@AllArgsConstructor
@Data
@@ -13,7 +11,7 @@ public class MsCaseApplicationReq {
/**
* 批次
*/
private Integer batchNumber;
private String batchNumber;
/**
* 案件编号
@@ -24,12 +22,17 @@ public class MsCaseApplicationReq {
*/
private String applicationOrganId;
/**
* 案件状态,字典
* 案件状态
*/
private Integer caseStatus;
private String caseStatusName;
/**
* 创建时间
* 开始时间
*/
private Date createTime;
private String startTime;
/**
* 结束时间
*/
private String endTime;
private String userName;
}
@@ -1,414 +1,32 @@
package com.ruoyi.wisdomarbitrate.domain.vo.mscase;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 案件信息VO
*/
@NoArgsConstructor
@AllArgsConstructor
@Data
public class MsCaseApplicationVO extends BaseEntity {
private static final long serialVersionUID = 1L;
public class MsCaseApplicationVO extends MsCaseApplication {
/**
* 查询案件时区分是否待办案件,0待办案件,1已办案件
* 案件相关人员
*/
private String selectCaseStatus;
/** ID */
private Long id;
/** 案件名称 */
@Excel(name = "案件名称")
private String caseName;
/** 案件编号 */
// @Excel(name = "案件编号")
private String caseNum;
/** 案件标的 */
@Excel(name = "案件标的")
private BigDecimal caseSubjectAmount;
private MsCaseAffiliate affiliate;
/**
* 模板id
* 案件附件相关表
*/
private Long templateId;
/** 立案日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date registerDate;
/** 仲裁方式 */
private Integer arbitratMethod;
private List<MsCaseAttach> caseAttachList;
/**
* 是否导入,0手动录入,1导入,默认0
* 附件类型
*/
private Integer importFlag;
/** 仲裁方式名称 */
private String arbitratMethodName;
/** 案件状态 */
private Integer caseStatus;
/** 申请人是否书面审理 */
private Integer applicantIsWrittenHear;
/** 被申请人是否书面审理 */
private Integer respondentIsWrittenHear;
/** 开庭方式是否一致 */
private Integer arbitraMethodIssame;
/** 仲裁方式说明 */
private String arbitratMethodIllustrate;
/** 案件申请表ID */
private Long caseAppliId;
/** 开庭日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date hearDate;
/** 借款开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "借款开始日期")
private Date loanStartDate;
/** 借款结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "借款结束日期")
private Date loanEndDate;
/** 合同编号 */
@Excel(name = "合同编号")
private String contractNumber;
/** 申请人主张欠本金 */
@Excel(name = "申请人主张欠本金")
private BigDecimal claimPrinciOwed;
/** 申请人主张欠利息 */
@Excel(name = "申请人主张欠利息")
private BigDecimal claimInterestOwed;
/** 申请人主张违约金 */
@Excel(name = "申请人主张违约金")
private BigDecimal claimLiquidDamag;
/** 申请人请求仲裁庭裁决 */
@Excel(name = "申请人请求仲裁庭裁决",width = 36)
private String requestRule;
/** 是否财产保全申请 */
@Excel(name = "是否财产保全申请",width = 26,combo= {"是","否"},readConverterExp = "0=否,1=是")
private Integer properPreser;
/** 申请人仲裁请求及事实和理由 */
@Excel(name = "申请人仲裁请求及事实和理由",width = 36)
private String arbitratClaims;
/** 仲裁应缴费用 */
private BigDecimal feePayable;
/** 开始在线视频时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date beginVideoDate;
/** 在线视频人员 */
private String onlineVideoPerson;
/** 仲裁员id */
private String arbitratorId;
/** 仲裁员名称 */
private String arbitratorName;
/** 案件描述 */
private String caseDescribe;
/** 裁决书URL */
private String filearbitraUrl;
/** 是否同意组庭 */
private Integer isAgreePendTral;
/** 是否有异议需要举证 */
private Integer objectionAddEviden;
/** 是否需要开庭审理 */
private Integer openCourtHear;
/** 是否仲裁反请求 */
private Integer adjudicaCounter;
/**
* 仲裁反请求原因
*/
private String adjudicaCounterReason;
/** 被申请人是否缺席 */
private Integer isAbsence;
/** 是否管辖异议申请 */
private Integer objectiJuris;
/** 被申请人质证意见 */
private String responCrossOpin;
/** 被申请人的答辩意见 */
private String responDefenOpini;
/** 申请人是否缺席 */
private Integer appliIsAbsen;
/** 申请人质证意见 */
private String applicaCrossOpin;
/** 支付状态 */
private Integer paymentStatus;
/** 支付状态描述 */
private String paymentStatusName;
/**
* 支付方式code,0线上支付,1线下支付
*/
private Integer payTypeCode;
/**
* 支付方式name,0线上支付,1线下支付
*/
private String payTypeName;
/**
* 缴费凭证
*/
private List<CaseAttach> payOrderList;
// 导入校验失败信息
private StringBuilder errorMsg;
/**
* 是否锁定,0-否,1-是
*/
private Integer lockStatus;
/** 案件状态名称 */
private String caseStatusName;
/** 是否同意审核 */
private Integer agreeOrNotCheck;
/** 申请人名称 */
private String applicantName;
/** 被申请人名称 */
private String respondentName;
/**
* 用户身份证号
*/
private String idCard;
/**
* 用户id
*/
private String userId;
/**
* 登录用户用户名
*/
private String loginUserName;
private List<Long> deptIds;
/**
* 部门长状态
*/
private List<Integer> deptHeadStatus;
/**
* 代理人角色有关部门
*/
private List<Long> agentDeptIds;
/**
* 财务状态
*/
private Integer financeStatus;
/**
* 是否是被申请人,仲裁员,部门长,财务,代理人,0-否,1-是
*/
private Integer isOtherRole;
/**
* 案件日志id
*/
private Long caseLogId;
/** 仲裁结果 */
private String caseResult;
/** 是否指派仲裁员 */
private int pendingAppointArbotrar;
private List<Integer> caseStatusList;
private List<Integer> annexTypeList;
private Integer annexType;
/**
* 案件附件列表
*/
private List<CaseAttach> caseAttachList;
/** 身份类型 */
// @Excel(name = "身份类型")
private int identityType;
/**
* 申请人主体信息
*/
/** 姓名 */
@Excel(name = "申请人主体信息-申请人(机构)",width = 26)
private String name;
/** 身份证号 */
@Excel(name = "申请人主体信息-代码",width = 26)
private String identityNum;
/** 申请人主体信息-法定代表人 */
@Excel(name = "申请人主体信息-法定代表人",width = 26)
private String compLegalPerson;
/** 申请人主体信息-法定代表人 */
@Excel(name = "申请人主体信息-法定代表人职位",width = 26)
private String compLegalperPost;
/**
* 申请人主体信息-申请人(机构)id
*/
private String nameId;
/** 联系电话 */
@Excel(name = "申请人主体信息-联系电话",width = 26)
private String contactTelphone;
/** 联系地址 */
@Excel(name = "申请人主体信息-联系地址",width = 26)
private String contactAddress;
/** 单位电话 */
@Excel(name = "申请人主体信息-单位电话",width = 26)
private String workTelphone;
/** 单位地址 */
@Excel(name = "申请人主体信息-单位地址",width = 26)
private String workAddress;
/** 申请人住所 */
@Excel(name = "申请人主体信息-住所",width = 26)
private String residenAffiliAppli;
/** 申请人邮箱 */
@Excel(name = "申请人主体信息-邮箱",width = 26)
private String email;
/** 代理人姓名 */
@Excel(name = "申请人主体信息-代理人姓名",width = 26)
private String nameAgent;
/** 身份证号 */
@Excel(name = "申请人主体信息-代理人身份证号",width = 26)
private String identityNumAgent;
/** 联系电话 */
@Excel(name = "申请人主体信息-代理人联系电话",width = 26)
private String contactTelphoneAgent;
/** 联系地址 */
@Excel(name = "申请人主体信息-代理人联系地址",width = 26)
private String contactAddressAgent;
/** 申请人代理人职称 */
@Excel(name = "申请人主体信息-代理人职称",width = 26)
private String appliAgentTitle;
/**
* 被申请人主体信息
*/
/** 姓名 */
@Excel(name = "被申请人主体信息-申请人姓名",width = 26)
private String debtorName;
/** 身份证号 */
@Excel(name = "被申请人主体信息-身份证号",width = 26)
private String debtorIdentityNum;
/** 被申请人主体信息-性别 */
@Excel(name = "被申请人主体信息-性别",width = 26,combo= {"男","女"},readConverterExp = "0=男,1=女")
private String responSex;
/** 被申请人主体信息-出生年月日 */
@Excel(name = "被申请人主体信息-出生年月日",width = 26)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date responBirth;
/** 联系电话 */
@Excel(name = "被申请人主体信息-联系电话",width = 26)
private String debtorContactTelphone;
/** 联系地址 */
@Excel(name = "被申请人主体信息-联系地址",width = 26)
private String debtorContactAddress;
/** 被申请人住所 */
@Excel(name = "被申请人主体信息-住所",width = 26)
private String residenAffiliRespon;
/** 单位电话 */
@Excel(name = "被申请人主体信息-单位电话",width = 26)
private String debtorWorkTelphone;
/** 单位地址 */
@Excel(name = "被申请人主体信息-单位地址",width = 26)
private String debtorWorkAddress;
/** 邮箱 */
@Excel(name = "被申请人主体信息-邮箱",width = 26)
private String debtorEmail;
/** 代理人姓名 */
@Excel(name = "被申请人主体信息-代理人姓名",width = 26)
private String debtorNameAgent;
/** 身份证号 */
@Excel(name = "被申请人主体信息-代理人身份证号",width = 26)
private String debtorIdentityNumAgent;
/** 联系电话 */
@Excel(name = "被申请人主体信息-代理人联系电话",width = 26)
private String debtorContactTelphoneAgent;
/** 联系地址 */
@Excel(name = "被申请人主体信息-代理人联系地址",width = 26)
private String debtorContactAddressAgent;
/**
* 申请机构id
*/
private String applicationOrganId;
/**
* 版本号
*/
private Integer version;
/**
* 修改案件的提交状态,0-未提交,1-已提交,2-同意,3-拒绝,4-撤销
*/
private Integer updateSubmitStatus;
/** 合同名称 */
private String contractName;
/**
* 事实和理由
*/
private String facts;
/**
* 合同甲方
*/
private String partyA;
/**
* 利率
*/
private String interestRate;
/**
* 待还金额
*/
private String outstandingMoney;
/**
* 调解达成协议内容
*/
private String mediationAgreement;
/**
* 金融消费纠纷基本情况
*/
private String disputes;
/**
* 贷款类型
*/
private String loanType;
/**
* 贷款期限
*/
private String loanTerm;
/**
* 本案争议焦点
*/
private String caseFocus;
/**
* 本案事实
*/
private String caseFacts;
/**
* 被申请人对上述材料的质证意见
*/
private String respondentOpinion;
/**
* 申请人对上述材料的质证意见
*/
private String applicantOpinion;
/**
* 批号
*/
private Integer batchNumber;
/**
* 自定义字段
*/
private List<MsColumnValueVO> msColumnValueVOS;
/**
* 待办状态,0待办,1已办
*/
private Integer pendingStatus;
/** e签宝流程id */
private String signFlowId;;
}
@@ -1,7 +1,108 @@
package com.ruoyi.wisdomarbitrate.mapper.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface MsCaseApplicationMapper extends Mapper<MsCaseApplication> {
/**
* 查询最大批次号
* @return
*/
@Select("<script> select max(batch_number) as maxBatchNumber from ms_case_application " +
"</script>")
Integer selectMaxBatchNumber();
/**
* 查询最大编号
* @param caseNum
* @param length
* @return
*/
@Select("<script> select max(substring(case_num, #{length}+1,14)) as maxCaseNum from ms_case_application where case_num like CONCAT(#{caseNum},'%') " +
" </script>")
Integer selectCaseNumLike(@Param("caseNum") String caseNum, @Param("length") int length);
/**
* 案件列表查询
* @param req
* @param caseStatusName
* @return
*/
@Select("<script> select t.* from (select c.id,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
"a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_application c " +
"join ms_case_affiliate a on c.id=a.case_appli_id <where> " +
"<if test='caseStatusName != null and caseStatusName.size() > 0 '> and c.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusName' open='(' separator=',' close=')'>" +
"#{caseStatus}" +
"</foreach>" +
"</if> " +
"<if test=\"req.batchNumber != null and req.batchNumber != ''\">" +
" AND c.batch_number = #{req.batchNumber} " +
"</if> " +
"<if test=\"req.caseNum != null and req.caseNum != ''\">" +
" AND c.case_num = #{req.caseNum} " +
"</if> " +
"<if test=\"req.applicationOrganId != null and req.applicationOrganId != ''\">" +
" AND a.application_organ_id = #{req.applicationOrganId} " +
"</if> " +
"<if test=\"req.startTime != null and req.startTime != ''\">" +
"and c.create_time &gt;= #{req.startTime}</if>" +
"<if test=\"req.endTime != null and req.endTime != ''\">" +
"and c.create_time &lt;= #{req.endTime}</if>" +
" </where> " +
"union select c.id id,c.batch_number batchNumber,c.case_num caseNum,c.case_subject_amount caseSubjectAmount," +
"a.application_organ_name applicationOrganName,a.respondent_name respondentName,c.mediator_name mediatorName," +
"c.hear_date hearDate,c.case_status_name caseStatusName,c.create_time createTime from ms_case_log_record r " +
"join ms_case_application c on r.case_appli_id=c.id and r.case_status_name!=c.case_status_name " +
"join ms_case_affiliate a on c.id=a.case_appli_id <where> r.create_by=#{req.userName} and c.id not in (" +
"select c1.id from ms_case_application c1 JOIN ms_case_affiliate a1 ON a1.case_appli_id = c1.id" +
"<if test='caseStatusName != null and caseStatusName.size() > 0 '> and c.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusName' open='(' separator=',' close=')'>" +
"#{caseStatus}" +
"</foreach>" +
"</if> " +
"<if test=\"req.batchNumber != null and req.batchNumber != ''\">" +
" AND c1.batch_number = #{req.batchNumber} " +
"</if> " +
"<if test=\"req.caseNum != null and req.caseNum != ''\">" +
" AND c1.case_num = #{req.caseNum} " +
"</if> " +
"<if test=\"req.applicationOrganId != null and req.applicationOrganId != ''\">" +
" AND a1.application_organ_id = #{req.applicationOrganId} " +
"</if> " +
"<if test=\"req.startTime != null and req.startTime != ''\">" +
"and c1.create_time &gt;= #{req.startTime}</if>" +
"<if test=\"req.endTime != null and req.endTime != ''\">" +
"and c1.create_time &lt;= #{req.endTime}</if>" +
" </where> " +
" ) " +
"<if test='caseStatusName != null and caseStatusName.size() > 0 '> and c.case_status_name in" +
"<foreach item='caseStatus' index='index' collection='caseStatusName' open='(' separator=',' close=')'>" +
"#{caseStatus}" +
"</foreach>" +
"</if> " +
"<if test=\"req.batchNumber != null and req.batchNumber != ''\">" +
" AND c.batch_number = #{req.batchNumber} " +
"</if> " +
"<if test=\"req.caseNum != null and req.caseNum != ''\">" +
" AND c.case_num = #{req.caseNum} " +
"</if> " +
"<if test=\"req.applicationOrganId != null and req.applicationOrganId != ''\">" +
" AND a.application_organ_id = #{req.applicationOrganId} " +
"</if> " +
"<if test=\"req.startTime != null and req.startTime != ''\">" +
"and c.create_time &gt;= #{req.startTime}</if>" +
"<if test=\"req.endTime != null and req.endTime != ''\">" +
"and c.create_time &lt;= #{req.endTime}</if>" +
" ) t order by t.createTime desc,t.caseNum desc" +
" </script>")
List<MsCaseApplicationVO> list(@Param("req")MsCaseApplicationReq req, @Param("caseStatusName") List<String> caseStatusName);
}
@@ -1,7 +1,7 @@
package com.ruoyi.wisdomarbitrate.mapper.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -9,23 +9,23 @@ import java.util.List;
@Mapper
public interface MsCaseAttachLogMapper {
int save(CaseAttach caseAttach);
int save(MsCaseAttach caseAttach);
List<CaseAttach> queryAnnexPathByCaseId(Long id);
List<MsCaseAttach> queryAnnexPathByCaseId(Long id);
List<CaseAttach> queryCaseAttachList(MsCaseApplicationVO msCaseApplicationVO);
List<MsCaseAttach> queryCaseAttachList(MsCaseApplicationVO msCaseApplicationVO);
int updateCaseAttach(CaseAttach caseAttach);
int updateCaseAttach(MsCaseAttach caseAttach);
int updateCaseAttachBycaseid(CaseAttach caseAttach);
int updateCaseAttachBycaseid(MsCaseAttach caseAttach);
int deleteByFileIds(@Param("ids") List<Integer> fileIds);
List<CaseAttach> getCaseAttachByCaseIdAndType(CaseAttach caseAttach);
List<MsCaseAttach> getCaseAttachByCaseIdAndType(MsCaseAttach caseAttach);
CaseAttach queryAnnexById(Integer annexId);
MsCaseAttach queryAnnexById(Integer annexId);
Integer batchSave(@Param("list")List<CaseAttach> caseAttaches);
Integer batchSave(@Param("list")List<MsCaseAttach> caseAttaches);
}
@@ -1,7 +1,7 @@
package com.ruoyi.wisdomarbitrate.mapper.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -9,23 +9,23 @@ import java.util.List;
@Mapper
public interface MsCaseAttachMapper {
int save(CaseAttach caseAttach);
int batchSave(@Param("list") List<CaseAttach> caseAttach);
int save(MsCaseAttach caseAttach);
int batchSave(@Param("list") List<MsCaseAttach> caseAttach);
List<CaseAttach> queryAnnexPathByCaseId(Long id);
List<MsCaseAttach> queryAnnexPathByCaseId(Long id);
List<CaseAttach> queryCaseAttachList(MsCaseApplicationVO msCaseApplicationVO);
List<MsCaseAttach> queryCaseAttachList(MsCaseApplicationVO msCaseApplicationVO);
int updateCaseAttach(CaseAttach caseAttach);
int updateCaseAttach(MsCaseAttach caseAttach);
int updateCaseAttachBycaseid(CaseAttach caseAttach);
int updateCaseAttachBycaseid(MsCaseAttach caseAttach);
int deleteByFileIds(@Param("ids") List<Integer> fileIds);
List<CaseAttach> getCaseAttachByCaseIdAndType(CaseAttach caseAttach);
List<MsCaseAttach> getCaseAttachByCaseIdAndType(MsCaseAttach caseAttach);
CaseAttach queryAnnexById(Integer annexId);
MsCaseAttach queryAnnexById(@Param("annexId") Long annexId);
/**
* 根据案件id和附件类型删除和上传类型
@@ -19,9 +19,9 @@ import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.system.mapper.*;
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
import com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach;
import com.ruoyi.wisdomarbitrate.domain.dto.template.FatchRule;
import com.ruoyi.wisdomarbitrate.domain.dto.template.TemplateManage;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.template.TemplateFatchRule;
import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper;
@@ -247,14 +247,14 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
}
boolean downLoadFile = FileTransformation.downLoadFileByUrl(sealImageDownloadUrl, resultFilePath);
if (downLoadFile) {
CaseAttach caseAttach = new CaseAttach();
MsCaseAttach caseAttach = new MsCaseAttach();
caseAttach.setAnnexType(10); //10代表印章图片
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
int i1 = msCaseAttachMapper.save(caseAttach);
if (i1 > 0) {
//将附件id保存到公章管理表里
Integer annexId1 = caseAttach.getAnnexId();
Long annexId1 = caseAttach.getAnnexId();
SealManage sealManage = new SealManage();
sealManage.setSealId(sealId);
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
@@ -288,10 +288,10 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
if (selectSealList != null && selectSealList.size() > 0) {
for (SealManage sealManage1 : selectSealList) {
Integer annexId = sealManage1.getAnnexId();
Long annexId = sealManage1.getAnnexId();
if (annexId != null) {
//根据附件id查询路径
CaseAttach caseAttach = msCaseAttachMapper.queryAnnexById(annexId);
MsCaseAttach caseAttach = msCaseAttachMapper.queryAnnexById(annexId);
String annexName = caseAttach.getAnnexName();
String prefix = "/profile";
int startIndex = annexName.indexOf(prefix);
@@ -1,7 +1,7 @@
package com.ruoyi.wisdomarbitrate.service.mscase;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import java.util.List;
@@ -18,5 +18,7 @@ public interface MsCaseApplicationService {
* @param req
* @return
*/
List<MsCaseApplication> list(MsCaseApplicationReq req);
List<MsCaseApplicationVO> list(MsCaseApplicationReq req);
int insert(MsCaseApplicationVO caseApplication);
}
@@ -1,14 +1,41 @@
package com.ruoyi.wisdomarbitrate.service.mscase.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.core.domain.entity.SysDept;
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.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.IdWorkerUtil;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseApplication;
import com.ruoyi.system.domain.entity.flow.MsCaseFlow;
import com.ruoyi.system.domain.entity.flow.MsCaseFlowRoleRelated;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.system.mapper.flow.MsCaseFlowMapper;
import com.ruoyi.system.mapper.flow.MsCaseFlowRoleRelatedMapper;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationReq;
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseApplicationVO;
import com.ruoyi.wisdomarbitrate.mapper.mscase.*;
import com.ruoyi.wisdomarbitrate.service.mscase.MsCaseApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
/**
* @Classname MsCaseApplicationServiceImpl
@@ -19,18 +46,242 @@ import java.util.List;
*/
@Service
public class MsCaseApplicationServiceImpl implements MsCaseApplicationService {
@Autowired
MsCaseApplicationMapper msCaseApplicationMapper;
@Autowired
MsCaseApplicationLogMapper msCaseApplicationLogMapper;
@Autowired
MsCaseAffiliateMapper msCaseAffiliateMapper;
@Autowired
MsCaseAffiliateLogMapper msCaseAffiliateLogMapper;
@Autowired
MsCaseAttachMapper msCaseAttachMapper;
@Autowired
MsCaseAttachLogMapper msCaseAttachLogMapper;
@Autowired
MsCaseFlowMapper caseFlowMapper;
@Autowired
MsCaseFlowRoleRelatedMapper caseFlowRoleRelatedMapper;
@Autowired
SysDeptMapper sysDeptMapper;
@Autowired
SysRoleMapper roleMapper;
@Autowired
SysUserMapper userMapper;
@Autowired
SysUserRoleMapper userRoleMapper;
/**
* 案件列表查询
* @param req
* @return
*/
@Override
public List<MsCaseApplication> list(MsCaseApplicationReq req) {
public List<MsCaseApplicationVO> list(MsCaseApplicationReq req) {
// 根据用户查询角色
LoginUser loginUser = SecurityUtils.getLoginUser();
Long roleId = loginUser.getUser().getRoleId();
if(roleId==null){
return new ArrayList<>();
List<SysRole> roles = loginUser.getUser().getRoles();
if(CollectionUtil.isEmpty(roles)){
throw new ServiceException("该用户未指定角色");
}
req.setUserName(SecurityUtils.getUsername());
// 根据角色查询关联的案件状态
Example example = new Example(MsCaseFlowRoleRelated.class);
example.createCriteria().andIn("roleid",roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
List<MsCaseFlowRoleRelated> caseFlowRoleRelatedList= caseFlowRoleRelatedMapper.selectByExample(example);
if(CollectionUtil.isEmpty(caseFlowRoleRelatedList)){
throw new ServiceException("该角色为绑定案件流程");
}
Example flowExample = new Example(MsCaseFlow.class);
flowExample.createCriteria().andIn("id",caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList()));
List<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
if(CollectionUtil.isEmpty(caseFlows)){
throw new ServiceException("该角色为绑定案件流程");
}
// 查询案件列表
List<MsCaseApplicationVO> caseApplicationList=msCaseApplicationMapper.list(req,caseFlows.stream().map(MsCaseFlow::getCaseStatusName).collect(Collectors.toList()));
return caseApplicationList;
}
/**
* 新增案件
* @param caseApplication
* @return
*/
@Transactional
@Override
public int insert(MsCaseApplicationVO caseApplication) {
caseApplication.setId(IdWorkerUtil.getId());
// 根据用户查询角色
LoginUser loginUser = SecurityUtils.getLoginUser();
List<SysRole> roles = loginUser.getUser().getRoles();
if(CollectionUtil.isEmpty(roles)){
throw new ServiceException("该用户未指定角色");
}
// 根据角色查询关联的案件状态
Example example = new Example(MsCaseFlowRoleRelated.class);
example.createCriteria().andIn("roleid",roles.stream().map(SysRole::getRoleId).collect(Collectors.toList()));
List<MsCaseFlowRoleRelated> caseFlowRoleRelatedList= caseFlowRoleRelatedMapper.selectByExample(example);
if(CollectionUtil.isEmpty(caseFlowRoleRelatedList)){
throw new ServiceException("该角色为绑定案件流程");
}
Example flowExample = new Example(MsCaseFlow.class);
flowExample.setOrderByClause("sort asc");
flowExample.createCriteria().andIn("id",caseFlowRoleRelatedList.stream().map(MsCaseFlowRoleRelated::getFlowId).collect(Collectors.toList()));
List<MsCaseFlow> caseFlows = caseFlowMapper.selectByExample(flowExample);
if(CollectionUtil.isNotEmpty(caseFlows)){
caseApplication.setCaseStatusName(caseFlows.get(0).getCaseStatusName());
caseApplication.setCaseFlowId(caseFlows.get(0).getId());
}
// 计算仲裁费用
if( caseApplication.getCaseSubjectAmount()!=null) {
BigDecimal feeRate = new BigDecimal("0.01");
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
}
// 设置批号
caseApplication.setBatchNumber(getBatchNumber());
// 设置编码
caseApplication.setCaseNum(getCaseNum());
caseApplication.setCreateBy(SecurityUtils.getUsername());
caseApplication.setUpdateBy(SecurityUtils.getUsername());
caseApplication.setVersion(1);
MsCaseAffiliate affiliate = caseApplication.getAffiliate();
// 保存案件基本信息
if(msCaseApplicationMapper.insertSelective(caseApplication)>0){
List<MsCaseAttach> caseAttachList = caseApplication.getCaseAttachList();
// 保存案件相关人员
if(affiliate !=null) {
// 设置申请人
if( StrUtil.isNotEmpty(affiliate.getApplicationOrganName())){
// 组装申请机构
insertDept(affiliate);
// 查询申请人角色id
Long roleId = roleMapper.selectRoleIdByName("申请人");
// 根据代理人手机号去用户表查询,有修改,么有新增
SysUser agentUser = userMapper.selectUserByPhone(affiliate.getContactTelphoneAgent());
// 代理人为空,新增代理人
if(agentUser==null){
agentUser = new SysUser();
agentUser.setUserName(affiliate.getContactTelphoneAgent());
agentUser.setNickName(affiliate.getNameAgent());
agentUser.setPhonenumber(affiliate.getContactTelphoneAgent());
agentUser.setPassword(SecurityUtils.encryptPassword("abc123456"));
agentUser.setDeptId(Long.valueOf(affiliate.getApplicationOrganId()));
userMapper.insertUser(agentUser);
userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
}else if(null != agentUser.getDeptId() && !String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())){
if (null != agentUser.getDept() && StrUtil.isNotEmpty(agentUser.getDept().getDeptName())) {
throw new ServiceException( "该申请代理人已在【" + agentUser.getDept().getDeptName() + "】申请机构下存在,请检查填写信息是否正确");
} else {
throw new ServiceException("该申请代理人已存在,与申请机构不匹配,请检查填写信息是否正确");
}
}else if (null != agentUser.getDeptId() && String.valueOf(agentUser.getDeptId()).equals(affiliate.getApplicationOrganId())) {
// 同步用户表和案件关联人表的手机号和名称
affiliate.setContactTelphoneAgent(StrUtil.isNotEmpty(agentUser.getPhonenumber())?agentUser.getPhonenumber():affiliate.getContactTelphoneAgent());
affiliate.setNameAgent(agentUser.getNickName());
affiliate.setAgentEmail(StrUtil.isNotEmpty(agentUser.getEmail())?agentUser.getEmail():affiliate.getAgentEmail());
List<Long> longList = new ArrayList<>();
// 新增角色为申请人
if (CollectionUtil.isNotEmpty(agentUser.getRoles())) {
longList = agentUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList());
if (!longList.contains(roleId)) {
userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
}
} else {
userRoleMapper.insertUserRole(agentUser.getUserId(), roleId);
}
}
}
affiliate.setCaseAppliId(caseApplication.getId());
msCaseAffiliateMapper.insert(affiliate);
}
// 保存案件附件
if(CollectionUtil.isNotEmpty(caseAttachList)){
for (MsCaseAttach caseAttach : caseAttachList) {
caseAttach.setCaseAppliId(caseApplication.getId());
// 修改案件附件
msCaseAttachMapper.updateCaseAttach(caseAttach);
}
// for(MsCaseAttach caseAttach:caseAttachList){
// caseAttach.setCaseAppliId(caseApplication.getId());
//
// }
// msCaseAttachMapper.batchSave(caseAttachList);
}
return 1;
}
return 0;
}
/**
* 新增部门
* @param affiliate
*/
@Transactional
void insertDept(MsCaseAffiliate affiliate) {
// 查询所有的组织机构,组装成map
List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
if (CollectionUtil.isEmpty(deptList)) {
deptList = new ArrayList<>();
}
Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV));
// 将组织机构id设为申请人名称
if (deptMap.containsKey(affiliate.getApplicationOrganName())) {
affiliate.setApplicationOrganId(String.valueOf(deptMap.get(affiliate.getApplicationOrganName())));
} else {
// 如果不存在则新增
SysDept dept = new SysDept();
dept.setParentId(0L);
dept.setDeptName(affiliate.getApplicationOrganName());
dept.setAncestors("0");
dept.setOrderNum(1);
dept.setStatus("0");
dept.setDelFlag("0");
dept.setCreateBy(getUsername());
dept.setUpdateBy(getUsername());
sysDeptMapper.insertDept(dept);
deptMap.put(dept.getDeptName(), dept.getDeptId());
affiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
}
}
/**
* 获取案件编码
* @return
*/
private String getCaseNum() {
// todo 查询编码规则
// 自动编码格式 zc+yyyyMMdd+001
String currentDay = DateUtils.dateTime();
String caseNum = "zc" + currentDay;
//查询出当天的案件编号的最大值
Integer maxCaseNum = msCaseApplicationMapper.selectCaseNumLike(caseNum, caseNum.length());
if (null == maxCaseNum) {
caseNum = caseNum + "00001";
} else {
maxCaseNum=maxCaseNum+1;
caseNum = caseNum + String.format("%05d", maxCaseNum);
}
return caseNum;
}
/**
* 获取批次号
* @return
*/
private String getBatchNumber() {
Integer batchNumber = msCaseApplicationMapper.selectMaxBatchNumber();
if(batchNumber==null){
return "000001";
}else {
return String.format("%06d", batchNumber+1);
}
// 查询案件列表
return null;
}
}
@@ -0,0 +1,225 @@
package com.ruoyi.wisdomarbitrate.utils;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.ruoyi.common.constant.FileTransformation;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.wisdomarbitrate.domain.dto.dept.DeptIdentify;
import com.ruoyi.wisdomarbitrate.domain.dto.dept.SealManage;
import com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach;
import com.ruoyi.wisdomarbitrate.mapper.dept.DeptIdentifyMapper;
import com.ruoyi.wisdomarbitrate.mapper.dept.SealManageMapper;
import com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper;
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.List;
import java.util.UUID;
@Component
public class FixSelectFlowDetailUtils {
@Autowired
private MsCaseAttachMapper caseAttachMapper;
@Autowired
private DeptIdentifyMapper deptIdentifyMapper;
@Autowired
private SealManageMapper sealManageMapper;
/**
* 定时查询企业认证状态
*
* @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) {
MsCaseAttach caseAttach = new MsCaseAttach();
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);
Long 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) {
//查询企业内部印章
Long 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) {
MsCaseAttach caseAttach = new MsCaseAttach();
caseAttach.setAnnexType(10); //10代表印章图片
caseAttach.setAnnexPath(savePath);
caseAttach.setAnnexName(saveName);
int i1 = caseAttachMapper.save(caseAttach);
if (i1 > 0) {
//将附件id保存到公章管理表里
Long 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();
}
}
}
@@ -41,4 +41,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{userId}
</foreach>
</delete>
<insert id="insertUserRole">
insert into ms_sys_user_role(user_id, role_id) values(#{userId}, #{roleId})
</insert>
</mapper>
@@ -3,27 +3,27 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachLogMapper">
<resultMap type="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" id="CaseAttachResult">
<resultMap type="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" id="CaseAttachResult">
<id property="annexId" column="annex_id" />
<result property="caseAppliId" column="case_appli_id" />
<result property="annexName" column="annex_name" />
<result property="annexPath" column="annex_path" />
<result property="annexType" column="annex_type" />
<result property="note" column="note" />
<result property="userId" column="use_id" />
<result property="userName" column="use_account" />
<result property="useId" column="use_id" />
<result property="useAccount" column="use_account" />
<result property="sealStatus" column="seal_status" />
<result property="caseAppliLogId" column="case_appli_log_id" />
</resultMap>
<insert id="save" useGeneratedKeys="true" keyProperty="annexId">
INSERT INTO ms_case_attach_log (case_appli_log_id, annex_id,annex_name, annex_path , annex_type,note,use_id,use_account,seal_status)
VALUES (#{caseAppliLogId},#{annexId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName},#{sealStatus})
VALUES (#{caseAppliLogId},#{annexId}, #{annexName}, #{annexPath},#{annexType},#{note},#{useId},#{useAccount},#{sealStatus})
</insert>
<insert id="batchSave">
INSERT INTO ms_case_attach_log (case_appli_log_id, annex_id,annex_name, annex_path , annex_type,note,use_id,use_account,seal_status)
VALUES
<foreach item="item" index="index" collection="list" separator=",">
(#{item.caseAppliLogId},#{item.annexId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.userId},#{item.userName},#{item.sealStatus})
(#{item.caseAppliLogId},#{item.annexId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.useId},#{item.useAccount},#{item.sealStatus})
</foreach>
</insert>
<delete id="deleteByFileIds">
@@ -34,13 +34,13 @@
</foreach>
</delete>
<select id="queryAnnexPathByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" resultMap="CaseAttachResult">
<select id="queryAnnexPathByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
select *
from ms_case_attach_log
where case_appli_log_id =#{id}
</select>
<select id="getCaseAttachByCaseIdAndType" resultType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" resultMap="CaseAttachResult">
<select id="getCaseAttachByCaseIdAndType" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
select *
from ms_case_attach_log
<where>
@@ -71,7 +71,7 @@
</if>
</where>
</select>
<select id="queryAnnexById" resultType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" resultMap="CaseAttachResult">
<select id="queryAnnexById" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
select *
from ms_case_attach_log
<where>
@@ -81,14 +81,14 @@
</where>
</select>
<update id="updateCaseAttach" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach">
<update id="updateCaseAttach" parameterType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach">
update ms_case_attach_log
set
case_appli_log_id= #{caseAppliLogId}
where annex_id = #{annexId}
</update>
<update id="updateCaseAttachBycaseid" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" >
<update id="updateCaseAttachBycaseid" parameterType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" >
update ms_case_attach_log
<set>
<if test="annexName != null and annexName != ''">annex_name = #{annexName},</if>
@@ -3,20 +3,20 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.mscase.MsCaseAttachMapper">
<resultMap type="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" id="CaseAttachResult">
<resultMap type="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" id="CaseAttachResult">
<id property="annexId" column="annex_id" />
<result property="caseAppliId" column="case_appli_id" />
<result property="annexName" column="annex_name" />
<result property="annexPath" column="annex_path" />
<result property="annexType" column="annex_type" />
<result property="note" column="note" />
<result property="userId" column="use_id" />
<result property="userName" column="use_account" />
<result property="sealStatus" column="seal_status" />
<result property="useId" column="use_id" />
<result property="useAccount" column="use_account" />
</resultMap>
<insert id="save" useGeneratedKeys="true" keyProperty="annexId">
INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload)
VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{userId},#{userName},#{sealStatus},#{isBatchUpload})
VALUES (#{caseAppliId}, #{annexName}, #{annexPath},#{annexType},#{note},#{useId},#{useAccount},#{sealStatus},#{isBatchUpload})
</insert>
<insert id="batchSave" useGeneratedKeys="true" keyProperty="annexId">
INSERT INTO ms_case_attach (case_appli_id, annex_name, annex_path , annex_type,note,use_id,use_account,seal_status,is_batch_upload)
@@ -24,7 +24,7 @@
<foreach item="item" index="index" collection="list" separator=",">
(#{item.caseAppliId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.userId},#{item.userName},#{item.sealStatus},#{item.isBatchUpload})
(#{item.caseAppliId}, #{item.annexName}, #{item.annexPath},#{item.annexType},#{item.note},#{item.useId},#{item.useAccount},#{item.sealStatus},#{item.isBatchUpload})
</foreach>
</insert>
<delete id="deleteByFileIds">
@@ -43,13 +43,13 @@
</if>
</delete>
<select id="queryAnnexPathByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" resultMap="CaseAttachResult">
<select id="queryAnnexPathByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
from ms_case_attach
where case_appli_id =#{id}
</select>
<select id="getCaseAttachByCaseIdAndType" resultType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" resultMap="CaseAttachResult">
<select id="getCaseAttachByCaseIdAndType" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
select annex_id,case_appli_id,annex_name,annex_path,annex_type,note,use_id,use_account
from ms_case_attach
<where>
@@ -86,7 +86,7 @@
</if>
</where>
</select>
<select id="queryAnnexById" resultType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" resultMap="CaseAttachResult">
<select id="queryAnnexById" resultType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" resultMap="CaseAttachResult">
select *
from ms_case_attach
<where>
@@ -96,14 +96,14 @@
</where>
</select>
<update id="updateCaseAttach" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach">
<update id="updateCaseAttach" parameterType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach">
update ms_case_attach
set
case_appli_id= #{caseAppliId}
where annex_id = #{annexId}
</update>
<update id="updateCaseAttachBycaseid" parameterType="com.ruoyi.wisdomarbitrate.domain.dto.mscase.CaseAttach" >
<update id="updateCaseAttachBycaseid" parameterType="com.ruoyi.wisdomarbitrate.domain.entity.mscase.MsCaseAttach" >
update ms_case_attach
<set>
<if test="annexName != null and annexName != ''">annex_name = #{annexName},</if>