diff --git a/build/classes/net/jxvtc/controller/AppInfoController.class b/build/classes/net/jxvtc/controller/AppInfoController.class index 2a1db77ed99d9bbc4f1ae5d25c8d87e8f5113a7c..55d69ddd811f349f958d988c7efea2f56be9fbf8 100644 Binary files a/build/classes/net/jxvtc/controller/AppInfoController.class and b/build/classes/net/jxvtc/controller/AppInfoController.class differ diff --git a/build/classes/net/jxvtc/dao/appinfo/AppInfoMapper.class b/build/classes/net/jxvtc/dao/appinfo/AppInfoMapper.class index 869f6ee1fbb49a84280b091022782b91d5ab2726..c4329a59c1459f204250662c342211f2e1668745 100644 Binary files a/build/classes/net/jxvtc/dao/appinfo/AppInfoMapper.class and b/build/classes/net/jxvtc/dao/appinfo/AppInfoMapper.class differ diff --git a/build/classes/net/jxvtc/dao/appinfo/AppInfoMapper.xml b/build/classes/net/jxvtc/dao/appinfo/AppInfoMapper.xml index ba2a97b461b7aa79444f92347afca7c56f864058..eb68aebddd1420e16fc03f270bc650839f4013ac 100644 --- a/build/classes/net/jxvtc/dao/appinfo/AppInfoMapper.xml +++ b/build/classes/net/jxvtc/dao/appinfo/AppInfoMapper.xml @@ -95,6 +95,95 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + + update app_info + + + softwareName=#{softwareName}, + + + APKName=#{APKName}, + + + supportROM=#{supportROM}, + + + interfaceLanguage=#{interfaceLanguage}, + + + softwareSize=#{softwareSize}, + + + updateDate=#{updateDate}, + + + devId=#{devId}, + + + appIno=#{appInfo}, + + + status=#{status}, + + + onSaleDate=#{onSaleDate}, + + + offSaleDate=#{offSaleDate}, + + + flatformId=#{flatformId}, + + + categoryLevel3=#{categoryLevel3}, + + + downloads=#{downloads}, + + + createdBy=#{createdBy}, + + + creationDate=#{creationDate}, + + + categoryLevel1=#{categoryLevel1}, + + + categoryLevel2=#{categoryLevel2}, + + + logoPicPath=#{logoPicPath}, + + + logoLocPath=#{logoLocPath}, + + + versionId=#{versionId}, + + + + + + + + \ No newline at end of file diff --git a/build/classes/net/jxvtc/service/appinfo/AppInfoService.class b/build/classes/net/jxvtc/service/appinfo/AppInfoService.class index 70a3c185d66db58b2f9e0c82df99e4606373979f..85efa55cfdd1848f17e27233b09e40578c7823d3 100644 Binary files a/build/classes/net/jxvtc/service/appinfo/AppInfoService.class and b/build/classes/net/jxvtc/service/appinfo/AppInfoService.class differ diff --git a/build/classes/net/jxvtc/service/appinfo/AppInfoServiceImpl.class b/build/classes/net/jxvtc/service/appinfo/AppInfoServiceImpl.class index adf4dc6c6ea5fb5befe702110fc6e4fc3c39b848..4dd5238bfa5a11afb6a4f48479191b54bc95cde1 100644 Binary files a/build/classes/net/jxvtc/service/appinfo/AppInfoServiceImpl.class and b/build/classes/net/jxvtc/service/appinfo/AppInfoServiceImpl.class differ diff --git a/src/net/jxvtc/controller/AppInfoController.java b/src/net/jxvtc/controller/AppInfoController.java index 04bb48c4b8ca7dc7d2a1826ba91b51d242b97b15..2b94b5ccef63b5c96c109f169e1756f2ea4bf8e8 100644 --- a/src/net/jxvtc/controller/AppInfoController.java +++ b/src/net/jxvtc/controller/AppInfoController.java @@ -1,19 +1,27 @@ package net.jxvtc.controller; +import java.io.File; +import java.io.IOException; import java.util.ArrayList; +import java.util.Date; import java.util.List; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang.math.RandomUtils; import org.apache.log4j.Logger; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; import net.jxvtc.pojo.AppCategory; import net.jxvtc.pojo.AppInfo; @@ -25,6 +33,7 @@ import net.jxvtc.service.datadictionary.DataDictionaryService; import net.jxvtc.tools.Constants; import net.jxvtc.tools.PageSupport; + @Controller @RequestMapping(value="/dev/flatform/appinfo") public class AppInfoController { @@ -191,9 +200,226 @@ public class AppInfoController { @RequestMapping(value="/appinfoadd",method=RequestMethod.GET) public String add(@ModelAttribute("appInfo") AppInfo appInfo){ return "developer/appinfoadd"; + } + @RequestMapping(value="/appinfoaddsave",method=RequestMethod.GET) + public String addAppInfoSave(AppInfo appinfo,HttpSession session, + HttpServletRequest request, + @RequestParam(value="attachs",required= false)MultipartFile[] attachs + ) + { + String logoPicPath=null; + String logoLocPath=null; + String errorInfo = null; + boolean flag = true; + String path = request.getSession().getServletContext().getRealPath("statics"+File.separator+"uploadfiles"); + logger.info("uploadFile path ============== > "+path); + if(attachs!=null) + { + for(int i=0;i filesize){//上传大小不得超过 500k + request.setAttribute(errorInfo, " * 上传大小不得超过 500k"); + flag = false; + }else if(prefix.equalsIgnoreCase("jpg") || prefix.equalsIgnoreCase("png") + || prefix.equalsIgnoreCase("jpeg") || prefix.equalsIgnoreCase("pneg")){//上传图片格式不正确 + String fileName = System.currentTimeMillis()+RandomUtils.nextInt(1000000)+"_Personal.jpg"; + logger.debug("new fileName======== " + attach.getName()); + File targetFile = new File(path, fileName); + if(!targetFile.exists()){ + targetFile.mkdirs(); + } + try { + attach.transferTo(targetFile); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + request.setAttribute(errorInfo, " * 上传失败!"); + flag = false; + } + if(i == 0){ + logoPicPath = path+File.separator+fileName; + }else if(i == 1){ + logoLocPath = path+File.separator+fileName; + } + logger.debug("logoPicPath: " + logoPicPath); + logger.debug("logoLocPath: " + logoLocPath); + + }else{ + request.setAttribute(errorInfo, " * 上传图片格式不正确"); + flag = false; + } + } + } + + if(flag){ + appinfo.setModifyBy(((DevUser)session.getAttribute(Constants.DEV_USER_SESSION)).getId()); + appinfo.setModifyDate(new Date()); + appinfo.setLogoPicPath(logoPicPath); + appinfo.setLogoLocPath(logoLocPath); + try { + if(appinfoService.add(appinfo)){ + return "redirect:/dev/flatform/app/list"; + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + return "developer/appinfoadd"; } + @RequestMapping(value="/appview/{id}",method=RequestMethod.GET) + public String view(@PathVariable String id,Model model,HttpServletRequest request){ + logger.debug("view id===================== "+id); + AppInfo appInfo = null; + try { + appInfo = appinfoService.getAppInfo(Integer.parseInt(id)); + } catch (NumberFormatException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + if(appInfo.getLogoLocPath() != null && !"".equals(appInfo.getLogoLocPath())){ + String[] paths = appInfo.getLogoLocPath().split("\\"+File.separator); + logger.debug("appInfo.getLogoLocPath() paths[paths.length-1]============ " + paths[paths.length-1]); + appInfo.setLogoLocPath(request.getContextPath()+"/statics/uploadfiles/"+paths[paths.length-1]); + } + if(appInfo.getLogoPicPath() != null && !"".equals(appInfo.getLogoPicPath())){ + String[] paths = appInfo.getLogoPicPath().split("\\"+File.separator); + logger.debug("appInfo.getLogoPicPath() paths[paths.length-1]============ " + paths[paths.length-1]); + appInfo.setLogoPicPath(request.getContextPath()+"/statics/uploadfiles/"+paths[paths.length-1]); + } + + model.addAttribute(appInfo); + return "developer/appinfoview"; + } + + @RequestMapping(value="/modify/{id}",method=RequestMethod.GET) + public String getAppInfoById(@PathVariable String id,Model model,HttpServletRequest request){ + logger.debug("getProviderById id===================== "+id); + AppInfo appInfo = new AppInfo(); + try { + appInfo = appinfoService.getAppInfo(Integer.parseInt(id)); + if(appInfo.getLogoLocPath() != null && !"".equals(appInfo.getLogoLocPath())){ + String[] paths = appInfo.getLogoLocPath().split("\\"+File.separator); + logger.debug("appInfo.getLogoLocPath() paths[paths.length-1]============ " + paths[paths.length-1]); + appInfo.setLogoLocPath(request.getContextPath()+"/statics/uploadfiles/"+paths[paths.length-1]); + } + if(appInfo.getLogoPicPath() != null && !"".equals(appInfo.getLogoPicPath())){ + String[] paths = appInfo.getLogoPicPath().split("\\"+File.separator); + logger.debug("appInfo.getLogoPicPath() paths[paths.length-1]============ " + paths[paths.length-1]); + appInfo.setLogoPicPath(request.getContextPath()+"/statics/uploadfiles/"+paths[paths.length-1]); + } + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + model.addAttribute(appInfo); + return "developer/appinfoview"; +} + + + +@RequestMapping(value="/appinfomodify",method=RequestMethod.GET) +public String modifyAppInfo(AppInfo appinfo,HttpSession session, + HttpServletRequest request, + @RequestParam(value="attachs",required= false)MultipartFile[] attachs, + Model model){ + String logoPicPath=null; + String logoLocPath=null; + String errorInfo = null; + boolean flag = true; + String path = request.getSession().getServletContext().getRealPath("statics"+File.separator+"uploadfiles"); + logger.info("uploadFile path ============== > "+path); + if(attachs!=null) + { + for(int i=0;i filesize){//上传大小不得超过 500k + request.setAttribute(errorInfo, " * 上传大小不得超过 500k"); + flag = false; + }else if(prefix.equalsIgnoreCase("jpg") || prefix.equalsIgnoreCase("png") + || prefix.equalsIgnoreCase("jpeg") || prefix.equalsIgnoreCase("pneg")){//上传图片格式不正确 + String fileName = System.currentTimeMillis()+RandomUtils.nextInt(1000000)+"_Personal.jpg"; + logger.debug("new fileName======== " + attach.getName()); + File targetFile = new File(path, fileName); + if(!targetFile.exists()){ + targetFile.mkdirs(); + } + try { + attach.transferTo(targetFile); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + request.setAttribute(errorInfo, " * 上传失败!"); + flag = false; + } + if(i == 0){ + logoPicPath = path+File.separator+fileName; + }else if(i == 1){ + logoLocPath = path+File.separator+fileName; + } + logger.debug("logoPicPath: " + logoPicPath); + logger.debug("logoLocPath: " + logoLocPath); + + }else{ + request.setAttribute(errorInfo, " * 上传图片格式不正确"); + flag = false; + } + } + } + + if(flag){ + appinfo.setModifyBy(((DevUser)session.getAttribute(Constants.DEV_USER_SESSION)).getId()); + appinfo.setModifyDate(new Date()); + appinfo.setLogoPicPath(logoPicPath); + appinfo.setLogoLocPath(logoLocPath); + try { + if(appinfoService.add(appinfo)){ + return "redirect:/dev/flatform/app/list"; + } + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } + return "developer/appinfomodify"; +} } diff --git a/src/net/jxvtc/dao/appinfo/AppInfoMapper.java b/src/net/jxvtc/dao/appinfo/AppInfoMapper.java index 06365acdf55cfcbe12285389d01b21c3e4815660..120711955b6ed76a5364235087ced1c15bcca9fc 100644 --- a/src/net/jxvtc/dao/appinfo/AppInfoMapper.java +++ b/src/net/jxvtc/dao/appinfo/AppInfoMapper.java @@ -33,8 +33,22 @@ public interface AppInfoMapper { @Param(value="categoryLevel3")Integer queryCategoryLevel3, @Param(value="devId")Integer devId)throws Exception; - + /** + * 增加app基础信息 + * @param appinfo + * @return + * @throws Exception + */ public int add(AppInfo appinfo)throws Exception; - + /** + * 修改App基础信息 + * @param appinfo + * @return + * @throws Exception + */ + public int modify(AppInfo appinfo)throws Exception; + + + public AppInfo getAppInfo(@Param(value="id")Integer id)throws Exception; } diff --git a/src/net/jxvtc/dao/appinfo/AppInfoMapper.xml b/src/net/jxvtc/dao/appinfo/AppInfoMapper.xml index ba2a97b461b7aa79444f92347afca7c56f864058..eb68aebddd1420e16fc03f270bc650839f4013ac 100644 --- a/src/net/jxvtc/dao/appinfo/AppInfoMapper.xml +++ b/src/net/jxvtc/dao/appinfo/AppInfoMapper.xml @@ -95,6 +95,95 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + + update app_info + + + softwareName=#{softwareName}, + + + APKName=#{APKName}, + + + supportROM=#{supportROM}, + + + interfaceLanguage=#{interfaceLanguage}, + + + softwareSize=#{softwareSize}, + + + updateDate=#{updateDate}, + + + devId=#{devId}, + + + appIno=#{appInfo}, + + + status=#{status}, + + + onSaleDate=#{onSaleDate}, + + + offSaleDate=#{offSaleDate}, + + + flatformId=#{flatformId}, + + + categoryLevel3=#{categoryLevel3}, + + + downloads=#{downloads}, + + + createdBy=#{createdBy}, + + + creationDate=#{creationDate}, + + + categoryLevel1=#{categoryLevel1}, + + + categoryLevel2=#{categoryLevel2}, + + + logoPicPath=#{logoPicPath}, + + + logoLocPath=#{logoLocPath}, + + + versionId=#{versionId}, + + + + + + + + \ No newline at end of file diff --git a/src/net/jxvtc/service/appinfo/AppInfoService.java b/src/net/jxvtc/service/appinfo/AppInfoService.java index 14929a514daf924973f4e44ceab991d172112a0d..3e1d2109aa4d1abd4dec13855b2340d8af59ee50 100644 --- a/src/net/jxvtc/service/appinfo/AppInfoService.java +++ b/src/net/jxvtc/service/appinfo/AppInfoService.java @@ -18,4 +18,11 @@ public interface AppInfoService { throws Exception; public boolean add(AppInfo appInfo)throws Exception; + + + public boolean modify(AppInfo appInfo) throws Exception; + + + + public AppInfo getAppInfo(Integer id)throws Exception; } diff --git a/src/net/jxvtc/service/appinfo/AppInfoServiceImpl.java b/src/net/jxvtc/service/appinfo/AppInfoServiceImpl.java index f6ce2e5f76b02c59232ac4dd89524a24a53e3a71..fae7efcb68c460ae21cdaa83a8f9b35bad85f408 100644 --- a/src/net/jxvtc/service/appinfo/AppInfoServiceImpl.java +++ b/src/net/jxvtc/service/appinfo/AppInfoServiceImpl.java @@ -57,4 +57,21 @@ public class AppInfoServiceImpl implements AppInfoService { return flag; } + @Override + public boolean modify(AppInfo appInfo) throws Exception { + // TODO Auto-generated method stub + boolean flag=false; + if(appInfomapper.modify(appInfo)>0) + { + flag=true; + } + return flag; + } + + @Override + public AppInfo getAppInfo(Integer id) throws Exception { + // TODO Auto-generated method stub + return appInfomapper.getAppInfo(id); + } + }