Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangzhijiang
2022-03-08 18:33:17 +08:00
45 changed files with 1368 additions and 635 deletions
@@ -0,0 +1,37 @@
package com.jero.common.constant.enums;
/**
* 中英文切换标识
* @description
* @date 2022/1/21 15:22
* @auth zhn
*/
public enum IsMustEnum {
YES("","0"),
NO("","1");
String name;
String value;
private IsMustEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -646,5 +646,26 @@ public class DateUtils extends PropertyEditorSupport {
calendar.setTime(getDate());
return calendar.get(Calendar.YEAR);
}
/***
* @Description: 判断多个日期是否都符合日期格式
* @Author: yangxuenan
* @Date: 2020/12/31 11:31
* @Param: [str]
* @Return: boolean
*/
public static boolean isValidDate(String str){
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String[] strArr = str.split(",");
for (String dateStr : strArr) {
String replace = dateStr.replace("/", "-");
try {
simpleDateFormat.setLenient(false);
simpleDateFormat.parse(replace);
} catch (Exception e){
return false;
}
}
return true;
}
}
}
@@ -71,6 +71,7 @@ public class ShiroConfig {
}
// 配置不会被拦截的链接 顺序判断
filterChainDefinitionMap.put("/sys/cas/client/validateLogin", "anon"); //cas验证登录
filterChainDefinitionMap.put("/ocr/OcrRestful/ocrHandleResult", "anon"); //ocr回调接口
filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/checkCaptcha", "anon"); //登录验证码接口排除
filterChainDefinitionMap.put("/sys/getRSAPublicKey", "anon"); //获取RSA公钥接口排除
@@ -1,6 +1,8 @@
package com.jero.modules.system.vo;
import lombok.Data;
import java.io.Serializable;
/**
@@ -9,6 +11,7 @@ import java.io.Serializable;
* <b>日期:</b> 2019-03-25 <br>
* <b>版权所有:<b>版权归北京卡达克数据技术中心所有。<br>
*/
@Data
public class OcrVO implements Serializable{
private String restHandleFileUrl;
private String OcrUserId;
@@ -18,68 +21,5 @@ public class OcrVO implements Serializable{
private String fileContent;
private String taskId;
private String RestCallBackUrl;
public String getRestHandleFileUrl() {
return restHandleFileUrl;
}
public void setRestHandleFileUrl(String restHandleFileUrl) {
this.restHandleFileUrl = restHandleFileUrl;
}
public String getOcrUserId() {
return OcrUserId;
}
public void setOcrUserId(String ocrUserId) {
OcrUserId = ocrUserId;
}
public String getAuthCode() {
return authCode;
}
public void setAuthCode(String authCode) {
this.authCode = authCode;
}
public String getConvertType() {
return convertType;
}
public void setConvertType(String convertType) {
this.convertType = convertType;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileContent() {
return fileContent;
}
public void setFileContent(String fileContent) {
this.fileContent = fileContent;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getRestCallBackUrl() {
return RestCallBackUrl;
}
public void setRestCallBackUrl(String restCallBackUrl) {
RestCallBackUrl = restCallBackUrl;
}
private Boolean isThird; //调用方:单纯获取识别的返回结果
}
@@ -413,16 +413,8 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
@ApiOperation(value = "导入.zip")
@PostMapping(value = "/importZip")
public Result<?> importZip(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
//验证文件名是否合格
//截取后缀名
int pos = file.getOriginalFilename().lastIndexOf(".");
String str = file.getOriginalFilename().substring(pos+1).toLowerCase();
String filenameorg = file.getOriginalFilename().substring(0,pos);
//判断上传文件必须是zip
if (!str.equals("zip")) {
return Result.error("请上传zip文件");
}
return Result.OK("导入成功");
String result = bussDocumentLibraryEOService.importZip(file);
return Result.OK(result);
}
@ApiOperation(value = "推送")
@@ -78,4 +78,7 @@ public interface BussDocumentLibraryEOMapper extends BaseMapper<BussDocumentLibr
List<Map<String, Object>> getInfoListByReplaceStandard(@Param("replaceStandard") String replaceStandard);
List<Map<String,Object>> getListBySerialNumber(@Param("serialNumbers") String serialNumbers);
}
@@ -70,5 +70,16 @@
</foreach>
</if>
</select>
<!--根据编码列表查询-->
<select id="getListBySerialNumber" resultType="java.util.LinkedHashMap">
select * from buss_document_library
where 1=1
<if test="serialNumbers != null" >
and serial_number in
<foreach collection="serialNumbers.split(',')" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
@@ -3,7 +3,7 @@ package com.jero.modules.document.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -13,164 +13,180 @@ import java.util.Map;
/**
* @Description: 文档库信息表
* @Author: jero-boot
* @Date: 2022-01-21
* @Date: 2022-01-21
* @Version: V1.0
*/
public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibraryEO> {
/**
* 通过id删除
*
* @param id
* @return
*/
/**
* 通过id删除
*
* @param id
* @return
*/
void deleteById(String id);
/**
* 批量删除
*
* @param ids
* @return
*/
/**
* 批量删除
*
* @param ids
* @return
*/
void deleteByIds(List<String> ids);
/**
* 通过id查询
*
* @param id
* @return
*/
/**
* 通过id查询
*
* @param id
* @return
*/
BussDocumentLibraryEO queryById(String id);
/**
* 列表查询
*
* @return
*/
* 列表查询
*
* @return
*/
List<BussDocumentLibraryEO> queryList();
/**
* 查询条件
*
* @return
*/
List<Map<String,Object>> queryCondition(String flag,String cut);
* 查询条件
*
* @return
*/
List<Map<String, Object>> queryCondition(String flag, String cut);
/**
* 列表表头
*
* @return
*/
List<Map<String,Object>> getHeader(String flag,String cut);
* 列表表头
*
* @return
*/
List<Map<String, Object>> getHeader(String flag, String cut);
/**
* 新增表单
*
* @return
*/
List<Map<String,Object>> getAddForm(String flag,String cut,String type);
* 新增表单
*
* @return
*/
List<Map<String, Object>> getAddForm(String flag, String cut, String type);
/**
* 编辑数据查询
* @param id
* @return
*/
List<Map<String,Object>> getDocumentInfoById(String id,String cut);
/**
* 编辑数据查询
*
* @param id
* @return
*/
List<Map<String, Object>> getDocumentInfoById(String id, String cut);
/**
* 详情数据查询
* @param id
* @return
*/
List<Map<String,Object>> getInfoById(String id,String cut);
/**
* 详情数据查询
*
* @param id
* @return
*/
List<Map<String, Object>> getInfoById(String id, String cut);
/**
* 新增数据
* @param map
*/
void addInfo(Map<String,Object> map);
/**
* 新增数据
*
* @param map
*/
void addInfo(Map<String, Object> map);
/**
* 编辑数据
* @param map
*/
void updateInfo(Map<String,Object> map);
/**
* 编辑数据
*
* @param map
*/
void updateInfo(Map<String, Object> map);
/**
* 分页
* @param parameter
* @return
*/
IPage getInfoPage(Map<String,Object> parameter);
/**
* 分页
*
* @param parameter
* @return
*/
IPage getInfoPage(Map<String, Object> parameter);
/**
* 代替标准分页
* @param parameter
* @return
*/
IPage replacePageInfo(Map<String,Object> parameter);
/**
* 代替标准分页
*
* @param parameter
* @return
*/
IPage replacePageInfo(Map<String, Object> parameter);
/**
* ocr识别调取已入库文件分页
* @param parameter
* @return
*/
IPage ocrPageInfo(Map<String,Object> parameter);
/**
* ocr识别调取已入库文件分页
*
* @param parameter
* @return
*/
IPage ocrPageInfo(Map<String, Object> parameter);
/**
* 添加收藏
* @param id
*/
void addCollect(String id);
/**
* 添加收藏
*
* @param id
*/
void addCollect(String id);
/**
* 取消收藏
* @param id
*/
void cancelCollect(String id);
/**
* 取消收藏
*
* @param id
*/
void cancelCollect(String id);
/**
* 添加订阅
* @param id
*/
void addSubscribe(String id);
/**
* 添加订阅
*
* @param id
*/
void addSubscribe(String id);
/**
* 取消订阅
* @param id
*/
void cancelSubscribe(String id);
/**
* 取消订阅
*
* @param id
*/
void cancelSubscribe(String id);
/**
* 导出excel
* @param map
* @param response
* @param request
*/
void exportExcel(Map<String,Object> map,
HttpServletResponse response,
HttpServletRequest request);
/**
* 导出excel
*
* @param map
* @param response
* @param request
*/
void exportExcel(Map<String, Object> map,
HttpServletResponse response,
HttpServletRequest request);
void exportZip(Map<String,Object> map,
HttpServletResponse response,
HttpServletRequest request);
void exportZip(Map<String, Object> map,
HttpServletResponse response,
HttpServletRequest request);
/**
* 模板下载
* @param response
* @param request
*/
void exportTemplate(Map<String,Object> map,HttpServletResponse response, HttpServletRequest request);
/**
* 模板下载
*
* @param response
* @param request
*/
void exportTemplate(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request);
/**
* ocr识别调取已入库文件-中英文切换
* @param flag
* @param cut
* @return
*/
List<Map<String, Object>> getHeaderOrConditionForOcr(String flag, String cut);
/**
* ocr识别调取已入库文件-中英文切换
*
* @param flag
* @param cut
* @return
*/
List<Map<String, Object>> getHeaderOrConditionForOcr(String flag, String cut);
String pullMessage(String departIds,String ids,String documentIds);
String pullMessage(String departIds, String ids, String documentIds);
String importZip(MultipartFile file);
}
@@ -7,11 +7,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.ocr.entity.OcrRecordEO;
import com.jero.modules.ocr.enums.FileSourceEnum;
import com.jero.modules.ocr.enums.FileSyncStateEnum;
import com.jero.modules.ocr.enums.FileTypeEnum;
import com.jero.modules.ocr.page.OcrRecordEOPage;
import com.jero.modules.ocr.service.IOcrRecordEOService;
import com.jero.modules.oss.entity.OSSFile;
@@ -28,7 +27,9 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@@ -72,6 +73,11 @@ public class OcrRecordEOController extends JeroController<OcrRecordEO, IOcrRecor
IPage<OcrRecordEO> pageList = ocrRecordService.page(page, queryWrapper);
List<OcrRecordEO> rows = pageList.getRecords();
for (OcrRecordEO row : rows){
if(StringUtils.isNotEmpty(row.getConnectId())) {
row.setFileSource(FileSourceEnum.IMPORT.getValue());
}else{
row.setFileSource(FileSourceEnum.UPLOAD.getValue());
}
if(StringUtils.isNotEmpty(row.getDocRealName())) {
row.setDocRealFile(ocrDownPath + row.getDocRealName());
}
@@ -86,97 +92,29 @@ public class OcrRecordEOController extends JeroController<OcrRecordEO, IOcrRecor
@ApiOperation(value="OCR识别转换记录表-同步至文档库", notes="OCR识别转换记录表-同步至文档库")
@PostMapping(value = "/syncToDocument")
public Result<?> syncToDocument(@RequestBody OcrRecordEO ocrRecordEO) {
if(StringUtils.isBlank(ocrRecordEO.getAttId())){
return Result.error("没有可同步的文档");
if(StringUtils.isBlank(ocrRecordEO.getConnectId())){
return Result.error("同步失败");
}
if (StringUtils.isBlank(ocrRecordEO.getStandName())
|| StringUtils.isBlank(ocrRecordEO.getStandNumber())){
return Result.error("参数不能为空");
//查询doc文件的id
LambdaQueryWrapper<OSSFile> ossFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
ossFileLambdaQueryWrapper.eq(OSSFile::getUrl, ocrRecordEO.getDocName());
List<OSSFile> ossFiles = ossFileService.list(ossFileLambdaQueryWrapper);
if (CollectionUtil.isEmpty(ossFiles)) {
return Result.error("没有可同步的文件");
}
if (StringUtils.isBlank(ocrRecordEO.getFileType())) {
return Result.error("文本状态不能为空");
}
//通过编号和标题查询对应文档
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BussDocumentLibraryEO::getTitle, ocrRecordEO.getStandName())
.eq(BussDocumentLibraryEO::getSerialNumber, ocrRecordEO.getStandNumber());
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = bussDocumentLibraryEOService.list(queryWrapper);
if(CollectionUtil.isNotEmpty(bussDocumentLibraryEOList)){
//查询doc文件的id
LambdaQueryWrapper<OSSFile> ossFileLambdaQueryWrapper = new LambdaQueryWrapper<>();
ossFileLambdaQueryWrapper.eq(OSSFile::getUrl, ocrRecordEO.getDocName());
List<OSSFile> ossFiles = ossFileService.list(ossFileLambdaQueryWrapper);
if (CollectionUtil.isEmpty(ossFiles)) {
return Result.error("没有可同步的文件");
}
//开始同步
int countSuccess = 0;
for(BussDocumentLibraryEO documentLibraryEO : bussDocumentLibraryEOList) {
OSSFile ossFile = new OSSFile();
String docFileId = ossFiles.get(0).getId();
ossFile.setId(docFileId);
//设置doc文件的关联id
if (FileTypeEnum.RELEASE_DRAFT.getValue().equals(ocrRecordEO.getFileType())) {
String connectId = documentLibraryEO.getReleaseDraft();
if (StringUtils.isBlank(connectId)) {
connectId = UUID.randomUUID().toString().replace("-", "");
//修改文档库相关字段
BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO();
bussDocumentLibraryEO.setId(documentLibraryEO.getId());
bussDocumentLibraryEO.setReleaseDraft(connectId);
bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO);
}
ossFile.setConnectId(connectId);
OSSFile ossFile = new OSSFile();
String docFileId = ossFiles.get(0).getId();
ossFile.setId(docFileId);
ossFile.setConnectId(ocrRecordEO.getConnectId());
ossFileService.updateById(ossFile);
} else if (FileTypeEnum.SUPPLEMENT.getValue().equals(ocrRecordEO.getFileType())) {
String connectId = documentLibraryEO.getSupplement();
if (StringUtils.isBlank(connectId)) {
connectId = UUID.randomUUID().toString().replace("-", "");
//修改文档库相关字段
BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO();
bussDocumentLibraryEO.setId(documentLibraryEO.getId());
bussDocumentLibraryEO.setSupplement(connectId);
bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO);
}
ossFile.setConnectId(connectId);
//修改记录表的同步情况
OcrRecordEO updateOcrRecordEO = new OcrRecordEO();
updateOcrRecordEO.setId(ocrRecordEO.getId());
updateOcrRecordEO.setSyncState(FileSyncStateEnum.SYNC_YES.getValue());
ocrRecordService.editById(updateOcrRecordEO);
} else if (FileTypeEnum.APPROVAL_DRAFT.getValue().equals(ocrRecordEO.getFileType())) {
String connectId = documentLibraryEO.getApprovalDraft();
if (StringUtils.isBlank(connectId)) {
connectId = UUID.randomUUID().toString().replace("-", "");
//修改文档库相关字段
BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO();
bussDocumentLibraryEO.setId(documentLibraryEO.getId());
bussDocumentLibraryEO.setApprovalDraft(connectId);
bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO);
}
ossFile.setConnectId(connectId);
} else if (FileTypeEnum.EXPOSURE_DRAFT.getValue().equals(ocrRecordEO.getFileType())) {
String connectId = documentLibraryEO.getExposureDraft();
if (StringUtils.isBlank(connectId)) {
connectId = UUID.randomUUID().toString().replace("-", "");
//修改文档库相关字段
BussDocumentLibraryEO bussDocumentLibraryEO = new BussDocumentLibraryEO();
bussDocumentLibraryEO.setId(documentLibraryEO.getId());
bussDocumentLibraryEO.setExposureDraft(connectId);
bussDocumentLibraryEOService.updateById(bussDocumentLibraryEO);
}
ossFile.setConnectId(connectId);
}
ossFileService.updateById(ossFile);
//修改记录表的同步情况
OcrRecordEO updateOcrRecordEO = new OcrRecordEO();
updateOcrRecordEO.setId(ocrRecordEO.getId());
updateOcrRecordEO.setSyncState(FileSyncStateEnum.SYNC_YES.getValue());
ocrRecordService.editById(updateOcrRecordEO);
countSuccess++;
}
return Result.OK("同步成功", countSuccess);
}else{
return Result.error("没有可同步的文档");
}
return Result.OK("同步成功", ossFile);
}
/**
@@ -1,11 +1,10 @@
package com.jero.modules.ocr.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.jero.common.api.vo.Result;
import com.jero.modules.ocr.entity.OcrCallBackResultEO;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.ocr.entity.OcrRecordEO;
import com.jero.modules.ocr.enums.ResultContentEnum;
import com.jero.modules.ocr.service.IOcrRecordEOService;
import com.jero.modules.ocr.service.IOcrRestfulService;
import com.jero.modules.ocr.util.MD5Util;
@@ -14,6 +13,7 @@ import com.jero.modules.oss.service.IOSSFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.springframework.beans.factory.annotation.Autowired;
@@ -22,11 +22,11 @@ import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* @program: OcrDemo
@@ -56,9 +56,37 @@ public class OcrRestfulController{
@Value("${OCR.ocrDownPath}")
private String ocrDownPath;
@Value("${OCR.ocrPath}")
private String ocrPath;
@Value("${jero.path.upload}")
private String filePath;//文件存储路径
@ApiOperation(value = "下载word文件")
@GetMapping("/downFile")
public void downFile(String fileName, HttpServletResponse response, HttpServletRequest request) throws Exception {
InputStream is = null;
OutputStream os = null;
response.reset();
try {
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
response.setContentType("application/octet-stream");
String fullPath = ocrPath + fileName;
is = new FileInputStream(fullPath);
os = response.getOutputStream();
IOUtils.copy(is, os);
os.flush();
} catch (FileNotFoundException var4) {
throw new JeroBootException("文件[" + ocrPath + fileName + "]不存在");
} catch (IOException e) {
log.error(e.getMessage(), e);
} finally {
is.close();
os.close();
}
}
/**
* 测试OCR
* @param file
@@ -77,34 +105,38 @@ public class OcrRestfulController{
* OCR回调
* @param wordFile
* @param jsonFile
* @param ocrCallBackResultEo
* @param taskId
* @param result
* @param key
* @return
*/
@ApiOperation(value = "OCR回调")
@PostMapping("/OcrHandleResult")
public String OcrHandleResult(@RequestParam("wordFile") MultipartFile wordFile,@RequestParam("jsonFile") MultipartFile jsonFile, OcrCallBackResultEO ocrCallBackResultEo) {
@PostMapping("/ocrHandleResult")
public String ocrHandleResult(@RequestParam("wordFile") MultipartFile wordFile,
@RequestParam("jsonFile") MultipartFile jsonFile,
@RequestParam("taskId") String taskId,
@RequestParam("result") String result,
@RequestParam("key") String key) {
try{
log.info("调取到我了");
log.info("接口回调结果:"+ JSON.toJSONString(ocrCallBackResultEo));
log.info("接口回调时所传文件---wordFile:"+ wordFile.toString() +"; jsonFile:"+jsonFile.toString());
if("error".equals(ocrCallBackResultEo.getResult())){
if("error".equals(result)){
log.info("客户接口处理文件失败");
ocrRestfulService.updateDb(ocrCallBackResultEo.getTaskID(),"客户接口处理文件失败");
ocrRestfulService.updateDb(taskId,"客户接口处理文件失败");
return "{\"result\":\"error\"}";
}
//1.验证 key 是否符合,不符合打回,符合继续
//2.向后传递文件
String key = ocrCallBackResultEo.getKey();
String sign = ocrCallBackResultEo.getTaskID() + OcrPublicKey;
String sign = taskId + OcrPublicKey;
String signMD5 = MD5Util.string2MD5(sign);
// String encpySign =MD5Util.convertMD5(signMD5);
if(!signMD5.equals(key)){
//不同,则认证失败
log.info("认证失败");
ocrRestfulService.updateDb(ocrCallBackResultEo.getTaskID(),"回调接口认证失败");
ocrRestfulService.updateDb(taskId, ResultContentEnum.OCR_CONVERT_FAIL.getValue());
return "{\"result\":\"Authentication failed\"}";
}
return ocrRestfulService.OcrHandleResult(wordFile,jsonFile,ocrCallBackResultEo.getTaskID());
return ocrRestfulService.ocrHandleResult(wordFile,jsonFile,taskId);
}catch (Exception e){
log.error(e.getMessage(),e);
return "{\"result\":\"runTimeException\"}";
@@ -1,22 +1,20 @@
package com.jero.modules.ocr.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
@@ -128,9 +126,15 @@ public class OcrRecordEO implements Serializable {
@Excel(name = "同步状态", width = 15)
@ApiModelProperty(value = "同步状态")
private String syncState;
/**文档库关联文件id*/
@ApiModelProperty(value = "文档库关联文件id")
private String connectId;
@TableField(exist = false)
private String docRealFile;
@TableField(exist = false)
private String jsonRealFile;
@TableField(exist = false)
private String fileSource; //文件来源:0-上传 1-导入
}
@@ -0,0 +1,36 @@
package com.jero.modules.ocr.enums;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 16:04 2022/3/8
*/
public enum FileSourceEnum {
UPLOAD("上传","0"),
IMPORT("导入","1");
String name;
String value;
FileSourceEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -21,5 +21,6 @@
<result column="json_file_code" property="jsonFileCode" />
<result column="att_id" property="attId" />
<result column="sync_state" property="syncState" />
<result column="connect_id" property="connectId" />
</resultMap>
</mapper>
@@ -1,6 +1,5 @@
package com.jero.modules.ocr.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.common.api.vo.Result;
import com.jero.modules.ocr.entity.OcrRecordEO;
import org.springframework.web.multipart.MultipartFile;
@@ -13,7 +12,7 @@ import org.springframework.web.multipart.MultipartFile;
public interface IOcrRestfulService{
Result<?> handleFile(MultipartFile file, String fileName, OcrRecordEO getOcrEO, String type) throws Exception;
String OcrHandleResult(MultipartFile wordFile,MultipartFile jsonFile,String taskId) throws Exception;
String ocrHandleResult(MultipartFile wordFile,MultipartFile jsonFile,String taskId) throws Exception;
OcrRecordEO getOcrResult(String taskId, int i) throws Exception;
@@ -10,6 +10,9 @@ import com.jero.modules.ocr.service.IOcrRecordEOService;
import com.jero.modules.ocr.service.IOcrRestfulService;
import com.jero.modules.ocr.util.Base64Util;
import com.jero.modules.ocr.util.RsaUtil;
import com.jero.modules.ocr.util.UUIDUtils;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.system.vo.OcrVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
@@ -52,6 +55,8 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
@Autowired
private IOcrRecordEOService ocrRecordEOService;
@Autowired
private IOSSFileService ossFileService;
//请求处理文件url
@@ -86,7 +91,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
public Result<?> handleFile(MultipartFile file, String fileName, OcrRecordEO getOcrEO, String type) throws Exception {
String taskId = "";
if ("add".equals(type)) {
taskId = UUID.randomUUID().toString().replace("-", "");
taskId = UUIDUtils.randomUUID20();
} else {
taskId = getOcrEO.getId();
}
@@ -126,6 +131,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrVO.setFileContent(fileContent);
ocrVO.setTaskId(taskId);
ocrVO.setRestCallBackUrl(RestCallBackUrl);
ocrVO.setIsThird(true);
ResponseEntity<String> responseEntity = localToolFeignClient.getFile(ocrVO);
log.info("请求OCR接口完毕,返回响应状态:【"+sdf.format(new Date())+"");
@@ -145,6 +151,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setStandNumber(getOcrEO.getStandNumber());
ocrRecordEO.setStandName(getOcrEO.getStandName());
ocrRecordEO.setFileType(getOcrEO.getFileType());
ocrRecordEO.setConnectId(getOcrEO.getConnectId());
// LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
// ocrRecordEO.setCreateBy(sysUser.getId());
// ocrRecordEO.setCreateTime(new Date());
@@ -160,6 +167,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setStandName(getOcrEO.getStandName());
ocrRecordEO.setFileType(getOcrEO.getFileType());
ocrRecordEO.setCreateTime(new Date());
ocrRecordEO.setConnectId(getOcrEO.getConnectId());
ocrRecordEOService.editById(ocrRecordEO); //TODO ??
return Result.OK( "加入转换成功", taskId);
}
@@ -173,19 +181,19 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
}
}
public String OcrHandleResult(MultipartFile wordFile,MultipartFile jsonFile,String taskId) throws Exception {
public String ocrHandleResult(MultipartFile wordFile,MultipartFile jsonFile,String taskId) throws Exception {
//首先将文件保存至本地
String saveWordFilePath=null;
String saveWordFileName=null;
if(wordFile!=null && !wordFile.isEmpty()){
saveWordFileName= UUID.randomUUID().toString().replace("-", "") + "_"+wordFile.getOriginalFilename();
saveWordFileName= UUIDUtils.randomUUID20() + "_"+wordFile.getOriginalFilename();
saveWordFilePath=ocrFilePath+saveWordFileName;
FileUtils.copyInputStreamToFile(wordFile.getInputStream(),new File(saveWordFilePath));
}
String saveJsonFilePath=null;
String saveJsonFileName=null;
if(jsonFile!=null && !jsonFile.isEmpty()){
saveJsonFileName=UUID.randomUUID().toString().replace("-", "") + "_"+jsonFile.getOriginalFilename();
saveJsonFileName=UUIDUtils.randomUUID20() + "_"+jsonFile.getOriginalFilename();
saveJsonFilePath=ocrFilePath+saveJsonFileName;
FileUtils.copyInputStreamToFile(jsonFile.getInputStream(),new File(saveJsonFilePath));
}
@@ -201,7 +209,15 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setJsonFileCode(null);
ocrRecordEO.setUpdateTime(new Date());
ocrRecordEO.setResultContent("转换成功");
ocrRecordEOService.editById(ocrRecordEO);
ocrRecordEOService.updateById(ocrRecordEO);
//记录doc文件信息
OSSFile docFile = new OSSFile();
docFile.setId(UUID.randomUUID().toString().replace("-", ""));
docFile.setUrl(saveWordFilePath);
docFile.setFileName(saveWordFilePath.substring(saveWordFilePath.lastIndexOf("_")+1));
ossFileService.save(docFile);
return "{\"result\":\"success\"}";
}else{
updateDb(taskId,"error:File does not exist");
@@ -236,7 +252,7 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
ocrRecordEO.setId(taskId);
ocrRecordEO.setUpdateTime(new Date());
ocrRecordEO.setResultContent(result);
ocrRecordEOService.editById(ocrRecordEO);
ocrRecordEOService.updateById(ocrRecordEO);
}
public boolean checkFileName(String fileName){
@@ -0,0 +1,57 @@
package com.jero.modules.ocr.util;
import java.awt.*;
import java.util.Random;
/**
* @Author: liyawei
* @Description:
* @Date: Created in 0:09 2022/3/8
*/
public class RandomUtils extends org.apache.commons.lang3.RandomUtils {
private static final char[] codeSeq = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7', '8', '9'};
private static final char[] numberArray = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
private static Random random = new Random();
public RandomUtils() {
}
public static final String randomString(int length) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < length; ++i) {
sb.append(String.valueOf(codeSeq[random.nextInt(codeSeq.length)]));
}
return sb.toString();
}
public static final String randomNumberString(int length) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < length; ++i) {
sb.append(String.valueOf(numberArray[random.nextInt(numberArray.length)]));
}
return sb.toString();
}
public static Color randomColor(int fc, int bc) {
int f = fc;
int b = bc;
Random random = new Random();
if (fc > 255) {
f = 255;
}
if (bc > 255) {
b = 255;
}
return new Color(f + random.nextInt(b - f), f + random.nextInt(b - f), f + random.nextInt(b - f));
}
public static int nextInt(int bound) {
return random.nextInt(bound);
}
}
@@ -0,0 +1,38 @@
package com.jero.modules.ocr.util;
import java.util.Random;
public class UUIDUtils {
public static String randomUUID10() {
return RandomUtils.randomString(10);
}
public static String randomUUID20() {
return RandomUtils.randomString(20);
}
public static String randomUUID(int length) {
return RandomUtils.randomString(length);
}
public static String getUUIDPath(String uuid){
StringBuilder builder=new StringBuilder();
builder.append("/");
builder.append((uuid.substring(0, 3).hashCode())%100+"").append("/");
builder.append((uuid.substring(7,10).hashCode())%100+"").append("/");
builder.append((uuid.substring(11,14).hashCode())%100+"").append("/");
return builder.toString();
}
public static String getAttTable(){
Random rand = new Random();
int nextInt = rand.nextInt(10)+1;
StringBuilder builder=new StringBuilder();
builder.append("ATT_FILE_").append(String.format("%02d", nextInt));
return builder.toString();
}
}
@@ -113,21 +113,51 @@ public class FileUnZip {
* @param filename
*/
public static List<File> readFileByFilename(String path,String filename) {
if(filename.contains("/")){
filename = filename.split("/")[1];
}
List<File> resultlist = new ArrayList<>();
if (StringUtil.isNotEmpty(path)){
File file = new File(path);
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File fi : files) {
// 对文件进行过滤
if (fi.getName().equals(filename)) {
resultlist.add(fi);
if(fi.isDirectory()){
File[] filesTemp = fi.listFiles();
for (File fileTemp : filesTemp) {
// 对文件进行过滤
if (fileTemp.getName().equals(filename)) {
resultlist.add(fileTemp);
}
}
}else{
// 对文件进行过滤
if (fi.getName().equals(filename)) {
resultlist.add(fi);
}
}
}
}
}
return resultlist;
}
// public static List<File> readFileByFilename(String path,String filename) {
// List<File> resultlist = new ArrayList<>();
// if (StringUtil.isNotEmpty(path)){
// File file = new File(path);
// if (file.isDirectory()) {
// File[] files = file.listFiles();
// for (File fi : files) {
// // 对文件进行过滤
// if (fi.getName().equals(filename)) {
// resultlist.add(fi);
// }
// }
// }
// }
// return resultlist;
// }
/**
*@Description: 删除某个文件
@@ -152,4 +182,21 @@ public class FileUnZip {
}
}
public static List<File> readImpExcelFile(String path) {
File file = new File(path);
List<File> resultlist = new ArrayList<>();
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File fi : files) {
// 对文件进行过滤,只读取Excel文件
String name = fi.getName();
// "导入模板".equals(fi.getName()) || "导入模板.xlsx".equals(fi.getName())
if (name != null &&( fi.getName().contains(".xls") || fi.getName().contains(".xlsx") )){
resultlist.add(fi);
}
}
}
return resultlist;
}
}
@@ -299,11 +299,11 @@ justauth:
# 云端OCR识别集成配置参数
OCR:
#请求OCR转换接口
handleFileUrl: https://sws.trans-cosmos.com.cn/WebService.asmx/FileConversion
#handleFileUrl = https://61.136.1.103:8091/WebService.asmx/FileConversion
# handleFileUrl: https://sws.trans-cosmos.com.cn/WebService.asmx/FileConversion
handleFileUrl: http://61.136.1.103:8091/WebService.asmx/FileConversion
# OCR回调接口地址 配置客户本地的IP及端口号
# callBackUrl: http://139.9.235.66:9110/api/ocr/OCRRestful/OcrHandleResult
callBackUrl: http://127.0.0.1:8080/api/ocr/OCRRestful/OcrHandleResult
# callBackUrl: http://139.9.235.66:9110//api/ocr/OCRRestful/OcrHandleResult
callBackUrl: http://139.9.235.66:9022/local-tool/ocr/ocrHandleResult
# OCR认证用户
userId: dayuzhou1234
# OCR认证编码
@@ -320,11 +320,6 @@ OCR:
times: 20
# OCR转换类型
convertType: BOTH
## 这个IFeignService是加了@FeignClient注解的类
local-tool:
ribbon:
## 服务提供者的地址,不是服务注册中心的地址
listOfServers: http://139.9.235.66:9022
## 这个要有,如果不加,只加了上面也没用
ribbon:
+6
View File
@@ -500,4 +500,10 @@ module.exports = {
ProcessStatus:'Process status',
CompletionTime:'Completion time',
draft:'draft',
CannotExceed100characters:'cannot exceed 100 characters',
cantExeed:'cannot exceed ',
characters:' characters',
Processing:'Processing',
See:'See',
}
+6 -1
View File
@@ -424,7 +424,7 @@ module.exports = {
LabeItemName:'标签项名称',
PleaseEnterLabelName:'请输入标签名称',
DisplayArea:'展示区域',
ChineseName:'中文名称',
ChineseName:'属性名称',
AttributeType:'属性类型',
FieldLength:'字段长度',
DisplayOrder:'展示顺序',
@@ -504,4 +504,9 @@ module.exports = {
ProcessStatus:'流程状态',
CompletionTime:'完成时间',
draft:'草稿',
CannotExceed100characters:'不能超过100字符',
cantExeed:'不能超过',
characters:'字符',
Processing:'办理',
See:'查看',
}
@@ -322,12 +322,12 @@
})
},
dateChange(item) {
this.formInline[item.db_field_name] = moment(this.formInline[item.db_field_name]).format('YYYY-MM-DD')
this.formInline[item.db_field_name] = this.formInline[item.db_field_name] ? moment(this.formInline[item.db_field_name]).format('YYYY-MM-DD') : ''
},
onChange(item) {
let dateOne = moment(this.formInline[item][0]).format('YYYY-MM-DD')
let dateTwo = moment(this.formInline[item][1]).format('YYYY-MM-DD')
this.formInline[item] = [dateOne, dateTwo]
this.formInline[item] =dateOne ? [dateOne, dateTwo] : []
},
clickButtonToUpload(current) {
+4 -4
View File
@@ -271,7 +271,7 @@
},
methods: {
sumber() {
console.log('vilidate',this.$refs.ruleForm1)
console.log('vilidate',this.formInline)
this.$refs.ruleForm1.validate(valid => {
console.log('va',valid)
if (valid) {
@@ -283,11 +283,11 @@
}
postAction(url, this.formInline).then((res) => {
if (res.success) {
this.$message.success(res.message)
this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset')
this.$emit('addFormClick')
} else {
this.$message.warning(res.message)
this.$message.warning(this.$t('operationFailed'))
}
})
} else {
@@ -310,6 +310,7 @@
/** 赋值给当前对应的表单文件 */
this.formInline[this.uploadName] = attIdList.join(',')
this.formInline = { ...this.formInline }
console.log('form',this.formInline)
}
},
handleInput(value) {
@@ -371,7 +372,6 @@
this.$set(this, 'rules', rules)
this.isFormInline = true
this.confirmLoading = false
console.log('rules',rules,this)
},
getForm() {
this.confirmLoading = true
@@ -16,7 +16,7 @@
<a class="text" v-for="(ol,index) in OperationList"
@click="OperationClick(ol,record)">
<span v-if="ol.text==$t('SyncLibrary')">
{{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}}
{{record.resultContent=='转换成功'&&record.syncState=='未同步'&&record.fileSource=='1'?ol.text:''}}
</span>
<span v-if="ol.text==$t('check')">
{{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}}
@@ -112,6 +112,7 @@
})
eventBUs.$on('searchReset', target => {
this.searchParmes = {}
this.selectedRowKeys=[]
this.getData()
this.getTableList()
})
+1 -1
View File
@@ -16,7 +16,7 @@
<a class="text" v-for="(ol,index) in OperationList"
@click="OperationClick(ol,record)">
<span v-if="ol.text==$t('SyncLibrary')">
{{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}}
{{record.resultContent=='转换成功'&&record.syncState=='未同步'&&record.fileSource=='1'?ol.text:''}}
</span>
<span v-if="ol.text==$t('check')">
{{record.resultContent=='转换成功'&&record.syncState=='未同步'?ol.text:''}}
+8 -1
View File
@@ -27,7 +27,9 @@
</a>
</span>
<span slot="detailClick" slot-scope="text,record">
<a class="text" :title="text" @click="detailClick(record)">{{text}}</a>
<a class="text" :title="text" @click="detailClick(record)">
{{text && text.length > 18?text.slice(0,17)+'...':text}}
</a>
</span>
<span slot="detailText" slot-scope="text,record">
<span class="text" :title="text">
@@ -187,6 +189,11 @@
this.loading = true
postAction(this.url.tableList, params).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0){
this.pageNo = res.result.current - 1
this.getTableList()
return
}
this.dataSource = res.result.records
this.total = res.result.total
this.loading = false
+87 -85
View File
@@ -1,68 +1,71 @@
<template>
<div>
<a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title">
<a-upload-dragger
accept='*.*'
:disabled="disabled"
class="ant-upload-list"
name="file"
:file-list="myfileList"
:multiple="true"
:action = 'uploadAction'
:headers="headers"
:before-upload="beforeUpload"
:remove='remove'
@change="handleChange">
<p><a-icon style="font-size: 67px;color: #c0c4cc;" type="cloud-upload" /></p>
<p class="ant-upload-text" style="font-size: 14px;line-height: 30px">{{this.$t('clickUpload')}}</p>
</a-upload-dragger>
</a-modal>
</div>
<div>
<a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title">
<a-upload-dragger
accept='*.*'
:disabled="disabled"
class="ant-upload-list"
name="file"
:file-list="myfileList"
:multiple="true"
:action='uploadAction'
:headers="headers"
:before-upload="beforeUpload"
:remove='remove'
@change="handleChange">
<p>
<a-icon style="font-size: 67px;color: #c0c4cc;" type="cloud-upload"/>
</p>
<p class="ant-upload-text" style="font-size: 14px;line-height: 30px">{{this.$t('clickUpload')}}</p>
</a-upload-dragger>
</a-modal>
</div>
</template>
<script>
import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types"
import { ACCESS_TOKEN } from '@/store/mutation-types'
export default {
name: 'file',
props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType'],
data(){
return{
visible:false,
title:this.$t('clickUpload'),
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload",
myuploadAction:window._CONFIG['domianURL']+this.thisFileUploadUrl,
upDataList:[],
downLoadFileUrl:window._CONFIG['domianURL']+'/sys/common/static',
fileList:[],
myfileList:[],
isLoding:false,
}
props: ['disableds', 'disabled', 'thisFileUploadUrl', 'readonly', 'thisFileType'],
data() {
return {
visible: false,
title: this.$t('clickUpload'),
uploadAction: window._CONFIG['domianURL'] + '/sys/common/upload',
myuploadAction: window._CONFIG['domianURL'] + this.thisFileUploadUrl,
upDataList: [],
downLoadFileUrl: window._CONFIG['domianURL'] + '/sys/common/static',
fileList: [],
myfileList: [],
isLoding: false
}
},
created(){
const token = Vue.ls.get(ACCESS_TOKEN);
this.headers = {"X-Access-Token":token};
this.containerId = 'container-ty-'+new Date().getTime();
created() {
const token = Vue.ls.get(ACCESS_TOKEN)
this.headers = { 'X-Access-Token': token }
this.containerId = 'container-ty-' + new Date().getTime()
},
mounted(){
mounted() {
// console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl);
},
methods:{
perentHandleFunc(data){
methods: {
perentHandleFunc(data) {
this.myfileList = data
if (data && data.length > 0){
this.myfileList.forEach((res)=>{
if (data && data.length > 0) {
this.myfileList.forEach((res) => {
res.name = res.fileName
res.uid = res.id
})
}else {
} else {
this.myfileList = []
}
},
beforeUpload(file) {
console.log(file)
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
this.fileTypeSatus = true;
this.fileTypeSatus = true
//TODO 客户要求不拦截文件
// if(file.type){
// if (thisFileType.indexOf(file.type) != -1) {
@@ -81,60 +84,60 @@
// }
this.$message.destroy()
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
this.errorMessage = file.name + "文件大小超出100MB限制, 请压缩或降低文件质量!";
this.errorMessage = file.name + '文件大小超出100MB限制, 请压缩或降低文件质量!'
},
remove(){
this.fileTypeSatus = true;
remove() {
this.fileTypeSatus = true
},
mydownload(item){
var fileName = item.fileName;
downFile(this.downLoadFileUrl+'/'+item.ext1,{}).then((data)=>{
mydownload(item) {
var fileName = item.fileName
downFile(this.downLoadFileUrl + '/' + item.ext1, {}).then((data) => {
if (!data) {
this.$message.destroy()
this.$message.warning("文件下载失败")
this.$message.warning('文件下载失败')
return
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName)
}else{
let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'}))
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName)
} else {
let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
let link = document.createElement('a')
link.style.display = 'none'
link.href = url
link.setAttribute('download', fileName)
document.body.appendChild(link)
link.click()
document.body.removeChild(link); //下载完成移除元素
window.URL.revokeObjectURL(url); //释放掉blob对象
document.body.removeChild(link) //下载完成移除元素
window.URL.revokeObjectURL(url) //释放掉blob对象
}
})
},
mypreview(item){
console.log(item);
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(this.downLoadFileUrl+'/'+item.ext1)
mypreview(item) {
console.log(item)
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(this.downLoadFileUrl + '/' + item.ext1)
window.open(url, '_blank')
},
handleChange(info) {
let { file } = info;
const status = info.file.status;
info.fileList.forEach((val,index)=>{
if(val.response && !val.response.result){
this.$message.error(val.response.message);
info.fileList.splice(index,1)
let { file } = info
const status = info.file.status
info.fileList.forEach((val, index) => {
if (val.response && !val.response.result) {
this.$message.error(val.response.message)
info.fileList.splice(index, 1)
}
})
if (this.fileTypeSatus) {
if (file.size > 100000000) {
this.$message.error(this.errorMessage)
return
}else {
} else {
if (status === 'error') {
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error(`${info.file.name} 文件上传失败。`);
this.$message.error(`${info.file.name} 文件上传失败。`)
} else if (status === 'removed') {
this.myfileList = info.fileList;
this.myfileList = info.fileList
this.fileList = []
this.myfileList.forEach((res) => {
if (res.response) {
@@ -144,16 +147,16 @@
}
})
this.$emit('uploadSuccess', this.fileList)
if(this.myfileList.length > 0){
if (this.myfileList.length > 0) {
this.$message.destroy()
this.$message.success(`${info.file.name} 删除成功。`);
this.$message.success(`${info.file.name} 删除成功。`)
}
} else if (status === 'done') {
this.fileList = []
this.myfileList = info.fileList;
this.myfileList = info.fileList
if (info.fileList.length > 20) {
info.fileList.splice(20)
this.myfileList = info.fileList;
this.myfileList = info.fileList
this.myfileList.forEach((res) => {
if (res.response) {
this.fileList.push(res.response.result)
@@ -163,7 +166,7 @@
})
this.$emit('uploadSuccess', this.fileList)
this.$message.destroy()
this.$message.error('最多只能上传二十个');
this.$message.error('最多只能上传二十个')
return
}
this.myfileList.forEach((res) => {
@@ -174,30 +177,29 @@
}
})
this.$emit('uploadSuccess', this.fileList)
if(this.myfileList.length > 0){
if (this.myfileList.length > 0) {
this.$message.destroy()
this.$message.success(`${info.file.name} 文件上传成功。`);
this.$message.success(`${info.file.name} 文件上传成功。`)
}
} else if (status === 'uploading') {
this.myfileList = info.fileList;
this.$emit('uploadSuccess')
this.myfileList = info.fileList
// this.$message.success(`${info.file.name} 文件上传成功。`);
}
}
}else{
} else {
this.$message.warning('不支持上传该类型的文件!')
}
},
resetFileList(){
this.myfileList = [];
this.fileList = [];
},
},
resetFileList() {
this.myfileList = []
this.fileList = []
}
}
}
</script>
<style>
.ant-upload-list-item-name{
.ant-upload-list-item-name {
color: rgba(0, 0, 0, 0.65) !important;
}
}
</style>
@@ -164,7 +164,9 @@
confirmLoading: false,
selectedIds:'', //选择行id
record:{},
accept:'application/pdf'
accept:'application/pdf',
today:'',
timer:''
}
},
props:{
@@ -173,9 +175,26 @@
mounted() {
// this.loadData()
},
created() {
const date = new Date(),
year = date.getFullYear(),
month = date.getMonth()+1,
myDate = date.getDate()
this.today = `${year}/${month < 10 ? '0'+month : month}/${myDate < 10 ? '0'+myDate : myDate}`
if(this.timer){
clearInterval(this.timer)
}else{
eventBUs.$emit('searchReset')
this.initSetTimeout(this.today)//调用每隔10秒刷新数据
}
},
methods:{
//上传
handleUpload(){
// if(this.timer){
// clearInterval(this.timer)
// }
this.fileVisible=true
},
//调取已入库文件
@@ -229,8 +248,9 @@
//下载
actionDown(val){
// downloadFile('/sys/common/download', val.docRealName, { id: val.attId })
downloadFile('ocr/OcrRestful/downFile', val.docRealName, { fileName: val.docRealName })
// downloadFile(val.docRealFile)
window.open(val.docRealFile)
// window.open(val.docRealFile)
},
//删除
actionDelete(record){
@@ -264,6 +284,7 @@
},
//上传确定按钮
modalOk(){
this.$refs.fileForm.sumber()
},
handleCancel(){
@@ -325,8 +346,17 @@
},
addFormClick() {
this.fileVisible = false
}
}
},
//10秒刷新页面
initSetTimeout(today) {//每隔10秒刷新数据,也就是每隔10秒向后台请求一次数据
this.timer=setInterval( () => {
eventBUs.$emit('searchReset')
}, 10000)
},
},
beforeDestroy(){
clearInterval(this.timer)
},
}
</script>
@@ -190,7 +190,8 @@
let params = {
attId: this.rows.id,
standName: this.rows.title,
standNumber: this.rows.serial_number
standNumber: this.rows.serial_number,
connectId:this.rows.connect_id
}
if(this.rows.text_info=='发布稿(必读)'){
params.fileType='1'
@@ -76,8 +76,8 @@
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item :label="$t('DisplayArea')" prop="areaId">
<a-select :placeholder="$t('SelectDisplayArea')" v-model="form.areaId" @change="handleChange">
<a-form-model-item :label="$t('DisplayArea')" prop="showArea">
<a-select :placeholder="$t('SelectDisplayArea')" v-model="form.showArea" @change="handleChange">
<a-select-option v-for="(item,index) in areaOptions" :key="item.id" :value="item.id">
{{item.showArea}}
</a-select-option>
@@ -176,9 +176,14 @@
],
dbFieldTxt: [
{ required: true, message: this.$t('PleaseEnterPropertyName'),trigger: 'blur'},
{ min:1, max: 20, message: this.$t('cantExeed')+'20'+this.$t('characters'), trigger: 'blur' },
],
dbFieldName: [
{ required: true, message: this.$t('PleaseEnterYourEnglishName'),trigger: 'blur'},
{ min:1, max: 20, message: this.$t('cantExeed')+'20'+this.$t('characters'), trigger: 'blur' },
],
dbFieldEnName:[
{ max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },
],
fieldShowType: [
{ required: true, message: this.$t('PleaseSelectAttributeType'),trigger: 'change'},
@@ -198,7 +203,7 @@
isShowForm: [
{ required: true, message: this.$t('SelectWhetherDisplayList'),trigger: 'change'},
],
areaId: [
showArea: [
{ required: true, message: this.$t('SelectDisplayArea'),trigger: 'change'},
],
isQuery: [
@@ -351,6 +356,7 @@
httpurl+=this.url.add;
method = 'post';
this.form.id=''
this.form.isReadOnly=0
}else if(this.submitEdit=='edit'){
httpurl+=this.url.edit;
method = 'put';
@@ -111,8 +111,8 @@
columns: [
{
title: this.$t('DisplayArea'),
dataIndex: 'show_area',
key: 'show_rea',
dataIndex: 'showArea',
key: 'showArea',
align: "center",
width: 100,
},
@@ -120,13 +120,13 @@
title: this.$t('enName'),
align: "center",
width: 100,
dataIndex: 'en_name',
dataIndex: 'enName',
},
{
title: this.$t('Module'),
align: "center",
width: 100,
dataIndex: 'item_text',
dataIndex: 'isModel_dictText',
},
{
title: this.$t('SortNumber'),
@@ -162,6 +162,10 @@
{ required: true, message: this.$t('PleaseSelectModule'), trigger: 'change' },
],
enName:[
{ max: 100, message: this.$t('CannotExceed100characters'), trigger: 'blur' },
],
showArea:[
{ required: true, message: this.$t('enterDisplayArea'), trigger: 'blur' },
{ min:1, max: 50, message: this.$t('charactersLength'), trigger: 'blur' },
@@ -184,9 +188,9 @@
let params={
...this.queryParams
}
getAction(`tag/onlCgformArea/page`,params).then(res=>{
postAction(`tag/onlCgformArea/page`,params).then(res=>{
if(res.success){
this.areaTable=res.result
this.areaTable=[...res.result.records]
this.total=res.result.total
}
})
@@ -36,7 +36,10 @@
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-model-item :label="$t('name')" prop="name">
<a-form-model-item :label="$t('name')" prop="itemText" v-if="dictVal=='list'">
<a-input v-model="form.itemText" :placeholder="$t('enterName')" />
</a-form-model-item>
<a-form-model-item :label="$t('name')" prop="name" v-if="dictVal=='tree'">
<a-input v-model="form.name" :placeholder="$t('enterName')" />
</a-form-model-item>
<a-form-model-item :label="$t('DataValue')" prop="itemValue">
@@ -102,6 +105,10 @@
newVisible:false,
rules:{
name:[
{ required: true, message: this.$t('enterName'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
],
itemText:[
{ required: true, message: this.$t('enterName'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
],
@@ -127,17 +134,36 @@
total:0,
isEdit:false,
selectedIds:[], //树形选中的id
parentData:[]
parentData:[],
editPId:'',
tabletreeDataSource:[]
}
},
watch: {
parentName(value) {
console.log(value);
},
editPId(){
this.parentData=this.getParents
},
},
mounted() {
this.loadData()
},
computed:{
//获取父级名称
getParents(){
let parents=[]
if(this.tabletreeDataSource&&this.tabletreeDataSource.length>0){
this.tabletreeDataSource.forEach((item)=>{
if(item.pid=='0'&&item.id!=this.editPId){
parents.push(item)
}
})
}
return parents
},
},
methods:{
//获取列表数据
loadData(){
@@ -164,25 +190,16 @@
isTagDict:1
}).then(res=>{
let parentNode=[]
let tabletreeData=[...res.result]
let data = this.toTree(tabletreeData)
this.tabletreeDataSource=[...res.result]
let data = this.toTree(this.tabletreeDataSource)
this.tabletreeData=data
this.parentData=this.getParents(tabletreeData)
this.parentData=this.getParents
this.dataFlag=true
})
}
},
//获取父级名称
getParents(data){
let parents=[]
data.forEach((item)=>{
if(item.pid=='0'){
parents.push(item)
}
})
return parents
},
//将数据拼成树形结构
toTree(config) {
config.forEach(function(item) {
@@ -313,6 +330,8 @@
//树状编辑
editTreeDict(val,form){
this.title=this.$t('edit')
this.editPId=form.id
// console.log('dictId',form)
this.isEdit=true
this.form={...form}
if(form.pid=='0'){
@@ -128,6 +128,7 @@
}
.page{
margin-top: 20px;
text-align: right;
}
}
</style>
@@ -133,7 +133,7 @@
deleteAction(`sys/category/delete`, { id: val.id }).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'));
this.$emit('ok')
this.$emit('ok',this.queryParams)
}else{
this.$message.warning(this.$t('operationFailed'));
}
@@ -293,6 +293,7 @@
.tree-table{
.page{
margin-top: 20px;
text-align: right;
}
}
@@ -11,9 +11,9 @@
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<a @click="editVisible(record.id)" v-if="!record.is_read_only">{{$t('edit')}}</a>
<a-divider type="vertical" v-if="!record.is_read_only" />
<a class="table-del" @click="deleteVisible(record.id)">{{$t('delete')}}</a>
<a @click="editVisible(record.id)" v-if="record.isReadOnly==0">{{$t('edit')}}</a>
<a-divider type="vertical" v-if="record.isReadOnly==0" />
<a class="table-del" v-if="record.isReadOnly==2||record.isReadOnly==0" @click="deleteVisible(record.id)">{{$t('delete')}}</a>
</span>
</a-table>
<div class="page" v-if="tableData.length > 0">
@@ -50,10 +50,14 @@
props:{
tableData:Array,
columns:Array,
total:Number
total:Number,
parm:Object
},
mounted() {
this.queryParams.pageNo=this.parm.pageNo
this.queryParams.pageSize=this.parm.pageSize
// console.log('colum',this.tableData,this.columns)
console.log('query',this.queryParams)
},
methods:{
onSelectChange(selectedRowKeys) {
@@ -90,6 +94,7 @@
}
.page{
margin-top: 20px;
text-align: right;
}
}
</style>
@@ -111,8 +111,8 @@
columns: [
{
title: this.$t('LabelName'),
dataIndex: 'dict_name',
key: 'dict_name',
dataIndex: 'dictName',
key: 'dictName',
align: "center",
width: 100,
},
@@ -120,7 +120,7 @@
title: this.$t('LabelType'),
align: "center",
width: 100,
dataIndex: 'attribute_type_name',
dataIndex: 'attributeType_dictText',
},
{
title: this.$t('describe'),
@@ -170,7 +170,7 @@
getAction(`sys/dict/page`,params).then(res=>{
if(res.success){
this.total=res.result.total
this.tableData=[...res.result]
this.tableData=[...res.result.records]
}
})
},
@@ -328,7 +328,7 @@
}
.page{
margin-top: 20px;
text-align: right;
}
}
.type-popover{
@@ -44,7 +44,7 @@
<a-spin :spinning="spinning" tip="Loading...">
<a-tabs default-active-key="1" @change="callbackTab">
<a-tab-pane key="1" :tab="$t('DocumentLibrary')">
<tabTable :tableData="tableData" :columns="taglabColumns" @visibleEd="visibleEd" @visibleDelete="visibleDelete" @queryParams="queryParams" :total="total"></tabTable>
<tabTable v-if="spinning==false" :tableData="tableData" :columns="taglabColumns" :parm="queryParam" @visibleEd="visibleEd" @visibleDelete="visibleDelete" @queryParams="queryParams" :total="total"></tabTable>
</a-tab-pane>
<!-- <a-tab-pane key="2" :tab="$t('DocumentSplitting')" force-render>-->
<!-- <tabTable :tableData="tableData" :columns="taglabColumns" @visibleEd="visibleEd" @visibleDelete="visibleDelete" @queryParams="queryParams" :total="total"></tabTable>-->
@@ -88,37 +88,37 @@
title: this.$t('ChineseName'),
align: "center",
width: 100,
dataIndex: 'db_field_txt',
dataIndex: 'dbFieldTxt_dictText',
},
{
title: this.$t('enName'),
align: "center",
width: 100,
dataIndex: 'db_field_en_name',
dataIndex: 'dbFieldEnName_dictText',
},
{
title: this.$t('AttributeType'),
align: "center",
width: 100,
dataIndex: 'item_text',
dataIndex: 'fieldShowType_dictText',
},
{
title: this.$t('FieldLength'),
align: "center",
width: 80,
dataIndex: 'db_length'
dataIndex: 'dbLength_dictText'
},
{
title: this.$t('DisplayOrder'),
align: "center",
width: 80,
dataIndex: 'order_num'
dataIndex: 'orderNum_dictText'
},
{
title: this.$t('DisplayArea'),
align: "center",
width: 80,
dataIndex: 'show_area'
dataIndex: 'showAreaName'
},
{
title: this.$t('operation'),
@@ -212,7 +212,10 @@
postAction(`tag/onlCgformTag/page`,params).then(res=>{
if(res.success){
this.total=res.result.total
this.tableData= [ ...res.result]
this.tableData= [ ...res.result.records]
this.spinning=false
}else{
this.$message.warning(res.message)
this.spinning=false
}
})
@@ -279,6 +282,7 @@
if (res.success) {
if (this.key == 1) {
this.$message.success(this.$t('OperationSuccessful'))
this.queryParam.pageNo=1
this.loadData(1)
} else if (this.key == 2) {
this.$message.success(this.$t('OperationSuccessful'))
@@ -11,6 +11,9 @@
:loading="loading"
:columns="columns"
>
<span slot="operation" slot-scope="record">
<a @click="classAdd(record)" style="margin-right:8px">{{$t('See')}}</a>
</span>
</a-table>
<div class="page" v-if="dataSource.length > 0">
<a-pagination
@@ -11,6 +11,9 @@
:loading="loading"
:columns="columns"
>
<span slot="operation" slot-scope="record">
<a @click="classAdd(record)" style="margin-right:8px">{{$t('See')}}</a>
</span>
</a-table>
<div class="page" v-if="dataSource.length > 0">
<a-pagination
@@ -11,6 +11,9 @@
:loading="loading"
:columns="columns"
>
<span slot="operation" slot-scope="record">
<a @click="classAdd(record)" style="margin-right:8px">{{$t('See')}}</a>
</span>
</a-table>
<div class="page" v-if="dataSource.length > 0">
<a-pagination
@@ -11,6 +11,9 @@
:loading="loading"
:columns="columns"
>
<span slot="operation" slot-scope="record">
<a @click="dealWith(record)" style="margin-right:8px">{{$t('Processing')}}</a>
</span>
</a-table>
<div class="page" v-if="dataSource.length > 0">
<a-pagination
@@ -11,6 +11,10 @@
:loading="loading"
:columns="columns"
>
<span slot="operation" slot-scope="record">
<a @click="dealWith(record)" style="margin-right:8px">{{$t('Processing')}}</a>
<a @click="classDel(record)" style="margin-right:8px">{{$t('deleteLib')}}</a>
</span>
</a-table>
<div class="page" v-if="dataSource.length > 0">
<a-pagination
@@ -30,6 +34,7 @@
import { mapMutations, mapActions, mapGetters } from 'vuex'
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
import moment from 'moment'
import eventBUs from '../../../../../common/event'
export default {
name: 'ProcessCenter',
@@ -117,40 +122,23 @@
...mapGetters(['userInfo']),
onSelectChange() {
},
handleCommand(command) {
switch (command[1]) {
case '查看':
this.classAdd(command[0])
break
case '办理':
this.dealWith(command[0])
break
case '删除':
this.classDel(command[0])
break
}
},
// 删除
classDel(row) {
this.$confirm('确认删除信息?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
confirmButtonClass: 'common-button-primary',
roundButton: true
}).then(() => {
this.$http.get('lawss/activiti/deleteDraft', { id: row.id }, {
_this: this,
loading: 'loading'
}, res => {
if (res.success) {
this.$message.success('删除成功')
this.pageNo = 1
this.queryProcess()
} else {
}
})
let _this = this
this.$confirm({
content: _this.$t('ConfirmDelete'),
onOk() {
deleteAction('task/deleteDraft', { id: row.id }).then((res) => {
if (res.success) {
_this.$message.success(_this.$t('OperationSuccessful'));
this.pageNo = 1
_this.queryProcess()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
}
})
},
// 查询待办流程
+2 -2
View File
@@ -9,8 +9,8 @@
{{$t('NotificationTime')}}: {{this.$route.query.sendTime}}
</span>
</div>
<div class="box-content">
{{this.$route.query.msgContentInfo}}
<div class="box-content" v-html="this.$route.query.msgContentInfo">
<!-- {{this.$route.query.msgContentInfo}}-->
</div>
</div>
</template>
@@ -65,8 +65,8 @@
:loading="loading"
@change="handleTableChange">
<span slot="msgContent" slot-scope="text,scope">
<a :style="{'color':scope.readFlag == 0 ? 'red':'#00A0E9'}" @click="msgContentClick(scope)">
{{text}}
<a :style="{'color':scope.readFlag == 0 ? 'red':'#00A0E9'}" :title="text" @click="msgContentClick(scope)">
{{text && text.length > 25?text.slice(0,24)+'...':text}}
</a>
</span>
<span slot="msgCategory" slot-scope="text,scope">