Commit 15819834 authored by shiyu's avatar shiyu

lot设置

parent 1d15bc67
......@@ -129,4 +129,33 @@ public class SysSpecialPerformanceController {
return sysSpecialPerformanceService.findItemListById(dto);
}
@ApiOperation(value = "拍品排序")
@PostMapping("/itemSort")
public Result itemSort(@RequestBody SpecialPerformanceConfigRequestDto dto) {
logger.info("专场拍品排序,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("specialPerformanceId", "专场id").must().number()
.set("itemId", "商品id").must().number()
.set("lot", "lot").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return sysSpecialPerformanceService.itemSort(dto);
}
@ApiOperation(value = "根据lot配置截拍时间")
@PostMapping("/autoConfigTimeByLot")
public Result autoConfigTimeByLot(@RequestBody SpecialPerformanceConfigRequestDto dto) {
logger.info("专场配置截拍时间,请求参数:{}", JSON.toJSONString(dto));
Validator validator = new Validator(FormHandler.ofEntity(dto));
validator.set("specialPerformanceId", "专场id").must().number()
.end();
if (!validator.isValid()) {
return Result.failed(validator.getErrorInfo());
}
return sysSpecialPerformanceService.autoConfigTimeByLot(dto);
}
}
......@@ -127,6 +127,7 @@ public class SysSpecialPerformanceServiceImpl implements SysSpecialPerformanceSe
SupplierItem supplierItem = supplierItemDao.findById(specialPerformanceConfig.getItemId());
SupplierItemVo supplierItemVo = new SupplierItemVo();
EntityMapper.copyAttribute(supplierItem, supplierItemVo);
supplierItemVo.setLot(specialPerformanceConfig.getLot());
supplierItemVo.setDistributionPrice(PriceUtil.convertPriceFenToYuan(supplierItem.getDistributionPrice()));
supplierItemVo.setHomePageImage(MediaUtil.getHomePageImage(supplierItem.getImages(), supplierItem.getVideos()));
supplierItemVo.setTypeName(DistributionEnum.DistributionTypeEnum.getNameByCode(supplierItem.getType()));
......@@ -213,9 +214,11 @@ public class SysSpecialPerformanceServiceImpl implements SysSpecialPerformanceSe
if (flag) {
continue;
}
AuctionConfig auctionConfig = auctionConfigDao.findByItemId(Long.valueOf(itemId));
SpecialPerformanceConfig specialPerformanceConfig = new SpecialPerformanceConfig();
specialPerformanceConfig.setItemId(Long.valueOf(itemId));
specialPerformanceConfig.setSpecialPerformanceId(dto.getSpecialPerformanceId());
specialPerformanceConfig.setCurrentPrice(auctionConfig.getStartPrice());
specialPerformanceConfig.setState(SpecialPerformanceEnum.ConfigStateEnum.VALID.getCode());
Random random = new Random();
int randomNumber = random.nextInt(20);
......@@ -258,4 +261,27 @@ public class SysSpecialPerformanceServiceImpl implements SysSpecialPerformanceSe
}
return Result.failed();
}
@Override
public Result itemSort(SpecialPerformanceConfigRequestDto dto) {
try {
//校验是否lot重复
boolean isExist = specialPerformanceConfigDao.isExistedSort(dto.getSpecialPerformanceId(), dto.getItemId(), dto.getLot());
if (isExist) {
return Result.failed("lot重复");
}
specialPerformanceConfigDao.itemSort(dto.getSpecialPerformanceId(), dto.getItemId(), dto.getLot());
return Result.success();
} catch (Exception e) {
logger.error("专场商品排序 error {}", e);
}
return Result.failed();
}
@Override
public Result autoConfigTimeByLot(SpecialPerformanceConfigRequestDto dto) {
return null;
}
}
......@@ -378,6 +378,9 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
auctionConfig.setIsDeal(false);
}
auctionConfigDao.update(auctionConfig);
//调整专场里商品的当前价
// List<SpecialPerformanceConfig> specialPerformanceConfigList = specialPerformanceConfigDao.findList();
// specialPerformanceConfigDao.update();
}
long oldDistributionPrice = oldSupplierItem.getDistributionPrice();
if (oldDistributionPrice != PriceUtil.convertPriceFromStr(dto.getDistributionPrice())) {
......
......@@ -71,4 +71,18 @@ public interface SysSpecialPerformanceService {
*/
Result reSale(SpecialPerformanceConfigRequestDto dto);
/**
* 专场商品排序
* @param dto
* @return
*/
Result itemSort(SpecialPerformanceConfigRequestDto dto);
/**
* 根据lot配置拍品截拍时间
* @param dto
* @return
*/
Result autoConfigTimeByLot(SpecialPerformanceConfigRequestDto dto);
}
......@@ -5,6 +5,7 @@ public enum ShareTypeEnum {
COLLECTOR_ITEM(1, "藏家藏品"),
COLLECTOR_PAGE(2, "藏家藏馆"),
SYSTEM_ITEM(3, "平台藏品"),
COLLECTOR_AUCTION_ITEM(4, "藏家拍品"),
;
private Integer code;
......
......@@ -304,4 +304,9 @@ public class SupplierItemVo implements Entity {
*/
private Boolean isTransformAuction;
/**
* 专场拍品编号
*/
private Integer lot;
}
......@@ -25,4 +25,8 @@ public interface SpecialPerformanceConfigDao {
boolean isExisted(int specialPerformanceId, long itemId);
boolean isExistedSort(int specialPerformanceId, long itemId, int lot);
boolean itemSort(int specialPerformanceId, long itemId, int lot);
}
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/06/04
* @date 2024/06/26
*/
@Data
public class SpecialPerformance implements Entity {
......@@ -46,6 +44,11 @@ public class SpecialPerformance implements Entity {
*/
private Date endTime;
/**
* 商品结束间隔,单位分钟
*/
private Double itemEndInterval;
/**
* 专场类型1拍卖
*/
......@@ -71,6 +74,7 @@ public class SpecialPerformance implements Entity {
sb.append(", updateTime=").append(updateTime);
sb.append(", startTime=").append(startTime);
sb.append(", endTime=").append(endTime);
sb.append(", itemEndInterval=").append(itemEndInterval);
sb.append(", type=").append(type);
sb.append(", state=").append(state);
sb.append(", serialVersionUID=").append(serialVersionUID);
......@@ -97,6 +101,7 @@ public class SpecialPerformance implements Entity {
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
&& (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
&& (this.getItemEndInterval() == null ? other.getItemEndInterval() == null : this.getItemEndInterval().equals(other.getItemEndInterval()))
&& (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()));
}
......@@ -112,6 +117,7 @@ public class SpecialPerformance implements Entity {
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
result = prime * result + ((getItemEndInterval() == null) ? 0 : getItemEndInterval().hashCode());
result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
return result;
......@@ -132,6 +138,7 @@ public class SpecialPerformance implements Entity {
updateTime("update_time", "updateTime", "TIMESTAMP", false),
startTime("start_time", "startTime", "TIMESTAMP", false),
endTime("end_time", "endTime", "TIMESTAMP", false),
itemEndInterval("item_end_interval", "itemEndInterval", "DOUBLE", false),
type("type", "type", "INTEGER", true),
state("state", "state", "INTEGER", true);
......
package com.wwdz.ch.db.domain.distribution;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
......@@ -9,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/05/29
* @date 2024/06/25
*/
@Data
public class SpecialPerformanceConfig implements Entity {
......@@ -35,6 +36,16 @@ public class SpecialPerformanceConfig implements Entity {
*/
private Integer viewNum;
/**
* 当前价,要除以100
*/
private Long currentPrice;
/**
* 编号
*/
private Integer lot;
/**
* 状态
*/
......@@ -53,6 +64,8 @@ public class SpecialPerformanceConfig implements Entity {
sb.append(", itemId=").append(itemId);
sb.append(", createTime=").append(createTime);
sb.append(", viewNum=").append(viewNum);
sb.append(", currentPrice=").append(currentPrice);
sb.append(", lot=").append(lot);
sb.append(", state=").append(state);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
......@@ -76,6 +89,8 @@ public class SpecialPerformanceConfig implements Entity {
&& (this.getItemId() == null ? other.getItemId() == null : this.getItemId().equals(other.getItemId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getViewNum() == null ? other.getViewNum() == null : this.getViewNum().equals(other.getViewNum()))
&& (this.getCurrentPrice() == null ? other.getCurrentPrice() == null : this.getCurrentPrice().equals(other.getCurrentPrice()))
&& (this.getLot() == null ? other.getLot() == null : this.getLot().equals(other.getLot()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()));
}
......@@ -88,6 +103,8 @@ public class SpecialPerformanceConfig implements Entity {
result = prime * result + ((getItemId() == null) ? 0 : getItemId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
result = prime * result + ((getViewNum() == null) ? 0 : getViewNum().hashCode());
result = prime * result + ((getCurrentPrice() == null) ? 0 : getCurrentPrice().hashCode());
result = prime * result + ((getLot() == null) ? 0 : getLot().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
return result;
}
......@@ -105,6 +122,8 @@ public class SpecialPerformanceConfig implements Entity {
itemId("item_id", "itemId", "BIGINT", false),
createTime("create_time", "createTime", "TIMESTAMP", false),
viewNum("view_num", "viewNum", "INTEGER", false),
currentPrice("current_price", "currentPrice", "BIGINT", false),
lot("lot", "lot", "INTEGER", false),
state("state", "state", "INTEGER", true);
/**
......
......@@ -1092,6 +1092,138 @@ public class SpecialPerformanceExample {
return (Criteria) this;
}
public Criteria andItemEndIntervalIsNull() {
addCriterion("item_end_interval is null");
return (Criteria) this;
}
public Criteria andItemEndIntervalIsNotNull() {
addCriterion("item_end_interval is not null");
return (Criteria) this;
}
public Criteria andItemEndIntervalEqualTo(Double value) {
addCriterion("item_end_interval =", value, "itemEndInterval");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemEndIntervalEqualToColumn(SpecialPerformance.Column column) {
addCriterion(new StringBuilder("item_end_interval = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemEndIntervalNotEqualTo(Double value) {
addCriterion("item_end_interval <>", value, "itemEndInterval");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemEndIntervalNotEqualToColumn(SpecialPerformance.Column column) {
addCriterion(new StringBuilder("item_end_interval <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemEndIntervalGreaterThan(Double value) {
addCriterion("item_end_interval >", value, "itemEndInterval");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemEndIntervalGreaterThanColumn(SpecialPerformance.Column column) {
addCriterion(new StringBuilder("item_end_interval > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemEndIntervalGreaterThanOrEqualTo(Double value) {
addCriterion("item_end_interval >=", value, "itemEndInterval");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemEndIntervalGreaterThanOrEqualToColumn(SpecialPerformance.Column column) {
addCriterion(new StringBuilder("item_end_interval >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemEndIntervalLessThan(Double value) {
addCriterion("item_end_interval <", value, "itemEndInterval");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemEndIntervalLessThanColumn(SpecialPerformance.Column column) {
addCriterion(new StringBuilder("item_end_interval < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemEndIntervalLessThanOrEqualTo(Double value) {
addCriterion("item_end_interval <=", value, "itemEndInterval");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table special_performance
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andItemEndIntervalLessThanOrEqualToColumn(SpecialPerformance.Column column) {
addCriterion(new StringBuilder("item_end_interval <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andItemEndIntervalIn(List<Double> values) {
addCriterion("item_end_interval in", values, "itemEndInterval");
return (Criteria) this;
}
public Criteria andItemEndIntervalNotIn(List<Double> values) {
addCriterion("item_end_interval not in", values, "itemEndInterval");
return (Criteria) this;
}
public Criteria andItemEndIntervalBetween(Double value1, Double value2) {
addCriterion("item_end_interval between", value1, value2, "itemEndInterval");
return (Criteria) this;
}
public Criteria andItemEndIntervalNotBetween(Double value1, Double value2) {
addCriterion("item_end_interval not between", value1, value2, "itemEndInterval");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
......
......@@ -27,6 +27,11 @@ public class SpecialPerformanceConfigRequestDto extends BaseRequestDto implement
*/
private Long itemId;
/**
* 编号
*/
private Integer lot;
/**
* 创建时间
*/
......
......@@ -22,6 +22,11 @@ public class SpecialPerformanceRequestDto extends BaseRequestDto implements Enti
*/
private String backgroundImage;
/**
* 商品结束间隔,单位分钟
*/
private Double itemEndInterval;
/**
* 专场名称
*/
......
......@@ -111,4 +111,27 @@ public class SpecialPerformanceConfigDaoImpl implements SpecialPerformanceConfig
criteria.andStateEqualTo(1);
return specialPerformanceConfigMapper.countByExample(example) > 0;
}
@Override
public boolean isExistedSort(int specialPerformanceId, long itemId, int lot) {
SpecialPerformanceConfigExample example = new SpecialPerformanceConfigExample();
SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria();
criteria.andSpecialPerformanceIdEqualTo(specialPerformanceId);
criteria.andItemIdEqualTo(itemId);
criteria.andLotEqualTo(lot);
criteria.andStateEqualTo(1);
return specialPerformanceConfigMapper.countByExample(example) > 0;
}
@Override
public boolean itemSort(int specialPerformanceId, long itemId, int lot) {
SpecialPerformanceConfigExample example = new SpecialPerformanceConfigExample();
SpecialPerformanceConfigExample.Criteria criteria = example.createCriteria();
criteria.andSpecialPerformanceIdEqualTo(specialPerformanceId);
criteria.andItemIdEqualTo(itemId);
SpecialPerformanceConfig specialPerformanceConfig = new SpecialPerformanceConfig();
specialPerformanceConfig.setLot(lot);
return specialPerformanceConfigMapper.updateByExampleSelective(specialPerformanceConfig, example) > 0;
}
}
......@@ -7,6 +7,8 @@
<result column="item_id" jdbcType="BIGINT" property="itemId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="view_num" jdbcType="INTEGER" property="viewNum" />
<result column="current_price" jdbcType="BIGINT" property="currentPrice" />
<result column="lot" jdbcType="INTEGER" property="lot" />
<result column="state" jdbcType="INTEGER" property="state" />
</resultMap>
<sql id="Example_Where_Clause">
......@@ -68,7 +70,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, special_performance_id, item_id, create_time, view_num, `state`
id, special_performance_id, item_id, create_time, view_num, current_price, lot, `state`
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.SpecialPerformanceConfigExample" resultMap="BaseResultMap">
select
......@@ -97,13 +99,14 @@
distinct
</if>
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, special_performance_id, item_id, create_time, view_num, `state`
id, special_performance_id, item_id, create_time, view_num, current_price, lot, `state`
</otherwise>
</choose>
from special_performance_config
......@@ -128,13 +131,14 @@
-->
select
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, special_performance_id, item_id, create_time, view_num, `state`
id, special_performance_id, item_id, create_time, view_num, current_price, lot, `state`
</otherwise>
</choose>
from special_performance_config
......@@ -155,9 +159,11 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into special_performance_config (special_performance_id, item_id, create_time,
view_num, `state`)
view_num, current_price, lot,
`state`)
values (#{specialPerformanceId,jdbcType=INTEGER}, #{itemId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{viewNum,jdbcType=INTEGER}, #{state,jdbcType=INTEGER})
#{viewNum,jdbcType=INTEGER}, #{currentPrice,jdbcType=BIGINT}, #{lot,jdbcType=INTEGER},
#{state,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.SpecialPerformanceConfig">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
......@@ -177,6 +183,12 @@
<if test="viewNum != null">
view_num,
</if>
<if test="currentPrice != null">
current_price,
</if>
<if test="lot != null">
lot,
</if>
<if test="state != null">
`state`,
</if>
......@@ -194,6 +206,12 @@
<if test="viewNum != null">
#{viewNum,jdbcType=INTEGER},
</if>
<if test="currentPrice != null">
#{currentPrice,jdbcType=BIGINT},
</if>
<if test="lot != null">
#{lot,jdbcType=INTEGER},
</if>
<if test="state != null">
#{state,jdbcType=INTEGER},
</if>
......@@ -223,6 +241,12 @@
<if test="record.viewNum != null">
view_num = #{record.viewNum,jdbcType=INTEGER},
</if>
<if test="record.currentPrice != null">
current_price = #{record.currentPrice,jdbcType=BIGINT},
</if>
<if test="record.lot != null">
lot = #{record.lot,jdbcType=INTEGER},
</if>
<if test="record.state != null">
`state` = #{record.state,jdbcType=INTEGER},
</if>
......@@ -238,6 +262,8 @@
item_id = #{record.itemId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
view_num = #{record.viewNum,jdbcType=INTEGER},
current_price = #{record.currentPrice,jdbcType=BIGINT},
lot = #{record.lot,jdbcType=INTEGER},
`state` = #{record.state,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -258,6 +284,12 @@
<if test="viewNum != null">
view_num = #{viewNum,jdbcType=INTEGER},
</if>
<if test="currentPrice != null">
current_price = #{currentPrice,jdbcType=BIGINT},
</if>
<if test="lot != null">
lot = #{lot,jdbcType=INTEGER},
</if>
<if test="state != null">
`state` = #{state,jdbcType=INTEGER},
</if>
......@@ -270,6 +302,8 @@
item_id = #{itemId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
view_num = #{viewNum,jdbcType=INTEGER},
current_price = #{currentPrice,jdbcType=BIGINT},
lot = #{lot,jdbcType=INTEGER},
`state` = #{state,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
......@@ -300,13 +334,14 @@
select
'true' as QUERYID,
<choose>
<when test="selective != null and selective.length > 0">
<when test="selective != null and selective.length &gt; 0">
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
</when>
<otherwise>
id, special_performance_id, item_id, create_time, view_num, `state`
id, special_performance_id, item_id, create_time, view_num, current_price, lot, `state`
</otherwise>
</choose>
from special_performance_config
......@@ -318,7 +353,6 @@
</if>
limit 1
</select>
<select id="countViewNum" parameterType="java.lang.Integer" resultType="java.lang.Long">
select IFNULL(sum(view_num),0) from special_performance_config where special_performance_id = #{specialPerformanceId} and state = 1
</select>
......
......@@ -9,6 +9,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
<result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
<result column="item_end_interval" jdbcType="DOUBLE" property="itemEndInterval" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="state" jdbcType="INTEGER" property="state" />
</resultMap>
......@@ -71,8 +72,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, title, background_image, create_time, update_time, start_time, end_time, `type`,
`state`
id, title, background_image, create_time, update_time, start_time, end_time, item_end_interval,
`type`, `state`
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.SpecialPerformanceExample" resultMap="BaseResultMap">
select
......@@ -107,8 +108,8 @@
</foreach>
</when>
<otherwise>
id, title, background_image, create_time, update_time, start_time, end_time, `type`,
`state`
id, title, background_image, create_time, update_time, start_time, end_time, item_end_interval,
`type`, `state`
</otherwise>
</choose>
from special_performance
......@@ -139,8 +140,8 @@
</foreach>
</when>
<otherwise>
id, title, background_image, create_time, update_time, start_time, end_time, `type`,
`state`
id, title, background_image, create_time, update_time, start_time, end_time, item_end_interval,
`type`, `state`
</otherwise>
</choose>
from special_performance
......@@ -162,10 +163,12 @@
</selectKey>
insert into special_performance (title, background_image, create_time,
update_time, start_time, end_time,
`type`, `state`)
item_end_interval, `type`, `state`
)
values (#{title,jdbcType=VARCHAR}, #{backgroundImage,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
#{type,jdbcType=INTEGER}, #{state,jdbcType=INTEGER})
#{itemEndInterval,jdbcType=DOUBLE}, #{type,jdbcType=INTEGER}, #{state,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.SpecialPerformance">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
......@@ -191,6 +194,9 @@
<if test="endTime != null">
end_time,
</if>
<if test="itemEndInterval != null">
item_end_interval,
</if>
<if test="type != null">
`type`,
</if>
......@@ -217,6 +223,9 @@
<if test="endTime != null">
#{endTime,jdbcType=TIMESTAMP},
</if>
<if test="itemEndInterval != null">
#{itemEndInterval,jdbcType=DOUBLE},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
......@@ -255,6 +264,9 @@
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=TIMESTAMP},
</if>
<if test="record.itemEndInterval != null">
item_end_interval = #{record.itemEndInterval,jdbcType=DOUBLE},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
</if>
......@@ -275,6 +287,7 @@
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
start_time = #{record.startTime,jdbcType=TIMESTAMP},
end_time = #{record.endTime,jdbcType=TIMESTAMP},
item_end_interval = #{record.itemEndInterval,jdbcType=DOUBLE},
`type` = #{record.type,jdbcType=INTEGER},
`state` = #{record.state,jdbcType=INTEGER}
<if test="_parameter != null">
......@@ -302,6 +315,9 @@
<if test="endTime != null">
end_time = #{endTime,jdbcType=TIMESTAMP},
</if>
<if test="itemEndInterval != null">
item_end_interval = #{itemEndInterval,jdbcType=DOUBLE},
</if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
</if>
......@@ -319,6 +335,7 @@
update_time = #{updateTime,jdbcType=TIMESTAMP},
start_time = #{startTime,jdbcType=TIMESTAMP},
end_time = #{endTime,jdbcType=TIMESTAMP},
item_end_interval = #{itemEndInterval,jdbcType=DOUBLE},
`type` = #{type,jdbcType=INTEGER},
`state` = #{state,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
......@@ -356,8 +373,8 @@
</foreach>
</when>
<otherwise>
id, title, background_image, create_time, update_time, start_time, end_time, `type`,
`state`
id, title, background_image, create_time, update_time, start_time, end_time, item_end_interval,
`type`, `state`
</otherwise>
</choose>
from special_performance
......
......@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/>
<table tableName="auction_config" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<table tableName="special_performance" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table>
......
......@@ -254,6 +254,8 @@ public class SelfPageServiceImpl implements SelfPageService {
map.put("wechatQrCode", user.getWechatQrCode());
long followerNum = followFansRecordDao.countFollowers(itemUserId);
map.put("followerNum", followerNum);
long fansNum = followFansRecordDao.countFans(itemUserId);
map.put("fansNum", fansNum);
map.put("targetUserId", itemUserId);
long count = supplierItemDao.countByCreatorId(itemUserId);
map.put("count", count);
......
......@@ -330,4 +330,8 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
}
return Result.failed();
}
}
......@@ -508,15 +508,20 @@ public class SupplierItemServiceImpl implements SupplierItemService {
Date previewStartTime = Date.from(startInstant);
Long itemId;
String shareRecordId = dto.getShareRecordId();
DistributorShareRecord distributorShareRecord = null;
CollectionShareRecord collectionShareRecord = null;
if (StringUtils.isEmpty(shareRecordId) && dto.getId() == null) {
return Result.failed("商品信息为空");
} else if (StringUtils.hasLength(shareRecordId) && !shareRecordId.equals(CommConsts.DEFAULT_SHARE_ID)) {
distributorShareRecord = distributorShareRecordDao.findById(shareRecordId);
if (distributorShareRecord == null || !distributorShareRecord.getEnabled()) {
return Result.failed("该商品已下架");
} else {
itemId = distributorShareRecord.getItemId();
} else if (StringUtils.hasLength(shareRecordId) && ! shareRecordId.equals(CommConsts.DEFAULT_SHARE_ID)) {
collectionShareRecord = collectionShareRecordDao.findById(dto.getShareRecordId());
itemId = collectionShareRecord.getShareTargetId();
if (collectionShareRecord.getItemUserId().longValue() != dto.getUserId().longValue()) {
//客态进入别人的藏馆,自动关注
FollowFansRecordRequestDto followFansRecordRequestDto = new FollowFansRecordRequestDto();
followFansRecordRequestDto.setFollowerId(collectionShareRecord.getItemUserId());
followFansRecordRequestDto.setFansId(dto.getUserId());
followFansRecordRequestDto.setIntroducerId(collectionShareRecord.getSharerId());
followFansRecordService.follow(followFansRecordRequestDto);
logger.info("通过藏品详情分享点击,用户id:{} 关注了 用户id为 {}, 介绍人为", dto.getUserId(), collectionShareRecord.getItemUserId(), collectionShareRecord.getSharerId());
}
} else {
itemId = dto.getId();
......@@ -525,24 +530,10 @@ public class SupplierItemServiceImpl implements SupplierItemService {
return Result.failed("没有对应的商品id");
}
if (StringUtils.hasLength(shareRecordId) && !shareRecordId.equals(CommConsts.DEFAULT_SHARE_ID)) {
if (distributorShareRecord.getDistributorId().longValue() != dto.getUserId().longValue()) {
//做浏览记录
boolean flag = userRecentBrowseDao.isExisted(dto.getUserId(), distributorShareRecord.getDistributorId());
if (!flag) {
UserRecentBrowse newRecord = new UserRecentBrowse();
newRecord.setShareRecordId(dto.getShareRecordId());
newRecord.setSharerId(distributorShareRecord.getDistributorId());
newRecord.setUserId(dto.getUserId());
newRecord.setCreateTime(new Date());
newRecord.setUpdateTime(new Date());
newRecord.setType(DistributionEnum.UserBrowseTypeEnum.PLATFORM_ITEM.getCode());
newRecord.setSharedUserId(distributorShareRecord.getDistributorId());
userRecentBrowseDao.insert(newRecord);
}
if (collectionShareRecord.getItemUserId().longValue() != dto.getUserId().longValue()) {
//拍卖专场进入详情页,增加围观次数
specialPerformanceConfigDao.addViewNum(itemId);
}
} else {
//拍卖专场进入详情页,增加围观次数
specialPerformanceConfigDao.addViewNum(itemId);
}
//查询商品所属专场id
SpecialPerformanceConfigRequestDto specialPerformanceConfigRequestDto = new SpecialPerformanceConfigRequestDto();
......
package com.wwdz.ch.wx.service.distribution;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceConfigRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto;
public interface SpecialPerformanceService {
......@@ -23,4 +24,6 @@ public interface SpecialPerformanceService {
* @return
*/
Result sendMsg();
}
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