修改vipprice,用户会员类型修改
This commit is contained in:
@@ -2,7 +2,13 @@ package com.peanut.modules.common.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.service.BuyOrderProductService;
|
||||
import com.peanut.modules.book.service.ShopProductService;
|
||||
import com.peanut.modules.common.entity.BuyOrder;
|
||||
import com.peanut.modules.common.entity.BuyOrderProduct;
|
||||
import com.peanut.modules.common.entity.ShopProduct;
|
||||
import com.peanut.modules.common.entity.TransactionDetailsEntity;
|
||||
import com.peanut.modules.common.service.BuyOrderService;
|
||||
import com.peanut.modules.common.service.TransactionDetailsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -24,6 +30,12 @@ public class TransactionDetailsController {
|
||||
|
||||
@Autowired
|
||||
private TransactionDetailsService transactionDetailsService;
|
||||
@Autowired
|
||||
private BuyOrderService buyOrderService;
|
||||
@Autowired
|
||||
private BuyOrderProductService buyOrderProductService;
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
|
||||
/**
|
||||
* 获取付款记录列表
|
||||
@@ -37,6 +49,29 @@ public class TransactionDetailsController {
|
||||
}
|
||||
wrapper.orderByDesc(TransactionDetailsEntity::getCreateTime);
|
||||
List<TransactionDetailsEntity> list = transactionDetailsService.list(wrapper);
|
||||
for (TransactionDetailsEntity detail:list){
|
||||
if ("购买商品".equals(detail.getOrderType())){
|
||||
String productName = "";
|
||||
String orderSn = detail.getRemark().substring(8);
|
||||
BuyOrder buyOrder = buyOrderService.getOne(new LambdaQueryWrapper<BuyOrder>()
|
||||
.eq(BuyOrder::getOrderSn,orderSn));
|
||||
if (buyOrder!=null){
|
||||
List<BuyOrderProduct> products = buyOrderProductService.list(new LambdaQueryWrapper<BuyOrderProduct>()
|
||||
.eq(BuyOrderProduct::getOrderId,buyOrder.getOrderId()));
|
||||
for (BuyOrderProduct buyOrderProduct : products) {
|
||||
ShopProduct shopProduct = shopProductService.getById(buyOrderProduct.getProductId());
|
||||
if (shopProduct != null){
|
||||
if (StringUtils.isNotBlank(productName)){
|
||||
productName += ";"+shopProduct.getProductName();
|
||||
}else {
|
||||
productName += shopProduct.getProductName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
detail.setProductName(productName);
|
||||
}
|
||||
}
|
||||
return R.ok().put("transactionDetailsList",list);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.peanut.modules.common.controller;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.HttpContextUtil;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.config.Constants;
|
||||
@@ -22,6 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.transaction.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
@@ -64,14 +67,38 @@ public class UserVipController {
|
||||
List<UserVip> l4 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,4).orderByDesc(UserVip::getEndTime));
|
||||
List<UserVip> l5 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,5).orderByDesc(UserVip::getEndTime));
|
||||
List<UserVip> l6 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,6).orderByDesc(UserVip::getEndTime));
|
||||
if (l4.size()>0&&l5.size()>0&&l6.size()>0&&l4.get(0).getState()==0&&l5.get(0).getState()==0&&l6.get(0).getState()==0){
|
||||
if (l4.size()>0&&l5.size()>0&&l6.size()>0){
|
||||
Date t4 = l4.get(0).getEndTime();
|
||||
Date t5 = l5.get(0).getEndTime();
|
||||
Date t6 = l6.get(0).getEndTime();
|
||||
Map map = new HashMap();
|
||||
map.put("type",1);
|
||||
map.put("endTime",t4.getTime()<t5.getTime()?(t4.getTime()<t6.getTime()?t4:(t5.getTime()<t6.getTime()?t5:t6)):(t5.getTime()<t6.getTime()?t5:t6));
|
||||
resList.add(map);
|
||||
if (t4.getTime()==t5.getTime()&&t5.getTime()==t6.getTime()){
|
||||
Map map = new HashMap();
|
||||
map.put("type",1);
|
||||
map.put("endTime",t4);
|
||||
resList.add(map);
|
||||
}else {
|
||||
List<Map<String,Object>> tempList = new ArrayList();
|
||||
Map map4 = new HashMap();
|
||||
map4.put("type",4);
|
||||
map4.put("endTime",t4);
|
||||
tempList.add(map4);
|
||||
Map map5 = new HashMap();
|
||||
map5.put("type",5);
|
||||
map5.put("endTime",t5);
|
||||
tempList.add(map5);
|
||||
Map map6 = new HashMap();
|
||||
map6.put("type",6);
|
||||
map6.put("endTime",t6);
|
||||
tempList.add(map6);
|
||||
tempList = tempList.stream().sorted((map1,map2)->{
|
||||
return Long.compare(((Date)map1.get("endTime")).getTime(),((Date)map2.get("endTime")).getTime());
|
||||
}).collect(Collectors.toList());
|
||||
resList.addAll(tempList);
|
||||
Map map1 = new HashMap();
|
||||
map1.put("type",1);
|
||||
map1.put("endTime",tempList.get(0).get("endTime"));
|
||||
resList.add(map1);
|
||||
}
|
||||
}else {
|
||||
if (l4.size()>0){
|
||||
Map map = new HashMap();
|
||||
@@ -90,17 +117,38 @@ public class UserVipController {
|
||||
map.put("type",6);
|
||||
map.put("endTime",l6.get(0).getEndTime());
|
||||
resList.add(map);
|
||||
|
||||
}
|
||||
}
|
||||
List<UserVip> l7 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,7).orderByDesc(UserVip::getEndTime));
|
||||
List<UserVip> l8 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,8).orderByDesc(UserVip::getEndTime));
|
||||
if (l7.size()>0&&l8.size()>0&&l7.get(0).getState()==0&&l8.get(0).getState()==0){
|
||||
if (l7.size()>0&&l8.size()>0){
|
||||
Date t7 = l7.get(0).getEndTime();
|
||||
Date t8 = l8.get(0).getEndTime();
|
||||
Map map = new HashMap();
|
||||
map.put("type",2);
|
||||
map.put("endTime",t7.getTime()<t8.getTime()?t7:t8);
|
||||
resList.add(map);
|
||||
if (t7.getTime()==t8.getTime()){
|
||||
Map map = new HashMap();
|
||||
map.put("type",2);
|
||||
map.put("endTime",t7);
|
||||
resList.add(map);
|
||||
}else {
|
||||
List<Map<String,Object>> tempList = new ArrayList();
|
||||
Map map7 = new HashMap();
|
||||
map7.put("type",7);
|
||||
map7.put("endTime",t7);
|
||||
tempList.add(map7);
|
||||
Map map8 = new HashMap();
|
||||
map8.put("type",8);
|
||||
map8.put("endTime",t8);
|
||||
tempList.add(map8);
|
||||
tempList = tempList.stream().sorted((map1,map2)->{
|
||||
return Long.compare(((Date)map1.get("endTime")).getTime(),((Date)map2.get("endTime")).getTime());
|
||||
}).collect(Collectors.toList());
|
||||
resList.addAll(tempList);
|
||||
Map map2 = new HashMap();
|
||||
map2.put("type",2);
|
||||
map2.put("endTime",tempList.get(0).get("endTime"));
|
||||
resList.add(map2);
|
||||
}
|
||||
}else {
|
||||
if (l7.size()>0){
|
||||
Map map = new HashMap();
|
||||
@@ -116,7 +164,7 @@ public class UserVipController {
|
||||
}
|
||||
}
|
||||
resList = resList.stream().sorted((map1,map2)->{
|
||||
return Long.compare(((Date)map2.get("endTime")).getTime(),((Date)map1.get("endTime")).getTime());
|
||||
return Long.compare(((Date)map1.get("endTime")).getTime(),((Date)map2.get("endTime")).getTime());
|
||||
}).collect(Collectors.toList());
|
||||
return R.ok().put("list", resList);
|
||||
}
|
||||
@@ -126,10 +174,18 @@ public class UserVipController {
|
||||
@RequestMapping("/getVipBuyConfigList")
|
||||
public R getVipBuyConfigList() {
|
||||
List<List> ll = new ArrayList<>();
|
||||
ll.add(Arrays.asList(1));
|
||||
ll.add(Arrays.asList(4,5,6));
|
||||
ll.add(Arrays.asList(2));
|
||||
ll.add(Arrays.asList(7,8));
|
||||
//根部不同平台返回不同列表
|
||||
HttpServletRequest request = HttpContextUtil.getHttpServletRequest();
|
||||
String appType = request.getHeader("appType")==null?"":request.getHeader("appType");
|
||||
if ("psyche".equals(appType)){
|
||||
ll.add(Arrays.asList(8,7));
|
||||
ll.add(Arrays.asList(2));
|
||||
}else {
|
||||
ll.add(Arrays.asList(1));
|
||||
ll.add(Arrays.asList(4,5,6));
|
||||
ll.add(Arrays.asList(2));
|
||||
ll.add(Arrays.asList(7,8));
|
||||
}
|
||||
List<Map<String,Object>> resList = new ArrayList<>();
|
||||
for (List l : ll) {
|
||||
LambdaQueryWrapper<VipBuyConfigEntity> wrapper = new LambdaQueryWrapper();
|
||||
|
||||
Reference in New Issue
Block a user