Browse Source

1.商家端前端商品管理新增平台上架状态业务功能 2.商家端后台新增平台上架业务功能 3.商家端商品新增编辑添加平台上架状态业务功能处理 4.商家端商品上架状态结合平台上架状态业务调整修改处理 5.上架端商品上架状态调整为不经过平台端审核处理

multiwx
dy-hu 7 months ago
parent
commit
5b36b8a779
  1. 9
      cereshop-admin/src/main/java/com/shop/cereshop/admin/service/product/impl/CereShopProductServiceImpl.java
  2. 5
      cereshop-admin/src/main/resources/mybatis/mapper/product/CereShopProductDAO.xml
  3. 15
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/ProductController.java
  4. 6
      cereshop-business/src/main/java/com/shop/cereshop/business/page/product/ShopProduct.java
  5. 7
      cereshop-business/src/main/java/com/shop/cereshop/business/param/product/ProductSaveParam.java
  6. 6
      cereshop-business/src/main/java/com/shop/cereshop/business/param/product/ProductUpdateParam.java
  7. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/service/product/CereShopProductService.java
  8. 75
      cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java
  9. 9
      cereshop-business/src/main/resources/mybatis/mapper/product/CereShopProductDAO.xml
  10. 6
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/product/CereShopProduct.java
  11. 2
      doc/3.0/update.sql

9
cereshop-admin/src/main/java/com/shop/cereshop/admin/service/product/impl/CereShopProductServiceImpl.java

