删除 RecommendSectionGoods相关+推送版本调整
| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.wx.WXUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.taobao.api.ApiException;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendDetails;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionDetail;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.InviteUser;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.ClassRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendDetailsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionDetailService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
|
| | |
| | | private GoodsSecondClassService goodsSecondClassService;
|
| | |
|
| | | @Resource
|
| | | private ClassRecommendGoodsService classRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | |
| | | @Resource
|
| | | private RecommendSectionService recommendSectionService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionDetailService recommendSectionDetailService;
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("picUrl", recommendSectionDetail.getPicUrl());
|
| | | data.put("html", recommendSectionDetail.getHtmlCode());
|
| | | out.println(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping("getRecommendSectionGoodsList")
|
| | | public void getRecommendSectionGoodsList(long id, PrintWriter out) {
|
| | | List<RecommendSectionGoods> recommendSectionGoodsList = recommendSectionGoodsService
|
| | | .getRecommendSectionGoods(id, Integer.MAX_VALUE);
|
| | | if (recommendSectionGoodsList == null) {
|
| | | JsonUtil.loadFalseResult("商品为空!");
|
| | | return;
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | List<TaoBaoGoodsBriefExtra> list = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | for (RecommendSectionGoods recommendSectionGoods : recommendSectionGoodsList) {
|
| | | list.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(recommendSectionGoods.getTaoBaoGoodsBrief(),
|
| | | proportion.toString(), ""));
|
| | | }
|
| | |
|
| | | Gson gson = JsonUtil.getApiCommonGson();
|
| | | data.put("goodsList", gson.toJson(list));
|
| | | out.println(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.common.Config;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | |
|
| | | /**
|
| | | * 查询列表 - 新后台
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("修改失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询列表 - 新后台
|
| | | * @param callback
|
| | | * @param key 查询词 名称
|
| | | * @param pageIndex
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getVersionList")
|
| | | public void getVersionList(String callback, String key, Integer pageIndex, PrintWriter out){
|
| | | |
| | | try {
|
| | | AppVersionInfo appVersionInfo = new AppVersionInfo();
|
| | | appVersionInfo.setVersion("全推");
|
| | | |
| | | |
| | | // IOS版本
|
| | | List<AppVersionInfo> list1 = appVersionService.getAppVersionInfoListByPlatform(AppVersionInfo.PLATFORM_IOS);
|
| | | if (list1 == null) {
|
| | | list1 = new ArrayList<AppVersionInfo>();
|
| | | }
|
| | | List<AppVersionInfo> listIOS = new ArrayList<AppVersionInfo>();
|
| | | listIOS.add(appVersionInfo);
|
| | | listIOS.addAll(list1);
|
| | | |
| | | |
| | | // 安卓版本
|
| | | List<AppVersionInfo> list2 = appVersionService.getAppVersionInfoListByPlatform(AppVersionInfo.PLATFORM_ANDROID);
|
| | | if (list2 == null) {
|
| | | list2 = new ArrayList<AppVersionInfo>();
|
| | | }
|
| | | List<AppVersionInfo> listAndroid = new ArrayList<AppVersionInfo>();
|
| | | listAndroid.add(appVersionInfo);
|
| | | listAndroid.addAll(list2);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("android", listAndroid);
|
| | | data.put("ios", listIOS);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | |
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("版本查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.ClassRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | |
| | | @Resource
|
| | | private SuperGoodsClassService superGoodsClassService;
|
| | |
|
| | | @Resource
|
| | | private ClassRecommendGoodsService classRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private GoodsSecondClassService goodsSecondClassService;
|
| | |
| | | Long recordId = Long.parseLong(id);
|
| | |
|
| | | superGoodsClassService.deleteSuperGoodsClass(recordId);
|
| | | classRecommendGoodsService.deleteClassGoodsByGC(recordId);
|
| | | |
| | | // goodsSecondClassService.deleteSecondClassByGC(recordId); |
| | |
|
| | | // 删除子类分类
|
| | | goodsSubClassService.deleteByRootId(recordId);
|
| | |
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
|
| | | import com.yeshi.fanli.entity.bus.msg.UserSystemMsgTypeEnum;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 商品推送 -(新后台)
|
| | | * |
| | | * @param uId
|
| | | * -用户ID 可为空
|
| | | * @param url
|
| | | * -商品链接
|
| | | * @param title
|
| | | * -推送标题
|
| | | * @param content
|
| | | * -推送内容
|
| | | * @param out
|
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "newPushGoodsAll")
|
| | | public void newPushGoodsAll(String callback, String url, String title, String content, String uids, String versions, PrintWriter out)
|
| | | throws Exception {
|
| | |
|
| | | String auctionId = null;
|
| | | if (!StringUtil.isNullOrEmpty(url) && url.contains("id=")) {
|
| | | String[] sts = url.split("\\?")[1].split("&");
|
| | | for (String st : sts)
|
| | | if (st.contains("id=")) {
|
| | | auctionId = st.replace("id=", "");
|
| | | }
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(auctionId)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("提取商品ID失败"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject json = IOSPushFactory.createGoodsPush(Long.parseLong(auctionId), title, content);
|
| | | if (json.toString().getBytes().length > 256) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("标题或内容过长,请删减后再试"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | |
| | | List<String> listuid = null;
|
| | | if (uids != null && uids.trim().length() > 0) {
|
| | | listuid = Arrays.asList(uids.split(","));
|
| | | if (listuid == null || listuid.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户id格式不正确"));
|
| | | return;
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | List<String> listVersion = null;
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | List<String> list = Arrays.asList(versions.split(","));
|
| | | |
| | | if (list != null && list.size() > 0) {
|
| | | listVersion = new ArrayList<String>();
|
| | | for (String version: list) {
|
| | | if (version != null && version.trim().length() > 0) {
|
| | | listVersion.add(version.trim());
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if (listVersion == null || listVersion.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("版本号格式不正确"));
|
| | | return;
|
| | | }
|
| | | }
|
| | | |
| | | if (listuid == null) {
|
| | | // 全推
|
| | | pushService.pushGoods(null, title, content, url, listVersion);
|
| | | } else {
|
| | | // 部分用户推送
|
| | | for (String str_uid: listuid) {
|
| | | if (str_uid != null && str_uid.trim().length() > 0) {
|
| | | pushService.pushGoods(Long.parseLong(str_uid), url, title, content, listVersion);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | | } catch (PushException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 网页推送 -(新后台)
|
| | |
| | | */
|
| | | @RequestMapping(value = "newPushUrlAll")
|
| | | public void newPushUrlAll(String callback, String url, String title, String content, String uids,
|
| | | String versions, PrintWriter out) {
|
| | | String arrayIOS, String arrayAndroid, PrintWriter out) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(url) || StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写链接,标题与内容"));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | List<String> listVersion = null;
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | List<String> list = Arrays.asList(versions.split(","));
|
| | | |
| | | if (list != null && list.size() > 0) {
|
| | | listVersion = new ArrayList<String>();
|
| | | for (String version: list) {
|
| | | if (version != null && version.trim().length() > 0) {
|
| | | listVersion.add(version.trim());
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if (listVersion == null || listVersion.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("版本号格式不正确"));
|
| | | if ((arrayIOS == null || arrayIOS.trim().length() == 0)
|
| | | && (arrayAndroid == null || arrayAndroid.trim().length() == 0)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送版本不能为空"));
|
| | | return;
|
| | | }
|
| | | }
|
| | | |
| | | List<String> listIOS = convertList(arrayIOS);
|
| | | List<String> listAndroid = convertList(arrayAndroid);
|
| | |
|
| | | if (listuid == null) {
|
| | | // 全推
|
| | | pushService.pushUrl(null, title, content, url, listVersion);
|
| | | pushService.pushUrl(null, title, content, url, listIOS, listAndroid);
|
| | | } else {
|
| | | // 部分推送
|
| | | for (String str_uid: listuid) {
|
| | | if (str_uid != null && str_uid.trim().length() > 0) {
|
| | | pushService.pushUrl(Long.parseLong(str_uid), url, title, content, listVersion);
|
| | | pushService.pushUrl(Long.parseLong(str_uid), url, title, content, listIOS, listAndroid);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "newPushFanZNX")
|
| | | public void newPushFanZNX(String callback, String uids, String title, String content, String versions, PrintWriter out) {
|
| | | public void newPushFanZNX(String callback, String uids, String title, String content, String arrayIOS, |
| | | String arrayAndroid, PrintWriter out) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写标题与内容"));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | List<String> listVersion = null;
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | List<String> list = Arrays.asList(versions.split(","));
|
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | | listVersion = new ArrayList<String>();
|
| | | for (String version: list) {
|
| | | if (version != null && version.trim().length() > 0) {
|
| | | listVersion.add(version.trim());
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if (listVersion == null || listVersion.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("版本号格式不正确"));
|
| | | if ((arrayIOS == null || arrayIOS.trim().length() == 0)
|
| | | && (arrayAndroid == null || arrayAndroid.trim().length() == 0)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送版本不能为空"));
|
| | | return;
|
| | | }
|
| | | }
|
| | | |
| | | List<String> listIOS = convertList(arrayIOS);
|
| | | List<String> listAndroid = convertList(arrayAndroid);
|
| | |
|
| | | if (listuid == null) {
|
| | | // 全推
|
| | | pushService.pushZNX(null, title, content, listVersion);
|
| | | pushService.pushZNX(null, title, content, listIOS, listAndroid);
|
| | | } else {
|
| | | // 部分推送
|
| | | for (String str_uid: listuid) {
|
| | | if (str_uid != null && str_uid.trim().length() > 0) {
|
| | | pushService.pushZNX(Long.parseLong(str_uid), title, content, listVersion);
|
| | | pushService.pushZNX(Long.parseLong(str_uid), title, content, listIOS, listAndroid);
|
| | |
|
| | | userSystemMsgService.addUserSystemMsg(Long.parseLong(str_uid), UserSystemMsgTypeEnum.question,
|
| | | title, content, UserSystemMsg.TIME_TAG_EMERGENT, null);
|
| | |
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "pushBaiChuan")
|
| | | public void pushBaiChuan(String callback, String uids, String title, String content, String url, String versions, PrintWriter out) {
|
| | | public void pushBaiChuan(String callback, String uids, String title, String content, String url, String arrayIOS,
|
| | | String arrayAndroid, PrintWriter out) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写标题与内容"));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | List<String> listVersion = null;
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | List<String> list = Arrays.asList(versions.split(","));
|
| | | |
| | | if (list != null && list.size() > 0) {
|
| | | listVersion = new ArrayList<String>();
|
| | | for (String version: list) {
|
| | | if (version != null && version.trim().length() > 0) {
|
| | | listVersion.add(version.trim());
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if (listVersion == null || listVersion.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("版本号格式不正确"));
|
| | | if ((arrayIOS == null || arrayIOS.trim().length() == 0)
|
| | | && (arrayAndroid == null || arrayAndroid.trim().length() == 0)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送版本不能为空"));
|
| | | return;
|
| | | }
|
| | | }
|
| | | |
| | | List<String> listIOS = convertList(arrayIOS);
|
| | | List<String> listAndroid = convertList(arrayAndroid);
|
| | |
|
| | | if (listuid == null) {
|
| | | // 全推
|
| | | pushService.pushBaiChuanUrl(null, title, content, url, listVersion);
|
| | | pushService.pushBaiChuanUrl(null, title, content, url, listIOS, listAndroid);
|
| | | } else {
|
| | | // 部分推送
|
| | | for (String str_uid: listuid) {
|
| | | if (str_uid != null && str_uid.trim().length() > 0) {
|
| | | pushService.pushBaiChuanUrl(Long.parseLong(str_uid), title, content, url, listVersion);
|
| | | pushService.pushBaiChuanUrl(Long.parseLong(str_uid), title, content, url, listIOS, listAndroid);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 版本处理
|
| | | * @param array
|
| | | * @return
|
| | | */
|
| | | public List<String> convertList (String array) {
|
| | | Gson gson = new Gson();
|
| | | List<String> list = null;
|
| | | if (array == null || array.trim().length() == 0) {
|
| | | list = new ArrayList<String>(); // 长度为0 不推送
|
| | | } else {
|
| | | list = gson.fromJson(array, new TypeToken<ArrayList<String>>() {}.getType());
|
| | | if (list != null && list.size() > 0 && list.contains("全推")) {
|
| | | list = null; // 全推
|
| | | }
|
| | | }
|
| | | return list;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, PushCoupon pushCoupon, PrintWriter out) {
|
| | | public void save(String callback, PushCoupon pushCoupon, String arrayIOS, String arrayAndroid, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | convertVersion(pushCoupon, arrayIOS, arrayAndroid);
|
| | | |
| | | pushCouponService.save(pushCoupon);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
|
| | | } catch (PushCouponException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | |
| | | long receivedCount = pushCouponRecordService.countByPushId(pushCoupon.getId());
|
| | | pushCouponVO.setReceivedCount(receivedCount);
|
| | |
|
| | | convertVersionList(pushCouponVO);
|
| | | |
| | | |
| | | listVO.add(pushCouponVO);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 版本转换为list
|
| | | * @param pushGoods
|
| | | */
|
| | | public void convertVersionList(PushCouponVO pushCouponVO) {
|
| | | String versions = pushCouponVO.getVersions();
|
| | | List<String> listIOS = null;
|
| | | List<String> listAndroid = null;
|
| | | if (versions == null || versions.trim().length() == 0) {
|
| | | listIOS = new ArrayList<String>();
|
| | | listAndroid = new ArrayList<String>();
|
| | | } else {
|
| | | JSONObject json = JSONObject.fromObject(versions);
|
| | | |
| | | String versionsIOS = json.getString("IOS");
|
| | | if (versionsIOS != null && versionsIOS.trim().length() > 0) {
|
| | | listIOS = Arrays.asList(versionsIOS.split(","));
|
| | | }
|
| | | |
| | | String versionsAndroid = json.getString("Android");
|
| | | if (versionsAndroid != null && versionsAndroid.trim().length() > 0) {
|
| | | listAndroid = Arrays.asList(versionsAndroid.split(","));
|
| | | }
|
| | | }
|
| | | pushCouponVO.setListIOS(listIOS);
|
| | | pushCouponVO.setListAndroid(listAndroid);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 转换json
|
| | | * @param pushGoods
|
| | | */
|
| | | public void convertVersion(PushCoupon pushCoupon, String arrayIOS, String arrayAndroid) {
|
| | | |
| | | List<String> listIOS = convertList(arrayIOS);
|
| | | List<String> listAndroid = convertList(arrayAndroid);
|
| | | if ((listIOS == null || listIOS.size() == 0) && (listAndroid == null || listAndroid.size() == 0)) {
|
| | | return;
|
| | | }
|
| | | |
| | | JSONObject json = new JSONObject();
|
| | | if (listIOS != null && listIOS.size() > 0) {
|
| | | String versions = "";
|
| | | for (String version: listIOS) {
|
| | | versions += version + ",";
|
| | | }
|
| | | if (versions.endsWith(",")) {
|
| | | versions = versions.substring(0, versions.length() - 1);
|
| | | }
|
| | | json.put("IOS", versions);
|
| | | }
|
| | | |
| | | if (listAndroid != null && listAndroid.size() > 0) {
|
| | | String versions = "";
|
| | | for (String version: listAndroid) {
|
| | | versions += version + ",";
|
| | | }
|
| | | if (versions.endsWith(",")) {
|
| | | versions = versions.substring(0, versions.length() - 1);
|
| | | }
|
| | | json.put("Android", versions);
|
| | | }
|
| | | |
| | | pushCoupon.setVersions(json.toString());
|
| | | }
|
| | | |
| | | /**
|
| | | * 版本处理
|
| | | * @param array
|
| | | * @return
|
| | | */
|
| | | public List<String> convertList (String array) {
|
| | | Gson gson = new Gson();
|
| | | List<String> list = null;
|
| | | if (array != null && array.trim().length() > 0) {
|
| | | list = gson.fromJson(array, new TypeToken<ArrayList<String>>() {}.getType());
|
| | | }
|
| | | return list;
|
| | | }
|
| | | |
| | | }
|
| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/pushgoods")
|
| | | public class PushGoodsController {
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, PushGoods pushGoods, String idArray, PrintWriter out) {
|
| | | public void save(String callback, PushGoods pushGoods, String idArray, String arrayIOS, |
| | | String arrayAndroid, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | |
|
| | | convertVersion(pushGoods, arrayIOS, arrayAndroid);
|
| | |
|
| | | pushGoodsService.save(pushGoods, list);
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 版本处理
|
| | | convertVersionList(pushGoods);
|
| | | |
| | | List<TaoBaoGoodsBrief> listgoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | List<PushGoodsGroup> listGroup = pushGoodsGroupService.getAllInfoByPushId(pushGoods.getId());
|
| | |
| | | for (PushGoods pushGoods : list) {
|
| | | long countGoods = pushGoodsGroupService.countByPushId(pushGoods.getId());
|
| | | pushGoods.setCountGoods(countGoods);
|
| | | |
| | | // 版本处理
|
| | | convertVersionList(pushGoods);
|
| | | }
|
| | |
|
| | | long count = pushGoodsService.countQuery(key, state);
|
| | |
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 转换json
|
| | | * @param pushGoods
|
| | | */
|
| | | public void convertVersion(PushGoods pushGoods, String arrayIOS, String arrayAndroid) {
|
| | |
|
| | | List<String> listIOS = convertList(arrayIOS);
|
| | | List<String> listAndroid = convertList(arrayAndroid);
|
| | | if ((listIOS == null || listIOS.size() == 0) && (listAndroid == null || listAndroid.size() == 0)) {
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | if (listIOS != null && listIOS.size() > 0) {
|
| | | String versions = "";
|
| | | for (String version: listIOS) {
|
| | | versions += version + ",";
|
| | | }
|
| | | if (versions.endsWith(",")) {
|
| | | versions = versions.substring(0, versions.length() - 1);
|
| | | }
|
| | | |
| | | json.put("IOS", versions);
|
| | | }
|
| | | if (listAndroid != null && listAndroid.size() > 0) {
|
| | | String versions = "";
|
| | | for (String version: listAndroid) {
|
| | | versions += version + ",";
|
| | | }
|
| | | if (versions.endsWith(",")) {
|
| | | versions = versions.substring(0, versions.length() - 1);
|
| | | }
|
| | | |
| | | json.put("Android", versions);
|
| | | }
|
| | | pushGoods.setVersions(json.toString());
|
| | | }
|
| | | |
| | | /**
|
| | | * 版本处理
|
| | | * @param array
|
| | | * @return
|
| | | */
|
| | | public List<String> convertList (String array) {
|
| | | Gson gson = new Gson();
|
| | | List<String> list = null;
|
| | | if (array != null && array.trim().length() > 0) {
|
| | | list = gson.fromJson(array, new TypeToken<ArrayList<String>>() {}.getType());
|
| | | }
|
| | | return list;
|
| | | }
|
| | | |
| | | /**
|
| | | * 版本转换为list
|
| | | * @param pushGoods
|
| | | */
|
| | | public void convertVersionList(PushGoods pushGoods) {
|
| | | String versions = pushGoods.getVersions();
|
| | | List<String> listIOS = null;
|
| | | List<String> listAndroid = null;
|
| | | if (versions == null || versions.trim().length() == 0) {
|
| | | listIOS = new ArrayList<String>();
|
| | | listAndroid = new ArrayList<String>();
|
| | | } else {
|
| | | JSONObject json = JSONObject.fromObject(versions);
|
| | | |
| | | String versionsIOS = json.getString("IOS");
|
| | | if (versionsIOS != null && versionsIOS.trim().length() > 0) {
|
| | | listIOS = Arrays.asList(versionsIOS.split(","));
|
| | | }
|
| | | |
| | | String versionsAndroid = json.getString("Android");
|
| | | if (versionsAndroid != null && versionsAndroid.trim().length() > 0) {
|
| | | listAndroid = Arrays.asList(versionsAndroid.split(","));
|
| | | }
|
| | | }
|
| | | pushGoods.setListIOS(listIOS);
|
| | | pushGoods.setListAndroid(listAndroid);
|
| | | }
|
| | | }
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.clazz.ClassRecommendGoods;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.ClassRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | |
| | |
|
| | | @Resource
|
| | | private GoodsSecondClassService goodsSecondClassService;
|
| | |
|
| | | @Resource
|
| | | private ClassRecommendGoodsService classRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private GoodsClassService goodsClassService;
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getclassrecommendgoods", method = RequestMethod.POST)
|
| | | public void getClassRecommendGoods(AcceptData acceptData, long goodsClassId, PrintWriter out) {
|
| | | List<ClassRecommendGoods> classRecommendGoodsList = classRecommendGoodsService
|
| | | .getClassRecommendGoodsByGoodsClassId(goodsClassId);
|
| | | if (classRecommendGoodsList == null) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", classRecommendGoodsList.size());
|
| | | data.put("classRecommendGoodsList", JsonUtil.getApiCommonGson().toJson(classRecommendGoodsList));
|
| | | String result = JsonUtil.loadTrueResult(data);
|
| | | out.print(result);
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getCouponGoods", method = RequestMethod.POST)
|
| | | public void getCouponGoods(AcceptData acceptData, int page, long gcid, PrintWriter out) {
|
| | |
| | | import com.yeshi.fanli.entity.bus.recommend.Honest;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendBanner;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendBannerV2;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSpecial;
|
| | | import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendBanner;
|
| | | import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendBannerV2;
|
| | | import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSpecial;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.ShamUser;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendBannerService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendBannerService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendBannerV2Service;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.factory.MonitorFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoCouponUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
| | | @Resource
|
| | | private SuperRecommendSpecialService superRecommendSpecialService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @RequestMapping(value = "getrecommendsection")
|
| | | public void getRecommendSection(AcceptData acceptData, int index, PrintWriter out) {
|
| | |
|
| | | if (index < 0) {
|
| | | index = 0;
|
| | | }
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统不存在"));
|
| | | return;
|
| | | }
|
| | | List<SuperRecommendSection> superRecommendSectionList = superRecommendSectionService
|
| | | .getSuperRecommendSectionBySystemId(system.getId());
|
| | | List<RecommendSection> recommendSectionList = null;
|
| | | for (SuperRecommendSection superRecommendSection : superRecommendSectionList) {
|
| | | if (recommendSectionList == null) {
|
| | | recommendSectionList = new ArrayList<RecommendSection>();
|
| | | }
|
| | | RecommendSection recommendSection = superRecommendSection.getRecommendSection();
|
| | |
|
| | | // 暂时改变淘特价的跳转地址
|
| | | if (system.getId() == 7) {
|
| | | recommendSection.setJumpUrl(recommendSection.getJumpUrl().replace("column.html", "column_ttj.html"));
|
| | | }
|
| | |
|
| | | recommendSectionList.add(recommendSection);
|
| | | }
|
| | | if (recommendSectionList == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "暂无数据"));
|
| | | return;
|
| | | }
|
| | | Utils.sort(recommendSectionList);
|
| | | int size = recommendSectionList.size();
|
| | |
|
| | | List<RecommendSectionGoods> recommendSectionGoodsList = null;
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", size);
|
| | | JSONArray dataArr = new JSONArray();
|
| | | JSONObject validData = null;
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | Map<Long, List<RecommendSectionGoods>> map = recommendSectionGoodsService.getAllSectionGoodsMap();
|
| | | for (int i = 0; i < size; i++) {
|
| | | validData = new JSONObject();
|
| | | RecommendSection recommendSection = recommendSectionList.get(i);
|
| | | recommendSectionGoodsList = map.get(recommendSection.getId());
|
| | | if (recommendSectionGoodsList == null) {
|
| | | continue;
|
| | | }
|
| | | Utils.sort(recommendSectionGoodsList);
|
| | | if (recommendSection.getCounts() < recommendSectionGoodsList.size()) {
|
| | | recommendSectionGoodsList = recommendSectionGoodsList.subList(0, recommendSection.getCounts());
|
| | | }
|
| | | validData.put("count", recommendSectionGoodsList.size());
|
| | | validData.put("recommendSection", gson.toJson(recommendSection));
|
| | |
|
| | | // 替换TaoBaoGoodsBrief
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson2 = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
|
| | | for (RecommendSectionGoods rss : recommendSectionGoodsList) {
|
| | | JSONObject obj = JSONObject.fromObject(gson2.toJson(rss));
|
| | | String json = gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(
|
| | | gson2.fromJson(obj.optJSONObject("taoBaoGoodsBrief").toString(), TaoBaoGoodsBrief.class),
|
| | | proportion.toString(), ""));
|
| | | obj.put("taoBaoGoodsBrief", json);
|
| | | array.add(obj);
|
| | | }
|
| | |
|
| | | validData.put("recommendSectionGoodsList", array);
|
| | | dataArr.add(validData);
|
| | | }
|
| | | data.put("data", dataArr);
|
| | |
|
| | | String result = JsonUtil.loadTrueResult(data);
|
| | | if (Constant.IS_OUTNET)
|
| | | redisManager.cacheCommonString("client-api-getRecommendSection", result, 3 * 60);
|
| | |
|
| | | out.print(result);
|
| | | return;
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getHonestList")
|
| | | public void getHonestList(AcceptData acceptData, PrintWriter out) {
|
| | |
| | |
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | recommendSectionGoodsService.deleteRecommendSectionGoodsByTbAuctionId(Long.parseLong(id));
|
| | | }
|
| | | });
|
| | | }
|
| | | long end = java.lang.System.currentTimeMillis();
|
| | | java.lang.System.out.println("耗时:" + (end - begin));
|
| | |
| | | if (goodsList.size() < 6)
|
| | | goodsList.add(gds);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 需要另做推荐
|
| | | if (goodsList.size() < 6) {
|
| | | List<RecommendSectionGoods> list = recommendSectionGoodsService.getSectionGoods(10);
|
| | | if (list != null)
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (goodsList.size() < 6)
|
| | | goodsList.add(list.get(i).getTaoBaoGoodsBrief());
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendBanner;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory;
|
| | | import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendBanner;
|
| | | import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSection;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.TBPid;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendBannerService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendSectionService;
|
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 推荐商品列表
|
| | | * |
| | | * @author mawurui createTime 2018年5月11日 上午11:26:03
|
| | | * @param acceptData
|
| | | * @param index
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRecommendSection", method = RequestMethod.GET)
|
| | | public void getRecommendSection(AcceptData acceptData, String callback, PrintWriter out) {
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystem("WEB", Constant.systemCommonConfig.getH5PackageName());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, H5ControllerUtil.NOSYSTEM));
|
| | | return;
|
| | | }
|
| | | List<SuperRecommendSection> superRecommendSectionList = superRecommendSectionService
|
| | | .getSuperRecommendSectionBySystemId(system.getId());
|
| | | List<RecommendSection> recommendSectionList = null;
|
| | | for (SuperRecommendSection superRecommendSection : superRecommendSectionList) {
|
| | | if (recommendSectionList == null) {
|
| | | recommendSectionList = new ArrayList<RecommendSection>();
|
| | | }
|
| | | RecommendSection recommendSection = superRecommendSection.getRecommendSection();
|
| | |
|
| | | // 暂时改变淘特价的跳转地址
|
| | | if (system.getId() == 7) {
|
| | | recommendSection.setJumpUrl(recommendSection.getJumpUrl().replace("column.html", "column_ttj.html"));
|
| | | }
|
| | |
|
| | | recommendSectionList.add(recommendSection);
|
| | | }
|
| | | if (recommendSectionList == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, H5ControllerUtil.NODATA));
|
| | | return;
|
| | | }
|
| | | Utils.sort(recommendSectionList);
|
| | | int size = recommendSectionList.size();
|
| | |
|
| | | List<RecommendSectionGoods> recommendSectionGoodsList = null;
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", size);
|
| | | JSONArray dataArr = new JSONArray();
|
| | | JSONObject validData = null;
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | Map<Long, List<RecommendSectionGoods>> map = recommendSectionGoodsService.getAllSectionGoodsMap();
|
| | | for (int i = 0; i < size; i++) {
|
| | | validData = new JSONObject();
|
| | | RecommendSection recommendSection = recommendSectionList.get(i);
|
| | | recommendSectionGoodsList = map.get(recommendSection.getId());
|
| | | if (recommendSectionGoodsList == null) {
|
| | | continue;
|
| | | }
|
| | | Utils.sort(recommendSectionGoodsList);
|
| | | if (recommendSection.getCounts() < recommendSectionGoodsList.size()) {
|
| | | recommendSectionGoodsList = recommendSectionGoodsList.subList(0, recommendSection.getCounts());
|
| | | }
|
| | | validData.put("count", recommendSectionGoodsList.size());
|
| | | validData.put("recommendSection", gson.toJson(recommendSection));
|
| | |
|
| | | // 替换TaoBaoGoodsBrief
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson2 = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
|
| | | for (RecommendSectionGoods rss : recommendSectionGoodsList) {
|
| | | JSONObject obj = JSONObject.fromObject(gson2.toJson(rss));
|
| | | String json = gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(
|
| | | gson2.fromJson(obj.optJSONObject("taoBaoGoodsBrief").toString(), TaoBaoGoodsBrief.class),
|
| | | proportion.toString(), ""));
|
| | | obj.put("taoBaoGoodsBrief", json);
|
| | | array.add(obj);
|
| | | }
|
| | |
|
| | | validData.put("recommendSectionGoodsList", array);
|
| | | dataArr.add(validData);
|
| | | }
|
| | | data.put("data", dataArr);
|
| | |
|
| | | String result = JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data));
|
| | | if (Constant.IS_OUTNET)
|
| | | redisManager.cacheCommonString("client-api-getRecommendSection", result, 3 * 60);
|
| | |
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(result)));
|
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | package com.yeshi.fanli.controller.web;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendBanner;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendBanner;
|
| | | import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSection;
|
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendBannerService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendSectionService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 推荐商品列表
|
| | | * |
| | | * @author mawurui createTime 2018年5月11日 上午11:26:03
|
| | | * @param acceptData
|
| | | * @param index
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getRecommendSection", method = RequestMethod.GET)
|
| | | public void getRecommendSection(AcceptData acceptData, String callback, PrintWriter out) {
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystem("WEB", Constant.systemCommonConfig.getH5PackageName());
|
| | | if (system == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NOSYSTEM));
|
| | | return;
|
| | | }
|
| | | List<SuperRecommendSection> superRecommendSectionList = superRecommendSectionService
|
| | | .getSuperRecommendSectionBySystemId(system.getId());
|
| | | List<RecommendSection> recommendSectionList = null;
|
| | | for (SuperRecommendSection superRecommendSection : superRecommendSectionList) {
|
| | | if (recommendSectionList == null) {
|
| | | recommendSectionList = new ArrayList<RecommendSection>();
|
| | | }
|
| | | RecommendSection recommendSection = superRecommendSection.getRecommendSection();
|
| | |
|
| | | // 暂时改变淘特价的跳转地址
|
| | | if (system.getId() == 7) {
|
| | | recommendSection.setJumpUrl(recommendSection.getJumpUrl().replace("column.html", "column_ttj.html"));
|
| | | }
|
| | |
|
| | | recommendSectionList.add(recommendSection);
|
| | | }
|
| | | if (recommendSectionList == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, WebControllerUtil.NODATA));
|
| | | return;
|
| | | }
|
| | | Utils.sort(recommendSectionList);
|
| | | int size = recommendSectionList.size();
|
| | |
|
| | | List<RecommendSectionGoods> recommendSectionGoodsList = null;
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", size);
|
| | | JSONArray dataArr = new JSONArray();
|
| | | JSONObject validData = null;
|
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | Map<Long, List<RecommendSectionGoods>> map = recommendSectionGoodsService.getAllSectionGoodsMap();
|
| | | for (int i = 0; i < size; i++) {
|
| | | validData = new JSONObject();
|
| | | RecommendSection recommendSection = recommendSectionList.get(i);
|
| | | recommendSectionGoodsList = map.get(recommendSection.getId());
|
| | | if (recommendSectionGoodsList == null) {
|
| | | continue;
|
| | | }
|
| | | Utils.sort(recommendSectionGoodsList);
|
| | | if (recommendSection.getCounts() < recommendSectionGoodsList.size()) {
|
| | | recommendSectionGoodsList = recommendSectionGoodsList.subList(0, recommendSection.getCounts());
|
| | | }
|
| | | validData.put("count", recommendSectionGoodsList.size());
|
| | | validData.put("recommendSection", gson.toJson(recommendSection));
|
| | |
|
| | | // 替换TaoBaoGoodsBrief
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson2 = new GsonBuilder().setDateFormat("yyyy-MM-dd").create();
|
| | | for (RecommendSectionGoods rss : recommendSectionGoodsList) {
|
| | | JSONObject obj = JSONObject.fromObject(gson2.toJson(rss));
|
| | | String json = gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(
|
| | | gson2.fromJson(obj.optJSONObject("taoBaoGoodsBrief").toString(), TaoBaoGoodsBrief.class),
|
| | | proportion.toString(), ""));
|
| | | obj.put("taoBaoGoodsBrief", json);
|
| | | array.add(obj);
|
| | | }
|
| | |
|
| | | validData.put("recommendSectionGoodsList", array);
|
| | | dataArr.add(validData);
|
| | | }
|
| | | data.put("data", dataArr);
|
| | |
|
| | | String result = JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data));
|
| | | if (Constant.IS_OUTNET)
|
| | | redisManager.cacheCommonString("client-api-getRecommendSection", result, 3 * 60);
|
| | |
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(result)));
|
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | |
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | recommendSectionGoodsService.deleteRecommendSectionGoodsByTbAuctionId(Long.parseLong(id));
|
| | | ;
|
| | | }
|
| | | });
|
| | | }
|
| | | long end = java.lang.System.currentTimeMillis();
|
| | | java.lang.System.out.println("耗时:" + (end - begin));
|
| | |
| | | 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.controller.client.SearchController;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.clazz.ClassRecommendGoods;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass;
|
| | | import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoCoupon;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.ClassRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService;
|
| | |
| | |
|
| | | @Resource
|
| | | private GoodsSecondClassService goodsSecondClassService;
|
| | |
|
| | | @Resource
|
| | | private ClassRecommendGoodsService classRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private GoodsClassService goodsClassService;
|
| | |
| | | out.print(result);
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 推荐商品获取
|
| | | * |
| | | * @author mawurui createTime 2018年4月25日 下午5:25:34
|
| | | * @param acceptData
|
| | | * @param goodsClassId
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getclassrecommendgoods", method = RequestMethod.POST)
|
| | | public void getClassRecommendGoods(AcceptData acceptData, long goodsClassId, PrintWriter out) {
|
| | | List<ClassRecommendGoods> classRecommendGoodsList = classRecommendGoodsService
|
| | | .getClassRecommendGoodsByGoodsClassId(goodsClassId);
|
| | | if (classRecommendGoodsList == null) {
|
| | | out.print(JsonUtil.loadFalseResult(XcxMiniControllerUtil.NODATA));
|
| | | return;
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", classRecommendGoodsList.size());
|
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
| | | data.put("classRecommendGoodsList", gson.toJson(classRecommendGoodsList));
|
| | | String result = JsonUtil.loadTrueResult(data);
|
| | | out.print(result);
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | |
| | | int updateByPrimaryKey(DeviceTokenIOS record); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.entity.push;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
| | | private String picture;
|
| | |
|
| | | // 推送用户id 使用于单推
|
| | | // @Column(name = "pg_uid")
|
| | | @Column(name = "pg_uid")
|
| | | private Long uid;
|
| | |
|
| | | @Column(name = "pg_versions")
|
| | |
| | |
|
| | | // 统计商品数量
|
| | | private Long countGoods;
|
| | | |
| | | // ios推送版本
|
| | | private List<String> listIOS;
|
| | | // Android推送版本
|
| | | private List<String> listAndroid;
|
| | |
|
| | | public PushGoods(){}
|
| | |
|
| | |
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public List<String> getListIOS() {
|
| | | return listIOS;
|
| | | }
|
| | |
|
| | | public void setListIOS(List<String> listIOS) {
|
| | | this.listIOS = listIOS;
|
| | | }
|
| | |
|
| | | public List<String> getListAndroid() {
|
| | | return listAndroid;
|
| | | }
|
| | |
|
| | | public void setListAndroid(List<String> listAndroid) {
|
| | | this.listAndroid = listAndroid;
|
| | | }
|
| | | }
|
| | |
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.ActivityException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | /**
|
| | | * 淘宝商品更细
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private ActivityService activityService;
|
| | |
| | | @Resource
|
| | | private QualityFlashSaleService qualityFlashSaleService;
|
| | |
|
| | |
|
| | | @Scheduled(cron = "0 0 0 * * ?")
|
| | | public void doJob() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | taoBaoGoodsBriefService.getUpdateTaoBao();
|
| | | }
|
| | |
|
| | | // 两小时执行一次 对推荐商品信息进行更新
|
| | | @Scheduled(cron = "0 0 */2 * * ?")
|
| | | public void doUpdateJob() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | List<RecommendSectionGoods> list = taoBaoGoodsBriefService.listRecommendSectionGoods();
|
| | | for (RecommendSectionGoods recommendSectionGoods : list) {
|
| | | try {
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil
|
| | | .searchGoodsDetail(recommendSectionGoods.getTaoBaoGoodsBrief().getAuctionId());
|
| | | taoBaoGoodsUpdateService.updateTaoBaoGoods(goods);
|
| | | } catch (TaobaoGoodsDownException e1) {
|
| | | taoBaoGoodsUpdateService. offlineTaoBaoGoods(recommendSectionGoods.getTaoBaoGoodsBrief().getAuctionId());
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 动态商品更新 ,1个小时更新
|
| | | @Scheduled(cron = "0 0 */1 * * ?")
|
| | |
| | | <result column="pg_title" property="title" jdbcType="VARCHAR"/> |
| | | <result column="pg_content" property="content" jdbcType="VARCHAR"/> |
| | | <result column="pg_picture" property="picture" jdbcType="VARCHAR"/> |
| | | <result column="pg_uid" property="uid" jdbcType="BIGINT"/>
|
| | | <result column="pg_versions" property="versions" jdbcType="VARCHAR"/> |
| | | <result column="pg_is_push" property="isPush" jdbcType="VARCHAR"/> |
| | | <result column="pg_push_time" property="pushTime" jdbcType="TIMESTAMP"/> |
| | | <result column="pg_createtime" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="pg_updatetime" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">pg_id,pg_alert_title,pg_alert_content,pg_title,pg_content,pg_picture,pg_versions,pg_is_push,pg_push_time,pg_createtime,pg_updatetime</sql> |
| | | <sql id="Base_Column_List">pg_id,pg_alert_title,pg_alert_content,pg_title,pg_content,pg_picture,pg_uid,pg_versions,pg_is_push,pg_push_time,pg_createtime,pg_updatetime</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_push_goods where pg_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_goods where pg_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods (pg_id,pg_alert_title,pg_alert_content,pg_title,pg_content,pg_picture,pg_versions,pg_is_push,pg_push_time,pg_createtime,pg_updatetime) values (#{id,jdbcType=BIGINT},#{alertTitle,jdbcType=VARCHAR},#{alertContent,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{versions,jdbcType=VARCHAR},#{isPush,jdbcType=VARCHAR},#{pushTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods (pg_id,pg_alert_title,pg_alert_content,pg_title,pg_content,pg_picture,pg_uid,pg_versions,pg_is_push,pg_push_time,pg_createtime,pg_updatetime) values (#{id,jdbcType=BIGINT},#{alertTitle,jdbcType=VARCHAR},#{alertContent,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{versions,jdbcType=VARCHAR},#{isPush,jdbcType=VARCHAR},#{pushTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">pg_id,</if> |
| | |
| | | <if test="title != null">pg_title,</if> |
| | | <if test="content != null">pg_content,</if> |
| | | <if test="picture != null">pg_picture,</if> |
| | | <if test="uid != null">pg_uid,</if>
|
| | | <if test="versions != null">pg_versions,</if> |
| | | <if test="isPush != null">pg_is_push,</if> |
| | | <if test="pushTime != null">pg_push_time,</if> |
| | |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="content != null">#{content,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="versions != null">#{versions,jdbcType=VARCHAR},</if> |
| | | <if test="isPush != null">#{isPush,jdbcType=VARCHAR},</if> |
| | | <if test="pushTime != null">#{pushTime,jdbcType=TIMESTAMP},</if> |
| | |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.PushGoods">update yeshi_ec_push_goods set pg_alert_title = #{alertTitle,jdbcType=VARCHAR},pg_alert_content = #{alertContent,jdbcType=VARCHAR},pg_title = #{title,jdbcType=VARCHAR},pg_content = #{content,jdbcType=VARCHAR},pg_picture = #{picture,jdbcType=VARCHAR},pg_versions = #{versions,jdbcType=VARCHAR},pg_is_push = #{isPush,jdbcType=VARCHAR},pg_push_time = #{pushTime,jdbcType=TIMESTAMP},pg_createtime = #{createTime,jdbcType=TIMESTAMP},pg_updatetime = #{updateTime,jdbcType=TIMESTAMP} where pg_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.PushGoods">update yeshi_ec_push_goods set pg_alert_title = #{alertTitle,jdbcType=VARCHAR},pg_alert_content = #{alertContent,jdbcType=VARCHAR},pg_title = #{title,jdbcType=VARCHAR},pg_content = #{content,jdbcType=VARCHAR},pg_picture = #{picture,jdbcType=VARCHAR},pg_uid = #{uid,jdbcType=BIGINT},pg_versions = #{versions,jdbcType=VARCHAR},pg_is_push = #{isPush,jdbcType=VARCHAR},pg_push_time = #{pushTime,jdbcType=TIMESTAMP},pg_createtime = #{createTime,jdbcType=TIMESTAMP},pg_updatetime = #{updateTime,jdbcType=TIMESTAMP} where pg_id = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushGoods">update yeshi_ec_push_goods |
| | | <set> |
| | | <if test="alertTitle != null">pg_alert_title=#{alertTitle,jdbcType=VARCHAR},</if> |
| | |
| | | <if test="title != null">pg_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="content != null">pg_content=#{content,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">pg_picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="uid != null">pg_uid=#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="versions != null">pg_versions=#{versions,jdbcType=VARCHAR},</if> |
| | | <if test="isPush != null">pg_is_push=#{isPush,jdbcType=VARCHAR},</if> |
| | | <if test="pushTime != null">pg_push_time=#{pushTime,jdbcType=TIMESTAMP},</if> |
| | |
| | | close=")">#{item}</foreach> |
| | | </select> |
| | | </mapper> |
| | |
|
| | |
| | |
|
| | | return listVersionCode;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<AppVersionInfo> listByPlatformAndMinVersionCode(String platform, int versionCode) {
|
| | | return appVersionInfoMapper.listByPlatformAndMinVersionCode(platform, versionCode);
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.ClassRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | |
| | |
|
| | | @Resource
|
| | | private SuperGoodsClassService superGoodsClassService;
|
| | |
|
| | | @Resource
|
| | | private ClassRecommendGoodsService classRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private GoodsSecondClassService goodsSecondClassService;
|
| | |
| | | public void deleteGoodsClasss(long[] gcids) {
|
| | | for (long id : gcids) {
|
| | | superGoodsClassService.deleteSuperGoodsClass(id);
|
| | | classRecommendGoodsService.deleteClassGoodsByGC(id);
|
| | | goodsSecondClassService.deleteSecondClassByGC(id);
|
| | | goodsClassDao.delete(new GoodsClass(id));
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionDetailService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperRecommendSectionService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | @Resource
|
| | | private SuperRecommendSectionService superRecommendSectionService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private BusinessSystemService businessSystemService;
|
| | |
| | | public void deleteSections(final long[] rsids) {
|
| | |
|
| | | superRecommendSectionService.deleteSuperRecommendSections(rsids);
|
| | | recommendSectionGoodsService.deleteSectionGoodsBySections(rsids);
|
| | | recommendSectionDetailService.deleteSectionDetailBySections(rsids);
|
| | | recommendSectionDao.excute(new HibernateCallback() {
|
| | | public Object doInHibernate(Session session)
|
| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.transaction.Transactional;
|
| | |
|
| | | import org.hibernate.HibernateException;
|
| | | import org.hibernate.Query;
|
| | | import org.hibernate.Session;
|
| | | import org.springframework.orm.hibernate4.HibernateCallback;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.goods.RecommendSectionGoodsDao;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper;
|
| | | import com.yeshi.fanli.dao.taobao.TaoBaoGoodsBriefDao;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TBPid;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.ExistObjectException;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.exception.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.service.inter.goods.ClassRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
| | | public class TaoBaoGoodsBriefServiceImpl implements TaoBaoGoodsBriefService {
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefDao taoBaoGoodsBriefDao;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsDao recommendSectionGoodsDao;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionService recommendSectionService;
|
| | |
|
| | | @Resource
|
| | | private ClassRecommendGoodsService classRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private GoodsClassService goodsClassService;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoCouponService taoBaoCouponService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefMapper taoBaoGoodsBriefMapper;
|
| | |
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
|
| | | public void save(TaoBaoGoodsBrief taoBaoGoodsBrief) throws ExistObjectException {
|
| | |
|
| | | long auctionId = taoBaoGoodsBrief.getAuctionId();
|
| | | List<TaoBaoGoodsBrief> list = taoBaoGoodsBriefDao.list("from TaoBaoGoodsBrief tb where tb.auctionId = ?",
|
| | | new Serializable[] { auctionId });
|
| | | if (list.size() > 0) {
|
| | | throw new ExistObjectException("已存在该商品");
|
| | | }
|
| | |
|
| | | taoBaoGoodsBrief.setCreatetime(new Date());
|
| | | taoBaoGoodsBriefDao.create(taoBaoGoodsBrief);
|
| | | }
|
| | |
|
| | | public List<TaoBaoGoodsBrief> getTBList(int index, String key) {
|
| | |
|
| | | int start = index * Constant.PAGE_SIZE;
|
| | |
|
| | | boolean b = NumberUtil.isNumeric(key);
|
| | | if (b) {
|
| | | return taoBaoGoodsBriefDao.list(
|
| | | "from TaoBaoGoodsBrief tb where tb.title like ? or tb.auctionId = ? order by tb.id desc", start,
|
| | | Constant.PAGE_SIZE, new Serializable[] { "%" + key + "%", Long.parseLong(key) });
|
| | | } else {
|
| | | return taoBaoGoodsBriefDao.list("from TaoBaoGoodsBrief tb where tb.title like ? order by tb.id desc", start,
|
| | | Constant.PAGE_SIZE, new Serializable[] { "%" + key + "%" });
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public int getCount(String key) {
|
| | | boolean b = NumberUtil.isNumeric(key);
|
| | | Long lcount = 0L;
|
| | | if (b) {
|
| | | lcount = taoBaoGoodsBriefDao.getCount(
|
| | | "select count(*) from TaoBaoGoodsBrief tb where tb.title like ? or tb.auctionId = ? ",
|
| | | new Serializable[] { "%" + key + "%", Long.parseLong(key) });
|
| | | } else {
|
| | | lcount = taoBaoGoodsBriefDao.getCount("select count(*) from TaoBaoGoodsBrief tb where tb.title like ? ",
|
| | | new Serializable[] { "%" + key + "%" });
|
| | | }
|
| | |
|
| | | return lcount.intValue();
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBao(long id) {
|
| | |
|
| | | return taoBaoGoodsBriefDao.find(TaoBaoGoodsBrief.class, id);
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBaoByAuctionId(long id) {
|
| | | List<TaoBaoGoodsBrief> list = taoBaoGoodsBriefDao
|
| | | .list("from TaoBaoGoodsBrief goods where goods.auctionId=" + id);
|
| | | if (list == null || list.size() == 0)
|
| | | return null;
|
| | | else
|
| | | return list.get(0);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public void deleteTaoBaoGoods(final long id) {
|
| | | taoBaoGoodsBriefDao.excute(new HibernateCallback() {
|
| | |
|
| | | public Object doInHibernate(Session session) throws HibernateException {
|
| | | recommendSectionGoodsService.deleteRecommendSectionGoodsByTB(id);
|
| | | classRecommendGoodsService.deleteRecommendGoodsByTB(id);
|
| | | Query query = session.createQuery("delete from TaoBaoGoodsBrief tb where tb.id = ?");
|
| | | query.setParameter(0, id);
|
| | | return query.executeUpdate();
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public void addRecommendSectionGoods(long rsid, long tbid) throws NotExistObjectException, ExistObjectException {
|
| | | RecommendSection recommendSection = recommendSectionService.getRecommendSection(rsid);
|
| | | TaoBaoGoodsBrief taobao = taoBaoGoodsBriefDao.find(TaoBaoGoodsBrief.class, tbid);
|
| | | if (recommendSection == null || taobao == null) {
|
| | | throw new NotExistObjectException("不存在该板块或者淘宝商品");
|
| | | }
|
| | | recommendSectionGoodsService.addRecommendSectionGoods(recommendSection, taobao);
|
| | | }
|
| | |
|
| | |
|
| | | @Transactional
|
| | | public void addClassRecommendGoods(long gcid, long tbid) throws NotExistObjectException, ExistObjectException {
|
| | | GoodsClass goodsClass = goodsClassService.getGoodsClass(gcid);
|
| | | TaoBaoGoodsBrief taobao = taoBaoGoodsBriefDao.find(TaoBaoGoodsBrief.class, tbid);
|
| | | if (goodsClass == null || taobao == null) {
|
| | | throw new NotExistObjectException("不存在该分类或者淘宝商品");
|
| | | }
|
| | | classRecommendGoodsService.addRecommendGoods(goodsClass, taobao);
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBaoByAuctionId(String tbid) {
|
| | | List<TaoBaoGoodsBrief> list = taoBaoGoodsBriefDao.list("from TaoBaoGoodsBrief tb where tb.auctionId=?",
|
| | | new Serializable[] { Long.parseLong(tbid) });
|
| | | if (list.size() == 0) {
|
| | | return null;
|
| | | }
|
| | | return list.get(0);
|
| | | }
|
| | |
|
| | | public void updateTBGoods(TaoBaoGoodsBrief tb) throws NotExistObjectException {
|
| | | TaoBaoGoodsBrief find = taoBaoGoodsBriefDao.find(TaoBaoGoodsBrief.class, tb.getId());
|
| | | if (find == null) {
|
| | | throw new NotExistObjectException("不存在该对象");
|
| | | }
|
| | | find.setPictUrl(tb.getPictUrl());
|
| | | find.setTitle(tb.getTitle());
|
| | | taoBaoGoodsBriefDao.update(find);
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | public List<TaoBaoGoodsBrief> getAllTaoBao() {
|
| | | return (List<TaoBaoGoodsBrief>) taoBaoGoodsBriefDao.excute(new HibernateCallback<List<TaoBaoGoodsBrief>>() {
|
| | |
|
| | | public List<TaoBaoGoodsBrief> doInHibernate(Session session) throws HibernateException {
|
| | | Query query = session.createQuery("from TaoBaoGoodsBrief ");
|
| | | return query.list();
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | public void getUpdateTaoBao() {
|
| | | List<TaoBaoGoodsBrief> list = getAllTaoBao();
|
| | | int len = list.size();
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : list) {
|
| | | try {
|
| | | Thread.sleep(2000);
|
| | | } catch (InterruptedException e) {
|
| | | continue;
|
| | | }
|
| | | try {
|
| | | updateTaoBaoGoods(taoBaoGoodsBrief);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | len--;
|
| | | System.out.println("还剩:" + len + "个商品未更新");
|
| | | }
|
| | | return;
|
| | | }
|
| | |
|
| | | public void updateTaoBaoGoods(TaoBaoGoodsBrief taoBaoGoodsBrief) throws TaobaoGoodsDownException {
|
| | |
|
| | | SearchFilter filter = new SearchFilter();
|
| | | filter.setKey("https://item.taobao.com/item.htm?id=" + taoBaoGoodsBrief.getAuctionId());
|
| | | TaoBaoGoodsBrief tb = TaoKeApiUtil.searchGoodsDetail(taoBaoGoodsBrief.getAuctionId());
|
| | | if (tb == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | taoBaoGoodsBrief.setCouponLink(tb.getCouponLink());
|
| | | taoBaoGoodsBrief.setCouponActivityId(tb.getCouponActivityId());
|
| | | taoBaoGoodsBrief.setCouponAmount(tb.getCouponAmount());
|
| | | taoBaoGoodsBrief.setCouponEffectiveStartTime(tb.getCouponEffectiveStartTime());
|
| | | taoBaoGoodsBrief.setCouponEffectiveEndTime(tb.getCouponEffectiveEndTime());
|
| | | taoBaoGoodsBrief.setCouponInfo(tb.getCouponInfo());
|
| | | taoBaoGoodsBrief.setCouponLeftCount(tb.getCouponLeftCount());
|
| | | taoBaoGoodsBrief.setCouponLinkTaoToken(tb.getCouponLinkTaoToken());
|
| | | taoBaoGoodsBrief.setCouponOriLink(tb.getCouponOriLink());
|
| | | taoBaoGoodsBrief.setCouponShortLink(tb.getCouponShortLink());
|
| | | taoBaoGoodsBrief.setCouponStartFee(tb.getCouponStartFee());
|
| | | taoBaoGoodsBrief.setCouponTotalCount(tb.getCouponTotalCount());
|
| | | taoBaoGoodsBrief.setBiz30day(tb.getBiz30day());
|
| | | taoBaoGoodsBrief.setTkRate(tb.getTkRate());
|
| | | taoBaoGoodsBrief.setZkPrice(tb.getZkPrice());
|
| | | taoBaoGoodsBrief.setEventRate(tb.getEventRate());
|
| | | taoBaoGoodsBrief.setTkMktStatus(tb.getTkMktStatus());
|
| | | taoBaoGoodsBrief.setReservePrice(tb.getReservePrice());
|
| | |
|
| | | taoBaoGoodsBrief.setCreatetime(new Date());
|
| | | taoBaoGoodsBriefDao.update(taoBaoGoodsBrief);
|
| | |
|
| | | }
|
| | |
|
| | | public int getInvalidCount() {
|
| | | Long count = taoBaoGoodsBriefDao.getCount("select count(tb.id) from TaoBaoGoodsBrief tb where tb.tkRate = 0");
|
| | | return count.intValue();
|
| | | }
|
| | |
|
| | | public List<TaoBaoGoodsBrief> getInvalidTB(int pageIndex) {
|
| | | int start = (pageIndex - 1) * Constant.PAGE_SIZE;
|
| | | return taoBaoGoodsBriefDao.list("from TaoBaoGoodsBrief tb where tb.tkRate = 0 ", start, Constant.PAGE_SIZE,
|
| | | new Serializable[] {});
|
| | | }
|
| | |
|
| | | /**
|
| | | * 从yeshi_ec_recommend_section_goods表中查询数据
|
| | | */
|
| | | @SuppressWarnings("unchecked")
|
| | | @Override
|
| | | public List<RecommendSectionGoods> listRecommendSectionGoods() {
|
| | | return recommendSectionGoodsDao.list("from RecommendSectionGoods");
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String getGoodsUserHongBao(TaoBaoGoodsBrief goods) {
|
| | |
| | |
|
| | | @Override
|
| | | public int insertSelective(TaoBaoGoodsBrief taoBaoGoodsBrief) {
|
| | |
|
| | | return taoBaoGoodsBriefMapper.insertSelective(taoBaoGoodsBrief);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insertBatch(List<TaoBaoGoodsBrief> list) {
|
| | |
|
| | | return taoBaoGoodsBriefMapper.insertBatch(list);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void updateTBGoodsWithNewInfo(TaoBaoGoodsBrief tb) throws NotExistObjectException {
|
| | | if (tb == null)
|
| | | return;
|
| | | List<TaoBaoGoodsBrief> findList = taoBaoGoodsBriefDao
|
| | | .list("from TaoBaoGoodsBrief tb where tb.auctionId=" + tb.getAuctionId());
|
| | | if (findList != null && findList.size() > 0) {
|
| | | for (TaoBaoGoodsBrief goods : findList) {
|
| | | tb.setId(goods.getId());
|
| | | if (!StringUtil.isNullOrEmpty(goods.getPictUrl()))
|
| | | tb.setPictUrl(goods.getPictUrl());
|
| | | taoBaoGoodsBriefDao.update(tb);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void setGoodsBriefDefault(TaoBaoGoodsBrief goodsBrief) {
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.controller.admin.PushController;
|
| | |
| | | @Resource
|
| | | private DeviceTokenHWService deviceTokenHWService;
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, List<String> listVersion) throws PushException {
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, String versions) throws PushException {
|
| | | String gid = auctionId + "";
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("url", "");
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushUrl(Long uid, String url, String title, String content, List<String> listVersion) throws PushException {
|
| | | public void pushUrl(Long uid, String url, String title, String content, String versions) throws PushException {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("url", url);
|
| | | json.put("type", "url");
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushZNX(Long uid, AccountMessage msg, SystemZnx systemZNX, List<String> listVersion) throws PushException {
|
| | | public void pushZNX(Long uid, AccountMessage msg, SystemZnx systemZNX, String versions) throws PushException {
|
| | |
|
| | | JSONObject contentJson = new JSONObject();
|
| | | contentJson.put("isOpen", 0);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listVersion) throws PushException {
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl, String versions) throws PushException {
|
| | | // TODO 推送weex页面
|
| | |
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listVersion) throws PushException {
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versions) throws PushException {
|
| | | // TODO 推送淘客百川链接
|
| | |
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushWelfareCenter(Long uid, String title, String content, List<String> listVersion) throws PushException {
|
| | | public void pushWelfareCenter(Long uid, String title, String content, String versions) throws PushException {
|
| | | // TODO Auto-generated method stub
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.controller.admin.PushController;
|
| | | import com.yeshi.fanli.dao.mybatis.push.DeviceTokenIOSMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.push.PushQueueRecordMapper;
|
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenIOS;
|
| | | import com.yeshi.fanli.entity.push.PushQueueRecord;
|
| | |
| | | import com.yeshi.fanli.entity.xinge.PushRecord;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.log.PushLogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | |
| | | @Resource
|
| | | private UserCustomSettingsService userCustomSettingsService;
|
| | |
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | | |
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, List<String> listVersion) throws PushException {
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, String versionCodes) throws PushException {
|
| | |
|
| | | String url = "https://item.taobao.com/item.htm?id=" + auctionId;
|
| | | JSONObject json = new JSONObject();
|
| | |
| | |
|
| | | if (uid == null || uid == 0) {
|
| | |
|
| | | addPushIOSQueue(info, url, PushController.GOODS, listVersion);
|
| | | addPushIOSQueue(info, url, PushController.GOODS, versionCodes);
|
| | |
|
| | | /*
|
| | | * // 查询IOS所有设备号 // TODO 需要全推 List<String> deviceTokenList =
|
| | |
| | | }
|
| | |
|
| | | // IOS 单推
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, listVersion);
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
|
| | | |
| | | List<String> deviceTokenList = new ArrayList<>();
|
| | | if (deviceTokenIosList != null)
|
| | | for (DeviceTokenIOS ios : deviceTokenIosList) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushUrl(Long uid, String url, String title, String content, List<String> listVersion) throws PushException {
|
| | | public void pushUrl(Long uid, String url, String title, String content, String versionCodes) throws PushException {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("url", url);
|
| | | json.put("type", "url");
|
| | |
| | | if (uid == null || uid == 0) {
|
| | | // TODO 需要全推
|
| | |
|
| | | addPushIOSQueue(info, url, PushController.URL, listVersion);
|
| | | addPushIOSQueue(info, url, PushController.URL, versionCodes);
|
| | |
|
| | | /*
|
| | | * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
|
| | |
| | | return; // 通知免打扰(20:00-24:00 / 00:00 -08:00)
|
| | | }
|
| | |
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, listVersion);
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
|
| | | List<String> deviceTokenList = new ArrayList<>();
|
| | | if (deviceTokenIosList != null)
|
| | | for (DeviceTokenIOS ios : deviceTokenIosList) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, List<String> listVersion) throws PushException {
|
| | | public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versionCodes) throws PushException {
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
|
| | |
|
| | |
| | |
|
| | | // TODO 需要全推
|
| | |
|
| | | addPushIOSQueue(info, id + "", PushController.ZNX, listVersion);
|
| | | addPushIOSQueue(info, id + "", PushController.ZNX, versionCodes);
|
| | |
|
| | | /*
|
| | | * List<String> deviceTokenList = getDeviceTokenList(1, 1000);
|
| | |
| | | json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
|
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | |
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(msg.getUserInfo().getId(), listVersion);
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(msg.getUserInfo().getId(), versionCodes);
|
| | | List<String> deviceTokenList = new ArrayList<>();
|
| | | if (deviceTokenIosList != null)
|
| | | for (DeviceTokenIOS ios : deviceTokenIosList) {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DeviceTokenIOS> getDeviceTokenListByUid(Long uid, List<String> listVersion) throws PushException {
|
| | | List<Integer> listCode = null;
|
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | | // 版本号推送限制 |
| | | listCode = appVersionService.listVersionCodeByVersions(AppVersionInfo.PLATFORM_IOS,listVersion);
|
| | | if (listCode == null || listCode.size() == 0) {
|
| | | throw new PushException(1, "IOS推送失败,推送版本不存在!");
|
| | | }
|
| | | }
|
| | | |
| | | return deviceTokenIOSMapper.selectByUid(uid, listCode);
|
| | | public List<DeviceTokenIOS> getDeviceTokenListByUid(Long uid, String versionCodes) throws PushException {
|
| | | return deviceTokenIOSMapper.selectByUid(uid, convertVersionType(versionCodes));
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | * @param json
|
| | | */
|
| | | @Transactional
|
| | | public void addPushIOSQueue(MessageInfo info, String url, int type, List<String> listVersion) throws PushException {
|
| | | public void addPushIOSQueue(MessageInfo info, String url, int type, String versionCodes) throws PushException {
|
| | |
|
| | | try {
|
| | |
|
| | |
| | |
|
| | | // 每次执行条目
|
| | | int pushNum = 50;
|
| | |
|
| | | String versionCodes = "";
|
| | | |
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | | // 加入版本推送限制
|
| | | List<Integer> listCode = appVersionService.listVersionCodeByVersions(AppVersionInfo.PLATFORM_IOS,listVersion);
|
| | | |
| | | if (listCode != null && listCode.size() > 0) {
|
| | | for (Integer code: listCode) {
|
| | | versionCodes = versionCodes + code + ",";
|
| | | }
|
| | | |
| | | // 去除末尾逗号
|
| | | if (versionCodes.endsWith(",")) {
|
| | | versionCodes = versionCodes.substring(0, versionCodes.length() - 1);
|
| | | }
|
| | | }
|
| | | |
| | | if (versionCodes == null || versionCodes.trim().length() == 0) {
|
| | | throw new PushException(1, "IOS推送失败,推送版本不存在!");
|
| | | }
|
| | | |
| | | }
|
| | | |
| | |
|
| | | for (long i = 0; i < tokenCount + totalCount;) {
|
| | |
|
| | |
| | |
|
| | | // 推送的版本号
|
| | | String versions = pushQueueRecord.getVersions();
|
| | | List<Integer> listVersionCode = null;
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | |
| | | List<String> listVersion = Arrays.asList(versions.split(","));
|
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | | listVersionCode = new ArrayList<Integer>();
|
| | | for (String version: listVersion) {
|
| | | if (version != null && version.trim().length() > 0) {
|
| | | listVersionCode.add(Integer.parseInt(version));
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if (listVersionCode == null || listVersionCode.size() == 0) {
|
| | | return; //版本号存在异常
|
| | | }
|
| | | }
|
| | | List<Integer> listCode = convertVersionType(versions);
|
| | |
|
| | |
|
| | | int total = (int) (endCursor - startCursor);
|
| | |
| | |
|
| | | for (int i = 0; i < count; i++) {
|
| | |
|
| | | |
| | | // 不足50个数据
|
| | | if (moveNum > total) {
|
| | | moveNum = (int) (endCursor - startCursor);
|
| | | List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(startCursor, moveNum, listVersionCode);
|
| | | List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(startCursor, moveNum, listCode);
|
| | | recordCursor = endCursor;
|
| | |
|
| | | if (list != null) {
|
| | |
| | | // System.out.println("recordCursorend:" +recordCursor);
|
| | | moveNum = (int) (endCursor - recordCursor);
|
| | | // System.out.println(moveNum);
|
| | | List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum, listVersionCode);
|
| | | List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum, listCode);
|
| | | if (list != null) {
|
| | | executePushIOS(list, pushQueueRecord, endCursor);
|
| | | PushLogHelper.iosInfo("推送游标:" + recordCursor + "," + moveNum);
|
| | |
| | | recordCursor = endCursor;
|
| | |
|
| | | } else {
|
| | | List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum, listVersionCode);
|
| | | List<DeviceTokenIOS> list = deviceTokenIOSMapper.selectList(recordCursor, moveNum, listCode);
|
| | | recordCursor = recordCursor + 50;
|
| | |
|
| | | if (list != null) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listVersion) throws PushException {
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl,String versionCodes) throws PushException {
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setTitle(title);
|
| | | info.setContent(content);
|
| | | info.setDescription(content);
|
| | | // IOS 全推
|
| | | if (uid == null || uid == 0) {
|
| | | addPushIOSQueue(info, weexUrl, PushController.WEEX, listVersion);
|
| | | addPushIOSQueue(info, weexUrl, PushController.WEEX, versionCodes);
|
| | | } else {
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, listVersion);
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
|
| | | List<String> deviceTokenList = new ArrayList<>();
|
| | | if (deviceTokenIosList != null)
|
| | | for (DeviceTokenIOS ios : deviceTokenIosList) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listVersion) throws PushException {
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versionCodes) throws PushException {
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setTitle(title);
|
| | | info.setContent(content);
|
| | | info.setDescription(content);
|
| | | // IOS 全推
|
| | | if (uid == null || uid == 0) {
|
| | | addPushIOSQueue(info, url, PushController.BAICHUAN, listVersion);
|
| | | addPushIOSQueue(info, url, PushController.BAICHUAN, versionCodes);
|
| | | } else {
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, listVersion);
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
|
| | | List<String> deviceTokenList = new ArrayList<>();
|
| | | if (deviceTokenIosList != null)
|
| | | for (DeviceTokenIOS ios : deviceTokenIosList) {
|
| | |
| | | return ispush;
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushWelfareCenter(Long uid, String title, String content, List<String> listVersion) throws PushException {
|
| | | public void pushWelfareCenter(Long uid, String title, String content, String versionCodes) throws PushException {
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setTitle(title);
|
| | | info.setContent(content);
|
| | | info.setDescription(content);
|
| | | // IOS 全推
|
| | | if (uid == null || uid == 0) {
|
| | | addPushIOSQueue(info, "", PushController.WELFARE_CENTER, listVersion);
|
| | | addPushIOSQueue(info, "", PushController.WELFARE_CENTER, versionCodes);
|
| | | } else {
|
| | | if (!validateNotDisturbSingle(uid)) {
|
| | | return;
|
| | | }
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, listVersion);
|
| | | List<DeviceTokenIOS> deviceTokenIosList = getDeviceTokenListByUid(uid, versionCodes);
|
| | | List<String> deviceTokenList = new ArrayList<>();
|
| | | if (deviceTokenIosList != null)
|
| | | for (DeviceTokenIOS ios : deviceTokenIosList) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private List<Integer> convertVersionType(String versionCodes) {
|
| | | List<Integer> listVersionCode = null;
|
| | |
|
| | | if (versionCodes != null && versionCodes.trim().length() > 0) {
|
| | | List<String> listVersion = Arrays.asList(versionCodes.split(","));
|
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | |
|
| | | listVersionCode = new ArrayList<Integer>();
|
| | | // 转换成功整型
|
| | | for (String version : listVersion) {
|
| | | if (version != null && version.trim().length() > 0) {
|
| | | listVersionCode.add(Integer.parseInt(version));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | return listVersionCode;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | | import com.yeshi.fanli.service.inter.push.PushCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.push.PushCouponService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Service
|
| | | public class PushCouponServiceImpl implements PushCouponService {
|
| | |
| | | if(pushCoupon.isPushed()) {
|
| | | throw new PushCouponException(1, "该信息不能重复推送");
|
| | | }
|
| | | String versions = pushCoupon.getVersions();
|
| | | if (versions == null || versions.trim().length() == 0 ) {
|
| | | throw new PushCouponException(1, "推送版本不能为空");
|
| | | }
|
| | |
|
| | |
|
| | | String title = pushCoupon.getTitle();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | List<String> listVersion = null;
|
| | | String versions = pushCoupon.getVersions();
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | listVersion = Arrays.asList(versions.split(","));
|
| | | if (listVersion == null || listVersion.size() == 0) {
|
| | | throw new PushCouponException(1, "版本号格式不正确\"");
|
| | | List<String> listIOS = new ArrayList<String>();
|
| | | JSONObject json = JSONObject.fromObject(versions);
|
| | | String versionsIOS = json.getString("IOS");
|
| | | if (versionsIOS != null && versionsIOS.trim().length() > 0) {
|
| | | if (versionsIOS.contains("全推")) {
|
| | | listIOS = null;
|
| | | } else {
|
| | | listIOS = Arrays.asList(versionsIOS.split(","));
|
| | | }
|
| | | }
|
| | |
|
| | | List<String> listAndroid = new ArrayList<String>();
|
| | | String versionsAndroid = json.getString("Android");
|
| | | if (versionsAndroid != null && versionsAndroid.trim().length() > 0) {
|
| | | if (versionsAndroid.contains("全推")) {
|
| | | listAndroid = null;
|
| | | } else {
|
| | | listAndroid = Arrays.asList(versionsAndroid.split(","));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | if (listuid == null) {
|
| | | // 全推
|
| | | pushService.pushWelfareCenter(null, title, content, listVersion);
|
| | | pushService.pushWelfareCenter(null, title, content, listIOS, listAndroid);
|
| | |
|
| | | } else {
|
| | | // 指定用户推送
|
| | | for (String str_uid: listuid) {
|
| | | if (str_uid != null && str_uid.trim().length() > 0) {
|
| | | pushService.pushWelfareCenter(Long.parseLong(str_uid), title, content, listVersion);
|
| | | pushService.pushWelfareCenter(Long.parseLong(str_uid), title, content, listIOS, listAndroid);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.push.PushGoodsGroup;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.exception.push.PushCouponException;
|
| | | import com.yeshi.fanli.exception.push.PushGoodsException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Service
|
| | | public class PushGoodsServiceImpl implements PushGoodsService {
|
| | |
| | | throw new PushException(1, "推送无商品,请完善数据");
|
| | | }
|
| | |
|
| | | List<String> listVersion = null;
|
| | | String versions = pushGoods.getVersions();
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | listVersion = Arrays.asList(versions.split(","));
|
| | | if (listVersion == null || listVersion.size() == 0) {
|
| | | throw new PushCouponException(1, "版本号格式不正确\"");
|
| | | if (versions == null || versions.trim().length() == 0) {
|
| | | throw new PushException(1, "推送版本不能为空");
|
| | | }
|
| | | |
| | | List<String> listIOS = new ArrayList<String>();
|
| | | JSONObject json = JSONObject.fromObject(versions);
|
| | | String versionsIOS = json.getString("IOS");
|
| | | if (versionsIOS != null && versionsIOS.trim().length() > 0) {
|
| | | if (versionsIOS.contains("全推")) {
|
| | | listIOS = null;
|
| | | } else {
|
| | | listIOS = Arrays.asList(versionsIOS.split(","));
|
| | | }
|
| | | }
|
| | | |
| | | List<String> listAndroid = new ArrayList<String>();
|
| | | String versionsAndroid = json.getString("Android");
|
| | | if (versionsAndroid != null && versionsAndroid.trim().length() > 0) {
|
| | | if (versionsAndroid.contains("全推")) {
|
| | | listAndroid = null;
|
| | | } else {
|
| | | listAndroid = Arrays.asList(versionsAndroid.split(","));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | Long goodsId = commonGoods.getGoodsId();
|
| | | String url = "https://item.taobao.com/item.htm?id=" + goodsId;
|
| | |
|
| | | pushService.pushGoods(pushGoods.getUid(), url, alertTitle, alertContent, listVersion);
|
| | | pushService.pushGoods(pushGoods.getUid(), url, alertTitle, alertContent, listIOS, listAndroid);
|
| | |
|
| | | } else {
|
| | | /* 多个商品推送 */
|
| | |
| | | // 生成链接
|
| | | url = url + "?id=" + id;
|
| | |
|
| | | pushService.pushUrl(pushGoods.getUid(), url, alertTitle, alertContent, listVersion);
|
| | | pushService.pushUrl(pushGoods.getUid(), url, alertTitle, alertContent, listIOS, listAndroid);
|
| | | }
|
| | |
|
| | | // 已推送
|
| | |
| | | pushGoods.setUpdateTime(new Date());
|
| | |
|
| | | updateByPrimaryKeySelective(pushGoods);
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.controller.admin.PushController;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.push.PushRecordMapper;
|
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.system.SystemZnx;
|
| | | import com.yeshi.fanli.entity.xinge.PushRecord;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | | import com.yeshi.fanli.service.inter.push.HWPushService;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | |
| | | @Resource
|
| | | private AccountMessageMapper accountMessageMapper;
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | | |
| | | |
| | | @Override
|
| | | public void pushGoods(Long uid, String url, String title, String content, List<String> listVersion) throws PushException {
|
| | | public void pushGoods(Long uid, String url, String title, String content, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | | String gids = url.split("id=")[1];
|
| | | String gid = gids.split("&")[0];
|
| | | if (StringUtil.isNullOrEmpty(gid))
|
| | |
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "请填写推送内容");
|
| | |
|
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, versions);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setState(1);
|
| | | pushRecord.setType(PushController.GOODS); // 都成功
|
| | |
| | | pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
|
| | | pushRecord.setAccount(1);
|
| | | pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
|
| | |
|
| | | xmPushService.pushGoods(uid, Long.parseLong(gid), title, content, listVersion);
|
| | | iosPushService.pushGoods(uid, Long.parseLong(gid), title, content, listVersion);
|
| | | // hwPushService.pushGoods(uid, Long.parseLong(gid), title, content);
|
| | |
|
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | |
| | | @Override
|
| | | public void pushUrl(Long uid, String url, String title, String content, List<String> listVersion) throws PushException {
|
| | | public void pushUrl(Long uid, String url, String title, String content, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | throw new PushException(1, "无推送链接");
|
| | |
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "无推送内容");
|
| | |
|
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushUrl(uid, url, title, content, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushUrl(uid, url, title, content, versions);
|
| | | hwPushService.pushUrl(uid, url, title, content, versions);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setState(1);
|
| | | pushRecord.setType(PushController.URL);
|
| | |
| | | pushRecord.setTitle(title);
|
| | | pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
|
| | | pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
|
| | |
|
| | | xmPushService.pushUrl(uid, url, title, content, listVersion);
|
| | | iosPushService.pushUrl(uid, url, title, content, listVersion);
|
| | | hwPushService.pushUrl(uid, url, title, content, listVersion);
|
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | |
| | | @Override
|
| | | public void pushZNX(Long uId, String title, String content, List<String> listVersion) throws PushException {
|
| | | public void pushZNX(Long uId, String title, String content, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | | if (StringUtil.isNullOrEmpty(title))
|
| | | throw new PushException(1, "无推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "无推送内容");
|
| | |
|
| | | SystemZnx systemZnx = null;
|
| | | AccountMessage accountMessage = null;
|
| | | |
| | | /* 无uid , 广播 数据插入系统表 */
|
| | | if (uId == null || uId == 0) {
|
| | | // 插入数据库(系统站内信数据)
|
| | | SystemZnx systemZnx = new SystemZnx();
|
| | | systemZnx = new SystemZnx();
|
| | | systemZnx.setTitle(title);
|
| | | systemZnx.setContent(content);
|
| | | systemZnx.setCreateTime(System.currentTimeMillis());
|
| | | systemZnxService.save(systemZnx);
|
| | |
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setTitle(title);
|
| | | pushRecord.setState(1); // 成功
|
| | | pushRecord.setType(4); // 类型:站内信
|
| | | pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
|
| | | pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | |
| | | xmPushService.pushZNX(uId, null, systemZnx, listVersion);
|
| | | iosPushService.pushZNX(uId, null, systemZnx, listVersion);
|
| | | hwPushService.pushZNX(uId, null, systemZnx, listVersion);
|
| | | // 插入推送记录
|
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | } else {
|
| | | AccountMessage accountMessage = new AccountMessage();
|
| | | accountMessage = new AccountMessage();
|
| | | accountMessage.setCreateTime(System.currentTimeMillis());
|
| | | accountMessage.setIsOpen(false);
|
| | | accountMessage.setUserInfo(new UserInfo(uId));
|
| | | accountMessage.setTitle(title);
|
| | | accountMessage.setContent(content);
|
| | | accountMessageMapper.insertSelective(accountMessage);
|
| | | }
|
| | |
|
| | | xmPushService.pushZNX(uId, accountMessage, null, listVersion);
|
| | | iosPushService.pushZNX(uId, accountMessage, null, listVersion);
|
| | | hwPushService.pushZNX(uId, accountMessage, null, listVersion);
|
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushZNX(uId, accountMessage, systemZnx, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushZNX(uId, accountMessage, systemZnx, versions);
|
| | | hwPushService.pushZNX(uId, accountMessage, systemZnx, versions);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setTitle(title);
|
| | | pushRecord.setUid(uId);
|
| | | pushRecord.setTitle(title);
|
| | | pushRecord.setState(1); // 成功
|
| | | pushRecord.setType(PushController.ZNX); // 类型:站内信
|
| | | pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
|
| | | pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | |
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listVersion) throws PushException {
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | | if (StringUtil.isNullOrEmpty(title))
|
| | | throw new PushException(1, "无推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "无推送内容");
|
| | | iosPushService.pushWEEX(uid, title, content, weexUrl, listVersion);
|
| | | |
| | | // 适用版本 1.4.8及以后 推送weex页面
|
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushWEEX(uid, title, content, weexUrl, codes);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listVersion) throws PushException {
|
| | | iosPushService.pushBaiChuanUrl(uid, title, content, url, listVersion);
|
| | | xmPushService.pushBaiChuanUrl(uid, title, content, url, listVersion);
|
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:31
|
| | | String versions = getEffectiveVersions(0, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushWEEX(uid, title, content, weexUrl, versions);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setTitle(title);
|
| | | pushRecord.setUid(uid);
|
| | | pushRecord.setState(1); // 成功
|
| | | pushRecord.setType(PushController.BAICHUAN); // 类型:百川
|
| | | pushRecord.setType(PushController.WEEX); // 类型:WEEX
|
| | | pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
|
| | | pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | |
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void pushWelfareCenter(Long uid, String title, String content, List<String> listVersion) throws PushException {
|
| | | iosPushService.pushWelfareCenter(uid, title, content, listVersion);
|
| | | xmPushService.pushWelfareCenter(uid, title, content, listVersion);
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | | |
| | | if (StringUtil.isNullOrEmpty(title))
|
| | | throw new PushException(1, "无推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "无推送内容");
|
| | | |
| | | // 适用版本 1.4.8及以后 推送百川网页
|
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushBaiChuanUrl(uid, title, content, url, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:31
|
| | | String versions = getEffectiveVersions(31, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushBaiChuanUrl(uid, title, content, url, versions);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setUrl(url);
|
| | | pushRecord.setTitle(title);
|
| | | pushRecord.setUid(uid);
|
| | | pushRecord.setState(1); // 成功
|
| | | pushRecord.setType(PushController.BAICHUAN); // 类型:百川
|
| | | pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
|
| | | pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void pushWelfareCenter(Long uid, String title, String content, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException {
|
| | | |
| | | if (StringUtil.isNullOrEmpty(title))
|
| | | throw new PushException(1, "无推送标题");
|
| | | if (StringUtil.isNullOrEmpty(content))
|
| | | throw new PushException(1, "无推送内容");
|
| | | |
| | | |
| | | /* IOS端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listIOS == null || listIOS.size() > 0) {
|
| | | // 限制推送版本号:0
|
| | | String codes = getEffectiveVersionCodes(0, AppVersionInfo.PLATFORM_IOS, listIOS); |
| | | if(listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
|
| | | iosPushService.pushWelfareCenter(uid, title, content, codes);
|
| | | }
|
| | | }
|
| | | |
| | | /* Android端推送 (注明:list等于 'null' 时全推, size等于0 不做推送) */
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | // 限制推送版本号:36
|
| | | String versions = getEffectiveVersions(36, AppVersionInfo.PLATFORM_ANDROID, listAndroid); |
| | | if(listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
|
| | | xmPushService.pushWelfareCenter(uid, title, content, versions);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setTitle(title);
|
| | | pushRecord.setUid(uid);
|
| | | pushRecord.setState(1); // 成功
|
| | | pushRecord.setType(PushController.WELFARE_CENTER); // 类型:百川
|
| | | pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
|
| | | pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | pushRecordMapper.insertSelective(pushRecord);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 查询能推送版本号
|
| | | * @param versionCode
|
| | | * @param listVersion
|
| | | * @return
|
| | | */
|
| | | private String getEffectiveVersions(int minCode, String type, List<String> listVersion) throws PushException{
|
| | | |
| | | if (minCode == 0 && listVersion == null) {
|
| | | return null;
|
| | | }
|
| | | |
| | | String versions = "";
|
| | | if (listVersion == null) {
|
| | | List<AppVersionInfo> list = appVersionService.listByPlatformAndMinVersionCode(type, minCode);
|
| | | if (list != null) {
|
| | | for (AppVersionInfo appVersion : list) {
|
| | | versions += appVersion.getVersion() + ",";
|
| | | }
|
| | | }
|
| | | } else {
|
| | | List<AppVersionInfo> list = appVersionService.listByVersions(type, listVersion);
|
| | | if (list != null) {
|
| | | for (AppVersionInfo appVersion : list) {
|
| | | Integer code = appVersion.getVersionCode();
|
| | | if (code != null && code >= minCode) {
|
| | | versions += appVersion.getVersion() + ",";
|
| | | }
|
| | | }
|
| | | } |
| | | }
|
| | | |
| | | if (versions.endsWith(",")) {
|
| | | versions = versions.substring(0, versions.length() - 1);
|
| | | }
|
| | | |
| | | return versions;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 查询能推送版本号code
|
| | | * @param versionCode
|
| | | * @param listVersion
|
| | | * @return
|
| | | */
|
| | | private String getEffectiveVersionCodes(int minCode, String type, List<String> listVersion) throws PushException{
|
| | | |
| | | if (minCode == 0 && listVersion == null) {
|
| | | return null;
|
| | | }
|
| | | |
| | | String versionCodes = "";
|
| | | if (listVersion == null) {
|
| | | List<AppVersionInfo> list = appVersionService.listByPlatformAndMinVersionCode(type, minCode);
|
| | | if (list != null) {
|
| | | for (AppVersionInfo appVersion : list) {
|
| | | versionCodes += appVersion.getVersionCode() + ",";
|
| | | }
|
| | | }
|
| | | } else {
|
| | | List<AppVersionInfo> list = appVersionService.listByVersions(type, listVersion);
|
| | | if (list != null) {
|
| | | for (AppVersionInfo appVersion : list) {
|
| | | Integer code = appVersion.getVersionCode();
|
| | | if (code != null && code >= minCode) {
|
| | | versionCodes += appVersion.getVersionCode() + ",";
|
| | | }
|
| | | }
|
| | | } |
| | | }
|
| | | |
| | | if (versionCodes.endsWith(",")) {
|
| | | versionCodes = versionCodes.substring(0, versionCodes.length() - 1);
|
| | | }
|
| | | |
| | | return versionCodes;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.AppVersionInfoMapper;
|
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | | import com.yeshi.fanli.entity.system.SystemZnx;
|
| | | import com.yeshi.fanli.entity.xinge.MessageInfo;
|
| | | import com.yeshi.fanli.entity.xinge.PushRecord;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.log.PushLogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.push.XMPushService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.push.PushUtils;
|
| | |
| | | @Service
|
| | | public class XMPushServiceImpl implements XMPushService {
|
| | |
|
| | | @Resource
|
| | | private AppVersionInfoMapper appVersionInfoMapper;
|
| | | |
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, List<String> listVersion) throws PushException {
|
| | | |
| | | // 无最低版本限制
|
| | | int minVersionCode = 0;
|
| | | String appVersion = null;
|
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | | appVersion = getCanPushVersions(minVersionCode, listVersion);
|
| | | if (appVersion == null || appVersion.trim().length() ==0) {
|
| | | throw new PushException(1, "小米推送失败,推送的版本过低!");
|
| | | }
|
| | | } else if (minVersionCode > 0) {
|
| | | appVersion = getVersionByMinVersionCode(minVersionCode);
|
| | | }
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, String versions) throws PushException {
|
| | |
|
| | | String gid = auctionId + "";
|
| | | JSONObject json = new JSONObject();
|
| | |
| | | json.put("type", "goodsdetail");
|
| | | json.put("miPushUrl", String.format("%s.ui.recommend.GoodsBrowserActivity",
|
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | | |
| | | // 版本推送
|
| | | if (appVersion != null && appVersion.trim().length() > 0) {
|
| | | json.put("app_version", appVersion);
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushUrl(Long uid, String url, String title, String content, List<String> listVersion) throws PushException {
|
| | | // 无最低版本限制
|
| | | int minVersionCode = 0;
|
| | | String appVersion = null;
|
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | | appVersion = getCanPushVersions(minVersionCode, listVersion);
|
| | | if (appVersion == null || appVersion.trim().length() ==0) {
|
| | | throw new PushException(1, "小米推送失败,推送的版本过低!");
|
| | | }
|
| | | } else if (minVersionCode > 0) {
|
| | | appVersion = getVersionByMinVersionCode(minVersionCode);
|
| | | }
|
| | | public void pushUrl(Long uid, String url, String title, String content, String versions) throws PushException {
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("url", url);
|
| | |
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | |
|
| | | // 版本推送
|
| | | if (appVersion != null && appVersion.trim().length() > 0) {
|
| | | json.put("app_version", appVersion);
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | |
| | | info.setAlias(uid + "");
|
| | | PushUtils.singlePushXiaoMi(info, json, pushRecord);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, List<String> listVersion) throws PushException {
|
| | | |
| | | // 无最低版本限制
|
| | | int minVersionCode = 0;
|
| | | String appVersion = null;
|
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | | appVersion = getCanPushVersions(minVersionCode, listVersion);
|
| | | if (appVersion == null || appVersion.trim().length() == 0) {
|
| | | throw new PushException(1, "小米推送失败,推送的版本过低!");
|
| | | }
|
| | | } else if (minVersionCode > 0) {
|
| | | appVersion = getVersionByMinVersionCode(minVersionCode);
|
| | | }
|
| | | public void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versions) throws PushException {
|
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setPackageName(Constant.systemCommonConfig.getAndroidPackageName());
|
| | |
| | | json.put("content", contentJson);
|
| | | json.put("miPushUrl", String.format("%s.ui.mine.AppMailDetailActivity",
|
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | | |
| | | // 版本推送
|
| | | if (appVersion != null && appVersion.trim().length() > 0) {
|
| | | json.put("app_version", appVersion);
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | |
|
| | | PushRecord pushRecord = new PushRecord();
|
| | |
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | |
|
| | | // 版本推送
|
| | | if (appVersion != null && appVersion.trim().length() > 0) {
|
| | | json.put("app_version", appVersion);
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | |
|
| | | // 小米 单推
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listVersion) throws PushException {
|
| | |
|
| | | // 设置可推送版本,1.4.8以后的版本可推送
|
| | | int minVersionCode = 31;
|
| | | String appVersion = null;
|
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | | appVersion = getCanPushVersions(minVersionCode, listVersion);
|
| | | if (appVersion == null || appVersion.trim().length() == 0) {
|
| | | throw new PushException(1, "小米推送失败,推送的版本不能低于1.4.8");
|
| | | }
|
| | | } else if (minVersionCode > 0) {
|
| | | appVersion = getVersionByMinVersionCode(minVersionCode);
|
| | | }
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl, String versions) throws PushException {
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("url", weexUrl);
|
| | | json.put("type", "weex");
|
| | | |
| | | // 版本推送
|
| | | if (appVersion != null && appVersion.trim().length() > 0) {
|
| | | json.put("app_version", appVersion);
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private String getVersionByMinVersionCode(int versionCode) {
|
| | | List<AppVersionInfo> list = appVersionInfoMapper
|
| | | .listByPlatformAndMinVersionCode(AppVersionInfo.PLATFORM_ANDROID, versionCode);
|
| | | String versions = "";
|
| | | if (list != null)
|
| | | for (AppVersionInfo appVersion : list) {
|
| | | versions += appVersion.getVersion() + ",";
|
| | |
|
| | | }
|
| | | if (versions.endsWith(","))
|
| | | versions = versions.substring(0, versions.length() - 1);
|
| | |
|
| | | return versions;
|
| | | }
|
| | | |
| | | /**
|
| | | * 查询能推送版本号
|
| | | * @param versionCode
|
| | | * @param listVersion
|
| | | * @return
|
| | | */
|
| | | private String getCanPushVersions(int versionCode, List<String> listVersion) throws PushException{
|
| | | List<AppVersionInfo> list = appVersionService.listByVersions(AppVersionInfo.PLATFORM_ANDROID, listVersion);
|
| | | String versions = "";
|
| | | |
| | | if (list != null) {
|
| | | for (AppVersionInfo appVersion : list) {
|
| | | Integer code = appVersion.getVersionCode();
|
| | | if (code != null && code >= versionCode) {
|
| | | versions += appVersion.getVersion() + ",";
|
| | | }
|
| | | }
|
| | | } else {
|
| | | throw new PushException(1, "推送的版本不存在,请核实版本信息");
|
| | | }
|
| | | |
| | | if (versions.endsWith(",")) {
|
| | | versions = versions.substring(0, versions.length() - 1);
|
| | | }
|
| | | |
| | | return versions;
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listVersion) throws PushException {
|
| | | |
| | | // 设置可推送版本,1.4.8以后的版本可推送
|
| | | int minVersionCode = 31;
|
| | | String appVersion = null;
|
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | | appVersion = getCanPushVersions(minVersionCode, listVersion);
|
| | | if (appVersion == null || appVersion.trim().length() ==0) {
|
| | | throw new PushException(1, "小米推送失败,推送的版本不能低于1.4.8");
|
| | | }
|
| | | |
| | | } else if (minVersionCode > 0){
|
| | | appVersion = getVersionByMinVersionCode(minVersionCode);
|
| | | }
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, String versions) throws PushException {
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("url", url);
|
| | | json.put("type", "baichuan");
|
| | | // 版本推送
|
| | | if (appVersion != null && appVersion.trim().length() > 0) {
|
| | | json.put("app_version", appVersion);
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | | |
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | | info.setTitle(title);
|
| | |
| | | info.setAlias(uid + "");
|
| | | PushUtils.singlePushXiaoMi(info, json, pushRecord);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushWelfareCenter(Long uid, String title, String content, List<String> listVersion) throws PushException {
|
| | | |
| | | // 1.5.1之后的版本可推送
|
| | | int minVersionCode = 36;
|
| | | String appVersion = null;
|
| | | if (listVersion != null && listVersion.size() > 0) {
|
| | | appVersion = getCanPushVersions(minVersionCode, listVersion);
|
| | | if (appVersion == null || appVersion.trim().length() ==0) {
|
| | | throw new PushException(1, "小米推送失败,推送的版本不能低于1.5.1");
|
| | | }
|
| | | } else if (minVersionCode > 0){
|
| | | appVersion = getVersionByMinVersionCode(minVersionCode);
|
| | | }
|
| | | public void pushWelfareCenter(Long uid, String title, String content, String versions) throws PushException {
|
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("type", "welfare");
|
| | | json.put("miPushUrl", String.format("%s.ui.mine.WelfareCenterActivity",
|
| | | Constant.systemCommonConfig.getAndroidBaseactivityName()));
|
| | | // 版本推送
|
| | | if (appVersion != null && appVersion.trim().length() > 0) {
|
| | | json.put("app_version", appVersion);
|
| | | if (versions != null && versions.trim().length() > 0) {
|
| | | json.put("app_version", versions);
|
| | | }
|
| | |
|
| | | MessageInfo info = new MessageInfo();
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | |
| | |
|
| | | @Service
|
| | | public class TaoBaoGoodsUpdateServiceImpl implements TaoBaoGoodsUpdateService {
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
|
| | | @Resource
|
| | | private ActivityService activityService;
|
| | |
| | | @Transactional
|
| | | @Override
|
| | | public void deleteTaoBaoGoods(Long auctionId) {
|
| | | // 删除首页推荐数据
|
| | | recommendSectionGoodsService.deleteRecommendSectionGoodsByTbAuctionId(auctionId);
|
| | |
|
| | | // 删除精选库相关的数据
|
| | | qualityFactoryService.deleteByTbAuctionId(auctionId);
|
| | |
|
| | |
| | | @Transactional
|
| | | @Override
|
| | | public void offlineTaoBaoGoods(Long auctionId) {
|
| | | // 删除首页推荐数据
|
| | | recommendSectionGoodsService.deleteRecommendSectionGoodsByTbAuctionId(auctionId);
|
| | | // 更新动态数据
|
| | | activityService.downTaoBaoGoods(auctionId);
|
| | |
|
| | |
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getNewerHongbaoTitle(),
|
| | | Constant.znxConfig.getNewerHongbaoMsg().replace("[金额]", money.toString()), null);
|
| | | Constant.znxConfig.getNewerHongbaoMsg().replace("[金额]", money.toString()), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getOrderFanliRecieveTitle(), Constant.znxConfig
|
| | | .getOrderFanliRecieveMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()), null);
|
| | | .getOrderFanliRecieveMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getShareMoneyRecieveTitle(),
|
| | | Constant.znxConfig.getShareMoneyRecieveMsg().replace("[金额]", money.toString()), null);
|
| | | Constant.znxConfig.getShareMoneyRecieveMsg().replace("[金额]", money.toString()), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getFanliOrderStatisticedTitle(),
|
| | | Constant.znxConfig.getFanliOrderStatisticedMsg().replace("[订单号]", orderId), null);
|
| | | Constant.znxConfig.getFanliOrderStatisticedMsg().replace("[订单号]", orderId), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getTichengOrderStatisticedTitle(), Constant.znxConfig
|
| | | .getTichengOrderStatisticedMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()), null);
|
| | | .getTichengOrderStatisticedMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getExtractApplayTitle(),
|
| | | Constant.znxConfig.getExtractApplayMsg(), null);
|
| | | Constant.znxConfig.getExtractApplayMsg(), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getExtractTransferFailTitle(),
|
| | | Constant.znxConfig.getExtractTransferFailMsg().replace("[时间]", time), null);
|
| | | Constant.znxConfig.getExtractTransferFailMsg().replace("[时间]", time), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | |
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getExtractWrongTitle(),
|
| | | Constant.znxConfig.getExtractWrongMsg().replace("[时间]", time), null);
|
| | | Constant.znxConfig.getExtractWrongMsg().replace("[时间]", time), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | |
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getExtractSuccessTitle(),
|
| | | Constant.znxConfig.getExtractSuccessMsg().replace("[时间]", time), null);
|
| | | Constant.znxConfig.getExtractSuccessMsg().replace("[时间]", time), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getInviteMoneyRecieveTitle(),
|
| | | Constant.znxConfig.getInviteMoneyRecieveMsg().replace("[金额]", money.toString()), null);
|
| | | Constant.znxConfig.getInviteMoneyRecieveMsg().replace("[金额]", money.toString()), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getShareMoneyRecieveTitle(),
|
| | | Constant.znxConfig.getShareMoneyRecieveMsg().replace("[金额]", money.toString()), null);
|
| | | Constant.znxConfig.getShareMoneyRecieveMsg().replace("[金额]", money.toString()), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getShareOrderStatisticedTitle(), Constant.znxConfig
|
| | | .getShareOrderStatisticedMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()), null);
|
| | | .getShareOrderStatisticedMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getInviteOrderStatisticedTitle(), Constant.znxConfig
|
| | | .getInviteOrderStatisticedMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()), null);
|
| | | .getInviteOrderStatisticedMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()), null, null);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public AppVersionInfo getAppVersionInfoListByPlatformAndVersion(String platform, int versionCode);
|
| | | |
| | | |
| | | /**
|
| | | * 通过版本号与平台获取详细信息
|
| | | * |
| | | * @param platform
|
| | | * @param versionCode
|
| | | * @return
|
| | | */
|
| | | public List<AppVersionInfo> listByPlatformAndMinVersionCode(String platform, int versionCode);
|
| | |
|
| | |
|
| | | /**
|
| | | * 根据版本号获取
|
| | |
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.ExistObjectException;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.exception.ShareGoodsException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | |
|
| | | public interface TaoBaoGoodsBriefService {
|
| | |
|
| | | public void save(TaoBaoGoodsBrief taoBaoGoodsBrief) throws ExistObjectException;
|
| | |
|
| | | public List<TaoBaoGoodsBrief> getTBList(int i, String key);
|
| | |
|
| | | public int getCount(String key);
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBao(long id);
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBaoByAuctionId(long id);
|
| | |
|
| | | public void deleteTaoBaoGoods(long id);
|
| | |
|
| | | public void addRecommendSectionGoods(long rsid, long tbid) throws NotExistObjectException, ExistObjectException;
|
| | |
|
| | | public void addClassRecommendGoods(long gcid, long tbid) throws NotExistObjectException, ExistObjectException;
|
| | |
|
| | | public TaoBaoGoodsBrief getTaoBaoByAuctionId(String tbid);
|
| | |
|
| | | public void updateTBGoods(TaoBaoGoodsBrief tb) throws NotExistObjectException;
|
| | |
|
| | | /**
|
| | | * 更新最新的商品数据到数据库
|
| | | * |
| | | * @param tb
|
| | | * @throws NotExistObjectException
|
| | | */
|
| | | public void updateTBGoodsWithNewInfo(TaoBaoGoodsBrief tb) throws NotExistObjectException;
|
| | |
|
| | | public List<TaoBaoGoodsBrief> getAllTaoBao();
|
| | |
|
| | | public void getUpdateTaoBao();
|
| | |
|
| | | public int getInvalidCount();
|
| | |
|
| | | public List<TaoBaoGoodsBrief> getInvalidTB(int pageIndex);
|
| | |
|
| | | public void updateTaoBaoGoods(TaoBaoGoodsBrief taoBaoGoodsBrief) throws TaobaoGoodsDownException;
|
| | |
|
| | | public List<RecommendSectionGoods> listRecommendSectionGoods();
|
| | |
|
| | |
|
| | | /**
|
| | | * 获取单个商品用户能够分得的红包
|
| | |
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushGoods(Long uid, Long auctionId, String title, String content, List<String> listVersion) throws PushException;
|
| | | void pushGoods(Long uid, Long auctionId, String title, String content, String versions) throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送链接
|
| | |
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushUrl(Long uid, String url, String title, String content, List<String> listVersion) throws PushException;
|
| | | void pushUrl(Long uid, String url, String title, String content, String versions) throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送站内信
|
| | |
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, List<String> listVersion) throws PushException;
|
| | | void pushZNX(Long uId, AccountMessage msg, SystemZnx systemZNX, String versions) throws PushException;
|
| | |
|
| | | /**
|
| | | * 适用版本 1.4.8及以后 推送weex页面
|
| | |
| | | * @param weexUrl
|
| | | * @throws PushException
|
| | | */
|
| | | void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listVersion) throws PushException;
|
| | | void pushWEEX(Long uid, String title, String content, String weexUrl, String versions) throws PushException;
|
| | |
|
| | | /**
|
| | | * 适用版本 1.4.8及以后 推送百川网页
|
| | |
| | | * @param url
|
| | | * @throws PushException
|
| | | */
|
| | | void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listVersion) throws PushException;
|
| | | void pushBaiChuanUrl(Long uid, String title, String content, String url, String versions) throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送福利中心(版本号:1.5.1后)
|
| | |
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushWelfareCenter(Long uid, String title, String content, List<String> listVersion) throws PushException;
|
| | | void pushWelfareCenter(Long uid, String title, String content, String versions) throws PushException;
|
| | | }
|
| | |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public List<DeviceTokenIOS> getDeviceTokenListByUid(Long uid, List<String> listVersion) throws PushException;
|
| | | public List<DeviceTokenIOS> getDeviceTokenListByUid(Long uid, String versionCodes) throws PushException;
|
| | |
|
| | | /**
|
| | | * 获取DeviceToken不为空的列表
|
| | |
| | | public interface PushService {
|
| | | /**
|
| | | * 推送商品
|
| | | * |
| | | * @param uid
|
| | | * @param url
|
| | | * @param title
|
| | | * @param content
|
| | | * @param listIOS
|
| | | * @param listAndroid
|
| | | * @throws PushException
|
| | | */
|
| | | void pushGoods(Long uid, String url, String title, String content, List<String> listVersion) throws PushException;
|
| | | void pushGoods(Long uid, String url, String title, String content, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送链接
|
| | | * |
| | | * @param uid
|
| | | * @param url
|
| | | * @param title
|
| | | * @param content
|
| | | * @param listIOS
|
| | | * @param listAndroid
|
| | | * @throws PushException
|
| | | */
|
| | | void pushUrl(Long uid, String url, String title, String content, List<String> listVersion) throws PushException;
|
| | | void pushUrl(Long uid, String url, String title, String content,List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送站内信
|
| | | * |
| | | * @param uId
|
| | | * @param title
|
| | | * @param content
|
| | | * @param listIOS
|
| | | * @param listAndroid
|
| | | * @throws PushException
|
| | | */
|
| | | void pushZNX(Long uId, String title, String content, List<String> listVersion) throws PushException;
|
| | | void pushZNX(Long uId, String title, String content, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException;
|
| | |
|
| | | /**
|
| | | * 适用版本 1.4.8及以后 推送weex页面
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param weexUrl
|
| | | * @param listIOS
|
| | | * @param listAndroid
|
| | | * @throws PushException
|
| | | */
|
| | | void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listVersion) throws PushException;
|
| | | void pushWEEX(Long uid, String title, String content, String weexUrl, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException;
|
| | |
|
| | | /**
|
| | | * 适用版本 1.4.8及以后 推送百川网页
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param url
|
| | | * @param listIOS
|
| | | * @param listAndroid
|
| | | * @throws PushException
|
| | | */
|
| | | void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listVersion) throws PushException;
|
| | | void pushBaiChuanUrl(Long uid, String title, String content, String url, List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送福利中心
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param listIOS
|
| | | * @param listAndroid
|
| | | * @throws PushException
|
| | | */
|
| | | void pushWelfareCenter(Long uid, String title, String content, List<String> listVersion) throws PushException;
|
| | | void pushWelfareCenter(Long uid, String title, String content,List<String> listIOS,
|
| | | List<String> listAndroid) throws PushException;
|
| | | }
|
| | |
| | |
|
| | | import org.jsoup.Jsoup;
|
| | | import org.jsoup.nodes.Document;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.GoodsClassAdmin;
|
| | | import com.yeshi.fanli.entity.admin.HotSearchAdmin;
|
| | | import com.yeshi.fanli.entity.admin.RecommendBannerAdmin;
|
| | | import com.yeshi.fanli.entity.admin.RecommendSectionAdmin;
|
| | | import com.yeshi.fanli.entity.admin.RecommendSpecialAdmin;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | return newMap;
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | public static void sort(List list) {
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | | if (list.get(0) instanceof RecommendSection) {
|
| | | Collections.sort(list, new Comparator<RecommendSection>() {
|
| | | public int compare(RecommendSection o1, RecommendSection o2) {
|
| | | return o1.getOrderby() - o2.getOrderby();
|
| | | }
|
| | | });
|
| | | } else if (list.get(0) instanceof RecommendSectionGoods) {
|
| | | Collections.sort(list, new Comparator<RecommendSectionGoods>() {
|
| | | public int compare(RecommendSectionGoods o1, RecommendSectionGoods o2) {
|
| | | return o1.getOrderby() - o2.getOrderby();
|
| | | }
|
| | | });
|
| | | }
|
| | | return;
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | public static Map orderBy(Map map) {
|
| | |
| | | package com.yeshi.fanli.vo.push;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.push.PushCoupon;
|
| | |
|
| | | public class PushCouponVO extends PushCoupon {
|
| | |
| | | // 已领取券数量
|
| | | private long receivedCount;
|
| | |
|
| | | // ios推送版本
|
| | | private List<String> listIOS;
|
| | | // Android推送版本
|
| | | private List<String> listAndroid;
|
| | | |
| | | public long getReceivedCount() {
|
| | | return receivedCount;
|
| | | }
|
| | |
| | | this.receivedCount = receivedCount;
|
| | | }
|
| | |
|
| | | public List<String> getListIOS() {
|
| | | return listIOS;
|
| | | }
|
| | |
|
| | | public void setListIOS(List<String> listIOS) {
|
| | | this.listIOS = listIOS;
|
| | | }
|
| | |
|
| | | public List<String> getListAndroid() {
|
| | | return listAndroid;
|
| | | }
|
| | |
|
| | | public void setListAndroid(List<String> listAndroid) {
|
| | | this.listAndroid = listAndroid;
|
| | | }
|
| | | |
| | | }
|