记得上下班打卡 | git大法好,push需谨慎

Commit 62f43927 authored by jiangxiulong's avatar jiangxiulong

push admin 管理

parent 96cb3e71
package com.liquidnet.service.kylin.dto.param.admin;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 友盟推送 添加、修改需要的参数
* </p>
* @author jiangxiulong
* @since 2021-07-13
*/
@Data
public class UpushParam implements Serializable {
/**
* upush_id
*/
private String upushId;
/**
* 推送设备all ios android
*/
private Integer pushRange;
/**
* 推送类型 unicast broadcast
*/
private Integer pushType;
/**
* 推送号码
*/
private String mobile;
/**
* 推送标题
*/
private String pushTitle;
/**
* 推送内容
*/
private String pushContent;
/**
* 封面图
*/
private String img;
/**
* 跳转类型 go_app,go_channel,go_super_channel,normal_play,normal_live,ugc_play,ugc_live,ad_link,promotion,ticket,tour,goods,area
*/
private Integer jumpType;
/**
* 跳转值
*/
private String jumpValue;
/**
* 跳转对应的值
*/
private String jumpContent;
/**
* 推送时间
*/
private String pushTime;
/**
* 推送者姓名
*/
private String pushedName;
/**
* 推送任务ID
*/
private String taskId;
/**
* 是否发送推送消息,2不发送 1发送推送消息
*/
private Integer isPush;
/**
* 发送类型,2立即发送 1定时发送
*/
private Integer sendType;
/**
* 消息类型,2系统消息 1会员消息
*/
private Integer messageType;
/**
* 用户类型,2全部用户 1指定手机号
*/
private Integer specifyType;
/**
* 消息展示类型,2普通文本,1图文排版
*/
private Integer messageShowType;
private String showContent;
/**
* 推送者ID
*/
private String pushedBy;
private String createdAt;
private String updatedAt;
}
package com.liquidnet.service.kylin.dto.param.admin;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* <p>
* 友盟推送 search param
* </p>
* @author jiangxiulong
* @since 2021-07-13
*/
@Data
public class UpushSearchParam implements Serializable {
@ApiModelProperty(value = "页数", example = "0")
@NotNull(message = "页数不能为空")
private Integer pageSize;
@ApiModelProperty(value = "数量", example = "20")
@NotNull(message = "数量不能为空")
private Integer pageNum;
private String pushTitle;
/**
* 推送设备all ios android
*/
private Integer pushRange;
/**
* 推送类型 unicast broadcast
*/
private Integer pushType;
/**
* 跳转类型 go_app,go_channel,go_super_channel,normal_play,normal_live,ugc_play,ugc_live,ad_link,promotion,ticket,tour,goods,area
*/
private Integer jumpType;
/**
* 是否发送推送消息,2不发送 1发送推送消息
*/
private Integer isPush;
/**
* 消息类型,2系统消息 1会员消息
*/
private Integer messageType;
}
package com.liquidnet.service.kylin.service.admin;
import com.liquidnet.service.kylin.entity.AdminUpush;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 友盟消息推送 服务类
* </p>
*
* @author jiangxiulong
* @since 2021-07-13
*/
public interface IAdminUpushService extends IService<AdminUpush> {
}
package com.liquidnet.client.admin.common.enums;
import java.util.*;
/**
* <p>
* 友盟推送 跳转类型
* </p>
*
* @author jiangxiulong
* @since 2021-07-13
*/
public enum UpushTargetType {
TARGET_TYPE5("场地详情", 5),
TARGET_TYPE6("票务详情", 6),
TARGET_TYPE7("商品详情", 7),
TARGET_TYPE14("商品集合", 14),
TARGET_TYPE20("音乐人详情", 20),
TARGET_TYPE21("歌曲详情", 21),
TARGET_TYPE22("专辑详情", 22),
TARGET_TYPE24("音乐人集合", 24),
TARGET_TYPE26("摩登会员", 26),
TARGET_TYPE12("活动跳转-可分享", 12),
TARGET_TYPE100("活动跳转", 100),
TARGET_TYPE0("不跳转", 0),
TARGET_TYPE16("票务首页", 16),
TARGET_TYPE17("商品首页", 17),
TARGET_TYPE28("消息列表", 28),
TARGET_TYPE32("系统消息列表", 32),
TARGET_TYPE33("会员消息列表", 33);
private String name;
private int index;
UpushTargetType(String name, int index) {
this.name = name;
this.index = index;
}
public String getName() {
return this.name;
}
public int getIndex() {
return this.index;
}
private static List<Object> resultTypeListR = null;
static {
ArrayList<Object> resultTypeList = new ArrayList<>();
for (UpushTargetType resultType : UpushTargetType.values()) {
Map<String, Object> mapTemp = new HashMap<>();
mapTemp.put("id", resultType.index);
mapTemp.put("name", resultType.name);
resultTypeList.add(mapTemp);
}
resultTypeListR = Collections.unmodifiableList(resultTypeList);
}
public static List<Object> getResultType() {
return resultTypeListR;
}
public static String getTypeName(int index) {
for (UpushTargetType c : UpushTargetType.values()) {
if (c.getIndex() == index) {
return c.name;
}
}
return null;
}
}
package com.liquidnet.client.admin.framework.web.service;
import com.liquidnet.client.admin.common.enums.BannersTargetType;
import com.liquidnet.client.admin.common.enums.UpushTargetType;
import org.springframework.stereotype.Service;
import java.util.List;
......@@ -18,4 +19,9 @@ public class BannerService
return BannersTargetType.getResultType();
}
public List<Object> getUpushType()
{
return UpushTargetType.getResultType();
}
}
package com.liquidnet.client.admin.web.controller.zhengzai.admin;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.common.enums.UpushTargetType;
import com.liquidnet.client.admin.zhengzai.admin.service.impl.AdminUpushServiceImpl;
import com.liquidnet.service.kylin.dao.UpushDetailsListDao;
import com.liquidnet.service.kylin.dto.param.admin.UpushParam;
import com.liquidnet.service.kylin.dto.param.admin.UpushSearchParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 友盟推送 后端管理控制器
* </p>
*
* @author jiangxiulong
* @since 2021-07-13
*/
@Controller
@RequestMapping("/admin/upush")
public class AdminUpushController extends BaseController {
private String prefix = "zhengzai/admin/upush";
@Value("${liquidnet.client.admin.platformUrl}")
private String platformUrl;
@Value("${liquidnet.url-banner.url5}")
private String url5;
@Value("${liquidnet.url-banner.url6}")
private String url6;
@Value("${liquidnet.url-banner.url7}")
private String url7;
@Value("${liquidnet.url-banner.url14}")
private String url14;
@Value("${liquidnet.url-banner.url20}")
private String url20;
@Value("${liquidnet.url-banner.url21}")
private String url21;
@Value("${liquidnet.url-banner.url22}")
private String url22;
@Value("${liquidnet.url-banner.url24}")
private String url24;
@Value("${liquidnet.url-banner.url26}")
private String url26;
@Autowired
private AdminUpushServiceImpl adminUpushServiceImpl;
@GetMapping("/create")
public String create(ModelMap mmap) {
List<Object> jumpType = UpushTargetType.getResultType();
mmap.put("jumpType", jumpType);
mmap.put("platformUrl", platformUrl);
mmap.put("url5", url5);
mmap.put("url6", url6);
mmap.put("url7", url7);
mmap.put("url14", url14);
mmap.put("url20", url20);
mmap.put("url21", url21);
mmap.put("url22", url22);
mmap.put("url24", url24);
mmap.put("url26", url26);
return prefix + "/create";
}
@RequiresPermissions("admin:upush:create")
@PostMapping("create")
@ResponseBody
public AjaxResult createSave(UpushParam upushParam) {
Boolean res = adminUpushServiceImpl.create(upushParam);
if (res) {
return success();
} else {
return error("添加失败");
}
}
@RequiresPermissions("admin:upush:view")
@GetMapping()
public String upushs() {
return prefix + "/upush";
}
@RequiresPermissions("admin:upush:list")
@PostMapping("list")
@ResponseBody
public TableDataInfo upushList(UpushSearchParam upushSearchParam) {
PageInfo<UpushDetailsListDao> result = adminUpushServiceImpl.lists(upushSearchParam);
return getDataTable(result.getList());
}
@GetMapping("/detail/{upushId}")
public String detail(@PathVariable("upushId") String upushId, ModelMap mmap) {
UpushDetailsListDao result = null;
result = adminUpushServiceImpl.detail(upushId);
mmap.put("UpushDetailsListDao", result);
return prefix + "/detail";
}
}
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('添加推送')"/>
<th:block th:include="include :: select2-css"/>
<th:block th:include="include :: datetimepicker-css"/>
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-post-add">
<div class="form-group">
<label class="col-sm-2 control-label">消息类型</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="messageType" checked=""> 系统消息
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="1" name="messageType"> 会员消息
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">设备类型</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="1" name="pushRange" checked=""> 全部
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="2" name="pushRange"> IOS
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="3" name="pushRange"> Android
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">请选择跳转类型</label>
<div class="col-sm-5">
<select class="form-control" name="jumpType" id="jumpType">
<option value="">--请选择跳转类型--</option>
<option th:each="type : ${jumpType}" th:text="${type.name}" th:value="${type.id}"></option>
</select>
</div>
<div class="col-sm-5">
<input class="form-control" type="text" placeholder="请填写url" id="targetObjInput">
<div hidden class="row" id="targetObjSelectShow">
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control" id="targetObjSelect">
<div class="input-group-btn">
<button type="button" class="btn btn-white dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">推送范围</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="specifyType" checked=""> 全部用户
</label>
</div>
<!--<div class="radio check-box">
<label>
<input type="radio" value="1" name="specifyType"> 指定手机号
</label>
</div>-->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">排版方式</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="messageShowType" checked=""> 文本消息
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="1" name="messageShowType"> 图文消息
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">推送标题:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="pushTitle" id="pushTitle" required>
</div>
</div>
<div class="form-group">
<label class="col-xs-2 control-label">推送内容:</label>
<div class="col-xs-10">
<textarea name="pushContent" maxlength="500" class="form-control" rows="3"></textarea>
</div>
</div>
<div class="form-group">
<label class="font-noraml">推送图片</label>
<div class="file-loading">
<input id="fileinput-demo-1" type="file" name="files" data-browse-on-zone-click="true"
data-msg-placeholder="Select {files} for upload...">
</div>
</div>
<input hidden id="img" name="img">
<div class="form-group">
<label class="col-sm-2 control-label">是否发送通知</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="isPush" checked=""> 不发送
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="1" name="isPush"> 发送
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">推送方式</label>
<div class="col-sm-6">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="sendType" checked=""> 立即推送
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="1" name="sendType"> 定时推送
</label>
</div>
</div>
<div class="col-sm-4">
<div class="input-daterange input-group">
<input name="pushTime" type="text" class="input-sm form-control" id="laydate-startTime" placeholder="yyyy-MM-dd HH:mm:ss"/>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: bootstrap-suggest-js"/>
<script type="text/javascript">
var prefix = ctx + "admin/upush";
var platformUrl = "[[${platformUrl}]]";
var url5 = "[[${url5}]]";
var url6 = "[[${url6}]]";
var url7 = "[[${url7}]]";
var url14 = "[[${url14}]]";
var url20 = "[[${url20}]]";
var url21 = "[[${url21}]]";
var url22 = "[[${url22}]]";
var url24 = "[[${url24}]]";
var url26 = "[[${url26}]]";
function submitHandler() {
if ($.validate.form()) {
var data = $('#form-post-add').serializeArray();
var jumpType = $('#jumpType').select2('val');
if (!jumpType) {
layer.msg("请选择跳转类型");
return false;
}
var targetObj = '';
var targetObjName = '';
if (12 == jumpType || 100 == jumpType) { // 请填写url
targetObj = $("#targetObjInput").val();
if (!targetObj) {
layer.msg("请填写跳转的url");
return false;
}
} else if (0 == jumpType || 201 == jumpType || 16 == jumpType || 17 == jumpType || 28 == jumpType || 32 == jumpType || 33 == jumpType) { // 无需跳转
targetObj = '';
} else {
targetObj = $("#targetObjSelect").attr("data-id");
targetObjName = $("#targetObjSelect").val();
if (!targetObj) {
layer.msg("请选择跳转的目标");
return false;
}
}
/*var img = $('#img').val();
if (!img) {
layer.msg("请上传图片,请勿忘记点击上传按钮先上传图片哦~");
return false;
}*/
data.push({"name": "jumpValue", "value": targetObj});
data.push({"name": "jumpContent", "value": targetObjName});
$.operate.save(prefix + "/create", data);
}
}
$(function () {
layui.use(['laydate'], function () {
var laydate = layui.laydate;
var startDate = laydate.render({
elem: '#laydate-startTime',
type: 'datetime',
theme: 'molv',
trigger: 'click',
});
});
// 跳转类型选择事件
function targetObjBsSuggest(searchUrl, targetType) {
var bsSuggest = $("#targetObjSelect").bsSuggest({
indexId: 0, // data.value 每组数据的第几个数据,作为input输入框的 data-id,设为 -1 且 idField 为空则不设置此值
indexKey: 1, // data.value 的第几个数据,作为input输入框的内容
keyField: "ID",
showBtn: false, //是否显示下拉按钮
hideOnSelect:true, //鼠标从列表单击选择了值时,是否隐藏选择列表
searchingTip: "获取中...",
clearable: true, //是否可清除已输入的内容
allowNoKeyword: false, // 是否允许无关键字时请求数据
multiWord: false, // 以分隔符号分割的多关键字支持
separator: ",", // 多关键字支持时的分隔符,默认为空格
getDataMethod: "url", // 获取数据的方式,总是从 URL 获取
effectiveFieldsAlias: {
Id: "ID",
Keyword: "名称"
},
showHeader: true,
url: searchUrl + '&title=',
/*优先从url ajax 请求 json 帮助数据,注意最后一个参数为关键字请求参数*/
// jsonp: 'callback',
/*如果从 url 获取数据,并且需要跨域,则该参数必须设置*/
processData: function (json) { // url 获取数据时,对数据的处理,作为 getData 的回调函数
var i, len, data = {
value: []
};
if (!json) {
return false;
}
if (6 == targetType) {
dataList = json.value;
} else if(8 == targetType) {
dataList = json.rows;
} else if(24 == targetType) {
dataList = json.data;
} else if(26 == targetType) {
dataList = json.data;
} else {
dataList = json.data
}
console.log(dataList);
len = dataList.length;
for (i = 0; i < len; i++) {
var Title = '';
var Id = '';
if (6 == targetType) {
Id = dataList[i].performancesId;
Title = dataList[i].title;
} else if(8 == targetType) {
Id = dataList[i].roadShowId;
Title = dataList[i].title;
} else if(24 == targetType) {
Id = dataList[i].id;
Title = dataList[i].collect_name;
} else if(26 == targetType) {
Id = dataList[i].id;
Title = dataList[i].name;
} else {
Id = dataList[i].id;
Title = dataList[i].title;
}
data.value.push({
"Id": Id,
"Title": Title,
});
}
console.log(data);
return data;
}
});
}
$('#jumpType').on('select2:select', function (e) {
$("#targetObjSelect").bsSuggest("destroy");
// var cardTypeW = $("#cardType option:checked").text(); // 获取选中的名
// var targetType = $("#targetType option:checked").val();
var targetType = $('#jumpType').select2('val');
if (12 == targetType || 100 == targetType) { // 请填写url
$("#targetObjSelectShow").hide();
$("#targetObjInput").show();
} else if (0 == targetType || 201 == targetType || 16 == targetType || 17 == targetType || 28 == targetType || 32 == targetType || 33 == targetType) { // 无需跳转
$("#targetObjSelectShow").hide();
$("#targetObjInput").hide();
} else {
var urlVarName = 'url' + targetType;
var urleval = eval(urlVarName);
var arrEntities = {'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"'};
searchUrl = urleval.replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) {
return arrEntities[t];
});
$("#targetObjSelectShow").show();
$("#targetObjInput").hide();
targetObjBsSuggest(searchUrl, targetType);
}
});
$("#fileinput-demo-1").fileinput({
'theme': 'explorer-fas',
// 'uploadUrl': "/kylin/banners/upload3",
// 'uploadUrl': "http://127.0.0.1:9003" + "/platform/basicServices/alOss/upload",
'uploadUrl': platformUrl + "/platform/basicServices/alOss/upload",
"uploadExtraData": {
"pathName" : "push",
"buckType" : 1
},
// overwriteInitial: false,
// initialPreviewAsData: true,
autoReplace: true,
dropZoneTitle: "请上传文件",
maxFileCount: 1
});
$("#fileinput-demo-1").on("fileuploaded", function (event, data, previewId, index) {
$("#img").val(data.response.ossPath)
});
})
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('推送详情')"/>
<th:block th:include="include :: select2-css"/>
<th:block th:include="include :: datetimepicker-css"/>
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-post-add">
<div class="form-group">
<label class="col-sm-2 control-label">消息类型</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="messageType" disabled="" th:checked="${UpushDetailsListDao.messageType==2 ? true : false}"> 系统消息
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="1" name="messageType" disabled="" th:checked="${UpushDetailsListDao.messageType==1 ? true : false}"> 会员消息
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">设备类型</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="1" name="pushRange" disabled="" th:checked="${UpushDetailsListDao.pushRange==1 ? true : false}"> 全部
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="2" name="pushRange" disabled="" th:checked="${UpushDetailsListDao.pushRange==2 ? true : false}"> IOS
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="3" name="pushRange" disabled="" th:checked="${UpushDetailsListDao.pushRange==3 ? true : false}"> Android
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">请选择跳转类型</label>
<div class="col-sm-5">
<input class="form-control" type="text" disabled th:value="${UpushDetailsListDao.jumpName}">
</div>
<div class="col-sm-5">
<input class="form-control" type="text" disabled th:value="${UpushDetailsListDao.jumpValue + UpushDetailsListDao.jumpContent}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">推送范围</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="specifyType" disabled="" th:checked="${UpushDetailsListDao.specifyType==2 ? true : false}"> 全部用户
</label>
</div>
<!--<div class="radio check-box">
<label>
<input type="radio" value="1" name="specifyType"> 指定手机号
</label>
</div>-->
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">排版方式</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="messageShowType" disabled="" th:checked="${UpushDetailsListDao.messageShowType==2 ? true : false}"> 文本消息
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="1" name="messageShowType" disabled="" th:checked="${UpushDetailsListDao.messageShowType==1 ? true : false}"> 图文消息
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label is-required">推送标题:</label>
<div class="col-sm-10">
<input class="form-control" type="text" name="pushTitle" id="pushTitle" disabled th:value="${UpushDetailsListDao.pushTitle}">
</div>
</div>
<div class="form-group">
<label class="col-xs-2 control-label">推送内容:</label>
<div class="col-xs-10">
<textarea name="pushContent" maxlength="500" class="form-control" rows="3" disabled th:text="${UpushDetailsListDao.pushTitle}"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-xs-2 control-label">推送图片:</label>
<img alt="" th:src="${UpushDetailsListDao.img}">
</div>
<div class="form-group">
<label class="col-sm-2 control-label">是否发送通知</label>
<div class="col-sm-10">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="isPush" disabled="" th:checked="${UpushDetailsListDao.isPush==2 ? true : false}"> 不发送
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="1" name="isPush" disabled="" th:checked="${UpushDetailsListDao.isPush==1 ? true : false}"> 发送
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">推送方式</label>
<div class="col-sm-6">
<div class="radio check-box">
<label>
<input type="radio" value="2" name="sendType" disabled="" th:checked="${UpushDetailsListDao.sendType==2 ? true : false}"> 立即推送
</label>
</div>
<div class="radio check-box">
<label>
<input type="radio" value="1" name="sendType" disabled="" th:checked="${UpushDetailsListDao.sendType==1 ? true : false}"> 定时推送
</label>
</div>
</div>
<div class="col-sm-4">
<div class="input-daterange input-group">
<input name="pushTime" type="text" class="input-sm form-control" id="laydate-startTime" th:value="${UpushDetailsListDao.pushTime}" placeholder="yyyy-MM-dd HH:mm:ss"/>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: bootstrap-fileinput-js"/>
<th:block th:include="include :: bootstrap-suggest-js"/>
</body>
</html>
<!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="pushTitle"/>
</li>
<li>
<label>跳转类型:</label>
<select name="jumpType">
<option value="">全部</option>
<option th:each="target : ${@banner.getUpushType()}" th:value="${target.id}" th:text="${target.name}"></option>
</select>
</li>
<li>
<label>设备类型:</label>
<select name="pushRange">
<option value="">全部</option>
<option value="2">IOS</option>
<option value="3">Android</option>
</select>
</li>
<li>
<label>推送类型:</label>
<select name="pushType">
<option value="">全部</option>
<option value="1">unicast</option>
<option value="2">broadcast</option>
</select>
</li>
<li>
<label>是否发送通知:</label>
<select name="isPush">
<option value="">全部</option>
<option value="2">不发送</option>
<option value="1">发送推送消息</option>
</select>
</li>
<li>
<label>消息类型:</label>
<select name="messageType">
<option value="">全部</option>
<option value="2">系统消息</option>
<option value="1">会员消息</option>
</select>
</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="admin:upush:create">
<i class="fa fa-plus"></i> 添加
</a>
</div>
<div class="col-sm-12 select-table table-bordered">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var detailFlag = [[${@permission.hasPermi('admin:upush:detail')}]];
var prefix = ctx + "admin/upush";
$(function () {
var options = {
url: prefix + "/list",
createUrl: prefix + "/create",
detailUrl: prefix + "/detail/{id}",
modalName: "推送",
columns: [
{
field: 'upushId',
title: 'ID'
},
{
field: 'pushType',
title: '推送方式'
},
{
field: 'pushTitle',
title: '推送标题'
},
{
field: 'jumpName',
title: '跳转类型'
},
{
field: 'jumpContent',
title: '跳转内容',
formatter: function(value, row, index) {
if (row.jumpContent != '') {
return row.jumpContent
} else {
return row.jumpValue
}
}
},
{
field: 'messageShowType',
title: '消息类型',
formatter: function(value, row, index) {
if (row.messageShowType == 2) {
return "普通文本"
}
if (row.messageShowType == 1) {
return "图文排版"
}
}
},
{
field: 'specifyType',
title: '用户类型',
formatter: function(value, row, index) {
if (row.specifyType == 2) {
return "全部用户"
}
if (row.specifyType == 1) {
return "指定手机号"
}
}
},
{
field: 'isPush',
title: '是否发通知',
formatter: function(value, row, index) {
if (row.isPush == 1) {
return "发送"
}
if (row.isPush == 2) {
return "不发送"
}
}
},
{
field: 'pushRange',
title: '设备类型',
formatter: function(value, row, index) {
if (row.pushRange == 1) {
return "ALL"
}
if (row.pushRange == 2) {
return "IOS"
}
if (row.pushRange == 3) {
return "Android"
}
}
},
{
field: 'pushedName',
title: '发送人'
},
{
field: 'createdAt',
title: '添加时间'
},
{
field: 'pushTime',
title: '推送时间'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-info btn-xs' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detailTab(\'' + row.upushId + '\')"></i>查看</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('修改banner')"/>
<th:block th:include="include :: header('编辑正在现场App版本')"/>
<th:block th:include="include :: select2-css"/>
<th:block th:include="include :: datetimepicker-css"/>
<th:block th:include="include :: bootstrap-fileinput-css"/>
......
<!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('Banner列表')"/>
<th:block th:include="include :: header('正在现场App版本列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
......
package com.liquidnet.client.admin.zhengzai.admin.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.enums.UpushTargetType;
import com.liquidnet.client.admin.common.utils.ShiroUtils;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.kylin.dao.UpushDetailsListDao;
import com.liquidnet.service.kylin.dto.param.admin.UpushParam;
import com.liquidnet.service.kylin.dto.param.admin.UpushSearchParam;
import com.liquidnet.service.kylin.entity.AdminUpush;
import com.liquidnet.service.kylin.mapper.AdminUpushMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.kylin.service.admin.IAdminUpushService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 友盟消息推送 服务实现类
* </p>
*
* @author jiangxiulong
* @since 2021-07-13
*/
@Service
public class AdminUpushServiceImpl extends ServiceImpl<AdminUpushMapper, AdminUpush> implements IAdminUpushService {
@Value("${liquidnet.al-oss.imgUrl}")
private String imgUrl;
@Autowired
private AdminUpushMapper adminUpushMapper;
public Boolean create(UpushParam upushParam) {
try {
// 入数据库
String upushId = IDGenerator.nextSnowId();
upushParam.setUpushId(upushId);
upushParam.setCreatedAt(DateUtil.getNowTime());
String authId = ShiroUtils.getUserId().toString();
String authName = ShiroUtils.getLoginName();
upushParam.setPushedBy(authId);
upushParam.setPushedName(authName);
AdminUpush adminUpush = new AdminUpush();
BeanUtils.copyProperties(upushParam, adminUpush);
if (adminUpush.getPushTime().isEmpty()) {
adminUpush.setPushTime(null);
}
adminUpushMapper.insert(adminUpush);
return true;
} catch (Exception e) {
return false;
}
}
public PageInfo<UpushDetailsListDao> lists(UpushSearchParam upushSearchParam) {
try {
PageHelper.startPage(upushSearchParam.getPageNum(), upushSearchParam.getPageSize());
List<UpushDetailsListDao> voList = adminUpushMapper.searchList(BeanUtil.convertBeanToMap(upushSearchParam));
for (UpushDetailsListDao item : voList) {
String typeName = UpushTargetType.getTypeName(item.getJumpType());
item.setJumpName(typeName);
}
return new PageInfo(voList);
} catch (Exception e) {
return new PageInfo(new ArrayList());
}
}
public UpushDetailsListDao detail(String upushId) {
AdminUpush data = adminUpushMapper.selectOne(Wrappers.lambdaQuery(AdminUpush.class).eq(AdminUpush::getUpushId, upushId));
UpushDetailsListDao upushDetailsListDao = new UpushDetailsListDao();
if (null != data) {
String typeName = UpushTargetType.getTypeName(data.getJumpType());
BeanUtils.copyProperties(data, upushDetailsListDao);
upushDetailsListDao.setImg(imgUrl + upushDetailsListDao.getImg());
upushDetailsListDao.setJumpName(typeName);
} else {
return null;
}
return upushDetailsListDao;
}
}
package com.liquidnet.service.kylin.dao;
import lombok.Data;
import java.io.Serializable;
@Data
public class UpushDetailsListDao implements Serializable {
/**
* upush_id
*/
private String upushId;
/**
* 推送设备all ios android
*/
private Integer pushRange;
/**
* 推送类型 unicast broadcast
*/
private Integer pushType;
/**
* 推送号码
*/
private String mobile;
/**
* 推送标题
*/
private String pushTitle;
/**
* 推送内容
*/
private String pushContent;
/**
* 封面图
*/
private String img;
/**
* 跳转类型 go_app,go_channel,go_super_channel,normal_play,normal_live,ugc_play,ugc_live,ad_link,promotion,ticket,tour,goods,area
*/
private Integer jumpType;
private String jumpName;
/**
* 跳转值
*/
private String jumpValue;
/**
* 跳转对应的值
*/
private String jumpContent;
/**
* 推送时间
*/
private String pushTime;
/**
* 推送任务ID
*/
private String taskId;
/**
* 是否发送推送消息,2不发送 1发送推送消息
*/
private Integer isPush;
/**
* 发送类型,2立即发送 1定时发送
*/
private Integer sendType;
/**
* 消息类型,2系统消息 1会员消息
*/
private Integer messageType;
/**
* 用户类型,2对应全部用户 1对应指定手机号
*/
private Integer specifyType;
/**
* 消息展示类型,2普通文本,1图文排版
*/
private Integer messageShowType;
private String showContent;
/**
* 推送者ID
*/
private String pushedBy;
/**
* 推送者姓名
*/
private String pushedName;
private String createdAt;
private String updatedAt;
}
package com.liquidnet.service.kylin.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 友盟消息推送
* </p>
*
* @author jiangxiulong
* @since 2021-07-13
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class AdminUpush implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Integer mid;
/**
* upush_id
*/
private String upushId;
/**
* 推送设备all ios android
*/
private Integer pushRange;
/**
* 推送类型 unicast broadcast
*/
private Integer pushType;
/**
* 推送号码
*/
private String mobile;
/**
* 推送标题
*/
private String pushTitle;
/**
* 推送内容
*/
private String pushContent;
/**
* 封面图
*/
private String img;
/**
* 跳转类型 go_app,go_channel,go_super_channel,normal_play,normal_live,ugc_play,ugc_live,ad_link,promotion,ticket,tour,goods,area
*/
private Integer jumpType;
/**
* 跳转值
*/
private String jumpValue;
/**
* 跳转对应的值
*/
private String jumpContent;
/**
* 推送时间
*/
private String pushTime;
/**
* 推送者姓名
*/
private String pushedName;
/**
* 推送任务ID
*/
private String taskId;
/**
* 是否发送推送消息,2不发送 1发送推送消息
*/
private Integer isPush;
/**
* 发送类型,2立即发送 1定时发送
*/
private Integer sendType;
/**
* 消息类型,2系统消息 1会员消息
*/
private Integer messageType;
/**
* 用户类型,2全部用户 1指定手机号
*/
private Integer specifyType;
/**
* 消息展示类型,2普通文本,1图文排版
*/
private Integer messageShowType;
private String showContent;
/**
* 推送者ID
*/
private String pushedBy;
private String createdAt;
private String updatedAt;
}
package com.liquidnet.service.kylin.mapper;
import com.liquidnet.service.kylin.dao.UpushDetailsListDao;
import com.liquidnet.service.kylin.entity.AdminUpush;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
/**
* <p>
* 友盟消息推送 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2021-07-13
*/
public interface AdminUpushMapper extends BaseMapper<AdminUpush> {
List<UpushDetailsListDao> searchList(Map<String, Object> convertBeanToMap);
}
<?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.liquidnet.service.kylin.mapper.AdminUpushMapper">
<select id="searchList" resultType="com.liquidnet.service.kylin.dao.UpushDetailsListDao">
SELECT *
FROM admin_upush
<where>
<if test="pushTitle != ''">
AND push_title LIKE concat('%', #{pushTitle}, '%')
</if>
<if test="pushRange != ''">
AND push_range=${pushRange}
</if>
<if test="pushType != ''">
AND push_type=${pushType}
</if>
<if test="jumpType != ''">
AND jump_type=${jumpType}
</if>
<if test="isPush != ''">
AND is_push=${isPush}
</if>
<if test="messageType != ''">
AND message_type=${messageType}
</if>
</where>
ORDER BY mid DESC
</select>
</mapper>
......@@ -982,6 +982,7 @@ create table platform_oss_files
DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci COMMENT '阿里云OSS上传记录';
drop TABLE if exists `admin_upush`;
CREATE TABLE `admin_upush`
(
`mid` int(11) unsigned NOT NULL AUTO_INCREMENT,
......@@ -994,18 +995,17 @@ CREATE TABLE `admin_upush`
`img` varchar(500) NOT NULL DEFAULT '' COMMENT '封面图',
`jump_type` tinyint NOT NULL DEFAULT 0 COMMENT '跳转类型 go_app,go_channel,go_super_channel,normal_play,normal_live,ugc_play,ugc_live,ad_link,promotion,ticket,tour,goods,area',
`jump_value` varchar(255) NOT NULL DEFAULT '' COMMENT '跳转值',
`jump_content` varchar(500) NOT NULL DEFAULT '' COMMENT '跳转对应的值',
`jump_content` varchar(500) NOT NULL DEFAULT '' COMMENT '跳转对应的值名称',
`push_time` timestamp NULL DEFAULT NULL COMMENT '推送时间',
`jump_begin_time` timestamp NULL DEFAULT NULL COMMENT '直播开始时间',
`pushed_by` varchar(255) NOT NULL DEFAULT '' COMMENT '推送者ID',
`pushed_name` varchar(255) NOT NULL DEFAULT '' COMMENT '推送者姓名',
`task_id` varchar(255) NOT NULL DEFAULT '' COMMENT '推送任务ID',
`is_push` int NOT NULL DEFAULT 0 COMMENT '是否发送推送消息,2不发送 1发送推送消息',
`send_type` int NOT NULL DEFAULT 0 COMMENT '发送类型,2立即发送 1定时发送',
`message_type` int NOT NULL DEFAULT 0 COMMENT '消息类型,2系统消息 1会员消息',
`specify_type` int NOT NULL DEFAULT 0 COMMENT '用户类型,2对应全部用户 1对应指定手机号',
`specify_type` int NOT NULL DEFAULT 0 COMMENT '用户类型,2全部用户 1指定手机号',
`message_show_type` int NOT NULL DEFAULT 0 COMMENT '消息展示类型,2普通文本,1图文排版',
`show_content` text,
`pushed_by` varchar(255) NOT NULL DEFAULT '' COMMENT '推送者ID',
`pushed_name` varchar(255) NOT NULL DEFAULT '' COMMENT '推送者姓名',
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
KEY `admin_upush_id_index` (`upush_id`),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment