3个文件已删除
40个文件已修改
13个文件已添加
New file |
| | |
| | | package com.yeshi.goods.facade.dto.taobao.haodanku; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | public class HaoDanKuJDGoodsInfo { |
| | | |
| | | |
| | | /** |
| | | * skuid : 10027627962896 |
| | | * goodsname : 一次性柔软珍珠纹卷筒式洗脸巾 三卷 |
| | | * goodsnameshort : 一次性柔软珍珠纹卷筒式洗脸巾 三卷 |
| | | * goodsdesc : 京东商城,品质无忧,万里挑一! |
| | | * itemprice : 8.50 |
| | | * itemendprice : 8.90 |
| | | * itemsale : 7658 |
| | | * itemsale2 : 477 |
| | | * todaysale : 1037 |
| | | * itempic : http://img14.360buyimg.com/imgzone/jfs/t1/175520/4/17098/128960/60d98958Ea8ed8d2c/6593bd71c0abb7a1.jpg |
| | | * cid : 4 |
| | | * commissionshare : 40.00 |
| | | * commission : 3.56 |
| | | * couponurl : http://coupon.m.jd.com/coupons/show.action?key=45d5f2d9b5464b3393dbeda433342b0e&roleId=54583615&to=mall.jd.com/index-10406960.html |
| | | * couponmoney : 1 |
| | | * couponnum : 1000000 |
| | | * couponstarttime : 1624809600 |
| | | * couponendtime : 1625673599 |
| | | * jd_image : https://img14.360buyimg.com/pop/jfs/t1/175520/4/17098/128960/60d98958Ea8ed8d2c/6593bd71c0abb7a1.jpg,https://img14.360buyimg.com/pop/jfs/t1/168932/31/11927/91829/604b2457E41481d3d/a2e1e65a5849eae0.jpg,https://img14.360buyimg.com/pop/jfs/t1/170815/35/5445/575765/601ba3b3Ee81103a1/fa461e7210a6d060.jpg |
| | | * shopname : 泽成彩妆工具拼购专营店 |
| | | */ |
| | | |
| | | private String skuid; |
| | | private String goodsname; |
| | | private String goodsnameshort; |
| | | private String goodsdesc; |
| | | private BigDecimal itemprice; |
| | | private BigDecimal itemendprice; |
| | | private String itemsale; |
| | | private String itemsale2; |
| | | private String todaysale; |
| | | private String itempic; |
| | | private String cid; |
| | | private BigDecimal commissionshare; |
| | | private BigDecimal commission; |
| | | private String couponurl; |
| | | private BigDecimal couponmoney; |
| | | private Integer couponnum; |
| | | private String couponstarttime; |
| | | private String couponendtime; |
| | | private String jd_image; |
| | | private String shopname; |
| | | |
| | | public String getSkuid() { |
| | | return skuid; |
| | | } |
| | | |
| | | public void setSkuid(String skuid) { |
| | | this.skuid = skuid; |
| | | } |
| | | |
| | | public String getGoodsname() { |
| | | return goodsname; |
| | | } |
| | | |
| | | public void setGoodsname(String goodsname) { |
| | | this.goodsname = goodsname; |
| | | } |
| | | |
| | | public String getGoodsnameshort() { |
| | | return goodsnameshort; |
| | | } |
| | | |
| | | public void setGoodsnameshort(String goodsnameshort) { |
| | | this.goodsnameshort = goodsnameshort; |
| | | } |
| | | |
| | | public String getGoodsdesc() { |
| | | return goodsdesc; |
| | | } |
| | | |
| | | public void setGoodsdesc(String goodsdesc) { |
| | | this.goodsdesc = goodsdesc; |
| | | } |
| | | |
| | | public BigDecimal getItemprice() { |
| | | return itemprice; |
| | | } |
| | | |
| | | public void setItemprice(BigDecimal itemprice) { |
| | | this.itemprice = itemprice; |
| | | } |
| | | |
| | | public BigDecimal getItemendprice() { |
| | | return itemendprice; |
| | | } |
| | | |
| | | public void setItemendprice(BigDecimal itemendprice) { |
| | | this.itemendprice = itemendprice; |
| | | } |
| | | |
| | | public String getItemsale() { |
| | | return itemsale; |
| | | } |
| | | |
| | | public void setItemsale(String itemsale) { |
| | | this.itemsale = itemsale; |
| | | } |
| | | |
| | | public String getItemsale2() { |
| | | return itemsale2; |
| | | } |
| | | |
| | | public void setItemsale2(String itemsale2) { |
| | | this.itemsale2 = itemsale2; |
| | | } |
| | | |
| | | public String getTodaysale() { |
| | | return todaysale; |
| | | } |
| | | |
| | | public void setTodaysale(String todaysale) { |
| | | this.todaysale = todaysale; |
| | | } |
| | | |
| | | public String getItempic() { |
| | | return itempic; |
| | | } |
| | | |
| | | public void setItempic(String itempic) { |
| | | this.itempic = itempic; |
| | | } |
| | | |
| | | public String getCid() { |
| | | return cid; |
| | | } |
| | | |
| | | public void setCid(String cid) { |
| | | this.cid = cid; |
| | | } |
| | | |
| | | public BigDecimal getCommissionshare() { |
| | | return commissionshare; |
| | | } |
| | | |
| | | public void setCommissionshare(BigDecimal commissionshare) { |
| | | this.commissionshare = commissionshare; |
| | | } |
| | | |
| | | public BigDecimal getCommission() { |
| | | return commission; |
| | | } |
| | | |
| | | public void setCommission(BigDecimal commission) { |
| | | this.commission = commission; |
| | | } |
| | | |
| | | public String getCouponurl() { |
| | | return couponurl; |
| | | } |
| | | |
| | | public void setCouponurl(String couponurl) { |
| | | this.couponurl = couponurl; |
| | | } |
| | | |
| | | public BigDecimal getCouponmoney() { |
| | | return couponmoney; |
| | | } |
| | | |
| | | public void setCouponmoney(BigDecimal couponmoney) { |
| | | this.couponmoney = couponmoney; |
| | | } |
| | | |
| | | public Integer getCouponnum() { |
| | | return couponnum; |
| | | } |
| | | |
| | | public void setCouponnum(Integer couponnum) { |
| | | this.couponnum = couponnum; |
| | | } |
| | | |
| | | public String getCouponstarttime() { |
| | | return couponstarttime; |
| | | } |
| | | |
| | | public void setCouponstarttime(String couponstarttime) { |
| | | this.couponstarttime = couponstarttime; |
| | | } |
| | | |
| | | public String getCouponendtime() { |
| | | return couponendtime; |
| | | } |
| | | |
| | | public void setCouponendtime(String couponendtime) { |
| | | this.couponendtime = couponendtime; |
| | | } |
| | | |
| | | public String getJd_image() { |
| | | return jd_image; |
| | | } |
| | | |
| | | public void setJd_image(String jd_image) { |
| | | this.jd_image = jd_image; |
| | | } |
| | | |
| | | public String getShopname() { |
| | | return shopname; |
| | | } |
| | | |
| | | public void setShopname(String shopname) { |
| | | this.shopname = shopname; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.goods.facade.dto.taobao.haodanku; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class HaoDanKuListResult { |
| | | private List resultList; |
| | | private Integer minId; |
| | | |
| | | public HaoDanKuListResult(List resultList, Integer minId) { |
| | | this.resultList = resultList; |
| | | this.minId = minId; |
| | | } |
| | | |
| | | public List getResultList() { |
| | | return resultList; |
| | | } |
| | | |
| | | public void setResultList(List resultList) { |
| | | this.resultList = resultList; |
| | | } |
| | | |
| | | public Integer getMinId() { |
| | | return minId; |
| | | } |
| | | |
| | | public void setMinId(Integer minId) { |
| | | this.minId = minId; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.goods.facade.dto.taobao.haodanku; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | public class HaoDanKuPDDGoodsInfo { |
| | | |
| | | |
| | | /** |
| | | * goods_id : 256892844228 |
| | | * goods_sign : Y9r2mbpPRlBKj3phwfjZN_gIiyLN0ykW_JQzhTIuSsL |
| | | * zs_duo_id : 11138663 |
| | | * goodsname : 正品洗头发水水去屑顺柔修护控油洗头发露持久留香男女通用 |
| | | * goodsnameshort : 正品洗头发水水去屑顺柔修护控油洗头发露持久留香男女通用 |
| | | * goodsdesc : 正品洗头发水水去屑顺柔修护控油洗头发露持久留香男女通用 |
| | | * itemprice : 39.90 |
| | | * itemendprice : 19.90 |
| | | * itemsale : 3020 |
| | | * itemsale2 : 249 |
| | | * todaysale : 1013 |
| | | * itempic : https://img.pddpic.com/mms-material-img/2021-05-17/b2ba1c69-6120-4829-8d90-a362391c45eb.jpeg.a.jpeg |
| | | * cid : 14 |
| | | * promotion_rate : 27.00 |
| | | * commission : 5.37 |
| | | * couponmoney : 20 |
| | | * couponnum : 5000 |
| | | * couponstarttime : 1624809600 |
| | | * couponendtime : 1627401599 |
| | | * pdd_image : https://img.pddpic.com/mms-material-img/2021-05-17/b2ba1c69-6120-4829-8d90-a362391c45eb.jpeg.a.jpeg,https://t16img.yangkeduo.com/garner-api/00860d6790e3dbe527830b368080bede.jpeg,https://t16img.yangkeduo.com/garner-api/08107712a286faf46408f530895fa465.jpeg,https://t16img.yangkeduo.com/garner-api/a237430f62873b82952b6a31e07f4674.jpeg,https://img.pddpic.com/mms-material-img/2021-05-17/21919094-8edb-4b35-be76-b94b392df134.jpeg.a.jpeg,https://img.pddpic.com/mms-material-img/2021-05-17/d477390e-ff35-4c7f-bb25-def84e213e49.jpeg.a.jpeg,https://img.pddpic.com/mms-material-img/2021-05-17/b9939d43-b00b-4c78-a4b4-f40cb8f5aa60.jpeg.a.jpeg,https://img.pddpic.com/mms-material-img/2021-05-17/29cfd381-b705-4040-a7d5-9fbb90664df2.jpeg.a.jpeg |
| | | * shopname : 艾漫家直发店 |
| | | * start_time : 1624809600 |
| | | */ |
| | | |
| | | private String goods_id; |
| | | private String goods_sign; |
| | | private String zs_duo_id; |
| | | private String goodsname; |
| | | private String goodsnameshort; |
| | | private String goodsdesc; |
| | | private BigDecimal itemprice; |
| | | private BigDecimal itemendprice; |
| | | private String itemsale; |
| | | private String itemsale2; |
| | | private String todaysale; |
| | | private String itempic; |
| | | private String cid; |
| | | private BigDecimal promotion_rate; |
| | | private BigDecimal commission; |
| | | private BigDecimal couponmoney; |
| | | private String couponnum; |
| | | private String couponstarttime; |
| | | private String couponendtime; |
| | | private String pdd_image; |
| | | private String shopname; |
| | | private String start_time; |
| | | |
| | | |
| | | public String getGoods_id() { |
| | | return goods_id; |
| | | } |
| | | |
| | | public void setGoods_id(String goods_id) { |
| | | this.goods_id = goods_id; |
| | | } |
| | | |
| | | public String getGoods_sign() { |
| | | return goods_sign; |
| | | } |
| | | |
| | | public void setGoods_sign(String goods_sign) { |
| | | this.goods_sign = goods_sign; |
| | | } |
| | | |
| | | public String getZs_duo_id() { |
| | | return zs_duo_id; |
| | | } |
| | | |
| | | public void setZs_duo_id(String zs_duo_id) { |
| | | this.zs_duo_id = zs_duo_id; |
| | | } |
| | | |
| | | public String getGoodsname() { |
| | | return goodsname; |
| | | } |
| | | |
| | | public void setGoodsname(String goodsname) { |
| | | this.goodsname = goodsname; |
| | | } |
| | | |
| | | public String getGoodsnameshort() { |
| | | return goodsnameshort; |
| | | } |
| | | |
| | | public void setGoodsnameshort(String goodsnameshort) { |
| | | this.goodsnameshort = goodsnameshort; |
| | | } |
| | | |
| | | public String getGoodsdesc() { |
| | | return goodsdesc; |
| | | } |
| | | |
| | | public void setGoodsdesc(String goodsdesc) { |
| | | this.goodsdesc = goodsdesc; |
| | | } |
| | | |
| | | public BigDecimal getItemprice() { |
| | | return itemprice; |
| | | } |
| | | |
| | | public void setItemprice(BigDecimal itemprice) { |
| | | this.itemprice = itemprice; |
| | | } |
| | | |
| | | public BigDecimal getItemendprice() { |
| | | return itemendprice; |
| | | } |
| | | |
| | | public void setItemendprice(BigDecimal itemendprice) { |
| | | this.itemendprice = itemendprice; |
| | | } |
| | | |
| | | public String getItemsale() { |
| | | return itemsale; |
| | | } |
| | | |
| | | public void setItemsale(String itemsale) { |
| | | this.itemsale = itemsale; |
| | | } |
| | | |
| | | public String getItemsale2() { |
| | | return itemsale2; |
| | | } |
| | | |
| | | public void setItemsale2(String itemsale2) { |
| | | this.itemsale2 = itemsale2; |
| | | } |
| | | |
| | | public String getTodaysale() { |
| | | return todaysale; |
| | | } |
| | | |
| | | public void setTodaysale(String todaysale) { |
| | | this.todaysale = todaysale; |
| | | } |
| | | |
| | | public String getItempic() { |
| | | return itempic; |
| | | } |
| | | |
| | | public void setItempic(String itempic) { |
| | | this.itempic = itempic; |
| | | } |
| | | |
| | | public String getCid() { |
| | | return cid; |
| | | } |
| | | |
| | | public void setCid(String cid) { |
| | | this.cid = cid; |
| | | } |
| | | |
| | | public BigDecimal getPromotion_rate() { |
| | | return promotion_rate; |
| | | } |
| | | |
| | | public void setPromotion_rate(BigDecimal promotion_rate) { |
| | | this.promotion_rate = promotion_rate; |
| | | } |
| | | |
| | | public BigDecimal getCommission() { |
| | | return commission; |
| | | } |
| | | |
| | | public void setCommission(BigDecimal commission) { |
| | | this.commission = commission; |
| | | } |
| | | |
| | | public BigDecimal getCouponmoney() { |
| | | return couponmoney; |
| | | } |
| | | |
| | | public void setCouponmoney(BigDecimal couponmoney) { |
| | | this.couponmoney = couponmoney; |
| | | } |
| | | |
| | | public String getCouponnum() { |
| | | return couponnum; |
| | | } |
| | | |
| | | public void setCouponnum(String couponnum) { |
| | | this.couponnum = couponnum; |
| | | } |
| | | |
| | | public String getCouponstarttime() { |
| | | return couponstarttime; |
| | | } |
| | | |
| | | public void setCouponstarttime(String couponstarttime) { |
| | | this.couponstarttime = couponstarttime; |
| | | } |
| | | |
| | | public String getCouponendtime() { |
| | | return couponendtime; |
| | | } |
| | | |
| | | public void setCouponendtime(String couponendtime) { |
| | | this.couponendtime = couponendtime; |
| | | } |
| | | |
| | | public String getPdd_image() { |
| | | return pdd_image; |
| | | } |
| | | |
| | | public void setPdd_image(String pdd_image) { |
| | | this.pdd_image = pdd_image; |
| | | } |
| | | |
| | | public String getShopname() { |
| | | return shopname; |
| | | } |
| | | |
| | | public void setShopname(String shopname) { |
| | | this.shopname = shopname; |
| | | } |
| | | |
| | | public String getStart_time() { |
| | | return start_time; |
| | | } |
| | | |
| | | public void setStart_time(String start_time) { |
| | | this.start_time = start_time; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.goods.facade.utils.factory; |
| | | |
| | | public class TaoBaoGoodsFactory { |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | parseTaoBaoToken("3.0微Ni3dX7WcGnT微 https://m.tb.cn/h.4vPHrmS?sm=3f931f 兰古仕电热蚊香液无味非灭蚊婴儿孕妇宝宝电蚊香器驱蚊液家用防蚊"); |
| | | parseTaoBaoToken("8\uD83D\uDC48嘻etMgX8V2M30信 https://m.tb.cn/h.4CFFCNf?sm=fb01ec 大码女装法式初恋复古超仙rouje碎花吊带小雏菊石原里美连衣裙子"); |
| | | } |
| | | } |
| | |
| | | package com.yeshi.goods.facade.utils.taobao; |
| | | |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Type; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.TypeAdapter; |
| | | import com.google.gson.TypeAdapterFactory; |
| | | import com.google.gson.stream.JsonReader; |
| | | import com.google.gson.stream.JsonToken; |
| | | import com.google.gson.stream.JsonWriter; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.*; |
| | | import org.yeshi.utils.HttpUtil; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HDKGoodsListResultDTO; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HDKSearchFilter; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HDKWXCircleContentDTO; |
| | | import com.yeshi.goods.facade.entity.taobao.haodanku.HDKGoodsDetail; |
| | | |
| | | import net.sf.json.JSONArray; |
| | |
| | | |
| | | /** |
| | | * 好单库API |
| | | * @author Administrator |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | public class HaoDanKuApiUtil { |
| | | |
| | |
| | | |
| | | /** |
| | | * 获取朋友圈API的内容 |
| | | * @Title: getSendWXCircleContent |
| | | * @Description: |
| | | * void 返回类型 |
| | | * |
| | | * @throws |
| | | * @Title: getSendWXCircleContent |
| | | * @Description: void 返回类型 |
| | | */ |
| | | public void getSendWXCircleContent(Integer minId) { |
| | | if (minId == null) |
| | |
| | | |
| | | /** |
| | | * 商品列表 |
| | | * @Title: listGoods |
| | | * @Description: |
| | | * |
| | | * @param minId |
| | | * @param catIds |
| | | * @param pageSize |
| | | * @return |
| | | * HDKGoodsListResultDTO 返回类型 |
| | | * @return HDKGoodsListResultDTO 返回类型 |
| | | * @throws |
| | | * @Title: listGoods |
| | | * @Description: |
| | | */ |
| | | // 详情:https://www.haodanku.com/api/detail/show/1.html |
| | | public HDKGoodsListResultDTO listGoods(Integer minId, List<Integer> catIds, int pageSize) { |
| | |
| | | |
| | | /** |
| | | * 商品列表筛选 |
| | | * |
| | | * @param filter |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 商品爆单列表 |
| | | * @Title: listGoods |
| | | * @Description: |
| | | * |
| | | * @param minId |
| | | * @param catIds |
| | | * @param pageSize |
| | | * @return |
| | | * HDKGoodsListResultDTO 返回类型 |
| | | * @return HDKGoodsListResultDTO 返回类型 |
| | | * @throws |
| | | * @Title: listGoods |
| | | * @Description: |
| | | */ |
| | | public HDKGoodsListResultDTO listHotGoods(Integer minId, int pageSize, int saleType, List<Integer> catIds) { |
| | | if (minId == null) |
| | |
| | | |
| | | /** |
| | | * 增量更新的商品 |
| | | * @Title: listAddGoods |
| | | * @Description: |
| | | * |
| | | * @param minId |
| | | * @param startHour |
| | | * @param endHour |
| | | * @param pageSize |
| | | * @return |
| | | * HDKGoodsListResultDTO 返回类型 |
| | | * @return HDKGoodsListResultDTO 返回类型 |
| | | * @throws |
| | | * @Title: listAddGoods |
| | | * @Description: |
| | | */ |
| | | public HDKGoodsListResultDTO listAddGoods(Integer minId, int startHour, int endHour, int pageSize) { |
| | | if (minId == null) |
| | |
| | | |
| | | /** |
| | | * 更新商品信息 |
| | | * |
| | | * @param minId |
| | | * @param pageSize void 返回类型 |
| | | * @throws |
| | | * @Title: listUpdateGoods |
| | | * @Description: |
| | | * @param minId |
| | | * @param pageSize |
| | | * void 返回类型 |
| | | * @throws |
| | | */ |
| | | public HDKGoodsListResultDTO listUpdateGoods(Integer minId, int pageSize) { |
| | | List<ParamsKeyValue> params = new ArrayList<HaoDanKuApiUtil.ParamsKeyValue>(); |
| | |
| | | |
| | | /** |
| | | * 拉取失效商品 |
| | | * @Title: listInvalidGoods |
| | | * @Description: |
| | | * |
| | | * @param startHour |
| | | * @param endHour |
| | | * @return |
| | | * List<Long> 返回类型 |
| | | * @return List<Long> 返回类型 |
| | | * @throws |
| | | * @Title: listInvalidGoods |
| | | * @Description: |
| | | */ |
| | | public List<Long> listInvalidGoods(int startHour, int endHour) { |
| | | List<ParamsKeyValue> params = new ArrayList<HaoDanKuApiUtil.ParamsKeyValue>(); |
| | |
| | | |
| | | /** |
| | | * 单品详情API |
| | | * |
| | | * @param itemid |
| | | * @return |
| | | */ |
| | |
| | | |
| | | JSONObject resultData = JSONObject.fromObject(result); |
| | | if (resultData.optInt("code") == 1) { |
| | | Type type = new TypeToken<HDKGoodsDetail>() {}.getType(); |
| | | Type type = new TypeToken<HDKGoodsDetail>() { |
| | | }.getType(); |
| | | HDKGoodsDetail goodsDetail = new Gson().fromJson(resultData.optJSONObject("data").toString(), type); |
| | | return goodsDetail; |
| | | } |
| | |
| | | |
| | | /** |
| | | * 精选低价包邮专区API |
| | | * |
| | | * @param minId |
| | | * @param pageSize |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * 高佣专场商品API |
| | | * |
| | | * @param minId |
| | | * @param pageSize |
| | | * @return |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 获取拼多多实时热榜 |
| | | * |
| | | * @param cid |
| | | * @param minId |
| | | * @return |
| | | */ |
| | | public HaoDanKuListResult getPDDHotGoods(Integer cid, Integer minId) { |
| | | List<ParamsKeyValue> params = new ArrayList<>(); |
| | | params.add(new ParamsKeyValue("sort", 1 + "")); |
| | | if (cid != null) |
| | | params.add(new ParamsKeyValue("cid", cid + "")); |
| | | else |
| | | params.add(new ParamsKeyValue("cid", "0")); |
| | | |
| | | if (minId != null) |
| | | params.add(new ParamsKeyValue("min_id", minId + "")); |
| | | |
| | | String result = baseGetRequest("pdd_hot_rank", params); |
| | | System.out.println(result); |
| | | JSONObject resultJSON = JSONObject.fromObject(result); |
| | | if (resultJSON.optInt("code") == 200) { |
| | | Type type = new TypeToken<List<HaoDanKuPDDGoodsInfo>>() { |
| | | }.getType(); |
| | | List<HaoDanKuPDDGoodsInfo> list = new GsonBuilder().serializeNulls().registerTypeAdapterFactory(new NullStringToEmptyAdapterFactory()).create().fromJson(resultJSON.optJSONArray("data").toString(), type); |
| | | int min_id = resultJSON.optInt("min_id"); |
| | | HaoDanKuListResult listResult = new HaoDanKuListResult(list, min_id); |
| | | return listResult; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 获取京东实时热榜 |
| | | * |
| | | * @param cid |
| | | * @param minId |
| | | * @return |
| | | */ |
| | | public HaoDanKuListResult getJDHotGoods(Integer cid, Integer minId) { |
| | | List<ParamsKeyValue> params = new ArrayList<>(); |
| | | params.add(new ParamsKeyValue("sort", 1 + "")); |
| | | if (cid != null) |
| | | params.add(new ParamsKeyValue("cid", cid + "")); |
| | | else |
| | | params.add(new ParamsKeyValue("cid", "0")); |
| | | |
| | | if (minId != null) |
| | | params.add(new ParamsKeyValue("min_id", minId + "")); |
| | | |
| | | String result = baseGetRequest("jd_hot_rank", params); |
| | | System.out.println(result); |
| | | JSONObject resultJSON = JSONObject.fromObject(result); |
| | | if (resultJSON.optInt("code") == 200) { |
| | | Type type = new TypeToken<List<HaoDanKuJDGoodsInfo>>() { |
| | | }.getType(); |
| | | List<HaoDanKuJDGoodsInfo> list = new Gson().fromJson(resultJSON.optJSONArray("data").toString(), type); |
| | | int min_id = resultJSON.optInt("min_id"); |
| | | HaoDanKuListResult listResult = new HaoDanKuListResult(list, min_id); |
| | | return listResult; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 获取淘宝实时热榜( https://www.haodanku.com/openapi/api_detail?id=19) |
| | | * |
| | | * @param cid |
| | | * @param minId |
| | | * @return |
| | | */ |
| | | public HaoDanKuListResult getTBHotGoods(Integer cid, Integer minId) { |
| | | List<ParamsKeyValue> params = new ArrayList<>(); |
| | | params.add(new ParamsKeyValue("sale_type", 1 + "")); |
| | | if (cid != null) |
| | | params.add(new ParamsKeyValue("cid", cid + "")); |
| | | else |
| | | params.add(new ParamsKeyValue("cid", "0")); |
| | | params.add(new ParamsKeyValue("back", "20")); |
| | | |
| | | |
| | | if (minId != null) |
| | | params.add(new ParamsKeyValue("min_id", minId + "")); |
| | | |
| | | String result = baseGetRequest("sales_list", params); |
| | | System.out.println(result); |
| | | JSONObject resultJSON = JSONObject.fromObject(result); |
| | | if (resultJSON.optInt("code") == 1) { |
| | | Type type = new TypeToken<List<HDKGoodsDetail>>() { |
| | | }.getType(); |
| | | List<HDKGoodsDetail> list = new Gson().fromJson(resultJSON.optJSONArray("data").toString(), type); |
| | | int min_id = resultJSON.optInt("min_id"); |
| | | HaoDanKuListResult listResult = new HaoDanKuListResult(list, min_id); |
| | | return listResult; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public class NullStringToEmptyAdapterFactory<T> implements TypeAdapterFactory { |
| | | @SuppressWarnings("unchecked") |
| | | public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { |
| | | Class<T> rawType = (Class<T>) type.getRawType(); |
| | | if (rawType != String.class) { |
| | | return null; |
| | | } |
| | | return (TypeAdapter<T>) new StringNullAdapter(); |
| | | } |
| | | } |
| | | |
| | | public class StringNullAdapter extends TypeAdapter<String> { |
| | | @Override |
| | | public String read(JsonReader reader) throws IOException { |
| | | if (reader.peek() == JsonToken.NULL) { |
| | | reader.nextNull(); |
| | | return ""; |
| | | } |
| | | return reader.nextString(); |
| | | } |
| | | @Override |
| | | public void write(JsonWriter writer, String value) throws IOException { |
| | | if (value == null) { |
| | | writer.nullValue(); |
| | | return; |
| | | } |
| | | writer.value(value); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | HaoDanKuListResult result = HaoDanKuApiUtil.getInstance().getTBHotGoods(null, null); |
| | | System.out.println(result); |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.goods.facade.utils.taobao; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.util.List; |
| | | |
| | | public class HaoDankuUtil { |
| | | private final static String categorys = "[{\"id\":1,\"name\":\"女装\"},{\"id\":2,\"name\":\"男装\"},{\"id\":3,\"name\":\"内衣\"},{\"id\":4,\"name\":\"美妆\"},{\"id\":5,\"name\":\"配饰\"},{\"id\":6,\"name\":\"鞋品\"},{\"id\":7,\"name\":\"箱包\"},{\"id\":8,\"name\":\"儿童\"},{\"id\":9,\"name\":\"母婴\"},{\"id\":10,\"name\":\"居家\"},{\"id\":11,\"name\":\"美食\"},{\"id\":12,\"name\":\"数码\"},{\"id\":13,\"name\":\"家电\"},{\"id\":15,\"name\":\"车品\"},{\"id\":16,\"name\":\"文体\"},{\"id\":17,\"name\":\"宠物\"},{\"id\":14,\"name\":\"其他\"}]"; |
| | | |
| | | public static List<Category> CATEGORYS = null; |
| | | |
| | | static { |
| | | Type type = new TypeToken<List<Category>>() { |
| | | }.getType(); |
| | | CATEGORYS = new Gson().fromJson(categorys, type); |
| | | } |
| | | |
| | | public static class Category { |
| | | private int id; |
| | | private String name; |
| | | |
| | | public Category(int id, String name) { |
| | | this.id = id; |
| | | this.name = name; |
| | | } |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | <dubbo.version>2.7.5</dubbo.version> |
| | | <curator.version>2.13.0</curator.version> |
| | | <zookeeper.version>3.4.6</zookeeper.version> |
| | | <kafka.client.version>0.10.1.1</kafka.client.version> |
| | | </properties> |
| | | <dependencies> |
| | | <dependency> |
| | |
| | | |
| | | |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.dubbo</groupId> |
| | | <artifactId>dubbo</artifactId> |
| | |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-vip</artifactId> |
| | | <version>0.1.7</version> |
| | | <version>0.2.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>facade-lijin</artifactId> |
| | | <version>0.0.8</version> |
| | | <version>0.1.1</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | </dependency> |
| | | |
| | | |
| | | <!-- logback日志配置开始 --> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-core</artifactId> |
| | | <version>1.2.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-access</artifactId> |
| | | <version>1.2.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-classic</artifactId> |
| | | <version>1.2.3</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>log4j-over-slf4j</artifactId> |
| | | <version>1.7.7</version> |
| | | </dependency> |
| | | <!-- logback日志配置结束 --> |
| | | |
| | | |
| | | |
| | | <!-- kafka --> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.kafka</groupId> |
| | | <artifactId>kafka-clients</artifactId> |
| | | <version>${kafka.client.version}</version> |
| | | <scope>compile</scope> |
| | | <exclusions> |
| | | <exclusion> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <groupId>org.slf4j</groupId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.kafka</groupId> |
| | | <artifactId>kafka_2.11</artifactId> |
| | | <version>${kafka.client.version}</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | </dependencies> |
| | | <build> |
| | |
| | | import com.yeshi.goods.facade.service.TaoBaoCouponCacheService; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.jsoup.Jsoup; |
| | | import org.jsoup.nodes.Document; |
| | | import org.jsoup.select.Elements; |
| | |
| | | import com.ks.lijin.exception.LiJinGoodsException; |
| | | import com.ks.lijin.exception.LiJinUserException; |
| | | import com.ks.lijin.pojo.DO.LiJinExpendRecord; |
| | | import com.ks.lijin.pojo.DTO.MoneyInfo; |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | import com.yeshi.common.entity.taobao.TaoBaoShop; |
| | | import com.yeshi.common.entity.taobao.TaoKeAppInfo; |
| | |
| | | import com.yeshi.fanli.lijin.manager.UserLijinSendManager; |
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service; |
| | | import com.yeshi.fanli.service.inter.goods.ScanHistoryV2Service; |
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMoneyComputeService; |
| | | import com.yeshi.fanli.service.inter.pdd.PDDAuthService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService; |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService; |
| | |
| | | import com.yeshi.fanli.service.manger.PIDManager; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil; |
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory; |
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOLijinFactory; |
| | | import com.yeshi.fanli.util.factory.goods.ShopInfoVOFactory; |
| | | import com.yeshi.fanli.util.jd.JDApiUtil; |
| | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private OrderHongBaoMoneyComputeService orderHongBaoMoneyComputeService; |
| | | |
| | | |
| | | /** |
| | | * 获取商品详情 |
| | |
| | | public void getGoodsDetail(AcceptData acceptData, int goodsType, String goodsId, Long uid, String from, PrintWriter out) { |
| | | GoodsDetailVO goodsDetailVO = new GoodsDetailVO(); |
| | | GoodsDetailVO.GoodsExtraVO extraVO = new GoodsDetailVO.GoodsExtraVO(); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = new GoodsMoneyConfigParamsDTO(); |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | |
| | | paramsDTO.setFanLiRate(goodsLijinMnager.getFanLiRate(uid)); |
| | | // 领券人列表 |
| | | List<ShamUser> listCouponUser = new ArrayList<>(); |
| | |
| | | |
| | | TaoBaoGoodsBrief goods = getTaoBaoGoods(Long.parseLong(goodsId)); |
| | | |
| | | //加载资金信息 |
| | | com.yeshi.fanli.vo.goods.GoodsDetailVO goodsDetailVO1 = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO); |
| | | goodsDetailVO1 = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goods, goodsDetailVO1); |
| | | |
| | | goodsDetailVO.setGoods(GoodsDetailVOLijinFactory.convertTaoBao(goods, paramsDTO)); |
| | | BigDecimal lijinAmount = goodsLijinMnager.getTBLijin(uid, goods); |
| | | if (lijinAmount != null && lijinAmount.compareTo(new BigDecimal(0)) > 0) { |
| | | goodsDetailVO.getGoods().getMoneyInfo().setHongBaoMoney("¥" + lijinAmount); |
| | | } |
| | | //重置资金信息 |
| | | goodsDetailVO.getGoods().setMoneyInfo(goodsDetailVO1.getMoneyInfo()); |
| | | |
| | | |
| | | GoodsDetailVOLijinFactory.fillRights(goodsDetailVO.getGoods()); |
| | | |
| | | // 店铺信息 |
| | |
| | | data.put("link", link); |
| | | data.put("native", true); |
| | | data.put("userLevel", userLijinMnager.getUserLevelInfo(uid, acceptData.getSystem())); |
| | | //获取今日的剩余次数 |
| | | try { |
| | | int leftCount = goodsLijinMnager.getTodayLeftCount(uid, new Date(user.getCreatetime())); |
| | | data.put("todayLeftCount", "立减机会:-1次 今日剩余:" + leftCount + "次"); |
| | | } catch (Exception e) { |
| | | } |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } catch (LiJinException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg())); |
| | |
| | | package com.yeshi.fanli.controller.client.lijin; |
| | | |
| | | import com.google.gson.*; |
| | | import com.ks.vip.exception.OrderPayException; |
| | | import com.ks.vip.exception.VipOrderException; |
| | | import com.ks.vip.pojo.DO.*; |
| | | import com.ks.vip.pojo.DTO.PayWayInfoDTO; |
| | | import com.ks.vip.pojo.Enums.OrderTypeEnum; |
| | | import com.ks.vip.pojo.Enums.PayWayEnum; |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | import com.ks.vip.service.LijinRecordService; |
| | | import com.ks.vip.exception.LijinBalanceException; |
| | | import com.ks.vip.pojo.DO.UserLijinRecord; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.lijin.dto.LijinSendInfo; |
| | | import com.yeshi.fanli.lijin.dto.TodayLijinCreatedInfo; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinMnager; |
| | | import com.yeshi.fanli.lijin.manager.UserLijinSendManager; |
| | | import com.yeshi.fanli.lijin.vo.LijinRecordVO; |
| | | import com.yeshi.fanli.lijin.vo.VIPGradeVO; |
| | | import com.yeshi.fanli.lijin.vo.VipRecordVO; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.user.UserInfoService; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.*; |
| | | import redis.clients.jedis.Jedis; |
| | | import redis.clients.jedis.JedisPool; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.PrintWriter; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/lijin/hongbao") |
| | | @RequestMapping("api/v2/lijin/hongbao") |
| | | public class LijinHongBaoController { |
| | | |
| | | @Resource |
| | |
| | | userLijinSendManager.sendLijin(acceptData.getSystem(), acceptData.getDevice(), uid, new BigDecimal(10)); |
| | | lijinSendInfo = userLijinSendManager.getSendingLijinInfo(acceptData.getSystem(), acceptData.getDevice(), uid); |
| | | } |
| | | |
| | | if (lijinSendInfo == null) { |
| | | out.print(JsonUtil.loadFalseResult("无红包")); |
| | | return; |
| | | } |
| | | |
| | | //填充notify的值 |
| | | lijinSendInfo.setNotifyTitle("领取" + lijinSendInfo.getName()); |
| | | lijinSendInfo.setNotifySubtitle("限时福利,最低66.66元起"); |
| | | |
| | | |
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | |
| | |
| | | using = new BigDecimal(0); |
| | | |
| | | String recordLink = configService.getValue(ConfigKeyEnum.lijinRecordLink, acceptData.getSystem()); |
| | | String ruleLink = configService.getValue(ConfigKeyEnum.lijinRuleLink, acceptData.getSystem()); |
| | | String courseLink = configService.getValue(ConfigKeyEnum.lijinCourseLink, acceptData.getSystem()); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("balance", balance); |
| | | data.put("using", using); |
| | | data.put("recordLink", recordLink); |
| | | data.put("ruleLink", ruleLink); |
| | | data.put("courseLink", courseLink); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | |
| | | @RequestMapping("recieveHongBao") |
| | | public void recieveHongBao(AcceptData acceptData, Long uid, String id, PrintWriter out) { |
| | | try { |
| | | userLijinSendManager.initBalance(uid); |
| | | LijinSendInfo lijinSendInfo = userLijinSendManager.recieveLijin(id, uid); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("url", configService.getValue(ConfigKeyEnum.lijinRecievedSuccessLink, acceptData.getSystem()).replace("{name}", lijinSendInfo.getName()).replace("{money}", lijinSendInfo.getMoney() + "")); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | return; |
| | | } catch (LijinBalanceException e) { |
| | | if (e.getCode() == LijinBalanceException.CODE_NOT_INIT) { |
| | | out.print(JsonUtil.loadFalseResult("领取失败,请稍后重试")); |
| | | userLijinMnager.initBalance(uid); |
| | | } else { |
| | | out.print(JsonUtil.loadFalseResult(e.getMessage())); |
| | | } |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMessage())); |
| | | } |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | |
| | | BigDecimal pro = hongBaoManageService.getFanLiRate(acceptData.getSystem()); |
| | | if (CommonContentTypeEnum.valueOf(key) == CommonContentTypeEnum.mianDan)// 免单商品 |
| | | pro = new BigDecimal(100); |
| | | List<TaoBaoGoodsBrief> goodsList = result.getGoodsList(); |
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) { |
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, pro.toString(), ""); |
| | | if (CommonContentTypeEnum.valueOf(key) == CommonContentTypeEnum.mianDan)// 免单商品 |
| | | { |
| | | extra.getTaoBaoHongBaoInfo().setRate("¥" + TaoBaoUtil.getCouponPrice(taoBaoGoodsBrief)); |
| | | extra.getTaoBaoHongBaoInfo().setHongbao(TaoBaoUtil.getCouponPrice(taoBaoGoodsBrief)); |
| | | } |
| | | array.add(gson.toJson(extra)); |
| | | List<CommonGoods> goodsList = result.getGoodsList(); |
| | | for (CommonGoods taoBaoGoodsBrief : goodsList) { |
| | | // TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, pro.toString(), ""); |
| | | // if (CommonContentTypeEnum.valueOf(key) == CommonContentTypeEnum.mianDan)// 免单商品 |
| | | // { |
| | | // extra.getTaoBaoHongBaoInfo().setRate("¥" + TaoBaoUtil.getCouponPrice(taoBaoGoodsBrief)); |
| | | // extra.getTaoBaoHongBaoInfo().setHongbao(TaoBaoUtil.getCouponPrice(taoBaoGoodsBrief)); |
| | | // } |
| | | array.add(gson.toJson(taoBaoGoodsBrief)); |
| | | } |
| | | root.put("goodsList", array); |
| | | root.put("goodsCount", result.getCount()); |
| | | out.print(JsonUtil.loadTrueResult(root)); |
| | | |
| | | // 更新前5页数据 |
| | | if (page <= 5) |
| | | try { |
| | | taoBaoGoodsUpdateService.addUpdateQueueAsync(goodsList); |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | |
| | | /** |
| | | * 热门搜索 |
| | | * |
| | | * @param acceptData |
| | | * @param goodsType |
| | | * @param out |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "search") |
| | | public void search(AcceptData acceptData, String kw, int page, String filter, String order, String startprice, |
| | | public void search(AcceptData acceptData, String kw, Long uid, int page, String filter, String order, String startprice, |
| | | String endprice, String fastFilter, PrintWriter out) { |
| | | String bid = getHistorySearchBid(acceptData); |
| | | historySearchService.addHistorySearch(kw, bid); |
| | | |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | HistorySearch search = new HistorySearch(); |
| | | search.setDevice(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()); |
| | | search.setKey(kw); |
| | | search.setSystem(acceptData.getSystem()); |
| | | search.setUid(uid); |
| | | historySearchService.addHistorySearch(search); |
| | | } |
| | | }); |
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | acceptData.getPackages(),acceptData.getSystem()); |
| | | if (system == null) { |
| | |
| | | * @param kw |
| | | * @param page |
| | | * @param filter |
| | | * @param order |
| | | * 销量由高到低:1 、 价格从高到低:2 、 价格从低到高:3 、 推广量高到低:4(综合默认)、返利比高到低:5 |
| | | * @param order 销量由高到低:1 、 价格从高到低:2 、 价格从低到高:3 、 推广量高到低:4(综合默认)、返利比高到低:5 |
| | | * 、返利比低到高:6 、推荐20 |
| | | * @param startprice |
| | | * @param endprice |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "searchgoods") |
| | | public void searchgoods(AcceptData acceptData, String kw, int page, String filter, String order, String startprice, |
| | | public void searchgoods(AcceptData acceptData, String kw, Long uid, int page, String filter, String order, String startprice, |
| | | String endprice, Double startTkRate, Double endTkRate, String fastFilter, PrintWriter out) { |
| | | |
| | | String bid = getHistorySearchBid(acceptData); |
| | | |
| | | historySearchService.addHistorySearch(kw, bid); |
| | | |
| | | // BusinessSystem system = |
| | | // businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), |
| | | // acceptData.getPackages()); |
| | | // if (system == null) { |
| | | // out.print(JsonUtil.loadFalseResult("系统不存在")); |
| | | // return; |
| | | // } |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | HistorySearch search = new HistorySearch(); |
| | | search.setDevice(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()); |
| | | search.setKey(kw); |
| | | search.setSystem(acceptData.getSystem()); |
| | | search.setUid(uid); |
| | | historySearchService.addHistorySearch(search); |
| | | } |
| | | }); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(kw) && (kw.startsWith("http://") || kw.startsWith("https://"))) { |
| | | JSONObject data = new JSONObject(); |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.util.CommonGoodsUtil; |
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder()).create(); |
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); |
| | | List<CommonGoods> goodsList = new ArrayList<>(); |
| | | if (result != null) |
| | | goodsList = result.getGoodsList(); |
| | | |
| | | GoodsMoneyConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | |
| | | List<GoodsDetailVO> goodsDetailVOList = goodsLijinMnager.loadTBMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO); |
| | | List<GoodsDetailVO> goodsDetailVOList = goodsLijinMnager.loadCommonGoodsMoneyInfo(acceptData.getSystem(), uid, goodsList, paramsDTO); |
| | | int p = 0; |
| | | for (GoodsDetailVO vo : goodsDetailVOList) { |
| | | vo.setCreatetime(null); |
| | | if (type == CommonContentTypeEnum.mianDan)// 免单商品 |
| | | { |
| | | vo.getMoneyInfo().setFanliMoney("¥" + TaoBaoUtil.getCouponPrice(goodsList.get(p))); |
| | | vo.getMoneyInfo().setShareMoney("¥" + TaoBaoUtil.getCouponPrice(goodsList.get(p))); |
| | | vo.getMoneyInfo().setFanliMoney("¥" + CommonGoodsUtil.getAfterUseCouplePrice(goodsList.get(p))); |
| | | vo.getMoneyInfo().setShareMoney("¥" + CommonGoodsUtil.getAfterUseCouplePrice(goodsList.get(p))); |
| | | vo.getMoneyInfo().setMaxMoney(null); |
| | | } |
| | | array.add(gson.toJson(vo)); |
| | |
| | | && searchResult.getTaoBaoGoodsBriefs().size() > 0) { |
| | | CommonContentResult result = new CommonContentResult(); |
| | | result.setCount(searchResult.getPageEntity().getTotalCount()); |
| | | result.setGoodsList(searchResult.getTaoBaoGoodsBriefs()); |
| | | result.setGoodsList(CommonGoodsFactory.createTaoBaoList(searchResult.getTaoBaoGoodsBriefs())); |
| | | return result; |
| | | } |
| | | return null; |
| | |
| | | */ |
| | | @RequestMapping(value = "userProtocolListen") |
| | | public void userProtocolListen(AcceptData acceptData, Long uid, int type, PrintWriter out) { |
| | | LogHelper.userProtocolListen(String.format("%s#%s#%s", acceptData.getDevice(), uid, type)); |
| | | out.print(JsonUtil.loadTrueResult("")); |
| | | } |
| | | |
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | @RequestMapping(value = "convertPDDLink") |
| | | public void convertPDDLink(AcceptData acceptData, String resourceType, String channelType, Long uid, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(resourceType)&&StringUtil.isNullOrEmpty(channelType)) { |
| | | out.print(JsonUtil.loadFalseResult(1, "resourceType|channelType为空")); |
| | | return; |
| | | } |
| | | String customParams = null; |
| | | if (uid != null) |
| | | customParams = pddAuthService.getFanliCustomParams(uid); |
| | | String pid = pidManager.getPidCache(acceptData.getSystem(), Constant.SOURCE_TYPE_PDD, SystemPIDInfo.PidType.fanli); |
| | | PDDConvertLinkResultVO pddConvertLinkResultVO = null; |
| | | if (!StringUtil.isNullOrEmpty(resourceType)) { |
| | | pddConvertLinkResultVO = PinDuoDuoApiUtil.convertActivity(resourceType, null, pid, customParams); |
| | | } else if (!StringUtil.isNullOrEmpty(channelType)) { |
| | | pddConvertLinkResultVO = PinDuoDuoApiUtil.convertChannel(channelType, pid, customParams); |
| | | } |
| | | |
| | | |
| | | GoodsJumpLinkVO vo = GoodsJumpUtil.getPDDJumpInfo(pddConvertLinkResultVO); |
| | | JSONObject data = JSONObject.fromObject(new Gson().toJson(vo)); |
| | | data.put("native", vo.is_native()); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |
| | | @RequestMapping(value = "getTaoBaoGoodsDetailImgs") |
| | | public void getTaoBaoGoodsDetailImgs(AcceptData acceptData, Long id, PrintWriter out) { |
| | | TaoBaoGoodsImportantInfo info = DaTaoKeApiUtil.getGoodsImportantInfo(id); |
| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.fanli.dto.GoodsMoneyConfigParamsDTO; |
| | | import com.yeshi.fanli.dto.common.CommonContentResult; |
| | | import com.yeshi.fanli.dto.common.CommonContentTypeEnum; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | | import com.yeshi.fanli.service.inter.goods.CommonTemplateContentService; |
| | | import com.yeshi.goods.facade.dto.taobao.dataoke.DingDongTime; |
| | | import com.yeshi.fanli.dto.jd.JDSearchResult; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | |
| | | @Resource |
| | | private GoodsLijinMnager goodsLijinMnager; |
| | | |
| | | @Resource |
| | | private CommonTemplateContentService commonTemplateContentService; |
| | | |
| | | /** |
| | | * 新版推荐专题管理(1.5.3) |
| | | * |
| | |
| | | if (VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) |
| | | root.put("searchDiscovery", getSearchDiscoveryInfo(acceptData)); |
| | | |
| | | |
| | | out.print(JsonUtil.loadTrueResult(root)); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(1, "获取数据失败")); |
| | | try { |
| | | LogHelper.errorDetailInfo(e); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 特价推荐 |
| | | * |
| | | * @param acceptData |
| | | * @param uid |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getRecommendIndexTJ") |
| | | public void getRecommendIndexTJ(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | try { |
| | | // 获取设备定义性别 |
| | | int deviceSex = deviceSexService.getDeviceSex(acceptData.getDevice(), acceptData.getSystem()); |
| | | |
| | | // 1、专题模块 |
| | | JSONObject root = specialService.listCacheSpecialToIndex(acceptData, deviceSex, acceptData.getSystem()); |
| | | |
| | | // 2、顶部轮播图 |
| | | List<BannerVO> oldtopPicList = swiperPictureService.getByBannerCardAndVersion("index_top", |
| | | acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()), acceptData.getSystem()); |
| | | |
| | | List<BannerVO> topPicList = new ArrayList<>(); |
| | | if (oldtopPicList != null && oldtopPicList.size() > 0) |
| | | topPicList.addAll(oldtopPicList); |
| | | |
| | | root.put("topPicList", JsonUtil.getApiCommonGson().toJson(topPicList)); |
| | | |
| | | // 3、邀请有奖 |
| | | List<BannerVO> invitePicList = null; |
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) |
| | | && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()), acceptData.getSystem())) { |
| | | // 如果IOS当前版本处于审核状态就不返回 |
| | | } else { |
| | | invitePicList = swiperPictureService.getByBannerCardAndVersion("index_invite", acceptData.getPlatform(), |
| | | Integer.parseInt(acceptData.getVersion()), acceptData.getSystem()); |
| | | } |
| | | |
| | | if (invitePicList == null) { |
| | | invitePicList = new ArrayList<BannerVO>(); |
| | | } |
| | | root.put("invitePicList", JsonUtil.getApiCommonGson().toJson(invitePicList)); |
| | | |
| | | // 4、IOS的底部网页链接 |
| | | String platform = acceptData.getPlatform(); |
| | | if ("ios".equalsIgnoreCase(platform)) { |
| | | root.put("htmlLink", configService.getValue(ConfigKeyEnum.indexHtmlLinkIos.getKey(), acceptData.getSystem())); |
| | | } |
| | | |
| | | root.put("spikeGoods", getSpikeGoodsContent(acceptData)); |
| | | if (VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) |
| | | root.put("scoreExchange", getScoreExchangeInfo(acceptData)); |
| | | |
| | | if (VersionUtil.greaterThan_2_0(acceptData.getPlatform(), acceptData.getVersion())) |
| | | root.put("searchDiscovery", getSearchDiscoveryInfo(acceptData)); |
| | | |
| | | |
| | | //今日爆款 |
| | | CommonContentResult commonContentResult = commonTemplateContentService.getContentList(CommonContentTypeEnum.pddHotGoodsRank, null, 1, 10, acceptData.getSystem()); |
| | | if (commonContentResult != null && commonContentResult.getGoodsList() != null && commonContentResult.getGoodsList().size() > 0) { |
| | | com.alibaba.fastjson.JSONObject hotSale = new com.alibaba.fastjson.JSONObject(); |
| | | JumpDetailV2 jumpDetailV2 = new JumpDetailV2(); |
| | | jumpDetailV2.setActivity("com.tejia.lijin.app.ui.sellwellcommodity.SellWellGoods"); |
| | | |
| | | hotSale.put("jumpDetail", jumpDetailV2); |
| | | com.alibaba.fastjson.JSONObject params = new com.alibaba.fastjson.JSONObject(); |
| | | String navs = "[{\"key\":\"pddHotGoodsRank\",\"title\":\"拼多多\"},{\"key\":\"jdHotGoodsRank\",\"title\":\"京东\"},{\"key\":\"tbHotGoodsRank\",\"title\":\"淘宝\"}]"; |
| | | params.put("navs", navs.replace("\"","\\"+"\"")); |
| | | hotSale.put("params", params); |
| | | |
| | | Collections.shuffle(commonContentResult.getGoodsList()); |
| | | |
| | | //获取goodsList |
| | | GoodsMoneyConfigParamsDTO configParamsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(), |
| | | acceptData.getVersion(), acceptData.getSystem()); |
| | | List<GoodsDetailVO> goodsList = goodsLijinMnager.loadCommonGoodsMoneyInfo(acceptData.getSystem(), uid, commonContentResult.getGoodsList(), configParamsDTO); |
| | | JSONArray array = new JSONArray(); |
| | | Gson gson = new Gson(); |
| | | for (GoodsDetailVO vo : goodsList) { |
| | | array.add(gson.toJson(vo)); |
| | | } |
| | | hotSale.put("goodsList", array); |
| | | root.put("hotSales", hotSale); |
| | | } |
| | | |
| | | |
| | | out.print(JsonUtil.loadTrueResult(root)); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(1, "获取数据失败")); |
| | |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemPIDInfo; |
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch; |
| | | import com.yeshi.fanli.exception.pdd.PDDApiException; |
| | | import com.yeshi.fanli.exception.taobao.TaoBaoTokenParseException; |
| | | import com.yeshi.fanli.lijin.manager.GoodsLijinMnager; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.yeshi.utils.HttpUtil; |
| | | import org.yeshi.utils.IPUtil; |
| | | import org.yeshi.utils.JsonUtil; |
| | | |
| | | import com.google.gson.Gson; |
| | |
| | | */ |
| | | @RequestMapping(value = "searchGoods") |
| | | public void searchGoods(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter, |
| | | Integer order, Long uid, String notifyType, HttpSession session, PrintWriter out) { |
| | | Integer order, Long uid, String notifyType, HttpSession session,HttpServletRequest request, PrintWriter out) { |
| | | |
| | | if (goodsType == null || goodsType < 1 || goodsType > 5) { |
| | | out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数")); |
| | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | StringBuffer sb = new StringBuffer(); |
| | | String link = "#$$$#"; |
| | | String platform = acceptData.getPlatform(); |
| | | String packages = acceptData.getPackages(); |
| | | String device = acceptData.getDevice(); |
| | | sb.append(platform).append(link).append(packages).append(link).append(device); |
| | | String bid = StringUtil.Md5(sb.toString()); |
| | | |
| | | // 加入搜索历史记录 |
| | | historySearchService.addHistorySearch(searchkey, bid); |
| | | HistorySearch search = new HistorySearch(); |
| | | search.setDevice(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()); |
| | | search.setKey(key); |
| | | search.setSystem(acceptData.getSystem()); |
| | | search.setUid(uid); |
| | | search.setGoodsType(goodsType); |
| | | search.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); |
| | | historySearchService.addHistorySearch(search); |
| | | } |
| | | }); |
| | | |
| | | |
| | | if (searchkey.startsWith("http://") || searchkey.startsWith("https://")) { |
| | | JSONObject data = new JSONObject(); |
| | |
| | | |
| | | @RequestMapping(value = "searchGoodsTJ") |
| | | public void searchGoodsTJ(AcceptData acceptData, Integer goodsType, String key, Integer page, String filter, |
| | | Integer order, Long uid, String notifyType, HttpSession session, PrintWriter out) { |
| | | Integer order, Long uid, String notifyType, HttpSession session, HttpServletRequest request, PrintWriter out) { |
| | | |
| | | if (goodsType == null || goodsType < 1 || goodsType > 5) { |
| | | out.print(JsonUtil.loadFalseResult(1, "请传递正确平台参数")); |
| | |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | StringBuffer sb = new StringBuffer(); |
| | | String link = "#$$$#"; |
| | | String platform = acceptData.getPlatform(); |
| | | String packages = acceptData.getPackages(); |
| | | String device = acceptData.getDevice(); |
| | | sb.append(platform).append(link).append(packages).append(link).append(device); |
| | | String bid = StringUtil.Md5(sb.toString()); |
| | | // 加入搜索历史记录 |
| | | historySearchService.addHistorySearch(searchkey, bid); |
| | | HistorySearch search = new HistorySearch(); |
| | | search.setDevice(StringUtil.isNullOrEmpty(acceptData.getUtdid()) ? acceptData.getDevice() : acceptData.getUtdid()); |
| | | search.setKey(key); |
| | | search.setSystem(acceptData.getSystem()); |
| | | search.setUid(uid); |
| | | search.setGoodsType(goodsType); |
| | | search.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); |
| | | historySearchService.addHistorySearch(search); |
| | | } |
| | | }); |
| | | |
| | |
| | | goodsId = id; |
| | | } |
| | | } |
| | | if (goodsId == null) { |
| | | //解析链接 |
| | | if (linkList != null && linkList.size() > 0) { |
| | | String tempGoodsId = clipboardAnalysisManager.parseTBAuctionIdFromLink(linkList.get(0)); |
| | | if (!StringUtil.isNullOrEmpty(tempGoodsId)) { |
| | | goodsId = Long.parseLong(tempGoodsId); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //商品ID为空,且是口令的形式就以未加入淘宝联盟的商品处理 |
| | | if (goodsId == null && (linkList != null && linkList.size() > 0) && TaoBaoUtil.isHaveNewVersionTaoBaoToken(key)) { |
| | | String[] ks = key.trim().split(" "); |
| | | if (ks.length > 1) |
| | | key = ks[1].trim(); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.yeshi.fanli.dao.user; |
| | | |
| | | import com.yeshi.common.MongodbBaseDao; |
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Repository |
| | | public class HistorySearchDao extends MongodbBaseDao<HistorySearch> { |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | |
| | | public class CommonContentResult implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | private List<TaoBaoGoodsBrief> goodsList; |
| | | private List<CommonGoods> goodsList; |
| | | private long count; |
| | | |
| | | public List<TaoBaoGoodsBrief> getGoodsList() { |
| | | |
| | | public List<CommonGoods> getGoodsList() { |
| | | return goodsList; |
| | | } |
| | | |
| | | public void setGoodsList(List<TaoBaoGoodsBrief> goodsList) { |
| | | public void setGoodsList(List<CommonGoods> goodsList) { |
| | | this.goodsList = goodsList; |
| | | } |
| | | |
| | |
| | | this.count = count; |
| | | } |
| | | |
| | | public CommonContentResult(List<TaoBaoGoodsBrief> goodsList, long count) { |
| | | this.goodsList = goodsList; |
| | | this.count = count; |
| | | public CommonContentResult() { |
| | | } |
| | | |
| | | public CommonContentResult() { |
| | | public CommonContentResult(List<CommonGoods> goodsList, long count) { |
| | | this.goodsList = goodsList; |
| | | this.count = count; |
| | | } |
| | | } |
| | |
| | | |
| | | _9k9("9.9包邮"), haoQuan("高额好券"), chaoSheng("超级省钱"), muYin("母婴精选"), reMai("潮品热卖"), meiShi("优选美食"), juJia( |
| | | "居家生活"), chuanYiDaPei("穿衣搭配"), meiZhuangGehu("美妆个护"), jingPinXieBao("精品鞋包"), chaoNanReMai( |
| | | "潮男热卖"), shuMaShouJi("数码手机"), yunDongKuXie("运动酷鞋"), qiCheHuWai("汽车户外"), chaoPinReMai("新款潮品"),mianDan("免单商品") |
| | | ,guessLikeDevice("猜你喜欢"); |
| | | "潮男热卖"), shuMaShouJi("数码手机"), yunDongKuXie("运动酷鞋"), qiCheHuWai("汽车户外"), chaoPinReMai("新款潮品"), mianDan("免单商品"), guessLikeDevice("猜你喜欢"), pddHotGoodsRank("拼多多热销榜单"), jdHotGoodsRank("拼多多热销榜单"), tbHotGoodsRank("淘宝热销榜单"); |
| | | private final String desc; |
| | | |
| | | private CommonContentTypeEnum(String desc) { |
| | |
| | | |
| | | public enum JDCommonContentTypeEnum { |
| | | |
| | | _9k9("9.9包邮"), jdPeiSong("京东配送"), jiaDian("精选家电"), baiHuo("百货超市"), juJia("居家生活"); |
| | | _9k9("9.9包邮"), jdPeiSong("京东配送"), jiaDian("精选家电"), baiHuo("百货超市"), juJia("居家生活"),; |
| | | private final String desc; |
| | | |
| | | private JDCommonContentTypeEnum(String desc) { |
| | |
| | | |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | import org.yeshi.utils.mybatis.Column; |
| | | import org.yeshi.utils.mybatis.Table; |
| | | |
| | | import com.google.gson.annotations.Expose; |
| | | |
| | | @Table("`yeshi_ec_history_search`") |
| | | @Document(collection = "searchRecord") |
| | | public class HistorySearch { |
| | | @Column(name="id") |
| | | private Long id; |
| | | |
| | | @Column(name="name") |
| | | @Expose |
| | | private String name; |
| | | |
| | | @Column(name="businessId") |
| | | private String businessId; |
| | | |
| | | @Column(name="state") |
| | | private int state; |
| | | |
| | | @Column(name="createtime") |
| | | @Id |
| | | private String id; |
| | | private String device; |
| | | private Integer goodsType; |
| | | private Long uid; |
| | | private SystemEnum system; |
| | | private String key; |
| | | private String ipInfo; |
| | | private Date createtime; |
| | | |
| | | public Long getId() { |
| | | public String getIpInfo() { |
| | | return ipInfo; |
| | | } |
| | | |
| | | public void setIpInfo(String ipInfo) { |
| | | this.ipInfo = ipInfo; |
| | | } |
| | | |
| | | public String getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public int getState() { |
| | | return state; |
| | | public Integer getGoodsType() { |
| | | return goodsType; |
| | | } |
| | | |
| | | public void setState(int state) { |
| | | this.state = state; |
| | | public void setGoodsType(Integer goodsType) { |
| | | this.goodsType = goodsType; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | public String getDevice() { |
| | | return device; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | public void setDevice(String device) { |
| | | this.device = device; |
| | | } |
| | | |
| | | public String getBusinessId() { |
| | | return businessId; |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setBusinessId(String businessId) { |
| | | this.businessId = businessId; |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public SystemEnum getSystem() { |
| | | return system; |
| | | } |
| | | |
| | | public void setSystem(SystemEnum system) { |
| | | this.system = system; |
| | | } |
| | | |
| | | public String getKey() { |
| | | return key; |
| | | } |
| | | |
| | | public void setKey(String key) { |
| | | this.key = key; |
| | | } |
| | | |
| | | public Date getCreatetime() { |
| | |
| | | public void setCreatetime(Date createtime) { |
| | | this.createtime = createtime; |
| | | } |
| | | |
| | | } |
| | |
| | | lijinVIPLink("lijin_vip_link", "礼金会员链接"), |
| | | lijinRecordLink("lijin_record_link", "礼金记录链接"), |
| | | lijinRecievedSuccessLink("lijin_recieve_success_link", "礼金领取成功链接"), |
| | | lijinRuleLink("lijin_rule_link", "礼金规则链接"), |
| | | lijinCourseLink("lijin_course_link", "礼金教程链接"), |
| | | |
| | | |
| | | // 文案转链 |
| | |
| | | private Date expireTime; |
| | | @Expose |
| | | private String md5; |
| | | @Expose |
| | | private String notifyTitle; |
| | | @Expose |
| | | private String notifySubtitle; |
| | | |
| | | public String getNotifyTitle() { |
| | | return notifyTitle; |
| | | } |
| | | |
| | | public void setNotifyTitle(String notifyTitle) { |
| | | this.notifyTitle = notifyTitle; |
| | | } |
| | | |
| | | public String getNotifySubtitle() { |
| | | return notifySubtitle; |
| | | } |
| | | |
| | | public void setNotifySubtitle(String notifySubtitle) { |
| | | this.notifySubtitle = notifySubtitle; |
| | | } |
| | | |
| | | public String getCategory() { |
| | | return category; |
| | |
| | | } |
| | | |
| | | |
| | | public BigDecimal getTBLijin(Long uid, TaoBaoGoodsBrief goodsBrief) { |
| | | public MoneyInfo getTBLijinAndFanli(Long uid, TaoBaoGoodsBrief goodsBrief) { |
| | | List<MoneyInfo> moneyInfo = lijinCreateService.getMoneyInfo(getUid(uid), Arrays.asList(new TaoBaoGoodsBrief[]{goodsBrief})); |
| | | return moneyInfo.get(0).getLijinAmount(); |
| | | return moneyInfo.get(0); |
| | | } |
| | | |
| | | |
| | | private List<GoodsDetailVOWithKey> loadTBMoneyInfo(SystemEnum system, Long uid, List<TaoBaoGoodsBrief> goodsBriefList, List<String> goodsKeyList, GoodsMoneyConfigParamsDTO paramsDTO) { |
| | | Map<String, MoneyInfo> lijinMap = null; |
| | | boolean hasCreateTime = false; |
| | | if (SystemInfoUtil.hasFunctions(system, SystemFunction.lijinSub)) { |
| | | if (SystemInfoUtil.hasFunctions(system, SystemFunction.lijinSub) && goodsBriefList.size() > 0) { |
| | | loadMaterialLibsType(goodsBriefList); |
| | | lijinMap = getTBLijinList(uid, goodsBriefList); |
| | | hasCreateTime = true; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取今日剩余数量 |
| | | * |
| | | * @param uid |
| | | * @param registDate |
| | | * @return |
| | | */ |
| | | public int getTodayLeftCount(Long uid, Date registDate) { |
| | | return lijinCreateService.getTodayLeftCount(getUid(uid), registDate); |
| | | } |
| | | |
| | | /** |
| | | * 封装礼金信息 |
| | | * |
| | | * @param money |
| | |
| | | public class UserLijinMnager { |
| | | |
| | | //@Reference(version = "1.0", check = false, url = "dubbo://193.112.35.168:20904/com.ks.lijin.service.LijinCreateService") |
| | | @Reference(version = "1.0", check = false) |
| | | @Reference(version = "1.0", check = false, timeout = 30000) |
| | | private LijinCreateService lijinCreateService; |
| | | |
| | | //@Reference(version = "1.0", check = false, url = "dubbo://193.112.35.168:20902/com.ks.vip.service.VipCenterService") |
| | |
| | | return lijinBalanceService.getUsingLijin(getUid(uid)); |
| | | } |
| | | |
| | | /** |
| | | * 初始化余额 |
| | | * |
| | | * @param uid |
| | | */ |
| | | public void initBalance(Long uid) { |
| | | lijinBalanceService.init(getUid(uid)); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.lijin.manager; |
| | | |
| | | import com.ks.vip.exception.LijinBalanceException; |
| | | import com.ks.vip.pojo.DO.UserLijinRecord; |
| | | import com.ks.vip.pojo.Enums.VIPEnum; |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | |
| | | * |
| | | * @param id |
| | | */ |
| | | public LijinSendInfo recieveLijin(String id, Long uid) throws Exception { |
| | | public LijinSendInfo recieveLijin(String id, Long uid) throws LijinBalanceException, Exception { |
| | | LijinSendInfo lijinSendInfo = (LijinSendInfo) redisManager.getObj(LijinSendInfo.class, id); |
| | | if (lijinSendInfo == null) |
| | | throw new Exception("红包为空"); |
| | |
| | | } |
| | | |
| | | //判断是否是新人红包 |
| | | if(lijinSendInfo.getCategory().equalsIgnoreCase(UserLijinRecord.Category.newer.name())){ |
| | | if (lijinSendInfo.getCategory() != null && lijinSendInfo.getCategory().equalsIgnoreCase(UserLijinRecord.Category.newer.name())) { |
| | | UserLijinRecord record = userLijinMnager.getLijinRecord(uid, null, UserLijinRecord.Category.newer.name()); |
| | | if(record!=null){ |
| | | throw new Exception("已领过新人红包"); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 初始化余额 |
| | | * |
| | | * @param uid |
| | | */ |
| | | public void initBalance(Long uid) { |
| | | userLijinMnager.initBalance(uid); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.log; |
| | | |
| | | import ch.qos.logback.classic.spi.ILoggingEvent; |
| | | import ch.qos.logback.core.ConsoleAppender; |
| | | import org.apache.kafka.clients.producer.Callback; |
| | | import org.apache.kafka.clients.producer.Producer; |
| | | import org.apache.kafka.clients.producer.ProducerRecord; |
| | | import org.apache.kafka.clients.producer.RecordMetadata; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | public class KafkaAppender extends ConsoleAppender<ILoggingEvent> { |
| | | |
| | | private String bootstrapServers; |
| | | private String topic; |
| | | private String batchSize; |
| | | private String lingerMs; |
| | | private String compressionType; |
| | | private String retries; |
| | | private String maxRequestSize; |
| | | private String isSend; |
| | | |
| | | private Producer<String, String> producer; |
| | | |
| | | public KafkaAppender() { |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void start() { |
| | | super.start(); |
| | | if ("true".equals(this.isSend)) { |
| | | if (producer == null) { |
| | | producer = KafkaUtil.createProducer(this.bootstrapServers, this.batchSize, |
| | | this.lingerMs, this.compressionType, this.retries, this.maxRequestSize, "", ""); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void stop() { |
| | | super.stop(); |
| | | if ("true".equals(this.isSend)) { |
| | | this.producer.close(); |
| | | } |
| | | |
| | | System.out.println("Stopping kafkaAppender..."); |
| | | } |
| | | |
| | | @Override |
| | | protected void append(ILoggingEvent eventObject) { |
| | | byte[] byteArray; |
| | | String log; |
| | | // 对日志格式进行解码 |
| | | byteArray = this.encoder.encode(eventObject); |
| | | log = new String(byteArray); |
| | | ProducerRecord<String, String> record = new ProducerRecord<>(this.topic, log); |
| | | if (eventObject.getMarker() == null && "true".equals(this.isSend)) { |
| | | //如果需要进行分析日志,可以对record进行数据结构重构下 |
| | | producer.send(record, new Callback() { |
| | | @Override |
| | | public void onCompletion(RecordMetadata metadata, Exception exception) { |
| | | if (exception != null) { |
| | | System.out.println(String.format("Send log to kafka failed: [%s]", log)); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | public String getBootstrapServers() { |
| | | return bootstrapServers; |
| | | } |
| | | |
| | | public void setBootstrapServers(String bootstrapServers) { |
| | | this.bootstrapServers = bootstrapServers; |
| | | } |
| | | |
| | | public String getTopic() { |
| | | return topic; |
| | | } |
| | | |
| | | public void setTopic(String topic) { |
| | | this.topic = topic; |
| | | } |
| | | |
| | | public String getBatchSize() { |
| | | return batchSize; |
| | | } |
| | | |
| | | public void setBatchSize(String batchSize) { |
| | | this.batchSize = batchSize; |
| | | } |
| | | |
| | | public String getLingerMs() { |
| | | return lingerMs; |
| | | } |
| | | |
| | | public void setLingerMs(String lingerMs) { |
| | | this.lingerMs = lingerMs; |
| | | } |
| | | |
| | | public String getCompressionType() { |
| | | return compressionType; |
| | | } |
| | | |
| | | public void setCompressionType(String compressionType) { |
| | | this.compressionType = compressionType; |
| | | } |
| | | |
| | | public String getRetries() { |
| | | return retries; |
| | | } |
| | | |
| | | public void setRetries(String retries) { |
| | | this.retries = retries; |
| | | } |
| | | |
| | | public String getMaxRequestSize() { |
| | | return maxRequestSize; |
| | | } |
| | | |
| | | public void setMaxRequestSize(String maxRequestSize) { |
| | | this.maxRequestSize = maxRequestSize; |
| | | } |
| | | |
| | | public String getIsSend() { |
| | | return isSend; |
| | | } |
| | | |
| | | public void setIsSend(String isSend) { |
| | | this.isSend = isSend; |
| | | } |
| | | |
| | | public Producer<String, String> getProducer() { |
| | | return producer; |
| | | } |
| | | |
| | | public void setProducer(Producer<String, String> producer) { |
| | | this.producer = producer; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.log; |
| | | |
| | | import org.apache.kafka.clients.consumer.KafkaConsumer; |
| | | import org.apache.kafka.clients.producer.KafkaProducer; |
| | | import org.apache.kafka.clients.producer.Producer; |
| | | import org.apache.kafka.clients.producer.ProducerConfig; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.Properties; |
| | | |
| | | public class KafkaUtil { |
| | | public static Producer<String, String> createProducer( |
| | | String bootstrapServers, String batchSize, String lingerMs, |
| | | String compressionType, String retries, String maxRequestSize, String username, String password) { |
| | | // 当配置项为IS_UNDEFINED时,使用默认值 |
| | | if (bootstrapServers == null) { |
| | | bootstrapServers = "kafka地址"; |
| | | } |
| | | if (batchSize.contains("IS_UNDEFINED")) { |
| | | batchSize = "50000"; |
| | | } |
| | | if (lingerMs.contains("IS_UNDEFINED")) { |
| | | lingerMs = "60000"; |
| | | } |
| | | |
| | | if (retries.contains("IS_UNDEFINED")) { |
| | | retries = "3"; |
| | | } |
| | | if (maxRequestSize.contains("IS_UNDEFINED")) { |
| | | maxRequestSize = "5242880"; |
| | | } |
| | | |
| | | Properties properties = new Properties(); |
| | | // kafka地址,集群用逗号分隔开 |
| | | properties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers); |
| | | // acks取值: |
| | | // 0: kafka不返回确认信息,不保证record是否被收到,因为没有返回所以重试机制不会生效 |
| | | // 1: partition leader确认record写入到日志中,但不保证信息是否被正确复制 |
| | | // all: leader会等待所有信息被同步后返回确认信息 |
| | | properties.put(ProducerConfig.ACKS_CONFIG, "1"); |
| | | properties.put(ProducerConfig.RETRIES_CONFIG, Integer.valueOf(retries)); |
| | | // 批量发送,当达到batch size最大值触发发送机制(10.0后支持批量发送) |
| | | properties.put(ProducerConfig.BATCH_SIZE_CONFIG, Integer.valueOf(batchSize)); |
| | | // 该配置是指在batch.size数量未达到时,指定时间内也会推送数据 |
| | | properties.put(ProducerConfig.LINGER_MS_CONFIG, Integer.valueOf(lingerMs)); |
| | | |
| | | // 配置缓存 |
| | | properties.put(ProducerConfig.BUFFER_MEMORY_CONFIG, 33554432); |
| | | if (!compressionType.contains("IS_UNDEFINED")) { |
| | | // 指定压缩算法 |
| | | // properties.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, compressionType); |
| | | } |
| | | // 每个请求的消息大小 |
| | | properties.put(ProducerConfig.MAX_REQUEST_SIZE_CONFIG, Integer.valueOf(maxRequestSize)); |
| | | properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, |
| | | "org.apache.kafka.common.serialization.StringSerializer"); |
| | | properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, |
| | | "org.apache.kafka.common.serialization.StringSerializer"); |
| | | if (!"".equals(username)) { |
| | | properties.put("security.protocol", "SASL_PLAINTEXT"); |
| | | properties.put("sasl.mechanism", "PLAIN"); |
| | | properties.put("sasl.jaas.config", |
| | | "org.apache.kafka.common.security.scram.ScramLoginModule required username=\"" + "用戶名" + "\" password=\"" + "密碼" + "\";"); |
| | | } |
| | | return new KafkaProducer<String, String>(properties); |
| | | } |
| | | |
| | | |
| | | public static KafkaConsumer<String, String> createConsumer(String servers, String topic) { |
| | | Properties props = new Properties(); |
| | | props.put("bootstrap.servers", servers); |
| | | props.put("group.id", "test"); |
| | | props.put("enable.auto.commit", true);//设置是否为自动提交 |
| | | props.put("auto.offset.reset", "earliest"); |
| | | props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); |
| | | props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); |
| | | KafkaConsumer consumer = new KafkaConsumer<String, String>(props); |
| | | consumer.subscribe(Arrays.asList(new String[]{topic})); |
| | | return consumer; |
| | | } |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.log; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.apache.log4j.Logger; |
| | | |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | public class LogHelper { |
| | | // log |
| | | private static Logger userLogger = Logger.getLogger("userInfoLog"); |
| | | |
| | | private static Logger orderLogger = Logger.getLogger("orderLog"); |
| | | private static Logger logger = LoggerFactory.getLogger(LogHelper.class); |
| | | |
| | | private static Logger userOrderLogger = Logger.getLogger("userOrderLog"); |
| | | private static Logger userLogger = LoggerFactory.getLogger("userInfoLog"); |
| | | |
| | | private static Logger testLogger = Logger.getLogger("testLog"); |
| | | private static Logger orderLogger = LoggerFactory.getLogger("orderLog"); |
| | | |
| | | private static Logger errorLogger = Logger.getLogger("errorLog"); |
| | | private static Logger userOrderLogger = LoggerFactory.getLogger("userOrderLog"); |
| | | |
| | | private static Logger httpLogger = Logger.getLogger("httpLog"); |
| | | private static Logger testLogger = LoggerFactory.getLogger("testLog"); |
| | | |
| | | private static Logger taoBaoLinkLog = Logger.getLogger("taoBaoLinkLog"); |
| | | private static Logger errorLogger = LoggerFactory.getLogger("errorLog"); |
| | | |
| | | private static Logger shareGoodsLogger = Logger.getLogger("shareGoodsLog"); |
| | | private static Logger httpLogger = LoggerFactory.getLogger("httpLog"); |
| | | |
| | | private static Logger loginLogger = Logger.getLogger("loginLog"); |
| | | private static Logger taoBaoLinkLog = LoggerFactory.getLogger("taoBaoLinkLog"); |
| | | |
| | | private static Logger smsLogger = Logger.getLogger("smsLog"); |
| | | private static Logger shareGoodsLogger = LoggerFactory.getLogger("shareGoodsLog"); |
| | | |
| | | private static Logger requestLogger = Logger.getLogger("requestLog"); |
| | | private static Logger loginLogger = LoggerFactory.getLogger("loginLog"); |
| | | |
| | | private static Logger requestTimeLogger = Logger.getLogger("requestTimeLog"); |
| | | private static Logger smsLogger = LoggerFactory.getLogger("smsLog"); |
| | | |
| | | private static Logger jobLogger = Logger.getLogger("jobLog"); |
| | | private static Logger requestLogger = LoggerFactory.getLogger("requestLog"); |
| | | |
| | | private static Logger mqLogger = Logger.getLogger("mqLog"); |
| | | private static Logger requestTimeLogger = LoggerFactory.getLogger("requestTimeLog"); |
| | | |
| | | private static Logger vipInfoLogger = Logger.getLogger("vipInfoLog"); |
| | | private static Logger jobLogger = LoggerFactory.getLogger("jobLog"); |
| | | |
| | | private static Logger userProtocolListenLog = Logger.getLogger("userProtocolListenLog"); |
| | | private static Logger mqLogger = LoggerFactory.getLogger("mqLog"); |
| | | |
| | | private static Logger teamLogger = Logger.getLogger("teamLog"); |
| | | private static Logger vipInfoLogger = LoggerFactory.getLogger("vipInfoLog"); |
| | | |
| | | private static Logger teamLogger = LoggerFactory.getLogger("teamLog"); |
| | | |
| | | |
| | | private static Logger cloudLogger = Logger.getLogger("cloudLog"); |
| | | private static Logger cloudLogger = LoggerFactory.getLogger("cloudLog"); |
| | | |
| | | private static Logger pushHWLog = Logger.getLogger("pushHWLog"); |
| | | private static Logger pushHWLog = LoggerFactory.getLogger("pushLog"); |
| | | |
| | | |
| | | public static void userProtocolListen(Object obj) { |
| | | userProtocolListenLog.info(obj); |
| | | } |
| | | |
| | | public static void userInfo(Object obj) { |
| | | userLogger.info(obj); |
| | | userLogger.info(obj + ""); |
| | | } |
| | | |
| | | public static void userErrorInfo(Object obj) { |
| | | userLogger.error(obj); |
| | | userLogger.error(obj + ""); |
| | | } |
| | | |
| | | public static void orderInfo(Object obj) { |
| | | orderLogger.info(obj); |
| | | orderLogger.info(obj + ""); |
| | | } |
| | | |
| | | public static void orderErrorInfo(Object obj) { |
| | | orderLogger.error(obj); |
| | | orderLogger.error(obj + ""); |
| | | } |
| | | |
| | | public static void userOrder(Object obj) { |
| | | userOrderLogger.info(obj); |
| | | userOrderLogger.info(obj + ""); |
| | | } |
| | | |
| | | public static void test(Object obj) { |
| | | testLogger.info(obj); |
| | | testLogger.info(obj + ""); |
| | | } |
| | | |
| | | public static void error(Object obj) { |
| | | errorLogger.info(obj); |
| | | errorLogger.error(obj + ""); |
| | | } |
| | | |
| | | public static void taoBaoLinkError(Object obj) { |
| | | taoBaoLinkLog.info(obj); |
| | | taoBaoLinkLog.info(obj + ""); |
| | | } |
| | | |
| | | public static void shareGoods(Object obj) { |
| | | shareGoodsLogger.info(obj); |
| | | shareGoodsLogger.info(obj + ""); |
| | | } |
| | | |
| | | public static void job(Object obj) { |
| | | jobLogger.info(obj); |
| | | jobLogger.info(obj + ""); |
| | | } |
| | | |
| | | public static void pushHW(Object obj) { |
| | | pushHWLog.info(obj); |
| | | pushHWLog.info(obj + ""); |
| | | } |
| | | |
| | | public static void mqError(String errorMsg, String topic, String tag, Object data) { |
| | |
| | | } |
| | | |
| | | public static void vipInfo(Object obj) { |
| | | vipInfoLogger.info(obj); |
| | | vipInfoLogger.info(obj + ""); |
| | | } |
| | | |
| | | public static void cloudInfo(Object info) { |
| | | if (info != null) |
| | | cloudLogger.info(info); |
| | | cloudLogger.info(info + ""); |
| | | } |
| | | |
| | | |
| | |
| | | * @param obj |
| | | */ |
| | | public static void lgoinInfo(Object obj) { |
| | | loginLogger.info(obj); |
| | | loginLogger.info(obj + ""); |
| | | } |
| | | |
| | | public static void errorDetailInfo(Throwable e) { |
| | | e.printStackTrace(); |
| | | String date = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy_MM_dd"); |
| | | String os = System.getProperty("os.name"); |
| | | String filePath = String.format("/usr/local/tomcat8/logs/error_detail_%s.log", date); |
| | | if (os.toLowerCase().startsWith("win")) { |
| | | filePath = String.format("C:/logs/error_detail_%s.log", date); |
| | | } else |
| | | filePath = String.format("/usr/local/tomcat8/logs/error_detail_%s.log", date); |
| | | |
| | | OutputStream out = null; |
| | | |
| | | try { |
| | | out = new FileOutputStream(new File(filePath), true); |
| | | PrintStream ps = new PrintStream(out); |
| | | ps.print(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | ps.print("\n"); |
| | | e.printStackTrace(ps); |
| | | ps.flush(); |
| | | ps.close(); |
| | | } catch (Exception ee) { |
| | | |
| | | } finally { |
| | | try { |
| | | out.close(); |
| | | } catch (IOException e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | logger.error("", e); |
| | | } |
| | | |
| | | public static void errorDetailInfo(Throwable e, String params, String url) { |
| | | e.printStackTrace(); |
| | | String date = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy_MM_dd"); |
| | | String os = System.getProperty("os.name"); |
| | | String filePath = String.format("/usr/local/tomcat8/logs/error_detail_%s.log", date); |
| | | if (os.toLowerCase().startsWith("win")) { |
| | | filePath = String.format("C:/logs/error_detail_%s.log", date); |
| | | } else |
| | | filePath = String.format("/usr/local/tomcat8/logs/error_detail_%s.log", date); |
| | | OutputStream out = null; |
| | | try { |
| | | out = new FileOutputStream(new File(filePath), true); |
| | | PrintStream ps = new PrintStream(out); |
| | | ps.print(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | ps.print("\n"); |
| | | ps.print("链接:" + url); |
| | | ps.print("\n"); |
| | | ps.print("参数:" + params); |
| | | ps.print("\n"); |
| | | e.printStackTrace(ps); |
| | | ps.flush(); |
| | | ps.close(); |
| | | } catch (Exception e1) { |
| | | |
| | | |
| | | } finally { |
| | | try { |
| | | out.close(); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | } |
| | | logger.error(String.format("链接:%s,参数:%s", url, params), e); |
| | | } |
| | | |
| | | /** |
| | | * 请求日志 |
| | | * |
| | | * @param request |
| | | * @param url |
| | | * @param map |
| | | */ |
| | | public static void requestInfo(String url, Map<String, Object> map) { |
| | | try { |
| | |
| | | paramsStr += param + "&"; |
| | | if (paramsStr.endsWith("&")) |
| | | paramsStr = paramsStr.substring(0, paramsStr.length() - 1); |
| | | requestLogger.info(String.format("%s#####%s", url, paramsStr)); |
| | | requestLogger.info("{}#####{}", url, paramsStr); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | } |
| | | |
| | | public static void httpInfo(String url, String params, String response) { |
| | | String msg = url + "\n" + params + "\n" + response; |
| | | httpLogger.info(msg); |
| | | } |
| | | |
| | | public static void smsInfo(String info) { |
| | |
| | | if (paramsStr.endsWith("&")) |
| | | paramsStr = paramsStr.substring(0, paramsStr.length() - 1); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | String content = String.format("链接:%s 参数:%s 响应时间:%s", url, paramsStr, time + ""); |
| | | requestTimeLogger.info(content); |
| | | requestTimeLogger.info("链接:{} 参数:{} 响应时间:{}", new String[]{url, paramsStr, time + ""}); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.log.category; |
| | | |
| | | public class MQ { |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.log.category; |
| | | |
| | | public class TaoKe { |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.log.category; |
| | | |
| | | public class Test { |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.log.category; |
| | | |
| | | public class User { |
| | | } |
| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.fanli.util.SystemInfoUtil; |
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HaoDanKuJDGoodsInfo; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HaoDanKuListResult; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HaoDanKuPDDGoodsInfo; |
| | | import com.yeshi.goods.facade.entity.taobao.haodanku.HDKGoodsDetail; |
| | | import com.yeshi.goods.facade.utils.taobao.HaoDanKuApiUtil; |
| | | import com.yeshi.goods.facade.utils.taobao.HaoDankuUtil; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | navList = getCommonNav(system); |
| | | } else if (type == CommonContentTypeEnum.mianDan) { |
| | | navList = new ArrayList<>(); |
| | | } else if (type == CommonContentTypeEnum.pddHotGoodsRank) { |
| | | //好单库数据 |
| | | navList.add(new CommonContentNav("0", "全部")); |
| | | for (HaoDankuUtil.Category category : HaoDankuUtil.CATEGORYS) { |
| | | navList.add(new CommonContentNav(category.getId() + "", category.getName())); |
| | | } |
| | | } else if (type == CommonContentTypeEnum.jdHotGoodsRank) { |
| | | //好单库数据 |
| | | navList.add(new CommonContentNav("0", "全部")); |
| | | for (HaoDankuUtil.Category category : HaoDankuUtil.CATEGORYS) { |
| | | navList.add(new CommonContentNav(category.getId() + "", category.getName())); |
| | | } |
| | | } else if (type == CommonContentTypeEnum.tbHotGoodsRank) { |
| | | //好单库数据 |
| | | navList.add(new CommonContentNav("0", "全部")); |
| | | for (HaoDankuUtil.Category category : HaoDankuUtil.CATEGORYS) { |
| | | navList.add(new CommonContentNav(category.getId() + "", category.getName())); |
| | | } |
| | | } |
| | | |
| | | return navList; |
| | |
| | | result = getHaoQuanContent(cid, page, pageSize); |
| | | } else if (type == CommonContentTypeEnum.mianDan) { |
| | | result = getMianDanContent(page, pageSize); |
| | | } else if (type == CommonContentTypeEnum.pddHotGoodsRank) { |
| | | result = getPDDHotGoodsRankContent(cid, page); |
| | | } else if (type == CommonContentTypeEnum.jdHotGoodsRank) { |
| | | result = getJDHotGoodsRankContent(cid, page); |
| | | } else if (type == CommonContentTypeEnum.tbHotGoodsRank) { |
| | | result = getTBHotGoodsRankContent(cid, page); |
| | | } |
| | | |
| | | if (result != null) {// 商品信息过滤 |
| | | List<TaoBaoGoodsBrief> goodsList = taoBaoGoodsUpdateService |
| | | .filterImportantTaoBaoGoods(result.getGoodsList()); |
| | | List<CommonGoods> goodsList = taoBaoGoodsUpdateService |
| | | .filterImportantTaoBaoGoodsWithCommonGoods(result.getGoodsList()); |
| | | result.setGoodsList(goodsList); |
| | | } |
| | | |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | goodsList.add(taoBaoGoodsBrief); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | goodsList.add(taoBaoGoodsBrief); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | |
| | | } else {// |
| | | List<TaobaoMeterial> taobaoMeterials = taobaoMeterialService.selectByClassNameAndSuperNameCache("母婴_" + cid, |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new CommonContentResult(listBrands, 1000); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(listBrands), 1000); |
| | | } |
| | | return new CommonContentResult(new ArrayList<>(), 0); |
| | | } |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.remove(i--); |
| | | } |
| | | } |
| | | result.setGoodsList(CommonGoodsFactory.createTaoBaoList(goodsList)); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拼多多热销 |
| | | * |
| | | * @return |
| | | */ |
| | | private CommonContentResult getPDDHotGoodsRankContent(String cid, int page) { |
| | | cid = cid == null ? 0 + "" : cid; |
| | | CommonContentResult result = new CommonContentResult(); |
| | | HaoDanKuListResult pddResult = HaoDanKuApiUtil.getInstance().getPDDHotGoods(Integer.parseInt(cid), page == 1 ? null : page); //qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize); |
| | | result.setCount(1000); |
| | | List<CommonGoods> goodsList = new ArrayList<>(); |
| | | if (pddResult != null) { |
| | | List<HaoDanKuPDDGoodsInfo> list = pddResult.getResultList(); |
| | | for (HaoDanKuPDDGoodsInfo goodsInfo : list) { |
| | | goodsList.add(CommonGoodsFactory.create(goodsInfo)); |
| | | } |
| | | } |
| | | result.setGoodsList(goodsList); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 京东热销 |
| | | * |
| | | * @return |
| | | */ |
| | | private CommonContentResult getJDHotGoodsRankContent(String cid, int page) { |
| | | CommonContentResult result = new CommonContentResult(); |
| | | HaoDanKuListResult pddResult = HaoDanKuApiUtil.getInstance().getJDHotGoods(Integer.parseInt(cid), page == 1 ? null : page); //qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize); |
| | | result.setCount(1000); |
| | | List<CommonGoods> goodsList = new ArrayList<>(); |
| | | if (pddResult != null) { |
| | | List<HaoDanKuJDGoodsInfo> list = pddResult.getResultList(); |
| | | for (HaoDanKuJDGoodsInfo goodsInfo : list) { |
| | | goodsList.add(CommonGoodsFactory.create(goodsInfo)); |
| | | } |
| | | } |
| | | result.setGoodsList(goodsList); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 淘宝热销 |
| | | * |
| | | * @return |
| | | */ |
| | | private CommonContentResult getTBHotGoodsRankContent(String cid, int page) { |
| | | CommonContentResult result = new CommonContentResult(); |
| | | HaoDanKuListResult pddResult = HaoDanKuApiUtil.getInstance().getTBHotGoods(Integer.parseInt(cid), page == 1 ? null : page); //qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize); |
| | | result.setCount(1000); |
| | | List<CommonGoods> goodsList = new ArrayList<>(); |
| | | if (pddResult != null) { |
| | | List<HDKGoodsDetail> list = pddResult.getResultList(); |
| | | for (HDKGoodsDetail goodsInfo : list) { |
| | | goodsList.add(CommonGoodsFactory.create(goodsInfo)); |
| | | } |
| | | } |
| | | result.setGoodsList(goodsList); |
| | | return result; |
| | | } |
| | |
| | | } |
| | | |
| | | private JDSearchResult getJiaDianContent(String cid, int page, int pageSize) { |
| | | int[] arrayId = { 5, 2 }; |
| | | int[] arrayId = { 24}; |
| | | JDSearchResult result = getJingFenGoods(page, pageSize, "jiadian-", arrayId); |
| | | return filterGoods(result); |
| | | } |
| | | |
| | | private JDSearchResult getBaiHuoContent(String cid, int page, int pageSize) { |
| | | int[] arrayId = { 6, 3 }; |
| | | int[] arrayId = { 25 }; |
| | | JDSearchResult result = getJingFenGoods(page, pageSize, "baihuo-", arrayId); |
| | | return filterGoods(result); |
| | | } |
| | | |
| | | private JDSearchResult getJuJiaContent(String cid, int page, int pageSize) { |
| | | int[] arrayId = { 7, 4 }; |
| | | int[] arrayId = { 27 }; |
| | | JDSearchResult result = getJingFenGoods(page, pageSize, "jujia-", arrayId); |
| | | return filterGoods(result); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonGoods> filterImportantTaoBaoGoodsWithCommonGoods(List<CommonGoods> goodsList) { |
| | | |
| | | // 商品过滤不允许出错 |
| | | try { |
| | | Map<Long, CommonGoods> finalMap = new HashMap<>(); |
| | | // 原始数据全覆盖 |
| | | List<CommonGoods> tempGoodsList = new ArrayList<>(); |
| | | for (CommonGoods goods : goodsList) { |
| | | if (goods.getGoodsType() == CommonGoods.SHOP_TYPE_TB) { |
| | | finalMap.put(goods.getGoodsId(), goods); |
| | | tempGoodsList.add(goods); |
| | | } |
| | | } |
| | | |
| | | // 先从redis里面取覆盖 |
| | | for (int i = 0; i < tempGoodsList.size(); i++) { |
| | | TaoBaoGoodsBrief goods = taoBaoGoodsCacheUtil |
| | | .getCommonTaoBaoGoodsInfo(tempGoodsList.get(i).getGoodsId()); |
| | | if (goods != null) { |
| | | finalMap.put(goods.getAuctionId(), CommonGoodsFactory.create(goods)); |
| | | tempGoodsList.remove(i--); |
| | | } |
| | | } |
| | | |
| | | // 再从mongodb中取覆盖 |
| | | List<Long> auctionIds = new ArrayList<>(); |
| | | for (CommonGoods goods : tempGoodsList) { |
| | | auctionIds.add(goods.getGoodsId()); |
| | | } |
| | | List<TaoBaoGoodsBrief> mList = taoBaoGoodsUpdateDao.listByAuctionIds(auctionIds); |
| | | if (mList != null) |
| | | for (TaoBaoGoodsBrief goods : mList) { |
| | | if (goods.getUpdatetime().getTime() > System.currentTimeMillis() - 1000 * 60 * 60 * 24L)// 在1天内更新的数据才参与过滤 |
| | | finalMap.put(goods.getAuctionId(), CommonGoodsFactory.create(goods)); |
| | | } |
| | | |
| | | List<CommonGoods> finalList = new ArrayList<>(); |
| | | for (CommonGoods goods : goodsList) { |
| | | if (goods.getGoodsType() == CommonGoods.GOODS_TYPE_TB) { |
| | | CommonGoods newGoods = finalMap.get(goods.getGoodsId()); |
| | | // 过滤价格,返利比例,券信息 |
| | | goods.setPrice(newGoods.getPrice()); |
| | | goods.setRate(newGoods.getRate()); |
| | | goods.setCouponAmount(newGoods.getCouponAmount()); |
| | | goods.setCouponInfo(newGoods.getCouponInfo()); |
| | | goods.setCouponLeftCount(newGoods.getCouponLeftCount()); |
| | | goods.setCouponStartPrice(newGoods.getCouponStartPrice()); |
| | | goods.setCouponTotalCount(newGoods.getCouponTotalCount()); |
| | | } |
| | | |
| | | finalList.add(goods); |
| | | } |
| | | return finalList; |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | return goodsList; |
| | | } |
| | | |
| | | @Override |
| | | public int listAndRemoveByMaxUpdateTime(Date maxTime, int page, int pageSize) { |
| | | return taoBaoGoodsUpdateDao.listAndRemoveByMaxUpdateTime(maxTime, (page - 1) * pageSize, pageSize); |
| | | } |
| | |
| | | package com.yeshi.fanli.service.impl.user; |
| | | |
| | | import java.util.Date; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.yeshi.fanli.dao.mybatis.HistorySearchMapper; |
| | | import com.yeshi.fanli.dao.user.HistorySearchDao; |
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch; |
| | | import com.yeshi.fanli.service.inter.user.HistorySearchService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.UUID; |
| | | |
| | | @Service |
| | | public class HistorySearchServiceImpl implements HistorySearchService { |
| | | |
| | | @Resource |
| | | private HistorySearchMapper historySearchMapper; |
| | | private HistorySearchDao historySearchDao; |
| | | |
| | | public void addHistorySearch(String searchKey, String bid) { |
| | | searchKey = searchKey != null && searchKey.length() > 64 ? searchKey.substring(0, 64) : searchKey; |
| | | HistorySearch historySearch = new HistorySearch(); |
| | | historySearch.setName(searchKey); |
| | | historySearch.setBusinessId(bid); |
| | | historySearch.setCreatetime(new Date()); |
| | | historySearch.setState(0); |
| | | historySearchMapper.insertSelective(historySearch); |
| | | public void addHistorySearch(HistorySearch search) { |
| | | if (search.getId() == null) { |
| | | search.setId(UUID.randomUUID().toString()); |
| | | } |
| | | if (search.getCreatetime() == null) { |
| | | search.setCreatetime(new Date()); |
| | | } |
| | | historySearchDao.save(search); |
| | | } |
| | | |
| | | } |
| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException; |
| | | |
| | |
| | | */ |
| | | public List<TaoBaoGoodsBrief> filterImportantTaoBaoGoods(List<TaoBaoGoodsBrief> goodsList); |
| | | |
| | | |
| | | public List<CommonGoods> filterImportantTaoBaoGoodsWithCommonGoods(List<CommonGoods> goodsList); |
| | | |
| | | /** |
| | | * 根据最大的更新时间移除 |
| | | * |
| | |
| | | package com.yeshi.fanli.service.inter.user; |
| | | |
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch; |
| | | |
| | | public interface HistorySearchService { |
| | | |
| | | public void addHistorySearch(String searchKey, String bid); |
| | | public void addHistorySearch(HistorySearch search); |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.util.factory; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.yeshi.fanli.dto.common.CategoryInfoDTO; |
| | | import com.yeshi.fanli.dto.common.GoodsOtherInfoDTO; |
| | |
| | | import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo; |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.fanli.entity.jd.JDGoods; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import org.yeshi.utils.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.factory.goods.TaoBaoGoodsFactory; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HaoDanKuJDGoodsInfo; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HaoDanKuPDDGoodsInfo; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.goods.facade.entity.taobao.haodanku.HDKGoodsDetail; |
| | | import org.yeshi.utils.MoneyBigDecimalUtil; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class CommonGoodsFactory { |
| | | |
| | |
| | | cg.setCategoryInfo(JSONObject.toJSON(categoryInfo).toString()); |
| | | |
| | | return cg; |
| | | } |
| | | |
| | | public static List<CommonGoods> createTaoBaoList(List<TaoBaoGoodsBrief> goodsList) { |
| | | if (goodsList == null) |
| | | return null; |
| | | List<CommonGoods> commonGoodsList = new ArrayList<>(); |
| | | for (TaoBaoGoodsBrief goodsBrief : goodsList) { |
| | | commonGoodsList.add(create(goodsBrief)); |
| | | } |
| | | return commonGoodsList; |
| | | } |
| | | |
| | | /** |
| | |
| | | return cg; |
| | | } |
| | | |
| | | |
| | | public static CommonGoods create(HaoDanKuPDDGoodsInfo goods) { |
| | | if (goods == null) |
| | | return null; |
| | | CommonGoods cg = new CommonGoods(); |
| | | if (goods.getCouponmoney() != null) { |
| | | cg.setCouponAmount(goods.getCouponmoney()); |
| | | cg.setCouponStartPrice(goods.getItemprice()); |
| | | cg.setCouponInfo(String.format("满%s元减%s元", MoneyBigDecimalUtil.getWithNoZera(goods.getItemprice()) + "", MoneyBigDecimalUtil.getWithNoZera(cg.getCouponAmount()) + "")); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(goods.getCouponnum())) |
| | | cg.setCouponLeftCount(0); |
| | | else |
| | | cg.setCouponLeftCount(Integer.parseInt(goods.getCouponnum())); |
| | | cg.setCouponTotalCount(1); |
| | | cg.setRate(goods.getPromotion_rate()); |
| | | cg.setSellerName(goods.getShopname()); |
| | | |
| | | cg.setGoodsId(Long.parseLong(goods.getGoods_id())); |
| | | cg.setTitle(goods.getGoodsname()); |
| | | cg.setGoodsType(CommonGoods.GOODS_TYPE_PDD); |
| | | cg.setPicture(goods.getItempic()); |
| | | cg.setPrice(goods.getItemprice()); |
| | | cg.setSales(Integer.parseInt(goods.getItemsale())); |
| | | cg.setShopType(CommonGoods.SHOP_TYPE_PDD); // 拼多多 |
| | | cg.setState(CommonGoods.STATE_NORMAL); |
| | | // 保留字段 |
| | | cg.setVideoCover(null); |
| | | cg.setVideoUrl(null); |
| | | return cg; |
| | | } |
| | | |
| | | |
| | | public static CommonGoods create(HaoDanKuJDGoodsInfo goods) { |
| | | if (goods == null) |
| | | return null; |
| | | CommonGoods cg = new CommonGoods(); |
| | | if (goods.getCouponmoney() != null) { |
| | | cg.setCouponAmount(goods.getCouponmoney()); |
| | | cg.setCouponStartPrice(goods.getItemprice()); |
| | | cg.setCouponInfo(String.format("满%s元减%s元", MoneyBigDecimalUtil.getWithNoZera(goods.getItemprice()) + "", MoneyBigDecimalUtil.getWithNoZera(cg.getCouponAmount()) + "")); |
| | | } |
| | | cg.setCouponLeftCount(goods.getCouponnum()); |
| | | cg.setCouponTotalCount(1); |
| | | cg.setRate(goods.getCommissionshare()); |
| | | cg.setSellerName(goods.getShopname()); |
| | | |
| | | cg.setGoodsId(Long.parseLong(goods.getSkuid())); |
| | | cg.setTitle(goods.getGoodsname()); |
| | | cg.setGoodsType(CommonGoods.GOODS_TYPE_JD); |
| | | cg.setPicture(goods.getItempic()); |
| | | cg.setPrice(goods.getItemprice()); |
| | | cg.setSales(Integer.parseInt(goods.getItemsale())); |
| | | cg.setShopType(CommonGoods.SHOP_TYPE_JD); // 拼多多 |
| | | cg.setState(CommonGoods.STATE_NORMAL); |
| | | // 保留字段 |
| | | cg.setVideoCover(null); |
| | | cg.setVideoUrl(null); |
| | | return cg; |
| | | } |
| | | |
| | | public static CommonGoods create(HDKGoodsDetail goods) { |
| | | if (goods == null) |
| | | return null; |
| | | return CommonGoodsFactory.create(TaoBaoGoodsFactory.create(goods)); |
| | | } |
| | | |
| | | } |
| | |
| | | if (goodsType == Constant.SOURCE_TYPE_JD) { |
| | | // 月销量 |
| | | goodsInfo.setSalesType(1); |
| | | |
| | | JDPingouInfo pinGouInfo = null; |
| | | List<ClientTextStyleVO> labels =null; |
| | | if (otherDTO != null) { |
| | | Integer isFreeShipping = otherDTO.getIsFreeShipping(); |
| | | if (isFreeShipping != null && isFreeShipping == 1) { |
| | | goodsInfo.setBaoyou(true); |
| | | } |
| | | |
| | | List<ClientTextStyleVO> labels = goodsInfo.getLabels(); |
| | | labels = goodsInfo.getLabels(); |
| | | // 自营 |
| | | String owner = otherDTO.getOwner(); |
| | | if (!StringUtil.isNullOrEmpty(owner) && "g".equalsIgnoreCase(owner)) { |
| | |
| | | labels.add(textStyleVO); |
| | | } |
| | | // 拼团价 |
| | | JDPingouInfo pinGouInfo = otherDTO.getPinGouInfo(); |
| | | pinGouInfo = otherDTO.getPinGouInfo(); |
| | | } |
| | | if (pinGouInfo != null) { |
| | | goods.setPrice(pinGouInfo.getPingouPrice()); |
| | | goodsInfo.setPriceName("拼购价"); |
| | | |
| | | if (labels == null) { |
| | | labels = new ArrayList<ClientTextStyleVO>(); |
| | | labels = new ArrayList<>(); |
| | | } |
| | | ClientTextStyleVO textStyleVO = new ClientTextStyleVO(); |
| | | textStyleVO.setContent("拼购"); |
| | |
| | | } |
| | | |
| | | |
| | | public static PDDPromotionUrl convertResourceUrl(String pid) { |
| | | /** |
| | | * 活动转链 https://open.pinduoduo.com/application/document/api?id=pdd.ddk.resource.url.gen |
| | | * |
| | | * @param resourceType |
| | | * @param url |
| | | * @param pid |
| | | * @param customParams |
| | | * @return |
| | | */ |
| | | public static PDDConvertLinkResultVO convertActivity(String resourceType, String url, String pid, String customParams) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("type", "pdd.ddk.resource.url.gen"); |
| | | map.put("pid", pid); |
| | | map.put("resource_type", "39998"); |
| | | map.put("url", "https://mobile.yangkeduo.com/attendance.html?_pdd_fs=1&_pdd_tc=ffffff&_pdd_sbs=1&type=1&id=155075"); |
| | | if (customParams != null) { |
| | | map.put("custom_parameters", customParams); |
| | | } |
| | | map.put("resource_type", resourceType); |
| | | if (url != null) { |
| | | map.put("url", url); |
| | | } |
| | | |
| | | String result = baseRequest(map); |
| | | System.out.println(result); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | JSONObject json = root.optJSONObject("resource_url_response"); |
| | | if (json == null) { |
| | | return null; |
| | | } |
| | | JSONObject urlJSON = json.optJSONObject("single_url_list"); |
| | | PDDConvertLinkResultVO vo = null; |
| | | Gson gson = new GsonBuilder().disableHtmlEscaping().create(); |
| | | if (urlJSON != null) { |
| | | |
| | | vo = gson.fromJson(urlJSON.toString(), PDDConvertLinkResultVO.class); |
| | | } |
| | | JSONObject weAppInfo = json.optJSONObject("we_app_info"); |
| | | if (weAppInfo != null && vo != null) { |
| | | PDDConvertLinkResultVO.WeAppInfoBean weAppInfoBean = gson.fromJson(weAppInfo.toString(), PDDConvertLinkResultVO.WeAppInfoBean.class); |
| | | vo.setWe_app_info(weAppInfoBean); |
| | | } |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 频道推广(https://open.pinduoduo.com/application/document/api?id=pdd.ddk.cms.prom.url.generate) |
| | | * |
| | | * @param channelType |
| | | * @param pid |
| | | * @param customParams |
| | | * @return |
| | | */ |
| | | |
| | | public static PDDConvertLinkResultVO convertChannel(String channelType, String pid, String customParams) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("type", "pdd.ddk.cms.prom.url.generate"); |
| | | map.put("p_id_list", "[\"" + pid + "\"]"); |
| | | if (customParams != null) { |
| | | map.put("custom_parameters", customParams); |
| | | } |
| | | map.put("channel_type", channelType); |
| | | map.put("generate_mobile", true+""); |
| | | map.put("generate_short_url", true+""); |
| | | map.put("generate_we_app", true+""); |
| | | |
| | | |
| | | |
| | | String result = baseRequest(map); |
| | | System.out.println(result); |
| | | JSONObject root = JSONObject.fromObject(result); |
| | | JSONObject json = root.optJSONObject("cms_promotion_url_generate_response"); |
| | | if (json == null) { |
| | | return null; |
| | | } |
| | | JSONObject urlJSON = json.optJSONArray("url_list").optJSONObject(0); |
| | | PDDConvertLinkResultVO vo = null; |
| | | Gson gson = new GsonBuilder().disableHtmlEscaping().create(); |
| | | if (urlJSON != null) { |
| | | vo = gson.fromJson(urlJSON.toString(), PDDConvertLinkResultVO.class); |
| | | } |
| | | |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信小程序转链 @Title: convertWXMP @Description: @param goodsId @param |
| | |
| | | // PDDConvertLinkResultVO vo = getAuthLink(PID_SHARE, PinDuoDuoUtil.getCustomParams(437032l)); |
| | | // |
| | | // System.out.println(vo); |
| | | PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(227873724698L); |
| | | // PDDGoodsDetail goods = PinDuoDuoApiUtil.getGoodsDetail(227873724698L); |
| | | |
| | | PDDConvertLinkResultVO vo = convertChannel("0", PID_DEFAULT, null); |
| | | |
| | | PinDuoDuoApiUtil.convert(goods.getGoodsSign(), PID_DEFAULT + "","437032", false); |
| | | System.out.println(vo); |
| | | // PinDuoDuoApiUtil.convert(goods.getGoodsSign(), PID_DEFAULT + "", "437032", false); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 跳转链接 |
| | | */ |
| | | public class GoodsJumpLinkVO { |
| | | public class |
| | | GoodsJumpLinkVO { |
| | | private String jumpLink; |
| | | private boolean _native; |
| | | private String nativeJumpLink; |
| | |
| | | <dubbo:annotation package="com.yeshi.fanli"></dubbo:annotation> |
| | | |
| | | <dubbo:registry address="zookeeper://172.16.16.46:2181"/> |
| | | <!--<dubbo:registry address="zookeeper://193.112.35.168:2182"/>--> |
| | | |
| | | <!-- url=dubbo://192.168.3.122:20882/com.yeshi.goods.facade.service.TaoBaoCouponCacheService --> |
| | | |
| | | <dubbo:reference id="taoBaoCouponCacheService" interface="com.yeshi.goods.facade.service.TaoBaoCouponCacheService" check="false" version="1.0.0"/> |
| | | <dubbo:reference id="taoBaoCouponCacheService" interface="com.yeshi.goods.facade.service.TaoBaoCouponCacheService" |
| | | check="false" version="1.0.0"/> |
| | | |
| | | <dubbo:consumer> |
| | | |
| | | |
| | | </dubbo:consumer> |
| | | </beans> |
| | |
| | | |
| | | <dubbo:annotation package="com.yeshi.fanli"></dubbo:annotation> |
| | | |
| | | <dubbo:registry address="zookeeper://193.112.35.168:2181"/> |
| | | <dubbo:registry address="zookeeper://193.112.35.168:2182"/> |
| | | |
| | | <!-- url=dubbo://192.168.3.122:20882/com.yeshi.goods.facade.service.TaoBaoCouponCacheService --> |
| | | |
| | |
| | | |
| | | <!-- url=dubbo://192.168.3.122:20882/com.yeshi.goods.facade.service.TaoBaoCouponCacheService --> |
| | | |
| | | <dubbo:reference id="taoBaoCouponCacheService" interface="com.yeshi.goods.facade.service.TaoBaoCouponCacheService" check="false" version="1.0.0"/> |
| | | <dubbo:reference id="taoBaoCouponCacheService" interface="com.yeshi.goods.facade.service.TaoBaoCouponCacheService" |
| | | check="false" version="1.0.0"/> |
| | | </beans> |
New file |
| | |
| | | log.config.kafka.isSend=true |
| | | log.config.kafka.bootstrapServers= 134.175.68.214:9092 |
| | | log.config.kafka.topic= log_fanli_error |
| | | log.config.kafka.batchSize=5 |
| | | log.config.kafka.lingerMs=1000 |
| | | log.config.kafka.compressionType=gzip |
| | | log.config.kafka.retries=3 |
| | | log.config.kafka.maxRequestSize=5242880 |
| | | |
| | |
| | | <property name="log.level" value="debug"/> |
| | | <!--归档日志文件保存的最大时间(单位跟按什么轮转有关,比如按天轮转那么单位就为天) --> |
| | | <property name="log.maxHistory" value="30"/> |
| | | <!-- 单个日志的文件大小 --> |
| | | <property name="log.maxSize" value="20MB"/> |
| | | <!--日志存储的根路径 ${catalina.base}指向每个Tomcat目录私有信息的位置, |
| | | 就是conf、logs、temp、webapps和work的父目录--> |
| | | <property name="log.filePath" value="/usr/local/tomcat/logs"/> |
| | | <property name="log.filePath" value="/tmp/logs"/> |
| | | <!--日志展示的格式--> |
| | | <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n"/> |
| | | |
| | | |
| | | <property resource="kafka_log.properties"></property> |
| | | |
| | | <!--appender是为了配置日志信息输出到哪个地方--> |
| | | <!--控制台设置,输出到控制台中--> |
| | |
| | | <!-- ERROR --> |
| | | <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/error/error.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/error/error.%d{yyyy-MM-dd}.log.zip</fileNamePattern> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/error/error.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | <appender name="USER_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/user/user.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/user/user.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | |
| | | |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/order/order.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/order/order.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="USER_ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/user_order/user_order.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/user_order/user_order.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="TEST" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/test/test.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/test/test.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="HTTP" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/http/http.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/http/http.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="TAOBAO_LINK" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/taobao_link/taobao_link.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/taobao_link/taobao_link.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | |
| | | <appender name="SHARE_GOODS" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/share-goods/share-goods.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/share-goods/share-goods.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="LOGIN" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/login/login.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/login/login.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="SMS" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/sms/sms.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/sms/sms.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="REQUEST" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/request/request.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/request/request.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | |
| | | <appender name="REQUEST_TIME" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/request_time/request_time.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/request_time/request_time.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="JOB" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/job/job.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/job/job.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | |
| | | <appender name="MQ" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/mq/mq.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/mq/mq.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="VIP_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/vip_info/vip_info.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/vip_info/vip_info.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="TEAM" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/team/team.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/team/team.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="CLOUD" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/cloud/cloud.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/cloud/cloud.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | <appender name="PUSH" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| | | <file>${log.filePath}/push/push.log</file> |
| | | <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
| | | <fileNamePattern>${log.filePath}/push/push.%d{yyyy-MM-dd}.%i.log.zip</fileNamePattern> |
| | | <maxHistory>${log.maxHistory}</maxHistory> |
| | | <maxFileSize>${log.maxSize}</maxFileSize> |
| | | </rollingPolicy> |
| | | <layout class="ch.qos.logback.classic.PatternLayout"> |
| | | <pattern> |
| | | ${log.pattern} |
| | | </pattern> |
| | | </layout> |
| | | </appender> |
| | | |
| | | |
| | | <!-- 读取配置文件中kafka的信息 --> |
| | | <property name="isSend" |
| | | value="${log.config.kafka.isSend}"/> |
| | | <property name="bootstrapServers" |
| | | value="${log.config.kafka.bootstrapServers}"/> |
| | | <property name="topic" |
| | | value="${log.config.kafka.topic}"/> |
| | | <property name="batchSize" |
| | | value="${log.config.kafka.batchSize}"/> |
| | | <property name="lingerMs" |
| | | value="${log.config.kafka.lingerMs}"/> |
| | | <property name="compressionType" |
| | | value="${log.config.kafka.compressionType}"/> |
| | | <property name="retries" |
| | | value="${log.config.kafka.retries}"/> |
| | | <property name="maxRequestSize" |
| | | value="${log.config.kafka.maxRequestSize}"/> |
| | | |
| | | |
| | | <appender name="KAFKA_ERROR" class="com.yeshi.fanli.log.KafkaAppender"> |
| | | <!-- encoder必须配置, 日志格式 --> |
| | | <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> |
| | | <!--<pattern>--> |
| | | <!--%red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %highlight(%-5level) %green([%thread]) %boldMagenta(%logger{10}) - %cyan(%msg%n)--> |
| | | <!--</pattern>--> |
| | | <!--为了便于分析将日志数据转为json格式--> |
| | | <pattern>${log.pattern}</pattern> |
| | | <!-- 控制台也要使用UTF-8,不要使用GBK,否则会中文乱码 --> |
| | | <charset>UTF-8</charset> |
| | | </encoder> |
| | | <bootstrapServers>${bootstrapServers}</bootstrapServers> |
| | | <topic>${topic}</topic> |
| | | <batchSize>${batchSize}</batchSize> |
| | | <lingerMs>${lingerMs}</lingerMs> |
| | | <compressionType>${compressionType}</compressionType> |
| | | <retries>${retries}</retries> |
| | | <maxRequestSize>${maxRequestSize}</maxRequestSize> |
| | | <isSend>${isSend}</isSend> |
| | | |
| | | <filter class="ch.qos.logback.classic.filter.LevelFilter"> |
| | | <level>ERROR</level> |
| | | <onMatch>ACCEPT</onMatch> |
| | | <onMismatch>DENY</onMismatch> |
| | | </filter> |
| | | </appender> |
| | | |
| | | |
| | | <!--name表示为哪一个logger指定层级和输出的方式 |
| | | additivity表示叠加祖先的输出方式(默认为true,会叠加),所以com.lxc.o2o以及其子类都会输出在控制台中,因为这个logger继承了root中的appender |
| | | level表示级别大于等于${log.level}的信息才会输出,输出方式为配置的appender, |
| | | 由于这里level为debug(重写了,就不会继承root的level了), |
| | | 所以控制台中会输出大于等于debug等级的日志(包括持久层执行的mysql) |
| | | 并且 |
| | | debug日志会输出到debugAppender指定的文件中 |
| | | info日志会输出到infoAppender指定的文件中 |
| | | error日志会输出到errorAppender指定的文件中--> |
| | | <logger name="userInfoLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="USER_INFO"></appender-ref> |
| | | </logger> |
| | | |
| | | <logger name="orderLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="ORDER"></appender-ref> |
| | | </logger> |
| | | |
| | | <logger name="userOrderLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="USER_ORDER"></appender-ref> |
| | | </logger> |
| | | |
| | | <logger name="testLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="TEST"></appender-ref> |
| | | </logger> |
| | | |
| | | <logger name="httpLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="HTTP"></appender-ref> |
| | | </logger> |
| | | |
| | | <logger name="taoBaoLinkLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="TAOBAO_LINK"></appender-ref> |
| | | </logger> |
| | | <logger name="shareGoodsLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="SHARE_GOODS"></appender-ref> |
| | | </logger> |
| | | <logger name="loginLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="LOGIN"></appender-ref> |
| | | </logger> |
| | | <logger name="smsLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="SMS"></appender-ref> |
| | | </logger> |
| | | <logger name="requestLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="REQUEST"></appender-ref> |
| | | </logger> |
| | | <logger name="requestTimeLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="REQUEST_TIME"></appender-ref> |
| | | </logger> |
| | | <logger name="jobLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="JOB"></appender-ref> |
| | | </logger> |
| | | <logger name="mqLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="MQ"></appender-ref> |
| | | </logger> |
| | | <logger name="vipInfoLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="VIP_INFO"></appender-ref> |
| | | </logger> |
| | | <logger name="teamLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="TEAM"></appender-ref> |
| | | </logger> |
| | | <logger name="cloudLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="CLOUD"></appender-ref> |
| | | </logger> |
| | | <logger name="pushLog" level="INFO" additivity="false"> |
| | | <appender-ref ref="PUSH"></appender-ref> |
| | | </logger> |
| | | |
| | | <!-- 一切logger都会继承自root,root默认的层级level为debug --> |
| | | <root> |
| | | <level value="INFO"/> |
| | | <!--在控制台中输出所在层级对应level(以及大于level)的日志信息,因为这里并没有设置LevelFilter--> |
| | | <appender-ref ref="STDOUT"></appender-ref> |
| | | <appender-ref ref="ERROR_FILE"></appender-ref> |
| | | <appender-ref ref="KAFKA_ERROR"></appender-ref> |
| | | </root> |
| | | </configuration> |
| | |
| | | AND IF(sp.`b_min_ios_version_code` IS NOT NULL, #{versionCode}<![CDATA[>=]]> sp.b_min_ios_version_code,TRUE) |
| | | </if> |
| | | <include refid="Sex_Screen" /> |
| | | <if test="sex == null"> ORDER BY sp.`b_orderby`</if> |
| | | <if test="sex == null"> ORDER BY sp.b_end_time,sp.`b_orderby`</if> |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | |
| | | <value>classpath:rocketmq.properties</value> |
| | | <value>classpath:xxl-job-executor.properties</value> |
| | | <value>classpath:elasticsearch.properties</value> |
| | | <value>classpath:kafka_log.properties</value> |
| | | </array> |
| | | </property> |
| | | </bean> |
| | |
| | | <groupId>com.qcloud</groupId> |
| | | <artifactId>cos_api</artifactId> |
| | | <version>5.2.4</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>log4j</groupId> |
| | | <artifactId>log4j</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | |
| | | <groupId>org.springframework.data</groupId> |
| | | <artifactId>spring-data-redis</artifactId> |
| | | <version>1.0.2.RELEASE</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-log4j12</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>log4j</groupId> |
| | | <artifactId>log4j</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | |