Commit f595cafb authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents 18855c48 5e42c554
...@@ -78,12 +78,12 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -78,12 +78,12 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
@Override @Override
public IPage<TElecEmployeeInfo> getTElecEmployeeInfoPage(Page page, TElecEmployeeInfo tElecEmployeeInfo) { public IPage<TElecEmployeeInfo> getTElecEmployeeInfoPage(Page page, TElecEmployeeInfo tElecEmployeeInfo) {
return baseMapper.getTElecEmployeeInfoPage(page,tElecEmployeeInfo); return baseMapper.getTElecEmployeeInfoPage(page, tElecEmployeeInfo);
} }
/** /**
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @param zipFile zip文件包 * @param zipFile zip文件包
* @description: 解析zip文件包中的多个附件,并生成结算记录
* @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean> * @return: com.yifu.cloud.v1.common.core.util.R<java.lang.Boolean>
* @author: huyc * @author: huyc
* @date: 2022/6/27 * @date: 2022/6/27
...@@ -117,7 +117,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -117,7 +117,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
@Override @Override
public R getEmpInfoByCard(String idCard) { public R getEmpInfoByCard(String idCard) {
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda() TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,idCard)).eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING)); .eq(TEmployeeInfo::getEmpIdcard, idCard)).eq(TEmployeeInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
if (Common.isNotNull(tEmployeeInfo)) { if (Common.isNotNull(tEmployeeInfo)) {
if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()) { if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()) {
return R.failed("身份证号对应的档案为已减档"); return R.failed("身份证号对应的档案为已减档");
...@@ -132,15 +132,16 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -132,15 +132,16 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
baseMapper.insert(tElecEmployeeInfo); baseMapper.insert(tElecEmployeeInfo);
//更新附件信息 //更新附件信息
List<String> ids; List<String> ids;
if (Common.isNotNull(tElecEmployeeInfo.getAttaIds())){ if (Common.isNotNull(tElecEmployeeInfo.getAttaIds())) {
ids = Common.initStrToList(tElecEmployeeInfo.getAttaIds(),CommonConstants.COMMA_STRING); ids = Common.initStrToList(tElecEmployeeInfo.getAttaIds(), CommonConstants.COMMA_STRING);
attaInfoMapper.updateDomainId(tElecEmployeeInfo.getId(),ids); attaInfoMapper.updateDomainId(tElecEmployeeInfo.getId(), ids);
} }
return R.ok(); return R.ok();
} }
/** /**
* zip解压 * zip解压
*
* @param srcFile zip源文件 * @param srcFile zip源文件
* @throws RuntimeException 解压失败会抛出运行时异常 * @throws RuntimeException 解压失败会抛出运行时异常
*/ */
...@@ -155,7 +156,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -155,7 +156,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
Map<String, String> elecTypeMap; Map<String, String> elecTypeMap;
if (dictR == null) { if (dictR == null) {
return R.failed("获取字典失败!"); return R.failed("获取字典失败!");
}else { } else {
dictMap = dictR.getData(); dictMap = dictR.getData();
elecTypeMapData = dictMap.get("data"); elecTypeMapData = dictMap.get("data");
elecTypeMap = elecTypeMapData.get("literature_types"); elecTypeMap = elecTypeMapData.get("literature_types");
...@@ -170,34 +171,54 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -170,34 +171,54 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
zipFile = new ZipFile(srcFile, CharsetUtil.CHARSET_GBK); zipFile = new ZipFile(srcFile, CharsetUtil.CHARSET_GBK);
Enumeration<?> entries = zipFile.entries(); Enumeration<?> entries = zipFile.entries();
Enumeration<?> entriesCheck = zipFile.entries(); Enumeration<?> entriesCheck = zipFile.entries();
Map<String,String> insMap = new HashMap<>();
List<TElecEmployeeInfo> infolist = new ArrayList<>(); Set<String> infoList =new HashSet<>();
List<String> list = new ArrayList<>(); Set<String> idCardList =new HashSet<>();
Set<String> cardType =new HashSet<>();
while (entriesCheck.hasMoreElements()) { while (entriesCheck.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entriesCheck.nextElement(); ZipEntry entry = (ZipEntry) entriesCheck.nextElement();
//添加进filesName //添加进filesName
String empInfo = entry.getName(); String empInfo = entry.getName();
// 如果是文件夹,就创建个文件夹 infoList.add(empInfo);
if (!entry.isDirectory()) { String dataType = "";
if (empInfo.length() > empInfo.lastIndexOf("/") + 1) { if (empInfo.length() == empInfo.lastIndexOf("/") + 1) {
String idCard = empInfo.substring(0, empInfo.indexOf("/")); String idCard = empInfo.substring(0, empInfo.indexOf("/"));
String dataType = empInfo.substring(empInfo.indexOf("/") + 1, empInfo.lastIndexOf("/")); TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda() .eq(TEmployeeInfo::getEmpIdcard, idCard)).eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getEmpIdcard, idCard)).eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT) .eq(TEmployeeInfo::getDeleteFlag, CommonConstants.ZERO_STRING)
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.ZERO_STRING) .eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT));
.eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)); if (Common.isEmpty(tEmployeeInfo)) {
if (Common.isEmpty(tEmployeeInfo)) { return R.failed("未找到身份证对应的档案信息,身份证号:" + idCard);
return R.failed("未找到身份证对应的档案信息,身份证号:" + idCard); }
} idCardList.add(idCard);
if (empInfo.length() > 20) {
dataType = empInfo.substring(empInfo.indexOf("/") + 1, empInfo.lastIndexOf("/"));
if (Common.isNotNull(elecTypeMap)) { if (Common.isNotNull(elecTypeMap)) {
if (!Common.isNotNull(elecTypeMap.get(dataType))) { if (!Common.isNotNull(elecTypeMap.get(dataType))) {
return R.failed("资料类型错误:" + dataType); return R.failed("资料类型错误:" + dataType);
} }
cardType.add(idCard + "/" + dataType);
} }
} }
} }
} }
for (String idCarInfo : idCardList) {
if (!infoList.stream().anyMatch(e-> containsCheckTwo(e,idCarInfo))) {
return R.failed(idCarInfo + ":"+"证件数据不可为空");
}
}
if (cardType.size() > CommonConstants.ZERO_INT) {
for (String typeInfo :cardType) {
if (!infoList.stream().anyMatch(e -> containsCheckOne(e, typeInfo))) {
return R.failed(typeInfo + ":" + "证件数据不可为空");
}
}
}
Map<String, String> insMap = new HashMap<>();
List<TElecEmployeeInfo> infolist = new ArrayList<>();
List<String> list = new ArrayList<>();
while (entries.hasMoreElements()) { while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement(); ZipEntry entry = (ZipEntry) entries.nextElement();
//添加进filesName //添加进filesName
...@@ -226,37 +247,31 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -226,37 +247,31 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
} }
TElecEmployeeInfo tElecEmployeeInfo = new TElecEmployeeInfo(); TElecEmployeeInfo tElecEmployeeInfo = new TElecEmployeeInfo();
if (empInfo.length() > empInfo.lastIndexOf("/") + 1) { if (empInfo.length() > empInfo.lastIndexOf("/") + 1) {
String idCard = empInfo.substring(0,empInfo.indexOf("/")); String idCard = empInfo.substring(0, empInfo.indexOf("/"));
String dataType = empInfo.substring(empInfo.indexOf("/") +1,empInfo.lastIndexOf("/")); String dataType = empInfo.substring(empInfo.indexOf("/") + 1, empInfo.lastIndexOf("/"));
String empName = ""; String empName = "";
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda() TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getOne((Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard,idCard)).eq(TEmployeeInfo::getFileStatus,CommonConstants.ZERO_INT) .eq(TEmployeeInfo::getEmpIdcard, idCard)).eq(TEmployeeInfo::getFileStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeInfo::getDeleteFlag,CommonConstants.ZERO_STRING)); .eq(TEmployeeInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
if (Common.isNotNull(tEmployeeInfo)) { if (Common.isNotNull(tEmployeeInfo)) {
empName = tEmployeeInfo.getEmpName(); empName = tEmployeeInfo.getEmpName();
}else {
return R.failed("未找到身份证对应的档案信息,身份证号:" + idCard);
} }
tElecEmployeeInfo.setEmpIdcard(idCard); tElecEmployeeInfo.setEmpIdcard(idCard);
tElecEmployeeInfo.setEmpName(empName); tElecEmployeeInfo.setEmpName(empName);
if (Common.isNotNull(elecTypeMap)) { if (Common.isNotNull(elecTypeMap)) {
if (Common.isNotNull(elecTypeMap.get(dataType))) { if (Common.isNotNull(elecTypeMap.get(dataType))) {
tElecEmployeeInfo.setDataType(elecTypeMap.get(dataType)); tElecEmployeeInfo.setDataType(elecTypeMap.get(dataType));
} else {
return R.failed("资料类型错误:" + dataType);
} }
} }
String id = insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType); String id = insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType);
//if (!elecTypeMap.get(dataType).equals(insMap.get(idCard))) {
if (Common.isEmpty(id)) { if (Common.isEmpty(id)) {
infolist.add(tElecEmployeeInfo); infolist.add(tElecEmployeeInfo);
this.save(tElecEmployeeInfo); this.save(tElecEmployeeInfo);
insMap.put(idCard + CommonConstants.DOWN_LINE_STRING + dataType, tElecEmployeeInfo.getId()); insMap.put(idCard + CommonConstants.DOWN_LINE_STRING + dataType, tElecEmployeeInfo.getId());
} }
list.add(insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType)); list.add(insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType));
fileUploadService.uploadImg(fileCovertMultipartFile(targetFile),"", CommonConstants.EIGHT_INT,insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType)); fileUploadService.uploadImg(fileCovertMultipartFile(targetFile), "", CommonConstants.EIGHT_INT, insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType));
} }
// 关流顺序,先打开的后关闭 // 关流顺序,先打开的后关闭
...@@ -282,8 +297,9 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -282,8 +297,9 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
/** /**
* File转MultipartFile * File转MultipartFile
* @description: File转MultipartFile *
* @param file 需要转换的文件 * @param file 需要转换的文件
* @description: File转MultipartFile
* @return: org.springframework.web.multipart.MultipartFile * @return: org.springframework.web.multipart.MultipartFile
* @author: huyc * @author: huyc
* @date: 2022/6/27 * @date: 2022/6/27
...@@ -311,6 +327,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -311,6 +327,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
/** /**
* 根据路径删除指定的目录或文件,无论存在与否 * 根据路径删除指定的目录或文件,无论存在与否
*
* @param path 要删除的目录或文件路径 * @param path 要删除的目录或文件路径
* @return 删除成功返回 true,否则返回 false * @return 删除成功返回 true,否则返回 false
*/ */
...@@ -376,4 +393,18 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -376,4 +393,18 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
//删除当前目录 //删除当前目录
return dirFile.delete(); return dirFile.delete();
} }
public boolean containsCheckTwo(String e,String idCard) {
if (e.contains(idCard) && e.length() > 20) {
return true;
}
return false;
}
public boolean containsCheckOne(String e,String cardType) {
if (e.contains(cardType) && e.contains(CommonConstants.SPOT)) {
return true;
}
return false;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment