feat: 手动翻译企标计划详情页的字典值
This commit is contained in:
+15
@@ -71,10 +71,14 @@ public class EnterpriseStandardPlan implements Serializable {
|
||||
@Dict(dicCode = "esp_application_category")
|
||||
@ApiModelProperty(value = "申请类别")
|
||||
private String applicationCategory;
|
||||
@TableField(exist = false)
|
||||
private String applicationCategory_dictText;
|
||||
|
||||
@Dict(dicCode = "esp_project_type")
|
||||
@ApiModelProperty(value = "项目类型")
|
||||
private String projectType;
|
||||
@TableField(exist = false)
|
||||
private String projectType_dictText;;
|
||||
|
||||
@ApiModelProperty(value = "原企标编号")
|
||||
private String originEnStandardNo;
|
||||
@@ -109,6 +113,8 @@ public class EnterpriseStandardPlan implements Serializable {
|
||||
@Dict(dicCode = "esp_standard_type")
|
||||
@ApiModelProperty(value = "标准类型")
|
||||
private String standardType;
|
||||
@TableField(exist = false)
|
||||
private String standardType_dictText;
|
||||
|
||||
@ApiModelProperty(value = "企标等级分类")
|
||||
private String enStandardClassification;
|
||||
@@ -131,6 +137,8 @@ public class EnterpriseStandardPlan implements Serializable {
|
||||
@Dict(dicCode = "esp_project_status")
|
||||
@ApiModelProperty(value = "项目状态")
|
||||
private String projectStatus;
|
||||
@TableField(exist = false)
|
||||
private String projectStatus_dictText;
|
||||
|
||||
@ApiModelProperty(value = "编制说明")
|
||||
private String compilationDescription;
|
||||
@@ -170,6 +178,8 @@ public class EnterpriseStandardPlan implements Serializable {
|
||||
@Dict(dicCode = "yn")
|
||||
@ApiModelProperty(value = "是否征求意见")
|
||||
private String solicitationOpinionEnabled;
|
||||
@TableField(exist = false)
|
||||
private String solicitationOpinionEnabled_dictText;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@@ -194,6 +204,8 @@ public class EnterpriseStandardPlan implements Serializable {
|
||||
@Dict(dicCode = "esp_change_status")
|
||||
@ApiModelProperty(value = "变更状态")
|
||||
private String changeStatus;
|
||||
@TableField(exist = false)
|
||||
private String changeStatus_dictText;
|
||||
|
||||
@ApiModelProperty(value = "立项背景、立项依据")
|
||||
private String projectBackground;
|
||||
@@ -223,4 +235,7 @@ public class EnterpriseStandardPlan implements Serializable {
|
||||
@Dict(dicCode = "yn")
|
||||
@ApiModelProperty(value = "是否为优质标准")
|
||||
private String qualityFlag;
|
||||
@TableField(exist = false)
|
||||
private String qualityFlag_dictText;
|
||||
|
||||
}
|
||||
|
||||
+51
-1
@@ -18,7 +18,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -32,6 +34,9 @@ import java.util.stream.Collectors;
|
||||
public class EnterpriseStandardPlanServiceImpl extends ServiceImpl<EnterpriseStandardPlanMapper, EnterpriseStandardPlan>
|
||||
implements EnterpriseStandardPlanService{
|
||||
|
||||
@Resource
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
@Resource
|
||||
private EnterpriseStandardPlanMapper esPlanMapper;
|
||||
|
||||
@@ -54,8 +59,53 @@ public class EnterpriseStandardPlanServiceImpl extends ServiceImpl<EnterpriseSta
|
||||
|
||||
@Override
|
||||
public EnterpriseStandardPlan getDetailById(String planId) {
|
||||
return esPlanMapper.getDetailById(planId);
|
||||
EnterpriseStandardPlan detail = esPlanMapper.getDetailById(planId);
|
||||
this.transDict(Collections.singletonList(detail));
|
||||
return detail;
|
||||
}
|
||||
|
||||
// 转换列表中的状态值为中文
|
||||
private void transDict(List<EnterpriseStandardPlan> list) {
|
||||
if (list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, DictModel> acDict = convertDictToMap(sysBaseAPI.getDictItems("esp_application_category"));
|
||||
Map<String, DictModel> ptDict = convertDictToMap(sysBaseAPI.getDictItems("esp_project_type"));
|
||||
Map<String, DictModel> stDict = convertDictToMap(sysBaseAPI.getDictItems("esp_standard_type"));
|
||||
Map<String, DictModel> psDict = convertDictToMap(sysBaseAPI.getDictItems("esp_project_status"));
|
||||
Map<String, DictModel> ynDict = convertDictToMap(sysBaseAPI.getDictItems("yn"));
|
||||
Map<String, DictModel> csDict = convertDictToMap(sysBaseAPI.getDictItems("esp_change_status"));
|
||||
|
||||
list.forEach(e -> {
|
||||
if (acDict.containsKey(e.getApplicationCategory())) {
|
||||
e.setApplicationCategory_dictText(acDict.get(e.getApplicationCategory()).getText());
|
||||
}
|
||||
if (ptDict.containsKey(e.getProjectType())) {
|
||||
e.setProjectType_dictText(ptDict.get(e.getProjectType()).getText());
|
||||
}
|
||||
if (stDict.containsKey(e.getStandardType())) {
|
||||
e.setStandardType_dictText(stDict.get(e.getStandardType()).getText());
|
||||
}
|
||||
if (psDict.containsKey(e.getProjectStatus())) {
|
||||
e.setProjectStatus_dictText(psDict.get(e.getProjectStatus()).getText());
|
||||
}
|
||||
if (ynDict.containsKey(e.getSolicitationOpinionEnabled())) {
|
||||
e.setSolicitationOpinionEnabled_dictText(ynDict.get(e.getSolicitationOpinionEnabled()).getText());
|
||||
}
|
||||
if (csDict.containsKey(e.getChangeStatus())) {
|
||||
e.setChangeStatus_dictText(csDict.get(e.getChangeStatus()).getText());
|
||||
}
|
||||
if (ynDict.containsKey(e.getQualityFlag())) {
|
||||
e.setQualityFlag_dictText(ynDict.get(e.getQualityFlag()).getText());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Map<String, DictModel> convertDictToMap(List<DictModel> dictModelList) {
|
||||
return dictModelList.stream().collect(Collectors.toMap(DictModel::getValue, dictModel -> dictModel));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user