| | |
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.IOException;
|
| | | import java.io.PrintWriter;
|
| | | import java.security.SignatureException;
|
| | | import java.util.Date;
|
| | |
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | @Controller
|
| | | @RequestMapping("client/v1/callback")
|
| | | public class CallBackController {
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private MsgDeviceReadStateService msgDeviceReadStateService;
|
| | |
| | | msg = "[语音]";
|
| | | String customizedId = json.optJSONObject("customizedData").optString("设备标识");
|
| | | msgDeviceReadStateService.addUnreadDeviceMsg(MsgDeviceReadState.TYPE_KEFU, customizedId,
|
| | | "android".equalsIgnoreCase(deviceOS) ? 1 : 2, 1, msg,new Date());
|
| | | "android".equalsIgnoreCase(deviceOS) ? 1 : 2, 1, msg, new Date());
|
| | | }
|
| | |
|
| | | LogHelper.test("美洽:body----" + sb.toString());
|
| | |
| | | return "meiqia_sign:" + result;
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "test")
|
| | | public void test(PrintWriter out) {
|
| | | configService.getConfig(1L);
|
| | | out.print("success");
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.dto.common.CommonContentNav;
|
| | | import com.yeshi.fanli.dto.common.CommonContentResult;
|
| | | import com.yeshi.fanli.dto.common.CommonContentTypeEnum;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.banner.SwiperPictureException;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | 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;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private CommonTemplateContentService commonTemplateContentService;
|
| | |
|
| | | /**
|
| | | * 通用模板导航
|
| | | *
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "请传入Key"));
|
| | | return;
|
| | | }
|
| | | List<CommonContentNav> list = new ArrayList<>();
|
| | | for (int i = 0; i < 20; i++) {
|
| | | CommonContentNav gc = new CommonContentNav();
|
| | | gc.setCid((i + 1L) + "");
|
| | | if (i == 1) {
|
| | | gc.setName("测试" + i);
|
| | | gc.setPicture(
|
| | | "http://e.hiphotos.baidu.com/zhidao/pic/item/37d3d539b6003af3be51388a322ac65c1138b675.jpg");
|
| | | } else if (i == 2) {
|
| | | gc.setName("");
|
| | | gc.setPicture(
|
| | | "http://e.hiphotos.baidu.com/zhidao/pic/item/37d3d539b6003af3be51388a322ac65c1138b675.jpg");
|
| | | } else {
|
| | | gc.setName("测试" + i);
|
| | | }
|
| | | list.add(gc);
|
| | | }
|
| | | List<CommonContentNav> list = commonTemplateContentService.getNavList(CommonContentTypeEnum.valueOf(key));
|
| | | out.print(JsonUtil.loadTrueResult(new Gson().toJson(list)));
|
| | | }
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | CommonContentResult result = commonTemplateContentService.getContentList(CommonContentTypeEnum.valueOf(key),
|
| | | cid, page, Constant.PAGE_SIZE);
|
| | |
|
| | | // 保留暂时不开启,待后续开启
|
| | | List<SwiperPicture> bannerList = new ArrayList<>();
|
| | | try {
|
| | | bannerList = swiperPictureService.getByBannerCard("index_top");
|
| | | } catch (SwiperPictureException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | if (page == 1)
|
| | | root.put("bannerList", new Gson().toJson(bannerList));
|
| | | |
| | | root.put("goodsCount", 200);
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setKey("鞋");
|
| | | sf.setPage(page);
|
| | | sf.setPageSize(20);
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create();
|
| | | BigDecimal pro = hongBaoManageService.getFanLiRate();
|
| | | List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.searchWuLiao(sf).getTaoBaoGoodsBriefs();
|
| | | List<TaoBaoGoodsBrief> goodsList = result.getGoodsList();
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, pro.toString(), "")));
|
| | | }
|
| | |
|
| | | root.put("goodsList", array);
|
| | | |
| | |
|
| | | root.put("goodsCount", result.getCount());
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | |
| | | public void updateApp(AcceptData acceptData, PrintWriter out) {
|
| | | Map<String, String> params = new HashMap<>();
|
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform())) {// android更新
|
| | | acceptData.setVersion("10");
|
| | | // acceptData.setVersion("10");
|
| | | params.put("method", "update");
|
| | | params.put("Platform", "Android");
|
| | | params.put("Version", acceptData.getVersion());
|
| | |
| | | String hongBao = null;
|
| | |
|
| | | // 获取券信息
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponInfo())) {
|
| | | if (!StringUtil.isNullOrEmpty(tb.getCouponInfo()) && tb.getCouponAmount() != null
|
| | | && tb.getCouponAmount().compareTo(new BigDecimal(0)) > 0 && tb.getCouponEffectiveStartTime() != null
|
| | | && tb.getCouponEffectiveEndTime() != null) {
|
| | | BigDecimal quanPrice = TaoBaoUtil.getAfterUseCouplePrice(tb);
|
| | | JSONObject couponInfo = new JSONObject();
|
| | | couponInfo.put("couponPrice", MoneyBigDecimalUtil.getWithNoZera(quanPrice).toString());
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsCacheUtil taoBaoGoodsCacheUtil;
|
| | | |
| | |
|
| | | @Resource
|
| | | private TaoBaoShopService taoBaoShopService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
| | |
|
| | | historySearchService.addHistorySearch(kw, bid);
|
| | |
|
| | | // BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | // acceptData.getPackages());
|
| | | // if (system == null) {
|
| | | // out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | // return;
|
| | | // }
|
| | | // BusinessSystem system =
|
| | | // businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | // acceptData.getPackages());
|
| | | // if (system == null) {
|
| | | // out.print(JsonUtil.loadFalseResult("系统不存在"));
|
| | | // return;
|
| | | // }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(kw) && (kw.startsWith("http://") || kw.startsWith("https://"))) {
|
| | | out.print(JsonUtil.loadFalseResult("无法搜索链接"));
|
| | |
| | | if (listRecommendWords == null || listRecommendWords.size() == 0) {
|
| | | listRecommendWords = new ArrayList<String>();
|
| | | }
|
| | | |
| | |
|
| | | List<TaoBaoShopVO> listShop = taoBaoShopService.getShopByKey(kw);
|
| | | if (listShop != null && listShop.size() > 0) {
|
| | | if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoods() != null
|
| | | && listShop.get(0).getListGoods().size() > 2) {
|
| | | data.put("shop", JsonUtil.getApiCommonGson().toJson(listShop.get(0)));
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | private JSONObject searchDaTaoKeGoods(String key, int page, String filter, String order, String startprice,
|
| | | String endprice) {
|
| | | page=page+1;
|
| | | page = page + 1;
|
| | | int sort = DaTaoKeApiUtil.SORT_DEFAULT;
|
| | | if ("5".equalsIgnoreCase(order)) {
|
| | | sort = DaTaoKeApiUtil.SORT_COMMISSION;
|
| | |
| | | List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.search(key, null, page, 20, sort);
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.search(key, null,null,null, page, 20, sort);
|
| | | if (result != null && result.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 goods : result.getGoodsList()) {
|
| | | listExtra.add(
|
| | |
| | | ClientTextStyleVO desc = dynamicInfo.getDesc();
|
| | | String content = desc.getContent();
|
| | | int index = content.indexOf("¥");
|
| | | data.put("shareMoney", new BigDecimal(content.substring(index + 1, content.length())));
|
| | | data.put("shareMoney", new BigDecimal(content.substring(index + 1, content.length())).toString());
|
| | |
|
| | | // 分享提醒
|
| | | data.put("notifyDesc", configService.get("goods_share_notify"));
|
| | |
| | |
|
| | | } else
|
| | | vo.setRead(true);
|
| | | |
| | | if(StringUtil.isNullOrEmpty(vo.getLatestMsg()))
|
| | | vo.setLatestMsg("[点击打开人工客服]");
|
| | |
|
| | | return vo;
|
| | | }
|
| | |
| | | package com.yeshi.fanli.dao.mybatis.taobao.dataoke; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | * @return |
| | | */ |
| | | List<DaTaoKeDetail> listByIds(@Param("idList") List<Long> idList); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 取出最新的id |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | List<DaTaoKeDetail> getGoodsNotInList(@Param("cid") Long cid, @Param("list") List<Long> list, @Param("count") int count); |
| | | |
| | | List<DaTaoKeDetail> getGoodsNotInList(@Param("cid") Long cid, @Param("list") List<Long> list, |
| | | @Param("count") int count); |
| | | |
| | | /** |
| | | * 根据标题查询 |
| | |
| | | * @return |
| | | */ |
| | | Long countSearchByTitleWithCid(@Param("title") String key, @Param("cid") Long cid); |
| | | |
| | | |
| | | /** |
| | | * 根据店铺id查询 |
| | | * |
| | | * @param start |
| | | * @param count |
| | | * @param sellerId |
| | | * @return |
| | | */ |
| | | public List<DaTaoKeDetail> listBySellerId( @Param("start")long start, @Param("count")int count, @Param("sellerId")Long sellerId); |
| | | |
| | | public List<DaTaoKeDetail> listBySellerId(@Param("start") long start, @Param("count") int count, |
| | | @Param("sellerId") Long sellerId); |
| | | |
| | | List<DaTaoKeDetail> listByCidAndMaxMinPrice(@Param("cid") Integer cid, @Param("maxPrice") BigDecimal maxPrice, |
| | | @Param("minPrice") BigDecimal minPrice, @Param("start") long start, @Param("count") int count); |
| | | |
| | | Long countByCidAndMaxMinPrice(@Param("cid") Integer cid, @Param("maxPrice") BigDecimal maxPrice, |
| | | @Param("minPrice") BigDecimal minPrice); |
| | | } |
| | |
| | | private String cid;
|
| | | private String name;
|
| | | private String picture;
|
| | | |
| | | public CommonContentNav() {
|
| | | }
|
| | | public CommonContentNav(String cid, String name) {
|
| | | this.cid = cid;
|
| | | this.name = name;
|
| | | }
|
| | |
|
| | | public String getCid() {
|
| | | return cid;
|
New file |
| | |
| | | package com.yeshi.fanli.dto.common;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | public class CommonContentResult {
|
| | | private List<TaoBaoGoodsBrief> goodsList;
|
| | | private long count;
|
| | |
|
| | | public List<TaoBaoGoodsBrief> getGoodsList() {
|
| | | return goodsList;
|
| | | }
|
| | |
|
| | | public void setGoodsList(List<TaoBaoGoodsBrief> goodsList) {
|
| | | this.goodsList = goodsList;
|
| | | }
|
| | |
|
| | | public long getCount() {
|
| | | return count;
|
| | | }
|
| | |
|
| | | public void setCount(long count) {
|
| | | this.count = count;
|
| | | }
|
| | |
|
| | | public CommonContentResult(List<TaoBaoGoodsBrief> goodsList, long count) {
|
| | | this.goodsList = goodsList;
|
| | | this.count = count;
|
| | | }
|
| | |
|
| | | public CommonContentResult() {
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.common;
|
| | |
|
| | | public enum CommonContentTypeEnum {
|
| | |
|
| | | _9k9("9块9"), haoQuan("高额好券"), chaoSheng("超级省钱"), muYin("母婴精选"), reMai("潮品热卖"), meiShi("优选美食"), juJia("居家生活");
|
| | | private final String desc;
|
| | |
|
| | | private CommonContentTypeEnum(String desc) {
|
| | | this.desc = desc;
|
| | | }
|
| | |
|
| | | public String getDesc() {
|
| | | return desc;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Field
|
| | | private String couponLink;// 领券链接
|
| | | @Field
|
| | | private Date couponEndTime;// 优惠券结束时间
|
| | | private String couponEndTime;// 优惠券结束时间
|
| | | @Field
|
| | | private Date couponStartTime;// 优惠券开始时间
|
| | | private String couponStartTime;// 优惠券开始时间
|
| | | @Field
|
| | | private BigDecimal couponPrice;// 优惠券金额
|
| | | @Field
|
| | |
| | | @Field
|
| | | private Integer activityType;// 活动类型,1-无活动,2-淘抢购,3-聚划算
|
| | | @Field
|
| | | private Date createTime;// 商品创建时间
|
| | | private String createTime;// 商品创建时间
|
| | | @Field
|
| | | private String mainPic;// 商品主图链接
|
| | | @Field
|
| | |
| | | this.couponLink = couponLink;
|
| | | }
|
| | |
|
| | | public Date getCouponEndTime() {
|
| | | public String getCouponEndTime() {
|
| | | return couponEndTime;
|
| | | }
|
| | |
|
| | | public void setCouponEndTime(Date couponEndTime) {
|
| | | public void setCouponEndTime(String couponEndTime) {
|
| | | this.couponEndTime = couponEndTime;
|
| | | }
|
| | |
|
| | | public Date getCouponStartTime() {
|
| | | public String getCouponStartTime() {
|
| | | return couponStartTime;
|
| | | }
|
| | |
|
| | | public void setCouponStartTime(Date couponStartTime) {
|
| | | public void setCouponStartTime(String couponStartTime) {
|
| | | this.couponStartTime = couponStartTime;
|
| | | }
|
| | |
|
| | |
| | | this.activityType = activityType;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | public String getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | public void setCreateTime(String createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | |
| | | |
| | | <select id="getGoodsNotInList" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_goods_dataoke` d |
| | | WHERE 1=1 |
| | | <if test="cid != null and cid !=0"> |
| | | AND d.`cid` = #{cid} |
| | | </if> |
| | | <if test="list != null"> |
| | | AND d.`id` NOT IN <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </if> |
| | | WHERE 1=1 |
| | | <if test="cid != null and cid !=0"> |
| | | AND d.`cid` = #{cid} |
| | | </if> |
| | | <if test="list != null"> |
| | | AND d.`id` NOT IN |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </if> |
| | | ORDER BY RAND() LIMIT #{count} |
| | | </select> |
| | | |
| | |
| | | |
| | | |
| | | <select id="listBySellerId" resultMap="BaseResultMap"> |
| | | select <include refid="Base_Column_List" /> from yeshi_ec_goods_dataoke |
| | | where seller_id = #{sellerId} |
| | | order by update_time desc |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_goods_dataoke |
| | | where seller_id = #{sellerId} |
| | | order by |
| | | update_time desc |
| | | limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByCidAndMaxMinPrice" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_goods_dataoke |
| | | where 1 = 1 |
| | | <if test="cid!=null"> |
| | | and cid=#{cid} |
| | | </if> |
| | | |
| | | <if test="maxPrice!=null"> |
| | | and #{maxPrice}>price |
| | | </if> |
| | | |
| | | <if test="minPrice!=null"> |
| | | and price>=#{minPrice} |
| | | </if> |
| | | order by update_time desc |
| | | limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countByCidAndMaxMinPrice" resultType="java.lang.Long"> |
| | | select count(id) from yeshi_ec_goods_dataoke |
| | | where 1 = 1 |
| | | <if test="cid!=null"> |
| | | and cid=#{cid} |
| | | </if> |
| | | |
| | | <if test="maxPrice!=null"> |
| | | and #{maxPrice}>price |
| | | </if> |
| | | |
| | | <if test="minPrice!=null"> |
| | | and price>=#{minPrice} |
| | | </if> |
| | | order by update_time desc |
| | | limit #{start},#{count} |
| | | </select> |
| | | |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dto.common.CommonContentNav;
|
| | | import com.yeshi.fanli.dto.common.CommonContentResult;
|
| | | import com.yeshi.fanli.dto.common.CommonContentTypeEnum;
|
| | | import com.yeshi.fanli.dto.dataoke.DaTaoKeGoodsResult;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
|
| | | @Service
|
| | | public class CommonTemplateContentServiceImpl implements CommonTemplateContentService {
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | @Override
|
| | | public List<CommonContentNav> getNavList(CommonContentTypeEnum type) {
|
| | | List<CommonContentNav> navList = new ArrayList<>();
|
| | | if (type == CommonContentTypeEnum._9k9) {
|
| | | navList.add(new CommonContentNav("-1", "综合"));
|
| | | navList.add(new CommonContentNav("0", "最新"));
|
| | | for (GoodsClass gc : DaTaoKeUtil.goodsClasses) {
|
| | | navList.add(new CommonContentNav(gc.getId() + "", gc.getName()));
|
| | | }
|
| | | } else if (type == CommonContentTypeEnum.chaoSheng) {
|
| | | navList.add(new CommonContentNav("1", "5%~10%返利"));
|
| | | navList.add(new CommonContentNav("2", "10%~20%返利"));
|
| | | navList.add(new CommonContentNav("3", "20%~30%返利"));
|
| | | navList.add(new CommonContentNav("4", "30%~40%返利"));
|
| | | navList.add(new CommonContentNav("5", "40%以上返利"));
|
| | | } else if (type == CommonContentTypeEnum.haoQuan) {
|
| | | navList.add(new CommonContentNav("1", "5~10元券"));
|
| | | navList.add(new CommonContentNav("2", "10~30元券"));
|
| | | navList.add(new CommonContentNav("3", "30~50元券"));
|
| | | navList.add(new CommonContentNav("4", "50元以上券"));
|
| | | } else if (type == CommonContentTypeEnum.juJia) {
|
| | | navList.add(new CommonContentNav("1", "综合"));
|
| | | navList.add(new CommonContentNav("2", "最新"));
|
| | | navList.add(new CommonContentNav("3", "热卖"));
|
| | | navList.add(new CommonContentNav("4", "销量"));
|
| | | navList.add(new CommonContentNav("5", "返利比"));
|
| | | } else if (type == CommonContentTypeEnum.meiShi) {
|
| | | navList.add(new CommonContentNav("1", "综合"));
|
| | | navList.add(new CommonContentNav("2", "最新"));
|
| | | navList.add(new CommonContentNav("3", "热卖"));
|
| | | navList.add(new CommonContentNav("4", "销量"));
|
| | | navList.add(new CommonContentNav("5", "返利比"));
|
| | | } else if (type == CommonContentTypeEnum.muYin) {
|
| | | navList.add(new CommonContentNav("1", "精选"));
|
| | | navList.add(new CommonContentNav("2", "备孕"));
|
| | | navList.add(new CommonContentNav("3", "0~6月"));
|
| | | navList.add(new CommonContentNav("4", "7~12月"));
|
| | | navList.add(new CommonContentNav("5", "1~3岁"));
|
| | | navList.add(new CommonContentNav("6", "4~6岁"));
|
| | | navList.add(new CommonContentNav("7", "7~12岁"));
|
| | | } else if (type == CommonContentTypeEnum.reMai) {
|
| | | navList.add(new CommonContentNav("1", "综合"));
|
| | | navList.add(new CommonContentNav("2", "最新"));
|
| | | navList.add(new CommonContentNav("3", "热卖"));
|
| | | navList.add(new CommonContentNav("4", "销量"));
|
| | | navList.add(new CommonContentNav("5", "返利比"));
|
| | | }
|
| | | return navList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public CommonContentResult getContentList(CommonContentTypeEnum type, String cid, int page, int pageSize) {
|
| | | if (type == CommonContentTypeEnum._9k9)
|
| | | return get9K9Content(cid, page, pageSize);
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | private CommonContentResult get9K9Content(String cid, int page, int pageSize) {
|
| | | DaTaoKeGoodsResult result = null;
|
| | | if ("-1".equalsIgnoreCase(cid)) {
|
| | | result = DaTaoKeApiUtil.search("", null, null, new BigDecimal("10"), page, pageSize,
|
| | | DaTaoKeApiUtil.SORT_DEFAULT);
|
| | |
|
| | | } else if ("0".equalsIgnoreCase(cid)) {
|
| | | result = DaTaoKeApiUtil.search("", null, null, new BigDecimal("10"), page, pageSize,
|
| | | DaTaoKeApiUtil.SORT_CREATETIME);
|
| | | } else {
|
| | | List<Integer> cidList = new ArrayList<>();
|
| | | cidList.add(Integer.parseInt(cid));
|
| | | result = DaTaoKeApiUtil.search("", cidList, null, new BigDecimal("10"), page, pageSize,
|
| | | DaTaoKeApiUtil.SORT_DEFAULT);
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | long count = 0;
|
| | | if (result != null) {
|
| | | count = result.getTotalCount();
|
| | | if (result.getGoodsList() != null)
|
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList())
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | }
|
| | | return new CommonContentResult(goodsList, count);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | | int maxOrder = homeNavbarMapper.getMaxOrder();
|
| | | record.setOrderby(maxOrder + 1);
|
| | | |
| | | record.setIsFixed(false);//目前无固定项
|
| | | homeNavbarMapper.insert(record);
|
| | | } else {
|
| | | // 修改
|
| | |
| | | record.setOrderby(resultObj.getOrderby());
|
| | | record.setCreatetime(resultObj.getCreatetime());
|
| | | record.setUpdatetime(new Date());
|
| | | record.setIsFixed(false);//目前无固定项
|
| | | homeNavbarMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | |
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.homemodule.SpecialMapper;
|
| | | import com.yeshi.fanli.dto.common.CommonContentTypeEnum;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | |
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialPlaceService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | | import sun.security.krb5.internal.ccache.CCacheInputStream;
|
| | |
| | | arcMap.put("bottomPicture", special.getBottomPicture());
|
| | | }
|
| | | }
|
| | |
|
| | | // 处理9.9包邮
|
| | | if (listArc != null && VersionUtil.greaterThan_1_5_50(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | for (Special s : listArc) {
|
| | | if (s.getName().contains("9.9")) {// 9块9
|
| | | s.setJumpDetail(jumpDetailV2Service.getByTypeCache("common_template"));
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("key", CommonContentTypeEnum._9k9.name());
|
| | | params.put("title", CommonContentTypeEnum._9k9.getDesc());
|
| | | s.setParams(params.toString());
|
| | | }
|
| | | }
|
| | |
|
| | | // 数据处理
|
| | | handlelist(listArc);
|
| | | arcMap.put("list", JsonUtil.getApiCommonGson().toJson(listArc));
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Service
|
| | | public class TaoKeGoodsServiceImpl implements TaoKeGoodsService {
|
| | |
| | | JSONArray arrayGoods = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | |
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | |
| | | int fh = sf.getHongbao();
|
| | | boolean ft = sf.isTmall();
|
| | |
|
| | | Map<String, String> map = manageService.convertMap();
|
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | |
|
| | | if (fq == 0 && fh == 0 && !ft) {
|
| | |
| | | if (!StringUtil.isNullOrEmpty(startBiz30day)) {
|
| | | int biz30day = Integer.parseInt(startBiz30day);
|
| | | if (count < biz30day) {
|
| | | break;
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | package com.yeshi.fanli.service.impl.taobao.dataoke;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | |
| | | return daTaoKeDetailMapper.getGoodsNotInList(cid, listId, count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetail> listByCidAndMaxPrice(Integer cid, BigDecimal maxPrice, int page, int pageSize) {
|
| | | return daTaoKeDetailMapper.listByCidAndMaxMinPrice(cid, maxPrice, null, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countByCidAndMaxPrice(Integer cid, BigDecimal maxPrice) {
|
| | |
|
| | | return daTaoKeDetailMapper.countByCidAndMaxMinPrice(cid, maxPrice, null);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | String startTime = null;
|
| | | DaTaoKeDetailV2 latest = daTaoKeGoodsDetailV2Dao.selectLatest();
|
| | | if (latest != null) {
|
| | | startTime = TimeUtil.getGernalTime(latest.getCreateTime().getTime(), "yyyy-MM-dd HH:mm:ss");
|
| | | startTime = latest.getCreateTime();
|
| | | }
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getNewGoodsList(null, startTime, null);
|
| | | while (!StringUtil.isNullOrEmpty(result.getPageId())) {
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.goods;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.common.CommonContentNav;
|
| | | import com.yeshi.fanli.dto.common.CommonContentResult;
|
| | | import com.yeshi.fanli.dto.common.CommonContentTypeEnum;
|
| | |
|
| | | /**
|
| | | * 商品模板内容服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface CommonTemplateContentService {
|
| | | /**
|
| | | * 获取导航栏
|
| | | * |
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public List<CommonContentNav> getNavList(CommonContentTypeEnum type);
|
| | |
|
| | | /**
|
| | | * 获取内容列表
|
| | | * |
| | | * @param type
|
| | | * @param cid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public CommonContentResult getContentList(CommonContentTypeEnum type, String cid, int page, int pageSize);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.taobao.dataoke;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | */
|
| | | public List<DaTaoKeDetail> listByIds(List<Long> idList);
|
| | |
|
| | | |
| | | /**
|
| | | * 查询一类全部
|
| | | * |
| | | * @param cid
|
| | | * @param listId
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetail> getGoodsNotInList(Long cid, List<Long> listId, int count);
|
| | | |
| | | /* 根据标题查询
|
| | |
|
| | | /*
|
| | | * 根据标题查询
|
| | | * |
| | | * @param dtitle
|
| | | * |
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetail> listByDtitle(String dtitle);
|
| | |
| | | */
|
| | | public Long countSearchByTitleWithCid(String title, Long cid);
|
| | |
|
| | | /**
|
| | | * 根据分类ID与最大券后价检索
|
| | | * |
| | | * @param cid
|
| | | * @param maxPrice
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetail> listByCidAndMaxPrice(Integer cid, BigDecimal maxPrice, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 根据分类ID与最大券后价检索数量
|
| | | * @param cid
|
| | | * @param maxPrice
|
| | | * @return
|
| | | */
|
| | | public Long countByCidAndMaxPrice(Integer cid, BigDecimal maxPrice);
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | |
| | | params.put("version", "v1.0.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("pageSize", 200 + "");
|
| | | // params.put("sort", "1");
|
| | | // params.put("sort", "1");
|
| | | if (!StringUtil.isNullOrEmpty(pageId)) {
|
| | | params.put("pageId", pageId);
|
| | | }
|
| | |
| | | return daTaoKeGoodsResult;
|
| | | }
|
| | |
|
| | | public static DaTaoKeGoodsResult search(String key, List<Integer> cidList, int page, int pageSize, int sort) {
|
| | | public static DaTaoKeDetailV2 getGoodsDetail(Long id) {
|
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("id", id + "");
|
| | | params.put("sign", getSign(params, app.getAppSecret()));
|
| | | String result = HttpUtil.get("https://openapi.dataoke.com/api/goods/get-goods-details", params,
|
| | | new HashMap<>());
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | JSONObject dataJson = json.optJSONObject("data");
|
| | | if (dataJson != null) {
|
| | | return gson.fromJson(dataJson.toString(), DaTaoKeDetailV2.class);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static DaTaoKeGoodsResult search(String key, List<Integer> cidList, BigDecimal priceLowerLimit,
|
| | | BigDecimal priceUpperLimit, int page, int pageSize, int sort) {
|
| | |
|
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | | Map<String, String> params = new TreeMap<>();
|
| | | params.put("version", "v1.0.0");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("pageSize", 200 + "");
|
| | | params.put("pageSize", pageSize + "");
|
| | | params.put("pageId", page + "");
|
| | |
|
| | | if (priceLowerLimit != null)
|
| | | params.put("priceLowerLimit", priceLowerLimit + "");
|
| | | if (priceUpperLimit != null)
|
| | | params.put("priceUpperLimit", priceUpperLimit + "");
|
| | | String cids = "";
|
| | | if (cidList != null && cidList.size() > 0)
|
| | | for (Integer cid : cidList) {
|
| | |
| | | params.put("sign", getSign(params, app.getAppSecret()));
|
| | | String result = HttpUtil.get("https://openapi.dataoke.com/api/goods/get-dtk-search-goods", params,
|
| | | new HashMap<>());
|
| | |
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | JSONObject dataJson = json.optJSONObject("data");
|
| | | if (dataJson != null) {
|
| | |
| | | }
|
| | |
|
| | | public static TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods, DaTaoKeDetail detail) {
|
| | | if (detail != null) {
|
| | | if (detail != null && goods != null) {
|
| | | // 重新设置标题与券价格
|
| | | goods.setTitle(detail.getdTitle());
|
| | | if (goods.getCouponAmount() != null && detail.getQuanPrice() != null
|
| | | && goods.getCouponAmount().compareTo(detail.getQuanPrice()) < 0)
|
| | | goods.setCouponAmount(detail.getQuanPrice());
|
| | | goods.setZkPrice(detail.getOrgPrice());
|
| | | if (new BigDecimal(detail.getQuanCondition()).compareTo(new BigDecimal(0)) > 0)
|
| | | goods.setCouponInfo(String.format("满%s元减%s元", detail.getQuanCondition(),
|
| | | MoneyBigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString()));
|
| | | else
|
| | | goods.setCouponInfo(String.format("%s元无条件券", goods.getCouponAmount()));
|
| | | }
|
| | | return goods;
|
| | | }
|
| | |
|
| | | public static TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods, DaTaoKeDetailV2 detail) {
|
| | | if (detail != null) {
|
| | | if (detail != null && goods != null) {
|
| | | // 重新设置标题与券价格
|
| | | goods.setTitle(detail.getDtitle());
|
| | | if (goods.getCouponAmount() != null && detail.getCouponPrice() != null
|
| | | && goods.getCouponAmount().compareTo(detail.getCouponPrice()) < 0)
|
| | | goods.setCouponAmount(detail.getCouponPrice());
|
| | | goods.setZkPrice(detail.getOriginalPrice());
|
| | | if (new BigDecimal(detail.getCouponConditions()).compareTo(new BigDecimal(0)) > 0)
|
| | | goods.setCouponInfo(String.format("满%s元减%s元", detail.getCouponConditions(),
|
| | | MoneyBigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString()));
|
| | | else
|
| | | goods.setCouponInfo(String.format("%s元无条件券", goods.getCouponAmount()));
|
| | | }
|
| | | return goods;
|
| | | }
|
| | |
| | | taoBaoGoods.setCouponLeftCount(detail.getCouponTotalNum() - detail.getCouponReceiveNum());
|
| | | else
|
| | | taoBaoGoods.setCouponLeftCount(0);
|
| | | taoBaoGoods.setCouponStartFee(new BigDecimal(detail.getCouponConditions()));
|
| | | taoBaoGoods.setCouponStartFee(detail.getOriginalPrice());
|
| | | taoBaoGoods.setCouponTotalCount(detail.getCouponTotalNum());
|
| | | taoBaoGoods.setPictUrl(detail.getMainPic());
|
| | | taoBaoGoods.setPictUrlWhite(detail.getMainPic());
|