浏览代码

925 定时备份

LT32820A 2 月之前
父节点
当前提交
fc57a2df9e

+ 1 - 1
jeecg-boot/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -84,7 +84,7 @@ public class ShiroConfig {
         }
 
         // 配置不会被拦截的链接 顺序判断
-        filterChainDefinitionMap.put("/WF/API/test1", "anon"); //cas验证登录
+        filterChainDefinitionMap.put("/WF/API/test", "anon"); //cas验证登录
         filterChainDefinitionMap.put("/sys/applicationInfo/test", "anon"); //cas验证登录
         filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录
         filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除

+ 6 - 5
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/client/AppManage/WorkFlowClient.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.client.AppManage;
 
+import org.jeecg.common.api.vo.Result;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.stereotype.Component;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -12,9 +13,9 @@ import java.util.Hashtable;
 public interface WorkFlowClient {
 
     @PostMapping("/WF/API/startFlow")
-    void startFlow(@RequestParam("flowNo") String flowNo,
-                   @RequestParam("username") String username,
-                   @RequestParam("toEmps") String toEmps,
-                   @RequestParam("execUserNo") String execUserNo,
-                   @RequestBody Hashtable<String, String> hashtable);
+    Result<Object> startFlow(@RequestParam("flowNo") String flowNo,
+                             @RequestParam("username") String username,
+                             @RequestParam("toEmps") String toEmps,
+                             @RequestParam("execUserNo") String execUserNo,
+                             @RequestBody Hashtable<String, String> hashtable);
 }

+ 6 - 5
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/mapper/AppBaseInfoMapper.java

@@ -1,10 +1,7 @@
 package org.jeecg.modules.system.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
+import org.apache.ibatis.annotations.*;
 import org.jeecg.modules.system.entity.AppmanageEntity.AppBaseInfo;
 
 import java.util.List;
@@ -36,6 +33,10 @@ public interface AppBaseInfoMapper extends BaseMapper<AppBaseInfo> {
     @Select("SELECT username from sys_user where id = #{id}")
     String queryUsernameById(@Param("id") String id);
 
+    // 真删除基础信息(非逻辑删除)
+    @Delete("delete from app_base_info where id = #{id}")
+    void deleteAppInfoNotLogic(@Param("id") String id);
+
     @Update("<script>" +
             "UPDATE app_base_info " +
             "<set>" +
@@ -60,5 +61,5 @@ public interface AppBaseInfoMapper extends BaseMapper<AppBaseInfo> {
             "</set>" +
             "WHERE id = #{baseInfo.id}" +
             "</script>")
-    void undateBaseInfo(@Param("baseInfo") AppBaseInfo baseInfo);
+    int updateBaseInfo(@Param("baseInfo") AppBaseInfo baseInfo);
 }

+ 13 - 6
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/service/impl/AppmanageServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.apache.http.HttpRequest;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.dto.message.TemplateMessageDTO;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.config.mqtoken.UserTokenContext;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.query.QueryGenerator;
@@ -114,7 +115,7 @@ public class AppmanageServiceImpl implements AppmanageService {
         AppBaseInfo appBaseInfo = appInfo.getAppBaseInfoDTO();
         QueryWrapper<AppBaseInfo> appBaseInfoQueryWrapper = new QueryWrapper<>();
         appBaseInfoQueryWrapper.eq("name", appBaseInfo.getName());
-        if (baseInfoMapper.selectOne(appBaseInfoQueryWrapper) != null) return "应用名称已存在";
+        if (baseInfoMapper.selectOne(appBaseInfoQueryWrapper) != null) return"应用名称已存在";
 
         // 创建人
         LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -125,9 +126,9 @@ public class AppmanageServiceImpl implements AppmanageService {
 
         // 提交至工作流的表单信息(临时将用户id换成真名,字典值换成字典文本)
         AppBaseInfo sendCheck_appBaseInfo = appBaseInfo;
-        sendCheck_appBaseInfo.setAdmin(customMapper.queryRealnameByUserId(appBaseInfo.getAdmin()));
+//        sendCheck_appBaseInfo.setAdmin(customMapper.queryRealnameByUserId(appBaseInfo.getAdmin()));
 //        if (appBaseInfo.getDevelopUser()!=null)
-//            sendCheck_appBaseInfo.setDevelopUser(customMapper.queryRealnameByUserId(appBaseInfo.getDevelopUser()));
+            sendCheck_appBaseInfo.setDevelopUser(customMapper.queryRealnameByUserId(appBaseInfo.getDevelopUser()));
         if (appBaseInfo.getOperationUser()!=null)
             sendCheck_appBaseInfo.setOperationUser(customMapper.queryRealnameByUserId(appBaseInfo.getOperationUser()));
         if (appBaseInfo.getRequirementUser()!=null)
@@ -141,8 +142,14 @@ public class AppmanageServiceImpl implements AppmanageService {
         if (appInfo.getAppEnvInfoDTO()!=null) hasEnvInfo = appInfo.getAppEnvInfoDTO().size()>0;
         // 简易注册模式下添加基础信息即可
         if (appBaseInfo.getAddType().equals("easy")){
-            appManageUtil.sendCheckWordFlow(sendCheck_appBaseInfo, "021",loginUser.getUsername(),"admin");
-            return "提交成功";
+            boolean tag = appManageUtil.sendCheckWordFlow(sendCheck_appBaseInfo, "021", loginUser.getUsername(), "admin");
+            // 发起流程失败则删除数据库内数据
+            if (tag){
+                return "提交成功";
+            } else {
+                baseInfoMapper.deleteAppInfoNotLogic(appBaseInfo.getId());
+                return "提交失败";
+            }
         }else {
             APP_Register_workFlow_FormEntity appRegisterWorkFlowFormEntity = new APP_Register_workFlow_FormEntity();
             BeanUtils.copyProperties(appRegisterWorkFlowFormEntity, appDocInfo);
@@ -659,7 +666,7 @@ public class AppmanageServiceImpl implements AppmanageService {
         AppBaseInfo appBaseInfo = baseInfoMapper.queryAppBaseInfoById(appid);
         appManageUtil.CompareOldAppBaseInfoAndNewAppBaseInfo(appBaseInfo, formData);
         // 以通过审批的应用信息为准更新应用信息
-        baseInfoMapper.undateBaseInfo(appBaseInfo);
+        int i = baseInfoMapper.updateBaseInfo(appBaseInfo);
 //        QueryWrapper<AppBaseInfo> appBaseInfoQueryWrapper = new QueryWrapper<>();
 //        appBaseInfoQueryWrapper.eq("id", appid);
 //        int i = baseInfoMapper.update(appBaseInfo, appBaseInfoQueryWrapper);

+ 4 - 2
jeecg-boot/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/system/util/AppManageUtil.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.system.util;
 
 import org.apache.poi.ss.formula.functions.T;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.common.util.RedisUtil;
@@ -121,7 +122,7 @@ public class AppManageUtil {
      *                 @RequestParam("toEmps") String toEmps,
      *                           @RequestParam("execUserNo") String execUserNo,
      */
-    public <T> void sendCheckWordFlow(T object, String flowNo, String username, String toEmps) throws Exception {
+    public <T> boolean sendCheckWordFlow(T object, String flowNo, String username, String toEmps) {
         Hashtable<String, String> hashtable = new Hashtable<>();
         Class<?> clazz = object.getClass();
         // 获取所有字段
@@ -142,7 +143,8 @@ public class AppManageUtil {
             }
         }
 //      微服务调用 审核加入流程
-        workFlowClient.startFlow(flowNo, username, toEmps, username, hashtable);
+        return workFlowClient.startFlow(flowNo, username, toEmps, username, hashtable).isSuccess();
+
     }
 
     // 审核完成将审核通过的最终数据插入数据库,因为应用注册审核已经提前将数据插入数据库表(应用基础信息)

+ 20 - 8
jeecg-boot/jeecg-server-cloud/jflow-cloud-start/src/main/java/org/jeecg/config/DevelopAPI.java

@@ -15,6 +15,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.api.vo.Result;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
@@ -1842,14 +1843,25 @@ public class DevelopAPI extends HttpHandlerBase {
      * @param hashtable:表单数据
      */
     @PostMapping("/startFlow")
-    public void startFlow(@RequestParam("flowNo") String flowNo,
-                          @RequestParam("username") String username,
-                          @RequestParam("toEmps") String toEmps,
-                          @RequestParam("execUserNo") String execUserNo,
-                          @RequestBody Hashtable<String, String> hashtable) throws Exception {
-        long workID = Dev2Interface.Node_CreateBlankWork(flowNo, username);
-        if (hashtable.size() > 0) {
-            Dev2Interface.Node_SendWork(flowNo, workID, hashtable, null, 0, toEmps, execUserNo);
+    public Result<SendReturnObjs> startFlow(@RequestParam("flowNo") String flowNo,
+                                            @RequestParam("username") String username,
+                                            @RequestParam("toEmps") String toEmps,
+                                            @RequestParam("execUserNo") String execUserNo,
+                                            @RequestBody Hashtable<String, String> hashtable) {
+        try {
+            long workID = Dev2Interface.Node_CreateBlankWork(flowNo, username);
+            if (hashtable.size() > 0) {
+                SendReturnObjs sendReturnObjs = Dev2Interface.Node_SendWork(flowNo, workID, hashtable, null, 0, toEmps, execUserNo);
+                return Result.OK(sendReturnObjs);
+            }
+        }catch (Exception e){
+            System.out.println("流程发起失败:"+ e);
         }
+        return null;
+    }
+
+    @GetMapping("/test")
+    public String test() {
+        return "JFlow 接口正常";
     }
 }

+ 0 - 3
jeecg-boot/jflow-core/src/main/java/bp/difference/handler/DirectoryPageBase.java

@@ -4,9 +4,6 @@ import bp.da.DataType;
 import bp.da.Log;
 import bp.difference.ContextHolderUtils;
 import bp.sys.Glo;
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
-import net.sf.json.JSON;
 import org.apache.http.protocol.HttpContext;
 
 import javax.servlet.http.HttpServletRequest;

+ 1 - 0
jeecg-boot/jflow-core/src/main/java/bp/wf/httphandler/WF_GPM.java

@@ -1,5 +1,6 @@
 package bp.wf.httphandler;
 
+import bp.ccfast.ccmenu.Module;
 import bp.da.*;
 import bp.sys.*;
 import bp.web.*;