123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- package com.ruixuan.isc.controller;
- import com.ruixuan.common.core.controller.BaseController;
- import com.ruixuan.common.core.domain.AjaxResult;
- import com.ruixuan.common.core.page.TableDataInfo;
- import com.ruixuan.isc.entity.KuaishouPromoter;
- import com.ruixuan.isc.service.IKuaishouPromoterService;
- import com.ruixuan.isc.utils.Tess4jClient;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.ApiParam;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import org.springframework.web.multipart.MultipartFile;
- import java.util.List;
- /**
- * 快手达人 信息Controller
- *
- * @author ruoyi
- * @date 2023-02-03
- */
- @Api(tags = "快手达人")
- @RestController
- @RequestMapping("/kuaishou/promoter")
- public class KuaishouPromoterController extends BaseController {
- @Autowired
- private IKuaishouPromoterService kuaishouPromoterService;
- /**
- * 查询快手达人 信息列表
- */
- @GetMapping("/list")
- @ApiOperation(value = "查询快手达人")
- public TableDataInfo list(@ApiParam("创建人ID") @RequestParam(value = "userId", required = true) Long userId,
- @ApiParam("达人ID") @RequestParam(value = "promoterId", required = false) Long promoterId,
- @ApiParam("达人名称") @RequestParam(value = "promoterNickName", required = false) String promoterNickName) {
- List<KuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList(userId, promoterId, promoterNickName);
- return getDataTable(list);
- }
- /**
- * 获取快手达人 信息详细信息
- */
- @GetMapping(value = "/getById")
- @ApiOperation(value = "获取快手达人信息详细信息")
- public AjaxResult getById(@ApiParam("主键") @RequestParam(value = "id", required = true) Long id) {
- return AjaxResult.success(kuaishouPromoterService.selectKuaishouPromoterById(id));
- }
- /**
- * 获取快手达人信息
- */
- @GetMapping(value = "/getPromoterInfo")
- @ApiOperation(value = "获取快手达人短视频信息")
- public AjaxResult getPromoterInfo(@ApiParam("达人ID") @RequestParam(value = "promoterId", required = true) Long promoterId) {
- return kuaishouPromoterService.getPromoterInfo(promoterId);
- }
- /**
- * 获取快手达人信息
- */
- @GetMapping(value = "/getOnlyPromoterInfo")
- @ApiOperation(value = "只获取达人信息")
- public AjaxResult getOnlyPromoterInfo(@ApiParam("达人ID") @RequestParam(value = "promoterId", required = true) Long promoterId) {
- return AjaxResult.success(kuaishouPromoterService.getOnlyPromoterInfo(promoterId));
- }
- /**
- * 新增快手达人 信息
- */
- @PostMapping(value = "/add")
- @ApiOperation(value = "新增快手达人")
- public AjaxResult add(@RequestBody KuaishouPromoter kuaishouPromoter) {
- return toAjax2(kuaishouPromoterService.insertKuaishouPromoter(kuaishouPromoter));
- }
- /**
- * 修改快手达人 信息
- */
- @PostMapping(value = "/edit")
- @ApiOperation(value = "修改快手达人")
- public AjaxResult edit(@RequestBody KuaishouPromoter kuaishouPromoter) {
- return toAjax(kuaishouPromoterService.updateKuaishouPromoter(kuaishouPromoter));
- }
- /**
- * 删除快手达人 信息
- */
- @GetMapping("/deleteById")
- @ApiOperation(value = "删除快手达人")
- public AjaxResult deleteById(@ApiParam("主键") @RequestParam(value = "id", required = true) Long id,
- @ApiParam("操作人ID") @RequestParam(value = "userId", required = true) Long userId
- ) {
- return toAjax(kuaishouPromoterService.deleteKuaishouPromoterById(id, userId));
- }
- /**
- * 读取图片文字信息
- */
- @PostMapping(value = "/readImage")
- @ApiOperation(value = "读取图片文字信息")
- public String readImage(@RequestParam("file") MultipartFile file) {
- try {
- Tess4jClient t = new Tess4jClient();
- // ITesseract tesseract = new Tesseract();
- // File savefile = new File("C:\\Users\\Administrator\\Desktop\\test005.png");
- // //设置中文字体库路径
- // tesseract.setDatapath("D:\\download\\tessdata");
- // //中文识别
- // tesseract.setLanguage("chi_sim");
- // //执行ocr识别
- // String result = tesseract.doOCR(savefile);
- String result = t.getWords(file);
- System.out.println(result);
- return result;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return "";
- }
- }
|