New file |
| | |
| | | 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();
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | 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.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;
|
| | | }
|
| | | taoBaoShopHistoryService.addHistory(sid, uid, acceptData.getDevice());
|
| | | 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) {
|
| | | 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, PrintWriter out) {
|
| | | try {
|
| | | JSONObject data = new JSONObject();
|
| | | if (page == 1) {
|
| | | TaoBaoShop taoBaoShop = taoBaoShopService.selectByPrimaryKey(sid);
|
| | | if (taoBaoShop == null) {
|
| | | out.print(JsonUtil.loadFalseResult("店铺信息获取失败"));
|
| | | }
|
| | | taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId()));
|
| | | data.put("shop", taoBaoShop);
|
| | | }
|
| | |
|
| | | 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("查询失败"));
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | 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); |
| | | |
| | | } |
New file |
| | |
| | | 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>{ |
| | | |
| | | /** |
| | | * 查询有效 |
| | | * @param start |
| | | * @param count |
| | | * @param cid |
| | | * @return |
| | | */ |
| | | List<BrandClassShop> listEffective(@Param("start") long start, @Param("count") int count, @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); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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 deleteByUid(@Param("shopId") Long shopId, @Param("uid") Long uid); |
| | | |
| | | /** |
| | | * 根据删除 |
| | | * @param sid |
| | | * @param device |
| | | * @return |
| | | */ |
| | | void deleteByDevice(@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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | 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); |
| | | |
| | | } |
New file |
| | |
| | | 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;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | 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;
|
| | |
|
| | | /**
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_brand_class")
|
| | | public class BrandClass {
|
| | | @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;
|
| | | }
|
| | |
| | | this.goodsClass = goodsClass;
|
| | | }
|
| | |
|
| | | public Boolean getShow() {
|
| | | return show;
|
| | | }
|
| | |
|
| | | public void setShow(Boolean show) {
|
| | | this.show = show;
|
| | | }
|
| | |
|
| | | public Integer getOrderBy() {
|
| | | return orderBy;
|
| | | }
|
| | |
| | | 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;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | 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;
|
| | |
|
| | | /**
|
| | |
| | | * @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;
|
| | | }
|
| | |
| | | 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;
|
| | | }
|
| | |
| | | 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;
|
| | | }
|
| | | }
|
New file |
| | |
| | | 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;
|
| | | |
| | | @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;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Column(name = "tsi_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | // 店铺链接
|
| | | private String shopLink;
|
| | | |
| | | |
| | | public TaoBaoShop() {}
|
| | | |
| | | public TaoBaoShop(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | | |
| | | |
| | | public Integer getUserType() {
|
| | | return userType;
|
| | | }
|
| | |
| | | this.goodRatePercentage = goodRatePercentage;
|
| | | }
|
| | |
|
| | | public String getShopLink() {
|
| | | return shopLink;
|
| | | }
|
| | |
|
| | | public void setShopLink(String shopLink) {
|
| | | this.shopLink = shopLink;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | <?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> |
| | | |
| | | <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 |
| | | LIMIT ${start},${count} |
| | | </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> |
New file |
| | |
| | | <?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_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_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_create_time,tsh_update_time) values (#{id,jdbcType=BIGINT},#{taoBaoShop.id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{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="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="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_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="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> |
| | | |
| | | <delete id="deleteByUid"> |
| | | delete from yeshi_ec_taobao_shop_history |
| | | where tsh_uid = #{uid} AND tsh_shop_id = #{shopId} |
| | | </delete> |
| | | |
| | | <delete id="deleteByDevice"> |
| | | delete from yeshi_ec_taobao_shop_history |
| | | where tsh_device = #{device} AND tsh_shop_id = #{shopId} |
| | | </delete> |
| | | |
| | | |
| | | <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} |
| | | 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} |
| | | </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} |
| | | 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} |
| | | </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> |
| | |
| | | </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> |
| | |
| | | <![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> |
New file |
| | |
| | | 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.goods.GoodsClassService;
|
| | |
|
| | | @Service
|
| | | public class BrandClassServiceImpl implements BrandClassService {
|
| | | |
| | | @Resource
|
| | | private BrandClassMapper brandClassMapper;
|
| | | |
| | | @Resource
|
| | | private GoodsClassService goodsClassService;
|
| | |
|
| | | @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) {
|
| | | 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);
|
| | | }
|
| | | |
| | | |
| | | |
| | | }
|
New file |
| | |
| | | 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.apache.commons.beanutils.PropertyUtils;
|
| | | 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> listEffective(long start, int count, Long cid) {
|
| | | return brandClassShopMapper.listEffective(start, count, cid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public long countEffective(Long cid) {
|
| | | return brandClassShopMapper.countEffective(cid);
|
| | | }
|
| | |
|
| | | @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);
|
| | | |
| | | shop.setShopLink(TaoBaoUtil.getShopLink(shop.getId()));
|
| | | |
| | | 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 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 count = 0;
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | List<BrandClassShop> list = brandClassShopMapper.listEffective((page - 1) * pageSize, pageSize, cid);
|
| | | if (list == null) {
|
| | | list = new ArrayList<BrandClassShop>();
|
| | | } else if (list.size() > 0) {
|
| | | count = brandClassShopMapper.countEffective(cid);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | if (page == 1 && cid != null && cid > 0 && count > pageSize) {
|
| | | List<TaoBaoShop> listShop = new ArrayList<TaoBaoShop>();
|
| | | List<BrandClassShop> listBrand = brandClassShopMapper.listEffective(0, Integer.MAX_VALUE, cid);
|
| | | for (BrandClassShop brandClassShop : listBrand) {
|
| | | TaoBaoShop shop = brandClassShop.getShop();
|
| | | if (shop != null) {
|
| | | String shopIconCustom = shop.getShopIconCustom();
|
| | | if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
|
| | | shop.setShopIcon(shopIconCustom);
|
| | | }
|
| | | listShop.add(shop);
|
| | | }
|
| | | }
|
| | | data.put("listShop", JsonUtil.getApiCommonGson().toJson(listShop));
|
| | | } else if (page == 1 && cid != null && cid > 0) {
|
| | | List<TaoBaoShop> listShop = new ArrayList<TaoBaoShop>();
|
| | | for (BrandClassShop brandClassShop : list) {
|
| | | TaoBaoShop shop = brandClassShop.getShop();
|
| | | if (shop != null) {
|
| | | String shopIconCustom = shop.getShopIconCustom();
|
| | | if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
|
| | | shop.setShopIcon(shopIconCustom);
|
| | | }
|
| | | listShop.add(shop);
|
| | | }
|
| | | }
|
| | | data.put("listShop", JsonUtil.getApiCommonGson().toJson(listShop));
|
| | | }
|
| | |
|
| | | List<TaoBaoShopVO> listVO = new ArrayList<TaoBaoShopVO>();
|
| | | for (BrandClassShop brandClassShop : list) {
|
| | | TaoBaoShop shop = brandClassShop.getShop();
|
| | | if (shop == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | String shopIconCustom = shop.getShopIconCustom();
|
| | | if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
|
| | | shop.setShopIcon(shopIconCustom);
|
| | | }
|
| | |
|
| | | |
| | | List<Long> listgid = new ArrayList<Long>();
|
| | | listgid.add(543572782962L);
|
| | | listgid.add(578504974101L);
|
| | | listgid.add(530275132249L);
|
| | | |
| | | BigDecimal proportion = manageService.getFanLiRate();
|
| | | List<TaoBaoGoodsBriefExtra> listGoods = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | List<TaoBaoGoodsBrief> listgd = taoBaoGoodsBriefService.listQueryByAuctionId(listgid);
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : listgd) {
|
| | | listGoods.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null));
|
| | | }
|
| | | |
| | | |
| | | // List<QualityFactory> listFactory = qualityGoodsService.listByShopId(0, 3, shop.getId());
|
| | | // if (listFactory == null || listFactory.size() < 3) {
|
| | | // count --;
|
| | | // continue;
|
| | | // }
|
| | | // |
| | | // List<TaoBaoGoodsBriefExtra> listGoods = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | // BigDecimal proportion = manageService.getFanLiRate();
|
| | | // for (QualityFactory selectionGoods : listFactory) {
|
| | | // TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | // if (taoBaoGoodsBrief == null) {
|
| | | // break;
|
| | | // }
|
| | | // listGoods.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null));
|
| | | // }
|
| | | // |
| | | // if (listGoods == null || listGoods.size() < 3) {
|
| | | // count --;
|
| | | // continue;
|
| | | // }
|
| | | // |
| | | |
| | | TaoBaoShopVO vo = new TaoBaoShopVO();
|
| | | try {
|
| | | PropertyUtils.copyProperties(vo, shop);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | vo.setListGoods(listGoods);
|
| | | listVO.add(vo);
|
| | | }
|
| | | data.put("count", count);
|
| | | data.put("list", JsonUtil.getApiCommonGson().toJson(listVO));
|
| | | |
| | | 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);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | }
|
New file |
| | |
| | | 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.deleteByDevice(Long.parseLong(shopId), device);
|
| | | }
|
| | | } else {
|
| | | for (String shopId:list) {
|
| | | taoBaoShopHistoryMapper.deleteByUid(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.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);
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<CommonGoods> listBySellerId(Long sellerId) {
|
| | | return commonGoodsMapper.listBySellerId(sellerId);
|
| | | } |
| | | |
| | | |
| | | @Override
|
| | | public long countBySellerIdAndHasCoupon(Long sellerId) {
|
| | | return commonGoodsMapper.countBySellerIdAndHasCoupon(sellerId);
|
| | | }
|
| | | }
|
| | |
| | | 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);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.taobao;
|
| | |
|
| | | import java.io.InputStream;
|
| | | 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;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private MongoDBManager mongoDBManager;
|
| | | |
| | | @Resource
|
| | | private TaoBaoShopMapper taoBaoShopMapper;
|
| | |
|
| | | @Override
|
| | | public TaoBaoShopInfo getTaoBaoShopInfo(TaoBaoGoodsBrief goodsInfo) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | @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);
|
| | | }
|
| | | }
|
| | | |
| | | updateShop.setId(id);
|
| | | updateShop.setShopName(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;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | }
|
| | |
| | | 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;
|
| | |
|
| | |
| | | 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);
|
| | |
|
| | | |
| | | }
|
New file |
| | |
| | | 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 {
|
| | |
|
| | | /**
|
| | | * 查询有效分类
|
| | | * |
| | | * @return
|
| | | */
|
| | | public List<BrandClassShop> listEffective(long start, int count, Long cid);
|
| | |
|
| | | public long countEffective(Long cid);
|
| | |
|
| | | /**
|
| | | * 是否存在
|
| | | * @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);
|
| | | |
| | | }
|
New file |
| | |
| | | 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);
|
| | | |
| | | |
| | | }
|
| | |
| | | * @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);
|
| | |
|
| | | }
|
| | |
| | | * @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);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.taobao;
|
| | |
|
| | | 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;
|
| | |
|
| | | public interface TaoBaoShopService {
|
| | |
| | | */
|
| | | 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);
|
| | | |
| | | }
|
| | |
| | |
|
| | | 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");
|
| | |
| | | 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;
|
| | |
| | | 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 按设备猜你喜欢
|
| | | *
|
New file |
| | |
| | | package com.yeshi.fanli.vo.brand;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShop;
|
| | |
|
| | | public class TaoBaoShopVO extends TaoBaoShop{
|
| | | |
| | | @Expose
|
| | | private String shopLink;
|
| | | @Expose
|
| | | private List<TaoBaoGoodsBriefExtra> listGoods;
|
| | | |
| | | public String getShopLink() {
|
| | | return shopLink;
|
| | | }
|
| | | public void setShopLink(String shopLink) {
|
| | | this.shopLink = shopLink;
|
| | | }
|
| | | public List<TaoBaoGoodsBriefExtra> getListGoods() {
|
| | | return listGoods;
|
| | | }
|
| | | public void setListGoods(List<TaoBaoGoodsBriefExtra> listGoods) {
|
| | | this.listGoods = listGoods;
|
| | | }
|
| | | }
|
| | |
| | | timeToLiveSeconds="120" overflowToDisk="true"
|
| | | memoryStoreEvictionPolicy="LRU" />
|
| | |
|
| | | <!--品牌缓存 -->
|
| | | <cache name="brandCache" maxElementsInMemory="1000"
|
| | | maxElementsOnDisk="10000" eternal="false" timeToIdleSeconds="120"
|
| | | timeToLiveSeconds="120" overflowToDisk="true"
|
| | | memoryStoreEvictionPolicy="LRU" /> |
| | | </ehcache>
|