| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.MapUtils; |
| | | import com.ruoyi.domain.TravelCount; |
| | | import com.ruoyi.domain.TravelDetail; |
| | | import com.ruoyi.domain.ZfProperty; |
| | | 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.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Autowired |
| | | private TravelCountService travelCountService; |
| | | |
| | | @Autowired |
| | | ZInfoUserService zInfoUserService; |
| | | @Override |
| | | 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.lt(TravelCount::getEndTime,happenEndTime); |
| | | } |
| | | lqw.orderByDesc(TravelCount::getCreateTime); |
| | | |
| | | |
| | | System.out.println("--sdfdsf000sfssssssssssssssssss"); |
| | | //根据userId查询到infouser的uaid |
| | | 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(this::inputTotalData); |
| | |
| | | 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))); |
| | | } |