Browse Source

Merge branch 'master' into test

anderx 2 years ago
parent
commit
e188e2eabd

+ 12 - 0
src/main/java/com/goafanti/admin/bo/AdminListBo.java

@@ -110,14 +110,26 @@ public class AdminListBo {
 	 */
 	private String depManager;
 
+	/**
+	 *  0新员工 1老员工
+	 */
+	private Integer seniorStaff;
 
 	private String ambId;
 	private String ancestors;
 	private Integer ambManage;
+
 	private String ambName;
 	private String ancestorsNames;
 	private String ambRole;
 
+	public Integer getSeniorStaff() {
+		return seniorStaff;
+	}
+
+	public void setSeniorStaff(Integer seniorStaff) {
+		this.seniorStaff = seniorStaff;
+	}
 
 	public String getAmbId() {
 		return ambId;

+ 3 - 3
src/main/java/com/goafanti/admin/controller/AdminSuperviseApiController.java

@@ -111,8 +111,8 @@ public class AdminSuperviseApiController extends CertifyApiController {
 	 * 管理员列表
 	 */
 	@RequestMapping(value = "/adminList", method = RequestMethod.GET)
-	public Result adminList(Integer province, Integer number, String mobile, String name,String roleName, String pageNo,
-			String pageSize) {
+	public Result adminList(Integer province, Integer number, String mobile, String name,String roleName,Integer seniorStaff,
+							String pageNo, String pageSize) {
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pSize = 10;
@@ -122,7 +122,7 @@ public class AdminSuperviseApiController extends CertifyApiController {
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 		}
-		res.setData(adminService.listAdmin(province, number, mobile, name, roleName, pNo, pSize));
+		res.setData(adminService.listAdmin(province, number, mobile, name, roleName,seniorStaff, pNo, pSize));
 		return res;
 	}
 

+ 2 - 2
src/main/java/com/goafanti/admin/service/AdminService.java

@@ -16,8 +16,8 @@ public interface AdminService {
 
 	Admin selectByPrimaryKey(String key);
 
-	Pagination<AdminListBo> listAdmin(Integer province, Integer number, String mobile, String name, String roleName, Integer pNo,
-			Integer pSize);
+	Pagination<AdminListBo> listAdmin(Integer province, Integer number, String mobile, String name, String roleName,Integer seniorStaff,
+									  Integer pNo, Integer pSize);
 
 	int insert(Admin ad);
 

+ 11 - 4
src/main/java/com/goafanti/admin/service/impl/AdminServiceImpl.java

@@ -75,13 +75,14 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<AdminListBo> listAdmin(Integer province, Integer number, String mobile, String name,String roleName,
+	public Pagination<AdminListBo> listAdmin(Integer province, Integer number, String mobile, String name,String roleName,Integer seniorStaff,
 			Integer pageNo, Integer pageSize) {
 		Map<String, Object> params = new HashMap<>();
 		if (StringUtils.isNotBlank(roleName))params.put("roleName", roleName);
 		if (StringUtils.isNotBlank(mobile))params.put("mobile", mobile);
 		if (StringUtils.isNotBlank(name))params.put("name", name);
 		if (null != number)params.put("number", number);
+		if (null != seniorStaff)params.put("seniorStaff", seniorStaff);
 		if (pageNo == null || pageNo < 0)pageNo = 1;
 		if (pageSize == null || pageSize < 0 || pageSize > 10)pageSize = 10;
 		if (province != null) params.put("province", province);
@@ -375,6 +376,12 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		if (endTime!=null)endTime=endTime+" 23:59:59";
 		List<DepCountBo >deps=new ArrayList<>();
 		List<Department> depIds=new ArrayList<>();
+		//总裁助力不查看老员工
+		Integer seniorstaff = null;
+		if (TokenManager.hasRole(AFTConstants.CED_ASSISTANT)){
+			seniorstaff=0;
+		}
+
 		if (depId==null) {
 			acb.setName("科德集团");
 			deps=departmentMapper.selectBysuperName("科德集团");
@@ -396,7 +403,7 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		//原sql计算
 //		list=departmentMapper.AlldepCount(depIds,startTime,  endTime);
 		//新java计算
-		list=AllDepCount(depIds,startTime,endTime);
+		list=AllDepCount(depIds,startTime,endTime,seniorstaff);
 		for (AdminCustomerBo ad : list) {
 			if (acb.getId().equals(ad.getDepId())){
 				acb.getaList().add(ad);
@@ -416,8 +423,8 @@ public class AdminServiceImpl extends BaseMybatisDao<AdminMapper> implements Adm
 		return acb;
 	}
 
-	private List<AdminCustomerBo> AllDepCount(List<Department> depIds, String startTime, String endTime) {
-		List<AdminCustomerBo> admins = adminMapper.selectByDeps(depIds);
+	private List<AdminCustomerBo> AllDepCount(List<Department> depIds, String startTime, String endTime,Integer seniorStaff) {
+		List<AdminCustomerBo> admins = adminMapper.selectByDeps(depIds,seniorStaff);
 		if(!admins.isEmpty()){
 			List<AdminCustomerBo> users = 	userMapper.selectNoChannelByaids(admins,startTime,endTime);
 			List<AdminCustomerBo> users2 = 	userMapper.selectChannelByaids(admins,startTime,endTime);

+ 1 - 0
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -51,6 +51,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		if(StringUtils.isNotBlank(alb.getAmbId())) params.put("ambId", alb.getAmbId());
 		if(StringUtils.isNotBlank(alb.getAncestors())) params.put("ancestors", alb.getAncestors());
 		if(alb.getAmbManage()!=null) params.put("ambManage", alb.getAmbManage());
+		if(alb.getSeniorStaff()!=null) params.put("seniorStaff", alb.getSeniorStaff());
 		Pagination<AdminListBo> p=(Pagination<AdminListBo>)findPage("selectAdminListByPage","selectAdminCount",params,pageNo,pageSize);
 		List<AdminListBo> list= (List<AdminListBo>) p.getList();
 		for(AdminListBo i:list){

+ 1 - 1
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -164,5 +164,5 @@ public interface AdminMapper {
 
     List<Admin> selectAdminByRoleType(@Param("roleType") String roleType);
 
-    List<AdminCustomerBo > selectByDeps(@Param("depIds") List<Department> depIds);
+    List<AdminCustomerBo > selectByDeps(@Param("depIds") List<Department> depIds,@Param("seniorStaff") Integer seniorStaff);
 }

+ 62 - 42
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -28,12 +28,13 @@
     <result column="amb_role" jdbcType="VARCHAR" property="ambRole" />
     <result column="amb_manage" jdbcType="INTEGER" property="ambManage" />
     <result column="manager_id" jdbcType="VARCHAR" property="managerId" />
+    <result column="senior_staff" jdbcType="INTEGER" property="seniorStaff" />
   </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, amb_manage,
-    manager_id
+    manager_id, senior_staff
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -45,32 +46,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,
-      amb_manage, manager_id)
-    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},
-      #{ambManage,jdbcType=INTEGER}, #{managerId,jdbcType=VARCHAR})
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
+    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, amb_manage,
+      manager_id, senior_staff)
+    values (#{id},#{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},
+      #{managerId,jdbcType=VARCHAR}, #{seniorStaff,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>
@@ -146,11 +144,11 @@
       <if test="managerId != null">
         manager_id,
       </if>
+      <if test="seniorStaff != null">
+        senior_staff,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
       <if test="mobile != null">
         #{mobile,jdbcType=VARCHAR},
       </if>
@@ -226,6 +224,9 @@
       <if test="managerId != null">
         #{managerId,jdbcType=VARCHAR},
       </if>
+      <if test="seniorStaff != null">
+        #{seniorStaff,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
@@ -306,6 +307,9 @@
       <if test="managerId != null">
         manager_id = #{managerId,jdbcType=VARCHAR},
       </if>
+      <if test="seniorStaff != null">
+        senior_staff = #{seniorStaff,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -335,7 +339,8 @@
       amb_id = #{ambId,jdbcType=VARCHAR},
       amb_role = #{ambRole,jdbcType=VARCHAR},
       amb_manage = #{ambManage,jdbcType=INTEGER},
-      manager_id = #{managerId,jdbcType=VARCHAR}
+      manager_id = #{managerId,jdbcType=VARCHAR},
+      senior_staff = #{seniorStaff,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>
 
@@ -522,6 +527,9 @@
     <if test="number != null">
       and a.number = #{number,jdbcType=INTEGER}
     </if>
+    <if test="seniorStaff != null">
+      and a.senior_staff = #{seniorStaff}
+    </if>
     <if test="province != null">
       and a.province = #{province,jdbcType=VARCHAR}
     </if>
@@ -548,6 +556,9 @@
     <if test="number != null">
       and number = #{number,jdbcType=INTEGER}
     </if>
+    <if test="seniorStaff != null">
+      and a.senior_staff = #{seniorStaff}
+    </if>
     <if test="province != null">
       and a.province = #{province,jdbcType=VARCHAR}
     </if>
@@ -568,7 +579,7 @@
   <select id="selectAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
     select a.id, a.mobile, a.name, a.position, a.email, a.province, a.city, a.create_time as createTime, aa.name as superior,dep.name departmentName,
     a.superior_id as superiorId, a.department_id as departmentId, a.last_login_time as lastLoginTime, a.contact_mobile as contactMobile,
-    a.duty,a.status, a.type, ambs.id ambId,ambs.name ambName,ambs.ancestors_names ancestorsNames ,a.amb_role ambRole
+    a.duty,a.status, a.type, ambs.id ambId,ambs.name ambName,ambs.ancestors_names ancestorsNames ,a.amb_role ambRole,a.senior_staff seniorStaff
     from admin a
     left join admin_location al on a.id = al.admin_id
     left join admin aa on aa.id = a.superior_id
@@ -607,6 +618,9 @@
     <if test="ambId != null">
       and a.amb_id = #{ambId}
     </if>
+    <if test="seniorStaff != null">
+      and a.senior_staff = #{seniorStaff}
+    </if>
     <if test="ancestors != null">
       and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
     </if>
@@ -657,6 +671,9 @@
     <if test="ambId != null">
       and a.amb_id = #{ambId}
     </if>
+    <if test="seniorStaff != null">
+      and a.senior_staff = #{seniorStaff}
+    </if>
     <if test="ancestors != null">
       and (ambs.id=#{ancestors} or find_in_set( #{ancestors} ,ambs.ancestors))
     </if>
@@ -700,10 +717,10 @@
     select a.id, a.mobile, a.name, a.`password`, a.email, a.create_time as createTime,
            a.province, a.`position`,a.reviewer , a.superior_id as superiorId,
            a.department_id as departmentId, a.status,a.user_no as userNo,a.duty,a.district,
-           a.head_portrait_url as headPortraitUrl, a.contact_mobile as contactMobile,
+           a.head_portrait_url as headPortraitUrl, a.contact_mobile as contactMobile,a.senior_staff seniorStaff,
            b.name superior,c.name reviewerName,a.type,a.amb_id ambId,a.manager_id managerId ,d.name managerName
     from admin a left join admin b on a.superior_id =b.id left join admin c on a.reviewer =c.id
-    left join admin d on a.manager_id=d.id
+                 left join admin d on a.manager_id=d.id
     where a.id= #{id,jdbcType=VARCHAR}
   </select>
   <select id="selectNameByid" parameterType="java.lang.String" resultType="java.lang.String">
@@ -1156,15 +1173,18 @@
       and c.role_type  in (#{roleType})
     </if>
   </select>
-    <select id="selectByDeps" resultType="com.goafanti.admin.bo.AdminCustomerBo">
-      SELECT a.id aid,a.name aName,a.department_id depId,d.name depName
-      from admin a left join department d on a.department_id = d.id
-      where a.status =0 and a.`type` =1
-      <if test="depIds!= null">
-        and a.department_id in
-        <foreach close=")" collection="depIds" item="deps" open="(" separator=",">
-          #{deps.id}
-        </foreach>
-      </if>
-    </select>
+  <select id="selectByDeps" resultType="com.goafanti.admin.bo.AdminCustomerBo">
+    SELECT a.id aid,a.name aName,a.department_id depId,d.name depName
+    from admin a left join department d on a.department_id = d.id
+    where a.status =0 and a.`type` =1
+      <if test="seniorStaff != null">
+        and a.senior_staff=#{seniorStaff}
+      </if>
+    <if test="depIds!= null">
+      and a.department_id in
+      <foreach close=")" collection="depIds" item="deps" open="(" separator=",">
+        #{deps.id}
+      </foreach>
+    </if>
+  </select>
 </mapper>

+ 13 - 0
src/main/java/com/goafanti/common/model/Admin.java

@@ -135,6 +135,11 @@ public class Admin extends BaseModel implements AftUser {
      */
     private String managerId;
 
+    /**
+     * 0新员工 1老员工
+     */
+    private Integer seniorStaff;
+
     private static final long serialVersionUID = 1L;
 
 
@@ -391,4 +396,12 @@ public class Admin extends BaseModel implements AftUser {
     public void setManagerId(String managerId) {
         this.managerId = managerId;
     }
+
+    public Integer getSeniorStaff() {
+        return seniorStaff;
+    }
+
+    public void setSeniorStaff(Integer seniorStaff) {
+        this.seniorStaff = seniorStaff;
+    }
 }