Browse Source

Merge branch 'prod' into test009

anderx 3 years ago
parent
commit
874242798a
24 changed files with 501 additions and 191 deletions
  1. 84 5
      src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java
  2. 16 16
      src/main/java/com/goafanti/ambSystem/service/Impl/AmbServiceImpl.java
  3. 12 0
      src/main/java/com/goafanti/common/dao/NewOrderChangeMapper.java
  4. 1 0
      src/main/java/com/goafanti/common/dao/OrderExamineMapper.java
  5. 8 8
      src/main/java/com/goafanti/common/dao/RoleMapper.java
  6. 17 0
      src/main/java/com/goafanti/common/dao/TOrderInvoiceMapper.java
  7. 10 0
      src/main/java/com/goafanti/common/dao/TOrderNewMapper.java
  8. 0 2
      src/main/java/com/goafanti/common/dao/UserMapper.java
  9. 44 37
      src/main/java/com/goafanti/common/mapper/AdminMapper.xml
  10. 41 1
      src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml
  11. 6 0
      src/main/java/com/goafanti/common/mapper/OrderExamineMapper.xml
  12. 25 17
      src/main/java/com/goafanti/common/mapper/RoleMapper.xml
  13. 63 1
      src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml
  14. 23 0
      src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml
  15. 2 2
      src/main/java/com/goafanti/common/mapper/UserMapperExt.xml
  16. 18 6
      src/main/java/com/goafanti/common/model/Admin.java
  17. 61 6
      src/main/java/com/goafanti/common/utils/AsyncUtils.java
  18. 10 61
      src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java
  19. 5 25
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java
  20. 31 0
      src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java
  21. 2 0
      src/main/java/com/goafanti/order/service/impl/PushOrderService.java
  22. 14 0
      src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java
  23. 4 0
      src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java
  24. 4 4
      src/main/java/com/goafanti/user/controller/UserLoginController.java

+ 84 - 5
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) {
@@ -94,6 +96,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		Map<String, Object> params = new HashMap<>();
 		params.put("uid", ad.getId());
 		params.put("roles", roleIds);
+		Set<String> useRole = roleMapper.findRoleByUserId(ad.getId());
 		if (ad.getId() != "1") {
 			userRoleMapper.deleteByUserId(ad.getId());
 			if (!roleIds.isEmpty()) {
@@ -101,9 +104,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,useRole);
 		if (count>0&&ad.getAmbId()!=null){
 			//进行巴人数计算
 //			AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(Long.valueOf(ad.getAmbId()));
@@ -118,6 +123,79 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 	}
 
 
+
+	private void pushAdminRole(String id,List<String>roleIds, Set<String> useRole) {
+		Integer flag=0;
+		String roleType="";
+		//加入以前有也要重新计算
+		if (useRole!=null){
+			for (String s : useRole) {
+				if (AFTConstants.SALESMAN_ADMIN.equals(s)){
+					flag=1;
+					roleType=AFTConstants.SALESMAN_ADMIN;
+					break;
+				}else if (AFTConstants.COMPANY_MANAGER.equals(s)){
+					flag=2;
+					roleType=AFTConstants.COMPANY_MANAGER;
+					break;
+				}else if (AFTConstants.FINANCE_ADMIN.equals(s)){
+					flag=3;
+					roleType=AFTConstants.FINANCE_ADMIN;
+					break;
+				}else if (AFTConstants.TECH_ADMIN.equals(s)){
+					flag=4;
+					roleType=AFTConstants.TECH_ADMIN;
+					break;
+				}else if (AFTConstants.TECH.equals(s)){
+					flag=5;
+					roleType=AFTConstants.TECH;
+					break;
+				}else if (AFTConstants.TECH_MANAGER.equals(s)){
+					flag=6;
+					roleType=AFTConstants.TECH_MANAGER;
+					break;
+				}
+			}
+		}
+		List<Role> roleList = roleMapper.selectByIdList(roleIds);
+		if (roleList!=null){
+			for (Role role : roleList) {
+				if (AFTConstants.SALESMAN_ADMIN.equals(role.getRoleType().toString())){
+					flag=1;
+					roleType=AFTConstants.SALESMAN_ADMIN;
+					break;
+				}else if (AFTConstants.COMPANY_MANAGER.equals(role.getRoleType().toString())){
+					flag=2;
+					roleType=AFTConstants.COMPANY_MANAGER;
+					break;
+				}else if (AFTConstants.FINANCE_ADMIN.equals(role.getRoleType().toString())){
+					flag=3;
+					roleType=AFTConstants.FINANCE_ADMIN;
+					break;
+				}else if (AFTConstants.TECH_ADMIN.equals(role.getRoleType().toString())){
+					flag=4;
+					roleType=AFTConstants.TECH_ADMIN;
+					break;
+				}else if (AFTConstants.TECH.equals(role.getRoleType().toString())){
+					flag=5;
+					roleType=AFTConstants.TECH;
+					break;
+				}else if (AFTConstants.TECH_MANAGER.equals(role.getRoleType().toString())){
+					flag=6;
+					roleType=AFTConstants.TECH_MANAGER;
+					break;
+				}
+			}
+		}
+		if (flag!=0){
+
+			asyncUtils.updateListExamineName(flag,id,roleType);
+		}
+
+
+	}
+
+
 	private int sumType(List<String > roleIds) {
 		int type=0;
 		for (String roleId : roleIds) {
@@ -232,7 +310,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 
 	@Override
 	public int insertNewAdmin(Admin ad ,List<String> roleIds) {
-		ad.setStatus("1");
+		ad.setStatus("0");
 		ad.setId(UUID.randomUUID().toString());
 		ad.setType(sumType(roleIds));
 
@@ -249,6 +327,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		}
 		if(ad.getAmbId()!=null)pushAmbRole(ad);
 		adminMapper.insertSelective(ad);
+		pushAdminRole(ad.getId(),roleIds,null);
 		return 1;
 	}
 

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

@@ -35,7 +35,7 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
         in.setCreateBy(TokenManager.getAdminId());
         in.setCreateTime(new Date());
         ambSystemMapper.insertSelective(in);
-        pushAdminAmbRole(in);
+        pushAdminAmbRole(in,null);
         return  1;
     }
 
@@ -62,7 +62,7 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
         in.setUpdateBy(TokenManager.getAdminId());
         in.setUpdateTime(new Date());
         ambSystemMapper.updateByPrimaryKeySelective(in);
-        if (!in.getLeader().equals(use.getLeader()))pushAdminAmbRole(in);
+        if (!in.getLeader().equals(use.getLeader()))pushAdminAmbRole(in,use);
         return 1;
     }
 
@@ -70,36 +70,36 @@ public class AmbServiceImpl extends BaseMybatisDao<AmbSystemMapper> implements A
      * 设置巴主巴角色
      * @param in
      */
-    private void pushAdminAmbRole(InputAmb in) {
+    private void pushAdminAmbRole(InputAmb in,AmbSystem use) {
         //如果是修改,处理原负责人
         if (in.getId()!=null){
-            AmbSystem use = ambSystemMapper.selectByPrimaryKey(in.getId());
             if (in.getLeader()!=null){
                 updateAmbRole(use.getLeader());
             }
         }
         updateAmbRole(in.getLeader());
-
     }
 
+    /**
+     *
+     * @param leader
+     */
     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) {
+            if (ambSystem.getLvl()==5||ambSystem.getLvl()==6){
+                a.setAmbManage(1);
+            }
             str.append(ambSystem.getLvl()).append(",");
+
         }
-        if (admin.getAmbRole().contains("7")){
-            str.append("7").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);

+ 12 - 0
src/main/java/com/goafanti/common/dao/NewOrderChangeMapper.java

@@ -40,4 +40,16 @@ public interface NewOrderChangeMapper {
     NewOrderChangeBo selectByChangeId(String changeId);
 
     NewOrderChangeBo selectByorderNoAndStatus(String orderNo);
+
+    /**
+     * 切换审核人员
+     * @param type 3财务
+     * @param depId 部门编号
+     * @param aid 切换后审核人
+     * @return
+     */
+    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid,
+                          @Param("names")String names);
+
+    int updateTaskExamineName(@Param("aid") String aid, @Param("taskReceiverId") String taskReceiverId,@Param("type") Integer type);
 }

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

@@ -116,4 +116,5 @@ public interface OrderExamineMapper {
     void deleteByAidAndStatus(@Param("aid")String aid,  @Param("type")Integer type);
 
 
+    void updateBack(@Param("aid")String aid, @Param("taskReceiverId")String taskReceiverId);
 }

+ 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);
-}
+}

+ 17 - 0
src/main/java/com/goafanti/common/dao/TOrderInvoiceMapper.java

@@ -34,4 +34,21 @@ public interface TOrderInvoiceMapper {
     TOrderInvoiceDetails getInvoiceDetails(String orderNo);
 
     List<OutInvoiceLog>  selectInvoiceLog(Integer id);
+
+    /**
+     * 切换审核人员
+     * @param type 0财务  1营销管理员 3公司管理
+     * @param depId 部门编号
+     * @param aid 切换后审核人
+     * @return
+     */
+    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid
+        ,@Param("names")String names);
+
+    /**
+     * @param roleType
+     * @param depId
+     * @return
+     */
+    int updateListExamineName(@Param("type")Integer type, @Param("depId")String depId,@Param("roleType")String roleType);
 }

