yujian
2020-05-17 facf0c3bcbbb6cc993d87caa12ac34bede690f38
推送记录
6个文件已修改
125 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushGoodsController.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/PushGoodsService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushGoodsController.java
@@ -292,17 +292,14 @@
     */
    @RequestMapping(value = "push")
    public void push(String callback, String idArray, PrintWriter out) throws Exception {
        if (idArray == null || idArray.trim().length() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不能为空"));
            return;
        }
        
        try {
            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;
@@ -311,9 +308,7 @@
            for (Long id: list) {
                pushGoodsService.handPush(id);
            }
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
        } catch (PushException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (PushGoodsException e) {
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java
@@ -7,6 +7,7 @@
import javax.annotation.Resource;
import org.apache.commons.beanutils.PropertyUtils;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -14,10 +15,13 @@
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.taobao.TbImgUtil;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.activity.ActivityUser;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.entity.dynamic.GoodsEvaluate;
import com.yeshi.fanli.entity.dynamic.ImgInfo;
import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.entity.push.DeviceTokenOPPO;
@@ -46,6 +50,7 @@
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
import com.yeshi.fanli.util.factory.JumpDetailParamsFactory;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
@@ -299,18 +304,28 @@
                totalwords.add(new ClientTextStyleVO("个商品", "#666666"));
            } else if (type == PushGoods.TYPE_ACTIVITY) {
                GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pushGoods.getOtherId());
                if (goodsEvaluate != null) {
                    ActivityUser user = goodsEvaluate.getUser();
                    if (user != null) {
                        nickName = user.getNickName();
                if (goodsEvaluate == null) {
                    continue;
                }
                ActivityUser user = goodsEvaluate.getUser();
                if (user != null) {
                    nickName = user.getNickName();
                }
                if (StringUtil.isNullOrEmpty(vo.getPicture()) && goodsEvaluate.getImgList() != null &&
                        goodsEvaluate.getImgList().size() > 0) {
                    for (ImgInfo tmgInfo: goodsEvaluate.getImgList()) {
                        if (tmgInfo.getType() == ImgEnum.img || tmgInfo.getType() == ImgEnum.activity) {
                            vo.setPicture(tmgInfo.getUrl());
                        }
                    }
                }
                String url = configService.get(ConfigKeyEnum.pushActivityLink.getKey());
                if (url == null) {
                    url = "";
                }
                url = url + "?id=" + id + "&otherId=" + pushGoods.getOtherId();
                url = url + "?id=" + id;
                params = JumpDetailParamsFactory.createWEBParams(url);
                jumpDetail = jumpDetailV2Service.getByTypeCache("web",
                        Constant.getPlatformCode(acceptData.getPlatform()), Integer.parseInt(acceptData.getVersion()));
@@ -399,4 +414,83 @@
        out.print(JsonUtil.loadTrueResult(""));
    }
    /**
     * 获取推送活动详情
     * @param callback
     * @param acceptData
     * @param uid
     * @param id
     * @param out
     */
    @RequestMapping("getPushDetail")
    public void getPushDetail(String callback, AcceptData acceptData, Long uid, Long id, PrintWriter out) {
        if (uid == null || id == null) {
            JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("参数不完整"));
            return;
        }
        PushGoods pushGoods = pushGoodsService.selectByPrimaryKey(id);
        if (pushGoods == null || StringUtil.isNullOrEmpty(pushGoods.getOtherId())) {
            JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("该活动已下架"));
            return;
        }
        GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pushGoods.getOtherId());
        if (goodsEvaluate == null) {
            JsonUtil.printMode(out, callback,JsonUtil.loadFalseResult("该活动已下架"));
            return;
        }
        String scanResult = null;
        Integer scanNum = pushGoods.getScanNum();
        if (scanNum == null) {
        } else if (scanNum >= 10000) {
            double num = scanNum;
            String numMidea = String.format("%.1f", num / 10000);
            scanResult = numMidea + "万";
        } else {
            scanResult = scanNum +"";
        }
        String jumpLink = configService.get(ConfigKeyEnum.activityDetailLink.getKey()) + "?type=%s&id=%s";
        jumpLink = String.format(jumpLink, "circle", goodsEvaluate.getId());
        if (!StringUtil.isNullOrEmpty(goodsEvaluate.getJumpLink())) {
            goodsEvaluate.setJumpLink(jumpLink);
        }
        List<ImgInfo> imgListNew = new ArrayList<>();
        List<ImgInfo> imgList = goodsEvaluate.getImgList();
        if (imgList != null && imgList.size() > 0) {
            for (ImgInfo imgInfo: imgList) {
                if (imgInfo.getType() != ImgEnum.img || imgInfo.getType() == ImgEnum.activity) {
                    ImgInfo imgInfoNew = new ImgInfo();
                    try {
                        PropertyUtils.copyProperties(imgInfoNew, imgInfo);
                    } catch (Exception e) {
                        e.printStackTrace();
                        continue;
                    }
                    if (!StringUtil.isNullOrEmpty(imgInfoNew.getActivityUrl())) {
                        imgInfoNew.setActivityUrl(jumpLink);
                    }
                    imgListNew.add(imgInfoNew);
                    continue;
                }
                imgListNew.add(imgInfo);
            }
        }
        goodsEvaluate.setImgList(imgListNew);
        GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
        JSONObject json = new JSONObject();
        json.put("title", pushGoods.getTitle());
        json.put("content", pushGoods.getContent());
        json.put("pushTime", TimeUtil.formatDate(pushGoods.getPushTime()));
        json.put("scanNum", scanResult);
        json.put("detailInfo", gsonBuilder.create().toJson(goodsEvaluate));
        JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(json));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
