Browse Source

博物馆权限系统对接:
根据用户名查询用户信息接口
查询7天内新增用户
博物馆uuid登录接口
待办事项查询接口

shenji 2 years ago
parent
commit
8fa47c7b5c

+ 74 - 1
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActTaskController.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.activiti.web;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
@@ -10,7 +11,6 @@ import org.activiti.engine.*;
 import org.activiti.engine.history.HistoricIdentityLink;
 import org.activiti.engine.history.HistoricProcessInstance;
 import org.activiti.engine.history.HistoricTaskInstance;
-import org.activiti.engine.history.HistoricTaskInstanceQuery;
 import org.activiti.engine.impl.interceptor.Command;
 import org.activiti.engine.impl.interceptor.CommandContext;
 import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
@@ -694,4 +694,77 @@ public class ActTaskController {
         }
         return Result.ok("操作成功");
     }
+
+    @RequestMapping(value = "/todo-list/{userId}" )
+    public JSONObject todoList(@PathVariable String userId){
+        JSONObject result = new JSONObject();
+        JSONObject data = new JSONObject();
+        // 转换vo
+        List<JSONObject> todoList = new ArrayList<>();
+
+        LoginUser user = sysBaseAPI.getUserByName(userId);
+        if(user==null){
+            result.put("error_code", "0");
+            result.put("message", "未找到该用户");
+            data.put("todo_items", todoList);
+            data.put("user_id", userId);
+            result.put("data", data);
+            return result;
+        }else {
+            result.put("error_code", "0");
+            result.put("message", "success");
+        }
+        data.put("user_id", userId);
+        data.put("user_cn_name", user.getRealname());
+
+        Map<String,Object> map=new HashMap<>();
+        map.put("username",userId);
+        map.put("username",user.getUsername());
+        //公司id
+        map.put("pkOrg",user.getOrgCode());
+        List<Task> taskList=iActReModelService.getListTask(map);
+        taskList.forEach(task -> {
+            JSONObject todo = new JSONObject();
+            todo.put("sub_sys_cn_name", "OA办公");
+
+            // 关联流程信息
+            ActZprocess actProcess = actZprocessService.getById(task.getProcessDefinitionId());
+            if(actProcess!=null){
+                todo.put("module_cn_name", actProcess.getName());
+                todo.put("type", actProcess.getName());
+            }
+
+            List<IdentityLink> identityLinks = runtimeService.getIdentityLinksForProcessInstance(task.getProcessInstanceId());
+            for(IdentityLink ik : identityLinks){
+                // 关联发起人
+                if("starter".equals(ik.getType())&&StrUtil.isNotBlank(ik.getUserId())){
+                    todo.put("summary",sysBaseAPI.getUserByName(ik.getUserId()).getRealname()+"的申请");
+                }
+            }
+            todo.put("link", "");
+            if(StringUtils.isNotBlank(user.getPostName())){
+                todo.put("current_state", "待审批("+user.getPostName()+"审批)");
+            }else{
+                todo.put("current_state", "待审批");
+            }
+            todo.put("current_state_since", task.getCreateTime());
+            String priorityStr = "";
+            if (task.getPriority() == 0) {
+                priorityStr = "普通";
+            }else if (task.getPriority() == 1) {
+                priorityStr = "重要";
+            }else if (task.getPriority() == 2) {
+                priorityStr = "紧急";
+            }
+            todo.put("priority", priorityStr);
+            todo.put("urgency_level", "");
+            todo.put("note", "");
+            if (todoList.size() < 200) {
+                todoList.add(todo);
+            }
+        });
+        data.put("todo_items", todoList);
+        result.put("data", data);
+        return result;
+    }
 }

+ 3 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -74,6 +74,7 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除
 		filterChainDefinitionMap.put("/sys/login", "anon"); //登录接口排除
 		filterChainDefinitionMap.put("/sys/redirect/login", "anon"); //登录接口排除
+		filterChainDefinitionMap.put("/sys/uuid/login", "anon"); //登录接口排除
 		filterChainDefinitionMap.put("/sys/mLogin", "anon"); //登录接口排除
 		filterChainDefinitionMap.put("/sys/logout", "anon"); //登出接口排除
 		filterChainDefinitionMap.put("/sys/getDingLogin", "anon"); //钉钉登录接口排除
@@ -85,6 +86,7 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/sys/user/querySysUser", "anon");//根据手机号获取用户信息
 		filterChainDefinitionMap.put("/sys/user/phoneVerification", "anon");//用户忘记密码验证手机号
 		filterChainDefinitionMap.put("/sys/user/passwordChange", "anon");//用户更改密码
+		filterChainDefinitionMap.put("/sys/user/detail/**", "anon");//根据id查用户信息
 		filterChainDefinitionMap.put("/auth/2step-code", "anon");//登录验证码
 		filterChainDefinitionMap.put("/sys/common/static/**", "anon");//图片预览 &下载文件不限制token
 		filterChainDefinitionMap.put("/sys/common/view/**", "anon");//图片预览不限制token
@@ -124,6 +126,7 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/editor-app/**", "anon");
 		filterChainDefinitionMap.put("/tbTableInfo/**","anon");
 		filterChainDefinitionMap.put("/actBusiness/external/**","anon");
+		filterChainDefinitionMap.put("/actTask/todo-list/**","anon");
 
 		//性能监控
 		filterChainDefinitionMap.put("/actuator/metrics/**", "anon");

File diff suppressed because it is too large
+ 2 - 8
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java


+ 108 - 4
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang.StringUtils;
@@ -24,10 +25,7 @@ import org.jeecg.common.system.api.ISysBaseAPI;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.util.JwtUtil;
 import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.common.util.MD5Util;
-import org.jeecg.common.util.PasswordUtil;
-import org.jeecg.common.util.RedisUtil;
-import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.common.util.*;
 import org.jeecg.config.dataSource.OtherSource;
 import org.jeecg.modules.system.entity.*;
 import org.jeecg.modules.system.mapper.SysUserMapper;
@@ -44,7 +42,11 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.ClientHttpResponse;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.ResponseErrorHandler;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartHttpServletRequest;
 import org.springframework.web.servlet.ModelAndView;
@@ -128,6 +130,18 @@ public class SysUserController {
 
 		IPage<SysUser> pageList = sysUserService.page(page, queryWrapper);
 
+        List<SysPosition> positionList = sysPositionService.list();
+        Map<String,String> map = new HashMap<>();
+        for(SysPosition o:positionList){
+            map.put(o.getCode(),o.getName());
+        }
+
+        pageList.getRecords().forEach( item ->{
+            if(StringUtils.isNotBlank(item.getPost()) && map.containsKey(item.getPost())){
+                item.setPostName(map.get(item.getPost()));
+            }
+        });
+
 		//批量查询用户的所属部门
         //step.1 先拿到全部的 useids
         //step.2 通过 useids,一次性查询用户的所属部门名字
@@ -1487,4 +1501,94 @@ public class SysUserController {
 
     }
 
+    /**
+     * 根据用户名查询用户信息
+     * @param userId
+     * @return
+     */
+    @RequestMapping(value = "/detail/{userId}", method = RequestMethod.GET)
+    public JSONObject getDetail(@PathVariable String userId) {
+        JSONObject result = new JSONObject();
+        SysUser sysUser = sysUserService.getUserByName(userId);
+        if (sysUser == null) {
+            result.put("error_code", "999");
+            result.put("message", "未找到该用户");
+        } else {
+            result.put("error_code", "0");
+            result.put("message", "success");
+
+            JSONObject user = new JSONObject();
+            user.put("user_id", userId);
+            user.put("user_cn_name",sysUser.getRealname());
+            user.put("contact",sysUser.getPhone());
+            user.put("email",sysUser.getEmail());
+            user.put("update_time", sysUser.getUpdateTime());
+
+
+            List<SysDepart> departList = sysDepartService.queryUserDeparts(sysUser.getId());
+            if (departList != null && departList.size() > 0) {
+                String deptCode = departList.stream().map(SysDepart::getOrgCode).collect(Collectors.joining(","));
+                String deptName = departList.stream().map(SysDepart::getDepartName).collect(Collectors.joining(","));
+                user.put("dept_code",deptCode);
+                user.put("dept_cn_name",deptName);
+            }
+
+            result.put("data", user);
+        }
+        return result;
+    }
+
+
+    @ApiOperation("7天内新增用户")
+    @RequestMapping(value = "/recently/added", method = RequestMethod.GET)
+    public Result<List<JSONObject>> recentlyAdded(){
+        Result<List<JSONObject>> result = new Result<List<JSONObject>>();
+        RestUtil.getRestTemplate().setErrorHandler(new ResponseErrorHandler(){
+
+            @Override
+            public boolean hasError(ClientHttpResponse clientHttpResponse) throws IOException {
+                return false;
+            }
+
+            @Override
+            public void handleError(ClientHttpResponse clientHttpResponse) throws IOException {
+            }
+        });
+        ResponseEntity<JSONObject> response = RestUtil.getNative("http://172.18.91.50:9002/prod-api/authEmployee/lastweek",null,null);
+        int statusCode = response.getStatusCodeValue();
+        JSONObject res = response.getBody();
+
+        if(HttpStatus.OK.value()!=statusCode){
+            result.setCode(statusCode);
+            result.setMessage(res.getString("error_description"));
+        }else{
+            String code = res.getString("error_code");
+            String msg = res.getString("msg");
+            JSONArray data = res.getJSONArray("data");
+
+            List<JSONObject> newUser = new ArrayList<>();
+
+            if(data==null || data.size()==0){
+                result.setCode(statusCode);
+                result.setResult(newUser);
+                return result;
+            }
+
+            List<SysUser> sysUsers = sysUserService.queryAllUserInfo();
+            List<String> userNames = sysUsers.stream().map(SysUser::getUsername).collect(Collectors.toList());
+            for (int i = 0; i < data.size(); i++) {
+                JSONObject user = data.getJSONObject(i);
+                String userId = user.getString("user_id");
+                int activeState = user.getIntValue("active_state");
+                if (! userNames.contains(userId) && activeState==1) {
+                    newUser.add(user);
+                }
+            }
+
+            result.setCode(statusCode);
+            result.setResult(newUser);
+        }
+        return result;
+
+    }
 }

Some files were not shown because too many files changed in this diff