From e1d90b795afd1d5eb44d56014c26f3d457dc3fc5 Mon Sep 17 00:00:00 2001 From: "kuang.yife" Date: Sat, 29 Jul 2023 10:48:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BF=AE=E5=A4=8D/=E7=9F=AD?= =?UTF-8?q?=E4=BF=A1=E9=AA=8C=E8=AF=81/=E5=9B=9E=E8=B0=83=E6=96=B0?= =?UTF-8?q?=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/ClewPhoneController.java | 127 ++++++++++++++++++ .../web/controller/tool/NoticeController.java | 85 +++++++++++- .../src/main/resources/application.yml | 5 + .../resources/templates/system/clew/clew.html | 54 ++++---- .../resources/templates/system/phone/add.html | 37 +++++ .../templates/system/phone/edit.html | 38 ++++++ .../templates/system/phone/phone.html | 94 +++++++++++++ .../com/ruoyi/common/config/BaiduConfig.java | 32 +++++ .../com/ruoyi/system/domain/ClewPhone.java | 56 ++++++++ .../com/ruoyi/system/domain/OppoCheck.java | 22 +++ .../ruoyi/system/mapper/ClewPhoneMapper.java | 61 +++++++++ .../system/service/IClewPhoneService.java | 61 +++++++++ .../service/impl/ClewPhoneServiceImpl.java | 97 +++++++++++++ .../system/service/impl/ClewServiceImpl.java | 18 +++ .../mapper/system/ClewPhoneMapper.xml | 77 +++++++++++ 15 files changed, 836 insertions(+), 28 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ClewPhoneController.java create mode 100644 ruoyi-admin/src/main/resources/templates/system/phone/add.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/phone/edit.html create mode 100644 ruoyi-admin/src/main/resources/templates/system/phone/phone.html create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/config/BaiduConfig.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/ClewPhone.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/OppoCheck.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/ClewPhoneMapper.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IClewPhoneService.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClewPhoneServiceImpl.java create mode 100644 ruoyi-system/src/main/resources/mapper/system/ClewPhoneMapper.xml diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ClewPhoneController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ClewPhoneController.java new file mode 100644 index 00000000..a1d689ab --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ClewPhoneController.java @@ -0,0 +1,127 @@ +package com.ruoyi.web.controller.system; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.system.domain.ClewPhone; +import com.ruoyi.system.service.IClewPhoneService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 线索手机号Controller + * + * @author ruoyi + * @date 2023-07-19 + */ +@Controller +@RequestMapping("/system/phone") +public class ClewPhoneController extends BaseController +{ + private String prefix = "system/phone"; + + @Autowired + private IClewPhoneService clewPhoneService; + + @RequiresPermissions("system:phone:view") + @GetMapping() + public String phone() + { + return prefix + "/phone"; + } + + /** + * 查询线索手机号列表 + */ + @RequiresPermissions("system:phone:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(ClewPhone clewPhone) + { + startPage(); + List list = clewPhoneService.selectClewPhoneList(clewPhone); + return getDataTable(list); + } + + /** + * 导出线索手机号列表 + */ + @RequiresPermissions("system:phone:export") + @Log(title = "线索手机号", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(ClewPhone clewPhone) + { + List list = clewPhoneService.selectClewPhoneList(clewPhone); + ExcelUtil util = new ExcelUtil(ClewPhone.class); + return util.exportExcel(list, "线索手机号数据"); + } + + /** + * 新增线索手机号 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存线索手机号 + */ + @RequiresPermissions("system:phone:add") + @Log(title = "线索手机号", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(ClewPhone clewPhone) + { + return toAjax(clewPhoneService.insertClewPhone(clewPhone)); + } + + /** + * 修改线索手机号 + */ + @RequiresPermissions("system:phone:edit") + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Long id, ModelMap mmap) + { + ClewPhone clewPhone = clewPhoneService.selectClewPhoneById(id); + mmap.put("clewPhone", clewPhone); + return prefix + "/edit"; + } + + /** + * 修改保存线索手机号 + */ + @RequiresPermissions("system:phone:edit") + @Log(title = "线索手机号", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(ClewPhone clewPhone) + { + return toAjax(clewPhoneService.updateClewPhone(clewPhone)); + } + + /** + * 删除线索手机号 + */ + @RequiresPermissions("system:phone:remove") + @Log(title = "线索手机号", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(clewPhoneService.deleteClewPhoneByIds(ids)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/NoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/NoticeController.java index de3765e1..446c345d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/NoticeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/NoticeController.java @@ -1,24 +1,38 @@ package com.ruoyi.web.controller.tool; +import com.alibaba.fastjson.JSONObject; import com.aliyun.dysmsapi20170525.Client; import com.aliyun.dysmsapi20170525.models.SendSmsRequest; import com.aliyun.dysmsapi20170525.models.SendSmsResponse; import com.aliyun.teaopenapi.models.Config; import com.aliyun.teautil.models.RuntimeOptions; +import com.ruoyi.common.config.BaiduConfig; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.CacheUtils; import com.ruoyi.common.utils.ExceptionUtil; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.http.HttpUtils; +import com.ruoyi.system.domain.ClewPhone; import com.ruoyi.system.domain.NoticeRequest; +import com.ruoyi.system.domain.OppoCheck; +import com.ruoyi.system.service.IClewPhoneService; import lombok.extern.slf4j.Slf4j; -import net.bytebuddy.asm.Advice; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import java.security.GeneralSecurityException; +import java.security.Key; +import javax.crypto.Cipher; +import javax.crypto.spec.SecretKeySpec; +import org.apache.commons.codec.binary.Base64; import javax.validation.Valid; +import java.util.Date; +import java.util.List; /** * @author clunt @@ -29,6 +43,12 @@ import javax.validation.Valid; @RequestMapping("/tool/notice") public class NoticeController { + @Autowired + private BaiduConfig baiduConfig; + + @Autowired + private IClewPhoneService clewPhoneService; + @PostMapping("/logout") @ResponseBody public AjaxResult logout(@RequestBody NoticeRequest request){ @@ -36,6 +56,27 @@ public class NoticeController { return AjaxResult.success("注销成功!"); } + @PostMapping("/getLocation") + @ResponseBody + public AjaxResult getLocationByLot(@RequestBody JSONObject jsonObject){ + try { + String location = jsonObject.getString("location"); + String url = baiduConfig.getUrl().replace("#AK#", baiduConfig.getAk()) + location; + String result = HttpUtils.sendGet(url); + result = result.replaceAll("\n", "").replaceAll("\t", ""); + JSONObject resultJson = JSONObject.parseObject(result); + if("0".equals(resultJson.getString("status"))){ + return AjaxResult.success(resultJson.getJSONObject("result").getJSONObject("addressComponent")); + }else { + return AjaxResult.error("Api服务异常!"); + } + }catch (Exception e){ + e.printStackTrace(); + log.error(e.getMessage()); + return AjaxResult.error(ExceptionUtil.getExceptionMessage(e)); + } + } + @PostMapping("/sendSms") @ResponseBody @@ -56,6 +97,21 @@ public class NoticeController { SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime); log.info("发送给{}短信响应为{}", request.getPhone(), sendSmsResponse); CacheUtils.put(request.getPhone(), code); + // 请求次数入库 + try { + ClewPhone param = new ClewPhone(); + param.setPhone(request.getPhone()); + List clewPhones = clewPhoneService.selectClewPhoneList(param); + if(CollectionUtils.isEmpty(clewPhones)){ + ClewPhone model = new ClewPhone(); + model.setPhone(request.getPhone()); + model.setCreateTime(new Date()); + clewPhoneService.insertClewPhone(model); + } + }catch (Exception e){ + log.error("手机号入库失败!"); + } + }catch (Exception e){ log.error("给 {} 发送短信失败 {}", request.getPhone(), ExceptionUtil.getExceptionMessage(e)); return AjaxResult.error(e.getMessage()); @@ -70,12 +126,39 @@ public class NoticeController { Object obj = CacheUtils.get(request.getPhone()); if(obj != null && request.getCode().equals(obj.toString())){ CacheUtils.remove(request.getPhone()); + // 调用oppo的统计接口 + try { + // 回调 + OppoCheck model = new OppoCheck(); + model.setTimestamp(System.currentTimeMillis()); + model.setOuId(encode(model.getOuId().getBytes())); + String content = JSONObject.toJSONString(model) + model.getTimestamp() + "e0u6fnlag06lc3pl"; + log.info("请求的content加密前属性{}", content); + JSONObject oppoModel = new JSONObject(); + oppoModel.put("signature", encode(content.getBytes())); + oppoModel.put("timestamp", model.getTimestamp()); + log.info("请求https://api.ads.heytapmobi.com/api/uploadActiveData的属性{}", oppoModel.toJSONString()); + String s = HttpUtils.sendPost("https://api.ads.heytapmobi.com/api/uploadActiveData", oppoModel.toJSONString()); + log.info("请求https://api.ads.heytapmobi.com/api/uploadActiveData的响应{}", s); + }catch (Exception e){ + e.printStackTrace(); + log.error("回调oppo报错:{}", e.getMessage()); + } + return AjaxResult.success("操作成功!"); } } return AjaxResult.error("操作失败!"); } + public static String encode(byte[] data) throws GeneralSecurityException { + final Key dataKey = new SecretKeySpec(Base64.decodeBase64("XGAXicVG5GMBsx5bueOe4w=="), "AES"); + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + cipher.init(Cipher.ENCRYPT_MODE, dataKey); + byte[] encryptData = cipher.doFinal(data); + return Base64.encodeBase64String(encryptData).replaceAll("\r", "").replaceAll("\n", ""); + } + /** * 使用AK&SK初始化账号Client * @param accessKeyId diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index d7c69003..77e9adae 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -140,3 +140,8 @@ xss: swagger: # 是否开启swagger enabled: true + +# 百度地图应用api +baidu: + ak: 'ZQTgMW7W0GTuE7Ripb0HDp5TqRaOI6PZ' + url: 'https://api.map.baidu.com/reverse_geocoding/v3/?ak=#AK#&output=json&coordtype=wgs84ll&location=' \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/clew/clew.html b/ruoyi-admin/src/main/resources/templates/system/clew/clew.html index 2e655d4a..9c136138 100644 --- a/ruoyi-admin/src/main/resources/templates/system/clew/clew.html +++ b/ruoyi-admin/src/main/resources/templates/system/clew/clew.html @@ -149,28 +149,20 @@ visible: false }, { - field: 'company', - title: '广告主' + field: 'phone', + title: '手机号' }, { - field: 'saleId', - title: '销售' - }, - { - field: 'infoFlow', - title: '信息流' - }, - { - field: 'nextTime', - title: '下次跟进日期' + field: 'customerName', + title: '姓名' }, { field: 'wxName', title: '微信昵称' }, { - field: 'phone', - title: '手机号' + field: 'wxAccount', + title: '微信号' }, { field: 'debtType', @@ -181,16 +173,16 @@ title: '债务金额' }, { - field: 'sourceType', - title: '推广来源' - }, - { - field: 'sourceApp', + field: 'remark', title: 'App来源' }, { - field: 'wxAccount', - title: '微信号' + field: 'createTime', + title: '创建时间' + }, + { + field: 'sourceType', + title: '推广来源' }, { field: 'customerStatus', @@ -200,6 +192,10 @@ field: 'customerLevel', title: '客户评级' }, + { + field: 'nextTime', + title: '下次跟进日期' + }, { field: 'touchQrcode', title: '是否长按识别二维码' @@ -236,10 +232,6 @@ field: 'cityName', title: '城市' }, - { - field: 'customerName', - title: '姓名' - }, { field: 'contactTime', title: '方便接电话时间' @@ -249,8 +241,16 @@ title: '其他联系方式' }, { - field: 'remark', - title: '备注' + field: 'company', + title: '广告主' + }, + { + field: 'saleId', + title: '销售' + }, + { + field: 'infoFlow', + title: '信息流' }, { title: '操作', diff --git a/ruoyi-admin/src/main/resources/templates/system/phone/add.html b/ruoyi-admin/src/main/resources/templates/system/phone/add.html new file mode 100644 index 00000000..2cf5d3bc --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/phone/add.html @@ -0,0 +1,37 @@ + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/phone/edit.html b/ruoyi-admin/src/main/resources/templates/system/phone/edit.html new file mode 100644 index 00000000..d4ea6e0f --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/phone/edit.html @@ -0,0 +1,38 @@ + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/phone/phone.html b/ruoyi-admin/src/main/resources/templates/system/phone/phone.html new file mode 100644 index 00000000..76a73aeb --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/phone/phone.html @@ -0,0 +1,94 @@ + + + + + + +
+
+
+
+
+ +
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/BaiduConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/BaiduConfig.java new file mode 100644 index 00000000..bdd1ac00 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/config/BaiduConfig.java @@ -0,0 +1,32 @@ +package com.ruoyi.common.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +/** + * 百度地图应用ak配置 + * @author clunt + */ +@Component +@ConfigurationProperties(prefix = "baidu") +public class BaiduConfig { + + private String ak; + private String url; + + public String getAk() { + return ak; + } + + public void setAk(String ak) { + this.ak = ak; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/ClewPhone.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/ClewPhone.java new file mode 100644 index 00000000..e37982b5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/ClewPhone.java @@ -0,0 +1,56 @@ +package com.ruoyi.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 线索手机号对象 clew_phone + * + * @author ruoyi + * @date 2023-07-19 + */ +public class ClewPhone extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 手机号 */ + @Excel(name = "手机号") + private String phone; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setPhone(String phone) + { + this.phone = phone; + } + + public String getPhone() + { + return phone; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("phone", getPhone()) + .append("createTime", getCreateTime()) + .append("createBy", getCreateBy()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/OppoCheck.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/OppoCheck.java new file mode 100644 index 00000000..a02423c1 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/OppoCheck.java @@ -0,0 +1,22 @@ +package com.ruoyi.system.domain; + +import lombok.Data; + +/** + * oppo回调接口 + * @author clunt + */ +@Data +public class OppoCheck { + + private String ouId = "1007988678"; + private Long timestamp; + private String pkg = "com.yinliu.loan"; + private Integer dataType = 1; + private Integer channel = 1; + private Integer type = 1; + private Integer ascribeType = 1; + private Long adId = 101097648L; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ClewPhoneMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ClewPhoneMapper.java new file mode 100644 index 00000000..a0fd7a93 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ClewPhoneMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.mapper; + +import java.util.List; +import com.ruoyi.system.domain.ClewPhone; + +/** + * 线索手机号Mapper接口 + * + * @author ruoyi + * @date 2023-07-19 + */ +public interface ClewPhoneMapper +{ + /** + * 查询线索手机号 + * + * @param id 线索手机号主键 + * @return 线索手机号 + */ + public ClewPhone selectClewPhoneById(Long id); + + /** + * 查询线索手机号列表 + * + * @param clewPhone 线索手机号 + * @return 线索手机号集合 + */ + public List selectClewPhoneList(ClewPhone clewPhone); + + /** + * 新增线索手机号 + * + * @param clewPhone 线索手机号 + * @return 结果 + */ + public int insertClewPhone(ClewPhone clewPhone); + + /** + * 修改线索手机号 + * + * @param clewPhone 线索手机号 + * @return 结果 + */ + public int updateClewPhone(ClewPhone clewPhone); + + /** + * 删除线索手机号 + * + * @param id 线索手机号主键 + * @return 结果 + */ + public int deleteClewPhoneById(Long id); + + /** + * 批量删除线索手机号 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteClewPhoneByIds(String[] ids); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IClewPhoneService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IClewPhoneService.java new file mode 100644 index 00000000..8dd5fb42 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IClewPhoneService.java @@ -0,0 +1,61 @@ +package com.ruoyi.system.service; + +import java.util.List; +import com.ruoyi.system.domain.ClewPhone; + +/** + * 线索手机号Service接口 + * + * @author ruoyi + * @date 2023-07-19 + */ +public interface IClewPhoneService +{ + /** + * 查询线索手机号 + * + * @param id 线索手机号主键 + * @return 线索手机号 + */ + public ClewPhone selectClewPhoneById(Long id); + + /** + * 查询线索手机号列表 + * + * @param clewPhone 线索手机号 + * @return 线索手机号集合 + */ + public List selectClewPhoneList(ClewPhone clewPhone); + + /** + * 新增线索手机号 + * + * @param clewPhone 线索手机号 + * @return 结果 + */ + public int insertClewPhone(ClewPhone clewPhone); + + /** + * 修改线索手机号 + * + * @param clewPhone 线索手机号 + * @return 结果 + */ + public int updateClewPhone(ClewPhone clewPhone); + + /** + * 批量删除线索手机号 + * + * @param ids 需要删除的线索手机号主键集合 + * @return 结果 + */ + public int deleteClewPhoneByIds(String ids); + + /** + * 删除线索手机号信息 + * + * @param id 线索手机号主键 + * @return 结果 + */ + public int deleteClewPhoneById(Long id); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClewPhoneServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClewPhoneServiceImpl.java new file mode 100644 index 00000000..f3bbe1c0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClewPhoneServiceImpl.java @@ -0,0 +1,97 @@ +package com.ruoyi.system.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.system.mapper.ClewPhoneMapper; +import com.ruoyi.system.domain.ClewPhone; +import com.ruoyi.system.service.IClewPhoneService; +import com.ruoyi.common.core.text.Convert; + +/** + * 线索手机号Service业务层处理 + * + * @author ruoyi + * @date 2023-07-19 + */ +@Service +public class ClewPhoneServiceImpl implements IClewPhoneService +{ + @Autowired + private ClewPhoneMapper clewPhoneMapper; + + /** + * 查询线索手机号 + * + * @param id 线索手机号主键 + * @return 线索手机号 + */ + @Override + public ClewPhone selectClewPhoneById(Long id) + { + return clewPhoneMapper.selectClewPhoneById(id); + } + + /** + * 查询线索手机号列表 + * + * @param clewPhone 线索手机号 + * @return 线索手机号 + */ + @Override + public List selectClewPhoneList(ClewPhone clewPhone) + { + return clewPhoneMapper.selectClewPhoneList(clewPhone); + } + + /** + * 新增线索手机号 + * + * @param clewPhone 线索手机号 + * @return 结果 + */ + @Override + public int insertClewPhone(ClewPhone clewPhone) + { + clewPhone.setCreateTime(DateUtils.getNowDate()); + return clewPhoneMapper.insertClewPhone(clewPhone); + } + + /** + * 修改线索手机号 + * + * @param clewPhone 线索手机号 + * @return 结果 + */ + @Override + public int updateClewPhone(ClewPhone clewPhone) + { + clewPhone.setUpdateTime(DateUtils.getNowDate()); + return clewPhoneMapper.updateClewPhone(clewPhone); + } + + /** + * 批量删除线索手机号 + * + * @param ids 需要删除的线索手机号主键 + * @return 结果 + */ + @Override + public int deleteClewPhoneByIds(String ids) + { + return clewPhoneMapper.deleteClewPhoneByIds(Convert.toStrArray(ids)); + } + + /** + * 删除线索手机号信息 + * + * @param id 线索手机号主键 + * @return 结果 + */ + @Override + public int deleteClewPhoneById(Long id) + { + return clewPhoneMapper.deleteClewPhoneById(id); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClewServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClewServiceImpl.java index 0df57371..954c76e0 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClewServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ClewServiceImpl.java @@ -1,7 +1,11 @@ package com.ruoyi.system.service.impl; import java.util.List; + +import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.http.HttpUtils; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.ClewMapper; @@ -15,6 +19,7 @@ import com.ruoyi.common.core.text.Convert; * @author ruoyi * @date 2023-05-15 */ +@Slf4j @Service public class ClewServiceImpl implements IClewService { @@ -54,6 +59,19 @@ public class ClewServiceImpl implements IClewService @Override public int insertClew(Clew clew) { + // 线索短信通知 + try { + JSONObject smsContent = new JSONObject(); + smsContent.put("uid", "12347"); + smsContent.put("pwd", "wJgzaC0u"); + smsContent.put("mobile", "18580863889"); + smsContent.put("content", "你有一条来自黑猫,新线索生成,客户电话:" + clew.getPhone() + "(请注意及时跟进)"); + log.info("请求傲众短信入参:{}", smsContent.toJSONString()); + String s = HttpUtils.sendPost("http://www.aozhongyun.com/Admin/index.php/Message/send", smsContent.toJSONString()); + log.info("请求傲众短信url:{}, 响应:{}", "http://www.aozhongyun.com/Admin/index.php/Message/send", s); + }catch (Exception e){ + log.error("请求傲众短信url:{}, 报错:{}","http://www.aozhongyun.com/Admin/index.php/Message/send", e.getMessage()); + } clew.setCreateTime(DateUtils.getNowDate()); return clewMapper.insertClew(clew); } diff --git a/ruoyi-system/src/main/resources/mapper/system/ClewPhoneMapper.xml b/ruoyi-system/src/main/resources/mapper/system/ClewPhoneMapper.xml new file mode 100644 index 00000000..4664f855 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/ClewPhoneMapper.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + select id, phone, create_time, create_by, update_by, update_time, remark from clew_phone + + + + + + + + insert into clew_phone + + phone, + create_time, + create_by, + update_by, + update_time, + remark, + + + #{phone}, + #{createTime}, + #{createBy}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update clew_phone + + phone = #{phone}, + create_time = #{createTime}, + create_by = #{createBy}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where id = #{id} + + + + delete from clew_phone where id = #{id} + + + + delete from clew_phone where id in + + #{id} + + + + \ No newline at end of file