Commit 0290b504 authored by hongguangwu's avatar hongguangwu

1.7.21-法大大试用期默认值

parent c4d31c10
...@@ -84,5 +84,12 @@ public class TFascHrField { ...@@ -84,5 +84,12 @@ public class TFascHrField {
@ExcelProperty("字段格式化或键值对") @ExcelProperty("字段格式化或键值对")
@Schema(description = "字段格式化或键值对") @Schema(description = "字段格式化或键值对")
private String fieldValue; private String fieldValue;
/**
* 字段空值时的默认值
*/
@ExcelAttribute(name = "字段空值时的默认值", maxLength = 2)
@Length(max = 2, message = "字段空值时的默认值不能超过2个字符")
@Schema(description = "字段空值时的默认值")
private String fieldDefaultValue;
} }
...@@ -153,6 +153,12 @@ public class TFascTemplateDetail extends BaseEntity { ...@@ -153,6 +153,12 @@ public class TFascTemplateDetail extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
@Schema(description = "字段格式化或键值对") @Schema(description = "字段格式化或键值对")
private String fieldValue; private String fieldValue;
/**
* 字段空值时的默认值
*/
@TableField(exist = false)
@Schema(description = "字段空值时的默认值")
private String fieldDefaultValue;
/** /**
* 公司主体Id * 公司主体Id
*/ */
......
...@@ -693,18 +693,22 @@ public class FascUtil { ...@@ -693,18 +693,22 @@ public class FascUtil {
// 针对一个模板,三种类型,有的要开始时间,有的不要,这里做区分: // 针对一个模板,三种类型,有的要开始时间,有的不要,这里做区分:
if (fieldNameChinese.contains("无固定-")) { if (fieldNameChinese.contains("无固定-")) {
if (CommonConstants.TWO_STRING.equals(contract.getContractTerm())) { if (CommonConstants.TWO_STRING.equals(contract.getContractTerm())) {
fieldValue = this.getContractFieldValueByReflection(contract, fieldName, detail.getFieldType(), detail.getFieldValue()); fieldValue = this.getContractFieldValueByReflection(contract, fieldName
, detail.getFieldType(), detail.getFieldValue(), detail.getFieldDefaultValue());
} }
} else if (fieldNameChinese.contains("固定-")) { } else if (fieldNameChinese.contains("固定-")) {
if (CommonConstants.ONE_STRING.equals(contract.getContractTerm())) { if (CommonConstants.ONE_STRING.equals(contract.getContractTerm())) {
fieldValue = this.getContractFieldValueByReflection(contract, fieldName, detail.getFieldType(), detail.getFieldValue()); fieldValue = this.getContractFieldValueByReflection(contract, fieldName
, detail.getFieldType(), detail.getFieldValue(), detail.getFieldDefaultValue());
} }
} else if (fieldNameChinese.contains("完成任务-")) { } else if (fieldNameChinese.contains("完成任务-")) {
if (CommonConstants.ZERO_STRING.equals(contract.getContractTerm())) { if (CommonConstants.ZERO_STRING.equals(contract.getContractTerm())) {
fieldValue = this.getContractFieldValueByReflection(contract, fieldName, detail.getFieldType(), detail.getFieldValue()); fieldValue = this.getContractFieldValueByReflection(contract, fieldName
, detail.getFieldType(), detail.getFieldValue(), detail.getFieldDefaultValue());
} }
} else { } else {
fieldValue = this.getContractFieldValueByReflection(contract, fieldName, detail.getFieldType(), detail.getFieldValue()); fieldValue = this.getContractFieldValueByReflection(contract, fieldName
, detail.getFieldType(), detail.getFieldValue(), detail.getFieldDefaultValue());
} }
} }
} }
...@@ -787,18 +791,22 @@ public class FascUtil { ...@@ -787,18 +791,22 @@ public class FascUtil {
// 针对一个模板,三种类型,有的要开始时间,有的不要,这里做区分: // 针对一个模板,三种类型,有的要开始时间,有的不要,这里做区分:
if (fieldNameChinese.contains("无固定-")) { if (fieldNameChinese.contains("无固定-")) {
if (CommonConstants.TWO_STRING.equals(contract.getContractTerm())) { if (CommonConstants.TWO_STRING.equals(contract.getContractTerm())) {
fieldValue = this.getContractFieldValueByReflection(contract, fieldName, detail.getFieldType(), detail.getFieldValue()); fieldValue = this.getContractFieldValueByReflection(contract, fieldName
, detail.getFieldType(), detail.getFieldValue(), detail.getFieldDefaultValue());
} }
} else if (fieldNameChinese.contains("固定-")) { } else if (fieldNameChinese.contains("固定-")) {
if (CommonConstants.ONE_STRING.equals(contract.getContractTerm())) { if (CommonConstants.ONE_STRING.equals(contract.getContractTerm())) {
fieldValue = this.getContractFieldValueByReflection(contract, fieldName, detail.getFieldType(), detail.getFieldValue()); fieldValue = this.getContractFieldValueByReflection(contract, fieldName
, detail.getFieldType(), detail.getFieldValue(), detail.getFieldDefaultValue());
} }
} else if (fieldNameChinese.contains("完成任务-")) { } else if (fieldNameChinese.contains("完成任务-")) {
if (CommonConstants.ZERO_STRING.equals(contract.getContractTerm())) { if (CommonConstants.ZERO_STRING.equals(contract.getContractTerm())) {
fieldValue = this.getContractFieldValueByReflection(contract, fieldName, detail.getFieldType(), detail.getFieldValue()); fieldValue = this.getContractFieldValueByReflection(contract, fieldName
, detail.getFieldType(), detail.getFieldValue(), detail.getFieldDefaultValue());
} }
} else { } else {
fieldValue = this.getContractFieldValueByReflection(contract, fieldName, detail.getFieldType(), detail.getFieldValue()); fieldValue = this.getContractFieldValueByReflection(contract, fieldName
, detail.getFieldType(), detail.getFieldValue(), detail.getFieldDefaultValue());
} }
} }
} }
...@@ -828,7 +836,8 @@ public class FascUtil { ...@@ -828,7 +836,8 @@ public class FascUtil {
* @param fieldName 字段名 * @param fieldName 字段名
* @return 字段值 * @return 字段值
*/ */
private String getContractFieldValueByReflection(TEmployeeContractPre contract, String fieldName, String fieldType, String fieldValue) { private String getContractFieldValueByReflection(TEmployeeContractPre contract, String fieldName, String fieldType
, String fieldValue, String fieldDefaultValue) {
if (contract == null || fieldName == null) { if (contract == null || fieldName == null) {
return null; return null;
} }
...@@ -841,7 +850,7 @@ public class FascUtil { ...@@ -841,7 +850,7 @@ public class FascUtil {
java.lang.reflect.Method method = contract.getClass().getMethod(getterMethodName); java.lang.reflect.Method method = contract.getClass().getMethod(getterMethodName);
Object value = method.invoke(contract); Object value = method.invoke(contract);
String valueStr = String.valueOf(value); String valueStr = String.valueOf(value);
valueStr = this.getCoverValue(valueStr, fieldType, fieldValue); valueStr = this.getCoverValue(valueStr, fieldType, fieldValue, fieldDefaultValue);
return valueStr; return valueStr;
} catch (Exception e) { } catch (Exception e) {
// 如果找不到对应的方法,尝试直接匹配字段名 // 如果找不到对应的方法,尝试直接匹配字段名
...@@ -855,7 +864,8 @@ public class FascUtil { ...@@ -855,7 +864,8 @@ public class FascUtil {
} }
} }
} }
private String getContractFieldValueByReflection(TEmployeeContractPreNew contract, String fieldName, String fieldType, String fieldValue) { private String getContractFieldValueByReflection(TEmployeeContractPreNew contract, String fieldName, String fieldType
, String fieldValue, String fieldDefaultValue) {
if (contract == null || fieldName == null) { if (contract == null || fieldName == null) {
return null; return null;
} }
...@@ -868,7 +878,7 @@ public class FascUtil { ...@@ -868,7 +878,7 @@ public class FascUtil {
java.lang.reflect.Method method = contract.getClass().getMethod(getterMethodName); java.lang.reflect.Method method = contract.getClass().getMethod(getterMethodName);
Object value = method.invoke(contract); Object value = method.invoke(contract);
String valueStr = String.valueOf(value); String valueStr = String.valueOf(value);
valueStr = this.getCoverValue(valueStr, fieldType, fieldValue); valueStr = this.getCoverValue(valueStr, fieldType, fieldValue, fieldDefaultValue);
return valueStr; return valueStr;
} catch (Exception e) { } catch (Exception e) {
// 如果找不到对应的方法,尝试直接匹配字段名 // 如果找不到对应的方法,尝试直接匹配字段名
...@@ -883,13 +893,15 @@ public class FascUtil { ...@@ -883,13 +893,15 @@ public class FascUtil {
} }
} }
// 翻译字典 // 翻译字典
private String getCoverValue(String valueStr, String fieldType, String fieldValue) { private String getCoverValue(String valueStr, String fieldType, String fieldValue, String fieldDefailtValue) {
if (Common.isNotNull(valueStr) && (Common.isNotNull(fieldType))) { if (Common.isNotNull(valueStr) && Common.isNotNull(fieldType)) {
if (DATA_COVER.equals(fieldType)) { if (DATA_COVER.equals(fieldType)) {
valueStr = convertByExp(fieldValue, valueStr); valueStr = convertByExp(fieldValue, valueStr);
} else if (DATE_FORMAT.equals(fieldType)) { } else if (DATE_FORMAT.equals(fieldType)) {
valueStr = formatStringDate(fieldValue, valueStr); valueStr = formatStringDate(fieldValue, valueStr);
} }
} else if (Common.isNotNull(fieldDefailtValue)) {
valueStr = fieldDefailtValue;
} }
return valueStr; return valueStr;
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
<result property="contractType" column="contract_type"/> <result property="contractType" column="contract_type"/>
<result property="fieldType" column="field_type"/> <result property="fieldType" column="field_type"/>
<result property="fieldValue" column="field_value"/> <result property="fieldValue" column="field_value"/>
<result property="fieldDefaultValue" column="field_default_value"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.id, a.id,
...@@ -37,7 +38,8 @@ ...@@ -37,7 +38,8 @@
a.hr_field_id, a.hr_field_id,
a.contract_type, a.contract_type,
a.field_type, a.field_type,
a.field_value a.field_value,
a.field_default_value
</sql> </sql>
<sql id="tFascHrField_where"> <sql id="tFascHrField_where">
<if test="tFascHrField != null"> <if test="tFascHrField != null">
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<result property="fascDocId" column="fasc_doc_id"/> <result property="fascDocId" column="fasc_doc_id"/>
<result property="fieldType" column="field_type"/> <result property="fieldType" column="field_type"/>
<result property="fieldValue" column="field_value"/> <result property="fieldValue" column="field_value"/>
<result property="fieldDefaultValue" column="field_default_value"/>
</resultMap> </resultMap>
<resultMap id="tFascTemplateDetailExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TFascTemplateDetailExportVo"> <resultMap id="tFascTemplateDetailExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TFascTemplateDetailExportVo">
...@@ -174,7 +175,7 @@ ...@@ -174,7 +175,7 @@
a.hr_field, a.hr_field,
a.hr_field_id, a.hr_field_id,
a.is_edit, a.is_edit,
h.field_type,h.field_value h.field_type,h.field_value,h.field_default_value
FROM t_fasc_template_detail a FROM t_fasc_template_detail a
left join t_fasc_template b on a.sign_template_id = b.sign_template_id left join t_fasc_template b on a.sign_template_id = b.sign_template_id
left join t_fasc_hr_field h on h.hr_field_id = a.hr_field_id and h.hr_field = a.hr_field left join t_fasc_hr_field h on h.hr_field_id = a.hr_field_id and h.hr_field = a.hr_field
......
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