package com.bupt.trainbookingsystem.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bupt.trainbookingsystem.annotation.OperationLogDetail;
import com.bupt.trainbookingsystem.entity.*;
import com.bupt.trainbookingsystem.entity.custom.Pay_userinfo;
import com.bupt.trainbookingsystem.entity.custom.Selectcontactor;
import com.bupt.trainbookingsystem.entity.custom.Userorder_search;
import com.bupt.trainbookingsystem.entity.searchResult.SearchTrip;
import com.bupt.trainbookingsystem.service.*;
import com.fasterxml.jackson.annotation.JsonAlias;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.*;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.jms.Queue;
import javax.servlet.http.HttpSession;
import java.math.BigDecimal;
import java.security.PublicKey;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 个人中心
* 编辑:严智琪
*/
@Controller
public class PCenterController {
@Autowired
ContactService contactorsmethods;
@Autowired
UserOrderService userOrderService;
@Autowired
OrdinaryUserService userService;
@Autowired
StationsService stationsService;
@Autowired
SeatService seatService;
@Autowired
TrainService trainService;
//生成订单
@Autowired
TripService tripService;
@Autowired
RoutelineService routelineService;
@Autowired
FareService fareService;
@Autowired
private JmsMessagingTemplate jmsMessagingTemplate;
@Autowired
private Queue queue1;
@RequestMapping("/pcenter")
public String showpagestu(HttpSession session, Model model,
@RequestParam(value = "page", defaultValue = "0") int page,
@RequestParam(value = "page1", defaultValue = "0")int page1,
@RequestParam(value = "page2", defaultValue = "0")int page2,
@RequestParam(value = "page3",defaultValue = "0")int page3,
@RequestParam(value = "page4",defaultValue ="0")int page4){
OrdinaryUserEntity user=(OrdinaryUserEntity) session.getAttribute("user");
Timestamp nowtime=new Timestamp(System.currentTimeMillis());
if(user!=null){
Sort sort = Sort.by(Sort.Direction.DESC,"id");
Pageable pageable= PageRequest.of(page,6,sort);
Page<ContactEntity> contactuser=contactorsmethods.findallcontator(user.getId(),pageable);
List<Userorder_search> not_payorder=new ArrayList<>();
List<Userorder_search> not_goorder=new ArrayList<>();
List<Userorder_search> complete_order=new ArrayList<>();
List<Userorder_search> disabled_order=new ArrayList<>();
Pageable pageable4=PageRequest.of(page4,6,sort);
List<UserOrderEntity> orderdisabled=userOrderService.orderstate_get(user.getId(),"-1");
for(int i=0;i<orderdisabled.size();i++){
UserOrderEntity pay4=orderdisabled.get(i);
String[] route=pay4.getRoutLine().split("-");
String start=route[0];
String end=route[route.length-1];
Timestamp starttime=stationsService.getStationTimeByTripIdAndStation(start,pay4.getTripId());
if(starttime.before(nowtime)){
userOrderService.updateUserOrderEntityById("2",pay4.getId());
}
else {
Timestamp endtime = stationsService.getStationTimeByTripIdAndStation(end, pay4.getTripId());
Userorder_search pay_4 = new Userorder_search(pay4.getId(), pay4.getTripNumber(), pay4.getNameList(), pay4.getSeatList()
, pay4.getPrice(), start, end, starttime, endtime);
not_payorder.add(pay_4);
}
}
Page<Userorder_search> disabledorders=listConvertToPage(not_payorder,pageable4);
Pageable pageable3=PageRequest.of(page3,6,sort);
List<UserOrderEntity> ordernotpay=userOrderService.orderstate_get(user.getId(),"0");
for(int i=0;i<ordernotpay.size();i++){
UserOrderEntity pay0=ordernotpay.get(i);
String[] route=pay0.getRoutLine().split("-");
String start=route[0];
String end=route[route.length-1];
Timestamp starttime=stationsService.getStationTimeByTripIdAndStation(start,pay0.getTripId());
if(starttime.before(nowtime)){
userOrderService.updateUserOrderEntityById("2",pay0.getId());
}
else {
Timestamp endtime = stationsService.getStationTimeByTripIdAndStation(end, pay0.getTripId());
Userorder_search pay_0 = new Userorder_search(pay0.getId(), pay0.getTripNumber(), pay0.getNameList(), pay0.getSeatList()
, pay0.getPrice(), start, end, starttime, endtime);
not_payorder.add(pay_0);
}
}
Page<Userorder_search> notpayorders=listConvertToPage(not_payorder,pageable3);
Pageable pageable1=PageRequest.of(page1,6,sort);
List<UserOrderEntity> ordernotgo=userOrderService.orderstate_get(user.getId(),"1");
for(int i=0;i<ordernotgo.size();i++){
UserOrderEntity pay1=ordernotgo.get(i);
String[] route=pay1.getRoutLine().split("-");
String start=route[0];
String end=route[route.length-1];
Timestamp starttime=stationsService.getStationTimeByTripIdAndStation(start,pay1.getTripId());
if(starttime.before(nowtime)){
userOrderService.updateUserOrderEntityById("2",pay1.getId());
}
else {
Timestamp endtime = stationsService.getStationTimeByTripIdAndStation(end, pay1.getTripId());
Userorder_search pay_1 = new Userorder_search(pay1.getId(), pay1.getTripNumber(), pay1.getNameList(), pay1.getSeatList()
, pay1.getPrice(), start, end, starttime, endtime);
not_goorder.add(pay_1);
}
}
Page<Userorder_search> notgoorders=listConvertToPage(not_goorder,pageable1);
Pageable pageable2=PageRequest.of(page2,6,sort);
List<UserOrderEntity> ordercomplete=userOrderService.orderstate_get(user.getId(),"2");
for(int i=0;i<ordercomplete.size();i++){
UserOrderEntity pay2=ordercomplete.get(i);
String[] route=pay2.getRoutLine().split("-");
String start=route[0];
String end=route[route.length-1];
Timestamp starttime=stationsService.getStationTimeByTripIdAndStation(start,pay2.getTripId());
Timestamp endtime=stationsService.getStationTimeByTripIdAndStation(end,pay2.getTripId());
Userorder_search pay_2=new Userorder_search(pay2.getId(),pay2.getTripNumber(),pay2.getNameList(),pay2.getSeatList()
,pay2.getPrice(),start,end,starttime,endtime);
complete_order.add(pay_2);
}
Page<Userorder_search> completeorders=listConvertToPage(complete_o
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip基于springboot+vue开发的火车订票系统源码(毕设项目).zip
资源推荐
资源详情
资源评论
收起资源包目录
基于springboot+vue开发的火车订票系统源码(毕设项目).zip (164个子文件)
mvnw.cmd 6KB
app.b0ef315706a4a9658cbb83bf49fc6e59.css 228KB
.gitignore 444B
ticketCenter.html 95KB
managercenter.html 51KB
personalcenter.html 33KB
reBook_search.html 15KB
search.html 15KB
buyticket.html 14KB
gaiqianpay.html 13KB
pay.html 9KB
index.html 8KB
search_new.html 7KB
register.html 7KB
ticketlogin.html 3KB
managerlogin.html 3KB
login.html 3KB
404.html 1KB
index.html 546B
template.html 527B
maven-wrapper.jar 50KB
PCenterController.java 31KB
Changeticket.java 19KB
TicketCenterRestController.java 19KB
OrderConsumer.java 11KB
IndexRestController.java 10KB
ManagerCenterRestController.java 8KB
AdministratorService.java 6KB
SysLogAspect.java 6KB
LogAspect.java 6KB
TripEntity.java 6KB
UserOrderEntity.java 5KB
MavenWrapperDownloader.java 5KB
OrdinaryUserEntity.java 5KB
LoginfoEntity.java 5KB
UserOrderServiceImp.java 4KB
SearchTrip.java 4KB
IPUtil.java 4KB
OperationLog.java 3KB
AdministratorServiceImp.java 3KB
TicketCenterController.java 3KB
SecurityConfiguration.java 3KB
TripServiceImpl.java 3KB
LoginController.java 3KB
TicketManagerServiceImp.java 3KB
Aes.java 3KB
FareEntity.java 3KB
Pay_userinfo.java 3KB
OrdinaryUserServiceImp.java 3KB
ContactEntity.java 3KB
SeatEntity.java 3KB
MainController.java 3KB
Userorder_search.java 2KB
EntityUtils.java 2KB
StationsServiceImp.java 2KB
StationsEntity.java 2KB
UserOrderRepository.java 2KB
FareServiceImp.java 2KB
AdministratorEntity.java 2KB
ContactServiceImp.java 2KB
AuthenticationFilter.java 2KB
TicketManagerEntity.java 2KB
TripRepository.java 2KB
TrainEntity.java 2KB
RoutelineServiceImp.java 2KB
ManageCenterController.java 2KB
OrdinaryUserRepository.java 2KB
RoutelineEntity.java 2KB
TrainServiceImp.java 2KB
TicketManagerRepository.java 2KB
SysLog.java 2KB
Task.java 2KB
ContactRespository.java 2KB
AuthenticationProvider.java 2KB
AdvertisementServiceImp.java 2KB
SwaggerConfig.java 2KB
UserOrderService.java 2KB
AdvertisementEntity.java 1KB
TicketManagerService.java 1KB
RoutelineRepository.java 1KB
Selectcontactor.java 1KB
LogResultEntity.java 1KB
Intersepterconfig.java 1KB
TripWorstEntity.java 1KB
TripBestEntity.java 1KB
TripService.java 1KB
JacksonUtil.java 1KB
FareRespository.java 1KB
AdvertisementRespository.java 1KB
FileUtils.java 1KB
OrdinaryUserService.java 1KB
StationsRepository.java 1KB
TrainRepository.java 1KB
SeatRepository.java 1KB
Operation.java 1KB
SeatServiceImp.java 1KB
RedisConfig.java 1003B
logResultImp.java 955B
AdministratorRespository.java 932B
AdministratorService.java 919B
共 164 条
- 1
- 2
资源评论
- doroyu2024-05-20好旧的系统,运行不了
- zls_88888882024-01-10资源使用价值高,内容详实,给了我很多新想法,感谢大佬分享~
- 小秋今天也要加油吖2024-03-07资源不错,对我启发很大,获得了新的灵感,受益匪浅。
manylinux
- 粉丝: 4321
- 资源: 2491
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功