Commit 0e7b2887 authored by wlx@33.cn's avatar wlx@33.cn

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

parents dbc97216 ea702a91
package com.fzm.mall.server.admin.block_chain.enums;
/**
* 通证类型 1:token 2:ft 3:nft(外部) 4:nft(内部)
*/
public enum ChainStatusEnum {
RUNNING(0),//待确认
SUCCESS(1),//成功
FAIL(2);//失败
private Integer status;
ChainStatusEnum(Integer status) {
this.status = status;
}
public Integer getStatus() {
return status;
}
}
......@@ -13,6 +13,7 @@ import com.fzm.mall.server.admin.exception.MyException;
import com.fzm.mall.server.admin.goods_center.entity.dto.*;
import com.fzm.mall.server.admin.goods_center.entity.vo.*;
import com.fzm.mall.server.admin.goods_center.enums.status.SpuStatusEnum;
import com.fzm.mall.server.admin.goods_center.model.Spu;
import com.fzm.mall.server.admin.goods_center.service.IExternalTokenService;
import com.fzm.mall.server.admin.goods_center.service.ISkuService;
import com.fzm.mall.server.admin.goods_center.service.ISpuService;
......@@ -65,17 +66,16 @@ public class SpuController {
@PostMapping("/releaseGoods/add")
public ResponseVO add(@RequestBody @Valid GoodsSpuDTO pDTO, @ApiParam(name = "adminId", value = "管理员id")
@RequestHeader String adminId) {
System.err.println("pDTO:" + pDTO);
spuService.goodsNameExist(pDTO.getName());
adminService.adminAuthChecks(adminId, AdminTypeEnum.getMerchantTypeArr());
String merchantId = adminService.getByAdminId(adminId).getMerchantId();
Merchant merchant = merchantService.getByMerchantId(merchantId);
if (merchant.getDelayDelivery().equals(GoodsConfigureEnum.IMMEDIATE_DELIVERY.status())
&& pDTO.getDelayDelivery().equals(GoodsConfigureEnum.DELAY_DELIVERY.status())) {
return resFac.getResponse(MallResponseError.MERCHANT_NOT_DELAY_DELIVERY);
}
Spu spu = spuService.getByGoodsId(pDTO.getGoodsId());
if (spu != null && !spu.getName().equals(pDTO.getName())) {
return resFac.getResponse(MallResponseError.GOODS_NAME_EXIST);
}
/*Template template = templateService.getByMerchantId(merchantId);
if (template == null) {
return resFac.getResponse(MallResponseError.NULL_TEMPLATE);
......@@ -84,7 +84,16 @@ public class SpuController {
if (shopDTO == null) {
return resFac.getResponse(MallResponseError.NULL_SHOP);
}
spuService.add(pDTO, merchantId, null);
spuService.add(pDTO, merchantId, null, merchant.getTokenIssueAddr());
return resFac.getSimpleSuccessResponse();
}
@ApiOperation(value = "存为草稿")
@PostMapping("/releaseGoods/draft")
public ResponseVO draft(@RequestBody @Valid GoodsSpuDraftDTO pDTO, @ApiParam(name = "adminId", value = "管理员id")
@RequestHeader String adminId) {
String merchantId = adminService.getByAdminId(adminId).getMerchantId();
spuService.draft(pDTO, merchantId);
return resFac.getSimpleSuccessResponse();
}
......
package com.fzm.mall.server.admin.goods_center.entity.dto;
import com.fzm.mall.server.admin.constant.MallResponseError;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.List;
......@@ -23,18 +21,12 @@ public class GoodsSkuDTO {
private String skuId;
@ApiModelProperty("原价")
@DecimalMin(value = "0", message = MallResponseError.VALUE_LT_0_ERROR)
@NotNull(message = MallResponseError.NULL_PARAM_ERROR)
private BigDecimal originalPrice;
@ApiModelProperty("重量")
// @DecimalMin(value = "0", message = MallResponseError.VALUE_LT_0_ERROR)
// @NotNull(message = MallResponseError.NULL_PARAM_ERROR)
private BigDecimal weight;
@ApiModelProperty("库存")
@Min(value = 0, message = MallResponseError.VALUE_LT_0_ERROR)
@NotNull(message = MallResponseError.NULL_PARAM_ERROR)
private Long stock;
@ApiModelProperty("外部token编号")
......@@ -44,11 +36,9 @@ public class GoodsSkuDTO {
private String coinName;
@ApiModelProperty("规格缩略图")
// @NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String image;
@ApiModelProperty("规格属性列表")
@NotEmpty(message = MallResponseError.NULL_PARAM_ERROR)
private List<SkuPropertyDTO> propertyList;
@ApiModelProperty("是否重发")
......@@ -57,4 +47,7 @@ public class GoodsSkuDTO {
@ApiModelProperty("nft销售方式(1.原商品销售 2.拷贝销售)")
private Integer nftSalesType;
@ApiModelProperty("是否隐藏款(0.否 1.是)")
private Integer isHide;
}
......@@ -10,6 +10,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -22,6 +23,9 @@ import java.util.List;
@ApiModel(value = "GoodsSpuDTO", description = "商品信息")
public class GoodsSpuDTO {
@ApiModelProperty("商品ID")
private String goodsId;
@ApiModelProperty("商品名称")
@NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String name;
......@@ -52,27 +56,19 @@ public class GoodsSpuDTO {
private String imgList;
@ApiModelProperty("商品视频")
// @NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String video;
@ApiModelProperty("视频封面")
// @NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String videoPoster;
@ApiModelProperty("商品介绍")
@NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String detail;
// @ApiModelProperty("快递模板")
// @NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
// private String templateId;
@ApiModelProperty("商品通证(0.否 1.是,自动生成Token 2.是,使用外部既有Token 3.外部token使用权)")
// @NotNull(message = MallResponseError.NULL_PARAM_ERROR)
private Integer commodityPass;
@ApiModelProperty("延迟提货(0--否 1--是)")
// @NotNull(message = MallResponseError.NULL_PARAM_ERROR)
private Integer delayDelivery;
@ApiModelProperty("退货类型")
......@@ -87,27 +83,27 @@ public class GoodsSpuDTO {
private String note;
@ApiModelProperty("溯源信息")
// @NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String traceabilityNumber;
@ApiModelProperty("ntf文件")
// @NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String nftFile;
@ApiModelProperty("商品规格")
// @NotEmpty(message = MallResponseError.NULL_PARAM_ERROR)
private List<GoodsSkuDTO> skuList;
@ApiModelProperty("商品预售")
private PreSaleDTO preSaleDTO;
@ApiModelProperty("nft")
private NFTDTO nftdto;
@ApiModelProperty("1.普通 4.盲盒")
private Integer salesType;
@ApiModelProperty("商品拍卖")
private AuctionDTO auctionDTO;
@ApiModelProperty("盲盒商品难度(1-10)")
private Integer difficulty;
@ApiModelProperty("商品拍卖")
private PackageDTO packageDTO;
@ApiModelProperty("盲盒价格")
private BigDecimal blindBoxPrice;
@ApiModelProperty("nft")
private NFTDTO nftdto;
@ApiModelProperty("盲盒规则")
private String blindBoxRule;
}
package com.fzm.mall.server.admin.goods_center.entity.dto;
import com.fzm.mall.server.admin.annotation.CustomType;
import com.fzm.mall.server.admin.constant.MALLGlobalConfig;
import com.fzm.mall.server.admin.constant.MallResponseError;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
/**
* @author wangp
* @date 2021/3/9 10:37
* @description 商品信息
* @since JDK 1.8
*/
@Data
@ApiModel(value = "GoodsSpuDTO", description = "商品信息")
public class GoodsSpuDraftDTO {
@ApiModelProperty("商品ID")
private String goodsId;
@ApiModelProperty("商品名称")
@NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String name;
@ApiModelProperty("商品类型")
private Integer type;
@ApiModelProperty("商品描述")
private String description;
@ApiModelProperty("商品属性")
private String prop;
@ApiModelProperty("商品类目")
private String categoryId;
@ApiModelProperty("商品缩略图")
private String thumb;
@ApiModelProperty("商品展示图")
private String imgList;
@ApiModelProperty("商品视频")
private String video;
@ApiModelProperty("视频封面")
private String videoPoster;
@ApiModelProperty("商品介绍")
private String detail;
@ApiModelProperty("商品通证(0.否 1.是,自动生成Token 2.是,使用外部既有Token 3.外部token使用权)")
private Integer commodityPass;
@ApiModelProperty("延迟提货(0--否 1--是)")
private Integer delayDelivery;
@ApiModelProperty("退货类型")
private Integer returnType;
@ApiModelProperty("退货原因")
private String returnReason;
@ApiModelProperty("商品备注")
private String note;
@ApiModelProperty("溯源信息")
private String traceabilityNumber;
@ApiModelProperty("ntf文件")
private String nftFile;
@ApiModelProperty("商品规格")
private List<GoodsSkuDTO> skuList;
@ApiModelProperty("nft")
private NFTDTO nftdto;
@ApiModelProperty("1.普通 4.盲盒")
private Integer salesType;
@ApiModelProperty("盲盒商品难度(1-10)")
private Integer difficulty;
@ApiModelProperty("盲盒价格")
private BigDecimal blindBoxPrice;
@ApiModelProperty("盲盒规则")
private String blindBoxRule;
}
......@@ -18,11 +18,9 @@ import javax.validation.constraints.NotBlank;
public class SkuPropertyDTO {
@ApiModelProperty("属性名称")
@NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String propKey;
@ApiModelProperty("属性值")
@NotBlank(message = MallResponseError.NULL_PARAM_ERROR)
private String propVal;
}
......@@ -25,5 +25,6 @@ public class GoodsSkuVO {
private List<SkuPropertyVO> propertyList;
private Integer status;
private Integer nftSalesType;
private Integer isHide;
}
......@@ -3,6 +3,7 @@ package com.fzm.mall.server.admin.goods_center.entity.vo;
import com.fzm.mall.server.admin.goods_center.model.GoodsNft;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -40,5 +41,9 @@ public class GoodsSpuDetailVO {
private GoodsPackageVO goodsPackageVO;
private GoodsNftVO goodsNftVO;
private PointsExchangeVO pointsExchangeVO;
private Integer difficulty;
private BigDecimal blindBoxPrice;
private Integer salesType;
private String blindBoxRule;
}
......@@ -27,14 +27,15 @@ public class GoodsSpuVO {
private Integer status;
private BigDecimal maxPrice;
private BigDecimal defaultPrice;
private Long stock;
private Long sales;
private Long stock = 0L;
private Long sales = 0L;
private String enterpriseName;
private String linkName;
private String linkPhone;
private String checkFailReason;
private Integer type;
private Long createTime;
private Integer salesType;
@ApiModelProperty(value = "1.是,自动生成Token 2.是,使用外部既有Token")
@TableField(exist = false)
......
......@@ -21,7 +21,8 @@ public enum SpuStatusEnum {
WAIT_CHECK(5),//待审核
CHECK_FAIL(6),//审核未通过
CHECK_PASS(7),//审核通过
CANCEL(8);//取消发布
CANCEL(8),//取消发布
DRAFT(9);//草稿
private Integer status;
......
package com.fzm.mall.server.admin.goods_center.enums.type;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author wangp
* @date 2021/3/12 13:49
* @description 商品类别
* @since JDK 1.8
*/
public enum NFTSalesTypeEnum {
ORIGIN(1),//原商品销售
COPY(2);//拷贝销售
private Integer type;
NFTSalesTypeEnum(Integer type) {
this.type = type;
}
public Integer getType() {
return type;
}
public static List<Integer> getValueList() {
return Arrays.stream(NFTSalesTypeEnum.values())
.map(NFTSalesTypeEnum::getType)
.collect(Collectors.toList());
}
}
package com.fzm.mall.server.admin.goods_center.enums.type;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author wangp
* @date 2021/3/12 13:49
* @description 商品类别
* @since JDK 1.8
*/
public enum SalesTypeEnum {
ORDINARY(1),//普通
BLIND_BOX(4);//盲盒
private Integer type;
SalesTypeEnum(Integer type) {
this.type = type;
}
public Integer getType() {
return type;
}
public static List<Integer> getValueList() {
return Arrays.stream(SalesTypeEnum.values())
.map(SalesTypeEnum::getType)
.collect(Collectors.toList());
}
}
......@@ -101,4 +101,12 @@ public class Sku implements Serializable {
@ApiModelProperty(value = "nft销售方式(1.原商品销售 2.拷贝销售)")
@TableField("nft_sales_type")
private Integer nftSalesType;
@ApiModelProperty(value = "是否隐藏款(0.否 1.是)")
@TableField("is_hide")
private Integer isHide;
@ApiModelProperty(value = "token_id")
@TableField("token_id")
private Long tokenId;
}
......@@ -173,5 +173,12 @@ public class Spu implements Serializable {
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
private Long updateTime;
@ApiModelProperty(value = "盲盒商品难度(1-10)")
private Integer difficulty;
@ApiModelProperty(value = "盲盒价格")
private BigDecimal blindBoxPrice;
@ApiModelProperty(value = "盲盒规则")
private String blindBoxRule;
}
......@@ -44,4 +44,11 @@ public interface ICategorySpuService extends IService<CategorySpu> {
*/
String getByGoodsIdForId(String goodsId);
/**
* 新增商品类目
*
* @param goodsId 商品id
*/
void removeByGoodsId(String goodsId);
}
......@@ -35,4 +35,11 @@ public interface ICountService extends IService<Count> {
* @return
*/
List<SalesTopTenVO> salesTopTen(String merchantId);
/**
* 初始化商品销量
*
* @param goodsId
*/
void removeByGoodsId(String goodsId);
}
......@@ -34,4 +34,6 @@ public interface IExternalTokenService extends IService<ExternalToken> {
ExternalToken queryByLabelNameAndMerchantId(String coin, String merchantId);
List<ExternNFTVO> queryByMerchantId(String merchantId);
ExternalToken queryByComId(String comId);
}
......@@ -26,6 +26,14 @@ public interface IGoodsNftService extends IService<GoodsNft> {
void add(NFTDTO nftdto, String goodsId, String name, String nftAddr, String merchantId, long timestamp);
/**
* 草稿NFT商品
*
* @param nftdto NFT信息
* @param goodsId 商品id
*/
void draft(NFTDTO nftdto, String goodsId);
/**
* 根据商品id查询商品信息
*
* @param goodsId 商品id
......@@ -59,4 +67,11 @@ public interface IGoodsNftService extends IService<GoodsNft> {
* 编辑NFT商品
*/
GoodsNft queryByTokenId(String tokenId);
/**
* 根据goodsId清除商品
*
* @param goodsId 商品ID
*/
void removeByGoodsId(String goodsId);
}
......@@ -30,4 +30,10 @@ public interface ISkuPropService extends IService<SkuProp> {
*/
List<SkuPropertyVO> getBySkuId(String skuId);
/**
* 删除规格属性
*
* @param skuId 规格id
*/
void removeBySkuId(String skuId);
}
......@@ -27,7 +27,15 @@ public interface ISkuService extends IService<Sku> {
* @param merchantId 商户id
* @param commodityPass 商品通证
*/
void add(List<GoodsSkuDTO> kDTOs, String goodsId, String goodsName, String merchantId, Integer commodityPass, Integer pDTOType);
void add(List<GoodsSkuDTO> kDTOs, String goodsId, String goodsName, String merchantId, String addr, Integer commodityPass, String thumb, Integer pDTOType, Integer salesType);
/**
* 新增商品规格
*
* @param kDTOs 商品规格信息
* @param goodsId 商品id
*/
void draft(List<GoodsSkuDTO> kDTOs, String goodsId);
/**
* 编辑商品规格
......@@ -110,4 +118,6 @@ public interface ISkuService extends IService<Sku> {
Sku getByCoin(String coin);
void removeByGoodsId(String goodsId);
}
package com.fzm.mall.server.admin.goods_center.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fzm.mall.server.admin.goods_center.entity.dto.GoodsCheckDTO;
import com.fzm.mall.server.admin.goods_center.entity.dto.GoodsEditDTO;
import com.fzm.mall.server.admin.goods_center.entity.dto.GoodsRepublishUpdateDTO;
import com.fzm.mall.server.admin.goods_center.entity.dto.GoodsSpuDTO;
import com.fzm.mall.server.admin.goods_center.entity.dto.*;
import com.fzm.mall.server.admin.goods_center.entity.vo.GoodsListVO;
import com.fzm.mall.server.admin.goods_center.entity.vo.GoodsSpuDetailVO;
import com.fzm.mall.server.admin.goods_center.entity.vo.GoodsSpuVO;
......@@ -28,7 +25,16 @@ public interface ISpuService extends IService<Spu> {
* @param merchantId 商户id
* @param templateId 快递模板
*/
void add(GoodsSpuDTO pDTO, String merchantId, String templateId);
void add(GoodsSpuDTO pDTO, String merchantId, String templateId, String addr);
/**
* 草稿商品
*
* @param pDTO 商品信息
* @param merchantId 商户id
*/
void draft(GoodsSpuDraftDTO pDTO, String merchantId);
/**
* 编辑商品
......@@ -59,7 +65,7 @@ public interface ISpuService extends IService<Spu> {
* @param goodsId 商品id
* @param status 商品状态
*/
void updateStatus(String goodsId, Integer status,String errMsg);
void updateStatus(String goodsId, Integer status, String errMsg);
/**
* 分页查询商品
......
......@@ -12,6 +12,7 @@ import com.fzm.mall.server.admin.goods_center.service.ICategoryService;
import com.fzm.mall.server.admin.goods_center.service.ICategorySpuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -74,7 +75,7 @@ public class CategorySpuServiceImpl extends ServiceImpl<CategorySpuMapper, Categ
.append(categoryService.getById(v.getCategoryId()).getName())
.append(">"));
return categoryString.substring(0, categoryString.lastIndexOf(">"));
return StringUtils.isBlank(categoryString) ? "" : categoryString.substring(0, categoryString.lastIndexOf(">"));
}
@Override
......@@ -95,4 +96,11 @@ public class CategorySpuServiceImpl extends ServiceImpl<CategorySpuMapper, Categ
return jsonArray.toJSONString();
}
@Override
public void removeByGoodsId(String goodsId) {
LambdaQueryWrapper<CategorySpu> qw = new LambdaQueryWrapper<>();
qw.eq(CategorySpu::getGoodsId, goodsId);
remove(qw);
}
}
package com.fzm.mall.server.admin.goods_center.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
......@@ -74,4 +75,10 @@ public class CountServiceImpl extends ServiceImpl<CountMapper, Count> implements
return salesTopTenVOS;
}
@Override
public void removeByGoodsId(String goodsId) {
LambdaQueryWrapper<Count> qw = new LambdaQueryWrapper<>();
qw.eq(Count::getGoodsId, goodsId);
remove(qw);
}
}
......@@ -158,5 +158,12 @@ public class ExternalTokenServiceImpl extends ServiceImpl<ExternalTokenMapper, E
return list(qw).stream().map(v -> beanMapper.map(v, ExternNFTVO.class))
.collect(Collectors.toList());
}
@Override
public ExternalToken queryByComId(String comId) {
LambdaQueryWrapper<ExternalToken> qw = new LambdaQueryWrapper<>();
qw.eq(ExternalToken::getCommodityPassId, comId);
return getOne(qw);
}
}
......@@ -95,9 +95,18 @@ public class GoodsNftServiceImpl extends ServiceImpl<GoodsNftMapper, GoodsNft> i
}
@Override
public void draft(NFTDTO nftdto, String goodsId) {
GoodsNft nft = beanMapper.map(nftdto, GoodsNft.class);
nft.setGoodsId(goodsId);
save(nft);
}
@Override
public GoodsNftVO getByGoodsId(String goodsId) {
LambdaQueryWrapper<GoodsNft> qw = new LambdaQueryWrapper<>();
qw.eq(GoodsNft::getGoodsId, goodsId);
if (getOne(qw) == null)
return null;
return beanMapper.map(getOne(qw), GoodsNftVO.class);
}
......@@ -144,4 +153,11 @@ public class GoodsNftServiceImpl extends ServiceImpl<GoodsNftMapper, GoodsNft> i
qw.lambda().eq(GoodsNft::getTokenId, tokenId);
return getOne(qw);
}
@Override
public void removeByGoodsId(String goodsId) {
LambdaQueryWrapper<GoodsNft> qw = new LambdaQueryWrapper<>();
qw.eq(GoodsNft::getGoodsId, goodsId);
remove(qw);
}
}
package com.fzm.mall.server.admin.goods_center.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzm.mall.server.admin.constant.MallResponseError;
......@@ -57,5 +58,10 @@ public class SkuPropServiceImpl extends ServiceImpl<SkuPropMapper, SkuProp> impl
return propertyVOList;
}
@Override
public void removeBySkuId(String skuId) {
LambdaQueryWrapper<SkuProp> qw = new LambdaQueryWrapper<>();
qw.eq(SkuProp::getSkuId, skuId);
remove(qw);
}
}
package com.fzm.mall.server.admin.mq.consumer.goods_center;
import cn.fzm.chain.simplesdk.constant.TxStatusEnum;
import cn.fzm.chain.simplesdk.model.TxResult;
import com.fzm.mall.server.admin.block_chain.enums.ChainStatusEnum;
import com.fzm.mall.server.admin.block_chain.util.ChainUtil;
import com.fzm.mall.server.admin.chain.FzmChain;
import com.fzm.mall.server.admin.goods_center.enums.status.SkuStatusEnum;
import com.fzm.mall.server.admin.goods_center.enums.status.SpuStatusEnum;
import com.fzm.mall.server.admin.goods_center.model.Sku;
import com.fzm.mall.server.admin.goods_center.service.ISkuService;
import com.fzm.mall.server.admin.goods_center.service.ISpuService;
import lombok.RequiredArgsConstructor;
......@@ -26,12 +31,39 @@ public class CoinsConsumer {
private final ISpuService spuService;
private final FzmChain fzmChain;
private final ChainUtil chainUtil;
private final ISkuService skuService;
//发行
@RabbitListener(queues = "ly.issue.coins.queue")
public void issueCoinsPrice(Map<String, Object> obj) {
try {
String hash = (String) obj.get("hash");
int stock = Integer.parseInt(obj.get("stock") + "");
String goodsId = (String) obj.get("goodsId");
String skuId = (String) obj.get("skuId");
int subCount = (int) obj.get("subCount");
int total = (int) obj.get("total");
//异步确认
TxResult tr = chainUtil.cycleConfirmTxWithHash(hash);
log.info("issue.coins.queue发行=========================" + tr.getStatus());
if (tr.getStatus() != TxStatusEnum.SUCCESS) {
log.error("NFT发行失败,交易HASH:{},失败原因:{},交易参数:{}", hash, tr.getErrMsg(), obj);
spuService.updateStatus(goodsId, SpuStatusEnum.DRAFT.getStatus(), tr.getErrMsg().getValue());
skuService.updateStatus(skuId, SkuStatusEnum.ISSUE_FAIL.getStatus(), tr.getErrMsg().getValue());
} else {
log.info("NFT发行成功");
Integer status = spuService.getByGoodsId(goodsId).getStatus();
if (subCount == total && !status.equals(SpuStatusEnum.DRAFT.getStatus())) {
spuService.updateStatus(goodsId, SpuStatusEnum.WAIT_CHECK.getStatus(), "");
}
skuService.updateCirculation(skuId, stock);
}
} catch (Exception e) {
log.info("issue.coins.queue异常=========================" + e.getMessage());
}
/*try {
String coinName = obj.get("coinName") + "";
int stock = (int) ((long) obj.get("stock"));
String tokenAddr = obj.get("tokenAddr") + "";
......@@ -63,12 +95,30 @@ public class CoinsConsumer {
} catch (Exception e) {
return;
}
}*/
}
@RabbitListener(queues = "ly.change.coins.queue")
public void changeCoinsPrice(Map<String, Object> obj) {
try {
String hash = obj.get("hash") + "";
String skuId = obj.get("skuId") + "";
int cir = Integer.parseInt(obj.get("cir") + "");
//异步确认
TxResult tr = chainUtil.cycleConfirmTxWithHash(hash);
log.info("change.coins.queue发行=========================" + tr.getStatus());
if (tr.getStatus() != TxStatusEnum.SUCCESS) {
log.error("NFT增发失败,交易HASH:{},失败原因:{}", hash, tr.getErrMsg());
Sku sku = skuService.getBySkuId(skuId);
skuService.updateStatus(skuId, SkuStatusEnum.ISSUE_FAIL.getStatus(), tr.getErrMsg().getValue());
} else {
skuService.updateCirculation(skuId, cir);
}
} catch (Exception e) {
return;
}
/*try {
String coinName = obj.get("coinName") + "";
int change = (int) obj.get("change");
String issueAddr = obj.get("issueAddr") + "";
......@@ -95,6 +145,6 @@ public class CoinsConsumer {
}
} catch (Exception e) {
return;
}
}*/
}
}
......@@ -52,7 +52,7 @@ chain:
token-manager: 1N2ABERwHgxGhebVw6fVSwaQ5uLAysmGEu
token-manager-key: 0x4e92bda2477ded0e7c07a9e3acd2370de8d7401c68cc83ee8376806db3121e77
para:
rpc-url: http://146.56.197.42:12021
rpc-url: http://139.9.231.117:12021
withhold: 1417K9fd5vt4zYW86xinWiCbAkNP794aNy
withhold-key: 19d78691584930407e63cd35ac6e67fae6113894b41812e65847d4a365a802a0
token-manager: 1KEBcdmMPfUV2suAqgkyDpdm4brZbYmdfF
......
......@@ -22,6 +22,8 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="nft_sales_type" property="nftSalesType"/>
<result column="is_hide" property="isHide"/>
<result column="token_id" property="tokenId"/>
</resultMap>
</mapper>
......@@ -29,6 +29,10 @@
<result column="sales_type" property="salesType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="sales_type" property="salesType"/>
<result column="difficulty" property="difficulty"/>
<result column="blind_box_price" property="blindBoxPrice"/>
<result column="blind_box_rule" property="blindBoxRule"/>
</resultMap>
<select id="page" resultType="com.fzm.mall.server.admin.goods_center.entity.vo.GoodsSpuVO">
......
......@@ -2517,12 +2517,39 @@ CREATE TABLE `goods_sku_usufruct` (
ALTER TABLE `order_detail`
ADD COLUMN `serial_no` JSON NULL DEFAULT NULL COMMENT '序列号' ;
ALTER TABLE `user_asset`
ADD COLUMN `goods_coin` VARCHAR(32) NOT NULL DEFAULT '0' COMMENT '商品coin' ;
update user_asset set goods_coin = coin;
ALTER TABLE `user_asset_record` ADD COLUMN `goods_coin` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品coin';
ALTER TABLE `merchant_integral`
ADD COLUMN `price` decimal(20,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '行情 1积分=n人民币';
\ No newline at end of file
ADD COLUMN `price` decimal(20,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '行情 1积分=n人民币';
--2022-2-22
ALTER TABLE `goods_spu`
ADD COLUMN `sales_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '(销售方式)1.普通 2.盲盒';
ALTER TABLE `goods_sku`
ADD COLUMN `is_hide` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否隐藏款(0.否 1.是)';
ALTER TABLE `goods_spu`
ADD COLUMN `difficulty` tinyint(2) unsigned NOT NULL DEFAULT '1' COMMENT '盲盒商品难度(1-10)';
ALTER TABLE `goods_spu`
ADD COLUMN `blind_box_price` decimal(10,2) unsigned NOT NULL DEFAULT 0 COMMENT '盲盒价格';
ALTER TABLE `goods_sku`
ADD COLUMN `token_id` bigint(32) DEFAULT '0' COMMENT 'token_id';
ALTER TABLE `goods_spu`
ADD COLUMN `blind_box_rule` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '盲盒规则';
ALTER TABLE `goods_spu`
ADD COLUMN `preheat_start_time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '预热开始时间';
ALTER TABLE `goods_spu`
ADD COLUMN `preheat_end_time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '预热结束时间';
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