Commit 53d410896a37d1af3d3e4062fb3850ce6f09930c
1 parent
c1ea85fe
1.图片导出报错,本地upload情况下,ImageBasePath未设置
2.重复check接口,sql注入检查 3.导入excel校验示例代码 4.文档地址写错了
Showing
4 changed files
with
49 additions
and
37 deletions
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml
@@ -196,7 +196,7 @@ | @@ -196,7 +196,7 @@ | ||
196 | </dependency> | 196 | </dependency> |
197 | 197 | ||
198 | <!-- 代码生成器 --> | 198 | <!-- 代码生成器 --> |
199 | - <!-- 如下载失败,请参考此文档 http://doc.jeecg.com/1273965 --> | 199 | + <!-- 如下载失败,请参考此文档 http://doc.jeecg.com/2043876 --> |
200 | <dependency> | 200 | <dependency> |
201 | <groupId>org.jeecgframework.boot</groupId> | 201 | <groupId>org.jeecgframework.boot</groupId> |
202 | <artifactId>codegenerate</artifactId> | 202 | <artifactId>codegenerate</artifactId> |
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/base/controller/JeecgController.java
@@ -15,6 +15,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams; | @@ -15,6 +15,7 @@ import org.jeecgframework.poi.excel.entity.ExportParams; | ||
15 | import org.jeecgframework.poi.excel.entity.ImportParams; | 15 | import org.jeecgframework.poi.excel.entity.ImportParams; |
16 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | 16 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
17 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
18 | +import org.springframework.beans.factory.annotation.Value; | ||
18 | import org.springframework.web.multipart.MultipartFile; | 19 | import org.springframework.web.multipart.MultipartFile; |
19 | import org.springframework.web.multipart.MultipartHttpServletRequest; | 20 | import org.springframework.web.multipart.MultipartHttpServletRequest; |
20 | import org.springframework.web.servlet.ModelAndView; | 21 | import org.springframework.web.servlet.ModelAndView; |
@@ -38,6 +39,8 @@ public class JeecgController<T, S extends IService<T>> { | @@ -38,6 +39,8 @@ public class JeecgController<T, S extends IService<T>> { | ||
38 | @Autowired | 39 | @Autowired |
39 | S service; | 40 | S service; |
40 | 41 | ||
42 | + @Value("${jeecg.path.upload}") | ||
43 | + private String upLoadPath; | ||
41 | /** | 44 | /** |
42 | * 导出excel | 45 | * 导出excel |
43 | * | 46 | * |
@@ -65,7 +68,11 @@ public class JeecgController<T, S extends IService<T>> { | @@ -65,7 +68,11 @@ public class JeecgController<T, S extends IService<T>> { | ||
65 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); | 68 | ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); |
66 | mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下 | 69 | mv.addObject(NormalExcelConstants.FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下 |
67 | mv.addObject(NormalExcelConstants.CLASS, clazz); | 70 | mv.addObject(NormalExcelConstants.CLASS, clazz); |
68 | - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title)); | 71 | + //update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置-------------------- |
72 | + ExportParams exportParams=new ExportParams(title + "报表", "导出人:" + sysUser.getRealname(), title); | ||
73 | + exportParams.setImageBasePath(upLoadPath); | ||
74 | + //update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置---------------------- | ||
75 | + mv.addObject(NormalExcelConstants.PARAMS,exportParams); | ||
69 | mv.addObject(NormalExcelConstants.DATA_LIST, exportList); | 76 | mv.addObject(NormalExcelConstants.DATA_LIST, exportList); |
70 | return mv; | 77 | return mv; |
71 | } | 78 | } |
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/DuplicateCheckController.java
1 | package org.jeecg.modules.system.controller; | 1 | package org.jeecg.modules.system.controller; |
2 | 2 | ||
3 | -import javax.servlet.http.HttpServletRequest; | ||
4 | - | 3 | +import io.swagger.annotations.Api; |
4 | +import io.swagger.annotations.ApiOperation; | ||
5 | +import lombok.extern.slf4j.Slf4j; | ||
5 | import org.apache.commons.lang.StringUtils; | 6 | import org.apache.commons.lang.StringUtils; |
6 | import org.jeecg.common.api.vo.Result; | 7 | import org.jeecg.common.api.vo.Result; |
8 | +import org.jeecg.common.util.SqlInjectionUtil; | ||
7 | import org.jeecg.modules.system.mapper.SysDictMapper; | 9 | import org.jeecg.modules.system.mapper.SysDictMapper; |
8 | import org.jeecg.modules.system.model.DuplicateCheckVo; | 10 | import org.jeecg.modules.system.model.DuplicateCheckVo; |
9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -11,9 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -11,9 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
11 | import org.springframework.web.bind.annotation.RequestMethod; | 13 | import org.springframework.web.bind.annotation.RequestMethod; |
12 | import org.springframework.web.bind.annotation.RestController; | 14 | import org.springframework.web.bind.annotation.RestController; |
13 | 15 | ||
14 | -import io.swagger.annotations.Api; | ||
15 | -import io.swagger.annotations.ApiOperation; | ||
16 | -import lombok.extern.slf4j.Slf4j; | 16 | +import javax.servlet.http.HttpServletRequest; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * @Title: DuplicateCheckAction | 19 | * @Title: DuplicateCheckAction |
@@ -29,7 +29,7 @@ import lombok.extern.slf4j.Slf4j; | @@ -29,7 +29,7 @@ import lombok.extern.slf4j.Slf4j; | ||
29 | public class DuplicateCheckController { | 29 | public class DuplicateCheckController { |
30 | 30 | ||
31 | @Autowired | 31 | @Autowired |
32 | - SysDictMapper sysDictMapper; | 32 | + SysDictMapper sysDictMapper; |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * 校验数据是否在系统中是否存在 | 35 | * 校验数据是否在系统中是否存在 |
@@ -42,6 +42,10 @@ public class DuplicateCheckController { | @@ -42,6 +42,10 @@ public class DuplicateCheckController { | ||
42 | Long num = null; | 42 | Long num = null; |
43 | 43 | ||
44 | log.info("----duplicate check------:"+ duplicateCheckVo.toString()); | 44 | log.info("----duplicate check------:"+ duplicateCheckVo.toString()); |
45 | + //关联表字典(举例:sys_user,realname,id) | ||
46 | + //SQL注入校验(只限制非法串改数据库) | ||
47 | + final String[] sqlInjCheck = {duplicateCheckVo.getTableName(),duplicateCheckVo.getFieldName()}; | ||
48 | + SqlInjectionUtil.filterContent(sqlInjCheck); | ||
45 | if (StringUtils.isNotBlank(duplicateCheckVo.getDataId())) { | 49 | if (StringUtils.isNotBlank(duplicateCheckVo.getDataId())) { |
46 | // [2].编辑页面校验 | 50 | // [2].编辑页面校验 |
47 | num = sysDictMapper.duplicateCheckCountSql(duplicateCheckVo); | 51 | num = sysDictMapper.duplicateCheckCountSql(duplicateCheckVo); |
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDictController.java
@@ -26,11 +26,11 @@ import org.jeecg.modules.system.model.TreeSelectModel; | @@ -26,11 +26,11 @@ import org.jeecg.modules.system.model.TreeSelectModel; | ||
26 | import org.jeecg.modules.system.service.ISysDictItemService; | 26 | import org.jeecg.modules.system.service.ISysDictItemService; |
27 | import org.jeecg.modules.system.service.ISysDictService; | 27 | import org.jeecg.modules.system.service.ISysDictService; |
28 | import org.jeecg.modules.system.vo.SysDictPage; | 28 | import org.jeecg.modules.system.vo.SysDictPage; |
29 | +import org.jeecgframework.poi.excel.ExcelImportCheckUtil; | ||
29 | import org.jeecgframework.poi.excel.ExcelImportUtil; | 30 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
30 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; | 31 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
31 | import org.jeecgframework.poi.excel.entity.ExportParams; | 32 | import org.jeecgframework.poi.excel.entity.ExportParams; |
32 | import org.jeecgframework.poi.excel.entity.ImportParams; | 33 | import org.jeecgframework.poi.excel.entity.ImportParams; |
33 | -import org.jeecgframework.poi.excel.entity.result.ExcelImportResult; | ||
34 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | 34 | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
35 | import org.springframework.beans.BeanUtils; | 35 | import org.springframework.beans.BeanUtils; |
36 | import org.springframework.beans.factory.annotation.Autowired; | 36 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -66,8 +66,8 @@ public class SysDictController { | @@ -66,8 +66,8 @@ public class SysDictController { | ||
66 | public RedisTemplate<String, Object> redisTemplate; | 66 | public RedisTemplate<String, Object> redisTemplate; |
67 | 67 | ||
68 | @RequestMapping(value = "/list", method = RequestMethod.GET) | 68 | @RequestMapping(value = "/list", method = RequestMethod.GET) |
69 | - public Result<IPage<SysDict>> queryPageList(SysDict sysDict,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
70 | - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) { | 69 | + public Result<IPage<SysDict>> queryPageList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
70 | + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { | ||
71 | Result<IPage<SysDict>> result = new Result<IPage<SysDict>>(); | 71 | Result<IPage<SysDict>> result = new Result<IPage<SysDict>>(); |
72 | QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, req.getParameterMap()); | 72 | QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, req.getParameterMap()); |
73 | Page<SysDict> page = new Page<SysDict>(pageNo, pageSize); | 73 | Page<SysDict> page = new Page<SysDict>(pageNo, pageSize); |
@@ -91,8 +91,8 @@ public class SysDictController { | @@ -91,8 +91,8 @@ public class SysDictController { | ||
91 | */ | 91 | */ |
92 | @SuppressWarnings("unchecked") | 92 | @SuppressWarnings("unchecked") |
93 | @RequestMapping(value = "/treeList", method = RequestMethod.GET) | 93 | @RequestMapping(value = "/treeList", method = RequestMethod.GET) |
94 | - public Result<List<SysDictTree>> treeList(SysDict sysDict,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | ||
95 | - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,HttpServletRequest req) { | 94 | + public Result<List<SysDictTree>> treeList(SysDict sysDict, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
95 | + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { | ||
96 | Result<List<SysDictTree>> result = new Result<>(); | 96 | Result<List<SysDictTree>> result = new Result<>(); |
97 | LambdaQueryWrapper<SysDict> query = new LambdaQueryWrapper<>(); | 97 | LambdaQueryWrapper<SysDict> query = new LambdaQueryWrapper<>(); |
98 | // 构造查询条件 | 98 | // 构造查询条件 |
@@ -118,7 +118,7 @@ public class SysDictController { | @@ -118,7 +118,7 @@ public class SysDictController { | ||
118 | * @return | 118 | * @return |
119 | */ | 119 | */ |
120 | @RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET) | 120 | @RequestMapping(value = "/getDictItems/{dictCode}", method = RequestMethod.GET) |
121 | - public Result<List<DictModel>> getDictItems(@PathVariable String dictCode, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) { | 121 | + public Result<List<DictModel>> getDictItems(@PathVariable String dictCode, @RequestParam(value = "sign",required = false) String sign, HttpServletRequest request) { |
122 | log.info(" dictCode : "+ dictCode); | 122 | log.info(" dictCode : "+ dictCode); |
123 | Result<List<DictModel>> result = new Result<List<DictModel>>(); | 123 | Result<List<DictModel>> result = new Result<List<DictModel>>(); |
124 | List<DictModel> ls = null; | 124 | List<DictModel> ls = null; |
@@ -203,9 +203,9 @@ public class SysDictController { | @@ -203,9 +203,9 @@ public class SysDictController { | ||
203 | */ | 203 | */ |
204 | @RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET) | 204 | @RequestMapping(value = "/loadDict/{dictCode}", method = RequestMethod.GET) |
205 | public Result<List<DictModel>> loadDict(@PathVariable String dictCode, | 205 | public Result<List<DictModel>> loadDict(@PathVariable String dictCode, |
206 | - @RequestParam(name="keyword") String keyword, | ||
207 | - @RequestParam(value = "sign",required = false) String sign, | ||
208 | - @RequestParam(value = "pageSize", required = false) Integer pageSize) { | 206 | + @RequestParam(name="keyword") String keyword, |
207 | + @RequestParam(value = "sign",required = false) String sign, | ||
208 | + @RequestParam(value = "pageSize", required = false) Integer pageSize) { | ||
209 | log.info(" 加载字典表数据,加载关键字: "+ keyword); | 209 | log.info(" 加载字典表数据,加载关键字: "+ keyword); |
210 | Result<List<DictModel>> result = new Result<List<DictModel>>(); | 210 | Result<List<DictModel>> result = new Result<List<DictModel>>(); |
211 | List<DictModel> ls = null; | 211 | List<DictModel> ls = null; |
@@ -240,7 +240,7 @@ public class SysDictController { | @@ -240,7 +240,7 @@ public class SysDictController { | ||
240 | * 根据字典code加载字典text 返回 | 240 | * 根据字典code加载字典text 返回 |
241 | */ | 241 | */ |
242 | @RequestMapping(value = "/loadDictItem/{dictCode}", method = RequestMethod.GET) | 242 | @RequestMapping(value = "/loadDictItem/{dictCode}", method = RequestMethod.GET) |
243 | - public Result<List<String>> loadDictItem(@PathVariable String dictCode,@RequestParam(name="key") String keys, @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) { | 243 | + public Result<List<String>> loadDictItem(@PathVariable String dictCode, @RequestParam(name="key") String keys, @RequestParam(value = "sign",required = false) String sign, HttpServletRequest request) { |
244 | Result<List<String>> result = new Result<>(); | 244 | Result<List<String>> result = new Result<>(); |
245 | try { | 245 | try { |
246 | if(dictCode.indexOf(",")!=-1) { | 246 | if(dictCode.indexOf(",")!=-1) { |
@@ -271,13 +271,13 @@ public class SysDictController { | @@ -271,13 +271,13 @@ public class SysDictController { | ||
271 | */ | 271 | */ |
272 | @SuppressWarnings("unchecked") | 272 | @SuppressWarnings("unchecked") |
273 | @RequestMapping(value = "/loadTreeData", method = RequestMethod.GET) | 273 | @RequestMapping(value = "/loadTreeData", method = RequestMethod.GET) |
274 | - public Result<List<TreeSelectModel>> loadTreeData(@RequestParam(name="pid") String pid,@RequestParam(name="pidField") String pidField, | ||
275 | - @RequestParam(name="tableName") String tbname, | ||
276 | - @RequestParam(name="text") String text, | ||
277 | - @RequestParam(name="code") String code, | ||
278 | - @RequestParam(name="hasChildField") String hasChildField, | ||
279 | - @RequestParam(name="condition") String condition, | ||
280 | - @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request) { | 274 | + public Result<List<TreeSelectModel>> loadTreeData(@RequestParam(name="pid") String pid, @RequestParam(name="pidField") String pidField, |
275 | + @RequestParam(name="tableName") String tbname, | ||
276 | + @RequestParam(name="text") String text, | ||
277 | + @RequestParam(name="code") String code, | ||
278 | + @RequestParam(name="hasChildField") String hasChildField, | ||
279 | + @RequestParam(name="condition") String condition, | ||
280 | + @RequestParam(value = "sign",required = false) String sign, HttpServletRequest request) { | ||
281 | Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>(); | 281 | Result<List<TreeSelectModel>> result = new Result<List<TreeSelectModel>>(); |
282 | Map<String, String> query = null; | 282 | Map<String, String> query = null; |
283 | if(oConvertUtils.isNotEmpty(condition)) { | 283 | if(oConvertUtils.isNotEmpty(condition)) { |
@@ -293,17 +293,18 @@ public class SysDictController { | @@ -293,17 +293,18 @@ public class SysDictController { | ||
293 | } | 293 | } |
294 | 294 | ||
295 | /** | 295 | /** |
296 | - * 【APP接口】根据字典配置查询表字典数据 | 296 | + * 【APP接口】根据字典配置查询表字典数据(目前暂未找到调用的地方) |
297 | * @param query | 297 | * @param query |
298 | * @param pageNo | 298 | * @param pageNo |
299 | * @param pageSize | 299 | * @param pageSize |
300 | * @return | 300 | * @return |
301 | */ | 301 | */ |
302 | + @Deprecated | ||
302 | @GetMapping("/queryTableData") | 303 | @GetMapping("/queryTableData") |
303 | public Result<List<DictModel>> queryTableData(DictQuery query, | 304 | public Result<List<DictModel>> queryTableData(DictQuery query, |
304 | - @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, | ||
305 | - @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, | ||
306 | - @RequestParam(value = "sign",required = false) String sign,HttpServletRequest request){ | 305 | + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
306 | + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, | ||
307 | + @RequestParam(value = "sign",required = false) String sign, HttpServletRequest request){ | ||
307 | Result<List<DictModel>> res = new Result<List<DictModel>>(); | 308 | Result<List<DictModel>> res = new Result<List<DictModel>>(); |
308 | // SQL注入漏洞 sign签名校验 | 309 | // SQL注入漏洞 sign签名校验 |
309 | String dictCode = query.getTable()+","+query.getText()+","+query.getCode(); | 310 | String dictCode = query.getTable()+","+query.getText()+","+query.getCode(); |
@@ -319,7 +320,7 @@ public class SysDictController { | @@ -319,7 +320,7 @@ public class SysDictController { | ||
319 | * @param sysDict | 320 | * @param sysDict |
320 | * @return | 321 | * @return |
321 | */ | 322 | */ |
322 | - //@RequiresRoles({"admin"}) | 323 | + @RequiresRoles({"admin"}) |
323 | @RequestMapping(value = "/add", method = RequestMethod.POST) | 324 | @RequestMapping(value = "/add", method = RequestMethod.POST) |
324 | public Result<SysDict> add(@RequestBody SysDict sysDict) { | 325 | public Result<SysDict> add(@RequestBody SysDict sysDict) { |
325 | Result<SysDict> result = new Result<SysDict>(); | 326 | Result<SysDict> result = new Result<SysDict>(); |
@@ -340,7 +341,7 @@ public class SysDictController { | @@ -340,7 +341,7 @@ public class SysDictController { | ||
340 | * @param sysDict | 341 | * @param sysDict |
341 | * @return | 342 | * @return |
342 | */ | 343 | */ |
343 | - //@RequiresRoles({"admin"}) | 344 | + @RequiresRoles({"admin"}) |
344 | @RequestMapping(value = "/edit", method = RequestMethod.PUT) | 345 | @RequestMapping(value = "/edit", method = RequestMethod.PUT) |
345 | public Result<SysDict> edit(@RequestBody SysDict sysDict) { | 346 | public Result<SysDict> edit(@RequestBody SysDict sysDict) { |
346 | Result<SysDict> result = new Result<SysDict>(); | 347 | Result<SysDict> result = new Result<SysDict>(); |
@@ -362,7 +363,7 @@ public class SysDictController { | @@ -362,7 +363,7 @@ public class SysDictController { | ||
362 | * @param id | 363 | * @param id |
363 | * @return | 364 | * @return |
364 | */ | 365 | */ |
365 | - //@RequiresRoles({"admin"}) | 366 | + @RequiresRoles({"admin"}) |
366 | @RequestMapping(value = "/delete", method = RequestMethod.DELETE) | 367 | @RequestMapping(value = "/delete", method = RequestMethod.DELETE) |
367 | @CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true) | 368 | @CacheEvict(value=CacheConstant.SYS_DICT_CACHE, allEntries=true) |
368 | public Result<SysDict> delete(@RequestParam(name="id",required=true) String id) { | 369 | public Result<SysDict> delete(@RequestParam(name="id",required=true) String id) { |
@@ -381,7 +382,7 @@ public class SysDictController { | @@ -381,7 +382,7 @@ public class SysDictController { | ||
381 | * @param ids | 382 | * @param ids |
382 | * @return | 383 | * @return |
383 | */ | 384 | */ |
384 | - //@RequiresRoles({"admin"}) | 385 | + @RequiresRoles({"admin"}) |
385 | @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) | 386 | @RequestMapping(value = "/deleteBatch", method = RequestMethod.DELETE) |
386 | @CacheEvict(value= CacheConstant.SYS_DICT_CACHE, allEntries=true) | 387 | @CacheEvict(value= CacheConstant.SYS_DICT_CACHE, allEntries=true) |
387 | public Result<SysDict> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | 388 | public Result<SysDict> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
@@ -424,7 +425,7 @@ public class SysDictController { | @@ -424,7 +425,7 @@ public class SysDictController { | ||
424 | * @param request | 425 | * @param request |
425 | */ | 426 | */ |
426 | @RequestMapping(value = "/exportXls") | 427 | @RequestMapping(value = "/exportXls") |
427 | - public ModelAndView exportXls(SysDict sysDict,HttpServletRequest request) { | 428 | + public ModelAndView exportXls(SysDict sysDict, HttpServletRequest request) { |
428 | // Step.1 组装查询条件 | 429 | // Step.1 组装查询条件 |
429 | QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap()); | 430 | QueryWrapper<SysDict> queryWrapper = QueryGenerator.initQueryWrapper(sysDict, request.getParameterMap()); |
430 | //Step.2 AutoPoi 导出Excel | 431 | //Step.2 AutoPoi 导出Excel |
@@ -460,7 +461,7 @@ public class SysDictController { | @@ -460,7 +461,7 @@ public class SysDictController { | ||
460 | * @param | 461 | * @param |
461 | * @return | 462 | * @return |
462 | */ | 463 | */ |
463 | - //@RequiresRoles({"admin"}) | 464 | + @RequiresRoles({"admin"}) |
464 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | 465 | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
465 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | 466 | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
466 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; | 467 | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
@@ -473,8 +474,8 @@ public class SysDictController { | @@ -473,8 +474,8 @@ public class SysDictController { | ||
473 | params.setNeedSave(true); | 474 | params.setNeedSave(true); |
474 | try { | 475 | try { |
475 | //导入Excel格式校验,看匹配的字段文本概率 | 476 | //导入Excel格式校验,看匹配的字段文本概率 |
476 | - ExcelImportResult t = ExcelImportUtil.importExcelVerify(file.getInputStream(), SysDictPage.class, params); | ||
477 | - if(t.isVerfiyFail()){ | 477 | + Boolean t = ExcelImportCheckUtil.check(file.getInputStream(), SysDictPage.class, params); |
478 | + if(!t){ | ||
478 | throw new RuntimeException("导入Excel校验失败 !"); | 479 | throw new RuntimeException("导入Excel校验失败 !"); |
479 | } | 480 | } |
480 | List<SysDictPage> list = ExcelImportUtil.importExcel(file.getInputStream(), SysDictPage.class, params); | 481 | List<SysDictPage> list = ExcelImportUtil.importExcel(file.getInputStream(), SysDictPage.class, params); |