| | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | Map<String, String> map = hongBaoManageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate(java.lang.System.currentTimeMillis());
|
| | |
|
| | | for (UserShareGoodsGroup goodsGroup : list) {
|
| | | CommonGoods commonGoods = goodsGroup.getCommonGoods();
|
| | |
| | | dataObject.put("totalBrowse",goodsGroup.getTotalBrowse() );
|
| | | dataObject.put("totalOrder", goodsGroup.getTotalOrder());
|
| | | dataObject.put("totalMoney", "¥"+goodsGroup.getTotalMoney());
|
| | | dataObject.put("goods", gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion, null)));
|
| | | dataObject.put("goods", gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, shareRate+"", null)));
|
| | | array.add(dataObject);
|
| | | }
|
| | |
|
| | |
| | | JSONArray array = new JSONArray();
|
| | |
|
| | | List<UserShareGoodsGroup> list = userShareGoodsGroupService.listByRecordId(recordId);
|
| | | |
| | | if (list != null && list.size() > 0) {
|
| | |
|
| | | Date nowDate = new Date();
|
| | | long nh = 1000 * 60 * 60;
|
| | | long nd = 1000 * 24 * 60 * 60;
|
| | |
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | |
| | | |
| | | Map<String, String> map = hongBaoManageService.convertMap();
|
| | | String proportion = map.get("hongbao_goods_proportion");
|
| | |
|
| | | for (UserShareGoodsGroup userShareGoodsGroup : list) {
|
| | | CommonGoods commonGoods = userShareGoodsGroup.getCommonGoods();
|
| | | List<Long> listGid = new ArrayList<Long>();
|
| | | for (UserShareGoodsGroup goodsGroup : list) {
|
| | | CommonGoods commonGoods = goodsGroup.getCommonGoods();
|
| | | if (commonGoods == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief goodsBrief = null;
|
| | | // 更新一个小时之内的商品不再更新
|
| | | Integer goodsState = commonGoods.getState();
|
| | | // 状态未下架时进行更新
|
| | | if (goodsState != null && (goodsState != 1 || !goodsState.equals(1))) {
|
| | | Date updateTime = commonGoods.getUpdateTime();
|
| | | if (updateTime != null) {
|
| | | |
| | | // 计算差多少小时
|
| | | long diff = nowDate.getTime() - updateTime.getTime();
|
| | | long day = diff / nd;
|
| | | long hour = diff % nd / nh;
|
| | | if (hour > 1 || day > 0 ) {
|
| | | try {
|
| | | if (commonGoods.getGoodsType() == CommonGoods.GOODS_TYPE_TB) {
|
| | | goodsBrief = redisManager.getTaoBaoGoodsBrief(commonGoods.getGoodsId());
|
| | | |
| | | goodsState = 0;
|
| | | goodsBrief.setState(goodsState); // 在售
|
| | | |
| | | CommonGoods upadeteCommonGoods = CommonGoodsFactory.create(goodsBrief);
|
| | | upadeteCommonGoods.setState(goodsState);
|
| | | upadeteCommonGoods.setId(commonGoods.getId());
|
| | | listUpadteCommonGoods.add(upadeteCommonGoods);
|
| | | }
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | // 已下架
|
| | | goodsState = 1;
|
| | | commonGoods.setState(goodsState);
|
| | | listUpadteCommonGoods.add(commonGoods);
|
| | | e.printStackTrace();
|
| | | }
|
| | | listGid.add(commonGoods.getGoodsId());
|
| | | }
|
| | | |
| | | // API网络接口验证是否在售
|
| | | List<TaoBaoGoodsBrief> listTaoKeGoods = null;
|
| | | try {
|
| | | listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | |
| | | BigDecimal shareRate = hongBaoManageService.getShareRate(java.lang.System.currentTimeMillis());
|
| | | |
| | | for (UserShareGoodsGroup goodsGroup : list) {
|
| | | CommonGoods commonGoods = goodsGroup.getCommonGoods();
|
| | | if (commonGoods == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | if (listTaoKeGoods != null && listTaoKeGoods.size() > 0 ) {
|
| | | int state = 1; // 默认停售
|
| | | Long goodsId = commonGoods.getGoodsId();
|
| | | for (TaoBaoGoodsBrief taoKeGoods: listTaoKeGoods) {
|
| | | Long auctionId = taoKeGoods.getAuctionId();
|
| | | if (goodsId == auctionId || goodsId.equals(auctionId)) {
|
| | | state = 0; // 在售
|
| | | break;
|
| | | }
|
| | | }
|
| | | commonGoods.setState(state);
|
| | | }
|
| | |
|
| | | if (goodsBrief == null) {
|
| | | goodsBrief = TaoBaoUtil.convert(commonGoods);
|
| | | } |
| | | |
| | | TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(commonGoods);
|
| | |
|
| | | if (goodsBrief.getCouponLeftCount() < 1 || StringUtil.isNullOrEmpty(goodsBrief.getCouponInfo())) {
|
| | | goodsBrief.setState(1); // 已抢光
|
| | | }
|
| | |
|
| | | // 改变图片尺寸
|
| | | String pictUrl = goodsBrief.getPictUrl();
|
| | | if (!StringUtil.isNullOrEmpty(pictUrl) && !pictUrl.contains("320x320")) {
|
| | | goodsBrief.setPictUrl(TbImgUtil.getTBSize320Img(pictUrl));
|
| | | }
|
| | | |
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, proportion, null);
|
| | | TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(goodsBrief, shareRate +"", null);
|
| | | array.add(gson.toJson(taoBaoGoodsBriefExtra));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | String title = "";
|