+ 10 - 0
src/main/java/com/goafanti/common/dao/TOrderNewMapper.java

@@ -57,4 +57,14 @@ public interface TOrderNewMapper {
     List<OutOrderSalesSource> orderSalesSource(InputOrderSalesSource in);
 
     TOrderNew  checkOrderProcessStatus(Integer tid);
+
+    /**
+     * 切换审核人员
+     * @param type 3财务
+     * @param depId 部门编号
+     * @param aid 切换后审核人
+     * @return
+     */
+    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid,
+                          @Param("names")String names);
 }

+ 0 - 2
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -59,14 +59,12 @@ public interface UserMapper {
 
     /**
      * 根据客户模糊搜索
-     * @param name
      * @return
      */
     List<CustomerSimpleBo> findCustomerByName(@Param("identifyName")String identifyName);
 
     /**
      * 判断客户是否存在
-     * @param name
      * @return
      */
     int judgeCustomerByName(@Param("identifyName")String identifyName);

+ 44 - 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,13 +1119,16 @@
   <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>
+    <if test="roleType !='99999' and roleType !='99998'">
+      and c.role_type  in (#{roleType})
+    </if>
   </select>
 </mapper>

+ 41 - 1
src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml

@@ -722,7 +722,47 @@ select
 	set `refund_Invoice`=ifnull(`refund_Invoice`,0)- #{amount}
 	where order_no= #{orderNo}
 	</update>
-	<select id="getOrderChange" resultType="java.util.Map">
+
+    <select id="getOrderChange" resultType="java.util.Map">
 	select id,used_order usedOrder from new_order_change where  order_no= #{orderNo} order by id
 	</select>
+
+  <update id="updateExamineName">
+    update  new_order_change a
+    <if test="names ==null">
+      ,t_order_new b,admin c
+      set a.examine_name=c.name
+      where a.process_state = #{type} and a.order_no =b.order_no
+      <if test="type==1">
+        and b.order_dep = #{depId}
+      </if>
+      and c.id= #{aid}
+    </if>
+      <if test="names !=null">
+        ,t_order_new b
+        set a.examine_name=#{names}
+        where a.process_state = #{type} and a.order_no =b.order_no
+        <if test="type==1">
+          and b.order_dep = #{depId}
+        </if>
+      </if>
+  </update>
+    <update id="updateTaskExamineName">
+      update new_order_change n left join (select c.id
+             from t_order_new a left join t_order_task b on a.order_no =b.order_no
+                                left join new_order_change c on a.order_no =c.order_no
+             where (b.consultant_id in (#{aid},#{taskReceiverId}) or b.manager_id in (#{aid},#{taskReceiverId}))
+               and c.process_state in (#{type}) group by c.id)x on n.id =x.id
+      left join (select a.order_no ,group_concat(DISTINCT b.name)name from order_examine a left join admin b on a.aid=b.id
+                   where 1=1
+                   <if test="type==2">
+                   and  a.type=0
+                   </if>
+                  <if test="type==3">
+                  and   a.type=1
+                  </if>
+      group by a.order_no ) a on n.order_no =a.order_no
+      set n.examine_name =a.name
+      where n.process_state =#{type}
+    </update>
 </mapper>

+ 6 - 0
src/main/java/com/goafanti/common/mapper/OrderExamineMapper.xml

@@ -337,8 +337,14 @@
       and type= #{type}
     </if>
   </update>
+
   <delete id="deleteByAidAndStatus">
     delete  from order_examine
     where status=0 and  aid=#{aid} and type=#{type}
   </delete>
+  <update id="updateBack">
+    update order_examine
+    set aid= #{taskReceiverId} ,`type` =1
+    where aid= #{aid} and and status =0
+  </update>
 </mapper>

+ 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>

+ 63 - 1
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -357,7 +357,8 @@
     where id = #{id,jdbcType=INTEGER}
   </update>
 
-  <select id="checkApplyAmount" resultType="java.lang.String">
+
+    <select id="checkApplyAmount" resultType="java.lang.String">
   select ifnull(sum(amount),0) from t_order_invoice
 	where order_no= #{orderNo,jdbcType=VARCHAR}  and status !=4
 	<if test="id != null">
@@ -591,4 +592,65 @@ where a.status=2 and a.order_no=  #{orderNo,jdbcType=VARCHAR}
     from invoice_log a left join admin b on a.aid =b.id
     where a.invoice_id =#{id} order by a.create_time
   </select>
+
+  <update id="updateExamineName">
+    update  t_order_invoice a,t_order_new b
+    <if test="names ==null">
+      ,admin c
+      set a.examine_name=c.name
+      where 1=1
+      <if test="type==0">
+        and a.type=0 and a.status =1 and a.approval in (0,2)
+      </if>
+      <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
+      <if test="type==1">
+        and b.order_dep = #{depId}
+      </if>
+      and c.id= #{aid}
+    </if>
+    <if test="names !=null">
+      set a.examine_name= #{names}
+      where 1=1
+      <if test="type==0">
+        and a.type=0 and a.status =1 and a.approval in (0,2)
+      </if>
+      <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
+      <if test="type==1">
+        and b.order_dep = #{depId}
+      </if>
+    </if>
+  </update>
+  <update id="updateListExamineName">
+    <if test="type==1">
+      update t_order_invoice t0,(select a.id , ifnull(GROUP_CONCAT(x.name) ,'暂无人员')name
+      from t_order_invoice a left join t_order_new b on a.order_no =b.order_no left join (select name ,department_id
+      from admin a left join user_role b on a.id =b.uid left join `role` c on b.rid =c.id where a.status ='0'
+      and c.role_type in (#{roleType}))x on b.order_dep =x.department_id where a.`type` =1
+      and a.status =1 and a.approval =0  and b.order_dep= #{depId}  group by a.id)t1
+      set t0.examine_name =t1.name
+      where t0.id=t1.id
+    </if>
+    <if test="type==2">
+      update t_order_invoice t0,(select a.id , ifnull(GROUP_CONCAT(x.name) ,'暂无人员')name
+      from t_order_invoice a left join t_order_new b on a.order_no =b.order_no left join (select name ,department_id
+      from admin a left join user_role b on a.id =b.uid left join `role` c on b.rid =c.id where a.status ='0'
+      and c.role_type in (#{roleType}))x on b.order_dep =x.department_id where a.`type` =1 and a.status =1
+      and a.approval =1 and b.order_dep= #{depId}  group by a.id)t1
+      set t0.examine_name =t1.name
+      where t0.id=t1.id
+    </if>
+
+  </update>
 </mapper>

+ 23 - 0
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -1615,6 +1615,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
                            refund_amount=#{refundAmount,jdbcType=DECIMAL}	where order_no=#{orderNo}
   </update>
 
+
   <select id="selectArrearsDunListByPage" resultType="com.goafanti.order.bo.OutArrearsDunListBo">
     select a.id, b.contract_no contractNo,a.order_no as orderNo,c.nickname as userName,tm.salesman_name as salesmanName,
     b.project_status projectStatus, b.total_amount as totalAmount,b.liquidation_status as liquidationStatus,a.`type`,
@@ -1940,4 +1941,26 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     where order_no = (select t_order_task.order_no from t_order_task where id=#{tid})
   </select>
 
+  <update id="updateExamineName">
+    update  t_order_new a
+    <if test="names==null">
+      ,admin b
+      set a.examine_name=b.name
+      where a.process_status = #{type}
+      <if test="type==1">
+        and a.order_dep = #{depId}
+      </if>
+      and b.id= #{aid}
+    </if>
+    <if test="names!=null">
+      set a.examine_name= #{names}
+      where a.process_status = #{type}
+      <if test="type==1">
+        and a.order_dep = #{depId}
+      </if>
+    </if>
+
+
+  </update>
+
 </mapper>

+ 2 - 2
src/main/java/com/goafanti/common/mapper/UserMapperExt.xml

@@ -1404,7 +1404,7 @@
 		</if>
 	</select>
 
-	<select id="findAdminName" resultType="com.goafanti.customer.bo.CustomerListOut">
+	<select id="findAdminName" resultType="com.goafanti.common.model.Admin">
 		select d.name as adminName,d.id as aid
 		from admin d left join department dm on dm.id = d.department_id
 		where d.department_id=(select department_id from admin where id=#{aid,jdbcType=INTEGER})
@@ -1972,7 +1972,7 @@ inner join(
 	<select id="checkUserMax" parameterType="string" resultType="integer">
 		select count(*) from `user`
 		where aid= #{aid,jdbcType=VARCHAR}
-		and source in(1,2,3) and share_type=0 and channel =0
+		and source in(1,2,3) and share_type=0 and channel =0 and new_channel =0
 	</select>
 
 	<select id="checkRoleMax" parameterType="string" resultType="string">

+ 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;
     }
 }

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

@@ -9,20 +9,20 @@ import java.util.UUID;
 import javax.mail.MessagingException;
 
 import com.goafanti.admin.bo.AdminListBo;
-import com.goafanti.common.dao.AdminMapper;
-import com.goafanti.common.dao.NewOrderChangeMapper;
-import com.goafanti.common.dao.TChangeTaskMapper;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.*;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.TChangeTask;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.NewOrderChangeBo;
+import com.goafanti.order.enums.OrderChangeProcess;
+import com.goafanti.order.enums.ProcessStatus;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 
 import com.goafanti.common.bo.EmailBo;
-import com.goafanti.common.dao.NoticeMapper;
 import com.goafanti.common.enums.NoticeTypes;
 import com.goafanti.common.model.Notice;
 
@@ -34,9 +34,11 @@ public class AsyncUtils {
 	@Autowired
 	private AdminMapper adminMapper;
 	@Autowired
-	private TChangeTaskMapper tChangeTaskMapper;
+	private TOrderNewMapper tOrderNewMapper;
 	@Autowired
 	private NewOrderChangeMapper newOrderChangeMapper;
+	@Autowired
+	private TOrderInvoiceMapper tOrderInvoiceMapper;
 
 
 
@@ -111,7 +113,60 @@ public class AsyncUtils {
     }
 
 
+	/**
+	 * 切换审核人员
+	 * @param depId 部门编号
+	 * @param aid 切换后审核人
+	 * @return
+	 */
+    public void updateExamineName( String depId, String aid) {
+			tOrderNewMapper.updateExamineName(3,depId,aid,null);
+			newOrderChangeMapper.updateExamineName(5,depId,aid,null);
+			tOrderInvoiceMapper.updateExamineName(0,depId,aid,null);
+	}
 
+	/**
+	 *
+	 * @param type 1营销管理 2公司管理 3财务管理 4咨询管理
+	 * @param id 管理员id
+	 * @param roleType
+	 */
+	public void updateListExamineName(Integer type, String id, String roleType) {
+		Admin admin = adminMapper.selectByPrimaryKey(id);
+		String depId=admin.getDepartmentId();
+		String names="";
+		if (type==1){
+			names=getNames(type,depId, roleType);
+			tOrderNewMapper.updateExamineName(ProcessStatus.YPYXGLY.getCode(),depId,null,names);
+			newOrderChangeMapper.updateExamineName(OrderChangeProcess.YXGLY.getCode(),depId,null,names);
+			tOrderInvoiceMapper.updateExamineName(1,depId,null,names);
+		}else if (type==2){
+			tOrderInvoiceMapper.updateListExamineName(type,depId,roleType);
+		}else if (type==3){
+			names=getNames(type,depId, roleType);
+			newOrderChangeMapper.updateExamineName(OrderChangeProcess.CWZJ.getCode(),depId,null,names);
+		}else if (type==4){
+			names=getNames(type,depId, roleType);
+			tOrderNewMapper.updateExamineName(ProcessStatus.YPZXSGLY.getCode(),depId,null,names);
+			newOrderChangeMapper.updateExamineName(OrderChangeProcess.JSZJ.getCode(),depId,null,names);
+		}else if (type==5){
+			newOrderChangeMapper.updateTaskExamineName(admin.getId(),admin.getId(),2);
+		}else if (type==6){
+			newOrderChangeMapper.updateTaskExamineName(admin.getId(),admin.getId(),3);
+		}
+	}
 
-
+	private String getNames(Integer type,String depId, String roleType) {
+		StringBuffer str=new StringBuffer();
+		List<Admin> admins = adminMapper.selectAdminByRoleType(roleType);
+		for (Admin admin : admins) {
+			if (type==1&&admin.getDepartmentId().equals(depId)){
+				str = str.append(admin.getName()).append(",");
+			}else if(type!=1){
+				str = str.append(admin.getName()).append(",");
+			}
+		}
+		if (str.length()>1)return str.substring(0,str.length()-1);
+		else return "暂无";
+	}
 }

+ 10 - 61
src/main/java/com/goafanti/order/service/impl/OrderChangeServiceImpl.java

@@ -179,16 +179,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			}
 			tChangeTaskMapper.insertSelectiveList(listck);
 		}
-		if (t.getType()==OrderChangeType.TDTK.getCode()) {
-			OrderChangeLog ocl=new OrderChangeLog();
-			ocl.setAuditor(TokenManager.getAdminId());
-			ocl.setOrderNo(t.getOrderNo());
-			ocl.setRemarks(startRemarks);
-			ocl.setChangeId(ncb.getId());
-			ocl.setStatus(0);
-			sendNotice(0, t);//设置与通过一样发送信息
-			orderChangeLogMapper.insertSelective(ocl);
-		}
+
 	return 1;
 	}
 
@@ -648,33 +639,14 @@ 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()){
-			if (noc.getStatus()==2){
+		}else if (noc.getProcessState()== OrderChangeProcess.ZC.getCode()||noc.getProcessState()== OrderChangeProcess.DSZ.getCode()){
+			if(noc.getStatus()==2){
 				TOrderNewBo ton = tOrderNewMapper.getSaleIdByOno(noc.getOrderNo());
 				OrganizationListOut dep = departmentMapper.selectAllById(ton.getOrderDep());
 				noc.setExamineName(dep.getFinanceName());
 			}else {
-				StringBuffer str=new StringBuffer();
-				List<Admin> admins = adminMapper.getAdminRoleTypeList(AFTConstants.CED);
-				for (Admin a : admins) {
-					str=str.append(a.getName()).append(",");
-				}
-				if (str.length()>0)noc.setExamineName(str.substring(0,str.length()-1));
+				noc.setExamineName("");
 			}
-		}else if (noc.getProcessState()== OrderChangeProcess.DSZ.getCode()){
-			if (noc.getStatus()==2){
-				TOrderNewBo ton = tOrderNewMapper.getSaleIdByOno(noc.getOrderNo());
-				OrganizationListOut dep = departmentMapper.selectAllById(ton.getOrderDep());
-				noc.setExamineName(dep.getFinanceName());
-			}else {
-				StringBuffer str=new StringBuffer();
-				List<Admin> admins = adminMapper.getAdminRoleTypeList(AFTConstants.APPROVAL_DECISION);
-				for (Admin a : admins) {
-					str=str.append(a.getName()).append(",");
-				}
-				if (str.length()>0)noc.setExamineName(str.substring(0,str.length()-1));
-			}
-
 		}
 	}
 
@@ -700,27 +672,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 	}
 
 
-	/**
-	   *   判断变更项目是否拆分父子数量是否一直
-	 * @param noc
-	 */
-	private void chekeChangeTaskNumber(NewOrderChange noc) {
-		List<TChangeTaskOut> list=tChangeTaskMapper.selectByCid(noc.getId(),null);
-		//x记录父值y记录子值
-		int x=0;
-		int y=0;
-
-		for (TChangeTaskOut tcto : list) {
-			if (tcto.getSplitStatus()==1&&tcto.getType()!=3) {
-				x+=tcto.getCommodityQuantity();
-			}else if (tcto.getSplitStatus()==2&&tcto.getType()!=3) {
-				y+=tcto.getCommodityQuantity();
-			}
-		}
-		if (x!=y) {
-			throw new BusinessException("变更子项目与父项目数量不符");
-		}
-	}
+
 
 	@Override
 	public int addOrderRefundInvoice(OrderRefundInvoice o) {
@@ -820,8 +772,11 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 		TOrderNew o=tOrderNewMapper.selectByPrimaryKey(nb.getOrderNo());
 		NewOrderChangeBo nob=newOrderChangeMapper.selectById(nb.getId());
 //		变更类型 0退单退款 1项目及金额变更 2仅项目变更 3仅金额变更 4重报 5赠送
-		//退单退款不需改变内容
-		if (nob.getType()==OrderChangeType.XMJJEBG.getCode()) {
+		if(nob.getType()==OrderChangeType.TDTK.getCode()) {
+			o.setTotalAmount(nob.getTotalAmount());
+			if (nob.getFirstAmount()!=null)o.setFirstAmount(nob.getFirstAmount());
+			pushTaskAndDun(nob.getId(),o);
+		}else if (nob.getType()==OrderChangeType.XMJJEBG.getCode()) {
 			o.setTotalAmount(nob.getTotalAmount());
 			if (nob.getFirstAmount()!=null)o.setFirstAmount(nob.getFirstAmount());
 			//处理项目及催款
@@ -838,12 +793,6 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
 			pushTaskAndDun(nob.getId(),o);
 		}else if (nob.getType()==OrderChangeType.ZS.getCode()) {
 			pushTaskAndDun(nob.getId(),o);
-		}else if(nob.getType()==OrderChangeType.TDTK.getCode()) {
-			//先将业务锁关闭 退单退款不做任何处理
-//			List<String> list=tOrderTaskMapper.getLockId(nb.getOrderNo(),o.getSalesmanId(),o.getBuyerId());
-//			if(!list.isEmpty())userLockReleaseMapper.updateReleaseList(list);
-//			int i=userLockReleaseMapper.selectByUidGetCount(o.getSalesmanId(),o.getBuyerId());
-//			if (i<1) userLockReleaseMapper.updateReleaseUser(o.getOrderNo());
 		}
 		//
 		o.setProcessStatus(orderProjectService.getOrderProcessStatus(nb.getOrderNo()));

+ 5 - 25
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -493,7 +493,10 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 
 			TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
 			pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),t.getApproval());
-
+			if (t.getOrderDep()!=null){
+				OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
+				t.setExamineName(dep.getManagerName());
+			}
 		}
 		if (t2.getApproval().equals(ApprovalNewState.ZCBH.getCode()) ||
 				t2.getApproval().equals(ApprovalNewState.DSZBH.getCode()) ||
@@ -516,10 +519,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				t.setLiquidationStatus(LiquidationNewState.WAIT_PAY_FIRST_BALANCE.getCode());
 			}
 		}
-		if (t.getOrderDep()!=null){
-			OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
-			t.setExamineName(dep.getManagerName());
-		}
+
 
 		return tOrderNewMapper.updateByPrimaryKeySelective(t);
 	}
@@ -975,26 +975,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
 				t.setExamineName(dep.getManagerName());
 			}
-		}else if (t.getProcessStatus()==ProcessStatus.YPTPSH.getCode()){
-			if(t.getApproval()==ApprovalNewState.ZCDSH.getCode()){
-				List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.CED);
-				for (Admin e : admins) {
-					str=str.append(e.getName()).append(",");
-				}
-
-
-			}else if(t.getApproval()==ApprovalNewState.DSZDSH.getCode()) {
-				List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.APPROVAL_DECISION);
-				for (Admin e : admins) {
-					str=str.append(e.getName()).append(",");
-				}
-			}
-
-		}else if (t.getProcessStatus()==ProcessStatus.YPZXSGLY.getCode()){
-			List<Admin> admins = adminMapper.getAdminRoleTypeList(AFTConstants.TECH_ADMIN);
-			for (Admin e : admins) {
-				str=str.append(e.getName()).append(",");
-			}
 		}else if (t.getProcessStatus()==ProcessStatus.YPZXSGLY.getCode()){
 			List<Admin> admins = adminMapper.getAdminRoleTypeList(AFTConstants.TECH_ADMIN);
 			for (Admin e : admins) {

+ 31 - 0
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -119,6 +119,11 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	private TTaskMemberMapper tTaskMemberMapper;
 	@Autowired
 	private TOrderMidMapper	tOrderMidMapper;
+	@Autowired
+	private OrderExamineMapper orderExamineMapper;
+	@Autowired
+	private NewOrderChangeMapper newOrderChangeMapper;
+
 	@Value(value = "${upload.path}")
 	private String 					uploadPath 			= null;
 
@@ -160,6 +165,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			t.setConsultantId(null);
 			t.setManagerId(taskReceiverId);
 		}
+
 		t.setReceiverName(a.getName());
 		tOrderTaskMapper.updateByPrimaryKey(t);
 		List<String> aids = new ArrayList<>();
@@ -167,9 +173,34 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t.getOrderNo());
 		orderNewService.pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_TASK_TO.getCode(),order, TokenManager.getAdminId(),0,taskId);
 		checkProjiectAllocation(t.getOrderNo());
