From 56b4d3fcfc9edf19659821d983113840d1acbe14 Mon Sep 17 00:00:00 2001 From: hejinbo Date: Mon, 9 Oct 2023 18:18:04 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E7=94=A8=E5=8D=B0=E6=A8=A1=E6=8B=9F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wisdomarbitrate/AdjudicationController.java | 9 +++++++++ .../wisdomarbitrate/service/IAdjudicationService.java | 2 ++ .../service/impl/AdjudicationServiceImpl.java | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java index 2dfd99d..213e195 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java @@ -83,4 +83,13 @@ public class AdjudicationController extends BaseController { ,String apptrackingNum,String restrackingNum){ return adjudicationService.service(id,appEmail,resEmail,apptrackingNum,restrackingNum); } + /** + * 用印(暂时只改案件状态) + * @param caseApplication + * @return + */ + @PostMapping("/stamp") + public AjaxResult stamp(@Validated @RequestBody CaseApplication caseApplication){ + return adjudicationService.stamp(caseApplication); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java index 935b0a2..773fc61 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java @@ -16,4 +16,6 @@ public interface IAdjudicationService { AjaxResult service(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum); + AjaxResult stamp(CaseApplication caseApplication); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java index f2059f1..e4e8fff 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java @@ -352,6 +352,14 @@ public class AdjudicationServiceImpl implements IAdjudicationService { return AjaxResult.success("仲裁文书送达成功"); } + @Override + public AjaxResult stamp(CaseApplication caseApplication) { + //更改案件状态(暂时) + caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY); + caseApplicationMapper.submitCaseApplication(caseApplication); + return AjaxResult.success("用印成功,案件状态已改为待仲裁文书送达"); + } + public static void main(String[] args) { try { List fileList = new ArrayList<>(); From 62f1e3111d2146cefbb3c811602ae3d5b72953f3 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 10 Oct 2023 16:00:34 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E6=A1=88=E4=BB=B6=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=8F=91=E9=80=81=E6=88=BF=E9=97=B4?= =?UTF-8?q?=E5=8F=B7=E7=9F=AD=E4=BF=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 10 ++ .../domain/CaseApplication.java | 4 +- .../wisdomarbitrate/domain/vo/CaseLogVO.java | 29 ----- .../domain/vo/SendRoomNoMessageVO.java | 23 ++++ .../mapper/ArbitratorMapper.java | 9 ++ .../service/ICaseApplicationService.java | 3 + .../impl/CaseApplicationServiceImpl.java | 118 ++++++++++++++++-- .../resources/mapper/system/SysDeptMapper.xml | 4 +- .../wisdomarbitrate/ArbitratorMapper.xml | 27 ++-- .../wisdomarbitrate/CaseApplicationMapper.xml | 7 +- 10 files changed, 178 insertions(+), 56 deletions(-) delete mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseLogVO.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 14df926..27287d5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -8,6 +8,7 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -218,5 +219,14 @@ public class CaseApplicationController extends BaseController { + /** + * 确认缴费查询立案信息 + */ + @PostMapping("/sendRoomNoMessage") + public AjaxResult sendRoomNoMessage(@Validated @RequestBody SendRoomNoMessageVO messageVO) + { + String result = caseApplicationService.sendRoomNoMessage(messageVO); + return success(result); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java index 44df51c..2703ad5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java @@ -332,10 +332,10 @@ public class CaseApplication extends BaseEntity { * 申请人主体信息 */ /** 姓名 */ - @Excel(name = "申请人主体信息-申请人姓名",width = 26) + @Excel(name = "申请人主体信息-申请人(机构)",width = 26) private String name; /** 身份证号 */ - @Excel(name = "申请人主体信息-身份证号",width = 26) + @Excel(name = "申请人主体信息-代码",width = 26) private String identityNum; /** 联系电话 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseLogVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseLogVO.java deleted file mode 100644 index 7169864..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseLogVO.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.ruoyi.wisdomarbitrate.domain.vo; - -import lombok.Data; - -import java.util.Date; - -/** - * @description 案件操作日志实体 - * @Author wangqiong - * @Date 2023/10/09 15:18 - * @Version V1.0 - **/ -@Data -public class CaseLogVO { - /**日志id*/ - private String logId; - /**操作人id*/ - private String operatorId; - /**操作人名称*/ - private String operatorName; - /**操作人ip*/ - private String ip; - /**操作时间*/ - private Date operateTime; - /**操作明细*/ - private String operateDetail; - /**操作类型*/ - private String operateType; -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java new file mode 100644 index 0000000..d20d4f3 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java @@ -0,0 +1,23 @@ +package com.ruoyi.wisdomarbitrate.domain.vo; + +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; + +/** + * @author wangqiong + * @description 发送房间号短信入参类 + * @date 2023-10-10 15:20 + */ +@Data +public class SendRoomNoMessageVO implements Serializable { + private static final long serialVersionUID = 1L; + @NotEmpty(message = "案件id不能为空") + private Long id; + @NotEmpty(message = "房间号不能为空") + private String roomNo; + + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ArbitratorMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ArbitratorMapper.java index b3bcbaf..e7d6e2b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ArbitratorMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ArbitratorMapper.java @@ -1,10 +1,19 @@ 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 selectArbitratorList(Arbitrator arbitrator); + /** + * 根据案件id和身份类型查询案件关联人 + * @param caseAppliId + * @param identityType + * @return + */ + Arbitrator selectArbitratorById(@Param("caseAppliId") Long caseAppliId,@Param("identityType") Integer identityType); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java index d5d3708..2bcd9a5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java @@ -1,6 +1,7 @@ package com.ruoyi.wisdomarbitrate.service; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; import java.util.List; @@ -37,4 +38,6 @@ public interface ICaseApplicationService { int submitCaseApplicationCheck(CaseApplication caseApplication); CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication); + + String sendRoomNoMessage(SendRoomNoMessageVO messageVO); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 3d110fe..da34b56 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -1,13 +1,18 @@ package com.ruoyi.wisdomarbitrate.service.impl; +import cn.hutool.core.collection.CollectionUtil; +import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.CaseApplicationConstants; +import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.wisdomarbitrate.domain.*; +import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; import com.ruoyi.wisdomarbitrate.mapper.*; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import org.springframework.beans.factory.annotation.Autowired; @@ -18,6 +23,8 @@ import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; +import static com.ruoyi.common.utils.SecurityUtils.getUsername; + @Service public class CaseApplicationServiceImpl implements ICaseApplicationService { @@ -34,6 +41,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Autowired private CaseAttachMapper caseAttachMapper; + @Autowired + private SysDeptMapper sysDeptMapper; @@ -52,7 +61,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //根据仲裁费用计费规则计算应缴费用 //暂时设置计费比率为0.01 BigDecimal feeRate = new BigDecimal(0.01); - BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP); + BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP); caseApplication.setFeePayable(feePayable); // 获取自动编码 String caseNum = generateCaseNum(); @@ -60,16 +69,43 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { int rows = caseApplicationMapper.insertCaseApplication(caseApplication); List caseAffiliates = caseApplication.getCaseAffiliates(); - if(caseAffiliates!=null&&caseAffiliates.size()>0){ - for (CaseAffiliate caseAffiliate : caseAffiliates){ - caseAffiliate.setCaseAppliId(caseApplication.getId()); + + if (caseAffiliates != null && caseAffiliates.size() > 0) { + // 查询所有的组织机构,组装成map + List deptList = sysDeptMapper.selectDeptList(new SysDept()); + if (CollectionUtil.isEmpty(deptList)) { + deptList = new ArrayList<>(); } + Map deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); + + for (CaseAffiliate caseAffiliate : caseAffiliates) { + caseAffiliate.setCaseAppliId(caseApplication.getId()); + // 将组织机构id设为申请人名称 + if (deptMap.containsKey(caseApplication.getName())) { + caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName()))); + } else { + // 如果不存在则新增 + SysDept dept = new SysDept(); + dept.setParentId(0L); + dept.setDeptName(caseApplication.getName()); + dept.setAncestors("0"); + dept.setOrderNum(1); + dept.setStatus("0"); + dept.setDelFlag("0"); + dept.setCreateBy(getUsername()); + dept.setUpdateBy(getUsername()); + sysDeptMapper.insertDept(dept); + caseAffiliate.setName(String.valueOf(dept.getDeptId())); + + } + } + caseAffiliateMapper.batchCaseAffiliate(caseAffiliates); } List caseAttachList = caseApplication.getCaseAttachList(); - if(caseAttachList!=null&&caseAttachList.size()>0){ - for (CaseAttach caseAttach : caseAttachList){ + if (caseAttachList != null && caseAttachList.size() > 0) { + for (CaseAttach caseAttach : caseAttachList) { caseAttach.setCaseAppliId(caseApplication.getId()); caseAttachMapper.updateCaseAttach(caseAttach); } @@ -213,6 +249,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { int successNum = 0; int failureNum = 0; if(caseApplicationList!=null&&caseApplicationList.size()>0){ + // 1,查询所有的组织机构,组装成map + List deptList = sysDeptMapper.selectDeptList(new SysDept()); List caseApplicationListinsert = new ArrayList<>(); for (int i = 0; i < caseApplicationList.size(); i++){ CaseApplication caseApplication = caseApplicationList.get(i); @@ -224,7 +262,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //赋值CaseApplication的案件关联人信息 List caseAffiliatesnew = new ArrayList<>(); - assignmentCaseAffiliates(caseApplication,caseAffiliatesnew); + // 组装案件关联人信息 + assignmentCaseAffiliates(caseApplication,caseAffiliatesnew,deptList); // int caseApplicationCount = selectCaseApplicationCount(caseApplication); // if(caseApplicationCount>0){ @@ -415,6 +454,32 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return caseApplicationselect; } + /** + * 给被申请人发送房间号短信 + * @param messageVO + * @return + */ + @Override + public String sendRoomNoMessage(SendRoomNoMessageVO messageVO) { + Arbitrator arbitrator = arbitratorMapper.selectArbitratorById(messageVO.getId(), 2); + if(null==arbitrator){ + return "被申请人不存在"; + } + CaseApplication caseApplication = new CaseApplication(); + caseApplication.setId(messageVO.getId()); + CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication); + + //发送短信通知 + SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); + request.setTemplateId("1948332"); + // 1948332 普通短信 开庭审理房间号通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请知晓,如非本人操作,请忽略本短信。 + request.setPhone(arbitrator.getTelephone()); + request.setTemplateParamSet(new String[]{arbitrator.getArbitratorName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()}); + + + return "短信发送成功"; + } + @Override @Transactional public int pendTralSure(CaseApplication caseApplication) { @@ -509,12 +574,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { - private void assignmentCaseAffiliates(CaseApplication caseApplication, List caseAffiliatesnew) { + private void assignmentCaseAffiliates(CaseApplication caseApplication, List caseAffiliatesnew,List deptList) { + // 申请人信息 CaseAffiliate caseAffiliate = new CaseAffiliate(); // BeanUtils.copyBeanProp(caseApplication,caseAffiliate); BeanUtils.copyBeanProp(caseAffiliate,caseApplication); caseAffiliate.setIdentityType(1); + // 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构 + setApplicantOrganization(caseAffiliate,caseApplication,deptList); caseAffiliatesnew.add(caseAffiliate); // 组装被申请人信息 @@ -522,6 +590,40 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplication.setCaseAffiliates(caseAffiliatesnew); } + /** + * 设置申请人的组织机构 + * @param caseAffiliate + * @param caseApplication + */ + @DataScope(deptAlias = "d") + private void setApplicantOrganization(CaseAffiliate caseAffiliate, CaseApplication caseApplication, List deptList ) { + + if(CollectionUtil.isNotEmpty(deptList)){ + Map deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); + // 将组织机构id设为申请人名称 + if(deptMap.containsKey(caseApplication.getName())){ + caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName()))); + }else { + // 如果不存在则新增 + SysDept dept = new SysDept(); + dept.setParentId(0L); + dept.setDeptName(caseApplication.getName()); + dept.setAncestors("0"); + dept.setOrderNum(1); + dept.setStatus("0"); + dept.setDelFlag("0"); + dept.setCreateBy(getUsername()); + dept.setUpdateBy(getUsername()); + sysDeptMapper.insertDept(dept); + caseAffiliate.setName(String.valueOf(dept.getDeptId())); + + } + } + + + + } + /** * 组装被申请人信息 * @param caseApplication diff --git a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml index cf439f6..3e0f228 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml @@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1 - + insert into sys_dept( dept_id, parent_id, @@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{status}, #{createBy}, sysdate() - ) + ); diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml index d88164e..1c1845b 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml @@ -36,22 +36,21 @@ + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index 9fb0e6e..0e8219b 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -55,8 +55,10 @@ c.hear_date ,c.arbitrat_claims , c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable , c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time , - c.update_by ,c.update_time , c.arbitrator_name + c.update_by ,c.update_time , c.arbitrator_name,d.dept_name as name from case_application c + LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 + LEFT JOIN sys_dept d ON ca.NAME = d.dept_id AND c.case_status = #{caseStatus} @@ -64,6 +66,9 @@ AND c.case_num = #{caseNum} + + AND d.dept_name like CONCAT( '%',#{name},'%') AND ca.identity_type=1 and ca.name=d.dept_id + and c.case_status in From 4d4ab28c40e2d8699c800f6895b67bac5060059d Mon Sep 17 00:00:00 2001 From: hejinbo Date: Tue, 10 Oct 2023 16:22:24 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=20=E8=8E=B7=E5=8F=96=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdjudicationController.java | 11 +- ruoyi-common/pom.xml | 5 +- .../ruoyi/common/config/EsignDemoConfig.java | 13 + .../common/constant/EsignEncryption.java | 371 +++++++++++++ .../common/constant/EsignHeaderConstant.java | 26 + .../common/constant/EsignHttpCfgHelper.java | 486 ++++++++++++++++++ .../common/constant/FileTransformation.java | 284 ++++++++++ .../core/domain/entity/EsignCoreSdkInfo.java | 24 + .../core/domain/entity/EsignHttpResponse.java | 24 + .../ruoyi/common/enums/EsignRequestType.java | 39 ++ .../common/exception/EsignDemoException.java | 36 ++ .../ruoyi/common/utils/EsignHttpHelper.java | 178 +++++++ .../common/utils/bean/EsignFileBean.java | 57 ++ .../common/utils/file/SaaSAPIFileUtils.java | 43 ++ 14 files changed, 1588 insertions(+), 9 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/config/EsignDemoConfig.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignEncryption.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHeaderConstant.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHttpCfgHelper.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/constant/FileTransformation.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignCoreSdkInfo.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignHttpResponse.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/enums/EsignRequestType.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/exception/EsignDemoException.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/EsignHttpHelper.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/EsignFileBean.java create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java index d934d51..cbc0f7b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java @@ -27,17 +27,12 @@ public class AdjudicationController extends BaseController { /** * 裁决书送达(电子邮件) - * @param id 案件id - * @param appEmail 申请人邮箱 - * @param resEmail 被申请人邮箱 - * @param apptrackingNum 申请人快递单号 - * @param restrackingNum 被申请人快递单号 + * @param bookSendVO * @return */ @PostMapping("/delivery") - public AjaxResult sendDocumentByEmail(Long id,String appEmail,String resEmail - ,String apptrackingNum,String restrackingNum){ - return adjudicationService.sendDocumentByEmail(id,appEmail,resEmail,apptrackingNum,restrackingNum); + public AjaxResult sendDocumentByEmail(@RequestBody BookSendVO bookSendVO){ + return adjudicationService.sendDocumentByEmail(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum()); } /** diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 3b55c2b..77e53b1 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -183,7 +183,10 @@ mail 1.4.7 - + + org.apache.httpcomponents + httpclient + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/EsignDemoConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/EsignDemoConfig.java new file mode 100644 index 0000000..f9888e2 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/EsignDemoConfig.java @@ -0,0 +1,13 @@ +package com.ruoyi.common.config; + +public class EsignDemoConfig { + + // 应用ID + public static final String EsignAppId = "7438987614"; + // 应用密钥 + public static final String EsignAppSecret = "9d7844f13830931037772b9d20cf1529"; + // e签宝接口调用域名(模拟环境) + public static final String EsignHost = "https://smlopenapi.esign.cn"; + // e签宝接口调用域名(正式环境) + // public static final String EsignHost = "https://openapi.esign.cn"; +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignEncryption.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignEncryption.java new file mode 100644 index 0000000..ade398b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignEncryption.java @@ -0,0 +1,371 @@ +/* + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ruoyi.common.constant; +import com.ruoyi.common.exception.EsignDemoException; +import org.apache.commons.codec.binary.Base64; +import org.apache.http.message.BasicNameValuePair; + +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.io.UnsupportedEncodingException; +import java.security.InvalidKeyException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.text.Collator; +import java.text.MessageFormat; +import java.util.*; + +/** + * @description 请求数据通用处理类 + * @author 澄泓 + * @date 2020年10月22日 下午14:25:31 + * @since JDK1.7 + */ +public class EsignEncryption { + + /** + * 不允许外部创建实例 + */ + private EsignEncryption(){} + + /** + * 拼接待签名字符串 + * @param httpMethod + * @param url + * @return + */ + public static String appendSignDataString(String httpMethod, String contentMd5,String accept,String contentType,String headers,String date, String url) throws EsignDemoException { + StringBuffer sb = new StringBuffer(); + sb.append(httpMethod).append("\n").append(accept).append("\n").append(contentMd5).append("\n") + .append(contentType).append("\n"); + + if ("".equals(date) || date == null) { + sb.append("\n"); + } else { + sb.append(date).append("\n"); + } + if ("".equals(headers) || headers == null) { + sb.append(url); + } else { + sb.append(headers).append("\n").append(url); + } + return new String(sb); + } + + /*** + * Content-MD5的计算方法 + * @param str 待计算的消息 + * @return MD5计算后摘要值的Base64编码(ContentMD5) + * @throws EsignDemoException 加密过程中的异常信息 + */ + public static String doContentMD5(String str) throws EsignDemoException { + byte[] md5Bytes = null; + MessageDigest md5 = null; + String contentMD5 = null; + try { + md5 = MessageDigest.getInstance("MD5"); + // 计算md5函数 + md5.update(str.getBytes("UTF-8")); + // 获取文件MD5的二进制数组(128位) + md5Bytes = md5.digest(); + // 把MD5摘要后的二进制数组md5Bytes使用Base64进行编码(而不是对32位的16进制字符串进行编码) + contentMD5 = Base64.encodeBase64String(md5Bytes); + + } catch (NoSuchAlgorithmException e) { + EsignDemoException ex = new EsignDemoException("不支持此算法",e); + ex.initCause(e); + throw ex; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return contentMD5; + } + + /*** + * 计算请求签名值-HmacSHA256摘要 + * @param message 待签名字符串 + * @param secret 密钥APP KEY + * @return reqSignature HmacSHA256计算后摘要值的Base64编码 + * @throws EsignDemoException 加密过程中的异常信息 + */ + public static String doSignatureBase64(String message, String secret) throws EsignDemoException { + String algorithm = "HmacSHA256"; + Mac hmacSha256; + String digestBase64 = null; + try { + hmacSha256 = Mac.getInstance(algorithm); + byte[] keyBytes = secret.getBytes("UTF-8"); + byte[] messageBytes = message.getBytes("UTF-8"); + hmacSha256.init(new SecretKeySpec(keyBytes, 0, keyBytes.length, algorithm)); + // 使用HmacSHA256对二进制数据消息Bytes计算摘要 + byte[] digestBytes = hmacSha256.doFinal(messageBytes); + // 把摘要后的结果digestBytes使用Base64进行编码 + digestBase64 = Base64.encodeBase64String(digestBytes); + } catch (NoSuchAlgorithmException e) { + EsignDemoException ex = new EsignDemoException("不支持此算法",e); + ex.initCause(e); + throw ex; + } catch (InvalidKeyException e) { + EsignDemoException ex = new EsignDemoException("无效的密钥规范",e); + ex.initCause(e); + throw ex; + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return digestBase64; + } + + /** + * 获取时间戳 + * @return + */ + public static String timeStamp() { + long timeStamp = System.currentTimeMillis(); + return String.valueOf(timeStamp); + } + + /** + * byte字节数组转换成字符串 + * @param b + * @return + */ + public static String byteArrayToHexString(byte[] b) { + StringBuilder hs = new StringBuilder(); + String stmp; + for (int n = 0; b != null && n < b.length; n++) { + stmp = Integer.toHexString(b[n] & 0XFF); + if (stmp.length() == 1) + hs.append('0'); + hs.append(stmp); + } + return hs.toString().toLowerCase(); + } + + /** + * hash散列加密算法 + * @return + */ + public static String Hmac_SHA256(String message,String key) throws EsignDemoException { + byte[] rawHmac=null; + try { + SecretKeySpec sk = new SecretKeySpec(key.getBytes(), "HmacSHA256"); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(sk); + rawHmac = mac.doFinal(message.getBytes()); + }catch (InvalidKeyException e){ + EsignDemoException ex = new EsignDemoException("无效的密钥规范",e); + ex.initCause(e); + throw ex; + } catch (NoSuchAlgorithmException e) { + EsignDemoException ex = new EsignDemoException("不支持此算法",e); + ex.initCause(e); + throw ex; + }catch (Exception e){ + EsignDemoException ex = new EsignDemoException("hash散列加密算法报错",e); + ex.initCause(e); + throw ex; + }finally { + return byteArrayToHexString(rawHmac); + } + + } + + /** + * MD5加密32位 + */ + public static String MD5Digest(String text) throws EsignDemoException { + byte[] digest=null; + try { + MessageDigest md5 = MessageDigest.getInstance("MD5"); + md5.update(text.getBytes()); + digest = md5.digest(); + }catch (NoSuchAlgorithmException e){ + EsignDemoException ex = new EsignDemoException("不支持此算法",e); + ex.initCause(e); + throw ex; + }finally { + return byteArrayToHexString(digest); + } + + } + + public static void formDataSort(List param) { + Collections.sort(param, new Comparator() { + @Override + public int compare(BasicNameValuePair o1, BasicNameValuePair o2) { + Comparator com = Collator.getInstance(Locale.CHINA); + return com.compare(o1.getName(), o2.getName()); + } + }); + } + + /*** + * 字符串是否为空(含空格校验) + * @param str + * @return + */ + public static boolean isBlank(String str) { + if (null == str || 0 == str.length()) { + return true; + } + + int strLen = str.length(); + + for (int i = 0; i < strLen; i++) { + if (!Character.isWhitespace(str.charAt(i))) { + return false; + } + } + return true; + } + + + /*** + * 对请求URL中的Query参数按照字段名的 ASCII 码从小到大排序(字典排序) + * + * @param apiUrl + * @return 排序后的API接口地址 + * @throws Exception + */ + public static String sortApiUrl(String apiUrl) throws EsignDemoException { + + if (!apiUrl.contains("?")) { + return apiUrl; + } + + int queryIndex = apiUrl.indexOf("?"); + String apiUrlPath =apiUrl.substring(0,queryIndex+1); + String apiUrlQuery = apiUrl.substring(queryIndex+1); + //apiUrlQuery为空时返回 + if(isBlank(apiUrlQuery)){ + return apiUrl.substring(0,apiUrl.length()-1); + } + // 请求URL中Query参数转成Map + Map queryParamsMap = new HashMap(); + String[] params = apiUrlQuery.split("&"); + for (String str : params) { + int index = str.indexOf("="); + String key = str.substring(0, index); + String value = str.substring(index + 1); + if (queryParamsMap.containsKey(key)) { + String msg = MessageFormat.format("请求URL中的Query参数的{0}重复", key); + throw new EsignDemoException(msg); + } + queryParamsMap.put(key, value); + } + + ArrayList queryMapKeys = new ArrayList(); + for (Map.Entry entry : queryParamsMap.entrySet()) { + queryMapKeys.add((String) entry.getKey()); + } + // 按照字段名的 ASCII 码从小到大排序(字典排序) + Collections.sort(queryMapKeys, new Comparator() { + @Override + public int compare(String o1, String o2) { + return (o1.compareToIgnoreCase(o2) == 0 ? -o1.compareTo(o2) : o1.compareToIgnoreCase(o2)); + } + }); + + StringBuffer queryString = new StringBuffer(); + // 构造Query参数键值对值对的格式 + for (int i = 0; i < queryMapKeys.size(); i++) { + String key = queryMapKeys.get(i); + String value = (String) queryParamsMap.get(key); + queryString.append(key); + queryString.append("="); + queryString.append(value); + queryString.append("&"); + } + if (queryString.length() > 0) { + queryString = queryString.deleteCharAt(queryString.length() - 1); + } + + // Query参数排序后的接口请求地址 + StringBuffer sortApiUrl = new StringBuffer(); + sortApiUrl.append(apiUrlPath); + sortApiUrl.append(queryString.toString()); + return sortApiUrl.toString(); + } + + /** + *获取query + * @param apiUrl + * @return + * @throws EsignDemoException + */ + public static ArrayList getQuery(String apiUrl) throws EsignDemoException { + ArrayList BasicNameValuePairList = new ArrayList<>(); + + if (!apiUrl.contains("?")) { + return BasicNameValuePairList; + } + + int queryIndex = apiUrl.indexOf("\\?"); + String apiUrlQuery = apiUrl.substring(queryIndex,apiUrl.length()); + + // 请求URL中Query参数转成Map + Map queryParamsMap = new HashMap(); + String[] params = apiUrlQuery.split("&"); + for (String str : params) { + int index = str.indexOf("="); + String key = str.substring(0, index); + String value = str.substring(index + 1); + if (queryParamsMap.containsKey(key)) { + String msg = MessageFormat.format("请求URL中的Query参数的{0}重复", key); + throw new EsignDemoException(msg); + } + BasicNameValuePairList.add(new BasicNameValuePair(key,value)); + queryParamsMap.put(key, value); + } + return BasicNameValuePairList; + } + /** + * + */ + public static boolean callBackCheck(String timestamp,String requestQuery,String body,String key,String signature){ + String algorithm="HmacSHA256"; + String encoding="UTF-8"; + Mac mac = null; + try { + String data = timestamp + requestQuery + body; + mac = Mac.getInstance(algorithm); + SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(encoding), algorithm); + mac.init(secretKey); + mac.update(data.getBytes(encoding)); + } catch (NoSuchAlgorithmException | InvalidKeyException | UnsupportedEncodingException e) { + e.printStackTrace(); + System.out.println("获取Signature签名信息异常:" + e.getMessage()); + return false; + } + return byte2hex(mac.doFinal()).equalsIgnoreCase(signature); + } + + /*** + * 将byte[]转成16进制字符串 + * + * @param data + * + * @return 16进制字符串 + */ + public static String byte2hex(byte[] data) { + StringBuilder hash = new StringBuilder(); + String stmp; + for (int n = 0; data != null && n < data.length; n++) { + stmp = Integer.toHexString(data[n] & 0XFF); + if (stmp.length() == 1) + hash.append('0'); + hash.append(stmp); + } + return hash.toString(); + } + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHeaderConstant.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHeaderConstant.java new file mode 100644 index 0000000..ae1e035 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHeaderConstant.java @@ -0,0 +1,26 @@ +package com.ruoyi.common.constant; +/** + * @description 头部信息常量 + * @author 澄泓 + * @date 2020/10/22 15:05 + * @version JDK1.7 + */ +public enum EsignHeaderConstant { + ACCEPT("*/*"), + DATE(""), + HEADERS( ""), + CONTENTTYPE_FORMDATA("application/x-www-form-urlencoded"), + CONTENTTYPE_JSON("application/json; charset=UTF-8"), + CONTENTTYPE_PDF("application/pdf"), + CONTENTTYPE_STREAM("application/octet-stream"), + AUTHMODE("Signature"); + + private String value; + private EsignHeaderConstant(String value) { + this.value=value; + } + + public String VALUE(){ + return this.value; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHttpCfgHelper.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHttpCfgHelper.java new file mode 100644 index 0000000..78162ed --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/EsignHttpCfgHelper.java @@ -0,0 +1,486 @@ +/* + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ruoyi.common.constant; +import com.ruoyi.common.core.domain.entity.EsignHttpResponse; +import com.ruoyi.common.enums.EsignRequestType; +import com.ruoyi.common.exception.EsignDemoException; +import org.apache.http.*; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.CredentialsProvider; +import org.apache.http.client.HttpRequestRetryHandler; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpRequestBase; +import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.config.Registry; +import org.apache.http.config.RegistryBuilder; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.conn.socket.ConnectionSocketFactory; +import org.apache.http.conn.socket.LayeredConnectionSocketFactory; +import org.apache.http.conn.socket.PlainConnectionSocketFactory; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.BasicCredentialsProvider; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.protocol.HttpContext; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.net.ssl.*; +import java.io.IOException; +import java.io.InterruptedIOException; +import java.net.UnknownHostException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @description Http请求 辅助类 + * @author 澄泓 + * @since JDK1.7 + */ +public class EsignHttpCfgHelper { + + private static Logger LOGGER = LoggerFactory.getLogger(EsignHttpCfgHelper.class); + /** + * 超时时间,默认15000毫秒 + */ + private static int MAX_TIMEOUT = 15000; + /** + * 请求池最大连接数,默认100个 + */ + private static int MAX_TOTAL=100; + /** + * 单域名最大的连接数,默认50个 + */ + private static int ROUTE_MAX_TOTAL=50; + /** + * 请求失败重试次数,默认3次 + */ + private static int MAX_RETRY = 3; + /** + * 是否需要域名校验,默认不需要校验 + */ + private static boolean SSL_VERIFY=false; + + /** + * 正向代理IP + */ + private static String PROXY_IP; + /** + * 正向代理端口,默认8888 + */ + private static int PROXY_PORT=8888; + /** + * 代理协议,默认http + */ + private static String PROXY_AGREEMENT="http"; + + /** + * 是否开启代理,默认false + */ + private static boolean OPEN_PROXY=false; + + /** + * 代理服务器用户名 + */ + private static String PROXY_USERNAME=""; + + /** + * 代理服务器密码 + */ + private static String PROXY_PASSWORD=""; + + + private static PoolingHttpClientConnectionManager connMgr; //连接池 + private static HttpRequestRetryHandler retryHandler; //重试机制 + + private static CloseableHttpClient httpClient=null; + + public static int getMaxTimeout() { + return MAX_TIMEOUT; + } + + public static void setMaxTimeout(int maxTimeout) { + MAX_TIMEOUT = maxTimeout; + } + + public static int getMaxTotal() { + return MAX_TOTAL; + } + + public static void setMaxTotal(int maxTotal) { + MAX_TOTAL = maxTotal; + } + + public static int getRouteMaxTotal() { + return ROUTE_MAX_TOTAL; + } + + public static void setRouteMaxTotal(int routeMaxTotal) { + ROUTE_MAX_TOTAL = routeMaxTotal; + } + + public static int getMaxRetry() { + return MAX_RETRY; + } + + public static void setMaxRetry(int maxRetry) { + MAX_RETRY = maxRetry; + } + + public static boolean isSslVerify() { + return SSL_VERIFY; + } + + public static void setSslVerify(boolean sslVerify) { + SSL_VERIFY = sslVerify; + } + + public static String getProxyIp() { + return PROXY_IP; + } + + public static void setProxyIp(String proxyIp) { + PROXY_IP = proxyIp; + } + + public static int getProxyPort() { + return PROXY_PORT; + } + + public static void setProxyPort(int proxyPort) { + PROXY_PORT = proxyPort; + } + + public static String getProxyAgreement() { + return PROXY_AGREEMENT; + } + + public static void setProxyAgreement(String proxyAgreement) { + PROXY_AGREEMENT = proxyAgreement; + } + + public static boolean getOpenProxy() { + return OPEN_PROXY; + } + + public static void setOpenProxy(boolean openProxy) { + OPEN_PROXY = openProxy; + } + + public static String getProxyUsername() { + return PROXY_USERNAME; + } + + public static void setProxyUserame(String proxyUsername) { + PROXY_USERNAME = proxyUsername; + } + + public static String getProxyPassword() { + return PROXY_PASSWORD; + } + + public static void setProxyPassword(String proxyPassword) { + PROXY_PASSWORD = proxyPassword; + } + + + + + /** + * 不允许外部创建实例 + */ + private EsignHttpCfgHelper() { + } + + //------------------------------公有方法start-------------------------------------------- + + + /** + * @description 发起HTTP / HTTPS 请求 + * + * @param reqType + * {@link EsignRequestType} 请求类型 GET、 POST 、 DELETE 、 PUT + * @param httpUrl + * {@link String} 请求目标地址 + * @param headers + * {@link Map} 请求头 + * @param param + * {@link Object} 参数 + * @return + * @throws EsignDemoException + * @author 澄泓 + */ + public static EsignHttpResponse sendHttp(EsignRequestType reqType, String httpUrl, Map headers, Object param, boolean debug) + throws EsignDemoException { + HttpRequestBase reqBase=null; + if(httpUrl.startsWith("http")){ + reqBase=reqType.getHttpType(httpUrl); + }else{ + throw new EsignDemoException("请求url地址格式错误"); + } + if(debug){ + LOGGER.info("请求头:{}",headers+"\n"); + LOGGER.info("请求参数\n{}", param+"\n"); + LOGGER.info("请求地址\n:{}\n请求方式\n:{}",reqBase.getURI(),reqType+"\n"); + } + //请求方法不是GET或者DELETE时传入body体,否则不传入。 + String[] methods = {"DELETE", "GET"}; + if(param instanceof String&&Arrays.binarySearch(methods, reqType.name())<0){//POST或者PUT请求 + ((HttpEntityEnclosingRequest) reqBase).setEntity( + new StringEntity(String.valueOf(param), ContentType.create("application/json", "UTF-8"))); + } + //参数时字节流数组 + else if(param instanceof byte[]) { + reqBase=reqType.getHttpType(httpUrl); + byte[] paramBytes = (byte[])param; + ((HttpEntityEnclosingRequest) reqBase).setEntity(new ByteArrayEntity(paramBytes)); + } + //参数是form表单时 + else if(param instanceof List){ + ((HttpEntityEnclosingRequest) reqBase).setEntity(new UrlEncodedFormEntity((Iterable) param)); + } + httpClient = getHttpClient(); + config(reqBase); + + //设置请求头 + if(headers != null &&headers.size()>0) { + for(Map.Entry entry :headers.entrySet()) { + reqBase.setHeader(entry.getKey(), entry.getValue()); + } + } + //响应对象 + CloseableHttpResponse res = null; + //响应内容 + String resCtx = null; + int status; + EsignHttpResponse esignHttpResponse = new EsignHttpResponse(); + try { + //执行请求 + res = httpClient.execute(reqBase); + status=res.getStatusLine().getStatusCode(); + + //获取请求响应对象和响应entity + HttpEntity httpEntity = res.getEntity(); + if(httpEntity != null) { + resCtx = EntityUtils.toString(httpEntity,"utf-8"); + } + if(debug) { + LOGGER.info("响应\n{}", resCtx + "\n"); + LOGGER.info("----------------------------end------------------------"); + } + } catch (NoHttpResponseException e) { + throw new EsignDemoException("服务器丢失了",e); + } catch (SSLHandshakeException e){ + String msg = MessageFormat.format("SSL握手异常", e); + EsignDemoException ex = new EsignDemoException(msg, e); + throw ex; + } catch (UnknownHostException e){ + EsignDemoException ex = new EsignDemoException("服务器找不到", e); + ex.initCause(e); + throw ex; + } catch(ConnectTimeoutException e){ + EsignDemoException ex = new EsignDemoException("连接超时", e); + ex.initCause(e); + throw ex; + } catch(SSLException e){ + EsignDemoException ex = new EsignDemoException("SSL异常",e); + ex.initCause(e); + throw ex; + } catch (ClientProtocolException e) { + EsignDemoException ex = new EsignDemoException("请求头异常",e); + ex.initCause(e); + throw ex; + } catch (IOException e) { + EsignDemoException ex = new EsignDemoException("网络请求失败",e); + ex.initCause(e); + throw ex; + } finally { + if(res != null) { + try { + res.close(); + } catch (IOException e) { + EsignDemoException ex = new EsignDemoException("--->>关闭请求响应失败",e); + ex.initCause(e); + throw ex; + } + } + } + esignHttpResponse.setStatus(status); + esignHttpResponse.setBody(resCtx); + return esignHttpResponse; + } + //------------------------------公有方法end---------------------------------------------- + + //------------------------------私有方法start-------------------------------------------- + + /** + * @description 请求头和超时时间配置 + * + * @param httpReqBase + * @author 澄泓 + */ + private static void config(HttpRequestBase httpReqBase) { + // 配置请求的超时设置 + RequestConfig.Builder builder = RequestConfig.custom() + .setConnectionRequestTimeout(MAX_TIMEOUT) + .setConnectTimeout(MAX_TIMEOUT) + .setSocketTimeout(MAX_TIMEOUT); + if(OPEN_PROXY){ + HttpHost proxy=new HttpHost(PROXY_IP,PROXY_PORT,PROXY_AGREEMENT); + builder.setProxy(proxy); + } + RequestConfig requestConfig = builder.build(); + httpReqBase.setConfig(requestConfig); + } + + /** + * @description 连接池配置 + * + * @return + * @author 澄泓 + */ + private static void cfgPoolMgr() throws EsignDemoException { + ConnectionSocketFactory plainsf = PlainConnectionSocketFactory.getSocketFactory(); + LayeredConnectionSocketFactory sslsf = SSLConnectionSocketFactory.getSocketFactory(); + if(!SSL_VERIFY){ + sslsf=sslConnectionSocketFactory(); + } + + Registry registry = RegistryBuilder.create() + .register("http", plainsf) + .register("https", sslsf) + .build(); + + //连接池管理器 + connMgr = new PoolingHttpClientConnectionManager(registry); + //请求池最大连接数 + connMgr.setMaxTotal(MAX_TOTAL); + //但域名最大的连接数 + connMgr.setDefaultMaxPerRoute(ROUTE_MAX_TOTAL); + } + + + + + /** + * @description 设置重试机制 + * + * @author 澄泓 + */ + private static void cfgRetryHandler() { + retryHandler = new HttpRequestRetryHandler() { + + @Override + public boolean retryRequest(IOException e, int excCount, HttpContext ctx) { + //超过最大重试次数,就放弃 + if(excCount > MAX_RETRY) { + return false; + } + //服务器丢掉了链接,就重试 + if(e instanceof NoHttpResponseException) { + return true; + } + //不重试SSL握手异常 + if(e instanceof SSLHandshakeException) { + return false; + } + //中断 + if(e instanceof InterruptedIOException) { + return false; + } + //目标服务器不可达 + if(e instanceof UnknownHostException) { + return false; + } + //连接超时 + //SSL异常 + if(e instanceof SSLException) { + return false; + } + + HttpClientContext clientCtx = HttpClientContext.adapt(ctx); + HttpRequest req = clientCtx.getRequest(); + //如果是幂等请求,就再次尝试 + if(!(req instanceof HttpEntityEnclosingRequest)) { + return true; + } + return false; + } + }; + } + + /** + * 忽略域名校验 + */ + private static SSLConnectionSocketFactory sslConnectionSocketFactory() throws EsignDemoException { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); // 创建一个上下文(此处指定的协议类型似乎不是重点) + X509TrustManager tm = new X509TrustManager() { // 创建一个跳过SSL证书的策略 + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } + }; + ctx.init(null, new TrustManager[] { tm }, null); // 使用上面的策略初始化上下文 + return new SSLConnectionSocketFactory(ctx, new String[] { "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2" }, null, NoopHostnameVerifier.INSTANCE); + }catch (Exception e){ + EsignDemoException ex = new EsignDemoException("忽略域名校验失败",e); + ex.initCause(e); + throw ex; + } + + } + + /** + * @description 获取单例HttpClient + * + * @return + * @author 澄泓 + */ + private static synchronized CloseableHttpClient getHttpClient() throws EsignDemoException { + if(httpClient==null) { + CredentialsProvider credsProvider = new BasicCredentialsProvider(); + credsProvider.setCredentials(new AuthScope(PROXY_IP,PROXY_PORT),new UsernamePasswordCredentials(PROXY_USERNAME, PROXY_PASSWORD)); + cfgPoolMgr(); + cfgRetryHandler(); + HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); + httpClient = httpClientBuilder.setDefaultCredentialsProvider(credsProvider).setConnectionManager(connMgr).setRetryHandler(retryHandler).build(); + } + return httpClient; + + } + //------------------------------私有方法end---------------------------------------------- + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/FileTransformation.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/FileTransformation.java new file mode 100644 index 0000000..f63a3d9 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/FileTransformation.java @@ -0,0 +1,284 @@ +/* + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package com.ruoyi.common.constant; + +import com.ruoyi.common.exception.EsignDemoException; +import org.apache.commons.codec.binary.Base64; + +import java.io.*; +import java.net.HttpURLConnection; +import java.net.URL; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.HashMap; +import java.util.Map; + +/** + * @author 澄泓 + * @version JDK1.7 + * @description 文件转换类 + * @date 2020/10/26 10:47 + */ +public class FileTransformation { + + /** + * 传入本地文件路径转二进制byte + * + * @param srcFilePath 本地文件路径 + * @return + * @throws EsignDemoException + */ + public static byte[] fileToBytes(String srcFilePath) throws EsignDemoException { + return getBytes(srcFilePath); + } + + /** + * 图片转base64 + * + * @param filePath 本地文件路径 + * @return + * @throws EsignDemoException + */ + public static String fileToBase64(String filePath) throws EsignDemoException { + byte[] bytes; + String base64 = null; + bytes = fileToBytes(filePath); + base64 = Base64.encodeBase64String(bytes); + base64 = base64.replaceAll("\r\n", ""); + return base64; + } + + public static void main(String[] args) throws EsignDemoException { + System.out.println(getFileContentMD5("D:\\文档\\PLT2022-02124CT.pdf")); + } + + /*** + * 计算文件内容的Content-MD5 + * @param filePath 文件路径 + * @return + */ + public static String getFileContentMD5(String filePath) throws EsignDemoException { + // 获取文件MD5的二进制数组(128位) + byte[] bytes = getFileMD5Bytes128(filePath); + // 对文件MD5的二进制数组进行base64编码 + return new String(Base64.encodeBase64String(bytes)); + } + + /** + * 下载文件 + * + * @param httpUrl 网络文件地址url + * @return + */ + public static boolean downLoadFileByUrl(String httpUrl, String dir) throws EsignDemoException { + InputStream fis = null; + FileOutputStream fileOutputStream = null; + try { + URL url = new URL(httpUrl); + HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); + httpConn.connect(); + fis = httpConn.getInputStream(); + fileOutputStream = new FileOutputStream(new File(dir)); + byte[] md5Bytes = null; + + byte[] buffer = new byte[1024]; + int length = -1; + while ((length = fis.read(buffer, 0, 1024)) != -1) { + fileOutputStream.write(buffer, 0, length); + } + } catch (IOException e) { + EsignDemoException ex = new EsignDemoException("获取文件流异常", e); + ex.initCause(e); + throw ex; + } finally { + try { + if (fis != null) { + fis.close(); + } + if (fileOutputStream != null) { + fileOutputStream.close(); + } + } catch (IOException e) { + EsignDemoException ex = new EsignDemoException("关闭文件流异常", e); + ex.initCause(e); + throw ex; + } + } + return true; + } + + + /** + * 网络文件转二进制MD5数组并获取文件大小 + * + * @param fileUrl 网络文件地址url + * @return + */ + public static Map fileUrlToBytes(String fileUrl) throws EsignDemoException { + HashMap map = new HashMap(); + try { + URL url = new URL(fileUrl); + HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); + httpConn.connect(); + InputStream fis = httpConn.getInputStream(); + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + outStream.close(); + map.put("fileSize", fis.available()); + byte[] md5Bytes = null; + MessageDigest md5 = MessageDigest.getInstance("MD5"); + byte[] buffer = new byte[1024]; + int length = -1; + while ((length = fis.read(buffer, 0, 1024)) != -1) { + md5.update(buffer, 0, length); + outStream.write(buffer, 0, length); + } + md5Bytes = md5.digest(); + byte[] fileData = outStream.toByteArray(); + map.put("fileData", fileData); + outStream.close(); + fis.close(); + map.put("md5Bytes", md5Bytes); + } catch (IOException e) { + EsignDemoException ex = new EsignDemoException("获取文件流异常", e); + ex.initCause(e); + throw ex; + } catch (NoSuchAlgorithmException e) { + EsignDemoException ex = new EsignDemoException("文件计算异常", e); + ex.initCause(e); + throw ex; + } + return map; + } + + /*** + * 获取文件MD5的二进制数组(128位) + * @param filePath + * @return + * @throws EsignDemoException + */ + public static byte[] getFileMD5Bytes128(String filePath) throws EsignDemoException { + FileInputStream fis = null; + byte[] md5Bytes = null; + try { + File file = new File(filePath); + fis = new FileInputStream(file); + MessageDigest md5 = MessageDigest.getInstance("MD5"); + byte[] buffer = new byte[1024]; + int length = -1; + while ((length = fis.read(buffer, 0, 1024)) != -1) { + md5.update(buffer, 0, length); + } + md5Bytes = md5.digest(); + fis.close(); + } catch (FileNotFoundException e) { + EsignDemoException ex = new EsignDemoException("文件找不到", e); + ex.initCause(e); + throw ex; + } catch (NoSuchAlgorithmException e) { + EsignDemoException ex = new EsignDemoException("不支持此算法", e); + ex.initCause(e); + throw ex; + } catch (IOException e) { + EsignDemoException ex = new EsignDemoException("输入流或输出流异常", e); + ex.initCause(e); + throw ex; + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + EsignDemoException ex = new EsignDemoException("关闭文件输入流失败", e); + ex.initCause(e); + throw ex; + } + } + } + return md5Bytes; + } + + /** + * @param path + * @return + * @throws EsignDemoException + * @description 根据文件路径,获取文件base64 + * @author 宫清 + * @date 2019年7月21日 下午4:22:08 + */ + public static String getBase64Str(String path) throws EsignDemoException { + InputStream is = null; + try { + is = new FileInputStream(new File(path)); + byte[] bytes = new byte[is.available()]; + is.read(bytes); + return Base64.encodeBase64String(bytes); + } catch (Exception e) { + EsignDemoException ex = new EsignDemoException("获取文件输入流失败", e); + ex.initCause(e); + throw ex; + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) { + EsignDemoException ex = new EsignDemoException("关闭文件输入流失败", e); + ex.initCause(e); + throw ex; + } + } + } + } + + /** + * @param path 文件路径 + * @return + * @description 获取文件名称 + * @author 宫清 + * @date 2019年7月21日 下午8:21:16 + */ + public static String getFileName(String path) { + return new File(path).getName(); + } + + /** + * @param filePath {@link String} 文件地址 + * @return + * @throws EsignDemoException + * @description 获取文件字节流 + * @date 2019年7月10日 上午9:17:00 + * @author 宫清 + */ + public static byte[] getBytes(String filePath) throws EsignDemoException { + File file = new File(filePath); + FileInputStream fis = null; + byte[] buffer = null; + try { + fis = new FileInputStream(file); + buffer = new byte[(int) file.length()]; + fis.read(buffer); + } catch (Exception e) { + EsignDemoException ex = new EsignDemoException("获取文件字节流失败", e); + ex.initCause(e); + throw ex; + } finally { + if (fis != null) { + try { + fis.close(); + } catch (IOException e) { + EsignDemoException ex = new EsignDemoException("关闭文件字节流失败", e); + ex.initCause(e); + throw ex; + } + } + } + return buffer; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignCoreSdkInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignCoreSdkInfo.java new file mode 100644 index 0000000..d97603d --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignCoreSdkInfo.java @@ -0,0 +1,24 @@ +package com.ruoyi.common.core.domain.entity; +/** + * esignSDK-core信息类 + * @author 澄泓 + * @date 2022/2/22 13:59 + * @version + */ +public class EsignCoreSdkInfo { + private static final String SdkVersion="Esign-Sdk-Core1.0"; + private static final String SupportedVersion="JDK1.7 MORE THAN"; + + private static final String Info="sdk-esign-api核心工具包,主要处理e签宝公有云产品接口调用时的签名计算以及网络请求,通过EsignHttpHelper.signAndBuildSignAndJsonHeader构造签名鉴权+json数据格式的请求头,通过HttpHelper.doCommHttp方法入参发起网络请求。让开发者无需关注具体的请求签名算法,专注于接口业务的json参数构造"; + public static String getSdkVersion() { + return SdkVersion; + } + + public static String getInfo() { + return Info; + } + + public static String getSupportedVersion() { + return SupportedVersion; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignHttpResponse.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignHttpResponse.java new file mode 100644 index 0000000..26375c0 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/EsignHttpResponse.java @@ -0,0 +1,24 @@ +package com.ruoyi.common.core.domain.entity; +/** + * 网络请求的response类 + */ +public class EsignHttpResponse { + private int status; + private String body; + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/EsignRequestType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/EsignRequestType.java new file mode 100644 index 0000000..8b87de6 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/enums/EsignRequestType.java @@ -0,0 +1,39 @@ +package com.ruoyi.common.enums; + +import org.apache.http.client.methods.*; + +/** + * @description 请求类型 + * @author 澄泓 + * @since JDK1.7 + */ +public enum EsignRequestType { + + POST{ + @Override + public HttpRequestBase getHttpType(String url) { + return new HttpPost(url); + } + }, + GET{ + @Override + public HttpRequestBase getHttpType(String url) { + return new HttpGet(url); + } + }, + DELETE{ + @Override + public HttpRequestBase getHttpType(String url) { + return new HttpDelete(url); + } + }, + PUT{ + @Override + public HttpRequestBase getHttpType(String url) { + return new HttpPut(url); + } + }, + ; + + public abstract HttpRequestBase getHttpType(String url); +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/exception/EsignDemoException.java b/ruoyi-common/src/main/java/com/ruoyi/common/exception/EsignDemoException.java new file mode 100644 index 0000000..7be2957 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/exception/EsignDemoException.java @@ -0,0 +1,36 @@ +package com.ruoyi.common.exception; + +/** + * description 自定义全局异常 + * @author 澄泓 + * datetime 2019年7月1日上午10:43:24 + */ +public class EsignDemoException extends Exception { + + private static final long serialVersionUID = 4359180081622082792L; + private Exception e; + + public EsignDemoException(String msg) { + super(msg); + } + + public EsignDemoException(String msg, Throwable cause) { + super(msg,cause); + } + + public EsignDemoException(){ + + } + + public Exception getE() { + return e; + } + + public void setE(Exception e) { + this.e = e; + } + + + + +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/EsignHttpHelper.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EsignHttpHelper.java new file mode 100644 index 0000000..ed255e5 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/EsignHttpHelper.java @@ -0,0 +1,178 @@ +package com.ruoyi.common.utils; + + +import com.ruoyi.common.constant.EsignEncryption; +import com.ruoyi.common.constant.EsignHeaderConstant; +import com.ruoyi.common.constant.EsignHttpCfgHelper; +import com.ruoyi.common.core.domain.entity.EsignCoreSdkInfo; +import com.ruoyi.common.core.domain.entity.EsignHttpResponse; +import com.ruoyi.common.enums.EsignRequestType; +import com.ruoyi.common.exception.EsignDemoException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; + +/** + * @description Http 请求 辅助类 + * @author 澄泓 + * @since JDK1.7 + */ +public class EsignHttpHelper { + private static final Logger LOGGER = LoggerFactory.getLogger(EsignHttpHelper.class); + + /** + * 不允许外部创建实例 + */ + private EsignHttpHelper() { + + } + + /** + * @description 发送常规HTTP 请求 + * + * @param reqType 请求方式 + * @param url 请求路径 + * @param paramStr 请求参数 + * @return + * @throws EsignDemoException + * @author 澄泓 + */ + public static EsignHttpResponse doCommHttp(String host, String url, EsignRequestType reqType, Object paramStr , Map httpHeader, boolean debug) throws EsignDemoException { + + return EsignHttpCfgHelper.sendHttp(reqType, host+url,httpHeader, paramStr, debug); + + } + + + /** + * @description 发送文件流上传 HTTP 请求 + * + * @param reqType 请求方式 + * @param uploadUrl 请求路径 + * @param param 请求参数 + * @param fileContentMd5 文件fileContentMd5 + * @param contentType 文件MIME类型 + * @return + * @throws EsignDemoException + * @author 澄泓 + */ + public static EsignHttpResponse doUploadHttp( String uploadUrl,EsignRequestType reqType,byte[] param, String fileContentMd5, + String contentType, boolean debug) throws EsignDemoException { + Map uploadHeader = buildUploadHeader(fileContentMd5, contentType); + if(debug){ + LOGGER.info("----------------------------start------------------------"); + LOGGER.info("fileContentMd5:{}",fileContentMd5); + LOGGER.info("contentType:{}",contentType); + } + return EsignHttpCfgHelper.sendHttp(reqType,uploadUrl, uploadHeader, param,debug); + } + + + + /** + * @description 构建一个签名鉴权+json数据的esign请求头 + * @return + * @author 澄泓 + */ + public static Map buildSignAndJsonHeader(String projectId,String contentMD5,String accept,String contentType,String authMode) { + + Map header = new HashMap<>(); + header.put("X-Tsign-Open-App-Id", projectId); + header.put("X-Tsign-Open-Version-Sdk",EsignCoreSdkInfo.getSdkVersion()); + header.put("X-Tsign-Open-Ca-Timestamp", EsignEncryption.timeStamp()); + header.put("Accept",accept); + header.put("Content-MD5",contentMD5); + header.put("Content-Type", contentType); + header.put("X-Tsign-Open-Auth-Mode", authMode); + return header; + } + + /** + * 签名计算并且构建一个签名鉴权+json数据的esign请求头 + * @param httpMethod + * * The name of a supported {@linkplain java.nio.charset.Charset + * * charset} + * @return + */ + public static Map signAndBuildSignAndJsonHeader(String projectId, String secret,String paramStr,String httpMethod,String url,boolean debug) throws EsignDemoException { + String contentMD5=""; + //统一转大写处理 + httpMethod = httpMethod.toUpperCase(); + if("GET".equals(httpMethod)||"DELETE".equals(httpMethod)){ + paramStr=null; + contentMD5=""; + } else if("PUT".equals(httpMethod)||"POST".equals(httpMethod)){ + //对body体做md5摘要 + contentMD5= EsignEncryption.doContentMD5(paramStr); + }else{ + throw new EsignDemoException(String.format("不支持的请求方法%s",httpMethod)); + } + //构造一个初步的请求头 + Map esignHeaderMap = buildSignAndJsonHeader(projectId, contentMD5, EsignHeaderConstant.ACCEPT.VALUE(), EsignHeaderConstant.CONTENTTYPE_JSON.VALUE(), EsignHeaderConstant.AUTHMODE.VALUE()); + //排序 + url=EsignEncryption.sortApiUrl(url); + //传入生成的bodyMd5,加上其他请求头部信息拼接成字符串 + String message = EsignEncryption.appendSignDataString(httpMethod, esignHeaderMap.get("Content-MD5"),esignHeaderMap.get("Accept"),esignHeaderMap.get("Content-Type"),esignHeaderMap.get("Headers"),esignHeaderMap.get("Date"), url); + //整体做sha256签名 + String reqSignature = EsignEncryption.doSignatureBase64(message, secret); + //请求头添加签名值 + esignHeaderMap.put("X-Tsign-Open-Ca-Signature",reqSignature); + if(debug){ + LOGGER.info("----------------------------start------------------------"); + LOGGER.info("待计算body值:{}", paramStr+"\n"); + LOGGER.info("MD5值:{}",contentMD5+"\n"); + LOGGER.info("待签名字符串:{}",message+"\n"); + LOGGER.info("签名值:{}",reqSignature+"\n"); + } + return esignHeaderMap; + } + + + /** + * @description 构建一个Token鉴权+jsons数据的esign请求头 + * @return + * @author 澄泓 + */ + public static Map buildTokenAndJsonHeader(String appid,String token) { + Map esignHeader = new HashMap<>(); + esignHeader.put("X-Tsign-Open-Version-Sdk", EsignCoreSdkInfo.getSdkVersion()); + esignHeader.put("Content-Type", EsignHeaderConstant.CONTENTTYPE_JSON.VALUE()); + esignHeader.put("X-Tsign-Open-App-Id", appid); + esignHeader.put("X-Tsign-Open-Token", token); + return esignHeader; + } + + /** + * @description 构建一个form表单数据的esign请求头 + * @return + * @author 澄泓 + */ + public static Map buildFormDataHeader(String appid) { + Map esignHeader = new HashMap<>(); + esignHeader.put("X-Tsign-Open-Version-Sdk",EsignCoreSdkInfo.getSdkVersion()); + esignHeader.put("X-Tsign-Open-Authorization-Version","v2"); + esignHeader.put("Content-Type", EsignHeaderConstant.CONTENTTYPE_FORMDATA.VALUE()); + esignHeader.put("X-Tsign-Open-App-Id", appid); + return esignHeader; + } + + /** + * @description 创建文件流上传 请求头 + * + * @param fileContentMd5 + * @param contentType + * @return + * @author 澄泓 + */ + public static Map buildUploadHeader(String fileContentMd5, String contentType) { + Map header = new HashMap<>(); + header.put("Content-MD5", fileContentMd5); + header.put("Content-Type", contentType); + + return header; + } + + // ------------------------------私有方法end---------------------------------------------- +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/EsignFileBean.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/EsignFileBean.java new file mode 100644 index 0000000..5f46713 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/bean/EsignFileBean.java @@ -0,0 +1,57 @@ +package com.ruoyi.common.utils.bean; + + +import com.ruoyi.common.constant.FileTransformation; +import com.ruoyi.common.exception.EsignDemoException; + +import java.io.File; + +/** + * @description 文件基础信息封装类 + * @author 澄泓 + * @date 2020/10/26 14:54 + * @version JDK1.7 + */ +public class EsignFileBean { + //文件名称 + private String fileName; + //文件大小 + private int fileSize; + //文件内容MD5 + private String fileContentMD5; + //文件地址 + private String filePath; + + + public EsignFileBean(String filePath) throws EsignDemoException { + this.filePath=filePath; + this.fileContentMD5 = FileTransformation.getFileContentMD5(filePath); + File file = new File(filePath); + if (!file.exists()) { + throw new EsignDemoException("文件不存在"); + } + this.fileName = file.getName(); + this.fileSize = (int) file.length(); + } + + public String getFileName() { + return fileName; + } + + public int getFileSize() { + return fileSize; + } + + public String getFileContentMD5() { + return fileContentMD5; + } + + /** + * 传入本地文件地址获取二进制数据 + * @return + * @throws EsignDemoException + */ + public byte[] getFileBytes() throws EsignDemoException { + return FileTransformation.fileToBytes(filePath); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java new file mode 100644 index 0000000..5ea9410 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java @@ -0,0 +1,43 @@ +package com.ruoyi.common.utils.file; + +import com.ruoyi.common.config.EsignDemoConfig; +import com.ruoyi.common.constant.EsignHeaderConstant; +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.EsignHttpHelper; +import com.ruoyi.common.utils.bean.EsignFileBean; + +import java.util.Map; + +public class SaaSAPIFileUtils { + private static String eSignHost= EsignDemoConfig.EsignHost; + private static String eSignAppId= EsignDemoConfig.EsignAppId; + private static String eSignAppSecret=EsignDemoConfig.EsignAppSecret; + /** + * 获取文件上传地址 + * + * @return + */ + public static EsignHttpResponse getUploadUrl(String filePath) throws EsignDemoException { + //自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据 + EsignFileBean esignFileBean = new EsignFileBean(filePath); + String apiaddr = "/v3/files/file-upload-url"; + //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null + String jsonParm = "{\n" + + " \"contentMd5\": \"" + esignFileBean.getFileContentMD5() + "\",\n" + + " \"fileName\":\"" + esignFileBean.getFileName() + "\"," + + " \"fileSize\": " + esignFileBean.getFileSize() + ",\n" + + " \"convertToPDF\":" +true+ ",\n" + + " \"contentType\": \"" + EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE() + "\"\n" + + "}"; + //请求方法 + EsignRequestType requestType = EsignRequestType.POST; + //生成签名鉴权方式的的header + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, true); + //发起接口请求 + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); + } + + +} From a43ded3a85e3354ec52af9010d179f2b342c3191 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 10 Oct 2023 16:54:51 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E8=B7=B3=E8=BF=87token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/wisdomarbitrate/CaseApplicationController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 27287d5..7222568 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.wisdomarbitrate; +import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -220,8 +221,9 @@ public class CaseApplicationController extends BaseController { /** - * 确认缴费查询立案信息 + * 发送房间号短信 */ + @Anonymous @PostMapping("/sendRoomNoMessage") public AjaxResult sendRoomNoMessage(@Validated @RequestBody SendRoomNoMessageVO messageVO) { From f0f65d0cf0950b50e67c55226fb6b667e59c3c4b Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 10 Oct 2023 17:47:12 +0800 Subject: [PATCH 05/23] =?UTF-8?q?=E5=8F=91=E9=80=81=E6=88=BF=E9=97=B4?= =?UTF-8?q?=E5=8F=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 1 + .../domain/vo/SendRoomNoMessageVO.java | 3 ++- .../wisdomarbitrate/mapper/ArbitratorMapper.java | 8 -------- .../mapper/CaseAffiliateMapper.java | 2 ++ .../service/impl/CaseApplicationServiceImpl.java | 10 +++++----- .../mapper/wisdomarbitrate/ArbitratorMapper.xml | 16 ---------------- .../wisdomarbitrate/CaseAffiliateMapper.xml | 14 ++++++++++++++ 7 files changed, 24 insertions(+), 30 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 7222568..01d6354 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*; import com.ruoyi.common.utils.poi.ExcelUtil; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.security.PermitAll; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java index d20d4f3..0ba7248 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java @@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.domain.vo; import lombok.Data; import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -13,7 +14,7 @@ import java.io.Serializable; @Data public class SendRoomNoMessageVO implements Serializable { private static final long serialVersionUID = 1L; - @NotEmpty(message = "案件id不能为空") + @NotNull(message = "案件id不能为空") private Long id; @NotEmpty(message = "房间号不能为空") private String roomNo; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ArbitratorMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ArbitratorMapper.java index e7d6e2b..04bda03 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ArbitratorMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ArbitratorMapper.java @@ -8,12 +8,4 @@ import java.util.List; public interface ArbitratorMapper { List selectArbitratorList(Arbitrator arbitrator); - /** - * 根据案件id和身份类型查询案件关联人 - * @param caseAppliId - * @param identityType - * @return - */ - Arbitrator selectArbitratorById(@Param("caseAppliId") Long caseAppliId,@Param("identityType") Integer identityType); - } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateMapper.java index 52e0057..9c0ce9d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseAffiliateMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.mapper; import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -15,6 +16,7 @@ public interface CaseAffiliateMapper { List selectCaseAffiliate(CaseAffiliate caseAffiliate); + CaseAffiliate selectCaseAffiliateByIdentityType(@Param("caseAppliId") Long caseAppliId, @Param("identityType")int identityType); int updataCaseAffiliate(CaseAffiliate caseAffiliate); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index da34b56..6ce19d3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -461,8 +461,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { */ @Override public String sendRoomNoMessage(SendRoomNoMessageVO messageVO) { - Arbitrator arbitrator = arbitratorMapper.selectArbitratorById(messageVO.getId(), 2); - if(null==arbitrator){ + CaseAffiliate caseAffiliate = caseAffiliateMapper.selectCaseAffiliateByIdentityType(messageVO.getId(), 2); + if(null==caseAffiliate){ return "被申请人不存在"; } CaseApplication caseApplication = new CaseApplication(); @@ -473,9 +473,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); request.setTemplateId("1948332"); // 1948332 普通短信 开庭审理房间号通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请知晓,如非本人操作,请忽略本短信。 - request.setPhone(arbitrator.getTelephone()); - request.setTemplateParamSet(new String[]{arbitrator.getArbitratorName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()}); - + request.setPhone(caseAffiliate.getContactTelphone()); + request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()}); + SmsUtils.sendSms(request); return "短信发送成功"; } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml index 1c1845b..e394d00 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml @@ -36,21 +36,5 @@ - - \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml index 7a10075..90258bb 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml @@ -33,6 +33,20 @@ + From db5a2e44e64b8875cd935ac115a179756754bb09 Mon Sep 17 00:00:00 2001 From: hejinbo Date: Tue, 10 Oct 2023 18:23:45 +0800 Subject: [PATCH 06/23] =?UTF-8?q?1=E3=80=81=20=E8=8E=B7=E5=8F=96=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=8A=E4=BC=A0=E5=9C=B0=E5=9D=80=20=EF=BC=8C2?= =?UTF-8?q?=E3=80=81=20=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E6=B5=81=20?= =?UTF-8?q?=EF=BC=8C3=E3=80=81=20=E6=9F=A5=E8=AF=A2=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/utils/file/SaaSAPIFileUtils.java | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java index 5ea9410..fa6389b 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java @@ -1,5 +1,6 @@ package com.ruoyi.common.utils.file; +import cn.hutool.json.JSONObject; import com.ruoyi.common.config.EsignDemoConfig; import com.ruoyi.common.constant.EsignHeaderConstant; import com.ruoyi.common.core.domain.entity.EsignHttpResponse; @@ -16,8 +17,6 @@ public class SaaSAPIFileUtils { private static String eSignAppSecret=EsignDemoConfig.EsignAppSecret; /** * 获取文件上传地址 - * - * @return */ public static EsignHttpResponse getUploadUrl(String filePath) throws EsignDemoException { //自定义的文件封装类,传入文件地址可以获取文件的名称大小,文件流等数据 @@ -38,6 +37,47 @@ public class SaaSAPIFileUtils { //发起接口请求 return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, true); } + /** + * 上传文件流 + */ + public static EsignHttpResponse uploadFile(String uploadUrl,String filePath) throws EsignDemoException { + //根据文件地址获取文件contentMd5 + EsignFileBean esignFileBean = new EsignFileBean(filePath); + //请求方法 + EsignRequestType requestType= EsignRequestType.PUT; + return EsignHttpHelper.doUploadHttp(uploadUrl,requestType,esignFileBean.getFileBytes(),esignFileBean.getFileContentMD5(), EsignHeaderConstant.CONTENTTYPE_STREAM.VALUE(),true); + } + /** + * 获取文件上传状态 + */ + public static EsignHttpResponse getFileStatus(String fileId) throws EsignDemoException { + String apiaddr="/v3/files/"+fileId; + //请求参数body体,json格式。get或者delete请求时jsonString传空json:"{}"或者null + String jsonParm=null; + //请求方法 + EsignRequestType requestType= EsignRequestType.GET; + //生成签名鉴权方式的的header + Map header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId,eSignAppSecret,jsonParm,requestType.name(),apiaddr,true); + //发起接口请求 + return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); + } + +/* public static void main(String[] args) throws EsignDemoException { + String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\07\\6babb8e261454fffbacf6d9fd1589b9b.docx"; + EsignHttpResponse uploadUrl = getUploadUrl(filePath); + String body = uploadUrl.getBody(); + JSONObject jsonObject = new JSONObject(body); + JSONObject dataObj = jsonObject.getJSONObject("data"); + String fileUploadUrl = dataObj.get("fileUploadUrl").toString(); + System.out.println("这是fileUploadUrl:"+fileUploadUrl); + String fileId = dataObj.get("fileId").toString(); + System.out.println("这是fileId:"+fileId); + EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath); + System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody()); + EsignHttpResponse fileStatus = getFileStatus(fileId); + System.out.println("这是获取文件上传状态的结果:"+fileStatus.getBody()); + getFileStatus("95d0c307d91e4985bdb8874f6f84daa5"); + }*/ } From af901190b9eab9cfa476280b998befa370b76eed Mon Sep 17 00:00:00 2001 From: gy b Date: Tue, 10 Oct 2023 18:25:15 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=92=8C=E6=8C=89=E9=92=AE=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdjudicationController.java | 7 +++++++ .../CaseApplicationController.java | 19 ++++++++++--------- .../CaseArbitrateController.java | 3 +++ .../CaseEvidenceController.java | 3 +++ .../CaseLogRecordController.java | 2 +- .../CasePaymentController.java | 3 +++ 6 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java index cbc0f7b..af62cdf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java @@ -6,6 +6,7 @@ import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -21,6 +22,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/document") + @PreAuthorize("@ss.hasPermi('caseManagement:createaward')") public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.createDocument(caseApplication); } @@ -41,6 +43,7 @@ public class AdjudicationController extends BaseController { * @return */ @GetMapping("/logistics") + @PreAuthorize("@ss.hasPermi('delivery:detail')") public AjaxResult getLogisticsInfo(CaseApplication caseApplication){ return adjudicationService.getLogisticsInfo(caseApplication); } @@ -51,6 +54,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/signature") + @PreAuthorize("@ss.hasPermi('awardManagement:sign')") public AjaxResult signature(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.signature(caseApplication); } @@ -61,6 +65,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/caseFile") + @PreAuthorize("@ss.hasPermi('awardManagement:file')") public AjaxResult caseFile(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.caseFile(caseApplication); } @@ -71,6 +76,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/service") + @PreAuthorize("@ss.hasPermi('awardManagement:sendaward')") public AjaxResult service(@RequestBody BookSendVO bookSendVO){ return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum()); } @@ -80,6 +86,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/stamp") + @PreAuthorize("@ss.hasPermi('awardManagement:signprint')") public AjaxResult stamp(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.stamp(caseApplication); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 27287d5..8225542 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -34,7 +34,7 @@ public class CaseApplicationController extends BaseController { /** * 查询立案数据 */ - @PreAuthorize("@ss.hasPermi('caseApplication:list')") + @PreAuthorize("@ss.hasPermi('caseManagement:list')") @GetMapping("/list") public TableDataInfo list(CaseApplication caseApplication) { @@ -46,7 +46,7 @@ public class CaseApplicationController extends BaseController { /** * 新增立案数据 */ - @PreAuthorize("@ss.hasPermi('caseApplication:add')") + @PreAuthorize("@ss.hasPermi('caseManagement:add')") @Log(title = "新增立案数据", businessType = BusinessType.INSERT) @PostMapping("/addCaseApplication") public AjaxResult addCaseApplication(@Validated @RequestBody CaseApplication caseApplication) @@ -62,7 +62,7 @@ public class CaseApplicationController extends BaseController { /** * 修改立案数据 */ - @PreAuthorize("@ss.hasPermi('caseApplication:edit')") + @PreAuthorize("@ss.hasPermi('caseManagement:update')") @Log(title = "修改立案数据", businessType = BusinessType.UPDATE) @PostMapping("/editCaseApplication") public AjaxResult editCaseApplication(@Validated @RequestBody CaseApplication caseApplication) @@ -75,7 +75,7 @@ public class CaseApplicationController extends BaseController { /** * 提交立案申请 */ - @PreAuthorize("@ss.hasPermi('caseApplication:submit')") + @PreAuthorize("@ss.hasPermi('caseManagement:submit')") @Log(title = "提交立案申请", businessType = BusinessType.UPDATE) @PostMapping("/submitCaseApplication") public AjaxResult submitCaseApplication(@Validated @RequestBody CaseApplication caseApplication) @@ -87,7 +87,7 @@ public class CaseApplicationController extends BaseController { /** * 删除立案数据 */ - @PreAuthorize("@ss.hasPermi('caseApplication:remove')") + @PreAuthorize("@ss.hasPermi('caseManagement:delete')") @Log(title = "删除立案数据", businessType = BusinessType.DELETE) @PostMapping("/removeCaseApplication") public AjaxResult removeCaseApplication(@Validated @RequestBody CaseApplication caseApplication) @@ -99,6 +99,7 @@ public class CaseApplicationController extends BaseController { /** * 查询立案信息 */ + @PreAuthorize("@ss.hasPermi('caseManagement:detail')") @PostMapping("/selectCaseApplication") public AjaxResult selectCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { @@ -117,7 +118,7 @@ public class CaseApplicationController extends BaseController { } @Log(title = "立案信息导入", businessType = BusinessType.IMPORT) - @PreAuthorize("@ss.hasPermi('caseApplication:import')") + @PreAuthorize("@ss.hasPermi('caseManagement:import')") @PostMapping("/importData") public AjaxResult importData(MultipartFile file) throws Exception { ExcelUtil util = new ExcelUtil(CaseApplication.class); @@ -141,7 +142,7 @@ public class CaseApplicationController extends BaseController { /** * 组庭审核 */ - @PreAuthorize("@ss.hasPermi('caseApplication:pendTralCheck')") + @PreAuthorize("@ss.hasPermi('caseManagement:checkgroup')") @Log(title = "组庭审核", businessType = BusinessType.UPDATE) @PostMapping("/pendTralCheck") public AjaxResult pendTralCheck(@Validated @RequestBody CaseApplication caseApplication) @@ -152,7 +153,7 @@ public class CaseApplicationController extends BaseController { /** * 组庭确认 */ - @PreAuthorize("@ss.hasPermi('caseApplication:pendTralSure')") + @PreAuthorize("@ss.hasPermi('caseManagement:confirmgroup')") @Log(title = "组庭确认", businessType = BusinessType.UPDATE) @PostMapping("/pendTralSure") public AjaxResult pendTralSure(@Validated @RequestBody CaseApplication caseApplication) @@ -198,7 +199,7 @@ public class CaseApplicationController extends BaseController { /** * 提交立案审查 */ - @PreAuthorize("@ss.hasPermi('caseApplication:submitCaseApplicationCheck')") + @PreAuthorize("@ss.hasPermi('caseManagement:check')") @Log(title = "提交立案审查", businessType = BusinessType.UPDATE) @PostMapping("/submitCaseApplicationCheck") public AjaxResult submitCaseApplicationCheck(@Validated @RequestBody CaseApplication caseApplication) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java index b44cead..440bdad 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java @@ -6,6 +6,7 @@ import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.service.ICaseArbitrateService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -22,6 +23,7 @@ public class CaseArbitrateController extends BaseController { * @return */ @PutMapping("/method") + @PreAuthorize("@ss.hasPermi('caseManagement:checkarbitrationway')") public AjaxResult examineArbitrateMethod(@Validated @RequestBody CaseApplication caseApplication ,Integer opinion){ return caseArbitrateService.examineArbitrateMethod(caseApplication,opinion); @@ -33,6 +35,7 @@ public class CaseArbitrateController extends BaseController { * @return */ @PostMapping("/writtenHear") + @PreAuthorize("@ss.hasPermi('caseManagement:offlinehear')") public AjaxResult writtenHear(@Validated @RequestBody ArbitrateRecord arbitrateRecord){ return caseArbitrateService.writtenHear(arbitrateRecord); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java index 536228c..49f30ee 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java @@ -8,6 +8,7 @@ import com.ruoyi.wisdomarbitrate.domain.dto.CaseEvidenceDTO; import com.ruoyi.wisdomarbitrate.domain.vo.CaseEvidenceVO; import com.ruoyi.wisdomarbitrate.service.ICaseEvidenceService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -35,6 +36,7 @@ public class CaseEvidenceController extends BaseController { * @return */ @GetMapping("/{id}") + @PreAuthorize("@ss.hasPermi('caseManagement:detail')") public AjaxResult getCaseDetailsById(@PathVariable Long id) { String username = this.getUsername(); return caseEvidenceService.getCaseDetailsById(id,username); @@ -61,6 +63,7 @@ public class CaseEvidenceController extends BaseController { * @return */ @GetMapping("/all") + @PreAuthorize("@ss.hasPermi('caseManagement:list')") public TableDataInfo getCaseListAll(@RequestParam String identityNum) { startPage(); List list = caseEvidenceService.getCaseListAll(identityNum); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java index dc733c1..8fd1ee0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseLogRecordController.java @@ -22,7 +22,7 @@ public class CaseLogRecordController extends BaseController { /** * 查询案件日志列表 */ - @PreAuthorize("@ss.hasPermi('caseLogRecord:list')") + @PreAuthorize("@ss.hasPermi('caseLog:list')") @GetMapping("/list") public TableDataInfo list(CaseLogRecord caseLogRecord) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java index 712ac1f..9bd76f7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java @@ -5,6 +5,7 @@ import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.service.ICasePaymentService; import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -24,6 +25,7 @@ public class CasePaymentController { * @param casePayDTO 缴费传入参数 * @return 统一响应结果 */ + @PreAuthorize("@ss.hasPermi('caseManagement:pay')") @PostMapping("/casePay") public AjaxResult casePay(@Validated @RequestBody CasePayDTO casePayDTO) { return paymentService.casePay(casePayDTO); @@ -34,6 +36,7 @@ public class CasePaymentController { * @param caseApplication * @return */ + @PreAuthorize("@ss.hasPermi('paymentManagement:payconfirm')") @PutMapping("/confirm") public AjaxResult confirmPayment(@Validated @RequestBody CaseApplication caseApplication) { return paymentService.confirmPayment(caseApplication); From e1422ce1c8d103ddcf98a7d5010333d7269e7415 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 10 Oct 2023 19:23:27 +0800 Subject: [PATCH 08/23] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E7=AB=8B=E6=A1=88=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 6 -- .../wisdomarbitrate/domain/CaseLogRecord.java | 29 ++++++++++ .../impl/CaseApplicationServiceImpl.java | 56 +++++++++++-------- .../impl/CaseLogRecordServiceImpl.java | 40 ++++++++++++- .../wisdomarbitrate/CaseLogRecordMapper.xml | 9 ++- 5 files changed, 108 insertions(+), 32 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 01d6354..e3941a8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -6,22 +6,16 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; -import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import com.ruoyi.common.utils.poi.ExcelUtil; import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.security.PermitAll; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.util.List; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java index 4a47bd4..bd5f9ca 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java @@ -25,6 +25,15 @@ public class CaseLogRecord extends BaseEntity { /** 案件编号 */ private String caseNum; + /** + * 展示的内容 + */ + private String content; + /** + * 用户昵称 + */ + private String nickName; + public String getCaseNum() { return caseNum; @@ -73,4 +82,24 @@ public class CaseLogRecord extends BaseEntity { public void setNotes(String notes) { this.notes = notes; } + + public void setCaseNode(Integer caseNode) { + this.caseNode = caseNode; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 6ce19d3..a8bfabb 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.entity.SysDept; @@ -69,34 +70,38 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { int rows = caseApplicationMapper.insertCaseApplication(caseApplication); List caseAffiliates = caseApplication.getCaseAffiliates(); - + Map deptMap =new HashMap<>(); if (caseAffiliates != null && caseAffiliates.size() > 0) { - // 查询所有的组织机构,组装成map - List deptList = sysDeptMapper.selectDeptList(new SysDept()); - if (CollectionUtil.isEmpty(deptList)) { - deptList = new ArrayList<>(); + if(StrUtil.isNotEmpty(caseApplication.getName())) { + // 查询所有的组织机构,组装成map + List deptList = sysDeptMapper.selectDeptList(new SysDept()); + if (CollectionUtil.isEmpty(deptList)) { + deptList = new ArrayList<>(); + } + deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); } - Map deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); - for (CaseAffiliate caseAffiliate : caseAffiliates) { caseAffiliate.setCaseAppliId(caseApplication.getId()); - // 将组织机构id设为申请人名称 - if (deptMap.containsKey(caseApplication.getName())) { - caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName()))); - } else { - // 如果不存在则新增 - SysDept dept = new SysDept(); - dept.setParentId(0L); - dept.setDeptName(caseApplication.getName()); - dept.setAncestors("0"); - dept.setOrderNum(1); - dept.setStatus("0"); - dept.setDelFlag("0"); - dept.setCreateBy(getUsername()); - dept.setUpdateBy(getUsername()); - sysDeptMapper.insertDept(dept); - caseAffiliate.setName(String.valueOf(dept.getDeptId())); + if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseApplication.getName())) { + // 将组织机构id设为申请人名称 + if (deptMap.containsKey(caseApplication.getName())) { + caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName()))); + } else { + // 如果不存在则新增 + SysDept dept = new SysDept(); + dept.setParentId(0L); + dept.setDeptName(caseApplication.getName()); + 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()); + caseAffiliate.setName(String.valueOf(dept.getDeptId())); + } } } @@ -582,7 +587,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { BeanUtils.copyBeanProp(caseAffiliate,caseApplication); caseAffiliate.setIdentityType(1); // 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构 - setApplicantOrganization(caseAffiliate,caseApplication,deptList); + if(StrUtil.isNotEmpty(caseApplication.getName())){ + setApplicantOrganization(caseAffiliate, caseApplication, deptList); + } caseAffiliatesnew.add(caseAffiliate); // 组装被申请人信息 @@ -615,6 +622,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { dept.setCreateBy(getUsername()); dept.setUpdateBy(getUsername()); sysDeptMapper.insertDept(dept); + deptMap.put(dept.getDeptName(),dept.getDeptId()); caseAffiliate.setName(String.valueOf(dept.getDeptId())); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java index de484db..1236934 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java @@ -1,5 +1,7 @@ package com.ruoyi.wisdomarbitrate.service.impl; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord; import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper; import com.ruoyi.wisdomarbitrate.service.ICaseLogRecordService; @@ -16,7 +18,43 @@ public class CaseLogRecordServiceImpl implements ICaseLogRecordService { @Override public List selectCaseLogRecordList(CaseLogRecord caseLogRecord) { - return caseLogRecordMapper.selectCaseLogRecordList(caseLogRecord); + List records = caseLogRecordMapper.selectCaseLogRecordList(caseLogRecord); + if(CollectionUtil.isNotEmpty(records)){ + records.forEach(record->{ + StringBuilder contentBuilder = new StringBuilder(); + if(StrUtil.isNotEmpty(record.getNickName())) { + contentBuilder.append(record.getNickName()); + } + contentBuilder.append("于").append(record.getCaseNodeTime()); + switch(record.getCaseNode()){ + case 0: + contentBuilder.append("创建立案申请"); + break; + case 1: + contentBuilder.append("提交立案申请"); + break; + case 2: + contentBuilder.append("提交立案审查"); + break; + case 3: + contentBuilder.append("创建立案申请"); + break; + case 4: + contentBuilder.append("缴费成功"); + case 5: + contentBuilder.append("缴费成功"); + case 6: + contentBuilder.append("缴费成功"); + case 7: + contentBuilder.append("缴费成功"); + case 8: + contentBuilder.append("缴费成功"); + break; + } + + }); + } + return records; } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml index 88d4288..8ec69d1 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml @@ -10,6 +10,8 @@ + + @@ -20,12 +22,17 @@ From 373486d54a9bce6d159052d3ffebd5f6092a7a05 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 10 Oct 2023 19:37:55 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E5=85=B3=E8=81=94=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/CaseApplicationServiceImpl.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index a8bfabb..4866118 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -256,6 +256,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { if(caseApplicationList!=null&&caseApplicationList.size()>0){ // 1,查询所有的组织机构,组装成map List deptList = sysDeptMapper.selectDeptList(new SysDept()); + Map deptMap =new HashMap<>(); + if(CollectionUtil.isNotEmpty(deptList)) { + deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); + } List caseApplicationListinsert = new ArrayList<>(); for (int i = 0; i < caseApplicationList.size(); i++){ CaseApplication caseApplication = caseApplicationList.get(i); @@ -268,7 +272,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //赋值CaseApplication的案件关联人信息 List caseAffiliatesnew = new ArrayList<>(); // 组装案件关联人信息 - assignmentCaseAffiliates(caseApplication,caseAffiliatesnew,deptList); + assignmentCaseAffiliates(caseApplication,caseAffiliatesnew,deptMap); // int caseApplicationCount = selectCaseApplicationCount(caseApplication); // if(caseApplicationCount>0){ @@ -579,7 +583,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { - private void assignmentCaseAffiliates(CaseApplication caseApplication, List caseAffiliatesnew,List deptList) { + private void assignmentCaseAffiliates(CaseApplication caseApplication, List caseAffiliatesnew, Map deptMap) { // 申请人信息 CaseAffiliate caseAffiliate = new CaseAffiliate(); @@ -588,7 +592,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAffiliate.setIdentityType(1); // 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构 if(StrUtil.isNotEmpty(caseApplication.getName())){ - setApplicantOrganization(caseAffiliate, caseApplication, deptList); + setApplicantOrganization(caseAffiliate, caseApplication, deptMap); } caseAffiliatesnew.add(caseAffiliate); @@ -603,10 +607,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { * @param caseApplication */ @DataScope(deptAlias = "d") - private void setApplicantOrganization(CaseAffiliate caseAffiliate, CaseApplication caseApplication, List deptList ) { + private void setApplicantOrganization(CaseAffiliate caseAffiliate, CaseApplication caseApplication, Map deptMap ) { + + - if(CollectionUtil.isNotEmpty(deptList)){ - Map deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); // 将组织机构id设为申请人名称 if(deptMap.containsKey(caseApplication.getName())){ caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName()))); @@ -626,9 +630,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAffiliate.setName(String.valueOf(dept.getDeptId())); } - } - - } From 01fd6157e1bd3d3777c4ebdf66b6bf9de59ed91d Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 10 Oct 2023 20:53:40 +0800 Subject: [PATCH 10/23] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E6=9C=BA=E6=9E=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 6 ++--- .../impl/CaseApplicationServiceImpl.java | 24 +++++++++++++------ .../wisdomarbitrate/CaseApplicationMapper.xml | 12 ++++++---- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 543c4f9..33cd573 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.wisdomarbitrate; +import cn.hutool.core.util.StrUtil; import com.ruoyi.common.annotation.Anonymous; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; @@ -47,10 +48,7 @@ public class CaseApplicationController extends BaseController { @PostMapping("/addCaseApplication") public AjaxResult addCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { - int caseApplicationCount = caseApplicationService.selectCaseApplicationCount(caseApplication); - if(caseApplicationCount>0){ - return error("新增立案申请'" + caseApplication.getCaseNum() + "'案件编号已存在"); - } + caseApplication.setCreateBy(getUsername()); return toAjax(caseApplicationService.insertcaseApplication(caseApplication)); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 4866118..27b9298 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -72,25 +72,24 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List caseAffiliates = caseApplication.getCaseAffiliates(); Map deptMap =new HashMap<>(); if (caseAffiliates != null && caseAffiliates.size() > 0) { - if(StrUtil.isNotEmpty(caseApplication.getName())) { // 查询所有的组织机构,组装成map List deptList = sysDeptMapper.selectDeptList(new SysDept()); if (CollectionUtil.isEmpty(deptList)) { deptList = new ArrayList<>(); } - deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); - } + deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV)); + for (CaseAffiliate caseAffiliate : caseAffiliates) { caseAffiliate.setCaseAppliId(caseApplication.getId()); - if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseApplication.getName())) { + if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) { // 将组织机构id设为申请人名称 if (deptMap.containsKey(caseApplication.getName())) { - caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName()))); + caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName()))); } else { // 如果不存在则新增 SysDept dept = new SysDept(); dept.setParentId(0L); - dept.setDeptName(caseApplication.getName()); + dept.setDeptName(caseAffiliate.getName()); dept.setAncestors("0"); dept.setOrderNum(1); dept.setStatus("0"); @@ -227,12 +226,23 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); if(caseAffiliatListeselect!=null){ + // 查询组织机构 + List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); + Map deptMap=new HashMap<>(); + if(CollectionUtil.isNotEmpty(sysDepts)){ + for (SysDept sysDept : sysDepts) { + deptMap.put(String.valueOf(sysDept.getDeptId()),sysDept.getDeptName()); + } + } StringBuffer applicantName = new StringBuffer(); StringBuffer respondentName = new StringBuffer(); for (int i = 0; i < caseAffiliatListeselect.size(); i++){ CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i); int identityType = caseAffiliateselect.getIdentityType(); if(identityType==1){ + if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){ + caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName())); + } applicantName.append(caseAffiliateselect.getName()).append(",");; }else if(identityType==2){ respondentName.append(caseAffiliateselect.getName()).append(",");; @@ -258,7 +268,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List deptList = sysDeptMapper.selectDeptList(new SysDept()); Map deptMap =new HashMap<>(); if(CollectionUtil.isNotEmpty(deptList)) { - deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId)); + deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV)); } List caseApplicationListinsert = new ArrayList<>(); for (int i = 0; i < caseApplicationList.size(); i++){ diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index 0e8219b..6048e88 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -55,10 +55,10 @@ c.hear_date ,c.arbitrat_claims , c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable , c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time , - c.update_by ,c.update_time , c.arbitrator_name,d.dept_name as name + c.update_by ,c.update_time , c.arbitrator_name,d.dept_name as applicantName from case_application c LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 - LEFT JOIN sys_dept d ON ca.NAME = d.dept_id + LEFT JOIN sys_dept d ON ca.NAME = d.dept_id and ca.name=d.dept_id AND c.case_status = #{caseStatus} @@ -206,8 +206,10 @@ c.hear_date ,c.arbitrat_claims , c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable , c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time , - c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name + c.update_by ,c.update_time,c.arbitrator_id,c.arbitrator_name,d.dept_name as applicantName from case_application c + LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 + LEFT JOIN sys_dept d ON ca.NAME = d.dept_id and ca.name=d.dept_id AND c.id = #{id} @@ -236,8 +238,10 @@ p.payment_status , CASE p.payment_status when 1 then '已支付' when 0 then '未支付' ELSE '无支付状态' - END paymentStatusName + END paymentStatusName,d.dept_name as applicantName from case_application c left join case_payment_record p on c.id = p.case_id + LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 + LEFT JOIN sys_dept d ON ca.NAME = d.dept_id and ca.name=d.dept_id where c.case_status = 3 and p.payment_status = 1 AND c.id = #{id} From a7b7ea826fcfd937467bf24b2ee8d097201308d1 Mon Sep 17 00:00:00 2001 From: gy b Date: Tue, 10 Oct 2023 21:25:29 +0800 Subject: [PATCH 11/23] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdjudicationController.java | 10 +-- .../wisdomarbitrate/ArbitratorController.java | 2 +- .../CaseApplicationController.java | 73 ++++++++----------- .../CaseArbitrateController.java | 4 +- .../CaseEvidenceController.java | 2 +- .../CasePaymentController.java | 4 +- 6 files changed, 40 insertions(+), 55 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java index af62cdf..3096efe 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java @@ -22,7 +22,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/document") - @PreAuthorize("@ss.hasPermi('caseManagement:createaward')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:createaward')") public AjaxResult createDocument(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.createDocument(caseApplication); } @@ -54,7 +54,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/signature") - @PreAuthorize("@ss.hasPermi('awardManagement:sign')") + @PreAuthorize("@ss.hasPermi('awardManagement:list:sign')") public AjaxResult signature(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.signature(caseApplication); } @@ -65,7 +65,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/caseFile") - @PreAuthorize("@ss.hasPermi('awardManagement:file')") + @PreAuthorize("@ss.hasPermi('awardManagement:list:file')") public AjaxResult caseFile(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.caseFile(caseApplication); } @@ -76,7 +76,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/service") - @PreAuthorize("@ss.hasPermi('awardManagement:sendaward')") + @PreAuthorize("@ss.hasPermi('awardManagement:list:sendaward')") public AjaxResult service(@RequestBody BookSendVO bookSendVO){ return adjudicationService.service(bookSendVO.getId(),bookSendVO.getAppEmail(),bookSendVO.getResEmail(),bookSendVO.getApptrackingNum(),bookSendVO.getRestrackingNum()); } @@ -86,7 +86,7 @@ public class AdjudicationController extends BaseController { * @return */ @PostMapping("/stamp") - @PreAuthorize("@ss.hasPermi('awardManagement:signprint')") + @PreAuthorize("@ss.hasPermi('awardManagement:list:signprint')") public AjaxResult stamp(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.stamp(caseApplication); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitratorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitratorController.java index 8b9f249..b87089a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitratorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitratorController.java @@ -21,7 +21,7 @@ public class ArbitratorController extends BaseController { /** * 查询仲裁员信息 */ - @PreAuthorize("@ss.hasPermi('arbitrator:list')") +// @PreAuthorize("@ss.hasPermi('arbitrator:list')") @GetMapping("/list") public TableDataInfo list(Arbitrator arbitrator) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 543c4f9..e3e0c4c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; @@ -15,14 +16,14 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import com.ruoyi.common.utils.poi.ExcelUtil; import org.springframework.web.multipart.MultipartFile; + import javax.servlet.http.HttpServletResponse; import java.util.List; - @RestController @RequestMapping("/caseApplication") -public class CaseApplicationController extends BaseController { +public class CaseApplicationController extends BaseController { @Autowired private ICaseApplicationService caseApplicationService; @@ -32,8 +33,7 @@ public class CaseApplicationController extends BaseController { */ @PreAuthorize("@ss.hasPermi('caseManagement:list')") @GetMapping("/list") - public TableDataInfo list(CaseApplication caseApplication) - { + public TableDataInfo list(CaseApplication caseApplication) { startPage(); List list = caseApplicationService.selectCaseApplicationList(caseApplication); return getDataTable(list); @@ -42,7 +42,7 @@ public class CaseApplicationController extends BaseController { /** * 新增立案数据 */ - @PreAuthorize("@ss.hasPermi('caseManagement:add')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:add')") @Log(title = "新增立案数据", businessType = BusinessType.INSERT) @PostMapping("/addCaseApplication") public AjaxResult addCaseApplication(@Validated @RequestBody CaseApplication caseApplication) @@ -58,11 +58,10 @@ public class CaseApplicationController extends BaseController { /** * 修改立案数据 */ - @PreAuthorize("@ss.hasPermi('caseManagement:update')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:update')") @Log(title = "修改立案数据", businessType = BusinessType.UPDATE) @PostMapping("/editCaseApplication") - public AjaxResult editCaseApplication(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult editCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { caseApplication.setUpdateBy(getUsername()); return toAjax(caseApplicationService.editCaseApplication(caseApplication)); @@ -71,11 +70,10 @@ public class CaseApplicationController extends BaseController { /** * 提交立案申请 */ - @PreAuthorize("@ss.hasPermi('caseManagement:submit')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:submit')") @Log(title = "提交立案申请", businessType = BusinessType.UPDATE) @PostMapping("/submitCaseApplication") - public AjaxResult submitCaseApplication(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult submitCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { return toAjax(caseApplicationService.submitCaseApplication(caseApplication)); } @@ -83,11 +81,10 @@ public class CaseApplicationController extends BaseController { /** * 删除立案数据 */ - @PreAuthorize("@ss.hasPermi('caseManagement:delete')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:delete')") @Log(title = "删除立案数据", businessType = BusinessType.DELETE) @PostMapping("/removeCaseApplication") - public AjaxResult removeCaseApplication(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult removeCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { return toAjax(caseApplicationService.deletecaseApplicationByIds(caseApplication)); } @@ -95,10 +92,9 @@ public class CaseApplicationController extends BaseController { /** * 查询立案信息 */ - @PreAuthorize("@ss.hasPermi('caseManagement:detail')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:detail')") @PostMapping("/selectCaseApplication") - public AjaxResult selectCaseApplication(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult selectCaseApplication(@Validated @RequestBody CaseApplication caseApplication) { CaseApplication caseApplicationselect = caseApplicationService.selectCaseApplication(caseApplication); return success(caseApplicationselect); } @@ -107,20 +103,19 @@ public class CaseApplicationController extends BaseController { * 立案申请导入模板下载 */ @PostMapping("/importTemplate") - public void importTemplate(HttpServletResponse response) - { + public void importTemplate(HttpServletResponse response) { ExcelUtil util = new ExcelUtil(CaseApplication.class); util.importTemplateExcel(response, "立案申请数据"); } @Log(title = "立案信息导入", businessType = BusinessType.IMPORT) - @PreAuthorize("@ss.hasPermi('caseManagement:import')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:import')") @PostMapping("/importData") public AjaxResult importData(MultipartFile file) throws Exception { ExcelUtil util = new ExcelUtil(CaseApplication.class); List caseApplicationList = util.importExcel(file.getInputStream()); String operName = getUsername(); - String message = caseApplicationService.importCaseApplication(caseApplicationList,operName); + String message = caseApplicationService.importCaseApplication(caseApplicationList, operName); return success(message); } @@ -130,30 +125,27 @@ public class CaseApplicationController extends BaseController { @PreAuthorize("@ss.hasPermi('caseApplication:pendTral')") @Log(title = "组庭", businessType = BusinessType.UPDATE) @PostMapping("/pendTral") - public AjaxResult pendTral(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult pendTral(@Validated @RequestBody CaseApplication caseApplication) { return toAjax(caseApplicationService.pendTral(caseApplication)); } /** * 组庭审核 */ - @PreAuthorize("@ss.hasPermi('caseManagement:checkgroup')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:checkgroup')") @Log(title = "组庭审核", businessType = BusinessType.UPDATE) @PostMapping("/pendTralCheck") - public AjaxResult pendTralCheck(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult pendTralCheck(@Validated @RequestBody CaseApplication caseApplication) { return toAjax(caseApplicationService.pendTralCheck(caseApplication)); } /** * 组庭确认 */ - @PreAuthorize("@ss.hasPermi('caseManagement:confirmgroup')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:confirmgroup')") @Log(title = "组庭确认", businessType = BusinessType.UPDATE) @PostMapping("/pendTralSure") - public AjaxResult pendTralSure(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult pendTralSure(@Validated @RequestBody CaseApplication caseApplication) { return toAjax(caseApplicationService.pendTralSure(caseApplication)); } @@ -163,8 +155,7 @@ public class CaseApplicationController extends BaseController { @PreAuthorize("@ss.hasPermi('caseApplication:verificationArbitrateRecord')") @Log(title = "核验裁决书", businessType = BusinessType.UPDATE) @PostMapping("/verificationArbitrateRecord") - public AjaxResult verificationArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult verificationArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) { return toAjax(caseApplicationService.verificationArbitrateRecord(caseApplication)); } @@ -174,32 +165,28 @@ public class CaseApplicationController extends BaseController { @PreAuthorize("@ss.hasPermi('caseApplication:checkArbitrateRecord')") @Log(title = "审核裁决书", businessType = BusinessType.UPDATE) @PostMapping("/checkArbitrateRecord") - public AjaxResult checkArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult checkArbitrateRecord(@Validated @RequestBody CaseApplication caseApplication) { return toAjax(caseApplicationService.checkArbitrateRecord(caseApplication)); } - /** * 是否指派仲裁员 */ @PreAuthorize("@ss.hasPermi('caseApplication:pendingAppointArbotrar')") @Log(title = "是否指派仲裁员", businessType = BusinessType.UPDATE) @PostMapping("/pendingAppointArbotrar") - public AjaxResult pendingAppointArbotrar(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult pendingAppointArbotrar(@Validated @RequestBody CaseApplication caseApplication) { return toAjax(caseApplicationService.pendingAppointArbotrar(caseApplication)); } /** * 提交立案审查 */ - @PreAuthorize("@ss.hasPermi('caseManagement:check')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:check')") @Log(title = "提交立案审查", businessType = BusinessType.UPDATE) @PostMapping("/submitCaseApplicationCheck") - public AjaxResult submitCaseApplicationCheck(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult submitCaseApplicationCheck(@Validated @RequestBody CaseApplication caseApplication) { return toAjax(caseApplicationService.submitCaseApplicationCheck(caseApplication)); } @@ -207,22 +194,20 @@ public class CaseApplicationController extends BaseController { /** * 确认缴费查询立案信息 */ + @PreAuthorize("@ss.hasPermi('paymentManagement:list:detail')") @PostMapping("/selectCaseApplicationConfirm") - public AjaxResult selectCaseApplicationConfirm(@Validated @RequestBody CaseApplication caseApplication) - { + public AjaxResult selectCaseApplicationConfirm(@Validated @RequestBody CaseApplication caseApplication) { CaseApplication caseApplicationselect = caseApplicationService.selectCaseApplicationConfirm(caseApplication); return success(caseApplicationselect); } - /** * 发送房间号短信 */ @Anonymous @PostMapping("/sendRoomNoMessage") - public AjaxResult sendRoomNoMessage(@Validated @RequestBody SendRoomNoMessageVO messageVO) - { + public AjaxResult sendRoomNoMessage(@Validated @RequestBody SendRoomNoMessageVO messageVO) { String result = caseApplicationService.sendRoomNoMessage(messageVO); return success(result); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java index 440bdad..20c5b17 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseArbitrateController.java @@ -23,7 +23,7 @@ public class CaseArbitrateController extends BaseController { * @return */ @PutMapping("/method") - @PreAuthorize("@ss.hasPermi('caseManagement:checkarbitrationway')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:checkarbitrationway')") public AjaxResult examineArbitrateMethod(@Validated @RequestBody CaseApplication caseApplication ,Integer opinion){ return caseArbitrateService.examineArbitrateMethod(caseApplication,opinion); @@ -35,7 +35,7 @@ public class CaseArbitrateController extends BaseController { * @return */ @PostMapping("/writtenHear") - @PreAuthorize("@ss.hasPermi('caseManagement:offlinehear')") + @PreAuthorize("@ss.hasPermi('caseManagement:hear')") public AjaxResult writtenHear(@Validated @RequestBody ArbitrateRecord arbitrateRecord){ return caseArbitrateService.writtenHear(arbitrateRecord); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java index 49f30ee..50527dc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java @@ -36,7 +36,7 @@ public class CaseEvidenceController extends BaseController { * @return */ @GetMapping("/{id}") - @PreAuthorize("@ss.hasPermi('caseManagement:detail')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:detail')") public AjaxResult getCaseDetailsById(@PathVariable Long id) { String username = this.getUsername(); return caseEvidenceService.getCaseDetailsById(id,username); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java index 9bd76f7..5f13ee7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CasePaymentController.java @@ -25,7 +25,7 @@ public class CasePaymentController { * @param casePayDTO 缴费传入参数 * @return 统一响应结果 */ - @PreAuthorize("@ss.hasPermi('caseManagement:pay')") + @PreAuthorize("@ss.hasPermi('caseManagement:list:pay')") @PostMapping("/casePay") public AjaxResult casePay(@Validated @RequestBody CasePayDTO casePayDTO) { return paymentService.casePay(casePayDTO); @@ -36,7 +36,7 @@ public class CasePaymentController { * @param caseApplication * @return */ - @PreAuthorize("@ss.hasPermi('paymentManagement:payconfirm')") + @PreAuthorize("@ss.hasPermi('paymentManagement:list:payconfirm')") @PutMapping("/confirm") public AjaxResult confirmPayment(@Validated @RequestBody CaseApplication caseApplication) { return paymentService.confirmPayment(caseApplication); From fd4a156e25382c1cdd9045d3ab633e1c7bda0c12 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Tue, 10 Oct 2023 22:41:40 +0800 Subject: [PATCH 12/23] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=B3=A8=E8=A7=A3?= =?UTF-8?q?=E7=AE=80=E5=8D=95=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 1 + .../com/ruoyi/common/annotation/CaseLog.java | 34 ++++++++ .../framework/aspectj/CaseLogAspect.java | 87 +++++++++++++++++++ .../impl/CaseApplicationServiceImpl.java | 56 +++++++++++- .../impl/CaseLogRecordServiceImpl.java | 43 +++++++-- .../wisdomarbitrate/CaseApplicationMapper.xml | 4 +- 6 files changed, 213 insertions(+), 12 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/annotation/CaseLog.java create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/CaseLogAspect.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index 33cd573..7412d73 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.wisdomarbitrate; import cn.hutool.core.util.StrUtil; import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.annotation.CaseLog; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/CaseLog.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/CaseLog.java new file mode 100644 index 0000000..4c26db1 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/CaseLog.java @@ -0,0 +1,34 @@ +package com.ruoyi.common.annotation; + + +import java.lang.annotation.*; + +/** + * 案件操作日志记录注解 + * + * @author wangqiong + * + */ +@Target({ ElementType.PARAMETER, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface CaseLog +{ + /** + * 案件申请人id + */ + public long caseAppliId() default 0L; + + /** + * 案件节点 + */ + public String caseNode() default ""; + + + /** + * 备注 + */ + public String notes() default ""; + + +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/CaseLogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/CaseLogAspect.java new file mode 100644 index 0000000..40d724b --- /dev/null +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/CaseLogAspect.java @@ -0,0 +1,87 @@ +package com.ruoyi.framework.aspectj; + + +import com.ruoyi.common.annotation.CaseLog; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord; +import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 案件操作日志记录处理 + * + * @author wangqiong + */ +@Aspect +@Component +public class CaseLogAspect { + @Autowired + private CaseLogRecordMapper logRecordMapper; + private static final Logger log = LoggerFactory.getLogger(CaseLogAspect.class); + + + /** + * 处理请求前执行 + */ + @Before(value = "@annotation(controllerLog)") + public void boBefore(JoinPoint joinPoint, CaseLog controllerLog) { + } + + /** + * 处理完请求后执行 + * + * @param joinPoint 切点 + */ + @AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult") + public void doAfterReturning(JoinPoint joinPoint, CaseLog controllerLog, Object jsonResult) { + handleLog(joinPoint, controllerLog, null, jsonResult); + } + + protected void handleLog(final JoinPoint joinPoint, CaseLog controllerLog, final Exception e, Object jsonResult) { + try { + // 获取当前的用户 + LoginUser loginUser = SecurityUtils.getLoginUser(); + String nickName = loginUser.getUser().getNickName(); + + // *========数据库日志=========*// + CaseLogRecord operLog = new CaseLogRecord(); + operLog.setCreateBy(nickName); + operLog.setUpdateBy(nickName); + // 处理设置注解上的参数 + getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult); + + // 保存数据库 + logRecordMapper.insertCaseLogRecord(operLog); + } catch (Exception exp) { + // 记录本地异常日志 + log.error("异常信息:{}", exp.getMessage()); + exp.printStackTrace(); + } + } + + /** + * 获取注解中对方法的描述信息 用于Controller层注解 + * + * @param log 日志 + * @param operLog 操作日志 + * @throws Exception + */ + public void getControllerMethodDescription(JoinPoint joinPoint, CaseLog log, CaseLogRecord operLog, Object jsonResult) throws Exception { + // 设置案件id + operLog.setCaseAppliId(log.caseAppliId()); + // 设置案件节点 + operLog.setNotes(log.caseNode()); + // 设置备注 + operLog.setNotes(log.notes()); + + } + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 27b9298..9211603 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; +import com.ruoyi.common.annotation.CaseLog; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.entity.SysDept; @@ -113,9 +114,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAttach.setCaseAppliId(caseApplication.getId()); caseAttachMapper.updateCaseAttach(caseAttach); } - } - return rows; } @@ -156,10 +155,38 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { int rows = caseApplicationMapper.updataCaseApplication(caseApplication); List caseAffiliates = caseApplication.getCaseAffiliates(); if(caseAffiliates!=null&&caseAffiliates.size()>0){ + // 查询所有的组织机构,组装成map + List deptList = sysDeptMapper.selectDeptList(new SysDept()); + if (CollectionUtil.isEmpty(deptList)) { + deptList = new ArrayList<>(); + } + Map deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId,(oldV,newV)->newV)); for (CaseAffiliate caseAffiliate : caseAffiliates){ caseAffiliate.setCaseAppliId(caseApplication.getId()); + if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) { + // 将组织机构id设为申请人名称 + if (deptMap.containsKey(caseApplication.getName())) { + caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName()))); + } else { + // 如果不存在则新增 + SysDept dept = new SysDept(); + dept.setParentId(0L); + dept.setDeptName(caseAffiliate.getName()); + 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()); + caseAffiliate.setName(String.valueOf(dept.getDeptId())); + + } + } caseAffiliateMapper.updataCaseAffiliate(caseAffiliate); } + } List caseAttachList = caseApplication.getCaseAttachList(); if(caseAttachList!=null&&caseAttachList.size()>0){ @@ -458,11 +485,22 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAffiliate.setCaseAppliId(caseApplication.getId()); List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); if(caseAffiliatListeselect!=null){ + // 查询组织机构 + List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); + Map deptMap=new HashMap<>(); + if(CollectionUtil.isNotEmpty(sysDepts)){ + for (SysDept sysDept : sysDepts) { + deptMap.put(String.valueOf(sysDept.getDeptId()),sysDept.getDeptName()); + } + } StringBuffer applicantName = new StringBuffer(); for (int i = 0; i < caseAffiliatListeselect.size(); i++){ CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i); int identityType = caseAffiliateselect.getIdentityType(); if(identityType==1){ + if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){ + caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName())); + } applicantName.append(caseAffiliateselect.getName()).append(",");; } } @@ -543,9 +581,23 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAffiliate.setCaseAppliId(caseApplication.getId()); List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); if(caseAffiliatListeselect!=null) { + // 查询组织机构 + List sysDepts = sysDeptMapper.selectDeptList(new SysDept()); + Map deptMap=new HashMap<>(); + if(CollectionUtil.isNotEmpty(sysDepts)){ + for (SysDept sysDept : sysDepts) { + deptMap.put(String.valueOf(sysDept.getDeptId()),sysDept.getDeptName()); + } + } for (int j = 0; j < caseAffiliatListeselect.size(); j++) { CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(j); int identityType = caseAffiliateselect.getIdentityType(); + if(identityType==1){ + if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){ + caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName())); + } + caseAffiliateselect.setName(caseAffiliateselect.getName());; + } //给申请人、被申请人发送短信通知 request.setPhone(caseAffiliateselect.getContactTelphone()); // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java index 1236934..c8c685c 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java @@ -34,21 +34,50 @@ public class CaseLogRecordServiceImpl implements ICaseLogRecordService { contentBuilder.append("提交立案申请"); break; case 2: - contentBuilder.append("提交立案审查"); + contentBuilder.append("同意立案申请"); break; case 3: - contentBuilder.append("创建立案申请"); + contentBuilder.append("缴费成功"); break; case 4: - contentBuilder.append("缴费成功"); + contentBuilder.append("已确认缴费"); case 5: - contentBuilder.append("缴费成功"); + contentBuilder.append("进行案件质证"); case 6: - contentBuilder.append("缴费成功"); + contentBuilder.append("同意组庭审核"); case 7: - contentBuilder.append("缴费成功"); + contentBuilder.append("组庭确认成功"); case 8: - contentBuilder.append("缴费成功"); + contentBuilder.append("同意待开庭审理"); + case 9: + contentBuilder.append("同意书面审理"); + break; + case 10: + contentBuilder.append("已完成书面审理"); + break; + case 11: + contentBuilder.append("已生成仲裁文书"); + break; + case 12: + contentBuilder.append("已核查仲裁文书"); + break; + case 13: + contentBuilder.append("已同意仲裁文书"); + break; + case 14: + contentBuilder.append("已完成仲裁文书签名"); + break; + case 15: + contentBuilder.append("已完成仲裁文书用印"); + break; + case 16: + contentBuilder.append("已送达仲裁文书"); + break; + case 17: + contentBuilder.append("已完成案件归档"); + break; + case 26: + contentBuilder.append("已完成证据确认"); break; } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index 6048e88..fcc83e4 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -238,10 +238,8 @@ p.payment_status , CASE p.payment_status when 1 then '已支付' when 0 then '未支付' ELSE '无支付状态' - END paymentStatusName,d.dept_name as applicantName + END paymentStatusName from case_application c left join case_payment_record p on c.id = p.case_id - LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1 - LEFT JOIN sys_dept d ON ca.NAME = d.dept_id and ca.name=d.dept_id where c.case_status = 3 and p.payment_status = 1 AND c.id = #{id} From e09da313e024eb962d4da8c78a389b490746aa8f Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Wed, 11 Oct 2023 11:31:35 +0800 Subject: [PATCH 13/23] =?UTF-8?q?=E6=A1=88=E4=BB=B6=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 3 - .../com/ruoyi/common/annotation/CaseLog.java | 34 -------- .../framework/aspectj/CaseLogAspect.java | 87 ------------------- .../domain/CaseApplication.java | 12 +++ .../wisdomarbitrate/domain/CaseLogRecord.java | 12 +-- .../service/impl/AdjudicationServiceImpl.java | 16 +++- .../impl/CaseApplicationServiceImpl.java | 20 ++++- .../impl/CaseArbitrateServiceImpl.java | 22 +++++ .../service/impl/CaseEvidenceServiceImpl.java | 16 ++-- .../impl/CaseLogRecordServiceImpl.java | 52 ++++++----- .../service/impl/CasePaymentServiceImpl.java | 5 +- .../wisdomarbitrate/utils/CaseLogUtils.java | 42 +++++++++ .../wisdomarbitrate/CaseApplicationMapper.xml | 2 +- .../wisdomarbitrate/CaseLogRecordMapper.xml | 52 ++++------- 14 files changed, 173 insertions(+), 202 deletions(-) delete mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/annotation/CaseLog.java delete mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/CaseLogAspect.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CaseLogUtils.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index e932361..fa501cb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -1,14 +1,11 @@ package com.ruoyi.web.controller.wisdomarbitrate; -import cn.hutool.core.util.StrUtil; import com.ruoyi.common.annotation.Anonymous; -import com.ruoyi.common.annotation.CaseLog; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/CaseLog.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/CaseLog.java deleted file mode 100644 index 4c26db1..0000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/CaseLog.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ruoyi.common.annotation; - - -import java.lang.annotation.*; - -/** - * 案件操作日志记录注解 - * - * @author wangqiong - * - */ -@Target({ ElementType.PARAMETER, ElementType.METHOD }) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface CaseLog -{ - /** - * 案件申请人id - */ - public long caseAppliId() default 0L; - - /** - * 案件节点 - */ - public String caseNode() default ""; - - - /** - * 备注 - */ - public String notes() default ""; - - -} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/CaseLogAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/CaseLogAspect.java deleted file mode 100644 index 40d724b..0000000 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/CaseLogAspect.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.ruoyi.framework.aspectj; - - -import com.ruoyi.common.annotation.CaseLog; -import com.ruoyi.common.core.domain.model.LoginUser; -import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord; -import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper; -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.annotation.AfterReturning; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Before; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 案件操作日志记录处理 - * - * @author wangqiong - */ -@Aspect -@Component -public class CaseLogAspect { - @Autowired - private CaseLogRecordMapper logRecordMapper; - private static final Logger log = LoggerFactory.getLogger(CaseLogAspect.class); - - - /** - * 处理请求前执行 - */ - @Before(value = "@annotation(controllerLog)") - public void boBefore(JoinPoint joinPoint, CaseLog controllerLog) { - } - - /** - * 处理完请求后执行 - * - * @param joinPoint 切点 - */ - @AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult") - public void doAfterReturning(JoinPoint joinPoint, CaseLog controllerLog, Object jsonResult) { - handleLog(joinPoint, controllerLog, null, jsonResult); - } - - protected void handleLog(final JoinPoint joinPoint, CaseLog controllerLog, final Exception e, Object jsonResult) { - try { - // 获取当前的用户 - LoginUser loginUser = SecurityUtils.getLoginUser(); - String nickName = loginUser.getUser().getNickName(); - - // *========数据库日志=========*// - CaseLogRecord operLog = new CaseLogRecord(); - operLog.setCreateBy(nickName); - operLog.setUpdateBy(nickName); - // 处理设置注解上的参数 - getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult); - - // 保存数据库 - logRecordMapper.insertCaseLogRecord(operLog); - } catch (Exception exp) { - // 记录本地异常日志 - log.error("异常信息:{}", exp.getMessage()); - exp.printStackTrace(); - } - } - - /** - * 获取注解中对方法的描述信息 用于Controller层注解 - * - * @param log 日志 - * @param operLog 操作日志 - * @throws Exception - */ - public void getControllerMethodDescription(JoinPoint joinPoint, CaseLog log, CaseLogRecord operLog, Object jsonResult) throws Exception { - // 设置案件id - operLog.setCaseAppliId(log.caseAppliId()); - // 设置案件节点 - operLog.setNotes(log.caseNode()); - // 设置备注 - operLog.setNotes(log.notes()); - - } - -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java index 2703ad5..2a5dbc5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java @@ -334,6 +334,10 @@ public class CaseApplication extends BaseEntity { /** 姓名 */ @Excel(name = "申请人主体信息-申请人(机构)",width = 26) private String name; + /** + * 申请人主体信息-申请人(机构)id + */ + private String nameId; /** 身份证号 */ @Excel(name = "申请人主体信息-代码",width = 26) private String identityNum; @@ -415,6 +419,14 @@ public class CaseApplication extends BaseEntity { this.name = name; } + public String getNameId() { + return nameId; + } + + public void setNameId(String nameId) { + this.nameId = nameId; + } + public String getIdentityNum() { return identityNum; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java index bd5f9ca..7a2c680 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseLogRecord.java @@ -32,7 +32,7 @@ public class CaseLogRecord extends BaseEntity { /** * 用户昵称 */ - private String nickName; + private String createNickName; public String getCaseNum() { @@ -59,7 +59,7 @@ public class CaseLogRecord extends BaseEntity { this.caseAppliId = caseAppliId; } - public int getCaseNode() { + public Integer getCaseNode() { return caseNode; } @@ -95,11 +95,11 @@ public class CaseLogRecord extends BaseEntity { this.content = content; } - public String getNickName() { - return nickName; + public String getCreateNickName() { + return createNickName; } - public void setNickName(String nickName) { - this.nickName = nickName; + public void setCreateNickName(String nickName) { + this.createNickName = nickName; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java index e4e8fff..691cdaf 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java @@ -2,9 +2,9 @@ package com.ruoyi.wisdomarbitrate.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; -import com.deepoove.poi.config.Configure; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.common.utils.EmailOutUtil; import com.ruoyi.common.utils.WordUtil; import com.ruoyi.wisdomarbitrate.domain.*; @@ -16,7 +16,6 @@ import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import lombok.extern.slf4j.Slf4j; -import org.apache.poi.xwpf.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.MailSendException; import org.springframework.mail.javamail.JavaMailSender; @@ -32,7 +31,6 @@ import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.time.LocalDate; import java.time.ZoneId; -import java.time.format.DateTimeFormatter; import java.util.*; @Service @@ -310,6 +308,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { //更改案件状态(暂时) caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATED_SEAL); caseApplicationMapper.submitCaseApplication(caseApplication); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.ARBITRATED_SEAL,""); + return AjaxResult.success("签名成功,案件状态已改为待仲裁文书用印"); } @@ -318,6 +319,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { //更改案件状态(暂时) caseApplication.setCaseStatus(CaseApplicationConstants.CASE_ARCHIVED); caseApplicationMapper.submitCaseApplication(caseApplication); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CASE_ARCHIVED,""); + return AjaxResult.success("归档成功,案件状态已改为已归档"); } @@ -349,6 +353,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } } + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CASE_FILING,""); + return AjaxResult.success("仲裁文书送达成功"); } @@ -357,6 +364,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService { //更改案件状态(暂时) caseApplication.setCaseStatus(CaseApplicationConstants.ARBITRATION_DELIVERY); caseApplicationMapper.submitCaseApplication(caseApplication); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.ARBITRATION_DELIVERY,""); + return AjaxResult.success("用印成功,案件状态已改为待仲裁文书送达"); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 9211603..b4e0882 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -3,11 +3,12 @@ package com.ruoyi.wisdomarbitrate.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; -import com.ruoyi.common.annotation.CaseLog; + import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.common.utils.StringUtils; @@ -115,6 +116,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAttachMapper.updateCaseAttach(caseAttach); } } + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CASE_APPLICATION,""); return rows; } @@ -206,6 +209,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //提交立案申请 caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CHECK); int rows = caseApplicationMapper.submitCaseApplication(caseApplication); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CASE_CHECK,""); return rows; } @@ -429,7 +434,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { rows = caseApplicationMapper.submitCaseApplication(caseApplication); } } - + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL,""); return rows; } @@ -440,6 +446,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { int rows = caseApplicationMapper.submitCaseApplication(caseApplication); ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord(); arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CHECK_ARBITRATION,""); return rows; } @@ -453,9 +461,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck(); if(agreeOrNotCheck.intValue()==1){//同意审核 caseApplication.setCaseStatus(CaseApplicationConstants.SIGN_ARBITRATION); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.SIGN_ARBITRATION,""); + rows = caseApplicationMapper.submitCaseApplication(caseApplication); }else if(agreeOrNotCheck.intValue()==2){//拒绝审核 caseApplication.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.VERPRIF_ARBITRATION,""); + rows = caseApplicationMapper.submitCaseApplication(caseApplication); } @@ -606,6 +620,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { SmsUtils.sendSms(request); } } + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CHECK_ARBITRATION_METHOD,""); return rows; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java index f480e65..ee57a80 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseArbitrateServiceImpl.java @@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.service.impl; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.wisdomarbitrate.domain.ArbitrateRecord; import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate; @@ -44,18 +45,30 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { caseApplication1.setArbitratMethod(1); // 更改仲裁方式 //修改案件状态为待开庭审理 caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.PENDING_OPENCOURT_HEAR,""); + }else { caseApplication1.setArbitratMethod(2); //修改案件状态为待书面审理 caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.PENDING_WRIITEN_HEAR,""); + } }else { if (arbitratMethod == 2){ //修改案件状态为待书面审理 caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_WRIITEN_HEAR); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.PENDING_WRIITEN_HEAR,""); + }else { //修改案件状态为待开庭审理 caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_OPENCOURT_HEAR); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.PENDING_OPENCOURT_HEAR,""); + } } int i = caseApplicationMapper.submitCaseApplication(caseApplication1); @@ -87,6 +100,9 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { } } } + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.PENDING_OPENCOURT_HEAR,""); + return AjaxResult.success("审核成功"); } return AjaxResult.error(); @@ -118,6 +134,9 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { //修改案件状态 caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION); caseApplicationMapper.submitCaseApplication(caseApplication); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,""); + return AjaxResult.success("提交成功"); } }else { @@ -136,6 +155,9 @@ public class CaseArbitrateServiceImpl implements ICaseArbitrateService { //修改案件状态 caseApplication.setCaseStatus(CaseApplicationConstants.GENERATED_ARBITRATION); caseApplicationMapper.submitCaseApplication(caseApplication); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.GENERATED_ARBITRATION,""); + return AjaxResult.success("提交成功"); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java index 546993c..70f462b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service.impl; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.AjaxResult; +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; @@ -130,6 +131,9 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { 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("暂无需要确认的证据"); @@ -165,15 +169,9 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { } int i = caseApplicationMapper.submitCaseApplication(caseApplication1); if (i > 0) { - //案件日志表里添加数据 - CaseLogRecord caseLogRecord = new CaseLogRecord(); - caseLogRecord.setCaseAppliId(caseApplication1.getId()); - caseLogRecord.setCaseNode(caseStatus); - String createBy = caseApplication1.getCreateBy(); - if (createBy != null) { - caseLogRecord.setCreateBy(createBy); - } - caseLogRecordMapper.insertCaseLogRecord(caseLogRecord); + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL_SUBMMIT,""); + return AjaxResult.success("提交成功"); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java index c8c685c..c2848d9 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.wisdomarbitrate.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord; import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper; @@ -22,10 +24,12 @@ public class CaseLogRecordServiceImpl implements ICaseLogRecordService { if(CollectionUtil.isNotEmpty(records)){ records.forEach(record->{ StringBuilder contentBuilder = new StringBuilder(); - if(StrUtil.isNotEmpty(record.getNickName())) { - contentBuilder.append(record.getNickName()); + String caseNodeTime=""; + if(record.getCaseNodeTime()!=null){ + caseNodeTime= DateUtil.format(record.getCaseNodeTime(), DatePattern.NORM_DATETIME_FORMATTER); } - contentBuilder.append("于").append(record.getCaseNodeTime()); + + contentBuilder.append(record.getCreateNickName()).append("(").append(record.getCreateBy()).append(")").append("于").append(caseNodeTime); switch(record.getCaseNode()){ case 0: contentBuilder.append("创建立案申请"); @@ -34,53 +38,61 @@ public class CaseLogRecordServiceImpl implements ICaseLogRecordService { contentBuilder.append("提交立案申请"); break; case 2: - contentBuilder.append("同意立案申请"); + contentBuilder.append("提交立案审查"); break; case 3: - contentBuilder.append("缴费成功"); + contentBuilder.append("支付成功"); break; case 4: - contentBuilder.append("已确认缴费"); + contentBuilder.append("缴费确认"); + break; case 5: - contentBuilder.append("进行案件质证"); + contentBuilder.append("案件质证"); + break; case 6: - contentBuilder.append("同意组庭审核"); + contentBuilder.append("组庭审核"); + break; case 7: - contentBuilder.append("组庭确认成功"); + contentBuilder.append("组庭确认"); + break; case 8: - contentBuilder.append("同意待开庭审理"); + contentBuilder.append("待开庭审理"); + break; case 9: - contentBuilder.append("同意书面审理"); + contentBuilder.append("待书面审理"); break; case 10: - contentBuilder.append("已完成书面审理"); + contentBuilder.append("书面审理"); break; case 11: - contentBuilder.append("已生成仲裁文书"); + contentBuilder.append("审核裁决书,拒绝"); break; case 12: - contentBuilder.append("已核查仲裁文书"); + contentBuilder.append("核验裁决书"); break; case 13: - contentBuilder.append("已同意仲裁文书"); + contentBuilder.append("审核裁决书,同意"); break; case 14: - contentBuilder.append("已完成仲裁文书签名"); + contentBuilder.append("签名成功"); break; case 15: - contentBuilder.append("已完成仲裁文书用印"); + contentBuilder.append("用印成功"); break; case 16: - contentBuilder.append("已送达仲裁文书"); + contentBuilder.append("送达仲裁文书"); break; case 17: - contentBuilder.append("已完成案件归档"); + contentBuilder.append("案件归档"); break; case 26: - contentBuilder.append("已完成证据确认"); + contentBuilder.append("证据确认成功"); break; + default:break; } + record.setContent(contentBuilder.toString()); + }); } return records; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java index 95a7d7c..3841ec8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CasePaymentServiceImpl.java @@ -4,6 +4,7 @@ package com.ruoyi.wisdomarbitrate.service.impl; import com.ruoyi.ElegentPay; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.dto.PayRequest; import com.ruoyi.dto.PayResponse; @@ -19,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; import java.util.Date; import java.util.List; @@ -127,6 +127,9 @@ public class CasePaymentServiceImpl implements ICasePaymentService { SmsUtils.sendSms(request); } } + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.CASE_CROSSEXAMI,""); + return AjaxResult.success(); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CaseLogUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CaseLogUtils.java new file mode 100644 index 0000000..7781461 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/CaseLogUtils.java @@ -0,0 +1,42 @@ +package com.ruoyi.wisdomarbitrate.utils; + +import cn.hutool.extra.spring.SpringUtil; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord; +import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +/** + * 案件记录日志文件 + * + * @author wangqiong + */ +public class CaseLogUtils +{ + private static CaseLogRecordMapper caseLogRecordMapper= SpringUtil.getBean(CaseLogRecordMapper.class); + + /** + * 新增案件日志 + * @param caseAppliId 案件id,不能为空 + * @param caseNode 案件节点,不能为空 + * @param notes 备注 + */ + public static void insertCaseLog(@NotNull Long caseAppliId, @NotEmpty Integer caseNode, String notes ){ + // 获取当前的用户 + LoginUser loginUser = SecurityUtils.getLoginUser(); + String nickName = loginUser.getUser().getNickName(); + CaseLogRecord operLog = new CaseLogRecord(); + operLog.setCreateBy(loginUser.getUsername()); + operLog.setCreateNickName(nickName); + operLog.setUpdateBy(loginUser.getUsername()); + operLog.setCaseAppliId(caseAppliId); + operLog.setCaseNode(caseNode); + operLog.setNotes(notes); + caseLogRecordMapper.insertCaseLogRecord(operLog); + } + + +} diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index fcc83e4..7ab517b 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -67,7 +67,7 @@ AND c.case_num = #{caseNum} - AND d.dept_name like CONCAT( '%',#{name},'%') AND ca.identity_type=1 and ca.name=d.dept_id + AND ca.NAME=#{nameId} AND ca.identity_type=1 and ca.name=d.dept_id and c.case_status in diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml index 8ec69d1..254e8e2 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml @@ -10,50 +10,30 @@ - - + + - insert into case_log_record(case_appli_id, case_node,case_node_time,notes,create_by,create_time ) values( - #{caseAppliId},#{caseNode},sysdate(),#{notes},#{createBy},sysdate() + insert into case_log_record(case_appli_id, case_node,case_node_time,notes,create_by,create_nick_name,create_time,update_by,update_time ) values( + #{caseAppliId},#{caseNode},sysdate(),#{notes},#{createBy},#{createNickName},sysdate(),#{updateBy},sysdate() ) + - select cl.case_node ,cl.case_node_time ,cl.notes ,c.case_num ,cl.id ,cl.case_appli_id, - u.nick_name - from case_log_record cl left join case_application c on cl.case_appli_id = c.id - join sys_user u on cl.create_by=u.user_id - - - AND c.case_num = #{caseNum} - - - AND c.case_appli_id = #{caseAppliId} - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file From adf87c8ec285f1c86df984e3931faf73670d9ff2 Mon Sep 17 00:00:00 2001 From: hejinbo Date: Wed, 11 Oct 2023 11:47:26 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AdjudicationController.java | 16 +++++++- .../common/utils/file/SaaSAPIFileUtils.java | 32 +++++++-------- .../domain/vo/ArchivesDetailVO.java | 24 +++++++++++ .../service/IAdjudicationService.java | 6 ++- .../service/impl/AdjudicationServiceImpl.java | 40 ++++++++++++++++--- 5 files changed, 95 insertions(+), 23 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ArchivesDetailVO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java index cbc0f7b..da014b6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java @@ -4,11 +4,14 @@ import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO; +import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequestMapping("/adjudication") public class AdjudicationController extends BaseController { @@ -42,7 +45,8 @@ public class AdjudicationController extends BaseController { */ @GetMapping("/logistics") public AjaxResult getLogisticsInfo(CaseApplication caseApplication){ - return adjudicationService.getLogisticsInfo(caseApplication); + List logisticsInfo = adjudicationService.getLogisticsInfo(caseApplication); + return AjaxResult.success(logisticsInfo); } /** @@ -83,4 +87,14 @@ public class AdjudicationController extends BaseController { public AjaxResult stamp(@Validated @RequestBody CaseApplication caseApplication){ return adjudicationService.stamp(caseApplication); } + + /** + * 档案详情查询 + * @param id + * @return + */ + @GetMapping("/archives") + public AjaxResult getArchivesDetail(Long id){ + return adjudicationService.getArchivesDetail(id); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java index fa6389b..6033c25 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/file/SaaSAPIFileUtils.java @@ -64,20 +64,20 @@ public class SaaSAPIFileUtils { return EsignHttpHelper.doCommHttp(eSignHost, apiaddr,requestType , jsonParm, header,true); } -/* public static void main(String[] args) throws EsignDemoException { - String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\07\\6babb8e261454fffbacf6d9fd1589b9b.docx"; - EsignHttpResponse uploadUrl = getUploadUrl(filePath); - String body = uploadUrl.getBody(); - JSONObject jsonObject = new JSONObject(body); - JSONObject dataObj = jsonObject.getJSONObject("data"); - String fileUploadUrl = dataObj.get("fileUploadUrl").toString(); - System.out.println("这是fileUploadUrl:"+fileUploadUrl); - String fileId = dataObj.get("fileId").toString(); - System.out.println("这是fileId:"+fileId); - EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath); - System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody()); - EsignHttpResponse fileStatus = getFileStatus(fileId); - System.out.println("这是获取文件上传状态的结果:"+fileStatus.getBody()); - getFileStatus("95d0c307d91e4985bdb8874f6f84daa5"); - }*/ +// public static void main(String[] args) throws EsignDemoException { + // String filePath = "D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx"; +// EsignHttpResponse uploadUrl = getUploadUrl(filePath); +// String body = uploadUrl.getBody(); +// JSONObject jsonObject = new JSONObject(body); +// JSONObject dataObj = jsonObject.getJSONObject("data"); +// String fileUploadUrl = dataObj.get("fileUploadUrl").toString(); +// System.out.println("这是fileUploadUrl:"+fileUploadUrl); +// String fileId = dataObj.get("fileId").toString(); +// System.out.println("这是fileId:"+fileId); +// EsignHttpResponse esignHttpResponse = uploadFile(fileUploadUrl, filePath); +// System.out.println("这是上传文件流的结果:"+esignHttpResponse.getBody()); +// EsignHttpResponse fileStatus = getFileStatus(fileId); +// System.out.println("这是获取文件上传状态的结果:"+fileStatus.getBody()); +// getFileStatus("a0c2ad21065f48ff8b872412c39d5d3a"); +// } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ArchivesDetailVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ArchivesDetailVO.java new file mode 100644 index 0000000..dfe4abc --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ArchivesDetailVO.java @@ -0,0 +1,24 @@ +package com.ruoyi.wisdomarbitrate.domain.vo; + +import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +import com.ruoyi.wisdomarbitrate.domain.CaseLogRecord; +import com.ruoyi.wisdomarbitrate.mapper.CaseLogRecordMapper; +import lombok.Data; + +import java.util.List; + +@Data +public class ArchivesDetailVO { + /** + * 案件信息 + */ + private CaseApplication caseApplication; + /** + * 案件日志信息 + */ + private List caseLogRecordList; + /** + * 快递信息 + */ + private List logisticsInfoVOList; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java index 773fc61..6d7f6a1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IAdjudicationService.java @@ -2,13 +2,16 @@ package com.ruoyi.wisdomarbitrate.service; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; +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); - AjaxResult getLogisticsInfo(CaseApplication caseApplication); + List getLogisticsInfo(CaseApplication caseApplication); AjaxResult signature(CaseApplication caseApplication); @@ -18,4 +21,5 @@ public interface IAdjudicationService { AjaxResult stamp(CaseApplication caseApplication); + AjaxResult getArchivesDetail(Long id); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java index e4e8fff..4e665aa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java @@ -8,6 +8,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.EmailOutUtil; import com.ruoyi.common.utils.WordUtil; import com.ruoyi.wisdomarbitrate.domain.*; +import com.ruoyi.wisdomarbitrate.domain.vo.ArchivesDetailVO; import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO; import com.ruoyi.wisdomarbitrate.mapper.ArbitrateRecordMapper; import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper; @@ -15,6 +16,7 @@ import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper; import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper; import com.ruoyi.wisdomarbitrate.service.IAdjudicationService; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; +import com.ruoyi.wisdomarbitrate.service.ICaseLogRecordService; import lombok.extern.slf4j.Slf4j; import org.apache.poi.xwpf.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; @@ -52,6 +54,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService { private EmailOutUtil emailOutUtil; @Autowired private ICaseApplicationService caseApplicationService; + @Autowired + private ICaseLogRecordService caseLogRecordService; @Override public AjaxResult createDocument(CaseApplication caseApplication) { @@ -248,7 +252,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } @Override - public AjaxResult getLogisticsInfo(CaseApplication caseApplication) { + public List getLogisticsInfo(CaseApplication caseApplication) { try { //快递单号查询 String key = "729437f92468910aee6c12dbfeaee3c1"; @@ -293,11 +297,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } else { // 请求失败 - return AjaxResult.error("请求失败,错误码:" + responseCode); + return null; } } } - return AjaxResult.success(logisticsInfoVOList); + return logisticsInfoVOList; } } catch (IOException e) { e.printStackTrace(); @@ -360,7 +364,32 @@ public class AdjudicationServiceImpl implements IAdjudicationService { return AjaxResult.success("用印成功,案件状态已改为待仲裁文书送达"); } - public static void main(String[] args) { + @Override + public AjaxResult getArchivesDetail(Long id) { + ArchivesDetailVO archivesDetailVO = new ArchivesDetailVO(); + CaseApplication caseApplication = new CaseApplication(); + caseApplication.setId(id); + //查询案件信息 + CaseApplication caseApplication1 = caseApplicationService.selectCaseApplication(caseApplication); + if (caseApplication1 != null) { + archivesDetailVO.setCaseApplication(caseApplication1); + } + //查询案件日志信息 + CaseLogRecord caseLogRecord = new CaseLogRecord(); + caseLogRecord.setCaseAppliId(id); + List caseLogRecords = caseLogRecordService.selectCaseLogRecordList(caseLogRecord); + if (caseLogRecords != null && caseLogRecords.size() > 0) { + archivesDetailVO.setCaseLogRecordList(caseLogRecords); + } + //查询快递信息 + List logisticsInfo = this.getLogisticsInfo(caseApplication); + if (logisticsInfo != null && logisticsInfo.size() > 0) { + archivesDetailVO.setLogisticsInfoVOList(logisticsInfo); + } + return AjaxResult.success(archivesDetailVO); + } + + /*public static void main(String[] args) { try { List fileList = new ArrayList<>(); fileList.add(new File("D:\\home\\ruoyi\\uploadPath\\upload\\2023\\10\\7\\b442880179844a848f1f8b08c29e3d0c.docx")); @@ -375,5 +404,6 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } catch (MailSendException e) { e.printStackTrace(); } - } + }*/ + } \ No newline at end of file From ec864b2b8e92f1c036935ccdd6253c6421962e95 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Wed, 11 Oct 2023 11:48:33 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E6=A1=88=E4=BB=B6=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=EF=BC=8C=E6=A1=88=E4=BB=B6=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CaseApplicationServiceImpl.java | 3 +++ .../service/impl/CaseLogRecordServiceImpl.java | 2 +- .../resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index b4e0882..7c8301f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -489,6 +489,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); rows = caseApplicationMapper.submitCaseApplication(caseApplication); } + // 新增日志 + CaseLogUtils.insertCaseLog(caseApplication.getId(),CaseApplicationConstants.PENDING_PAYMENT,""); + return rows; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java index c2848d9..57b28ae 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseLogRecordServiceImpl.java @@ -38,7 +38,7 @@ public class CaseLogRecordServiceImpl implements ICaseLogRecordService { contentBuilder.append("提交立案申请"); break; case 2: - contentBuilder.append("提交立案审查"); + contentBuilder.append("立案审查"); break; case 3: contentBuilder.append("支付成功"); diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml index 254e8e2..857117b 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseLogRecordMapper.xml @@ -22,7 +22,7 @@ From 4c93945eaf0ea8823612b414500212a49177fd68 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Wed, 11 Oct 2023 11:54:57 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=9C=BA=E6=9E=84id?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=A1=88=E4=BB=B6=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml index 7ab517b..ffaaa73 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml @@ -66,7 +66,7 @@ AND c.case_num = #{caseNum} - + AND ca.NAME=#{nameId} AND ca.identity_type=1 and ca.name=d.dept_id From 9aa2ff00eb1697e943d1d0cadc812d4a23a60627 Mon Sep 17 00:00:00 2001 From: gy b Date: Wed, 11 Oct 2023 12:21:09 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=85=BE=E8=AE=AF?= =?UTF-8?q?=E4=BA=BA=E8=84=B8=E6=A0=B8=E8=BA=AB=E7=9B=B8=E5=85=B3=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IdentityAuthenticationController.java | 21 +-- ruoyi-common/pom.xml | 4 +- .../IdentityAuthenticationService.java | 20 ++- .../IdentityAuthenticationServiceImpl.java | 147 +++++++----------- 4 files changed, 85 insertions(+), 107 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java index f097a64..66fedb3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.wisdomarbitrate; +import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; @@ -19,27 +20,27 @@ public class IdentityAuthenticationController extends BaseController { private IdentityAuthenticationService identityAuthenticationService; /** - * 查询身份认证EIDtoken + * 获取EIDtoken */ @PostMapping("/selectIdentityAuthenticaEIDtoken") public AjaxResult selectIdentityAuthenticaEIDtoken() { - IdentityAuthentication ientityAuthentication = identityAuthenticationService.selectIdentityAuthenticaEIDtoken(); - return success(ientityAuthentication); + JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthenticaEIDtoken(); + return success(tokenResult); } /** - * 查询身份认证结果 + * 小程序人脸核身后查询身份认证结果 */ @PostMapping("/selectIdentityAuthenticaRespon") public AjaxResult selectIdentityAuthenticaRespon(@Validated @RequestBody IdentityAuthentication ientityAuthentication) { - String username = this.getUsername(); - Long userId = this.getUserId(); - ientityAuthentication.setUserId(userId); - ientityAuthentication.setUserName(username); - IdentityAuthentication ientityAuthenticationRes = identityAuthenticationService.selectIdentityAuthenticaRespon( ientityAuthentication); - return success(ientityAuthenticationRes); +// String username = this.getUsername(); +// Long userId = this.getUserId(); +// ientityAuthentication.setUserId(userId); +// ientityAuthentication.setUserName(username); + JSONObject checkResult = identityAuthenticationService.selectIdentityAuthenticaRespon( ientityAuthentication); + return success(checkResult); } diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 77e53b1..206e38a 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -136,13 +136,13 @@ com.tencentcloudapi tencentcloud-sdk-java - 3.1.270 + 3.1.876 com.tencentcloudapi tencentcloud-sdk-java-faceid - 3.1.871 + 3.1.875 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IdentityAuthenticationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IdentityAuthenticationService.java index 3748942..b98d66b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IdentityAuthenticationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IdentityAuthenticationService.java @@ -1,15 +1,25 @@ package com.ruoyi.wisdomarbitrate.service; +import com.alibaba.fastjson.JSONObject; import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication; -import com.tencentcloudapi.common.exception.TencentCloudSDKException; public interface IdentityAuthenticationService { - IdentityAuthentication selectIdentityAuthentication(IdentityAuthentication identityAuthentication); + IdentityAuthentication selectIdentityAuthentication(IdentityAuthentication identityAuthentication); + /** + * 获取Eidtoken + * + * @return + */ + JSONObject selectIdentityAuthenticaEIDtoken(); - IdentityAuthentication selectIdentityAuthenticaEIDtoken(); - - IdentityAuthentication selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication); + /** + * 小程序人脸核身后查询身份认证结果 + * + * @param ientityAuthentication + * @return + */ + JSONObject selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java index 5d56387..f8686ed 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java @@ -1,27 +1,22 @@ package com.ruoyi.wisdomarbitrate.service.impl; - -import cn.hutool.crypto.SmUtil; -import cn.hutool.crypto.asymmetric.SM2; -import cn.hutool.crypto.symmetric.SymmetricCrypto; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.exceptions.TradeException; import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication; import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper; -import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import com.ruoyi.wisdomarbitrate.service.IdentityAuthenticationService; - import com.tencentcloudapi.common.Credential; +import com.tencentcloudapi.common.exception.TencentCloudSDKException; import com.tencentcloudapi.common.profile.ClientProfile; import com.tencentcloudapi.common.profile.HttpProfile; -import com.tencentcloudapi.common.exception.TencentCloudSDKException; import com.tencentcloudapi.faceid.v20180301.FaceidClient; -import com.tencentcloudapi.faceid.v20180301.models.*; - +import com.tencentcloudapi.faceid.v20180301.models.GetEidResultRequest; +import com.tencentcloudapi.faceid.v20180301.models.GetEidResultResponse; +import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenRequest; +import com.tencentcloudapi.faceid.v20180301.models.GetEidTokenResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,15 +24,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Base64; -import java.util.HashMap; -import java.util.Map; - @Service -public class IdentityAuthenticationServiceImpl implements IdentityAuthenticationService { +public class IdentityAuthenticationServiceImpl implements IdentityAuthenticationService { @Value("${identityAuthentication.credentialSecretId}") private String credentialSecretId; @@ -58,9 +46,9 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthenticatio @Override public IdentityAuthentication selectIdentityAuthentication(IdentityAuthentication identityAuthentication) { IdentityAuthentication identityAuthenticationselect = identityAuthenticationMapper.selectIdentityAuthentication(identityAuthentication); - if(identityAuthenticationselect!=null){ + if (identityAuthenticationselect != null) { identityAuthenticationselect.setCertificationStatusName("已身份认证"); - }else { + } else { IdentityAuthentication identityAuthenticationselectnew = new IdentityAuthentication(); identityAuthenticationselectnew.setCertificationStatusName("未身份认证"); identityAuthenticationselectnew.setCertificationStatus(0); @@ -71,85 +59,64 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthenticatio } @Override - public IdentityAuthentication selectIdentityAuthenticaEIDtoken() { - IdentityAuthentication identityAuthentication = new IdentityAuthentication(); - try{ - Credential authenti = new Credential(credentialSecretId, credentialSecretKey); - HttpProfile httpProfileIdenAuth = new HttpProfile(); - httpProfileIdenAuth.setEndpoint("faceid.tencentcloudapi.com"); - ClientProfile clientInv= new ClientProfile(); - clientInv.setHttpProfile(httpProfileIdenAuth); - FaceidClient clientIdenAuth = new FaceidClient(authenti, "", clientInv); - // 实例化一个请求对象 - GetEidTokenRequest reqest = new GetEidTokenRequest(); - //设置请求参数 - reqest.setMerchantId(merchantId); - GetEidTokenResponse respIdenAuth = clientIdenAuth.GetEidToken(reqest); - String respJSON = GetEidTokenResponse.toJsonString(respIdenAuth); - JSONObject objJSON = JSON.parseObject(respJSON); - String eidToken = objJSON.getString("EidToken"); - String requestId = objJSON.getString("RequestId"); - identityAuthentication.setEidToken(eidToken); - }catch (TencentCloudSDKException e) { - log.error("获取Eidtoke异常:", e); - throw new RuntimeException("获取Eidtoke异常"); + public JSONObject selectIdentityAuthenticaEIDtoken() { + JSONObject objJSON = new JSONObject(); + objJSON.put("EidToken", ""); + try { + Credential cred = new Credential(credentialSecretId, credentialSecretKey); + // 实例化一个http选项,可选的,没有特殊需求可以跳过 + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint("faceid.tencentcloudapi.com"); + // 实例化一个client选项,可选的,没有特殊需求可以跳过 + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); + // 实例化要请求产品的client对象,clientProfile是可选的 + FaceidClient client = new FaceidClient(cred, "", clientProfile); + // 实例化一个请求对象,每个接口都会对应一个request对象 + GetEidTokenRequest req = new GetEidTokenRequest(); + // 返回的resp是一个GetEidTokenResponse的实例,与请求对象对应 + GetEidTokenResponse resp = client.GetEidToken(req); + // 输出json格式的字符串回包 + System.out.println(GetEidTokenResponse.toJsonString(resp)); + String respJSON = GetEidTokenResponse.toJsonString(resp); + objJSON = JSON.parseObject(respJSON); + } catch (TencentCloudSDKException e) { + System.out.println(e.toString()); + System.out.println("获取Eidtoken失败"); } - - return identityAuthentication; - + return objJSON; } @Override @Transactional - public IdentityAuthentication selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication) { + public JSONObject selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication) { String eidToken = ientityAuthentication.getEidToken(); - Long userId = ientityAuthentication.getUserId(); - String userName = ientityAuthentication.getUserName(); - IdentityAuthentication IdentityAuthenticationRespon = new IdentityAuthentication(); - IdentityAuthentication IdentityAuthenticationResult = new IdentityAuthentication(); - if(StringUtils.isNotEmpty(eidToken)){ - try{ - Credential authenti = new Credential(credentialSecretId, credentialSecretKey); - HttpProfile httpProfileIdenAuth = new HttpProfile(); - httpProfileIdenAuth.setEndpoint("faceid.tencentcloudapi.com"); - ClientProfile clientInv= new ClientProfile(); - clientInv.setHttpProfile(httpProfileIdenAuth); - FaceidClient clientIdenAuth = new FaceidClient(authenti, "", clientInv); - // 实例化一个请求对象 - GetEidResultRequest reqest = new GetEidResultRequest(); - //设置请求参数 - reqest.setEidToken(eidToken); - -// reqest.setInfoType("1"); -// reqest.setInfoType("13"); -// reqest.setInfoType("2"); - - //获得身份认证结果 - GetEidResultResponse respIdenAuth = clientIdenAuth.GetEidResult(reqest); - String respJSON = GetEidResultResponse.toJsonString(respIdenAuth); - JSONObject objJSON = JSON.parseObject(respJSON); - IdentityAuthenticationRespon.setCertificationStatus(1); - IdentityAuthenticationRespon.setUserName(userName); - IdentityAuthenticationRespon.setUserId(userId); - - JSONObject objEidInfo = JSON.parseObject(objJSON.getString("EidInfo")); -// identityAuthenticationMapper.insertIdentityAuthentication(IdentityAuthenticationRespon); - IdentityAuthenticationResult.setCertificationStatus(1); - IdentityAuthenticationResult.setCertificationStatusName("认证成功"); - } catch (TencentCloudSDKException e) { - log.error("认证失败:", e); - throw new RuntimeException("认证失败"); - } + try { + Credential cred = new Credential(credentialSecretId, credentialSecretKey); + // 实例化一个http选项,可选的,没有特殊需求可以跳过 + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint("faceid.tencentcloudapi.com"); + // 实例化一个client选项,可选的,没有特殊需求可以跳过 + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); + // 实例化要请求产品的client对象,clientProfile是可选的 + FaceidClient client = new FaceidClient(cred, "", clientProfile); + // 实例化一个请求对象,每个接口都会对应一个request对象 + GetEidResultRequest req = new GetEidResultRequest(); + req.setEidToken(eidToken); + // 返回的resp是一个GetEidResultResponse的实例,与请求对象对应 + GetEidResultResponse resp = client.GetEidResult(req); + // 输出json格式的字符串回包 + System.out.println(GetEidResultResponse.toJsonString(resp)); + String s = GetEidResultResponse.toJsonString(resp); + JSONObject object = JSON.parseObject(s); + return object; + } catch (TencentCloudSDKException e) { + System.out.println(e.toString()); } - return IdentityAuthenticationResult; + return null; } - - - - - - } From 3994ca3e7778e75ed4fb08862f944f6304a016c5 Mon Sep 17 00:00:00 2001 From: hejinbo Date: Wed, 11 Oct 2023 14:25:15 +0800 Subject: [PATCH 18/23] =?UTF-8?q?=E6=A1=A3=E6=A1=88=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/wisdomarbitrate/AdjudicationController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java index 2bcc3d9..ea6ce32 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/AdjudicationController.java @@ -97,7 +97,7 @@ public class AdjudicationController extends BaseController { /** * 档案详情查询 - * @param id + * @param id 案件id * @return */ @GetMapping("/archives") From 24f15d82369e692915802e2402eeee6a526c7657 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Wed, 11 Oct 2023 16:40:40 +0800 Subject: [PATCH 19/23] =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 3 + .../domain/CaseApplication.java | 10 + .../impl/CaseApplicationServiceImpl.java | 265 ++++++++++++++++-- 3 files changed, 260 insertions(+), 18 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index fa501cb..de992f1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -108,6 +108,9 @@ public class CaseApplicationController extends BaseController { @PreAuthorize("@ss.hasPermi('caseManagement:list:import')") @PostMapping("/importData") public AjaxResult importData(MultipartFile file) throws Exception { + if(file==null){ + return warn("请上传文件"); + } ExcelUtil util = new ExcelUtil(CaseApplication.class); List caseApplicationList = util.importExcel(file.getInputStream()); String operName = getUsername(); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java index 2a5dbc5..ac77efe 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java @@ -114,6 +114,16 @@ public class CaseApplication extends BaseEntity { private Integer paymentStatus; /** 支付状态描述 */ private String paymentStatusName; + // 导入校验失败信息 + private StringBuilder errorMsg; + + public StringBuilder getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(StringBuilder errorMsg) { + this.errorMsg = errorMsg; + } public Integer getPaymentStatus() { return paymentStatus; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 7c8301f..adf49a0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; +import java.util.regex.Pattern; import java.util.stream.Collectors; import static com.ruoyi.common.utils.SecurityUtils.getUsername; @@ -46,7 +47,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { private CaseAttachMapper caseAttachMapper; @Autowired private SysDeptMapper sysDeptMapper; - + // 手机号正则 + 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}$"); @@ -305,16 +307,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { List caseApplicationListinsert = new ArrayList<>(); for (int i = 0; i < caseApplicationList.size(); i++){ CaseApplication caseApplication = caseApplicationList.get(i); - //根据仲裁费用计费规则计算应缴费用 - //暂时设置计费比率为0.01 - BigDecimal feeRate = new BigDecimal(0.01); - BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP); - caseApplication.setFeePayable(feePayable); - //赋值CaseApplication的案件关联人信息 - List caseAffiliatesnew = new ArrayList<>(); - // 组装案件关联人信息 - assignmentCaseAffiliates(caseApplication,caseAffiliatesnew,deptMap); + // 导入校验 + importValid(caseApplication); + // 校验成功的数据 + if(StrUtil.isEmpty(caseApplication.getErrorMsg())) { + //根据仲裁费用计费规则计算应缴费用 + //暂时设置计费比率为0.01 + BigDecimal feeRate = new BigDecimal(0.01); + BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP); + caseApplication.setFeePayable(feePayable); + + //赋值CaseApplication的案件关联人信息 + List caseAffiliatesnew = new ArrayList<>(); + // 组装案件关联人信息 + assignmentCaseAffiliates(caseApplication, caseAffiliatesnew, deptMap); // int caseApplicationCount = selectCaseApplicationCount(caseApplication); // if(caseApplicationCount>0){ @@ -323,9 +330,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { // }else { // caseApplicationListinsert.add(caseApplication); // } - caseApplicationListinsert.add(caseApplication); + caseApplicationListinsert.add(caseApplication); + }else { + // 拼接错误信息 + failureMsg.append("
").append("第").append(i+2).append("行:").append(caseApplication.getErrorMsg().toString()); + } } - if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){ // List caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect( // collectingAndThen( @@ -384,15 +394,235 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { }else { throw new ServiceException("导入立案申请数据不能为空!"); } - // 编号存在不导入 - if(StringUtils.isNotEmpty(failureMsg)){ - return failureMsg.append(successMsg).toString(); - }else { + return successMsg.append(failureMsg.toString()).toString(); - return successMsg.toString(); + } + + /** + * 导入校验 + * @param caseApplication + * @param + */ + private void importValid(CaseApplication caseApplication) { + StringBuilder failureMsg=new StringBuilder(); + caseApplication.setErrorMsg(failureMsg); + // 校验基本字段 + validBaseColumn(caseApplication,failureMsg); + // 校验申请人信息 + validApplicationColumn(caseApplication,failureMsg); + // 校验申请人代理信息 + validApplicationAgentColumn(caseApplication,failureMsg); + // 校验被申请人信息 + 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(caseApplication.getDebtorIdentityNumAgent().length()>50){ + failureMsg.append("【被申请人主体信息-代理人身份证号】字段超出指定长度,最大长度为50;"); + } + 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(caseApplication.getDebtorIdentityNum().length()>50){ + failureMsg.append("【被申请人主体信息-身份证号】字段超出指定长度,最大长度为50;"); + } + 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;"); + } + } + + /** + * 校验申请人代理信息 + * @param caseApplication + * @param failureMsg + */ + private void validApplicationAgentColumn(CaseApplication caseApplication, StringBuilder failureMsg) { + 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(caseApplication.getIdentityNumAgent().length()>50){ + failureMsg.append("【申请人主体信息-代理人身份证号】字段超出指定长度,最大长度为50;"); + } + 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 + */ + 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;"); + } + } + + /** + * 校验基本字段 + * @param caseApplication + * @param failureMsg + */ + private void validBaseColumn(CaseApplication caseApplication, StringBuilder failureMsg) { + 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( 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;"); + } + } + + @Override @Transactional public int pendTral(CaseApplication caseApplication) { @@ -751,5 +981,4 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseApplicationNew.setFeePayable(caseApplicationinsertDiffer.getFeePayable()); } - } From 382615570f7a61c4d41453e258826c18afbee51b Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Wed, 11 Oct 2023 17:33:23 +0800 Subject: [PATCH 20/23] =?UTF-8?q?=E7=BC=B4=E8=B4=B9=E7=A1=AE=E8=AE=A4?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CaseApplicationServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index adf49a0..e008e0b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -728,6 +728,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { @Override public CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication) { CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplicationConfirm(caseApplication); + if(caseApplicationselect==null){ + return caseApplicationselect; + } CaseAffiliate caseAffiliate = new CaseAffiliate(); caseAffiliate.setCaseAppliId(caseApplication.getId()); List caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); From d40fbccf2442f3dd46219b1e6d98ffef2291ffb3 Mon Sep 17 00:00:00 2001 From: gy b Date: Wed, 11 Oct 2023 18:11:32 +0800 Subject: [PATCH 21/23] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=BA=E8=84=B8?= =?UTF-8?q?=E6=A0=B8=E8=BA=AB=E8=A7=A3=E5=AF=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/SysLoginController.java | 34 +++--- .../IdentityAuthenticationController.java | 24 +--- .../src/main/resources/application.yml | 2 +- ruoyi-common/pom.xml | 16 +-- .../IdentityAuthenticationService.java | 11 +- .../IdentityAuthenticationServiceImpl.java | 111 +++++++++++++++++- 6 files changed, 143 insertions(+), 55 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index deef3b5..60633c7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -22,12 +22,11 @@ import com.ruoyi.system.service.ISysMenuService; /** * 登录验证 - * + * * @author ruoyi */ @RestController -public class SysLoginController -{ +public class SysLoginController { @Autowired private SysLoginService loginService; @@ -37,40 +36,36 @@ public class SysLoginController @Autowired private SysPermissionService permissionService; @Autowired - private IdentityAuthenticationService identityAuthenticationService; + IdentityAuthenticationService identityAuthenticationService; /** * 登录方法 - * + * * @param loginBody 登录信息 * @return 结果 */ @PostMapping("/login") - public AjaxResult login(@RequestBody LoginBody loginBody) - { + public AjaxResult login(@RequestBody LoginBody loginBody) { AjaxResult ajax = AjaxResult.success(); // 生成令牌 String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid()); ajax.put(Constants.TOKEN, token); - -// IdentityAuthentication identityAuthentication = new IdentityAuthentication(); -// identityAuthentication.setUserName(loginBody.getUsername()); -// IdentityAuthentication identityAuthenticationselect = identityAuthenticationService.selectIdentityAuthentication(identityAuthentication); -// ajax.put("certificationStatusName", identityAuthenticationselect.getCertificationStatusName()); -// ajax.put("certificationStatus", identityAuthenticationselect.getCertificationStatus()); - + //判断该用户是否已经实名认证(certificationStatus1已认证0未认证) + IdentityAuthentication identityAuthentication=new IdentityAuthentication(); + identityAuthentication.setUserName(loginBody.getUsername()); + String status = identityAuthenticationService.checkIsAuthentication(identityAuthentication); + ajax.put("certificationStatus", status); return ajax; } /** * 获取用户信息 - * + * * @return 用户信息 */ @GetMapping("getInfo") - public AjaxResult getInfo() - { + public AjaxResult getInfo() { SysUser user = SecurityUtils.getLoginUser().getUser(); // 角色集合 Set roles = permissionService.getRolePermission(user); @@ -85,12 +80,11 @@ public class SysLoginController /** * 获取路由信息 - * + * * @return 路由信息 */ @GetMapping("getRouters") - public AjaxResult getRouters() - { + public AjaxResult getRouters() { Long userId = SecurityUtils.getUserId(); List menus = menuService.selectMenuTreeByUserId(userId); return AjaxResult.success(menuService.buildMenus(menus)); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java index 66fedb3..7260847 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/IdentityAuthenticationController.java @@ -3,7 +3,6 @@ package com.ruoyi.web.controller.wisdomarbitrate; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication; import com.ruoyi.wisdomarbitrate.service.IdentityAuthenticationService; import org.springframework.beans.factory.annotation.Autowired; @@ -15,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/identityAuthentication") -public class IdentityAuthenticationController extends BaseController { +public class IdentityAuthenticationController extends BaseController { @Autowired private IdentityAuthenticationService identityAuthenticationService; @@ -23,8 +22,7 @@ public class IdentityAuthenticationController extends BaseController { * 获取EIDtoken */ @PostMapping("/selectIdentityAuthenticaEIDtoken") - public AjaxResult selectIdentityAuthenticaEIDtoken() - { + public AjaxResult selectIdentityAuthenticaEIDtoken() { JSONObject tokenResult = identityAuthenticationService.selectIdentityAuthenticaEIDtoken(); return success(tokenResult); } @@ -33,22 +31,10 @@ public class IdentityAuthenticationController extends BaseController { * 小程序人脸核身后查询身份认证结果 */ @PostMapping("/selectIdentityAuthenticaRespon") - public AjaxResult selectIdentityAuthenticaRespon(@Validated @RequestBody IdentityAuthentication ientityAuthentication) - { -// String username = this.getUsername(); -// Long userId = this.getUserId(); -// ientityAuthentication.setUserId(userId); -// ientityAuthentication.setUserName(username); - JSONObject checkResult = identityAuthenticationService.selectIdentityAuthenticaRespon( ientityAuthentication); - return success(checkResult); + public AjaxResult selectIdentityAuthenticaRespon(@Validated @RequestBody IdentityAuthentication ientityAuthentication) { + AjaxResult checkResult = identityAuthenticationService.selectIdentityAuthenticaRespon(ientityAuthentication); + return checkResult; } - - - - - - - } diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 9e15e95..3e9f5c0 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -166,4 +166,4 @@ identityAuthentication: credentialSecretId: AKID3xfHgroY4MQHvLXUXMwIQL1UjmbBX1Tv credentialSecretKey: INDrIXcT8YmomZBcsy0oNirnU0LTN4X7 merchantId: 0NSJ2309281116194321 - privateKeyHexDecodeinfo: MHcCAQEEIEw7MRv3uYlpmU6Fko4GlXSh6Vd38k0cUQZ5zDwvRg+voAoGCCqBHM9VAYItoUQDQgAEUdxIAWhGg4LUXf1GoPdb8XMbGudpexPQCuaaRi9BCnNbpaF1kcwRhhsBKvop9ZmW/nOz4wQ1r/iIEOrc9qCXgQ== \ No newline at end of file + privateKeyHexDecodeinfo: 4c3b311bf7b98969994e85928e069574a1e95777f24d1c510679cc3c2f460faf \ No newline at end of file diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 206e38a..b0c399b 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -52,19 +52,19 @@ org.apache.commons commons-lang3
- + com.fasterxml.jackson.core jackson-databind - + - - com.baomidou - dynamic-datasource-spring-boot-starter - 3.5.2 - + + com.baomidou + dynamic-datasource-spring-boot-starter + 3.5.2 + @@ -144,7 +144,7 @@ tencentcloud-sdk-java-faceid 3.1.875 - + cn.hutool hutool-all diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IdentityAuthenticationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IdentityAuthenticationService.java index b98d66b..1ae0f29 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IdentityAuthenticationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IdentityAuthenticationService.java @@ -1,6 +1,7 @@ package com.ruoyi.wisdomarbitrate.service; import com.alibaba.fastjson.JSONObject; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication; public interface IdentityAuthenticationService { @@ -8,6 +9,14 @@ public interface IdentityAuthenticationService { IdentityAuthentication selectIdentityAuthentication(IdentityAuthentication identityAuthentication); + /** + * 检查是否已经认证的用户 + * + * @param identityAuthentication + * @return + */ + String checkIsAuthentication(IdentityAuthentication identityAuthentication); + /** * 获取Eidtoken * @@ -21,5 +30,5 @@ public interface IdentityAuthenticationService { * @param ientityAuthentication * @return */ - JSONObject selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication); + AjaxResult selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java index f8686ed..b842f92 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java @@ -1,10 +1,15 @@ package com.ruoyi.wisdomarbitrate.service.impl; +import cn.hutool.core.codec.Base64; +import cn.hutool.crypto.SmUtil; +import cn.hutool.crypto.asymmetric.SM2; +import cn.hutool.crypto.symmetric.SymmetricCrypto; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.core.domain.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication; import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper; import com.ruoyi.wisdomarbitrate.service.IdentityAuthenticationService; @@ -24,6 +29,8 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Date; + @Service public class IdentityAuthenticationServiceImpl implements IdentityAuthenticationService { @@ -58,6 +65,27 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication } + /** + * 检查是否已经认证的用户 + * + * @param identityAuthentication + * @return + */ + @Override + public String checkIsAuthentication(IdentityAuthentication identityAuthentication) { + IdentityAuthentication identityAuthenticationselect = identityAuthenticationMapper.selectIdentityAuthentication(identityAuthentication); + if (identityAuthenticationselect != null) { + return "1"; + } else { + return "0"; + } + } + + /** + * 获取EIDtoken + * + * @return + */ @Override public JSONObject selectIdentityAuthenticaEIDtoken() { JSONObject objJSON = new JSONObject(); @@ -74,10 +102,10 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication FaceidClient client = new FaceidClient(cred, "", clientProfile); // 实例化一个请求对象,每个接口都会对应一个request对象 GetEidTokenRequest req = new GetEidTokenRequest(); + req.setMerchantId(merchantId); // 返回的resp是一个GetEidTokenResponse的实例,与请求对象对应 GetEidTokenResponse resp = client.GetEidToken(req); // 输出json格式的字符串回包 - System.out.println(GetEidTokenResponse.toJsonString(resp)); String respJSON = GetEidTokenResponse.toJsonString(resp); objJSON = JSON.parseObject(respJSON); } catch (TencentCloudSDKException e) { @@ -87,9 +115,37 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication return objJSON; } + /** + * 解密用户信息 + */ + public JSONObject DecodeUserInfo(String deskey, String userInfo) { + JSONObject parse = null; + try { + byte[] desKeyBytes = Base64.decode(deskey); + final SM2 sm2 = new SM2(privateKeyHexDecodeinfo, null, null); + sm2.usePlainEncoding(); + byte[] sm4KeyBytes = sm2.decrypt(desKeyBytes); + SymmetricCrypto sm4 = SmUtil.sm4(sm4KeyBytes); + byte[] plaintext = sm4.decrypt(Base64.decode(userInfo)); + if (plaintext != null && plaintext.length > 0) { + String s = new String(plaintext); + parse = JSON.parseObject(s); + } + } catch (Exception e) { + System.out.println(e.toString()); + } + return parse; + } + + /** + * 小程序人脸核身后查询身份认证结果 + * + * @param ientityAuthentication + * @return + */ @Override @Transactional - public JSONObject selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication) { + public AjaxResult selectIdentityAuthenticaRespon(IdentityAuthentication ientityAuthentication) { String eidToken = ientityAuthentication.getEidToken(); try { @@ -108,10 +164,53 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication // 返回的resp是一个GetEidResultResponse的实例,与请求对象对应 GetEidResultResponse resp = client.GetEidResult(req); // 输出json格式的字符串回包 - System.out.println(GetEidResultResponse.toJsonString(resp)); String s = GetEidResultResponse.toJsonString(resp); - JSONObject object = JSON.parseObject(s); - return object; + JSONObject objJSON = JSON.parseObject(s); + //查看是否核验成功 + JSONObject text = objJSON.getJSONObject("Text"); + if (text != null) { + Integer comparestatus = text.getInteger("Comparestatus"); + if (comparestatus != null && comparestatus == 0) { + JSONObject eidInfo = objJSON.getJSONObject("EidInfo"); + if (eidInfo != null) { + String desKey = eidInfo.getString("DesKey"); + String userInfo = eidInfo.getString("UserInfo"); + //1.解密用户的信息 + JSONObject info = DecodeUserInfo(desKey, userInfo); + if (info != null) { + String idcardno = info.getString("idnum"); + String name = info.getString("name"); + //2.在用户认证表中插入用户认证记录 + LoginUser loginUser = SecurityUtils.getLoginUser(); + IdentityAuthentication authentication = new IdentityAuthentication(); + /** + * 用户名 + * 用户名id + * 姓名 + * 身份证号 + * 认证时间 + * 认证状态0表示成功 + * 请求id + */ + authentication.setUserName(loginUser.getUsername()); + authentication.setUserId(loginUser.getUserId()); + authentication.setName(name); + authentication.setIdentityNo(idcardno); + authentication.setCertificationTime(new Date()); + authentication.setCertificationStatus(0); + authentication.setRequestId(objJSON.getString("RequestId")); + try { + identityAuthenticationMapper.insertIdentityAuthentication(authentication); + } catch (Exception e) { + System.out.println("认证记录新增失败"); + } + + } + + } + } + } + return AjaxResult.success(); } catch (TencentCloudSDKException e) { System.out.println(e.toString()); } From 5e0a84ae10c590626907b3cca5108977c9ab4d86 Mon Sep 17 00:00:00 2001 From: gy b Date: Wed, 11 Oct 2023 19:14:55 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=9E=E5=90=8D?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E8=AE=B0=E5=BD=95=E5=AD=98=E5=82=A8SQL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/wisdomarbitrate/CaseEvidenceController.java | 2 -- .../service/impl/IdentityAuthenticationServiceImpl.java | 2 +- .../mapper/wisdomarbitrate/IdentityAuthenticationMapper.xml | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java index 50527dc..d60267e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java @@ -36,7 +36,6 @@ public class CaseEvidenceController extends BaseController { * @return */ @GetMapping("/{id}") - @PreAuthorize("@ss.hasPermi('caseManagement:list:detail')") public AjaxResult getCaseDetailsById(@PathVariable Long id) { String username = this.getUsername(); return caseEvidenceService.getCaseDetailsById(id,username); @@ -63,7 +62,6 @@ public class CaseEvidenceController extends BaseController { * @return */ @GetMapping("/all") - @PreAuthorize("@ss.hasPermi('caseManagement:list')") public TableDataInfo getCaseListAll(@RequestParam String identityNum) { startPage(); List list = caseEvidenceService.getCaseListAll(identityNum); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java index b842f92..168a223 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/IdentityAuthenticationServiceImpl.java @@ -198,7 +198,7 @@ public class IdentityAuthenticationServiceImpl implements IdentityAuthentication authentication.setIdentityNo(idcardno); authentication.setCertificationTime(new Date()); authentication.setCertificationStatus(0); - authentication.setRequestId(objJSON.getString("RequestId")); + authentication.setCreateBy(loginUser.getUsername()); try { identityAuthenticationMapper.insertIdentityAuthentication(authentication); } catch (Exception e) { diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/IdentityAuthenticationMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/IdentityAuthenticationMapper.xml index 9132c83..ebd2422 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/IdentityAuthenticationMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/IdentityAuthenticationMapper.xml @@ -20,7 +20,7 @@ name, identity_no, certification_time, - certification_status, + certification_status, user_name, create_by, create_time From 8ceaf7478c76109b18a99b15efb6fe3a2ed3b5f4 Mon Sep 17 00:00:00 2001 From: gy b Date: Wed, 11 Oct 2023 19:54:13 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=9F=A5=E8=AF=A2=E6=A1=88=E4=BB=B6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wisdomarbitrate/CaseEvidenceController.java | 13 ++++++++----- .../service/impl/CaseEvidenceServiceImpl.java | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java index d60267e..3a408ca 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseEvidenceController.java @@ -38,7 +38,7 @@ public class CaseEvidenceController extends BaseController { @GetMapping("/{id}") public AjaxResult getCaseDetailsById(@PathVariable Long id) { String username = this.getUsername(); - return caseEvidenceService.getCaseDetailsById(id,username); + return caseEvidenceService.getCaseDetailsById(id, username); } /** @@ -53,16 +53,17 @@ public class CaseEvidenceController extends BaseController { public AjaxResult uploadEvidence(@RequestParam("file") MultipartFile file, Integer annexType, Long id) { String username = this.getUsername(); Long userId = this.getUserId(); - return caseEvidenceService.uploadEvidence(file, annexType, id,username,userId); + return caseEvidenceService.uploadEvidence(file, annexType, id, username, userId); } /** * 查询当前用户案件列表 + * * @param identityNum * @return */ @GetMapping("/all") - public TableDataInfo getCaseListAll(@RequestParam String identityNum) { + public TableDataInfo getCaseListAll(@RequestParam(required = false) String identityNum) { startPage(); List list = caseEvidenceService.getCaseListAll(identityNum); if (list != null) { @@ -73,21 +74,23 @@ public class CaseEvidenceController extends BaseController { /** * 证据确认 + * * @param caseApplication 案件对象 * @return 统一返回结果 */ @PutMapping("/confirm") - public AjaxResult evidenceConfirmation(@Validated @RequestBody CaseApplication caseApplication){ + public AjaxResult evidenceConfirmation(@Validated @RequestBody CaseApplication caseApplication) { return caseEvidenceService.evidenceConfirmation(caseApplication); } /** * 案件质证 + * * @param caseEvidenceDTO * @return */ @PostMapping("/crossexami") - public AjaxResult caseCrossexamination(@Validated @RequestBody CaseEvidenceDTO caseEvidenceDTO){ + public AjaxResult caseCrossexamination(@Validated @RequestBody CaseEvidenceDTO caseEvidenceDTO) { return caseEvidenceService.caseCrossexamination(caseEvidenceDTO); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java index 70f462b..5a31a39 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseEvidenceServiceImpl.java @@ -3,6 +3,9 @@ package com.ruoyi.wisdomarbitrate.service.impl; 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.model.LoginUser; +import com.ruoyi.common.utils.SecurityUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.wisdomarbitrate.domain.*; @@ -118,10 +121,21 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService { return AjaxResult.error("上传失败"); } - +@Autowired +IdentityAuthenticationMapper identityAuthenticationMapper; @Override public List getCaseListAll(String identityNum) { + if(StringUtils.isBlank(identityNum)){ + LoginUser loginUser = SecurityUtils.getLoginUser(); + String username = loginUser.getUsername(); + IdentityAuthentication authentication=new IdentityAuthentication(); + authentication.setUserName(username); + IdentityAuthentication authentication1 = identityAuthenticationMapper.selectIdentityAuthentication(authentication); + if(authentication1!=null){ + identityNum = authentication1.getIdentityNo(); + } + } List caseStatusList = Arrays.asList(CaseApplicationConstants.CASE_CROSSEXAMI); return getCaseEvidenceVOList(identityNum, caseStatusList, null); }