yujian
2019-03-15 585a05bef033fa4b6a02b5d3afd3b305b3914abb
券推送、今天推荐加入版本推送   用户活跃检测开启任务
6个文件已修改
95 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/aspect/ActiveUserAspect.java 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushCouponController.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushGoodsController.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserSystemCoupon.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/push/PushCouponMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/aspect/ActiveUserAspect.java
@@ -21,9 +21,9 @@
 * @author Administrator
 *
 */
//@Component
//@Aspect
//@Order(6)
@Component
@Aspect
@Order(6)
public class ActiveUserAspect {
    
    @Resource(name = "taskExecutor")
@@ -63,18 +63,18 @@
                    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 {
@@ -85,8 +85,7 @@
            }
        });
        
        Object[] args = joinPoint.getArgs();
        return joinPoint.proceed(args);
        return joinPoint.proceed(joinPoint.getArgs());
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushCouponController.java
@@ -179,7 +179,7 @@
            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);
@@ -201,15 +201,25 @@
     * @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("推送成功"));
            
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushGoodsController.java
@@ -226,22 +226,33 @@
    
    
    /**
     * 网页推送
     *   商品推送
     * 
     * @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("推送成功"));
            
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserSystemCoupon.java
@@ -26,7 +26,7 @@
    // 来源: 新人抽奖、邀请奖励
    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")
fanli/src/main/java/com/yeshi/fanli/mapping/push/PushCouponMapper.xml
@@ -83,7 +83,7 @@
                  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}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushCouponServiceImpl.java
@@ -1,5 +1,6 @@
package com.yeshi.fanli.service.impl.push;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -94,9 +95,18 @@
        }
        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) {
@@ -112,6 +122,10 @@
            PushCoupon current = selectByPrimaryKey(id);
            if (current == null) {
                throw new PushCouponException(1, "该记录已不存在");
            }
            if(current.isPushed()) {
                throw new PushCouponException(1, "已推送的信息不能修改");
            }
            current.setTitle(title);
@@ -199,6 +213,7 @@
        
        for (Long id: list) {
            long receivedCount = pushCouponRecordService.countByPushId(id);
            // 领取数量
            if (receivedCount > 0) {
                continue;
            }