+		pushTaskChange(TokenManager.getAdminId(),taskReceiverId,type,t.getOrderNo());
 		return 1;
 	}
 
+	/**
+	 *
+	 * @param aid 操作者
+	 * @param taskReceiverId 接收方
+	 * @param type type – 0管理员派单 1经理转交 2经理派单 3咨询师转交 4回退
+	 */
+	private void pushTaskChange(String aid, String taskReceiverId,Integer type,String orderNo) {
+		if (type==1||type==3){
+			orderExamineMapper.updateDimissionTransfer(aid,taskReceiverId,null);
+		}else if (type==2){
+			OrderExamine o=new OrderExamine();
+			o.setAid(taskReceiverId);
+			o.setOrderNo(orderNo);
+			o.setCreateTime(new Date());
+			o.setType(0);//咨询师经理
+			o.setStatus(0);//正常
+			orderExamineMapper.insertSelective(o);
+		}else if (type==4){
+			orderExamineMapper.updateBack(aid,taskReceiverId);
+		}
+		newOrderChangeMapper.updateTaskExamineName(aid,taskReceiverId,2);
+		newOrderChangeMapper.updateTaskExamineName(aid,taskReceiverId,3);
+	}
+
 	private void projectDistributionPushUserMid(TOrderNew tn) {
 		if (tn.getProcessStatus()==4){
 			UserMid um=new UserMid();

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

@@ -49,6 +49,8 @@ public class PushOrderService {
             return  t.getContractPictureUrl();
         }else if (TokenManager.hasRole(AFTConstants.TECH_ADMIN)&&t.getProcessStatus()== ProcessStatus.YPZXSGLY.getCode()){
             return  t.getContractPictureUrl();
+        }else if (TokenManager.hasRole(AFTConstants.OUTSOURCE_AUDITOR)){
+            return  t.getContractPictureUrl();
         }else{
             return DEFAULTS_URL;
         }

+ 14 - 0
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -3,7 +3,10 @@ package com.goafanti.organization.service.impl;
 import java.util.*;
 
 import com.goafanti.common.dao.DepartmentMapper;
+import com.goafanti.common.dao.NewOrderChangeMapper;
+import com.goafanti.common.dao.TOrderNewMapper;
 import com.goafanti.common.model.Department;
+import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.organization.bo.DepOut;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -22,6 +25,12 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 	private DepartmentMapper departmentMapper;
 	@Autowired
 	private TOrderMidMapper	tOrderMidMapper;
+	@Autowired
+	private TOrderNewMapper	tOrderNewMapper;
+	@Autowired
+	private NewOrderChangeMapper newOrderChangeMapper;
+	@Autowired
+	private AsyncUtils asyncUtils;
 
 	@Override
 	public Pagination<OrganizationListOut> listOrganizationManagement(OrganizationListOut olo, Integer pageNo,
@@ -187,6 +196,11 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		dep.setProvince(province);
 		dep.setHideSign(hideSign);
 		dep.setWorkingHoursType(workingHoursType);
+		Department use = departmentMapper.selectByPrimaryKey(id);
+		if (!use.getFinanceId().equals(financeId)){
+			//切换后更换审核人
+			asyncUtils.updateExamineName(id,financeId);
+		}
 		tOrderMidMapper.updateFinanceId(id,financeId);
 		int x=departmentMapper.updateByPrimaryKeySelective(dep);
 		return x;

+ 4 - 0
src/main/java/com/goafanti/permission/service/impl/NewRoleServiceImpl.java

@@ -217,6 +217,7 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 				userTransferLogMapper.insertUserLockLog(aid,transferId,date);
 				patentNewMapper.updateAdmin(aid,transferId);
 				roleResourcesMapper.updateLockRelease("1",aid,transferId);//将业务锁转给指定人
+
 			}
 			if (s == roleResources.YQDD.getCode()) {
 
@@ -271,6 +272,7 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 				int x=1;
 				if (changeBo.getProcessState()==2){
 					x=orderExamineMapper.checkCountStatus(changeBo.getOrderNo(), 0,0);
+
 				}else if (changeBo.getProcessState()==3){
 					  x=orderExamineMapper.checkCountStatus(changeBo.getOrderNo(), 1,0);
 				}
@@ -287,6 +289,8 @@ public class NewRoleServiceImpl extends BaseMybatisDao<RoleMapper> implements Ne
 					newOrderChangeMapper.updateByPrimaryKeySelective(changeBo);
 				}
 			}
+			newOrderChangeMapper.updateTaskExamineName(aid,transferId,2);
+			newOrderChangeMapper.updateTaskExamineName(aid,transferId,3);
 			taskAttributionLogMapper.insertList(aid, transferId, date);
 			tTaskLogMapper.updateDimissionTransfer(aid, transferId);
 		}

+ 4 - 4
src/main/java/com/goafanti/user/controller/UserLoginController.java

@@ -100,18 +100,18 @@ public class UserLoginController extends BaseController {
 	@CrossOrigin
 	public Result managesignin(Admin admin, Boolean remember) {
 		Result res = new Result();
-		String mobile=adminMapper.selectStatusByMobile(admin.getMobile());
-		if("锁定".equals(mobile)){
+		Admin a =adminMapper.selectByMobile(admin.getMobile());
+		if("1".equals(a.getStatus())){
 			res.getError().add(buildError("","用户已被锁定不能登录"));
 			return res;
 		}
-		if("注销".equals(mobile)){
+		if("2".equals(a.getStatus())){
 			res.getError().add(buildError("","用户已被注销"));
 			return res;
 		}
 
 		res.setData(TokenManager.manageLogin(admin, remember));
-		Admin a =adminMapper.selectByMobile(admin.getMobile());
+
 		if (a!=null) {
 			shiroAddRedis();
 			a.setLastLoginTime(new Date());