Browse Source

随身邦-自主下单增加权限控制

njs 2 years ago
parent
commit
9f94fc8cde

+ 12 - 21
suishenbang-system/src/main/java/com/dgtly/system/domain/SysUser.java

@@ -118,8 +118,10 @@ public class SysUser extends BaseEntity
     private SysUserExt  sysUserExt;
     /** 用户销售信息扩展 */
     private List<SysUserExt>  sysUserExtLsit;
-    /** 是否收货人 */
+    /** 是否收货人 0否 1是*/
     private String  isConsignee;
+    /** 自主下单是否授权(0否1是)*/
+    private String  isIndependently;
     /*企业认证状态0未认证1已认证*/
     private String isOrgAuthentication;
     /*企业认证时间*/
@@ -135,7 +137,7 @@ public class SysUser extends BaseEntity
 
     /** 用户权限 TUC*/
     private String  authorType;
-    //2离职authorType
+    //2离职
     private String quit;
 
     public String getQuit(){return  quit;}
@@ -163,6 +165,14 @@ public class SysUser extends BaseEntity
 
     }
 
+    public String getIsIndependently() {
+        return isIndependently;
+    }
+
+    public void setIsIndependently(String isIndependently) {
+        this.isIndependently = isIndependently;
+    }
+
     public List<Ztree> getAuthor() {
         return author;
     }
@@ -576,26 +586,7 @@ public class SysUser extends BaseEntity
             .toString();
     }
 
-    @Override
-    public int hashCode() {
-        int result = 20;
-        result = 31 * result + (loginName == null ? 0 : loginName.hashCode());
-        return result;
-
-    }
 
-    @Override
-    public boolean equals(Object object) {
-
-        boolean result = false;
-        if (object instanceof SysUser) {
-            SysUser that = (SysUser) object;
-            if (this.hashCode() == that.hashCode()) {
-                result = true;
-            }
-        }
-        return result;
-    }
 }
 
 

+ 10 - 5
suishenbang-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.dgtly.system.mapper.SysUserMapper">
 
-	<resultMap type="SysUser" id="SysUserResult">
+	<resultMap  id="SysUserResult" type="SysUser">
 		<id     property="userId"       column="user_id"      />
 		<result property="companyId"       column="company_id"      />
 		<result property="deptId"       column="dept_id"      />
@@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="updateTime"   column="update_time"  />
 		<result property="remark"       column="remark"       />
 		<result property="isConsignee"       column="is_consignee"       />
+		<result property="isIndependently"  column="is_independently" />
 		<result property="isSync"       column="is_sync"       />
 		<result property="quit"       column="quit"       />
 		<result property="isAuthentication"       column="is_authentication"       />
@@ -88,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<sql id="selectUserVo">
         select  u.user_id,u.company_id, u.dept_id, u.login_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.password, u.salt,u.id_type,u.id_number,u.account_id,u.is_authentication,u.receive_url_mobile_no, u.status,
-        		u.del_flag, u.login_ip, u.login_date, u.create_time, u.remark,u.is_consignee,u.person_attestation_time,is_sync,
+        		u.del_flag, u.login_ip, u.login_date, u.create_time, u.remark,u.is_consignee,u.person_attestation_time,u.is_independently,is_sync,
         		c.company_name,u.quit,
        		    d.dept_id, d.parent_id, d.dept_name, d.order_num, d.leader, d.status as dept_status,
        		    r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,
@@ -104,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
 		select u.user_id,u.company_id, u.dept_id, u.login_name, u.user_name,u.id_type,u.id_number,u.account_id,u.is_authentication,u.receive_url_mobile_no, u.email, u.avatar,
-          u.phonenumber, u.password, u.sex, u.salt, u.status, u.del_flag,u.quit,
+          u.phonenumber, u.password, u.sex, u.salt, u.status, u.del_flag,u.quit,u.is_independently,
           u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
           d.dept_name, d.leader,
 		suse.identity,suse.sales_level,suse.org_name,suse.org_code,suse.post_name,suse.is_customer_manager,ce.is_authentication is_org_authentication,ce.org_attestation_time
@@ -216,7 +217,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<select id="selectUserByLoginName" parameterType="String" resultMap="SysUserResult">
 	    <include refid="selectUserVo"/>
-		where u.login_name = #{userName} and u.quit is null
+		where u.login_name = #{userName} and u.quit is null GROUP BY login_name
 	</select>
 
 	<select id="selectUserByIsManager"  resultType="java.lang.String">
@@ -248,6 +249,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			u.id_number,
 			u.account_id,
 			u.is_authentication,
+		    u.is_independently,
 			u.receive_url_mobile_no,
 			u.STATUS,
 			u.del_flag,
@@ -330,6 +332,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="idNumber != null and idNumber != ''">id_number = #{idNumber},</if>
  			<if test="accountId != null and accountId != ''">account_id = #{accountId},</if>
  			<if test="isAuthentication != null and isAuthentication != ''">is_authentication = #{isAuthentication},</if>
+			<if test="isIndependently != null ">is_independently = #{isIndependently},</if>
  			<if test="personAttestationTime != null">person_attestation_time = #{personAttestationTime},</if>
  			<if test="receiveUrlMobileNo != null and receiveUrlMobileNo != ''">receive_url_mobile_no = #{receiveUrlMobileNo},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
@@ -369,6 +372,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="remark != null">remark = #{remark},</if>
 			<if test="isConsignee != null">is_consignee = #{isConsignee},</if>
 			<if test="isSync != null">is_sync = #{isSync},</if>
+			<if test="isIndependently != null ">is_independently = #{isIndependently},</if>
 			update_time = sysdate()
 		</set>
 		where login_name = #{loginName}
@@ -526,13 +530,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			u.user_id,
 			u.user_name,
 			u.is_consignee,
+		    u.is_independently,
 			v.sap_employee_id,
 			v.org_code
 		FROM
 			sys_user u
 		LEFT JOIN sys_user_ext v ON u.user_id = v.user_id
 		WHERE
-			v.org_code =#{orgCode}
+			v.org_code =#{orgCode} and u.quit is null
 	</select>
 
 	<select id="getCustomNameByCode" resultType="java.lang.String" >

+ 2 - 2
suishenbang-system/src/main/resources/mapper/system/SysUserSalesExtMapper.xml

@@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <select id="selectSysUserExtById" parameterType="Long" resultMap="SysUserExtResult">
         <include refid="selectSysUserExtVo"/>
-        where user_id = #{userId}
+        where user_id = #{userId} and is_customer_manager !='0' and is_customer_manager !='8'
     </select>
         
     <insert id="insertSysUserExt" parameterType="SysUserExt">
@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
              is_customer_manager = #{isCustomerManager},
             <if test="postCode != null and postCode != ''">  post_code = #{postCode},</if>
             <if test="postName != null  and postName != ''">  post_name = #{postName}, </if>
-            <if test="identity != null  and identity != ''">  `identity` = #{identity}, </if>
+            <if test="identity != null  and identity != ''">  identity = #{identity}, </if>
         </trim>
         where user_id = #{userId}
     </update>

+ 23 - 0
suishenbang-wxportal/suishenbang-wxportal-api/src/main/java/com/dgtly/wxportal/controller/WxPortalController.java

@@ -240,6 +240,29 @@ public class WxPortalController extends ApiBaseController {
         }
     }
 
+    @ApiOperation(value = "设置/取消自主下单授权", notes = "参数:{'userId':'XXXXXXX','isIndependently':'1'}" +
+            "\n(userId:用户id" +
+            "\n isIndependently:是否自主下单授权(0否1是))")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "params", paramType = "body")
+    })
+    @PostMapping("updateUserByIsIndependently")
+    public Object updateUserByIsIndependently() {
+        ParameterObject obj = getParameterObject();
+        obj.checkParameterNotNull("userId,isIndependently");
+        String userId = obj.getString("userId");
+        String IsIndependently = obj.getString("isIndependently");
+        SysUser user = new SysUser();
+        user.setUserId(Long.parseLong(userId));
+        user.setIsIndependently(IsIndependently);
+        int i = userService.updateUserInfo(user);
+        if (i>0){
+            return AjaxResult.success();
+        }else {
+            return AjaxResult.error();
+        }
+    }
+
     @ApiOperation(value = "帮助中心",notes = "参数:{userId:1}")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "params" , paramType = "body")