Commit d4427ecd authored by shiyu's avatar shiyu

新增拍品的拍卖状态

parent 4b74e4a5
...@@ -97,6 +97,17 @@ public class SysSpecialPerformanceController { ...@@ -97,6 +97,17 @@ public class SysSpecialPerformanceController {
} }
@ApiOperation(value = "重新上架")
@PostMapping("/reSale")
public Result reSale(@RequestBody SpecialPerformanceConfigRequestDto dto) {
logger.info("重新上架,请求参数:{}", JSON.toJSONString(dto));
if (dto.getItemId() == null) {
return Result.failed(ResultCode.PARAM_ERROR);
}
return sysSpecialPerformanceService.reSale(dto);
}
@ApiOperation(value = "修改拍卖专场") @ApiOperation(value = "修改拍卖专场")
@PostMapping("/update") @PostMapping("/update")
public Result update(@RequestBody SpecialPerformanceRequestDto dto) { public Result update(@RequestBody SpecialPerformanceRequestDto dto) {
......
...@@ -2,10 +2,7 @@ package com.wwdz.ch.admin.impl; ...@@ -2,10 +2,7 @@ package com.wwdz.ch.admin.impl;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.wwdz.ch.admin.service.SysSpecialPerformanceService; import com.wwdz.ch.admin.service.SysSpecialPerformanceService;
import com.wwdz.ch.core.consts.CommConsts; import com.wwdz.ch.core.consts.*;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.consts.SpecialPerformanceEnum;
import com.wwdz.ch.core.consts.SupplierItemEnum;
import com.wwdz.ch.core.entity.SpecialPerformanceVo; import com.wwdz.ch.core.entity.SpecialPerformanceVo;
import com.wwdz.ch.core.entity.SupplierItemVo; import com.wwdz.ch.core.entity.SupplierItemVo;
import com.wwdz.ch.core.type.PageSearchResult; import com.wwdz.ch.core.type.PageSearchResult;
...@@ -202,6 +199,10 @@ public class SysSpecialPerformanceServiceImpl implements SysSpecialPerformanceSe ...@@ -202,6 +199,10 @@ public class SysSpecialPerformanceServiceImpl implements SysSpecialPerformanceSe
try { try {
List<String> itemIds = Arrays.asList(dto.getItemIds().split(",")); List<String> itemIds = Arrays.asList(dto.getItemIds().split(","));
for (String itemId : itemIds) { for (String itemId : itemIds) {
boolean flag = specialPerformanceConfigDao.isExisted(dto.getSpecialPerformanceId(), Long.valueOf(itemId));
if (flag) {
continue;
}
SpecialPerformanceConfig specialPerformanceConfig = new SpecialPerformanceConfig(); SpecialPerformanceConfig specialPerformanceConfig = new SpecialPerformanceConfig();
specialPerformanceConfig.setItemId(Long.valueOf(itemId)); specialPerformanceConfig.setItemId(Long.valueOf(itemId));
specialPerformanceConfig.setSpecialPerformanceId(dto.getSpecialPerformanceId()); specialPerformanceConfig.setSpecialPerformanceId(dto.getSpecialPerformanceId());
...@@ -217,4 +218,22 @@ public class SysSpecialPerformanceServiceImpl implements SysSpecialPerformanceSe ...@@ -217,4 +218,22 @@ public class SysSpecialPerformanceServiceImpl implements SysSpecialPerformanceSe
} }
return Result.failed(); return Result.failed();
} }
@Override
public Result reSale(SpecialPerformanceConfigRequestDto dto) {
try {
//拍卖配置重新生效
auctionConfigDao.updateState(dto.getItemId(), AuctionEnum.StateEnum.WAIT_ON_SALE.getCode());
//商品表中,商品重新上架
SupplierItem supplierItem = new SupplierItem();
supplierItem.setId(dto.getItemId());
supplierItem.setIsOnSale(true);
supplierItemDao.update(supplierItem);
return Result.success();
} catch (Exception e) {
logger.error("重新上架商品 error:{}", e);
}
return Result.failed();
}
} }
...@@ -3,10 +3,7 @@ package com.wwdz.ch.admin.impl; ...@@ -3,10 +3,7 @@ package com.wwdz.ch.admin.impl;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.wwdz.ch.admin.service.SysSupplierItemService; import com.wwdz.ch.admin.service.SysSupplierItemService;
import com.wwdz.ch.core.api.WxAppletApi; import com.wwdz.ch.core.api.WxAppletApi;
import com.wwdz.ch.core.consts.CommConsts; import com.wwdz.ch.core.consts.*;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.consts.MediaTypeEnum;
import com.wwdz.ch.core.consts.SupplierItemEnum;
import com.wwdz.ch.core.entity.SupplierItemVo; import com.wwdz.ch.core.entity.SupplierItemVo;
import com.wwdz.ch.core.notify.AliSmsSender; import com.wwdz.ch.core.notify.AliSmsSender;
import com.wwdz.ch.core.storage.QiniuStorage; import com.wwdz.ch.core.storage.QiniuStorage;
...@@ -128,6 +125,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService { ...@@ -128,6 +125,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
if (dto.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) { if (dto.getType() == DistributionEnum.DistributionTypeEnum.AUCTION.getCode()) {
AuctionConfig auctionConfig = new AuctionConfig(); AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setItemId(itemId); auctionConfig.setItemId(itemId);
auctionConfig.setCreatorId(CommConsts.SYSTEM_ACCOUNT);
auctionConfig.setIsValid(true); auctionConfig.setIsValid(true);
auctionConfig.setIsDeal(false); auctionConfig.setIsDeal(false);
auctionConfig.setStartTime(DateUtils.parseString(dto.getAuctionStartTime())); auctionConfig.setStartTime(DateUtils.parseString(dto.getAuctionStartTime()));
...@@ -137,6 +135,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService { ...@@ -137,6 +135,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
auctionConfig.setAddExtent(PriceUtil.convertPriceFromStr(dto.getAddExtent())); auctionConfig.setAddExtent(PriceUtil.convertPriceFromStr(dto.getAddExtent()));
auctionConfig.setCreateTime(now); auctionConfig.setCreateTime(now);
auctionConfig.setUpdateTime(now); auctionConfig.setUpdateTime(now);
auctionConfig.setState(AuctionEnum.StateEnum.WAIT_ON_SALE.getCode());
auctionConfigDao.insert(auctionConfig); auctionConfigDao.insert(auctionConfig);
} }
return Result.success(); return Result.success();
...@@ -428,7 +427,9 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService { ...@@ -428,7 +427,9 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
long newItemId = supplierItemDao.insert(supplierItem); long newItemId = supplierItemDao.insert(supplierItem);
//新增默认拍卖配置 //新增默认拍卖配置
AuctionConfig auctionConfig = new AuctionConfig(); AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setState(AuctionEnum.StateEnum.WAIT_ON_SALE.getCode());
auctionConfig.setItemId(newItemId); auctionConfig.setItemId(newItemId);
auctionConfig.setCreatorId(oldItem.getCreatorId());
auctionConfig.setIsValid(false); auctionConfig.setIsValid(false);
auctionConfig.setIsDeal(false); auctionConfig.setIsDeal(false);
auctionConfig.setStartTime(StringUtils.isEmpty(dto.getAuctionStartTime()) ? new Date(): DateUtils.parseString(dto.getAuctionStartTime())); auctionConfig.setStartTime(StringUtils.isEmpty(dto.getAuctionStartTime()) ? new Date(): DateUtils.parseString(dto.getAuctionStartTime()));
......
...@@ -64,4 +64,11 @@ public interface SysSpecialPerformanceService { ...@@ -64,4 +64,11 @@ public interface SysSpecialPerformanceService {
*/ */
Result addItem(SpecialPerformanceConfigRequestDto dto); Result addItem(SpecialPerformanceConfigRequestDto dto);
/**
* 重新上架
* @param dto
* @return
*/
Result reSale(SpecialPerformanceConfigRequestDto dto);
} }
package com.wwdz.ch.core.consts;
public class AuctionEnum {
/**
* 售后单状态
*/
public enum StateEnum {
WAIT_ON_SALE(1, "待上架"),
PREVIEW(10, "预展中"),
AUCTIONING(20, "竞拍中"),
GET_NOT_PAY(30, "中拍未付款"),
GET_NOT_PAY_TO_PASS(40, "中拍未付款流拍"),
NO_OFFER_TO_PASS(50, "无出价流拍"),
DEALED(100, "成交"),
;
private int code;
private String des;
StateEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (AuctionEnum.StateEnum stateEnum : AuctionEnum.StateEnum.values()) {
if (code == stateEnum.getCode()) {
return stateEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
}
...@@ -24,6 +24,14 @@ public interface AuctionConfigDao { ...@@ -24,6 +24,14 @@ public interface AuctionConfigDao {
*/ */
int update(AuctionConfig auctionConfig); int update(AuctionConfig auctionConfig);
/**
* 更新状态
* @param itemId
* @param state
* @return
*/
int updateState(long itemId, int state);
/** /**
* 根据商品id查询拍卖设置 * 根据商品id查询拍卖设置
* @param itemId * @param itemId
...@@ -89,7 +97,8 @@ public interface AuctionConfigDao { ...@@ -89,7 +97,8 @@ public interface AuctionConfigDao {
/** /**
* 拍卖配置更新为已处理 * 拍卖配置更新为已处理
* @param itemId * @param itemId
* @param state
* @return * @return
*/ */
int setDeal(long itemId); int setDeal(long itemId, int state);
} }
...@@ -23,4 +23,6 @@ public interface SpecialPerformanceConfigDao { ...@@ -23,4 +23,6 @@ public interface SpecialPerformanceConfigDao {
boolean delete(int specialPerformanceId, long itemId); boolean delete(int specialPerformanceId, long itemId);
boolean isExisted(int specialPerformanceId, long itemId);
} }
...@@ -15,6 +15,8 @@ public interface SpecialPerformanceDao { ...@@ -15,6 +15,8 @@ public interface SpecialPerformanceDao {
boolean update(SpecialPerformance specialPerformance); boolean update(SpecialPerformance specialPerformance);
boolean updateState(int id, int state);
int insert(SpecialPerformance specialPerformance); int insert(SpecialPerformance specialPerformance);
......
...@@ -10,7 +10,7 @@ import lombok.Data; ...@@ -10,7 +10,7 @@ import lombok.Data;
/** /**
* @author shiyu * @author shiyu
* @date 2024/03/07 * @date 2024/06/20
*/ */
@Data @Data
public class AuctionConfig implements Entity { public class AuctionConfig implements Entity {
...@@ -21,6 +21,11 @@ public class AuctionConfig implements Entity { ...@@ -21,6 +21,11 @@ public class AuctionConfig implements Entity {
*/ */
private Long itemId; private Long itemId;
/**
* 商品所属人id
*/
private Long creatorId;
/** /**
* 竞拍开始时间 * 竞拍开始时间
*/ */
...@@ -66,6 +71,11 @@ public class AuctionConfig implements Entity { ...@@ -66,6 +71,11 @@ public class AuctionConfig implements Entity {
*/ */
private Boolean isDeal; private Boolean isDeal;
/**
* 状态
*/
private Integer state;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Override @Override
...@@ -76,6 +86,7 @@ public class AuctionConfig implements Entity { ...@@ -76,6 +86,7 @@ public class AuctionConfig implements Entity {
sb.append("Hash = ").append(hashCode()); sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", itemId=").append(itemId); sb.append(", itemId=").append(itemId);
sb.append(", creatorId=").append(creatorId);
sb.append(", startTime=").append(startTime); sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime); sb.append(", endTime=").append(endTime);
sb.append(", startPrice=").append(startPrice); sb.append(", startPrice=").append(startPrice);
...@@ -85,6 +96,7 @@ public class AuctionConfig implements Entity { ...@@ -85,6 +96,7 @@ public class AuctionConfig implements Entity {
sb.append(", updateTime=").append(updateTime); sb.append(", updateTime=").append(updateTime);
sb.append(", isValid=").append(isValid); sb.append(", isValid=").append(isValid);
sb.append(", isDeal=").append(isDeal); sb.append(", isDeal=").append(isDeal);
sb.append(", state=").append(state);
sb.append(", serialVersionUID=").append(serialVersionUID); sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]"); sb.append("]");
return sb.toString(); return sb.toString();
...@@ -104,6 +116,7 @@ public class AuctionConfig implements Entity { ...@@ -104,6 +116,7 @@ public class AuctionConfig implements Entity {
AuctionConfig other = (AuctionConfig) that; AuctionConfig other = (AuctionConfig) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId())) && (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId()))
&& (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId()))
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime())) && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
&& (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime())) && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
&& (this.getStartPrice() == null ? other.getStartPrice() == null : this.getStartPrice().equals(other.getStartPrice())) && (this.getStartPrice() == null ? other.getStartPrice() == null : this.getStartPrice().equals(other.getStartPrice()))
...@@ -112,7 +125,8 @@ public class AuctionConfig implements Entity { ...@@ -112,7 +125,8 @@ public class AuctionConfig implements Entity {
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getIsValid() == null ? other.getIsValid() == null : this.getIsValid().equals(other.getIsValid())) && (this.getIsValid() == null ? other.getIsValid() == null : this.getIsValid().equals(other.getIsValid()))
&& (this.getIsDeal() == null ? other.getIsDeal() == null : this.getIsDeal().equals(other.getIsDeal())); && (this.getIsDeal() == null ? other.getIsDeal() == null : this.getIsDeal().equals(other.getIsDeal()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()));
} }
@Override @Override
...@@ -121,6 +135,7 @@ public class AuctionConfig implements Entity { ...@@ -121,6 +135,7 @@ public class AuctionConfig implements Entity {
int result = 1; int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getItemId() == null) ? 0 : getItemId().hashCode()); result = prime * result + ((getItemId() == null) ? 0 : getItemId().hashCode());
result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode()); result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode()); result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
result = prime * result + ((getStartPrice() == null) ? 0 : getStartPrice().hashCode()); result = prime * result + ((getStartPrice() == null) ? 0 : getStartPrice().hashCode());
...@@ -130,6 +145,7 @@ public class AuctionConfig implements Entity { ...@@ -130,6 +145,7 @@ public class AuctionConfig implements Entity {
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getIsValid() == null) ? 0 : getIsValid().hashCode()); result = prime * result + ((getIsValid() == null) ? 0 : getIsValid().hashCode());
result = prime * result + ((getIsDeal() == null) ? 0 : getIsDeal().hashCode()); result = prime * result + ((getIsDeal() == null) ? 0 : getIsDeal().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
return result; return result;
} }
...@@ -143,6 +159,7 @@ public class AuctionConfig implements Entity { ...@@ -143,6 +159,7 @@ public class AuctionConfig implements Entity {
public enum Column { public enum Column {
id("id", "id", "INTEGER", false), id("id", "id", "INTEGER", false),
itemId("item_id", "itemId", "BIGINT", false), itemId("item_id", "itemId", "BIGINT", false),
creatorId("creator_id", "creatorId", "BIGINT", false),
startTime("start_time", "startTime", "TIMESTAMP", false), startTime("start_time", "startTime", "TIMESTAMP", false),
endTime("end_time", "endTime", "TIMESTAMP", false), endTime("end_time", "endTime", "TIMESTAMP", false),
startPrice("start_price", "startPrice", "BIGINT", false), startPrice("start_price", "startPrice", "BIGINT", false),
...@@ -151,7 +168,8 @@ public class AuctionConfig implements Entity { ...@@ -151,7 +168,8 @@ public class AuctionConfig implements Entity {
createTime("create_time", "createTime", "TIMESTAMP", false), createTime("create_time", "createTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false), updateTime("update_time", "updateTime", "TIMESTAMP", false),
isValid("is_valid", "isValid", "BIT", false), isValid("is_valid", "isValid", "BIT", false),
isDeal("is_deal", "isDeal", "BIT", false); isDeal("is_deal", "isDeal", "BIT", false),
state("state", "state", "INTEGER", true);
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
......
...@@ -412,6 +412,138 @@ public class AuctionConfigExample { ...@@ -412,6 +412,138 @@ public class AuctionConfigExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdIsNull() {
addCriterion("creator_id is null");
return (Criteria) this;
}
public Criteria andCreatorIdIsNotNull() {
addCriterion("creator_id is not null");
return (Criteria) this;
}
public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId");
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 andCreatorIdEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("creator_id = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId");
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 andCreatorIdNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("creator_id <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId");
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 andCreatorIdGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("creator_id > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId");
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 andCreatorIdGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("creator_id >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId");
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 andCreatorIdLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("creator_id < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId");
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 andCreatorIdLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("creator_id <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this;
}
public Criteria andStartTimeIsNull() { public Criteria andStartTimeIsNull() {
addCriterion("start_time is null"); addCriterion("start_time is null");
return (Criteria) this; return (Criteria) this;
...@@ -1599,6 +1731,138 @@ public class AuctionConfigExample { ...@@ -1599,6 +1731,138 @@ public class AuctionConfigExample {
addCriterion("is_deal not between", value1, value2, "isDeal"); addCriterion("is_deal not between", value1, value2, "isDeal");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStateIsNull() {
addCriterion("`state` is null");
return (Criteria) this;
}
public Criteria andStateIsNotNull() {
addCriterion("`state` is not null");
return (Criteria) this;
}
public Criteria andStateEqualTo(Integer value) {
addCriterion("`state` =", value, "state");
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 andStateEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("`state` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStateNotEqualTo(Integer value) {
addCriterion("`state` <>", value, "state");
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 andStateNotEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("`state` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStateGreaterThan(Integer value) {
addCriterion("`state` >", value, "state");
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 andStateGreaterThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("`state` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStateGreaterThanOrEqualTo(Integer value) {
addCriterion("`state` >=", value, "state");
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 andStateGreaterThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("`state` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStateLessThan(Integer value) {
addCriterion("`state` <", value, "state");
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 andStateLessThanColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("`state` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStateLessThanOrEqualTo(Integer value) {
addCriterion("`state` <=", value, "state");
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 andStateLessThanOrEqualToColumn(AuctionConfig.Column column) {
addCriterion(new StringBuilder("`state` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStateIn(List<Integer> values) {
addCriterion("`state` in", values, "state");
return (Criteria) this;
}
public Criteria andStateNotIn(List<Integer> values) {
addCriterion("`state` not in", values, "state");
return (Criteria) this;
}
public Criteria andStateBetween(Integer value1, Integer value2) {
addCriterion("`state` between", value1, value2, "state");
return (Criteria) this;
}
public Criteria andStateNotBetween(Integer value1, Integer value2) {
addCriterion("`state` not between", value1, value2, "state");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
......
...@@ -16,6 +16,11 @@ public class AuctionConfigRequestDto extends BaseRequestDto implements Entity { ...@@ -16,6 +16,11 @@ public class AuctionConfigRequestDto extends BaseRequestDto implements Entity {
*/ */
private Long itemId; private Long itemId;
/**
* 商品所属人id
*/
private Long creatorId;
/** /**
* 竞拍开始时间 * 竞拍开始时间
*/ */
...@@ -56,5 +61,15 @@ public class AuctionConfigRequestDto extends BaseRequestDto implements Entity { ...@@ -56,5 +61,15 @@ public class AuctionConfigRequestDto extends BaseRequestDto implements Entity {
*/ */
private Boolean isValid; private Boolean isValid;
/**
* 是否成交
*/
private Boolean isDeal;
/**
* 状态
*/
private Integer state;
} }
...@@ -36,6 +36,17 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao { ...@@ -36,6 +36,17 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao {
return auctionConfigMapper.updateByPrimaryKeySelective(auctionConfig); return auctionConfigMapper.updateByPrimaryKeySelective(auctionConfig);
} }
@Override
public int updateState(long itemId, int state) {
AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId);
AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setUpdateTime(new Date());
auctionConfig.setState(state);
return auctionConfigMapper.updateByExampleSelective(auctionConfig, example);
}
@Override @Override
public AuctionConfig findByItemId(long itemId) { public AuctionConfig findByItemId(long itemId) {
AuctionConfigExample example = new AuctionConfigExample(); AuctionConfigExample example = new AuctionConfigExample();
...@@ -125,13 +136,14 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao { ...@@ -125,13 +136,14 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao {
} }
@Override @Override
public int setDeal(long itemId) { public int setDeal(long itemId, int state) {
AuctionConfigExample example = new AuctionConfigExample(); AuctionConfigExample example = new AuctionConfigExample();
AuctionConfigExample.Criteria criteria = example.createCriteria(); AuctionConfigExample.Criteria criteria = example.createCriteria();
criteria.andItemIdEqualTo(itemId); criteria.andItemIdEqualTo(itemId);
AuctionConfig auctionConfig = new AuctionConfig(); AuctionConfig auctionConfig = new AuctionConfig();
auctionConfig.setUpdateTime(new Date()); auctionConfig.setUpdateTime(new Date());
auctionConfig.setIsDeal(true); auctionConfig.setIsDeal(true);
auctionConfig.setState(state);
return auctionConfigMapper.updateByExampleSelective(auctionConfig, example); return auctionConfigMapper.updateByExampleSelective(auctionConfig, example);
} }
} }
...@@ -52,6 +52,7 @@ public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfig ...@@ -52,6 +52,7 @@ public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfig
SpecialPerformanceConfigExample example = new SpecialPerformanceConfigExample(); SpecialPerformanceConfigExample example = new SpecialPerformanceConfigExample();
SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria(); SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria();
criteria.andSpecialPerformanceIdEqualTo(specialPerformanceConfig.getSpecialPerformanceId()); criteria.andSpecialPerformanceIdEqualTo(specialPerformanceConfig.getSpecialPerformanceId());
JdbcHelper.ifPresent(specialPerformanceConfig.getItemId(), criteria::andItemIdEqualTo);
return specialPerformanceConfigMapper.updateByExampleSelective(specialPerformanceConfig, example) > 0; return specialPerformanceConfigMapper.updateByExampleSelective(specialPerformanceConfig, example) > 0;
} }
...@@ -99,4 +100,14 @@ public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfig ...@@ -99,4 +100,14 @@ public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfig
specialPerformanceConfig.setState(0); specialPerformanceConfig.setState(0);
return specialPerformanceConfigMapper.updateByExampleSelective(specialPerformanceConfig, example) > 0; return specialPerformanceConfigMapper.updateByExampleSelective(specialPerformanceConfig, example) > 0;
} }
@Override
public boolean isExisted(int specialPerformanceId, long itemId) {
SpecialPerformanceConfigExample example = new SpecialPerformanceConfigExample();
SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria();
criteria.andSpecialPerformanceIdEqualTo(specialPerformanceId);
criteria.andItemIdEqualTo(itemId);
criteria.andStateEqualTo(1);
return specialPerformanceConfigMapper.countByExample(example) > 0;
}
} }
...@@ -59,6 +59,15 @@ public class SpecialPerformanceDaoImpl implements SpecialPerformanceDao { ...@@ -59,6 +59,15 @@ public class SpecialPerformanceDaoImpl implements SpecialPerformanceDao {
} }
@Override
public boolean updateState(int id, int state) {
SpecialPerformance specialPerformance = new SpecialPerformance();
specialPerformance.setUpdateTime(new Date());
specialPerformance.setId(id);
specialPerformance.setState(state);
return specialPerformanceMapper.updateByPrimaryKeySelective(specialPerformance) > 0;
}
@Override @Override
public int insert(SpecialPerformance specialPerformance) { public int insert(SpecialPerformance specialPerformance) {
specialPerformance.setCreateTime(new Date()); specialPerformance.setCreateTime(new Date());
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.distribution.AuctionConfig"> <resultMap id="BaseResultMap" type="com.wwdz.ch.db.domain.distribution.AuctionConfig">
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id" />
<result column="item_id" jdbcType="BIGINT" property="itemId" /> <result column="item_id" jdbcType="BIGINT" property="itemId" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" /> <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="start_price" jdbcType="BIGINT" property="startPrice" /> <result column="start_price" jdbcType="BIGINT" property="startPrice" />
...@@ -13,6 +14,7 @@ ...@@ -13,6 +14,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_valid" jdbcType="BIT" property="isValid" /> <result column="is_valid" jdbcType="BIT" property="isValid" />
<result column="is_deal" jdbcType="BIT" property="isDeal" /> <result column="is_deal" jdbcType="BIT" property="isDeal" />
<result column="state" jdbcType="INTEGER" property="state" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
...@@ -73,8 +75,8 @@ ...@@ -73,8 +75,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time, id, item_id, creator_id, start_time, end_time, start_price, add_extent, real_end_time,
update_time, is_valid, is_deal create_time, update_time, is_valid, is_deal, `state`
</sql> </sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultMap="BaseResultMap">
select select
...@@ -109,8 +111,8 @@ ...@@ -109,8 +111,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time, id, item_id, creator_id, start_time, end_time, start_price, add_extent, real_end_time,
update_time, is_valid, is_deal create_time, update_time, is_valid, is_deal, `state`
</otherwise> </otherwise>
</choose> </choose>
from auction_config from auction_config
...@@ -141,8 +143,8 @@ ...@@ -141,8 +143,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time, id, item_id, creator_id, start_time, end_time, start_price, add_extent, real_end_time,
update_time, is_valid, is_deal create_time, update_time, is_valid, is_deal, `state`
</otherwise> </otherwise>
</choose> </choose>
from auction_config from auction_config
...@@ -162,14 +164,14 @@ ...@@ -162,14 +164,14 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
</selectKey> </selectKey>
insert into auction_config (item_id, start_time, end_time, insert into auction_config (item_id, creator_id, start_time,
start_price, add_extent, real_end_time, end_time, start_price, add_extent,
create_time, update_time, is_valid, real_end_time, create_time, update_time,
is_deal) is_valid, is_deal, `state`)
values (#{itemId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, values (#{itemId,jdbcType=BIGINT}, #{creatorId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP},
#{startPrice,jdbcType=BIGINT}, #{addExtent,jdbcType=BIGINT}, #{realEndTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{startPrice,jdbcType=BIGINT}, #{addExtent,jdbcType=BIGINT},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isValid,jdbcType=BIT}, #{realEndTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{isDeal,jdbcType=BIT}) #{isValid,jdbcType=BIT}, #{isDeal,jdbcType=BIT}, #{state,jdbcType=INTEGER})
</insert> </insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfig"> <insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfig">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
...@@ -180,6 +182,9 @@ ...@@ -180,6 +182,9 @@
<if test="itemId != null"> <if test="itemId != null">
item_id, item_id,
</if> </if>
<if test="creatorId != null">
creator_id,
</if>
<if test="startTime != null"> <if test="startTime != null">
start_time, start_time,
</if> </if>
...@@ -207,11 +212,17 @@ ...@@ -207,11 +212,17 @@
<if test="isDeal != null"> <if test="isDeal != null">
is_deal, is_deal,
</if> </if>
<if test="state != null">
`state`,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="itemId != null"> <if test="itemId != null">
#{itemId,jdbcType=BIGINT}, #{itemId,jdbcType=BIGINT},
</if> </if>
<if test="creatorId != null">
#{creatorId,jdbcType=BIGINT},
</if>
<if test="startTime != null"> <if test="startTime != null">
#{startTime,jdbcType=TIMESTAMP}, #{startTime,jdbcType=TIMESTAMP},
</if> </if>
...@@ -239,6 +250,9 @@ ...@@ -239,6 +250,9 @@
<if test="isDeal != null"> <if test="isDeal != null">
#{isDeal,jdbcType=BIT}, #{isDeal,jdbcType=BIT},
</if> </if>
<if test="state != null">
#{state,jdbcType=INTEGER},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultType="java.lang.Long">
...@@ -256,6 +270,9 @@ ...@@ -256,6 +270,9 @@
<if test="record.itemId != null"> <if test="record.itemId != null">
item_id = #{record.itemId,jdbcType=BIGINT}, item_id = #{record.itemId,jdbcType=BIGINT},
</if> </if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT},
</if>
<if test="record.startTime != null"> <if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=TIMESTAMP}, start_time = #{record.startTime,jdbcType=TIMESTAMP},
</if> </if>
...@@ -283,6 +300,9 @@ ...@@ -283,6 +300,9 @@
<if test="record.isDeal != null"> <if test="record.isDeal != null">
is_deal = #{record.isDeal,jdbcType=BIT}, is_deal = #{record.isDeal,jdbcType=BIT},
</if> </if>
<if test="record.state != null">
`state` = #{record.state,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" />
...@@ -292,6 +312,7 @@ ...@@ -292,6 +312,7 @@
update auction_config update auction_config
set id = #{record.id,jdbcType=INTEGER}, set id = #{record.id,jdbcType=INTEGER},
item_id = #{record.itemId,jdbcType=BIGINT}, item_id = #{record.itemId,jdbcType=BIGINT},
creator_id = #{record.creatorId,jdbcType=BIGINT},
start_time = #{record.startTime,jdbcType=TIMESTAMP}, start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP}, end_time = #{record.endTime,jdbcType=TIMESTAMP},
start_price = #{record.startPrice,jdbcType=BIGINT}, start_price = #{record.startPrice,jdbcType=BIGINT},
...@@ -300,7 +321,8 @@ ...@@ -300,7 +321,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_valid = #{record.isValid,jdbcType=BIT}, is_valid = #{record.isValid,jdbcType=BIT},
is_deal = #{record.isDeal,jdbcType=BIT} is_deal = #{record.isDeal,jdbcType=BIT},
`state` = #{record.state,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>
...@@ -311,6 +333,9 @@ ...@@ -311,6 +333,9 @@
<if test="itemId != null"> <if test="itemId != null">
item_id = #{itemId,jdbcType=BIGINT}, item_id = #{itemId,jdbcType=BIGINT},
</if> </if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT},
</if>
<if test="startTime != null"> <if test="startTime != null">
start_time = #{startTime,jdbcType=TIMESTAMP}, start_time = #{startTime,jdbcType=TIMESTAMP},
</if> </if>
...@@ -338,12 +363,16 @@ ...@@ -338,12 +363,16 @@
<if test="isDeal != null"> <if test="isDeal != null">
is_deal = #{isDeal,jdbcType=BIT}, is_deal = #{isDeal,jdbcType=BIT},
</if> </if>
<if test="state != null">
`state` = #{state,jdbcType=INTEGER},
</if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfig"> <update id="updateByPrimaryKey" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfig">
update auction_config update auction_config
set item_id = #{itemId,jdbcType=BIGINT}, set item_id = #{itemId,jdbcType=BIGINT},
creator_id = #{creatorId,jdbcType=BIGINT},
start_time = #{startTime,jdbcType=TIMESTAMP}, start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP}, end_time = #{endTime,jdbcType=TIMESTAMP},
start_price = #{startPrice,jdbcType=BIGINT}, start_price = #{startPrice,jdbcType=BIGINT},
...@@ -352,7 +381,8 @@ ...@@ -352,7 +381,8 @@
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
is_valid = #{isValid,jdbcType=BIT}, is_valid = #{isValid,jdbcType=BIT},
is_deal = #{isDeal,jdbcType=BIT} is_deal = #{isDeal,jdbcType=BIT},
`state` = #{state,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultMap="BaseResultMap"> <select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultMap="BaseResultMap">
...@@ -388,8 +418,8 @@ ...@@ -388,8 +418,8 @@
</foreach> </foreach>
</when> </when>
<otherwise> <otherwise>
id, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time, id, item_id, creator_id, start_time, end_time, start_price, add_extent, real_end_time,
update_time, is_valid, is_deal create_time, update_time, is_valid, is_deal, `state`
</otherwise> </otherwise>
</choose> </choose>
from auction_config from auction_config
...@@ -401,5 +431,4 @@ ...@@ -401,5 +431,4 @@
</if> </if>
limit 1 limit 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -63,16 +63,16 @@ ...@@ -63,16 +63,16 @@
<!--生成Model类存放位置--> <!--生成Model类存放位置-->
<javaModelGenerator targetPackage="com.wwdz.ch.db.domain" targetProject="ch-dao/src/main/java"> <javaModelGenerator targetPackage="com.wwdz.ch.db.domain.distribution" targetProject="ch-dao/src/main/java">
<property name="enableSubPackages" value="true"/> <property name="enableSubPackages" value="true"/>
<property name="trimStrings" value="true"/> <property name="trimStrings" value="true"/>
</javaModelGenerator> </javaModelGenerator>
<sqlMapGenerator targetPackage="com.wwdz.ch.db.mapper" targetProject="ch-dao/src/main/resources"/> <sqlMapGenerator targetPackage="com.wwdz.ch.db.mapper.distribution" targetProject="ch-dao/src/main/resources"/>
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper" <javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/> targetProject="ch-dao/src/main/java"/>
<table tableName="collector_white_list" 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>
......
...@@ -8,6 +8,7 @@ import com.wechat.pay.java.service.refund.model.RefundNotification; ...@@ -8,6 +8,7 @@ import com.wechat.pay.java.service.refund.model.RefundNotification;
import com.wwdz.ch.core.api.OfficialAccountApi; import com.wwdz.ch.core.api.OfficialAccountApi;
import com.wwdz.ch.core.api.WxAppletApi; import com.wwdz.ch.core.api.WxAppletApi;
import com.wwdz.ch.core.api.wxpay.WxPayServiceApi; import com.wwdz.ch.core.api.wxpay.WxPayServiceApi;
import com.wwdz.ch.core.consts.AuctionEnum;
import com.wwdz.ch.core.consts.DistributionEnum; import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.consts.RefundOrderEnum; import com.wwdz.ch.core.consts.RefundOrderEnum;
import com.wwdz.ch.core.notify.AliSmsSender; import com.wwdz.ch.core.notify.AliSmsSender;
...@@ -94,6 +95,9 @@ public class WxPayCallbackController { ...@@ -94,6 +95,9 @@ public class WxPayCallbackController {
@Autowired @Autowired
IdentifyOrderService identifyOrderService; IdentifyOrderService identifyOrderService;
@Autowired
AuctionConfigDao auctionConfigDao;
@RequestMapping(value ="/getPayNotify") @RequestMapping(value ="/getPayNotify")
public String payNotify(HttpServletRequest request) throws IOException { public String payNotify(HttpServletRequest request) throws IOException {
logger.info("------------------ 收到微信支付回调通知 ------------------"); logger.info("------------------ 收到微信支付回调通知 ------------------");
...@@ -298,6 +302,8 @@ public class WxPayCallbackController { ...@@ -298,6 +302,8 @@ public class WxPayCallbackController {
distributorBind.setIsValid(true); distributorBind.setIsValid(true);
distributorBindDao.insert(distributorBind); distributorBindDao.insert(distributorBind);
} }
//更新拍品配置中的状态为"成交"
auctionConfigDao.updateState(distributionOrder.getItemId(), AuctionEnum.StateEnum.DEALED.getCode());
return Result.success(); return Result.success();
} catch (Exception e) { } catch (Exception e) {
logger.error(">>>>>>>>>>>> 竞拍订单,微信支付回调通知处理失败 error :{}", e); logger.error(">>>>>>>>>>>> 竞拍订单,微信支付回调通知处理失败 error :{}", e);
......
...@@ -328,8 +328,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -328,8 +328,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
aliSmsSender.sendSms(record.getDistributorId(), msg); aliSmsSender.sendSms(record.getDistributorId(), msg);
} }
} }
//把该拍卖配置信息改为已处理 //把该拍卖配置信息改为已处理, 拍品状态为"中拍未付款"
auctionConfigDao.setDeal(dto.getItemId()); auctionConfigDao.setDeal(dto.getItemId(), AuctionEnum.StateEnum.GET_NOT_PAY.getCode());
//发送中拍信息给用户 //发送中拍信息给用户
String userOpenId = sendMsgService.getOpenIdByUserId(auctionRecord.getUserId()); String userOpenId = sendMsgService.getOpenIdByUserId(auctionRecord.getUserId());
Instant instant = auctionConfig.getRealEndTime().toInstant().plus(Duration.ofHours(24)); Instant instant = auctionConfig.getRealEndTime().toInstant().plus(Duration.ofHours(24));
......
...@@ -81,13 +81,13 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService ...@@ -81,13 +81,13 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
Date now = new Date(); Date now = new Date();
//到时自动开始,修改状态 //到时自动开始,修改状态
SpecialPerformanceRequestDto specialPerformanceRequestDto = new SpecialPerformanceRequestDto(); SpecialPerformanceRequestDto specialPerformanceRequestDto = new SpecialPerformanceRequestDto();
specialPerformanceRequestDto.setState(DistributionEnum.AuctionStateEnum.NOT_START.getCode()); specialPerformanceRequestDto.setState(SpecialPerformanceEnum.StateEnum.PREVIEW.getCode());
List<SpecialPerformance> specialPerformanceList = specialPerformanceDao.find(specialPerformanceRequestDto); List<SpecialPerformance> specialPerformanceList = specialPerformanceDao.find(specialPerformanceRequestDto);
for (SpecialPerformance notStartSpecialPerformance : specialPerformanceList) { for (SpecialPerformance notStartSpecialPerformance : specialPerformanceList) {
if (now.after(notStartSpecialPerformance.getStartTime())) { if (now.after(notStartSpecialPerformance.getStartTime()) && notStartSpecialPerformance.getEndTime().after(now)) {
SpecialPerformance updateDto = new SpecialPerformance(); SpecialPerformance updateDto = new SpecialPerformance();
updateDto.setId(notStartSpecialPerformance.getId()); updateDto.setId(notStartSpecialPerformance.getId());
updateDto.setState(DistributionEnum.AuctionStateEnum.IN_AUCTION.getCode()); updateDto.setState(SpecialPerformanceEnum.StateEnum.PROCESSING.getCode());
updateDto.setUpdateTime(now); updateDto.setUpdateTime(now);
specialPerformanceDao.update(updateDto); specialPerformanceDao.update(updateDto);
} }
...@@ -102,10 +102,10 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService ...@@ -102,10 +102,10 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
if (now.after(specialPerformance.getEndTime())) { if (now.after(specialPerformance.getEndTime())) {
SpecialPerformance updateDto = new SpecialPerformance(); SpecialPerformance updateDto = new SpecialPerformance();
updateDto.setId(specialPerformance.getId()); updateDto.setId(specialPerformance.getId());
updateDto.setState(DistributionEnum.AuctionStateEnum.END.getCode()); updateDto.setState(SpecialPerformanceEnum.StateEnum.END.getCode());
updateDto.setUpdateTime(now); updateDto.setUpdateTime(now);
specialPerformanceDao.update(updateDto); specialPerformanceDao.update(updateDto);
specialPerformance.setState(DistributionEnum.AuctionStateEnum.END.getCode()); specialPerformance.setState(SpecialPerformanceEnum.StateEnum.END.getCode());
} }
int specialPerformanceId = specialPerformance.getId(); int specialPerformanceId = specialPerformance.getId();
SpecialPerformanceConfigRequestDto specialPerformanceConfigRequestDto = new SpecialPerformanceConfigRequestDto(); SpecialPerformanceConfigRequestDto specialPerformanceConfigRequestDto = new SpecialPerformanceConfigRequestDto();
......
package com.wwdz.ch.wx.job; package com.wwdz.ch.wx.job;
import com.wwdz.ch.core.consts.AuctionEnum;
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.db.dao.distribution.AuctionConfigDao; import com.wwdz.ch.db.dao.distribution.AuctionConfigDao;
import com.wwdz.ch.db.dao.distribution.AuctionRecordDao; import com.wwdz.ch.db.dao.distribution.AuctionRecordDao;
...@@ -99,8 +101,8 @@ public class AutoCreateAuctionOrderJob { ...@@ -99,8 +101,8 @@ public class AutoCreateAuctionOrderJob {
} }
} }
} else { } else {
//没有出价记录,流拍的商品也要更新拍卖配置信息为已处理 //没有出价记录,流拍的商品也要更新拍卖配置信息为已处理, 拍品状态更新为"无出价流拍"
auctionConfigDao.setDeal(itemId); auctionConfigDao.setDeal(itemId, AuctionEnum.StateEnum.NO_OFFER_TO_PASS.getCode());
} }
}); });
//把截拍超过24小时的商品设置为下架 //把截拍超过24小时的商品设置为下架
...@@ -135,5 +137,4 @@ public class AutoCreateAuctionOrderJob { ...@@ -135,5 +137,4 @@ public class AutoCreateAuctionOrderJob {
} }
} }
} }
package com.wwdz.ch.wx.job; package com.wwdz.ch.wx.job;
import com.wwdz.ch.core.consts.AuctionEnum;
import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.consts.SpecialPerformanceEnum;
import com.wwdz.ch.core.notify.AliSmsSender; import com.wwdz.ch.core.notify.AliSmsSender;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
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.core.util.StringUtil; import com.wwdz.ch.core.util.StringUtil;
import com.wwdz.ch.db.dao.distribution.AuctionConfigDao; import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.dao.distribution.AuctionRecordDao; import com.wwdz.ch.db.domain.distribution.*;
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.core.api.WxAppletApi; import com.wwdz.ch.core.api.WxAppletApi;
import com.wwdz.ch.core.entity.AuctionOfferNoticeMsg; import com.wwdz.ch.core.entity.AuctionOfferNoticeMsg;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceConfigRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto;
import com.wwdz.ch.wx.service.distribution.DistributionOrderService; import com.wwdz.ch.wx.service.distribution.DistributionOrderService;
import com.wwdz.ch.core.service.SendMsgService; import com.wwdz.ch.core.service.SendMsgService;
import com.xxdxxs.utils.DateUtils; import com.xxdxxs.utils.DateUtils;
...@@ -84,6 +84,9 @@ public class AutoSendMsgJob { ...@@ -84,6 +84,9 @@ public class AutoSendMsgJob {
@Autowired @Autowired
WxAppletApi wxAppletApi; WxAppletApi wxAppletApi;
@Autowired
SpecialPerformanceDao specialPerformanceDao;
@Value("${dts.wx.auction-msg-url}") @Value("${dts.wx.auction-msg-url}")
private String AUCTION_MSG_URL; private String AUCTION_MSG_URL;
...@@ -99,6 +102,9 @@ public class AutoSendMsgJob { ...@@ -99,6 +102,9 @@ public class AutoSendMsgJob {
} }
logger.info(">>>>>>>>>>>>>>>>>>>>>>> 自动发送拍卖通知任务,开始执行 <<<<<<<<<<<<<<<<<<<<<"); logger.info(">>>>>>>>>>>>>>>>>>>>>>> 自动发送拍卖通知任务,开始执行 <<<<<<<<<<<<<<<<<<<<<");
try { try {
//自动取消中拍未付款超时的订单
autoCancelNotPayOrder();
//查询即将在一小时内截拍的商品,通知参与过出价的用户即将截拍 //查询即将在一小时内截拍的商品,通知参与过出价的用户即将截拍
List<AuctionConfig> auctionConfigList = auctionConfigDao.findAbortEndList(); List<AuctionConfig> auctionConfigList = auctionConfigDao.findAbortEndList();
logger.info(">>>>>> 一小时内即将截拍的商品数量 :{} <<<<<<<", auctionConfigList.size()); logger.info(">>>>>> 一小时内即将截拍的商品数量 :{} <<<<<<<", auctionConfigList.size());
...@@ -219,4 +225,27 @@ public class AutoSendMsgJob { ...@@ -219,4 +225,27 @@ public class AutoSendMsgJob {
} }
} }
/**
* 拍卖订单中拍超时未付款导致流拍
* 自动更新这些拍品的状态为"中拍未付款流拍"
*/
public void autoCancelNotPayOrder() {
DistributionOrderRequestDto dto = new DistributionOrderRequestDto();
dto.setType(DistributionEnum.DistributionTypeEnum.AUCTION.getCode());
dto.setState(DistributionEnum.DistributionOrderStateEnum.PRE_PAY.getCode());
List<DistributionOrder> prePayList = distributionOrderDao.findByPage(dto);
prePayList.forEach(distributionOrder -> {
long diffInMillies = Math.abs(new Date().getTime() - distributionOrder.getCreateTime().getTime());
//竞拍商品超出24小时未付款,订单取消
long diffInHours = diffInMillies / (60 * 1000 * 60);
if (diffInHours >= 24) {
distributionOrderDao.updateState(distributionOrder.getDistributionOrderId(), DistributionEnum.DistributionOrderStateEnum.CANCEL.getCode());
auctionConfigDao.updateState(distributionOrder.getItemId(), AuctionEnum.StateEnum.GET_NOT_PAY_TO_PASS.getCode());
logger.info("================== 拍品:{}, 超过付款时效, 自动取消订单 ==================", distributionOrder.getItemId());
}
});
}
} }
...@@ -2,7 +2,9 @@ package com.wwdz.ch.wx.job; ...@@ -2,7 +2,9 @@ package com.wwdz.ch.wx.job;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.wwdz.ch.core.api.WxAppletApi; import com.wwdz.ch.core.api.WxAppletApi;
import com.wwdz.ch.core.consts.AuctionEnum;
import com.wwdz.ch.core.consts.DistributionEnum; import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.consts.SpecialPerformanceEnum;
import com.wwdz.ch.core.entity.AuctionOfferNoticeMsg; import com.wwdz.ch.core.entity.AuctionOfferNoticeMsg;
import com.wwdz.ch.core.notify.AliSmsSender; import com.wwdz.ch.core.notify.AliSmsSender;
import com.wwdz.ch.core.service.SendMsgService; import com.wwdz.ch.core.service.SendMsgService;
...@@ -52,6 +54,9 @@ public class SpecialPerformanceNoticeJob { ...@@ -52,6 +54,9 @@ public class SpecialPerformanceNoticeJob {
@Autowired @Autowired
SpecialPerformanceDao specialPerformanceDao; SpecialPerformanceDao specialPerformanceDao;
@Autowired
SpecialPerformanceConfigDao specialPerformanceConfigDao;
@Autowired @Autowired
RedissonClient redissonClient; RedissonClient redissonClient;
...@@ -67,6 +72,9 @@ public class SpecialPerformanceNoticeJob { ...@@ -67,6 +72,9 @@ public class SpecialPerformanceNoticeJob {
@Autowired @Autowired
WxAppletApi wxAppletApi; WxAppletApi wxAppletApi;
@Autowired
AuctionConfigDao auctionConfigDao;
@Autowired @Autowired
UserDao userDao; UserDao userDao;
...@@ -84,8 +92,10 @@ public class SpecialPerformanceNoticeJob { ...@@ -84,8 +92,10 @@ public class SpecialPerformanceNoticeJob {
} }
logger.info(">>>>>>>>>>>>>>>>>>>>>>> 专场即将开始通知任务,开始执行 <<<<<<<<<<<<<<<<<<<<<"); logger.info(">>>>>>>>>>>>>>>>>>>>>>> 专场即将开始通知任务,开始执行 <<<<<<<<<<<<<<<<<<<<<");
try { try {
autoRefreshSpecialPerformanceState();
SpecialPerformanceRequestDto specialPerformanceRequestDto = new SpecialPerformanceRequestDto(); SpecialPerformanceRequestDto specialPerformanceRequestDto = new SpecialPerformanceRequestDto();
specialPerformanceRequestDto.setState(DistributionEnum.AuctionStateEnum.NOT_START.getCode()); specialPerformanceRequestDto.setState(SpecialPerformanceEnum.StateEnum.PREVIEW.getCode());
Date now = new Date(); Date now = new Date();
Instant startInstant = now.toInstant().plus(Duration.ofMinutes(20)); Instant startInstant = now.toInstant().plus(Duration.ofMinutes(20));
Date startTime = Date.from(startInstant); Date startTime = Date.from(startInstant);
...@@ -143,4 +153,83 @@ public class SpecialPerformanceNoticeJob { ...@@ -143,4 +153,83 @@ public class SpecialPerformanceNoticeJob {
} }
} }
/**
* 自动更新专场和专场商品在竞拍结束前的状态
*/
public void autoRefreshSpecialPerformanceState() {
try {
//查询专场
SpecialPerformanceRequestDto specialPerformanceRequestDto = new SpecialPerformanceRequestDto();
specialPerformanceRequestDto.setFilterState(SpecialPerformanceEnum.StateEnum.END.getCode());
List<SpecialPerformance> specialPerformanceList = specialPerformanceDao.find(specialPerformanceRequestDto);
Date now = new Date();
Instant startInstant = now.toInstant().minus(Duration.ofDays(1));
Date startTime = Date.from(startInstant);
for (SpecialPerformance specialPerformance : specialPerformanceList) {
if (specialPerformance.getState().intValue() == SpecialPerformanceEnum.StateEnum.DELETED.getCode()) {
continue;
} else if (specialPerformance.getState().intValue() == SpecialPerformanceEnum.StateEnum.NOT_START.getCode()) {
//未开始的专场判断是否需要改为预展中,开始时间提前一天预展
//设置为预展中
if (specialPerformance.getStartTime().after(startTime) && specialPerformance.getStartTime().before(now)) {
if (specialPerformance.getState().intValue() != SpecialPerformanceEnum.StateEnum.PREVIEW.getCode()) {
specialPerformanceDao.updateState(specialPerformance.getId(), SpecialPerformanceEnum.StateEnum.PREVIEW.getCode());
}
} else if (specialPerformance.getStartTime().after(now) && specialPerformance.getEndTime().after(now)) {
//开始时间之后,结束时间之前,状态设置为进行中
if (specialPerformance.getState().intValue() != SpecialPerformanceEnum.StateEnum.PROCESSING.getCode()) {
specialPerformanceDao.updateState(specialPerformance.getId(), SpecialPerformanceEnum.StateEnum.PROCESSING.getCode());
}
}
} else if (specialPerformance.getState().intValue() == SpecialPerformanceEnum.StateEnum.PREVIEW.getCode()) {
if (specialPerformance.getStartTime().after(now) && specialPerformance.getEndTime().after(now)) {
//开始时间之后,结束时间之前,状态设置为进行中
if (specialPerformance.getState().intValue() != SpecialPerformanceEnum.StateEnum.PROCESSING.getCode()) {
specialPerformanceDao.updateState(specialPerformance.getId(), SpecialPerformanceEnum.StateEnum.PROCESSING.getCode());
}
} else if (specialPerformance.getEndTime().before(now)) {
//超过结束时间,状态设置为结束
specialPerformanceDao.updateState(specialPerformance.getId(), SpecialPerformanceEnum.StateEnum.END.getCode());
}
} else if (specialPerformance.getState().intValue() == SpecialPerformanceEnum.StateEnum.PROCESSING.getCode()) {
//超过结束时间,状态设置为结束
if (specialPerformance.getEndTime().before(now)) {
specialPerformanceDao.updateState(specialPerformance.getId(), SpecialPerformanceEnum.StateEnum.END.getCode());
}
}
//查询该专场下的商品,自动更新状态
List<SpecialPerformanceConfig> specialPerformanceConfigList = specialPerformanceConfigDao.findAllItem(specialPerformance.getId());
for (SpecialPerformanceConfig specialPerformanceConfig : specialPerformanceConfigList) {
long itemId = specialPerformanceConfig.getItemId();
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(itemId);
if (auctionConfig.getState().intValue() == AuctionEnum.StateEnum.WAIT_ON_SALE.getCode()) {
//待上架的拍品判断是否需要改为预展中,开始时间提前一天预展
if (auctionConfig.getStartTime().after(startTime) && auctionConfig.getStartTime().before(now)) {
if (auctionConfig.getState().intValue() != AuctionEnum.StateEnum.PREVIEW.getCode()) {
auctionConfigDao.updateState(itemId, AuctionEnum.StateEnum.PREVIEW.getCode());
}
} else if (auctionConfig.getStartTime().after(now) && auctionConfig.getEndTime().after(now)) {
//开始时间之后,结束时间之前,状态设置为拍卖中
if (auctionConfig.getState().intValue() != AuctionEnum.StateEnum.AUCTIONING.getCode()) {
auctionConfigDao.updateState(itemId, AuctionEnum.StateEnum.AUCTIONING.getCode());
}
}
} else if (auctionConfig.getState().intValue() == AuctionEnum.StateEnum.PREVIEW.getCode()) {
if (auctionConfig.getStartTime().after(now) && specialPerformance.getEndTime().after(now)) {
//开始时间之后,结束时间之前,状态设置为进行中
if (auctionConfig.getState().intValue() != AuctionEnum.StateEnum.AUCTIONING.getCode()) {
auctionConfigDao.updateState(itemId, AuctionEnum.StateEnum.AUCTIONING.getCode());
}
}
}
}
}
logger.info(">>>>>>>>>>>> 自动更新专场和专场商品在竞拍结束前的状态 SUCCESS <<<<<<<<<<<<<");
} catch (Exception e) {
logger.error("自动更新专场和专场商品在竞拍结束前的状态 ERROR :{}", e);
}
}
} }
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