Răsfoiți Sursa

邮件修正

YPZ 4 săptămâni în urmă
părinte
comite
df1afa6f91

+ 38 - 47
java/storlead-sasa/storlead-trade/src/main/java/com/storlead/trade/service/impl/MarketingCampaignSopDetailServiceImpl.java

@@ -84,45 +84,24 @@ public class MarketingCampaignSopDetailServiceImpl
 
 
 //        List<CustomerEntity> customerEntityList = customerService.listByIds(customerIdList);
-        //查询本地信息
-        String yourName = "";
-        String companyName = "";
-        String yourTitle = "";
-        String yourCompany = "";
-        String yourPhone = "";
-        String yourEmail = "";
-        String fullCompanyAddress = "";
-        List<SysDictDetailResponseDTO> sysDictDetailResponseDTOList = sysDictService.getListByCode("company_base");
-        if (!CollectionUtils.isEmpty(sysDictDetailResponseDTOList)){
-            //取label为本地信息的value值
-            for (SysDictDetailResponseDTO sysDictDetailResponseDTO : sysDictDetailResponseDTOList) {
-                if ("yourName".equals(sysDictDetailResponseDTO.getLabel())) {
-                    yourName = sysDictDetailResponseDTO.getValue();
-                }if ("companyName".equals(sysDictDetailResponseDTO.getLabel())) {
-                    companyName = sysDictDetailResponseDTO.getValue();
-                }
-                if ("yourTitle".equals(sysDictDetailResponseDTO.getLabel())) {
-                    yourTitle = sysDictDetailResponseDTO.getValue();
-                }
-                if ("yourCompany".equals(sysDictDetailResponseDTO.getLabel())) {
-                    yourTitle = sysDictDetailResponseDTO.getValue();
-                }
-                if ("yourPhone".equals(sysDictDetailResponseDTO.getLabel())) {
-                    yourPhone = sysDictDetailResponseDTO.getValue();
-                }
-                if ("yourEmail".equals(sysDictDetailResponseDTO.getLabel())) {
-                    yourEmail = sysDictDetailResponseDTO.getValue();
-                }
-                if ("fullCompanyAddress".equals(sysDictDetailResponseDTO.getLabel())) {
-                    fullCompanyAddress = sysDictDetailResponseDTO.getValue();
-                }
-            }
 
-        }
 
 
         Map<Long,CustomerVO> customerEntityMap = customerVOList.stream().collect(Collectors.toMap(CustomerVO::getId, customerVO -> customerVO));
         for (MarketEmailsEntity marketEmailsEntity : marketEmailsEntityList) {
+            //查询客户信息
+//            客户名称:${customerName}$
+//            区域名称:${areaName}$
+//            企业名称:${companyName}$
+//            企业网址:${companyUrl}$
+//            联系人名称:${liaisonName}$
+//            联系人邮箱:${email}$
+            String customerName = "";
+            String areaName = "";
+            String companyName = "";
+            String companyUrl = "";
+            String liaisonName = "";
+            String email = "";
             marketEmailsEntity.setSubject(emailSubject);
             marketEmailsEntity.setStatus(-1);
             CustomerVO customerEntity = customerEntityMap.get(marketEmailsEntity.getCustomerId());
@@ -130,22 +109,34 @@ public class MarketingCampaignSopDetailServiceImpl
                 if (ObjectUtils.isEmpty(customerEntity.getCustomerCompany())) {
                     customerEntity.setCustomerCompany(new CustomerCompanyEntity());
                 }
+                if (ObjectUtils.isEmpty(customerEntity.getLiaison())) {
+                    customerEntity.setLiaison(new LiaisonEntity());
+                }
+                if (!ObjectUtils.isEmpty(customerEntity.getCustomerName())) {
+                    customerName = customerEntity.getCustomerName();
+                }
+                if (!ObjectUtils.isEmpty(customerEntity.getCountry())) {
+                    areaName = customerEntity.getCountry();
+                }
+                if (!ObjectUtils.isEmpty(customerEntity.getCustomerCompany().getName())){
+                    companyName = customerEntity.getCustomerCompany().getName();
+                }
 
-//                ${areaName}$、${customerIndustry}$
-                //修改emailContent中全部的${customerName}$为customerEntity.getCustomerName()
-                String industry = "";
-                if (!ObjectUtils.isEmpty(customerEntity.getCustomerCompany().getIndustry())){
-                    industry = customerEntity.getCustomerCompany().getIndustry();
+                if (!ObjectUtils.isEmpty(customerEntity.getCustomerCompany().getWebsite())){
+                    companyUrl = customerEntity.getCustomerCompany().getWebsite();
+                }
+                if (!ObjectUtils.isEmpty(customerEntity.getLiaison().getName())){
+                    liaisonName = customerEntity.getLiaison().getName();
+                }
+                if (!ObjectUtils.isEmpty(customerEntity.getLiaison().getEmail())){
+                    email = customerEntity.getLiaison().getEmail();
                 }
                 emailContent = emailContent.replace("${customerName}$", companyName)
-                        .replace("${areaName}$", customerEntity.getCountry())
-                        .replace("${customerIndustry}$", industry)
-                        .replace("${yourName}$", yourName)
-                        .replace("${yourTitle}$", yourTitle)
-                        .replace("${yourCompany}$", yourCompany)
-                        .replace("${yourPhone}$", yourPhone)
-                        .replace("${yourEmail}$", yourEmail)
-                        .replace("${fullCompanyAddress}$", fullCompanyAddress);
+                        .replace("${areaName}$", areaName)
+                        .replace("${companyName}$", companyName)
+                        .replace("${companyUrl}$", companyUrl)
+                        .replace("${liaisonName}$", liaisonName)
+                        .replace("${email}$", email);
                 marketEmailsEntity.setContent(emailContent);
             }
             if (!ObjectUtils.isEmpty(marketEmailsEntity.getCustomerId()) && !ObjectUtils.isEmpty(customerEntityMap.get(marketEmailsEntity.getCustomerId()).getCustomerCompany()) && !ObjectUtils.isEmpty(customerEntityMap.get(marketEmailsEntity.getCustomerId()).getCustomerCompany().getEmail())){