Просмотр исходного кода

修改管理员名称审核人员名称修改开发

anderx лет назад: 3
Родитель
Сommit
c376bb61f3

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

@@ -67,7 +67,7 @@ public interface TOrderNewMapper {
      */
     OrderProcessName getProcessName(String orderNo);
 
-    void updateExamine(String departmentId);
+    void updateDepExamine(String departmentId);
 
     void updateExamineById(@Param("id") String id,@Param("type")Integer type);
 

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

@@ -769,16 +769,26 @@ select
       where a.process_state =1 and c.manager_id = #{id}
     </if>
     <if test="type==3">
-      left join department c on b.order_dep =c.id
-      left join admin d on c.finance_id =d.id
-      set a.examine_name=d.name
-      where a.process_state =3 and d.id = #{id}
+      left join t_order_task c on a.order_no =c.order_no
+      left join (select a.order_no ,a.`type` ,GROUP_CONCAT(distinct b.name) name
+      from order_examine a left join admin b on a.aid=b.id where  a.`type` =0
+      group by order_no ,type)d on a.order_no =d.order_no
+      set a.examine_name =d.name
+      where a.process_state =3 and c.manager_id = #{id}
     </if>
-    <if test="type==3">
+    <if test="type==4">
+      left join t_order_task c on a.order_no =c.order_no
+      left join (select a.order_no ,a.`type` ,GROUP_CONCAT(distinct b.name) name
+      from order_examine a left join admin b on a.aid=b.id where  a.`type` =1
+      group by order_no ,type)d on a.order_no =d.order_no
+      set a.examine_name =d.name
+      where a.process_state =3 and c.consultant_id = #{id}
+    </if>
+    <if test="type==6">
       left join department c on b.order_dep =c.id
       left join admin d on c.finance_id =d.id
       set a.examine_name=d.name
-      where a.process_state =3 and d.id = #{id}
+      where a.process_state =6 and d.id = #{id}
     </if>
     <if test="type==5 or type==7">
       left join (select group_concat(a.name) name

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

@@ -1630,7 +1630,7 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
     update t_order_new set settlement_amount=settlement_amount-#{refundAmount,jdbcType=DECIMAL},
                            refund_amount=#{refundAmount,jdbcType=DECIMAL}	where order_no=#{orderNo}
   </update>
-    <update id="updateExamine">
+    <update id="updateDepExamine">
       update t_order_new a ,(select a.department_id depId,group_concat(a.name) name
                              from admin a left join user_role b on a.id=b.uid
                                           left join `role` c on b.rid =c.id

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

@@ -457,6 +457,8 @@ public class AsyncUtils {
 		List<Role> roles = roleMapper.selectByIdList(roleIds);
 		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.SALESMAN_MANAGER);
 		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.SALESMAN_ADMIN);
+		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.TECH);
+		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.TECH_MANAGER);
 		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.TECH_ADMIN);
 		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.FINANCE);
 		updateExamineByRole(ad, usead, useRole, roles,AFTConstants.FINANCE_ADMIN);
@@ -517,21 +519,37 @@ public class AsyncUtils {
 	 */
 	public void updateOrderAndChangeExamine(Admin ad, String roleType) {
 		if (roleType.equals(AFTConstants.SALESMAN_ADMIN)){
-			tOrderNewMapper.updateExamine(ad.getDepartmentId());
+			tOrderNewMapper.updateDepExamine(ad.getDepartmentId());
 			newOrderChangeMapper.updateExamineName(ad.getDepartmentId());
 		}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=董事长
-			tOrderNewMapper.updateExamineById(ad.getId(),1);
-			newOrderChangeMapper.updateExamineById(ad.getId(),1);
+			updateSalesmanManagerExamine(ad);
 		}else if (roleType.equals(AFTConstants.FINANCE)){
-			tOrderNewMapper.updateExamineById(ad.getId(),3);
-			newOrderChangeMapper.updateExamineById(ad.getId(),3);
+			updateFinanceExamine(ad.getId());
+		}else if (roleType.equals(AFTConstants.TECH)) {
+			newOrderChangeMapper.updateExamineById(ad.getId(), OrderChangeProcess.JSY.getCode());
+		}else if (roleType.equals(AFTConstants.TECH_MANAGER)) {
+			newOrderChangeMapper.updateExamineById(ad.getId(), OrderChangeProcess.JSJL.getCode());
 		}else if (roleType.equals(AFTConstants.TECH_ADMIN)) {
-			tOrderNewMapper.updateExamineById(null, 5);
-			newOrderChangeMapper.updateExamineById(null, 5);
+			tOrderNewMapper.updateExamineById(null, ProcessStatus.YPZXSGLY.getCode());
+			newOrderChangeMapper.updateExamineById(null, OrderChangeProcess.JSZJ.getCode());
 		}else if (roleType.equals(AFTConstants.FINANCE_ADMIN)) {
-			newOrderChangeMapper.updateExamineById(null, 7);
+			newOrderChangeMapper.updateExamineById(null, OrderChangeProcess.CWZJ.getCode());
 		}
 	}
+
+	private void updateSalesmanManagerExamine(Admin ad) {
+		updateSalesmanManagerExamine(ad.getId());
+	}
+
+	private void updateSalesmanManagerExamine(String id) {
+		tOrderNewMapper.updateExamineById(id, ProcessStatus.YPYXJL.getCode());
+		newOrderChangeMapper.updateExamineById(id, OrderChangeProcess.YXJL.getCode());
+	}
+
+	public void updateFinanceExamine(String id) {
+		tOrderNewMapper.updateExamineById(id,ProcessStatus.YPCWZY.getCode());
+		newOrderChangeMapper.updateExamineById(id,OrderChangeProcess.CWZY.getCode());
+	}
 }

+ 15 - 1
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -5,8 +5,10 @@ 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.enums.OrderState;
 import com.goafanti.common.model.Department;
 import com.goafanti.common.utils.AsyncUtils;
+import com.goafanti.order.enums.ProcessStatus;
 import com.goafanti.organization.bo.DepOut;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -196,12 +198,24 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		dep.setProvince(province);
 		dep.setHideSign(hideSign);
 		dep.setWorkingHoursType(workingHoursType);
+		checkFinaceUpdate(id,financeId);
 
-		tOrderMidMapper.updateFinanceId(id,financeId);
 		int x=departmentMapper.updateByPrimaryKeySelective(dep);
 		return x;
 	}
 
+	/**
+	 * 如果更换了负责人刷新中间表
+	 * @param id
+	 * @param financeId
+	 */
+	private void checkFinaceUpdate(String id, String financeId) {
+		Department dep = departmentMapper.selectByPrimaryKey(id);
+		if (financeId!=null&&financeId.equals(dep.getFinanceId())){
+			asyncUtils.updateFinanceExamine(financeId);
+		}
+	}
+
 	@Override
 	public boolean checkDepNo(String depNo,Integer type) {
 		String useDepNo=departmentMapper.selectIdByDepNo(depNo);