提示语优化
This commit is contained in:
parent
db5bd06c35
commit
8f20e755fb
@ -281,10 +281,10 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
|
|
||||||
// 参数校验
|
// 参数校验
|
||||||
if (activity_id == null || activity_id <= 0) {
|
if (activity_id == null || activity_id <= 0) {
|
||||||
throw new ApiException(I18nUtil._("活动ID无效!"));
|
throw new ApiException(I18nUtil._("活动编号无效!"));
|
||||||
}
|
}
|
||||||
if (user_id == null || user_id <= 0) {
|
if (user_id == null || user_id <= 0) {
|
||||||
throw new ApiException(I18nUtil._("用户ID无效!"));
|
throw new ApiException(I18nUtil._("用户编号无效!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取活动基础信息
|
// 获取活动基础信息
|
||||||
@ -353,7 +353,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
|
|
||||||
// 保存砍价记录
|
// 保存砍价记录
|
||||||
if (!saveOrUpdate(cutprice_row)) {
|
if (!saveOrUpdate(cutprice_row)) {
|
||||||
throw new ApiException(I18nUtil._("砍价活动参加失败!"));
|
throw new ApiException(I18nUtil._("参加砍价活动失败!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
is_join_activity = true;
|
is_join_activity = true;
|
||||||
@ -382,7 +382,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
// 库存不够,立即更改活动状态为已结束
|
// 库存不够,立即更改活动状态为已结束
|
||||||
shopStoreActivityBaseService.updateActivityState(activity_id, StateCode.ACTIVITY_STATE_FINISHED);
|
shopStoreActivityBaseService.updateActivityState(activity_id, StateCode.ACTIVITY_STATE_FINISHED);
|
||||||
activity_row.put("can_buy_now", CommonConstant.Disable2);
|
activity_row.put("can_buy_now", CommonConstant.Disable2);
|
||||||
activity_row.put("cannot_buy_now_reason", "抱歉,商品已抢空,活动已结束");
|
activity_row.put("cannot_buy_now_reason", "抱歉,商品已抢完,活动结束。");
|
||||||
} else {
|
} else {
|
||||||
// 判断是否可以立即购买
|
// 判断是否可以立即购买
|
||||||
boolean canBuyNow = cutprice_row != null
|
boolean canBuyNow = cutprice_row != null
|
||||||
@ -396,7 +396,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
activity_row.put("can_buy_now", canBuyNow ? CommonConstant.Enable : CommonConstant.Disable2);
|
activity_row.put("can_buy_now", canBuyNow ? CommonConstant.Enable : CommonConstant.Disable2);
|
||||||
activity_row.put("cannot_buy_now_reason",
|
activity_row.put("cannot_buy_now_reason",
|
||||||
canBuyNow ? "恭喜您,商品可以立即出手了。" :
|
canBuyNow ? "恭喜您,商品可以立即出手了。" :
|
||||||
String.format("还剩%.2f元到达商品底价,请继续加油!", subtractPrice));
|
String.format("还剩%.2f元到达商品底价,继续加油!", subtractPrice));
|
||||||
}
|
}
|
||||||
|
|
||||||
return activity_row;
|
return activity_row;
|
||||||
@ -415,13 +415,13 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
public CommonResult doCutPrice(Integer ac_id, Integer user_id) {
|
public CommonResult doCutPrice(Integer ac_id, Integer user_id) {
|
||||||
// 参数校验
|
// 参数校验
|
||||||
if (ac_id == null || ac_id <= 0 || user_id == null || user_id <= 0) {
|
if (ac_id == null || ac_id <= 0 || user_id == null || user_id <= 0) {
|
||||||
return CommonResult.failed(I18nUtil._("活动ID或用户ID无效!"));
|
return CommonResult.failed(I18nUtil._("活动或用户编号无效!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取砍价记录
|
// 获取砍价记录
|
||||||
ShopActivityCutprice cutprice = get(ac_id);
|
ShopActivityCutprice cutprice = get(ac_id);
|
||||||
if (cutprice == null) {
|
if (cutprice == null) {
|
||||||
return CommonResult.failed(I18nUtil._("砍价记录不存在!"));
|
return CommonResult.failed(I18nUtil._("未找到砍价记录!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查活动状态
|
// 检查活动状态
|
||||||
@ -432,7 +432,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
ShopStoreActivityBase activityBase = shopStoreActivityBaseService.get(cutprice.getActivity_id());
|
ShopStoreActivityBase activityBase = shopStoreActivityBaseService.get(cutprice.getActivity_id());
|
||||||
if (activityBase == null) {
|
if (activityBase == null) {
|
||||||
updateCutPriceState(cutprice.getAc_id(), null, CommonConstant.CutPrice_Order_State_Canceled);
|
updateCutPriceState(cutprice.getAc_id(), null, CommonConstant.CutPrice_Order_State_Canceled);
|
||||||
return CommonResult.failed(I18nUtil._("砍价活动已失效!"));
|
return CommonResult.failed(I18nUtil._("抱歉,砍价活动已失效啦!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查活动状态是否正常
|
// 检查活动状态是否正常
|
||||||
@ -441,7 +441,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
|| ObjectUtil.equal(activityBase.getActivity_state(), StateCode.ACTIVITY_STATE_CLOSED)) {
|
|| ObjectUtil.equal(activityBase.getActivity_state(), StateCode.ACTIVITY_STATE_CLOSED)) {
|
||||||
updateCutPriceState(cutprice.getAc_id(), null, CommonConstant.CutPrice_Order_State_Canceled);
|
updateCutPriceState(cutprice.getAc_id(), null, CommonConstant.CutPrice_Order_State_Canceled);
|
||||||
}
|
}
|
||||||
return CommonResult.failed(I18nUtil._("砍价活动已结束!"));
|
return CommonResult.failed(I18nUtil._("抱歉,砍价活动已结束啦!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
@ -450,7 +450,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
// 检查砍价记录是否过期
|
// 检查砍价记录是否过期
|
||||||
if (CheckUtil.isNotEmpty(expiredAt) && expiredAt < now.getTime()) {
|
if (CheckUtil.isNotEmpty(expiredAt) && expiredAt < now.getTime()) {
|
||||||
updateCutPriceState(cutprice.getAc_id(), null, CommonConstant.CutPrice_Order_State_Expired);
|
updateCutPriceState(cutprice.getAc_id(), null, CommonConstant.CutPrice_Order_State_Expired);
|
||||||
return CommonResult.failed(I18nUtil._("砍价已过期!"));
|
return CommonResult.failed(I18nUtil._("抱歉,砍价已过期啦!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查活动时间是否有效
|
// 检查活动时间是否有效
|
||||||
@ -512,7 +512,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
QueryWrapper<ShopActivityCutpriceHistory> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<ShopActivityCutpriceHistory> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("user_id", user_id).eq("ac_id", ac_id);
|
queryWrapper.eq("user_id", user_id).eq("ac_id", ac_id);
|
||||||
if (shopActivityCutpriceHistoryService.count(queryWrapper) > 0) {
|
if (shopActivityCutpriceHistoryService.count(queryWrapper) > 0) {
|
||||||
return CommonResult.failed(I18nUtil._("您已经帮好友砍过价了!"));
|
return CommonResult.failed(I18nUtil._("您已帮好友砍过价了!"));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return CommonResult.failed(I18nUtil._("系统繁忙,请稍后再试!"));
|
return CommonResult.failed(I18nUtil._("系统繁忙,请稍后再试!"));
|
||||||
@ -617,12 +617,12 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
params.eq("activity_id", activity_id);
|
params.eq("activity_id", activity_id);
|
||||||
ShopStoreActivityBase storeActivityBase = shopStoreActivityBaseService.getOne(params);
|
ShopStoreActivityBase storeActivityBase = shopStoreActivityBaseService.getOne(params);
|
||||||
if (storeActivityBase == null) {
|
if (storeActivityBase == null) {
|
||||||
return Pair.of(false, I18nUtil._("抱歉,系统未找到活动记录。"));
|
return Pair.of(false, I18nUtil._("抱歉,未找到活动记录。"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 检查活动是否在有效期内
|
// 2. 检查活动是否在有效期内
|
||||||
if (!DateTimeUtils.isActivityTimeValid(storeActivityBase.getActivity_starttime(), storeActivityBase.getActivity_endtime(), new Date())) {
|
if (!DateTimeUtils.isActivityTimeValid(storeActivityBase.getActivity_starttime(), storeActivityBase.getActivity_endtime(), new Date())) {
|
||||||
return Pair.of(false, I18nUtil._("该活动已过期,请检查。"));
|
return Pair.of(false, I18nUtil._("抱歉,该活动已过期。"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 检查用户是否有发起的砍价记录
|
// 3. 检查用户是否有发起的砍价记录
|
||||||
@ -632,7 +632,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
queryWrapper.orderByDesc("ac_id");
|
queryWrapper.orderByDesc("ac_id");
|
||||||
ShopActivityCutprice shopActivityCutprice = getOne(queryWrapper);
|
ShopActivityCutprice shopActivityCutprice = getOne(queryWrapper);
|
||||||
if (shopActivityCutprice == null) {
|
if (shopActivityCutprice == null) {
|
||||||
return Pair.of(false, I18nUtil._("系统未找到您发起的砍价记录。"));
|
return Pair.of(false, I18nUtil._("未找到您发起的砍价记录。"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 检查是否已砍到最低价
|
// 4. 检查是否已砍到最低价
|
||||||
@ -645,7 +645,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
BigDecimal subPrice = NumberUtil.sub(currPrice, mixSalePrice);
|
BigDecimal subPrice = NumberUtil.sub(currPrice, mixSalePrice);
|
||||||
// 当前价格已经等于或低于底价,可以立即出手下单
|
// 当前价格已经等于或低于底价,可以立即出手下单
|
||||||
if (NumberUtil.isGreater(subPrice, BigDecimal.ZERO)) {
|
if (NumberUtil.isGreater(subPrice, BigDecimal.ZERO)) {
|
||||||
return Pair.of(false, String.format(I18nUtil._("还剩%.2f元可达活动底价,请继续加油。"), subPrice));
|
return Pair.of(false, String.format(I18nUtil._("还剩%.2f元就到底价,继续加油。"), subPrice));
|
||||||
}
|
}
|
||||||
// 5. 检查是否存在砍价历史记录
|
// 5. 检查是否存在砍价历史记录
|
||||||
QueryWrapper<ShopActivityCutpriceHistory> queryWrapperHistory = new QueryWrapper<>();
|
QueryWrapper<ShopActivityCutpriceHistory> queryWrapperHistory = new QueryWrapper<>();
|
||||||
@ -701,7 +701,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
// 检查活动商品库存
|
// 检查活动商品库存
|
||||||
Integer productCount = shopStoreActivityBase.getProduct_count();
|
Integer productCount = shopStoreActivityBase.getProduct_count();
|
||||||
if (CheckUtil.isEmpty(productCount) || productCount <= 0) {
|
if (CheckUtil.isEmpty(productCount) || productCount <= 0) {
|
||||||
return Pair.of(false, I18nUtil._("活动商品库存未设置,请联系店长!"));
|
return Pair.of(false, I18nUtil._("活动商品未给库存,请联系店长!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询已占用库存的砍价订单数量
|
// 查询已占用库存的砍价订单数量
|
||||||
@ -716,7 +716,7 @@ public class ShopActivityCutpriceServiceImpl extends BaseServiceImpl<ShopActivit
|
|||||||
|
|
||||||
// 判断库存是否充足(当已占用库存大于等于总库存时,表示库存不足)
|
// 判断库存是否充足(当已占用库存大于等于总库存时,表示库存不足)
|
||||||
if (recordCount >= productCount) {
|
if (recordCount >= productCount) {
|
||||||
return Pair.of(false, I18nUtil._("活动商品库存不足,请稍后再参与!"));
|
return Pair.of(false, I18nUtil._("活动商品不足,稍后再参与!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 所有检查通过
|
// 所有检查通过
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user