yansen 4 年前
父节点
当前提交
15691b3a39

+ 2
- 0
src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java 查看文件

241
 
241
 
242
     @TableField(exist = false)
242
     @TableField(exist = false)
243
     private String miniAppName;
243
     private String miniAppName;
244
+
245
+    private Boolean notShow;
244
 }
246
 }

+ 6
- 1
src/main/java/com/huiju/estateagents/common/CommConstant.java 查看文件

890
     /**
890
     /**
891
      * 人员类型---财务
891
      * 人员类型---财务
892
      */
892
      */
893
-    public static final String FINANCE = "finance";
893
+    public static final String CONTACT_FINANCE = "finance";
894
+
895
+    /**
896
+     * 人员类型---售前
897
+     */
898
+    public static final String CONTACT_PRESALE = "pre-sale";
894
 
899
 
895
     /**
900
     /**
896
      * 审核状态-审核中
901
      * 审核状态-审核中

+ 31
- 0
src/main/java/com/huiju/estateagents/common/SMSUtils.java 查看文件

1
 package com.huiju.estateagents.common;
1
 package com.huiju.estateagents.common;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3
 import com.huiju.estateagents.config.SMSProperties;
4
 import com.huiju.estateagents.config.SMSProperties;
5
+import com.huiju.estateagents.entity.SysSmsSetting;
6
+import com.huiju.estateagents.mapper.SysSmsSettingMapper;
4
 import lombok.Data;
7
 import lombok.Data;
5
 import lombok.extern.slf4j.Slf4j;
8
 import lombok.extern.slf4j.Slf4j;
6
 import org.springframework.beans.factory.annotation.Autowired;
9
 import org.springframework.beans.factory.annotation.Autowired;
21
 
24
 
22
     Hashtable<String, Phone> allPhones;
25
     Hashtable<String, Phone> allPhones;
23
 
26
 
27
+    @Autowired
28
+    SysSmsSettingMapper sysSmsSettingMapper;
29
+
24
     @Autowired
30
     @Autowired
25
     public SMSUtils(SMSProperties properties) {
31
     public SMSUtils(SMSProperties properties) {
26
         smsProperties = properties;
32
         smsProperties = properties;
125
         return true;
131
         return true;
126
     }
132
     }
127
 
133
 
134
+    public void sendMessage(String tel, List<String> params, String type) throws Exception {
135
+        if (StringUtils.isEmpty(tel) || StringUtils.isEmpty(type)) {
136
+            throw new Exception("短信发送失败: 没有手机号或者短信模板");
137
+        }
138
+
139
+        QueryWrapper<SysSmsSetting> query = new QueryWrapper<>();
140
+        query.eq("sms_type", type);
141
+        query.eq("status", CommConstant.STATUS_NORMAL);
142
+        query.last("limit 1");
143
+
144
+        SysSmsSetting smsSetting = sysSmsSettingMapper.selectOne(query);
145
+        if (null == smsSetting) {
146
+            throw new Exception("没有设置有效的【" + type + "】短信模板");
147
+        }
148
+
149
+        params.add("橙蕉"); // 短信签名
150
+        String[] paramArr = new String[params.size()];
151
+        params.toArray(paramArr);
152
+
153
+        boolean success = sendMessage(smsSetting.getTplCode(), tel, paramArr);
154
+        if (!success) {
155
+            throw new Exception("短信发送失败");
156
+        }
157
+    }
158
+
128
     @Data
159
     @Data
129
     public static class Phone {
160
     public static class Phone {
130
         String tel;
161
         String tel;

+ 2
- 5
src/main/java/com/huiju/estateagents/controller/TaOfficeContactController.java 查看文件

5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.huiju.estateagents.base.BaseController;
6
 import com.huiju.estateagents.base.BaseController;
7
 import com.huiju.estateagents.base.ResponseBean;
7
 import com.huiju.estateagents.base.ResponseBean;
8
-import com.huiju.estateagents.common.CommConstant;
9
-import com.huiju.estateagents.common.DBUtils;
10
-import com.huiju.estateagents.common.DateUtils;
11
-import com.huiju.estateagents.common.StringUtils;
8
+import com.huiju.estateagents.common.*;
12
 import com.huiju.estateagents.entity.TaOfficeContact;
9
 import com.huiju.estateagents.entity.TaOfficeContact;
13
 import com.huiju.estateagents.service.ITaOfficeContactService;
10
 import com.huiju.estateagents.service.ITaOfficeContactService;
14
 import org.slf4j.Logger;
11
 import org.slf4j.Logger;
40
     @Autowired
37
     @Autowired
41
     public DBUtils dbUtils;
38
     public DBUtils dbUtils;
42
 
39
 
43
-
44
     /**
40
     /**
45
      * 分页查询列表
41
      * 分页查询列表
46
      * @param pageNum
42
      * @param pageNum
94
             taOfficeContact.setStatus(2);   // 待跟进
90
             taOfficeContact.setStatus(2);   // 待跟进
95
             if (iTaOfficeContactService.save(taOfficeContact)){
91
             if (iTaOfficeContactService.save(taOfficeContact)){
96
                 responseBean.addSuccess(taOfficeContact);
92
                 responseBean.addSuccess(taOfficeContact);
93
+                iTaOfficeContactService.sendNotice(taOfficeContact);
97
             }else {
94
             }else {
98
                 responseBean.addError("fail");
95
                 responseBean.addError("fail");
99
             }
96
             }

+ 1
- 1
src/main/java/com/huiju/estateagents/redpack/service/impl/TaOrgAccountServiceImpl.java 查看文件

424
     @Override
424
     @Override
425
     public List<TaContact> selectSmsContactUser(){
425
     public List<TaContact> selectSmsContactUser(){
426
         QueryWrapper<TaContact> taContactQueryWrapper = new QueryWrapper<>();
426
         QueryWrapper<TaContact> taContactQueryWrapper = new QueryWrapper<>();
427
-        taContactQueryWrapper.eq("contact_Type", CommConstant.FINANCE);
427
+        taContactQueryWrapper.eq("contact_Type", CommConstant.CONTACT_FINANCE);
428
         taContactQueryWrapper.ne("status", CommConstant.STATUS_DELETE);
428
         taContactQueryWrapper.ne("status", CommConstant.STATUS_DELETE);
429
         List<TaContact> taContacts = taContactMapper.selectList(taContactQueryWrapper);
429
         List<TaContact> taContacts = taContactMapper.selectList(taContactQueryWrapper);
430
         return taContacts;
430
         return taContacts;

+ 2
- 2
src/main/java/com/huiju/estateagents/sample/controller/TaContactController.java 查看文件

249
             queryWrapper.like(!StringUtils.isEmpty(telephone), "telephone", telephone);
249
             queryWrapper.like(!StringUtils.isEmpty(telephone), "telephone", telephone);
250
             queryWrapper.like(!StringUtils.isEmpty(phone), "phone", phone);
250
             queryWrapper.like(!StringUtils.isEmpty(phone), "phone", phone);
251
             queryWrapper.like(!StringUtils.isEmpty(job), "job", job);
251
             queryWrapper.like(!StringUtils.isEmpty(job), "job", job);
252
-            queryWrapper.like("contact_type", CommConstant.FINANCE);
252
+            queryWrapper.like("contact_type", CommConstant.CONTACT_FINANCE);
253
             queryWrapper.ne("status", CommConstant.STATUS_DELETE);
253
             queryWrapper.ne("status", CommConstant.STATUS_DELETE);
254
             queryWrapper.orderByDesc("order_no", "create_date");
254
             queryWrapper.orderByDesc("order_no", "create_date");
255
 
255
 
275
         try {
275
         try {
276
             TaContact taContact = new TaContact();
276
             TaContact taContact = new TaContact();
277
             taContact.setContactId(id);
277
             taContact.setContactId(id);
278
-            taContact.setContactType(CommConstant.FINANCE);
278
+            taContact.setContactType(CommConstant.CONTACT_FINANCE);
279
             if (!StringUtils.isEmpty(contact.getOrderNo())){
279
             if (!StringUtils.isEmpty(contact.getOrderNo())){
280
                 taContact.setOrderNo(contact.getOrderNo());
280
                 taContact.setOrderNo(contact.getOrderNo());
281
             }
281
             }

+ 1
- 0
src/main/java/com/huiju/estateagents/service/ITaOfficeContactService.java 查看文件

13
  */
