后台文件上传,账单错误修改
This commit is contained in:
parent
18f00dc655
commit
1260faa8bc
7
pom.xml
7
pom.xml
|
|
@ -196,6 +196,12 @@
|
|||
<scope>system</scope>
|
||||
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/fastdfs-client-java-1.25.jar</systemPath>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>ifishSystem</finalName>
|
||||
|
|
@ -242,6 +248,7 @@
|
|||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.conf</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import com.ifish.service.AdInfoService;
|
|||
import com.ifish.util.IfishFileDirectory;
|
||||
import com.ifish.util.IfishFileUtils;
|
||||
import com.ifish.util.ResultUtil;
|
||||
import com.ifishNew.help.FastDFSClientI;
|
||||
|
||||
/**
|
||||
* 广告信息
|
||||
|
|
@ -30,7 +31,6 @@ public class AdInfoAction {
|
|||
|
||||
@Autowired
|
||||
private AdInfoService adInfoService;
|
||||
|
||||
/**
|
||||
* 广告信息页面
|
||||
*
|
||||
|
|
@ -91,7 +91,7 @@ public class AdInfoAction {
|
|||
}
|
||||
adInfo.setAdImage(newImgName);
|
||||
//新增广告
|
||||
return adInfoService.addAdInfo(adInfo);
|
||||
return adInfoService.addAdInfo(adInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import com.ifish.service.IfishShopService;
|
|||
import com.ifish.util.IfishFileDirectory;
|
||||
import com.ifish.util.IfishFileUtils;
|
||||
import com.ifish.util.ResultUtil;
|
||||
import com.ifishNew.help.FastDFSClientI;
|
||||
|
||||
/**
|
||||
* 商品管理action
|
||||
|
|
|
|||
|
|
@ -21,156 +21,165 @@ import com.ifish.service.InformationService;
|
|||
import com.ifish.util.IfishFileDirectory;
|
||||
import com.ifish.util.IfishFileUtils;
|
||||
import com.ifish.util.ResultUtil;
|
||||
import com.ifishNew.help.FastDFSClientI;
|
||||
|
||||
/**
|
||||
* 资讯信息
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class InformationAction {
|
||||
|
||||
@Autowired
|
||||
private InformationService infoService;
|
||||
|
||||
/**
|
||||
* 资讯信息页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/information.do")
|
||||
public ModelAndView information(Model model){
|
||||
model.addAttribute("ueditorMap", infoService.getUeditors());
|
||||
return new ModelAndView("information/information");
|
||||
}
|
||||
|
||||
/**
|
||||
* 资讯信息分页数据
|
||||
* @param pageData
|
||||
* @param information
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/informationData.do")
|
||||
@ResponseBody
|
||||
public PageDataDto getInformationByPage(PageDataDto pageData,Information information){
|
||||
pageData.pageData(infoService.getInformationByPage(pageData, information));
|
||||
return pageData;
|
||||
}
|
||||
|
||||
/**
|
||||
* app展示
|
||||
* @param infoId
|
||||
* @param appShow
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/informationShowUpdate.do")
|
||||
@ResponseBody
|
||||
public JsonResult informationShowUpdate(@RequestParam Integer infoId,@RequestParam boolean appShow) {
|
||||
return infoService.informationShowUpdate(infoId,appShow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资讯
|
||||
* @param information
|
||||
* @param fileUpload
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/addInformation.do")
|
||||
@ResponseBody
|
||||
public JsonResult addInformation(Information information,MultipartFile fileUpload){
|
||||
//上传文件不能为空
|
||||
if(fileUpload==null){
|
||||
throw new IfishException(SysUserEnum.warn114);
|
||||
}
|
||||
//上传图片
|
||||
String newImgName = null;
|
||||
try {
|
||||
//上传文件
|
||||
newImgName = String.valueOf(System.currentTimeMillis())+".png";
|
||||
IfishFileUtils.uploadFile(IfishFileDirectory.path_img_information,newImgName,fileUpload);
|
||||
} catch (IfishException e){
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new IfishException(SysUserEnum.warn113);
|
||||
}
|
||||
information.setImage(newImgName);
|
||||
//新增资讯
|
||||
return infoService.addInformation(information);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资讯信息
|
||||
* @param information
|
||||
* @param fileUpload
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/updateInformation.do")
|
||||
@ResponseBody
|
||||
public JsonResult updateInformation(Information information,MultipartFile fileUpload){
|
||||
String newImgName = null;
|
||||
//String oldImgName = information.getImage();
|
||||
//上传新资讯图
|
||||
if(fileUpload!=null){
|
||||
try {
|
||||
//上传文件
|
||||
newImgName = String.valueOf(System.currentTimeMillis())+".png";
|
||||
IfishFileUtils.uploadFile(IfishFileDirectory.path_img_information,newImgName,fileUpload);
|
||||
} catch (IfishException e){
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new IfishException(SysUserEnum.warn113);
|
||||
}
|
||||
information.setImage(newImgName);
|
||||
}
|
||||
JsonResult jsonResult = infoService.updateInformation(information);
|
||||
//删除老资讯图
|
||||
/*if(newImgName!=null && StringUtils.isNotBlank(oldImgName)){
|
||||
|
||||
@Autowired
|
||||
private InformationService infoService;
|
||||
|
||||
/**
|
||||
* 资讯信息页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/information.do")
|
||||
public ModelAndView information(Model model) {
|
||||
model.addAttribute("ueditorMap", infoService.getUeditors());
|
||||
return new ModelAndView("information/information");
|
||||
}
|
||||
|
||||
/**
|
||||
* 资讯信息分页数据
|
||||
*
|
||||
* @param pageData
|
||||
* @param information
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/informationData.do")
|
||||
@ResponseBody
|
||||
public PageDataDto getInformationByPage(PageDataDto pageData, Information information) {
|
||||
pageData.pageData(infoService.getInformationByPage(pageData, information));
|
||||
return pageData;
|
||||
}
|
||||
|
||||
/**
|
||||
* app展示
|
||||
*
|
||||
* @param infoId
|
||||
* @param appShow
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/informationShowUpdate.do")
|
||||
@ResponseBody
|
||||
public JsonResult informationShowUpdate(@RequestParam Integer infoId, @RequestParam boolean appShow) {
|
||||
return infoService.informationShowUpdate(infoId, appShow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资讯
|
||||
*
|
||||
* @param information
|
||||
* @param fileUpload
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/addInformation.do")
|
||||
@ResponseBody
|
||||
public JsonResult addInformation(Information information, MultipartFile fileUpload) {
|
||||
//上传文件不能为空
|
||||
if (fileUpload == null) {
|
||||
throw new IfishException(SysUserEnum.warn114);
|
||||
}
|
||||
//上传图片
|
||||
String newImgName = null;
|
||||
try {
|
||||
//上传文件
|
||||
newImgName = String.valueOf(System.currentTimeMillis()) + ".png";
|
||||
IfishFileUtils.uploadFile(IfishFileDirectory.path_img_information, newImgName, fileUpload);
|
||||
} catch (IfishException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new IfishException(SysUserEnum.warn113);
|
||||
}
|
||||
information.setImage(newImgName);
|
||||
//新增资讯
|
||||
return infoService.addInformation(information);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资讯信息
|
||||
*
|
||||
* @param information
|
||||
* @param fileUpload
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/updateInformation.do")
|
||||
@ResponseBody
|
||||
public JsonResult updateInformation(Information information, MultipartFile fileUpload) {
|
||||
String newImgName = null;
|
||||
//String oldImgName = information.getImage();
|
||||
//上传新资讯图
|
||||
if (fileUpload != null) {
|
||||
try {
|
||||
//上传文件
|
||||
newImgName = String.valueOf(System.currentTimeMillis()) + ".png";
|
||||
IfishFileUtils.uploadFile(IfishFileDirectory.path_img_information, newImgName, fileUpload);
|
||||
} catch (IfishException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new IfishException(SysUserEnum.warn113);
|
||||
}
|
||||
information.setImage(newImgName);
|
||||
}
|
||||
JsonResult jsonResult = infoService.updateInformation(information);
|
||||
//删除老资讯图
|
||||
/*if(newImgName!=null && StringUtils.isNotBlank(oldImgName)){
|
||||
IfishFileUtils.deleteFile(IfishFileDirectory.path_img_information, oldImgName);
|
||||
}*/
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资讯
|
||||
* @param infoId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/deleteInformation.do")
|
||||
@ResponseBody
|
||||
public JsonResult deleteInformation(Integer infoId){
|
||||
String image = infoService.deleteInformation(infoId);
|
||||
//删除资讯图
|
||||
if(StringUtils.isNotBlank(image)){
|
||||
IfishFileUtils.deleteFile(IfishFileDirectory.path_img_information, image);
|
||||
}
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询资讯信息
|
||||
* @param infoId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/getInformationById.do")
|
||||
@ResponseBody
|
||||
public Information getInformationById(Integer infoId){
|
||||
Information info = infoService.getInformationById(infoId);
|
||||
if(info.getUeditorId()!=null){
|
||||
info.setSource(InformationSourceEnum.ueditor.getKey());
|
||||
}
|
||||
else{
|
||||
info.setSource(InformationSourceEnum.other.getKey());
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查找编辑器信息
|
||||
* @param ueditorId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/information/getUeditorById.do")
|
||||
@ResponseBody
|
||||
public Ueditor editUeditor(Integer ueditorId) {
|
||||
return infoService.getUeditorById(ueditorId);
|
||||
}
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资讯
|
||||
*
|
||||
* @param infoId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteInformation.do")
|
||||
@ResponseBody
|
||||
public JsonResult deleteInformation(Integer infoId) {
|
||||
String image = infoService.deleteInformation(infoId);
|
||||
//删除资讯图
|
||||
if (StringUtils.isNotBlank(image)) {
|
||||
IfishFileUtils.deleteFile(IfishFileDirectory.path_img_information, image);
|
||||
}
|
||||
return ResultUtil.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询资讯信息
|
||||
*
|
||||
* @param infoId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getInformationById.do")
|
||||
@ResponseBody
|
||||
public Information getInformationById(Integer infoId) {
|
||||
Information info = infoService.getInformationById(infoId);
|
||||
if (info.getUeditorId() != null) {
|
||||
info.setSource(InformationSourceEnum.ueditor.getKey());
|
||||
} else {
|
||||
info.setSource(InformationSourceEnum.other.getKey());
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查找编辑器信息
|
||||
*
|
||||
* @param ueditorId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/information/getUeditorById.do")
|
||||
@ResponseBody
|
||||
public Ueditor editUeditor(Integer ueditorId) {
|
||||
return infoService.getUeditorById(ueditorId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,199 +25,217 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.ifish.entity.Menu;
|
||||
import com.ifish.entity.Role;
|
||||
import com.ifish.entity.SecurityUser;
|
||||
import com.ifish.enums.AdTypeEnum;
|
||||
import com.ifish.enums.RoleEnum;
|
||||
import com.ifish.enums.SysUserEnum;
|
||||
import com.ifish.exception.IfishException;
|
||||
import com.ifish.menu.IfishMenu;
|
||||
import com.ifish.service.AdminService;
|
||||
import com.ifish.service.PublicService;
|
||||
import com.ifish.ueditor.ActionEnter;
|
||||
import com.ifish.util.IfishFileDirectory;
|
||||
import com.ifish.util.IfishFileUtils;
|
||||
import com.ifish.util.IfishUtil;
|
||||
import com.ifish.util.getRemoteAddress;
|
||||
import com.ifishNew.bean.CommodityInfoBean;
|
||||
import com.ifishNew.help.FastDFSClientI;
|
||||
import com.ifishNew.mapper.Tbl_Commodity_Info_Mapper;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* @ClassName: PublicAction
|
||||
* @Description: 公共页面
|
||||
* @author ggw
|
||||
/**
|
||||
* @ClassName: PublicAction
|
||||
* @Description: 公共页面
|
||||
* @author ggw
|
||||
*/
|
||||
|
||||
@Controller("publicAction")
|
||||
@RequestMapping("/public")
|
||||
public class PublicAction {
|
||||
|
||||
@Autowired
|
||||
private PublicService publicService;
|
||||
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(PublicAction.class);
|
||||
|
||||
/**
|
||||
* 登陆页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/login.do")
|
||||
public ModelAndView login(String status) {
|
||||
return new ModelAndView("roleAll/login","status",status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本编辑器配置
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping("/config.do")
|
||||
public void config(HttpServletRequest request,HttpServletResponse response){
|
||||
try {
|
||||
request.setCharacterEncoding( "utf-8" );
|
||||
response.setHeader("Content-Type" , "text/html");
|
||||
response.setContentType("application/json");
|
||||
String rootPath = request.getSession().getServletContext().getRealPath( "/" );
|
||||
String exec = new ActionEnter( request, rootPath ).exec();
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer.write(exec);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主页
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/index.do")
|
||||
public ModelAndView index() {
|
||||
String role = null;
|
||||
String userName = null;
|
||||
try {
|
||||
//登录用户
|
||||
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
userName = userDetails.getUsername();
|
||||
//根据登录用户角色类型跳转
|
||||
Collection<? extends GrantedAuthority> authorities = SecurityContextHolder.getContext().getAuthentication().getAuthorities();
|
||||
for(GrantedAuthority grantedAuthority : authorities) {
|
||||
role = grantedAuthority.getAuthority();
|
||||
}
|
||||
//菜单初始化
|
||||
if(role!=null && userName!=null){
|
||||
Role curRole = this.adminService.get(role);
|
||||
List<Menu> menuList = new ArrayList<Menu>();
|
||||
menuList.addAll(curRole.getMenuList());
|
||||
//默认选择菜单
|
||||
IfishMenu.initChioceMenu(userName, null);
|
||||
//用户菜单
|
||||
if(userName!=null){
|
||||
IfishMenu.initMenu(userName, menuList);
|
||||
}
|
||||
}
|
||||
//重定向
|
||||
String redirect = "";
|
||||
if(role.equals(RoleEnum.admin.getKey())){
|
||||
redirect = "page/admin/home.do";
|
||||
}
|
||||
else if(role.equals(RoleEnum.vender.getKey())){
|
||||
redirect = "page/vender/tmpDeviceList.do";
|
||||
}
|
||||
else if(role.equals(RoleEnum.user.getKey())){
|
||||
redirect = "page/user/home.do";
|
||||
}
|
||||
else if(role.equals(RoleEnum.factory.getKey())){
|
||||
redirect = "page/factory/tmpDeviceList.do";
|
||||
}
|
||||
return new ModelAndView("redirect:/"+redirect);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("index page:role:{},error message:{}",role,e.toString());
|
||||
}
|
||||
return new ModelAndView("redirect:login.do");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/changePwd.do")
|
||||
public ModelAndView changePwd(String status) {
|
||||
return new ModelAndView("roleAll/changePwd","status",status);
|
||||
}
|
||||
/**
|
||||
* 修改密码
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/savePwd.do")
|
||||
public ModelAndView savePwd(String username,String oldPassword,String newPassword) {
|
||||
try {
|
||||
SecurityUser securityUser = publicService.updateSecurityPwd(username, oldPassword, newPassword);
|
||||
if(securityUser!=null){
|
||||
return new ModelAndView("redirect:/page/public/changePwd.do","status",SysUserEnum.success100.getKey());
|
||||
}
|
||||
return new ModelAndView("redirect:/page/public/changePwd.do","status",SysUserEnum.warn105.getKey());
|
||||
} catch (Exception e) {
|
||||
log.error("update password:userName:{},error message:{}",username,e.toString());
|
||||
}
|
||||
return new ModelAndView("redirect:/page/public/changePwd.do","status",SysUserEnum.failed101.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
* @param securityUser
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/signup.do")
|
||||
public ModelAndView signup(SecurityUser securityUser) {
|
||||
try {
|
||||
String code = publicService.createSysUser(securityUser);
|
||||
return new ModelAndView("redirect:/page/public/login.do","status",code);
|
||||
} catch (Exception e) {
|
||||
log.error("securityUser register:userName:{},error message:{}",securityUser.getUsername(),e.toString());
|
||||
}
|
||||
return new ModelAndView("redirect:/page/public/login.do","status",SysUserEnum.failed101.getKey());
|
||||
}
|
||||
|
||||
/***********************************************测试工具接口***************************************************/
|
||||
/**
|
||||
* 获取厂家列表
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getVenderList.do")
|
||||
@ResponseBody
|
||||
public Object getVenderList(HttpServletResponse response,String factoryCode) {
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
map = publicService.getVenderList(factoryCode);
|
||||
} catch (Exception e) {
|
||||
log.error("get venderList information to test tool:error message:{}",e.toString());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
/**
|
||||
* 保存设备mac
|
||||
* @param data
|
||||
* @param subStr
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/saveMacAddress.do")
|
||||
@ResponseBody
|
||||
public Object saveMacAddress(Map<String, String> data,String subStr,HttpServletRequest request,HttpServletResponse response) {
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
try {
|
||||
String ip = getRemoteAddress.getIp(request);
|
||||
JSONObject json = JSONObject.parseObject(subStr);
|
||||
String brandCode = json.getString("brandCode");
|
||||
String factoryCode = json.getString("factoryCode");
|
||||
String isBlacklist = json.getString("isBlacklist");
|
||||
String macs = json.getString("mac");
|
||||
String hardType = json.getString("hardType");
|
||||
String[] mac = macs.equals("")?null:macs.split(",");
|
||||
String[] hardTypes = hardType.equals("")?null:hardType.split(",");
|
||||
Map<String, Object> map = this.publicService.saveDevices(factoryCode,isBlacklist,brandCode,ip, mac, hardTypes);
|
||||
JSONObject returnJson = new JSONObject(map);
|
||||
return returnJson.toString();
|
||||
} catch (Exception e) {
|
||||
log.error("save macAddress from test tool:error message:{}",e.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PublicService publicService;
|
||||
|
||||
@Autowired
|
||||
private AdminService adminService;
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(PublicAction.class);
|
||||
|
||||
/**
|
||||
* 登陆页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/login.do")
|
||||
public ModelAndView login(String status) {
|
||||
return new ModelAndView("roleAll/login", "status", status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本编辑器配置
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping("/config.do")
|
||||
public void config(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
request.setCharacterEncoding("utf-8");
|
||||
response.setHeader("Content-Type", "text/html");
|
||||
response.setContentType("application/json");
|
||||
String rootPath = request.getSession().getServletContext().getRealPath("/");
|
||||
String exec = new ActionEnter(request, rootPath).exec();
|
||||
PrintWriter writer = response.getWriter();
|
||||
writer.write(exec);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 主页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/index.do")
|
||||
public ModelAndView index() {
|
||||
String role = null;
|
||||
String userName = null;
|
||||
try {
|
||||
//登录用户
|
||||
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
|
||||
userName = userDetails.getUsername();
|
||||
//根据登录用户角色类型跳转
|
||||
Collection<? extends GrantedAuthority> authorities = SecurityContextHolder.getContext().getAuthentication().getAuthorities();
|
||||
for (GrantedAuthority grantedAuthority : authorities) {
|
||||
role = grantedAuthority.getAuthority();
|
||||
}
|
||||
//菜单初始化
|
||||
if (role != null && userName != null) {
|
||||
Role curRole = this.adminService.get(role);
|
||||
List<Menu> menuList = new ArrayList<Menu>();
|
||||
menuList.addAll(curRole.getMenuList());
|
||||
//默认选择菜单
|
||||
IfishMenu.initChioceMenu(userName, null);
|
||||
//用户菜单
|
||||
if (userName != null) {
|
||||
IfishMenu.initMenu(userName, menuList);
|
||||
}
|
||||
}
|
||||
//重定向
|
||||
String redirect = "";
|
||||
if (role.equals(RoleEnum.admin.getKey())) {
|
||||
redirect = "page/admin/home.do";
|
||||
} else if (role.equals(RoleEnum.vender.getKey())) {
|
||||
redirect = "page/vender/tmpDeviceList.do";
|
||||
} else if (role.equals(RoleEnum.user.getKey())) {
|
||||
redirect = "page/user/home.do";
|
||||
} else if (role.equals(RoleEnum.factory.getKey())) {
|
||||
redirect = "page/factory/tmpDeviceList.do";
|
||||
}
|
||||
return new ModelAndView("redirect:/" + redirect);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("index page:role:{},error message:{}", role, e.toString());
|
||||
}
|
||||
return new ModelAndView("redirect:login.do");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/changePwd.do")
|
||||
public ModelAndView changePwd(String status) {
|
||||
return new ModelAndView("roleAll/changePwd", "status", status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改密码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/savePwd.do")
|
||||
public ModelAndView savePwd(String username, String oldPassword, String newPassword) {
|
||||
try {
|
||||
SecurityUser securityUser = publicService.updateSecurityPwd(username, oldPassword, newPassword);
|
||||
if (securityUser != null) {
|
||||
return new ModelAndView("redirect:/page/public/changePwd.do", "status", SysUserEnum.success100.getKey());
|
||||
}
|
||||
return new ModelAndView("redirect:/page/public/changePwd.do", "status", SysUserEnum.warn105.getKey());
|
||||
} catch (Exception e) {
|
||||
log.error("update password:userName:{},error message:{}", username, e.toString());
|
||||
}
|
||||
return new ModelAndView("redirect:/page/public/changePwd.do", "status", SysUserEnum.failed101.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户注册
|
||||
*
|
||||
* @param securityUser
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/signup.do")
|
||||
public ModelAndView signup(SecurityUser securityUser) {
|
||||
try {
|
||||
String code = publicService.createSysUser(securityUser);
|
||||
return new ModelAndView("redirect:/page/public/login.do", "status", code);
|
||||
} catch (Exception e) {
|
||||
log.error("securityUser register:userName:{},error message:{}", securityUser.getUsername(), e.toString());
|
||||
}
|
||||
return new ModelAndView("redirect:/page/public/login.do", "status", SysUserEnum.failed101.getKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* *********************************************测试工具接口**************************************************
|
||||
*/
|
||||
/**
|
||||
* 获取厂家列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getVenderList.do")
|
||||
@ResponseBody
|
||||
public Object getVenderList(HttpServletResponse response, String factoryCode) {
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
try {
|
||||
map = publicService.getVenderList(factoryCode);
|
||||
} catch (Exception e) {
|
||||
log.error("get venderList information to test tool:error message:{}", e.toString());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存设备mac
|
||||
*
|
||||
* @param data
|
||||
* @param subStr
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/saveMacAddress.do")
|
||||
@ResponseBody
|
||||
public Object saveMacAddress(Map<String, String> data, String subStr, HttpServletRequest request, HttpServletResponse response) {
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
try {
|
||||
String ip = getRemoteAddress.getIp(request);
|
||||
JSONObject json = JSONObject.parseObject(subStr);
|
||||
String brandCode = json.getString("brandCode");
|
||||
String factoryCode = json.getString("factoryCode");
|
||||
String isBlacklist = json.getString("isBlacklist");
|
||||
String macs = json.getString("mac");
|
||||
String hardType = json.getString("hardType");
|
||||
String[] mac = macs.equals("") ? null : macs.split(",");
|
||||
String[] hardTypes = hardType.equals("") ? null : hardType.split(",");
|
||||
Map<String, Object> map = this.publicService.saveDevices(factoryCode, isBlacklist, brandCode, ip, mac, hardTypes);
|
||||
JSONObject returnJson = new JSONObject(map);
|
||||
return returnJson.toString();
|
||||
} catch (Exception e) {
|
||||
log.error("save macAddress from test tool:error message:{}", e.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.ifish.util.IfishFileUtils;
|
|||
import com.ifish.util.ResultUtil;
|
||||
import com.ifishNew.bean.CommodityInfoBean;
|
||||
import com.ifishNew.help.CommodityInfoHelperI;
|
||||
import com.ifishNew.help.FastDFSClientI;
|
||||
|
||||
/**
|
||||
* 商家信息controller
|
||||
|
|
@ -36,6 +37,9 @@ public class ShopsInfoAction {
|
|||
|
||||
@Autowired
|
||||
private CommodityInfoHelperI commodityInfoHelperI;
|
||||
|
||||
@Autowired
|
||||
private FastDFSClientI fastDFSClientI;
|
||||
|
||||
/**
|
||||
* 已审核商家信息页面
|
||||
|
|
@ -130,7 +134,7 @@ public class ShopsInfoAction {
|
|||
try {
|
||||
//上传文件
|
||||
newImgName = String.valueOf(System.currentTimeMillis()) + ".png";
|
||||
IfishFileUtils.uploadFile(IfishFileDirectory.path_picture4 + "/" + userId, newImgName, fileUpload);
|
||||
newImgName = fastDFSClientI.uploadFile(IfishFileDirectory.path_picture4 + "/" + userId, newImgName, fileUpload);
|
||||
} catch (IfishException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
|
@ -265,8 +269,8 @@ public class ShopsInfoAction {
|
|||
*/
|
||||
@RequestMapping("/shopsInfo/updategoodsInfo.do")
|
||||
@ResponseBody
|
||||
public JsonResult updateGoodsInfoJsonResult(CommodityInfoBean commodityInfoBean,boolean appShow) {
|
||||
return commodityInfoHelperI.updateCommodityInfo(commodityInfoBean,appShow);
|
||||
public JsonResult updateGoodsInfoJsonResult(CommodityInfoBean commodityInfoBean, boolean appShow) {
|
||||
return commodityInfoHelperI.updateCommodityInfo(commodityInfoBean, appShow);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2602,6 +2602,9 @@ public class AdminServiceImpl implements AdminService {
|
|||
if (StringUtils.isNotBlank(isTax)) {
|
||||
isTax = BooleanEnum.NO.getKey();
|
||||
factoryList.setIsTax(isTax);
|
||||
} else {
|
||||
isTax = BooleanEnum.NO.getKey();
|
||||
factoryList.setIsTax(isTax);
|
||||
}
|
||||
//支付金额为null时
|
||||
if (payMoney == null) {
|
||||
|
|
|
|||
|
|
@ -13,64 +13,70 @@ import com.ifish.exception.IfishException;
|
|||
|
||||
/**
|
||||
* 文件处理工具类
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public class IfishFileUtils {
|
||||
|
||||
/**
|
||||
* 上传文件并校验尺寸
|
||||
* @param path
|
||||
* @param fileName
|
||||
* @param multipartFile
|
||||
* @param width
|
||||
* @param height
|
||||
* @throws IllegalStateException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void uploadFile(String path,String fileName,MultipartFile multipartFile,int width,int height) throws IllegalStateException, IOException{
|
||||
//检验图片尺寸
|
||||
BufferedImage sourceImg =ImageIO.read(multipartFile.getInputStream());
|
||||
|
||||
/**
|
||||
* 上传文件并校验尺寸
|
||||
*
|
||||
* @param path
|
||||
* @param fileName
|
||||
* @param multipartFile
|
||||
* @param width
|
||||
* @param height
|
||||
* @throws IllegalStateException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void uploadFile(String path, String fileName, MultipartFile multipartFile, int width, int height) throws IllegalStateException, IOException {
|
||||
//检验图片尺寸
|
||||
BufferedImage sourceImg = ImageIO.read(multipartFile.getInputStream());
|
||||
int imgWidth = sourceImg.getWidth();
|
||||
int imgHeight = sourceImg.getHeight();
|
||||
if(width!=imgWidth || height!=imgHeight){
|
||||
throw new IfishException(SysUserEnum.warn115.getKey(),SysUserEnum.warn115.getValue()+"("+width+"x"+height+")");
|
||||
if (width != imgWidth || height != imgHeight) {
|
||||
throw new IfishException(SysUserEnum.warn115.getKey(), SysUserEnum.warn115.getValue() + "(" + width + "x" + height + ")");
|
||||
}
|
||||
//文件名
|
||||
File newFile = new File(path,fileName);
|
||||
if(!newFile.exists()){
|
||||
newFile.mkdirs();
|
||||
}
|
||||
//传输文件
|
||||
multipartFile.transferTo(newFile);
|
||||
}
|
||||
/**
|
||||
* 上传文件
|
||||
* @param path
|
||||
* @param fileName
|
||||
* @param multipartFile
|
||||
* @throws IllegalStateException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void uploadFile(String path,String fileName,MultipartFile multipartFile) throws IllegalStateException, IOException{
|
||||
//文件名
|
||||
File newFile = new File(path,fileName);
|
||||
if(!newFile.exists()){
|
||||
newFile.mkdirs();
|
||||
}
|
||||
//传输文件
|
||||
multipartFile.transferTo(newFile);
|
||||
}
|
||||
/**
|
||||
* 删除文件
|
||||
* @param path
|
||||
* @param fileName
|
||||
*/
|
||||
public static void deleteFile(String path,String fileName){
|
||||
File file = new File(path, fileName);
|
||||
if(file.exists()){
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
//文件名
|
||||
File newFile = new File(path, fileName);
|
||||
if (!newFile.exists()) {
|
||||
newFile.mkdirs();
|
||||
}
|
||||
//传输文件
|
||||
multipartFile.transferTo(newFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param path
|
||||
* @param fileName
|
||||
* @param multipartFile
|
||||
* @throws IllegalStateException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void uploadFile(String path, String fileName, MultipartFile multipartFile) throws IllegalStateException, IOException {
|
||||
//文件名
|
||||
File newFile = new File(path, fileName);
|
||||
if (!newFile.exists()) {
|
||||
newFile.mkdirs();
|
||||
}
|
||||
//传输文件
|
||||
multipartFile.transferTo(newFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param path
|
||||
* @param fileName
|
||||
*/
|
||||
public static void deleteFile(String path, String fileName) {
|
||||
File file = new File(path, fileName);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ public class MybatisConfig {
|
|||
|
||||
// //获取当前操作系统(servers_os为服务器设置的属性JAVA_OPTS=%JAVA_OPTS% -Dservers_os=online84)
|
||||
// String servers_os = System.getProperty("servers_os") == null ? "" : System.getProperty("servers_os");
|
||||
|
||||
dataSource.setUsername("ifish");
|
||||
dataSource.setPassword("ifish7pwd");
|
||||
dataSource.setUrl("jdbc\\:mysql\\://localhost\\:3306/myfishdb?characterEncoding\\=UTF-8");
|
||||
|
|
|
|||
|
|
@ -5,8 +5,14 @@
|
|||
*/
|
||||
package com.ifishNew.help;
|
||||
|
||||
import com.ifish.enums.SysUserEnum;
|
||||
import com.ifish.exception.IfishException;
|
||||
import com.ifish.util.IfishFileDirectory;
|
||||
import com.ifish.util.ValidateUtil;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import javax.imageio.ImageIO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.csource.fastdfs.ClientGlobal;
|
||||
import org.csource.fastdfs.StorageClient1;
|
||||
|
|
@ -136,10 +142,47 @@ public class FastDFSClient implements FastDFSClientI {
|
|||
return "";
|
||||
}
|
||||
|
||||
return IfishFileDirectory.fastDFS_url_app + url;
|
||||
if (IfishFileDirectory.env.equals("product")) {
|
||||
return IfishFileDirectory.fastDFS_url_app + url;
|
||||
} else {
|
||||
return IfishFileDirectory.fastDFS_url_local + url;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFile(String path, String fileName, MultipartFile multipartFile, int width, int height) throws IllegalStateException, IOException {
|
||||
//检验图片尺寸
|
||||
BufferedImage sourceImg = ImageIO.read(multipartFile.getInputStream());
|
||||
int imgWidth = sourceImg.getWidth();
|
||||
int imgHeight = sourceImg.getHeight();
|
||||
if (width != imgWidth || height != imgHeight) {
|
||||
throw new IfishException(SysUserEnum.warn115.getKey(), SysUserEnum.warn115.getValue() + "(" + width + "x" + height + ")");
|
||||
}
|
||||
//文件名
|
||||
File newFile = new File(path, fileName);
|
||||
if (!newFile.exists()) {
|
||||
newFile.mkdirs();
|
||||
}
|
||||
//传输文件
|
||||
//multipartFile.transferTo(newFile);
|
||||
String value = uploadFileToFastDFS(multipartFile);
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadFile(String path, String fileName, MultipartFile multipartFile) throws IllegalStateException, IOException {
|
||||
//文件名
|
||||
// File newFile = new File(path, fileName);
|
||||
// if (!newFile.exists()) {
|
||||
// newFile.mkdirs();
|
||||
// }
|
||||
//传输文件
|
||||
//multipartFile.transferTo(newFile);
|
||||
String value = uploadFileToFastDFS(multipartFile);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
package com.ifishNew.help;
|
||||
|
||||
import com.ifish.domain.JsonResult;
|
||||
import java.io.IOException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
|
|
@ -46,4 +47,8 @@ public interface FastDFSClientI {
|
|||
String uploadFile(String group_name, String local_filename, String file_ext_name) throws Exception;
|
||||
|
||||
String uploadFileToFastDFS(MultipartFile file);
|
||||
|
||||
String uploadFile(String path, String fileName, MultipartFile multipartFile, int width, int height) throws IllegalStateException, IOException;
|
||||
|
||||
String uploadFile(String path, String fileName, MultipartFile multipartFile) throws IllegalStateException, IOException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<intercept-url pattern="/page/public/savePwd.do" access="isAuthenticated()"/>
|
||||
<!-- 允许所有人访问 -->
|
||||
<intercept-url pattern="/page/public/**" access="permitAll"/>
|
||||
<intercept-url pattern="/page/test/test" access="permitAll"/>
|
||||
<!-- 根据角色访问 -->
|
||||
<intercept-url pattern="/ueditor/ueditor.jsp" access="hasAnyRole('ROLE_ADMIN')" />
|
||||
<intercept-url pattern="/page/user/**" access="hasAnyRole('ROLE_USER')" />
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ ifish_account=ifish
|
|||
#IM\u5b98\u65b9\u624b\u673a\u53f7
|
||||
netease_phone=18501773036
|
||||
#FastDFS\u6587\u4ef6URL\u8bbf\u95ee\u8def\u5f84(\u672c\u5730\u548c\u6d4b\u8bd5\u73af\u5883)
|
||||
fastDFS_url_local=https://app.zhangxinyanv5.top/
|
||||
fastDFS_url_local=http://139.196.24.156:83/
|
||||
#FastDFS\u6587\u4ef6URL\u8bbf\u95ee\u8def\u5f84(\u6b63\u5f0f\u73af\u5883)
|
||||
fastDFS_url_app=http://app.ifish7.com/
|
||||
#\u73af\u5883(local:\u672c\u5730\u73af\u5883,test:\u6d4b\u8bd5\u73af\u5883,\u6b63\u5f0f\u73af\u5883:product)
|
||||
env=test
|
||||
env=product
|
||||
Binary file not shown.
|
|
@ -2,273 +2,281 @@
|
|||
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>广告信息</title>
|
||||
<!-- css and js -->
|
||||
<%@ include file="../htm/script.jsp" %>
|
||||
<script type="text/javascript">
|
||||
var dt = null;
|
||||
$(function(){
|
||||
//modal初始化
|
||||
myModule.modalInit();
|
||||
//dataTable模块
|
||||
myModule.URL = {
|
||||
dataSourceUrl:"<%=basePath%>page/adInfoData.do",
|
||||
addUrl:"<%=basePath%>page/addAdInfo.do",
|
||||
updateUrl:"<%=basePath%>page/updateAdInfo.do",
|
||||
deleteUrl:"<%=basePath%>page/deleteAdInfo.do",
|
||||
getByIdUrl:"<%=basePath%>page/getAdInfoById.do",
|
||||
};
|
||||
//dataTable
|
||||
dt = myModule.dataTable(true,'#sample-table-2',[
|
||||
{ "mData": "adId","bSortable": false },
|
||||
{ "mData": function(adInfo){
|
||||
return adInfo.isShow=='1'?'<span class="green">是</span>':'<span class="red">否</span>';
|
||||
},
|
||||
"bSortable": false
|
||||
},
|
||||
{ "mData": function(adInfo){
|
||||
return $("#adType_"+adInfo.adType).val();
|
||||
},
|
||||
"bSortable": false
|
||||
},
|
||||
{ "mData": function(adInfo){
|
||||
return '<img src="<%=picturePath%>Img/adInfo/'+adInfo.adImage+'" width="50%"/>';
|
||||
},
|
||||
"bSortable": false
|
||||
},
|
||||
{ "mData": function(adInfo){
|
||||
return '<a href="'+adInfo.adLink+'" target="_blank">'+adInfo.adLink+'</a>';
|
||||
},
|
||||
"bSortable": false
|
||||
},
|
||||
{ "mData": "orderNum","bSortable": false },
|
||||
{ "mData": "updateTime","bSortable": false },
|
||||
{ "mData": "createTime","bSortable": false },
|
||||
{ "mData": function(adInfo){
|
||||
return '<a href="javascript:void(0);" onclick="findById(this,'+adInfo.adId+');" class="label label-primary"><i class="icon-edit"></i></a> '
|
||||
+'<a href="javascript:void(0);" onclick="deleteById(this,'+adInfo.adId+');" class="label label-danger"><i class="icon-trash"></i></a>';
|
||||
},
|
||||
"bSortable": false,
|
||||
"sClass":"center"
|
||||
}
|
||||
]);
|
||||
$("#sample-table-2_length").append(' 是否显示:<select name="isShow" class="input-xlarge searchClass">'
|
||||
+'<option value="">请选择</option>'
|
||||
+'<c:forEach items="<%=BooleanEnum.getJson()%>" var="local">'
|
||||
+'<option value="${local.key}">${local.value}</option>'
|
||||
+'</c:forEach>'
|
||||
+'</select>'
|
||||
);
|
||||
$(".searchBtn").click(function(){
|
||||
$("button[name='adType']").removeClass("searchClass");
|
||||
$(this).addClass("searchClass");
|
||||
dt.fnDraw();
|
||||
});
|
||||
//自动查询
|
||||
$(".searchClass").change(function(){
|
||||
dt.fnDraw();
|
||||
});
|
||||
//异步提交新增表单
|
||||
myModule.addAjaxFrom("#addSubmitBtn",'#form-add',dt);
|
||||
//异步提交修改表单
|
||||
myModule.updateAjaxFrom("#updateSubmitBtn",'#form-update',dt);
|
||||
});
|
||||
//修改
|
||||
function findById(el,adId){
|
||||
//重置表单
|
||||
$("#form-update").data('bootstrapValidator').resetForm(true);
|
||||
//数据
|
||||
var jsonData = {"adId":adId};
|
||||
//赋值属性
|
||||
var columns = ["adId","adType","adLink","isShow","adImage","orderNum"];
|
||||
myModule.findByIdFunction(el,'#updateModal',jsonData,columns);
|
||||
}
|
||||
//删除
|
||||
function deleteById(el,adId){
|
||||
var jsonData = {"adId":adId};
|
||||
myModule.deleteFunction(el,jsonData,dt);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<head>
|
||||
<title>广告信息</title>
|
||||
<!-- css and js -->
|
||||
<%@ include file="../htm/script.jsp" %>
|
||||
<script type="text/javascript">
|
||||
var dt = null;
|
||||
$(function () {
|
||||
//modal初始化
|
||||
myModule.modalInit();
|
||||
//dataTable模块
|
||||
myModule.URL = {
|
||||
dataSourceUrl: "<%=basePath%>page/adInfoData.do",
|
||||
addUrl: "<%=basePath%>page/addAdInfo.do",
|
||||
updateUrl: "<%=basePath%>page/updateAdInfo.do",
|
||||
deleteUrl: "<%=basePath%>page/deleteAdInfo.do",
|
||||
getByIdUrl: "<%=basePath%>page/getAdInfoById.do",
|
||||
};
|
||||
//dataTable
|
||||
dt = myModule.dataTable(true, '#sample-table-2', [
|
||||
{"mData": "adId", "bSortable": false},
|
||||
{"mData": function (adInfo) {
|
||||
return adInfo.isShow == '1' ? '<span class="green">是</span>' : '<span class="red">否</span>';
|
||||
},
|
||||
"bSortable": false
|
||||
},
|
||||
{"mData": function (adInfo) {
|
||||
return $("#adType_" + adInfo.adType).val();
|
||||
},
|
||||
"bSortable": false
|
||||
},
|
||||
{"mData": function (adInfo) {
|
||||
if (adInfo.adImage.indexOf('http') > 1) {
|
||||
return '<img src="' + adInfo.adImage + '" width="50%"/>';
|
||||
} else {
|
||||
return '<img src="<%=picturePath%>Img/adInfo/' + adInfo.adImage + '" width="50%"/>';
|
||||
}
|
||||
|
||||
<body>
|
||||
<!-- 头部 -->
|
||||
<%@ include file="../htm/header.jsp" %>
|
||||
<!-- 主体 -->
|
||||
<div class="main-container" id="main-container">
|
||||
<div class="main-container-inner">
|
||||
<!-- 侧边栏 -->
|
||||
<%@ include file="../htm/sidebar.jsp" %>
|
||||
<!-- 主体内容 -->
|
||||
<div class="main-content">
|
||||
<div class="breadcrumbs" id="breadcrumbs">
|
||||
<script type="text/javascript">
|
||||
try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
|
||||
</script>
|
||||
<ul class="breadcrumb">
|
||||
<li>
|
||||
<i class="icon-home home-icon"></i>
|
||||
<a href="<%=basePath%>page/public/index.do">首页</a>
|
||||
</li>
|
||||
<li class="active">广告信息</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="page-content">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="table-responsive">
|
||||
<c:forEach items="<%=AdTypeEnum.getJson()%>" var="local">
|
||||
<button class="btn btn-primary searchBtn" name="adType" value="${local.key}">${local.value}</button>
|
||||
</c:forEach>
|
||||
<table id="sample-table-2" class="table table-striped table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>显示</th>
|
||||
<th>广告类型</th>
|
||||
<th>广告图</th>
|
||||
<th>广告链接</th>
|
||||
<th>排序</th>
|
||||
<th>更新</th>
|
||||
<th>创建</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<c:forEach items="<%=AdTypeEnum.getJson()%>" var="local">
|
||||
<input type="hidden" id="adType_${local.key}" value="${local.value}"/>
|
||||
</c:forEach>
|
||||
<form action="" enctype="multipart/form-data" class="form-horizontal" method="post" id="form-add">
|
||||
<div class="modal fade" id="addModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="closeBtn close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">新增</h4>
|
||||
</div>
|
||||
<div class="modal-body row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告类型<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<select name="adType" class="form-control">
|
||||
<c:forEach items="<%=AdTypeEnum.getJson()%>" var="local">
|
||||
<option value="${local.key}">${local.value}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告图<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告链接<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="url" name="adLink" class="form-control" maxlength="200" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">是否显示<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<select name="isShow" class="form-control">
|
||||
<c:forEach items="<%=BooleanEnum.getJson()%>" var="local">
|
||||
<option value="${local.key}">${local.value}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">排序号<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="number" name="orderNum" class="form-control" max="99" required/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="closeBtn btn btn-default">关闭</button>
|
||||
<button type="button" id="addSubmitBtn" class="btn btn-primary">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form action="" enctype="multipart/form-data" class="form-horizontal" method="post" id="form-update">
|
||||
<div class="modal fade" id="updateModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="closeBtn close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">修改</h4>
|
||||
</div>
|
||||
<div class="modal-body row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告类型<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="hidden" name="adId" id="adId">
|
||||
<select name="adType" id="adType" class="form-control">
|
||||
<c:forEach items="<%=AdTypeEnum.getJson()%>" var="local">
|
||||
<option value="${local.key}">${local.value}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告图<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="hidden" name="adImage" id="adImage"/>
|
||||
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告链接<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="url" name="adLink" id="adLink" class="form-control" maxlength="200" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">是否显示<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<select name="isShow" id="isShow" class="form-control">
|
||||
<c:forEach items="<%=BooleanEnum.getJson()%>" var="local">
|
||||
<option value="${local.key}">${local.value}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">排序号<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="number" name="orderNum" id="orderNum" class="form-control" max="99" required/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="closeBtn btn btn-default">关闭</button>
|
||||
<button type="button" id="updateSubmitBtn" class="btn btn-primary">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- 设置工具 -->
|
||||
<%@ include file="../htm/setting.jsp" %>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
},
|
||||
"bSortable": false
|
||||
},
|
||||
{"mData": function (adInfo) {
|
||||
return '<a href="' + adInfo.adLink + '" target="_blank">' + adInfo.adLink + '</a>';
|
||||
},
|
||||
"bSortable": false
|
||||
},
|
||||
{"mData": "orderNum", "bSortable": false},
|
||||
{"mData": "updateTime", "bSortable": false},
|
||||
{"mData": "createTime", "bSortable": false},
|
||||
{"mData": function (adInfo) {
|
||||
return '<a href="javascript:void(0);" onclick="findById(this,' + adInfo.adId + ');" class="label label-primary"><i class="icon-edit"></i></a> '
|
||||
+ '<a href="javascript:void(0);" onclick="deleteById(this,' + adInfo.adId + ');" class="label label-danger"><i class="icon-trash"></i></a>';
|
||||
},
|
||||
"bSortable": false,
|
||||
"sClass": "center"
|
||||
}
|
||||
]);
|
||||
$("#sample-table-2_length").append(' 是否显示:<select name="isShow" class="input-xlarge searchClass">'
|
||||
+ '<option value="">请选择</option>'
|
||||
+ '<c:forEach items="<%=BooleanEnum.getJson()%>" var="local">'
|
||||
+ '<option value="${local.key}">${local.value}</option>'
|
||||
+ '</c:forEach>'
|
||||
+ '</select>'
|
||||
);
|
||||
$(".searchBtn").click(function () {
|
||||
$("button[name='adType']").removeClass("searchClass");
|
||||
$(this).addClass("searchClass");
|
||||
dt.fnDraw();
|
||||
});
|
||||
//自动查询
|
||||
$(".searchClass").change(function () {
|
||||
dt.fnDraw();
|
||||
});
|
||||
//异步提交新增表单
|
||||
myModule.addAjaxFrom("#addSubmitBtn", '#form-add', dt);
|
||||
//异步提交修改表单
|
||||
myModule.updateAjaxFrom("#updateSubmitBtn", '#form-update', dt);
|
||||
});
|
||||
//修改
|
||||
function findById(el, adId) {
|
||||
//重置表单
|
||||
$("#form-update").data('bootstrapValidator').resetForm(true);
|
||||
//数据
|
||||
var jsonData = {"adId": adId};
|
||||
//赋值属性
|
||||
var columns = ["adId", "adType", "adLink", "isShow", "adImage", "orderNum"];
|
||||
myModule.findByIdFunction(el, '#updateModal', jsonData, columns);
|
||||
}
|
||||
//删除
|
||||
function deleteById(el, adId) {
|
||||
var jsonData = {"adId": adId};
|
||||
myModule.deleteFunction(el, jsonData, dt);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- 头部 -->
|
||||
<%@ include file="../htm/header.jsp" %>
|
||||
<!-- 主体 -->
|
||||
<div class="main-container" id="main-container">
|
||||
<div class="main-container-inner">
|
||||
<!-- 侧边栏 -->
|
||||
<%@ include file="../htm/sidebar.jsp" %>
|
||||
<!-- 主体内容 -->
|
||||
<div class="main-content">
|
||||
<div class="breadcrumbs" id="breadcrumbs">
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
ace.settings.check('breadcrumbs', 'fixed')
|
||||
} catch (e) {
|
||||
}
|
||||
</script>
|
||||
<ul class="breadcrumb">
|
||||
<li>
|
||||
<i class="icon-home home-icon"></i>
|
||||
<a href="<%=basePath%>page/public/index.do">首页</a>
|
||||
</li>
|
||||
<li class="active">广告信息</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="page-content">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="table-responsive">
|
||||
<c:forEach items="<%=AdTypeEnum.getJson()%>" var="local">
|
||||
<button class="btn btn-primary searchBtn" name="adType" value="${local.key}">${local.value}</button>
|
||||
</c:forEach>
|
||||
<table id="sample-table-2" class="table table-striped table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>显示</th>
|
||||
<th>广告类型</th>
|
||||
<th>广告图</th>
|
||||
<th>广告链接</th>
|
||||
<th>排序</th>
|
||||
<th>更新</th>
|
||||
<th>创建</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<c:forEach items="<%=AdTypeEnum.getJson()%>" var="local">
|
||||
<input type="hidden" id="adType_${local.key}" value="${local.value}"/>
|
||||
</c:forEach>
|
||||
<form action="" enctype="multipart/form-data" class="form-horizontal" method="post" id="form-add">
|
||||
<div class="modal fade" id="addModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="closeBtn close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">新增</h4>
|
||||
</div>
|
||||
<div class="modal-body row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告类型<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<select name="adType" class="form-control">
|
||||
<c:forEach items="<%=AdTypeEnum.getJson()%>" var="local">
|
||||
<option value="${local.key}">${local.value}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告图<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告链接<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="url" name="adLink" class="form-control" maxlength="200" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">是否显示<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<select name="isShow" class="form-control">
|
||||
<c:forEach items="<%=BooleanEnum.getJson()%>" var="local">
|
||||
<option value="${local.key}">${local.value}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">排序号<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="number" name="orderNum" class="form-control" max="99" required/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="closeBtn btn btn-default">关闭</button>
|
||||
<button type="button" id="addSubmitBtn" class="btn btn-primary">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form action="" enctype="multipart/form-data" class="form-horizontal" method="post" id="form-update">
|
||||
<div class="modal fade" id="updateModal">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="closeBtn close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title">修改</h4>
|
||||
</div>
|
||||
<div class="modal-body row">
|
||||
<div class="col-xs-12">
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告类型<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="hidden" name="adId" id="adId">
|
||||
<select name="adType" id="adType" class="form-control">
|
||||
<c:forEach items="<%=AdTypeEnum.getJson()%>" var="local">
|
||||
<option value="${local.key}">${local.value}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告图<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="hidden" name="adImage" id="adImage"/>
|
||||
<input type="file" name="fileUpload" accept="image/png,image/jpg,image/jpeg" class="form-control"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">广告链接<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="url" name="adLink" id="adLink" class="form-control" maxlength="200" required/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">是否显示<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<select name="isShow" id="isShow" class="form-control">
|
||||
<c:forEach items="<%=BooleanEnum.getJson()%>" var="local">
|
||||
<option value="${local.key}">${local.value}</option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-3 control-label no-padding-right">排序号<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-7">
|
||||
<input type="number" name="orderNum" id="orderNum" class="form-control" max="99" required/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="closeBtn btn btn-default">关闭</button>
|
||||
<button type="button" id="updateSubmitBtn" class="btn btn-primary">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- 设置工具 -->
|
||||
<%@ include file="../htm/setting.jsp" %>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,26 +1,24 @@
|
|||
<%@page import="com.ifish.util.IfishFileDirectory"%>
|
||||
<%@ page language="java" pageEncoding="utf-8"%>
|
||||
<%
|
||||
String basePath = "";
|
||||
String picturePath = "";
|
||||
String IMPath = "";
|
||||
String basePath = "";
|
||||
String picturePath = "";
|
||||
String IMPath = "";
|
||||
//本地环境
|
||||
if(IfishFileDirectory.env.equals("local")){
|
||||
basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
|
||||
picturePath = request.getScheme()+"://"+request.getServerName()+":81/";
|
||||
}
|
||||
//测试环境
|
||||
else if(IfishFileDirectory.env.equals("test")){
|
||||
basePath = "https://"+request.getServerName()+"/";
|
||||
picturePath = "https://"+request.getServerName()+"/";
|
||||
IMPath = "http://www.zhangxinyanv5.top/neteaseIM/im/index.html";
|
||||
}
|
||||
//正式环境
|
||||
else if(IfishFileDirectory.env.equals("product")){
|
||||
basePath = "https://"+request.getServerName()+"/";
|
||||
picturePath = "https://"+request.getServerName()+"/";
|
||||
IMPath = "https://www.ifish7.com/neteaseIM/im/index.html";
|
||||
}
|
||||
if (IfishFileDirectory.env.equals("local")) {
|
||||
basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
|
||||
picturePath = request.getScheme() + "://" + request.getServerName() + ":81/";
|
||||
} //测试环境
|
||||
else if (IfishFileDirectory.env.equals("test")) {
|
||||
basePath = "http://139.196.24.156:83/";
|
||||
picturePath = "http://139.196.24.156:83/";
|
||||
IMPath = "http://www.zhangxinyanv5.top/neteaseIM/im/index.html";
|
||||
} //正式环境
|
||||
else if (IfishFileDirectory.env.equals("product")) {
|
||||
basePath = "https://" + request.getServerName() + "/";
|
||||
picturePath = "https://" + request.getServerName() + "/";
|
||||
IMPath = "https://www.ifish7.com/neteaseIM/im/index.html";
|
||||
}
|
||||
//https
|
||||
%>
|
||||
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
<%--
|
||||
Document : test
|
||||
Created on : 2017-9-21, 22:38:06
|
||||
Author : Administrator
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>JSP Page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
<form action="test" method="post" enctype="multipart/form-data">
|
||||
<input type="file" name="file" /> <input type="submit" value="Submit" /></form>
|
||||
|
||||
<h1>${status}</h1>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue