提交 1403ae66 authored 作者: 林海冰's avatar 林海冰

一级分类列表,店铺列表,访问列表

上级 8cc3fd66
package com.mall.controller.api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.mall.util.OssUtil;
import com.mall.util.ResultOutDto;
/**
* ClassName:CommonApiController <br/>
* Function: TODO ADD FUNCTION. <br/>
* Reason: TODO ADD REASON. <br/>
* Date: 2019年1月16日 下午3:59:02 <br/>
* @author 林海冰
* @version 广州抵奥云信息科技有限公司
* @since JDK 1.8
* @see
*/
@RestController
@RequestMapping(value="/api/commont",produces="application/json;charset=UTF-8")
public class CommonApiController {
/**
* 上传资料
* https://www.cnblogs.com/dengfukui/p/6252798.html
*/
@ResponseBody
@RequestMapping(value="/photo")
public ResultOutDto singlePhoto(MultipartFile photo) {
try {
if (photo==null|| photo.getSize()<=0) {
return ResultOutDto.err("facePhoto传递参数缺少。。。", null);
}
String url = OssUtil.upload(photo);
return ResultOutDto.ok(url);
} catch (Exception e) {
e.printStackTrace();
return ResultOutDto.err("上传异常,请稍后重试", null);
}
}
}
package com.mall.controller.api;
import javax.annotation.Resource;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mall.service.mengbeng.store.StoreManager;
import com.mall.util.DateHelper;
import com.mall.util.DateUtil;
import com.mall.util.PageData;
import com.mall.util.ResultOutDto;
import com.mall.util.UuidUtil;
/**
* ClassName:BannerApiController <br/>
* Function: TODO ADD FUNCTION. <br/>
* Reason: TODO ADD REASON. <br/>
* Date: 2018年12月14日 上午10:09:38 <br/>
* @author 林海冰
* @version 广州抵奥云信息科技有限公司
* @since JDK 1.8
* @see
*/
@RestController
@RequestMapping(value="/api/store",produces="application/json;charset=UTF-8")
public class StoreApiController {
@Resource(name="storeService")
private StoreManager storeService;
@RequestMapping(value="/registerStore")
public ResultOutDto registerStore(String name,String telephone,String phone,String storeName ,Integer storeType,
String type, String address,String nickname,String wxNumber ,String qqNumber,String icomUrl,String payType ){
if(StringUtils.isEmpty(name)||StringUtils.isEmpty(telephone)||StringUtils.isEmpty(storeType)||StringUtils.isEmpty(storeName)||StringUtils.isEmpty(storeType)||StringUtils.isEmpty(type)||StringUtils.isEmpty(icomUrl)){
return ResultOutDto.err(null, "注册失败!参数缺失!");
}
try {
PageData pd = new PageData();
pd.put("store_id", UuidUtil.get32UUID());
pd.put("real_name", name);
pd.put("telephone", telephone);
pd.put("mobile", phone);
pd.put("store_name", storeName);
pd.put("one_classfy_id", storeType);
// pd.put("type", type);
pd.put("store_address", address);
pd.put("nickname", nickname);
pd.put("wx_muner", wxNumber);
pd.put("qq_munber", qqNumber);
pd.put("store_logo", icomUrl);
pd.put("gender", 0);//性别
pd.put("create_time", DateUtil.getDay()); //创建时间
pd.put("end_valid_time", 0); //到期时间
//pd.put("payType", payType);
storeService.save(pd);
return ResultOutDto.ok();
} catch (Exception e) {
e.printStackTrace();
return ResultOutDto.err("注册异常!");
}
}
/**
* 访问店铺
* @author LHB
* @since JDK 1.8
*/
@RequestMapping(value="/viewedStore")
public ResultOutDto viewedStore(String view_store_id,String viewed_store_id){
if(StringUtils.isEmpty(view_store_id)||StringUtils.isEmpty(viewed_store_id)){
return ResultOutDto.err(null, "参数缺失!");
}
try {
PageData pd = new PageData();
pd.put("view_store_id", view_store_id);
pd.put("viewed_store_id", viewed_store_id);
pd.put("view_time", DateHelper.getCurrDateTime());
storeService.viewStore(pd);
return ResultOutDto.ok();
} catch (Exception e) {
return ResultOutDto.err("访问异常!");
}
}
}
package com.mall.controller.tongmeng.viewstore;
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.viewstore.ViewStoreManager;
import com.mall.util.AppUtil;
import com.mall.util.Jurisdiction;
import com.mall.util.ObjectExcelView;
import com.mall.util.PageData;
/**
* 说明:访问记录
* 创建时间:2019-01-16
*/
@Controller
@RequestMapping(value="/viewstore")
public class ViewStoreController extends BaseController {
String menuUrl = "viewstore/list.do"; //菜单地址(权限用)
@Resource(name="viewstoreService")
private ViewStoreManager viewstoreService;
/**保存
* @param
* @throws Exception
*/
@RequestMapping(value="/save")
public ModelAndView save() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"新增ViewStore");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "add")){return null;} //校验权限
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
viewstoreService.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()+"删除ViewStore");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "del")){return;} //校验权限
PageData pd = new PageData();
pd = this.getPageData();
viewstoreService.delete(pd);
out.write("success");
out.close();
}
/**修改
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
public ModelAndView edit() throws Exception{
logBefore(logger, Jurisdiction.getUsername()+"修改ViewStore");
if(!Jurisdiction.buttonJurisdiction(menuUrl, "edit")){return null;} //校验权限
ModelAndView mv = this.getModelAndView();
PageData pd = new PageData();
pd = this.getPageData();
viewstoreService.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()+"列表ViewStore");
//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 = viewstoreService.list(page); //列出ViewStore列表
mv.setViewName("tongmeng/viewstore/viewstore_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("tongmeng/viewstore/viewstore_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 = viewstoreService.findById(pd); //根据ID读取
mv.setViewName("tongmeng/viewstore/viewstore_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()+"批量删除ViewStore");
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(",");
viewstoreService.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()+"导出ViewStore到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("备注1"); //1
titles.add("访店"); //2
titles.add("被访"); //3
dataMap.put("titles", titles);
List<PageData> varOList = viewstoreService.listAll(pd);
List<PageData> varList = new ArrayList<PageData>();
for(int i=0;i<varOList.size();i++){
PageData vpd = new PageData();
vpd.put("var1", varOList.get(i).get("VIEW_STORE_ID").toString()); //1
vpd.put("var2", varOList.get(i).get("VIEWED_STORE_ID").toString()); //2
vpd.put("var3", varOList.get(i).getString("VIEW_TIME")); //3
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));
}
}
......@@ -17,7 +17,7 @@ public interface StoreManager{
* @param pd
* @throws Exception
*/
public int save(PageData pd)throws Exception;
public void save(PageData pd)throws Exception;
/**删除
* @param pd
......@@ -61,6 +61,8 @@ public interface StoreManager{
*/
public int findByPhone(PageData pd)throws Exception;
public void viewStore(PageData pd)throws Exception;
}
......@@ -6,10 +6,12 @@ import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.mall.dao.DaoSupport;
import com.mall.entity.Page;
import com.mall.service.mengbeng.store.StoreManager;
import com.mall.service.mengbeng.viewstore.ViewStoreManager;
import com.mall.util.PageData;
/**
......@@ -19,7 +21,8 @@ import com.mall.util.PageData;
*/
@Service("storeService")
public class StoreService implements StoreManager{
@Resource(name="viewstoreService")
private ViewStoreManager viewstoreService;
@Resource(name = "daoSupport")
private DaoSupport dao;
......@@ -27,8 +30,10 @@ public class StoreService implements StoreManager{
* @param pd
* @throws Exception
*/
public int save(PageData pd)throws Exception{
return (int) dao.save("StoreManager.save", pd);
@Transactional
public void save(PageData pd)throws Exception{
dao.save("StoreManager.save", pd);
dao.save("StoreManager.saveDesc", pd);
}
/**删除
......@@ -90,6 +95,25 @@ public class StoreService implements StoreManager{
public int findByPhone(PageData pd) throws Exception {
return (int) dao.findForObject("StoreManager.findByPhone", pd);
}
@Override
@Transactional
public void viewStore(PageData pd) throws Exception {
//保存访问记录
viewstoreService.save(pd);
//自己看其他店铺
PageData viewStore = new PageData();
viewStore.put("store_id", pd.get("view_store_id"));
viewStore = findById(pd);
int view_number =(int)viewStore.get("view_number")+1;
viewStore.put("view_number",view_number);
//别人看我的店铺
PageData viewedStore = new PageData();
viewedStore.put("store_id", pd.get("viewed_store_id"));
viewedStore = findById(pd);
int store_view_number =(int)viewedStore.get("store_view_number")+1;
viewedStore.put("store_view_number",store_view_number);
}
}
package com.mall.service.mengbeng.viewstore;
import java.util.List;
import com.mall.entity.Page;
import com.mall.util.PageData;
/**
* 说明: 访问记录 接口
* 创建时间:2019-01-16
* @version
*/
public interface ViewStoreManager{
/**新增
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
/**删除
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception;
/**修改
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**列表
* @param page
* @throws Exception
*/
public List<PageData> list(Page page)throws Exception;
/**列表(全部)
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**通过id获取数据
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception;
/**批量删除
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
/**
* 访问人总数
* @author LHB
* @since JDK 1.8
*/
public PageData viewStoreCount(PageData pd)throws Exception;
/**
* 被访问人总数
* @author LHB
* @since JDK 1.8
*/
public PageData viewStoreedCount(PageData pd)throws Exception;
}
package com.mall.service.mengbeng.viewstore.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.mall.dao.DaoSupport;
import com.mall.entity.Page;
import com.mall.service.mengbeng.viewstore.ViewStoreManager;
import com.mall.util.PageData;
/**
* 说明: 访问记录
* 创建时间:2019-01-16
* @version
*/
@Service("viewstoreService")
public class ViewStoreService implements ViewStoreManager{
@Resource(name = "daoSupport")
private DaoSupport dao;
/**新增
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
dao.save("ViewStoreMapper.save", pd);
}
/**删除
* @param pd
* @throws Exception
*/
public void delete(PageData pd)throws Exception{
dao.delete("ViewStoreMapper.delete", pd);
}
/**修改
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception{
dao.update("ViewStoreMapper.edit", pd);
}
/**列表
* @param page
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<PageData> list(Page page)throws Exception{
return (List<PageData>)dao.findForList("ViewStoreMapper.datalistPage", page);
}
/**列表(全部)
* @param pd
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<PageData> listAll(PageData pd)throws Exception{
return (List<PageData>)dao.findForList("ViewStoreMapper.listAll", pd);
}
/**通过id获取数据
* @param pd
* @throws Exception
*/
public PageData findById(PageData pd)throws Exception{
return (PageData)dao.findForObject("ViewStoreMapper.findById", pd);
}
/**批量删除
* @param ArrayDATA_IDS
* @throws Exception
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception{
dao.delete("ViewStoreMapper.deleteAll", ArrayDATA_IDS);
}
/**
* 访问人总数
* @author LHB
* @since JDK 1.8
*/
public PageData viewStoreCount(PageData pd)throws Exception{
return (PageData) dao.findForObject("ViewStoreMapper.viewStoreCount", pd);
}
/**
* 被访问人总数
* @author LHB
* @since JDK 1.8
*/
public PageData viewStoreedCount(PageData pd)throws Exception{
return (PageData) dao.findForObject("ViewStoreMapper.viewStoreedCount", pd);
}
}
......@@ -27,7 +27,7 @@ public class OssUtil {
//阿里云API的bucket名称
private static final String BACKET_NAME="diaosaas-prod";
//阿里云API的文件夹名称
private static final String FOLDER="vehicle/";
private static final String FOLDER="tongmeng/";
/**
......
......@@ -49,4 +49,11 @@ public class ResultOutDto implements Serializable{
resultOutDto.setErrmsg(err);
return resultOutDto;
}
public static ResultOutDto err(String err){
ResultOutDto resultOutDto = new ResultOutDto();
resultOutDto.setFlag(flag_fail);
resultOutDto.setData(null);
resultOutDto.setErrmsg(err);
return resultOutDto;
}
}
......@@ -48,35 +48,56 @@
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
c_store(
store_id,
gender,
mobile,
real_name,
store_logo,
nickname,
create_time,
store_name,
end_valid_time,
wx_muner,
qq_munber,
one_classfy_id)
values (
#{store_id},
#{gender},
#{mobile},
#{real_name},
#{store_logo},
#{nickname},
#{create_time},
#{store_name},
#{end_valid_time},
#{wx_muner},
#{qq_munber},
#{one_classfy_id}
)
</insert>
<insert id="saveDesc" parameterType="pd">
insert into
gender,
mobile,
real_name,
store_logo,
nickname,
create_time,
store_name,
end_valid_time,
wx_muner,
qq_munber,
one_classfy_id
c_store_desc
(
<include refid="Field"></include>
) values (
#{gender},
#{mobile},
#{real_name},
#{store_logo},
#{nickname},
#{create_time},
#{store_name},
#{end_valid_time},
#{wx_muner},
#{qq_munber},
#{one_classfy_id}
store_address,
weeks_number,
works_date,
remarks,
store_id
)
values (
#{store_address},
#{weeks_number},
#{works_date},
#{remarks},
#{store_id}
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
delete from
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="ViewStoreMapper">
<!--表名 -->
<sql id="tableName">
c_view_log
</sql>
<!-- 字段 -->
<sql id="Field">
view_store_id,
view_time,
viewed_store_id
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{view_store_id},
#{viewed_store_id},
#{view_time}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
where 1=1
<if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
and
(
<!-- 根据需求自己加检索条件
字段1 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
or
字段2 LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
-->
)
</if>
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
</select>
<!-- 访问人的总数 -->
<select id="viewStoreCount" parameterType="pd" resultType="pd">
select
count(view_store_id)
from
<include refid="tableName"></include>
where view_store_id = #{view_store_id}
</select>
<!-- 被访问人的总数 -->
<select id="viewStoreedCount" parameterType="pd" resultType="pd">
select
count(viewed_store_id)
from
<include refid="tableName"></include>
where viewed_store_id = #{viewed_store_id}
</select>
</mapper>
\ No newline at end of file
......@@ -104,16 +104,7 @@
$("#name").focus();
return false;
}
if($("#icom").val()==""){
$("#icom").tips({
side:3,
msg:'请输入分类图标',
bg:'#AE81FF',
time:2
});
$("#icom").focus();
return false;
}
$("#Form").submit();
$("#zhongxin").hide();
$("#zhongxin2").show();
......
......@@ -72,7 +72,7 @@
<th class="center">一级分类ID</th>
<th class="center">名称</th>
<th class="center">分类图标</th>
<th class="center">二级分类标识</th>
<!-- <th class="center">二级分类标识</th> -->
<th class="center">操作</th>
</tr>
</thead>
......@@ -91,8 +91,8 @@
<td class='center'>${var.classify_id}</td>
<td class='center'>${var.name}</td>
<td class='center'><img src="${var.icom}" width="50px" height="50px"/></td>
<td class='center'>${var.one_classfy_tag=='3'?'二级分类':''}${var.one_classfy_tag=='2'?'车牌分类':''}</td>
<td class="center">
<%-- <td class='center'>${var.one_classfy_tag=='3'?'二级分类':''}${var.one_classfy_tag=='2'?'车牌分类':''}</td>
--%> <td class="center">
<c:if test="${QX.edit != 1 && QX.del != 1 }">
<span class="label label-large label-grey arrowed-in-right arrowed-in"><i class="ace-icon fa fa-lock" title="无权限"></i></span>
</c:if>
......
......@@ -93,7 +93,7 @@
<label class="pos-rel"><input type='checkbox' name='ids' value="${var.openid}" class="ace" /><span class="lbl"></span></label>
</td>
<td class='center' style="width: 30px;">${vs.index+1}</td>
<td class='center'><img src="${var.headportrait}" style="height:50px"></td>
<td class='center'><img src="${var.store_logo}" style="height:50px"></td>
<td class='center'>${var.nickname}</td>
<td class='center'>
<c:choose>
......@@ -113,11 +113,11 @@
</td>
<td class='center'>${var.mobile}</td>
<%-- <td class='center'>${var.openid}</td>--%>
<td class='center'>${var.name}</td>
<td class='center'>${var.real_name}</td>
<%--<td class='center'>${var.birthday}</td>--%>
<td class='center'><fmt:formatDate value="${var.create_time}" pattern="yyyy-MM-dd"/> </td>
<td class="center">
<td class='center'>${var.create_time}</td>
<%-- <td class='center'><fmt:formatDate value="${var.create_time}" pattern="yyyy-MM-dd"/> </td>
--%> <td class="center">
<!--
<c:if test="${QX.edit != 1 && QX.del != 1 }">
<span class="label label-large label-grey arrowed-in-right arrowed-in"><i class="ace-icon fa fa-lock" title="无权限"></i></span>
......@@ -166,7 +166,6 @@
</div>
</td>
</tr>
</c:forEach>
</c:if>
<c:if test="${QX.cha == 0 }">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论