|
@@ -97,8 +97,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
@Autowired
|
|
|
private AppManageUtil appManageUtil;
|
|
|
|
|
|
- @Autowired
|
|
|
- private WorkFlowClient workFlowClient;
|
|
|
+
|
|
|
|
|
|
private final ReentrantLock lock = new ReentrantLock();
|
|
|
private final String UNCHECK_TAG_BASE_PATH = "AppInfouncheckTag:";
|
|
@@ -116,17 +115,19 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
QueryWrapper<AppBaseInfo> appBaseInfoQueryWrapper = new QueryWrapper<>();
|
|
|
appBaseInfoQueryWrapper.eq("name", appBaseInfo.getName());
|
|
|
if (baseInfoMapper.selectOne(appBaseInfoQueryWrapper) != null) return "应用名称已存在";
|
|
|
+
|
|
|
// 创建人
|
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
appBaseInfo.setCreateBy(loginUser.getId());
|
|
|
appBaseInfo.setAddType(appInfo.getAddType());
|
|
|
appBaseInfo.setDelFlag(1);
|
|
|
baseInfoMapper.insert(appBaseInfo);
|
|
|
- // 提交至工作流的表单信息(需要将用户id换成真名,字典值换成字典文本)
|
|
|
+
|
|
|
+ // 提交至工作流的表单信息(临时将用户id换成真名,字典值换成字典文本)
|
|
|
AppBaseInfo sendCheck_appBaseInfo = appBaseInfo;
|
|
|
sendCheck_appBaseInfo.setAdmin(customMapper.queryRealnameByUserId(appBaseInfo.getAdmin()));
|
|
|
- if (appBaseInfo.getDevelopUser()!=null)
|
|
|
- sendCheck_appBaseInfo.setDevelopUser(customMapper.queryRealnameByUserId(appBaseInfo.getDevelopUser()));
|
|
|
+// if (appBaseInfo.getDevelopUser()!=null)
|
|
|
+// sendCheck_appBaseInfo.setDevelopUser(customMapper.queryRealnameByUserId(appBaseInfo.getDevelopUser()));
|
|
|
if (appBaseInfo.getOperationUser()!=null)
|
|
|
sendCheck_appBaseInfo.setOperationUser(customMapper.queryRealnameByUserId(appBaseInfo.getOperationUser()));
|
|
|
if (appBaseInfo.getRequirementUser()!=null)
|
|
@@ -140,7 +141,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
if (appInfo.getAppEnvInfoDTO()!=null) hasEnvInfo = appInfo.getAppEnvInfoDTO().size()>0;
|
|
|
// 简易注册模式下添加基础信息即可
|
|
|
if (appBaseInfo.getAddType().equals("easy")){
|
|
|
- sendCheckWordFlow(sendCheck_appBaseInfo, "021",loginUser.getUsername());
|
|
|
+ appManageUtil.sendCheckWordFlow(sendCheck_appBaseInfo, "021",loginUser.getUsername(),"admin");
|
|
|
return "提交成功";
|
|
|
}else {
|
|
|
APP_Register_workFlow_FormEntity appRegisterWorkFlowFormEntity = new APP_Register_workFlow_FormEntity();
|
|
@@ -151,7 +152,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
AppManageUtil appManageUtil = new AppManageUtil();
|
|
|
appRegisterWorkFlowFormEntity = appManageUtil.TransitionEnvInfoToAppRegisterWorkFlowForm(appRegisterWorkFlowFormEntity, appInfo.getAppEnvInfoDTO());
|
|
|
}
|
|
|
- sendCheckWordFlow(appRegisterWorkFlowFormEntity, "022",loginUser.getUsername());
|
|
|
+ appManageUtil.sendCheckWordFlow(appRegisterWorkFlowFormEntity, "022",loginUser.getUsername(),"admin");
|
|
|
}
|
|
|
String appid = appBaseInfo.getId();
|
|
|
|
|
@@ -238,6 +239,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
*/
|
|
|
@Override
|
|
|
public Boolean editBaseInfo(AppBaseInfo baseInfo) throws Exception {
|
|
|
+
|
|
|
int i = baseInfoMapper.updateById(baseInfo);
|
|
|
// 保存成功解除反审核状态
|
|
|
if (i>0) uncheckLock("AppbaseInfo"+baseInfo.getId());
|
|
@@ -539,6 +541,7 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
lock.lock();
|
|
|
try {
|
|
|
String uncheckinfo = (String) redisUtil.get(UNCHECK_TAG_BASE_PATH+key);
|
|
|
+ String test = (String) redisUtil.get("bucunzaide");
|
|
|
// 该条信息处于反审核状态,反审核方为当前用户,直接返回false
|
|
|
if (uncheckinfo!=null && uncheckinfo.equals(loginUser.getId())) {
|
|
|
return false;
|
|
@@ -549,7 +552,9 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
redisUtil.set(UNCHECK_TAG_BASE_PATH+key, loginUser.getId(), 600);
|
|
|
return false;
|
|
|
}
|
|
|
- } finally {
|
|
|
+ }catch (Exception e) {
|
|
|
+ System.out.println("chec kLock error:"+e);
|
|
|
+ }finally {
|
|
|
lock.unlock();
|
|
|
}
|
|
|
// 该条信息已被反审核,不可编辑(tag为 表单disable的标志)
|
|
@@ -614,36 +619,8 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- // 加入流程
|
|
|
- private <T> void sendCheckWordFlow(T object, String flowNo, String username) throws Exception {
|
|
|
- Hashtable<String, String> hashtable = new Hashtable<>();
|
|
|
- Class<?> clazz = object.getClass();
|
|
|
- // 获取所有字段
|
|
|
- Field[] fields = clazz.getDeclaredFields();
|
|
|
- // 遍历所有字段
|
|
|
- for (Field field : fields) {
|
|
|
- // 设置访问权限
|
|
|
- field.setAccessible(true);
|
|
|
- try {
|
|
|
- Object value = field.get(object);
|
|
|
- if (value != null) {
|
|
|
- // 将值转换为字符串
|
|
|
- String stringValue = value.toString();
|
|
|
- hashtable.put(field.getName(), stringValue);
|
|
|
- }
|
|
|
- } catch (IllegalAccessException e) {
|
|
|
- throw new RuntimeException("Failed to access field: " + field.getName(), e);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-// 微服务调用 审核加入流程
|
|
|
- workFlowClient.startFlow(flowNo, username, hashtable);
|
|
|
- }
|
|
|
-
|
|
|
// 判断当前用户是否有编辑当前信息的权限
|
|
|
- private boolean hasEditCurrentInfoPermission(String appid){
|
|
|
+ public boolean hasEditCurrentInfoPermission(String appid){
|
|
|
// 获取当前登录用户
|
|
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
|
|
// 查询基础信息的应用管理员id,比较是否和当前登录用户一致
|
|
@@ -678,24 +655,29 @@ public class AppmanageServiceImpl implements AppmanageService {
|
|
|
|
|
|
|
|
|
// 应用审核通过后一系列创建应用一级菜单、默认角色、授权操作(完整注册时)
|
|
|
- public void afterAppCheckPass(String appid) {
|
|
|
-
|
|
|
- System.out.println("审核完成后续处理:"+appid);
|
|
|
- // 将基础信息删除标志位恢复
|
|
|
- baseInfoMapper.recoverAppInfo(appid);
|
|
|
+ public <T> void afterAppCheckPass(String appid, T formData) {
|
|
|
+ AppBaseInfo appBaseInfo = baseInfoMapper.queryAppBaseInfoById(appid);
|
|
|
+ appManageUtil.CompareOldAppBaseInfoAndNewAppBaseInfo(appBaseInfo, formData);
|
|
|
+ // 以通过审批的应用信息为准更新应用信息
|
|
|
+ baseInfoMapper.undateBaseInfo(appBaseInfo);
|
|
|
+// QueryWrapper<AppBaseInfo> appBaseInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+// appBaseInfoQueryWrapper.eq("id", appid);
|
|
|
+// int i = baseInfoMapper.update(appBaseInfo, appBaseInfoQueryWrapper);
|
|
|
// 查询该应用信息
|
|
|
- AppBaseInfo appBaseInfo = baseInfoMapper.selectById(appid);
|
|
|
+
|
|
|
String toUser = baseInfoMapper.queryUsernameById(appBaseInfo.getCreateBy());
|
|
|
//给申请注册应用信息的用户发送系统消息
|
|
|
TemplateMessageDTO message = new TemplateMessageDTO();
|
|
|
message.setAppId("0");
|
|
|
message.setToUser(toUser);
|
|
|
+ // 设置消息模板编码
|
|
|
message.setTemplateCode("app_examineAndapprove");
|
|
|
Map<String, String> templateParam = new HashMap<>();
|
|
|
templateParam.put("resultText","通过");
|
|
|
message.setTemplateParam(templateParam);
|
|
|
sysBaseApi.sendTemplateAnnouncement(message);
|
|
|
|
|
|
+
|
|
|
// 判断该信息是否为完整注册
|
|
|
if (appBaseInfo.getAddType().equals("full")){
|
|
|
// 添加默认角色信息
|