-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
1,586 additions
and
2 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
business/src/main/java/com/pds/business/controller/web/TrainTicketController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.pds.business.controller.web; | ||
|
||
|
||
import com.pds.business.mapper.TrainTicketMapper; | ||
import com.pds.business.req.TrainTicketQueryReq; | ||
import com.pds.business.resp.TrainQueryResp; | ||
|
||
import com.pds.business.resp.TrainTicketQueryResp; | ||
import com.pds.business.service.TrainTicketService; | ||
import com.pds.common.resp.CommonResp; | ||
import com.pds.common.resp.PageResp; | ||
import jakarta.validation.Valid; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.text.ParseException; | ||
|
||
@RestController | ||
@RequestMapping("/web/trainTicket") | ||
public class TrainTicketController { | ||
|
||
|
||
@Autowired | ||
private TrainTicketService trainTicketService; | ||
|
||
/** | ||
* 查询接受日期参数 | ||
* 所有的train信息+余票 | ||
* 没有则为每个train新建1000张票 | ||
* @param req | ||
* @return | ||
*/ | ||
@GetMapping("/queryByDate") | ||
public CommonResp<Object> save(@Valid TrainTicketQueryReq req) throws ParseException { | ||
PageResp<TrainTicketQueryResp> page = trainTicketService.queryPageByParam(req); | ||
return new CommonResp<>(page); | ||
} | ||
|
||
/** | ||
* 购票 | ||
* 用户id trainId 车次 日期 | ||
* trainId ticketNum() | ||
* @param req | ||
* @return | ||
*/ | ||
@PostMapping("/orderTic") | ||
public CommonResp<Object> orderTicket( @RequestBody TrainTicketQueryReq req) { | ||
trainTicketService.orderTic(req); | ||
return new CommonResp<>("购票成功"); | ||
} | ||
// | ||
// /** | ||
// * 退票 | ||
// * 用户id trainId 车次 日期 | ||
// * trainId ticketNum() | ||
// * @param req | ||
// * @return | ||
// */ | ||
// @PostMapping("/save") | ||
// public CommonResp<Object> save(@Valid @RequestBody ConfirmOrderDoReq req) { | ||
// confirmOrderService.save(req); | ||
// return new CommonResp<>(); | ||
// } | ||
// | ||
// /** | ||
// * 用户购票信息查询 | ||
// * 用户id 车票num 车次信息 | ||
// */ | ||
// @PostMapping("/save") | ||
// public CommonResp<Object> save(@Valid @RequestBody ConfirmOrderDoReq req) { | ||
// confirmOrderService.save(req); | ||
// return new CommonResp<>(); | ||
// } | ||
} |
70 changes: 70 additions & 0 deletions
70
business/src/main/java/com/pds/business/domain/TrainTicket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.pds.business.domain; | ||
|
||
import java.time.LocalDate; | ||
import java.util.Date; | ||
|
||
public class TrainTicket { | ||
private Long id; | ||
|
||
private Long trainId; | ||
|
||
private Integer ticketNum; | ||
|
||
private Integer saleFlag; | ||
|
||
private LocalDate saleDate; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
|
||
public LocalDate getSaleDate() { | ||
return saleDate; | ||
} | ||
|
||
public void setSaleDate(LocalDate saleDate) { | ||
this.saleDate = saleDate; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
final StringBuffer sb = new StringBuffer("TrainTicket{"); | ||
sb.append("id=").append(id); | ||
sb.append(", trainId=").append(trainId); | ||
sb.append(", ticketNum=").append(ticketNum); | ||
sb.append(", saleFlag=").append(saleFlag); | ||
sb.append(", saleDate=").append(saleDate); | ||
sb.append('}'); | ||
return sb.toString(); | ||
} | ||
|
||
public Long getTrainId() { | ||
return trainId; | ||
} | ||
|
||
public void setTrainId(Long trainId) { | ||
this.trainId = trainId; | ||
} | ||
|
||
public Integer getTicketNum() { | ||
return ticketNum; | ||
} | ||
|
||
public void setTicketNum(Integer ticketNum) { | ||
this.ticketNum = ticketNum; | ||
} | ||
|
||
public Integer getSaleFlag() { | ||
return saleFlag; | ||
} | ||
|
||
public void setSaleFlag(Integer saleFlag) { | ||
this.saleFlag = saleFlag; | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.