提交 0d9f2d0c authored 作者: 林海冰's avatar 林海冰

初始化项目

上级 db146b6c
<<<<<<< HEAD
package com.mall.controller.tongmeng.oneclassfy;
import java.text.DateFormat;
......@@ -179,187 +178,3 @@ public class OneClassfyController extends BaseController {
binder.registerCustomEditor(Date.class, new CustomDateEditor(format,true));
}
}
=======
package com.mall.controller.tongmeng.oneclassfy;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.mall.controller.base.BaseController;
import com.mall.entity.Page;
import com.mall.service.mengbeng.oneclassfy.OneClassfyManager;
import com.mall.util.Jurisdiction;
import com.mall.util.OssUtil;
import com.mall.util.PageData;
import com.mall.util.ResultOutDto;
/**
* 说明:一级菜单
* 创建时间:2018-12-05
*/
@Controller
@RequestMapping(value="/oneclassfy")
public class OneClassfyController extends BaseController {
String menuUrl = "oneclassfy/list.do"; //菜单地址(权限用)
@Resource(name="oneclassfyService")
private OneClassfyManager oneclassfyService;
/**保存
* @param
* @throws Exception
*/
@RequestMapping(value="/save")
public ModelAndView save(HttpServletRequest request,MultipartFile file) throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"新增TwoClassfy");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限
ModelAndView mv = this.getModelAndView();
PageData dbContent = new PageData();
dbContent.put("NAME", request.getParameter("NAME"));
String icomPath =OssUtil.upload(file);
if(icomPath!="fail"){
dbContent.put("ICOM", icomPath);
}else {
dbContent.put("ICOM",request.getParameter("ICOM"));
}
dbContent.put("ONE_CLASSFY_TAG", request.getParameter("ONE_CLASSFY_TAG"));
oneclassfyService.save(dbContent);
mv.addObject("msg","success");
mv.setViewName("save_result");
return mv;
}
/**删除
* @param out
* @throws Exception
*/
@ResponseBody
@RequestMapping(value="/delete",produces="application/json;charset=UTF-8")
public ResultOutDto delete() throws Exception{
// logBefore(logger, Jurisdiction.getUsername()+"删除OneClassfy");
// if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return null;} //校验权限
// PageData pd = new PageData();
// pd = this.getPageData();
// PageData oneClassfy=oneclassfyService.findById(pd);
// List<PageData> listPd = twoclassfyService.findByOneClassfy(oneClassfy.get("CLASSIFY_ID").toString());
// List<PageData> dataList =homedescribeService.findbyOneClassfy(oneClassfy.get("CLASSIFY_ID").toString());
// if(listPd.size()<=0 && dataList.size()<=0){
// oneclassfyService.delete(pd);
// return ResultOutDto.ok();
// }else if(listPd.size()>0){
// return ResultOutDto.err(null,"该菜单存在二级菜单!请先删除二级再重新删除!" );
// }else{
// return ResultOutDto.err(null,"该菜单存在详情内容!请先删除详情内容再重新删除!" );
// }
//
return null;
}
/**修改
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
public ModelAndView edit(HttpServletRequest request,MultipartFile file) throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"修改OneClassfy");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "edit")){return null;} //校验权限
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
String icomPath ="fail";
if(file.getSize()>0){
icomPath =OssUtil.upload(file);
pd.put("ICOM", icomPath);
}else{
pd.put("ICOM",request.getParameter("ICOM"));
}
pd.put("ONE_CLASSFY_TAG", request.getParameter("ONE_CLASSFY_TAG"));
pd.put("CLASSIFY_ID",request.getParameter("CLASSIFY_ID"));
pd.put("NAME",request.getParameter("NAME"));
oneclassfyService.edit(pd);
mv.addObject("msg","success");
mv.setViewName("save_result");
return mv;
}
/**列表
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
public ModelAndView list(Page page) throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"列表OneClassfy");
//if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码)
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
String keywords = pd.getString("keywords"); //关键词检索条件
if(null != keywords && !"".equals(keywords)){
pd.put("keywords", keywords.trim());
}
page.setPd(pd);
List<PageData> varList = oneclassfyService.list(page); //列出OneClassfy列表
mv.setViewName("vehicle/oneclassfy/oneclassfy_list");
mv.addObject("varList", varList);
mv.addObject("pd", pd);
mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
return mv;
}
/**去新增页面
* @param
* @throws Exception
*/
@RequestMapping(value="/goAdd")
public ModelAndView goAdd()throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
mv.setViewName("vehicle/oneclassfy/oneclassfy_edit");
mv.addObject("msg", "save");
mv.addObject("pd", pd);
return mv;
}
/**去修改页面
* @param
* @throws Exception
*/
@RequestMapping(value="/goEdit")
public ModelAndView goEdit()throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
pd = oneclassfyService.findById(pd); //根据ID读取
mv.setViewName("vehicle/oneclassfy/oneclassfy_edit");
mv.addObject("msg", "edit");
mv.addObject("pd", pd);
return mv;
}
@InitBinder
public void initBinder(WebDataBinder binder){
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(format,true));
}
}
>>>>>>> branch 'master' of http://code.diaosaas.com/linhaibing/tongmeng-app.git
<<<<<<< HEAD
package com.mall.controller.tongmeng.store;
import com.mall.controller.base.BaseController;
......@@ -234,246 +233,3 @@ public class StoreController extends BaseController {
binder.registerCustomEditor(Date.class, new CustomDateEditor(format,true));
}
}
=======
package com.mall.controller.tongmeng.store;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.mall.controller.base.BaseController;
import com.mall.entity.Page;
import com.mall.service.mengbeng.store.StoreManager;
import com.mall.util.AppUtil;
import com.mall.util.Jurisdiction;
import com.mall.util.ObjectExcelView;
import com.mall.util.PageData;
/**
* 说明:小程序用户
* 创建时间:2018-12-04
*/
@Controller
@RequestMapping(value="/store")
public class StoreController extends BaseController {
String menuUrl = "user/list.do"; //菜单地址(权限用)
@Resource(name="storeService")
private StoreManager storeService;
/**保存
* @param
* @throws Exception
*/
@RequestMapping(value="/save")
public ModelAndView save() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"新增Appuser");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
storeService.save(pd);
mv.addObject("msg","success");
mv.setViewName("save_result");
return mv;
}
/**删除
* @param out
* @throws Exception
*/
@RequestMapping(value="/delete")
public void delete(PrintWriter out) throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"删除Appuser");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return;} //校验权限
PageData pd = new PageData();
pd = this.getPageData();
storeService.delete(pd);
out.write("success");
out.close();
}
/**修改
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
public ModelAndView edit() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"修改Appuser");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "edit")){return null;} //校验权限
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
storeService.edit(pd);
mv.addObject("msg","success");
mv.setViewName("save_result");
return mv;
}
/**列表
* @param page
* @throws Exception
*/
@RequestMapping(value="/list")
public ModelAndView list(Page page) throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"列表Appuser");
//if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;} //校验权限(无权查看时页面会有提示,如果不注释掉这句代码就无法进入列表页面,所以根据情况是否加入本句代码)
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
String keywords = pd.getString("keywords"); //关键词检索条件
if(null != keywords && !"".equals(keywords)){
pd.put("keywords", keywords.trim());
}
page.setPd(pd);
List<PageData> varList = storeService.list(page); //列出Appuser列表
mv.setViewName("vehicle/appuser/appuser_list");
mv.addObject("varList", varList);
mv.addObject("pd", pd);
mv.addObject("QX",Jurisdiction.getHC()); //按钮权限
return mv;
}
/**去新增页面
* @param
* @throws Exception
*/
@RequestMapping(value="/goAdd")
public ModelAndView goAdd()throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
mv.setViewName("vehicle/appuser/appuser_edit");
mv.addObject("msg", "save");
mv.addObject("pd", pd);
return mv;
}
/**去修改页面
* @param
* @throws Exception
*/
@RequestMapping(value="/goEdit")
public ModelAndView goEdit()throws Exception{
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
pd = storeService.findById(pd); //根据ID读取
mv.setViewName("vehicle/appuser/appuser_edit");
mv.addObject("msg", "edit");
mv.addObject("pd", pd);
return mv;
}
/**批量删除
* @param
* @throws Exception
*/
@RequestMapping(value="/deleteAll")
@ResponseBody
public Object deleteAll() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"批量删除Appuser");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return null;} //校验权限
PageData pd = new PageData();
Map<String,Object> map = new HashMap<String,Object>();
pd = this.getPageData();
List<PageData> pdList = new ArrayList<PageData>();
String DATA_IDS = pd.getString("DATA_IDS");
if(null != DATA_IDS && !"".equals(DATA_IDS)){
String ArrayDATA_IDS[] = DATA_IDS.split(",");
storeService.deleteAll(ArrayDATA_IDS);
pd.put("msg", "ok");
}else{
pd.put("msg", "no");
}
pdList.add(pd);
map.put("list", pdList);
return AppUtil.returnObject(pd, map);
}
/**导出到excel
* @param
* @throws Exception
*/
@RequestMapping(value="/excel")
public ModelAndView exportExcel() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"导出Appuser到excel");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "cha")){return null;}
ModelAndView mv = new ModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
Map<String,Object> dataMap = new HashMap<String,Object>();
List<String> titles = new ArrayList<String>();
titles.add("用户openID"); //3
titles.add("昵称"); //8
titles.add("性别"); //1
titles.add("手机号"); //2
titles.add("最近登录地址"); //2
titles.add("省"); //2
titles.add("市"); //2
titles.add("区"); //2
titles.add("注册时间"); //9
dataMap.put("titles", titles);
List<PageData> varOList = storeService.listAll(pd);
List<PageData> varList = new ArrayList<PageData>();
String genderStr = null;
for(int i=0;i<varOList.size();i++){
if(varOList.get(i).get("gender")==null||"null".equals(varOList.get(i).get("gender"))){
genderStr = "未知";
}else{
switch (Integer.valueOf(varOList.get(i).get("gender").toString())) {
case 1:
genderStr= "男";
break;
case 2:
genderStr= "女";
break;
default:
genderStr = "未知";
break;
}
}
PageData vpd = new PageData();
vpd.put("var1", varOList.get(i).get("openid").toString()); //1
vpd.put("var2", varOList.get(i).get("nickname")==null?"":varOList.get(i).get("nickname").toString()); //2
vpd.put("var3", genderStr); //3
vpd.put("var4", varOList.get(i).get("mobile")==null?"":varOList.get(i).get("nickname").toString()); //4
vpd.put("var5", varOList.get(i).get("loginAddrss")==null?"":varOList.get(i).get("loginAddrss").toString());
vpd.put("var6", varOList.get(i).get("province")==null?"":varOList.get(i).get("province").toString());
vpd.put("var7", varOList.get(i).get("city")==null?"":varOList.get(i).get("city").toString());
vpd.put("var8", varOList.get(i).get("area")==null?"":varOList.get(i).get("area").toString());
vpd.put("var9", varOList.get(i).get("create_time")==null?"":varOList.get(i).get("create_time").toString()); //5
varList.add(vpd);
}
dataMap.put("varList", varList);
ObjectExcelView erv = new ObjectExcelView();
mv = new ModelAndView(erv,dataMap);
return mv;
}
@InitBinder
public void initBinder(WebDataBinder binder){
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(format,true));
}
}
>>>>>>> branch 'master' of http://code.diaosaas.com/linhaibing/tongmeng-app.git
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论