消息推送
This commit is contained in:
@@ -28,9 +28,13 @@ CREATE TABLE `push_cids` (
|
|||||||
`getuiCid` varchar(100) NOT NULL COMMENT '个推的ClientID',
|
`getuiCid` varchar(100) NOT NULL COMMENT '个推的ClientID',
|
||||||
`userPhone` varchar(100) DEFAULT NULL COMMENT '用户手机号',
|
`userPhone` varchar(100) DEFAULT NULL COMMENT '用户手机号',
|
||||||
`userId` bigint(32) DEFAULT NULL COMMENT '用户ID',
|
`userId` bigint(32) DEFAULT NULL COMMENT '用户ID',
|
||||||
|
`store_id` int(11) DEFAULT 1 COMMENT '用户ID',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
ALTER TABLE mallplus1.push_cids ADD store_id INT DEFAULT 1 NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `sys_message_task` (
|
CREATE TABLE `sys_message_task` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
@@ -38,7 +42,13 @@ CREATE TABLE `sys_message_task` (
|
|||||||
`code` varchar(60) DEFAULT '系统消息' COMMENT '消息编码',
|
`code` varchar(60) DEFAULT '系统消息' COMMENT '消息编码',
|
||||||
`params` varchar(5000) DEFAULT NULL COMMENT '参数',
|
`params` varchar(5000) DEFAULT NULL COMMENT '参数',
|
||||||
`content` text COMMENT '内容',
|
`content` text COMMENT '内容',
|
||||||
`sendtime` date NOT NULL COMMENT '发送时间',
|
`sendtime` datetime NOT NULL COMMENT '发送时间',
|
||||||
`status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0未发送,1已发送',
|
`status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0未发送,1已发送',
|
||||||
|
`store_id` int(11) DEFAULT 1 COMMENT '用户ID',
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='定时消息';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='定时消息';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO sys_permission (pid, name, value, icon, type, uri, status, create_time, sort)
|
||||||
|
VALUES (43, '定时消息', 'ums:UmsMember:read', 'product-list', 1, 'sysMessageTask', 1, now() , 0)
|
||||||
6
docs/xiugai/20230315/工作安排20230318.md
Normal file
6
docs/xiugai/20230315/工作安排20230318.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
1.优惠券的批量领取
|
||||||
|
2.购买商品时如果有符合使用的优惠券,自动选取优惠券
|
||||||
|
3.增加订单归集统计页面,对于商品待发货、已发货、已完成订单统计列表。
|
||||||
|
(1)全部提货点的商品订单统计。
|
||||||
|
(2)各个提货点的商品订单统计。
|
||||||
|
(3)各个提货点对应到人的订单统计。
|
||||||
BIN
docs/xiugai/20230315/营销系统问题及修改20230318.docx
Normal file
BIN
docs/xiugai/20230315/营销系统问题及修改20230318.docx
Normal file
Binary file not shown.
@@ -13,8 +13,10 @@ import com.zscat.mallplus.oms.service.IOmsOrderService;
|
|||||||
import com.zscat.mallplus.oms.vo.*;
|
import com.zscat.mallplus.oms.vo.*;
|
||||||
import com.zscat.mallplus.pms.entity.PmsProduct;
|
import com.zscat.mallplus.pms.entity.PmsProduct;
|
||||||
import com.zscat.mallplus.pms.mapper.PmsProductMapper;
|
import com.zscat.mallplus.pms.mapper.PmsProductMapper;
|
||||||
|
import com.zscat.mallplus.ums.entity.SysMessage;
|
||||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||||
import com.zscat.mallplus.ums.mapper.UmsMemberMapper;
|
import com.zscat.mallplus.ums.mapper.UmsMemberMapper;
|
||||||
|
import com.zscat.mallplus.ums.service.ISysMessageService;
|
||||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -48,6 +50,8 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
|
|||||||
private IOmsOrderOperateHistoryService orderOperateHistoryDao;
|
private IOmsOrderOperateHistoryService orderOperateHistoryDao;
|
||||||
@Resource
|
@Resource
|
||||||
private OmsOrderOperateHistoryMapper orderOperateHistoryMapper;
|
private OmsOrderOperateHistoryMapper orderOperateHistoryMapper;
|
||||||
|
@Resource
|
||||||
|
private ISysMessageService messageService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delivery(List<OmsOrderDeliveryParam> deliveryParamList) {
|
public int delivery(List<OmsOrderDeliveryParam> deliveryParamList) {
|
||||||
@@ -68,9 +72,24 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
orderOperateHistoryDao.saveBatch(operateHistoryList);
|
orderOperateHistoryDao.saveBatch(operateHistoryList);
|
||||||
}
|
}
|
||||||
|
sendPushMsg(deliveryParamList);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void sendPushMsg(List<OmsOrderDeliveryParam> deliveryParamList) {
|
||||||
|
for (OmsOrderDeliveryParam param : deliveryParamList) {
|
||||||
|
OmsOrder omsOrder = baseMapper.selectById(param.getOrderId());
|
||||||
|
if (omsOrder != null && omsOrder.getMemberId() != null) {
|
||||||
|
SysMessage msg = new SysMessage();
|
||||||
|
msg.setUserId(omsOrder.getMemberId().intValue());
|
||||||
|
msg.setCode("交易物流");
|
||||||
|
msg.setParams("您购买的商品已发货");
|
||||||
|
msg.setContent("您在汇融云链购买的,订单号为:" + omsOrder.getOrderSn() + " 的商品已经发货,请在7日内到取货点取货。");
|
||||||
|
messageService.sendToOne(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int singleDelivery(OmsOrderDeliveryParam deliveryParamList) {
|
public int singleDelivery(OmsOrderDeliveryParam deliveryParamList) {
|
||||||
OmsOrder order = new OmsOrder();
|
OmsOrder order = new OmsOrder();
|
||||||
@@ -103,7 +122,6 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object dayStatic(String date, Integer type) {
|
public Object dayStatic(String date, Integer type) {
|
||||||
List<OmsOrder> orders = orderMapper.listByDate(date, type);
|
List<OmsOrder> orders = orderMapper.listByDate(date, type);
|
||||||
@@ -166,22 +184,22 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
|
|||||||
@Override
|
@Override
|
||||||
public Object getOrderTimeData(Integer status) {
|
public Object getOrderTimeData(Integer status) {
|
||||||
BigDecimal nowOrderPay = new BigDecimal(0); //销售总额
|
BigDecimal nowOrderPay = new BigDecimal(0); //销售总额
|
||||||
List<OmsOrder> orders =null;
|
List<OmsOrder> orders = null;
|
||||||
Map<Long,Object> memberMap =new HashMap<>();
|
Map<Long, Object> memberMap = new HashMap<>();
|
||||||
if (status==0){
|
if (status == 0) {
|
||||||
orders = orderMapper.selectList(new QueryWrapper<OmsOrder>());
|
orders = orderMapper.selectList(new QueryWrapper<OmsOrder>());
|
||||||
}else {
|
} else {
|
||||||
orders = orderMapper.selectList(new QueryWrapper<OmsOrder>().eq("status",status));
|
orders = orderMapper.selectList(new QueryWrapper<OmsOrder>().eq("status", status));
|
||||||
}
|
}
|
||||||
for (OmsOrder order : orders) {
|
for (OmsOrder order : orders) {
|
||||||
memberMap.put(order.getMemberId(),order.getId());
|
memberMap.put(order.getMemberId(), order.getId());
|
||||||
nowOrderPay = nowOrderPay.add(order.getPayAmount());
|
nowOrderPay = nowOrderPay.add(order.getPayAmount());
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap();
|
Map<String, Object> map = new HashMap();
|
||||||
map.put("orderCount", orders.size());
|
map.put("orderCount", orders.size());
|
||||||
map.put("orderPay", nowOrderPay);
|
map.put("orderPay", nowOrderPay);
|
||||||
map.put("memberCount", memberMap.size());
|
map.put("memberCount", memberMap.size());
|
||||||
// map.put("femallount", femallount);
|
// map.put("femallount", femallount);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,12 +287,12 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OrderStstic> listOrderGroupByStatus(Integer status){
|
public List<OrderStstic> listOrderGroupByStatus(Integer status) {
|
||||||
return orderMapper.listOrderGroupByStatus(status);
|
return orderMapper.listOrderGroupByStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map orderMonthStatic(String date, Integer status){
|
public Map orderMonthStatic(String date, Integer status) {
|
||||||
return orderMapper.orderMonthStatic(date,status);
|
return orderMapper.orderMonthStatic(date, status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.zscat.mallplus.ums.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.zscat.mallplus.annotation.SysLog;
|
||||||
|
import com.zscat.mallplus.ums.entity.SysMessageTask;
|
||||||
|
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||||
|
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
||||||
|
import com.zscat.mallplus.ums.service.SysMessageTaskService;
|
||||||
|
import com.zscat.mallplus.util.StringUtils;
|
||||||
|
import com.zscat.mallplus.utils.CommonResult;
|
||||||
|
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
|
import org.slf4j.ILoggerFactory;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController("com.zscat.mallplus.ums.controller.SysMessageTaskRest")
|
||||||
|
@RequestMapping("/ums/sysMessageTask")
|
||||||
|
public class SysMessageTaskRest {
|
||||||
|
|
||||||
|
private static final Logger L = LoggerFactory.getLogger(SysMessageTaskRest.class);
|
||||||
|
@Resource
|
||||||
|
private SysMessageTaskService sysMessageTaskService;
|
||||||
|
|
||||||
|
@GetMapping(value = "/list")
|
||||||
|
public Object listByPage(
|
||||||
|
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
QueryWrapper<SysMessageTask> qw = new QueryWrapper<>();
|
||||||
|
qw.orderByDesc("sendtime");
|
||||||
|
IPage<SysMessageTask> page = sysMessageTaskService.page(new Page<SysMessageTask>(pageNum, pageSize), qw);
|
||||||
|
return new CommonResult().success(page);
|
||||||
|
} catch (Exception e) {
|
||||||
|
L.error("根据条件查询所有会员表列表:%s", e.getMessage(), e);
|
||||||
|
}
|
||||||
|
return new CommonResult().failed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/create")
|
||||||
|
public Object saveTask(@RequestBody SysMessageTask entity) {
|
||||||
|
try {
|
||||||
|
entity.setId(null);
|
||||||
|
if (sysMessageTaskService.save(entity)) {
|
||||||
|
return new CommonResult().success();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
L.error("保存定时消息表:%s", e.getMessage(), e);
|
||||||
|
return new CommonResult().failed();
|
||||||
|
}
|
||||||
|
return new CommonResult().failed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/delete/{id}")
|
||||||
|
public Object deleteUmsMember(@PathVariable Integer id) {
|
||||||
|
try {
|
||||||
|
System.out.println("KKKKKKKKK: "+id);
|
||||||
|
if (ValidatorUtils.empty(id)) {
|
||||||
|
return new CommonResult().paramFailed("定时消息表id");
|
||||||
|
}
|
||||||
|
if (sysMessageTaskService.removeById(id)) {
|
||||||
|
return new CommonResult().success();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
L.error("删除定时消息表:%s", e.getMessage(), e);
|
||||||
|
return new CommonResult().failed();
|
||||||
|
}
|
||||||
|
return new CommonResult().failed();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zscat.mallplus.ums.service;
|
package com.zscat.mallplus.ums.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.zscat.mallplus.ums.entity.SysMessage;
|
||||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@@ -22,4 +23,8 @@ public interface IUmsMemberService extends IService<UmsMember> {
|
|||||||
Map memberMonthStatic( String date);
|
Map memberMonthStatic( String date);
|
||||||
|
|
||||||
List<UmsMember> listAll();
|
List<UmsMember> listAll();
|
||||||
|
|
||||||
|
String fetchPhoneById(Integer userId);
|
||||||
|
|
||||||
|
List<String> listPhoneByIdList(List<Integer> userIdList);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.zscat.mallplus.ums.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.zscat.mallplus.ums.entity.SysMessageTask;
|
||||||
|
import com.zscat.mallplus.ums.mapper.SysMessageTaskMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SysMessageTaskService extends ServiceImpl<SysMessageTaskMapper, SysMessageTask> {
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.zscat.mallplus.ums.service.impl;
|
package com.zscat.mallplus.ums.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zscat.mallplus.ums.entity.SysMessage;
|
import com.zscat.mallplus.ums.entity.SysMessage;
|
||||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||||
@@ -7,9 +10,13 @@ import com.zscat.mallplus.ums.mapper.SysMessageMapper;
|
|||||||
import com.zscat.mallplus.ums.service.ISysMessageService;
|
import com.zscat.mallplus.ums.service.ISysMessageService;
|
||||||
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
import com.zscat.mallplus.ums.service.IUmsMemberService;
|
||||||
import com.zscat.mallplus.ums.vo.SysMessageSendSelectVo;
|
import com.zscat.mallplus.ums.vo.SysMessageSendSelectVo;
|
||||||
|
import com.zscat.mallplus.unipush.UniPushService;
|
||||||
|
import com.zscat.mallplus.unipush.entity.PushCids;
|
||||||
|
import com.zscat.mallplus.unipush.mapper.PushCidsMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -26,32 +33,47 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IUmsMemberService memberService;
|
private IUmsMemberService memberService;
|
||||||
|
@Resource
|
||||||
|
private PushCidsMapper pushCidsMapper;
|
||||||
|
@Resource
|
||||||
|
private UniPushService uniPushService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendToOne(SysMessage entity) {
|
public boolean sendToOne(SysMessage entity) {
|
||||||
entity.setId(null);
|
entity.setId(null);
|
||||||
|
sendPushToOne(entity);
|
||||||
return this.save(entity);
|
return this.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendToAll(SysMessage entity) {
|
public boolean sendToAll(SysMessage entity) {
|
||||||
List<UmsMember> memberList = memberService.listAll();
|
|
||||||
// List<SysMessage> messList = new ArrayList<>();
|
sendPushToAll(entity);
|
||||||
for (UmsMember member : memberList) {
|
|
||||||
// SysMessage
|
// List<UmsMember> memberList = memberService.listAll();
|
||||||
entity.setId(null);
|
//// List<SysMessage> messList = new ArrayList<>();
|
||||||
Integer id = Math.toIntExact(member.getId());
|
// for (UmsMember member : memberList) {
|
||||||
entity.setUserId(id);
|
//// SysMessage
|
||||||
// messList.add(en)
|
// entity.setId(null);
|
||||||
this.save(entity);
|
// Integer id = Math.toIntExact(member.getId());
|
||||||
}
|
// entity.setUserId(id);
|
||||||
|
//// messList.add(en)
|
||||||
|
// this.save(entity);
|
||||||
|
// }
|
||||||
|
entity.setId(null);
|
||||||
|
entity.setUserId(1);
|
||||||
|
this.save(entity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean sendToSelect(SysMessageSendSelectVo vo) {
|
public boolean sendToSelect(SysMessageSendSelectVo vo) {
|
||||||
|
|
||||||
SysMessage entity = vo.getSysMessage();
|
SysMessage entity = vo.getSysMessage();
|
||||||
List<Integer> userIdList = vo.getUserIdList();
|
List<Integer> userIdList = vo.getUserIdList();
|
||||||
|
|
||||||
|
sendPushToList(entity, userIdList);
|
||||||
|
|
||||||
for (Integer memberId : userIdList) {
|
for (Integer memberId : userIdList) {
|
||||||
entity.setId(null);
|
entity.setId(null);
|
||||||
entity.setUserId(memberId);
|
entity.setUserId(memberId);
|
||||||
@@ -66,9 +88,60 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
|||||||
entity.setId(null);
|
entity.setId(null);
|
||||||
entity.setCode("交易物流");
|
entity.setCode("交易物流");
|
||||||
entity.setParams("货物已发出");
|
entity.setParams("货物已发出");
|
||||||
entity.setContent("你的订单号码为:"+orderNo+" 的货物已经发出,请您留意物流信息!");
|
entity.setContent("你的订单号码为:" + orderNo + " 的货物已经发出,请您留意物流信息!");
|
||||||
entity.setUserId(userId);
|
entity.setUserId(userId);
|
||||||
this.save(entity);
|
this.save(entity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void sendPushToOne(SysMessage sysMessage) {
|
||||||
|
Integer userId = sysMessage.getUserId();
|
||||||
|
if (userId == null)
|
||||||
|
return;
|
||||||
|
if (userId.equals(1)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String phone = memberService.fetchPhoneById(userId);
|
||||||
|
if (StrUtil.isNotBlank(phone)) {
|
||||||
|
List<String> cids = listPushCidByPhone(phone);
|
||||||
|
uniPushService.sendPushAsync(sysMessage, cids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> listPushCidByPhone(String phone) {
|
||||||
|
QueryWrapper<PushCids> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("userPhone", phone);
|
||||||
|
List<PushCids> list = pushCidsMapper.selectList(qw);
|
||||||
|
List<String> cids = new ArrayList<>();
|
||||||
|
list.forEach(ent -> cids.add(ent.getGetuiCid()));
|
||||||
|
return cids;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> listPushCidByPhoneList(List<String> phoneList) {
|
||||||
|
QueryWrapper<PushCids> qw = new QueryWrapper<>();
|
||||||
|
qw.in("userPhone", phoneList);
|
||||||
|
List<PushCids> list = pushCidsMapper.selectList(qw);
|
||||||
|
List<String> cids = new ArrayList<>();
|
||||||
|
list.forEach(ent -> cids.add(ent.getGetuiCid()));
|
||||||
|
return cids;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> listPushCidAll() {
|
||||||
|
List<PushCids> list = pushCidsMapper.selectList(new QueryWrapper<>());
|
||||||
|
List<String> cids = new ArrayList<>();
|
||||||
|
list.forEach(ent -> cids.add(ent.getGetuiCid()));
|
||||||
|
return cids;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendPushToList(SysMessage sysMessage, List<Integer> userIdList) {
|
||||||
|
List<String> phoneList = memberService.listPhoneByIdList(userIdList);
|
||||||
|
List<String> cids = listPushCidByPhoneList(phoneList);
|
||||||
|
uniPushService.sendPushAsync(sysMessage, cids);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendPushToAll(SysMessage sysMessage) {
|
||||||
|
List<String> cids = listPushCidAll();
|
||||||
|
uniPushService.sendPushAsync(sysMessage, cids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map memberMonthStatic(@Param("date") String date){
|
public Map memberMonthStatic(@Param("date") String date) {
|
||||||
return memberMapper.memberMonthStatic(date);
|
return memberMapper.memberMonthStatic(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,4 +64,25 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
|||||||
public List<UmsMember> listAll() {
|
public List<UmsMember> listAll() {
|
||||||
return baseMapper.selectList(new QueryWrapper<UmsMember>());
|
return baseMapper.selectList(new QueryWrapper<UmsMember>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String fetchPhoneById(Integer userId) {
|
||||||
|
UmsMember um = baseMapper.selectById(userId);
|
||||||
|
if (um == null)
|
||||||
|
return null;
|
||||||
|
String userPhone = um.getUsername();
|
||||||
|
return userPhone;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> listPhoneByIdList(List<Integer> userIdList) {
|
||||||
|
QueryWrapper<UmsMember> qw = new QueryWrapper<>();
|
||||||
|
qw.in("id", userIdList);
|
||||||
|
List<UmsMember> memberList = baseMapper.selectList(qw);
|
||||||
|
List<String> phoneList = new ArrayList<>();
|
||||||
|
memberList.forEach(mem -> phoneList.add(mem.getUsername()));
|
||||||
|
return phoneList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zscat.mallplus.unipush;
|
package com.zscat.mallplus.unipush;
|
||||||
|
|
||||||
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.getui.push.v2.sdk.ApiHelper;
|
import com.getui.push.v2.sdk.ApiHelper;
|
||||||
import com.getui.push.v2.sdk.GtApiConfiguration;
|
import com.getui.push.v2.sdk.GtApiConfiguration;
|
||||||
@@ -228,6 +229,10 @@ public class UniPushService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendPushAsync(SysMessage mess, List<String> cids) {
|
||||||
|
ThreadUtil.execute(() -> sendPush(mess, cids));
|
||||||
|
}
|
||||||
|
|
||||||
private void sendSingleMsg(PushMessage pushMessage, String cid, int index) {
|
private void sendSingleMsg(PushMessage pushMessage, String cid, int index) {
|
||||||
PushDTO<Audience> pushDTO = new PushDTO<Audience>();
|
PushDTO<Audience> pushDTO = new PushDTO<Audience>();
|
||||||
pushDTO.setRequestId("" + System.currentTimeMillis() + index);
|
pushDTO.setRequestId("" + System.currentTimeMillis() + index);
|
||||||
@@ -235,7 +240,7 @@ public class UniPushService {
|
|||||||
Audience audience = new Audience();
|
Audience audience = new Audience();
|
||||||
audience.addCid(cid);
|
audience.addCid(cid);
|
||||||
pushDTO.setAudience(audience);
|
pushDTO.setAudience(audience);
|
||||||
ApiResult<Map<String, Map<String, String>>> apiResult = pushApi.pushToSingleByCid(pushDTO);
|
ApiResult<Map<String, Map<String, String>>> apiResult = singlePushApi().pushToSingleByCid(pushDTO);
|
||||||
if (apiResult.isSuccess()) {
|
if (apiResult.isSuccess()) {
|
||||||
System.out.println(apiResult.getData());
|
System.out.println(apiResult.getData());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.zscat.mallplus.ums.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@TableName("sys_message_task")
|
||||||
|
public class SysMessageTask implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
@TableField("user_id")
|
||||||
|
private Integer userId = 1;
|
||||||
|
/**
|
||||||
|
* 消息编码
|
||||||
|
*/
|
||||||
|
private String code = "系统消息";
|
||||||
|
/**
|
||||||
|
* 参数
|
||||||
|
*/
|
||||||
|
private String params;
|
||||||
|
/**
|
||||||
|
* 内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
private Date sendtime;
|
||||||
|
private int status = 0;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(Integer userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParams() {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParams(String params) {
|
||||||
|
this.params = params;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getSendtime() {
|
||||||
|
return sendtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSendtime(Date sendtime) {
|
||||||
|
this.sendtime = sendtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.zscat.mallplus.ums.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.zscat.mallplus.ums.entity.SysMessageTask;
|
||||||
|
|
||||||
|
public interface SysMessageTaskMapper extends BaseMapper<SysMessageTask> {
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ package com.zscat.mallplus.unipush.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.zscat.mallplus.unipush.entity.PushCids;
|
import com.zscat.mallplus.unipush.entity.PushCids;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project: mallplus <br/>
|
* Project: mallplus <br/>
|
||||||
@@ -41,5 +42,6 @@ import com.zscat.mallplus.unipush.entity.PushCids;
|
|||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
|
@Mapper
|
||||||
public interface PushCidsMapper extends BaseMapper<PushCids> {
|
public interface PushCidsMapper extends BaseMapper<PushCids> {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zscat.mallplus.apirest;
|
package com.zscat.mallplus.apirest;
|
||||||
|
|
||||||
import com.zscat.mallplus.oms.entity.OmsCartItem;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.zscat.mallplus.ums.entity.SysMessage;
|
import com.zscat.mallplus.ums.entity.SysMessage;
|
||||||
import com.zscat.mallplus.ums.entity.UmsMember;
|
import com.zscat.mallplus.ums.entity.UmsMember;
|
||||||
import com.zscat.mallplus.ums.service.ISysMessageService;
|
import com.zscat.mallplus.ums.service.ISysMessageService;
|
||||||
@@ -11,11 +12,8 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Api(tags = "SysMessageRest", description = "系统消息")
|
@Api(tags = "SysMessageRest", description = "系统消息")
|
||||||
@@ -31,14 +29,17 @@ public class SysMessageRest {
|
|||||||
@ApiOperation("获取某个会员的消息列表")
|
@ApiOperation("获取某个会员的消息列表")
|
||||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public Object list() {
|
public Object list(
|
||||||
|
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
|
||||||
|
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum) {
|
||||||
UmsMember umsMember = memberService.getNewCurrentMember();
|
UmsMember umsMember = memberService.getNewCurrentMember();
|
||||||
List<SysMessage> list = new ArrayList<>();
|
IPage<SysMessage> page = new Page<>(pageNum, pageSize);
|
||||||
if (umsMember != null && umsMember.getId() != null) {
|
if (umsMember != null && umsMember.getId() != null) {
|
||||||
list = messageService.listByUserId(umsMember.getId());
|
page = messageService.listPageByUserId(umsMember.getId(), page);
|
||||||
return new CommonResult().success(list);
|
} else {
|
||||||
|
page = messageService.listPageOfSys(page);
|
||||||
}
|
}
|
||||||
return new CommonResult().success(list);
|
return new CommonResult().success(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("获取消息内容")
|
@ApiOperation("获取消息内容")
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zscat.mallplus.ums.service;
|
package com.zscat.mallplus.ums.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.zscat.mallplus.ums.entity.SysMessage;
|
import com.zscat.mallplus.ums.entity.SysMessage;
|
||||||
|
|
||||||
@@ -18,4 +19,8 @@ public interface ISysMessageService extends IService<SysMessage> {
|
|||||||
List<SysMessage> listByUserId(Long userId);
|
List<SysMessage> listByUserId(Long userId);
|
||||||
|
|
||||||
int updateStatus(SysMessage sysMessage);
|
int updateStatus(SysMessage sysMessage);
|
||||||
|
|
||||||
|
IPage<SysMessage> listPageByUserId(Long id, IPage<SysMessage> page);
|
||||||
|
|
||||||
|
IPage<SysMessage> listPageOfSys(IPage<SysMessage> page);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zscat.mallplus.ums.service.impl;
|
package com.zscat.mallplus.ums.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zscat.mallplus.ums.entity.SysMessage;
|
import com.zscat.mallplus.ums.entity.SysMessage;
|
||||||
import com.zscat.mallplus.ums.mapper.SysMessageMapper;
|
import com.zscat.mallplus.ums.mapper.SysMessageMapper;
|
||||||
@@ -34,4 +35,22 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
|||||||
baseMapper.updateById(sysMessage);
|
baseMapper.updateById(sysMessage);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<SysMessage> listPageByUserId(Long userId, IPage<SysMessage> page) {
|
||||||
|
QueryWrapper<SysMessage> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("store_id", 1);
|
||||||
|
qw.and(wrapper -> wrapper.eq("user_id", userId).or().eq("user_id", 1));
|
||||||
|
qw.orderByDesc("ctime");
|
||||||
|
return this.page(page, qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<SysMessage> listPageOfSys(IPage<SysMessage> page) {
|
||||||
|
QueryWrapper<SysMessage> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("store_id", 1);
|
||||||
|
qw.eq("user_id", 1);
|
||||||
|
qw.orderByDesc("ctime");
|
||||||
|
return this.page(page, qw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,9 +94,20 @@ public class PushCidsService extends ServiceImpl<PushCidsMapper, PushCids> {
|
|||||||
public void unbindPhone(String cid) {
|
public void unbindPhone(String cid) {
|
||||||
if (StrUtil.isBlank(cid))
|
if (StrUtil.isBlank(cid))
|
||||||
return;
|
return;
|
||||||
UpdateWrapper<PushCids> uw = new UpdateWrapper<>();
|
|
||||||
uw.set("userPhone", "");
|
PushCids pushCids = fetchByCid(cid);
|
||||||
uw.eq("getuiCid", cid);
|
if (pushCids != null) {
|
||||||
baseMapper.update(null, uw);
|
pushCids.setUserPhone("");
|
||||||
|
baseMapper.updateById(pushCids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PushCids fetchByCid(String cid) {
|
||||||
|
QueryWrapper<PushCids> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("getuiCid", cid);
|
||||||
|
List<PushCids> list = baseMapper.selectList(qw);
|
||||||
|
if (list == null || list.isEmpty())
|
||||||
|
return null;
|
||||||
|
return list.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
83
mallplusui-web-admin/src/api/ums/sysMessageTask.js
Normal file
83
mallplusui-web-admin/src/api/ums/sysMessageTask.js
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
export function fetchList(params) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/list',
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function createMessageTask(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/create',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteMessageTask(id) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/delete/' + id,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function updateShowStatus(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/update/showStatus',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateFactoryStatus(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/update/factoryStatus',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getMember(id) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/' + id,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function updateMember(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/update',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function updateMemberOrderInfo() {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/updateMemberOrderInfo',
|
||||||
|
method: 'post'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function fetchBlanceList(id) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/fetchBlanceList/' + id,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handleEditBlance(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/handleEditBlance',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function handleEditIntegration(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ums/sysMessageTask/handleEditIntegration',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1140,8 +1140,15 @@ export const constantRouterMap = [{
|
|||||||
icon: 'home'
|
icon: 'home'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
path: 'sysMessageTask',
|
||||||
|
name: 'sysMessageTask',
|
||||||
|
component: () => import('@/views/ums/sysMessageTask/index'),
|
||||||
|
meta: {
|
||||||
|
title: '定时消息',
|
||||||
|
icon: 'product-list'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'member',
|
path: 'member',
|
||||||
name: 'member',
|
name: 'member',
|
||||||
|
|||||||
@@ -211,12 +211,12 @@
|
|||||||
<el-dialog title="向指定会员发送信息" :visible.sync="dialogVisibleMessOne" width="40%">
|
<el-dialog title="向指定会员发送信息" :visible.sync="dialogVisibleMessOne" width="40%">
|
||||||
<el-form :model="msgOne" :rules="msgOneRules" ref="msgOneFrom" label-width="150px">
|
<el-form :model="msgOne" :rules="msgOneRules" ref="msgOneFrom" label-width="150px">
|
||||||
<el-form-item label="会员:">向账号为 {{msgOne.membername}} 的会员发送信息</el-form-item>
|
<el-form-item label="会员:">向账号为 {{msgOne.membername}} 的会员发送信息</el-form-item>
|
||||||
<el-form-item label="信息类型:" prop="code">
|
<!-- <el-form-item label="信息类型:" prop="code">
|
||||||
<el-select v-model="msgOne.code" placeholder="请选择">
|
<el-select v-model="msgOne.code" placeholder="请选择">
|
||||||
<el-option v-for="item in messageCodeOptions" :key="item.value" :label="item.label"
|
<el-option v-for="item in messageCodeOptions" :key="item.value" :label="item.label"
|
||||||
:value="item.value"></el-option>
|
:value="item.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="标题:" prop="params">
|
<el-form-item label="标题:" prop="params">
|
||||||
<el-input v-model="msgOne.params"></el-input>
|
<el-input v-model="msgOne.params"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -234,12 +234,12 @@
|
|||||||
<el-dialog title="向选择会员发送信息" :visible.sync="dialogVisibleMessSelect" width="40%">
|
<el-dialog title="向选择会员发送信息" :visible.sync="dialogVisibleMessSelect" width="40%">
|
||||||
<el-form :model="msgOne" :rules="msgOneRules" ref="msgSelectFrom" label-width="150px">
|
<el-form :model="msgOne" :rules="msgOneRules" ref="msgSelectFrom" label-width="150px">
|
||||||
<el-form-item label=""> 向所选择的会员发送信息!</el-form-item>
|
<el-form-item label=""> 向所选择的会员发送信息!</el-form-item>
|
||||||
<el-form-item label="信息类型:" prop="code">
|
<!-- <el-form-item label="信息类型:" prop="code">
|
||||||
<el-select v-model="msgOne.code" placeholder="请选择">
|
<el-select v-model="msgOne.code" placeholder="请选择">
|
||||||
<el-option v-for="item in messageCodeOptions" :key="item.value" :label="item.label"
|
<el-option v-for="item in messageCodeOptions" :key="item.value" :label="item.label"
|
||||||
:value="item.value"></el-option>
|
:value="item.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="标题:" prop="params">
|
<el-form-item label="标题:" prop="params">
|
||||||
<el-input v-model="msgOne.params"></el-input>
|
<el-input v-model="msgOne.params"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -257,12 +257,12 @@
|
|||||||
<el-dialog title="向所有会员发送信息" :visible.sync="dialogVisibleMessAll" width="40%">
|
<el-dialog title="向所有会员发送信息" :visible.sync="dialogVisibleMessAll" width="40%">
|
||||||
<el-form :model="msgOne" :rules="msgOneRules" ref="msgAllFrom" label-width="150px">
|
<el-form :model="msgOne" :rules="msgOneRules" ref="msgAllFrom" label-width="150px">
|
||||||
<el-form-item label=""> 向所有的会员发送信息!</el-form-item>
|
<el-form-item label=""> 向所有的会员发送信息!</el-form-item>
|
||||||
<el-form-item label="信息类型:" prop="code">
|
<!-- <el-form-item label="信息类型:" prop="code">
|
||||||
<el-select v-model="msgOne.code" placeholder="请选择">
|
<el-select v-model="msgOne.code" placeholder="请选择">
|
||||||
<el-option v-for="item in messageCodeOptions" :key="item.value" :label="item.label"
|
<el-option v-for="item in messageCodeOptions" :key="item.value" :label="item.label"
|
||||||
:value="item.value"></el-option>
|
:value="item.value"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item> -->
|
||||||
<el-form-item label="标题:" prop="params">
|
<el-form-item label="标题:" prop="params">
|
||||||
<el-input v-model="msgOne.params"></el-input>
|
<el-input v-model="msgOne.params"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@@ -540,8 +540,8 @@
|
|||||||
this.dialogVisibleMessSelect = false
|
this.dialogVisibleMessSelect = false
|
||||||
},
|
},
|
||||||
sendMessageToAll() {
|
sendMessageToAll() {
|
||||||
this.msgOne.userId = null
|
this.msgOne.userId = 1
|
||||||
this.msgOne.code = '云链助手'
|
this.msgOne.code = '系统消息'
|
||||||
this.msgOne.params = ''
|
this.msgOne.params = ''
|
||||||
this.msgOne.content = ''
|
this.msgOne.content = ''
|
||||||
this.msgOne.membername = ''
|
this.msgOne.membername = ''
|
||||||
@@ -571,8 +571,8 @@
|
|||||||
},
|
},
|
||||||
sendMessageToAllReset() {
|
sendMessageToAllReset() {
|
||||||
this.$refs['msgAllFrom'].resetFields();
|
this.$refs['msgAllFrom'].resetFields();
|
||||||
this.msgOne.userId = null
|
this.msgOne.userId = 1
|
||||||
this.msgOne.code = '云链助手'
|
this.msgOne.code = '系统消息'
|
||||||
this.msgOne.params = ''
|
this.msgOne.params = ''
|
||||||
this.msgOne.content = ''
|
this.msgOne.content = ''
|
||||||
this.msgOne.membername = ''
|
this.msgOne.membername = ''
|
||||||
|
|||||||
210
mallplusui-web-admin/src/views/ums/sysMessageTask/index.vue
Normal file
210
mallplusui-web-admin/src/views/ums/sysMessageTask/index.vue
Normal file
@@ -0,0 +1,210 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container" style="margin-right: 10px;">
|
||||||
|
<div class="listconadd">
|
||||||
|
<el-card class="operate-container" shadow="never">
|
||||||
|
<i class="el-icon-tickets"></i>
|
||||||
|
<span>定时消息列表</span>
|
||||||
|
<el-button type="primary" class="btn-add" @click="sendMessageToOne()" size="mini">新增定时消息</el-button>
|
||||||
|
</el-card>
|
||||||
|
<div class="table-container">
|
||||||
|
<el-table ref="brandTable" :data="list" style="width: 100%" v-loading="listLoading" border>
|
||||||
|
<!-- <el-table-column label="编号" width="80" align="center" prop="id" /> -->
|
||||||
|
<el-table-column label="标题" width="180" prop="params" align="center" />
|
||||||
|
<el-table-column label="内容" prop="content" />
|
||||||
|
<el-table-column label="发送时间" width="180" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.sendtime | formatTime }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="发送状态" width="100" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
{{ scope.row.status | formatStatus }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" width="250" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</div>
|
||||||
|
<div class="batch-operate-container"></div>
|
||||||
|
<div class="pagination-container">
|
||||||
|
<el-pagination
|
||||||
|
background
|
||||||
|
@size-change="handleSizeChange"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
layout="total, sizes,prev, pager, next,jumper"
|
||||||
|
:page-size="listQuery.pageSize"
|
||||||
|
:page-sizes="[5, 10, 15]"
|
||||||
|
:current-page.sync="listQuery.pageNum"
|
||||||
|
:total="total"
|
||||||
|
></el-pagination>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<el-dialog title="新增定时消息" :visible.sync="dialogVisibleMessOne" width="40%">
|
||||||
|
<el-form :model="msgOne" :rules="msgOneRules" ref="msgOneFrom" label-width="150px">
|
||||||
|
<el-form-item label="设定发送时间:" prop="sendtime"><el-date-picker v-model="msgOne.sendtime" type="datetime" placeholder="选择日期时间"></el-date-picker></el-form-item>
|
||||||
|
<el-form-item label="标题:" prop="params"><el-input v-model="msgOne.params"></el-input></el-form-item>
|
||||||
|
<el-form-item label="信息内容:" prop="content"><el-input type="textarea" :rows="3" v-model="msgOne.content"></el-input></el-form-item>
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="sendMessageToOneReset">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="sendMessageToOneSubmit">确 定</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { formatDate } from '@/utils/date'
|
||||||
|
import { fetchList, createMessageTask, deleteMessageTask } from '@/api/ums/sysMessageTask'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'sysMessageTaskList',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisibleMessOne: false,
|
||||||
|
msgOne: {
|
||||||
|
userId: 1,
|
||||||
|
code: '',
|
||||||
|
params: '',
|
||||||
|
content: '',
|
||||||
|
sendtime: '',
|
||||||
|
status: 0
|
||||||
|
},
|
||||||
|
msgOneRules: {
|
||||||
|
sendtime: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请选择日期时间',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
params: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入信息标题',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
content: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '信息内容不能为空',
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
listQuery: {
|
||||||
|
keyword: null,
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10
|
||||||
|
},
|
||||||
|
list: null,
|
||||||
|
total: null,
|
||||||
|
listLoading: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
formatTime(time) {
|
||||||
|
if (time == null || time === '') {
|
||||||
|
return 'N/A'
|
||||||
|
}
|
||||||
|
let date = new Date(time)
|
||||||
|
return formatDate(date, 'yyyy-MM-dd hh:mm:ss')
|
||||||
|
},
|
||||||
|
formatStatus(value) {
|
||||||
|
if (value === 0) {
|
||||||
|
return '未发送'
|
||||||
|
}
|
||||||
|
return '已发送'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
sendMessageToOne() {
|
||||||
|
this.msgOne.userId = 1
|
||||||
|
this.msgOne.code = '系统消息'
|
||||||
|
this.msgOne.params = ''
|
||||||
|
this.msgOne.content = ''
|
||||||
|
this.msgOne.sendtime = ''
|
||||||
|
this.msgOne.status = 0
|
||||||
|
this.dialogVisibleMessOne = true
|
||||||
|
},
|
||||||
|
sendMessageToOneSubmit() {
|
||||||
|
let _this = this
|
||||||
|
this.$refs['msgOneFrom'].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
createMessageTask(_this.msgOne).then(response => {
|
||||||
|
this.$message({
|
||||||
|
message: '信息设置成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000
|
||||||
|
})
|
||||||
|
_this.getList()
|
||||||
|
_this.sendMessageToOneReset()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
_this.$message({
|
||||||
|
message: '请输入正确的数据',
|
||||||
|
type: 'error',
|
||||||
|
duration: 1000
|
||||||
|
})
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sendMessageToOneReset() {
|
||||||
|
this.$refs['msgOneFrom'].resetFields()
|
||||||
|
this.msgOne.userId = 1
|
||||||
|
this.msgOne.code = '系统消息'
|
||||||
|
this.msgOne.params = ''
|
||||||
|
this.msgOne.content = ''
|
||||||
|
this.msgOne.sendtime = ''
|
||||||
|
this.msgOne.status = 0
|
||||||
|
this.dialogVisibleMessOne = false
|
||||||
|
},
|
||||||
|
getList() {
|
||||||
|
this.listLoading = true
|
||||||
|
if (this.listQuery.keyword == '') this.listQuery.keyword = null
|
||||||
|
|
||||||
|
fetchList(this.listQuery).then(response => {
|
||||||
|
this.listLoading = false
|
||||||
|
this.list = response.data.records
|
||||||
|
this.total = response.data.total
|
||||||
|
this.totalPage = response.data.pages
|
||||||
|
this.pageSize = response.data.size
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleDelete(row) {
|
||||||
|
this.$confirm('是否要删除该记录', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
deleteMessageTask(row.id).then(response => {
|
||||||
|
this.$message({
|
||||||
|
message: '删除成功',
|
||||||
|
type: 'success',
|
||||||
|
duration: 1000
|
||||||
|
})
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.listQuery.pageNum = 1
|
||||||
|
this.listQuery.pageSize = val
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.listQuery.pageNum = val
|
||||||
|
this.getList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scoped></style>
|
||||||
Reference in New Issue
Block a user