From 12ff8c3fdf75d11d4a26fb83849238be633f1fba Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期五, 08 十二月 2023 17:18:15 +0800
Subject: [PATCH] 后台添加购课记录价格bug2
---
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java | 245 ++++++++++++++++++++++++++++++++++++------------
1 files changed, 182 insertions(+), 63 deletions(-)
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java
index 7b8c8e3..e815431 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java
@@ -3,18 +3,23 @@
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.dsh.course.entity.CoursePackageOrderStudent;
import com.dsh.course.feignClient.account.*;
import com.dsh.course.feignClient.account.model.*;
import com.dsh.course.feignClient.activity.PointMercharsClient;
import com.dsh.course.feignClient.competition.CompetitionClient;
+import com.dsh.course.feignClient.competition.model.CompetionVO;
import com.dsh.course.feignClient.competition.model.Competition;
import com.dsh.course.feignClient.competition.model.CompetitionQuery;
import com.dsh.course.feignClient.competition.model.PaymentCompetition;
import com.dsh.course.feignClient.course.*;
import com.dsh.course.feignClient.course.model.TCoursePackage;
import com.dsh.course.feignClient.course.model.TCoursePackagePayment;
+import com.dsh.course.feignClient.other.BallClient;
import com.dsh.course.feignClient.other.SiteClient;
import com.dsh.course.feignClient.other.StoreClient;
+import com.dsh.course.feignClient.other.model.GameDataQuery;
+import com.dsh.course.feignClient.other.model.TGameRecord;
import com.dsh.course.model.MoneyBack;
import com.dsh.guns.config.UserExt;
import com.dsh.guns.core.base.controller.BaseController;
@@ -87,6 +92,8 @@
private CoursePackageClient coursePackageClient;
@Autowired
private TOperatorService operatorService;
+ @Autowired
+ private BallClient ballClient;
/**
* 跳转到平台统计数据页面
*/
@@ -94,15 +101,9 @@
public String index(Model model) {
Object o = type1(null);
model.addAttribute("data",o);
-
-
-
// 教学统计
HashMap<String, Object> map = appUserClient.queryUserAge();
model.addAttribute("stuData",map);
-
-
-
return PREFIX + "platformIncome.html";
}
@@ -115,15 +116,16 @@
public Object getIncomeData(Integer operatorId,Integer storeId) {
// 报名课程查询query
RegisterOrderQuery query = new RegisterOrderQuery();
- // 充值记录查询query
+ // 充值记录查询query
RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery();
// 赛事活动查询query
CompetitionQuery competitionQuery = new CompetitionQuery();
-
// 会员支付查询query
IncomeQuery incomeQuery = new IncomeQuery();
// 场地预约记录查询query
SiteBookingQuery siteBookingQuery = new SiteBookingQuery();
+ // 智慧球场查询query
+ GameDataQuery gameDataQuery = new GameDataQuery();
// 筛选运营商的是时候使用
List<Integer> storeIds = new ArrayList<>();
// 根据运营商ID 查询运营商下的所有门店
@@ -150,13 +152,14 @@
query.setInsertType(roleType);
competitionQuery.setInsertType(roleType);
incomeQuery.setInsertType(roleType);
+ rechargeRecordsQuery.setObjectId(UserExt.getUser().getObjectId());
List<IncomeVO> incomeVOS = new ArrayList<>();
// 会员支付记录
List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery);
for (VipPayment vipPayment : vipPayments) {
IncomeVO temp = new IncomeVO();
- if (vipPayment.getPayStatus()==1){
- temp.setInsertTime(vipPayment.getInsertTime());
+ if (vipPayment.getState()!=3){
+ temp.setInsertTime(vipPayment.getPayTime());
incomeVOS.add(temp);
}
if (vipPayment.getAmount() != null) {
@@ -167,14 +170,13 @@
List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(rechargeRecordsQuery);
for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) {
IncomeVO temp = new IncomeVO();
- temp.setInsertTime(rechargeRecordsVO.getInsertTime());
+ temp.setInsertTime(rechargeRecordsVO.getPayTime());
if (rechargeRecordsVO.getAmount() != null) {
temp.setAmount(rechargeRecordsVO.getAmount());
}
- if (rechargeRecordsVO.getPayStatus() ==1){
+ if (rechargeRecordsVO.getState() !=3){
incomeVOS.add(temp);
}
-
}
// 报名课程记录
List<RegisterOrderVO> registerOrderVOS = coursePackagePaymentClient.listAllRegister(query);
@@ -191,6 +193,10 @@
incomeVOS.add(temp);
}
}
+ // query权限设置 获取运营商下的门店集合
+ if (roleType==2){
+ competitionQuery.setOperatorId(UserExt.getUser().getObjectId());
+ }
// 报名活动
List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery);
for (PaymentCompetition competition : competitions) {
@@ -200,8 +206,9 @@
if (competition.getPayType()==3 || competition.getPayType()==4){
continue;
}
+ if (competition.getState()==3)continue;
IncomeVO temp = new IncomeVO();
- temp.setInsertTime(competition.getInsertTime());
+ temp.setInsertTime(competition.getPayTime());
if (competition.getAmount() != null) {
temp.setAmount(new BigDecimal(competition.getAmount().toString()));
}
@@ -214,9 +221,10 @@
List<SiteBooking> siteBookings = siteClient.listAll(siteBookingQuery);
for (SiteBooking siteBooking : siteBookings) {
IncomeVO temp = new IncomeVO();
- if(siteBooking.getStatus()!=3){
+ if(siteBooking.getStatus()==0 || siteBooking.getStatus()==5){
continue;
}
+ if (siteBooking.getPayType() ==3 || siteBooking.getPayType() ==4)continue;
temp.setInsertTime(siteBooking.getPayTime());
if (siteBooking.getPayMoney() != null) {
temp.setAmount(new BigDecimal(siteBooking.getPayMoney().toString()));
@@ -229,9 +237,43 @@
List<PointMerchandiseIncomeVo> amount = pointMercharsClient.getAmount();
for (PointMerchandiseIncomeVo pointMerchandiseIncomeVo : amount) {
IncomeVO temp = new IncomeVO();
+ if (pointMerchandiseIncomeVo==null) continue;
temp.setInsertTime(pointMerchandiseIncomeVo.getInsertTime());
if (pointMerchandiseIncomeVo.getCash()!=null){
temp.setAmount(pointMerchandiseIncomeVo.getCash());
+ incomeVOS.add(temp);
+ }
+ }
+ // 平台智慧球场
+ if (storeId==null&&operatorId==null){
+ gameDataQuery.setObjectId(0);
+ List<TGameRecord> data = ballClient.getData(gameDataQuery);
+ for (TGameRecord datum : data) {
+ IncomeVO temp = new IncomeVO();
+ temp.setAmount(datum.getMoney());
+ temp.setInsertTime(datum.getTime());
+ incomeVOS.add(temp);
+ }
+ }
+ // 运营商
+ if (operatorId!=null && storeId==null){
+ gameDataQuery.setObjectId(operatorId);
+ List<TGameRecord> data = ballClient.getData(gameDataQuery);
+ for (TGameRecord datum : data) {
+ IncomeVO temp = new IncomeVO();
+ temp.setAmount(datum.getMoney());
+ temp.setInsertTime(datum.getTime());
+ incomeVOS.add(temp);
+ }
+ }
+ // 门店
+ if (storeId!=null){
+ gameDataQuery.setStoreId(storeId);
+ List<TGameRecord> data = ballClient.getData(gameDataQuery);
+ for (TGameRecord datum : data) {
+ IncomeVO temp = new IncomeVO();
+ temp.setAmount(datum.getMoney());
+ temp.setInsertTime(datum.getTime());
incomeVOS.add(temp);
}
}
@@ -274,7 +316,7 @@
int years = DateUtil.year(new Date());
for (int i = 0; i < 10; i++) {
integers1.add(years-i);
- }
+ }
List<Object> collect = integers1.stream().sorted().collect(Collectors.toList());
List<Object> objects1 = new ArrayList<>();
for (Object o : collect) {
@@ -444,39 +486,39 @@
List<MoneyBack> refund = refundCoursePackageClient.getRefund();
for (MoneyBack moneyBack : refund) {
- List<TCoursePackagePayment> coursePackagePayments = courseStuddentClient.queryByIds(moneyBack.getIds());
+ List<CoursePackageOrderStudent> coursePackagePayments = courseStuddentClient.queryByIds(moneyBack.getIds());
BigDecimal totalAmount = BigDecimal.ZERO;
- for (TCoursePackagePayment payment : coursePackagePayments){
- //课包名称
- TCoursePackage tCoursePackage = coursePackageClient.queryById(payment.getCoursePackageId());
- payment.setName(tCoursePackage.getName());
- payment.setId(Long.valueOf(tCoursePackage.getId()));
- BigDecimal cashPayment = payment.getCashPayment();
- if (cashPayment==null){
- cashPayment = BigDecimal.ZERO;
- }
- Integer totalClassHours = payment.getTotalClassHours();
- BigDecimal result = new BigDecimal(0);
- if (totalClassHours!=0) {
- result = cashPayment.divide(BigDecimal.valueOf(totalClassHours), 2, RoundingMode.HALF_UP);
- }
- //单价
- payment.setOnePrice(result);
- int has = payment.getTotalClassHours() - payment.getLaveClassHours();
- //剩余课时
- payment.setHasHours(has);
- BigDecimal onePrice = payment.getOnePrice();
- Integer laveClassHours = payment.getLaveClassHours();
- BigDecimal result1 = onePrice.multiply(BigDecimal.valueOf(laveClassHours));
- //总价
- payment.setRestPrice(result1);
- System.out.println("======="+result1);
- totalAmount = totalAmount.add(result1);
- IncomeVO temp = new IncomeVO();
- temp.setInsertTime(payment.getInsertTime());
- temp.setAmount(result1);
- incomeVOS.add(temp);
- }
+// for (TCoursePackagePayment payment : coursePackagePayments){
+// //课包名称
+// TCoursePackage tCoursePackage = coursePackageClient.queryById(payment.getCoursePackageId());
+// payment.setName(tCoursePackage.getName());
+// payment.setId(Long.valueOf(tCoursePackage.getId()));
+// BigDecimal cashPayment = payment.getCashPayment();
+// if (cashPayment==null){
+// cashPayment = BigDecimal.ZERO;
+// }
+// Integer totalClassHours = payment.getTotalClassHours();
+// BigDecimal result = new BigDecimal(0);
+// if (totalClassHours!=0) {
+// result = cashPayment.divide(BigDecimal.valueOf(totalClassHours), 2, RoundingMode.HALF_UP);
+// }
+// //单价
+// payment.setOnePrice(result);
+// int has = payment.getTotalClassHours() - payment.getLaveClassHours();
+// //剩余课时
+// payment.setHasHours(has);
+// BigDecimal onePrice = payment.getOnePrice();
+// Integer laveClassHours = payment.getLaveClassHours();
+// BigDecimal result1 = onePrice.multiply(BigDecimal.valueOf(laveClassHours));
+// //总价
+// payment.setRestPrice(result1);
+// System.out.println("======="+result1);
+// totalAmount = totalAmount.add(result1);
+// IncomeVO temp = new IncomeVO();
+// temp.setInsertTime(payment.getInsertTime());
+// temp.setAmount(result1);
+// incomeVOS.add(temp);
+// }
}
// 获取赛事退费记录
List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery);
@@ -714,6 +756,9 @@
@RequestMapping(value = "/backStore")
@ResponseBody
public Object backStore(Integer id) {
+ if(UserExt.getUser().getObjectType()==3){
+ id = UserExt.getUser().getObjectId();
+ }
HashMap<String, Object> map = new HashMap<>();
List<Integer> userPt = appUserClient.getUserStore(id);
if(userPt.size()==0){
@@ -831,11 +876,40 @@
HashMap<String, Object> map = appUserClient.stuPt();
return map;
}
+ @RequestMapping(value = "/stuYys")
+ @ResponseBody
+ public Object stuYys(Integer id) {
+ HashMap<String, Object> map = appUserClient.stuYys(id);
+ return map;
+ }
+ @RequestMapping(value = "/stuStores")
+ @ResponseBody
+ public Object stuStores(Integer id) {
+ HashMap<String, Object> map = appUserClient.stuStores(id);
+ return map;
+ }
+ // 消耗课时数据-平台
@RequestMapping(value = "/coursePt")
@ResponseBody
public Object coursePt() {
List<Integer> userPt = appUserClient.getUserPt(Arrays.asList(1));
+ HashMap<String, Object> map = coursePackagePaymentClient.coursePt(userPt);
+ return map;
+ }
+ // 消耗课时数据-运营商
+ @RequestMapping(value = "/courseYys")
+ @ResponseBody
+ public Object courseYys(Integer id) {
+ List<Integer> userPt = appUserClient.getUserYYs(id);
+ HashMap<String, Object> map = coursePackagePaymentClient.coursePt(userPt);
+ return map;
+ }
+ // 消耗课时数据-运营商
+ @RequestMapping(value = "/courseStore")
+ @ResponseBody
+ public Object courseStore(Integer id) {
+ List<Integer> userPt = appUserClient.getUserPt(Arrays.asList(id));
HashMap<String, Object> map = coursePackagePaymentClient.coursePt(userPt);
return map;
}
@@ -849,6 +923,9 @@
@RequestMapping(value = "/userAndVipStore")
@ResponseBody
public Object userAndVipStore(Integer id) {
+ if(UserExt.getUser().getObjectType()==3){
+ id = UserExt.getUser().getObjectId();
+ }
HashMap<String, Object> map = appUserClient.userAndVipStore(id);
return map;
}
@@ -882,10 +959,14 @@
@RequestMapping(value = "/actYys")
@ResponseBody
public Object actYys(Integer id) {
- List<Integer> userPt = appUserClient.getUserYYs(id);
- HashMap<String, Object> map = competitionClient.actPt(userPt);
+ CompetionVO competionVO = new CompetionVO();
- List<TStore> list = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getOperatorId, 0));
+ List<Integer> userPt = appUserClient.getUserYYs(id);
+ competionVO.setIds(userPt);
+ competionVO.setOperatorId(id);
+ HashMap<String, Object> map = competitionClient.actYys(competionVO);
+
+ List<TStore> list = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getOperatorId, id));
long l1=0;
for (TStore tStore : list) {
long l = DateUtil.betweenDay(tStore.getCreateTime(), new Date(), true);
@@ -899,7 +980,7 @@
if(integer==0 && integer1==0){
a=24;
}else {
- a= integer1-integer;
+ a= integer-integer1;
}
l1 += l * a;
}
@@ -909,6 +990,12 @@
@RequestMapping(value = "/actStore")
@ResponseBody
public Object actStore(Integer id) {
+
+
+ Integer objectType = UserExt.getUser().getObjectType();
+ if(objectType==3){
+ id = UserExt.getUser().getObjectId();
+ }
List<Integer> userPt = appUserClient.getUserStore(id);
HashMap<String, Object> map = competitionClient.actPt(userPt);
@@ -942,9 +1029,12 @@
@RequestMapping("/operator")
public String operator(Model model) {
Integer objectType = UserExt.getUser().getObjectType();
- List<TOperator> list = operatorService.list(new LambdaQueryWrapper<TOperator>().ne(TOperator::getState, 3));
+ Integer objectId = UserExt.getUser().getObjectId();
+
+ List<TOperator> list = operatorService.list(new LambdaQueryWrapper<TOperator>().ne(TOperator::getState, 3).ne(TOperator::getId,0));
model.addAttribute("list",list);
model.addAttribute("objectType",objectType);
+ model.addAttribute("objectId",objectId);
return PREFIX + "operatorIncome.html";
}
@@ -1068,6 +1158,10 @@
// 找出平台的用户
List<User> list = sysUserService.list(new LambdaQueryWrapper<User>().eq(User::getObjectType, 2));
List<Integer> ids = list.stream().map(User::getId).collect(Collectors.toList());
+ Integer objectType = UserExt.getUser().getObjectType();
+ if(objectType==3){
+ id = UserExt.getUser().getObjectId();
+ }
List<Integer> userIds = appUserClient.getUserStore(id);
QueryDataFee queryDataFee = new QueryDataFee(time, userIds);
// 会员费
@@ -1169,9 +1263,17 @@
@RequestMapping("/store")
public String store(Model model) {
Integer objectType = UserExt.getUser().getObjectType();
- List<TStore> list = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getState, 1));
- model.addAttribute("list",list);
+ List<TStore> tStores = new ArrayList<>();
+
+ if (objectType == 2){
+ tStores = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getState, 1).eq(TStore::getOperatorId,UserExt.getUser().getObjectId()));
+ }
+ if (objectType == 3){
+ tStores = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getState, 1).eq(TStore::getId,UserExt.getUser().getObjectId()));
+ }
+ model.addAttribute("list",tStores);
model.addAttribute("objectType",objectType);
+ model.addAttribute("objectId",UserExt.getUser().getObjectId());
return PREFIX + "storeIncome.html";
}
@@ -1195,7 +1297,6 @@
// 会员费
HashMap<String, Object> map1 = appUserClient.queryFee(queryDataFee);
Object fee1 = map1.get("fee1");
-
map.put("fee1",fee1);
//玩湃比
Object fee2 = map1.get("fee2");
@@ -1205,12 +1306,9 @@
map.put("fee3",map3.get("fee"));
Object data = map3.get("data");
map.put("courseData",data);
-
-
// 赛事收入
Double aDouble1 = competitionClient.queryFee(queryDataFee);
map.put("fee4",aDouble1);
-
// 订场
if(ids.size()==0){
ids.add(-1);
@@ -1224,15 +1322,28 @@
if(userIds.size()==0){
userIds.add(-1);
}
- vipPaymentLambdaQueryWrapper.in(SiteBooking::getAppUserId,userIds);
vipPaymentLambdaQueryWrapper.ne(SiteBooking::getStatus,0);
+ vipPaymentLambdaQueryWrapper.ne(SiteBooking::getStatus,5);
ArrayList<Integer> objects = new ArrayList<>();
objects.add(1);
objects.add(2);
vipPaymentLambdaQueryWrapper.in(SiteBooking::getPayType,objects);
- List<SiteBooking> list1 = siteBookingService.list(vipPaymentLambdaQueryWrapper);
+ List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>()
+ .ne("status",0)
+ .ne("status",5)
+ .ne("payType",3)
+ .ne("payType",4));
double sum = list1.stream().mapToDouble(SiteBooking::getPayMoney).sum();
- map.put("fee5",sum);
+ // 智慧球场查询query
+ GameDataQuery gameDataQuery = new GameDataQuery();
+ gameDataQuery.setObjectId(0);
+ // 平台智慧球场
+ List<TGameRecord> data1 = ballClient.getData(gameDataQuery);
+ double sum1 = data1.stream()
+ .map(TGameRecord::getMoney) // 获取每个 TGameRecord 对象的 money 字段
+ .mapToDouble(BigDecimal::doubleValue) // 将 BigDecimal 转换为 double
+ .sum();
+ map.put("fee5",sum+sum1);
List<Integer> collect = list1.stream().map(SiteBooking::getSiteId).collect(Collectors.toList());
@@ -1316,14 +1427,18 @@
@ResponseBody
public Object stuUserDataYys(Integer id) {
ArrayList<Integer> objects = new ArrayList<>();
+
objects.add(1);
- HashMap<String, Object> map = appUserClient.queryUserAgeYys(id);
+ HashMap<String, Object> map = appUserClient.queryUserAgeYys(operatorService.getById(id).getId());
return map;
}
@RequestMapping("/stuUserDataStore")
@ResponseBody
public Object stuUserDataStore(Integer id) {
+ if(UserExt.getUser().getObjectType()==3){
+ id = UserExt.getUser().getObjectId();
+ }
ArrayList<Integer> objects = new ArrayList<>();
objects.add(1);
HashMap<String, Object> map = appUserClient.queryUserAgeStore(id);
@@ -1359,6 +1474,10 @@
@RequestMapping("/selectStoreJx")
@ResponseBody
public Object selectStoreJx(Integer id) {
+ Integer objectType = UserExt.getUser().getObjectType();
+ if(objectType==3){
+ id = UserExt.getUser().getObjectId();
+ }
ArrayList<Integer> objects = new ArrayList<>();
objects.add(1);
HashMap<String, Object> map1 = appUserClient.queryUserAgeStore1(id);
--
Gitblit v1.7.1