|
|
@ -11,11 +11,16 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
|
|
|
|
|
import org.jeecg.common.util.AssertUtils;
|
|
|
|
import org.jeecg.modules.ocr.entity.OcrMetadataConfig;
|
|
|
|
import org.jeecg.modules.ocr.entity.OcrMetadataConfig;
|
|
|
|
|
|
|
|
import org.jeecg.modules.ocr.entity.OcrMetadataConfigDetail;
|
|
|
|
|
|
|
|
import org.jeecg.modules.ocr.model.OcrMetadataConfigSaveModel;
|
|
|
|
import org.jeecg.modules.ocr.service.IOcrMetadataConfigService;
|
|
|
|
import org.jeecg.modules.ocr.service.IOcrMetadataConfigService;
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
|
import org.jeecg.modules.ocr.utils.DownloadTemplateUtil;
|
|
|
|
import org.jeecg.modules.ocr.utils.DownloadTemplateUtil;
|
|
|
|
|
|
|
|
import org.jeecg.modules.ocr.vo.OcrMetadataConfigVo;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
@ -51,11 +56,11 @@ public class OcrMetadataConfigController extends JeecgController<OcrMetadataConf
|
|
|
|
//@AutoLog(value = "元数据配置-分页列表查询")
|
|
|
|
//@AutoLog(value = "元数据配置-分页列表查询")
|
|
|
|
@ApiOperation(value="元数据配置-分页列表查询", notes="元数据配置-分页列表查询")
|
|
|
|
@ApiOperation(value="元数据配置-分页列表查询", notes="元数据配置-分页列表查询")
|
|
|
|
@GetMapping(value = "/list")
|
|
|
|
@GetMapping(value = "/list")
|
|
|
|
public Result<IPage<OcrMetadataConfig>> queryPageList(OcrMetadataConfig ocrMetadataConfig,
|
|
|
|
public Result<IPage<OcrMetadataConfigVo>> queryPageList(OcrMetadataConfig ocrMetadataConfig,
|
|
|
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
|
HttpServletRequest req) {
|
|
|
|
HttpServletRequest req) {
|
|
|
|
if (StringUtils.isNotBlank(ocrMetadataConfig.getConfigName())){
|
|
|
|
/*if (StringUtils.isNotBlank(ocrMetadataConfig.getConfigName())){
|
|
|
|
ocrMetadataConfig.setConfigName("*"+ocrMetadataConfig.getConfigName()+"*");
|
|
|
|
ocrMetadataConfig.setConfigName("*"+ocrMetadataConfig.getConfigName()+"*");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(ocrMetadataConfig.getResultName())){
|
|
|
|
if (StringUtils.isNotBlank(ocrMetadataConfig.getResultName())){
|
|
|
@ -63,40 +68,64 @@ public class OcrMetadataConfigController extends JeecgController<OcrMetadataConf
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isNotBlank(ocrMetadataConfig.getGetField())){
|
|
|
|
if (StringUtils.isNotBlank(ocrMetadataConfig.getGetField())){
|
|
|
|
ocrMetadataConfig.setGetField("*"+ocrMetadataConfig.getGetField()+"*");
|
|
|
|
ocrMetadataConfig.setGetField("*"+ocrMetadataConfig.getGetField()+"*");
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
QueryWrapper<OcrMetadataConfig> queryWrapper = QueryGenerator.initQueryWrapper(ocrMetadataConfig, req.getParameterMap());
|
|
|
|
//QueryWrapper<OcrMetadataConfig> queryWrapper = QueryGenerator.initQueryWrapper(ocrMetadataConfig, req.getParameterMap());
|
|
|
|
Page<OcrMetadataConfig> page = new Page<OcrMetadataConfig>(pageNo, pageSize);
|
|
|
|
Page<OcrMetadataConfig> page = new Page<OcrMetadataConfig>(pageNo, pageSize);
|
|
|
|
IPage<OcrMetadataConfig> pageList = ocrMetadataConfigService.page(page, queryWrapper);
|
|
|
|
IPage<OcrMetadataConfigVo> pageList = ocrMetadataConfigService.pageVo(page, ocrMetadataConfig);
|
|
|
|
return Result.OK(pageList);
|
|
|
|
return Result.OK(pageList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 添加
|
|
|
|
* 添加
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param ocrMetadataConfig
|
|
|
|
* @param ocrMetadataConfigSaveModel
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@AutoLog(value = "元数据配置-添加")
|
|
|
|
@AutoLog(value = "元数据配置-添加")
|
|
|
|
@ApiOperation(value="元数据配置-添加", notes="元数据配置-添加")
|
|
|
|
@ApiOperation(value="元数据配置-添加", notes="元数据配置-添加")
|
|
|
|
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_metadata_config:add")
|
|
|
|
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_metadata_config:add")
|
|
|
|
@PostMapping(value = "/add")
|
|
|
|
@PostMapping(value = "/add")
|
|
|
|
public Result<String> add(@RequestBody OcrMetadataConfig ocrMetadataConfig) {
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
ocrMetadataConfigService.save(ocrMetadataConfig);
|
|
|
|
public Result<String> add(@RequestBody OcrMetadataConfigSaveModel ocrMetadataConfigSaveModel) {
|
|
|
|
|
|
|
|
checkSaveModel(ocrMetadataConfigSaveModel);
|
|
|
|
|
|
|
|
String configName = ocrMetadataConfigSaveModel.getConfigName();
|
|
|
|
|
|
|
|
boolean existsFlag=ocrMetadataConfigService.existsByConfigName(configName,null);//true 已存在,false不存在
|
|
|
|
|
|
|
|
AssertUtils.notTrue(existsFlag,String.format("[配置名称]-%s 已存在",configName));
|
|
|
|
|
|
|
|
ocrMetadataConfigService.saveModel(ocrMetadataConfigSaveModel);
|
|
|
|
return Result.OK("添加成功!");
|
|
|
|
return Result.OK("添加成功!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 校验保存时入参是否可通过
|
|
|
|
|
|
|
|
* @param ocrMetadataConfigSaveModel
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public void checkSaveModel(OcrMetadataConfigSaveModel ocrMetadataConfigSaveModel){
|
|
|
|
|
|
|
|
AssertUtils.notEmpty(ocrMetadataConfigSaveModel.getConfigName(),"[配置名称]不可为空");
|
|
|
|
|
|
|
|
if (ocrMetadataConfigSaveModel.getOcrMetadataConfigDetailList()!=null) {
|
|
|
|
|
|
|
|
for (OcrMetadataConfigDetail detail : ocrMetadataConfigSaveModel.getOcrMetadataConfigDetailList()) {
|
|
|
|
|
|
|
|
AssertUtils.notEmpty(detail.getFieldName(),"[字段名称]不可为空");
|
|
|
|
|
|
|
|
AssertUtils.notEmpty(detail.getGetField(),"[获取字段]不可为空");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 编辑
|
|
|
|
* 编辑
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param ocrMetadataConfig
|
|
|
|
* @param ocrMetadataConfigSaveModel
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@AutoLog(value = "元数据配置-编辑")
|
|
|
|
@AutoLog(value = "元数据配置-编辑")
|
|
|
|
@ApiOperation(value="元数据配置-编辑", notes="元数据配置-编辑")
|
|
|
|
@ApiOperation(value="元数据配置-编辑", notes="元数据配置-编辑")
|
|
|
|
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_metadata_config:edit")
|
|
|
|
// @RequiresPermissions("org.jeecg.modules.ocr:ocr_metadata_config:edit")
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
|
public Result<String> edit(@RequestBody OcrMetadataConfig ocrMetadataConfig) {
|
|
|
|
public Result<String> edit(@RequestBody OcrMetadataConfigSaveModel ocrMetadataConfigSaveModel) {
|
|
|
|
ocrMetadataConfigService.updateById(ocrMetadataConfig);
|
|
|
|
checkSaveModel(ocrMetadataConfigSaveModel);
|
|
|
|
|
|
|
|
AssertUtils.notEmpty(ocrMetadataConfigSaveModel.getId(),"");
|
|
|
|
|
|
|
|
String configName = ocrMetadataConfigSaveModel.getConfigName();
|
|
|
|
|
|
|
|
boolean existsFlag=ocrMetadataConfigService.existsByConfigName(configName,ocrMetadataConfigSaveModel.getId());//true 已存在,false不存在
|
|
|
|
|
|
|
|
AssertUtils.notTrue(existsFlag,String.format("[配置名称]-%s 已存在",configName));
|
|
|
|
|
|
|
|
ocrMetadataConfigService.updateModel(ocrMetadataConfigSaveModel);
|
|
|
|
return Result.OK("编辑成功!");
|
|
|
|
return Result.OK("编辑成功!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|