券推送、今天推荐加入版本推送 用户活跃检测开启任务
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | //@Component
|
| | | //@Aspect
|
| | | //@Order(6)
|
| | | @Component
|
| | | @Aspect
|
| | | @Order(6)
|
| | | public class ActiveUserAspect {
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // // 缓存uid的Key
|
| | | // String key = "activeUid_" + uuid;
|
| | | // |
| | | // // 缓存中是否存在uid
|
| | | // String cacheValue = redisManager.getCommonString(key);
|
| | | // if (cacheValue != null && cacheValue.trim().length() > 0) {
|
| | | // return;
|
| | | // }
|
| | | //
|
| | | // // 加入缓存 20分钟
|
| | | // redisManager.cacheCommonString("activeUid_" + uuid, uuid.toString(), 60 * 20);
|
| | | // |
| | | // 缓存uid的Key
|
| | | String key = "activeUid_" + uuid;
|
| | | |
| | | // 缓存中是否存在uid
|
| | | String cacheValue = redisManager.getCommonString(key);
|
| | | if (cacheValue != null && cacheValue.trim().length() > 0) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 加入缓存 20分钟
|
| | | redisManager.cacheCommonString("activeUid_" + uuid, uuid.toString(), 60 * 20);
|
| | | |
| | |
|
| | | // 接收券
|
| | | try {
|
| | |
| | | }
|
| | | });
|
| | |
|
| | | Object[] args = joinPoint.getArgs();
|
| | | return joinPoint.proceed(args);
|
| | | return joinPoint.proceed(joinPoint.getArgs());
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | |
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "push")
|
| | | public void push(String callback, Long id, PrintWriter out) throws Exception {
|
| | | public void push(String callback, String idArray, PrintWriter out) throws Exception {
|
| | |
|
| | | if (id == null) {
|
| | | if (idArray == null || idArray.trim().length() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | |
| | | pushCouponService.executePush(id);
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | |
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | for (Long id: list) {
|
| | | pushCouponService.executePush(id);
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | |
|
| | |
| | |
|
| | |
|
| | | /**
|
| | | * 网页推送
|
| | | * 商品推送
|
| | | *
|
| | | * @param id 推送id
|
| | | * @param out
|
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "push")
|
| | | public void push(String callback, Long id, PrintWriter out) throws Exception {
|
| | | public void push(String callback, String idArray, PrintWriter out) throws Exception {
|
| | |
|
| | | if (id == null) {
|
| | | if (idArray == null || idArray.trim().length() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | pushGoodsService.executePush(id);
|
| | | |
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | |
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | for (Long id: list) {
|
| | | pushGoodsService.executePush(id);
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | |
|
| | |
| | | // 来源: 新人抽奖、邀请奖励
|
| | | public final static String SOURCE_CHOUJIANG = "新人抽奖";
|
| | | public final static String SOURCE_YAOQING = "邀请奖励";
|
| | | public final static String SOURCE_SYSTEM_PUSH = "系统推送";
|
| | | public final static String SOURCE_SYSTEM_PUSH = "系统赠送";
|
| | |
|
| | | @Expose
|
| | | @Column(name = "usc_id")
|
| | |
| | | AND (pc_title like '%${key}%' or pc_content like '%${key}%') |
| | | </if> |
| | | <if test='state != null'> |
| | | AND pg_is_push = #{state} |
| | | AND pc_pushed = #{state} |
| | | </if> |
| | | ORDER BY pc_create_time desc |
| | | LIMIT ${start},${count} |
| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | | }
|
| | |
|
| | | Integer amount = record.getAmount();
|
| | | if (amount == null || amount < 1) {
|
| | | throw new PushCouponException(1, "券数量不能小于1");
|
| | | if (amount == null) {
|
| | | throw new PushCouponException(1, "券数量不能为空");
|
| | | } else if (amount < 1 || amount > 5) {
|
| | | throw new PushCouponException(1, "券数量范围是 1~5");
|
| | | }
|
| | | |
| | | BigDecimal percent = record.getPercent();
|
| | | if (percent != null && (percent.compareTo(new BigDecimal(60)) > 0
|
| | | || percent.compareTo(new BigDecimal(1)) < 0)) {
|
| | | throw new PushCouponException(1, "券比例范围是1~60 的正整数");
|
| | | }
|
| | | |
| | |
|
| | | Long id = record.getId();
|
| | | if (id == null) {
|
| | |
| | | PushCoupon current = selectByPrimaryKey(id);
|
| | | if (current == null) {
|
| | | throw new PushCouponException(1, "该记录已不存在");
|
| | | }
|
| | | |
| | | if(current.isPushed()) {
|
| | | throw new PushCouponException(1, "已推送的信息不能修改");
|
| | | }
|
| | |
|
| | | current.setTitle(title);
|
| | |
| | |
|
| | | for (Long id: list) {
|
| | | long receivedCount = pushCouponRecordService.countByPushId(id);
|
| | | // 领取数量
|
| | | if (receivedCount > 0) {
|
| | | continue;
|
| | | }
|