Browse Source

科德系统修改公司管理开发

anderx 3 years ago
parent
commit
d3f1693602

+ 24 - 4
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -2,9 +2,10 @@ package com.goafanti.admin.service.impl;
 
 import java.util.*;
 
-import com.goafanti.common.dao.AmbSystemMapper;
+import com.goafanti.common.dao.*;
 import com.goafanti.common.model.AmbSystem;
 import com.goafanti.common.model.Role;
+import com.goafanti.common.utils.AsyncUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -13,9 +14,6 @@ import com.goafanti.admin.bo.AdminDetail;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.admin.service.NewAdminService;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.AdminLocationMapper;
-import com.goafanti.common.dao.AdminMapper;
-import com.goafanti.common.dao.UserRoleMapper;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.UserRole;
 import com.goafanti.common.utils.StringUtils;
@@ -33,6 +31,10 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 	private AdminLocationMapper	adminLocationMapper;
 	@Autowired
 	private AmbSystemMapper	ambSystemMapper;
+	@Autowired
+	private RoleMapper	roleMapper;
+	@Autowired
+	private AsyncUtils asyncUtils;
 
 	@Override
 	public Pagination<AdminListBo> listAdmin(AdminListBo alb, String rid,String roleName,Integer pageNo, Integer pageSize) {
@@ -101,9 +103,11 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 			}
 			TokenManager.clearUserAuthByUserId(ad.getId());
 		}
+
 		ad.setType(sumType(roleIds));
 		int count=adminMapper.updateByPrimaryKeySelective(ad);
 		pushAmbRole(ad);
+		pushAdminRole(ad.getId(),roleIds);
 		if (count>0&&ad.getAmbId()!=null){
 			//进行巴人数计算
 //			AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(Long.valueOf(ad.getAmbId()));
@@ -117,6 +121,22 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		return count;
 	}
 
+	private void pushAdminRole(String id,List<String>roleIds) {
+		boolean flag=false;
+		List<Role> roleList = roleMapper.selectByIdList(roleIds);
+		for (Role role : roleList) {
+			if (role.getRoleType().equals(AFTConstants.COMPANY_MANAGER)){
+				flag=true;
+				break;
+			}
+		}
+		if (flag){
+			Admin admin = adminMapper.selectByPrimaryKey(id);
+			asyncUtils.updateexamineName(2,admin.getDepartmentId(),admin.getId());
+		}
+
+	}
+
 
 	private int sumType(List<String > roleIds) {
 		int type=0;

+ 8 - 8
src/main/java/com/goafanti/common/dao/RoleMapper.java

@@ -28,16 +28,16 @@ public interface RoleMapper {
 	int deleteByPrimaryKeys(List<String> records);
 
 	List<RolePermissionBo> findRolePermissionsExceptAreaManager();
-	
-	List<Role> findRoles();
-	
+
+	List<Role> selectByIdList(List<String> list);
+
 	List<RolePermissionBo> selectRolePList(String id);
-	
+
 	int selectCountByRoleId(List<String> records);
-	
+
 	String selectIdByName(String roleName);
-	
+
 	String selectNameById(String id);
-	
+
 	String selectIdByNamei(Role role);
-}
+}

+ 25 - 17
src/main/java/com/goafanti/common/mapper/RoleMapper.xml

@@ -10,7 +10,7 @@
     id, role_name, role_type ,creater,create_time as createTime
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from role
     where id = #{id,jdbcType=VARCHAR}
@@ -82,7 +82,7 @@
   </update>
   <insert id="insertBatch" parameterType="com.goafanti.common.model.Role">
     insert into role (id, name)
-    values 
+    values
     <foreach item="item" index="index" collection="list" separator=",">
       (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR})
     </foreach>
@@ -110,15 +110,15 @@
   </select>
   <delete id="deleteByPrimaryKeys" parameterType="java.lang.String">
     delete from role
-    where id in 
-    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">  
-	  #{item,jdbcType=VARCHAR}  
+    where id in
+    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+	  #{item,jdbcType=VARCHAR}
     </foreach>
   </delete>
- <!-- ******************************************************************** --> 
+ <!-- ******************************************************************** -->
   <select id="selectRoleList" resultType="com.goafanti.permission.bo.RoleBo">
     select id,role_name as roleName,role_type as roleType,creater,create_time as createTime
-    from role 
+    from role
     where role_type <![CDATA[ < ]]> 999999
     <if test="roleName !=null">
 		AND role_name like CONCAT('%',#{roleName,jdbcType=VARCHAR},'%')
@@ -137,7 +137,7 @@
 		AND role_name like CONCAT('%',#{roleName,jdbcType=VARCHAR},'%')
 		</if>
   </select>
-  
+
   <select id="selectRolePList" resultType="com.goafanti.permission.bo.RolePermissionBo">
   	select tr.id as rid, tr.role_name as rname, tr.role_type,tp.id as pid,tp.name as pname,tp.url
     from role tr
@@ -147,14 +147,14 @@
     tr.id=#{id,jdbcType=VARCHAR}
   </select>
   <select id="selectCountByRoleId" parameterType="java.lang.String" resultType="java.lang.Integer">
-  	select 
-  	count(0) 
-  	from user_role 
-   	where 
-   	rid in 
-    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">  
-	  #{item,jdbcType=VARCHAR}  
-    </foreach>  
+  	select
+  	count(0)
+  	from user_role
+   	where
+   	rid in
+    <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+	  #{item,jdbcType=VARCHAR}
+    </foreach>
   </select>
   <select id="selectIdByName" parameterType="java.lang.String" resultType="java.lang.String">
   	select
@@ -179,4 +179,12 @@
   	and
   	id!=#{id,jdbcType=VARCHAR}
   </select>
-</mapper>
+    <select id="selectByIdList" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from role where id in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item,jdbcType=VARCHAR}
+        </foreach>
+    </select>
+</mapper>

+ 3 - 0
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -603,6 +603,9 @@ where a.status=2 and a.order_no=  #{orderNo,jdbcType=VARCHAR}
     <if test="type==1">
       and a.type=1 and a.status =1 and a.approval in (0,2)
     </if>
+      <if test="type==2">
+        and  a.`type` =1 and a.status =1 and a.approval =1
+    </if>
       and a.order_no =b.order_no
       and b.order_dep = #{depId}
       and c.id= #{aid}

+ 8 - 6
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -112,20 +112,22 @@ public class AsyncUtils {
 
 	/**
 	 * 切换审核人员
-	 * @param type 3财务
+	 * @param type 1营销管理 2公司管理  3财务
 	 * @param depId 部门编号
 	 * @param aid 切换后审核人
 	 * @return
 	 */
     public void updateexamineName(Integer type, String depId, String aid) {
-    	if (type==3){
-			tOrderNewMapper.updateexamineName(3,depId,aid);
-			newOrderChangeMapper.updateexamineName(5,depId,aid);
-			tOrderInvoiceMapper.updateexamineName(0,depId,aid);
-		}else if (type==1){
+		if (type==1){
 			tOrderNewMapper.updateexamineName(1,depId,aid);
 			newOrderChangeMapper.updateexamineName(1,depId,aid);
 			tOrderInvoiceMapper.updateexamineName(1,depId,aid);
+		}else if (type==2){
+			tOrderInvoiceMapper.updateexamineName(2,depId,aid);
+		}else if (type==3){
+			tOrderNewMapper.updateexamineName(3,depId,aid);
+			newOrderChangeMapper.updateexamineName(5,depId,aid);
+			tOrderInvoiceMapper.updateexamineName(0,depId,aid);
 		}
 	}
 }