Commit 2b3a4045 authored by shiyu's avatar shiyu

上传藏品

parent 37d1cf30
......@@ -2,6 +2,7 @@ package com.wwdz.ch.admin.impl;
import com.github.pagehelper.PageInfo;
import com.wwdz.ch.admin.service.SysSupplierItemService;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.entity.SupplierItemVo;
import com.wwdz.ch.core.type.PageSearchResult;
......@@ -25,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -76,6 +78,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
} else {
supplierItem.setSupplyPrice(0L);
}
supplierItem.setRebate(new BigDecimal(dto.getRebate()));
supplierItem.setImages(dto.getImages());
supplierItem.setVideos(dto.getVideos());
supplierItem.setSort(1);
......@@ -83,6 +86,8 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
supplierItem.setUpdateTime(now);
supplierItem.setIsOnSale(true);
supplierItem.setIsDeleted(false);
//平台上传商品使用系统默认账号
supplierItem.setUserId(CommConsts.SYSTEM_ACCOUNT);
long itemId = supplierItemDao.insert(supplierItem);
//竞拍商品,维护竞拍配置
if (dto.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
......@@ -152,6 +157,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
if (supplierItem.getBuyLimitNum() == -1) {
supplierItemVo.setIsLimitBuy(false);
}
supplierItemVo.setRebate(supplierItem.getRebate().toPlainString());
supplierItemVo.setSupplyPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getSupplyPrice()));
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
......@@ -206,6 +212,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
}
SupplierItem supplierItem = new SupplierItem();
EntityMapper.copyAttribute(dto, supplierItem);
supplierItem.setRebate(new BigDecimal(dto.getRebate()));
supplierItem.setDistributionPrice(PriceUtil.convertPriceFromStr(dto.getDistributionPrice()));
if (StringUtils.hasLength(dto.getSupplyPrice())) {
supplierItem.setSupplyPrice(PriceUtil.convertPriceFromStr(dto.getSupplyPrice()));
......
......@@ -38,5 +38,8 @@ public interface CommConsts {
public static final String AUCTION_LOCK_KEY_PRE = "AUCTION:OFFER:";
public static final Long SYSTEM_ACCOUNT = 8888888888L;
}
......@@ -89,6 +89,7 @@ public class DistributionEnum {
public enum DistributionTypeEnum {
FIXED_PRICE(1, "一口价"),
AUCTION(2, "竞拍"),
COLLECT(3, "藏品"),
;
private int code;
......
......@@ -106,6 +106,11 @@ public class SupplierItemVo implements Entity {
*/
private Long selledNum;
/**
* 返佣比例
*/
private String rebate;
/**
* 是否限购
*/
......@@ -137,6 +142,11 @@ public class SupplierItemVo implements Entity {
*/
private Date auctionEndTime;
/**
* 实际竞拍结束时间
*/
private Date realEndTime;
/**
* 起拍价
* 单位元 需要转为分
......@@ -150,9 +160,22 @@ public class SupplierItemVo implements Entity {
private String addExtent;
/**
* 实际竞拍结束时间
* 竞拍商品的状态
*/
private Date realEndTime;
private Integer state;
/**
* 状态
*/
private String stateName;
/**
* 用户的状态
* 出价、已领先、立即支付、竞拍结束
*/
private Integer userState;
private String userStateName;
/**
* 是否可编辑
......@@ -165,4 +188,10 @@ public class SupplierItemVo implements Entity {
*/
private String currentPrice;
/**
* 预计佣金
*/
private String rebateAmount;
}
......@@ -35,10 +35,8 @@ public class PriceUtil {
}
public static String convertDoubleToString(Double price){
BigDecimal bigDecimal = new BigDecimal(String.valueOf( price / 100));
DecimalFormat df = new DecimalFormat("#0.00");
String str = df.format(bigDecimal);
return new BigDecimal(str).stripTrailingZeros().toPlainString();
BigDecimal bigDecimal = new BigDecimal(String.valueOf( price / 100)).setScale(2,BigDecimal.ROUND_DOWN);
return bigDecimal.stripTrailingZeros().toPlainString();
}
......
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.CollectionBook;
import com.wwdz.ch.db.dto.request.distribution.CollectionBookRequestDto;
import java.util.List;
public interface CollectionBookDao {
/**
* 插入新记录
*
* @param collectionBook
* @return
*/
int insert(CollectionBook collectionBook);
/**
* 查询记录
* @param dto
* @return
*/
List<CollectionBook> find(CollectionBookRequestDto dto);
List<CollectionBook> findByUserId(long userId);
int delete(long id);
}
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.CollectionItemsRelation;
import com.wwdz.ch.db.dto.request.distribution.CollectionItemsRelationRequestDto;
import java.util.List;
public interface CollectionItemsRelationDao {
/**
* 插入新记录
*
* @param collectionItemsRelation
* @return
*/
int insert(CollectionItemsRelation collectionItemsRelation);
/**
* 查询记录
* @param dto
* @return
*/
List<CollectionItemsRelation> find(CollectionItemsRelationRequestDto dto);
/**
*
* @param itemId
* @return
*/
List<CollectionItemsRelation> findByItemId(long itemId);
boolean isExisted(long bookId, long itemId);
int delete(CollectionItemsRelationRequestDto dto);
}
......@@ -25,6 +25,14 @@ public interface DistributorShareRecordDao {
DistributorShareRecord findById(String shareId);
/**
* 查询列表
* @param dto
* @return
*/
List<DistributorShareRecord> find(DistributorShareRecordRequestDto dto);
/**
* 查询最高价格的分享记录
* @param dto
......@@ -39,4 +47,25 @@ public interface DistributorShareRecordDao {
*/
int updateDisEnabled(long itemId);
/**
* 删除分销商关于该商品的分销链接
* @param distributorId, itemId
* @return
*/
int updateDisEnabledForDistributor(long distributorId, long itemId);
/**
* 根据分销商id查询分享记录
*/
List<DistributorShareRecord> findByDistributorId(DistributorShareRecordRequestDto dto);
/**
* 查询分销商是否已经分销过该商品
* @param distributorId
* @param itemId
* @return
*
*/
DistributorShareRecord findItemShareRecordByDistributorId(long distributorId, long itemId);
}
......@@ -18,6 +18,15 @@ public interface UserRecentBrowseDao {
*/
UserRecentBrowse findByUserId(long userId);
/**
* 根据用户id查询最近浏览的记录
* @param userId, distributorId
* @return
*/
boolean isExisted(long userId, long distributorId);
/**
* 插入新记录
* @param userRecentBrowse
......
package com.wwdz.ch.db.domain.distribution;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import com.xxdxxs.entity.Entity;
import lombok.Data;
/**
* @author shiyu
* @date 2024/03/20
*/
@Data
public class CollectionBook implements Entity {
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 标题
*/
private String title;
/**
* 排序
*/
private Integer sort;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 逻辑删除
*/
private Boolean isDeleted;
private static final long serialVersionUID = 1L;
@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(", userId=").append(userId);
sb.append(", title=").append(title);
sb.append(", sort=").append(sort);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isDeleted=").append(isDeleted);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
CollectionBook other = (CollectionBook) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
&& (this.getSort() == null ? other.getSort() == null : this.getSort().equals(other.getSort()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
result = prime * result + ((getSort() == null) ? 0 : getSort().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "BIGINT", false),
userId("user_id", "userId", "BIGINT", false),
title("title", "title", "VARCHAR", false),
sort("sort", "sort", "INTEGER", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
isDeleted("is_deleted", "isDeleted", "BIT", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String BEGINNING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private static final String ENDING_DELIMITER = "`";
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String column;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final boolean isColumnNameDelimited;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String javaProperty;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private final String jdbcType;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String value() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getValue() {
return this.column;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJavaProperty() {
return this.javaProperty;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getJdbcType() {
return this.jdbcType;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
}
}
\ No newline at end of file
package com.wwdz.ch.db.domain.distribution;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
......@@ -10,7 +11,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/02/29
* @date 2024/03/20
*/
@Data
public class SupplierItem implements Entity {
......@@ -77,10 +78,20 @@ public class SupplierItem implements Entity {
private Integer buyLimitNum;
/**
* 商品类型1一口价2竞拍
* 商品类型1一口价2竞拍3用户藏品
*/
private Integer type;
/**
* 返佣比例
*/
private BigDecimal rebate;
/**
* 用户id,非用户id的为系统账号
*/
private Long userId;
/**
* 商品图片,分号分隔
*/
......@@ -118,6 +129,8 @@ public class SupplierItem implements Entity {
sb.append(", isDeleted=").append(isDeleted);
sb.append(", buyLimitNum=").append(buyLimitNum);
sb.append(", type=").append(type);
sb.append(", rebate=").append(rebate);
sb.append(", userId=").append(userId);
sb.append(", images=").append(images);
sb.append(", videos=").append(videos);
sb.append(", description=").append(description);
......@@ -152,6 +165,8 @@ public class SupplierItem implements Entity {
&& (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()))
&& (this.getBuyLimitNum() == null ? other.getBuyLimitNum() == null : this.getBuyLimitNum().equals(other.getBuyLimitNum()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getRebate() == null ? other.getRebate() == null : this.getRebate().equals(other.getRebate()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getImages() == null ? other.getImages() == null : this.getImages().equals(other.getImages()))
&& (this.getVideos() == null ? other.getVideos() == null : this.getVideos().equals(other.getVideos()))
&& (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()));
......@@ -175,6 +190,8 @@ public class SupplierItem implements Entity {
result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
result = prime * result + ((getBuyLimitNum() == null) ? 0 : getBuyLimitNum().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getRebate() == null) ? 0 : getRebate().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getImages() == null) ? 0 : getImages().hashCode());
result = prime * result + ((getVideos() == null) ? 0 : getVideos().hashCode());
result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
......@@ -203,6 +220,8 @@ public class SupplierItem implements Entity {
isDeleted("is_deleted", "isDeleted", "BIT", false),
buyLimitNum("buy_limit_num", "buyLimitNum", "INTEGER", false),
type("type", "type", "INTEGER", true),
rebate("rebate", "rebate", "DECIMAL", false),
userId("user_id", "userId", "BIGINT", false),
images("images", "images", "LONGVARCHAR", false),
videos("videos", "videos", "LONGVARCHAR", false),
description("description", "description", "LONGVARCHAR", false);
......
package com.wwdz.ch.db.domain.distribution;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
......@@ -24,7 +23,7 @@ public class UserRecentBrowse implements Entity {
/**
* 分销商id
*/
private Long distributorId;
private Long sharerId;
/**
* 创建时间
......@@ -51,7 +50,7 @@ public class UserRecentBrowse implements Entity {
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", distributorId=").append(distributorId);
sb.append(", distributorId=").append(sharerId);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", shareRecordId=").append(shareRecordId);
......@@ -74,7 +73,7 @@ public class UserRecentBrowse implements Entity {
UserRecentBrowse other = (UserRecentBrowse) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getDistributorId() == null ? other.getDistributorId() == null : this.getDistributorId().equals(other.getDistributorId()))
&& (this.getSharerId() == null ? other.getSharerId() == null : this.getSharerId().equals(other.getSharerId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getShareRecordId() == null ? other.getShareRecordId() == null : this.getShareRecordId().equals(other.getShareRecordId()));
......@@ -86,7 +85,7 @@ public class UserRecentBrowse implements Entity {
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getDistributorId() == null) ? 0 : getDistributorId().hashCode());
result = prime * result + ((getSharerId() == null) ? 0 : getSharerId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getShareRecordId() == null) ? 0 : getShareRecordId().hashCode());
......
package com.wwdz.ch.db.dto.request.distribution;
import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class CollectionBookRequestDto extends BaseRequestDto implements Entity {
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 标题
*/
private String title;
/**
* 描述
*/
private String description;
/**
* 排序
*/
private Integer sort;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 逻辑删除
*/
private Boolean isDeleted;
/**
* 收藏册图片,用;分隔
*/
private String images;
}
package com.wwdz.ch.db.dto.request.distribution;
import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class CollectionItemsRelationRequestDto extends BaseRequestDto implements Entity {
/**
* id
*/
private Long id;
/**
* 收藏册id
*/
private Long collectionBookId;
/**
* 多个收藏册id
* 分号分割
*/
private String collectionBookIds;
/**
* 用户id
*/
private Long userId;
/**
* 商品id
*/
private Long itemId;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否删除
*/
private Boolean isDeleted;
}
......@@ -5,6 +5,7 @@ import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 分销分享链接记录参数类
......@@ -27,11 +28,21 @@ public class DistributorShareRecordRequestDto extends BaseRequestDto implements
*/
private Long itemId;
/**
* 商品id集合
*/
private List<Long> itemIdList;
/**
* 分销商id
*/
private Long distributorId;
/**
* 分销商id
*/
private List<Long> distributorIdList;
/**
* 分销商店铺id
*/
......@@ -42,5 +53,10 @@ public class DistributorShareRecordRequestDto extends BaseRequestDto implements
*/
private Date createTime;
/**
* 类型
*/
private Integer type;
}
......@@ -4,6 +4,7 @@ import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
......@@ -108,6 +109,11 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
*/
private Boolean isShop;
/**
* 返佣比例
*/
private String rebate;
/**
* 商品类型1一口价2竞拍
*/
......@@ -139,4 +145,12 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
* 实际竞拍结束时间
*/
private Date realEndTime;
/**
* 收藏标签id
* 分号分割,可以是多个
*/
private String collectionBookId;
}
package com.wwdz.ch.db.impl.distribution;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.distribution.CollectionBookDao;
import com.wwdz.ch.db.domain.distribution.CollectionBook;
import com.wwdz.ch.db.domain.distribution.CollectionBookExample;
import com.wwdz.ch.db.dto.request.distribution.CollectionBookRequestDto;
import com.wwdz.ch.db.mapper.distribution.CollectionBookMapper;
import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
@Repository
public class CollectionBookDaoImpl implements CollectionBookDao {
@Autowired
CollectionBookMapper collectionBookMapper;
@Override
public int insert(CollectionBook collectionBook) {
return collectionBookMapper.insert(collectionBook);
}
@Override
public List<CollectionBook> find(CollectionBookRequestDto dto) {
CollectionBookExample example = new CollectionBookExample();
CollectionBookExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
criteria.andIsDeletedEqualTo(false);
example.setOrderByClause("update_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return collectionBookMapper.selectByExample(example);
}
@Override
public List<CollectionBook> findByUserId(long userId) {
CollectionBookExample example = new CollectionBookExample();
CollectionBookExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
criteria.andIsDeletedEqualTo(false);
example.setOrderByClause("update_time desc");
return collectionBookMapper.selectByExample(example);
}
@Override
public int delete(long id) {
CollectionBook collectionBook = new CollectionBook();
collectionBook.setUpdateTime(new Date());
collectionBook.setIsDeleted(true);
collectionBook.setId(id);
return collectionBookMapper.updateByPrimaryKeySelective(collectionBook);
}
}
package com.wwdz.ch.db.impl.distribution;
import com.wwdz.ch.db.dao.distribution.CollectionItemsRelationDao;
import com.wwdz.ch.db.domain.distribution.CollectionItemsRelation;
import com.wwdz.ch.db.domain.distribution.CollectionItemsRelationExample;
import com.wwdz.ch.db.dto.request.distribution.CollectionItemsRelationRequestDto;
import com.wwdz.ch.db.mapper.distribution.CollectionItemsRelationMapper;
import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class CollectionItemsRelationDaoImpl implements CollectionItemsRelationDao {
@Autowired
CollectionItemsRelationMapper collectionItemsRelationMapper;
@Override
public int insert(CollectionItemsRelation collectionItemsRelation) {
return collectionItemsRelationMapper.insert(collectionItemsRelation);
}
@Override
public List<CollectionItemsRelation> find(CollectionItemsRelationRequestDto dto) {
CollectionItemsRelationExample example = new CollectionItemsRelationExample();
CollectionItemsRelationExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getCollectionBookId(), criteria::andCollectionBookIdEqualTo);
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
return collectionItemsRelationMapper.selectByExample(example);
}
@Override
public List<CollectionItemsRelation> findByItemId(long itemId) {
CollectionItemsRelationExample example = new CollectionItemsRelationExample();
CollectionItemsRelationExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
return collectionItemsRelationMapper.selectByExample(example);
}
@Override
public boolean isExisted(long bookId, long itemId) {
CollectionItemsRelationExample example = new CollectionItemsRelationExample();
CollectionItemsRelationExample.Criteria criteria = example.createCriteria();
criteria.andCollectionBookIdEqualTo(bookId);
criteria.andItemIdEqualTo(itemId);
return collectionItemsRelationMapper.countByExample(example) > 0;
}
@Override
public int delete(CollectionItemsRelationRequestDto dto) {
CollectionItemsRelationExample example = new CollectionItemsRelationExample();
CollectionItemsRelationExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getCollectionBookId(), criteria::andCollectionBookIdEqualTo);
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
CollectionItemsRelation collectionItemsRelation = new CollectionItemsRelation();
collectionItemsRelation.setIsDeleted(true);
return collectionItemsRelationMapper.updateByExampleSelective(collectionItemsRelation, example);
}
}
package com.wwdz.ch.db.impl.distribution;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.distribution.DistributorShareRecordDao;
import com.wwdz.ch.db.domain.distribution.DistributorShareRecord;
import com.wwdz.ch.db.domain.distribution.DistributorShareRecordExample;
import com.wwdz.ch.db.dto.request.distribution.DistributorShareRecordRequestDto;
import com.wwdz.ch.db.mapper.distribution.DistributorShareRecordMapper;
import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.Date;
......@@ -29,6 +31,16 @@ public class DistributorShareRecordDaoImpl implements DistributorShareRecordDao
return distributorShareRecordMapper.selectOneByExample(distributorShareRecordExample);
}
@Override
public List<DistributorShareRecord> find(DistributorShareRecordRequestDto dto) {
DistributorShareRecordExample example = new DistributorShareRecordExample();
DistributorShareRecordExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getDistributorIdList(), criteria::andDistributorIdIn);
JdbcHelper.ifPresent(dto.getItemIdList(), criteria::andItemIdIn);
criteria.andEnabledEqualTo(true);
return distributorShareRecordMapper.selectByExample(example);
}
@Override
public List<DistributorShareRecord> findMaxPriceRecord(DistributorShareRecordRequestDto dto) {
List<DistributorShareRecord> distributorShareRecords = distributorShareRecordMapper.findMaxPriceRecord(dto.getDistributorId());
......@@ -44,4 +56,39 @@ public class DistributorShareRecordDaoImpl implements DistributorShareRecordDao
distributorShareRecord.setEnabled(false);
return distributorShareRecordMapper.updateByExampleSelective(distributorShareRecord, distributorShareRecordExample);
}
@Override
public int updateDisEnabledForDistributor(long distributorId, long itemId) {
DistributorShareRecordExample distributorShareRecordExample = new DistributorShareRecordExample();
DistributorShareRecordExample.Criteria criteria = distributorShareRecordExample.createCriteria();
criteria.andDistributorIdEqualTo(distributorId);
criteria.andItemIdEqualTo(itemId);
DistributorShareRecord distributorShareRecord = new DistributorShareRecord();
distributorShareRecord.setEnabled(false);
return distributorShareRecordMapper.updateByExampleSelective(distributorShareRecord, distributorShareRecordExample);
}
@Override
public List<DistributorShareRecord> findByDistributorId(DistributorShareRecordRequestDto dto) {
DistributorShareRecordExample distributorShareRecordExample = new DistributorShareRecordExample();
DistributorShareRecordExample.Criteria criteria = distributorShareRecordExample.createCriteria();
criteria.andDistributorIdEqualTo(dto.getDistributorId());
criteria.andEnabledEqualTo(true);
criteria.andTypeEqualTo(dto.getType());
distributorShareRecordExample.setOrderByClause(" create_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return distributorShareRecordMapper.selectByExample(distributorShareRecordExample);
}
@Override
public DistributorShareRecord findItemShareRecordByDistributorId(long distributorId, long itemId) {
DistributorShareRecordExample example = new DistributorShareRecordExample();
DistributorShareRecordExample.Criteria criteria = example.createCriteria();
criteria.andDistributorIdEqualTo(distributorId);
criteria.andItemIdEqualTo(itemId);
criteria.andEnabledEqualTo(true);
return distributorShareRecordMapper.selectOneByExample(example);
}
}
......@@ -30,6 +30,15 @@ public class UserRecentBrowseDaoImpl implements UserRecentBrowseDao {
return userRecentBrowseMapper.selectOneByExample(example);
}
@Override
public boolean isExisted(long userId, long distributorId) {
UserRecentBrowseExample example = new UserRecentBrowseExample();
UserRecentBrowseExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
criteria.andDistributorIdEqualTo(distributorId);
return userRecentBrowseMapper.countByExample(example) > 0;
}
@Override
public int insert(UserRecentBrowse userRecentBrowse) {
return userRecentBrowseMapper.insert(userRecentBrowse);
......
package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.CollectionBook;
import com.wwdz.ch.db.domain.distribution.CollectionBookExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface CollectionBookMapper {
long countByExample(CollectionBookExample example);
int deleteByExample(CollectionBookExample example);
int deleteByPrimaryKey(Long id);
int insert(CollectionBook record);
int insertSelective(CollectionBook record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
CollectionBook selectOneByExample(CollectionBookExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
CollectionBook selectOneByExampleSelective(@Param("example") CollectionBookExample example, @Param("selective") CollectionBook.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<CollectionBook> selectByExampleSelective(@Param("example") CollectionBookExample example, @Param("selective") CollectionBook.Column ... selective);
List<CollectionBook> selectByExample(CollectionBookExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_book
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
CollectionBook selectByPrimaryKeySelective(@Param("id") Long id, @Param("selective") CollectionBook.Column ... selective);
CollectionBook selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") CollectionBook record, @Param("example") CollectionBookExample example);
int updateByExample(@Param("record") CollectionBook record, @Param("example") CollectionBookExample example);
int updateByPrimaryKeySelective(CollectionBook record);
int updateByPrimaryKey(CollectionBook record);
}
\ No newline at end of file
package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.CollectionItemsRelation;
import com.wwdz.ch.db.domain.distribution.CollectionItemsRelationExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface CollectionItemsRelationMapper {
long countByExample(CollectionItemsRelationExample example);
int deleteByExample(CollectionItemsRelationExample example);
int deleteByPrimaryKey(Long id);
int insert(CollectionItemsRelation record);
int insertSelective(CollectionItemsRelation record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
CollectionItemsRelation selectOneByExample(CollectionItemsRelationExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
CollectionItemsRelation selectOneByExampleSelective(@Param("example") CollectionItemsRelationExample example, @Param("selective") CollectionItemsRelation.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<CollectionItemsRelation> selectByExampleSelective(@Param("example") CollectionItemsRelationExample example, @Param("selective") CollectionItemsRelation.Column ... selective);
List<CollectionItemsRelation> selectByExample(CollectionItemsRelationExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table collection_items_relation
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
CollectionItemsRelation selectByPrimaryKeySelective(@Param("id") Long id, @Param("selective") CollectionItemsRelation.Column ... selective);
CollectionItemsRelation selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") CollectionItemsRelation record, @Param("example") CollectionItemsRelationExample example);
int updateByExample(@Param("record") CollectionItemsRelation record, @Param("example") CollectionItemsRelationExample example);
int updateByPrimaryKeySelective(CollectionItemsRelation record);
int updateByPrimaryKey(CollectionItemsRelation record);
}
\ No newline at end of file
......@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/>
<table tableName="auction_config" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<table tableName="collection_items_relation" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table>
......
......@@ -37,7 +37,11 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.wwdz.mall</groupId>
<artifactId>notify-api</artifactId>
<version>1.9.5-RELEASE</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
......
......@@ -45,7 +45,7 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
"/wx/returnOrder/**", "/wx/distributionOrder/confirmSigned", "/wx/distributionOrder/delivery", "/wx/distributionOrder/cancel",
"/wx/distributionOrder/refund",
"/wx/supplierItem/findItemsOfCurrentDistributor"
// , "/wx/supplierItem/**", "/wx/shareRecord/**", "/wx/distributionOrder/**", "/wx/selfPage/**", "/wx/auctionRecord/**"
, "/wx/supplierItem/**", "/wx/shareRecord/**", "/wx/distributionOrder/**", "/wx/selfPage/**", "/wx/auctionRecord/**", "/wx/shareRecord"
/* "/wx/officialAccount/**",
"/wx/item/**",
"/wx/aiAssistant/**",
......
package com.wwdz.ch.wx.entity.vo.distribution;
import com.xxdxxs.entity.Entity;
import lombok.Data;
@Data
public class CollectionBookVo implements Entity {
}
package com.wwdz.ch.wx.entity.vo.distribution;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.Map;
@Data
public class DistributorShareRecordVo implements Entity {
/**
* 分享记录id
*/
private String shareId;
/**
* 商品id
*/
private Long itemId;
/**
* 商品名称
*/
private String itemName;
/**
* 商品定价,要除以100
*/
private String distributionPrice;
/**
* 用于列表展示的图片对象
*/
private Map<String, Object> homePageImage;
/**
* 分销商id
*/
private Long distributorId;
/**
* 分销商店铺id
*/
private Long shopId;
/**
* 创建时间
*/
private Date createTime;
/**
* 是否有效
*/
private Boolean enabled;
/**
* 分享类型1一口价2竞拍
*/
private Integer type;
/**
* 预计佣金
*/
private String rebateAmount;
}
......@@ -913,7 +913,6 @@ public class ItemServiceImpl implements ItemService {
userCollectBrowseNumDao.update(userCollectBrowseNum);
}
}
// 发送收藏消息
sendMessage(item.getId(), dto.getUserId(), MessageEnum.TypeEnum.COLLECT.getCode(), MessageEnum.ContentIdTypeEnum.ITEM.getCode());
......
package com.wwdz.ch.wx.service.distribution;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.CollectionBookRequestDto;
public interface CollectionBookService {
/**
* 新增收藏册
* @param dto
* @return
*/
Result create(CollectionBookRequestDto dto);
/**
* 查询收藏册
* @param dto
* @return
*/
Result findList(CollectionBookRequestDto dto);
/**
* 删除收藏册
* @param dto
* @return
*/
Result delete(CollectionBookRequestDto dto);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment