| | |
| | | import com.linghu.model.common.ResponseResult; |
| | | import com.linghu.model.dto.ExportFeedDTO; |
| | | |
| | | import com.linghu.model.dto.ExportGetResultByPlatformIdDTO; |
| | | import com.linghu.model.dto.ExportGetResultDTO; |
| | | import com.linghu.model.dto.ExportStaticsDTO; |
| | | import com.linghu.model.entity.Keyword; |
| | | import com.linghu.model.entity.Platform; |
| | | import com.linghu.model.entity.Reference; |
| | |
| | | |
| | | @PostMapping(value = "/exportStatics") |
| | | @ApiOperation(value = "EChart图导出") |
| | | public ResponseEntity<byte[]> exportStatics(@RequestParam("id") Integer keywordId, |
| | | @RequestParam(value = "questionId", required = false) Integer questionId, HttpServletResponse response) { |
| | | Keyword keyword = keywordMapper.selectById(keywordId); |
| | | List<KeywordStaticsVO> voList = keywordMapper.statics(keywordId, questionId, keyword.getNum()); |
| | | public ResponseEntity<byte[]> exportStatics(@RequestBody ExportStaticsDTO exportStaticsDTO) { |
| | | Keyword keyword = keywordMapper.selectById(exportStaticsDTO.getKeywordId()); |
| | | List<KeywordStaticsVO> voList = keywordMapper.statics(exportStaticsDTO.getKeywordId(), exportStaticsDTO.getQuestionId(), keyword.getNum()); |
| | | |
| | | // 3. 导出Excel |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | |
| | | @RequestParam(value = "typeId", required = false) Integer typeId, |
| | | @RequestParam(value = "isNow") Integer isNow) { |
| | | Keyword keyword = keywordService.getById(keywordId); |
| | | List<PlatformProportionVO> result = keywordMapper.getResultByTypeId(keywordId, questionId, |
| | | keyword.getNum() - isNow, typeId); |
| | | if (isNow == 0) { |
| | | List<PlatformProportionVO> result = keywordMapper.getResultByTypeId(keywordId, questionId, |
| | | keyword.getNum() , typeId); |
| | | |
| | | return ResponseResult.success(result); |
| | | return ResponseResult.success(result); |
| | | } |
| | | if (isNow > 0 && keyword.getNum()>isNow){ |
| | | List<PlatformProportionVO> result = keywordMapper.getResultByTypeId(keywordId, questionId, |
| | | keyword.getNum() - isNow, typeId); |
| | | |
| | | return ResponseResult.success(result); |
| | | }else { |
| | | return ResponseResult.success(new ArrayList<>()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping(value = "/exportGetResultByTypeId") |
| | | @ApiOperation(value = "导出:根据类别查看") |
| | | public ResponseEntity<byte[]> exportGetResultByTypeId(@RequestParam("keywordId") Integer keywordId, |
| | | @RequestParam(value = "questionId", required = false) Integer questionId, |
| | | @RequestParam(value = "typeId", required = false) Integer typeId, |
| | | @RequestParam(value = "isNow") Integer isNow) { |
| | | Keyword keyword = keywordService.getById(keywordId); |
| | | List<PlatformProportionVO> result = keywordMapper.getResultByTypeId(keywordId, questionId, |
| | | keyword.getNum() - isNow, typeId); |
| | | public ResponseEntity<byte[]> exportGetResultByTypeId(@RequestBody ExportGetResultDTO dto) { |
| | | Keyword keyword = keywordService.getById(dto.getKeywordId()); |
| | | List<PlatformProportionVO> result = keywordMapper.getResultByTypeId(dto.getKeywordId(), dto.getQuestionId(), |
| | | keyword.getNum() - dto.getIsNow(), dto.getTypeId()); |
| | | // 3. 导出Excel |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | EasyExcel.write(out, PlatformProportionVO.class) |
| | |
| | | /** |
| | | * 根据平台查看 |
| | | */ |
| | | @GetMapping("/getResultByPlatformId") |
| | | @PostMapping("/getResultByPlatformId") |
| | | @ApiOperation(value = "根据平台查看") |
| | | public ResponseResult<List<ResultListVO>> getResultByPlatformId(@RequestParam("keywordId") Integer keywordId, |
| | | @RequestParam(value = "questionId", required = false) Integer questionId, |
| | | @RequestParam(value = "platformId", required = false) Integer platformId, |
| | | @RequestParam(value = "isNow") Integer isNow) { |
| | | Keyword keyword = keywordService.getById(keywordId); |
| | | if (isNow==0){ |
| | | List<ResultListVO> result = keywordMapper.getResultByPlatformId(keywordId, questionId, keyword.getNum(), |
| | | platformId); |
| | | return ResponseResult.success(result); |
| | | } |
| | | if (isNow > 0 && keyword.getNum()>isNow){ |
| | | List<ResultListVO> result = keywordMapper.getResultByPlatformId(keywordId, questionId, keyword.getNum() - isNow, |
| | | platformId); |
| | | |
| | | return ResponseResult.success(result); |
| | | }else { |
| | | return ResponseResult.success(new ArrayList<>()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据平台查看 0-当前轮 1-代表前1轮 2-代表前2轮 |
| | | */ |
| | | @GetMapping("/exportGetResultByPlatformId") |
| | | @PostMapping("/exportGetResultByPlatformId") |
| | | @ApiOperation(value = "导出:根据平台查看") |
| | | public ResponseEntity<byte[]> exportGetResultByPlatformId(@RequestParam("id") Integer keywordId, |
| | | @RequestParam(value = "questionId", required = false) Integer questionId, |
| | | @RequestParam(value = "platformId", required = false) Integer platformId, |
| | | @RequestParam(value = "isNow") Integer isNow) { |
| | | Keyword keyword = keywordService.getById(keywordId); |
| | | List<ResultListVO> result = keywordMapper.getResultByPlatformId(keywordId, questionId, keyword.getNum() - isNow, |
| | | platformId); |
| | | public ResponseEntity<byte[]> exportGetResultByPlatformId(@RequestBody ExportGetResultByPlatformIdDTO dto) { |
| | | Keyword keyword = keywordService.getById(dto.getKeywordId()); |
| | | List<ResultListVO> result = keywordMapper.getResultByPlatformId(dto.getKeywordId(), dto.getQuestionId(), keyword.getNum() - dto.getIsNow(), |
| | | dto.getPlatformId()); |
| | | // 3. 导出Excel |
| | | ByteArrayOutputStream out = new ByteArrayOutputStream(); |
| | | EasyExcel.write(out, ResultListVO.class) |
| | |
| | | /** |
| | | * 投喂 |
| | | */ |
| | | @PostMapping("/importFeed") |
| | | @PostMapping("/importFeed/{keywordId}") |
| | | @ApiOperation("投喂") |
| | | public ResponseResult<List<FeedExportExcel>> importTemplate(@RequestParam("file") MultipartFile file,@RequestParam("keywordId") Integer keywordId) { |
| | | public ResponseResult<List<FeedExportExcel>> importTemplate(@PathVariable("keywordId") Integer keywordId,@RequestParam("file") MultipartFile file) { |
| | | Keyword keyword = keywordService.getById(keywordId); |
| | | //查找出最近一次的结果 |
| | | List<FeedExportExcel> references = referenceMapper.importTemplateList(keywordId,keyword.getNum()); |