fanli/src/main/java/com/yeshi/fanli/aspect/WebFrequencyLimitAspect.java
New file @@ -0,0 +1,63 @@ package com.yeshi.fanli.aspect; import java.io.IOException; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import org.yeshi.utils.JsonUtil; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.RedisManager; //请求频率验证 @Component @Aspect @Order(1) public class WebFrequencyLimitAspect { public static final String EDP = "execution(* com.yeshi.fanli.controller.web.*.*(..))"; @Resource private RedisManager redisManager; @Around(EDP) public Object testAround(ProceedingJoinPoint joinPoint) throws IOException { Object[] args = joinPoint.getArgs(); ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder .getRequestAttributes(); HttpServletRequest request = servletContainer.getRequest(); HttpServletResponse response = servletContainer.getResponse(); boolean limit = false; if (request != null && response != null) { String uri = request.getRequestURI(); String ip = request.getRemoteHost(); if (Constant.IS_OUTNET) { limit = redisManager.ipFrequencyLimit(ip, uri); } } if (limit) { //需要验证码验证 LogHelper.error("IP被限制了"); response.getWriter().print(JsonUtil.loadFalseResult("请求过快")); return null; } Object obj = null; try { obj = joinPoint.proceed(args); } catch (Throwable e) { e.printStackTrace(); } return obj; } } fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java
@@ -100,7 +100,7 @@ nickName = URLDecoder.decode(nickName, "UTF-8"); } catch (Exception e) { } final String name=nickName; final String name = nickName; // LogHelper.test("uid:" + uid + "\n accessToken:" + accessToken); // 获取渠道ID与会员ID @@ -115,9 +115,9 @@ LogHelper.test(e.getMsg()); errCode = 5; } //异步申请会员ID ThreadUtil.run(new Runnable() { // 异步申请会员ID ThreadUtil.run(new Runnable() { @Override public void run() { String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY, @@ -132,7 +132,7 @@ } } }); } else if ("zigou".equalsIgnoreCase(source)) { String specialId = TaoKeApiUtil.getSpecialId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET); @@ -145,11 +145,10 @@ LogHelper.test(e.getMsg()); errCode = 5; } //异步申请渠道ID ThreadUtil.run(new Runnable() { // 异步申请渠道ID ThreadUtil.run(new Runnable() { @Override public void run() { String relationId = TaoKeApiUtil.getRelationId(accessToken, TaoBaoConstant.TAOBAO_AUTH_APPKEY, @@ -163,7 +162,7 @@ } } }); } else if ("bind".equalsIgnoreCase(source)) { boolean bindInfo = true; @@ -253,4 +252,9 @@ } @RequestMapping(value = "pinduoduo") public void pinDuoDuo(HttpServletResponse response) { } } fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoShopMapper.java
New file @@ -0,0 +1,8 @@ package com.yeshi.fanli.dao.mybatis.taobao; import com.yeshi.fanli.dao.BaseMapper; import com.yeshi.fanli.entity.taobao.TaoBaoShop; public interface TaoBaoShopMapper extends BaseMapper<TaoBaoShop> { } fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandClass.java
New file @@ -0,0 +1,77 @@ package com.yeshi.fanli.entity.brand; import java.util.Date; import com.yeshi.fanli.entity.bus.clazz.GoodsClass; /** * 品牌分类 * * @author Administrator * */ public class BrandClass { private Long id; private String name;// 分类名称 private GoodsClass goodsClass;// 对应的一级分类 private Boolean show; private Integer orderBy;// 排序值,越小越靠前 private Date createTime; private Date updateTime; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public GoodsClass getGoodsClass() { return goodsClass; } public void setGoodsClass(GoodsClass goodsClass) { this.goodsClass = goodsClass; } public Boolean getShow() { return show; } public void setShow(Boolean show) { this.show = show; } public Integer getOrderBy() { return orderBy; } public void setOrderBy(Integer orderBy) { this.orderBy = orderBy; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } } fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandClassShop.java
New file @@ -0,0 +1,50 @@ package com.yeshi.fanli.entity.brand; import java.util.Date; import com.yeshi.fanli.entity.taobao.TaoBaoShop; /** * 品牌分类店铺 * * @author Administrator * */ public class BrandClassShop { private Long id; private BrandClass brandClass; private TaoBaoShop shop; private Date createTime; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public BrandClass getBrandClass() { return brandClass; } public void setBrandClass(BrandClass brandClass) { this.brandClass = brandClass; } public TaoBaoShop getShop() { return shop; } public void setShop(TaoBaoShop shop) { this.shop = shop; } public Date getCreateTime() { return createTime; } public void setCreateTime(Date createTime) { this.createTime = createTime; } } fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoShop.java
New file @@ -0,0 +1,168 @@ package com.yeshi.fanli.entity.taobao; import java.math.BigDecimal; import java.util.Date; import org.yeshi.utils.mybatis.Column; import org.yeshi.utils.mybatis.Table; /** * 淘宝店铺信息(新版) * * @author Administrator * */ @Table("yeshi_ec_taobao_shop_info") public class TaoBaoShop { @Column(name = "tsi_id") private Long id;// 卖家ID @Column(name = "tsi_user_type") private Integer userType;// 用户类型 0-淘宝 1-天猫 @Column(name = "tsi_shop_id") private Long shopId;// 店铺ID @Column(name = "tsi_shop_name") private String shopName;// 店铺名称 @Column(name = "tsi_seller_nick") private String sellerNick;// 卖家昵称 @Column(name = "tsi_shop_icon") private String shopIcon;// 店铺图标 @Column(name = "tsi_shop_icon_custom") private String shopIconCustom;// 自定义店铺图标 @Column(name = "tsi_score_goods") private BigDecimal scoreGoods;// 商品评分 @Column(name = "tsi_score_seller") private BigDecimal scoreSeller;// 卖家评分 @Column(name = "tsi_score_logistics") private BigDecimal scoreLogistics;// 物流评分 @Column(name = "tsi_score_goods_d") private BigDecimal scoreGoodsD;// 与行业平均分的差值 @Column(name = "tsi_score_seller_d") private BigDecimal scoreSellerD; @Column(name = "tsi_score_logistics_d") private BigDecimal scoreLogisticsD; @Column(name = "tsi_good_rate_percentage") private BigDecimal goodRatePercentage;// 好评率 @Column(name = "tsi_update_time") private Date updateTime; public Integer getUserType() { return userType; } public void setUserType(Integer userType) { this.userType = userType; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getShopId() { return shopId; } public void setShopId(Long shopId) { this.shopId = shopId; } public String getShopName() { return shopName; } public void setShopName(String shopName) { this.shopName = shopName; } public String getSellerNick() { return sellerNick; } public void setSellerNick(String sellerNick) { this.sellerNick = sellerNick; } public String getShopIcon() { return shopIcon; } public void setShopIcon(String shopIcon) { this.shopIcon = shopIcon; } public String getShopIconCustom() { return shopIconCustom; } public void setShopIconCustom(String shopIconCustom) { this.shopIconCustom = shopIconCustom; } public BigDecimal getScoreGoods() { return scoreGoods; } public void setScoreGoods(BigDecimal scoreGoods) { this.scoreGoods = scoreGoods; } public BigDecimal getScoreSeller() { return scoreSeller; } public void setScoreSeller(BigDecimal scoreSeller) { this.scoreSeller = scoreSeller; } public BigDecimal getScoreLogistics() { return scoreLogistics; } public void setScoreLogistics(BigDecimal scoreLogistics) { this.scoreLogistics = scoreLogistics; } public BigDecimal getScoreGoodsD() { return scoreGoodsD; } public void setScoreGoodsD(BigDecimal scoreGoodsD) { this.scoreGoodsD = scoreGoodsD; } public BigDecimal getScoreSellerD() { return scoreSellerD; } public void setScoreSellerD(BigDecimal scoreSellerD) { this.scoreSellerD = scoreSellerD; } public BigDecimal getScoreLogisticsD() { return scoreLogisticsD; } public void setScoreLogisticsD(BigDecimal scoreLogisticsD) { this.scoreLogisticsD = scoreLogisticsD; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public BigDecimal getGoodRatePercentage() { return goodRatePercentage; } public void setGoodRatePercentage(BigDecimal goodRatePercentage) { this.goodRatePercentage = goodRatePercentage; } } fanli/src/main/java/com/yeshi/fanli/exception/brand/BrandClassException.java
New file @@ -0,0 +1,32 @@ package com.yeshi.fanli.exception.brand; public class BrandClassException extends Exception { /** * */ private static final long serialVersionUID = 1L; private int code; private String msg; public int getCode() { return code; } public String getMsg() { return msg; } public BrandClassException(int code, String msg) { this.code = code; this.msg = msg; } public BrandClassException() { } @Override public String getMessage() { return this.msg; } } fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml
New file @@ -0,0 +1,131 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoShopMapper"> <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.taobao.TaoBaoShop"> <id column="tsi_id" property="id" jdbcType="BIGINT" /> <result column="tsi_user_type" property="userType" jdbcType="INTEGER" /> <result column="tsi_shop_id" property="shopId" jdbcType="BIGINT" /> <result column="tsi_shop_name" property="shopName" jdbcType="VARCHAR" /> <result column="tsi_seller_nick" property="sellerNick" jdbcType="VARCHAR" /> <result column="tsi_shop_icon" property="shopIcon" jdbcType="VARCHAR" /> <result column="tsi_shop_icon_custom" property="shopIconCustom" jdbcType="VARCHAR" /> <result column="tsi_score_goods" property="scoreGoods" jdbcType="DECIMAL" /> <result column="tsi_score_seller" property="scoreSeller" jdbcType="DECIMAL" /> <result column="tsi_score_logistics" property="scoreLogistics" jdbcType="DECIMAL" /> <result column="tsi_score_goods_d" property="scoreGoodsD" jdbcType="DECIMAL" /> <result column="tsi_score_seller_d" property="scoreSellerD" jdbcType="DECIMAL" /> <result column="tsi_score_logistics_d" property="scoreLogisticsD" jdbcType="DECIMAL" /> <result column="tsi_update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="tsi_good_rate_percentage" property="goodRatePercentage" jdbcType="DECIMAL" /> </resultMap> <sql id="Base_Column_List">tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_seller_nick,tsi_shop_icon,tsi_shop_icon_custom,tsi_score_goods,tsi_score_seller,tsi_score_logistics,tsi_score_goods_d,tsi_score_seller_d,tsi_score_logistics_d,tsi_update_time,tsi_good_rate_percentage </sql> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> select <include refid="Base_Column_List" /> from yeshi_ec_taobao_shop_info where tsi_id = #{id,jdbcType=BIGINT} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_taobao_shop_info where tsi_id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_shop_info (tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_seller_nick,tsi_shop_icon,tsi_shop_icon_custom,tsi_score_goods,tsi_score_seller,tsi_score_logistics,tsi_score_goods_d,tsi_score_seller_d,tsi_score_logistics_d,tsi_update_time,tsi_good_rate_percentage) values (#{id,jdbcType=BIGINT},#{userType,jdbcType=INTEGER},#{shopId,jdbcType=BIGINT},#{shopName,jdbcType=VARCHAR},#{sellerNick,jdbcType=VARCHAR},#{shopIcon,jdbcType=VARCHAR},#{shopIconCustom,jdbcType=VARCHAR},#{scoreGoods,jdbcType=DECIMAL},#{scoreSeller,jdbcType=DECIMAL},#{scoreLogistics,jdbcType=DECIMAL},#{scoreGoodsD,jdbcType=DECIMAL},#{scoreSellerD,jdbcType=DECIMAL},#{scoreLogisticsD,jdbcType=DECIMAL},#{updateTime,jdbcType=TIMESTAMP},#{goodRatePercentage,jdbcType=DECIMAL}) </insert> <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop" useGeneratedKeys="true" keyProperty="id"> insert into yeshi_ec_taobao_shop_info <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">tsi_id,</if> <if test="userType != null">tsi_user_type,</if> <if test="shopId != null">tsi_shop_id,</if> <if test="shopName != null">tsi_shop_name,</if> <if test="sellerNick != null">tsi_seller_nick,</if> <if test="shopIcon != null">tsi_shop_icon,</if> <if test="shopIconCustom != null">tsi_shop_icon_custom,</if> <if test="scoreGoods != null">tsi_score_goods,</if> <if test="scoreSeller != null">tsi_score_seller,</if> <if test="scoreLogistics != null">tsi_score_logistics,</if> <if test="scoreGoodsD != null">tsi_score_goods_d,</if> <if test="scoreSellerD != null">tsi_score_seller_d,</if> <if test="scoreLogisticsD != null">tsi_score_logistics_d,</if> <if test="updateTime != null">tsi_update_time,</if> <if test="goodRatePercentage != null">tsi_good_rate_percentage,</if> </trim> values <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id != null">#{id,jdbcType=BIGINT},</if> <if test="userType != null">#{userType,jdbcType=INTEGER},</if> <if test="shopId != null">#{shopId,jdbcType=BIGINT},</if> <if test="shopName != null">#{shopName,jdbcType=VARCHAR},</if> <if test="sellerNick != null">#{sellerNick,jdbcType=VARCHAR},</if> <if test="shopIcon != null">#{shopIcon,jdbcType=VARCHAR},</if> <if test="shopIconCustom != null">#{shopIconCustom,jdbcType=VARCHAR},</if> <if test="scoreGoods != null">#{scoreGoods,jdbcType=DECIMAL},</if> <if test="scoreSeller != null">#{scoreSeller,jdbcType=DECIMAL},</if> <if test="scoreLogistics != null">#{scoreLogistics,jdbcType=DECIMAL},</if> <if test="scoreGoodsD != null">#{scoreGoodsD,jdbcType=DECIMAL},</if> <if test="scoreSellerD != null">#{scoreSellerD,jdbcType=DECIMAL},</if> <if test="scoreLogisticsD != null">#{scoreLogisticsD,jdbcType=DECIMAL},</if> <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> <if test="goodRatePercentage != null">#{goodRatePercentage,jdbcType=DECIMAL}</if> </trim> </insert> <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop">update yeshi_ec_taobao_shop_info set tsi_user_type = #{userType,jdbcType=INTEGER},tsi_shop_id = #{shopId,jdbcType=BIGINT},tsi_shop_name = #{shopName,jdbcType=VARCHAR},tsi_seller_nick = #{sellerNick,jdbcType=VARCHAR},tsi_shop_icon = #{shopIcon,jdbcType=VARCHAR},tsi_shop_icon_custom = #{shopIconCustom,jdbcType=VARCHAR},tsi_score_goods = #{scoreGoods,jdbcType=DECIMAL},tsi_score_seller = #{scoreSeller,jdbcType=DECIMAL},tsi_score_logistics = #{scoreLogistics,jdbcType=DECIMAL},tsi_score_goods_d = #{scoreGoodsD,jdbcType=DECIMAL},tsi_score_seller_d = #{scoreSellerD,jdbcType=DECIMAL},tsi_score_logistics_d = #{scoreLogisticsD,jdbcType=DECIMAL},tsi_update_time = #{updateTime,jdbcType=TIMESTAMP} ,tsi_good_rate_percentage =#{goodRatePercentage,jdbcType=DECIMAL} where tsi_id = #{id,jdbcType=BIGINT}</update> <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.taobao.TaoBaoShop"> update yeshi_ec_taobao_shop_info <set> <if test="userType != null">tsi_user_type=#{userType,jdbcType=INTEGER},</if> <if test="shopId != null">tsi_shop_id=#{shopId,jdbcType=BIGINT},</if> <if test="shopName != null">tsi_shop_name=#{shopName,jdbcType=VARCHAR},</if> <if test="sellerNick != null">tsi_seller_nick=#{sellerNick,jdbcType=VARCHAR},</if> <if test="shopIcon != null">tsi_shop_icon=#{shopIcon,jdbcType=VARCHAR},</if> <if test="shopIconCustom != null">tsi_shop_icon_custom=#{shopIconCustom,jdbcType=VARCHAR}, </if> <if test="scoreGoods != null">tsi_score_goods=#{scoreGoods,jdbcType=DECIMAL},</if> <if test="scoreSeller != null">tsi_score_seller=#{scoreSeller,jdbcType=DECIMAL},</if> <if test="scoreLogistics != null">tsi_score_logistics=#{scoreLogistics,jdbcType=DECIMAL}, </if> <if test="scoreGoodsD != null">tsi_score_goods_d=#{scoreGoodsD,jdbcType=DECIMAL},</if> <if test="scoreSellerD != null">tsi_score_seller_d=#{scoreSellerD,jdbcType=DECIMAL},</if> <if test="scoreLogisticsD != null">tsi_score_logistics_d=#{scoreLogisticsD,jdbcType=DECIMAL}, </if> <if test="updateTime != null">tsi_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> <if test="id !=null">tsi_id =#{id,jdbcType=BIGINT},</if> <if test="goodRatePercentage !=null">tsi_good_rate_percentage =#{goodRatePercentage,jdbcType=DECIMAL},</if> </set> where tsi_id = #{id,jdbcType=BIGINT} </update> </mapper> fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java
@@ -42,5 +42,9 @@ LogHelper.test("获取店铺信息耗时:" + (System.currentTimeMillis() - startTime)); return shopInfo; } } fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassService.java
New file @@ -0,0 +1,21 @@ package com.yeshi.fanli.service.inter.brand; import com.yeshi.fanli.entity.brand.BrandClass; import com.yeshi.fanli.exception.brand.BrandClassException; /** * 品牌分类服务 * * @author Administrator * */ public interface BrandClassService { /** * 添加品牌分类 * @param brandClass * @throws BrandClassException */ public void addBrandClass(BrandClass brandClass) throws BrandClassException; } fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoOrderUtil.java
@@ -710,7 +710,10 @@ CommonOrder commonOrder = new CommonOrder(); commonOrder.setCount(taoBaoOrder.getCount()); commonOrder.setCreateTime(new Date()); commonOrder.seteIncome(taoBaoOrder.geteIncome()); if (taoBaoOrder.geteIncome() != null && taoBaoOrder.getSubsidy() != null) commonOrder.seteIncome(taoBaoOrder.geteIncome().add(taoBaoOrder.getSubsidy())); else commonOrder.seteIncome(taoBaoOrder.geteIncome()); commonOrder.setEstimate(taoBaoOrder.getEstimate()); commonOrder.setOrderNo(taoBaoOrder.getOrderId()); commonOrder.setPayment(taoBaoOrder.getPayment()); fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeOrderApiUtil.java
@@ -180,8 +180,7 @@ map.put("tb_trade_parent_id", "370829441412331676"); map.put("punish_status", "2"); map.put("violation_type", "2"); // map.put("start_time", "2019-01-01 00:00:00"); TaoKeAppInfo app = new TaoKeAppInfo(); app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); @@ -307,7 +306,8 @@ taoBaoOrder.setSourceMediaId(item.optString("site_id")); taoBaoOrder.setSourceMediaName(item.optString("site_name")); taoBaoOrder.setsRatio(null); taoBaoOrder.setSubsidy(null); if (!StringUtil.isNullOrEmpty(item.optString("subsidy_fee")))// 补贴金额 taoBaoOrder.setSubsidy(new BigDecimal(item.optString("subsidy_fee"))); if (!StringUtil.isNullOrEmpty(item.optString("subsidy_rate"))) taoBaoOrder.setSubsidyRatio( new BigDecimal(item.optString("subsidy_rate")).multiply(new BigDecimal(100)));