页面修复/短信验证/回调新增

This commit is contained in:
kuang.yife 2023-07-29 10:48:15 +08:00
parent 40043859df
commit e1d90b795a
15 changed files with 836 additions and 28 deletions

View File

@ -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<ClewPhone> 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<ClewPhone> list = clewPhoneService.selectClewPhoneList(clewPhone);
ExcelUtil<ClewPhone> util = new ExcelUtil<ClewPhone>(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));
}
}

View File

@ -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<ClewPhone> 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

View File

@ -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='

View File

@ -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: '操作',

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增线索手机号')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-phone-add">
<div class="form-group">
<label class="col-sm-3 control-label">手机号:</label>
<div class="col-sm-8">
<input name="phone" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/phone"
$("#form-phone-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-phone-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改线索手机号')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-phone-edit" th:object="${clewPhone}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">手机号:</label>
<div class="col-sm-8">
<input name="phone" th:field="*{phone}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "system/phone";
$("#form-phone-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-phone-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('线索手机号列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>手机号:</label>
<input type="text" name="phone"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:phone:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:phone:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:phone:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:phone:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:phone:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:phone:remove')}]];
var prefix = ctx + "system/phone";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "线索手机号",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键',
visible: false
},
{
field: 'phone',
title: '手机号'
},
{
field: 'createTime',
title: '创建时间'
},
{
field: 'remark',
title: '备注'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -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;
}
}

View File

@ -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();
}
}

View File

@ -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;
}

View File

@ -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<ClewPhone> 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);
}

View File

@ -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<ClewPhone> 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);
}

View File

@ -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<ClewPhone> 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);
}
}

View File

@ -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);
}

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.ClewPhoneMapper">
<resultMap type="ClewPhone" id="ClewPhoneResult">
<result property="id" column="id" />
<result property="phone" column="phone" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectClewPhoneVo">
select id, phone, create_time, create_by, update_by, update_time, remark from clew_phone
</sql>
<select id="selectClewPhoneList" parameterType="ClewPhone" resultMap="ClewPhoneResult">
<include refid="selectClewPhoneVo"/>
<where>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
</where>
</select>
<select id="selectClewPhoneById" parameterType="Long" resultMap="ClewPhoneResult">
<include refid="selectClewPhoneVo"/>
where id = #{id}
</select>
<insert id="insertClewPhone" parameterType="ClewPhone" useGeneratedKeys="true" keyProperty="id">
insert into clew_phone
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="phone != null">phone,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="phone != null">#{phone},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateClewPhone" parameterType="ClewPhone">
update clew_phone
<trim prefix="SET" suffixOverrides=",">
<if test="phone != null">phone = #{phone},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteClewPhoneById" parameterType="Long">
delete from clew_phone where id = #{id}
</delete>
<delete id="deleteClewPhoneByIds" parameterType="String">
delete from clew_phone where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>