退VIP后,如果有延期VIP,需要退掉延期VIP才可以退掉此VIP订单

This commit is contained in:
wyn
2026-06-02 14:24:56 +08:00
parent 24264b82ff
commit 4e8b479683
7 changed files with 70 additions and 16 deletions

View File

@@ -673,6 +673,9 @@ public class BuyOrderController {
|| Constants.ORDER_STATUS_OUT_OF_TIME.equals(buyOrder.getOrderStatus())) {
return R.error("当前订单状态不支持退单");
}
if(buyOrder.getOrderType().equals("vip")&& buyOrderService.hasYQOrder(buyOrder)){
return R.error("需要先退掉当前VIP下的延期");
}
//设置状态为退款中
buyOrder.setOrderStatus(Constants.ORDER_STATUS_REFUNDING);
buyOrderService.updateById(buyOrder);

View File

@@ -388,10 +388,12 @@ public class ShopProductController {
shopProduct.setBookId("");
}
shopProductService.save(shopProduct);
ShopProductBookEntity shopProductBookEntity = new ShopProductBookEntity();
for (String s : shopProduct.getBookids()) {
String bookIdList = s;
if (bookIdList != null) {
ShopProductBookEntity shopProductBookEntity = new ShopProductBookEntity();
Integer product = shopProduct.getProductId();
shopProductBookEntity.setProductId(product);
shopProductBookEntity.setBookId(Integer.valueOf(bookIdList));

View File

@@ -76,4 +76,6 @@ public interface BuyOrderService extends IService<BuyOrder> {
BigDecimal getRefundFee(Map<String, Object> params, BuyOrder buyOrder);
void refundOrder(BuyOrder buyOrder, MyUserEntity user, int refundId);
boolean hasYQOrder(BuyOrder buyOrder);
}

View File

@@ -116,6 +116,8 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
private UserVipLogDao userVipLogDao;
@Autowired
private UserVipDao userVipDao;
@Autowired
private VipBuyConfigDao vipBuyConfigDao;
// TODO 新版本上线后删除
@Override
@@ -1105,4 +1107,35 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
shopProductService.rollbackStock(buyOrder);
}
}
/**
* 判断该VIP后是否办理过延期VIP,退VIP时如果在此VIP后办理过延期需要把延期退掉才可以退此订单
* @param buyOrder
* @return
*/
@Override
public boolean hasYQOrder(BuyOrder buyOrder){
VipBuyConfigEntity vipBuyConfig = vipBuyConfigService.getById(buyOrder.getVipBuyConfigId());
if(vipBuyConfig.getType()<=10){
List<String> typeStrs = new ArrayList<>();
if(vipBuyConfig.getType()==1){
typeStrs.add("41");
typeStrs.add("91");
typeStrs.add("51");
typeStrs.add("41");
typeStrs.add("61");
typeStrs.add("101");
}else if(vipBuyConfig.getType()==2){
typeStrs.add("71");
typeStrs.add("81");
}else{
typeStrs.add(vipBuyConfig.getType()+"1");
}
List<Integer> vipBuyConfigIdList = vipBuyConfigDao.selectList(new LambdaQueryWrapper<VipBuyConfigEntity>().in(VipBuyConfigEntity::getType,typeStrs)).stream().map(VipBuyConfigEntity::getId).collect(Collectors.toList());
Long nums = buyOrderDao.selectCount(new LambdaQueryWrapper<BuyOrder>().in(BuyOrder::getVipBuyConfigId,vipBuyConfigIdList).eq(BuyOrder::getOrderStatus,3).gt(BuyOrder::getCreateTime, buyOrder.getCreateTime()));
log.info("=====hasYQOrder===="+nums);
return nums>0?true:false;
}
return false;
}
}

View File

@@ -494,7 +494,12 @@ public class ClassController {
}
}
}
// @RequestMapping("/createCertificateNo")
// public R createCertificateNo() {
// String certificateNo = classEntityService.getNextCertificateNo("B", "");
// log.info("========certificateNo========="+certificateNo);
// return R.ok(certificateNo);
// }
//结班
@RequestMapping("/closeClass")
@Transactional

View File

@@ -386,7 +386,7 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
vipBuyConfigEntity.getType()==71||vipBuyConfigEntity.getType()==81 ||vipBuyConfigEntity.getType()==101){
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
.eq(UserVip::getUserId,buyOrder.getUserId())
.eq(UserVip::getType,vipBuyConfigEntity.getType().toString().substring(0,1))
.eq(UserVip::getType,vipBuyConfigEntity.getType().toString().substring(0,vipBuyConfigEntity.getType()==101?2:1))
.orderByDesc(UserVip::getEndTime));
UserVip userVip = userVipList.get(0);
if (userVip.getState()==0) {

View File

@@ -63,7 +63,7 @@ public class StatisticsBusinessVipController {
.stream().map(UserVip::getType).collect(Collectors.toList());
// 定义复购规则
Map<String, List<Integer>> reBuyRules = new HashMap<>();
reBuyRules.put("医学超级", Arrays.asList(4, 5, 6, 9));
reBuyRules.put("医学超级", Arrays.asList(4, 5, 6, 9, 10));
reBuyRules.put("国学心理学超级", Arrays.asList(7, 8));
reBuyRules.put("中医学", Arrays.asList(4));
reBuyRules.put("针灸学", Arrays.asList(5));
@@ -71,6 +71,7 @@ public class StatisticsBusinessVipController {
reBuyRules.put("国学", Arrays.asList(7));
reBuyRules.put("心理学", Arrays.asList(8));
reBuyRules.put("中西汇通学", Arrays.asList(9));
reBuyRules.put("妇幼生殖", Arrays.asList(10));
// 判断是否复购
List<Integer> required = reBuyRules.get(vipType);
if (required != null && state1UserVips.containsAll(required)) {
@@ -141,14 +142,17 @@ public class StatisticsBusinessVipController {
row5.createCell(0).setCellValue("肿瘤学");row5.createCell(1).setCellValue(state1Counts.getOrDefault("肿瘤学", 0).toString());
row5.createCell(2).setCellValue("肿瘤学");row5.createCell(3).setCellValue(state0Counts.getOrDefault("肿瘤学", 0).toString());
Row row6 = sheet.createRow(rowNum++);
row6.createCell(0).setCellValue("国学");row6.createCell(1).setCellValue(state1Counts.getOrDefault("国学",0).toString());
row6.createCell(2).setCellValue("国学");row6.createCell(3).setCellValue(state0Counts.getOrDefault("国学", 0).toString());
row6.createCell(0).setCellValue("妇幼生殖");row6.createCell(1).setCellValue(state1Counts.getOrDefault("妇幼生殖",0).toString());
row6.createCell(2).setCellValue("妇幼生殖");row6.createCell(3).setCellValue(state0Counts.getOrDefault("妇幼生殖", 0).toString());
Row row7 = sheet.createRow(rowNum++);
row7.createCell(0).setCellValue("心理");row7.createCell(1).setCellValue(state1Counts.getOrDefault("心理", 0).toString());
row7.createCell(2).setCellValue("心理");row7.createCell(3).setCellValue(state0Counts.getOrDefault("心理", 0).toString());
row7.createCell(0).setCellValue("");row7.createCell(1).setCellValue(state1Counts.getOrDefault("",0).toString());
row7.createCell(2).setCellValue("");row7.createCell(3).setCellValue(state0Counts.getOrDefault("", 0).toString());
Row row8 = sheet.createRow(rowNum++);
row8.createCell(0).setCellValue("中西汇通");row8.createCell(1).setCellValue(state1Counts.getOrDefault("中西汇通", 0).toString());
row8.createCell(2).setCellValue("中西汇通");row8.createCell(3).setCellValue(state0Counts.getOrDefault("中西汇通", 0).toString());
row8.createCell(0).setCellValue("心理");row8.createCell(1).setCellValue(state1Counts.getOrDefault("心理", 0).toString());
row8.createCell(2).setCellValue("心理");row8.createCell(3).setCellValue(state0Counts.getOrDefault("心理", 0).toString());
Row row9 = sheet.createRow(rowNum++);
row9.createCell(0).setCellValue("中西汇通学");row9.createCell(1).setCellValue(state1Counts.getOrDefault("中西汇通学", 0).toString());
row9.createCell(2).setCellValue("中西汇通学");row9.createCell(3).setCellValue(state0Counts.getOrDefault("中西汇通学", 0).toString());
sheet.createRow(rowNum++);
String[] header = {"时间","姓名","电话","VIP类型","是否延期", "本次年限","本次金额","本次开始时间","本次结束时间","到期时间","是否复购"};
@@ -316,14 +320,17 @@ public class StatisticsBusinessVipController {
row5.createCell(0).setCellValue("肿瘤学");row5.createCell(1).setCellValue(state1Counts.getOrDefault("肿瘤学", 0).toString());
row5.createCell(2).setCellValue("肿瘤学");row5.createCell(3).setCellValue(state0Counts.getOrDefault("肿瘤学", 0).toString());
Row row6 = sheet.createRow(rowNum++);
row6.createCell(0).setCellValue("国学");row6.createCell(1).setCellValue(state1Counts.getOrDefault("国学",0).toString());
row6.createCell(2).setCellValue("国学");row6.createCell(3).setCellValue(state0Counts.getOrDefault("国学", 0).toString());
row6.createCell(0).setCellValue("妇幼生殖");row6.createCell(1).setCellValue(state1Counts.getOrDefault("妇幼生殖",0).toString());
row6.createCell(2).setCellValue("妇幼生殖");row6.createCell(3).setCellValue(state0Counts.getOrDefault("妇幼生殖", 0).toString());
Row row7 = sheet.createRow(rowNum++);
row7.createCell(0).setCellValue("心理");row7.createCell(1).setCellValue(state1Counts.getOrDefault("心理", 0).toString());
row7.createCell(2).setCellValue("心理");row7.createCell(3).setCellValue(state0Counts.getOrDefault("心理", 0).toString());
row7.createCell(0).setCellValue("");row7.createCell(1).setCellValue(state1Counts.getOrDefault("",0).toString());
row7.createCell(2).setCellValue("");row7.createCell(3).setCellValue(state0Counts.getOrDefault("", 0).toString());
Row row8 = sheet.createRow(rowNum++);
row8.createCell(0).setCellValue("中西汇通");row8.createCell(1).setCellValue(state1Counts.getOrDefault("中西汇通", 0).toString());
row8.createCell(2).setCellValue("中西汇通");row8.createCell(3).setCellValue(state0Counts.getOrDefault("中西汇通", 0).toString());
row8.createCell(0).setCellValue("心理");row8.createCell(1).setCellValue(state1Counts.getOrDefault("心理", 0).toString());
row8.createCell(2).setCellValue("心理");row8.createCell(3).setCellValue(state0Counts.getOrDefault("心理", 0).toString());
Row row9 = sheet.createRow(rowNum++);
row9.createCell(0).setCellValue("中西汇通学");row9.createCell(1).setCellValue(state1Counts.getOrDefault("中西汇通学", 0).toString());
row9.createCell(2).setCellValue("中西汇通学");row9.createCell(3).setCellValue(state0Counts.getOrDefault("中西汇通学", 0).toString());
sheet.createRow(rowNum++);
String[] header2 = {"","首次办理三年","首次办理四年","其他","延期一年", "延期三年","延期四年","其他"};
@@ -339,6 +346,7 @@ public class StatisticsBusinessVipController {
fillRow(sheet.createRow(rowNum++), 0, "中医学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "针灸学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "肿瘤学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "妇幼生殖", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "国学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "心理学", banCounts, yanCounts);
fillRow(sheet.createRow(rowNum++), 0, "中西汇通学", banCounts, yanCounts);
@@ -352,6 +360,7 @@ public class StatisticsBusinessVipController {
sheet.createRow(rowNum++).createCell(0).setCellValue("中医学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("中医学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("针灸学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("针灸学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("肿瘤学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("肿瘤学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("妇幼生殖");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("妇幼生殖",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("国学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("国学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("心理学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("心理学",0).toString());
sheet.createRow(rowNum++).createCell(0).setCellValue("中西汇通学");sheet.getRow(rowNum-1).createCell(1).setCellValue(banTypeRatios.getOrDefault("中西汇通学",0).toString());