Commit 3cf47103 by 吕明尚

客服增加公众号和短信的接收控制

parent f1ad419f
...@@ -10,6 +10,7 @@ import share.common.core.page.TableDataInfo; ...@@ -10,6 +10,7 @@ import share.common.core.page.TableDataInfo;
import share.common.enums.BusinessType; import share.common.enums.BusinessType;
import share.common.utils.poi.ExcelUtil; import share.common.utils.poi.ExcelUtil;
import share.system.domain.ConsumerMember; import share.system.domain.ConsumerMember;
import share.system.domain.vo.ConsumerMemberVo;
import share.system.service.ConsumerMemberService; import share.system.service.ConsumerMemberService;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -32,9 +33,9 @@ public class ConsumerMemberController extends BaseController { ...@@ -32,9 +33,9 @@ public class ConsumerMemberController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:member:list')") @PreAuthorize("@ss.hasPermi('system:member:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(ConsumerMember consumerMember) { public TableDataInfo list(ConsumerMemberVo consumerMember) {
startPage(); startPage();
List<ConsumerMember> list = consumerMemberService.selectConsumerMemberList(consumerMember); List<ConsumerMemberVo> list = consumerMemberService.selectConsumerMemberList(consumerMember);
return getDataTable(list); return getDataTable(list);
} }
...@@ -44,9 +45,9 @@ public class ConsumerMemberController extends BaseController { ...@@ -44,9 +45,9 @@ public class ConsumerMemberController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:member:export')") @PreAuthorize("@ss.hasPermi('system:member:export')")
@Log(title = "会员用户", businessType = BusinessType.EXPORT) @Log(title = "会员用户", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, ConsumerMember consumerMember) { public void export(HttpServletResponse response, ConsumerMemberVo consumerMember) {
List<ConsumerMember> list = consumerMemberService.selectConsumerMemberList(consumerMember); List<ConsumerMemberVo> list = consumerMemberService.selectConsumerMemberList(consumerMember);
ExcelUtil<ConsumerMember> util = new ExcelUtil<ConsumerMember>(ConsumerMember.class); ExcelUtil<ConsumerMemberVo> util = new ExcelUtil<>(ConsumerMemberVo.class);
util.exportExcel(response, list, "会员用户数据"); util.exportExcel(response, list, "会员用户数据");
} }
......
...@@ -5,6 +5,8 @@ public enum PositionEnum { ...@@ -5,6 +5,8 @@ public enum PositionEnum {
//1保洁人员 2管理员 //1保洁人员 2管理员
CLEANER(1, "保洁人员"), CLEANER(1, "保洁人员"),
ADMIN(2, "管理员"), ADMIN(2, "管理员"),
//客服
CUSTOMER_SERVICE(3, "客服");
; ;
private Integer code; private Integer code;
private String name; private String name;
......
...@@ -18,10 +18,10 @@ public class SStoreConsumer { ...@@ -18,10 +18,10 @@ public class SStoreConsumer {
private Integer position; private Integer position;
//电控 //电控 是否接收公众号
private Integer controller; private Integer controller;
//门控 //门控 是否接收短信
private Integer gating; private Integer gating;
} }
package share.system.domain.vo;
import lombok.Data;
import share.system.domain.ConsumerMember;
@Data
public class ConsumerMemberVo extends ConsumerMember {
private String nickName;
private String avatar;
/**
* 用户手机号
*/
private String phone;
}
...@@ -2,6 +2,7 @@ package share.system.mapper; ...@@ -2,6 +2,7 @@ package share.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import share.system.domain.ConsumerMember; import share.system.domain.ConsumerMember;
import share.system.domain.vo.ConsumerMemberVo;
import java.util.List; import java.util.List;
...@@ -26,7 +27,7 @@ public interface ConsumerMemberMapper extends BaseMapper<ConsumerMember> { ...@@ -26,7 +27,7 @@ public interface ConsumerMemberMapper extends BaseMapper<ConsumerMember> {
* @param consumerMember 会员用户 * @param consumerMember 会员用户
* @return 会员用户集合 * @return 会员用户集合
*/ */
public List<ConsumerMember> selectConsumerMemberList(ConsumerMember consumerMember); public List<ConsumerMember> selectConsumerMemberList(ConsumerMemberVo consumerMember);
/** /**
* 新增会员用户 * 新增会员用户
......
...@@ -2,6 +2,7 @@ package share.system.service; ...@@ -2,6 +2,7 @@ package share.system.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import share.system.domain.ConsumerMember; import share.system.domain.ConsumerMember;
import share.system.domain.vo.ConsumerMemberVo;
import java.util.List; import java.util.List;
...@@ -26,7 +27,7 @@ public interface ConsumerMemberService extends IService<ConsumerMember> { ...@@ -26,7 +27,7 @@ public interface ConsumerMemberService extends IService<ConsumerMember> {
* @param consumerMember 会员用户 * @param consumerMember 会员用户
* @return 会员用户集合 * @return 会员用户集合
*/ */
public List<ConsumerMember> selectConsumerMemberList(ConsumerMember consumerMember); public List<ConsumerMemberVo> selectConsumerMemberList(ConsumerMemberVo consumerMember);
/** /**
* 新增会员用户 * 新增会员用户
......
package share.system.service.impl; package share.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
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 share.common.utils.DateUtils; import share.common.utils.DateUtils;
import share.system.domain.ConsumerMember; import share.system.domain.ConsumerMember;
import share.system.domain.SConsumer;
import share.system.domain.vo.ConsumerMemberVo;
import share.system.mapper.ConsumerMemberMapper; import share.system.mapper.ConsumerMemberMapper;
import share.system.service.ConsumerMemberService; import share.system.service.ConsumerMemberService;
import share.system.service.SConsumerService;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 会员用户Service业务层处理 * 会员用户Service业务层处理
...@@ -20,6 +29,8 @@ import java.util.List; ...@@ -20,6 +29,8 @@ import java.util.List;
public class ConsumerMemberServiceImpl extends ServiceImpl<ConsumerMemberMapper, ConsumerMember> implements ConsumerMemberService { public class ConsumerMemberServiceImpl extends ServiceImpl<ConsumerMemberMapper, ConsumerMember> implements ConsumerMemberService {
@Autowired @Autowired
private ConsumerMemberMapper consumerMemberMapper; private ConsumerMemberMapper consumerMemberMapper;
@Autowired
private SConsumerService sConsumerService;
/** /**
* 查询会员用户 * 查询会员用户
...@@ -39,8 +50,24 @@ public class ConsumerMemberServiceImpl extends ServiceImpl<ConsumerMemberMapper, ...@@ -39,8 +50,24 @@ public class ConsumerMemberServiceImpl extends ServiceImpl<ConsumerMemberMapper,
* @return 会员用户 * @return 会员用户
*/ */
@Override @Override
public List<ConsumerMember> selectConsumerMemberList(ConsumerMember consumerMember) { public List<ConsumerMemberVo> selectConsumerMemberList(ConsumerMemberVo consumerMember) {
return consumerMemberMapper.selectConsumerMemberList(consumerMember); List<ConsumerMember> consumerMembers = consumerMemberMapper.selectConsumerMemberList(consumerMember);
Map<Long, SConsumer> sConsumerMap = sConsumerService.list().stream().collect(Collectors.toMap(SConsumer::getId, s -> s));
List<ConsumerMemberVo> voList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(consumerMembers)) {
consumerMembers.stream().forEach(o -> {
ConsumerMemberVo vo = new ConsumerMemberVo();
BeanUtils.copyProperties(o, vo);
SConsumer sConsumer = sConsumerMap.get(o.getConsumerId());
if (ObjectUtil.isNotEmpty(sConsumer)) {
vo.setPhone(sConsumer.getPhone());
vo.setNickName(sConsumer.getNickName());
vo.setAvatar(sConsumer.getAvatar());
}
voList.add(vo);
});
}
return voList;
} }
/** /**
......
...@@ -36,6 +36,7 @@ import share.common.vo.TableDataInfoVo; ...@@ -36,6 +36,7 @@ import share.common.vo.TableDataInfoVo;
import share.system.domain.*; import share.system.domain.*;
import share.system.domain.vo.*; import share.system.domain.vo.*;
import share.system.mapper.SOrderMapper; import share.system.mapper.SOrderMapper;
import share.system.mapper.SStoreConsumerMapper;
import share.system.request.AdminRefundRequest; import share.system.request.AdminRefundRequest;
import share.system.request.CreateOrderRequest; import share.system.request.CreateOrderRequest;
import share.system.request.OrderComputedPriceRequest; import share.system.request.OrderComputedPriceRequest;
...@@ -127,6 +128,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -127,6 +128,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Resource @Resource
private RoomLabelService roomLabelService; private RoomLabelService roomLabelService;
@Autowired
private SStoreConsumerMapper storeConsumerMapper;
private final static Long FIVE = 5l; private final static Long FIVE = 5l;
...@@ -953,12 +957,26 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -953,12 +957,26 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sConsumer.setStoreId(sStore.getId()); sConsumer.setStoreId(sStore.getId());
sConsumer.setPosition(3); sConsumer.setPosition(3);
List<SConsumer> consumers = sConsumerService.selectAllocatedList(sConsumer); List<SConsumer> consumers = sConsumerService.selectAllocatedList(sConsumer);
//获取用户id
List<Long> sconsumerIds = consumers.stream().map(SConsumer::getId).collect(Collectors.toList());
Map<Long, SStoreConsumer> consumerMap = storeConsumerMapper.selectList(new LambdaQueryWrapper<SStoreConsumer>()
.in(SStoreConsumer::getConsumerId, sconsumerIds)
.eq(SStoreConsumer::getPosition, PositionEnum.CUSTOMER_SERVICE.getCode())
.eq(SStoreConsumer::getStoreId, sOrder.getStoreId())
).stream().collect(Collectors.toMap(SStoreConsumer::getConsumerId, Function.identity()));
if (consumers.size() > 0) { if (consumers.size() > 0) {
logger.info("订单预订成功通知发送开始"); logger.info("订单预订成功通知发送开始");
consumers.forEach(o -> { consumers.forEach(o -> {
phones.add(o.getPhone()); SStoreConsumer sStoreConsumer = consumerMap.get(o.getId());
//公众号发送订单预订成功通知 if (ObjectUtil.isNotEmpty(sStoreConsumer)) {
wechatNewService.sendPublicTemplateMessage(sOrder, MessageReminderEnum.ORDER_RESERVE, o.getId()); if (sStoreConsumer.getGating().equals(YesNoEnum.yes.getIndex())) {
phones.add(o.getPhone());
}
if (sStoreConsumer.getController().equals(YesNoEnum.yes.getIndex())) {
//公众号发送订单预订成功通知
wechatNewService.sendPublicTemplateMessage(sOrder, MessageReminderEnum.ORDER_RESERVE, o.getId());
}
}
}); });
smsService.sendSmsOrderPredetermine(phones, sOrder, sStore, room); smsService.sendSmsOrderPredetermine(phones, sOrder, sStore, room);
logger.info("订单预订成功通知发送结束"); logger.info("订单预订成功通知发送结束");
...@@ -1480,12 +1498,25 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1480,12 +1498,25 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sConsumer.setStoreId(sStore.getId()); sConsumer.setStoreId(sStore.getId());
sConsumer.setPosition(3); sConsumer.setPosition(3);
List<SConsumer> consumers = sConsumerService.selectAllocatedList(sConsumer); List<SConsumer> consumers = sConsumerService.selectAllocatedList(sConsumer);
List<Long> sconsumerIds = consumers.stream().map(SConsumer::getId).collect(Collectors.toList());
Map<Long, SStoreConsumer> consumerMap = storeConsumerMapper.selectList(new LambdaQueryWrapper<SStoreConsumer>()
.in(SStoreConsumer::getConsumerId, sconsumerIds)
.eq(SStoreConsumer::getPosition, PositionEnum.CUSTOMER_SERVICE.getCode())
.eq(SStoreConsumer::getStoreId, sOrder.getStoreId())
).stream().collect(Collectors.toMap(SStoreConsumer::getConsumerId, Function.identity()));
if (consumers.size() > 0) { if (consumers.size() > 0) {
logger.info("订单预订成功通知发送开始"); logger.info("订单预订成功通知发送开始");
consumers.forEach(o->{ consumers.forEach(o->{
phones.add(o.getPhone()); SStoreConsumer sStoreConsumer = consumerMap.get(o.getId());
//公众号发送订单预订成功通知 if (ObjectUtil.isNotEmpty(sStoreConsumer)) {
wechatNewService.sendPublicTemplateMessage(sOrder, MessageReminderEnum.ORDER_RESERVE, o.getId()); if (sStoreConsumer.getGating().equals(YesNoEnum.yes.getIndex())) {
phones.add(o.getPhone());
}
if (sStoreConsumer.getController().equals(YesNoEnum.yes.getIndex())) {
//公众号发送订单预订成功通知
wechatNewService.sendPublicTemplateMessage(sOrder, MessageReminderEnum.ORDER_RESERVE, o.getId());
}
}
}); });
smsService.sendSmsOrderPredetermine(phones, sOrder, sStore, sRoom); smsService.sendSmsOrderPredetermine(phones, sOrder, sStore, sRoom);
logger.info("订单预订成功通知发送结束"); logger.info("订单预订成功通知发送结束");
......
...@@ -37,16 +37,33 @@ ...@@ -37,16 +37,33 @@
from s_consumer_member from s_consumer_member
</sql> </sql>
<select id="selectConsumerMemberList" parameterType="ConsumerMember" resultMap="ConsumerMemberResult"> <select id="selectConsumerMemberList" parameterType="ConsumerMemberVo" resultMap="ConsumerMemberResult">
<include refid="selectConsumerMemberVo"/> select m.id,
m.consumer_id,
m. membership_level,
m.member_type,
m.member_config_id,
m.expiration_date,
m.membership_progress,
m.is_delete,
m.create_by,
m.create_time,
m.update_by,
m.update_time,
m.remark
from s_consumer_member m join s_consumer c on m.consumer_id = c.id
<where> <where>
<if test="consumerId != null ">and consumer_id = #{consumerId}</if> <if test="nickName != null and nickName != ''">and c.nick_name like concat('%', #{nickName},'%')
<if test="membershipLevel != null ">and membership_level = #{membershipLevel}</if> </if>
<if test="memberType != null ">and member_type = #{memberType}</if> <if test="phone != null and phone != ''">and c.phone like concat('%', #{phone},'%')
<if test="memberConfigId != null ">and member_config_id = #{memberConfigId}</if> </if>
<if test="expirationDate != null ">and expiration_date = #{expirationDate}</if> <if test="consumerId != null ">and m.consumer_id = #{consumerId}</if>
<if test="membershipProgress != null ">and membership_progress = #{membershipProgress}</if> <if test="membershipLevel != null ">and m.membership_level = #{membershipLevel}</if>
<if test="isDelete != null ">and is_delete = #{isDelete}</if> <if test="memberType != null ">and m.member_type = #{memberType}</if>
<if test="memberConfigId != null ">and m.member_config_id = #{memberConfigId}</if>
<if test="expirationDate != null ">and m.expiration_date = #{expirationDate}</if>
<if test="membershipProgress != null ">and m.membership_progress = #{membershipProgress}</if>
<if test="isDelete != null ">and m.is_delete = #{isDelete}</if>
</where> </where>
</select> </select>
......
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