Commit 613dcc0d authored by wlx@33.cn's avatar wlx@33.cn

Merge branch 'dev' of https://gitlab.33.cn/yimu/mall-server into dev

parents 2789df0b 6546af76
......@@ -133,7 +133,7 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
nos[0] = 0;
for (int i = 0; i < kDTO.getStock(); i++) {
String hash = chainUtil.evmPublishTokenSplit(merchant.getTokenIssueAddr(), Long.parseLong(tokenId + (i + 1)), 1L);
nos[i + 1] = i + 1;
nos[i + 1] = 1;
hashs[i] = hash;
}
......@@ -308,7 +308,7 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
String hash = chainUtil.evmPublishTokenSplit(merchant.getTokenIssueAddr(), Long.parseLong(tokenId + (i + 1)), 1L);
hashs[i] = hash;
}
nos[i + 1] = i + 1;
nos[i + 1] = 1;
}
Map<String, Object> map = new HashMap<>();
......
......@@ -62,4 +62,8 @@ public class UserAsset implements Serializable {
@ApiModelProperty(value = "库存总价")
@TableField(exist = false)
private BigDecimal totalPrice;
@ApiModelProperty(value = "溯源hash")
@TableField(exist = false)
private String hash;
}
package com.fzm.mall.server.front.asset.model.vo.asset;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fzm.mall.server.front.goods.model.vo.SkuVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -30,5 +31,7 @@ public class UserAssetVo {
private String logo;
@ApiModelProperty("关键字查询")
private String keyWord;
@ApiModelProperty(value = "溯源hash")
@TableField(exist = false)
private String hash;
}
......@@ -22,8 +22,10 @@ import com.fzm.mall.server.front.base.PageVO;
import com.fzm.mall.server.front.constant.StateConst;
import com.fzm.mall.server.front.enums.CoinNameEnum;
import com.fzm.mall.server.front.enums.QueueTTLTypeEnum;
import com.fzm.mall.server.front.goods.model.GoodSpu;
import com.fzm.mall.server.front.goods.model.vo.PageVo;
import com.fzm.mall.server.front.goods.model.vo.SkuVo;
import com.fzm.mall.server.front.goods.service.IGoodSpuService;
import com.fzm.mall.server.front.goods.service.ISkuService;
import com.fzm.mall.server.front.mq.MsgProducer;
import com.fzm.mall.server.front.order.model.po.TranDto;
......@@ -70,6 +72,8 @@ public class UserAssetServiceImpl extends ServiceImpl<UserAssetMapper, UserAsset
private final IUserAssetRecordService userAssetRecordService;
private final ISkuService skuService;
private final ISysConfigService sysConfigService;
private final IGoodSpuService goodSpuService;
/**
* 分页查询用户资产
......@@ -86,14 +90,14 @@ public class UserAssetServiceImpl extends ServiceImpl<UserAssetMapper, UserAsset
if (type == 1 && !StringUtil.isNullOrEmpty(keyWord)) {
//模糊查询库存
list = coinDao.searchAssetLike(uid, type, keyWord);
}else{
} else {
list = list(qw);
}
for (UserAsset i : list) {
BigDecimal amount = i.getAmount();
i.setAmount(amount.setScale(2, BigDecimal.ROUND_DOWN));
i.setFrozen(i.getFrozen().setScale(2, BigDecimal.ROUND_DOWN));
if(StringUtil.isNullOrEmpty(i.getCoin())){
if (StringUtil.isNullOrEmpty(i.getCoin())) {
continue;
}
SkuVo skuVo = skuService.querySkuByCoin(i.getCoin());
......@@ -101,6 +105,11 @@ public class UserAssetServiceImpl extends ServiceImpl<UserAssetMapper, UserAsset
BigDecimal totalPrice = amount.multiply(skuVo.getOriginalPrice()).setScale(2, BigDecimal.ROUND_DOWN);
i.setTotalPrice(totalPrice);
i.setSkuVo(skuVo);
String goodsId = skuVo.getGoodsId();
GoodSpu goodSpu = goodSpuService.goodSpu(goodsId);
if (goodSpu != null) {
i.setHash(goodSpu.getHash());
}
}
}
PageVO<UserAsset> pageVO = new PageVO<>();
......@@ -122,6 +131,14 @@ public class UserAssetServiceImpl extends ServiceImpl<UserAssetMapper, UserAsset
asset.setAmount(asset.getAmount().setScale(2, BigDecimal.ROUND_DOWN));
asset.setFrozen(asset.getFrozen().setScale(2, BigDecimal.ROUND_DOWN));
BeanUtils.copyProperties(asset, userAssetVo);
SkuVo skuVo = skuService.querySkuByCoin(asset.getCoin());
if (skuVo != null) {
String goodsId = skuVo.getGoodsId();
GoodSpu goodSpu = goodSpuService.goodSpu(goodsId);
if (goodSpu != null) {
userAssetVo.setHash(goodSpu.getHash());
}
}
SysConfig sysConfig = sysConfigService.getByKey("coin_logo");
if (sysConfig != null) {
userAssetVo.setLogo(sysConfig.getDictValue());
......@@ -556,6 +573,6 @@ public class UserAssetServiceImpl extends ServiceImpl<UserAssetMapper, UserAsset
@Override
public int deleteAmount(Long id, BigDecimal amount) {
return coinDao.deleteAmount(id,amount);
return coinDao.deleteAmount(id, amount);
}
}
......@@ -23,6 +23,7 @@ import jdk.nashorn.internal.ir.annotations.Ignore;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
......@@ -80,6 +81,10 @@ public class GoodsController {
@Autowired
private IFootService footService;
@Autowired
private ICountService countService;
@ApiOperation(value = "热搜词")
@PostMapping("/without/getHotSearchKey")
public ResponseVO<List<String>> getHotSearchKey() {
......@@ -155,7 +160,7 @@ public class GoodsController {
List<String> categoryIds = iSpuService.getCategoryId(goodsVo.getGoodsId());
List<UserCouponVo> userCouponVos = couponService.getCouponByGoodsId(header.getUid(), goodsVo.getGoodsId(), header.getType(), PLATFORM_MERCHANT_ID, goodsVo.getMerchantId());
goodsVo.setMarketingCoupons(userCouponVos);
PromotionVo promotionVo = marketingPromotionService.getByGoodsId(goodsVo.getGoodsId(), header.getType(),goodsVo.getMerchantId());
PromotionVo promotionVo = marketingPromotionService.getByGoodsId(goodsVo.getGoodsId(), header.getType(), goodsVo.getMerchantId());
goodsVo.setPromotionVo(promotionVo);
}
SearchGoods searchGoods = new SearchGoods();
......@@ -175,7 +180,7 @@ public class GoodsController {
return new ResponseVO<>(MallResponseEnum.GOOD_NOT_EXIST);
}
BigDecimal comment = goodCommentService.getScope(goodsVo.getMerchantId());
goodsVo.setComment(comment==null?BigDecimal.ZERO:comment.setScale(2, RoundingMode.HALF_UP));
goodsVo.setComment(comment == null ? BigDecimal.ZERO : comment.setScale(2, RoundingMode.HALF_UP));
//生成浏览记录
if (!StringUtil.isNullOrEmpty(uid)) {
footService.addRecord(uid, goodsId);
......@@ -196,16 +201,23 @@ public class GoodsController {
}
goodsVo.setMarketingCoupons(userCouponVos);
//促销活动
PromotionVo byGoodsId = marketingPromotionService.getByGoodsId(goodsId, type,goodsVo.getMerchantId());
PromotionVo byGoodsId = marketingPromotionService.getByGoodsId(goodsId, type, goodsVo.getMerchantId());
goodsVo.setPromotionVo(byGoodsId);
List<SkuVo> skus = iSkuService.getByGoodsId(goodsId);
System.out.println(skus.size());
Long sum = 0L;
Long sales = 0L;
if (!CollectionUtils.isEmpty(skus)) {
for (SkuVo skuVo : skus) {
System.out.println(skuVo.getSkuId());
List<SkuProp> skuProps = iSkuPropService.getBySkuId(skuVo.getSkuId());
skuVo.setSkuProps(skuProps);
}
sum = skus.stream().mapToLong(SkuVo::getCirculation).sum();
sales = skus.stream().mapToLong(SkuVo::getSales).sum();
}
goodsVo.setCirculation(sum);
goodsVo.setSales(sales);
goodsVo.setSkus(skus);
return new ResponseVO<>(MallResponseEnum.SUCCESS, goodsVo);
}
......@@ -302,7 +314,7 @@ public class GoodsController {
System.err.println(userCouponId);
CouponVo couponVos = couponService.getAll(userCouponId, type);
if (couponVos.getRangeType() == 1) {
if (couponVos.getMerchantId().equals(PLATFORM_MERCHANT_ID)||merchantId.contains(couponVos.getMerchantId())) {
if (couponVos.getMerchantId().equals(PLATFORM_MERCHANT_ID) || merchantId.contains(couponVos.getMerchantId())) {
couponVos.setSkuIds(skuIds);
couponVoList.add(couponVos);
}
......@@ -311,7 +323,7 @@ public class GoodsController {
Set<String> skuId = new HashSet<>();
for (MarketingCouponCategory marketingCouponCategorie : marketingCouponCategories) {
if (categoryId.contains(marketingCouponCategorie.getCategoryId())) {
if(couponVos.getMerchantId().equals(PLATFORM_MERCHANT_ID)||merchantId.contains(couponVos.getMerchantId())){
if (couponVos.getMerchantId().equals(PLATFORM_MERCHANT_ID) || merchantId.contains(couponVos.getMerchantId())) {
skuId.addAll(categorySku.get(marketingCouponCategorie.getCategoryId()));
}
......@@ -366,7 +378,7 @@ public class GoodsController {
public String stringArray2Strin(List<String> strings) {
StringBuffer sb = new StringBuffer();
for (String s:strings) {
for (String s : strings) {
sb.append("'").append(s).append("'").append(",");
}
return sb.toString();
......@@ -380,7 +392,7 @@ public class GoodsController {
GoodsVo goodsVo = iSpuService.getByGoodId(goodsId);
Nft nft = nftService.getByGoodsId(goodsId);
goodsVo.setNft(nft);
return new ResponseVO<GoodsVo>(MallResponseEnum.SUCCESS,goodsVo);
return new ResponseVO<GoodsVo>(MallResponseEnum.SUCCESS, goodsVo);
}
}
......
......@@ -33,7 +33,7 @@ public class Count implements Serializable {
private Long id;
@ApiModelProperty(value = "商品编号")
private String gid;
private String goodsId;
@ApiModelProperty(value = "商品销量")
private Integer sales;
......
......@@ -141,6 +141,8 @@ public class GoodSpu implements Serializable {
private Integer nftSalesType;
private String nftFile;
@ApiModelProperty(value = "溯源hash")
private String hash;
public void initTokenId() {
if (commodityPass.equals(COMMODITY_PASS_OUT)){
......
......@@ -66,6 +66,13 @@ public class GoodsVo {
private List<String> imgListJson;
@ApiModelProperty(value = "商品销量")
@TableField(exist = false)
private Long sales;
@ApiModelProperty(value = "发行量")
@TableField(exist = false)
private Long circulation;
@ApiModelProperty(value = "nft")
@TableField(exist = false)
private Nft nft;
......
......@@ -17,6 +17,8 @@ import java.util.List;
* @since 2021-03-05
*/
public interface ICountService extends IService<Count> {
Count getCountByGid(String goodsId);
List<SaleHotVo> getTopTenSaleHotVo(PageVO pageVo);
List<SaleHotVo> getList(PageVo pageVo);
......
package com.fzm.mall.server.front.goods.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzm.mall.server.front.base.PageVO;
import com.fzm.mall.server.front.goods.mapper.CustomMapper;
import com.fzm.mall.server.front.goods.model.Count;
import com.fzm.mall.server.front.goods.mapper.CountMapper;
import com.fzm.mall.server.front.goods.model.OprationFunction;
import com.fzm.mall.server.front.goods.model.qo.UserAuctionQO;
import com.fzm.mall.server.front.goods.model.vo.PageVo;
import com.fzm.mall.server.front.goods.model.vo.SaleHotVo;
......@@ -36,6 +38,13 @@ public class CountServiceImpl extends ServiceImpl<CountMapper, Count> implements
return countMapper.getList(start, end);
}
@Override
public Count getCountByGid(String goodsId) {
QueryWrapper<Count> q = new QueryWrapper<>();
q.eq("goods_id",goodsId);
return getOne(q);
}
/**
* 查询前十的值得买商品
*/
......
......@@ -62,12 +62,12 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
@Override
public Boolean checkOrder(OrderVo orderVo) {
List<MerchantGoodsVo> merchantGoodsVos = orderVo.getMerchantGoodsVos();
for (MerchantGoodsVo merchantGoodsVo:merchantGoodsVos) {
for (MerchantGoodsVo merchantGoodsVo : merchantGoodsVos) {
String merchantId = merchantGoodsVo.getMerchantId();
List<OrderSkuVo> orderSkuVos = merchantGoodsVo.getOrderSkuVos();
for (OrderSkuVo orderSkuVo:orderSkuVos) {
boolean b = checkMerchantIdAndSkuId(merchantId,orderSkuVo.getSkuId());
if(!b){
for (OrderSkuVo orderSkuVo : orderSkuVos) {
boolean b = checkMerchantIdAndSkuId(merchantId, orderSkuVo.getSkuId());
if (!b) {
return false;
}
}
......@@ -82,9 +82,9 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
private boolean checkMerchantIdAndSkuId(String merchantId, String skuId) {
SkuVo skuVo = skuMapper.getBySkuId(skuId);
if(merchantId.equals(skuVo.getMerchantId())){
if (merchantId.equals(skuVo.getMerchantId())) {
return true;
}else{
} else {
return false;
}
}
......@@ -92,17 +92,20 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements ISkuS
@Override
public SkuVo querySkuByCoin(String coin) {
QueryWrapper<Sku> qw = new QueryWrapper<>();
if(StringUtil.isNullOrEmpty(coin)){
if (StringUtil.isNullOrEmpty(coin)) {
return null;
}
qw.eq("coin_name", coin);
Sku sku = getOne(qw);
SkuVo skuVo = new SkuVo();
if (sku != null) {
skuVo = skuMapper.getBySkuId(sku.getSkuId());
if (sku == null) {
return null;
}
SkuVo skuVo = skuMapper.getBySkuId(sku.getSkuId());
if (skuVo == null) {
return null;
}
List<SkuProp> list = skuPropService.getBySkuId(skuVo.getSkuId());
skuVo.setSkuProps(list);
}
return skuVo;
}
......
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