Browse Source

修改订单部门BUG修复

anderx 2 years ago
parent
commit
ab2c880142

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

@@ -27,4 +27,5 @@ public interface TOrderExamineMapper {
     int selectByOrderNoAndAid(@Param("orderNo")String orderNo,@Param("aid") String aid);
 
 
+    void deleteByOrderNo(String orderNo);
 }

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

@@ -23,7 +23,8 @@
     delete from t_order_examine
     where id = #{id,jdbcType=INTEGER}
   </delete>
-  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderExamine" useGeneratedKeys="true">
+
+    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderExamine" useGeneratedKeys="true">
     insert into t_order_examine (order_no, aid, `status`,
       create_time, aname)
     values (#{orderNo,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
@@ -129,6 +130,9 @@
     from t_order_examine where status=0
     and order_no = #{orderNo} and aid= #{aid}
   </select>
-
+  <delete id="deleteByOrderNo">
+    delete from t_order_examine
+    where order_no = #{orderNo}
+  </delete>
 
 </mapper>

+ 35 - 33
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -1,60 +1,57 @@
 package com.goafanti.order.service.impl;
 
 
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.math.BigDecimal;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.stream.Collectors;
-
-
-import javax.mail.MessagingException;
-
-import com.goafanti.admin.service.DepartmentService;
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.dao.*;
-import com.goafanti.common.model.*;
-import com.goafanti.common.utils.excel.NewExcelUtil;
-import com.goafanti.order.bo.*;
-import com.goafanti.order.enums.*;
-import com.goafanti.order.service.OrderProjectService;
-import com.goafanti.organization.bo.*;
-import com.goafanti.common.utils.StringUtils;
-import groovy.transform.Synchronized;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.stereotype.Service;
-
 import com.alibaba.fastjson.JSON;
 import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.admin.service.DepartmentService;
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.bo.OrderOperator;
+import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.dao.*;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.enums.OfficialPatentType;
 import com.goafanti.common.enums.OrderLogProcess;
 import com.goafanti.common.error.BusinessException;
+import com.goafanti.common.model.*;
 import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.SendEmailUtil;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.customer.bo.LockingReleaseBo;
+import com.goafanti.order.bo.*;
+import com.goafanti.order.enums.*;
 import com.goafanti.order.service.OrderNewService;
+import com.goafanti.order.service.OrderProjectService;
+import com.goafanti.organization.bo.*;
 import com.goafanti.patent.service.PatentNewService;
+import groovy.transform.Synchronized;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.mail.MessagingException;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
 @Service
 @EnableAsync
 public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> implements OrderNewService {
@@ -189,7 +186,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		if (tOrderExamines.isEmpty()){
 			OrganizationListOut dep = departmentMapper.selectAllById(o.getOrderDep());
 			List<TOrderExamine> list =new ArrayList<>();
-			list.add(new TOrderExamine(o.getOrderNo(),dep.getFinanceId(),dep.getFinanceName()));
+			if (dep!=null&&dep.getFinanceId()!=null)list.add(new TOrderExamine(o.getOrderNo(),dep.getFinanceId(),dep.getFinanceName()));
 			List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.TECH_ADMIN);
 			for (Admin admin : admins) {
 				list.add(new TOrderExamine(o.getOrderNo(),admin.getId(),admin.getName()));
@@ -529,7 +526,12 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 				contractNoReplace(t.getOrderNo(), t2.getContractNo(),t2.getOrderDep());
 				createContractNo(t);
 			}
-			//修改订单中间表信息
+			//如果修改了部门she审核财务也要切换
+			if(!t.getOrderDep().equals(t2.getOrderDep())) {
+				tOrderExamineMapper.deleteByOrderNo(t.getOrderNo());
+				addOrderExamine(t);
+			}
+			// 修改订单中间表信息
 			t.setBuyerId(t2.getBuyerId());
 			updateOrderMid(t);
 			List<String> aids = new ArrayList<>();