13
  */
14
 public interface ITaOfficeContactService extends IService<TaOfficeContact> {
14
 public interface ITaOfficeContactService extends IService<TaOfficeContact> {
15
 
15
 
16
+    void sendNotice(TaOfficeContact taOfficeContact);
16
 }
17
 }

+ 40
- 0
src/main/java/com/huiju/estateagents/service/impl/TaOfficeContactServiceImpl.java 查看文件

1
 package com.huiju.estateagents.service.impl;
1
 package com.huiju.estateagents.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.huiju.estateagents.common.CommConstant;
5
+import com.huiju.estateagents.common.SMSUtils;
6
+import com.huiju.estateagents.common.StringUtils;
3
 import com.huiju.estateagents.entity.TaOfficeContact;
7
 import com.huiju.estateagents.entity.TaOfficeContact;
4
 import com.huiju.estateagents.mapper.TaOfficeContactMapper;
8
 import com.huiju.estateagents.mapper.TaOfficeContactMapper;
9
+import com.huiju.estateagents.sample.entity.TaContact;
10
+import com.huiju.estateagents.sample.mapper.TaContactMapper;
5
 import com.huiju.estateagents.service.ITaOfficeContactService;
11
 import com.huiju.estateagents.service.ITaOfficeContactService;
6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
12
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
13
+import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
14
 import org.springframework.stereotype.Service;
