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

Commit 1bbc2fdf authored by Administrator's avatar Administrator 🎨

Merge branch 'pre' into 'master'

Pre

See merge request !247
parents 6716f87c c5e12ba3
......@@ -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());
}*/
}
......@@ -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) {
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);
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;
}
......
......@@ -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;
/**
* 应付金额
*/
......
......@@ -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>
......@@ -170,7 +170,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);
......@@ -180,6 +180,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());
}
// 订单状态
......
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);
}
......
package com.liquidnet.service.goblin.controller;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
import java.util.SimpleTimeZone;
@Slf4j
//@Api(tags = "正在下单相关")
@RestController
@RequestMapping("/zhengzai/app")
public class testController {
public static void main(String[] args) {
/*SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
DateFormat dateInstance = SimpleDateFormat.getDateInstance();
String format = dateInstance.format("2022-01-01 22:22:22");
Date parse = simpleDateFormat.parse("2022-01-01 22:22:22");
DateTimeFormatter.ofLocalizedTime();
Calendar.getInstance()*/
}
}
class person implements Comparable {
@Override
public int compareTo(Object o) {
return 0;
}
}
class eumue {
private final String name;
private final int num;
private eumue(String name, int num) {
this.name = name;
this.num = num;
}
}
\ No newline at end of file
......@@ -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) {
......
......@@ -148,6 +148,7 @@ public class GoblinNftGoodsAppServiceImpl implements IGoblinNftGoodsAppService {
Integer tagType = (Integer) map.get("tagType");
String listId = (String) map.get("listId");
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;
......
......@@ -14,19 +14,16 @@ import com.liquidnet.service.goblin.param.GoblinListCreateItemParam;
import com.liquidnet.service.goblin.param.GoblinListCreateParam;
import com.liquidnet.service.goblin.param.GoblinListUpdateParam;
import com.liquidnet.service.goblin.service.manage.IGoblinListService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.ObjectUtil;
import com.liquidnet.service.goblin.util.QueueUtils;
import com.liquidnet.service.goblin.util.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.*;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
......@@ -39,6 +36,7 @@ import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
* @since 2022-04-29
*/
@Service
@Slf4j
public class GoblinListServiceImpl implements IGoblinListService {
@Autowired
......@@ -47,6 +45,8 @@ public class GoblinListServiceImpl implements IGoblinListService {
GoblinMongoUtils mongoUtils;
@Autowired
QueueUtils queueUtils;
@Autowired
GoblinNftBoxUtils nftBoxUtils;
@Override
public ResponseDto<PageInfo<GoblinListVo>> getList(String name, Integer page) {
......@@ -78,7 +78,16 @@ public class GoblinListServiceImpl implements IGoblinListService {
for (GoblinListDetailsItemVo item : vo.getItemVo()) {
GoblinGoodsSkuInfoVo skuVo = redisUtils.getGoodsSkuInfoVo(item.getSkuId());
item.setSkuName(skuVo.getName());
if (skuVo.getUnbox().equals("1")) {
int stock = 0;
ArrayList<String> skuIdList = redisUtils.getGoblinListRelationBox(skuVo.getSkuId(), vo.getListId());
for (String relationSkuId : skuIdList) {
stock += redisUtils.getSkuStock(listId, relationSkuId);
}
item.setSurplusStock(stock);
} else {
item.setSurplusStock(redisUtils.getSkuStock(listId, skuVo.getSkuId()));
}
// if (skuVo.getUnbox().equals("0")) {
// item.setSurplusStock(redisUtils.getSkuStock(null, item.getSkuId()));
// item.setStock(skuVo.getSkuStock());
......@@ -116,7 +125,7 @@ public class GoblinListServiceImpl implements IGoblinListService {
return ResponseDto.failure("只能配置一个sku");
}
//判断重名
if(mongoUtils.hasGoblinListDetailsVoByName(param.getName())){
if (mongoUtils.hasGoblinListDetailsVoByName(param.getName())) {
return ResponseDto.failure("活动名称重复");
}
String skuId = param.getItemParams().get(0).getSkuId();
......@@ -135,7 +144,7 @@ public class GoblinListServiceImpl implements IGoblinListService {
collectVos = redisUtils.getGoblinListCollect(skuId);
boolean isSame = judgeTime(st, et, collectVos);
if(isSame){
if (isSame) {
return ResponseDto.failure("sku时间不能重合");
}
for (GoblinListCollectVo collectItem : collectVos) {
......@@ -199,6 +208,74 @@ public class GoblinListServiceImpl implements IGoblinListService {
itemVo.setSkuStock(item.getSkuStock());
itemVo.setProductId(item.getProductId());
voItemList.add(itemVo);
if (skuInfoVo.getUnbox().equals("1")) {//盲盒逻辑
//计算盲盒对应sku数量
HashMap<String, BigDecimal> map = CollectionUtil.mapStringBigDecimal();
GoblinGoodsInfoVo spuInfoVo = redisUtils.getGoodsInfoVo(item.getSpuId());
// int countStockNumber = 0;
// int checkNumberSku = 0;
// 是否存在概率为空
boolean isHit = false;
// 概率相加
BigDecimal hitRatioCount = new BigDecimal(0);
for (String itemSkuId : spuInfoVo.getSkuIdList()) {
GoblinGoodsSkuInfoVo skuItemVo = redisUtils.getGoodsSkuInfoVo(itemSkuId);
if (skuItemVo.getUnbox().equals("1")) {
continue;
}
// // 判断开售、停售时间
// LocalDateTime saleStartTime = skuItemVo.getSaleStartTime();
// LocalDateTime saleStopTime = skuItemVo.getSaleStopTime();
// LocalDateTime nowTime = LocalDateTime.now();
// if (nowTime.isBefore(saleStartTime)) {
// continue;
// } else if (null != saleStopTime && nowTime.isAfter(saleStopTime)) {
// continue;
// }
//是否购买
if (!skuItemVo.getSkuCanbuy().equals("1")) {
continue;
}
if (nftBoxUtils.getSkuAllStatusShow(skuItemVo) && nftBoxUtils.getSkuAllStatusStock(skuItemVo) > 0) {
if (skuItemVo.getHitRatio() == null) {
isHit = true;
} else {
hitRatioCount = hitRatioCount.add(skuItemVo.getHitRatio());
}
// countStockNumber += goblinRedisUtils.getSkuStock(goblinGoodsSku.getSkuId());
map.put(skuItemVo.getSkuId(), skuItemVo.getHitRatio());
// checkNumberSku++;
}
}
// if (checkNumberSku <= 0) {
// return ResponseDto.failure("盲盒下没有可生成兑换码的sku!");
// }
//
// if (countStockNumber < stockNumber) {
// ResponseDto.failure("配置库存大于sku总库存!");
// }
if (isHit && hitRatioCount.doubleValue() < 100.00 && map.size() > 0) {
nftBoxUtils.arrangeHitRatioMap(map, hitRatioCount);
}
Map<String, Integer> skuMap = nftBoxUtils.getSkuHitRatio(item.getSkuStock(), map);
for (String key : skuMap.keySet()) {
Integer stockNum = skuMap.get(key);
//库存
int skuStock = redisUtils.decrSkuStock(null, key, stockNum);
log.info("盲盒库存 SKUID = " + key + " 数量 = " + stockNum);
if (skuStock < 0) {
redisUtils.incrSkuStock(null, key, stockNum);
return ResponseDto.failure("库存不足");
} else {
redisUtils.setSkuStock(vo.getListId(), key, stockNum);
redisUtils.addGoblinListRelationBox(itemVo.getSkuId(), vo.getListId(), key);
}
}
} else {//非盲盒逻辑
//库存
int skuStock = redisUtils.decrSkuStock(null, itemVo.getSkuId(), itemVo.getSkuStock());
if (skuStock < 0) {
......@@ -207,6 +284,8 @@ public class GoblinListServiceImpl implements IGoblinListService {
} else {
redisUtils.setSkuStock(vo.getListId(), itemVo.getSkuId(), itemVo.getSkuStock());
}
}
//集合
GoblinListCollectVo collectVo = GoblinListCollectVo.getNew();
collectVo.setSpuId(itemVo.getSpuId());
......@@ -215,7 +294,7 @@ public class GoblinListServiceImpl implements IGoblinListService {
collectVo.setPriceV(itemVo.getPriceV());
collectVo.setProductId(itemVo.getProductId());
collectVo.setWhiteType(vo.getWhiteType());
if(vo.getWhiteType().equals(1) && vo.getWhiteUrl().equals("")){
if (vo.getWhiteType().equals(1) && vo.getWhiteUrl().equals("")) {
collectVo.setWhiteType(-1);
}
collectVo.setTimeStart(st);
......@@ -277,7 +356,7 @@ public class GoblinListServiceImpl implements IGoblinListService {
for (GoblinListCollectVo itemVo : collectVos) {
if (itemVo.getListId().equals(param.getListId())) {
itemVo.setWhiteType(vo.getWhiteType());
if(vo.getWhiteType().equals(1) && vo.getWhiteUrl().equals("")){
if (vo.getWhiteType().equals(1) && vo.getWhiteUrl().equals("")) {
itemVo.setWhiteType(-1);
}
break;
......@@ -306,11 +385,23 @@ public class GoblinListServiceImpl implements IGoblinListService {
queueUtils.sendMsgByRedisXls(vo.getListId(), "", vo.getBlackUrl(), "4", item.getSkuId());
}
//获取skuVo
GoblinGoodsSkuInfoVo skuVo = redisUtils.getGoodsSkuInfoVo(vo.getItemVo().get(0).getSkuId());
if (skuVo.getUnbox().equals("1")) {
ArrayList<String> skuIdList = redisUtils.getGoblinListRelationBox(skuVo.getSkuId(), vo.getListId());
for (String relationSkuId : skuIdList) {
int restStock = redisUtils.getSkuStock(vo.getListId(), relationSkuId);
if (restStock > 0) {
redisUtils.incrSkuStock(null, relationSkuId, restStock);
}
}
} else {
//库存
int restStock = redisUtils.getSkuStock(vo.getListId(), vo.getItemVo().get(0).getSkuId());
if (restStock > 0) {
redisUtils.incrSkuStock(null, vo.getItemVo().get(0).getSkuId(), restStock);
}
}
redisUtils.delGoblinListCollect(vo.getItemVo().get(0).getSkuId(), listId);
redisUtils.delGoblinListDetailsVo(listId);
......
......@@ -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 (filterParam.getType().equals(0)) {
if ("4".equals(filterParam.getShelvesStatus())) {
stock += redisUtils.getSkuAllStatusStockStatus4(itemVo);
restStock += redisUtils.getSkuAllStatusStockStatus4(itemVo);
} else {
stock += redisUtils.getSkuAllStatusStock(itemVo, null);
restStock += redisUtils.getSkuAllStatusStock(itemVo, null);
}
} else if (filterParam.getType().equals(1)) {
restStock += redisUtils.getSkuAllStatusStockType1(itemVo);
}
mgtGoodsSkuListVo.setSurplusStock(stock);
stock +=redisUtils.getSkuTotalStockShelvesStatus3(itemVo);
}
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)
) {// 可以返回库存
// 外面只有盲盒才能请求进来 里面只有不是分批购才判断盲盒里藏品的开售时间
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,
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) {
iGoblinExportService.exportMallOrder(response, beginTime, endTime, state, mailType, storeId);
return iGoblinExportService.exportMallOrder(response, beginTime, endTime, state, mailType, storeId);
}
}
......@@ -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();
......
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