|
|
@@ -1,11 +1,14 @@
|
|
|
package platform.modules.government.web;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -13,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
import platform.common.Constant;
|
|
|
import platform.common.annotation.OperationLog;
|
|
|
import platform.common.base.controller.BaseController;
|
|
|
@@ -22,6 +26,8 @@ import platform.common.base.model.Template;
|
|
|
import platform.common.base.service.DictionaryItemService;
|
|
|
import platform.common.base.service.DictionaryTypeService;
|
|
|
import platform.common.base.service.TemplateService;
|
|
|
+import platform.common.util.ReadExcelUtil;
|
|
|
+import platform.common.util.holiday.HolidayExcelParser;
|
|
|
import platform.modules.build.entity.BuildInfo;
|
|
|
import platform.modules.build.service.BuildInfoService;
|
|
|
import platform.modules.build.service.CompanyService;
|
|
|
@@ -34,9 +40,13 @@ import platform.modules.government.service.AttachmentService;
|
|
|
import platform.modules.government.service.BuildTypeService;
|
|
|
import platform.modules.government.service.StreetService;
|
|
|
import platform.modules.government.service.UserService;
|
|
|
+import platform.modules.sys.entity.SysConfig;
|
|
|
+import platform.modules.sys.service.SysConfigService;
|
|
|
import platform.modules.sys.web.ResponseMessage;
|
|
|
import tk.mybatis.mapper.entity.Example;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
@Controller
|
|
|
@RequestMapping(value = "/super")
|
|
|
public class SupermeController extends BaseController {
|
|
|
@@ -67,6 +77,9 @@ public class SupermeController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private AttachmentService attachmentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
|
|
@GetMapping(value = "")
|
|
|
public String list() {
|
|
|
@@ -1004,4 +1017,98 @@ public class SupermeController extends BaseController {
|
|
|
return BASE_SUPER_PATH + "industry/industry_file_list";
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 假日信息管理列表展示
|
|
|
+ *
|
|
|
+ * @param pageNum
|
|
|
+ * @param modelMap
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/holidayList")
|
|
|
+ public String holidayList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
+ ModelMap modelMap) throws Exception {
|
|
|
+
|
|
|
+ PageInfo<SysConfig> pageInfo = sysConfigService.findPage(pageNum, PAGESIZE,"year_");
|
|
|
+ modelMap.put("pageInfo", pageInfo);
|
|
|
+ modelMap.put("fileUrl", setFileUrl());
|
|
|
+ return BASE_SUPER_PATH + "holiday/holiday_list";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加假日信息
|
|
|
+ * @param pageNum
|
|
|
+ * @param modelMap
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/holiday/add")
|
|
|
+ public String addHolidayPage(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,ModelMap modelMap) {
|
|
|
+ return BASE_SUPER_PATH + "holiday/holiday_add";
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改相应假日信息
|
|
|
+ * @param pageNum
|
|
|
+ * @param modelMap
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/holiday/edit/{id}")
|
|
|
+ public String editHolidayPage(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
+ @PathVariable("id") Integer id,ModelMap modelMap) {
|
|
|
+ SysConfig holidayInfo = sysConfigService.findById(id);
|
|
|
+
|
|
|
+ modelMap.put("id", holidayInfo.getId());
|
|
|
+ modelMap.put("configName", holidayInfo.getConfigName());
|
|
|
+ modelMap.put("configKey", holidayInfo.getConfigKey());
|
|
|
+ modelMap.put("configValue", holidayInfo.getConfigValue());
|
|
|
+
|
|
|
+ modelMap.put("fileUrl", setFileUrl());
|
|
|
+ return BASE_SUPER_PATH + "holiday/holiday_add";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @OperationLog(value = "节假日信息删除")
|
|
|
+ @ResponseBody
|
|
|
+ @DeleteMapping(value = "/holiday/delete/{id}")
|
|
|
+ public ResponseMessage deleteHoliday(@PathVariable("id") int id,ModelMap modelMap) {
|
|
|
+ SysConfig ent2Del = sysConfigService.findById(id);
|
|
|
+ if (null == ent2Del) {
|
|
|
+ return ResponseMessage.error("未找到相应的假日信息");
|
|
|
+ }
|
|
|
+ ent2Del.setDel_flag(true);
|
|
|
+ sysConfigService.update(ent2Del);
|
|
|
+
|
|
|
+ return ResponseMessage.success("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping(value = "/holiday/import")
|
|
|
+ public ResponseEntity<String> importHoliday(HttpServletRequest request, @RequestParam("file") MultipartFile file) throws IOException {
|
|
|
+
|
|
|
+ if (file.isEmpty()) {
|
|
|
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("文件不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ArrayList<String>> readExcel = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ //调用util方法拿到解析的数据集合
|
|
|
+ readExcel = new ReadExcelUtil().readExcel(file);
|
|
|
+
|
|
|
+ // 进一步解析
|
|
|
+
|
|
|
+ String retInfo = HolidayExcelParser.parse(readExcel);
|
|
|
+
|
|
|
+ //int a = 0;
|
|
|
+
|
|
|
+ } catch (IOException e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return ResponseEntity.status(HttpStatus.OK).body("OK");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|