Commit 7b747ef8 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.7.21' into MVP1.7.21

parents d40accdb ca4c8dd6
......@@ -84,5 +84,12 @@ public class TFascHrField {
@ExcelProperty("字段格式化或键值对")
@Schema(description = "字段格式化或键值对")
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 {
@TableField(exist = false)
@Schema(description = "字段格式化或键值对")
private String fieldValue;
/**
* 字段空值时的默认值
*/
@TableField(exist = false)
@Schema(description = "字段空值时的默认值")
private String fieldDefaultValue;
/**
* 公司主体Id
*/
......
......@@ -693,18 +693,22 @@ public class FascUtil {
// 针对一个模板,三种类型,有的要开始时间,有的不要,这里做区分:
if (fieldNameChinese.contains("无固定-")) {
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("固定-")) {
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("完成任务-")) {
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 {
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 {
// 针对一个模板,三种类型,有的要开始时间,有的不要,这里做区分:
if (fieldNameChinese.contains("无固定-")) {
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("固定-")) {
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("完成任务-")) {
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 {
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 {
* @param fieldName 字段名
* @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) {
return null;
}
......@@ -841,7 +850,7 @@ public class FascUtil {
java.lang.reflect.Method method = contract.getClass().getMethod(getterMethodName);
Object value = method.invoke(contract);
String valueStr = String.valueOf(value);
valueStr = this.getCoverValue(valueStr, fieldType, fieldValue);
valueStr = this.getCoverValue(valueStr, fieldType, fieldValue, fieldDefaultValue);
return valueStr;
} catch (Exception e) {
// 如果找不到对应的方法,尝试直接匹配字段名
......@@ -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) {
return null;
}
......@@ -868,7 +878,7 @@ public class FascUtil {
java.lang.reflect.Method method = contract.getClass().getMethod(getterMethodName);
Object value = method.invoke(contract);
String valueStr = String.valueOf(value);
valueStr = this.getCoverValue(valueStr, fieldType, fieldValue);
valueStr = this.getCoverValue(valueStr, fieldType, fieldValue, fieldDefaultValue);
return valueStr;
} catch (Exception e) {
// 如果找不到对应的方法,尝试直接匹配字段名
......@@ -883,13 +893,15 @@ public class FascUtil {
}
}
// 翻译字典
private String getCoverValue(String valueStr, String fieldType, String fieldValue) {
if (Common.isNotNull(valueStr) && (Common.isNotNull(fieldType))) {
private String getCoverValue(String valueStr, String fieldType, String fieldValue, String fieldDefailtValue) {
if (Common.isNotNull(valueStr) && Common.isNotNull(fieldType)) {
if (DATA_COVER.equals(fieldType)) {
valueStr = convertByExp(fieldValue, valueStr);
} else if (DATE_FORMAT.equals(fieldType)) {
valueStr = formatStringDate(fieldValue, valueStr);
}
} else if (Common.isNotNull(fieldDefailtValue)) {
valueStr = fieldDefailtValue;
}
return valueStr;
}
......
......@@ -30,6 +30,7 @@
<result property="contractType" column="contract_type"/>
<result property="fieldType" column="field_type"/>
<result property="fieldValue" column="field_value"/>
<result property="fieldDefaultValue" column="field_default_value"/>
</resultMap>
<sql id="Base_Column_List">
a.id,
......@@ -37,7 +38,8 @@
a.hr_field_id,
a.contract_type,
a.field_type,
a.field_value
a.field_value,
a.field_default_value
</sql>
<sql id="tFascHrField_where">
<if test="tFascHrField != null">
......
......@@ -44,6 +44,7 @@
<result property="fascDocId" column="fasc_doc_id"/>
<result property="fieldType" column="field_type"/>
<result property="fieldValue" column="field_value"/>
<result property="fieldDefaultValue" column="field_default_value"/>
</resultMap>
<resultMap id="tFascTemplateDetailExportMap" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TFascTemplateDetailExportVo">
......@@ -174,7 +175,7 @@
a.hr_field,
a.hr_field_id,
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
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
......
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