| | |
| | | package com.yeshi.fanli.controller.client.v2;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | | |
| | | @Resource
|
| | | private QualityGoodsService qualityGoodsService;
|
| | | |
| | | @Resource
|
| | | private SpecialService specialService;
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | public void getGoodsInfo(AcceptData acceptData, Integer cid, Integer page, PrintWriter out) {
|
| | | JSONObject root = new JSONObject();
|
| | | if (cid == 1 && page == 1) {
|
| | | List<SwiperPicture> topPicList = swiperPictureService.getByBannerCard("pdd_top");
|
| | | List<SwiperPicture> topPicList = swiperPictureService.getByBannerCard("index_top");
|
| | | if (topPicList == null) {
|
| | | topPicList = new ArrayList<SwiperPicture>();
|
| | | }
|
| | | root.put("listPic", JsonUtil.getApiCommonGson().toJson(topPicList));
|
| | | |
| | | List<Special> listSpecial = specialService.listByPlaceKey("pinduoduo_special_top");
|
| | | if (listSpecial == null) {
|
| | | listSpecial = new ArrayList<Special>();
|
| | | }
|
| | | root.put("listSpe", JsonUtil.getApiCommonGson().toJson(listSpecial));
|
| | | }
|
| | |
|
| | | // TODO
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listFreeGoods((page - 1) * 20, 20);
|
| | | if (listQuery == null) {
|
| | | listQuery = new ArrayList<QualityFactory>();
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | if (listQuery.size() > 0) {
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | |
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | for (QualityFactory qualityFactory : listQuery) {
|
| | | TaoBaoGoodsBrief goods = qualityFactory.getTaoBaoGoodsBrief();
|
| | | if (goods == null) {
|
| | | continue;
|
| | | }
|
| | | array.add(gson.toJson(GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate)));
|
| | | }
|
| | | }
|
| | | long count = qualityGoodsService.countFreeGoods();
|
| | |
|
| | | |
| | | root.put("count", count);
|
| | | root.put("list", array);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|