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

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

Merge branch 'pre' into 'master'

Pre

See merge request !350
parents a61dd493 9756887a
......@@ -10,7 +10,7 @@ import java.io.Serializable;
@Data
public class AdamMemberRightsCouponRuleVo implements Serializable, Cloneable {
private static final long serialVersionUID = 4282440130223655255L;
@ApiModelProperty(value = "适用范围[100-全场|90-演出|91-场次|92-票|80-商品|81-款式]", example = "90")
@ApiModelProperty(value = "适用范围[101-音乐节|102-小型演出(livehouse演出) |103-巡演|100-全场|90-演出|91-场次|92-票|80-商品|81-款式]", example = "90")
private Integer useScope;
@ApiModelProperty(value = "适用名称", example = "北京草莓")
private String busiName;
......
......@@ -38,4 +38,17 @@ public class CandyRedisConst {
* </value>
*/
public static final String BASIC_COMMON_COUPON = PREFIX.concat("basic:common_coupon");
/**
* <key>
* candy:basic:user_coupon_assoc:${ucouponId}
* </key>
* <value>
* com.liquidnet.service.candy.dto.CandyUserCouponAssocDto
* </value>
*/
public static final String BASIC_USER_COUPON_ASSOC = PREFIX.concat("basic:user_coupon_assoc:");
/**
* 发放券操作人-券类商品下单
*/
public static final String OPERATOR_MGT_COUPON_BY_SKU = "COUPON_SKU";
}
......@@ -9,7 +9,7 @@ import javax.validation.constraints.Pattern;
@ApiModel(value = "CandyCouponRuleBuildParam", description = "添加券规则入参")
public class CandyCouponRuleBuildParam {
@Pattern(regexp = "\\b(100|90|91|92|80|81)\\b", message = "适用范围无效")
@ApiModelProperty(required = true, value = "适用范围[100-全场|90-演出|91-场次|92-票|80-商品|81-款式]", allowableValues = "100,90,91,92,80,81")
@ApiModelProperty(required = true, value = "适用范围[101-音乐节|102-小型演出(livehouse演出) |103-巡演|100-全场|90-演出|91-场次|92-票|80-商品|81-款式]", allowableValues = "100,90,91,92,80,81")
private Integer useScope;
@ApiModelProperty(required = true, value = "适用名称", allowableValues = "适用名称")
private String busiName;
......
......@@ -28,9 +28,9 @@ public interface ICandyCouponService {
List<CandyCouponVo> memberCoupon(String mCouponId);
CandyMyCouponListVo preUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId, Integer type);
CandyMyCouponListVo preUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId, Integer type,int perType,int isTrueName);
Integer preCanUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId);
Integer preCanUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId,int perType,int isTrueName);
CandyMyCouponListVo preUseGoodCoupon(BigDecimal priceTotal, String goodId, Integer type,String uid);
......@@ -40,7 +40,7 @@ public interface ICandyCouponService {
Integer stateCoupon(String uCouponId);
CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, String goodIds,String uid);
CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, String goodIds,String uid,int perType);
Boolean useBackCoupon(List<BackCouponParam> backCouponParam);
......
......@@ -12,7 +12,7 @@ public class CandyCouponRulesVo implements Serializable,Cloneable {
private static final long serialVersionUID = 4073256621782131607L;
@ApiModelProperty(value = "适用范围[100-全场|90-演出|91-场次|92-票|80-商品|81-款式]",example = "90")
@ApiModelProperty(value = "适用范围[101-音乐节|102-小型演出(livehouse演出) |103-巡演|100-全场|90-演出|91-场次|92-票|80-商品|81-款式]",example = "90")
private Integer useScope;
@ApiModelProperty(value = "适用名称",example = "北京草莓")
private String busiName;
......
......@@ -118,6 +118,8 @@ public class GoblinRedisConst {
public static final String REDIS_GOBLIN_STORE_MARKET_ISCONFIG = PREFIX.concat("store:is_config:");//商铺活动-该活动配置了款式的商品
public static final String REDIS_GOBLIN_BUY_COUNT = PREFIX.concat("uid:");//用户sku购买数量 key:uid:skuId:$skuId
public static final String REDIS_GOBLIN_BUY_COUNT_IDNO = PREFIX.concat("idno:%s:%s:%s");// 实名sku购买数量 key:$idType:$idNo:$skuId
public static final String REDIS_GOBLIN_SALE_COUNT = PREFIX.concat("sale:skuId:");//用户sku购买数量 key:sale:skuId:$skuId
public static final String REDIS_GOBLIN_SALE_SPU_COUNT = PREFIX.concat("sale:spuId:");//用户sku购买数量 key:sale:skuId:$spuId
public static final String REDIS_GOBLIN_ORDER = PREFIX.concat("order:");//用户sku购买数量 key:$orderId
......
......@@ -16,4 +16,10 @@ public class GoblinOrderSkuParam {
private String spuId;
@ApiModelProperty(required = true, value = "数量")
private Integer number;
@ApiModelProperty(required = false, value = "关联人证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照")
private Integer idType;
@ApiModelProperty(required = false, value = "关联人姓名")
private String idName;
@ApiModelProperty(required = false, value = "关联人证件号码")
private String idNo;
}
......@@ -169,6 +169,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
} else {
vo.setSpuNo(this.getSpuNo());
}
vo.setSpuType(0);
vo.setName(this.getName());
vo.setSubtitle(this.getSubtitle());
vo.setSellPrice(this.getSellPrice());
......@@ -227,6 +228,7 @@ public class GoblinStoreMgtGoodsAddParam implements Serializable {
vo.setStoreId(this.getStoreId());
vo.setSpuId(this.getSpuId());
vo.setSpuNo(this.getSpuNo());
vo.setSpuType(0);
vo.setName(this.getName());
vo.setSubtitle(this.getSubtitle());
vo.setSellPrice(this.getSellPrice());
......
package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSpecValueVo;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSpecVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ApiModel(value = "GoblinStoreMgtGoodsCouponAddParam", description = "商品管理:添加券类商品入参")
@Data
public class GoblinStoreMgtGoodsCouponAddParam implements Serializable {
private static final long serialVersionUID = -6261151635859590265L;
@ApiModelProperty(position = 10, required = true, value = "店铺ID")
@NotNull(message = "店铺ID不能为空")
private String storeId;
@ApiModelProperty(position = 11, required = false, value = "商品ID[编辑时必传]")
private String spuId;
/**
* ---------------------------- 基本信息 ----------------------------
**/
@ApiModelProperty(position = 12, required = true, value = "商品名称[36]")
@NotBlank(message = "商品名称不能为空")
@Size(max = 36, message = "商品名称长度超限")
private String name;
// @ApiModelProperty(position = 13, required = false, value = "商品名称[128]")
// @Size(max = 128, message = "商品副名称长度超限")
// private String subtitle;//-
// @ApiModelProperty(position = 14, required = false, value = "商品销售价-原价[20,2]")
// private BigDecimal sellPrice;//-
@ApiModelProperty(position = 15, required = true, value = "商品一级分类ID[30]")
@NotBlank(message = "商品分类ID不能为空")
private String cateFid;
@ApiModelProperty(position = 16, required = true, value = "商品二级分类ID[30]")
private String cateSid;
@ApiModelProperty(position = 17, required = true, value = "商品三级分类ID[30]")
private String cateTid;
@ApiModelProperty(position = 18, required = false, value = "商品简介[256]", example = "商品简介...")
@Size(max = 256, message = "商品简介内容过长")
private String intro;
@ApiModelProperty(position = 19, required = false, value = "商品标签列表")
private List<String> tagList;
@ApiModelProperty(position = 20, required = true, value = "商品图片列表")
private List<String> imageList;
@ApiModelProperty(position = 21, required = false, value = "商品图片封面")
@Size(max = 256, message = "商品图片封面URL过长")
private String coverPic;
@ApiModelProperty(position = 22, required = false, value = "商品视频地址")
@Size(max = 256, message = "商品视频地址URL过长")
private String video;
/**
* ---------------------------- 价格库存 ----------------------------
**/
// @ApiModelProperty(position = 23, required = false, value = "规格展现方式[1-常规|2-组合]", allowableValues = "1,2", example = "1")
// @NotBlank(message = "规格展现方式不能为空")
// @Pattern(regexp = "\\b(1|2)\\b", message = "规格展现方式参数无效")
// private String specMode;
@ApiModelProperty(position = 24, required = false, value = "SKU规格信息[初次添加商品必填]")
// @NotNull(message = "SKU规格信息不能为空")
@Valid
private GoblinStoreMgtGoodsCouponAddSkuParam skuParam;
// @ApiModelProperty(position = 25, required = false, value = "物流模版", example = "松鼠德邦")
// @Size(max = 50, message = "物流模版ID过长")
// private String logisticsTemplate;//-
@ApiModelProperty(position = 26, required = false, value = "商品编码[默认为系统编码,也可手动输入商家自己的编码]")
@Pattern(regexp = LnsRegex.Valid.ALPHABET_NUMBER_UNDER_50, message = "商品编码格式或长度有误")
private String spuNo;
// @ApiModelProperty(position = 26, required = false, value = "ERP类型[WANGDIAN-旺店通]")
// @Pattern(regexp = "\\b(WANGDIAN)\\b", message = "ERP类型无效")
// private String erpType;//-
// @ApiModelProperty(position = 26, required = false, value = "ERP货品编号[商品对应在ERP的商品编码,默认为空]")
// @Size(max = 40, message = "ERP货品编号长度限制40")
// private String spuErpCode;//-
/**
* ---------------------------- 商品介绍 ----------------------------
**/
@ApiModelProperty(position = 27, required = true, value = "商品详情", example = "商品详情...")
@Size(max = 10000, message = "商品详情内容过长")
private String details;
/**
* ---------------------------- 销售属性 ----------------------------
**/
@ApiModelProperty(position = 28, required = true, value = "上架处理方式[1-等待手动上架|2-直接上架售卖|3-预约定时上架]", example = "1")
@NotNull(message = "上架处理方式不能为空")
@Pattern(regexp = "\\b(1|2|3)\\b", message = "规格展现方式参数无效")
private String shelvesHandle;
@ApiModelProperty(position = 29, required = false, value = "预约上架时间[yyyy-MM-dd HH:mm:ss][上架处理方式为3-预约定时上架时需要指定]")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "预约上架时间格式有误")
private String shelvesTime;
// @ApiModelProperty(position = 30, required = false, value = "商品有效期[yyyy-MM-dd]")
// @Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "商品有效期格式有误")
// private String spuValidity;
// @ApiModelProperty(position = 31, required = false, value = "是否虚拟商品[0-否|1-是]", allowableValues = "0,1", example = "0")
// @Pattern(regexp = "\\b(0|1)\\b", message = "是否虚拟商品参数无效")
// private String virtualFlg;//---默认1
/**
* ---------------------------- 服务保障 ----------------------------
**/
@ApiModelProperty(position = 32, required = false, value = "商品服务支持ID列表")
private List<String> ssidList;
/**
* ---------------------------- 专属标签 ----------------------------
**/
@ApiModelProperty(position = 33, required = false, value = "商品关联音乐人、艺术家、品牌方、厂牌列表")
private List<String> extagList;
/**
* ---------------------------- AR标签 ----------------------------
**/
@ApiModelProperty(position = 33, required = false, value = "商品关联音乐人、艺术家、品牌方、厂牌、AR列表")
private List<String> artagList;
/**
* 生成券类SPU
*
* @return GoblinGoodsInfoVo
*/
public GoblinGoodsInfoVo initGoodsInfoVo(String currentUid, LocalDateTime nowTime) {
GoblinGoodsInfoVo vo = GoblinGoodsInfoVo.getNew();
vo.setStoreId(this.getStoreId());
if (StringUtils.isBlank(this.getSpuId())) {
vo.setSpuId(IDGenerator.nextMilliId2());
} else {
vo.setSpuId(this.getSpuId());
}
if (StringUtils.isBlank(this.getSpuNo())) {
vo.setSpuNo(vo.getSpuId());
} else {
vo.setSpuNo(this.getSpuNo());
}
vo.setSpuType(2);
vo.setName(this.getName());
// vo.setSubtitle(this.getSubtitle());
// vo.setSellPrice(this.getSellPrice());
// vo.setPriceGe(BigDecimal.ZERO);
// vo.setPriceLe(BigDecimal.ZERO);
vo.setIntro(this.getIntro());
vo.setDetails(this.getDetails());
vo.setCoverPic(StringUtils.isBlank(this.getCoverPic()) ? this.getImageList().get(0) : this.getCoverPic());
vo.setVideo(this.getVideo());
vo.setSpecMode("1");
vo.setCateFid(this.getCateFid());
vo.setCateSid(this.getCateSid());
vo.setCateTid(this.getCateTid());
vo.setShelvesHandle(this.getShelvesHandle());
vo.setShelvesTime(this.getShelvesTime());
// vo.setSpuValidity(this.getSpuValidity());
vo.setVirtualFlg("1");
vo.setStatus("3");
// vo.setReason(null);
// vo.setShelvesStatus("0");
if (vo.getShelvesHandle().equals("2")) {
vo.setShelvesStatus("3");// `上架处理方式`:2-直接上架售卖,直接上架
vo.setShelvesAt(LocalDateTime.now());
} else {
vo.setShelvesStatus("0");
}
vo.setSpuAppear("0");
vo.setDelFlg("0");
// vo.setShelvesAt(null);
vo.setImageList(this.getImageList());
vo.setLogisticsTemplate("");
vo.setCreatedBy(currentUid);
vo.setCreatedAt(nowTime);
// vo.setUpdatedBy();
// vo.setUpdatedAt();
// vo.setSpecVoList();
// vo.setTagVoList();
// vo.setServiceSupportVoList();
// vo.setExtagVoList();
// vo.setErpType(StringUtils.isBlank(this.getErpType()) ? "WANGDIAN" : this.getErpType());
// vo.setSpuErpCode(StringUtils.trim(this.getSpuErpCode()));
return vo;
}
/**
* 编辑SPU参数整理
*
* @return GoblinGoodsInfoVo
*/
public GoblinGoodsInfoVo initEditGoodsInfoVo() {
GoblinGoodsInfoVo vo = GoblinGoodsInfoVo.getNew();
vo.setStoreId(this.getStoreId());
vo.setSpuId(this.getSpuId());
if (StringUtils.isBlank(this.getSpuNo())) {
vo.setSpuNo(vo.getSpuId());
} else {
vo.setSpuNo(this.getSpuNo());
}
vo.setSpuType(2);
vo.setName(this.getName());
// vo.setSubtitle(this.getSubtitle());
// vo.setSellPrice(this.getSellPrice());
vo.setIntro(this.getIntro());
vo.setDetails(this.getDetails());
vo.setCoverPic(StringUtils.isBlank(this.getCoverPic()) ? this.getImageList().get(0) : this.getCoverPic());
vo.setVideo(this.getVideo());
vo.setSpecMode("1");
vo.setCateFid(this.getCateFid());
vo.setCateSid(this.getCateSid());
vo.setCateTid(this.getCateTid());
vo.setShelvesHandle(this.getShelvesHandle());
vo.setShelvesTime(this.getShelvesTime());
// vo.setSpuValidity(this.getSpuValidity());
vo.setVirtualFlg("1");
vo.setImageList(this.getImageList());
vo.setLogisticsTemplate("");
// vo.setErpType();// 暂不考虑更改ERP类型
// vo.setSpuErpCode(StringUtils.trim(this.getSpuErpCode()));
return vo;
}
/**
* 生成SKU列表以及SPU规格等信息
*
* @param goodsInfoVo GoblinGoodsInfoVo
* @param vos List<GoblinGoodsSkuInfoVo>
* @param goodsSpecVos List<GoblinGoodsSpecVo>
*/
public void initGoodsSkuInfoVo(GoblinGoodsInfoVo goodsInfoVo, List<GoblinGoodsSkuInfoVo> vos,
List<GoblinGoodsSpecVo> goodsSpecVos) {
GoblinGoodsSkuInfoVo skuInfoVo = GoblinGoodsSkuInfoVo.getNew();
GoblinStoreMgtGoodsCouponAddSkuParam addSkuParam = this.getSkuParam();
{// 券信息设置
skuInfoVo.setIsTrueName(null == addSkuParam.getIsTrueName() ? 1 : Integer.valueOf(addSkuParam.getIsTrueName()));// 券类商品默认需要实名登记
skuInfoVo.setBusiType(1);// 业务类别暂时只支持演出
skuInfoVo.setCouType(1);// 券类型暂时只支持代金券
skuInfoVo.setUseScope(Integer.valueOf(addSkuParam.getUseScope()));
skuInfoVo.setValFace(addSkuParam.getValFace());
skuInfoVo.setValidity(-1);
skuInfoVo.setEffectAt(DateUtil.Formatter.yyyyMMddHHmmss.parse(addSkuParam.getEffectAt()));
skuInfoVo.setExpireAt(DateUtil.Formatter.yyyyMMddHHmmss.parse(addSkuParam.getExpireAt()));
}
if (StringUtils.isBlank(addSkuParam.getSkuId())) {
skuInfoVo.setSkuId(goodsInfoVo.getSpuId().concat(StringUtils.right(String.valueOf(System.nanoTime()), 5)));
} else {
skuInfoVo.setSkuId(addSkuParam.getSkuId());
}
skuInfoVo.setSpuId(goodsInfoVo.getSpuId());
// if (StringUtils.isNotBlank(addSkuParam.getSkuNo())) {
// skuInfoVo.setSkuNo(addSkuParam.getSkuNo());
// } else {
skuInfoVo.setSkuNo(goodsInfoVo.getSpuNo());
// }
// if (StringUtils.isNotBlank(addSkuParam.getSkuBarCode())) {
// skuInfoVo.setSkuBarCode(addSkuParam.getSkuBarCode());
// } else {
skuInfoVo.setSkuBarCode(goodsInfoVo.getSpuNo());
// }
skuInfoVo.setSkuType(2);
skuInfoVo.setName("张");
skuInfoVo.setSubtitle(goodsInfoVo.getSubtitle());
skuInfoVo.setSkuPic(goodsInfoVo.getCoverPic());// 默认使用SPU的
skuInfoVo.setSkuIsbn("");
skuInfoVo.setStock(addSkuParam.getStock());
skuInfoVo.setSkuStock(skuInfoVo.getStock());
// skuInfoVo.setWarningStock(addSkuParam.getWarningStock());
// skuInfoVo.setSellPrice(addSkuParam.getSellPrice());
skuInfoVo.setPrice(addSkuParam.getPrice());
// skuInfoVo.setPriceMember(null == addSkuParam.getPriceMember() ? addSkuParam.getPrice() : addSkuParam.getPriceMember());
skuInfoVo.setPriceMember(addSkuParam.getPrice());
// skuInfoVo.setWeight(addSkuParam.getWeight());
// skuInfoVo.setBuyFactor(addSkuParam.getBuyFactor());
skuInfoVo.setBuyFactor("0");
// skuInfoVo.setBuyRoster(addSkuParam.getBuyRoster());
skuInfoVo.setBuyLimit(addSkuParam.getBuyLimit());
skuInfoVo.setStoreId(goodsInfoVo.getStoreId());
// skuInfoVo.setSkuValidity(DateUtil.Formatter.yyyyMMddHHmmss.parse(addSkuParam.getSkuValidity()));
skuInfoVo.setVirtualFlg("1");
skuInfoVo.setStatus("3");// 没有审核流程,默认通过
// skuInfoVo.setReason();
skuInfoVo.setShelvesStatus(goodsInfoVo.getShelvesStatus());
skuInfoVo.setSkuAppear("0");
skuInfoVo.setDelFlg("0");
// skuInfoVo.setShelvesAt();
skuInfoVo.setCreatedBy(goodsInfoVo.getCreatedBy());
skuInfoVo.setCreatedAt(goodsInfoVo.getCreatedAt());
// skuInfoVo.setUpdatedBy();
// skuInfoVo.setUpdatedAt();
skuInfoVo.setLogisticsTemplate("");
// skuInfoVo.setSkuErpCode(StringUtils.trim(addSkuParam.getSkuErpCode()));
skuInfoVo.setErpType(goodsInfoVo.getErpType());
// skuInfoVo.setErpWarehouseNo(StringUtils.trim(addSkuParam.getErpWarehouseNo()));
// if (StringUtils.equals(addSkuParam.getErpHosting(), "1")) {
// skuInfoVo.setErpHosting(1);
// if (StringUtils.isBlank(goodsInfoVo.getSpuErpCode())) {
// ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("149022");
// throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
// }
// if (StringUtils.isBlank(skuInfoVo.getSkuErpCode())) {
// ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("149023");
// throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
// }
// if (StringUtils.isBlank(skuInfoVo.getErpWarehouseNo())) {
// ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("149024");
// throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
// }
// } else {
skuInfoVo.setErpHosting(0);
// }
{// 规格信息处理
// 券类商品固定规格
GoblinGoodsSpecDto goblinGoodsSpecDto = GoblinGoodsSpecDto.getNew();
goblinGoodsSpecDto.setSpecName("规格");
goblinGoodsSpecDto.setSpecVname("张");
// SKU规格设置
List<GoblinGoodsSpecDto> skuSpecList = new ArrayList<>();
skuSpecList.add(goblinGoodsSpecDto);
skuInfoVo.setSkuSpecList(skuSpecList);
// SPU规格集合
GoblinGoodsSpecValueVo specValueVo = GoblinGoodsSpecValueVo.getNew().setSpecVname(goblinGoodsSpecDto.getSpecVname()).setSpecVsort(0);
ArrayList<GoblinGoodsSpecValueVo> specValueVos = new ArrayList<>();
specValueVos.add(specValueVo);
goodsSpecVos.add(GoblinGoodsSpecVo.getNew().setSpecName(goblinGoodsSpecDto.getSpecName()).setSpecSort(0).setSpecValues(specValueVos));
}
vos.add(skuInfoVo);
List<String> skuIdList = CollectionUtil.arrayListString();
skuIdList.add(skuInfoVo.getSkuId());
goodsInfoVo.setPriceGe(skuInfoVo.getPrice());
goodsInfoVo.setPriceLe(skuInfoVo.getPrice());
goodsInfoVo.setSpecVoList(goodsSpecVos);
goodsInfoVo.setSkuIdList(skuIdList);
}
}
package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
@ApiModel(value = "GoblinStoreMgtGoodsCouponAddSkuParam", description = "商品管理:添加券类商品:添加券SKU入参")
@Data
public class GoblinStoreMgtGoodsCouponAddSkuParam implements Serializable {
private static final long serialVersionUID = 7886534346305369761L;
@ApiModelProperty(position = 10, required = false, value = "单品ID[编辑时必传]")
private String skuId;
// @ApiModelProperty(position = 11, required = false, value = "单品编码[默认为系统编码,也可手动输入商家自己的编码]")
// @Pattern(regexp = LnsRegex.Valid.ALPHABET_NUMBER_UNDER_50, message = "单品编码格式或长度有误")
// private String skuNo;
// @ApiModelProperty(position = 12, required = false, value = "单品条码")
// @Pattern(regexp = LnsRegex.Valid.ALPHABET_NUMBER_32, message = "单品条码格式或长度有误")
// private String skuBarCode;
// @ApiModelProperty(position = 13, required = false, value = "ERP商家编码")
// @Size(max = 40, message = "ERP商家编码长度限制40")
// private String skuErpCode;//-
// @ApiModelProperty(position = 14, required = false, value = "ERP托管[0-否|1-是],默认0")
// @Pattern(regexp = "\\b(0|1)\\b", message = "ERP托管参数无效")
// private String erpHosting;//-
// @ApiModelProperty(position = 15, required = false, value = "ERP仓库编号")
// @Size(max = 40, message = "ERP仓库编号长度限制40")
// private String erpWarehouseNo;//-
// @ApiModelProperty(position = 16, required = false, value = "单品默认图片的url[256]")
// @NotBlank(message = "单品图片不能为空")
// private String skuPic;
@ApiModelProperty(position = 12, required = false, value = "单品规格信息")
// @NotNull(message = "规格信息不能为空")
// @Valid// 初始化写死['规格':'张']
private List<GoblinGoodsSpecDto> skuSpecList;
// @ApiModelProperty(position = 18, required = false, value = "单品销售价-原价[20,2]")
// private BigDecimal sellPrice;
@ApiModelProperty(position = 19, required = true, value = "单品现价[20,2]")
@Digits(integer = 6, fraction = 2, message = "参数'单品现价'无效")
@DecimalMin(value = "0.01", message = "参数'单品现价'必须为大于0")
private BigDecimal price;
// @ApiModelProperty(position = 20, required = false, value = "单品会员价格[20,2]")
// @NotNull(message = "单品会员价格不能为空")
// @Min(value = 0, message = "单品会员价格不能小于0")
// private BigDecimal priceMember;
// @ApiModelProperty(position = 21, required = false, value = "单品的重量[20,2]")
// private BigDecimal weight;//-
@ApiModelProperty(position = 20, required = true, value = "总库存")
@Min(value = 0, message = "总库存不能小于0")
private Integer stock;
// @ApiModelProperty(position = 21, required = false, value = "预警库存")
// private Integer warningStock;
// @ApiModelProperty(position = 22, required = false, value = "ISBN,针对CD/图书等[100]")
// private String skuIsbn;//-
// @ApiModelProperty(position = 23, required = false, value = "购买限制[0-全部用户|1-仅会员|2-指定用户]")
// @NotNull(message = "购买限制不能为空")
// private String buyFactor;
// @ApiModelProperty(position = 24, required = false, value = "购买限制人员名单[购买限制为2-指定用户时必填]")
// private String buyRoster;
@ApiModelProperty(position = 25, required = false, value = "限量[0-无限制|X:限购数量]")
private Integer buyLimit;
// @ApiModelProperty(position = 26, required = false, value = "单品有效期[yyyy-MM-dd HH:mm:ss]")
// @Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "单品有效期格式有误")
// private String skuValidity;
// @ApiModelProperty(position = 27, required = false, value = "自定义展示[0-默认展示|1-隐藏不可购买]")
// private String skuAppear;
/**
* ---------------------------- 券类商品-代金券属性 ----------------------------
*/
@ApiModelProperty(position = 28, required = true, value = "是否实名[0-否|1-是,表示该商品需要实名关联]", allowableValues = "0,1", example = "1")
@Pattern(regexp = "\\b(0|1)\\b", message = "参数'是否实名'无效")
private String isTrueName;
@ApiModelProperty(position = 29, required = true, value = "适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]", allowableValues = "101,102,103", example = "101")
@Pattern(regexp = "\\b(101|102|103)\\b", message = "参数'适用范围'无效")
private String useScope;
@ApiModelProperty(position = 30, required = true, value = "面值", example = "99.00")
@Digits(integer = 3, fraction = 2, message = "参数'面值'无效")
@DecimalMin(value = "0.01", message = "参数'面值'必须为大于0")
private BigDecimal valFace;
@ApiModelProperty(position = 31, required = true, value = "开始时间[yyyy-MM-dd HH:mm:ss]", example = "2024-01-01 00:00:00")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "开始时间格式有误")
@NotNull(message = "参数'开始时间'不可为空")
private String effectAt;
@ApiModelProperty(position = 32, required = true, value = "结束时间[yyyy-MM-dd HH:mm:ss]", example = "2024-12-31 00:00:00")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "结束时间格式有误")
@NotNull(message = "参数'结束时间'不可为空")
private String expireAt;
}
package com.liquidnet.service.goblin.dto.manage;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.dto.vo.GoblinGoodsSkuInfoVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
@ApiModel(value = "GoblinStoreMgtGoodsCouponEditSkuParam", description = "商品管理:编辑券类商品:编辑券SKU入参")
@Data
public class GoblinStoreMgtGoodsCouponEditSkuParam implements Serializable {
private static final long serialVersionUID = 8174428924922310702L;
@ApiModelProperty(position = 10, required = true, value = "店铺ID[64]")
@NotBlank(message = "店铺ID不能为空")
private String storeId;
@ApiModelProperty(position = 11, required = true, value = "商品ID[64]")
@NotNull(message = "商品ID不能为空")
private String spuId;
@ApiModelProperty(position = 12, required = true, value = "单品ID[编辑时必传]")
@NotNull(message = "商品SKU_ID不能为空")
private String skuId;
@ApiModelProperty(position = 13, required = true, value = "单品现价[20,2]")
@Digits(integer = 3, fraction = 2, message = "参数'单品现价'无效")
@DecimalMin(value = "0.01", message = "参数'单品现价'必须为大于0")
private BigDecimal price;
@ApiModelProperty(position = 14, required = true, value = "限量[0-无限制|X:限购数量]")
@Min(value = 0, message = "参数'限购数量'不能小于0")
@NotNull(message = "参数'限购数量'不可为空")
private Integer buyLimit;
@ApiModelProperty(position = 15, required = false, value = "总库存")
private Integer stock;
@ApiModelProperty(position = 16, required = false, value = "总库存")
private Integer skuStock;
@ApiModelProperty(position = 17, required = false, value = "加减库存")
private Integer operStock;
/**
* ---------------------------- 券类商品-代金券属性 ----------------------------
*/
@ApiModelProperty(position = 18, required = true, value = "是否实名[0-否|1-是,表示该商品需要实名关联]", example = "1")
@Pattern(regexp = "\\b(0|1)\\b", message = "参数'是否实名'无效")
private String isTrueName;
@ApiModelProperty(position = 19, required = true, value = "适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]")
@Pattern(regexp = "\\b(101|102|103)\\b", message = "参数'适用范围'无效")
private String useScope;
@ApiModelProperty(position = 20, required = true, value = "面值", example = "99.00")
@Digits(integer = 3, fraction = 2, message = "参数'面值'无效")
@DecimalMin(value = "0.01", message = "参数'面值'必须为大于0")
private BigDecimal valFace;
@ApiModelProperty(position = 21, required = true, value = "结束时间[yyyy-MM-dd HH:mm:ss]", example = "2024-01-01 00:00:00")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "开始时间格式有误")
@NotNull(message = "参数'开始时间'不可为空")
private String effectAt;
@ApiModelProperty(position = 22, required = true, value = "结束时间[yyyy-MM-dd HH:mm:ss]", example = "2024-12-31 00:00:00")
@Pattern(regexp = LnsRegex.Valid.DATETIME_FULL, message = "结束时间格式有误")
@NotNull(message = "参数'结束时间'不可为空")
private String expireAt;
public GoblinGoodsSkuInfoVo initEditGoodsSkuInfoVo() {
GoblinGoodsSkuInfoVo goodsSkuInfoVo = GoblinGoodsSkuInfoVo.getNew();
goodsSkuInfoVo.setSkuType(2);
goodsSkuInfoVo.setSkuId(this.getSkuId());
goodsSkuInfoVo.setPrice(this.getPrice());
goodsSkuInfoVo.setPriceMember(this.getPrice());
goodsSkuInfoVo.setBuyLimit(this.getBuyLimit());
goodsSkuInfoVo.setStock(this.getStock());
goodsSkuInfoVo.setSkuStock(this.getSkuStock());
goodsSkuInfoVo.setIsTrueName(Integer.valueOf(this.getIsTrueName()));
goodsSkuInfoVo.setUseScope(Integer.valueOf(this.getUseScope()));
goodsSkuInfoVo.setValFace(this.getValFace());
goodsSkuInfoVo.setEffectAt(DateUtil.Formatter.yyyyMMddHHmmss.parse(this.getEffectAt()));
goodsSkuInfoVo.setExpireAt(DateUtil.Formatter.yyyyMMddHHmmss.parse(this.getExpireAt()));
return goodsSkuInfoVo;
}
}
......@@ -108,6 +108,7 @@ public class GoblinStoreMgtGoodsEditSkuParam implements Serializable {
goodsSkuInfoVo.setName(mgtGoodsSkuInfoVo.getName());
goodsSkuInfoVo.setSkuSpecList(mgtGoodsSkuInfoVo.getSkuSpecList());
}
goodsSkuInfoVo.setSkuType(0);
goodsSkuInfoVo.setSkuId(this.getSkuId());
goodsSkuInfoVo.setSkuBarCode(this.getSkuBarCode());
goodsSkuInfoVo.setSkuPic(this.getSkuPic());
......@@ -133,6 +134,7 @@ public class GoblinStoreMgtGoodsEditSkuParam implements Serializable {
public GoblinGoodsSkuInfoVo initEditAddGoodsSkuInfoVo() {
GoblinGoodsSkuInfoVo vo = GoblinGoodsSkuInfoVo.getNew();
List<GoblinGoodsSpecDto> skuSpecList = this.getSkuSpecList();
vo.setSkuType(0);
vo.setName("");
for (GoblinGoodsSpecDto goblinGoodsSpecDto : skuSpecList) {
vo.setName(vo.getName().concat(goblinGoodsSpecDto.getSpecVname()));
......
......@@ -41,6 +41,6 @@ public class GoblinStoreMgtGoodsFilterParam implements Serializable {
private BigDecimal priceGe;
@ApiModelProperty(position = 20, required = false, value = "价格区间MAX")
private BigDecimal priceLe;
@ApiModelProperty(position = 21, required = false, value = "商品类型[0-常规|1-数字藏品]")
@ApiModelProperty(position = 21, required = false, value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private Integer spuType;
}
......@@ -24,7 +24,7 @@ public class GoblinStoreMgtGoodsSkuSimpleFilterParam implements Serializable {
@ApiModelProperty(position = 13, required = false, value = "搜索关键字[128]")
@Size(min = 2, max = 100, message = "搜索关键字长度范围2~100")
private String keyword;
@ApiModelProperty(position = 14, required = false, value = "商品类型[0-常规|1-数字藏品],未指定则代表全部")
@ApiModelProperty(position = 14, required = false, value = "商品类型[0-常规|1-数字藏品|2-券类商品],未指定则代表全部")
private Integer skuType;
// @ApiModelProperty(position = 15, required = false, value = "商品上架状态[0-待上架|1-下架|2-违规|3-上架]", allowableValues = "0,1,2,3")
// private String shelvesStatus;
......
......@@ -19,7 +19,7 @@ public class GoblinStoreMgtGoodsListVo implements Serializable, Cloneable {
private String spuId;
@ApiModelProperty(position = 12, value = "商品编码[45]")
private String spuNo;
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品]")
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private int spuType;
@ApiModelProperty(position = 13, value = "封面图片地址[256]")
private String coverPic;
......
......@@ -14,7 +14,7 @@ public class GoblinStoreMgtGoodsSkuSimpleVo implements Serializable {
private String spuId;
@ApiModelProperty(position = 11, value = "单品ID[64]")
private String skuId;
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品]")
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private int skuType;
@ApiModelProperty(position = 13, value = "单品名称[100]")
private String name;
......
package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
......@@ -17,6 +18,7 @@ import java.math.BigDecimal;
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinBackOrderSkuVo implements Serializable,Cloneable {
@ApiModelProperty(value = "orderSkuId")
......@@ -42,6 +44,9 @@ public class GoblinBackOrderSkuVo implements Serializable,Cloneable {
@ApiModelProperty(value = "创建时间")
private String createdAt;
@ApiModelProperty(value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private Integer skuType;
private static final GoblinBackOrderSkuVo obj = new GoblinBackOrderSkuVo();
public static GoblinBackOrderSkuVo getNew() {
......
......@@ -14,6 +14,8 @@ import java.util.List;
@JsonIgnoreProperties(ignoreUnknown = true)
public class GoblinGoodsInfoDetailVo implements Serializable, Cloneable {
private static final long serialVersionUID = -4712015317981742851L;
@ApiModelProperty(position = 1, value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private Integer spuType;
@ApiModelProperty(position = 22, value = "规格展现方式[1-常规|2-组合]")
private String specMode;
@ApiModelProperty(position = 51, value = "规格信息")
......
......@@ -30,7 +30,7 @@ public class GoblinGoodsInfoVo implements Serializable, Cloneable {
private String spuErpCode;
@ApiModelProperty(position = 12, value = "ERP类型[WANGDIAN-旺店通]")
private String erpType;
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品]")
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private int spuType;
@ApiModelProperty(position = 13, value = "商品名称[100]")
private String name;
......
......@@ -45,6 +45,8 @@ public class GoblinGoodsSkuInfoDetailVo implements Serializable, Cloneable {
private Integer buyLimit;
@ApiModelProperty(position = 27, value = "剩余库存")
private Integer restStock;
@ApiModelProperty(position = 51, value = "是否实名[0-否|1-是,表示该商品需要实名关联]")
private Integer isTrueName;
private static final GoblinGoodsSkuInfoDetailVo obj = new GoblinGoodsSkuInfoDetailVo();
......
package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
......@@ -35,7 +34,7 @@ public class GoblinGoodsSkuInfoVo implements Serializable, Cloneable {
private int erpHosting;
@ApiModelProperty(position = 12, value = "ERP仓库编号")
private String erpWarehouseNo;
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品]")
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private int skuType;
@ApiModelProperty(position = 13, value = "单品的名称[100]")
private String name;
......@@ -137,6 +136,32 @@ public class GoblinGoodsSkuInfoVo implements Serializable, Cloneable {
private String nftHash;
@ApiModelProperty(position = 33, value = "NFT系列声明时间")
private String declareAt;
/**
* ---------------------------- 以下为券类商品-代金券属性 ----------------------------
*/
@ApiModelProperty(position = 33, value = "是否实名[0-否|1-是,表示该商品需要实名关联]")
private Integer isTrueName;
@ApiModelProperty(position = 33, value = "业务类别[0-全场|1-演出|2-商品|3-优先购]")
private Integer busiType;
@ApiModelProperty(position = 33, value = "券类型[1-代金券|2-满减券|3-兑换券|4-折扣券|101-优先券]")
private Integer couType;
@ApiModelProperty(position = 33, value = "适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]")
private Integer useScope;
@ApiModelProperty(position = 33, value = "面值")
private BigDecimal valFace;
@ApiModelProperty(position = 33, value = "购买后(单位天)有效期,与生效/过期时间二选一")
private Integer validity;
@ApiModelProperty(position = 33, value = "生效时间[yyyy-MM-dd HH:mm:ss]")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime effectAt;
@ApiModelProperty(position = 33, value = "过期时间[yyyy-MM-dd HH:mm:ss]")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtil.DATE_FULL_STR)
private LocalDateTime expireAt;
/**
* ---------------------------- 以上为券类商品-代金券属性 ----------------------------
*/
@ApiModelProperty(position = 34, value = "删除标记[0-未删除|1-删除]")
private String delFlg;
@ApiModelProperty(position = 35, value = "上架时间")
......@@ -175,7 +200,7 @@ public class GoblinGoodsSkuInfoVo implements Serializable, Cloneable {
private static final GoblinGoodsSkuInfoVo obj = new GoblinGoodsSkuInfoVo();
public String getUnbox() {
if (skuType == 0) {
if (skuType == 0 || skuType == 2) {
return unbox == null ? "0" : unbox;
} else {
return unbox;
......@@ -189,4 +214,10 @@ public class GoblinGoodsSkuInfoVo implements Serializable, Cloneable {
return new GoblinGoodsSkuInfoVo();
}
}
public String getCouponSnapshot() {
String str = "skuId=%s,price=%s,valFace=%s,buyLimit=%d,useScope=%s,effectAt=%s,expireAt=%s,isTrueName=%s;";
return String.format(str, this.getSkuId(), this.getPrice(), this.getValFace(),
this.getBuyLimit(), this.getUseScope(), this.getEffectAt(), this.getExpireAt(), this.getIsTrueName());
}
}
package com.liquidnet.service.goblin.dto.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.SensitizeUtil;
import com.liquidnet.service.goblin.entity.GoblinOrderSku;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
import java.util.Objects;
/**
* <p>
......@@ -78,6 +74,25 @@ public class GoblinOrderSkuVo implements Serializable, Cloneable {
@ApiModelProperty(value = "erp-仓库号")
private String erpWarehouseNo;
/**
* ---------------------------- 以下为券类商品-代金券属性 ----------------------------
*/
@ApiModelProperty(value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private Integer skuType;
@ApiModelProperty(value = "是否实名[0-否|1-是,表示该商品需要实名关联],这里默认0")
private Integer isTrueName;
@ApiModelProperty(value = "关联人证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照")
private Integer idType;
@ApiModelProperty(value = "关联人姓名")
private String idName;
@ApiModelProperty(value = "关联人证件号码")
private String idNo;
/**
* ---------------------------- 以上为券类商品-代金券属性 ----------------------------
*/
public String getPushTime() {
return pushTime == null ? "" : pushTime;
}
......@@ -122,4 +137,17 @@ public class GoblinOrderSkuVo implements Serializable, Cloneable {
return new GoblinOrderSkuVo();
}
}
/**
* 脱敏处理-关联人信息
*
* @return AdamUserIdentityVo
*/
public void desensitize() {
this.setIdName(SensitizeUtil.chineseName(this.getIdName()));
this.setIdNo(SensitizeUtil.custom(this.getIdNo(), 3, 2));
if (!Objects.isNull(this.idNo) && StringUtils.length(this.getIdNo()) < 9) {
this.setIdNo(SensitizeUtil.custom(this.getIdNo(), 2, 2));
}
}
}
......@@ -32,6 +32,24 @@ public class GoblinStoreOrderListSkuVo implements Cloneable {
@ApiModelProperty(value = "优惠价")
private BigDecimal priceVoucher;
/**
* ---------------------------- 以下为券类商品-代金券属性 ----------------------------
*/
@ApiModelProperty(value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private Integer skuType;
@ApiModelProperty(value = "是否实名[0-否|1-是,表示该商品需要实名关联],这里默认0")
private Integer isTrueName;
@ApiModelProperty(value = "关联人证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照")
private Integer idType;
@ApiModelProperty(value = "关联人姓名")
private String idName;
@ApiModelProperty(value = "关联人证件号码")
private String idNo;
/**
* ---------------------------- 以上为券类商品-代金券属性 ----------------------------
*/
private static final GoblinStoreOrderListSkuVo obj = new GoblinStoreOrderListSkuVo();
public static GoblinStoreOrderListSkuVo getNew() {
......
......@@ -25,7 +25,7 @@ public class NoticeGoblinGoodsSkuInfoVo implements Serializable, Cloneable {
private String spuId;
@ApiModelProperty(value = "单品的编号[45]")
private String skuNo;
@ApiModelProperty(value = "商品类型[0-常规|1-数字藏品]")
@ApiModelProperty(value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private int skuType;
@ApiModelProperty(value = "单品的名称[100]")
private String name;
......
package com.liquidnet.service.goblin.param;
import com.liquidnet.service.goblin.dto.manage.GoblinOrderSkuParam;
import com.liquidnet.service.goblin.entity.GoblinOrderAttr;
import com.liquidnet.service.goblin.entity.GoblinOrderSku;
import com.liquidnet.service.goblin.entity.GoblinStoreOrder;
......@@ -9,6 +10,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@ApiModel(value = "GoblinOrderPreParam")
......@@ -48,6 +50,7 @@ public class GoblinOrderPreParam implements Cloneable{
private List<GoblinOrderSku> orderSkuList;
private List<String> storeSpuIds;
private List<String> platformSpuIds;
private Map<String, GoblinOrderSkuParam> orderSkuParamMap;
private static final GoblinOrderPreParam obj = new GoblinOrderPreParam();
......
package com.liquidnet.service.goblin.param;
import com.liquidnet.service.goblin.dto.manage.GoblinOrderSkuParam;
import com.liquidnet.service.goblin.entity.GoblinOrderAttr;
import com.liquidnet.service.goblin.entity.GoblinOrderSku;
import com.liquidnet.service.goblin.entity.GoblinStoreOrder;
......@@ -9,6 +10,7 @@ import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@ApiModel(value = "GoblinOrderSqlParam")
......@@ -18,6 +20,7 @@ public class GoblinOrderSqlParam implements Cloneable{
private GoblinStoreOrder storeOrder;
private GoblinOrderAttr orderAttr;
private List<GoblinOrderSku> orderSkuList;
private Map<String, GoblinOrderSkuParam> orderSkuParamMap;
private static final GoblinOrderSqlParam obj = new GoblinOrderSqlParam();
......
......@@ -16,6 +16,8 @@ public interface IGoblinOrderAppService {
ResponseDto<GoblinAppOrderDetailsVo> orderDetails(String orderId,String uid);
Integer couponState(String orderId, String uid);
ResponseDto<Boolean> getProduce(String orderId,String uid);
ResponseDto<Boolean> applyRefund(GoblinAppOrderRefundParam param);
......
......@@ -40,6 +40,14 @@ public interface IGoblinstoreMgtGoodsService {
*/
void digitalGoodsAdd(GoblinGoodsInfoVo goodsInfoVo);
/**
* 商品管理:SPU添加-券类商品
*
* @param goodsInfoVo GoblinGoodsInfoVo
* @param goodsSkuInfoVoList List<GoblinGoodsSkuInfoVo>
*/
void couponGoodsAdd(GoblinGoodsInfoVo goodsInfoVo, List<GoblinGoodsSkuInfoVo> goodsSkuInfoVoList);
/**
* 商品管理:SPU详情
*
......@@ -69,6 +77,16 @@ public interface IGoblinstoreMgtGoodsService {
*/
boolean digitalGoodsEditSpu(String uid, GoblinStoreMgtDigitalGoodsAddParam mgtDigitalGoodsAddParam, GoblinGoodsInfoVo goodsInfoVo);
/**
* 商品管理:商品编辑:SPU编辑
*
* @param uid UID
* @param mgtGoodsCouponAddParam GoblinStoreMgtGoodsCouponAddParam
* @param goodsInfoVo GoblinGoodsInfoVo
* @return boolean
*/
boolean couponGoodsEditSpu(String uid, GoblinStoreMgtGoodsCouponAddParam mgtGoodsCouponAddParam, GoblinGoodsInfoVo goodsInfoVo);
/**
* 商品管理:商品编辑:SKU编辑
*
......@@ -93,6 +111,16 @@ public interface IGoblinstoreMgtGoodsService {
*/
boolean digitalGoodsEditSku(String uid, GoblinStoreMgtDigitalGoodsAddSkuParam mgtDigitalGoodsAddSkuParam, GoblinGoodsInfoVo mgtGoodsInfoVo);
/**
* 商品管理:商品编辑:SKU编辑-券类商品
*
* @param uid UID
* @param mgtGoodsEditSkuParam GoblinStoreMgtGoodsCouponEditSkuParam
* @param goodsInfoVo GoblinGoodsInfoVo
* @return boolean
*/
boolean couponGoodsEditSku(String uid, GoblinStoreMgtGoodsCouponEditSkuParam mgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo);
/**
* 商品管理:商品编辑:SKU添加
*
......
......@@ -25,6 +25,7 @@ public class KylinRedisConst {
public static final String TIMES = "kylin:times:id:";
public static final String AGENT = "kylin:agent:info";
public static final String ORDER_LIST = "kylin:order:list:userId:";
public static final String ORDER_REFUND_TEMP = "kylin:order:refund:";
public static final String ORDER_REFUND_BY_ORDER_ID = "kylin:order:refund:orderId:";
public static final String ORDER_REFUND = "kylin:order:refund:orderRefundsId:";
......
......@@ -23,7 +23,7 @@ public class GoblinGoodsInfoVo implements Serializable, Cloneable {
private String spuId;
@ApiModelProperty(position = 12, value = "商品编码[默认为系统编码,也可手动输入商家自己的编码]")
private String spuNo;
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品]")
@ApiModelProperty(position = 12, value = "商品类型[0-常规|1-数字藏品|2-券类商品]")
private int spuType;
@ApiModelProperty(position = 13, value = "商品名称[100]")
private String name;
......
......@@ -15,8 +15,8 @@ import java.math.BigDecimal;
*/
@Data
public class OrderRefundPoundage implements Cloneable {
@ApiModelProperty(value = "天数")
private int day;
@ApiModelProperty(value = "日期 yyyy-MM-dd HH:mm:ss")
private String day;
@ApiModelProperty(value = "距离演出开始日期>15天")
private String content;
@ApiModelProperty(value = "费率 如果手续费是0.1")
......
package com.liquidnet.service.kylin.dto.vo.admin;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
* 退款手续费说明
* </p>
*
* @author jiangxiulong
* @since 2021-10-13
*/
@Data
public class OrderRefundPoundageF implements Cloneable {
@ApiModelProperty(value = "演出id")
private String performanceId;
@ApiModelProperty(value = "阶梯退款数据")
private List<OrderRefundPoundage> orderRefundPoundage;
private static final OrderRefundPoundageF obj = new OrderRefundPoundageF();
public static OrderRefundPoundageF getNew() {
try {
return (OrderRefundPoundageF) obj.clone();
} catch (CloneNotSupportedException e) {
return new OrderRefundPoundageF();
}
}
}
......@@ -153,6 +153,14 @@ public class KylinPerformanceVo implements Serializable, Cloneable {
}
}
//todo 阶梯退票 所有调用这个方法的地方都有改动
public Integer getIsRefundPoundage(Integer i) {
if(null==i || 0==i){
return 0;
}
return 1;
}
public void setPerformance(KylinPerformances performance) {
this.mid = performance.getMid();
this.performancesId = performance.getPerformancesId();
......
......@@ -11,6 +11,7 @@ import com.liquidnet.service.kylin.dto.vo.partner.KylinPerformanceMisVo;
import com.liquidnet.service.kylin.entity.KylinOrderImport;
import com.liquidnet.service.kylin.entity.KylinPerformances;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -28,6 +29,7 @@ public interface IKylinPerformancesAdminService {
/**
* 同步演出 到票务平台
*
* @param performanceId 演出id
* @return 结果
*/
......@@ -35,6 +37,7 @@ public interface IKylinPerformancesAdminService {
/**
* 同步订单 到票务平台
*
* @param performanceId 演出id
* @return 结果
*/
......@@ -80,7 +83,7 @@ public interface IKylinPerformancesAdminService {
* @param status 演出状态
* @return 20个 sql 数据
*/
List<PerformanceTitleDao> getListByStatus(String status,String title);
List<PerformanceTitleDao> getListByStatus(String status, String title);
/**
* 根据演出状态 查询演出列表 演出全量场次票
......@@ -94,7 +97,7 @@ public interface IKylinPerformancesAdminService {
* 根据(演出\场次\票种)ID 查询演出、场次、票种信息
*
* @param scope ID所属字段
* @param id ID值
* @param id ID值
* @return 1条记录(包括演出名称、场次名称?、票种名称?及对于ID)
*/
PerformanceSimpleAllDao getSimpleDetailByScopeAndId(String scope, String id);
......@@ -123,7 +126,7 @@ public interface IKylinPerformancesAdminService {
* @param performancesId 相关参数
* @return boolean
*/
boolean setRecommend(String performancesId,Integer isRecommend);
boolean setRecommend(String performancesId, Integer isRecommend);
/**
* 设置 演出推荐 关联
......@@ -131,7 +134,7 @@ public interface IKylinPerformancesAdminService {
* @param performancesId 相关参数
* @return boolean
*/
Integer setIsShow(String performancesId,Integer isShow);
Integer setIsShow(String performancesId, Integer isShow);
/**
* 查询 推荐演出列表
......@@ -193,41 +196,79 @@ public interface IKylinPerformancesAdminService {
/**
* 修改 当前票种是否关联分销
*
* @param ticketId 票务id
* @param status 0 否 1 是
* @param status 0 否 1 是
* @return
*/
boolean changeTicketAgent(String performancesId,String ticketId, Integer status);
boolean changeTicketAgent(String performancesId, String ticketId, Integer status);
/**
* 修改 当前票种支付文案
*
* @param ticketId 票务id
* @param payTxt 支付文案
* @param payTxt 支付文案
* @return
*/
boolean changeTicketPayTxt(String performancesId,String ticketId, String payTxt);
boolean changeTicketPayTxt(String performancesId, String ticketId, String payTxt);
/**
* 修改 演出&票种&是否同步到大麦
*
* @return
*/
boolean changeSysDamai(List<SysDamaiParam> params);
/**
* 获取 演出退款配置
*
* @param performanceId
* @return
*/
PerformanceRefundConfigVo getRefundConfig(String performanceId);
/**
* 配置 注意事项
*
* @param performanceId
* @return
*/
String setPoundageExplain(String explain, String performanceId);
/**
* 获取 注意事项
*
* @param performanceId
* @return
*/
String getPoundageExplain(String performanceId);
/**
* 配置 注意事项
*
* @param performanceId
* @return
*/
String setRefundPoundageAll(List<OrderRefundPoundage> orderRefundPoundageArrayList, String performanceId);
/**
* 获取 注意事项
*
* @param performanceId
* @return
*/
ArrayList<OrderRefundPoundage> getRefundPoundageAll(String performanceId);
/**
* 修改 演出退款配置
*
* @return
*/
String changeRefundConfig(String performancesId,
Integer isCanRefund,
String refundOpenTime,
String refundCloseTime,
Integer isCanRefund,
String refundOpenTime,
String refundCloseTime,
Integer isRefundPoundage,
Integer isRefundVoucher,
Integer isRefundExpress,
......@@ -236,6 +277,7 @@ public interface IKylinPerformancesAdminService {
/**
* 获取 演出转赠配置
*
* @param performanceId
* @return
*/
......@@ -243,6 +285,7 @@ public interface IKylinPerformancesAdminService {
/**
* 获取 演出转赠配置
*
* @param performanceId
* @return
*/
......@@ -250,12 +293,13 @@ public interface IKylinPerformancesAdminService {
/**
* 修改 演出转赠配置
*
* @return
*/
String changeTransferConfig(String performancesId,
Integer isCanRefund,
String refundOpenTime,
String refundCloseTime);
Integer isCanRefund,
String refundOpenTime,
String refundCloseTime);
KylinPerformanceAgentVo getPerformanceAgent(String performancesId);
......
......@@ -237,5 +237,4 @@ public class LocalAdminController extends BaseController
{
return smilePrefix + "/userList/add";
}
}
......@@ -39,7 +39,7 @@ public class GoblinCommonController extends BaseController {
@GetMapping("goods")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "title", value = "商品名称[模糊]"),
@ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "type", value = "商品类型[0-常规|1-数字藏品]"),
@ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "type", value = "商品类型[0-常规|1-数字藏品|2-券类商品]"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "shelvesStatus", value = "上线状态"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "spuAppear", value = "显示状态"),
})
......@@ -58,7 +58,7 @@ public class GoblinCommonController extends BaseController {
@GetMapping("sku")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "title", value = "商品名称[模糊]"),
@ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "type", value = "商品类型[0-常规|1-数字藏品]"),
@ApiImplicitParam(type = "form", required = true, dataType = "Integer", name = "type", value = "商品类型[0-常规|1-数字藏品|2-券类商品]"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "shelvesStatus", value = "上线状态"),
})
@ResponseBody
......
......@@ -10,6 +10,7 @@ import com.liquidnet.client.admin.common.enums.BusinessType;
import com.liquidnet.client.admin.zhengzai.kylin.dto.KylinOrderImportDto;
import com.liquidnet.client.admin.zhengzai.kylin.dto.PerformanceOrderStatisCountResp;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.goblin.param.GoblinFrontCubeParam;
import com.liquidnet.service.kylin.dao.PerformanceAdminListDao;
import com.liquidnet.service.kylin.dao.PerformanceMemberAuditDao;
import com.liquidnet.service.kylin.dao.PerformanceOrderStatisticalDao;
......@@ -21,12 +22,14 @@ import com.liquidnet.service.kylin.dto.vo.partner.KylinPerformanceMisVo;
import com.liquidnet.service.kylin.entity.KylinOrderImport;
import com.liquidnet.service.kylin.service.admin.IKylinPerformancesAdminService;
import com.liquidnet.service.kylin.service.other.DamaiService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
......@@ -117,7 +120,7 @@ public class KylinPerformancesController extends BaseController {
return toAjax(kylinPerformancesService.setIsShow(performancesId, isShow));
}
// @Log(title = "演出列表", businessType = BusinessType.DETAIL)
// @Log(title = "演出列表", businessType = BusinessType.DETAIL)
//@RequiresPermissions("kylin:performances:view")
@GetMapping(value = "/memberInfo/{performancesId}")
public String memberInfo(@PathVariable("performancesId") String performancesId, ModelMap mmap) {
......@@ -135,7 +138,7 @@ public class KylinPerformancesController extends BaseController {
return toAjax(result);
}
// @Log(title = "演出列表-演出数据", businessType = BusinessType.LIST)
// @Log(title = "演出列表-演出数据", businessType = BusinessType.LIST)
//@RequiresPermissions("kylin:performances:view")
@GetMapping(value = "/performanceStatic/{performancesId}")
public String performanceStatic(@PathVariable("performancesId") String performancesId, ModelMap mmap) {
......@@ -229,6 +232,56 @@ public class KylinPerformancesController extends BaseController {
return prefix + "/refundConfig";
}
@GetMapping(value = "/refundPoundage/{performancesId}")
public String getRefundPoundage(@PathVariable("performancesId") String performancesId, ModelMap mmap) {
ArrayList<OrderRefundPoundage> refundPoundageList = kylinPerformancesService.getRefundPoundageAll(performancesId);
String refundPoundageExplain = kylinPerformancesService.getPoundageExplain(performancesId);
mmap.put("performancesId", performancesId);
mmap.put("refundPoundageList", refundPoundageList);
mmap.put("refundPoundageExplain", refundPoundageExplain);
return prefix + "/refundPoundage";
}
//
@PostMapping(value = "/refundConfig/explain") //todo 阶梯退票
@ApiOperation(value = "设置注意事项")
@ResponseBody
public AjaxResult setPoundageExplain(@RequestParam("explain") String explain,
@RequestParam("performancesId") String performancesId) {
String result = kylinPerformancesService.setPoundageExplain(explain, performancesId);
return AjaxResult.success(result);
}
@GetMapping(value = "/refundConfig/explain") //todo 阶梯退票
@ApiOperation(value = "获取注意事项")
@ResponseBody
public AjaxResult getPoundageExplain(@RequestParam("performancesId") String performancesId) {
String result = kylinPerformancesService.getPoundageExplain(performancesId);
return AjaxResult.success(result);
}
//阶梯退票
@GetMapping(value = "/refundConfig/poundage") //todo 阶梯退票
@ApiOperation(value = "获取阶梯退票")
@ResponseBody
public AjaxResult getRefundPoundageAll(@RequestParam("performancesId") String performancesId) {
ArrayList<OrderRefundPoundage> result = kylinPerformancesService.getRefundPoundageAll(performancesId);
return AjaxResult.success(result);
}
//
@PostMapping(value = "/refundConfig/poundage") //todo 阶梯退票
@ApiOperation(value = "设置阶梯退票")
@ResponseBody
public AjaxResult setRefundPoundageAll(@RequestBody OrderRefundPoundageF param) {
String result = kylinPerformancesService.setRefundPoundageAll(param.getOrderRefundPoundage(), param.getPerformanceId());
if (null != result && result.equals("操作成功")) {
return AjaxResult.success(result);
} else {
return AjaxResult.error(result);
}
}
//@RequiresPermissions("kylin:performances:view")
@PostMapping(value = "/refundConfig/change")
@ResponseBody
......
......@@ -25,8 +25,9 @@
</li>
<li id="li-tab-1"><a data-toggle="tab" href="#tab-1" aria-expanded="true" id="tab-nav-1"> 演出数据</a>
</li>
<li id="li-tab-6"><a data-toggle="tab" href="#tab-6" aria-expanded="false"
onclick="refundConfigInfo()">退款管理</a>
<li id="li-tab-6"><a data-toggle="tab" href="#tab-6" aria-expanded="false" onclick="refundConfigInfo()">退款管理</a>
</li>
<li id="li-tab-10"><a data-toggle="tab" href="#tab-10" aria-expanded="false" onclick="refundPoundageInfo()">阶段退票</a>
</li>
<li id="li-tab-7"><a data-toggle="tab" href="#tab-7" aria-expanded="false" onclick="transferInfo()">转赠配置</a>
</li>
......@@ -309,6 +310,13 @@
height=800px frameborder=0></iframe>
</div>
</div>
<div id="tab-10" class="tab-pane">
<div class="panel-body">
<iframe id="refundPoundage_iframe" name="refundPoundage_iframe" marginwidth=0 marginheight=0
width=100%
height=800px frameborder=0></iframe>
</div>
</div>
<div id="tab-7" class="tab-pane">
<div class="panel-body">
<iframe id="transfer_iframe" name="transfer_iframe" marginwidth=0 marginheight=0 width=100%
......@@ -506,6 +514,10 @@
function refundConfigInfo() {
document.getElementById("refundConfig_iframe").src = "../refundConfig/" + '[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "");
}
//阶梯退票
function refundPoundageInfo() {
document.getElementById("refundPoundage_iframe").src = `../refundPoundage/${'[[${kylinPerformanceMisVo.performancesId}]]'.replaceAll("\"", "")}`
}
//转赠配置
function transferInfo() {
......
......@@ -121,6 +121,10 @@
field: 'saleGeneral',
title: '实销'
},
// {
// field: 'refundNumber',
// title: '退票'
// },
{
field: 'surplusGeneral',
title: '余票'
......
......@@ -97,6 +97,9 @@
<th>
<div class="cell">退票数量</div>
</th>
<th>
<div class="cell">羊毛券数量</div>
</th>
<th>
<div class="cell">销售额(元)</div>
</th>
......@@ -134,6 +137,9 @@
<td>
<div class="cell" th:text="${respBean.totalRefundGeneral}">0</div>
</td>
<td>
<div class="cell" th:text="${respBean.totalVoucherCount}">0</div>
</td>
<td>
<div class="cell" th:text="${respBean.totalSalePrice}">0</div>
</td>
......
......@@ -23,10 +23,12 @@
<label class="col-sm-3 control-label is-required">用户申请退款:</label>
<div class="col-sm-8">
<div class="radio check-box">
<input type="radio" value="0" name="performance_isCanRefund" th:checked="*{isCanRefund==0 ? true : false}" checked> 关闭</label>
<input type="radio" value="0" name="performance_isCanRefund"
th:checked="*{isCanRefund==0 ? true : false}" checked> 关闭</label>
</div>
<div class="radio check-box">
<input type="radio" value="1" name="performance_isCanRefund" th:checked="*{isCanRefund==1 ? true : false}">开启</label>
<input type="radio" value="1" name="performance_isCanRefund"
th:checked="*{isCanRefund==1 ? true : false}">开启</label>
</div>
</div>
</div>
......@@ -40,14 +42,17 @@
class="form-control" id="endTime" placeholder="结束时间选择" name="refundCloseTime"
required/>
</div>
<div class="form-group">
<!-- todo 阶梯退票 添加了 style="display: none" 这个注释你看完需要删除-->
<div class="form-group" style="display: none">
<label class="col-sm-3 control-label is-required">用户退款手续费:</label>
<div class="col-sm-8">
<div class="radio check-box">
<input type="radio" value="0" name="performance_isRefundPoundage" th:checked="*{isRefundPoundage==0 ? true : false}" checked> 关闭</label>
<input type="radio" value="0" name="performance_isRefundPoundage"
th:checked="*{isRefundPoundage==0 ? true : false}" checked> 关闭</label>
</div>
<div class="radio check-box">
<input type="radio" value="1" name="performance_isRefundPoundage" th:checked="*{isRefundPoundage==1 ? true : false}">开启</label>
<input type="radio" value="1" name="performance_isRefundPoundage"
th:checked="*{isRefundPoundage==1 ? true : false}">开启</label>
</div>
</div>
</div>
......@@ -55,10 +60,12 @@
<label class="col-sm-3 control-label is-required">用户退款快递票上门取货快递费:</label>
<div class="col-sm-8">
<div class="radio check-box">
<input type="radio" value="0" name="performance_isRefundExpress" th:checked="*{isRefundExpress==0 ? true : false}" checked> 公司月结</label>
<input type="radio" value="0" name="performance_isRefundExpress"
th:checked="*{isRefundExpress==0 ? true : false}" checked> 公司月结</label>
</div>
<div class="radio check-box">
<input type="radio" value="1" name="performance_isRefundExpress" th:checked="*{isRefundExpress==1 ? true : false}">用户承担</label>
<input type="radio" value="1" name="performance_isRefundExpress"
th:checked="*{isRefundExpress==1 ? true : false}">用户承担</label>
</div>
</div>
</div>
......@@ -66,10 +73,12 @@
<label class="col-sm-3 control-label is-required">用户退款快递票是否需要退回:</label>
<div class="col-sm-8">
<div class="radio check-box">
<input type="radio" value="1" name="isBackPaperTicket" th:checked="*{isBackPaperTicket==1 ? true : false}" checked> 需要</label>
<input type="radio" value="1" name="isBackPaperTicket"
th:checked="*{isBackPaperTicket==1 ? true : false}" checked> 需要</label>
</div>
<div class="radio check-box">
<input type="radio" value="0" name="isBackPaperTicket" th:checked="*{isBackPaperTicket==0 ? true : false}">不需要</label>
<input type="radio" value="0" name="isBackPaperTicket"
th:checked="*{isBackPaperTicket==0 ? true : false}">不需要</label>
</div>
</div>
</div>
......@@ -77,10 +86,12 @@
<label class="col-sm-3 control-label is-required">用户退款快递票快递费是否退回:</label>
<div class="col-sm-8">
<div class="radio check-box">
<input type="radio" value="1" name="isRefundExpressNew" th:checked="*{isRefundExpressNew==1 ? true : false}" checked> 退回</label>
<input type="radio" value="1" name="isRefundExpressNew"
th:checked="*{isRefundExpressNew==1 ? true : false}" checked> 退回</label>
</div>
<div class="radio check-box">
<input type="radio" value="0" name="isRefundExpressNew" th:checked="*{isRefundExpressNew==0 ? true : false}">不退回</label>
<input type="radio" value="0" name="isRefundExpressNew"
th:checked="*{isRefundExpressNew==0 ? true : false}">不退回</label>
</div>
</div>
</div>
......@@ -88,10 +99,12 @@
<label class="col-sm-3 control-label is-required">退款是否退优惠券:</label>
<div class="col-sm-8">
<div class="radio check-box">
<input type="radio" value="0" name="performance_isRefundVoucher" th:checked="*{isRefundVoucher==0 ? true : false}" checked> 关闭</label>
<input type="radio" value="0" name="performance_isRefundVoucher"
th:checked="*{isRefundVoucher==0 ? true : false}" checked> 关闭</label>
</div>
<div class="radio check-box">
<input type="radio" value="1" name="performance_isRefundVoucher" th:checked="*{isRefundVoucher==1 ? true : false}">开启</label>
<input type="radio" value="1" name="performance_isRefundVoucher"
th:checked="*{isRefundVoucher==1 ? true : false}">开启</label>
</div>
</div>
</div>
......@@ -144,7 +157,8 @@
isCanRefund: parseInt($("input[name^='performance_isCanRefund']:checked").val()),
refundOpenTime: $("input[name^='refundOpenTime']").val(),
refundCloseTime: $("input[name^='refundCloseTime']").val(),
isRefundPoundage: parseInt($("input[name^='performance_isRefundPoundage']:checked").val()),
// isRefundPoundage: parseInt($("input[name^='performance_isRefundPoundage']:checked").val()),
isRefundPoundage: 0,
isRefundVoucher: parseInt($("input[name^='performance_isRefundVoucher']:checked").val()),
isRefundExpress: parseInt($("input[name^='performance_isRefundExpress']:checked").val()),
isBackPaperTicket: parseInt($("input[name^='isBackPaperTicket']:checked").val()),
......
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:include="include :: header('阶段退票')"/>
<th:block th:include="include :: datetimepicker-css"/>
<style>
.icheckbox, .icheckbox-blue, .iradio, .iradio-blue, .iradio-purple {
top: 5px !important;
}
.layui-input {
height: 34px;
line-height: 1.3;
line-height: 38px\9;
border-width: 1px;
border-style: solid;
background-color: #fff;
color: rgba(0,0,0,.85);
border-radius: 2px;
border-color: #d2d2d2!important;
}
input:focus, .layui-textarea:focus {
border-color: #d2d2d2!important;
outline: none;
}
input:focus-visible, .layui-textarea:focus-visible {
border-color: #d2d2d2!important;
outline: none;
}
.ibox-content {
padding-left: 0;
padding-right: 0;
}
.btn:focus {
outline: none;
}
</style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<!--退票规则-->
<h4 style="margin-bottom: 20px;">退票规则<span style="color: red;">( 规则上限10条,且多个规则的'申请退票时间'均需按顺序设置,否则无效)</span></h4>
<div class="ladder_box" id="ladder_box" style="width: 100%; background: #f5f5f5; padding: 10px 6px;overflow-x: auto">
<button type="button" class="btn btn-primary" style="margin-bottom: 12px;" onclick="add()">新增</button>
</div>
<div style="display: flex; justify-content: end; margin-top: 20px;">
<button type="button" class="btn btn-primary" onclick="save()">保存</button>
</div>
<div style="border-top: 1px solid #e7eaec; width: 100%; margin-top: 20px;"></div>
<div class="" style="margin: 12px 0;">
<h4 style="margin: 12px 0;">注意事项</h4>
<div>
<textarea name="details" class="form-control layui-textarea" id="wrningText" placeholder="注意事项字符不得超过200个" style="height: 200px;" onblur="wrningBlur()"></textarea>
</div>
<div style="display: flex; justify-content: end; margin-top: 20px;">
<button type="button" class="btn btn-primary" onclick="saveExplain()">保存</button>
</div>
</div>
<!--注意事项-->
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
var prefix = ctx + "kylin/performances";
/**
* 演出ID
*
* @type {*[String][]}
*/
var performancesId = [[${performancesId}]];
/**
* 退票规则列表
*
* @type {*[Array][]}
*/
var refundPoundageList = [[${refundPoundageList}]];
/**
* 注意事项
*
* @type {*[String][]}
*/
var refundPoundageExplain = [[${refundPoundageExplain}]];
$("#wrningText").val(refundPoundageExplain)
function wrningBlur() {
if ($("#wrningText").val().length > 200) {
$("#wrningText").val($("#wrningText").val().substring(0, 200))
layer.msg('注意事项限制字数为200字以内,已为您删掉多余文字!')
}
}
let ex = {day: '', content: '', present: 0, isCanRefund: 0}
if (refundPoundageList && refundPoundageList.length > 0) {
let dom = ''
for(var i = 0; i < refundPoundageList.length; i++) {
refundPoundageList[i].index = i
dom += `<div class="ladder_items" id="ladder_items${i}" style="width: 100%; display: flex; align-items: center; margin-bottom: 12px;">
<div class="" style="display: flex; align-items: center; margin-right: 12px; width: 260px;">
<span class="control-label is-required" style="padding-top: 0px; width: 106px;">截至退票时间:</span>
<input type="text" class="layui-input form-control test" id="test${i}" value="${refundPoundageList[i].day}" style="width: 154px">
</div>
<div class="" style="display: flex; align-items: center; margin-right: 12px; width: 202px;">
<span class="control-label is-required" style="padding-top: 0px; width: 106px">是否支持退票:</span>
<p style="dispaly: flex; align-items: center; margin-bottom: 0px; width: 48px"><input type="radio" class="performance_isRefundPoundage" value="0" style="flex: 1; margin-top: 0; margin-right: 4px; cursor: pointer" name="performance_isRefundPoundage${i}" ${refundPoundageList[i].isCanRefund == 0 ? 'checked' : false}> <span>关闭</span></p>
<p style="dispaly: flex; align-items: center; margin-bottom: 0px; width: 48px"><input type="radio" class="performance_isRefundPoundage" value="1" style="flex: 1; margin: 0 4px 0; cursor: pointer" name="performance_isRefundPoundage${i}" ${refundPoundageList[i].isCanRefund ? 'checked' : false}><span>开启</span></p>
</div>
<div class="" style="display: flex; align-items: center; margin-right: 12px; width: 148px; position: relative">
<span class="control-label is-required" style="padding-top: 0px; width: 88px">扣除手续费:</span>
<input type="number" class="layui-input form-control handlingCharge" id="handlingCharge${i}" value="${refundPoundageList[i].present}" name="" style="width: 60px;" onblur="presentBlur(${i})">
<span style="width: 20px; height: 24px; position: absolute; right: 2px; top: 4px; background: #fff"></span>
</div>
<div class="" style="flex: 1; display: flex; align-items: center;">
<span class="control-label is-required" style="padding-top: 0px; width: 74px;">规则描述:</span>
<input type="text" class="layui-input form-control description" value="${refundPoundageList[i].content}" placeholder="规则描述限制在50分字符以内" name="" style="width: 400px; flex: 1;" id="description${i}" onBlur="descriptionBlurClick(${i})">
<button class="btn btn-danger del-btn" style="width: 58px; margin-left: 12px;" onclick="del(${i})">删除</button>
</div>
</div>`
createLay(`#test${i}`)
}
$("#ladder_box").append(dom)
} else {
add()
}
function add () {
if (refundPoundageList.length >= 10) return layer.msg('规则最多可添加十条!');
let num = refundPoundageList.length
let dom = `<div class="ladder_items" id="ladder_items${num}" style="width: 100%; display: flex; align-items: center; margin-bottom: 12px;">
<div class="" style="display: flex; align-items: center; margin-right: 12px; width: 260px;">
<span class="control-label is-required" style="padding-top: 0px; width: 106px;">截至退票时间:</span>
<input type="text" class="layui-input form-control test" id="test${num}" value="" style="width: 154px">
</div>
<div class="" style="display: flex; align-items: center; margin-right: 12px; width: 202px;">
<span class="control-label is-required" style="padding-top: 0px; width: 106px">是否支持退票:</span>
<p style="dispaly: flex; align-items: center; margin-bottom: 0px; width: 48px"><input type="radio" class="performance_isRefundPoundage" value="0" style="flex: 1;margin-top: 0; margin-right: 4px; cursor: pointer" name="performance_isRefundPoundage${num}" checked> <span>关闭</span></p>
<p style="dispaly: flex; align-items: center; margin-bottom: 0px; width: 48px"><input type="radio" class="performance_isRefundPoundage" value="1" style="flex: 1;margin: 0 4px 0; cursor: pointer" name="performance_isRefundPoundage${num}"><span>开启</span></p>
</div>
<div class="" style="display: flex; align-items: center; margin-right: 12px; width: 148px; position: relative">
<span class="control-label is-required" style="padding-top: 0px; width: 88px">扣除手续费:</span>
<input type="number" id="handlingCharge${num}" class="layui-input form-control handlingCharge" value="" name="" style="width: 60px;" onblur="presentBlur(${num})">
<span style="width: 20px; height: 24px; position: absolute; right: 2px; top: 4px; background: #fff"></span>
</div>
<div class="" style="flex: 1; display: flex; align-items: center;">
<span class="control-label is-required" style="padding-top: 0px; width: 74px;">规则描述:</span>
<input type="text" id="description${num}" class="layui-input form-control description" placeholder="规则描述限制在50分字符以内" value="" name="" style="width: 400px; flex: 1;" onBlur="descriptionBlurClick(${num})">
<button class="btn btn-danger del-btn" style="width: 58px; margin-left: 12px;" onclick="del(${num})">删除</button>
</div>
</div>`
$("#ladder_box").append(dom)
createLay(`#test${num}`)
ex['index'] = num
refundPoundageList.push(JSON.parse(JSON.stringify(ex)))
}
function del(num) {
refundPoundageList.splice(refundPoundageList.findIndex(item=> item.index == num), 1)
$(`#ladder_items${num}`).remove()
}
function descriptionBlurClick(num) {
if ($(`#description${num}`).val().length > 50) {
$(`#description${num}`).val($(`#description${num}`).val().substring(0, 50))
layer.msg('描述字数不得超过50字,已将超出部分进行删除!')
}
}
function presentBlur(num) {
if ($(`#handlingCharge${num}`).val() > 1 || $(`#handlingCharge${num}`).val() < 0) {
$(`#handlingCharge${num}`).val(0)
layer.msg('手续费比例为大于0小于1的数值!')
}
}
function save() {
let data = {
"orderRefundPoundage": [],
"performanceId": performancesId
}
const doms = $('.ladder_items')
let flag = false
for(var i = 0; i < doms.length; i++) {
let item = doms[i]
let description, test, handlingCharge
[description, test, handlingCharge] = [$(item).find('.description').val(), $(item).find('.test').val(), $(item).find('.handlingCharge').val()]
if (!description || !test || !handlingCharge) {
flag = true
}
data['orderRefundPoundage'].push({
content: description,
day: test,
isCanRefund: $(item).find('.performance_isRefundPoundage:checked').val(),
present: handlingCharge
})
}
if (flag) return layer.msg('存在未填写的必填项,请输入后再次保存!')
ajaxMethd('/kylin/performances/refundConfig/poundage', 'post', JSON.stringify(data), 'application/json').then(resp => {
if (resp.code == 0) {
layer.msg('保存成功')
} else {
layer.msg(resp.msg)
}
}).catch(err => {
layer.msg(resp.msg)
})
}
function saveExplain() {
if (!$("#wrningText").val()) layer.msg('注意事项内容为空!')
let data = {
explain: $("#wrningText").val(),
performancesId: performancesId
}
ajaxMethd('/kylin/performances/refundConfig/explain', 'post', data).then(resp => {
if (resp.code == 0) {
layer.msg('保存成功')
} else {
layer.msg(resp.msg)
}
}).catch(err => {
layer.msg(resp.msg)
})
}
function createLay(dom) {
layui.use('laydate', function(){
var laydate = layui.laydate;
laydate.render({
elem: dom, //指定元素
type: 'datetime'
});
});
}
function ajaxMethd(url, type, data, contentType) {
return new Promise((resolve, reject) => {
$.ajax({
url,
type,
data,
contentType,
success: function(res) {
resolve(res)
}
})
})
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -45,6 +45,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
......@@ -53,6 +54,8 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
/**
* <p>
* 演出 服务实现类
......@@ -91,6 +94,8 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
ISlimeAuthorizationRecordsAdminService merchantAuthorizationRecordsAdminService;
@Autowired
InnerService innerService;
@Autowired
private KylinOrderRefundsMapper kylinOrderRefundsMapper;
@Autowired
SmileRedisUtils smileRedisUtils;
......@@ -744,7 +749,7 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
vo.setRefundCloseTime(kylinPerformanceStatus.getRefundCloseTime() == null ? "" : DateUtil.Formatter.yyyyMMddHHmmss.format(kylinPerformanceStatus.getRefundCloseTime()));
vo.setRefundOpenTime(kylinPerformanceStatus.getRefundOpenTime() == null ? "" : DateUtil.Formatter.yyyyMMddHHmmss.format(kylinPerformanceStatus.getRefundOpenTime()));
vo.setIsRefundPoundage(kylinPerformanceStatus.getIsRefundPoundage());
// vo.setIsRefundPoundage(kylinPerformanceStatus.getIsRefundPoundage());
vo.setIsRefundVoucher(kylinPerformanceStatus.getIsRefundVoucher());
vo.setIsRefundExpress(kylinPerformanceStatus.getIsRefundExpress());
vo.setIsBackPaperTicket(kylinPerformanceStatus.getIsBackPaperTicket());
......@@ -754,6 +759,65 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
return vo;
}
@Override
public String setPoundageExplain(String explain, String performanceId) {
dataUtils.setRefundPoundageExplain(explain, performanceId);
return explain;
}
@Override
public String getPoundageExplain(String performanceId) {
return dataUtils.getRefundPoundageExplain(performanceId);
}
@Override
public String setRefundPoundageAll(List<OrderRefundPoundage> orderRefundPoundageArrayList, String performanceId) {
if (orderRefundPoundageArrayList.size() > 10) {
return "阶梯不能大于10";
}
PerformanceRefundConfigVo configVo = getRefundConfig(performanceId);
if (configVo.getIsCanRefund() == 1) {
return "请先关闭退款再进行操作";
}
int count = kylinOrderRefundsMapper.selectingCount(performanceId);
if (count > 0) {
return "请先处理该演出待退款订单再进行操作";
}
LocalDateTime nextTime = LocalDateTime.parse("2001-01-01 12:00:00", DTF_YMD_HMS);
for (OrderRefundPoundage item : orderRefundPoundageArrayList) {
if (item.getPresent().compareTo(BigDecimal.ONE) > 0) {
return "手续费不能大于100%";
}
LocalDateTime curTime = LocalDateTime.parse(item.getDay(), DTF_YMD_HMS);
if (curTime.isBefore(nextTime)) {
return "当前阶梯时间不能早于前一个阶梯";
}
nextTime = curTime;
}
if (orderRefundPoundageArrayList.size() > 1) {
LocalDateTime st = LocalDateTime.parse(configVo.getRefundOpenTime(), DTF_YMD_HMS);
LocalDateTime et = LocalDateTime.parse(configVo.getRefundCloseTime(), DTF_YMD_HMS);
LocalDateTime ft = LocalDateTime.parse(orderRefundPoundageArrayList.get(0).getDay(), DTF_YMD_HMS);
LocalDateTime lt = LocalDateTime.parse(orderRefundPoundageArrayList.get(orderRefundPoundageArrayList.size() - 1).getDay(), DTF_YMD_HMS);
if (ft.isBefore(st)) {
return orderRefundPoundageArrayList.get(0).getDay() + "超出退款时间范围";
} else if (lt.isAfter(et)) {
return orderRefundPoundageArrayList.get(orderRefundPoundageArrayList.size() - 1).getDay() + "超出退款时间范围";
}
}
dataUtils.setRefundPoundage(orderRefundPoundageArrayList, performanceId);
return "操作成功";
}
@Override
public ArrayList<OrderRefundPoundage> getRefundPoundageAll(String performanceId) {
return dataUtils.getRefundPoundage(performanceId);
}
@Override
public PerformanceTransferConfigVo getTransferConfig(String performanceId) {
KylinPerformances kylinPerformances = performancesMapper.selectOne(new UpdateWrapper<KylinPerformances>().eq("performances_id", performanceId));
......@@ -895,6 +959,7 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
countBean.setTotalRefundPrice(countBean.getTotalRefundPrice().add(dto.getTotalRefundPrice()));
countBean.setTotalMemberNumber(countBean.getTotalMemberNumber().add(dto.getTotalMemberNumber()));
countBean.setTotalPayingNumber(countBean.getTotalPayingNumber().add(dto.getTotalPayingNumber()));
countBean.setTotalVoucherCount(countBean.getTotalVoucherCount().add(dto.getTotalVoucherCount()));
countBean.setTotalBuyUsers(dto.getTotalBuyUsers());
});
dtoList.add(countBean);
......
......@@ -7,6 +7,7 @@ import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dto.vo.KylinExpressModuleVo;
import com.liquidnet.service.kylin.dto.vo.admin.OrderRefundAddress;
import com.liquidnet.service.kylin.dto.vo.admin.OrderRefundPoundage;
import com.liquidnet.service.kylin.dto.vo.express.KylinOrderExpressVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketEntitiesVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
......@@ -24,6 +25,7 @@ import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@Component
......@@ -274,8 +276,8 @@ public class DataUtils {
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKeyUid;
String redisKeyIdCard;
String performanceIdKeyIdCard="";
String ticketIdKeyIdCard="";
String performanceIdKeyIdCard = "";
String ticketIdKeyIdCard = "";
int isTrueName = getPerformanceIsTrueName(performanceId);
......@@ -499,36 +501,84 @@ public class DataUtils {
public String getTicketPayTxt(String ticketId) {
String rdsKey = KylinRedisConst.TICKET_PAY_TXT.concat(ticketId);
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(rdsKey);
if(obj==null){
if (obj == null) {
return "";
}else{
} else {
return (String) obj;
}
}
//删除 订单Ar激活码
public void delOrderArCode(String orderId){
public void delOrderArCode(String orderId) {
String rdk = KylinRedisConst.ORDER_AR_CODE.concat(orderId);
redisDataSourceUtil.getRedisKylinUtil().del(rdk);
}
//添加 订单Ar激活码
public void addOrderArCode(String orderId,String arCode){
public void addOrderArCode(String orderId, String arCode) {
String rdk = KylinRedisConst.ORDER_AR_CODE.concat(orderId);
List<String> data = getOrderArCode(orderId);
data.add(arCode);
redisDataSourceUtil.getRedisKylinUtil().set(rdk,data);
redisDataSourceUtil.getRedisKylinUtil().set(rdk, data);
}
//获取 订单Ar激活码
public List<String> getOrderArCode(String orderId){
public List<String> getOrderArCode(String orderId) {
String rdk = KylinRedisConst.ORDER_AR_CODE.concat(orderId);
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(rdk);
if(obj==null){
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(rdk);
if (obj == null) {
return CollectionUtil.arrayListString();
}else{
} else {
return (List<String>) obj;
}
}
/**
* //todo 阶梯退票
* 设置 注意事项
*
* @param explain 注意事项
* @param performanceId 演出id
*/
public void setRefundPoundageExplain(String explain, String performanceId) {
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.ORDER_REFUND_POUNDAGE_EXPLAIN.concat(":").concat(performanceId), explain);
}
/**
* //todo 阶梯退票
* 获取 注意事项
*
* @param performanceId 演出id
*/
public String getRefundPoundageExplain(String performanceId) {
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(KylinRedisConst.ORDER_REFUND_POUNDAGE_EXPLAIN.concat(":").concat(performanceId));
if (null == obj) {
return "";
} else {
return (String) obj;
}
}
/**
* //todo 阶梯退票
* 设置手续费
*
* @param orderRefundPoundageArrayList 手续费数据集合
* @param performanceId 演出id
*/
public void setRefundPoundage(List<OrderRefundPoundage> orderRefundPoundageArrayList, String performanceId) {
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.ORDER_REFUND_POUNDAGE.concat(":").concat(performanceId), orderRefundPoundageArrayList);
}
// 获取手续费
public ArrayList<OrderRefundPoundage> getRefundPoundage(String performanceId) {
ArrayList<OrderRefundPoundage> orderRefundPoundageArrayList = new ArrayList<>();
Object obj = redisDataSourceUtil.getRedisKylinUtil().get(KylinRedisConst.ORDER_REFUND_POUNDAGE.concat(":").concat(performanceId));
if (obj == null) {
return orderRefundPoundageArrayList;
} else {
return (ArrayList<OrderRefundPoundage>) obj;
}
}
}
......@@ -68,7 +68,13 @@ public class SmsEnum {
* 购票短信
* - 模版内容:您已成功购买${name}门票。可至个人中心查看订单 http://t.cn/ExMlr1B。演出${time}开始。微信关注 摩登天空服务号,获得更多演出资讯。特别提示:下载“正在现场APP”最新版,使用“在场”功能,可结识该场演出中共同观演的在场好友。
*/
@Deprecated
SMS_225995308,
/**
* 购票短信
* - 模版内容:您已成功购买${name}门票。可至个人中心查看订单 http://t.cn/ExMlr1B。演出${time}开始。微信关注 摩登天空订阅号,获得更多演出资讯。特别提示: 获取「正在现场」最新版,使用“在场"功能,可结识该场演出中共同观演的在场好友。
*/
SMS_463657321,
/**
* 购买会员
* - 模版内容:欢迎加入登登登VIP大家庭。请微信关注“摩登天空服务号”,回复VIP,获取专属小助理客服服务了,回T退订
......
package com.liquidnet.service.candy.dto;
import com.liquidnet.service.candy.entity.CandyUserCouponAssoc;
import lombok.Data;
import java.io.Serializable;
@Data
public class CandyUserCouponAssocDto implements Serializable, Cloneable {
private static final long serialVersionUID = -5500626839150118876L;
/**
* 关联人证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照,5-军官证
*/
private Integer idType;
/**
* 关联人姓名
*/
private String idName;
/**
* 关联人证件号码
*/
private String idNo;
private static final CandyUserCouponAssocDto obj = new CandyUserCouponAssocDto();
public static CandyUserCouponAssocDto getNew() {
try {
return (CandyUserCouponAssocDto) obj.clone();
} catch (CloneNotSupportedException e) {
return new CandyUserCouponAssocDto();
}
}
public CandyUserCouponAssocDto copy(CandyUserCouponAssoc userCouponAssoc) {
if (null == userCouponAssoc) return this;
this.setIdType(userCouponAssoc.getIdType());
this.setIdName(userCouponAssoc.getIdName());
this.setIdNo(userCouponAssoc.getIdNo());
return this;
}
}
......@@ -30,6 +30,7 @@ public class CandyUserCouponBasicDto implements Serializable, Cloneable {
private Integer overlay;
private Integer overlayLevel;
private Integer validity;
private Integer isTrueName;
private Integer redeemValidity;
private LocalDateTime redeemStart;
private LocalDateTime redeemStop;
......@@ -60,7 +61,6 @@ public class CandyUserCouponBasicDto implements Serializable, Cloneable {
/* com.liquidnet.service.candy.entity.CandyCommonCoupon */
private String ccouponId;
private static final CandyUserCouponBasicDto obj = new CandyUserCouponBasicDto();
public static CandyUserCouponBasicDto getNew() {
......@@ -89,6 +89,7 @@ public class CandyUserCouponBasicDto implements Serializable, Cloneable {
this.setOverlay(coupon.getOverlay());
this.setOverlayLevel(coupon.getOverlayLevel());
this.setValidity(coupon.getValidity());
this.setIsTrueName(coupon.getIsTrueName());
this.setRedeemValidity(coupon.getRedeemValidity());
this.setRedeemStart(coupon.getRedeemStart());
this.setRedeemStop(coupon.getRedeemStop());
......
......@@ -104,6 +104,11 @@ public class CandyCoupon implements Serializable {
*/
private Integer validity;
/**
* 是否实名[0-否|1-是,表示该商品需要实名关联]
*/
private Integer isTrueName;
/**
* 兑换有效期(单位天)
*/
......
......@@ -28,7 +28,7 @@ public class CandyCouponRule implements Serializable {
private String couponId;
/**
* 适用范围[100-全场|90-演出|91-场次|92-票|80-商品|81-款式]
* 适用范围[101-音乐节|102-小型演出(livehouse演出) |103-巡演|100-全场|90-演出|91-场次|92-票|80-商品|81-款式]
*/
private Integer useScope;
......
package com.liquidnet.service.candy.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 券关联适用人信息
* </p>
*
* @author liquidnet
* @since 2024-01-26
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class CandyUserCouponAssoc implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* ~candy_user_coupon.ucoupon_id
*/
private String ucouponId;
/**
* 关联人证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照,5-军官证
*/
private Integer idType;
/**
* 关联人姓名
*/
private String idName;
/**
* 关联人证件号码
*/
private String idNo;
private String comment;
}
package com.liquidnet.service.candy.mapper;
import com.liquidnet.service.candy.entity.CandyUserCouponAssoc;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 券关联适用人信息 Mapper 接口
* </p>
*
* @author liquidnet
* @since 2024-01-26
*/
public interface CandyUserCouponAssocMapper extends BaseMapper<CandyUserCouponAssoc> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.candy.mapper.CandyUserCouponAssocMapper">
</mapper>
......@@ -51,7 +51,7 @@ public class GoblinGoods implements Serializable {
private String erpType;
/**
* 商品类型[0-常规|1-数字藏品]
* 商品类型[0-常规|1-数字藏品|2-券类商品]
*/
private Integer spuType;
......
......@@ -58,7 +58,7 @@ public class GoblinGoodsSku implements Serializable {
private String erpWarehouseNo;
/**
* 商品类型[0-常规|1-数字藏品]
* 商品类型[0-常规|1-数字藏品|2-券类商品]
*/
private Integer skuType;
......
package com.liquidnet.service.goblin.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 商品券信息
* </p>
*
* @author liquidnet
* @since 2024-01-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinGoodsSkuCoupon implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 单品id
*/
private String skuId;
/**
* 是否实名[0-否|1-是,表示该商品需要实名关联]
*/
private Integer isTrueName;
/**
* 业务类别[1-演出]
*/
private Integer busiType;
/**
* 券类型[1-代金券]
*/
private Integer couType;
/**
* 适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]
*/
private Integer useScope;
/**
* 面值
*/
private BigDecimal valFace;
/**
* 购买后(单位天)有效期,与生效/过期时间二选一
*/
private Integer validity;
/**
* 生效时间
*/
private LocalDateTime effectAt;
/**
* 过期时间
*/
private LocalDateTime expireAt;
private String comment;
}
package com.liquidnet.service.goblin.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 商品券关联人信息
* </p>
*
* @author liquidnet
* @since 2024-01-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinOrderSkuAssoc implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* 订单sku_id
*/
private String orderSkuId;
/**
* 是否实名[0-否|1-是,表示该商品需要实名关联]
*/
private Integer isTrueName;
/**
* 关联人证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照,5-军官证
*/
private Integer idType;
/**
* 关联人姓名
*/
private String idName;
/**
* 关联人证件号码
*/
private String idNo;
/**
* 操作人
*/
private String operator;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
private String comment;
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.entity.GoblinGoodsSkuCoupon;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 商品券信息 Mapper 接口
* </p>
*
* @author liquidnet
* @since 2024-01-23
*/
public interface GoblinGoodsSkuCouponMapper extends BaseMapper<GoblinGoodsSkuCoupon> {
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.entity.GoblinOrderSkuAssoc;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 商品券关联人信息 Mapper 接口
* </p>
*
* @author liquidnet
* @since 2024-01-23
*/
public interface GoblinOrderSkuAssocMapper extends BaseMapper<GoblinOrderSkuAssoc> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinGoodsSkuCouponMapper">
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinOrderSkuAssocMapper">
</mapper>
......@@ -22,6 +22,7 @@ public class PerformanceAdminListDao {
private Integer auditStatus;
private Integer totalGeneral;
private Integer saleGeneral;
// private Integer refundNumber;
private BigDecimal totalSalePrice;
private Integer surplusGeneral;
private Integer syncDamai;
......
......@@ -33,6 +33,7 @@ public class PerformanceOrderStatisticalDao implements Cloneable{
private BigDecimal totalMemberNumber = BigDecimal.ZERO;
private BigDecimal totalPayingNumber = BigDecimal.ZERO;
private BigDecimal totalBuyUsers = BigDecimal.ZERO;
private BigDecimal totalVoucherCount = BigDecimal.ZERO;
private static final PerformanceOrderStatisticalDao obj = new PerformanceOrderStatisticalDao();
public static PerformanceOrderStatisticalDao getNew() {
......
......@@ -28,7 +28,7 @@ public interface KylinOrderRefundsMapper extends BaseMapper<KylinOrderRefunds> {
double refundedTotalPrice(String orderTicketsId);
List<OrderRefundDao> misRefundList(Map<String,Object> map);
List<OrderRefundDao> misRefundList(Map<String, Object> map);
int selectRefundingCount(
@Param("orderTicketsId") String orderTicketsId,
......@@ -47,4 +47,7 @@ public interface KylinOrderRefundsMapper extends BaseMapper<KylinOrderRefunds> {
@Param("orderRefundsId") String orderRefundsId,
@Param("entitiesId") String entitiesId
);
//查询正在进行的订单 TODO 阶梯退票
int selectingCount(@Param("performanceId") String performanceId);
}
......@@ -33,7 +33,8 @@
<result column="price" property="price"/>
<result column="created_at" property="createdAt"/>
</resultMap>
<select id="misRefundList1" resultType="com.liquidnet.service.kylin.dao.OrderRefundDao" resultMap="misRefundListResult">
<select id="misRefundList1" resultType="com.liquidnet.service.kylin.dao.OrderRefundDao"
resultMap="misRefundListResult">
SELECT a.*, b.order_code, b.performance_title, d.mailno
FROM kylin_order_refunds AS a
JOIN kylin_order_tickets AS b ON a.order_tickets_id = b.order_tickets_id
......@@ -79,7 +80,8 @@
ORDER BY a.mid DESC
</select>
<select id="misRefundList" resultType="com.liquidnet.service.kylin.dao.OrderRefundDao" resultMap="misRefundListResult">
<select id="misRefundList" resultType="com.liquidnet.service.kylin.dao.OrderRefundDao"
resultMap="misRefundListResult">
select t.*, b.order_code, b.performance_title, b.get_ticket_type from
(select a.*, d.mailno, d.send_express_type,d.remark,d.express_status
from kylin_order_refunds a
......@@ -182,4 +184,13 @@
AND b.order_ticket_entities_id = #{entitiesId}
</where>
</select>
<select id="selectingCount" resultType="java.lang.Integer">
SELECT COUNT(0)
FROM kylin_order_refunds AS a
INNER JOIN kylin_order_ticket_relations AS b ON a.order_tickets_id = b.order_id
WHERE (status = 0 OR status = 1 OR status = 7 OR status = 3)
AND b.performance_id = #{performanceId}
</select>
</mapper>
......@@ -28,6 +28,7 @@
<result column="time_end" property="timeEnd"/>
<result column="total_general" property="totalGeneral"/>
<result column="sale_general" property="saleGeneral"/>
<result column="refund_number" property="refundNumber"/>
<result column="total_sale_price" property="totalSalePrice"/>
<result column="surplus_general" property="surplusGeneral"/>
<result column="status" property="status"/>
......@@ -171,6 +172,7 @@
<result column="total_member_number" property="totalMemberNumber"/>
<result column="total_paying_number" property="totalPayingNumber"/>
<result column="total_buy_users" property="totalBuyUsers"/>
<result column="total_voucher_count" property="totalVoucherCount"/>
</resultMap>
<resultMap id="performanceOrderListDaoResult" type="com.liquidnet.service.kylin.dao.PerformanceOrderListDao">
<result column="performances_id" property="performancesId"/>
......@@ -514,6 +516,7 @@
IFNULL(ot.total_member_number , 0) AS 'total_member_number',
IFNULL(otp.total_paying_number , 0) AS 'total_paying_number',
IFNULL(ut.total_buy_users , 0) AS 'total_buy_users'
,IFNULL(ot.voucher_count, 0) AS 'total_voucher_count'
FROM
(select t.performances_id,ktr.ticket_id from kylin_performances t inner join kylin_ticket_time_relation kttr
on t.performances_id = kttr.performance_id
......@@ -526,10 +529,12 @@
sum(kot.number)-sum(ifnull(kot.refund_number,0)) AS 'total_sale_general' ,
sum(kot.price_actual)-sum(ifnull(kot.price_refund,0)) AS 'total_sale_price',
sum(case when kotr.is_member = 1 then kot.number else 0 end) total_member_number
,count(koc.order_id) as voucher_count
FROM
kylin_order_ticket_relations kotr
inner join kylin_order_tickets AS kot on kotr.order_id = kot.order_tickets_id
inner JOIN kylin_order_ticket_status AS kots ON kots.order_id = kot.order_tickets_id
LEFT JOIN kylin_order_coupons AS koc on kots.order_id = koc.order_id and koc.coupon_type = 1
WHERE 1>0 and kotr.performance_id = ${performancesId}
and kots.`status` in(1,3,6) and kot.coupon_type ='no' and kots.transfer_status in (0,1,2,5)
group by kotr.performance_id,kotr.ticket_id
......
......@@ -181,6 +181,24 @@ create table candy_coupon_relate
comment text
) engine InnoDB comment '券适用关联配置';
create index idx_ccr_coupon_id on candy_coupon_relate (coupon_id);
# -- >>------------------------------------------------------------------------------------ |20240123 商品券业务
alter table candy_coupon add is_true_name smallint default 0 comment '是否实名[0-否|1-是,表示该商品需要实名关联]' after validity;
alter table candy_coupon_rule modify use_scope smallint null comment '适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演|100-全场|90-演出|91-场次|92-票|80-商品|81-款式]';
drop table if exists candy_user_coupon_assoc;
create table candy_user_coupon_assoc
(
mid bigint unsigned auto_increment primary key,
ucoupon_id varchar(64) not null comment '~candy_user_coupon.ucoupon_id',
id_type tinyint not null comment '关联人证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照,5-军官证',
id_name varchar(30) not null comment '关联人姓名',
id_no varchar(30) not null comment '关联人证件号码',
comment text
) engine InnoDB comment '券关联适用人信息';
create index idx_cuca_ucoupon_id on candy_user_coupon_assoc (ucoupon_id);
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
\ No newline at end of file
......@@ -99,14 +99,24 @@ public class CandyCouponController {
@ApiImplicitParam(type = "form", dataType = "String", name = "timeId", value = "场次id", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "ticketId", value = "票id", required = true),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "type", value = "类型 1可用 2过期/已使用 ", required = true),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "perType", value = "演出类型", required = false),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "isTrueName", value = "是否实名", required = false),
})
public ResponseDto<CandyMyCouponListVo> preUsePerformanceCoupon(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal,
@RequestParam("performanceId") @NotNull @NotBlank String performanceId,
@RequestParam("timeId") @NotNull @NotBlank String timeId,
@RequestParam("ticketId") @NotNull @NotBlank String ticketId,
@RequestParam("type") @NotNull Integer type,
@RequestParam(required = false, name = "page") Integer page) {
CandyMyCouponListVo vo = candyCouponService.preUsePerformanceCoupon(priceTotal, performanceId, timeId, ticketId, type);
@RequestParam(required = false, name = "page") Integer page,
@RequestParam(required = false, name = "perType") Integer perType,
@RequestParam(required = false, name = "isTrueName") Integer isTrueName) {
if (perType == null) {
perType = -1;
}
if (isTrueName == null) {
isTrueName = 1;
}
CandyMyCouponListVo vo = candyCouponService.preUsePerformanceCoupon(priceTotal, performanceId, timeId, ticketId, type,perType,isTrueName);
List<CandyCouponVo> list = vo.getMyCoupon();
List<CandyCouponVo> listVo = ObjectUtil.getCandyCouponVoArrayList();
if (page == null || page == 0) {
......@@ -133,13 +143,23 @@ public class CandyCouponController {
@ApiImplicitParam(type = "form", dataType = "String", name = "performanceId", value = "演出id", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "timeId", value = "场次id", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "ticketId", value = "票id", required = true),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "perType", value = "演出类型", required = false),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "isTrueName", value = "是否实名", required = false),
})
public ResponseDto<HashMap<String, Integer>> preCanUsePerformanceCoupon(@RequestParam("priceTotal") @NotNull BigDecimal priceTotal,
@RequestParam("performanceId") @NotNull @NotBlank String performanceId,
@RequestParam("timeId") @NotNull @NotBlank String timeId,
@RequestParam("ticketId") @NotNull @NotBlank String ticketId) {
@RequestParam("ticketId") @NotNull @NotBlank String ticketId,
@RequestParam(required = false, name = "perType") Integer perType,
@RequestParam(required = false, name = "isTrueName") Integer isTrueName) {
if (perType == null) {
perType = -1;
}
if (isTrueName == null) {
isTrueName = 1;
}
HashMap<String, Integer> hashMap = CollectionUtil.mapStringInteger();
hashMap.put("canUse", candyCouponService.preCanUsePerformanceCoupon(priceTotal, performanceId, timeId, ticketId));
hashMap.put("canUse", candyCouponService.preCanUsePerformanceCoupon(priceTotal, performanceId, timeId, ticketId,perType,isTrueName));
return ResponseDto.success(hashMap);
}
......@@ -255,6 +275,7 @@ public class CandyCouponController {
@ApiImplicitParam(type = "form", dataType = "String", name = "timeId", value = "场次id", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "ticketId", value = "票id", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "uid", value = "uid", required = false),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "perType", value = "演出类型", required = false),
})
public ResponseDto<CandyUseResultVo> useCoupon(@RequestParam("uCouponId") @NotNull @NotBlank String uCouponId,
@RequestParam("content") @NotNull @NotBlank String content,
......@@ -263,12 +284,16 @@ public class CandyCouponController {
@RequestParam("performanceId") @NotNull @NotBlank String performanceId,
@RequestParam("timeId") @NotNull @NotBlank String timeId,
@RequestParam("ticketId") @NotNull @NotBlank String ticketId,
@RequestParam(value = "uid", required = false) String uid
@RequestParam(value = "uid", required = false) String uid,
@RequestParam(required = false, name = "perType") Integer perType
) {
if (uid == null) {
uid = CurrentUtil.getCurrentUid();
}
CandyUseResultVo result = candyCouponService.useCoupon(uCouponId, content, totalPrice, performanceId, timeId, ticketId, goodId, uid);
if (perType == null) {
perType = -1;
}
CandyUseResultVo result = candyCouponService.useCoupon(uCouponId, content, totalPrice, performanceId, timeId, ticketId, goodId, uid,perType);
if (result == null) {
return ResponseDto.failure();
}
......
......@@ -67,7 +67,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
continue;
}
if (type == 1) {
if (baseVo.getState().equals(3) || dtoItem.getState().equals(5)) {
if (baseVo.getState().equals(3) || baseVo.getState().equals(5)|| dtoItem.getState().equals(2)) {
continue;
}
} else if (type == 2) {
......@@ -139,7 +139,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
@Override
public CandyMyCouponListVo preUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId, Integer type) {
public CandyMyCouponListVo preUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId, Integer type,int perType,int isTrueName) {
String uid = CurrentUtil.getCurrentUid();
LocalDateTime userCreateTime;
try {
......@@ -153,9 +153,9 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
List<CandyCouponVo> myCoupon = ObjectUtil.getCandyCouponVoArrayList();
for (CandyUserCouponBasicDto dtoItem : dtoList) {
CandyCouponVo baseVo = CouponBaseUtil.getPerformanceCouponUserVo(dtoItem, priceTotal, performanceId, timeId, ticketId);
CandyCouponVo baseVo = CouponBaseUtil.getPerformanceCouponUserVo(dtoItem, priceTotal, performanceId, timeId, ticketId,perType,isTrueName);
if (type == 1) {
if (baseVo.getState().equals(3) || dtoItem.getState().equals(5) || baseVo.getState().equals(21)) {
if (baseVo.getState().equals(3) || baseVo.getState().equals(5) || baseVo.getState().equals(21)|| baseVo.getState().equals(31)|| baseVo.getState().equals(2)) {
continue;
}
} else if (type == 2) {
......@@ -182,7 +182,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
@Override
public Integer preCanUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId) {
public Integer preCanUsePerformanceCoupon(BigDecimal priceTotal, String performanceId, String timeId, String ticketId,int perType,int isTrueName) {
String uid = CurrentUtil.getCurrentUid();
LocalDateTime userCreateTime;
try {
......@@ -193,7 +193,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
List<CandyUserCouponBasicDto> dtoList = redisDataUtils.getCouponByUid(uid, userCreateTime);
int canUse = 0;
for (CandyUserCouponBasicDto dtoItem : dtoList) {
CandyCouponVo baseVo = CouponBaseUtil.getPerformanceCouponUserVo(dtoItem, priceTotal, performanceId, timeId, ticketId);
CandyCouponVo baseVo = CouponBaseUtil.getPerformanceCouponUserVo(dtoItem, priceTotal, performanceId, timeId, ticketId,perType,isTrueName);
if (baseVo.getCouType().equals(101) || baseVo.getCouType().equals(3) || baseVo.getBusiType() == 2) {
continue;
}
......@@ -287,7 +287,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
List<CandyCouponVo> advanceCoupon = ObjectUtil.getCandyCouponVoArrayList();
for (CandyUserCouponBasicDto dtoItem : dtoList) {
if (dtoItem.getBusiType().equals(3)) {
CandyCouponVo baseVo = CouponBaseUtil.getPerformanceCouponUserVo(dtoItem, BigDecimal.ZERO, performanceId, "-1", "-1");
CandyCouponVo baseVo = CouponBaseUtil.getPerformanceCouponUserVo(dtoItem, BigDecimal.ZERO, performanceId, "-1", "-1",-1,0);
if (baseVo.getState().equals(1)) {
advanceCoupon.add(baseVo);
} else {
......@@ -317,7 +317,7 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
}
@Override
public CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, String goodId, String uid) {
public CandyUseResultVo useCoupon(String uCouponId, String content, String totalPrice, String performanceId, String timesId, String ticketId, String goodId, String uid,int perType) {
LocalDateTime userCreateTime;
try {
userCreateTime = getCreatedAt(uid);
......@@ -380,9 +380,15 @@ public class CandyCouponServiceImpl implements ICandyCouponService {
case 92://票
isTarget = CouponBaseUtil.isTargetCoupon(ruleItem.getBusiId(), dto.getCouType(), ticketId, new BigDecimal(totalPrice), dto.getValOver());
break;
case 100://
case 100://全场
isTarget = true;
break;
//TODO 胡佳晨 20240123
case 101:
case 102:
case 103:
isTarget = ruleItem.getUseScope()==perType;
break;
default:
isTarget = false;
break;
......
......@@ -74,7 +74,8 @@ public class CouponBaseUtil {
BigDecimal priceTotal,
String performanceId,
String timeId,
String ticketId) {
String ticketId,
int perType,int isTrueName) {
boolean isTarget = false;
LocalDateTime now = LocalDateTime.now();
CandyCouponVo vo = CandyCouponVo.getNew();
......@@ -126,6 +127,12 @@ public class CouponBaseUtil {
isTarget = true;
}
break;
//TODO 胡佳晨 20240123
case 101:
case 102:
case 103:
isTarget = ruleItem.getUseScope() == perType && isTrueName ==1;
break;
default:
isTarget = false;
break;
......
......@@ -141,6 +141,14 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
String pre = GoblinStatusConst.MarketPreStatus.getPre(skuVo.getSkuId());
incrSkuStock(pre, skuVo.getSkuId(), skuVo.getNum());
decrSkuCountByUid(orderVo.getUserId(), skuVo.getSkuId(), skuVo.getNum());
if (Objects.equals(skuVo.getSkuType(), 2)) {// 券类商品
if (Objects.equals(skuVo.getIsTrueName(), 1)) {// 需关联实名人
// 这里默认券类商品需要关联实名人且都要求关联实名人限购
decrSkuCountByIdNo(skuVo.getIdType(), skuVo.getIdNo(), skuVo.getSkuId(), skuVo.getNum());
}
}
//mysql
sqlDataSku.add(new Object[]{
skuVo.getStatus(), now, skuVo.getOrderSkuId(), now, now
......@@ -475,6 +483,11 @@ public abstract class AbstractOrderCloseReceiver implements StreamListener<Strin
return (int) redisDataSourceUtil.getRedisKylinUtil().decr(redisKey, number);
}
// 减少 关联实名人sku购买个数
public long decrSkuCountByIdNo(int idType, String idNo, String skuId, int number) {
return redisDataSourceUtil.getRedisKylinUtil().decr(String.format(GoblinRedisConst.REDIS_GOBLIN_BUY_COUNT_IDNO, idType, idNo, skuId), number);
}
// 赋值 订单相关vo
public void setGoblinOrder(String orderId, GoblinStoreOrderVo vo) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER.concat(orderId);
......
......@@ -1240,6 +1240,50 @@ create table goblin_store_erp_config
) engine = InnoDB comment '店铺ERP配置';
create unique index idx_gsec_store_id on goblin_store_erp_config (store_id);
# -- >>------------------------------------------------------------------------------------ |20240123 商品券业务
alter table goblin_goods modify spu_type tinyint default 0 not null comment '商品类型[0-常规|1-数字藏品|2-券类商品]';
drop table if exists goblin_goods_sku_coupon;
create table goblin_goods_sku_coupon
(
mid bigint auto_increment primary key,
sku_id varchar(64) not null comment '单品id',
busi_type smallint null comment '业务类别[1-演出]',
cou_type smallint null comment '券类型[1-代金券]',
use_scope smallint null comment '适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]',
val_face decimal(8, 2) comment '面值',
is_true_name smallint default 0 comment '是否实名[0-否|1-是,表示该商品需要实名关联]',
validity int default 0 comment '购买后(单位天)有效期,与生效/过期时间二选一',
effect_at datetime(3) null comment '生效时间',
expire_at datetime(3) null comment '过期时间',
comment varchar(255)
) engine = InnoDB comment '商品券信息';
create unique index uidx_ggsc_sku_id on goblin_goods_sku_coupon (sku_id);
drop table if exists goblin_order_sku_assoc;
create table goblin_order_sku_assoc
(
mid bigint unsigned auto_increment primary key,
order_sku_id varchar(64) default '' null comment '订单sku_id',
is_true_name smallint default 0 comment '是否实名[0-否|1-是,表示该商品需要实名关联]',
id_type tinyint not null comment '关联人证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照,5-军官证',
id_name varchar(30) not null comment '关联人姓名',
id_no varchar(30) not null comment '关联人证件号码',
operator varchar(64) not null comment '操作人',
created_at datetime(3) not null,
updated_at datetime(3),
comment varchar(255)
) engine InnoDB comment '商品券关联人信息';
create index idx_gosa_order_sku_id on goblin_order_sku_assoc (order_sku_id);
# -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------
......
......@@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import java.util.List;
@Slf4j
......@@ -59,6 +60,12 @@ public class GoblinOrderAppController {
return goblinOrderAppService.orderDetails(orderId, uid);
}
@GetMapping("couponState")
@ApiOperation(value = "券类商品订单查询已发放券状态", notes = "响应参数[1-可用,5-已用]")
public ResponseDto<Integer> couponState(@NotBlank(message = "子订单Id不能为空") @RequestParam String orderSkuId) {
return ResponseDto.success(goblinOrderAppService.couponState(orderSkuId, CurrentUtil.getCurrentUid()));
}
@PostMapping("getProduce")
@ApiOperation("已收货")
@ApiImplicitParams({
......
......@@ -280,7 +280,7 @@ public class GoblinStoreMgtGoodsController {
log.warn("商品管理:SPU管理:上架警告:无效操作,商品已上架[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品已上架");
}
if (goodsSkuInfoVo.getSkuType() == 0) {
if (goodsSkuInfoVo.getSkuType() != 1) {
log.warn("商品管理:SPU管理:上架警告:数字藏品不支持此操作[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品非数字藏品");
}
......@@ -306,7 +306,7 @@ public class GoblinStoreMgtGoodsController {
log.warn("商品管理:SPU管理:售罄警告:非法操作,参数有误[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "参数有误");
}
if (goodsSkuInfoVo.getSkuType() == 0) {
if (goodsSkuInfoVo.getSkuType() != 1) {
log.warn("商品管理:SPU管理:售罄警告:数字藏品不支持此操作[UID={},skuId={}]", currentUid, skuId);
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,商品非数字藏品");
}
......@@ -540,7 +540,7 @@ public class GoblinStoreMgtGoodsController {
}
}
if (log.isDebugEnabled()) {
log.debug("商品管理:SPU添加:[GoblinStoreMgtGoodsAddParam={}]", JsonUtils.toJson(mgtDigitalGoodsAddParam));
log.debug("商品管理:SPU添加:[GoblinStoreMgtDigitalGoodsAddParam={}]", JsonUtils.toJson(mgtDigitalGoodsAddParam));
}
initGoodsInfoVo.setCreatedBy(currentUid);
initGoodsInfoVo.setCreatedAt(LocalDateTime.now());
......@@ -548,6 +548,107 @@ public class GoblinStoreMgtGoodsController {
return ResponseDto.success(initGoodsInfoVo.getSpuId());
}
@ApiOperationSupport(order = 402)
@ApiOperation(value = "SPU添加-券类商品")
@PostMapping("coupon/add")
public ResponseDto<Object> couponAdd(@Valid @RequestBody GoblinStoreMgtGoodsCouponAddParam mgtGoodsCouponAddParam) {
String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtGoodsCouponAddParam.getStoreId();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) return ResponseDto.failure(ErrorMapping.get("149002"));
if (log.isDebugEnabled()) {
log.debug("商品管理:SPU添加-券类商品:[GoblinStoreMgtGoodsCouponAddParam={}]", JsonUtils.toJson(mgtGoodsCouponAddParam));
}
GoblinStoreMgtGoodsCouponAddSkuParam skuParam = mgtGoodsCouponAddParam.getSkuParam();
if (Objects.isNull(skuParam)) {
return ResponseDto.failure(ErrorMapping.get("149006"));
}
if (Objects.isNull(skuParam.getEffectAt()) || Objects.isNull(skuParam.getExpireAt())) {
return ResponseDto.failure(ErrorMapping.get("149025"));
}
LocalDateTime effectAt = DateUtil.Formatter.yyyyMMddHHmmss.parse(skuParam.getEffectAt());
LocalDateTime expireAt = DateUtil.Formatter.yyyyMMddHHmmss.parse(skuParam.getExpireAt());
if (effectAt.isAfter(expireAt) || expireAt.isBefore(LocalDateTime.now())) {
return ResponseDto.failure(ErrorMapping.get("149026"));
}
if (CollectionUtils.isEmpty(mgtGoodsCouponAddParam.getImageList())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品图片不能为空");
}
{// 分类、ISBN校验
String cateFid = mgtGoodsCouponAddParam.getCateFid(), cateSid = mgtGoodsCouponAddParam.getCateSid(), cateTid = mgtGoodsCouponAddParam.getCateTid();
List<GoblinSelfGoodsCategoryVo> selfGoodsCategoryVos = goblinStoreMgtExtraService.listCategoryVo();
if (selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateFid) && r.getGrade().equals("1"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品一级分类无效");
}
if (StringUtils.isNotBlank(cateSid)) {
if (selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateSid) && r.getGrade().equals("2"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品二级分类无效");
}
}
if (StringUtils.isNotBlank(cateTid)) {
if (selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateTid) && r.getGrade().equals("3"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品三级分类无效");
}
}
}
if (goblinMongoUtils.countMgtGoodsInfoVo(mgtGoodsCouponAddParam.getName()) > 0) {
return ResponseDto.failure(ErrorMapping.get("149007"));
}
if (mgtGoodsCouponAddParam.getShelvesHandle().equals("3") && null == mgtGoodsCouponAddParam.getShelvesTime()) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "预约上架时间未指定");
}
GoblinGoodsInfoVo goodsInfoVo = mgtGoodsCouponAddParam.initGoodsInfoVo(currentUid, LocalDateTime.now());
ArrayList<GoblinGoodsSpecVo> goodsSpecVoList = ObjectUtil.getGoblinGoodsSpecVoArrayList();
List<GoblinGoodsSkuInfoVo> goodsSkuInfoVoList = ObjectUtil.getGoblinGoodsSkuInfoVoArrayList();
mgtGoodsCouponAddParam.initGoodsSkuInfoVo(goodsInfoVo, goodsSkuInfoVoList, goodsSpecVoList);
{// 标签处理
List<String> goodsTagIdList = mgtGoodsCouponAddParam.getTagList(),
goodsExtagIdList = mgtGoodsCouponAddParam.getExtagList(),
goodsArtagIdList = mgtGoodsCouponAddParam.getArtagList();
if (!CollectionUtils.isEmpty(goodsTagIdList)) {
List<GoblinSelfTagVo> selfGoodsTagVos = goblinRedisUtils.getSelfTagVos();
List<GoblinGoodsTagVo> goodsTagVoList = ObjectUtil.getGoblinGoodsTagVoArrayList();
for (int i = 0; i < goodsTagIdList.size(); i++)
for (GoblinSelfTagVo r : selfGoodsTagVos)
if (r.getTagId().equals(goodsTagIdList.get(i)) && r.getTagBelong().equals("0")) {
goodsTagVoList.add(GoblinGoodsTagVo.getNew().copy(r).setSort(i));
break;
}
goodsInfoVo.setTagVoList(goodsTagVoList);
}
if (!CollectionUtils.isEmpty(goodsExtagIdList)) {
List<GoblinSelfTagVo> selfExtagVos = goblinRedisUtils.getSelfExtagVos();
List<GoblinGoodsExtagVo> goodsExtagVoList = ObjectUtil.getGoblinGoodsExtagVoArrayList();
for (int i = 0; i < goodsExtagIdList.size(); i++)
for (GoblinSelfTagVo r : selfExtagVos)
if (r.getTagId().equals(goodsExtagIdList.get(i)) && r.getTagBelong().equals("1") && !r.getTagType().equals("5")) {
goodsExtagVoList.add(GoblinGoodsExtagVo.getNew().copy(r).setSort(i));
break;
}
goodsInfoVo.setExtagVoList(goodsExtagVoList);
}
if (!CollectionUtils.isEmpty(goodsArtagIdList)) {
List<GoblinSelfTagVo> selfExtagVos = goblinRedisUtils.getSelfExtagVos();
List<GoblinGoodsExtagVo> goodsArtagVoList = ObjectUtil.getGoblinGoodsExtagVoArrayList();
for (int i = 0; i < goodsArtagIdList.size(); i++)
for (GoblinSelfTagVo r : selfExtagVos)
if (r.getTagId().equals(goodsArtagIdList.get(i)) && r.getTagBelong().equals("1")) {
goodsArtagVoList.add(GoblinGoodsExtagVo.getNew().copy(r).setSort(i));
break;
}
goodsInfoVo.setArtagVoList(goodsArtagVoList);
}
}
// 服务保障处理
List<String> ssidList = mgtGoodsCouponAddParam.getSsidList();
if (!CollectionUtils.isEmpty(ssidList)) {
goodsInfoVo.setServiceSupportVoList(goblinMongoUtils.getServiceSupportVos(ssidList));
}
goblinstoreMgtGoodsService.couponGoodsAdd(goodsInfoVo, goodsSkuInfoVoList);
return ResponseDto.success(goodsInfoVo.getSpuId());
}
@ApiOperationSupport(order = 5)
@ApiOperation(value = "SPU详情")
@ApiImplicitParams({
......@@ -584,8 +685,8 @@ public class GoblinStoreMgtGoodsController {
|| !mgtGoodsInfoVo.getDelFlg().equals("0")) {
return ResponseDto.failure(ErrorMapping.get("149010"));
}
if (mgtGoodsInfoVo.getSpuType() == 1) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品为数字藏品");
if (mgtGoodsInfoVo.getSpuType() != 0) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非常规商品");
}
if (!mgtGoodsInfoVo.getName().equals(mgtGoodsAddParam.getName())
// && null != goblinMongoUtils.getMgtGoodsInfoVo(storeId, mgtGoodsAddParam.getName())) {
......@@ -656,7 +757,7 @@ public class GoblinStoreMgtGoodsController {
}
@ApiOperationSupport(order = 601)
@ApiOperation(value = "SPU编辑-数字藏品", notes = "只修改商品信息,不包含价格库存相关信息")
@ApiOperation(value = "商品编辑:SPU编辑-数字藏品", notes = "只修改商品信息,不包含价格库存相关信息")
@PutMapping("digital/edit_spu")
public ResponseDto<Object> digitalEditSpu(@Valid @RequestBody GoblinStoreMgtDigitalGoodsAddParam mgtDigitalGoodsEditParam) {
String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtDigitalGoodsEditParam.getStoreId();
......@@ -669,7 +770,7 @@ public class GoblinStoreMgtGoodsController {
|| !mgtGoodsInfoVo.getDelFlg().equals("0")) {
return ResponseDto.failure(ErrorMapping.get("149010"));
}
if (mgtGoodsInfoVo.getSpuType() == 0) {
if (mgtGoodsInfoVo.getSpuType() != 1) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非数字藏品");
}
if (!mgtGoodsInfoVo.getName().equals(mgtDigitalGoodsEditParam.getName())
......@@ -696,13 +797,73 @@ public class GoblinStoreMgtGoodsController {
}
}
if (log.isDebugEnabled()) {
log.debug("商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsAddParam={}]", JsonUtils.toJson(mgtDigitalGoodsEditParam));
log.debug("商品管理:商品编辑:SPU编辑:[GoblinStoreMgtDigitalGoodsAddParam={}]", JsonUtils.toJson(mgtDigitalGoodsEditParam));
}
boolean resultFlg = goblinstoreMgtGoodsService.digitalGoodsEditSpu(currentUid, mgtDigitalGoodsEditParam, mgtGoodsInfoVo);
return resultFlg ? ResponseDto.success() : ResponseDto.failure();
}
@ApiOperationSupport(order = 602)
@ApiOperation(value = "商品编辑:SPU编辑-券类商品", notes = "只修改商品信息,不包含价格库存相关信息")
@PutMapping("coupon/edit_spu")
public ResponseDto<Object> couponEditSpu(@Valid @RequestBody GoblinStoreMgtGoodsCouponAddParam mgtGoodsEditParam) {
String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtGoodsEditParam.getStoreId();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) return ResponseDto.failure(ErrorMapping.get("149002"));
GoblinGoodsInfoVo mgtGoodsInfoVo;
if (StringUtils.isBlank(mgtGoodsEditParam.getSpuId())
|| null == (mgtGoodsInfoVo = goblinRedisUtils.getGoodsInfoVo(mgtGoodsEditParam.getSpuId()))
|| !mgtGoodsInfoVo.getStoreId().equals(storeId)
|| !mgtGoodsInfoVo.getDelFlg().equals("0")) {
return ResponseDto.failure(ErrorMapping.get("149010"));
}
if (mgtGoodsInfoVo.getSpuType() != 2) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非券类商品");
}
if (!mgtGoodsInfoVo.getName().equals(mgtGoodsEditParam.getName())
&& goblinMongoUtils.countMgtGoodsInfoVo(mgtGoodsEditParam.getName()) > 0) {
return ResponseDto.failure(ErrorMapping.get("149007"));
}
if (!mgtGoodsEditParam.getShelvesHandle().equals(mgtGoodsInfoVo.getShelvesHandle())
&& mgtGoodsInfoVo.getShelvesStatus().equals("3")) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "上架处理方式只限商品未上架时变更");
}
List<String> skuIdList = mgtGoodsInfoVo.getSkuIdList();
List<GoblinGoodsSkuInfoVo> goodsSkuInfoVos = CollectionUtils.isEmpty(skuIdList) ? null : goblinMongoUtils.getGoodsSkuInfoVos(skuIdList);
boolean hasSkuFlg = !CollectionUtils.isEmpty(goodsSkuInfoVos);
{// 分类、ISBN校验
String cateFid = mgtGoodsEditParam.getCateFid(), cateSid = mgtGoodsEditParam.getCateSid(), cateTid = mgtGoodsEditParam.getCateTid();
List<GoblinSelfGoodsCategoryVo> selfGoodsCategoryVos = goblinStoreMgtExtraService.listCategoryVo();
if (selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateFid) && r.getGrade().equals("1"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品一级分类无效");
}
if (StringUtils.isNotBlank(cateSid)) {
if (selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateSid) && r.getGrade().equals("2"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品二级分类无效");
}
}
if (StringUtils.isNotBlank(cateTid)) {
if (selfGoodsCategoryVos.stream().noneMatch(r -> r.getCateId().equals(cateTid) && r.getGrade().equals("3"))) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "商品三级分类无效");
}
}
}
// if (StringUtils.isNotEmpty(mgtGoodsInfoVo.getSpuErpCode()) && StringUtils.isBlank(mgtGoodsEditParam.getSpuErpCode())) {
// if (hasSkuFlg && goodsSkuInfoVos.stream().anyMatch(r -> r.getErpHosting() == 1)) {// 存在SKU启用ERP托管,不可修改`spu_erp_code`
// mgtGoodsEditParam.setSpuErpCode(mgtGoodsInfoVo.getSpuErpCode());
// } else {
// mgtGoodsEditParam.setSpuErpCode(mgtGoodsEditParam.getSpuErpCode());
// }
// }
if (log.isDebugEnabled()) {
log.debug("商品管理:商品编辑:SPU编辑:[GoblinStoreMgtGoodsCouponAddParam={}]", JsonUtils.toJson(mgtGoodsEditParam));
}
boolean resultFlg = goblinstoreMgtGoodsService.couponGoodsEditSpu(currentUid, mgtGoodsEditParam, mgtGoodsInfoVo);
return resultFlg ? ResponseDto.success() : ResponseDto.failure();
}
@ApiOperationSupport(order = 7)
@ApiOperation(value = "商品编辑:SKU编辑", notes = "只修改单品信息,不包含商品信息")
@PostMapping("edit_sku")
......@@ -723,8 +884,8 @@ public class GoblinStoreMgtGoodsController {
if (null == goodsInfoVo || !goodsInfoVo.getDelFlg().equals("0")) {
return ResponseDto.failure(ErrorMapping.get("149010"));
}
if (goodsInfoVo.getSpuType() == 1) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品为数字藏品");
if (goodsInfoVo.getSpuType() != 0) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非常规商品");
}
{// 分类、ISBN校验
String cateFid = goodsInfoVo.getCateFid(), cateSid = goodsInfoVo.getCateSid(), cateTid = goodsInfoVo.getCateTid();
......@@ -895,11 +1056,10 @@ public class GoblinStoreMgtGoodsController {
return ResponseDto.success(mgtGoodsSkuInfoVo);
} else {
if (null != operStock && operStock != 0) {// 处理库存:回滚
int operStockVal = Math.abs(operStock);
if (operStock > 0) {// 增加的减回去
goblinRedisUtils.decrSkuStock(null, paramSkuId, operStockVal);
goblinRedisUtils.decrSkuStock(null, paramSkuId, Math.abs(operStock));
} else {// 扣减的加回去
goblinRedisUtils.incrSkuStock(null, paramSkuId, operStockVal);
goblinRedisUtils.incrSkuStock(null, paramSkuId, Math.abs(operStock));
}
}
return ResponseDto.failure(ErrorMapping.get("149013"));
......@@ -923,7 +1083,7 @@ public class GoblinStoreMgtGoodsController {
if (null == mgtGoodsInfoVo || !mgtGoodsInfoVo.getDelFlg().equals("0")) {
return ResponseDto.failure(ErrorMapping.get("149010"));
}
if (mgtGoodsInfoVo.getSpuType() == 0) {
if (mgtGoodsInfoVo.getSpuType() != 1) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非数字藏品");
}
BigDecimal hitRatio = mgtDigitalGoodsEditSkuParam.getHitRatio();
......@@ -990,6 +1150,73 @@ public class GoblinStoreMgtGoodsController {
return ResponseDto.failure(ErrorMapping.get("149013"));
}
@ApiOperationSupport(order = 7)
@ApiOperation(value = "商品编辑:SKU编辑-券类商品", notes = "只修改单品信息,不包含商品信息")
@PostMapping("coupon/edit_sku")
public ResponseDto<Object> couponEditSku(@Valid @RequestBody GoblinStoreMgtGoodsCouponEditSkuParam mgtGoodsEditSkuParam) {
String currentUid = CurrentUtil.getCurrentUid(), storeId = mgtGoodsEditSkuParam.getStoreId();
if (!goblinRedisUtils.hasStoreId(currentUid, storeId)) {
return ResponseDto.failure(ErrorMapping.get("149002"));
}
String paramSkuId = mgtGoodsEditSkuParam.getSkuId();
GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo;
if (StringUtils.isBlank(paramSkuId)
|| null == (mgtGoodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(paramSkuId))
|| !mgtGoodsSkuInfoVo.getStoreId().equals(storeId)
|| !mgtGoodsSkuInfoVo.getDelFlg().equals("0")) {
return ResponseDto.failure(ErrorMapping.get("149011"));
}
if (mgtGoodsSkuInfoVo.getSkuType() != 2) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非券类商品");
}
if (log.isDebugEnabled()) {
log.debug("商品管理:商品编辑:SKU编辑:[GoblinStoreMgtGoodsEditSkuParam={}]", JsonUtils.toJson(mgtGoodsEditSkuParam));
}
GoblinGoodsInfoVo goodsInfoVo = goblinRedisUtils.getGoodsInfoVo(mgtGoodsSkuInfoVo.getSpuId());
mgtGoodsEditSkuParam.setStock(mgtGoodsSkuInfoVo.getStock());
mgtGoodsEditSkuParam.setSkuStock(mgtGoodsSkuInfoVo.getSkuStock());
// mgtGoodsEditSkuParam.setWarningStock(mgtGoodsSkuInfoVo.getWarningStock());
Integer operStock = mgtGoodsEditSkuParam.getOperStock();
if (null != operStock && operStock != 0) {// 处理库存
int operStockVal = Math.abs(operStock);
Integer stock = mgtGoodsSkuInfoVo.getStock();// 总库存
Integer skuStock = mgtGoodsSkuInfoVo.getSkuStock();// SKU总库存
int surplusStock = goblinRedisUtils.getSkuStock(null, paramSkuId);// 当前剩余库存
if (operStock < 0 && surplusStock > 0 && surplusStock >= operStockVal) {// SKU实时库存充足时允许扣减
if (goblinRedisUtils.decrSkuStock(null, paramSkuId, operStockVal) < 0) {// 过程中库存不足时,回滚库存,编辑无效
goblinRedisUtils.incrSkuStock(null, paramSkuId, operStockVal);
return ResponseDto.failure(ErrorMapping.get("149012"));
} else {
mgtGoodsEditSkuParam.setSkuStock(skuStock - operStockVal);
mgtGoodsEditSkuParam.setStock(stock - operStockVal);
}
} else if (operStock > 0) {// 增加
goblinRedisUtils.incrSkuStock(null, paramSkuId, operStockVal);
mgtGoodsEditSkuParam.setSkuStock(skuStock + operStockVal);
mgtGoodsEditSkuParam.setStock(stock + operStockVal);
} else {
return ResponseDto.failure(ErrorMapping.get("149012"));
}
}
if (goblinstoreMgtGoodsService.couponGoodsEditSku(currentUid, mgtGoodsEditSkuParam, goodsInfoVo)) {
mgtGoodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(paramSkuId);
mgtGoodsSkuInfoVo.setSurplusStock(goblinRedisUtils.getSkuStock(null, paramSkuId));
return ResponseDto.success(mgtGoodsSkuInfoVo);
} else {
if (null != operStock && operStock != 0) {// 处理库存:回滚
int operStockVal = Math.abs(operStock);
if (operStock > 0) {// 增加的减回去
goblinRedisUtils.decrSkuStock(null, paramSkuId, operStockVal);
} else {// 扣减的加回去
goblinRedisUtils.incrSkuStock(null, paramSkuId, operStockVal);
}
}
return ResponseDto.failure(ErrorMapping.get("149013"));
}
}
@ApiOperationSupport(order = 8)
@ApiOperation(value = "商品编辑:SKU添加")
@PutMapping("edit_sku/add")
......@@ -1010,8 +1237,8 @@ public class GoblinStoreMgtGoodsController {
|| !goodsInfoVo.getStoreId().equals(storeId)) {
return ResponseDto.failure(ErrorMapping.get("149010"));
}
if (goodsInfoVo.getSpuType() == 1) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品为数字藏品");
if (goodsInfoVo.getSpuType() != 0) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非常规商品");
}
{// 分类、ISBN校验
String cateFid = goodsInfoVo.getCateFid(), cateSid = goodsInfoVo.getCateSid(), cateTid = goodsInfoVo.getCateTid();
......@@ -1117,7 +1344,7 @@ public class GoblinStoreMgtGoodsController {
if (null == goodsInfoVo || !goodsInfoVo.getDelFlg().equals("0") || !goodsInfoVo.getStoreId().equals(storeId)) {
return ResponseDto.failure(ErrorMapping.get("149010"));
}
if (goodsInfoVo.getSpuType() == 0) {
if (goodsInfoVo.getSpuType() != 1) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "该商品非数字藏品");
}
String unbox = mgtDigitalGoodsAddSkuParam.getUnbox();
......@@ -1229,8 +1456,8 @@ public class GoblinStoreMgtGoodsController {
if (null == mgtGoodsSkuInfoVo || !mgtGoodsSkuInfoVo.getDelFlg().equals("0") || !mgtGoodsSkuInfoVo.getStoreId().equals(storeId)) {
return ResponseDto.failure(ErrorMapping.get("149011"));
}
if (mgtGoodsSkuInfoVo.getSkuType() == 1) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品为数字藏品");
if (mgtGoodsSkuInfoVo.getSkuType() != 0) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "无效操作,该商品非常规商品");
}
if (mgtGoodsSkuInfoVo.getShelvesStatus().equals("3")) {
return ResponseDto.failure(ErrorMapping.get("149016"));
......
......@@ -563,7 +563,7 @@ public class GoblinFrontServiceImpl implements GoblinFrontService {
Criteria.where("storeId").in(listStore),
Criteria.where("extagVoList.tagName").is(name)
),
new Criteria().orOperator(Criteria.where("spuType").exists(false), (Criteria.where("spuType").is(0)))
new Criteria().orOperator(Criteria.where("spuType").exists(false), (Criteria.where("spuType").in(0, 2)))
));
long count = mongoTemplate.count(query, GoblinGoodsInfoVo.class.getSimpleName());
query.with(PageRequest.of(page, pageSize)).with(Sort.by(
......
......@@ -9,6 +9,8 @@ import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.candy.constant.CandyRedisConst;
import com.liquidnet.service.candy.dto.CandyUserCouponBasicDto;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinBackOrder;
......@@ -28,6 +30,8 @@ import java.time.LocalDateTime;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.stream.IntStream;
import static com.liquidnet.commons.lang.util.DateUtil.DTF_YMD_HMS;
import static com.liquidnet.commons.lang.util.DateUtil.DTFYMDHMS;
......@@ -116,6 +120,7 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
List<GoblinOrderSkuVo> skuVos = ObjectUtil.getGoblinOrderSkuVoArrayList();
for (String orderSkuId : orderVo.getOrderSkuVoIds()) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuId);
orderSkuVo.desensitize();// 商品订单页面展示-关联人信息脱敏
skuVos.add(orderSkuVo);
}
LocalDateTime canRefundTime = getCanRefundTime(orderVo);
......@@ -155,6 +160,21 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
return ResponseDto.success(vo);
}
@Override
public Integer couponState(String orderSkuId, String uid) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuId);
if (Objects.equals(orderSkuVo.getSkuType(), 2)) {// 券类商品-校验发放的券是否已使用
// 券类商品默认一个商品对应一个券,下单只可购买一张
List<CandyUserCouponBasicDto> vos = (List<CandyUserCouponBasicDto>) redisUtils.get(CandyRedisConst.BASIC_USER_COUPON.concat(uid));
if (!CollectionUtil.isEmpty(vos)) {
CandyUserCouponBasicDto basicDto = vos.stream().filter(r -> r.getUcouponId().equals(orderSkuId)).findAny().orElse(null);
return (!Objects.isNull(basicDto) && basicDto.getState() == 5) ? 5 : 1;
}
}
return 1;
}
@Override
public ResponseDto<Boolean> getProduce(String orderId, String uid) {
LocalDateTime now = LocalDateTime.now();
......@@ -207,11 +227,13 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
sqls.add(SqlMapping.get("goblin_order.store.orderStatus"));
sqls.add(SqlMapping.get("goblin_order.store.orderSkuStatus"));
sqls.add(SqlMapping.get("goblin_order.store.refundLog"));
sqls.add(SqlMapping.get("candy_user_coupon.update_apply_refund"));
LinkedList<Object[]> applyRefund = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> orderStatus = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> orderSkuStatus = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> refundLog = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> updateCandyUserCouponObjs = CollectionUtil.linkedListObjectArr();
String uid = CurrentUtil.getCurrentUid();
LocalDateTime now = LocalDateTime.now();
......@@ -331,6 +353,25 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
} else if (orderVo.getStatus() == GoblinStatusConst.Status.ORDER_STATUS_4.getValue()) {
if (param.getOrderSkuId() != null) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(param.getOrderSkuId());
if (Objects.equals(orderSkuVo.getSkuType(), 2)) {// 券类商品-校验发放的券是否已使用
// 券类商品默认一个商品对应一个券,下单只可购买一张
String ucKey = CandyRedisConst.BASIC_USER_COUPON.concat(orderVo.getUserId());
List<CandyUserCouponBasicDto> vos = (List<CandyUserCouponBasicDto>) redisUtils.get(ucKey);
int idx = IntStream.range(0, vos.size())
.filter(i -> vos.get(i).getUcouponId().equals(orderSkuVo.getOrderSkuId())).findFirst().orElse(-1);
if (-1 != idx) {
CandyUserCouponBasicDto basicDto = vos.get(idx);
if (5 == basicDto.getState()) {// 券状态为'5-已使用',则不可退款
return ResponseDto.failure("券已使用,不可申请");
}
basicDto.setState(2);// 置为'2-无效',防止用户在后台审核过程中使用券,造成券已使用,订单也退款
vos.set(idx, basicDto);
redisUtils.redisUtil.set(ucKey, vos);
updateCandyUserCouponObjs.add(new Object[]{basicDto.getState(), orderVo.getUserId(), now, basicDto.getUcouponId()});
} else {
log.warn("券类商品订单申请退款,未找到对应券[orderSkuId={},uid={}]", orderSkuVo.getOrderSkuId(), orderVo.getUserId());
}
}
//订单款式状态修改
orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_61.getValue());
GoblinBackOrderSkuVo backOrderSkuVo = GoblinBackOrderSkuVo.getNew();
......@@ -343,6 +384,7 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
backOrderSkuVo.setRefundPrice(orderSkuVo.getSkuPriceActual());
backOrderSkuVo.setSkuSpecs(orderSkuVo.getSkuSpecs());
backOrderSkuVo.setCreatedAt(nowStr);
backOrderSkuVo.setSkuType(orderSkuVo.getSkuType());
orderSkuVoList.add(backOrderSkuVo);
backOrderLog(orderVo, orderSkuVo, now);
//redis
......@@ -357,6 +399,24 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
for (String orderSkuId : orderVo.getOrderSkuVoIds()) {
//订单款式状态修改
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuId);
if (Objects.equals(orderSkuVo.getSkuType(), 2)) {// 券类商品-校验发放的券是否已使用
// 券类商品默认一个商品对应一个券,下单只可购买一张
String ucKey = CandyRedisConst.BASIC_USER_COUPON.concat(orderVo.getUserId());
List<CandyUserCouponBasicDto> vos = (List<CandyUserCouponBasicDto>) redisUtils.get(ucKey);
int idx = IntStream.range(0, vos.size()).filter(i -> vos.get(i).getUcouponId().equals(orderSkuVo.getOrderSkuId())).findFirst().orElse(-1);
if (-1 != idx) {
CandyUserCouponBasicDto basicDto = vos.get(idx);
if (5 == basicDto.getState()) {// 券状态为'5-已使用',则不可退款
return ResponseDto.failure("券已使用,不可申请");
}
basicDto.setState(2);// 置为'2-无效',防止用户在后台审核过程中使用券,造成券已使用,订单也退款
vos.set(idx, basicDto);
redisUtils.redisUtil.set(ucKey, vos);
updateCandyUserCouponObjs.add(new Object[]{basicDto.getState(), orderVo.getUserId(), now, basicDto.getUcouponId()});
} else {
log.warn("券类商品订单申请退款,未找到对应券[orderSkuId={},uid={}]", orderSkuVo.getOrderSkuId(), orderVo.getUserId());
}
}
orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_61.getValue());
GoblinBackOrderSkuVo backOrderSkuVo = GoblinBackOrderSkuVo.getNew();
backOrderSkuVo.setOrderSkuId(orderSkuId);
......@@ -368,6 +428,7 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
backOrderSkuVo.setSkuPic(orderSkuVo.getSkuImage());
backOrderSkuVo.setRefundPrice(orderSkuVo.getSkuPriceActual());
backOrderSkuVo.setCreatedAt(nowStr);
backOrderSkuVo.setSkuType(orderSkuVo.getSkuType());
orderSkuVoList.add(backOrderSkuVo);
backOrderLog(orderVo, orderSkuVo, now);
//redis
......@@ -409,7 +470,7 @@ public class GoblinOrderAppServiceImpl implements IGoblinOrderAppService {
backOrderLog.getBackOrderLogId(), backOrderLog.getBackOrderId(), backOrderLog.getOperationType(),
backOrderLog.getMessage(), backOrderLog.getOperationName(), backOrderLog.getStatus(), now
});
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getKey(), SqlMapping.gets(sqls, applyRefund, orderStatus, orderSkuStatus, refundLog));
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_USER_ORDER_OPERA.getKey(), SqlMapping.gets(sqls, applyRefund, orderStatus, orderSkuStatus, refundLog, updateCandyUserCouponObjs));
return ResponseDto.success();
}
......
......@@ -5,6 +5,8 @@ import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.candy.constant.CandyRedisConst;
import com.liquidnet.service.candy.dto.CandyUserCouponBasicDto;
import com.liquidnet.service.dragon.constant.DragonConstant;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.vo.*;
......@@ -25,6 +27,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.stream.IntStream;
@Service
@Slf4j
......@@ -102,6 +105,7 @@ public class GoblinStoreBackOrderServiceImpl implements IGoblinStoreBackOrderSer
for (String orderSkuVoId : orderVo.getOrderSkuVoIds()) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuVoId);
orderSkuVo.setStatus(vo.getStatus());
orderSkuVo.desensitize();// 商品订单页面展示-关联人信息脱敏
orderSkuVoList.add(orderSkuVo);
}
vo.setOrderSkuVoList(orderSkuVoList);
......@@ -219,6 +223,32 @@ public class GoblinStoreBackOrderServiceImpl implements IGoblinStoreBackOrderSer
return ResponseDto.failure("无法查看");
}
GoblinBackOrderVo backOrderVo = redisUtils.getBackOrderVo(backOrderId);
{// 券类商品-拒绝退款后,恢复已发放券状态
List<GoblinBackOrderSkuVo> backOrderSkuVos = backOrderVo.getBackOrderSkuVos();
for (GoblinBackOrderSkuVo backOrderSkuVo : backOrderSkuVos) {
if (2 == backOrderSkuVo.getSkuType()) {
// 券类商品默认一个商品对应一个券,下单只可购买一张
String ucKey = CandyRedisConst.BASIC_USER_COUPON.concat(backOrderVo.getUserId());
List<CandyUserCouponBasicDto> vos = (List<CandyUserCouponBasicDto>) redisUtils.get(ucKey);
int idx = IntStream.range(0, vos.size())
.filter(i -> vos.get(i).getUcouponId().equals(backOrderSkuVo.getOrderSkuId())).findFirst().orElse(-1);
if (-1 != idx) {
CandyUserCouponBasicDto basicDto = vos.get(idx);
basicDto.setState(1);// 恢复状态
vos.set(idx, basicDto);
redisUtils.redisUtil.set(ucKey, vos);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_STORE_ORDER_OPERA.getKey(),
SqlMapping.get("candy_user_coupon.update_apply_refund",
basicDto.getState(), uid, now, basicDto.getUcouponId()
)
);
} else {
log.warn("券类商品订单拒绝退款,未找到对应券[orderSkuId={},operator={}]", backOrderSkuVo.getOrderSkuId(), uid);
}
}
}
}
backOrderVo.setStatus(GoblinStatusConst.Status.ORDER_BACK_STATUS_3.getValue());
backOrderVo.setRefuseAt(nowStr);
backOrderVo.setRefuseSize(backOrderVo.getRefuseSize() == null ? 1 : backOrderVo.getRefuseSize() + 1);
......
......@@ -3,6 +3,7 @@ package com.liquidnet.service.goblin.service.impl.manage;
import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.common.exception.constant.ErrorCode;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.SqlMapping;
......@@ -264,6 +265,158 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), SqlMapping.gets(toMqSqls, initGoodsObjs));
}
@Override
public void couponGoodsAdd(GoblinGoodsInfoVo goodsInfoVo, List<GoblinGoodsSkuInfoVo> goodsSkuInfoVoList) {
goblinMongoUtils.setGoodsInfoVo(goodsInfoVo);
goblinMongoUtils.setGoodsSkuInfoVos(goodsSkuInfoVoList);
if (goodsInfoVo.getShelvesHandle().equals("2")) {
goblinRedisUtils.deleteKeyForSelectGoods();// 精选商品:商品上架、下架、删除 调用的方法
}
String createdBy = goodsInfoVo.getCreatedBy();
LocalDateTime createdAt = goodsInfoVo.getCreatedAt();
String spuId = goodsInfoVo.getSpuId();
LinkedList<Object[]> initGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> initGoodsSkuSpecValueObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> initGoodsCategorySpecObjs = CollectionUtil.linkedListObjectArr();
{// 分类规格记录
String cateFid = goodsInfoVo.getCateFid(), cateSid = goodsInfoVo.getCateSid(), cateTid = goodsInfoVo.getCateTid();
String filterCateId = StringUtils.isBlank(cateTid) ? (StringUtils.isBlank(cateSid) ? cateFid : cateSid) : cateTid;
GoblinMgtCategorySpecVo mgtCategorySpecVoCache = goblinRedisUtils.getCategorySpec(filterCateId);// 分类绑定的规格信息
List<String> addSpecNameList = goodsSkuInfoVoList.get(0).getSkuSpecList().stream().map(GoblinGoodsSpecDto::getSpecName).collect(Collectors.toList());
if (null == mgtCategorySpecVoCache) {// 根据分类ID未查取到规格信息,则Cache、数据库新增
GoblinMgtCategorySpecVo initMgtCategorySpecVo = GoblinMgtCategorySpecVo.getNew().setCateId(filterCateId).setSpecNameList(addSpecNameList);
goblinMongoUtils.setCategorySpecVo(initMgtCategorySpecVo);
goblinRedisUtils.setCategorySpec(filterCateId, initMgtCategorySpecVo);
addSpecNameList.forEach(r -> initGoodsCategorySpecObjs.add(new Object[]{filterCateId, r}));
} else {// 根据分类ID查取到规格信息,则进一步比对判断是否新增
List<String> confirmAddSpecNameList = addSpecNameList.stream().filter(r -> !mgtCategorySpecVoCache.getSpecNameList().contains(r)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(confirmAddSpecNameList)) {// 不存在于`mgtCategorySpecVoCache`的,则更新Cache,数据库新增
mgtCategorySpecVoCache.getSpecNameList().addAll(confirmAddSpecNameList);
goblinMongoUtils.updateCategorySpecVo(mgtCategorySpecVoCache);
goblinRedisUtils.setCategorySpec(filterCateId, mgtCategorySpecVoCache);
confirmAddSpecNameList.forEach(r -> initGoodsCategorySpecObjs.add(new Object[]{filterCateId, r}));
}
}
}
LinkedList<Object[]> initGoodsSkuCouponObjs = CollectionUtil.linkedListObjectArr();// 券类商品信息
LinkedList<Object[]> initCandyCouponObjs = CollectionUtil.linkedListObjectArr();// 券信息
LinkedList<Object[]> initCandyCouponRuleObjs = CollectionUtil.linkedListObjectArr();// 券规则信息
int skuSize = goodsSkuInfoVoList.size();
for (int i = 0; i < skuSize; i++) {
GoblinGoodsSkuInfoVo skuInfoVo = goodsSkuInfoVoList.get(i);
String skuId = skuInfoVo.getSkuId();
String buyRoster = skuInfoVo.getBuyRoster();
goblinRedisUtils.setSkuStock(null, skuId, skuInfoVo.getSkuStock());
initGoodsSkuObjs.add(new Object[]{
skuId, skuInfoVo.getSpuId(), skuInfoVo.getSkuNo(), skuInfoVo.getSkuBarCode(), skuInfoVo.getSkuErpCode(),
skuInfoVo.getErpType(), skuInfoVo.getErpHosting(), skuInfoVo.getErpWarehouseNo(), skuInfoVo.getName(),
skuInfoVo.getSubtitle(), skuInfoVo.getSellPrice(), skuInfoVo.getSkuPic(), skuInfoVo.getSkuIsbn(), skuInfoVo.getStock(),
skuInfoVo.getSkuStock(), skuInfoVo.getWarningStock(), skuInfoVo.getPrice(), skuInfoVo.getPriceMember(), skuInfoVo.getWeight(),
skuInfoVo.getBuyFactor(), buyRoster, skuInfoVo.getBuyLimit(), skuInfoVo.getStoreId(), skuInfoVo.getSkuValidity(),
skuInfoVo.getVirtualFlg(), skuInfoVo.getStatus(), skuInfoVo.getShelvesStatus(), skuInfoVo.getSkuAppear(), skuInfoVo.getShelvesAt(),
createdBy, createdAt, skuInfoVo.getLogisticsTemplate()
});
if (2 == goodsInfoVo.getSpuType()) {// 券类商品为一个SPU对应一个SKU
initGoodsSkuCouponObjs.add(new Object[]{skuId, skuInfoVo.getBusiType(), skuInfoVo.getCouType(), skuInfoVo.getUseScope(),
skuInfoVo.getValFace(), skuInfoVo.getIsTrueName(), skuInfoVo.getValidity(), skuInfoVo.getEffectAt(), skuInfoVo.getExpireAt()});
initCandyCouponObjs.add(new Object[]{skuId, goodsInfoVo.getName(), goodsInfoVo.getIntro(), skuInfoVo.getBusiType(),
skuInfoVo.getCouType(), skuInfoVo.getValFace(), skuInfoVo.getValidity(), skuInfoVo.getIsTrueName(),
skuInfoVo.getEffectAt(), skuInfoVo.getExpireAt(), createdBy, createdAt
});
String busiName = "%s";
switch (skuInfoVo.getUseScope()) {// 适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]
case 101:// 音乐节
busiName = String.format(busiName, "草莓、M_DSK、五百里音乐节");// 按杨要求文案'音乐节'改'草莓、M_DSK、五百里音乐节'
break;
case 102:// 小型演出(LiveHouse演出)
busiName = String.format(busiName, "小型演出(LiveHouse演出)系列");
break;
case 103:// 巡演
busiName = String.format(busiName, "巡演 系列");
break;
}
initCandyCouponRuleObjs.add(new Object[]{IDGenerator.nextTimeId2(), skuId, skuInfoVo.getUseScope(), busiName, ""});
}
skuInfoVo.getSkuSpecList().forEach(skuSpecDto -> initGoodsSkuSpecValueObjs.add(new Object[]{
spuId, skuId, skuSpecDto.getSpecName(), skuSpecDto.getSpecVname()
}));
if (skuInfoVo.getBuyFactor().equals("2") && StringUtils.isNotBlank(buyRoster) && buyRoster.startsWith("http")) {
queueUtils.sendMsgByRedisXls(buyRoster, "1", skuId);
}
}
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods.insert"));
LinkedList<Object[]> initGoodsObjs = CollectionUtil.linkedListObjectArr();
initGoodsObjs.add(new Object[]{
spuId, goodsInfoVo.getSpuNo(), goodsInfoVo.getSpuBarCode(), goodsInfoVo.getSpuErpCode(), goodsInfoVo.getErpType(),
goodsInfoVo.getName(), goodsInfoVo.getSubtitle(), goodsInfoVo.getSellPrice(), goodsInfoVo.getPriceGe(), goodsInfoVo.getPriceLe(),
goodsInfoVo.getIntro(), goodsInfoVo.getDetails(), goodsInfoVo.getCoverPic(), goodsInfoVo.getVideo(), goodsInfoVo.getSpecMode(),
goodsInfoVo.getStoreId(), goodsInfoVo.getCateFid(), goodsInfoVo.getCateSid(), goodsInfoVo.getCateTid(), goodsInfoVo.getStoreCateFid(),
goodsInfoVo.getStoreCateSid(), goodsInfoVo.getStoreCateTid(), goodsInfoVo.getBrandId(), goodsInfoVo.getShelvesHandle(), goodsInfoVo.getShelvesTime(),
goodsInfoVo.getSpuValidity(), goodsInfoVo.getVirtualFlg(), goodsInfoVo.getStatus(), goodsInfoVo.getShelvesStatus(), goodsInfoVo.getSpuAppear(),
goodsInfoVo.getShelvesAt(), createdBy, createdAt, goodsInfoVo.getLogisticsTemplate()
});
toMqSqls.add(SqlMapping.get("goblin_goods_sku.insert"));
toMqSqls.add(SqlMapping.get("goblin_goods_sku_coupon.insert"));
toMqSqls.add(SqlMapping.get("candy_coupon.goods_insert"));
toMqSqls.add(SqlMapping.get("candy_coupon_rule.goods_insert"));
toMqSqls.add(SqlMapping.get("goblin_goods_image.insert_byreplace"));
LinkedList<Object[]> initGoodsImageObjs = CollectionUtil.linkedListObjectArr();
if (CollectionUtils.isEmpty(goodsInfoVo.getImageList())) {
goodsInfoVo.getImageList().forEach(imageUrl -> initGoodsImageObjs.add(new Object[]{spuId, imageUrl}));
}
toMqSqls.add(SqlMapping.get("goblin_goods_tag.insert_byreplace"));
LinkedList<Object[]> initGoodsTagObjs = CollectionUtil.linkedListObjectArr();
if (!CollectionUtils.isEmpty(goodsInfoVo.getTagVoList())) {
goodsInfoVo.getTagVoList().forEach(tagVo -> initGoodsTagObjs.add(new Object[]{spuId, tagVo.getTagId(), tagVo.getSort(), "0"}));
}
if (!CollectionUtils.isEmpty(goodsInfoVo.getExtagVoList())) {
goodsInfoVo.getExtagVoList().forEach(exTagVo -> initGoodsTagObjs.add(new Object[]{spuId, exTagVo.getTagId(), exTagVo.getSort(), "1"}));
}
toMqSqls.add(SqlMapping.get("goblin_goods_artag.insert_byreplace"));
LinkedList<Object[]> initGoodsArTagObjs = CollectionUtil.linkedListObjectArr();
if (!CollectionUtils.isEmpty(goodsInfoVo.getArtagVoList())) {
goodsInfoVo.getArtagVoList().forEach(arTagVo -> initGoodsArTagObjs.add(new Object[]{spuId, arTagVo.getTagId(), arTagVo.getSort(), "1"}));
}
toMqSqls.add(SqlMapping.get("goblin_goods_service_support.insert_byreplace"));
LinkedList<Object[]> initGoodsServiceSupportObjs = CollectionUtil.linkedListObjectArr();
if (!CollectionUtils.isEmpty(goodsInfoVo.getServiceSupportVoList())) {
goodsInfoVo.getServiceSupportVoList().forEach(ssvo -> initGoodsServiceSupportObjs.add(new Object[]{spuId, ssvo.getSsid()}));
}
toMqSqls.add(SqlMapping.get("goblin_goods_spec.insert_byreplace"));
LinkedList<Object[]> initGoodsSpecObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spec_value.insert_byreplace"));
LinkedList<Object[]> initGoodsSpecValueObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_spu_spec_value.insert_byreplace"));// SPU规格信息
LinkedList<Object[]> initGoodsSpuSpecValueObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_sku_spec_value.insert_byreplace"));// SKU规格信息
{// 规格记录
List<GoblinGoodsSpecVo> specVoList = goodsInfoVo.getSpecVoList();
specVoList.forEach(s -> {
initGoodsSpecObjs.add(new Object[]{s.getSpecName(), createdAt});
s.getSpecValues().forEach(sv -> {
initGoodsSpecValueObjs.add(new Object[]{s.getSpecName(), sv.getSpecVname(), createdAt});
initGoodsSpuSpecValueObjs.add(new Object[]{spuId, s.getSpecName(), sv.getSpecVname(), sv.getSpecVsort()});
});
});
}
toMqSqls.add(SqlMapping.get("goblin_goods_category_spec.insert_byreplace"));// 分类关联规格信息
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, initGoodsObjs, initGoodsSkuObjs, initGoodsSkuCouponObjs, initCandyCouponObjs, initCandyCouponRuleObjs,
initGoodsImageObjs, initGoodsTagObjs, initGoodsArTagObjs, initGoodsServiceSupportObjs, initGoodsSpecObjs,
initGoodsSpecValueObjs, initGoodsSpuSpecValueObjs, initGoodsSkuSpecValueObjs, initGoodsCategorySpecObjs)
);
}
@Override
public GoblinStoreMgtGoodsInfoVo goodsInfo(String storeId, String spuId) {
GoblinStoreMgtGoodsInfoVo vo = GoblinStoreMgtGoodsInfoVo.getNew();
......@@ -648,6 +801,294 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
return false;
}
@Override
public boolean couponGoodsEditSpu(String uid, GoblinStoreMgtGoodsCouponAddParam mgtGoodsAddParam, GoblinGoodsInfoVo mgtGoodsInfoVo) {
String spuId = mgtGoodsAddParam.getSpuId();
GoblinGoodsInfoVo updateSpuInfoVo = mgtGoodsAddParam.initEditGoodsInfoVo();
boolean updateTagFlg = false, updateExtagFlg = false, updateArtagFlg = false;
List<GoblinGoodsTagVo> befTagVoList = mgtGoodsInfoVo.getTagVoList();
boolean befTagIsEmptyFlg = CollectionUtils.isEmpty(befTagVoList);
List<GoblinGoodsExtagVo> befExtagVoList = mgtGoodsInfoVo.getExtagVoList();
boolean befExtagIsEmptyFlg = CollectionUtils.isEmpty(befExtagVoList);
List<GoblinGoodsExtagVo> befArtagVoList = mgtGoodsInfoVo.getArtagVoList();
boolean befArtagIsEmptyFlg = CollectionUtils.isEmpty(befArtagVoList);
boolean paramTagIsEmptyFlg, paramExtagIsEmptyFlg, paramArtagIsEmptyFlg;
List<GoblinGoodsTagVo> paramTagVoList = ObjectUtil.getGoblinGoodsTagVoArrayList();
List<GoblinGoodsExtagVo> paramExtagVoList = ObjectUtil.getGoblinGoodsExtagVoArrayList();
List<GoblinGoodsExtagVo> paramArtagVoList = ObjectUtil.getGoblinGoodsExtagVoArrayList();
{// 标签处理
List<String> goodsTagIdList = mgtGoodsAddParam.getTagList(),
goodsExtagIdList = mgtGoodsAddParam.getExtagList(),
goodsArtagIdList = mgtGoodsAddParam.getArtagList();
if (!CollectionUtils.isEmpty(goodsTagIdList)) {
List<GoblinSelfTagVo> selfGoodsTagVos = goblinRedisUtils.getSelfTagVos();
for (int i = 0; i < goodsTagIdList.size(); i++)
for (GoblinSelfTagVo r : selfGoodsTagVos)
if (r.getTagId().equals(goodsTagIdList.get(i)) && r.getTagBelong().equals("0")) {
paramTagVoList.add(GoblinGoodsTagVo.getNew().copy(r).setSort(i));
break;
}
}
List<GoblinSelfTagVo> selfExtagVos = null;
if (!CollectionUtils.isEmpty(goodsExtagIdList)) {
selfExtagVos = goblinRedisUtils.getSelfExtagVos();
for (int i = 0; i < goodsExtagIdList.size(); i++)
for (GoblinSelfTagVo r : selfExtagVos)
if (r.getTagId().equals(goodsExtagIdList.get(i)) && r.getTagBelong().equals("1") && !r.getTagType().equals("5")) {
paramExtagVoList.add(GoblinGoodsExtagVo.getNew().copy(r).setSort(i));
break;
}
}
if (!CollectionUtils.isEmpty(goodsArtagIdList)) {
selfExtagVos = CollectionUtils.isEmpty(selfExtagVos) ? goblinRedisUtils.getSelfExtagVos() : selfExtagVos;
for (int i = 0; i < goodsArtagIdList.size(); i++)
for (GoblinSelfTagVo r : selfExtagVos)
if (r.getTagId().equals(goodsArtagIdList.get(i)) && r.getTagBelong().equals("1")) {
paramArtagVoList.add(GoblinGoodsExtagVo.getNew().copy(r).setSort(i));
break;
}
}
paramTagIsEmptyFlg = CollectionUtils.isEmpty(paramTagVoList);
paramExtagIsEmptyFlg = CollectionUtils.isEmpty(paramExtagVoList);
paramArtagIsEmptyFlg = CollectionUtils.isEmpty(paramArtagVoList);
if (!befTagIsEmptyFlg || !paramTagIsEmptyFlg) {
if (!befTagIsEmptyFlg && !paramTagIsEmptyFlg) {
if (paramTagVoList.size() != befTagVoList.size()) {
updateTagFlg = true;
} else {
List<String> befTagIdList = befTagVoList.stream().map(GoblinGoodsTagVo::getTagId).collect(Collectors.toList());
for (GoblinGoodsTagVo vo : paramTagVoList) {
if (!befTagIdList.contains(vo.getTagId())) {
updateTagFlg = true;
break;
}
}
}
} else {
updateTagFlg = true;
}
}
if (updateTagFlg) {
updateSpuInfoVo.setTagVoList(paramTagIsEmptyFlg ? ObjectUtil.getGoblinGoodsTagVoArrayList() : paramTagVoList);
}
if (!befExtagIsEmptyFlg || !paramExtagIsEmptyFlg) {
if (!befExtagIsEmptyFlg && !paramExtagIsEmptyFlg) {
if (paramExtagVoList.size() != befExtagVoList.size()) {
updateExtagFlg = true;
} else {
List<String> befExtagIdList = befExtagVoList.stream().map(GoblinGoodsExtagVo::getTagId).collect(Collectors.toList());
for (GoblinGoodsExtagVo vo : paramExtagVoList) {
if (!befExtagIdList.contains(vo.getTagId())) {
updateExtagFlg = true;
break;
}
}
}
} else {
updateExtagFlg = true;
}
}
if (updateExtagFlg) {
updateSpuInfoVo.setExtagVoList(paramExtagIsEmptyFlg ? ObjectUtil.getGoblinGoodsExtagVoArrayList() : paramExtagVoList);
}
if (!befArtagIsEmptyFlg || !paramArtagIsEmptyFlg) {
if (!befArtagIsEmptyFlg && !paramArtagIsEmptyFlg) {
if (paramArtagVoList.size() != befArtagVoList.size()) {
updateArtagFlg = true;
} else {
List<String> befArtagIdList = befArtagVoList.stream().map(GoblinGoodsExtagVo::getTagId).collect(Collectors.toList());
for (GoblinGoodsExtagVo vo : paramArtagVoList) {
if (!befArtagIdList.contains(vo.getTagId())) {
updateArtagFlg = true;
break;
}
}
}
} else {
updateArtagFlg = true;
}
}
if (updateArtagFlg) {
updateSpuInfoVo.setArtagVoList(paramArtagIsEmptyFlg ? ObjectUtil.getGoblinGoodsExtagVoArrayList() : paramArtagVoList);
}
}
boolean updateSsidFlg = false;
List<String> ssidList = mgtGoodsAddParam.getSsidList();
boolean paramSsidListIsEmptyFlg = CollectionUtils.isEmpty(ssidList);
List<GoblinServiceSupportVo> serviceSupportVoList = mgtGoodsInfoVo.getServiceSupportVoList();
boolean befServiceSupportVoListIsEmptyFlg = CollectionUtils.isEmpty(serviceSupportVoList);
{// 服务支持处理
if (!befServiceSupportVoListIsEmptyFlg || !paramSsidListIsEmptyFlg) {
if (!befServiceSupportVoListIsEmptyFlg && !paramSsidListIsEmptyFlg) {
if (serviceSupportVoList.size() != ssidList.size()) {
updateSsidFlg = true;
} else {
List<String> befSsidList = serviceSupportVoList.stream().map(GoblinServiceSupportVo::getSsid).collect(Collectors.toList());
for (String ssid : ssidList) {
if (!befSsidList.contains(ssid)) {
updateSsidFlg = true;
break;
}
}
}
} else {
updateSsidFlg = true;
}
}
if (updateSsidFlg) {
updateSpuInfoVo.setServiceSupportVoList(paramSsidListIsEmptyFlg ? ObjectUtil.getGoblinServiceSupportVoArrayList() : goblinMongoUtils.getServiceSupportVos(ssidList));
}
}
boolean updateImageFlg = false;
List<String> paramImageList = mgtGoodsAddParam.getImageList();
List<String> befImageList = mgtGoodsInfoVo.getImageList();
{// 图片处理
if (befImageList.size() != paramImageList.size()) {
updateImageFlg = true;
} else {
for (String imageUrl : paramImageList) {
if (!befImageList.contains(imageUrl)) {
updateImageFlg = true;
break;
}
}
}
if (updateImageFlg) {
updateSpuInfoVo.setImageList(paramImageList);
}
}
updateSpuInfoVo.setUpdatedBy(uid);
updateSpuInfoVo.setUpdatedAt(LocalDateTime.now());
if (goblinMongoUtils.updateGoodsInfoVo(updateSpuInfoVo)) {
goblinRedisUtils.delGoodsInfoVo(updateSpuInfoVo.getSpuId());
log.info("商品管理:SPU编辑[UID={},PARAMS={}]", uid, JsonUtils.toJson(mgtGoodsAddParam));
GoblinGoodsSkuInfoVo updateSkuInfoVo = GoblinGoodsSkuInfoVo.getNew();
updateSkuInfoVo.setSpuId(updateSpuInfoVo.getSpuId());
updateSkuInfoVo.setSkuNo(updateSpuInfoVo.getSpuNo());
// updateSkuInfoVo.setName(updateSpuInfoVo.getName());
// updateSkuInfoVo.setSubtitle(updateSpuInfoVo.getSubtitle());
updateSkuInfoVo.setVirtualFlg(updateSpuInfoVo.getVirtualFlg());
updateSkuInfoVo.setLogisticsTemplate(updateSpuInfoVo.getLogisticsTemplate());
updateSkuInfoVo.setSkuPic(updateSpuInfoVo.getCoverPic());// 默认使用SPU的
updateSkuInfoVo.setUpdatedBy(updateSpuInfoVo.getUpdatedBy());
updateSkuInfoVo.setUpdatedAt(updateSpuInfoVo.getUpdatedAt());
LinkedList<Object[]> updateGoodsInfoObjs = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> updateGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
// 参与活动的同一商品更新处理
List<String> marketSpuIdList = goblinMongoUtils.updateGoodsInfoVoForMarket(spuId, mgtGoodsInfoVo.getSpuNo(), updateSpuInfoVo);
if (!CollectionUtils.isEmpty(marketSpuIdList)) {
marketSpuIdList.forEach(marketSpuId -> {
goblinRedisUtils.delGoodsInfoVo(marketSpuId);
updateGoodsInfoObjs.add(new Object[]{
updateSpuInfoVo.getSpuNo(), updateSpuInfoVo.getName(), updateSpuInfoVo.getSubtitle(), updateSpuInfoVo.getSellPrice(),
updateSpuInfoVo.getIntro(), updateSpuInfoVo.getDetails(), updateSpuInfoVo.getCoverPic(), updateSpuInfoVo.getVideo(),
"2", updateSpuInfoVo.getCateFid(), updateSpuInfoVo.getCateSid(), updateSpuInfoVo.getCateTid(),
updateSpuInfoVo.getShelvesHandle(), updateSpuInfoVo.getShelvesTime(), updateSpuInfoVo.getSpuValidity(), updateSpuInfoVo.getVirtualFlg(),
updateSpuInfoVo.getLogisticsTemplate(), updateSpuInfoVo.getUpdatedBy(), updateSpuInfoVo.getUpdatedAt(), updateSpuInfoVo.getSpuErpCode(),
marketSpuId
});
updateGoodsSkuObjs.add(new Object[]{
updateSkuInfoVo.getSkuNo(), updateSkuInfoVo.getVirtualFlg(), updateSkuInfoVo.getLogisticsTemplate(),
updateSkuInfoVo.getSkuPic(), updateSkuInfoVo.getUpdatedBy(), updateSkuInfoVo.getUpdatedAt(), marketSpuId
});
});
}
// goblinMongoUtils.updateGoodsSkuInfoVoBySpuId(updateSkuInfoVo);
goblinMongoUtils.updateGoodsSkuInfoVoPropBySpuId(updateSkuInfoVo);
goblinRedisUtils.delGoodsSkuInfoVo(mgtGoodsInfoVo.getSkuIdList().get(0));
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_edit"));
updateGoodsInfoObjs.add(new Object[]{
updateSpuInfoVo.getSpuNo(), updateSpuInfoVo.getName(), updateSpuInfoVo.getSubtitle(), updateSpuInfoVo.getSellPrice(),
updateSpuInfoVo.getIntro(), updateSpuInfoVo.getDetails(), updateSpuInfoVo.getCoverPic(), updateSpuInfoVo.getVideo(),
updateSpuInfoVo.getSpecMode(), updateSpuInfoVo.getCateFid(), updateSpuInfoVo.getCateSid(), updateSpuInfoVo.getCateTid(),
updateSpuInfoVo.getShelvesHandle(), updateSpuInfoVo.getShelvesTime(), updateSpuInfoVo.getSpuValidity(), updateSpuInfoVo.getVirtualFlg(),
updateSpuInfoVo.getLogisticsTemplate(), updateSpuInfoVo.getUpdatedBy(), updateSpuInfoVo.getUpdatedAt(), updateSpuInfoVo.getSpuErpCode(),
updateSpuInfoVo.getSpuId()
});
toMqSqls.add(SqlMapping.get("goblin_goods_sku.update_by_edit_coupon_spu"));
updateGoodsSkuObjs.add(new Object[]{
updateSkuInfoVo.getSkuNo(), updateSkuInfoVo.getVirtualFlg(), updateSkuInfoVo.getLogisticsTemplate(),
updateSkuInfoVo.getSkuPic(), updateSkuInfoVo.getUpdatedBy(), updateSkuInfoVo.getUpdatedAt(), updateSkuInfoVo.getSpuId()
});
toMqSqls.add(SqlMapping.get("candy_coupon.goods_spu_update"));
LinkedList<Object[]> updateCandyCouponObjs = CollectionUtil.linkedListObjectArr();
updateCandyCouponObjs.add(new Object[]{updateSpuInfoVo.getName(), updateSpuInfoVo.getIntro(), updateSpuInfoVo.getUpdatedBy(), updateSpuInfoVo.getUpdatedAt(), spuId});
toMqSqls.add(SqlMapping.get("goblin_goods_tag.delete"));
LinkedList<Object[]> deleteGoodsTagObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_tag.insert_byreplace"));
LinkedList<Object[]> initGoodsTagObjs = CollectionUtil.linkedListObjectArr();
if (updateTagFlg) {
if (!befTagIsEmptyFlg) {
deleteGoodsTagObjs.add(new Object[]{spuId, '0'});
}
if (!paramTagIsEmptyFlg) {
updateSpuInfoVo.getTagVoList().forEach(vo -> initGoodsTagObjs.add(new Object[]{spuId, vo.getTagId(), vo.getSort(), "0"}));
}
}
if (updateExtagFlg) {
if (!befExtagIsEmptyFlg) {
deleteGoodsTagObjs.add(new Object[]{spuId, '1'});
}
if (!paramExtagIsEmptyFlg) {
updateSpuInfoVo.getExtagVoList().forEach(vo -> initGoodsTagObjs.add(new Object[]{spuId, vo.getTagId(), vo.getSort(), "1"}));
}
}
toMqSqls.add(SqlMapping.get("goblin_goods_artag.delete"));
LinkedList<Object[]> deleteGoodsArTagObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_artag.insert_byreplace"));
LinkedList<Object[]> initGoodsArTagObjs = CollectionUtil.linkedListObjectArr();
if (updateArtagFlg) {
if (!befArtagIsEmptyFlg) {
deleteGoodsArTagObjs.add(new Object[]{spuId, '1'});
}
if (!paramArtagIsEmptyFlg) {
updateSpuInfoVo.getArtagVoList().forEach(vo -> initGoodsArTagObjs.add(new Object[]{spuId, vo.getTagId(), vo.getSort(), "1"}));
}
}
toMqSqls.add(SqlMapping.get("goblin_goods_service_support.delete"));
LinkedList<Object[]> deleteServiceSupportObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_service_support.insert_byreplace"));
LinkedList<Object[]> initServiceSupportObjs = CollectionUtil.linkedListObjectArr();
if (updateSsidFlg) {
if (!befServiceSupportVoListIsEmptyFlg) {
deleteServiceSupportObjs.add(new Object[]{spuId});
}
if (!paramSsidListIsEmptyFlg) {
updateSpuInfoVo.getServiceSupportVoList().forEach(vo -> initServiceSupportObjs.add(new Object[]{spuId, vo.getSsid()}));
}
}
toMqSqls.add(SqlMapping.get("goblin_goods_image.delete"));
LinkedList<Object[]> deleteGoodsImageObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_image.insert_byreplace"));
LinkedList<Object[]> initGoodsImageObjs = CollectionUtil.linkedListObjectArr();
if (updateImageFlg) {
deleteGoodsImageObjs.add(new Object[]{spuId});
updateSpuInfoVo.getImageList().forEach(imageUrl -> initGoodsImageObjs.add(new Object[]{spuId, imageUrl}));
}
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, updateGoodsInfoObjs, updateGoodsSkuObjs, updateCandyCouponObjs,
deleteGoodsTagObjs, initGoodsTagObjs, deleteGoodsArTagObjs, initGoodsArTagObjs,
deleteServiceSupportObjs, initServiceSupportObjs, deleteGoodsImageObjs, initGoodsImageObjs));
return true;
}
return false;
}
@Override
public boolean goodsEditSku(String uid, GoblinStoreMgtGoodsEditSkuParam mgtGoodsEditSkuParam, GoblinGoodsSkuInfoVo mgtGoodsSkuInfoVo,
GoblinGoodsInfoVo goodsInfoVo, Map<String, String> delSpuSpecMap, Map<String, String> addSpuSpecMap) {
......@@ -760,14 +1201,6 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
updateSkuSpecValueObjs, initSpuSpecValueObjs, delSpuSpecValueObjs, updateGoodsObjs));
return true;
}
Integer operStock = mgtGoodsEditSkuParam.getOperStock();
if (null != operStock && operStock != 0) {
if (operStock > 0) {
goblinRedisUtils.decrSkuStock(null, skuId, Math.abs(operStock));
} else {
goblinRedisUtils.incrSkuStock(null, skuId, Math.abs(operStock));
}
}
return false;
}
......@@ -886,6 +1319,102 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
return false;
}
@Override
public boolean couponGoodsEditSku(String uid, GoblinStoreMgtGoodsCouponEditSkuParam mgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo) {
LocalDateTime nowTime = LocalDateTime.now();
GoblinGoodsSkuInfoVo updateSkuInfoVo = mgtGoodsEditSkuParam.initEditGoodsSkuInfoVo();
updateSkuInfoVo.setUpdatedBy(uid);
updateSkuInfoVo.setUpdatedAt(nowTime);
String skuId = updateSkuInfoVo.getSkuId();
if (goblinMongoUtils.updateGoodsSkuInfoVo(updateSkuInfoVo)) {
goblinRedisUtils.delGoodsSkuInfoVo(skuId);
log.info("商品管理:SKU编辑[UID={},PARAMS={}]", uid, JsonUtils.toJson(mgtGoodsEditSkuParam));
LinkedList<Object[]> updateGoodsSkuForMarketObjs = CollectionUtil.linkedListObjectArr();
// 参与活动的同一商品更新处理
List<String> marketSkuIdList = goblinRedisUtils.getSkuRe(updateSkuInfoVo.getSkuId());
if (!CollectionUtils.isEmpty(marketSkuIdList)) {
goblinMongoUtils.updateGoodsSkuInfoVoForMarket(marketSkuIdList, updateSkuInfoVo);
marketSkuIdList.forEach(marketSkuId -> {
goblinRedisUtils.delGoodsSkuInfoVo(marketSkuId);
updateGoodsSkuForMarketObjs.add(new Object[]{
updateSkuInfoVo.getStock(), updateSkuInfoVo.getIsTrueName(), updateSkuInfoVo.getUseScope(),
updateSkuInfoVo.getValFace(), updateSkuInfoVo.getEffectAt(), updateSkuInfoVo.getExpireAt(),
updateSkuInfoVo.getUpdatedBy(), updateSkuInfoVo.getUpdatedAt(), marketSkuId
});
});
}
BigDecimal priceGe = BigDecimal.ZERO, priceLe = BigDecimal.ZERO;
for (String skuIdStr : goodsInfoVo.getSkuIdList()) {
GoblinGoodsSkuInfoVo skuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(skuIdStr);
if (null != skuInfoVo && skuInfoVo.getDelFlg().equals("0")) {
priceGe = priceGe.compareTo(BigDecimal.ZERO) == 0 ? skuInfoVo.getPrice() : (priceGe.compareTo(skuInfoVo.getPrice()) > 0 ? skuInfoVo.getPrice() : priceGe);
priceLe = priceLe.compareTo(skuInfoVo.getPrice()) < 0 ? skuInfoVo.getPrice() : priceLe;
}
}
boolean updateGoodsInfoVoFlg = false;
LinkedList<Object[]> updateGoodsObjs = CollectionUtil.linkedListObjectArr();
if (priceGe.compareTo(goodsInfoVo.getPriceGe()) != 0 || priceLe.compareTo(goodsInfoVo.getPriceLe()) != 0) {
updateGoodsInfoVoFlg = true;
goodsInfoVo.setPriceGe(priceGe);
goodsInfoVo.setPriceLe(priceLe);
goodsInfoVo.setUpdatedBy(uid);
goodsInfoVo.setUpdatedAt(nowTime);
updateGoodsObjs.add(new Object[]{priceGe, priceLe, uid, nowTime, goodsInfoVo.getSpuId()});
}
if (updateGoodsInfoVoFlg) {
goblinMongoUtils.updateGoodsInfoVo(goodsInfoVo);
goblinRedisUtils.delGoodsInfoVo(goodsInfoVo.getSpuId());
}
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_goods_sku.update_by_edit_for_market2"));
// LinkedList<Object[]> updateGoodsSkuForMarketObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("goblin_goods_sku.update_by_edit_for_coupon"));
LinkedList<Object[]> updateGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
updateGoodsSkuObjs.add(new Object[]{
updateSkuInfoVo.getPrice(), updateSkuInfoVo.getPriceMember(), updateSkuInfoVo.getStock(), updateSkuInfoVo.getSkuStock(),
updateSkuInfoVo.getBuyLimit(), updateSkuInfoVo.getUpdatedBy(), updateSkuInfoVo.getUpdatedAt(), skuId
});
toMqSqls.add(SqlMapping.get("goblin_goods_sku_coupon.update"));
LinkedList<Object[]> updateGoodsSkuCouponObjs = CollectionUtil.linkedListObjectArr();
updateGoodsSkuCouponObjs.add(new Object[]{
updateSkuInfoVo.getUseScope(), updateSkuInfoVo.getValFace(), updateSkuInfoVo.getIsTrueName(),
updateSkuInfoVo.getEffectAt(), updateSkuInfoVo.getExpireAt(), skuId});
toMqSqls.add(SqlMapping.get("candy_coupon.goods_sku_update"));
LinkedList<Object[]> updateCandyCouponObjs = CollectionUtil.linkedListObjectArr();
updateCandyCouponObjs.add(new Object[]{
updateSkuInfoVo.getValFace(), updateSkuInfoVo.getIsTrueName(), updateSkuInfoVo.getEffectAt(),
updateSkuInfoVo.getExpireAt(), updateSkuInfoVo.getUpdatedBy(), updateSkuInfoVo.getUpdatedAt(), skuId
});
toMqSqls.add(SqlMapping.get("candy_coupon_rule.goods_sku_update"));
LinkedList<Object[]> updateCandyCouponRuleObjs = CollectionUtil.linkedListObjectArr();
String busiName = "%s系列";
switch (updateSkuInfoVo.getUseScope()) {// 适用范围[101-音乐节|102-小型演出(livehouse演出)|103-巡演]
case 101:// 音乐节
busiName = String.format(busiName, "音乐节");
break;
case 102:// 小型演出(LiveHouse演出)
busiName = String.format(busiName, "小型演出(LiveHouse演出)");
break;
case 103:// 巡演
busiName = String.format(busiName, "巡演");
break;
}
updateCandyCouponRuleObjs.add(new Object[]{updateSkuInfoVo.getUseScope(), busiName, skuId});
toMqSqls.add(SqlMapping.get("goblin_goods.update_by_edit_sku"));
// LinkedList<Object[]> updateGoodsObjs = CollectionUtil.linkedListObjectArr();
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(),
SqlMapping.gets(toMqSqls, updateGoodsSkuForMarketObjs, updateGoodsSkuObjs, updateGoodsSkuCouponObjs,
updateCandyCouponObjs, updateCandyCouponRuleObjs, updateGoodsObjs));
return true;
}
return false;
}
@Override
public void goodsEditSkuAdd(String uid, GoblinStoreMgtGoodsEditSkuParam mgtGoodsEditSkuParam, GoblinGoodsInfoVo goodsInfoVo) {
LocalDateTime now = LocalDateTime.now();
......
......@@ -203,6 +203,13 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService {
itemSkuVo.setStatus(orderSkuVo.getStatus());
itemSkuVo.setPrice(orderSkuVo.getSkuPrice());
itemSkuVo.setPriceVoucher(orderSkuVo.getPriceVoucher());
orderSkuVo.desensitize();// 商品订单页面展示-关联人信息脱敏
itemSkuVo.setSkuType(orderSkuVo.getSkuType());
itemSkuVo.setIsTrueName(orderSkuVo.getIsTrueName());
itemSkuVo.setIdType(orderSkuVo.getIdType());
itemSkuVo.setIdName(orderSkuVo.getIdName());
itemSkuVo.setIdNo(orderSkuVo.getIdNo());
orderListSkuVos.add(itemSkuVo);
}
vo.setStoreOrderListSkuVoList(orderListSkuVos);
......
......@@ -593,7 +593,8 @@ public class GoblinMongoUtils {
if (0 == filterParam.getSpuType()) {
criteria.orOperator(Criteria.where("spuType").exists(false), (Criteria.where("spuType").is(0)));
} else {
criteria.and("spuType").is(1);
// criteria.and("spuType").is(1);
criteria.and("spuType").is(filterParam.getSpuType());
}
}
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
......@@ -895,8 +896,12 @@ public class GoblinMongoUtils {
filterParam.setKeyword(null);
} else if (0 == filterParam.getSkuType()) {
criteria.orOperator(Criteria.where("skuType").exists(false), (Criteria.where("skuType").is(0)));
} else if (1 == filterParam.getSkuType()) {
criteria.and("skuType").is(1);
}
// else if (1 == filterParam.getSkuType()) {
// criteria.and("skuType").is(1);
// }
else {
criteria.and("skuType").is(filterParam.getSkuType());
}
}
if (StringUtils.isNotBlank(filterParam.getKeyword())) {
......
......@@ -2268,7 +2268,7 @@ public class GoblinRedisUtils {
}
/**
* private int skuType 商品类型[0-常规|1-数字藏品]
* private int skuType 商品类型[0-常规|1-数字藏品|2-券类商品]
* private String status 审核状态[0-初始编辑|1-审核中|2-审核不通过|3-审核通过];
* private String shelvesStatus 单品上架状态[0-待上架|1-下架|2-违规|3-上架];
* private String skuAppear 是否隐藏[0-默认展示|1-隐藏];
......
......@@ -97,6 +97,8 @@
149022=\u5F00\u542FERP\u6258\u7BA1\u540E\uFF0C\u8BE5\u5546\u54C1\u5C5E\u6027`ERP\u5546\u54C1\u7F16\u7801`\u5FC5\u586B
149023=\u5F00\u542FERP\u6258\u7BA1\u540E\uFF0C\u5BF9\u5E94\u89C4\u683C\u5C5E\u6027`ERP\u89C4\u683C\u7F16\u7801`\u5FC5\u586B
149024=\u5F00\u542FERP\u6258\u7BA1\u540E\uFF0C\u5BF9\u5E94\u89C4\u683C\u5C5E\u6027`ERP\u4ED3\u5E93\u7F16\u53F7`\u5FC5\u586B
149025=\u9002\u7528\u5F00\u59CB/\u7ED3\u675F\u65F6\u95F4\u4E3A\u7A7A\uFF0C\u8BF7\u6838\u5B9E
149026=\u9002\u7528\u5F00\u59CB/\u7ED3\u675F\u65F6\u95F4\u65E0\u6548\uFF0C\u8BF7\u6838\u5B9E
148001=\u6B63\u5728\u4E0B\u5355\u5E93\u5B58\u4E0D\u8DB3
......
......@@ -57,6 +57,7 @@ goblin_goods_sku.insert=INSERT INTO goblin_goods_sku (sku_id,spu_id,sku_no,sku_b
goblin_goods_sku.insert_for_digital=INSERT INTO goblin_goods_sku (sku_id,spu_id,sku_no,sku_type,name,subtitle,sku_pic,sku_watch,watch_type,sku_watch_pic,stock,sku_stock,hit_ratio,price,price_v,product_id,price_member,intro,details,buy_factor,buy_limit,store_id,shelves_handle,shelves_time,sale_start_time,virtual_flg,status,shelves_status,sku_appear,sku_canbuy,unbox,opening_time,shelves_at,created_by,created_at,sku_erp_code,erp_type,erp_hosting,erp_warehouse_no)VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
#goblin_goods_sku.update_by_edit_for_market=UPDATE goblin_goods_sku SET sku_bar_code=?,name=?,sku_pic=?,sell_price=?,weight=?,stock=?,warning_stock=?,sku_appear=?,sku_isbn=?,sku_validity=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit_for_market=UPDATE goblin_goods_sku SET sku_bar_code=?,name=?,sku_pic=?,sell_price=?,weight=?,stock=?,warning_stock=?,sku_appear=?,sku_isbn=?,sku_validity=?,updated_by=?,updated_at=?,sku_erp_code=?,erp_hosting=?,erp_warehouse_no=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit_for_market2=UPDATE goblin_goods_sku SET stock=?,is_true_name=?,use_scope=?,val_face=?,effect_at=?,expire_at=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
#goblin_goods_sku.update_by_edit=UPDATE goblin_goods_sku SET name=?,sku_pic=?,sell_price=?,price=?,price_member=?,weight=?,stock=?,sku_stock=?,warning_stock=?,sku_appear=?,sku_isbn=?,buy_factor=?,buy_roster=?,buy_limit=?,sku_validity=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit=UPDATE goblin_goods_sku SET name=?,sku_pic=?,sell_price=?,price=?,price_member=?,weight=?,stock=?,sku_stock=?,warning_stock=?,sku_appear=?,sku_isbn=?,buy_factor=?,buy_roster=?,buy_limit=?,sku_validity=?,updated_by=?,updated_at=?,sku_erp_code=?,erp_hosting=?,erp_warehouse_no=? WHERE sku_id=? AND del_flg='0'
#goblin_goods_sku.update_by_edit_for_digital=UPDATE goblin_goods_sku SET hit_ratio=?,buy_factor=?,buy_limit=?,sku_appear=?,sku_canbuy=?,shelves_handle=?,shelves_time=?,sale_start_time=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
......@@ -64,8 +65,10 @@ goblin_goods_sku.update_by_edit_for_digital=UPDATE goblin_goods_sku SET hit_rati
#goblin_goods_sku.update_by_edit_box_digital=UPDATE goblin_goods_sku SET name=?,subtitle=?,sku_pic=?,sku_watch=?,watch_type=?,sku_watch_pic=?,price=?,price_member=?,intro=?,details=?,shelves_handle=?,shelves_time=?,sale_start_time=?,opening_time=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit_box_digital=UPDATE goblin_goods_sku SET name=?,subtitle=?,sku_pic=?,sku_watch=?,watch_type=?,sku_watch_pic=?,price=?,price_member=?,intro=?,details=?,shelves_handle=?,shelves_time=?,sale_start_time=?,opening_time=?,updated_by=?,updated_at=?,sku_erp_code=?,erp_hosting=?,erp_warehouse_no=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit_spu=UPDATE goblin_goods_sku SET sku_no=?,virtual_flg=?,logistics_template=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit_coupon_spu=UPDATE goblin_goods_sku SET sku_no=?,virtual_flg=?,logistics_template=?,sku_pic=?,updated_by=?,updated_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods_sku.update_by_shelves=UPDATE goblin_goods_sku SET shelves_status=?,shelves_at=?,updated_by=?,updated_at=? WHERE sku_id=? AND store_id=? AND del_flg='0'
goblin_goods_sku.update_by_soldout=UPDATE goblin_goods_sku SET soldout_status=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_edit_for_coupon=UPDATE goblin_goods_sku SET price=?,price_member=?,stock=?,sku_stock=?,buy_limit=?,updated_by=?,updated_at=? WHERE sku_id=? AND del_flg='0'
goblin_goods_sku.update_by_del_store=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE store_id=? AND del_flg='0'
goblin_goods_sku.update_by_del_spu=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE spu_id=? AND del_flg='0'
goblin_goods_sku.update_by_del=UPDATE goblin_goods_sku SET del_flg='1',updated_by=?,updated_at=?,deleted_by=?,deleted_at=? WHERE sku_id=? AND del_flg='0'
......@@ -75,6 +78,13 @@ goblin_goods_sku_extra.del_ar=UPDATE goblin_goods_sku_extra SET del_flg='1',upda
#goblin_goods_sku_nft.insert_for_digital=INSERT INTO goblin_goods_sku_nft (sku_id,route_type,material_type,material_url,upchain,display_url,nft_url,series_id,series_hash,nft_hash,declare_at,created_at)VALUES(?,?,?,?,?,?,?,?,?,?,?,?)
goblin_goods_sku_nft.insert_for_digital=INSERT INTO goblin_goods_sku_nft (sku_id,route_type,material_type,material_url,upchain,display_url,nft_url,created_at)VALUES(?,?,?,?,?,?,?,?)
#goblin_goods_sku_nft.update_for_digital=UPDATE goblin_goods_sku_nft SET upchain=?,series_id=?,series_hash=?,nft_hash=?,declare_at=?,updated_at=? WHERE skuId=? AND upchain=9
goblin_goods_sku_coupon.insert=INSERT INTO goblin_goods_sku_coupon (sku_id,busi_type,cou_type,use_scope,val_face,is_true_name,validity,effect_at,expire_at)VALUES(?,?,?,?,?,?,?,?,?)
goblin_goods_sku_coupon.update=UPDATE goblin_goods_sku_coupon SET use_scope=?,val_face=?,is_true_name=?,effect_at=?,expire_at=? WHERE sku_id=?
candy_coupon.goods_insert=INSERT INTO candy_coupon (coupon_id,state,title,notice,`exclusive`,busi_type,cou_type,bind_type,val_face,validity,is_true_name,effect_at,expire_at,operator,created_at) VALUES (?,1,?,?,0,?,?,1,?,?,?,?,?,?,?)
candy_coupon.goods_spu_update=UPDATE candy_coupon SET title=?,notice=?,operator=?,updated_at=? WHERE coupon_id=?
candy_coupon.goods_sku_update=UPDATE candy_coupon SET val_face=?,is_true_name=?,effect_at=?,expire_at=?,operator=?,updated_at=? WHERE coupon_id=?
candy_coupon_rule.goods_insert=INSERT INTO candy_coupon_rule (crule_id,coupon_id,use_scope,busi_name,busi_id,state) VALUES (?,?,?,?,?,1)
candy_coupon_rule.goods_sku_update=UPDATE candy_coupon_rule SET use_scope=?,busi_name=? WHERE coupon_id=?
goblin_goods_image.insert_byreplace=REPLACE INTO goblin_goods_image (spu_id,url,del_flg)VALUES(?,?,'0')
goblin_goods_image.delete=UPDATE goblin_goods_image SET del_flg='1' WHERE spu_id=? AND del_flg='0'
goblin_goods_tag.insert_byreplace=REPLACE INTO goblin_goods_tag (spu_id,tag_id,sort,tag_belong,del_flg)VALUES(?,?,?,?,'0')
......@@ -180,5 +190,6 @@ goblin_nft_order.update_artwork=UPDATE goblin_nft_order SET artwork_id=? WHERE o
#----
goblin_sku.stock=UPDATE goblin_goods_sku SET sku_stock = ? , stock = ?, updated_at = ? WHERE sku_erp_code = ? and erp_warehouse_no = ?
#----
candy_user_coupon.update_apply_refund=UPDATE candy_user_coupon SET state=?,operator=?,updated_at=? WHERE ucoupon_id=?
#----
#----
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.liquidnet.service.kylin.controller;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.kylin.dto.vo.admin.OrderRefundPoundage;
import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderTicketPreVo;
import com.liquidnet.service.kylin.dto.vo.returns.OrderRefundVo;
import com.liquidnet.service.kylin.service.impl.KylinOrderTicketsRefundServiceImpl;
......@@ -38,13 +39,31 @@ public class KylinOrderTicketsRefundController {
return kylinOrderTicketsRefundService.toOrderRefundDetails(orderId);
}
@GetMapping("getChargesRatioItem")
@ApiOperation("阶梯退款详情")
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<OrderRefundPoundage> getChargesRatioItem(
@RequestParam(value = "performanceId", required = true) @NotNull(message = "演出id") String performanceId
) {
return kylinOrderTicketsRefundService.getChargesRatioItem(performanceId);
}
@GetMapping("getChargesRatioItem2")
@ApiOperation("阶梯退款注意事项")
@ApiResponse(code = 200, message = "接口返回对象参数")
public ResponseDto<String> getChargesRatioItem2(
@RequestParam(value = "performanceId", required = true) @NotNull(message = "演出id") String performanceId
) {
return kylinOrderTicketsRefundService.getChargesRatioItem2(performanceId);
}
@PostMapping("sendOrderRefunds")
@ApiOperation("发起退款申请")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", dataType = "String", name = "orderId", value = "订单ID", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "orderTicketEntitiesId", value = "订单入场人ID", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "reason", value = "退款申请备注", required = true),
@ApiImplicitParam(type = "form", dataType = "String", name = "reason", value = "退款申请备注", required = false),
@ApiImplicitParam(type = "form", dataType = "String", name = "picList", value = "图片"),
@ApiImplicitParam(type = "form", dataType = "String", name = "ticketNum", value = "纸质票号"),
@ApiImplicitParam(type = "form", dataType = "Integer", name = "sendExpressType", value = "快递方式 1上门取件 2自主发货"),
......@@ -57,7 +76,7 @@ public class KylinOrderTicketsRefundController {
public ResponseDto sendOrderRefund(
@RequestParam(value = "orderId", required = true) @NotNull(message = "订单ID不能为空") String orderId,
@RequestParam(value = "orderTicketEntitiesId", required = true) @NotNull(message = "票单ID不能为空") String orderTicketEntitiesId,
@RequestParam(value = "reason", required = true) @NotNull(message = "退款原因不能为空") String reason,
@RequestParam(value = "reason", required = false) @NotNull(message = "退款原因不能为空") String reason,
@RequestParam(value = "picList", required = false) String picList,
@RequestParam(value = "ticketNum", required = false) String ticketNum,
......
......@@ -6,6 +6,7 @@ import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.constant.KylinTableStatusConst;
import com.liquidnet.service.kylin.dto.vo.admin.OrderRefundAddress;
import com.liquidnet.service.kylin.dto.vo.admin.OrderRefundPoundage;
......@@ -81,7 +82,7 @@ public class KylinOrderTicketsRefundServiceImpl {
KylinPerformanceVo performanceVo = dataUtils.getPerformanceVo(orderTicketVo.getPerformanceId());
List<KylinOrderRefundsVo> kylinOrderRefundsVoBaseList = dataUtils.getOrderRefundVoByOrderId(orderTicketVo.getOrderTicketsId());
// 判断是否购买人
if(!SuperAccountUtils.isSuperAccount(uid,orderTicketVo.getUserId())){
if (!SuperAccountUtils.isSuperAccount(uid, orderTicketVo.getUserId())) {
return ResponseDto.failure(ErrorMapping.get("20003"));
}
// if (uid.equals("809406") || uid.equals("773650")) {
......@@ -103,9 +104,9 @@ public class KylinOrderTicketsRefundServiceImpl {
}
item.setPriceActual(orderTicketVo.getPriceActual().subtract(orderTicketVo.getPriceExpress()).divide(BigDecimal.valueOf(orderTicketVo.getNumber()), 2, BigDecimal.ROUND_HALF_UP));
item.setPriceCanRefund(dataUtils.getCanRefundOrderEntitiesPrice(orderTicketVo, kylinOrderRefundsVoBaseList, item.getOrderTicketEntitiesId()));
// 手续费处理
BigDecimal chargesRatio = getChargesRatio(orderTicketVo.getUseStart(), performanceVo.getIsRefundPoundage());
BigDecimal chargesPrice = item.getPriceCanRefund().multiply(chargesRatio).setScale(2, BigDecimal.ROUND_HALF_UP);
// 手续费处理 TODO 手续费计算改成 按照实付金额计算
BigDecimal chargesRatio = getChargesRatio(orderTicketVo.getUseStart(), performanceVo.getIsRefundPoundage(dataUtils.getRefundPoundage(1, performanceVo.getPerformancesId()).size()), performanceVo.getPerformancesId());
BigDecimal chargesPrice = item.getPriceActual().multiply(chargesRatio).setScale(2, BigDecimal.ROUND_HALF_UP);
item.setPriceCanRefund(item.getPriceCanRefund().subtract(chargesPrice));
item.setChargesRatio(chargesRatio);
item.setChargesPrice(chargesPrice);
......@@ -120,7 +121,7 @@ public class KylinOrderTicketsRefundServiceImpl {
orderTicketVo.setOrderCode(orderTicketVo.getOrderCode().substring(orderTicketVo.getOrderCode().length() - 10));
}
// 手续费相关
OrderRefundPoundageAll refundPoundageAll = dataUtils.getRefundPoundageAll(performanceVo.getIsRefundPoundage());
OrderRefundPoundageAll refundPoundageAll = dataUtils.getRefundPoundageAll(performanceVo.getIsRefundPoundage(dataUtils.getRefundPoundage(1, performanceVo.getPerformancesId()).size()), performanceVo.getPerformancesId());
// 券
ArrayList<KylinOrderCoupons> orderCoupon = dataUtils.getOrderCoupon(orderId);
// 快递地址
......@@ -138,7 +139,7 @@ public class KylinOrderTicketsRefundServiceImpl {
for (KylinOrderRefundsVo refundVo : kylinOrderRefundsVoBaseList) {
int status = refundVo.getStatus();
if (status != KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL && status != KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT) { //退款流程未完成和已完成的
refundNum ++;
refundNum++;
priceExpressOld = priceExpressOld.add(refundVo.getPriceExpress());
}
}
......@@ -148,7 +149,7 @@ public class KylinOrderTicketsRefundServiceImpl {
}
// 整理返回数据
BeanUtils.copyProperties(orderTicketVo, vo);
vo.setIsRefundPoundage(performanceVo.getIsRefundPoundage());
vo.setIsRefundPoundage(performanceVo.getIsRefundPoundage(dataUtils.getRefundPoundage(1, performanceVo.getPerformancesId()).size()));
vo.setIsRefundVoucher(performanceVo.getIsRefundVoucher());
vo.setIsBackPaperTicket(performanceVo.getIsBackPaperTicket());
vo.setIsRefundExpressNew(performanceVo.getIsRefundExpressNew());
......@@ -177,7 +178,7 @@ public class KylinOrderTicketsRefundServiceImpl {
String uid = CurrentUtil.getCurrentUid();
KylinOrderTicketVo orderTicketVo = dataUtils.getOrderTicketVo(orderId);
List<KylinOrderRefundsVo> kylinOrderRefundsVoBaseList = dataUtils.getOrderRefundVoByOrderId(orderTicketVo.getOrderTicketsId());
if(!SuperAccountUtils.isSuperAccount(uid,orderTicketVo.getUserId())){
if (!SuperAccountUtils.isSuperAccount(uid, orderTicketVo.getUserId())) {
return ResponseDto.failure(ErrorMapping.get("20003"));
}
// if (uid.equals("809406") || uid.equals("773650")) {
......@@ -233,9 +234,10 @@ public class KylinOrderTicketsRefundServiceImpl {
return ResponseDto.failure("申请金额不得小于0");
}
// 手续费处理
BigDecimal chargesRatio = getChargesRatio(orderTicketVo.getUseStart(), performanceVo.getIsRefundPoundage());
BigDecimal priceCharges = refundSinglePrice.multiply(chargesRatio).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal singlePrice = orderTicketVo.getPriceActual().subtract(orderTicketVo.getPriceExpress()).divide(BigDecimal.valueOf(orderTicketVo.getNumber()), 2, BigDecimal.ROUND_HALF_UP);
// 手续费处理 TODO 修改了手续费根据票单算
BigDecimal chargesRatio = getChargesRatio(orderTicketVo.getUseStart(), performanceVo.getIsRefundPoundage(dataUtils.getRefundPoundage(1, performanceVo.getPerformancesId()).size()), performanceVo.getPerformancesId());
BigDecimal priceCharges = singlePrice.multiply(chargesRatio).setScale(2, BigDecimal.ROUND_HALF_UP);
refundSinglePrice = refundSinglePrice.subtract(priceCharges);
if (refundSinglePrice.compareTo(BigDecimal.ZERO) <= 0) {
return ResponseDto.failure("申请金额不得小于0哦~");
......@@ -250,7 +252,7 @@ public class KylinOrderTicketsRefundServiceImpl {
for (KylinOrderRefundsVo refundVo : kylinOrderRefundsVoBaseList) {
int status = refundVo.getStatus();
if (status != KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL && status != KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT) { //退款流程未完成和已完成的
refundNum ++;
refundNum++;
priceExpressOld = priceExpressOld.add(refundVo.getPriceExpress());
}
}
......@@ -290,7 +292,7 @@ public class KylinOrderTicketsRefundServiceImpl {
KylinOrderTicketVo orderTicketVo = dataUtils.getOrderTicketVo(orderId);
KylinPerformanceVo performanceVo = dataUtils.getPerformanceVo(orderTicketVo.getPerformanceId());
if(!SuperAccountUtils.isSuperAccount(uid,orderTicketVo.getUserId())){
if (!SuperAccountUtils.isSuperAccount(uid, orderTicketVo.getUserId())) {
return ResponseDto.failure(ErrorMapping.get("20003"));
}
// if (uid.equals("809406") || uid.equals("773650")) {
......@@ -318,52 +320,96 @@ public class KylinOrderTicketsRefundServiceImpl {
}
// 返回手续费比例
private BigDecimal getChargesRatio(String useStart, Integer isRefundPoundage) {
ArrayList<OrderRefundPoundage> refundPoundage = dataUtils.getRefundPoundage(isRefundPoundage);
private BigDecimal getChargesRatio(String useStart, Integer isRefundPoundage, String performanceId) {
ArrayList<OrderRefundPoundage> refundPoundage = dataUtils.getRefundPoundage(isRefundPoundage, performanceId);
// 手续费比例
BigDecimal chargesRatio = BigDecimal.valueOf(0);
if (!CollectionUtils.isEmpty(refundPoundage)) {
chargesRatio = BigDecimal.valueOf(1);
// 票种演出开始时间
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime useStartD = LocalDateTime.parse(useStart, df);
// 3、15天之前的时间 时间可变
int oneDay = refundPoundage.get(0).getDay();
int twoDay = refundPoundage.get(1).getDay();
LocalDateTime useStartD15Before = useStartD.minusDays(oneDay);
LocalDateTime useStartD3Before = useStartD.minusDays(twoDay);
// 当前时间
LocalDateTime nowTime = LocalDateTime.now();
if (useStartD15Before.isAfter(nowTime)) { // 15天以前的时间大于当前时间 距离演出开始日期>15天
int isCanRefund = refundPoundage.get(0).getIsCanRefund();
if (isCanRefund > 0) {
chargesRatio = refundPoundage.get(0).getPresent();
} else {
chargesRatio = BigDecimal.valueOf(Long.parseLong("-1"));
}
} else if (useStartD3Before.isAfter(nowTime)) { // 3天以前的时间大于当前时间 距离演出开始日期>3天-15天 含15天
int isCanRefund = refundPoundage.get(1).getIsCanRefund();
if (isCanRefund > 0) {
chargesRatio = refundPoundage.get(1).getPresent();
} else {
chargesRatio = BigDecimal.valueOf(Long.parseLong("-1"));
}
} else { // 三天以内 <=3
int isCanRefund = refundPoundage.get(2).getIsCanRefund();
if (isCanRefund > 0) {
chargesRatio = refundPoundage.get(2).getPresent();
} else {
chargesRatio = BigDecimal.valueOf(Long.parseLong("1"));
// return ResponseDto.failure("当前日期不支持退票");
//todo 阶梯退票 下面注释为原逻辑 这是判断是否支持退手续费和退多少
for (OrderRefundPoundage item : refundPoundage) {
LocalDateTime t = LocalDateTime.parse(item.getDay(), df);//当前阶段时间
if(nowTime.isBefore(t)){
int isCanRefund = item.getIsCanRefund();
if (isCanRefund > 0) {
chargesRatio = item.getPresent();
} else {
chargesRatio = BigDecimal.valueOf(Long.parseLong("1"));
}
break;
}
}
// LocalDateTime useStartD = LocalDateTime.parse(useStart, df);
// 3、15天之前的时间 时间可变
// int oneDay = refundPoundage.get(0).getDay();
// int twoDay = refundPoundage.get(1).getDay();
// LocalDateTime useStartD15Before = useStartD.minusDays(oneDay);
// LocalDateTime useStartD3Before = useStartD.minusDays(twoDay);
//
// if (useStartD15Before.isAfter(nowTime)) { // 15天以前的时间大于当前时间 距离演出开始日期>15天
// int isCanRefund = refundPoundage.get(0).getIsCanRefund();
// if (isCanRefund > 0) {
// chargesRatio = refundPoundage.get(0).getPresent();
// } else {
// chargesRatio = BigDecimal.valueOf(Long.parseLong("-1"));
// }
// } else if (useStartD3Before.isAfter(nowTime)) { // 3天以前的时间大于当前时间 距离演出开始日期>3天-15天 含15天
// int isCanRefund = refundPoundage.get(1).getIsCanRefund();
// if (isCanRefund > 0) {
// chargesRatio = refundPoundage.get(1).getPresent();
// } else {
// chargesRatio = BigDecimal.valueOf(Long.parseLong("-1"));
// }
// } else { // 三天以内 <=3
// int isCanRefund = refundPoundage.get(2).getIsCanRefund();
// if (isCanRefund > 0) {
// chargesRatio = refundPoundage.get(2).getPresent();
// } else {
// chargesRatio = BigDecimal.valueOf(Long.parseLong("1"));
// // return ResponseDto.failure("当前日期不支持退票");
// }
// }
return chargesRatio;
} else { // 无手续费
return chargesRatio;
}
}
// @Async
// 返回手续费比例
public ResponseDto<OrderRefundPoundage> getChargesRatioItem(String performanceId) {
KylinPerformanceVo performanceVo = dataUtils.getPerformanceVo(performanceId);
int isRefundPoundage = performanceVo.getIsRefundPoundage(dataUtils.getRefundPoundage(1, performanceVo.getPerformancesId()).size());
ArrayList<OrderRefundPoundage> refundPoundage = dataUtils.getRefundPoundage(isRefundPoundage, performanceId);
OrderRefundPoundage a = null;
if (!CollectionUtils.isEmpty(refundPoundage)) {
// 票种演出开始时间
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 当前时间
LocalDateTime nowTime = LocalDateTime.now();
//todo 阶梯退票 下面注释为原逻辑 这是判断是否支持退手续费和退多少
for (OrderRefundPoundage item : refundPoundage) {
LocalDateTime t = LocalDateTime.parse(item.getDay(), df);//当前阶段时间
if(nowTime.isBefore(t)){
a = item;
break;
}
}
return ResponseDto.success(a);
} else { // 无手续费
return ResponseDto.success(a);
}
}
// 返回手续费比例
public ResponseDto<String> getChargesRatioItem2(String performanceId) {
return ResponseDto.success(dataUtils.getExplain(performanceId));
}
// @Async
public void expressPlace(Integer sendExpressType, String expressNumber, String expressContacts, String expressPhone, String sendExpressAddress, String appointmentTime, KylinOrderTicketVo orderTicketVo, KylinPerformanceVo performanceVo, String orderRefundId) {
try {
// Thread.sleep(1000 * 60);
......
......@@ -103,8 +103,9 @@ public class KylinRefundsStatusServiceImpl {
kylinOrderRefunds.setOrderRefundsId(orderRefundsId);
kylinOrderRefunds.setOrderTicketsId(orderInfo.getOrderTicketsId());
String orderRefundCode = orderInfo.getOrderCode();
String codeNum = StringUtils.leftPad(String.valueOf(refundCount), 3, "0");
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(codeNum));
// String codeNum = StringUtils.leftPad(String.valueOf(refundCount), 3, "0");
// long currentTime = System.currentTimeMillis()% 100;
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(dataUtils.incrOrderRefundCode(orderInfo.getOrderCode())+""));
kylinOrderRefunds.setPrice(refundPrice);
kylinOrderRefunds.setPriceExpress(priceExpress);
kylinOrderRefunds.setPriceCharges(priceCharges);
......@@ -261,8 +262,9 @@ public class KylinRefundsStatusServiceImpl {
kylinOrderRefunds.setOrderRefundsId(orderRefundsId);
kylinOrderRefunds.setOrderTicketsId(orderInfo.getOrderTicketsId());
String orderRefundCode = orderInfo.getOrderCode();
String codeNum = StringUtils.leftPad(String.valueOf(refundCount), 3, "0");
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(codeNum));
// String codeNum = StringUtils.leftPad(String.valueOf(refundCount), 3, "0");
// long currentTime = System.currentTimeMillis()% 100;
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(dataUtils.incrOrderRefundCode(orderInfo.getOrderCode())+""));
kylinOrderRefunds.setPrice(BigDecimal.valueOf(refundPrice));
kylinOrderRefunds.setPriceExpress(orderInfo.getPriceExpress());
kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY);
......@@ -351,5 +353,4 @@ public class KylinRefundsStatusServiceImpl {
return "";
}
}
}
\ No newline at end of file
......@@ -655,7 +655,7 @@ public class DataUtils {
try {
DateTimeFormatter df = DateTimeFormatter.ofPattern(DateUtil.DATE_FULL_STR);
LocalDateTime nowTime = LocalDateTime.parse(nowTimeTStr, df);
LocalDateTime endTime = LocalDateTime.parse(toDayEndTimeStr,df);
LocalDateTime endTime = LocalDateTime.parse(toDayEndTimeStr, df);
LocalDateTime threeEndTime = DateUtil.asLocalDateTime(beforeDayEnd);
//查询预约(当天)
......@@ -978,8 +978,8 @@ public class DataUtils {
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKeyUid;
String redisKeyIdCard;
String performanceIdKeyIdCard="";
String ticketIdKeyIdCard="";
String performanceIdKeyIdCard = "";
String ticketIdKeyIdCard = "";
int isTrueName = getPerformanceIsTrueName(performanceId);
......@@ -1092,30 +1092,11 @@ public class DataUtils {
}
// 获取手续费
public ArrayList<OrderRefundPoundage> getRefundPoundage(Integer isRefundPoundage) {
public ArrayList<OrderRefundPoundage> getRefundPoundage(Integer isRefundPoundage, String performanceId) {
ArrayList<OrderRefundPoundage> orderRefundPoundageArrayList = ObjectUtil.getOrderRefundPoundageArrayList();
if (null != isRefundPoundage && isRefundPoundage > 0) { // 开启了演出退票有手续费
Object obj = redisUtil.get(KylinRedisConst.ORDER_REFUND_POUNDAGE);
Object obj = redisUtil.get(KylinRedisConst.ORDER_REFUND_POUNDAGE.concat(":").concat(performanceId));
if (obj == null) {
OrderRefundPoundage vo1 = OrderRefundPoundage.getNew();
vo1.setDay(15);
vo1.setContent("距离演出开始日期>15天");
vo1.setPresent(BigDecimal.valueOf(0.1));
vo1.setIsCanRefund(1);
OrderRefundPoundage vo2 = OrderRefundPoundage.getNew();
vo2.setDay(3);
vo2.setContent("距离演出开始日期>3天-15天(含15天)");
vo2.setPresent(BigDecimal.valueOf(0.5));
vo2.setIsCanRefund(1);
OrderRefundPoundage vo3 = OrderRefundPoundage.getNew();
vo3.setDay(0);
vo3.setContent("距离演出开始日期≤3天(含演出当天)");
vo3.setPresent(BigDecimal.valueOf(1));
vo3.setIsCanRefund(0);
orderRefundPoundageArrayList.add(vo1);
orderRefundPoundageArrayList.add(vo2);
orderRefundPoundageArrayList.add(vo3);
redisUtil.set(KylinRedisConst.ORDER_REFUND_POUNDAGE, orderRefundPoundageArrayList);
return orderRefundPoundageArrayList;
} else {
return (ArrayList<OrderRefundPoundage>) obj;
......@@ -1126,17 +1107,15 @@ public class DataUtils {
}
// 获取手续费ALL说明
public OrderRefundPoundageAll getRefundPoundageAll(Integer isRefundPoundage) {
ArrayList<OrderRefundPoundage> refundPoundage = getRefundPoundage(isRefundPoundage);
public OrderRefundPoundageAll getRefundPoundageAll(Integer isRefundPoundage, String performanceId) {
ArrayList<OrderRefundPoundage> refundPoundage = getRefundPoundage(isRefundPoundage, performanceId);
OrderRefundPoundageAll aNew = OrderRefundPoundageAll.getNew();
aNew.setOrderRefundPoundageList(refundPoundage);
Object obj = redisUtil.get(KylinRedisConst.ORDER_REFUND_POUNDAGE_EXPLAIN);
Object obj = redisUtil.get(KylinRedisConst.ORDER_REFUND_POUNDAGE_EXPLAIN.concat(":").concat(performanceId));
if (null == obj) {
String explain = "1.存在异常订购行为的订单,平台有权不予办理退票。\n2.不支持退票示例:如演出时间为5月1日,则不支持退票的时间范围为4月28日-30日及5月1日(演出当天)。";
redisUtil.set(KylinRedisConst.ORDER_REFUND_POUNDAGE_EXPLAIN, explain);
aNew.setExplain(explain);
aNew.setExplain("");
} else {
String explain = (String) obj;
aNew.setExplain(explain);
......@@ -1144,6 +1123,15 @@ public class DataUtils {
return aNew;
}
public String getExplain(String performanceId){
Object obj = redisUtil.get(KylinRedisConst.ORDER_REFUND_POUNDAGE_EXPLAIN.concat(":").concat(performanceId));
if (null == obj) {
return "";
} else {
return (String) obj;
}
}
// 获取订单券的使用情况
public ArrayList<KylinOrderCoupons> getOrderCoupon(String orderId) {
String redisKey = KylinRedisConst.ORDER_COUPON.concat(orderId);
......@@ -1315,11 +1303,13 @@ public class DataUtils {
String rdk = KylinRedisConst.REDIS_WQ_ORDER_FIX.concat(orderId);
redisUtil.del(rdk, orderId);
}
// 万青补偿vo覆盖
public void setWqOrderVo(WqTempVo vo) {
String rdk = KylinRedisConst.REDIS_WQ_ORDER_EXPRESS.concat(vo.getOrderId());
redisUtil.set(rdk, vo);
}
// 万青补偿vo获取
public WqTempVo getWqOrderVo(String orderId) {
String rdk = KylinRedisConst.REDIS_WQ_ORDER_EXPRESS.concat(orderId);
......@@ -1366,8 +1356,9 @@ public class DataUtils {
return (List<String>) obj;
}
}
//获得 admin配置的推荐活动
public List<KylinRecommendActive> getRecommendActive(String id) {
public List<KylinRecommendActive> getRecommendActive(String id) {
return (List<KylinRecommendActive>) redisUtil.get(KylinRedisConst.RECOMMEND_ACTIVE + id);
}
......@@ -1382,7 +1373,7 @@ public class DataUtils {
KylinOrderTicketVo data = dataSingle;
KylinOrderListVo voItem = KylinOrderListVo.getNew().copy(data);
List<KylinOrderListVo> redisData = (List<KylinOrderListVo>) redisUtil.get(KylinRedisConst.ORDER_LIST + userId);
if(redisData==null){
if (redisData == null) {
return false;
}
if (type == 1) {
......@@ -1432,32 +1423,36 @@ public class DataUtils {
}
//删除 订单Ar激活码
public void delOrderArCode(String orderId){
public void delOrderArCode(String orderId) {
String rdk = KylinRedisConst.ORDER_AR_CODE.concat(orderId);
redisUtil.del(rdk);
}
//添加 订单Ar激活码
public void addOrderArCode(String orderId,String arCode){
public void addOrderArCode(String orderId, String arCode) {
String rdk = KylinRedisConst.ORDER_AR_CODE.concat(orderId);
List<String> data = getOrderArCode(orderId);
data.add(arCode);
redisUtil.set(rdk,data);
redisUtil.set(rdk, data);
}
//获取 订单Ar激活码
public List<String> getOrderArCode(String orderId){
public List<String> getOrderArCode(String orderId) {
String rdk = KylinRedisConst.ORDER_AR_CODE.concat(orderId);
Object obj = redisUtil.get(rdk);
if(obj==null){
if (obj == null) {
return CollectionUtil.arrayListString();
}else{
} else {
return (List<String>) obj;
}
}
//添加激活码使用量
public void incrArCode() {
redisUtil.incr(KylinRedisConst.ACTIVE_USE_AR_COUNT,1);
redisUtil.incr(KylinRedisConst.ACTIVE_USE_AR_COUNT, 1);
}
public int incrOrderRefundCode(String orderCode) {
return (int) redisUtil.incr(KylinRedisConst.ORDER_REFUND_TEMP + orderCode,1);
}
}
......@@ -3,6 +3,8 @@ package com.liquidnet.service.order.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.commons.lang.constant.LnsRegex;
import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.adam.dto.vo.AdamUserInfoVo;
import com.liquidnet.service.adam.dto.vo.AdamUserMemberVo;
......@@ -11,11 +13,13 @@ import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.UserPathDto;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.candy.constant.CandyRedisConst;
import com.liquidnet.service.dragon.constant.DragonConstant;
import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
import com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto;
import com.liquidnet.service.dragon.service.IDragonOrdersService;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.manage.AddressVo;
import com.liquidnet.service.goblin.dto.manage.GoblinOrderParam;
......@@ -34,6 +38,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
......@@ -42,6 +47,7 @@ import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.regex.Pattern;
import static com.liquidnet.commons.lang.util.DateUtil.*;
......@@ -88,6 +94,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
preParam.setStoreName("");
preParam.setSkuName("");
preParam.setOrderIdList("");
HashMap<String, Integer> couponSkuIdNoBuyLimitMap = CollectionUtil.mapStringInteger();// 记录券类商品关联人限购KEY:NUM
boolean rollbackStock = false;
try {
List<GoblinOrderStoreParam> goblinOrderStoreParamList = param.getGoblinOrderStoreParamList();//分订单
boolean isMember;
......@@ -117,18 +125,72 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if (!skuParam.getSpuId().equals(skuVo.getSpuId())) {
throw new Exception("参数异常");
}
if (Objects.equals(skuVo.getSkuType(), 2)) {// 券类商品
if (Objects.equals(skuVo.getIsTrueName(), 1)) {// 需关联实名人
if (Objects.isNull(skuParam.getIdType()) || Objects.isNull(skuParam.getIdName()) || Objects.isNull(skuParam.getIdNo())) {
throw new LiquidnetServiceException("-1", "关联人信息缺失,请核实");
}
switch (skuParam.getIdType()) {// 证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照
case 1:
if (!Pattern.matches(LnsRegex.Valid.CN_HANZI, skuParam.getIdName())) {
throw new LiquidnetServiceException("-1", "身份证姓名不合规");
}
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_REF, skuParam.getIdNo())) {
throw new LiquidnetServiceException("-1", "身份证号码不合规");
}
adamRedisUtils.identityHandler1(uid, skuParam.getIdName(), skuParam.getIdNo());
break;
case 2:
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_HM, skuParam.getIdNo())) {
throw new LiquidnetServiceException("-1", "港澳居民来往内地通行证号码不合规");
}
break;
case 3:
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_TW, skuParam.getIdNo())) {
throw new LiquidnetServiceException("-1", "台湾居民来往大陆通行证号码不合规");
}
break;
case 4:
if (Pattern.matches(LnsRegex.Valid.CN_ID_CARD_PP, skuParam.getIdNo())) {
throw new LiquidnetServiceException("-1", "不支持中国大陆护照");
}
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_PP_NON, skuParam.getIdNo())) {
throw new LiquidnetServiceException("-1", "护照号码不合规");
}
break;
default:
throw new LiquidnetServiceException("-1", "无效证件类型,请重新选择");
}
}
}
int limitCount = skuVo.getBuyLimit() == 0 ? Integer.MAX_VALUE : skuVo.getBuyLimit();
//判断限购
if (orderUtils.noZhengzaiOrder(uid)) {
String res1 = orderUtils.judgeOrderLimit(uid, skuParam.getSkuId(), skuParam.getNumber(), limitCount);
rollbackStock = true;
if (!res1.equals("")) {
throw new Exception("已超出限购数量");
// throw new Exception("已超出限购数量");
throw new LiquidnetServiceException("-1", "超出账号限购数量");// 按杨要求调整
}
//权限限购
Boolean res2 = orderUtils.judgeOrderRose(isMember, skuParam.getSkuId(), StringUtils.defaultString(((String) CurrentUtil.getTokenClaims().get("mobile")), ""), Integer.parseInt(skuVo.getBuyFactor()));
if (!res2) {
throw new Exception("无权购买");
}
if (Objects.equals(skuVo.getSkuType(), 2)) {// 券类商品
if (skuParam.getNumber() > 1) {// 券类商品单次下单限购1
throw new LiquidnetServiceException("-1", String.format("代金券商品单次下单限购%d张", 1));
}
if (Objects.equals(skuVo.getIsTrueName(), 1)) {// 需关联实名人
int idNoLimitCount = 1;// 这里默认券类商品需要关联实名人且都要求关联实名人限购,限购数量为1
String couponSkuIdNoBuyLimitKey = String.format(GoblinRedisConst.REDIS_GOBLIN_BUY_COUNT_IDNO, skuParam.getIdType(), skuParam.getIdNo(), skuId, skuParam.getNumber());
couponSkuIdNoBuyLimitMap.put(couponSkuIdNoBuyLimitKey, skuParam.getNumber());
if (redisUtils.redisUtil.incr(couponSkuIdNoBuyLimitKey, skuParam.getNumber()) > idNoLimitCount) {
throw new LiquidnetServiceException("-1", String.format("超过限购数量,一个证件信息限购%d张", idNoLimitCount));
}
}
}
}
//库存回滚
if (surplusGeneral < 0) {
......@@ -150,6 +212,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
sqlParam.setStoreOrder(pre.getStoreOrder());
sqlParam.setOrderAttr(pre.getOrderAttr());
sqlParam.setOrderSkuList(pre.getOrderSkuList());
sqlParam.setOrderSkuParamMap(pre.getOrderSkuParamMap());
orderSqlParams.add(sqlParam);
}//GoblinOrderStoreParam
if (preParam.getOrderIdList().equals("")) {
......@@ -161,7 +224,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
log.info(UserPathDto.setData("下单(唤起支付)", param, data));
return data;
} catch (Exception e) {
log.error("Kylin Order Pay Error = {}", e);
log.error("Goblin Order Pay Error = {}", e);
Long time3 = System.currentTimeMillis();
//回顾限购 回滚库存
for (String item : skuAndPreListAndNumber) {
......@@ -171,7 +234,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
int number = Integer.parseInt(array[2]);
redisUtils.incrSkuStock(pre, skuId, number);
if (orderUtils.noZhengzaiOrder(uid)) {
redisUtils.decrSkuCountByUid(uid, skuId, number);
if (rollbackStock) {
redisUtils.decrSkuCountByUid(uid, skuId, number);
}
}
}
//回退平台券
......@@ -189,6 +254,15 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if (params.size() > 0) {
orderUtils.backStoreCoupon(params);
}
if (!CollectionUtils.isEmpty(couponSkuIdNoBuyLimitMap)) {
couponSkuIdNoBuyLimitMap.forEach((couponSkuIdNoBuyLimitKey, number) -> {
redisUtils.redisUtil.decr(couponSkuIdNoBuyLimitKey, number);
});
}
if (e instanceof LiquidnetServiceException) {
LiquidnetServiceException lsEx = (LiquidnetServiceException) e;
return ResponseDto.failure(lsEx.getCode(), lsEx.getMessage());
}
if (e.getMessage() == null) {
return ResponseDto.failure(ErrorMapping.get("20018"));//乱七八糟异常
} else if (e.getMessage().equals("平台券不可用")) {
......@@ -236,8 +310,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
List<GoblinOrderSku> goblinOrderSkuList = ObjectUtil.getGoblinOrderSkuArrayList();
List<String> storeSpuIds = CollectionUtil.linkedListString();
List<String> platformSpuIds = CollectionUtil.linkedListString();
String marketId = "";
String marketType = "";
String marketId = "", marketType = "", goodsSkuCouponSnapshot = "";
Map<String, GoblinOrderSkuParam> orderSkuParamMap = ObjectUtil.cloneGoblinOrderSkuParamMap();
for (GoblinOrderSkuParam skuParam : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(skuParam.getSkuId());
GoblinGoodsSkuInfoVo skuVo = redisUtils.getGoodsSkuInfoVo(skuParam.getSkuId());
......@@ -248,6 +322,48 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if (!(skuVo.getStatus().equals("3") && skuVo.getShelvesStatus().equals("3")) || skuVo.getDelFlg().equals("1")) {
throw new Exception("不可购买");
}
if (Objects.equals(skuVo.getSkuType(), 2)) {// 券类商品
if (Objects.equals(skuVo.getIsTrueName(), 1)) {// 需关联实名人
// if (Objects.isNull(skuParam.getIdType()) || Objects.isNull(skuParam.getIdName()) || Objects.isNull(skuParam.getIdNo())) {
// throw new LiquidnetServiceException("-1", "关联人信息缺失,请核实");
// }
// switch (skuParam.getIdType()) {// 证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照
// case 1:
// if (!Pattern.matches(LnsRegex.Valid.CN_HANZI, skuParam.getIdName())) {
// throw new LiquidnetServiceException("-1", "身份证姓名不合规");
// }
// if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_REF, skuParam.getIdNo())) {
// throw new LiquidnetServiceException("-1", "身份证号码不合规");
// }
// adamRedisUtils.identityHandler1(uid, skuParam.getIdName(), skuParam.getIdNo());
// break;
// case 2:
// if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_HM, skuParam.getIdNo())) {
// throw new LiquidnetServiceException("-1", "港澳居民来往内地通行证号码不合规");
// }
// break;
// case 3:
// if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_TW, skuParam.getIdNo())) {
// throw new LiquidnetServiceException("-1", "台湾居民来往大陆通行证号码不合规");
// }
// break;
// case 4:
// if (Pattern.matches(LnsRegex.Valid.CN_ID_CARD_PP, skuParam.getIdNo())) {
// throw new LiquidnetServiceException("-1", "不支持中国大陆护照");
// }
// if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_PP_NON, skuParam.getIdNo())) {
// throw new LiquidnetServiceException("-1", "护照号码不合规");
// }
// break;
// default:
// throw new LiquidnetServiceException("-1", "无效证件类型,请重新选择");
// }
orderSkuParamMap.put(skuParam.getSkuId(), skuParam);
}
writeOffCode = "EMPTY";
goodsSkuCouponSnapshot = goodsSkuCouponSnapshot.concat(skuVo.getCouponSnapshot());
}
marketId = spuVo.getMarketId();
marketType = pre;
skuName = skuName.concat(skuVo.getName()).concat(",");
......@@ -376,6 +492,10 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
storeOrder.setUserMobile(userInfoVo.getMobile());
}
if (StringUtils.isNotEmpty(goodsSkuCouponSnapshot)) {
log.info("券类商品下单[uid={},mobile={},orderId={},masterOrderCode={},orderCode={},goodsSkuCouponSnapshot({})]",
uid, storeOrder.getUserMobile(), orderId, orderMasterCode, orderCode, goodsSkuCouponSnapshot);
}
if (addressesVo == null) {
storeOrder.setPriceExpress(BigDecimal.ZERO);
......@@ -435,6 +555,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
preParam.setOrderSkuList(goblinOrderSkuList);
preParam.setStoreSpuIds(storeSpuIds);
preParam.setPlatformSpuIds(platformSpuIds);
preParam.setOrderSkuParamMap(orderSkuParamMap);
return preParam;
}
......@@ -541,14 +662,17 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
sqls.add(SqlMapping.get("goblin.order.create.sku_insert"));
sqls.add(SqlMapping.get("goblin.order.create.order_insert"));
sqls.add(SqlMapping.get("goblin.order.create.attr_insert"));
sqls.add(SqlMapping.get("goblin_order_sku_assoc.insert"));
LinkedList<Object[]> sqlDataSku = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> sqlDataOrder = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> sqlDataAttr = CollectionUtil.linkedListObjectArr();
LinkedList<Object[]> initGoblinOrderSkuAssocObjs = CollectionUtil.linkedListObjectArr();
List<GoblinStoreOrderVo> orderVoList = ObjectUtil.getGoblinStoreOrderVoArrayList();
List<GoblinOrderSkuVo> skuVoList = ObjectUtil.getGoblinOrderSkuVoArrayList();
for (GoblinOrderSqlParam item : sqlParams) {
List<String> goblinOrderSkuIdList = CollectionUtil.linkedListString();
BigDecimal restVoucherPrice = item.getStoreOrder().getPriceVoucher();
Map<String, GoblinOrderSkuParam> orderSkuParamMap = item.getOrderSkuParamMap();
int erpHosting = 0;
for (int i = 0; i < item.getOrderSkuList().size(); i++) {
GoblinOrderSku orderSku = item.getOrderSkuList().get(i);
......@@ -617,6 +741,18 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
});
//订单 orderSku Vo
GoblinOrderSkuVo orderSkuVo = GoblinOrderSkuVo.getNew().copy(orderSku);
// 关联人信息处理
GoblinOrderSkuParam orderSkuParam = orderSkuParamMap.get(orderSku.getSkuId());
if (!Objects.isNull(orderSkuParam)) {
orderSkuVo.setSkuType(2);
orderSkuVo.setIsTrueName(1);
orderSkuVo.setIdType(orderSkuParam.getIdType());
orderSkuVo.setIdName(orderSkuParam.getIdName());
orderSkuVo.setIdNo(orderSkuParam.getIdNo());
initGoblinOrderSkuAssocObjs.add(new Object[]{orderSkuVo.getOrderSkuId(), orderSkuVo.getIsTrueName(),
orderSkuVo.getIdType(), orderSkuVo.getIdName(), orderSkuVo.getIdNo(), uid, orderSkuVo.getCreatedAt()});
}
redisUtils.setGoblinOrderSku(orderSkuVo.getOrderSkuId(), orderSkuVo);
goblinOrderSkuIdList.add(orderSkuVo.getOrderSkuId());
skuVoList.add(orderSkuVo);
......@@ -660,7 +796,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
mongoUtils.insertGoblinStoreOrderVos(orderVoList);
//mysql 执行sql
String sqlData = SqlMapping.gets(sqls, sqlDataSku, sqlDataOrder, sqlDataAttr);
String sqlData = SqlMapping.gets(sqls, sqlDataSku, sqlDataOrder, sqlDataAttr, initGoblinOrderSkuAssocObjs);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_ORDER_CREATE_PAY.getKey(), sqlData);
if (isFree && preParam.getPayType().equals("huifu")) {
......@@ -852,18 +988,29 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
storeOrder.setUpdatedAt(now);
sqls.add(SqlMapping.get("goblin_order.pay.order"));
sqlDataOrder.add(new Object[]{
storeOrder.getPaymentType(), storeOrder.getPaymentId(), storeOrder.getPayCode(), storeOrder.getPayTime(), storeOrder.getWriteOffCode(), storeOrder.getZhengzaiStatus(), storeOrder.getStatus(), storeOrder.getUpdatedAt(), storeOrder.getPushTime(),
orderId, now, now
});
// sqlDataOrder.add(new Object[]{
// storeOrder.getPaymentType(), storeOrder.getPaymentId(), storeOrder.getPayCode(), storeOrder.getPayTime(), storeOrder.getWriteOffCode(), storeOrder.getZhengzaiStatus(), storeOrder.getStatus(), storeOrder.getUpdatedAt(), storeOrder.getPushTime(),
// orderId, now, now
// });
sqls.add(SqlMapping.get("goblin_order.pay.sku"));
sqls.add(SqlMapping.get("candy_mgt_coupon.pay.sku"));// 券类商品发放券
LinkedList<Object[]> initCandyMgtCouponObjs = CollectionUtil.linkedListObjectArr();// 券类商品发放券
List<String> skuList = orderVo.getOrderSkuVoIds();
for (String orderSkuVoIds : skuList) {
GoblinOrderSkuVo orderSkuVo = redisUtils.getGoblinOrderSkuVo(orderSkuVoIds);
//增加销量
log.debug("增加销量 spuId=" + orderSkuVo.getSpuId() + ",skuId=" + orderSkuVo.getSkuId());
redisUtils.incrSkuSaleCount(orderSkuVo.getSpuId(), orderSkuVo.getSkuId(), orderSkuVo.getNum());
orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_2.getValue());
// orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_2.getValue());
if (Objects.equals(orderSkuVo.getSkuType(), 2)) {// 判定券类商品时,直接设置状态为已完成
storeOrder.setStatus(GoblinStatusConst.Status.ORDER_STATUS_4.getValue());
orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_4.getValue());
// 券类商品创建发放券任务,券类商品默认一个商品对应一个券,下单只可购买一张
initCandyMgtCouponObjs.add(new Object[]{orderSkuVo.getOrderSkuId(), orderSkuVo.getSkuId(),
orderVo.getUserMobile(), now, CandyRedisConst.OPERATOR_MGT_COUPON_BY_SKU, now});
} else {
orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_2.getValue());
}
if (orderVo.getDeviceFrom().equals("micropay") && GoblinStatusConst.MarketPreStatus.MARKET_PRE_ZHENGZAI.getValue().equals(orderVo.getMarketType())) {
orderSkuVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_4.getValue());
orderSkuVo.setPushTime(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
......@@ -899,6 +1046,10 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderSkuVo.getOrderSkuId(), now, now
});
}
sqlDataOrder.add(new Object[]{
storeOrder.getPaymentType(), storeOrder.getPaymentId(), storeOrder.getPayCode(), storeOrder.getPayTime(), storeOrder.getWriteOffCode(), storeOrder.getZhengzaiStatus(), storeOrder.getStatus(), storeOrder.getUpdatedAt(), storeOrder.getPushTime(),
orderId, now, now
});
//redis
orderVo.setPayCode(storeOrder.getPayCode());
orderVo.setPayTime(syncOrderParam.getPaymentAt());
......@@ -913,7 +1064,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
mongoUtils.updateGoblinStoreOrderVo(orderId, orderVo);
//mysql
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.GOBLIN_ORDER_CREATE_PAY.getKey(),
SqlMapping.gets(sqls, sqlDataOrder, sqlDataSku));
SqlMapping.gets(sqls, sqlDataOrder, sqlDataSku, initCandyMgtCouponObjs));
//加分
if (orderUtils.noZhengzaiOrder(uid)) {
......@@ -1109,6 +1260,12 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if (!"超时支付自动退款".equals(backOrderVo.getDescribes())) {
redisUtils.incrSkuStock(pre, skuId, orderSkuVo.getNum());
redisUtils.decrSkuCountByUid(orderVo.getUserId(), skuId, orderSkuVo.getNum());
if (Objects.equals(orderSkuVo.getSkuType(), 2)) {// 券类商品
if (Objects.equals(orderSkuVo.getIsTrueName(), 1)) {// 需关联实名人
redisUtils.decrSkuCountByIdNo(orderSkuVo.getIdType(), orderSkuVo.getIdNo(), orderSkuVo.getSkuId(), orderSkuVo.getNum());
}
}
}
}
......
......@@ -6,6 +6,7 @@ import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.adam.dto.vo.AdamEntersVo;
import com.liquidnet.service.base.*;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.candy.dto.CandyUserCouponAssocDto;
import com.liquidnet.service.dragon.constant.DragonConstant;
import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
......@@ -261,7 +262,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
} else {
if (DateUtil.compareStrDay(DateUtil.getNowTime(), memberTimeStart) == 1 && DateUtil.compareStrDay(DateUtil.getNowTime(), timeStart) == -1) {
advanceMap = orderUtils.useCoupon(payOrderParam.getAdvanceCode(), "购买 " + performanceData.getTitle(), BigDecimal.ZERO, payOrderParam.getPerformanceId(), payOrderParam.getTimeId(), payOrderParam.getTicketId());
advanceMap = orderUtils.useCoupon(payOrderParam.getAdvanceCode(), "购买 " + performanceData.getTitle(), BigDecimal.ZERO, payOrderParam.getPerformanceId(), payOrderParam.getTimeId(), payOrderParam.getTicketId(),performanceData.getType());
if (advanceMap == null) {
return ResponseDto.failure("优先券不可用");
}
......@@ -322,6 +323,22 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
return ResponseDto.failure(ErrorMapping.get("20015"));//入场人数量错误
}
//判断新商品券
if(payOrderParam.getVoucherCode()!=null) {
CandyUserCouponAssocDto couponAssocDto = dataUtils.getGoblinPlatformCoupon(payOrderParam.getVoucherCode());
if (couponAssocDto != null) {
boolean goblinPlatformCouponseCanUse = false;
for (AdamEntersVo adamEnters : entersVoList) {
if (couponAssocDto.getIdNo().equals(adamEnters.getIdCard())) {
goblinPlatformCouponseCanUse = true;
}
}
if (!goblinPlatformCouponseCanUse) {
return ResponseDto.failure("实名券与入场人信息不一致");
}
}
}
// 判断库存
int surplusGeneral = orderUtils.changeSurplus(isPay, payOrderParam.getTicketId(), -payOrderParam.getNumber());
......@@ -406,7 +423,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
if (e.getMessage() == null) {
return ResponseDto.failure(ErrorMapping.get("20018"));//乱七八糟异常
} else if (e.getMessage().equals("券不可用")) {
return ResponseDto.failure(ErrorMapping.get("20030"));//券不可用
return ResponseDto.failure("请在“我的订单”中取消或支付“待支付订单”再进行操作");//券不可用
} else {
return ResponseDto.failure(ErrorMapping.get("20018"));//乱七八糟异常
}
......@@ -476,7 +493,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
if (payOrderParam.getVoucherCode() != null) {
HashMap<String, Object> hashMap = orderUtils.useCoupon(payOrderParam.getVoucherCode(), content, orderTickets.getPriceTotal().subtract(priceExpress), payOrderParam.getPerformanceId(), payOrderParam.getTimeId(), payOrderParam.getTicketId());
HashMap<String, Object> hashMap = orderUtils.useCoupon(payOrderParam.getVoucherCode(), content, orderTickets.getPriceTotal().subtract(priceExpress), payOrderParam.getPerformanceId(), payOrderParam.getTimeId(), payOrderParam.getTicketId(),performanceData.getType());
if (null != hashMap) {
BigDecimal priceVoucher = (BigDecimal) hashMap.get("voucher");
Integer typeVoucher = (Integer) hashMap.get("type");
......@@ -1043,9 +1060,9 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
SmsEnum.ADTemplate adTemplate = null;
if (orderTicketData.getGetTicketType().equals("express")) {
adTemplate = SmsEnum.ADTemplate.SMS_225995308;
adTemplate = SmsEnum.ADTemplate.SMS_463657321;
} else if (orderTicketData.getGetTicketType().equals("electronic")) {
adTemplate = ticketData.getIsShowCode() == 1 ? SmsEnum.ADTemplate.SMS_225995308 : SmsEnum.ADTemplate.SMS_225995308;
adTemplate = ticketData.getIsShowCode() == 1 ? SmsEnum.ADTemplate.SMS_463657321 : SmsEnum.ADTemplate.SMS_463657321;
}
if (null != adTemplate) {
......
package com.liquidnet.service.order.service.impl;
import com.alibaba.fastjson.JSON;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.*;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.kylin.constant.KylinTableStatusConst;
......@@ -124,8 +121,9 @@ public class KylinRefundsStatusServiceImpl {
kylinOrderRefunds.setOrderRefundsId(orderRefundsId);
kylinOrderRefunds.setOrderTicketsId(orderTicketsId);
String orderRefundCode = orderInfo.getOrderCode();
String codeNum = StringUtils.leftPad(String.valueOf(5), 3, "0");
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(codeNum));
// long currentTime = System.currentTimeMillis()% 100;
// String codeNum = StringUtils.leftPad(String.valueOf(5), 3, "0");
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(dataUtils.incrOrderRefundCode(orderInfo.getOrderCode())+""));
kylinOrderRefunds.setPrice(entitiesPriceSum);
kylinOrderRefunds.setPriceExpress(RefundPriceExpress);
kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY);
......
......@@ -158,7 +158,7 @@ public class MixOrderServiceImpl implements IMixOrderService {
canBuyIds.add(skuId + "," + itemVo.getCount());
}
}
if (skuInfoVo.getSkuType() == 0) {
if (skuInfoVo.getSkuType() == 0 || skuInfoVo.getSkuType() == 2) {
skuInfoList.add(skuInfoVo);
skuMix.put(skuInfoVo.getSkuId() + "price", itemVo.getPrice());
skuMix.put(skuInfoVo.getSkuId() + "count", itemVo.getCount());
......
package com.liquidnet.service.order.utils;
import com.fasterxml.jackson.databind.JsonNode;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.commons.lang.util.IdentityUtils;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.adam.dto.vo.AdamUserInfoVo;
import com.liquidnet.service.adam.dto.vo.AdamUserMemberVo;
import com.liquidnet.service.base.ErrorMapping;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
......@@ -34,4 +40,87 @@ public class AdamRedisUtils {
log.debug("#RDM耗时:{}ms", System.currentTimeMillis() - s);
return vo;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证失败的<ID_TYPE+ID_NO, ID_NAME> */
private boolean setCertificationJunk(int idType, String idNo, String idName) {
return redisUtil.set(AdamRedisConst.INFO_CERTIFICATION_JUNK + idType + idNo, idName, 604800);
}
private boolean isCertificationJunk(int idType, String idNo, String idName) {
String o = (String) redisUtil.get(AdamRedisConst.INFO_CERTIFICATION_JUNK + idType + idNo);
return !StringUtils.isEmpty(o) && o.equals(idName);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证成功的<ID_TYPE+ID_NO, ID_NAME> */
/**
* 目前只针对身份证类型三方服务认证成功的标记
*
* @param idType
* @param idNo
* @param idName
* @return
*/
private boolean setCertification(int idType, String idNo, String idName) {
return redisUtil.set(AdamRedisConst.INFO_CERTIFICATION + idType + idNo, idName);
}
/**
* 目前只针对身份证类型三方服务认证成功的标记
*
* @param idType
* @param idNo
* @param idName
* @return
*/
private int isCertification(int idType, String idNo, String idName) {
String o = (String) redisUtil.get(AdamRedisConst.INFO_CERTIFICATION + idType + idNo);
if (StringUtils.isEmpty(o)) {
return -1;
}
return o.equals(idName) ? 1 : 0;
// return !StringUtils.isEmpty(o) && o.equals(idName);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证处理 */
/**
* 身份证实名处理
*
* @param uid
* @param name
* @param idCard
*/
public void identityHandler1(String uid, String name, String idCard) {
int rst = this.isCertification(1, idCard, name);
switch (rst) {
case -1:// 本地不存在
if (this.isCertificationJunk(1, idCard, name)) {
throw new LiquidnetServiceException("-1", "身份证号与姓名不符");
}
String respStr = IdentityUtils.aliThird(name, idCard), respErrorCode = null;
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"0".equals(respErrorCode = String.valueOf(respJNode.get("error_code")))) {
log.info("###实名认证失败[{}]", respStr);
// this.setCertificationJunk(1, idCard, name);
if (!StringUtils.isEmpty(respErrorCode) && org.apache.commons.lang3.StringUtils.indexOf("3000290033", respErrorCode) < 0) {
// 认证服务商'30002'、'90033'为运营商导致的失败,这里不做缓存标记
this.setCertificationJunk(1, idCard, name);
}
throw new LiquidnetServiceException("-1", "身份证号与姓名不符");
}
this.setCertification(1, idCard, name);
break;
case 0:// 本地存在,验证不通过
throw new LiquidnetServiceException("-1", "身份证号与姓名不符");
case 1:// 本地存在,验证通过
break;
}
}
}
......@@ -5,6 +5,8 @@ import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IPUtil;
import com.liquidnet.service.adam.dto.vo.AdamEntersVo;
import com.liquidnet.service.candy.constant.CandyRedisConst;
import com.liquidnet.service.candy.dto.CandyUserCouponAssocDto;
import com.liquidnet.service.goblin.constant.SmileRedisConst;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dao.KylinFreightChargeDao;
......@@ -73,6 +75,10 @@ public class DataUtils {
redisUtil.set(KylinRedisConst.ORDER_LIST + userId, vo);
}
public int incrOrderRefundCode(String orderCode) {
return (int) redisUtil.incr(KylinRedisConst.ORDER_REFUND_TEMP + orderCode,1);
}
public List<KylinOrderListVo> getOrderList(String userId) {
Object obj = redisUtil.get(KylinRedisConst.ORDER_LIST + userId);
if (obj != null) {
......@@ -126,8 +132,8 @@ public class DataUtils {
public void changeBuyInfo(String userId, String idCard, String performanceId, String ticketId, int buyCount) {
String redisKeyUid;
String redisKeyIdCard;
String performanceIdKeyIdCard="";
String ticketIdKeyIdCard="";
String performanceIdKeyIdCard = "";
String ticketIdKeyIdCard = "";
int isTrueName = getPerformanceIsTrueName(performanceId);
......@@ -380,7 +386,7 @@ public class DataUtils {
/**
* 获取演出ids
*/
public List<String> getShowIds(){
public List<String> getShowIds() {
String rdk = SmileRedisConst.SMILE_SHOW;
Object obj = redisUtil.get(rdk);
if (obj == null) {
......@@ -389,4 +395,19 @@ public class DataUtils {
return (List<String>) obj;
}
}
/**
* 根据券id查询适用人证件信息
* @param ucouponId
* @return
*/
public CandyUserCouponAssocDto getGoblinPlatformCoupon(String ucouponId) {
String rdk = CandyRedisConst.BASIC_USER_COUPON_ASSOC.concat(ucouponId);
Object obj = redisUtil.get(rdk);
if (obj == null) {
return null;
} else {
return (CandyUserCouponAssocDto) obj;
}
}
}
......@@ -429,7 +429,7 @@ public class GoblinNftOrderUtils {
}
/**
* private int skuType 商品类型[0-常规|1-数字藏品]
* private int skuType 商品类型[0-常规|1-数字藏品|2-券类商品]
* private String status 审核状态[0-初始编辑|1-审核中|2-审核不通过|3-审核通过];
* private String shelvesStatus 单品上架状态[0-待上架|1-下架|2-违规|3-上架];
* private String skuAppear 是否隐藏[0-默认展示|1-隐藏]; 隐藏款 拼参数可购买 盲盒可抽
......
......@@ -25,7 +25,7 @@ import java.util.stream.Collectors;
@Component
public class GoblinRedisUtils {
@Autowired
RedisUtil redisUtil;
public RedisUtil redisUtil;
@Autowired
GoblinMongoUtils goblinMongoUtils;
......@@ -361,6 +361,11 @@ public class GoblinRedisUtils {
return (int) redisUtil.decr(redisKey, number);
}
// 减少 关联实名人sku购买个数
public long decrSkuCountByIdNo(int idType, String idNo, String skuId, int number) {
return redisUtil.decr(String.format(GoblinRedisConst.REDIS_GOBLIN_BUY_COUNT_IDNO, idType, idNo, skuId), number);
}
// 增加 sku销量
public int incrSkuSaleCount(String spuId, String skuId, int number) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_SALE_COUNT.concat(skuId);
......
package com.liquidnet.service.order.utils;
import com.liquidnet.service.adam.dto.vo.AdamEntersVo;
import com.liquidnet.service.goblin.dto.manage.GoblinOrderSkuParam;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinNftOrder;
import com.liquidnet.service.goblin.entity.GoblinOrderSku;
......@@ -59,6 +60,7 @@ public class ObjectUtil {
private static final HashMap<String, List<GoblinGoodsSkuInfoVo>> goblinGoodsSkuInfoVoMap = new HashMap();
private static final HashMap<String, String[]> mixIdMap = new HashMap();
private static final ArrayList<CouponOutLineVo> couponOutLineVo = new ArrayList<>();
private static final HashMap<String, GoblinOrderSkuParam> goblinOrderSkuParamMap = new HashMap();
public static Object[] objectsArray;
public static final Integer[] integerArray2 = new Integer[2];
......@@ -185,4 +187,8 @@ public class ObjectUtil {
public static ArrayList<WriteModel<Document>> getWriteModelDocumentArrayList() {
return (ArrayList<WriteModel<Document>>) writeModelDocumentArrayList.clone();
}
public static HashMap<String, GoblinOrderSkuParam> cloneGoblinOrderSkuParamMap() {
return (HashMap<String, GoblinOrderSkuParam>) goblinOrderSkuParamMap.clone();
}
}
......@@ -222,7 +222,7 @@ public class OrderUtils {
* @param totalPrice 订单总价
* @return
*/
public HashMap<String, Object> useCoupon(String uCouponId, String content, BigDecimal totalPrice, String performanceId, String timesId, String ticketId) {
public HashMap<String, Object> useCoupon(String uCouponId, String content, BigDecimal totalPrice, String performanceId, String timesId, String ticketId,int perType) {
HashMap<String, Object> hashMap = CollectionUtil.mapStringObject();
try {
MultiValueMap<String, String> params = CollectionUtil.linkedMultiValueMapStringString();
......@@ -233,6 +233,7 @@ public class OrderUtils {
params.add("performanceId", performanceId);
params.add("timeId", timesId);
params.add("ticketId", ticketId);
params.add("perType", perType+"");
MultiValueMap<String, String> header = CollectionUtil.linkedMultiValueMapStringString();
header.add("Authorization", "Bearer " + CurrentUtil.getToken());
String returnData = HttpUtil.post(candyUrl + "/candy-coupon/use", params, header);
......
......@@ -33,11 +33,13 @@ kylin_order_refund_entities.overtimeRefund=INSERT INTO kylin_order_refund_entiti
goblin.order.create.order_insert=INSERT INTO goblin_store_order (`master_order_code`,`order_id`,`store_id`,`store_name`,`order_code`,`user_id`,`user_name`,`user_mobile`,`price_total`,`pay_code`,`price_actual`,`price_refund`,`price_express`,`price_coupon`,`store_price_coupon`,`price_voucher`,`status`,`ucoupon_id`,`store_coupon_id`,`pay_type`,`device_from`,`source`,`version`,`is_member`,`order_type`,`write_off_code`,`pay_countdown_minute`,`ip_address`,`market_id`,`market_type`,`created_at`,`mix_id`,`mix_code`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin.order.create.attr_insert=INSERT INTO goblin_order_attr (`order_attr_id`,`order_id`,`express_contacts`,`express_address`,`express_address_detail`,`express_phone`,`express_type`,`created_at`) VALUES (?,?,?,?,?,?,?,?)
goblin.order.create.sku_insert=INSERT INTO goblin_order_sku (`order_sku_id`,`order_id`,`spu_id`,`spu_name`,`spu_pic`,`sku_id`,`num`,`sku_price`,`sku_price_actual`,`sku_name`,`sku_no`,`sku_image`,`sku_specs`,`price_voucher`,`spu_erp_code`,`sku_erp_code`,`erp_type`,`erp_warehouse_no`,`erp_hosting`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
goblin_order_sku_assoc.insert=INSERT INTO goblin_order_sku_assoc (order_sku_id,is_true_name,id_type,id_name,id_no,operator,created_at) VALUES (?,?,?,?,?,?,?)
#---- \u518D\u6B21\u652F\u4ED8
goblin_order.pay.again=UPDATE goblin_store_order SET pay_type = ? ,device_from = ? ,pay_code = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
#---- \u8BA2\u5355\u521B\u5EFA&\u652F\u4ED8
goblin_order.pay.order=UPDATE goblin_store_order SET payment_type = ? ,payment_id=?,pay_code = ? ,pay_time = ?,write_off_code = ? ,zhengzai_status =?,status = ? ,updated_at = ?,push_time = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
goblin_order.pay.sku=UPDATE goblin_order_sku SET status = ? ,updated_at = ? ,push_time = ? WHERE order_sku_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
candy_mgt_coupon.pay.sku=INSERT INTO candy_mgt_coupon (mcoupon_id,coupon_id,state,event_amt,event_type,event_limit,event_at,operator,created_at) VALUES (?,?,0,1,2,?,?,?,?)
goblin_order.store.refundPrice=UPDATE goblin_store_order SET price_refund = ? ,status = ? , updated_at = ? WHERE order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
goblin_order.store.refundSkuPrice=UPDATE goblin_order_sku SET price_refund = ? ,status = ? , updated_at = ? WHERE order_sku_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
goblin_order.store.refundBackOrder=UPDATE goblin_back_order SET status = ? ,refund_at=?, updated_at = ? WHERE back_order_id = ? and (updated_at <= ? or created_at = ? or updated_at is null)
......
......@@ -11,12 +11,11 @@ import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.adam.dto.vo.AdamUserMemberVo;
import com.liquidnet.service.adam.entity.AdamUserMember;
import com.liquidnet.service.candy.constant.CandyRedisConst;
import com.liquidnet.service.candy.dto.CandyCommonCouponBasicDto;
import com.liquidnet.service.candy.dto.CandyCouponCodeDto;
import com.liquidnet.service.candy.dto.CandyCouponRuleDto;
import com.liquidnet.service.candy.dto.CandyUserCouponBasicDto;
import com.liquidnet.service.candy.dto.*;
import com.liquidnet.service.candy.entity.*;
import com.liquidnet.service.candy.mapper.CandyCouponMapper;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.vo.GoblinOrderSkuVo;
import com.liquidnet.service.platform.service.impl.adam.PlatformAdamUserMemberService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
......@@ -27,9 +26,9 @@ import org.springframework.util.CollectionUtils;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
......@@ -41,6 +40,8 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
@Autowired
private PlatformCandyUserCouponService platformCandyUserCouponService;
@Autowired
private PlatformCandyUserCouponAssocService platformCandyUserCouponAssocService;
@Autowired
private PlatformCandyCommonCouponService platformCandyCommonCouponService;
@Autowired
private PlatformAdamUserMemberService platformAdamUserMemberService;
......@@ -300,7 +301,6 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
* @param couponRuleDtoList List<CandyCouponRuleDto>
*/
private void processForUserCoupon(CandyMgtCoupon mgtCoupon, CandyCoupon coupon, List<CandyCouponRuleDto> couponRuleDtoList) {
List<CandyUserCoupon> initUserCouponList = new ArrayList<>();
LocalDateTime now = LocalDateTime.now();
String eventLimit = mgtCoupon.getEventLimit();
......@@ -309,6 +309,7 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
log.info("发放券处理中:{}-目标指定手机号[总数:{},发放量:{}]", mgtCoupon.getMcouponId(), limitSize, eventAmt);
AbstractRedisUtil redisAdamUtil = redisDataSourceUtil.getRedisAdamUtil();
AbstractRedisUtil redisGoblinUtil = redisDataSourceUtil.getRedisGoblinUtil();
if (coupon.getBindType() == 2) {// 券领取方式[2-积分商品],实际发放至用户时计算有效期
coupon.setEffectAt(now);
......@@ -324,6 +325,9 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
// 指定手机号发放券中,会员权益券失效时间duedAt需要同步会员到期时间expiryAt
Integer exclusively = mgtCoupon.getExclusively();
boolean isMemberRightsCoupon = exclusively == 1;
List<CandyUserCoupon> initUserCouponList = new ArrayList<>();
List<CandyUserCouponAssoc> initUserCouponAssocList = new ArrayList<>();
for (int i = 0; i < eventAmt; i++) {
for (String r : eventLimitArr) {
String uid = (String) redisAdamUtil.get(AdamRedisConst.IDENTITY_MOBILE.concat(r));
......@@ -353,6 +357,24 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
log.warn("发放券处理中:{}-目标指定手机号,该券生效日期或失效日期无效[couponId:{},effectAt:{},expireAt:{}]", mcouponId, couponId, couponEffectAt, couponExpireAt);
continue;
}
// 判定为券类商品支付后发放券业务&&需要关联实名人时,提取关联人信息绑定到用户券信息中
if (Objects.equals(mgtCoupon.getEventDriven(), 0)
&& Objects.equals(operator, CandyRedisConst.OPERATOR_MGT_COUPON_BY_SKU)
&& Objects.equals(coupon.getIsTrueName(), 1)) {
GoblinOrderSkuVo goblinOrderSkuVo = (GoblinOrderSkuVo) redisGoblinUtil.get(GoblinRedisConst.REDIS_GOBLIN_ORDER_SKU.concat(mgtCoupon.getMcouponId()));
if (!Objects.isNull(goblinOrderSkuVo)) {
CandyUserCouponAssoc userCouponAssoc = new CandyUserCouponAssoc();
userCoupon.setUcouponId(mcouponId);// 券类商品默认一个商品对应一个券,下单只可购买一张
userCouponAssoc.setUcouponId(userCoupon.getUcouponId());
userCouponAssoc.setIdType(goblinOrderSkuVo.getIdType());
userCouponAssoc.setIdName(goblinOrderSkuVo.getIdName());
userCouponAssoc.setIdNo(goblinOrderSkuVo.getIdNo());
initUserCouponAssocList.add(userCouponAssoc);
} else {
log.warn("");
}
}
userCoupon.setOperator(operator);
userCoupon.setCreatedAt(now);
......@@ -366,6 +388,15 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
AbstractRedisUtil redisCandyUtil = redisDataSourceUtil.getRedisCandyUtil();
if (!initUserCouponList.isEmpty()) {
if (platformCandyUserCouponService.saveBatch(initUserCouponList)) {
if (!initUserCouponAssocList.isEmpty()) {// 券类商品默认一个商品对应一个券,下单只可购买一张
boolean assocSaveFlg = platformCandyUserCouponAssocService.saveBatch(initUserCouponAssocList);
initUserCouponAssocList.forEach(c -> {
CandyUserCouponAssocDto assocDto = CandyUserCouponAssocDto.getNew().copy(c);
long l = ChronoUnit.SECONDS.between(now, couponExpireAt);
boolean assocRdsSetFlg = redisCandyUtil.set(CandyRedisConst.BASIC_USER_COUPON_ASSOC.concat(c.getUcouponId()), assocDto, l);
log.info("发放券-券类商品-记录关联人信息:[mcouponId={}, ucouponId={},assocSaveFlg={},assocRdsSetFlg={}]", mcouponId, c.getUcouponId(), assocSaveFlg, assocRdsSetFlg);
});
}
initUserCouponList.forEach(r -> {
String uckey = CandyRedisConst.BASIC_USER_COUPON.concat(r.getUid());
......
package com.liquidnet.service.platform.service.impl.candy;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.service.candy.entity.CandyUserCouponAssoc;
import com.liquidnet.service.candy.mapper.CandyUserCouponAssocMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class PlatformCandyUserCouponAssocService extends ServiceImpl<CandyUserCouponAssocMapper, CandyUserCouponAssoc> {
}
......@@ -148,7 +148,7 @@ public class KylinRefundsStatusServiceImpl {
KylinOrderTicketEntities entitiesTable = KylinOrderTicketEntities.getNew();
BigDecimal priceNew = refundEntitiesInfo.getRefundPrice().add(refundedPrice);
int isPayment = 0;
if (priceNew.compareTo(onePrice) >= 0) {
if (priceNew.compareTo(onePrice.subtract(refundInfo.getPriceCharges())) >= 0) {//增加 胡佳晨 .subtract(refundInfo.getPriceCharges())
isPayment = KylinTableStatusConst.ENTITIES_IS_PAYMENT3;
refundNumber++;
} else {
......@@ -156,7 +156,7 @@ public class KylinRefundsStatusServiceImpl {
}
entitiesTable.setIsPayment(isPayment);
entitiesTable.setUpdatedAt(LocalDateTime.now());
if (priceNew.compareTo(onePrice) > 0) {
if (priceNew.compareTo(onePrice.subtract(refundInfo.getPriceCharges())) > 0) {//.subtract(refundInfo.getPriceCharges())
priceNew = onePrice;
}
entitiesTable.setRefundPrice(priceNew);
......
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