## Feat - 秒杀专区销售数量
This commit is contained in:
parent
0c799715d7
commit
28bbd5064d
|
@ -292,6 +292,16 @@ public class ApiBdWaresController extends BaseController {
|
|||
jsonArray.add(js);
|
||||
}
|
||||
}
|
||||
Integer inventory = waresExt.getInventory();
|
||||
Integer inventoryRatio = waresExt.getInventoryRatio();
|
||||
Integer inventoryUse = waresExt.getInventoryUse();
|
||||
int ratio = 100 - (int) Math.round(NumberUtil.getRatioNum(inventory, inventoryUse));
|
||||
if(ratio <= inventoryRatio){
|
||||
waresParams.setUseRatio(true);
|
||||
waresParams.setInventory(ratio + "");
|
||||
}else{
|
||||
waresParams.setUseRatio(false);
|
||||
}
|
||||
waresParams.setProductGroup(jsonArray);
|
||||
waresParamsList.add(waresParams);
|
||||
}
|
||||
|
@ -684,6 +694,16 @@ public class ApiBdWaresController extends BaseController {
|
|||
} else {
|
||||
waresParamsList.add(waresParams);
|
||||
}
|
||||
Integer inventory = waresExt.getInventory();
|
||||
Integer inventoryRatio = waresExt.getInventoryRatio();
|
||||
Integer inventoryUse = waresExt.getInventoryUse();
|
||||
int ratio = 100 - (int) Math.round(NumberUtil.getRatioNum(inventory, inventoryUse));
|
||||
if(ratio <= inventoryRatio){
|
||||
waresParams.setUseRatio(true);
|
||||
waresParams.setInventory(ratio + "");
|
||||
}else{
|
||||
waresParams.setUseRatio(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(waresParamsList);
|
||||
|
|
|
@ -891,6 +891,13 @@ public class BdWaresController extends BaseController {
|
|||
waresParams.setMemberLimit(waresExtend.getMemberLimit());
|
||||
waresParams.setMemberMonthLimit(waresExtend.getMemberMonthLimit());
|
||||
|
||||
waresParams.setInventory(waresExtend.getInventory());
|
||||
waresParams.setInventoryRatio(waresExtend.getInventoryRatio());
|
||||
waresParams.setMemberLimit(waresExtend.getMemberLimit());
|
||||
waresParams.setMemberMonthLimit(waresExtend.getMemberMonthLimit());
|
||||
waresParams.setInventoryUse(waresExtend.getInventoryUse());
|
||||
|
||||
|
||||
BdAreaClassify parentAreaClassify = areaClassifyService.getAreaClassify(wares.getPkAreaClassify());
|
||||
if (parentAreaClassify != null) {
|
||||
if (parentAreaClassify.getPkParent() == 0) {
|
||||
|
@ -1342,4 +1349,18 @@ public class BdWaresController extends BaseController {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑商品信息
|
||||
*
|
||||
* @param waresParams
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/resetInventoryUse")
|
||||
@Log(module = EOperationModule.WARES_LIST, business = EOperationBusiness.WARES_LIST, method = EOperationMethod.RESET)
|
||||
public AjaxResult resetInventoryUse(@RequestBody WaresParams waresParams) {
|
||||
waresParams.setPkCountry(SecurityUtils.getPkCountry());
|
||||
waresService.resetInventoryUse(waresParams);
|
||||
return AjaxResult.success(waresParams.getWaresCode());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -281,4 +281,14 @@ public class CuWaresParams implements Serializable {
|
|||
* 消费配置主键
|
||||
*/
|
||||
private Integer pkSpecialCurrency;
|
||||
|
||||
/**
|
||||
* 展示库存
|
||||
*/
|
||||
private String inventory;
|
||||
|
||||
/**
|
||||
* 是否展示剩余比例
|
||||
*/
|
||||
private boolean useRatio;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.hzs.sale.wares.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.hzs.common.core.annotation.BigDecimalFormat;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -423,5 +424,10 @@ public class WaresParams implements Serializable {
|
|||
* 会员月限购
|
||||
*/
|
||||
private Integer memberMonthLimit;
|
||||
/**
|
||||
* 已用库存数量
|
||||
*/
|
||||
private Integer inventoryUse;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -236,4 +236,5 @@ public interface IBdWaresService extends IService<BdWares> {
|
|||
*/
|
||||
List<BdWaresExt> listWares(IndexWaresParam param);
|
||||
|
||||
void resetInventoryUse(WaresParams params);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.hzs.common.core.enums.*;
|
|||
import com.hzs.common.core.exception.base.BaseException;
|
||||
import com.hzs.common.core.service.RedisService;
|
||||
import com.hzs.common.core.utils.DateUtils;
|
||||
import com.hzs.common.core.utils.NumberUtil;
|
||||
import com.hzs.common.core.utils.StringUtils;
|
||||
import com.hzs.common.domain.member.base.CuMember;
|
||||
import com.hzs.common.domain.member.ext.CuMemberExt;
|
||||
|
@ -135,6 +136,7 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
|||
waresExtend.setPkCreator(user.getUserId());
|
||||
waresExtend.setCreationTime(DateUtils.currentDateTime());
|
||||
waresExtend.setPkCountry(user.getDataCountry());
|
||||
waresExtend.setInventoryUse(0);
|
||||
// 前缀标签
|
||||
BdLabel prefixLabel = null;
|
||||
if (waresParams.getPkPrefixLabel() != null) {
|
||||
|
@ -551,6 +553,7 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
|||
waresExtend.setPkWares(wares.getPkId());
|
||||
waresExtend.setPkModified(user.getUserId());
|
||||
waresExtend.setModifiedTime(new Date());
|
||||
waresExtend.setInventoryUse(null);
|
||||
// 根据商品id 修改信息
|
||||
LambdaQueryWrapper<BdWaresExtend> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdWaresExtend::getPkWares, wares.getPkId());
|
||||
|
@ -1241,6 +1244,7 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
|||
specialAreaList = saList;
|
||||
}
|
||||
|
||||
specialAreaList.add(14);
|
||||
RecommendWaresInfoVo recommendWaresInfoVo = new RecommendWaresInfoVo();
|
||||
// 推荐专区
|
||||
List<RecommendSpecialAreaVo> resultList = new ArrayList<>();
|
||||
|
@ -1281,6 +1285,17 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
|||
waresVo.setIsSale(wl.getIsSale());
|
||||
waresVo.setPreSaleStatus(wl.getPreSaleStatus());
|
||||
waresVo.setSpecialArea(wl.getSpecialArea());
|
||||
|
||||
Integer inventory = wl.getInventory();
|
||||
Integer inventoryRatio = wl.getInventoryRatio();
|
||||
Integer inventoryUse = wl.getInventoryUse();
|
||||
int ratio = 100 - (int) Math.round(NumberUtil.getRatioNum(inventory, inventoryUse));
|
||||
if(ratio <= inventoryRatio){
|
||||
waresVo.setUseRatio(true);
|
||||
waresVo.setInventory(ratio + "");
|
||||
}else{
|
||||
waresVo.setUseRatio(false);
|
||||
}
|
||||
return waresVo;
|
||||
}).collect(Collectors.toList());
|
||||
recommendSpecialAreaVo.setWaresList(waresVoList);
|
||||
|
@ -1508,4 +1523,19 @@ public class BdWaresServiceImpl extends ServiceImpl<BdWaresMapper, BdWares> impl
|
|||
return baseMapper.listWaresNew(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetInventoryUse(WaresParams params) {
|
||||
BdWaresExtend waresExtend = BeanUtil.copyProperties(params, BdWaresExtend.class);
|
||||
waresExtend.setSystemType(ESystemType.DEFAULT.getValue());
|
||||
waresExtend.setPkWares(params.getWaresId());
|
||||
waresExtend.setPkModified(SecurityUtils.getUserId());
|
||||
waresExtend.setModifiedTime(new Date());
|
||||
waresExtend.setInventoryUse(0);
|
||||
|
||||
LambdaQueryWrapper<BdWaresExtend> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BdWaresExtend::getPkWares, params.getWaresId());
|
||||
|
||||
iBdWaresExtendService.update(waresExtend, queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.hzs.common.core.domain.R;
|
|||
import com.hzs.common.core.enums.*;
|
||||
import com.hzs.common.core.utils.ComputeUtil;
|
||||
import com.hzs.common.core.utils.DistinctByKeyUtil;
|
||||
import com.hzs.common.core.utils.NumberUtil;
|
||||
import com.hzs.common.core.utils.StringUtils;
|
||||
import com.hzs.common.domain.member.base.CuMember;
|
||||
import com.hzs.common.domain.sale.ext.BdWaresSpecsRelationExt;
|
||||
|
@ -98,6 +99,7 @@ public class BdWaresSpecsSkuServiceImpl extends ServiceImpl<BdWaresSpecsSkuMappe
|
|||
}
|
||||
specsNameMap.put(bdWaresSpecsSku.getPkId(), specsName);
|
||||
}
|
||||
BdWaresSpecsSkuExt sku = bdWaresSpecsSkuExtList.get(0);
|
||||
CuWaresParams cuWaresParams = BeanUtil.copyProperties(bdWaresSpecsSkuExtList.get(0), CuWaresParams.class);
|
||||
cuWaresParams.setWaresPrice(bdWaresSpecsSkuExtList.get(0).getPrice());
|
||||
cuWaresParams.setPkWares(bdWaresSpecsSkuExtList.get(0).getPkWares());
|
||||
|
@ -168,6 +170,17 @@ public class BdWaresSpecsSkuServiceImpl extends ServiceImpl<BdWaresSpecsSkuMappe
|
|||
productParams.addAll(productParamsResultList);
|
||||
cuWaresParams.setProductParams(productParams);
|
||||
cuWaresParams.setSpecialArea(specialArea);
|
||||
|
||||
Integer inventory = sku.getInventory();
|
||||
Integer inventoryRatio = sku.getInventoryRatio();
|
||||
Integer inventoryUse = sku.getInventoryUse();
|
||||
int ratio = 100 - (int) Math.round(NumberUtil.getRatioNum(inventory, inventoryUse));
|
||||
if(ratio <= inventoryRatio){
|
||||
cuWaresParams.setUseRatio(true);
|
||||
cuWaresParams.setInventory(ratio + "");
|
||||
}else{
|
||||
cuWaresParams.setUseRatio(false);
|
||||
}
|
||||
return cuWaresParams;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.hzs.sale.wares.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.hzs.common.core.annotation.BigDecimalFormat;
|
||||
import com.hzs.common.core.annotation.Excel;
|
||||
|
@ -292,4 +293,29 @@ public class WaresVo {
|
|||
*/
|
||||
private Date waresApprovalTime;
|
||||
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private String inventory;
|
||||
/**
|
||||
* 库存倒计时比例
|
||||
*/
|
||||
private Integer inventoryRatio;
|
||||
/**
|
||||
* 会员总限购
|
||||
*/
|
||||
private Integer memberLimit;
|
||||
/**
|
||||
* 会员月限购
|
||||
*/
|
||||
private Integer memberMonthLimit;
|
||||
/**
|
||||
* 已用库存数量
|
||||
*/
|
||||
private Integer inventoryUse;
|
||||
/**
|
||||
* 是否展示剩余比例
|
||||
*/
|
||||
private boolean useRatio;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,9 @@
|
|||
OPERATE_SCOPE, PREFIX_LABEL, COOL_LABEL,
|
||||
S_LABEL, SALES, IS_SALE, ARRIVAL_TIME, WARN_MESSAGE,
|
||||
IS_LAND_TRANS, IS_AIR_TRANS, IS_OCEAN_TRANS,
|
||||
VIDEO_URL, COVER, be.maker_income, be.PK_SPECIAL_CURRENCY
|
||||
VIDEO_URL, COVER, be.maker_income, be.PK_SPECIAL_CURRENCY,
|
||||
|
||||
be.INVENTORY, be.INVENTORY_RATIO, be.MEMBER_LIMIT, be.MEMBER_MONTH_LIMIT, be.INVENTORY_USE
|
||||
from bd_wares bw
|
||||
inner join bd_wares_extend be
|
||||
on bw.pk_id = be.pk_wares
|
||||
|
@ -188,7 +190,8 @@
|
|||
bw.SORT,bw.COVER,bw.WARES_NAME,bw.WARES_CODE,bw.WARES_PRICE,bw.WARES_ACHIEVE,bw.SPECIAL_AREA ,bw.IS_SINGLE,bw.IS_FREE_MAIL,
|
||||
ac.CLASSIFY_NAME,we.OPERATE_SCOPE,we.IS_SALE,we.IS_PUT_ON,we.PRE_SALE_STATUS,bw.PK_ID,we.ARRIVAL_TIME,we.PUT_ON_TIME,we.PUT_OFF_TIME,
|
||||
we.SALES actualSales,we.SALES,bw.CREATION_TIME,bw.IS_RECOMMEND,bw.LISTING_TIME,bw.REMOVAL_TIME,bw.SORT_STATUS,we.IS_MAKER_GIFT,
|
||||
sc.TEMP_NAME, we.maker_income, nvl(we.SYSTEM_TYPE, 0) SYSTEM_TYPE, bw.WARES_STATUS
|
||||
sc.TEMP_NAME, we.maker_income, nvl(we.SYSTEM_TYPE, 0) SYSTEM_TYPE, bw.WARES_STATUS,
|
||||
we.INVENTORY, we.INVENTORY_RATIO, we.MEMBER_LIMIT, we.MEMBER_MONTH_LIMIT, we.INVENTORY_USE
|
||||
from bd_wares bw
|
||||
left join BD_WARES_EXTEND we on we.PK_WARES = bw.PK_ID
|
||||
left join BD_AREA_CLASSIFY ac on ac.PK_ID = bw.PK_AREA_CLASSIFY
|
||||
|
@ -370,7 +373,8 @@
|
|||
DETAILS, SORT, SPECIAL_AREA, IS_SINGLE,
|
||||
IS_PUT_ON, PRE_SALE_STATUS, PUT_ON_TIME, PUT_OFF_TIME, OPERATE_SCOPE, PREFIX_LABEL, COOL_LABEL,
|
||||
S_LABEL, SALES, IS_SALE, ARRIVAL_TIME, WARN_MESSAGE,
|
||||
IS_LAND_TRANS,IS_AIR_TRANS,IS_OCEAN_TRANS,VIDEO_URL
|
||||
IS_LAND_TRANS,IS_AIR_TRANS,IS_OCEAN_TRANS,VIDEO_URL,
|
||||
be.INVENTORY, be.INVENTORY_RATIO, be.MEMBER_LIMIT, be.MEMBER_MONTH_LIMIT, be.INVENTORY_USE
|
||||
from bd_wares bw
|
||||
inner join bd_wares_extend be
|
||||
on bw.pk_id = be.pk_wares
|
||||
|
@ -409,7 +413,9 @@
|
|||
|
||||
<!-- 查询推荐商品 -->
|
||||
<select id="queryByRecommendList" resultMap="BaseResultMap">
|
||||
select bw.*, be.IS_SALE, be.PRE_SALE_STATUS
|
||||
select bw.*, be.IS_SALE, be.PRE_SALE_STATUS,
|
||||
|
||||
be.INVENTORY, be.INVENTORY_RATIO, be.MEMBER_LIMIT, be.MEMBER_MONTH_LIMIT, be.INVENTORY_USE
|
||||
from bd_wares bw
|
||||
left join bd_wares_extend be on bw.pk_id = be.pk_wares
|
||||
where be.IS_PUT_ON = 0 and bw.del_flag = 0 and be.del_flag = 0
|
||||
|
@ -420,9 +426,11 @@
|
|||
<if test="pkCountry != null">
|
||||
and bw.PK_COUNTRY = #{pkCountry}
|
||||
</if>
|
||||
<!--
|
||||
<if test="isRecommend != null">
|
||||
and bw.IS_RECOMMEND = #{isRecommend}
|
||||
</if>
|
||||
-->
|
||||
order by bw.SORT desc, bw.wares_price
|
||||
</select>
|
||||
|
||||
|
|
|
@ -99,7 +99,9 @@
|
|||
, be.CREATION_TIME
|
||||
, be.PRE_SALE_STATUS
|
||||
, be.is_maker_gift
|
||||
, bk.vip_price,bk.retail_price,be.PK_SPECIAL_CURRENCY
|
||||
, bk.vip_price,bk.retail_price,be.PK_SPECIAL_CURRENCY,
|
||||
|
||||
be.INVENTORY, be.INVENTORY_RATIO, be.MEMBER_LIMIT, be.MEMBER_MONTH_LIMIT, be.INVENTORY_USE
|
||||
from bd_wares bw
|
||||
inner join bd_wares_extend be
|
||||
on bw.pk_id = be.pk_wares
|
||||
|
@ -296,7 +298,9 @@
|
|||
, be.CREATION_TIME
|
||||
, be.PRE_SALE_STATUS
|
||||
, be.is_maker_gift
|
||||
, be.PK_SPECIAL_CURRENCY
|
||||
, be.PK_SPECIAL_CURRENCY,
|
||||
|
||||
be.INVENTORY, be.INVENTORY_RATIO, be.MEMBER_LIMIT, be.MEMBER_MONTH_LIMIT, be.INVENTORY_USE
|
||||
from bd_wares bw
|
||||
inner join bd_wares_extend be
|
||||
on bw.pk_id = be.pk_wares
|
||||
|
|
|
@ -22,6 +22,8 @@ public enum EOperationMethod {
|
|||
|
||||
UPDATE("修改"),
|
||||
|
||||
RESET("重置已用库存"),
|
||||
|
||||
UPDATE_STATUS("修改状态"),
|
||||
|
||||
DELETE("删除"),
|
||||
|
|
|
@ -39,7 +39,7 @@ public enum ESpecialArea {
|
|||
/**
|
||||
* 秒杀专区
|
||||
*/
|
||||
LIVE_BROADCAST(14, "秒杀专区", 0, EnumsPrefixConstants.SPECIAL_AREA + 14, 14, EMenuDetail.LIVE.getValue()),
|
||||
LIVE_BROADCAST(14, "秒杀专区", 0, EnumsPrefixConstants.SPECIAL_AREA + 14, 0, EMenuDetail.LIVE.getValue()),
|
||||
|
||||
/**
|
||||
* 注册专区
|
||||
|
|
|
@ -26,5 +26,12 @@ public class NumberUtil {
|
|||
return "0%";
|
||||
}
|
||||
}
|
||||
public static double getRatioNum(Integer number1, Integer number2) {
|
||||
if (number2 != 0) {
|
||||
return ((double) number2/ (double) number1) * 100;
|
||||
} else {
|
||||
return 0d;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -186,4 +186,25 @@ public class BdWaresExt extends BdWares {
|
|||
*/
|
||||
private Integer isMakerGift;
|
||||
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer inventory;
|
||||
/**
|
||||
* 库存倒计时比例
|
||||
*/
|
||||
private Integer inventoryRatio;
|
||||
/**
|
||||
* 会员总限购
|
||||
*/
|
||||
private Integer memberLimit;
|
||||
/**
|
||||
* 会员月限购
|
||||
*/
|
||||
private Integer memberMonthLimit;
|
||||
/**
|
||||
* 已用库存数量
|
||||
*/
|
||||
private Integer inventoryUse;
|
||||
}
|
||||
|
|
|
@ -171,4 +171,24 @@ public class BdWaresSpecsSkuExt extends BdWaresSpecsSku {
|
|||
|
||||
private Integer pkSpecialCurrency;
|
||||
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer inventory;
|
||||
/**
|
||||
* 库存倒计时比例
|
||||
*/
|
||||
private Integer inventoryRatio;
|
||||
/**
|
||||
* 会员总限购
|
||||
*/
|
||||
private Integer memberLimit;
|
||||
/**
|
||||
* 会员月限购
|
||||
*/
|
||||
private Integer memberMonthLimit;
|
||||
/**
|
||||
* 已用库存数量
|
||||
*/
|
||||
private Integer inventoryUse;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue