yujian
2020-01-01 d3abe5706d231a938ebf4b551208d69d11265736
小程序
7个文件已修改
14个文件已添加
2348 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/ConsumerController.java 372 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/GoodsController.java 938 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/RecommendController.java 336 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/SearchController.java 535 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsRecordServiceImpl.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/QrCodeService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserShareGoodsRecordService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserSystemMsgVO.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/icon_baoyou.png 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/icon_jd.png 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/icon_pdd.png 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/icon_quan.png 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/icon_xcx.jpg 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/icon_ziying.png 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/official_default_head.jpg 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/share/qr_code_frame.png 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/share/qr_code_frame_no_coupon.png 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/image/share/qr_code_frame_xcx.png 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/ShareControllerV2.java
@@ -404,7 +404,7 @@
                    history.setQuanLink(taobaoLink.getCouponLink());
                    history.setGoodsId(taobaoLink.getGoods().getAuctionId());
                    history.setPostPicture(taobaoLink.getGoods().getPictUrl());
                    history.setShareImg(taobaoLink.getClickUrl());
                    List<String> imgList = taobaoLink.getGoods().getImgList();
                    if (imgList == null) {
                        imgList = new ArrayList<>();
@@ -585,7 +585,7 @@
                    history.setQuanLink(taobaoLink.getCouponLink());
                    history.setGoodsId(finalGoods.getAuctionId());
                    history.setPostPicture(finalGoods.getPictUrl());
                    history.setShareImg(taobaoLink.getClickUrl());
                    List<String> imgList = finalGoods.getImgList();
                    if (imgList == null) {
                        imgList = new ArrayList<>();
@@ -718,7 +718,8 @@
                history.setQuanLink(null);
                history.setGoodsId(goodsId);
                history.setPostPicture(goods.getPicUrl());
                history.setShareImg(jumpLink);
                List<String> imgList = goods.getImageList();
                if (imgList == null) {
                    imgList = new ArrayList<>();
@@ -843,7 +844,7 @@
                history.setQuanLink(null);
                history.setGoodsId(goodsId);
                history.setPostPicture(goods.getGoodsImageUrl());
                history.setShareImg(jumpLink);
                List<String> imgList = null;
                String[] goodsGalleryUrls = goods.getGoodsGalleryUrls();
                if (goodsGalleryUrls != null) {
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/ConsumerController.java
New file
@@ -0,0 +1,372 @@
package com.yeshi.fanli.controller.wxmp.v1;
import java.io.PrintWriter;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.goods.ScanHistoryV2;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.goods.CollectionGoodsException;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
import com.yeshi.fanli.util.jd.JDApiUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
/**
 * 用户相关商品
 *
 * @author Administrator
 *
 */
@Controller("WXMPConsumerController")
@RequestMapping("/wxmp/api/v1/consumer")
public class ConsumerController {
    @Resource
    private BusinessSystemService businessSystemService;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private CollectionGoodsV2Service collectionGoodsV2Service;
    @Resource
    private ScanHistoryV2Service scanHistoryV2Service;
    @Resource
    private TaoBaoGoodsCacheUtil taoBaoGoodsCacheUtil;
    @Resource
    private JDGoodsCacheUtil jdGoodsCacheUtil;
    @Resource
    private PinDuoDuoCacheUtil pinDuoDuoCacheUtil;
    @Resource
    private RedisManager redisManager;
    /**
     * 收藏商品
     *
     * @param acceptData
     * @param uid
     * @param id
     * @param type
     * @param goodsType
     * @param out
     */
    @RequestMapping("collectionGoods")
    public void collectionGoods(AcceptData acceptData, Long uid, Long goodsId, int type, Integer goodsType,
            PrintWriter out) {
        try {
            if (goodsType == null || goodsType < 2 || goodsType > 3) {
                out.print(JsonUtil.loadFalseResult(1, "请传递正确参数"));
                return;
            }
            if (type != 1) {
                collectionGoodsV2Service.cancelCollectionByAuctionId(uid, goodsId, goodsType);
                out.print(JsonUtil.loadTrueResult("取消收藏成功"));
                return;
            }
            CollectionGoodsV2 find = collectionGoodsV2Service.findByUidAndAuctionId(uid, goodsId, goodsType);
            if (find != null) {
                out.print(JsonUtil.loadFalseResult(""));
                return;
            }
            if (goodsType == Constant.SOURCE_TYPE_JD) {
                JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
                if (jdGoods == null) {
                    jdGoods = JDApiUtil.getGoodsDetail(goodsId);
                }
                if (jdGoods == null) {
                    out.print(JsonUtil.loadFalseResult(1, "商品已下架"));
                    return;
                }
                collectionGoodsV2Service.addJDCollection(uid, jdGoods);
            } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
                PDDGoodsDetail pddGoods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
                if (pddGoods == null) {
                    out.print(JsonUtil.loadFalseResult(1, "商品已下架"));
                    return;
                }
                collectionGoodsV2Service.addPDDCollection(uid, pddGoods);
            }
            out.print(JsonUtil.loadTrueResult("收藏成功"));
        } catch (CollectionGoodsException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        }
    }
    /**
     * 删除收藏
     *
     * @param acceptData
     * @param ids
     * @param type
     * @param uid
     * @param out
     */
    @RequestMapping("deleteCollectionGoods")
    public void deleteCollectionGoods(AcceptData acceptData, Long uid, String ids, Integer type, PrintWriter out) {
        if (uid == null || uid <= 0) {
            out.print(JsonUtil.loadFalseResult("用户未登录"));
            return;
        }
        if (type != null && type == 1) { // 删除全部
            try {
                collectionGoodsV2Service.cancelCollectionByUid(uid);
            } catch (CollectionGoodsException e) {
                out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMessage()));
                return;
            }
        } else { // 删除部分
            if (!StringUtil.isNullOrEmpty(ids)) {
                Arrays.asList(ids.split(",")).parallelStream().forEach(idStr -> {
                    try {
                        collectionGoodsV2Service.deteleBYByUidAndCommonId(uid, Long.parseLong(idStr));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                });
            }
        }
        out.print(JsonUtil.loadTrueResult("删除成功"));
    }
    /**
     * 收藏列表
     *
     * @param acceptData
     * @param uid
     * @param page
     * @param goodsType
     * @param out
     */
    @RequestMapping("collectionGoodsList")
    public void collectionGoodsList(AcceptData acceptData, Long uid, Integer page, Integer goodsType, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult("用户未登录"));
            return;
        }
        if (page < 1) {
            out.print(JsonUtil.loadFalseResult(1, "page不小于1"));
            return;
        }
        List<CollectionGoodsV2> collectionGoodsList = collectionGoodsV2Service.getCollectionGoodsList(uid, page,
                Constant.PAGE_SIZE, goodsType);
        long count = collectionGoodsV2Service.getCollectionGoodsCount(uid, goodsType);
        JSONObject data = new JSONObject();
        List<GoodsDetailVO> list = new ArrayList<GoodsDetailVO>();
        if (collectionGoodsList != null && collectionGoodsList.size() > 0) {
            List<Long> listGid = new ArrayList<Long>();
            for (CollectionGoodsV2 collectionGoodsV2 : collectionGoodsList) {
                CommonGoods commonGoods = collectionGoodsV2.getCommonGoods();
                if (commonGoods == null || commonGoods.getGoodsType() != Constant.SOURCE_TYPE_TAOBAO) {
                    continue;
                }
                listGid.add(commonGoods.getGoodsId());
            }
            // API网络接口验证是否在售
            List<TaoBaoGoodsBrief> listTaoKeGoods = null;
            if (listGid.size() > 0) {
                try {
                    listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
                } catch (TaoKeApiException e) {
                    e.printStackTrace();
                } catch (TaobaoGoodsDownException e) {
                    e.printStackTrace();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            ConfigParamsDTO paramsDTO =  hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                    acceptData.getVersion());
            for (CollectionGoodsV2 collectionGoodsV2 : collectionGoodsList) {
                CommonGoods commonGoods = collectionGoodsV2.getCommonGoods();
                if (commonGoods == null) {
                    continue;
                }
                if (listTaoKeGoods != null && listTaoKeGoods.size() > 0
                        && commonGoods.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
                    int state = 1; // 默认停售
                    Long goodsId = commonGoods.getGoodsId();
                    for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) {
                        Long auctionId = taoKeGoods.getAuctionId();
                        if (goodsId == auctionId || goodsId.equals(auctionId)) {
                            state = 0; // 在售
                            break;
                        }
                    }
                    commonGoods.setState(state);
                }
                GoodsDetailVO detailVO = GoodsDetailVOFactory.convertCommonGoods(commonGoods, paramsDTO);
                detailVO.setId(commonGoods.getId());
                detailVO.setCreatetime(collectionGoodsV2.getCreateTime());
                list.add(detailVO);
            }
        }
        GsonBuilder builder = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
            @Override
            public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
                if (value == null) {
                    return new JsonPrimitive("");
                } else {
                    return new JsonPrimitive(value.getTime() + "");
                }
            }
        });
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(builder).excludeFieldsWithoutExposeAnnotation()
                .create();
        data.put("list", gson.toJson(list));
        data.put("count", count);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 删除足迹
     *
     * @param acceptData
     * @param type
     * @param uid
     * @param ids
     * @param out
     */
    @RequestMapping(value = "deleteScanhistory", method = RequestMethod.POST)
    public void deleteScanHistory(AcceptData acceptData, String type, Long uid, String ids, PrintWriter out) {
        if ("1".equals(type)) {
            // 全部删除
            scanHistoryV2Service.deleteByDeviceOrUid(uid, acceptData.getDevice());
        } else {
            // 删除部分
            if (StringUtil.isNullOrEmpty(ids)) {
                out.print(JsonUtil.loadFalseResult("ids不能为空"));
                return;
            }
            String[] idStr = ids.split(",");
            for (String id : idStr) {
                scanHistoryV2Service.deleteByCommonIdAndDeviceOrUid(uid, acceptData.getDevice(), Long.parseLong(id));
            }
        }
        out.print(JsonUtil.loadTrueResult(""));
    }
    /**
     * 获取浏览记录
     *
     * @param acceptData
     * @param uid
     * @param page
     * @param goodsType
     * @param out
     */
    @RequestMapping(value = "getScanHistory", method = RequestMethod.POST)
    public void getScanHistory(AcceptData acceptData, Long uid, int page, Integer goodsType, PrintWriter out) {
        if (page < 1) {
            out.print(JsonUtil.loadFalseResult(1, "page不小于1"));
            return;
        }
        List<ScanHistoryV2> list = scanHistoryV2Service.getScanHistoryByDeviceOrUid(uid, acceptData.getDevice(), page,
                20, goodsType);
        GsonBuilder gsonBuilder = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder());
        gsonBuilder.excludeFieldsWithoutExposeAnnotation();
        gsonBuilder.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
            @Override
            public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
                if (value == null) {
                    return new JsonPrimitive("");
                } else {
                    return new JsonPrimitive(value.getTime() + "");
                }
            }
        });
        long count = scanHistoryV2Service.getCountByDeviceOrUid(uid, acceptData.getDevice(), goodsType);
        JSONArray array = new JSONArray();
        if (list != null && list.size() > 0) {
            Gson gson = gsonBuilder.create();
            ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                    acceptData.getVersion());
            for (ScanHistoryV2 sh : list) {
                CommonGoods commonGoods = sh.getCommonGoods();
                if (commonGoods == null) {
                    continue;
                }
                GoodsDetailVO detailVO = GoodsDetailVOFactory.convertCommonGoods(commonGoods, paramsDTO);
                detailVO.setId(commonGoods.getId());
                detailVO.setCreatetime(sh.getCreateTime());
                array.add(gson.toJson(detailVO));
            }
        }
        JSONObject data = new JSONObject();
        data.put("count", count);
        data.put("list", array);
        out.print(JsonUtil.loadTrueResult(data));
        return;
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/GoodsController.java
New file
@@ -0,0 +1,938 @@
package com.yeshi.fanli.controller.wxmp.v1;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.json.simple.JSONArray;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.entity.FileUploadResult;
import org.yeshi.utils.wx.WXUtil;
import org.yeshi.utils.wx.WXXCXUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.WXMPAcceptData;
import com.yeshi.fanli.dto.jd.JDCategoryInfo;
import com.yeshi.fanli.dto.jd.JDCouponInfo;
import com.yeshi.fanli.dto.jd.JDFilter;
import com.yeshi.fanli.dto.jd.JDSearchResult;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory;
import com.yeshi.fanli.entity.bus.user.ShamUser;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.entity.jd.JDGoodsClass;
import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
import com.yeshi.fanli.exception.user.UserInfoExtraException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service;
import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
import com.yeshi.fanli.service.inter.jd.JDGoodsClassService;
import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.redpack.UserTaoLiJinNewbiesService;
import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
import com.yeshi.fanli.service.inter.user.QrCodeService;
import com.yeshi.fanli.service.inter.user.ShamUserService;
import com.yeshi.fanli.service.inter.user.TBPidService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.JumpDetailUtil;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
import com.yeshi.fanli.util.cache.PinDuoDuoCacheUtil;
import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
import com.yeshi.fanli.util.jd.JDApiUtil;
import com.yeshi.fanli.util.jd.JDUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
import com.yeshi.fanli.vo.goods.CouponInfoVO;
import com.yeshi.fanli.vo.goods.GoodsDetailExtraVO;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import com.yeshi.fanli.vo.goods.MoneyInfoVO;
import com.yeshi.fanli.vo.goods.OtherInfo;
import com.yeshi.fanli.vo.goods.RewardCouponVO;
import com.yeshi.fanli.vo.goods.ShareVO;
import com.yeshi.fanli.vo.goods.ShopInfoVO;
import net.sf.json.JSONObject;
@Controller("WXMPGoodsController")
@RequestMapping("/wxmp/api/v1/goods")
public class GoodsController {
    @Resource
    private ConfigService configService;
    @Resource
    private ShamUserService shamUserService;
    @Resource
    private CollectionGoodsV2Service collectionGoodsV2Service;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private ScanHistoryV2Service scanHistoryV2Service;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private JDGoodsCacheUtil jdGoodsCacheUtil;
    @Resource
    private PinDuoDuoCacheUtil pinDuoDuoCacheUtil;
    @Resource
    private JumpDetailV2Service jumpDetailV2Service;
    @Resource
    private JDGoodsClassService jdGoodsClassService;
    @Resource
    private UserVIPInfoService userVIPInfoService;
    @Resource
    private QrCodeService qrCodeService;
    @Resource
    private ShareGoodsService shareGoodsService;
    @Resource
    private UserShareGoodsRecordService userShareGoodsRecordService;
    @Resource
    private SwiperPictureService swiperPictureService;
    /**
     * 一级分类
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "getTopCategory", method = RequestMethod.POST)
    public void getTopCategory(WXMPAcceptData acceptData, PrintWriter out) {
        JSONObject data = new JSONObject();
        data.put("list", configService.get("jd_wxmp_class"));
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 一级分类商品
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "getCategoryRecommend", method = RequestMethod.POST)
    public void getCategoryRecommend(WXMPAcceptData acceptData, Long cid, Integer page, PrintWriter out) {
        if (cid == null) {
            out.print(JsonUtil.loadFalseResult("分类ID为空"));
            return;
        }
        JSONObject data = new JSONObject();
        if (page == 1) {
            // 轮播图
            String platform = acceptData.getPlatform();
            int version = Integer.parseInt(acceptData.getVersion());
            List<SwiperPicture> picList = swiperPictureService.getByBannerCardAndVersion("index_top", platform,
                    version);
            if (picList == null) {
                picList = new ArrayList<>();
            }
            for (SwiperPicture swiper : picList) {
                JSONObject params = null;
                if (StringUtil.isNullOrEmpty(swiper.getParams())) {
                    params = JSONObject.fromObject(swiper.getParams());
                }
                swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail(), params));
                swiper.setParams(null);
            }
            data.put("bannerList", JsonUtil.getApiCommonGson().toJson(picList));
        }
        JDFilter filterAPI = new JDFilter();
        filterAPI.setPageIndex(page);
        filterAPI.setPageSize(Constant.PAGE_SIZE);
        filterAPI.setIsCoupon(1); // 有券
        filterAPI.setIsHot(1); // 爆款
        filterAPI.setCid1(cid);
        JDSearchResult result = JDApiUtil.queryByKey(filterAPI);
        long count = 0;
        JSONArray array = new JSONArray();
        if (result != null) {
            PageEntity pageEntity = result.getPageEntity();
            if (pageEntity != null) {
                count = pageEntity.getTotalCount();
            }
            List<JDGoods> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion());
                for (JDGoods goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
                    if (goodsDetailVO.isHasCoupon()) {
                        array.add(gson.toJson(goodsDetailVO));
                    }
                }
            }
        }
        data.put("count", count);
        data.put("list", array);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 获取商品详情
     * @param acceptData
     * @param goodsId 商品id
     * @param uid
     * @param code 邀请码
     * @param goodsType 商品类型
     * @param from 页面来源
     * @param out
     */
    @RequestMapping(value = "getGoodsDetial", method = RequestMethod.POST)
    public void getGoodsDetial(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from,
             Long uid, PrintWriter out) {
        if (goodsType == null || goodsType < 2 || goodsType > 3) {
            out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数"));
            return;
        }
        /*--------- 京东商品  -------*/
        if (goodsType.intValue() == Constant.SOURCE_TYPE_JD) {
            getDetialJD(acceptData, goodsId, uid, from, out);
            return;
        }
        /*-------- 拼多多商品  -------*/
        if (goodsType.intValue() == Constant.SOURCE_TYPE_PDD) {
            getDetialPDD(acceptData, goodsId, uid, from, out);
            return;
        }
    }
    /**
     * 京东商品详情
     *
     * @param acceptData
     * @param id
     * @param uid
     * @param from
     * @param out
     */
    private void getDetialJD(WXMPAcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
        JDGoods jdGoods = JDApiUtil.queryGoodsDetail(id); // 高级接口
        if (jdGoods == null) {
            jdGoods = JDUtil.getGoodsDetail(id); // 爬取网页
            // jdGoods = JDApiUtil.getGoodsDetail(id); // 普通接口
        }
        if (jdGoods == null) {
            out.print(JsonUtil.loadFalseResult(2, "商品不存在"));
            return;
        }
        List<String> imageList = jdGoods.getImageList();
        if (imageList == null) {
            imageList = new ArrayList<String>();
            imageList.add(jdGoods.getPicUrl());
        }
        // 保存缓存
        jdGoodsCacheUtil.saveGoodsInfo(jdGoods);
        ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                acceptData.getVersion());
        GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO);
        if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
            goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
            goodsDetail.getMoneyInfo()
                    .setShareMoney("¥" + JDUtil.getGoodsFanLiMoney(jdGoods, hongBaoManageService.getVIPShareRate()));
        }
        // 附加信息
        OtherInfo otherInfo = new OtherInfo();
        // 京东plus返利
        String maxMoneyPlus = null;
        JDCategoryInfo categoryInfo = jdGoods.getCategoryInfo();
        if (categoryInfo != null && categoryInfo.getCid3() != null && jdGoods.getCommissionInfo() != null) {
            Long cid3 = categoryInfo.getCid3();
            JDGoodsClass threeClass = jdGoodsClassService.getThreeClassByCid(Integer.parseInt(cid3.toString()));
            if (threeClass != null && threeClass.getSelfComm() != null
                    && threeClass.getSelfComm().compareTo(new BigDecimal(0)) > 0) {
                BigDecimal commissionShare = jdGoods.getCommissionInfo().getCommissionShare();
                // plus比例 小于正常比例
                if (commissionShare != null && commissionShare.compareTo(threeClass.getSelfComm()) > 0) {
                    jdGoods.setCommissionPlus(threeClass.getSelfComm());
                    // plus返利
                    BigDecimal fanliMoneyPlus = JDUtil.getGoodsFanLiMoneyPlus(jdGoods,
                            hongBaoManageService.getFanLiRate());
                    otherInfo.setFanliMoneyPlus("京东plus返¥" + fanliMoneyPlus);
                    // 使用奖励券最高返
                    if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
                        maxMoneyPlus = "(京东plus返¥"
                                + JDUtil.getGoodsFanLiMoneyPlus(jdGoods,
                                        hongBaoManageService.getVIPFanLiRate())
                                + ")";
                    } else
                        maxMoneyPlus = "(京东plus最高返¥"
                                + fanliMoneyPlus.add(MoneyBigDecimalUtil.mul(fanliMoneyPlus, Constant.MAX_REWARD_RATE))
                                + ")";
                }
            }
        }
        // 奖励券返利
        RewardCouponVO rewardCoupon = new RewardCouponVO();
        rewardCoupon.setMaxMoneyPlus(maxMoneyPlus);
        rewardCoupon.setJumpDetail(jumpDetailV2Service.getByTypeCache("web"));
        goodsDetail.setOtherInfo(otherInfo);
        CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
        if (couponInfo != null) {
            // 券链接处理
            String materialId = "https://item.jd.com/" + id + ".html";
            String url = JDApiUtil.convertLinkWithSubUnionId(materialId, couponInfo.getLink(),
                    JDApiUtil.POSITION_COUPON + "", null);
            couponInfo.setLink(url);
        }
        ShopInfoVO shopInfo = goodsDetail.getShopInfo();
        if (shopInfo != null) {
            if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null
                    || shopInfo.getScoreSeller() == null) {
                goodsDetail.setShopInfo(null);
            }
        }
        GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO();
        extraVO.setIsNative(false);
        // IOS是否正在上线
        if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
            String version = acceptData.getVersion();
            extraVO.setIosOnling(configService.iosOnLining(Integer.parseInt(version)));
        }
        Long inOrderCount30Days = jdGoods.getInOrderCount30Days();
        List<ShamUser> listShareUser = new ArrayList<ShamUser>();
        // 京东开启分享
        String open = configService.get("share_jd_open");
        if ("1".equals(open.trim())) {
            extraVO.setShareValid(true);
            MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
            if (moneyInfo != null) {
                String shareMoney = moneyInfo.getShareMoney().replaceAll("¥", "");
                if (Integer.parseInt(inOrderCount30Days.toString()) >= 1000) {
                    listShareUser.addAll(shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5));
                }
            }
        }
        extraVO.setListShareUser(listShareUser);
        // 领券人列表
        List<ShamUser> listCouponUser = new ArrayList<ShamUser>();
        if (goodsDetail.isHasCoupon() && Integer.parseInt(inOrderCount30Days.toString()) >= 1000) {
            listCouponUser = shamUserService.listRandCouponUser(5, 1, 300);
        }
        extraVO.setListCouponUser(listCouponUser);
        if (uid != null) {
            // 是否加入收藏
            CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id,
                    Constant.SOURCE_TYPE_JD);
            extraVO.setCollected(collectionGoods != null ? true : false);
        }
        // 图文详情
        extraVO.setDetailUrl("https://in.m.jd.com/product/jieshao/video/" + id + ".html");
        // 商品链接
        String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
                Constant.systemCommonConfig.getShareGoodsPagePathJD(), "", id + "");
        try {
            extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
        } catch (Exception e) {
            extraVO.setH5Url(h5Url);
        }
        String helpLink = null;
        extraVO.setFanliValid(true);
        if (StringUtil.isNullOrEmpty(helpLink)) {
            helpLink = configService.get("no_rebate_help_link");
        }
        ShareVO shareInfoVO = new ShareVO();
        shareInfoVO.setHelpLink(helpLink);
        extraVO.setShare(shareInfoVO);
        JSONObject object = new JSONObject();
        object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
        object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail));
        out.print(JsonUtil.loadTrueResult(object.toString()));
        final JDGoods goods = jdGoods;
        ThreadUtil.run(new Runnable() {
            public void run() {
                // 添加浏览记录
                try {
                    scanHistoryV2Service.addJDScanHistory(uid, acceptData.getDevice(), goods);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
    /**
     * 拼多多商品详情
     *
     * @param acceptData
     * @param id
     * @param uid
     * @param from
     * @param out
     */
    private void getDetialPDD(WXMPAcceptData acceptData, Long id, Long uid, String from, PrintWriter out) {
        PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(id);
        if (pddGoods == null) {
            out.print(JsonUtil.loadFalseResult(2, "商品不存在"));
            return;
        }
        ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                acceptData.getVersion());
        GoodsDetailVO goodsDetail = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO);
        if (goodsDetail != null && goodsDetail.getMoneyInfo() != null && userVIPInfoService.isVIP(uid)) {
            goodsDetail.getMoneyInfo().setFanliMoney(goodsDetail.getMoneyInfo().getMaxMoney());
            goodsDetail.getMoneyInfo().setShareMoney(
                    "¥" + PinDuoDuoUtil.getGoodsFanLiMoney(pddGoods, hongBaoManageService.getVIPShareRate()));
        }
        CouponInfoVO couponInfo = goodsDetail.getCouponInfo();
        PDDPromotionUrl convertUrl = null;
        if (couponInfo != null) {
            convertUrl = PinDuoDuoApiUtil.convert(id, PinDuoDuoApiUtil.PID_COUPON + "", null);
            if (convertUrl != null)
                couponInfo.setLink(convertUrl.getUrl());
        }
        ShopInfoVO shopInfo = goodsDetail.getShopInfo();
        if (shopInfo != null) {
            if (shopInfo.getId() == null || shopInfo.getScoreGoods() == null || shopInfo.getScoreLogistics() == null
                    || shopInfo.getScoreSeller() == null) {
                goodsDetail.setShopInfo(null);
            }
        }
        GoodsDetailExtraVO extraVO = new GoodsDetailExtraVO();
        extraVO.setDetailUrl("http://apph5.yeshitv.com/apppage/goods_img_pdd.html?id=" + id);
        String salesTip = pddGoods.getSalesTip();
        if (!StringUtil.isNullOrEmpty(salesTip)) {
            int indexOf = salesTip.indexOf("+");
            if (indexOf > 0) {
                salesTip = salesTip.substring(0, indexOf);
            }
            int totalSales = 0;
            if (salesTip.contains("万")) {
                salesTip = salesTip.substring(0, salesTip.indexOf("万"));
                totalSales = (int) (Float.parseFloat(salesTip) * 10000);
            } else {
                totalSales = Integer.parseInt(salesTip);
            }
            List<ShamUser> listShareUser = new ArrayList<ShamUser>();
            MoneyInfoVO moneyInfo = goodsDetail.getMoneyInfo();
            if (moneyInfo != null) {
                String shareMoney = moneyInfo.getShareMoney().replaceAll("¥", "");
                if (totalSales >= 50000) {
                    listShareUser = shamUserService.listRandShareUser(10, new BigDecimal(shareMoney), 1, 5);
                }
            }
            extraVO.setListShareUser(listShareUser);
            // 领券人列表
            List<ShamUser> listCouponUser = new ArrayList<ShamUser>();
            if (goodsDetail.isHasCoupon() && totalSales >= 50000) {
                listCouponUser = shamUserService.listRandCouponUser(5, 1, 300);
            }
            extraVO.setListCouponUser(listCouponUser);
        }
        if (uid != null) {
            // 是否加入收藏
            CollectionGoodsV2 collectionGoods = collectionGoodsV2Service.findByUidAndAuctionId(uid, id,
                    Constant.SOURCE_TYPE_PDD);
            extraVO.setCollected(collectionGoods != null ? true : false);
        }
        // 分享路径
        String h5Url = String.format("http://%s%s?uid=%s&id=%s", configService.getH5Host(),
                Constant.systemCommonConfig.getShareGoodsPagePathPDD(), "", id + "");
        try {
            extraVO.setH5Url(HttpUtil.getShortLink(h5Url));
        } catch (Exception e) {
            extraVO.setH5Url(h5Url);
        }
        String helpLink = null;
        extraVO.setFanliValid(true);
        extraVO.setShareValid(true);
        if (StringUtil.isNullOrEmpty(helpLink)) {
            helpLink = configService.get("no_rebate_help_link");
        }
        ShareVO shareInfoVO = new ShareVO();
        shareInfoVO.setHelpLink(helpLink);
        extraVO.setShare(shareInfoVO);
        if (convertUrl != null) {
            extraVO.setCouponJumpLink(convertUrl.getUrl());
            extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
        }
        JSONObject object = new JSONObject();
        object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
        object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail));
        out.print(JsonUtil.loadTrueResult(object.toString()));
        ThreadUtil.run(new Runnable() {
            public void run() {
                try {
                    scanHistoryV2Service.addPDDScanHistory(uid, acceptData.getDevice(), pddGoods);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
    /**
     * 商品详情推荐(猜你喜欢 + 推荐)
     *
     * @param acceptData
     * @param id
     * @param out
     */
    @RequestMapping(value = "getRecommendGoods", method = RequestMethod.POST)
    public void getRecommendGoods(AcceptData acceptData, long id, Integer goodsType, PrintWriter out) {
        if (goodsType == null || goodsType < 2 || goodsType > 3) {
            out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数"));
            return;
        }
        try {
            // 京东
            if (goodsType == Constant.SOURCE_TYPE_JD) {
                JSONObject data = new JSONObject();
                data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
                List<JDGoods> list = JDUtil.getRecommendGoodsById(id);
                if (list == null) {
                    list = new ArrayList<JDGoods>();
                } else if (list.size() > 10) {
                    list = list.subList(0, 10);
                }
                ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion());
                List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
                for (JDGoods goods : list) {
                    listDetailVO.add(GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO));
                }
                // 取偶数个数据
                if (listDetailVO.size() % 2 != 0) {
                    listDetailVO.remove(listDetailVO.size() - 1);
                }
                data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO));
                out.print(JsonUtil.loadTrueResult(data));
                return;
            }
            // 拼多多
            if (goodsType == Constant.SOURCE_TYPE_PDD) {
                JSONObject data = new JSONObject();
                data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
                List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
                List<Long> goodsIdList = PinDuoDuoUtil.getRecommendGoodsId(id);
                if (goodsIdList != null && goodsIdList.size() > 0) {
                    PDDSearchFilter pddfilter = new PDDSearchFilter();
                    pddfilter.setPage(1);
                    pddfilter.setPageSize(Constant.PAGE_SIZE);
                    Long[] strings = new Long[goodsIdList.size()];
                    pddfilter.setGoodsIdList(goodsIdList.toArray(strings));
                    PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
                    if (result != null) {
                        List<PDDGoodsDetail> goodsList = result.getGoodsList();
                        if (goodsList != null && goodsList.size() > 0) {
                            if (goodsList.size() > 10) {
                                goodsList = goodsList.subList(0, 10);
                            }
                            ConfigParamsDTO paramsDTO = hongBaoManageService
                                    .getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion());
                            for (PDDGoodsDetail goods : goodsList) {
                                listDetailVO.add(GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO));
                            }
                        }
                    }
                }
                // 取偶数个数据
                if (listDetailVO.size() % 2 != 0) {
                    listDetailVO.remove(listDetailVO.size() - 1);
                }
                data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO));
                out.print(JsonUtil.loadTrueResult(data));
                return;
            }
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
            JSONObject data = new JSONObject();
            data.put("listQuality", new JSONArray());
            data.put("listGuess", new JSONArray());
            out.print(JsonUtil.loadTrueResult(data));
        }
    }
    /**
     * 获取商品详情
     * @param acceptData
     * @param goodsId 商品id
     * @param uid
     * @param code 邀请码
     * @param goodsType 商品类型
     * @param from 页面来源
     * @param out
     */
    @RequestMapping(value = "getBuyLink", method = RequestMethod.POST)
    public void getBuyLink(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from,
            String couponUrl, Long uid, String inviteCode, PrintWriter out) {
        if (goodsId == null || goodsType == null) {
            out.print(JsonUtil.loadFalseResult(1, "商品信息传递错误"));
            return;
        }
        // 判断是自购 还是根据邀请码
        boolean share = false;
        String subUnionId = "";
        if (uid != null) {
            UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
            if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
                out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
                return;
            }
            subUnionId = uid.toString();
        } else if ((uid == null || uid < 1) && !StringUtil.isNullOrEmpty(inviteCode) ) {
            try {
                UserInfo user = userInfoExtraService.getUserByInviteCode(inviteCode);
                if (user != null && user.getState() == UserInfo.STATE_NORMAL) {
                    share = true;
                    subUnionId = user.getId().toString();
                }
            } catch (UserInfoExtraException e) {
                e.printStackTrace();
            }
        }
        String jumpLink = null;
        if (goodsType.intValue() == Constant.SOURCE_TYPE_JD) { // 京东
            JDGoods goods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
            if (goods == null) {
                out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
                return;
            }
            String materialId = "https://item.jd.com/" + goodsId + ".html";
            if (StringUtil.isNullOrEmpty(couponUrl)) {
                JDCouponInfo couponInfo = JDUtil.getShowCouponInfo(goods.getCouponInfoList(), goods.getPrice());
                if (couponInfo != null) {
                    couponUrl = couponInfo.getLink();
                }
            }
            long position =  JDApiUtil.POSITION_FANLI;
            if (share) {
                position = JDApiUtil.POSITION_SHARE;
            }
            String jdLink = JDApiUtil.convertLinkWithSubUnionId(materialId, couponUrl, position + "", subUnionId);
            try {
                jumpLink = "/pages/union/proxy/proxy?spreadUrl=" + URLEncoder.encode(jdLink, "UTF-8");
            } catch (Exception e) {
                LogHelper.errorDetailInfo(e);
            }
        } else if (goodsType.intValue() == Constant.SOURCE_TYPE_PDD) { // 拼多多
            PDDGoodsDetail goods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
            if (goods == null) {
                out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
                return;
            }
            String position = PinDuoDuoApiUtil.PID_FANLI;
            if (share) {
                position = PinDuoDuoApiUtil.PID_SHARE;
            }
            jumpLink = PinDuoDuoApiUtil.convertWXMP(goodsId, position, subUnionId);
        } else {
            out.print(JsonUtil.loadFalseResult(1, "参数传递错误"));
            return;
        }
        if (StringUtil.isNullOrEmpty(jumpLink)) {
            out.print(JsonUtil.loadFalseResult(1, "创建购买信息失败"));
            return;
        }
        JSONObject data = new JSONObject();
        data.put("goodsType", goodsType);
        data.put("jumpLink", jumpLink);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 分享商品海报
     * @param acceptData
     * @param goodsId
     * @param goodsType
     * @param from
     * @param type
     * @param uid
     * @param out
     */
    @RequestMapping(value = "sharePoster", method = RequestMethod.POST)
    public void sharePoster(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type,
            Long uid, PrintWriter out) {
        if (uid == null || uid < 1) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if (goodsId == null || goodsType == null) {
            out.print(JsonUtil.loadFalseResult(1, "商品信息传递错误"));
            return;
        }
        if (type == null || type < 1 || type > 2) {
            out.print(JsonUtil.loadFalseResult(1, "分享类型错误"));
            return;
        }
        UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
        if (user != null && user.getState() != UserInfo.STATE_NORMAL) {
            out.print(JsonUtil.loadFalseResult(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC));
            return;
        }
        String inviteCode = userInfoExtraService.getInviteCodeByUid(uid);
        if (StringUtil.isNullOrEmpty(inviteCode)) {
            out.print(JsonUtil.loadFalseResult(1, "邀请码未激活"));
            return;
        }
        if (goodsType.intValue() == Constant.SOURCE_TYPE_JD) { // 京东
            createPosterJD(acceptData, goodsId, goodsType, from, type, user, inviteCode, out);
        } else if (goodsType.intValue() == Constant.SOURCE_TYPE_PDD) { // 拼多多
            createPosterPDD(acceptData, goodsId, goodsType, from, type, user, inviteCode, out);
        } else {
            out.print(JsonUtil.loadFalseResult(1, "参数传递错误"));
        }
    }
    /**
     * 创建京东分享海报
     */
    private void createPosterJD(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type, UserInfo user,
            String inviteCode,  PrintWriter out) {
        JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(goodsId);
        if (jdGoods == null) {
            out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
            return;
        }
        ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),acceptData.getVersion());
        GoodsDetailVO goods = GoodsDetailVOFactory.convertJDGoods(jdGoods, paramsDTO);
        String scene = goodsType+"#"+goodsId+"#" + inviteCode;
        FileUploadResult uploadResult = null;
        if (type == 1) {
            String erCodeUrl = "https://wxmp.banliapp.com/goods?info="+ scene;
            uploadResult = qrCodeService.drawGoodsPoster(erCodeUrl, user.getPortrait(), goods);
        } else {
            String acessToken = WXUtil.getAcessToken(Constant.WXMP_APP_INFO.getAppId(), Constant.WXMP_APP_INFO.getAppSecret());
            InputStream xcxCode = WXXCXUtil.getXCXCode(acessToken, "/pages/goods/goods", scene);
            uploadResult = qrCodeService.drawGoodsPosterXCX(xcxCode, user, goods);
        }
        try {
            userShareGoodsRecordService.saveShareRecord(user.getId(), CommonGoodsFactory.create(jdGoods));
        } catch (UserShareGoodsRecordException e) {
            e.printStackTrace();
        }
        String posterLink = uploadResult.getUrl();
        JSONObject data = new JSONObject();
        data.put("posterLink", posterLink);
        out.print(JsonUtil.loadTrueResult(data));
        com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
            @Override
            public void run() {
                // 异步操作 添加分享记录
                UserShareGoodsHistory history = new UserShareGoodsHistory();
                history.setUser(new UserInfo(user.getId()));
                history.setHongbao(new BigDecimal(goods.getMoneyInfo().getShareMoney().replace("¥", "")));
                history.setCreateTime(new Date());
                history.setGoodsType(Constant.SOURCE_TYPE_JD);
                history.setTkCode(null);
                history.setLink(null);
                history.setQuanLink(null);
                history.setGoodsId(goodsId);
                history.setPostPicture(goods.getPicUrl());
                history.setPictures(JsonUtil.getGson().toJson(goods.getImgList()));
                history.setShareImg(posterLink);
                shareGoodsService.addShareGoodsHistory(history);
            }
        });
    }
    /**
     * 创建拼多多分享海报
     */
    private void createPosterPDD(WXMPAcceptData acceptData, Long goodsId, Integer goodsType, String from, Integer type, UserInfo user,
            String inviteCode,  PrintWriter out) {
        PDDGoodsDetail pddGoods = pinDuoDuoCacheUtil.getGoodsInfo(goodsId);
        if (pddGoods == null) {
            out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
            return;
        }
        ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion());
        GoodsDetailVO goods = GoodsDetailVOFactory.convertPDDGoods(pddGoods, paramsDTO);
        String scene = goodsType+"#"+goodsId+"#" + inviteCode;
        FileUploadResult uploadResult = null;
        if (type == 1) {
            String erCodeUrl = "https://wxmp.banliapp.com/goods?info="+ scene;
            uploadResult = qrCodeService.drawGoodsPoster(erCodeUrl, user.getPortrait(), goods);
        } else {
            String acessToken = WXUtil.getAcessToken(Constant.WXMP_APP_INFO.getAppId(), Constant.WXMP_APP_INFO.getAppSecret());
            InputStream xcxCode = WXXCXUtil.getXCXCode(acessToken, "/pages/goods/goods", scene);
            uploadResult = qrCodeService.drawGoodsPosterXCX(xcxCode, user, goods);
        }
        try {
            userShareGoodsRecordService.saveShareRecord(user.getId(), CommonGoodsFactory.create(pddGoods));
        } catch (UserShareGoodsRecordException e) {
            e.printStackTrace();
        }
        String posterLink = uploadResult.getUrl();
        JSONObject data = new JSONObject();
        data.put("posterLink", posterLink);
        out.print(JsonUtil.loadTrueResult(data));
        // 异步操作
        com.yeshi.fanli.util.ThreadUtil.run(new Runnable() {
            @Override
            public void run() {
                // 异步操作 添加分享记录
                UserShareGoodsHistory history = new UserShareGoodsHistory();
                history.setUser(new UserInfo(user.getId()));
                history.setHongbao(new BigDecimal(goods.getMoneyInfo().getShareMoney().replace("¥", "")));
                history.setCreateTime(new Date());
                history.setGoodsType(Constant.SOURCE_TYPE_PDD);
                history.setTkCode(null);
                history.setLink(null);
                history.setQuanLink(null);
                history.setGoodsId(goodsId);
                history.setPostPicture(goods.getPicUrl());
                history.setPictures(JsonUtil.getGson().toJson(goods.getImgList()));
                history.setShareImg(posterLink);
                shareGoodsService.addShareGoodsHistory(history);
            }
        });
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/RecommendController.java
New file
@@ -0,0 +1,336 @@
package com.yeshi.fanli.controller.wxmp.v1;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.WXMPAcceptData;
import com.yeshi.fanli.dto.jd.JDSearchResult;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.homemodule.Special;
import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.goods.recommend.HomeRecommendGoodsService;
import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
import com.yeshi.fanli.service.inter.homemodule.DeviceSexService;
import com.yeshi.fanli.service.inter.homemodule.SpecialService;
import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
import com.yeshi.fanli.service.inter.jd.JDGoodsService;
import com.yeshi.fanli.service.inter.lable.QualityFlashSaleService;
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
import com.yeshi.fanli.service.inter.monitor.MonitorService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.pdd.PDDGoodsService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.JumpDetailUtil;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller("WXMPRecommendController")
@RequestMapping("/wxmp/api/v1/recommend")
public class RecommendController {
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private QualityGoodsService qualityGoodsService;
    @Resource
    private RedisManager redisManager;
    @Resource
    private HomeRecommendGoodsService homeRecommendGoodsService;
    @Resource
    private ConfigService configService;
    @Resource
    private MonitorService monitorService;
    @Resource
    private QualityFlashSaleService qualityFlashSaleService;
    @Resource
    private RecommendGoodsDeleteHistoryService recommendGoodsDeleteHistoryService;
    @Resource
    private JumpDetailV2Service jumpDetailV2Service;
    @Resource
    private DeviceSexService deviceSexService;
    @Resource
    private SpecialService specialService;
    @Resource
    private SwiperPictureService swiperPictureService;
    @Resource
    private JDGoodsService jdGoodsService;
    @Resource
    private PDDGoodsService pddGoodsService;
    @Resource
    private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
    @Resource
    private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
    @Resource
    private DaTaoKeGoodsService daTaoKeGoodsService;
    @Resource
    private HongBaoV2CountService hongBaoV2CountService;
    /**
     * 首页专题
     *
     * @param acceptData
     * @param uid
     * @param out
     */
    @RequestMapping(value = "getIndex")
    public void getIndex(WXMPAcceptData acceptData, Long uid, PrintWriter out) {
        try {
            String platform = acceptData.getPlatform();
            int version = Integer.parseInt(acceptData.getVersion());
            // 轮播图
            List<SwiperPicture> picList = swiperPictureService.getByBannerCardAndVersion("index_top", platform,
                    version);
            if (picList == null) {
                picList = new ArrayList<>();
            }
            for (SwiperPicture swiper : picList) {
                JSONObject params = null;
                if (StringUtil.isNullOrEmpty(swiper.getParams())) {
                    params = JSONObject.fromObject(swiper.getParams());
                }
                swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail(), params));
                swiper.setParams(null);
            }
            // 圆形专题
            List<Special> specials = specialService.listByVersion(0, 10, "index_arc_1.6.5", platform, version);
            if (specials == null)
                specials = new ArrayList<>();
            for (Special special : specials) {
                JumpDetailV2 jumpDetail = special.getJumpDetail();
                if (special.isJumpLogin() && jumpDetail != null) {
                    jumpDetail.setNeedLogin(true);
                }
                JSONObject params = null;
                if (StringUtil.isNullOrEmpty(special.getParams())) {
                    params = JSONObject.fromObject(special.getParams());
                }
                special.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(jumpDetail, params));
                special.setParams(null);
            }
            // 活动
            List<SwiperPicture> activitys = swiperPictureService.getByBannerCardAndVersion("index_invite", platform,
                    version);
            if (activitys == null)
                activitys = new ArrayList<>();
            for (SwiperPicture swiper : activitys) {
                JSONObject params = null;
                if (StringUtil.isNullOrEmpty(swiper.getParams())) {
                    params = JSONObject.fromObject(swiper.getParams());
                }
                swiper.setJumpDetail(JumpDetailUtil.getWXMPJumDetail(swiper.getJumpDetail(), params));
                swiper.setParams(null);
            }
            JSONObject data = new JSONObject();
            data.put("bannerList", JsonUtil.getApiCommonGson().toJson(picList));
            data.put("specialList", JsonUtil.getApiCommonGson().toJson(specials));
            data.put("activityList", JsonUtil.getApiCommonGson().toJson(activitys));
            out.print(JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult(1, "获取数据失败"));
            try {
                LogHelper.errorDetailInfo(e);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
        }
    }
    /**
     * 首页底部商品推荐
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "getGoodList")
    public void getGoodList(WXMPAcceptData acceptData, Integer goodsType, Integer page, HttpServletRequest request,
            PrintWriter out) {
        if (goodsType == null || page == null) {
            out.print(JsonUtil.loadFalseResult("参数信息不正常"));
            return;
        }
        try {
            if (goodsType == Constant.SOURCE_TYPE_JD) {
                getIndexJDGoods(acceptData, page, out);
                return;
            }
            if (goodsType == Constant.SOURCE_TYPE_PDD) {
                getIndexPDDGoods(acceptData, page, out);
                return;
            }
            out.print(JsonUtil.loadFalseResult("商品类型错误"));
        } catch (Exception e) {
            LogHelper.errorDetailInfo(e);
            JSONObject data = new JSONObject();
            data.put("list", new JSONArray());
            data.put("count", 0);
            out.print(JsonUtil.loadTrueResult(data));
        }
    }
    /**
     * 京东首页商品
     *
     * @param acceptData
     * @param page
     * @param out
     */
    private void getIndexJDGoods(WXMPAcceptData acceptData, int page, PrintWriter out) {
        JDSearchResult result = jdGoodsService.getIndexJDGoods(page);
        long count = 0;
        JSONObject data = new JSONObject();
        JSONArray array = new JSONArray();
        if (result != null) {
            PageEntity pageEntity = result.getPageEntity();
            if (pageEntity != null) {
                count = pageEntity.getTotalCount();
            }
            List<JDGoods> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion());
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                for (JDGoods goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
                    array.add(gson.toJson(goodsDetailVO));
                }
            }
        }
        data.put("list", array);
        data.put("count", count);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 爆款排行商品-实时热销榜
     *
     * @param acceptData
     * @param page
     * @param out
     */
    private void getIndexPDDGoods(WXMPAcceptData acceptData, int page, PrintWriter out) {
        PDDGoodsResult result = pddGoodsService.getTopGoodsList(page, 1);
        int count = 0;
        JSONArray array = new JSONArray();
        if (result != null) {
            count = result.getTotalCount();
            Gson gson = JsonUtil.getApiCommonGson();
            List<PDDGoodsDetail> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion());
                for (PDDGoodsDetail goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO);
                    array.add(gson.toJson(goodsDetailVO));
                }
            }
        }
        JSONObject data = new JSONObject();
        data.put("list", array);
        data.put("count", count);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 首页顶部提示
     *
     * @param acceptData
     * @param uid
     * @param callback
     * @param out
     */
    @RequestMapping(value = "getGuide")
    public void getGuide(AcceptData acceptData, Long uid, PrintWriter out) {
        String tips = null;
        if (uid == null || uid <= 0) {
            tips = configService.get("tip_guide_new_user");
        } else {
            long rebateOrder = hongBaoV2CountService.countRebateOrder(uid);
            long shareOrInviteOrder = hongBaoV2CountService.countShareOrInviteOrder(uid);
            if (rebateOrder + shareOrInviteOrder >= 3) {
                // 熟客版
            } else if (rebateOrder <= 0 && shareOrInviteOrder <= 0) {
                // 新人版
                tips = configService.get("tip_guide_new_user");
            } else if (rebateOrder > 0 && shareOrInviteOrder <= 0) {
                // 省钱版
                tips = configService.get("tip_guide_save_money");
            } else {
                // 赚钱版
                tips = configService.get("tip_guide_share_invite");
            }
        }
        if (StringUtil.isNullOrEmpty(tips)) {
            out.print(JsonUtil.loadFalseResult("暂无提示"));
            return;
        }
        JSONObject data = JSONObject.fromObject(tips);
        out.print(JsonUtil.loadTrueResult(data));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/wxmp/v1/SearchController.java
New file
@@ -0,0 +1,535 @@
package com.yeshi.fanli.controller.wxmp.v1;
import java.io.PrintWriter;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.WXMPAcceptData;
import com.yeshi.fanli.dto.jd.JDFilter;
import com.yeshi.fanli.dto.jd.JDSearchFilter;
import com.yeshi.fanli.dto.jd.JDSearchResult;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.jd.JDGoods;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.brand.BrandInfoService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.manger.goods.jd.JDGoodsLinkParseManager;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
import com.yeshi.fanli.util.jd.JDApiUtil;
import com.yeshi.fanli.util.jd.JDUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
import com.yeshi.fanli.util.taobao.SearchFilterUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller("WXMPSearchController")
@RequestMapping("/wxmp/api/v1/search")
public class SearchController {
    @Resource
    private ConfigService configService;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private BrandInfoService brandInfoService;
    @Resource
    private JDGoodsLinkParseManager jdGoodsLinkParseManager;
    /**
     * 粘贴板信息推荐
     *
     * @param acceptData
     * @param url
     *            商品链接
     * @param out
     */
    @RequestMapping(value = "getRecommendInfo", method = RequestMethod.POST)
    public void getRecommendInfo(WXMPAcceptData acceptData, String text, Long uid, PrintWriter out) {
        if (StringUtil.isNullOrEmpty(text)) {
            out.print(JsonUtil.loadFalseResult("值为空"));
            return;
        }
        // 去除前后空格
        int type = 1;
        text = text.trim();
        String URL_REGEX = "(((http|https)://)|(www\\.))[a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6}(:[0-9]{1,4})?(/[a-zA-Z0-9\\&%_\\./-~-]*)?";
        Pattern p = Pattern.compile(URL_REGEX);
        Matcher matcher = p.matcher(text);
        if (!matcher.find()) {// 不包含链接
            if (text.length() > 256) {
                out.print(JsonUtil.loadFalseResult("值过长"));
                return;
            }
            String pattern = "^[A-Za-z0-9-]+$";
            if (Pattern.matches(pattern, text.replace(" ", ""))) {// 删除空格
                out.println(JsonUtil.loadFalseResult("不支持推荐"));
                return;
            }
            LogHelper.test("根据粘贴板推荐:" + text);
            if (text.length() > 80) {
                out.print(JsonUtil.loadFalseResult("值过长"));
                return;
            }
            if (!StringUtil.isNullOrEmpty(TaoBaoUtil.parseSystemTaoToken(text))) {
                out.print(JsonUtil.loadFalseResult("不支持推荐"));
                return;
            }
            JSONObject data = new JSONObject();
            data.put("type", type);
            data.put("title", text);
            out.print(JsonUtil.loadTrueResult(data));
            return;
        }
        type = 2;
        CommonGoods commonGoods = null;
        text = matcher.group();
        String jdId = JDUtil.getJDGoodsId(text);
        if (StringUtil.isNullOrEmpty(jdId)) {
            jdId = JDUtil.getJDGoodsIdByWeiXin(text); // 微信链接
            if (StringUtil.isNullOrEmpty(jdId) && text.contains("u.jd.com")) {
                jdId = jdGoodsLinkParseManager.parseGoodsIdByJDShortUrl(text); // 领券短连接
            }
        }
        if (!StringUtil.isNullOrEmpty(jdId)) {
            JDGoods goods = JDApiUtil.getGoodsDetail(Long.parseLong(jdId));
            if (goods != null) {
                // 高级接口 -- 信息更完整
                JDGoods jdGoods = JDApiUtil.queryGoodsDetail(Long.parseLong(jdId));
                if (jdGoods != null) {
                    commonGoods = CommonGoodsFactory.create(jdGoods);
                } else {
                    commonGoods = CommonGoodsFactory.create(goods);
                }
            } else {
                type = 3;
                goods = JDUtil.getSimpleGoodsInfo(jdId);
                if (goods != null) {
                    commonGoods = new CommonGoods();
                    commonGoods.setTitle(goods.getSkuName());
                    commonGoods.setPicture(goods.getPicUrl());
                }
            }
        } else {
            String pddId = PinDuoDuoUtil.getPDDGoodsId(text);
            if (!StringUtil.isNullOrEmpty(pddId)) {
                PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(pddId));
                if (goods != null) {
                    commonGoods = CommonGoodsFactory.create(goods);
                } else {
                    type = 3;
                    goods = PinDuoDuoUtil.getPDDGoodsInfo(pddId);
                    if (goods != null) {
                        commonGoods = new CommonGoods();
                        commonGoods.setTitle(goods.getGoodsName());
                        commonGoods.setPicture(goods.getGoodsThumbnailUrl());
                    }
                }
            }
        }
        if (commonGoods == null) {
            out.println(JsonUtil.loadFalseResult("暂未找到该商品,请稍后再试!"));
            return;
        }
        if (type == 3) {
            JSONObject data = new JSONObject();
            JSONObject goodsJSON = new JSONObject();
            goodsJSON.put("title", commonGoods.getTitle());
            goodsJSON.put("pictUrl", commonGoods.getPicture());
            data.put("type", type);
            data.put("desc", "该商品无推广信息");
            data.put("goods", goodsJSON);
            out.print(JsonUtil.loadTrueResult(data));
            return;
        }
        JSONObject data = new JSONObject();
        Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
        data.put("type", type);
        data.put("goods", gson.toJson(GoodsDetailVOFactory.convertCommonGoods(commonGoods, hongBaoManageService.getShowComputeRate(acceptData.getPlatform(), acceptData.getVersion()))));
        out.print(JsonUtil.loadTrueResult(data));
        return;
    }
    /**
     * 搜索候选词
     *
     * @param acceptData
     * @param kw
     * @param out
     */
    @RequestMapping(value = "suggestSearch", method = RequestMethod.POST)
    public void getSugguestSearch(WXMPAcceptData acceptData, String kw, Integer goodsType, PrintWriter out) {
        if (goodsType == null) {
            out.print(JsonUtil.loadFalseResult("平台类型不能为空"));
            return;
        }
        List<String> list = null;
        if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
            list = TaoBaoUtil.getSuguestSearch(kw);
        } else if (goodsType == Constant.SOURCE_TYPE_JD) {
            list = JDUtil.suggestSearch(kw);
        } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
            list = PinDuoDuoUtil.suggestSearch(kw);
        }
        if (list == null || list.size() == 0) {
            out.print(JsonUtil.loadFalseResult("暂无建议内容"));
            return;
        }
        JSONArray array = new JSONArray();
        for (String words : list) {
            array.add(words);
        }
        out.print(JsonUtil.loadTrueResult(array));
    }
    /**
     * 搜索-新版
     *
     * @param acceptData
     * @param kw
     * @param page
     * @param filter
     * @param order
     *            销量由高到低:1 、 价格从高到低:2 、 价格从低到高:3 、 推广量高到低:4(综合默认)、返利比高到低:5
     *            、返利比低到高:6 、推荐20
     * @param startprice
     * @param endprice
     * @param fastFilter
     * @param out
     */
    @RequestMapping(value = "searchGoods")
    public void searchGoods(WXMPAcceptData acceptData, Integer goodsType, String key, Integer page, String filter,
            Integer order, Long uid, HttpSession session, PrintWriter out) {
        if (goodsType == null || goodsType < 2 || goodsType > 3) {
            out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数"));
            return;
        }
        if (StringUtil.isNullOrEmpty(key)) {
            out.print(JsonUtil.loadFalseResult(1, "请输入搜索内容"));
            return;
        }
        if (page == null || page < 1) {
            page = 1;
        }
        final String searchkey = key.trim();
        if (searchkey.startsWith("http://") || searchkey.startsWith("https://")) {
            JSONObject data = new JSONObject();
            data.put("count", 0);
            data.put("list", new JSONArray());
            out.print(JsonUtil.loadTrueResult(data));
            return;
        }
        /*--------- 京东商品  -------*/
        if (goodsType.intValue() == Constant.SOURCE_TYPE_JD) {
            searchJDGoods(acceptData, searchkey, page, filter, order, out);
            return;
        }
        /*-------- 拼多多商品  -------*/
        if (goodsType.intValue() == Constant.SOURCE_TYPE_PDD) {
            searchPDDGoods(acceptData, searchkey, page, filter, order, out);
            return;
        }
    }
    /**
     * 京东
     *
     * @param kw
     * @param page
     * @param filter
     * @param order
     * @param startprice
     * @param endprice
     * @return
     */
    private void searchJDGoods(WXMPAcceptData acceptData, String key, Integer page, String filter, Integer order,
            PrintWriter out) {
        JDSearchResult result = null;
        boolean hasCoupon = false;
        String way = configService.get("jd_api_search_key");
        if ("1".equals(way)) {
            JDFilter filterAPI = new JDFilter();
            filterAPI.setKeyword(SearchFilterUtil.filterSearchContent(key));
            filterAPI.setPageIndex(page);
            filterAPI.setPageSize(Constant.PAGE_SIZE);
            if (order != null) {
                int sort = order.intValue();
                switch (sort) {
                case 1: // 销量 desc
                    filterAPI.setSort(JDFilter.SORT_DESC);
                    filterAPI.setSortName(JDFilter.SORTNAME_ORDER_COUNT_30DAYS);
                    break;
                case 2: // 价格—desc
                    filterAPI.setSort(JDFilter.SORT_DESC);
                    filterAPI.setSortName(JDFilter.SORTNAME_PRICE);
                    break;
                case 3: // 价格—asc
                    filterAPI.setSort(JDFilter.SORT_ASC);
                    filterAPI.setSortName(JDFilter.SORTNAME_PRICE);
                    break;
                case 4: // 返利比—DESC
                    filterAPI.setSort(JDFilter.SORT_DESC);
                    filterAPI.setSortName(JDFilter.SORTNAME_COMMISSION_SHARE);
                    break;
                default:
                    break;
                }
            }
            if (!StringUtil.isNullOrEmpty(filter)) {
                JSONObject jsonfilter = JSONObject.fromObject(filter);
                Boolean coupon = jsonfilter.optBoolean("coupon");
                if (coupon != null && coupon) {
                    hasCoupon = true;
                    filterAPI.setIsCoupon(1); // 有券
                }
                Boolean zy = jsonfilter.optBoolean("zy");
                if (zy != null && zy) {
                    filterAPI.setOwner("g"); // 自营
                }
                String minPrice = jsonfilter.optString("minPrice");
                if (!StringUtil.isNullOrEmpty(minPrice)) {
                    filterAPI.setPricefrom(Double.parseDouble(minPrice));
                }
                String maxPrice = jsonfilter.optString("maxPrice");
                if (!StringUtil.isNullOrEmpty(maxPrice)) {
                    filterAPI.setPriceto(Double.parseDouble(maxPrice));
                }
            }
            result = JDApiUtil.queryByKey(filterAPI);
        } else {
            // 网页爬取
            JDSearchFilter jdfilter = new JDSearchFilter();
            jdfilter.setKey(SearchFilterUtil.filterSearchContent(key));
            jdfilter.setPageNo(page);
            jdfilter.setPageSize(Constant.PAGE_SIZE);
            if (order != null) {
                int sort = order.intValue();
                switch (sort) {
                case 1: // 销量 desc
                    jdfilter.setSort(JDSearchFilter.SORT_DESC);
                    jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
                    break;
                case 2: // 价格—desc
                    jdfilter.setSort(JDSearchFilter.SORT_DESC);
                    jdfilter.setSortName(JDSearchFilter.SORTNAME_PRICE);
                    break;
                case 3: // 价格—asc
                    jdfilter.setSort(JDSearchFilter.SORT_ASC);
                    jdfilter.setSortName(JDSearchFilter.SORTNAME_PRICE);
                    break;
                case 4: // 返利比—DESC
                    jdfilter.setSort(JDSearchFilter.SORT_DESC);
                    jdfilter.setSortName(JDSearchFilter.SORTNAME_COMMISSION_SHARE);
                    break;
                default:
                    break;
                }
            }
            if (!StringUtil.isNullOrEmpty(filter)) {
                JSONObject jsonfilter = JSONObject.fromObject(filter);
                Boolean coupon = jsonfilter.optBoolean("coupon");
                if (coupon != null && coupon) {
                    hasCoupon = true;
                    jdfilter.setHasCoupon(1); // 有券
                }
                Boolean zy = jsonfilter.optBoolean("zy");
                if (zy != null && zy) {
                    jdfilter.setIsZY(1); // 自营
                }
                Boolean delivery = jsonfilter.optBoolean("delivery");
                if (delivery != null && delivery) {
                    jdfilter.setDeliveryType(1); // 京东配送
                }
                String minPrice = jsonfilter.optString("minPrice");
                if (!StringUtil.isNullOrEmpty(minPrice)) {
                    if (minPrice.contains(".")) {
                        minPrice = minPrice.replace(".", "-");
                        minPrice = minPrice.split("-")[0];
                    }
                    jdfilter.setFromPrice(Integer.parseInt(minPrice));
                }
                String maxPrice = jsonfilter.optString("maxPrice");
                if (!StringUtil.isNullOrEmpty(maxPrice)) {
                    if (maxPrice.contains(".")) {
                        maxPrice = maxPrice.replace(".", "-");
                        maxPrice = maxPrice.split("-")[0];
                    }
                    jdfilter.setToPrice(Integer.parseInt(maxPrice));
                }
            }
            result = JDUtil.searchByKey(jdfilter);
        }
        long count = 0;
        JSONObject data = new JSONObject();
        JSONArray array = new JSONArray();
        if (result != null) {
            PageEntity pageEntity = result.getPageEntity();
            if (pageEntity != null) {
                count = pageEntity.getTotalCount();
            }
            List<JDGoods> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion());
                for (JDGoods goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
                    if (hasCoupon) {
                        if (goodsDetailVO.isHasCoupon()) {
                            array.add(gson.toJson(goodsDetailVO));
                        }
                    } else {
                        array.add(gson.toJson(goodsDetailVO));
                    }
                }
            }
        }
        data.put("count", count);
        data.put("list", array);
        out.print(JsonUtil.loadTrueResult(data));
    }
    /**
     * 拼多多
     *
     * @param kw
     * @param page
     * @param filter
     * @param order
     * @param startprice
     * @param endprice
     * @return
     */
    private void searchPDDGoods(WXMPAcceptData acceptData, String key, Integer page, String filter, Integer order,
            PrintWriter out) {
        PDDSearchFilter pddfilter = new PDDSearchFilter();
        pddfilter.setKw(SearchFilterUtil.filterSearchContent(key));
        pddfilter.setPage(page);
        pddfilter.setPageSize(Constant.PAGE_SIZE);
        if (order != null) {
            int sort = order.intValue();
            switch (sort) {
            case 1: // 销量 desc
                pddfilter.setSortType(6);
                break;
            case 2: // 价格—desc
                pddfilter.setSortType(4);
                break;
            case 3: // 价格—asc
                pddfilter.setSortType(3);
                break;
            case 4: // 返利比—desc
                pddfilter.setSortType(2);
                break;
            default: // 综合排序
                pddfilter.setSortType(0);
                break;
            }
        }
        if (!StringUtil.isNullOrEmpty(filter)) {
            JSONObject jsonfilter = JSONObject.fromObject(filter);
            Boolean coupon = jsonfilter.optBoolean("coupon");
            if (coupon != null && coupon) {
                pddfilter.setHasCoupon(true); // 有券
            }
            Boolean brand = jsonfilter.optBoolean("brand");
            if (brand != null && brand) {
                pddfilter.setIsBrand(true); // 是否是品牌
            }
        }
        int count = 0;
        JSONObject data = new JSONObject();
        JSONArray array = new JSONArray();
        PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
        if (result != null) {
            count = result.getTotalCount();
            Gson gson = JsonUtil.getApiCommonGson();
            List<PDDGoodsDetail> goodsList = result.getGoodsList();
            if (goodsList != null && goodsList.size() > 0) {
                ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
                        acceptData.getVersion());
                for (PDDGoodsDetail goods : goodsList) {
                    GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertPDDGoods(goods, paramsDTO);
                    array.add(gson.toJson(goodsDetailVO));
                }
            }
        }
        data.put("count", count);
        data.put("list", array);
        out.print(JsonUtil.loadTrueResult(data));
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/QrCodeServiceImpl.java
@@ -12,9 +12,11 @@
import org.springframework.stereotype.Service;
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.QRCodeUtil;
import org.yeshi.utils.entity.FileUploadResult;
import org.yeshi.utils.tencentcloud.COSManager;
import com.yeshi.fanli.dao.mybatis.share.ShareMapper;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.service.inter.user.QrCodeService;
import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
import com.yeshi.fanli.util.Constant;
@@ -22,6 +24,7 @@
import com.yeshi.fanli.util.ImageUtil;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.UserInviteUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
@Service
public class QrCodeServiceImpl implements QrCodeService {
@@ -278,5 +281,51 @@
        }
        return null;
    }
    @Override
    public FileUploadResult drawGoodsPoster(String erCodeUrl, String portrait, GoodsDetailVO goods) {
        // 二维码流
        InputStream erCodeStream = null;
        try {
            erCodeStream = QRCodeUtil.getInstance(250).encode(erCodeUrl);
        } catch (Exception e1) {
            e1.printStackTrace();
        }
        // 头像
        InputStream portraitStream = null;
        if (!StringUtil.isNullOrEmpty(portrait)) {
            try {
                portraitStream = HttpUtil.getAsInputStream(portrait);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (portraitStream == null) {
            portraitStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_default_head.jpg");
        }
        // 画图
        InputStream drawStream = ImageUtil.drawGoodsShareSingle(erCodeStream, portraitStream, goods);
        // 上传位置
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String upPath = "sharegoods/xcx/poster" + uuid + "_" + goods.getGoodsId() + "_" + System.currentTimeMillis() + ".png";
        // 上传文件
        return COSManager.getInstance().uploadInputStream(drawStream, upPath);
    }
    @Override
    public FileUploadResult drawGoodsPosterXCX(InputStream erCodeStream,UserInfo user, GoodsDetailVO goods) {
        // 画图
        InputStream drawStream = ImageUtil.drawGoodsShareXCX(erCodeStream, user, goods);
        // 上传位置
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String upPath = "sharegoods/xcx/poster" + uuid + "_" + goods.getGoodsId() + "_" + System.currentTimeMillis() + ".png";
        // 上传文件
        return COSManager.getInstance().uploadInputStream(drawStream, upPath);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsRecordServiceImpl.java
@@ -28,6 +28,7 @@
import com.yeshi.fanli.dto.share.ShareGoodsRecordDTO;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.share.UserShareGoodsGroup;
import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory;
import com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord;
import com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord.ShareSourceTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserGoodsStorage;
@@ -43,6 +44,7 @@
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
import com.yeshi.fanli.service.inter.user.QrCodeService;
import com.yeshi.fanli.service.inter.user.UserAccountService;
import com.yeshi.fanli.service.inter.user.UserGoodsStorageService;
import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService;
@@ -56,6 +58,7 @@
import com.yeshi.fanli.util.factory.CommonGoodsFactory;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -95,6 +98,7 @@
    @Resource
    private IntegralGetService integralGetService;
    @Override
    public int insert(UserShareGoodsRecord record) {
@@ -1025,5 +1029,56 @@
        return shareImg;
    }
    @Override
    public void saveShareRecord(Long uid, CommonGoods goods) throws UserShareGoodsRecordException {
        if (goods == null || uid == null) {
            throw new UserShareGoodsRecordException(1, "参数缺失");
        }
        UserShareGoodsRecord userShareGoodsRecord = new UserShareGoodsRecord();
        userShareGoodsRecord.setShareState(1);
        userShareGoodsRecord.setUid(uid);
        userShareGoodsRecord.setSource(ShareSourceTypeEnum.goodsDetail);
        CommonGoods resultCommonGoods = null;
        try {
            resultCommonGoods = commonGoodsService.addOrUpdateCommonGoods(goods);
        } catch (CommonGoodsException e) {
            throw new UserShareGoodsRecordException(1, "商品存入失败");
        }
        UserShareGoodsGroup singleGoods = userShareGoodsGroupService.getSingleGoods(resultCommonGoods.getId(),uid);
        if (singleGoods != null) {
            // 单个商品多次分享
            userShareGoodsRecord.setPicture(resultCommonGoods.getPicture());
            userShareGoodsRecord.setId(singleGoods.getRecordId());
            userShareGoodsRecord.setUpdateTime(new Date());
            userShareGoodsRecordMapper.updateByPrimaryKeySelective(userShareGoodsRecord);
            // 最新商品
            singleGoods.setUpdateTime(new Date());
            userShareGoodsGroupService.updateByPrimaryKeySelective(singleGoods);
        } else {
            // 单个商品第一次分享
            Date date = new Date();
            userShareGoodsRecord.setPicture(resultCommonGoods.getPicture());
            userShareGoodsRecord.setCreateTime(date);
            userShareGoodsRecord.setUpdateTime(date);
            userShareGoodsRecordMapper.insertSelective(userShareGoodsRecord);
            singleGoods = new UserShareGoodsGroup();
            singleGoods.setTotalOrder(0);
            singleGoods.setTotalBrowse(0);
            singleGoods.setTodayBrowse(0);
            singleGoods.setTotalMoney(new BigDecimal(0));
            singleGoods.setCreateTime(date);
            singleGoods.setUpdateTime(date);
            singleGoods.setCommonGoods(resultCommonGoods);
            singleGoods.setRecordId(userShareGoodsRecord.getId());
            userShareGoodsGroupService.insertSelective(singleGoods);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/QrCodeService.java
@@ -4,6 +4,11 @@
import java.io.InputStream;
import java.util.Date;
import org.yeshi.utils.entity.FileUploadResult;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.vo.goods.GoodsDetailVO;
public interface QrCodeService {
    String getPortrait(Long uid);
@@ -64,4 +69,24 @@
     * @throws IOException
     */
    public String drawInviteQrCodeNew(InputStream urlInputStream,String urlMd5, Long uid, String portrait, Integer pX, Integer pY, Integer size, String inviteCode) throws IOException;
    /**
     * 分享商品海报图
     * @param urlInputStream
     * @param erCodeUrl
     * @param uid
     * @param portrait
     * @param goods
     * @return
     */
    public FileUploadResult drawGoodsPoster(String erCodeUrl, String portrait,GoodsDetailVO goods);
    /**
     * 分享小程序名片
     * @param erCodeStream
     * @param user
     * @param goods
     * @return
     */
    public FileUploadResult drawGoodsPosterXCX(InputStream erCodeStream, UserInfo user, GoodsDetailVO goods);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserShareGoodsRecordService.java
@@ -147,5 +147,13 @@
    public ShareGoodsRecordDTO addRecordGoodsStorageV2(Long uid, List<CommonGoods> listCommonGoods,
            List<Long> listStorageID,boolean needDrawPicture) throws UserShareGoodsRecordException;
    /**
     * 创建分享记录
     * @param uid
     * @param goods
     * @throws UserShareGoodsRecordException
     */
    public void saveShareRecord(Long uid, CommonGoods goods) throws UserShareGoodsRecordException;
    
}
fanli/src/main/java/com/yeshi/fanli/util/ImageUtil.java
@@ -126,10 +126,8 @@
                row++;
            }
            String code_frame = "image/share/ic_qr_code_frame.png";
            if (!goods.isHasCoupon()) {
                // 无券
                code_frame = "image/share/ic_qr_code_frame_no_coupon.png";
                g2d.setColor(new Color(229, 0, 92));
                g2d.drawString("¥ ", spacing, y + 175);
                g2d.setFont(boldFont36);
@@ -197,7 +195,7 @@
            // 二维码图框
            g2d.setColor(Color.WHITE);
            InputStream codeFrame = ImageUtil.class.getClassLoader().getResourceAsStream(code_frame);
            InputStream codeFrame = ImageUtil.class.getClassLoader().getResourceAsStream("image/share/qr_code_frame_xcx.png");
            g2d.drawImage(ImageIO.read(codeFrame), spacing + 405, y + 20, 200, 220, null);
            // 画二维码
            int codeSize = 170;
@@ -212,7 +210,7 @@
            }
            
            if (portraitStream == null) {
                portraitStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_icon.png");
                portraitStream = ImageUtil.class.getClassLoader().getResourceAsStream("image/official_default_head.jpg");
            }
            BufferedImage portraitImg = ImageIO.read(portraitStream);
            BufferedImage zoomInImage = ImageUtil.zoomInImage(portraitImg, 84, 84);
@@ -333,10 +331,10 @@
                row++;
            }
            String code_frame = "image/share/ic_qr_code_frame.png";
            String code_frame = "image/share/qr_code_frame.png";
            if (!goods.isHasCoupon()) {
                // 无券
                code_frame = "image/share/ic_qr_code_frame_no_coupon.png";
                code_frame = "image/share/qr_code_frame_no_coupon.png";
                g2d.setColor(new Color(229, 0, 92));
                g2d.drawString("¥ ", spacing, y + 175);
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserSystemMsgVO.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.vo.msg;
import com.yeshi.fanli.entity.common.JumpDetailV2;
public class UserSystemMsgVO {
    private Long id;
    private String portrait;
@@ -11,6 +13,7 @@
    private String timeTag;
    private String createTime;
    private int unReadCount;
    private JumpDetailV2 jumpDetail;// 跳转详情
    public UserSystemMsgVO(Long id, String type, Boolean solved, String title, String content, String timeTag,
            String portrait, String createTime, int unReadCount) {
@@ -101,4 +104,12 @@
        this.createTime = createTime;
    }
    public JumpDetailV2 getJumpDetail() {
        return jumpDetail;
    }
    public void setJumpDetail(JumpDetailV2 jumpDetail) {
        this.jumpDetail = jumpDetail;
    }
}
fanli/src/main/resource/image/icon_baoyou.png
fanli/src/main/resource/image/icon_jd.png
fanli/src/main/resource/image/icon_pdd.png
fanli/src/main/resource/image/icon_quan.png
fanli/src/main/resource/image/icon_xcx.jpg
fanli/src/main/resource/image/icon_ziying.png
fanli/src/main/resource/image/official_default_head.jpg
fanli/src/main/resource/image/share/qr_code_frame.png
fanli/src/main/resource/image/share/qr_code_frame_no_coupon.png
fanli/src/main/resource/image/share/qr_code_frame_xcx.png