Quellcode durchsuchen

发起订单开发

anderx vor 3 Jahren
Ursprung
Commit
da99235250

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

@@ -60,7 +60,7 @@ public class AdminSuperviseApiController extends CertifyApiController {
 			res.getError().add(buildError("", "查询条件不能为空!"));
 			return res;
 		}
-		
+
 		if (UserType.PERSONAL.getCode().equals(type)){
 			res.setData(userService.findUserNameByNameAndMobile(name, mobile));
 		} else {
@@ -170,7 +170,7 @@ public class AdminSuperviseApiController extends CertifyApiController {
 	}
 
 	/**
-	 * 修改管理员信息
+	 * 修改管理员信息(不是管理员列表修改)
 	 */
 	@RequestMapping(value = "/updateAdmin", method = RequestMethod.POST)
 	public Result updateAdmin(@RequestParam(value = "roles[]", required = false) String[] roleIds, String data) {
@@ -201,10 +201,10 @@ public class AdminSuperviseApiController extends CertifyApiController {
 			}
 
 			Admin a = adminService.selectByPrimaryKey(admin.getId());
-			if (null == a) {	
-				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));				
+			if (null == a) {
+				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
 				return res;
-				
+
 			}
 			Admin ad = new Admin();
 			BeanUtils.copyProperties(admin, ad);
@@ -212,7 +212,7 @@ public class AdminSuperviseApiController extends CertifyApiController {
 			if (!res.getError().isEmpty()) {
 				return res;
 			}
-		
+
 			List<String> roles = new ArrayList<String>();
 			if (roleIds != null && roleIds.length > 0) {
 				for (String role : roleIds) {

+ 2 - 2
src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java

@@ -162,10 +162,10 @@ public class AdminSuperviserApiController extends CertifyApiController {
 				return res;
 			}
 			//如果锁定,清楚登陆者的token
-			if (!a.getStatus().equals(ad.getStatus())&&!ad.getStatus().equals("正常")){
+			if (!a.getStatus().equals(ad.getStatus())&&!ad.getStatus().equals("0")){
 				redisUtil.deleteAid(aa.getId());
 			}
-		res.setData(newAdminService.updateByPrimaryKeySelective(ad, roles));
+			res.setData(newAdminService.updateByPrimaryKeySelective(ad, roles));
 		}
 		return res;
 	}

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

@@ -1,6 +1,12 @@
 package com.goafanti.common.dao;
 
+import com.goafanti.admin.bo.AdminContacts;
+import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.Role;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface AdminMapper {
     int deleteByPrimaryKey(String id);
@@ -14,4 +20,145 @@ public interface AdminMapper {
     int updateByPrimaryKeySelective(Admin record);
 
     int updateByPrimaryKey(Admin record);
-}
+    Admin selectByMobile(String mobile);
+
+    List<Role> selectRolesByPrimaryKey(String uid);
+
+    List<Admin> selectCognizanceConsultant();
+
+    List<Admin> selectCognizancePrincipal();
+
+    List<Admin> selectPatentAuthor();
+
+    List<Admin> selectPatentPrincipal();
+
+    List<Admin> selectCopyrightConsultant();
+
+    List<Admin> selectCopyrightPrincipal();
+
+    List<Admin> selectTechprojectConsultant();
+
+    List<Admin> selectTechprojectPrincipal();
+
+    List<String> selectRoleByPrimaryKey(String uid);
+
+    List<Admin> selectAccoutManager();
+
+    List<Admin> selectTechnician();
+
+    List<Admin> selectSalesman();
+
+    List<Admin> selectContractManager();
+
+    List<Admin> selectTechBroder();
+
+    List<Admin> listAdminSelectBySuperAdmin();
+
+    List<Admin> listAdminSelectByAreaAdmin(@Param("provinceList")List<Integer> provinceList, @Param("cityList")List<Integer> cityList);
+
+    List<Admin> listAdminByName(@Param("name")String name,@Param("status")Integer status);
+
+
+    int insertn(Admin record);
+
+    String selectUserNoBySuperiorId(String superiorId);
+
+    int selectCountBySuperiorId(String superiorId);
+
+    String selectIdByUserNo(String userNo);
+
+    Admin selectAllByid(@Param("id") String id);
+
+    String selectNameByid(String id);
+
+    List<Role> selectRolesByUid(String id);
+
+
+
+    String selectStatusByMobile(@Param("mobile")String mobile);
+
+    int deleteById(String id);
+
+    List<Admin> selectIDNBySuperiorId(String superiorId);
+
+    String selectUserNoById(String superiorId);
+
+    int updateByUserNo(Admin record);
+
+    List<String>selectIdBySuperiorId(String superiorId);
+
+    /**
+     * 查询下级人员
+     * @param adminId
+     * @return
+     */
+    List<AdminListBo> selectSubList(@Param("adminId")String adminId);
+
+    /**
+     * @return
+     */
+    Admin selectAdminByRoleId(@Param("roleId")String roleId);
+    /**
+     * 查询部门下的员工
+     * @param departmentId
+     * @param name
+     * @return
+     */
+    List<AdminListBo> selectDepartmentStaff(String departmentId, String name);
+
+    Admin selectAdminName(@Param("name")String name);
+
+    List<Admin> selectAllAdmin(@Param("depId")String depId);
+
+    int updateLockIds(@Param("lockIds")String lockIds);
+
+
+    int getCountById(String id);
+    AdminListBo getDeptNameByAid(String id);
+
+    List<Admin> getAdminRoleNameList(String roleName);
+    List<Admin> getAdminRoleNamesList(List<String> list);
+
+    List<Admin> getAdminRoleTypesList(List<String> list);
+    List<Admin> getAdminRoleTypeList(String roleType);
+
+    int addAdminContacts(AdminContacts a);
+
+    int deleteFrequentContacts(String id);
+
+    List<String> getaidFrequentContacts(String id);
+
+    /**
+     * 获取属于某部门的角色
+     * @param depId
+     * @param roleType
+     * @return
+     */
+    List<String> listNameByDepAndName(@Param("depId")String depId,@Param("roleType")String roleType);
+
+    List<Admin> listAdminBydepIdAndRoleType(@Param("depId")String depId,@Param("roleType")String roleType);
+
+    List<String> selectBySuperId(String aid);
+
+    Admin selectFinanceAdminByOrderDep(String orderDep);
+
+    String getPermission(String transferId);
+
+    List<String> selectDepIdWithSpuerId(String superId);
+
+
+    List<String> getAdminRoleListByAid(String id);
+
+    Admin selectByOpeid(String openid);
+
+    Admin selectGetSuper(String aid);
+
+    List<String> getFinanceDep(String aid);
+
+    List<String> getLowerFinanceDep(String aid);
+
+
+    int selectByAmbIdCount(String id);
+
+    List<Admin> selectAdminByRoleType(@Param("roleType") String roleType);
+}

+ 1 - 0
src/main/java/com/goafanti/common/enums/OrderLogProcess.java

@@ -28,6 +28,7 @@ public enum OrderLogProcess {
 	XMWBTG(15,"项目外包通过"),
 	XMWBBH(16,"项目外包驳回"),
 	DDLZZJ(17,"订单离职转交"),
+	YXJLTT(18,"营销经理审核"),
 	NOT(99,"未知"),
 	;
 

+ 835 - 21
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -30,13 +30,13 @@
     <result column="manager_id" jdbcType="VARCHAR" property="managerId" />
   </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, 
+    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
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
-    select 
+    select
     <include refid="Base_Column_List" />
     from admin
     where id = #{id,jdbcType=VARCHAR}
@@ -46,23 +46,23 @@
     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 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}, 
+    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>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
@@ -338,4 +338,818 @@
       manager_id = #{managerId,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
-</mapper>
+
+
+
+  <select id="selectAllAdmin" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin
+    where status ='0'
+    <if test="depId != null">
+      and department_id = #{depId,jdbcType=VARCHAR}
+    </if>
+  </select>
+
+  <select id="selectByMobile" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin
+    where mobile = #{mobile,jdbcType=VARCHAR}
+  </select>
+
+  <select id="selectRolesByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.common.model.Role">
+    select r.name, r.id, r.type
+    from role r
+           left join user_role ur on ur.rid=r.id
+    where ur.uid = #{uid,jdbcType=VARCHAR}
+  </select>
+
+  <select id="selectCognizanceConsultant" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin
+    where id  <![CDATA[ <> ]]> '1'
+  </select>
+
+  <select id="selectCognizancePrincipal" resultMap="BaseResultMap">
+    select a.id, a.name, a.position from admin a
+                                           INNER JOIN user_role  ur on a.id = ur.uid
+    where ur.rid not in('1','2','3','4','5','6')
+    group by a.id
+  </select>
+
+  <select id="selectPatentAuthor" resultMap="BaseResultMap">
+    select a.id, a.name, a.position from admin a
+                                           INNER JOIN user_role  ur on a.id = ur.uid
+    where ur.rid not in('1','2','3','4','5','6')
+    group by a.id
+  </select>
+
+  <select id="selectPatentPrincipal" resultMap="BaseResultMap">
+    select a.id, a.name, a.position from admin a
+                                           INNER JOIN user_role  ur on a.id = ur.uid
+    where ur.rid not in('1','2','3','4','5','6')
+    group by a.id
+  </select>
+
+  <select id="selectCopyrightConsultant" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin
+    where id  <![CDATA[ <> ]]> '1'
+  </select>
+
+  <select id="selectCopyrightPrincipal" resultMap="BaseResultMap">
+    select a.id, a.name, a.position from admin a
+                                           INNER JOIN user_role  ur on a.id = ur.uid
+    where ur.rid not in('1','2','3','4','5','6')
+    group by a.id
+  </select>
+
+  <select id="selectTechprojectConsultant" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin
+    where id  <![CDATA[ <> ]]> '1'
+  </select>
+
+  <select id="selectTechprojectPrincipal" resultMap="BaseResultMap">
+    select a.id, a.name, a.position from admin a
+                                           INNER JOIN user_role  ur on a.id = ur.uid
+    where ur.rid not in('1','2','3','4','5','6')
+    group by a.id
+  </select>
+
+  <select id="selectRoleByPrimaryKey" parameterType="java.lang.String" resultType="String">
+    SELECT rid FROM user_role
+    where uid = #{uid,jdbcType=VARCHAR}
+  </select>
+
+  <select id="selectAccoutManager" resultMap="BaseResultMap">
+    select a.id, a.name, a.position from admin a
+                                           INNER JOIN user_role  ur on a.id = ur.uid
+    where ur.rid = '4'
+  </select>
+
+  <select id="selectTechnician" resultMap="BaseResultMap">
+    select a.id, a.name, a.position from admin a
+                                           INNER JOIN user_role  ur on a.id = ur.uid
+    where ur.rid not in('1','2','3','4')
+    group by a.id
+  </select>
+
+  <select id="selectSalesman" resultMap="BaseResultMap">
+    select a.id, a.name, a.position from admin a
+                                           INNER JOIN user_role  ur on a.id = ur.uid
+    where ur.rid in ('5', '6')
+  </select>
+
+  <select id="selectContractManager" resultMap="BaseResultMap">
+    select a.id, a.name, a.position from admin a
+                                           INNER JOIN user_role  ur on a.id = ur.uid
+    where ur.rid not in('1','2','3','4')
+    group by a.id
+  </select>
+
+  <select id="selectTechBroder" resultMap="BaseResultMap">
+    select
+      u.rid as rolesId, a.name,a.id, a.position
+    from user_role u
+           left join admin a on a.id =u.uid
+           left join role r on r.id =u.rid
+    where
+      r.role_name='技术经纪专员'
+  </select>
+
+  <select id="listAdminSelectBySuperAdmin" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin
+    where id <![CDATA[ <> ]]> '1'
+  </select>
+
+  <select id="listAdminSelectByAreaAdmin" resultMap="BaseResultMap">
+    select
+    a.id, a.name, a.mobile,
+    a.create_time as createTime, a.number,  aa.name as superior
+    from admin a
+    left join admin_location al on al.admin_id = a.id
+    left join admin aa on aa.id = a.superior_id
+    where 1 = 1
+    <if test="provinceList != null and provinceList.size &gt; 0">
+      and  al.province in
+      <foreach close=")" collection="provinceList" item="plist" open="(" separator=",">
+        #{plist}
+      </foreach>
+    </if>
+    <if test="cityList != null and cityList.size &gt; 0">
+      and al.city in
+      <foreach close=")" collection="cityList" item="clist" open="(" separator=",">
+        #{clist}
+      </foreach>
+    </if>
+  </select>
+
+  <select id="findAdminListByPage" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
+    select
+    a.number, a.mobile, a.name,
+    a.position, a.email, a.id,
+    a.province,
+    a.city,
+    a.create_time as createTime,
+    aa.name as superior,
+    a.superior_id as superiorId,
+    a.department_id as departmentId,
+    date_format(a.last_login_time,'%Y-%m-%d %H:%i:%S') as lastLoginTime,
+    dm.name as departmentName
+    from admin a
+    left join admin_location al on a.id = al.admin_id
+    left join admin aa on aa.id = a.superior_id
+    left join department dm on a.department_id = dm.id
+    left join user_role x on x.uid=a.id
+    left join `role` y on x.rid=y.id
+    where a.id <![CDATA[ <> ]]> '1'
+    <if test="roleName != null">
+      where y.role_name= #{roleName,jdbcType=VARCHAR}
+    </if>
+    <if test="mobile != null">
+      and a.mobile = #{mobile,jdbcType=VARCHAR}
+    </if>
+    <if test="name != null">
+      and a.name = #{name,jdbcType=VARCHAR}
+    </if>
+    <if test="number != null">
+      and a.number = #{number,jdbcType=INTEGER}
+    </if>
+    <if test="province != null">
+      and a.province = #{province,jdbcType=VARCHAR}
+    </if>
+    order by a.last_login_time ,a.number
+    <if test="page_sql!=null">
+      ${page_sql}
+    </if>
+  </select>
+
+  <select id="findAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
+    select count(1) from admin
+    where id <![CDATA[ <> ]]> '1'
+    left join `role` y on x.rid=y.id
+    where a.id <![CDATA[ <> ]]> '1'
+    <if test="roleName != null">
+      where y.role_name= #{roleName,jdbcType=VARCHAR}
+    </if>
+    <if test="mobile != null">
+      and mobile = #{mobile,jdbcType=VARCHAR}
+    </if>
+    <if test="name != null">
+      and name = #{name,jdbcType=VARCHAR}
+    </if>
+    <if test="number != null">
+      and number = #{number,jdbcType=INTEGER}
+    </if>
+    <if test="province != null">
+      and a.province = #{province,jdbcType=VARCHAR}
+    </if>
+  </select>
+
+
+  <select id="listAdminByName" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select id,name from admin where   name like concat('%',#{name},'%')
+    <if test="status==0">
+      and status= '0'
+    </if>
+    <if test="status==1">
+      and status= '1'
+    </if>
+  </select>
+
+  <!--*************************************************************************-->
+  <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
+    from admin a
+    left join admin_location al on a.id = al.admin_id
+    left join admin aa on aa.id = a.superior_id
+    left join amb_system ambs on a.amb_id=ambs.id
+    left join department dep on a.department_id = dep.id
+    <if test="rid != null">
+      RIGHT join (select uid from user_role where rid=#{rid,jdbcType=VARCHAR}) ur on a.id=ur.uid
+    </if>
+    <if test="roleName != null">
+      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>
+    where a.status in (0,1)
+    <if test="name != null">
+      and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="departmentId != null">
+      and a.department_id = #{departmentId,jdbcType=VARCHAR}
+    </if>
+
+    <if test="duty != null">
+      and a.duty = #{duty,jdbcType=VARCHAR}
+    </if>
+    <if test="position != null">
+      and a.position = #{position,jdbcType=VARCHAR}
+    </if>
+    <if test="status != null">
+      and a.status = #{status,jdbcType=VARCHAR}
+    </if>
+    <if test="mobile != null">
+      and a.mobile = #{mobile,jdbcType=VARCHAR}
+    </if>
+    <if test="superiorId != null">
+      and a.superior_id = #{superiorId,jdbcType=VARCHAR}
+    </if>
+    <if test="ambId != null">
+      and a.amb_id = #{ambId}
+    </if>
+    <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}
+    </if>
+  </select>
+  <select id="selectAdminCount" parameterType="java.lang.String" resultType="java.lang.Integer">
+    select count(*)
+    from admin a
+    left join admin_location al on a.id = al.admin_id
+    left join admin aa on aa.id = a.superior_id
+    left join amb_system ambs on a.amb_id=ambs.id
+    left join department dep on a.department_id = dep.id
+    <if test="rid != null">
+      RIGHT join (select * from user_role where rid=#{rid,jdbcType=VARCHAR}) ur on a.id=ur.uid
+    </if>
+    <if test="roleName != null">
+      left  join  user_role  ur on a.id=ur.uid
+      RIGHT join (select * from role where role_name =#{roleName,jdbcType=VARCHAR}) y on ur.rid=y.id
+    </if>
+    where a.status in (0,1)
+    <if test="name != null">
+      and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="departmentId != null">
+      and a.department_id = #{departmentId,jdbcType=VARCHAR}
+    </if>
+    <if test="duty != null">
+      and a.duty = #{duty,jdbcType=VARCHAR}
+    </if>
+    <if test="position != null">
+      and a.position = #{position,jdbcType=VARCHAR}
+    </if>
+    <if test="status != null">
+      and a.status = #{status,jdbcType=VARCHAR}
+    </if>
+    <if test="mobile != null">
+      and a.mobile = #{mobile,jdbcType=VARCHAR}
+    </if>
+    <if test="superiorId != null">
+      and a.superior_id = #{superiorId,jdbcType=VARCHAR}
+    </if>
+    <if test="ambId != null">
+      and a.amb_id = #{ambId}
+    </if>
+    <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,
+                       password, email, create_time,
+                       number, province, position, superior_id, city,department_id,status,user_no,duty,district,head_portrait_url,contact_mobile,type)
+    values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
+            #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
+            #{number,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{position,jdbcType=VARCHAR},
+            #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=INTEGER},#{departmentId,jdbcType=VARCHAR},
+            #{status,jdbcType=VARCHAR},#{userNo,jdbcType=VARCHAR},#{duty,jdbcType=VARCHAR},#{district,jdbcType=VARCHAR},#{headPortraitUrl,jdbcType=VARCHAR},#{contactMobile,jdbcType=VARCHAR},
+            #{type})
+  </insert>
+  <select id="selectUserNoBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
+    select
+      user_no as userNo
+    from admin
+    where
+      id=#{superiorId,jdbcType=VARCHAR}
+  </select>
+  <select id="selectCountBySuperiorId" parameterType="java.lang.String" resultType="java.lang.Integer">
+    select
+      count(1)
+    from admin
+    where
+      superior_id=#{superiorId,jdbcType=VARCHAR}
+  </select>
+  <select id="selectIdByUserNo" parameterType="java.lang.String" resultType="java.lang.String">
+    select
+      id
+    from admin
+    where
+      user_no=#{UserNo,jdbcType=VARCHAR}
+  </select>
+  <select id="selectAllByid" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
+    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,
+           b.name superior,c.name reviewerName,a.type,a.amb_id ambId
+    from admin a left join admin b on a.superior_id =b.id left join admin c on a.reviewer =c.id
+    where a.id= #{id,jdbcType=VARCHAR}
+  </select>
+  <select id="selectNameByid" parameterType="java.lang.String" resultType="java.lang.String">
+    select
+      name
+    from admin
+    where
+      id=#{id,jdbcType=VARCHAR}
+  </select>
+  <select id="selectRolesByUid" parameterType="com.goafanti.common.model.Role" resultType="com.goafanti.common.model.Role">
+    select
+      r.id,r.role_name as roleName
+    from user_role ur
+           left join role r on r.id = ur.rid
+    where
+      uid=#{id,jdbcType=VARCHAR}
+  </select>
+
+  <select id="selectStatusByMobile" parameterType="java.lang.String" resultType="java.lang.String">
+    select
+      status
+    from admin
+    where
+      mobile= #{mobile,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteById" parameterType="java.lang.String">
+    delete from admin
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+
+  <select id="selectIDNBySuperiorId" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
+    select id, mobile, name,
+           password, email, create_time as createTime,
+           province, position,
+           superior_id as superiorId,department_id as departmentId,
+           status,user_no as userNo,duty,district,head_portrait_url as headPortraitUrl
+    from admin
+    where
+      superior_id=#{superiorId,jdbcType=VARCHAR}
+  </select>
+  <select id="selectUserNoById" resultType="java.lang.String">
+    select user_no as userNo
+    from admin
+    where
+      id=#{superiorId,jdbcType=VARCHAR}
+  </select>
+  <update id="updateByUserNo" parameterType="com.goafanti.common.model.Admin">
+    update admin
+    set user_no = #{userNo,jdbcType=VARCHAR}
+    where
+      id=#{id,jdbcType=VARCHAR}
+  </update>
+
+
+  <select id="selectIdBySuperiorId" parameterType="java.lang.String" resultType="java.lang.String">
+    select id
+    from admin
+    where
+      superior_id=#{superiorId,jdbcType=VARCHAR}
+  </select>
+
+  <select id="selectSubList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
+    select
+      a.id,
+      a.user_no as userNo,
+      a.mobile,
+      a.name,
+      a.position,
+      b.name as departmentName
+    from
+      admin a left join department b on
+        a.department_id = b.id
+    where
+        a.department_id =(
+        select
+          department_id
+        from
+          admin
+        where
+          id = #{adminId,jdbcType=VARCHAR}
+      )
+      and a.id <![CDATA[ <> ]]> #{adminId,jdbcType=VARCHAR}
+  </select>
+
+  <select id="selectAdminByRoleId" parameterType="java.lang.String" resultMap="BaseResultMap">
+    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 where c.id = #{roleId,jdbcType=VARCHAR} limit 1
+  </select>
+
+  <select id="selectDepartmentStaff" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
+    select a.id ,a.name,a.password,a.department_id,b.name
+    from admin a left join department b
+    on a.department_id= b.id
+    where 1=1
+    <if test="departmentId != null and departmentId !='' ">
+      and a.department_id = #{departmentId,jdbcType=VARCHAR}
+    </if>
+    <if test="name != null">
+      and a.name like  concat('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
+
+  </select>
+  <select id="selectAdminName" parameterType="java.lang.String" resultMap="BaseResultMap">
+    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
+    where c.role_name  = #{name,jdbcType=VARCHAR}
+  </select>
+  <update id="updateLockIds" parameterType="java.lang.String">
+    update admin set status = '1' where id in (${lockIds})
+  </update>
+
+  <!--  用户是为正常的 -->
+  <select id="getCountById" parameterType="java.lang.String" resultType="java.lang.Integer">
+    select count(a.id)  from admin a
+                               inner join user_role ur on a.id=ur.uid
+    where a.id= #{_parameter,jdbcType=VARCHAR} and ( a.status != '注销' or a.status is null)
+  </select>
+  <select id="getAdminRoleNameList" parameterType="java.lang.String" resultMap="BaseResultMap">
+    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
+    where c.role_name  = #{name,jdbcType=VARCHAR} and a.status= 0
+  </select>
+
+  <select id="getAdminRoleNamesList" parameterType="java.lang.String" resultMap="BaseResultMap">
+    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
+    where a.status= 0
+    and  c.role_name  in
+    <foreach close=")" collection="list" item="name" open="(" separator=",">
+      #{name}
+    </foreach>
+  </select>
+
+  <select id="getAdminRoleTypeList" parameterType="java.lang.String" resultMap="BaseResultMap">
+    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
+    where c.role_type  = #{roleType} and a.status= 0
+  </select>
+
+  <select id="getAdminRoleTypesList" parameterType="java.lang.String" resultMap="BaseResultMap">
+    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
+    where a.status= 0
+    and  c.role_type  in
+    <foreach close=")" collection="list" item="type" open="(" separator=",">
+      #{type}
+    </foreach>
+  </select>
+
+
+  <select id="getDeptNameByAid" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
+    select a.id,a.name, d.name as departmentName,a.department_id departmentId,a.email,a.superior_id superiorId,a.open_id openId,
+           a.reviewer,d.manager_id depManager
+    from admin a left join department d on a.department_id = d.id
+    where a.id = #{_parameter,jdbcType=VARCHAR}
+  </select>
+
+  <insert id="addAdminContacts" parameterType="com.goafanti.admin.bo.AdminContacts">
+    insert into admin_contacts (id,aid,contacts_id)values
+    (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
+  </insert>
+
+  <select id="frequentContactsList" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
+    select a.id,b.id as contactId,b.name,b.position,b.contact_mobile as contactMobile,c.name as departmentName,y.role_name as roleName
+    from admin_contacts a left join admin b
+    on a.contacts_id=b.id left join department c
+    on c.id=b.department_id left join user_role x on x.uid=b.id
+    left join `role` y on x.rid=y.id
+    where b.status ='0'
+    <if test="roleName != null">
+      and y.role_name= #{roleName,jdbcType=VARCHAR}
+    </if>
+    <if test="aid != null">
+      and a.aid= #{aid,jdbcType=VARCHAR}
+    </if>
+    <if test="name != null">
+      and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="deps != null">
+      and b.department_id in
+      <foreach close=")" collection="deps" item="depId" open="(" separator=",">
+        #{depId}
+      </foreach>
+    </if>
+    <if test="page_sql!=null">
+      ${page_sql}
+    </if>
+  </select>
+
+  <select id="frequentContactsCount" parameterType="java.lang.String" resultType="java.lang.Integer">
+    select count(*)
+    from admin_contacts a left join admin b
+    on a.contacts_id=b.id
+    left join user_role x on x.uid=b.id
+    left join `role` y on x.rid=y.id
+    where b.status ='0'
+    <if test="roleName != null">
+      and y.role_name= #{roleName,jdbcType=VARCHAR}
+    </if>
+    <if test="aid != null">
+      and a.aid= #{aid,jdbcType=VARCHAR}
+    </if>
+    <if test="name != null">
+      and b.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+    </if>
+    <if test="deps != null">
+      and b.department_id in
+      <foreach close=")" collection="deps" item="depId" open="(" separator=",">
+        #{depId}
+      </foreach>
+    </if>
+  </select>
+
+  <delete id="deleteFrequentContacts" parameterType="java.lang.String">
+    delete from admin_contacts
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <select id="getaidFrequentContacts" resultType="java.lang.String">
+    select b.id from admin_contacts a left join admin b on a.contacts_id = b.id
+    where b.status = '0' and a.aid= #{id,jdbcType=VARCHAR}
+  </select>
+
+
+  <select id="selectAdminCustomerList"  resultType="com.goafanti.admin.bo.AdminCustomerBo">
+    select a.id as aid,a.name as aName,d.name as depName,ifnull(b.userCount,0) as userCount,ifnull(c.timeCount,0) as inputCount,
+    ifnull(d.timeCount,0) as receiveCount,ifnull(g.timeCount,0) as signCount from admin a
+    left join (select aid,count(aid) as userCount from user where aid is not null
+    and  share_type=0 and source in(1,2,3) and type=1 and new_channel=0
+    group by aid) b on a.id=b.aid
+    left join (select aid,count(aid) as timeCount from `user` where aid is not null
+    and  share_type in (0,2) and source =1 and type=1 and new_channel=0
+    <if test="startTime != null and endTime != null">
+      and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+    </if>
+    group by aid) c on a.id=c.aid
+    left join (select aid,count(aid) as timeCount from `user` where aid is not null
+    and  share_type in (0,2) and source =2 and type=1 and new_channel=0
+    <if test="startTime != null and endTime != null">
+      and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+    </if>
+    group by aid) d on a.id=d.aid
+    left join (select aid,count(aid) as timeCount from `user` where aid is not null
+    and share_type =2 and type=1  and new_channel=0
+    <if test="startTime != null and endTime != null">
+      and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+    </if>
+    group by aid) g on a.id=g.aid
+    left join department d on a.department_id=d.id
+    left join user_role e on a.id=e.uid
+    left join `role` f on e.rid=f.id
+    where f.role_name in ('营销员','营销经理')
+    and	 a.status= 0
+    <if test="depId != null">
+      and a.department_id =  #{depId,jdbcType=VARCHAR}
+    </if>
+    <if test="page_sql!=null">
+      ${page_sql}
+    </if>
+  </select>
+
+  <select id="selectAdminCustomerCount" parameterType="java.lang.String" resultType="java.lang.Integer">
+    select count(*) from admin a
+    left join department d on a.department_id=d.id
+    left join user_role e on a.id=e.uid
+    left join `role` f on e.rid=f.id
+    where f.role_name in ('营销员','营销经理')
+    and	 a.status= 0
+    <if test="depId != null">
+      and a.department_id =  #{depId,jdbcType=VARCHAR}
+    </if>
+  </select>
+
+  <select id="selectAdminCustomerDetailList"  resultType="com.goafanti.admin.bo.AdminCustomerDetailBo">
+    select a.id,a.nickname as name,a.source,c.contacts contacts,c.contact_mobile as contactMobile,c.contacts_dep contactsDep,
+    c.contacts_position contactsPosition, a.create_time as createTime,b.last_follow_time as followTime,c.location_province locationProvince,
+    c.location_city locationCity,c.location_area locationArea,c.business_scope businessScope , c.intended_project intendedProject
+    from user a left join (select uid,last_follow_time from user_mid where aid= #{aid}) b  on a.id=b.uid
+    left join organization_identity c on a.id=c.uid
+    <if test="type==5 or type==6">
+      left join (select aid,uid from public_release where clock_in =1
+      and aid= #{aid,jdbcType=VARCHAR}
+      <if test="startTime != null and endTime != null">
+        and  clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+      </if>
+      )e on a.id=e.uid
+    </if>
+    where  a.type=1 and a.new_channel=0
+    <if test="type != 5 and type !=6">
+      and a.aid=  #{aid,jdbcType=VARCHAR}
+    </if>
+    <if test="type == 5 or type ==6">
+      and e.aid=  #{aid,jdbcType=VARCHAR}
+    </if>
+    <if test="type == 0">
+      and  a.share_type = 0
+    </if>
+    <if test="type == 1">
+      and  a.share_type = 3
+    </if>
+    <if test="type ==0  or type==3 or type==5 or type==7">
+      and a.channel=0
+    </if>
+    <if test="type == 1 or type==4 or type==6">
+      and a.channel=1
+    </if>
+    <if test="type == 2">
+      and a.share_type=2
+    </if>
+    <if test="type == 3 or type==4">
+      and a.source=1
+      and  a.share_type = 0
+    </if>
+    <if test="type==7 ">
+      and a.share_type = 0
+      and a.source=2
+    </if>
+    <if test="type!=5 and type!=6">
+      <if test="startTime != null and endTime != null">
+        and  a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+      </if>
+    </if>
+    <if test="page_sql!=null">
+      ${page_sql}
+    </if>
+  </select>
+
+  <select id="selectAdminCustomerDetailCount" parameterType="java.lang.String" resultType="java.lang.Integer">
+    select count(*)
+    from user a
+    <if test="type==5 or type==6">
+      left join (select aid,uid from public_release where clock_in =1
+      and aid= #{aid,jdbcType=VARCHAR}
+      <if test="startTime != null and endTime != null">
+        and  clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+      </if>
+      )e on a.id=e.uid
+    </if>
+    where  a.type=1 and a.new_channel=0
+    <if test="type != 5 and type !=6">
+      and a.aid=  #{aid,jdbcType=VARCHAR}
+    </if>
+    <if test="type == 5 or type ==6">
+      and e.aid=  #{aid,jdbcType=VARCHAR}
+    </if>
+    <if test="type == 0">
+      and  a.share_type = 0
+    </if>
+    <if test="type == 1">
+      and  a.share_type = 3
+    </if>
+    <if test="type ==0  or type==3 or type==5 or type==7">
+      and a.channel=0
+    </if>
+    <if test="type == 1 or type==4 or type==6">
+      and a.channel=1
+    </if>
+    <if test="type == 2">
+      and a.share_type=2
+    </if>
+    <if test="type == 3 or type==4">
+      and a.source=1
+      and  a.share_type = 0
+    </if>
+    <if test="type==7 ">
+      and a.share_type = 0
+      and a.source=2
+    </if>
+    <if test="type!=5 and type!=6">
+      <if test="startTime != null and endTime != null">
+        and  a.transfer_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+      </if>
+    </if>
+  </select>
+
+
+  <select id="listNameByDepAndName" resultType="java.lang.String">
+    select a.id  from admin a left join user_role b on a.id =b.uid
+                              left join `role` c on b.rid=c.id
+    where department_id= #{depId}
+      and c.role_type= #{roleType}
+  </select>
+
+
+  <select id="listAdminBydepIdAndRoleType" resultType="com.goafanti.common.model.Admin">
+    select a.id,a.name,a.email  from admin a left join user_role b on a.id =b.uid
+                                             left join `role` c on b.rid=c.id
+    where department_id= #{depId}
+      and c.role_type= #{roleType}
+  </select>
+
+
+  <select id="selectBySuperId" resultType="java.lang.String">
+    select id from admin where superior_id= #{aid}
+  </select>
+
+  <select id="selectGetSuper" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin
+    where  superior_id= #{aid}
+  </select>
+  <select id="selectFinanceAdminByOrderDep" resultType="com.goafanti.common.model.Admin">
+    select a.finance_id id,b.name from department a left join admin b on a.finance_id=b.id
+    where a.id= #{orderDep}
+  </select>
+  <select id="getPermission" resultType="java.lang.String">
+    select c.role_type from admin a left join user_role b on a.id=b.uid left join `role` c on b.rid=c.id
+    where a.id= #{transferId}
+  </select>
+  <select id="selectDepIdWithSpuerId" resultType="java.lang.String">
+    select b.id from admin a right join department b on a.id=b.finance_id
+    where a.superior_id= #{superId}
+  </select>
+  <select id="getAdminRoleListByAid"  resultType="java.lang.String">
+    select c.role_type from admin a left join user_role b on a.id=b.uid
+                                    left join role c on b.rid =c.id
+    where a.id= #{id}
+  </select>
+
+  <select id="selectByOpeid" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from admin
+    where  open_id= #{openid}
+  </select>
+  <select id="getFinanceDep" resultType="java.lang.String">
+    select id from department where finance_id = #{aid}
+  </select>
+  <select id="getLowerFinanceDep" resultType="java.lang.String">
+    select b.id from admin a left join department b on a.id=b.finance_id
+    where a.superior_id = #{aid}
+  </select>
+  <select id="selectByAmbIdCount" resultType="java.lang.Integer">
+    SELECT count(*) from admin where amb_id= #{ambId}
+  </select>
+  <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
+    where a.status='0'
+    <if test="roleType =='99998'">
+      and c.role_type  in ('99998','99988')
+    </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>

+ 13 - 13
src/main/java/com/goafanti/order/enums/ProcessStatus.java

@@ -11,26 +11,26 @@ import java.util.Map;
 public enum ProcessStatus {
 	/** 已派营销员 **/
 	YPYXY(0,"已派营销员"),
+	/** 已派营销经理 **/
+	YPYXJL(1,"已派营经理"),
 	/** 已派营销管理员 **/
-	YPYXGLY(1,"已派营销管理员"),
-	/** 已派财务管理员 **/
-	YPCWGLY(2,"已派财务管理员"),
+	YPYXGLY(2,"已派营销管理员"),
 	/** 已派财务专员 **/
 	YPCWZY(3,"已派财务专员"),
+	/** 已派特批审核 **/
+	YPTPSH(4,"已派特批审核"),
 	/** 已派咨询师管理员 **/
-	YPZXSGLY(4,"已派咨询师管理员"),
+	YPZXSGLY(5,"已派咨询师管理员"),
 	/** 已部分派咨询师经理 **/
-	YBFPZXSGLY(5,"已部分分派咨询师经理"),
+	YBFPZXSGLY(6,"已部分分派咨询师经理"),
 	/** 已全部分派咨询师经理 **/
-	YQBFPZXSGLY(6,"已全部分派咨询师经理"),
-	/** 已派特批审核 **/
-	YPTPSH(7,"已派特批审核"),
-	/** 已派外包审核 **/
-	YPWBSH(8,"已派外包审核"),
+	YQBFPZXSGLY(7,"已全部分派咨询师经理"),
+
+
 	/** 无效 **/
 	INVALID(10, "INVALID");
-	
-	
+
+
 	private ProcessStatus(Integer code, String desc) {
 		this.code = code;
 		this.desc = desc;
@@ -73,5 +73,5 @@ public enum ProcessStatus {
             }
         }
         return  null;
-    }	
+    }
 }

+ 1 - 1
src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java

@@ -99,7 +99,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		onew.setOrderNo(orderNo);
 		//onew.setDeleteSign(0);//锁定订单也能走流程
 		onew.setApproval(approval);//特批状态
-		onew.setProcessStatus(ProcessStatus.YPCWGLY.getCode());//已派财务管理员
+//		onew.setProcessStatus(ProcessStatus.YPCWGLY.getCode());//已派财务管理员 废除
 		onew.setOrderStatus(OrderNewState.QDSHTG.getCode());//营销管理员审核通过
 		int idCount = tOrderNewMapper.getCountByIdAndStatus(onew);
 		int fidCount = adminMapper.getCountById(financeId);

+ 64 - 57
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -451,11 +451,22 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		//订单提交
 		if (isSubmit==1) {
 			t2.setApproval(t.getApproval());
-			if(t2.getProcessStatus()<ProcessStatus.YPYXGLY.getCode()) {
-				t.setOrderStatus(OrderNewState.QDDS.getCode());
-				t.setProcessStatus(ProcessStatus.YPYXGLY.getCode());
-			}else {
-				t.setOrderStatus(OrderNewState.QDSHTG.getCode());
+			addOrderLog(t2.getOrderNo(),OrderLogProcess.TJ.getCode(), null);
+			if(t2.getProcessStatus()<ProcessStatus.YPYXJL.getCode()) {
+				//添加营销管理员审核经理
+					if (a.getManagerId()!=null){
+						t.setProcessStatus(ProcessStatus.YPYXJL.getCode());
+					}else {
+						if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
+							addOrderLog(t2.getOrderNo(),OrderLogProcess.SH.getCode(), "管理员跳过自己审核");
+							t.setProcessStatus(ProcessStatus.YPCWZY.getCode());
+						}else {
+							addOrderLog(t2.getOrderNo(),OrderLogProcess.YXJLTT.getCode(), "无经理跳过审核");
+							t.setProcessStatus(ProcessStatus.YPYXGLY.getCode());
+						}
+					}
+					t.setOrderStatus(OrderNewState.QDDS.getCode());
+
 			}
 			//特批逻辑处理
 			if (t2.getApproval()==ApprovalNewState.ZCDSH.getCode()){
@@ -471,11 +482,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				t.setApproval(ApprovalNewState.DSZDSH.getCode());
 			}
 			//生成流转
-			TOrderLog tl=new TOrderLog();
-			tl.setOrderNo(t.getOrderNo());
-			tl.setProcess(OrderLogProcess.TJ.getCode());
-			tl.setAid(TokenManager.getAdminId());
-			addOrderLog(tl,null);
 			if (StringUtils.isBlank(t2.getContractNo())) {
 				//没有合同编号则生成
 				createContractNo(t);
@@ -487,23 +493,32 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			t.setBuyerId(t2.getBuyerId());
 			updateOrderMid(t);
 			List<String> aids = new ArrayList<>();
-			Integer type;
-			aids.addAll(adminMapper.listNameByDepAndName(a.getDepartmentId(), AFTConstants.SALESMAN_ADMIN));
-			type=NoticeStatus.ORDER_START.getCode();
-			TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
-			pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),t.getApproval());
-			if (t.getOrderDep()!=null){
+			Integer type=NoticeStatus.OTHER.getCode();
+			StringBuffer str =new StringBuffer();
+			if (t.getProcessStatus()==ProcessStatus.YPYXJL.getCode()){
+				type=NoticeStatus.ORDER_START.getCode();
+				aids.add(a.getManagerId());
+				Admin manager = adminMapper.selectByPrimaryKey(a.getManagerId());
+				str=str.append(manager.getName()).append(",");
+			}else if (t.getProcessStatus()==ProcessStatus.YPYXGLY.getCode()){
+				type=NoticeStatus.ORDER_YES.getCode();
 				List<Admin> admins = adminMapper.listAdminBydepIdAndRoleType(t.getOrderDep(),AFTConstants.SALESMAN_ADMIN);
-				StringBuffer str =new StringBuffer();
-				if (admins.isEmpty()){
-					OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());
-					admins = adminMapper.listAdminBydepIdAndRoleType(dep.getSuperId(),AFTConstants.SALESMAN_ADMIN);
-				}
-				for (Admin admin : admins) {
-					if (!str.toString().contains(admin.getName()))str.append(admin.getName()).append(",");
+				if (!admins.isEmpty()){
+					for (Admin admin : admins) {
+						aids.add(admin.getId());
+						if (!str.toString().contains(admin.getName()))str.append(admin.getName()).append(",");
+					}
 				}
-				if (str.length()>0)t.setExamineName(str.substring(0,str.length()-1));
-			}
+			}else  if (t.getProcessStatus()==ProcessStatus.YPCWZY.getCode()){
+				type=NoticeStatus.ORDER_YES.getCode();
+				Department dep = departmentMapper.selectByPrimaryKey(t.getOrderDep());
+				aids.add(dep.getFinanceId());
+				Admin finance = adminMapper.selectByPrimaryKey(dep.getFinanceId());
+				str=str.append(finance.getName()).append(",");
+			}
+			if (str.length()>0)t.setExamineName(str.substring(0,str.length()-1));
+			TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
+			pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),t.getApproval());
 		}
 		if (t2.getApproval().equals(ApprovalNewState.ZCBH.getCode()) ||
 				t2.getApproval().equals(ApprovalNewState.DSZBH.getCode()) ||
@@ -526,8 +541,6 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				t.setLiquidationStatus(LiquidationNewState.WAIT_PAY_FIRST_BALANCE.getCode());
 			}
 		}
-
-
 		return tOrderNewMapper.updateByPrimaryKeySelective(t);
 	}
 
@@ -663,6 +676,14 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 
 	}
 
+	public void addOrderLog(String  orderNo,Integer process , String reason) {
+		TOrderLog tl=new TOrderLog();
+		tl.setOrderNo(orderNo);
+		tl.setProcess(process);
+		addOrderLog( tl,  reason);
+
+	}
+
 
 	@Override
 	public TOrderNewBo getOrderNewDetail(String orderNo) {
@@ -912,42 +933,24 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		Integer type=null;
 		TOrderLog tl=new TOrderLog();
 		tl.setAid(TokenManager.getAdminId());
+		tl.setOrderNo(orderNo);
 		if (orderStatus.equals(OrderNewState.QDSHTG.getCode())) {
 			t.setOutsource(outsource);
-			//外包单给外包审核员 否则给财务专员
-				if(outsource==0) {
-					t.setProcessStatus(ProcessStatus.YPCWZY.getCode());
-					//如果是转的暂时不删除外包信息
-					aids.add(departmentMapper.selectByPrimaryKey(t2.getOrderDep()).getFinanceId());
-				} else if(outsource==1) {
-					for (Admin admin : adminMapper.getAdminRoleNameList("外包审核员")) {
-						aids.add(admin.getId());
-					}
-					t.setProcessStatus(ProcessStatus.YPWBSH.getCode());
-					tl.setOrderNo(orderNo);
-					tl.setProcess(OrderLogProcess.FQWB.getCode());
-					addOrderLog(tl,reason);
+			Admin a =adminMapper.selectByPrimaryKey(t2.getSalesmanId());
+			if (t2.getProcessStatus()==ProcessStatus.YPYXJL.getCode()){
+				tl.setProcess(OrderLogProcess.YXJLTT.getCode());
+				t.setProjectStatus(ProcessStatus.YPYXGLY.getCode());
+				aids.addAll(adminMapper.listNameByDepAndName(a.getDepartmentId(), AFTConstants.SALESMAN_ADMIN));
+			}else if (t2.getProcessStatus()==ProcessStatus.YPYXGLY.getCode()){
+				tl.setProcess(OrderLogProcess.SH.getCode());
+				t.setProcessStatus(ProcessStatus.YPCWZY.getCode());
+				aids.add(departmentMapper.selectByPrimaryKey(t2.getOrderDep()).getFinanceId());
+			}
 
-				}
 			type=NoticeStatus.ORDER_YES.getCode();
-			tl.setOrderNo(orderNo);
-			tl.setProcess(OrderLogProcess.SH.getCode());
 			//增加日志
 			addOrderLog(tl,reason);
-			//非特批增加催款信息
-			//外包
-			 if(outsource==1) {
-				 o.setRefundStatus(0);
-				if(o.getId()==null) {
-				o.setCreateTime(new Date());
-				tOrderOutsourceMapper.insertSelective(o);
-				}else {
-				tOrderOutsourceMapper.updateByPrimaryKeySelective(o);
-				}
-				//修改项目为外包项目
-				tOrderTaskMapper.updateByOutsourceToOrderNo(orderNo,1);
-			}
-//			pushOrderDun(t2);
+
 		}else if (orderStatus.equals(OrderNewState.QDSHJJ.getCode())) {//如果不通过新增驳回
 				if (outsource==0) {//非外包
 				t.setProcessStatus(ProcessStatus.YPYXY.getCode());
@@ -973,6 +976,10 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (t.getProcessStatus()==ProcessStatus.YPYXY.getCode()){
 			Admin admin = adminMapper.selectByPrimaryKey(t.getSalesmanId());
 			t.setExamineName(admin.getName());
+		}else if (t.getProcessStatus()==ProcessStatus.YPYXJL.getCode()){
+			Admin a = adminMapper.selectByPrimaryKey(t.getSalesmanId());
+			Admin admin = adminMapper.selectByPrimaryKey(a.getManagerId());
+			t.setExamineName(admin.getName());
 		}else if (t.getProcessStatus()==ProcessStatus.YPCWZY.getCode()){
 			if (t.getOrderDep()!=null){
 				OrganizationListOut dep = departmentMapper.selectAllById(t.getOrderDep());