| | |
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap;
|
| | | import com.yeshi.fanli.entity.bus.clazz.TaoBaoClass;
|
| | | import com.yeshi.fanli.exception.FloatADException;
|
| | | import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | |
| | | @Resource
|
| | | private TaoBaoClassService taoBaoClassService;
|
| | |
|
| | | @Resource
|
| | | private GoodsSubClassLabelService goodsSubClassLabelService;
|
| | |
|
| | | /**
|
| | | * 保存信息
|
| | | *
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, GoodsSubClass goodsSubClass, Long pid, Integer type, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | | public void save(String callback, GoodsSubClass goodsSubClass, Long pid, Integer type, Long labelId,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | if (goodsSubClass.getTaobaoCids() != null)
|
| | | goodsSubClass.setTaobaoCids(goodsSubClass.getTaobaoCids().replace(",", ","));
|
| | |
|
| | | GoodsSubClassLabelMap map = null;
|
| | | if (labelId != null) {
|
| | | map = new GoodsSubClassLabelMap();
|
| | | map.setLabel(new GoodsSubClassLabel(labelId));
|
| | | map.setOrderBy(0);
|
| | | }
|
| | |
|
| | | try {
|
| | | // 1. 先判断httpRequest 是否含有文件类型
|
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | | goodsSubClassService.saveObject(fileRequest.getFile("file"), fileRequest.getFile("file2"),
|
| | | goodsSubClass, type, pid);
|
| | | goodsSubClass, type, pid,map);
|
| | | } else {
|
| | | goodsSubClassService.saveObject(null, null, goodsSubClass, type, pid);
|
| | | goodsSubClassService.saveObject(null, null, goodsSubClass, type, pid,map);
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | |
| | | }
|
| | | goodsSubClass.setTaobaoCids(taobaoCids);
|
| | | }
|
| | |
|
| | | // 查询分类标签
|
| | | GoodsSubClassLabelMap map = goodsSubClassLabelService.selectBySubClassId(goodsSubClass.getId());
|
| | | if (map != null)
|
| | | goodsSubClass.setClassLabel(map.getLabel());
|
| | | }
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | 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.entity.bus.clazz.GoodsSubClassLabel;
|
| | | import com.yeshi.fanli.exception.GoodsClassException;
|
| | | import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/goodsSubClassLabel")
|
| | | public class GoodsSubClassLabelAdminController {
|
| | |
|
| | | @Resource
|
| | | private GoodsSubClassLabelService goodsSubClassLabelService;
|
| | |
|
| | | /**
|
| | | * 标签列表
|
| | | * @param callback
|
| | | * @param classId
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "labelList")
|
| | | public void labelList(String callback, Long classId, int pageIndex, int pageSize, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (classId != null && classId == 0)
|
| | | classId = null;
|
| | | List<GoodsSubClassLabel> list = goodsSubClassLabelService.listLabelByClassId(classId);
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls(); // 重点
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("resultList", gson.toJson(list));
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, list.size(), 1);
|
| | | data.put("pe", pe);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 保存信息
|
| | | * |
| | | * @param callback
|
| | | * @param special
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveLabel")
|
| | | public void save(String callback, GoodsSubClassLabel label, HttpServletRequest request, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(label.getName()) || label.getGoodsClass() == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("数据不完整"));
|
| | | return;
|
| | | }
|
| | | if (label.getId() == null)// 新增
|
| | | {
|
| | | if (label.getGoodsClass().getId() == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("分类不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | label.setCreateTime(new Date());
|
| | | try {
|
| | | goodsSubClassLabelService.addSubClassLabel(label);
|
| | | } catch (GoodsClassException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage()));
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("添加成功"));
|
| | | } else {// 修改
|
| | | goodsSubClassLabelService.updateSubClassLabel(label);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 批量删除
|
| | | * |
| | | * @param callback
|
| | | * @param ids
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "deleteLabelBatch")
|
| | | public void deleteBatch(String callback, String ids, PrintWriter out) {
|
| | | Gson gson = new Gson();
|
| | | try {
|
| | | List<String> recordIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {
|
| | | }.getType());
|
| | |
|
| | | if (recordIds == null || recordIds.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择需删除数据")));
|
| | | } else {
|
| | |
|
| | | for (String id : recordIds)
|
| | | goodsSubClassLabelService.deleteLabel(Long.parseLong(id));
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("删除成功")));
|
| | | }
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.quality.QualityFactoryVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | |
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | | |
| | |
|
| | | public static final int SALES_ASC = 1;
|
| | | public static final int SALES_DESC = 2;
|
| | |
| | |
|
| | | public static final int TKRATE_ASC = 5;
|
| | | public static final int TKRATE_DESC = 6;
|
| | | |
| | | |
| | |
|
| | | public static final int PROPOR_ASC = 7;
|
| | | public static final int PROPOR_DESC = 8;
|
| | |
|
| | | @RequestMapping(value = "addBatch")
|
| | | public void addBatch(String callback, String auctionIds, String lableNames, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | | // 获取当前操作用户
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | if (admin == null) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆")));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(auctionIds)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选者正确的商品入库")));
|
| | | return;
|
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> auctionIdList = gson.fromJson(auctionIds, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | if (auctionIdList == null || auctionIdList.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择正确的商品入库")));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<TaoBaoGoodsBrief> listTaoBaoGoods = new ArrayList<>();
|
| | |
|
| | | JSONArray array = JSONArray.fromObject(auctionIds);
|
| | |
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | listTaoBaoGoods.add(TaoKeApiUtil.searchGoodsDetail(array.optLong(i)));
|
| | | }
|
| | | qualityFactoryService.addBatchTaoBaoGoods(listTaoBaoGoods, lableNames, admin);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("添加成功")));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 保存修改精品库商品关联信息
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveModify")
|
| | | public void saveModify(String callback, QualityFactory selectionGoods, HttpServletRequest request, PrintWriter out) {
|
| | | public void saveModify(String callback, QualityFactory selectionGoods, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | |
| | | try {
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<String> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {}.getType());
|
| | | List<String> goodsIds = gson.fromJson(ids, new TypeToken<ArrayList<String>>() {
|
| | | }.getType());
|
| | |
|
| | | if (goodsIds == null || goodsIds.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未检测到移除商品数据")));
|
| | |
| | |
|
| | | /**
|
| | | * 查询
|
| | | * |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex,Integer pageSize, Integer sort, |
| | | public void query(String callback, Integer pageIndex, Integer pageSize, Integer sort,
|
| | | QualityFactoryVO qualityFactoryVO, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
| | | case PROPOR_ASC:
|
| | | propor = 1;
|
| | | break;
|
| | | case PROPOR_DESC: |
| | | case PROPOR_DESC:
|
| | | propor = 2;
|
| | | break;
|
| | | default:
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | qualityFactoryVO.setPrice(price);
|
| | | qualityFactoryVO.setTkRate(tkRate);
|
| | | qualityFactoryVO.setTotalSales(totalSales);
|
| | | qualityFactoryVO.setPropor(propor);
|
| | | qualityFactoryVO.setStart((pageIndex - 1) * pageSize); |
| | | qualityFactoryVO.setStart((pageIndex - 1) * pageSize);
|
| | | qualityFactoryVO.setCount(pageSize);
|
| | |
|
| | | List<QualityFactory> selectionList = qualityFactoryService.query(qualityFactoryVO);
|
| | |
| | |
|
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | /* 验证网络: 获取商品链接 图片链接 */
|
| | | /* 验证网络: 获取商品链接 图片链接 */
|
| | | List<TaoBaoGoodsBrief> goodsBriefList = new ArrayList<TaoBaoGoodsBrief>();
|
| | | |
| | |
|
| | | StringBuffer idBuf = new StringBuffer();
|
| | | StringBuffer auctionIdBuf = new StringBuffer();
|
| | | |
| | |
|
| | | int j = 0;
|
| | | for (int i = 0; i < selectionList.size(); i++ ) {
|
| | | for (int i = 0; i < selectionList.size(); i++) {
|
| | | QualityFactory selectionGoods = selectionList.get(i);
|
| | | |
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | if (taoBaoGoodsBrief == null)
|
| | | continue; // 为空结束本次循环
|
| | | |
| | | |
| | |
|
| | | Long id = taoBaoGoodsBrief.getId();
|
| | | idBuf.append(id + ",");
|
| | | |
| | |
|
| | | Long auctionId = taoBaoGoodsBrief.getAuctionId();
|
| | | if (auctionId != null) {
|
| | | j++;
|
| | | auctionIdBuf.append(auctionId + ",");
|
| | | }
|
| | | |
| | |
|
| | | if (selectionList.size() <= 40) {
|
| | | // 小于40个参数
|
| | | if (i == selectionList.size()-1 ){
|
| | | if (i == selectionList.size() - 1) {
|
| | | if (auctionIdBuf != null && auctionIdBuf.length() > 0) {
|
| | | String auctionIds = auctionIdBuf.toString();
|
| | | String ids = auctionIds.substring(0, auctionIds.length() -1);
|
| | | String ids = auctionIds.substring(0, auctionIds.length() - 1);
|
| | | List<TaoBaoGoodsBrief> list = null;
|
| | | try {
|
| | | list = TaoKeApiUtil.getBatchGoodsInfos(ids);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | | goodsBriefList.addAll(list);
|
| | | }
|
| | | |
| | |
|
| | | auctionIdBuf = new StringBuffer();
|
| | | }
|
| | | }
|
| | |
| | | if (j == 40) {
|
| | | // 大于40参数
|
| | | String auctionIds = auctionIdBuf.toString();
|
| | | String ids = auctionIds.substring(0, auctionIds.length() -1);
|
| | | String ids = auctionIds.substring(0, auctionIds.length() - 1);
|
| | | List<TaoBaoGoodsBrief> list = null;
|
| | | try {
|
| | | list = TaoKeApiUtil.getBatchGoodsInfos(ids);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | | goodsBriefList.addAll(list);
|
| | | }
|
| | | |
| | | j= 0;
|
| | |
|
| | | j = 0;
|
| | | auctionIdBuf = new StringBuffer();
|
| | | |
| | | } else if (i == selectionList.size()-1 ){
|
| | |
|
| | | } else if (i == selectionList.size() - 1) {
|
| | | // 最后一个
|
| | | String auctionIds = auctionIdBuf.toString();
|
| | | String ids = auctionIds.substring(0, auctionIds.length() -1);
|
| | | String ids = auctionIds.substring(0, auctionIds.length() - 1);
|
| | | List<TaoBaoGoodsBrief> list = null;
|
| | | try {
|
| | | list = TaoKeApiUtil.getBatchGoodsInfos(ids);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | if (list != null && list.size() > 0) {
|
| | | goodsBriefList.addAll(list);
|
| | | }
|
| | | auctionIdBuf = new StringBuffer();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | |
| | | |
| | |
|
| | | for (QualityFactory selectionGoods : selectionList) {
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | if (taoBaoGoodsBrief == null)
|
| | | continue; // 为空结束本次循环
|
| | |
|
| | | |
| | | String auctionUrl = taoBaoGoodsBrief.getAuctionUrl();
|
| | | if (auctionUrl != null && auctionUrl.trim().length() > 0 && auctionUrl.contains("id=null")) {
|
| | | auctionUrl =auctionUrl.replace("id=null","id="+ taoBaoGoodsBrief.getAuctionId());
|
| | | auctionUrl = auctionUrl.replace("id=null", "id=" + taoBaoGoodsBrief.getAuctionId());
|
| | | taoBaoGoodsBrief.setAuctionUrl(auctionUrl);
|
| | | }
|
| | | |
| | |
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | | |
| | |
|
| | | BoutiqueAutoRule boutiqueAutoRule = selectionGoods.getBoutiqueAutoRule();
|
| | | if (boutiqueAutoRule == null) {
|
| | | boutiqueAutoRule = new BoutiqueAutoRule();
|
| | | selectionGoods.setBoutiqueAutoRule(boutiqueAutoRule);
|
| | | }
|
| | | |
| | |
|
| | | String reslutSource = "";
|
| | | Integer gsSource = selectionGoods.getGoodsSource();
|
| | | if (QualityFactory.SOURCE_TAOBAO == gsSource ) {
|
| | | if (QualityFactory.SOURCE_TAOBAO == gsSource) {
|
| | | reslutSource = "淘宝";
|
| | | } else if (QualityFactory.SOURCE_TAOBAO_MATERIAL == gsSource) {
|
| | | reslutSource = "淘宝推荐";
|
| | |
| | | } else if (QualityFactory.SOURCE_OTHER == gsSource) {
|
| | | reslutSource = "商务合作";
|
| | | }
|
| | | |
| | |
|
| | | map.put("goodsSource", reslutSource);
|
| | | |
| | | |
| | |
|
| | | map.put("selectionGoods", selectionGoods);
|
| | |
|
| | | /* 商品销售状态: 0 在售 1停售 */
|
| | |
| | | Long auctionId = taoBaoGoodsBrief.getAuctionId();
|
| | | if (auctionId != null) {
|
| | | if (goodsBriefList != null && goodsBriefList.size() > 0) {
|
| | | for (TaoBaoGoodsBrief tb :goodsBriefList) {
|
| | | for (TaoBaoGoodsBrief tb : goodsBriefList) {
|
| | | Long auctionIdTB = tb.getAuctionId();
|
| | | if (auctionId.equals(auctionIdTB)) {
|
| | | saleStae = 0;
|
| | | }
|
| | | }
|
| | | } |
| | | }
|
| | | }
|
| | | |
| | |
|
| | | map.put("saleStae", saleStae);
|
| | | |
| | |
|
| | | /* 1 定向计划 2 营销返利 、高佣 3 普佣 */
|
| | | Integer includeDxjh = taoBaoGoodsBrief.getIncludeDxjh();
|
| | |
| | | map.put("yongjinType", 3);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | /* 券后价--计算 */
|
| | |
|
| | | /* 券后价--计算 */
|
| | | BigDecimal couponPrice = TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief);
|
| | | map.put("couponPrice", couponPrice);
|
| | |
|
| | |
| | | BigDecimal estimateProfit = MoneyBigDecimalUtil.div(profit, new BigDecimal("100"));
|
| | | // 预计收益
|
| | | map.put("estimateProfit", estimateProfit);
|
| | | |
| | | |
| | |
|
| | | BigDecimal couponAmount = taoBaoGoodsBrief.getCouponAmount();
|
| | | if (couponAmount != null && zkPrice != null) {
|
| | | BigDecimal propors = couponAmount.divide(zkPrice ,10 ,BigDecimal.ROUND_HALF_DOWN);
|
| | | BigDecimal propors = couponAmount.divide(zkPrice, 10, BigDecimal.ROUND_HALF_DOWN);
|
| | | BigDecimal resultPropor = MoneyBigDecimalUtil.mul(propors, new BigDecimal("100"));
|
| | | map.put("propor", resultPropor);
|
| | | } else {
|
| | | map.put("propor", 0);
|
| | | }
|
| | | |
| | |
|
| | | /* 商品标签列表 */
|
| | | Long id = taoBaoGoodsBrief.getId();
|
| | | int totalLabels = labelGoodsService.getCountQueryByGoodsId(id);
|
| | | |
| | | //List<LabelGoods> labelList = labelService.getByGoodsId(id);
|
| | | |
| | |
|
| | | // List<LabelGoods> labelList = labelService.getByGoodsId(id);
|
| | |
|
| | | map.put("totalLabels", totalLabels);
|
| | |
|
| | | listmap.add(map);
|
| | |
| | | * 获取商品信息 以及对应标签列表;此商品标签候选项
|
| | | *
|
| | | * @param callback
|
| | | * @param id 精选id
|
| | | * @param id
|
| | | * 精选id
|
| | | * @param request
|
| | | * @param out
|
| | | */
|
| | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("该商品已不在")));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | // 商品图片
|
| | | List<String> imgList = TaoBaoUtil.getTbImg(taobao.getAuctionId() + "");
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 单个商品贴上标签
|
| | | *
|
| | |
| | | try {
|
| | | // 获取当前操作用户
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | // if (admin == null) {
|
| | | // out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")));
|
| | | // return;
|
| | | // }
|
| | | // if (admin == null) {
|
| | | // out.print(JsonUtil.loadJSONP(callback,
|
| | | // JsonUtil.loadFalseResult("当前账户失效,请重新登陆。")));
|
| | | // return;
|
| | | // }
|
| | |
|
| | | if (id == null || labId == null) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确的参数")));
|
| | |
| | |
|
| | | try {
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | //
|
| | | // if (admin == null) {
|
| | | // out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("当前账户已失效,请重新登陆")));
|
| | | // return;
|
| | | // } |
| | | //
|
| | | // if (admin == null) {
|
| | | // out.print(JsonUtil.loadJSONP(callback,
|
| | | // JsonUtil.loadFalseResult("当前账户已失效,请重新登陆")));
|
| | | // return;
|
| | | // }
|
| | |
|
| | | Long id = selectionGoods.getId();
|
| | | QualityFactory resultObj = qualityFactoryService.selectByPrimaryKey(id);
|
| | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("修改失败")));
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | } catch (QualityFactoryException e) {
|
| | | e.printStackTrace();
|
| | |
| | | }
|
| | |
|
| | | @RequestMapping(value = "queryMyLabels")
|
| | | public void queryMyLabels(String callback, Integer pageIndex, Integer pageSize, |
| | | String ids, HttpServletRequest request, PrintWriter out) {
|
| | | public void queryMyLabels(String callback, Integer pageIndex, Integer pageSize, String ids,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | |
| | |
|
| | | if (StringUtil.isNullOrEmpty(ids)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:101")));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | if (idList == null || idList.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:102")));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (idList.size() > 1) {
|
| | | // 只处理单个商品
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:103")));
|
| | | return;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | Long id = idList.get(0);
|
| | | |
| | |
|
| | | if (id == null) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:104")));
|
| | | return;
|
| | |
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | // 商品标签列表
|
| | | List<LabelGoods> labelList = labelGoodsService.queryByGoodsId((pageIndex - 1) * pageSize, |
| | | pageSize, id);
|
| | | List<LabelGoods> labelList = labelGoodsService.queryByGoodsId((pageIndex - 1) * pageSize, pageSize, id);
|
| | |
|
| | | if (labelList == null || labelList.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无标签"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | int count = labelGoodsService.getCountQueryByGoodsId(id);
|
| | |
|
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls(); |
| | | gsonBuilder.serializeNulls();
|
| | | Gson rgson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryLabel")
|
| | | public void queryLabel(String callback, Integer pageIndex, Integer pageSize, String key, |
| | | String ids, HttpServletRequest request, PrintWriter out) {
|
| | | public void queryLabel(String callback, Integer pageIndex, Integer pageSize, String key, String ids,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:101")));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | | if (idList == null || idList.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请传递正确参数:102")));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | int count = 0;
|
| | | List<Label> labelList = null;
|
| | | |
| | |
|
| | | if (pageIndex == null)
|
| | | pageIndex = 1;
|
| | |
|
| | | if (pageSize == null)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | |
| | |
|
| | | if (idList.size() > 1) {
|
| | | // 多个商品 查询所有标签
|
| | | labelList = labelService.query((pageIndex - 1) * pageSize, pageSize, key, null, null,null);
|
| | | |
| | | count = labelService.getQueryCount(key, null, null);
|
| | | |
| | | labelList = labelService.query((pageIndex - 1) * pageSize, pageSize, key, null, null, null);
|
| | |
|
| | | count = labelService.getQueryCount(key, null, null);
|
| | |
|
| | | } else {
|
| | | // 单个商品
|
| | | Long id = idList.get(0);
|
| | |
| | |
|
| | | count = labelService.getCountQueryGoodsCandidate(key, id);
|
| | | }
|
| | | |
| | |
|
| | | if (labelList == null || labelList.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无标签"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "addBatchcGoodsLabel")
|
| | | public void addBatchcGoodsLabel(String callback, String labIds, Long id, HttpServletRequest request, PrintWriter out) {
|
| | | public void addBatchcGoodsLabel(String callback, String labIds, Long id, HttpServletRequest request,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(labIds)) {
|
| | |
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = taoBaoGoodsBriefService.selectByPrimaryKey(id);
|
| | | |
| | |
|
| | | // 获取当前操作用户
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | labelGoodsService.addBatchByLabId(taoBaoGoodsBrief, labIdList, admin);
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | @RequestMapping(value="updateGoodsBrief")
|
| | | public void updateGoodsBrief(String callback, TaoBaoGoodsBrief tb, PrintWriter out){
|
| | |
|
| | | @RequestMapping(value = "updateGoodsBrief")
|
| | | public void updateGoodsBrief(String callback, TaoBaoGoodsBrief tb, PrintWriter out) {
|
| | | try {
|
| | | |
| | |
|
| | | // 实际未精选ID
|
| | | Long id = tb.getId();
|
| | | |
| | |
|
| | | QualityFactory resultObj = qualityFactoryService.selectByPrimaryKey(id);
|
| | |
|
| | | if (resultObj == null) {
|
| | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("该商品已不在")));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | String title = tb.getTitle();
|
| | | String pictUrl = tb.getPictUrl();
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(title)) |
| | |
|
| | | if (!StringUtil.isNullOrEmpty(title))
|
| | | taobao.setTitle(title);
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(pictUrl)) |
| | |
|
| | | if (!StringUtil.isNullOrEmpty(pictUrl))
|
| | | taobao.setPictUrl(pictUrl);
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite())) |
| | |
|
| | | if (!StringUtil.isNullOrEmpty(tb.getPictUrlWhite()))
|
| | | taobao.setPictUrlWhite(tb.getPictUrlWhite());
|
| | | |
| | |
|
| | | // 更新商品
|
| | | taoBaoGoodsUpdateService.getUpdateTaoBaoGoodsBrief(taobao);
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("修改成功")));
|
| | | |
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("修改失败")));
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 批量添加标签 --- 精品库(随机权重)
|
| | | * |
| | | * @param callback
|
| | | * @param request
|
| | | * @param out @param 权重范围 大值
|
| | | * @param 佣金范围 小值
|
| | | * @param out
|
| | | * @param 权重范围
|
| | | * 大值
|
| | | * @param 佣金范围
|
| | | * 小值
|
| | | */
|
| | | @RequestMapping(value = "setWeightBatch")
|
| | | public void setWeightBatch(String callback,String ids, Integer weight,Integer weightSmall, |
| | | Integer weightLarge, HttpServletRequest request, PrintWriter out) {
|
| | | public void setWeightBatch(String callback, String ids, Integer weight, Integer weightSmall, Integer weightLarge,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | try { |
| | | |
| | | if (StringUtil.isNullOrEmpty(ids)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未选择需操作的商品")));
|
| | | return;
|
| | | } |
| | | |
| | | Gson gson = new Gson();
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | | |
| | | if (idList == null || idList.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择需操作的商品")));
|
| | | return;
|
| | | } |
| | | // 获取当前操作用户
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | | |
| | | qualityFactoryService.setWeightBatch(idList, admin, weight, weightSmall, weightLarge);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("设置成功")));
|
| | | |
| | | } catch ( Exception e) {
|
| | | try {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(ids)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未选择需操作的商品")));
|
| | | return;
|
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> idList = gson.fromJson(ids, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | if (idList == null || idList.size() == 0) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("请选择需操作的商品")));
|
| | | return;
|
| | | }
|
| | | // 获取当前操作用户
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | |
|
| | | qualityFactoryService.setWeightBatch(idList, admin, weight, weightSmall, weightLarge);
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult("设置成功")));
|
| | |
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | | |
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaobaoMeterial;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaobaoMeterialService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
| | | @Resource
|
| | | private TaoBaoClassService taoBaoClassService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | /**
|
| | | *
|
| | | * @param callback
|
| | |
| | | // 查询物料
|
| | | TaoBaoSearchResult result = getGoodsByWuLiao(pageIndex, pageSize, key, tbClassId, startPrice, endPrice,
|
| | | startTkRate, endTkRate, sort, istmall, hasCoupon, baoYou, startDsr, overseas, needPrepay,
|
| | | includePayRate30, includeGoodRate, includeRfdRate, npxLevel,cid);
|
| | | includePayRate30, includeGoodRate, includeRfdRate, npxLevel, cid);
|
| | |
|
| | | if (result == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到淘宝商品信息"));
|
| | |
| | | // 查询物料
|
| | | TaoBaoSearchResult result = getGoodsByWuLiao(pageIndex, pageSize, key, tbClassId, startPrice, endPrice,
|
| | | startTkRate, endTkRate, sort, istmall, hasCoupon, baoYou, startDsr, overseas, needPrepay,
|
| | | includePayRate30, includeGoodRate, includeRfdRate, npxLevel,null);
|
| | | includePayRate30, includeGoodRate, includeRfdRate, npxLevel, null);
|
| | |
|
| | | if (result == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到淘宝商品信息"));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private List<Map<String, Object>> filterTaoBaoGoodsWithQulity(List<TaoBaoGoodsBrief> goodsList) {
|
| | |
|
| | | // 插入商品集合
|
| | | List<Long> listAuctionId = new ArrayList<Long>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : goodsList) {
|
| | | listAuctionId.add(goodsBrief.getAuctionId());
|
| | | }
|
| | |
|
| | | // 验证是否存在数据库
|
| | | List<QualityFactory> listHas = qualityFactoryService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsList) {
|
| | | taoBaoGoodsBrief.setId(null);
|
| | |
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
|
| | | map.put("pictUrl", taoBaoGoodsBrief.getPictUrl());
|
| | | map.put("title", taoBaoGoodsBrief.getTitle());
|
| | | map.put("auctionId", taoBaoGoodsBrief.getAuctionId());
|
| | | map.put("auctionUrl", taoBaoGoodsBrief.getAuctionUrl());
|
| | | map.put("zkPrice", taoBaoGoodsBrief.getZkPrice());
|
| | | map.put("biz30day", taoBaoGoodsBrief.getBiz30day());
|
| | | map.put("couponInfo", taoBaoGoodsBrief.getCouponInfo());
|
| | | map.put("couponTotalCount", taoBaoGoodsBrief.getCouponTotalCount());
|
| | | map.put("couponLeftCount", taoBaoGoodsBrief.getCouponLeftCount());
|
| | | map.put("couponEffectiveEndTime", taoBaoGoodsBrief.getCouponEffectiveEndTime());
|
| | | map.put("tkRate", taoBaoGoodsBrief.getTkRate());
|
| | |
|
| | | // 来源 0 无 1淘宝 2 京东
|
| | | map.put("goodsSource", 1);
|
| | |
|
| | | /* 券后价--计算 */
|
| | | BigDecimal couponPrice = TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief);
|
| | | map.put("couponPrice", couponPrice);
|
| | |
|
| | | /* 预计收益: 公司、用户 */
|
| | | BigDecimal tkRate = taoBaoGoodsBrief.getTkRate();
|
| | | BigDecimal zkPrice = taoBaoGoodsBrief.getZkPrice();
|
| | | BigDecimal profit = MoneyBigDecimalUtil.mul(tkRate, zkPrice);
|
| | | // 计算结果
|
| | | BigDecimal estimateProfit = MoneyBigDecimalUtil.div(profit, new BigDecimal("100"));
|
| | |
|
| | | // 预计收益
|
| | | map.put("estimateProfit", estimateProfit);
|
| | |
|
| | | int existence = 0;
|
| | |
|
| | | /* 查询商品是否已存在商品精选库中 */
|
| | | Long localAuctionId = taoBaoGoodsBrief.getAuctionId();
|
| | | if (localAuctionId != null) {
|
| | | if (listHas != null && listHas.size() > 0) {
|
| | | for (QualityFactory selectionGoods : listHas) {
|
| | | TaoBaoGoodsBrief hasgoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | Long hasId = hasgoodsBrief.getAuctionId();
|
| | | if (localAuctionId.equals(hasId) || localAuctionId == hasId) {
|
| | | existence = 1; // 存在商品中
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | map.put("isExistence", existence);
|
| | |
|
| | | listmap.add(map);
|
| | | }
|
| | |
|
| | | return listmap;
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | | * @param callback
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 插入商品集合
|
| | | List<Long> listAuctionId = new ArrayList<Long>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
|
| | | listAuctionId.add(goodsBrief.getAuctionId());
|
| | | }
|
| | |
|
| | | // 验证是否存在数据库
|
| | | List<QualityFactory> listHas = qualityFactoryService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | taoBaoGoodsBrief.setId(null);
|
| | |
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
|
| | | map.put("pictUrl", taoBaoGoodsBrief.getPictUrl());
|
| | | map.put("title", taoBaoGoodsBrief.getTitle());
|
| | | map.put("auctionId", taoBaoGoodsBrief.getAuctionId());
|
| | | map.put("auctionUrl", taoBaoGoodsBrief.getAuctionUrl());
|
| | | map.put("zkPrice", taoBaoGoodsBrief.getZkPrice());
|
| | | map.put("biz30day", taoBaoGoodsBrief.getBiz30day());
|
| | | map.put("couponInfo", taoBaoGoodsBrief.getCouponInfo());
|
| | | map.put("couponTotalCount", taoBaoGoodsBrief.getCouponTotalCount());
|
| | | map.put("couponLeftCount", taoBaoGoodsBrief.getCouponLeftCount());
|
| | | map.put("couponEffectiveEndTime", taoBaoGoodsBrief.getCouponEffectiveEndTime());
|
| | | map.put("tkRate", taoBaoGoodsBrief.getTkRate());
|
| | |
|
| | | // 来源 0 无 1淘宝 2 京东
|
| | | map.put("goodsSource", 1);
|
| | |
|
| | | /* 券后价--计算 */
|
| | | BigDecimal couponPrice = TaoBaoUtil.getAfterUseCouplePrice(taoBaoGoodsBrief);
|
| | | map.put("couponPrice", couponPrice);
|
| | |
|
| | | /* 预计收益: 公司、用户 */
|
| | | BigDecimal tkRate = taoBaoGoodsBrief.getTkRate();
|
| | | BigDecimal zkPrice = taoBaoGoodsBrief.getZkPrice();
|
| | | BigDecimal profit = MoneyBigDecimalUtil.mul(tkRate, zkPrice);
|
| | | // 计算结果
|
| | | BigDecimal estimateProfit = MoneyBigDecimalUtil.div(profit, new BigDecimal("100"));
|
| | |
|
| | | // 预计收益
|
| | | map.put("estimateProfit", estimateProfit);
|
| | |
|
| | | int existence = 0;
|
| | |
|
| | | /* 查询商品是否已存在商品精选库中 */
|
| | | Long localAuctionId = taoBaoGoodsBrief.getAuctionId();
|
| | | if (localAuctionId != null) {
|
| | | if (listHas != null && listHas.size() > 0) {
|
| | | for (QualityFactory selectionGoods : listHas) {
|
| | | TaoBaoGoodsBrief hasgoodsBrief = selectionGoods.getTaoBaoGoodsBrief();
|
| | | Long hasId = hasgoodsBrief.getAuctionId();
|
| | | if (localAuctionId.equals(hasId) || localAuctionId == hasId) {
|
| | | existence = 1; // 存在商品中
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | map.put("isExistence", existence);
|
| | |
|
| | | listmap.add(map);
|
| | | }
|
| | | List<Map<String, Object>> listmap = filterTaoBaoGoodsWithQulity(taoBaoGoodsBriefs);
|
| | |
|
| | | PageEntity pe = result.getPageEntity();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls(); // 重点
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "searchDaTaoKe")
|
| | | public void searchDaTaoKe(String callback, Integer pageIndex, Integer pageSize, String key, Long cid,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | | key = StringUtil.isNullOrEmpty(key) ? "" : key;
|
| | | List<DaTaoKeDetail> list = daTaoKeGoodsDetailService.listSearchByTitleWithCid(key, cid, pageIndex,
|
| | | pageSize);
|
| | | long count = daTaoKeGoodsDetailService.countSearchByTitleWithCid(key, cid);
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | for (DaTaoKeDetail detail : list) {
|
| | | goodsList.add(TaoBaoUtil.convert(detail));
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> listmap = filterTaoBaoGoodsWithQulity(goodsList);
|
| | |
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, (int) count,
|
| | | (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1));
|
| | | JSONObject data = new JSONObject();
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls(); // 重点
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | data.put("pe", pe);
|
| | | data.put("listGoods", gson.toJson(listmap));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getQiangGou")
|
| | | public void getQiangGou(String callback, Integer pageIndex, PrintWriter out) {
|
| | |
|
| | |
| | | if ("ios".equalsIgnoreCase(platform)) {
|
| | | root.put("htmlLink", configService.get("index_html_link_ios"));
|
| | | }
|
| | | |
| | | root.put("spikeGoods", getSpikeGoodsContent(acceptData));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | } catch (Exception e) {
|
| | |
| | | return swiperList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 限时秒杀 1.5.3
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSpikeGoods")
|
| | | public void getSpikeGoods(AcceptData acceptData, PrintWriter out) {
|
| | |
|
| | | private JSONObject getSpikeGoodsContent(AcceptData acceptData) {
|
| | | // 下一次倒计时的时间
|
| | | int type = qualityFlashSaleService.getNowType() + 1;
|
| | | int hour = 0;
|
| | |
| | | JSONObject root = new JSONObject();
|
| | | root.put("time", nextTime.getTimeInMillis());
|
| | | root.put("listgoods", array);
|
| | |
|
| | | return root;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 限时秒杀 1.5.3
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getSpikeGoods")
|
| | | public void getSpikeGoods(AcceptData acceptData, PrintWriter out) {
|
| | | JSONObject root = getSpikeGoodsContent(acceptData);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | |
| | | Date createTime = deviceActive.getCreateTime();
|
| | | List<PushGoods> list = pushGoodsService.listHistoryByPushTime(0, 1, uid, createTime);
|
| | | if (list != null && list.size() > 0) {
|
| | | MsgDeviceReadState state = msgDeviceReadStateService.getByDeviceAndPlatformAndType(
|
| | | UserCommonMsgVO.TYPE_ZHUSHOU, acceptData.getDevice(),
|
| | | acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
|
| | | boolean read=false;
|
| | | if (state != null && state.getReadTime() != null
|
| | | && list.get(0).getCreateTime().getTime() < state.getReadTime().getTime())
|
| | | read = true;
|
| | | |
| | | commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_recommend.png", "推荐记录",
|
| | | list.get(0).getCreateTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), false,
|
| | | list.get(0).getCreateTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), read,
|
| | | jumpDetailV2Service.getByTypeCache("recommend_list"), null));
|
| | | }
|
| | | }
|
| | |
| | | msgDeviceReadStateService.setDeviceMsgRead(UserCommonMsgVO.TYPE_RECOMMEND, acceptData.getDevice(),
|
| | | (acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2));
|
| | | } else if (type.equalsIgnoreCase(UserCommonMsgVO.TYPE_ZHUSHOU)) {
|
| | | msgDeviceReadStateService.setDeviceMsgRead(UserCommonMsgVO.TYPE_RECOMMEND, acceptData.getDevice(),
|
| | | msgDeviceReadStateService.setDeviceMsgRead(UserCommonMsgVO.TYPE_ZHUSHOU, acceptData.getDevice(),
|
| | | (acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2));
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.clazz; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap; |
| | | |
| | | public interface GoodsSubClassLabelMapMapper extends BaseMapper<GoodsSubClassLabelMap> { |
| | | |
| | | /** |
| | | * 根据二级分类与标签ID检索 |
| | | * |
| | | * @param labelId |
| | | * @param subClassId |
| | | * @return |
| | | */ |
| | | GoodsSubClassLabelMap selectByLabelIdAndSubClassId(@Param("labelId") Long labelId, |
| | | @Param("subClassId") Long subClassId); |
| | | |
| | | /** |
| | | * 根据标签ID检索 |
| | | * |
| | | * @param labelId |
| | | * @return |
| | | */ |
| | | List<GoodsSubClassLabelMap> listMapByLabelId(@Param("labelId") Long labelId); |
| | | |
| | | /** |
| | | * 根据子分类查询 |
| | | * @param subClassId |
| | | * @return |
| | | */ |
| | | GoodsSubClassLabelMap selectBySubClassId(Long subClassId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.clazz; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel; |
| | | |
| | | public interface GoodsSubClassLabelMapper extends BaseMapper<GoodsSubClassLabel> { |
| | | |
| | | /** |
| | | * 根据名称与主分类ID获取二级分类标签 |
| | | * |
| | | * @param name |
| | | * @param classId |
| | | * @return |
| | | */ |
| | | GoodsSubClassLabel selectByClassIdAndName(@Param("name")String name,@Param("classId") Long classId); |
| | | |
| | | /** |
| | | * 根据分类ID检索 |
| | | * @param classId |
| | | * @return |
| | | */ |
| | | List<GoodsSubClassLabel> listByClassId(@Param("classId") Long classId); |
| | | |
| | | } |
| | |
| | | */ |
| | | List<DaTaoKeDetail> listByDtitle(String dtitle); |
| | | |
| | | /** |
| | | * 根据标题与分类搜索列表 |
| | | * |
| | | * @param title |
| | | * @param cid |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<DaTaoKeDetail> listSearchByTitleWithCid(@Param("title") String key, @Param("cid") Long cid, |
| | | @Param("start") long start, @Param("count") int count); |
| | | |
| | | /** |
| | | * 根据标题与分类获取搜索列表数量 |
| | | * |
| | | * @param title |
| | | * @param cid |
| | | * @return |
| | | */ |
| | | Long countSearchByTitleWithCid(@Param("title") String key, @Param("cid") Long cid); |
| | | |
| | | } |
| | |
| | |
|
| | | private String taobaoCids;
|
| | |
|
| | | |
| | |
|
| | | @Column(name = "sub_createtime")
|
| | | private Date createtime; // 创建时间
|
| | |
|
| | |
| | | private int countlabel = 0;
|
| | |
|
| | | private String searchParam;
|
| | |
|
| | | private GoodsSubClassLabel classLabel;
|
| | |
|
| | | public GoodsSubClass() {
|
| | | }
|
| | |
| | | public void setPictureSecond(String pictureSecond) {
|
| | | this.pictureSecond = pictureSecond;
|
| | | }
|
| | | |
| | |
|
| | | public String getTaobaoCids() {
|
| | | return taobaoCids;
|
| | | }
|
| | |
| | | public void setTaobaoCids(String taobaoCids) {
|
| | | this.taobaoCids = taobaoCids;
|
| | | }
|
| | |
|
| | | public GoodsSubClassLabel getClassLabel() {
|
| | | return classLabel;
|
| | | }
|
| | |
|
| | | public void setClassLabel(GoodsSubClassLabel classLabel) {
|
| | | this.classLabel = classLabel;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.clazz;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 二级分类标签
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_sub_class_label")
|
| | | public class GoodsSubClassLabel {
|
| | |
|
| | | public GoodsSubClassLabel(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public GoodsSubClassLabel() {
|
| | | }
|
| | |
|
| | | @Column(name = "scl_id")
|
| | | private Long id;// 主键ID
|
| | |
|
| | | @Column(name = "scl_name")
|
| | | private String name;// 名字
|
| | | @Column(name = "scl_order_by")
|
| | | private Integer orderBy;// 排序值
|
| | | @Column(name = "scl_class_id")
|
| | | private GoodsClass goodsClass;// 主分类ID
|
| | | @Column(name = "scl_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "scl_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getName() {
|
| | | return name;
|
| | | }
|
| | |
|
| | | public void setName(String name) {
|
| | | this.name = name;
|
| | | }
|
| | |
|
| | | public Integer getOrderBy() {
|
| | | return orderBy;
|
| | | }
|
| | |
|
| | | public void setOrderBy(Integer orderBy) {
|
| | | this.orderBy = orderBy;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public GoodsClass getGoodsClass() {
|
| | | return goodsClass;
|
| | | }
|
| | |
|
| | | public void setGoodsClass(GoodsClass goodsClass) {
|
| | | this.goodsClass = goodsClass;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.clazz;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 二级分类标签
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_sub_class_label_map")
|
| | | public class GoodsSubClassLabelMap {
|
| | | @Column(name="sclm_id")
|
| | | private Long id;// 主键ID
|
| | | @Column(name="sclm_label_id")
|
| | | private GoodsSubClassLabel label;
|
| | | @Column(name="sclm_sub_class_id")
|
| | | private GoodsSubClass goodsSubClass;
|
| | | @Column(name="sclm_order_by")
|
| | | private Integer orderBy;// 排序值
|
| | | @Column(name="sclm_create_time")
|
| | | private Date createTime;// 创建时间
|
| | | @Column(name="sclm_update_time")
|
| | | private Date updateTime;// 更改时间
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public GoodsSubClassLabel getLabel() {
|
| | | return label;
|
| | | }
|
| | |
|
| | | public void setLabel(GoodsSubClassLabel label) {
|
| | | this.label = label;
|
| | | }
|
| | |
|
| | | public GoodsSubClass getGoodsSubClass() {
|
| | | return goodsSubClass;
|
| | | }
|
| | |
|
| | | public void setGoodsSubClass(GoodsSubClass goodsSubClass) {
|
| | | this.goodsSubClass = goodsSubClass;
|
| | | }
|
| | |
|
| | | public Integer getOrderBy() {
|
| | | return orderBy;
|
| | | }
|
| | |
|
| | | public void setOrderBy(Integer orderBy) {
|
| | | this.orderBy = orderBy;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
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.clazz.GoodsSubClassLabelMapMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap"> |
| | | <id column="sclm_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="sclm_order_by" property="orderBy" jdbcType="INTEGER" /> |
| | | <result column="sclm_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="sclm_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <association property="label" column="sclm_label_id" |
| | | select="com.yeshi.fanli.dao.mybatis.clazz.GoodsSubClassLabelMapper.selectByPrimaryKey"> |
| | | </association> |
| | | <association property="goodsSubClass" column="sclm_sub_class_id" |
| | | select="com.yeshi.fanli.dao.mybatis.GoodsSubClassMapper.selectByPrimaryKey"> |
| | | </association> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">sclm_id,sclm_label_id,sclm_sub_class_id,sclm_order_by,sclm_create_time,sclm_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_sub_class_label_map where sclm_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByLabelIdAndSubClassId" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_sub_class_label_map where |
| | | sclm_sub_class_id=#{subClassId} and sclm_label_id=#{labelId} |
| | | </select> |
| | | |
| | | |
| | | <select id="listMapByLabelId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_sub_class_label_map where sclm_label_id=#{labelId} order |
| | | by sclm_order_by,sclm_create_time desc |
| | | </select> |
| | | |
| | | |
| | | <select id="selectBySubClassId" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_sub_class_label_map where |
| | | sclm_sub_class_id=#{0} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_sub_class_label_map where sclm_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_sub_class_label_map |
| | | (sclm_id,sclm_label_id,sclm_sub_class_id,sclm_order_by,sclm_create_time,sclm_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{label.id,jdbcType=BIGINT},#{goodsSubClass.id,jdbcType=BIGINT},#{orderBy,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_sub_class_label_map |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sclm_id,</if> |
| | | <if test="label != null">sclm_label_id,</if> |
| | | <if test="goodsSubClass != null">sclm_sub_class_id,</if> |
| | | <if test="orderBy != null">sclm_order_by,</if> |
| | | <if test="createTime != null">sclm_create_time,</if> |
| | | <if test="updateTime != null">sclm_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="label != null">#{label.id,jdbcType=BIGINT},</if> |
| | | <if test="goodsSubClass != null">#{goodsSubClass.id,jdbcType=BIGINT},</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.bus.clazz.GoodsSubClassLabelMap">update yeshi_ec_sub_class_label_map set sclm_label_id = |
| | | #{label.id,jdbcType=BIGINT},sclm_sub_class_id = |
| | | #{goodsSubClass.id,jdbcType=BIGINT},sclm_order_by = |
| | | #{orderBy,jdbcType=INTEGER},sclm_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},sclm_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where sclm_id = |
| | | #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap"> |
| | | update yeshi_ec_sub_class_label_map |
| | | <set> |
| | | <if test="label != null">sclm_label_id=#{label.id,jdbcType=BIGINT},</if> |
| | | <if test="goodsSubClass != null">sclm_sub_class_id=#{goodsSubClass.id,jdbcType=BIGINT}, |
| | | </if> |
| | | <if test="orderBy != null">sclm_order_by=#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">sclm_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">sclm_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where sclm_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </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.clazz.GoodsSubClassLabelMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel"> |
| | | <id column="scl_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="scl_name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="scl_order_by" property="orderBy" jdbcType="INTEGER" /> |
| | | <result column="scl_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="scl_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <association property="goodsClass" column="scl_class_id" |
| | | select="com.yeshi.fanli.dao.mybatis.GoodsClassMapper.selectByPrimaryKey"></association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">scl_id,scl_name,scl_order_by,scl_class_id,scl_create_time,scl_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_sub_class_label where scl_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByClassIdAndName" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_sub_class_label where scl_name = #{name} and |
| | | scl_class_id=#{classId} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByClassId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_sub_class_label |
| | | <if test="classId!=null"> |
| | | where |
| | | scl_class_id=#{classId} |
| | | </if> |
| | | |
| | | order by scl_order_by |
| | | |
| | | </select> |
| | | |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_sub_class_label where scl_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_sub_class_label |
| | | (scl_id,scl_name,scl_order_by,scl_class_id,scl_create_time,scl_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{orderBy,jdbcType=INTEGER},#{goodsClass.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_sub_class_label |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">scl_id,</if> |
| | | <if test="name != null">scl_name,</if> |
| | | <if test="orderBy != null">scl_order_by,</if> |
| | | <if test="goodsClass != null">scl_class_id,</if> |
| | | <if test="createTime != null">scl_create_time,</if> |
| | | <if test="updateTime != null">scl_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="orderBy != null">#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="goodsClass != null">#{goodsClass.id,jdbcType=BIGINT},</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.bus.clazz.GoodsSubClassLabel">update |
| | | yeshi_ec_sub_class_label set scl_name = |
| | | #{name,jdbcType=VARCHAR},scl_order_by = |
| | | #{orderBy,jdbcType=INTEGER},scl_class_id = |
| | | #{goodsClass.id,jdbcType=BIGINT},scl_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},scl_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where scl_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel"> |
| | | update yeshi_ec_sub_class_label |
| | | <set> |
| | | <if test="name != null">scl_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="orderBy != null">scl_order_by=#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="goodsClass != null">scl_class_id=#{goodsClass.id,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">scl_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">scl_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where scl_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tkMktStatus != null">#{tkMktStatus,jdbcType=VARCHAR},</if> |
| | | <if test="updatetime != null">#{updatetime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER}</if> |
| | | <if test="totalSales != null">#{totalSales,jdbcType=INTEGER}</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="totalSales != null">#{totalSales,jdbcType=INTEGER},</if> |
| | | <if test="materialLibType != null">#{materialLibType,jdbcType=INTEGER}</if> |
| | | |
| | | |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="listSearchByTitleWithCid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_goods_dataoke where (d_title like '%${title}%' or title |
| | | like '%${title}%') |
| | | <if test="cid!=null"> |
| | | and cid=#{cid} |
| | | </if> |
| | | order by update_time desc limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countSearchByTitleWithCid" resultType="java.lang.Long"> |
| | | select |
| | | count(id) |
| | | from yeshi_ec_goods_dataoke where (d_title like |
| | | '%${title}%' or `title` like '%${title}%') |
| | | <if test="cid!=null"> |
| | | and cid=#{cid} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByIdList"> |
| | | delete from |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.clazz;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.clazz.GoodsSubClassLabelMapMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.clazz.GoodsSubClassLabelMapper;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap;
|
| | | import com.yeshi.fanli.exception.GoodsClassException;
|
| | | import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class GoodsSubClassLabelServiceImpl implements GoodsSubClassLabelService {
|
| | |
|
| | | @Resource
|
| | | private GoodsSubClassLabelMapper goodsSubClassLabelMapper;
|
| | |
|
| | | @Resource
|
| | | private GoodsSubClassLabelMapMapper goodsSubClassLabelMapMapper;
|
| | |
|
| | | @Override
|
| | | public void addSubClassLabel(GoodsSubClassLabel label) throws GoodsClassException {
|
| | |
|
| | | if (label == null || label.getGoodsClass() == null || StringUtil.isNullOrEmpty(label.getName()))
|
| | | throw new GoodsClassException(1, "数据不完整");
|
| | | GoodsSubClassLabel oldLabel = goodsSubClassLabelMapper.selectByClassIdAndName(label.getName(),
|
| | | label.getGoodsClass().getId());
|
| | | if (oldLabel != null)
|
| | | throw new GoodsClassException(2, "分类标签名称已经存在");
|
| | | label.setCreateTime(new Date());
|
| | | goodsSubClassLabelMapper.insertSelective(label);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addSubClassLabelMap(GoodsSubClassLabelMap map) throws GoodsClassException {
|
| | | if (map.getGoodsSubClass() == null || map.getLabel() == null)
|
| | | throw new GoodsClassException(1, "数据不完整");
|
| | |
|
| | | GoodsSubClassLabelMap oldMap = goodsSubClassLabelMapMapper.selectByLabelIdAndSubClassId(map.getLabel().getId(),
|
| | | map.getGoodsSubClass().getId());
|
| | | if (oldMap != null)
|
| | | throw new GoodsClassException(2, "对应关系已经存在");
|
| | | // 通过subClassId查询
|
| | |
|
| | | GoodsSubClassLabelMap omap = goodsSubClassLabelMapMapper.selectBySubClassId(map.getGoodsSubClass().getId());
|
| | | if (omap != null)
|
| | | goodsSubClassLabelMapMapper.deleteByPrimaryKey(omap.getId());
|
| | |
|
| | | map.setCreateTime(new Date());
|
| | | goodsSubClassLabelMapMapper.insertSelective(map);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<GoodsSubClassLabel> listLabelByClassId(Long classId) {
|
| | |
|
| | | return goodsSubClassLabelMapper.listByClassId(classId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<GoodsSubClassLabelMap> listMapByLabelId(Long labelId) {
|
| | | return goodsSubClassLabelMapMapper.listMapByLabelId(labelId);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void deleteLabel(Long labelId) {
|
| | |
|
| | | List<GoodsSubClassLabelMap> maplist = listMapByLabelId(labelId);
|
| | | if (maplist != null)
|
| | | for (GoodsSubClassLabelMap map : maplist) {
|
| | | goodsSubClassLabelMapMapper.deleteByPrimaryKey(map.getId());
|
| | | }
|
| | | goodsSubClassLabelMapper.deleteByPrimaryKey(labelId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateSubClassLabel(GoodsSubClassLabel label) {
|
| | | goodsSubClassLabelMapper.updateByPrimaryKeySelective(label);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public GoodsSubClassLabelMap selectBySubClassId(Long subClassId) {
|
| | |
|
| | | return goodsSubClassLabelMapMapper.selectBySubClassId(subClassId);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap;
|
| | | import com.yeshi.fanli.exception.GoodsSubClassException;
|
| | | import com.yeshi.fanli.service.inter.clazz.GoodsSubClassLabelService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoClassService taoBaoClassService;
|
| | |
|
| | | @Resource
|
| | | private GoodsSubClassLabelService goodsSubClassLabelService;
|
| | |
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void saveObject(MultipartFile file, MultipartFile file2, GoodsSubClass record, Integer type, Long pid)
|
| | | throws GoodsSubClassException, Exception {
|
| | | public void saveObject(MultipartFile file, MultipartFile file2, GoodsSubClass record, Integer type, Long pid,
|
| | | GoodsSubClassLabelMap labelMap) throws GoodsSubClassException, Exception {
|
| | |
|
| | | String name = record.getName();
|
| | | if (name == null || name.trim().length() == 0) {
|
| | |
| | | }
|
| | |
|
| | | goodsSubClassMapper.insert(record);
|
| | | if (labelMap != null) {
|
| | | labelMap.setCreateTime(new Date());
|
| | | labelMap.setGoodsSubClass(record);
|
| | | goodsSubClassLabelService.addSubClassLabelMap(labelMap);
|
| | | }
|
| | |
|
| | | } else {
|
| | | // 修改
|
| | |
| | | record.setCreatetime(resultObj.getCreatetime());
|
| | | record.setUpdatetime(new Date());
|
| | | goodsSubClassMapper.updateByPrimaryKey(record);
|
| | |
|
| | | if (labelMap != null) {
|
| | | labelMap.setCreateTime(new Date());
|
| | | labelMap.setGoodsSubClass(record);
|
| | | goodsSubClassLabelService.addSubClassLabelMap(labelMap);
|
| | | }
|
| | | }
|
| | |
|
| | | // 保存淘宝商品分类id
|
| | |
| | | update.setUnReadCount(0);
|
| | | update.setUpdateTime(new Date());
|
| | | msgDeviceReadStateMapper.updateByPrimaryKeySelective(update);
|
| | | } else {
|
| | | state = new MsgDeviceReadState();
|
| | | state.setCreateTime(new Date());
|
| | | state.setDevice(device);
|
| | | state.setPlatform(platform);
|
| | | state.setReadTime(new Date());
|
| | | state.setType(type);
|
| | | state.setUnReadCount(0);
|
| | | msgDeviceReadStateMapper.insertSelective(state);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | package com.yeshi.fanli.service.impl.taobao.dataoke;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | |
| | | List<DaTaoKeDetail> daTaoKeList = daTaoKeDetailMapper.listByGoodsIds(goodsIdList);
|
| | | if (daTaoKeList == null || daTaoKeList.size() == 0)
|
| | | return goods;
|
| | |
|
| | | // 重新设置标题与券价格
|
| | | goods = DaTaoKeUtil.filterTaoBaoGoods(goods, daTaoKeList.get(0));
|
| | |
|
| | | return goods;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetail> listByDtitle(String dtitle) {
|
| | |
|
| | | return daTaoKeDetailMapper.listByDtitle(dtitle.trim());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetail> listSearchByTitleWithCid(String title, Long cid, int page, int pageSize) {
|
| | | return daTaoKeDetailMapper.listSearchByTitleWithCid(title, (cid == null || cid == 0 ? null : cid),
|
| | | (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public Long countSearchByTitleWithCid(String title, Long cid) {
|
| | | return daTaoKeDetailMapper.countSearchByTitleWithCid(title, (cid == null || cid == 0 ? null : cid));
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.clazz;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabel;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap;
|
| | | import com.yeshi.fanli.exception.GoodsClassException;
|
| | |
|
| | | /**
|
| | | * 二级分类的标签服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface GoodsSubClassLabelService {
|
| | |
|
| | | /**
|
| | | * 添加二级分类标签
|
| | | * |
| | | * @param label
|
| | | * @throws GoodsClassException
|
| | | */
|
| | | public void addSubClassLabel(GoodsSubClassLabel label) throws GoodsClassException;
|
| | |
|
| | | /**
|
| | | * 更新
|
| | | * |
| | | * @param label
|
| | | */
|
| | | public void updateSubClassLabel(GoodsSubClassLabel label);
|
| | |
|
| | | /**
|
| | | * 添加二级分类标签映射
|
| | | * |
| | | * @param map
|
| | | * @throws GoodsClassException
|
| | | */
|
| | | public void addSubClassLabelMap(GoodsSubClassLabelMap map) throws GoodsClassException;
|
| | |
|
| | | /**
|
| | | * |
| | | * 根据主分类ID获取标签
|
| | | * |
| | | * @param classId-主分类ID
|
| | | * @return
|
| | | */
|
| | | public List<GoodsSubClassLabel> listLabelByClassId(Long classId);
|
| | |
|
| | | /**
|
| | | * 根据分类标签ID获取映射关系列表
|
| | | * |
| | | * @param labelId
|
| | | * @return
|
| | | */
|
| | | public List<GoodsSubClassLabelMap> listMapByLabelId(Long labelId);
|
| | |
|
| | | /**
|
| | | * 删除标签
|
| | | * |
| | | * @param labelId
|
| | | */
|
| | | public void deleteLabel(Long labelId);
|
| | |
|
| | | /**
|
| | | * 查询映射(通过子分类ID查询)
|
| | | * |
| | | * @param subClassId
|
| | | * @return
|
| | | */
|
| | | public GoodsSubClassLabelMap selectBySubClassId(Long subClassId);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClassLabelMap;
|
| | | import com.yeshi.fanli.exception.GoodsSubClassException;
|
| | |
|
| | |
|
| | |
| | | * @throws GoodsSubClassException
|
| | | * @throws Exception
|
| | | */
|
| | | public void saveObject(MultipartFile file,MultipartFile file2, GoodsSubClass record, Integer type, Long pid)
|
| | | public void saveObject(MultipartFile file,MultipartFile file2, GoodsSubClass record, Integer type, Long pid,GoodsSubClassLabelMap labelMap)
|
| | | throws GoodsSubClassException, Exception;
|
| | |
|
| | | }
|
| | |
| | |
|
| | | /**
|
| | | * 根据标题查询
|
| | | * |
| | | * @param dtitle
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetail> listByDtitle(String dtitle);
|
| | |
|
| | | /**
|
| | | * 根据标题类型搜索
|
| | | * |
| | | * @param title
|
| | | * -标题
|
| | | * @param cid
|
| | | * -分类ID
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<DaTaoKeDetail> listSearchByTitleWithCid(String title, Long cid, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 获取搜索到的数量
|
| | | * |
| | | * @param title
|
| | | * @param cid
|
| | | * @return
|
| | | */
|
| | | public Long countSearchByTitleWithCid(String title, Long cid);
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | |
| | | public static void taoKeContent() {
|
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("method", "taobao.tbk.content.get");
|
| | | map.put("adzone_id",TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]);
|
| | | map.put("type", "1");
|
| | | |
| | | // map.put("method", "taobao.tbk.content.get");
|
| | | TaoKeAppInfo app = new TaoKeAppInfo();
|
| | | app.setAppKey("24838852");
|
| | | app.setAppSecret("bc8265e2bf8d8115329d652f9d3d4cd8");
|
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
|
| | | app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | try {
|
| | | JSONObject json = TaoKeBaseUtil.baseRequest(map,app);
|
| | | System.out.println(json);
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | // AA5ISJ
|