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

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

@@ -241,4 +241,6 @@ public class TaUser implements Serializable {
241 241
 
242 242
     @TableField(exist = false)
243 243
     private String miniAppName;
244
+
245
+    private Boolean notShow;
244 246
 }

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

@@ -890,7 +890,12 @@ public class CommConstant {
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,6 +1,9 @@
1 1
 package com.huiju.estateagents.common;
2 2
 
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 4
 import com.huiju.estateagents.config.SMSProperties;
5
+import com.huiju.estateagents.entity.SysSmsSetting;
6
+import com.huiju.estateagents.mapper.SysSmsSettingMapper;
4 7
 import lombok.Data;
5 8
 import lombok.extern.slf4j.Slf4j;
6 9
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +24,9 @@ public class SMSUtils {
21 24
 
22 25
     Hashtable<String, Phone> allPhones;
23 26
 
27
+    @Autowired
28
+    SysSmsSettingMapper sysSmsSettingMapper;
29
+
24 30
     @Autowired
25 31
     public SMSUtils(SMSProperties properties) {
26 32
         smsProperties = properties;
@@ -125,6 +131,31 @@ public class SMSUtils {
125 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 159
     @Data
129 160
     public static class Phone {
130 161
         String tel;

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

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

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

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

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

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

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

@@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 13
  */
14 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,11 +1,21 @@
1 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 7
 import com.huiju.estateagents.entity.TaOfficeContact;
4 8
 import com.huiju.estateagents.mapper.TaOfficeContactMapper;
9
+import com.huiju.estateagents.sample.entity.TaContact;
10
+import com.huiju.estateagents.sample.mapper.TaContactMapper;
5 11
 import com.huiju.estateagents.service.ITaOfficeContactService;
6 12
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
13
+import org.springframework.beans.factory.annotation.Autowired;
7 14
 import org.springframework.stereotype.Service;
8 15
 
16
+import java.util.ArrayList;
17
+import java.util.List;
18
+
9 19
 /**
10 20
  * <p>
11 21
  * 联系咨询  服务实现类
@@ -17,4 +27,34 @@ import org.springframework.stereotype.Service;
17 27
 @Service
18 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,7 +30,7 @@
30 30
             left join ta_channel_app_relation n on o.org_id = n.org_id
31 31
             left join ta_channel_proxy z on z.channel_id = n.channel_id
32 32
         WHERE
33
-            t.is_admin =1
33
+            t.is_admin =1 AND ifnull(t.not_show, 0) != 1
34 34
             <if test="channelId != null and channelId != ''">
35 35
                 and n.channel_id = #{channelId}
36 36
             </if>