Browse Source

李剑-假日信息维护-导入假日数据模板丢失后服务的抛异常问题解决。

lijian 4 years ago
parent
commit
1b4c366745

+ 11 - 1
src/main/java/platform/common/util/holiday/HolidayExcelTemplateUtil.java

@@ -6,7 +6,6 @@ import platform.common.Constant;
 import platform.common.base.model.Template;
 import platform.common.base.service.TemplateService;
 import platform.modules.government.entity.Attachment;
-import platform.modules.government.entity.FileDown;
 import platform.modules.government.service.AttachmentService;
 
 import java.util.HashMap;
@@ -30,6 +29,11 @@ public class HolidayExcelTemplateUtil {
         try {
             int id = this.loadTemalateId();
 
+            if(-1 == id)
+            {
+                return ret;
+            }
+
             List<Attachment> attachments = attachmentService.selectByIdAndBusinessId(Constant.Attachment.TEMPLATE, id, null);
             if (null != attachments && attachments.size()>0) {
                 ret.put("templateFileUrl",attachments.get(0).getFile_url());
@@ -48,6 +52,12 @@ public class HolidayExcelTemplateUtil {
         entCondition.setName(HOLIDAY_IMPORT_XLS_TEMPLATE_NAME);
         Template entRet;
         entRet = templateService.findOne(entCondition);
+
+        if(null == entRet)
+        {
+            return -1;
+        }
+
         return entRet.getId();
     }
 

+ 6 - 4
src/main/java/platform/modules/government/web/SupermeController.java

@@ -1055,8 +1055,9 @@ public class SupermeController extends BaseController {
 	public String addHolidayPage(ModelMap modelMap) {
 
 		Map<String,String> mapTemplateFileInfo = holidayExcelTemplateUtil.getTemplateFileInfo();
-		modelMap.put("templateFileUrl",mapTemplateFileInfo.get("templateFileUrl"));
-		modelMap.put("templateFileName",mapTemplateFileInfo.get("templateFileName"));
+		//modelMap.put("templateFileUrl",mapTemplateFileInfo.get("templateFileUrl"));
+		//modelMap.put("templateFileName",mapTemplateFileInfo.get("templateFileName"));
+		modelMap.putAll(mapTemplateFileInfo);
 		modelMap.put("fileUrl", setFileUrl());
 		return BASE_SUPER_PATH + "holiday/holiday_add";
 	}
@@ -1078,8 +1079,9 @@ public class SupermeController extends BaseController {
 
 
 		Map<String,String> mapTemplateFileInfo = holidayExcelTemplateUtil.getTemplateFileInfo();
-		modelMap.put("templateFileUrl",mapTemplateFileInfo.get("templateFileUrl"));
-		modelMap.put("templateFileName",mapTemplateFileInfo.get("templateFileName"));
+		//modelMap.put("templateFileUrl",mapTemplateFileInfo.get("templateFileUrl"));
+		//modelMap.put("templateFileName",mapTemplateFileInfo.get("templateFileName"));
+		modelMap.putAll(mapTemplateFileInfo);
 		modelMap.put("fileUrl", setFileUrl());
 		return BASE_SUPER_PATH + "holiday/holiday_add";
 	}