This commit is contained in:
hejinbo
2023-11-17 14:25:03 +08:00
parent 8bb2a6f327
commit 2557d57508
8 changed files with 141 additions and 30 deletions
@@ -29,6 +29,26 @@ public class DeptIdentifyController extends BaseController {
return deptIdentifyService.insertDeptIdentify(deptIdentify); 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 * @return
*/ */
@PostMapping("/sealUpload") @PostMapping("/sealUpload")
public AjaxResult sealUpload(Long id, @RequestParam("file") MultipartFile file) { public AjaxResult sealUpload(Long id, String sealName , @RequestParam("file") MultipartFile file) {
return deptIdentifyService.sealUpload(id, file); return deptIdentifyService.sealUpload(id, sealName ,file);
} }
/** /**
@@ -37,4 +37,7 @@ public class DeptIdentify extends BaseEntity {
private Integer identifyType; private Integer identifyType;
/** 删除标志(0代表存在 2代表删除) */
private Integer delFlag;
} }
@@ -4,6 +4,8 @@ import lombok.Data;
@Data @Data
public class SealListVO { public class SealListVO {
/** 主键 */
private Long id;
/** 印章id */ /** 印章id */
private String sealId; private String sealId;
/** 印章名称 */ /** 印章名称 */
@@ -19,7 +19,7 @@ public interface IDeptIdentifyService {
AjaxResult enableDept(DeptIdentify deptIdentify); AjaxResult enableDept(DeptIdentify deptIdentify);
AjaxResult sealUpload(Long id,MultipartFile file); AjaxResult sealUpload(Long id,String sealName ,MultipartFile file);
AjaxResult receiveNotify(String body); AjaxResult receiveNotify(String body);
@@ -31,4 +31,7 @@ public interface IDeptIdentifyService {
AjaxResult insertDeptIdentify(DeptIdentify deptIdentify); AjaxResult insertDeptIdentify(DeptIdentify deptIdentify);
AjaxResult deleteDeptIdentify(Long id);
AjaxResult updateDeptIdentify(DeptIdentify deptIdentify);
} }
@@ -1725,9 +1725,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
for (CaseAttach caseAttach : caseAttachList) { for (CaseAttach caseAttach : caseAttachList) {
if (caseAttach.getAnnexType() == 3) { if (caseAttach.getAnnexType() == 3) {
String annexPath = caseAttach.getAnnexPath(); String annexPath = caseAttach.getAnnexPath();
//String path = "/home/ruoyi" + annexPath; String path = "/home/ruoyi" + annexPath;
// System.out.println("这是查询到的裁决书路径" + path); // System.out.println("这是查询到的裁决书路径" + path);
String path = "D:\\home\\仲裁裁决书模板.docx"; //String path = "D:\\home\\仲裁裁决书模板.docx";
//获取文件上传地址 //获取文件上传地址
EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path); EsignHttpResponse response = SaaSAPIFileUtils.getUploadUrl(path);
String body = response.getBody(); String body = response.getBody();
@@ -1873,10 +1873,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
} else { } else {
throw new ServiceException("发起签署流程失败,请检查参数是否有误"); throw new ServiceException("发起签署流程失败,请检查参数是否有误");
} }
} }else {
return AjaxResult.error(); return AjaxResult.error();
} }
}
} else { } else {
return AjaxResult.error(); return AjaxResult.error();
@@ -7,9 +7,13 @@ import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.FileTransformation; import com.ruoyi.common.constant.FileTransformation;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse; 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.exception.EsignDemoException;
import com.ruoyi.common.utils.SealUtil; import com.ruoyi.common.utils.SealUtil;
import com.ruoyi.common.utils.file.FileUploadUtils; 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.CaseAttach;
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify; import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
import com.ruoyi.wisdomarbitrate.domain.SealManage; import com.ruoyi.wisdomarbitrate.domain.SealManage;
@@ -27,10 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@Service @Service
public class DeptIdentifyServiceImpl implements IDeptIdentifyService { public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
@@ -41,6 +42,10 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
private CaseAttachMapper caseAttachMapper; private CaseAttachMapper caseAttachMapper;
@Autowired @Autowired
private SealManageMapper sealManageMapper; private SealManageMapper sealManageMapper;
@Autowired
private SysDeptMapper sysDeptMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Override @Override
@@ -106,7 +111,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
} }
@Override @Override
public AjaxResult sealUpload(Long id, MultipartFile file) { public AjaxResult sealUpload(Long id, String sealName, MultipartFile file) {
try { try {
if (file.isEmpty()) { if (file.isEmpty()) {
return AjaxResult.error("请选择要上传的文件"); return AjaxResult.error("请选择要上传的文件");
@@ -134,7 +139,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex); String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
//创建机构图片印章 //创建机构图片印章
//String annexPath = "D:\\develop\\2.jpg"; //String annexPath = "D:\\develop\\2.jpg";
String sealName = "自定义" + UUID.randomUUID() + ""; //自定义印章印章名称不能重复,所以用UUID确保唯一性
EsignHttpResponse response = SignAward.createOrgByImage(identify, sealName, annexPath); EsignHttpResponse response = SignAward.createOrgByImage(identify, sealName, annexPath);
JSONObject jsonObject = JSONObject.parseObject(response.getBody()); JSONObject jsonObject = JSONObject.parseObject(response.getBody());
int code = jsonObject.getIntValue("code"); int code = jsonObject.getIntValue("code");
@@ -152,7 +157,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
return AjaxResult.success("上传成功"); return AjaxResult.success("上传成功");
} }
} }
return AjaxResult.error("公章上传失败,请检查参数"); return AjaxResult.error(jsonObject.getString("message"));
} }
return AjaxResult.error("企业用户未授予资源管理权限"); return AjaxResult.error("企业用户未授予资源管理权限");
} }
@@ -257,14 +262,15 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
List<SealListVO> sealListVOS = new ArrayList<>(); List<SealListVO> sealListVOS = new ArrayList<>();
if (selectSealList != null && selectSealList.size() > 0) { if (selectSealList != null && selectSealList.size() > 0) {
for (SealManage sealManage1 : selectSealList) { for (SealManage sealManage1 : selectSealList) {
Integer sealStatus = sealManage1.getSealStatus();
if (sealStatus == 1) { //审核状态为启用
SealListVO sealListVO = new SealListVO(); SealListVO sealListVO = new SealListVO();
sealListVO.setId(sealManage1.getId());
sealListVO.setSealId(sealManage1.getSealId()); sealListVO.setSealId(sealManage1.getSealId());
sealListVO.setSealName(sealManage1.getSealName()); sealListVO.setSealName(sealManage1.getSealName());
sealListVO.setSealStatus(sealManage1.getSealStatus()); sealListVO.setSealStatus(sealManage1.getSealStatus());
Integer annexId = sealManage1.getAnnexId();
if (annexId != null) {
//根据附件id查询路径 //根据附件id查询路径
CaseAttach caseAttach = caseAttachMapper.queryAnnexById(sealManage1.getAnnexId()); CaseAttach caseAttach = caseAttachMapper.queryAnnexById(annexId);
String annexName = caseAttach.getAnnexName(); String annexName = caseAttach.getAnnexName();
String prefix = "/profile"; String prefix = "/profile";
int startIndex = annexName.indexOf(prefix); int startIndex = annexName.indexOf(prefix);
@@ -272,11 +278,14 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
String annexPath = "/uploadPath" + annexName.substring(startIndex); String annexPath = "/uploadPath" + annexName.substring(startIndex);
sealListVO.setAnnexPath(annexPath); sealListVO.setAnnexPath(annexPath);
sealListVO.setAnnexType(caseAttach.getAnnexType()); sealListVO.setAnnexType(caseAttach.getAnnexType());
} else {
sealListVO.setAnnexPath(null);
sealListVO.setAnnexType(null);
}
sealListVO.setIsUse(sealManage1.getIsUse()); sealListVO.setIsUse(sealManage1.getIsUse());
sealListVOS.add(sealListVO); sealListVOS.add(sealListVO);
} }
} }
}
return sealListVOS; return sealListVOS;
} }
@@ -309,8 +318,74 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
deptIdentify.setIsUse(0); //设置机构默认为未启用 deptIdentify.setIsUse(0); //设置机构默认为未启用
int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify); int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify);
if (i > 0) { 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.success("新增成功");
} }
return AjaxResult.error(); 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<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentifyNew);
if (deptIdentifies != null && deptIdentifies.size() > 0) {
DeptIdentify deptIdentify1 = deptIdentifies.get(0);
if (deptIdentify1.getIdentifyStatus() == 1) {
return AjaxResult.error("已认证的机构不允许修改");
}
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
if (i > 0) {
return AjaxResult.success("修改成功");
}
}
return null;
}
private String generateUniqueUsername() {
final Random random = new Random();
final Set<String> 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);
}
}
}
} }
@@ -43,7 +43,7 @@ public class FixSelectFlowDetailUtils {
/* /*
定时查询签署流程详情 定时查询签署流程详情
*/ */
//@Scheduled(cron = "0/10 * * * * ?") @Scheduled(cron = "0/10 * * * * ?")
@Transactional @Transactional
public void fixExecuteSelectFlowDetailUtils() { public void fixExecuteSelectFlowDetailUtils() {
Gson gson = new Gson(); Gson gson = new Gson();
@@ -177,7 +177,7 @@ public class FixSelectFlowDetailUtils {
* *
* @throws Exception * @throws Exception
*/ */
//@Scheduled(cron = "*/30 * * * * *") @Scheduled(cron = "*/30 * * * * *")
@Transactional @Transactional
public void fixExecuteSelectDeptIndentifyUtils() throws Exception { public void fixExecuteSelectDeptIndentifyUtils() throws Exception {
Gson gson = new Gson(); Gson gson = new Gson();
@@ -14,6 +14,7 @@
<result property="operName" column="oper_name" /> <result property="operName" column="oper_name" />
<result property="operPhone" column="oper_phone" /> <result property="operPhone" column="oper_phone" />
<result property="identifyType" column="identify_type" /> <result property="identifyType" column="identify_type" />
<result property="delFlag" column="del_flag" />
</resultMap> </resultMap>
@@ -42,6 +43,7 @@
AND oper_phone = #{operPhone} AND oper_phone = #{operPhone}
</if> </if>
AND identify_type = 1 AND identify_type = 1
AND del_flag =0
</where> </where>
</select> </select>
@@ -55,9 +57,9 @@
<if test="orgId != null and orgId != ''">org_id,</if> <if test="orgId != null and orgId != ''">org_id,</if>
<if test="operName != null and operName != ''">oper_name,</if> <if test="operName != null and operName != ''">oper_name,</if>
<if test="operPhone != null and operPhone != ''">oper_phone,</if> <if test="operPhone != null and operPhone != ''">oper_phone,</if>
<if test="identifyType != null">identify_type</if> <if test="identifyType != null">identify_type,</if>
<if test="authFlowId != null and authFlowId != ''">auth_flow_id</if> <if test="authFlowId != null and authFlowId != ''">auth_flow_id,</if>
del_flag
)values( )values(
<if test="identifyName != null and identifyName != ''">#{identifyName},</if> <if test="identifyName != null and identifyName != ''">#{identifyName},</if>
<if test="identifyStatus != null">#{identifyStatus},</if> <if test="identifyStatus != null">#{identifyStatus},</if>
@@ -66,8 +68,9 @@
<if test="orgId != null and orgId != ''">#{orgId},</if> <if test="orgId != null and orgId != ''">#{orgId},</if>
<if test="operName != null and operName != ''">#{operName},</if> <if test="operName != null and operName != ''">#{operName},</if>
<if test="operPhone != null and operPhone != ''">#{operPhone},</if> <if test="operPhone != null and operPhone != ''">#{operPhone},</if>
<if test="identifyType != null ">#{identifyType}</if> <if test="identifyType != null ">#{identifyType},</if>
<if test="authFlowId != null and authFlowId != '' ">#{authFlowId}</if> <if test="authFlowId != null and authFlowId != '' ">#{authFlowId},</if>
0
) )
</insert> </insert>
@@ -83,6 +86,9 @@
<if test="isUse != null">is_use = #{isUse},</if> <if test="isUse != null">is_use = #{isUse},</if>
<if test="identifyStatus != null ">identify_status = #{identifyStatus},</if> <if test="identifyStatus != null ">identify_status = #{identifyStatus},</if>
<if test="orgId != null and orgId != ''">org_id = #{orgId},</if> <if test="orgId != null and orgId != ''">org_id = #{orgId},</if>
<if test="delFlag != null ">del_flag = #{delFlag},</if>
<if test="operName != null ">oper_name = #{operName},</if>
<if test="operPhone != null ">oper_phone = #{operPhone},</if>
<if test="authFlowId != null and authFlowId != '' ">auth_flow_id = #{authFlowId}</if> <if test="authFlowId != null and authFlowId != '' ">auth_flow_id = #{authFlowId}</if>
</set> </set>
<where> <where>