包头bug修复

This commit is contained in:
guoshengxiong 2025-04-27 18:01:40 +08:00
parent b2adcec61d
commit 8c2ea4f976
5 changed files with 134 additions and 44 deletions

View File

@ -8,7 +8,9 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.*;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.ZipUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gexin.fastjson.JSON;
@ -28,7 +30,6 @@ import com.zhgd.xmgl.modules.basicdata.service.IDictionariesRecordService;
import com.zhgd.xmgl.modules.basicdata.service.IDictionaryItemService;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.basicdata.service.impl.NoticeServiceImpl;
import com.zhgd.xmgl.modules.exam.entity.ExamTrainRecord;
import com.zhgd.xmgl.modules.exam.service.IExamTrainRecordService;
import com.zhgd.xmgl.modules.project.service.IProjectEnterpriseService;
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
@ -620,8 +621,16 @@ public class WorkerAdmissionController {
FileUtil.writeFromStream(zipFile.getInputStream(), zip);
File unzip = ZipUtil.unzip(zip, Charset.forName("gbk"));
File[] files = unzip.listFiles();
if (!CollUtil.newArrayList(files).stream().anyMatch(o -> StringUtils.endsWith(o.getAbsolutePath(), ".xlsx"))) {
unzip = files[0];
if (files == null || files.length == 0) {
throw new OpenAlertException("压缩文件为空");
}
while (CollUtil.newArrayList(files).stream().noneMatch(o -> StringUtils.endsWith(o.getAbsolutePath(), ".xlsx"))) {
List<File> dirList = Arrays.stream(files).filter(File::isDirectory).collect(Collectors.toList());
if (dirList.size() != 1) {
throw new OpenAlertException("压缩文件目录结构有误,请检查");
}
unzip = dirList.get(0);
files = unzip.listFiles();
}
//设置一个压缩包里面分别有人员信息excel人脸采集图片文件夹身份证人像面文件夹身份证国徽面文件夹劳动合同文件夹保险文件夹体检报告文件夹人员资质文件夹人员资质验证文件夹文件夹中文件分别以姓名_身份证格式名称
List<UploadZipWorkAdmissionVo> vos = parseUploadExcelWorkAdmission(unzip.getAbsolutePath(), projectSn);
@ -720,45 +729,65 @@ public class WorkerAdmissionController {
throw new OpenAlertException(MessageUtil.get("excelNotDataErr"));
}
this.checkParams(list);
List<String> absentWorkerTypes = new ArrayList<>();
List<String> absentGroups = new ArrayList<>();
List<String> absentEpcs = new ArrayList<>();
List<String> absentEdus = new ArrayList<>();
List<String> absentPolitics = new ArrayList<>();
List<String> absentBranchs = new ArrayList<>();
List<EnterpriseInfo> enterpriseInfos = projectEnterpriseService.queryPageList(new MapBuilder<String, Object>()
.put("projectSn", projectSn)
.put(Cts.PAGE_SIZE, -1)
.build()).getRecords();
List<DeviceUnit> deviceUnits = deviceUnitService.list(new LambdaQueryWrapper<DeviceUnit>()
.eq(DeviceUnit::getProjectSn, projectSn).last(Cts.IGNORE_DATA_SCOPE_CONDITION));
List<PostWorkType> workerTypeList = postWorkTypeService.list(new LambdaQueryWrapper<PostWorkType>()
.eq(PostWorkType::getProjectSn, projectSn));
Map<String, ProjectGroup> groupMap = projectGroupService.list(new LambdaQueryWrapper<ProjectGroup>()
.eq(ProjectGroup::getProjectSn, projectSn)).stream().collect(Collectors.toMap(ProjectGroup::getProjectGroupName, Function.identity(), (o1, o2) -> o1));
Map<String, DictionariesRecord> certTypeMap = dictionariesRecordService.selectCertTypeList(new MapBuilder<String, Object>()
.put("type", 1)
.build()).stream().collect(Collectors.toMap(DictionariesRecord::getDictionaryName, Function.identity(), (o1, o2) -> o1));
List<String> isc = Arrays.asList("市场监督管理局", "应急管理局", "住房和城乡建设厅", "人力资源和社会保障部(厅)");
Map<String, PartyConstructionOrganization> orgMap = partyConstructionOrganizationService.list(new LambdaQueryWrapper<PartyConstructionOrganization>()
.eq(PartyConstructionOrganization::getProjectSn, projectSn)).stream().collect(Collectors.toMap(PartyConstructionOrganization::getClassificationName, Function.identity(), (o1, o2) -> o1));
for (Map<String, String> importInfo : list) {
UploadZipWorkAdmissionVo detail = new UploadZipWorkAdmissionVo();
detail.setNum(importInfo.get("*编号"));
detail.setWorkerName(importInfo.get("*姓名"));
String num = StrUtil.trim(importInfo.get("*编号"));
detail.setNum(num);
String workerName = StrUtil.trim(importInfo.get("*姓名"));
detail.setWorkerName(workerName);
detail.setEnterpriseId(enterpriseInfos.stream().filter(o -> o.getEnterpriseName().equals(importInfo.get("单位"))).findFirst().map(EnterpriseInfo::getId).orElse(null));
detail.setWorkAreaName(importInfo.get("*工作区域"));
detail.setPostWorkType(workerTypeList.stream().filter(o -> o.getPostWorkTypeName().equals(importInfo.get("*岗位(工种)"))).findFirst().map(o -> o.getId()).orElse(null));
//detail.setTeam("");
Map<String, String> idCardInfoMap = IdCardUtils.getBirthdayAgeSex(importInfo.get("*身份证号"));
String idCardNo = importInfo.get("*身份证号");
String workerType = importInfo.get("*岗位(工种)");
Optional<PostWorkType> workType = workerTypeList.stream().filter(o -> o.getPostWorkTypeName().equals(workerType)).findFirst();
Long postWorkTypeId = workType.map(PostWorkType::getId).orElse(null);
if (postWorkTypeId == null) {
absentWorkerTypes.add(StrUtil.format("{}的岗位(工种)({}", workerName, workerType));
}
detail.setPostWorkType(postWorkTypeId);
Map<String, String> idCardInfoMap = IdCardUtils.getBirthdayAgeSex(idCardNo);
detail.setSex(MapUtils.getInteger(idCardInfoMap, "sex"));
detail.setAge(idCardInfoMap.get("age"));
detail.setIdCard(importInfo.get("*身份证号"));
detail.setIdCard(idCardNo);
detail.setEntryDeadline(importInfo.get("*计划截止时间"));
detail.setRemark(importInfo.get("备注"));
detail.setProjectSn(projectSn);
detail.setPersonType(NumberUtil.compare(detail.getPostWorkType(), 200) >= 0 ? 1 : 2);
detail.setPersonType(workType.map(PostWorkType::getWorkerType).orElse(null));
detail.setBirthday(idCardInfoMap.get("birthday"));
detail.setPhone(importInfo.get("电话"));
detail.setEpcCbs(enterpriseInfos.stream().filter(o -> o.getEnterpriseName().equals(importInfo.get("EPC承包商"))).findFirst().map(o -> o.getId()).orElse(null));
String phone = StrUtil.trim(importInfo.get("电话"));
detail.setPhone(phone);
String epcName = StrUtil.trim(importInfo.get("EPC承包商"));
Long epcCbs = enterpriseInfos.stream().filter(o -> o.getEnterpriseName().equals(epcName)).findFirst().map(EnterpriseInfo::getId).orElse(null);
if (epcCbs == null && StrUtil.isNotBlank(epcName)) {
absentEpcs.add(StrUtil.format("{}的EPC承包商{}", workerName, epcName));
}
detail.setEpcCbs(epcCbs);
//项目组 资格证号 资质类型 发证机关 取证日期 截止日期
detail.setProjectGroup(Optional.ofNullable(groupMap.get(importInfo.get("*项目组"))).map(m -> Convert.toLong(m.getId())).orElse(null));
detail.setCertificateNumber(importInfo.get("资格证号"));
detail.setCertificateType(Optional.ofNullable(certTypeMap.get(importInfo.get("资质类型"))).map(m -> Convert.toStr(m.getId())).orElse(null));
String groupName = StrUtil.trim(importInfo.get("*项目组"));
Long projectGroup = Optional.ofNullable(groupMap.get(groupName)).map(m -> Convert.toLong(m.getId())).orElse(null);
if (projectGroup == null) {
absentGroups.add(StrUtil.format("{}的项目组({}", workerName, groupName));
}
detail.setProjectGroup(projectGroup);
String certificateNumber = StrUtil.trim(importInfo.get("资格证号"));
detail.setCertificateNumber(certificateNumber);
int issueCompany = isc.indexOf(importInfo.get("发证机关"));
detail.setIssueCompany(issueCompany != -1 ? issueCompany + 1 : null);
String issueTime = importInfo.get("取证日期");
@ -771,9 +800,14 @@ public class WorkerAdmissionController {
List<String> ps = Arrays.asList("群众",
"正式党员",
"预备党员");
int p = ps.indexOf(importInfo.get("政治面貌"));
String readPolitics = StrUtil.trim(importInfo.get("政治面貌"));
int p = ps.indexOf(readPolitics);
if (p == -1 && StrUtil.isNotBlank(readPolitics)) {
absentPolitics.add(StrUtil.format("{}的政治面貌({}", workerName, readPolitics));
}
detail.setPoliticsStatus(p != -1 ? p + 1 : null);
detail.setPoliticsStatusStr(importInfo.get("政治面貌"));
detail.setPoliticsStatusStr(readPolitics);
String readEdu = StrUtil.trim(importInfo.get("学历"));
List<String> edus = Arrays.asList("小学",
"初中",
"中专",
@ -783,18 +817,53 @@ public class WorkerAdmissionController {
"研究生",
"博士",
"博士后");
int edu = edus.indexOf(importInfo.get("学历"));
int edu = edus.indexOf(readEdu);
if (edu == -1 && StrUtil.isNotBlank(readEdu)) {
absentEdus.add(StrUtil.format("{}的学历({}", workerName, readEdu));
}
detail.setEducational(edu != -1 ? edu + 1 : null);
detail.setEducationalStr(importInfo.get("学历"));
PartyConstructionOrganization organization = orgMap.get(importInfo.get("支部名称"));
detail.setEducationalStr(readEdu);
String readBranch = StrUtil.trim(importInfo.get("支部名称"));
PartyConstructionOrganization organization = orgMap.get(readBranch);
if (organization != null) {
List<String> ids = StrUtil.split(organization.getAncestors(), ",");
ids.remove("0");
ids.add(organization.getId() + "");
detail.setBranchIdStr(StrUtil.join("-", ids));
} else {
if (StrUtil.isNotBlank(readBranch)) {
absentBranchs.add(StrUtil.format("{}的支部名称({}", workerName, readBranch));
}
}
admissionVos.add(detail);
}
if (absentWorkerTypes.size() > 0 ||
absentGroups.size() > 0 ||
absentEpcs.size() > 0 ||
absentEdus.size() > 0 ||
absentPolitics.size() > 0 ||
absentBranchs.size() > 0) {
ArrayList<String> lists = new ArrayList<>();
if (absentWorkerTypes.size() > 0) {
lists.add(StrUtil.join("", absentWorkerTypes) + "不存在");
}
if (absentGroups.size() > 0) {
lists.add(StrUtil.join("", absentGroups) + "不存在");
}
if (absentEpcs.size() > 0) {
lists.add(StrUtil.join("", absentEpcs) + "不存在");
}
if (absentEdus.size() > 0) {
lists.add(StrUtil.join("", absentEdus) + "不存在");
}
if (absentPolitics.size() > 0) {
lists.add(StrUtil.join("", absentPolitics) + "不存在");
}
if (absentBranchs.size() > 0) {
lists.add(StrUtil.join("", absentBranchs) + "不存在");
}
throw new OpenAlertException(StrUtil.join("", lists));
}
return admissionVos;
}
@ -807,15 +876,6 @@ public class WorkerAdmissionController {
if (StringUtils.isBlank(importInfo.get("*姓名"))) {
throw new OpenAlertException("有姓名未填写");
}
// if (StringUtils.isBlank(importInfo.get("*电话"))) {
// throw new OpenAlertException("有电话未填写");
// }
//if (StringUtils.isBlank(importInfo.get("EPC承包商"))) {
// throw new OpenAlertException("有EPC承包商未填写");
//}
//if (StringUtils.isBlank(importInfo.get("单位"))) {
// throw new OpenAlertException("有单位未填写");
//}
if (StringUtils.isBlank(importInfo.get("*工作区域"))) {
throw new OpenAlertException("有工作区域未填写");
}

View File

@ -428,11 +428,6 @@ public class WorkerAdmissionServiceImpl extends ServiceImpl<WorkerAdmissionMappe
.eq(DeviceUnit::getProjectSn, projectSn));
List<PostWorkType> postWorkTypes = postWorkTypeService.list(new LambdaQueryWrapper<PostWorkType>()
.eq(PostWorkType::getProjectSn, projectSn));
//List<String> epcIds = deviceUnits.stream().map(DeviceUnit::getEpcContractorIds).collect(Collectors.toList()).stream().flatMap(o -> StrUtil.split(o, ",").stream()).distinct().collect(Collectors.toList());
//List<EnterpriseInfo> epcInfos = new ArrayList<>();
//if (CollUtil.isNotEmpty(epcIds)) {
// epcInfos = enterpriseInfos.stream().filter(o -> epcIds.contains(o.getId() + "")).collect(Collectors.toList());
//}
List<EnterpriseInfo> epcInfos = deviceUnitService.getEpcList(new MapBuilder<String, Object>()
.put("projectSn", projectSn)
.build());

View File

@ -465,8 +465,16 @@ public class CarInfoController {
FileUtil.writeFromStream(zipFile.getInputStream(), zip);
File unzip = ZipUtil.unzip(zip, Charset.forName("gbk"));
File[] files = unzip.listFiles();
if (!CollUtil.newArrayList(files).stream().anyMatch(o -> StringUtils.endsWith(o.getAbsolutePath(), ".xlsx"))) {
unzip = files[0];
if (files == null || files.length == 0) {
throw new OpenAlertException("压缩文件为空");
}
while (CollUtil.newArrayList(files).stream().noneMatch(o -> StringUtils.endsWith(o.getAbsolutePath(), ".xlsx"))) {
List<File> dirList = Arrays.stream(files).filter(File::isDirectory).collect(Collectors.toList());
if (dirList.size() != 1) {
throw new OpenAlertException("压缩文件目录结构有误,请检查");
}
unzip = dirList.get(0);
files = unzip.listFiles();
}
Result result = carInfoService.uploadExcelCar(unzip, projectSn);
if (result.isSuccess()) {

View File

@ -42,6 +42,7 @@ import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.runtime.ProcessInstanceQuery;
import org.flowable.task.api.Task;
@ -451,9 +452,35 @@ public class FlowSeviceUtil {
HistoricProcessInstanceQuery instanceQuery = historyService.createHistoricProcessInstanceQuery();
instanceQuery.processInstanceTenantId(TenantContextHolder.getTenantId());
if (Objects.equals(customStatus, 1)) {
instanceQuery.or().startedBy(userId + "").involvedUser(userId + "").endOr();
HistoricProcessInstanceQuery baseQuery = historyService.createHistoricProcessInstanceQuery()
.or().startedBy(userId)
.involvedUser(userId)
.endOr()
.unfinished();
List<String> processInstanceIds = baseQuery.list()
.stream()
.map(HistoricProcessInstance::getId)
.collect(Collectors.toList());
// 获取当前用户待处理任务的流程实例ID
TaskQuery taskQuery = taskService.createTaskQuery();
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
Set<String> stringSet = processInstanceQuery.list().stream().map(Execution::getProcessInstanceId).collect(Collectors.toSet());
taskQuery.active().taskTenantId(TenantContextHolder.getTenantId())
.processInstanceIdIn(stringSet)
.taskCandidateOrAssigned(userId);
List<String> activeTaskProcessIds = taskQuery.list()
.stream()
.map(Task::getProcessInstanceId)
.collect(Collectors.toList());
// 排除待处理的流程实例ID
processInstanceIds.removeAll(activeTaskProcessIds);
if (processInstanceIds.isEmpty()) {
processInstanceIds.add("-100");
}
// 构造最终查询并分页
instanceQuery.processInstanceIds(new HashSet<>(processInstanceIds));
} else if (Objects.equals(customStatus, 2)) {
instanceQuery.or().startedBy(userId + "").involvedUser(userId + "").endOr();
instanceQuery.or().startedBy(userId).involvedUser(userId).endOr();
instanceQuery.finished();
}
Executor.builder()