diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java index 839739a..d5b9ec7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/DeptIdentifyController.java @@ -29,6 +29,26 @@ public class DeptIdentifyController extends BaseController { return deptIdentifyService.insertDeptIdentify(deptIdentify); } + /** + * 删除机构 + * @param id + * @return + */ + @DeleteMapping("/delete") + public AjaxResult deleteDeptIdentify(Long id){ + return deptIdentifyService.deleteDeptIdentify(id); + } + + /** + * 修改机构信息 + * @param deptIdentify + * @return + */ + @PutMapping("/update") + public AjaxResult updateDeptIdentify(@RequestBody DeptIdentify deptIdentify){ + return deptIdentifyService.updateDeptIdentify(deptIdentify); + } + /** * 查询机构信息 */ @@ -64,8 +84,8 @@ public class DeptIdentifyController extends BaseController { * @return */ @PostMapping("/sealUpload") - public AjaxResult sealUpload(Long id, @RequestParam("file") MultipartFile file) { - return deptIdentifyService.sealUpload(id, file); + public AjaxResult sealUpload(Long id, String sealName , @RequestParam("file") MultipartFile file) { + return deptIdentifyService.sealUpload(id, sealName ,file); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java index e34c90d..22b369e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/DeptIdentify.java @@ -37,4 +37,7 @@ public class DeptIdentify extends BaseEntity { private Integer identifyType; + /** 删除标志(0代表存在 2代表删除) */ + private Integer delFlag; + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java index f0174d5..1a0f3fa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SealListVO.java @@ -4,6 +4,8 @@ import lombok.Data; @Data public class SealListVO { + /** 主键 */ + private Long id; /** 印章id */ private String sealId; /** 印章名称 */ diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java index 00de51c..3b0db23 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/IDeptIdentifyService.java @@ -19,7 +19,7 @@ public interface IDeptIdentifyService { AjaxResult enableDept(DeptIdentify deptIdentify); - AjaxResult sealUpload(Long id,MultipartFile file); + AjaxResult sealUpload(Long id,String sealName ,MultipartFile file); AjaxResult receiveNotify(String body); @@ -31,4 +31,7 @@ public interface IDeptIdentifyService { AjaxResult insertDeptIdentify(DeptIdentify deptIdentify); + AjaxResult deleteDeptIdentify(Long id); + + AjaxResult updateDeptIdentify(DeptIdentify deptIdentify); } 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 065c1b3..4c0e806 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 @@ -1725,9 +1725,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { for (CaseAttach caseAttach : caseAttachList) { if (caseAttach.getAnnexType() == 3) { String annexPath = caseAttach.getAnnexPath(); - //String path = "/home/ruoyi" + annexPath; + String path = "/home/ruoyi" + annexPath; // System.out.println("这是查询到的裁决书路径" + path); - String path = "D:\\home\\仲裁裁决书模板.docx"; + //String path = "D:\\home\\仲裁裁决书模板.docx"; //获取文件上传地址 EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); String body = response.getBody(); @@ -1873,8 +1873,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } else { throw new ServiceException("发起签署流程失败,请检查参数是否有误"); } + }else { + return AjaxResult.error(); } - return AjaxResult.error(); + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java index 8ca2400..538994f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/DeptIdentifyServiceImpl.java @@ -7,9 +7,13 @@ import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.constant.FileTransformation; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.EsignHttpResponse; +import com.ruoyi.common.core.domain.entity.SysDept; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.utils.SealUtil; import com.ruoyi.common.utils.file.FileUploadUtils; +import com.ruoyi.system.mapper.SysDeptMapper; +import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.wisdomarbitrate.domain.CaseAttach; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.SealManage; @@ -27,10 +31,7 @@ import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.time.LocalDate; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.UUID; +import java.util.*; @Service public class DeptIdentifyServiceImpl implements IDeptIdentifyService { @@ -41,6 +42,10 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { private CaseAttachMapper caseAttachMapper; @Autowired private SealManageMapper sealManageMapper; + @Autowired + private SysDeptMapper sysDeptMapper; + @Autowired + private SysUserMapper sysUserMapper; @Override @@ -106,7 +111,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { } @Override - public AjaxResult sealUpload(Long id, MultipartFile file) { + public AjaxResult sealUpload(Long id, String sealName, MultipartFile file) { try { if (file.isEmpty()) { return AjaxResult.error("请选择要上传的文件"); @@ -133,8 +138,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { startIndex += prefix.length(); String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex); //创建机构图片印章 - // String annexPath = "D:\\develop\\2.jpg"; - String sealName = "自定义" + UUID.randomUUID() + ""; //自定义印章印章名称不能重复,所以用UUID确保唯一性 + //String annexPath = "D:\\develop\\2.jpg"; + EsignHttpResponse response = SignAward.createOrgByImage(identify, sealName, annexPath); JSONObject jsonObject = JSONObject.parseObject(response.getBody()); int code = jsonObject.getIntValue("code"); @@ -152,7 +157,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { return AjaxResult.success("上传成功"); } } - return AjaxResult.error("公章上传失败,请检查参数"); + return AjaxResult.error(jsonObject.getString("message")); } return AjaxResult.error("企业用户未授予资源管理权限"); } @@ -257,14 +262,15 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { List sealListVOS = new ArrayList<>(); if (selectSealList != null && selectSealList.size() > 0) { for (SealManage sealManage1 : selectSealList) { - Integer sealStatus = sealManage1.getSealStatus(); - if (sealStatus == 1) { //审核状态为启用 - SealListVO sealListVO = new SealListVO(); - sealListVO.setSealId(sealManage1.getSealId()); - sealListVO.setSealName(sealManage1.getSealName()); - sealListVO.setSealStatus(sealManage1.getSealStatus()); + SealListVO sealListVO = new SealListVO(); + sealListVO.setId(sealManage1.getId()); + sealListVO.setSealId(sealManage1.getSealId()); + sealListVO.setSealName(sealManage1.getSealName()); + sealListVO.setSealStatus(sealManage1.getSealStatus()); + Integer annexId = sealManage1.getAnnexId(); + if (annexId != null) { //根据附件id查询路径 - CaseAttach caseAttach = caseAttachMapper.queryAnnexById(sealManage1.getAnnexId()); + CaseAttach caseAttach = caseAttachMapper.queryAnnexById(annexId); String annexName = caseAttach.getAnnexName(); String prefix = "/profile"; int startIndex = annexName.indexOf(prefix); @@ -272,9 +278,12 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { String annexPath = "/uploadPath" + annexName.substring(startIndex); sealListVO.setAnnexPath(annexPath); sealListVO.setAnnexType(caseAttach.getAnnexType()); - sealListVO.setIsUse(sealManage1.getIsUse()); - sealListVOS.add(sealListVO); + } else { + sealListVO.setAnnexPath(null); + sealListVO.setAnnexType(null); } + sealListVO.setIsUse(sealManage1.getIsUse()); + sealListVOS.add(sealListVO); } } return sealListVOS; @@ -309,8 +318,74 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService { deptIdentify.setIsUse(0); //设置机构默认为未启用 int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify); if (i > 0) { + //将机构名称保存到部门表里 + SysDept sysDept = new SysDept(); + sysDept.setDeptName(identifyName); + sysDept.setParentId(0L); + sysDept.setDeptType(1); + int i1 = sysDeptMapper.insertDept(sysDept); + if (i1 > 0) { + //将经办人信息存入到用户表里 + Long deptId = sysDept.getDeptId(); + SysUser sysUser = new SysUser(); + sysUser.setDeptId(deptId); + sysUser.setUserName(generateUniqueUsername());//设置默认的用户名 + sysUser.setNickName(operName); + sysUser.setPhonenumber(operPhone); + sysUserMapper.insertUser(sysUser); + } + return AjaxResult.success("新增成功"); } return AjaxResult.error(); } + + @Override + public AjaxResult deleteDeptIdentify(Long id) { + DeptIdentify deptIdentify = new DeptIdentify(); + deptIdentify.setId(id); + deptIdentify.setDelFlag(2); + int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify); + if (i > 0) { + return AjaxResult.success("删除成功"); + } + return AjaxResult.error(); + } + + @Override + public AjaxResult updateDeptIdentify(DeptIdentify deptIdentify) { + Long id = deptIdentify.getId(); + if (id == null) { + return AjaxResult.error(); + } + DeptIdentify deptIdentifyNew = new DeptIdentify(); + deptIdentifyNew.setId(id); + List deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentifyNew); + if (deptIdentifies != null && deptIdentifies.size() > 0) { + DeptIdentify deptIdentify1 = deptIdentifies.get(0); + if (deptIdentify1.getIdentifyStatus() == 1) { + return AjaxResult.error("已认证的机构不允许修改"); + } + int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify); + if (i > 0) { + return AjaxResult.success("修改成功"); + } + } + return null; + } + + private String generateUniqueUsername() { + final Random random = new Random(); + final Set generatedUsernames = new HashSet<>(); + while (true) { + int min = 000000; // 最小的六位数 + int max = 999999; // 最大的六位数 + int randomNum = random.nextInt(max - min + 1) + min; + if (!generatedUsernames.contains(randomNum)) { + generatedUsernames.add(String.valueOf(randomNum)); + return String.valueOf(randomNum); + } + } + } + } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java index b363d35..4824820 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/FixSelectFlowDetailUtils.java @@ -43,7 +43,7 @@ public class FixSelectFlowDetailUtils { /* 定时查询签署流程详情 */ - //@Scheduled(cron = "0/10 * * * * ?") + @Scheduled(cron = "0/10 * * * * ?") @Transactional public void fixExecuteSelectFlowDetailUtils() { Gson gson = new Gson(); @@ -177,7 +177,7 @@ public class FixSelectFlowDetailUtils { * * @throws Exception */ - //@Scheduled(cron = "*/30 * * * * *") + @Scheduled(cron = "*/30 * * * * *") @Transactional public void fixExecuteSelectDeptIndentifyUtils() throws Exception { Gson gson = new Gson(); diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml index 82d7a1d..8c2d2be 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/DeptIdentifyMapper.xml @@ -14,6 +14,7 @@ + @@ -42,6 +43,7 @@ AND oper_phone = #{operPhone} AND identify_type = 1 + AND del_flag =0 @@ -55,9 +57,9 @@ org_id, oper_name, oper_phone, - identify_type - auth_flow_id - + identify_type, + auth_flow_id, + del_flag )values( #{identifyName}, #{identifyStatus}, @@ -66,8 +68,9 @@ #{orgId}, #{operName}, #{operPhone}, - #{identifyType} - #{authFlowId} + #{identifyType}, + #{authFlowId}, + 0 ) @@ -83,6 +86,9 @@ is_use = #{isUse}, identify_status = #{identifyStatus}, org_id = #{orgId}, + del_flag = #{delFlag}, + oper_name = #{operName}, + oper_phone = #{operPhone}, auth_flow_id = #{authFlowId}