人员库
This commit is contained in:
parent
aa8d681013
commit
42c32bdf16
|
|
@ -1,6 +1,5 @@
|
|||
package com.bonus.web.service.enterprise;
|
||||
|
||||
import com.bonus.common.constant.CertificateConstants;
|
||||
import com.bonus.common.constant.TableConstants;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.domain.file.po.ResourceFilePo;
|
||||
|
|
@ -11,7 +10,6 @@ import com.bonus.common.domain.mainDatabase.po.EnterprisePersonnel;
|
|||
import com.bonus.common.domain.mainDatabase.po.ErrorInfo;
|
||||
import com.bonus.common.domain.mainDatabase.po.PersonnelCertificate;
|
||||
import com.bonus.common.domain.mainDatabase.vo.EnterprisePersonnelVo;
|
||||
import com.bonus.common.domain.mainDatabase.vo.EnterpriseVo;
|
||||
import com.bonus.common.utils.CertificateUtil;
|
||||
import com.bonus.common.utils.ValidatorsUtils;
|
||||
import com.bonus.file.service.FileUploadService;
|
||||
|
|
@ -28,7 +26,6 @@ import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -190,7 +187,7 @@ public class PersonnelService {
|
|||
List<ResourceFilePo> delFiles = new ArrayList<>();
|
||||
for (PersonnelCertificate item : changeList) {
|
||||
// 添加需要删除的资源文件
|
||||
ResourceFilePo delResourceFilePo = setResourceFile(item);
|
||||
ResourceFilePo delResourceFilePo = setResourceFile(item,TableConstants.TB_PERSONNEL_CERTIFICATE);
|
||||
delFiles.add(delResourceFilePo);
|
||||
// 添加需要删除的异常信息
|
||||
ErrorInfo delErrorInfo = setErrorInfo(item);
|
||||
|
|
@ -223,6 +220,11 @@ public class PersonnelService {
|
|||
errorInfos.add(errorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果存在证书删除的文件 则删除系统资源文件
|
||||
if (CollectionUtils.isNotEmpty(dto.getDelCertificateFiles())) {
|
||||
sourceFileService.delResourceFile(dto.getDelCertificateFiles(), TableConstants.TB_PERSONNEL_CERTIFICATE);
|
||||
}
|
||||
// 添加证书资源文件
|
||||
if(CollectionUtils.isNotEmpty(certificateList)){
|
||||
sourceFileService.saveResourceFile(certificateList);
|
||||
|
|
@ -274,7 +276,7 @@ public class PersonnelService {
|
|||
if(CollectionUtils.isNotEmpty(certificateList)){
|
||||
for (PersonnelCertificate item : certificateList) {
|
||||
// 添加需要删除的资源文件
|
||||
ResourceFilePo delResourceFilePo = setResourceFile(item);
|
||||
ResourceFilePo delResourceFilePo = setResourceFile(item,TableConstants.TB_PERSONNEL_CERTIFICATE);
|
||||
delFiles.add(delResourceFilePo);
|
||||
// 添加需要删除的异常信息
|
||||
ErrorInfo delErrorInfo = setErrorInfo(item);
|
||||
|
|
@ -324,7 +326,7 @@ public class PersonnelService {
|
|||
for (PersonnelCertificate item : certificateList) {
|
||||
EnterprisePersonnelVo.CertificateDetailVo vo = new EnterprisePersonnelVo.CertificateDetailVo();
|
||||
vo.setCertificate(item);
|
||||
List<ResourceFileVo> filesByTable = sourceFileService.getFilesByTable(item.getPersonnelCertificateId(), TableConstants.TB_ENTERPRISE_PERSONNEL);
|
||||
List<ResourceFileVo> filesByTable = sourceFileService.getFilesByTable(item.getPersonnelCertificateId(), TableConstants.TB_PERSONNEL_CERTIFICATE);
|
||||
// 取minio中的文件访问路径
|
||||
List<ResourceFileVo> fileVos = setFile(filesByTable);
|
||||
vo.setFileVoList(fileVos);
|
||||
|
|
@ -357,10 +359,10 @@ public class PersonnelService {
|
|||
* @author cwchen
|
||||
* @date 2025/10/24 12:15
|
||||
*/
|
||||
public ResourceFilePo setResourceFile(PersonnelCertificate item) {
|
||||
public ResourceFilePo setResourceFile(PersonnelCertificate item,String sourceTable) {
|
||||
ResourceFilePo resourceFilePo = new ResourceFilePo();
|
||||
resourceFilePo.setBusinessId(item.getPersonnelCertificateId());
|
||||
resourceFilePo.setSourceTable(TableConstants.TB_PERSONNEL_CERTIFICATE);
|
||||
resourceFilePo.setSourceTable(sourceTable);
|
||||
resourceFilePo.setFileType(item.getCertificateType());
|
||||
return resourceFilePo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,7 @@ import lombok.Data;
|
|||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
|
@ -95,6 +92,7 @@ public class EnterpriseDto {
|
|||
*/
|
||||
@NotBlank(message = "法人身份证号不能为空", groups = {ADD.class, UPDATE.class})
|
||||
@Length(max = 32, message = "法人身份证号字符长度不能超过32", groups = {ADD.class, UPDATE.class})
|
||||
@Pattern(regexp = "(^\\d{15}$)|(^\\d{17}(\\d|X|x)$)",message = "法人身份证号格式不正确", groups = {ADD.class, UPDATE.class})
|
||||
private String legalPersonIdCard;
|
||||
|
||||
/**
|
||||
|
|
@ -114,7 +112,8 @@ public class EnterpriseDto {
|
|||
/**
|
||||
* 法人联系方式
|
||||
*/
|
||||
@Length(max = 11, message = "法人联系方式字符长度不能超过32", groups = {ADD.class, UPDATE.class})
|
||||
@Length(max = 11, message = "法人联系方式字符长度不能超过11", groups = {ADD.class, UPDATE.class})
|
||||
@Pattern(regexp = "^(?:(?:\\+|00)?86)?1[3-9]\\d{9}$",message = "法人联系方式格式不正确", groups = {ADD.class, UPDATE.class})
|
||||
private String legalPersonPhone;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -11,10 +11,7 @@ import lombok.NoArgsConstructor;
|
|||
import org.hibernate.validator.constraints.Length;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
|
@ -58,6 +55,7 @@ public class EnterprisePersonnelDto {
|
|||
*/
|
||||
@NotBlank(message = "身份证号码不能为空", groups = {ADD.class, UPDATE.class})
|
||||
@Length(max = 32, message = "身份证号码字符长度不能超过32", groups = {ADD.class, UPDATE.class})
|
||||
@Pattern(regexp = "(^\\d{15}$)|(^\\d{17}(\\d|X|x)$)",message = "身份证号码格式不正确", groups = {ADD.class, UPDATE.class})
|
||||
private String personnelIdCard;
|
||||
|
||||
/**
|
||||
|
|
@ -109,6 +107,7 @@ public class EnterprisePersonnelDto {
|
|||
*/
|
||||
@NotBlank(message = "联系方式不能为空", groups = {ADD.class, UPDATE.class})
|
||||
@Length(max = 11, message = "联系方式字符长度不能超过11", groups = {ADD.class, UPDATE.class})
|
||||
@Pattern(regexp = "^(?:(?:\\+|00)?86)?1[3-9]\\d{9}$",message = "联系方式格式不正确", groups = {ADD.class, UPDATE.class})
|
||||
private String personnelPhone;
|
||||
|
||||
/**
|
||||
|
|
@ -175,11 +174,13 @@ public class EnterprisePersonnelDto {
|
|||
public static class PersonnelCertificateDto {
|
||||
private PersonnelCertificate personnelCertificate;
|
||||
private ResourceFilePo resourceFilePo;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 证书删除的文件路径
|
||||
*/
|
||||
private List<String> delFiles;
|
||||
}
|
||||
private List<String> delCertificateFiles;
|
||||
|
||||
/**
|
||||
* 查询条件限制
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ public class EnterprisePersonnel {
|
|||
*/
|
||||
private String personnelName;
|
||||
|
||||
/**
|
||||
* 人员身份证id
|
||||
*/
|
||||
private String personnelIdCard;
|
||||
|
||||
/**
|
||||
* 入职时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public class CertificateUtil {
|
|||
CERTIFICATE_ERROR_MAP.put("quality_inspector_certificate", "质检员证过期");
|
||||
CERTIFICATE_ERROR_MAP.put("construction_worker_certificate", "施工员证过期");
|
||||
CERTIFICATE_ERROR_MAP.put("materials_officer_certificate", "材料员证过期");
|
||||
CERTIFICATE_ERROR_MAP.put("document_clerk_certificate", "资料员证过期");
|
||||
CERTIFICATE_ERROR_MAP.put("mechanic_s_certificate", "机械员证过期");
|
||||
CERTIFICATE_ERROR_MAP.put("cost_engineer_certificate", "造价员证过期");
|
||||
}
|
||||
|
|
@ -78,8 +79,8 @@ public class CertificateUtil {
|
|||
return isIdCardExpired(endDate);
|
||||
}
|
||||
|
||||
// 其他证书直接检查过期
|
||||
return DateTimeHelper.isExpired(endDate);
|
||||
// 其他证书也按照 '-' 截取处理
|
||||
return isOtherCertificateExpired(endDate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -103,6 +104,27 @@ public class CertificateUtil {
|
|||
return DateTimeHelper.isExpired(endDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查其他证书是否过期
|
||||
*/
|
||||
private static boolean isOtherCertificateExpired(String endDate) {
|
||||
// 检查是否为长期有效
|
||||
for (String indicator : PERMANENT_INDICATORS) {
|
||||
if (endDate.contains(indicator)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 处理日期格式:起始日期-结束日期
|
||||
String[] dateParts = endDate.split(" - ");
|
||||
if (dateParts.length == 2) {
|
||||
return DateTimeHelper.isExpired(dateParts[1]);
|
||||
}
|
||||
|
||||
// 如果格式不符合预期,按普通日期处理
|
||||
return DateTimeHelper.isExpired(endDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建错误信息对象
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class FileUtil {
|
|||
// 生成唯一文件名
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
String fileExtension = getFileExtension(originalFilename);
|
||||
String uniqueFileName = UUID.randomUUID().toString() + fileExtension;
|
||||
String uniqueFileName = UUID.randomUUID().toString().replaceAll("-","") + fileExtension;
|
||||
|
||||
// 构建完整路径:baseDir/年/月/日/UUID.扩展名
|
||||
return Paths.get(baseDir, datePath, uniqueFileName).toString();
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ public class XssRequestWrapper extends HttpServletRequestWrapper {
|
|||
// 添加特殊字符和编码模式
|
||||
XSS_PATTERNS.add(Pattern.compile("<.*>", Pattern.CASE_INSENSITIVE)); // 尖括号
|
||||
XSS_PATTERNS.add(Pattern.compile("\\[.*\\]", Pattern.CASE_INSENSITIVE)); // 方括号
|
||||
XSS_PATTERNS.add(Pattern.compile("\\(.*\\)", Pattern.CASE_INSENSITIVE)); // 圆括号
|
||||
// XSS_PATTERNS.add(Pattern.compile("\\(.*\\)", Pattern.CASE_INSENSITIVE)); // 圆括号
|
||||
XSS_PATTERNS.add(Pattern.compile("'.*'", Pattern.CASE_INSENSITIVE)); // 单引号
|
||||
XSS_PATTERNS.add(Pattern.compile("\".*\"", Pattern.CASE_INSENSITIVE)); // 双引号
|
||||
// 更完善的% 校验 URL编码排除
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ public class MDEnterpriseServiceImpl implements IMDEnterpriseService {
|
|||
for (EnterpriseVo vo : list) {
|
||||
List<Integer> nums = imdEnterpriseMapper.getNum(vo);
|
||||
vo.setFinanceNum(nums.get(0));
|
||||
vo.setPerformanceNum(nums.get(1));
|
||||
vo.setPersonnelNum(nums.get(2));
|
||||
vo.setPersonnelNum(nums.get(1));
|
||||
vo.setPerformanceNum(nums.get(2));
|
||||
vo.setQualificationNum(nums.get(3));
|
||||
}
|
||||
return list;
|
||||
|
|
|
|||
|
|
@ -72,7 +72,15 @@
|
|||
<select id="getCertificates" resultType="com.bonus.common.domain.mainDatabase.po.PersonnelCertificate">
|
||||
SELECT personnel_certificate_id AS personnelCertificateId,
|
||||
personnel_id AS personnelId,
|
||||
certificate_type AS certificateType
|
||||
certificate_type AS certificateType,
|
||||
professional_type AS professionalType,
|
||||
certificate_code AS certificateCode,
|
||||
certificate_level AS certificateLevel,
|
||||
certificate_validity_period AS certificateValidityPeriod,
|
||||
use_validity_period AS useValidityPeriod,
|
||||
register_professional AS registerProfessional,
|
||||
title_name AS titleName,
|
||||
professional_name AS professionalName
|
||||
FROM tb_personnel_certificate
|
||||
WHERE personnel_id = #{personnelId}
|
||||
AND del_flag = '0'
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@
|
|||
|
||||
<!--查询企业库知识库数量-->
|
||||
<select id="getNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM tb_enterprise_finance WHERE del_flag = '0'
|
||||
SELECT COUNT(*) FROM tb_enterprise_finance WHERE del_flag = '0' AND enterprise_id = #{enterpriseId}
|
||||
UNION ALL
|
||||
SELECT COUNT(*) FROM tb_enterprise_personnel WHERE del_flag = '0'
|
||||
SELECT COUNT(*) FROM tb_enterprise_personnel WHERE del_flag = '0' AND enterprise_id = #{enterpriseId}
|
||||
UNION ALL
|
||||
SELECT COUNT(*) FROM tb_enterprise_performance WHERE del_flag = '0'
|
||||
SELECT COUNT(*) FROM tb_enterprise_performance WHERE del_flag = '0' AND enterprise_id = #{enterpriseId}
|
||||
UNION ALL
|
||||
SELECT COUNT(*) FROM tb_enterprise_qualification WHERE del_flag = '0'
|
||||
SELECT COUNT(*) FROM tb_enterprise_qualification WHERE del_flag = '0' AND enterprise_id = #{enterpriseId}
|
||||
</select>
|
||||
<!--判断主体企业是否被引用-->
|
||||
<select id="getUseNum" resultType="java.lang.Integer">
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<if test="list[0].errorId != null and list[0].errorId != ''">error_id,</if>
|
||||
<if test="list[0].sourceTable != null and list[0].sourceTable != ''">source_table,</if>
|
||||
<if test="list[0].errorContent != null and list[0].errorContent != ''">error_content,</if>
|
||||
<if test="list[0].errorTime != null and list[0].errorTime != ''">error_time,</if>
|
||||
<if test="list[0].errorTime != null">error_time,</if>
|
||||
<if test="list[0].businessId != null and list[0].businessId != ''">business_id,</if>
|
||||
<if test="list[0].businessType != null and list[0].businessType != ''">business_type,</if>
|
||||
<if test="list[0].enterpriseId != null and list[0].enterpriseId != ''">enterprise_id,</if>
|
||||
|
|
|
|||
|
|
@ -21,10 +21,10 @@
|
|||
<if test="personnelPosition!=null and personnelPosition!=''">
|
||||
AND tep.personnel_position = #{personnelPosition}
|
||||
</if>
|
||||
ORDER BY update_time DESC
|
||||
ORDER BY tep.update_time DESC
|
||||
</select>
|
||||
|
||||
<!--判断主体企业是否被引用-->
|
||||
<!--判断人员是否被引用-->
|
||||
<select id="getUseNum" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) AS num FROM tb_enterprise_performance WHERE project_manager = #{personnelId} AND del_flag = '0'
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class OcrService {
|
|||
|
||||
log.info("OCR服务开始识别");
|
||||
// 执行请求
|
||||
try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
/*try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
|
||||
HttpEntity entity = response.getEntity();
|
||||
String responseBody = EntityUtils.toString(entity, "UTF-8");
|
||||
log.info("OCR服务响应状态: {}", response.getStatusLine().getStatusCode());
|
||||
|
|
@ -112,8 +112,8 @@ public class OcrService {
|
|||
}
|
||||
|
||||
return ocrResponse;
|
||||
}
|
||||
|
||||
}*/
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
log.error("调用OCR服务失败", e);
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue