文档库--导入
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());
|
||||
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")
|
||||
@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 = "推送")
|
||||
|
||||
+3
@@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
+11
@@ -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>
|
||||
|
||||
+141
-125
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
+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