@@ -1162,11 +1162,12 @@
            List<ImgInfo> imgList = evaluate.getImgList();
            if (imgList != null && imgList.size() > 0) {
                for (ImgInfo imgInfo : imgList) {
                    if (imgInfo.getType() == ImgEnum.img && !StringUtil.isNullOrEmpty(imgInfo.getUrl())) {
                    if (!StringUtil.isNullOrEmpty(imgInfo.getUrl())
                            && (imgInfo.getType() == ImgEnum.img || imgInfo.getType() == ImgEnum.activity)) {
                        imgs.add(imgInfo.getUrl());
                    }
                    
                    if (imgInfo.getType() == ImgEnum.img || imgInfo.getType() == ImgEnum.video) {
                    if (imgInfo.getType() == ImgEnum.img || imgInfo.getType() == ImgEnum.activity) {
                        if (StringUtil.isNullOrEmpty(jumpLink) && !StringUtil.isNullOrEmpty(imgInfo.getActivityUrl())) {
                            jumpLink  = imgInfo.getActivityUrl();
                        }
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -1139,7 +1139,7 @@
                    imgInfo0.setPid(pid);
                    imgInfo0.setUrl(info.getUrl());
                    imgInfo0.setUrlHD(info.getUrl());
                    imgInfo0.setType(ImgEnum.img);
                    imgInfo0.setType(ImgEnum.activity);
                    imgInfo0.setW(info.getW());
                    imgInfo0.setH(info.getH());
                    imgInfo0.setActivityUrl(activityUrl);
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java
@@ -74,7 +74,7 @@
    }
    @Override
    public PushGoods selectByPrimaryKey(Long id) throws PushGoodsException {
    public PushGoods selectByPrimaryKey(Long id) {
        return pushGoodsMapper.selectByPrimaryKey(id);
    }
@@ -443,8 +443,7 @@
        if (StringUtil.isNullOrEmpty(url)) {
            throw new PushGoodsException(1, "推送页面链接不存在");
        }
        url = url + "?id=" + pushGoods.getId() + "&otherId=" + pushGoods.getOtherId();
        url = url + "?id=" + pushGoods.getId();
        // h活动全推
        pushService.pushUrl(pushGoods.getUid(), pushGoods.getTitle(), pushGoods.getContent(), url, listIOS, listAndroid);
    }
fanli/src/main/java/com/yeshi/fanli/service/inter/push/PushGoodsService.java
@@ -15,7 +15,7 @@
    public int insertSelective(PushGoods record) throws PushGoodsException;
    public PushGoods selectByPrimaryKey(Long id) throws PushGoodsException;
    public PushGoods selectByPrimaryKey(Long id);
    public int updateByPrimaryKeySelective(PushGoods record) throws PushGoodsException;