Browse Source

bug修改

24282 2 years ago
parent
commit
df98540482

+ 3 - 2
bladex-saas-project/new-mail/src/main/java/com/fjhx/service/impl/CoreServiceImpl.java

@@ -232,7 +232,8 @@ public class CoreServiceImpl implements ApplicationRunner {
             }
 
         } catch (Exception e) {
-            log.error("邮件同步出错,邮箱信息:{}", JSON.toJSONString(mailbox), e);
+            log.error("邮件同步出错,邮箱信息:{}", JSON.toJSONString(mailbox));
+            e.printStackTrace();
         } finally {
             if (store != null) {
                 try {
@@ -303,7 +304,7 @@ public class CoreServiceImpl implements ApplicationRunner {
 
             // 保存发件人信息
             Address[] addresses = message.getFrom();
-            if (addresses.length > 0) {
+            if (addresses != null && addresses.length > 0) {
                 InternetAddress internetAddress = (InternetAddress) addresses[0];
                 mailInfo.setFromEmail(internetAddress.getAddress());
                 mailInfo.setFromPersonalName(internetAddress.getPersonal());

+ 1 - 1
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/contract/mapper/ContractMapper.xml

@@ -909,7 +909,7 @@
     <!-- 根据子编号前缀代码统计 -->
     <select id="getCount" resultType="java.lang.Integer">
         select
-            count(DISTINCT t1.`code`) count
+            count(t1.`code`) count
         from
             t_erp_contract t1
         <where>

+ 11 - 12
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/contract/service/impl/ContractFlowServiceImplV2.java

@@ -37,7 +37,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.text.SimpleDateFormat;
-import java.time.LocalDate;
 import java.util.Date;
 import java.util.Optional;
 
@@ -158,23 +157,23 @@ public class ContractFlowServiceImplV2 implements IContractFlowServiceV2 {
                 entity.setProcessInstanceUserName(null);
             }
 
-            //初始化业务数据ID
+            // 初始化业务数据ID
             String uuid = IdUtils.fastSimpleUUID();
             if (StringUtils.isNotBlank(entity.getId())) {
                 uuid = entity.getId();
             }
 
-            //获取编码
-            if (StringUtils.isBlank(entity.getCode())) {
-                String customerId = entity.getCustomerId();
-                String productId = entity.getProducts().get(0).getProductId();
-                String countryId = entity.getCustomerCountryId();
-                String code = CodeRuleUtil.getCode(CodeRuleTypeEnum.CODE_RULE_TYPE_3.getKey(), customerId, productId, countryId);
-                if (StringUtils.isBlank(code)) {
-                    throw new ServiceException("获取外销合同编码异常。");
-                }
-                entity.setCode(code);
+            // 获取编码
+            // if (StringUtils.isBlank(entity.getCode())) {
+            String customerId = entity.getCustomerId();
+            String productId = entity.getProducts().get(0).getProductId();
+            String countryId = entity.getCustomerCountryId();
+            String code = CodeRuleUtil.getCode(CodeRuleTypeEnum.CODE_RULE_TYPE_3.getKey(), customerId, productId, countryId);
+            if (StringUtils.isBlank(code)) {
+                throw new ServiceException("获取外销合同编码异常。");
             }
+            entity.setCode(code);
+            // }
 
             //流程标题
             String title = AuthUtil.getUserName() + " 在" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "发起了 外销合同审批流程(单号" + entity.getCode() + ")";

+ 19 - 1
bladex-saas-project/saas-business-tradeerp/src/main/java/com/fjhx/utils/CodeRuleUtil.java

@@ -1,7 +1,9 @@
 package com.fjhx.utils;
 
+import cn.hutool.core.convert.Convert;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fjhx.city.entity.City;
 import com.fjhx.city.feign.ICityApi;
 import com.fjhx.coderule.entity.CodeRule;
@@ -9,6 +11,7 @@ import com.fjhx.coderule.enums.CodeRuleEnum;
 import com.fjhx.coderule.enums.CodeRuleTypeEnum;
 import com.fjhx.coderule.feign.ICodeRuleApi;
 import com.fjhx.contract.constant.ContractConstant;
+import com.fjhx.contract.entity.Contract;
 import com.fjhx.contract.service.IContractService;
 import com.fjhx.customer.cm.entity.Customer;
 import com.fjhx.customer.feign.ICustomerApi;
@@ -165,7 +168,22 @@ public class CodeRuleUtil {
                 }
                 //外销合同编码
                 if (codeRuleType == CodeRuleTypeEnum.CODE_RULE_TYPE_3.getKey()) {
-                    count = iContractService.getCount(prefixCode, countryId, customerId, productId, ContractConstant.DataType.CONTRACT);
+
+                    if (AuthUtil.getTenantId().equals("EHSD")) {
+
+                        Contract contract = iContractService.getOne(Wrappers.<Contract>lambdaQuery()
+                                .eq(Contract::getTenantId, AuthUtil.getTenantId())
+                                .likeRight(Contract::getCode, "EHSD23")
+                                .orderByDesc(Contract::getCode)
+                                .last("limit 1")
+                        );
+
+                        count = Convert.toInt(contract.getCode().replace("EHSD23", ""));
+
+                    } else {
+                        count = iContractService.getCount(prefixCode, countryId, customerId, productId, ContractConstant.DataType.CONTRACT);
+                    }
+
                 }
                 //采购合同编码
                 if (codeRuleType == CodeRuleTypeEnum.CODE_RULE_TYPE_4.getKey()) {