Browse Source

修复搜索时间/导入时间/回调删除状态

Lgx 4 years ago
parent
commit
80c349c5dc

+ 74 - 0
UI/src/pages/externalWechat/externalCleanMobile.js

@@ -0,0 +1,74 @@
+import React from 'react';
+import { BirdGrid } from 'components/Grid';
+import { config,util } from 'utils'
+import { connect } from 'dva';
+const { WXAPIV5 } = config
+import {Modal,
+  Row,
+  Col,
+  Button,
+  Icon,
+  Upload
+} from 'antd';
+class tag_setting extends React.Component {
+  constructor(props) {
+    super(props)
+
+    this.state = {
+      formConfirmLoading:false,
+      formVisiable:false,
+      formVisiable2:false,
+      getdDisdatas:[],
+      fileName:"",
+      fileName2:""
+    }
+  }
+
+  cancelClick2(){
+    this.setState({
+      formVisiable2:false
+    })
+  }
+  excelonChange2(e){
+    if(e.file!=null && e.file.response!=null){
+        this.setState({
+          fileName2:e.file.response
+        })
+    }
+  }
+  okClick2(){
+    var fileName=this.state.fileName2;
+    if(fileName!=null&&fileName!=""){
+      window.location.href=WXAPIV5+"/api/excel/downloadTemplate?fileName="+fileName;
+    }
+  }
+  getExcelTemp(){
+    window.location.href=WXAPIV5+"/api/excel/exportExcel"
+  }
+  getExcelTemp2(){
+    window.location.href=WXAPIV5+"/api/excel/exportMobileExcel"
+  }
+  render() {
+    let user=util.auth.getUser();
+    let self = this;
+    return <div style={{width:"80%",marginLeft:"10%"}}>
+                  <div style={{color:"red",margin:"20px 0px"}}>下载企业微信自动程序>><span style={{color:"blue"}}>点击下载</span></div>
+                  <Row>
+                    <Col>
+                    {<Upload.Dragger name="files" action={WXAPIV5+"/api/excel/readMobileExcel?name="+user.userName} onChange={self.excelonChange2.bind(self)}>
+                    <p className="ant-upload-drag-icon">
+                      <Icon type="inbox" />
+                    </p>
+                    <p className="ant-upload-text">添加需要添加好友的手机号列表,参考下方excel模板</p>
+                  </Upload.Dragger>}
+                  <div style={{margin:"20px 35%"}}>
+                  <Button onClick={self.getExcelTemp2.bind(self)} style={{color:"#fff",fontWeight:"bold",background:"#1E90FF"}} className="ant-upload-text">下载导入模板</Button>
+                  <Button onClick={self.okClick2.bind(self)} style={{color:"#fff",fontWeight:"bold",background:"red",marginLeft:"50px"}} className="ant-upload-text">下载结果</Button>
+                  </div>
+                    </Col>
+                </Row>
+
+           </div>
+  }
+}
+export default connect( ( { bindActionCreators } ) => ( { bindActionCreators } ) )( tag_setting );

+ 2 - 11
UI/src/pages/externalWechat/externalUserList.js

