ocr识别-添加接口权限

This commit is contained in:
liyawei
2022-03-09 13:58:48 +08:00
parent 859f7f5c0e
commit 0476f81ef6
3 changed files with 9 additions and 0 deletions
@@ -19,6 +19,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
@@ -91,6 +92,7 @@ public class OcrRecordEOController extends JeroController<OcrRecordEO, IOcrRecor
@AutoLog(value = "OCR识别转换记录表-同步至文档库")
@ApiOperation(value="OCR识别转换记录表-同步至文档库", notes="OCR识别转换记录表-同步至文档库")
@PostMapping(value = "/syncToDocument")
@RequiresPermissions("ocr:ocrRecord:syncToDocument")
public Result<?> syncToDocument(@RequestBody OcrRecordEO ocrRecordEO) {
if(StringUtils.isBlank(ocrRecordEO.getConnectId())){
return Result.error("同步失败");
@@ -209,6 +211,7 @@ public class OcrRecordEOController extends JeroController<OcrRecordEO, IOcrRecor
@AutoLog(value = "OCR识别转换记录表-通过id删除")
@ApiOperation(value="OCR识别转换记录表-通过id删除", notes="OCR识别转换记录表-通过id删除")
@DeleteMapping(value = "/delete")
@RequiresPermissions("ocr:ocrRecord:delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
if (StringUtils.isBlank(id)) {
return Result.error("删除数据不能为空");
@@ -226,6 +229,7 @@ public class OcrRecordEOController extends JeroController<OcrRecordEO, IOcrRecor
@AutoLog(value = "OCR识别转换记录表-批量删除")
@ApiOperation(value="OCR识别转换记录表-批量删除", notes="OCR识别转换记录表-批量删除")
@DeleteMapping(value = "/deleteBatch")
@RequiresPermissions("ocr:ocrRecord:deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
if (StringUtils.isBlank(ids)) {
return Result.error("删除数据不能为空");
@@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.http.entity.ContentType;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
@@ -64,6 +65,7 @@ public class OcrRestfulController{
@ApiOperation(value = "下载word文件")
@GetMapping("/downFile")
@RequiresPermissions("ocr:ocrRestful:downFile")
public void downFile(String fileName, HttpServletResponse response, HttpServletRequest request) throws Exception {
InputStream is = null;
OutputStream os = null;
@@ -151,6 +153,7 @@ public class OcrRestfulController{
*/
@ApiOperation(value = "新增OCR内容")
@PostMapping("/addOcrRecord")
@RequiresPermissions("ocr:ocrRestful:addOcrRecord")
public Result<?> addOcrRecord(@RequestBody OcrRecordEO ocrRecordEO) throws Exception {
SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
log.info("收到文件上传请求,开始处理文件:【"+sdf.format(new Date())+"");
@@ -152,6 +152,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setStandName(getOcrEO.getStandName());
ocrRecordEO.setFileType(getOcrEO.getFileType());
ocrRecordEO.setConnectId(getOcrEO.getConnectId());
ocrRecordEO.setAttId(getOcrEO.getAttId());
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// ocrRecordEO.setCreateBy(sysUser.getId());
// ocrRecordEO.setCreateTime(new Date());
@@ -168,6 +169,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setFileType(getOcrEO.getFileType());
ocrRecordEO.setCreateTime(new Date());
ocrRecordEO.setConnectId(getOcrEO.getConnectId());
ocrRecordEO.setAttId(getOcrEO.getAttId());
ocrRecordEOService.editById(ocrRecordEO); //TODO ??
return Result.OK( "加入转换成功", taskId);
}