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

Commit 2c0acaee authored by 胡佳晨's avatar 胡佳晨

Merge branch 'master' into hjc_kylin_stock

parents e00a0eff 831f4547
......@@ -247,6 +247,7 @@ public class GoblinRedisConst {
public static final String REDIS_WHITE = PREFIX.concat("white:");//白名单 key:$listId:$skuId:$mobile
public static final String LIST_COLLECT = PREFIX.concat("list:collect");//名单列表详情 $key:$skuId
public static final String ADAM_IS_MEMBER = "kylin:member:uid:";//是否会员 $key:$uid
public static final String LIST_RELATION_BOX = PREFIX.concat("list:relation:box");//名单列表详情 $key:$skuId:$listId
/**
* nft兑换活动配置
*/
......
......@@ -25,5 +25,7 @@ public class GoblinStoreMgtGoodsSkuFilterParam implements Serializable {
private String keyword;
@ApiModelProperty(position = 14, required = false, value = "商品上架状态[0-待上架|1-下架|2-违规|3-上架|4-已上架未开售]", allowableValues = "0,1,2,3")
private String shelvesStatus;
@ApiModelProperty(position = 15, required = false, value = "类型[0-普通|1-分批购]")
private Integer type;
}
package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@ApiModel(value = "GoblinGoodsInfoListVo", description = "商品SPU List")
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinGoodsInfoListVoo implements Serializable, Cloneable {
private List<GoblinGoodsInfoListVo> list;
@ApiModelProperty(position = 55, value = "数量")
private long count;
private static final GoblinGoodsInfoListVoo obj = new GoblinGoodsInfoListVoo();
public static GoblinGoodsInfoListVoo getNew() {
try {
return (GoblinGoodsInfoListVoo) obj.clone();
} catch (CloneNotSupportedException e) {
return new GoblinGoodsInfoListVoo();
}
}
/* public int compareTo(GoblinGoodsInfoVo arg0) {
return this.getCount().compareTo(arg0.getCount());
}*/
}
......@@ -110,6 +110,7 @@ public class GoblinNftExSkuVo {
@ApiModelProperty(position = 20,required = true,value ="修改时间")
private LocalDateTime updatedAt;
// redis 覆盖暂时无用
private String rdStartTime;
private String rdStopTime;
......
......@@ -105,6 +105,9 @@ public class GoblinNftGoodsSkuInfoVo implements Serializable, Cloneable {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
@ApiModelProperty(position = 69, value = "sku正常开售时间")
private LocalDateTime baseSaleStartTime;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
@ApiModelProperty(position = 70, value = "下个分段购开始时间,如果为null则没有")
private LocalDateTime nextSaleStartTime;
private static final GoblinNftGoodsSkuInfoVo obj = new GoblinNftGoodsSkuInfoVo();
......
......@@ -61,6 +61,12 @@ public class GoblinNftOrderVo implements Serializable, Cloneable {
@ApiModelProperty(value = "用户手机号")
private String userMobile;
@ApiModelProperty(value = "分批购ID")
private String listId;
@ApiModelProperty(value = "兑换码")
private String exCode;
@ApiModelProperty(value = "应付金额")
private BigDecimal priceTotal;
......@@ -150,6 +156,8 @@ public class GoblinNftOrderVo implements Serializable, Cloneable {
this.setUserId(source.getUserId());
this.setUserName(source.getUserName());
this.setUserMobile(source.getUserMobile());
this.setListId(source.getListId());
this.setExCode(source.getExCode());
this.setPriceTotal(source.getPriceTotal());
this.setPriceCoupon(source.getPriceCoupon());
this.setStorePriceCoupon(source.getStorePriceCoupon());
......
......@@ -39,4 +39,8 @@ public class GoblinNftOrderListParam {
private String payTimeStart;
@ApiModelProperty(value = "支付结束时间")
private String payTimeEnd;
@ApiModelProperty(value = "兑换码")
private String exCode;
@ApiModelProperty(value = "用户手机号")
private String userMobile;
}
......@@ -35,4 +35,8 @@ public class GoblinNftOrderRefundListParam {
private String payType;
@ApiModelProperty(value = "订单状态")
private Integer status;
@ApiModelProperty(value = "支付开始时间")
private String payTimeStart;
@ApiModelProperty(value = "支付结束时间")
private String payTimeEnd;
}
......@@ -6,6 +6,6 @@ import javax.servlet.http.HttpServletResponse;
public interface IGoblinExportService {
//导出商城订单信息
ResponseDto<Boolean> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType,String storeId);
ResponseDto<String> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType,String storeId);
}
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.zhengzai.goblin.service.impl.GoblinFrontCubeServiceImpl;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.goblin.entity.GoblinFrontCube;
import com.liquidnet.service.goblin.param.GoblinFrontCubeParam;
import io.swagger.annotations.Api;
......@@ -52,6 +53,12 @@ public class GoblinFrontCubeController extends BaseController {
public AjaxResult updateOrCreate(@RequestBody List<GoblinFrontCubeParam> list) {
List<GoblinFrontCube> list1=new ArrayList<>();
for(GoblinFrontCubeParam goblinFrontCubeParam:list){
if(StringUtil.isBlank(goblinFrontCubeParam.getSpuId())||goblinFrontCubeParam.getSpuId().equals("undefined")){
return error("spuId必传,请填写");
}
if(goblinFrontCubeParam.getSpuId().split(",").length==0){
return error("spuId必传,请填写");
}
GoblinFrontCube goblinFrontCube=new GoblinFrontCube();
BeanUtils.copyProperties(goblinFrontCubeParam,goblinFrontCube);
list1.add(goblinFrontCube);
......
......@@ -27,10 +27,6 @@
<label>订单编号:</label>
<input type="text" name="orderCode"/>
</li>
<li>
<label>哈希值:</label>
<input type="text" name="nftId"/>
</li>
</div>
<div class="col-sm-12">
<li>
......@@ -52,7 +48,7 @@
</select>
</li>
<li>
<label>订单状态:</label>
<label>退款状态:</label>
<select name="status">
<option value="">全部</option>
<option value="1">申请退款</option>
......@@ -60,6 +56,18 @@
<option value="3">退款失败</option>
</select>
</li>
<li class="select-time">
<label>支付时间: </label>
<input type="text" class="time-input" placeholder="开始日期" name="payTimeStart"/>
<span>-</span>
<input type="text" class="time-input" placeholder="结束日期" name="payTimeEnd"/>
</li>
</div>
<div class="col-sm-12">
<li>
<label>哈希值:</label>
<input type="text" name="nftId"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
......
......@@ -27,10 +27,6 @@
<label>订单编号:</label>
<input type="text" name="orderCode"/>
</li>
<li>
<label>哈希值:</label>
<input type="text" name="nftId"/>
</li>
</div>
<div class="col-sm-12">
<li>
......@@ -66,6 +62,20 @@
<span>-</span>
<input type="text" class="time-input" placeholder="结束日期" name="payTimeEnd"/>
</li>
</div>
<div class="col-sm-12">
<li>
<label>哈希值:</label>
<input type="text" name="nftId"/>
</li>
<li>
<label>兑换码:</label>
<input type="text" name="exCode"/>
</li>
<li>
<label>用户手机号:</label>
<input type="text" name="userMobile"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
......@@ -135,8 +145,12 @@
{
field: 'payType',
title: '支付方式',
formatter: function (value) {
return $.table.selectDictLabel(payTypeDic, value);
formatter: function (value, row) {
if (row.orderType == 2 || row.orderType == 4) {
return row.exCode;
} else {
return $.table.selectDictLabel(payTypeDic, value);
}
},
},
{
......@@ -160,7 +174,21 @@
},
{
field: 'name',
title: '藏品名称'
title: '藏品名称',
formatter: function (value) {
return value.trim().split(" ")[0];
}
},
{
field: 'boxSkuId',
title: '藏品类型',
formatter: function (value) {
if (value) {
return "盲盒";
} else {
return "明盒";
}
}
},
{
field: 'tradingAt',
......
......@@ -24,7 +24,7 @@ public class GoblinNftOrderListExcelDto implements Serializable, Cloneable {
private String priceActual;
@Excel(name = "订单状态")
private String status;
@Excel(name = "下大美时间")
@Excel(name = "下时间")
private String createdAt;
@Excel(name = "支付时间")
private String payTime;
......@@ -59,6 +59,9 @@ public class GoblinNftOrderListExcelDto implements Serializable, Cloneable {
case 3:
this.setOrderType("演出赠送");
break;
case 4:
this.setOrderType("空投赠送");
break;
default:
this.setOrderType("未知");
break;
......
......@@ -67,6 +67,17 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
public boolean updateOrCreate(List<GoblinFrontCube> list) {
for(GoblinFrontCube goblinFrontCube:list){
if (goblinFrontCube.getMid() == 0) {
String spuIds="";
for(String spuId:goblinFrontCube.getSpuId().split(",")){
if(spuId.equals("")||spuId.equals("undefined")){
}else{
spuIds=spuIds.concat(spuId).concat(",");
}
}
if(spuIds.length()>0){
goblinFrontCube.setSpuId(spuIds.substring(0,spuIds.length()-1));
}
this.create(goblinFrontCube);
} else {
goblinFrontCube.setUpdateTime(LocalDateTime.now());
......@@ -79,7 +90,10 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
spuIds=spuIds.concat(spuId).concat(",");
}
}
goblinFrontCube.setSpuId(spuIds);
if(spuIds.length()>0){
goblinFrontCube.setSpuId(spuIds.substring(0,spuIds.length()-1));
}
goblinFrontCubeMapper.updateById(goblinFrontCube);
}
}
......@@ -107,7 +121,9 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
List<GoblinGoods> goodsList= goblinGoodsMapper.selectList(queryWrappers);
GoblinFrontCubeParam goblinFrontCubeParam=new GoblinFrontCubeParam();
BeanUtils.copyProperties(goblinFrontCube,goblinFrontCubeParam);
goblinFrontCubeParam.setGoblinGoods(goodsList.get(0));
if(null!=goodsList&&goodsList.size()>0){
goblinFrontCubeParam.setGoblinGoods(goodsList.get(0));
}
list1.add(goblinFrontCubeParam);
}
}
......@@ -139,6 +155,8 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
}
//redis
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_GOBLINFRONTCUBE,list);
}else{
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_GOBLINFRONTCUBE,list);
}
return true;
......@@ -164,6 +182,8 @@ public class GoblinFrontCubeServiceImpl extends ServiceImpl<GoblinFrontCubeMappe
}
//redis
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_GOBLIN_RECOMMEND,list);
}else{
redisDataSourceUtil.getRedisGoblinUtil().set(GoblinRedisConst.FRONT_GOBLIN_RECOMMEND,list);
}
return true;
}
......
......@@ -116,9 +116,9 @@ public class ZxlnftSdkServiceImpl implements ZxlnftSdkService
}
log.info("nft003RegisterPersonPlatform--->>> response : {} ",response);
if (StringUtils.isEmpty(response)) {
return null;
}
// if (StringUtils.isEmpty(response)) {
// return null;
// }
/**
* 构造返回结果
......@@ -488,10 +488,6 @@ public class ZxlnftSdkServiceImpl implements ZxlnftSdkService
}
log.info("nft014IdentityBindSubmitByTrusted--->>> response : {} ",response);
if (StringUtils.isEmpty(response)) {
return null;
}
/**
* 构造返回结果
*/
......
......@@ -2,6 +2,7 @@ package com.liquidnet.common.third.zxlnft.util;
import com.liquidnet.common.third.zxlnft.biz.ZxlnftBiz;
import com.liquidnet.common.third.zxlnft.config.ZxlnftConfig;
import com.liquidnet.common.third.zxlnft.constant.ZxlErrorEnum;
import com.liquidnet.common.third.zxlnft.dto.*;
import com.liquidnet.common.third.zxlnft.dto.nft.*;
import com.liquidnet.common.third.zxlnft.exception.ZxlNftException;
......@@ -90,6 +91,8 @@ public class ZxlnftSdkUtil {
BeanUtil.copy(resp,respDto);
}catch(ZxlNftException e){
return ZxlnftResponseDto.failure(e.getCode()+","+e.getMessage());
}catch(Exception e){
return ZxlnftResponseDto.failure(ZxlErrorEnum.SERVER_INNER_ERROR.getCode(),ZxlErrorEnum.SERVER_INNER_ERROR.getMsg());
}
return ZxlnftResponseDto.success(respDto);
}
......@@ -316,6 +319,8 @@ public class ZxlnftSdkUtil {
BeanUtil.copy(resp,respDto);
}catch(ZxlNftException e){
return ZxlnftResponseDto.failure(e.getCode()+","+e.getMessage());
}catch(Exception e){
return ZxlnftResponseDto.failure(ZxlErrorEnum.SERVER_INNER_ERROR.getCode(),ZxlErrorEnum.SERVER_INNER_ERROR.getMsg());
}
return ZxlnftResponseDto.success(respDto);
}
......
......@@ -15,4 +15,6 @@ public class GoblinNftOrderListDto {
private String name;
private String tradingAt;
private String nftId;
private String exCode;
private String boxSkuId;
}
......@@ -85,6 +85,16 @@ public class GoblinNftOrder implements Serializable, Cloneable {
*/
private String userMobile;
/**
* 分批购ID
*/
private String listId;
/**
* 兑换码
*/
private String exCode;
/**
* 应付金额
*/
......
......@@ -94,4 +94,12 @@ public interface GoblinNftExCodeMapper extends BaseMapper<GoblinNftExCode> {
* @return
*/
int updateCodeAdminUids(@Param("codes") String codes, @Param("adminUid") String adminUid);
/**
* excel导出打乱兑换码顺序
* @param goblinNftExCode
* @return
*/
List<GoblinNftExCode> selectGoblinNftCodeExcel(GoblinNftExCode goblinNftExCode);
}
......@@ -129,6 +129,58 @@
</select>
<select id="selectGoblinNftCodeExcel" parameterType="com.liquidnet.service.goblin.entity.GoblinNftExCode"
resultMap="BeseResult">
select
DISTINCT
gnec.code,gnec.code_id,gnec.sku_id,gnec.box_sku_id,gnec.activity_id,gnec.state,gnec.redeem_uid,gnec.redeem_at,gnec.admin_uid,gnec.created_at
from goblin_nft_ex_code gnec inner join goblin_nft_ex_sku gnes on gnec.sku_id = gnes.sku_id and gnes.activity_id
= gnec.activity_id
<where>
<if test="code != null and code != ''">
and gnec.code = #{code,jdbcType=VARCHAR}
</if>
<if test="activityId != null and activityId != ''">
and gnec.activity_id = #{activityId,jdbcType=VARCHAR}
</if>
<if test="state != null">
<choose>
<when test="state == 1">
and (now() BETWEEN gnes.ex_start_time and gnes.ex_stop_time) and
gnec.state =1
</when>
<when test="state == 2">
and gnec.state = 2
</when>
<when test="state == 3">
and (((now() &gt; gnes.ex_stop_time) AND gnec.state = 1) ||
gnec.state = 3)
</when>
</choose>
</if>
<if test="redeemUid != null and redeemUid != ''">
and gnec.redeem_uid = #{redeemUid,jdbcType=VARCHAR}
</if>
<if test="skuId != null and skuId != ''">
and gnec.sku_id in
<foreach collection="skuId.split(',')" item="sId" open="(" separator="," close=")">
#{sId,jdbcType=VARCHAR}
</foreach>
</if>
<if test="isDrivi != null">
<choose>
<when test="isDrivi == 1">
and gnec.admin_uid = ''
</when>
<when test="isDrivi == 2">
and gnec.admin_uid != ''
</when>
</choose>
</if>
</where>
ORDER BY gnec.code desc
</select>
<select id="selectCodeAvailableByActivityId" resultMap="BeseResult">
select DISTINCT gnec.code,
gnec.code_id,
......
......@@ -3,48 +3,56 @@
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinNftOrderMapper">
<select id="searchList" resultType="com.liquidnet.service.goblin.dto.admin.GoblinNftOrderListDto">
select
a.user_id,a.order_code,a.order_type,a.pay_type,a.price_actual,a.status,a.pay_time,a.created_at,
b.name,
c.trading_at, c.nft_id
from goblin_nft_order as a
left join goblin_goods_sku as b on b.sku_id = a.sku_id
left join goblin_user_digital_artwork as c on c.order_id = a.order_id and c.del_flg = '0'
select c.trading_at, c.nft_id, a.* from (select
user_id,order_code,order_id,order_type,pay_type,price_actual,
status,pay_time,created_at,sku_title as name, mid, ex_code, box_sku_id
from goblin_nft_order
<where>
<if test="name!=''">
and b.name like concat('%', #{name}, '%')
and sku_title like concat('%', #{name}, '%')
</if>
<if test="userId!=''">
and a.user_id = #{userId}
and user_id = #{userId}
</if>
<if test="userMobile!=''">
and user_mobile = #{userMobile}
</if>
<if test="shortOrderCode!=''">
and a.order_code like concat('%', #{shortOrderCode}, '%')
and order_code like concat('%', #{shortOrderCode}, '%')
</if>
<if test="orderCode!=''">
and a.order_code = #{orderCode}
</if>
<if test="nftId!=''">
and c.nft_id = #{nftId}
and order_code = #{orderCode}
</if>
<if test="orderType != null and orderType!=''">
and a.order_type = #{orderType}
and order_type = #{orderType}
</if>
<if test="payType!=''">
and a.pay_type = #{payType}
and pay_type = #{payType}
</if>
<if test="status != null and status!=''">
and a.status = #{status}
and status = #{status}
</if>
<if test="payTimeStart != null and payTimeStart != ''">
<!-- and amo.payment_at &gt; #{paymentAtStart} -->
and a.pay_time <![CDATA[>=]]> #{payTimeStart}
and pay_time <![CDATA[>=]]> #{payTimeStart}
</if>
<if test="payTimeEnd != null and payTimeEnd != ''">
<!-- and amo.payment_at &lt; #{paymentAtEnd} -->
and a.pay_time <![CDATA[<=]]> #{payTimeEnd}
and pay_time <![CDATA[<=]]> #{payTimeEnd}
</if>
<if test="exCode!=''">
and ex_code = #{exCode}
</if>
</where>
) as a
left join goblin_user_digital_artwork as c on c.order_id = a.order_id and c.del_flg = '0'
<where>
<if test="nftId!=''">
and c.nft_id = #{nftId}
</if>
</where>
group by a.order_id
order by a.created_at desc
-- group by a.order_id
-- order by a.created_at desc
order by a.mid desc
</select>
</mapper>
......@@ -37,8 +37,17 @@
<if test="status != null and status!=''">
and d.status = #{status}
</if>
<if test="payTimeStart != null and payTimeStart != ''">
<!-- and amo.payment_at &gt; #{paymentAtStart} -->
and a.pay_time <![CDATA[>=]]> #{payTimeStart}
</if>
<if test="payTimeEnd != null and payTimeEnd != ''">
<!-- and amo.payment_at &lt; #{paymentAtEnd} -->
and a.pay_time <![CDATA[<=]]> #{payTimeEnd}
</if>
</where>
group by a.order_id
order by d.created_at desc
-- group by a.order_id
-- order by d.created_at desc
order by d.mid desc
</select>
</mapper>
......@@ -103,7 +103,8 @@
// LocalDateTime now = LocalDateTime.now();
//
// GoblinUserDigitalArtworkVo digitalArtworkVo = GoblinUserDigitalArtworkVo.getNew();
// String artworkId = IDGenerator.nextMilliId2();
//// String artworkId = IDGenerator.nextMilliId2();
// String artworkId = IDGenerator.nextSnowId();
// digitalArtworkVo.setArtworkId(artworkId);
// digitalArtworkVo.setSkuId(skuId);
// digitalArtworkVo.setUid(uid);
......
......@@ -185,7 +185,7 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
// 库存购买数量回滚
goblinNftUtils.decrSkuCountByUid(nftOrder.getUserId(), nftOrder.getSkuId(), nftOrder.getNum());
LocalDateTime nowTime = LocalDateTime.now();
if (StringUtils.isEmpty(nftOrder.getBoxSkuId())) {// 购买藏品
/*if (StringUtils.isEmpty(nftOrder.getBoxSkuId())) {// 购买藏品
GoblinListCollectVo goblinListCollectVo = goblinNftUtils.getCollectByNowNext(nowTime, nftOrder.getSkuId());
String listId = (null == goblinListCollectVo) ? null : goblinListCollectVo.getListId();
log.debug("listId : {}", listId);
......@@ -195,6 +195,14 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
String listId = (null == goblinListCollectVo) ? null : goblinListCollectVo.getListId();
log.debug("listId : {}", listId);
goblinNftUtils.incrSkuStock(listId, nftOrder.getBoxSkuId(), nftOrder.getNum());
}*/
GoblinListCollectVo goblinListCollectVo = goblinNftUtils.getCollectByNowNext(nowTime, nftOrder.getSkuId());
String listId = (null == goblinListCollectVo) ? null : goblinListCollectVo.getListId();
log.debug("listId : {}",listId);
if (StringUtils.isEmpty(nftOrder.getBoxSkuId())) {// 购买藏品
goblinNftUtils.incrSkuStock(listId, nftOrder.getSkuId(), nftOrder.getNum());
} else {// 购买盲盒
goblinNftUtils.incrSkuStock(listId, nftOrder.getBoxSkuId(), nftOrder.getNum());
}
// 订单状态
......
......@@ -103,7 +103,8 @@ package com.liquidnet.service.consumer.slowly.receiver;//package com.liquidnet.s
// LocalDateTime now = LocalDateTime.now();
//
// GoblinUserDigitalArtworkVo digitalArtworkVo = GoblinUserDigitalArtworkVo.getNew();
// String artworkId = IDGenerator.nextMilliId2();
//// String artworkId = IDGenerator.nextMilliId2();
// String artworkId = IDGenerator.nextSnowId();
// digitalArtworkVo.setArtworkId(artworkId);
// digitalArtworkVo.setSkuId(skuId);
// digitalArtworkVo.setUid(uid);
......
......@@ -172,7 +172,11 @@ public class ZxinUserCommonBiz {
userIdentification = nft003Resp.getData().getUserIdentification();
isRealNameAuthSuccess = true;
}else{
throw new GalaxyNftUserException(nft003Resp.getCode(),nft003Resp.getMessage());
if(nft003Resp.getCode().equals(ZxlErrorEnum.SERVER_INNER_ERROR.getCode())){
throw new ZxlNftException(nft003Resp.getCode(),nft003Resp.getMessage());
}else{
throw new GalaxyNftUserException(nft003Resp.getCode(),nft003Resp.getMessage());
}
}
//如果实名认证成功,并且该身份证已经开通过数字账户
......@@ -291,8 +295,8 @@ public class ZxinUserCommonBiz {
//是否开通数字账户
boolean isOpenAccount = false;
//开通失败错误信息
String resultCode = null;
String resultMessage = null;
String resultCode = NftAccStatusEnum.StatusAcc.ING.getCode();
String resultMessage = NftAccStatusEnum.StatusAcc.ING.getMsg();
//实名成功+绑定区块链地址成功
if(isRealNameAuthSuccess && isBindBlockAddressSuccess){
......@@ -305,8 +309,13 @@ public class ZxinUserCommonBiz {
if(!isOpenAccount){
//实名失败
if(!isRealNameAuthSuccess){
resultCode = NftAccStatusEnum.StatusAcc.FAILURE1.getCode();
resultMessage = NftAccStatusEnum.StatusAcc.FAILURE1.getMsg();
if(StringUtil.isNotEmpty(bizFailDesc)){
resultCode = NftAccStatusEnum.StatusAcc.FAILURE1.getCode();
resultMessage = NftAccStatusEnum.StatusAcc.FAILURE1.getMsg();
}else if(StringUtil.isNotEmpty(sysFailDesc)){
resultCode = NftAccStatusEnum.StatusAcc.FAILURE2.getCode();
resultMessage = NftAccStatusEnum.StatusAcc.FAILURE2.getMsg();
}
}else{
//地址绑定失败
if(!isBindBlockAddressSuccess){
......@@ -350,7 +359,7 @@ public class ZxinUserCommonBiz {
}
//设置错误信息到redis
if(StringUtil.isNotEmpty(resultCode)&&!resultCode.equalsIgnoreCase(NftAccStatusEnum.StatusAcc.SUCCESS.getCode())){
if(StringUtil.isNotEmpty(resultCode)&&resultCode.equalsIgnoreCase(NftAccStatusEnum.StatusAcc.FAILURE1.getCode())){
//开户失败记录缓存 {goblin:nft:certmeta:{idType+idNo},{idname,mobile}}
dataUtils.getRedisUtil().set(GoblinRedisConst.REDIS_GOBLIN_NFT_CERTMETA_JUNK.concat(reqDto.getIdCardType().concat(reqDto.getIdCard()))
,reqDto.getUserName().concat(",").concat(reqDto.getMobile()),openAccFailKeyExpireTime);
......
USE dev_ln_scene;
ALTER TABLE goblin_nft_order ADD list_id VARCHAR(64) NOT NULL DEFAULT '' COMMENT '分批购ID' after user_mobile;
ALTER TABLE goblin_nft_order ADD ex_code VARCHAR(64) NOT NULL DEFAULT '' COMMENT '兑换码' after list_id;
\ No newline at end of file
package com.liquidnet.service.goblin.controller;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.StringUtil;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinFrontHotWord;
import com.liquidnet.service.goblin.service.GoblinFrontService;
import com.liquidnet.service.goblin.service.impl.GoblinFrontServiceImpl;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -134,9 +131,9 @@ public class GoblinFrontController {
@GetMapping("searchGoodesName")
@ApiOperation("搜索商品名字、或商铺名字")
public ResponseDto<List<GoblinGoodsInfoListVo>> searchGoodesName(@RequestParam(name = "name", required = true) String name) throws ParseException {
public ResponseDto<GoblinGoodsInfoListVoo> searchGoodesName(@RequestParam(name = "name", required = true) String name,@RequestParam(name = "page", required = true) int page,@RequestParam(name = "pageSize", required = true) int pageSize) throws ParseException {
if (StringUtil.isNotBlank(name)) {
return ResponseDto.success(goblinFrontService.searchGoodesName(name));
return ResponseDto.success(goblinFrontService.searchGoodesName(name,page,pageSize));
}
return ResponseDto.success(null);
}
......
......@@ -380,6 +380,8 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
}
goblinFrontCubeVo.setGoblinGoodsInfoVoList(goblinGoodsInfoVoArrayList);
}else{
return null;
}
return goblinFrontCubeVo;
}
......@@ -463,7 +465,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
}
public List<GoblinGoodsInfoListVo> searchGoodesName(String name) {
public GoblinGoodsInfoListVoo searchGoodesName(String name,int page,int pageSize) {
List<String> listStore = mongoUtils.getStoreInfoVoRegexName(name);
Pattern pattern = Pattern.compile("^.*" + name + ".*$", Pattern.CASE_INSENSITIVE);
Query query = new Query();
......@@ -475,11 +477,15 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
),
new Criteria().orOperator(Criteria.where("spuType").exists(false), (Criteria.where("spuType").is(0)))
));
query.with(PageRequest.of(0, 20)).with(Sort.by(
long count = mongoTemplate.count(query, GoblinGoodsInfoVo.class.getSimpleName());
query.with(PageRequest.of(page, pageSize)).with(Sort.by(
//Sort.Order.desc("count"),
Sort.Order.desc("shelvesAt")
));
List<GoblinGoodsInfoVo> list = mongoTemplate.find(query, GoblinGoodsInfoVo.class, GoblinGoodsInfoVo.class.getSimpleName());
GoblinGoodsInfoListVoo goblinGoodsInfoListVoo=GoblinGoodsInfoListVoo.getNew();
goblinGoodsInfoListVoo.setCount(count);
ArrayList<GoblinGoodsInfoListVo> list1 = ObjectUtil.getGoblinGoodsInfoListVo();
//遍历
for (GoblinGoodsInfoVo goblinGoodsInfoVo : list) {
......@@ -507,7 +513,9 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
list1.add(goblinGoodsInfoListVo);
}
}
return list1;
goblinGoodsInfoListVoo.setList(list1);
return goblinGoodsInfoListVoo;
//return list1;
}
public GoblinFrontCategoryListVo getStoreGoodes(String storeId, String categoryId, String name) {
......
......@@ -147,7 +147,8 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
GoblinGoodsSkuInfoVo skuInfoVo = (GoblinGoodsSkuInfoVo) map.get("vo");
Integer tagType = (Integer) map.get("tagType");
String listId = (String) map.get("listId");
LocalDateTime baseSaleStartTime = (LocalDateTime) map.get("baseSaleStartTime");
LocalDateTime baseSaleStartTime = (LocalDateTime) map.get("baseSaleStartTime");
LocalDateTime nextSaleStartTime = (LocalDateTime) map.get("nextSaleStartTime");
if (goblinRedisUtils.getSkuAllStatusShow(skuInfoVo)) {
//获取预约相关
AnticipateValueVo anticipateValueVo = goblinGoodsAnticipateMgService.getAnticipateValueBySkuId(skuId, 1);
......@@ -178,6 +179,8 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
nftGoodsSkuInfoVo.setTagType(tagType);
nftGoodsSkuInfoVo.setListId(listId);
nftGoodsSkuInfoVo.setBaseSaleStartTime(baseSaleStartTime);
nftGoodsSkuInfoVo.setNextSaleStartTime(nextSaleStartTime);
// 是否开启兑换
nftGoodsSkuInfoVo.setIsExchange(goblinRedisUtils.getIsExchange(skuId));
return nftGoodsSkuInfoVo;
......
......@@ -77,6 +77,9 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
LocalDateTime now = LocalDateTime.now(), toCheckTime = now.minusSeconds(15);
for (int i = 0, subSize = subArtworkIdList.size(); i < subSize; i++) {
GoblinUserDigitalArtworkVo userDigitalArtworkVo = goblinRedisUtils.getUserDigitalArtworkVo(subArtworkIdList.get(i));
if (null == userDigitalArtworkVo || !userDigitalArtworkVo.getUid().equals(uid)) {
continue;
}
GoblinGoodsSkuInfoVo goodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(userDigitalArtworkVo.getSkuId());
GoblinUserDigitalArtworkListVo listVo = GoblinUserDigitalArtworkListVo.getNew().copy(userDigitalArtworkVo);
......@@ -188,7 +191,8 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
userDigitalArtworkBoxVo.setDeletedAt(now);
// if (goblinMongoUtils.updateUserDigitalArtworkVoByUnboxing(userDigitalArtworkBoxVo)) {
String artworkId = IDGenerator.nextMilliId2();
// String artworkId = IDGenerator.nextMilliId2();
String artworkId = IDGenerator.nextSnowId();
String orderId = userDigitalArtworkBoxVo.getOrderId();
GoblinNftOrderVo orderVo = goblinRedisUtils.getGoblinNftOrder(orderId);
......@@ -206,7 +210,9 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
// unboxDigitalArtworkListVo.setOpeningTime(now);
String skuId = orderVo.getBoxSkuId(), spuId = orderVo.getSpuId();
Integer source = 1;
// Integer source = 1;
Integer orderType = orderVo.getOrderType();
Integer source = orderType == 1 ? 1 : (orderType == 2 ? 2 : (orderType == 3 ? 3 : (orderType == 4 ? 31 : 0)));
// if (goblinRedisUtils.hasGenUserDigitalArtwork(uid, skuId, orderId)) {// 已生成
// log.warn("#UNBOX_ARTWORK EXIST_ART[uid={},skuId={},orderId={},source={}]", uid, skuId, orderId, source);
// return unboxDigitalArtworkListVo;
......
......@@ -105,6 +105,9 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
@Override
public PagedResult<GoblinStoreMgtGoodsSkuListVo> skusList(GoblinStoreMgtGoodsSkuFilterParam mgtGoodsSkuFilterParam) {
if(mgtGoodsSkuFilterParam.getType()==null){
mgtGoodsSkuFilterParam.setType(0);
}
PagedResult<GoblinStoreMgtGoodsSkuListVo> voList = goblinMongoUtils.getSkuSearch(mgtGoodsSkuFilterParam);
return voList;
}
......
......@@ -1645,19 +1645,27 @@ public class GoblinMongoUtils {
mgtGoodsSkuListVo.setSurplusStock(redisUtils.getSkuStock(null, vo.getSkuId()));
} else {
List<String> skuIdList = redisUtils.getGoodsInfoVo(vo.getSpuId()).getSkuIdList();
int restStock = 0;
int stock = 0;
for (String skuIdItem : skuIdList) {// 盲盒计算所有sku库存总数
if (skuIdItem.equals(vo.getSkuId())) {// 过滤自己
continue;
}
GoblinGoodsSkuInfoVo itemVo = redisUtils.getGoodsSkuInfoVo(skuIdItem);
if ("4".equals(filterParam.getShelvesStatus())) {
stock += redisUtils.getSkuAllStatusStockStatus4(itemVo);
} else {
stock += redisUtils.getSkuAllStatusStock(itemVo, null);
if (filterParam.getType().equals(0)) {
if ("4".equals(filterParam.getShelvesStatus())) {
restStock += redisUtils.getSkuAllStatusStockStatus4(itemVo);
} else {
restStock += redisUtils.getSkuAllStatusStock(itemVo, null);
}
} else if (filterParam.getType().equals(1)) {
restStock += redisUtils.getSkuAllStatusStockType1(itemVo);
}
stock +=redisUtils.getSkuTotalStockShelvesStatus3(itemVo);
}
mgtGoodsSkuListVo.setSurplusStock(stock);
mgtGoodsSkuListVo.setSurplusStock(restStock);
mgtGoodsSkuListVo.setSkuStock(stock);
}
mgtGoodsSkuListVo.setSysTime(sysTime);
voList.add(mgtGoodsSkuListVo);
......
package com.liquidnet.service.goblin.util;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.entity.GoblinGoodsSku;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@Component
public class GoblinNftBoxUtils {
@Autowired
GoblinRedisUtils redisUtils;
/**
* 获取每个sku的兑换码生成数量
* <p>
* sku兑换码数 = 生码总数 * sku概率/总概率
* 若sku兑换码数 > sku剩余库存
* 用 sku兑换码数 - sku剩余库存 * (其他sku概率/其他总概率)
* <p>
* 例:生成兑换码 120 有sku1,sku2,sku3
* sku1 库存5 概率 10%
* sku2 库存100 概率 20%
* sku3 库存100 概率 30%
* <p>
* sku1兑换码数=120 * (10/60) = 20 >5
* sku2兑换码数=120 * (20/60) = 40 <100
* sku3兑换码数=120 * (30/60) = 60 <100
* <p>
* sku2第二轮兑换码数 = (20-5) * (20/50) = 6 < 60
* sku3第二轮兑换码数 = (20-5) * (30/50) = 9 < 40
* <p>
* 总兑换码 = sku1兑换码数+sku2兑换码数+sku3兑换码数+sku2第二轮兑换码数+sku3第二轮兑换码数
*
* @return
*/
public Map<String, Integer> getSkuHitRatio(Integer exStock, Map<String, BigDecimal> map) {
// 获取sku总概率
BigDecimal hitRatioCount = new BigDecimal(0);
// Map<String, Map<String, Object>> mapMap = new HashMap<>();
// sku --> 概率/库存
Integer countStockNumber = 0;
HashMap<String, Map<String, Object>> mapMap = CollectionUtil.mapHashMap();
for (String key : map.keySet()) {
BigDecimal skuHitRatio = BigDecimal.valueOf(Double.valueOf(map.get(key).toString()));
HashMap<String, Object> objectMap = CollectionUtil.mapStringObject();
if (skuHitRatio == null) {
continue;
}
hitRatioCount = hitRatioCount.add(skuHitRatio);
objectMap.put("hitRatio", skuHitRatio);
objectMap.put("stock", redisUtils.getSkuStock(null,key));
countStockNumber += redisUtils.getSkuStock(null,key);
mapMap.put(key, objectMap);
}
// sku ---> 库存
HashMap<String, Integer> stockMap = CollectionUtil.mapStringInteger();
ArrayList<String> eliminateSkuIdList = CollectionUtil.arrayListString();
getStock(exStock, hitRatioCount, mapMap, stockMap, countStockNumber, eliminateSkuIdList);
return stockMap;
}
/**
* 获取单个sku库存
*
* @param exStock
* @param hitRatioCount
* @param mapMap
* @return
*/
private static void getStock(Integer exStock, BigDecimal hitRatioCount, Map<String, Map<String, Object>> mapMap, Map<String, Integer> stockMap, Integer countStockNumber, ArrayList<String> eliminateSkuIdList) {
if (exStock <= 0 || countStockNumber == 0) {
return;
}
// 单个sku ---> 当前循环权重
HashMap<String, BigDecimal> bigDecimalHashMap = CollectionUtil.mapStringBigDecimal();
int subNumber = 0;
for (String key : mapMap.keySet()) {
Object stock = mapMap.get(key).get("stock");
Object hitRatio = mapMap.get(key).get("hitRatio");
if (Integer.valueOf(stock.toString()) <= 0) {
continue;
}
BigDecimal bigDecimal = BigDecimal.valueOf(exStock).multiply((new BigDecimal(hitRatio.toString()).divide(hitRatioCount, 5, BigDecimal.ROUND_HALF_UP)));
bigDecimalHashMap.put(key, bigDecimal);
// 要减去的库存
int subStock = BigDecimal.valueOf(exStock).multiply((new BigDecimal(hitRatio.toString()).divide(hitRatioCount, 5, BigDecimal.ROUND_HALF_UP))).setScale(0, BigDecimal.ROUND_UP).intValue();
if (subStock > Integer.valueOf(stock.toString())) {
subNumber += Integer.valueOf(stock.toString());
countStockNumber -= Integer.valueOf(stock.toString());
mapMap.get(key).put("stock", 0);
if (stockMap.get(key) == null) {
stockMap.put(key, Integer.valueOf(stock.toString()));
} else {
stockMap.put(key, stockMap.get(key) + Integer.valueOf(stock.toString()));
}
} else {
countStockNumber -= subStock;
mapMap.get(key).put("stock", Integer.valueOf(stock.toString()) - subStock);
subNumber += subStock;
if (stockMap.get(key) == null) {
stockMap.put(key, subStock);
} else {
stockMap.put(key, stockMap.get(key) + subStock);
}
}
}
if (subNumber > exStock) {
int usNumber = subNumber - exStock;
ArrayList<String> skuIdList = CollectionUtil.arrayListString();
for (int k = 0; k < usNumber; k++) {
String subKey = "";
double maxValue = Double.MAX_VALUE;
for (String key : bigDecimalHashMap.keySet()) {
if (skuIdList.contains(key) || stockMap.get(key) == 0) {
continue;
}
Double compare = Double.valueOf(bigDecimalHashMap.get(key).toString());
if (maxValue > compare) {
maxValue = compare;
subKey = key;
}
}
Integer stock = stockMap.get(subKey);
stockMap.put(subKey, stock - 1);
skuIdList.add(subKey);
}
return;
}
exStock -= subNumber;
if (exStock > 0) {
for (String key : mapMap.keySet()) {
Object hitRatio = mapMap.get(key).get("hitRatio");
Object stock = mapMap.get(key).get("stock");
if (Integer.valueOf(stock.toString()) <= 0 && !eliminateSkuIdList.contains(key)) {
eliminateSkuIdList.add(key);
hitRatioCount = hitRatioCount.subtract(new BigDecimal(hitRatio.toString()));
}
}
getStock(exStock, hitRatioCount, mapMap, stockMap, countStockNumber, eliminateSkuIdList);
}
}
// 各种状态下判断藏品是否可以展示
public boolean getSkuAllStatusShow(GoblinGoodsSkuInfoVo info) {
if (
info != null
&& info.getSkuType() == 1
&& info.getStatus().equals("3")
&& info.getShelvesStatus().equals("3")
// && (info.getSkuAppear() == null || info.getSkuAppear().equals("0"))
&& info.getDelFlg().equals("0")
) {
return true;
} else {
return false;
}
}
/**
* 整理map集合中存在空概率的值
*
* @param map,hitRatioCount
*/
public void arrangeHitRatioMap(Map<String, BigDecimal> map, BigDecimal hitRatioCount) {
// 定义最大概率
BigDecimal maxHitRatio = new BigDecimal(100);
// 剩余概率
BigDecimal remainHitRatio = maxHitRatio.subtract(hitRatioCount);
// 获取值为空的数量
int number = 0;
for (String key : map.keySet()) {
if (map.get(key) == null) {
number++;
}
}
// 平均值
BigDecimal averageNumber = remainHitRatio.divide(BigDecimal.valueOf(number), 2, BigDecimal.ROUND_DOWN);
for (String key : map.keySet()) {
if (map.get(key) == null) {
map.put(key, averageNumber);
}
}
}
// 获取盲盒下藏品的库存 各种状态下不能算库存的排除掉
public int getSkuAllStatusStock(GoblinGoodsSkuInfoVo info) {
if (
info != null
// && LocalDateTime.now().isAfter(info.getSaleStartTime())
&& (null == info.getSoldoutStatus() || info.getSoldoutStatus().equals("0"))
&& (null == info.getHitRatio() || info.getHitRatio().compareTo(BigDecimal.ZERO) > 0)
) {// 可以返回库存
return (int)redisUtils.getSkuStock(null,info.getSkuId());
} else {// 不计入库存
return 0;
}
}
}
......@@ -106,8 +106,9 @@ public class GoblinOrderUtils {
}
HashMap<String, Object> map = redisUtils.getGoodsSkuInfoVo(LocalDateTime.now(), skuIdItem);
GoblinGoodsSkuInfoVo itemVo = (GoblinGoodsSkuInfoVo) map.get("vo");
String listId2 = (String) map.get("listId");
surplusStock += redisUtils.getSkuAllStatusStock(itemVo, listId2);
// String listId2 = (String) map.get("listId");
// surplusStock += redisUtils.getSkuAllStatusStock(itemVo, listId2);
surplusStock += redisUtils.getSkuAllStatusStock(itemVo, listId);
totalStock += redisUtils.getSkuTotalStock(itemVo);
}
}
......
......@@ -422,12 +422,21 @@ public class GoblinNftOrderUtils {
public int getSkuAllStatusStock(String listId, GoblinGoodsSkuInfoVo info) {
if (
info != null
&& LocalDateTime.now().isAfter(info.getSaleStartTime())
// && LocalDateTime.now().isAfter(info.getSaleStartTime())
&& (null == info.getSoldoutStatus() || info.getSoldoutStatus().equals("0"))
&& (null == info.getSkuCanbuy() || info.getSkuCanbuy().equals("1"))
&& (null == info.getHitRatio() || info.getHitRatio().compareTo(BigDecimal.ZERO) > 0)
) {// 可以返回库存
return goblinRedisUtils.getSkuStock(listId, info.getSkuId());
// 外面只有盲盒才能请求进来 里面只有不是分批购才判断盲盒里藏品的开售时间
if (null == listId) {
if (LocalDateTime.now().isAfter(info.getSaleStartTime())) {
return goblinRedisUtils.getSkuStock(listId, info.getSkuId());
} else {
return 0;
}
} else {
return goblinRedisUtils.getSkuStock(listId, info.getSkuId());
}
} else {// 不计入库存
return 0;
}
......
......@@ -47,7 +47,7 @@ goblin_order.store.refundLog=INSERT INTO goblin_back_order_log (`back_order_log_
goblin_order.store.backOrder=INSERT INTO goblin_back_order (`back_order_id`,`back_code`,`order_id`,`order_code`,`store_id`,`user_id`,`sku_id_nums`,`type`,`reason`,`describes`,`real_back_price`,`status`,`created_at`,`audit_at`,`error_reason`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
#-------- NFT -------
goblin_nft_order.insert=INSERT INTO goblin_nft_order (`order_id`,`spu_id`,`sku_id`,`box_sku_id`,`num`,`store_id`,`store_name`,`order_code`,`user_id`,`user_name`,`user_mobile`,`price_total`,`price_coupon`,`store_price_coupon`,`price_red_envelope`,`price_voucher`,`price_actual`,`ucoupon_id`,`store_coupon_id`,`red_envelope_code`,`status`,`source`,`order_type`,`pay_type`,`device_from`,`version`,`pay_countdown_minute`,`ip_address`,`created_at`,`pay_code`,sku_title) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_nft_order.insert=INSERT INTO goblin_nft_order (`order_id`,`spu_id`,`sku_id`,`box_sku_id`,`num`,`store_id`,`store_name`,`order_code`,`user_id`,`user_name`,`user_mobile`,`price_total`,`price_coupon`,`store_price_coupon`,`price_red_envelope`,`price_voucher`,`price_actual`,`ucoupon_id`,`store_coupon_id`,`red_envelope_code`,`status`,`source`,`order_type`,`pay_type`,`device_from`,`version`,`pay_countdown_minute`,`ip_address`,`created_at`,`pay_code`,sku_title,list_id,ex_code) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_nft_order.update.pay=UPDATE goblin_nft_order SET payment_type = ?, payment_id=?, pay_code = ?, pay_time = ?, status = ?, updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
goblin_nft_order.update.refund=UPDATE goblin_nft_order SET status = ?, updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
goblin_nft_order_refund.insert=INSERT INTO goblin_nft_order_refund (`order_refund_id`,`refund_code`,`order_id`,`order_code`,`store_id`,`user_id`,`price`,`status`,`error_reason`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?)
......
package com.liquidnet.service.platform.controller.goblin;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.service.IGoblinExportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -11,6 +12,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
......@@ -32,6 +34,7 @@ public class GoblinExportDataController {
*/
@GetMapping("/exportMallOrder")
@ApiOperation(value = "excel订单信息导出")
@ResponseBody
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "beginTime", value = "开始时间"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "storeId", value = "店铺id"),
......@@ -39,9 +42,9 @@ public class GoblinExportDataController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "state", value = "状态逗号隔开字符串[0-待付款(用户刚下单)|2-代发货(用户付完款 等待商城发货)|3-代收货(商城已经发货 等待用户确认收货)|4-已完成(用户已经确认收货 订单结束)|5-取消订单(用户未付款前取消订单)|6-退款通过(用户已经付款但是商城还未发货,用户发出退款申请,商城同意退款)|7-退货通过(用户已经确认收货后用户发出退货申请,商城同意所有退货申请 ,一个订单可能有多个单品)|61-6的发起状态|71-7的发起状态】"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "mailType", value = "快递状态[0-全部|1-未发货|2-已发货]"),
})
public void exportMallOrder(HttpServletResponse response, @RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime,
@RequestParam("state") String state, @RequestParam("mailType") Integer mailType, @RequestParam("storeId") String storeId) {
iGoblinExportService.exportMallOrder(response, beginTime, endTime, state, mailType, storeId);
public ResponseDto<String> exportMallOrder(HttpServletResponse response, @RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime,
@RequestParam("state") String state, @RequestParam("mailType") Integer mailType, @RequestParam("storeId") String storeId) {
return iGoblinExportService.exportMallOrder(response, beginTime, endTime, state, mailType, storeId);
}
}
......@@ -4,8 +4,10 @@ package com.liquidnet.service.platform.controller.kylin;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dto.vo.KylinTimePerformanceVo;
import com.liquidnet.service.kylin.dto.vo.PerformanceOrderStatisticalVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import com.liquidnet.service.kylin.service.partner.IKylinPerformancesPartnerService;
import com.liquidnet.service.platform.utils.PerformanceVoTask;
import com.mongodb.BasicDBObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
......@@ -14,6 +16,7 @@ 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.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
......@@ -70,6 +73,11 @@ public class KylinPerformancesController {
performancesPartnerService.outLinePerformance(item.getPerformanceId());
log.info("[FINISH OUT LINE TASK] performanceId = " + item.getPerformanceId() + " time = " + item.getTime());
}
if (item.getTaskType() != 0) {
mongoTemplate.getCollection(KylinTimePerformanceVo.class.getSimpleName()).updateMany(
Query.query(Criteria.where("performanceId").is(item.getPerformanceId())).getQueryObject(),
Update.update("taskType", 0).getUpdateObject());
}
}
}
return ResponseDto.success(true);
......
......@@ -31,7 +31,7 @@ public class GoblinExportServiceImpl implements IGoblinExportService {
GoblinStoreOrderMapper goblinStoreOrderMapper;
@Override
public ResponseDto<Boolean> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType, String storeId) {
public ResponseDto<String> exportMallOrder(HttpServletResponse response, String beginTime, String endTime, String state, Integer mailType, String storeId) {
if (!timeIsNotNull(beginTime, endTime)) {
return ResponseDto.failure("起始和结束时间不能为空!");
}
......@@ -145,6 +145,8 @@ public class GoblinExportServiceImpl implements IGoblinExportService {
.head(head(header))
// 当然这里数据也可以用 List<List<String>> 去传入
.doWrite(objectList);
}else{
return ResponseDto.failure("无数据");
}
} catch (Exception e) {
e.printStackTrace();
......
......@@ -284,7 +284,7 @@ public class GoblinNftExCodeServiceImpl implements IGoblinNftExCodeService {
// PageHelper.startPage(goblinNftExCodeParam.getPageNum(), 20, true);
List<GoblinNftExCode> goblinNftExCodes = goblinNftExCodeMapper.selectGoblinNftCode(goblinNftExCode);
List<GoblinNftExCode> goblinNftExCodes = goblinNftExCodeMapper.selectGoblinNftCodeExcel(goblinNftExCode);
StringBuffer skuIds = new StringBuffer();
StringBuffer acticityIds = new StringBuffer();
......
......@@ -190,26 +190,30 @@ public class GoblinNftExCodeTaskServiceImpl implements IGoblinNftExCodeTaskServi
Boolean bolTime = false;
if (!StringUtil.isEmpty(goblinNftExSkuVo)) {
// redis存储 单个sku的开始和结束时间
LocalDateTime rdExStartTime = LocalDateTime.parse(goblinNftExSkuVo.getRdStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
LocalDateTime rdExStopTime = LocalDateTime.parse(goblinNftExSkuVo.getRdStopTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
// 时间比对
if (exStartTime.isBefore(rdExStartTime)) {
if (goblinNftExSkuVo.getExStartTime() != null && exStartTime.isBefore(goblinNftExSkuVo.getExStartTime())) { // 当操作时间小于red存储时间时为true
goblinNftExSku.setExStartTime(exStartTime);
goblinNftExSku.setRdStartTime(exStartTime.toString());
bolTime = true;
}else {
goblinNftExSku.setExStartTime(goblinNftExSkuVo.getExStartTime());
goblinNftExSku.setRdStartTime(goblinNftExSkuVo.getExStartTime().toString());
}
if (exStopTime.isAfter(rdExStopTime)) {
if (goblinNftExSkuVo.getExStopTime() != null && exStopTime.isAfter(goblinNftExSkuVo.getExStopTime())) { // 当操作时间大于red存储时间为true
goblinNftExSku.setExStopTime(exStopTime);
goblinNftExSku.setRdStopTime(exStopTime.toString());
bolTime = true;
}else {
goblinNftExSku.setExStopTime(goblinNftExSkuVo.getExStopTime());
goblinNftExSku.setRdStopTime(goblinNftExSkuVo.getExStopTime().toString());
}
} else {
bolTime = true;
goblinNftExSku.setExStartTime(exStartTime);
goblinNftExSku.setExStopTime(exStopTime);
goblinNftExSku.setRdStartTime(exStartTime.toString());
goblinNftExSku.setExStopTime(exStopTime);
goblinNftExSku.setRdStopTime(exStopTime.toString());
}
......@@ -242,8 +246,6 @@ public class GoblinNftExCodeTaskServiceImpl implements IGoblinNftExCodeTaskServi
LocalDateTime localDateTime2 = LocalDateTime.parse(time2, dtf2);
System.out.println(localDateTime2.isBefore(LocalDateTime.now()));//你的时间小于当前时间是true
System.out.println(localDateTime2.isAfter(LocalDateTime.now()));//你的时间小于在当前时间是false
}
......
......@@ -106,10 +106,18 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
List<GoblinGoodsSku> goblinGoodsSkus = goblinGoodsSkuMapper.selectBySpuIds(spuIds.toString());
int countStockNumber = 0;
int checkNumberSku = 0;
// 是否存在概率为空
boolean isHit = false;
// 概率相加
BigDecimal hitRatioCount = new BigDecimal(0);
for (GoblinGoodsSku goblinGoodsSku : goblinGoodsSkus) {
if (goblinGoodsSku.getUnbox().equals("1")) {
continue;
}
// 判断开售、停售时间
LocalDateTime saleStartTime = goblinGoodsSku.getSaleStartTime();
LocalDateTime saleStopTime = goblinGoodsSku.getSaleStopTime();
......@@ -124,8 +132,15 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
if (!goblinGoodsSku.getSkuCanbuy().equals("1")) {
continue;
}
// 不能购买的 没库存的 概率是0的 过滤
if (getSkuAllStatusShow(goblinGoodsSku) && goblinRedisUtils.getSkuAllStatusStock(goblinGoodsSku) > 0 && goblinGoodsSku.getHitRatio() != null) {
if (getSkuAllStatusShow(goblinGoodsSku) && goblinRedisUtils.getSkuAllStatusStock(goblinGoodsSku) > 0) {
log.debug("skuId:"+goblinGoodsSku.getSkuId()+"----hitRatio:"+goblinGoodsSku.getHitRatio());
if (goblinGoodsSku.getHitRatio() == null) {
isHit = true;
} else {
hitRatioCount = hitRatioCount.add(goblinGoodsSku.getHitRatio());
}
countStockNumber += goblinRedisUtils.getSkuStock(goblinGoodsSku.getSkuId());
map.put(goblinGoodsSku.getSkuId(), goblinGoodsSku.getHitRatio());
checkNumberSku++;
......@@ -140,6 +155,12 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
ResponseDto.failure("配置库存大于sku总库存!");
}
if (isHit && hitRatioCount.doubleValue() < 100.00 && map.size() > 0) {
arrangeHitRatioMap(map, hitRatioCount);
}
}
......@@ -220,6 +241,7 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
return ResponseDto.success(true);
}
/**
* 获取每个sku的兑换码生成数量
* <p>
......@@ -284,50 +306,94 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
Map<String, Map<String, Object>> mapMap = new HashMap<>();
Map<String, Object> objectMap = new HashMap<>();
objectMap.put("hitRatio", 30);
objectMap.put("stock", 900);
objectMap.put("hitRatio", 3.33);
objectMap.put("stock", 100);
mapMap.put("1", objectMap);
Map<String, Object> objectMap1 = new HashMap<>();
objectMap1.put("hitRatio", 0.3);
objectMap1.put("stock", 9);
objectMap1.put("hitRatio", 57.7);
objectMap1.put("stock", 20);
mapMap.put("2", objectMap1);
Map<String, Object> objectMap2 = new HashMap<>();
objectMap2.put("hitRatio", 23.3);
objectMap2.put("stock", 697);
objectMap2.put("hitRatio", 9);
objectMap2.put("stock", 30);
mapMap.put("3", objectMap2);
Map<String, Object> objectMap3 = new HashMap<>();
objectMap3.put("hitRatio", 2.2);
objectMap3.put("stock", 66);
objectMap3.put("hitRatio", 1);
objectMap3.put("stock", 50);
mapMap.put("4", objectMap3);
Map<String, Object> objectMap4 = new HashMap<>();
/* Map<String, Object> objectMap4 = new HashMap<>();
objectMap4.put("hitRatio", 26.7);
objectMap4.put("stock", 797);
objectMap4.put("stock", 165);
mapMap.put("5", objectMap4);
Map<String, Object> objectMap5 = new HashMap<>();
objectMap5.put("hitRatio", 2.2);
objectMap5.put("stock", 66);
objectMap5.put("stock", 12);
mapMap.put("6", objectMap5);
Map<String, Object> objectMap6 = new HashMap<>();
objectMap6.put("hitRatio", 15.3);
objectMap6.put("stock", 458);
mapMap.put("7", objectMap6);
objectMap6.put("hitRatio", 15.6);
objectMap6.put("stock", 90);
mapMap.put("7", objectMap6);*/
Map<String, Integer> stockMap = new HashMap<>();
ArrayList<String> eliminateSkuIdList = CollectionUtil.arrayListString();
getStock(594, new BigDecimal(100), mapMap, stockMap, 2993, eliminateSkuIdList);
getStock(155, new BigDecimal(71.03), mapMap, stockMap, 179, eliminateSkuIdList);
for (String key : stockMap.keySet()) {
System.out.println("skuId" + key + "***********数量" + stockMap.get(key));
System.out.println("skuId:" + key + "***********数量:" + stockMap.get(key));
}
System.out.println("kkk");
/* Map<String, BigDecimal> hmap = new HashMap<>();
hmap.put("1", new BigDecimal(40));
hmap.put("2", new BigDecimal(49));
hmap.put("3", null);
hmap.put("4", null);
hmap.put("5", null);
arrangeHitRatioMap(hmap, new BigDecimal(89));
for (String key : hmap.keySet()) {
}*/
}
/**
* 整理map集合中存在空概率的值
*
* @param map,hitRatioCount
*/
private static void arrangeHitRatioMap(Map<String, BigDecimal> map, BigDecimal hitRatioCount) {
// 定义最大概率
BigDecimal maxHitRatio = new BigDecimal(100);
// 剩余概率
BigDecimal remainHitRatio = maxHitRatio.subtract(hitRatioCount);
// 获取值为空的数量
int number = 0;
for (String key : map.keySet()) {
if (map.get(key) == null) {
number++;
}
}
// 平均值
BigDecimal averageNumber = remainHitRatio.divide(BigDecimal.valueOf(number), 2, BigDecimal.ROUND_DOWN);
for (String key : map.keySet()) {
if (map.get(key) == null) {
map.put(key, averageNumber);
}
}
}
/**
* 获取单个sku库存
*
......@@ -351,11 +417,11 @@ public class GoblinNftExSkuServiceImpl implements IGoblinNftExSkuService {
continue;
}
BigDecimal bigDecimal = BigDecimal.valueOf(exStock).multiply((new BigDecimal(hitRatio.toString()).divide(hitRatioCount, 2, BigDecimal.ROUND_HALF_UP)));
BigDecimal bigDecimal = BigDecimal.valueOf(exStock).multiply((new BigDecimal(hitRatio.toString()).divide(hitRatioCount, 5, BigDecimal.ROUND_HALF_UP)));
bigDecimalHashMap.put(key, bigDecimal);
// 要减去的库存
int subStock = BigDecimal.valueOf(exStock).multiply((new BigDecimal(hitRatio.toString()).divide(hitRatioCount, 2, BigDecimal.ROUND_HALF_UP))).setScale(0, BigDecimal.ROUND_UP).intValue();
int subStock = BigDecimal.valueOf(exStock).multiply((new BigDecimal(hitRatio.toString()).divide(hitRatioCount, 5, BigDecimal.ROUND_HALF_UP))).setScale(0, BigDecimal.ROUND_UP).intValue();
if (subStock > Integer.valueOf(stock.toString())) {
subNumber += Integer.valueOf(stock.toString());
......
......@@ -257,12 +257,11 @@ public class GoblinRedisUtils {
*/
public GoblinNftExSkuVo getSkuTime(String skuId) {
String key = GoblinRedisConst.ACTIVITY_SKU_TIME.concat(skuId);
GoblinNftExSkuVo goblinNftExSkuVo = null;
if (!StringUtil.isEmpty(getRedis().get(key))){
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.convertValue (getRedis().get(key), GoblinNftExSkuVo.class);
Object val = getRedis().get(key);
if (!StringUtil.isEmpty(val)){
return (GoblinNftExSkuVo)val;
}
return goblinNftExSkuVo;
return null;
}
/**
......
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