修复MD5

pet
shanao 2024-10-23 17:24:25 +08:00
parent 87520d5b8f
commit 162b25bb87
3 changed files with 313 additions and 294 deletions

View File

@ -1,5 +1,6 @@
package com.zcloud.controller.app; package com.zcloud.controller.app;
import cn.hutool.core.io.FileUtil;
import cn.hutool.crypto.digest.DigestUtil; import cn.hutool.crypto.digest.DigestUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -552,7 +553,7 @@ public class AppHiddenController extends BaseController {
} }
File tempFile = new File(file.getOriginalFilename()); File tempFile = new File(file.getOriginalFilename());
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
String md5 = DigestUtil.md5Hex(tempFile); String md5 = FileUtil.isEmpty(tempFile) ? "" : DigestUtil.md5Hex(tempFile);
if (!FileUpload.isImage(tempFile)) { if (!FileUpload.isImage(tempFile)) {
tempFile.delete(); tempFile.delete();
map.put("result", "failed"); map.put("result", "failed");

View File

@ -1,5 +1,6 @@
package com.zcloud.controller.app; package com.zcloud.controller.app;
import cn.hutool.core.io.FileUtil;
import cn.hutool.crypto.digest.DigestUtil; import cn.hutool.crypto.digest.DigestUtil;
import com.zcloud.controller.base.BaseController; import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page; import com.zcloud.entity.Page;
@ -36,7 +37,9 @@ public class AppImgFilesController extends BaseController {
@Autowired @Autowired
private ImgFilesService imgfilesService; private ImgFilesService imgfilesService;
/** /**
*
*
* @param * @param
* @throws Exception * @throws Exception
*/ */
@ -64,8 +67,8 @@ public class AppImgFilesController extends BaseController {
MultipartFile file = files[i]; MultipartFile file = files[i];
// 保存文件 // 保存文件
File tempFile = new File(file.getOriginalFilename()); File tempFile = new File(file.getOriginalFilename());
String md5 = DigestUtil.md5Hex(tempFile);
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
String md5 = FileUtil.isEmpty(tempFile) ? "" : DigestUtil.md5Hex(tempFile);
if (!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("102")) {//四色图改为json文件,不用判断类型 if (!FileUpload.isImage(tempFile) && !TYPE.equals("2") && !TYPE.equals("102")) {//四色图改为json文件,不用判断类型
tempFile.delete(); tempFile.delete();
map.put("result", "failed"); map.put("result", "failed");
@ -109,7 +112,9 @@ public class AppImgFilesController extends BaseController {
} }
/** /**
*
*
* @param * @param
* @throws Exception * @throws Exception
*/ */
@ -142,7 +147,9 @@ public class AppImgFilesController extends BaseController {
} }
/** /**
*
*
* @param * @param
* @throws Exception * @throws Exception
*/ */
@ -209,7 +216,9 @@ public class AppImgFilesController extends BaseController {
return map; return map;
} }
/** /**
*
*
* @param out * @param out
* @throws Exception * @throws Exception
*/ */
@ -228,7 +237,9 @@ public class AppImgFilesController extends BaseController {
return map; return map;
} }
/** /**
*
*
* @param * @param
* @throws Exception * @throws Exception
*/ */
@ -245,7 +256,9 @@ public class AppImgFilesController extends BaseController {
return map; return map;
} }
/** /**
*
*
* @param page * @param page
* @throws Exception * @throws Exception
*/ */
@ -267,7 +280,9 @@ public class AppImgFilesController extends BaseController {
return map; return map;
} }
/** /**
*
*
* @param * @param
* @throws Exception * @throws Exception
*/ */
@ -285,7 +300,9 @@ public class AppImgFilesController extends BaseController {
return map; return map;
} }
/** /**
*
*
* @param * @param
* @throws Exception * @throws Exception
*/ */
@ -309,7 +326,9 @@ public class AppImgFilesController extends BaseController {
return map; return map;
} }
/**excel /**
* excel
*
* @param * @param
* @throws Exception * @throws Exception
*/ */
@ -341,7 +360,9 @@ public class AppImgFilesController extends BaseController {
} }
/** /**
*
*
* @param * @param
* @throws Exception * @throws Exception
*/ */

View File

@ -153,7 +153,6 @@ public class LoginController extends BaseController {
} catch (AuthenticationException ae) { } catch (AuthenticationException ae) {
errInfo = "usererror"; errInfo = "usererror";
} }
Integer port = SpringUtil.getApplicationContext().getEnvironment().getProperty("server.port", Integer.class);
if (subject.isAuthenticated()) { //验证是否登录成功 if (subject.isAuthenticated()) { //验证是否登录成功
removeSession(USERNAME); removeSession(USERNAME);
@ -178,8 +177,7 @@ public class LoginController extends BaseController {
if (backEndPath.get("result").toString().equals("success")) { if (backEndPath.get("result").toString().equals("success")) {
backEndPath.put("baseImgPath",map.get("baseImgPath").toString()); backEndPath.put("baseImgPath",map.get("baseImgPath").toString());
backEndPath.put("USER_IDENTITY",map.get("USER_IDENTITY").toString()); backEndPath.put("USER_IDENTITY",map.get("USER_IDENTITY").toString());
backEndPath.put("BACKENDADDR", map.get("BACKENDADDR").toString());
backEndPath.put("BACKENDADDR", "http://" + ip + ":" + port + "/");
System.out.println("登录返回参数:" + backEndPath); System.out.println("登录返回参数:" + backEndPath);
return backEndPath; return backEndPath;
} else { } else {
@ -190,7 +188,6 @@ public class LoginController extends BaseController {
return map; return map;
} }
} }
map.put("BACKENDADDR", "http://" + ip + ":" + port + "/");
if ("99".equals(pd.getString("STATUS"))) { if ("99".equals(pd.getString("STATUS"))) {
errInfo = "userlock"; errInfo = "userlock";
map.put("result", "fail"); map.put("result", "fail");