|
@@ -11,12 +11,14 @@ import com.miaxis.common.enums.BusinessTypeEnum;
|
|
|
import com.miaxis.common.utils.SecurityUtils;
|
|
|
import com.miaxis.score.domain.ScoreInfo;
|
|
|
import com.miaxis.score.dto.ScoreInfoAllDTO;
|
|
|
+import com.miaxis.score.dto.ScoreInfoDTO;
|
|
|
import com.miaxis.score.dto.ScoreInfoPcDTO;
|
|
|
import com.miaxis.score.dto.ScoreInfoUserIdDTO;
|
|
|
import com.miaxis.score.service.IScoreInfoService;
|
|
|
import com.miaxis.score.vo.ScoreIStudentInfoPcVo;
|
|
|
import com.miaxis.user.service.IUserInfoService;
|
|
|
import io.swagger.annotations.*;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -31,7 +33,7 @@ import java.util.List;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("score/info")
|
|
|
-@Api(tags={"【PC-模拟考成绩】"})
|
|
|
+@Api(tags = {"【PC-模拟考成绩】"})
|
|
|
public class PcScoreInfoController extends BaseController {
|
|
|
@Autowired
|
|
|
private IScoreInfoService scoreInfoService;
|
|
@@ -40,20 +42,37 @@ public class PcScoreInfoController extends BaseController {
|
|
|
@Autowired
|
|
|
private IUserInfoService userInfoService;
|
|
|
|
|
|
-// /**
|
|
|
-// * 查询模拟考成绩列表
|
|
|
-// */
|
|
|
-// @GetMapping("/list")
|
|
|
-// @ApiOperation("查询模拟考成绩列表")
|
|
|
-// @ApiImplicitParams({
|
|
|
-// @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
|
|
|
-// @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
|
|
|
-// })
|
|
|
-// public ResponsePageInfo<ScoreInfoPcVo> list(@ModelAttribute ScoreInfoPcDTO scoreInfoPcDTO){
|
|
|
-// startPage();
|
|
|
-// List<ScoreInfoPcVo> list = scoreInfoService.selectScoreInfoPcList(scoreInfoPcDTO);
|
|
|
-// return toResponsePageInfo(list);
|
|
|
-// }
|
|
|
+ /**
|
|
|
+ * 根据当前用户查询模拟考成绩列表
|
|
|
+ */
|
|
|
+ @GetMapping("/list")
|
|
|
+ @ApiOperation("查询模拟考成绩列表")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
|
|
|
+ @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
|
|
|
+ })
|
|
|
+ public ResponsePageInfo<ScoreInfo> list(){
|
|
|
+ startPage();
|
|
|
+ ScoreInfoUserIdDTO scoreInfoUserIdDTO = new ScoreInfoUserIdDTO();
|
|
|
+ scoreInfoUserIdDTO.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
+ scoreInfoUserIdDTO.setDeviceType(2);
|
|
|
+ List<ScoreInfo> list = scoreInfoService.selectScoreInfoList(scoreInfoUserIdDTO);
|
|
|
+ return toResponsePageInfo(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增模拟考成绩
|
|
|
+ */
|
|
|
+ @PostMapping
|
|
|
+ @ApiOperation("新增模拟考成绩")
|
|
|
+ public Response<Integer> add(@RequestBody ScoreInfoDTO scoreInfoDTO) {
|
|
|
+ ScoreInfo scoreInfo = new ScoreInfo();
|
|
|
+ BeanUtils.copyProperties(scoreInfoDTO, scoreInfo);
|
|
|
+ scoreInfo.setUserId(SecurityUtils.getLoginUser().getUser().getUserId());
|
|
|
+ scoreInfo.setDeviceType(2);
|
|
|
+ return toResponse(scoreInfoService.save(scoreInfo) ? 1 : 0);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -62,21 +81,21 @@ public class PcScoreInfoController extends BaseController {
|
|
|
@GetMapping("/studentlist")
|
|
|
@ApiOperation("查询驾校学员列表")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
|
|
|
- @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
|
|
|
+ @ApiImplicitParam(name = "pageNum", value = "当前页码", dataType = "int", paramType = "query", required = false),
|
|
|
+ @ApiImplicitParam(name = "pageSize", value = "每页数据量", dataType = "int", paramType = "query", required = false),
|
|
|
})
|
|
|
- public ResponsePageInfo<ScoreIStudentInfoPcVo> studentList(@ModelAttribute ScoreInfoPcDTO scoreInfoPcDTO){
|
|
|
+ public ResponsePageInfo<ScoreIStudentInfoPcVo> studentList(@ModelAttribute ScoreInfoPcDTO scoreInfoPcDTO) {
|
|
|
startPage();
|
|
|
//判断该用户是否拥有amin或者manager角色
|
|
|
SysUser user = SecurityUtils.getLoginUser().getUser();
|
|
|
List<SysRole> roles = user.getRoles();
|
|
|
Boolean hasAdminAuthority = false;
|
|
|
- for (SysRole sysRole : roles){
|
|
|
- if (sysRole.getRoleKey().equals("admin") || sysRole.getRoleKey().equals("manager")){
|
|
|
- hasAdminAuthority =true;
|
|
|
+ for (SysRole sysRole : roles) {
|
|
|
+ if (sysRole.getRoleKey().equals("admin") || sysRole.getRoleKey().equals("manager")) {
|
|
|
+ hasAdminAuthority = true;
|
|
|
}
|
|
|
}
|
|
|
- if (!hasAdminAuthority){
|
|
|
+ if (!hasAdminAuthority) {
|
|
|
scoreInfoPcDTO.setSchoolName(user.getNickName());
|
|
|
}
|
|
|
List<ScoreIStudentInfoPcVo> list = scoreInfoService.selectStudentList(scoreInfoPcDTO);
|
|
@@ -89,50 +108,36 @@ public class PcScoreInfoController extends BaseController {
|
|
|
@GetMapping("/studentscore/{userId}")
|
|
|
@ApiOperation("查询学员成绩")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
|
|
|
- @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
|
|
|
+ @ApiImplicitParam(name = "pageNum", value = "当前页码", dataType = "int", paramType = "query", required = false),
|
|
|
+ @ApiImplicitParam(name = "pageSize", value = "每页数据量", dataType = "int", paramType = "query", required = false),
|
|
|
})
|
|
|
- public ResponsePageInfo<ScoreInfo> studentscore( @PathVariable("userId") Long userId){
|
|
|
+ public ResponsePageInfo<ScoreInfo> studentscore(@PathVariable("userId") Long userId) {
|
|
|
startPage();
|
|
|
- List<ScoreInfo> list = scoreInfoService.list(new QueryWrapper<ScoreInfo>().eq("user_id",userId).orderByDesc("create_time"));
|
|
|
+ List<ScoreInfo> list = scoreInfoService.list(new QueryWrapper<ScoreInfo>().eq("user_id", userId)
|
|
|
+ .eq("device_type",2).orderByDesc("create_time"));
|
|
|
return toResponsePageInfo(list);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 修改模拟考成绩
|
|
|
- */
|
|
|
- @Log(title = "模拟考成绩", businessType = BusinessTypeEnum.UPDATE)
|
|
|
- @PutMapping
|
|
|
- @ApiOperation("修改模拟考成绩")
|
|
|
- public Response<Integer> edit(@RequestBody ScoreInfo scoreInfo){
|
|
|
- return toResponse(scoreInfoService.updateById(scoreInfo) ? 1 : 0);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 删除模拟考成绩
|
|
|
*/
|
|
|
- @Log(title = "模拟考成绩", businessType = BusinessTypeEnum.DELETE)
|
|
|
- @DeleteMapping("/{ids}")
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
@ApiOperation("删除模拟考成绩")
|
|
|
public Response<Integer> remove(
|
|
|
@ApiParam(name = "ids", value = "模拟考成绩ids参数", required = true)
|
|
|
@PathVariable Long[] ids
|
|
|
- ){
|
|
|
+ ) {
|
|
|
return toResponse(scoreInfoService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 根据userID获取最大成绩,平均成绩,预测成绩
|
|
|
*/
|
|
|
@GetMapping(value = "/getScoreInfoAllByUserId")
|
|
|
@ApiOperation("根据userID获取最大成绩,平均成绩,预测成绩")
|
|
|
- public Response<ScoreInfoAllDTO> getScoreInfoAllByUserId(ScoreInfoUserIdDTO scoreInfoUserIdDTO){
|
|
|
+ public Response<ScoreInfoAllDTO> getScoreInfoAllByUserId(ScoreInfoUserIdDTO scoreInfoUserIdDTO) {
|
|
|
ScoreInfo scoreInfo = new ScoreInfo();
|
|
|
scoreInfo.setUserId(scoreInfoUserIdDTO.getUserId());
|
|
|
ScoreInfoAllDTO scoreInfoAllDTO = scoreInfoService.getScoreInfoAll(scoreInfo);
|