Browse Source

[BL_2018100025]销售订单客户关闭逻辑限制

guq 7 years ago
parent
commit
293ba0270d

+ 6 - 1
applications/sale/sale-server/src/main/java/com/usoftchina/saas/sale/service/impl/SaleServiceImpl.java

@@ -310,6 +310,11 @@ public class SaleServiceImpl implements SaleService{
             throw new BizException(BizExceptionCode.SALE_EXISTS_PURCHASE.getCode(),
                     String.format(BizExceptionCode.SALE_EXISTS_PURCHASE.getMessage(),purchaseCode));
         }
+        //检测客户是否禁用
+        Integer ban = saleMapper.checkCustomer(id);
+        if (ban > 0) {
+            throw new BizException(7890001, "存在已禁用客户");
+        }
         singleUnAudit(id);
     }
 
@@ -742,7 +747,7 @@ public class SaleServiceImpl implements SaleService{
             if (!StringUtils.isEmpty(custAudit)) {
                 String message = BizExceptionCode.SALE_ORDER_CUSTBANDED.getMessage();
                 int code = BizExceptionCode.SALE_ORDER_CUSTBANDED.getCode();
-                throw new BizException(code, String.format(message, "审核")+custAudit);
+                throw new BizException(code, String.format(message, "审核")+custAudit);
             }
         }else{
             //存在未审核单据,单据编号:XXXX

+ 2 - 2
applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml

@@ -400,7 +400,7 @@
     select sa_code from sale where IFNULL(sa_sendstatuscode,' ')='CLOSE' and sa_id=#{id}
   </select>
   <select id="validateCustAudit" parameterType="com.usoftchina.saas.commons.dto.DocBaseDTO" resultType="java.lang.String">
-    select GROUP_CONCAT(sa_code) from sale left join customer on cu_id=sa_custid  where IFNULL(sa_statuscode,' ')='AUDITED' and IFNULL(cu_statuscode,' ')='BANNED' and sa_id in
+    select GROUP_CONCAT(sa_code) from sale left join customer on cu_id=sa_custid  where IFNULL(cu_statuscode,' ')='BANNED' and sa_id in
     <foreach collection="list" item="item" open="(" close=")" separator=",">
       #{item.id}
     </foreach>
@@ -449,7 +449,7 @@
     and purchasedetail.companyid= #{companyid}
   </select>
   <select id="checkCustomer" parameterType="long" resultType="integer">
-    select count(1) from sale left join  customer on sa_custid=cu_id  where  cu_statuscode='CLOSE' and sa_id=#{id}
+    select count(1) from sale left join  customer on sa_custid=cu_id  where  cu_statuscode='BANNED' and sa_id=#{id}
   </select>
   <update id="updateAudit">
     update sale set sa_status=#{status},sa_statuscode=#{statuscode},sa_auditman=#{name},sa_auditdate=#{format} where sa_id=#{id}