@ -187,7 +187,7 @@ public class CereShopProductServiceImpl implements CereShopProductService {
String time =TimeUtils.yyMMddHHmmss();
CereShopProduct cereShopProduct=new CereShopProduct();
cereShopProduct.setProductId(param.getProductId());
cereShopProduct.setShelveState(param.getShelveState());
cereShopProduct.setPlatShelveState(param.getShelveState());
cereShopProduct.setReject(param.getReject());
cereShopProduct.setUpdateTime(time);
String describe="";
@ -228,13 +228,14 @@ public class CereShopProductServiceImpl implements CereShopProductService {
String time =TimeUtils.yyMMddHHmmss();
CereShopProduct cereShopProduct=new CereShopProduct();
cereShopProduct.setProductId(param.getProductId());
cereShopProduct.setShelveState(IntegerEnum.PRODUCT_SHELVSTATE_FORCED.getCode());
//cereShopProduct.setShelveState(IntegerEnum.PRODUCT_SHELVSTATE_FORCED.getCode());
cereShopProduct.setPlatShelveState(IntegerEnum.PRODUCT_SHELVSTATE_FORCED.getCode());
cereShopProduct.setUpdateTime(time);
cereShopProductDAO.updateByPrimaryKeySelective(cereShopProduct);
//清除缓存
triggerCacheUpdate(param.getProductId());
//triggerCacheUpdate(param.getProductId());
//刷新实时信息
projectInvokeUtil.postRefreshSkuRealInfo(param.getProductId(), RefreshSkuRealInfoSourceEnum.PUT_OFF_SHELVE);
//projectInvokeUtil.postRefreshSkuRealInfo(param.getProductId(), RefreshSkuRealInfoSourceEnum.PUT_OFF_SHELVE);
//新增日志
cerePlatformLogService.addLog(user,"商品管理","平台端操作","强制下架",String.valueOf(cereShopProduct.getProductId()),time);
}

5
cereshop-admin/src/main/resources/mybatis/mapper/product/CereShopProductDAO.xml

@ -167,7 +167,10 @@
<if test="shelveState != null">
shelve_state = #{shelveState,jdbcType=BIT},
</if>
<if test="ifOversold != null">
<if test="platShelveState != null">
plat_shelve_state = #{platShelveState,jdbcType=BIT},
</if>
<if test="ifOversold != null">
if_oversold = #{ifOversold,jdbcType=BIT},
</if>
<if test="fictitiousNumber != null">

15
cereshop-business/src/main/java/com/shop/cereshop/business/controller/ProductController.java

@ -163,6 +163,21 @@ public class ProductController {
}
/**
* 商品上下架
* @param param
* @return
*/
@PostMapping(value = "platStart")
@NoRepeatSubmit
@ApiOperation(value = "平台上下架")
@NoRepeatWebLog
public Result platStart(@RequestBody ProductUpDownParam param, HttpServletRequest request) throws CoBusinessException{
//获取当前登录账户
CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user");
cereShopProductService.platStart(param,user);
return new Result(user.getUsername(),"平台上下架", GsonUtil.objectToGson(param));
}
/**
* 修改商品查询
* @param param
* @return

6
cereshop-business/src/main/java/com/shop/cereshop/business/page/product/ShopProduct.java

@ -235,6 +235,12 @@ public class ShopProduct {
private Integer ifLowPrice;
/**
* 平台上架商品状态 0-已下架 1-已上架 2-待审核 3-审核失败
*/
@ApiModelProperty(value = "平台上架商品状态 0-已下架 1-已上架 2-待审核 3-审核失败")
private Integer platShelveState;
/**
* 名称Map
*/
@ApiModelProperty(value = "名称Map")

7
cereshop-business/src/main/java/com/shop/cereshop/business/param/product/ProductSaveParam.java

@ -103,6 +103,13 @@ public class ProductSaveParam {
private String shelveState;
/**
* 是否平台上架 1-上架 0-不上架
*/
@ApiModelProperty(value = "是否上架 1-上架 0-不上架")
@NotBlank(message = "没有选择是否上架")
private String platShelveState;
/**
* 是否允许超卖 1- 0-
*/
@ApiModelProperty(value = "是否允许超卖 1-是 0-否")

6
cereshop-business/src/main/java/com/shop/cereshop/business/param/product/ProductUpdateParam.java

@ -97,6 +97,12 @@ public class ProductUpdateParam {
private Integer shelveState;
/**
* 是否平台上架 1-上架 0-不上架
*/
@ApiModelProperty(value = "是否平台上架 1-上架 0-不上架")
private Integer platShelveState;
/**
* 是否允许超卖 1- 0-
*/
@ApiModelProperty(value = "是否允许超卖 1-是 0-否")

2
cereshop-business/src/main/java/com/shop/cereshop/business/service/product/CereShopProductService.java

@ -30,6 +30,8 @@ public interface CereShopProductService {
void start(ProductUpDownParam param, CerePlatformBusinessUser user) throws CoBusinessException;
void platStart(ProductUpDownParam param, CerePlatformBusinessUser user) throws CoBusinessException;
Page getAll(ProductGetAllParam param) throws CoBusinessException;

75
cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java

@ -149,14 +149,15 @@ public class CereShopProductServiceImpl implements CereShopProductService {
cereShopProduct.setIfNew(param.getIfNew());
cereShopProduct.setIfFirst(param.getIfFirst());
cereShopProduct.setIfLowPrice(param.getIfLowPrice());
cereShopProduct.setShelveState(Integer.parseInt(param.getShelveState()));
if(IntegerEnum.PRODUCT_EXAMINE_YES.getCode().equals(Integer.parseInt(param.getShelveState()))){
//如果是已上架,修改状态为审核中
cereShopProduct.setShelveState(IntegerEnum.PRODUCT_EXAMINE_STAY.getCode());
if(IntegerEnum.PRODUCT_EXAMINE_YES.getCode().equals(Integer.parseInt(param.getPlatShelveState())) && IntegerEnum.PRODUCT_EXAMINE_YES.getCode().equals(Integer.parseInt(param.getShelveState()))){
//如果是平台已上架,修改状态为平台上架审核中需要满足商品上架状态为上架状态下
cereShopProduct.setPlatShelveState(IntegerEnum.PRODUCT_EXAMINE_STAY.getCode());
}else {
//已下架
cereShopProduct.setShelveState(Integer.parseInt(param.getShelveState()));
cereShopProduct.setPlatShelveState(Integer.parseInt(param.getPlatShelveState()));
}
cereShopProduct.setCreateTime(time);
cereShopProduct.setUpdateTime(time);
@ -296,6 +297,7 @@ public class CereShopProductServiceImpl implements CereShopProductService {
cereShopProduct.setIfNew(param.getIfNew());
cereShopProduct.setIfFirst(param.getIfFirst());
cereShopProduct.setIfLowPrice(param.getIfLowPrice());
cereShopProduct.setShelveState(param.getShelveState());
boolean isNeedReExam = false;
if(!StringUtils.equals(cereShopProduct.getProductName(), dbCereShopProduct.getProductName())){
@ -317,7 +319,7 @@ public class CereShopProductServiceImpl implements CereShopProductService {
isNeedReExam = true;
}
if(!isNeedReExam && !Objects.equals(cereShopProduct.getShelveState(), dbCereShopProduct.getShelveState())){
if(!isNeedReExam && !Objects.equals(param.getPlatShelveState(), dbCereShopProduct.getPlatShelveState())){
isNeedReExam = true;
}
@ -330,16 +332,21 @@ public class CereShopProductServiceImpl implements CereShopProductService {
}
}
if (isNeedReExam && IntegerEnum.PRODUCT_EXAMINE_YES.getCode().equals(param.getShelveState())) {
//如果是已上架,修改状态为审核中
cereShopProduct.setShelveState(IntegerEnum.PRODUCT_EXAMINE_STAY.getCode());
if (isNeedReExam && IntegerEnum.PRODUCT_EXAMINE_YES.getCode().equals(param.getPlatShelveState()) && IntegerEnum.PRODUCT_EXAMINE_YES.getCode().equals(param.getShelveState())) {
//如果是已上架,修改状态为审核中需满足商品上架状态为上架情况下
cereShopProduct.setPlatShelveState(IntegerEnum.PRODUCT_EXAMINE_STAY.getCode());
} else {
//已下架
cereShopProduct.setShelveState(param.getShelveState());
cereShopProduct.setPlatShelveState(param.getPlatShelveState());
}
//不管是审核中还是已下架sku实时信息都要改成下架
projectInvokeUtil.postRefreshSkuRealInfo(param.getProductId(), null, RefreshSkuRealInfoSourceEnum.PUT_OFF_SHELVE, null);
if (param.getShelveState() == 0){
//若为商品下架sku实时信息都要改成下架平台端也强制下架
cereShopProduct.setPlatShelveState(IntegerEnum.PRODUCT_SHELVSTATE_FORCED.getCode());
projectInvokeUtil.postRefreshSkuRealInfo(param.getProductId(), null, RefreshSkuRealInfoSourceEnum.PUT_OFF_SHELVE, null);
}
cereShopProduct.setUpdateTime(time);
cereShopProduct.setShopId(param.getShopId());
@ -587,14 +594,40 @@ public class CereShopProductServiceImpl implements CereShopProductService {
String describe="";
if(IntegerEnum.YES.getCode().equals(param.getShelveState())){
describe="上架商品";
cereShopProduct.setShelveState(IntegerEnum.PRODUCT_EXAMINE_STAY.getCode());
cereShopProduct.setShelveState(IntegerEnum.PRODUCT_EXAMINE_YES.getCode());
//更新商品库存缓存
updateProductStock(cereShopProduct.getProductId());
//刷新实时信息
projectInvokeUtil.postRefreshSkuRealInfo(param.getProductId(), RefreshSkuRealInfoSourceEnum.PUT_ON_SHELVE);
}else {
describe="下架商品";
cereShopProduct.setPlatShelveState(param.getShelveState());
projectInvokeUtil.postRefreshSkuRealInfo(param.getProductId(), null, RefreshSkuRealInfoSourceEnum.PUT_OFF_SHELVE, null);
}
cereShopProductDAO.updateByPrimaryKeySelective(cereShopProduct);
//清空缓存
triggerCacheUpdate(param.getProductId());
//triggerCacheUpdate(param.getProductId());
//新增日志
cerePlatformLogService.addLog(user,"商品管理","商户端操作",describe,cereShopProduct.getProductId(),time);
}
@Override
public void platStart(ProductUpDownParam param, CerePlatformBusinessUser user) throws CoBusinessException {
String time=TimeUtils.yyMMddHHmmss();
CereShopProduct cereShopProduct=new CereShopProduct();
cereShopProduct.setProductId(param.getProductId());
cereShopProduct.setPlatShelveState(param.getShelveState());
String describe="";
if(IntegerEnum.YES.getCode().equals(param.getShelveState())){
describe="平台上架商品";
cereShopProduct.setPlatShelveState(IntegerEnum.PRODUCT_EXAMINE_STAY.getCode());
}else {
describe="平台下架商品";
//projectInvokeUtil.postRefreshSkuRealInfo(param.getProductId(), null, RefreshSkuRealInfoSourceEnum.PUT_OFF_SHELVE, null);
}
cereShopProductDAO.updateByPrimaryKeySelective(cereShopProduct);
//清空缓存
//triggerCacheUpdate(param.getProductId());
//新增日志
cerePlatformLogService.addLog(user,"商品管理","商户端操作",describe,cereShopProduct.getProductId(),time);
}
@ -765,7 +798,8 @@ public class CereShopProductServiceImpl implements CereShopProductService {
cereShopProduct.setIfOversold(Integer.parseInt(param.getIfOversold()));
if (IntegerEnum.PRODUCT_EXAMINE_YES.getCode().equals(Integer.parseInt(param.getShelveState()))) {
//如果是已上架,修改状态为审核中
cereShopProduct.setShelveState(IntegerEnum.PRODUCT_EXAMINE_STAY.getCode());
//cereShopProduct.setShelveState(IntegerEnum.PRODUCT_EXAMINE_STAY.getCode());
cereShopProduct.setShelveState(IntegerEnum.PRODUCT_EXAMINE_YES.getCode());
} else {
//已下架
cereShopProduct.setShelveState(Integer.parseInt(param.getShelveState()));
@ -1306,4 +1340,19 @@ public class CereShopProductServiceImpl implements CereShopProductService {
cereShopSeckillDetailService.updateBatchSeckillPrice(details);
}
}
/**
* 更新商品库存
* @param productId
*/
private void updateProductStock(Long productId) {
List<Sku> skuList = cereProductSkuService.findByProductId(productId);
for (Sku sku:skuList) {
String skuStockKey = CacheKeyConstants.SKU_STOCK_PREFIX + sku.getSkuId();
stringRedisService.set(skuStockKey, sku.getStockNumber());
String skuTotalStockKey = CacheKeyConstants.SKU_TOTAL_STOCK_PREFIX + sku.getSkuId();
stringRedisService.set(skuTotalStockKey, sku.getTotal());
}
}
}

9
cereshop-business/src/main/resources/mybatis/mapper/product/CereShopProductDAO.xml

@ -28,7 +28,7 @@
</resultMap>
<sql id="Base_Column_List">
product_id, shop_id, product_name, product_brief, shop_group_id, classify_id, shop_group_business_id, classify_business_id, supplier_id,
supplier_name, if_logistics, shelve_state, if_oversold, fictitious_number, create_time, update_time, product_text,
supplier_name, if_logistics, shelve_state, plat_shelve_state, if_oversold, fictitious_number, create_time, update_time, product_text,
reject, if_credit, credit_limit, brand_id
</sql>
<sql id="Blob_Column_List">
@ -91,6 +91,9 @@
<if test="shelveState != null">
shelve_state = #{shelveState,jdbcType=BIT},
</if>
<if test="platShelveState != null">
plat_shelve_state = #{platShelveState,jdbcType=BIT},
</if>
<if test="ifOversold != null">
if_oversold = #{ifOversold,jdbcType=BIT},
</if>
@ -147,7 +150,8 @@
csp.brand_id,
csp.if_new,
csp.if_first,
csp.if_low_price
csp.if_low_price,
csp.plat_shelve_state
FROM cere_shop_product csp
INNER JOIN cere_platform_shop cps ON cps.shop_id = csp.shop_id
where csp.product_id = #{productId}
@ -168,6 +172,7 @@
csp.if_credit,
csp.reject,
csp.brand_id,
csp.plat_shelve_state,
(SELECT cpi.product_image FROM cere_product_image cpi WHERE cpi.product_id=csp.product_id LIMIT 1) product_image,
c.price,
c.original_price,

6
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/product/CereShopProduct.java

@ -141,6 +141,12 @@ public class CereShopProduct implements Serializable {
@ApiModelProperty("是否低价")
private Integer ifLowPrice;
/**
* 平台上架商品状态 0-已下架 1-已上架 2-待审核 3-审核失败
*/
@ApiModelProperty(value = "平台上架商品状态 0-已下架 1-已上架 2-待审核 3-审核失败")
private Integer platShelveState;
private static final long serialVersionUID = 1L;
/**

2
doc/3.0/update.sql

@ -289,3 +289,5 @@ ALTER TABLE `cere_shop_product` MODIFY COLUMN `classify_id` bigint DEFAULT NULL
ALTER TABLE cere_platform_shop ADD shop_type tinyint(1) DEFAULT 1 COMMENT '店铺类型 1国内贸易 2跨境保税 3海外直邮';
ALTER TABLE cere_platform_business ADD pc_domain varchar(128) DEFAULT '' COMMENT 'pc端商城域名';
ALTER TABLE cere_platform_business ADD mobile_domain varchar(128) DEFAULT '' COMMENT '移动端商城域名';
ALTER TABLE cere_shop_product ADD plat_shelve_state tinyint(1) DEFAULT 0 COMMENT '平台上架商品状态 0-已下架 1-已上架 2-待审核 3-审核失败';
Loading…
Cancel
Save