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

Commit 5d4fad58 authored by 张国柄's avatar 张国柄

Merge remote-tracking branch 'origin/master' into dev_pvuv

parents 34911644 17b80e87
package com.liquidnet.service.sweet.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.entity.SweetAppletSubMsg;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 小程序订阅消息记录表 服务类
* </p>
*
* @author jiangxiulong
* @since 2021-11-22
*/
public interface ISweetAppletSubMsgService extends IService<SweetAppletSubMsg> {
ResponseDto sendMsg(Integer type, String targetId);
ResponseDto<Boolean> create(String openId, String templateId, String targetId, Integer appletType, Integer activityType);
ResponseDto sendOfMid(Integer type, String midList, String targetId);
}
...@@ -37,6 +37,12 @@ public class SweetCItyVoteStatVo implements Serializable, Cloneable { ...@@ -37,6 +37,12 @@ public class SweetCItyVoteStatVo implements Serializable, Cloneable {
@ApiModelProperty("type") @ApiModelProperty("type")
private Integer type; private Integer type;
@ApiModelProperty("名次")
private Integer ranking;
@ApiModelProperty("名次变动状态 1未变化 2上升 3下降")
private Integer rankingUpOrDown;
/*@ApiModelProperty("创建时间") /*@ApiModelProperty("创建时间")
private LocalDateTime createdAt; private LocalDateTime createdAt;
......
...@@ -156,7 +156,7 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma ...@@ -156,7 +156,7 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
mapSql.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); mapSql.put("updatedAt", updatedAt.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
KylinPerformanceMisVo vo = performanceVoUtils.getPerformanceMisVo(performancesId); KylinPerformanceMisVo vo = performanceVoUtils.getPerformanceMisVo(performancesId);
performanceVoUtils.updatePerformanceMySql(performancesId, mapSql, vo, updatedAt, auditStatus); performanceVoUtils.updatePerformanceMySql(performancesId, mapSql, vo, updatedAt, auditStatus);
if (sqlStatus.getStatus() >= 6 && sqlStatus.getStatus() != 7) {//若 演出上 则 线判断状态 if (sqlStatus.getStatus() == 3 || (sqlStatus.getStatus() >= 6 && sqlStatus.getStatus() != 7)) {//若 演出上 则 线判断状态
performanceVoUtils.performanceVoStatus(performancesId); performanceVoUtils.performanceVoStatus(performancesId);
} }
delOrderTicketsRedis(vo); delOrderTicketsRedis(vo);
......
...@@ -52,15 +52,15 @@ liquidnet: ...@@ -52,15 +52,15 @@ liquidnet:
adam: adam:
database: 255 database: 255
dbs: 0,256 dbs: 0,256
host: r-2ze3sf1ll8er966uuc.redis.rds.aliyuncs.com host: r-2ze7002ckw5u75fguk.redis.rds.aliyuncs.com
port: 6380 port: 6380
password: Qwer1234 password: PO@B!Iud32
candy: candy:
database: 255 database: 255
dbs: 0,256 dbs: 0,256
host: r-2zem98z0tongsw3fpc.redis.rds.aliyuncs.com host: r-2ze7002ckw5u75fguk.redis.rds.aliyuncs.com
port: 6380 port: 6380
password: Qwer1234 password: PO@B!Iud32
mongodb: mongodb:
host: 39.107.71.112:27017 host: 39.107.71.112:27017
port: 27017 port: 27017
......
package com.liquidnet.service.sweet.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 小程序订阅消息记录表
* </p>
*
* @author jiangxiulong
* @since 2021-11-22
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SweetAppletSubMsg implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* msg_id
*/
private String msgId;
/**
* open_id
*/
private String openId;
/**
* template_id
*/
private String templateId;
/**
* 目标id 显示是演出id
*/
private String targetId;
/**
* 1草莓 2五百里 3mdsk 4正在
*/
private Integer appletType;
/**
* 活动类型
*/
private Integer activityType;
/**
* 是否推送 1未推送 2已推送
*/
private Integer isPush;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
}
package com.liquidnet.service.sweet.mapper;
import com.liquidnet.service.sweet.entity.SweetAppletSubMsg;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 小程序订阅消息记录表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2021-11-22
*/
public interface SweetAppletSubMsgMapper extends BaseMapper<SweetAppletSubMsg> {
}
<?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.sweet.mapper.SweetAppletSubMsgMapper">
</mapper>
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
AND type=${type} AND type=${type}
</if> </if>
</where> </where>
GROUP BY city_code
ORDER BY total_num DESC ORDER BY total_num DESC
</select> </select>
</mapper> </mapper>
...@@ -5,6 +5,7 @@ import feign.hystrix.FallbackFactory; ...@@ -5,6 +5,7 @@ import feign.hystrix.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Component @Component
@FeignClient(name = "liquidnet-service-sweet", @FeignClient(name = "liquidnet-service-sweet",
...@@ -16,4 +17,7 @@ public interface FeignSweetWechatClient { ...@@ -16,4 +17,7 @@ public interface FeignSweetWechatClient {
@GetMapping("sweet/wechatTemplate/send") @GetMapping("sweet/wechatTemplate/send")
ResponseDto send(); ResponseDto send();
@GetMapping("sweet/appletSubMsg/send")
ResponseDto sendSubMsg(@RequestParam("type") Integer type, @RequestParam("targetId") String targetId);
} }
...@@ -23,11 +23,18 @@ public class SweetCityVoteTaskHandler { ...@@ -23,11 +23,18 @@ public class SweetCityVoteTaskHandler {
public ReturnT<String> cityVoteStatHandler() { public ReturnT<String> cityVoteStatHandler() {
try { try {
String jobParam = XxlJobHelper.getJobParam();//执行参数 String jobParam = XxlJobHelper.getJobParam();//执行参数
log.info("jobParam = " + Integer.parseInt(jobParam)); log.info("jobParam = " + jobParam);
Boolean data = feignSweetTaskActivityClient.setStatList(Integer.parseInt(jobParam)).getData(); String[] paramArray = jobParam.split(",");
log.info("cityVoteStatHandler:结果:{}", data);
ReturnT<String> success = ReturnT.SUCCESS; ReturnT<String> success = ReturnT.SUCCESS;
success.setMsg(String.valueOf(data));
for (String type : paramArray) {
log.info("type = " + type);
Boolean data = feignSweetTaskActivityClient.setStatList(Integer.parseInt(type)).getData();
log.info("cityVoteStatHandler:结果:{}", data);
success.setMsg(String.valueOf(data));
}
return success; return success;
} catch (Exception e) { } catch (Exception e) {
log.error("exception of handler:{}", e.getMessage(), e); log.error("exception of handler:{}", e.getMessage(), e);
......
...@@ -2,6 +2,7 @@ package com.liquidnet.service.executor.main.handler; ...@@ -2,6 +2,7 @@ package com.liquidnet.service.executor.main.handler;
import com.liquidnet.service.feign.sweet.task.FeignSweetWechatClient; import com.liquidnet.service.feign.sweet.task.FeignSweetWechatClient;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -34,4 +35,31 @@ public class SweetWechatTaskHandler { ...@@ -34,4 +35,31 @@ public class SweetWechatTaskHandler {
} }
} }
@XxlJob(value = "sev-sweet:sendSubMsg")
public ReturnT<String> sendSubMsgHandler() {
try {
String jobParam = XxlJobHelper.getJobParam();//执行参数
log.info("jobParam = " + jobParam);
String[] paramArray = jobParam.split(":");
ReturnT<String> success = ReturnT.SUCCESS;
for (String typeAndTargetId : paramArray) {
String[] typeAndTargetIdArray = typeAndTargetId.split(",");
Integer type = Integer.parseInt(typeAndTargetIdArray[0]);
String targetId = typeAndTargetIdArray[1];
Object data = feignSweetWechatClient.sendSubMsg(type, targetId).getData();
log.info("sendSubMsgHandler:结果:{}", data);
success.setMsg(String.valueOf(data));
}
return success;
} catch (Exception e) {
log.error("exception of handler:{}", e.getMessage(), e);
ReturnT<String> fail = ReturnT.FAIL;
fail.setMsg(e.getLocalizedMessage());
return fail;
}
}
} }
...@@ -234,6 +234,12 @@ public class KylinRefundsStatusServiceImpl { ...@@ -234,6 +234,12 @@ public class KylinRefundsStatusServiceImpl {
dataUtils.delOrderRefundVoByOrderId(refundInfo.getOrderTicketsId()); dataUtils.delOrderRefundVoByOrderId(refundInfo.getOrderTicketsId());
log.info("refundCallback数据库更新res: [update1={},update2={},update3={}]", update1, update2, update3); log.info("refundCallback数据库更新res: [update1={},update2={},update3={}]", update1, update2, update3);
if(null != refundInfo.getRefundCode() && !refundInfo.getRefundCode().isEmpty()) {
log.info("refundCallback已退过不处理库存等: [refundAt={}, orderRefundCode={}, refundCode={}]", refundInfo.getRefundAt(), refundInfo.getOrderRefundCode(), refundInfo.getRefundCode());
return true;
}
if (refundInfo.getType() != KylinTableStatusConst.ORDER_REFUND_TYPE_AUTO && update3 > 0) { if (refundInfo.getType() != KylinTableStatusConst.ORDER_REFUND_TYPE_AUTO && update3 > 0) {
// 退还库存 // 退还库存
for (String entitiesId : orderTicketEntitiesIdsArr) { for (String entitiesId : orderTicketEntitiesIdsArr) {
...@@ -274,8 +280,12 @@ public class KylinRefundsStatusServiceImpl { ...@@ -274,8 +280,12 @@ public class KylinRefundsStatusServiceImpl {
} }
} }
// 退积分 // 退积分
ResponseDto<String> de2111 = feignStoneIntegralClient.de2111(orderInfo.getUserId(), refundCallbackParam.getRefundPrice().setScale(0, BigDecimal.ROUND_DOWN).intValue(), "演出订单退款:".concat(orderInfo.getPerformanceTitle()).concat(":").concat(orderInfo.getOrderCode().substring(orderInfo.getOrderCode().length() - 10))); try {
log.info("订单退款回调退积分结果:[de2111={}]", de2111); ResponseDto<String> de2111 = feignStoneIntegralClient.de2111(orderInfo.getUserId(), refundCallbackParam.getRefundPrice().setScale(0, BigDecimal.ROUND_DOWN).intValue(), "演出订单退款:".concat(orderInfo.getPerformanceTitle()).concat(":").concat(orderInfo.getOrderCode().substring(orderInfo.getOrderCode().length() - 10)));
log.info("订单退款回调退积分结果:[getCode={}, getData={}]", de2111.getCode(), de2111.getData());
} catch (Exception e) {
log.info("订单退款回调退积分异常:[errorMsg={}, e={}]", e.getMessage(), e);
}
} }
return true; return true;
......
-- 小程序订阅消息记录表
drop TABLE if exists `sweet_applet_sub_msg`;
CREATE TABLE `sweet_applet_sub_msg`
(
`mid` bigint unsigned NOT NULL AUTO_INCREMENT,
`msg_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'msg_id',
`open_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'open_id',
`template_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'template_id',
`target_id` varchar(255) NOT NULL DEFAULT '' COMMENT '目标id 显示是演出id',
`applet_type` tinyint NOT NULL DEFAULT 0 COMMENT '1草莓 2五百里 3mdsk 4正在',
`activity_type` tinyint NOT NULL DEFAULT 0 COMMENT '活动类型',
`is_push` tinyint NOT NULL DEFAULT 1 COMMENT '是否推送 1未推送 2已推送',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`),
KEY `sweet_applet_sub_msg_id` (`msg_id`)
) ENGINE = InnoDB
DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT '小程序订阅消息记录表';
\ No newline at end of file
...@@ -17,7 +17,7 @@ XGROUP CREATE sweet:stream:rk.answerInsert group.answerInsert 0 ...@@ -17,7 +17,7 @@ XGROUP CREATE sweet:stream:rk.answerInsert group.answerInsert 0
XADD sweet:stream:rk.sweetUserInsert * 0 0 XADD sweet:stream:rk.sweetUserInsert * 0 0
XGROUP CREATE sweet:stream:rk.sweetUserInsert group.sweetUserInsert 0 XGROUP CREATE sweet:stream:rk.sweetUserInsert group.sweetUserInsert 0
-- 提醒记录 -- -- 开票提醒 模版消息 订阅消息 --
XADD sweet:stream:rk.remindInsert * 0 0 XADD sweet:stream:rk.remindInsert * 0 0
XGROUP CREATE sweet:stream:rk.remindInsert group.remindInsert 0 XGROUP CREATE sweet:stream:rk.remindInsert group.remindInsert 0
......
...@@ -6,6 +6,7 @@ import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl; ...@@ -6,6 +6,7 @@ import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl;
import cn.binarywang.wx.miniapp.message.WxMaMessageRouter; import cn.binarywang.wx.miniapp.message.WxMaMessageRouter;
import com.liquidnet.service.sweet.handler.ApplySubscribeHandler; import com.liquidnet.service.sweet.handler.ApplySubscribeHandler;
import com.liquidnet.service.sweet.handler.ApplyUnsubscribeHandler; import com.liquidnet.service.sweet.handler.ApplyUnsubscribeHandler;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts; import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps; import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -16,6 +17,7 @@ import org.springframework.data.redis.core.StringRedisTemplate; ...@@ -16,6 +17,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@Configuration @Configuration
@Slf4j
public class WechatMaConfigure { public class WechatMaConfigure {
private static String appletAppidZhengzai; private static String appletAppidZhengzai;
private static String appletSecretZhengzai; private static String appletSecretZhengzai;
...@@ -80,9 +82,9 @@ public class WechatMaConfigure { ...@@ -80,9 +82,9 @@ public class WechatMaConfigure {
private StringRedisTemplate stringRedisTemplate; private StringRedisTemplate stringRedisTemplate;
@Autowired @Autowired
private ApplySubscribeHandler unsubscribeHandler; private ApplySubscribeHandler subscribeHandler;
@Autowired @Autowired
private ApplyUnsubscribeHandler subscribeHandler; private ApplyUnsubscribeHandler unsubscribeHandler;
@PostConstruct @PostConstruct
public void init() { public void init() {
...@@ -179,15 +181,19 @@ public class WechatMaConfigure { ...@@ -179,15 +181,19 @@ public class WechatMaConfigure {
// 消息去重 // 消息去重
// router.setMessageDuplicateChecker(wxMessageInMemoryDuplicateChecker); // router.setMessageDuplicateChecker(wxMessageInMemoryDuplicateChecker);
// 关注事件 // 订阅事件
router.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT) router.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT)
.event(WxConsts.EventType.SUBSCRIBE) .event("subscribe_msg_popup_event")
.handler(subscribeHandler) .handler(subscribeHandler)
.end(); .end();
/*router.rule().async(false)
.content("订阅消息")
.handler(subscribeHandler)
.end();*/
// 取消关注事件 // 取消订阅事件
router.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT) router.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT)
.event(WxConsts.EventType.UNSUBSCRIBE) .event("subscribe_msg_popup_event")
.handler(unsubscribeHandler) .handler(unsubscribeHandler)
.end(); .end();
......
package com.liquidnet.service.sweet.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.service.impl.SweetAppletSubMsgServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* <p>
* 小程序订阅消息记录表 前端控制器
* </p>
*
* @author jiangxiulong
* @since 2021-11-22
*/
@Api(tags = "小程序-订阅消息")
@Slf4j
@Validated
@RestController
@RequestMapping("/appletSubMsg")
public class SweetAppletSubMsgController {
@Autowired
private SweetAppletSubMsgServiceImpl subMsgService;
@GetMapping("send")
@ApiOperation("发送模版消息")
public ResponseDto send(
@RequestParam Integer type,
@RequestParam String targetId
) {
return subMsgService.sendMsg(type, targetId);
}
@GetMapping("sendOfMid")
@ApiOperation("发送模版消息OfMid")
public ResponseDto sendOfMid(
@RequestParam Integer type,
@RequestParam String midList,
@RequestParam String targetId
) {
return subMsgService.sendOfMid(type, midList, targetId);
}
// 一次订阅 可以多次发 直到用户取消订阅 所以正规做法应该是记录订阅模版 不关联任何推送数据 等推送的时候查是否订阅某模版
// 然后发送判断失败是用户取消了 删除订阅记录 或者看取消是否有回调 利用回调处理也可
// 现在的理解有误 已写完 先用
// * 实际到了测试发现订阅一次只能发一条 再次发43101
@PostMapping("create")
@ApiOperation("添加订阅记录")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", dataType = "String", name = "openId", value = "openId", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "templateId", value = "templateId 多个用英文逗号分割", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "targetId", value = "演出id", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "appletType", value = "1草莓 2五百里 3mdsk 4正在", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "activityType", value = "活动类型", required = true),
})
public ResponseDto<Boolean> create(
@RequestParam() String openId,
@RequestParam() String templateId,
@RequestParam() String targetId,
@RequestParam() Integer appletType,
@RequestParam() Integer activityType
) {
return subMsgService.create(openId, templateId, targetId, appletType, activityType);
}
}
...@@ -4,16 +4,19 @@ import cn.binarywang.wx.miniapp.api.WxMaService; ...@@ -4,16 +4,19 @@ import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaMessage; import cn.binarywang.wx.miniapp.bean.WxMaMessage;
import cn.binarywang.wx.miniapp.message.WxMaMessageHandler; import cn.binarywang.wx.miniapp.message.WxMaMessageHandler;
import cn.binarywang.wx.miniapp.message.WxMaXmlOutMessage; import cn.binarywang.wx.miniapp.message.WxMaXmlOutMessage;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.sweet.config.WechatMpConfigure; import com.liquidnet.service.sweet.config.WechatMpConfigure;
import com.liquidnet.service.sweet.service.impl.SweetWechatTemplateServiceImpl;
import com.liquidnet.service.sweet.utils.QueueUtils; import com.liquidnet.service.sweet.utils.QueueUtils;
import com.liquidnet.service.sweet.utils.WechatUsersRedisUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager; import me.chanjar.weixin.common.session.WxSessionManager;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.LinkedList;
import java.util.Map; import java.util.Map;
/** /**
...@@ -27,18 +30,29 @@ import java.util.Map; ...@@ -27,18 +30,29 @@ import java.util.Map;
@Component @Component
@Slf4j @Slf4j
public class ApplySubscribeHandler implements WxMaMessageHandler { public class ApplySubscribeHandler implements WxMaMessageHandler {
@Autowired
private WechatUsersRedisUtils redisUtils;
@Autowired @Autowired
private QueueUtils queueUtils; private QueueUtils queueUtils;
@Autowired @Autowired
WechatMpConfigure wechatMpConfigure; WechatMpConfigure wechatMpConfigure;
@Autowired
private SweetWechatTemplateServiceImpl sweetWechatTemplateService;
@Override @Override
public WxMaXmlOutMessage handle(WxMaMessage message, Map<String, Object> context, WxMaService service, WxSessionManager sessionManager) throws WxErrorException { public WxMaXmlOutMessage handle(WxMaMessage message, Map<String, Object> context, WxMaService service, WxSessionManager sessionManager) throws WxErrorException {
log.info("ApplySubscribeHandler message{},context{},service{},sessionManager{}", message, context, service, sessionManager);
String openId = message.getFromUser();
String templateId = "ue0Ehbk0u-akw4hIx_xUsrElT4gFOgc_Ch-CSsJlXas";
String targetId = "4567654235465";
String appletType = "4";
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("sweet_applet_sub_msg.insert"));
sqlsDataA.add(new Object[]{
IDGenerator.nextSnowId(), openId, templateId, targetId, appletType
});
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_REMIND_INSERT.getKey(),
SqlMapping.gets(sqls, sqlsDataA));
return null; return null;
} }
} }
...@@ -125,9 +125,36 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S ...@@ -125,9 +125,36 @@ public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, S
public ResponseDto setStatList(Integer type) { public ResponseDto setStatList(Integer type) {
List<SweetCityVoteStatDto> list = sweetCityVoteStatMapper.getStatList(type); List<SweetCityVoteStatDto> list = sweetCityVoteStatMapper.getStatList(type);
List<SweetCItyVoteStatVo> sweetCityVoteStatList = redisDataUtils.getSweetCityVoteStatList(type);
ArrayList<SweetCItyVoteStatVo> newList = ObjectUtil.getSweetCItyVoteStatVoList();
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
ArrayList<SweetCItyVoteStatVo> newList = ObjectUtil.getSweetCItyVoteStatVoList(); Integer ranking = 0;
list.forEach(r -> newList.add(SweetCItyVoteStatVo.getNew().copy(r))); Integer rankingUpOrDown = 1;
for (SweetCityVoteStatDto cityVote : list) {
SweetCItyVoteStatVo voteStatVo = SweetCItyVoteStatVo.getNew().copy(cityVote);
voteStatVo.setRanking(ranking);
// 1.找到了老数据就进行对比 2.未找到说明是新增的 默认为排名不变 3.第一次没有统计过默认不变
for (SweetCItyVoteStatVo statVoOld : sweetCityVoteStatList) {
if (statVoOld.getCityCode().equals(cityVote.getCityCode())) {
Integer oldRanking = statVoOld.getRanking();
if (null != oldRanking) { // 老数据没有这个字段默认为上升
if (oldRanking > ranking) {
rankingUpOrDown = 2;
} else if (oldRanking < ranking) {
rankingUpOrDown = 3;
} else {
rankingUpOrDown = 1;
}
}
}
}
voteStatVo.setRankingUpOrDown(rankingUpOrDown);
newList.add(voteStatVo);
ranking++;
}
// list.forEach(r -> newList.add(SweetCItyVoteStatVo.getNew().copy(r)));
redisDataUtils.setSweetCityVoteStatList(newList, type);
} else {
redisDataUtils.setSweetCityVoteStatList(newList, type); redisDataUtils.setSweetCityVoteStatList(newList, type);
} }
redisDataUtils.setSweetCityVoteStatUpdateTime(type); redisDataUtils.setSweetCityVoteStatUpdateTime(type);
......
...@@ -37,6 +37,7 @@ sweet_luck_draw.insert=INSERT INTO sweet_luck_draw (mobile,union_id,luck_draw_nu ...@@ -37,6 +37,7 @@ sweet_luck_draw.insert=INSERT INTO sweet_luck_draw (mobile,union_id,luck_draw_nu
sweet_answer.insert=INSERT INTO sweet_answer (answer_id,phone,answer_json,img_url) VALUES (?,?,?,?) sweet_answer.insert=INSERT INTO sweet_answer (answer_id,phone,answer_json,img_url) VALUES (?,?,?,?)
# --------------------------提醒记录-------------------------- # --------------------------提醒记录--------------------------
sweet_remind.insert=INSERT INTO sweet_remind (remind_id,openId,unionId,performancesId) VALUES (?,?,?,?) sweet_remind.insert=INSERT INTO sweet_remind (remind_id,openId,unionId,performancesId) VALUES (?,?,?,?)
sweet_applet_sub_msg.insert=INSERT INTO sweet_applet_sub_msg (msg_id,open_id,template_id,target_id,applet_type,activity_type) VALUES (?,?,?,?,?,?)
# --------------------------用户投票记录-------------------------- # --------------------------用户投票记录--------------------------
sweet_city_vote.insert=INSERT INTO sweet_city_vote (vote_id,phone,openId,unionId,type,city_code,city_name,day_time) VALUES (?,?,?,?,?,?,?,?) sweet_city_vote.insert=INSERT INTO sweet_city_vote (vote_id,phone,openId,unionId,type,city_code,city_name,day_time) VALUES (?,?,?,?,?,?,?,?)
sweet_city_vote_stat.insert=INSERT INTO sweet_city_vote_stat (stat_id,city_code,city_name,vote_num,type) VALUES (?,?,?,?,?) sweet_city_vote_stat.insert=INSERT INTO sweet_city_vote_stat (stat_id,city_code,city_name,vote_num,type) VALUES (?,?,?,?,?)
......
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