Commit 1dc14392 authored by shiyu's avatar shiyu

发布商品

parent cfc3401d
......@@ -84,6 +84,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
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()));
......@@ -195,6 +196,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
AuctionConfig addConfig = new AuctionConfig();
addConfig.setItemId(dto.getId());
addConfig.setIsValid(true);
auctionConfig.setIsDeal(false);
addConfig.setStartTime(DateUtils.parseString(dto.getAuctionStartTime()));
addConfig.setEndTime(DateUtils.parseString(dto.getAuctionEndTime()));
addConfig.setRealEndTime(DateUtils.parseString(dto.getAuctionEndTime()));
......
......@@ -33,7 +33,7 @@ public interface AuctionConfigDao {
/**
* 查询截拍商品记录
* 查询截拍未处理的商品记录
* @param
* @return
*/
......@@ -68,4 +68,12 @@ public interface AuctionConfigDao {
* @return
*/
int setValid(long itemId);
/**
* 拍卖配置更新为已处理
* @param itemId
* @return
*/
int setDeal(long itemId);
}
......@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/02/29
* @date 2024/03/07
*/
@Data
public class AuctionConfig implements Entity {
......@@ -61,6 +61,11 @@ public class AuctionConfig implements Entity {
*/
private Boolean isValid;
/**
* 是否成交
*/
private Boolean isDeal;
private static final long serialVersionUID = 1L;
@Override
......@@ -79,6 +84,7 @@ public class AuctionConfig implements Entity {
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();
......@@ -105,7 +111,8 @@ public class AuctionConfig implements Entity {
&& (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.getIsValid() == null ? other.getIsValid() == null : this.getIsValid().equals(other.getIsValid()))
&& (this.getIsDeal() == null ? other.getIsDeal() == null : this.getIsDeal().equals(other.getIsDeal()));
}
@Override
......@@ -122,6 +129,7 @@ public class AuctionConfig implements Entity {
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;
}
......@@ -142,7 +150,8 @@ public class AuctionConfig implements Entity {
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);
isValid("is_valid", "isValid", "BIT", false),
isDeal("is_deal", "isDeal", "BIT", false);
/**
* This field was generated by MyBatis Generator.
......
......@@ -1467,6 +1467,138 @@ public class AuctionConfigExample {
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 {
......
......@@ -60,6 +60,7 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao {
Date time = Date.from(instant);
criteria.andRealEndTimeGreaterThanOrEqualTo(time);
criteria.andIsValidEqualTo(false);
criteria.andIsDealEqualTo(false);
return auctionConfigMapper.selectByExample(example);
}
......@@ -94,4 +95,15 @@ public class AuctionConfigDaoImpl implements AuctionConfigDao {
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);
}
}
......@@ -12,6 +12,7 @@
<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>
......@@ -73,7 +74,7 @@
</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
update_time, is_valid, is_deal
</sql>
<select id="selectByExample" parameterType="com.wwdz.ch.db.domain.distribution.AuctionConfigExample" resultMap="BaseResultMap">
select
......@@ -102,14 +103,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, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time,
update_time, is_valid
update_time, is_valid, is_deal
</otherwise>
</choose>
from auction_config
......@@ -134,14 +135,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, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time,
update_time, is_valid
update_time, is_valid, is_deal
</otherwise>
</choose>
from auction_config
......@@ -163,12 +164,12 @@
</selectKey>
insert into auction_config (item_id, start_time, end_time,
start_price, add_extent, real_end_time,
create_time, update_time, is_valid
)
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}
)
#{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">
......@@ -203,6 +204,9 @@
<if test="isValid != null">
is_valid,
</if>
<if test="isDeal != null">
is_deal,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="itemId != null">
......@@ -232,6 +236,9 @@
<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">
......@@ -273,6 +280,9 @@
<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" />
......@@ -289,7 +299,8 @@
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_valid = #{record.isValid,jdbcType=BIT},
is_deal = #{record.isDeal,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -324,6 +335,9 @@
<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>
......@@ -337,7 +351,8 @@
real_end_time = #{realEndTime,jdbcType=TIMESTAMP},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_valid = #{isValid,jdbcType=BIT}
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">
......@@ -367,14 +382,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, item_id, start_time, end_time, start_price, add_extent, real_end_time, create_time,
update_time, is_valid
update_time, is_valid, is_deal
</otherwise>
</choose>
from auction_config
......@@ -386,4 +401,5 @@
</if>
limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -72,7 +72,7 @@
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper.distribution"
targetProject="ch-dao/src/main/java"/>
<table tableName="auction_record" 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" />
</table>
......
......@@ -86,6 +86,9 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
@Autowired
AuctionRecordDao auctionRecordDao;
@Autowired
AuctionConfigDao auctionConfigDao;
@Transactional
@Override
public Result createDistributionOrder(DistributionOrderRequestDto dto) {
......@@ -231,6 +234,8 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
distributorProfit.setCreateTime(new Date());
distributorProfit.setIsValid(false);
distributorProfitDao.insert(distributorProfit);
//把该拍卖配置信息改为已处理
auctionConfigDao.setDeal(dto.getItemId());
//发送中拍信息给用户
/**
*
......
......@@ -12,7 +12,6 @@ import com.wwdz.ch.db.dao.distribution.*;
import com.wwdz.ch.db.domain.Switch;
import com.wwdz.ch.db.domain.distribution.*;
import com.wwdz.ch.db.dto.request.distribution.AuctionRecordRequestDto;
import com.wwdz.ch.db.dto.request.distribution.DistributionOrderRequestDto;
import com.wwdz.ch.db.dto.request.distribution.DistributorShareRecordRequestDto;
import com.wwdz.ch.db.dto.request.distribution.SupplierItemRequestDto;
import com.wwdz.ch.core.entity.SupplierItemVo;
......@@ -20,7 +19,6 @@ 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.xxdxxs.utils.DateUtils;
import com.xxdxxs.utils.EntityMapper;
import com.xxdxxs.utils.StringUtils;
import org.redisson.api.RLock;
......@@ -29,8 +27,6 @@ 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 org.springframework.util.ObjectUtils;
import java.util.*;
......
......@@ -98,6 +98,9 @@ public class AutoCreateAuctionOrderJob {
logger.info("============== ERROR 拍卖 商品id:{}, 自动生成订单失败 ERROR ==============", itemId);
}
}
} else {
//没有出价记录,流拍的商品也要更新拍卖配置信息为已处理
auctionConfigDao.setDeal(itemId);
}
});
} catch (Exception 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