Browse Source

新增外包审核员订单合同查看权限

anderx 3 years ago
parent
commit
4a718cde22

+ 12 - 18
src/main/java/com/goafanti/ambSystem/service/Impl/AmbServiceImpl.java

@@ -73,39 +73,33 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
     private void pushAdminAmbRole(InputAmb in,AmbSystem use) {
         //如果是修改,处理原负责人
         if (in.getId()!=null){
-
             if (in.getLeader()!=null){
-                updateAmbRole(use.getLeader(),0);
+                updateAmbRole(use.getLeader());
             }
         }
-        updateAmbRole(in.getLeader(),1);
+        updateAmbRole(in.getLeader());
     }
 
     /**
      *
      * @param leader
-     * @param type 0去掉巴主  1成为巴主
      */
-    private void updateAmbRole(String  leader,Integer type) {
+    private void updateAmbRole(String  leader) {
         StringBuffer str=new StringBuffer();
-        Admin admin =new Admin();
         List<AmbSystem> list=selectByLeader(leader);
+        Admin a =new Admin();
         for (AmbSystem ambSystem : list) {
-            str.append(ambSystem.getLvl()).append(",");
-        }
-        if (type==1){
-            if (admin.getAmbRole()==null||admin.getAmbRole().contains("7")){
-                str.append("7").append(",");
+            if (ambSystem.getLvl()==5||ambSystem.getLvl()==6){
+                a.setAmbManage(1);
             }
+            str.append(ambSystem.getLvl()).append(",");
+
         }
-        if (StringUtils.isNotBlank(str)){
-            Admin a =new Admin();
-            a.setId(leader);
-            a.setAmbRole(str.substring(0,str.length()-1));
-            adminMapper.updateByPrimaryKeySelective(a);
-        }
-    }
+        a.setId(leader);
+        if (StringUtils.isNotBlank(str)) a.setAmbRole(str.substring(0,str.length()-1));
+        adminMapper.updateByPrimaryKeySelective(a);
 
+    }
     private List<AmbSystem> selectByLeader(String leader) {
         AmbSystem a =new AmbSystem();
         a.setLeader(leader);

+ 41 - 37
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -26,11 +26,12 @@
     <result column="reviewer" jdbcType="VARCHAR" property="reviewer" />
     <result column="amb_id" jdbcType="VARCHAR" property="ambId" />
     <result column="amb_role" jdbcType="VARCHAR" property="ambRole" />
+    <result column="amb_manage" jdbcType="INTEGER" property="ambManage" />
   </resultMap>
   <sql id="Base_Column_List">
     id, mobile, `name`, `password`, email, create_time, `number`, province, `position`,
     superior_id, city, department_id, `status`, user_no, duty, district, head_portrait_url,
-    contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id, amb_role
+    contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id, amb_role, amb_manage
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -42,32 +43,29 @@
     delete from admin
     where id = #{id,jdbcType=VARCHAR}
   </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.Admin">
-    insert into admin (id, mobile, `name`,
-      `password`, email, create_time,
-      `number`, province, `position`,
-      superior_id, city, department_id,
-      `status`, user_no, duty,
-      district, head_portrait_url, contact_mobile,
-      last_login_time, open_id, `type`,
-      reviewer, amb_id, amb_role
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
+    insert into admin (mobile, `name`, `password`,
+      email, create_time, `number`,
+      province, `position`, superior_id,
+      city, department_id, `status`,
+      user_no, duty, district,
+      head_portrait_url, contact_mobile, last_login_time,
+      open_id, `type`, reviewer,
+      amb_id, amb_role, amb_manage
       )
-    values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
-      #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
-      #{number,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
-      #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR},
-      #{status,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR},
-      #{district,jdbcType=VARCHAR}, #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
-      #{lastLoginTime,jdbcType=TIMESTAMP}, #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
-      #{reviewer,jdbcType=VARCHAR}, #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR}
+    values (#{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
+      #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{number,jdbcType=INTEGER},
+      #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{superiorId,jdbcType=VARCHAR},
+      #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
+      #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR}, #{district,jdbcType=VARCHAR},
+      #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}, #{lastLoginTime,jdbcType=TIMESTAMP},
+      #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{reviewer,jdbcType=VARCHAR},
+      #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR}, #{ambManage,jdbcType=INTEGER}
       )
   </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
     insert into admin
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
       <if test="mobile != null">
         mobile,
       </if>
@@ -137,11 +135,11 @@
       <if test="ambRole != null">
         amb_role,
       </if>
+      <if test="ambManage != null">
+        amb_manage,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
       <if test="mobile != null">
         #{mobile,jdbcType=VARCHAR},
       </if>
@@ -211,6 +209,9 @@
       <if test="ambRole != null">
         #{ambRole,jdbcType=VARCHAR},
       </if>
+      <if test="ambManage != null">
+        #{ambManage,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
@@ -285,6 +286,9 @@
       <if test="ambRole != null">
         amb_role = #{ambRole,jdbcType=VARCHAR},
       </if>
+      <if test="ambManage != null">
+        amb_manage = #{ambManage,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -312,10 +316,10 @@
       `type` = #{type,jdbcType=INTEGER},
       reviewer = #{reviewer,jdbcType=VARCHAR},
       amb_id = #{ambId,jdbcType=VARCHAR},
-      amb_role = #{ambRole,jdbcType=VARCHAR}
+      amb_role = #{ambRole,jdbcType=VARCHAR},
+      amb_manage = #{ambManage,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>
-
   <select id="selectAllAdmin" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
@@ -556,12 +560,6 @@
       left  join  user_role  ur on a.id=ur.uid
       RIGHT join (select id from role where role_name =#{roleName,jdbcType=VARCHAR}) y on ur.rid=y.id
     </if>
-    <if test="ambManage ==0">
-      RIGHT join (select id from admin where(find_in_set( 5 ,amb_role) or find_in_set( 6 ,amb_role)))am on a.id !=am.id
-    </if>
-    <if test="ambManage ==1">
-      RIGHT join (select id from admin where(find_in_set( 5 ,amb_role) or find_in_set( 6 ,amb_role)))am on a.id =am.id
-    </if>
     where a.status in (0,1)
     <if test="name != null">
       and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
@@ -591,6 +589,9 @@
     <if test="ancestors != null">
       and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
     </if>
+    <if test="ambManage !=null">
+      and a.amb_manage= #{ambManage}
+    </if>
     order by a.last_login_time desc
     <if test="page_sql!=null">
       ${page_sql}
@@ -638,6 +639,9 @@
     <if test="ancestors != null">
       and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
     </if>
+    <if test="ambManage !=null">
+      and a.amb_manage= #{ambManage}
+    </if>
   </select>
   <insert id="insertn" parameterType="com.goafanti.common.model.Admin">
     insert into admin (id, mobile, name,
@@ -1062,7 +1066,7 @@
 
   <select id="listAdminBydepIdAndRoleType" resultType="com.goafanti.common.model.Admin">
     select a.id,a.name  from admin a left join user_role b on a.id =b.uid
-                              left join `role` c on b.rid=c.id
+                                     left join `role` c on b.rid=c.id
     where department_id= #{depId}
       and c.role_type= #{roleType}
   </select>
@@ -1115,11 +1119,11 @@
   <select id="selectAdminByRoleType" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
     SELECT a.id,a.name ,a.mobile ,a.email,a.department_id departmentId
     FROM admin a left join user_role b on a.id=b.uid
-                 left join `role` c on b.rid =c.id
+    left join `role` c on b.rid =c.id
     where a.status='0'
-      <if test="roleType =='99998'">
+    <if test="roleType =='99998'">
       and c.role_type  in ('99998','99988')
-      </if>
+    </if>
     <if test="roleType =='99999'">
       and c.role_type  in ('99999','99989')
     </if>

+ 18 - 6
src/main/java/com/goafanti/common/model/Admin.java

@@ -3,7 +3,7 @@ package com.goafanti.common.model;
 import com.goafanti.common.constant.AFTConstants;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
-import java.io.Serializable;
+
 import java.util.Date;
 
 /**
@@ -11,8 +11,6 @@ import java.util.Date;
  * @author
  */
 public class Admin extends BaseModel implements AftUser {
-    private static final long	serialVersionUID	= 1L;
-
     private String id;
 
     /**
@@ -127,6 +125,12 @@ public class Admin extends BaseModel implements AftUser {
      */
     private String ambRole;
 
+    /**
+     * 阿米巴管理者 0巴员 1巴主
+     */
+    private Integer ambManage;
+
+    private static final long serialVersionUID = 1L;
 
 
     /**
@@ -161,6 +165,11 @@ public class Admin extends BaseModel implements AftUser {
             return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
         }
     }
+    @Override
+    public String getAid() {
+        return getId();
+    }
+
 
     public String getId() {
         return id;
@@ -354,8 +363,11 @@ public class Admin extends BaseModel implements AftUser {
         this.ambRole = ambRole;
     }
 
-    @Override
-    public String getAid() {
-        return null;
+    public Integer getAmbManage() {
+        return ambManage;
+    }
+
+    public void setAmbManage(Integer ambManage) {
+        this.ambManage = ambManage;
     }
 }

+ 2 - 0
src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java

@@ -648,6 +648,8 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			}
 			if (str.length()>0)noc.setExamineName(str.substring(0,str.length()-1));
 
+		}else if (noc.getProcessState()== OrderChangeProcess.ZC.getCode()||noc.getProcessState()== OrderChangeProcess.DSZ.getCode()){
+			noc.setExamineName("");
 		}
 	}