anderx 3 years ago
parent
commit
8640d87026

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

@@ -763,6 +763,12 @@ select
     </update>
   <update id="updateExamineById">
     update new_order_change a left join t_order_new b on a.order_no =b.order_no
+    <if test="type==0 or type==1">
+      left join admin c on b.salesman_id =c.id
+      left join admin d on c.manager_id =d.id
+      set a.examine_name=d.name
+      where a.process_state =1 and d.id = #{id}
+    </if>
     <if test="type==1">
       left join admin c on b.salesman_id =c.id
       set a.examine_name=c.name

+ 4 - 3
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -1641,10 +1641,11 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     </update>
   <update id="updateExamineById">
     update t_order_new a
-    <if test="type==1">
+    <if test="type==0 or type==1">
       left join admin b on a.salesman_id =b.id
-      set a.examine_name=b.name
-      where a.process_status =1 and b.manager_id = #{id}
+      left join admin c on b.manager_id =c.id
+      set a.examine_name =c.name
+      where a.process_status =1 and c.id= #{id}
     </if>
     <if test="type==2">
       left join (select a.department_id depId,group_concat(a.name) name

+ 13 - 2
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -455,6 +455,7 @@ public class AsyncUtils {
 	 */
 	public  void pushRoleUpdateExamine(Admin ad, Admin usead, List<String> roleIds, List<Role>  useRole) {
 		List<Role> roles = roleMapper.selectByIdList(roleIds);
+		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.SALESMAN);
 		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.SALESMAN_MANAGER);
 		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.SALESMAN_ADMIN);
 		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.TECH);
@@ -488,16 +489,19 @@ public class AsyncUtils {
 						updateOrderAndChangeExamine(ad, roleType);
 						updateOrderAndChangeExamine(usead, roleType);
 					}
-				}else if (newDEP&&!useDep){
-					updateOrderAndChangeExamine(ad, roleType);
 				}else if (!newDEP&&useDep){
 					updateOrderAndChangeExamine(usead, roleType);
 				}
+			}else if (roleType.equals(AFTConstants.SALESMAN)){
+				if (!ad.getManagerId().equals(usead.getManagerId())){
+					updateOrderAndChangeExamine(ad, roleType);
+				}
 			}else {
 				if (updateParam){
 					updateOrderAndChangeExamine(ad, roleType);
 				}
 			}
+
 		}
 
 
@@ -520,6 +524,8 @@ public class AsyncUtils {
 	public void updateOrderAndChangeExamine(Admin ad, String roleType) {
 		if (roleType.equals(AFTConstants.SALESMAN_ADMIN)){
 			updateSalesmanAdminExamine(ad.getId());
+		}else if (roleType.equals(AFTConstants.SALESMAN)){
+			updateSalesmanExamine(ad.getManagerId());
 		}else if (roleType.equals(AFTConstants.SALESMAN_MANAGER)){
 //			订单 0=营销员,1=经理,2=营销管理员,3=财务专员,4=总裁,5=技术总监,6部分分配,7全部分配
 //			变更 流程状态 0=营销员,1=营销经理,2=营销管理员,3=技术员,4=技术经理,5=技术总监,6=财务专员,7=财务总监,8=总裁,9=董事长
@@ -538,6 +544,11 @@ public class AsyncUtils {
 		}
 	}
 
+	private void updateSalesmanExamine(String id) {
+		tOrderNewMapper.updateExamineById(id,ProcessStatus.YPYXY.getCode());
+		newOrderChangeMapper.updateExamineById(id,OrderChangeProcess.YXY.getCode());
+	}
+
 	private void updateSalesmanAdminExamine(String id) {
 		tOrderNewMapper.updateExamineById(id,ProcessStatus.YPYXGLY.getCode());
 		newOrderChangeMapper.updateExamineById(id,OrderChangeProcess.YXGLY.getCode());