修复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;
@ -33,329 +34,349 @@ import java.util.Map;
@RequestMapping("/app/imgfiles") @RequestMapping("/app/imgfiles")
public class AppImgFilesController extends BaseController { public class AppImgFilesController extends BaseController {
@Autowired @Autowired
private ImgFilesService imgfilesService; private ImgFilesService imgfilesService;
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/add", headers = "content-type=multipart/form-data") * @throws Exception
@ResponseBody */
@Transactional @RequestMapping(value = "/add", headers = "content-type=multipart/form-data")
public Object finish( @ResponseBody
@RequestParam(value="FFILE",required=false) MultipartFile[] files, @Transactional
@RequestParam(value="TYPE",required=false) String TYPE, public Object finish(
@RequestParam(value="FOREIGN_KEY",required=false) String FOREIGN_KEY @RequestParam(value = "FFILE", required = false) MultipartFile[] files,
) throws Exception{ @RequestParam(value = "TYPE", required = false) String TYPE,
Map<String,Object> map = new HashMap<String,Object>(); @RequestParam(value = "FOREIGN_KEY", required = false) String FOREIGN_KEY
String errInfo = "success"; ) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
if (files != null && files.length > 0) { if (files != null && files.length > 0) {
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
if (!"json".equals(suffixName) && !"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { if (!"json".equals(suffixName) && !"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
errInfo = "fail"; errInfo = "fail";
map.put("result", errInfo); map.put("result", errInfo);
map.put("msg", "文件格式不正确!"); map.put("msg", "文件格式不正确!");
return map; return map;
} }
} }
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
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");
map.put("exception", "上传图片格式不正确,请重新上传"); map.put("exception", "上传图片格式不正确,请重新上传");
return map; return map;
} }
if (tempFile.exists()) { if (tempFile.exists()) {
tempFile.delete(); tempFile.delete();
} }
if(TYPE.equals("2") || TYPE.equals("102")) {//先删除原四色图 if (TYPE.equals("2") || TYPE.equals("102")) {//先删除原四色图
PageData pd2 = new PageData(); PageData pd2 = new PageData();
pd2.put("FOREIGN_KEY",FOREIGN_KEY); pd2.put("FOREIGN_KEY", FOREIGN_KEY);
pd2.put("TYPE",TYPE); pd2.put("TYPE", TYPE);
List<PageData> four = imgfilesService.listAll(pd2); List<PageData> four = imgfilesService.listAll(pd2);
for (PageData pageData : four) { for (PageData pageData : four) {
File old = new File(PathUtil.getProjectpath()+pageData.getString("FILEPATH")); File old = new File(PathUtil.getProjectpath() + pageData.getString("FILEPATH"));
old.delete(); old.delete();
imgfilesService.delete(pageData); imgfilesService.delete(pageData);
} }
} }
PageData pd = new PageData(); PageData pd = new PageData();
pd = this.getPageData(); pd = this.getPageData();
String ffile = DateUtil.getDays(); String ffile = DateUtil.getDays();
// String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径
// String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 // String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName,Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd.put("IMGFILES_ID", this.get32UUID()); pd.put("IMGFILES_ID", this.get32UUID());
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd.put("TYPE", TYPE); pd.put("TYPE", TYPE);
pd.put("MD5", md5); pd.put("MD5", md5);
pd.put("FOREIGN_KEY", FOREIGN_KEY); pd.put("FOREIGN_KEY", FOREIGN_KEY);
imgfilesService.save(pd); imgfilesService.save(pd);
} }
} }
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/add64") * @throws Exception
@ResponseBody */
public Object add64() throws Exception{ @RequestMapping(value = "/add64")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object add64() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("FILEPATH")); PageData pd = new PageData();
String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); pd = this.getPageData();
if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { MultipartFile img = BASE64DecodedMultipartFile.base64ToMultipart(pd.getString("FILEPATH"));
errInfo = "fail"; String suffixName = img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
map.put("result", errInfo); if (!"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
map.put("msg", "文件格式不正确!"); errInfo = "fail";
return map; map.put("result", errInfo);
} map.put("msg", "文件格式不正确!");
String ffile = DateUtil.getDays(); return map;
String fileName = this.get32UUID()+img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf(".")); }
Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); String ffile = DateUtil.getDays();
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); String fileName = this.get32UUID() + img.getOriginalFilename().substring(img.getOriginalFilename().lastIndexOf("."));
pd.put("IMGFILES_ID", this.get32UUID()); Smb.sshSftp(img, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd.put("TYPE", pd.getString("TYPE")); pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd.put("FOREIGN_KEY", pd.getString("FOREIGN_KEY")); pd.put("IMGFILES_ID", this.get32UUID());
imgfilesService.save(pd); pd.put("TYPE", pd.getString("TYPE"));
map.put("pd", pd); pd.put("FOREIGN_KEY", pd.getString("FOREIGN_KEY"));
map.put("result", errInfo); imgfilesService.save(pd);
return map; map.put("pd", pd);
} map.put("result", errInfo);
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/edit", headers = "content-type=multipart/form-data") * @throws Exception
@ResponseBody */
@Transactional @RequestMapping(value = "/edit", headers = "content-type=multipart/form-data")
public Object edit( @ResponseBody
@RequestParam(value="FFILE",required=false) MultipartFile[] files, @Transactional
@RequestParam(value="TYPE",required=false) String TYPE, public Object edit(
@RequestParam(value="FOREIGN_KEY",required=false) String FOREIGN_KEY @RequestParam(value = "FFILE", required = false) MultipartFile[] files,
) throws Exception{ @RequestParam(value = "TYPE", required = false) String TYPE,
Map<String,Object> map = new HashMap<String,Object>(); @RequestParam(value = "FOREIGN_KEY", required = false) String FOREIGN_KEY
String errInfo = "success"; ) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success";
if (files != null && files.length > 0) { if (files != null && files.length > 0) {
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".")+1).toLowerCase(); String suffixName = files[i].getOriginalFilename().substring(files[i].getOriginalFilename().lastIndexOf(".") + 1).toLowerCase();
if (!"json".equals(suffixName) && !"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) { if (!"json".equals(suffixName) && !"pdf".equals(suffixName) && !"jpg".equals(suffixName) && !"jpeg".equals(suffixName) && !"png".equals(suffixName) && !"mp4".equals(suffixName)) {
errInfo = "fail"; errInfo = "fail";
map.put("result", errInfo); map.put("result", errInfo);
map.put("msg", "文件格式不正确!"); map.put("msg", "文件格式不正确!");
return map; return map;
} }
} }
PageData pd2 = new PageData(); PageData pd2 = new PageData();
pd2.put("FOREIGN_KEY",FOREIGN_KEY); pd2.put("FOREIGN_KEY", FOREIGN_KEY);
pd2.put("TYPE",TYPE); pd2.put("TYPE", TYPE);
List<PageData> four = imgfilesService.listAll(pd2); List<PageData> four = imgfilesService.listAll(pd2);
for (PageData pageData : four) { for (PageData pageData : four) {
File old = new File(PathUtil.getProjectpath()+pageData.getString("FILEPATH")); File old = new File(PathUtil.getProjectpath() + pageData.getString("FILEPATH"));
old.delete(); old.delete();
imgfilesService.delete(pageData); imgfilesService.delete(pageData);
} }
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
MultipartFile file = files[i]; MultipartFile file = files[i];
// 保存文件 // 保存文件
File tempFile = new File(file.getOriginalFilename()); File tempFile = new File(file.getOriginalFilename());
FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile); FileUtils.copyInputStreamToFile(file.getInputStream(), tempFile);
if(!FileUpload.isImage(tempFile) && !TYPE.equals("2")) {//四色图改为json文件,不用判断类型 if (!FileUpload.isImage(tempFile) && !TYPE.equals("2")) {//四色图改为json文件,不用判断类型
tempFile.delete(); tempFile.delete();
map.put("result", "failed"); map.put("result", "failed");
map.put("exception", "上传图片格式不正确,请重新上传"); map.put("exception", "上传图片格式不正确,请重新上传");
return map; return map;
} }
if (tempFile.exists()) { if (tempFile.exists()) {
tempFile.delete(); tempFile.delete();
} }
PageData pd = new PageData(); PageData pd = new PageData();
pd = this.getPageData(); pd = this.getPageData();
String ffile = DateUtil.getDays(); String ffile = DateUtil.getDays();
// String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径 // String filePath = PathUtil.getProjectpath() + Const.FILEPATHFILE + ffile; //文件上传路径
// String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传 // String fileName = FileUpload.fileUp(file, filePath, this.get32UUID()); //执行上传
String fileName = this.get32UUID()+file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
Smb.sshSftp(file, fileName,Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile); Smb.sshSftp(file, fileName, Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile);
pd.put("IMGFILES_ID", this.get32UUID()); pd.put("IMGFILES_ID", this.get32UUID());
pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName); pd.put("FILEPATH", Const.FILEPATHFILE + pd.getString("CORPINFO_ID") + "/" + ffile + "/" + fileName);
pd.put("TYPE", TYPE); pd.put("TYPE", TYPE);
pd.put("FOREIGN_KEY", FOREIGN_KEY); pd.put("FOREIGN_KEY", FOREIGN_KEY);
imgfilesService.save(pd); imgfilesService.save(pd);
} }
} }
map.put("result", errInfo); map.put("result", errInfo);
return map; return map;
} }
/** /**
* @param out *
* @throws Exception *
*/ * @param out
@RequestMapping(value="/delete") * @throws Exception
@ResponseBody */
public Object delete() throws Exception{ @RequestMapping(value = "/delete")
Map<String,String> map = new HashMap<String,String>(); @ResponseBody
String errInfo = "success"; public Object delete() throws Exception {
PageData pd = new PageData(); Map<String, String> map = new HashMap<String, String>();
pd = this.getPageData(); String errInfo = "success";
pd = imgfilesService.findById(pd); //根据ID读取 PageData pd = new PageData();
File file = new File(PathUtil.getProjectpath()+pd.getString("FILEPATH")); pd = this.getPageData();
file.delete(); pd = imgfilesService.findById(pd); //根据ID读取
imgfilesService.delete(pd); File file = new File(PathUtil.getProjectpath() + pd.getString("FILEPATH"));
map.put("result", errInfo); //返回结果 file.delete();
return map; imgfilesService.delete(pd);
} map.put("result", errInfo); //返回结果
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/edit") * @throws Exception
@RequiresPermissions("imgfiles:edit") */
@ResponseBody @RequestMapping(value = "/edit")
public Object edit() throws Exception{ @RequiresPermissions("imgfiles:edit")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object edit() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
imgfilesService.edit(pd); PageData pd = new PageData();
map.put("result", errInfo); pd = this.getPageData();
return map; imgfilesService.edit(pd);
} map.put("result", errInfo);
return map;
}
/** /**
* @param page *
* @throws Exception *
*/ * @param page
@RequestMapping(value="/list") * @throws Exception
@RequiresPermissions("imgfiles:list") */
@ResponseBody @RequestMapping(value = "/list")
public Object list(Page page) throws Exception{ @RequiresPermissions("imgfiles:list")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object list(Page page) throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件 PageData pd = new PageData();
if(Tools.notEmpty(KEYWORDS))pd.put("KEYWORDS", KEYWORDS.trim()); pd = this.getPageData();
page.setPd(pd); String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
List<PageData> varList = imgfilesService.list(page); //列出ImgFiles列表 if (Tools.notEmpty(KEYWORDS)) pd.put("KEYWORDS", KEYWORDS.trim());
map.put("varList", varList); page.setPd(pd);
map.put("page", page); List<PageData> varList = imgfilesService.list(page); //列出ImgFiles列表
map.put("result", errInfo); map.put("varList", varList);
return map; map.put("page", page);
} map.put("result", errInfo);
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/goEdit") * @throws Exception
@RequiresPermissions("imgfiles:edit") */
@ResponseBody @RequestMapping(value = "/goEdit")
public Object goEdit() throws Exception{ @RequiresPermissions("imgfiles:edit")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object goEdit() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
pd = imgfilesService.findById(pd); //根据ID读取 PageData pd = new PageData();
map.put("pd", pd); pd = this.getPageData();
map.put("result", errInfo); pd = imgfilesService.findById(pd); //根据ID读取
return map; map.put("pd", pd);
} map.put("result", errInfo);
return map;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/deleteAll") * @throws Exception
@RequiresPermissions("imgfiles:del") */
@ResponseBody @RequestMapping(value = "/deleteAll")
public Object deleteAll() throws Exception{ @RequiresPermissions("imgfiles:del")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object deleteAll() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
String DATA_IDS = pd.getString("DATA_IDS"); PageData pd = new PageData();
if(Tools.notEmpty(DATA_IDS)){ pd = this.getPageData();
String ArrayDATA_IDS[] = DATA_IDS.split(","); String DATA_IDS = pd.getString("DATA_IDS");
imgfilesService.deleteAll(ArrayDATA_IDS); if (Tools.notEmpty(DATA_IDS)) {
errInfo = "success"; String ArrayDATA_IDS[] = DATA_IDS.split(",");
}else{ imgfilesService.deleteAll(ArrayDATA_IDS);
errInfo = "fail"; errInfo = "success";
} } else {
map.put("result", errInfo); //返回结果 errInfo = "fail";
return map; }
} map.put("result", errInfo); //返回结果
return map;
}
/**excel /**
* @param * excel
* @throws Exception *
*/ * @param
@RequestMapping(value="/excel") * @throws Exception
@RequiresPermissions("toExcel") */
public ModelAndView exportExcel() throws Exception{ @RequestMapping(value = "/excel")
ModelAndView mv = new ModelAndView(); @RequiresPermissions("toExcel")
PageData pd = new PageData(); public ModelAndView exportExcel() throws Exception {
pd = this.getPageData(); ModelAndView mv = new ModelAndView();
Map<String,Object> dataMap = new HashMap<String,Object>(); PageData pd = new PageData();
List<String> titles = new ArrayList<String>(); pd = this.getPageData();
titles.add("路径"); //1 Map<String, Object> dataMap = new HashMap<String, Object>();
titles.add("类型"); //2 List<String> titles = new ArrayList<String>();
titles.add("外键"); //3 titles.add("路径"); //1
dataMap.put("titles", titles); titles.add("类型"); //2
List<PageData> varOList = imgfilesService.listAll(pd); titles.add("外键"); //3
List<PageData> varList = new ArrayList<PageData>(); dataMap.put("titles", titles);
for(int i=0;i<varOList.size();i++){ List<PageData> varOList = imgfilesService.listAll(pd);
PageData vpd = new PageData(); List<PageData> varList = new ArrayList<PageData>();
vpd.put("var1", varOList.get(i).getString("FILEPATH")); //1 for (int i = 0; i < varOList.size(); i++) {
vpd.put("var2", varOList.get(i).get("TYPE").toString()); //2 PageData vpd = new PageData();
vpd.put("var3", varOList.get(i).getString("FOREIGN_KEY")); //3 vpd.put("var1", varOList.get(i).getString("FILEPATH")); //1
varList.add(vpd); vpd.put("var2", varOList.get(i).get("TYPE").toString()); //2
} vpd.put("var3", varOList.get(i).getString("FOREIGN_KEY")); //3
dataMap.put("varList", varList); varList.add(vpd);
ObjectExcelView erv = new ObjectExcelView(); }
mv = new ModelAndView(erv,dataMap); dataMap.put("varList", varList);
return mv; ObjectExcelView erv = new ObjectExcelView();
} mv = new ModelAndView(erv, dataMap);
return mv;
}
/** /**
* @param *
* @throws Exception *
*/ * @param
@RequestMapping(value="/listImgs") * @throws Exception
@ResponseBody */
public Object listImgs() throws Exception{ @RequestMapping(value = "/listImgs")
Map<String,Object> map = new HashMap<String,Object>(); @ResponseBody
String errInfo = "success"; public Object listImgs() throws Exception {
PageData pd = new PageData(); Map<String, Object> map = new HashMap<String, Object>();
pd = this.getPageData(); String errInfo = "success";
List<PageData> imgs = imgfilesService.listAll(pd); //根据ID读取 PageData pd = new PageData();
map.put("imgs", imgs); pd = this.getPageData();
map.put("result", errInfo); List<PageData> imgs = imgfilesService.listAll(pd); //根据ID读取
return map; map.put("imgs", imgs);
} map.put("result", errInfo);
return map;
}
} }

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");
@ -511,4 +508,4 @@ public class LoginController extends BaseController {
// pd.put("ArrayDATA_IDS", a); // pd.put("ArrayDATA_IDS", a);
// } // }
// } // }
} }