Commit 37d1cf30 authored by shiyu's avatar shiyu

Merge branch 'quanku_v1.9'

parents 70f5aa27 025bd5ad
...@@ -119,6 +119,7 @@ public class ShiroConfig { ...@@ -119,6 +119,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/admin/sysIMRecord/**", "anon"); filterChainDefinitionMap.put("/admin/sysIMRecord/**", "anon");
filterChainDefinitionMap.put("/admin/consignSaleManage/**", "anon"); filterChainDefinitionMap.put("/admin/consignSaleManage/**", "anon");
filterChainDefinitionMap.put("/admin/returnOrderManage/**", "anon"); filterChainDefinitionMap.put("/admin/returnOrderManage/**", "anon");
filterChainDefinitionMap.put("/admin/supplierItem/**", "anon");
filterChainDefinitionMap.put("/admin/invitationCode/**", "anon"); filterChainDefinitionMap.put("/admin/invitationCode/**", "anon");
// filterChainDefinitionMap.put("/admin/**", "anon"); // filterChainDefinitionMap.put("/admin/**", "anon");
......
package com.wwdz.ch.admin.controller;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.admin.service.SysIMService;
import com.wwdz.ch.admin.service.SysSupplierItemService;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.xxdxxs.service.FormHandler;
import com.xxdxxs.validation.Validator;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/admin/supplierItem")
public class SysSupplierItemController {
private static final Logger logger = LoggerFactory.getLogger(SysSupplierItemController.class);
@Autowired
SysSupplierItemService sysSupplierItemService;
@ApiOperation(value = "新增商品")
@PostMapping("/create")
public Result create(@RequestBody SupplierItemRequestDto dto) {
logger.info("新增商品,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("name", "商品名称").must().string()
.set("distributionPrice", "商品供货价").must().string()
.set("type", "商品类型").must().number()
.set("buyLimitNum", "限购数量").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return sysSupplierItemService.create(dto);
}
@ApiOperation(value = "编辑商品")
@PostMapping("/update")
public Result update(@RequestBody SupplierItemRequestDto dto) {
logger.info("编辑商品,请求参数:{}", JSON.toJSONString(dto));
if (dto.getId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return sysSupplierItemService.update(dto);
}
@ApiOperation(value = "查询商品列表")
@PostMapping("/findList")
public Result findList(@RequestBody SupplierItemRequestDto dto) {
logger.info("查询商品列表,请求参数:{}", JSON.toJSONString(dto));
return sysSupplierItemService.findList(dto);
}
@ApiOperation(value = "查询商品详情")
@PostMapping("/findDetail")
public Result findDetail(@RequestBody SupplierItemRequestDto dto) {
logger.info("查询商品详情,请求参数:{}", JSON.toJSONString(dto));
if (dto.getId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return sysSupplierItemService.findDetail(dto);
}
@ApiOperation(value = "商品上下架")
@PostMapping("/updateOnSale")
public Result updateOnSale(@RequestBody SupplierItemRequestDto dto) {
logger.info("商品上下架,请求参数:{}", JSON.toJSONString(dto));
if (dto.getId() == null || dto.getIsOnSale() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return sysSupplierItemService.updateOnSale(dto);
}
@ApiOperation(value = "删除商品")
@PostMapping("/delete")
public Result delete(@RequestBody SupplierItemRequestDto dto) {
logger.info("删除商品,请求参数:{}", JSON.toJSONString(dto));
if (dto.getId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return sysSupplierItemService.delete(dto);
}
}
package com.wwdz.ch.admin.impl;
import com.github.pagehelper.PageInfo;
import com.wwdz.ch.admin.service.SysSupplierItemService;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.entity.SupplierItemVo;
import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.MediaUtil;
import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.db.dao.SwitchDao;
import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.domain.distribution.*;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.EntityMapper;
import com.xxdxxs.utils.StringUtils;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class SysSupplierItemServiceImpl implements SysSupplierItemService {
private static final Logger logger = LoggerFactory.getLogger(SysSupplierItemServiceImpl.class);
@Autowired
SupplierItemDao supplierItemDao;
@Autowired
DistributorShareRecordDao distributorShareRecordDao;
@Autowired
DistributionOrderDao distributionOrderDao;
@Autowired
RedissonClient redissonClient;
@Autowired
DistributorBindDao distributorBindDao;
@Autowired
UserRecentBrowseDao userRecentBrowseDao;
@Autowired
private SwitchDao switchDao;
@Autowired
AuctionConfigDao auctionConfigDao;
@Autowired
AuctionRecordDao auctionRecordDao;
@Override
@Transactional
public Result create(SupplierItemRequestDto dto) {
try {
Date now = new Date();
//商品表中新增数据
SupplierItem supplierItem = new SupplierItem();
EntityMapper.copyAttribute(dto, supplierItem);
supplierItem.setDistributionPrice(PriceUtil.convertPriceFromStr(StringUtils.isEmpty(dto.getDistributionPrice())?"0":dto.getDistributionPrice()));
if (StringUtils.hasLength(dto.getSupplyPrice())) {
supplierItem.setSupplyPrice(PriceUtil.convertPriceFromStr(dto.getSupplyPrice()));
} else {
supplierItem.setSupplyPrice(0L);
}
supplierItem.setImages(dto.getImages());
supplierItem.setVideos(dto.getVideos());
supplierItem.setSort(1);
supplierItem.setCreateTime(now);
supplierItem.setUpdateTime(now);
supplierItem.setIsOnSale(true);
supplierItem.setIsDeleted(false);
long itemId = supplierItemDao.insert(supplierItem);
//竞拍商品,维护竞拍配置
if (dto.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setItemId(itemId);
auctionConfig.setIsValid(true);
auctionConfig.setIsDeal(false);
auctionConfig.setStartTime(DateUtils.parseString(dto.getAuctionStartTime()));
auctionConfig.setEndTime(DateUtils.parseString(dto.getAuctionEndTime()));
auctionConfig.setRealEndTime(DateUtils.parseString(dto.getAuctionEndTime()));
auctionConfig.setStartPrice(PriceUtil.convertPriceFromStr(dto.getStartPrice()));
auctionConfig.setAddExtent(PriceUtil.convertPriceFromStr(dto.getAddExtent()));
auctionConfig.setCreateTime(now);
auctionConfig.setUpdateTime(now);
auctionConfigDao.insert(auctionConfig);
}
return Result.success();
} catch (Exception e) {
logger.error("新增商品失败 error : {}", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return Result.failed();
}
@Override
public Result findList(SupplierItemRequestDto dto) {
try {
List<SupplierItemVo> supplierItemVos = new ArrayList<>();
dto.setIsDeleted(false);
List<SupplierItem> supplierItemList = supplierItemDao.findList(dto);
PageInfo<SupplierItem> pageInfo = new PageInfo(supplierItemList);
supplierItemList.forEach(supplierItem -> {
SupplierItemVo supplierItemVo = new SupplierItemVo();
EntityMapper.copyAttribute(supplierItem, supplierItemVo);
supplierItemVo.setSupplyPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getSupplyPrice()));
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
if (supplierItem.getBuyLimitNum() == -1) {
supplierItemVo.setIsLimitBuy(false);
}
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(supplierItem.getId());
if (auctionConfig != null && auctionConfig.getIsValid()) {
supplierItemVo.setEditAble(false);
} else {
supplierItemVo.setEditAble(true);
}
supplierItemVos.add(supplierItemVo);
//售出数量
Long selledNum = distributionOrderDao.countSelledNum(supplierItem.getId());
supplierItemVo.setSelledNum(selledNum == null ? 0 : selledNum);
});
return Result.success(PageSearchResult.of(pageInfo, supplierItemVos));
} catch (Exception e) {
logger.error("商品列表查询失败 error : {}", e);
}
return Result.failed();
}
@Override
public Result findDetail(SupplierItemRequestDto dto) {
try {
SupplierItemVo supplierItemVo = new SupplierItemVo();
long itemId = dto.getId();
SupplierItem supplierItem = supplierItemDao.findById(itemId);
EntityMapper.copyAttribute(supplierItem, supplierItemVo);
supplierItemVo.setItemId(supplierItem.getId());
if (supplierItem.getBuyLimitNum() == -1) {
supplierItemVo.setIsLimitBuy(false);
}
supplierItemVo.setSupplyPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getSupplyPrice()));
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
//拍卖品需要查询拍卖配置信息
if (supplierItem.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(itemId);
supplierItemVo.setAuctionStartTime(auctionConfig.getStartTime());
supplierItemVo.setAuctionEndTime(auctionConfig.getEndTime());
supplierItemVo.setStartPrice(PriceUtil.convertPriceFenToYuan(auctionConfig.getStartPrice()));
supplierItemVo.setAddExtent(PriceUtil.convertPriceFenToYuan(auctionConfig.getAddExtent()));
}
return Result.success(supplierItemVo);
} catch (Exception e) {
logger.error("商品详情查询失败 error : {}", e);
}
return Result.failed();
}
@Override
@Transactional
public Result update(SupplierItemRequestDto dto) {
try {
//如果价格有改动,需要把分享的链接改为无效,先查询原来商品这使得价格
SupplierItem oldSupplierItem = supplierItemDao.findById(dto.getId());
//竞拍商品,维护竞拍配置
if (dto.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
//判断有无出价记录,有出价记录的竞拍商品不能修改或上架
AuctionRecordRequestDto auctionRecordRequestDto = new AuctionRecordRequestDto();
auctionRecordRequestDto.setItemId(dto.getId());
long count = auctionRecordDao.count(auctionRecordRequestDto);
if (count > 0) {
return Result.failed("有出价的竞拍商品不能再次编辑");
}
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(dto.getId());
auctionConfig.setStartTime(DateUtils.parseString(dto.getAuctionStartTime()));
auctionConfig.setEndTime(DateUtils.parseString(dto.getAuctionEndTime()));
auctionConfig.setRealEndTime(DateUtils.parseString(dto.getAuctionEndTime()));
auctionConfig.setStartPrice(PriceUtil.convertPriceFromStr(dto.getStartPrice()));
auctionConfig.setAddExtent(PriceUtil.convertPriceFromStr(dto.getAddExtent()));
//修改的截拍时间在当前时间之后,则重新上架,设置拍卖信息为有效
if (DateUtils.parseString(dto.getAuctionEndTime()).after(new Date())) {
auctionConfig.setIsValid(true);
auctionConfig.setIsDeal(false);
}
auctionConfigDao.update(auctionConfig);
}
long oldDistributionPrice = oldSupplierItem.getDistributionPrice();
if (oldDistributionPrice != PriceUtil.convertPriceFromStr(dto.getDistributionPrice())) {
//把该商品所关联的所有分享链接都改为无效
distributorShareRecordDao.updateDisEnabled(dto.getId());
logger.info("商品 id:{} 更改价格,分享链接改为无效", dto.getId());
}
SupplierItem supplierItem = new SupplierItem();
EntityMapper.copyAttribute(dto, supplierItem);
supplierItem.setDistributionPrice(PriceUtil.convertPriceFromStr(dto.getDistributionPrice()));
if (StringUtils.hasLength(dto.getSupplyPrice())) {
supplierItem.setSupplyPrice(PriceUtil.convertPriceFromStr(dto.getSupplyPrice()));
}
supplierItem.setImages(dto.getImages());
supplierItem.setVideos(dto.getVideos());
supplierItemDao.update(supplierItem);
return Result.success();
} catch (Exception e) {
logger.error("编辑商品失败 error : {}", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return Result.failed();
}
@Override
public Result updateOnSale(SupplierItemRequestDto dto) {
try {
SupplierItem oldItem = supplierItemDao.findById(dto.getId());
//下架的是竞拍品需要把拍卖配置信息改为无效
if (oldItem.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
if (!dto.getIsOnSale()) {
auctionConfigDao.setEnd(dto.getId());
} else {
//判断有无出价记录,有出价记录的竞拍商品不能修改或上架
AuctionRecordRequestDto auctionRecordRequestDto = new AuctionRecordRequestDto();
auctionRecordRequestDto.setItemId(dto.getId());
long count = auctionRecordDao.count(auctionRecordRequestDto);
if (count > 0) {
return Result.failed("有出价的竞拍商品不能重新上架");
}
auctionConfigDao.setValid(dto.getId());
}
}
SupplierItem supplierItem = new SupplierItem();
supplierItem.setId(dto.getId());
supplierItem.setIsOnSale(dto.getIsOnSale());
supplierItemDao.update(supplierItem);
return Result.success();
} catch (Exception e) {
logger.error("商品上下架失败 error : {}", e);
}
return Result.failed();
}
@Override
public Result delete(SupplierItemRequestDto dto) {
try {
SupplierItem oldItem = supplierItemDao.findById(dto.getId());
if (oldItem.getIsOnSale()) {
return Result.failed("先下架商品");
}
SupplierItem supplierItem = new SupplierItem();
supplierItem.setId(dto.getId());
supplierItem.setIsDeleted(true);
supplierItemDao.update(supplierItem);
return Result.success();
} catch (Exception e) {
logger.error("商品删除失败 error : {}", e);
}
return Result.failed();
}
}
...@@ -67,7 +67,7 @@ public class SynItemToEsJob { ...@@ -67,7 +67,7 @@ public class SynItemToEsJob {
/** /**
* 隔2分钟运行一次 * 隔2分钟运行一次
*/ */
@Scheduled(fixedDelay = 1000 * 60 * 2) // @Scheduled(fixedDelay = 1000 * 60 * 2)
public void execute() { public void execute() {
RLock lock = redissonClient.getLock(QUANKU_SYN_TO_ES_TASK_KEY); RLock lock = redissonClient.getLock(QUANKU_SYN_TO_ES_TASK_KEY);
if (!lock.tryLock()) { if (!lock.tryLock()) {
......
package com.wwdz.ch.admin.service;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
public interface SysSupplierItemService {
/**
* 新增商品
* @param dto
* @return
*/
Result create(SupplierItemRequestDto dto);
/**
* 查询供应商商品列表
* @param dto
* @return
*/
Result findList(SupplierItemRequestDto dto);
/**
* 查询供应商商品详情
* @param dto
* @return
*/
Result findDetail(SupplierItemRequestDto dto);
/**
* 编辑更新
* @param dto
* @return
*/
Result update(SupplierItemRequestDto dto);
/**
* 上下架
* @param dto
* @return
*/
Result updateOnSale(SupplierItemRequestDto dto);
/**
* 删除商品
* @param dto
* @return
*/
Result delete(SupplierItemRequestDto dto);
}
package com.wwdz.ch.core.api; package com.wwdz.ch.core.api;
import com.wwdz.ch.core.entity.AbstractSubscribeMsg;
import com.wwdz.ch.core.entity.ConsignSaleSubscribeMsg; import com.wwdz.ch.core.entity.ConsignSaleSubscribeMsg;
import com.wwdz.ch.core.util.OkHttpUtil; import com.wwdz.ch.core.util.OkHttpUtil;
import com.wwdz.ch.core.util.RedisUtils; import com.wwdz.ch.core.util.RedisUtils;
...@@ -23,7 +22,6 @@ public class OfficialAccountApi { ...@@ -23,7 +22,6 @@ public class OfficialAccountApi {
private static final Logger logger = LoggerFactory.getLogger(OfficialAccountApi.class); private static final Logger logger = LoggerFactory.getLogger(OfficialAccountApi.class);
private final static String GET_USER_BASE_INFO_URL = "https://api.weixin.qq.com/cgi-bin/user/info?lang=zh_CN"; private final static String GET_USER_BASE_INFO_URL = "https://api.weixin.qq.com/cgi-bin/user/info?lang=zh_CN";
private final static String SEND_MSG_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send"; private final static String SEND_MSG_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send";
......
...@@ -305,4 +305,29 @@ public class WxPayServiceApi { ...@@ -305,4 +305,29 @@ public class WxPayServiceApi {
return Result.failed(); return Result.failed();
} }
/**
* 微信支付关闭订单
* @param dto
* @return
*/
public Result closeOrder(DistributionOrderRequestDto dto){
try {
//请求微信支付相关配置
JsapiServiceExtension service = new JsapiServiceExtension.Builder()
.config(rsaAutoCertificateConfig)
.signType("RSA") // 不填默认为RSA
.build();
CloseOrderRequest request = new CloseOrderRequest();
request.setOutTradeNo(dto.getDistributionOrderId());
request.setMchid(wxPayProperties.getMerchantId());
service.closeOrder(request);
return Result.success();
}catch (Exception e){
logger.error("微信支付关闭订单错误error : {}", e);
}
return Result.failed();
}
} }
...@@ -32,6 +32,11 @@ public interface CommConsts { ...@@ -32,6 +32,11 @@ public interface CommConsts {
*/ */
public static final String UPLOAD_PRE_WXACODE_DIRECTORY = "quanku/wxacode/"; public static final String UPLOAD_PRE_WXACODE_DIRECTORY = "quanku/wxacode/";
/**
* 拍卖出价的锁
*/
public static final String AUCTION_LOCK_KEY_PRE = "AUCTION:OFFER:";
} }
...@@ -82,4 +82,118 @@ public class DistributionEnum { ...@@ -82,4 +82,118 @@ public class DistributionEnum {
} }
/**
* 分销类型
*/
public enum DistributionTypeEnum {
FIXED_PRICE(1, "一口价"),
AUCTION(2, "竞拍"),
;
private int code;
private String des;
DistributionTypeEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (DistributionTypeEnum distributionTypeEnum : DistributionTypeEnum.values()) {
if (code == distributionTypeEnum.getCode()) {
return distributionTypeEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
/**
* 竞拍状态
*/
public enum AuctionStateEnum {
NOT_START(1, "未开拍"),
IN_AUCTION(2, "拍卖中"),
END(3, "已截拍")
;
private int code;
private String des;
AuctionStateEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (AuctionStateEnum auctionStateEnum : AuctionStateEnum.values()) {
if (code == auctionStateEnum.getCode()) {
return auctionStateEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
/**
* 竞拍状态
*/
public enum AuctionUserStateEnum {
PROCESS(1, "出价"),
LEAD(2, "已领先"),
PRE_PAY(3, "立即支付"),
END(4, "竞拍结束")
;
private int code;
private String des;
AuctionUserStateEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (AuctionUserStateEnum auctionUserStateEnum : AuctionUserStateEnum.values()) {
if (code == auctionUserStateEnum.getCode()) {
return auctionUserStateEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
} }
package com.wwdz.ch.wx.entity.vo.distribution; package com.wwdz.ch.core.entity;
import com.wwdz.ch.core.util.PriceUtil; import com.wwdz.ch.core.util.PriceUtil;
import com.xxdxxs.entity.Entity; import com.xxdxxs.entity.Entity;
...@@ -101,8 +101,68 @@ public class SupplierItemVo implements Entity { ...@@ -101,8 +101,68 @@ public class SupplierItemVo implements Entity {
*/ */
private String shareId; private String shareId;
/**
* 商品售出的数量
*/
private Long selledNum;
/**
* 是否限购
*/
private Boolean isLimitBuy = true;
/**
* 限购数量
*/
private Integer buyLimitNum;
/**
* 商品类型1一口价2竞拍
*/
private Integer type;
/** /**
* 分销商是否购买过 * 分销商是否购买过
*/ */
private Boolean shopBought; private Boolean shopBought;
/**
* 竞拍开始时间
*/
private Date auctionStartTime;
/**
* 竞拍结束时间
*/
private Date auctionEndTime;
/**
* 起拍价
* 单位元 需要转为分
*/
private String startPrice;
/**
* 加价幅度
* 单位元 需要转为分
*/
private String addExtent;
/**
* 实际竞拍结束时间
*/
private Date realEndTime;
/**
* 是否可编辑
*/
private Boolean editAble;
/**
* 针对竞拍品
* 最新价格
*/
private String currentPrice;
} }
package com.wwdz.ch.core.notify; package com.wwdz.ch.core.notify;
import com.aliyun.dysmsapi20170525.models.SendSmsResponse; import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.CacheUtil;
import com.wwdz.ch.db.domain.User;
import com.xxdxxs.utils.JsonUtils; import com.xxdxxs.utils.JsonUtils;
import com.xxdxxs.utils.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import okhttp3.Cache;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -29,6 +35,9 @@ public class AliSmsSender implements SmsSender { ...@@ -29,6 +35,9 @@ public class AliSmsSender implements SmsSender {
@Value("${dts.notify.alisms.templateCode}") @Value("${dts.notify.alisms.templateCode}")
private String templateCode; private String templateCode;
@Autowired
CacheUtil cacheUtil;
//短信API产品名称(短信产品名固定,无需修改) //短信API产品名称(短信产品名固定,无需修改)
final String product = "Dysmsapi"; final String product = "Dysmsapi";
...@@ -82,4 +91,42 @@ public class AliSmsSender implements SmsSender { ...@@ -82,4 +91,42 @@ public class AliSmsSender implements SmsSender {
} }
} }
public Result sendAuctionWithTemplate(long userId, String msg) {
try {
User user = cacheUtil.getAppletUsers(userId);
if (user == null) {
logger.error("======== userId:{},用户信息为空不能发送短信 ========", userId);
return Result.failed("用户信息为空");
}
String phone = user.getMobile();
if (StringUtils.isEmpty(phone)) {
logger.error("======== userId:{},手机号为空不能发送短信 ========", userId);
return Result.failed("手机号为空");
}
Map<String, Object> map = new HashMap<>();
map.put("msg", msg);
logger.info("拍卖通知发送内容 : {} ", msg);
com.aliyun.dysmsapi20170525.Client client = createClient();
com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest()
.setPhoneNumbers(phone)
.setTemplateCode(templateCode)
.setTemplateParam(JsonUtils.fromMap(map))
.setSignName("玩物得志");
SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, new com.aliyun.teautil.models.RuntimeOptions());
logger.info("拍卖通知发送结果 : {} ", JsonUtils.from(sendSmsResponse));
if ("OK".equals(sendSmsResponse.getBody().code)) {
return Result.success();
}
} catch (Exception e) {
logger.error("AliSmsSender.sendWithTemplate(),userId={}, error:{}",userId, e);
}
return Result.failed();
}
public static void main(String[] args) {
}
} }
...@@ -164,6 +164,20 @@ public class CacheUtil { ...@@ -164,6 +164,20 @@ public class CacheUtil {
return map.get(key); return map.get(key);
}*/ }*/
/**
* 查询小程序用户手机号
*
* @return
*/
public String getAppletUserPhoneList(long key) {
User user = dtsUserDao.findById(key);
return user.getMobile();
/* List<User> userList = dtsUserDao.findAll();
Map<Long, String> map = userList.stream().collect(Collectors.toMap(User::getId, User::getNickname, (k1, k2) -> k2));
return map.get(key);*/
}
/** /**
* 查询小程序会员 * 查询小程序会员
......
...@@ -26,6 +26,8 @@ public class PriceUtil { ...@@ -26,6 +26,8 @@ public class PriceUtil {
return bigDecimal.longValue(); return bigDecimal.longValue();
} }
public static Integer convertPriceFromStrToInt(String price){ public static Integer convertPriceFromStrToInt(String price){
BigDecimal bigDecimal = new BigDecimal(price); BigDecimal bigDecimal = new BigDecimal(price);
bigDecimal = bigDecimal.multiply(new BigDecimal(100)); bigDecimal = bigDecimal.multiply(new BigDecimal(100));
...@@ -53,6 +55,9 @@ public class PriceUtil { ...@@ -53,6 +55,9 @@ public class PriceUtil {
DecimalFormat df = new DecimalFormat("#0.00"); DecimalFormat df = new DecimalFormat("#0.00");
String a = df.format(bigDecimal); String a = df.format(bigDecimal);
System.out.println(new BigDecimal(a).stripTrailingZeros().toPlainString()); System.out.println(new BigDecimal(a).stripTrailingZeros().toPlainString());
System.out.println("+++++++" + convertPriceFromStr("0"));
} }
......
...@@ -6,6 +6,10 @@ import org.springframework.util.StringUtils; ...@@ -6,6 +6,10 @@ import org.springframework.util.StringUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.IntStream; import java.util.stream.IntStream;
public class StringUtil { public class StringUtil {
...@@ -43,5 +47,9 @@ public class StringUtil { ...@@ -43,5 +47,9 @@ public class StringUtil {
return numberArray; return numberArray;
} }
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Map<Object,Boolean> seen = new ConcurrentHashMap<>();
return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
}
} }
...@@ -21,6 +21,8 @@ dts: ...@@ -21,6 +21,8 @@ dts:
msg-url: pages/consignNodeDetail/index msg-url: pages/consignNodeDetail/index
#分销业务,公众号消息点击后跳转到小程序页面的链接 #分销业务,公众号消息点击后跳转到小程序页面的链接
distribution-msg-url: pages/saleOrderDetail/index distribution-msg-url: pages/saleOrderDetail/index
#分销拍卖业务,众号消息点击后跳转到小程序页面的链接
auction-msg-url: pages/saleAuctionDetail/index
# 商户证书文件路径 # 商户证书文件路径
# 请参考“商户证书”一节 https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=4_3 # 请参考“商户证书”一节 https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=4_3
......
...@@ -13,6 +13,8 @@ dts: ...@@ -13,6 +13,8 @@ dts:
msg-url: pages/consignNodeDetail/index msg-url: pages/consignNodeDetail/index
#分销业务,公众号消息点击后跳转到小程序页面的链接 #分销业务,公众号消息点击后跳转到小程序页面的链接
distribution-msg-url: pages/saleOrderDetail/index distribution-msg-url: pages/saleOrderDetail/index
#分销拍卖业务,众号消息点击后跳转到小程序页面的链接
auction-msg-url: pages/saleAuctionDetail/index
# 商户证书文件路径 # 商户证书文件路径
# 请参考“商户证书”一节 https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=4_3 # 请参考“商户证书”一节 https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=4_3
key-path: xxxxx key-path: xxxxx
......
...@@ -14,4 +14,6 @@ public class DistributionOrderNum implements Entity { ...@@ -14,4 +14,6 @@ public class DistributionOrderNum implements Entity {
private String stateName; private String stateName;
private Integer num; private Integer num;
private Integer selledNum;
} }
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import java.util.Date;
import java.util.List;
public interface AuctionConfigDao {
/**
* 插入新记录
*
* @param auctionConfig
* @return
*/
int insert(AuctionConfig auctionConfig);
/**
* 更新拍卖配置
*
* @param auctionConfig
* @return
*/
int update(AuctionConfig auctionConfig);
/**
* 根据商品id查询拍卖设置
* @param itemId
* @return
*/
AuctionConfig findByItemId(long itemId);
/**
* 查询截拍时间超过指定时间的拍卖配置
* @param
* @return
*/
List<AuctionConfig> findList(Date startTime, Date endTime);
/**
* 查询截拍后在一小时内的拍卖配置
* @param
* @return
*/
List<AuctionConfig> findEndList();
/**
* 查询超过截拍时间,但状态没有更改为截拍的商品记录
* @param
* @return
*/
List<AuctionConfig> findTimeOutNotValidList();
/**
* 查询一小时内即将截拍的拍卖商品
* @param
* @return
*/
List<AuctionConfig> findAbortEndList();
/**
* 更新截拍时间
* @param itemId
* @param realEndTime
* @return
*/
int updateRealEndTime(long itemId, Date realEndTime);
/**
* 拍卖结束
* @param itemId
* @return
*/
int setEnd(long itemId);
/**
* 拍卖配置更新为有效
* @param itemId
* @return
*/
int setValid(long itemId);
/**
* 拍卖配置更新为已处理
* @param itemId
* @return
*/
int setDeal(long itemId);
}
package com.wwdz.ch.db.dao.distribution;
import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import java.util.Date;
import java.util.List;
public interface AuctionRecordDao {
/**
* 插入新记录
*
* @param auctionRecord
* @return
*/
int insert(AuctionRecord auctionRecord);
/**
* 更新记录
* 价格被反超时,设置islead字段为false
* @param itemId
* @return
*/
int updateNotLead(long itemId);
/**
* 根据主键id更新记录
* 价格被反超时,设置islead字段为false
* @param id
* @return
*/
int updateNotLeadById(int id);
/**
* 查询出价记录
* @param dto
* @return
*/
List<AuctionRecord> find(AuctionRecordRequestDto dto);
/**
* 查询出价记录
* @param dto
* @return
*/
List<AuctionRecord> findByPage(AuctionRecordRequestDto dto);
/**
* 根据商品id查询出价记录
* @param itemId
* @return
*/
List<AuctionRecord> findByItemId(long itemId);
/**
* 查询最新的一条出价记录
* @param itemId
* @return
*/
AuctionRecord findLastedRecord(long itemId);
/**
* 查询用户第一条出价记录
* @param itemId
* @param userId
* @return
*/
AuctionRecord findFirstRecord(long itemId, long userId);
/**
* 统计出价次数
* @param dto
* @return
*/
long count(AuctionRecordRequestDto dto);
/**
* 查询用户出价过的商品
* @param userId
* @param startTime
* @param endTime
* @return
*/
List<AuctionRecord> findRecordByUserId(long userId, Date startTime, Date endTime);
}
...@@ -5,6 +5,7 @@ import com.wwdz.ch.db.domain.distribution.DistributionOrder; ...@@ -5,6 +5,7 @@ import com.wwdz.ch.db.domain.distribution.DistributionOrder;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto; import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
public interface DistributionOrderDao { public interface DistributionOrderDao {
...@@ -34,6 +35,15 @@ public interface DistributionOrderDao { ...@@ -34,6 +35,15 @@ public interface DistributionOrderDao {
*/ */
DistributionOrder findById(String distributionOrderId); DistributionOrder findById(String distributionOrderId);
/**
* 查询该商品是否生成了订单
* 用于拍卖生成订单判断
* @param itemId
* @return
*/
DistributionOrder findByItemId(long itemId);
/** /**
* 根据买家id查询 * 根据买家id查询
* @param buyerId * @param buyerId
...@@ -71,6 +81,16 @@ public interface DistributionOrderDao { ...@@ -71,6 +81,16 @@ public interface DistributionOrderDao {
*/ */
List<DistributionOrder> findByPage(DistributionOrderRequestDto dto); List<DistributionOrder> findByPage(DistributionOrderRequestDto dto);
List<DistributionOrder> findList(Date startTime, Date endTime);
/**
* 统计商品卖出数量
* @param itemId
* @return
*/
Long countSelledNum(long itemId);
/** /**
* 根据状态统计订单数量 * 根据状态统计订单数量
* @param buyerId * @param buyerId
......
...@@ -36,6 +36,14 @@ public interface DistributorProfitDao { ...@@ -36,6 +36,14 @@ public interface DistributorProfitDao {
*/ */
DistributorProfit findById(String distributionOrderId); DistributorProfit findById(String distributionOrderId);
/**
* 根据分销单号查询
* @param distributionOrderId
* @return
*/
DistributorProfit findByIdOfDistributor(String distributionOrderId, long distributorId);
/** /**
* 统计分销商卖出的商品数量 * 统计分销商卖出的商品数量
* *
......
...@@ -11,6 +11,8 @@ import java.util.List; ...@@ -11,6 +11,8 @@ import java.util.List;
public interface SupplierItemDao { public interface SupplierItemDao {
long insert(SupplierItem supplierItem);
/** /**
* 查询商品列表 * 查询商品列表
* @param supplierItemRequestDto * @param supplierItemRequestDto
...@@ -35,4 +37,6 @@ public interface SupplierItemDao { ...@@ -35,4 +37,6 @@ public interface SupplierItemDao {
* @return * @return
*/ */
int updateStock(long itemId, int stock); int updateStock(long itemId, int stock);
} }
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/07
*/
@Data
public class AuctionConfig implements Entity {
private Integer id;
/**
* 商品id
*/
private Long itemId;
/**
* 竞拍开始时间
*/
private Date startTime;
/**
* 竞拍结束时间
*/
private Date endTime;
/**
* 起拍价
*/
private Long startPrice;
/**
* 加价幅度
*/
private Long addExtent;
/**
* 实际竞拍结束时间
*/
private Date realEndTime;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否有效
*/
private Boolean isValid;
/**
* 是否成交
*/
private Boolean isDeal;
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(", itemId=").append(itemId);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);
sb.append(", startPrice=").append(startPrice);
sb.append(", addExtent=").append(addExtent);
sb.append(", realEndTime=").append(realEndTime);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", isValid=").append(isValid);
sb.append(", isDeal=").append(isDeal);
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;
}
AuctionConfig other = (AuctionConfig) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId()))
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
&& (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
&& (this.getStartPrice() == null ? other.getStartPrice() == null : this.getStartPrice().equals(other.getStartPrice()))
&& (this.getAddExtent() == null ? other.getAddExtent() == null : this.getAddExtent().equals(other.getAddExtent()))
&& (this.getRealEndTime() == null ? other.getRealEndTime() == null : this.getRealEndTime().equals(other.getRealEndTime()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getIsValid() == null ? other.getIsValid() == null : this.getIsValid().equals(other.getIsValid()))
&& (this.getIsDeal() == null ? other.getIsDeal() == null : this.getIsDeal().equals(other.getIsDeal()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getItemId() == null) ? 0 : getItemId().hashCode());
result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
result = prime * result + ((getStartPrice() == null) ? 0 : getStartPrice().hashCode());
result = prime * result + ((getAddExtent() == null) ? 0 : getAddExtent().hashCode());
result = prime * result + ((getRealEndTime() == null) ? 0 : getRealEndTime().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getIsValid() == null) ? 0 : getIsValid().hashCode());
result = prime * result + ((getIsDeal() == null) ? 0 : getIsDeal().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
itemId("item_id", "itemId", "BIGINT", false),
startTime("start_time", "startTime", "TIMESTAMP", false),
endTime("end_time", "endTime", "TIMESTAMP", false),
startPrice("start_price", "startPrice", "BIGINT", false),
addExtent("add_extent", "addExtent", "BIGINT", false),
realEndTime("real_end_time", "realEndTime", "TIMESTAMP", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
isValid("is_valid", "isValid", "BIT", false),
isDeal("is_deal", "isDeal", "BIT", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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 auction_config
*
* @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.util.ArrayList;
import java.util.Date;
import java.util.List;
public class AuctionConfigExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public AuctionConfigExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AuctionConfigExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AuctionConfigExample orderBy(String ... orderByClauses) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < orderByClauses.length; i++) {
sb.append(orderByClauses[i]);
if (i < orderByClauses.length - 1) {
sb.append(" , ");
}
}
this.setOrderByClause(sb.toString());
return this;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria(this);
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
AuctionConfigExample example = new AuctionConfigExample();
return example.createCriteria();
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andItemIdIsNull() {
addCriterion("item_id is null");
return (Criteria) this;
}
public Criteria andItemIdIsNotNull() {
addCriterion("item_id is not null");
return (Criteria) this;
}
public Criteria andItemIdEqualTo(Long value) {
addCriterion("item_id =", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("item_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdNotEqualTo(Long value) {
addCriterion("item_id <>", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("item_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdGreaterThan(Long value) {
addCriterion("item_id >", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("item_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdGreaterThanOrEqualTo(Long value) {
addCriterion("item_id >=", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("item_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdLessThan(Long value) {
addCriterion("item_id <", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("item_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdLessThanOrEqualTo(Long value) {
addCriterion("item_id <=", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("item_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdIn(List<Long> values) {
addCriterion("item_id in", values, "itemId");
return (Criteria) this;
}
public Criteria andItemIdNotIn(List<Long> values) {
addCriterion("item_id not in", values, "itemId");
return (Criteria) this;
}
public Criteria andItemIdBetween(Long value1, Long value2) {
addCriterion("item_id between", value1, value2, "itemId");
return (Criteria) this;
}
public Criteria andItemIdNotBetween(Long value1, Long value2) {
addCriterion("item_id not between", value1, value2, "itemId");
return (Criteria) this;
}
public Criteria andStartTimeIsNull() {
addCriterion("start_time is null");
return (Criteria) this;
}
public Criteria andStartTimeIsNotNull() {
addCriterion("start_time is not null");
return (Criteria) this;
}
public Criteria andStartTimeEqualTo(Date value) {
addCriterion("start_time =", value, "startTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartTimeEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartTimeNotEqualTo(Date value) {
addCriterion("start_time <>", value, "startTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartTimeNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartTimeGreaterThan(Date value) {
addCriterion("start_time >", value, "startTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartTimeGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartTimeGreaterThanOrEqualTo(Date value) {
addCriterion("start_time >=", value, "startTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartTimeGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartTimeLessThan(Date value) {
addCriterion("start_time <", value, "startTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartTimeLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartTimeLessThanOrEqualTo(Date value) {
addCriterion("start_time <=", value, "startTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartTimeLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartTimeIn(List<Date> values) {
addCriterion("start_time in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotIn(List<Date> values) {
addCriterion("start_time not in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeBetween(Date value1, Date value2) {
addCriterion("start_time between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotBetween(Date value1, Date value2) {
addCriterion("start_time not between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andEndTimeIsNull() {
addCriterion("end_time is null");
return (Criteria) this;
}
public Criteria andEndTimeIsNotNull() {
addCriterion("end_time is not null");
return (Criteria) this;
}
public Criteria andEndTimeEqualTo(Date value) {
addCriterion("end_time =", value, "endTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEndTimeEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("end_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEndTimeNotEqualTo(Date value) {
addCriterion("end_time <>", value, "endTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEndTimeNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("end_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEndTimeGreaterThan(Date value) {
addCriterion("end_time >", value, "endTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEndTimeGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("end_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEndTimeGreaterThanOrEqualTo(Date value) {
addCriterion("end_time >=", value, "endTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEndTimeGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("end_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEndTimeLessThan(Date value) {
addCriterion("end_time <", value, "endTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEndTimeLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("end_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEndTimeLessThanOrEqualTo(Date value) {
addCriterion("end_time <=", value, "endTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andEndTimeLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("end_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andEndTimeIn(List<Date> values) {
addCriterion("end_time in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotIn(List<Date> values) {
addCriterion("end_time not in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeBetween(Date value1, Date value2) {
addCriterion("end_time between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotBetween(Date value1, Date value2) {
addCriterion("end_time not between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andStartPriceIsNull() {
addCriterion("start_price is null");
return (Criteria) this;
}
public Criteria andStartPriceIsNotNull() {
addCriterion("start_price is not null");
return (Criteria) this;
}
public Criteria andStartPriceEqualTo(Long value) {
addCriterion("start_price =", value, "startPrice");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartPriceEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_price = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartPriceNotEqualTo(Long value) {
addCriterion("start_price <>", value, "startPrice");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartPriceNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_price <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartPriceGreaterThan(Long value) {
addCriterion("start_price >", value, "startPrice");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartPriceGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_price > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartPriceGreaterThanOrEqualTo(Long value) {
addCriterion("start_price >=", value, "startPrice");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartPriceGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_price >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartPriceLessThan(Long value) {
addCriterion("start_price <", value, "startPrice");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartPriceLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_price < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartPriceLessThanOrEqualTo(Long value) {
addCriterion("start_price <=", value, "startPrice");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andStartPriceLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("start_price <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStartPriceIn(List<Long> values) {
addCriterion("start_price in", values, "startPrice");
return (Criteria) this;
}
public Criteria andStartPriceNotIn(List<Long> values) {
addCriterion("start_price not in", values, "startPrice");
return (Criteria) this;
}
public Criteria andStartPriceBetween(Long value1, Long value2) {
addCriterion("start_price between", value1, value2, "startPrice");
return (Criteria) this;
}
public Criteria andStartPriceNotBetween(Long value1, Long value2) {
addCriterion("start_price not between", value1, value2, "startPrice");
return (Criteria) this;
}
public Criteria andAddExtentIsNull() {
addCriterion("add_extent is null");
return (Criteria) this;
}
public Criteria andAddExtentIsNotNull() {
addCriterion("add_extent is not null");
return (Criteria) this;
}
public Criteria andAddExtentEqualTo(Long value) {
addCriterion("add_extent =", value, "addExtent");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddExtentEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("add_extent = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddExtentNotEqualTo(Long value) {
addCriterion("add_extent <>", value, "addExtent");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddExtentNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("add_extent <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddExtentGreaterThan(Long value) {
addCriterion("add_extent >", value, "addExtent");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddExtentGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("add_extent > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddExtentGreaterThanOrEqualTo(Long value) {
addCriterion("add_extent >=", value, "addExtent");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddExtentGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("add_extent >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddExtentLessThan(Long value) {
addCriterion("add_extent <", value, "addExtent");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddExtentLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("add_extent < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddExtentLessThanOrEqualTo(Long value) {
addCriterion("add_extent <=", value, "addExtent");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andAddExtentLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("add_extent <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andAddExtentIn(List<Long> values) {
addCriterion("add_extent in", values, "addExtent");
return (Criteria) this;
}
public Criteria andAddExtentNotIn(List<Long> values) {
addCriterion("add_extent not in", values, "addExtent");
return (Criteria) this;
}
public Criteria andAddExtentBetween(Long value1, Long value2) {
addCriterion("add_extent between", value1, value2, "addExtent");
return (Criteria) this;
}
public Criteria andAddExtentNotBetween(Long value1, Long value2) {
addCriterion("add_extent not between", value1, value2, "addExtent");
return (Criteria) this;
}
public Criteria andRealEndTimeIsNull() {
addCriterion("real_end_time is null");
return (Criteria) this;
}
public Criteria andRealEndTimeIsNotNull() {
addCriterion("real_end_time is not null");
return (Criteria) this;
}
public Criteria andRealEndTimeEqualTo(Date value) {
addCriterion("real_end_time =", value, "realEndTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealEndTimeEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("real_end_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealEndTimeNotEqualTo(Date value) {
addCriterion("real_end_time <>", value, "realEndTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealEndTimeNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("real_end_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealEndTimeGreaterThan(Date value) {
addCriterion("real_end_time >", value, "realEndTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealEndTimeGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("real_end_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealEndTimeGreaterThanOrEqualTo(Date value) {
addCriterion("real_end_time >=", value, "realEndTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealEndTimeGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("real_end_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealEndTimeLessThan(Date value) {
addCriterion("real_end_time <", value, "realEndTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealEndTimeLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("real_end_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealEndTimeLessThanOrEqualTo(Date value) {
addCriterion("real_end_time <=", value, "realEndTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andRealEndTimeLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("real_end_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andRealEndTimeIn(List<Date> values) {
addCriterion("real_end_time in", values, "realEndTime");
return (Criteria) this;
}
public Criteria andRealEndTimeNotIn(List<Date> values) {
addCriterion("real_end_time not in", values, "realEndTime");
return (Criteria) this;
}
public Criteria andRealEndTimeBetween(Date value1, Date value2) {
addCriterion("real_end_time between", value1, value2, "realEndTime");
return (Criteria) this;
}
public Criteria andRealEndTimeNotBetween(Date value1, Date value2) {
addCriterion("real_end_time not between", value1, value2, "realEndTime");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("create_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("create_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("create_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("create_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("create_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("create_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNull() {
addCriterion("update_time is null");
return (Criteria) this;
}
public Criteria andUpdateTimeIsNotNull() {
addCriterion("update_time is not null");
return (Criteria) this;
}
public Criteria andUpdateTimeEqualTo(Date value) {
addCriterion("update_time =", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("update_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeNotEqualTo(Date value) {
addCriterion("update_time <>", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("update_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThan(Date value) {
addCriterion("update_time >", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("update_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("update_time >=", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("update_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeLessThan(Date value) {
addCriterion("update_time <", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("update_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
addCriterion("update_time <=", value, "updateTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUpdateTimeLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("update_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUpdateTimeIn(List<Date> values) {
addCriterion("update_time in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotIn(List<Date> values) {
addCriterion("update_time not in", values, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
addCriterion("update_time between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
addCriterion("update_time not between", value1, value2, "updateTime");
return (Criteria) this;
}
public Criteria andIsValidIsNull() {
addCriterion("is_valid is null");
return (Criteria) this;
}
public Criteria andIsValidIsNotNull() {
addCriterion("is_valid is not null");
return (Criteria) this;
}
public Criteria andIsValidEqualTo(Boolean value) {
addCriterion("is_valid =", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_valid = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidNotEqualTo(Boolean value) {
addCriterion("is_valid <>", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_valid <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidGreaterThan(Boolean value) {
addCriterion("is_valid >", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_valid > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_valid >=", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_valid >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidLessThan(Boolean value) {
addCriterion("is_valid <", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_valid < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidLessThanOrEqualTo(Boolean value) {
addCriterion("is_valid <=", value, "isValid");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsValidLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_valid <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsValidIn(List<Boolean> values) {
addCriterion("is_valid in", values, "isValid");
return (Criteria) this;
}
public Criteria andIsValidNotIn(List<Boolean> values) {
addCriterion("is_valid not in", values, "isValid");
return (Criteria) this;
}
public Criteria andIsValidBetween(Boolean value1, Boolean value2) {
addCriterion("is_valid between", value1, value2, "isValid");
return (Criteria) this;
}
public Criteria andIsValidNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_valid not between", value1, value2, "isValid");
return (Criteria) this;
}
public Criteria andIsDealIsNull() {
addCriterion("is_deal is null");
return (Criteria) this;
}
public Criteria andIsDealIsNotNull() {
addCriterion("is_deal is not null");
return (Criteria) this;
}
public Criteria andIsDealEqualTo(Boolean value) {
addCriterion("is_deal =", value, "isDeal");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDealEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_deal = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDealNotEqualTo(Boolean value) {
addCriterion("is_deal <>", value, "isDeal");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDealNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_deal <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDealGreaterThan(Boolean value) {
addCriterion("is_deal >", value, "isDeal");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDealGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_deal > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDealGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_deal >=", value, "isDeal");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDealGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_deal >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDealLessThan(Boolean value) {
addCriterion("is_deal <", value, "isDeal");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDealLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_deal < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDealLessThanOrEqualTo(Boolean value) {
addCriterion("is_deal <=", value, "isDeal");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsDealLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("is_deal <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsDealIn(List<Boolean> values) {
addCriterion("is_deal in", values, "isDeal");
return (Criteria) this;
}
public Criteria andIsDealNotIn(List<Boolean> values) {
addCriterion("is_deal not in", values, "isDeal");
return (Criteria) this;
}
public Criteria andIsDealBetween(Boolean value1, Boolean value2) {
addCriterion("is_deal between", value1, value2, "isDeal");
return (Criteria) this;
}
public Criteria andIsDealNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_deal not between", value1, value2, "isDeal");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private AuctionConfigExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(AuctionConfigExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AuctionConfigExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
if (ifAdd) {
add.add(this);
}
return this;
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface ICriteriaAdd {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Criteria add(Criteria add);
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
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/05
*/
@Data
public class AuctionRecord implements Entity {
private Integer id;
/**
* 商品id
*/
private Long itemId;
/**
* 用户id
*/
private Long userId;
/**
* 微信openid
*/
private String userOpenId;
/**
* 出价
*/
private Long price;
/**
* 出价时间
*/
private Date createTime;
/**
* 分享id
*/
private String shareRecordId;
/**
* 分享商id
*/
private Long distributorId;
/**
* 价格是否领先
*/
private Boolean isLead;
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(", itemId=").append(itemId);
sb.append(", userId=").append(userId);
sb.append(", userOpenId=").append(userOpenId);
sb.append(", price=").append(price);
sb.append(", createTime=").append(createTime);
sb.append(", shareRecordId=").append(shareRecordId);
sb.append(", distributorId=").append(distributorId);
sb.append(", isLead=").append(isLead);
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;
}
AuctionRecord other = (AuctionRecord) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getUserOpenId() == null ? other.getUserOpenId() == null : this.getUserOpenId().equals(other.getUserOpenId()))
&& (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getShareRecordId() == null ? other.getShareRecordId() == null : this.getShareRecordId().equals(other.getShareRecordId()))
&& (this.getDistributorId() == null ? other.getDistributorId() == null : this.getDistributorId().equals(other.getDistributorId()))
&& (this.getIsLead() == null ? other.getIsLead() == null : this.getIsLead().equals(other.getIsLead()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getItemId() == null) ? 0 : getItemId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getUserOpenId() == null) ? 0 : getUserOpenId().hashCode());
result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getShareRecordId() == null) ? 0 : getShareRecordId().hashCode());
result = prime * result + ((getDistributorId() == null) ? 0 : getDistributorId().hashCode());
result = prime * result + ((getIsLead() == null) ? 0 : getIsLead().hashCode());
return result;
}
/**
* This enum was generated by MyBatis Generator.
* This enum corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public enum Column {
id("id", "id", "INTEGER", false),
itemId("item_id", "itemId", "BIGINT", false),
userId("user_id", "userId", "BIGINT", false),
userOpenId("user_open_id", "userOpenId", "VARCHAR", false),
price("price", "price", "BIGINT", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
shareRecordId("share_record_id", "shareRecordId", "VARCHAR", false),
distributorId("distributor_id", "distributorId", "BIGINT", false),
isLead("is_lead", "isLead", "BIT", false);
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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 auction_record
*
* @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.util.ArrayList;
import java.util.Date;
import java.util.List;
public class AuctionRecordExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public AuctionRecordExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AuctionRecordExample orderBy(String orderByClause) {
this.setOrderByClause(orderByClause);
return this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AuctionRecordExample orderBy(String ... orderByClauses) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < orderByClauses.length; i++) {
sb.append(orderByClauses[i]);
if (i < orderByClauses.length - 1) {
sb.append(" , ");
}
}
this.setOrderByClause(sb.toString());
return this;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria(this);
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public static Criteria newAndCreateCriteria() {
AuctionRecordExample example = new AuctionRecordExample();
return example.createCriteria();
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdNotEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdGreaterThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIdLessThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andItemIdIsNull() {
addCriterion("item_id is null");
return (Criteria) this;
}
public Criteria andItemIdIsNotNull() {
addCriterion("item_id is not null");
return (Criteria) this;
}
public Criteria andItemIdEqualTo(Long value) {
addCriterion("item_id =", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("item_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdNotEqualTo(Long value) {
addCriterion("item_id <>", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdNotEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("item_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdGreaterThan(Long value) {
addCriterion("item_id >", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdGreaterThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("item_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdGreaterThanOrEqualTo(Long value) {
addCriterion("item_id >=", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdGreaterThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("item_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdLessThan(Long value) {
addCriterion("item_id <", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdLessThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("item_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdLessThanOrEqualTo(Long value) {
addCriterion("item_id <=", value, "itemId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemIdLessThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("item_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemIdIn(List<Long> values) {
addCriterion("item_id in", values, "itemId");
return (Criteria) this;
}
public Criteria andItemIdNotIn(List<Long> values) {
addCriterion("item_id not in", values, "itemId");
return (Criteria) this;
}
public Criteria andItemIdBetween(Long value1, Long value2) {
addCriterion("item_id between", value1, value2, "itemId");
return (Criteria) this;
}
public Criteria andItemIdNotBetween(Long value1, Long value2) {
addCriterion("item_id not between", value1, value2, "itemId");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdNotEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdGreaterThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdGreaterThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdLessThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserIdLessThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserOpenIdIsNull() {
addCriterion("user_open_id is null");
return (Criteria) this;
}
public Criteria andUserOpenIdIsNotNull() {
addCriterion("user_open_id is not null");
return (Criteria) this;
}
public Criteria andUserOpenIdEqualTo(String value) {
addCriterion("user_open_id =", value, "userOpenId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserOpenIdEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_open_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserOpenIdNotEqualTo(String value) {
addCriterion("user_open_id <>", value, "userOpenId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserOpenIdNotEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_open_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserOpenIdGreaterThan(String value) {
addCriterion("user_open_id >", value, "userOpenId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserOpenIdGreaterThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_open_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserOpenIdGreaterThanOrEqualTo(String value) {
addCriterion("user_open_id >=", value, "userOpenId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserOpenIdGreaterThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_open_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserOpenIdLessThan(String value) {
addCriterion("user_open_id <", value, "userOpenId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserOpenIdLessThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_open_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserOpenIdLessThanOrEqualTo(String value) {
addCriterion("user_open_id <=", value, "userOpenId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andUserOpenIdLessThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("user_open_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andUserOpenIdLike(String value) {
addCriterion("user_open_id like", value, "userOpenId");
return (Criteria) this;
}
public Criteria andUserOpenIdNotLike(String value) {
addCriterion("user_open_id not like", value, "userOpenId");
return (Criteria) this;
}
public Criteria andUserOpenIdIn(List<String> values) {
addCriterion("user_open_id in", values, "userOpenId");
return (Criteria) this;
}
public Criteria andUserOpenIdNotIn(List<String> values) {
addCriterion("user_open_id not in", values, "userOpenId");
return (Criteria) this;
}
public Criteria andUserOpenIdBetween(String value1, String value2) {
addCriterion("user_open_id between", value1, value2, "userOpenId");
return (Criteria) this;
}
public Criteria andUserOpenIdNotBetween(String value1, String value2) {
addCriterion("user_open_id not between", value1, value2, "userOpenId");
return (Criteria) this;
}
public Criteria andPriceIsNull() {
addCriterion("price is null");
return (Criteria) this;
}
public Criteria andPriceIsNotNull() {
addCriterion("price is not null");
return (Criteria) this;
}
public Criteria andPriceEqualTo(Long value) {
addCriterion("price =", value, "price");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPriceEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("price = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPriceNotEqualTo(Long value) {
addCriterion("price <>", value, "price");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPriceNotEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("price <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPriceGreaterThan(Long value) {
addCriterion("price >", value, "price");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPriceGreaterThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("price > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPriceGreaterThanOrEqualTo(Long value) {
addCriterion("price >=", value, "price");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPriceGreaterThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("price >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPriceLessThan(Long value) {
addCriterion("price <", value, "price");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPriceLessThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("price < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPriceLessThanOrEqualTo(Long value) {
addCriterion("price <=", value, "price");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andPriceLessThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("price <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPriceIn(List<Long> values) {
addCriterion("price in", values, "price");
return (Criteria) this;
}
public Criteria andPriceNotIn(List<Long> values) {
addCriterion("price not in", values, "price");
return (Criteria) this;
}
public Criteria andPriceBetween(Long value1, Long value2) {
addCriterion("price between", value1, value2, "price");
return (Criteria) this;
}
public Criteria andPriceNotBetween(Long value1, Long value2) {
addCriterion("price not between", value1, value2, "price");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("create_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeNotEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("create_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("create_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeGreaterThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("create_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("create_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andCreateTimeLessThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("create_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andShareRecordIdIsNull() {
addCriterion("share_record_id is null");
return (Criteria) this;
}
public Criteria andShareRecordIdIsNotNull() {
addCriterion("share_record_id is not null");
return (Criteria) this;
}
public Criteria andShareRecordIdEqualTo(String value) {
addCriterion("share_record_id =", value, "shareRecordId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareRecordIdEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("share_record_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareRecordIdNotEqualTo(String value) {
addCriterion("share_record_id <>", value, "shareRecordId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareRecordIdNotEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("share_record_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareRecordIdGreaterThan(String value) {
addCriterion("share_record_id >", value, "shareRecordId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareRecordIdGreaterThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("share_record_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareRecordIdGreaterThanOrEqualTo(String value) {
addCriterion("share_record_id >=", value, "shareRecordId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareRecordIdGreaterThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("share_record_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareRecordIdLessThan(String value) {
addCriterion("share_record_id <", value, "shareRecordId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareRecordIdLessThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("share_record_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareRecordIdLessThanOrEqualTo(String value) {
addCriterion("share_record_id <=", value, "shareRecordId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andShareRecordIdLessThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("share_record_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareRecordIdLike(String value) {
addCriterion("share_record_id like", value, "shareRecordId");
return (Criteria) this;
}
public Criteria andShareRecordIdNotLike(String value) {
addCriterion("share_record_id not like", value, "shareRecordId");
return (Criteria) this;
}
public Criteria andShareRecordIdIn(List<String> values) {
addCriterion("share_record_id in", values, "shareRecordId");
return (Criteria) this;
}
public Criteria andShareRecordIdNotIn(List<String> values) {
addCriterion("share_record_id not in", values, "shareRecordId");
return (Criteria) this;
}
public Criteria andShareRecordIdBetween(String value1, String value2) {
addCriterion("share_record_id between", value1, value2, "shareRecordId");
return (Criteria) this;
}
public Criteria andShareRecordIdNotBetween(String value1, String value2) {
addCriterion("share_record_id not between", value1, value2, "shareRecordId");
return (Criteria) this;
}
public Criteria andDistributorIdIsNull() {
addCriterion("distributor_id is null");
return (Criteria) this;
}
public Criteria andDistributorIdIsNotNull() {
addCriterion("distributor_id is not null");
return (Criteria) this;
}
public Criteria andDistributorIdEqualTo(Long value) {
addCriterion("distributor_id =", value, "distributorId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDistributorIdEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("distributor_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDistributorIdNotEqualTo(Long value) {
addCriterion("distributor_id <>", value, "distributorId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDistributorIdNotEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("distributor_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDistributorIdGreaterThan(Long value) {
addCriterion("distributor_id >", value, "distributorId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDistributorIdGreaterThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("distributor_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDistributorIdGreaterThanOrEqualTo(Long value) {
addCriterion("distributor_id >=", value, "distributorId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDistributorIdGreaterThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("distributor_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDistributorIdLessThan(Long value) {
addCriterion("distributor_id <", value, "distributorId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDistributorIdLessThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("distributor_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDistributorIdLessThanOrEqualTo(Long value) {
addCriterion("distributor_id <=", value, "distributorId");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andDistributorIdLessThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("distributor_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andDistributorIdIn(List<Long> values) {
addCriterion("distributor_id in", values, "distributorId");
return (Criteria) this;
}
public Criteria andDistributorIdNotIn(List<Long> values) {
addCriterion("distributor_id not in", values, "distributorId");
return (Criteria) this;
}
public Criteria andDistributorIdBetween(Long value1, Long value2) {
addCriterion("distributor_id between", value1, value2, "distributorId");
return (Criteria) this;
}
public Criteria andDistributorIdNotBetween(Long value1, Long value2) {
addCriterion("distributor_id not between", value1, value2, "distributorId");
return (Criteria) this;
}
public Criteria andIsLeadIsNull() {
addCriterion("is_lead is null");
return (Criteria) this;
}
public Criteria andIsLeadIsNotNull() {
addCriterion("is_lead is not null");
return (Criteria) this;
}
public Criteria andIsLeadEqualTo(Boolean value) {
addCriterion("is_lead =", value, "isLead");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsLeadEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("is_lead = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsLeadNotEqualTo(Boolean value) {
addCriterion("is_lead <>", value, "isLead");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsLeadNotEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("is_lead <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsLeadGreaterThan(Boolean value) {
addCriterion("is_lead >", value, "isLead");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsLeadGreaterThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("is_lead > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsLeadGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_lead >=", value, "isLead");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsLeadGreaterThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("is_lead >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsLeadLessThan(Boolean value) {
addCriterion("is_lead <", value, "isLead");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsLeadLessThanColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("is_lead < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsLeadLessThanOrEqualTo(Boolean value) {
addCriterion("is_lead <=", value, "isLead");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsLeadLessThanOrEqualToColumn(AuctionRecord.Column column) {
addCriterion(new StringBuilder("is_lead <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsLeadIn(List<Boolean> values) {
addCriterion("is_lead in", values, "isLead");
return (Criteria) this;
}
public Criteria andIsLeadNotIn(List<Boolean> values) {
addCriterion("is_lead not in", values, "isLead");
return (Criteria) this;
}
public Criteria andIsLeadBetween(Boolean value1, Boolean value2) {
addCriterion("is_lead between", value1, value2, "isLead");
return (Criteria) this;
}
public Criteria andIsLeadNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_lead not between", value1, value2, "isLead");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
private AuctionRecordExample example;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
protected Criteria(AuctionRecordExample example) {
super();
this.example = example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public AuctionRecordExample example() {
return this.example;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIf(boolean ifAdd, ICriteriaAdd add) {
if (ifAdd) {
add.add(this);
}
return this;
}
/**
* This interface was generated by MyBatis Generator.
* This interface corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public interface ICriteriaAdd {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
Criteria add(Criteria add);
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}
\ No newline at end of file
...@@ -10,7 +10,7 @@ import lombok.Data; ...@@ -10,7 +10,7 @@ import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/01/31 * @date 2024/02/29
*/ */
@Data @Data
public class DistributionOrder implements Entity { public class DistributionOrder implements Entity {
...@@ -131,6 +131,11 @@ public class DistributionOrder implements Entity { ...@@ -131,6 +131,11 @@ public class DistributionOrder implements Entity {
*/ */
private Integer state; private Integer state;
/**
* 订单类型1一口价2竞拍
*/
private Integer type;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override
...@@ -163,6 +168,7 @@ public class DistributionOrder implements Entity { ...@@ -163,6 +168,7 @@ public class DistributionOrder implements Entity {
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);
sb.append(", shareRecordId=").append(shareRecordId); sb.append(", shareRecordId=").append(shareRecordId);
sb.append(", state=").append(state); sb.append(", state=").append(state);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
...@@ -203,7 +209,8 @@ public class DistributionOrder implements Entity { ...@@ -203,7 +209,8 @@ public class DistributionOrder implements Entity {
&& (this.getFinishTime() == null ? other.getFinishTime() == null : this.getFinishTime().equals(other.getFinishTime())) && (this.getFinishTime() == null ? other.getFinishTime() == null : this.getFinishTime().equals(other.getFinishTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getShareRecordId() == null ? other.getShareRecordId() == null : this.getShareRecordId().equals(other.getShareRecordId())) && (this.getShareRecordId() == null ? other.getShareRecordId() == null : this.getShareRecordId().equals(other.getShareRecordId()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState())); && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
} }
@Override @Override
...@@ -234,6 +241,7 @@ public class DistributionOrder implements Entity { ...@@ -234,6 +241,7 @@ public class DistributionOrder implements Entity {
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getShareRecordId() == null) ? 0 : getShareRecordId().hashCode()); result = prime * result + ((getShareRecordId() == null) ? 0 : getShareRecordId().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode()); result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
return result; return result;
} }
...@@ -268,7 +276,8 @@ public class DistributionOrder implements Entity { ...@@ -268,7 +276,8 @@ public class DistributionOrder implements Entity {
finishTime("finish_time", "finishTime", "TIMESTAMP", false), finishTime("finish_time", "finishTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false), updateTime("update_time", "updateTime", "TIMESTAMP", false),
shareRecordId("share_record_id", "shareRecordId", "VARCHAR", false), shareRecordId("share_record_id", "shareRecordId", "VARCHAR", false),
state("state", "state", "INTEGER", true); state("state", "state", "INTEGER", true),
type("type", "type", "INTEGER", true);
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
......
...@@ -3415,6 +3415,138 @@ public class DistributionOrderExample { ...@@ -3415,6 +3415,138 @@ public class DistributionOrderExample {
addCriterion("`state` not between", value1, value2, "state"); addCriterion("`state` not between", value1, value2, "state");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeNotEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanOrEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distribution_order
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanOrEqualToColumn(DistributionOrder.Column column) {
addCriterion(new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
...@@ -10,7 +10,7 @@ import lombok.Data; ...@@ -10,7 +10,7 @@ import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/01/25 * @date 2024/02/29
*/ */
@Data @Data
public class DistributorShareRecord implements Entity { public class DistributorShareRecord implements Entity {
...@@ -51,6 +51,11 @@ public class DistributorShareRecord implements Entity { ...@@ -51,6 +51,11 @@ public class DistributorShareRecord implements Entity {
*/ */
private Boolean enabled; private Boolean enabled;
/**
* 分享类型1一口价2竞拍
*/
private Integer type;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override
...@@ -67,6 +72,7 @@ public class DistributorShareRecord implements Entity { ...@@ -67,6 +72,7 @@ public class DistributorShareRecord implements Entity {
sb.append(", shopId=").append(shopId); sb.append(", shopId=").append(shopId);
sb.append(", createTime=").append(createTime); sb.append(", createTime=").append(createTime);
sb.append(", enabled=").append(enabled); sb.append(", enabled=").append(enabled);
sb.append(", type=").append(type);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
...@@ -91,7 +97,8 @@ public class DistributorShareRecord implements Entity { ...@@ -91,7 +97,8 @@ public class DistributorShareRecord implements Entity {
&& (this.getDistributorId() == null ? other.getDistributorId() == null : this.getDistributorId().equals(other.getDistributorId())) && (this.getDistributorId() == null ? other.getDistributorId() == null : this.getDistributorId().equals(other.getDistributorId()))
&& (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId())) && (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getEnabled() == null ? other.getEnabled() == null : this.getEnabled().equals(other.getEnabled())); && (this.getEnabled() == null ? other.getEnabled() == null : this.getEnabled().equals(other.getEnabled()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
} }
@Override @Override
...@@ -106,6 +113,7 @@ public class DistributorShareRecord implements Entity { ...@@ -106,6 +113,7 @@ public class DistributorShareRecord implements Entity {
result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode()); result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getEnabled() == null) ? 0 : getEnabled().hashCode()); result = prime * result + ((getEnabled() == null) ? 0 : getEnabled().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
return result; return result;
} }
...@@ -124,7 +132,8 @@ public class DistributorShareRecord implements Entity { ...@@ -124,7 +132,8 @@ public class DistributorShareRecord implements Entity {
distributorId("distributor_id", "distributorId", "BIGINT", false), distributorId("distributor_id", "distributorId", "BIGINT", false),
shopId("shop_id", "shopId", "BIGINT", false), shopId("shop_id", "shopId", "BIGINT", false),
createTime("create_time", "createTime", "TIMESTAMP", false), createTime("create_time", "createTime", "TIMESTAMP", false),
enabled("enabled", "enabled", "BIT", false); enabled("enabled", "enabled", "BIT", false),
type("type", "type", "INTEGER", true);
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
......
...@@ -1213,6 +1213,138 @@ public class DistributorShareRecordExample { ...@@ -1213,6 +1213,138 @@ public class DistributorShareRecordExample {
addCriterion("enabled not between", value1, value2, "enabled"); addCriterion("enabled not between", value1, value2, "enabled");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeEqualToColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeNotEqualToColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanOrEqualToColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table distributor_share_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanOrEqualToColumn(DistributorShareRecord.Column column) {
addCriterion(new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
...@@ -10,7 +10,7 @@ import lombok.Data; ...@@ -10,7 +10,7 @@ import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/02/19 * @date 2024/02/29
*/ */
@Data @Data
public class SupplierItem implements Entity { public class SupplierItem implements Entity {
...@@ -76,6 +76,11 @@ public class SupplierItem implements Entity { ...@@ -76,6 +76,11 @@ public class SupplierItem implements Entity {
*/ */
private Integer buyLimitNum; private Integer buyLimitNum;
/**
* 商品类型1一口价2竞拍
*/
private Integer type;
/** /**
* 商品图片,分号分隔 * 商品图片,分号分隔
*/ */
...@@ -112,6 +117,7 @@ public class SupplierItem implements Entity { ...@@ -112,6 +117,7 @@ public class SupplierItem implements Entity {
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);
sb.append(", isDeleted=").append(isDeleted); sb.append(", isDeleted=").append(isDeleted);
sb.append(", buyLimitNum=").append(buyLimitNum); sb.append(", buyLimitNum=").append(buyLimitNum);
sb.append(", type=").append(type);
sb.append(", images=").append(images); sb.append(", images=").append(images);
sb.append(", videos=").append(videos); sb.append(", videos=").append(videos);
sb.append(", description=").append(description); sb.append(", description=").append(description);
...@@ -145,6 +151,7 @@ public class SupplierItem implements Entity { ...@@ -145,6 +151,7 @@ public class SupplierItem implements Entity {
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted())) && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()))
&& (this.getBuyLimitNum() == null ? other.getBuyLimitNum() == null : this.getBuyLimitNum().equals(other.getBuyLimitNum())) && (this.getBuyLimitNum() == null ? other.getBuyLimitNum() == null : this.getBuyLimitNum().equals(other.getBuyLimitNum()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getImages() == null ? other.getImages() == null : this.getImages().equals(other.getImages())) && (this.getImages() == null ? other.getImages() == null : this.getImages().equals(other.getImages()))
&& (this.getVideos() == null ? other.getVideos() == null : this.getVideos().equals(other.getVideos())) && (this.getVideos() == null ? other.getVideos() == null : this.getVideos().equals(other.getVideos()))
&& (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription())); && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()));
...@@ -167,6 +174,7 @@ public class SupplierItem implements Entity { ...@@ -167,6 +174,7 @@ public class SupplierItem implements Entity {
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode()); result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
result = prime * result + ((getBuyLimitNum() == null) ? 0 : getBuyLimitNum().hashCode()); result = prime * result + ((getBuyLimitNum() == null) ? 0 : getBuyLimitNum().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getImages() == null) ? 0 : getImages().hashCode()); result = prime * result + ((getImages() == null) ? 0 : getImages().hashCode());
result = prime * result + ((getVideos() == null) ? 0 : getVideos().hashCode()); result = prime * result + ((getVideos() == null) ? 0 : getVideos().hashCode());
result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode()); result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
...@@ -194,6 +202,7 @@ public class SupplierItem implements Entity { ...@@ -194,6 +202,7 @@ public class SupplierItem implements Entity {
updateTime("update_time", "updateTime", "TIMESTAMP", false), updateTime("update_time", "updateTime", "TIMESTAMP", false),
isDeleted("is_deleted", "isDeleted", "BIT", false), isDeleted("is_deleted", "isDeleted", "BIT", false),
buyLimitNum("buy_limit_num", "buyLimitNum", "INTEGER", false), buyLimitNum("buy_limit_num", "buyLimitNum", "INTEGER", false),
type("type", "type", "INTEGER", true),
images("images", "images", "LONGVARCHAR", false), images("images", "images", "LONGVARCHAR", false),
videos("videos", "videos", "LONGVARCHAR", false), videos("videos", "videos", "LONGVARCHAR", false),
description("description", "description", "LONGVARCHAR", false); description("description", "description", "LONGVARCHAR", false);
......
...@@ -1883,6 +1883,138 @@ public class SupplierItemExample { ...@@ -1883,6 +1883,138 @@ public class SupplierItemExample {
addCriterion("buy_limit_num not between", value1, value2, "buyLimitNum"); addCriterion("buy_limit_num not between", value1, value2, "buyLimitNum");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeNotEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeGreaterThanOrEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andTypeLessThanOrEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("`type` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
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 AuctionConfigRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 商品id
*/
private Long itemId;
/**
* 竞拍开始时间
*/
private Date startTime;
/**
* 竞拍结束时间
*/
private Date endTime;
/**
* 起拍价
*/
private Long startPrice;
/**
* 加价幅度
*/
private Long addExtent;
/**
* 实际竞拍结束时间
*/
private Date realEndTime;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否有效
*/
private Boolean isValid;
}
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 AuctionRecordRequestDto extends BaseRequestDto implements Entity {
private Integer id;
/**
* 商品id
*/
private Long itemId;
/**
* 用户id
*/
private Long userId;
/**
* 微信openid
*/
private String userOpenId;
/**
* 出价
*/
private String price;
/**
* 出价时间
*/
private Date createTime;
/**
* 分享id
*/
private String shareRecordId;
/**
* 分享商id
*/
private Long distributorId;
/**
* 价格是否领先
*/
private Boolean isLead;
/**
* 分销订单号
*/
private String distributionOrderId;
/**
* 时间范围查询
*/
private Date queryStartTime;
/**
* 时间范围查询
*/
private Date queryEndTime;
}
...@@ -132,4 +132,15 @@ public class DistributionOrderRequestDto extends BaseRequestDto implements Entit ...@@ -132,4 +132,15 @@ public class DistributionOrderRequestDto extends BaseRequestDto implements Entit
* 退款接口请求秘钥 * 退款接口请求秘钥
*/ */
private String secret; private String secret;
private Date startTime;
private Date endTime;
/**
* 订单类型
* 1 一口价
* 2 竞价
*/
private Integer type;
} }
...@@ -4,6 +4,7 @@ import com.wwdz.ch.db.dto.request.BaseRequestDto; ...@@ -4,6 +4,7 @@ import com.wwdz.ch.db.dto.request.BaseRequestDto;
import com.xxdxxs.entity.Entity; import com.xxdxxs.entity.Entity;
import lombok.Data; import lombok.Data;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -34,11 +35,42 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity { ...@@ -34,11 +35,42 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
*/ */
private Integer stock; private Integer stock;
/**
* 进货价格
*前端传过来的单位是元,后台要处理为分
*/
private String supplyPrice;
/** /**
* 商品名称 * 商品名称
*/ */
private String name; private String name;
/**
* 置顶图片
*/
private String topImage;
/**
* 商品图片,分号分隔
*/
private String images;
/**
* 商品视频,分号分隔
*/
private String videos;
/**
* 限购数量
*/
private Integer buyLimitNum;
/**
* 商品详细介绍,是富文本格式
*/
private String description;
/** /**
* 分销价格,前端传过来的单位是元,后台要处理为分 * 分销价格,前端传过来的单位是元,后台要处理为分
*/ */
...@@ -75,4 +107,36 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity { ...@@ -75,4 +107,36 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
* 是否是店家 * 是否是店家
*/ */
private Boolean isShop; private Boolean isShop;
/**
* 商品类型1一口价2竞拍
*/
private Integer type;
/**
* 竞拍开始时间
*/
private String auctionStartTime;
/**
* 竞拍结束时间
*/
private String auctionEndTime;
/**
* 起拍价
* 单位元 需要转为分
*/
private String startPrice;
/**
* 加价幅度
* 单位元 需要转为分
*/
private String addExtent;
/**
* 实际竞拍结束时间
*/
private Date realEndTime;
} }
package com.wwdz.ch.db.impl.distribution;
import com.wwdz.ch.db.dao.distribution.AuctionConfigDao;
import com.wwdz.ch.db.dao.distribution.SupplierItemDao;
import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import com.wwdz.ch.db.domain.distribution.AuctionConfigExample;
import com.wwdz.ch.db.domain.distribution.DistributionOrderExample;
import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.mapper.distribution.AuctionConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.time.Duration;
import java.time.Instant;
import java.time.temporal.TemporalAmount;
import java.util.Date;
import java.util.List;
@Repository
public class AuctionConfigDaoImpl implements AuctionConfigDao {
@Autowired
AuctionConfigMapper auctionConfigMapper;
@Autowired
SupplierItemDao supplierItemDao;
@Override
public int insert(AuctionConfig auctionConfig) {
return auctionConfigMapper.insert(auctionConfig);
}
@Override
public int update(AuctionConfig auctionConfig) {
auctionConfig.setUpdateTime(new Date());
return auctionConfigMapper.updateByPrimaryKeySelective(auctionConfig);
}
@Override
public AuctionConfig findByItemId(long itemId) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
return auctionConfigMapper.selectOneByExample(example);
}
@Override
public List<AuctionConfig> findList(Date startTime, Date endTime) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andRealEndTimeGreaterThanOrEqualTo(startTime);
criteria.andRealEndTimeLessThanOrEqualTo(endTime);
criteria.andIsValidEqualTo(false);
return auctionConfigMapper.selectByExample(example);
}
@Override
public int updateRealEndTime(long itemId, Date realEndTime) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setUpdateTime(new Date());
auctionConfig.setRealEndTime(realEndTime);
return auctionConfigMapper.updateByExampleSelective(auctionConfig, example);
}
@Override
public List<AuctionConfig> findEndList() {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
Date now = new Date();
//查询截单时间一小时内的拍卖
Instant instant = now.toInstant().minus(Duration.ofHours(1));
Date time = Date.from(instant);
criteria.andRealEndTimeGreaterThanOrEqualTo(time);
criteria.andIsValidEqualTo(false);
criteria.andIsDealEqualTo(false);
return auctionConfigMapper.selectByExample(example);
}
@Override
public List<AuctionConfig> findTimeOutNotValidList() {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
Date now = new Date();
criteria.andRealEndTimeLessThanOrEqualTo(now);
criteria.andIsValidEqualTo(true);
return auctionConfigMapper.selectByExample(example);
}
@Override
public List<AuctionConfig> findAbortEndList() {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
Date now = new Date();
//查询即将在一小时内截单的拍卖
Instant instant = now.toInstant().plus(Duration.ofHours(1));
Date time = Date.from(instant);
criteria.andRealEndTimeLessThanOrEqualTo(time);
criteria.andIsValidEqualTo(true);
return auctionConfigMapper.selectByExample(example);
}
@Override
public int setEnd(long itemId) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setUpdateTime(new Date());
auctionConfig.setIsValid(false);
return auctionConfigMapper.updateByExampleSelective(auctionConfig, example);
}
@Override
public int setValid(long itemId) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setUpdateTime(new Date());
auctionConfig.setIsValid(true);
return auctionConfigMapper.updateByExampleSelective(auctionConfig, example);
}
@Override
public int setDeal(long itemId) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setUpdateTime(new Date());
auctionConfig.setIsDeal(true);
return auctionConfigMapper.updateByExampleSelective(auctionConfig, example);
}
}
package com.wwdz.ch.db.impl.distribution;
import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.dao.distribution.AuctionRecordDao;
import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.wwdz.ch.db.domain.distribution.AuctionRecordExample;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import com.wwdz.ch.db.mapper.distribution.AuctionRecordMapper;
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 AuctionRecordDaoImpl implements AuctionRecordDao {
@Autowired
AuctionRecordMapper auctionRecordMapper;
@Override
public int insert(AuctionRecord auctionRecord) {
return auctionRecordMapper.insert(auctionRecord);
}
@Override
public int updateNotLead(long itemId) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
AuctionRecord auctionRecord = new AuctionRecord();
auctionRecord.setIsLead(false);
return auctionRecordMapper.updateByExampleSelective(auctionRecord, example);
}
@Override
public int updateNotLeadById(int id) {
AuctionRecord auctionRecord = new AuctionRecord();
auctionRecord.setId(id);
auctionRecord.setIsLead(false);
return auctionRecordMapper.updateByPrimaryKeySelective(auctionRecord);
}
@Override
public List<AuctionRecord> find(AuctionRecordRequestDto dto) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getIsLead(), criteria::andIsLeadEqualTo);
return auctionRecordMapper.selectByExample(example);
}
@Override
public List<AuctionRecord> findByPage(AuctionRecordRequestDto dto) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getIsLead(), criteria::andIsLeadEqualTo);
example.setOrderByClause("create_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit());
return auctionRecordMapper.selectByExample(example);
}
@Override
public List<AuctionRecord> findByItemId(long itemId) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
example.setOrderByClause("create_time desc");
return auctionRecordMapper.selectByExample(example);
}
@Override
public AuctionRecord findLastedRecord(long itemId) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
criteria.andIsLeadEqualTo(true);
return auctionRecordMapper.selectOneByExample(example);
}
@Override
public AuctionRecord findFirstRecord(long itemId, long userId) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
criteria.andUserIdEqualTo(userId);
example.setOrderByClause("create_time asc");
return auctionRecordMapper.selectOneByExample(example);
}
@Override
public long count(AuctionRecordRequestDto dto) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
JdbcHelper.ifPresent(dto.getItemId(), criteria::andItemIdEqualTo);
JdbcHelper.ifPresent(dto.getUserId(), criteria::andUserIdEqualTo);
JdbcHelper.ifPresent(dto.getIsLead(), criteria::andIsLeadEqualTo);
return auctionRecordMapper.countByExample(example);
}
@Override
public List<AuctionRecord> findRecordByUserId(long userId, Date startTime, Date endTime) {
AuctionRecordExample example = new AuctionRecordExample();
AuctionRecordExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
criteria.andCreateTimeGreaterThanOrEqualTo(startTime);
criteria.andCreateTimeLessThanOrEqualTo(endTime);
example.setOrderByClause("create_time desc");
return auctionRecordMapper.selectByExample(example);
}
}
...@@ -43,6 +43,15 @@ public class DistributionOrderDaoImpl implements DistributionOrderDao { ...@@ -43,6 +43,15 @@ public class DistributionOrderDaoImpl implements DistributionOrderDao {
return distributionOrderMapper.selectOneByExample(example); return distributionOrderMapper.selectOneByExample(example);
} }
@Override
public DistributionOrder findByItemId(long itemId) {
DistributionOrderExample example = new DistributionOrderExample();
DistributionOrderExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
return distributionOrderMapper.selectOneByExample(example);
}
@Override @Override
public List<DistributionOrder> findByBuyerId(long buyerId) { public List<DistributionOrder> findByBuyerId(long buyerId) {
DistributionOrderExample example = new DistributionOrderExample(); DistributionOrderExample example = new DistributionOrderExample();
...@@ -92,8 +101,25 @@ public class DistributionOrderDaoImpl implements DistributionOrderDao { ...@@ -92,8 +101,25 @@ public class DistributionOrderDaoImpl implements DistributionOrderDao {
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
return distributionOrderMapper.selectByExample(example); return distributionOrderMapper.selectByExample(example);
}
@Override
public List<DistributionOrder> findList(Date startTime, Date endTime) {
DistributionOrderExample example = new DistributionOrderExample();
DistributionOrderExample.Criteria criteria = example.createCriteria();
//竞拍
criteria.andTypeEqualTo(2);
//待付款
criteria.andStateEqualTo(1);
criteria.andCreateTimeGreaterThanOrEqualTo(startTime);
criteria.andCreateTimeLessThanOrEqualTo(endTime);
criteria.andPayTimeIsNull();
return distributionOrderMapper.selectByExample(example);
}
@Override
public Long countSelledNum(long itemId) {
return distributionOrderMapper.countSelledNum(itemId);
} }
@Override @Override
...@@ -121,6 +147,10 @@ public class DistributionOrderDaoImpl implements DistributionOrderDao { ...@@ -121,6 +147,10 @@ public class DistributionOrderDaoImpl implements DistributionOrderDao {
criteria.andDistributionOrderIdEqualTo(distributionOrderId); criteria.andDistributionOrderIdEqualTo(distributionOrderId);
DistributionOrder distributionOrder = new DistributionOrder(); DistributionOrder distributionOrder = new DistributionOrder();
distributionOrder.setState(state); distributionOrder.setState(state);
//确认收货,更新完成时间
if (state == 100) {
distributionOrder.setFinishTime(new Date());
}
distributionOrder.setUpdateTime(new Date()); distributionOrder.setUpdateTime(new Date());
return distributionOrderMapper.updateByExampleSelective(distributionOrder, example) > 0; return distributionOrderMapper.updateByExampleSelective(distributionOrder, example) > 0;
} }
......
...@@ -44,6 +44,15 @@ public class DistributorProfitDaoImpl implements DistributorProfitDao { ...@@ -44,6 +44,15 @@ public class DistributorProfitDaoImpl implements DistributorProfitDao {
return distributorProfitMapper.selectOneByExample(example); return distributorProfitMapper.selectOneByExample(example);
} }
@Override
public DistributorProfit findByIdOfDistributor(String distributionOrderId, long distributorId) {
DistributorProfitExample example = new DistributorProfitExample();
DistributorProfitExample.Criteria criteria = example.createCriteria();
criteria.andDistributionOrderIdEqualTo(distributionOrderId);
criteria.andDistributorIdEqualTo(distributorId);
return distributorProfitMapper.selectOneByExample(example);
}
@Override @Override
public Long countSellItemNum(long distributorId) { public Long countSellItemNum(long distributorId) {
Long num = distributorProfitMapper.countSellItemNum(distributorId); Long num = distributorProfitMapper.countSellItemNum(distributorId);
......
...@@ -21,6 +21,12 @@ public class SupplierItemDaoImpl implements SupplierItemDao { ...@@ -21,6 +21,12 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
@Autowired @Autowired
SupplierItemMapper supplierItemMapper; SupplierItemMapper supplierItemMapper;
@Override
public long insert(SupplierItem supplierItem) {
supplierItemMapper.insert(supplierItem);
return supplierItem.getId();
}
@Override @Override
public List<SupplierItem> findList(SupplierItemRequestDto dto) { public List<SupplierItem> findList(SupplierItemRequestDto dto) {
SupplierItemExample supplierItemExample = new SupplierItemExample(); SupplierItemExample supplierItemExample = new SupplierItemExample();
...@@ -30,10 +36,11 @@ public class SupplierItemDaoImpl implements SupplierItemDao { ...@@ -30,10 +36,11 @@ public class SupplierItemDaoImpl implements SupplierItemDao {
if (StringUtils.hasLength(dto.getName())) { if (StringUtils.hasLength(dto.getName())) {
criteria.andNameLike("%" + dto.getName() + "%"); criteria.andNameLike("%" + dto.getName() + "%");
} }
JdbcHelper.ifPresent(dto.getType(), criteria::andTypeEqualTo);
JdbcHelper.ifPresent(dto.getStock(), criteria::andStockGreaterThan); JdbcHelper.ifPresent(dto.getStock(), criteria::andStockGreaterThan);
JdbcHelper.ifPresent(dto.getIsOnSale(), criteria::andIsOnSaleEqualTo); JdbcHelper.ifPresent(dto.getIsOnSale(), criteria::andIsOnSaleEqualTo);
JdbcHelper.ifPresent(dto.getIsDeleted(), criteria::andIsDeletedEqualTo); JdbcHelper.ifPresent(dto.getIsDeleted(), criteria::andIsDeletedEqualTo);
supplierItemExample.setOrderByClause(" id desc"); supplierItemExample.setOrderByClause(" update_time desc");
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
return supplierItemMapper.selectByExampleWithBLOBs(supplierItemExample); return supplierItemMapper.selectByExampleWithBLOBs(supplierItemExample);
} }
......
package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import com.wwdz.ch.db.domain.distribution.AuctionConfigExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface AuctionConfigMapper {
long countByExample(AuctionConfigExample example);
int deleteByExample(AuctionConfigExample example);
int deleteByPrimaryKey(Integer id);
int insert(AuctionConfig record);
int insertSelective(AuctionConfig record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
AuctionConfig selectOneByExample(AuctionConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
AuctionConfig selectOneByExampleSelective(@Param("example") AuctionConfigExample example, @Param("selective") AuctionConfig.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<AuctionConfig> selectByExampleSelective(@Param("example") AuctionConfigExample example, @Param("selective") AuctionConfig.Column ... selective);
List<AuctionConfig> selectByExample(AuctionConfigExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_config
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
AuctionConfig selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") AuctionConfig.Column ... selective);
AuctionConfig selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") AuctionConfig record, @Param("example") AuctionConfigExample example);
int updateByExample(@Param("record") AuctionConfig record, @Param("example") AuctionConfigExample example);
int updateByPrimaryKeySelective(AuctionConfig record);
int updateByPrimaryKey(AuctionConfig record);
}
\ No newline at end of file
package com.wwdz.ch.db.mapper.distribution;
import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.wwdz.ch.db.domain.distribution.AuctionRecordExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface AuctionRecordMapper {
long countByExample(AuctionRecordExample example);
int deleteByExample(AuctionRecordExample example);
int deleteByPrimaryKey(Integer id);
int insert(AuctionRecord record);
int insertSelective(AuctionRecord record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
AuctionRecord selectOneByExample(AuctionRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
AuctionRecord selectOneByExampleSelective(@Param("example") AuctionRecordExample example, @Param("selective") AuctionRecord.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
List<AuctionRecord> selectByExampleSelective(@Param("example") AuctionRecordExample example, @Param("selective") AuctionRecord.Column ... selective);
List<AuctionRecord> selectByExample(AuctionRecordExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table auction_record
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
AuctionRecord selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") AuctionRecord.Column ... selective);
AuctionRecord selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") AuctionRecord record, @Param("example") AuctionRecordExample example);
int updateByExample(@Param("record") AuctionRecord record, @Param("example") AuctionRecordExample example);
int updateByPrimaryKeySelective(AuctionRecord record);
int updateByPrimaryKey(AuctionRecord record);
List<Long> findItemsOfRecord(@Param("itemId")Long userId);
}
\ No newline at end of file
...@@ -82,4 +82,7 @@ public interface DistributionOrderMapper { ...@@ -82,4 +82,7 @@ public interface DistributionOrderMapper {
*/ */
List<DistributionOrderNum> countGroupByStateForUser(@Param("buyerId")Long userId); List<DistributionOrderNum> countGroupByStateForUser(@Param("buyerId")Long userId);
Long countSelledNum(@Param("itemId")Long itemId);
} }
\ No newline at end of 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.wwdz.ch.db.mapper.distribution.AuctionConfigMapper">
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.distribution.AuctionConfig">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="item_id" jdbcType="BIGINT" property="itemId" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="start_price" jdbcType="BIGINT" property="startPrice" />
<result column="add_extent" jdbcType="BIGINT" property="addExtent" />
<result column="real_end_time" jdbcType="TIMESTAMP" property="realEndTime" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_valid" jdbcType="BIT" property="isValid" />
<result column="is_deal" jdbcType="BIT" property="isDeal" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time,
update_time, is_valid, is_deal
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from auction_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<if test="example.distinct">
distinct
</if>
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time,
update_time, is_valid, is_deal
</otherwise>
</choose>
from auction_config
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from auction_config
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time,
update_time, is_valid, is_deal
</otherwise>
</choose>
from auction_config
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from auction_config
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample">
delete from auction_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfig">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into auction_config (item_id, start_time, end_time,
start_price, add_extent, real_end_time,
create_time, update_time, is_valid,
is_deal)
values (#{itemId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{startPrice,jdbcType=BIGINT}, #{addExtent,jdbcType=BIGINT}, #{realEndTime,jdbcType=TIMESTAMP},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=BIT},
#{isDeal,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfig">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into auction_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="itemId != null">
item_id,
</if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="startPrice != null">
start_price,
</if>
<if test="addExtent != null">
add_extent,
</if>
<if test="realEndTime != null">
real_end_time,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="isValid != null">
is_valid,
</if>
<if test="isDeal != null">
is_deal,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="itemId != null">
#{itemId,jdbcType=BIGINT},
</if>
<if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="startPrice != null">
#{startPrice,jdbcType=BIGINT},
</if>
<if test="addExtent != null">
#{addExtent,jdbcType=BIGINT},
</if>
<if test="realEndTime != null">
#{realEndTime,jdbcType=TIMESTAMP},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isValid != null">
#{isValid,jdbcType=BIT},
</if>
<if test="isDeal != null">
#{isDeal,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultType="java.lang.Long">
select count(*) from auction_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update auction_config
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.itemId != null">
item_id = #{record.itemId,jdbcType=BIGINT},
</if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=TIMESTAMP},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=TIMESTAMP},
</if>
<if test="record.startPrice != null">
start_price = #{record.startPrice,jdbcType=BIGINT},
</if>
<if test="record.addExtent != null">
add_extent = #{record.addExtent,jdbcType=BIGINT},
</if>
<if test="record.realEndTime != null">
real_end_time = #{record.realEndTime,jdbcType=TIMESTAMP},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.isValid != null">
is_valid = #{record.isValid,jdbcType=BIT},
</if>
<if test="record.isDeal != null">
is_deal = #{record.isDeal,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update auction_config
set id = #{record.id,jdbcType=INTEGER},
item_id = #{record.itemId,jdbcType=BIGINT},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
start_price = #{record.startPrice,jdbcType=BIGINT},
add_extent = #{record.addExtent,jdbcType=BIGINT},
real_end_time = #{record.realEndTime,jdbcType=TIMESTAMP},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_valid = #{record.isValid,jdbcType=BIT},
is_deal = #{record.isDeal,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfig">
update auction_config
<set>
<if test="itemId != null">
item_id = #{itemId,jdbcType=BIGINT},
</if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="startPrice != null">
start_price = #{startPrice,jdbcType=BIGINT},
</if>
<if test="addExtent != null">
add_extent = #{addExtent,jdbcType=BIGINT},
</if>
<if test="realEndTime != null">
real_end_time = #{realEndTime,jdbcType=TIMESTAMP},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isValid != null">
is_valid = #{isValid,jdbcType=BIT},
</if>
<if test="isDeal != null">
is_deal = #{isDeal,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfig">
update auction_config
set item_id = #{itemId,jdbcType=BIGINT},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
start_price = #{startPrice,jdbcType=BIGINT},
add_extent = #{addExtent,jdbcType=BIGINT},
real_end_time = #{realEndTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_valid = #{isValid,jdbcType=BIT},
is_deal = #{isDeal,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<include refid="Base_Column_List" />
from auction_config
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time,
update_time, is_valid, is_deal
</otherwise>
</choose>
from auction_config
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
limit 1
</select>
</mapper>
\ No newline at end of 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.wwdz.ch.db.mapper.distribution.AuctionRecordMapper">
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.distribution.AuctionRecord">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="item_id" jdbcType="BIGINT" property="itemId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="user_open_id" jdbcType="VARCHAR" property="userOpenId" />
<result column="price" jdbcType="BIGINT" property="price" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="share_record_id" jdbcType="VARCHAR" property="shareRecordId" />
<result column="distributor_id" jdbcType="BIGINT" property="distributorId" />
<result column="is_lead" jdbcType="BIT" property="isLead" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, item_id, user_id, user_open_id, price, create_time, share_record_id, distributor_id,
is_lead
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionRecordExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
'true' as QUERYID,
<include refid="Base_Column_List" />
from auction_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<if test="example.distinct">
distinct
</if>
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, item_id, user_id, user_open_id, price, create_time, share_record_id, distributor_id,
is_lead
</otherwise>
</choose>
from auction_record
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from auction_record
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, item_id, user_id, user_open_id, price, create_time, share_record_id, distributor_id,
is_lead
</otherwise>
</choose>
from auction_record
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from auction_record
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionRecordExample">
delete from auction_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.wwdz.ch.db.domain.distribution.AuctionRecord">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into auction_record (item_id, user_id, user_open_id,
price, create_time, share_record_id,
distributor_id, is_lead)
values (#{itemId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{userOpenId,jdbcType=VARCHAR},
#{price,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{shareRecordId,jdbcType=VARCHAR},
#{distributorId,jdbcType=BIGINT}, #{isLead,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.AuctionRecord">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into auction_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="itemId != null">
item_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="userOpenId != null">
user_open_id,
</if>
<if test="price != null">
price,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="shareRecordId != null">
share_record_id,
</if>
<if test="distributorId != null">
distributor_id,
</if>
<if test="isLead != null">
is_lead,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="itemId != null">
#{itemId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="userOpenId != null">
#{userOpenId,jdbcType=VARCHAR},
</if>
<if test="price != null">
#{price,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="shareRecordId != null">
#{shareRecordId,jdbcType=VARCHAR},
</if>
<if test="distributorId != null">
#{distributorId,jdbcType=BIGINT},
</if>
<if test="isLead != null">
#{isLead,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionRecordExample" resultType="java.lang.Long">
select count(*) from auction_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update auction_record
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=INTEGER},
</if>
<if test="record.itemId != null">
item_id = #{record.itemId,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.userOpenId != null">
user_open_id = #{record.userOpenId,jdbcType=VARCHAR},
</if>
<if test="record.price != null">
price = #{record.price,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.shareRecordId != null">
share_record_id = #{record.shareRecordId,jdbcType=VARCHAR},
</if>
<if test="record.distributorId != null">
distributor_id = #{record.distributorId,jdbcType=BIGINT},
</if>
<if test="record.isLead != null">
is_lead = #{record.isLead,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update auction_record
set id = #{record.id,jdbcType=INTEGER},
item_id = #{record.itemId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
user_open_id = #{record.userOpenId,jdbcType=VARCHAR},
price = #{record.price,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
share_record_id = #{record.shareRecordId,jdbcType=VARCHAR},
distributor_id = #{record.distributorId,jdbcType=BIGINT},
is_lead = #{record.isLead,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.wwdz.ch.db.domain.distribution.AuctionRecord">
update auction_record
<set>
<if test="itemId != null">
item_id = #{itemId,jdbcType=BIGINT},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="userOpenId != null">
user_open_id = #{userOpenId,jdbcType=VARCHAR},
</if>
<if test="price != null">
price = #{price,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="shareRecordId != null">
share_record_id = #{shareRecordId,jdbcType=VARCHAR},
</if>
<if test="distributorId != null">
distributor_id = #{distributorId,jdbcType=BIGINT},
</if>
<if test="isLead != null">
is_lead = #{isLead,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.distribution.AuctionRecord">
update auction_record
set item_id = #{itemId,jdbcType=BIGINT},
user_id = #{userId,jdbcType=BIGINT},
user_open_id = #{userOpenId,jdbcType=VARCHAR},
price = #{price,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
share_record_id = #{shareRecordId,jdbcType=VARCHAR},
distributor_id = #{distributorId,jdbcType=BIGINT},
is_lead = #{isLead,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionRecordExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<include refid="Base_Column_List" />
from auction_record
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
limit 1
</select>
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
@project https://github.com/itfsw/mybatis-generator-plugin
-->
select
'true' as QUERYID,
<choose>
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, item_id, user_id, user_open_id, price, create_time, share_record_id, distributor_id,
is_lead
</otherwise>
</choose>
from auction_record
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
<if test="example.orderByClause != null">
order by ${example.orderByClause}
</if>
limit 1
</select>
<select id="findItemsOfRecord" parameterType="java.lang.Long" resultType="java.lang.Long">
select DISTINCT(`item_id`) from `auction_record` where user_id = = #{userId} order by create_time desc
</select>
</mapper>
\ No newline at end of file
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="share_record_id" jdbcType="VARCHAR" property="shareRecordId" /> <result column="share_record_id" jdbcType="VARCHAR" property="shareRecordId" />
<result column="state" jdbcType="INTEGER" property="state" /> <result column="state" jdbcType="INTEGER" property="state" />
<result column="type" jdbcType="INTEGER" property="type" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -89,7 +90,7 @@ ...@@ -89,7 +90,7 @@
id, distribution_order_id, prepay_id, transaction_id, item_id, item_num, buyer_id, id, distribution_order_id, prepay_id, transaction_id, item_id, item_num, buyer_id,
buyer_openid, shop_id, seller_id, amount, address_id, receiver_name, receiver_phone, buyer_openid, shop_id, seller_id, amount, address_id, receiver_name, receiver_phone,
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time, receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
finish_time, update_time, share_record_id, `state` finish_time, update_time, share_record_id, `state`, `type`
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultMap="BaseResultMap">
select select
...@@ -127,7 +128,7 @@ ...@@ -127,7 +128,7 @@
id, distribution_order_id, prepay_id, transaction_id, item_id, item_num, buyer_id, id, distribution_order_id, prepay_id, transaction_id, item_id, item_num, buyer_id,
buyer_openid, shop_id, seller_id, amount, address_id, receiver_name, receiver_phone, buyer_openid, shop_id, seller_id, amount, address_id, receiver_name, receiver_phone,
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time, receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
finish_time, update_time, share_record_id, `state` finish_time, update_time, share_record_id, `state`, `type`
</otherwise> </otherwise>
</choose> </choose>
from distribution_order from distribution_order
...@@ -161,7 +162,7 @@ ...@@ -161,7 +162,7 @@
id, distribution_order_id, prepay_id, transaction_id, item_id, item_num, buyer_id, id, distribution_order_id, prepay_id, transaction_id, item_id, item_num, buyer_id,
buyer_openid, shop_id, seller_id, amount, address_id, receiver_name, receiver_phone, buyer_openid, shop_id, seller_id, amount, address_id, receiver_name, receiver_phone,
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time, receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
finish_time, update_time, share_record_id, `state` finish_time, update_time, share_record_id, `state`, `type`
</otherwise> </otherwise>
</choose> </choose>
from distribution_order from distribution_order
...@@ -188,7 +189,8 @@ ...@@ -188,7 +189,8 @@
receiver_phone, receiver_address, logistics_code, receiver_phone, receiver_address, logistics_code,
waybill, create_time, pay_time, waybill, create_time, pay_time,
delivery_time, finish_time, update_time, delivery_time, finish_time, update_time,
share_record_id, `state`) share_record_id, `state`, `type`
)
values (#{distributionOrderId,jdbcType=VARCHAR}, #{prepayId,jdbcType=VARCHAR}, #{transactionId,jdbcType=VARCHAR}, values (#{distributionOrderId,jdbcType=VARCHAR}, #{prepayId,jdbcType=VARCHAR}, #{transactionId,jdbcType=VARCHAR},
#{itemId,jdbcType=BIGINT}, #{itemNum,jdbcType=INTEGER}, #{buyerId,jdbcType=BIGINT}, #{itemId,jdbcType=BIGINT}, #{itemNum,jdbcType=INTEGER}, #{buyerId,jdbcType=BIGINT},
#{buyerOpenid,jdbcType=VARCHAR}, #{shopId,jdbcType=BIGINT}, #{sellerId,jdbcType=BIGINT}, #{buyerOpenid,jdbcType=VARCHAR}, #{shopId,jdbcType=BIGINT}, #{sellerId,jdbcType=BIGINT},
...@@ -196,7 +198,8 @@ ...@@ -196,7 +198,8 @@
#{receiverPhone,jdbcType=VARCHAR}, #{receiverAddress,jdbcType=VARCHAR}, #{logisticsCode,jdbcType=VARCHAR}, #{receiverPhone,jdbcType=VARCHAR}, #{receiverAddress,jdbcType=VARCHAR}, #{logisticsCode,jdbcType=VARCHAR},
#{waybill,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP}, #{waybill,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP},
#{deliveryTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deliveryTime,jdbcType=TIMESTAMP}, #{finishTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{shareRecordId,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}) #{shareRecordId,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}
)
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrder"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrder">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
...@@ -273,6 +276,9 @@ ...@@ -273,6 +276,9 @@
<if test="state != null"> <if test="state != null">
`state`, `state`,
</if> </if>
<if test="type != null">
`type`,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="distributionOrderId != null"> <if test="distributionOrderId != null">
...@@ -344,6 +350,9 @@ ...@@ -344,6 +350,9 @@
<if test="state != null"> <if test="state != null">
#{state,jdbcType=INTEGER}, #{state,jdbcType=INTEGER},
</if> </if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultType="java.lang.Long">
...@@ -427,6 +436,9 @@ ...@@ -427,6 +436,9 @@
<if test="record.state != null"> <if test="record.state != null">
`state` = #{record.state,jdbcType=INTEGER}, `state` = #{record.state,jdbcType=INTEGER},
</if> </if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -457,7 +469,8 @@ ...@@ -457,7 +469,8 @@
finish_time = #{record.finishTime,jdbcType=TIMESTAMP}, finish_time = #{record.finishTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
share_record_id = #{record.shareRecordId,jdbcType=VARCHAR}, share_record_id = #{record.shareRecordId,jdbcType=VARCHAR},
`state` = #{record.state,jdbcType=INTEGER} `state` = #{record.state,jdbcType=INTEGER},
`type` = #{record.type,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -534,6 +547,9 @@ ...@@ -534,6 +547,9 @@
<if test="state != null"> <if test="state != null">
`state` = #{state,jdbcType=INTEGER}, `state` = #{state,jdbcType=INTEGER},
</if> </if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -561,7 +577,8 @@ ...@@ -561,7 +577,8 @@
finish_time = #{finishTime,jdbcType=TIMESTAMP}, finish_time = #{finishTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
share_record_id = #{shareRecordId,jdbcType=VARCHAR}, share_record_id = #{shareRecordId,jdbcType=VARCHAR},
`state` = #{state,jdbcType=INTEGER} `state` = #{state,jdbcType=INTEGER},
`type` = #{type,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributionOrderExample" resultMap="BaseResultMap">
...@@ -600,7 +617,7 @@ ...@@ -600,7 +617,7 @@
id, distribution_order_id, prepay_id, transaction_id, item_id, item_num, buyer_id, id, distribution_order_id, prepay_id, transaction_id, item_id, item_num, buyer_id,
buyer_openid, shop_id, seller_id, amount, address_id, receiver_name, receiver_phone, buyer_openid, shop_id, seller_id, amount, address_id, receiver_name, receiver_phone,
receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time, receiver_address, logistics_code, waybill, create_time, pay_time, delivery_time,
finish_time, update_time, share_record_id, `state` finish_time, update_time, share_record_id, `state`, `type`
</otherwise> </otherwise>
</choose> </choose>
from distribution_order from distribution_order
...@@ -613,7 +630,6 @@ ...@@ -613,7 +630,6 @@
limit 1 limit 1
</select> </select>
<select id="countGroupByStateForDistributor" parameterType="java.lang.Long" resultType="com.wwdz.ch.db.bean.DistributionOrderNum"> <select id="countGroupByStateForDistributor" parameterType="java.lang.Long" resultType="com.wwdz.ch.db.bean.DistributionOrderNum">
select state, count(distribution_order_id) as num from distribution_order where seller_id = #{sellerId} group by state select state, count(distribution_order_id) as num from distribution_order where seller_id = #{sellerId} group by state
</select> </select>
...@@ -621,4 +637,8 @@ ...@@ -621,4 +637,8 @@
<select id="countGroupByStateForUser" parameterType="java.lang.Long" resultType="com.wwdz.ch.db.bean.DistributionOrderNum"> <select id="countGroupByStateForUser" parameterType="java.lang.Long" resultType="com.wwdz.ch.db.bean.DistributionOrderNum">
select state, count(distribution_order_id) as num from distribution_order where buyer_id = #{buyerId} group by state select state, count(distribution_order_id) as num from distribution_order where buyer_id = #{buyerId} group by state
</select> </select>
<select id="countSelledNum" parameterType="java.lang.Long" resultType="java.lang.Long">
select sum(item_num) as selledNum from distribution_order where item_id = #{itemId} and state not in (1, 101)
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<result column="shop_id" jdbcType="BIGINT" property="shopId" /> <result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="enabled" jdbcType="BIT" property="enabled" /> <result column="enabled" jdbcType="BIT" property="enabled" />
<result column="type" jdbcType="INTEGER" property="type" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -70,7 +71,7 @@ ...@@ -70,7 +71,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, share_id, item_id, price, distributor_id, shop_id, create_time, enabled id, share_id, item_id, price, distributor_id, shop_id, create_time, enabled, `type`
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributorShareRecordExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributorShareRecordExample" resultMap="BaseResultMap">
select select
...@@ -105,7 +106,8 @@ ...@@ -105,7 +106,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, share_id, item_id, price, distributor_id, shop_id, create_time, enabled id, share_id, item_id, price, distributor_id, shop_id, create_time, enabled, `type`
</otherwise> </otherwise>
</choose> </choose>
from distributor_share_record from distributor_share_record
...@@ -136,7 +138,8 @@ ...@@ -136,7 +138,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, share_id, item_id, price, distributor_id, shop_id, create_time, enabled id, share_id, item_id, price, distributor_id, shop_id, create_time, enabled, `type`
</otherwise> </otherwise>
</choose> </choose>
from distributor_share_record from distributor_share_record
...@@ -158,10 +161,10 @@ ...@@ -158,10 +161,10 @@
</selectKey> </selectKey>
insert into distributor_share_record (share_id, item_id, price, insert into distributor_share_record (share_id, item_id, price,
distributor_id, shop_id, create_time, distributor_id, shop_id, create_time,
enabled) enabled, `type`)
values (#{shareId,jdbcType=VARCHAR}, #{itemId,jdbcType=BIGINT}, #{price,jdbcType=BIGINT}, values (#{shareId,jdbcType=VARCHAR}, #{itemId,jdbcType=BIGINT}, #{price,jdbcType=BIGINT},
#{distributorId,jdbcType=BIGINT}, #{shopId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{distributorId,jdbcType=BIGINT}, #{shopId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{enabled,jdbcType=BIT}) #{enabled,jdbcType=BIT}, #{type,jdbcType=INTEGER})
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.DistributorShareRecord"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.DistributorShareRecord">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
...@@ -190,6 +193,9 @@ ...@@ -190,6 +193,9 @@
<if test="enabled != null"> <if test="enabled != null">
enabled, enabled,
</if> </if>
<if test="type != null">
`type`,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="shareId != null"> <if test="shareId != null">
...@@ -213,6 +219,9 @@ ...@@ -213,6 +219,9 @@
<if test="enabled != null"> <if test="enabled != null">
#{enabled,jdbcType=BIT}, #{enabled,jdbcType=BIT},
</if> </if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributorShareRecordExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributorShareRecordExample" resultType="java.lang.Long">
...@@ -248,6 +257,9 @@ ...@@ -248,6 +257,9 @@
<if test="record.enabled != null"> <if test="record.enabled != null">
enabled = #{record.enabled,jdbcType=BIT}, enabled = #{record.enabled,jdbcType=BIT},
</if> </if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
...@@ -262,7 +274,8 @@ ...@@ -262,7 +274,8 @@
distributor_id = #{record.distributorId,jdbcType=BIGINT}, distributor_id = #{record.distributorId,jdbcType=BIGINT},
shop_id = #{record.shopId,jdbcType=BIGINT}, shop_id = #{record.shopId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
enabled = #{record.enabled,jdbcType=BIT} enabled = #{record.enabled,jdbcType=BIT},
`type` = #{record.type,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -291,6 +304,9 @@ ...@@ -291,6 +304,9 @@
<if test="enabled != null"> <if test="enabled != null">
enabled = #{enabled,jdbcType=BIT}, enabled = #{enabled,jdbcType=BIT},
</if> </if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -302,7 +318,8 @@ ...@@ -302,7 +318,8 @@
distributor_id = #{distributorId,jdbcType=BIGINT}, distributor_id = #{distributorId,jdbcType=BIGINT},
shop_id = #{shopId,jdbcType=BIGINT}, shop_id = #{shopId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
enabled = #{enabled,jdbcType=BIT} enabled = #{enabled,jdbcType=BIT},
`type` = #{type,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributorShareRecordExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.DistributorShareRecordExample" resultMap="BaseResultMap">
...@@ -338,7 +355,8 @@ ...@@ -338,7 +355,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, share_id, item_id, price, distributor_id, shop_id, create_time, enabled id, share_id, item_id, price, distributor_id, shop_id, create_time, enabled, `type`
</otherwise> </otherwise>
</choose> </choose>
from distributor_share_record from distributor_share_record
...@@ -351,7 +369,7 @@ ...@@ -351,7 +369,7 @@
limit 1 limit 1
</select> </select>
<select id="findMaxPriceRecord" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="findMaxPriceRecord" parameterType="java.lang.Long" resultMap="BaseResultMap">
SELECT d.* SELECT d.*
FROM distributor_share_record d FROM distributor_share_record d
JOIN JOIN
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" /> <result column="is_deleted" jdbcType="BIT" property="isDeleted" />
<result column="buy_limit_num" jdbcType="INTEGER" property="buyLimitNum" /> <result column="buy_limit_num" jdbcType="INTEGER" property="buyLimitNum" />
<result column="type" jdbcType="INTEGER" property="type" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.wwdz.ch.db.domain.distribution.SupplierItem"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.wwdz.ch.db.domain.distribution.SupplierItem">
<result column="images" jdbcType="LONGVARCHAR" property="images" /> <result column="images" jdbcType="LONGVARCHAR" property="images" />
...@@ -81,7 +82,7 @@ ...@@ -81,7 +82,7 @@
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price, id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price,
stock, create_time, update_time, is_deleted, buy_limit_num stock, create_time, update_time, is_deleted, buy_limit_num, `type`
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
images, videos, description images, videos, description
...@@ -137,8 +138,8 @@ ...@@ -137,8 +138,8 @@
</when> </when>
<otherwise> <otherwise>
id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price, id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price,
stock, create_time, update_time, is_deleted, buy_limit_num, images, videos, description stock, create_time, update_time, is_deleted, buy_limit_num, `type`, images, videos,
description
</otherwise> </otherwise>
</choose> </choose>
from supplier_item from supplier_item
...@@ -172,8 +173,8 @@ ...@@ -172,8 +173,8 @@
</when> </when>
<otherwise> <otherwise>
id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price, id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price,
stock, create_time, update_time, is_deleted, buy_limit_num, images, videos, description stock, create_time, update_time, is_deleted, buy_limit_num, `type`, images, videos,
description
</otherwise> </otherwise>
</choose> </choose>
from supplier_item from supplier_item
...@@ -197,14 +198,14 @@ ...@@ -197,14 +198,14 @@
sort, top_image, distribution_price, sort, top_image, distribution_price,
supply_price, stock, create_time, supply_price, stock, create_time,
update_time, is_deleted, buy_limit_num, update_time, is_deleted, buy_limit_num,
images, videos, description `type`, images, videos,
) description)
values (#{name,jdbcType=VARCHAR}, #{supplierId,jdbcType=BIGINT}, #{isOnSale,jdbcType=BIT}, values (#{name,jdbcType=VARCHAR}, #{supplierId,jdbcType=BIGINT}, #{isOnSale,jdbcType=BIT},
#{sort,jdbcType=INTEGER}, #{topImage,jdbcType=VARCHAR}, #{distributionPrice,jdbcType=BIGINT}, #{sort,jdbcType=INTEGER}, #{topImage,jdbcType=VARCHAR}, #{distributionPrice,jdbcType=BIGINT},
#{supplyPrice,jdbcType=BIGINT}, #{stock,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{supplyPrice,jdbcType=BIGINT}, #{stock,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{isDeleted,jdbcType=BIT}, #{buyLimitNum,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{isDeleted,jdbcType=BIT}, #{buyLimitNum,jdbcType=INTEGER},
#{images,jdbcType=LONGVARCHAR}, #{videos,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR} #{type,jdbcType=INTEGER}, #{images,jdbcType=LONGVARCHAR}, #{videos,jdbcType=LONGVARCHAR},
) #{description,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.SupplierItem"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.SupplierItem">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
...@@ -248,6 +249,9 @@ ...@@ -248,6 +249,9 @@
<if test="buyLimitNum != null"> <if test="buyLimitNum != null">
buy_limit_num, buy_limit_num,
</if> </if>
<if test="type != null">
`type`,
</if>
<if test="images != null"> <if test="images != null">
images, images,
</if> </if>
...@@ -295,6 +299,9 @@ ...@@ -295,6 +299,9 @@
<if test="buyLimitNum != null"> <if test="buyLimitNum != null">
#{buyLimitNum,jdbcType=INTEGER}, #{buyLimitNum,jdbcType=INTEGER},
</if> </if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
<if test="images != null"> <if test="images != null">
#{images,jdbcType=LONGVARCHAR}, #{images,jdbcType=LONGVARCHAR},
</if> </if>
...@@ -354,6 +361,9 @@ ...@@ -354,6 +361,9 @@
<if test="record.buyLimitNum != null"> <if test="record.buyLimitNum != null">
buy_limit_num = #{record.buyLimitNum,jdbcType=INTEGER}, buy_limit_num = #{record.buyLimitNum,jdbcType=INTEGER},
</if> </if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
</if>
<if test="record.images != null"> <if test="record.images != null">
images = #{record.images,jdbcType=LONGVARCHAR}, images = #{record.images,jdbcType=LONGVARCHAR},
</if> </if>
...@@ -383,6 +393,7 @@ ...@@ -383,6 +393,7 @@
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_deleted = #{record.isDeleted,jdbcType=BIT}, is_deleted = #{record.isDeleted,jdbcType=BIT},
buy_limit_num = #{record.buyLimitNum,jdbcType=INTEGER}, buy_limit_num = #{record.buyLimitNum,jdbcType=INTEGER},
`type` = #{record.type,jdbcType=INTEGER},
images = #{record.images,jdbcType=LONGVARCHAR}, images = #{record.images,jdbcType=LONGVARCHAR},
videos = #{record.videos,jdbcType=LONGVARCHAR}, videos = #{record.videos,jdbcType=LONGVARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR} description = #{record.description,jdbcType=LONGVARCHAR}
...@@ -404,7 +415,8 @@ ...@@ -404,7 +415,8 @@
create_time = #{record.createTime,jdbcType=TIMESTAMP}, create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update_time = #{record.updateTime,jdbcType=TIMESTAMP},
is_deleted = #{record.isDeleted,jdbcType=BIT}, is_deleted = #{record.isDeleted,jdbcType=BIT},
buy_limit_num = #{record.buyLimitNum,jdbcType=INTEGER} buy_limit_num = #{record.buyLimitNum,jdbcType=INTEGER},
`type` = #{record.type,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
...@@ -448,6 +460,9 @@ ...@@ -448,6 +460,9 @@
<if test="buyLimitNum != null"> <if test="buyLimitNum != null">
buy_limit_num = #{buyLimitNum,jdbcType=INTEGER}, buy_limit_num = #{buyLimitNum,jdbcType=INTEGER},
</if> </if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
</if>
<if test="images != null"> <if test="images != null">
images = #{images,jdbcType=LONGVARCHAR}, images = #{images,jdbcType=LONGVARCHAR},
</if> </if>
...@@ -474,6 +489,7 @@ ...@@ -474,6 +489,7 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
is_deleted = #{isDeleted,jdbcType=BIT}, is_deleted = #{isDeleted,jdbcType=BIT},
buy_limit_num = #{buyLimitNum,jdbcType=INTEGER}, buy_limit_num = #{buyLimitNum,jdbcType=INTEGER},
`type` = #{type,jdbcType=INTEGER},
images = #{images,jdbcType=LONGVARCHAR}, images = #{images,jdbcType=LONGVARCHAR},
videos = #{videos,jdbcType=LONGVARCHAR}, videos = #{videos,jdbcType=LONGVARCHAR},
description = #{description,jdbcType=LONGVARCHAR} description = #{description,jdbcType=LONGVARCHAR}
...@@ -492,7 +508,8 @@ ...@@ -492,7 +508,8 @@
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
is_deleted = #{isDeleted,jdbcType=BIT}, is_deleted = #{isDeleted,jdbcType=BIT},
buy_limit_num = #{buyLimitNum,jdbcType=INTEGER} buy_limit_num = #{buyLimitNum,jdbcType=INTEGER},
`type` = #{type,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.SupplierItemExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.SupplierItemExample" resultMap="BaseResultMap">
...@@ -549,8 +566,8 @@ ...@@ -549,8 +566,8 @@
</when> </when>
<otherwise> <otherwise>
id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price, id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price,
stock, create_time, update_time, is_deleted, buy_limit_num, images, videos, description stock, create_time, update_time, is_deleted, buy_limit_num, `type`, images, videos,
description
</otherwise> </otherwise>
</choose> </choose>
from supplier_item from supplier_item
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution" <javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/> targetProject="ch-dao/src/main/java"/>
<table tableName="refund_order" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> <table tableName="auction_config" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" /> <generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table> </table>
......
...@@ -138,9 +138,18 @@ public class WxPayCallbackController { ...@@ -138,9 +138,18 @@ public class WxPayCallbackController {
//查询系统中订单现在的状态,避免重复更新 //查询系统中订单现在的状态,避免重复更新
DistributionOrder distributionOrder = distributionOrderDao.findById(distributionOrderId); DistributionOrder distributionOrder = distributionOrderDao.findById(distributionOrderId);
if (distributionOrder.getState() == DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode()) { if (distributionOrder.getState() == DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode()) {
Result updateResult = updateOrderStateAndInsertProfit(transaction); //一口价处理逻辑
if (!updateResult.getSuccess()) { if (distributionOrder.getType() == DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode()) {
return JsonUtils.from(returnMap); Result updateResult = updateOrderStateAndInsertProfit(transaction);
if (!updateResult.getSuccess()) {
return JsonUtils.from(returnMap);
}
} else {
//竞拍订单处理
Result updateResult = handleAuctionOrder(transaction);
if (!updateResult.getSuccess()) {
return JsonUtils.from(returnMap);
}
} }
} }
} }
...@@ -224,6 +233,52 @@ public class WxPayCallbackController { ...@@ -224,6 +233,52 @@ public class WxPayCallbackController {
public Result handleAuctionOrder(Transaction transaction) {
try {
//商户订单号,分销订单号
String distributionOrderId = transaction.getOutTradeNo();
//微信支付交易id
String transactionId = transaction.getTransactionId();
//支付成功时间
String payTime = transaction.getSuccessTime();
//支付成功,更新订单状态为待发货
DistributionOrder distributionOrderDto = new DistributionOrder();
distributionOrderDto.setDistributionOrderId(distributionOrderId);
distributionOrderDto.setTransactionId(transactionId);
distributionOrderDto.setPayTime(TimeUtil.wxTimeConvertToDate(payTime));
distributionOrderDto.setState(DistributionEnum.DistributionOrderStateEnum.PRE_SEND.getCode());
distributionOrderDao.update(distributionOrderDto);
//用户付款成功后,把分销商利润的记录更新为有效,因为未付款前只是创建了预计利润记录,但并未生效
distributorProfitDao.updateValidState(distributionOrderId, true);
DistributionOrder distributionOrder = distributionOrderDao.findById(distributionOrderId);
SupplierItem supplierItem = supplierItemDao.findById(distributionOrder.getItemId());
//更新库存
supplierItemService.reduceStock(distributionOrder.getItemId(), distributionOrder.getItemNum());
logger.info(">>>>>>>>>>>> 微信支付回调通知处理成功,更新拍卖订单状态和商品库存 <<<<<<<<<<<<");
//用户首次购买的话,即绑定该分销商
boolean isExisted = distributorBindDao.isExisted(distributionOrder.getBuyerId());
if (!isExisted) {
Date now = new Date();
DistributorBind distributorBind = new DistributorBind();
distributorBind.setUserId(distributionOrder.getBuyerId());
distributorBind.setDistributorId(distributionOrder.getSellerId());
distributorBind.setCreateTime(now);
distributorBind.setUpdateTime(now);
distributorBind.setBindShareId(distributionOrder.getShareRecordId());
distributorBind.setIsValid(true);
distributorBindDao.insert(distributorBind);
}
return Result.success();
} catch (Exception e) {
logger.error(">>>>>>>>>>>> 微信支付回调通知处理失败 error :{}", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return Result.failed();
}
/** /**
* 获取请求体 * 获取请求体
* *
......
...@@ -43,8 +43,9 @@ public class WebMvcConfiguration implements WebMvcConfigurer { ...@@ -43,8 +43,9 @@ public class WebMvcConfiguration implements WebMvcConfigurer {
"/imCallback/**", "/wx/category/**", "/imCallback/**", "/wx/category/**",
"/wx/consignSale/**", "/wx/item/**", "/wx/consignSale/**", "/wx/item/**",
"/wx/returnOrder/**", "/wx/distributionOrder/confirmSigned", "/wx/distributionOrder/delivery", "/wx/distributionOrder/cancel", "/wx/returnOrder/**", "/wx/distributionOrder/confirmSigned", "/wx/distributionOrder/delivery", "/wx/distributionOrder/cancel",
"/wx/supplierItem/findItemsOfCurrentDistributor", "/wx/distributionOrder/refund" "/wx/distributionOrder/refund",
// , "/wx/supplierItem/**", "/wx/shareRecord/**", "/wx/distributionOrder/**", "/wx/selfPage/**" "/wx/supplierItem/findItemsOfCurrentDistributor"
// , "/wx/supplierItem/**", "/wx/shareRecord/**", "/wx/distributionOrder/**", "/wx/selfPage/**", "/wx/auctionRecord/**"
/* "/wx/officialAccount/**", /* "/wx/officialAccount/**",
"/wx/item/**", "/wx/item/**",
"/wx/aiAssistant/**", "/wx/aiAssistant/**",
......
package com.wwdz.ch.wx.entity;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class AuctionOfferNoticeMsg implements Entity {
private String openId;
private String templetId;
/**
* 分销订单号
*/
private String distributionOrderId;
/**
* 拍卖分享id
*/
private String shareRecordId;
/**
* 商品id
*/
private Long itemId;
/**
* 商品名称
*/
private String itemName;
/**
* 付款金额
*/
private String amount;
/**
* 拍卖结束时间
*/
private Date auctionEndTime;
/**
* 支付截止时间
*/
private Date payEndTime;
/**
* 拍卖当前价
*/
private String currentPrice;
/**
* 用户名称
*/
private String userName;
/**
* 利润
*/
private String profit;
}
package com.wwdz.ch.wx.entity.request;
import com.wwdz.ch.core.entity.AbstractSubscribeMsg;
import com.xxdxxs.entity.Entity;
import java.util.Map;
public class AuctionMsgRequestDto implements Entity, AbstractSubscribeMsg {
/**
* 竞拍成功用户名称
*/
private String buyerName;
/**
* 商品名称
*/
private String itemName;
/**
* 截止时间
*/
private String endTime;
/**
* 付款截止时间
*/
private String payEndTime;
/**
* 拍卖商品当前价格
*/
private String currentPrice;
@Override
public Map<String, Object> getTempletParam() {
return null;
}
@Override
public String getTempletId() {
return null;
}
}
package com.wwdz.ch.wx.entity.vo.distribution;
import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Data
public class AuctionDetailVo implements Entity {
/**
* 商品id
*/
private Long itemId;
/**
* 商品名称
*/
private String name;
/**
* 用于列表展示的图片对象
*/
private Map<String, Object> homePageImage;
/**
* 当前售价
*/
private String currentPrice;
/**
* 起拍价
*/
private String startPrice;
/**
* 商品图片,分号分隔
*/
private String images;
/**
* 商品视频,分号分隔
*/
private String videos;
/**
* 竞拍开始时间
*/
private Date startTime;
/**
* 竞拍结束时间
*/
private Date endTime;
/**
* 加价幅度
*/
private String addExtent;
/**
* 加价幅度展示
*/
private String addExtentStr;
/**
* 实际竞拍结束时间
*/
private Date realEndTime;
/**
* 出价记录
*/
private List<AuctionRecord> auctionRecordList;
/**
* 出价记录带分页信息
*/
private PageSearchResult pageSearchResult;
private Integer state;
/**
* 状态
*/
private String stateName;
/**
* 拍卖规则
*/
private String rule;
/**
* 商品描述详情
*/
private String description;
/**
* 用户的状态
* 出价、已领先、立即支付、竞拍结束
*/
private Integer userState;
private String userStateName;
/**
* 是否延长
*/
private Boolean isExtend;
}
package com.wwdz.ch.wx.entity.vo.distribution;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
@Data
public class AuctionRecordRowVo implements Entity {
private Integer id;
/**
* 商品id
*/
private Long itemId;
/**
* 用户id
*/
private Long userId;
/**
* 微信openid
*/
private String userOpenId;
/**
* 出价
* 单位为元
*/
private String price;
/**
* 出价时间
*/
private Date createTime;
/**
* 分享id
*/
private String shareRecordId;
/**
* 分享商id
*/
private Long distributorId;
/**
* 价格是否领先
*/
private Boolean isLead;
}
package com.wwdz.ch.wx.entity.vo.distribution;
import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Data
public class AuctionRecordVo implements Entity {
/**
* 商品id
*/
private Long itemId;
/**
* 商品名称
*/
private String itemName;
/**
* 商品分享的id
*/
private String shareRecordId;
/**
* 用于列表展示的图片对象
*/
private Map<String, Object> homePageImage;
/**
* 当前售价
*/
private String currentPrice;
/**
* 起拍价
*/
private String startPrice;
/**
* 下次出价价格
*/
private String nextPrice;
/**
* 实际竞拍结束时间
*/
private Date realEndTime;
/**
* 竞拍开始时间
*/
private Date startTime;
/**
* 出价记录
*/
private List<AuctionRecord> auctionRecordList;
/**
* 出价记录带分页信息
*/
private PageSearchResult pageSearchResult;
private Integer state;
/**
* 状态
*/
private String stateName;
/**
* 是否领先
*/
private Boolean isLead;
/**
* 用户自己的出价次数
*/
private Integer offerNum;
/**
* 加价幅度
*/
private String addExtent;
/**
* 该商品的总出价次数
*/
private Integer totalOfferNum;
private Integer userState;
private String userStateName;
}
...@@ -173,4 +173,11 @@ public class DistributionOrderDetailVo implements Entity { ...@@ -173,4 +173,11 @@ public class DistributionOrderDetailVo implements Entity {
*/ */
private Date payEndTime; private Date payEndTime;
/**
* 商品类型1一口价2竞拍
*/
private Integer type;
private String typeName;
} }
...@@ -153,4 +153,17 @@ public class DistributionOrderVo implements Entity { ...@@ -153,4 +153,17 @@ public class DistributionOrderVo implements Entity {
* 支付截止时间 * 支付截止时间
*/ */
private Date payEndTime; private Date payEndTime;
/**
* 商品类型1一口价2竞拍
*/
private Integer type;
private String typeName;
/**
* 利润
*/
private String profit;
} }
...@@ -30,6 +30,11 @@ public class SelfPageInfoVo implements Entity { ...@@ -30,6 +30,11 @@ public class SelfPageInfoVo implements Entity {
private String userName; private String userName;
/**
* 用户出价的商品数量,统计正在拍卖中的
*/
private Integer userOfferNum;
/** /**
* 头像 * 头像
*/ */
......
package com.wwdz.ch.wx.impl.distribution;
import com.github.pagehelper.PageInfo;
import com.wwdz.ch.core.api.OfficialAccountApi;
import com.wwdz.ch.core.api.wxpay.WxPayServiceApi;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.notify.AliSmsSender;
import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.MediaUtil;
import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.db.dao.OfficialAccountSubscribeRecordDao;
import com.wwdz.ch.db.dao.UserDao;
import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord;
import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.domain.distribution.*;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import com.wwdz.ch.wx.entity.AuctionOfferNoticeMsg;
import com.wwdz.ch.wx.entity.vo.distribution.AuctionRecordRowVo;
import com.wwdz.ch.wx.entity.vo.distribution.AuctionRecordVo;
import com.wwdz.ch.wx.service.distribution.AuctionRecordService;
import com.wwdz.ch.wx.service.distribution.SendMsgService;
import com.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.EntityMapper;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service
public class AuctionRecordServiceImpl implements AuctionRecordService {
private static final Logger logger = LoggerFactory.getLogger(AuctionRecordServiceImpl.class);
@Autowired
AuctionConfigDao auctionConfigDao;
@Autowired
AuctionRecordDao auctionRecordDao;
@Autowired
RedissonClient redissonClient;
@Autowired
DistributionOrderDao distributionOrderDao;
@Autowired
SupplierItemDao supplierItemDao;
@Autowired
WxPayServiceApi wxPayServiceApi;
@Autowired
DistributorShareRecordDao distributorShareRecordDao;
@Autowired
OfficialAccountApi officialAccountApi;
@Autowired
UserDao userDao;
@Autowired
OfficialAccountSubscribeRecordDao officialAccountSubscribeRecordDao;
@Autowired
SendMsgService sendMsgService;
@Autowired
AliSmsSender aliSmsSender;
@Override
@Transactional
public Result createAuctionRecord(AuctionRecordRequestDto dto) {
long itemId = dto.getItemId();
String itemIdKey = CommConsts.AUCTION_LOCK_KEY_PRE + itemId;
RLock lock = redissonClient.getLock(itemIdKey);
try {
if (lock.tryLock(0, 10, TimeUnit.SECONDS)) {
Date now = new Date();
//查询竞拍配置信息
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(itemId);
Date endTime = auctionConfig.getRealEndTime();
//当前查询出来的拍卖还没截拍,但是已过时间,则更新截拍的状态
if (auctionConfig.getIsValid() && now.after(endTime)) {
auctionConfigDao.setEnd(itemId);
return Result.failed("该商品已截拍");
} else if (!auctionConfig.getIsValid()) {
return Result.failed("该商品已截拍");
}
String shareRecordId = dto.getShareRecordId();
DistributorShareRecord distributorShareRecord = distributorShareRecordDao.findById(shareRecordId);
if (distributorShareRecord == null || !distributorShareRecord.getEnabled()) {
logger.info("======== 拍卖出价,对应分享id = {}, 无效 ========", shareRecordId);
return Result.failed("该商品分享链接已失效");
}
SupplierItem supplierItem = supplierItemDao.findById(itemId);
//查询当前最新的价格
AuctionRecord auctionRecord = auctionRecordDao.findLastedRecord(itemId);
long price = PriceUtil.convertPriceFromStr(dto.getPrice());
if (auctionRecord != null) {
long lastedPrice = auctionRecord.getPrice();
if (price <= lastedPrice) {
return Result.failed("当前出价已不是最高价,请刷新出价记录");
}
//把上次的最高价记录改为落后
auctionRecordDao.updateNotLeadById(auctionRecord.getId());
//发送模板消息,提示用户出价被超越
String openId = sendMsgService.getOpenIdByUserId(auctionRecord.getUserId());
if (com.xxdxxs.utils.StringUtils.hasLength(openId)) {
AuctionOfferNoticeMsg auctionOfferNoticeMsg = new AuctionOfferNoticeMsg();
auctionOfferNoticeMsg.setItemId(supplierItem.getId());
auctionOfferNoticeMsg.setItemName(supplierItem.getName());
auctionOfferNoticeMsg.setCurrentPrice(PriceUtil.convertPriceFenToYuan(price));
auctionOfferNoticeMsg.setOpenId(openId);
Result result = sendMsgService.sendAuctionOfferOutMsg(auctionOfferNoticeMsg);
if (!result.getSuccess()) {
String msg = "您出价过的拍品" + supplierItem.getName() + "的价格被其他人超越了, 当前价是" + PriceUtil.convertPriceFenToYuan(price) +
"元,竞拍截止时间是" + DateUtils.toString(endTime) +", 请前往\"换藏小程序\"查看";
aliSmsSender.sendAuctionWithTemplate(auctionRecord.getUserId(), msg);
}
} else {
String msg = "您出价过的拍品" + supplierItem.getName() + "的价格被其他人超越了, 当前价是" + PriceUtil.convertPriceFenToYuan(price) +
"元,竞拍截止时间是" + DateUtils.toString(endTime) +", 请前往\"换藏小程序\"查看";
aliSmsSender.sendAuctionWithTemplate(auctionRecord.getUserId(), msg);
}
}
//插入最新出价记录
AuctionRecord addRecord = new AuctionRecord();
addRecord.setIsLead(true);
addRecord.setShareRecordId(shareRecordId);
addRecord.setCreateTime(now);
addRecord.setDistributorId(distributorShareRecord.getDistributorId());
addRecord.setItemId(itemId);
addRecord.setPrice(price);
addRecord.setUserId(dto.getUserId());
addRecord.setUserOpenId(dto.getUserOpenId());
auctionRecordDao.insert(addRecord);
//如果当前时间是拍卖截止时间的最后五分钟内,则再延长五分钟
Instant instant = endTime.toInstant().minus(Duration.ofMinutes(5));
Date time = Date.from(instant);
if (now.after(time)) {
Instant afterInstant = endTime.toInstant().plus(Duration.ofMinutes(5));
Date newRealEndTime = Date.from(afterInstant);
auctionConfigDao.updateRealEndTime(itemId, newRealEndTime);
logger.info("商品id:{}, 用户id:{}, 本次出价时间: {}, 原先截拍时间为:{}, 延长截拍时间为{}", itemId, dto.getUserId(), now, endTime, newRealEndTime);
}
//发送消息通知对应的分销商有用户出价
String openId = sendMsgService.getOpenIdByUserId(distributorShareRecord.getDistributorId());
if (com.xxdxxs.utils.StringUtils.hasLength(openId)) {
AuctionOfferNoticeMsg auctionOfferNoticeMsg = new AuctionOfferNoticeMsg();
auctionOfferNoticeMsg.setItemId(supplierItem.getId());
auctionOfferNoticeMsg.setOpenId(openId);
auctionOfferNoticeMsg.setItemName(supplierItem.getName());
auctionOfferNoticeMsg.setCurrentPrice(PriceUtil.convertPriceFenToYuan(price));
Result result = sendMsgService.offerNoticeToDistributorMsg(auctionOfferNoticeMsg);
if (!result.getSuccess()) {
String msg = "您分销的拍品" + supplierItem.getName() + "有人成出价" + PriceUtil.convertPriceFenToYuan(price) +
"元,请前往\"换藏小程序\"查看";
aliSmsSender.sendAuctionWithTemplate(distributorShareRecord.getDistributorId(), msg);
}
} else {
String msg = "您分销的拍品" + supplierItem.getName() + "有人成出价" + PriceUtil.convertPriceFenToYuan(price) +
"元,请前往\"换藏小程序\"查看";
aliSmsSender.sendAuctionWithTemplate(distributorShareRecord.getDistributorId(), msg);
}
return Result.success();
} else {
return Result.failed("出价者较多,请刷新出价记录");
}
} catch (Exception e) {
logger.error("拍卖出价失败 error : {}", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} finally {
if (lock != null && lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
return Result.failed("出价失败");
}
@Override
public Result refreshOffer(AuctionRecordRequestDto dto) {
try {
AuctionRecordVo auctionRecordVo = new AuctionRecordVo();
AuctionRecordRequestDto searchDto = new AuctionRecordRequestDto();
searchDto.setItemId(dto.getItemId());
searchDto.setPage(dto.getPage());
searchDto.setLimit(dto.getLimit());
List<AuctionRecord> auctionRecordList = auctionRecordDao.findByPage(searchDto);
PageInfo<AuctionRecord> pageInfo = new PageInfo<>(auctionRecordList);
List<AuctionRecordRowVo> auctionRecordRowVos = new ArrayList<>();
auctionRecordList.forEach(a ->{
AuctionRecordRowVo auctionRecordRowVo = new AuctionRecordRowVo();
EntityMapper.copyAttribute(a, auctionRecordRowVo);
auctionRecordRowVo.setPrice(PriceUtil.convertPriceFenToYuan(a.getPrice()));
auctionRecordRowVos.add(auctionRecordRowVo);
});
auctionRecordVo.setPageSearchResult(PageSearchResult.of(pageInfo, auctionRecordRowVos));
//查询商品竞拍信息
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(dto.getItemId());
AuctionRecord lastedRecord = auctionRecordDao.findLastedRecord(dto.getItemId());
//当前价
if (CollectionUtils.isEmpty(auctionRecordList)) {
//没有出价记录最新价格为0
auctionRecordVo.setCurrentPrice("0");
if (auctionConfig.getStartPrice() == 0) {
auctionRecordVo.setNextPrice(PriceUtil.convertPriceFenToYuan(auctionConfig.getStartPrice() + auctionConfig.getAddExtent()));
} else {
auctionRecordVo.setNextPrice(PriceUtil.convertPriceFenToYuan(auctionConfig.getStartPrice()));
}
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.PROCESS.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PROCESS.getDes());
} else {
auctionRecordVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(lastedRecord.getPrice()));
auctionRecordVo.setNextPrice(PriceUtil.convertPriceFenToYuan(lastedRecord.getPrice() + auctionConfig.getAddExtent()));
//如果最高价是自己出的,用户状态显示已领先
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.LEAD.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.LEAD.getDes());
} else {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.PROCESS.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PROCESS.getDes());
}
}
auctionRecordVo.setStartPrice(PriceUtil.convertPriceFenToYuan(auctionConfig.getStartPrice()));
Date startTime = auctionConfig.getStartTime();
Date realEndTime = auctionConfig.getRealEndTime();
auctionRecordVo.setStartTime(startTime);
auctionRecordVo.setRealEndTime(realEndTime);
auctionRecordVo.setAddExtent(PriceUtil.convertPriceFenToYuan(auctionConfig.getAddExtent()));
Date now = new Date();
DistributionOrder distributionOrder = distributionOrderDao.findByItemId(dto.getItemId());
if (now.before(startTime)) {
auctionRecordVo.setState(DistributionEnum.AuctionStateEnum.NOT_START.getCode());
auctionRecordVo.setStateName(DistributionEnum.AuctionStateEnum.NOT_START.getDes());
} else if (now.after(realEndTime)) {
//超过时间仍然有效,则设置为无效
if (auctionConfig.getIsValid()) {
auctionConfigDao.setEnd(dto.getItemId());
}
auctionRecordVo.setState(DistributionEnum.AuctionStateEnum.END.getCode());
auctionRecordVo.setStateName(DistributionEnum.AuctionStateEnum.END.getDes());
//如果是该用户竞拍成功,还没生成订单则用户状态为立即支付
if (lastedRecord != null) {
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
//竞拍结束后未生成订单
if (distributionOrder == null || distributionOrder.getPayTime() == null) {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.PRE_PAY.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PRE_PAY.getDes());
} else {
//竞拍结束页生成了订单并支付过了就显示竞拍结束
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
} else {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
} else {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
} else {
auctionRecordVo.setState(DistributionEnum.AuctionStateEnum.IN_AUCTION.getCode());
auctionRecordVo.setStateName(DistributionEnum.AuctionStateEnum.IN_AUCTION.getDes());
}
return Result.success(auctionRecordVo);
} catch (Exception e) {
logger.error("刷新出价记录失败 error : {}", e);
}
return Result.failed();
}
@Override
public Result findList(AuctionRecordRequestDto dto) {
try {
List<AuctionRecordVo> auctionRecordVos = new ArrayList<>();
//查询4天内出价记录
Date now = new Date();
Instant instant = now.toInstant().minus(Duration.ofDays(4));
Date queryStartTime = Date.from(instant);
List<AuctionRecord> auctionRecords = auctionRecordDao.findRecordByUserId(dto.getUserId(), queryStartTime, now);
List<Long> itemIds = auctionRecords.stream().map(AuctionRecord::getItemId).distinct().collect(Collectors.toList());
if (CollectionUtils.isEmpty(itemIds)) {
return Result.success();
}
itemIds.forEach(itemId -> {
AuctionRecordVo auctionRecordVo = new AuctionRecordVo();
//查询商品信息
SupplierItem supplierItem = supplierItemDao.findById(itemId);
auctionRecordVo.setItemId(itemId);
auctionRecordVo.setItemName(supplierItem.getName());
auctionRecordVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
List<AuctionRecord> auctionRecordList = auctionRecordDao.findByItemId(itemId);
//查询商品竞拍信息
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(itemId);
//当前拍品价格
AuctionRecord lastedRecord = auctionRecordList.get(0);
auctionRecordVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(lastedRecord.getPrice()));
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
auctionRecordVo.setIsLead(true);
} else {
auctionRecordVo.setIsLead(false);
}
//商品的总出价次数
auctionRecordVo.setTotalOfferNum(auctionRecordList.size());
//用户自己的出价次数
long userOfferNum = auctionRecordList.stream().filter(auctionRecord -> auctionRecord.getUserId().longValue() == dto.getUserId()).count();
auctionRecordVo.setOfferNum((int)userOfferNum);
AuctionRecord selfRecord = auctionRecordList.stream().filter(auctionRecord -> auctionRecord.getUserId().longValue() == dto.getUserId()).findFirst().get();
auctionRecordVo.setShareRecordId(selfRecord.getShareRecordId());
auctionRecordVo.setAuctionRecordList(auctionRecordList);
auctionRecordVo.setStartPrice(PriceUtil.convertPriceFenToYuan(auctionConfig.getStartPrice()));
Date startTime = auctionConfig.getStartTime();
Date realEndTime = auctionConfig.getRealEndTime();
auctionRecordVo.setStartTime(startTime);
auctionRecordVo.setRealEndTime(realEndTime);
//出价记录对应展示的按钮
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.PROCESS.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PROCESS.getDes());
if (now.after(realEndTime)) {
//如果最高价是自己出的,用户状态显示已领先
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
DistributionOrder distributionOrder = distributionOrderDao.findByItemId(itemId);
//竞拍结束后未生成订单
if (distributionOrder == null || distributionOrder.getPayTime() == null) {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.PRE_PAY.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PRE_PAY.getDes());
//检查是否超时未支付
if (distributionOrder != null) {
Date createOrderTime = distributionOrder.getCreateTime();
Instant createInstant = createOrderTime.toInstant().plus(Duration.ofHours(24));
Date time = Date.from(createInstant);
if (now.after(time)) {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
}
} else {
//竞拍结束页生成了订单并支付过了就显示竞拍结束
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
} else {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
auctionRecordVo.setState(DistributionEnum.AuctionStateEnum.END.getCode());
auctionRecordVo.setStateName(DistributionEnum.AuctionStateEnum.END.getDes());
} else {
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
auctionRecordVo.setUserState(DistributionEnum.AuctionUserStateEnum.LEAD.getCode());
auctionRecordVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.LEAD.getDes());
}
auctionRecordVo.setState(DistributionEnum.AuctionStateEnum.IN_AUCTION.getCode());
auctionRecordVo.setStateName(DistributionEnum.AuctionStateEnum.IN_AUCTION.getDes());
}
auctionRecordVos.add(auctionRecordVo);
});
return Result.success(auctionRecordVos);
} catch (Exception e) {
logger.error("出价记录查询失败 error : {}", e);
}
return Result.failed();
}
}
...@@ -6,22 +6,28 @@ import com.wechat.pay.java.service.refund.model.Status; ...@@ -6,22 +6,28 @@ import com.wechat.pay.java.service.refund.model.Status;
import com.wwdz.ch.core.api.wxpay.WxPayServiceApi; import com.wwdz.ch.core.api.wxpay.WxPayServiceApi;
import com.wwdz.ch.core.consts.DistributionEnum; import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.consts.LogisticsEnum; import com.wwdz.ch.core.consts.LogisticsEnum;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.entity.wxPay.DistributionOrderRefundRequestDto; import com.wwdz.ch.core.entity.wxPay.DistributionOrderRefundRequestDto;
import com.wwdz.ch.core.notify.AliSmsSender;
import com.wwdz.ch.core.type.PageSearchResult; import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.*; import com.wwdz.ch.core.util.*;
import com.wwdz.ch.core.util.UUID;
import com.wwdz.ch.db.dao.distribution.*; import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.domain.distribution.*; import com.wwdz.ch.db.domain.distribution.*;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto; import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto; import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.wwdz.ch.wx.entity.AuctionOfferNoticeMsg;
import com.wwdz.ch.wx.entity.DeliveryNoticeMsg; import com.wwdz.ch.wx.entity.DeliveryNoticeMsg;
import com.wwdz.ch.wx.entity.SignedNoticeMsg; import com.wwdz.ch.wx.entity.SignedNoticeMsg;
import com.wwdz.ch.wx.entity.vo.distribution.DistributionOrderDetailVo; import com.wwdz.ch.wx.entity.vo.distribution.DistributionOrderDetailVo;
import com.wwdz.ch.wx.entity.vo.distribution.DistributionOrderVo; import com.wwdz.ch.wx.entity.vo.distribution.DistributionOrderVo;
import com.wwdz.ch.wx.service.distribution.DistributionOrderService; import com.wwdz.ch.wx.service.distribution.DistributionOrderService;
import com.wwdz.ch.wx.service.distribution.SendMsgService; import com.wwdz.ch.wx.service.distribution.SendMsgService;
import com.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.EntityMapper; import com.xxdxxs.utils.EntityMapper;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -30,10 +36,10 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -30,10 +36,10 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
...@@ -47,6 +53,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -47,6 +53,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
private final static String SECRET = "117eb48AX0864490fbe4d1ef081B9cc25"; private final static String SECRET = "117eb48AX0864490fbe4d1ef081B9cc25";
private static final String CREATE_ORDER_KEY_PRE = "AUCTION:CREATE:";
private final static Long SYSTEM_ACCOUNT = 8888888888L; private final static Long SYSTEM_ACCOUNT = 8888888888L;
@Autowired @Autowired
...@@ -76,6 +84,18 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -76,6 +84,18 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Autowired @Autowired
RefundOrderDao refundOrderDao; RefundOrderDao refundOrderDao;
@Autowired
RedissonClient redissonClient;
@Autowired
AuctionRecordDao auctionRecordDao;
@Autowired
AuctionConfigDao auctionConfigDao;
@Autowired
AliSmsSender aliSmsSender;
@Transactional @Transactional
@Override @Override
public Result createDistributionOrder(DistributionOrderRequestDto dto) { public Result createDistributionOrder(DistributionOrderRequestDto dto) {
...@@ -96,7 +116,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -96,7 +116,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
return Result.failed("商品库存不足"); return Result.failed("商品库存不足");
} }
//商品限购数量 //商品限购数量
int buyLimitNum = supplierItem.getBuyLimitNum() == null ? 5 : supplierItem.getBuyLimitNum(); int buyLimitNum = supplierItem.getBuyLimitNum() == -1 ? 9999999 : supplierItem.getBuyLimitNum();
//检查该购买者是否超出限购数量 //检查该购买者是否超出限购数量
//1.查询购买者对该商品的历史购买记录 //1.查询购买者对该商品的历史购买记录
List<DistributionOrder> distributionOrders = distributionOrderDao.findValidOrderOfItemIdByBuyerId(dto.getBuyerId(), distributorShareRecord.getItemId()); List<DistributionOrder> distributionOrders = distributionOrderDao.findValidOrderOfItemIdByBuyerId(dto.getBuyerId(), distributorShareRecord.getItemId());
...@@ -137,6 +157,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -137,6 +157,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrder.setReceiverPhone(dto.getReceiverPhone()); distributionOrder.setReceiverPhone(dto.getReceiverPhone());
distributionOrder.setCreateTime(new Date()); distributionOrder.setCreateTime(new Date());
distributionOrder.setUpdateTime(new Date()); distributionOrder.setUpdateTime(new Date());
distributionOrder.setType(DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode());
distributionOrder.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode()); distributionOrder.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode());
distributionOrderDao.insert(distributionOrder); distributionOrderDao.insert(distributionOrder);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
...@@ -169,6 +190,206 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -169,6 +190,206 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Override @Override
@Transactional @Transactional
public Result createAuctionOrder(DistributionOrderRequestDto dto) {
String itemIdKey = CREATE_ORDER_KEY_PRE + dto.getItemId();
RLock lock = redissonClient.getLock(itemIdKey);
try {
if (lock.tryLock(5, 5, TimeUnit.SECONDS)) {
AuctionRecord auctionRecord = auctionRecordDao.findLastedRecord(dto.getItemId());
if (auctionRecord.getUserId().longValue() != dto.getBuyerId().longValue()) {
return Result.failed("下单信息错误");
}
String distributionOrderId = IdUtils.getOrderNumber(DISTRIBUTION_ORDER_PREFIX);
Map<String, String> map = new HashMap<>();
//判断是否该商品已创建了订单
DistributionOrder searchOrder = distributionOrderDao.findByItemId(dto.getItemId());
if (searchOrder != null && com.xxdxxs.utils.StringUtils.hasLength(searchOrder.getDistributionOrderId())) {
map.put("distributionOrderId", searchOrder.getDistributionOrderId());
return Result.success(map);
}
Date now = new Date();
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(dto.getItemId());
//查询用户第一次出价对应的分销商
AuctionRecord firstAuctionRecord = auctionRecordDao.findFirstRecord(dto.getItemId(), auctionRecord.getUserId());
String shareRecordId = firstAuctionRecord.getShareRecordId();
DistributorShareRecord distributorShareRecord = distributorShareRecordDao.findById(shareRecordId);
//SupplierItem supplierItem = supplierItemDao.findById(dto.getItemId());
DistributionOrder distributionOrder = new DistributionOrder();
distributionOrder.setItemId(dto.getItemId());
distributionOrder.setItemNum(1);
distributionOrder.setShareRecordId(shareRecordId);
distributionOrder.setDistributionOrderId(distributionOrderId);
distributionOrder.setBuyerId(auctionRecord.getUserId());
distributionOrder.setBuyerOpenid(auctionRecord.getUserOpenId());
distributionOrder.setShopId(distributorShareRecord.getShopId());
distributionOrder.setSellerId(firstAuctionRecord.getDistributorId());
distributionOrder.setAmount(auctionRecord.getPrice());
distributionOrder.setCreateTime(auctionConfig.getRealEndTime());
distributionOrder.setUpdateTime(now);
distributionOrder.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode());
distributionOrder.setType(DistributionEnum.DistributionTypeEnum.AUCTION.getCode());
distributionOrderDao.insert(distributionOrder);
map.put("distributionOrderId", distributionOrderId);
map.put("prepayId", null);
//计算分销商的利润
DistributorProfit distributorProfit = new DistributorProfit();
//利润,该记录在用户未付款时未无效,仅用于在分销商查看订单详情时,计算预计利润
Double profit = distributionOrder.getAmount().doubleValue() * 0.03;
distributorProfit.setDistributionOrderId(distributionOrderId);
distributorProfit.setDistributorId(distributionOrder.getSellerId());
distributorProfit.setItemId(distributionOrder.getItemId());
distributorProfit.setItemNum(distributionOrder.getItemNum());
distributorProfit.setAmount(distributionOrder.getAmount());
distributorProfit.setItemCost(auctionConfig.getStartPrice());
distributorProfit.setProfit((long) Math.floor(profit));
distributorProfit.setCreateTime(new Date());
distributorProfit.setIsValid(false);
distributorProfitDao.insert(distributorProfit);
SupplierItem supplierItem = supplierItemDao.findById(dto.getItemId());
//查询参与出价的所有用户所对应的分销商,可以评分成交额的3%的利润
List<AuctionRecord> auctionRecordList = auctionRecordDao.findByItemId(dto.getItemId());
List<AuctionRecord> filterRecordList = auctionRecordList.stream()
.filter(StringUtil.distinctByKey(AuctionRecord::getDistributorId))
.filter(a -> a.getDistributorId().longValue() != firstAuctionRecord.getDistributorId())
.collect(Collectors.toList());
for (AuctionRecord record : filterRecordList) {
Double allProfit = distributionOrder.getAmount().doubleValue() * 0.03;
int peopleNum = filterRecordList.size();
double averageProfit = allProfit / peopleNum;
DistributorProfit averageProfitRecord = new DistributorProfit();
averageProfitRecord.setDistributionOrderId(distributionOrderId);
averageProfitRecord.setDistributorId(record.getDistributorId());
averageProfitRecord.setItemId(distributionOrder.getItemId());
averageProfitRecord.setItemNum(distributionOrder.getItemNum());
averageProfitRecord.setAmount(distributionOrder.getAmount());
averageProfitRecord.setItemCost(0L);
averageProfitRecord.setProfit((long) Math.floor(averageProfit));
averageProfitRecord.setCreateTime(new Date());
averageProfitRecord.setIsValid(false);
distributorProfitDao.insert(averageProfitRecord);
//通知每一个分享参与出价的分销商
String distributorOpenId = sendMsgService.getOpenIdByUserId(record.getDistributorId());
if (com.xxdxxs.utils.StringUtils.hasLength(distributorOpenId)) {
AuctionOfferNoticeMsg auctionOfferNoticeMsg = new AuctionOfferNoticeMsg();
auctionOfferNoticeMsg.setCurrentPrice(PriceUtil.convertPriceFenToYuan(auctionRecord.getPrice()));
auctionOfferNoticeMsg.setOpenId(distributorOpenId);
auctionOfferNoticeMsg.setItemId(supplierItem.getId());
auctionOfferNoticeMsg.setItemName(supplierItem.getName());
auctionOfferNoticeMsg.setCurrentPrice(PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()));
auctionOfferNoticeMsg.setAuctionEndTime(auctionConfig.getRealEndTime());
auctionOfferNoticeMsg.setProfit(PriceUtil.convertDoubleToString(Math.floor(averageProfit)));
Result result = sendMsgService.auctionSuccessForDistributorsMsg(auctionOfferNoticeMsg);
if (!result.getSuccess()) {
String msg = "您分销的拍品" + supplierItem.getName() + "已成拍,成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) +
"元,您预计获得利润" + PriceUtil.convertDoubleToString(Math.floor(averageProfit)) + "元。请前往\"换藏小程序\"查看";
aliSmsSender.sendAuctionWithTemplate(record.getDistributorId(), msg);
}
} else {
String msg = "您分销的拍品" + supplierItem.getName() + "已成拍,成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) +
"元,您预计获得利润" + PriceUtil.convertDoubleToString(Math.floor(averageProfit)) + "元。请前往\"换藏小程序\"查看";
aliSmsSender.sendAuctionWithTemplate(record.getDistributorId(), msg);
}
}
//把该拍卖配置信息改为已处理
auctionConfigDao.setDeal(dto.getItemId());
//发送中拍信息给用户
String userOpenId = sendMsgService.getOpenIdByUserId(auctionRecord.getUserId());
Instant instant = auctionConfig.getRealEndTime().toInstant().plus(Duration.ofHours(24));
Date payEndTime = Date.from(instant);
if (com.xxdxxs.utils.StringUtils.hasLength(userOpenId)) {
AuctionOfferNoticeMsg auctionOfferNoticeMsg = new AuctionOfferNoticeMsg();
auctionOfferNoticeMsg.setCurrentPrice(PriceUtil.convertPriceFenToYuan(auctionRecord.getPrice()));
auctionOfferNoticeMsg.setOpenId(userOpenId);
auctionOfferNoticeMsg.setItemId(supplierItem.getId());
auctionOfferNoticeMsg.setItemName(supplierItem.getName());
auctionOfferNoticeMsg.setDistributionOrderId(distributionOrderId);
auctionOfferNoticeMsg.setPayEndTime(payEndTime);
Result result = sendMsgService.auctionSuccessMsg(auctionOfferNoticeMsg);
if (!result.getSuccess()) {
String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" +
DateUtils.toString(payEndTime) + "前完成付款,请前往\"换藏小程序\"查看。";
aliSmsSender.sendAuctionWithTemplate(auctionRecord.getUserId(), msg);
}
} else {
String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" +
DateUtils.toString(payEndTime) + "前完成付款,请前往\"换藏小程序\"查看。";
aliSmsSender.sendAuctionWithTemplate(auctionRecord.getUserId(), msg);
}
//给中拍用户对应分销商发消息
String lastOpenId = sendMsgService.getOpenIdByUserId(distributionOrder.getSellerId());
if (com.xxdxxs.utils.StringUtils.hasLength(lastOpenId)) {
AuctionOfferNoticeMsg auctionOfferNoticeMsg = new AuctionOfferNoticeMsg();
auctionOfferNoticeMsg.setCurrentPrice(PriceUtil.convertPriceFenToYuan(auctionRecord.getPrice()));
auctionOfferNoticeMsg.setOpenId(lastOpenId);
auctionOfferNoticeMsg.setItemId(supplierItem.getId());
auctionOfferNoticeMsg.setItemName(supplierItem.getName());
auctionOfferNoticeMsg.setCurrentPrice(PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()));
auctionOfferNoticeMsg.setAuctionEndTime(auctionConfig.getRealEndTime());
auctionOfferNoticeMsg.setProfit(PriceUtil.convertDoubleToString(Math.floor(profit)));
Result result = sendMsgService.auctionSuccessForDistributorsMsg(auctionOfferNoticeMsg);
if (!result.getSuccess()) {
String msg = "您分销的拍品" + supplierItem.getName() + "已成拍,成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) +
"元,您预计获得利润" + PriceUtil.convertDoubleToString(Math.floor(profit)) + "元。请前往\"换藏小程序\"查看";
aliSmsSender.sendAuctionWithTemplate(distributionOrder.getSellerId(), msg);
}
} else {
String msg = "您分销的拍品" + supplierItem.getName() + "已成拍,成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) +
"元,您预计获得利润" + PriceUtil.convertDoubleToString(Math.floor(profit)) + "元。请前往\"换藏小程序\"查看";
aliSmsSender.sendAuctionWithTemplate(distributionOrder.getSellerId(), msg);
}
return Result.success(map);
} else {
return Result.failed("稍后再试");
}
} catch (Exception e) {
logger.error("创建拍卖分销订单失败 error : {}", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
} finally {
if (lock != null && lock.isHeldByCurrentThread()) {
lock.unlock();
}
}
return Result.failed("拍卖分销订单下单失败");
}
@Override
public Result auctionPay(DistributionOrderRequestDto dto) {
try {
String distributionOrderId = dto.getDistributionOrderId();
DistributionOrder distributionOrder = distributionOrderDao.findById(distributionOrderId);
SupplierItem supplierItem = supplierItemDao.findById(distributionOrder.getItemId());
DistributionOrderRequestDto prePayDto = new DistributionOrderRequestDto();
prePayDto.setDistributionOrderId(distributionOrderId);
prePayDto.setAmount(distributionOrder.getAmount().toString());
prePayDto.setBuyerOpenid(distributionOrder.getBuyerOpenid());
prePayDto.setItemName(supplierItem.getName());
Result prePayResult = wxPayServiceApi.createPrepareOrder(prePayDto);
if (!prePayResult.getSuccess()) {
logger.error(">>>>>>>> 订单号: {}, 预下单失败 <<<<<<<<", distributionOrderId);
return Result.failed(ResultCode.PAY_FAILED);
}
String prepayId = (String) prePayResult.getData();
Result result = wxPayServiceApi.wxAppPayTuneUp(prepayId);
//保存用户收货地址,每次都要获取新的prepayid,并且要更新表中的数据
DistributionOrder updateOrder = new DistributionOrder();
updateOrder.setDistributionOrderId(distributionOrderId);
updateOrder.setPrepayId(prepayId);
updateOrder.setAddressId(dto.getAddressId());
updateOrder.setReceiverAddress(dto.getReceiverAddress());
updateOrder.setReceiverName(dto.getReceiverName());
updateOrder.setReceiverPhone(dto.getReceiverPhone());
distributionOrderDao.update(updateOrder);
return result;
} catch (Exception e) {
logger.error("拍卖订单付款失败 error : {}", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return Result.failed("拍卖订单付款失败");
}
@Override
public Result buySample(DistributionOrderRequestDto dto) { public Result buySample(DistributionOrderRequestDto dto) {
try { try {
long itemId = dto.getItemId(); long itemId = dto.getItemId();
...@@ -214,6 +435,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -214,6 +435,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrder.setReceiverPhone(dto.getReceiverPhone()); distributionOrder.setReceiverPhone(dto.getReceiverPhone());
distributionOrder.setCreateTime(new Date()); distributionOrder.setCreateTime(new Date());
distributionOrder.setUpdateTime(new Date()); distributionOrder.setUpdateTime(new Date());
distributionOrder.setType(DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode());
distributionOrder.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode()); distributionOrder.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode());
distributionOrderDao.insert(distributionOrder); distributionOrderDao.insert(distributionOrder);
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
...@@ -259,6 +481,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -259,6 +481,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
} }
@Override @Override
@Transactional @Transactional
public Result cancel(DistributionOrderRequestDto dto) { public Result cancel(DistributionOrderRequestDto dto) {
...@@ -309,6 +532,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -309,6 +532,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
return Result.failed(); return Result.failed();
} }
@Override @Override
public Result delivery(DistributionOrderRequestDto dto) { public Result delivery(DistributionOrderRequestDto dto) {
try { try {
...@@ -397,11 +621,19 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -397,11 +621,19 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrderVo.setBuyerAvatar(cacheUtil.getAppletUserList(distributionOrder.getBuyerId()) == null?"":cacheUtil.getAppletUsers(distributionOrder.getBuyerId()).getAvatar()); distributionOrderVo.setBuyerAvatar(cacheUtil.getAppletUserList(distributionOrder.getBuyerId()) == null?"":cacheUtil.getAppletUsers(distributionOrder.getBuyerId()).getAvatar());
distributionOrderVo.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrder.getState())); distributionOrderVo.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrder.getState()));
distributionOrderVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos())); distributionOrderVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
distributionOrderVo.setTypeName(DistributionEnum.DistributionTypeEnum.getNameByCode(distributionOrder.getType()));
//支付截止时间,下单后半小时内 //支付截止时间,下单后半小时内
Date date = distributionOrder.getCreateTime(); Date date = distributionOrder.getCreateTime();
Instant instant = date.toInstant().plus(Duration.ofMinutes(30)); Instant instant = date.toInstant().plus(Duration.ofMinutes(30));
Date time = Date.from(instant); Date time = Date.from(instant);
distributionOrderVo.setPayEndTime(time); distributionOrderVo.setPayEndTime(time);
//查询订单利润
DistributorProfit distributorProfit = distributorProfitDao.findByIdOfDistributor(distributionOrder.getDistributionOrderId(), distributionOrder.getSellerId());
if (distributorProfit != null) {
distributionOrderVo.setProfit(PriceUtil.convertPriceFenToYuan(distributorProfit.getProfit()));
} else {
distributionOrderVo.setProfit("0");
}
distributionOrderVoList.add(distributionOrderVo); distributionOrderVoList.add(distributionOrderVo);
}); });
return Result.success(PageSearchResult.of(pageInfo, distributionOrderVoList)); return Result.success(PageSearchResult.of(pageInfo, distributionOrderVoList));
...@@ -414,9 +646,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -414,9 +646,12 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Override @Override
public Result findOrderDetailOfDistributor(DistributionOrderRequestDto dto) { public Result findOrderDetailOfDistributor(DistributionOrderRequestDto dto) {
try { try {
//检查订单是否超时未付款
checkPrePayTimeOut(dto.getDistributionOrderId());
DistributionOrder distributionOrder = distributionOrderDao.findById(dto.getDistributionOrderId()); DistributionOrder distributionOrder = distributionOrderDao.findById(dto.getDistributionOrderId());
int type = distributionOrder.getType();
//检查订单是否超时未付款
checkPrePayTimeOut(dto.getDistributionOrderId(), type);
DistributionOrderDetailVo distributionOrderDetailVo = new DistributionOrderDetailVo(); DistributionOrderDetailVo distributionOrderDetailVo = new DistributionOrderDetailVo();
EntityMapper.copyAttribute(distributionOrder, distributionOrderDetailVo); EntityMapper.copyAttribute(distributionOrder, distributionOrderDetailVo);
SupplierItem supplierItem = supplierItemDao.findById(distributionOrder.getItemId()); SupplierItem supplierItem = supplierItemDao.findById(distributionOrder.getItemId());
...@@ -427,8 +662,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -427,8 +662,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrderDetailVo.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrder.getState())); distributionOrderDetailVo.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrder.getState()));
distributionOrderDetailVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos())); distributionOrderDetailVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
distributionOrderDetailVo.setLogisticsName(LogisticsEnum.getNameByCode(distributionOrder.getLogisticsCode())); distributionOrderDetailVo.setLogisticsName(LogisticsEnum.getNameByCode(distributionOrder.getLogisticsCode()));
distributionOrderDetailVo.setTypeName(DistributionEnum.DistributionTypeEnum.getNameByCode(distributionOrder.getType()));
DistributorProfit distributorProfit = distributorProfitDao.findById(dto.getDistributionOrderId()); DistributorProfit distributorProfit = distributorProfitDao.findByIdOfDistributor(dto.getDistributionOrderId(), distributionOrder.getSellerId());
//供货价 //供货价
Long distributionTotalPrice = distributorProfit.getItemCost(); Long distributionTotalPrice = distributorProfit.getItemCost();
distributionOrderDetailVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(distributionTotalPrice)); distributionOrderDetailVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(distributionTotalPrice));
...@@ -441,12 +676,17 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -441,12 +676,17 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrderDetailVo.setChannelCost(PriceUtil.convertDoubleToString(channelCost));*/ distributionOrderDetailVo.setChannelCost(PriceUtil.convertDoubleToString(channelCost));*/
//利润 //利润
Double profit = distributorProfit.getProfit().doubleValue(); Double profit = distributorProfit.getProfit().doubleValue();
//支付截止时间,下单后半小时内 //一口价支付截止时间为下单半小时后,竞拍为24小时
Date date = distributionOrder.getCreateTime(); Date date = distributionOrder.getCreateTime();
Instant instant = date.toInstant().plus(Duration.ofMinutes(30)); if (type == DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode()) {
Date time = Date.from(instant); Instant instant = date.toInstant().plus(Duration.ofMinutes(30));
distributionOrderDetailVo.setPayEndTime(time); Date time = Date.from(instant);
distributionOrderDetailVo.setPayEndTime(time);
} else {
Instant instant = date.toInstant().plus(Duration.ofHours(24));
Date time = Date.from(instant);
distributionOrderDetailVo.setPayEndTime(time);
}
distributionOrderDetailVo.setProfit(PriceUtil.convertDoubleToString(profit)); distributionOrderDetailVo.setProfit(PriceUtil.convertDoubleToString(profit));
return Result.success(distributionOrderDetailVo); return Result.success(distributionOrderDetailVo);
} catch (Exception e) { } catch (Exception e) {
...@@ -492,6 +732,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -492,6 +732,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrderVo.setAmount(PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount())); distributionOrderVo.setAmount(PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()));
distributionOrderVo.setItemPrice(PriceUtil.convertPriceFenToYuan(itemPrice)); distributionOrderVo.setItemPrice(PriceUtil.convertPriceFenToYuan(itemPrice));
distributionOrderVo.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrder.getState())); distributionOrderVo.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrder.getState()));
distributionOrderVo.setTypeName(DistributionEnum.DistributionTypeEnum.getNameByCode(distributionOrder.getType()));
distributionOrderVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos())); distributionOrderVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
//支付截止时间,下单后半小时内 //支付截止时间,下单后半小时内
Date date = distributionOrder.getCreateTime(); Date date = distributionOrder.getCreateTime();
...@@ -503,7 +744,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -503,7 +744,7 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
}); });
return Result.success(PageSearchResult.of(pageInfo, distributionOrderVoList)); return Result.success(PageSearchResult.of(pageInfo, distributionOrderVoList));
} catch (Exception e) { } catch (Exception e) {
logger.error("查询分销商订单列表失败 error : {}", e); logger.error("查询用户订单列表失败 error : {}", e);
} }
return Result.failed(); return Result.failed();
} }
...@@ -513,8 +754,10 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -513,8 +754,10 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Override @Override
public Result findOrderDetailOfUser(DistributionOrderRequestDto dto) { public Result findOrderDetailOfUser(DistributionOrderRequestDto dto) {
try { try {
DistributionOrder oldOrder = distributionOrderDao.findById(dto.getDistributionOrderId());
int type = oldOrder.getType();
//检查订单是否超时未付款 //检查订单是否超时未付款
checkPrePayTimeOut(dto.getDistributionOrderId()); checkPrePayTimeOut(dto.getDistributionOrderId(), type);
DistributionOrder distributionOrder = distributionOrderDao.findById(dto.getDistributionOrderId()); DistributionOrder distributionOrder = distributionOrderDao.findById(dto.getDistributionOrderId());
DistributionOrderDetailVo distributionOrderDetailVo = new DistributionOrderDetailVo(); DistributionOrderDetailVo distributionOrderDetailVo = new DistributionOrderDetailVo();
EntityMapper.copyAttribute(distributionOrder, distributionOrderDetailVo); EntityMapper.copyAttribute(distributionOrder, distributionOrderDetailVo);
...@@ -525,12 +768,20 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -525,12 +768,20 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributionOrderDetailVo.setItemPrice(PriceUtil.convertPriceFenToYuan(itemPrice)); distributionOrderDetailVo.setItemPrice(PriceUtil.convertPriceFenToYuan(itemPrice));
distributionOrderDetailVo.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrder.getState())); distributionOrderDetailVo.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrder.getState()));
distributionOrderDetailVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos())); distributionOrderDetailVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
distributionOrderDetailVo.setTypeName(DistributionEnum.DistributionTypeEnum.getNameByCode(distributionOrder.getType()));
distributionOrderDetailVo.setLogisticsName(LogisticsEnum.getNameByCode(distributionOrder.getLogisticsCode())); distributionOrderDetailVo.setLogisticsName(LogisticsEnum.getNameByCode(distributionOrder.getLogisticsCode()));
//支付截止时间,下单后半小时内
//一口价支付截止时间为下单半小时后,竞拍为24小时
Date date = distributionOrder.getCreateTime(); Date date = distributionOrder.getCreateTime();
Instant instant = date.toInstant().plus(Duration.ofMinutes(30)); if (type == DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode()) {
Date time = Date.from(instant); Instant instant = date.toInstant().plus(Duration.ofMinutes(30));
distributionOrderDetailVo.setPayEndTime(time); Date time = Date.from(instant);
distributionOrderDetailVo.setPayEndTime(time);
} else {
Instant instant = date.toInstant().plus(Duration.ofHours(24));
Date time = Date.from(instant);
distributionOrderDetailVo.setPayEndTime(time);
}
return Result.success(distributionOrderDetailVo); return Result.success(distributionOrderDetailVo);
} catch (Exception e) { } catch (Exception e) {
logger.error("查询用户订单详情失败 error : {}", e); logger.error("查询用户订单详情失败 error : {}", e);
...@@ -539,14 +790,22 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -539,14 +790,22 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
} }
public void checkPrePayTimeOut(String distributionOrderId){ public void checkPrePayTimeOut(String distributionOrderId, int type){
DistributionOrder distributionOrder = distributionOrderDao.findById(distributionOrderId); DistributionOrder distributionOrder = distributionOrderDao.findById(distributionOrderId);
if (distributionOrder.getState() == DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode()) { if (distributionOrder.getState() == DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode()) {
long diffInMillies = Math.abs(new Date().getTime() - distributionOrder.getCreateTime().getTime()); long diffInMillies = Math.abs(new Date().getTime() - distributionOrder.getCreateTime().getTime());
long diffInMinutes = diffInMillies / (60 * 1000); if (type == DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode()) {
if (diffInMinutes >= 30) { long diffInMinutes = diffInMillies / (60 * 1000);
//待支付超出半小时,订单取消 if (diffInMinutes >= 30) {
distributionOrderDao.updateState(distributionOrder.getDistributionOrderId(), DistributionEnum.DistributionOrderStateEnum.CANCEL.getCode()); //待支付超出半小时,订单取消
distributionOrderDao.updateState(distributionOrder.getDistributionOrderId(), DistributionEnum.DistributionOrderStateEnum.CANCEL.getCode());
}
} else {
//竞拍商品超出24小时为付款,订单取消
long diffInHours = diffInMillies / (60 * 1000 * 60);
if (diffInHours >= 24) {
distributionOrderDao.updateState(distributionOrder.getDistributionOrderId(), DistributionEnum.DistributionOrderStateEnum.CANCEL.getCode());
}
} }
} }
} }
...@@ -565,10 +824,19 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -565,10 +824,19 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
List<DistributionOrder> prePayList = distributionOrderDao.findByPage(dto); List<DistributionOrder> prePayList = distributionOrderDao.findByPage(dto);
prePayList.forEach(distributionOrder -> { prePayList.forEach(distributionOrder -> {
long diffInMillies = Math.abs(new Date().getTime() - distributionOrder.getCreateTime().getTime()); long diffInMillies = Math.abs(new Date().getTime() - distributionOrder.getCreateTime().getTime());
long diffInMinutes = diffInMillies / (60 * 1000); int type = distributionOrder.getType();
if (diffInMinutes >= 30) { if (type == DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode()) {
//待支付超出半小时,订单取消 long diffInMinutes = diffInMillies / (60 * 1000);
distributionOrderDao.updateState(distributionOrder.getDistributionOrderId(), DistributionEnum.DistributionOrderStateEnum.CANCEL.getCode()); if (diffInMinutes >= 30) {
//待支付超出半小时,订单取消
distributionOrderDao.updateState(distributionOrder.getDistributionOrderId(), DistributionEnum.DistributionOrderStateEnum.CANCEL.getCode());
}
} else {
//竞拍商品超出24小时为付款,订单取消
long diffInHours = diffInMillies / (60 * 1000 * 60);
if (diffInHours >= 24) {
distributionOrderDao.updateState(distributionOrder.getDistributionOrderId(), DistributionEnum.DistributionOrderStateEnum.CANCEL.getCode());
}
} }
}); });
} }
......
package com.wwdz.ch.wx.impl.distribution; package com.wwdz.ch.wx.impl.distribution;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.IdUtils; import com.wwdz.ch.core.util.IdUtils;
import com.wwdz.ch.core.util.PriceUtil; import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.core.util.UUID; import com.wwdz.ch.core.util.UUID;
import com.wwdz.ch.db.dao.distribution.AuctionConfigDao;
import com.wwdz.ch.db.dao.distribution.DistributorShareRecordDao; import com.wwdz.ch.db.dao.distribution.DistributorShareRecordDao;
import com.wwdz.ch.db.dao.distribution.SupplierItemDao; import com.wwdz.ch.db.dao.distribution.SupplierItemDao;
import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import com.wwdz.ch.db.domain.distribution.DistributorShareRecord; import com.wwdz.ch.db.domain.distribution.DistributorShareRecord;
import com.wwdz.ch.db.domain.distribution.SupplierItem; import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.dto.request.distribution.DistributorShareRecordRequestDto; import com.wwdz.ch.db.dto.request.distribution.DistributorShareRecordRequestDto;
...@@ -30,6 +33,9 @@ public class DistributorShareRecordServiceImpl implements DistributorShareRecord ...@@ -30,6 +33,9 @@ public class DistributorShareRecordServiceImpl implements DistributorShareRecord
@Autowired @Autowired
SupplierItemDao supplierItemDao; SupplierItemDao supplierItemDao;
@Autowired
AuctionConfigDao auctionConfigDao;
@Override @Override
public Result createShareRecord(DistributorShareRecordRequestDto dto) { public Result createShareRecord(DistributorShareRecordRequestDto dto) {
...@@ -48,6 +54,7 @@ public class DistributorShareRecordServiceImpl implements DistributorShareRecord ...@@ -48,6 +54,7 @@ public class DistributorShareRecordServiceImpl implements DistributorShareRecord
distributorShareRecord.setShopId(dto.getShopId()); distributorShareRecord.setShopId(dto.getShopId());
distributorShareRecord.setCreateTime(new Date()); distributorShareRecord.setCreateTime(new Date());
distributorShareRecord.setEnabled(true); distributorShareRecord.setEnabled(true);
distributorShareRecord.setType(DistributionEnum.DistributionTypeEnum.FIXED_PRICE.getCode());
distributorShareRecordDao.insert(distributorShareRecord); distributorShareRecordDao.insert(distributorShareRecord);
return Result.success(new HashMap<String, String>(){{put("shareId", shareRecordId);}}); return Result.success(new HashMap<String, String>(){{put("shareId", shareRecordId);}});
} catch (Exception e) { } catch (Exception e) {
...@@ -55,4 +62,34 @@ public class DistributorShareRecordServiceImpl implements DistributorShareRecord ...@@ -55,4 +62,34 @@ public class DistributorShareRecordServiceImpl implements DistributorShareRecord
} }
return Result.failed(); return Result.failed();
} }
@Override
public Result createAuctionShareRecord(DistributorShareRecordRequestDto dto) {
try {
long itemId = dto.getItemId();
//查询商品竞拍信息
Date now = new Date();
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(itemId);
if (now.after(auctionConfig.getRealEndTime())) {
return Result.failed("该商品已截拍");
}
DistributorShareRecord distributorShareRecord = new DistributorShareRecord();
String shareRecordId = UUID.fastUUID().toString(true);
distributorShareRecord.setShareId(shareRecordId);
distributorShareRecord.setItemId(dto.getItemId());
//商品的起拍价
distributorShareRecord.setPrice(auctionConfig.getStartPrice());
distributorShareRecord.setDistributorId(dto.getDistributorId());
distributorShareRecord.setShopId(dto.getShopId());
distributorShareRecord.setCreateTime(new Date());
distributorShareRecord.setEnabled(true);
distributorShareRecord.setType(DistributionEnum.DistributionTypeEnum.AUCTION.getCode());
distributorShareRecordDao.insert(distributorShareRecord);
return Result.success(new HashMap<String, String>(){{put("shareId", shareRecordId);}});
} catch (Exception e) {
logger.error("创建竞拍品分销分享链接失败 error: {}", e);
}
return Result.failed();
}
} }
...@@ -6,9 +6,9 @@ import com.wwdz.ch.core.util.CacheUtil; ...@@ -6,9 +6,9 @@ import com.wwdz.ch.core.util.CacheUtil;
import com.wwdz.ch.core.util.PriceUtil; import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.core.util.RedisUtils; import com.wwdz.ch.core.util.RedisUtils;
import com.wwdz.ch.db.bean.DistributionOrderNum; import com.wwdz.ch.db.bean.DistributionOrderNum;
import com.wwdz.ch.db.dao.distribution.DistributionOrderDao; import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.dao.distribution.DistributorProfitDao; import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import com.wwdz.ch.db.dao.distribution.SupplierItemDao; import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.wwdz.ch.wx.entity.request.SelfPageRequestDto; import com.wwdz.ch.wx.entity.request.SelfPageRequestDto;
import com.wwdz.ch.wx.entity.vo.distribution.SelfPageInfoVo; import com.wwdz.ch.wx.entity.vo.distribution.SelfPageInfoVo;
import com.wwdz.ch.wx.service.distribution.SelfPageService; import com.wwdz.ch.wx.service.distribution.SelfPageService;
...@@ -24,8 +24,12 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -24,8 +24,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service @Service
...@@ -39,6 +43,12 @@ public class SelfPageServiceImpl implements SelfPageService { ...@@ -39,6 +43,12 @@ public class SelfPageServiceImpl implements SelfPageService {
@Autowired @Autowired
DistributionOrderDao distributionOrderDao; DistributionOrderDao distributionOrderDao;
@Autowired
AuctionRecordDao auctionRecordDao;
@Autowired
AuctionConfigDao auctionConfigDao;
@Autowired @Autowired
CacheUtil cacheUtil; CacheUtil cacheUtil;
...@@ -88,6 +98,21 @@ public class SelfPageServiceImpl implements SelfPageService { ...@@ -88,6 +98,21 @@ public class SelfPageServiceImpl implements SelfPageService {
distributionOrderNum.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrderNum.getState())); distributionOrderNum.setStateName(DistributionEnum.DistributionOrderStateEnum.getNameByCode(distributionOrderNum.getState()));
}); });
selfPageInfoVo.setOrderNum(distributionOrderNumList); selfPageInfoVo.setOrderNum(distributionOrderNumList);
//查询4天内出价记录
Date now = new Date();
Instant instant = now.toInstant().minus(Duration.ofDays(4));
Date queryStartTime = Date.from(instant);
List<AuctionRecord> auctionRecords = auctionRecordDao.findRecordByUserId(dto.getUserId(), queryStartTime, now);
List<Long> itemIds = auctionRecords.stream().map(AuctionRecord::getItemId).distinct().collect(Collectors.toList());
int num = 0;
for (long itemId : itemIds) {
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(itemId);
if (auctionConfig.getRealEndTime().after(now) && auctionConfig.getIsValid()) {
num = num + 1;
}
}
selfPageInfoVo.setUserOfferNum(num);
return Result.success(selfPageInfoVo); return Result.success(selfPageInfoVo);
} catch (Exception e) { } catch (Exception e) {
logger.error("查询用户个人主页失败 error : {}", e); logger.error("查询用户个人主页失败 error : {}", e);
......
...@@ -7,18 +7,24 @@ import com.wwdz.ch.db.dao.OfficialAccountSubscribeRecordDao; ...@@ -7,18 +7,24 @@ import com.wwdz.ch.db.dao.OfficialAccountSubscribeRecordDao;
import com.wwdz.ch.db.dao.UserDao; import com.wwdz.ch.db.dao.UserDao;
import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord; import com.wwdz.ch.db.domain.OfficialAccountSubscribeRecord;
import com.wwdz.ch.db.domain.User; import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.wx.entity.AuctionOfferNoticeMsg;
import com.wwdz.ch.wx.entity.DeliveryNoticeMsg; import com.wwdz.ch.wx.entity.DeliveryNoticeMsg;
import com.wwdz.ch.wx.entity.PayNoticeMsg; import com.wwdz.ch.wx.entity.PayNoticeMsg;
import com.wwdz.ch.wx.entity.SignedNoticeMsg; import com.wwdz.ch.wx.entity.SignedNoticeMsg;
import com.wwdz.ch.wx.service.distribution.SendMsgService; import com.wwdz.ch.wx.service.distribution.SendMsgService;
import com.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.JsonUtils; import com.xxdxxs.utils.JsonUtils;
import com.xxdxxs.utils.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map; import java.util.Map;
/** /**
...@@ -46,6 +52,9 @@ public class SendMsgServiceImpl implements SendMsgService { ...@@ -46,6 +52,9 @@ public class SendMsgServiceImpl implements SendMsgService {
@Value("${dts.wx.distribution-msg-url}") @Value("${dts.wx.distribution-msg-url}")
private String DISTRIBUTION_MSG_URL; private String DISTRIBUTION_MSG_URL;
@Value("${dts.wx.auction-msg-url}")
private String AUCTION_MSG_URL;
@Autowired @Autowired
OfficialAccountApi officialAccountApi; OfficialAccountApi officialAccountApi;
...@@ -146,6 +155,385 @@ public class SendMsgServiceImpl implements SendMsgService { ...@@ -146,6 +155,385 @@ public class SendMsgServiceImpl implements SendMsgService {
return Result.success(); return Result.success();
} }
@Override
public Result sendAuctionOfferOutMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg) {
try {
String openId = auctionOfferNoticeMsg.getOpenId();
String token = officialAccountApi.getAccessToken();
String url = SEND_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
Map<String, Object> map = new HashMap<>();
map.put("touser", openId);
map.put("template_id", "lO-SF3tbPEbC7bDZxRk-x6lcwp1FrNP7T3SGd160uYM");
Map<String, Object> miniprogramMap = new HashMap<>();
miniprogramMap.put("appid", APPLET_APPID);
StringBuffer stringBuffer = new StringBuffer(AUCTION_MSG_URL);
stringBuffer.append("?itemId=" + auctionOfferNoticeMsg.getItemId());
if (StringUtils.hasLength(auctionOfferNoticeMsg.getShareRecordId())) {
stringBuffer.append("&shareRecordId=" + auctionOfferNoticeMsg.getShareRecordId());
}
miniprogramMap.put("pagepath", stringBuffer.toString());
map.put("miniprogram", miniprogramMap);
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("thing4", new HashMap() {{
if (auctionOfferNoticeMsg.getItemName().length() > 20) {
put("value", auctionOfferNoticeMsg.getItemName().substring(0, 20));
} else {
put("value", auctionOfferNoticeMsg.getItemName());
}
}});
paramMap.put("amount5", new HashMap() {{
put("value", auctionOfferNoticeMsg.getCurrentPrice() + "元");
}});
map.put("data", paramMap);
logger.info("============ 拍卖出价被超越通知模板消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送拍卖出价被超越通知模板消息 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送拍卖出价被超越通知模板消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed();
}
logger.info("=============发送拍卖出价被超越通知模板消息成功 ===========");
return Result.success();
} catch (Exception e) {
logger.error("发送拍卖出价被超越通知模板消息 error :{}", e);
}
return Result.failed();
}
@Override
public Result auctionSuccessMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg) {
try {
String openId = auctionOfferNoticeMsg.getOpenId();
String token = officialAccountApi.getAccessToken();
String url = SEND_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
Map<String, Object> map = new HashMap<>();
map.put("touser", openId);
map.put("template_id", "Yy_58dviNzK1sDOilw6FnolJysIceRjm6qkhCN0RgcQ");
Map<String, Object> miniprogramMap = new HashMap<>();
miniprogramMap.put("appid", APPLET_APPID);
StringBuffer stringBuffer = new StringBuffer(AUCTION_MSG_URL);
stringBuffer.append("?itemId=" + auctionOfferNoticeMsg.getItemId());
if (StringUtils.hasLength(auctionOfferNoticeMsg.getShareRecordId())) {
stringBuffer.append("&shareRecordId=" + auctionOfferNoticeMsg.getShareRecordId());
}
miniprogramMap.put("pagepath", stringBuffer.toString());
map.put("miniprogram", miniprogramMap);
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("thing4", new HashMap() {{
if (auctionOfferNoticeMsg.getItemName().length() > 20) {
put("value", auctionOfferNoticeMsg.getItemName().substring(0, 20));
} else {
put("value", auctionOfferNoticeMsg.getItemName());
}
}});
paramMap.put("amount6", new HashMap() {{
put("value", auctionOfferNoticeMsg.getCurrentPrice() + "元");
}});
paramMap.put("character_string5", new HashMap() {{
put("value", auctionOfferNoticeMsg.getDistributionOrderId());
}});
paramMap.put("time3", new HashMap() {{
put("value", DateUtils.toString(auctionOfferNoticeMsg.getPayEndTime()));
}});
map.put("data", paramMap);
logger.info("============ 竞拍成功通知模板消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送竞拍成功模板消息 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送竞拍成功模板消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed();
}
logger.info("=============发送竞拍成功模板消息 成功 ===========");
return Result.success();
} catch (Exception e) {
logger.error("发送竞拍成功模板消息 error :{}", e);
}
return Result.failed();
}
@Override
public Result prePayMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg) {
try {
String openId = auctionOfferNoticeMsg.getOpenId();
String token = officialAccountApi.getAccessToken();
String url = SEND_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
Map<String, Object> map = new HashMap<>();
map.put("touser", openId);
map.put("template_id", "WJkhzyY0_7AYqh19_ujK93ISwKU1oniEgKKakYOdhfs");
Map<String, Object> miniprogramMap = new HashMap<>();
miniprogramMap.put("appid", APPLET_APPID);
StringBuffer stringBuffer = new StringBuffer(AUCTION_MSG_URL);
stringBuffer.append("?itemId=" + auctionOfferNoticeMsg.getItemId());
if (StringUtils.hasLength(auctionOfferNoticeMsg.getShareRecordId())) {
stringBuffer.append("&shareRecordId=" + auctionOfferNoticeMsg.getShareRecordId());
}
miniprogramMap.put("pagepath", stringBuffer.toString());
map.put("miniprogram", miniprogramMap);
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("thing2", new HashMap() {{
if (auctionOfferNoticeMsg.getItemName().length() > 20) {
put("value", auctionOfferNoticeMsg.getItemName().substring(0, 20));
} else {
put("value", auctionOfferNoticeMsg.getItemName());
}
}});
paramMap.put("thing3", new HashMap() {{
put("value", "请在截止时间前及时付款");
}});
String content = DateUtils.toString(auctionOfferNoticeMsg.getPayEndTime());
paramMap.put("time4", new HashMap() {{
put("value", content);
}});
map.put("data", paramMap);
logger.info("============ 中拍通知付款模板消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送中拍通知付款模板消息 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送中拍通知付款模板消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed();
}
logger.info("=============发送中拍通知付款模板消息 成功 ===========");
return Result.success();
} catch (Exception e) {
logger.error("发送中拍通知付款模板消息 error :{}", e);
}
return Result.failed();
}
@Override
public Result auctionSuccessForDistributorsMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg) {
try {
String openId = auctionOfferNoticeMsg.getOpenId();
String token = officialAccountApi.getAccessToken();
String url = SEND_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
Map<String, Object> map = new HashMap<>();
map.put("touser", openId);
map.put("template_id", "VVpkASCM6OgdbyERsy--hufo5PF1RvK2LfxgIsbGrR4");
Map<String, Object> miniprogramMap = new HashMap<>();
miniprogramMap.put("appid", APPLET_APPID);
StringBuffer stringBuffer = new StringBuffer(AUCTION_MSG_URL);
stringBuffer.append("?itemId=" + auctionOfferNoticeMsg.getItemId());
if (StringUtils.hasLength(auctionOfferNoticeMsg.getShareRecordId())) {
stringBuffer.append("&shareRecordId=" + auctionOfferNoticeMsg.getShareRecordId());
}
miniprogramMap.put("pagepath", stringBuffer.toString());
map.put("miniprogram", miniprogramMap);
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("thing1", new HashMap() {{
if (auctionOfferNoticeMsg.getItemName().length() > 20) {
put("value", auctionOfferNoticeMsg.getItemName().substring(0, 20));
} else {
put("value", auctionOfferNoticeMsg.getItemName());
}
}});
paramMap.put("amount2", new HashMap() {{
put("value", auctionOfferNoticeMsg.getCurrentPrice() + "元");
}});
String content = "预计获得利润 " + auctionOfferNoticeMsg.getProfit() + "元";
paramMap.put("thing3", new HashMap() {{
put("value", content);
}});
map.put("data", paramMap);
logger.info("============ 通知分销商竞拍成功模板消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送通知分销商竞拍成功模板消息 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送通知分销商竞拍成功模板消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed();
}
logger.info("=============发送通知分销商竞拍成功模板消息 成功 ===========");
return Result.success();
} catch (Exception e) {
logger.error("发送通知分销商竞拍成功模板消息 error :{}", e);
}
return Result.failed();
}
@Override
public Result aboutToEndMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg) {
try {
String openId = auctionOfferNoticeMsg.getOpenId();
String token = officialAccountApi.getAccessToken();
String url = SEND_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
Map<String, Object> map = new HashMap<>();
map.put("touser", openId);
map.put("template_id", "D03X6N8zIiFrkbsVWFixJvbDgdqMHhHw89sZsrp-Jj8");
Map<String, Object> miniprogramMap = new HashMap<>();
miniprogramMap.put("appid", APPLET_APPID);
StringBuffer stringBuffer = new StringBuffer(AUCTION_MSG_URL);
stringBuffer.append("?itemId=" + auctionOfferNoticeMsg.getItemId());
if (StringUtils.hasLength(auctionOfferNoticeMsg.getShareRecordId())) {
stringBuffer.append("&shareRecordId=" + auctionOfferNoticeMsg.getShareRecordId());
}
miniprogramMap.put("pagepath", stringBuffer.toString());
map.put("miniprogram", miniprogramMap);
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("thing1", new HashMap() {{
if (auctionOfferNoticeMsg.getItemName().length() > 20) {
put("value", auctionOfferNoticeMsg.getItemName().substring(0, 20));
} else {
put("value", auctionOfferNoticeMsg.getItemName());
}
}});
paramMap.put("amount2", new HashMap() {{
put("value", auctionOfferNoticeMsg.getCurrentPrice() + "元");
}});
String content = DateUtils.toString(auctionOfferNoticeMsg.getAuctionEndTime());
paramMap.put("time3", new HashMap() {{
put("value", content);
}});
map.put("data", paramMap);
logger.info("============ 竞拍即将结束模板消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送通竞拍即将结束模板消息 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送通竞拍即将结束模板消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed();
}
logger.info("=============发送通竞拍即将结束模板消息 成功 ===========");
return Result.success();
} catch (Exception e) {
logger.error("发送通竞拍即将结束模板消息 error :{}", e);
}
return Result.failed();
}
@Override
public Result auctionEndMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg) {
try {
String openId = auctionOfferNoticeMsg.getOpenId();
String token = officialAccountApi.getAccessToken();
String url = SEND_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
Map<String, Object> map = new HashMap<>();
map.put("touser", openId);
map.put("template_id", "z7EQt_ZrcSSd2GgtI4wh630v-QCXzRTG7eO86-vYvhs");
Map<String, Object> miniprogramMap = new HashMap<>();
miniprogramMap.put("appid", APPLET_APPID);
StringBuffer stringBuffer = new StringBuffer(AUCTION_MSG_URL);
stringBuffer.append("?itemId=" + auctionOfferNoticeMsg.getItemId());
if (StringUtils.hasLength(auctionOfferNoticeMsg.getShareRecordId())) {
stringBuffer.append("&shareRecordId=" + auctionOfferNoticeMsg.getShareRecordId());
}
miniprogramMap.put("pagepath", stringBuffer.toString());
map.put("miniprogram", miniprogramMap);
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("thing1", new HashMap() {{
if (auctionOfferNoticeMsg.getItemName().length() > 20) {
put("value", auctionOfferNoticeMsg.getItemName().substring(0, 20));
} else {
put("value", auctionOfferNoticeMsg.getItemName());
}
}});
paramMap.put("amount2", new HashMap() {{
put("value", auctionOfferNoticeMsg.getCurrentPrice() + "元");
}});
paramMap.put("time3", new HashMap() {{
put("value", DateUtils.toString(auctionOfferNoticeMsg.getAuctionEndTime()));
}});
map.put("data", paramMap);
logger.info("============ 竞拍结束模板消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送竞拍结束模板消息 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送竞拍结束模板消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed();
}
logger.info("=============发送竞拍结束模板消息 成功 ===========");
return Result.success();
} catch (Exception e) {
logger.error("发送竞拍结束模板消息 error :{}", e);
}
return Result.failed();
}
@Override
public Result offerNoticeToDistributorMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg) {
try {
String openId = auctionOfferNoticeMsg.getOpenId();
String token = officialAccountApi.getAccessToken();
String url = SEND_MSG_URL + "?access_token=" + token;
OkHttpUtil okHttpUtil = OkHttpUtil.builder().url(url);
Map<String, Object> map = new HashMap<>();
map.put("touser", openId);
map.put("template_id", "WJkhzyY0_7AYqh19_ujK99S_pVfRkKpLLpt5Y5XsKeM");
Map<String, Object> miniprogramMap = new HashMap<>();
miniprogramMap.put("appid", APPLET_APPID);
StringBuffer stringBuffer = new StringBuffer(AUCTION_MSG_URL);
stringBuffer.append("?itemId=" + auctionOfferNoticeMsg.getItemId());
if (StringUtils.hasLength(auctionOfferNoticeMsg.getShareRecordId())) {
stringBuffer.append("&shareRecordId=" + auctionOfferNoticeMsg.getShareRecordId());
}
miniprogramMap.put("pagepath", stringBuffer.toString());
map.put("miniprogram", miniprogramMap);
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("thing2", new HashMap() {{
if (auctionOfferNoticeMsg.getItemName().length() > 20) {
put("value", auctionOfferNoticeMsg.getItemName().substring(0, 20));
} else {
put("value", auctionOfferNoticeMsg.getItemName());
}
}});
paramMap.put("thing3", new HashMap() {{
put("value", "有用户新出价"+ auctionOfferNoticeMsg.getCurrentPrice() + "元");
}});
map.put("data", paramMap);
logger.info("============ 出价通知对应分销商模板消息内容 : {}", JsonUtils.fromMap(map));
okHttpUtil.addParams(map);
okHttpUtil.post(true);
String responseStr = okHttpUtil.async();
logger.info("openid : {}, 发送出价通知对应分销商模板消息 response :{}", openId, responseStr);
String errorCode = JsonUtils.getValueByPath(responseStr, "errcode");
String errmsg = JsonUtils.getValueByPath(responseStr, "errmsg");
if (!"0".equals(errorCode)) {
logger.error("openid : {}, 发送出价通知对应分销商模板消息, errorCode : {}, errmsg : {} ", openId, errorCode, errmsg);
return Result.failed();
}
logger.info("=============发送出价通知对应分销商模板消息 成功 ===========");
return Result.success();
} catch (Exception e) {
logger.error("发送出价通知对应分销商模板消息 error :{}", e);
}
return Result.failed();
}
@Override @Override
public String getOpenIdByUserId(long userId) { public String getOpenIdByUserId(long userId) {
//先查询寄售单用户信息 //先查询寄售单用户信息
......
package com.wwdz.ch.wx.impl.distribution; package com.wwdz.ch.wx.impl.distribution;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.consts.ResultCode; import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.PageSearchResult; import com.wwdz.ch.core.type.PageSearchResult;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
...@@ -8,12 +9,15 @@ import com.wwdz.ch.core.util.MediaUtil; ...@@ -8,12 +9,15 @@ import com.wwdz.ch.core.util.MediaUtil;
import com.wwdz.ch.core.util.PriceUtil; import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.db.dao.SwitchDao; import com.wwdz.ch.db.dao.SwitchDao;
import com.wwdz.ch.db.dao.distribution.*; import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.domain.AiAssistant;
import com.wwdz.ch.db.domain.Switch; import com.wwdz.ch.db.domain.Switch;
import com.wwdz.ch.db.domain.distribution.*; import com.wwdz.ch.db.domain.distribution.*;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import com.wwdz.ch.db.dto.request.distribution.DistributorShareRecordRequestDto; import com.wwdz.ch.db.dto.request.distribution.DistributorShareRecordRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto; import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.wwdz.ch.wx.entity.vo.distribution.SupplierItemVo; import com.wwdz.ch.core.entity.SupplierItemVo;
import com.wwdz.ch.wx.entity.vo.distribution.AuctionDetailVo;
import com.wwdz.ch.wx.entity.vo.distribution.AuctionRecordRowVo;
import com.wwdz.ch.wx.service.distribution.DistributionOrderService;
import com.wwdz.ch.wx.service.distribution.SupplierItemService; import com.wwdz.ch.wx.service.distribution.SupplierItemService;
import com.xxdxxs.utils.EntityMapper; import com.xxdxxs.utils.EntityMapper;
import com.xxdxxs.utils.StringUtils; import com.xxdxxs.utils.StringUtils;
...@@ -26,6 +30,8 @@ import org.springframework.stereotype.Service; ...@@ -26,6 +30,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.time.Duration;
import java.time.Instant;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.Function; import java.util.function.Function;
...@@ -34,7 +40,7 @@ import java.util.stream.Collectors; ...@@ -34,7 +40,7 @@ import java.util.stream.Collectors;
@Service @Service
public class SupplierItemServiceImpl implements SupplierItemService { public class SupplierItemServiceImpl implements SupplierItemService {
private static final Logger logger = LoggerFactory.getLogger(DistributorShareRecordServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(SupplierItemServiceImpl.class);
private final static Long SYSTEM_ACCOUNT = 8888888888L; private final static Long SYSTEM_ACCOUNT = 8888888888L;
...@@ -59,6 +65,15 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -59,6 +65,15 @@ public class SupplierItemServiceImpl implements SupplierItemService {
@Autowired @Autowired
private SwitchDao switchDao; private SwitchDao switchDao;
@Autowired
AuctionConfigDao auctionConfigDao;
@Autowired
AuctionRecordDao auctionRecordDao;
@Autowired
DistributionOrderService distributionOrderService;
@Override @Override
public Result findList(SupplierItemRequestDto dto) { public Result findList(SupplierItemRequestDto dto) {
try { try {
...@@ -75,6 +90,21 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -75,6 +90,21 @@ public class SupplierItemServiceImpl implements SupplierItemService {
supplierItemVo.setSupplyPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getSupplyPrice())); supplierItemVo.setSupplyPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getSupplyPrice()));
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice())); supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos())); supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
//竞拍商品需要展示当前价
if (supplierItem.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
AuctionRecord auctionRecord = auctionRecordDao.findLastedRecord(supplierItem.getId());
if (auctionRecord != null && auctionRecord.getPrice() != null) {
supplierItemVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(auctionRecord.getPrice()));
} else {
//没有出价记录最新价格为0
supplierItemVo.setCurrentPrice("0");
/* //查询商品起拍价
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(supplierItem.getId());
if (auctionConfig != null) {
supplierItemVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(auctionConfig.getStartPrice()));
}*/
}
}
supplierItemVos.add(supplierItemVo); supplierItemVos.add(supplierItemVo);
}); });
return Result.success(PageSearchResult.of(pageInfo, supplierItemVos)); return Result.success(PageSearchResult.of(pageInfo, supplierItemVos));
...@@ -135,7 +165,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -135,7 +165,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
userRecentBrowseDao.insert(newRecord); userRecentBrowseDao.insert(newRecord);
} }
} }
} else { } else {
//店家进入详情,需要判断是否购买过样品 //店家进入详情,需要判断是否购买过样品
if (distributionOrderDao.isBuyItem(dto.getUserId(), itemId)) { if (distributionOrderDao.isBuyItem(dto.getUserId(), itemId)) {
supplierItemVo.setShopBought(true); supplierItemVo.setShopBought(true);
...@@ -239,6 +269,7 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -239,6 +269,7 @@ public class SupplierItemServiceImpl implements SupplierItemService {
searchDto.setIsOnSale(true); searchDto.setIsOnSale(true);
searchDto.setIsDeleted(false); searchDto.setIsDeleted(false);
searchDto.setIds(itemIds); searchDto.setIds(itemIds);
searchDto.setType(dto.getType());
searchDto.setStock(0);//库存大于0 searchDto.setStock(0);//库存大于0
searchDto.setPage(dto.getPage()); searchDto.setPage(dto.getPage());
searchDto.setLimit(dto.getLimit()); searchDto.setLimit(dto.getLimit());
...@@ -251,6 +282,15 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -251,6 +282,15 @@ public class SupplierItemServiceImpl implements SupplierItemService {
supplierItemVo.setSalePrice(PriceUtil.convertPriceFenToYuan(map.get(supplierItem.getId()).getPrice())); supplierItemVo.setSalePrice(PriceUtil.convertPriceFenToYuan(map.get(supplierItem.getId()).getPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos())); supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
supplierItemVo.setShareId(map.get(supplierItem.getId()).getShareId()); supplierItemVo.setShareId(map.get(supplierItem.getId()).getShareId());
//竞拍商品需要展示当前价
if (supplierItem.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
AuctionRecord auctionRecord = auctionRecordDao.findLastedRecord(supplierItem.getId());
if (auctionRecord != null && auctionRecord.getPrice() != null) {
supplierItemVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(auctionRecord.getPrice()));
} else {
supplierItemVo.setCurrentPrice("0");
}
}
supplierItemVos.add(supplierItemVo); supplierItemVos.add(supplierItemVo);
}); });
return Result.success(PageSearchResult.of(pageInfo, supplierItemVos)); return Result.success(PageSearchResult.of(pageInfo, supplierItemVos));
...@@ -276,4 +316,143 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -276,4 +316,143 @@ public class SupplierItemServiceImpl implements SupplierItemService {
} }
return Result.failed(); return Result.failed();
} }
@Override
public Result findAuctionDetail(SupplierItemRequestDto dto) {
try {
AuctionDetailVo auctionDetailVo = new AuctionDetailVo();
Date now = new Date();
long itemId = 0;
String shareRecordId = dto.getShareRecordId();
DistributorShareRecord distributorShareRecord = null;
if (StringUtils.isEmpty(shareRecordId) && dto.getId() == null) {
return Result.failed("商品信息为空");
} else if (StringUtils.hasLength(shareRecordId)) {
distributorShareRecord = distributorShareRecordDao.findById(shareRecordId);
if (distributorShareRecord == null || !distributorShareRecord.getEnabled()) {
return Result.failed("该商品已下架");
} else {
itemId = distributorShareRecord.getItemId();
}
} else {
itemId = dto.getId();
}
//查询商品竞拍信息
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(itemId);
//查询商品竞拍记录
AuctionRecordRequestDto auctionRecordRequestDto = new AuctionRecordRequestDto();
auctionRecordRequestDto.setItemId(itemId);
auctionRecordRequestDto.setPage(dto.getPage());
auctionRecordRequestDto.setLimit(dto.getLimit());
List<AuctionRecord> auctionRecordList = auctionRecordDao.findByPage(auctionRecordRequestDto);
PageInfo<AuctionRecord> pageInfo = new PageInfo<>(auctionRecordList);
List<AuctionRecordRowVo> auctionRecordRowVos = new ArrayList<>();
auctionRecordList.forEach(a ->{
AuctionRecordRowVo auctionRecordRowVo = new AuctionRecordRowVo();
EntityMapper.copyAttribute(a, auctionRecordRowVo);
auctionRecordRowVo.setPrice(PriceUtil.convertPriceFenToYuan(a.getPrice()));
auctionRecordRowVos.add(auctionRecordRowVo);
});
auctionDetailVo.setPageSearchResult(PageSearchResult.of(pageInfo, auctionRecordRowVos));
AuctionRecord lastedRecord = auctionRecordDao.findLastedRecord(itemId);
//当前价
if (CollectionUtils.isEmpty(auctionRecordList)) {
auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.PROCESS.getCode());
auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PROCESS.getDes());
auctionDetailVo.setCurrentPrice("0");
} else {
auctionDetailVo.setCurrentPrice(PriceUtil.convertPriceFenToYuan(lastedRecord.getPrice()));
//如果最高价是自己出的,用户状态显示已领先
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.LEAD.getCode());
auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.LEAD.getDes());
} else {
auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.PROCESS.getCode());
auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PROCESS.getDes());
}
}
SupplierItem supplierItem = supplierItemDao.findById(itemId);
auctionDetailVo.setItemId(supplierItem.getId());
auctionDetailVo.setImages(supplierItem.getImages());
auctionDetailVo.setVideos(supplierItem.getVideos());
auctionDetailVo.setName(supplierItem.getName());
auctionDetailVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
//起拍价
auctionDetailVo.setStartPrice(PriceUtil.convertPriceFenToYuan(auctionConfig.getStartPrice()));
String addExtent = PriceUtil.convertPriceFenToYuan(auctionConfig.getAddExtent());
auctionDetailVo.setAddExtent(addExtent);
auctionDetailVo.setAddExtentStr("¥" + addExtent + "/次");
Date startTime = auctionConfig.getStartTime();
Date realEndTime = auctionConfig.getRealEndTime();
auctionDetailVo.setStartTime(startTime);
auctionDetailVo.setEndTime(auctionConfig.getEndTime());
auctionDetailVo.setRealEndTime(realEndTime);
DistributionOrder distributionOrder = distributionOrderDao.findByItemId(itemId);
if (now.before(startTime)) {
auctionDetailVo.setState(DistributionEnum.AuctionStateEnum.NOT_START.getCode());
auctionDetailVo.setStateName(DistributionEnum.AuctionStateEnum.NOT_START.getDes());
} else if (now.after(realEndTime)) {
auctionDetailVo.setState(DistributionEnum.AuctionStateEnum.END.getCode());
auctionDetailVo.setStateName(DistributionEnum.AuctionStateEnum.END.getDes());
auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
//如果当前时间已经超过截拍时间,并且竞拍配置还未改成无效,则进行修改
if (auctionConfig.getIsValid()) {
auctionConfigDao.setEnd(itemId);
}
if (lastedRecord != null) {
//如果是该用户竞拍成功,还没生成订单则用户状态为立即支付
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
//竞拍结束后未生成订单
if (distributionOrder == null || distributionOrder.getPayTime() == null) {
auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.PRE_PAY.getCode());
auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.PRE_PAY.getDes());
//检查是否超时未支付
if (distributionOrder != null) {
Date createOrderTime = distributionOrder.getCreateTime();
Instant createInstant = createOrderTime.toInstant().plus(Duration.ofHours(24));
Date time = Date.from(createInstant);
if (now.after(time)) {
auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
}
} else {
//竞拍结束页生成了订单并支付过了就显示竞拍结束
auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.END.getCode());
auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.END.getDes());
}
}
}
} else {
if (lastedRecord != null) {
if (lastedRecord.getUserId().longValue() == dto.getUserId().longValue()) {
auctionDetailVo.setUserState(DistributionEnum.AuctionUserStateEnum.LEAD.getCode());
auctionDetailVo.setUserStateName(DistributionEnum.AuctionUserStateEnum.LEAD.getDes());
}
}
auctionDetailVo.setState(DistributionEnum.AuctionStateEnum.IN_AUCTION.getCode());
auctionDetailVo.setStateName(DistributionEnum.AuctionStateEnum.IN_AUCTION.getDes());
}
auctionDetailVo.setRule("中拍买家对应的分销商可获得最终成拍价的3%的金额作为佣金奖励," +
"其余参与分销的分销商平分最终成拍价的3%的金额。若多个分销商分销给同一个买家," +
"奖励则归属于第一个分享给买家的分销商。(举例:某拍品最终成拍价是1000元," +
"有4个分销商参与分销,则中拍买家的分销商分得30元佣金,其余3个分销商每人分得10元佣金)");
auctionDetailVo.setDescription(supplierItem.getDescription());
//是否延迟截拍的标识
if (!auctionConfig.getEndTime().equals(auctionConfig.getRealEndTime())) {
auctionDetailVo.setIsExtend(true);
} else {
auctionDetailVo.setIsExtend(false);
}
return Result.success(auctionDetailVo);
} catch (Exception e) {
logger.error("查询拍卖商品详情 error : {}", e);
}
return Result.failed();
}
} }
package com.wwdz.ch.wx.job;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.distribution.AuctionConfigDao;
import com.wwdz.ch.db.dao.distribution.AuctionRecordDao;
import com.wwdz.ch.db.dao.distribution.DistributionOrderDao;
import com.wwdz.ch.db.dao.distribution.SupplierItemDao;
import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.wwdz.ch.db.domain.distribution.DistributionOrder;
import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import com.wwdz.ch.wx.service.distribution.DistributionOrderService;
import com.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.List;
/**
* 拍卖结束自动创建订单
*/
@Component
public class AutoCreateAuctionOrderJob {
private static final Logger logger = LoggerFactory.getLogger(AutoCreateAuctionOrderJob.class);
private final static String AUTO_CREATE_AUCTION_ORDER_KEY = "CREATE_AUCTION_ORDER_KEY";
@Autowired
DistributionOrderService distributionOrderService;
@Autowired
DistributionOrderDao distributionOrderDao;
@Autowired
RedissonClient redissonClient;
@Autowired
AuctionConfigDao auctionConfigDao;
@Autowired
AuctionRecordDao auctionRecordDao;
@Autowired
SupplierItemDao supplierItemDao;
/**
* 隔2分钟运行一次
*/
@Scheduled(fixedDelay = 1000 * 60 * 2)
public void execute() {
RLock lock = redissonClient.getLock(AUTO_CREATE_AUCTION_ORDER_KEY);
if (!lock.tryLock()) {
logger.warn("自动生成拍卖订单任务,当前服务实例获取锁成功: {} 获取锁失败,锁被占用不执行", Thread.currentThread().getId());
return;
}
logger.info(">>>>>>>>>>>>>>>>>>>>>>> 检测截拍的商品,自动创建订单, 开始执行 <<<<<<<<<<<<<<<<<<<<<");
try {
//查询过期未截拍的商品记录
List<AuctionConfig> timeOutNotValidList = auctionConfigDao.findTimeOutNotValidList();
timeOutNotValidList.forEach(auctionConfig -> {
//修改为已截拍,并在商品表中把该商品改为下架
auctionConfigDao.setEnd(auctionConfig.getItemId());
logger.info("============== 拍卖 商品id:{}, 超过截拍时间,系统自动修改为截拍状态,商品下架 ==============", auctionConfig.getItemId());
});
//查询一小时内拍卖截拍的商品
List<AuctionConfig> auctionConfigList = auctionConfigDao.findEndList();
auctionConfigList.forEach(auctionConfig -> {
long itemId = auctionConfig.getItemId();
//查询该商品是否有出价记录
AuctionRecord auctionRecord = auctionRecordDao.findLastedRecord(itemId);
if (auctionRecord != null && auctionRecord.getPrice() != null) {
//有出价记录的商品,再去检查有无生成过订单
DistributionOrder distributionOrder = distributionOrderDao.findByItemId(itemId);
//如果还没生成过订单,则系统自动生成订单
if (distributionOrder == null || StringUtils.isEmpty(distributionOrder.getDistributionOrderId())) {
DistributionOrderRequestDto distributionOrderRequestDto = new DistributionOrderRequestDto();
distributionOrderRequestDto.setItemId(itemId);
distributionOrderRequestDto.setBuyerId(auctionRecord.getUserId());
Result result = distributionOrderService.createAuctionOrder(distributionOrderRequestDto);
if (result.getSuccess()) {
logger.info("============== 拍卖 商品id:{}, 自动生成订单成功 ==============", itemId);
} else {
logger.info("============== ERROR 拍卖 商品id:{}, 自动生成订单失败 ERROR ==============", itemId);
}
}
} else {
//没有出价记录,流拍的商品也要更新拍卖配置信息为已处理
auctionConfigDao.setDeal(itemId);
}
});
//把截拍超过24小时的商品设置为下架
Date now = new Date();
Instant instant = now.toInstant().minus(Duration.ofHours(25));
Date startTime = Date.from(instant);
//把截拍超过24小时的商品设置为下架
Instant endInstant = now.toInstant().minus(Duration.ofHours(24));
Date endTime = Date.from(endInstant);
List<AuctionConfig> auctionConfigs = auctionConfigDao.findList(startTime, endTime);
logger.info(">>>>>>>>>> 截拍商品自动下架查询范围:{} 至 {} <<<<<<<<<<<", DateUtils.toString(startTime), DateUtils.toString(endTime));
if (!CollectionUtils.isEmpty(auctionConfigs)) {
for (AuctionConfig auctionConfig : auctionConfigs) {
long itemId = auctionConfig.getItemId();
SupplierItem supplierItem = supplierItemDao.findById(itemId);
if (supplierItem.getIsOnSale()) {
SupplierItem updateItem = new SupplierItem();
updateItem.setId(itemId);
updateItem.setIsOnSale(false);
supplierItemDao.update(updateItem);
logger.info(">>>>>>>>>> 定时作业检测商品id:{}, 已经截拍大于24小时,自动下架 <<<<<<<<<<<", itemId);
}
}
}
} catch (Exception e) {
logger.error("同步item增量数据到ES error {}", e);
} finally {
if (lock != null && lock.isHeldByCurrentThread()) {
lock.unlock();
logger.info("======================== 线程id: {} , 检测截拍的商品,自动创建订单执行结束, 释放锁成功 ========================", Thread.currentThread().getId());
}
}
}
}
package com.wwdz.ch.wx.job;
import com.wwdz.ch.core.notify.AliSmsSender;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.core.util.RedisUtils;
import com.wwdz.ch.core.util.StringUtil;
import com.wwdz.ch.db.dao.distribution.AuctionConfigDao;
import com.wwdz.ch.db.dao.distribution.AuctionRecordDao;
import com.wwdz.ch.db.dao.distribution.DistributionOrderDao;
import com.wwdz.ch.db.dao.distribution.SupplierItemDao;
import com.wwdz.ch.db.domain.distribution.AuctionConfig;
import com.wwdz.ch.db.domain.distribution.AuctionRecord;
import com.wwdz.ch.db.domain.distribution.DistributionOrder;
import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import com.wwdz.ch.wx.entity.AuctionOfferNoticeMsg;
import com.wwdz.ch.wx.service.distribution.DistributionOrderService;
import com.wwdz.ch.wx.service.distribution.SendMsgService;
import com.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 发送模板信息
*/
@Component
public class AutoSendMsgJob {
private static final Logger logger = LoggerFactory.getLogger(AutoSendMsgJob.class);
private final static String QUANKU_AUTO_SEND_MSG_KEY = "QUANKU_AUTO_SEND_MSG_KEY";
//即将截拍提醒,标识key
private final static String QUANKU_ABORT_END_KEY = "QUANKU_ABORT_END_KEY:";
//12小时后未付款提醒,标识key
private final static String QUANKU_NOT_PAY_FIRST_KEY = "QUANKU_NOT_PAY_FIRST_KEY:";
//23小时后未付款提醒,标识key
private final static String QUANKU_NOT_PAY_SECOND_KEY = "QUANKU_NOT_PAY_SECOND_KEY:";
@Autowired
DistributionOrderService distributionOrderService;
@Autowired
DistributionOrderDao distributionOrderDao;
@Autowired
RedissonClient redissonClient;
@Autowired
AuctionConfigDao auctionConfigDao;
@Autowired
AuctionRecordDao auctionRecordDao;
@Autowired
SupplierItemDao supplierItemDao;
@Autowired
SendMsgService sendMsgService;
@Autowired
AliSmsSender aliSmsSender;
@Autowired
RedisUtils redisUtils;
/**
* 隔5分钟运行一次
*/
@Scheduled(fixedDelay = 1000 * 60 * 5)
public void execute() {
RLock lock = redissonClient.getLock(QUANKU_AUTO_SEND_MSG_KEY);
if (!lock.tryLock()) {
logger.warn("自动发送拍卖通知任务,当前服务实例获取锁成功: {} 获取锁失败,锁被占用不执行", Thread.currentThread().getId());
return;
}
logger.info(">>>>>>>>>>>>>>>>>>>>>>> 自动发送拍卖通知任务,开始执行 <<<<<<<<<<<<<<<<<<<<<");
try {
//查询即将在一小时内截拍的商品,通知参与过出价的用户即将截拍
List<AuctionConfig> auctionConfigList = auctionConfigDao.findAbortEndList();
logger.info(">>>>>> 一小时内即将截拍的商品数量 :{} <<<<<<<", auctionConfigList.size());
auctionConfigList.forEach(auctionConfig -> {
long itemId = auctionConfig.getItemId();
//查询该商品所有出价记录
List<AuctionRecord> auctionRecordList = auctionRecordDao.findByItemId(itemId);
if (!CollectionUtils.isEmpty(auctionRecordList)) {
//用户id去重
List<Long> userIds = auctionRecordList.stream()
.filter(StringUtil.distinctByKey(AuctionRecord::getUserId))
.map(AuctionRecord::getUserId)
.collect(Collectors.toList());
SupplierItem supplierItem = supplierItemDao.findById(itemId);
// AuctionRecord lastRecord = auctionRecordDao.findLastedRecord(itemId);
for (long userId : userIds) {
//检查缓存中是否已有该商品的标识,已有标识该商品已发送过通知
String abortEndKey = QUANKU_ABORT_END_KEY + itemId + ":" + userId;
if (!redisUtils.hasKey(abortEndKey)) {
/* String userOpenId = sendMsgService.getOpenIdByUserId(userId);
if (com.xxdxxs.utils.StringUtils.hasLength(userOpenId)) {
AuctionOfferNoticeMsg auctionOfferNoticeMsg = new AuctionOfferNoticeMsg();
auctionOfferNoticeMsg.setCurrentPrice(PriceUtil.convertPriceFenToYuan(lastRecord.getPrice()));
auctionOfferNoticeMsg.setOpenId(userOpenId);
auctionOfferNoticeMsg.setItemId(supplierItem.getId());
auctionOfferNoticeMsg.setItemName(supplierItem.getName());
auctionOfferNoticeMsg.setAuctionEndTime(auctionConfig.getRealEndTime());
Result result = sendMsgService.aboutToEndMsg(auctionOfferNoticeMsg);
if (!result.getSuccess()) {
String msg = "您出过价的拍品" + supplierItem.getName() + ",将在1小时内结束,请前往\"换藏小程序\"查看。";
aliSmsSender.sendAuctionWithTemplate(userId, msg);
}
} else {
String msg = "您出过价的拍品" + supplierItem.getName() + ",将在1小时内结束,请前往\"换藏小程序\"查看。";
aliSmsSender.sendAuctionWithTemplate(userId, msg);
logger.info("================商品id:{}, 将在1小时内结束,提醒短信发送成功 ==============", supplierItem.getId());
}*/
String msg = "您出过价的拍品" + supplierItem.getName() + ",将在1小时内结束,请前往\"换藏小程序\"查看。";
aliSmsSender.sendAuctionWithTemplate(userId, msg);
logger.info("================商品id:{}, 将在1小时内结束,提醒短信发送成功 ==============", supplierItem.getId());
redisUtils.set(abortEndKey, itemId, 3600);
}
}
}
});
//处理生成订单后12小时后没有付款的订单
Date now = new Date();
Instant startInstant = now.toInstant().minus(Duration.ofHours(13));
Date startTime = Date.from(startInstant);
Instant endInstant = startTime.toInstant().plus(Duration.ofHours(1));
Date endTime = Date.from(endInstant);
handleNotPayOrderList(startTime, endTime, 1);
//查询生成订单后23小时后没有付款的订单
Instant secondStartInstant = now.toInstant().minus(Duration.ofHours(24));
Date secondStartTime = Date.from(secondStartInstant);
Instant secondEndInstant = secondStartTime.toInstant().plus(Duration.ofHours(1));
Date secondEndTime = Date.from(secondEndInstant);
handleNotPayOrderList(secondStartTime, secondEndTime, 2);
} catch (Exception e) {
logger.error("同步item增量数据到ES error {}", e);
} finally {
if (lock != null && lock.isHeldByCurrentThread()) {
lock.unlock();
logger.info("======================== 线程id: {} ,自动发送拍卖通知任务执行结束, 释放锁成功 ========================", Thread.currentThread().getId());
}
}
}
/**
* 催未付款的用户
* @param startTime
* @param endTime
*/
private void handleNotPayOrderList(Date startTime, Date endTime, int num) {
logger.info(">>>>> 未付款订单查询时间范围: {} 至 {} <<<<<", DateUtils.toString(startTime), DateUtils.toString(endTime));
List<DistributionOrder> distributionOrderList = distributionOrderDao.findList(startTime, endTime);
for (DistributionOrder distributionOrder : distributionOrderList) {
//检查缓存中是否有标识,有则表示已经发送过对应消息
String key = null;
if (num == 1) {
key = QUANKU_NOT_PAY_FIRST_KEY + distributionOrder.getDistributionOrderId();
} else {
key = QUANKU_NOT_PAY_SECOND_KEY + distributionOrder.getDistributionOrderId();
}
if (!redisUtils.hasKey(key)) {
Instant instant = distributionOrder.getCreateTime().toInstant().plus(Duration.ofHours(24));
Date payEndTime = Date.from(instant);
SupplierItem supplierItem = supplierItemDao.findById(distributionOrder.getItemId());
long userId = distributionOrder.getBuyerId();
String userOpenId = sendMsgService.getOpenIdByUserId(userId);
if (com.xxdxxs.utils.StringUtils.hasLength(userOpenId)) {
AuctionOfferNoticeMsg auctionOfferNoticeMsg = new AuctionOfferNoticeMsg();
auctionOfferNoticeMsg.setCurrentPrice(PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()));
auctionOfferNoticeMsg.setOpenId(userOpenId);
auctionOfferNoticeMsg.setItemId(supplierItem.getId());
auctionOfferNoticeMsg.setItemName(supplierItem.getName());
auctionOfferNoticeMsg.setPayEndTime(payEndTime);
Result result = sendMsgService.prePayMsg(auctionOfferNoticeMsg);
if (!result.getSuccess()) {
//发短信
String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" +
DateUtils.toString(payEndTime) + "前完成付款,请前往\"换藏小程序\"查看。";
aliSmsSender.sendAuctionWithTemplate(userId, msg);
}
} else {
String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" +
DateUtils.toString(payEndTime) + "前完成付款,请前往\"换藏小程序\"查看。";
aliSmsSender.sendAuctionWithTemplate(userId, msg);
logger.info("================订单号:{}, 催付款短信通知发送成功 ==============", distributionOrder.getDistributionOrderId());
}
redisUtils.set(key, distributionOrder.getDistributionOrderId(), 3600 * 24);
}
}
}
}
package com.wwdz.ch.wx.service.distribution;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.AuctionConfigRequestDto;
public interface AuctionConfigService {
/**
* 新增竞拍配置
* @param dto
* @return
*/
Result createAuctionConfig(AuctionConfigRequestDto dto);
}
package com.wwdz.ch.wx.service.distribution;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
public interface AuctionRecordService {
/**
* 新增出价记录
* @param dto
* @return
*/
Result createAuctionRecord(AuctionRecordRequestDto dto);
/**
* 查询用户所有商品的出价记录
* @param dto
* @return
*/
Result findList(AuctionRecordRequestDto dto);
/**
* 拍品详情中的刷新出价记录
* @param dto
* @return
*/
Result refreshOffer(AuctionRecordRequestDto dto);
}
...@@ -13,6 +13,22 @@ public interface DistributionOrderService { ...@@ -13,6 +13,22 @@ public interface DistributionOrderService {
Result createDistributionOrder(DistributionOrderRequestDto dto); Result createDistributionOrder(DistributionOrderRequestDto dto);
/**
* 创建拍卖分销单
* @param dto
* @return
*/
Result createAuctionOrder(DistributionOrderRequestDto dto);
/**
* 拍卖订单付款,先调用微信预支付接口,再拿prepay_id获取支付参数返回前端
* @param dto
* @return
*/
Result auctionPay(DistributionOrderRequestDto dto);
/** /**
* 分销商购买样品 * 分销商购买样品
* @param dto * @param dto
......
...@@ -11,4 +11,12 @@ public interface DistributorShareRecordService { ...@@ -11,4 +11,12 @@ public interface DistributorShareRecordService {
* @return * @return
*/ */
Result createShareRecord(DistributorShareRecordRequestDto dto); Result createShareRecord(DistributorShareRecordRequestDto dto);
/**
* 创建竞拍品分销分享记录
* @param dto
* @return
*/
Result createAuctionShareRecord(DistributorShareRecordRequestDto dto);
} }
...@@ -2,6 +2,7 @@ package com.wwdz.ch.wx.service.distribution; ...@@ -2,6 +2,7 @@ package com.wwdz.ch.wx.service.distribution;
import com.wwdz.ch.core.entity.AbstractSubscribeMsg; import com.wwdz.ch.core.entity.AbstractSubscribeMsg;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.wx.entity.AuctionOfferNoticeMsg;
import com.wwdz.ch.wx.entity.DeliveryNoticeMsg; import com.wwdz.ch.wx.entity.DeliveryNoticeMsg;
import com.wwdz.ch.wx.entity.PayNoticeMsg; import com.wwdz.ch.wx.entity.PayNoticeMsg;
import com.wwdz.ch.wx.entity.SignedNoticeMsg; import com.wwdz.ch.wx.entity.SignedNoticeMsg;
...@@ -14,5 +15,61 @@ public interface SendMsgService { ...@@ -14,5 +15,61 @@ public interface SendMsgService {
Result sendSignedTempletMsg(String openId, SignedNoticeMsg signedNoticeMsg); Result sendSignedTempletMsg(String openId, SignedNoticeMsg signedNoticeMsg);
/**
* 出价被超越通知用户
* @param auctionOfferNoticeMsg
* @return
*/
Result sendAuctionOfferOutMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg);
/**
* 竞拍成功通知
* @param auctionOfferNoticeMsg
* @return
*/
Result auctionSuccessMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg);
/**
* 催付款通知
* 给中拍用户发送
* @param auctionOfferNoticeMsg
* @return
*/
Result prePayMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg);
/**
* 竞拍成功通知所有参与的分销商
* @param auctionOfferNoticeMsg
* @return
*/
Result auctionSuccessForDistributorsMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg);
/**
* 竞拍快结束通知
* 给所有出过价的用户发送
* @param auctionOfferNoticeMsg
* @return
*/
Result aboutToEndMsg(AuctionOfferNoticeMsg auctionOfferNoticeMsg);
/**
* 竞拍结束通知
* 给所有出过价的用户发送
* @param auctionOfferNoticeMsg
* @return
*/
Result auctionEndMsg( AuctionOfferNoticeMsg auctionOfferNoticeMsg);
/**
* 用户出价通知对应分销商
* @param auctionOfferNoticeMsg
* @return
*/
Result offerNoticeToDistributorMsg( AuctionOfferNoticeMsg auctionOfferNoticeMsg);
String getOpenIdByUserId(long userId); String getOpenIdByUserId(long userId);
} }
...@@ -5,6 +5,7 @@ import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto; ...@@ -5,6 +5,7 @@ import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
public interface SupplierItemService { public interface SupplierItemService {
/** /**
* 查询供应商商品列表 * 查询供应商商品列表
* @param dto * @param dto
...@@ -44,4 +45,12 @@ public interface SupplierItemService { ...@@ -44,4 +45,12 @@ public interface SupplierItemService {
Result updateDistributionPrice(SupplierItemRequestDto dto); Result updateDistributionPrice(SupplierItemRequestDto dto);
/**
* 拍卖商品详情页
* @param dto
* @return
*/
Result findAuctionDetail(SupplierItemRequestDto dto);
} }
package com.wwdz.ch.wx.web.distribution;
import com.alibaba.fastjson.JSON;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.wwdz.ch.wx.service.distribution.AuctionRecordService;
import com.xxdxxs.service.FormHandler;
import com.xxdxxs.validation.Validator;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/wx/auctionRecord")
public class AuctionRecordController {
private static final Logger logger = LoggerFactory.getLogger(SupplierItemController.class);
@Autowired
AuctionRecordService auctionRecordService;
@ApiOperation(value = "查询出价记录")
@PostMapping("/findList")
public Result findList(@RequestBody AuctionRecordRequestDto dto) {
logger.info("查询出价记录,请求参数:{}", JSON.toJSONString(dto));
if (dto.getUserId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return auctionRecordService.findList(dto);
}
@ApiOperation(value = "刷新出价记录")
@PostMapping("/refreshOffer")
public Result refreshOffer(@RequestBody AuctionRecordRequestDto dto) {
logger.info("刷新出价记录,请求参数:{}", JSON.toJSONString(dto));
if (dto.getItemId() == null || dto.getUserId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return auctionRecordService.refreshOffer(dto);
}
@ApiOperation(value = "拍卖出价")
@PostMapping("/addOffer")
public Result addOffer(@RequestBody AuctionRecordRequestDto dto) {
logger.info("拍卖出价,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("itemId", "商品id").must().number()
.set("price", "出价").must().string()
.set("userId", "userId").must().number()
.set("userOpenId", "微信openid").must().string()
.set("shareRecordId", "分享id").must().string()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return auctionRecordService.createAuctionRecord(dto);
}
}
...@@ -47,6 +47,34 @@ public class DistributionOrderController { ...@@ -47,6 +47,34 @@ public class DistributionOrderController {
} }
@ApiOperation(value = "拍卖分销单下单,尚未付款")
@PostMapping("/createAuctionOrder")
public Result createAuctionOrder(@RequestBody DistributionOrderRequestDto dto) {
logger.info("拍卖分销单下单,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("itemId", "商品id").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return distributionOrderService.createAuctionOrder(dto);
}
@ApiOperation(value = "拍卖分销单付款,预下单并获取支付参数")
@PostMapping("/auctionPay")
public Result auctionPay(@RequestBody DistributionOrderRequestDto dto) {
logger.info("拍卖分销单付款,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("distributionOrderId", "分销订单号").must().string()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return distributionOrderService.auctionPay(dto);
}
@ApiOperation(value = "分销商购买样品,尚未付款") @ApiOperation(value = "分销商购买样品,尚未付款")
@PostMapping("/buySample") @PostMapping("/buySample")
public Result buySample(@RequestBody DistributionOrderRequestDto dto) { public Result buySample(@RequestBody DistributionOrderRequestDto dto) {
......
...@@ -45,4 +45,20 @@ public class DistributorShareRecordController { ...@@ -45,4 +45,20 @@ public class DistributorShareRecordController {
return distributorShareRecordService.createShareRecord(dto); return distributorShareRecordService.createShareRecord(dto);
} }
@ApiOperation(value = "创建竞拍品分享记录")
@PostMapping("/createAuctionShareRecord")
public Result createAuctionShareRecord(@RequestBody DistributorShareRecordRequestDto dto) {
logger.info("创建竞拍品分享记录,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("itemId", "商品id").must().number()
.set("distributorId", "分销商id").must().number()
.set("shopId", "分销商店铺id").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return distributorShareRecordService.createAuctionShareRecord(dto);
}
} }
...@@ -7,6 +7,7 @@ import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto; ...@@ -7,6 +7,7 @@ import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.wwdz.ch.wx.entity.request.MessageRequestDto; import com.wwdz.ch.wx.entity.request.MessageRequestDto;
import com.wwdz.ch.wx.service.distribution.SupplierItemService; import com.wwdz.ch.wx.service.distribution.SupplierItemService;
import com.xxdxxs.service.FormHandler; import com.xxdxxs.service.FormHandler;
import com.xxdxxs.utils.StringUtils;
import com.xxdxxs.validation.Validator; import com.xxdxxs.validation.Validator;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -26,6 +27,7 @@ public class SupplierItemController { ...@@ -26,6 +27,7 @@ public class SupplierItemController {
@Autowired @Autowired
SupplierItemService supplierItemService; SupplierItemService supplierItemService;
@ApiOperation(value = "查询供货商品列表") @ApiOperation(value = "查询供货商品列表")
@PostMapping("/findList") @PostMapping("/findList")
public Result findList(@RequestBody SupplierItemRequestDto dto) { public Result findList(@RequestBody SupplierItemRequestDto dto) {
...@@ -67,4 +69,15 @@ public class SupplierItemController { ...@@ -67,4 +69,15 @@ public class SupplierItemController {
} }
return supplierItemService.updateDistributionPrice(dto); return supplierItemService.updateDistributionPrice(dto);
} }
@ApiOperation(value = "查询竞拍商品详情")
@PostMapping("/findAuctionDetail")
public Result findAuctionDetail(@RequestBody SupplierItemRequestDto dto) {
logger.info("查询竞拍商品详情,请求参数:{}", JSON.toJSONString(dto));
if (StringUtils.isEmpty(dto.getShareRecordId()) && dto.getId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return supplierItemService.findAuctionDetail(dto);
}
} }
...@@ -3,11 +3,17 @@ package com.wwdz.ch.wx.api; ...@@ -3,11 +3,17 @@ package com.wwdz.ch.wx.api;
import com.github.binarywang.wxpay.service.WxPayService; import com.github.binarywang.wxpay.service.WxPayService;
import com.wwdz.ch.core.api.OfficialAccountApi; import com.wwdz.ch.core.api.OfficialAccountApi;
import com.wwdz.ch.core.api.wxpay.WxPayServiceApi; import com.wwdz.ch.core.api.wxpay.WxPayServiceApi;
import com.wwdz.ch.core.consts.ResultCode;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.core.util.IdUtils;
import com.wwdz.ch.core.util.PriceUtil; import com.wwdz.ch.core.util.PriceUtil;
import com.wwdz.ch.core.util.UUID; import com.wwdz.ch.core.util.UUID;
import com.wwdz.ch.db.dao.distribution.DistributionOrderDao; import com.wwdz.ch.db.dao.distribution.DistributionOrderDao;
import com.wwdz.ch.db.dao.distribution.DistributorShareRecordDao;
import com.wwdz.ch.db.dao.distribution.SupplierItemDao;
import com.wwdz.ch.db.domain.distribution.DistributionOrder; import com.wwdz.ch.db.domain.distribution.DistributionOrder;
import com.wwdz.ch.db.domain.distribution.DistributorShareRecord;
import com.wwdz.ch.db.domain.distribution.SupplierItem;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto; import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -16,6 +22,7 @@ import org.slf4j.LoggerFactory; ...@@ -16,6 +22,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.CollectionUtils;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -32,24 +39,62 @@ public class WxPayServiceTest { ...@@ -32,24 +39,62 @@ public class WxPayServiceTest {
@Autowired @Autowired
DistributionOrderDao distributionOrderDao; DistributionOrderDao distributionOrderDao;
@Autowired
SupplierItemDao supplierItemDao;
@Autowired
DistributorShareRecordDao distributorShareRecordDao;
@Test @Test
public void queryOrderBytOutTradeNo() { public void queryOrderBytOutTradeNo() {
String orderId = "DA2401311023019918454"; String orderId = "DA2403041820219215800";
DistributionOrderRequestDto dto = new DistributionOrderRequestDto(); DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId(orderId); dto.setDistributionOrderId(orderId);
Result result = wxPayServiceApi.queryOrderBytOutTradeNo(dto); Result result = wxPayServiceApi.queryOrderBytOutTradeNo(dto);
logger.info("查询支付状态:{}", result); logger.info("查询支付状态:{}", result);
} }
@Test
public void getParam() {
String prepayId = "wx04182022129559e96e5ef8653e13590000";
Result result = wxPayServiceApi.wxAppPayTuneUp(prepayId);
logger.info("获取支付参数:{}", result);
}
@Test
public void prepay() {
/* DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId("DA2403041819516253740");
wxPayServiceApi.closeOrder(dto);
String prepayId = "wx04182022129559e96e5ef8653e13590000";*/
String orderId = "DA2403051050136831424";
DistributionOrderRequestDto dto2 = new DistributionOrderRequestDto();
dto2.setDistributionOrderId(orderId);
Result result = wxPayServiceApi.queryOrderBytOutTradeNo(dto2);
logger.info("查询支付状态:{}", result);
String distributionOrderId = "DA2403051050136831424";
DistributorShareRecord distributorShareRecord = distributorShareRecordDao.findById("8991620b-5ae3-408c-b43f-5a76241ea208");
SupplierItem supplierItem = supplierItemDao.findById(distributorShareRecord.getItemId());
DistributionOrderRequestDto prePayDto = new DistributionOrderRequestDto();
prePayDto.setDistributionOrderId(distributionOrderId);
prePayDto.setAmount(String.valueOf(distributorShareRecord.getPrice()));
prePayDto.setBuyerOpenid("okGT15JamxpzlG7v7upYOIVXQmh8");
prePayDto.setItemName(supplierItem.getName());
Result prePayResult = wxPayServiceApi.createPrepareOrder(prePayDto);
logger.info("prepay:{}", prePayResult);
}
@Test @Test
public void refund() { public void refund() {
List<String> list = Arrays.asList("DA2403061107510927305", "DA2403061103288138522"); List<String> list = Arrays.asList("DA2403111801535237724");
list.forEach(orderId ->{ list.forEach(orderId ->{
DistributionOrderRequestDto dto = new DistributionOrderRequestDto(); DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setDistributionOrderId(orderId); dto.setDistributionOrderId(orderId);
dto.setAmount("6.8"); dto.setAmount("3.0");
dto.setRefundPrice("6.8"); dto.setRefundPrice("3.0");
Result result = wxPayServiceApi.refund(dto); Result result = wxPayServiceApi.refund(dto);
logger.info("申请微信支付退款:{}", result); logger.info("申请微信支付退款:{}", result);
}); });
......
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