南网,epc和国网模板下載更新
This commit is contained in:
parent
49dc4d3130
commit
f9020cc3f4
|
|
@ -78,4 +78,9 @@ public class ComOtherPersonBean extends PersonFileBean{
|
|||
*/
|
||||
private String workType;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDate;
|
||||
import java.time.Period;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -343,7 +345,7 @@ public class StateGridServiceImpl implements StateGridService {
|
|||
Map<String, Object> map2 = new HashMap<>();
|
||||
List<Map<String, Object>> imgList = new ArrayList<>(); // 项目合同关键页图片
|
||||
map2.put("proName", item.getProName() != null ? item.getProName() : ""); // 项目名称
|
||||
map2.put("voltageLevel", item.getVoltage() != null ? item.getProName() : ""); // 电压等级
|
||||
map2.put("voltageLevel", item.getVoltage() != null ? item.getVoltage() : ""); // 电压等级
|
||||
map2.put("proLocation", item.getProjectLocation() != null ? item.getProjectLocation() : ""); // 项目所在地
|
||||
map2.put("employerName", item.getOwnerUnit() != null ? item.getOwnerUnit() : ""); // 发包人名称
|
||||
map2.put("employerAddress", item.getOwnerLocation() != null ? item.getOwnerLocation() : ""); // 发包人地址
|
||||
|
|
@ -401,9 +403,10 @@ public class StateGridServiceImpl implements StateGridService {
|
|||
Map<String, Object> map2 = new HashMap<>();
|
||||
List<String> proList = new ArrayList<>();
|
||||
List<Map<String, Object>> zjProList = new ArrayList<>();
|
||||
Map<String, Object> ageAndGender = getAgeAndGender(item.getIdCard());
|
||||
map2.put("name", item.getUserName() != null ? item.getUserName() : ""); // 姓名
|
||||
map2.put("sex", ""); // 性别
|
||||
map2.put("age", item.getAge() != null ? item.getAge() : ""); // 年龄
|
||||
map2.put("sex", ageAndGender.get("gender")); // 性别
|
||||
map2.put("age", ageAndGender.get("age")); // 年龄
|
||||
map2.put("title", item.getTitle() != null ? item.getTitle() : ""); // 职称
|
||||
map2.put("majorStudied", item.getMajor() != null ? item.getMajor() : ""); // 所学专业
|
||||
map2.put("graduationSchool", item.getAlmaMater() != null ? item.getAlmaMater() : ""); // 毕业学校
|
||||
|
|
@ -507,7 +510,18 @@ public class StateGridServiceImpl implements StateGridService {
|
|||
|
||||
//本项目现场作业人员统计表
|
||||
if (tbData.getComOtherList() != null && !tbData.getComOtherList().isEmpty()) {
|
||||
for (ComOtherPersonBean item : tbData.getComOtherList()) {
|
||||
//使用 Java 8 Stream 进行分组、排序并每组只取一个
|
||||
Map<String, ComOtherPersonBean> groupedMap = tbData.getComOtherList().stream()
|
||||
.filter(Objects::nonNull) // 非空过滤
|
||||
.sorted(Comparator.comparing(ComOtherPersonBean::getPostName)) // 按 postName 排序
|
||||
.collect(Collectors.toMap(
|
||||
ComOtherPersonBean::getPostName, // 分组字段
|
||||
item -> item, // 当前元素本身
|
||||
(existing, replacement) -> existing // 如果键冲突,保留第一个出现的元素
|
||||
));
|
||||
// 获取去重后的有序列表
|
||||
List<ComOtherPersonBean> result = new ArrayList<>(groupedMap.values());
|
||||
for (ComOtherPersonBean item : result) {
|
||||
//表格 数据
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("name", item.getUserName() != null ? item.getUserName() : "" ); // 姓名
|
||||
|
|
@ -516,7 +530,7 @@ public class StateGridServiceImpl implements StateGridService {
|
|||
map.put("zc", item.getTitle() != null ? item.getTitle() : "" ); // 职称\技能
|
||||
map.put("major",item.getMajor() != null ? item.getMajor() : "" ); // 专业
|
||||
map.put("zsCode", item.getDiplomaNum() != null ? item.getDiplomaNum() : ""); // 证书号
|
||||
map.put("post", item.getPostName() != null ? item.getPostName() : ""); // 工种
|
||||
map.put("post", ""); // 工种
|
||||
map.put("tsCode", ""); // 特殊作业操作证书号
|
||||
map.put("dwCode", ""); // 电网建设作业人员资格认定证书号
|
||||
list7.add(map);
|
||||
|
|
@ -526,7 +540,6 @@ public class StateGridServiceImpl implements StateGridService {
|
|||
|
||||
// 投入本项目主要项目团队(施工团队)一览表
|
||||
if (tbData.getComOtherList() != null && !tbData.getComOtherList().isEmpty()) {
|
||||
|
||||
//使用 Java 8 Stream 进行分组、排序并每组只取一个
|
||||
Map<String, ComOtherPersonBean> groupedMap = tbData.getComOtherList().stream()
|
||||
.filter(Objects::nonNull) // 非空过滤
|
||||
|
|
@ -541,9 +554,10 @@ public class StateGridServiceImpl implements StateGridService {
|
|||
for (ComOtherPersonBean item : result) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
List<String> proList = new ArrayList<>();
|
||||
Map<String, Object> ageAndGender = getAgeAndGender(item.getIdCard());
|
||||
map.put("name", item.getUserName() != null ? item.getUserName() : ""); // 姓名
|
||||
map.put("sex", ""); // 性别
|
||||
map.put("age", ""); // 年龄
|
||||
map.put("sex", ageAndGender.get("sex")); // 性别
|
||||
map.put("age", ageAndGender.get("gender")); // 年龄
|
||||
map.put("title", item.getTitle() != null ? item.getTitle() : ""); // 职称
|
||||
map.put("majorStudied", item.getMajor() != null ? item.getMajor() : ""); // 所学专业
|
||||
map.put("graduationSchool", ""); // 毕业学校
|
||||
|
|
@ -899,8 +913,16 @@ public class StateGridServiceImpl implements StateGridService {
|
|||
jlMap.put("card", item.getIdCard() != null ? item.getIdCard() : "");
|
||||
jlMap.put("xl", item.getEducation() != null ? item.getEducation() : "");
|
||||
jlMap.put("zc", item.getTitle() != null ? item.getTitle() : "");
|
||||
jlMap.put("zs", item.getDiploma() != null ? item.getDiploma() : "");
|
||||
jlMap.put("bh", item.getDiplomaNum() != null ? item.getDiplomaNum() : "");
|
||||
StringBuilder diploma = new StringBuilder();
|
||||
StringBuilder diplomaNum = new StringBuilder();
|
||||
if(item.getCertList() != null && !item.getCertList().isEmpty()){
|
||||
item.getCertList().forEach(item2 -> {
|
||||
diploma.append(item2.getDiploma()).append(" ");
|
||||
diplomaNum.append(item2.getDiplomaNum()).append(" ");
|
||||
});
|
||||
}
|
||||
jlMap.put("zs",diploma);
|
||||
jlMap.put("bh", diplomaNum);
|
||||
jlMap.put("rcdate", item.getEinDate() != null ? item.getEinDate() : "");
|
||||
jlMap.put("tcDate", item.getExitDate() != null ? item.getExitDate() : "");
|
||||
// 处理业绩经历
|
||||
|
|
@ -989,6 +1011,46 @@ public class StateGridServiceImpl implements StateGridService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据18位身份证号获取年龄和性别,并返回Map
|
||||
*
|
||||
* @param idCard 18位身份证号
|
||||
* @return 包含年龄和性别的Map,例如:{ "age": 25, "gender": "男" }
|
||||
*/
|
||||
public static Map<String, Object> getAgeAndGender(String idCard) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if (idCard == null || idCard.length() != 18) {
|
||||
result.put("age", "");
|
||||
result.put("gender", "");
|
||||
return result;
|
||||
}
|
||||
// 提取出生年月日
|
||||
String yearStr = idCard.substring(6, 10);
|
||||
String monthStr = idCard.substring(10, 12);
|
||||
String dayStr = idCard.substring(12, 14);
|
||||
|
||||
int birthYear = Integer.parseInt(yearStr);
|
||||
int birthMonth = Integer.parseInt(monthStr);
|
||||
int birthDay = Integer.parseInt(dayStr);
|
||||
|
||||
// 当前日期和出生日期
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate birthDate = LocalDate.of(birthYear, birthMonth, birthDay);
|
||||
|
||||
// 计算年龄
|
||||
int age = Period.between(birthDate, today).getYears();
|
||||
|
||||
// 判断性别(第17位,索引为16)
|
||||
int genderDigit = Character.getNumericValue(idCard.charAt(16));
|
||||
String gender = (genderDigit % 2 == 1) ? "男" : "女";
|
||||
|
||||
// 放入Map中
|
||||
result.put("age", age);
|
||||
result.put("gender", gender);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件类型对文件列表进行分组,并设置到item对象中。
|
||||
* @param <E> 继承自PersonFileBean的类型
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ public class TestGWDOC {
|
|||
data.put("list10", list10);
|
||||
data.put("list11", list11);
|
||||
data.put("list12", list12);
|
||||
WordUtils.exportMillCertificateWord2(null, null, data, "test", "GW_DOC.ftl", "C:\\Users\\10488\\Desktop\\test (2)\\");
|
||||
WordUtils.exportMillCertificateWord2(null, null, data, "test", "GW_DOC.ftl", "C:\\Users\\admin\\Desktop\\");
|
||||
} catch (Exception e) {
|
||||
log.error("GW下载", e);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue