完善基本功能

This commit is contained in:
启航 2024-02-29 10:53:01 +08:00
parent 15ae0a9ec0
commit be638dfea0
13 changed files with 1123 additions and 196 deletions

View File

@ -16,7 +16,7 @@ import org.springframework.context.annotation.ComponentScan;
@EnableDiscoveryClient
@ComponentScan(basePackages={"com.qihang"})
@MapperScan("com.qihang.tao.mapper")
//@MapperScan("com.qihang.tao.mapper")
@SpringBootApplication
public class TaoApi
{

View File

@ -0,0 +1,63 @@
package com.qihang.tao.common;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qihang.common.common.ServiceException;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
public class PageQuery implements Serializable {
private Integer pageSize;
private Integer pageIndex;
private String orderByColumn;
private String isAsc;
public static final int DEFAULT_PAGE_INDEX =1;
public static final int DEFAULT_PAGE_SIZE = 10;
public <T> Page<T> build() {
Integer pageIndex = (getPageIndex() == null || getPageIndex() == 0) ? DEFAULT_PAGE_INDEX : getPageIndex();
Integer pageSize = (getPageSize() == null || getPageSize() == 0) ? DEFAULT_PAGE_SIZE : getPageSize();
if (pageIndex <= 0) {
pageIndex = DEFAULT_PAGE_INDEX;
}
Page<T> page = new Page<>(pageIndex,pageSize);
// 加上排序
List<OrderItem> orderItems = buildOrderItem();
if(!CollectionUtils.isEmpty(orderItems)){
page.addOrder(orderItems);
}
return page;
}
private List<OrderItem> buildOrderItem(){
List<OrderItem> list = new ArrayList<>();
if(StringUtils.isEmpty(orderByColumn) || StringUtils.isEmpty(isAsc)){
list.add(OrderItem.desc("id"));
return list;
}
String[] orderByArr = orderByColumn.split(",");
String[] isAscArr = isAsc.split(",");
// 字段加上排序
for (int i = 0; i < orderByArr.length; i++) {
String orderByStr = orderByArr[i];
String isAscStr = isAscArr.length ==1 ?isAscArr[0]:isAscArr[i];
if("asc".equals(isAscStr)){
list.add(OrderItem.asc(orderByStr));
}else if("desc".equals(isAscStr)){
list.add(OrderItem.desc(orderByStr));
}else {
throw new ServiceException("排序参数错误");
}
}
return list;
}
}

View File

@ -0,0 +1,41 @@
package com.qihang.tao.common;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qihang.common.enums.HttpStatus;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class PageResult<T> implements Serializable {
private long total;
private List<T> records;
private int code;
private String msg;
public static <T> PageResult<T> build(IPage<T> page){
PageResult<T> result = new PageResult<>();
result.setCode(HttpStatus.SUCCESS);
result.setMsg("查询成功");
result.setRecords(page.getRecords());
result.setTotal(page.getTotal());
return result;
}
public static <T> PageResult<T> build(List<T> list){
PageResult<T> result = new PageResult<>();
result.setCode(HttpStatus.SUCCESS);
result.setMsg("查询成功");
result.setRecords(list);
result.setTotal(list.size());
return result;
}
public static <T> PageResult<T> build(){
PageResult<T> result = new PageResult<>();
result.setCode(HttpStatus.SUCCESS);
result.setMsg("查询成功");
return result;
}
}

View File

@ -0,0 +1,19 @@
package com.qihang.tao.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@MapperScan("com.qihang.tao.mapper")
public class MybatisPlusConfig {
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); //注意使用哪种数据库
return interceptor;
}
}

View File

@ -1,142 +1,142 @@
package com.qihang.tao.controller;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class GoodsApiController {
/**
* @api {post} /api/v1/pull_goods 更新店铺商品列表
* @apiVersion 1.0.0
* @apiName pullGoods
* @apiGroup taoGood
* @apiParam {String} startTime 开始时间
* @apiParam {String} endTime 结束时间
* @apiParam {Number} shopId 店铺id(东方符号7)
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK{
"code": "0成功其他失败",
"msg": "成功或失败信息"
}
*/
@RequestMapping(value = "/pull_goods", method = RequestMethod.POST)
public ApiResult<Integer> getOrderList(@RequestBody DataRow reqData, HttpServletRequest request) throws Exception {
String startDate = reqData.getString("startTime");
String endDate = reqData.getString("endTime");
Integer shopId=reqData.getInt("shopId");
var checkResult = this.check(shopId);
if (checkResult.getCode() != EnumResultVo.SUCCESS.getIndex()) {
return new ApiResult<>(checkResult.getCode(), checkResult.getMsg());
}
Integer pageIndex = 1;
Integer pageSize = 40;
Long endTime = System.currentTimeMillis() / 1000;//更新结束时间
Long startTime = endTime-(60 * 60 * 24 * 7);//更新开始时间
if(!StringUtils.isEmpty(startDate))startTime = DateUtil.dateToStamp(startDate).longValue();
if (!StringUtils.isEmpty(endDate)) endTime = DateUtil.dateTimeToStamp(endDate + " 23:59:00").longValue();
long kaishidaojiesu = endTime - startTime;
long forSize = (kaishidaojiesu % (60 * 60 * 24 * 7) == 0) ? kaishidaojiesu / (60 * 60 * 24 * 7) : kaishidaojiesu / (60 * 60 * 24 * 7) + 1;//计算需要循环的次数
for (int i = 0; i < forSize; i++) {
Long startTime1 = startTime + i * 60 * 60 * 24 * 7;
Long endTime1 = startTime1 + 60 * 60 * 24 * 7;
Integer totalCount = pullGoods(checkResult.getData(),pageIndex,pageSize,startTime1,endTime1);
int totalPage = (totalCount % pageSize == 0) ? totalCount / pageSize : (totalCount / pageSize) + 1;
while (pageIndex < totalPage) {
pageIndex++;
pullGoods(checkResult.getData(),pageIndex,pageSize,startTime1,endTime1);
}
pageIndex=1;
}
return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS");
}
public Integer pullGoods(DcSysThirdSettingEntity result, Integer pageNo, Integer pageSize, Long startTime, Long endTime) throws Exception{
String sendUrl="http://gw.api.taobao.com/router/rest";
Map<String, String> params = new HashMap<>();
params.put("method","taobao.items.onsale.get");
params.put("app_key",result.getAppKey());
params.put("sign_method","md5");
params.put("timestamp",String.valueOf(System.currentTimeMillis()));
params.put("session",result.getAccess_token());
params.put("v","2.0");
params.put("fields","approve_status,num_iid,title,pic_url,num,list_time,price,delist_time,outer_id,sold_quantity,modified");
params.put("nick",result.getName());
params.put("page_no",String.valueOf(pageNo));
params.put("page_size",String.valueOf(pageSize));
params.put("start_modified",DateUtil.stampToDateTime(startTime));
params.put("end_modified",DateUtil.stampToDateTime(endTime));
params.put("sign",ExpressClient.buildSign(params,result.getAppSecret()));
HttpResponse<String> response = HttpUtil.doPost(sendUrl,HttpUtil.map2Url(params));
var dd = XmlUtil.xmlToJson(response.body());
if(dd.getInteger("total_results").intValue()>0){
var jsonArray= dd.getJSONObject("items").getJSONArray("item");
taoGoodService.addTaoGoods(jsonArray);
}
return dd.getInteger("total_results");
}
/**
* @api {post} /pull_goods_comment 更新商品评价
* @apiVersion 1.0.0
* @apiName pullGoodsComment
* @apiGroup taoGood
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
* {
* "code": 0:成功,
* "msg": "信息"
* }
*/
/* @RequestMapping(value = "/pull_goods_comment", method = RequestMethod.POST)
public ApiResult<Integer> pullGoodsComments(HttpServletRequest request){
Integer shopId=7;
Integer pageIndex = 1;
Integer pageSize = 100;
Date startDate=StringUtils.isEmpty(taoGoodService.getGoodCommentDate()) ? DateUtil.beforeDayDate(180) : taoGoodService.getGoodCommentDate();
System.out.println(startDate);
var result = pullTaoGoodsComment(shopId,pageIndex,pageSize,startDate);
if(result.getCode()==0){
while (result.getData().intValue()>pageSize.intValue()) {
pageIndex++;
System.out.println(pageIndex);
pullTaoGoodsComment(shopId,pageIndex,pageSize,startDate);
}
return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(),"成功");
}else return new ApiResult<>(EnumResultVo.Fail.getIndex(),"失败");
}*/
/* public ApiResult<Integer> pullTaoGoodsComment(Integer shopId,Integer pageIndex,Integer pageSize,Date startDate){
var result = this.check(shopId).getData();
TaobaoClient client = new DefaultTaobaoClient(result.getRequest_url(), result.getAppKey(), result.getAppSecret());
TraderatesGetRequest req = new TraderatesGetRequest();
req.setFields("tid,oid,role,nick,result,totalResults,hasNext,created,rated_nick,item_title,item_price,content,reply,num_iid");
req.setRateType("get");
req.setRole("buyer");
req.setStartDate(startDate);
req.setPageNo(pageIndex.longValue());
req.setPageSize(pageSize.longValue());
req.setUseHasNext(true);
try {
TraderatesGetResponse rsp = client.execute(req, result.getAccess_token());
if(rsp.getTradeRates().size()>0){
List<DcTaoGoodsCommentEntity> list =new ArrayList<>();
rsp.getTradeRates().forEach(c->{
DcTaoGoodsCommentEntity comment=new DcTaoGoodsCommentEntity();
comment.setNumIid(c.getNumIid());
comment.setBuyer(c.getNick());
comment.setCreated(c.getCreated());
comment.setTid(c.getTid());
comment.setOid(c.getOid());
comment.setComment(c.getContent());
comment.setResult(c.getResult());
list.add(comment);
});
taoGoodService.addGoodComment(list);
return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(),"成功",rsp.getTradeRates().size());
}else return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(),"失败");
}catch (Exception e){
return new ApiResult<>(EnumResultVo.Fail.getIndex(),"失败",0);
}
}*/
}
//package com.qihang.tao.controller;
//
//import org.springframework.web.bind.annotation.RestController;
//
//@RestController
//public class GoodsApiController {
///**
// * @api {post} /api/v1/pull_goods 更新店铺商品列表
// * @apiVersion 1.0.0
// * @apiName pullGoods
// * @apiGroup taoGood
// * @apiParam {String} startTime 开始时间
// * @apiParam {String} endTime 结束时间
// * @apiParam {Number} shopId 店铺id(东方符号7)
// * @apiSuccessExample {json} Success-Response:
// * HTTP/1.1 200 OK{
// "code": "0成功其他失败",
// "msg": "成功或失败信息"
// }
// */
// @RequestMapping(value = "/pull_goods", method = RequestMethod.POST)
// public ApiResult<Integer> getOrderList(@RequestBody DataRow reqData, HttpServletRequest request) throws Exception {
// String startDate = reqData.getString("startTime");
// String endDate = reqData.getString("endTime");
// Integer shopId=reqData.getInt("shopId");
// var checkResult = this.check(shopId);
// if (checkResult.getCode() != EnumResultVo.SUCCESS.getIndex()) {
// return new ApiResult<>(checkResult.getCode(), checkResult.getMsg());
// }
// Integer pageIndex = 1;
// Integer pageSize = 40;
// Long endTime = System.currentTimeMillis() / 1000;//更新结束时间
// Long startTime = endTime-(60 * 60 * 24 * 7);//更新开始时间
// if(!StringUtils.isEmpty(startDate))startTime = DateUtil.dateToStamp(startDate).longValue();
//
// if (!StringUtils.isEmpty(endDate)) endTime = DateUtil.dateTimeToStamp(endDate + " 23:59:00").longValue();
//
// long kaishidaojiesu = endTime - startTime;
// long forSize = (kaishidaojiesu % (60 * 60 * 24 * 7) == 0) ? kaishidaojiesu / (60 * 60 * 24 * 7) : kaishidaojiesu / (60 * 60 * 24 * 7) + 1;//计算需要循环的次数
// for (int i = 0; i < forSize; i++) {
// Long startTime1 = startTime + i * 60 * 60 * 24 * 7;
// Long endTime1 = startTime1 + 60 * 60 * 24 * 7;
// Integer totalCount = pullGoods(checkResult.getData(),pageIndex,pageSize,startTime1,endTime1);
// int totalPage = (totalCount % pageSize == 0) ? totalCount / pageSize : (totalCount / pageSize) + 1;
// while (pageIndex < totalPage) {
// pageIndex++;
// pullGoods(checkResult.getData(),pageIndex,pageSize,startTime1,endTime1);
// }
// pageIndex=1;
// }
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(), "SUCCESS");
// }
//
// public Integer pullGoods(DcSysThirdSettingEntity result, Integer pageNo, Integer pageSize, Long startTime, Long endTime) throws Exception{
// String sendUrl="http://gw.api.taobao.com/router/rest";
// Map<String, String> params = new HashMap<>();
// params.put("method","taobao.items.onsale.get");
// params.put("app_key",result.getAppKey());
// params.put("sign_method","md5");
// params.put("timestamp",String.valueOf(System.currentTimeMillis()));
// params.put("session",result.getAccess_token());
// params.put("v","2.0");
// params.put("fields","approve_status,num_iid,title,pic_url,num,list_time,price,delist_time,outer_id,sold_quantity,modified");
// params.put("nick",result.getName());
// params.put("page_no",String.valueOf(pageNo));
// params.put("page_size",String.valueOf(pageSize));
// params.put("start_modified",DateUtil.stampToDateTime(startTime));
// params.put("end_modified",DateUtil.stampToDateTime(endTime));
// params.put("sign",ExpressClient.buildSign(params,result.getAppSecret()));
// HttpResponse<String> response = HttpUtil.doPost(sendUrl,HttpUtil.map2Url(params));
// var dd = XmlUtil.xmlToJson(response.body());
// if(dd.getInteger("total_results").intValue()>0){
// var jsonArray= dd.getJSONObject("items").getJSONArray("item");
// taoGoodService.addTaoGoods(jsonArray);
// }
// return dd.getInteger("total_results");
// }
//
// /**
// * @api {post} /pull_goods_comment 更新商品评价
// * @apiVersion 1.0.0
// * @apiName pullGoodsComment
// * @apiGroup taoGood
// * @apiSuccessExample {json} Success-Response:
// * HTTP/1.1 200 OK
// * {
// * "code": 0:成功,
// * "msg": "信息"
// * }
// */
///* @RequestMapping(value = "/pull_goods_comment", method = RequestMethod.POST)
// public ApiResult<Integer> pullGoodsComments(HttpServletRequest request){
// Integer shopId=7;
// Integer pageIndex = 1;
// Integer pageSize = 100;
// Date startDate=StringUtils.isEmpty(taoGoodService.getGoodCommentDate()) ? DateUtil.beforeDayDate(180) : taoGoodService.getGoodCommentDate();
// System.out.println(startDate);
// var result = pullTaoGoodsComment(shopId,pageIndex,pageSize,startDate);
// if(result.getCode()==0){
// while (result.getData().intValue()>pageSize.intValue()) {
// pageIndex++;
// System.out.println(pageIndex);
// pullTaoGoodsComment(shopId,pageIndex,pageSize,startDate);
// }
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(),"成功");
// }else return new ApiResult<>(EnumResultVo.Fail.getIndex(),"失败");
//
// }*/
///* public ApiResult<Integer> pullTaoGoodsComment(Integer shopId,Integer pageIndex,Integer pageSize,Date startDate){
// var result = this.check(shopId).getData();
// TaobaoClient client = new DefaultTaobaoClient(result.getRequest_url(), result.getAppKey(), result.getAppSecret());
// TraderatesGetRequest req = new TraderatesGetRequest();
// req.setFields("tid,oid,role,nick,result,totalResults,hasNext,created,rated_nick,item_title,item_price,content,reply,num_iid");
// req.setRateType("get");
// req.setRole("buyer");
// req.setStartDate(startDate);
// req.setPageNo(pageIndex.longValue());
// req.setPageSize(pageSize.longValue());
// req.setUseHasNext(true);
// try {
// TraderatesGetResponse rsp = client.execute(req, result.getAccess_token());
// if(rsp.getTradeRates().size()>0){
// List<DcTaoGoodsCommentEntity> list =new ArrayList<>();
// rsp.getTradeRates().forEach(c->{
// DcTaoGoodsCommentEntity comment=new DcTaoGoodsCommentEntity();
// comment.setNumIid(c.getNumIid());
// comment.setBuyer(c.getNick());
// comment.setCreated(c.getCreated());
// comment.setTid(c.getTid());
// comment.setOid(c.getOid());
// comment.setComment(c.getContent());
// comment.setResult(c.getResult());
// list.add(comment);
// });
// taoGoodService.addGoodComment(list);
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(),"成功",rsp.getTradeRates().size());
// }else return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(),"失败");
// }catch (Exception e){
// return new ApiResult<>(EnumResultVo.Fail.getIndex(),"失败",0);
// }
// }*/
//}

View File

@ -1,6 +1,13 @@
package com.qihang.tao.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qihang.tao.common.PageQuery;
import com.qihang.tao.common.PageResult;
import com.qihang.tao.domain.TaoGoods;
import com.qihang.tao.domain.bo.TaoGoodsBo;
import com.qihang.tao.service.TaoGoodsService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@ -9,14 +16,19 @@ import java.util.List;
@RequestMapping("/goods")
@RestController
@AllArgsConstructor
public class GoodsController {
private final TaoGoodsService goodsService;
@RequestMapping(value = "/list", method = RequestMethod.GET)
public ApiResult<List<TaoGoods>> goodsList(String key) {
try {
var result=taoGoodService.getList(req);
return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(),"成功",result);
}catch (Exception ex){
return new ApiResult<>(EnumResultVo.Fail.getIndex(),EnumResultVo.Fail.getName()+ex.getMessage());
}
public PageResult<TaoGoods> goodsList(TaoGoodsBo bo, PageQuery pageQuery) {
PageResult<TaoGoods> result = goodsService.queryPageList(bo, pageQuery);
// try {
// var result=taoGoodService.getList(req);
// return new ApiResult<>(EnumResultVo.SUCCESS.getIndex(),"成功",result);
// }catch (Exception ex){
// return new ApiResult<>(EnumResultVo.Fail.getIndex(),EnumResultVo.Fail.getName()+ex.getMessage());
// }
return result;
}
}

View File

@ -1,20 +1,25 @@
package com.qihang.tao.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;
@Data
@TableName("tao_goods")
public class TaoGoods {
/**
*
* @TableName tao_goods
*/
public class TaoGoods implements Serializable {
/**
* 主键id自增长
*
*/
private Long id;
/**
* tao商品id
* 商品id
*/
private String iid;
/**
* 商品数字id
*/
private Long numIid;
@ -24,64 +29,720 @@ public class TaoGoods {
private String title;
/**
* 商品主图
* 卖家昵称
*/
private String nick;
/**
* 商品类型(fixed:一口价;auction:拍卖)取消团购
*/
private String type;
/**
* 商品所属的叶子类目 id
*/
private Long cid;
/**
* 商品所属的店铺内卖家自定义类目列表
*/
private String sellerCids;
/**
* 主图
*/
private String picUrl;
/**
* 商品价格
*/
private BigDecimal price;
/**
* 商品数量
*/
private Long num;
private Integer num;
/**
* 商品状态onsale出售中instock库中
* 商品属性 格式pid:vid;pid:vid
*/
private String approveStatus;
private String props;
/**
* 商品外部编码
* 有效期,7或者14默认是7天
*/
private Integer validThru;
/**
* 支持会员打折,true/false
*/
private String hasDiscount;
/**
* 是否有发票,true/false
*/
private String hasInvoice;
/**
* 是否有保修,true/false
*/
private String hasWarranty;
/**
* 橱窗推荐,true/false
*/
private String hasShowcase;
/**
* 商品修改时间格式yyyy-MM-dd HH:mm:ss
*/
private Date modified;
/**
* 下架时间格式yyyy-MM-dd HH:mm:ss
*/
private Date delistTime;
/**
* 宝贝所属的运费模板ID如果没有返回则说明没有使用运费模板
*/
private Integer postageId;
/**
* 商家外部编码(可与商家外部系统对接)需要授权才能获取
*/
private String outerId;
/**
* 上架时间格式yyyy-MM-dd HH:mm:ss
*/
private Date listTime;
/**
* 商品价格格式5.00单位精确到
*/
private String price;
/**
* 备注
*/
private String remark;
/**
* 是否在外部网店显示
*/
private String isEx;
/**
* 虚拟商品的状态字段
*/
private String isVirtual;
/**
* 是否在淘宝显示
*/
private String isTaobao;
/**
* 商品销量
*/
private Long soldQuantity;
private Integer soldQuantity;
/**
* 上架时间
* 是否为达尔文挂接成功了的商品
*/
private Long listTime;
private String isCspu;
/**
* 下架时间
* 商品首次上架时间
*/
private Long delistTime;
private Date firstStartsTime;
/**
* 修改时间
* 店铺id
*/
private Long modified;
private Integer shopId;
/**
* 销售价
* erp商品id
*/
private BigDecimal salesPrice;
/**
* 批发价
*/
private BigDecimal whslePrice;
private Integer erpGoodsId;
/**
* 创建时间
*/
private Long createOn;
//标签
private String tag;
//评价数量
private Integer commentCount;
private Date createTime;
}
private static final long serialVersionUID = 1L;
/**
*
*/
public Long getId() {
return id;
}
/**
*
*/
public void setId(Long id) {
this.id = id;
}
/**
* 商品id
*/
public String getIid() {
return iid;
}
/**
* 商品id
*/
public void setIid(String iid) {
this.iid = iid;
}
/**
* 商品数字id
*/
public Long getNumIid() {
return numIid;
}
/**
* 商品数字id
*/
public void setNumIid(Long numIid) {
this.numIid = numIid;
}
/**
* 商品标题
*/
public String getTitle() {
return title;
}
/**
* 商品标题
*/
public void setTitle(String title) {
this.title = title;
}
/**
* 卖家昵称
*/
public String getNick() {
return nick;
}
/**
* 卖家昵称
*/
public void setNick(String nick) {
this.nick = nick;
}
/**
* 商品类型(fixed:一口价;auction:拍卖)取消团购
*/
public String getType() {
return type;
}
/**
* 商品类型(fixed:一口价;auction:拍卖)取消团购
*/
public void setType(String type) {
this.type = type;
}
/**
* 商品所属的叶子类目 id
*/
public Long getCid() {
return cid;
}
/**
* 商品所属的叶子类目 id
*/
public void setCid(Long cid) {
this.cid = cid;
}
/**
* 商品所属的店铺内卖家自定义类目列表
*/
public String getSellerCids() {
return sellerCids;
}
/**
* 商品所属的店铺内卖家自定义类目列表
*/
public void setSellerCids(String sellerCids) {
this.sellerCids = sellerCids;
}
/**
* 主图
*/
public String getPicUrl() {
return picUrl;
}
/**
* 主图
*/
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
/**
* 商品数量
*/
public Integer getNum() {
return num;
}
/**
* 商品数量
*/
public void setNum(Integer num) {
this.num = num;
}
/**
* 商品属性 格式pid:vid;pid:vid
*/
public String getProps() {
return props;
}
/**
* 商品属性 格式pid:vid;pid:vid
*/
public void setProps(String props) {
this.props = props;
}
/**
* 有效期,7或者14默认是7天
*/
public Integer getValidThru() {
return validThru;
}
/**
* 有效期,7或者14默认是7天
*/
public void setValidThru(Integer validThru) {
this.validThru = validThru;
}
/**
* 支持会员打折,true/false
*/
public String getHasDiscount() {
return hasDiscount;
}
/**
* 支持会员打折,true/false
*/
public void setHasDiscount(String hasDiscount) {
this.hasDiscount = hasDiscount;
}
/**
* 是否有发票,true/false
*/
public String getHasInvoice() {
return hasInvoice;
}
/**
* 是否有发票,true/false
*/
public void setHasInvoice(String hasInvoice) {
this.hasInvoice = hasInvoice;
}
/**
* 是否有保修,true/false
*/
public String getHasWarranty() {
return hasWarranty;
}
/**
* 是否有保修,true/false
*/
public void setHasWarranty(String hasWarranty) {
this.hasWarranty = hasWarranty;
}
/**
* 橱窗推荐,true/false
*/
public String getHasShowcase() {
return hasShowcase;
}
/**
* 橱窗推荐,true/false
*/
public void setHasShowcase(String hasShowcase) {
this.hasShowcase = hasShowcase;
}
/**
* 商品修改时间格式yyyy-MM-dd HH:mm:ss
*/
public Date getModified() {
return modified;
}
/**
* 商品修改时间格式yyyy-MM-dd HH:mm:ss
*/
public void setModified(Date modified) {
this.modified = modified;
}
/**
* 下架时间格式yyyy-MM-dd HH:mm:ss
*/
public Date getDelistTime() {
return delistTime;
}
/**
* 下架时间格式yyyy-MM-dd HH:mm:ss
*/
public void setDelistTime(Date delistTime) {
this.delistTime = delistTime;
}
/**
* 宝贝所属的运费模板ID如果没有返回则说明没有使用运费模板
*/
public Integer getPostageId() {
return postageId;
}
/**
* 宝贝所属的运费模板ID如果没有返回则说明没有使用运费模板
*/
public void setPostageId(Integer postageId) {
this.postageId = postageId;
}
/**
* 商家外部编码(可与商家外部系统对接)需要授权才能获取
*/
public String getOuterId() {
return outerId;
}
/**
* 商家外部编码(可与商家外部系统对接)需要授权才能获取
*/
public void setOuterId(String outerId) {
this.outerId = outerId;
}
/**
* 上架时间格式yyyy-MM-dd HH:mm:ss
*/
public Date getListTime() {
return listTime;
}
/**
* 上架时间格式yyyy-MM-dd HH:mm:ss
*/
public void setListTime(Date listTime) {
this.listTime = listTime;
}
/**
* 商品价格格式5.00单位精确到
*/
public String getPrice() {
return price;
}
/**
* 商品价格格式5.00单位精确到
*/
public void setPrice(String price) {
this.price = price;
}
/**
* 备注
*/
public String getRemark() {
return remark;
}
/**
* 备注
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* 是否在外部网店显示
*/
public String getIsEx() {
return isEx;
}
/**
* 是否在外部网店显示
*/
public void setIsEx(String isEx) {
this.isEx = isEx;
}
/**
* 虚拟商品的状态字段
*/
public String getIsVirtual() {
return isVirtual;
}
/**
* 虚拟商品的状态字段
*/
public void setIsVirtual(String isVirtual) {
this.isVirtual = isVirtual;
}
/**
* 是否在淘宝显示
*/
public String getIsTaobao() {
return isTaobao;
}
/**
* 是否在淘宝显示
*/
public void setIsTaobao(String isTaobao) {
this.isTaobao = isTaobao;
}
/**
* 商品销量
*/
public Integer getSoldQuantity() {
return soldQuantity;
}
/**
* 商品销量
*/
public void setSoldQuantity(Integer soldQuantity) {
this.soldQuantity = soldQuantity;
}
/**
* 是否为达尔文挂接成功了的商品
*/
public String getIsCspu() {
return isCspu;
}
/**
* 是否为达尔文挂接成功了的商品
*/
public void setIsCspu(String isCspu) {
this.isCspu = isCspu;
}
/**
* 商品首次上架时间
*/
public Date getFirstStartsTime() {
return firstStartsTime;
}
/**
* 商品首次上架时间
*/
public void setFirstStartsTime(Date firstStartsTime) {
this.firstStartsTime = firstStartsTime;
}
/**
* 店铺id
*/
public Integer getShopId() {
return shopId;
}
/**
* 店铺id
*/
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
/**
* erp商品id
*/
public Integer getErpGoodsId() {
return erpGoodsId;
}
/**
* erp商品id
*/
public void setErpGoodsId(Integer erpGoodsId) {
this.erpGoodsId = erpGoodsId;
}
/**
* 创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
TaoGoods other = (TaoGoods) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getIid() == null ? other.getIid() == null : this.getIid().equals(other.getIid()))
&& (this.getNumIid() == null ? other.getNumIid() == null : this.getNumIid().equals(other.getNumIid()))
&& (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
&& (this.getNick() == null ? other.getNick() == null : this.getNick().equals(other.getNick()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getCid() == null ? other.getCid() == null : this.getCid().equals(other.getCid()))
&& (this.getSellerCids() == null ? other.getSellerCids() == null : this.getSellerCids().equals(other.getSellerCids()))
&& (this.getPicUrl() == null ? other.getPicUrl() == null : this.getPicUrl().equals(other.getPicUrl()))
&& (this.getNum() == null ? other.getNum() == null : this.getNum().equals(other.getNum()))
&& (this.getProps() == null ? other.getProps() == null : this.getProps().equals(other.getProps()))
&& (this.getValidThru() == null ? other.getValidThru() == null : this.getValidThru().equals(other.getValidThru()))
&& (this.getHasDiscount() == null ? other.getHasDiscount() == null : this.getHasDiscount().equals(other.getHasDiscount()))
&& (this.getHasInvoice() == null ? other.getHasInvoice() == null : this.getHasInvoice().equals(other.getHasInvoice()))
&& (this.getHasWarranty() == null ? other.getHasWarranty() == null : this.getHasWarranty().equals(other.getHasWarranty()))
&& (this.getHasShowcase() == null ? other.getHasShowcase() == null : this.getHasShowcase().equals(other.getHasShowcase()))
&& (this.getModified() == null ? other.getModified() == null : this.getModified().equals(other.getModified()))
&& (this.getDelistTime() == null ? other.getDelistTime() == null : this.getDelistTime().equals(other.getDelistTime()))
&& (this.getPostageId() == null ? other.getPostageId() == null : this.getPostageId().equals(other.getPostageId()))
&& (this.getOuterId() == null ? other.getOuterId() == null : this.getOuterId().equals(other.getOuterId()))
&& (this.getListTime() == null ? other.getListTime() == null : this.getListTime().equals(other.getListTime()))
&& (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
&& (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
&& (this.getIsEx() == null ? other.getIsEx() == null : this.getIsEx().equals(other.getIsEx()))
&& (this.getIsVirtual() == null ? other.getIsVirtual() == null : this.getIsVirtual().equals(other.getIsVirtual()))
&& (this.getIsTaobao() == null ? other.getIsTaobao() == null : this.getIsTaobao().equals(other.getIsTaobao()))
&& (this.getSoldQuantity() == null ? other.getSoldQuantity() == null : this.getSoldQuantity().equals(other.getSoldQuantity()))
&& (this.getIsCspu() == null ? other.getIsCspu() == null : this.getIsCspu().equals(other.getIsCspu()))
&& (this.getFirstStartsTime() == null ? other.getFirstStartsTime() == null : this.getFirstStartsTime().equals(other.getFirstStartsTime()))
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
&& (this.getErpGoodsId() == null ? other.getErpGoodsId() == null : this.getErpGoodsId().equals(other.getErpGoodsId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getIid() == null) ? 0 : getIid().hashCode());
result = prime * result + ((getNumIid() == null) ? 0 : getNumIid().hashCode());
result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
result = prime * result + ((getNick() == null) ? 0 : getNick().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getCid() == null) ? 0 : getCid().hashCode());
result = prime * result + ((getSellerCids() == null) ? 0 : getSellerCids().hashCode());
result = prime * result + ((getPicUrl() == null) ? 0 : getPicUrl().hashCode());
result = prime * result + ((getNum() == null) ? 0 : getNum().hashCode());
result = prime * result + ((getProps() == null) ? 0 : getProps().hashCode());
result = prime * result + ((getValidThru() == null) ? 0 : getValidThru().hashCode());
result = prime * result + ((getHasDiscount() == null) ? 0 : getHasDiscount().hashCode());
result = prime * result + ((getHasInvoice() == null) ? 0 : getHasInvoice().hashCode());
result = prime * result + ((getHasWarranty() == null) ? 0 : getHasWarranty().hashCode());
result = prime * result + ((getHasShowcase() == null) ? 0 : getHasShowcase().hashCode());
result = prime * result + ((getModified() == null) ? 0 : getModified().hashCode());
result = prime * result + ((getDelistTime() == null) ? 0 : getDelistTime().hashCode());
result = prime * result + ((getPostageId() == null) ? 0 : getPostageId().hashCode());
result = prime * result + ((getOuterId() == null) ? 0 : getOuterId().hashCode());
result = prime * result + ((getListTime() == null) ? 0 : getListTime().hashCode());
result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
result = prime * result + ((getIsEx() == null) ? 0 : getIsEx().hashCode());
result = prime * result + ((getIsVirtual() == null) ? 0 : getIsVirtual().hashCode());
result = prime * result + ((getIsTaobao() == null) ? 0 : getIsTaobao().hashCode());
result = prime * result + ((getSoldQuantity() == null) ? 0 : getSoldQuantity().hashCode());
result = prime * result + ((getIsCspu() == null) ? 0 : getIsCspu().hashCode());
result = prime * result + ((getFirstStartsTime() == null) ? 0 : getFirstStartsTime().hashCode());
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
result = prime * result + ((getErpGoodsId() == null) ? 0 : getErpGoodsId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", iid=").append(iid);
sb.append(", numIid=").append(numIid);
sb.append(", title=").append(title);
sb.append(", nick=").append(nick);
sb.append(", type=").append(type);
sb.append(", cid=").append(cid);
sb.append(", sellerCids=").append(sellerCids);
sb.append(", picUrl=").append(picUrl);
sb.append(", num=").append(num);
sb.append(", props=").append(props);
sb.append(", validThru=").append(validThru);
sb.append(", hasDiscount=").append(hasDiscount);
sb.append(", hasInvoice=").append(hasInvoice);
sb.append(", hasWarranty=").append(hasWarranty);
sb.append(", hasShowcase=").append(hasShowcase);
sb.append(", modified=").append(modified);
sb.append(", delistTime=").append(delistTime);
sb.append(", postageId=").append(postageId);
sb.append(", outerId=").append(outerId);
sb.append(", listTime=").append(listTime);
sb.append(", price=").append(price);
sb.append(", remark=").append(remark);
sb.append(", isEx=").append(isEx);
sb.append(", isVirtual=").append(isVirtual);
sb.append(", isTaobao=").append(isTaobao);
sb.append(", soldQuantity=").append(soldQuantity);
sb.append(", isCspu=").append(isCspu);
sb.append(", firstStartsTime=").append(firstStartsTime);
sb.append(", shopId=").append(shopId);
sb.append(", erpGoodsId=").append(erpGoodsId);
sb.append(", createTime=").append(createTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,18 @@
package com.qihang.tao.domain.bo;
import lombok.Data;
import java.io.Serializable;
@Data
public class TaoGoodsBo implements Serializable {
/**
* 商品数字id
*/
private Long numIid;
/**
* 商品标题
*/
private String title;
}

View File

@ -1,9 +1,18 @@
package com.qihang.tao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qihang.tao.domain.TaoGoods;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@Mapper
/**
* @author TW
* @description 针对表tao_goods的数据库操作Mapper
* @createDate 2024-02-29 09:28:38
* @Entity com.qihang.tao.domain.TaoGoods
*/
public interface TaoGoodsMapper extends BaseMapper<TaoGoods> {
}

View File

@ -0,0 +1,16 @@
package com.qihang.tao.service;
import com.qihang.tao.common.PageQuery;
import com.qihang.tao.common.PageResult;
import com.qihang.tao.domain.TaoGoods;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qihang.tao.domain.bo.TaoGoodsBo;
/**
* @author TW
* @description 针对表tao_goods的数据库操作Service
* @createDate 2024-02-29 09:28:38
*/
public interface TaoGoodsService extends IService<TaoGoods> {
PageResult<TaoGoods> queryPageList(TaoGoodsBo bo, PageQuery pageQuery);
}

View File

@ -0,0 +1,38 @@
package com.qihang.tao.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qihang.tao.common.PageQuery;
import com.qihang.tao.common.PageResult;
import com.qihang.tao.domain.TaoGoods;
import com.qihang.tao.domain.bo.TaoGoodsBo;
import com.qihang.tao.service.TaoGoodsService;
import com.qihang.tao.mapper.TaoGoodsMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
/**
* @author TW
* @description 针对表tao_goods的数据库操作Service实现
* @createDate 2024-02-29 09:28:38
*/
@AllArgsConstructor
@Service
public class TaoGoodsServiceImpl extends ServiceImpl<TaoGoodsMapper, TaoGoods>
implements TaoGoodsService {
private final TaoGoodsMapper mapper;
@Override
public PageResult<TaoGoods> queryPageList(TaoGoodsBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<TaoGoods> queryWrapper = new LambdaQueryWrapper<>();
Page<TaoGoods> taoGoodsPage = mapper.selectPage(pageQuery.build(), queryWrapper);
return PageResult.build(taoGoodsPage);
}
}

View File

@ -0,0 +1,55 @@
<?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.qihang.tao.mapper.TaoGoodsMapper">
<resultMap id="BaseResultMap" type="com.qihang.tao.domain.TaoGoods">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="iid" column="iid" jdbcType="VARCHAR"/>
<result property="numIid" column="num_iid" jdbcType="BIGINT"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="nick" column="nick" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="cid" column="cid" jdbcType="BIGINT"/>
<result property="sellerCids" column="seller_cids" jdbcType="VARCHAR"/>
<result property="picUrl" column="pic_url" jdbcType="VARCHAR"/>
<result property="num" column="num" jdbcType="INTEGER"/>
<result property="props" column="props" jdbcType="VARCHAR"/>
<result property="validThru" column="valid_thru" jdbcType="INTEGER"/>
<result property="hasDiscount" column="has_discount" jdbcType="VARCHAR"/>
<result property="hasInvoice" column="has_invoice" jdbcType="VARCHAR"/>
<result property="hasWarranty" column="has_warranty" jdbcType="VARCHAR"/>
<result property="hasShowcase" column="has_showcase" jdbcType="VARCHAR"/>
<result property="modified" column="modified" jdbcType="TIMESTAMP"/>
<result property="delistTime" column="delist_time" jdbcType="TIMESTAMP"/>
<result property="postageId" column="postage_id" jdbcType="INTEGER"/>
<result property="outerId" column="outer_id" jdbcType="VARCHAR"/>
<result property="listTime" column="list_time" jdbcType="TIMESTAMP"/>
<result property="price" column="price" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="isEx" column="is_ex" jdbcType="VARCHAR"/>
<result property="isVirtual" column="is_virtual" jdbcType="VARCHAR"/>
<result property="isTaobao" column="is_taobao" jdbcType="VARCHAR"/>
<result property="soldQuantity" column="sold_quantity" jdbcType="INTEGER"/>
<result property="isCspu" column="is_cspu" jdbcType="VARCHAR"/>
<result property="firstStartsTime" column="first_starts_time" jdbcType="TIMESTAMP"/>
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
<result property="erpGoodsId" column="erp_goods_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id,iid,num_iid,
title,nick,type,
cid,seller_cids,pic_url,
num,props,valid_thru,
has_discount,has_invoice,has_warranty,
has_showcase,modified,delist_time,
postage_id,outer_id,list_time,
price,remark,is_ex,
is_virtual,is_taobao,sold_quantity,
is_cspu,first_starts_time,shop_id,
erp_goods_id,create_time
</sql>
</mapper>

View File

@ -1,5 +0,0 @@
<?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.qihang.tao.mapper.TaoGoodsMapper">
</mapper>