商城资源添加折扣字段,商城vip折扣,vip过期定时任务
This commit is contained in:
@@ -235,6 +235,7 @@ public class DressShopAdminService {
|
||||
dressShop.setDressPrice(newDressShop.getDressPrice());
|
||||
dressShop.setDressDay(newDressShop.getDressDay());
|
||||
dressShop.setObtainWay(newDressShop.getObtainWay());
|
||||
dressShop.setVipLimit(newDressShop.getVipLimit());
|
||||
dressShop.setUpdateTime(date);
|
||||
return dressShop;
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ public enum DressShopTypeEnum {
|
||||
NAMEPLATE((byte)2, "铭牌"),
|
||||
INFO_CARD((byte)3, "资料卡"),
|
||||
CHAT_BUBBLE((byte)4, "聊天气泡"),
|
||||
PERSON_PAGE((byte)5, "个人主页"),
|
||||
;
|
||||
|
||||
/** 奖品ID **/
|
||||
|
@@ -13,6 +13,8 @@ public class CarRecord {
|
||||
|
||||
private Long price;
|
||||
|
||||
private Double discountPrice;
|
||||
|
||||
private Byte optType;
|
||||
|
||||
private Date createTime;
|
||||
@@ -162,4 +164,12 @@ public class CarRecord {
|
||||
public void setComeFrom(Byte comeFrom) {
|
||||
this.comeFrom = comeFrom;
|
||||
}
|
||||
|
||||
public Double getDiscountPrice() {
|
||||
return discountPrice;
|
||||
}
|
||||
|
||||
public void setDiscountPrice(Double discountPrice) {
|
||||
this.discountPrice = discountPrice;
|
||||
}
|
||||
}
|
@@ -13,6 +13,8 @@ public class HeadwearRecord {
|
||||
|
||||
private Long price;
|
||||
|
||||
private Double discountPrice;
|
||||
|
||||
private Byte optType;
|
||||
|
||||
private Date createTime;
|
||||
@@ -162,4 +164,12 @@ public class HeadwearRecord {
|
||||
public void setComeFrom(Byte comeFrom) {
|
||||
this.comeFrom = comeFrom;
|
||||
}
|
||||
|
||||
public Double getDiscountPrice() {
|
||||
return discountPrice;
|
||||
}
|
||||
|
||||
public void setDiscountPrice(Double discountPrice) {
|
||||
this.discountPrice = discountPrice;
|
||||
}
|
||||
}
|
@@ -48,6 +48,8 @@ public class NameplateRecord implements Serializable {
|
||||
|
||||
private Long price;
|
||||
|
||||
private Double discountPrice;
|
||||
|
||||
private Byte comeFrom;
|
||||
|
||||
}
|
||||
|
@@ -47,6 +47,10 @@ public class DressShop {
|
||||
@ApiModelProperty("获得方式,1-普通,2-活动")
|
||||
private Byte obtainWay;
|
||||
|
||||
@TableField("vip_limit")
|
||||
@ApiModelProperty("贵族限定,0-无限制,1,2,3,4...")
|
||||
private Byte vipLimit;
|
||||
|
||||
@TableField("create_time")
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
@@ -54,6 +54,8 @@ public class UserChatBubbleRecord {
|
||||
private Long giverUid;
|
||||
@TableField(value = "price")
|
||||
private Long price;
|
||||
@TableField(value = "discount_price")
|
||||
private Double discountPrice;
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
@TableField(value = "update_time")
|
||||
|
@@ -56,6 +56,8 @@ public class UserInfoCardRecord {
|
||||
private Long giverUid;
|
||||
@TableField(value = "price")
|
||||
private Long price;
|
||||
@TableField(value = "discount_price")
|
||||
private Double discountPrice;
|
||||
@TableField(value = "create_time")
|
||||
private Date createTime;
|
||||
@TableField(value = "update_time")
|
||||
|
@@ -7,6 +7,8 @@ import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ApiModel
|
||||
public class DressShopVo extends DressShop {
|
||||
@@ -15,6 +17,10 @@ public class DressShopVo extends DressShop {
|
||||
@ReplaceAppDomain
|
||||
private String pic;
|
||||
|
||||
@ApiModelProperty("装扮动效图片")
|
||||
@ReplaceAppDomain
|
||||
private String effect;
|
||||
|
||||
@ApiModelProperty("装扮昵称")
|
||||
private String name;
|
||||
|
||||
@@ -30,4 +36,13 @@ public class DressShopVo extends DressShop {
|
||||
@JsonIgnore
|
||||
private Integer partitionFlag;
|
||||
|
||||
@ApiModelProperty("折扣价格")
|
||||
private BigDecimal discountPrice;
|
||||
|
||||
@ApiModelProperty("vip等级")
|
||||
private Integer vipLevel;
|
||||
|
||||
@ApiModelProperty("vip等级对应的折扣百分比 * 100")
|
||||
private Integer discount;
|
||||
|
||||
}
|
||||
|
@@ -41,4 +41,6 @@ public interface VipAuthItemMapper extends BaseMapper<VipAuthItem> {
|
||||
* @return
|
||||
*/
|
||||
List<VipAuthItem> listValidItemByVipLevel(Integer vipLevel);
|
||||
|
||||
List<VipAuthItem> listValidItemByAuthType(@Param("authType") Byte authType);
|
||||
}
|
||||
|
@@ -99,98 +99,98 @@ public class CarPayService extends BaseService {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//
|
||||
// @Frozen
|
||||
// public CarCarport buyCarGoods(Long uid, Long targetUid, Integer carId, DeviceInfo deviceInfo, Byte currencyType,
|
||||
// Byte comeFrom) throws Exception {
|
||||
// //校验用户
|
||||
// Users user = usersService.getUsersByUid(uid);
|
||||
// if(user == null){
|
||||
// throw new ServiceException(BusiStatus.USERNOTEXISTS);
|
||||
// }
|
||||
// if (comeFrom == Constant.CarComeFrom.USER_DONATE) {
|
||||
// Users targetUser = usersService.getUsersByUid(targetUid);
|
||||
// if (targetUser == null) {//为兼容ios传错目标用户uid,则提示“赠送失败,请下载最新版本”
|
||||
// throw new ServiceException(BusiStatus.DONATE_ERROR);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 判断该座驾商品是否存在
|
||||
// CarGoods carGoods = carGoodsService.getCarGoods(carId);
|
||||
// //校验数据合法性
|
||||
// this.verifyBuyCar(carGoods, currencyType);
|
||||
//
|
||||
// // 判断用户是否存在该有效座驾,存在则续费,没有则购买
|
||||
// CarCarport carCarport = this.getOneCarInPort(targetUid, carId);
|
||||
// if (carCarport == null) {
|
||||
// carCarport = this.buyCarGoods(uid, targetUid, carGoods, deviceInfo, Constant.CarOptType.purchase,
|
||||
// currencyType, comeFrom, null);
|
||||
// } else {
|
||||
// carCarport = this.buyCarGoods(uid, targetUid, carGoods, deviceInfo, Constant.CarOptType.renew,
|
||||
// currencyType, comeFrom, carCarport.getExpireTime());
|
||||
// }
|
||||
// if (comeFrom == Constant.CarComeFrom.USER_DONATE) {//用户赠送发送小秘书通知
|
||||
// String carGoodsName = carGoods.getName();
|
||||
// String i18nId = CarGoods.class.getSimpleName() + StrUtil.DOT + carGoodsName;
|
||||
// String name = I18NMessageSourceUtil.getMessage(i18nId, carGoodsName, targetUid);
|
||||
// String message = I18NMessageSourceUtil.getMessage(I18nAlertEnum.CAR_GOODS_FOR_SEND, new Object[]{name, carGoods.getDays()}, targetUid);
|
||||
// Executors.newSingleThreadExecutor().execute(() -> sendGiveCarMsg(targetUid.toString(), message));
|
||||
// }
|
||||
// return carCarport;
|
||||
//
|
||||
// }
|
||||
|
||||
@Frozen
|
||||
public CarCarport buyCarGoods(Long uid, Long targetUid, Integer carId, DeviceInfo deviceInfo, Byte currencyType,
|
||||
Byte comeFrom) throws Exception {
|
||||
//校验用户
|
||||
Users user = usersService.getUsersByUid(uid);
|
||||
if(user == null){
|
||||
throw new ServiceException(BusiStatus.USERNOTEXISTS);
|
||||
}
|
||||
if (comeFrom == Constant.CarComeFrom.USER_DONATE) {
|
||||
Users targetUser = usersService.getUsersByUid(targetUid);
|
||||
if (targetUser == null) {//为兼容ios传错目标用户uid,则提示“赠送失败,请下载最新版本”
|
||||
throw new ServiceException(BusiStatus.DONATE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// 判断该座驾商品是否存在
|
||||
CarGoods carGoods = carGoodsService.getCarGoods(carId);
|
||||
//校验数据合法性
|
||||
this.verifyBuyCar(carGoods, currencyType);
|
||||
|
||||
// 判断用户是否存在该有效座驾,存在则续费,没有则购买
|
||||
CarCarport carCarport = this.getOneCarInPort(targetUid, carId);
|
||||
if (carCarport == null) {
|
||||
carCarport = this.buyCarGoods(uid, targetUid, carGoods, deviceInfo, Constant.CarOptType.purchase,
|
||||
currencyType, comeFrom, null);
|
||||
} else {
|
||||
carCarport = this.buyCarGoods(uid, targetUid, carGoods, deviceInfo, Constant.CarOptType.renew,
|
||||
currencyType, comeFrom, carCarport.getExpireTime());
|
||||
}
|
||||
if (comeFrom == Constant.CarComeFrom.USER_DONATE) {//用户赠送发送小秘书通知
|
||||
String carGoodsName = carGoods.getName();
|
||||
String i18nId = CarGoods.class.getSimpleName() + StrUtil.DOT + carGoodsName;
|
||||
String name = I18NMessageSourceUtil.getMessage(i18nId, carGoodsName, targetUid);
|
||||
String message = I18NMessageSourceUtil.getMessage(I18nAlertEnum.CAR_GOODS_FOR_SEND, new Object[]{name, carGoods.getDays()}, targetUid);
|
||||
Executors.newSingleThreadExecutor().execute(() -> sendGiveCarMsg(targetUid.toString(), message));
|
||||
}
|
||||
return carCarport;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 购买、续费、用户赠送座驾
|
||||
*
|
||||
* @param uid
|
||||
* @param targetUid
|
||||
* @param carGoods
|
||||
* @param deviceInfo
|
||||
* @param optType
|
||||
* @param currencyType
|
||||
* @param comeFrom
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CarCarport buyCarGoods(Long uid, Long targetUid, CarGoods carGoods, DeviceInfo deviceInfo, Byte optType,
|
||||
Byte currencyType, Byte comeFrom, Date expireTime) throws Exception {
|
||||
String lockVal = null;
|
||||
try {
|
||||
lockVal = jedisLockService.lock(RedisKey.lock_buy_car.getKey(uid.toString()), 10 * 1000, 12 * 1000);
|
||||
if (BlankUtil.isBlank(lockVal)) {
|
||||
throw new ServiceException(BusiStatus.SERVERBUSY);
|
||||
}
|
||||
CarCarport carCarport = null;
|
||||
Long carPrice = this.getCarPrice(carGoods, currencyType, optType, expireTime);
|
||||
if (currencyType.byteValue() == Constant.WalletCurrencyType.gold) {//金币购买逻辑
|
||||
// 扣除用户金币
|
||||
this.userPurseService.subDiamond(uid, carPrice.doubleValue(), BillObjTypeEnum.PURCHASE_CAR_GOODS.getDesc());
|
||||
// 通知客户端修改钱包数据
|
||||
UserPurse userPurse = userPurseService.queryUserPurse(uid);
|
||||
userPurseService.sendSysMsgByModifyGold(userPurse);
|
||||
// 插入座驾商品
|
||||
carCarport = insertCarport(targetUid, carGoods, comeFrom == Constant.CarComeFrom.USER_DONATE ? true : false, carGoods.getDays());
|
||||
insertCarRecord(targetUid, carGoods, optType, deviceInfo, carGoods.getDays(), uid, comeFrom, carPrice, currencyType, null);
|
||||
BillObjTypeEnum billObjTypeEnum = Constant.CarComeFrom.BUY == comeFrom ? BillObjTypeEnum.PURCHASE_CAR_GOODS : BillObjTypeEnum.GIVE_CAR_GOODS;
|
||||
// 插入账单
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, Double.valueOf(carPrice));
|
||||
applicationContext.publishEvent(new ActivityOfDayConsumeEvent(ActivityOfDayConsumeMessage.builder()
|
||||
.sendUid(uid)
|
||||
.messTime(Calendar.getInstance().getTime())
|
||||
.totalDiamondNum(carPrice.doubleValue()).consumeType("buyCarGoods").build()));
|
||||
}
|
||||
return carCarport;
|
||||
} catch (Exception e) {
|
||||
logger.error("buyCarGoods error: uid = {},targetUid = {},carGoodsId = {},currencyType = {},e={}",
|
||||
uid, targetUid, carGoods.getId(), currencyType, e.getMessage());
|
||||
throw e;
|
||||
} finally {
|
||||
jedisLockService.unlock(RedisKey.lock_buy_car.getKey(uid.toString()), lockVal);
|
||||
}
|
||||
|
||||
}
|
||||
// /**
|
||||
// * 购买、续费、用户赠送座驾
|
||||
// *
|
||||
// * @param uid
|
||||
// * @param targetUid
|
||||
// * @param carGoods
|
||||
// * @param deviceInfo
|
||||
// * @param optType
|
||||
// * @param currencyType
|
||||
// * @param comeFrom
|
||||
// * @return
|
||||
// * @throws Exception
|
||||
// */
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
// public CarCarport buyCarGoods(Long uid, Long targetUid, CarGoods carGoods, DeviceInfo deviceInfo, Byte optType,
|
||||
// Byte currencyType, Byte comeFrom, Date expireTime) throws Exception {
|
||||
// String lockVal = null;
|
||||
// try {
|
||||
// lockVal = jedisLockService.lock(RedisKey.lock_buy_car.getKey(uid.toString()), 10 * 1000, 12 * 1000);
|
||||
// if (BlankUtil.isBlank(lockVal)) {
|
||||
// throw new ServiceException(BusiStatus.SERVERBUSY);
|
||||
// }
|
||||
// CarCarport carCarport = null;
|
||||
// Long carPrice = this.getCarPrice(carGoods, currencyType, optType, expireTime);
|
||||
// if (currencyType.byteValue() == Constant.WalletCurrencyType.gold) {//金币购买逻辑
|
||||
// // 扣除用户金币
|
||||
// this.userPurseService.subDiamond(uid, carPrice.doubleValue(), BillObjTypeEnum.PURCHASE_CAR_GOODS.getDesc());
|
||||
// // 通知客户端修改钱包数据
|
||||
// UserPurse userPurse = userPurseService.queryUserPurse(uid);
|
||||
// userPurseService.sendSysMsgByModifyGold(userPurse);
|
||||
// // 插入座驾商品
|
||||
// carCarport = insertCarport(targetUid, carGoods, comeFrom == Constant.CarComeFrom.USER_DONATE ? true : false, carGoods.getDays());
|
||||
// insertCarRecord(targetUid, carGoods, optType, deviceInfo, carGoods.getDays(), uid, comeFrom, carPrice, carPrice.doubleValue(), currencyType, null);
|
||||
// BillObjTypeEnum billObjTypeEnum = Constant.CarComeFrom.BUY == comeFrom ? BillObjTypeEnum.PURCHASE_CAR_GOODS : BillObjTypeEnum.GIVE_CAR_GOODS;
|
||||
// // 插入账单
|
||||
// billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, Double.valueOf(carPrice));
|
||||
// applicationContext.publishEvent(new ActivityOfDayConsumeEvent(ActivityOfDayConsumeMessage.builder()
|
||||
// .sendUid(uid)
|
||||
// .messTime(Calendar.getInstance().getTime())
|
||||
// .totalDiamondNum(carPrice.doubleValue()).consumeType("buyCarGoods").build()));
|
||||
// }
|
||||
// return carCarport;
|
||||
// } catch (Exception e) {
|
||||
// logger.error("buyCarGoods error: uid = {},targetUid = {},carGoodsId = {},currencyType = {},e={}",
|
||||
// uid, targetUid, carGoods.getId(), currencyType, e.getMessage());
|
||||
// throw e;
|
||||
// } finally {
|
||||
// jedisLockService.unlock(RedisKey.lock_buy_car.getKey(uid.toString()), lockVal);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
private long getCarPrice(CarGoods carGoods, Byte currencyType, Byte optType, Date expireTime) {
|
||||
long carPrice = 0L;
|
||||
@@ -341,20 +341,20 @@ public class CarPayService extends BaseService {
|
||||
* @desc 座驾购买记录
|
||||
*/
|
||||
public int insertCarRecord(Long uid, CarGoods carGoods, Byte optType, DeviceInfo deviceInfo, Integer days,
|
||||
Long giverUid, Byte comeFrom, Long price, Byte currencyType, String objSrc) {
|
||||
CarRecord carRecord = buildCarRecord(uid, carGoods, optType, deviceInfo, days, giverUid, comeFrom, price, currencyType, objSrc);
|
||||
Long giverUid, Byte comeFrom, Long price, Double discountPrice, Byte currencyType, String objSrc) {
|
||||
CarRecord carRecord = buildCarRecord(uid, carGoods, optType, deviceInfo, days, giverUid, comeFrom, price, discountPrice, currencyType, objSrc);
|
||||
return carRecordMapper.insertSelective(carRecord);
|
||||
}
|
||||
|
||||
public int insertCarRecord(Long uid, CarGoods carGoods, Byte optType, DeviceInfo deviceInfo, Date expireTime,
|
||||
Long giverUid, Byte comeFrom, Long price, Byte currencyType, String objSrc) {
|
||||
Long giverUid, Byte comeFrom, Long price, Double discountPrice, Byte currencyType, String objSrc) {
|
||||
int days = DateTimeUtil.diffDayByDateV2(new Date(), expireTime);
|
||||
CarRecord carRecord = buildCarRecord(uid, carGoods, optType, deviceInfo, days, giverUid, comeFrom, price, currencyType, objSrc);
|
||||
CarRecord carRecord = buildCarRecord(uid, carGoods, optType, deviceInfo, days, giverUid, comeFrom, price, discountPrice, currencyType, objSrc);
|
||||
return carRecordMapper.insertSelective(carRecord);
|
||||
}
|
||||
|
||||
public CarRecord buildCarRecord(Long uid, CarGoods carGoods, Byte optType, DeviceInfo deviceInfo, Integer days,
|
||||
Long giverUid, Byte comeFrom, Long price, Byte currencyType, String objSrc) {
|
||||
Long giverUid, Byte comeFrom, Long price, Double discountPrice, Byte currencyType, String objSrc) {
|
||||
Date date = new Date();
|
||||
CarRecord carRecord = new CarRecord();
|
||||
carRecord.setUid(uid);
|
||||
@@ -362,6 +362,7 @@ public class CarPayService extends BaseService {
|
||||
carRecord.setCarName(carGoods.getName());
|
||||
carRecord.setOptType(optType);
|
||||
carRecord.setPrice(price);
|
||||
carRecord.setDiscountPrice(discountPrice);
|
||||
carRecord.setCreateTime(date);
|
||||
if (deviceInfo != null) {
|
||||
carRecord.setOs(deviceInfo.getOs());
|
||||
@@ -509,7 +510,7 @@ public class CarPayService extends BaseService {
|
||||
carCarport = insertCarport(uid, carGoods, true, expireTime);
|
||||
int days = DateTimeUtil.diffDayByDateV2(startTime, expireTime);
|
||||
//插入座驾记录
|
||||
insertCarRecord(uid, carGoods, optType, null, days, null, Constant.CarComeFrom.OFFICIAL_DONATE, carPrice, currencyType, desc);
|
||||
insertCarRecord(uid, carGoods, optType, null, days, null, Constant.CarComeFrom.OFFICIAL_DONATE, carPrice, 0D, currencyType, desc);
|
||||
if (isSendMsg) {
|
||||
String carGoodsName = carGoods.getName();
|
||||
String i18nId = CarGoods.class.getSimpleName() + StrUtil.DOT + carGoodsName;
|
||||
@@ -570,7 +571,7 @@ public class CarPayService extends BaseService {
|
||||
* 购买座驾V2,传入价值和增加天数以传入值 为主
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CarCarport buyCarGoodsV2(Long uid, Long targetUid, Integer carId, DeviceInfo deviceInfo, Byte comeFrom, Long carPrice,Integer carDay) throws Exception{
|
||||
public CarCarport buyCarGoodsV2(Long uid, Long targetUid, Integer carId, DeviceInfo deviceInfo, Byte comeFrom, Long carPrice, Double discountPrice,Integer carDay) throws Exception{
|
||||
String lockVal = null;
|
||||
try {
|
||||
lockVal = jedisLockService.lock(RedisKey.lock_buy_car.getKey(uid.toString()), 10 * 1000, 12 * 1000);
|
||||
@@ -600,7 +601,7 @@ public class CarPayService extends BaseService {
|
||||
|
||||
|
||||
// 扣除用户金币
|
||||
this.userPurseService.subDiamond(uid, carPrice.doubleValue(), billObjTypeEnum.getDesc());
|
||||
this.userPurseService.subDiamond(uid, discountPrice, billObjTypeEnum.getDesc());
|
||||
// 通知客户端修改钱包数据
|
||||
UserPurse userPurse = userPurseService.queryUserPurse(uid);
|
||||
userPurseService.sendSysMsgByModifyGold(userPurse);
|
||||
@@ -608,17 +609,17 @@ public class CarPayService extends BaseService {
|
||||
CarCarport carCarport;
|
||||
if(Constant.CarComeFrom.BUY == comeFrom){
|
||||
carCarport = insertCarport(uid, carGoods, comeFrom == Constant.CarComeFrom.USER_DONATE ? true : false, carDay);
|
||||
insertCarRecord(uid, carGoods, optType, deviceInfo, carDay,null, comeFrom, carPrice, Constant.WalletCurrencyType.gold, null);
|
||||
insertCarRecord(uid, carGoods, optType, deviceInfo, carDay,null, comeFrom, carPrice, discountPrice, Constant.WalletCurrencyType.gold, null);
|
||||
}else{
|
||||
carCarport = insertCarport(targetUid, carGoods, comeFrom == Constant.CarComeFrom.USER_DONATE ? true : false, carDay);
|
||||
insertCarRecord(targetUid, carGoods, optType, deviceInfo, carDay, uid, comeFrom, carPrice, Constant.WalletCurrencyType.gold, null);
|
||||
insertCarRecord(targetUid, carGoods, optType, deviceInfo, carDay, uid, comeFrom, carPrice, discountPrice, Constant.WalletCurrencyType.gold, null);
|
||||
}
|
||||
// 插入账单
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, Double.valueOf(carPrice));
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, discountPrice);
|
||||
applicationContext.publishEvent(new ActivityOfDayConsumeEvent(ActivityOfDayConsumeMessage.builder()
|
||||
.sendUid(uid)
|
||||
.messTime(new Date())
|
||||
.totalDiamondNum(Double.valueOf(carPrice)).consumeType("buyCarGoodsV2").build()));
|
||||
.totalDiamondNum(discountPrice).consumeType("buyCarGoodsV2").build()));
|
||||
return carCarport;
|
||||
} catch (Exception e) {
|
||||
logger.error("buyCarGoodsV2 error: uid = {},targetUid = {},carGoodsId = {},e={}",
|
||||
|
@@ -9,16 +9,14 @@ import com.accompany.business.model.Nameplate;
|
||||
import com.accompany.business.model.dress.ChatBubble;
|
||||
import com.accompany.business.model.dress.DressShop;
|
||||
import com.accompany.business.model.dress.InfoCard;
|
||||
import com.accompany.business.model.vip.VipAuthItem;
|
||||
import com.accompany.business.mybatismapper.dress.DressShopMapper;
|
||||
import com.accompany.business.param.neteasepush.NeteaseSendMsgParam;
|
||||
import com.accompany.business.service.SendSysMsgService;
|
||||
import com.accompany.business.service.car.CarPayService;
|
||||
import com.accompany.business.service.nameplate.UserNameplateService;
|
||||
import com.accompany.core.base.DeviceInfoContextHolder;
|
||||
import com.accompany.core.enumeration.I18nAlertEnum;
|
||||
import com.accompany.core.service.partition.PartitionInfoService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.core.base.SpringContextHolder;
|
||||
import com.accompany.business.util.VipUtil;
|
||||
import com.accompany.business.vo.dress.DressShopVo;
|
||||
import com.accompany.common.annotation.Frozen;
|
||||
import com.accompany.common.config.SystemConfig;
|
||||
@@ -28,13 +26,17 @@ import com.accompany.common.constant.HeadwearConstant;
|
||||
import com.accompany.common.device.DeviceInfo;
|
||||
import com.accompany.common.redis.RedisKey;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.base.DeviceInfoContextHolder;
|
||||
import com.accompany.core.base.SpringContextHolder;
|
||||
import com.accompany.core.enumeration.BillObjTypeEnum;
|
||||
import com.accompany.core.enumeration.I18nAlertEnum;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
import com.accompany.core.model.PartitionInfo;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.accompany.core.service.base.BaseService;
|
||||
import com.accompany.core.util.I18NMessageSourceUtil;
|
||||
import com.accompany.core.util.PartitionUtil;
|
||||
import com.accompany.payment.model.UserVipInfo;
|
||||
import com.accompany.payment.service.UserVipInfoService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -44,11 +46,15 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.accompany.common.constant.Constant.VipAuthType.PRIVATE_SHOP_DISCOUNT;
|
||||
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -70,16 +76,53 @@ public class DressShopService extends BaseService {
|
||||
private UserChatBubbleService userChatBubbleService;
|
||||
@Autowired
|
||||
private SendSysMsgService sendSysMsgService;
|
||||
|
||||
@Autowired
|
||||
private PartitionInfoService partitionInfoService;
|
||||
private UserVipInfoService userVipInfoService;
|
||||
|
||||
public List<DressShopVo> getDressShopListByUid(Long uid, Byte dressType) {
|
||||
public List<DressShopVo> getDressShopListByUid(Long uid, Byte dressType, List<Integer> idList) {
|
||||
Users u = usersService.getUsersByUid(uid);
|
||||
if (null == u) {
|
||||
throw new ServiceException(BusiStatus.USERNOTEXISTS);
|
||||
}
|
||||
return getDressShopList(u.getPartitionId(), dressType, null);
|
||||
List<DressShopVo> dressShopList = getDressShopList(u.getPartitionId(), dressType, idList);
|
||||
if (CollectionUtils.isEmpty(dressShopList)) {
|
||||
return dressShopList;
|
||||
}
|
||||
calVipDiscount(uid, dressShopList);
|
||||
return dressShopList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算vip等级折扣
|
||||
* @param uid
|
||||
* @param dressShopList
|
||||
*/
|
||||
private void calVipDiscount(Long uid, List<DressShopVo> dressShopList) {
|
||||
UserVipInfo vipInfo = userVipInfoService.getValidUserVipInfo(uid);
|
||||
Integer vipLevel = 0;
|
||||
BigDecimal discount = BigDecimal.valueOf(1D);
|
||||
Boolean hasDiscount = false;
|
||||
if (vipInfo != null) {
|
||||
vipLevel = vipInfo.getVipLevel();
|
||||
String authItemValue = VipUtil.getVipAuthItemValue(vipLevel, PRIVATE_SHOP_DISCOUNT);
|
||||
if (StringUtils.isNotEmpty(authItemValue)) {
|
||||
discount = new BigDecimal(authItemValue);
|
||||
hasDiscount = true;
|
||||
}
|
||||
}
|
||||
if (!hasDiscount) {
|
||||
List<VipAuthItem> authItems = VipUtil.getItemByAuthType(PRIVATE_SHOP_DISCOUNT);
|
||||
if (CollectionUtils.isNotEmpty(authItems)) {
|
||||
VipAuthItem vipAuthItem = authItems.get(0);
|
||||
vipLevel = vipAuthItem.getVipLevel();
|
||||
discount = new BigDecimal(vipAuthItem.getItemValue());
|
||||
}
|
||||
}
|
||||
for (DressShopVo dressShopVo : dressShopList) {
|
||||
dressShopVo.setVipLevel(vipLevel);
|
||||
dressShopVo.setDiscount(discount.multiply(BigDecimal.valueOf(100)).intValue());
|
||||
dressShopVo.setDiscountPrice(discount.multiply(BigDecimal.valueOf(dressShopVo.getDressPrice()).setScale(2, RoundingMode.HALF_UP)));
|
||||
}
|
||||
}
|
||||
|
||||
public List<DressShopVo> getDressShopList(Byte dressType, List<Integer> idList) {
|
||||
@@ -98,6 +141,8 @@ public class DressShopService extends BaseService {
|
||||
list = dressShopMapper.getDressShopInfoCardList(idList, dressType, partitionId);
|
||||
} else if (DressShopTypeEnum.CHAT_BUBBLE.getDressType().equals(dressType)) {
|
||||
list = dressShopMapper.getDressShopChatBubbleList(idList, dressType, partitionId);
|
||||
} else if (DressShopTypeEnum.PERSON_PAGE.getDressType().equals(dressType)) {
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -111,7 +156,7 @@ public class DressShopService extends BaseService {
|
||||
Byte dressType = dressShop.getDressType();
|
||||
List<Integer> idS = new ArrayList<>();
|
||||
idS.add(dressShop.getId());
|
||||
List<DressShopVo> dressShopList = getDressShopList(dressType, idS);
|
||||
List<DressShopVo> dressShopList = getDressShopListByUid(uid, dressType, idS);
|
||||
if (CollectionUtils.isEmpty(dressShopList)) {
|
||||
throw new ServiceException(BusiStatus.BUSIERROR, "查询不到对应装扮");
|
||||
}
|
||||
@@ -149,23 +194,25 @@ public class DressShopService extends BaseService {
|
||||
try {
|
||||
Byte dressType = dressShopVo.getDressType();
|
||||
DressShopTypeEnum typeEnum;
|
||||
Double discountPrice = dressShopVo.getDiscountPrice().doubleValue();
|
||||
Long price = dressShopVo.getDressPrice();
|
||||
if (DressShopTypeEnum.NAMEPLATE.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.NAMEPLATE;
|
||||
userNameplateService.buyNameplate(uid, null, dressShopVo.getDressId().longValue(), Constant.DressComeFrom.BUY, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
userNameplateService.buyNameplate(uid, null, dressShopVo.getDressId().longValue(), Constant.DressComeFrom.BUY, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else if (DressShopTypeEnum.HEADWEAR.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.HEADWEAR;
|
||||
userHeadwearService.buyHeadwear(uid, null, dressShopVo.getDressId(), deviceInfo, HeadwearConstant.ComeFrom.BUY, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
userHeadwearService.buyHeadwear(uid, null, dressShopVo.getDressId(), deviceInfo, HeadwearConstant.ComeFrom.BUY, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else if (DressShopTypeEnum.CAR.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.CAR;
|
||||
carPayService.buyCarGoodsV2(uid, null, dressShopVo.getDressId(), deviceInfo, Constant.CarComeFrom.BUY, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
carPayService.buyCarGoodsV2(uid, null, dressShopVo.getDressId(), deviceInfo, Constant.CarComeFrom.BUY, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else if (DressShopTypeEnum.INFO_CARD.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.INFO_CARD;
|
||||
userInfoCardService.buyInfoCard(uid, null, dressShopVo.getDressId().longValue(), Constant.UserInfoCardComeFrom.BUY,
|
||||
BillObjTypeEnum.PURCHASE_INFO_CARD.getDesc(), false, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
BillObjTypeEnum.PURCHASE_INFO_CARD.getDesc(), false, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else if (DressShopTypeEnum.CHAT_BUBBLE.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.CHAT_BUBBLE;
|
||||
userChatBubbleService.buyChatBubble(uid, null, dressShopVo.getDressId().longValue(), Constant.UserInfoCardComeFrom.BUY,
|
||||
BillObjTypeEnum.PURCHASE_CHAT_BUBBLE.getDesc(), false, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
BillObjTypeEnum.PURCHASE_CHAT_BUBBLE.getDesc(), false, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else {
|
||||
throw new ServiceException(BusiStatus.DRESS_SHOP_TYPE_NOTEXISTS);
|
||||
}
|
||||
@@ -184,23 +231,25 @@ public class DressShopService extends BaseService {
|
||||
try {
|
||||
Byte dressType = dressShopVo.getDressType();
|
||||
DressShopTypeEnum typeEnum;
|
||||
Long price = dressShopVo.getDressPrice();
|
||||
Double discountPrice = dressShopVo.getDiscountPrice().doubleValue();
|
||||
if (DressShopTypeEnum.NAMEPLATE.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.NAMEPLATE;
|
||||
userNameplateService.buyNameplate(uid, targetUid, dressShopVo.getDressId().longValue(), Constant.DressComeFrom.USER_DONATE, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
userNameplateService.buyNameplate(uid, targetUid, dressShopVo.getDressId().longValue(), Constant.DressComeFrom.USER_DONATE, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else if (DressShopTypeEnum.HEADWEAR.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.HEADWEAR;
|
||||
userHeadwearService.buyHeadwear(uid, targetUid, dressShopVo.getDressId(), deviceInfo, HeadwearConstant.ComeFrom.USER_DONATE, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
userHeadwearService.buyHeadwear(uid, targetUid, dressShopVo.getDressId(), deviceInfo, HeadwearConstant.ComeFrom.USER_DONATE, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else if (DressShopTypeEnum.CAR.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.CAR;
|
||||
carPayService.buyCarGoodsV2(uid, targetUid, dressShopVo.getDressId(), deviceInfo, Constant.CarComeFrom.USER_DONATE, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
carPayService.buyCarGoodsV2(uid, targetUid, dressShopVo.getDressId(), deviceInfo, Constant.CarComeFrom.USER_DONATE, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else if (DressShopTypeEnum.INFO_CARD.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.INFO_CARD;
|
||||
userInfoCardService.buyInfoCard(uid, targetUid, dressShopVo.getDressId().longValue(), Constant.UserInfoCardComeFrom.USER_DONATE,
|
||||
BillObjTypeEnum.GIVE_INFO_CARD.getDesc(), false, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
BillObjTypeEnum.GIVE_INFO_CARD.getDesc(), false, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else if (DressShopTypeEnum.CHAT_BUBBLE.getDressType().equals(dressType)) {
|
||||
typeEnum = DressShopTypeEnum.CHAT_BUBBLE;
|
||||
userChatBubbleService.buyChatBubble(uid, targetUid, dressShopVo.getDressId().longValue(), Constant.UserInfoCardComeFrom.USER_DONATE,
|
||||
BillObjTypeEnum.GIVE_CHAT_BUBBLE.getDesc(), false, dressShopVo.getDressPrice(), dressShopVo.getDressDay());
|
||||
BillObjTypeEnum.GIVE_CHAT_BUBBLE.getDesc(), false, price, discountPrice, dressShopVo.getDressDay());
|
||||
} else {
|
||||
throw new ServiceException(BusiStatus.DRESS_SHOP_TYPE_NOTEXISTS);
|
||||
}
|
||||
|
@@ -141,7 +141,7 @@ public class UserChatBubbleService extends ServiceImpl<UserChatBubbleMapper, Use
|
||||
}
|
||||
try {
|
||||
UserChatBubble bubbleForSend = getByBubbleIdAndUid(uid, bubbleId);
|
||||
sendUserChatBubble(uid, null, bubbleId, comeFrom, expireTime, desc, needSendMsg, null, bubbleForSend);
|
||||
sendUserChatBubble(uid, null, bubbleId, comeFrom, expireTime, desc, needSendMsg, null, 0D, bubbleForSend);
|
||||
} catch (Exception e) {
|
||||
log.error("赠送用户资料卡出现异常。uid :" + uid + ", bubbleId : " + bubbleId, e);
|
||||
throw e;
|
||||
@@ -166,7 +166,7 @@ public class UserChatBubbleService extends ServiceImpl<UserChatBubbleMapper, Use
|
||||
}
|
||||
try {
|
||||
UserChatBubble bubbleForSend = getByBubbleIdAndUid(uid, bubbleId);
|
||||
sendUserChatBubble(uid, null, bubbleId, comeFrom, day, desc, needSendMsg, null, bubbleForSend);
|
||||
sendUserChatBubble(uid, null, bubbleId, comeFrom, day, desc, needSendMsg, null, null, bubbleForSend);
|
||||
} catch (Exception e) {
|
||||
log.error("赠送用户资料卡出现异常。uid :" + uid + ", bubbleId : " + bubbleId, e);
|
||||
throw e;
|
||||
@@ -175,11 +175,11 @@ public class UserChatBubbleService extends ServiceImpl<UserChatBubbleMapper, Use
|
||||
}
|
||||
}
|
||||
|
||||
private void saveRecord(Long uid, Long bubbleId, Byte comeFrom, Integer days, String desc, Date sendTime, Long targetUid, Long price) {
|
||||
private void saveRecord(Long uid, Long bubbleId, Byte comeFrom, Integer days, String desc, Date sendTime, Long targetUid, Long price, Double discountPrice) {
|
||||
UserChatBubbleRecord record = UserChatBubbleRecord.builder()
|
||||
.uid(uid).bubbleId(bubbleId).days(days).comeFrom(comeFrom)
|
||||
.remark(desc).status(Constant.status.valid).createTime(sendTime)
|
||||
.giverUid(targetUid).price(price)
|
||||
.giverUid(targetUid).price(price).discountPrice(discountPrice)
|
||||
.build();
|
||||
userChatBubbleRecordMapper.insert(record);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public class UserChatBubbleService extends ServiceImpl<UserChatBubbleMapper, Use
|
||||
* @param needSendMsg
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class, transactionManager = "mybatisplusTransactionManager")
|
||||
public void buyChatBubble(Long uid, Long targetUid, Long bubbleId, Byte comeFrom, String desc, Boolean needSendMsg, Long price, Integer addDay) {
|
||||
public void buyChatBubble(Long uid, Long targetUid, Long bubbleId, Byte comeFrom, String desc, Boolean needSendMsg, Long price, Double discountPrice, Integer addDay) {
|
||||
String cacheName = RedisKey.buy_chat_bubble_lock.getKey(uid.toString());
|
||||
String lockVal = jedisLockService.lock(cacheName, 3000);
|
||||
if (StringUtils.isEmpty(lockVal)) {
|
||||
@@ -242,19 +242,19 @@ public class UserChatBubbleService extends ServiceImpl<UserChatBubbleMapper, Use
|
||||
if (Constant.UserInfoCardComeFrom.USER_DONATE.equals(comeFrom) || Constant.UserInfoCardComeFrom.BUY.equals(comeFrom)) {
|
||||
BillObjTypeEnum billObjTypeEnum = Constant.UserInfoCardComeFrom.BUY.equals(comeFrom) ? BillObjTypeEnum.PURCHASE_CHAT_BUBBLE : BillObjTypeEnum.GIVE_CHAT_BUBBLE;
|
||||
// 扣除用户金币
|
||||
this.userPurseService.subDiamond(uid, price.doubleValue(), billObjTypeEnum.getDesc());
|
||||
this.userPurseService.subDiamond(uid, discountPrice, billObjTypeEnum.getDesc());
|
||||
// 通知客户端修改钱包数据
|
||||
UserPurse userPurse = userPurseService.queryUserPurse(uid);
|
||||
userPurseService.sendSysMsgByModifyGold(userPurse);
|
||||
// 插入账单
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, Double.valueOf(price));
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, discountPrice);
|
||||
applicationContext.publishEvent(new ActivityOfDayConsumeEvent(ActivityOfDayConsumeMessage.builder()
|
||||
.sendUid(uid)
|
||||
.messTime(new Date())
|
||||
.totalDiamondNum(Double.valueOf(price)).consumeType("buyInfoCard").build()));
|
||||
.totalDiamondNum(discountPrice).consumeType("buyInfoCard").build()));
|
||||
}
|
||||
|
||||
sendUserChatBubble(uid, targetUid, bubbleId, comeFrom, expireTime, desc, needSendMsg, price, bubbleForSend);
|
||||
sendUserChatBubble(uid, targetUid, bubbleId, comeFrom, expireTime, desc, needSendMsg, price, discountPrice, bubbleForSend);
|
||||
} catch (Exception e) {
|
||||
log.error("赠送用户资料卡出现异常。uid :" + uid + ", bubbleId : " + bubbleId, e);
|
||||
throw e;
|
||||
@@ -264,7 +264,7 @@ public class UserChatBubbleService extends ServiceImpl<UserChatBubbleMapper, Use
|
||||
}
|
||||
|
||||
|
||||
private void sendUserChatBubble(Long uid, Long targetUid, Long bubbleId, Byte comeFrom, Date expireTime, String desc, Boolean needSendMsg, Long price, UserChatBubble userChatBubble) {
|
||||
private void sendUserChatBubble(Long uid, Long targetUid, Long bubbleId, Byte comeFrom, Date expireTime, String desc, Boolean needSendMsg, Long price, Double discountPrice, UserChatBubble userChatBubble) {
|
||||
ChatBubble chatBubbleById = chatBubbleService.getChatBubbleById(bubbleId);
|
||||
Date now = new Date();
|
||||
if (null == chatBubbleById) {
|
||||
@@ -309,9 +309,9 @@ public class UserChatBubbleService extends ServiceImpl<UserChatBubbleMapper, Use
|
||||
// 增加记录
|
||||
int days = DateTimeUtil.diffDayByDateV2(startTime, expireTime);
|
||||
if (Constant.UserInfoCardComeFrom.USER_DONATE.equals(comeFrom)) {
|
||||
saveRecord(targetUid, bubbleId, comeFrom, days, desc, now, targetUid, price);
|
||||
saveRecord(targetUid, bubbleId, comeFrom, days, desc, now, targetUid, price, discountPrice);
|
||||
} else {
|
||||
saveRecord(uid, bubbleId, comeFrom, days, desc, now, targetUid, price);
|
||||
saveRecord(uid, bubbleId, comeFrom, days, desc, now, targetUid, price, discountPrice);
|
||||
}
|
||||
if (needSendMsg) {
|
||||
String chatBubbleName = chatBubbleById.getName();
|
||||
@@ -322,7 +322,7 @@ public class UserChatBubbleService extends ServiceImpl<UserChatBubbleMapper, Use
|
||||
}
|
||||
}
|
||||
|
||||
private void sendUserChatBubble(Long uid, Long targetUid, Long bubbleId, Byte comeFrom, Integer days, String desc, Boolean needSendMsg, Long price, UserChatBubble userChatBubble) {
|
||||
private void sendUserChatBubble(Long uid, Long targetUid, Long bubbleId, Byte comeFrom, Integer days, String desc, Boolean needSendMsg, Long price, Double discountPrice, UserChatBubble userChatBubble) {
|
||||
ChatBubble chatBubbleById = chatBubbleService.getChatBubbleById(bubbleId);
|
||||
Date now = new Date();
|
||||
if (null == chatBubbleById) {
|
||||
@@ -368,9 +368,9 @@ public class UserChatBubbleService extends ServiceImpl<UserChatBubbleMapper, Use
|
||||
}
|
||||
|
||||
if (Constant.UserInfoCardComeFrom.USER_DONATE.equals(comeFrom)) {
|
||||
saveRecord(targetUid, bubbleId, comeFrom, days, desc, now, targetUid, price);
|
||||
saveRecord(targetUid, bubbleId, comeFrom, days, desc, now, targetUid, price, discountPrice);
|
||||
} else {
|
||||
saveRecord(uid, bubbleId, comeFrom, days, desc, now, targetUid, price);
|
||||
saveRecord(uid, bubbleId, comeFrom, days, desc, now, targetUid, price, discountPrice);
|
||||
}
|
||||
|
||||
if (needSendMsg) {
|
||||
|
@@ -44,7 +44,7 @@ public class UserHeadwearService extends BaseService {
|
||||
* 购买头饰,传入价值和增加天数以传入值 为主
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public UserHeadwear buyHeadwear(Long uid, Long targetUid, Integer headwearId, DeviceInfo deviceInfo, Byte comeFrom, Long price, Integer addDay) {
|
||||
public UserHeadwear buyHeadwear(Long uid, Long targetUid, Integer headwearId, DeviceInfo deviceInfo, Byte comeFrom, Long price, Double discountPrice, Integer addDay) {
|
||||
String lockVal = null;
|
||||
try {
|
||||
lockVal = jedisLockService.lock(RedisKey.buy_headwear_lock.getKey(uid.toString()), 10 * 1000, 12 * 1000);
|
||||
@@ -71,7 +71,7 @@ public class UserHeadwearService extends BaseService {
|
||||
Byte optType = userHeadwear != null ? Constant.CarOptType.purchase : Constant.CarOptType.renew;
|
||||
|
||||
// 扣除用户金币
|
||||
userPurseService.subDiamond(uid, price.doubleValue(), billObjTypeEnum.getDesc());
|
||||
userPurseService.subDiamond(uid, discountPrice, billObjTypeEnum.getDesc());
|
||||
// 通知客户端修改钱包数据
|
||||
UserPurse userPurse = userPurseService.queryUserPurse(uid);
|
||||
userPurseService.sendSysMsgByModifyGold(userPurse);
|
||||
@@ -103,17 +103,17 @@ public class UserHeadwearService extends BaseService {
|
||||
|
||||
//头饰记录
|
||||
if(HeadwearConstant.ComeFrom.BUY.equals(comeFrom)){
|
||||
headwearService.insertHeadwearRecord(uid, headwear, price, optType, deviceInfo, addDay,null, comeFrom, Constant.WalletCurrencyType.gold);
|
||||
headwearService.insertHeadwearRecord(uid, headwear, price, discountPrice, optType, deviceInfo, addDay,null, comeFrom, Constant.WalletCurrencyType.gold);
|
||||
}else {
|
||||
headwearService.insertHeadwearRecord(targetUid, headwear, price, optType, deviceInfo, addDay, uid, comeFrom, Constant.WalletCurrencyType.gold);
|
||||
headwearService.insertHeadwearRecord(targetUid, headwear, price, discountPrice, optType, deviceInfo, addDay, uid, comeFrom, Constant.WalletCurrencyType.gold);
|
||||
}
|
||||
|
||||
// 插入账单
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, Double.valueOf(price));
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, discountPrice);
|
||||
applicationContext.publishEvent(new ActivityOfDayConsumeEvent(ActivityOfDayConsumeMessage.builder()
|
||||
.sendUid(uid)
|
||||
.messTime(new Date())
|
||||
.totalDiamondNum(Double.valueOf(price)).consumeType("buyHeadwear").build()));
|
||||
.totalDiamondNum(discountPrice).consumeType("buyHeadwear").build()));
|
||||
return userHeadwear;
|
||||
} catch (Exception e) {
|
||||
logger.error("buyCarGoodsV2 error: uid = {},targetUid = {},headwearId = {},e={}",
|
||||
|
@@ -143,7 +143,7 @@ public class UserInfoCardService extends ServiceImpl<UserInfoCardMapper, UserInf
|
||||
}
|
||||
try {
|
||||
UserInfoCard cardForSend = getByUidAndCardId(uid, cardId);
|
||||
sendUserInfoCard(uid,null,cardId, comeFrom, expireTime, desc, needSendMsg,null, cardForSend);
|
||||
sendUserInfoCard(uid,null,cardId, comeFrom, expireTime, desc, needSendMsg,null, 0D, cardForSend);
|
||||
} catch (Exception e) {
|
||||
log.error("赠送用户资料卡出现异常。uid :" + uid + ", cardId : " + cardId, e);
|
||||
throw e;
|
||||
@@ -186,11 +186,11 @@ public class UserInfoCardService extends ServiceImpl<UserInfoCardMapper, UserInf
|
||||
* @param desc
|
||||
* @param sendTime
|
||||
*/
|
||||
private void saveRecord(Long uid, Long cardId, Byte comeFrom, Integer days, String desc, Date sendTime,Long giverUid, Long price) {
|
||||
private void saveRecord(Long uid, Long cardId, Byte comeFrom, Integer days, String desc, Date sendTime,Long giverUid, Long price, Double discountPrice) {
|
||||
UserInfoCardRecord record = UserInfoCardRecord.builder()
|
||||
.uid(uid).cardId(cardId).days(days).comeFrom(comeFrom)
|
||||
.remake(desc).status(Constant.status.valid).createTime(sendTime).updateTime(sendTime)
|
||||
.giverUid(giverUid).price(price)
|
||||
.giverUid(giverUid).price(price).discountPrice(discountPrice)
|
||||
.build();
|
||||
userInfoCardRecordMapper.insert(record);
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public class UserInfoCardService extends ServiceImpl<UserInfoCardMapper, UserInf
|
||||
* @param needSendMsg
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class, transactionManager = "mybatisplusTransactionManager")
|
||||
public void buyInfoCard(Long uid, Long targetUid, Long cardId, Byte comeFrom, String desc, Boolean needSendMsg, Long price, Integer addDay) {
|
||||
public void buyInfoCard(Long uid, Long targetUid, Long cardId, Byte comeFrom, String desc, Boolean needSendMsg, Long price, Double discountPrice, Integer addDay) {
|
||||
String cacheName = RedisKey.buy_info_card_lock.getKey(uid.toString());
|
||||
String lockVal = jedisLockService.lock(cacheName, 3000);
|
||||
if (com.accompany.common.utils.StringUtils.isEmpty(lockVal)) {
|
||||
@@ -261,20 +261,20 @@ public class UserInfoCardService extends ServiceImpl<UserInfoCardMapper, UserInf
|
||||
if(Constant.UserInfoCardComeFrom.BUY.equals(comeFrom) || Constant.UserInfoCardComeFrom.USER_DONATE.equals(comeFrom)){
|
||||
BillObjTypeEnum billObjTypeEnum = Constant.UserInfoCardComeFrom.BUY.equals(comeFrom) ? BillObjTypeEnum.PURCHASE_INFO_CARD : BillObjTypeEnum.GIVE_INFO_CARD;
|
||||
// 扣除用户金币
|
||||
this.userPurseService.subDiamond(uid, price.doubleValue(), billObjTypeEnum.getDesc());
|
||||
this.userPurseService.subDiamond(uid, discountPrice, billObjTypeEnum.getDesc());
|
||||
// 通知客户端修改钱包数据
|
||||
UserPurse userPurse = userPurseService.queryUserPurse(uid);
|
||||
userPurseService.sendSysMsgByModifyGold(userPurse);
|
||||
// 插入账单
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, Double.valueOf(price));
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, discountPrice);
|
||||
applicationContext.publishEvent(new ActivityOfDayConsumeEvent(ActivityOfDayConsumeMessage.builder()
|
||||
.sendUid(uid)
|
||||
.messTime(new Date())
|
||||
.totalDiamondNum(Double.valueOf(price)).consumeType("buyInfoCard").build()));
|
||||
.totalDiamondNum(discountPrice).consumeType("buyInfoCard").build()));
|
||||
}
|
||||
|
||||
// 发送装扮、保存记录
|
||||
sendUserInfoCard(uid, targetUid,cardId, comeFrom, expireTime, desc, needSendMsg, price,cardForSend);
|
||||
sendUserInfoCard(uid, targetUid,cardId, comeFrom, expireTime, desc, needSendMsg, price, discountPrice,cardForSend);
|
||||
} catch (Exception e) {
|
||||
log.error("赠送用户资料卡出现异常。uid :" + uid + ", cardId : " + cardId, e);
|
||||
throw e;
|
||||
@@ -284,7 +284,7 @@ public class UserInfoCardService extends ServiceImpl<UserInfoCardMapper, UserInf
|
||||
}
|
||||
|
||||
|
||||
private void sendUserInfoCard(Long uid, Long targetUid,Long cardId, Byte comeFrom, Date expireTime, String desc, Boolean needSendMsg, Long price, UserInfoCard userInfoCard){
|
||||
private void sendUserInfoCard(Long uid, Long targetUid,Long cardId, Byte comeFrom, Date expireTime, String desc, Boolean needSendMsg, Long price, Double discountPrice, UserInfoCard userInfoCard){
|
||||
InfoCard infoCard = infoCardMapper.selectById(cardId);
|
||||
Date now = new Date();
|
||||
if (null == infoCard) {
|
||||
@@ -329,9 +329,9 @@ public class UserInfoCardService extends ServiceImpl<UserInfoCardMapper, UserInf
|
||||
// 增加记录
|
||||
int days = DateTimeUtil.diffDayByDateV2(startTime, expireTime);
|
||||
if(Constant.UserInfoCardComeFrom.USER_DONATE.equals(comeFrom)){
|
||||
saveRecord(targetUid, cardId, comeFrom, days, desc, now, uid, price);
|
||||
saveRecord(targetUid, cardId, comeFrom, days, desc, now, uid, price, discountPrice);
|
||||
}else{
|
||||
saveRecord(uid, cardId, comeFrom, days, desc, now,null, price);
|
||||
saveRecord(uid, cardId, comeFrom, days, desc, now,null, price, discountPrice);
|
||||
}
|
||||
if (needSendMsg) {
|
||||
String infoCardName = infoCard.getName();
|
||||
@@ -390,9 +390,9 @@ public class UserInfoCardService extends ServiceImpl<UserInfoCardMapper, UserInf
|
||||
}
|
||||
|
||||
if(Constant.UserInfoCardComeFrom.USER_DONATE.equals(comeFrom)){
|
||||
saveRecord(targetUid, cardId, comeFrom, days, desc, now, uid, price);
|
||||
saveRecord(targetUid, cardId, comeFrom, days, desc, now, uid, price, 0D);
|
||||
}else{
|
||||
saveRecord(uid, cardId, comeFrom, days, desc, now,null, price);
|
||||
saveRecord(uid, cardId, comeFrom, days, desc, now,null, price, 0D);
|
||||
}
|
||||
|
||||
if (needSendMsg) {
|
||||
|
@@ -582,7 +582,7 @@ public class HeadwearService extends BaseService {
|
||||
}
|
||||
int days = DateTimeUtil.diffDayByDateV2(startTime, expireTime);
|
||||
//头饰记录
|
||||
this.insertHeadwearRecord(uid, headwear, price, optType, null, days, null, HeadwearConstant.ComeFrom.OFFICIAL_DONATE, currencyType);
|
||||
this.insertHeadwearRecord(uid, headwear, price, 0D, optType, null, days, null, HeadwearConstant.ComeFrom.OFFICIAL_DONATE, currencyType);
|
||||
} catch (Exception e) {
|
||||
log.error("赠送用户头饰出现异常。uid :" + uid + ", headwearId : " + headwearId, e);
|
||||
} finally {
|
||||
@@ -680,7 +680,7 @@ public class HeadwearService extends BaseService {
|
||||
* @param optType
|
||||
* @param deviceInfo
|
||||
*/
|
||||
public Long insertHeadwearRecord(Long uid, Headwear headwear, Long price, Byte optType, DeviceInfo deviceInfo, Integer days,
|
||||
public Long insertHeadwearRecord(Long uid, Headwear headwear, Long price, Double discountPrice, Byte optType, DeviceInfo deviceInfo, Integer days,
|
||||
Long giverUid, Byte comeFrom, Byte currencyType) {
|
||||
HeadwearRecord record = new HeadwearRecord();
|
||||
record.setUid(uid);
|
||||
@@ -695,6 +695,7 @@ public class HeadwearService extends BaseService {
|
||||
}
|
||||
record.setOptType(optType);
|
||||
record.setPrice(price);
|
||||
record.setDiscountPrice(discountPrice);
|
||||
record.setCreateTime(Calendar.getInstance().getTime());
|
||||
record.setDays(days);
|
||||
record.setCurrencyType(currencyType);
|
||||
|
@@ -804,7 +804,7 @@ public class UserNameplateService extends BaseService {
|
||||
* 购买头饰,传入价值和增加天数以传入值 为主
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void buyNameplate(Long uid, Long targetUid, Long nameplateId, Byte comeFrom, Long price, Integer addDay) {
|
||||
public void buyNameplate(Long uid, Long targetUid, Long nameplateId, Byte comeFrom, Long price, Double discountPrice, Integer addDay) {
|
||||
String lockVal = null;
|
||||
try {
|
||||
lockVal = jedisLockService.lock(RedisKey.buy_nameplate_lock.getKey(uid.toString()), 10 * 1000, 12 * 1000);
|
||||
@@ -826,7 +826,7 @@ public class UserNameplateService extends BaseService {
|
||||
billObjTypeEnum = BillObjTypeEnum.GIVE_NAMEPLATE;
|
||||
}
|
||||
// 扣除用户金币
|
||||
this.userPurseService.subDiamond(uid, price.doubleValue(), billObjTypeEnum.getDesc());
|
||||
this.userPurseService.subDiamond(uid, discountPrice, billObjTypeEnum.getDesc());
|
||||
// 通知客户端修改钱包数据
|
||||
UserPurse userPurse = userPurseService.queryUserPurse(uid);
|
||||
userPurseService.sendSysMsgByModifyGold(userPurse);
|
||||
@@ -847,15 +847,16 @@ public class UserNameplateService extends BaseService {
|
||||
nameplateRecord.setCreateTime(new Date());
|
||||
nameplateRecord.setDays(addDay);
|
||||
nameplateRecord.setPrice(price);
|
||||
nameplateRecord.setDiscountPrice(discountPrice);
|
||||
nameplateRecord.setComeFrom(comeFrom);
|
||||
nameplateRecordMapper.insert(nameplateRecord);
|
||||
|
||||
// 插入账单
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, Double.valueOf(price));
|
||||
billRecordService.insertGeneralBillRecord(uid, targetUid, null, billObjTypeEnum, discountPrice);
|
||||
applicationContext.publishEvent(new ActivityOfDayConsumeEvent(ActivityOfDayConsumeMessage.builder()
|
||||
.sendUid(uid)
|
||||
.messTime(new Date())
|
||||
.totalDiamondNum(Double.valueOf(price)).consumeType("buyNameplate").build()));
|
||||
.totalDiamondNum(discountPrice).consumeType("buyNameplate").build()));
|
||||
} catch (Exception e) {
|
||||
logger.error("buyCarGoodsV2 error: uid = {},targetUid = {},nameplateId = {},e={}",
|
||||
uid, targetUid, nameplateId, e.getMessage());
|
||||
|
@@ -105,7 +105,6 @@ public class VipTaskService {
|
||||
if (vipInfo == null) {
|
||||
throw new ServiceException(BusiStatus.SERVERBUSY, "贵族信息不存在");
|
||||
}
|
||||
// 降级或者撤销
|
||||
vipLevelBizService.doCancelVip(userVipInfo);
|
||||
}
|
||||
|
||||
|
@@ -326,4 +326,8 @@ public class VipUtil {
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static List<VipAuthItem> getItemByAuthType(Byte authType) {
|
||||
return SpringContextHolder.getBean(VipAuthItemMapper.class).listValidItemByAuthType(authType);
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@
|
||||
<result column="car_id" property="carId" jdbcType="INTEGER" />
|
||||
<result column="car_name" property="carName" jdbcType="VARCHAR" />
|
||||
<result column="price" property="price" jdbcType="BIGINT" />
|
||||
<result column="discount_price" property="discountPrice" jdbcType="DOUBLE" />
|
||||
<result column="opt_type" property="optType" jdbcType="TINYINT" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="os" property="os" jdbcType="VARCHAR" />
|
||||
@@ -78,7 +79,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List" >
|
||||
record_id, uid, car_id, car_name, price, opt_type, create_time, os, osVersion, model,
|
||||
record_id, uid, car_id, car_name, price, discount_price, opt_type, create_time, os, osVersion, model,
|
||||
app_version, obj_src, days, giver_uid, currency_type, come_from
|
||||
</sql>
|
||||
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.accompany.business.model.CarRecordExample" >
|
||||
@@ -122,13 +123,13 @@
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.accompany.business.model.CarRecord" useGeneratedKeys="true" keyProperty="recordId" >
|
||||
insert into car_record (uid, car_id, car_name,
|
||||
price, opt_type, create_time,
|
||||
price, discount_price, opt_type, create_time,
|
||||
os, osVersion, model,
|
||||
app_version, obj_src, days,
|
||||
giver_uid, currency_type, come_from
|
||||
)
|
||||
values (#{uid,jdbcType=BIGINT}, #{carId,jdbcType=INTEGER}, #{carName,jdbcType=VARCHAR},
|
||||
#{price,jdbcType=BIGINT}, #{optType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{price,jdbcType=BIGINT},#{discountPrice,jdbcType=DOUBLE}, #{optType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{os,jdbcType=VARCHAR}, #{osversion,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR},
|
||||
#{appVersion,jdbcType=VARCHAR}, #{objSrc,jdbcType=VARCHAR}, #{days,jdbcType=INTEGER},
|
||||
#{giverUid,jdbcType=BIGINT}, #{currencyType,jdbcType=TINYINT}, #{comeFrom,jdbcType=TINYINT}
|
||||
@@ -149,6 +150,9 @@
|
||||
<if test="price != null" >
|
||||
price,
|
||||
</if>
|
||||
<if test="discountPrice != null" >
|
||||
discount_price,
|
||||
</if>
|
||||
<if test="optType != null" >
|
||||
opt_type,
|
||||
</if>
|
||||
@@ -196,6 +200,9 @@
|
||||
<if test="price != null" >
|
||||
#{price,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="discountPrice != null" >
|
||||
#{discountPrice,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="optType != null" >
|
||||
#{optType,jdbcType=TINYINT},
|
||||
</if>
|
||||
@@ -255,6 +262,9 @@
|
||||
<if test="record.price != null" >
|
||||
price = #{record.price,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.discountPrice != null" >
|
||||
discount_price = #{record.discountPrice,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="record.optType != null" >
|
||||
opt_type = #{record.optType,jdbcType=TINYINT},
|
||||
</if>
|
||||
@@ -300,6 +310,7 @@
|
||||
car_id = #{record.carId,jdbcType=INTEGER},
|
||||
car_name = #{record.carName,jdbcType=VARCHAR},
|
||||
price = #{record.price,jdbcType=BIGINT},
|
||||
discount_price = #{record.discountPrice,jdbcType=DOUBLE},
|
||||
opt_type = #{record.optType,jdbcType=TINYINT},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
os = #{record.os,jdbcType=VARCHAR},
|
||||
@@ -330,6 +341,9 @@
|
||||
<if test="price != null" >
|
||||
price = #{price,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="price != null" >
|
||||
discount_price = #{discountPrice,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="optType != null" >
|
||||
opt_type = #{optType,jdbcType=TINYINT},
|
||||
</if>
|
||||
@@ -372,6 +386,7 @@
|
||||
car_id = #{carId,jdbcType=INTEGER},
|
||||
car_name = #{carName,jdbcType=VARCHAR},
|
||||
price = #{price,jdbcType=BIGINT},
|
||||
discount_price = #{discountPrice,jdbcType=DOUBLE},
|
||||
opt_type = #{optType,jdbcType=TINYINT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
os = #{os,jdbcType=VARCHAR},
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<mapper namespace="com.accompany.business.mybatismapper.dress.DressShopMapper">
|
||||
|
||||
<select id="getDressShopNameplateList" resultType="com.accompany.business.vo.dress.DressShopVo">
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,na.icon_pic as 'pic',na.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way,na.partition_flag
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,na.icon_pic as 'pic',na.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way, ds.vip_limit,na.partition_flag
|
||||
FROM dress_shop ds,nameplate na
|
||||
where ds.dress_id = na.id and na.`status` = 1 and ds.dress_type = #{dressType}
|
||||
<if test="idList != null and idList.size() > 0">
|
||||
@@ -19,7 +19,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getDressShopHeadwearList" resultType="com.accompany.business.vo.dress.DressShopVo">
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,hd.pic,hd.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way,hd.partition_flag
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,hd.pic,hd.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way, ds.vip_limit,hd.partition_flag,hd.effect effect
|
||||
FROM dress_shop ds,headwear hd
|
||||
where ds.dress_id = hd.headwear_id and hd.noble_limit = 0 and hd.`enable` =1 and ds.dress_type = #{dressType}
|
||||
<if test="idList != null and idList.size() > 0">
|
||||
@@ -35,7 +35,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getDressShopCarGoodsList" resultType="com.accompany.business.vo.dress.DressShopVo">
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,cg.pic,cg.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way,cg.partition_flag
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,cg.pic,cg.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way, ds.vip_limit,cg.partition_flag,cg.effect effect
|
||||
FROM dress_shop ds,car_goods cg
|
||||
where ds.dress_id = cg.id and cg.`enable` = 2 and cg.car_goods_type = 1 and ds.dress_type = #{dressType}
|
||||
and cg.is_activity_limit = 0 and cg.is_noble_limit = 0 and cg.is_monster_limit = 0 and cg.is_week_star_limit = 0
|
||||
@@ -52,7 +52,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getDressShopInfoCardList" resultType="com.accompany.business.vo.dress.DressShopVo">
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,ic.pic,ic.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way,ic.partition_flag
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,ic.pic,ic.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way, ds.vip_limit,ic.partition_flag
|
||||
FROM dress_shop ds,info_card ic
|
||||
where ds.dress_id = ic.id and ic.`status` = 1 and ic.type = 1 and ds.dress_type = #{dressType}
|
||||
<if test="idList != null and idList.size() > 0">
|
||||
@@ -68,7 +68,7 @@
|
||||
</select>
|
||||
|
||||
<select id="getDressShopChatBubbleList" resultType="com.accompany.business.vo.dress.DressShopVo">
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,cb.ios_url as 'pic',cb.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way,cb.partition_flag
|
||||
SELECT ds.id,ds.dress_id,ds.dress_price,ds.dress_day,ds.dress_type,cb.ios_url as 'pic',cb.name,ds.dress_seq,ds.dress_limit_status, ds.obtain_way, ds.vip_limit,cb.partition_flag
|
||||
FROM dress_shop ds,chat_bubble cb
|
||||
where ds.dress_id = cb.id and cb.`status` = 1 and cb.type = 1 and ds.dress_type = #{dressType}
|
||||
<if test="idList != null and idList.size() > 0">
|
||||
|
@@ -7,6 +7,7 @@
|
||||
<result column="headwear_id" property="headwearId" jdbcType="INTEGER" />
|
||||
<result column="headwear_name" property="headwearName" jdbcType="VARCHAR" />
|
||||
<result column="price" property="price" jdbcType="BIGINT" />
|
||||
<result column="discount_price" property="discountPrice" jdbcType="DOUBLE" />
|
||||
<result column="opt_type" property="optType" jdbcType="TINYINT" />
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
||||
<result column="os" property="os" jdbcType="VARCHAR" />
|
||||
@@ -78,7 +79,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List" >
|
||||
record_id, uid, headwear_id, headwear_name, price, opt_type, create_time, os, os_version,
|
||||
record_id, uid, headwear_id, headwear_name, price,discount_price, opt_type, create_time, os, os_version,
|
||||
phone_model, app_version, channel, days, giver_uid, currency_type, come_from
|
||||
</sql>
|
||||
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.accompany.business.model.HeadwearRecordExample" >
|
||||
@@ -122,13 +123,13 @@
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.accompany.business.model.HeadwearRecord" useGeneratedKeys="true" keyProperty="recordId" >
|
||||
insert into headwear_record (uid, headwear_id, headwear_name,
|
||||
price, opt_type, create_time,
|
||||
price, discount_price, opt_type, create_time,
|
||||
os, os_version, phone_model,
|
||||
app_version, channel, days,
|
||||
giver_uid, currency_type, come_from
|
||||
)
|
||||
values (#{uid,jdbcType=BIGINT}, #{headwearId,jdbcType=INTEGER}, #{headwearName,jdbcType=VARCHAR},
|
||||
#{price,jdbcType=BIGINT}, #{optType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{price,jdbcType=BIGINT},#{discountPrice,jdbcType=DOUBLE}, #{optType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{os,jdbcType=VARCHAR}, #{osVersion,jdbcType=VARCHAR}, #{phoneModel,jdbcType=VARCHAR},
|
||||
#{appVersion,jdbcType=VARCHAR}, #{channel,jdbcType=VARCHAR}, #{days,jdbcType=INTEGER},
|
||||
#{giverUid,jdbcType=BIGINT}, #{currencyType,jdbcType=TINYINT}, #{comeFrom,jdbcType=TINYINT}
|
||||
@@ -149,6 +150,9 @@
|
||||
<if test="price != null" >
|
||||
price,
|
||||
</if>
|
||||
<if test="discountPrice != null" >
|
||||
discount_price,
|
||||
</if>
|
||||
<if test="optType != null" >
|
||||
opt_type,
|
||||
</if>
|
||||
@@ -196,6 +200,9 @@
|
||||
<if test="price != null" >
|
||||
#{price,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="discountPrice != null" >
|
||||
#{discountPrice,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="optType != null" >
|
||||
#{optType,jdbcType=TINYINT},
|
||||
</if>
|
||||
@@ -255,6 +262,9 @@
|
||||
<if test="record.price != null" >
|
||||
price = #{record.price,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.discountPrice != null" >
|
||||
discount_price = #{record.discountPrice,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="record.optType != null" >
|
||||
opt_type = #{record.optType,jdbcType=TINYINT},
|
||||
</if>
|
||||
@@ -300,6 +310,7 @@
|
||||
headwear_id = #{record.headwearId,jdbcType=INTEGER},
|
||||
headwear_name = #{record.headwearName,jdbcType=VARCHAR},
|
||||
price = #{record.price,jdbcType=BIGINT},
|
||||
discount_price = #{record.discountPrice,jdbcType=DOUBLE},
|
||||
opt_type = #{record.optType,jdbcType=TINYINT},
|
||||
create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
||||
os = #{record.os,jdbcType=VARCHAR},
|
||||
@@ -330,6 +341,9 @@
|
||||
<if test="price != null" >
|
||||
price = #{price,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="price != null" >
|
||||
discount_price = #{discountPrice,jdbcType=DOUBLE},
|
||||
</if>
|
||||
<if test="optType != null" >
|
||||
opt_type = #{optType,jdbcType=TINYINT},
|
||||
</if>
|
||||
@@ -372,6 +386,7 @@
|
||||
headwear_id = #{headwearId,jdbcType=INTEGER},
|
||||
headwear_name = #{headwearName,jdbcType=VARCHAR},
|
||||
price = #{price,jdbcType=BIGINT},
|
||||
discount_price = #{discountPrice,jdbcType=DOUBLE},
|
||||
opt_type = #{optType,jdbcType=TINYINT},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
os = #{os,jdbcType=VARCHAR},
|
||||
|
@@ -16,4 +16,13 @@
|
||||
and va.auth_type = vi.auth_type
|
||||
and va.vip_level = #{vipLevel}
|
||||
</select>
|
||||
|
||||
<select id="listValidItemByAuthType" resultType="com.accompany.business.model.vip.VipAuthItem">
|
||||
select vi.* from vip_ref_auth va , vip_auth_item vi
|
||||
where va.vip_level = vi.vip_level
|
||||
and vi.status = 1 and va.status = 1
|
||||
and va.auth_type = vi.auth_type
|
||||
and va.auth_type = #{authType}
|
||||
order by va.vip_level asc
|
||||
</select>
|
||||
</mapper>
|
@@ -1,77 +1,77 @@
|
||||
package com.accompany.business.controller.car;
|
||||
|
||||
import com.accompany.business.common.BaseController;
|
||||
import com.accompany.business.model.CarCarport;
|
||||
import com.accompany.business.service.car.CarPayService;
|
||||
import com.accompany.common.annotation.Authorization;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.device.DeviceInfo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* Created by yuanyi on 2018/2/28.
|
||||
*
|
||||
* @desc 座驾开通与续费
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/car/pay")
|
||||
public class CarPayController extends BaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(CarPayController.class);
|
||||
|
||||
@Autowired
|
||||
private CarPayService carPayService;
|
||||
|
||||
/**
|
||||
* 座驾的赠送
|
||||
*
|
||||
* @param uid
|
||||
* @param targetUid
|
||||
* @param carId
|
||||
* @param deviceInfo
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("giveByGold")
|
||||
@ResponseBody
|
||||
@Authorization
|
||||
public BusiResult giveCarByGold(Long uid, Long targetUid, Integer carId, DeviceInfo deviceInfo) throws Exception {
|
||||
logger.info("v1 giveCarByGold param is: uid={},targetUid={},carId={}", uid, targetUid, carId);
|
||||
if (uid == null || carId == null || targetUid == null || deviceInfo == null) {
|
||||
return new BusiResult(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
CarCarport carCarport = carPayService.buyCarGoods(uid, targetUid, carId, deviceInfo, Constant.WalletCurrencyType.gold,
|
||||
Constant.CarComeFrom.USER_DONATE);
|
||||
return new BusiResult(carCarport);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 座驾的开通
|
||||
*
|
||||
* @param uid
|
||||
* @param carId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("byGold")
|
||||
@ResponseBody
|
||||
@Authorization
|
||||
public BusiResult carPurchaseByGold(HttpServletRequest request, Long uid, Integer carId, DeviceInfo deviceInfo) throws Exception {
|
||||
logger.info("v1 carPurchaseByGold param is: uid={},carId={}", uid, carId);
|
||||
|
||||
if (uid == null || carId == null || deviceInfo == null) {
|
||||
return new BusiResult(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
CarCarport carCarport = carPayService.buyCarGoods(uid, uid, carId, deviceInfo, Constant.WalletCurrencyType.gold,
|
||||
Constant.CarComeFrom.BUY);
|
||||
return new BusiResult(carCarport);
|
||||
}
|
||||
|
||||
}
|
||||
//package com.accompany.business.controller.car;
|
||||
//
|
||||
//import com.accompany.business.common.BaseController;
|
||||
//import com.accompany.business.model.CarCarport;
|
||||
//import com.accompany.business.service.car.CarPayService;
|
||||
//import com.accompany.common.annotation.Authorization;
|
||||
//import com.accompany.common.constant.Constant;
|
||||
//import com.accompany.common.device.DeviceInfo;
|
||||
//import com.accompany.common.result.BusiResult;
|
||||
//import com.accompany.common.status.BusiStatus;
|
||||
//import org.slf4j.Logger;
|
||||
//import org.slf4j.LoggerFactory;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.stereotype.Controller;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.ResponseBody;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//
|
||||
///**
|
||||
// * Created by yuanyi on 2018/2/28.
|
||||
// *
|
||||
// * @desc 座驾开通与续费
|
||||
// */
|
||||
//@Controller
|
||||
//@RequestMapping("/car/pay")
|
||||
//public class CarPayController extends BaseController {
|
||||
// private static final Logger logger = LoggerFactory.getLogger(CarPayController.class);
|
||||
//
|
||||
// @Autowired
|
||||
// private CarPayService carPayService;
|
||||
//
|
||||
// /**
|
||||
// * 座驾的赠送
|
||||
// *
|
||||
// * @param uid
|
||||
// * @param targetUid
|
||||
// * @param carId
|
||||
// * @param deviceInfo
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping("giveByGold")
|
||||
// @ResponseBody
|
||||
// @Authorization
|
||||
// public BusiResult giveCarByGold(Long uid, Long targetUid, Integer carId, DeviceInfo deviceInfo) throws Exception {
|
||||
// logger.info("v1 giveCarByGold param is: uid={},targetUid={},carId={}", uid, targetUid, carId);
|
||||
// if (uid == null || carId == null || targetUid == null || deviceInfo == null) {
|
||||
// return new BusiResult(BusiStatus.PARAMETERILLEGAL);
|
||||
// }
|
||||
// CarCarport carCarport = carPayService.buyCarGoods(uid, targetUid, carId, deviceInfo, Constant.WalletCurrencyType.gold,
|
||||
// Constant.CarComeFrom.USER_DONATE);
|
||||
// return new BusiResult(carCarport);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 座驾的开通
|
||||
// *
|
||||
// * @param uid
|
||||
// * @param carId
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping("byGold")
|
||||
// @ResponseBody
|
||||
// @Authorization
|
||||
// public BusiResult carPurchaseByGold(HttpServletRequest request, Long uid, Integer carId, DeviceInfo deviceInfo) throws Exception {
|
||||
// logger.info("v1 carPurchaseByGold param is: uid={},carId={}", uid, carId);
|
||||
//
|
||||
// if (uid == null || carId == null || deviceInfo == null) {
|
||||
// return new BusiResult(BusiStatus.PARAMETERILLEGAL);
|
||||
// }
|
||||
// CarCarport carCarport = carPayService.buyCarGoods(uid, uid, carId, deviceInfo, Constant.WalletCurrencyType.gold,
|
||||
// Constant.CarComeFrom.BUY);
|
||||
// return new BusiResult(carCarport);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
@@ -1,71 +1,71 @@
|
||||
package com.accompany.business.controller.car;
|
||||
|
||||
import com.accompany.business.common.BaseController;
|
||||
import com.accompany.business.model.CarCarport;
|
||||
import com.accompany.business.service.car.CarPayService;
|
||||
import com.accompany.common.annotation.Authorization;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.device.DeviceInfo;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/car/pay/v2")
|
||||
public class CarPayV2Controller extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CarPayService carPayService;
|
||||
|
||||
/**
|
||||
* 座驾的赠送
|
||||
*
|
||||
* @param uid
|
||||
* @param targetUid
|
||||
* @param carId
|
||||
* @param deviceInfo
|
||||
* @param currencyType:0金币,1萝卜
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/giveCar", method = RequestMethod.POST)
|
||||
@Authorization
|
||||
public BusiResult giveCarByGold(Long uid, Long targetUid, Integer carId, DeviceInfo deviceInfo, Byte currencyType) throws Exception {
|
||||
log.info("v1 giveCarByGold param is: uid={},targetUid={},carId={},currencyType={}", uid, targetUid, carId, currencyType);
|
||||
if (uid == null || carId == null || targetUid == null || deviceInfo == null) {
|
||||
return new BusiResult(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
CarCarport carCarport = carPayService.buyCarGoods(uid, targetUid, carId, deviceInfo, currencyType, Constant.CarComeFrom.USER_DONATE);
|
||||
return new BusiResult(carCarport);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 座驾的开通
|
||||
*
|
||||
* @param uid
|
||||
* @param carId
|
||||
* @param currencyType:0金币,1萝卜
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/buy", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BusiResult buyCarGoods(Long uid, Integer carId, DeviceInfo deviceInfo, Byte currencyType) throws Exception {
|
||||
log.info("v2 carPurchaseByGold param is: uid={},carId={},currencyType={}", uid, carId, currencyType);
|
||||
|
||||
if (uid == null || carId == null || deviceInfo == null) {
|
||||
return new BusiResult(BusiStatus.PARAMETERILLEGAL);
|
||||
}
|
||||
CarCarport carCarport = carPayService.buyCarGoods(uid, uid, carId, deviceInfo, currencyType, Constant.CarComeFrom.BUY);
|
||||
return new BusiResult(carCarport);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//package com.accompany.business.controller.car;
|
||||
//
|
||||
//import com.accompany.business.common.BaseController;
|
||||
//import com.accompany.business.model.CarCarport;
|
||||
//import com.accompany.business.service.car.CarPayService;
|
||||
//import com.accompany.common.annotation.Authorization;
|
||||
//import com.accompany.common.constant.Constant;
|
||||
//import com.accompany.common.device.DeviceInfo;
|
||||
//import com.accompany.common.result.BusiResult;
|
||||
//import com.accompany.common.status.BusiStatus;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMethod;
|
||||
//import org.springframework.web.bind.annotation.ResponseBody;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//
|
||||
//@Slf4j
|
||||
//@RestController
|
||||
//@RequestMapping("/car/pay/v2")
|
||||
//public class CarPayV2Controller extends BaseController {
|
||||
//
|
||||
// @Autowired
|
||||
// private CarPayService carPayService;
|
||||
//
|
||||
// /**
|
||||
// * 座驾的赠送
|
||||
// *
|
||||
// * @param uid
|
||||
// * @param targetUid
|
||||
// * @param carId
|
||||
// * @param deviceInfo
|
||||
// * @param currencyType:0金币,1萝卜
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/giveCar", method = RequestMethod.POST)
|
||||
// @Authorization
|
||||
// public BusiResult giveCarByGold(Long uid, Long targetUid, Integer carId, DeviceInfo deviceInfo, Byte currencyType) throws Exception {
|
||||
// log.info("v1 giveCarByGold param is: uid={},targetUid={},carId={},currencyType={}", uid, targetUid, carId, currencyType);
|
||||
// if (uid == null || carId == null || targetUid == null || deviceInfo == null) {
|
||||
// return new BusiResult(BusiStatus.PARAMETERILLEGAL);
|
||||
// }
|
||||
// CarCarport carCarport = carPayService.buyCarGoods(uid, targetUid, carId, deviceInfo, currencyType, Constant.CarComeFrom.USER_DONATE);
|
||||
// return new BusiResult(carCarport);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 座驾的开通
|
||||
// *
|
||||
// * @param uid
|
||||
// * @param carId
|
||||
// * @param currencyType:0金币,1萝卜
|
||||
// * @return
|
||||
// */
|
||||
// @RequestMapping(value = "/buy", method = RequestMethod.POST)
|
||||
// @ResponseBody
|
||||
// public BusiResult buyCarGoods(Long uid, Integer carId, DeviceInfo deviceInfo, Byte currencyType) throws Exception {
|
||||
// log.info("v2 carPurchaseByGold param is: uid={},carId={},currencyType={}", uid, carId, currencyType);
|
||||
//
|
||||
// if (uid == null || carId == null || deviceInfo == null) {
|
||||
// return new BusiResult(BusiStatus.PARAMETERILLEGAL);
|
||||
// }
|
||||
// CarCarport carCarport = carPayService.buyCarGoods(uid, uid, carId, deviceInfo, currencyType, Constant.CarComeFrom.BUY);
|
||||
// return new BusiResult(carCarport);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
@@ -33,7 +33,7 @@ public class DressShopController extends BaseController {
|
||||
@Authorization
|
||||
public BaseResponseVO<List<DressShopVo>> getDressShopListVo(Byte dressType, HttpServletRequest request) {
|
||||
Long uid = getUid(request);
|
||||
List<DressShopVo> dressShopList = dressShopService.getDressShopListByUid(uid, dressType);
|
||||
List<DressShopVo> dressShopList = dressShopService.getDressShopListByUid(uid, dressType, null);
|
||||
dressShopService.wrapDressShop(dressType, dressShopList);
|
||||
return new BaseResponseVO<>(dressShopList);
|
||||
}
|
||||
|
@@ -31,9 +31,9 @@ public class VipTask {
|
||||
private VipTaskService vipTaskService;
|
||||
|
||||
/**
|
||||
* 核销到期的用户贵族(保级、降级、撤销)
|
||||
* 核销到期的用户贵族
|
||||
*/
|
||||
//@Scheduled(cron = "${scheduler.vip.checkVip-cron}")
|
||||
@Scheduled(cron = "0 0/5 * * * ?")
|
||||
public void checkVip() {
|
||||
log.info("核销到期的用户贵族...");
|
||||
vipTaskService.checkExpireVip();
|
||||
|
Reference in New Issue
Block a user