@@ -90,19 +90,10 @@ class tag_setting extends React.Component {
       actions: [
       {
         name: '数据导入(多谋/艾客)',          
-        color: 'bule',
-        onClick: (data) => {
-          self.setState({
-            formVisiable:true
-          })
-        }
-      },
-      {
-        name: '数据去重',          
         color: 'red',
         onClick: (data) => {
           self.setState({
-            formVisiable2:true
+            formVisiable:true
           })
         }
       }
@@ -114,7 +105,7 @@ class tag_setting extends React.Component {
         { title: "年龄", data: "user_age",  type: "text", editor: {},query:true },
         { title: "手机", data: "remark_mobiles", type: "text",  editor: {},query:true},
         { title: "添加时间", data: "crTime", type: "text", editor: {},query:false},
-        { title: "添加时间", data: "createtime", type: "date", editor: {},query:true,hide:true},
+        { title: "添加时间", data: "createtime", type: "datetime", editor: {},query:true,hide:true},
         { title: "到达", data: "termain_type", type: "text",  editor: {},query:true},
         { title: "企业好友", data: "company_name", type: "text",  editor: {},query:true},
         { title: "状态", data: "is_delete", type: "dropdown", editor: {},source: { data:database },query:true}

+ 3 - 3
src/main/java/com/liangjiang11/wx/cp/controller/ExternalUserController.java

@@ -72,7 +72,7 @@ public class ExternalUserController {
             //获取登陆信息
 
             for (ExternalUserExcel userExcel:list){
-                userExcel.setCreatetime(sdf.format(new Date()));
+                //userExcel.setCreatetime(sdf.format(new Date()));
                 int count=externalUserService.getExternalCount(userExcel.getUserMobile());
                 if(count>0){
                     userExcel.setRescode("手机号已存在");
@@ -85,8 +85,8 @@ public class ExternalUserController {
                     externalUser.setName(userExcel.getUserName());
                     externalUser.setRemark_mobiles(userExcel.getUserMobile());
                     externalUser.setGender(userExcel.getGender());
-                    //Date d1=sdf.parse(userExcel.getCreatetime());
-                    externalUser.setCreatetime(new Date());
+                    Date d1=sdf.parse(userExcel.getCreatetime());
+                    externalUser.setCreatetime(d1);
 
                     //导入人
                     externalUser.setCompany_mobiles(name);

+ 9 - 1
src/main/java/com/liangjiang11/wx/cp/controller/WxaAddContactController.java

@@ -114,7 +114,15 @@ public class WxaAddContactController {
                     }
                 }
             }else{//删除好友回调del_follow_user
-
+                List<WxCpUserExternalContactInfo.FollowedUser> follList=exuser.getFollowedUsers();
+                String [] mobile=follList.get(0).getRemarkMobiles();
+                if(mobile!=null&&mobile.length>0){
+                    ExternalUser externalUser=externalUserService.getExternalByMobile(mobile[0]);
+                    if(externalUser!=null&&externalUser.getId()!=null){
+                        externalUser.setIs_delete(0);
+                        externalUserService.updateExternalUserById(externalUser);
+                    }
+                }
             }
         } catch (WxErrorException e) {
             e.printStackTrace();

+ 3 - 0
src/main/java/com/liangjiang11/wx/cp/dao/foo/ExternalUserMapper.java

@@ -23,4 +23,7 @@ public interface ExternalUserMapper extends BaseMapper<ExternalUser> {
     int queryExternalCount(@Param("sqlStr")String sqlStr);
 
     int InsertExternalUser(@Param("externalUser") ExternalUser externalUser);
+
+    @Select("SELECT top 1 * FROM external_user where is_delete=1 and remark_mobiles= #{mobile}")
+    ExternalUser getExternalUserByMobile(@Param("mobile")String mobile);
 }

+ 2 - 0
src/main/java/com/liangjiang11/wx/cp/service/IExternalUserService.java

@@ -12,4 +12,6 @@ public interface IExternalUserService extends IService<ExternalUser> {
      Integer updateExternalUser(ExternalUser externalUser);
      Integer getExternalCount(String mobile);
      Map<String,Object> queryExternalList(FiltersData data);
+     Integer updateExternalUserById(ExternalUser externalUser);
+     ExternalUser getExternalByMobile(String mobile);
 }

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

@@ -37,11 +37,21 @@ public class ExternalUserService extends ServiceImpl<ExternalUserMapper, Externa
         //return  this.baseMapper.InsertExternalUser(externalUser);
     }
 
+    @Override
+    public Integer updateExternalUserById(ExternalUser externalUser) {
+        return baseMapper.updateById(externalUser);
+        //return  this.baseMapper.InsertExternalUser(externalUser);
+    }
     @Override
     public Integer getExternalCount(String mobile) {
         return this.baseMapper.getExternalUserCount(mobile);
     }
 
+    @Override
+    public ExternalUser getExternalByMobile(String mobile) {
+        return this.baseMapper.getExternalUserByMobile(mobile);
+    }
+
     @Override
     public Map<String,Object> queryExternalList(FiltersData data) {
         SimpleDateFormat sdf =   new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");