Browse Source

营销管理、公司管理、财务管理、咨询管理新增修改对于审核人员的更新

anderx 3 years ago
parent
commit
7cb1edb888

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

@@ -48,7 +48,8 @@ public interface NewOrderChangeMapper {
      * @param aid 切换后审核人
      * @return
      */
-    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid);
+    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);
 }

+ 3 - 2
src/main/java/com/goafanti/common/dao/TOrderInvoiceMapper.java

@@ -37,12 +37,13 @@ public interface TOrderInvoiceMapper {
 
     /**
      * 切换审核人员
-     * @param type 0财务
+     * @param type 0财务  1营销管理员 3公司管理
      * @param depId 部门编号
      * @param aid 切换后审核人
      * @return
      */
-    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid);
+    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid
+        ,@Param("names")String names);
 
     /**
      * @param roleType

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

@@ -65,5 +65,6 @@ public interface TOrderNewMapper {
      * @param aid 切换后审核人
      * @return
      */
-    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid);
+    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid,
+                          @Param("names")String names);
 }

+ 12 - 3
src/main/java/com/goafanti/common/mapper/NewOrderChangeMapper.xml

@@ -728,11 +728,20 @@ select
 	</select>
 
   <update id="updateExamineName">
-    update  new_order_change a,t_order_new b,admin c
-    set a.examine_name=c.name
-    where a.process_state = #{type} and a.order_no =b.order_no
+    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
       and b.order_dep = #{depId}
       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
+        and b.order_dep = #{depId}
+      </if>
   </update>
     <update id="updateTaskExamineName">
       update new_order_change n left join (select a.order_no

+ 29 - 10
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -594,21 +594,40 @@ where a.status=2 and a.order_no=  #{orderNo,jdbcType=VARCHAR}
   </select>
 
   <update id="updateExamineName">
-    update  t_order_invoice a,t_order_new b,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>
+    update  t_order_invoice a
+    <if test="names ==null">
+      ,t_order_new b,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>
+      </if>
       and a.order_no =b.order_no
       and b.order_dep = #{depId}
       and c.id= #{aid}
+    </if>
+    <if test="names !=null">
+      ,t_order_new b
+      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
+      and b.order_dep = #{depId}
+    </if>
   </update>
   <update id="updateListExamineName">
     <if test="type==1">

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

@@ -1942,10 +1942,19 @@ left join department d on o.order_dep = d.id   left join t_order_mid a on o.orde
   </select>
 
   <update id="updateExamineName">
-    update  t_order_new a,admin b
-    set a.examine_name=b.name
-    where a.process_status = #{type} and a.order_dep = #{depId}
-    and b.id= #{aid}
+    update  t_order_new a
+    <if test="names==null">
+      ,admin b
+      set a.examine_name=b.name
+      where a.process_status = #{type} and a.order_dep = #{depId}
+      and b.id= #{aid}
+    </if>
+    <if test="names!=null">
+      set a.examine_name= #{names}
+      where a.process_status = #{type}  and a.order_dep = #{depId}
+    </if>
+
+
   </update>
 
 </mapper>

+ 30 - 19
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -16,6 +16,8 @@ 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;
@@ -113,21 +115,14 @@ public class AsyncUtils {
 
 	/**
 	 * 切换审核人员
-	 * @param type 1营销管理   3财务
 	 * @param depId 部门编号
 	 * @param aid 切换后审核人
 	 * @return
 	 */
-    public void updateExamineName(Integer type, String depId, String aid) {
-		if (type==1){
-			tOrderNewMapper.updateExamineName(1,depId,aid);
-			newOrderChangeMapper.updateExamineName(1,depId,aid);
-			tOrderInvoiceMapper.updateExamineName(1,depId,aid);
-		}else if (type==3){
-			tOrderNewMapper.updateExamineName(3,depId,aid);
-			newOrderChangeMapper.updateExamineName(5,depId,aid);
-			tOrderInvoiceMapper.updateExamineName(0,depId,aid);
-		}
+    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);
 	}
 
 	/**
@@ -137,17 +132,33 @@ public class AsyncUtils {
 	 * @param roleType
 	 */
 	public void updateListExamineName(Integer type, String depId, String roleType) {
-		StringBuffer names=new StringBuffer();
+		StringBuffer str=new StringBuffer();
+		String names="";
+
+		if (str.length()>1)names=str.substring(0,str.length()-1);
 		if (type==1){
-			List<Admin> admins = adminMapper.selectAdminByRoleType(roleType);
-			for (Admin admin : admins) {
-				if (admin.getDepartmentId().equals(depId)){
-					names=names.append(admin.getName()).append(",");
-				}
-			}
-			tOrderInvoiceMapper.updateListExamineName(type,depId,roleType);
+			getNames(depId, roleType, str);
+			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){
+			getNames(depId, roleType, str);
+			newOrderChangeMapper.updateExamineName(OrderChangeProcess.CWZJ.getCode(),depId,null,names);
+		}else if (type==4){
+			getNames(depId, roleType, str);
+			tOrderNewMapper.updateExamineName(ProcessStatus.YPZXSGLY.getCode(),depId,null,names);
+			newOrderChangeMapper.updateExamineName(OrderChangeProcess.JSZJ.getCode(),depId,null,names);
+		}
+	}
+
+	private void getNames(String depId, String roleType, StringBuffer str) {
+		List<Admin> admins = adminMapper.selectAdminByRoleType(roleType);
+		for (Admin admin : admins) {
+			if (admin.getDepartmentId().equals(depId)) {
+				str = str.append(admin.getName()).append(",");
+			}
 		}
 	}
 }

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

@@ -199,10 +199,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		Department use = departmentMapper.selectByPrimaryKey(id);
 		if (!use.getFinanceId().equals(financeId)){
 			//切换后更换审核人
-			asyncUtils.updateExamineName(3,id,financeId);
-		}
-		if (!use.getManagerId().equals(managerId)){
-			asyncUtils.updateExamineName(1,id,managerId);
+			asyncUtils.updateExamineName(id,financeId);
 		}
 		tOrderMidMapper.updateFinanceId(id,financeId);
 		int x=departmentMapper.updateByPrimaryKeySelective(dep);