admin
2019-04-29 884196860ac5970eb1ac33386c65378284df4679
Merge remote-tracking branch 'origin/master'
34个文件已修改
17个文件已添加
3394 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/TestController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/ActivityAdminController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java 433 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/LableAdminController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/BrandController.java 326 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/TaoBaoClassMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/TaoBaoClassRelationMapper.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/activity/RecommendActivityMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandClassMapper.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandClassShopMapper.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/TaoBaoShopHistoryMapper.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/CommonGoodsMapper.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/lable/QualityFactoryMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/TaoBaoShopMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/taobao/TaoBaoShopInfoDTO.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandClass.java 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandClassShop.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/brand/TaoBaoShopHistory.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsClass.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoShop.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/brand/BrandClassShopException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/TaoBaoClassMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/TaoBaoClassRelationMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/activity/RecommendActivityMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandClassMapper.xml 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandClassShopMapper.xml 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/brand/TaoBaoShopHistoryMapper.xml 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/goods/CommonGoodsMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/activity/ActivityServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassServiceImpl.java 153 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java 361 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/TaoBaoShopHistoryServiceImpl.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/CommonGoodsServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/TaoBaoClassServiceImpl.java 132 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityGoodsServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/activity/ActivityService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassService.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassShopService.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/TaoBaoShopHistoryService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/CommonGoodsService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/TaoBaoClassService.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/QualityGoodsService.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoShopService.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/brand/TaoBaoShopVO.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/resource/ehcache.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/TestController.java
@@ -115,7 +115,7 @@
    @RequestMapping(value = "testactivity")
    public void test2(PrintWriter out) {
        List<RecommendActivity> list = activityService.getRecommendActivityList(1, Constant.PAGE_SIZE);
        long count = activityService.getRecommendActivityCount();
        long count = activityService.getRecommendActivityCount(null);
        JSONObject data = new JSONObject();
        data.put("data", getGson().toJson(list));
        data.put("count", count);
fanli/src/main/java/com/yeshi/fanli/controller/admin/ActivityAdminController.java
@@ -472,7 +472,7 @@
                }
            }
            
            int count = (int) activityService.getRecommendActivityCount();
            int count = (int) activityService.getRecommendActivityCount(key);
            int totalPage = count % Constant.PAGE_SIZE == 0 ? count / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1;
            PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count, totalPage);
