| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.system.dto.BasicDataDTO; |
| | | import com.ruoyi.system.query.ScoreQuery; |
| | | import com.ruoyi.system.service.TbBasicDataService; |
| | | import com.ruoyi.system.vo.BasicDataReportingVO; |
| | | import com.ruoyi.system.vo.ScoreVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | private final TbBasicDataService tbBasicDataService; |
| | | |
| | | @ApiOperation("获取基础数据填报相关信息") |
| | | public R<BasicDataReportingVO> getBasicFields(@RequestParam("deptAreaCode") String deptAreaCode) { |
| | | //TODO 如果能够获取到当前登录用户,则不需要传区划代码 |
| | | @GetMapping("/basic-fields") |
| | | public R<BasicDataReportingVO> getBasicFields() { |
| | | try { |
| | | return tbBasicDataService.getBasicFields(deptAreaCode); |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | String areaCode = user.getAreaCode(); |
| | | return tbBasicDataService.getBasicFields(areaCode); |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("import") |
| | | @PostMapping("/import") |
| | | @ApiOperation("基础数据导入") |
| | | public R<Void> importBasicData(@RequestPart("file") MultipartFile file) { |
| | | try { |
| | |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | log.error("基础数据导入异常",e); |
| | | throw new ServiceException("基础数据导入失败,请联系管理员!"); |
| | | return R.fail("基础数据导入失败,请联系管理员!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/page-score") |
| | | @ApiOperation("得分计算分页查询") |
| | | public R<PageDTO<ScoreVO>> pageScore(@RequestBody ScoreQuery query) { |
| | | try { |
| | | return R.ok(tbBasicDataService.pageScore(query)); |
| | | } catch (Exception e) { |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | log.error("查询得分计算异常",e); |
| | | return R.fail(); |
| | | } |
| | | } |
| | | } |