Commit b38cafb1 authored by hongguangwu's avatar hongguangwu

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

parents 6155c9aa 4b6c47cf
...@@ -81,7 +81,7 @@ public class EmpCertificateExcelVO extends RowIndex implements Serializable { ...@@ -81,7 +81,7 @@ public class EmpCertificateExcelVO extends RowIndex implements Serializable {
/** /**
* 是否最高资格0是/1否 * 是否最高资格0是/1否
*/ */
@ExcelAttribute(name = "是否最高资格",errorInfo = "是否最高资格不可为空",readConverterExp = "0:是,1:否") @ExcelAttribute(name = "是否最高资格",errorInfo = "是否最高资格不可为空",readConverterExp = "0=是,1=否")
@NotNull(message = "是否最高资格不可为空") @NotNull(message = "是否最高资格不可为空")
@ExcelProperty(value ="是否最高资格") @ExcelProperty(value ="是否最高资格")
private String heightIdentification; private String heightIdentification;
......
...@@ -25,7 +25,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable { ...@@ -25,7 +25,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/** /**
* 员工姓名 * 员工姓名
*/ */
@ExcelAttribute(name = "员工姓名",errorInfo = "员工姓名不可为空",maxLength = 20) @ExcelAttribute(name = "员工姓名",isNotEmpty = true, errorInfo = "员工姓名不可为空",maxLength = 20)
@NotNull(message = "员工姓名不可为空") @NotNull(message = "员工姓名不可为空")
@ExcelProperty(value ="员工姓名") @ExcelProperty(value ="员工姓名")
private String empName; private String empName;
...@@ -33,7 +33,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable { ...@@ -33,7 +33,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/** /**
* 身份证号 * 身份证号
*/ */
@ExcelAttribute(name = "身份证号",errorInfo = "员工身份证不可为空", maxLength = 20) @ExcelAttribute(name = "身份证号",isNotEmpty = true, errorInfo = "员工身份证不可为空", maxLength = 20)
@NotNull(message = "员工身份证不可为空") @NotNull(message = "员工身份证不可为空")
@ExcelProperty(value ="身份证号") @ExcelProperty(value ="身份证号")
private String empIdcard; private String empIdcard;
...@@ -41,7 +41,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable { ...@@ -41,7 +41,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/** /**
* 学校名称 * 学校名称
*/ */
@ExcelAttribute(name = "学校",errorInfo = "学校不可为空",maxLength = 50) @ExcelAttribute(name = "学校",isNotEmpty = true, errorInfo = "学校不可为空",maxLength = 50)
@NotNull(message = "学校不可为空") @NotNull(message = "学校不可为空")
@ExcelProperty(value ="学校") @ExcelProperty(value ="学校")
private String school; private String school;
...@@ -56,7 +56,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable { ...@@ -56,7 +56,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/** /**
* 专业 * 专业
*/ */
@ExcelAttribute(name = "专业",errorInfo = "专业不可为空",maxLength = 50) @ExcelAttribute(name = "专业",isNotEmpty = true, errorInfo = "专业不可为空",maxLength = 50)
@NotNull(message = "专业不可为空") @NotNull(message = "专业不可为空")
@ExcelProperty(value ="专业") @ExcelProperty(value ="专业")
private String major; private String major;
...@@ -64,7 +64,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable { ...@@ -64,7 +64,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/** /**
* 学历名称 * 学历名称
*/ */
@ExcelAttribute(name = "学历",errorInfo = "学历不可为空",isDataId = true,dataType = "education") @ExcelAttribute(name = "学历",isNotEmpty = true, errorInfo = "学历不可为空",isDataId = true,dataType = "education")
@NotNull(message = "学历不可为空") @NotNull(message = "学历不可为空")
@ExcelProperty(value ="学历") @ExcelProperty(value ="学历")
private String educationName; private String educationName;
...@@ -79,7 +79,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable { ...@@ -79,7 +79,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/** /**
* 最高学历标识0是/1否 * 最高学历标识0是/1否
*/ */
@ExcelAttribute(name = "最高学历",errorInfo = "最高学历不可为空",readConverterExp = "0=是,1=否") @ExcelAttribute(name = "最高学历",isNotEmpty = true, errorInfo = "最高学历不可为空",readConverterExp = "0=是,1=否")
@NotNull(message = "最高学历标识不可为空") @NotNull(message = "最高学历标识不可为空")
@ExcelProperty(value ="最高学历") @ExcelProperty(value ="最高学历")
private String highIdentification; private String highIdentification;
...@@ -94,7 +94,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable { ...@@ -94,7 +94,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/** /**
* 入学时间 * 入学时间
*/ */
@ExcelAttribute(name = "入学时间",errorInfo = "入学时间不可为空",isDate = true) @ExcelAttribute(name = "入学时间",isNotEmpty = true, errorInfo = "入学时间不可为空",isDate = true)
@NotNull(message = "入学时间不可为空") @NotNull(message = "入学时间不可为空")
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyy-MM-dd")
@ExcelProperty(value ="入学时间") @ExcelProperty(value ="入学时间")
...@@ -103,7 +103,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable { ...@@ -103,7 +103,7 @@ public class EmpEducationExcelVO extends RowIndex implements Serializable {
/** /**
* 结业日期 * 结业日期
*/ */
@ExcelAttribute(name = "毕业时间",errorInfo = "毕业时间不可为空",isDate = true) @ExcelAttribute(name = "毕业时间",isNotEmpty = true, errorInfo = "毕业时间不可为空",isDate = true)
@NotNull(message = "毕业时间不可为空") @NotNull(message = "毕业时间不可为空")
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyy-MM-dd")
@ExcelProperty(value ="毕业时间") @ExcelProperty(value ="毕业时间")
......
...@@ -110,7 +110,7 @@ public class TEmpProfessionalQualificationController { ...@@ -110,7 +110,7 @@ public class TEmpProfessionalQualificationController {
@PutMapping @PutMapping
@PreAuthorize("@pms.hasPermission('archives_tempprofessionalqualification_edit')" ) @PreAuthorize("@pms.hasPermission('archives_tempprofessionalqualification_edit')" )
public R updateById(@RequestBody TEmpProfessionalQualification tEmpProfessionalQualification) { public R updateById(@RequestBody TEmpProfessionalQualification tEmpProfessionalQualification) {
return R.ok(qualificationService.updateById(tEmpProfessionalQualification)); return R.ok(qualificationService.updateByIdDiy(tEmpProfessionalQualification));
} }
/** /**
......
...@@ -46,4 +46,6 @@ public interface TEmpProfessionalQualificationService extends IService<TEmpProfe ...@@ -46,4 +46,6 @@ public interface TEmpProfessionalQualificationService extends IService<TEmpProfe
IPage<TEmpProfessionalQualification> pageDiy(Page page, CertifySearchVo searchVo); IPage<TEmpProfessionalQualification> pageDiy(Page page, CertifySearchVo searchVo);
R<List<ErrorMessage>> importEmpCertificateDiy(InputStream inputStream); R<List<ErrorMessage>> importEmpCertificateDiy(InputStream inputStream);
R<Boolean> updateByIdDiy(TEmpProfessionalQualification tEmpProfessionalQualification);
} }
...@@ -108,8 +108,8 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert ...@@ -108,8 +108,8 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
private LambdaQueryWrapper buildQueryWrapper(CertRecordSearchVo entity){ private LambdaQueryWrapper buildQueryWrapper(CertRecordSearchVo entity){
LambdaQueryWrapper<TCertRecord> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<TCertRecord> wrapper = Wrappers.lambdaQuery();
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) { if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(TCertRecord::getCreateTime, entity.getCreateTimes()[0]) wrapper.ge(TCertRecord::getOpenTime, entity.getCreateTimes()[0])
.le(TCertRecord::getCreateTime, .le(TCertRecord::getOpenTime,
entity.getCreateTimes()[1]); entity.getCreateTimes()[1]);
} }
if (Common.isNotNull(entity.getEmpName())){ if (Common.isNotNull(entity.getEmpName())){
...@@ -118,6 +118,12 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert ...@@ -118,6 +118,12 @@ public class TCertRecordServiceImpl extends ServiceImpl<TCertRecordMapper, TCert
if (Common.isNotNull(entity.getEmpIdcard())){ if (Common.isNotNull(entity.getEmpIdcard())){
wrapper.likeRight(TCertRecord::getEmpIdcard,entity.getEmpIdcard()); wrapper.likeRight(TCertRecord::getEmpIdcard,entity.getEmpIdcard());
} }
if (Common.isNotNull(entity.getProjectName())){
wrapper.likeRight(TCertRecord::getProjectName,entity.getProjectName());
}
if (Common.isNotNull(entity.getType())){
wrapper.likeRight(TCertRecord::getType,entity.getType());
}
if (Common.isNotNull(entity.getCreateName())){ if (Common.isNotNull(entity.getCreateName())){
wrapper.eq(TCertRecord::getCreateName,entity.getCreateName()); wrapper.eq(TCertRecord::getCreateName,entity.getCreateName());
} }
......
...@@ -40,6 +40,7 @@ import org.apache.commons.fileupload.FileItemFactory; ...@@ -40,6 +40,7 @@ import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile; import org.springframework.web.multipart.commons.CommonsMultipartFile;
...@@ -84,21 +85,26 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -84,21 +85,26 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
* @date: 2022/6/27 * @date: 2022/6/27
*/ */
@Override @Override
public R<Boolean> importZip(MultipartFile zipFile) { public R<Boolean> importZip(MultipartFile zipFile){
//C:\Users\登录用户~1\AppData\Local\Temp\ try {
String pathName = System.getProperty("java.io.tmpdir") + "shpFileCache/"; String pathName = ResourceUtils.getURL("classpath:").getPath() + "unloap/";
String dec = System.getProperty("java.io.tmpdir") + "shpFileCache/"; String dec = ResourceUtils.getURL("classpath:").getPath() + "unloap/";
File file1 = new File(pathName);
//如果文件夹不存在 创建文件夹
if (!file1.exists()) {
file1.mkdir();
}
//获取文件名(包括后缀) //获取文件名(包括后缀)
String pname = zipFile.getOriginalFilename(); String pname = zipFile.getOriginalFilename();
pathName = pathName + pname; pathName = pathName + pname;
try {
File file = new File(pathName); File file = new File(pathName);
zipFile.transferTo(file); zipFile.transferTo(file);
// 获取解压出来的文件名 不带后缀 // 获取解压出来的文件名 不带后缀
unZip(file, dec); unZip(file, dec);
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件 //解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFile(dec); deleteFolder(dec);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -136,8 +142,6 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -136,8 +142,6 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
elecTypeMapData = dictMap.get("data"); elecTypeMapData = dictMap.get("data");
elecTypeMap = elecTypeMapData.get("elec_archives_type"); elecTypeMap = elecTypeMapData.get("elec_archives_type");
} }
//记录解压出来的所有文件名
List<String> filesName = new ArrayList<>();
// 判断源文件是否存在 // 判断源文件是否存在
if (!srcFile.exists()) { if (!srcFile.exists()) {
throw new RuntimeException(srcFile.getPath() + "所指文件不存在"); throw new RuntimeException(srcFile.getPath() + "所指文件不存在");
...@@ -244,40 +248,72 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM ...@@ -244,40 +248,72 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
return multipartFile; return multipartFile;
} }
/** /**
* 删除文件 * 根据路径删除指定的目录或文件,无论存在与否
* * @param path 要删除的目录或文件路径
* @param filePath * @return 删除成功返回 true,否则返回 false
* @return
*/ */
public static boolean deleteFile(String filePath) { public static boolean deleteFolder(String path) {
boolean flag = false; File file = new File(path);
File file = new File(filePath); // 判断目录或文件是否存在
if (!file.exists()) { if (!file.exists()) {
return flag; return false;
} else {
// 判断是否为文件
if (file.isFile()) { // 为文件时调用删除文件方法
return deleteFile(path);
} else { // 为目录时调用删除目录方法
return deleteDirectory(path);
} }
if (!file.isDirectory()) {
return flag;
} }
String[] tempList = file.list();
File temp;
for (int i = 0; i < tempList.length; i++) {
if (filePath.endsWith(File.separator)) {
temp = new File(filePath + tempList[i]);
} else {
temp = new File(filePath + File.separator + tempList[i]);
} }
if (temp.isFile()) {
temp.delete(); /**
* 删除单个文件
*/
private static boolean deleteFile(String path) {
File file = new File(path);
// 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) {
file.delete();
return true;
}
return false;
}
/**
* 删除目录(文件夹)以及目录下的文件
*/
private static boolean deleteDirectory(String path) {
//如果path不以文件分隔符结尾,自动添加文件分隔符
if (!path.endsWith(File.separator)) {
path = path + File.separator;
}
File dirFile = new File(path);
//如果dir对应的文件不存在,或者不是一个目录,则退出
if (!dirFile.exists() || !dirFile.isDirectory()) {
return false;
}
boolean flag = true;
//删除文件夹下的所有文件(包括子目录)
File[] files = dirFile.listFiles();
for (File file : files) {
//删除子文件
if (file.isFile()) {
flag = deleteFile(file.getAbsolutePath());
} //删除子目录
else {
flag = deleteDirectory(file.getAbsolutePath());
}
if (!flag) {
break;
} }
if (temp.isDirectory()) {
// 先删除文件夹里面的文件
deleteFile(filePath + "/" + tempList[i]);
// 再删除空文件夹
deleteFile(filePath + "/" + tempList[i]);
flag = true;
} }
if (!flag) {
return false;
} }
return flag; //删除当前目录
return dirFile.delete();
} }
} }
...@@ -92,6 +92,7 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T ...@@ -92,6 +92,7 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
errorMessageList.add(errorMsg); errorMessageList.add(errorMsg);
continue; continue;
} }
excel.setEmpName(emp.getEmpName());
exist = baseMapper.selectOne(Wrappers.<TEmpEducation>query().lambda() exist = baseMapper.selectOne(Wrappers.<TEmpEducation>query().lambda()
.eq(TEmpEducation::getEmpIdcard,excel.getEmpIdcard()) .eq(TEmpEducation::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmpEducation::getEducationName,excel.getEducationName()) .eq(TEmpEducation::getEducationName,excel.getEducationName())
...@@ -212,7 +213,7 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T ...@@ -212,7 +213,7 @@ public class TEmpEducationServiceImpl extends ServiceImpl<TEmpEducationMapper, T
if (Common.isEmpty(emp)){ if (Common.isEmpty(emp)){
return new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_NOT_EXIST)); return new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_NOT_EXIST));
} }
if (CommonConstants.ONE_STRING.equals(emp.getFileStatus())){ if (Common.isNotNull(emp.getFileStatus()) && CommonConstants.ONE_STRING.equals(emp.getFileStatus())){
return new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_REDUCED)); return new ErrorMessage(excel.getRowIndex(),MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_REDUCED));
} }
// 检查添加是否已经存在 // 检查添加是否已经存在
......
...@@ -65,6 +65,17 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr ...@@ -65,6 +65,17 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr
@Override @Override
public R<Boolean> saveDiy(TEmpProfessionalQualification qualification) { public R<Boolean> saveDiy(TEmpProfessionalQualification qualification) {
TEmpProfessionalQualification exist = baseMapper.selectOne(Wrappers.<TEmpProfessionalQualification>query().lambda()
.eq(TEmpProfessionalQualification::getEmpIdcard,qualification.getEmpIdcard())
.eq(TEmpProfessionalQualification::getQualificationLevel,qualification.getQualificationLevel())
.eq(TEmpProfessionalQualification::getQualificationType,qualification.getQualificationType())
.eq(TEmpProfessionalQualification::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(exist)){
return R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_CERTIFICATE_NAME_EXISTING));
}
qualification.setDeleteFlag(CommonConstants.ZERO_STRING); qualification.setDeleteFlag(CommonConstants.ZERO_STRING);
int res = baseMapper.insert(qualification); int res = baseMapper.insert(qualification);
if (res <= CommonConstants.ZERO_INT){ if (res <= CommonConstants.ZERO_INT){
...@@ -99,6 +110,7 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr ...@@ -99,6 +110,7 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr
continue; continue;
} }
exist = baseMapper.selectOne(Wrappers.<TEmpProfessionalQualification>query().lambda() exist = baseMapper.selectOne(Wrappers.<TEmpProfessionalQualification>query().lambda()
.eq(TEmpProfessionalQualification::getEmpIdcard,excel.getEmpIdcard())
.eq(TEmpProfessionalQualification::getQualificationLevel,excel.getQualificationLevel()) .eq(TEmpProfessionalQualification::getQualificationLevel,excel.getQualificationLevel())
.eq(TEmpProfessionalQualification::getQualificationType,excel.getQualificationType()) .eq(TEmpProfessionalQualification::getQualificationType,excel.getQualificationType())
.eq(TEmpProfessionalQualification::getDeleteFlag,CommonConstants.ZERO_STRING) .eq(TEmpProfessionalQualification::getDeleteFlag,CommonConstants.ZERO_STRING)
...@@ -215,6 +227,25 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr ...@@ -215,6 +227,25 @@ public class TEmpProfessionalQualificationServiceImpl extends ServiceImpl<TEmpPr
return R.ok(errorMessageList); return R.ok(errorMessageList);
} }
@Override
public R<Boolean> updateByIdDiy(TEmpProfessionalQualification qualification) {
TEmpProfessionalQualification exist = baseMapper.selectOne(Wrappers.<TEmpProfessionalQualification>query().lambda()
.ne(TEmpProfessionalQualification::getId,qualification.getId())
.eq(TEmpProfessionalQualification::getEmpIdcard,qualification.getEmpIdcard())
.eq(TEmpProfessionalQualification::getQualificationLevel,qualification.getQualificationLevel())
.eq(TEmpProfessionalQualification::getQualificationType,qualification.getQualificationType())
.eq(TEmpProfessionalQualification::getDeleteFlag,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(exist)){
return R.failed(MsgUtils.getMessage(ErrorCodes.ARCHIVES_EMP_CERTIFICATE_NAME_EXISTING));
}
int res = baseMapper.updateById(qualification);
if (res < 0){
return R.failed();
}
return R.ok();
}
private LambdaQueryWrapper buildQueryWrapper(CertifySearchVo entity){ private LambdaQueryWrapper buildQueryWrapper(CertifySearchVo entity){
LambdaQueryWrapper<TEmpProfessionalQualification> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<TEmpProfessionalQualification> wrapper = Wrappers.lambdaQuery();
wrapper.eq(TEmpProfessionalQualification::getDeleteFlag,CommonConstants.ZERO_STRING); wrapper.eq(TEmpProfessionalQualification::getDeleteFlag,CommonConstants.ZERO_STRING);
......
...@@ -26,6 +26,7 @@ mybatis-plus: ...@@ -26,6 +26,7 @@ mybatis-plus:
logic-not-delete-value: 0 logic-not-delete-value: 0
configuration: configuration:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# spring security 配置 # spring security 配置
security: security:
......
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