新增员工党员字段

This commit is contained in:
wkc
2026-04-17 11:04:52 +08:00
parent 3286795f98
commit 03a4acb63a
23 changed files with 453 additions and 68 deletions

View File

@@ -43,6 +43,10 @@ public class CcdiBaseStaff implements Serializable {
/** 入职时间 */
private Date hireDate;
/** 是否党员0-否 1-是 */
@TableField("is_party_member")
private Integer partyMember;
/** 状态 */
private String status;

View File

@@ -53,6 +53,10 @@ public class CcdiBaseStaffAddDTO implements Serializable {
/** 入职时间 */
private Date hireDate;
/** 是否党员0-否 1-是 */
@NotNull(message = "是否党员不能为空")
private Integer partyMember;
/** 状态 */
@NotBlank(message = "状态不能为空")
private String status;

View File

@@ -52,6 +52,10 @@ public class CcdiBaseStaffEditDTO implements Serializable {
/** 入职时间 */
private Date hireDate;
/** 是否党员0-否 1-是 */
@NotNull(message = "是否党员不能为空")
private Integer partyMember;
/** 状态 */
private String status;

View File

@@ -63,8 +63,15 @@ public class CcdiBaseStaffExcel implements Serializable {
@ColumnWidth(15)
private Date hireDate;
/** 是否党员 */
@ExcelProperty(value = "是否党员", index = 7)
@ColumnWidth(12)
@DictDropdown(dictType = "ccdi_yes_no_flag")
@Required
private Integer partyMember;
/** 状态 */
@ExcelProperty(value = "状态", index = 7)
@ExcelProperty(value = "状态", index = 8)
@ColumnWidth(10)
@DictDropdown(dictType = "ccdi_employee_status")
@Required

View File

@@ -44,6 +44,9 @@ public class CcdiBaseStaffVO implements Serializable {
/** 入职时间 */
private Date hireDate;
/** 是否党员0-否 1-是 */
private Integer partyMember;
/** 状态 */
private String status;

View File

@@ -32,6 +32,9 @@ public class ImportFailureVO {
@Schema(description = "年收入")
private BigDecimal annualIncome;
@Schema(description = "是否党员0-否 1-是")
private Integer partyMember;
@Schema(description = "状态")
private String status;

View File

@@ -320,6 +320,9 @@ public class CcdiBaseStaffImportServiceImpl implements ICcdiBaseStaffImportServi
if (StringUtils.isEmpty(addDTO.getPhone())) {
throw new RuntimeException("电话不能为空");
}
if (addDTO.getPartyMember() == null) {
throw new RuntimeException("是否党员不能为空");
}
if (StringUtils.isEmpty(addDTO.getStatus())) {
throw new RuntimeException("状态不能为空");
}
@@ -357,6 +360,9 @@ public class CcdiBaseStaffImportServiceImpl implements ICcdiBaseStaffImportServi
if (!"0".equals(addDTO.getStatus()) && !"1".equals(addDTO.getStatus())) {
throw new RuntimeException("状态只能填写'在职'或'离职'");
}
if (addDTO.getPartyMember() != 0 && addDTO.getPartyMember() != 1) {
throw new RuntimeException("是否党员只能填写'0'或'1'");
}
validateAnnualIncome(addDTO.getAnnualIncome(), "年收入");
}

View File

@@ -112,7 +112,7 @@ public class CcdiBaseStaffServiceImpl implements ICcdiBaseStaffService {
CcdiBaseStaff staff = baseStaffMapper.selectById(staffId);
CcdiBaseStaffVO vo = convertToVO(staff);
if (staff != null) {
vo.setAssetInfoList(assetInfoService.selectByFamilyId(staff.getIdCard()).stream().map(asset -> {
vo.setAssetInfoList(assetInfoService.selectByFamilyIdAndPersonId(staff.getIdCard(), staff.getIdCard()).stream().map(asset -> {
CcdiAssetInfoVO assetInfoVO = new CcdiAssetInfoVO();
BeanUtils.copyProperties(asset, assetInfoVO);
return assetInfoVO;
@@ -131,6 +131,7 @@ public class CcdiBaseStaffServiceImpl implements ICcdiBaseStaffService {
@Transactional
public int insertBaseStaff(CcdiBaseStaffAddDTO addDTO) {
validateAnnualIncome(addDTO.getAnnualIncome(), "年收入");
validatePartyMember(addDTO.getPartyMember(), "是否党员");
// 检查员工ID唯一性
if (baseStaffMapper.selectById(addDTO.getStaffId()) != null) {
throw new RuntimeException("该员工ID已存在");
@@ -161,6 +162,7 @@ public class CcdiBaseStaffServiceImpl implements ICcdiBaseStaffService {
@Transactional
public int updateBaseStaff(CcdiBaseStaffEditDTO editDTO) {
validateAnnualIncome(editDTO.getAnnualIncome(), "年收入");
validatePartyMember(editDTO.getPartyMember(), "是否党员");
CcdiBaseStaff existing = baseStaffMapper.selectById(editDTO.getStaffId());
if (existing == null) {
throw new RuntimeException("员工不存在");
@@ -291,4 +293,13 @@ public class CcdiBaseStaffServiceImpl implements ICcdiBaseStaffService {
}
}
private void validatePartyMember(Integer partyMember, String fieldLabel) {
if (partyMember == null) {
throw new RuntimeException(fieldLabel + "不能为空");
}
if (partyMember != 0 && partyMember != 1) {
throw new RuntimeException(fieldLabel + "只能填写'0'或'1'");
}
}
}

View File

@@ -14,13 +14,14 @@
<result property="phone" column="phone"/>
<result property="annualIncome" column="annual_income"/>
<result property="hireDate" column="hire_date"/>
<result property="partyMember" column="is_party_member"/>
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
</resultMap>
<select id="selectBaseStaffPageWithDept" resultMap="CcdiBaseStaffVOResult">
SELECT
e.staff_id, e.name, e.dept_id, e.id_card, e.phone, e.annual_income, e.hire_date, e.status, e.create_time,
e.staff_id, e.name, e.dept_id, e.id_card, e.phone, e.annual_income, e.hire_date, e.is_party_member, e.status, e.create_time,
d.dept_name
FROM ccdi_base_staff e
LEFT JOIN sys_dept d ON e.dept_id = d.dept_id
@@ -47,12 +48,12 @@
<!-- 批量插入或更新员工信息只更新非null字段 -->
<insert id="insertOrUpdateBatch" parameterType="java.util.List">
INSERT INTO ccdi_base_staff
(staff_id, name, dept_id, id_card, phone, annual_income, hire_date, status,
(staff_id, name, dept_id, id_card, phone, annual_income, hire_date, is_party_member, status,
create_time, create_by, update_by, update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.staffId}, #{item.name}, #{item.deptId}, #{item.idCard},
#{item.phone}, #{item.annualIncome}, #{item.hireDate}, #{item.status}, NOW(),
#{item.phone}, #{item.annualIncome}, #{item.hireDate}, #{item.partyMember}, #{item.status}, NOW(),
#{item.createBy}, #{item.updateBy}, NOW())
</foreach>
ON DUPLICATE KEY UPDATE
@@ -61,6 +62,7 @@
phone = COALESCE(VALUES(phone), phone),
annual_income = COALESCE(VALUES(annual_income), annual_income),
hire_date = COALESCE(VALUES(hire_date), hire_date),
is_party_member = COALESCE(VALUES(is_party_member), is_party_member),
status = COALESCE(VALUES(status), status),
update_by = COALESCE(VALUES(update_by), update_by),
update_time = NOW()
@@ -69,12 +71,12 @@
<!-- 批量插入员工信息 -->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO ccdi_base_staff
(staff_id, name, dept_id, id_card, phone, annual_income, hire_date, status,
(staff_id, name, dept_id, id_card, phone, annual_income, hire_date, is_party_member, status,
create_time, create_by, update_by, update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.staffId}, #{item.name}, #{item.deptId}, #{item.idCard},
#{item.phone}, #{item.annualIncome}, #{item.hireDate}, #{item.status}, NOW(),
#{item.phone}, #{item.annualIncome}, #{item.hireDate}, #{item.partyMember}, #{item.status}, NOW(),
#{item.createBy}, #{item.updateBy}, NOW())
</foreach>
</insert>