8
 
15
 
16
+import java.util.ArrayList;
17
+import java.util.List;
18
+
9
 /**
19
 /**
10
  * <p>
20
  * <p>
11
  * 联系咨询  服务实现类
21
  * 联系咨询  服务实现类
17
 @Service
27
 @Service
18
 public class TaOfficeContactServiceImpl extends ServiceImpl<TaOfficeContactMapper, TaOfficeContact> implements ITaOfficeContactService {
28
 public class TaOfficeContactServiceImpl extends ServiceImpl<TaOfficeContactMapper, TaOfficeContact> implements ITaOfficeContactService {
19
 
29
 
30
+    @Autowired
31
+    public SMSUtils smsUtils;
32
+
33
+    @Autowired
34
+    TaContactMapper taContactMapper;
35
+
36
+    @Override
37
+    public void sendNotice(TaOfficeContact taOfficeContact) {
38
+        List<String> params = new ArrayList<String>(){{
39
+            add(taOfficeContact.getName());
40
+            add(taOfficeContact.getPhone());
41
+            add(taOfficeContact.getCompany());
42
+        }};
43
+
44
+        QueryWrapper<TaContact> query = new QueryWrapper<>();
45
+        query.eq("contact_type", CommConstant.CONTACT_PRESALE);
46
+        query.eq("status", CommConstant.STATUS_NORMAL);
47
+
48
+        List<TaContact> taContacts = taContactMapper.selectList(query);
49
+        for (TaContact taContact : taContacts) {
50
+            String phone = taContact.getPhone();
51
+            if (!StringUtils.isEmpty(phone)) {
52
+                try {
53
+                    smsUtils.sendMessage(phone, params, "office-promotion");
54
+                } catch (Exception e) {
55
+                    e.printStackTrace();
56
+                }
57
+            }
58
+        }
59
+    }
20
 }
60
 }

+ 1
- 1
src/main/resources/mapper/TaUserMapper.xml 查看文件

30
             left join ta_channel_app_relation n on o.org_id = n.org_id
30
             left join ta_channel_app_relation n on o.org_id = n.org_id
31
             left join ta_channel_proxy z on z.channel_id = n.channel_id
31
             left join ta_channel_proxy z on z.channel_id = n.channel_id
32
         WHERE
32
         WHERE
33
-            t.is_admin =1
33
+            t.is_admin =1 AND ifnull(t.not_show, 0) != 1
34
             <if test="channelId != null and channelId != ''">
34
             <if test="channelId != null and channelId != ''">
35
                 and n.channel_id = #{channelId}
35
                 and n.channel_id = #{channelId}
36
             </if>
36
             </if>