Browse Source

前端更改为亮健营销平台/企业微信更改外部联系人手机号,回调修改

Lgx 4 years ago
parent
commit
6d88f7a840

+ 1 - 1
UI/src/layouts/components/sider/Sider.js

@@ -46,7 +46,7 @@ class Silder extends React.Component {
         >
           <div className={styles.logo}>
             <Icon type="menu-fold" style={{ width: 14, height: 13, color: '#009fe9' }} />
-            会员中心
+            亮健营销平台
           </div>
           <div className={styles.nav}>
             <div className={styles.navTop}><Icon type="bars" style={{ fontSize: 20, color: '#fff', marginRight: '10px' }} /><span>功能导航</span></div>

+ 1 - 1
UI/src/pages/document.ejs

@@ -5,7 +5,7 @@
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
   <meta name="description" content="A admin dashboard application demo built upon Ant Design and Dva.js">
-  <title>会员中心</title>
+  <title>亮健营销平台</title>
   <!--[if lte IE 10]>
       <script
         src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,media-match/2.0.2/media.match.min.js"></script>

+ 1 - 1
UI/src/utils/config.js

@@ -7,7 +7,7 @@ const APIV4 = 'http://localhost:8005'
 const APIV3Auth = 'http://119.130.113.245:8030'
 const WXAPIV5= 'http://219.128.77.86:7000'
 module.exports =  {
-  name: '亮健会员系统管理',
+  name: '亮健营销平台',
   prefix: 'bird',
   footerText: 'bird admin  © 2018 360lj.com',
   logo: '/logo.svg',

+ 1 - 1
UI/src/utils/config2.js

@@ -7,7 +7,7 @@ const APIV4 = 'http://localhost:8005'
 const APIV3Auth = 'http://localhost:8030'
 const WXAPIV5= 'http://localhost:7000'
 module.exports =  {
-  name: '亮健会员系统管理',
+  name: '亮健营销平台',
   prefix: 'bird',
   footerText: 'bird admin  © 2018 360lj.com',
   logo: '/logo.svg',

+ 52 - 28
src/main/java/com/liangjiang11/wx/cp/controller/WxaAddContactController.java

@@ -95,23 +95,30 @@ public class WxaAddContactController {
 
                 //企业人信息
                 WxCpUser wxUser = wxCpService.getUserService().getById(inMessage.getUserId());
+                this.logger.info("\n消息 "+JsonUtils.toJson(exuser)+"--------"+JsonUtils.toJson(wxUser));
                 //添加好友回调add_external_contact
-                if(inMessage.getChangeType().equals("add_external_contact")){
+                if(inMessage.getChangeType().equals("edit_external_contact") &&exuser.getFollowedUsers()!=null&&exuser.getFollowedUsers().size()>0&& exuser.getFollowedUsers().get(0).getRemarkMobiles()!=null && exuser.getFollowedUsers().get(0).getRemarkMobiles().length>0){
+                    ExternalUser externalUser=externalUserService.getExternalByMobile2(inMessage.getExternalUserId());
+                    if(externalUser!=null&&externalUser.getId()!=null){
+                        externalUser.setRemark_mobiles(exuser.getFollowedUsers().get(0).getRemarkMobiles()[0]);
+                        externalUserService.updateExternalUserById(externalUser);
+                    }
+                }else if(inMessage.getChangeType().equals("add_external_contact")){
                     List<WxCpUserExternalContactInfo.FollowedUser> follList=exuser.getFollowedUsers();
-                    for (WxCpUserExternalContactInfo.FollowedUser foll:follList) {
-                        if(foll.getRemarkMobiles()!=null && foll.getRemarkMobiles().length>0){
+                    //for (WxCpUserExternalContactInfo.FollowedUser foll:follList) {
+                        if(follList.size()>0 && follList.get(0).getRemarkMobiles()!=null && follList.get(0).getRemarkMobiles().length>0){
                             //是否存在
-                            ExternalUser externalUser1 =externalUserService.getExternalCount(foll.getRemarkMobiles()[0]);
+                            ExternalUser externalUser1 =externalUserService.getExternalCount(follList.get(0).getRemarkMobiles()[0]);
                             if(externalUser1!=null && externalUser1.getId()!=null){
                                 if(!externalUser1.getCompany_name().equals(wxUser.getName())){
                                     externalUser1.setCompany_name(externalUser1.getCompany_name()+","+wxUser.getName());
-                                    externalUser1.setUserid(externalUser1.getUserid()+","+foll.getUserId());
+                                    externalUser1.setUserid(externalUser1.getUserid()+","+wxUser.getUserId());
                                 }
                                 externalUser1.setIs_delete(1);
                                 externalUserService.updateExternalUserById(externalUser1);
                                 //externalUserService.updateExternalUser(externalUser1);
                             }else{
-                                this.logger.info("已存在用户:",foll.getRemarkMobiles()[0]);
+                                this.logger.info("已存在用户:",follList.get(0).getRemarkMobiles()[0]);
                                 //保存用户信息
                                 ExternalUser externalUser=new ExternalUser();
                                 externalUser.setAvatar(exuser.getExternalContact().getAvatar());
@@ -119,9 +126,9 @@ public class WxaAddContactController {
                                 externalUser.setName(exuser.getExternalContact().getName());
                                 externalUser.setGender(String.valueOf(exuser.getExternalContact().getGender()));
                                 externalUser.setType(exuser.getExternalContact().getType());
-                                externalUser.setUserid(foll.getUserId());
+                                externalUser.setUserid(wxUser.getUserId());
                                 externalUser.setCreatetime(date);
-                                externalUser.setRemark_mobiles(foll.getRemarkMobiles()[0]);
+                                externalUser.setRemark_mobiles(follList.get(0).getRemarkMobiles()[0]);
 
                                 externalUser.setCompany_avatar(wxUser.getAvatar());
                                 externalUser.setCompany_gender(wxUser.getGender().getGenderName());
@@ -132,36 +139,53 @@ public class WxaAddContactController {
                                 externalUser.setUser_age(0);
                                 externalUserService.updateExternalUser(externalUser);
                             }
-                            this.logger.info("通过手机号查找的外部客户:",foll.getRemarkMobiles()[0]);
+                            this.logger.info("通过手机号查找的外部客户:",follList.get(0).getRemarkMobiles()[0]);
                         }else{
-                            ExternalUser externalUser=new ExternalUser();
-                            externalUser.setAvatar(exuser.getExternalContact().getAvatar());
-                            externalUser.setExternal_userid(exuser.getExternalContact().getExternalUserId());
-                            externalUser.setName(exuser.getExternalContact().getName());
-                            externalUser.setGender(String.valueOf(exuser.getExternalContact().getGender()));
-                            externalUser.setType(exuser.getExternalContact().getType());
-                            externalUser.setUserid(foll.getUserId());
-                            externalUser.setCreatetime(date);
-                            externalUser.setCompany_avatar(wxUser.getAvatar());
-                            externalUser.setCompany_gender(wxUser.getGender().getGenderName());
-                            externalUser.setCompany_mobiles(wxUser.getMobile());
-                            externalUser.setCompany_name(wxUser.getName());
-                            externalUser.setTermain_type("企业微信/其他加入方式");
-                            //企业微信未返回年龄,默认0
-                            externalUser.setUser_age(0);
-                            externalUserService.updateExternalUser(externalUser);
+                            ExternalUser externalUser1=externalUserService.getExternalByMobile2(inMessage.getExternalUserId());
+                            if(externalUser1!=null&&externalUser1.getId()!=null){
+                                if(!externalUser1.getCompany_name().equals(wxUser.getName())){
+                                    externalUser1.setCompany_name(externalUser1.getCompany_name()+","+wxUser.getName());
+                                    externalUser1.setUserid(externalUser1.getUserid()+","+wxUser.getUserId());
+                                }
+                                externalUser1.setIs_delete(1);
+                                externalUserService.updateExternalUserById(externalUser1);
+                            }else{
+                                ExternalUser externalUser=new ExternalUser();
+                                externalUser.setAvatar(exuser.getExternalContact().getAvatar());
+                                externalUser.setExternal_userid(exuser.getExternalContact().getExternalUserId());
+                                externalUser.setName(exuser.getExternalContact().getName());
+                                externalUser.setGender(String.valueOf(exuser.getExternalContact().getGender()));
+                                externalUser.setType(exuser.getExternalContact().getType());
+                                externalUser.setUserid(wxUser.getUserId());
+                                externalUser.setCreatetime(date);
+                                externalUser.setCompany_avatar(wxUser.getAvatar());
+                                externalUser.setCompany_gender(wxUser.getGender().getGenderName());
+                                externalUser.setCompany_mobiles(wxUser.getMobile());
+                                externalUser.setCompany_name(wxUser.getName());
+                                externalUser.setTermain_type("企业微信/其他加入方式");
+                                //企业微信未返回年龄,默认0
+                                externalUser.setUser_age(0);
+                                externalUserService.updateExternalUser(externalUser);
+                            }
+
                             this.logger.info("不是通过手机号查找的外部客户:",exuser.getExternalContact().getName());
                         }
-                    }
+                    //}
                 }else{//微信删除回调del_follow_user
                     List<WxCpUserExternalContactInfo.FollowedUser> follList=exuser.getFollowedUsers();
-                    String [] mobile=follList.get(0).getRemarkMobiles();
-                    if(mobile!=null&&mobile.length>0){
+                    if(follList.size()>0 && follList.get(0).getRemarkMobiles()!=null&&follList.get(0).getRemarkMobiles().length>0){
+                        String [] mobile=follList.get(0).getRemarkMobiles();
                         ExternalUser externalUser=externalUserService.getExternalByMobile(mobile[0]);
                         if(externalUser!=null&&externalUser.getId()!=null){
                             externalUser.setIs_delete(0);
                             externalUserService.updateExternalUserById(externalUser);
                         }
+                    }else{
+                        ExternalUser externalUser=externalUserService.getExternalByMobile2(inMessage.getExternalUserId());
+                        if(externalUser!=null&&externalUser.getId()!=null){
+                            externalUser.setIs_delete(0);
+                            externalUserService.updateExternalUserById(externalUser);
+                        }
                     }
                 }
             }

+ 1 - 1
src/main/java/com/liangjiang11/wx/cp/service/impl/ExternalUserService.java

@@ -81,7 +81,7 @@ public class ExternalUserService extends ServiceImpl<ExternalUserMapper, Externa
                     externalUser.setGender("女");
                 }
                 if (externalUser.getRemark_mobiles() == null || externalUser.getRemark_mobiles().isEmpty() || externalUser.getRemark_mobiles().length()<=10) {
-                    externalUser.setRemark_mobiles("***********");
+                    externalUser.setRemark_mobiles("--");
                 } else {
                     externalUser.setRemark_mobiles(externalUser.getRemark_mobiles().substring(0, 3) + "****" + externalUser.getRemark_mobiles().substring(7, externalUser.getRemark_mobiles().length()));
                 }