公章管理测试

This commit is contained in:
hejinbo
2023-11-15 09:01:20 +08:00
parent dac20a4a04
commit 4088cf7357
10 changed files with 140 additions and 186 deletions
@@ -18,7 +18,7 @@ public interface IDeptIdentifyService {
AjaxResult enableDept(DeptIdentify deptIdentify);
AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file);
AjaxResult sealUpload(Long id, String sealName , MultipartFile file);
AjaxResult receiveNotify(String body);
@@ -71,14 +71,16 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
EsignHttpResponse identifyUrl = SignAward.deptIdentifyUrl(deptIdentifyselect);
JsonObject signUrlJsonObject = gson.fromJson(identifyUrl.getBody(), JsonObject.class);
int code = signUrlJsonObject.get("code").getAsInt();
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String url = signUrlData.get("authUrl").getAsString();
//获取本次认证授权流程ID
String authFlowId = signUrlData.get("authFlowId").getAsString();
deptIdentify.setAuthFlowId(authFlowId);
deptIdentifynew.setIdentifyUrl(url);
deptIdentify.setIdentifyDate(new Date());
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
if (code == 0){
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
String url = signUrlData.get("authUrl").getAsString();
//获取本次认证授权流程ID
String authFlowId = signUrlData.get("authFlowId").getAsString();
deptIdentify.setAuthFlowId(authFlowId);
deptIdentifynew.setIdentifyUrl(url);
deptIdentify.setIdentifyDate(new Date());
int row = deptIdentifyMapper.updateDeptIdentify(deptIdentify);
}
}
return deptIdentifynew;
}
@@ -113,7 +115,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
}
@Override
public AjaxResult sealUpload(DeptIdentify deptIdentify, MultipartFile file) {
public AjaxResult sealUpload(Long id, String sealName , MultipartFile file) {
try {
if (file.isEmpty()) {
return AjaxResult.error("请选择要上传的文件");
@@ -121,6 +123,8 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
String filePath = RuoYiConfig.getUploadPath();
// 上传
String fileName = FileUploadUtils.upload(filePath, file);
DeptIdentify deptIdentify = new DeptIdentify();
deptIdentify.setId(id);
List<DeptIdentify> deptIdentifies = deptIdentifyMapper.selectDeptIdentifyBydeptid(deptIdentify);
if (deptIdentifies != null && deptIdentifies.size() > 0) {
for (DeptIdentify identify : deptIdentifies) {
@@ -133,21 +137,32 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
String prefix = "/profile";
int startIndex = fileName.indexOf(prefix);
startIndex += prefix.length();
String annexPath = "/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);
JSONObject jsonObject = JSONObject.parseObject(response.getBody());
int code = jsonObject.getIntValue("code");
if (code == 0) { //业务码,0表示成功,非0表示异常。
String sealId = jsonObject.getJSONObject("data").getString("sealId");
identify.setSealId(sealId);
identify.setIsUse(0); //设置印章使用状态为未启用
//保存到表里
int i = deptIdentifyMapper.updateDeptIdentify(identify);
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);
if (i > 0) {
return AjaxResult.success("上传成功");
}
}
return AjaxResult.error("公章上传失败,请检查印章名称是否重复");
}
return AjaxResult.error("企业用户未授予资源管理权限");
}