| | |
| | | import com.finance.system.query.QuestionQuery; |
| | | import com.finance.system.query.ScoreCalculateDetailQuery; |
| | | import com.finance.system.query.ScoreCalculateQuery; |
| | | import com.finance.system.service.ISysUserService; |
| | | import com.finance.system.service.TbBasicDataService; |
| | | import com.finance.system.service.TbQuestionService; |
| | | import com.finance.system.service.TbScoreService; |
| | | import com.finance.system.vo.CurrentFieldsAllVO; |
| | | import com.finance.system.vo.CurrentFieldsDetailVO; |
| | | import com.finance.system.vo.CurrentFieldsVO; |
| | | import com.finance.system.vo.DeptVO; |
| | | import com.finance.system.vo.QuestionVO; |
| | | import com.finance.system.vo.ScoreCalculateDetailVO; |
| | | import com.finance.system.vo.ScoreCalculateVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import java.util.List; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | private final TbBasicDataService tbBasicDataService; |
| | | private final TbQuestionService tbQuestionService; |
| | | private final TbScoreService tbScoreService; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | /** |
| | | * 字段统计 |
| | | * |
| | | * @return R<PageDTO < CurrentFieldsVO>> |
| | | */ |
| | | @ApiOperation(value = "字段统计" , notes = "字段统计") |
| | | @ApiOperation(value = "字段统计", notes = "字段统计") |
| | | @PostMapping("/fields-statics") |
| | | public R<PageDTO<CurrentFieldsVO>> fieldsStatics( |
| | | @Validated @RequestBody CurrentFieldsQuery dto) { |
| | | try { |
| | | dto.setQuarter(DateUtils.getNowQuarter()); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | dto.setQuarter(previousQuarter); |
| | | return tbBasicDataService.fieldsStatics(dto); |
| | | } catch (Exception e) { |
| | | log.error("获取字段统计相关信息异常" , e); |
| | | log.error("获取字段统计相关信息异常", e); |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | * @return R<CurrentFieldsDetailVO> |
| | | */ |
| | | @GetMapping("/fields-details") |
| | | @ApiOperation(value = "字段统计-查看详情" , notes = "字段统计") |
| | | @ApiImplicitParam(name = "id" , value = "基础数据id" , required = true, dataType = "int" , paramType = "query" , dataTypeClass = Long.class) |
| | | @ApiOperation(value = "字段统计-查看详情", notes = "字段统计") |
| | | @ApiImplicitParam(name = "id", value = "基础数据id", required = true, dataType = "int", paramType = "query", dataTypeClass = Long.class) |
| | | public R<CurrentFieldsDetailVO> fieldsDetails(@RequestParam("id") Long id) { |
| | | try { |
| | | return tbBasicDataService.fieldsDetails(id); |
| | |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | log.error("保存当前季度数据异常" , e); |
| | | log.error("保存当前季度数据异常", e); |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | log.error("保存数据异常" , e); |
| | | log.error("保存数据异常", e); |
| | | return R.fail(); |
| | | } |
| | | return R.ok(); |
| | |
| | | * @return R<CurrentFieldsAllVO> |
| | | */ |
| | | @GetMapping("/fields-statics-all") |
| | | @ApiOperation(value = "字段统计-查看全部" , notes = "字段统计") |
| | | @ApiOperation(value = "字段统计-查看全部", notes = "字段统计") |
| | | public R<CurrentFieldsAllVO> fieldsStaticsAll() { |
| | | try { |
| | | return R.ok(tbBasicDataService.fieldsStaticsAll()); |
| | |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | log.error("查看全部异常" , e); |
| | | log.error("查看全部异常", e); |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | public R<PageDTO<ScoreCalculateVO>> scoreCalculate( |
| | | @Validated @RequestBody ScoreCalculateQuery query) { |
| | | try { |
| | | query.setQuarter(DateUtils.getNowQuarter()); |
| | | String previousQuarter = DateUtils.getPreviousQuarter(); |
| | | previousQuarter = "2024年一季度"; |
| | | query.setQuarter(previousQuarter); |
| | | return R.ok(tbBasicDataService.scoreCalculatePage(query)); |
| | | } catch (Exception e) { |
| | | log.error("获取得分计算异常" , e); |
| | | log.error("获取得分计算异常", e); |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/score-calculate-detail") |
| | | @ApiOperation("得分计算-查看详情") |
| | | @ApiImplicitParam(name = "areaName" , value = "部门名称" , required = false, dataType = "string" , paramType = "query" , dataTypeClass = String.class) |
| | | public R<ScoreCalculateDetailVO> scoreCalculateDetail( |
| | | @Validated @RequestBody ScoreCalculateDetailQuery query) { |
| | | return R.ok(tbScoreService.scoreCalculateDetail(query)); |
| | | try { |
| | | return R.ok(tbScoreService.scoreCalculateDetail(query)); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return R<Void> |
| | | */ |
| | | @PostMapping("add-question") |
| | | @ApiOperation(value = "发现问题-添加问题" , notes = "发现问题") |
| | | @ApiOperation(value = "发现问题-添加问题", notes = "发现问题") |
| | | public R<Void> addQuestion(@Validated @RequestBody QuestionDTO dto) { |
| | | try { |
| | | tbQuestionService.addQuestion(dto); |
| | |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | log.error("添加问题异常" , e); |
| | | log.error("添加问题异常", e); |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | * @return R<Void> |
| | | */ |
| | | @PostMapping("/edit-question") |
| | | @ApiOperation(value = "发现问题-编辑问题" , notes = "发现问题") |
| | | @ApiOperation(value = "发现问题-编辑问题", notes = "发现问题") |
| | | public R<Void> editQuestion(@Validated @RequestBody QuestionUpdDTO dto) { |
| | | try { |
| | | tbQuestionService.editQuestion(dto); |
| | |
| | | if (e instanceof ServiceException) { |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | log.error("编辑问题异常" , e); |
| | | log.error("编辑问题异常", e); |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | * @return R<PageDTO < QuestionVO>> |
| | | */ |
| | | @PostMapping("/page-question") |
| | | @ApiOperation(value = "发现问题-分页查询问题" , notes = "发现问题") |
| | | @ApiOperation(value = "发现问题-分页查询问题", notes = "发现问题") |
| | | public R<PageDTO<QuestionVO>> pageQuestion(@Validated @RequestBody QuestionQuery dto) { |
| | | return R.ok(tbQuestionService.pageQuestion(dto)); |
| | | } |
| | |
| | | * @return R<QuestionDTO> |
| | | */ |
| | | @GetMapping("/detail-question") |
| | | @ApiOperation(value = "发现问题-问题详情" , notes = "发现问题") |
| | | public R<QuestionDTO> detailQuestion(@RequestParam("id") Long id) { |
| | | @ApiOperation(value = "发现问题-问题详情", notes = "发现问题") |
| | | public R<QuestionVO> detailQuestion(@RequestParam("id") Long id) { |
| | | TbQuestion question = tbQuestionService.getById(id); |
| | | return R.ok(BeanUtils.copyBean(question, QuestionDTO.class)); |
| | | return R.ok(BeanUtils.copyBean(question, QuestionVO.class)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return R<Void> |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation(value = "发现问题-删除问题" , notes = "发现问题") |
| | | @ApiOperation(value = "发现问题-删除问题", notes = "发现问题") |
| | | public R<Void> delete(@RequestParam("id") Long id) { |
| | | tbQuestionService.removeById(id); |
| | | tbQuestionService.delete(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping(value = {"/dept/list/{deptName}", "/dept/list"}) |
| | | @ApiOperation(value = "发现问题-获取部门列表", notes = "发现问题") |
| | | public R<List<DeptVO>> deptList( |
| | | @ApiParam(value = "部门名称", required = false) @PathVariable(value = "deptName", required = false) String deptName) { |
| | | return R.ok(sysUserService.queryDeptListByName(deptName)); |
| | | } |
| | | |
| | | } |