yujian
2019-05-14 2b82f0694b9d0487cccc135852a49f7da3e2ecba
品牌优化+ 昵称敏感词验证
9个文件已修改
4个文件已添加
255 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/BrandController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoGoodsBriefMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/MaskKeyMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/recommend/MaskKey.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoGoodsBrief.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/DynamicInfoJob.java 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoGoodsBriefMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/MaskKeyMapper.xml 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/TaoBaoGoodsBriefServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/MaskKeyServiceImpl.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/TaoBaoGoodsBriefService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/MaskKeyService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/BrandController.java
@@ -18,7 +18,6 @@
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.brand.BrandClass;
import com.yeshi.fanli.entity.brand.TaoBaoShopHistory;
import com.yeshi.fanli.entity.bus.lable.QualityFactory;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
@@ -26,8 +25,8 @@
import com.yeshi.fanli.service.inter.brand.BrandClassService;
import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
import com.yeshi.fanli.service.inter.brand.TaoBaoShopHistoryService;
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -57,8 +56,9 @@
    @Resource
    private HongBaoManageService manageService;
    @Resource
    private QualityGoodsService qualityGoodsService;
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    /**
     * 获取品牌分类
@@ -274,17 +274,13 @@
            }
            int pageSize = Constant.PAGE_SIZE;
            List<QualityFactory> listQuery = qualityGoodsService.listByShopId((page - 1) * pageSize, pageSize, sid);
            List<TaoBaoGoodsBrief> listGoods = taoBaoGoodsBriefService.listByShopId((page - 1) * pageSize, pageSize, sid);
            long count = 0;
            JSONArray array = new JSONArray();
            if (listQuery != null && listQuery.size() > 0) {
            if (listGoods != null && listGoods.size() > 0) {
                List<Long> listGid = new ArrayList<Long>();
                for (QualityFactory qualityFactory : listQuery) {
                    TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief();
                    if (taoBaoGoodsBrief == null) {
                        continue;
                    }
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoods) {
                    listGid.add(taoBaoGoodsBrief.getAuctionId());
                }
@@ -304,12 +300,7 @@
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                BigDecimal proportion = manageService.getFanLiRate();
                for (QualityFactory selectionGoods : listQuery) {
                    TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
                    if (taoBaoGoodsBrief == null) {
                        continue;
                    }
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoods) {
                    if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) {
                        boolean stateSale = false; // 默认停售
                        Long goodsId = taoBaoGoodsBrief.getAuctionId();
@@ -327,7 +318,7 @@
                    }
                    array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
                }
                count = qualityGoodsService.countByShopId(sid);
                count = taoBaoGoodsBriefService.countByShopId(sid);
            }
            data.put("count", count);
            data.put("list", array);
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -88,6 +88,7 @@
import com.yeshi.fanli.service.inter.user.BindingAccountService;
import com.yeshi.fanli.service.inter.user.ExtractRecordService;
import com.yeshi.fanli.service.inter.user.ExtractService;
import com.yeshi.fanli.service.inter.user.MaskKeyService;
import com.yeshi.fanli.service.inter.user.ShamUserService;
import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
import com.yeshi.fanli.service.inter.user.UserAccountService;
@@ -204,6 +205,10 @@
    @Resource
    private AccountMessageService accountMessageService;
    @Resource
    private MaskKeyService maskKeyService;
    private static final String PASSWORD_MAX_ERROR = "password_max_error";
    private static final String EXTRACT_MIN_MONEY = "extract_min_money";
@@ -2212,6 +2217,12 @@
                out.print(JsonUtil.loadFalseResult("昵称过长"));
                return;
            }
            if(maskKeyService.examineContent(nickName)) {
                out.print(JsonUtil.loadFalseResult("不能包含敏感词汇"));
                return;
            }
            userInfoService.saveUserInfo(nickName, uid);
            
            out.print(JsonUtil.loadTrueResult("保存成功"));
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoGoodsBriefMapper.java
@@ -5,23 +5,14 @@
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
public interface TaoBaoGoodsBriefMapper {
public interface TaoBaoGoodsBriefMapper extends BaseMapper<TaoBaoGoodsBrief>{
    int deleteByPrimaryKey(Long id);
    int deleteByAuctionId(Long auctionId);
    int insert(TaoBaoGoodsBrief record);
    int insertSelective(TaoBaoGoodsBrief record);
    TaoBaoGoodsBrief selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(TaoBaoGoodsBrief record);
    int updateByPrimaryKey(TaoBaoGoodsBrief record);
    /**
     * 根据auctionId 查询商品信息
@@ -71,5 +62,18 @@
    List<Long> queryCanDeleteGoods(@Param("maxTime") Date maxTime,@Param("start")int start,@Param("count")int count);
    
    Long queryCanDeleteGoodsCount(@Param("maxTime") Date maxTime);
    /**
     * 根据店铺信息获取商品
     * @param start
     * @param count
     * @param shopId
     * @return
     */
    List<TaoBaoGoodsBrief> listByShopId(@Param("start") long start, @Param("count") int count,
            @Param("shopId") Long shopId);
    long countByShopId(@Param("shopId") Long shopId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/MaskKeyMapper.java
New file
@@ -0,0 +1,16 @@
package com.yeshi.fanli.dao.mybatis.user;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.recommend.MaskKey;
public interface MaskKeyMapper extends BaseMapper<MaskKey> {
        /**
         * 验证内容是否存在敏感词汇
         * @param content
         * @return
         */
        int examineContent(@Param("content") String content);
    }
fanli/src/main/java/com/yeshi/fanli/entity/bus/recommend/MaskKey.java
@@ -1,11 +1,7 @@
package com.yeshi.fanli.entity.bus.recommend;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 铭感词库
@@ -13,14 +9,14 @@
 * @author Administrator
 *
 */
@Entity
@Table(name = "yeshi_ec_mask_key")
@Table("yeshi_ec_mask_key")
public class MaskKey {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "`id`")
    @Column(name = "id")
    private long id;
    @Column(name = "content")
    private String content;
    public MaskKey() {
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoGoodsBrief.java
@@ -60,6 +60,7 @@
    @org.yeshi.utils.mybatis.Column(name = "sellerId")
    private Long sellerId;// 卖家Id
    @Expose
    @org.yeshi.utils.mybatis.Column(name = "userType")
    private Integer userType;// 0,
fanli/src/main/java/com/yeshi/fanli/job/DynamicInfoJob.java
@@ -31,9 +31,9 @@
    @Scheduled(cron = "0 0/10 6-23 * * ?")
    public void insetDynamicInfo() {
        
        if (!Constant.IS_TASK) {
            return;
        }
//        if (!Constant.IS_TASK) {
//            return;
//        }
        
        try {
            dynamicInfoService.insertTimeHotSale();
@@ -64,9 +64,9 @@
    @Scheduled(cron = "0 0 6,7,15,16,21,22,23 * * ? ")
    public void insetShopInfo1() {
        
        if (!Constant.IS_TASK) {
            return;
        }
//        if (!Constant.IS_TASK) {
//            return;
//        }
        
        try {
            dynamicInfoService.insertShopInfo();
@@ -85,9 +85,9 @@
    @Scheduled(cron = "0 0/30 8,9,10 * * ?")
    public void insetShopInfo2() {
        
        if (!Constant.IS_TASK) {
            return;
        }
//        if (!Constant.IS_TASK) {
//            return;
//        }
        
        try {
            dynamicInfoService.insertShopInfo();
@@ -107,9 +107,9 @@
    @Scheduled(cron = "0 0/30 11,12,13,14 * * ?")
    public void insetShopInfo3() {
        
        if (!Constant.IS_TASK) {
            return;
        }
//        if (!Constant.IS_TASK) {
//            return;
//        }
        
        try {
            dynamicInfoService.insertShopInfo();
@@ -129,9 +129,9 @@
    @Scheduled(cron = "0 0/30 17,18,19,20 * * ? ")
    public void insetShopInfo4() {
        
        if (!Constant.IS_TASK) {
            return;
        }
//        if (!Constant.IS_TASK) {
//            return;
//        }
        
        try {
            dynamicInfoService.insertShopInfo();
@@ -151,10 +151,10 @@
    @Scheduled(cron = "0 0 0 * * ?")
    public void remove() {
        
        if (!Constant.IS_TASK) {
            return;
        }
//        if (!Constant.IS_TASK) {
//            return;
//        }
//
        try {
            dynamicInfoService.removeByDate(DateUtil.reduceDay(3, new Date()));
        } catch (Exception e) {
@@ -173,10 +173,10 @@
    @Scheduled(cron = "0 0/3 * * * ?")
    public void activityNeedPublish() {
        
        if (!Constant.IS_TASK) {
            return;
        }
//        if (!Constant.IS_TASK) {
//            return;
//        }
//
        try {
            List<RecommendActivity> list = activityService.getNeedPublish();
            if (list == null || list.size() == 0) {
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoGoodsBriefMapper.xml
@@ -117,6 +117,19 @@
    </select>
    <select id="listByShopId" resultMap="BaseResultMap">
        SELECT * FROM `yeshi_ec_taobao_goods` t
        WHERE t.`sellerId` = #{shopId}
        ORDER BY t.`biz30day` DESC
        LIMIT #{start},#{count}
    </select>
    <select id="countByShopId" resultType="java.lang.Long">
        SELECT  ifnull(count(id),0) FROM `yeshi_ec_taobao_goods`
        WHERE `sellerId` = #{shopId}
     </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_taobao_goods where id = #{id,jdbcType=BIGINT}
    </delete>
fanli/src/main/java/com/yeshi/fanli/mapping/user/MaskKeyMapper.xml
New file
@@ -0,0 +1,37 @@
<?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.user.MaskKeyMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.recommend.MaskKey">
    <id column="id" property="id" jdbcType="VARCHAR"/>
    <result column="content" property="content" jdbcType="VARCHAR"/>
  </resultMap>
  <sql id="Base_Column_List">id,content</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_mask_key where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_mask_key where id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.recommend.MaskKey" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_mask_key (id,content) values (#{id,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.recommend.MaskKey" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_mask_key
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">id,</if>
      <if test="content != null">content,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=VARCHAR},</if>
      <if test="content != null">#{content,jdbcType=VARCHAR},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.recommend.MaskKey">update yeshi_ec_mask_key set content = #{content,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.recommend.MaskKey">update yeshi_ec_mask_key
    <set>
      <if test="content != null">content=#{content,jdbcType=VARCHAR},</if>
    </set> where id = #{id,jdbcType=VARCHAR}
  </update>
  <select id="examineContent" resultType="Integer">
    SELECT COUNT(t.id) FROM `yeshi_ec_mask_key` t
    WHERE  INSTR(#{content},t.`content`) <![CDATA[>]]> 0
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/TaoBaoGoodsBriefServiceImpl.java
@@ -186,5 +186,17 @@
        return taoBaoGoodsBrief;
    }
    @Override
    public List<TaoBaoGoodsBrief> listByShopId(long start, int count, Long shopId) {
        return taoBaoGoodsBriefMapper.listByShopId(start, count, shopId);
    }
    @Override
    public long countByShopId(Long shopId) {
        return taoBaoGoodsBriefMapper.countByShopId(shopId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/MaskKeyServiceImpl.java
New file
@@ -0,0 +1,27 @@
package com.yeshi.fanli.service.impl.user;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.user.MaskKeyMapper;
import com.yeshi.fanli.service.inter.user.MaskKeyService;
@Service
public class MaskKeyServiceImpl implements MaskKeyService {
    @Resource
    private MaskKeyMapper maskKeyMapper;
    @Override
    public boolean examineContent(String content) {
        boolean isValid = true;
        int count = maskKeyMapper.examineContent(content);
        if (count > 0) {
            isValid = false;
        }
        return isValid;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/TaoBaoGoodsBriefService.java
@@ -73,7 +73,17 @@
     * @return
     */
    public List<TaoBaoGoodsBrief> listQueryByAuctionId(List<Long> list);
    /**
     * 根据店铺id查询
     * @param start
     * @param count
     * @param shopId
     * @return
     */
    public List<TaoBaoGoodsBrief> listByShopId(long start, int count, Long shopId);
    public long countByShopId(Long shopId);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/MaskKeyService.java
New file
@@ -0,0 +1,11 @@
package com.yeshi.fanli.service.inter.user;
public interface MaskKeyService {
    /**
     * 验证内容是否存在敏感词汇
     * @param content
     * @return
     */
    public boolean examineContent(String content);
}