公章管理修改代码 #218

Merged
hejinbo merged 2 commits from hjb into dev 2023-11-17 06:27:35 +00:00
8 changed files with 141 additions and 30 deletions
@@ -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);
}
/**
@@ -37,4 +37,7 @@ public class DeptIdentify extends BaseEntity {
private Integer identifyType;
/** 删除标志(0代表存在 2代表删除) */
private Integer delFlag;
}
@@ -4,6 +4,8 @@ import lombok.Data;
@Data
public class SealListVO {
/** 主键 */
private Long id;
/** 印章id */
private String sealId;
/** 印章名称 */
@@ -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);
}
@@ -1734,9 +1734,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();
@@ -1882,8 +1882,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
} else {
throw new ServiceException("发起签署流程失败,请检查参数是否有误");
}
}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.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<SealListVO> 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<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
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();
@@ -14,6 +14,7 @@
<result property="operName" column="oper_name" />
<result property="operPhone" column="oper_phone" />
<result property="identifyType" column="identify_type" />
<result property="delFlag" column="del_flag" />
</resultMap>
@@ -42,6 +43,7 @@
AND oper_phone = #{operPhone}
</if>
AND identify_type = 1
AND del_flag =0
</where>
</select>
@@ -55,9 +57,9 @@
<if test="orgId != null and orgId != ''">org_id,</if>
<if test="operName != null and operName != ''">oper_name,</if>
<if test="operPhone != null and operPhone != ''">oper_phone,</if>
<if test="identifyType != null">identify_type</if>
<if test="authFlowId != null and authFlowId != ''">auth_flow_id</if>
<if test="identifyType != null">identify_type,</if>
<if test="authFlowId != null and authFlowId != ''">auth_flow_id,</if>
del_flag
)values(
<if test="identifyName != null and identifyName != ''">#{identifyName},</if>
<if test="identifyStatus != null">#{identifyStatus},</if>
@@ -66,8 +68,9 @@
<if test="orgId != null and orgId != ''">#{orgId},</if>
<if test="operName != null and operName != ''">#{operName},</if>
<if test="operPhone != null and operPhone != ''">#{operPhone},</if>
<if test="identifyType != null ">#{identifyType}</if>
<if test="authFlowId != null and authFlowId != '' ">#{authFlowId}</if>
<if test="identifyType != null ">#{identifyType},</if>
<if test="authFlowId != null and authFlowId != '' ">#{authFlowId},</if>
0
)
</insert>
@@ -83,6 +86,9 @@
<if test="isUse != null">is_use = #{isUse},</if>
<if test="identifyStatus != null ">identify_status = #{identifyStatus},</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>
</set>
<where>