Browse Source

导出模版,导入线索客户修改

anderx 1 year ago
parent
commit
a3898a4781

+ 10 - 0
src/main/java/com/goafanti/customer/bo/InputUserClueBo.java

@@ -7,6 +7,15 @@ public class InputUserClueBo {
     private String contacts;
 
     private String contactMobile;
+    private String contactMobileMore;
+
+    public String getContactMobileMore() {
+        return contactMobileMore;
+    }
+
+    public void setContactMobileMore(String contactMobileMore) {
+        this.contactMobileMore = contactMobileMore;
+    }
 
     public String getUserName() {
         return userName;
@@ -31,4 +40,5 @@ public class InputUserClueBo {
     public void setContactMobile(String contactMobile) {
         this.contactMobile = contactMobile;
     }
+
 }

+ 12 - 2
src/main/java/com/goafanti/customer/bo/OutUserClueExcel.java

@@ -6,14 +6,24 @@ public class OutUserClueExcel {
     private String id;
     @Excel(name = "客户名称")
     private String nickname;
-    @Excel(name = "联系人")
+    @Excel(name = "联系人(无联系人,填未知)")
     private String contacts;
-    @Excel(name = "联系人手机号")
+    @Excel(name = "电话")
     private String contactMobile;
+    @Excel(name = "更多电话(电话之间用;号隔开)")
+    private String contactMobileMore;
     private String adminName;
     private String clueProcess;
     private String clueTime;
 
+    public String getContactMobileMore() {
+        return contactMobileMore;
+    }
+
+    public void setContactMobileMore(String contactMobileMore) {
+        this.contactMobileMore = contactMobileMore;
+    }
+
     public String getId() {
         return id;
     }

+ 31 - 3
src/main/java/com/goafanti/customer/service/impl/UserClueServiceImpl.java

@@ -7,6 +7,7 @@ import com.goafanti.common.enums.UserLevel;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.*;
 import com.goafanti.common.utils.PasswordUtil;
+import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
@@ -16,6 +17,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.time.temporal.ChronoUnit;
 import java.util.*;
 import java.util.regex.Matcher;
@@ -65,7 +67,7 @@ public class UserClueServiceImpl extends BaseMybatisDao<UserMapper> implements U
         LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
         LocalDateTime clueTime = null;
         for (OutUserClueList e : list) {
-             clueTime=e.getClueTransferTime().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDateTime();
+             clueTime=e.getClueTransferTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
             clueTime = clueTime.withHour(0).withMinute(0).withSecond(0).plusDays(15);
             long between = ChronoUnit.DAYS.between(now,clueTime);
             e.setDays((int) between);
@@ -133,6 +135,12 @@ public class UserClueServiceImpl extends BaseMybatisDao<UserMapper> implements U
         un.setName(user.getNickname());
         userNamesMapper.insertSelective(un);
         // 新增企业联系人
+        iterContactBook(in,aname,uid);
+        addUserTransferLog(user,22,null);
+        return 1;
+    }
+
+    private void iterContactBook(InputUserClueBo in, String aname, String uid) {
         OrganizationContactBook cob = new OrganizationContactBook();
         cob.setAid(TokenManager.getAdminId());
         cob.setAname(aname);
@@ -142,8 +150,27 @@ public class UserClueServiceImpl extends BaseMybatisDao<UserMapper> implements U
         cob.setMobile(in.getContactMobile());
         cob.setMajor(AFTConstants.YES);
         organizationContactBookMapper.insert(cob);
-        addUserTransferLog(user,22,null);
-        return 1;
+        if (StringUtils.isNotBlank(in.getContactMobileMore())){
+            String[] split = null;
+            if (in.getContactMobileMore().contains(";")){
+                split = in.getContactMobileMore().split(";");
+            } else if (in.getContactMobileMore().contains(";")) {
+                split = in.getContactMobileMore().split(";");
+            }
+            for (String s : split) {
+                if (StringUtils.isNotBlank(s)) {
+                    OrganizationContactBook cob2 = new OrganizationContactBook();
+                    cob2.setAid(TokenManager.getAdminId());
+                    cob2.setAname(aname);
+                    cob2.setId(UUID.randomUUID().toString());
+                    cob2.setUid(uid);
+                    cob2.setName(in.getContacts());
+                    cob2.setMobile(s);
+                    cob2.setMajor(AFTConstants.NO);
+                    organizationContactBookMapper.insert(cob2);
+                }
+            }
+        }
     }
 
     @Override
@@ -165,6 +192,7 @@ public class UserClueServiceImpl extends BaseMybatisDao<UserMapper> implements U
             inUserClueBo.setUserName(e.getNickname());
             inUserClueBo.setContactMobile(e.getContactMobile());
             inUserClueBo.setContacts(e.getContacts());
+            inUserClueBo.setContactMobileMore(e.getContactMobileMore());
             try {
                 add(inUserClueBo);
             }catch (Exception ex){