文档库--导入
This commit is contained in:
+37
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
-1
@@ -646,5 +646,26 @@ public class DateUtils extends PropertyEditorSupport {
|
|||||||
calendar.setTime(getDate());
|
calendar.setTime(getDate());
|
||||||
return calendar.get(Calendar.YEAR);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-10
@@ -413,16 +413,8 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
|
|||||||
@ApiOperation(value = "导入.zip")
|
@ApiOperation(value = "导入.zip")
|
||||||
@PostMapping(value = "/importZip")
|
@PostMapping(value = "/importZip")
|
||||||
public Result<?> importZip(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
|
public Result<?> importZip(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
|
||||||
//验证文件名是否合格
|
String result = bussDocumentLibraryEOService.importZip(file);
|
||||||
//截取后缀名
|
return Result.OK(result);
|
||||||
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("导入成功");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "推送")
|
@ApiOperation(value = "推送")
|
||||||
|
|||||||
+3
@@ -78,4 +78,7 @@ public interface BussDocumentLibraryEOMapper extends BaseMapper<BussDocumentLibr
|
|||||||
List<Map<String, Object>> getInfoListByReplaceStandard(@Param("replaceStandard") String replaceStandard);
|
List<Map<String, Object>> getInfoListByReplaceStandard(@Param("replaceStandard") String replaceStandard);
|
||||||
|
|
||||||
|
|
||||||
|
List<Map<String,Object>> getListBySerialNumber(@Param("serialNumbers") String serialNumbers);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+11
@@ -70,5 +70,16 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|||||||
+141
-125
@@ -3,7 +3,7 @@ package com.jero.modules.document.service;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
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.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -13,164 +13,180 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* @Description: 文档库信息表
|
* @Description: 文档库信息表
|
||||||
* @Author: jero-boot
|
* @Author: jero-boot
|
||||||
* @Date: 2022-01-21
|
* @Date: 2022-01-21
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibraryEO> {
|
public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibraryEO> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void deleteById(String id);
|
void deleteById(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void deleteByIds(List<String> ids);
|
void deleteByIds(List<String> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询
|
* 通过id查询
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
BussDocumentLibraryEO queryById(String id);
|
BussDocumentLibraryEO queryById(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表查询
|
* 列表查询
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<BussDocumentLibraryEO> queryList();
|
List<BussDocumentLibraryEO> queryList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询条件
|
* 查询条件
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String,Object>> queryCondition(String flag,String cut);
|
List<Map<String, Object>> queryCondition(String flag, String cut);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表表头
|
* 列表表头
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String,Object>> getHeader(String flag,String cut);
|
List<Map<String, Object>> getHeader(String flag, String cut);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增表单
|
* 新增表单
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String,Object>> getAddForm(String flag,String cut,String type);
|
List<Map<String, Object>> getAddForm(String flag, String cut, String type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑数据查询
|
* 编辑数据查询
|
||||||
* @param id
|
*
|
||||||
* @return
|
* @param id
|
||||||
*/
|
* @return
|
||||||
List<Map<String,Object>> getDocumentInfoById(String id,String cut);
|
*/
|
||||||
|
List<Map<String, Object>> getDocumentInfoById(String id, String cut);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情数据查询
|
* 详情数据查询
|
||||||
* @param id
|
*
|
||||||
* @return
|
* @param id
|
||||||
*/
|
* @return
|
||||||
List<Map<String,Object>> getInfoById(String id,String cut);
|
*/
|
||||||
|
List<Map<String, Object>> getInfoById(String id, String cut);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增数据
|
* 新增数据
|
||||||
* @param map
|
*
|
||||||
*/
|
* @param map
|
||||||
void addInfo(Map<String,Object> map);
|
*/
|
||||||
|
void addInfo(Map<String, Object> map);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑数据
|
* 编辑数据
|
||||||
* @param map
|
*
|
||||||
*/
|
* @param map
|
||||||
void updateInfo(Map<String,Object> map);
|
*/
|
||||||
|
void updateInfo(Map<String, Object> map);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页
|
* 分页
|
||||||
* @param parameter
|
*
|
||||||
* @return
|
* @param parameter
|
||||||
*/
|
* @return
|
||||||
IPage getInfoPage(Map<String,Object> parameter);
|
*/
|
||||||
|
IPage getInfoPage(Map<String, Object> parameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代替标准分页
|
* 代替标准分页
|
||||||
* @param parameter
|
*
|
||||||
* @return
|
* @param parameter
|
||||||
*/
|
* @return
|
||||||
IPage replacePageInfo(Map<String,Object> parameter);
|
*/
|
||||||
|
IPage replacePageInfo(Map<String, Object> parameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ocr识别调取已入库文件分页
|
* ocr识别调取已入库文件分页
|
||||||
* @param parameter
|
*
|
||||||
* @return
|
* @param parameter
|
||||||
*/
|
* @return
|
||||||
IPage ocrPageInfo(Map<String,Object> parameter);
|
*/
|
||||||
|
IPage ocrPageInfo(Map<String, Object> parameter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加收藏
|
* 添加收藏
|
||||||
* @param id
|
*
|
||||||
*/
|
* @param id
|
||||||
void addCollect(String id);
|
*/
|
||||||
|
void addCollect(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消收藏
|
* 取消收藏
|
||||||
* @param id
|
*
|
||||||
*/
|
* @param id
|
||||||
void cancelCollect(String id);
|
*/
|
||||||
|
void cancelCollect(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加订阅
|
* 添加订阅
|
||||||
* @param id
|
*
|
||||||
*/
|
* @param id
|
||||||
void addSubscribe(String id);
|
*/
|
||||||
|
void addSubscribe(String id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消订阅
|
* 取消订阅
|
||||||
* @param id
|
*
|
||||||
*/
|
* @param id
|
||||||
void cancelSubscribe(String id);
|
*/
|
||||||
|
void cancelSubscribe(String id);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel
|
* 导出excel
|
||||||
* @param map
|
*
|
||||||
* @param response
|
* @param map
|
||||||
* @param request
|
* @param response
|
||||||
*/
|
* @param request
|
||||||
void exportExcel(Map<String,Object> map,
|
*/
|
||||||
HttpServletResponse response,
|
void exportExcel(Map<String, Object> map,
|
||||||
HttpServletRequest request);
|
HttpServletResponse response,
|
||||||
|
HttpServletRequest request);
|
||||||
|
|
||||||
void exportZip(Map<String,Object> map,
|
void exportZip(Map<String, Object> map,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
HttpServletRequest request);
|
HttpServletRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板下载
|
* 模板下载
|
||||||
* @param response
|
*
|
||||||
* @param request
|
* @param response
|
||||||
*/
|
* @param request
|
||||||
void exportTemplate(Map<String,Object> map,HttpServletResponse response, HttpServletRequest request);
|
*/
|
||||||
|
void exportTemplate(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ocr识别调取已入库文件-中英文切换
|
* ocr识别调取已入库文件-中英文切换
|
||||||
* @param flag
|
*
|
||||||
* @param cut
|
* @param flag
|
||||||
* @return
|
* @param cut
|
||||||
*/
|
* @return
|
||||||
List<Map<String, Object>> getHeaderOrConditionForOcr(String flag, String cut);
|
*/
|
||||||
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+538
-124
File diff suppressed because it is too large
Load Diff
+17
@@ -152,4 +152,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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user