功能完善

This commit is contained in:
Renpc-kilig 2021-06-17 15:31:57 +08:00
parent b1404141fb
commit 00624f2957
5 changed files with 27 additions and 10 deletions

View File

@ -15,6 +15,7 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -98,7 +99,7 @@ public class ExamPlanController extends DefaultBaseController {
@ApiOperation(value = "考试计划列表", notes = "考试计划列表接口") @ApiOperation(value = "考试计划列表", notes = "考试计划列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list") @GetMapping("list")
public List<ExamPlanDTO> list() { public List<ExamPlanDTO> list() throws ParseException {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
return examPlanService.list(params); return examPlanService.list(params);
} }
@ -113,7 +114,7 @@ public class ExamPlanController extends DefaultBaseController {
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage") @GetMapping("listpage")
public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) { public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) throws ParseException {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
page.setParams(params); page.setParams(params);
return examPlanService.listPage(page); return examPlanService.listPage(page);

View File

@ -15,6 +15,7 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -88,7 +89,7 @@ public class ExamPlanAppController extends DefaultBaseController {
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list") @GetMapping("list")
public List<ExamPlanDTO> list(@RequestHeader("token") String token) { public List<ExamPlanDTO> list(@RequestHeader("token") String token) throws ParseException {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
return examPlanService.list(params); return examPlanService.list(params);
} }
@ -104,7 +105,7 @@ public class ExamPlanAppController extends DefaultBaseController {
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpageexamplan") @GetMapping("listpageexamplan")
public SuccessResultList<List<ExamPlanDTO>> listPage(@RequestHeader("token") String token, ListPage page) { public SuccessResultList<List<ExamPlanDTO>> listPage(@RequestHeader("token") String token, ListPage page) throws ParseException {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
params.put("token", token); params.put("token", token);
page.setParams(params); page.setParams(params);

View File

@ -15,6 +15,7 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -88,7 +89,7 @@ public class ExamPlanResourceController extends DefaultBaseController {
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list") @GetMapping("list")
public List<ExamPlanDTO> list() { public List<ExamPlanDTO> list() throws ParseException {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
return examPlanService.list(params); return examPlanService.list(params);
} }
@ -104,7 +105,7 @@ public class ExamPlanResourceController extends DefaultBaseController {
}) })
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpage") @GetMapping("listpage")
public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) { public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) throws ParseException {
Map<String, Object> params = requestParams(); Map<String, Object> params = requestParams();
page.setParams(params); page.setParams(params);
return examPlanService.listPage(page); return examPlanService.listPage(page);

View File

@ -7,6 +7,7 @@ import cn.com.tenlion.pojo.vos.examplan.ExamPlanVO;
import ink.wgink.pojo.ListPage; import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList; import ink.wgink.pojo.result.SuccessResultList;
import java.text.ParseException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -151,7 +152,7 @@ public interface IExamPlanService {
* @param params * @param params
* @return * @return
*/ */
List<ExamPlanDTO> list(Map<String, Object> params); List<ExamPlanDTO> list(Map<String, Object> params) throws ParseException;
/** /**
* 考试计划列表 * 考试计划列表
@ -175,7 +176,7 @@ public interface IExamPlanService {
* @param page * @param page
* @return * @return
*/ */
SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page); SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) throws ParseException;
/** /**
* 考试计划统计 * 考试计划统计

View File

@ -30,6 +30,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
@ -231,12 +234,15 @@ public class ExamPlanServiceImpl extends DefaultBaseService implements IExamPlan
} }
@Override @Override
public List<ExamPlanDTO> list(Map<String, Object> params) { public List<ExamPlanDTO> list(Map<String, Object> params) throws ParseException {
String[] examPlanIds = params.get("examPlanIdList") == null ? null : params.get("examPlanIdList").toString().split(","); String[] examPlanIds = params.get("examPlanIdList") == null ? null : params.get("examPlanIdList").toString().split(",");
params.put("examPlanIdList", examPlanIds); params.put("examPlanIdList", examPlanIds);
List<ExamPlanDTO> list = examPlanDao.list(params); List<ExamPlanDTO> list = examPlanDao.list(params);
String token = params.get("token") == null ? null : params.get("token").toString(); String token = params.get("token") == null ? null : params.get("token").toString();
if(null != list && list.size() > 0) { if(null != list && list.size() > 0) {
// 获取当前时间判断是否到了报名截至日期
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTime = simpleDateFormat.format(new Date());
for(ExamPlanDTO examPlanDTO: list) { for(ExamPlanDTO examPlanDTO: list) {
examPlanDTO.setBtnStatus("确认报考"); examPlanDTO.setBtnStatus("确认报考");
Integer count = Integer.valueOf(examPlanDTO.getExamCount()); Integer count = Integer.valueOf(examPlanDTO.getExamCount());
@ -281,6 +287,13 @@ public class ExamPlanServiceImpl extends DefaultBaseService implements IExamPlan
examPlanDTO.setBtnStatus("暂停申报"); examPlanDTO.setBtnStatus("暂停申报");
} }
} }
String endTime = examPlanDTO.getEndTime();
// 时间比较
Date nowDate = simpleDateFormat.parse(nowTime);
Date endDate = simpleDateFormat.parse(endTime);
if(nowDate.getTime() <= endDate.getTime()) {
examPlanDTO.setBtnStatus("报名截止");
}
} }
} }
return list; return list;
@ -297,7 +310,7 @@ public class ExamPlanServiceImpl extends DefaultBaseService implements IExamPlan
} }
@Override @Override
public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) { public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) throws ParseException {
PageHelper.startPage(page.getPage(), page.getRows()); PageHelper.startPage(page.getPage(), page.getRows());
List<ExamPlanDTO> examPlanDTOs = list(page.getParams()); List<ExamPlanDTO> examPlanDTOs = list(page.getParams());
PageInfo<ExamPlanDTO> pageInfo = new PageInfo<>(examPlanDTOs); PageInfo<ExamPlanDTO> pageInfo = new PageInfo<>(examPlanDTOs);