Просмотр исходного кода

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-server-mdm

koushanshan 2 лет назад
Родитель
Сommit
f6ff3d2e85

+ 1 - 15
src/main/java/com/dk/mdm/controller/common/CommonController.java

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
+import java.util.Dictionary;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -35,21 +36,6 @@ public class CommonController extends BaseController<Map<String, Object>> {
     private CommonService commonService;
     private CommonService commonService;
 
 
     /**
     /**
-     * @desc : 登录后获取信息
-     * @author : 周兴
-     * @date : 2024/3/4 12:47
-     */
-    @ApiOperation(
-            value = "登录后获取信息",
-            notes = "登录后获取信息"
-    )
-    @PostMapping("get_info_after_login")
-    public ResponseResultVO<Map<String, List<Map<String, Object>>>> getInfoAfterLogin(@RequestBody Map<String, Object> param) {
-        return commonService.getInfoAfterLogin(param);
-    }
-
-
-    /**
      * @desc : 获取数据字典项目
      * @desc : 获取数据字典项目
      * @author : 王英杰
      * @author : 王英杰
      * @date : 2023/1/6 12:47
      * @date : 2023/1/6 12:47

+ 16 - 0
src/main/java/com/dk/mdm/controller/mst/StaffController.java

@@ -20,7 +20,9 @@ import org.springframework.web.multipart.MultipartFile;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
 import java.util.ArrayList;
+import java.util.Dictionary;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * @author : 姜永辉
  * @author : 姜永辉
@@ -201,4 +203,18 @@ public class StaffController {
         return ResponseResultUtil.success(pageListResponseResultVO.getData().getList().get(0));
         return ResponseResultUtil.success(pageListResponseResultVO.getData().getList().get(0));
     }
     }
 
 
+    /**
+     * @desc : 登录后获取信息
+     * @author : 周兴
+     * @date : 2024/3/4 12:47
+     */
+    @ApiOperation(
+            value = "登录后获取信息",
+            notes = "登录后获取信息"
+    )
+    @PostMapping("get_info_after_login")
+    public ResponseResultVO<Dictionary<String,Object>> getInfoAfterLogin(@RequestBody Map<String, Object> param) {
+        return staffService.getInfoAfterLogin(param);
+    }
+
 }
 }

+ 1 - 0
src/main/java/com/dk/mdm/service/common/CommonService.java

@@ -14,6 +14,7 @@ import com.dk.mdm.mapper.common.CommonMapper;
 import com.dk.mdm.infrastructure.util.AuthUtils;
 import com.dk.mdm.infrastructure.util.AuthUtils;
 import com.dk.mdm.mapper.mst.StaffMapper;
 import com.dk.mdm.mapper.mst.StaffMapper;
 import com.dk.common.model.response.mst.StaffResponse;
 import com.dk.common.model.response.mst.StaffResponse;
+import com.dk.mdm.model.pojo.mst.Staff;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.postgresql.util.PGobject;
 import org.postgresql.util.PGobject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;

+ 35 - 3
src/main/java/com/dk/mdm/service/mst/StaffService.java

@@ -5,12 +5,14 @@ import com.dk.common.infrastructure.constant.Constant;
 import com.dk.common.model.pojo.PageList;
 import com.dk.common.model.pojo.PageList;
 import com.dk.common.model.pojo.mst.StaffPurview;
 import com.dk.common.model.pojo.mst.StaffPurview;
 import com.dk.common.model.pojo.mst.StaffRight;
 import com.dk.common.model.pojo.mst.StaffRight;
+import com.dk.common.model.vo.core.StaffEntity;
 import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseCodeEnum;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.mdm.feign.CompanyFeign;
 import com.dk.mdm.feign.CompanyFeign;
 import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
 import com.dk.mdm.infrastructure.convert.mst.StaffConvert;
 import com.dk.mdm.infrastructure.util.AuthUtils;
 import com.dk.mdm.infrastructure.util.AuthUtils;
+import com.dk.mdm.mapper.common.CommonMapper;
 import com.dk.mdm.model.pojo.mst.*;
 import com.dk.mdm.model.pojo.mst.*;
 import com.dk.mdm.mapper.mst.StaffMapper;
 import com.dk.mdm.mapper.mst.StaffMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.service.BaseService;
@@ -25,9 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 
 /**
 /**
  * @author : 姜永辉
  * @author : 姜永辉
@@ -71,6 +71,9 @@ public class StaffService extends BaseService<Staff> {
     private CommonService commonService;
     private CommonService commonService;
 
 
     @Autowired
     @Autowired
+    private CommonMapper commonMapper;
+
+    @Autowired
     private AuthUtils authUtils;
     private AuthUtils authUtils;
 
 
     /**
     /**
@@ -259,4 +262,33 @@ public class StaffService extends BaseService<Staff> {
         return ResponseResultUtil.success();
         return ResponseResultUtil.success();
     }
     }
 
 
+    /**
+     * @desc : 登录后获取信息
+     * @author : 周兴
+     * @date : 2024/3/4 11:41
+     */
+    @Transactional(
+            rollbackFor = {Exception.class}
+    )
+    public ResponseResultVO<Dictionary<String,Object>> getInfoAfterLogin(Map<String, Object> param) {
+        // 先根据userId查询当前企业的员工信息
+        StaffResponse staff = staffMapper.selectByUserId(param.get("userId").toString());
+        if (staff != null) {
+            // 存Redis
+            authUtils.saveStaff(new StaffEntity().setStaffId(staff.getStaffId())
+                    .setStaffCode(staff.getStaffCode())
+                    .setStaffName(staff.getStaffName())
+                    .setCpId(Integer.parseInt(param.get("cpId").toString()))
+                    .setAppCode(param.get("appCode").toString()));
+            // 更新员工登录状态
+            this.updateByUuid(new Staff().setStaffId(staff.getStaffId()).setFlgCanLogin(true));
+        }
+        // 获取菜单
+        List menuList = commonMapper.getMenuByUser(param);
+        Dictionary<String,Object> dic = new Hashtable<>();
+        dic.put("menuList", menuList);
+        dic.put("staff",staff);
+        return ResponseResultUtil.success(dic);
+    }
+
 }
 }

+ 1 - 1
src/main/resources/dev/bootstrap.yml

@@ -2,7 +2,7 @@ server:
   port: 7008
   port: 7008
 spring:
 spring:
   application:
   application:
-    name: mdm-server-dkic-b1
+    name: mdm-server-dkic-b1-zx
   cloud:
   cloud:
     nacos:
     nacos:
       config:
       config: