Commit 2276b9d2 authored by shiyu's avatar shiyu

新增商品状态字段

parent 776c8d18
......@@ -61,6 +61,16 @@ public class ItemController {
return result;
}
@RequiresPermissionsDesc(menu = { "商品列表", "商品设置主图" }, button = "更新")
@PostMapping("/setTopImage")
public Result setTopImage(@RequestBody CoinRequestDto coinRequestDto) {
logger.info("【请求开始】操作人:[" + AuthSupport.userName()+ "] 商品列表->商品设置主图->更新,请求参数:parma:{}", coinRequestDto);
Result result = itemService.setItem(coinRequestDto);
logger.info("【请求结束】钱币列表->商品设置主图->更新");
return result;
}
@GetMapping("/updateUrl")
public void syn() {
synCoinJob.updateImageUrlOfsSize();
......
......@@ -63,9 +63,9 @@ public class ItemVo implements Entity {
private Boolean isOnSale;
/**
* 是否设置过
* 商品状态
*/
private Integer isSetted;
private Integer state;
/**
* 逻辑删除
......@@ -176,7 +176,7 @@ public class ItemVo implements Entity {
itemVo.setImages(item.getImages().split(";"));
}
itemVo.setIsDeleted(item.getIsDeleted());
itemVo.setIsSetted(item.getIsSetted());
itemVo.setState(item.getState());
if (!ObjectUtils.isEmpty(item.getPrice())) {
itemVo.setPrice(Double.parseDouble(PriceUtil.convertPrice(item.getPrice())));
}
......
......@@ -6,6 +6,7 @@ import com.wwdz.ch.admin.service.OperateLogService;
import com.wwdz.ch.admin.util.AuthSupport;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.consts.CommonEnum;
import com.wwdz.ch.core.consts.ItemStateEnum;
import com.wwdz.ch.core.storage.QiniuStorage;
import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.db.dao.CroppingRecordDao;
......@@ -146,10 +147,9 @@ public class ItemServiceImpl implements ItemService {
paramMap.put("topImage", url);
item.setTopImage(url);
}
item.setState(ItemStateEnum.FINISH.getCode());
itemDao.setCoin(item);
//记录钱币设置的操作日志
OperateLog operateLog = OperateLog.of(coinRequestDto.getId(), CommonEnum.OperateTypeEnum.ITEM_SET.getDes(),
CommonEnum.OperateTypeEnum.ITEM_SET.getCode(), AuthSupport.adminId(), AuthSupport.userName(), JsonUtils.fromMap(paramMap));
......@@ -161,6 +161,23 @@ public class ItemServiceImpl implements ItemService {
return Result.success();
}
@Override
public Result setTopImage(CoinRequestDto coinRequestDto) {
try {
Item item = new Item();
item.setId(coinRequestDto.getId());
item.setTopImage(coinRequestDto.getTopImage());
item.setState(ItemStateEnum.FINISH.getCode());
item.setUpdateTime(new Date());
itemDao.update(item);
} catch (Exception e) {
logger.error("设置主图出错:{}", e);
return Result.failed();
}
return Result.success();
}
@Override
public Result saveCroppingRecord(CroppingRecordRequestDto croppingRecordRequestDto) {
try {
......
......@@ -3,6 +3,7 @@ package com.wwdz.ch.admin.job;
import com.github.pagehelper.PageInfo;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.consts.CommonEnum;
import com.wwdz.ch.core.consts.ItemStateEnum;
import com.wwdz.ch.core.consts.MediaTypeEnum;
import com.wwdz.ch.core.storage.QiniuStorage;
import com.wwdz.ch.core.util.RedisUtils;
......@@ -100,7 +101,7 @@ public class SynCoinJob {
item.setIsDeleted(false);
item.setBidTime("");
item.setRemark(null);
item.setIsSetted(0);
item.setState(ItemStateEnum.PENDING.getCode());
item.setOriginalExtra(coins.getExtra());
item.setOriginalSourceUrl(coins.getSourceUrl());
item.setSource(coins.getSource());
......
......@@ -16,6 +16,8 @@ public interface ItemService {
Result setItem(CoinRequestDto coinRequestDto);
Result setTopImage(CoinRequestDto coinRequestDto);
/**
* 保存图片裁剪记录
* @param croppingRecordRequestDto
......
package com.wwdz.ch.core.consts;
/**
* 商品种类
*/
public enum ItemStateEnum {
PENDING(0, "待处理"),
SHELVE(1, "暂不处理"),
FINISH(10, "已完成"),
;
private int code;
private String des;
ItemStateEnum(int code, String des) {
this.code = code;
this.des = des;
}
public static String getNameByCode(int code) {
for (ItemStateEnum itemStateEnum : ItemStateEnum.values()) {
if (code == itemStateEnum.getCode()) {
return itemStateEnum.getDes();
}
}
return null;
}
public int getCode() {
return code;
}
public String getDes() {
return des;
}
}
......@@ -84,9 +84,9 @@ public class ItemOfEs implements Entity {
private String remark;
/**
* 是否设置过
* 商品状态
*/
private Integer isSetted;
private Integer state;
/**
* 原始的资源url
......
......@@ -10,7 +10,7 @@ import lombok.Data;
/**
* @author shiyu
* @date 2023/08/17
* @date 2023/08/28
*/
@Data
public class Item implements Entity {
......@@ -87,9 +87,9 @@ public class Item implements Entity {
private String remark;
/**
* 是否设置过
* 商品状态
*/
private Integer isSetted;
private Integer state;
/**
* 原始的资源url
......@@ -154,7 +154,7 @@ public class Item implements Entity {
sb.append(", isDeleted=").append(isDeleted);
sb.append(", bidTime=").append(bidTime);
sb.append(", remark=").append(remark);
sb.append(", isSetted=").append(isSetted);
sb.append(", state=").append(state);
sb.append(", originalSourceUrl=").append(originalSourceUrl);
sb.append(", source=").append(source);
sb.append(", kind=").append(kind);
......@@ -195,7 +195,7 @@ public class Item implements Entity {
&& (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()))
&& (this.getBidTime() == null ? other.getBidTime() == null : this.getBidTime().equals(other.getBidTime()))
&& (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
&& (this.getIsSetted() == null ? other.getIsSetted() == null : this.getIsSetted().equals(other.getIsSetted()))
&& (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
&& (this.getOriginalSourceUrl() == null ? other.getOriginalSourceUrl() == null : this.getOriginalSourceUrl().equals(other.getOriginalSourceUrl()))
&& (this.getSource() == null ? other.getSource() == null : this.getSource().equals(other.getSource()))
&& (this.getKind() == null ? other.getKind() == null : this.getKind().equals(other.getKind()))
......@@ -225,7 +225,7 @@ public class Item implements Entity {
result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
result = prime * result + ((getBidTime() == null) ? 0 : getBidTime().hashCode());
result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
result = prime * result + ((getIsSetted() == null) ? 0 : getIsSetted().hashCode());
result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
result = prime * result + ((getOriginalSourceUrl() == null) ? 0 : getOriginalSourceUrl().hashCode());
result = prime * result + ((getSource() == null) ? 0 : getSource().hashCode());
result = prime * result + ((getKind() == null) ? 0 : getKind().hashCode());
......@@ -260,7 +260,7 @@ public class Item implements Entity {
isDeleted("is_deleted", "isDeleted", "BIT", false),
bidTime("bid_time", "bidTime", "VARCHAR", false),
remark("remark", "remark", "VARCHAR", false),
isSetted("is_setted", "isSetted", "INTEGER", false),
state("state", "state", "INTEGER", true),
originalSourceUrl("original_source_url", "originalSourceUrl", "VARCHAR", false),
source("source", "source", "INTEGER", true),
kind("kind", "kind", "INTEGER", false),
......
......@@ -2178,18 +2178,18 @@ public class ItemExample {
return (Criteria) this;
}
public Criteria andIsSettedIsNull() {
addCriterion("is_setted is null");
public Criteria andStateIsNull() {
addCriterion("`state` is null");
return (Criteria) this;
}
public Criteria andIsSettedIsNotNull() {
addCriterion("is_setted is not null");
public Criteria andStateIsNotNull() {
addCriterion("`state` is not null");
return (Criteria) this;
}
public Criteria andIsSettedEqualTo(Integer value) {
addCriterion("is_setted =", value, "isSetted");
public Criteria andStateEqualTo(Integer value) {
addCriterion("`state` =", value, "state");
return (Criteria) this;
}
......@@ -2200,13 +2200,13 @@ public class ItemExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsSettedEqualToColumn(Item.Column column) {
addCriterion(new StringBuilder("is_setted = ").append(column.getEscapedColumnName()).toString());
public Criteria andStateEqualToColumn(Item.Column column) {
addCriterion(new StringBuilder("`state` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsSettedNotEqualTo(Integer value) {
addCriterion("is_setted <>", value, "isSetted");
public Criteria andStateNotEqualTo(Integer value) {
addCriterion("`state` <>", value, "state");
return (Criteria) this;
}
......@@ -2217,13 +2217,13 @@ public class ItemExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsSettedNotEqualToColumn(Item.Column column) {
addCriterion(new StringBuilder("is_setted <> ").append(column.getEscapedColumnName()).toString());
public Criteria andStateNotEqualToColumn(Item.Column column) {
addCriterion(new StringBuilder("`state` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsSettedGreaterThan(Integer value) {
addCriterion("is_setted >", value, "isSetted");
public Criteria andStateGreaterThan(Integer value) {
addCriterion("`state` >", value, "state");
return (Criteria) this;
}
......@@ -2234,13 +2234,13 @@ public class ItemExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsSettedGreaterThanColumn(Item.Column column) {
addCriterion(new StringBuilder("is_setted > ").append(column.getEscapedColumnName()).toString());
public Criteria andStateGreaterThanColumn(Item.Column column) {
addCriterion(new StringBuilder("`state` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsSettedGreaterThanOrEqualTo(Integer value) {
addCriterion("is_setted >=", value, "isSetted");
public Criteria andStateGreaterThanOrEqualTo(Integer value) {
addCriterion("`state` >=", value, "state");
return (Criteria) this;
}
......@@ -2251,13 +2251,13 @@ public class ItemExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsSettedGreaterThanOrEqualToColumn(Item.Column column) {
addCriterion(new StringBuilder("is_setted >= ").append(column.getEscapedColumnName()).toString());
public Criteria andStateGreaterThanOrEqualToColumn(Item.Column column) {
addCriterion(new StringBuilder("`state` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsSettedLessThan(Integer value) {
addCriterion("is_setted <", value, "isSetted");
public Criteria andStateLessThan(Integer value) {
addCriterion("`state` <", value, "state");
return (Criteria) this;
}
......@@ -2268,13 +2268,13 @@ public class ItemExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsSettedLessThanColumn(Item.Column column) {
addCriterion(new StringBuilder("is_setted < ").append(column.getEscapedColumnName()).toString());
public Criteria andStateLessThanColumn(Item.Column column) {
addCriterion(new StringBuilder("`state` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsSettedLessThanOrEqualTo(Integer value) {
addCriterion("is_setted <=", value, "isSetted");
public Criteria andStateLessThanOrEqualTo(Integer value) {
addCriterion("`state` <=", value, "state");
return (Criteria) this;
}
......@@ -2285,28 +2285,28 @@ public class ItemExample {
* @mbg.generated
* @project https://github.com/itfsw/mybatis-generator-plugin
*/
public Criteria andIsSettedLessThanOrEqualToColumn(Item.Column column) {
addCriterion(new StringBuilder("is_setted <= ").append(column.getEscapedColumnName()).toString());
public Criteria andStateLessThanOrEqualToColumn(Item.Column column) {
addCriterion(new StringBuilder("`state` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andIsSettedIn(List<Integer> values) {
addCriterion("is_setted in", values, "isSetted");
public Criteria andStateIn(List<Integer> values) {
addCriterion("`state` in", values, "state");
return (Criteria) this;
}
public Criteria andIsSettedNotIn(List<Integer> values) {
addCriterion("is_setted not in", values, "isSetted");
public Criteria andStateNotIn(List<Integer> values) {
addCriterion("`state` not in", values, "state");
return (Criteria) this;
}
public Criteria andIsSettedBetween(Integer value1, Integer value2) {
addCriterion("is_setted between", value1, value2, "isSetted");
public Criteria andStateBetween(Integer value1, Integer value2) {
addCriterion("`state` between", value1, value2, "state");
return (Criteria) this;
}
public Criteria andIsSettedNotBetween(Integer value1, Integer value2) {
addCriterion("is_setted not between", value1, value2, "isSetted");
public Criteria andStateNotBetween(Integer value1, Integer value2) {
addCriterion("`state` not between", value1, value2, "state");
return (Criteria) this;
}
......
......@@ -36,7 +36,7 @@ public class ItemDaoImpl implements ItemDao {
criteria.andIdNotIn(coinRequestDto.getIdExcludeList());
}
criteria.andIsDeletedEqualTo(false);
criteria.andIsSettedEqualTo(0);
criteria.andStateEqualTo(0);
criteria.andSourceIn(CHINESE_SOURCE_LIST);
return itemMapper.selectOneByExampleWithBLOBs(example);
}
......@@ -125,7 +125,6 @@ public class ItemDaoImpl implements ItemDao {
ItemExample example = new ItemExample();
ItemExample.Criteria criteria = example.createCriteria();
criteria.andIdEqualTo(item.getId());
item.setIsSetted(1);
item.setUpdateTime(new Date());
int num = itemMapper.updateByExampleSelective(item, example);
return num > 0;
......
......@@ -68,6 +68,7 @@ public interface ItemMapper {
*/
Item selectByPrimaryKeySelective(@Param("id") Long id, @Param("selective") Item.Column ... selective);
Item selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") Item record, @Param("example") ItemExample example);
......
......@@ -17,7 +17,7 @@
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
<result column="bid_time" jdbcType="VARCHAR" property="bidTime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="is_setted" jdbcType="INTEGER" property="isSetted" />
<result column="state" jdbcType="INTEGER" property="state" />
<result column="original_source_url" jdbcType="VARCHAR" property="originalSourceUrl" />
<result column="source" jdbcType="INTEGER" property="source" />
<result column="kind" jdbcType="INTEGER" property="kind" />
......@@ -91,7 +91,7 @@
</sql>
<sql id="Base_Column_List">
id, `name`, cid, is_on_sale, is_std, sort, share_image, top_image, price, create_time,
source_type, update_time, is_deleted, bid_time, remark, is_setted, original_source_url,
source_type, update_time, is_deleted, bid_time, remark, `state`, original_source_url,
`source`, kind
</sql>
<sql id="Blob_Column_List">
......@@ -148,7 +148,7 @@
</when>
<otherwise>
id, `name`, cid, is_on_sale, is_std, sort, share_image, top_image, price, create_time,
source_type, update_time, is_deleted, bid_time, remark, is_setted, original_source_url,
source_type, update_time, is_deleted, bid_time, remark, `state`, original_source_url,
`source`, kind, extra, images, videos, detail, original_extra
</otherwise>
</choose>
......@@ -183,7 +183,7 @@
</when>
<otherwise>
id, `name`, cid, is_on_sale, is_std, sort, share_image, top_image, price, create_time,
source_type, update_time, is_deleted, bid_time, remark, is_setted, original_source_url,
source_type, update_time, is_deleted, bid_time, remark, `state`, original_source_url,
`source`, kind, extra, images, videos, detail, original_extra
</otherwise>
</choose>
......@@ -208,7 +208,7 @@
is_std, sort, share_image,
top_image, price, create_time,
source_type, update_time, is_deleted,
bid_time, remark, is_setted,
bid_time, remark, `state`,
original_source_url, `source`, kind,
extra, images, videos,
detail, original_extra)
......@@ -216,7 +216,7 @@
#{isStd,jdbcType=BIT}, #{sort,jdbcType=INTEGER}, #{shareImage,jdbcType=VARCHAR},
#{topImage,jdbcType=VARCHAR}, #{price,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{sourceType,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{isDeleted,jdbcType=BIT},
#{bidTime,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{isSetted,jdbcType=INTEGER},
#{bidTime,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER},
#{originalSourceUrl,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, #{kind,jdbcType=INTEGER},
#{extra,jdbcType=LONGVARCHAR}, #{images,jdbcType=LONGVARCHAR}, #{videos,jdbcType=LONGVARCHAR},
#{detail,jdbcType=LONGVARCHAR}, #{originalExtra,jdbcType=LONGVARCHAR})
......@@ -269,8 +269,8 @@
<if test="remark != null">
remark,
</if>
<if test="isSetted != null">
is_setted,
<if test="state != null">
`state`,
</if>
<if test="originalSourceUrl != null">
original_source_url,
......@@ -340,8 +340,8 @@
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="isSetted != null">
#{isSetted,jdbcType=INTEGER},
<if test="state != null">
#{state,jdbcType=INTEGER},
</if>
<if test="originalSourceUrl != null">
#{originalSourceUrl,jdbcType=VARCHAR},
......@@ -423,8 +423,8 @@
<if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR},
</if>
<if test="record.isSetted != null">
is_setted = #{record.isSetted,jdbcType=INTEGER},
<if test="record.state != null">
`state` = #{record.state,jdbcType=INTEGER},
</if>
<if test="record.originalSourceUrl != null">
original_source_url = #{record.originalSourceUrl,jdbcType=VARCHAR},
......@@ -472,7 +472,7 @@
is_deleted = #{record.isDeleted,jdbcType=BIT},
bid_time = #{record.bidTime,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
is_setted = #{record.isSetted,jdbcType=INTEGER},
`state` = #{record.state,jdbcType=INTEGER},
original_source_url = #{record.originalSourceUrl,jdbcType=VARCHAR},
`source` = #{record.source,jdbcType=INTEGER},
kind = #{record.kind,jdbcType=INTEGER},
......@@ -502,7 +502,7 @@
is_deleted = #{record.isDeleted,jdbcType=BIT},
bid_time = #{record.bidTime,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR},
is_setted = #{record.isSetted,jdbcType=INTEGER},
`state` = #{record.state,jdbcType=INTEGER},
original_source_url = #{record.originalSourceUrl,jdbcType=VARCHAR},
`source` = #{record.source,jdbcType=INTEGER},
kind = #{record.kind,jdbcType=INTEGER}
......@@ -555,8 +555,8 @@
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="isSetted != null">
is_setted = #{isSetted,jdbcType=INTEGER},
<if test="state != null">
`state` = #{state,jdbcType=INTEGER},
</if>
<if test="originalSourceUrl != null">
original_source_url = #{originalSourceUrl,jdbcType=VARCHAR},
......@@ -601,7 +601,7 @@
is_deleted = #{isDeleted,jdbcType=BIT},
bid_time = #{bidTime,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
is_setted = #{isSetted,jdbcType=INTEGER},
`state` = #{state,jdbcType=INTEGER},
original_source_url = #{originalSourceUrl,jdbcType=VARCHAR},
`source` = #{source,jdbcType=INTEGER},
kind = #{kind,jdbcType=INTEGER},
......@@ -628,7 +628,7 @@
is_deleted = #{isDeleted,jdbcType=BIT},
bid_time = #{bidTime,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
is_setted = #{isSetted,jdbcType=INTEGER},
`state` = #{state,jdbcType=INTEGER},
original_source_url = #{originalSourceUrl,jdbcType=VARCHAR},
`source` = #{source,jdbcType=INTEGER},
kind = #{kind,jdbcType=INTEGER}
......@@ -688,7 +688,7 @@
</when>
<otherwise>
id, `name`, cid, is_on_sale, is_std, sort, share_image, top_image, price, create_time,
source_type, update_time, is_deleted, bid_time, remark, is_setted, original_source_url,
source_type, update_time, is_deleted, bid_time, remark, `state`, original_source_url,
`source`, kind, extra, images, videos, detail, original_extra
</otherwise>
</choose>
......@@ -702,6 +702,7 @@
limit 1
</select>
<select id="selectNameByExample" parameterType="com.wwdz.ch.db.domain.ItemExample" resultMap="StringResultMap">
select
distinct
......
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