api-显示当前场馆的预订信息

This commit is contained in:
limqhz
2020-07-26 19:08:34 +08:00
parent 94b8e9c320
commit a4ff3a966d
6 changed files with 228 additions and 4 deletions

View File

@@ -80,6 +80,10 @@ public class PlatformIdInterceptor implements Interceptor {
if (checkUrl(request)){
return sql;
}
// 复杂SQL
if (sql.contains("GROUP BY")){
return sql;
}
StringBuilder condition = new StringBuilder(" 1 = 1 ");
String platformKey = PlatformContext.getKey();
if(StringUtils.isEmpty(platformKey))

View File

@@ -1,14 +1,85 @@
package com.sv.netty.controller;
import com.ydd.framework.core.common.dto.ResponseDTO;
import com.sv.dto.app.VenueLessonStatus;
import com.sv.service.api.VenueLessonService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
@RestController
public class AppVenueLessonController {
@RequestMapping("/getLessonOrder")
public ResponseDTO sendMessage1() {
return ResponseDTO.ok();
@Resource
private VenueLessonService venueLessonService;
/**
* 通过返回页面来进行拼接每个APP可以返回具体的场馆的课程预订情况
* @return
*/
@RequestMapping("/getLessonOrder/{id}")
public String getLessonOrder(@PathVariable("id") Integer id,String date) {
if (date == null && "".equals(date)){
LocalDate now = LocalDate.now();
date = now.toString();
}
// 如果传入时间非法,都改为今天
try {
LocalDate parse = LocalDate.parse(date);
date = parse.toString();
}catch (Exception e){
LocalDate now = LocalDate.now();
date = now.toString();
}
List<VenueLessonStatus> lessonOrder = venueLessonService.getLessonOrder(id, date);
if (lessonOrder != null && lessonOrder.size() > 0){
String returnHtml = concatResult(lessonOrder);
return returnHtml;
}else {
return "<h1 align=\"center\">~_~该场馆当天没有课程~_~<h1>";
}
}
private String concatResult(List<VenueLessonStatus> lessonOrder) {
StringBuffer sb = new StringBuffer();
sb.append("<html><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><head></head>");
sb.append("<body bgcolor=\"#3C3C3C\">");
sb.append("<h1 align=\"center\">【" + lessonOrder.get(0).getVenueName() + "】(" + lessonOrder.get(0).getSearchDate() + ")预订信息一览表" + "<h1>");
sb.append("<table width = 100% bgcolor=\"#FFFFFF\" align=\"center\" border=\"1\">");
sb.append("<tr bgcolor=\"#3399ff\" align=\"center\">" +
// "<td width = 10% style=\"font-size: 20px;\">场馆</td>" +
"<td width = 10% style=\"font-size: 20px;\">课程</td>" +
// "<td width = 8% style=\"font-size: 20px;\">日期</td>" +
"<td width = 10% style=\"font-size: 20px;\">时间</td>" +
"<td width = 4% style=\"font-size: 20px;\">总量</td>" +
"<td width = 4% style=\"font-size: 20px;\">预订</td>" +
"<td width = 4% style=\"font-size: 20px;\">剩余</td>" +
"<td width = 20% style=\"font-size: 20px;\">预约用户</td>" +
"<td width = 38% style=\"font-size: 20px;\">说明</td>" +
"</tr>");
// boolean firstLine = true;
for (VenueLessonStatus s : lessonOrder){
sb.append("<tr>");
// if (firstLine){
// sb.append( "<td width = 10% rowspan=" + lessonOrder.size() + ">"+ s.getVenueName() + "</td>");
// firstLine = false;
// }
sb.append( "<td width = 10% >"+ s.getLessonName() + "</td>");
// sb.append( "<td width = 8% >"+ s.getSearchDate() + "</td>");
sb.append( "<td width = 10%>"+ s.getStartTime() + "-" + s.getEndTime() + "</td>");
sb.append( "<td width = 4%>"+ s.getNum() + "</td>");
sb.append( "<td width = 4%>"+ s.getSaleNum() + "</td>");
sb.append( "<td width = 4%>"+ s.getLimitNum() + "</td>");
sb.append( "<td width = 20%>"+ s.getOrderUsers() + "</td>");
sb.append( "<td width = 38%>"+ s.getNote() + "</td>");
sb.append("</tr>");
}
sb.append("</table></body></html>");
return sb.toString();
}
}