Compare commits

...

4 Commits

7 changed files with 36 additions and 11 deletions

View File

@@ -487,6 +487,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
refundableStatus = true;
}
}
}else if("relearn".equals(b.getOrderType()) && paymentDateTime > timestamp-7*24*60*60*1000){
refundableStatus = true;
}
if(b.getOrderStatus().equals(Constants.ORDER_STATUS_REFUND)){
BuyOrderRefund refundInfo = buyOrderRefundService.getRefundInfoByOrderId(b.getOrderId());

View File

@@ -183,6 +183,7 @@ public class CourseRelearnController {
String timeId = IdWorker.getTimeId().substring(0, 32);
buyOrder.setOrderSn(timeId);
buyOrder.setUserId(uid);
buyOrder.setPaymentDate(new Date());
buyOrderService.save(buyOrder);
BigDecimal totalPrice = buyOrder.getRealMoney();
//虚拟币支付

View File

@@ -56,8 +56,8 @@ public class JfTransactionDetailsController {
@Transactional
public R activityDonateJF(){
StringBuffer sb = new StringBuffer();
String startTime = "2025-11-08 00:00:00";
String endTime = "2025-11-13 09:22:00";
String startTime = "2026-06-18 00:00:00";
String endTime = "2026-06-22 10:06:59";
//查询时间段内所有充值的人
List<TransactionDetailsEntity> list = transactionDetailsService.list(new LambdaQueryWrapper<TransactionDetailsEntity>()
.between(TransactionDetailsEntity::getCreateTime,startTime,endTime)
@@ -76,7 +76,7 @@ public class JfTransactionDetailsController {
//时间段内获得的积分
Map<String,Object> jftd = jfService.getMap(new MPJLambdaWrapper<JfTransactionDetails>()
.eq(JfTransactionDetails::getUserId,transactionDetail.getUserId())
.like(JfTransactionDetails::getRemark,"双11")
.like(JfTransactionDetails::getRemark,"618活动充值")
.between(JfTransactionDetails::getCreateTime,startTime,endTime)
.gt(TransactionDetailsEntity::getChangeAmount,0)
.selectSum(TransactionDetailsEntity::getChangeAmount));
@@ -114,19 +114,19 @@ public class JfTransactionDetailsController {
new BigDecimal(changeAmount.toString()).compareTo(new BigDecimal(1000))>=0||
new BigDecimal(changeAmount.toString()).compareTo(new BigDecimal(500))>=0){
if (new BigDecimal(changeAmount.toString()).compareTo(new BigDecimal(5000))>=0){
shouldJf = shouldJf.add(new BigDecimal(2500));
shouldJf = shouldJf.add(new BigDecimal(2000));
changeAmount = changeAmount.subtract(new BigDecimal(5000));
}else if (new BigDecimal(changeAmount.toString()).compareTo(new BigDecimal(3000))>=0){
shouldJf = shouldJf.add(new BigDecimal(1300));
shouldJf = shouldJf.add(new BigDecimal(1000));
changeAmount = changeAmount.subtract(new BigDecimal(3000));
}else if (new BigDecimal(changeAmount.toString()).compareTo(new BigDecimal(2000))>=0){
shouldJf = shouldJf.add(new BigDecimal(800));
shouldJf = shouldJf.add(new BigDecimal(600));
changeAmount = changeAmount.subtract(new BigDecimal(2000));
}else if (new BigDecimal(changeAmount.toString()).compareTo(new BigDecimal(1000))>=0){
shouldJf = shouldJf.add(new BigDecimal(300));
shouldJf = shouldJf.add(new BigDecimal(240));
changeAmount = changeAmount.subtract(new BigDecimal(1000));
}else if (new BigDecimal(changeAmount.toString()).compareTo(new BigDecimal(500))>=0){
shouldJf = shouldJf.add(new BigDecimal(120));
shouldJf = shouldJf.add(new BigDecimal(100));
changeAmount = changeAmount.subtract(new BigDecimal(500));
}
return chgf(changeJf,shouldJf,changeAmount,jf);

View File

@@ -62,6 +62,9 @@ public class CouponEntity {
//使用门槛
private Integer useLevel;
//限定VIP类型逗号分隔如1,11,5,51用户开通其中任意VIP可现金券直接换积分
private String userVipIds;
private Date createTime;
@TableLogic

View File

@@ -148,6 +148,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
List<ExpressOrder> expressOrders = expressOrderDao.selectList(new LambdaQueryWrapper<ExpressOrder>().in(ExpressOrder::getId, collect));
b.setExpressList(expressOrders);
}
}else if("relearn".equals(b.getOrderType()) && paymentDateTime > timestamp-7*24*60*60*1000){
refundableStatus = true;
}
b.setRefundableStatus(b.getOrderStatus().equals("6") || b.getOrderStatus().equals("7")?false:refundableStatus);
}

View File

@@ -271,6 +271,15 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
return set;
}
private boolean matchUserVipIds(String userVipIds, List<UserVip> userVipList) {
Set<Integer> allowedVipTypes = Arrays.stream(userVipIds.split(","))
.map(String::trim)
.filter(StringUtils::isNotEmpty)
.map(Integer::parseInt)
.collect(Collectors.toSet());
return userVipList.stream().anyMatch(userVip -> allowedVipTypes.contains(userVip.getType()));
}
public void getCourseMedicalIds(int courseMedicalId,List<Integer> list){
CourseMedicine courseMedicine = courseMedicineDao.selectById(courseMedicalId);
if (courseMedicine.getIsLast()==1){
@@ -380,7 +389,7 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
List<Map<String,Object>> buyOrderProducts = couponToProductDao.selectJoinMaps(wrapper);
for (Map<String,Object> map : buyOrderProducts) {
ShopProduct shopProduct = shopProductDao.selectById(map.get("product_id").toString());
//预售书+赠送现金券VIP用户将券额转为积分仅产品id=2023时需为妇幼生殖vip(type=10)
//预售书+赠送现金券VIP用户将券额转为积分配置user_vip_ids时匹配VIP且现金券换积分不匹配只送券
if ("03".equals(shopProduct.getGoodsType())){
MyUserEntity userEntity = userDao.selectById(order.getUserId());
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
@@ -389,8 +398,15 @@ public class CouponServiceImpl extends ServiceImpl<CouponDao, CouponEntity> impl
int productId = Integer.parseInt(map.get("product_id").toString());
int couponId = Integer.parseInt(map.get("coupon_id").toString());
CouponEntity couponEntity = couponDao.selectById(couponId);
boolean isFyszVip = userVipList.stream().anyMatch(userVip -> Integer.valueOf(10).equals(userVip.getType()));
boolean couponToJf = couponEntity.getCouponType() == 0 && (productId == 2023 ? isFyszVip : userVipList.size() > 0);
boolean couponToJf = false;
if (StringUtils.isNotEmpty(couponEntity.getUserVipIds())) {
if (matchUserVipIds(couponEntity.getUserVipIds(), userVipList)) {
couponToJf = couponEntity.getCouponType() == 0;
}
} else {
boolean isFyszVip = userVipList.stream().anyMatch(userVip -> Integer.valueOf(10).equals(userVip.getType()));
couponToJf = couponEntity.getCouponType() == 0 && (productId == 2023 ? isFyszVip : userVipList.size() > 0);
}
if (couponToJf){
BigDecimal jf = BigDecimal.ZERO;
for (int i=0;i<Integer.parseInt(map.get("quantity").toString());i++){

View File

@@ -194,6 +194,7 @@ public class UserVipLogServiceImpl extends ServiceImpl<UserVipLogDao, UserVipLog
refundRow.put("alreadyTanxiao", 0);
refundRow.put("currentTanxiao", alreadyTanxiao.negate());
refundRow.put("notyetTanxiao", 0);
refundRow.put("startTime", refund.get("refundTime"));
} else {
refundRow.put("price", toBigDecimal(row.get("price")).negate());
refundRow.put("fee", toBigDecimal(row.get("fee")).negate());