fanli/src/main/java/com/yeshi/fanli/controller/admin/BrandShopAdminController.java
New file
@@ -0,0 +1,433 @@
package com.yeshi.fanli.controller.admin;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.yeshi.fanli.dto.taobao.TaoBaoShopInfoDTO;
import com.yeshi.fanli.entity.brand.BrandClass;
import com.yeshi.fanli.entity.brand.BrandClassShop;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
import com.yeshi.fanli.exception.brand.BrandClassException;
import com.yeshi.fanli.exception.brand.BrandClassShopException;
import com.yeshi.fanli.service.inter.brand.BrandClassService;
import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
import com.yeshi.fanli.tag.PageEntity;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("admin/new/api/v1/brand")
public class BrandShopAdminController {
    @Resource
    private BrandClassService brandClassService;
    @Resource
    private BrandClassShopService brandClassShopService;
    /**
     * 保存信息
     *
     * @param callback
     * @param special
     * @param out
     */
    @RequestMapping(value = "save")
    public void save(String callback, BrandClass brandClass, PrintWriter out) {
        try {
            brandClassService.saveObject(brandClass);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
        } catch (BrandClassException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
            e.printStackTrace();
        }
    }
    /**
     * 修改排序
     *
     * @param callback
     * @param goodsClass
     * @param out
     */
    @RequestMapping(value = "updateOrder")
    public void updateOrder(String callback, Long id, Integer moveType, PrintWriter out) {
        try {
            brandClassService.updateOrder(id, moveType);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (BrandClassException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
            e.printStackTrace();
        }
    }
    /**
     * 查询
     * @param callback
     * @param pageIndex
     * @param pageSize
     * @param key  模糊查询:说明、标识
     * @param out
     */
    @RequestMapping(value = "query")
    public void query(String callback, Integer pageIndex, Integer pageSize, String key,
            Integer state, PrintWriter out) {
        if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
        }
        if (pageSize == null || pageSize < 1) {
            pageSize = Constant.PAGE_SIZE;
        }
        try {
            List<BrandClass> list = brandClassService.listQuery((pageIndex - 1) * pageSize, pageSize, key, state);
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            long count = brandClassService.countQuery(key, state);
            int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
            GsonBuilder gsonBuilder = new GsonBuilder();
            gsonBuilder.serializeNulls();
            Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
            JSONObject data = new JSONObject();
            data.put("pe", pe);
            data.put("result_list", gson.toJson(list));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 删除
     * @param callback
     * @param idArray
     * @param out
     */
    @RequestMapping(value = "delete")
    public void delete(String callback, String idArray, PrintWriter out) {
        try {
            if (StringUtil.isNullOrEmpty(idArray)) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
                return;
            }
            Gson gson = new Gson();
            List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
                return;
            }
            int count = brandClassService.deleteBatchByPrimaryKey(list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除["+ count +"]条数据"));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
            e.printStackTrace();
        }
    }
    /**
     * 筛选列表
     * @param callback
     * @param out
     */
    @RequestMapping(value = "getOptions")
    public void getOptions(String callback, PrintWriter out) {
        try {
            List<BrandClass> list = brandClassService.listEffective();
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            List<Object> result_list = new ArrayList<Object>();
            if (list != null && list.size() > 0) {
                for (BrandClass record: list) {
                    Map<String,Object> map =new HashMap<String,Object>();
                    map.put("key", record.getId());
                    map.put("value", record.getName());
                    result_list.add(map);
                }
            }
            JSONObject data = new JSONObject();
            data.put("result_list", result_list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 查询
     * @param callback
     * @param pageIndex
     * @param pageSize
     * @param key  模糊查询:说明、标识
     * @param out
     */
    @RequestMapping(value = "queryTaoBaoShop")
    public void queryTaoBaoShop(String callback, Integer pageIndex, Integer pageSize, String key, PrintWriter out) {
        if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
        }
        if (pageSize == null || pageSize < 1) {
            pageSize = Constant.PAGE_SIZE;
        }
        try {
            TaoBaoShopInfoDTO  taoBaoShopInfoDTO = TaoKeApiUtil.searchShop(key, pageIndex, pageSize);
            List<TaoBaoShopInfo> listInfo = taoBaoShopInfoDTO.getListInfo();
            if (listInfo == null || listInfo.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            List<Long> listShopId = new ArrayList<Long>();
            for (TaoBaoShopInfo taoBaoShopInfo: listInfo) {
                listShopId.add(taoBaoShopInfo.getUserId());
            }
            // 已存在数据库中
            List<BrandClassShop> listExist = brandClassShopService.getExistByShopIds(listShopId);
            JSONArray array = new JSONArray();
            for (TaoBaoShopInfo taoBaoShopInfo: listInfo) {
                String name = "";
                if (listExist != null && listExist.size() > 0) {
                    Long userId = taoBaoShopInfo.getUserId();
                    for (BrandClassShop brandClassShop: listExist) {
                        TaoBaoShop shop = brandClassShop.getShop();
                        if (shop !=null && userId == shop.getId() || userId.equals(shop.getId()) ) {
                            BrandClass brandClass = brandClassShop.getBrandClass();
                            name = brandClass.getName();
                        }
                    }
                }
                JSONObject innerData = new JSONObject();
                innerData.put("cname", name);
                innerData.put("shopInfo", taoBaoShopInfo);
                array.add(innerData);
            }
            JSONObject data = new JSONObject();
            data.put("pe", taoBaoShopInfoDTO.getPage());
            data.put("result_list",array);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 添加店铺入库
     *
     * @param callback
     * @param special
     * @param out
     */
    @RequestMapping(value = "saveShopInfo")
    public void saveShopInfo(String callback,Long cid, String idArray, PrintWriter out) {
        try {
            if (StringUtil.isNullOrEmpty(idArray)) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
                return;
            }
            Gson gson = new Gson();
            List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
            String shopIds = brandClassShopService.saveShopInfo(cid,list);
            if (StringUtil.isNullOrEmpty(shopIds)) {
                JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
            } else {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("以下店铺ID:"+ shopIds + ",未添加成功"));
            }
        } catch (BrandClassShopException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
            e.printStackTrace();
        }
    }
    /**
     * 查询
     * @param callback
     * @param pageIndex
     * @param pageSize
     * @param key  模糊查询:说明、标识
     * @param out
     */
    @RequestMapping(value = "queryClassShop")
    public void queryClassShop(String callback, Integer pageIndex, Integer pageSize, String key,
            Long cid , Integer state, PrintWriter out) {
        if (pageIndex == null || pageIndex < 1) {
            pageIndex = 1;
        }
        if (pageSize == null || pageSize < 1) {
            pageSize = Constant.PAGE_SIZE;
        }
        try {
            List<BrandClassShop> list = brandClassShopService.listQuery((pageIndex - 1) * pageSize, pageSize, key, cid, state);
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
                return;
            }
            long count = brandClassShopService.countQuery(key, cid, state);
            int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
            PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
            GsonBuilder gsonBuilder = new GsonBuilder();
            gsonBuilder.serializeNulls();
            Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
            JSONObject data = new JSONObject();
            data.put("pe", pe);
            data.put("result_list", gson.toJson(list));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
            e.printStackTrace();
        }
    }
    /**
     * 保存信息
     *
     * @param callback
     * @param special
     * @param out
     */
    @RequestMapping(value = "saveClassShop")
    public void saveClassShop(String callback, Long id, Long cid, String shopName, Integer state, Integer top,
            HttpServletRequest request, PrintWriter out) {
        try {
            if (request instanceof MultipartHttpServletRequest) {
                MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
                brandClassShopService.changeShopInfo(fileRequest.getFile("file"), id, cid, shopName, state, top);
            }else{
                brandClassShopService.changeShopInfo(null, id, cid, shopName, state, top);
            }
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
        } catch (BrandClassShopException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
            e.printStackTrace();
        }
    }
    /**
     * 修改排序
     *
     * @param callback
     * @param goodsClass
     * @param out
     */
    @RequestMapping(value = "updateOrderClassShop")
    public void updateOrderClassShop(String callback, Long id, Integer moveType, PrintWriter out) {
        try {
            brandClassShopService.updateOrder(id, moveType);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
        } catch (BrandClassShopException e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
            e.printStackTrace();
        }
    }
    /**
     * 删除
     * @param callback
     * @param idArray
     * @param out
     */
    @RequestMapping(value = "deleteClassShop")
    public void deleteClassShop(String callback, String idArray, PrintWriter out) {
        try {
            if (StringUtil.isNullOrEmpty(idArray)) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
                return;
            }
            Gson gson = new Gson();
            List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
            if (list == null || list.size() == 0) {
                JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
                return;
            }
            brandClassShopService.deleteBatchByPrimaryKey(list);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("删除成功"));
        } catch (Exception e) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/admin/LableAdminController.java
@@ -61,7 +61,6 @@
     */
    @RequestMapping(value = "saveAdd")
    public void saveAdd(String callback, Long uid, Label label, HttpServletRequest request, PrintWriter out) {
        try {
            String title = label.getTitle();
            if (StringUtil.isNullOrEmpty(title)) {
fanli/src/main/java/com/yeshi/fanli/controller/client/BrandController.java
New file
@@ -0,0 +1,326 @@
package com.yeshi.fanli.controller.client;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.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;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
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.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;
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("api/v1/brand")
public class BrandController {
    @Resource
    private BrandClassService brandClassService;
    @Resource
    private BrandClassShopService brandClassShopService;
    @Resource
    private TaoBaoShopService taoBaoShopService;
    @Resource
    private TaoBaoShopHistoryService taoBaoShopHistoryService;
    @Resource
    private HongBaoManageService manageService;
    @Resource
    private QualityGoodsService qualityGoodsService;
    /**
     * 获取品牌分类
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "getClass", method = RequestMethod.POST)
    public void getClass(AcceptData acceptData, PrintWriter out) {
        try {
            List<BrandClass> list = brandClassService.listBrandClassEffectiveCache();
            if (list == null) {
                list = new ArrayList<BrandClass>();
            }
            JSONObject data = new JSONObject();
            data.put("count", list.size());
            data.put("list", JsonUtil.getApiCommonGson().toJson(list));
            out.print(JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("查询失败"));
            e.printStackTrace();
        }
    }
    /**
     * 添加足迹
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "addHistory", method = RequestMethod.POST)
    public void addHistory(AcceptData acceptData, Long sid, Long uid, PrintWriter out) {
        try {
            if (sid == null || sid == 0) {
                out.print(JsonUtil.loadFalseResult("店铺id为空"));
                return;
            }
            out.print(JsonUtil.loadTrueResult("记录成功"));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("记录失败"));
            e.printStackTrace();
        }
    }
    /**
     * 添加足迹
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "deleteHistory", method = RequestMethod.POST)
    public void deleteHistory(AcceptData acceptData, String ids, Long uid, PrintWriter out) {
        try {
            if (StringUtil.isNullOrEmpty(ids)) {
                out.print(JsonUtil.loadFalseResult("未选择数据"));
                return;
            }
            taoBaoShopHistoryService.deleteHistory(Arrays.asList(ids.split(",")), uid, acceptData.getDevice());
            out.print(JsonUtil.loadTrueResult("删除成功"));
        } catch (Exception e) {
            out.print(JsonUtil.loadFalseResult("删除失败"));
            e.printStackTrace();
        }
    }
    /**
     * 店铺足迹
     *
     * @param acceptData
     * @param type       精选1, 足迹列表2
     * @param out
     */
    @RequestMapping(value = "getHistory", method = RequestMethod.POST)
    public void getHistory(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) {
        try {
            int pageSize;
            if (type == 1) {
                pageSize = 4;
            } else {
                pageSize = Constant.PAGE_SIZE;
            }
            long count = 0;
            List<TaoBaoShopHistory> listHistory = null;
            if (uid == null || uid == 0) {
                String device = acceptData.getDevice();
                count = taoBaoShopHistoryService.countByDevice(device);
                if (count > 0) {
                    listHistory = taoBaoShopHistoryService.listByDevice((page - 1) * pageSize, pageSize, device);
                }
            } else {
                count = taoBaoShopHistoryService.countByUid(uid);
                if (count > 0) {
                    listHistory = taoBaoShopHistoryService.listByUid((page - 1) * pageSize, pageSize, uid);
                }
            }
            List<TaoBaoShop> list = new ArrayList<TaoBaoShop>();
            if (listHistory != null && listHistory.size() > 0) {
                for (TaoBaoShopHistory history : listHistory) {
                    TaoBaoShop taoBaoShop = history.getTaoBaoShop();
                    if (taoBaoShop != null) {
                        String shopLink = taoBaoShop.getShopLink();
                        if (StringUtil.isNullOrEmpty(shopLink)) {
                            taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId()));
                        }
                        String shopNameCustom = taoBaoShop.getShopNameCustom();
                        if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
                            taoBaoShop.setShopName(shopNameCustom);
                        }
                        String shopIconCustom = taoBaoShop.getShopIconCustom();
                        if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
                            taoBaoShop.setShopIcon(shopIconCustom);
                        }
                        list.add(taoBaoShop);
                    }
                }
            }
            JSONObject data = new JSONObject();
            data.put("count", list.size());
            data.put("list", JsonUtil.getApiCommonGson().toJson(list));
            out.print(JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            e.printStackTrace();
            out.print(JsonUtil.loadFalseResult("查询失败"));
        }
    }
    /**
     * 店铺列表
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "getShopList", method = RequestMethod.POST)
    public void getShopList(AcceptData acceptData, Integer page, Long cid, PrintWriter out) {
        try {
            if (page == null || page < 1) {
                page = 1;
            }
            JSONObject data = brandClassShopService.listEffectiveCache(page, cid);
            out.print(JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            e.printStackTrace();
            out.print(JsonUtil.loadFalseResult("查询失败"));
        }
    }
    /**
     * 店铺详情页
     *
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "getShopInfo", method = RequestMethod.POST)
    public void getShopInfo(AcceptData acceptData, Integer page, Long sid, Long uid, PrintWriter out) {
        try {
            JSONObject data = new JSONObject();
            if (page == 1) {
                TaoBaoShop taoBaoShop = taoBaoShopService.selectByPrimaryKey(sid);
                if (taoBaoShop == null) {
                    out.print(JsonUtil.loadFalseResult("店铺信息获取失败"));
                }
                String shopLink = taoBaoShop.getShopLink();
                if (StringUtil.isNullOrEmpty(shopLink)) {
                    taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId()));
                }
                String shopNameCustom = taoBaoShop.getShopNameCustom();
                if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
                    taoBaoShop.setShopName(shopNameCustom);
                }
                String shopIconCustom = taoBaoShop.getShopIconCustom();
                if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
                    taoBaoShop.setShopIcon(shopIconCustom);
                }
                data.put("shop", taoBaoShop);
                ThreadUtil.run(new Runnable() {
                    public void run() {
                        // 添加足迹
                        taoBaoShopHistoryService.addHistory(sid, uid, acceptData.getDevice());
                    }
                });
            }
            int pageSize = Constant.PAGE_SIZE;
            List<QualityFactory> listQuery = qualityGoodsService.listByShopId((page - 1) * pageSize, pageSize, sid);
            long count = 0;
            JSONArray array = new JSONArray();
            if (listQuery != null && listQuery.size() > 0) {
                List<Long> listGid = new ArrayList<Long>();
                for (QualityFactory qualityFactory : listQuery) {
                    TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief();
                    if (taoBaoGoodsBrief == null) {
                        continue;
                    }
                    listGid.add(taoBaoGoodsBrief.getAuctionId());
                }
                // API网络接口验证是否在售
                List<TaoBaoGoodsBrief> listTaoKeGoods = null;
                try {
                    listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
                } catch (TaoKeApiException e) {
                    e.printStackTrace();
                } catch (TaobaoGoodsDownException e) {
                    e.printStackTrace();
                } catch (Exception e) {
                    e.printStackTrace();
                }
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                BigDecimal proportion = manageService.getFanLiRate();
                for (QualityFactory selectionGoods : listQuery) {
                    TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
                    if (taoBaoGoodsBrief == null) {
                        continue;
                    }
                    if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) {
                        boolean stateSale = false; // 默认停售
                        Long goodsId = taoBaoGoodsBrief.getAuctionId();
                        for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) {
                            Long auctionId = taoKeGoods.getAuctionId();
                            if (goodsId == auctionId || goodsId.equals(auctionId)) {
                                stateSale = true; // 在售
                                break;
                            }
                        }
                        if (!stateSale) {
                            continue;
                        }
                    }
                    array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
                }
                count = qualityGoodsService.countByShopId(sid);
            }
            data.put("count", count);
            data.put("list", array);
            out.print(JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
            e.printStackTrace();
            out.print(JsonUtil.loadFalseResult("查询失败"));
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/TaoBaoClassMapper.java
@@ -4,22 +4,19 @@
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass;
public interface TaoBaoClassMapper {
public interface TaoBaoClassMapper extends BaseMapper<TaoBaoClass>{
    int deleteByPrimaryKey(Long id);
    int insert(TaoBaoClass record);
    int insertSelective(TaoBaoClass record);
    TaoBaoClass selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(TaoBaoClass record);
    int updateByPrimaryKey(TaoBaoClass record);
    
    List<TaoBaoClass> listBySystemCid(@Param("start") long start, @Param("count") int count,
            @Param("systemCid") Long systemCid);
    /**
     * 根据淘宝分类查询
     * @param categoryId
     * @return
     */
    TaoBaoClass getByCategoryId(@Param("categoryId") Integer categoryId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/TaoBaoClassRelationMapper.java
@@ -2,24 +2,25 @@
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation;
public interface TaoBaoClassRelationMapper {
public interface TaoBaoClassRelationMapper extends BaseMapper<TaoBaoClassRelation>{
    int deleteByPrimaryKey(Long id);
    int insert(TaoBaoClassRelation record);
    int insertSelective(TaoBaoClassRelation record);
    TaoBaoClassRelation selectByPrimaryKey(Long id);
    int updateByPrimaryKeySelective(TaoBaoClassRelation record);
    int updateByPrimaryKey(TaoBaoClassRelation record);
    
    List<TaoBaoClassRelation> listByTaoBaoCid(Long taobaoCid);
    
    /**
     * 根据分类id查询
     * @param taobaoCid
     * @return
     */
    TaoBaoClassRelation getByLocalCid(Long localCid);
    /**
     *
     * @param localCid
     * @param classId
     */
    void deleteRelationByLocalCid(Long localCid);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/activity/RecommendActivityMapper.java
@@ -24,7 +24,7 @@
    List<RecommendActivity> getRecommendActivityList(@Param("start") long start, @Param("count") int count);
    long getRecommendActivityCount();
    long getRecommendActivityCount(@Param("title") String title);
    
    long getRecommendActivityEffectiveCount();
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandClassMapper.java
New file
@@ -0,0 +1,54 @@
package com.yeshi.fanli.dao.mybatis.brand;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.brand.BrandClass;
public interface BrandClassMapper extends BaseMapper<BrandClass>{
    /**
     * 查询品牌分类
     * @return
     */
    List<BrandClass> listEffective();
    /**
     * 排序
     * @return
     */
    int getMaxOrder();
    /**
     * 获取相邻序号
     * @param position
     * @param type
     * @return
     */
    BrandClass getByAdjoinOrder(@Param("order") Integer order,    @Param("type") Integer type);
    /**
     * 根据主键批量删除
     * @param list
     * @return
     */
    int deleteBatchByPrimaryKey(List<Long> list);
    /**
     * 查询列表
     * @param start
     * @param count
     * @param key
     * @param state
     * @return
     */
    List<BrandClass> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key,
            @Param("state") Integer state);
    long countQuery(@Param("key") String key, @Param("state") Integer state);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/BrandClassShopMapper.java
New file
@@ -0,0 +1,80 @@
package com.yeshi.fanli.dao.mybatis.brand;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.brand.BrandClassShop;
public interface BrandClassShopMapper extends BaseMapper<BrandClassShop>{
    /**
     * 根据分类id批量删除
     * @param list
     * @return
     */
    int deleteBatchByClassId(List<Long> list);
    /**
     * 查询有效
     * @param start
     * @param count
     * @param cid
     * @return
     */
    List<BrandClassShop> listEffective(@Param("cid") Long cid);
    long countEffective(@Param("cid") Long cid);
    List<BrandClassShop> getExistByShopIds(List<Long> list);
    /**
     * 根据店铺id
     * @param cid
     * @param shopId
     * @return
     */
    BrandClassShop getByShopId(@Param("shopId") Long shopId);
    /**
     * 根据店铺id、分类id查询
     * @param cid
     * @param shopId
     * @return
     */
    BrandClassShop getByShopIdAndCid(@Param("cid") Long cid, @Param("shopId") Long shopId);
    /**
     * 根据分类查询排序
     * @param cid
     * @return
     */
    int getMaxOrder(@Param("cid") Long cid);
    /**
     * 排序交换
     * @param order
     * @param type
     * @return
     */
    BrandClassShop getByAdjoinOrder(@Param("cid") Long cid, @Param("order") Integer order,    @Param("type") Integer type);
    /**
     * 查询列表
     * @param start
     * @param count
     * @param key
     * @param state
     * @return
     */
    public List<BrandClassShop> listQuery(@Param("start") long start,@Param("count") int count,
            @Param("key")String key, @Param("cid") Long cid,@Param("state") Integer state);
    public long countQuery(@Param("key")String key, @Param("cid") Long cid,@Param("state") Integer state);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/brand/TaoBaoShopHistoryMapper.java
New file
@@ -0,0 +1,72 @@
package com.yeshi.fanli.dao.mybatis.brand;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.brand.TaoBaoShopHistory;
public interface TaoBaoShopHistoryMapper extends BaseMapper<TaoBaoShopHistory> {
    /**
     * 根据用户id删除
     * @param uid
     * @return
     */
    void updateByUid(@Param("shopId") Long shopId, @Param("uid") Long uid);
    /**
     * 根据删除
     * @param sid
     * @param device
     * @return
     */
    void updateByDevice(@Param("shopId") Long shopId, @Param("device") String device);
    /**
     * 根据用户id查询
     * @param uid
     * @return
     */
    TaoBaoShopHistory getByUid(@Param("shopId") Long shopId, @Param("uid") Long uid);
    /**
     * 根据设备
     * @param sid
     * @param device
     * @return
     */
    TaoBaoShopHistory getByDevice(@Param("shopId") Long shopId, @Param("device") String device);
    /**
     * 根据用户id查询
     * @param uid
     * @return
     */
    List<TaoBaoShopHistory> listByUid(@Param("start") long start, @Param("count") int count, @Param("uid") Long uid);
    long countByUid(@Param("uid") Long uid);
    /**
     * 根据用户id查询
     * @param uid
     * @return
     */
    List<TaoBaoShopHistory> listByDevice(@Param("start") long start, @Param("count") int count, @Param("device") String device);
    long countByDevice(@Param("device") String device);
    /**
     * 统计店铺点击数量
     * @param shopId
     * @return
     */
    long countByShopId(@Param("shopId") Long shopId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/CommonGoodsMapper.java
@@ -1,22 +1,29 @@
package com.yeshi.fanli.dao.mybatis.goods;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.goods.CommonGoods;
public interface CommonGoodsMapper {
public interface CommonGoodsMapper extends BaseMapper<CommonGoods> {
    int deleteByPrimaryKey(Long id);
    int insert(CommonGoods record);
    int insertSelective(CommonGoods record);
    CommonGoods selectByPrimaryKey(Long id);
    CommonGoods selectByGoodsIdAndGoodsType(@Param("goodsId") Long goodsId, @Param("goodsType") int goodsType);
    int updateByPrimaryKeySelective(CommonGoods record);
    int updateByPrimaryKey(CommonGoods record);
    /**
     * 根据店铺id查询 最新5个
     * @param goodsId
     * @return
     */
    List<CommonGoods> listBySellerId(@Param("sellerId") Long sellerId);
    /**
     * 统计店铺商品有券数量
     * @param sellerId
     * @return
     */
    long countBySellerIdAndHasCoupon(@Param("sellerId") Long sellerId);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/lable/QualityFactoryMapper.java
@@ -332,4 +332,17 @@
    
    long countFreeGoods(@Param("tkRate") Double tkRate, @Param("lableName") String lableName);
    /**
     * 根据店铺信息获取商品
     * @param start
     * @param count
     * @param shopId
     * @return
     */
    List<QualityFactory> 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/taobao/TaoBaoShopMapper.java
@@ -1,8 +1,28 @@
package com.yeshi.fanli.dao.mybatis.taobao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.vo.brand.TaoBaoShopVO;
public interface TaoBaoShopMapper extends BaseMapper<TaoBaoShop> {
    /**
     * 根据分类查询店铺信息、同时返回商品
     * @param start
     * @param count
     * @param cid
     * @return
     */
    List<TaoBaoShopVO> listBrandShopinfo(@Param("start") long start, @Param("count") int count, @Param("cid") Long cid);
    /**
     * 统计:分类统并商品数量大于3
     * @param cid
     * @return
     */
    long countBrandShopinfo(@Param("cid") Long cid);
}
fanli/src/main/java/com/yeshi/fanli/dto/taobao/TaoBaoShopInfoDTO.java
New file
@@ -0,0 +1,30 @@
package com.yeshi.fanli.dto.taobao;
import java.util.List;
import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
import com.yeshi.fanli.tag.PageEntity;
public class TaoBaoShopInfoDTO {
    private PageEntity page;
    private List<TaoBaoShopInfo> listInfo;
    public PageEntity getPage() {
        return page;
    }
    public void setPage(PageEntity page) {
        this.page = page;
    }
    public List<TaoBaoShopInfo> getListInfo() {
        return listInfo;
    }
    public void setListInfo(List<TaoBaoShopInfo> listInfo) {
        this.listInfo = listInfo;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandClass.java
@@ -1,7 +1,12 @@
package com.yeshi.fanli.entity.brand;
import java.io.Serializable;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
/**
@@ -10,15 +15,49 @@
 * @author Administrator
 *
 */
public class BrandClass {
@Table("yeshi_ec_brand_class")
public class BrandClass implements Serializable{
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    @Expose
    @Column(name = "bc_id")
    private Long id;
    @Expose
    @Column(name = "bc_name")
    private String name;// 分类名称
    @Column(name = "bc_gclass_id")
    private GoodsClass goodsClass;// 对应的一级分类
    private Boolean show;
    @Column(name = "bc_state")
    private Integer state;
    @Column(name = "bc_orderby")
    private Integer orderBy;// 排序值,越小越靠前
    @Column(name = "bc_create_time")
    private Date createTime;
    @Column(name = "bc_update_time")
    private Date updateTime;
    private Long gcid;
    private String gcName;
    public BrandClass() {}
    public BrandClass(Long id) {
        this.id = id;
    }
    public Long getId() {
        return id;
    }
@@ -43,14 +82,6 @@
        this.goodsClass = goodsClass;
    }
    public Boolean getShow() {
        return show;
    }
    public void setShow(Boolean show) {
        this.show = show;
    }
    public Integer getOrderBy() {
        return orderBy;
    }
@@ -74,4 +105,28 @@
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public Long getGcid() {
        return gcid;
    }
    public void setGcid(Long gcid) {
        this.gcid = gcid;
    }
    public String getGcName() {
        return gcName;
    }
    public void setGcName(String gcName) {
        this.gcName = gcName;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/brand/BrandClassShop.java
@@ -2,6 +2,10 @@
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
/**
@@ -10,12 +14,42 @@
 * @author Administrator
 *
 */
@Table("yeshi_ec_brand_class_shop")
public class BrandClassShop {
    @Expose
    @Column(name = "bcs_id")
    private Long id;
    @Column(name = "bcs_cid")
    private BrandClass brandClass;
    @Column(name = "bcs_shop_id")
    private TaoBaoShop shop;
    @Column(name = "bcs_top")
    private Integer top;
    @Column(name = "bcs_orderby")
    private Integer orderby;
    @Column(name = "bcs_state")
    private Integer state;
    // 点击次数
    @Column(name = "bcs_browse_num")
    private Long browseNum;
    @Column(name = "bcs_create_time")
    private Date createTime;
    @Column(name = "bcs_update_time")
    private Date updateTime;
    // 劵数量
    private long couponNum;
    public Long getId() {
        return id;
    }
@@ -40,6 +74,30 @@
        this.shop = shop;
    }
    public Integer getTop() {
        return top;
    }
    public void setTop(Integer top) {
        this.top = top;
    }
    public Integer getOrderby() {
        return orderby;
    }
    public void setOrderby(Integer orderby) {
        this.orderby = orderby;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
    public Date getCreateTime() {
        return createTime;
    }
@@ -47,4 +105,28 @@
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Long getBrowseNum() {
        return browseNum;
    }
    public void setBrowseNum(Long browseNum) {
        this.browseNum = browseNum;
    }
    public long getCouponNum() {
        return couponNum;
    }
    public void setCouponNum(long couponNum) {
        this.couponNum = couponNum;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/brand/TaoBaoShopHistory.java
New file
@@ -0,0 +1,96 @@
package com.yeshi.fanli.entity.brand;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
/**
 * 店铺足迹
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_taobao_shop_history")
public class TaoBaoShopHistory {
    @Column(name = "tsh_id")
    private Long id;
    // 店铺id
    @Column(name = "tsh_shop_id")
    private TaoBaoShop taoBaoShop;
    // 用户id
    @Column(name = "tsh_uid")
    private Long uid;
    // 设备id
    @Column(name = "tsh_device")
    private String device;
    // 用户是否已删除 : 1已删除 0未删除
    @Column(name = "tsh_state")
    private Integer state;
    @Column(name = "tsh_create_time")
    private Date createTime;
    @Column(name = "tsh_update_time")
    private Date updateTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public TaoBaoShop getTaoBaoShop() {
        return taoBaoShop;
    }
    public void setTaoBaoShop(TaoBaoShop taoBaoShop) {
        this.taoBaoShop = taoBaoShop;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public String getDevice() {
        return device;
    }
    public void setDevice(String device) {
        this.device = device;
    }
    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;
    }
    public Integer getState() {
        return state;
    }
    public void setState(Integer state) {
        this.state = state;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/clazz/GoodsClass.java
@@ -65,6 +65,8 @@
    // 关联标签数量
    private int countlabel = 0; 
    private String taobaoCids;
    
    public GoodsClass() {
    }
@@ -190,7 +192,13 @@
    public void setState(Integer state) {
        this.state = state;
    }
    public String getTaobaoCids() {
        return taobaoCids;
    }
    public void setTaobaoCids(String taobaoCids) {
        this.taobaoCids = taobaoCids;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/taobao/TaoBaoShop.java
@@ -1,10 +1,13 @@
package com.yeshi.fanli.entity.taobao;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
/**
 * 淘宝店铺信息(新版)
@@ -13,37 +16,83 @@
 *
 */
@Table("yeshi_ec_taobao_shop_info")
public class TaoBaoShop {
public class TaoBaoShop implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    @Expose
    @Column(name = "tsi_id")
    private Long id;// 卖家ID
    @Expose
    @Column(name = "tsi_user_type")
    private Integer userType;// 用户类型 0-淘宝 1-天猫
    @Expose
    @Column(name = "tsi_shop_id")
    private Long shopId;// 店铺ID
    @Expose
    @Column(name = "tsi_shop_name")
    private String shopName;// 店铺名称
    @Column(name = "tsi_seller_nick")
    private String sellerNick;// 卖家昵称
    private String sellerNick;// 卖家昵
    @Expose
    @Column(name = "tsi_shop_name_custom")
    private String shopNameCustom;// 自定义店铺名称
    @Expose
    @Column(name = "tsi_shop_icon")
    private String shopIcon;// 店铺图标
    @Column(name = "tsi_shop_icon_custom")
    private String shopIconCustom;// 自定义店铺图标
    @Expose
    @Column(name = "tsi_score_goods")
    private BigDecimal scoreGoods;// 商品评分
    @Expose
    @Column(name = "tsi_score_seller")
    private BigDecimal scoreSeller;// 卖家评分
    @Expose
    @Column(name = "tsi_score_logistics")
    private BigDecimal scoreLogistics;// 物流评分
    @Expose
    @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;
    @Expose
    @Column(name = "tsi_good_rate_percentage")
    private BigDecimal goodRatePercentage;// 好评率
    @Column(name = "tsi_update_time")
    private Date updateTime;
    @Expose
    @Column(name = "tsi_shop_link")
    private String shopLink; // 店铺链接
    public TaoBaoShop() {}
    public TaoBaoShop(Long id) {
        this.id = id;
    }
    public Integer getUserType() {
        return userType;
@@ -165,4 +214,20 @@
        this.goodRatePercentage = goodRatePercentage;
    }
    public String getShopLink() {
        return shopLink;
    }
    public void setShopLink(String shopLink) {
        this.shopLink = shopLink;
    }
    public String getShopNameCustom() {
        return shopNameCustom;
    }
    public void setShopNameCustom(String shopNameCustom) {
        this.shopNameCustom = shopNameCustom;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/brand/BrandClassShopException.java
New file
@@ -0,0 +1,32 @@
package com.yeshi.fanli.exception.brand;
public class BrandClassShopException 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 BrandClassShopException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public BrandClassShopException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/TaoBaoClassMapper.xml
@@ -53,4 +53,10 @@
         LIMIT  ${start},${count}
  </select>
  
   <select id="getByCategoryId" resultMap="BaseResultMap">
         SELECT * FROM `yeshi_ec_taobao_class`
         WHERE tc_category_id = #{categoryId}
        LIMIT 1
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/TaoBaoClassRelationMapper.xml
@@ -55,4 +55,15 @@
         WHERE tc.`tc_category_id`= #{taobaoCid,jdbcType=BIGINT}  ORDER BY tm.`tm_weight` DESC LIMIT 0,10
  </select>
  
  <select id="getByLocalCid" resultMap="BaseResultMap" parameterType="java.lang.Long">
         SELECT <include refid="Base_Column_List"/> FROM `yeshi_ec_taobao_class_mapper`
         WHERE tm_taobao_cid = #{localCid,jdbcType=BIGINT}
         LIMIT 1
  </select>
  <delete id="deleteRelationByLocalCid" parameterType="java.lang.Long">
      delete from yeshi_ec_taobao_class_mapper
      where tm_taobao_cid = #{localCid,jdbcType=BIGINT}
  </delete>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/activity/RecommendActivityMapper.xml
@@ -56,20 +56,22 @@
    <select id="queryRecommendActivityList" resultMap="BaseResultMap">
        select * from yeshi_ec_activity_recommend
        left join yeshi_ec_activity_user on ar_activity_uid=au_id
         where 1=1
        SELECT * FROM yeshi_ec_activity_recommend t
        LEFT JOIN yeshi_ec_activity_user u ON t.ar_activity_uid=u.au_id
        WHERE 1=1
             <if test="title != null and title != '' ">
                  ar_title like '%${title}%'
                  AND t.ar_title LIKE '%${title}%'
             </if>
         order by ar_top desc,ar_order_by asc,ar_create_time desc
         limit ${start},${count}
         ORDER BY t.ar_top DESC,t.ar_order_by ASC,t.ar_create_time DESC
         LIMIT ${START},${COUNT}
    </select>
    <select id="getRecommendActivityCount" resultType="java.lang.Long">
        select
        count(ar_id)
        from yeshi_ec_activity_recommend
        SELECT IFNULL(COUNT(t.ar_id),0) FROM yeshi_ec_activity_recommend t
         WHERE 1=1
             <if test="title != null and title != '' ">
                  AND t.ar_title LIKE '%${title}%'
             </if>
    </select>
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandClassMapper.xml
New file
@@ -0,0 +1,110 @@
<?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.brand.BrandClassMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.brand.BrandClass">
    <id column="bc_id" property="id" jdbcType="BIGINT"/>
    <result column="bc_name" property="name" jdbcType="VARCHAR"/>
    <result column="bc_state" property="state" jdbcType="INTEGER"/>
    <result column="bc_orderby" property="orderBy" jdbcType="INTEGER"/>
    <result column="bc_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bc_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="bc_gclass_id" property="goodsClass" javaType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">
        <id column="bc_gclass_id" property="id" jdbcType="BIGINT" />
    </association>
  </resultMap>
  <sql id="Base_Column_List">bc_id,bc_name,bc_gclass_id,bc_state,bc_orderby,bc_create_time,bc_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_brand_class where bc_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_class where bc_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_class (bc_id,bc_name,bc_gclass_id,bc_state,bc_orderby,bc_create_time,bc_update_time) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{goodsClass.id,jdbcType=BIGINT},#{state,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_class
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">bc_id,</if>
      <if test="name != null">bc_name,</if>
      <if test="goodsClass != null">bc_gclass_id,</if>
      <if test="state != null">bc_state,</if>
      <if test="orderBy != null">bc_orderby,</if>
      <if test="createTime != null">bc_create_time,</if>
      <if test="updateTime != null">bc_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="name != null">#{name,jdbcType=VARCHAR},</if>
      <if test="goodsClass != null">#{goodsClass.id,jdbcType=BIGINT},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandClass">update yeshi_ec_brand_class set bc_name = #{name,jdbcType=VARCHAR},bc_gclass_id = #{goodsClass.id,jdbcType=BIGINT},bc_state = #{state,jdbcType=INTEGER},bc_orderby = #{orderBy,jdbcType=INTEGER},bc_create_time = #{createTime,jdbcType=TIMESTAMP},bc_update_time = #{updateTime,jdbcType=TIMESTAMP} where bc_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandClass">update yeshi_ec_brand_class
    <set>
      <if test="name != null">bc_name=#{name,jdbcType=VARCHAR},</if>
      <if test="goodsClass != null">bc_gclass_id=#{goodsClass.id,jdbcType=BIGINT},</if>
      <if test="state != null">bc_state=#{state,jdbcType=INTEGER},</if>
      <if test="orderBy != null">bc_orderby=#{orderBy,jdbcType=INTEGER},</if>
      <if test="createTime != null">bc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">bc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where bc_id = #{id,jdbcType=BIGINT}
  </update>
  <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
        delete from yeshi_ec_brand_class WHERE bc_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
   </delete>
  <select id="listEffective" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_brand_class
    WHERE bc_state = 1
    ORDER BY bc_orderby
  </select>
  <select id="getMaxOrder" resultType="java.lang.Integer">
       SELECT IFNULL(MAX(bc_orderby),0) FROM yeshi_ec_brand_class
  </select>
   <select id="getByAdjoinOrder" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_brand_class
        WHERE  1=1
        <if test="type == -1">
            AND bc_orderby <![CDATA[<]]> #{order}
            ORDER BY bc_orderby desc
        </if>
        <if test="type == 1">
            AND bc_orderby <![CDATA[>]]> #{order}
            ORDER BY bc_orderby
        </if>
        LIMIT 1
   </select>
   <select id="listQuery" resultMap="BaseResultMap">
      SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_brand_class
      WHERE 1=1
          <if test="key != null and key !='' ">
              AND bc_name LIKE '%${key}%'
          </if>
          <if test="state != null">
               AND bc_state = #{state}
          </if>
      ORDER BY bc_orderby
      LIMIT ${start},${count}
  </select>
  <select id="countQuery" resultType="java.lang.Long">
      SELECT IFNULL(COUNT(bc_id),0) FROM yeshi_ec_brand_class
      WHERE 1=1
          <if test="key != null and key !='' ">
              AND bc_name LIKE '%${key}%'
          </if>
          <if test="state != null">
               AND  bc_state =  #{state}
          </if>
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/brand/BrandClassShopMapper.xml
New file
@@ -0,0 +1,189 @@
<?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.brand.BrandClassShopMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.brand.BrandClassShop">
    <id column="bcs_id" property="id" jdbcType="BIGINT"/>
    <result column="bcs_top" property="top" jdbcType="INTEGER"/>
    <result column="bcs_orderby" property="orderby" jdbcType="INTEGER"/>
    <result column="bcs_browse_num" property="browseNum" jdbcType="BIGINT"/>
    <result column="bcs_state" property="state" jdbcType="INTEGER"/>
    <result column="bcs_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bcs_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="bcs_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass">
        <id column="bcs_cid" property="id" jdbcType="BIGINT" />
    </association>
     <association column="bcs_shop_id" property="shop"
        resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoShopMapper.BaseResultMap">
    </association>
  </resultMap>
  <resultMap id="BaseResultAllMap" type="com.yeshi.fanli.entity.brand.BrandClassShop">
    <id column="bcs_id" property="id" jdbcType="BIGINT"/>
    <result column="bcs_top" property="top" jdbcType="INTEGER"/>
    <result column="bcs_orderby" property="orderby" jdbcType="INTEGER"/>
    <result column="bcs_browse_num" property="browseNum" jdbcType="BIGINT"/>
    <result column="bcs_state" property="state" jdbcType="INTEGER"/>
    <result column="bcs_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="bcs_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="bcs_cid" property="brandClass"
           resultMap="com.yeshi.fanli.dao.mybatis.brand.BrandClassMapper.BaseResultMap">
    </association>
     <association column="bcs_shop_id" property="shop"
         resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoShopMapper.BaseResultMap">
    </association>
  </resultMap>
  <sql id="Base_Column_List">bcs_id,bcs_cid,bcs_shop_id,bcs_top,bcs_orderby,bcs_browse_num,bcs_state,bcs_create_time,bcs_update_time,bcs_shop_id AS tsi_id</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_brand_class_shop where bcs_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_class_shop where bcs_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandClassShop" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_class_shop (bcs_id,bcs_cid,bcs_shop_id,bcs_top,bcs_orderby,bcs_browse_num,bcs_state,bcs_create_time,bcs_update_time) values (#{id,jdbcType=BIGINT},#{brandClass.id,jdbcType=BIGINT},#{shop.id,jdbcType=BIGINT},#{top,jdbcType=INTEGER},#{orderby,jdbcType=INTEGER},#{browseNum,jdbcType=BIGINT},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandClassShop" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_class_shop
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">bcs_id,</if>
      <if test="brandClass != null">bcs_cid,</if>
      <if test="shop != null">bcs_shop_id,</if>
      <if test="top != null">bcs_top,</if>
      <if test="orderby != null">bcs_orderby,</if>
      <if test="browseNum != null">bcs_browse_num,</if>
      <if test="state != null">bcs_state,</if>
      <if test="createTime != null">bcs_create_time,</if>
      <if test="updateTime != null">bcs_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="brandClass != null">#{brandClass.id,jdbcType=BIGINT},</if>
      <if test="shop != null">#{shop.id,jdbcType=BIGINT},</if>
      <if test="top != null">#{top,jdbcType=INTEGER},</if>
      <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if>
      <if test="browseNum != null">#{browseNum,jdbcType=BIGINT},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandClassShop">update yeshi_ec_brand_class_shop set bcs_cid = #{brandClass.id,jdbcType=BIGINT},bcs_shop_id = #{shop.id,jdbcType=BIGINT},bcs_top = #{top,jdbcType=INTEGER},bcs_orderby = #{orderby,jdbcType=INTEGER},bcs_browse_num = #{browseNum,jdbcType=BIGINT},bcs_state = #{state,jdbcType=INTEGER},bcs_create_time = #{createTime,jdbcType=TIMESTAMP},bcs_update_time = #{updateTime,jdbcType=TIMESTAMP} where bcs_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandClassShop">update yeshi_ec_brand_class_shop
    <set>
      <if test="brandClass != null">bcs_cid=#{brandClass.id,jdbcType=BIGINT},</if>
      <if test="shop != null">bcs_shop_id=#{shop.id,jdbcType=BIGINT},</if>
      <if test="top != null">bcs_top=#{top,jdbcType=INTEGER},</if>
      <if test="orderby != null">bcs_orderby=#{orderby,jdbcType=INTEGER},</if>
      <if test="browseNum != null">bcs_browse_num=#{browseNum,jdbcType=BIGINT},</if>
      <if test="state != null">bcs_state=#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">bcs_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">bcs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where bcs_id = #{id,jdbcType=BIGINT}
  </update>
   <delete id="deleteBatchByClassId" parameterType="java.util.List">
        delete from yeshi_ec_brand_class_shop WHERE bcs_cid in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
   </delete>
  <select id="listEffective" resultMap="BaseResultMap">
      SELECT * FROM  yeshi_ec_brand_class_shop b
    LEFT JOIN `yeshi_ec_taobao_shop_info` p ON b.`bcs_shop_id` = p.`tsi_id`
    WHERE 1=1
        <if test="cid != null and cid !=0 ">
            AND b.`bcs_cid` = #{cid}
        </if>
    ORDER BY b.`bcs_top`,b.`bcs_create_time` DESC
  </select>
  <select id="countEffective" resultType="Long">
      SELECT IFNULL(COUNT(b.`bcs_cid`),0) FROM  yeshi_ec_brand_class_shop b
    LEFT JOIN `yeshi_ec_taobao_shop_info` p ON b.`bcs_shop_id` = p.`tsi_id`
    WHERE 1=1
        <if test="cid != null and cid !=0 ">
            AND b.`bcs_cid` = #{cid}
        </if>
  </select>
   <select id="getExistByShopIds" parameterType="java.util.List" resultMap="BaseResultAllMap">
      SELECT * FROM  yeshi_ec_brand_class_shop cp
      LEFT JOIN `yeshi_ec_taobao_shop_info` p ON p.`tsi_id` = cp.`bcs_shop_id`
      LEFT JOIN `yeshi_ec_brand_class` c ON c.`bc_id` = cp.`bcs_cid`
    WHERE cp.bcs_shop_id in
        <foreach collection="list" item="item" open="(" close=")"
            separator=",">#{item}</foreach>
  </select>
   <select id="getByShopIdAndCid" resultMap="BaseResultAllMap">
      SELECT * FROM  yeshi_ec_brand_class_shop
    WHERE bcs_shop_id = #{shopId} AND bcs_cid = #{cid}
    limit 1
  </select>
   <select id="getByShopId" resultMap="BaseResultAllMap">
      SELECT * FROM  yeshi_ec_brand_class_shop
    WHERE bcs_shop_id = #{shopId}
    limit 1
  </select>
  <select id="getMaxOrder" resultType="Integer">
      SELECT IFNULL(COUNT(bcs_id),0) FROM  yeshi_ec_brand_class_shop
    WHERE bcs_cid = #{cid}
  </select>
   <select id="getByAdjoinOrder" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_brand_class_shop
        WHERE bcs_cid = #{cid}
        <if test="type == -1">
            AND bcs_orderby <![CDATA[<]]> #{order}
            ORDER BY bcs_orderby desc
        </if>
        <if test="type == 1">
            AND bcs_orderby <![CDATA[>]]> #{order}
            ORDER BY bcs_orderby
        </if>
        LIMIT 1
   </select>
  <select id="listQuery" resultMap="BaseResultAllMap">
      SELECT * FROM `yeshi_ec_brand_class_shop` cp
    LEFT JOIN `yeshi_ec_taobao_shop_info` p ON p.`tsi_id` = cp.`bcs_shop_id`
    LEFT JOIN `yeshi_ec_brand_class` c ON c.`bc_id` = cp.`bcs_cid`
    WHERE 1=1
        <if test="key != null and key !='' ">
              AND p.`tsi_shop_name` LIKE '%${key}%' or p.`tsi_seller_nick` LIKE '%${key}%'
          </if>
          <if test="cid != null">
              AND cp.`bcs_cid` = #{cid}
          </if>
          <if test="state != null">
              AND cp.`bcs_state` = #{state}
          </if>
    ORDER BY cp.`bcs_cid`,cp.`bcs_top` DESC,cp.`bcs_orderby`
      LIMIT ${start},${count}
  </select>
  <select id="countQuery" resultType="java.lang.Long">
     SELECT IFNULL(COUNT(cp.bcs_id),0) FROM `yeshi_ec_brand_class_shop` cp
     LEFT JOIN `yeshi_ec_taobao_shop_info` p ON p.`tsi_id` = cp.`bcs_shop_id`
     WHERE 1=1
        <if test="key != null and key !='' ">
              AND p.`tsi_shop_name` LIKE '%${key}%' or p.`tsi_seller_nick` LIKE '%${key}%'
          </if>
          <if test="cid != null">
              AND cp.`bcs_cid` = #{cid}
          </if>
          <if test="state != null">
              AND cp.`bcs_state` = #{state}
          </if>
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/brand/TaoBaoShopHistoryMapper.xml
New file
@@ -0,0 +1,108 @@
<?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.brand.TaoBaoShopHistoryMapper">
  <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.brand.TaoBaoShopHistory">
    <id column="tsh_id" property="id" jdbcType="BIGINT"/>
    <result column="tsh_uid" property="uid" jdbcType="BIGINT"/>
    <result column="tsh_device" property="device" jdbcType="VARCHAR"/>
    <result column="tsh_state" property="state" jdbcType="INTEGER"/>
    <result column="tsh_create_time" property="createTime" jdbcType="TIMESTAMP"/>
    <result column="tsh_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    <association column="tsh_shop_id" property="taoBaoShop"
        resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoShopMapper.BaseResultMap">
    </association>
  </resultMap>
  <sql id="Base_Column_List">tsh_id,tsh_shop_id,tsh_uid,tsh_device,tsh_state,tsh_create_time,tsh_update_time</sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
    <include refid="Base_Column_List"/>from yeshi_ec_taobao_shop_history where tsh_id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_taobao_shop_history where tsh_id = #{id,jdbcType=BIGINT}</delete>
  <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_shop_history (tsh_id,tsh_shop_id,tsh_uid,tsh_device,tsh_state,tsh_create_time,tsh_update_time) values (#{id,jdbcType=BIGINT},#{taoBaoShop.id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
  <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_taobao_shop_history
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">tsh_id,</if>
      <if test="taoBaoShop != null">tsh_shop_id,</if>
      <if test="uid != null">tsh_uid,</if>
      <if test="device != null">tsh_device,</if>
      <if test="state != null">tsh_state,</if>
      <if test="createTime != null">tsh_create_time,</if>
      <if test="updateTime != null">tsh_update_time,</if>
    </trim>values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">#{id,jdbcType=BIGINT},</if>
      <if test="taoBaoShop != null">#{taoBaoShop.id,jdbcType=BIGINT},</if>
      <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
      <if test="device != null">#{device,jdbcType=VARCHAR},</if>
      <if test="state != null">#{state,jdbcType=INTEGER},</if>
      <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory">update yeshi_ec_taobao_shop_history set tsh_shop_id = #{taoBaoShop.id,jdbcType=BIGINT},tsh_uid = #{uid,jdbcType=BIGINT},tsh_device = #{device,jdbcType=VARCHAR},tsh_state = #{state,jdbcType=INTEGER},tsh_create_time = #{createTime,jdbcType=TIMESTAMP},tsh_update_time = #{updateTime,jdbcType=TIMESTAMP} where tsh_id = #{id,jdbcType=BIGINT}</update>
  <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.TaoBaoShopHistory">update yeshi_ec_taobao_shop_history
    <set>
      <if test="taoBaoShop != null">tsh_shop_id=#{taoBaoShop.id,jdbcType=BIGINT},</if>
      <if test="uid != null">tsh_uid=#{uid,jdbcType=BIGINT},</if>
      <if test="device != null">tsh_device=#{device,jdbcType=VARCHAR},</if>
      <if test="state != null">tsh_state=#{state,jdbcType=VARCHAR},</if>
      <if test="createTime != null">tsh_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
      <if test="updateTime != null">tsh_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
    </set> where tsh_id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByUid">
        update yeshi_ec_taobao_shop_history set tsh_state = 1
        where  tsh_uid = #{uid} AND tsh_shop_id = #{shopId}
  </update>
  <update id="updateByDevice">
        update yeshi_ec_taobao_shop_history set tsh_state = 1
        where  tsh_device = #{device} AND tsh_shop_id = #{shopId}
  </update>
  <select id="getByUid" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_shop_history h
    WHERE h.tsh_uid = #{uid} AND h.tsh_shop_id = #{shopId}
    LIMIT 1
  </select>
  <select id="getByDevice" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_shop_history h
    WHERE  h.tsh_device = #{device} AND h.tsh_shop_id = #{shopId}
    LIMIT 1
  </select>
  <select id="listByUid" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_shop_history h
    LEFT JOIN `yeshi_ec_taobao_shop_info` p ON h.`tsh_shop_id` = p.`tsi_id`
    WHERE h.tsh_uid = #{uid} AND tsh_state = 0
    ORDER BY  h.tsh_update_time DESC
    LIMIT ${start},${count}
  </select>
  <select id="countByUid" resultType="Long">
      SELECT IFNULL(COUNT(tsh_id),0) FROM yeshi_ec_taobao_shop_history
    WHERE tsh_uid = #{uid} AND tsh_state = 0
  </select>
   <select id="listByDevice" resultMap="BaseResultMap">
      SELECT * FROM yeshi_ec_taobao_shop_history h
      LEFT JOIN `yeshi_ec_taobao_shop_info` p ON h.`tsh_shop_id` = p.`tsi_id`
    WHERE h.tsh_device = #{device} AND tsh_state = 0
    ORDER BY h.tsh_update_time DESC
    LIMIT ${start},${count}
  </select>
   <select id="countByDevice" resultType="Long">
      SELECT IFNULL(COUNT(tsh_id),0) FROM yeshi_ec_taobao_shop_history
    WHERE tsh_device = #{device} AND tsh_state = 0
  </select>
  <select id="countByShopId" resultType="Long">
      SELECT IFNULL(COUNT(tsh_id),0) FROM `yeshi_ec_taobao_shop_history`
    WHERE tsh_shop_id = #{shopId}
  </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/goods/CommonGoodsMapper.xml
@@ -168,4 +168,16 @@
        </set>
        where cg_id = #{id,jdbcType=BIGINT}
    </update>
    <select id="listBySellerId" resultMap="BaseResultMap">
        SELECT * FROM  yeshi_ec_common_goods
        WHERE cg_seller_id = #{sellerId}
        ORDER BY cg_updatetime  DESC
        LIMIT 0,5
    </select>
    <select id="countBySellerIdAndHasCoupon" resultType="Long">
        SELECT IFNULL(COUNT(cg_id),0) FROM  yeshi_ec_common_goods
        WHERE <![CDATA[cg_coupon_amount > 0 AND cg_coupon_left_count > 1]]>
            AND cg_seller_id = #{sellerId}
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/lable/QualityFactoryMapper.xml
@@ -1362,5 +1362,19 @@
             <![CDATA[AND tg.`tkRate` >= #{tkRate}]]>
    </select>
    
    <select id="listByShopId" resultMap="GoodsResultMap">
        SELECT * FROM  yeshi_ec_quality_factory q
        LEFT JOIN `yeshi_ec_taobao_goods` t ON q.`sg_goods_id` = t.`id`
        WHERE t.`sellerId` = #{shopId}
        ORDER BY q.`sg_weight` DESC
        LIMIT #{start},#{count}
    </select>
    <select id="countByShopId" resultType="java.lang.Long">
        SELECT  ifnull(count(sg_id),0) FROM  yeshi_ec_quality_factory q
        LEFT JOIN `yeshi_ec_taobao_goods` t ON q.`sg_goods_id` = t.`id`
        WHERE t.`sellerId` = #{shopId}
     </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/TaoBaoShopMapper.xml
@@ -7,8 +7,9 @@
        <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_name_custom" property="shopNameCustom" jdbcType="VARCHAR" />
        <result column="tsi_seller_nick" property="sellerNick" jdbcType="VARCHAR" />
        <result column="tsi_shop_link" property="shopLink" jdbcType="VARCHAR" />
        <result column="tsi_shop_icon" property="shopIcon" jdbcType="VARCHAR" />
        <result column="tsi_shop_icon_custom" property="shopIconCustom"
            jdbcType="VARCHAR" />
@@ -29,7 +30,42 @@
        <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
    <resultMap id="BaseResultVOMap" type="com.yeshi.fanli.vo.brand.TaoBaoShopVO">
        <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_shop_name_custom" property="shopNameCustom" jdbcType="VARCHAR" />
        <result column="tsi_seller_nick" property="sellerNick"    jdbcType="VARCHAR" />
        <result column="tsi_shop_link" property="shopLink" 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" />
        <collection property="listGoodsBrief" column="id" resultMap="com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper.BaseResultMap"/>
    </resultMap>
    <sql id="Base_Column_List">tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_shop_name_custom,tsi_seller_nick,tsi_shop_link,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">
@@ -43,9 +79,9 @@
    <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)
        (tsi_id,tsi_user_type,tsi_shop_id,tsi_shop_name,tsi_shop_name_custom,tsi_seller_nick,tsi_shop_link,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})
        (#{id,jdbcType=BIGINT},#{userType,jdbcType=INTEGER},#{shopId,jdbcType=BIGINT},#{shopName,jdbcType=VARCHAR},#{shopNameCustom,jdbcType=VARCHAR},#{sellerNick,jdbcType=VARCHAR},#{shopLink,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">
@@ -55,7 +91,9 @@
            <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="shopNameCustom != null">tsi_shop_name_custom,</if>
            <if test="sellerNick != null">tsi_seller_nick,</if>
            <if test="shopLink != null">tsi_shop_link,</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>
@@ -73,7 +111,9 @@
            <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="shopNameCustom != null">#{shopNameCustom,jdbcType=VARCHAR},</if>
            <if test="sellerNick != null">#{sellerNick,jdbcType=VARCHAR},</if>
            <if test="shopLink != null">#{shopLink,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>
@@ -87,45 +127,69 @@
        </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>
        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_shop_name_custom =    #{shopNameCustom,jdbcType=VARCHAR},
        tsi_seller_nick = #{sellerNick,jdbcType=VARCHAR},
        tsi_shop_link =    #{shopLink,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="shopNameCustom != null">tsi_shop_name_custom=#{shopNameCustom,jdbcType=VARCHAR},</if>
            <if test="sellerNick != null">tsi_seller_nick=#{sellerNick,jdbcType=VARCHAR},</if>
            <if test="shopLink != null">tsi_shop_link=#{shopLink,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="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="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="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>
            <if test="goodRatePercentage !=null">tsi_good_rate_percentage=#{goodRatePercentage,jdbcType=DECIMAL},</if>
        </set>
        where tsi_id = #{id,jdbcType=BIGINT}
    </update>
    <select id="listBrandShopinfo" resultMap="BaseResultVOMap" >
        SELECT tt.*,tg.* FROM
            (SELECT COUNT(t.`id`) AS totalGoods,t.`sellerId` FROM `yeshi_ec_taobao_goods` t
            LEFT JOIN `yeshi_ec_brand_class_shop` p ON t.`sellerId` = p.bcs_shop_id
            WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 <if test="cid != null">AND p.`bcs_cid` =#{cid}</if>
            GROUP BY t.`sellerId` HAVING totalGoods<![CDATA[>]]> 2
            ORDER BY p.`bcs_top`,p.`bcs_create_time` DESC
            LIMIT ${start},${count}
            )a
        LEFT JOIN `yeshi_ec_brand_class_shop` pp ON a.sellerId = pp.bcs_shop_id
        LEFT JOIN `yeshi_ec_taobao_shop_info` tt ON tt.`tsi_id` = pp.bcs_shop_id
        LEFT JOIN `yeshi_ec_taobao_goods` tg ON tg.`sellerId` = a.sellerId
         WHERE (SELECT COUNT(DISTINCT(e1.id)) FROM yeshi_ec_taobao_goods AS e1 WHERE  e1.sellerId = tg.sellerId AND e1.biz30day <![CDATA[ >]]> tg.biz30day)<![CDATA[ <]]> 3
        ORDER BY pp.`bcs_top`,pp.`bcs_create_time` DESC,tg.`biz30day` DESC
    </select>
    <select id="countBrandShopinfo"  resultType="Long">
        SELECT IFNULL(COUNT(*),0) FROM (SELECT COUNT(t.`id`) AS totalGoods FROM `yeshi_ec_taobao_goods` t
            LEFT JOIN `yeshi_ec_brand_class_shop` p ON t.`sellerId` = p.bcs_shop_id
            WHERE p.`bcs_id` IS NOT NULL AND p.`bcs_state` = 1 <if test="cid != null">AND p.`bcs_cid` =#{cid}</if>
            GROUP BY t.`sellerId` HAVING totalGoods<![CDATA[>]]> 2)a
    </select>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/activity/ActivityServiceImpl.java
@@ -120,8 +120,8 @@
    }
    @Override
    public long getRecommendActivityCount() {
        return recommendActivityMapper.getRecommendActivityCount();
    public long getRecommendActivityCount(String title) {
        return recommendActivityMapper.getRecommendActivityCount(title);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassServiceImpl.java
New file
@@ -0,0 +1,153 @@
package com.yeshi.fanli.service.impl.brand;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.brand.BrandClassMapper;
import com.yeshi.fanli.entity.brand.BrandClass;
import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
import com.yeshi.fanli.exception.brand.BrandClassException;
import com.yeshi.fanli.service.inter.brand.BrandClassService;
import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
import com.yeshi.fanli.service.inter.goods.GoodsClassService;
@Service
public class BrandClassServiceImpl implements BrandClassService {
    @Resource
    private BrandClassMapper brandClassMapper;
    @Resource
    private GoodsClassService goodsClassService;
    @Resource
    private BrandClassShopService brandClassShopService;
    @Override
    public List<BrandClass> listEffective() {
        return brandClassMapper.listEffective();
    }
    @Override
    @Cacheable(value = "brandCache", key = "'listBrandClassEffectiveCache'")
    public List<BrandClass> listBrandClassEffectiveCache() {
        return brandClassMapper.listEffective();
    }
    @Override
    public void saveObject(BrandClass record) throws BrandClassException, Exception{
        Long gcid = record.getGcid();
        if (gcid != null) {
            GoodsClass goodsClass = goodsClassService.selectByPrimaryKey(gcid);
            if (goodsClass != null) {
                record.setName(goodsClass.getName());
                record.setGoodsClass(goodsClass);
            }
        }
        String name = record.getName();
        if (name == null || name.trim().length() == 0) {
            throw new BrandClassException(1, "名称和分类不能同时为空");
        }
        Integer state = record.getState();
        if (state == null) {
            record.setState(0);
        }
        Long id = record.getId();
        if (id == null) {
            record.setOrderBy(brandClassMapper.getMaxOrder() + 1);
            record.setCreateTime(new Date());
            record.setUpdateTime(new Date());
            brandClassMapper.insert(record);
        } else {
            BrandClass resultObj = brandClassMapper.selectByPrimaryKey(id);
            if (resultObj == null) {
                throw new BrandClassException(1, "修改内容已不存在");
            }
            record.setOrderBy(resultObj.getOrderBy());
            record.setCreateTime(resultObj.getCreateTime());
            record.setUpdateTime(new Date());
            brandClassMapper.updateByPrimaryKey(record);
        }
    }
    @Override
    public void updateOrder(Long id, Integer moveType) throws BrandClassException, Exception{
        if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
            throw new BrandClassException(1, "传递的类型不正确");
        }
        if (id == null) {
            throw new BrandClassException(1, "ID不能为空");
        }
        BrandClass resultObj = brandClassMapper.selectByPrimaryKey(id);
        if (resultObj == null) {
            throw new BrandClassException(1, "操作数据已不存在");
        }
        Integer oldOrder = resultObj.getOrderBy();
        BrandClass changeObj = brandClassMapper.getByAdjoinOrder(oldOrder, moveType);
        if (changeObj == null ) {
            throw new BrandClassException(1, "已经在最边缘,无可交换的位置");
        }
        // 交换排序序号
        resultObj.setOrderBy(changeObj.getOrderBy());
        changeObj.setOrderBy(oldOrder);
        brandClassMapper.updateByPrimaryKeySelective(changeObj);
        brandClassMapper.updateByPrimaryKeySelective(resultObj);
    }
    @Override
    public int deleteBatchByPrimaryKey(List<Long> list) {
        // 删除已匹配的分类关系
        brandClassShopService.deleteBatchByClassId(list);
        return brandClassMapper.deleteBatchByPrimaryKey(list);
    }
    @Override
    public List<BrandClass> listQuery(long start, int count, String key, Integer state) {
        List<BrandClass> listQuery = brandClassMapper.listQuery(start, count, key, state);
        if (listQuery == null || listQuery.size() == 0) {
            return listQuery;
        }
        for (BrandClass brandClass : listQuery) {
            GoodsClass goodsClass = brandClass.getGoodsClass();
            if (goodsClass != null) {
                GoodsClass baseClass = goodsClassService.selectByPrimaryKey(goodsClass.getId());
                if(baseClass != null) {
                    brandClass.setGcid(goodsClass.getId());
                    brandClass.setGcName(baseClass.getName());
                }
            }
        }
        return listQuery;
    }
    @Override
    public long countQuery(String key, Integer state) {
        return brandClassMapper.countQuery(key, state);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/BrandClassShopServiceImpl.java
New file
@@ -0,0 +1,361 @@
package com.yeshi.fanli.service.impl.brand;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.yeshi.utils.JsonUtil;
import com.yeshi.fanli.dao.mybatis.brand.BrandClassShopMapper;
import com.yeshi.fanli.entity.brand.BrandClass;
import com.yeshi.fanli.entity.brand.BrandClassShop;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.exception.brand.BrandClassShopException;
import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
import com.yeshi.fanli.service.inter.brand.TaoBaoShopHistoryService;
import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
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;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
import com.yeshi.fanli.vo.brand.TaoBaoShopVO;
import net.sf.json.JSONObject;
@Service
public class BrandClassShopServiceImpl implements BrandClassShopService {
    @Resource
    private BrandClassShopMapper brandClassShopMapper;
    @Resource
    private CommonGoodsService commonGoodsService;
    @Resource
    private TaoBaoShopService taoBaoShopService;
    @Resource
    private TaoBaoShopHistoryService taoBaoShopHistoryService;
    @Resource
    private HongBaoManageService manageService;
    @Resource
    private QualityGoodsService qualityGoodsService;
    @Resource
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    @Override
    public List<BrandClassShop> getExistByShopIds(List<Long> list){
        return brandClassShopMapper.getExistByShopIds(list);
    }
    @Override
    @Transactional
    public String saveShopInfo(Long cid, List<Long> list) throws BrandClassShopException{
        if (list == null || list.size() == 0) {
            throw new BrandClassShopException(1, "请选择店铺");
        }
        if (cid == null) {
            throw new BrandClassShopException(1, "请选择店铺类型");
        }
        String shopIds = "";
        BrandClass brandClass = new BrandClass(cid);
        for (Long shopId: list) {
            List<CommonGoods> listGoods= commonGoodsService.listBySellerId(shopId);
            TaoBaoShop taoBaoShop = null;
            for (CommonGoods commonGoods: listGoods) {
                try {
                    taoBaoShop = TaoBaoUtil.getTaoBaoShopDetailByAuctionId(commonGoods.getGoodsId());
                    if (taoBaoShop != null && taoBaoShop.getId() != null) {
                        break;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            if (taoBaoShop == null) {
                shopIds = shopIds + "," + shopId;
                continue;
            }
            TaoBaoShop current = taoBaoShopService.selectByPrimaryKey(shopId);
            if (current == null) {
                taoBaoShopService.insertSelective(taoBaoShop);
            } else {
                taoBaoShopService.updateByPrimaryKeySelective(taoBaoShop);
            }
            BrandClassShop brandClassShop = brandClassShopMapper.getByShopIdAndCid(cid, shopId);
            if (brandClassShop == null) {
                brandClassShop = new BrandClassShop();
                brandClassShop.setOrderby(brandClassShopMapper.getMaxOrder(cid) + 1);
                brandClassShop.setState(0);
                brandClassShop.setTop(0);
                brandClassShop.setBrandClass(brandClass);
                brandClassShop.setShop(taoBaoShop);
                brandClassShop.setCreateTime(new Date());
                brandClassShop.setUpdateTime(new Date());
                brandClassShopMapper.insertSelective(brandClassShop);
            }
        }
        return shopIds;
    }
    @Override
    @Transactional
    public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top) throws BrandClassShopException{
        if (id == null) {
            throw new BrandClassShopException(1, "数据为空:请选择店铺");
        }
        if (cid == null) {
            throw new BrandClassShopException(1, "请选择店铺类型");
        }
        BrandClassShop current = brandClassShopMapper.selectByPrimaryKey(id);
        if (current == null) {
            throw new BrandClassShopException(1, "该数据已不存在");
        }
        TaoBaoShop shop = current.getShop();
        if (shop == null) {
            throw new BrandClassShopException(1, "店铺信息已不存在");
        }
        // 自定义图片
        taoBaoShopService.changeInfo(file, shop.getId(), shopName);
        BrandClassShop updateshop = new BrandClassShop();
        updateshop.setState(state);
        updateshop.setTop(top);
        updateshop.setId(current.getId());
        updateshop.setBrandClass(new BrandClass(cid));
        brandClassShopMapper.updateByPrimaryKeySelective(updateshop);
    }
    @Override
    public List<BrandClassShop> listQuery(long start, int count, String key, Long cid, Integer state) {
        List<BrandClassShop> listQuery = brandClassShopMapper.listQuery(start, count, key, cid, state);
        if (listQuery == null || listQuery.size() == 0) {
            return listQuery;
        }
        for (BrandClassShop brandClassShop : listQuery) {
            TaoBaoShop shop = brandClassShop.getShop();
            if (shop != null) {
                long couponNum = commonGoodsService.countBySellerIdAndHasCoupon(shop.getId());
                brandClassShop.setCouponNum(couponNum);
                String shopLink = shop.getShopLink();
                if (StringUtil.isNullOrEmpty(shopLink)) {
                    shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId()));
                }
                String shopNameCustom = shop.getShopNameCustom();
                if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
                    shop.setShopName(shopNameCustom);
                }
                String shopIconCustom = shop.getShopIconCustom();
                if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
                    shop.setShopIcon(shopIconCustom);
                }
            }
        }
        return listQuery;
    }
    @Override
    public long countQuery(String key, Long cid, Integer state) {
        return brandClassShopMapper.countQuery(key, cid, state);
    }
    @Override
    @Transactional
    public void deleteBatchByPrimaryKey(List<Long> list) {
        if (list == null || list.size() == 0) {
            return;
        }
        for (Long id: list) {
            brandClassShopMapper.deleteByPrimaryKey(id);
        }
    }
    @Override
    public void deleteBatchByClassId(List<Long> list) {
        if (list == null || list.size() == 0) {
            return;
        }
        brandClassShopMapper.deleteBatchByClassId(list);
    }
    @Override
    public void updateOrder(Long id, Integer moveType) throws BrandClassShopException, Exception{
        if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
            throw new BrandClassShopException(1, "传递的类型不正确");
        }
        if (id == null) {
            throw new BrandClassShopException(1, "ID不能为空");
        }
        BrandClassShop resultObj = brandClassShopMapper.selectByPrimaryKey(id);
        if (resultObj == null) {
            throw new BrandClassShopException(1, "操作数据已不存在");
        }
        BrandClass brandClass = resultObj.getBrandClass();
        if (brandClass == null) {
            throw new BrandClassShopException(1, "分类数据已不存在");
        }
        Integer oldOrder = resultObj.getOrderby();
        BrandClassShop changeObj = brandClassShopMapper.getByAdjoinOrder(brandClass.getId(),oldOrder, moveType);
        if (changeObj == null ) {
            throw new BrandClassShopException(1, "已经在最边缘,无可交换的位置");
        }
        // 交换排序序号
        resultObj.setOrderby(changeObj.getOrderby());
        changeObj.setOrderby(oldOrder);
        brandClassShopMapper.updateByPrimaryKeySelective(changeObj);
        brandClassShopMapper.updateByPrimaryKeySelective(resultObj);
    }
    @Override
    @Cacheable(value = "brandCache", key = "'listEffectiveCache-'+#page+'-'+#cid")
    public JSONObject listEffectiveCache(int page, Long cid) {
        long countShop = 0;
        if (cid != null && cid <= 0) {
            cid = null;
        }
        List<TaoBaoShop> listShop = new ArrayList<TaoBaoShop>();
        // 第一页 查询全部分类下店铺
        if (page == 1 &&  cid != null) {
            List<BrandClassShop> list = brandClassShopMapper.listEffective(cid);
            if (list == null) {
                list = new ArrayList<BrandClassShop>();
            } else if (list.size() > 0) {
                countShop = brandClassShopMapper.countEffective(cid);
            }
            for (BrandClassShop brandClassShop : list) {
                TaoBaoShop shop = brandClassShop.getShop();
                if (shop != null) {
                    String shopLink = shop.getShopLink();
                    if (StringUtil.isNullOrEmpty(shopLink)) {
                        shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId()));
                    }
                    String shopNameCustom = shop.getShopNameCustom();
                    if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
                        shop.setShopName(shopNameCustom);
                    }
                    String shopIconCustom = shop.getShopIconCustom();
                    if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
                        shop.setShopIcon(shopIconCustom);
                    }
                    listShop.add(shop);
                }
            }
        }
        JSONObject data = new JSONObject();
        data.put("countShop", countShop);
        data.put("listShop", JsonUtil.getApiCommonGson().toJson(listShop));
        long count = 0;
        List<TaoBaoShopVO> listInfo = taoBaoShopService.listBrandShopinfo((page-1)*Constant.PAGE_SIZE, Constant.PAGE_SIZE, cid);
        if (listInfo == null) {
            listInfo = new ArrayList<TaoBaoShopVO>();
        } else if (listInfo.size() > 0) {
            count = taoBaoShopService.countBrandShopinfo(cid);
        }
        BigDecimal proportion = manageService.getFanLiRate();
        for (TaoBaoShopVO taoBaoShopVO : listInfo) {
            String shopLink = taoBaoShopVO.getShopLink();
            if (StringUtil.isNullOrEmpty(shopLink)) {
                taoBaoShopVO.setShopLink(TaoBaoUtil.getShopLink(taoBaoShopVO.getId()));
            }
            String shopNameCustom = taoBaoShopVO.getShopNameCustom();
            if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
                taoBaoShopVO.setShopName(shopNameCustom);
            }
            String shopIconCustom = taoBaoShopVO.getShopIconCustom();
            if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
                taoBaoShopVO.setShopIcon(shopIconCustom);
            }
            List<TaoBaoGoodsBriefExtra> listGoods = new ArrayList<TaoBaoGoodsBriefExtra>();
            List<TaoBaoGoodsBrief> listGoodsBrief = taoBaoShopVO.getListGoodsBrief();
            for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
                listGoods.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null));
            }
            taoBaoShopVO.setListGoods(listGoods);
        }
        data.put("count", count);
        data.put("list", JsonUtil.getApiCommonGson().toJson(listInfo));
        return data;
    }
    @Override
    public void addClick(Long shopId) {
        BrandClassShop brandClassShop = brandClassShopMapper.getByShopId(shopId);
        if (brandClassShop != null) {
            Long browseNum = brandClassShop.getBrowseNum();
            if (browseNum == null) {
                browseNum = 0L;
            }
            BrandClassShop classShop = new BrandClassShop();
            classShop.setId(brandClassShop.getId());
            classShop.setBrowseNum(browseNum ++);
            brandClassShopMapper.updateByPrimaryKeySelective(classShop);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/brand/TaoBaoShopHistoryServiceImpl.java
New file
@@ -0,0 +1,109 @@
package com.yeshi.fanli.service.impl.brand;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.brand.TaoBaoShopHistoryMapper;
import com.yeshi.fanli.entity.brand.TaoBaoShopHistory;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
import com.yeshi.fanli.service.inter.brand.TaoBaoShopHistoryService;
@Service
public class TaoBaoShopHistoryServiceImpl implements TaoBaoShopHistoryService {
    @Resource
    private TaoBaoShopHistoryMapper taoBaoShopHistoryMapper;
    @Resource(name = "taskExecutor")
    private TaskExecutor executor;
    @Resource
    private BrandClassShopService brandClassShopService;
    @Override
    @Transactional
    public void deleteHistory(List<String> list, Long uid, String device) {
        if (list == null || list.size() == 0) {
            return;
        }
        if (uid == null || uid == 0) {
            for (String shopId:list) {
                taoBaoShopHistoryMapper.updateByDevice(Long.parseLong(shopId), device);
            }
        } else {
            for (String shopId:list) {
                taoBaoShopHistoryMapper.updateByUid(Long.parseLong(shopId), uid);
            }
        }
    }
    @Override
    public void addHistory(Long shopId, Long uid, String device) {
        TaoBaoShopHistory record = null;
        if (uid == null || uid == 0) {
            record = taoBaoShopHistoryMapper.getByDevice(shopId, device);
        } else {
            record = taoBaoShopHistoryMapper.getByUid(shopId, uid);
        }
        if (record != null) {
            TaoBaoShopHistory update = new TaoBaoShopHistory();
            update.setState(0);
            update.setId(record.getId());
            update.setUpdateTime(new Date());
            taoBaoShopHistoryMapper.updateByPrimaryKeySelective(update);
        } else {
            record = new TaoBaoShopHistory();
            record.setUid(uid);
            record.setDevice(device);
            record.setTaoBaoShop(new TaoBaoShop(shopId));
            record.setCreateTime(new Date());
            record.setUpdateTime(new Date());
            taoBaoShopHistoryMapper.insertSelective(record);
        }
        executor.execute(new Runnable() {
            @Override
            public void run() {
                brandClassShopService.addClick(shopId);
            }
        });
    }
    @Override
    public List<TaoBaoShopHistory> listByUid(long start, int count, Long uid) {
        return taoBaoShopHistoryMapper.listByUid(start, count, uid);
    }
    @Override
    public long countByUid(Long uid) {
        return taoBaoShopHistoryMapper.countByUid(uid);
    }
    @Override
    public List<TaoBaoShopHistory> listByDevice(long start, int count,String device) {
        return taoBaoShopHistoryMapper.listByDevice(start, count, device);
    }
    @Override
    public long countByDevice(String device) {
        return taoBaoShopHistoryMapper.countByDevice(device);
    }
    @Override
    public long countByShopId(Long shopId) {
        return taoBaoShopHistoryMapper.countByShopId(shopId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/CommonGoodsServiceImpl.java
@@ -151,4 +151,16 @@
            }
        }
    }
    @Override
    public List<CommonGoods> listBySellerId(Long sellerId) {
        return commonGoodsMapper.listBySellerId(sellerId);
    }
    @Override
    public long countBySellerIdAndHasCoupon(Long sellerId) {
        return commonGoodsMapper.countBySellerIdAndHasCoupon(sellerId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/GoodsClassServiceImpl.java
@@ -21,9 +21,11 @@
import com.yeshi.fanli.dao.mybatis.GoodsClassMapper;
import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass;
import com.yeshi.fanli.exception.GoodsClassException;
import com.yeshi.fanli.service.inter.goods.GoodsClassService;
import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
import com.yeshi.fanli.service.inter.lable.LabelClassService;
import com.yeshi.fanli.util.StringUtil;
@@ -39,6 +41,9 @@
    @Resource
    private LabelClassService labelClassService;
    
    @Resource
    private TaoBaoClassService taoBaoClassService;
    public GoodsClass getGoodsClass(long id) {
        return goodsClassMapper.selectByPrimaryKey(id);
@@ -112,6 +117,23 @@
            // 标签
            int countlabel = labelClassService.getCountQueryByClassId(gclass.getId());
            gclass.setCountlabel(countlabel);
            List<TaoBaoClass> listTB = taoBaoClassService.listBySystemCid(0, Integer.MAX_VALUE, gclass.getId());
            if (listTB == null || listTB.size() == 0) {
                gclass.setTaobaoCids("");
            } else {
                String taobaoCids = "";
                for (TaoBaoClass taoBaoClass: listTB) {
                    taobaoCids = taobaoCids + taoBaoClass.getCategoryName() + "-" + taoBaoClass.getCategoryId() + ",";
                }
                if (!StringUtil.isNullOrEmpty(taobaoCids)){
                    taobaoCids = taobaoCids.substring(0, taobaoCids.length()-1);
                }
                gclass.setTaobaoCids(taobaoCids);
            }
        }
        return list;
    }
@@ -122,6 +144,7 @@
    
    @Override
    @Transactional
    public void saveObject(MultipartFile file, GoodsClass record) throws GoodsClassException, Exception{
        
        String name = record.getName();
@@ -141,6 +164,7 @@
        } else if (!StringUtil.isJson(params)) {
            throw new GoodsClassException(1, "筛选条件非JSON格式");
        }
        
        
        Long id = record.getId();
@@ -189,6 +213,12 @@
            record.setCreatetime(resultObj.getCreatetime());
            goodsClassMapper.updateByPrimaryKey(record);
        }
        // 保存淘宝商品分类id
        String taobaoCids = record.getTaobaoCids();
        if (!StringUtil.isNullOrEmpty(taobaoCids) && !"null".equalsIgnoreCase(taobaoCids)) {
            taoBaoClassService.save(record.getId(), taobaoCids);
        }
    }
    
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/TaoBaoClassServiceImpl.java
@@ -1,13 +1,18 @@
package com.yeshi.fanli.service.impl.goods;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.TaoBaoClassMapper;
import com.yeshi.fanli.dao.mybatis.TaoBaoClassRelationMapper;
import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass;
import com.yeshi.fanli.entity.bus.clazz.TaoBaoClassRelation;
import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
import com.yeshi.fanli.util.StringUtil;
@@ -16,36 +21,10 @@
    @Resource
    private TaoBaoClassMapper taoBaoClassMapper;
    @Resource
    private TaoBaoClassRelationMapper taoBaoClassRelationMapper;
    @Override
    public int deleteByPrimaryKey(Long id) {
        return taoBaoClassMapper.deleteByPrimaryKey(id);
    }
    @Override
    public int insert(TaoBaoClass record) {
        return taoBaoClassMapper.insert(record);
    }
    @Override
    public int insertSelective(TaoBaoClass record) {
        return taoBaoClassMapper.insertSelective(record);
    }
    @Override
    public TaoBaoClass selectByPrimaryKey(Long id) {
        return taoBaoClassMapper.selectByPrimaryKey(id);
    }
    @Override
    public int updateByPrimaryKeySelective(TaoBaoClass record) {
        return taoBaoClassMapper.updateByPrimaryKeySelective(record);
    }
    @Override
    public int updateByPrimaryKey(TaoBaoClass record) {
        return taoBaoClassMapper.updateByPrimaryKey(record);
    }
    @Override
    public List<TaoBaoClass> listBySystemCid(long start, int count, Long systemCid) {
@@ -54,8 +33,6 @@
    
    @Override
    public String getTaoBaoCatIds(Long classId) {
        List<TaoBaoClass> listCatIds = listBySystemCid(0, 10, classId);
        if (listCatIds == null || listCatIds.size() == 0) {
            return null;
@@ -68,16 +45,103 @@
              if (categoryId == null ) {
                  continue;
              }
              taobaoCatIds += categoryId + ",";
        }
        
        if (!StringUtil.isNullOrEmpty(taobaoCatIds)){
            taobaoCatIds = taobaoCatIds.substring(0, taobaoCatIds.length()-1);
        } 
        return taobaoCatIds;
    }
    
    @Override
    public TaoBaoClass getByCategoryId(Integer categoryId) {
        return taoBaoClassMapper.getByCategoryId(categoryId);
    }
    @Override
    @Transactional
    public void save(Long classId, String taobaoCids) {
        if (StringUtil.isNullOrEmpty(taobaoCids) || "null".equalsIgnoreCase(taobaoCids)) {
            return;
        }
        List<Long> listId = new ArrayList<Long>();
        List<TaoBaoClass> listExist = taoBaoClassMapper.listBySystemCid(0, Integer.MAX_VALUE, classId);
        if (listExist != null && listExist.size() > 0) {
            for (TaoBaoClass taoBaoClass: listExist) {
                listId.add(taoBaoClass.getId());
            }
        }
        String[] array = taobaoCids.split(",");
        for (String info: array) {
            if(StringUtil.isNullOrEmpty(info)) {
                continue;
            }
            try {
                String[] taobaoArray = info.split("-");
                Integer categoryId = Integer.parseInt(taobaoArray[1]);
                if (listExist != null && listExist.size() > 0) {
                    for (int i =0; i< listExist.size(); i++) {
                        TaoBaoClass taoBaoClass = listExist.get(i);
                        Integer categoryId2 = taoBaoClass.getCategoryId();
                        if (categoryId == categoryId2 || categoryId.equals(categoryId2)) {
                            if (listId.size() > 0) {
                                listId.remove(taoBaoClass.getId());
                                listExist.remove(i);
                                i--;
                            }
                        }
                    }
                }
                TaoBaoClass tbClass = taoBaoClassMapper.getByCategoryId(Integer.parseInt(taobaoArray[1]));
                if (tbClass == null) {
                    tbClass = new TaoBaoClass();
                    tbClass.setCategoryName(taobaoArray[0].trim());
                    tbClass.setCategoryId(Integer.parseInt(taobaoArray[1].trim()));
                    tbClass.setCreatetime(new Date());
                    tbClass.setUpdatetime(new Date());
                    taoBaoClassMapper.insert(tbClass);
                }
                TaoBaoClassRelation relation = taoBaoClassRelationMapper.getByLocalCid(tbClass.getId());
                if (relation != null) {
                    if (classId.equals(relation.getCid()) || classId == relation.getCid()) {
                        continue;
                    }
                    TaoBaoClassRelation updateRelation = new TaoBaoClassRelation();
                    updateRelation.setId(relation.getId());
                    updateRelation.setCid(classId);
                    updateRelation.setUpdatetime(new Date());
                    taoBaoClassRelationMapper.updateByPrimaryKeySelective(updateRelation);
                } else {
                    relation = new TaoBaoClassRelation();
                    relation.setCid(classId);
                    relation.setTaobaoCid(tbClass.getId());
                    relation.setCreatetime(new Date());
                    relation.setUpdatetime(new Date());
                    relation.setWeight(0.0);
                    taoBaoClassRelationMapper.insertSelective(relation);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        if (listId.size() > 0) {
            for (Long id: listId) {
                taoBaoClassMapper.deleteByPrimaryKey(id);
                taoBaoClassRelationMapper.deleteRelationByLocalCid(id);
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/lable/QualityGoodsServiceImpl.java
@@ -388,4 +388,14 @@
        return qualityFactoryMapper.countFreeGoods(tkRate, lableName);
    }
    
    @Override
    public List<QualityFactory> listByShopId(long start, int count, Long shopId) {
        return qualityFactoryMapper.listByShopId(start, count, shopId);
    }
    @Override
    public long countByShopId(Long shopId) {
        return qualityFactoryMapper.countByShopId(shopId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java
@@ -1,21 +1,34 @@
package com.yeshi.fanli.service.impl.taobao;
import java.io.InputStream;
import java.util.List;
import java.util.UUID;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.yeshi.utils.tencentcloud.COSManager;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoShopMapper;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.db.MongoDBManager;
import com.yeshi.fanli.util.taobao.TaoBaoShopUtil;
import com.yeshi.fanli.vo.brand.TaoBaoShopVO;
@Service
public class TaoBaoShopServiceImpl implements TaoBaoShopService {
    @Resource
    private MongoDBManager mongoDBManager;
    @Resource
    private TaoBaoShopMapper taoBaoShopMapper;
    @Override
    public TaoBaoShopInfo getTaoBaoShopInfo(TaoBaoGoodsBrief goodsInfo) {
@@ -44,7 +57,93 @@
    }
    
    
    @Override
    public TaoBaoShop selectByPrimaryKey(Long id) {
        return taoBaoShopMapper.selectByPrimaryKey(id);
    }
    @Override
    public int insertSelective(TaoBaoShop record) {
        return taoBaoShopMapper.insertSelective(record);
    }
    @Override
    public int updateByPrimaryKeySelective(TaoBaoShop record) {
        return taoBaoShopMapper.updateByPrimaryKeySelective(record);
    }
    
    @Override
    public void changeInfo(MultipartFile file, Long id, String shopName) {
        TaoBaoShop taoBaoShop = taoBaoShopMapper.selectByPrimaryKey(id);
        if (taoBaoShop == null) {
            return;
        }
        String fileLink = null;
        if (file != null) {
            try {
                fileLink = uploadPicture(file);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        TaoBaoShop updateShop = new TaoBaoShop();
        if (!StringUtil.isNullOrEmpty(fileLink)) {
            updateShop.setShopIconCustom(fileLink);
            // 删除图片
            String shopIconCustom = taoBaoShop.getShopIconCustom();
            if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
                COSManager.getInstance().deleteFile(shopIconCustom);
            }
        }
        if (StringUtil.isNullOrEmpty(shopName) || "null".equalsIgnoreCase(shopName)) {
            shopName = null;
        }
        updateShop.setId(id);
        updateShop.setShopNameCustom(shopName);
        taoBaoShopMapper.updateByPrimaryKeySelective(updateShop);
    }
    /**
     * 上传图片
     * @param file
     * @return
     * @throws Exception
     */
    public String uploadPicture(MultipartFile file) throws Exception {
        // 文件解析
        InputStream inputStream = file.getInputStream();
        String contentType = file.getContentType();
        String type = contentType.substring(contentType.indexOf("/") + 1);
        // 文件路径
        String filePath="/img/TaoBaoShop/"+UUID.randomUUID().toString().replace("-", "") + "." + type;
        // 执行上传
        String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
        return fileLink;
    }
    @Override
    public List<TaoBaoShopVO> listBrandShopinfo(long start, int count, Long cid) {
        return taoBaoShopMapper.listBrandShopinfo(start, count, cid);
    }
    @Override
    public long countBrandShopinfo(Long cid) {
        return taoBaoShopMapper.countBrandShopinfo(cid);
    }
    
}
fanli/src/main/java/com/yeshi/fanli/service/inter/activity/ActivityService.java
@@ -159,7 +159,7 @@
     * 
     * @return
     */
    public long getRecommendActivityCount();
    public long getRecommendActivityCount(String title);
    
    public long getRecommendActivityCountCache();
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassService.java
@@ -1,5 +1,7 @@
package com.yeshi.fanli.service.inter.brand;
import java.util.List;
import com.yeshi.fanli.entity.brand.BrandClass;
import com.yeshi.fanli.exception.brand.BrandClassException;
@@ -12,10 +14,52 @@
public interface BrandClassService {
    /**
     * 添加品牌分类
     *
     * @param brandClass
     * @throws BrandClassException
     * 查询有效分类
     * @return
     */
    public void addBrandClass(BrandClass brandClass) throws BrandClassException;
    public List<BrandClass> listEffective();
    /**
     * 查询有效分类
     * @return
     */
    public List<BrandClass> listBrandClassEffectiveCache();
    /**
     * 保存品牌信息
     * @param record
     * @throws BrandClassException
     * @throws Exception
     */
    public void saveObject(BrandClass record) throws BrandClassException, Exception;
    /**
     * 查询列表
     * @param start
     * @param count
     * @param key
     * @param state
     * @return
     */
    public List<BrandClass> listQuery(long start, int count, String key, Integer state);
    public long countQuery(String key, Integer state);
    /**
     * 修改排序
     * @param id
     * @param moveType
     * @throws BrandClassException
     * @throws Exception
     */
    public void updateOrder(Long id, Integer moveType) throws BrandClassException, Exception;
    /**
     * 批量删除
     * @param list
     * @return
     */
    public int deleteBatchByPrimaryKey(List<Long> list);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/BrandClassShopService.java
New file
@@ -0,0 +1,94 @@
package com.yeshi.fanli.service.inter.brand;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
import com.yeshi.fanli.entity.brand.BrandClassShop;
import com.yeshi.fanli.exception.brand.BrandClassShopException;
import net.sf.json.JSONObject;
/**
 * 品牌店铺服务
 *
 * @author Administrator
 *
 */
public interface BrandClassShopService {
    /**
     * 是否存在
     * @param list
     * @return
     */
    public List<BrandClassShop> getExistByShopIds(List<Long> list);
    /**
     * 添加店铺信息
     * @param cid
     * @param list
     * @throws BrandClassShopException
     */
    public String saveShopInfo(Long cid, List<Long> list) throws BrandClassShopException;
    /**
     * 查询列表
     * @param start
     * @param count
     * @param key
     * @param cid
     * @param state
     * @return
     */
    public List<BrandClassShop> listQuery(long start, int count, String key, Long cid, Integer state);
    public long countQuery(String key, Long cid, Integer state);
    /**
     * 更新店铺信息
     * @param file
     * @param id
     * @param cid
     * @param shopName
     * @param state
     * @throws BrandClassShopException
     */
    public void changeShopInfo(MultipartFile file, Long id, Long cid, String shopName, Integer state, Integer top)
            throws BrandClassShopException;
    /**
     * 批量删除
     * @param list
     * @return
     */
    public void deleteBatchByPrimaryKey(List<Long> list);
    /*
     * 排序
     */
    public void updateOrder(Long id, Integer moveType) throws BrandClassShopException, Exception;
    /**
     * 前端查询并缓存
     * @param page
     * @param cid
     * @return
     */
    public JSONObject listEffectiveCache(int page, Long cid);
    /**
     * 点击次数
     * @param shopId
     */
    public void addClick(Long shopId);
    /**
     * 根据分类id进行删除
     * @param list
     */
    public void deleteBatchByClassId(List<Long> list);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/brand/TaoBaoShopHistoryService.java
New file
@@ -0,0 +1,61 @@
package com.yeshi.fanli.service.inter.brand;
import java.util.List;
import com.yeshi.fanli.entity.brand.TaoBaoShopHistory;
/**
 *   店铺足迹
 *
 * @author Administrator
 *
 */
public interface TaoBaoShopHistoryService {
    /**
     * 用户足迹
     * @param start
     * @param count
     * @param uid
     * @return
     */
    public List<TaoBaoShopHistory> listByUid(long start, int count, Long uid);
    public long countByUid(Long uid);
    /**
     * 设备足迹
     * @param start
     * @param count
     * @param device
     * @return
     */
    public List<TaoBaoShopHistory> listByDevice(long start, int count, String device);
    public long countByDevice(String device);
    /**
     * 添加历史记录
     * @param shopId
     * @param uid
     * @param device
     */
    public void addHistory(Long shopId, Long uid, String device);
    /**
     * 删除足迹
     * @param list
     * @param uid
     * @param device
     */
    public void deleteHistory(List<String> list, Long uid, String device);
    /**
     * 统计店铺浏览数量
     * @param shopId
     * @return
     */
    public long countByShopId(Long shopId);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/CommonGoodsService.java
@@ -69,5 +69,19 @@
     * @param listCommonGoods
     */
    public void addBatchCommonGoods(List<CommonGoods> listCommonGoods);
    /**
     *  根据店铺id查询 最新5个
     * @param sellerId
     * @return
     */
    public List<CommonGoods> listBySellerId(Long sellerId);
    /**
     * 统计店铺商品有券数量
     * @param sellerId
     * @return
     */
    public long countBySellerIdAndHasCoupon(Long sellerId);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/TaoBaoClassService.java
@@ -8,18 +8,7 @@
public interface TaoBaoClassService {
    
    public int deleteByPrimaryKey(Long id);
    public int insert(TaoBaoClass record);
    public int insertSelective(TaoBaoClass record);
    public TaoBaoClass selectByPrimaryKey(Long id);
    public int updateByPrimaryKeySelective(TaoBaoClass record);
    public int updateByPrimaryKey(TaoBaoClass record);
    public List<TaoBaoClass> listBySystemCid(long start, int count, Long systemCid);
    /**
@@ -29,4 +18,13 @@
     */
    public String getTaoBaoCatIds(Long classId);
    public TaoBaoClass getByCategoryId(Integer categoryId);
    /**
     * 保存
     * @param classId
     * @param taobaoCids
     */
    public void save(Long classId, String taobaoCids);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/lable/QualityGoodsService.java
@@ -201,4 +201,16 @@
     * @return
     */
    public List<QualityFactory> listFlashSaleRandGoods();
    /**
     * 根据店铺id查询
     * @param start
     * @param count
     * @param shopId
     * @return
     */
    public List<QualityFactory> listByShopId(long start, int count, Long shopId);
    public long countByShopId(Long shopId);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/TaoBaoShopService.java
@@ -1,7 +1,13 @@
package com.yeshi.fanli.service.inter.taobao;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
import com.yeshi.fanli.vo.brand.TaoBaoShopVO;
public interface TaoBaoShopService {
@@ -13,4 +19,37 @@
     */
    public TaoBaoShopInfo getTaoBaoShopInfo(TaoBaoGoodsBrief goodsInfo);
    /**
     * 店铺信息
     * @param id
     * @return
     */
    public TaoBaoShop selectByPrimaryKey(Long id);
    public int insertSelective(TaoBaoShop record);
    public int updateByPrimaryKeySelective(TaoBaoShop record);
    /**
     * 修改店铺信息
     * @param file
     * @param id
     * @param shopName
     */
    public void changeInfo(MultipartFile file, Long id, String shopName);
    /**
     * 查询店铺信息、并返回钱3个商品数量
     * @param start
     * @param count
     * @param cid
     * @return
     */
    public List<TaoBaoShopVO> listBrandShopinfo(long start, int count, Long cid);
    long countBrandShopinfo(Long cid);
}
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoBaoUtil.java
@@ -1805,8 +1805,20 @@
        else
            shop.setUserType(0);
        shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId()));
        return shop;
    }
    /**
     * 根据卖家id获取店铺链接
     * @param sellerId
     * @return
     */
    public static String getShopLink(Long sellerId) {
        return  "http://store.taobao.com/shop/view_shop.htm?user_number_id=" + sellerId;
    }
    public static void main(String[] args) {
        String s = channelMap.get("3");
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -10,6 +10,7 @@
import org.yeshi.utils.taobao.TbImgUtil;
import com.taobao.api.ApiException;
import com.yeshi.fanli.dto.taobao.TaoBaoShopInfoDTO;
import com.yeshi.fanli.entity.taobao.RelateGoods;
import com.yeshi.fanli.entity.taobao.SearchFilter;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
@@ -1236,6 +1237,63 @@
        return list;
    }
    /**
     * 店铺搜索
     *
     * @param key
     *            -店铺名称
     * @param page
     *            -页码
     * @return
     */
    public static TaoBaoShopInfoDTO searchShop(String key, int page, int pageSize) {
        TaoBaoShopInfoDTO dto = new TaoBaoShopInfoDTO();
        if (StringUtil.isNullOrEmpty(key))
            return dto;
        PageEntity pageEntity = new PageEntity();
        List<TaoBaoShopInfo> list = new ArrayList<>();
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.shop.get");
        map.put("fields", "user_id,shop_title,shop_type,seller_nick,pict_url,shop_url");
        map.put("q", key);
        map.put("page_size", pageSize + "");
        map.put("page_no", page + "");
        String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
        JSONObject resultDate = JSONObject.fromObject(resultStr);
        if (resultDate.optJSONObject("tbk_shop_get_response") != null
                && resultDate.optJSONObject("tbk_shop_get_response").optJSONObject("results") != null) {
            JSONArray array = resultDate.optJSONObject("tbk_shop_get_response").optJSONObject("results")
                    .optJSONArray("n_tbk_shop");
            if (array != null) {
                for (int i = 0; i < array.size(); i++) {
                    JSONObject item = array.optJSONObject(i);
                    TaoBaoShopInfo info = new TaoBaoShopInfo();
                    info.setPictureUrl(item.optString("pict_url"));
                    info.setSellerNick(item.optString("seller_nick"));
                    info.setShopTitle(item.optString("shop_title"));
                    info.setShopType(item.optString("shop_type"));
                    info.setShopUrl(item.optString("shop_url"));
                    info.setUserId(item.optLong("user_id"));
                    list.add(info);
                }
            }
            JSONObject optJSONObject = resultDate.optJSONObject("tbk_shop_get_response");
            int totalResults = optJSONObject.getInt("total_results");
            int totalPage = totalResults % pageSize == 0 ? totalResults / pageSize : totalResults / pageSize + 1;
            pageEntity.setTotalCount(totalResults);
            pageEntity.setTotalPage(totalPage);
        }
        pageEntity.setPageIndex(page);
        pageEntity.setPageSize(pageSize);
        dto.setListInfo(list);
        dto.setPage(pageEntity);
        return dto;
    }
    /**
     * TODO 按设备猜你喜欢
     * 
fanli/src/main/java/com/yeshi/fanli/vo/brand/TaoBaoShopVO.java
New file
@@ -0,0 +1,35 @@
package com.yeshi.fanli.vo.brand;
import java.io.Serializable;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
public class TaoBaoShopVO extends TaoBaoShop implements Serializable{
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private List<TaoBaoGoodsBrief> listGoodsBrief;
    @Expose
    private List<TaoBaoGoodsBriefExtra> listGoods;
    public List<TaoBaoGoodsBriefExtra> getListGoods() {
        return listGoods;
    }
    public void setListGoods(List<TaoBaoGoodsBriefExtra> listGoods) {
        this.listGoods = listGoods;
    }
    public List<TaoBaoGoodsBrief> getListGoodsBrief() {
        return listGoodsBrief;
    }
    public void setListGoodsBrief(List<TaoBaoGoodsBrief> listGoodsBrief) {
        this.listGoodsBrief = listGoodsBrief;
    }
}
fanli/src/main/resource/ehcache.xml
@@ -185,4 +185,9 @@
        timeToLiveSeconds="120" overflowToDisk="true"
        memoryStoreEvictionPolicy="LRU" />    
        
        <!--品牌缓存 -->
    <cache name="brandCache" maxElementsInMemory="1000"
        maxElementsOnDisk="10000" eternal="false" timeToIdleSeconds="120"
        timeToLiveSeconds="120" overflowToDisk="true"
        memoryStoreEvictionPolicy="LRU" />
</ehcache>