From e2d06c494465727f06334910f87c60009ebb9d4a Mon Sep 17 00:00:00 2001 From: weizhongxi <2412380450@qq.com> Date: Fri, 23 Apr 2021 08:36:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9F=A6=E5=BF=A0=E5=96=9C=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/sms/rest/TbTemplateController.java | 2 +- .../java/me/zhengjie/modules/sms/vo/SendNewVo.java | 2 -- .../uploadnew/rest/TbUploadFileNewController.java | 14 ++++++++------ .../service/impl/TbUploadFileNewServiceImpl.java | 3 ++- .../modules/uploadnew/task/SaveToFileNewTask.java | 3 ++- .../modules/uploadnew/util/ExcelUtils.java | 4 ++-- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/rest/TbTemplateController.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/rest/TbTemplateController.java index 014bb72..e3994e7 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/sms/rest/TbTemplateController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/rest/TbTemplateController.java @@ -106,7 +106,7 @@ public class TbTemplateController { @ApiOperation("接收短信内容和url") // @PreAuthorize("@el.check('taskRecord:list')") @PostMapping(value = "/getSmsInfo") - // @AnonymousAccess // fixme 需要测试完成后进行去除和使用上面的权限注解 + @AnonymousAccess // fixme 需要测试完成后进行去除和使用上面的权限注解 public ResponseEntity getSmsInfo(@RequestBody SendNewVo sendVo){ log.info("========== [TbTemplateController|getSmsInfo ========== SmsContent:"+sendVo.getSmsContent()+" LinkUrl:"+sendVo.getLinkUrl()); if (sendVo == null){ diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/sms/vo/SendNewVo.java b/eladmin-system/src/main/java/me/zhengjie/modules/sms/vo/SendNewVo.java index b59f236..fef266b 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/sms/vo/SendNewVo.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/sms/vo/SendNewVo.java @@ -7,8 +7,6 @@ import lombok.Data; public class SendNewVo { @ApiModelProperty("发送链接") private String linkUrl; - @ApiModelProperty("模板id") - private String sendMessage; @ApiModelProperty("短信内容") private String smsContent; diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/rest/TbUploadFileNewController.java b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/rest/TbUploadFileNewController.java index 09807b2..39f7f4a 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/rest/TbUploadFileNewController.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/rest/TbUploadFileNewController.java @@ -137,12 +137,14 @@ public class TbUploadFileNewController { String token = ""; HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; Cookie[] cookies = httpServletRequest.getCookies(); - for(Cookie cookie : cookies) { - //获取cookie的名字 - String cookieName = cookie.getName(); - token=cookie.getValue(); - System.out.println(cookieName); - System.out.println(cookieName+" : "+ cookie.getValue() ); + if (cookies != null){ + for(Cookie cookie : cookies) { + //获取cookie的名字 + String cookieName = cookie.getName(); + token=cookie.getValue(); + System.out.println(cookieName); + System.out.println(cookieName+" : "+ cookie.getValue() ); + } } keyName = token+"==="+name; Object keyValue = redisTemplate.opsForValue().get(keyName); diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/service/impl/TbUploadFileNewServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/service/impl/TbUploadFileNewServiceImpl.java index 275f434..4241f04 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/service/impl/TbUploadFileNewServiceImpl.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/service/impl/TbUploadFileNewServiceImpl.java @@ -176,7 +176,8 @@ public class TbUploadFileNewServiceImpl implements TbUploadFileNewService { try { if(nameStr.equals(".xlsx")||nameStr.equals(".xls")){ fileFormat = "excel文件"; - list = FileUtil.readLines(eachFilePath, "UTF-8"); + ExcelUtils excelUtils = new ExcelUtils(); + list = excelUtils.excelParseList(file.getInputStream()); }else if (nameStr.equals(".txt")){ fileFormat = "txt文件"; diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/task/SaveToFileNewTask.java b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/task/SaveToFileNewTask.java index cc09bfd..5359457 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/task/SaveToFileNewTask.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/task/SaveToFileNewTask.java @@ -148,7 +148,8 @@ public class SaveToFileNewTask { List list = null; try { if("excel文件".equals(tbUploadFileNewDto.getFileFormat())){ - list = ExcelUtils.excelParseListByUrl(filePath); + ExcelUtils excelUtils = new ExcelUtils(); + list = excelUtils.excelParseListByUrl(filePath); }else if ("txt文件".equals(tbUploadFileNewDto.getFileFormat())){ list = TxtUtils.txtParseListVyUrl(filePath); }else if ("csv文件".equals(tbUploadFileNewDto.getFileFormat())){ diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/util/ExcelUtils.java b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/util/ExcelUtils.java index 0222f6d..e42be8a 100644 --- a/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/util/ExcelUtils.java +++ b/eladmin-system/src/main/java/me/zhengjie/modules/uploadnew/util/ExcelUtils.java @@ -22,7 +22,7 @@ public class ExcelUtils { * @return * @throws IOException */ - public static List excelParseList(InputStream inputStream) throws IOException { + public List excelParseList(InputStream inputStream) throws IOException { List list = new ArrayList<>(); try { Workbook workbook = new XSSFWorkbook(inputStream); @@ -58,7 +58,7 @@ public class ExcelUtils { * @return * @throws IOException */ - public static List excelParseListByUrl(String url) throws IOException { + public List excelParseListByUrl(String url) throws IOException { List list = new ArrayList<>(); InputStream inputStream = new FileInputStream(new File(url)) ; try {