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

Commit a2ceccd7 authored by Administrator's avatar Administrator 🎨

Merge branch 'pre' into 'master'

Pre

See merge request !50
parents 3d010053 6d2f7472
...@@ -34,7 +34,7 @@ public class AdamUserMemberVo implements Serializable, Cloneable { ...@@ -34,7 +34,7 @@ public class AdamUserMemberVo implements Serializable, Cloneable {
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime updatedAt; private LocalDateTime updatedAt;
private static final LocalDateTime oldMemberSpotTime = LocalDateTime.parse("2021-12-31 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); public static final LocalDateTime spotTime = LocalDateTime.parse("2021-12-31 23:59:59", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
private static final AdamUserMemberVo obj = new AdamUserMemberVo(); private static final AdamUserMemberVo obj = new AdamUserMemberVo();
public static AdamUserMemberVo getNew() { public static AdamUserMemberVo getNew() {
...@@ -81,6 +81,6 @@ public class AdamUserMemberVo implements Serializable, Cloneable { ...@@ -81,6 +81,6 @@ public class AdamUserMemberVo implements Serializable, Cloneable {
LocalDateTime createdAt = this.getCreatedAt(); LocalDateTime createdAt = this.getCreatedAt();
LocalDateTime updatedAt = this.getUpdatedAt(); LocalDateTime updatedAt = this.getUpdatedAt();
// 创建时间在`指定时间`之前,且(更新时间为空或更新时间在`指定时间`之前) // 创建时间在`指定时间`之前,且(更新时间为空或更新时间在`指定时间`之前)
return createdAt.isBefore(oldMemberSpotTime) && (null == updatedAt || (updatedAt.isBefore(oldMemberSpotTime))); return createdAt.isBefore(spotTime) && (null == updatedAt || (updatedAt.isBefore(spotTime)));
} }
} }
\ No newline at end of file
...@@ -110,7 +110,6 @@ public class TicketCreateParam implements Serializable { ...@@ -110,7 +110,6 @@ public class TicketCreateParam implements Serializable {
kylinTickets.setCreatedAt(createdAt); kylinTickets.setCreatedAt(createdAt);
if (updatedAt != null) if (updatedAt != null)
kylinTickets.setUpdatedAt(updatedAt); kylinTickets.setUpdatedAt(updatedAt);
//TODO 各种说明文案
return kylinTickets; return kylinTickets;
} }
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>liquidnet-bus-api</artifactId>
<groupId>com.liquidnet</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>liquidnet-service-sweet-api</artifactId>
<dependencies>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
<version>4.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>2.2.3.RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>4.1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
package com.liquidnet.service.sweet.config;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl;
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
import javax.annotation.PostConstruct;
@Configuration
public class WechatMaConfigure {
private static String appletAppidZhengzai;
private static String appletSecretZhengzai;
private static String appletAppidStrawberry;
private static String appletSecretStrawberry;
private static String appletAppidFive;
private static String appletSecretFive;
private static String appletAppidMdsk;
private static String appletSecretMdsk;
@Value("${liquidnet.wechat.applet.zhengzai.appid}")
public void setAppletAppidZhengzai(String appletAppidZhengzai) {
WechatMaConfigure.appletAppidZhengzai = appletAppidZhengzai;
}
@Value("${liquidnet.wechat.applet.zhengzai.secret}")
public void setAppletSecretZhengzai(String appletSecretZhengzai) {
WechatMaConfigure.appletSecretZhengzai = appletSecretZhengzai;
}
@Value("${liquidnet.wechat.applet.strawberry.appid}")
public void setAppletAppidStrawberry(String appletAppidStrawberry) {
WechatMaConfigure.appletAppidStrawberry = appletAppidStrawberry;
}
@Value("${liquidnet.wechat.applet.strawberry.secret}")
public void setAppletSecretStrawberry(String appletSecretStrawberry) {
WechatMaConfigure.appletSecretStrawberry = appletSecretStrawberry;
}
@Value("${liquidnet.wechat.applet.five.appid}")
public void setAppletAppidFive(String appletAppidFive) {
WechatMaConfigure.appletAppidFive = appletAppidFive;
}
@Value("${liquidnet.wechat.applet.five.secret}")
public void setAppletSecretFive(String appletSecretFive) {
WechatMaConfigure.appletSecretFive = appletSecretFive;
}
@Value("${liquidnet.wechat.applet.mdsk.appid}")
public void setAppletAppidMdsk(String appletAppidMdsk) {
WechatMaConfigure.appletAppidMdsk = appletAppidMdsk;
}
@Value("${liquidnet.wechat.applet.mdsk.secret}")
public void setAppletSecretMdsk(String appletSecretMdsk) {
WechatMaConfigure.appletSecretMdsk = appletSecretMdsk;
}
private WxMaService wxMaAppletZhengzaiService;
private WxMaService wxMaAppletStrawberryService;
private WxMaService wxMaAppletFiveService;
private WxMaService wxMaAppletMdskService;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@PostConstruct
public void init() {
wxMaAppletZhengzaiService = new WxMaServiceImpl() {
{
RedisTemplateWxRedisOps redisTemplateWxRedisOps = new RedisTemplateWxRedisOps(stringRedisTemplate);
WxMaRedisBetterConfigImpl wxMaDefaultConfig = new WxMaRedisBetterConfigImpl(redisTemplateWxRedisOps, "sweet:accessToken:applet:zhengzai");
// WxMaDefaultConfigImpl wxMaDefaultConfig = new WxMaDefaultConfigImpl();
wxMaDefaultConfig.setAppid(appletAppidZhengzai);
wxMaDefaultConfig.setSecret(appletSecretZhengzai);
wxMaDefaultConfig.setMsgDataFormat("JSON");
this.setWxMaConfig(wxMaDefaultConfig);
}
};
wxMaAppletStrawberryService = new WxMaServiceImpl() {
{
RedisTemplateWxRedisOps redisTemplateWxRedisOps = new RedisTemplateWxRedisOps(stringRedisTemplate);
WxMaRedisBetterConfigImpl wxMaDefaultConfig = new WxMaRedisBetterConfigImpl(redisTemplateWxRedisOps, "sweet:accessToken:applet:strawberry");
// WxMaDefaultConfigImpl wxMaDefaultConfig = new WxMaDefaultConfigImpl();
wxMaDefaultConfig.setAppid(appletAppidStrawberry);
wxMaDefaultConfig.setSecret(appletSecretStrawberry);
wxMaDefaultConfig.setMsgDataFormat("JSON");
this.setWxMaConfig(wxMaDefaultConfig);
}
};
wxMaAppletFiveService = new WxMaServiceImpl() {
{
RedisTemplateWxRedisOps redisTemplateWxRedisOps = new RedisTemplateWxRedisOps(stringRedisTemplate);
WxMaRedisBetterConfigImpl wxMaDefaultConfig = new WxMaRedisBetterConfigImpl(redisTemplateWxRedisOps, "sweet:accessToken:applet:five");
// WxMaDefaultConfigImpl wxMaDefaultConfig = new WxMaDefaultConfigImpl();
wxMaDefaultConfig.setAppid(appletAppidFive);
wxMaDefaultConfig.setSecret(appletSecretFive);
wxMaDefaultConfig.setMsgDataFormat("JSON");
this.setWxMaConfig(wxMaDefaultConfig);
}
};
wxMaAppletMdskService = new WxMaServiceImpl() {
{
RedisTemplateWxRedisOps redisTemplateWxRedisOps = new RedisTemplateWxRedisOps(stringRedisTemplate);
WxMaRedisBetterConfigImpl wxMaDefaultConfig = new WxMaRedisBetterConfigImpl(redisTemplateWxRedisOps, "sweet:accessToken:applet:mdsk");
// WxMaDefaultConfigImpl wxMaDefaultConfig = new WxMaDefaultConfigImpl();
wxMaDefaultConfig.setAppid(appletAppidMdsk);
wxMaDefaultConfig.setSecret(appletSecretMdsk);
wxMaDefaultConfig.setMsgDataFormat("JSON");
this.setWxMaConfig(wxMaDefaultConfig);
}
};
}
public WxMaService getWxMaService(Integer anum) {
switch (anum) {
case 4:
return wxMaAppletZhengzaiService;
case 1:
return wxMaAppletStrawberryService;
case 2:
return wxMaAppletFiveService;
case 3:
return wxMaAppletMdskService;
}
return null;
}
public String getWxMaAppid(Integer anum) {
switch (anum) {
case 4:
return appletAppidZhengzai;
case 1:
return appletAppidStrawberry;
case 2:
return appletAppidFive;
case 3:
return appletAppidMdsk;
}
return "";
}
}
package com.liquidnet.service.sweet.config;
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpRedisConfigImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
import javax.annotation.PostConstruct;
@Configuration
public class WechatMpConfigure {
private static String appidZhengzai;
private static String secretZhengzai;
private static String tokenZhengzai;
private static String aeskeyZhengzai;
private static String appidModernsky;
private static String secretModernsky;
@Value("${liquidnet.wechat.service.zhengzai.appid}")
public void setAppidZhengzai(String appidZhengzai) { WechatMpConfigure.appidZhengzai = appidZhengzai; }
@Value("${liquidnet.wechat.service.zhengzai.secret}")
public void setSecretZhengzai(String secretZhengzai) {
WechatMpConfigure.secretZhengzai = secretZhengzai;
}
@Value("${liquidnet.wechat.service.zhengzai.token}")
public void setTokenZhengzai(String tokenZhengzai) {
WechatMpConfigure.tokenZhengzai = tokenZhengzai;
}
@Value("${liquidnet.wechat.service.zhengzai.aeskey}")
public void setAeskeyZhengzai(String aeskeyZhengzai) {
WechatMpConfigure.aeskeyZhengzai = aeskeyZhengzai;
}
@Value("${liquidnet.wechat.service.modernsky.appid}")
public void setAppidModernsky(String appidModernsky) {
WechatMpConfigure.appidModernsky = appidModernsky;
}
@Value("${liquidnet.wechat.service.modernsky.secret}")
public void setSecretModernsky(String secretModernsky) {
WechatMpConfigure.secretModernsky = secretModernsky;
}
private WxMpService wxMpZhengzaiService;
private WxMpService wxMpModernskyService;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@PostConstruct
public void init() {
wxMpZhengzaiService = new WxMpServiceImpl() {
{
RedisTemplateWxRedisOps redisTemplateWxRedisOps = new RedisTemplateWxRedisOps(stringRedisTemplate);
WxMpRedisConfigImpl wxMpDefaultConfig = new WxMpRedisConfigImpl(redisTemplateWxRedisOps, "sweet:accessToken:service:zhengzai");
wxMpDefaultConfig.setAppId(appidZhengzai);
wxMpDefaultConfig.setSecret(secretZhengzai);
wxMpDefaultConfig.setToken(tokenZhengzai);
wxMpDefaultConfig.setAesKey(aeskeyZhengzai);
this.setWxMpConfigStorage(wxMpDefaultConfig);
}
};
wxMpModernskyService = new WxMpServiceImpl() {
{
RedisTemplateWxRedisOps redisTemplateWxRedisOps = new RedisTemplateWxRedisOps(stringRedisTemplate);
WxMpRedisConfigImpl wxMpDefaultConfig = new WxMpRedisConfigImpl(redisTemplateWxRedisOps, "sweet:accessToken:service:modernsky");
wxMpDefaultConfig.setAppId(appidModernsky);
wxMpDefaultConfig.setSecret(secretModernsky);
this.setWxMpConfigStorage(wxMpDefaultConfig);
}
};
}
public WxMpService getWxMpService(Integer pnum) {
switch (pnum) {
case 1:
return wxMpZhengzaiService;
case 2:
return wxMpModernskyService;
}
return null;
}
}
package com.liquidnet.service.sweet.constant;
/**
*
*/
public class SweetConstant {
public final static String REDIS_KEY_SWEET_MANUAL_PUSH_LIST = "sweet:manual:pushList";
public final static String REDIS_KEY_SWEET_MANUAL_TIME_LIST = "sweet:manual:timeList:manual:";
public final static String REDIS_KEY_SWEET_MANUAL_NOTIFY_LIST = "sweet:manual:notify:manual:";
public final static String REDIS_KEY_SWEET_MANUAL_RICH_TEXT = "sweet:manual:richText:manual:";
public final static String REDIS_KEY_SWEET_MANUAL_SORT = "sweet:manual:sort:manual:";
public final static String REDIS_KEY_SWEET_ARTISTS_RELATION = "sweet:artists:relation:uid:";
public final static String REDIS_KEY_SWEET_ARTISTS_DETAILS = "sweet:artists:details:";
public final static String REDIS_KEY_SWEET_SHOP = "sweet:artists:shop:manual:";
public final static String REDIS_KEY_SWEET_LUCK_DRAW = "sweet:luckDraw:mobile:";
public final static String REDIS_KEY_SWEET_LUCK_DRAW_RESULT = "sweet:luckDraw:num:";
public final static String REDIS_KEY_SWEET_LUCK_DRAW_SURPLUS = "sweet:luckDraw:num:";//中奖库存
public final static String REDIS_KEY_SWEET_LUCK_DRAW_ALL = "sweet:luckDraw:num:";//中奖总量
public final static String REDIS_KEY_SWEET_LUCK_DRAW_PRESENT_MOBILE = "sweet:luckDraw:present:mobile:";//中奖库存
public final static String REDIS_KEY_SWEET_WECHAT_USER_INFO="sweet:wechatUser:unionId:";
public final static String REDIS_KEY_SWEET_WECHAT_USER_INFO_STR="sweet:wechatUser:unionIdStr:";
public final static String REDIS_KEY_SWEET_WECHAT_USER_UNIONID="sweet:wechatUser:openId:";
public final static String REDIS_KEY_SWEET_ANSWER_PHONE="sweet:answer:phone:";
// public enum ManualPosition {
// artist("艺人","artist"),
// signingTime("签售时间","signingTime"),
// foodAndAmusement("吃喝玩乐","foodAndAmusement"),
// siteMap("现场地图","siteMap"),
// howToReach("如何到达","howToReach"),
// relatedProduct ("官方售卖","relatedProduct"),
// officialSupport("官方支持","officialSupport"),
// audienceNotice("观众须知","audienceNotice"),
// preventionGuidelines("防疫指南","preventionGuidelines"),
// notice("通知","notice"),
// strategy("观演攻略","strategy");
//
// private String message;
// private String code;
//
// private ManualPosition(String message, String code) {
// this.message = message;
// this.code = code;
// }
//
// public void setCode(String code) {
// this.code = code;
// }
//
// public String getCode() {
// return code;
// }
//
// public void setMessage(String message) {
// this.message = message;
// }
//
// public String getMessage() {
// return message;
// }
//
// public static String getMessage(String code) {
// for (ManualPosition c : ManualPosition.values()) {
// if (c.getCode().equalsIgnoreCase(code)) {
// return c.message;
// }
// }
// return null;
// }
// }
public final static String REDIS_KEY_SWEET_MDSK_MANUAL_PUSH_LIST = "sweet:mdsk:manual:pushList";
public final static String REDIS_KEY_SWEET_MDSK_MANUAL_TIME_LIST = "sweet:mdsk:manual:timeList:manual:";
public final static String REDIS_KEY_SWEET_MDSK_MANUAL_NOTIFY_LIST = "sweet:mdsk:manual:notify:manual:";
public final static String REDIS_KEY_SWEET_MDSK_MANUAL_RICH_TEXT = "sweet:mdsk:manual:richText:manual:";
public final static String REDIS_KEY_SWEET_MDSK_MANUAL_SORT = "sweet:mdsk:manual:sort:manual:";
public final static String REDIS_KEY_SWEET_MDSK_ARTISTS_RELATION = "sweet:mdsk:artists:relation:uid:";
public final static String REDIS_KEY_SWEET_MDSK_ARTISTS_DETAILS = "sweet:mdsk:artists:details:";
public final static String REDIS_KEY_SWEET_MDSK_SHOP = "sweet:mdsk:artists:shop:manual:";
}
package com.liquidnet.service.sweet.dto.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
@ApiModel(value = "SweetOpenSendMsgParam", description = "发送模版消息公共接口入参")
@Data
public class SweetOpenSendMsgParam implements Serializable {
private static final long serialVersionUID = 675588088506034208L;
@ApiModelProperty(position = 11, required = true, allowableValues = "1,2", value = "发送目标类型 1正在服务号 2摩登服务号")
@NotNull(message = "sendTargetType不能为空") @Min(value = 1, message = "sendTargetType无效") @Max(value = 2, message = "sendTargetType无效")
private Integer sendTargetType;
@ApiModelProperty(position = 12, required = true, value = "模版消息ID", example = "y-j82V1TYhlTH1j8QscuDPcPQtNiDtENb7N5IZMBvqU")
@NotBlank(message = "templateId不能为空")
private String templateId;
@ApiModelProperty(position = 13, required = true, value = "模版消息数据", example = "{\"first\": \"感谢关注「正在现场」服务号\", \"keyword2\": \"4006-310-750\"}")
@NotBlank(message = "templateData不能为空")
private String templateData;
@ApiModelProperty(position = 14, required = true, allowableValues = "1,2,3,4,5", value = "点击跳转类型 1草莓小程序 2五百里小程序 3mdsk小程序 4正在小程序 5url")
@NotNull(message = "jumpType不能为空") @Min(value = 1, message = "jumpType无效") @Max(value = 5, message = "jumpType无效")
private Integer jumpType;
@ApiModelProperty(position = 15, value = "跳转url", example = "www.zhengzai.tv")
private String jumpUrl;
@ApiModelProperty(position = 16, allowableValues = "false,true", value = "是否需要前端配合处理跳转,直接跳转jumpAppletPagePath为false,true时需要前端根据状态码做跳转处理")
private Boolean jumpAppletUsePath;
@ApiModelProperty(position = 17, value = "跳转小程序需要的某页地址", example = "pages/webview?query=lottery")
private String jumpAppletPagePath;
/*@ApiModelProperty(position = 18, required = true, value = "openId", example = "oUpkkuNe4yuVs77aaKFvuvpgNOSw")
@NotBlank(message = "openId不能为空")
private String openId;*/
@ApiModelProperty(position = 18, required = true, value = "phone", example = "15888888888")
@NotBlank(message = "phone不能为空")
private String phone;
}
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<module>liquidnet-service-adam-api</module> <module>liquidnet-service-adam-api</module>
<module>liquidnet-service-kylin-api</module> <module>liquidnet-service-kylin-api</module>
<module>liquidnet-service-dragon-api</module> <module>liquidnet-service-dragon-api</module>
<module>liquidnet-service-sweet-api</module>
<module>liquidnet-service-chime-api</module> <module>liquidnet-service-chime-api</module>
<module>liquidnet-service-candy-api</module> <module>liquidnet-service-candy-api</module>
</modules> </modules>
......
...@@ -342,14 +342,13 @@ public class PerformancesExpressController extends BaseController { ...@@ -342,14 +342,13 @@ public class PerformancesExpressController extends BaseController {
list.forEach(r -> { list.forEach(r -> {
excelList.add(OrderExpressExportExcelListDao.getNew().copy(r)); excelList.add(OrderExpressExportExcelListDao.getNew().copy(r));
}); });
return excelUtil.exportExcel(excelList, "券码数据"); return excelUtil.exportExcel(excelList, "快递信息");
} }
/** /**
* 下载导入模版 * 下载导入模版
* @return * @return
*/ */
@RequiresPermissions("kylin:performancesExpress:view")
@GetMapping("/importTemplate") @GetMapping("/importTemplate")
@ResponseBody @ResponseBody
public AjaxResult importTemplate() public AjaxResult importTemplate()
......
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<a class="btn btn-danger" href="#" onclick="closeItem()"> <a class="btn btn-danger" href="#" onclick="closeItem()">
<i class="fa fa-reply-all"></i>&nbsp;&nbsp;&nbsp; <i class="fa fa-reply-all"></i>&nbsp;&nbsp;&nbsp;
</a> </a>
<a class="btn btn-primary" style="margin-left: 15px;" href="#member-refund-form" data-toggle="modal" shiro:hasPermission="adam:order:orderlist:refund"> <a class="btn btn-primary" style="margin-left: 15px;" href="#member-refund-form" data-toggle="modal" shiro:hasPermission="adam:order:orderlist:refund" th:if="${orderDetailsVo.adamMemberOrderVo.state == 1 && orderDetailsVo.adamUserMemberVo.state == 1}">
申请退款 申请退款
</a> </a>
</div> </div>
...@@ -143,19 +143,20 @@ ...@@ -143,19 +143,20 @@
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="pull-left">退款金额:<i class="fa fa-cny"></i>&nbsp;</label> <label class="pull-left">退款金额:<i class="fa fa-cny"></i>&nbsp;</label>
<input type="number" name="refundAmt" th:value="${orderDetailsVo.adamMemberOrderVo.pricePaid}" class="form-control" style="width: 30%;height: 20px;"> <!-- <input type="number" name="refundAmt" th:value="${orderDetailsVo.adamMemberOrderVo.pricePaid}" class="form-control" style="width: 30%;height: 20px;">-->
<input type="number" name="refundAmt" class="form-control" style="width: 30%;height: 20px;" placeholder="退款金额">
</div> </div>
<div class="form-group"> <div class="form-group">
<!-- <label>退款原因:</label>--> <!-- <label>退款原因:</label>-->
<textarea rows="3" name="reason" placeholder="请输入退款原因" class="form-control"></textarea> <textarea rows="3" name="reason" placeholder="请输入退款原因" class="form-control"></textarea>
</div> </div>
<div> <div class="form-group">
<label>是否能继续购买会员:</label> <label>是否能继续购买会员:</label>
<div class="radio check-box"> <div class="radio check-box">
<input type="radio" value="1" name="renewable"> <input type="radio" checked value="1" name="renewable">
</div> </div>
<div class="radio check-box"> <div class="radio check-box">
<input type="radio" checked="" value="2" name="renewable"> <input type="radio" value="2" name="renewable">
</div> </div>
</div> </div>
<div class="text-center" style="margin-bottom: -15px;margin-top: 10px;"> <div class="text-center" style="margin-bottom: -15px;margin-top: 10px;">
...@@ -182,19 +183,8 @@ ...@@ -182,19 +183,8 @@
<script> <script>
var pricePaid = [[${orderDetailsVo.adamMemberOrderVo.pricePaid}]]; var pricePaid = [[${orderDetailsVo.adamMemberOrderVo.pricePaid}]];
$(function(){
//键盘按下ESC时关闭窗口!
$(document).keypress(function(e){
if(e.keyCode==27){
//关闭窗口的方法
window.opener = null;
window.close();
}
});
});
$("#form-member-order-refund").validate({ $("#form-member-order-refund").validate({
onkeyup: false, onkeyup: true,
rules:{ rules:{
refundAmt: { refundAmt: {
required: true, required: true,
...@@ -212,13 +202,13 @@ ...@@ -212,13 +202,13 @@
refundAmt: { refundAmt: {
required: "请输入退款金额", required: "请输入退款金额",
number: "退款金额必须为数字", number: "退款金额必须为数字",
min: "退款金额必须不得小于0.01", min: "退款金额不得小于0.01",
max: "退款金额不能大于支付金额" max: "退款金额不能大于支付金额"
}, },
reason: { reason: {
required: "请输入退款原因", required: "请输入退款原因",
minlength: "退款原因不能大于100个字符", minlength: "退款原因不得少于2个字符",
maxlength: "退款原因不能小于2个字符" maxlength: "退款原因不得大于100个字符"
} }
}, },
......
...@@ -325,7 +325,7 @@ ...@@ -325,7 +325,7 @@
var rows = result.rows; var rows = result.rows;
var html = '<option value="">全部</option>'; var html = '<option value="">全部</option>';
$.each(rows,function(index,value){ $.each(rows,function(index,value){
html += '<option value="'+value.ticketsId+'">'+value.title+'</option>' html += '<option value="'+value.ticketsId+'">'+value.title+'-'+value.timeTitle+'</option>'
}); });
$('#selectTicketDiv').find('#openTicketListTplSelect').html(html); $('#selectTicketDiv').find('#openTicketListTplSelect').html(html);
openTicketList("openTicketListTpl", performanceId); openTicketList("openTicketListTpl", performanceId);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
<option value="2">取消退款</option> <option value="2">取消退款</option>
<option value="1">运营审核通过</option> <option value="1">运营审核通过</option>
<option value="5">运营审核驳回退款</option> <option value="5">运营审核驳回退款</option>
<option value="9">已确认收货</option>
<option value="7">财务审核通过等待退款</option> <option value="7">财务审核通过等待退款</option>
<option value="8">财务审核驳回退款</option> <option value="8">财务审核驳回退款</option>
<option value="4">完成退款</option> <option value="4">完成退款</option>
...@@ -40,6 +41,7 @@ ...@@ -40,6 +41,7 @@
<option value="2">取消退款</option> <option value="2">取消退款</option>
<option value="1">运营审核通过</option> <option value="1">运营审核通过</option>
<option value="5">运营审核驳回退款</option> <option value="5">运营审核驳回退款</option>
<option value="9">已确认收货</option>
<option value="7">财务审核通过等待退款</option> <option value="7">财务审核通过等待退款</option>
<option value="8">财务审核驳回退款</option> <option value="8">财务审核驳回退款</option>
<option value="4">完成退款</option> <option value="4">完成退款</option>
...@@ -48,9 +50,11 @@ ...@@ -48,9 +50,11 @@
</shiro:hasPermission> </shiro:hasPermission>
<shiro:hasPermission name="kylin:refund:review"> <shiro:hasPermission name="kylin:refund:review">
<shiro:lacksRole name="admin"> <shiro:lacksRole name="admin">
<option value="0,8">全部</option> <option value="0,8,4,6">全部</option>
<option value="0">请求退款</option> <option value="0">请求退款</option>
<option value="8">财务审核驳回退款</option> <option value="8">财务审核驳回退款</option>
<option value="4">完成退款</option>
<option value="6">退款失败</option>
</shiro:lacksRole> </shiro:lacksRole>
</shiro:hasPermission> </shiro:hasPermission>
<shiro:hasPermission name="kylin:refund:ticketAudit"> <shiro:hasPermission name="kylin:refund:ticketAudit">
...@@ -60,9 +64,11 @@ ...@@ -60,9 +64,11 @@
</shiro:hasPermission> </shiro:hasPermission>
<shiro:hasPermission name="kylin:refund:execute"> <shiro:hasPermission name="kylin:refund:execute">
<shiro:lacksRole name="admin"> <shiro:lacksRole name="admin">
<option value="1,9">全部</option> <option value="1,9,4,6">全部</option>
<option value="1">运营审核通过</option> <option value="1">运营审核通过</option>
<option value="9">已确认收货</option> <option value="9">已确认收货</option>
<option value="4">完成退款</option>
<option value="6">退款失败</option>
</shiro:lacksRole> </shiro:lacksRole>
</shiro:hasPermission> </shiro:hasPermission>
</select> </select>
......
...@@ -33,8 +33,8 @@ public class OrderExpressExportExcelListDao implements Serializable, Cloneable { ...@@ -33,8 +33,8 @@ public class OrderExpressExportExcelListDao implements Serializable, Cloneable {
private String enterName; private String enterName;
@Excel(name = "入场人手机号") @Excel(name = "入场人手机号")
private String enterMobile; private String enterMobile;
@Excel(name = "入场人身份证") @Excel(name = "入场人证件号")
private String enterIdCod; private String enterIdCode;
private static final OrderExpressExportExcelListDao obj = new OrderExpressExportExcelListDao(); private static final OrderExpressExportExcelListDao obj = new OrderExpressExportExcelListDao();
...@@ -59,7 +59,7 @@ public class OrderExpressExportExcelListDao implements Serializable, Cloneable { ...@@ -59,7 +59,7 @@ public class OrderExpressExportExcelListDao implements Serializable, Cloneable {
this.setExpressAddress(source.getExpressAddress()); this.setExpressAddress(source.getExpressAddress());
this.setEnterName(source.getEnterName()); this.setEnterName(source.getEnterName());
this.setEnterMobile(source.getEnterMobile()); this.setEnterMobile(source.getEnterMobile());
this.setEnterIdCod(source.getEnterIdCod()); this.setEnterIdCode(source.getEnterIdCode());
return this; return this;
} }
} }
...@@ -90,6 +90,11 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma ...@@ -90,6 +90,11 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
public KylinPerformanceMisVo performanceDetails(String performancesId) { public KylinPerformanceMisVo performanceDetails(String performancesId) {
log.info(" PERFORMANCE mis演出详情"); log.info(" PERFORMANCE mis演出详情");
KylinPerformanceMisVo createMisVo = performanceVoUtils.getPerformanceMisVo(performancesId); KylinPerformanceMisVo createMisVo = performanceVoUtils.getPerformanceMisVo(performancesId);
KylinPerformanceStatus kylinPerformanceStatus = performanceStatusMapper.selectOne(Wrappers.lambdaQuery(KylinPerformanceStatus.class)
.eq(KylinPerformanceStatus::getPerformanceId, performancesId)
.select(KylinPerformanceStatus::getStatus)
);
createMisVo.setStatus(kylinPerformanceStatus.getStatus());
return createMisVo; return createMisVo;
} }
......
...@@ -82,6 +82,8 @@ public class MQConst { ...@@ -82,6 +82,8 @@ public class MQConst {
SWEET_USER_INSERT_DRAW("sweet:stream:rk.sweetUserInsert", "group.sweetUserInsert", "关注服务号的用户信息"), SWEET_USER_INSERT_DRAW("sweet:stream:rk.sweetUserInsert", "group.sweetUserInsert", "关注服务号的用户信息"),
SWEET_REMIND_INSERT_DRAW("sweet:stream:rk.remindInsert", "group.remindInsert", "提醒记录"), SWEET_REMIND_INSERT_DRAW("sweet:stream:rk.remindInsert", "group.remindInsert", "提醒记录"),
SWEET_APPLET_USER_INSERT_DRAW("sweet:stream:rk.sweetAppletUserInsert", "group.sweetAppletUserInsert", "小程序登录记录用户解密后信息"), SWEET_APPLET_USER_INSERT_DRAW("sweet:stream:rk.sweetAppletUserInsert", "group.sweetAppletUserInsert", "小程序登录记录用户解密后信息"),
SWEET_TEMPLATE_MSG("sweet:stream:rk.sweetTemplateMsg", "group.sweetTemplateMsg", "发送模版消息"),
SWEET_CITY_VOTE_DRAW("sweet:stream:rk.cityVote", "group.cityVote", "用户投票记录"),
; ;
private final String key; private final String key;
......
...@@ -18,7 +18,7 @@ liquidnet: ...@@ -18,7 +18,7 @@ liquidnet:
url-refund: url-refund:
apply: "${liquidnet.client.admin.phpPayUrl}/dragon/refund/refundSingle" apply: "${liquidnet.client.admin.phpPayUrl}/dragon/refund/refundSingle"
notify: "${liquidnet.client.admin.platformUrl}/platform/refund/callback" notify: "${liquidnet.client.admin.platformUrl}/platform/refund/callback"
notify-member: ${liquidnet.client.admin.platformUrl}/amorder/callack/refund notify-member: ${liquidnet.client.admin.platformUrl}/platform/amorder/callack/refund
url-banner: url-banner:
url6: "/kylin/performances/recommend/performance/status?pageNum=1&pageSize=50&status=(3,6,7,8,9,10)" #票务 url6: "/kylin/performances/recommend/performance/status?pageNum=1&pageSize=50&status=(3,6,7,8,9,10)" #票务
url7: "${liquidnet.client.admin.phpMallUrl}/admin/goodListForQuick?page=1&per_page=50" #商品 url7: "${liquidnet.client.admin.phpMallUrl}/admin/goodListForQuick?page=1&per_page=50" #商品
......
...@@ -20,5 +20,5 @@ public class OrderExpressExportListDao implements Serializable { ...@@ -20,5 +20,5 @@ public class OrderExpressExportListDao implements Serializable {
private String expressAddress; private String expressAddress;
private String enterName; private String enterName;
private String enterMobile; private String enterMobile;
private String enterIdCod; private String enterIdCode;
} }
...@@ -11,6 +11,7 @@ public class PerformancesTicketListDao implements Serializable, Cloneable { ...@@ -11,6 +11,7 @@ public class PerformancesTicketListDao implements Serializable, Cloneable {
private String ticketsId; private String ticketsId;
private String title; private String title;
private String timeTitle;
private static final PerformancesTicketListDao obj = new PerformancesTicketListDao(); private static final PerformancesTicketListDao obj = new PerformancesTicketListDao();
......
...@@ -45,12 +45,14 @@ ...@@ -45,12 +45,14 @@
<select id="getPerformancesTicketList" resultType="com.liquidnet.service.kylin.dao.PerformancesTicketListDao"> <select id="getPerformancesTicketList" resultType="com.liquidnet.service.kylin.dao.PerformancesTicketListDao">
SELECT SELECT
a.tickets_id , a.tickets_id ,
a.title a.title,
e.title as time_title
FROM FROM
kylin_tickets AS a kylin_tickets AS a
LEFT JOIN kylin_ticket_status AS b ON b.ticket_id = a.tickets_id LEFT JOIN kylin_ticket_status AS b ON b.ticket_id = a.tickets_id
LEFT JOIN kylin_ticket_relations AS c ON c.ticket_id = a.tickets_id LEFT JOIN kylin_ticket_relations AS c ON c.ticket_id = a.tickets_id
LEFT JOIN kylin_ticket_time_relation AS d ON d.times_id = c.times_id LEFT JOIN kylin_ticket_time_relation AS d ON d.times_id = c.times_id
LEFT JOIN kylin_ticket_times AS e ON e.ticket_times_id = d.times_id
where d.performance_id = ${performanceId} where d.performance_id = ${performanceId}
and b.is_express = 1 and b.is_express = 1
and b.status IN (2, 3, 6, 7, 8, 9, 10) and b.status IN (2, 3, 6, 7, 8, 9, 10)
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>liquidnet-bus-do</artifactId>
<groupId>com.liquidnet</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>liquidnet-service-sweet-do</artifactId>
</project>
\ No newline at end of file
package com.liquidnet.service.sweet.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 小程序登录记录用户解密后信息表
* </p>
*
* @author jiangxiulong
* @since 2021-09-22
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SweetAppletUser implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* user_id
*/
private String userId;
/**
* openId
*/
@TableField("openId")
private String openId;
/**
* unionId
*/
@TableField("unionId")
private String unionId;
/**
* 手机号
*/
@TableField("getPhoneNumber")
private String getPhoneNumber;
/**
* 手机号
*/
@TableField("getPurePhoneNumber")
private String getPurePhoneNumber;
/**
* 地区码
*/
@TableField("getCountryCode")
private String getCountryCode;
/**
* 1草莓 2五百里 3mdsk 4正在
*/
private Integer type;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
}
package com.liquidnet.service.sweet.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 正在现场服务号关注事件储存用户信息表
* </p>
*
* @author jiangxiulong
* @since 2021-08-03
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SweetWechatUser implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* user_id
*/
private String userId;
/**
* openId
*/
@TableField("openId")
private String openId;
/**
* unionId
*/
@TableField("unionId")
private String unionId;
/**
* 昵称
*/
private String nickname;
/**
* 性别
*/
@TableField("sexDesc")
private String sexDesc;
/**
* 性别 男1
*/
private Integer sex;
/**
* 头像
*/
@TableField("headImgUrl")
private String headImgUrl;
/**
* zh_CN
*/
private String language;
/**
* 国家
*/
private String country;
/**
* 省
*/
private String province;
/**
* 市
*/
private String city;
/**
* 关注时间
*/
@TableField("subscribeTime")
private LocalDateTime subscribeTime;
/**
* ADD_SCENE_SEARCH 关注方式
*/
@TableField("subscribeScene")
private String subscribeScene;
/**
* 是否取消关注
*/
private Integer isCancel;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
private static final SweetWechatUser obj = new SweetWechatUser();
public static SweetWechatUser getNew() {
try {
return (SweetWechatUser) obj.clone();
} catch (CloneNotSupportedException e) {
return new SweetWechatUser();
}
}
}
package com.liquidnet.service.sweet.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.liquidnet.service.sweet.entity.SweetAppletUser;
/**
* <p>
* 小程序登录记录用户解密后信息表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2021-09-22
*/
public interface SweetAppletUserMapper extends BaseMapper<SweetAppletUser> {
}
<?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.SweetWechatUserMapper">
</mapper>
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<module>liquidnet-service-kylin-do</module> <module>liquidnet-service-kylin-do</module>
<module>liquidnet-service-adam-do</module> <module>liquidnet-service-adam-do</module>
<module>liquidnet-service-dragon-do</module> <module>liquidnet-service-dragon-do</module>
<module>liquidnet-service-sweet-do</module>
<module>liquidnet-service-candy-do</module> <module>liquidnet-service-candy-do</module>
</modules> </modules>
......
...@@ -5,12 +5,12 @@ import feign.hystrix.FallbackFactory; ...@@ -5,12 +5,12 @@ 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.PostMapping;
@Component @Component
@FeignClient(name = "liquidnet-service-platform", @FeignClient(name = "liquidnet-service-platform",
contextId = "FeignPlatformAlipayBackClient", path = "", contextId = "FeignPlatformAlipayBackClient", path = "",
url = "", url = "${liquidnet.service.platform.url}",
// url = "",
fallback = FallbackFactory.Default.class) fallback = FallbackFactory.Default.class)
public interface FeignPlatformAlipayBackClient { public interface FeignPlatformAlipayBackClient {
......
package com.liquidnet.service.feign.sweet.task;
import com.liquidnet.service.base.ResponseDto;
import feign.hystrix.FallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
@Component
@FeignClient(name = "liquidnet-service-sweet",
contextId = "FeignSweetTaskActivityClient", path = "",
url = "${liquidnet.service.sweet.url}",
fallback = FallbackFactory.Default.class)
public interface FeignSweetTaskActivityClient {
@GetMapping("sweet/sweetCityVote/setStatList")
ResponseDto<Boolean> setStatList();
}
...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping;
@Component @Component
@FeignClient(name = "liquidnet-service-sweet", @FeignClient(name = "liquidnet-service-sweet",
contextId = "FeignSweetWechatClient", path = "", contextId = "FeignSweetWechatClient", path = "",
url = "", url = "${liquidnet.service.sweet.url}",
fallback = FallbackFactory.Default.class) fallback = FallbackFactory.Default.class)
public interface FeignSweetWechatClient { public interface FeignSweetWechatClient {
......
...@@ -235,14 +235,14 @@ public class AdamUserController { ...@@ -235,14 +235,14 @@ public class AdamUserController {
tagsForSex.add(AdamTagVo.getNew().setVal("MS00").setDesc("保密")); tagsForSex.add(AdamTagVo.getNew().setVal("MS00").setDesc("保密"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS01").setDesc("男性")); tagsForSex.add(AdamTagVo.getNew().setVal("MS01").setDesc("男性"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS02").setDesc("女性")); tagsForSex.add(AdamTagVo.getNew().setVal("MS02").setDesc("女性"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS03").setDesc("跨性别女性")); // tagsForSex.add(AdamTagVo.getNew().setVal("MS03").setDesc("跨性别女性"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS04").setDesc("跨性别男性")); // tagsForSex.add(AdamTagVo.getNew().setVal("MS04").setDesc("跨性别男性"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS05").setDesc("双性别者")); // tagsForSex.add(AdamTagVo.getNew().setVal("MS05").setDesc("双性别者"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS06").setDesc("性别模糊")); // tagsForSex.add(AdamTagVo.getNew().setVal("MS06").setDesc("性别模糊"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS07").setDesc("性别流动")); // tagsForSex.add(AdamTagVo.getNew().setVal("MS07").setDesc("性别流动"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS08").setDesc("无性别者")); // tagsForSex.add(AdamTagVo.getNew().setVal("MS08").setDesc("无性别者"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS09").setDesc("不确定性别")); // tagsForSex.add(AdamTagVo.getNew().setVal("MS09").setDesc("不确定性别"));
tagsForSex.add(AdamTagVo.getNew().setVal("MS10").setDesc("不在乎性别")); // tagsForSex.add(AdamTagVo.getNew().setVal("MS10").setDesc("不在乎性别"));
adamRdmService.setTagsForSex(tagsForSex); adamRdmService.setTagsForSex(tagsForSex);
} }
......
...@@ -340,16 +340,23 @@ public class AdamMemberOrderServiceImpl implements IAdamMemberOrderService { ...@@ -340,16 +340,23 @@ public class AdamMemberOrderServiceImpl implements IAdamMemberOrderService {
toMqSqls.add(SqlMapping.get("adam_user_info.update_by_member")); toMqSqls.add(SqlMapping.get("adam_user_info.update_by_member"));
LinkedList<Object[]> updateUserInfoObjs = this.syncUserInfoProcessing(now, userInfoVo, handleMemberOrderVo); LinkedList<Object[]> updateUserInfoObjs = this.syncUserInfoProcessing(now, userInfoVo, handleMemberOrderVo);
// 权益券发放 // 根据新会员开售时间发放新权益
toMqSqls.add(SqlMapping.get("candy_mgt_coupon.add_for_member")); if (now.isAfter(AdamUserMemberVo.spotTime)) {
LinkedList<Object[]> initMemberRightsCouponObjs = this.issueMemberRightsCouponProcessing(now, userInfoVo.getMobile(), handleMemberOrderVo.getMemberId()); // 权益券发放
toMqSqls.add(SqlMapping.get("candy_mgt_coupon.add_for_member"));
LinkedList<Object[]> initMemberRightsCouponObjs = this.issueMemberRightsCouponProcessing(now, userInfoVo.getMobile(), handleMemberOrderVo.getMemberId());
queueUtils.sendMsgByRedis(
MQConst.AdamQueue.SQL_UMEMBER.getKey(),
SqlMapping.gets(toMqSqls, operationObjs, initMemberOrderObjs, initMemberOrderExtObjs, updateUserInfoObjs, initMemberRightsCouponObjs)
);
} else {
queueUtils.sendMsgByRedis(
MQConst.AdamQueue.SQL_UMEMBER.getKey(),
SqlMapping.gets(toMqSqls, operationObjs, initMemberOrderObjs, initMemberOrderExtObjs, updateUserInfoObjs)
);
}
s = System.currentTimeMillis();
queueUtils.sendMsgByRedis(
MQConst.AdamQueue.SQL_UMEMBER.getKey(),
SqlMapping.gets(toMqSqls, operationObjs, initMemberOrderObjs, initMemberOrderExtObjs, updateUserInfoObjs, initMemberRightsCouponObjs)
);
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
// } else { // } else {
// s = System.currentTimeMillis(); // s = System.currentTimeMillis();
// queueUtils.sendMsgByRedis( // queueUtils.sendMsgByRedis(
......
...@@ -69,6 +69,7 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService { ...@@ -69,6 +69,7 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService {
boolean syncChimeRegisterFlg = false;// 标识同步`service-chime`是否为首次注册 boolean syncChimeRegisterFlg = false;// 标识同步`service-chime`是否为首次注册
List<AdamTagParentVo> tagMe = parameter.getTagMe(); List<AdamTagParentVo> tagMe = parameter.getTagMe();
AdamTagVo beforeSex = existUserInfoVo.getSex();
String uuid = null, type = null; String uuid = null, type = null;
if (!CollectionUtil.isEmpty(tagMe)) {// 标签不为空则注册或更新IM if (!CollectionUtil.isEmpty(tagMe)) {// 标签不为空则注册或更新IM
if (isComplete == 1) {// 注册IM,参见:https://docs-im.easemob.com/im/server/ready/user if (isComplete == 1) {// 注册IM,参见:https://docs-im.easemob.com/im/server/ready/user
...@@ -119,10 +120,9 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService { ...@@ -119,10 +120,9 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService {
adamRdmService.setUserInfoVoByUid(existUserInfoVo.getUid(), existUserInfoVo); adamRdmService.setUserInfoVoByUid(existUserInfoVo.getUid(), existUserInfoVo);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
AdamTagVo existSex = existUserInfoVo.getSex();
String sexStr = JsonUtils.toJson(existUserInfoVo.getSex()); String sexStr = JsonUtils.toJson(existUserInfoVo.getSex());
String tagMeStr = JsonUtils.toJson(tagMe); String tagMeStr = JsonUtils.toJson(tagMe);
if (syncChimeFlg || null == existSex || !parameter.getSex().getVal().equals(existSex.getVal())) {// 同步`service-chime` if (syncChimeFlg || null == beforeSex || !parameter.getSex().getVal().equals(beforeSex.getVal())) {// 同步`service-chime`
ResponseDto<String> chimeRegisterRstFlg = null; ResponseDto<String> chimeRegisterRstFlg = null;
try { try {
chimeRegisterRstFlg = feignAdamChimeClient.registerForUser( chimeRegisterRstFlg = feignAdamChimeClient.registerForUser(
......
...@@ -257,7 +257,7 @@ public class ChimeUserBiz { ...@@ -257,7 +257,7 @@ public class ChimeUserBiz {
return null; return null;
} }
} }
String rsSexDesc = "其他"; String rsSexDesc = "保密";
switch (adamTagVo.getDesc()){ switch (adamTagVo.getDesc()){
case "男性": case "男性":
rsSexDesc = "男"; rsSexDesc = "男";
......
...@@ -40,6 +40,18 @@ ...@@ -40,6 +40,18 @@
<artifactId>liquidnet-common-sms</artifactId> <artifactId>liquidnet-common-sms</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-service-sweet-do</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-service-sweet-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.liquidnet.service; package com.liquidnet.service;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner; import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
...@@ -13,6 +14,7 @@ import java.util.Arrays; ...@@ -13,6 +14,7 @@ import java.util.Arrays;
@Slf4j @Slf4j
@SpringBootApplication(scanBasePackages = {"com.liquidnet"}) @SpringBootApplication(scanBasePackages = {"com.liquidnet"})
@MapperScan(basePackages = {"com.liquidnet.service.sweet.mapper"})
public class ServiceConsumerSweetApplication implements CommandLineRunner { public class ServiceConsumerSweetApplication implements CommandLineRunner {
@Autowired @Autowired
private Environment environment; private Environment environment;
......
package com.liquidnet.service.consumer.sweet.config;
import com.liquidnet.service.consumer.sweet.receiver.ConsumerCityVoteRdsReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.time.Duration;
import static com.liquidnet.service.base.constant.MQConst.SweetQueue.SWEET_CITY_VOTE_DRAW;
@Configuration
public class ConsumerCityVoteRedisStreamConfig {
@Autowired
ConsumerCityVoteRdsReceiver consumerCityVoteRdsReceiver;
private StreamMessageListenerContainer<String, MapRecord<String, String, String>> buildStreamMessageListenerContainer(RedisConnectionFactory factory) {
var options = StreamMessageListenerContainer
.StreamMessageListenerContainerOptions
.builder()
.pollTimeout(Duration.ofMillis(1))
.build();
return StreamMessageListenerContainer.create(factory, options);
}
/**
* 缺票登记
*
* @param listenerContainer
* @param t
* @return
*/
private Subscription receiveSqlCityVote(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(
Consumer.from(SWEET_CITY_VOTE_DRAW.getGroup(), SWEET_CITY_VOTE_DRAW.name() + t),
StreamOffset.create(SWEET_CITY_VOTE_DRAW.getKey(), ReadOffset.lastConsumed()), consumerCityVoteRdsReceiver
);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 缺票登记 */
@Bean
public Subscription subscriptionSqlCityVote(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCityVote(listenerContainer, 1);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlCityVote2(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCityVote(listenerContainer, 1);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlCityVote3(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlCityVote(listenerContainer, 1);
listenerContainer.start();
return subscription;
}
/* -------------------------------------------------------- | */
}
package com.liquidnet.service.consumer.sweet.config;
import com.liquidnet.service.consumer.sweet.receiver.ConsumerSweetTemplateMsgReceiver;
import lombok.var;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.stream.Consumer;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.ReadOffset;
import org.springframework.data.redis.connection.stream.StreamOffset;
import org.springframework.data.redis.stream.StreamMessageListenerContainer;
import org.springframework.data.redis.stream.Subscription;
import java.time.Duration;
import static com.liquidnet.service.base.constant.MQConst.SweetQueue.SWEET_TEMPLATE_MSG;
@Configuration
public class ConsumerSweetTemplateMsgStreamConfig {
@Autowired
ConsumerSweetTemplateMsgReceiver consumerSweetTemplateMsgReceiver;
private StreamMessageListenerContainer<String, MapRecord<String, String, String>> buildStreamMessageListenerContainer(RedisConnectionFactory factory) {
var options = StreamMessageListenerContainer
.StreamMessageListenerContainerOptions
.builder()
.pollTimeout(Duration.ofMillis(1))
.build();
return StreamMessageListenerContainer.create(factory, options);
}
/**
* 缺票登记
*
* @param listenerContainer
* @param t
* @return
*/
private Subscription receiveSqlTemplateMsg(StreamMessageListenerContainer<String, MapRecord<String, String, String>> listenerContainer, int t) {
return listenerContainer.receiveAutoAck(
Consumer.from(SWEET_TEMPLATE_MSG.getGroup(), SWEET_TEMPLATE_MSG.name() + t),
StreamOffset.create(SWEET_TEMPLATE_MSG.getKey(), ReadOffset.lastConsumed()), consumerSweetTemplateMsgReceiver
);
}
/* —————————————————————————— | —————————————————————————— | —————————————————————————— */
/* -------------------------------------------------------- | 缺票登记 */
@Bean
public Subscription subscriptionSqlTemplateMsg(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlTemplateMsg(listenerContainer, 1);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlTemplateMsg2(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlTemplateMsg(listenerContainer, 1);
listenerContainer.start();
return subscription;
}
@Bean
public Subscription subscriptionSqlTemplateMsg3(RedisConnectionFactory factory) {
var listenerContainer = this.buildStreamMessageListenerContainer(factory);
var subscription = receiveSqlTemplateMsg(listenerContainer, 1);
listenerContainer.start();
return subscription;
}
/* -------------------------------------------------------- | */
}
package com.liquidnet.service.consumer.sweet.receiver; package com.liquidnet.service.consumer.sweet.receiver;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils; import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.SqlMapping; import com.liquidnet.service.base.SqlMapping;
...@@ -20,8 +19,6 @@ public abstract class AbstractSqlRedisReceiver implements StreamListener<String, ...@@ -20,8 +19,6 @@ public abstract class AbstractSqlRedisReceiver implements StreamListener<String,
public IBaseDao baseDao; public IBaseDao baseDao;
@Autowired @Autowired
StringRedisTemplate stringRedisTemplate; StringRedisTemplate stringRedisTemplate;
@Autowired
private RedisUtil redisUtil;
@Override @Override
public void onMessage(MapRecord<String, String, String> message) { public void onMessage(MapRecord<String, String, String> message) {
......
package com.liquidnet.service.consumer.sweet.receiver;
import com.liquidnet.service.base.constant.MQConst;
import org.springframework.stereotype.Component;
@Component
public class ConsumerCityVoteRdsReceiver extends AbstractSqlRedisReceiver {
@Override
protected String getRedisStreamKey() {
return MQConst.SweetQueue.SWEET_CITY_VOTE_DRAW.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.SweetQueue.SWEET_CITY_VOTE_DRAW.getGroup();
}
}
package com.liquidnet.service.consumer.sweet.receiver;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.consumer.sweet.service.impl.SweetWechatTemplateMsgServiceImpl;
import com.liquidnet.service.sweet.dto.param.SweetOpenSendMsgParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.stream.MapRecord;
import org.springframework.data.redis.connection.stream.StreamRecords;
import org.springframework.stereotype.Component;
import java.util.HashMap;
@Slf4j
@Component
public class ConsumerSweetTemplateMsgReceiver extends AbstractSqlRedisReceiver {
@Autowired
SweetWechatTemplateMsgServiceImpl sweetWechatTemplateService;
@Override
protected String getRedisStreamKey() {
return MQConst.SweetQueue.SWEET_TEMPLATE_MSG.getKey();
}
@Override
protected String getRedisStreamGroup() {
return MQConst.SweetQueue.SWEET_TEMPLATE_MSG.getGroup();
}
@Override
public void onMessage(MapRecord<String, String, String> message) {
log.debug("CONSUMER SQL[streamKey:{},messageId:{},stream:{},body:{}]",
this.getRedisStreamKey(), message.getId(), message.getStream(), message.getValue());
boolean result = this.consumerSqlDaoHandler(message.getValue().get("message"));
log.info("CONSUMER SQL RESULT:{} ==> MESSAGE_ID:{}", result, message.getId());
try {
stringRedisTemplate.opsForStream().acknowledge(getRedisStreamGroup(), message);
stringRedisTemplate.opsForStream().delete(this.getRedisStreamKey(), message.getId());
} catch (Exception e) {
log.error("#CONSUMER SQL RESULT:{} ==> DEL_REDIS_QUEUE_MSG_EXCEPTION[MESSAGE_ID:{},MSG:{}]", result, message.getId(), JsonUtils.toJson(message), e);
} finally {
try {
stringRedisTemplate.opsForStream().acknowledge(getRedisStreamGroup(), message);
stringRedisTemplate.opsForStream().delete(this.getRedisStreamKey(), message.getId());
} catch (Exception ignored) {
}
}
}
private boolean consumerSqlDaoHandler(String msg) {
Boolean aBoolean = false;
try {
SweetOpenSendMsgParam sweetOpenSendMsgParam = JsonUtils.fromJson(msg, SweetOpenSendMsgParam.class);
if (sweetOpenSendMsgParam == null) {
aBoolean = true;
} else {
aBoolean = sweetWechatTemplateService.openSendMsg(sweetOpenSendMsgParam);
}
} catch (Exception e) {
log.error("CONSUMER SQL FAIL ==> {}", e.getMessage(), e);
} finally {
if (!aBoolean) {
HashMap<String, String> map = CollectionUtil.mapStringString();
map.put("message", msg);
stringRedisTemplate.opsForStream().add(StreamRecords.mapBacked(map).withStreamKey(this.getRedisStreamKey()));
}
}
return aBoolean;
}
}
package com.liquidnet.service.consumer.sweet.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.liquidnet.service.consumer.sweet.utils.RedisDataUtils;
import com.liquidnet.service.sweet.config.WechatMaConfigure;
import com.liquidnet.service.sweet.config.WechatMpConfigure;
import com.liquidnet.service.sweet.dto.param.SweetOpenSendMsgParam;
import com.liquidnet.service.sweet.entity.SweetAppletUser;
import com.liquidnet.service.sweet.entity.SweetWechatUser;
import com.liquidnet.service.sweet.mapper.SweetAppletUserMapper;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
/**
* <p>
* 公众号模版消息 服务实现类
* </p>
*
* @author liquidnet
* @since 2021-07-27
*/
@Slf4j
@Service
public class SweetWechatTemplateMsgServiceImpl {
@Autowired
WechatMpConfigure wechatMpConfigure;
@Autowired
WechatMaConfigure wechatMaConfigure;
@Autowired
private SweetAppletUserMapper sweetAppletUserMapper;
@Autowired
private RedisDataUtils redisDataUtils;
public Boolean openSendMsg(SweetOpenSendMsgParam param) {
String openId = getOpenId(param.getPhone(), param.getSendTargetType());
if (openId.isEmpty()) {
return true;
}
WxMpTemplateMessage templateMessage = null;
if (param.getJumpType() == 5) {
templateMessage = getTemplateMessage(param.getTemplateId(), openId, param.getJumpUrl());
} else {
templateMessage = getTemplateMessage(param.getTemplateId(), openId, param.getJumpType(), param.getJumpAppletPagePath(), param.getJumpAppletUsePath());
}
// 添加模板数据
String templateData = param.getTemplateData();
JSONObject templateDataJObj = JSONObject.parseObject(templateData);
for (Map.Entry<String, Object> entry : templateDataJObj.entrySet()) {
templateMessage.addData(new WxMpTemplateData(entry.getKey(), String.valueOf(entry.getValue())));
}
String msgId = sendTmpMsg(templateMessage, param.getSendTargetType());
if (null == msgId) {
return false;
} else {
return true;
}
}
/**
* 获取templateMessage
*
* @param templateId
* @param openId
* @param url
* @return
*/
private WxMpTemplateMessage getTemplateMessage(String templateId, String openId, String url) {
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(openId) // 接收者openid
.templateId(templateId) // 模板id
.url(url) // 模板跳转链接
.build();
return templateMessage;
}
private WxMpTemplateMessage getTemplateMessage(String templateId, String openId, Integer jumpType, String jumpAppletPagePath, Boolean jumpAppletUsePath) {
//配置小程序信息
WxMpTemplateMessage.MiniProgram miniProgram = new WxMpTemplateMessage.MiniProgram();
miniProgram.setAppid(wechatMaConfigure.getWxMaAppid(jumpType));//小程序appid
miniProgram.setUsePath(jumpAppletUsePath);//true的话需要前端配合处理跳转
miniProgram.setPagePath(jumpAppletPagePath);//用户点击时需要跳转的小程序页面
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(openId) // 接收者openid
.templateId(templateId) // 模板id
.miniProgram(miniProgram) // 模板跳转链接
.build();
return templateMessage;
}
private String getOpenId(String phone, Integer sendTargetType) { // sendTargetType 将来如果加入其他服务号用获取不同openId
List<SweetAppletUser> sweetAppletUsers = sweetAppletUserMapper.selectList(Wrappers.lambdaQuery(SweetAppletUser.class).eq(SweetAppletUser::getGetPurePhoneNumber, phone));
if (CollectionUtils.isEmpty(sweetAppletUsers)) {
log.info("getOpenId没有此applet用户:[phone=[{}]", phone);
return "";
} else {
SweetAppletUser sweetAppletUser = sweetAppletUsers.get(0);
SweetWechatUser userInfo = redisDataUtils.getSweetWechatUser(sweetAppletUser.getUnionId());
if (null == userInfo) {
log.info("getOpenId没有此WechatUser用户:[phone={},unionId={}]", phone, sweetAppletUser.getUnionId());
return "";
} else {
return userInfo.getOpenId();
}
}
}
private String sendTmpMsg(WxMpTemplateMessage templateMessage, Integer sendTargetType) {
String msgId = null;
try {
// 发送模板消息
WxMpService wxMpService = wechatMpConfigure.getWxMpService(sendTargetType);
log.info("sendTmpMsg-isAccessTokenExpired:[{}] ", wxMpService.getWxMpConfigStorage().isAccessTokenExpired());
log.info("sendTmpMsg-getAccessToken:[{}] ", wxMpService.getWxMpConfigStorage().getAccessToken());
msgId = wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
log.info("模版消息发送成功:[msgId={}]", msgId);
} catch (WxErrorException e) {
log.error("模版消息发送异常", e);
}
return msgId;
}
}
package com.liquidnet.service.consumer.sweet.utils;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.sweet.constant.SweetConstant;
import com.liquidnet.service.sweet.entity.SweetWechatUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class RedisDataUtils {
@Autowired
private RedisUtil redisUtil;
public SweetWechatUser getSweetWechatUser(String unionid) {
if (unionid.isEmpty()) {
return null;
}
String redisKey = SweetConstant.REDIS_KEY_SWEET_WECHAT_USER_INFO.concat(unionid);
return (SweetWechatUser) redisUtil.get(redisKey);
}
}
package com.liquidnet.service.executor.main.handler;
import com.liquidnet.service.feign.sweet.task.FeignSweetTaskActivityClient;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* sweet
*/
@Component
public class SweetCityVoteTaskHandler {
private static final Logger log = LoggerFactory.getLogger(SweetCityVoteTaskHandler.class);
@Autowired
private FeignSweetTaskActivityClient feignSweetTaskActivityClient;
@XxlJob(value = "sev-sweet:cityVoteStat")
public ReturnT<String> cityVoteStatHandler() {
try {
feignSweetTaskActivityClient.setStatList().getData();
log.info("cityVoteStatHandler:结果:success");
return ReturnT.SUCCESS;
} catch (Exception e) {
return ReturnT.FAIL;
}
}
}
package com.liquidnet.service.executor.main.handler; package com.liquidnet.service.executor.main.handler;
import com.liquidnet.service.feign.sweet.task.FeignSweetTaskActivityClient;
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.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
...@@ -18,6 +19,9 @@ public class SweetWechatTaskHandler { ...@@ -18,6 +19,9 @@ public class SweetWechatTaskHandler {
@Autowired @Autowired
private FeignSweetWechatClient feignSweetWechatClient; private FeignSweetWechatClient feignSweetWechatClient;
/*@Autowired
private FeignSweetTaskActivityClient feignSweetTaskActivityClient;*/
@XxlJob(value = "sev-sweet:sendMsg") @XxlJob(value = "sev-sweet:sendMsg")
public ReturnT<String> sendWechatMsgHandler() { public ReturnT<String> sendWechatMsgHandler() {
try { try {
...@@ -29,4 +33,15 @@ public class SweetWechatTaskHandler { ...@@ -29,4 +33,15 @@ public class SweetWechatTaskHandler {
} }
} }
/*@XxlJob(value = "sev-sweet:cityVoteStat")
public ReturnT<String> cityVoteStatHandler() {
try {
feignSweetTaskActivityClient.setStatList().getData();
log.info("cityVoteStatHandler:结果:success");
return ReturnT.SUCCESS;
} catch (Exception e) {
return ReturnT.FAIL;
}
}*/
} }
...@@ -66,13 +66,13 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -66,13 +66,13 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
@Override @Override
public PageInfo<List<KylinOrderListVo>> orderList() { public PageInfo<List<KylinOrderListVo>> orderList() {
//TODO 缺快递
PageInfo<List<KylinOrderListVo>> mPageInfo = null; PageInfo<List<KylinOrderListVo>> mPageInfo = null;
String uid = CurrentUtil.getCurrentUid(); String uid = CurrentUtil.getCurrentUid();
try { try {
List<KylinOrderListVo> voList = dataUtils.getOrderList(uid); List<KylinOrderListVo> voList = dataUtils.getOrderList(uid);
for (int i = 0; i < voList.size(); i++) { for (int i = 0; i < voList.size(); i++) {
KylinOrderListVo item = voList.get(i); KylinOrderListVo item = voList.get(i);
item.setStatus(item.getStatus()); item.setStatus(item.getStatus());
Integer orderExpressStatus = dataUtils.getOrderExpressInfo(item.getOrderTicketsId()); Integer orderExpressStatus = dataUtils.getOrderExpressInfo(item.getOrderTicketsId());
item.setExpressStatus(orderExpressStatus); item.setExpressStatus(orderExpressStatus);
...@@ -717,13 +717,13 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService { ...@@ -717,13 +717,13 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
orderTicketEntities.setUserId(uid); orderTicketEntities.setUserId(uid);
orderTicketEntities.setPerformanceId(performanceData.getPerformancesId()); orderTicketEntities.setPerformanceId(performanceData.getPerformancesId());
orderTicketEntities.setTimeId(ticketTimesData.getTicketTimesId()); orderTicketEntities.setTimeId(ticketTimesData.getTicketTimesId());
orderTicketEntities.setEnterType(entitiesVo.getEnterType());
if (entersVoList.size() > 0) { if (entersVoList.size() > 0) {
orderTicketEntities.setEnterType(entersVoList.get(i).getType());
orderTicketEntities.setEnterName(entersVoList.get(i).getName()); orderTicketEntities.setEnterName(entersVoList.get(i).getName());
orderTicketEntities.setEnterMobile(entersVoList.get(i).getMobile()); orderTicketEntities.setEnterMobile(entersVoList.get(i).getMobile());
orderTicketEntities.setEnterIdCode(entersVoList.get(i).getIdCard()); orderTicketEntities.setEnterIdCode(entersVoList.get(i).getIdCard());
} else { } else {
orderTicketEntities.setEnterType(entitiesVo.getEnterType());
orderTicketEntities.setEnterName(entitiesVo.getEnterName()); orderTicketEntities.setEnterName(entitiesVo.getEnterName());
orderTicketEntities.setEnterMobile(entitiesVo.getEnterMobile()); orderTicketEntities.setEnterMobile(entitiesVo.getEnterMobile());
orderTicketEntities.setEnterIdCode(entitiesVo.getEnterIdCode()); orderTicketEntities.setEnterIdCode(entitiesVo.getEnterIdCode());
......
package com.liquidnet.service.order.dto;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ApiModel(value = "SweetOpenSendMsgParam", description = "发送模版消息公共接口入参")
@Data
public class SweetOpenSendMsgParam implements Serializable,Cloneable {
private static final long serialVersionUID = 675588088506034208L;
@ApiModelProperty(position = 11, required = true, allowableValues = "1,2", value = "发送目标类型 1正在服务号 2摩登服务号")
@NotNull(message = "sendTargetType不能为空") @Min(value = 1, message = "sendTargetType无效") @Max(value = 2, message = "sendTargetType无效")
private Integer sendTargetType;
@ApiModelProperty(position = 12, required = true, value = "模版消息ID", example = "y-j82V1TYhlTH1j8QscuDPcPQtNiDtENb7N5IZMBvqU")
@NotBlank(message = "templateId不能为空")
private String templateId;
@ApiModelProperty(position = 13, required = true, value = "模版消息数据", example = "{\"first\": \"感谢关注「正在现场」服务号\", \"keyword2\": \"4006-310-750\"}")
@NotBlank(message = "templateData不能为空")
private String templateData;
@ApiModelProperty(position = 14, required = true, allowableValues = "1,2,3,4,5", value = "点击跳转类型 1草莓小程序 2五百里小程序 3mdsk小程序 4正在小程序 5url")
@NotNull(message = "jumpType不能为空") @Min(value = 1, message = "jumpType无效") @Max(value = 5, message = "jumpType无效")
private Integer jumpType;
@ApiModelProperty(position = 15, value = "跳转url", example = "www.zhengzai.tv")
private String jumpUrl;
@ApiModelProperty(position = 16, allowableValues = "false,true", value = "是否需要前端配合处理跳转,直接跳转jumpAppletPagePath为false,true时需要前端根据状态码做跳转处理")
private Boolean jumpAppletUsePath;
@ApiModelProperty(position = 17, value = "跳转小程序需要的某页地址", example = "pages/webview?query=lottery")
private String jumpAppletPagePath;
@ApiModelProperty(position = 18, required = true, value = "openId", example = "oUpkkuNe4yuVs77aaKFvuvpgNOSw")
@NotBlank(message = "openId不能为空")
private String openId;
@ApiModelProperty(position = 18, required = true, value = "phone", example = "15888888888")
@NotBlank(message = "phone不能为空")
private String phone;
private static final SweetOpenSendMsgParam obj = new SweetOpenSendMsgParam();
public static SweetOpenSendMsgParam getNew() {
try {
return (SweetOpenSendMsgParam) obj.clone();
} catch (CloneNotSupportedException e) {
return new SweetOpenSendMsgParam();
}
}
}
package com.liquidnet.service.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@ApiModel(value = "SweetOpenSendMsgParam", description = "发送模版消息公共接口入参")
@Data
public class TemplateOrderParam implements Serializable,Cloneable {
private static final long serialVersionUID = 675588088506034208L;
private String first;
private String keyword1;
private String keyword2;
private String keyword3;
private String keyword4;
private String remark;
private static final TemplateOrderParam obj = new TemplateOrderParam();
public static TemplateOrderParam getNew() {
try {
return (TemplateOrderParam) obj.clone();
} catch (CloneNotSupportedException e) {
return new TemplateOrderParam();
}
}
}
package com.liquidnet.service.order.service.impl; package com.liquidnet.service.order.service.impl;
import com.alibaba.fastjson.JSON;
import com.liquidnet.common.cache.redis.util.RedisUtil; import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.common.sms.constant.SmsEnum; import com.liquidnet.common.sms.constant.SmsEnum;
import com.liquidnet.commons.lang.util.*; import com.liquidnet.commons.lang.util.*;
...@@ -23,6 +24,8 @@ import com.liquidnet.service.kylin.dto.vo.returns.PayInnerResultVo; ...@@ -23,6 +24,8 @@ import com.liquidnet.service.kylin.dto.vo.returns.PayInnerResultVo;
import com.liquidnet.service.kylin.dto.vo.returns.PayResultVo; import com.liquidnet.service.kylin.dto.vo.returns.PayResultVo;
import com.liquidnet.service.kylin.entity.*; import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.service.IKylinOrderTicketsOrderService; import com.liquidnet.service.kylin.service.IKylinOrderTicketsOrderService;
import com.liquidnet.service.order.dto.SweetOpenSendMsgParam;
import com.liquidnet.service.order.dto.TemplateOrderParam;
import com.liquidnet.service.order.utils.*; import com.liquidnet.service.order.utils.*;
import com.taobao.api.TaobaoClient; import com.taobao.api.TaobaoClient;
import com.taobao.api.request.AlibabaDamaiMevOpenBatchpushticketRequest; import com.taobao.api.request.AlibabaDamaiMevOpenBatchpushticketRequest;
...@@ -912,7 +915,33 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ ...@@ -912,7 +915,33 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
.setTemplateParam("time", time1 + " " + time2).toJson() .setTemplateParam("time", time1 + " " + time2).toJson()
); );
} }
//模板消息
// try {
// String fieldName = performanceData.getFieldName();
// Integer number = orderTicketData.getNumber();
// String useTime = orderTicketData.getUseStart();
// String performanceName = performanceData.getTitle();
// SweetOpenSendMsgParam param = SweetOpenSendMsgParam.getNew();
// param.setSendTargetType(1);
// param.setTemplateId("glzgM9PLgchlaenpXN5H3N9JDwV69a52R8H6z95hzrA");
// TemplateOrderParam templateOrderParam = TemplateOrderParam.getNew();
// templateOrderParam.setFirst("您已购票成功");
// templateOrderParam.setKeyword1(performanceName);
// templateOrderParam.setKeyword2(number.toString());
// templateOrderParam.setKeyword3(useTime);
// templateOrderParam.setKeyword4(fieldName);
// templateOrderParam.setRemark("点击详情 查看更多票务信息");
// param.setTemplateData(JSON.toJSONString(templateOrderParam));
// param.setJumpType(4);
// param.setJumpUrl("http://m.zhengzai.tv/#/order/ticket/orderdetail?id=" + orderTicketData.getOrderTicketsId());
// param.setJumpAppletPagePath("/pages/webview?query=orderDetail&id=" + orderTicketData.getOrderTicketsId());
// param.setJumpAppletUsePath(false);
// param.setPhone(orderTicketData.getUserMobile());
// queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_TEMPLATE_MSG.getKey(),
// JsonUtils.toJson(param));
// }catch (Exception e){
// log.info("下单消息模版错误",e);
// }
// 大麦回调 // 大麦回调
// sycDamaiOrder(orderTickets.getOrderTicketsId(), orderTicketData.getIsMember()); // sycDamaiOrder(orderTickets.getOrderTicketsId(), orderTicketData.getIsMember());
} }
......
...@@ -28,7 +28,7 @@ kylin_order_ticket_entities.synPay=UPDATE kylin_order_ticket_entities SET is_pay ...@@ -28,7 +28,7 @@ kylin_order_ticket_entities.synPay=UPDATE kylin_order_ticket_entities SET is_pay
kylin_order_ticket_status.overtimeRefund=UPDATE kylin_order_ticket_status SET status = ? ,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null) kylin_order_ticket_status.overtimeRefund=UPDATE kylin_order_ticket_status SET status = ? ,updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_tickets.overtimeRefund=UPDATE kylin_order_tickets SET payment_id = ? , payment_type = ? ,updated_at = ? WHERE order_tickets_id = ? and (updated_at <= ? or created_at = ? or updated_at is null) kylin_order_tickets.overtimeRefund=UPDATE kylin_order_tickets SET payment_id = ? , payment_type = ? ,updated_at = ? WHERE order_tickets_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_ticket_entities.overtimeRefund=UPDATE kylin_order_ticket_entities SET is_payment = ? ,updated_at = ? WHERE order_ticket_entities_id = ? and (updated_at <= ? or created_at = ? or updated_at is null) kylin_order_ticket_entities.overtimeRefund=UPDATE kylin_order_ticket_entities SET is_payment = ? ,updated_at = ? WHERE order_ticket_entities_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
kylin_order_refund.overtimeRefund=INSERT INTO kylin_order_refunds (order_refunds_id,order_tickets_id,order_refund_code,price,price_express,status,type,applicant_id,applicant_name,applicant_at,reason,created_at) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?) kylin_order_refund.overtimeRefund=INSERT INTO kylin_order_refunds (order_refunds_id,order_tickets_id,order_refund_code,price,price_express,status,type,applicant_id,applicant_name,applicant_at,reason,created_at) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)
kylin_order_refund_entities.overtimeRefund=INSERT INTO kylin_order_refund_entities (order_refunds_entities_id,order_refunds_id,refund_price,order_ticket_entities_id,created_at) VALUES(?,?,?,?,?) kylin_order_refund_entities.overtimeRefund=INSERT INTO kylin_order_refund_entities (order_refunds_entities_id,order_refunds_id,refund_price,order_ticket_entities_id,created_at) VALUES(?,?,?,?,?)
......
...@@ -29,7 +29,7 @@ import java.util.List; ...@@ -29,7 +29,7 @@ import java.util.List;
* 演出 服务实现类 * 演出 服务实现类
* </p> * </p>
* *
* @author liquidnet * @author jiangxiulong
* @since 2021-05-05 * @since 2021-05-05
*/ */
@Service @Service
...@@ -119,7 +119,7 @@ public class PerformancesExpressCallbackServiceImpl extends ServiceImpl<KylinOrd ...@@ -119,7 +119,7 @@ public class PerformancesExpressCallbackServiceImpl extends ServiceImpl<KylinOrd
public boolean orderRoute(@RequestBody String params) { public boolean orderRoute(@RequestBody String params) {
boolean res = shunfengSignUtils.receiveRequestAndCheckSign(params, httpServletRequest); boolean res = shunfengSignUtils.receiveRequestAndCheckSign(params, httpServletRequest);
// {"id":"123","mailno":"SF1020099313222","orderid":"NEW127745085969203221966686005","acceptTime":"2021-06-20 11:37:33","acceptAddress":"深圳市","remark":"顺丰已收件(测试推送)","opCode":"80","companyId":"557104628450889728","routeAddress":"https://devplatform.zhengzai.tv/platform/performancesExpress/orderRoute"} // {"id":"123","mailno":"SF1020099313222","orderid":"NEW127745085969203221966686005","acceptTime":"2021-06-20 11:37:33","acceptAddress":"深圳市","remark":"顺丰已收件(测试推送)","opCode":"80","companyId":"557104628450889728","routeAddress":"https://devplatform.zhengzai.tv/platform/performancesExpress/orderRoute"}
if (true) { if (res) {
PerformanceExpressPushRouteParam performanceExpressPushRouteParam = JsonUtils.fromJson(params, PerformanceExpressPushRouteParam.class); PerformanceExpressPushRouteParam performanceExpressPushRouteParam = JsonUtils.fromJson(params, PerformanceExpressPushRouteParam.class);
KylinOrderExpressRoute kylinOrderExpressRoute = new KylinOrderExpressRoute(); KylinOrderExpressRoute kylinOrderExpressRoute = new KylinOrderExpressRoute();
String orderExpressRouteId = IDGenerator.nextSnowId(); String orderExpressRouteId = IDGenerator.nextSnowId();
......
...@@ -480,6 +480,45 @@ CREATE TABLE `sweet_answer` ...@@ -480,6 +480,45 @@ CREATE TABLE `sweet_answer`
COLLATE utf8mb4_unicode_ci COLLATE utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT '答题表'; ROW_FORMAT = DYNAMIC COMMENT '答题表';
-- 城市投票表
drop TABLE if exists `sweet_city_vote`;
CREATE TABLE `sweet_city_vote`
(
`mid` bigint unsigned NOT NULL AUTO_INCREMENT,
`vote_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'vote_id',
`phone` varchar(11) NOT NULL DEFAULT '' COMMENT '手机号',
`openId` varchar(255) NOT NULL DEFAULT '' COMMENT 'openId',
`unionId` varchar(255) NOT NULL DEFAULT '' COMMENT 'unionId',
`city_code` varchar(255) NOT NULL DEFAULT '' COMMENT '城市代码',
`city_name` varchar(255) NOT NULL DEFAULT '' COMMENT '城市名称',
`day_time` varchar(255) NOT NULL DEFAULT '' COMMENT '投票天',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`),
KEY `sweet_city_vote_vote_id` (`vote_id`)
) ENGINE = InnoDB
DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT '城市投票表';
drop TABLE if exists `sweet_city_vote_stat`;
CREATE TABLE `sweet_city_vote_stat`
(
`mid` bigint unsigned NOT NULL AUTO_INCREMENT,
`stat_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'stat_id',
`city_code` varchar(255) NOT NULL DEFAULT '' COMMENT '城市代码',
`city_name` varchar(255) NOT NULL DEFAULT '' COMMENT '城市名称',
`vote_num` int NOT NULL DEFAULT 0 COMMENT '真实投票数量',
`manual_vote_num` int NOT NULL DEFAULT 0 COMMENT '手动增加投票数量',
`created_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`mid`),
KEY `sweet_city_vote_stat_stat_id` (`stat_id`)
) ENGINE = InnoDB
DEFAULT CHARSET utf8mb4
COLLATE utf8mb4_unicode_ci
ROW_FORMAT = DYNAMIC COMMENT '城市投票统计表';
-- 提醒记录 -- 提醒记录
drop TABLE if exists `sweet_remind`; drop TABLE if exists `sweet_remind`;
CREATE TABLE `sweet_remind` CREATE TABLE `sweet_remind`
......
...@@ -23,4 +23,12 @@ XGROUP CREATE sweet:stream:rk.remindInsert group.remindInsert 0 ...@@ -23,4 +23,12 @@ XGROUP CREATE sweet:stream:rk.remindInsert group.remindInsert 0
-- 小程序登录记录用户解密后信息 -- -- 小程序登录记录用户解密后信息 --
XADD sweet:stream:rk.sweetAppletUserInsert * 0 0 XADD sweet:stream:rk.sweetAppletUserInsert * 0 0
XGROUP CREATE sweet:stream:rk.sweetAppletUserInsert group.sweetAppletUserInsert 0 XGROUP CREATE sweet:stream:rk.sweetAppletUserInsert group.sweetAppletUserInsert 0
\ No newline at end of file
-- 发送模版消息 --
XADD sweet:stream:rk.sweetTemplateMsg * 0 0
XGROUP CREATE sweet:stream:rk.sweetTemplateMsg group.sweetTemplateMsg 0
-- 用户投票记录 --
XADD sweet:stream:rk.cityVote * 0 0
XGROUP CREATE sweet:stream:rk.cityVote group.cityVote 0
\ No newline at end of file
...@@ -140,4 +140,18 @@ public class WechatMaConfigure { ...@@ -140,4 +140,18 @@ public class WechatMaConfigure {
} }
return null; return null;
} }
public String getWxMaAppid(Integer anum) {
switch (anum) {
case 4:
return appletAppidZhengzai;
case 1:
return appletAppidStrawberry;
case 2:
return appletAppidFive;
case 3:
return appletAppidMdsk;
}
return "";
}
} }
...@@ -24,6 +24,10 @@ public class SweetConstant { ...@@ -24,6 +24,10 @@ public class SweetConstant {
public final static String REDIS_KEY_SWEET_WECHAT_USER_INFO_STR="sweet:wechatUser:unionIdStr:"; public final static String REDIS_KEY_SWEET_WECHAT_USER_INFO_STR="sweet:wechatUser:unionIdStr:";
public final static String REDIS_KEY_SWEET_WECHAT_USER_UNIONID="sweet:wechatUser:openId:"; public final static String REDIS_KEY_SWEET_WECHAT_USER_UNIONID="sweet:wechatUser:openId:";
public final static String REDIS_KEY_SWEET_ANSWER_PHONE="sweet:answer:phone:"; public final static String REDIS_KEY_SWEET_ANSWER_PHONE="sweet:answer:phone:";
public final static String REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST="sweet:cityVote:StatList";
public final static String REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE="sweet:cityVote:cityCode:";
public final static String REDIS_KEY_SWEET_CITY_VOTE_USER="sweet:cityVote:user:";
public final static String REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME="sweet:cityVote:updateTime";
// public enum ManualPosition { // public enum ManualPosition {
// artist("艺人","artist"), // artist("艺人","artist"),
......
package com.liquidnet.service.sweet.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.param.SweetCityVoteParam;
import com.liquidnet.service.sweet.service.ISweetCityVoteService;
import com.liquidnet.service.sweet.vo.SweetCItyVoteStatVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* <p>
* 城市投票表 前端控制器
* </p>
*
* @author jiangxiulong
* @since 2021-09-15
*/
@Api(tags = "城市投票")
@RestController
@RequestMapping("/sweetCityVote")
public class SweetCityVoteController {
@Autowired
private ISweetCityVoteService sweetCityVoteService;
@GetMapping("statList")
@ApiOperation("城市投票排名")
@ApiImplicitParams({
@ApiImplicitParam(type = "query", dataType = "String", name = "phone", value = "手机号", required = true),
@ApiImplicitParam(type = "query", dataType = "String", name = "unionId", value = "unionId", required = true)
})
public ResponseDto<List<SweetCItyVoteStatVo>> getList(
@RequestParam String phone,
@RequestParam String unionId
) {
return sweetCityVoteService.getList(phone, unionId);
}
@PostMapping("createVote")
@ApiOperation("用户投票记录")
public ResponseDto createVote(@Valid @RequestBody SweetCityVoteParam param) {
return sweetCityVoteService.createVote(param);
}
@GetMapping("setStatList")
@ApiOperation("统计投票排名")
public ResponseDto setStatList() {
return sweetCityVoteService.setStatList();
}
}
package com.liquidnet.service.sweet.controller; package com.liquidnet.service.sweet.controller;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.param.SweetOpenSendMsgParam;
import com.liquidnet.service.sweet.service.impl.SweetWechatTemplateServiceImpl; import com.liquidnet.service.sweet.service.impl.SweetWechatTemplateServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -9,6 +10,8 @@ import io.swagger.annotations.ApiOperation; ...@@ -9,6 +10,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 javax.validation.Valid;
@Api(tags = "公众号模版消息") @Api(tags = "公众号模版消息")
@RestController @RestController
@RequestMapping("/wechatTemplate") @RequestMapping("/wechatTemplate")
...@@ -23,6 +26,12 @@ public class SweetWechatTemplateController { ...@@ -23,6 +26,12 @@ public class SweetWechatTemplateController {
return sweetTemplateService.sendRemindMsg(); return sweetTemplateService.sendRemindMsg();
} }
@PostMapping("openSend")
@ApiOperation("发送模版消息公共接口")
public ResponseDto openSend(@Valid @RequestBody SweetOpenSendMsgParam param) {
return sweetTemplateService.openSendMsg(param);
}
@PostMapping("remind") @PostMapping("remind")
@ApiOperation("提醒记录") @ApiOperation("提醒记录")
@ApiImplicitParams({ @ApiImplicitParams({
......
package com.liquidnet.service.sweet.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel
public class SweetCityVoteStatDto implements Serializable ,Cloneable{
private static final long serialVersionUID = -3159959399631688127L;
@ApiModelProperty("城市代码")
private String cityCode;
@ApiModelProperty("城市名称")
private String cityName;
@ApiModelProperty("真实投票数量")
private Integer voteNum;
@ApiModelProperty("手动增加投票数量")
private Integer manualVoteNum;
@ApiModelProperty("总投票数")
private Integer totalNum;
private static final SweetCityVoteStatDto obj = new SweetCityVoteStatDto();
public static SweetCityVoteStatDto getNew() {
try {
return (SweetCityVoteStatDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new SweetCityVoteStatDto();
}
}
}
package com.liquidnet.service.sweet.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 小程序登录记录用户解密后信息表
* </p>
*
* @author jiangxiulong
* @since 2021-09-22
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SweetAppletUser implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* user_id
*/
private String userId;
/**
* openId
*/
@TableField("openId")
private String openId;
/**
* unionId
*/
@TableField("unionId")
private String unionId;
/**
* 手机号
*/
@TableField("getPhoneNumber")
private String getPhoneNumber;
/**
* 手机号
*/
@TableField("getPurePhoneNumber")
private String getPurePhoneNumber;
/**
* 地区码
*/
@TableField("getCountryCode")
private String getCountryCode;
/**
* 1草莓 2五百里 3mdsk 4正在
*/
private Integer type;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
}
package com.liquidnet.service.sweet.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 城市投票表
* </p>
*
* @author jiangxiulong
* @since 2021-09-15
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SweetCityVote implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* vote_id
*/
private String voteId;
/**
* 手机号
*/
private String phone;
/**
* openId
*/
@TableField("openId")
private String openId;
/**
* unionId
*/
@TableField("unionId")
private String unionId;
/**
* 城市代码
*/
private String cityCode;
/**
* 城市名称
*/
private String cityName;
/**
* 投票天
*/
private String dayTime;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
private static final SweetCityVote obj = new SweetCityVote();
public static SweetCityVote getNew() {
try {
return (SweetCityVote) obj.clone();
} catch (CloneNotSupportedException e) {
return new SweetCityVote();
}
}
}
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-09-15
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SweetCityVoteStat implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* stat_id
*/
private String statId;
/**
* 城市代码
*/
private String cityCode;
/**
* 城市名称
*/
private String cityName;
/**
* 真实投票数量
*/
private Integer voteNum;
/**
* 手动增加投票数量
*/
private Integer manualVoteNum;
/**
* 创建时间
*/
private LocalDateTime createdAt;
/**
* 更新时间
*/
private LocalDateTime updatedAt;
}
package com.liquidnet.service.sweet.mapper;
import com.liquidnet.service.sweet.entity.SweetCityVote;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 城市投票表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2021-09-15
*/
public interface SweetCityVoteMapper extends BaseMapper<SweetCityVote> {
}
package com.liquidnet.service.sweet.mapper;
import com.liquidnet.service.sweet.dto.SweetCityVoteStatDto;
import com.liquidnet.service.sweet.entity.SweetCityVoteStat;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* 城市投票统计表 Mapper 接口
* </p>
*
* @author jiangxiulong
* @since 2021-09-15
*/
public interface SweetCityVoteStatMapper extends BaseMapper<SweetCityVoteStat> {
List<SweetCityVoteStatDto> getStatList();
}
package com.liquidnet.service.sweet.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ApiModel(value = "SweetCityVoteParam", description = "用户投票记录入参")
@Data
public class SweetCityVoteParam implements java.io.Serializable {
private static final long serialVersionUID = -2626425843975309892L;
@ApiModelProperty(position = 10, required = true, value = "手机号", example = "15811009011")
@NotBlank(message = "phone不能为空")
private String phone;
@ApiModelProperty(position = 11, required = true, value = "unionId", example = "unionId")
@NotBlank(message = "unionId不能为空")
private String unionId;
@ApiModelProperty(position = 12, required = true, value = "城市代码", example = "10001")
@NotBlank(message = "cityCode不能为空")
private String cityCode;
@ApiModelProperty(position = 13, required = true, value = "城市名称", example = "北京")
@NotBlank(message = "cityName不能为空")
private String cityName;
}
package com.liquidnet.service.sweet.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
@ApiModel(value = "SweetOpenSendMsgParam", description = "发送模版消息公共接口入参")
@Data
public class SweetOpenSendMsgParam implements Serializable {
private static final long serialVersionUID = 675588088506034208L;
@ApiModelProperty(position = 11, required = true, allowableValues = "1,2", value = "发送目标类型 1正在服务号 2摩登服务号")
@NotNull(message = "sendTargetType不能为空") @Min(value = 1, message = "sendTargetType无效") @Max(value = 2, message = "sendTargetType无效")
private Integer sendTargetType;
@ApiModelProperty(position = 12, required = true, value = "模版消息ID", example = "y-j82V1TYhlTH1j8QscuDPcPQtNiDtENb7N5IZMBvqU")
@NotBlank(message = "templateId不能为空")
private String templateId;
@ApiModelProperty(position = 13, required = true, value = "模版消息数据", example = "{\"first\": \"感谢关注「正在现场」服务号\", \"keyword2\": \"4006-310-750\"}")
@NotBlank(message = "templateData不能为空")
private String templateData;
@ApiModelProperty(position = 14, required = true, allowableValues = "1,2,3,4,5", value = "点击跳转类型 1草莓小程序 2五百里小程序 3mdsk小程序 4正在小程序 5url")
@NotNull(message = "jumpType不能为空") @Min(value = 1, message = "jumpType无效") @Max(value = 5, message = "jumpType无效")
private Integer jumpType;
@ApiModelProperty(position = 15, value = "跳转url", example = "www.zhengzai.tv")
private String jumpUrl;
@ApiModelProperty(position = 16, allowableValues = "false,true", value = "是否需要前端配合处理跳转,直接跳转jumpAppletPagePath为false,true时需要前端根据状态码做跳转处理")
private Boolean jumpAppletUsePath;
@ApiModelProperty(position = 17, value = "跳转小程序需要的某页地址", example = "pages/webview?query=lottery")
private String jumpAppletPagePath;
/*@ApiModelProperty(position = 18, required = true, value = "openId", example = "oUpkkuNe4yuVs77aaKFvuvpgNOSw")
@NotBlank(message = "openId不能为空")
private String openId;*/
@ApiModelProperty(position = 18, required = true, value = "phone", example = "15888888888")
@NotBlank(message = "phone不能为空")
private String phone;
}
package com.liquidnet.service.sweet.service;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.sweet.entity.SweetCityVote;
import com.baomidou.mybatisplus.extension.service.IService;
import com.liquidnet.service.sweet.param.SweetCityVoteParam;
import com.liquidnet.service.sweet.vo.SweetCItyVoteStatVo;
import java.util.List;
/**
* <p>
* 城市投票表 服务类
* </p>
*
* @author jiangxiulong
* @since 2021-09-15
*/
public interface ISweetCityVoteService extends IService<SweetCityVote> {
ResponseDto createVote(SweetCityVoteParam param);
ResponseDto setStatList();
ResponseDto<List<SweetCItyVoteStatVo>> getList(String phone, String unionId);
}
package com.liquidnet.service.sweet.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.sweet.dto.SweetCityVoteStatDto;
import com.liquidnet.service.sweet.entity.SweetCityVote;
import com.liquidnet.service.sweet.mapper.SweetCityVoteMapper;
import com.liquidnet.service.sweet.mapper.SweetCityVoteStatMapper;
import com.liquidnet.service.sweet.param.SweetCityVoteParam;
import com.liquidnet.service.sweet.service.ISweetCityVoteService;
import com.liquidnet.service.sweet.utils.ObjectUtil;
import com.liquidnet.service.sweet.utils.QueueUtils;
import com.liquidnet.service.sweet.utils.RedisDataUtils;
import com.liquidnet.service.sweet.vo.SweetCItyVoteStatVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
/**
* <p>
* 答题表 服务实现类
* </p>
*
* @author jiangxiulong
* @since 2021-08-12
*/
@Service
public class SweetCityVoteServiceImpl extends ServiceImpl<SweetCityVoteMapper, SweetCityVote> implements ISweetCityVoteService {
@Autowired
private RedisDataUtils redisDataUtils;
@Autowired
QueueUtils queueUtils;
@Autowired
private SweetCityVoteStatMapper sweetCityVoteStatMapper;
@Override
public ResponseDto getList(String phone, String unionId) {
List<SweetCItyVoteStatVo> sweetCityVoteStatList = redisDataUtils.getSweetCityVoteStatList();
SweetCityVoteParam userVote = redisDataUtils.getUserVote(phone, unionId);
if (!CollectionUtils.isEmpty(sweetCityVoteStatList)) {
for (SweetCItyVoteStatVo info : sweetCityVoteStatList) {
if (null == userVote) {
info.setIsVote(1);
} else if (userVote.getCityCode().equals(info.getCityCode())) {
info.setIsVote(2);
} else {
info.setIsVote(3);
}
}
}
HashMap<String, Object> stringObjectHashMap = CollectionUtil.mapStringObject();
stringObjectHashMap.put("list", sweetCityVoteStatList);
stringObjectHashMap.put("userVote", userVote);
stringObjectHashMap.put("statUpdateTime", redisDataUtils.getSweetCityVoteStatUpdateTime());
return ResponseDto.success(stringObjectHashMap);
}
@Override
public ResponseDto createVote(SweetCityVoteParam param) {
SweetCityVoteParam userVote = redisDataUtils.getUserVote(param.getPhone(), param.getUnionId());
if (null != userVote) {
return ResponseDto.failure("已经投过票啦~");
}
SweetCityVote aNew = SweetCityVote.getNew();
aNew.setVoteId(IDGenerator.nextSnowId());
aNew.setPhone(param.getPhone());
String sweetWechatOpenId = redisDataUtils.getSweetWechatOpenId(param.getUnionId());
aNew.setOpenId(sweetWechatOpenId);
aNew.setUnionId(param.getUnionId());
aNew.setCityCode(param.getCityCode());
aNew.setCityName(param.getCityName());
LinkedList<String> sqls = CollectionUtil.linkedListString();
LinkedList<Object[]> sqlsDataA = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> sqlsDataB = CollectionUtil.linkedListObjectArr();
sqls.add(SqlMapping.get("sweet_city_vote.insert"));
sqlsDataA.add(new Object[]{
aNew.getVoteId(), aNew.getPhone(), sweetWechatOpenId, aNew.getUnionId(), aNew.getCityCode(), aNew.getCityName(), DateUtil.format(LocalDateTime.now(), DateUtil.Formatter.yyyyMMdd)
});
Integer cityVoteNum = redisDataUtils.getSweetCityVote(aNew.getCityCode());
if (cityVoteNum > 0) { // 已有 incr
sqls.add(SqlMapping.get("sweet_city_vote_stat.update"));
sqlsDataB.add(new Object[]{
LocalDateTime.now(), aNew.getCityCode()
});
} else { // insert
sqls.add(SqlMapping.get("sweet_city_vote_stat.insert"));
sqlsDataB.add(new Object[]{
IDGenerator.nextSnowId(), aNew.getCityCode(), aNew.getCityName(), 1
});
}
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_CITY_VOTE_DRAW.getKey(),
SqlMapping.gets(sqls, sqlsDataA, sqlsDataB));
redisDataUtils.incrSweetCityVote(aNew.getCityCode());
redisDataUtils.setUserVote(param.getPhone(), param.getUnionId(), param);
return ResponseDto.success();
}
public ResponseDto setStatList() {
List<SweetCityVoteStatDto> list = sweetCityVoteStatMapper.getStatList();
if (!CollectionUtils.isEmpty(list)) {
ArrayList<SweetCItyVoteStatVo> newList = ObjectUtil.getSweetCItyVoteStatVoList();
list.forEach(r -> newList.add(SweetCItyVoteStatVo.getNew().copy(r)));
redisDataUtils.setSweetCityVoteStatList(newList);
}
redisDataUtils.setSweetCityVoteStatUpdateTime();
return ResponseDto.success();
}
}
...@@ -4,14 +4,19 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -4,14 +4,19 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.liquidnet.common.cache.redis.util.RedisUtil; import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil; import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil; import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.kylin.constant.KylinRedisConst; import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketTimesVo; import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketTimesVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo; import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.sweet.config.WechatMaConfigure;
import com.liquidnet.service.sweet.config.WechatMpConfigure; import com.liquidnet.service.sweet.config.WechatMpConfigure;
import com.liquidnet.service.sweet.entity.SweetRemind; import com.liquidnet.service.sweet.entity.SweetRemind;
import com.liquidnet.service.sweet.entity.SweetWechatUser; import com.liquidnet.service.sweet.entity.SweetWechatUser;
import com.liquidnet.service.sweet.mapper.SweetRemindMapper; import com.liquidnet.service.sweet.mapper.SweetRemindMapper;
import com.liquidnet.service.sweet.param.SweetOpenSendMsgParam;
import com.liquidnet.service.sweet.utils.QueueUtils;
import com.liquidnet.service.sweet.utils.RedisDataUtils; import com.liquidnet.service.sweet.utils.RedisDataUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
...@@ -50,6 +55,8 @@ public class SweetWechatTemplateServiceImpl { ...@@ -50,6 +55,8 @@ public class SweetWechatTemplateServiceImpl {
private RedisDataUtils redisDataUtils; private RedisDataUtils redisDataUtils;
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired
private QueueUtils queueUtils;
@Autowired @Autowired
private SweetRemindMapper sweetRemindMapper; private SweetRemindMapper sweetRemindMapper;
...@@ -57,6 +64,15 @@ public class SweetWechatTemplateServiceImpl { ...@@ -57,6 +64,15 @@ public class SweetWechatTemplateServiceImpl {
@Autowired @Autowired
WechatMpConfigure wechatMpConfigure; WechatMpConfigure wechatMpConfigure;
@Autowired
WechatMaConfigure wechatMaConfigure;
public ResponseDto openSendMsg(SweetOpenSendMsgParam param) {
queueUtils.sendMsgByRedis(MQConst.SweetQueue.SWEET_TEMPLATE_MSG.getKey(),
JsonUtils.toJson(param));
return ResponseDto.success();
}
public ResponseDto sendRemindMsg() { public ResponseDto sendRemindMsg() {
// test // test
/*WxMpTemplateMessage templateMessage = getTemplateMessage("CNLDBZYQoDgTWudicx8WU81Jr9b6RyG9hmK4O0tpK-k", "oUpkkuNe4yuVs77aaKFvuvpgNOSw", h5Url.concat("/#/ticket/detail?id=").concat("111")); /*WxMpTemplateMessage templateMessage = getTemplateMessage("CNLDBZYQoDgTWudicx8WU81Jr9b6RyG9hmK4O0tpK-k", "oUpkkuNe4yuVs77aaKFvuvpgNOSw", h5Url.concat("/#/ticket/detail?id=").concat("111"));
...@@ -246,4 +262,5 @@ public class SweetWechatTemplateServiceImpl { ...@@ -246,4 +262,5 @@ public class SweetWechatTemplateServiceImpl {
return false; return false;
} }
} }
} }
...@@ -7,8 +7,10 @@ import com.liquidnet.service.sweet.dto.SweetManualArtistListDto; ...@@ -7,8 +7,10 @@ import com.liquidnet.service.sweet.dto.SweetManualArtistListDto;
import com.liquidnet.service.sweet.dto.SweetManualArtistListMDSKDto; import com.liquidnet.service.sweet.dto.SweetManualArtistListMDSKDto;
import com.liquidnet.service.sweet.entity.SweetManualShop; import com.liquidnet.service.sweet.entity.SweetManualShop;
import com.liquidnet.service.sweet.entity.SweetManualShopMdsk; import com.liquidnet.service.sweet.entity.SweetManualShopMdsk;
import com.liquidnet.service.sweet.vo.SweetCItyVoteStatVo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
public class ObjectUtil { public class ObjectUtil {
private static final ArrayList<SweetManualAppletDto> sweetManualAppletDtoList = new ArrayList<>(); private static final ArrayList<SweetManualAppletDto> sweetManualAppletDtoList = new ArrayList<>();
...@@ -18,6 +20,7 @@ public class ObjectUtil { ...@@ -18,6 +20,7 @@ public class ObjectUtil {
private static final ArrayList<SweetManualAppletMDSKDto> sweetManualAppletMDSKDtoList = new ArrayList<>(); private static final ArrayList<SweetManualAppletMDSKDto> sweetManualAppletMDSKDtoList = new ArrayList<>();
private static final ArrayList<SweetManualArtistListMDSKDto> sweetManualArtistListMDSKDtoList = new ArrayList<>(); private static final ArrayList<SweetManualArtistListMDSKDto> sweetManualArtistListMDSKDtoList = new ArrayList<>();
private static final ArrayList<SweetManualShopMdsk> sweetManualShopMDSKList = new ArrayList<>(); private static final ArrayList<SweetManualShopMdsk> sweetManualShopMDSKList = new ArrayList<>();
private static final ArrayList<SweetCItyVoteStatVo> sweetCItyVoteStatVoList = new ArrayList<>();
public static ArrayList<SweetManualAppletDto> getSweetManualAppletDtoList() { public static ArrayList<SweetManualAppletDto> getSweetManualAppletDtoList() {
return (ArrayList<SweetManualAppletDto>)sweetManualAppletDtoList.clone(); return (ArrayList<SweetManualAppletDto>)sweetManualAppletDtoList.clone();
...@@ -43,4 +46,8 @@ public class ObjectUtil { ...@@ -43,4 +46,8 @@ public class ObjectUtil {
public static ArrayList<SweetManualShopMdsk> getSweetManualShopMdskList() { public static ArrayList<SweetManualShopMdsk> getSweetManualShopMdskList() {
return (ArrayList<SweetManualShopMdsk>)sweetManualShopMDSKList.clone(); return (ArrayList<SweetManualShopMdsk>)sweetManualShopMDSKList.clone();
} }
public static ArrayList<SweetCItyVoteStatVo> getSweetCItyVoteStatVoList() {
return (ArrayList<SweetCItyVoteStatVo>)sweetCItyVoteStatVoList.clone();
}
} }
...@@ -13,10 +13,8 @@ import com.liquidnet.service.sweet.dto.SweetManualArtistListDto; ...@@ -13,10 +13,8 @@ import com.liquidnet.service.sweet.dto.SweetManualArtistListDto;
import com.liquidnet.service.sweet.dto.SweetManualArtistStageListDto; import com.liquidnet.service.sweet.dto.SweetManualArtistStageListDto;
import com.liquidnet.service.sweet.entity.*; import com.liquidnet.service.sweet.entity.*;
import com.liquidnet.service.sweet.mapper.*; import com.liquidnet.service.sweet.mapper.*;
import com.liquidnet.service.sweet.vo.SweetAnswerVo; import com.liquidnet.service.sweet.param.SweetCityVoteParam;
import com.liquidnet.service.sweet.vo.SweetArtistsRelationVo; import com.liquidnet.service.sweet.vo.*;
import com.liquidnet.service.sweet.vo.SweetPrizeVo;
import com.liquidnet.service.sweet.vo.SweetRemindVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -24,9 +22,6 @@ import org.springframework.stereotype.Component; ...@@ -24,9 +22,6 @@ import org.springframework.stereotype.Component;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import static com.liquidnet.service.sweet.constant.SweetConstant.REDIS_KEY_SWEET_LUCK_DRAW_PRESENT_MOBILE;
import static com.liquidnet.service.sweet.constant.SweetConstant.REDIS_KEY_SWEET_LUCK_DRAW_SURPLUS;
@Component @Component
@Slf4j @Slf4j
public class RedisDataUtils { public class RedisDataUtils {
...@@ -350,6 +345,19 @@ public class RedisDataUtils { ...@@ -350,6 +345,19 @@ public class RedisDataUtils {
String redisKey = SweetConstant.REDIS_KEY_SWEET_WECHAT_USER_INFO.concat(unionid); String redisKey = SweetConstant.REDIS_KEY_SWEET_WECHAT_USER_INFO.concat(unionid);
return (SweetWechatUser) redisUtil.get(redisKey); return (SweetWechatUser) redisUtil.get(redisKey);
} }
public String getSweetWechatOpenId(String unionid) {
if (unionid.isEmpty()) {
return "";
}
String redisKey = SweetConstant.REDIS_KEY_SWEET_WECHAT_USER_INFO.concat(unionid);
Object obj = redisUtil.get(redisKey);
if (null == obj) {
return "";
} else {
SweetWechatUser sweetWechatUser = (SweetWechatUser) redisUtil.get(redisKey);
return sweetWechatUser.getOpenId();
}
}
public String getSweetWechatUserStr(String unionid) { public String getSweetWechatUserStr(String unionid) {
if (unionid.isEmpty()) { if (unionid.isEmpty()) {
...@@ -477,10 +485,63 @@ public class RedisDataUtils { ...@@ -477,10 +485,63 @@ public class RedisDataUtils {
String redisKey = SweetConstant.REDIS_KEY_SWEET_ANSWER_PHONE.concat(sweetAnswerVo.getPhone()); String redisKey = SweetConstant.REDIS_KEY_SWEET_ANSWER_PHONE.concat(sweetAnswerVo.getPhone());
redisUtil.set(redisKey, sweetAnswerVo); redisUtil.set(redisKey, sweetAnswerVo);
} }
public SweetAnswerVo getSweetAnswer(String phone) { public SweetAnswerVo getSweetAnswer(String phone) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_ANSWER_PHONE.concat(phone); String redisKey = SweetConstant.REDIS_KEY_SWEET_ANSWER_PHONE.concat(phone);
SweetAnswerVo sweetAnswerVo = (SweetAnswerVo) redisUtil.get(redisKey); SweetAnswerVo sweetAnswerVo = (SweetAnswerVo) redisUtil.get(redisKey);
return sweetAnswerVo; return sweetAnswerVo;
} }
// 投票
public void setSweetCityVoteStatList(List<SweetCItyVoteStatVo> sweetCItyVoteStatVo) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST;
redisUtil.set(redisKey, sweetCItyVoteStatVo);
}
public List<SweetCItyVoteStatVo> getSweetCityVoteStatList() {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_STAT_LIST;
Object obj = redisUtil.get(redisKey);
List<SweetCItyVoteStatVo> sweetCityVoteStatList = ObjectUtil.getSweetCItyVoteStatVoList();
if (null != obj) {
sweetCityVoteStatList = (List<SweetCItyVoteStatVo>) redisUtil.get(redisKey);
}
return sweetCityVoteStatList;
}
public void incrSweetCityVote(String cityCode) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE.concat(cityCode);
redisUtil.incr(redisKey, 1);
}
public Integer getSweetCityVote(String cityCode) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_CITY_CODE.concat(cityCode);
Object obj = redisUtil.get(redisKey);
if (null == obj) {
return 0;
} else {
return (Integer) obj;
}
}
public void setUserVote(String phone, String openId, SweetCityVoteParam param) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_USER.concat(phone).concat("-").concat(openId);
redisUtil.set(redisKey, param);
}
public SweetCityVoteParam getUserVote(String phone, String openId) {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_USER.concat(phone).concat("-").concat(openId);
Object obj = redisUtil.get(redisKey);
if (null == obj) {
return null;
} else {
return (SweetCityVoteParam) obj;
}
}
public void setSweetCityVoteStatUpdateTime() {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME;
redisUtil.set(redisKey, DateUtil.getNowTime());
}
public String getSweetCityVoteStatUpdateTime() {
String redisKey = SweetConstant.REDIS_KEY_SWEET_CITY_VOTE_STAT_UPDATE_TIME;
Object obj = redisUtil.get(redisKey);
if (null == obj) {
return "";
} else {
return (String) obj;
}
}
} }
package com.liquidnet.service.sweet.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.liquidnet.service.sweet.dto.SweetCityVoteStatDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
public class SweetCItyVoteStatVo implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
/*@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
@ApiModelProperty("vote_id")
private String statId;*/
@ApiModelProperty("城市代码")
private String cityCode;
@ApiModelProperty("城市名称")
private String cityName;
/*@ApiModelProperty("真实投票数量")
private Integer voteNum;
@ApiModelProperty("手动增加投票数量")
private Integer manualVoteNum;*/
@ApiModelProperty("总投票数")
private Integer totalNum;
@ApiModelProperty("当前用户是否投了当前城市 1没投 2投了")
private Integer isVote;
/*@ApiModelProperty("创建时间")
private LocalDateTime createdAt;
@ApiModelProperty("更新时间")
private LocalDateTime updatedAt;*/
private static final SweetCItyVoteStatVo obj = new SweetCItyVoteStatVo();
public static SweetCItyVoteStatVo getNew() {
try {
return (SweetCItyVoteStatVo) obj.clone();
} catch (CloneNotSupportedException e) {
return new SweetCItyVoteStatVo();
}
}
public SweetCItyVoteStatVo copy(SweetCityVoteStatDto source) {
if (null == this) return this;
this.setCityCode(source.getCityCode());
this.setCityName(source.getCityName());
// this.setVoteNum(source.getVoteNum());
// this.setManualVoteNum(source.getManualVoteNum());
this.setTotalNum(source.getTotalNum());
return this;
}
}
<?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.SweetCityVoteStatMapper">
<resultMap id="getListResult" type="com.liquidnet.service.sweet.dto.SweetCityVoteStatDto">
<result column="city_code" property="cityCode"/>
<result column="city_name" property="cityName"/>
<result column="vote_num" property="voteNum"/>
<result column="manual_vote_num" property="manualVoteNum"/>
<result column="total_num" property="totalNum"/>
</resultMap>
<select id="getStatList" resultMap="getListResult">
select
*, (vote_num + manual_vote_num) as total_num
from sweet_city_vote_stat
ORDER BY total_num DESC
</select>
</mapper>
...@@ -48,4 +48,8 @@ sweet_user.update=UPDATE sweet_wechat_user SET is_cancel = ?, updated_at = ? WH ...@@ -48,4 +48,8 @@ sweet_user.update=UPDATE sweet_wechat_user SET is_cancel = ?, updated_at = ? WH
# --------------------------提醒记录-------------------------- # --------------------------提醒记录--------------------------
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_user.insert=INSERT INTO sweet_applet_user (user_id,openId,unionId,getPhoneNumber,getPurePhoneNumber,getCountryCode,type) VALUES (?,?,?,?,?,?,?) sweet_applet_user.insert=INSERT INTO sweet_applet_user (user_id,openId,unionId,getPhoneNumber,getPurePhoneNumber,getCountryCode,type) VALUES (?,?,?,?,?,?,?)
\ No newline at end of file # --------------------------用户投票记录--------------------------
sweet_city_vote.insert=INSERT INTO sweet_city_vote (vote_id,phone,openId,unionId,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) VALUES (?,?,?,?)
sweet_city_vote_stat.update=UPDATE sweet_city_vote_stat SET vote_num = IFNULL(vote_num, 0) + 1, updated_at = ? WHERE city_code = ?
\ No newline at end of file
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