Commit 23e82386 authored by shiyu's avatar shiyu

新增是否可售字段

parent 45bbe603
......@@ -116,6 +116,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
supplierItem.setCreateTime(now);
supplierItem.setUpdateTime(now);
supplierItem.setIsOnSale(true);
supplierItem.setIsAbleSale(true);
supplierItem.setIsDeleted(false);
supplierItem.setStatus(SupplierItemEnum.StatusEnum.COMMON.getCode());
if (dto.getStock() == null) {
......@@ -178,22 +179,6 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
//售出数量
Long selledNum = distributionOrderDao.countSelledNum(supplierItem.getId());
supplierItemVo.setSelledNum(selledNum == null ? 0 : selledNum);
if (dto.getType() != null && dto.getType() == DistributionEnum.DistributionTypeEnum.COLLECT.getCode()) {
if (supplierItem.getStock() == 0) {
//库存为0,标识是可售的商品售罄了
supplierItemVo.setIsAbleSale(true);
} else if (supplierItem.getIsOnSale() && supplierItem.getStock() > 0) {
supplierItemVo.setIsAbleSale(true);
} else {
supplierItemVo.setIsAbleSale(false);
}
} else {
if (supplierItem.getIsOnSale()) {
supplierItemVo.setIsAbleSale(true);
} else {
supplierItemVo.setIsAbleSale(false);
}
}
});
return Result.success(PageSearchResult.of(pageInfo, supplierItemVos));
} catch (Exception e) {
......@@ -226,11 +211,6 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
supplierItemVo.setStartPrice(PriceUtil.convertPriceFenToYuan(auctionConfig.getStartPrice()));
supplierItemVo.setAddExtent(PriceUtil.convertPriceFenToYuan(auctionConfig.getAddExtent()));
}
if (supplierItem.getStock() == 0 || supplierItem.getIsOnSale()) {
supplierItemVo.setIsAbleSale(true);
} else {
supplierItemVo.setIsAbleSale(false);
}
return Result.success(supplierItemVo);
} catch (Exception e) {
logger.error("商品详情查询失败 error : {}", e);
......@@ -319,7 +299,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
if (!dto.getIsOnSale() && oldItem.getType().intValue() == DistributionEnum.DistributionTypeEnum.COLLECT.getCode()) {
//下架用户商品,短信通知,跳转到藏品详情页
String url = wxAppletApi.getUrlLink("/pages/detail/index","itemId=" + dto.getId() + "&shareRecordId=");
String msg = "您正在出售的藏品名称藏品…藏品名称,根据平台规定不得售卖该类藏品,平台已为您关闭出售,请前往"+ url + "查看";
String msg = "您正在出售的" + supplierItem.getName() + ",根据平台规定不得售卖该类藏品,平台已为您关闭出售,请前往"+ url + "查看";
aliSmsSender.sendSms(oldItem.getCreatorId(), msg);
}
return Result.success();
......@@ -360,7 +340,7 @@ public class SysSupplierItemServiceImpl implements SysSupplierItemService {
supplierItemDao.update(supplierItem);
//发送短息通知用户商品违规被下架,跳转到个人藏馆
String url = wxAppletApi.getUrlLink("/pages/saleSelf/index","userId=" + oldItem.getCreatorId() + "&shareRecordId=");
String msg = "您发布的藏品名称藏品…藏品名称内容涉嫌违反平台规定,已被平台下架,请前往"+ url + "查看";
String msg = "您发布的" + supplierItem.getName() + ",内容涉嫌违反平台规定,已被平台下架,请前往"+ url + "查看";
aliSmsSender.sendSms(oldItem.getCreatorId(), msg);
return Result.success();
} catch (Exception e) {
......
package com.wwdz.ch.core.entity;
import com.wwdz.ch.db.domain.distribution.CollectionBook;
import com.wwdz.ch.db.domain.distribution.CollectionItemsRelation;
import com.xxdxxs.entity.Entity;
import lombok.Data;
import java.util.Date;
......@@ -268,4 +266,5 @@ public class SupplierItemVo implements Entity {
private Integer status;
private String statusName;
}
......@@ -11,7 +11,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2024/04/26
* @date 2024/04/29
*/
@Data
public class SupplierItem implements Entity {
......@@ -97,6 +97,11 @@ public class SupplierItem implements Entity {
*/
private Integer status;
/**
* 是否可以售卖
*/
private Boolean isAbleSale;
/**
* 商品图片,分号分隔
*/
......@@ -137,6 +142,7 @@ public class SupplierItem implements Entity {
sb.append(", rebate=").append(rebate);
sb.append(", creatorId=").append(creatorId);
sb.append(", status=").append(status);
sb.append(", isAbleSale=").append(isAbleSale);
sb.append(", images=").append(images);
sb.append(", videos=").append(videos);
sb.append(", description=").append(description);
......@@ -174,6 +180,7 @@ public class SupplierItem implements Entity {
&& (this.getRebate() == null ? other.getRebate() == null : this.getRebate().equals(other.getRebate()))
&& (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getIsAbleSale() == null ? other.getIsAbleSale() == null : this.getIsAbleSale().equals(other.getIsAbleSale()))
&& (this.getImages() == null ? other.getImages() == null : this.getImages().equals(other.getImages()))
&& (this.getVideos() == null ? other.getVideos() == null : this.getVideos().equals(other.getVideos()))
&& (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()));
......@@ -200,6 +207,7 @@ public class SupplierItem implements Entity {
result = prime * result + ((getRebate() == null) ? 0 : getRebate().hashCode());
result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getIsAbleSale() == null) ? 0 : getIsAbleSale().hashCode());
result = prime * result + ((getImages() == null) ? 0 : getImages().hashCode());
result = prime * result + ((getVideos() == null) ? 0 : getVideos().hashCode());
result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
......@@ -231,6 +239,7 @@ public class SupplierItem implements Entity {
rebate("rebate", "rebate", "DECIMAL", false),
creatorId("creator_id", "creatorId", "BIGINT", false),
status("status", "status", "INTEGER", true),
isAbleSale("is_able_sale", "isAbleSale", "BIT", false),
images("images", "images", "LONGVARCHAR", false),
videos("videos", "videos", "LONGVARCHAR", false),
description("description", "description", "LONGVARCHAR", false);
......
......@@ -2412,6 +2412,138 @@ public class SupplierItemExample {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andIsAbleSaleIsNull() {
addCriterion("is_able_sale is null");
return (Criteria) this;
}
public Criteria andIsAbleSaleIsNotNull() {
addCriterion("is_able_sale is not null");
return (Criteria) this;
}
public Criteria andIsAbleSaleEqualTo(Boolean value) {
addCriterion("is_able_sale =", value, "isAbleSale");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsAbleSaleEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("is_able_sale = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsAbleSaleNotEqualTo(Boolean value) {
addCriterion("is_able_sale <>", value, "isAbleSale");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsAbleSaleNotEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("is_able_sale <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsAbleSaleGreaterThan(Boolean value) {
addCriterion("is_able_sale >", value, "isAbleSale");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsAbleSaleGreaterThanColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("is_able_sale > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsAbleSaleGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_able_sale >=", value, "isAbleSale");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsAbleSaleGreaterThanOrEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("is_able_sale >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsAbleSaleLessThan(Boolean value) {
addCriterion("is_able_sale <", value, "isAbleSale");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsAbleSaleLessThanColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("is_able_sale < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsAbleSaleLessThanOrEqualTo(Boolean value) {
addCriterion("is_able_sale <=", value, "isAbleSale");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table supplier_item
*
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsAbleSaleLessThanOrEqualToColumn(SupplierItem.Column column) {
addCriterion(new StringBuilder("is_able_sale <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsAbleSaleIn(List<Boolean> values) {
addCriterion("is_able_sale in", values, "isAbleSale");
return (Criteria) this;
}
public Criteria andIsAbleSaleNotIn(List<Boolean> values) {
addCriterion("is_able_sale not in", values, "isAbleSale");
return (Criteria) this;
}
public Criteria andIsAbleSaleBetween(Boolean value1, Boolean value2) {
addCriterion("is_able_sale between", value1, value2, "isAbleSale");
return (Criteria) this;
}
public Criteria andIsAbleSaleNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_able_sale not between", value1, value2, "isAbleSale");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
......@@ -51,6 +51,11 @@ public class SupplierItemRequestDto extends BaseRequestDto implements Entity {
*/
private Integer status;
/**
* 是否可以售卖
*/
private Boolean isAbleSale;
/**
* 置顶图片
*/
......
......@@ -19,6 +19,7 @@
<result column="rebate" jdbcType="DECIMAL" property="rebate" />
<result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="is_able_sale" jdbcType="BIT" property="isAbleSale" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.wwdz.ch.db.domain.distribution.SupplierItem">
<result column="images" jdbcType="LONGVARCHAR" property="images" />
......@@ -86,7 +87,7 @@
<sql id="Base_Column_List">
id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price,
stock, create_time, update_time, is_deleted, buy_limit_num, `type`, rebate, creator_id,
`status`
`status`, is_able_sale
</sql>
<sql id="Blob_Column_List">
images, videos, description
......@@ -143,7 +144,7 @@
<otherwise>
id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price,
stock, create_time, update_time, is_deleted, buy_limit_num, `type`, rebate, creator_id,
`status`, images, videos, description
`status`, is_able_sale, images, videos, description
</otherwise>
</choose>
from supplier_item
......@@ -178,7 +179,7 @@
<otherwise>
id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price,
stock, create_time, update_time, is_deleted, buy_limit_num, `type`, rebate, creator_id,
`status`, images, videos, description
`status`, is_able_sale, images, videos, description
</otherwise>
</choose>
from supplier_item
......@@ -203,15 +204,15 @@
supply_price, stock, create_time,
update_time, is_deleted, buy_limit_num,
`type`, rebate, creator_id,
`status`, images, videos,
description)
`status`, is_able_sale, images,
videos, description)
values (#{name,jdbcType=VARCHAR}, #{supplierId,jdbcType=BIGINT}, #{isOnSale,jdbcType=BIT},
#{sort,jdbcType=INTEGER}, #{topImage,jdbcType=VARCHAR}, #{distributionPrice,jdbcType=BIGINT},
#{supplyPrice,jdbcType=BIGINT}, #{stock,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{isDeleted,jdbcType=BIT}, #{buyLimitNum,jdbcType=INTEGER},
#{type,jdbcType=INTEGER}, #{rebate,jdbcType=DECIMAL}, #{creatorId,jdbcType=BIGINT},
#{status,jdbcType=INTEGER}, #{images,jdbcType=LONGVARCHAR}, #{videos,jdbcType=LONGVARCHAR},
#{description,jdbcType=LONGVARCHAR})
#{status,jdbcType=INTEGER}, #{isAbleSale,jdbcType=BIT}, #{images,jdbcType=LONGVARCHAR},
#{videos,jdbcType=LONGVARCHAR}, #{description,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.wwdz.ch.db.domain.distribution.SupplierItem">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
......@@ -267,6 +268,9 @@
<if test="status != null">
`status`,
</if>
<if test="isAbleSale != null">
is_able_sale,
</if>
<if test="images != null">
images,
</if>
......@@ -326,6 +330,9 @@
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="isAbleSale != null">
#{isAbleSale,jdbcType=BIT},
</if>
<if test="images != null">
#{images,jdbcType=LONGVARCHAR},
</if>
......@@ -397,6 +404,9 @@
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.isAbleSale != null">
is_able_sale = #{record.isAbleSale,jdbcType=BIT},
</if>
<if test="record.images != null">
images = #{record.images,jdbcType=LONGVARCHAR},
</if>
......@@ -430,6 +440,7 @@
rebate = #{record.rebate,jdbcType=DECIMAL},
creator_id = #{record.creatorId,jdbcType=BIGINT},
`status` = #{record.status,jdbcType=INTEGER},
is_able_sale = #{record.isAbleSale,jdbcType=BIT},
images = #{record.images,jdbcType=LONGVARCHAR},
videos = #{record.videos,jdbcType=LONGVARCHAR},
description = #{record.description,jdbcType=LONGVARCHAR}
......@@ -455,7 +466,8 @@
`type` = #{record.type,jdbcType=INTEGER},
rebate = #{record.rebate,jdbcType=DECIMAL},
creator_id = #{record.creatorId,jdbcType=BIGINT},
`status` = #{record.status,jdbcType=INTEGER}
`status` = #{record.status,jdbcType=INTEGER},
is_able_sale = #{record.isAbleSale,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -511,6 +523,9 @@
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if>
<if test="isAbleSale != null">
is_able_sale = #{isAbleSale,jdbcType=BIT},
</if>
<if test="images != null">
images = #{images,jdbcType=LONGVARCHAR},
</if>
......@@ -541,6 +556,7 @@
rebate = #{rebate,jdbcType=DECIMAL},
creator_id = #{creatorId,jdbcType=BIGINT},
`status` = #{status,jdbcType=INTEGER},
is_able_sale = #{isAbleSale,jdbcType=BIT},
images = #{images,jdbcType=LONGVARCHAR},
videos = #{videos,jdbcType=LONGVARCHAR},
description = #{description,jdbcType=LONGVARCHAR}
......@@ -563,7 +579,8 @@
`type` = #{type,jdbcType=INTEGER},
rebate = #{rebate,jdbcType=DECIMAL},
creator_id = #{creatorId,jdbcType=BIGINT},
`status` = #{status,jdbcType=INTEGER}
`status` = #{status,jdbcType=INTEGER},
is_able_sale = #{isAbleSale,jdbcType=BIT}
where id = #{id,jdbcType=BIGINT}
</update>
<select id="selectOneByExample" parameterType="com.wwdz.ch.db.domain.distribution.SupplierItemExample" resultMap="BaseResultMap">
......@@ -621,7 +638,7 @@
<otherwise>
id, `name`, supplier_id, is_on_sale, sort, top_image, distribution_price, supply_price,
stock, create_time, update_time, is_deleted, buy_limit_num, `type`, rebate, creator_id,
`status`, images, videos, description
`status`, is_able_sale, images, videos, description
</otherwise>
</choose>
from supplier_item
......
......@@ -572,12 +572,13 @@ public class SupplierItemServiceImpl implements SupplierItemService {
}
supplierItem.setSort(1);
supplierItem.setBuyLimitNum(-1);
if (dto.getIsOnSale()) {
if (dto.getIsAbleSale()) {
supplierItem.setIsOnSale(true);
supplierItem.setStock(dto.getStock());
} else {
supplierItem.setStock(1);
supplierItem.setIsOnSale(false);
}
supplierItem.setIsOnSale(dto.getIsOnSale());
Date now = new Date();
supplierItem.setCreateTime(now);
supplierItem.setUpdateTime(now);
......@@ -612,13 +613,14 @@ public class SupplierItemServiceImpl implements SupplierItemService {
if (StringUtils.hasLength(dto.getVideos())) {
supplierItem.setVideos(getVideosImage(dto.getVideos()));
}
if (dto.getIsOnSale()) {
if (dto.getIsAbleSale()) {
supplierItem.setIsOnSale(true);
supplierItem.setStock(dto.getStock());
} else {
supplierItem.setStock(1);
supplierItem.setIsOnSale(false);
}
supplierItemDao.update(supplierItem);
//更新相关的收藏册
if (StringUtils.hasLength(dto.getCollectionBookId())) {
CollectionItemsRelationRequestDto collectionItemsRelationRequestDto = new CollectionItemsRelationRequestDto();
......
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