Commit 92c09319 by 吕明尚

设备权限

parent a290146b
......@@ -186,9 +186,9 @@ public class SStoreController extends BaseController
@PreAuthorize("@ss.hasPermi('system:store:edit')")
@Log(title = "门店", businessType = BusinessType.GRANT)
@PutMapping("/consumer/selectAll")
public AjaxResult selectAuthUserAll(Long storeId, Long[] consumerIds)
public AjaxResult selectAuthUserAll(Long storeId, Long[] consumerIds, Integer position)
{
return toAjax(sStoreService.insertStoreConsumers(storeId, consumerIds));
return toAjax(sStoreService.insertStoreConsumers(storeId, consumerIds, position));
}
......
......@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import share.common.enums.MessageReminderEnum;
import share.system.config.WxMaProperties;
import share.system.domain.vo.SendTemplateMessageItemVo;
import share.system.domain.vo.TemplateMessageVo;
......@@ -19,6 +20,7 @@ import share.system.util.WXMsgPushUtils;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
......@@ -32,6 +34,8 @@ import java.util.Map;
public class WxMsgPushController {
private final WxMaService wxMaService;
private final WxMaProperties properties;
@Autowired
private WechatNewService wechatNewService;
/**
* // * 跳转的小程序页面
* //
......@@ -66,43 +70,81 @@ public class WxMsgPushController {
@GetMapping("/getOpenId")
public void getOpenId(String openId) throws Exception {
// HashMap<String, SendTemplateMessageItemVo> data = new HashMap<>();
// TemplateMessageVo templateMessageVo = new TemplateMessageVo();
// templateMessageVo.setTouser(openId);
// templateMessageVo.setTemplate_id("oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8");
// templateMessageVo.setUrl("http://www.baidu.com");
// data.put("thing4", new SendTemplateMessageItemVo("预约门店"));
// data.put("thing7", new SendTemplateMessageItemVo("服务名称"));
// data.put("date3", new SendTemplateMessageItemVo(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss")));
// data.put("thing5", new SendTemplateMessageItemVo("地址"));
// templateMessageVo.setData(data);
// log.info("开始发送消息!!!!");
// Boolean b = wechatNewService.sendMiniSubscribeMessage(templateMessageVo);
// if(b){
// log.info("消息发送成功!!!!");
// }
HashMap<String, SendTemplateMessageItemVo> data = new HashMap<>();
TemplateMessageVo templateMessageVo = new TemplateMessageVo();
templateMessageVo.setTouser(openId);
templateMessageVo.setMiniprogram_state("trial");
templateMessageVo.setPage("/pages/orderResult/orderResult?orderNo=CJ431705545528576539");
templateMessageVo.setTemplate_id(MessageReminderEnum.END.getValue());
data.put("thing5", new SendTemplateMessageItemVo("武汉"));
//服务名称
data.put("thing6", new SendTemplateMessageItemVo("服务名称"));
//订单时间
data.put("time7", new SendTemplateMessageItemVo("2020-12-12 12:12:12 ~ 2020-12-13 12:12:12"));
//温馨提示
data.put("thing4", new SendTemplateMessageItemVo(MessageReminderEnum.END.getTips()));
templateMessageVo.setData(data);
log.info("开始发送消息!!!!");
Boolean a = wechatNewService.sendMiniSubscribeMessage(templateMessageVo);
if (a) {
log.info("消息发送成功!!!!");
}
Map<String, String> map = new HashMap<>();
map.put("thing4", "预约门店");
map.put("thing7", "服务名称");
map.put("date3", LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss"));
map.put("thing5", "地址");
WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage.builder()
.toUser(openId)
.templateId("oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8")
.page(PAGES_ZP)
.build();
// 设置将推送的消息
map.forEach((k, v) -> {
wxMaSubscribeMessage.addData(new WxMaSubscribeMessage.MsgData(k, v));
});
try {
templateMessageVo.setTemplate_id(MessageReminderEnum.RESERVER.getValue());
//订单门店
data.put("thing3", new SendTemplateMessageItemVo("武汉"));
//服务名称
data.put("thing1", new SendTemplateMessageItemVo("服务名称"));
//订单时间
data.put("date2", new SendTemplateMessageItemVo(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss")));
//温馨提示
data.put("thing6", new SendTemplateMessageItemVo(MessageReminderEnum.RESERVER.getTips()));
log.info("开始发送消息!!!!");
wxMaService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
Boolean b = wechatNewService.sendMiniSubscribeMessage(templateMessageVo);
if (b) {
log.info("消息发送成功!!!!");
} catch (WxErrorException e) {
e.printStackTrace();
}
templateMessageVo.setTemplate_id(MessageReminderEnum.START.getValue());
//预约门店
data.put("thing6", new SendTemplateMessageItemVo("武汉"));
//服务名称
data.put("thing7", new SendTemplateMessageItemVo("服务名称"));
//预约时间
data.put("time8", new SendTemplateMessageItemVo("2024-12-12 12:12:12 ~ 2024-12-13 12:12:12"));
//温馨提示
data.put("thing5", new SendTemplateMessageItemVo(MessageReminderEnum.START.getTips()));
Boolean c = wechatNewService.sendMiniSubscribeMessage(templateMessageVo);
if (c) {
log.info("消息发送成功!!!!");
}
// Map<String, String> data = new HashMap<>();
// data.put("thing5", "订单门店");
// //服务名称
// data.put("thin6", "服务名称");
// //订单时间
// data.put("time7", new Date().toString());
// //温馨提示
// data.put("thing4", MessageReminderEnum.RESERVER.getTips());
// WxMaSubscribeMessage wxMaSubscribeMessage = WxMaSubscribeMessage.builder()
// .toUser(openId)
// .templateId("UkvsRnZkZB_w3MqXPbRhi4jEk8ML4N9PWT3rnd3Bhxg")
// .page(PAGES_ZP)
// .build();
// // 设置将推送的消息
// data.forEach((k, v) -> {
// wxMaSubscribeMessage.addData(new WxMaSubscribeMessage.MsgData(k, v));
// });
// try {
// log.info("开始发送消息!!!!");
// wxMaService.getMsgService().sendSubscribeMsg(wxMaSubscribeMessage);
// log.info("消息发送成功!!!!");
// } catch (WxErrorException e) {
// e.printStackTrace();
// }
}
}
......@@ -79,15 +79,11 @@ public class SStoreController extends BaseController
}
/**
* 查询全部门店及全部房间,每个房间绑定的设备列表
* 用户负责的门店设备
*/
@GetMapping("/storeList")
@GetMapping("/storeListByConsumer")
@ApiOperation(value = "查询全部门店及全部房间,每个房间绑定的设备列表")
public AjaxResult storeList() {
return success(sStoreService.storeList());
}
}
......@@ -14,4 +14,6 @@ public class SConsumerVo extends SConsumer {
private Long storeId;
private Integer position;
}
......@@ -34,7 +34,7 @@ public interface SStoreConsumerMapper extends BaseMapper<SStoreConsumer> {
public int deleteInfos(@Param("storeId") Long storeId, @Param("consumerIds") Long[] consumerIds);
List<Long> selectByConsumerId(Long id, Integer position);
List<Long> selectByConsumerId(@Param("consumerId") Long consumerId, @Param("position") Integer position);
List<SStoreConsumer> queryByConsumerId(Long id);
}
......@@ -92,7 +92,7 @@ public interface ISStoreService extends IService<SStore>
int deleteStoreConsumers(Long storeId, Long[] consumerIds);
int insertStoreConsumers(Long storeId, Long[] consumerIds);
int insertStoreConsumers(Long storeId, Long[] consumerIds, Integer position);
List<SStore> listVoByCleaner();
......
......@@ -351,14 +351,14 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
}
@Override
public int insertStoreConsumers(Long storeId, Long[] consumerIds) {
public int insertStoreConsumers(Long storeId, Long[] consumerIds, Integer position) {
// 新增保洁与门店关系
List<SStoreConsumer> list = new ArrayList<SStoreConsumer>();
for (Long consumerId : consumerIds) {
SStoreConsumer sc = new SStoreConsumer();
sc.setStoreId(storeId);
sc.setConsumerId(consumerId);
sc.setPosition(PositionEnum.CLEANER.getCode());
sc.setPosition(position);
list.add(sc);
}
return storeConsumerMapper.batchSStoreConsumer(list);
......@@ -448,8 +448,14 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
public List<SStoreVo> storeList() {
//查询所有门店
List<SStore> sStores = baseMapper.selectSStoreList(new SStore());
//获取所有门店id
List<Long> storeIds = sStores.stream().map(SStore::getId).collect(Collectors.toList());
SConsumer user = consumerService.getInfo();
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new BaseException("当前用户不是店员!");
}
List<Long> storeIds = storeConsumerMapper.selectByConsumerId(user.getId(), PositionEnum.CLEANER.getCode());
if (CollectionUtils.isEmpty(storeIds)) {
return new ArrayList<>();
}
List<SStoreVo> voList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(sStores)) {
voList = convertDosToVos(sStores);
......
......@@ -54,7 +54,7 @@
t1.free_amount, t1.total_times, t1.duration, t1.status, t1.pwd, t1.create_time, t1.last_login_time
from s_consumer t1
left join s_store_consumer t2 on t2.consumer_id = t1.id
where t1.role_type = '1' and t2.position='1' and t2.store_id = #{storeId}
where t1.role_type = '1' and t2.position=#{position} and t2.store_id = #{storeId}
<if test="nickName != null and nickName != ''">
AND t1.nick_name like concat('%', #{nickName}, '%')
</if>
......@@ -67,7 +67,8 @@
t1.free_amount, t1.total_times, t1.duration, t1.status, t1.pwd, t1.create_time, t1.last_login_time
from s_consumer t1
where t1.role_type = '1'
and t1.id not in (select consumer_id from s_store_consumer where store_id = #{storeId} and position = '1')
and t1.id not in (select consumer_id from s_store_consumer where store_id = #{storeId} and position =
#{position})
<if test="nickName != null and nickName != ''">
AND t1.nick_name like concat('%', #{nickName}, '%')
</if>
......
......@@ -50,7 +50,7 @@
from s_store_consumer
where consumer_id = #{consumerId}
and store_id = #{storeId}
and position = '1'
and position = #{position}
</delete>
<delete id="deleteInfos">
......
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