Răsfoiți Sursa

用户对应多个组织

lzm 2 ani în urmă
părinte
comite
c9b41cfe2f
19 a modificat fișierele cu 58 adăugiri și 37 ștergeri
  1. 3 2
      business-system/face-identify/src/main/java/com/pj/biz/TbPersonVisitRecordController.java
  2. 3 2
      business-system/filing-system/src/main/java/com/pj/biz/TbCarBlackController.java
  3. 3 2
      business-system/filing-system/src/main/java/com/pj/biz/TbCarFilingController.java
  4. 3 2
      business-system/filing-system/src/main/java/com/pj/biz/TbPersonBlackController.java
  5. 3 2
      business-system/filing-system/src/main/java/com/pj/biz/TbPersonFilingController.java
  6. 3 2
      business-system/venues-system/src/main/java/com/pj/biz/TbVenuesController.java
  7. 1 1
      sp-admin/src/main/java/com/pj/project4sp/admin/SpAdmin.java
  8. 3 2
      sp-admin/src/main/java/com/pj/project4sp/admin/SpAdminController.java
  9. 5 4
      sp-admin/src/main/java/com/pj/project4sp/admin/SpAdminMapper.xml
  10. 12 3
      sp-admin/src/main/java/com/pj/project4sp/admin/SpAdminService.java
  11. 2 2
      sp-core/src/main/java/com/pj/current/SaPlusStartup.java
  12. 4 4
      sp-core/src/main/java/com/pj/current/satoken/StpUserUtil.java
  13. 1 1
      sp-core/src/main/java/com/pj/project/tb_car_black/TbCarBlackMapper.xml
  14. 1 1
      sp-core/src/main/java/com/pj/project/tb_car_filing/TbCarFilingMapper.xml
  15. 7 3
      sp-core/src/main/java/com/pj/project/tb_dept/TbDeptController.java
  16. 1 1
      sp-core/src/main/java/com/pj/project/tb_person_black/TbPersonBlackMapper.xml
  17. 1 1
      sp-core/src/main/java/com/pj/project/tb_person_filing/TbPersonFilingMapper.xml
  18. 1 1
      sp-core/src/main/java/com/pj/project/tb_person_visit_record/TbPersonVisitRecordMapper.xml
  19. 1 1
      sp-core/src/main/java/com/pj/project/tb_venues/TbVenuesMapper.xml

+ 3 - 2
business-system/face-identify/src/main/java/com/pj/biz/TbPersonVisitRecordController.java

@@ -2,6 +2,7 @@ package com.pj.biz;
 
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
 import com.pj.project.tb_person_visit_record.TbPersonVisitRecord;
 import com.pj.project.tb_person_visit_record.TbPersonVisitRecordService;
 import com.pj.project.tb_person_visit_record.VisitAddBO;
@@ -79,8 +80,8 @@ public class TbPersonVisitRecordController {
     @RequestMapping("getList")
     public AjaxJson getList() {
         SoMap so = SoMap.getRequestSoMap();
-        long deptId = StpUserUtil.getDeptId();
-        if (deptId != StpUserUtil.ADMIN_DEPT_ID) {
+        String deptId = StpUserUtil.getDeptId();
+        if (!StrUtil.equals(String.valueOf(StpUserUtil.ADMIN_DEPT_ID), deptId)) {
             so.put("deptId", deptId);
         }
         List<TbPersonVisitRecord> list = tbPersonVisitRecordService.getList(so.startPage());

+ 3 - 2
business-system/filing-system/src/main/java/com/pj/biz/TbCarBlackController.java

@@ -2,6 +2,7 @@ package com.pj.biz;
 
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
 import com.pj.project.tb_car_black.TbCarBlack;
 import com.pj.project.tb_car_black.TbCarBlackService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,8 +89,8 @@ public class TbCarBlackController {
     @RequestMapping("getList")
     public AjaxJson getList() {
         SoMap so = SoMap.getRequestSoMap();
-        long deptId = StpUserUtil.getDeptId();
-        if (deptId != StpUserUtil.ADMIN_DEPT_ID) {
+        String deptId = StpUserUtil.getDeptId();
+        if (!StrUtil.equals(String.valueOf(StpUserUtil.ADMIN_DEPT_ID), deptId)) {
             so.put("deptId", deptId);
         }
         List<TbCarBlack> list = tbCarBlackService.getList(so.startPage());

+ 3 - 2
business-system/filing-system/src/main/java/com/pj/biz/TbCarFilingController.java

@@ -2,6 +2,7 @@ package com.pj.biz;
 
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.project.tb_car_filing.TbCarFiling;
 import com.pj.project.tb_car_filing.TbCarFilingService;
@@ -87,8 +88,8 @@ public class TbCarFilingController {
     @RequestMapping("getList")
     public AjaxJson getList() {
         SoMap so = SoMap.getRequestSoMap();
-        long deptId = StpUserUtil.getDeptId();
-        if (deptId != StpUserUtil.ADMIN_DEPT_ID) {
+        String deptId = StpUserUtil.getDeptId();
+        if (!StrUtil.equals(String.valueOf(StpUserUtil.ADMIN_DEPT_ID), deptId)) {
             so.put("deptId", deptId);
         }
         List<TbCarFiling> list = tbCarFilingService.getList(so.startPage());

+ 3 - 2
business-system/filing-system/src/main/java/com/pj/biz/TbPersonBlackController.java

@@ -2,6 +2,7 @@ package com.pj.biz;
 
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
 import com.pj.project.tb_person_black.TbPersonBlack;
 import com.pj.project.tb_person_black.TbPersonBlackService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,8 +89,8 @@ public class TbPersonBlackController {
     @RequestMapping("getList")
     public AjaxJson getList() {
         SoMap so = SoMap.getRequestSoMap();
-        long deptId = StpUserUtil.getDeptId();
-        if (deptId != StpUserUtil.ADMIN_DEPT_ID) {
+        String deptId = StpUserUtil.getDeptId();
+        if (!StrUtil.equals(String.valueOf(StpUserUtil.ADMIN_DEPT_ID), deptId)) {
             so.put("deptId", deptId);
         }
         List<TbPersonBlack> list = tbPersonBlackService.getList(so.startPage());

+ 3 - 2
business-system/filing-system/src/main/java/com/pj/biz/TbPersonFilingController.java

@@ -3,6 +3,7 @@ package com.pj.biz;
 import java.util.List;
 
 import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.util.StrUtil;
 import com.pj.project.tb_person_filing.TbPersonFiling;
 import com.pj.project.tb_person_filing.TbPersonFilingService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,8 +89,8 @@ public class TbPersonFilingController {
     @RequestMapping("getList")
     public AjaxJson getList() {
         SoMap so = SoMap.getRequestSoMap();
-        long deptId = StpUserUtil.getDeptId();
-        if (deptId != StpUserUtil.ADMIN_DEPT_ID) {
+        String deptId = StpUserUtil.getDeptId();
+        if (!StrUtil.equals(String.valueOf(StpUserUtil.ADMIN_DEPT_ID), deptId)) {
             so.put("deptId", deptId);
         }
         List<TbPersonFiling> list = tbPersonFilingService.getList(so.startPage());

+ 3 - 2
business-system/venues-system/src/main/java/com/pj/biz/TbVenuesController.java

@@ -2,6 +2,7 @@ package com.pj.biz;
 
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
 import com.pj.project.tb_venues.TbVenues;
 import com.pj.project.tb_venues.TbVenuesService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,8 +89,8 @@ public class TbVenuesController {
     public AjaxJson getTree() {
         // 获取记录
         SoMap so = SoMap.getRequestSoMap();
-        long deptId = StpUserUtil.getDeptId();
-        if (deptId != StpUserUtil.ADMIN_DEPT_ID) {
+        String deptId = StpUserUtil.getDeptId();
+        if (!StrUtil.equals(String.valueOf(StpUserUtil.ADMIN_DEPT_ID), deptId)) {
             so.put("deptId", deptId);
         }
         List<TbVenues> list = tbVenuesService.getList(so);

+ 1 - 1
sp-admin/src/main/java/com/pj/project4sp/admin/SpAdmin.java

@@ -23,7 +23,7 @@ public class SpAdmin implements Serializable  {
 	/** admin名称 */
 	public String name;	
 	public String nickname;
-	private Long deptId;
+	private String deptId;
 
 	/** 头像地址 */
 	public String avatar;	

+ 3 - 2
sp-admin/src/main/java/com/pj/project4sp/admin/SpAdminController.java

@@ -2,6 +2,7 @@ package com.pj.project4sp.admin;
 
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
 import com.pj.current.satoken.StpUserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -155,8 +156,8 @@ public class SpAdminController {
 	@SaCheckPermission(AuthConst.ADMIN_LIST)
 	AjaxJson getList(){
 		SoMap so = SoMap.getRequestSoMap();
-		long deptId = StpUserUtil.getDeptId();
-		if (StpUserUtil.ADMIN_DEPT_ID != deptId) {
+		String deptId = StpUserUtil.getDeptId();
+		if (!StrUtil.equals(String.valueOf(StpUserUtil.ADMIN_DEPT_ID), deptId)) {
 			so.put("deptId", deptId);
 		}
 		List<SpAdmin> list = spAdminMapper.getList(so.startPage());

+ 5 - 4
sp-admin/src/main/java/com/pj/project4sp/admin/SpAdminMapper.xml

@@ -6,8 +6,8 @@
 	<!-- 增 -->
 	<insert id="add">
 		insert into
-		sp_admin(name, avatar,nickname,detp_id, phone, role_id, create_by_aid, create_time)
-		values (#{name}, #{avatar},#{nickname},#{deptId}, #{phone}, #{roleId}, #{createByAid}, now())
+		sp_admin(name, avatar,nickname,dept_id, dept_name, phone, role_id, create_by_aid, create_time)
+		values (#{name}, #{avatar},#{nickname},#{deptId}, #{deptName}, #{phone}, #{roleId}, #{createByAid}, now())
 	</insert>
 
 
@@ -38,6 +38,7 @@
 		<result property="id" column="id" />
 		<result property="name" column="name" />
 		<result property="deptId" column="dept_id" />
+        <result property="deptName" column="dept_name" />
 		<result property="avatar" column="avatar" />
 		<result property="password" column="password" />
 		<!-- <result property="pw" column="pw" /> -->
@@ -55,7 +56,7 @@
 	<!-- 查询sql -->
 	<sql id="select_sql">
 		select *,
-		(select name from sp_role where id = sp_admin.role_id) as role_name,(select name from tb_dept where id=sp_admin.dept_id) as deptName
+		(select name from sp_role where id = sp_admin.role_id) as role_name
 		from sp_admin 
 	</sql>
 
@@ -84,7 +85,7 @@
 		<include refid="select_sql"></include>
 		where 1=1
 		<if test=' this.has("id")  '>and id = #{id} </if>
-		<if test=' this.has("deptId")  '>and dept_id = #{deptId} </if>
+		<if test=' this.has("deptId")  '>and dept_id in (${deptId}) </if>
 		<if test=' this.has("name")  '>and name like concat('%', #{name}, '%')  </if>
 		<if test=' this.has("roleId")  '>and role_id = #{roleId} </if>
 		order by 

+ 12 - 3
sp-admin/src/main/java/com/pj/project4sp/admin/SpAdminService.java

@@ -1,6 +1,7 @@
 package com.pj.project4sp.admin;
 
 import cn.hutool.core.util.PhoneUtil;
+import cn.hutool.core.util.StrUtil;
 import com.pj.current.global.BusinessException;
 import com.pj.project.tb_dept.TbDept;
 import com.pj.project.tb_dept.TbDeptService;
@@ -15,6 +16,7 @@ import com.pj.project4sp.admin4password.SpAdminPasswordService;
 import cn.dev33.satoken.stp.StpUtil;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 /**
  * Service: admin管理员
@@ -52,10 +54,17 @@ public class SpAdminService {
         // 创建人,为当前账号
         admin.setCreateByAid(StpUtil.getLoginIdAsLong());
         // 开始添加
+        String deptName = "";
+        List<String> deptIdList = StrUtil.splitTrim(admin.getDeptId(), ",");
+        for (String deptId : deptIdList) {
+            TbDept tbDept = tbDeptService.getById(deptId);
+            tbDept.setPeopleNum(tbDept.getPeopleNum() + 1);
+            tbDeptService.updateById(tbDept);
+            deptName += tbDept.getName() + "、";
+        }
+        deptName = deptName.substring(0, deptName.length()-1);
+        admin.setDeptName(deptName);
         spAdminMapper.add(admin);
-        TbDept tbDept = tbDeptService.getById(admin.getDeptId());
-        tbDept.setPeopleNum(tbDept.getPeopleNum() + 1);
-        tbDeptService.updateById(tbDept);
         // 获取主键
         long id = SP.publicMapper.getPrimarykey();
         // 更改密码(md5与明文)

+ 2 - 2
sp-core/src/main/java/com/pj/current/SaPlusStartup.java

@@ -45,12 +45,12 @@ public class SaPlusStartup implements CommandLineRunner {
         InetSocketAddress commandAddress = new InetSocketAddress(myConfig.getIp(),myConfig.getCommandPort());
         CommandNettyServer commandNettyServer=  new CommandNettyServer(commandAddress);
         commandNettyServer.setDaemon(true);
-        commandNettyServer.start();
+      //  commandNettyServer.start();
 
         InetSocketAddress hearAddress = new InetSocketAddress(myConfig.getIp(),myConfig.getHeartPort());
         HeartNettyServer heartNettyServer=  new HeartNettyServer(hearAddress);
         heartNettyServer.setDaemon(true);
-        heartNettyServer.start();
+      //  heartNettyServer.start();
     }
 
 	/**

+ 4 - 4
sp-core/src/main/java/com/pj/current/satoken/StpUserUtil.java

@@ -21,15 +21,15 @@ import com.pj.utils.cache.RedisUtil;
 public class StpUserUtil {
     public static final long ADMIN_DEPT_ID = 9999999L;
 
-    public static void setDeptId(Long deptId) {
+    public static void setDeptId(String deptId) {
         String key = "dept:" + StpUtil.getLoginIdAsString();
-        RedisUtil.set(key, deptId.toString());
+        RedisUtil.set(key, deptId);
     }
 
-    public static long getDeptId() {
+    public static String getDeptId() {
         String key = "dept:" + StpUtil.getLoginIdAsString();
         String deptId = RedisUtil.get(key);
-        return Long.parseLong(deptId);
+        return deptId;
     }
 
     public static void setAdmin(String name, String phone) {

+ 1 - 1
sp-core/src/main/java/com/pj/project/tb_car_black/TbCarBlackMapper.xml

@@ -33,7 +33,7 @@
 		<include refid="select_sql"></include>
 		<where>
 						<if test=' this.has("id") '> and id = #{id} </if>
-			<if test=' this.has("deptId") '> and dept_id = #{deptId} </if>
+			<if test=' this.has("deptId") '> and dept_id in (${deptId}) </if>
 			<if test=' this.has("carNo") '> and car_no like concat('%', #{carNo}, '%') </if>
 			<if test=' this.has("reason") '> and reason = #{reason} </if>
 			<if test=' this.has("startTime") '> and start_time = #{startTime} </if>

+ 1 - 1
sp-core/src/main/java/com/pj/project/tb_car_filing/TbCarFilingMapper.xml

@@ -38,7 +38,7 @@
 		<include refid="select_sql"></include>
 		<where>
 						<if test=' this.has("id") '> and id = #{id} </if>
-			<if test=' this.has("deptId") '> and dept_id = #{deptId} </if>
+			<if test=' this.has("deptId") '> and dept_id in (${deptId}) </if>
 			<if test=' this.has("carNo") '> and car_no  like concat('%',#{carNo} ,'%')</if>
 			<if test=' this.has("type") '> and type = #{type} </if>
 			<if test=' this.has("driverName") '> and driver_name like concat('%', #{driverName} ,'%')</if>

+ 7 - 3
sp-core/src/main/java/com/pj/project/tb_dept/TbDeptController.java

@@ -2,6 +2,7 @@ package com.pj.project.tb_dept;
 
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -86,10 +87,13 @@ public class TbDeptController {
     @RequestMapping("getList")
     public AjaxJson getList() {
         SoMap so = SoMap.getRequestSoMap();
-        long deptId = StpUserUtil.getDeptId();
-        if (StpUserUtil.ADMIN_DEPT_ID != deptId) {
-            so.put("id", deptId);
+        String deptId = StpUserUtil.getDeptId();
+        if (!StrUtil.equals(String.valueOf(StpUserUtil.ADMIN_DEPT_ID), deptId)) {
+            so.put("deptId", deptId);
         }
+//        if (StpUserUtil.ADMIN_DEPT_ID != deptId) {
+//            so.put("id", deptId);
+//        }
         List<TbDept> list = tbDeptService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }

+ 1 - 1
sp-core/src/main/java/com/pj/project/tb_person_black/TbPersonBlackMapper.xml

@@ -34,7 +34,7 @@
 		<include refid="select_sql"></include>
 		<where>
 						<if test=' this.has("id") '> and id = #{id} </if>
-			<if test=' this.has("deptId") '> and dept_id = #{deptId} </if>
+			<if test=' this.has("deptId") '> and dept_id in (${deptId}) </if>
 			<if test=' this.has("name") '> and name like concat('%', #{name}, '%') </if>
 			<if test=' this.has("idCard") '> and id_card = #{idCard} </if>
 			<if test=' this.has("reason") '> and reason = #{reason} </if>

+ 1 - 1
sp-core/src/main/java/com/pj/project/tb_person_filing/TbPersonFilingMapper.xml

@@ -37,7 +37,7 @@
 		<include refid="select_sql"></include>
 		<where>
 						<if test=' this.has("id") '> and id = #{id} </if>
-			<if test=' this.has("deptId") '> and dept_id = #{deptId} </if>
+			<if test=' this.has("deptId") '> and dept_id in (${deptId}) </if>
 			<if test=' this.has("name") '> and name = #{name} </if>
 			<if test=' this.has("type") '> and type = #{type} </if>
 			<if test=' this.has("idCard") '> and id_card = #{idCard} </if>

+ 1 - 1
sp-core/src/main/java/com/pj/project/tb_person_visit_record/TbPersonVisitRecordMapper.xml

@@ -38,7 +38,7 @@
 		<where>
 						<if test=' this.has("id") '> and id = #{id} </if>
 			<if test=' this.has("direction") '> and direction = #{direction} </if>
-			<if test=' this.has("deptId") '> and dept_id = #{deptId} </if>
+			<if test=' this.has("deptId") '> and dept_id in (${deptId}) </if>
 			<if test=' this.has("deptName") '> and dept_name = #{deptName} </if>
 			<if test=' this.has("name") '> and name like concat('%',#{name},'%') </if>
 			<if test=' this.has("idCard") '> and id_card = #{idCard} </if>

+ 1 - 1
sp-core/src/main/java/com/pj/project/tb_venues/TbVenuesMapper.xml

@@ -32,7 +32,7 @@
 		<include refid="select_sql"></include>
 		<where>
 			<if test=' this.has("deptName") '> and dept_name = #{deptName} </if>
-			<if test=' this.has("deptId") '> and dept_id = #{deptId} </if>
+			<if test=' this.has("deptId") '> and dept_id in (${deptId}) </if>
 			<if test=' this.has("name") '> and name like concat('%', #{name},'%') and p_id=-1 </if>
 		</where>
 		order by