记得上下班打卡 | git大法好,push需谨慎

Commit a422fbc9 authored by 胡佳晨's avatar 胡佳晨

Merge branch 'master' into hjc_nft_details

parents 4a50e4f5 e016ec77
...@@ -189,10 +189,16 @@ public class GoblinRedisConst { ...@@ -189,10 +189,16 @@ public class GoblinRedisConst {
/** /**
* 我的藏品ID列表(首页) * 我的藏品ID列表(首页)
* {goblin:u_d_art:${uid}, List<String:artwork_id>} * {goblin:u_d_art_ids:${uid}, List<String:artwork_id>}
*/ */
public static final String USER_DIGITAL_ARTWORK_IDS = PREFIX.concat("u_d_art_ids:"); public static final String USER_DIGITAL_ARTWORK_IDS = PREFIX.concat("u_d_art_ids:");
/**
* 我的受赠藏品ID列表
* {goblin:u_d_art_ids_tsf:${uid}, List<String:artwork_id>}
*/
public static final String USER_DIGITAL_ARTWORK_IDS_TRANSFER = PREFIX.concat("u_d_art_ids_tsf:");
/** /**
* 我的藏品信息 * 我的藏品信息
* {goblin:u_d_art:${artwork_id}, com.liquidnet.service.goblin.dto.vo.GoblinUserDigitalArtworkVo} * {goblin:u_d_art:${artwork_id}, com.liquidnet.service.goblin.dto.vo.GoblinUserDigitalArtworkVo}
...@@ -205,12 +211,6 @@ public class GoblinRedisConst { ...@@ -205,12 +211,6 @@ public class GoblinRedisConst {
*/ */
public static final String USER_DIGITAL_ARTWORK_CT = PREFIX.concat("u_d_art_ct:"); public static final String USER_DIGITAL_ARTWORK_CT = PREFIX.concat("u_d_art_ct:");
/**
* 藏品盲盒开启标记
* {goblin:u_d_art_ub:${artworkId}, Number}
*/
public static final String USER_DIGITAL_ARTWORK_UNBOX = PREFIX.concat("u_d_art_ub:");
/** /**
* 我的藏品生成标记(有时效) * 我的藏品生成标记(有时效)
* {goblin:u_d_art:${uid+skuId+orderId},1} * {goblin:u_d_art:${uid+skuId+orderId},1}
...@@ -362,11 +362,35 @@ public class GoblinRedisConst { ...@@ -362,11 +362,35 @@ public class GoblinRedisConst {
public static final String USER_SAFE_CONFIG = PREFIX.concat("u_safe_c:"); public static final String USER_SAFE_CONFIG = PREFIX.concat("u_safe_c:");
/** /**
* NFT转赠约束配置 * NFT用户安全密码临时锁定时间段配置(单位:分钟,默认30分钟)
* {goblin:nft_trans_conf, "${timeLimit},${routeType:1},${routeType:2}..."} * {goblin:u_safe_lk:passwdtl:timelimit, seconds}
*/
public static final String USER_SAFE_LK_PASSWDTL_TIMELIMIT = PREFIX.concat("u_safe_lk:passwdtl:timelimit");
/**
* NFT用户安全密码临时锁定KEY
* {goblin:u_safe_lk:passwdtl:${uid}, number++}
*/
public static final String USER_SAFE_LK_PASSWDTL = PREFIX.concat("u_safe_lk:passwdtl:");
/**
* NFT用户安全密码锁定KEY
* {goblin:u_safe_lk:passwd:${uid}, number++}
*/
public static final String USER_SAFE_LK_PASSWD = PREFIX.concat("u_safe_lk:passwd:");
/**
* NFT转赠约束配置(首次转赠)
* {goblin:nft_trans_conf, "${routeType:timeLimit0},${routeType:timeLimit1},${routeType:timeLimit2}..."}
*/ */
public static final String NFT_TRANSFER_CONF = PREFIX.concat("nft_trans_conf"); public static final String NFT_TRANSFER_CONF = PREFIX.concat("nft_trans_conf");
/**
* NFT转赠约束配置(二次转赠)
* {goblin:nft_trans_conf_again, "${routeType:timeLimit0},${routeType:timeLimit1},${routeType:timeLimit2}..."}
*/
public static final String NFT_TRANSFER_CONF_AGAIN = PREFIX.concat("nft_trans_conf_again");
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
/* ----------------------------------------------------------------- */ /* ----------------------------------------------------------------- */
......
...@@ -221,10 +221,20 @@ public class GoblinStatusConst { ...@@ -221,10 +221,20 @@ public class GoblinStatusConst {
} }
/** /**
* 数字藏品:转赠状态[PENDING|SUCCESS] * 数字藏品:转赠状态[WAITING|PENDING|SUCCESS]
*/ */
public enum TransferState { public enum TransferState {
/**
* 等待受赠人接收/拒绝
*/
WAITING,
/**
* 受赠人接收后上链交易中
*/
PENDING, PENDING,
/**
* 受赠人接收且上链交易成功
*/
SUCCESS, SUCCESS,
; ;
} }
......
...@@ -62,17 +62,22 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable { ...@@ -62,17 +62,22 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable {
@ApiModelProperty(position = 28, value = "转赠状态[PENDING|SUCCESS]") @ApiModelProperty(position = 28, value = "转赠状态[PENDING|SUCCESS]")
private String transferState; private String transferState;
@ApiModelProperty(position = 25, value = "转赠允许时间") @ApiModelProperty(position = 25, value = "转赠允许时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime transferAllowTime; private LocalDateTime transferAllowTime;
@ApiModelProperty(position = 30, value = "系统当前时间") @ApiModelProperty(position = 30, value = "系统当前时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime systime; private LocalDateTime systime;
@ApiModelProperty(position = 31, value = "受赠人信息") @ApiModelProperty(position = 31, value = "受赠人信息,发生转赠时有效")
private String receiverUser; private String receiverUser;
@ApiModelProperty(position = 32, value = "藏品转赠时间[yyyy-MM-dd HH:mm:ss]") @ApiModelProperty(position = 32, value = "藏品转赠时间[yyyy-MM-dd HH:mm:ss],发生转赠时有效")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime transferTime; private LocalDateTime transferTime;
@ApiModelProperty(position = 33, value = "转赠过期时间[yyyy-MM-dd HH:mm:ss],发生转赠时有效")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime transferExpireTime;
@ApiModelProperty(position = 34, value = "转赠人UID,发生转赠且受赠人查取详情时有效")
private String transferUid;
private static final GoblinUserDigitalArtworkInfoVo obj = new GoblinUserDigitalArtworkInfoVo(); private static final GoblinUserDigitalArtworkInfoVo obj = new GoblinUserDigitalArtworkInfoVo();
......
...@@ -47,7 +47,7 @@ public class GoblinUserDigitalArtworkListVo implements Serializable, Cloneable { ...@@ -47,7 +47,7 @@ public class GoblinUserDigitalArtworkListVo implements Serializable, Cloneable {
private String author; private String author;
@ApiModelProperty(position = 23, value = "区块链路由[zxinchain-至信链|xuper-百度超级链]") @ApiModelProperty(position = 23, value = "区块链路由[zxinchain-至信链|xuper-百度超级链]")
private String routeType; private String routeType;
@ApiModelProperty(position = 24, value = "转赠状态[PENDING|SUCCESS]") @ApiModelProperty(position = 24, value = "转赠状态[WAITING|PENDING|SUCCESS]")
private String transferState; private String transferState;
@ApiModelProperty(position = 25, value = "转赠允许时间") @ApiModelProperty(position = 25, value = "转赠允许时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
......
...@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModel; ...@@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@ApiModel(value = "GoblinUserDigitalArtworkPageVo", description = "我的藏品信息") @ApiModel(value = "GoblinUserDigitalArtworkPageVo", description = "我的藏品信息")
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
...@@ -16,6 +17,8 @@ public class GoblinUserDigitalArtworkPageVo implements Cloneable { ...@@ -16,6 +17,8 @@ public class GoblinUserDigitalArtworkPageVo implements Cloneable {
private int artworkNum; private int artworkNum;
@ApiModelProperty(position = 12, value = "藏品列表分页数据") @ApiModelProperty(position = 12, value = "藏品列表分页数据")
private PagedResult<GoblinUserDigitalArtworkListVo> pagedResult; private PagedResult<GoblinUserDigitalArtworkListVo> pagedResult;
@ApiModelProperty(position = 12, value = "受赠藏品列表数据")
private List<GoblinUserDigitalArtworkTransferListVo> receivedList;
@ApiModelProperty(position = 13, value = "系统当前时间") @ApiModelProperty(position = 13, value = "系统当前时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
...@@ -29,6 +32,10 @@ public class GoblinUserDigitalArtworkPageVo implements Cloneable { ...@@ -29,6 +32,10 @@ public class GoblinUserDigitalArtworkPageVo implements Cloneable {
return pagedResult; return pagedResult;
} }
public List<GoblinUserDigitalArtworkTransferListVo> getReceivedList() {
return receivedList;
}
public LocalDateTime getSystime() { public LocalDateTime getSystime() {
return systime; return systime;
} }
...@@ -43,6 +50,11 @@ public class GoblinUserDigitalArtworkPageVo implements Cloneable { ...@@ -43,6 +50,11 @@ public class GoblinUserDigitalArtworkPageVo implements Cloneable {
return this; return this;
} }
public GoblinUserDigitalArtworkPageVo setReceivedList(List<GoblinUserDigitalArtworkTransferListVo> receivedList) {
this.receivedList = receivedList;
return this;
}
public GoblinUserDigitalArtworkPageVo setSystime(LocalDateTime systime) { public GoblinUserDigitalArtworkPageVo setSystime(LocalDateTime systime) {
this.systime = systime; this.systime = systime;
return this; return this;
......
package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@ApiModel(value = "GoblinUserDigitalArtworkTransferListVo", description = "受赠藏品列表信息")
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinUserDigitalArtworkTransferListVo implements Serializable, Cloneable {
private static final long serialVersionUID = 6387597921696370960L;
@ApiModelProperty(position = 11, value = "藏品Id")
private String artworkId;
@ApiModelProperty(position = 12, value = "藏品名称")
private String name;
@ApiModelProperty(position = 13, value = "藏品副名称")
private String subtitle;
@ApiModelProperty(position = 14, value = "藏品封面")
private String coverPic;
@ApiModelProperty(position = 15, value = "序列号")
private Integer editionSn;
@ApiModelProperty(position = 16, value = "藏品发行量")
private Integer edition;
@ApiModelProperty(position = 17, value = "获得方式[1-购买|2-兑换|3-赠送|5-大美|6-转赠|31-空投赠送]")
private Integer source;
@ApiModelProperty(position = 18, value = "藏品状态,根据`unbox`区分盲盒来判断[0-生成中/未开启|1-已生成/已开启|2-生成失败/开启失败|5-待收取]")
private Integer state;
@ApiModelProperty(position = 19, value = "藏品创建时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime createdAt;
@ApiModelProperty(position = 20, value = "是否盲盒[0-否|1-是]")
private String unbox;
@ApiModelProperty(position = 21, value = "盲盒开启时间")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime openingTime;
@ApiModelProperty(position = 22, value = "创作者")
private String author;
@ApiModelProperty(position = 23, value = "区块链路由[zxinchain-至信链|xuper-百度超级链]")
private String routeType;
@ApiModelProperty(position = 24, value = "转赠状态[WAITING|PENDING|SUCCESS]")
private String transferState;
@ApiModelProperty(position = 25, value = "转赠过期时间[yyyy-MM-dd HH:mm:ss],发生转赠时有效")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime transferExpireTime;
private static final GoblinUserDigitalArtworkTransferListVo obj = new GoblinUserDigitalArtworkTransferListVo();
public static GoblinUserDigitalArtworkTransferListVo getNew() {
return obj.clone();
}
@Override
public GoblinUserDigitalArtworkTransferListVo clone() {
try {
return (GoblinUserDigitalArtworkTransferListVo) super.clone();
} catch (CloneNotSupportedException e) {
return new GoblinUserDigitalArtworkTransferListVo();
}
}
public GoblinUserDigitalArtworkTransferListVo copy(GoblinUserDigitalArtworkVo source) {
if (null == source) return this;
this.setArtworkId(source.getArtworkId());
// this.setName();
// this.setSubtitle();
// this.setCoverPic();
// this.setEdition();
this.setEditionSn(source.getEditionSn());
this.setSource(source.getSource());
this.setState(source.getState());
this.setCreatedAt(source.getCreatedAt());
// this.setUnbox();
// this.setOpeningTime();
this.setAuthor(source.getAuthor());
this.setTransferState(source.getTransferState());
return this;
}
}
...@@ -22,6 +22,7 @@ public class GoblinUserDigitalArtworkVo implements Serializable, Cloneable { ...@@ -22,6 +22,7 @@ public class GoblinUserDigitalArtworkVo implements Serializable, Cloneable {
private String tradingAt; private String tradingAt;
private String receiverUid; private String receiverUid;
private String transferOrderId; private String transferOrderId;
private LocalDateTime transferAt;
private String transferState; private String transferState;
private Integer source; private Integer source;
private Integer state; private Integer state;
......
...@@ -2,10 +2,20 @@ package com.liquidnet.service.goblin.service; ...@@ -2,10 +2,20 @@ package com.liquidnet.service.goblin.service;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import java.util.List;
public interface IGoblinUserDigitalArtworkService { public interface IGoblinUserDigitalArtworkService {
GoblinUserDigitalArtworkPageVo page(String uid, Integer pageNum, Integer pageSize); GoblinUserDigitalArtworkPageVo page(String uid, Integer pageNum, Integer pageSize);
/**
* 获取受赠藏品列表
*
* @param uid UID String
* @return List<GoblinUserDigitalArtworkTransferListVo>
*/
List<GoblinUserDigitalArtworkTransferListVo> getArtworkListFromTransfer(String uid);
GoblinUserDigitalArtworkInfoVo info(String uid, String artworkId); GoblinUserDigitalArtworkInfoVo info(String uid, String artworkId);
GoblinUserDigitalArtworkListVo unboxingForBuyOrExchange(String uid, GoblinUserDigitalArtworkVo userDigitalArtworkVo); GoblinUserDigitalArtworkListVo unboxingForBuyOrExchange(String uid, GoblinUserDigitalArtworkVo userDigitalArtworkVo);
...@@ -13,4 +23,20 @@ public interface IGoblinUserDigitalArtworkService { ...@@ -13,4 +23,20 @@ public interface IGoblinUserDigitalArtworkService {
boolean accept(String uid, GoblinUserDigitalArtworkVo userDigitalArtworkVo); boolean accept(String uid, GoblinUserDigitalArtworkVo userDigitalArtworkVo);
boolean transfer(GoblinUserDigitalArtworkVo userDigitalArtworkVo, String routerType, String[] receiverArr); boolean transfer(GoblinUserDigitalArtworkVo userDigitalArtworkVo, String routerType, String[] receiverArr);
/**
* 藏品受赠确认领取
*
* @param artworkId 藏品ID
* @return boolean, true-成功
*/
boolean transferConfirmReceive(String artworkId);
/**
* 藏品受赠确认退还
*
* @param artworkId 藏品ID
* @return boolean, true-成功
*/
boolean transferConfirmReturn(String artworkId);
} }
package com.liquidnet.service.goblin.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 藏品转赠订单记录
* </p>
*
* @author liquidnet
* @since 2022-08-26
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinNftTransferOrder implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 转赠订单号
*/
private String orderId;
/**
* 藏品ID
*/
private String artworkId;
/**
* 拥有人UID
*/
private String ownerUid;
/**
* 受赠人UID
*/
private String receiverUid;
/**
* 订单状态[0-等待接收|1-确认接收|2-拒绝接收|3-过期关闭]
*/
private Integer state;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
private String comment;
}
package com.liquidnet.service.goblin.entity; package com.liquidnet.service.goblin.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.io.Serializable; import java.io.Serializable;
...@@ -80,8 +82,21 @@ public class GoblinUserDigitalArtwork implements Serializable { ...@@ -80,8 +82,21 @@ public class GoblinUserDigitalArtwork implements Serializable {
private String tradingAt; private String tradingAt;
/** /**
* 转赠状态[PENDING|SUCCESS] * 受赠人UID
*/ */
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String receiverUid;
/**
* 转赠订单号
*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String transferOrderId;
/**
* 转赠状态[WAITING|PENDING|SUCCESS]
*/
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String transferState; private String transferState;
/** /**
......
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.entity.GoblinNftTransferOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 藏品转赠订单记录 Mapper 接口
* </p>
*
* @author liquidnet
* @since 2022-08-26
*/
public interface GoblinNftTransferOrderMapper extends BaseMapper<GoblinNftTransferOrder> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinNftTransferOrderMapper">
</mapper>
...@@ -477,9 +477,24 @@ public class AdamUserController { ...@@ -477,9 +477,24 @@ public class AdamUserController {
public ResponseDto<AdamUserIdentityInfoVo> identityInfoByMobile(@Pattern(regexp = "\\d{11}", message = "手机号格式有误") public ResponseDto<AdamUserIdentityInfoVo> identityInfoByMobile(@Pattern(regexp = "\\d{11}", message = "手机号格式有误")
@RequestParam(required = false) String mobile) { @RequestParam(required = false) String mobile) {
String uid = null == mobile ? CurrentUtil.getCurrentUid() : adamRdmService.getUidByMobile(mobile); String uid = null == mobile ? CurrentUtil.getCurrentUid() : adamRdmService.getUidByMobile(mobile);
if (uid == null) {
log.warn("###用户不存在[mobile:{},uid:{},token:{}]", mobile, uid, CurrentUtil.getToken());
return ResponseDto.failure(ErrorMapping.get("10114"));
}
return this.identityInfoByUID(uid);
}
@ApiOperationSupport(order = 12)
@ApiOperation(value = "用户身份信息")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "id", value = "手机号"),
})
@GetMapping(value = "info/identity2")
public ResponseDto<AdamUserIdentityInfoVo> identityInfoByUID(@RequestParam(required = false) String id) {
String uid = StringUtils.isBlank(id) ? CurrentUtil.getCurrentUid() : id;
AdamUserInfoVo userInfoVo; AdamUserInfoVo userInfoVo;
if (uid == null || null == (userInfoVo = adamRdmService.getUserInfoVoByUid(uid))) { if (uid == null || null == (userInfoVo = adamRdmService.getUserInfoVoByUid(uid))) {
log.warn("###用户不存在[MOBILE:{},UID:{},TOKEN:{}]", mobile, uid, CurrentUtil.getToken()); log.warn("###用户不存在[id:{},uid:{},token:{}]", id, uid, CurrentUtil.getToken());
return ResponseDto.failure(ErrorMapping.get("10114")); return ResponseDto.failure(ErrorMapping.get("10114"));
} }
AdamRealInfoVo realInfoVoByUidPlain = adamRdmService.getRealInfoVoByUidPlain(uid); AdamRealInfoVo realInfoVoByUidPlain = adamRdmService.getRealInfoVoByUidPlain(uid);
...@@ -489,11 +504,11 @@ public class AdamUserController { ...@@ -489,11 +504,11 @@ public class AdamUserController {
AdamUserIdentityInfoVo userIdentityInfoVo = AdamUserIdentityInfoVo.getNew(); AdamUserIdentityInfoVo userIdentityInfoVo = AdamUserIdentityInfoVo.getNew();
userIdentityInfoVo.setUid(uid); userIdentityInfoVo.setUid(uid);
userIdentityInfoVo.setName(realInfoVoByUidPlain.getName()); userIdentityInfoVo.setName(realInfoVoByUidPlain.getName());
userIdentityInfoVo.setMobile(mobile); userIdentityInfoVo.setMobile(userInfoVo.getMobile());
return ResponseDto.success(userIdentityInfoVo.desensitize()); return ResponseDto.success(userIdentityInfoVo.desensitize());
} }
@ApiOperationSupport(order = 12) @ApiOperationSupport(order = 13)
@ApiOperation(value = "验证手机号") @ApiOperation(value = "验证手机号")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "mobile", value = "手机号[用于验证当前账户所绑定手机号]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "mobile", value = "手机号[用于验证当前账户所绑定手机号]"),
......
package com.liquidnet.service.executor.main.handler; package com.liquidnet.service.executor.main.handler;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DESUtils;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.service.feign.platform.task.FeignPlatformGoblinTaskClient; import com.liquidnet.service.feign.platform.task.FeignPlatformGoblinTaskClient;
import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob; import com.xxl.job.core.handler.annotation.XxlJob;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
/** /**
* platform:goblin * platform:goblin
*/ */
@Component @Component
public class PlatformGoblinTaskHandler { public class PlatformGoblinTaskHandler {
@Value("${liquidnet.service.platform.url}")
private String sevPlatformUrl;
@Autowired @Autowired
private FeignPlatformGoblinTaskClient feignPlatformGoblinTaskClient; private FeignPlatformGoblinTaskClient feignPlatformGoblinTaskClient;
...@@ -63,4 +72,23 @@ public class PlatformGoblinTaskHandler { ...@@ -63,4 +72,23 @@ public class PlatformGoblinTaskHandler {
} }
} }
@XxlJob(value = "sev-platform:goblinArtworkTransferExpireHandler")
public void goblinArtworkTransferExpireHandler() {// 商城:藏品转赠过期处理
try {
String url = sevPlatformUrl.concat("/platform/artwork/task/transfer_expire");
LinkedMultiValueMap<String, String> paramsMap = CollectionUtil.linkedMultiValueMapStringString();
String jobParam = XxlJobHelper.getJobParam();
if (StringUtils.isNotBlank(jobParam)) {
paramsMap.add("expiredSeconds", DESUtils.DES().encrypt(jobParam));
}
LinkedMultiValueMap<String, String> headersMap = CollectionUtil.linkedMultiValueMapStringString();
headersMap.add("Accept", MediaType.APPLICATION_JSON_UTF8_VALUE);
headersMap.add("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
XxlJobHelper.handleSuccess("结果:" + HttpUtil.post(url, paramsMap, headersMap));
} catch (Exception e) {
XxlJobHelper.log(e);
XxlJobHelper.handleFail();
}
}
} }
...@@ -1153,9 +1153,9 @@ create table goblin_user_digital_artwork ...@@ -1153,9 +1153,9 @@ create table goblin_user_digital_artwork
) engine = InnoDB comment '用户数字藏品信息'; ) engine = InnoDB comment '用户数字藏品信息';
# -- >>------------------------------------------------------------------------------------ |20220817数字藏品转赠安全密码 # -- >>------------------------------------------------------------------------------------ |20220817数字藏品转赠安全密码
alter table goblin_user_digital_artwork alter table goblin_user_digital_artwork
add receiver_uid varchar(20) null comment '受赠人UID' after trading_at; add receiver_uid varchar(64) null comment '受赠人UID' after trading_at;
alter table goblin_user_digital_artwork alter table goblin_user_digital_artwork
add transfer_order_id varchar(20) null comment '转赠订单号' after receiver_uid; add transfer_order_id varchar(64) null comment '转赠订单号' after receiver_uid;
alter table goblin_user_digital_artwork alter table goblin_user_digital_artwork
add transfer_state varchar(20) null comment '转赠状态[PENDING|SUCCESS]' after transfer_order_id; add transfer_state varchar(20) null comment '转赠状态[PENDING|SUCCESS]' after transfer_order_id;
alter table goblin_user_digital_artwork alter table goblin_user_digital_artwork
...@@ -1173,6 +1173,21 @@ create table goblin_user_safe_config ...@@ -1173,6 +1173,21 @@ create table goblin_user_safe_config
comment varchar(500) comment varchar(500)
) engine = InnoDB comment '用户安全设置'; ) engine = InnoDB comment '用户安全设置';
create unique index idx_gusc_uid on goblin_user_safe_config (uid); create unique index idx_gusc_uid on goblin_user_safe_config (uid);
# -- >>------------------------------------------------------------------------------------ |20220825数字藏品受赠接收
drop table if exists goblin_nft_transfer_order;
create table goblin_nft_transfer_order
(
mid bigint auto_increment primary key,
order_id varchar(64) not null comment '转赠订单号',
artwork_id varchar(64) not null comment '藏品ID',
owner_uid varchar(64) not null comment '拥有人UID',
receiver_uid varchar(64) not null comment '受赠人UID',
state tinyint default 0 comment '订单状态[0-等待接收|1-确认接收|2-拒绝接收|3-过期关闭]',
created_at datetime not null,
updated_at datetime null,
comment varchar(500)
) engine = InnoDB comment '藏品转赠订单记录';
create unique index uidx_gnto_order_id on goblin_nft_transfer_order (order_id);
# -- >>------------------------------------------------------------------------------------ # -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------ # -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------ # -- >>------------------------------------------------------------------------------------
......
...@@ -58,8 +58,8 @@ public class GoblinSmsController { ...@@ -58,8 +58,8 @@ public class GoblinSmsController {
return ResponseDto.failure(ErrorMapping.get("140000")); return ResponseDto.failure(ErrorMapping.get("140000"));
} }
} }
// if (LnsEnum.ENV.prod.name().equals(env.getProperty(CurrentUtil.CK_ENV_ACTIVE))) { if (LnsEnum.ENV.prod.name().equals(env.getProperty(CurrentUtil.CK_ENV_ACTIVE))) {
if (Arrays.asList(LnsEnum.ENV.prod.name(), LnsEnum.ENV.test.name()).contains(env.getProperty(CurrentUtil.CK_ENV_ACTIVE))) { // if (Arrays.asList(LnsEnum.ENV.prod.name(), LnsEnum.ENV.test.name()).contains(env.getProperty(CurrentUtil.CK_ENV_ACTIVE))) {
ObjectNode msgNode = JsonUtils.OM().createObjectNode(); ObjectNode msgNode = JsonUtils.OM().createObjectNode();
msgNode.put("code", smsCode); msgNode.put("code", smsCode);
boolean sendRst = smsProcessor.send(mobile, SmsEnum.ADSignName.M02.getVal(), SmsEnum.ADTemplate.SMS_221055862.name(), msgNode.toString()); boolean sendRst = smsProcessor.send(mobile, SmsEnum.ADSignName.M02.getVal(), SmsEnum.ADTemplate.SMS_221055862.name(), msgNode.toString());
......
...@@ -43,19 +43,20 @@ public class GoblinQueBizArtworkTransQueryService { ...@@ -43,19 +43,20 @@ public class GoblinQueBizArtworkTransQueryService {
log.warn("#藏品转赠结果查询:藏品不存在[artworkId={}]", artworkId); log.warn("#藏品转赠结果查询:藏品不存在[artworkId={}]", artworkId);
return ResponseDto.success(String.format("藏品不存在[artworkId:%s]", artworkId)); return ResponseDto.success(String.format("藏品不存在[artworkId:%s]", artworkId));
} }
String transferOrderId = userDigitalArtworkVo.getTransferOrderId(), receiverUid = userDigitalArtworkVo.getReceiverUid();
if (!GoblinStatusConst.TransferState.PENDING.name().equals(userDigitalArtworkVo.getTransferState())) { if (!GoblinStatusConst.TransferState.PENDING.name().equals(userDigitalArtworkVo.getTransferState())) {
log.warn("#藏品转赠结果查询:藏品非转赠中不处理[artworkId={},transferState={},transferOrderId={}]", artworkId, userDigitalArtworkVo.getTransferState(), userDigitalArtworkVo.getTransferOrderId()); log.warn("#藏品转赠结果查询:藏品非转赠中不处理[artworkId={},transferState={},transferOrderId={}]", artworkId, userDigitalArtworkVo.getTransferState(), transferOrderId);
return ResponseDto.success(String.format("藏品非转赠中不处理[artworkId:%s]", artworkId)); return ResponseDto.success(String.format("藏品非转赠中不处理[artworkId:%s]", artworkId));
} }
GoblinGoodsSkuInfoVo goodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(userDigitalArtworkVo.getSkuId()); GoblinGoodsSkuInfoVo goodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(userDigitalArtworkVo.getSkuId());
GalaxyNftTransferQueryRespDto queryRespDto = this.queryNftTransferQueryRespDto(userDigitalArtworkVo.getTransferOrderId(), goodsSkuInfoVo.getRouteType()); GalaxyNftTransferQueryRespDto queryRespDto = this.queryNftTransferQueryRespDto(transferOrderId, goodsSkuInfoVo.getRouteType());
if (null == queryRespDto || !"1".equals(queryRespDto.getTransferStatus())) {// 查询失败,重新入队处理 if (null == queryRespDto || !"1".equals(queryRespDto.getTransferStatus())) {// 查询失败,重新入队处理
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_TRANS_QUERY.getKey(), userDigitalArtworkVo.getArtworkId()); queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_TRANS_QUERY.getKey(), userDigitalArtworkVo.getArtworkId());
return ResponseDto.failure(String.format("藏品转赠结果查询失败[artworkId:%s]", artworkId)); return ResponseDto.failure(String.format("藏品转赠结果查询失败[artworkId:%s]", artworkId));
} }
if (!userDigitalArtworkVo.getReceiverUid().equals(queryRespDto.getOwnerUserId())) {// 拥有者与受赠人不一致(特殊情况,重新入队处理) if (!receiverUid.equals(queryRespDto.getOwnerUserId())) {// 拥有者与受赠人不一致(特殊情况,重新入队处理)
log.warn("#藏品转赠结果查询:拥有者与受赠人不一致[artworkId={},receiverUid={},ownerUserId={}]", userDigitalArtworkVo.getArtworkId(), userDigitalArtworkVo.getReceiverUid(), queryRespDto.getOwnerUserId()); log.warn("#藏品转赠结果查询:拥有者与受赠人不一致[artworkId={},receiverUid={},ownerUserId={}]", userDigitalArtworkVo.getArtworkId(), receiverUid, queryRespDto.getOwnerUserId());
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_TRANS_QUERY.getKey(), artworkId); queueUtils.sendMsgByRedis(MQConst.GoblinQueue.BIZ_ARTWORK_TRANS_QUERY.getKey(), artworkId);
return ResponseDto.failure(String.format("藏品转赠结果查询数据不一致[artworkId:%s]", artworkId)); return ResponseDto.failure(String.format("藏品转赠结果查询数据不一致[artworkId:%s]", artworkId));
} }
...@@ -69,8 +70,9 @@ public class GoblinQueBizArtworkTransQueryService { ...@@ -69,8 +70,9 @@ public class GoblinQueBizArtworkTransQueryService {
if (goblinMongoUtils.updateUserDigitalArtworkVoByTransQuery(userDigitalArtworkVo)) {// 转赠人藏品状态更新Mongo if (goblinMongoUtils.updateUserDigitalArtworkVoByTransQuery(userDigitalArtworkVo)) {// 转赠人藏品状态更新Mongo
if (6 == userDigitalArtworkVo.getSource()) {// 来源为转赠的藏品,设置过期时间到期删除 if (6 == userDigitalArtworkVo.getSource()) {// 来源为转赠的藏品,设置过期时间到期删除
goblinRedisUtils.setexUserDigitalArtworkVo(userDigitalArtworkVo, 30 * 60); goblinRedisUtils.setexUserDigitalArtworkVo(userDigitalArtworkVo, 30 * 60);
} else {
goblinRedisUtils.setUserDigitalArtworkVo(userDigitalArtworkVo);// 转赠人藏品状态更新Redis
} }
goblinRedisUtils.setUserDigitalArtworkVo(userDigitalArtworkVo);// 转赠人藏品状态更新Redis
goblinRedisUtils.addSubUserDigitalArtworkCount(userDigitalArtworkVo.getUid(), -1);// 转赠人藏品数量处理Redis goblinRedisUtils.addSubUserDigitalArtworkCount(userDigitalArtworkVo.getUid(), -1);// 转赠人藏品数量处理Redis
goblinRedisUtils.resetUserDigitalArtworkIdsByMongo(userDigitalArtworkVo.getUid());// 转赠人藏品ID集合缓存重置Redis goblinRedisUtils.resetUserDigitalArtworkIdsByMongo(userDigitalArtworkVo.getUid());// 转赠人藏品ID集合缓存重置Redis
} else { } else {
...@@ -83,9 +85,9 @@ public class GoblinQueBizArtworkTransQueryService { ...@@ -83,9 +85,9 @@ public class GoblinQueBizArtworkTransQueryService {
{// 受赠人藏品处理 {// 受赠人藏品处理
String transferTime = queryRespDto.getTransferTime(), transferHash = queryRespDto.getTransferHash(); String transferTime = queryRespDto.getTransferTime(), transferHash = queryRespDto.getTransferHash();
receiverDigitalArtworkVo.setArtworkId(IDGenerator.nextSnowId()); receiverDigitalArtworkVo.setArtworkId(IDGenerator.nextSnowId());
receiverDigitalArtworkVo.setUid(userDigitalArtworkVo.getReceiverUid()); receiverDigitalArtworkVo.setUid(receiverUid);
receiverDigitalArtworkVo.setSkuId(userDigitalArtworkVo.getSkuId()); receiverDigitalArtworkVo.setSkuId(userDigitalArtworkVo.getSkuId());
receiverDigitalArtworkVo.setOrderId(userDigitalArtworkVo.getTransferOrderId()); receiverDigitalArtworkVo.setOrderId(transferOrderId);
receiverDigitalArtworkVo.setEditionSn(userDigitalArtworkVo.getEditionSn()); receiverDigitalArtworkVo.setEditionSn(userDigitalArtworkVo.getEditionSn());
receiverDigitalArtworkVo.setNftId(userDigitalArtworkVo.getNftId()); receiverDigitalArtworkVo.setNftId(userDigitalArtworkVo.getNftId());
//receiverDigitalArtworkVo.setReleaseTxhash(); //receiverDigitalArtworkVo.setReleaseTxhash();
...@@ -104,18 +106,21 @@ public class GoblinQueBizArtworkTransQueryService { ...@@ -104,18 +106,21 @@ public class GoblinQueBizArtworkTransQueryService {
receiverDigitalArtworkVo.setAuthor(userDigitalArtworkVo.getAuthor()); receiverDigitalArtworkVo.setAuthor(userDigitalArtworkVo.getAuthor());
receiverDigitalArtworkVo.setPublisher(userDigitalArtworkVo.getPublisher()); receiverDigitalArtworkVo.setPublisher(userDigitalArtworkVo.getPublisher());
goblinMongoUtils.insertUserDigitalArtworkVo(receiverDigitalArtworkVo);// 受赠人藏品记录Mongo
goblinRedisUtils.setUserDigitalArtworkVo(receiverDigitalArtworkVo);// 受赠人藏品记录Redis goblinRedisUtils.setUserDigitalArtworkVo(receiverDigitalArtworkVo);// 受赠人藏品记录Redis
goblinRedisUtils.addUserDigitalArtworkIds(receiverDigitalArtworkVo.getUid(), receiverDigitalArtworkVo.getArtworkId());// 受赠人藏品ID列表记录Redis
goblinRedisUtils.addSubUserDigitalArtworkCount(receiverDigitalArtworkVo.getUid(), 1);// 受赠人藏品数量记录Redis goblinRedisUtils.addSubUserDigitalArtworkCount(receiverDigitalArtworkVo.getUid(), 1);// 受赠人藏品数量记录Redis
goblinRedisUtils.addUserDigitalArtworkIds(receiverDigitalArtworkVo.getUid(), receiverDigitalArtworkVo.getArtworkId());// 受赠人藏品ID列表记录Redis
goblinMongoUtils.insertUserDigitalArtworkVo(receiverDigitalArtworkVo);// 受赠人藏品记录Mongo
// 受赠人受赠藏品列表缓存更新
goblinRedisUtils.rmvUserDigitalArtworkIdsTransfer(userDigitalArtworkVo.getReceiverUid(), userDigitalArtworkVo.getArtworkId());
} }
{// Mysql持久化 {// Mysql持久化
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_user_digital_artwork.update_for_trans_query")); toMqSqls.add(SqlMapping.get("goblin_user_digital_artwork.up_transfer_chain"));
LinkedList<Object[]> updateUserDigitalArtworkObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> updateUserDigitalArtworkObjs = CollectionUtil.linkedListObjectArr();
updateUserDigitalArtworkObjs.add(new Object[]{userDigitalArtworkVo.getTransferState(), userDigitalArtworkVo.getDeletedAt(), userDigitalArtworkVo.getArtworkId()}); updateUserDigitalArtworkObjs.add(new Object[]{userDigitalArtworkVo.getTransferState(), userDigitalArtworkVo.getDeletedAt(), userDigitalArtworkVo.getArtworkId()});
toMqSqls.add(SqlMapping.get("goblin_user_digital_artwork.insert_for_transfer")); toMqSqls.add(SqlMapping.get("goblin_user_digital_artwork.in_transfer"));
LinkedList<Object[]> initUserDigitalArtworkObjs = CollectionUtil.linkedListObjectArr(); LinkedList<Object[]> initUserDigitalArtworkObjs = CollectionUtil.linkedListObjectArr();
initUserDigitalArtworkObjs.add(new Object[]{receiverDigitalArtworkVo.getArtworkId(), initUserDigitalArtworkObjs.add(new Object[]{receiverDigitalArtworkVo.getArtworkId(),
receiverDigitalArtworkVo.getUid(), receiverDigitalArtworkVo.getSkuId(), receiverDigitalArtworkVo.getOrderId(), receiverDigitalArtworkVo.getUid(), receiverDigitalArtworkVo.getSkuId(), receiverDigitalArtworkVo.getOrderId(),
......
...@@ -1639,6 +1639,19 @@ public class GoblinMongoUtils { ...@@ -1639,6 +1639,19 @@ public class GoblinMongoUtils {
return updateResult.getModifiedCount() > 0; return updateResult.getModifiedCount() > 0;
} }
/**
* 转赠退还后,恢复藏品信息
*/
public boolean updateUserDigitalArtworkVoByTransReturn(String artworkId, LocalDateTime currentDateTime) {
Query queryMongo = Query.query(
Criteria.where("artworkId").is(artworkId).and("transferState").is(GoblinStatusConst.TransferState.WAITING.name())
);
Update updateMongo = Update.update("updatedAt", currentDateTime).unset("transferOrderId").unset("transferState")
.unset("receiverUid").unset("receiverUser").unset("transferAt");
UpdateResult updateResult = mongoTemplate.updateMulti(queryMongo, updateMongo, GoblinUserDigitalArtworkVo.class.getSimpleName());
return updateResult.getModifiedCount() > 0;
}
public List<String> getPageUserDigitalArtworkIds(String uid, Integer pageNum, Integer pageSize) { public List<String> getPageUserDigitalArtworkIds(String uid, Integer pageNum, Integer pageSize) {
Criteria criteria = Criteria.where("uid").is(uid).and("delFlg").is("0"); Criteria criteria = Criteria.where("uid").is(uid).and("delFlg").is("0");
Query query = Query.query(criteria); Query query = Query.query(criteria);
......
package com.liquidnet.service.goblin.util; package com.liquidnet.service.goblin.util;
import com.github.pagehelper.PageInfo;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto; import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto; import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
...@@ -13,7 +12,6 @@ import com.liquidnet.service.goblin.entity.GoblinOrderAttr; ...@@ -13,7 +12,6 @@ import com.liquidnet.service.goblin.entity.GoblinOrderAttr;
import com.liquidnet.service.goblin.entity.GoblinOrderSku; import com.liquidnet.service.goblin.entity.GoblinOrderSku;
import com.liquidnet.service.goblin.entity.GoblinStoreOrder; import com.liquidnet.service.goblin.entity.GoblinStoreOrder;
import com.liquidnet.service.goblin.param.BackCouponParam; import com.liquidnet.service.goblin.param.BackCouponParam;
import com.liquidnet.service.goblin.param.GoblinListCreateItemParam;
import com.liquidnet.service.goblin.param.GoblinOrderSqlParam; import com.liquidnet.service.goblin.param.GoblinOrderSqlParam;
import com.mongodb.BasicDBObject; import com.mongodb.BasicDBObject;
import com.mongodb.client.model.WriteModel; import com.mongodb.client.model.WriteModel;
...@@ -21,7 +19,7 @@ import org.bson.Document; ...@@ -21,7 +19,7 @@ import org.bson.Document;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.Map;
public class ObjectUtil { public class ObjectUtil {
private static final PagedResult<GoblinStoreMgtGoodsListVo> goblinStoreMgtGoodsVoPagedResult = new PagedResult<>(); private static final PagedResult<GoblinStoreMgtGoodsListVo> goblinStoreMgtGoodsVoPagedResult = new PagedResult<>();
...@@ -42,6 +40,7 @@ public class ObjectUtil { ...@@ -42,6 +40,7 @@ public class ObjectUtil {
private static final ArrayList<GoblinStoreConfigVo> goblinStoreConfigVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinStoreConfigVo> goblinStoreConfigVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinStoreNoticeVo> goblinStoreNoticeVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinStoreNoticeVo> goblinStoreNoticeVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSkuInfoVo> goblinGoodsSkuInfoVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinGoodsSkuInfoVo> goblinGoodsSkuInfoVoArrayList = new ArrayList<>();
private static final HashMap<String, GoblinGoodsSkuInfoVo> goblinGoodsSkuInfoVoHashMap = new HashMap<>();
private static final ArrayList<GoblinGoodsSpecVo> goblinGoodsSpecVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinGoodsSpecVo> goblinGoodsSpecVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinGoodsSpecValueVo> goblinGoodsSpecValueVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinGoodsSpecValueVo> goblinGoodsSpecValueVoArrayList = new ArrayList<>();
private static final ArrayList<GoblinServiceSupportVo> goblinServiceSupportVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinServiceSupportVo> goblinServiceSupportVoArrayList = new ArrayList<>();
...@@ -88,6 +87,7 @@ public class ObjectUtil { ...@@ -88,6 +87,7 @@ public class ObjectUtil {
private static final ArrayList<GoblinNftGoodsSkuListVo> goblinNftGoodsSkuListVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinNftGoodsSkuListVo> goblinNftGoodsSkuListVoArrayList = new ArrayList<>();
private static final ArrayList<TempCouponVo> tempCouponVo = new ArrayList<>(); private static final ArrayList<TempCouponVo> tempCouponVo = new ArrayList<>();
private static final ArrayList<GoblinUserDigitalArtworkListVo> GOBLIN_USER_DIGITAL_ARTWORK_LIST_VO_ARRAY_LIST = new ArrayList<>(); private static final ArrayList<GoblinUserDigitalArtworkListVo> GOBLIN_USER_DIGITAL_ARTWORK_LIST_VO_ARRAY_LIST = new ArrayList<>();
private static final ArrayList<GoblinUserDigitalArtworkTransferListVo> GOBLIN_USER_DIGITAL_ARTWORK_TRANSFER_LIST_VOS = new ArrayList<>();
private static final PagedResult<GoblinStoreMgtGoodsSkuListVo> goblinStoreMgtGoodsSkuListVo = new PagedResult<>(); private static final PagedResult<GoblinStoreMgtGoodsSkuListVo> goblinStoreMgtGoodsSkuListVo = new PagedResult<>();
private static final ArrayList<GoblinListVo> goblinListVo = new ArrayList<>(); private static final ArrayList<GoblinListVo> goblinListVo = new ArrayList<>();
private static final ArrayList<GoblinStoreMgtGoodsSkuListVo> goblinStoreMgtGoodsSkuListVoArrayList = new ArrayList<>(); private static final ArrayList<GoblinStoreMgtGoodsSkuListVo> goblinStoreMgtGoodsSkuListVoArrayList = new ArrayList<>();
...@@ -326,6 +326,10 @@ public class ObjectUtil { ...@@ -326,6 +326,10 @@ public class ObjectUtil {
return (ArrayList<GoblinGoodsSkuInfoVo>) goblinGoodsSkuInfoVoArrayList.clone(); return (ArrayList<GoblinGoodsSkuInfoVo>) goblinGoodsSkuInfoVoArrayList.clone();
} }
public static Map<String, GoblinGoodsSkuInfoVo> getGoblinGoodsSkuInfoVoMap() {
return (HashMap<String, GoblinGoodsSkuInfoVo>) goblinGoodsSkuInfoVoHashMap.clone();
}
public static ArrayList<GoblinGoodsSpecVo> getGoblinGoodsSpecVoArrayList() { public static ArrayList<GoblinGoodsSpecVo> getGoblinGoodsSpecVoArrayList() {
return (ArrayList<GoblinGoodsSpecVo>) goblinGoodsSpecVoArrayList.clone(); return (ArrayList<GoblinGoodsSpecVo>) goblinGoodsSpecVoArrayList.clone();
} }
...@@ -406,6 +410,10 @@ public class ObjectUtil { ...@@ -406,6 +410,10 @@ public class ObjectUtil {
return (ArrayList<GoblinUserDigitalArtworkListVo>) GOBLIN_USER_DIGITAL_ARTWORK_LIST_VO_ARRAY_LIST.clone(); return (ArrayList<GoblinUserDigitalArtworkListVo>) GOBLIN_USER_DIGITAL_ARTWORK_LIST_VO_ARRAY_LIST.clone();
} }
public static ArrayList<GoblinUserDigitalArtworkTransferListVo> getGoblinUserDigitalArtworkTransferListVos() {
return (ArrayList<GoblinUserDigitalArtworkTransferListVo>) GOBLIN_USER_DIGITAL_ARTWORK_TRANSFER_LIST_VOS.clone();
}
public static BasicDBObject cloneBasicDBObject() { public static BasicDBObject cloneBasicDBObject() {
return (BasicDBObject) basicDBObject.clone(); return (BasicDBObject) basicDBObject.clone();
} }
......
...@@ -55,6 +55,15 @@ ...@@ -55,6 +55,15 @@
140110=\u53D7\u8D60\u4EBA\u672A\u5F00\u901A\u6570\u5B57\u8D26\u53F7 140110=\u53D7\u8D60\u4EBA\u672A\u5F00\u901A\u6570\u5B57\u8D26\u53F7
140111=\u8BE5\u85CF\u54C1\u6240\u5C5E\u6570\u636E\u94FE\u6682\u672A\u5F00\u653E\u8F6C\u8D60 140111=\u8BE5\u85CF\u54C1\u6240\u5C5E\u6570\u636E\u94FE\u6682\u672A\u5F00\u653E\u8F6C\u8D60
140112=\u8BE5\u85CF\u54C1\u4E0D\u6EE1\u8DB3\u8F6C\u8D60\u6761\u4EF6 140112=\u8BE5\u85CF\u54C1\u4E0D\u6EE1\u8DB3\u8F6C\u8D60\u6761\u4EF6
140113=\u5BC6\u7801\u9519\u8BEF\uFF0C\u8BF7%d\u5206\u949F\u540E\u518D\u8BD5
140114=\u5BC6\u7801\u9519\u8BEF\uFF0C\u518D\u8F93\u95191\u6B21\u8BF7\u8054\u7CFB\u5BA2\u670D\u627E\u56DE
140115=\u5BC6\u7801\u9519\u8BEF\u5DF2\u8FBE\u4E0A\u9650\uFF0C\u8BF7\u8054\u7CFB\u5BA2\u670D\u91CD\u7F6E\u5BC6\u7801
140116=\u5BC6\u7801\u9519\u8BEF\uFF0C\u518D\u8F93\u9519%d\u6B21\u5C06\u9501\u5B9A%d\u5206\u949F
140117=%d\u5206\u949F\u9501\u5B9A\u65F6\u95F4\u672A\u7ED3\u675F\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5
140118=\u8D85\u8FC7\u9886\u53D6\u65F6\u95F4\uFF0C\u5DF2\u65E0\u6CD5\u9886\u53D6
140119=\u60A8\u5DF2\u9886\u53D6\u8BE5\u85CF\u54C1
140120=\u8BE5\u85CF\u54C1\u5DF2\u9000\u8FD8
140121=\u8BE5\u85CF\u54C1\u5DF2\u88AB\u8F6C\u8D60
......
...@@ -128,13 +128,17 @@ goblin_user_coupon.insert=INSERT INTO goblin_user_coupon (ucoupon_id, store_coup ...@@ -128,13 +128,17 @@ goblin_user_coupon.insert=INSERT INTO goblin_user_coupon (ucoupon_id, store_coup
goblin_user_coupon.updateState=UPDATE goblin_user_coupon SET state = ? , used_for = ? ,updated_at = ? where ucoupon_id = ? goblin_user_coupon.updateState=UPDATE goblin_user_coupon SET state = ? , used_for = ? ,updated_at = ? where ucoupon_id = ?
#---- \u6211\u7684\u85CF\u54C1 #---- \u6211\u7684\u85CF\u54C1
goblin_user_digital_artwork.insert=INSERT INTO goblin_user_digital_artwork (artwork_id,sku_id,uid,order_id,source,state,created_at)VALUES(?,?,?,?,?,?,?) goblin_user_digital_artwork.insert=INSERT INTO goblin_user_digital_artwork (artwork_id,sku_id,uid,order_id,source,state,created_at)VALUES(?,?,?,?,?,?,?)
goblin_user_digital_artwork.insert_for_transfer=INSERT INTO goblin_user_digital_artwork (artwork_id,uid,sku_id,order_id,edition_sn,nft_id,trading_txhash,trading_at,`source`,state,created_at)VALUES(?,?,?,?,?,?,?,?,?,?,?) goblin_user_digital_artwork.in_transfer=INSERT INTO goblin_user_digital_artwork (artwork_id,uid,sku_id,order_id,edition_sn,nft_id,trading_txhash,trading_at,`source`,state,created_at)VALUES(?,?,?,?,?,?,?,?,?,?,?)
goblin_user_digital_artwork.update_for_chain=UPDATE goblin_user_digital_artwork SET edition_sn=?,nft_id=?,release_txhash=?,release_at=?,trading_txhash=?,trading_at=?,state=?,updated_at=? WHERE artwork_id=? AND state<>1 goblin_user_digital_artwork.update_for_chain=UPDATE goblin_user_digital_artwork SET edition_sn=?,nft_id=?,release_txhash=?,release_at=?,trading_txhash=?,trading_at=?,state=?,updated_at=? WHERE artwork_id=? AND state<>1
goblin_user_digital_artwork.update_for_unboxing=UPDATE goblin_user_digital_artwork SET state=1,del_flg='1',opening_at=?,updated_at=?,deleted_at=? WHERE artwork_id=? AND state<>1 goblin_user_digital_artwork.update_for_unboxing=UPDATE goblin_user_digital_artwork SET state=1,del_flg='1',opening_at=?,updated_at=?,deleted_at=? WHERE artwork_id=? AND state<>1
goblin_user_digital_artwork.update_for_accept=UPDATE goblin_user_digital_artwork SET state=0,opening_at=?,updated_at=? WHERE artwork_id=? AND state=5 goblin_user_digital_artwork.update_for_accept=UPDATE goblin_user_digital_artwork SET state=0,opening_at=?,updated_at=? WHERE artwork_id=? AND state=5
goblin_user_digital_artwork.update_for_transfer=UPDATE goblin_user_digital_artwork SET receiver_uid=?,transfer_order_id=?,transfer_state=?,updated_at=? WHERE artwork_id=? goblin_user_digital_artwork.up_transfer=UPDATE goblin_user_digital_artwork SET receiver_uid=?,transfer_order_id=?,transfer_state=?,updated_at=? WHERE artwork_id=?
goblin_user_digital_artwork.update_for_trans_query=UPDATE goblin_user_digital_artwork SET transfer_state=?,del_flg='1',deleted_at=? WHERE artwork_id=? goblin_user_digital_artwork.up_transfer_receive=UPDATE goblin_user_digital_artwork SET transfer_state=?,updated_at=? WHERE artwork_id=?
#---- goblin_user_digital_artwork.up_transfer_return=UPDATE goblin_user_digital_artwork SET receiver_uid=null,transfer_order_id=null,transfer_state=null,updated_at=? WHERE artwork_id=?
goblin_user_digital_artwork.up_transfer_chain=UPDATE goblin_user_digital_artwork SET transfer_state=?,del_flg='1',deleted_at=? WHERE artwork_id=?
#---- \u85CF\u54C1\u8F6C\u8D60\u8BA2\u5355
goblin_nft_transfer_order.insert=INSERT INTO goblin_nft_transfer_order (order_id,artwork_id,owner_uid,receiver_uid,state,created_at)VALUES(?,?,?,?,0,?)
goblin_nft_transfer_order.up_transfer_confirm=UPDATE goblin_nft_transfer_order SET state=?,updated_at=? WHERE order_id=?
#---- \u9884\u7EA6 #---- \u9884\u7EA6
goblin_goods_anticipate=INSERT INTO goblin_goods_anticipate(ant_id,people,`type`,`rule`,created_date,del_tag) VALUES(?,?,?,?,?,?) goblin_goods_anticipate=INSERT INTO goblin_goods_anticipate(ant_id,people,`type`,`rule`,created_date,del_tag) VALUES(?,?,?,?,?,?)
goblin_goods_anticipate_value=INSERT INTO goblin_goods_anticipate_value (uid,ant_id,sku_name,sku_id,spu_id,about_people,actual_people,rule,about_start_date,about_end_date,created_date,del_tag) VALUES(?,?,?,?,?,?,?,?,?,?,?,?) goblin_goods_anticipate_value=INSERT INTO goblin_goods_anticipate_value (uid,ant_id,sku_name,sku_id,spu_id,about_people,actual_people,rule,about_start_date,about_end_date,created_date,del_tag) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)
......
...@@ -85,7 +85,9 @@ public class CandyCouponDueTaskController { ...@@ -85,7 +85,9 @@ public class CandyCouponDueTaskController {
AtomicInteger pl = new AtomicInteger(); AtomicInteger pl = new AtomicInteger();
int remainCount = totalCount; int remainCount = totalCount;
int num = 0, pSize = 1000; int num = 0, pSize = 1000;
log.info("券码到期检查处理:兑换码[到期总记录数:{},AT:{}] >>> BEGIN BEGIN BEGIN", totalCount, now); if (totalCount > 0) {
log.info("券码到期检查处理:兑换码[到期总记录数:{},AT:{}] >>> BEGIN BEGIN BEGIN", totalCount, now);
}
ArrayList<CandyCouponCode> updateCouponCodeList = ObjectUtil.getCandyCouponCodeArrayList(); ArrayList<CandyCouponCode> updateCouponCodeList = ObjectUtil.getCandyCouponCodeArrayList();
couponCodeQueryWrapper.select(CandyCouponCode::getMid, CandyCouponCode::getCcode); couponCodeQueryWrapper.select(CandyCouponCode::getMid, CandyCouponCode::getCcode);
...@@ -134,7 +136,9 @@ public class CandyCouponDueTaskController { ...@@ -134,7 +136,9 @@ public class CandyCouponDueTaskController {
remainCount -= pSize; remainCount -= pSize;
log.info("券码到期检查处理中:兑换码[到期总记录数:{},单次处理:{},剩余处理数:{}]", totalCount, lastLimitSql, remainCount); log.info("券码到期检查处理中:兑换码[到期总记录数:{},单次处理:{},剩余处理数:{}]", totalCount, lastLimitSql, remainCount);
} }
log.info("券码到期检查处理:兑换码[到期总记录数:{},处理总数:{}] >>> END END END", totalCount, pl.get()); if (totalCount > 0) {
log.info("券码到期检查处理:兑换码[到期总记录数:{},处理总数:{}] >>> END END END", totalCount, pl.get());
}
return ResponseDto.success(); return ResponseDto.success();
} }
......
...@@ -34,16 +34,18 @@ public class CandyMgtCouponTaskController { ...@@ -34,16 +34,18 @@ public class CandyMgtCouponTaskController {
.le(CandyMgtCoupon::getEventAt, now) .le(CandyMgtCoupon::getEventAt, now)
.orderByAsc(CandyMgtCoupon::getEventAt); .orderByAsc(CandyMgtCoupon::getEventAt);
List<CandyMgtCoupon> list = platformCandyMgtCouponService.list(queryWrapper); List<CandyMgtCoupon> list = platformCandyMgtCouponService.list(queryWrapper);
int taskSize = CollectionUtils.isEmpty(list) ? -1 : list.size(), pl = 0; int totalSize = CollectionUtils.isEmpty(list) ? -1 : list.size(), pl = 0;
log.info("发放券任务总数:{} >>> BEGIN BEGIN BEGIN", taskSize); if (totalSize > 0) {
log.info("发放券任务总数:{} >>> BEGIN BEGIN BEGIN", totalSize);
}
for (int i = 0; i < taskSize; i++) { for (int i = 0; i < totalSize; i++) {
CandyMgtCoupon mgtCoupon = list.get(i); CandyMgtCoupon mgtCoupon = list.get(i);
mgtCoupon.setState(9); mgtCoupon.setState(9);
mgtCoupon.setUpdatedAt(now); mgtCoupon.setUpdatedAt(now);
} }
if (platformCandyMgtCouponService.updateBatchById(list)) { if (platformCandyMgtCouponService.updateBatchById(list)) {
for (int i = 0; i < taskSize; i++) { for (int i = 0; i < totalSize; i++) {
CandyMgtCoupon mgtCoupon = list.get(i); CandyMgtCoupon mgtCoupon = list.get(i);
try { try {
...@@ -51,7 +53,7 @@ public class CandyMgtCouponTaskController { ...@@ -51,7 +53,7 @@ public class CandyMgtCouponTaskController {
.eq(CandyCoupon::getState, 1).eq(CandyCoupon::getCouponId, mgtCoupon.getCouponId()); .eq(CandyCoupon::getState, 1).eq(CandyCoupon::getCouponId, mgtCoupon.getCouponId());
CandyCoupon coupon = platformCandyCouponService.getOne(couponLambdaQueryWrapper); CandyCoupon coupon = platformCandyCouponService.getOne(couponLambdaQueryWrapper);
log.info("发放券任务总数:{},任务{}开始处理[mcouponId:{},couType:{},bindType:{},eventAmt:{},eventType:{}]", taskSize, i, log.info("发放券任务总数:{},任务{}开始处理[mcouponId:{},couType:{},bindType:{},eventAmt:{},eventType:{}]", totalSize, i,
mgtCoupon.getMcouponId(), coupon.getCouType(), coupon.getBindType(), mgtCoupon.getEventAmt(), mgtCoupon.getEventType()); mgtCoupon.getMcouponId(), coupon.getCouType(), coupon.getBindType(), mgtCoupon.getEventAmt(), mgtCoupon.getEventType());
switch (coupon.getCouType()) { switch (coupon.getCouType()) {
...@@ -71,23 +73,25 @@ public class CandyMgtCouponTaskController { ...@@ -71,23 +73,25 @@ public class CandyMgtCouponTaskController {
platformCandyCouponService.issuePriorityCouponHandler(mgtCoupon, coupon); platformCandyCouponService.issuePriorityCouponHandler(mgtCoupon, coupon);
break; break;
default: default:
log.warn("发放券任务总数:{},任务{}无法处理,无效的券类型[mcouponId:{},couType:{}]", taskSize, i, mgtCoupon.getMcouponId(), coupon.getCouType()); log.warn("发放券任务总数:{},任务{}无法处理,无效的券类型[mcouponId:{},couType:{}]", totalSize, i, mgtCoupon.getMcouponId(), coupon.getCouType());
break; break;
} }
mgtCoupon.setState(1); mgtCoupon.setState(1);
boolean update = platformCandyMgtCouponService.updateById(mgtCoupon); boolean update = platformCandyMgtCouponService.updateById(mgtCoupon);
log.info("发放券任务总数:{},任务{}处理{}[mcouponId:{},couType:{},bindType:{},eventAmt:{},eventType:{}]", taskSize, i, (update ? "成功" : "失败"), log.info("发放券任务总数:{},任务{}处理{}[mcouponId:{},couType:{},bindType:{},eventAmt:{},eventType:{}]", totalSize, i, (update ? "成功" : "失败"),
mgtCoupon.getMcouponId(), coupon.getCouType(), coupon.getBindType(), mgtCoupon.getEventAmt(), mgtCoupon.getEventType()); mgtCoupon.getMcouponId(), coupon.getCouType(), coupon.getBindType(), mgtCoupon.getEventAmt(), mgtCoupon.getEventType());
pl++; pl++;
} catch (Exception e) { } catch (Exception e) {
log.error("发放券任务总数:{},任务{}处理异常[mcouponId:{}]", taskSize, i, mgtCoupon.getMcouponId(), e); log.error("发放券任务总数:{},任务{}处理异常[mcouponId:{}]", totalSize, i, mgtCoupon.getMcouponId(), e);
} }
} }
} }
log.info("发放券任务总数:{},成功处理任务数:{} >>> END END END", taskSize, pl); if (totalSize > 0) {
return ResponseDto.success(String.format("发放券任务总数:%s,成功处理任务数:%s", taskSize, pl)); log.info("发放券任务总数:{},成功处理任务数:{} >>> END END END", totalSize, pl);
}
return ResponseDto.success(String.format("发放券任务总数:%s,成功处理任务数:%s", totalSize, pl));
} }
} }
package com.liquidnet.service.platform.controller.goblin;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.liquidnet.common.exception.constant.ErrorCode;
import com.liquidnet.commons.lang.util.DESUtils;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.entity.GoblinNftTransferOrder;
import com.liquidnet.service.platform.service.impl.goblin.PlatformGoblinNftTransferOrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("artwork/task")
public class GoblinUserDigitalArtworkTaskController {
@Autowired
private PlatformGoblinNftTransferOrderService platformGoblinNftTransferOrderService;
/**
* 藏品转赠过期批处理
*
* @param expiredSeconds 过期时间,单位秒,不传默认24小时即86400秒(这里统一延后30秒处理)
* @return ResponseDto<String>
*/
@PostMapping("transfer_expire")
public ResponseDto<String> processForTransferExpire(@RequestParam(required = false) String expiredSeconds) {
int expiredSecondsIntVal = 86400 + 30;
if (StringUtils.isNotBlank(expiredSeconds)) {
try {
String decrypt = DESUtils.DES().decrypt(expiredSeconds);
expiredSecondsIntVal = Integer.parseInt(decrypt) + 30;
} catch (NumberFormatException e) {
expiredSecondsIntVal = 86400 + 30;
} catch (Exception e) {
ErrorCode paramError = ErrorCode.HTTP_PARAM_ERROR;
return ResponseDto.failure(paramError.getCode(), paramError.getMessage());
}
}
LocalDateTime expiredTime = LocalDateTime.now().minusSeconds(expiredSecondsIntVal);
LambdaQueryWrapper<GoblinNftTransferOrder> queryWrapper = Wrappers.lambdaQuery(GoblinNftTransferOrder.class)
.eq(GoblinNftTransferOrder::getState, 0)
.le(GoblinNftTransferOrder::getCreatedAt, expiredTime);
int totalCount = platformGoblinNftTransferOrderService.count(queryWrapper), pl = 0, remainCount = totalCount, pSize = 200;
if (totalCount > 0) {
log.info("藏品转赠过期初始查询总数:{} >>> BEGIN BEGIN BEGIN", totalCount);
}
queryWrapper.select(GoblinNftTransferOrder::getMid, GoblinNftTransferOrder::getArtworkId);
queryWrapper.orderByAsc(GoblinNftTransferOrder::getMid);
while (remainCount > 0) {
String lastLimitSql = "LIMIT " + 0 + "," + pSize;
List<GoblinNftTransferOrder> list = platformGoblinNftTransferOrderService.list(queryWrapper.last(lastLimitSql));
if (!CollectionUtils.isEmpty(list)) {
int numSucc = platformGoblinNftTransferOrderService.processForTransferExpire(list);
log.info("藏品转赠过期处理[单次处理:{},list.size:{},list.numSucc:{}]", lastLimitSql, list.size(), numSucc);
if (numSucc == 0) {
return ResponseDto.failure(String.format("藏品转赠过期处理警告:Mysql与Redis数据不一致,请核实[expiredTime=%s]", expiredTime));
}
pl += numSucc;
queryWrapper.clear();
expiredTime = LocalDateTime.now().minusSeconds(expiredSecondsIntVal);
queryWrapper.eq(GoblinNftTransferOrder::getState, 0).le(GoblinNftTransferOrder::getCreatedAt, expiredTime);
queryWrapper.select(GoblinNftTransferOrder::getMid, GoblinNftTransferOrder::getArtworkId);
queryWrapper.orderByAsc(GoblinNftTransferOrder::getMid);
} else {
remainCount = -1;
}
}
if (totalCount > 0) {
log.info("藏品转赠过期初始查询总数:{},最终成功处理总数:{} >>> END END END", totalCount, pl);
}
return ResponseDto.success(String.format("藏品转赠过期初始查询总数:%s,最终成功处理总数:%s", totalCount, pl));
}
}
package com.liquidnet.service.platform.service.impl.goblin;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.common.cache.redis.util.AbstractRedisUtil;
import com.liquidnet.common.cache.redis.util.RedisDataSourceUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.GoblinUserDigitalArtworkVo;
import com.liquidnet.service.goblin.entity.GoblinNftTransferOrder;
import com.liquidnet.service.goblin.entity.GoblinUserDigitalArtwork;
import com.liquidnet.service.goblin.mapper.GoblinNftTransferOrderMapper;
import com.liquidnet.service.goblin.mapper.GoblinUserDigitalArtworkMapper;
import com.liquidnet.service.platform.utils.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@Service
public class PlatformGoblinNftTransferOrderService extends ServiceImpl<GoblinNftTransferOrderMapper, GoblinNftTransferOrder> {
@Autowired
private GoblinUserDigitalArtworkMapper goblinUserDigitalArtworkMapper;
@Autowired
private RedisDataSourceUtil redisDataSourceUtil;
@Autowired
private MongoTemplate mongoTemplate;
public int processForTransferExpire(List<GoblinNftTransferOrder> list) {
AbstractRedisUtil redisGoblinUtil = redisDataSourceUtil.getRedisGoblinUtil();
ArrayList<String> updateUserDigitalArtworkIdList = CollectionUtil.arrayListString();
ArrayList<GoblinNftTransferOrder> updateNftTransferOrderList = ObjectUtil.getGoblinNftTransferOrderArrayList();
int numSucc = 0;
LocalDateTime currentDateTime = LocalDateTime.now();
for (int i = 0, listSize = CollectionUtils.isEmpty(list) ? -1 : list.size(); i < listSize; i++) {
GoblinNftTransferOrder nftTransferOrder = list.get(i);
String artworkId = nftTransferOrder.getArtworkId();
if (this.lockUserDigitalArtworkVoOperate(artworkId)) {
GoblinUserDigitalArtworkVo rdsVo = (GoblinUserDigitalArtworkVo) redisGoblinUtil.get(GoblinRedisConst.USER_DIGITAL_ARTWORK.concat(artworkId));
if (null != rdsVo && GoblinStatusConst.TransferState.WAITING.name().equals(rdsVo.getTransferState())) {
// 受赠人受赠藏品列表缓存更新
this.rmvUserDigitalArtworkIdsTransfer(rdsVo.getReceiverUid(), artworkId);
// 转赠人藏品恢复
rdsVo.setTransferOrderId(null);
rdsVo.setTransferState(null);
rdsVo.setReceiverUid(null);
rdsVo.setReceiverUser(null);//
rdsVo.setUpdatedAt(currentDateTime);
redisGoblinUtil.set(GoblinRedisConst.USER_DIGITAL_ARTWORK.concat(artworkId), rdsVo);
nftTransferOrder.setState(3);
nftTransferOrder.setUpdatedAt(currentDateTime);
updateNftTransferOrderList.add(nftTransferOrder);
updateUserDigitalArtworkIdList.add(artworkId);
numSucc++;
}
this.unlockUserDigitalArtworkVoOperate(artworkId);
}
}
if (numSucc > 0) {// 更新Mysql、Mongo
this.updateBatchById(updateNftTransferOrderList, updateNftTransferOrderList.size());
GoblinUserDigitalArtwork updateUserDigitalArtwork = new GoblinUserDigitalArtwork();
updateUserDigitalArtwork.setTransferOrderId(null);
updateUserDigitalArtwork.setTransferState(null);
updateUserDigitalArtwork.setReceiverUid(null);
updateUserDigitalArtwork.setUpdatedAt(currentDateTime);
LambdaUpdateWrapper<GoblinUserDigitalArtwork> userDigitalArtworkLambdaUpdateWrapper = Wrappers.lambdaUpdate(GoblinUserDigitalArtwork.class)
.in(GoblinUserDigitalArtwork::getArtworkId, updateUserDigitalArtworkIdList)
.eq(GoblinUserDigitalArtwork::getTransferState, GoblinStatusConst.TransferState.WAITING.name());
goblinUserDigitalArtworkMapper.update(updateUserDigitalArtwork, userDigitalArtworkLambdaUpdateWrapper);
Query queryMongo = Query.query(
Criteria.where("artworkId").in(updateUserDigitalArtworkIdList).and("transferState").is(GoblinStatusConst.TransferState.WAITING.name())
);
Update updateMongo = Update.update("updatedAt", currentDateTime).unset("transferOrderId").unset("transferState")
.unset("receiverUid").unset("receiverUser").unset("transferAt");
mongoTemplate.updateMulti(queryMongo, updateMongo, GoblinUserDigitalArtworkVo.class.getSimpleName());
}
return numSucc;
}
/* ------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------ */
/**
* 锁定藏品操作
*/
private boolean lockUserDigitalArtworkVoOperate(String artworkId) {
String lk = GoblinRedisConst.USER_DIGITAL_ARTWORK.concat("lk").concat(artworkId);
AbstractRedisUtil redisUtil = redisDataSourceUtil.getRedisGoblinUtil();
if (redisUtil.incr(lk, 1) > 1) {
return false;
}
redisUtil.expireSet(lk, 30);
return true;
}
/**
* 解锁藏品操作
*/
private void unlockUserDigitalArtworkVoOperate(String artworkId) {
redisDataSourceUtil.getRedisGoblinUtil().del(GoblinRedisConst.USER_DIGITAL_ARTWORK.concat("lk").concat(artworkId));
}
/**
* 获取用户受赠藏品ID集合
*/
public List<String> getUserDigitalArtworkIdsTransfer(String uid) {
return (List<String>) redisDataSourceUtil.getRedisGoblinUtil().get(GoblinRedisConst.USER_DIGITAL_ARTWORK_IDS_TRANSFER.concat(uid));
}
private boolean rmvUserDigitalArtworkIdsTransfer(String uid, String artworkId) {
List<String> ids = this.getUserDigitalArtworkIdsTransfer(uid);
if (CollectionUtils.isEmpty(ids)) {
return false;
} else {
ids.remove(artworkId);
if (CollectionUtils.isEmpty(ids)) {
redisDataSourceUtil.getRedisGoblinUtil().del(GoblinRedisConst.USER_DIGITAL_ARTWORK_IDS_TRANSFER.concat(uid));
} else {
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.USER_DIGITAL_ARTWORK_IDS_TRANSFER.concat(uid), ids);
}
return true;
}
}
/* ------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------ */
}
...@@ -7,9 +7,7 @@ import com.liquidnet.service.candy.entity.CandyCouponCode; ...@@ -7,9 +7,7 @@ import com.liquidnet.service.candy.entity.CandyCouponCode;
import com.liquidnet.service.candy.entity.CandyUserCoupon; import com.liquidnet.service.candy.entity.CandyUserCoupon;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto; import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.vo.*; import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinNftExCode; import com.liquidnet.service.goblin.entity.*;
import com.liquidnet.service.goblin.entity.GoblinNftExCodeTask;
import com.liquidnet.service.goblin.entity.GoblinNftExCodeTaskRelation;
import com.liquidnet.service.kylin.dto.vo.KylinApiCameraDevicesVo; import com.liquidnet.service.kylin.dto.vo.KylinApiCameraDevicesVo;
import com.liquidnet.service.kylin.entity.KylinOrderCoupons; import com.liquidnet.service.kylin.entity.KylinOrderCoupons;
import com.liquidnet.service.goblin.dto.vo.ActivityExcelVo; import com.liquidnet.service.goblin.dto.vo.ActivityExcelVo;
...@@ -70,6 +68,8 @@ public class ObjectUtil { ...@@ -70,6 +68,8 @@ public class ObjectUtil {
private static final ArrayList<GoblinNftExCodeTask> goblinNftExCodeTaskArrayList = new ArrayList<>(); private static final ArrayList<GoblinNftExCodeTask> goblinNftExCodeTaskArrayList = new ArrayList<>();
private static final ArrayList<GoblinStoreMarketDto> goblinStoreMarketDtoArrayList = new ArrayList<>(); private static final ArrayList<GoblinStoreMarketDto> goblinStoreMarketDtoArrayList = new ArrayList<>();
private static final ArrayList<GoblinNftExCode> goblinNftExCodeArrayList = new ArrayList<>(); private static final ArrayList<GoblinNftExCode> goblinNftExCodeArrayList = new ArrayList<>();
private static final ArrayList<GoblinNftTransferOrder> goblinNftTransferOrders = new ArrayList<>();
private static final ArrayList<GoblinUserDigitalArtwork> goblinUserDigitalArtworks = new ArrayList<>();
public static ArrayList<SellDataOneVO> getSellDataOneVOArrayList() { public static ArrayList<SellDataOneVO> getSellDataOneVOArrayList() {
return (ArrayList<SellDataOneVO>) sellDataOneVOArrayList.clone(); return (ArrayList<SellDataOneVO>) sellDataOneVOArrayList.clone();
...@@ -179,5 +179,7 @@ public class ObjectUtil { ...@@ -179,5 +179,7 @@ public class ObjectUtil {
return (ArrayList<GoblinNftExCode>) goblinNftExCodeArrayList.clone(); return (ArrayList<GoblinNftExCode>) goblinNftExCodeArrayList.clone();
} }
public static ArrayList<GoblinNftTransferOrder> getGoblinNftTransferOrderArrayList(){
return (ArrayList<GoblinNftTransferOrder>) goblinNftTransferOrders.clone();
}
} }
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