机构管理.公章管理优化

This commit is contained in:
hejinbo
2023-11-15 18:27:09 +08:00
parent 044cffeb7f
commit 8b0eae8dca
13 changed files with 495 additions and 554 deletions
@@ -115,6 +115,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private ReservedConferenceMapper reservedConferenceMapper;
@Autowired
private SysDeptMapper deptMapper;
@Autowired
private SealManageMapper sealManageMapper;
// 手机号正则
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}$");
@@ -177,7 +179,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
deptIds.add(sysUser.getDeptId());
caseApplication.setDeptIds(deptIds);
}
if ( role.getRoleName().equals("申请人")) {
if (role.getRoleName().equals("申请人")) {
// 查询角色有关的用户部门
caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
}
@@ -238,7 +240,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
deptIds.add(sysUser.getDeptId());
caseApplication.setDeptIds(deptIds);
}
if ( role.getRoleName().equals("申请人")) {
if (role.getRoleName().equals("申请人")) {
// 查询角色有关的用户部门
caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
}
@@ -1686,7 +1688,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
if (jsonObject1.getIntValue("errCode") == 0) {
//查看文件上传状态
Thread.sleep(5000);
Thread.sleep(3000);
EsignHttpResponse response2 = SaaSAPIFileUtils.getFileStatus(fileId);
JSONObject jsonObject2 = JSONObject.parseObject(response2.getBody());
JSONObject data = jsonObject2.getJSONObject("data");
@@ -1716,12 +1718,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setIsUse(1);
DeptIdentify deptIdentifyselect = new DeptIdentify();
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
deptIdentifyselect = deptIdentifysnew.get(0);
sealSignRecord.setOrgnizeName(deptIdentifyselect.getDeptName());
sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getPhonenumber());
sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getNickName());
sealSignRecord.setOrgnizeName(deptIdentifyselect.getIdentifyName());
sealSignRecord.setOrgnizeNamePsnAccount(deptIdentifyselect.getOperName());
sealSignRecord.setOrgnizeNamepsnName(deptIdentifyselect.getOperPhone());
} else {
return AjaxResult.error("没有用印时的机构名称及经办人信息");
}
@@ -1781,19 +1783,45 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
sealIds.add(sealId);
}
}*/
EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord);
JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
if (jsonObject3.getIntValue("code") == 0) {
//获取签署流程ID
JSONObject data1 = jsonObject3.getJSONObject("data");
String signFlowId = data1.getString("signFlowId");
//保存案件id,文件id,文件名称.流程id到签署用印记录表里
sealSignRecord.setCaseAppliId(caseApplication.getId());
sealSignRecord.setSignFlowid(signFlowId);
sealSignRecord.setSignFlowStatus(1);//待签名
sealSignRecordMapper.insertSealSignRecord(sealSignRecord);
} else {
throw new ServiceException("发起签署流程失败,请检查参数是否有误");
String orgnizeName = sealSignRecord.getOrgnizeName(); //机构名称
String orgnizeNamepsnName = sealSignRecord.getOrgnizeNamepsnName(); //机构经办人姓名
String orgnizeNamePsnAccount = sealSignRecord.getOrgnizeNamePsnAccount(); //机构经办人联系方式
//查询机构信息
DeptIdentify deptIdentify1 = new DeptIdentify();
deptIdentify1.setIdentifyName(orgnizeName);
deptIdentify1.setOperName(orgnizeNamepsnName);
deptIdentify1.setOperPhone(orgnizeNamePsnAccount);
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify1);
if (deptIdentifies != null && deptIdentifies.size() > 0) {
Long id = deptIdentifies.get(0).getId();
SealManage sealManage = new SealManage();
sealManage.setIdentifyId(id);
List<String> sealIdList = new ArrayList<>();
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
if (selectSealList != null && selectSealList.size() > 0) {
for (SealManage manage : selectSealList) {
Integer sealStatus = manage.getSealStatus();
if (sealStatus == 1){
sealIdList.add(manage.getSealId());
}
}
EsignHttpResponse response3 = SignAward.createByFile(sealSignRecord,sealIdList);
JSONObject jsonObject3 = JSONObject.parseObject(response3.getBody());
if (jsonObject3.getIntValue("code") == 0) {
//获取签署流程ID
JSONObject data1 = jsonObject3.getJSONObject("data");
String signFlowId = data1.getString("signFlowId");
//保存案件id,文件id,文件名称.流程id到签署用印记录表里
sealSignRecord.setCaseAppliId(caseApplication.getId());
sealSignRecord.setSignFlowid(signFlowId);
sealSignRecord.setSignFlowStatus(1);//待签名
sealSignRecordMapper.insertSealSignRecord(sealSignRecord);
} else {
throw new ServiceException("发起签署流程失败,请检查参数是否有误");
}
}
}
}
}
@@ -2580,7 +2608,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// 新增预约会议表
ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), roomId,
reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime(),1);
reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime(), 1);
reservedConferenceMapper.insert(conference);
return AjaxResult.success("预约会议成功");
@@ -2608,20 +2636,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
String roomId = generateRoomId();
// 新增预约会议表
ReservedConference conference = new ReservedConference(caseId, roomId,
null, null,0);
null, null, 0);
reservedConferenceMapper.insert(conference);
return roomId;
}
/**
* 获取房间号
*
* @return
*/
public String generateRoomId() {
// 查询最大房间号
Integer maxRoomId = caseApplicationMapper.selectMaxRoomId();
if (null == maxRoomId || maxRoomId >999999) {
if (null == maxRoomId || maxRoomId > 999999) {
return "000001";
} else {
return String.format("%06d", maxRoomId);
@@ -2662,13 +2691,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
/**
* 删除房间号
*
* @param roomId
* @return
*/
@Override
public AjaxResult deleteRoom(String roomId) {
return AjaxResult.success( reservedConferenceMapper.deleteByRoomId(roomId));
return AjaxResult.success(reservedConferenceMapper.deleteByRoomId(roomId));
}
}
@@ -12,9 +12,11 @@ import com.ruoyi.common.utils.SealUtil;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
import com.ruoyi.wisdomarbitrate.domain.SealManage;
import com.ruoyi.wisdomarbitrate.domain.vo.SealListVO;
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.mapper.DeptIdentifyMapper;
import com.ruoyi.wisdomarbitrate.mapper.SealManageMapper;
import com.ruoyi.wisdomarbitrate.service.IDeptIdentifyService;
import com.ruoyi.wisdomarbitrate.utils.SignAward;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,33 +39,20 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
private DeptIdentifyMapper deptIdentifyMapper;
@Autowired
private CaseAttachMapper caseAttachMapper;
@Autowired
private SealManageMapper sealManageMapper;
@Override
@Transactional
public List<DeptIdentify> selectDeptIdentify(DeptIdentify deptIdentify) {
List<DeptIdentify> deptIdentifys = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
if (deptIdentifys != null && deptIdentifys.size() > 0) {
for (int i = 0; i < deptIdentifys.size(); i++) {
DeptIdentify deptIdentifyselect = deptIdentifys.get(i);
List<DeptIdentify> deptIdentifylist = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentifyselect);
if (deptIdentifylist != null && deptIdentifylist.size() > 0) {
continue;
} else {
deptIdentifyselect.setIdentifyStatus(0);
deptIdentifyMapper.insertDeptIdentify(deptIdentifyselect);
}
}
}
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
return deptIdentifysnew;
return deptIdentifyMapper.selectDeptIdentify(deptIdentify);
}
@Override
@Transactional
public DeptIdentify selectDeptIndefiUrl(DeptIdentify deptIdentify) throws EsignDemoException {
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
DeptIdentify deptIdentifynew = new DeptIdentify();
if (deptIdentifysnew != null && deptIdentifysnew.size() > 0) {
Gson gson = new Gson();
@@ -71,7 +60,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
int code = signUrlJsonObject.get("code").getAsInt();
if (code == 0){
if (code == 0) {
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String url = signUrlData.get("authUrl").getAsString();
//获取本次认证授权流程ID
@@ -88,34 +77,36 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
@Override
@Transactional
public AjaxResult enableDept(DeptIdentify deptIdentify) {
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentifylist(deptIdentify);
//参数校验
if (deptIdentify.getId() == null) {
return AjaxResult.error("请检查参数");
}
List<DeptIdentify> deptIdentifysnew = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
DeptIdentify deptIdentifyselect = deptIdentifysnew.get(0);
Integer identifyStatus = deptIdentifyselect.getIdentifyStatus();
if (identifyStatus.intValue() == 0) {
return AjaxResult.error("这个认证数据未进行认证,不能启用");
} else if (identifyStatus.intValue() == 1) {
deptIdentifyselect.setIsUse(1);
deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
DeptIdentify deptIdentifySel = new DeptIdentify();
deptIdentifySel.setId(deptIdentify.getId());
deptIdentifySel.setIdentifyStatus(1);
List<DeptIdentify> deptIdentifysother = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentifySel);
if (deptIdentifysother != null && deptIdentifysother.size() > 0) {
for (int i = 0; i < deptIdentifysother.size(); i++) {
DeptIdentify deptIdentifyother = deptIdentifysother.get(i);
deptIdentifyother.setIsUse(0);
deptIdentifyMapper.updateDeptIdentify(deptIdentifyother);
Integer isUse = deptIdentifyselect.getIsUse();
if (isUse == 0) { //机构为未启用状态
Integer identifyStatus = deptIdentifyselect.getIdentifyStatus();
if (identifyStatus == 0) {
return AjaxResult.error("这个认证数据未进行认证,不能启用");
} else {
deptIdentifyselect.setIsUse(1);
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
if (i > 0) {
return AjaxResult.success("启用成功");
}
}
} else { //机构为已启用状态
deptIdentifyselect.setIsUse(0);
int i = deptIdentifyMapper.updateDeptIdentify(deptIdentifyselect);
if (i > 0) {
return AjaxResult.success();
}
}
return AjaxResult.success();
return AjaxResult.error();
}
@Override
public AjaxResult sealUpload(Long id, String sealName , MultipartFile file) {
public AjaxResult sealUpload(Long id, MultipartFile file) {
try {
if (file.isEmpty()) {
return AjaxResult.error("请选择要上传的文件");
@@ -125,11 +116,14 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
String fileName = FileUploadUtils.upload(filePath, file);
DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setId(id);
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentify);
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(deptIdentify);
if (deptIdentifies != null && deptIdentifies.size() > 0) {
for (DeptIdentify identify : deptIdentifies) {
//先判断企业用户是否授予资源管理权限
String authFlowId = identify.getAuthFlowId();
if (authFlowId == null) {
return AjaxResult.error("改机构尚未认证,不能上传自定义公章");
}
EsignHttpResponse response1 = SealUtil.queryAuthProcess(authFlowId);
JSONObject jsonObject1 = JSONObject.parseObject(response1.getBody());
int authorizedStatus = jsonObject1.getJSONObject("data").getIntValue("authorizedStatus");
@@ -137,32 +131,27 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
String prefix = "/profile";
int startIndex = fileName.indexOf(prefix);
startIndex += prefix.length();
//String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
//创建机构图片印章
String annexPath = "D:\\develop\\2.jpg";
identify.setSealName(sealName);
EsignHttpResponse response = SignAward.createOrgByImage(identify, annexPath);
// String annexPath = "D:\\develop\\2.jpg";
String sealName = "自定义" + UUID.randomUUID() + ""; //自定义印章印章名称不能重复,所以用UUID确保唯一性
EsignHttpResponse response = SignAward.createOrgByImage(identify,sealName,annexPath);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
int code = jsonObject.getIntValue("code");
if (code == 0) { //业务码,0表示成功,非0表示异常。
String sealId = jsonObject.getJSONObject("data").getString("sealId");
//保存到表里
DeptIdentify deptIdentify1 = new DeptIdentify();
deptIdentify1.setDeptId(identify.getDeptId());
deptIdentify1.setUserId(identify.getUserId());
deptIdentify1.setIdentifyStatus(identify.getIdentifyStatus());
deptIdentify1.setIdentifyDate(identify.getIdentifyDate());
deptIdentify1.setIsUse(identify.getIsUse());
deptIdentify1.setSealName(sealName);
deptIdentify1.setOrgId(identify.getOrgId());
deptIdentify1.setAuthFlowId(identify.getAuthFlowId());
deptIdentify1.setSealId(sealId);
int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify1);
SealManage sealManage = new SealManage();
sealManage.setIdentifyId(identify.getId());
sealManage.setSealName(sealName);
sealManage.setSealId(sealId);
sealManage.setSealStatus(0); //默认为禁用
int i = sealManageMapper.insertSealManage(sealManage);
if (i > 0) {
return AjaxResult.success("上传成功");
}
}
return AjaxResult.error("公章上传失败,请检查印章名称是否重复");
return AjaxResult.error("公章上传失败,请检查参数");
}
return AjaxResult.error("企业用户未授予资源管理权限");
}
@@ -233,14 +222,14 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
if (i1 > 0) {
//将附件id保存到公章管理表里
Integer annexId1 = caseAttach.getAnnexId();
DeptIdentify identify = new DeptIdentify();
identify.setSealId(sealId);
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentify(identify);
if (deptIdentifies != null && deptIdentifies.size() > 0) {
DeptIdentify identify1 = deptIdentifies.get(0);
identify1.setAnnexId(annexId1);
identify1.setSealStatus(1); //启用
deptIdentifyMapper.updateDeptIdentify(identify1);
SealManage sealManage = new SealManage();
sealManage.setSealId(sealId);
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
if (selectSealList != null && selectSealList.size() > 0) {
SealManage sealManage1 = selectSealList.get(0);
sealManage1.setAnnexId(annexId1);
sealManage1.setSealStatus(1); //启用
sealManageMapper.updateSealManage(sealManage1);
}
}
}
@@ -258,33 +247,62 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
@Override
public List<SealListVO> getSealList(DeptIdentify deptIdentify) {
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifylistother(deptIdentify);
if (deptIdentify.getId() == null) {
return null;
}
SealManage sealManage = new SealManage();
sealManage.setIdentifyId(deptIdentify.getId());
List<SealManage> selectSealList = sealManageMapper.selectSealList(sealManage);
List<SealListVO> sealListVOS = new ArrayList<>();
if (deptIdentifies != null && deptIdentifies.size() > 0) {
for (DeptIdentify identify : deptIdentifies) {
SealListVO sealListVO = new SealListVO();
sealListVO.setSealId(identify.getSealId());
sealListVO.setSealName(identify.getSealName());
sealListVO.setSealStatus(identify.getSealStatus());
Integer annexId = identify.getAnnexId();
//根据附件id查询路径
CaseAttach caseAttach = caseAttachMapper.queryAnnexById(annexId);
String annexName = caseAttach.getAnnexName();
String prefix = "/profile";
int startIndex = annexName.indexOf(prefix);
startIndex += prefix.length();
String annexPath = "/uploadPath" + annexName.substring(startIndex);
sealListVO.setAnnexPath(annexPath);
sealListVO.setAnnexType(caseAttach.getAnnexType());
sealListVOS.add(sealListVO);
if (selectSealList != null && selectSealList.size() > 0) {
for (SealManage sealManage1 : selectSealList) {
Integer annexId = sealManage1.getAnnexId();
if (annexId != null) { //附件id有值,证明是审核通过了的
SealListVO sealListVO = new SealListVO();
sealListVO.setSealId(sealManage1.getSealId());
sealListVO.setSealName(sealManage1.getSealName());
sealListVO.setSealStatus(sealManage1.getSealStatus());
//根据附件id查询路径
CaseAttach caseAttach = caseAttachMapper.queryAnnexById(annexId);
String annexName = caseAttach.getAnnexName();
String prefix = "/profile";
int startIndex = annexName.indexOf(prefix);
startIndex += prefix.length();
String annexPath = "/uploadPath" + annexName.substring(startIndex);
sealListVO.setAnnexPath(annexPath);
sealListVO.setAnnexType(caseAttach.getAnnexType());
sealListVOS.add(sealListVO);
}
}
}
return sealListVOS;
}
@Override
public AjaxResult updateSealLockStatus(DeptIdentify deptIdentify) {
deptIdentifyMapper.updateDeptIdentify(deptIdentify);
public AjaxResult updateSealLockStatus(SealManage sealManage) {
sealManageMapper.updateSealManage(sealManage);
return AjaxResult.success();
}
@Override
public AjaxResult insertDeptIdentify(DeptIdentify deptIdentify) {
//参数校验
String identifyName = deptIdentify.getIdentifyName();
String operName = deptIdentify.getOperName();
String operPhone = deptIdentify.getOperPhone();
if (identifyName == null || operName == null || operPhone == null) {
AjaxResult.error("请检查参数是否完整");
}
Integer identifyType = deptIdentify.getIdentifyType();
if (identifyType == null) {
deptIdentify.setIdentifyType(1); // 设置机构默认为仲裁机构
}
deptIdentify.setIdentifyStatus(0); //设置认证状态默认为未认证
deptIdentify.setIsUse(0); //设置认证状态默认为未认证
int i = deptIdentifyMapper.insertDeptIdentify(deptIdentify);//设置机构默认为未启用
if (i > 0) {
return AjaxResult.success("新增成功");
}
return AjaxResult.error();
}
}