功能完善
This commit is contained in:
parent
b1404141fb
commit
00624f2957
@ -15,6 +15,7 @@ import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -98,7 +99,7 @@ public class ExamPlanController extends DefaultBaseController {
|
||||
@ApiOperation(value = "考试计划列表", notes = "考试计划列表接口")
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list")
|
||||
public List<ExamPlanDTO> list() {
|
||||
public List<ExamPlanDTO> list() throws ParseException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return examPlanService.list(params);
|
||||
}
|
||||
@ -113,7 +114,7 @@ public class ExamPlanController extends DefaultBaseController {
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage")
|
||||
public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) {
|
||||
public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) throws ParseException {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return examPlanService.listPage(page);
|
||||
|
@ -15,6 +15,7 @@ import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -88,7 +89,7 @@ public class ExamPlanAppController extends DefaultBaseController {
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@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();
|
||||
return examPlanService.list(params);
|
||||
}
|
||||
@ -104,7 +105,7 @@ public class ExamPlanAppController extends DefaultBaseController {
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@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();
|
||||
params.put("token", token);
|
||||
page.setParams(params);
|
||||
|
@ -15,6 +15,7 @@ import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -88,7 +89,7 @@ public class ExamPlanResourceController extends DefaultBaseController {
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list")
|
||||
public List<ExamPlanDTO> list() {
|
||||
public List<ExamPlanDTO> list() throws ParseException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return examPlanService.list(params);
|
||||
}
|
||||
@ -104,7 +105,7 @@ public class ExamPlanResourceController extends DefaultBaseController {
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage")
|
||||
public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) {
|
||||
public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) throws ParseException {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return examPlanService.listPage(page);
|
||||
|
@ -7,6 +7,7 @@ import cn.com.tenlion.pojo.vos.examplan.ExamPlanVO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -151,7 +152,7 @@ public interface IExamPlanService {
|
||||
* @param params
|
||||
* @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
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page);
|
||||
SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) throws ParseException;
|
||||
|
||||
/**
|
||||
* 考试计划统计
|
||||
|
@ -30,6 +30,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -231,12 +234,15 @@ public class ExamPlanServiceImpl extends DefaultBaseService implements IExamPlan
|
||||
}
|
||||
|
||||
@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(",");
|
||||
params.put("examPlanIdList", examPlanIds);
|
||||
List<ExamPlanDTO> list = examPlanDao.list(params);
|
||||
String token = params.get("token") == null ? null : params.get("token").toString();
|
||||
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) {
|
||||
examPlanDTO.setBtnStatus("确认报考");
|
||||
Integer count = Integer.valueOf(examPlanDTO.getExamCount());
|
||||
@ -281,6 +287,13 @@ public class ExamPlanServiceImpl extends DefaultBaseService implements IExamPlan
|
||||
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;
|
||||
@ -297,7 +310,7 @@ public class ExamPlanServiceImpl extends DefaultBaseService implements IExamPlan
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) {
|
||||
public SuccessResultList<List<ExamPlanDTO>> listPage(ListPage page) throws ParseException {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<ExamPlanDTO> examPlanDTOs = list(page.getParams());
|
||||
PageInfo<ExamPlanDTO> pageInfo = new PageInfo<>(examPlanDTOs);
|
||||
|
Loading…
Reference in New Issue
Block a user