From 6d727d545a19120f31c633957b2cf340df4a3eb1 Mon Sep 17 00:00:00 2001
From: feige <feige@qq.com>
Date: 星期四, 13 十一月 2025 10:28:12 +0800
Subject: [PATCH] 修改了一个bug
---
zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountServiceImpl.java | 104 +++++++++++++++++++++++++++++++++++++--------------
1 files changed, 75 insertions(+), 29 deletions(-)
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountServiceImpl.java
index e8a3c85..046f112 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/TravelCountServiceImpl.java
@@ -8,15 +8,19 @@
import com.ruoyi.common.utils.MapUtils;
import com.ruoyi.domain.TravelCount;
import com.ruoyi.domain.TravelDetail;
+import com.ruoyi.domain.ZInfoUser;
+import com.ruoyi.domain.ZProperty;
import com.ruoyi.mapper.TravelCountMapper;
import com.ruoyi.service.TravelCountService;
import com.ruoyi.service.TravelDetailService;
+import com.ruoyi.service.ZInfoUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.DecimalFormat;
import java.util.List;
+import java.util.stream.Collectors;
/**
* <p>
@@ -34,39 +38,48 @@
@Autowired
private TravelCountService travelCountService;
-
+ @Autowired
+ ZInfoUserService zInfoUserService;
@Override
- public AjaxResult selectDataList(Long userId, Integer pageNum, Integer pageSize) {
+ public AjaxResult selectDataList(Long userId, Integer pageNum, Integer pageSize, TravelCount travelCount, String happenStartTime, String happenEndTime) {
+ //璁剧疆鏌ヨ鏉′欢
LambdaQueryWrapper<TravelCount> lqw = new LambdaQueryWrapper<>();
- lqw.eq(TravelCount::getUid,userId);
+ // lqw.eq(TravelCount::getUid,userId);
+ if(travelCount!=null){
+ lqw.like(travelCount.getName()!=null,TravelCount::getName,travelCount.getName());
+ lqw.like(travelCount.getDestination()!=null,TravelCount::getDestination,travelCount.getDestination());
+ lqw.like(travelCount.getProperty()!=null,TravelCount::getProperty,travelCount.getProperty());
+ lqw.like(travelCount.getManner()!=null,TravelCount::getManner,travelCount.getManner());
+ lqw.like(travelCount.getName()!=null,TravelCount::getName,travelCount.getName());
+ lqw.like(travelCount.getName()!=null,TravelCount::getName,travelCount.getName());
+ lqw.like(travelCount.getName()!=null,TravelCount::getName,travelCount.getName());
+ }
+ if(happenStartTime!=null){
+ lqw.gt(TravelCount::getStartTime,happenStartTime);
+ }
+
+ if(happenEndTime!=null){
+ lqw.lt(TravelCount::getEndTime,happenEndTime);
+ }
+ lqw.orderByDesc(TravelCount::getCreateTime);
+
+
+ System.out.println("--sdfdsf000sfssssssssssssssssss");
+ //鏍规嵁userId鏌ヨ鍒癷nfouser鐨剈aid
+ ZInfoUser zInfoUser = zInfoUserService.getInfoBysysId(userId);
+ //鎷垮埌鎵�鏈夌殑sysid
+ List<Long> fms = zInfoUserService.findByUaidToFaid(zInfoUser.getUaid()).stream().map(ZInfoUser::getSysId).collect(Collectors.toList());
+// LambdaQueryWrapper<TravelCount> lqw;
+ if(!fms.isEmpty())
+ lqw = lqw.in(TravelCount::getUid, fms);
+ else
+ lqw.eq(TravelCount::getUid,userId);
+// else
+// lqw = buildCondition(zProperty, userId);
+
Page<TravelCount> resultPage = page(new Page<>(pageNum, pageSize), lqw);
-
- resultPage.getRecords().forEach(data ->{
- //鍏堟壘鍒板搴斾竴鏉$粺璁℃暟鎹殑鎵�鏈夎缁嗘暟鎹�
- List<TravelDetail> travelDetailList = travelDetailService.getDataByCid(data.getId());
- double entranceTotal = 0;
- double eatTotal = 0;
- double stayTotal = 0;
- double travelTotal = 0;
-
- //鎶婃墍鏈夎缁嗘暟鎹殑璐圭敤鍊肩疮鍔犺捣鏉�
- for (TravelDetail detail : travelDetailList) {
- entranceTotal+=detail.getEntrance();
- eatTotal+=detail.getEat();
- stayTotal+=detail.getStay();
- travelTotal+=detail.getTravel();
- }
-
- data.setEntranceTotal(entranceTotal);
- data.setEatTotal(eatTotal);
- data.setStayTotal(stayTotal);
- data.setTravelTotal(travelTotal);
-
- DecimalFormat df = new DecimalFormat("0.00");
- data.setTotalPrice(Double.parseDouble(df.format(entranceTotal+eatTotal+data.getGroupTotal()+stayTotal+travelTotal)));
- });
-
+ resultPage.getRecords().forEach(this::inputTotalData);
return AjaxResult.success(MapUtils.getResult(resultPage));
}
@@ -83,4 +96,37 @@
//鍐嶅垹闄よ嚜宸辫〃鐨勬暟鎹�
travelCountService.removeBatchByIds(list);
}
+
+ @Override
+ public TravelCount getDataById(Long id) {
+ TravelCount travelCount = getById(id);
+ inputTotalData(travelCount);
+ return travelCount;
+ }
+
+ private void inputTotalData(TravelCount travelCount){
+ //鍏堟壘鍒板搴斾竴鏉$粺璁℃暟鎹殑鎵�鏈夎缁嗘暟鎹�
+ List<TravelDetail> travelDetailList = travelDetailService.getDataByCid(travelCount.getId(),null);
+ double entranceTotal = 0;
+ double eatTotal = 0;
+ double stayTotal = 0;
+ double travelTotal = 0;
+ double shopTotal = 0;
+ //鎶婃墍鏈夎缁嗘暟鎹殑璐圭敤鍊肩疮鍔犺捣鏉�
+ for (TravelDetail detail : travelDetailList) {
+ entranceTotal+=detail.getEntrance();
+ eatTotal+=detail.getEat();
+ stayTotal+=detail.getStay();
+ travelTotal+=detail.getTravel();
+ shopTotal += detail.getShop();
+ }
+
+ travelCount.setEntranceTotal(entranceTotal);
+ travelCount.setEatTotal(eatTotal);
+ travelCount.setStayTotal(stayTotal);
+ travelCount.setTravelTotal(travelTotal);
+ travelCount.setShopTotal(shopTotal);
+ DecimalFormat df = new DecimalFormat("0.00");
+ travelCount.setTotalPrice(Double.parseDouble(df.format(entranceTotal+eatTotal+travelCount.getGroupTotal()+stayTotal+travelTotal)));
+ }
}
--
Gitblit v1.9.1