Commit b9f2fa04 authored by hongguangwu's avatar hongguangwu

合同

parent 4c0e4303
...@@ -17,15 +17,22 @@ ...@@ -17,15 +17,22 @@
package com.yifu.cloud.plus.v1.yifu.archives.entity; package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity; import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* 员工合同 * 员工合同
...@@ -46,245 +53,329 @@ public class TEmployeeContractInfo extends BaseEntity { ...@@ -46,245 +53,329 @@ public class TEmployeeContractInfo extends BaseEntity {
@Schema(description ="主键") @Schema(description ="主键")
private String id; private String id;
/**
* 员工编码
*/
@Schema(description ="员工编码")
private String empNo;
/** /**
* 员工主键 * 员工主键
*/ */
@Schema(description ="员工主键") @Length(max = 32, message = "员工主键不能超过32个字符")
@ExcelAttribute(name = "员工主键", maxLength = 32)
@Schema(description = "员工主键", name = "empId")
private String empId; private String empId;
/**
* 员工编码
*/
@NotBlank(message = "员工编码不能为空")
@Length(max = 32, message = "员工编码不能超过32个字符")
@ExcelAttribute(name = "员工编码", isNotEmpty = true, errorInfo = "员工编码不能为空", maxLength = 32)
@Schema(description = "员工编码", name = "empNo")
private String empNo;
/** /**
* 员工姓名 * 员工姓名
*/ */
@Schema(description ="员工姓名") @Length(max = 32, message = "员工姓名不能超过32个字符")
@ExcelAttribute(name = "员工姓名", maxLength = 32,needExport = true)
@Schema(description = "员工姓名", name = "empName")
private String empName; private String empName;
/** /**
* 员工身份证号 * 员工身份证号
*/ */
@Schema(description ="员工身份证号") @Length(max = 32, message = "员工身份证号不能超过32个字符")
@ExcelAttribute(name = "员工身份证号", maxLength = 32, isIdCard = true,needExport = true)
@Schema(description = "员工身份证号", name = "empIdcard")
private String empIdcard; private String empIdcard;
/** /**
* 合同名称 * 合同类型
*/ */
@Schema(description ="合同名称") @NotBlank(message = "合同类型不能为空")
@Length(max = 32, message = "合同类型不能超过32个字符")
@ExcelAttribute(name = "合同类型", isNotEmpty = true, errorInfo = "合同类型不能为空", maxLength = 32,needExport = true)
@Schema(description = "合同类型", name = "contractName")
private String contractName; private String contractName;
/** /**
* 合同类型 * 合同类型
*/ */
@Schema(description ="合同类型") @NotBlank(message = "合同类型不能为空")
@Length(max = 32, message = "合同类型不能超过32个字符")
@ExcelAttribute(name = "合同类型", isNotEmpty = true, errorInfo = "合同类型不能为空", maxLength = 32,isDataId = true, dataType = ExcelAttributeConstants.EMPLOYEE_CONTRACT_TYPE,needExport = true)
@Schema(description = "合同类型", name = "contractType")
private String contractType; private String contractType;
/** /**
* 合同起始时间 * 合同起始时间
*/ */
@Schema(description ="合同起始时间") @NotBlank(message = "合同起始时间不能为空")
@ExcelAttribute(name = "合同起始时间", isNotEmpty = true, errorInfo = "合同起始时间不能为空")
@Schema(description = "合同起始时间", name = "contractStart")
private LocalDate contractStart; private LocalDate contractStart;
/** /**
* 合同到期时间 * 合同到期时间
*/ */
@Schema(description ="合同到期时间") @ExcelAttribute(name = "合同到期时间",needExport = true)
@Schema(description = "合同到期时间", name = "contractEnd")
private LocalDate contractEnd; private LocalDate contractEnd;
/** /**
* 合同主体部门 * 合同主体部门
*/ */
@Schema(description ="合同主体部门") @Length(max = 128, message = "合同主体部门不能超过128个字符")
@ExcelAttribute(name = "合同主体部门", maxLength = 128)
@Schema(description = "合同主体部门deptName", name = "subjectDepart")
private String subjectDepart; private String subjectDepart;
/** /**
* 合同主体单位 * 合同主体单位
*/ */
@Schema(description ="合同主体单位") @Length(max = 128, message = "合同主体单位不能超过128个字符")
@ExcelAttribute(name = "合同主体单位", maxLength = 128)
@Schema(description = "合同主体单位unitName", name = "subjectUnit")
private String subjectUnit; private String subjectUnit;
/** /**
* 签订情况 * 签订情况
*/ */
@Schema(description ="签订情况") @NotBlank(message = "签订情况不能为空")
@Length(max = 1, message = "签订情况不能超过1个字符")
@ExcelAttribute(name = "签订情况", isNotEmpty = true, errorInfo = "签订情况不能为空", maxLength = 100,isDataId = true, dataType = ExcelAttributeConstants.EMPLOYEE_SITUATION_TYPE)
@Schema(description = "签订情况", name = "situation")
private String situation; private String situation;
/** /**
* 合同年限 * 合同年限
*/ */
@Schema(description ="合同年限") @NotBlank(message = "合同年限不能为空")
@ExcelAttribute(name = "合同年限", errorInfo = "合同年限不能为空")
@Schema(description = "合同年限", name = "contractTerm")
private Double contractTerm; private Double contractTerm;
/** /**
* 合同编码 * 合同编码
*/ */
@Schema(description ="合同编码") @NotBlank(message = "合同编码不能为空")
@Length(max = 128, message = "合同编码不能超过128个字符")
@ExcelAttribute(name = "合同编码", maxLength = 128)
@Schema(description = "合同编码", name = "contractNo")
private String contractNo; private String contractNo;
/** /**
* remark * 备注
*/ */
@Schema(description ="remark") @Length(max = 512, message = "不能超过512个字符")
@ExcelAttribute(name = "备注", maxLength = 512)
@Schema(description = "备注", name = "remark")
private String remark; private String remark;
/** /**
* 是否作废 0否/1是 * 是否作废 0否/1是
*/ */
@Schema(description ="是否作废 0否/1是") @Length(max = 32, message = "是否作废 0否/1是不能超过32个字符")
@ExcelAttribute(name = "是否作废 0否/1是")
@Schema(description = "是否作废 0否/1是", name = "isObsolete")
private String isObsolete; private String isObsolete;
/**
* 作废理由
*/
@Length(max = 32, message = "作废理由不能超过32个字符")
@ExcelAttribute(name = "作废理由")
@Schema(description = "作废理由", name = "obsoleteReason")
private String obsoleteReason;
/** /**
* 是否归档 0是/1否 * 是否归档 0是/1否
*/ */
@Schema(description ="是否归档 0是/1否") @Length(max = 1, message = "是否归档 0是/1否不能超过1个字符")
@ExcelAttribute(name = "是否归档 0是/1否", maxLength = 1)
@Schema(description = "是否归档 0是/1否", name = "isFile")
private String isFile; private String isFile;
/**
* 是否在用 0是/1否
*/
@Length(max = 1, message = "是否在用 0是/1否不能超过1个字符")
@ExcelAttribute(name = "是否在用 0是/1否", maxLength = 1)
@Schema(description = "是否在用 0是/1否", name = "inUse")
private String inUse;
/** /**
* 数据迁移ID * 数据迁移ID
*/ */
@Schema(description ="数据迁移ID") @ExcelAttribute(name = "数据迁移ID")
@Schema(description = "数据迁移ID", name = "oldId")
private Integer oldId; private Integer oldId;
/** /**
* 入职日期 * 入职日期
*/ */
@Schema(description ="入职日期") @ExcelAttribute(name = "入职日期")
@Schema(description = "入职日期", name = "enjoinDate")
private LocalDateTime enjoinDate; private LocalDateTime enjoinDate;
/** /**
* 合同岗位 * 合同岗位
*/ */
@Schema(description ="合同岗位") @Length(max = 32, message = "合同岗位不能超过32个字符")
@ExcelAttribute(name = "合同岗位", maxLength = 32 , needExport = true)
@Schema(description = "合同岗位", name = "post")
private String post; private String post;
/** /**
* 工时制(数据字典) * 工时制(数据字典) 1标准工时 2 综合工时 3不定时工时制
*/ */
@Schema(description ="工时制(数据字典)") @Length(max = 32, message = "工时制不能超过32个字符")
@ExcelAttribute(name = "工时制", maxLength = 32, isDataId = true, dataType = ExcelAttributeConstants.WORKING_HOURS)
@Schema(description = "工时制(数据字典) 1标准工时 2 综合工时 3不定时工时制", name = "workingHours")
private String workingHours; private String workingHours;
/** /**
* 档案柜号 * 档案柜号
*/ */
@Schema(description ="档案柜号") @Length(max = 50, message = "档案柜号不能超过50个字符")
@ExcelAttribute(name = "档案柜号", maxLength = 50)
@Schema(description = "档案柜号", name = "fileCabinetNo")
private String fileCabinetNo; private String fileCabinetNo;
/** /**
* 结算主体ID * 结算主体
*/ */
@Schema(description ="结算主体ID") @NotBlank(message = "结算主体不能为空")
@Length(max = 32, message = "结算主体不能超过32个字符")
@ExcelAttribute(name = "结算主体", errorInfo = "结算主体不能为空",isOrgan=true, maxLength = 32)
@Schema(description = "结算主体", name = "settleDomain")
private String settleDomain; private String settleDomain;
/** /**
* 是否在用:0 是 1 否 * 员工类型
*/ */
@Schema(description ="是否在用:0 是 1 否") @ExcelAttribute(name = "员工类型", errorInfo = "员工类型不能为空", maxLength = 32, isDataId = true,dataType = ExcelAttributeConstants.PERSONNEL_TYPE)
private String inUse; @TableField(exist = false)
private String empType;
/** /**
* 作废理由 * @Author: wangan
*/ * @Date: 2019/11/25
@Schema(description ="作废理由") * @Description: 用于首页代办任务跳转,参数指定
private String obsoleteReason; * @return:
**/
/** @TableField(exist = false)
* 客户id @Schema(description = "首页代办任务跳转(0:代办任务标识,其他:非代办任务标识", name = "workBranchjumpFlag")
*/ private String workBranchjumpFlag;
@Schema(description ="客户id") /******************************查询优化新增字段开始***********************************/
private String customerId;
/** /**
* 档案-省 * 档案-省
*/ */
@Schema(description ="档案-省") @ExcelAttribute(name = "档案-省", maxLength = 32, isDataId = true, isArea = true, parentField = "")
@Schema(description = "档案-省", name = "fileProvince")
private Integer fileProvince; private Integer fileProvince;
/** /**
* 档案-市 * 档案-市
*/ */
@Schema(description ="档案-市") @ExcelAttribute(name = "档案-市", maxLength = 32, isDataId = true, isArea = true, parentField = "fileProvince")
@Schema(description = "档案-市", name = "fileCity")
private Integer fileCity; private Integer fileCity;
/** /**
* 档案-县 * 档案-县
*/ */
@Schema(description ="档案-县") @ExcelAttribute(name = "档案-县", maxLength = 32, isDataId = true, isArea = true, parentField = "fileCity")
@Schema(description = "档案-县", name = "fileTown")
private Integer fileTown; private Integer fileTown;
/**
* 0 在职 1 个人离职 2 单位辞退 3 临时 4 特殊人员 5 退休 6 退休返聘
*/
@Schema(description ="0 在职 1 个人离职 2 单位辞退 3 临时 4 特殊人员 5 退休 6 退休返聘")
private String workingStatusSub;
/** /**
* 在职状态 0是/1否 * 在职状态 0是/1否
*/ */
@Schema(description ="在职状态 0是/1否") @ExcelAttribute(name = "在职状态", errorInfo = "在职状态 0是/1否不能为空", maxLength = 1, isDataId =true, readConverterExp = "0=在职,1=离职")
@Schema(description = "在职状态 0是/1否", name = "workFlag")
private String workFlag; private String workFlag;
/**
* 在职状态扩展 0 在职 1 个人离职 2 单位辞退 3 临时 4 特殊人员 5 退休 6 退休返聘
*/
@ExcelAttribute(name = "在职细分",isDataId = true, dataType = "work_falg_sub")
@Schema(description = "在职细分 0 在职 1 个人离职 2 单位辞退 3 临时 4 特殊人员 5 退休 6 退休返聘", name = "workingStatusSub")
private String workingStatusSub;
/** /**
* 合同试用期开始时间 * 合同试用期开始时间
*/ */
@Schema(description ="合同试用期开始时间") @ExcelAttribute(name = "试用期开始时间" )
private LocalDateTime periodStart; @Schema(description="合同试用期开始时间",name="periodStart")
private LocalDate periodStart;
/** /**
* 合同试用期结束时间 * 合同试用期结束时间
*/ */
@Schema(description ="合同试用期结束时间") @ExcelAttribute(name = "试用期结束时间" )
private LocalDateTime periodEnd; @Schema(description="合同试用期结束时间",name="periodEnd")
private LocalDate periodEnd;
/** /**
* 试用期工资 元/月 * 试用期工资元/月
*/ */
@Schema(description ="试用期工资 元/月") @ExcelAttribute(name = "试用期工资元/月" )
@Schema(description="试用期工资(元/月)",name="periodSalaryPerMonth")
private BigDecimal periodSalaryPerMonth; private BigDecimal periodSalaryPerMonth;
/** /**
* 工资形式 1.计时工资 2.计件工资 3.其他 * 工资形式 1.计时工资 2.计件工资 3.其他
*/ */
@Schema(description ="工资形式 1.计时工资 2.计件工资 3.其他") @Length(max=1,message = "工资形式不能超过1个字符")
@ExcelAttribute(name = "工资形式" , maxLength = 1 , isDataId = true, dataType = ExcelAttributeConstants.SALARY_TYPE)
@Schema(description="工资形式 1.计时工资 2.计件工资 3.其他",name="salaryType")
private String salaryType; private String salaryType;
/** /**
* 计时工资 工资标准 元/月 * 计时工资 工资标准 元/月
*/ */
@Schema(description ="计时工资 工资标准 元/月 ") @ExcelAttribute(name = "计时工资(元/月)" )
@Schema(description="计时工资 工资标准 元/月 ",name="salaryStandardPerHour")
private BigDecimal salaryStandardPerHour; private BigDecimal salaryStandardPerHour;
/** /**
* 计件工资 工资标准单价/元 * 计件工资 工资标准单价/元
*/ */
@Schema(description ="计件工资 工资标准单价/元 ") @ExcelAttribute(name = "计件工资(单价/元)" )
@Schema(description="计件工资 工资标准单价/元 ",name="salaryStandardPerPiece")
private BigDecimal salaryStandardPerPiece; private BigDecimal salaryStandardPerPiece;
/******************************查询优化新增字段结束***********************************/
/** /**
* 派单标识 1 代表派单生成, 派单审核通过后清空标识 专门用于派单作废 * 派单标识 默认null 如果派单产生 为1 派单审核通过 清空标识 2020-09-27 fxj
*/ */
@Schema(description ="派单标识 1 代表派单生成, 派单审核通过后清空标识 专门用于派单作废") @ExcelAttribute(name = "派单标识" )
@Schema(description="派单标识",name="dispatchFlag")
private String dispatchFlag; private String dispatchFlag;
/** /**
* 邮件提醒人id * 邮件提醒用户id
*/ */
@Schema(description ="邮件提醒人id") @Length(max = 32, message = "邮件提醒用户id不能超过32个字符")
@Schema(description = "邮件提醒用户id默认是创建人", name = "warnEmailUserId")
private String warnEmailUserId; private String warnEmailUserId;
/** /**
* 法大大电子合同标识 0不开通 1开通电子合同 * 合同终止时间串 解决freemarker 生产环境时间格式与测试环境不一样问提
*/ */
@Schema(description ="法大大电子合同标识 0不开通 1开通电子合同") @TableField(exist = false)
private String endDateStr;
@ExcelAttribute(name = "电子合同" ,readConverterExp = "0=不开通,1=开通" )
@Schema(description="电子合同:0不开通 1开通",name="fddFlag")
private String fddFlag; private String fddFlag;
@ExcelAttribute(name = "是否需要电子签" ,readConverterExp = "0=正常合同,1=需要电子签" )
@Schema(description="是否需要电子签:0正常合同 1需要电子签", name="isSign")
private Integer isSign;
/** /**
* isSign * 客户id
*/ */
@Schema(description ="isSign") @Schema(description ="客户id")
private Integer isSign; private String customerId;
/**
* 客户编码
*/
@Schema(description ="客户编码")
private String unitNo;
/**
* 项目编码
*/
@Schema(description ="项目编码")
private String deptNo;
/**
* 申请编码
*/
@Schema(description ="申请编码")
private String applyNo;
/**
* 审核状态(0:待提交;1:待审核;2审核通过;3审核不通过)
*/
@Schema(description ="审核状态(0:待提交;1:待审核;2审核通过;3审核不通过)")
private Integer auditStatus;
@Schema(description ="附件idList")
@TableField(exist = false)
private List<String> attaList;
} }
...@@ -44,7 +44,7 @@ public class EmployeeExportVO extends BaseEntity { ...@@ -44,7 +44,7 @@ public class EmployeeExportVO extends BaseEntity {
@ExcelProperty(value = "员工类型") @ExcelProperty(value = "员工类型")
private String empNatrue; private String empNatrue;
@ExcelProperty(value = "姓名") @ExcelProperty(value = "员工姓名")
private String empName; private String empName;
@ColumnWidth(20) @ColumnWidth(20)
......
...@@ -35,8 +35,8 @@ public class EmployeeLeaveVO implements Serializable { ...@@ -35,8 +35,8 @@ public class EmployeeLeaveVO implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ExcelProperty(value = "姓名") @ExcelProperty(value = "员工姓名")
@Size(max = 20, message = "姓名不可超过20位") @Size(max = 20, message = "员工姓名不可超过20位")
private String empName; private String empName;
@ExcelProperty(value = "身份证号") @ExcelProperty(value = "身份证号")
......
...@@ -48,7 +48,7 @@ public class EmployeeProjectExportVO{ ...@@ -48,7 +48,7 @@ public class EmployeeProjectExportVO{
/** /**
* 员工姓名 * 员工姓名
*/ */
@ExcelProperty(value ="姓名") @ExcelProperty(value ="员工姓名")
private String empName; private String empName;
/** /**
......
...@@ -45,10 +45,10 @@ public class EmployeeVO implements Serializable { ...@@ -45,10 +45,10 @@ public class EmployeeVO implements Serializable {
private String empNatrue; private String empNatrue;
/** /**
* 姓名 * 员工姓名
*/ */
@ExcelProperty(value = "姓名") @ExcelProperty(value = "员工姓名")
@Size(max = 20, message = "姓名不可超过20位") @Size(max = 20, message = "员工姓名不可超过20位")
private String empName; private String empName;
/** /**
......
...@@ -36,7 +36,7 @@ public class ErrorMessageVO implements Serializable { ...@@ -36,7 +36,7 @@ public class ErrorMessageVO implements Serializable {
@Schema(description = "行号") @Schema(description = "行号")
private int lineNum; private int lineNum;
@Schema(description = "姓名") @Schema(description = "员工姓名")
private String empName; private String empName;
@Schema(description = "身份证号") @Schema(description = "身份证号")
......
package com.yifu.cloud.plus.v1.yifu.archives.Constants;
public class EmployeeContractConstants {
public static final String searchEmpContractInfo = " 查询对应的员工合同信息!";
public static final String sameEmpOnlyOneStandContract= "同一员工只允许一个在用标准合同,请按员工编码:";
public static final String exportTip = "数据导入解析!数据行数:";
public final static String ContractUpdateFailInfo="合同更新失败:合同更新同步更新派单数据更新失败!";
public final static String UTF8 ="UTF-8";
}
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
package com.yifu.cloud.plus.v1.yifu.archives.controller; package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
...@@ -31,6 +31,8 @@ import org.springframework.http.HttpHeaders; ...@@ -31,6 +31,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* 员工合同 * 员工合同
...@@ -40,7 +42,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -40,7 +42,7 @@ import org.springframework.web.bind.annotation.*;
*/ */
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@RequestMapping("/temployeecontrctinfo") @RequestMapping("/temployeecontractinfo")
@Tag(name = "员工合同管理") @Tag(name = "员工合同管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) @SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class TEmployeeContractInfoController { public class TEmployeeContractInfoController {
...@@ -56,9 +58,8 @@ public class TEmployeeContractInfoController { ...@@ -56,9 +58,8 @@ public class TEmployeeContractInfoController {
*/ */
@Operation(summary = "分页查询", description = "分页查询") @Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page") @GetMapping("/page")
@PreAuthorize("@pms.hasPermission('contract_temployeecontrctinfo_get')") public R gettemployeecontractinfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
public R getTEmployeeContrctInfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) { return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page, tEmployeeContractInfo));
return new R<>(tEmployeeContractInfoService.getTEmployeeContractInfoPage(page,tEmployeeContractInfo));
} }
...@@ -68,9 +69,8 @@ public class TEmployeeContractInfoController { ...@@ -68,9 +69,8 @@ public class TEmployeeContractInfoController {
* @param id id * @param id id
* @return R * @return R
*/ */
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('contract_temployeecontrctinfo_get')") @Operation(summary = "通过id查询", description = "通过id查询:hasPermission('temployeecontractinfo_get')")
@GetMapping("/{id}") @GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('contract_temployeecontrctinfo_get')")
public R getById(@PathVariable("id") String id) { public R getById(@PathVariable("id") String id) {
return R.ok(tEmployeeContractInfoService.getById(id)); return R.ok(tEmployeeContractInfoService.getById(id));
} }
...@@ -81,12 +81,12 @@ public class TEmployeeContractInfoController { ...@@ -81,12 +81,12 @@ public class TEmployeeContractInfoController {
* @param tEmployeeContractInfo 员工合同 * @param tEmployeeContractInfo 员工合同
* @return R * @return R
*/ */
@Operation(summary = "新增员工合同", description = "新增员工合同:hasPermission('contract_temployeecontrctinfo_add')") @Operation(summary = "新增员工合同", description = "新增员工合同:hasPermission('temployeecontractinfo_add')")
@SysLog("新增员工合同") @SysLog("新增员工合同")
@PostMapping @PostMapping
@PreAuthorize("@pms.hasPermission('contract_temployeecontrctinfo_add')") @PreAuthorize("@pms.hasPermission('temployeecontractinfo_add')")
public R save(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) { public R<List<ErrorMessage>> save(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) {
return R.ok(tEmployeeContractInfoService.save(tEmployeeContractInfo)); return tEmployeeContractInfoService.saveNewContract(tEmployeeContractInfo);
} }
/** /**
...@@ -95,10 +95,10 @@ public class TEmployeeContractInfoController { ...@@ -95,10 +95,10 @@ public class TEmployeeContractInfoController {
* @param tEmployeeContractInfo 员工合同 * @param tEmployeeContractInfo 员工合同
* @return R * @return R
*/ */
@Operation(summary = "修改员工合同", description = "修改员工合同:hasPermission('contract_temployeecontrctinfo_edit')") @Operation(summary = "修改员工合同", description = "修改员工合同:hasPermission('temployeecontractinfo_edit')")
@SysLog("修改员工合同") @SysLog("修改员工合同")
@PutMapping @PutMapping
@PreAuthorize("@pms.hasPermission('contract_temployeecontrctinfo_edit')") @PreAuthorize("@pms.hasPermission('temployeecontractinfo_edit')")
public R updateById(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) { public R updateById(@RequestBody TEmployeeContractInfo tEmployeeContractInfo) {
return R.ok(tEmployeeContractInfoService.updateById(tEmployeeContractInfo)); return R.ok(tEmployeeContractInfoService.updateById(tEmployeeContractInfo));
} }
...@@ -109,10 +109,10 @@ public class TEmployeeContractInfoController { ...@@ -109,10 +109,10 @@ public class TEmployeeContractInfoController {
* @param id id * @param id id
* @return R * @return R
*/ */
@Operation(summary = "通过id删除员工合同", description = "通过id删除员工合同:hasPermission('contract_temployeecontrctinfo_del')") @Operation(summary = "通过id删除员工合同", description = "通过id删除员工合同:hasPermission('temployeecontractinfo_del')")
@SysLog("通过id删除员工合同") @SysLog("通过id删除员工合同")
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('contract_temployeecontrctinfo_del')") @PreAuthorize("@pms.hasPermission('temployeecontractinfo_del')")
public R removeById(@PathVariable String id) { public R removeById(@PathVariable String id) {
return R.ok(tEmployeeContractInfoService.removeById(id)); return R.ok(tEmployeeContractInfoService.removeById(id));
} }
......
...@@ -41,4 +41,15 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac ...@@ -41,4 +41,15 @@ public interface TEmployeeContractInfoMapper extends BaseMapper<TEmployeeContrac
*/ */
IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page, @Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo); IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page, @Param("tEmployeeContractInfo") TEmployeeContractInfo tEmployeeContractInfo);
/**
* 更新合同在用状态
* @Author fxj
* @Date 2019-10-17
* @param empId
* @param id
* @param status
* @return
**/
int updateInUseStatusById(@Param("empId")String empId, @Param("id")String id,@Param("status")String status);
} }
...@@ -21,6 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -21,6 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import java.util.List;
/** /**
* 员工合同 * 员工合同
...@@ -38,4 +43,16 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract ...@@ -38,4 +43,16 @@ public interface TEmployeeContractInfoService extends IService<TEmployeeContract
*/ */
IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo); IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo);
R<List<ErrorMessage>> saveNewContract(TEmployeeContractInfo tEmployeeContractInfo);
/**
* 保存员工合同表及附件关系表
* @Author fxj
* @Date 2019-09-09
* @param tEmployeeContractInfo
* @param tEmployeeInfo
* @return
**/
boolean saveContractAndAtta(TEmployeeContractInfo tEmployeeContractInfo, TEmployeeInfo tEmployeeInfo);
} }
...@@ -17,12 +17,27 @@ ...@@ -17,12 +17,27 @@
package com.yifu.cloud.plus.v1.yifu.archives.service.impl; package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractInfoService; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
/** /**
* 员工合同 * 员工合同
...@@ -31,7 +46,21 @@ import org.springframework.stereotype.Service; ...@@ -31,7 +46,21 @@ import org.springframework.stereotype.Service;
* @date 2022-06-29 20:45:22 * @date 2022-06-29 20:45:22
*/ */
@Service @Service
@RequiredArgsConstructor
public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContractInfoMapper, TEmployeeContractInfo> implements TEmployeeContractInfoService { public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContractInfoMapper, TEmployeeContractInfo> implements TEmployeeContractInfoService {
private static final String EMPID_NOT_EMPTY = "员工ID、项目ID不可为空";
private static final String EMPINFO_IS_NOT_EXITS_BYID = "未找到人员档案与项目档案!";
private final TEmployeeInfoService tEmployeeInfoService;
private final TEmployeeProjectService tEmployeeProjectService;
private final TSettleDomainService tSettleDomainService;
private final TCustomerInfoService tCustomerInfoService;
private final TAttaInfoService tAttaInfoService;
// 缓存信息
private final CacheManager cacheManager;
/** /**
* 员工合同信息表简单分页查询 * 员工合同信息表简单分页查询
* *
...@@ -42,4 +71,190 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -42,4 +71,190 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
public IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) { public IPage<TEmployeeContractInfo> getTEmployeeContractInfoPage(Page<TEmployeeContractInfo> page, TEmployeeContractInfo tEmployeeContractInfo) {
return baseMapper.getTEmployeeContractInfoPage(page, tEmployeeContractInfo); return baseMapper.getTEmployeeContractInfoPage(page, tEmployeeContractInfo);
} }
@Override
public R<List<ErrorMessage>> saveNewContract(TEmployeeContractInfo tEmployeeContractInfo) {
try {
if (Common.isEmpty(tEmployeeContractInfo.getEmpId()) || Common.isEmpty(tEmployeeContractInfo.getSettleDomain())) {
return R.failed(EMPID_NOT_EMPTY);
}
// 获取人员档案
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(tEmployeeContractInfo.getEmpId());
// 获取项目
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, tEmployeeContractInfo.getEmpId())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (null == tEmployeeInfo || tEmployeeProject == null) {
return R.failed(EMPINFO_IS_NOT_EXITS_BYID);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
// 初始化
this.initEmployeeContract(tEmployeeContractInfo, tEmployeeInfo, tEmployeeProject, user);
//是否归档:否
tEmployeeContractInfo.setIsFile(CommonConstants.ONE_STRING);
//是否在用:是
tEmployeeContractInfo.setInUse(CommonConstants.ZERO_STRING);
ExcelAttributeValidityUtil<TEmployeeContractInfo> validity = new ExcelAttributeValidityUtil<>(TEmployeeContractInfo.class);
validity.ValidityObj(tEmployeeContractInfo);
if (null != validity.getErrorInfo() && !validity.getErrorInfo().isEmpty()) {
return R.failed(validity.getErrorInfo(), ResultConstants.VALIDITY_FAIL);
}
if (this.saveContractAndAtta(tEmployeeContractInfo, tEmployeeInfo)) {
return R.ok();
} else {
return R.failed();
}
} catch (Exception e) {
log.error("员工合同保存异常:" + e.getMessage());
return R.failed("员工合同保存系统异常!");
}
}
private void initEmployeeContract(TEmployeeContractInfo tEmployeeContractInfo, TEmployeeInfo tEmployeeInfo
, TEmployeeProject tEmployeeProject, YifuUser user) {
tEmployeeContractInfo.setEmpId(tEmployeeInfo.getId());
tEmployeeContractInfo.setEmpIdcard(tEmployeeInfo.getEmpIdcard());
tEmployeeContractInfo.setEmpName(tEmployeeInfo.getEmpName());
tEmployeeContractInfo.setEmpNo(tEmployeeInfo.getEmpCode());
if (Common.isEmpty(tEmployeeContractInfo.getCreateBy())) {
tEmployeeContractInfo.setCreateBy(null == user ? "" : user.getId());
tEmployeeContractInfo.setCreateName(null == user ? "" : user.getNickname());
tEmployeeContractInfo.setCreateTime(LocalDateTime.now());
}
tEmployeeContractInfo.setUpdateBy(null == user ? "" : user.getId());
tEmployeeContractInfo.setUpdateTime(LocalDateTime.now());
tEmployeeContractInfo.setSettleDomain(tEmployeeProject.getDeptId());
tEmployeeContractInfo.setCustomerId(tEmployeeProject.getUnitId());
tEmployeeContractInfo.setSubjectUnit(tEmployeeProject.getUnitName());
tEmployeeContractInfo.setUnitNo(tEmployeeProject.getUnitNo());
tEmployeeContractInfo.setSubjectDepart(tEmployeeProject.getDeptName());
tEmployeeContractInfo.setDeptNo(tEmployeeProject.getDeptNo());
tEmployeeContractInfo.setFileProvince(tEmployeeInfo.getFileProvince());
tEmployeeContractInfo.setFileCity(tEmployeeInfo.getFileCity());
tEmployeeContractInfo.setFileTown(tEmployeeInfo.getFileTown());
tEmployeeContractInfo.setWorkFlag(String.valueOf(tEmployeeInfo.getFileStatus()));
tEmployeeContractInfo.setWorkingStatusSub(CommonConstants.ZERO_STRING);
//是否作废:否
tEmployeeContractInfo.setIsObsolete(CommonConstants.ZERO_STRING);
if (Common.isEmpty(tEmployeeContractInfo.getApplyNo())) {
tEmployeeContractInfo.setApplyNo(this.getCode());
}
}
/**
* @param
* @Description: 获取 申请编码
* @Author: hgw
* @Date: 2022/6/22 17:52
* @return: java.lang.String
**/
private synchronized String getCode() {
String nowDay = DateUtil.getThisDay();
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CONTRACT_CODE);
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (Common.isNotNull(nowNumObj)) {
SimpleValueWrapper value = (SimpleValueWrapper) nowNumObj;
nowNums = (Integer) value.get() + 1;
}
cache.put(nowDay, nowNums);
return "HT" + nowDay + this.getFourNum(String.valueOf(nowNums));
}
/**
* @param nowNums 数字
* @Description: 获取四位字符型数字
* @Author: hgw
* @Date: 2022-6-30 16:05:25
* @return: 五位字符型数字
**/
private String getFourNum(String nowNums) {
if (nowNums.length() >= 4) {
return nowNums.substring(0, 4);
}
String[] zeroArr = {"0", "00", "000"};
int num = 3 - nowNums.length();
return zeroArr[num] + nowNums;
}
/**
* 保存员工合同表及附件关系表
*
* @param tEmployeeContractInfo
* @param tEmployeeInfo
* @return
* @Author fxj
* @Date 2019-09-09
**/
@Transactional
@Override
public boolean saveContractAndAtta(TEmployeeContractInfo tEmployeeContractInfo, TEmployeeInfo tEmployeeInfo) {
//档案柜存在就自动归档
if (Common.isNotNull(tEmployeeContractInfo.getAttaList())) {
tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING);
}
if (null != tEmployeeContractInfo.getSettleDomain()
&& (Common.isEmpty(tEmployeeContractInfo.getSubjectUnit())
|| Common.isEmpty(tEmployeeContractInfo.getSubjectDepart()))) {
TSettleDomain settleDomain = tSettleDomainService.getById(tEmployeeContractInfo.getSettleDomain());
if (null != settleDomain) {
if (Common.isEmpty(tEmployeeContractInfo.getSubjectDepart())) {
tEmployeeContractInfo.setSubjectDepart(settleDomain.getDepartName());
tEmployeeContractInfo.setDeptNo(settleDomain.getDepartNo());
}
if (null != settleDomain.getCustomerId() && Common.isEmpty(tEmployeeContractInfo.getSubjectUnit())) {
TCustomerInfo customerInfo = tCustomerInfoService.getById(settleDomain.getCustomerId());
if (null != customerInfo) {
tEmployeeContractInfo.setSubjectUnit(customerInfo.getCustomerName());
tEmployeeContractInfo.setUnitNo(customerInfo.getCustomerCode());
}
}
}
}
// 如果存在工时制且合同为最新在用合同更新档案的工时制——档案没工时制了
if (baseMapper.insert(tEmployeeContractInfo) > 0) {
//先停用所有在用的员工合同
baseMapper.updateInUseStatusById(tEmployeeContractInfo.getEmpId(), tEmployeeContractInfo.getId(), CommonConstants.ONE_STRING);
if (Common.isNotNull(tEmployeeContractInfo.getAttaList()) && Common.isNotNull(tEmployeeContractInfo.getId())) {
List<String> attaList = tEmployeeContractInfo.getAttaList();
if (null != attaList && !attaList.isEmpty()) {
TAttaInfo contractAtta = null;
for (String attaId : attaList) {
contractAtta = tAttaInfoService.getById(attaId);
if (contractAtta != null) {
contractAtta.setDomainId(tEmployeeContractInfo.getId());
tAttaInfoService.updateById(contractAtta);
}
}
}
}
// 更新档案合同状态
this.updateEmployeeContractStatus(tEmployeeInfo.getId());
return true;
}
return false;
}
private void updateEmployeeContractStatus(String empId) {
//查看未作废合同数
TEmployeeInfo employeeInfo = tEmployeeInfoService.getById(empId);
if (employeeInfo != null) {
employeeInfo.setContractStatus(CommonConstants.ONE_INT);
}
}
} }
...@@ -70,6 +70,12 @@ ...@@ -70,6 +70,12 @@
<result property="createTime" column="CREATE_TIME"/> <result property="createTime" column="CREATE_TIME"/>
<result property="updateBy" column="UPDATE_BY"/> <result property="updateBy" column="UPDATE_BY"/>
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
<result property="unitName" column="UNIT_NAME"/>
<result property="unitNo" column="UNIT_NO"/>
<result property="deptName" column="DEPT_NAME"/>
<result property="deptNo" column="DEPT_NO"/>
<result property="applyNo" column="APPLY_NO"/>
<result property="auditStatus" column="AUDIT_STATUS"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.ID, a.ID,
...@@ -117,7 +123,14 @@ ...@@ -117,7 +123,14 @@
a.CREATE_NAME, a.CREATE_NAME,
a.CREATE_TIME, a.CREATE_TIME,
a.UPDATE_BY, a.UPDATE_BY,
a.UPDATE_TIME a.UPDATE_TIME,
a.UNIT_ID,
a.UNIT_NAME,
a.UNIT_NO,
a.DEPT_NAME,
a.DEPT_NO,
a.AUDIT_STATUS,
a.APPLY_NO
</sql> </sql>
<sql id="tEmployeeContractInfo_where"> <sql id="tEmployeeContractInfo_where">
<if test="tEmployeeContractInfo != null"> <if test="tEmployeeContractInfo != null">
...@@ -259,6 +272,29 @@ ...@@ -259,6 +272,29 @@
<if test="tEmployeeContractInfo.updateTime != null"> <if test="tEmployeeContractInfo.updateTime != null">
AND a.UPDATE_TIME = #{tEmployeeContractInfo.updateTime} AND a.UPDATE_TIME = #{tEmployeeContractInfo.updateTime}
</if> </if>
<if test="tEmployeeContractInfo.unitId != null and tEmployeeContractInfo.unitId.trim() != ''">
AND a.UNIT_ID = #{tEmployeeContractInfo.unitId}
</if>
<if test="tEmployeeContractInfo.unitName != null and tEmployeeContractInfo.unitName.trim() != ''">
AND a.UNIT_NAME like concat('%',#{tEmployeeContractInfo.unitName},'%')
</if>
<if test="tEmployeeContractInfo.unitNo != null and tEmployeeContractInfo.unitNo.trim() != ''">
AND a.UNIT_NO = #{tEmployeeContractInfo.unitNo}
</if>
<if test="tEmployeeContractInfo.deptName != null and tEmployeeContractInfo.deptName.trim() != ''">
AND a.DEPT_NAME like concat('%',#{tEmployeeContractInfo.deptName},'%')
</if>
<if test="tEmployeeContractInfo.deptNo != null and tEmployeeContractInfo.deptNo.trim() != ''">
AND a.DEPT_NO = #{tEmployeeContractInfo.deptNo}
</if>
<if test="tEmployeeContractInfo.applyNo != null and tEmployeeContractInfo.applyNo.trim() != ''">
AND a.APPLY_NO = #{tEmployeeContractInfo.applyNo}
</if>
<if test="tEmployeeContractInfo.auditStatus != null">
AND a.AUDIT_STATUS = #{tEmployeeContractInfo.auditStatus}
</if>
</if> </if>
</sql> </sql>
<!--tEmployeeContractInfo简单分页查询--> <!--tEmployeeContractInfo简单分页查询-->
...@@ -271,4 +307,10 @@ ...@@ -271,4 +307,10 @@
<include refid="tEmployeeContractInfo_where"/> <include refid="tEmployeeContractInfo_where"/>
</where> </where>
</select> </select>
<!-- 根据员工ID更新合同在用状态 -->
<update id="updateInUseStatusById">
update t_employee_contract_info set IN_USE = #{status} where EMP_ID = #{empId} and ID != #{id}
</update>
</mapper> </mapper>
...@@ -84,5 +84,11 @@ public interface CacheConstants { ...@@ -84,5 +84,11 @@ public interface CacheConstants {
* @Date: 2022/6/21 17:09 * @Date: 2022/6/21 17:09
**/ **/
String EVERYDAY_EMP_CODE = "everyday_emp_code"; String EVERYDAY_EMP_CODE = "everyday_emp_code";
/**
* @Description: 每日员工合同的 申请编码 缓存
* @Author: hgw
* @Date: 2022/6/21 17:09
**/
String EVERYDAY_EMP_CONTRACT_CODE = "everyday_emp_contract_code";
} }
...@@ -29,4 +29,76 @@ public class ExcelAttributeConstants { ...@@ -29,4 +29,76 @@ public class ExcelAttributeConstants {
// 公积金状态 // 公积金状态
public static final String FUND_STATUS = "fund_status"; public static final String FUND_STATUS = "fund_status";
//员工合同类型
public static final String EMPLOYEE_CONTRACT_TYPE = "employee_contract_type" ;
//员工合同工时制 1标准工时 2 综合工时 3不定时工时制
public static final String WORKING_HOURS = "working_hours";
//员工合同续签情况
public static final String EMPLOYEE_SITUATION_TYPE = "situation_type" ;
//商险结算类型
public static final String SETTLEMENT_TYPE = "settlementType";
//商险订单状态
public static final String INSURANCE_RECORD_STATUS = "Insurance_record_status";
//社保大病是否收取费用 0 是 1 否
public static final String IS_ILLNESS = "is_illness";
//社保大病取值方式 0 按比例 1按定值
public static final String VALUE_TYPE = "value_type";
public static final String NATION = "nation";
//家庭信息:与本人关系
public static final String RELATIONSHIP_SELF = "relationship_self";
//员工档案:性别
public static final String SEX ="sex";
//员工档案:户口性质
public static final String HOUSEHOLD_NATURE = "household_nature";
//员工档案:客户性质
public static final String NATURE ="nature";
//员工档案:婚姻状况
public static final String MARITAL_STATUS = "marital_status";
//员工档案:人员类型
public static final String PERSONNEL_TYPE = "personnel_type";
//员工档案:员工标签
public static final String EMPLOYEE_LABLE = "employee_lable";
//员工档案:政治面貌
public static final String POLITICAL_STATUS = "political_status";
//审核状态
public static final String AUDIT_STATUS ="audit_status";
//是否委托
public static final String IS_ENTRUST ="is_entrust";
//系统用户
public static final String SYS_USER ="sys_user";
//区域
public static final String SYS_AREA ="sys_area";
//员工档案:银行
public static final String BANK="bank";
//通用状态标识 0 是 1 否
public static final String STATUS_FLAG = "status_flag";
//学历信息:学历类型
public static final String EDUCATION_TYPE = "education_type";
//职业资格:资格类型
public static final String QUALIFICATION_TYPE = "qualification_type";
//职业资格:资格等级
public static final String QUALIFICATION_LEVEL = "qualification_level";
//员工伤残:伤残等级
public static final String DISABILITY_GRADE = "disability_grade";
//工作履历:工作类型 如兼职、全职等
public static final String WORK_TYPE = "work_type";
//职业资格:获取方式
public static final String OBTAIN_TYPE = "obtain_type";
//学历信息:学制
public static final String EDUCATION_SYSTEM = "education_system";
//工资形式 1.计时工资 2.计件工资 3.其他
public static final String SALARY_TYPE = "salary_type";
} }
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
import lombok.experimental.UtilityClass;
@UtilityClass
public class ResultConstants {
public static final String SAVE_SUCCESS ="保存成功!";
public static final String SAVE_FAIL ="保存失败!";
public static final String MODIFY_SUCCESS ="修改成功!";
public static final String MODIFY_FAIL ="修改失败!";
public static final String VALIDITY_FAIL="校验失败";
public static final String NO_USER = "获取登录用户信息失败!";
public static final String SUCCESS_INFO = "操作成功!";
public static final String FAIL_INFO_NO_MODEL = "操作失败无此实体信息!";
public static final String FAIL_INFO_HAVE = "操作失败记录已存在!";
public static final String FAIL_INFO_PARAM_NULL = "操作失败,参数为空!";
public static final String FAIL_INFO_RELATION_FOLLOW = "已关联跟进记录,禁止删除!";
public static final String FAIL_INFO_RELATION_CONTACT = "已关联联系人,禁止删除!";
public static final String REQUEST_LOCK_FAIL = "获取锁失败";
public static final String DATA_IMPORT_PARSING_RESULT = "数据导入解析!数据行数:";
public static final String NO_SELECT_DATA = "请选择数据";
public static final String NO_GETLOCK_DATA = "获取锁失败,10秒后重试!";
public static final String NO_ID = "操作失败,id不能为空!";
}
...@@ -3,8 +3,10 @@ package com.yifu.cloud.plus.v1.yifu.common.core.util; ...@@ -3,8 +3,10 @@ package com.yifu.cloud.plus.v1.yifu.common.core.util;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
...@@ -29,6 +31,7 @@ public class Common { ...@@ -29,6 +31,7 @@ public class Common {
public static boolean isEmpty(String str) { public static boolean isEmpty(String str) {
return null == str || "".equals(str.trim()) || "null".equals(str.trim()) || "undefinded".equals(str.trim()); return null == str || "".equals(str.trim()) || "null".equals(str.trim()) || "undefinded".equals(str.trim());
} }
/** /**
* 对象null * 对象null
* *
...@@ -49,7 +52,7 @@ public class Common { ...@@ -49,7 +52,7 @@ public class Common {
} }
public static boolean isNotNull(String obj) { public static boolean isNotNull(String obj) {
if (null != obj && !"".equals(obj) && !"undefined".equals(obj)){ if (null != obj && !"".equals(obj) && !"undefined".equals(obj)) {
return true; return true;
} }
return false; return false;
...@@ -62,33 +65,37 @@ public class Common { ...@@ -62,33 +65,37 @@ public class Common {
Matcher match = pattern.matcher(str); Matcher match = pattern.matcher(str);
return match.matches() != false; return match.matches() != false;
} }
/** /**
* 允许上传的文件类型 * 允许上传的文件类型
*
* @Author pwang * @Author pwang
* @Date 2020-01-07 15:52 * @Date 2020-01-07 15:52
* @param null * @param null
* @return * @return
**/ **/
private static final String suffixList = "gif|jpg|jpeg|png|bmp|xls|xlsx|csv|pdf|docx|doc|m4a|mp3|zip|rar|txt"; private static final String suffixList = "gif|jpg|jpeg|png|bmp|xls|xlsx|csv|pdf|docx|doc|m4a|mp3|zip|rar|txt";
/** /**
* 判断是否为允许的上传文件类型,true表示允许 * 判断是否为允许的上传文件类型,true表示允许
*/ */
public static boolean checkFile(String fileName) { public static boolean checkFile(String fileName) {
// 获取文件后缀 // 获取文件后缀
String suffix = getSuffix(fileName); String suffix = getSuffix(fileName);
if(null != suffix){ if (null != suffix) {
if (suffixList.contains(suffix.trim().toLowerCase())) { if (suffixList.contains(suffix.trim().toLowerCase())) {
return true; return true;
} }
} }
return false; return false;
} }
/** /**
* 判断是否为允许的上传文件类型,true表示允许 * 判断是否为允许的上传文件类型,true表示允许
*/ */
public static String getSuffix(String fileName) { public static String getSuffix(String fileName) {
if(isEmpty(fileName) || fileName.lastIndexOf(CommonConstants.SPOT_CHAR) < 0 ){ if (isEmpty(fileName) || fileName.lastIndexOf(CommonConstants.SPOT_CHAR) < 0) {
return null; return null;
} }
// 获取文件后缀 // 获取文件后缀
...@@ -161,9 +168,58 @@ public class Common { ...@@ -161,9 +168,58 @@ public class Common {
public static List<String> getList(String ids) { public static List<String> getList(String ids) {
List<String> idList = null; List<String> idList = null;
if (Common.isNotNull(ids)){ if (Common.isNotNull(ids)) {
idList = Common.initStrToList(ids, CommonConstants.COMMA_STRING); idList = Common.initStrToList(ids, CommonConstants.COMMA_STRING);
} }
return idList; return idList;
} }
/**
* 对象转string
*
* @param param
* @return
*/
public static String getStringValByObject(Object param) {
if (null == param) {
return null;
} else if (param instanceof Integer) {
return Integer.toString(((Integer) param).intValue());
} else if (param instanceof String) {
return (String) param;
} else if (param instanceof Double) {
return Double.toString(((Double) param).doubleValue());
} else if (param instanceof Float) {
return Float.toString(((Float) param).floatValue());
} else if (param instanceof Long) {
return Long.toString(((Long) param).longValue());
} else if (param instanceof Boolean) {
return Boolean.toString(((Boolean) param).booleanValue());
} else if (param instanceof Date) {
return DateUtil.formatDate((Date) param);
} else {
return param.toString();
}
}
/**
* 根据属性名获取属性值
*
* @param fieldName
* @param o
* @return
*/
public static Object getFieldValueByName(String fieldName, Object o) {
try {
String firstLetter = fieldName.substring(0, 1).toUpperCase();
String getter = "get" + firstLetter + fieldName.substring(1);
Method method = o.getClass().getMethod(getter);
Object value = method.invoke(o);
return value;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
} }
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ValidityConstants;
import java.lang.reflect.Field;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ExcelAttributeValidityUtil<T> {
private Class<T> clazz;
/**
* 用于返回错误信息
*/
private List<ErrorMessage> errorInfo;
public ExcelAttributeValidityUtil(Class<T> clazz) {
this.clazz = clazz;
}
public void ValidityObj(T obj) {
List<ErrorMessage> errorList = new ArrayList<>();
// 得到类的所有field
Field[] allFields = clazz.getDeclaredFields();
// 定义一个map用于存放列的序号和field
Map<Integer, Field> fieldsMap = new HashMap<>();
for (int i = 0, index = 0; i < allFields.length; i++) {
Field field = allFields[i];
// 将有注解的field存放到map中
if (field.isAnnotationPresent(ExcelAttribute.class)) {
// 设置类的私有字段属性可访问
field.setAccessible(true);
fieldsMap.put(index, field);
index++;
}
}
String error = "";
String val = null;
try {
for (int j = 0; j < fieldsMap.size(); j++) {
// 从map中得到对应列的field
Field field = fieldsMap.get(j);
//获取属性对应的注解属性
ExcelAttribute attr = field.getAnnotation(ExcelAttribute.class);
val = Common.getStringValByObject(Common.getFieldValueByName(field.getName(), obj));
//校验字段是否符合要求
error = ValidityFiled(val, attr);
if (null != error) {
errorList.add(new ErrorMessage(-1, error));
}
}
} catch (Exception e) {
errorList.add(new ErrorMessage(-1, e.getMessage()));
}
this.setErrorInfo(errorList);
}
private String ValidityFiled(String c, ExcelAttribute attr) {
//非空校验
if (attr.isNotEmpty() && Common.isEmpty(c)) {
return (attr.name() + "_字段不可为空");
}
if (Common.isNotNull(c) && Common.isNotNull(c.trim())) {
//日期格式校验
if (attr.isDate()) {
try {
DateUtil.parseDate(c.trim(), attr.dateFormat());
} catch (ParseException e) {
return (Common.isEmpty(attr.errorInfo()) ? attr.name() + "_日期格式错误:" + attr.dateFormat() : attr.errorInfo());
}
}
//手机号码校验
if (attr.isPhone()) {
if (!c.matches(Common.isEmpty(attr.pattern()) ? ValidityConstants.MOBILE_PATTERN : attr.pattern())) {
return (Common.isEmpty(attr.errorInfo()) ? attr.name() + "_手机号码有误" : attr.errorInfo());
}
}
//身份证校验
if (attr.isIdCard()) {
if (!c.matches(Common.isEmpty(attr.pattern()) ? ValidityConstants.IDCARD_PATTERN : attr.pattern())) {
return (attr.name() + "_身份证格式有误");
}
}
//邮箱验证
if (attr.isEmail()) {
if (!c.matches(Common.isEmpty(attr.pattern()) ? ValidityConstants.EMAIL_PATTERN : attr.pattern())) {
return (Common.isEmpty(attr.errorInfo()) ? attr.name() + "_邮箱格式有误" : attr.errorInfo());
}
}
//integer 验证
if (attr.isInteger()) {
if (!c.matches(Common.isEmpty(attr.pattern()) ? ValidityConstants.INTEGER_PATTERN : attr.pattern())) {
return (Common.isEmpty(attr.errorInfo()) ? attr.name() + "_整数格式有误" : attr.errorInfo());
}
}
//float、double 验证
if (attr.isFloat()) {
if (!c.matches(Common.isEmpty(attr.pattern()) ? ValidityConstants.FLOAT_PATTERN : attr.pattern())) {
return (Common.isEmpty(attr.errorInfo()) ? attr.name() + "_数字格式有误" : attr.errorInfo());
}
}
}
return null;
}
public List<ErrorMessage> getErrorInfo() {
return errorInfo;
}
public void setErrorInfo(List<ErrorMessage> errorInfo) {
this.errorInfo = errorInfo;
}
}
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