|
|
@@ -3,6 +3,7 @@ package nckd.jxccl.swc.hsas.business.outdata;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.kingdee.util.DateTimeUtils;
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
import kd.bos.dataentity.resource.ResManager;
|
|
|
import kd.bos.dataentity.utils.StringUtils;
|
|
|
import kd.bos.exception.ErrorCode;
|
|
|
@@ -18,6 +19,7 @@ import nckd.jxccl.sit.hcsi.business.importtaskguide.utils.ImportTaskUtils;
|
|
|
import nckd.jxccl.sit.hcsi.common.constant.enums.DataTypeEnum;
|
|
|
import nckd.jxccl.sit.hcsi.common.constant.enums.SITShowType;
|
|
|
import nckd.jxccl.sit.hcsi.formplugin.web.tp.enums.SinsurPresetItemEnum;
|
|
|
+import nckd.jxccl.swc.constants.SwcConstant;
|
|
|
import nckd.jxccl.swc.hsas.business.utils.OutImportTaskUtils;
|
|
|
import nckd.jxccl.swc.hsas.common.OutImpPresetItem;
|
|
|
import nckd.jxccl.swc.hsas.formplugin.web.outdata.helper.OutImpTemplateHelper;
|
|
|
@@ -133,7 +135,7 @@ public class OutImportTaskGuideExportService {
|
|
|
if (Long.parseLong(dataTypeIdStr) == DataTypeEnum.STRING.getDbId()) {
|
|
|
textIndexList.add(columnIndex);
|
|
|
}
|
|
|
- if ("0".equals(itemType)) {
|
|
|
+ if ("0".equals(itemType) && itemEnumMap.get(Long.valueOf((String) columnHead.get("id"))) != null) {
|
|
|
presetItemEnum = (OutImpPresetItem) itemEnumMap.get(Long.valueOf((String) columnHead.get("id")));
|
|
|
CellStyle style = this.getFixCellStyle(presetItemEnum, requrriedStyle, headDateStyle, headTextStyle, headRequriedNumStyle);
|
|
|
this.createCell(comment, headRow, columnIndex, presetItemEnum.getItemName(), true, style, this.getDataType(presetItemEnum), drawingPatriarch);
|
|
|
@@ -151,7 +153,7 @@ public class OutImportTaskGuideExportService {
|
|
|
}
|
|
|
|
|
|
// 添加数据验证(下拉列表)
|
|
|
- // TODO this.addDataValidations(sheet, columnHeadList, startLine - 1);
|
|
|
+ this.addDataValidations(sheet, columnHeadList, startLine - 1);
|
|
|
|
|
|
this.batchSetDefaulColumnStyle(sheet, textIndexList, this.getTextCellStyle(sheet));
|
|
|
}
|
|
|
@@ -180,16 +182,30 @@ public class OutImportTaskGuideExportService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 判断是否有下拉项 【nckd_outimportitem】
|
|
|
+ * @param presetItem
|
|
|
+ * @return
|
|
|
+ */
|
|
|
private boolean hasDropdownOptions(OutImpPresetItem presetItem) {
|
|
|
- // 根据实际业务逻辑判断是否需要下拉列表
|
|
|
- // 这里需要根据你的业务需求实现
|
|
|
- return true;
|
|
|
+ Long itemId = presetItem.getItemId();
|
|
|
+ DynamicObject item = SwcConstant.OUTIMPORTITEM_ENTITY.loadOne(itemId);
|
|
|
+ DynamicObjectCollection entryCols = item.getDynamicObjectCollection("nckd_entryentity");
|
|
|
+ if(entryCols.size() > 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private String[] getDropdownOptions(OutImpPresetItem presetItem) {
|
|
|
- // 获取下拉选项数组
|
|
|
- // 这里需要根据你的业务需求实现
|
|
|
- return new String[]{"选项1", "选项2", "选项3"};
|
|
|
+ Long itemId = presetItem.getItemId();
|
|
|
+ DynamicObject item = SwcConstant.OUTIMPORTITEM_ENTITY.loadOne(itemId);
|
|
|
+ DynamicObjectCollection entryCols = item.getDynamicObjectCollection("nckd_entryentity");
|
|
|
+ return entryCols.stream()
|
|
|
+ .map(entry -> entry.getString("nckd_validation"))
|
|
|
+ .toArray(String[]::new);
|
|
|
}
|
|
|
|
|
|
private void setDataValidation(SXSSFSheet sheet, String[] options, int columnIndex, int firstDataRowIndex) {
|