添加设备,添加摄像头,删除设备
This commit is contained in:
parent
c437a22eb1
commit
58f923f8b4
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.controller;
|
||||
|
||||
import com.ifish.bean.Tbl_Device_User;
|
||||
import com.ifish.helper.DeviceHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Controller
|
||||
public class Device {
|
||||
|
||||
@Autowired
|
||||
private DeviceHelper deviceHelper;
|
||||
|
||||
/**
|
||||
* 用户详情页面绑定设备
|
||||
*
|
||||
* @param userId
|
||||
* @param deviceMac
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/bindDevice", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object bindDevice(Integer userId, String deviceMac) {
|
||||
return deviceHelper.bindDevice(userId, deviceMac);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户详情页面绑定摄像头
|
||||
*
|
||||
* @param userId
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/bindCamera", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object bindCamera(Integer userId, String cameraId) {
|
||||
return deviceHelper.bindCamera(userId, cameraId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户详情页解除绑定设备
|
||||
*
|
||||
* @param userId
|
||||
* @param deviceMac
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteDeviceUser", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object deleteDeviceUser(Tbl_Device_User deviceUser) {
|
||||
return deviceHelper.deleteDeviceUser(deviceUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除绑定的摄像头
|
||||
*
|
||||
* @param deviceUser
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/deleteCameraUser", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object deleteCameraUser(Integer userId, String cameraId) {
|
||||
return deviceHelper.bindDevice(userId, cameraId);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.ifish.controller;
|
||||
|
||||
import com.ifish.helper.PushMessageHelperI;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Controller
|
||||
public class PushMessage {
|
||||
|
||||
@Autowired
|
||||
private PushMessageHelperI pushMessageHelperI;
|
||||
|
||||
/**
|
||||
* 消息推送页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/pushlist"}, method = RequestMethod.GET)
|
||||
public ModelAndView getPushList() {
|
||||
return pushMessageHelperI.getPushListView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询消息推送数据
|
||||
*
|
||||
* @param draw
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/pushlistdata"}, method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getPushListData(String draw, Integer start, Integer length, String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode) {
|
||||
return pushMessageHelperI.getPushListData(draw, start, length, sdkVersion, phoneNumber, mac, phoneType, pushType, sortField, sortMode);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -24,6 +24,11 @@ public class User {
|
|||
@Autowired
|
||||
private UserHelper userHelper;
|
||||
|
||||
/**
|
||||
* 注册用户页面
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/userlist"}, method = RequestMethod.GET)
|
||||
public ModelAndView getUserList() {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
|
|
@ -48,17 +53,52 @@ public class User {
|
|||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户详情页面
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = {"/userDetail"}, method = RequestMethod.GET)
|
||||
public ModelAndView getUserDetail(String userId) {
|
||||
return (ModelAndView) userHelper.getUserDetail(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册用户页面根据条件查询用户列表
|
||||
*
|
||||
* @param draw
|
||||
* @param start
|
||||
* @param length
|
||||
* @param userId
|
||||
* @param phoneNumber
|
||||
* @param userEmail
|
||||
* @param phoneType
|
||||
* @param isRegisterGwell
|
||||
* @param isRegisterJiguang
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @param nickName
|
||||
* @param remarks
|
||||
* @param loginTime1
|
||||
* @param loginTime2
|
||||
* @param createTime1
|
||||
* @param createTime2
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/getUserList", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getlist(String draw, Integer start, Integer length, String userId, String phoneNumber, String userEmail, String phoneType, String isRegisterGwell, String isRegisterJiguang, String sortField, String sortMode, String nickName, String remarks, String loginTime1, String loginTime2, String createTime1, String createTime2) {
|
||||
return userHelper.getlist(draw, start, length, userId, phoneNumber, userEmail, phoneType, isRegisterGwell, isRegisterJiguang, sortField, sortMode, nickName, remarks, loginTime1, loginTime2, createTime1, createTime2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册用户页面修改用户备注
|
||||
*
|
||||
* @param userId
|
||||
* @param remarks
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/updateRemarks", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object updateRemarks(String userId, String remarks) {
|
||||
|
|
|
|||
|
|
@ -41,6 +41,16 @@ public interface DeviceHelper {
|
|||
*/
|
||||
Tbl_Device getDeviceById(Integer deviceId) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据用户ID和设备ID获取此设备和此用户的关系
|
||||
*
|
||||
* @param userId
|
||||
* @param deviceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Tbl_Device_User getDeviceUserByUserId_DeviceId(Integer userId, Integer deviceId) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据设备MacAddress获取设备详情
|
||||
*
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ public class DeviceHelperI implements DeviceHelper {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Tbl_Device_User getDeviceUserByUserId_DeviceId(Integer userId, Integer deviceId) throws Exception {
|
||||
Tbl_Device_User device = null;
|
||||
String key = redisKeyHelperI.getTbl_Device_UserRedisKeyByDeviceIdAndUserId(userId, deviceId);
|
||||
|
|
@ -356,14 +357,16 @@ public class DeviceHelperI implements DeviceHelper {
|
|||
deviceUser.setUpdateTime(date);
|
||||
deviceUser.setCreateTime(date);
|
||||
tbl_Device_Mapper.insertDeviceUser(deviceUser);
|
||||
redisKeyHelperI.deleteRedisByTbl_Device(device);
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_User(deviceUser);
|
||||
}
|
||||
//封装设备返回信息
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "绑定成功");
|
||||
} else {
|
||||
return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "");
|
||||
return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "绑定出错");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "绑定失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -417,12 +420,12 @@ public class DeviceHelperI implements DeviceHelper {
|
|||
dataMap.put("isLook", device_User.getIsLook());
|
||||
dataMap.put("isLive", device_User.getIsLive());
|
||||
dataMap.put("isActive", camera.getActiveCode() != null && !camera.getActiveCode().equals("") ? "1" : "0");
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "绑定成功");
|
||||
} else {
|
||||
return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "");
|
||||
return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "绑定出错");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "绑定失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,10 +10,14 @@ import com.ifish.bean.Tbl_Push_List;
|
|||
import com.ifish.enums.ResultEnum;
|
||||
import com.ifish.mapper.Tbl_Push_List_Mapper;
|
||||
import com.ifish.util.IfishUtil;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -123,4 +127,107 @@ public class PushMessageHelper implements PushMessageHelperI {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送列表首页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ModelAndView getPushListView() {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
mv.setViewName("pushlist");
|
||||
mv.addObject("title", "消息推送列表");
|
||||
mv.addObject("myjs", "<!-- Other plugins ( load only nessesary plugins for every page) -->\n"
|
||||
+ " <script src=\"static/assets/plugins/core/moment/moment.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/sparklines/jquery.sparkline.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/charts/pie-chart/jquery.easy-pie-chart.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/icheck/jquery.icheck.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tags/jquery.tagsinput.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/forms/tinymce/tinymce.min.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/tables/jquery.dataTables.js\"></script>\n"
|
||||
+ "<link href=\"static/assets/plugins/tables/jquery.dataTables.css\" rel=\"stylesheet\">"
|
||||
+ "<link href=\"static/assets/plugins/tables/dataTables.bootstrap.css\" rel=\"stylesheet\">"
|
||||
+ " <script src=\"static/assets/plugins/tables/dataTables.bootstrap.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/highlight/highlight.pack.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/plugins/misc/countTo/jquery.countTo.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/js/jquery.sprFlat.js\"></script>\n"
|
||||
+ " <script src=\"static/assets/js/app.js\"></script>");
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件获取推送列表
|
||||
*
|
||||
* @param draw
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getPushListData(String draw, Integer start, Integer length, String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode) {
|
||||
List<Map> list = null;
|
||||
String key = redisKeyHelperI.getAdmin_Tbl_Push_List_BySelect(start, length, sdkVersion, phoneNumber, mac, phoneType, pushType, sortField, sortMode);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
try {
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
list = (List<Map>) IfishUtil.JsonToList(redisString, Map.class);
|
||||
} else {
|
||||
list = tbl_Push_List_Mapper.getPushListData(start, length, sdkVersion, phoneNumber, mac, phoneType, pushType, sortField, sortMode);
|
||||
if (list != null && list.size() > 0) {
|
||||
for (Map map : list) {
|
||||
if (map.get("createTime") != null) {
|
||||
String createTime = IfishUtil.format((Date) map.get("createTime"));
|
||||
map.put("createTime", createTime);
|
||||
}
|
||||
}
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(list));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Integer count = 0;
|
||||
key = redisKeyHelperI.getAdmin_Tbl_Push_List_Count_BySelect(sdkVersion, phoneNumber, mac, phoneType, pushType, sortField, sortMode);
|
||||
redisString = redisHelperI.getRedis(key);
|
||||
try {
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
count = Integer.parseInt(redisString);
|
||||
} else {
|
||||
count = tbl_Push_List_Mapper.getPushListDataCount(sdkVersion, phoneNumber, mac, phoneType, pushType, sortField, sortMode);
|
||||
if (count != null && count > 0) {
|
||||
redisHelperI.setRedis(key, count.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
Integer allCount = 0;
|
||||
key = redisKeyHelperI.getAdmin_Tbl_Push_List_AllCount();
|
||||
redisString = redisHelperI.getRedis(key);
|
||||
try {
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
allCount = Integer.parseInt(redisString);
|
||||
} else {
|
||||
allCount = tbl_Push_List_Mapper.getPushListDataAllCount();
|
||||
if (allCount != null && allCount > 0) {
|
||||
redisHelperI.setRedis(key, allCount.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("data", list);
|
||||
map.put("draw", draw);
|
||||
map.put("recordsTotal", allCount);
|
||||
map.put("recordsFiltered", count);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
package com.ifish.helper;
|
||||
|
||||
import com.ifish.bean.Tbl_Push_List;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -34,4 +35,28 @@ public interface PushMessageHelperI {
|
|||
Object deletePushList(Integer userId, Integer pushId);
|
||||
|
||||
Tbl_Push_List save(Tbl_Push_List pushList);
|
||||
|
||||
/**
|
||||
* 推送列表首页
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ModelAndView getPushListView();
|
||||
|
||||
/**
|
||||
* 根据条件获取推送列表
|
||||
*
|
||||
* @param draw
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
Object getPushListData(String draw, Integer start, Integer length, String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ package com.ifish.helper;
|
|||
import com.ifish.bean.Tbl_Device;
|
||||
import com.ifish.bean.Tbl_Device_Statistics;
|
||||
import com.ifish.bean.Tbl_Device_User;
|
||||
import com.ifish.bean.Tbl_Live_Message;
|
||||
import com.ifish.bean.Tbl_Live_Room;
|
||||
import com.ifish.bean.Tbl_Push_List;
|
||||
import com.ifish.bean.Tbl_User;
|
||||
import com.ifish.util.RedisKey;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -21,10 +23,13 @@ import org.springframework.stereotype.Component;
|
|||
*/
|
||||
@Component
|
||||
public class RedisKeyHelper implements RedisKeyHelperI {
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisHelperI redisHelperI;
|
||||
|
||||
@Autowired
|
||||
private DeviceHelper deviceHelper;
|
||||
|
||||
/**
|
||||
* 根据phoneNumber获取Tbl_User用户信息的Redis缓存key键值
|
||||
*
|
||||
|
|
@ -264,6 +269,17 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
return RedisKey.LIVEROOM_ROOMID + roomId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据摄像头Id获取Tbl_Live_Room的redis缓存key键值
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getTbl_Live_RoomRedisKeyByCameraId(String cameraId) {
|
||||
return RedisKey.LIVEROOM_CAMERAID + cameraId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户Id获取Tbl_Live_Room的redis缓存key键值
|
||||
*
|
||||
|
|
@ -294,7 +310,7 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
|
||||
public String getTbl_Live_Room_CountRedisKey() {
|
||||
return RedisKey.LIVEROOM_COUNT;
|
||||
}
|
||||
|
|
@ -310,6 +326,17 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
return RedisKey.LIVEMESSAGE_ROOMID + roomId + "_f_" + firstResult + "_p_" + pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取直播间评论总数的redis缓存key键值
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getTbl_Live_MessageCount(Integer roomId) {
|
||||
return RedisKey.LIVEMESSAGE_COUNT + roomId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据pushId获取Tbl_push_list的redis缓存key键值
|
||||
*
|
||||
|
|
@ -332,6 +359,16 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
return RedisKey.EMAIL_REGIESTER + md5;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据MD5值获取redis缓存key键值(修改密码用)
|
||||
*
|
||||
* @param md5
|
||||
* @return
|
||||
*/
|
||||
public String getEmailUpdatePasswordRedisKey(String md5) {
|
||||
return RedisKey.EMAIL_UPDATEPASSWORD + md5;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除redis中某个设备详情Tbl_Device的缓存
|
||||
*
|
||||
|
|
@ -340,6 +377,15 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Device(Tbl_Device device) {
|
||||
deleteTbl_DeviceInfo(device);
|
||||
try {
|
||||
Tbl_Device_Statistics device_Statistics = deviceHelper.getDeviceStatisticsByDeviceId(device.getDeviceId());
|
||||
deleteTbl_Device_StatisticsInfo(device_Statistics);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteTbl_DeviceInfo(Tbl_Device device) {
|
||||
if (device.getDeviceId() != null && device.getDeviceId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_DeviceRedisKeyByDeviceId(device.getDeviceId()));
|
||||
}
|
||||
|
|
@ -359,12 +405,22 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Device_Statistics(Tbl_Device_Statistics device) {
|
||||
deleteTbl_Device_StatisticsInfo(device);
|
||||
try {
|
||||
Tbl_Device device1 = deviceHelper.getDeviceById(device.getDeviceId());
|
||||
deleteTbl_DeviceInfo(device1);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteTbl_Device_StatisticsInfo(Tbl_Device_Statistics device) {
|
||||
if (device.getDeviceId() != null && device.getDeviceId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_DeviceRedisKeyByDeviceId(device.getDeviceId()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(device.getMacAddress())) {
|
||||
redisHelperI.deleteRedis(getTbl_DeviceRedisKeyByMacAddress(device.getMacAddress()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -374,12 +430,26 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Device_User(Tbl_Device_User tbl_Device_User) {
|
||||
deleteTbl_Device_UserInfo(tbl_Device_User);
|
||||
try {
|
||||
Tbl_Device device1 = deviceHelper.getDeviceById(tbl_Device_User.getDeviceId());
|
||||
deleteTbl_DeviceInfo(device1);
|
||||
Tbl_Device_Statistics device_Statistics = deviceHelper.getDeviceStatisticsByDeviceId(tbl_Device_User.getDeviceId());
|
||||
deleteTbl_Device_StatisticsInfo(device_Statistics);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteTbl_Device_UserInfo(Tbl_Device_User tbl_Device_User) {
|
||||
if (tbl_Device_User.getDeviceId() != null && tbl_Device_User.getUserId() != null && tbl_Device_User.getDeviceId() > 0 && tbl_Device_User.getUserId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_Device_UserRedisKeyByDeviceIdAndUserId(tbl_Device_User.getUserId(), tbl_Device_User.getDeviceId()));
|
||||
}
|
||||
if (tbl_Device_User.getDeviceId() != null && tbl_Device_User.getDeviceId() > 0) {
|
||||
redisHelperI.deleteRedis(getListTbl_Device_UserKeyByDeviceId(tbl_Device_User.getDeviceId()));
|
||||
}
|
||||
if (tbl_Device_User.getUserId() != null) {
|
||||
redisHelperI.delRedisByTagKey(getListTbl_Device_UserKeyByUserId(tbl_Device_User.getUserId()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -416,6 +486,9 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
if (live_Room.getRoomId() != null && live_Room.getRoomId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_Live_RoomRedisKeyByRoomId(live_Room.getRoomId()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(live_Room.getCameraId())) {
|
||||
redisHelperI.deleteRedis(live_Room.getCameraId());
|
||||
}
|
||||
if (live_Room.getUserId() != null && live_Room.getUserId() > 0) {
|
||||
redisHelperI.deleteRedis(getTbl_Live_RoomRedisKeyByUserId(live_Room.getUserId()));
|
||||
}
|
||||
|
|
@ -430,5 +503,91 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
public void deleteRedisByLiveRoomListCount() {
|
||||
redisHelperI.deleteRedis(getTbl_Live_Room_CountRedisKey());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除redis中某个直播间评论列表缓存
|
||||
*
|
||||
* @param tbl_Live_Message
|
||||
*/
|
||||
@Override
|
||||
public void deleteRedisByTbl_Live_Message(Tbl_Live_Message tbl_Live_Message) {
|
||||
redisHelperI.delRedisByTagKey(RedisKey.LIVEMESSAGE_ROOMID + tbl_Live_Message.getRoomId());
|
||||
redisHelperI.deleteRedis(RedisKey.LIVEMESSAGE_COUNT + tbl_Live_Message.getRoomId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台推送消息列表缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getAdmin_Tbl_Push_List_BySelect(Integer start, Integer length, String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode) {
|
||||
return RedisKey.PUSHLIST_SELECT + start + "_" + length + "_" + sdkVersion + "_" + phoneNumber + "_" + mac + "_" + phoneType + "_" + pushType + "_" + sortField + "_" + sortMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台推送消息列表查询数量缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getAdmin_Tbl_Push_List_Count_BySelect(String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode) {
|
||||
return RedisKey.PUSHLIST_SELECT + "count_" + sdkVersion + "_" + phoneNumber + "_" + mac + "_" + phoneType + "_" + pushType + "_" + sortField + "_" + sortMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台推送消息列表总数缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getAdmin_Tbl_Push_List_AllCount() {
|
||||
return RedisKey.PUSHLIST_SELECT;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件删除推送列表缓存
|
||||
*
|
||||
* @param pushId
|
||||
*/
|
||||
public void deleteRedisByTbl_Push_List(Tbl_Push_List tbl_Push_List) {
|
||||
if (tbl_Push_List.getPushId() != null) {
|
||||
redisHelperI.deleteRedis(getTbl_Push_List_RedisByPushId(tbl_Push_List.getPushId()));
|
||||
}
|
||||
deleteRedisByTbl_Push_ListToAllRedisList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除推送列表类缓存
|
||||
*/
|
||||
public void deleteRedisByTbl_Push_ListToAllRedisList() {
|
||||
redisHelperI.delRedisByTagKey(RedisKey.PUSHLIST_SELECT);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ package com.ifish.helper;
|
|||
import com.ifish.bean.Tbl_Device;
|
||||
import com.ifish.bean.Tbl_Device_Statistics;
|
||||
import com.ifish.bean.Tbl_Device_User;
|
||||
import com.ifish.bean.Tbl_Live_Message;
|
||||
import com.ifish.bean.Tbl_Live_Room;
|
||||
import com.ifish.bean.Tbl_Push_List;
|
||||
import com.ifish.bean.Tbl_User;
|
||||
|
||||
/**
|
||||
|
|
@ -199,6 +201,14 @@ public interface RedisKeyHelperI {
|
|||
*/
|
||||
public String getTbl_Live_RoomRedisKeyByRoomId(Integer roomId);
|
||||
|
||||
/**
|
||||
* 根据摄像头Id获取Tbl_Live_Room的redis缓存key键值
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
public String getTbl_Live_RoomRedisKeyByCameraId(String cameraId);
|
||||
|
||||
/**
|
||||
* 根据用户Id获取Tbl_Live_Room的redis缓存key键值
|
||||
*
|
||||
|
|
@ -232,6 +242,14 @@ public interface RedisKeyHelperI {
|
|||
*/
|
||||
public String getTbl_Live_Message(Integer firstResult, Integer pageSize, Integer roomId);
|
||||
|
||||
/**
|
||||
* 获取直播间评论总数的redis缓存key键值
|
||||
*
|
||||
* @param roomId
|
||||
* @return
|
||||
*/
|
||||
public String getTbl_Live_MessageCount(Integer roomId);
|
||||
|
||||
/**
|
||||
* 根据pushId获取Tbl_push_list的redis缓存key键值
|
||||
*
|
||||
|
|
@ -241,13 +259,69 @@ public interface RedisKeyHelperI {
|
|||
public String getTbl_Push_List_RedisByPushId(Integer pushId);
|
||||
|
||||
/**
|
||||
* 根据MD5值获取redis缓存key键值
|
||||
* 后台推送消息列表缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
public String getAdmin_Tbl_Push_List_BySelect(Integer start, Integer length, String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode);
|
||||
|
||||
/**
|
||||
* 后台推送消息列表查询数量缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
public String getAdmin_Tbl_Push_List_Count_BySelect(String sdkVersion, String phoneNumber, String mac, String phoneType, String pushType, String sortField, String sortMode);
|
||||
|
||||
/**
|
||||
* 后台推送消息列表总数缓存
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
public String getAdmin_Tbl_Push_List_AllCount();
|
||||
|
||||
/**
|
||||
* 根据MD5值获取redis缓存key键值(注册账号用)
|
||||
*
|
||||
* @param md5
|
||||
* @return
|
||||
*/
|
||||
public String getEmailRedisKey(String md5);
|
||||
|
||||
/**
|
||||
* 根据MD5值获取redis缓存key键值(修改密码用)
|
||||
*
|
||||
* @param md5
|
||||
* @return
|
||||
*/
|
||||
public String getEmailUpdatePasswordRedisKey(String md5);
|
||||
|
||||
/**
|
||||
* 删除redis中某个设备详情的缓存
|
||||
*
|
||||
|
|
@ -290,4 +364,23 @@ public interface RedisKeyHelperI {
|
|||
*/
|
||||
public void deleteRedisByLiveRoomListCount();
|
||||
|
||||
/**
|
||||
* 删除redis中某个直播间评论列表缓存
|
||||
*
|
||||
* @param tbl_Live_Message
|
||||
*/
|
||||
public void deleteRedisByTbl_Live_Message(Tbl_Live_Message tbl_Live_Message);
|
||||
|
||||
/**
|
||||
* 根据条件删除推送列表缓存
|
||||
*
|
||||
* @param pushId
|
||||
*/
|
||||
public void deleteRedisByTbl_Push_List(Tbl_Push_List tbl_Push_List);
|
||||
|
||||
/**
|
||||
* 删除推送列表类缓存
|
||||
*/
|
||||
public void deleteRedisByTbl_Push_ListToAllRedisList();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package com.ifish.mapper;
|
|||
|
||||
import com.ifish.bean.Tbl_Push_List;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -71,4 +72,44 @@ public interface Tbl_Push_List_Mapper {
|
|||
+ "#{push.pushType},#{push.pushTitle},#{push.pushContext},NOW(),#{push.pushLink},#{push.jpushStatus},#{push.googleStatus},#{push.reportId},#{push.mcuCount},#{push.modularCount},#{push.routerCount},#{push.serverCount},#{push.serverTryCount})")
|
||||
Integer saveTbl_Push_List(@Param("push") Tbl_Push_List tbl_Push_List);
|
||||
|
||||
/**
|
||||
* 根据条件搜索推送列表数据
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@SelectProvider(type = Tbl_Push_List_MapperSql.class, method = "getPushListData")
|
||||
List<Map> getPushListData(@Param("start") Integer start, @Param("length") Integer length, @Param("sdkversion") String sdkVersion, @Param("phoneNumber") String phoneNumber, @Param("mac") String mac, @Param("phoneType") String phoneType, @Param("pushType") String pushType, @Param("sortField") String sortField, @Param("sortMode") String sortMode);
|
||||
|
||||
/**
|
||||
* 根据条件搜索推送列表数据数量
|
||||
*
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
@SelectProvider(type = Tbl_Push_List_MapperSql.class, method = "getPushListDataCount")
|
||||
Integer getPushListDataCount(@Param("sdkversion") String sdkVersion, @Param("phoneNumber") String phoneNumber, @Param("mac") String mac, @Param("phoneType") String phoneType, @Param("pushType") String pushType, @Param("sortField") String sortField, @Param("sortMode") String sortMode);
|
||||
|
||||
/**
|
||||
* 获取推送列表总数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@SelectProvider(type = Tbl_Push_List_MapperSql.class, method = "getPushListDataAllCount")
|
||||
Integer getPushListDataAllCount();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,4 +39,112 @@ public class Tbl_Push_List_MapperSql {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件搜索推送列表数据
|
||||
*
|
||||
* @param start
|
||||
* @param length
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
public String getPushListData(@Param("start") Integer start, @Param("length") Integer length, @Param("sdkversion") String sdkVersion, @Param("phoneNumber") String phoneNumber, @Param("mac") String mac, @Param("phoneType") String phoneType, @Param("pushType") String pushType, @Param("sortField") String sortField, @Param("sortMode") String sortMode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("SELECT a.push_id pushId,e.phone_number phoneNumber,e.user_email userEmail,e.user_id userId,b.mac_address macAddress,b.device_id deviceId,c.sdk_version sdkVersion,c.MCU_count mcuCount,");
|
||||
sb.append(" c.module_count moduleCount,c.router_count routerCount,c.server_count serverCount,c.server_try_count serverTryCount,");
|
||||
sb.append(" a.phone_type phoneType,a.jpush_status jpushStatus,a.push_type pushType,a.push_title pushTitle,a.push_context pushContext,a.create_time createTime");
|
||||
sb.append(" from tbl_push_list a");
|
||||
sb.append(" LEFT JOIN tbl_device b ON a.device_id = b.device_id");
|
||||
sb.append(" LEFT JOIN tbl_device_statistics c ON a.device_id=c.device_id");
|
||||
sb.append(" LEFT JOIN tbl_user e ON a.user_id =e.user_id");
|
||||
sb.append(" WHERE 1=1 ");
|
||||
if (StringUtils.isNotBlank(phoneType)) {
|
||||
sb.append(" AND a.phone_type = #{phoneType}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(pushType)) {
|
||||
sb.append(" AND a.push_type = #{pushType}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(sdkVersion)) {
|
||||
sb.append(" AND c.sdk_version = #{sdkversion}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(phoneNumber)) {
|
||||
sb.append(" AND e.phone_number = #{phoneNumber}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(mac)) {
|
||||
sb.append(" AND b.mac_address = #{mac}");
|
||||
}
|
||||
if (StringUtils.isBlank(sortField)) {
|
||||
sortField = "push_id";
|
||||
}
|
||||
if (StringUtils.isBlank(sortMode)) {
|
||||
sortMode = "DESC";
|
||||
}
|
||||
sb.append("ORDER BY a." + sortField + " " + sortMode);
|
||||
sb.append(" limit " + start + "," + length);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件搜索推送列表数据数量
|
||||
*
|
||||
* @param sdkVersion
|
||||
* @param phoneNumber
|
||||
* @param mac
|
||||
* @param phoneType
|
||||
* @param pushType
|
||||
* @param sortField
|
||||
* @param sortMode
|
||||
* @return
|
||||
*/
|
||||
public String getPushListDataCount(@Param("sdkversion") String sdkVersion, @Param("phoneNumber") String phoneNumber, @Param("mac") String mac, @Param("phoneType") String phoneType, @Param("pushType") String pushType, @Param("sortField") String sortField, @Param("sortMode") String sortMode) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("SELECT COUNT(1) ");
|
||||
sb.append(" from tbl_push_list a");
|
||||
sb.append(" LEFT JOIN tbl_device b ON a.device_id = b.device_id");
|
||||
sb.append(" LEFT JOIN tbl_device_statistics c ON a.device_id=c.device_id");
|
||||
sb.append(" LEFT JOIN tbl_user e ON a.user_id =e.user_id");
|
||||
sb.append(" WHERE 1=1 ");
|
||||
if (StringUtils.isNotBlank(phoneType)) {
|
||||
sb.append(" AND a.phone_type = #{phoneType}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(pushType)) {
|
||||
sb.append(" AND a.push_type = #{pushType}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(sdkVersion)) {
|
||||
sb.append(" AND c.sdk_version = #{sdkversion}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(phoneNumber)) {
|
||||
sb.append(" AND e.phone_number = #{phoneNumber}");
|
||||
}
|
||||
if (StringUtils.isNotBlank(mac)) {
|
||||
sb.append(" AND b.mac_address = #{mac}");
|
||||
}
|
||||
if (StringUtils.isBlank(sortField)) {
|
||||
sortField = "push_id";
|
||||
}
|
||||
if (StringUtils.isBlank(sortMode)) {
|
||||
sortMode = "DESC";
|
||||
}
|
||||
sb.append("ORDER BY a." + sortField + " " + sortMode);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推送列表总数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPushListDataAllCount() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("SELECT COUNT(1) ");
|
||||
sb.append(" from tbl_push_list a");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,6 +134,11 @@ public class RedisKey {
|
|||
*/
|
||||
public static final String PUSHLIST_PUSHID = "pushlistE:id_";
|
||||
|
||||
/**
|
||||
* 后台推送列表缓存条件
|
||||
*/
|
||||
public static final String PUSHLIST_SELECT = "pushlistE:se_";
|
||||
|
||||
/**
|
||||
* 邮箱验证有效缓存key
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
<ul class="nav sub">
|
||||
<li><a href="userlist"><i class="ec-users"></i> 注册用户</a>
|
||||
</li>
|
||||
<li><a href="form-validation.html"><i class="ec-chat"></i> 消息推送</a>
|
||||
<li><a href="pushlist"><i class="ec-chat"></i> 消息推送</a>
|
||||
</li>
|
||||
<li><a href="form-wizard.html"><i class="ec-info"></i> 换水提醒</a>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -31,4 +31,8 @@
|
|||
<put-attribute name="body" value="/WEB-INF/views/user/detail.jsp" />
|
||||
</definition>
|
||||
|
||||
<!-- 消息推送列表 -->
|
||||
<definition name="pushlist" extends="base">
|
||||
<put-attribute name="body" value="/WEB-INF/views/pushlist/list.jsp" />
|
||||
</definition>
|
||||
</tiles-definitions>
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
<%--
|
||||
Document : list
|
||||
Created on : 2017-8-1, 16:39:50
|
||||
Author : Administrator
|
||||
--%>
|
||||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<div id="searchDiv" style="float: right">
|
||||
SDK版本:<input type="text" id="sdkVersion" name="sdkVersion" style="width: 130px;" />
|
||||
手机号:<input type="text" id="phoneNumber" name="phoneNumber" style="width: 130px;" />
|
||||
mac地址:<input type="text" id="mac" name="mac" style="width: 130px;" />
|
||||
推送手机类型:
|
||||
<select id="phoneType" name="phoneType">
|
||||
<option value="">请选择</option>
|
||||
<option value="android">安卓</option>
|
||||
<option value="ios">ios</option>
|
||||
</select>
|
||||
消息类型:
|
||||
<select id="pushType" name="pushType">
|
||||
<option value="">请选择</option>
|
||||
<!--<option value="all_shops_push">所有商家用户推送</option>-->
|
||||
<!--<option value="send_report">发送看护报告</option>-->
|
||||
<option value="all_push">所有用户推送</option>
|
||||
<option value="app_update">IOS更新推送</option>
|
||||
<option value="all_ios_push">所有IOS用户推送</option>
|
||||
<option value="remind_water">换水提醒</option>
|
||||
<!--<option value="review_push">商家审核推送</option>-->
|
||||
<option value="offline_push">设备离线推送</option>
|
||||
<option value="all_android_push">所有android用户推送</option>
|
||||
<option value="qu_reply">问题反馈</option>
|
||||
<option value="remove_device">解除设备</option>
|
||||
<option value="wendu_warn">温度报警</option>
|
||||
</select>
|
||||
排序字段:
|
||||
<select id="sortField" name="sortField">
|
||||
<option value="">请选择</option>
|
||||
<option value="create_time">推送时间</option>
|
||||
</select>
|
||||
排序方式:
|
||||
<select id="sortMode" name="sortMode">
|
||||
<option value="">请选择</option>
|
||||
<option value="asc">升序↑</option>
|
||||
<option value="desc">降序↓</option>
|
||||
</select>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-info" id="btnSearch" style="margin-right:20px;">确定</button>
|
||||
</div>
|
||||
<table class="dataTable cell-border" id="datatable" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>用户信息</th>
|
||||
<th>设备信息</th>
|
||||
<th>上报记录</th>
|
||||
<th>手机类型</th>
|
||||
<th>极光发送</th>
|
||||
<th>消息类型</th>
|
||||
<th>推送标题</th>
|
||||
<th>推送内容</th>
|
||||
<th>推送时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
var table = $('#datatable').DataTable({
|
||||
//记录用户状态
|
||||
stateSave: true,
|
||||
//中文自定义
|
||||
language: {
|
||||
"sProcessing": "处理中...",
|
||||
"sLengthMenu": "显示 _MENU_ 项结果",
|
||||
"sZeroRecords": "没有匹配结果",
|
||||
"sInfo": "显示第 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
|
||||
"sInfoEmpty": "显示第 0 至 0 项结果,共 0 项",
|
||||
"sInfoFiltered": "(由 _MAX_ 项结果过滤)",
|
||||
"sInfoPostFix": "",
|
||||
"sSearch": "搜索:",
|
||||
"sUrl": "",
|
||||
"sEmptyTable": "表中数据为空",
|
||||
"sLoadingRecords": "载入中...",
|
||||
"sInfoThousands": ",",
|
||||
"oPaginate": {
|
||||
"sFirst": "首页",
|
||||
"sPrevious": "上页",
|
||||
"sNext": "下页",
|
||||
"sLast": "末页"
|
||||
},
|
||||
"oAria": {
|
||||
"sSortAscending": ": 以升序排列此列",
|
||||
"sSortDescending": ": 以降序排列此列"
|
||||
}
|
||||
},
|
||||
//是否显示排序
|
||||
bSort: false,
|
||||
//是否显示过滤搜索
|
||||
bFilter: false,
|
||||
//页脚展示风格
|
||||
pagingType: "full_numbers",
|
||||
//是否启动服务器数据处理
|
||||
serverSide: true,
|
||||
//ajax获取服务器数据
|
||||
ajax: {
|
||||
url: 'pushlistdata',
|
||||
type: 'post',
|
||||
data: function (d) {
|
||||
d.sdkVersion = $('#sdkVersion').val();
|
||||
d.phoneNumber = $('#phoneNumber').val();
|
||||
d.mac = $('#mac').val();
|
||||
d.phoneType = $('#phoneType').val();
|
||||
d.pushType = $('#pushType').val();
|
||||
d.sortField = $('#sortField').val();
|
||||
d.sortMode = $('#sortMode').val();
|
||||
}
|
||||
},
|
||||
//数据展示
|
||||
columns: [
|
||||
{"data": "pushId"},
|
||||
{
|
||||
data: "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
//type 的值 dispaly sort filter
|
||||
//代表,是显示类型的时候判断值的长度是否超过8,如果是则截取
|
||||
//这里只处理了类型是显示的,过滤和排序返回原始数据
|
||||
var str = "";
|
||||
if (row.phoneNumber != null) {
|
||||
str = str + "<span class='btn btn-dark'>" + row.phoneNumber + "</span></br>";
|
||||
}
|
||||
if (row.userEmail != null) {
|
||||
str = str + "<span class='btn btn-primary'>" + row.userEmail + "</span></br>";
|
||||
}
|
||||
if (row.phoneNumber == null && row.userEmail == null && ((row.nickName == null || row.nickName == ''))) {
|
||||
str = str + "<span class='btn btn-info'>游客登录</span></br>";
|
||||
}
|
||||
if (row.userId != null && row.userId != '') {
|
||||
str = str + "<span class='btn btn-xs btn-purple'>用户ID:" + row.userId + "</span></br>";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "";
|
||||
if (row.macAddress != null) {
|
||||
str = str + "<span class='btn btn-dark btn-alt'>" + row.macAddress + "</span></br>";
|
||||
}
|
||||
if (row.deviceId != null) {
|
||||
str = str + "<span class='label label-info mr10 mb10'>设备ID:" + row.deviceId + "</span></br>";
|
||||
}
|
||||
if (row.sdkVersion != null) {
|
||||
str = str + "<span class='label label-info mr10 mb10'>sdk版本:" + row.sdkVersion + "</span></br>";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "";
|
||||
if (row.mcuCount != null) {
|
||||
str = str + "<span class='btn btn-dark btn-alt'>MCU启动次数:" + row.mcuCount + "次</span></br>";
|
||||
}
|
||||
if (row.moduleCount != null) {
|
||||
str = str + "<span class='label label-info mr10 mb10'>模块启动次数:" + row.moduleCount + "次</span>";
|
||||
}
|
||||
if (row.routerCount != null) {
|
||||
str = str + "<span class='label label-info mr10 mb10'>连接路由器次数:" + row.routerCount + "次</span>";
|
||||
}
|
||||
if (row.serverCount != null) {
|
||||
str = str + "<span class='label label-info mr10 mb10'>成功连接次数:" + row.serverCount + "次</span>";
|
||||
}
|
||||
if (row.serverTryCount != null) {
|
||||
str = str + "<span class='label label-info mr10 mb10'>尝试连接次数:" + row.serverTryCount + "次</span>";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "";
|
||||
if (row.phoneType != null) {
|
||||
str = str + "<span class='btn btn-dark btn-alt'>" + row.phoneType + "</span></br>";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "";
|
||||
if (row.jpushStatus != null && row.jpushStatus == '1') {
|
||||
str = "<span class='btn btn-success btn-alt'>是</span></br>";
|
||||
} else {
|
||||
str = "<span class='btn btn-danger btn-alt'>否</span></br>";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "";
|
||||
if (row.pushType != null && row.pushType !== '') {
|
||||
str = "<span class='btn btn-success btn-alt'>是</span></br>";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = row.pushTitle;
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = row.pushContext;
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{
|
||||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = row.createTime;
|
||||
return str;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
$('#phoneType,#pushType,#sortField,#sortMode').change(function () {
|
||||
table.ajax.reload(null, true);
|
||||
});
|
||||
|
||||
$('#btnSearch').click(function () {
|
||||
table.ajax.reload(null, true);
|
||||
});
|
||||
|
||||
$(document).keyup(function (event) {
|
||||
if (event.keyCode == 13) {
|
||||
table.ajax.reload(null, true);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -27,7 +27,8 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4 style="margin-top: 100px;float: left">拥有设备</h4><div style="margin-top: 100px;float: left;margin-left: 10px;"><button class="btn btn-xs btn-primary" id="bindDeviceBtn"><i class="fa-edit"></i>新增</button></div>
|
||||
<h4 style="margin-top: 100px;float: left">拥有设备</h4><div style="margin-top: 100px;float: left;margin-left: 10px;">
|
||||
<button class="btn btn-xs btn-primary" data-toggle="modal" data-target="#bindDeviceModal"><i class="fa-edit"></i>新增</button></div>
|
||||
<table class="dataTable cell-border no-footer" role="grid" style="width: 1611px;">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
|
|
@ -62,14 +63,15 @@
|
|||
<td>${item.createTime}</td>
|
||||
<td>${item.isBlacklist}</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" onclick="" class="btn btn-xs btn-danger"><i class="fa-remove">解除绑定</i></a>
|
||||
<a href="javascript:void(0);" onclick="deleteDevice('${user.userId}', '${item.deviceId}')" class="btn btn-xs btn-danger"><i class="fa-remove">解除绑定</i></a>
|
||||
<a href="javascript:void(0);" title="[禁用]" class="btn btn-xs"><i class="fa-remove">取消授权</i></a>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4 style="margin-top: 100px;float: left">拥有摄像头</h4><div style="margin-top: 100px;float: left;margin-left: 10px;"><button class="btn btn-xs btn-primary" id="bindCameraModal"><i class="fa-edit"></i>新增</button></div>
|
||||
<h4 style="margin-top: 100px;float: left">拥有摄像头</h4><div style="margin-top: 100px;float: left;margin-left: 10px;">
|
||||
<button class="btn btn-xs btn-primary" data-toggle="modal" data-target="#bindCameraModal"><i class="fa-edit"></i>新增</button></div>
|
||||
<table class="dataTable cell-border no-footer" role="grid" style="width: 1611px;">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
|
|
@ -94,45 +96,116 @@
|
|||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<form action="/bindCamera" class="form-horizontal" method="post" id="form-bindCamera">
|
||||
<div class="modal fade" id="bindCameraModal">
|
||||
<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-2 control-label no-padding-right">用户ID<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-8">
|
||||
<input type="number" name="userId" value="${user.userId}" readonly="readonly" class="input-medium" required="required">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-xs-2 control-label no-padding-right">摄像头ID<span style="color:red;">*</span></label>
|
||||
<div class="col-xs-8">
|
||||
<input type="text" id="cameraId" name="cameraId" class="input-medium" required="required" maxlength="20">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="bindCameraModal" tabindex="1" role="dialog" aria-labelledby="exampleModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="exampleModalLabel">绑定摄像头</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="recipient-name" class="control-label">用户ID:</label>
|
||||
<input type="text" class="form-control" id="userId" name="userId" value="${user.userId}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="closeBtn btn btn-default">关闭</button>
|
||||
<button id="bindCameraModalBtn" type="submit" class="btn btn-primary">确定</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message-text" class="control-label">摄像头ID:</label>
|
||||
<input type="text" class="form-control" id="cameraId" name="cameraId" >
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="hidden" value="device" id="bindtype">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" id="bindCamera" data-toggle="modal" data-target="#surediv">绑定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal fade" id="bindDeviceModal" tabindex="1" role="dialog" aria-labelledby="exampleModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="exampleModalLabel">绑定设备</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form>
|
||||
<div class="form-group">
|
||||
<label for="recipient-name" class="control-label">用户ID:</label>
|
||||
<input type="text" class="form-control" id="userId" name="userId" value="${user.userId}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="message-text" class="control-label">设备Mac:</label>
|
||||
<input type="text" class="form-control" id="deviceMac" name="deviceMac" >
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
<button type="button" class="btn btn-primary" id="bindDevice" data-toggle="modal" data-target="#surediv">绑定</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="surediv" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Modal title</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" id="btnBind">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="surediv" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">Modal title</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" id="btnBind">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#myModal').modal('hide')
|
||||
});
|
||||
//解除绑定设备
|
||||
function deleteDevice(userId, deviceId) {
|
||||
if (window.confirm('你确定要取消交易吗?')) {
|
||||
$(document).ready(function () {
|
||||
$.ajax({
|
||||
url: 'deleteDeviceUser',
|
||||
type: 'post',
|
||||
data: {"userId": userId, "deviceId": deviceId},
|
||||
success: function (e) {
|
||||
alert(e.data);
|
||||
window.location.reload();
|
||||
},
|
||||
error: function (e) {}
|
||||
})
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
var a = $('#crumb');
|
||||
|
|
@ -140,8 +213,93 @@
|
|||
a.append('<li>用户详情<li>');
|
||||
|
||||
//绑定摄像头
|
||||
$("#bindCameraBtn").click(function () {
|
||||
console.log(1);
|
||||
$('#bindCameraModal').on('show.bs.modal', function (event) {
|
||||
});
|
||||
//绑定设备
|
||||
$('#bindDeviceModal').on('show.bs.modal', function (event) {
|
||||
});
|
||||
//绑定摄像头绑定按钮,准备弹出确认框
|
||||
$('#bindCamera').click(function () {
|
||||
$('#bindCameraModal').modal("hide");
|
||||
$('#bindtype').val('camera');
|
||||
});
|
||||
//绑定设备绑定按钮,准备弹出确认框
|
||||
$('#bindDevice').click(function () {
|
||||
$('#bindDeviceModal').modal("hide");
|
||||
$('#bindtype').val('device');
|
||||
});
|
||||
//确认框
|
||||
$('#surediv').on('show.bs.modal', function (event) {
|
||||
var modal = $(this);
|
||||
var a = $('#cameraId').val();
|
||||
var b = $('#userId').val();
|
||||
var c = $('#bindtype').val();
|
||||
var d = $('#deviceMac').val();
|
||||
if (c === 'device') {
|
||||
if (d == null || d === '' || b == null || b === '') {
|
||||
modal.find('.modal-title').text('警告');
|
||||
modal.find('.modal-body').text('');
|
||||
modal.find('.modal-body').append('<p>请填写正确的用户ID或设备Mac</p>');
|
||||
} else {
|
||||
modal.find('.modal-body').text('');
|
||||
modal.find('.modal-title').text('提示');
|
||||
modal.find('.modal-body').append('<p>请确认要进行绑定?</p>');
|
||||
modal.find('.modal-body').append('<p>用户ID:' + b + '</p>');
|
||||
modal.find('.modal-body').append('<p>设备Mac:' + d + '</p>');
|
||||
modal.find('.modal-body').append('<input type="hidden" id="sendbind" value="devicetrue" />');
|
||||
}
|
||||
} else if (c === 'camera') {
|
||||
if (a == null || a === '' || b == null || b === '') {
|
||||
modal.find('.modal-title').text('警告');
|
||||
modal.find('.modal-body').text('');
|
||||
modal.find('.modal-body').append('<p>请填写正确的用户ID或摄像头ID</p>');
|
||||
} else {
|
||||
modal.find('.modal-body').text('');
|
||||
modal.find('.modal-title').text('提示');
|
||||
modal.find('.modal-body').append('<p>请确认要进行绑定?</p>');
|
||||
modal.find('.modal-body').append('<p>用户ID:' + b + '</p>');
|
||||
modal.find('.modal-body').append('<p>摄像头ID:' + a + '</p>');
|
||||
modal.find('.modal-body').append('<input type="hidden" id="sendbind" value="cameratrue" />');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
//绑定
|
||||
$('#btnBind').click(function () {
|
||||
$('#surediv').modal('hide');
|
||||
var a = $('#sendbind').val();
|
||||
var b = $('#userId').val();
|
||||
var c = $('#cameraId').val();
|
||||
var d = $('#deviceMac').val();
|
||||
if (a === 'devicetrue') {
|
||||
$.ajax({
|
||||
url: 'bindDevice',
|
||||
type: 'post',
|
||||
data: {"userId": b, "deviceMac": d},
|
||||
success: function (e) {
|
||||
alert(e.data);
|
||||
window.location.reload();
|
||||
},
|
||||
error: function (e) {
|
||||
alert(e.data);
|
||||
}
|
||||
});
|
||||
} else if (a === 'cameratrue') {
|
||||
$.ajax({
|
||||
url: '/bindCamera',
|
||||
type: 'post',
|
||||
data: {"userId": b, "cameraId": c},
|
||||
success: function (e) {
|
||||
alert(e.data);
|
||||
window.location.reload();
|
||||
},
|
||||
error: function (e) {
|
||||
alert(e.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<table id="searchTable" class="table table-bordered">
|
||||
<tbody><tr>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="important">
|
||||
<label>ID</label>
|
||||
</td>
|
||||
|
|
@ -96,7 +97,7 @@
|
|||
<td>
|
||||
<input type="text" id="remarks" name="remarks" class="input-medium searchClass" maxlength="10">
|
||||
</td>
|
||||
|
||||
<td colspan="4"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
|
|
@ -112,14 +113,16 @@
|
|||
<td colspan="2">
|
||||
<input type="text" id="createTime1" name="createTime1" class="input-medium searchClass" maxlength="20">~~<input type="text" id="createTime2" name="createTime2" class="input-medium searchClass" maxlength="20">
|
||||
</td>
|
||||
|
||||
<td></td><td></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="12" style="text-align:center;" class="important">
|
||||
<button type="button" class="btn btn-sm btn-info" onclick="refreshTable();" style="margin-right:20px;"><i class="fa-refresh"></i> 刷新</button>
|
||||
<button id="reset" type="reset" class="btn btn-sm btn-info" style="margin-right:20px;"><i class="fa-undo"></i> 重置</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody></table>
|
||||
<table class="dataTable cell-border" id="datatable" >
|
||||
<thead>
|
||||
|
|
@ -147,7 +150,7 @@
|
|||
|
||||
//备注
|
||||
function remarks(userId, remarks) {
|
||||
if (remarks == 'undefined') {
|
||||
if (remarks === 'undefined') {
|
||||
remarks = '';
|
||||
}
|
||||
bootbox.prompt({
|
||||
|
|
@ -180,25 +183,6 @@
|
|||
$('#loginTime1,#loginTime2,#createTime1,#createTime2').datepicker({
|
||||
format: "yyyy-mm-dd"
|
||||
});
|
||||
|
||||
var data = [
|
||||
[
|
||||
"Tiger Nixon",
|
||||
"System Architect",
|
||||
"Edinburgh",
|
||||
"5421",
|
||||
"2011/04/25",
|
||||
"$3,120"
|
||||
],
|
||||
[
|
||||
"Garrett Winters",
|
||||
"Director",
|
||||
"Edinburgh",
|
||||
"8422",
|
||||
"2011/07/25",
|
||||
"$5,300"
|
||||
]
|
||||
];
|
||||
var table = $('#datatable').DataTable({
|
||||
//记录用户状态
|
||||
stateSave: true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue