用户列表和详情修改
This commit is contained in:
parent
d14f0e099e
commit
c437a22eb1
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* 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.API;
|
||||
|
||||
import cn.jpush.api.JPushClient;
|
||||
import cn.jpush.api.push.PushResult;
|
||||
import cn.jpush.api.push.model.Message;
|
||||
import cn.jpush.api.push.model.Options;
|
||||
import cn.jpush.api.push.model.Platform;
|
||||
import cn.jpush.api.push.model.PushPayload;
|
||||
import cn.jpush.api.push.model.audience.Audience;
|
||||
import cn.jpush.api.push.model.notification.IosNotification;
|
||||
import cn.jpush.api.push.model.notification.Notification;
|
||||
import java.util.Map;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Component
|
||||
public class JiGuangPush {
|
||||
|
||||
private static JPushClient jPushClient = null;
|
||||
//正式
|
||||
// private static final String masterSecret = "60162c8cf195ce9f4dc76629";
|
||||
// private static final String appKey = "d970d5e193cb2a0bbe41653c";
|
||||
//测试
|
||||
private final static String masterSecret = "4f759a0609dcd9d2edb06125";
|
||||
private final static String appKey = "6e5e9d757570859b3f274bb8";
|
||||
|
||||
static {
|
||||
jPushClient = new JPushClient(masterSecret, appKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向安卓手机推送一条信息
|
||||
*
|
||||
* @param message
|
||||
* @return
|
||||
*/
|
||||
public boolean pushMessageByAndroid(String title, String message, String userId, Map map) {
|
||||
try {
|
||||
PushPayload payload = PushPayload.newBuilder()
|
||||
.setPlatform(Platform.android())
|
||||
.setAudience(Audience.alias(userId))
|
||||
.setNotification(Notification.android(title, message, map))
|
||||
.setMessage(Message.newBuilder().setTitle(title).setMsgContent(message).addExtras(map).build())
|
||||
.build();
|
||||
|
||||
PushResult result = jPushClient.sendPush(payload);
|
||||
if (result.msg_id > 0 && result.isResultOK()) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean pushMessageByIOS(String title, String message, String userId, Map map) {
|
||||
try {
|
||||
|
||||
PushPayload payload = PushPayload.newBuilder()
|
||||
.setPlatform(Platform.ios())
|
||||
.setAudience(Audience.alias(userId))
|
||||
.setNotification(Notification.newBuilder().addPlatformNotification(IosNotification.newBuilder().setSound("happy").setAlert(message).build()).build())
|
||||
.setMessage(Message.newBuilder().setTitle(title).setMsgContent(message).addExtras(map).build())
|
||||
.setOptions(Options.newBuilder().setApnsProduction(false).build())
|
||||
.build();
|
||||
|
||||
PushResult result = jPushClient.sendPush(payload);
|
||||
if (result.msg_id > 0 && result.isResultOK()) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
String b = e.getMessage();
|
||||
String a = "";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
package com.ifish.controller;
|
||||
|
||||
import com.ifish.helper.UserHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
|
@ -27,6 +28,7 @@ public class User {
|
|||
public ModelAndView getUserList() {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
mv.setViewName("userlist");
|
||||
mv.addObject("pagetitle", "用户列表");
|
||||
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"
|
||||
|
|
@ -42,13 +44,19 @@ public class User {
|
|||
+ " <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>");
|
||||
mv.addObject("title", "用户统计");
|
||||
return mv;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/userDetail"}, method = RequestMethod.GET)
|
||||
public ModelAndView getUserDetail(String userId) {
|
||||
return (ModelAndView) userHelper.getUserDetail(userId);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/getUserList", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object getlist(String draw, Integer start, Integer length) {
|
||||
return userHelper.getlist(draw, start, length);
|
||||
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);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/updateRemarks", method = RequestMethod.POST)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* 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.helper;
|
||||
|
||||
import com.ifish.bean.Tbl_Device;
|
||||
import com.ifish.bean.Tbl_Device_Statistics;
|
||||
import com.ifish.bean.Tbl_Device_User;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface DeviceHelper {
|
||||
|
||||
/**
|
||||
* 根据用户Id获取绑定设备集合
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
List<Tbl_Device_User> getDeviceUsersByUserId(Integer userId) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据用户ID和摄像头信息获取用户关联数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Tbl_Device_User getDeviceUserByUserId_CameraId(Integer userId, String cameraId) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据设备Id获取设备详情
|
||||
*
|
||||
* @param deviceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Tbl_Device getDeviceById(Integer deviceId) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据设备MacAddress获取设备详情
|
||||
*
|
||||
* @param macAddress
|
||||
* @param deviceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Tbl_Device getDeviceByMacAddress(String macAddress) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据设备ID获取设备统计信息
|
||||
*
|
||||
* @param deviceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Tbl_Device_Statistics getDeviceStatisticsByDeviceId(Integer deviceId) throws Exception;
|
||||
|
||||
/**
|
||||
* 绑定设备
|
||||
*
|
||||
* @param userId
|
||||
* @param mackAddress
|
||||
* @return
|
||||
*/
|
||||
Object bindDevice(Integer userId, String mackAddress);
|
||||
|
||||
/**
|
||||
* 激活摄像头
|
||||
*
|
||||
* @param activeCode
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
Object activeCamera(String activeCode, String cameraId);
|
||||
|
||||
/**
|
||||
* 绑定摄像头
|
||||
*
|
||||
* @param userId
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
Object bindCamera(Integer userId, String cameraId);
|
||||
|
||||
/**
|
||||
* 根据摄像头ID获取设备信息
|
||||
*
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
Tbl_Device getDeviceByCameraId(String cameraId) throws Exception;
|
||||
|
||||
/**
|
||||
* 修改设备信息
|
||||
*
|
||||
* @param device
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
Object updateDeviceUser(Tbl_Device_User device);
|
||||
|
||||
/**
|
||||
* 修改摄像头信息
|
||||
*
|
||||
* @param cameraId
|
||||
* @param device_User
|
||||
* @return
|
||||
*/
|
||||
Object updateCameraUser(Integer cameraId, Tbl_Device_User device_User);
|
||||
|
||||
/**
|
||||
* 删除绑定摄像头
|
||||
*
|
||||
* @param userId
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
Object deleteCameraUser(Integer userId, String cameraId);
|
||||
|
||||
/**
|
||||
* 删除绑定的设备
|
||||
*
|
||||
* @param deviceUser
|
||||
* @return
|
||||
*/
|
||||
Object deleteDeviceUser(Tbl_Device_User deviceUser);
|
||||
}
|
||||
|
|
@ -0,0 +1,643 @@
|
|||
/*
|
||||
* 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.helper;
|
||||
|
||||
import com.ifish.API.JiGuangPush;
|
||||
import com.ifish.bean.Tbl_Activa_Code;
|
||||
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_Push_List;
|
||||
import com.ifish.bean.Tbl_User;
|
||||
import com.ifish.enums.PushTypeEnum;
|
||||
import com.ifish.enums.ResultEnum;
|
||||
import com.ifish.mapper.Tbl_Device_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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Component
|
||||
public class DeviceHelperI implements DeviceHelper {
|
||||
|
||||
@Autowired
|
||||
private RedisHelperI redisHelperI;
|
||||
|
||||
@Autowired
|
||||
private RedisKeyHelperI redisKeyHelperI;
|
||||
|
||||
@Autowired
|
||||
private Tbl_Device_Mapper tbl_Device_Mapper;
|
||||
|
||||
@Autowired
|
||||
private UserHelperI userHelperI;
|
||||
|
||||
@Autowired
|
||||
private JiGuangPush jiGuangPush;
|
||||
|
||||
@Autowired
|
||||
private PushMessageHelperI pushMessageHelperI;
|
||||
|
||||
/**
|
||||
* 根据用户Id获取绑定设备集合
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Tbl_Device_User> getDeviceUsersByUserId(Integer userId) throws Exception {
|
||||
List<Tbl_Device_User> deviceUserList = null;
|
||||
String key = redisKeyHelperI.getListTbl_Device_UserKeyByUserId(userId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
deviceUserList = (List<Tbl_Device_User>) IfishUtil.JsonToList(redisString, Tbl_Device_User.class);
|
||||
} else {
|
||||
deviceUserList = tbl_Device_Mapper.getDeviceUsersByUserId(userId);
|
||||
if (deviceUserList != null && deviceUserList.size() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(deviceUserList));
|
||||
}
|
||||
}
|
||||
return deviceUserList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID和设备ID获取此设备和此用户的关系
|
||||
*
|
||||
* @param userId
|
||||
* @param deviceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
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);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
device = (Tbl_Device_User) IfishUtil.JsonToBean(redisString, Tbl_Device_User.class);
|
||||
} else {
|
||||
device = tbl_Device_Mapper.getDeviceUsersByUserIdAndDeviceId(userId, deviceId);
|
||||
if (device != null && device.getDeviceId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
|
||||
}
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID和摄像头ID获取此摄像头和用户的关系
|
||||
*
|
||||
* @param userId
|
||||
* @param deviceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Tbl_Device_User getDeviceUserByUserId_CameraId(Integer userId, String cameraId) throws Exception {
|
||||
Tbl_Device device = getDeviceByCameraId(cameraId);
|
||||
if (device == null) {
|
||||
return null;
|
||||
}
|
||||
return getDeviceUserByUserId_DeviceId(userId, device.getDeviceId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备Id获取设备详情
|
||||
*
|
||||
* @param deviceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Tbl_Device getDeviceById(Integer deviceId) throws Exception {
|
||||
Tbl_Device device = null;
|
||||
String key = redisKeyHelperI.getTbl_DeviceRedisKeyByDeviceId(deviceId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
device = (Tbl_Device) IfishUtil.JsonToBean(redisString, Tbl_Device.class);
|
||||
} else {
|
||||
device = tbl_Device_Mapper.getDeviceById(deviceId);
|
||||
if (device != null && device.getDeviceId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
|
||||
}
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据摄像头ID从缓存中取得设备信息
|
||||
*
|
||||
* @param cameraId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Tbl_Device getDeviceByCameraId(String cameraId) throws Exception {
|
||||
Tbl_Device device = null;
|
||||
String key = redisKeyHelperI.getTbl_CameraRedisKeyByCameraId(cameraId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
device = (Tbl_Device) IfishUtil.JsonToBean(redisString, Tbl_Device.class);
|
||||
} else {
|
||||
device = tbl_Device_Mapper.getDeviceByCameraId(cameraId);
|
||||
if (device != null && device.getDeviceId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
|
||||
}
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备mac地址获取设备详情
|
||||
*
|
||||
* @param macAddress
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Tbl_Device getDeviceByMacAddress(String macAddress) throws Exception {
|
||||
Tbl_Device device = null;
|
||||
String key = redisKeyHelperI.getTbl_DeviceRedisKeyByMacAddress(macAddress);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
device = (Tbl_Device) IfishUtil.JsonToBean(redisString, Tbl_Device.class);
|
||||
} else {
|
||||
device = tbl_Device_Mapper.getDeviceByMacAddress(macAddress);
|
||||
if (device != null && device.getDeviceId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
|
||||
}
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备ID获取设备统计信息
|
||||
*
|
||||
* @param deviceId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Tbl_Device_Statistics getDeviceStatisticsByDeviceId(Integer deviceId) throws Exception {
|
||||
Tbl_Device_Statistics device = null;
|
||||
String key = redisKeyHelperI.getTbl_Device_StatisticsRedisKeyByDeviceId(deviceId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
device = (Tbl_Device_Statistics) IfishUtil.JsonToBean(redisString, Tbl_Device_Statistics.class);
|
||||
} else {
|
||||
device = tbl_Device_Mapper.getDevStatisticsByDeviceId(deviceId);
|
||||
if (device != null && device.getDeviceId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(device));
|
||||
}
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定设备
|
||||
*
|
||||
* @param userId
|
||||
* @param user
|
||||
* @param mackAddress
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object bindDevice(Integer userId, String mackAddress) {
|
||||
|
||||
try {
|
||||
Tbl_User tmpUser = userHelperI.getUserById(userId);
|
||||
//用户存在
|
||||
if (tmpUser != null) {
|
||||
//新增用户拥有设备
|
||||
Tbl_Device_User deviceUser = new Tbl_Device_User();
|
||||
Tbl_Device device = getDeviceByMacAddress(mackAddress);
|
||||
boolean bln = false;
|
||||
//设备存在
|
||||
if (device != null) {
|
||||
//关联用户-设备
|
||||
deviceUser.setUserId(tmpUser.getUserId());
|
||||
deviceUser.setDeviceId(device.getDeviceId());
|
||||
//已关联设备的其他用户,这里的用户ID查询条件是不等于<>
|
||||
List<Tbl_Device_User> deviceUserList = tbl_Device_Mapper.getOtherDeviceUsersByOtherUserIdAndDeviceId(tmpUser.getUserId(), device.getDeviceId());
|
||||
//是否已关联这里的用户ID查询是等于=
|
||||
Tbl_Device_User tmpDdeviceUser = tbl_Device_Mapper.getDeviceUsersByUserIdAndDeviceId(tmpUser.getUserId(), device.getDeviceId());
|
||||
//已关联
|
||||
if (tmpDdeviceUser != null) {
|
||||
//原先不是主控制,则删除其他用户关联关系
|
||||
if (!tmpDdeviceUser.getIsMaster().equals("1")) {
|
||||
|
||||
for (Tbl_Device_User du : deviceUserList) {
|
||||
Integer userid = du.getUserId();
|
||||
Integer deviceId = du.getDeviceId();
|
||||
Tbl_User tu = userHelperI.getUserById(userid);
|
||||
if (tu != null) {
|
||||
String timestamp = IfishUtil.format(new Date());
|
||||
//基本参数
|
||||
Map<String, String> baseMap = new HashMap<String, String>();
|
||||
baseMap.put("title", PushTypeEnum.remove_device.getValue());
|
||||
baseMap.put("content", "你已于" + timestamp + "失去对“" + du.getShowName() + "”设备的控制权");
|
||||
baseMap.put("user_id", tu.getUserId().toString());
|
||||
baseMap.put("loginType", tu.getLoginType());
|
||||
//推送参数
|
||||
Map<String, String> pushMap = new HashMap<String, String>();
|
||||
pushMap.put("device_id", deviceId.toString());
|
||||
pushMap.put("device_name", du.getShowName());
|
||||
pushMap.put("timestamp", timestamp);
|
||||
pushMap.put("msg_type", PushTypeEnum.remove_device.getKey());
|
||||
//推送消息
|
||||
jPushNotifcation(baseMap, pushMap);
|
||||
}
|
||||
tbl_Device_Mapper.deleteDeviceUserById(du.getId());
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_User(tmpDdeviceUser);
|
||||
}
|
||||
}
|
||||
//变更为主控
|
||||
tmpDdeviceUser.setIsMaster("1");
|
||||
Date date = new Date();
|
||||
tmpDdeviceUser.setUpdateTime(date);
|
||||
tmpDdeviceUser.setCreateTime(date);
|
||||
tbl_Device_Mapper.updateTblDeviceUser(tmpDdeviceUser);
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_User(tmpDdeviceUser);
|
||||
deviceUser.setShowName(tmpDdeviceUser.getShowName());
|
||||
deviceUser.setIsMaster(tmpDdeviceUser.getIsMaster());
|
||||
} //未绑定过
|
||||
else {
|
||||
//删除其他用户控制权
|
||||
for (Tbl_Device_User du : deviceUserList) {
|
||||
Integer userid = du.getUserId();
|
||||
Integer deviceId = du.getDeviceId();
|
||||
Tbl_User tu = userHelperI.getUserById(userid);
|
||||
if (tu != null) {
|
||||
String timestamp = IfishUtil.format(new Date());
|
||||
//基本参数
|
||||
Map<String, String> baseMap = new HashMap<String, String>();
|
||||
baseMap.put("title", PushTypeEnum.remove_device.getValue());
|
||||
baseMap.put("content", "你已于" + timestamp + "失去对“" + du.getShowName() + "”设备的控制权");
|
||||
baseMap.put("user_id", tu.getUserId().toString());
|
||||
baseMap.put("loginType", tu.getLoginType());
|
||||
//推送参数
|
||||
Map<String, String> pushMap = new HashMap<String, String>();
|
||||
pushMap.put("device_id", deviceId.toString());
|
||||
pushMap.put("device_name", du.getShowName());
|
||||
pushMap.put("timestamp", timestamp);
|
||||
pushMap.put("msg_type", PushTypeEnum.remove_device.getKey());
|
||||
//推送消息
|
||||
jPushNotifcation(baseMap, pushMap);
|
||||
}
|
||||
tbl_Device_Mapper.deleteDeviceUserById(du.getId());
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_User(du);
|
||||
}
|
||||
//需要新增
|
||||
bln = true;
|
||||
//查询设备统计信息
|
||||
Tbl_Device_Statistics ds = getDeviceStatisticsByDeviceId(device.getDeviceId());
|
||||
//如果设备统计信息为空,新增
|
||||
if (ds == null || ds.getId() <= 0) {
|
||||
ds = new Tbl_Device_Statistics();
|
||||
ds.setDeviceId(device.getDeviceId());
|
||||
ds.setMacAddress(StringUtils.isBlank(device.getMacAddress()) ? null : device.getMacAddress());
|
||||
ds.setLoginCount(1);
|
||||
ds.setLoginTime(new Date());
|
||||
ds.setFirstActivate(new Date());
|
||||
ds.setCreateTime(new Date());
|
||||
ds.setIsCharge("0");
|
||||
ds.setHardwareType(StringUtils.isBlank(device.getHardwareType()) ? null : device.getHardwareType());
|
||||
ds.setFactoryCode(StringUtils.isBlank(device.getFactoryCode()) ? null : device.getFactoryCode());
|
||||
ds.setBrandCode(StringUtils.isBlank(device.getBrandCode()) ? null : device.getBrandCode());
|
||||
tbl_Device_Mapper.insertDeviceStatistics(ds);
|
||||
} else {
|
||||
//修改设备统计信息
|
||||
if (ds.getFirstActivate() == null) {
|
||||
ds.setFirstActivate(new Date());
|
||||
tbl_Device_Mapper.updateDeviceStatistics(ds);
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_Statistics(ds);
|
||||
}
|
||||
}
|
||||
}
|
||||
} //设备不存在
|
||||
else {
|
||||
//新增设备信息
|
||||
device = new Tbl_Device();
|
||||
device.setIsBlacklist("1");
|
||||
device.setMacAddress(mackAddress);
|
||||
Date date = new Date();
|
||||
device.setCreateTime(date);
|
||||
int i = tbl_Device_Mapper.insertDevice(device);
|
||||
if (i > 0) {
|
||||
Tbl_Device_Statistics tds = new Tbl_Device_Statistics();
|
||||
tds.setLoginCount(0);
|
||||
tds.setMacAddress(mackAddress);
|
||||
tds.setDeviceId(device.getDeviceId());
|
||||
tds.setFirstActivate(date);
|
||||
tds.setCreateDate(date);
|
||||
tds.setCreateTime(date);
|
||||
tbl_Device_Mapper.insertDeviceStatistics(tds);
|
||||
bln = true;
|
||||
deviceUser.setUserId(tmpUser.getUserId());
|
||||
deviceUser.setDeviceId(device.getDeviceId());
|
||||
}
|
||||
}
|
||||
//需要新增
|
||||
if (bln) {
|
||||
//新增关联关系
|
||||
deviceUser.setShowName("鱼缸" + (int) (Math.random() * 9000 + 1000));
|
||||
deviceUser.setIsMaster("1");
|
||||
Date date = new Date();
|
||||
deviceUser.setUpdateTime(date);
|
||||
deviceUser.setCreateTime(date);
|
||||
tbl_Device_Mapper.insertDeviceUser(deviceUser);
|
||||
}
|
||||
//封装设备返回信息
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
|
||||
} else {
|
||||
return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定摄像头
|
||||
*
|
||||
* @param userId
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object bindCamera(Integer userId, String cameraId) {
|
||||
try {
|
||||
Tbl_User user = userHelperI.getUserById(userId);
|
||||
Tbl_Device camera = getDeviceByCameraId(cameraId);
|
||||
//返回数据
|
||||
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||
//用户存在
|
||||
if (user != null) {
|
||||
//摄像头存在
|
||||
if (camera != null) {
|
||||
//已关联摄像头的用户
|
||||
List<Tbl_Device_User> CameraUserList = tbl_Device_Mapper.getDeviceUsersByDeviceId(camera.getDeviceId());
|
||||
//删除摄像头与用户关系
|
||||
for (Tbl_Device_User cu : CameraUserList) {
|
||||
//删除摄像头和用户的关系
|
||||
tbl_Device_Mapper.deleteDeviceUserById(cu.getId());
|
||||
}
|
||||
} else {
|
||||
//摄像头不存在
|
||||
camera = new Tbl_Device();
|
||||
camera.setCameraId(cameraId);
|
||||
camera.setCreateTime(new Date());
|
||||
camera.setIsCamera("1");
|
||||
tbl_Device_Mapper.insertDevice(camera);
|
||||
}
|
||||
//建立关系
|
||||
Tbl_Device_User device_User = new Tbl_Device_User();
|
||||
device_User.setUserId(userId);
|
||||
device_User.setIsMaster("1");
|
||||
device_User.setIsLook("0");
|
||||
device_User.setIsLive("0");
|
||||
device_User.setDeviceId(camera.getDeviceId());
|
||||
device_User.setShowName("摄像头" + (int) (Math.random() * 900 + 100));
|
||||
device_User.setCreateTime(new Date());
|
||||
tbl_Device_Mapper.insertDeviceUser(device_User);
|
||||
//返回数据
|
||||
dataMap.put("cameraId", cameraId);
|
||||
dataMap.put("showName", device_User.getShowName());
|
||||
dataMap.put("isMaster", device_User.getIsMaster());
|
||||
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);
|
||||
} else {
|
||||
return IfishUtil.returnJson(ResultEnum.warn202.getKey(), "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活摄像头
|
||||
*/
|
||||
@Override
|
||||
public Object activeCamera(String activeCode, String cameraId) {
|
||||
try {
|
||||
Tbl_Activa_Code activa_Code = tbl_Device_Mapper.getActiva_CodeByCode(activeCode);
|
||||
if (activa_Code != null) {
|
||||
if (activa_Code.getIsUsed().equals("1")) {
|
||||
return IfishUtil.returnJson(ResultEnum.warn208.getKey(), "");
|
||||
} else {
|
||||
Tbl_Device camera = tbl_Device_Mapper.getDeviceByCameraId(cameraId);
|
||||
if (camera != null) {
|
||||
if (StringUtils.isNotBlank(camera.getActiveCode())) {
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
|
||||
} else {
|
||||
Date date = new Date();
|
||||
camera.setActiveCode(activeCode);
|
||||
camera.setActiveTime(date);
|
||||
camera.setUpdateTime(date);
|
||||
int i = tbl_Device_Mapper.updateTbl_Device(camera);
|
||||
|
||||
activa_Code.setIsUsed("1");
|
||||
tbl_Device_Mapper.updateTblActivaCodeIsUse(activeCode);
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
|
||||
}
|
||||
} else {
|
||||
return IfishUtil.returnJson(ResultEnum.warn210.getKey(), "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return IfishUtil.returnJson(ResultEnum.warn209.getKey(), "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备和用户的关系数据
|
||||
*
|
||||
* @param device
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object updateDeviceUser(Tbl_Device_User device) {
|
||||
|
||||
try {
|
||||
Tbl_Device_User olDevice_User = getDeviceUserByUserId_DeviceId(device.getUserId(), device.getDeviceId());
|
||||
|
||||
if (device != null) {
|
||||
if (olDevice_User != null) {
|
||||
device.setId(olDevice_User.getId());
|
||||
int i = tbl_Device_Mapper.updateTblDeviceUser(device);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_User(device);
|
||||
Tbl_Device device1 = getDeviceById(device.getDeviceId());
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
|
||||
}
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.warn207.getKey(), "");
|
||||
} else {
|
||||
return IfishUtil.returnJson(ResultEnum.warn207.getKey(), "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改摄像头信息
|
||||
*
|
||||
* @param cameraId
|
||||
* @param device_User
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object updateCameraUser(Integer cameraId, Tbl_Device_User device_User) {
|
||||
try {
|
||||
Tbl_Device_User olDevice_User = getDeviceUserByUserId_CameraId(device_User.getUserId(), cameraId.toString());
|
||||
if (olDevice_User != null) {
|
||||
if (olDevice_User != null) {
|
||||
|
||||
device_User.setId(olDevice_User.getId());
|
||||
int i = tbl_Device_Mapper.updateTblDeviceUser(device_User);
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_User(device_User);
|
||||
Map dataMap = new HashMap();
|
||||
dataMap.put("cameraId", cameraId);
|
||||
dataMap.put("showName", device_User.getShowName());
|
||||
dataMap.put("isMaster", device_User.getIsMaster());
|
||||
dataMap.put("isLook", device_User.getIsLook());
|
||||
dataMap.put("isLive", device_User.getIsLive());
|
||||
Tbl_Device camera = getDeviceById(olDevice_User.getDeviceId());
|
||||
dataMap.put("isActive", camera.getActiveCode() != null && !camera.getActiveCode().equals("") ? "1" : "0");
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), dataMap);
|
||||
}
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.warn207.getKey(), "");
|
||||
} else {
|
||||
return IfishUtil.returnJson(ResultEnum.warn207.getKey(), "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 解除绑定设备
|
||||
*
|
||||
* @param deviceUser
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object deleteDeviceUser(Tbl_Device_User deviceUser) {
|
||||
try {
|
||||
Tbl_Device_User device_User = getDeviceUserByUserId_DeviceId(deviceUser.getUserId(), deviceUser.getDeviceId());
|
||||
if (device_User != null) {
|
||||
int i = tbl_Device_Mapper.deleteDeviceUserById(device_User.getId());
|
||||
if (i > 0) {
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_User(device_User);
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除绑定摄像头
|
||||
*
|
||||
* @param userId
|
||||
* @param cameraId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object deleteCameraUser(Integer userId, String cameraId) {
|
||||
try {
|
||||
Tbl_Device_User device_User = getDeviceUserByUserId_CameraId(userId, cameraId);
|
||||
if (device_User != null) {
|
||||
int i = tbl_Device_Mapper.deleteDeviceUserById(device_User.getId());
|
||||
if (i > 0) {
|
||||
Tbl_Device device = getDeviceByCameraId(cameraId);
|
||||
redisKeyHelperI.deleteRedisByTbl_Device(device);
|
||||
redisKeyHelperI.deleteRedisByTbl_Device_User(device_User);
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 极光推送
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
public boolean jPushNotifcation(Map<String, String> baseMap, Map<String, String> pushMap) {
|
||||
try {
|
||||
//登录类型
|
||||
String loginType = baseMap.get("loginType");
|
||||
if (loginType != null) {
|
||||
//推送消息类型
|
||||
String msgType = pushMap.get("msg_type");
|
||||
String userId = baseMap.get("user_id");
|
||||
String title = baseMap.get("title");
|
||||
String content = baseMap.get("content");
|
||||
boolean result = false;
|
||||
if (loginType.equals("ios")) {
|
||||
result = jiGuangPush.pushMessageByIOS(title, content, userId, pushMap);
|
||||
} else if (loginType.equals("android")) {
|
||||
result = jiGuangPush.pushMessageByAndroid(title, content, userId, pushMap);
|
||||
}
|
||||
//推送记录
|
||||
Tbl_Push_List pushList = new Tbl_Push_List();
|
||||
if (msgType.equals(PushTypeEnum.remove_device.getKey())) {
|
||||
pushList.setUserId(Integer.valueOf(userId));
|
||||
pushList.setDeviceId(Integer.valueOf(pushMap.get("device_id")));
|
||||
pushList.setPhoneType(loginType);
|
||||
pushList.setShowName(pushMap.get("showName"));
|
||||
pushList.setPushType(msgType);
|
||||
pushList.setPushTitle(title);
|
||||
pushList.setPushContext(content);
|
||||
pushList.setJpushStatus(result ? "1" : "0");
|
||||
pushList.setCreateTime(new Date());
|
||||
pushMessageHelperI.save(pushList);
|
||||
return true;
|
||||
} //发送看护报告推送
|
||||
else if (msgType.equals(PushTypeEnum.send_report.getKey())) {
|
||||
String reportId = baseMap.get("reportId");
|
||||
if (reportId != null) {
|
||||
pushList.setReportId(Integer.valueOf(reportId));
|
||||
}
|
||||
pushList.setUserId(Integer.valueOf(userId));
|
||||
pushList.setPhoneType(loginType);
|
||||
pushList.setPushType(msgType);
|
||||
pushList.setPushTitle(title);
|
||||
pushList.setPushContext(content);
|
||||
pushList.setPushLink(pushMap.get("push_link"));
|
||||
pushList.setJpushStatus(result ? "1" : "0");
|
||||
pushList.setCreateTime(new Date());
|
||||
pushMessageHelperI.save(pushList);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* 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.helper;
|
||||
|
||||
import com.ifish.bean.Tbl_HardWare_Type;
|
||||
import com.ifish.bean.Tbl_Vender;
|
||||
import com.ifish.mapper.Tbl_Hardware_Type_Mapper;
|
||||
import com.ifish.util.IfishUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Component
|
||||
public class HardWareTypeHelper implements HardWareTypeHelperI {
|
||||
|
||||
/**
|
||||
* 所有tbl_Hardware_Type表的操作方法接口
|
||||
*/
|
||||
@Autowired
|
||||
private Tbl_Hardware_Type_Mapper tbl_Hardware_Type_Mapper;
|
||||
|
||||
/**
|
||||
* redis缓存服务器方法接口
|
||||
*/
|
||||
@Autowired
|
||||
private RedisHelperI redisHelperI;
|
||||
|
||||
@Autowired
|
||||
private RedisKeyHelperI redisKeyHelperI;
|
||||
|
||||
/**
|
||||
* 根据设备型号获取设备类型参数
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Tbl_HardWare_Type getHardwareTypeByTypeCode(String code) throws Exception {
|
||||
Tbl_HardWare_Type hardwareType = null;
|
||||
String key = redisKeyHelperI.getTbl_HardWare_TypeRedisKeyByTypeCode(code);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
hardwareType = (Tbl_HardWare_Type) IfishUtil.JsonToBean(redisString, Tbl_HardWare_Type.class);
|
||||
} else {
|
||||
hardwareType = tbl_Hardware_Type_Mapper.getHardwareTypeByTypeCode(code);
|
||||
if (hardwareType != null && StringUtils.isNotBlank(hardwareType.getHardwareType())) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(hardwareType));
|
||||
}
|
||||
}
|
||||
return hardwareType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据厂家code获取厂家信息
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Tbl_Vender getVenderListByBrandCode(String code) throws Exception {
|
||||
Tbl_Vender venderList = new Tbl_Vender();
|
||||
String key = redisKeyHelperI.getTbl_Vender_ListRedisKeyByCode(code);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
venderList = (Tbl_Vender) IfishUtil.JsonToBean(redisString, Tbl_Vender.class);
|
||||
} else {
|
||||
venderList = tbl_Hardware_Type_Mapper.getVenderListByBrandCode(code);
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(venderList));
|
||||
}
|
||||
return venderList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备型号获取厂家信息
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Tbl_Vender getVenderListByHardwareTypeCode(String code) throws Exception {
|
||||
Tbl_Vender venderList = new Tbl_Vender();
|
||||
String key = redisKeyHelperI.getTbl_Vender_ListRedisKeyByCode(code);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
venderList = (Tbl_Vender) IfishUtil.JsonToBean(redisString, Tbl_Vender.class);
|
||||
} else {
|
||||
venderList = tbl_Hardware_Type_Mapper.getVenderListByHardwareTypeCode(code);
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(venderList));
|
||||
}
|
||||
return venderList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* 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.helper;
|
||||
|
||||
import com.ifish.bean.Tbl_HardWare_Type;
|
||||
import com.ifish.bean.Tbl_Vender;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface HardWareTypeHelperI {
|
||||
|
||||
/**
|
||||
* 根据设备型号获取设备类型参数
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
Tbl_HardWare_Type getHardwareTypeByTypeCode(String code) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据厂家code获取厂家信息
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Tbl_Vender getVenderListByBrandCode(String code) throws Exception;
|
||||
|
||||
/**
|
||||
* 根据设备型号获取厂家信息
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Tbl_Vender getVenderListByHardwareTypeCode(String code) throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
* 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.helper;
|
||||
|
||||
import com.ifish.bean.PageResult;
|
||||
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.List;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Component
|
||||
public class PushMessageHelper implements PushMessageHelperI {
|
||||
|
||||
@Autowired
|
||||
private Tbl_Push_List_Mapper tbl_Push_List_Mapper;
|
||||
|
||||
@Autowired
|
||||
private RedisHelperI redisHelperI;
|
||||
|
||||
@Autowired
|
||||
private RedisKeyHelperI redisKeyHelperI;
|
||||
|
||||
/**
|
||||
* 根据条件获取推送列表
|
||||
*
|
||||
* @param pushId
|
||||
* @param userId
|
||||
* @param firstResult
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getPushList(String pushType, Integer userId, Integer firstResult, Integer pageSize) {
|
||||
try {
|
||||
if (firstResult == null) {
|
||||
firstResult = 0;
|
||||
}
|
||||
if (pageSize == null) {
|
||||
pageSize = 10;
|
||||
}
|
||||
if (userId == null) {
|
||||
return IfishUtil.returnJson(ResultEnum.error401.getKey(), "");
|
||||
}
|
||||
List<Tbl_Push_List> list = tbl_Push_List_Mapper.getPushList(userId, pushType, pageSize, firstResult);
|
||||
int count = tbl_Push_List_Mapper.getPushListCount(userId, pushType);
|
||||
PageResult page = new PageResult();
|
||||
page.setList(list);
|
||||
page.setPageNo(firstResult);
|
||||
page.setPageSize(pageSize);
|
||||
page.setTotalCount(count);
|
||||
return IfishUtil.returnPageData(page, ResultEnum.success.getKey());
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除推送消息
|
||||
*
|
||||
* @param userId
|
||||
* @param pushId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object deletePushList(Integer userId, Integer pushId) {
|
||||
try {
|
||||
Tbl_Push_List tpl = getPush_ListById(pushId);
|
||||
if (tpl.getUserId().equals(userId)) {
|
||||
int i = tbl_Push_List_Mapper.deletePushListById(pushId);
|
||||
if (i > 0) {
|
||||
return IfishUtil.returnJson(ResultEnum.success.getKey(), "");
|
||||
}
|
||||
}
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
} catch (Exception e) {
|
||||
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID从缓存中获取推送消息对象
|
||||
*
|
||||
* @param pushId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Tbl_Push_List getPush_ListById(Integer pushId) throws Exception {
|
||||
Tbl_Push_List list = null;
|
||||
String key = redisKeyHelperI.getTbl_Push_List_RedisByPushId(pushId);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
list = (Tbl_Push_List) IfishUtil.JsonToBean(redisString, Tbl_Push_List.class);
|
||||
} else {
|
||||
list = tbl_Push_List_Mapper.getPush_ListById(pushId);
|
||||
if (list != null && list.getPushId() > 0) {
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(list));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Tbl_Push_List save(Tbl_Push_List pushList) {
|
||||
try {
|
||||
int i = tbl_Push_List_Mapper.saveTbl_Push_List(pushList);
|
||||
if (i > 0) {
|
||||
return pushList;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* 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.helper;
|
||||
|
||||
import com.ifish.bean.Tbl_Push_List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface PushMessageHelperI {
|
||||
|
||||
/**
|
||||
* 根据条件获取推送列表
|
||||
*
|
||||
* @param pushId
|
||||
* @param userId
|
||||
* @param firstResult
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
Object getPushList(String pushType, Integer userId, Integer firstResult, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 删除推送消息
|
||||
*
|
||||
* @param userId
|
||||
* @param pushId
|
||||
* @return
|
||||
*/
|
||||
Object deletePushList(Integer userId, Integer pushId);
|
||||
|
||||
Tbl_Push_List save(Tbl_Push_List pushList);
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
|
|||
*/
|
||||
@Component
|
||||
public class RedisKeyHelper implements RedisKeyHelperI {
|
||||
|
||||
|
||||
@Autowired
|
||||
private RedisHelperI redisHelperI;
|
||||
|
||||
|
|
@ -69,6 +69,66 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
return RedisKey.USER_ID_KEY + userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件获取用户列表缓存key
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
@Override
|
||||
public String getUserListRedisKey(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 RedisKey.USER_LIST + userId + "_" + phoneNumber + "_" + userEmail + "_" + phoneType + "_" + isRegisterGwell + "_" + isRegisterJiguang + "_" + sortField + "_" + sortMode + "_" + nickName + "_" + remarks + "_" + loginTime1 + "_" + loginTime2 + "_" + createTime1 + "_" + createTime2 + "_" + start + "_" + length;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件搜索获取用户列表缓存key
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
@Override
|
||||
public String getUserListCountRedisKey(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 RedisKey.USER_LIST_COUNT + userId + "_" + phoneNumber + "_" + userEmail + "_" + phoneType + "_" + isRegisterGwell + "_" + isRegisterJiguang + "_" + sortField + "_" + sortMode + "_" + nickName + "_" + remarks + "_" + loginTime1 + "_" + loginTime2 + "_" + createTime1 + "_" + createTime2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表总数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getAllUserListCountRedisKey() {
|
||||
return RedisKey.USER_LIST_COUNT_ALL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据userName获取Tbl_Security_User管理用户的redis缓存key键值
|
||||
*
|
||||
|
|
@ -234,7 +294,7 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
|
||||
|
||||
public String getTbl_Live_Room_CountRedisKey() {
|
||||
return RedisKey.LIVEROOM_COUNT;
|
||||
}
|
||||
|
|
@ -341,6 +401,9 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
if (StringUtils.isNotBlank(tbl_User.getToken())) {
|
||||
redisHelperI.deleteRedis(getTbl_UserRedisKeyByToken(tbl_User.getToken()));
|
||||
}
|
||||
redisHelperI.delRedisByTagKey(RedisKey.USER_LIST);
|
||||
redisHelperI.delRedisByTagKey(RedisKey.USER_LIST_COUNT);
|
||||
redisHelperI.delRedisByTagKey(RedisKey.USER_LIST_COUNT_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -367,5 +430,5 @@ public class RedisKeyHelper implements RedisKeyHelperI {
|
|||
public void deleteRedisByLiveRoomListCount() {
|
||||
redisHelperI.deleteRedis(getTbl_Live_Room_CountRedisKey());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,57 @@ public interface RedisKeyHelperI {
|
|||
*/
|
||||
public String getTbl_UserRedisKeyByEmail(String email);
|
||||
|
||||
/**
|
||||
* 根据条件获取用户列表缓存key
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public String getUserListRedisKey(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);
|
||||
|
||||
/**
|
||||
* 根据条件搜索获取用户列表缓存key
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public String getUserListCountRedisKey(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
|
||||
*/
|
||||
public String getAllUserListCountRedisKey();
|
||||
|
||||
/**
|
||||
* 根据userName获取Tbl_Security_User管理用户的redis缓存key键值
|
||||
*
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public interface UserHelper {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
public Object getlist(String draw, Integer start, Integer pageSize);
|
||||
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);
|
||||
|
||||
/**
|
||||
* 修改备注
|
||||
|
|
@ -36,4 +36,14 @@ public interface UserHelper {
|
|||
* @return
|
||||
*/
|
||||
public Object updateRemarks(String userId, String remarks);
|
||||
|
||||
/**
|
||||
* 根据用户ID获取用户详情页
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public Object getUserDetail(String userId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,16 @@
|
|||
*/
|
||||
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_HardWare_Type;
|
||||
import com.ifish.bean.Tbl_Security_User;
|
||||
import com.ifish.bean.Tbl_User;
|
||||
import com.ifish.bean.Tbl_Vender;
|
||||
import com.ifish.mapper.Tbl_User_Mapper;
|
||||
import com.ifish.util.IfishUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -16,6 +22,7 @@ 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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -30,6 +37,10 @@ public class UserHelperI implements UserHelper {
|
|||
private RedisKeyHelperI redisKeyHelperI;
|
||||
@Autowired
|
||||
private Tbl_User_Mapper tbl_User_Mapper;
|
||||
@Autowired
|
||||
private DeviceHelper deviceHelper;
|
||||
@Autowired
|
||||
private HardWareTypeHelperI hardWareTypeHelperI;
|
||||
|
||||
@Override
|
||||
public Tbl_Security_User getTbl_Security_User(String usernameSring) {
|
||||
|
|
@ -57,25 +68,65 @@ public class UserHelperI implements UserHelper {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Object getlist(String draw, Integer start, Integer pageSize) {
|
||||
List<Map> list = tbl_User_Mapper.getUserList(start, pageSize);
|
||||
Integer count = tbl_User_Mapper.getUsersCount();
|
||||
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) {
|
||||
List<Map> list = null;
|
||||
String key = redisKeyHelperI.getUserListRedisKey(start, length, userId, phoneNumber, userEmail, phoneType, isRegisterGwell, isRegisterJiguang, sortField, sortMode, nickName, remarks, loginTime1, loginTime2, createTime1, createTime2);
|
||||
String redisString = redisHelperI.getRedis(key);
|
||||
try {
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
list = (List<Map>) IfishUtil.JsonToList(redisString, Map.class);
|
||||
} else {
|
||||
list = tbl_User_Mapper.getUserList(start, length, userId, phoneNumber, userEmail, phoneType, isRegisterGwell, isRegisterJiguang, sortField, sortMode, nickName, remarks, loginTime1, loginTime2, createTime1, createTime2);
|
||||
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);
|
||||
}
|
||||
if (map.get("loginTime") != null) {
|
||||
String loginTime = IfishUtil.format((Date) map.get("loginTime"));
|
||||
map.put("loginTime", loginTime);
|
||||
}
|
||||
}
|
||||
redisHelperI.setRedis(key, IfishUtil.ObjectToJson(list));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
Integer count = 0;
|
||||
key = redisKeyHelperI.getUserListCountRedisKey(userId, phoneNumber, userEmail, phoneType, isRegisterGwell, isRegisterJiguang, sortField, sortMode, nickName, remarks, loginTime1, loginTime2, createTime1, createTime2);
|
||||
redisString = redisHelperI.getRedis(key);
|
||||
try {
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
count = Integer.parseInt(redisString);
|
||||
} else {
|
||||
count = tbl_User_Mapper.getUsersCount(userId, phoneNumber, userEmail, phoneType, isRegisterGwell, isRegisterJiguang, sortField, sortMode, nickName, remarks, loginTime1, loginTime2, createTime1, createTime2);
|
||||
if (count != null && count > 0) {
|
||||
redisHelperI.setRedis(key, count.toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
for (Map map : list) {
|
||||
if (map.get("createTime") != null) {
|
||||
String createTime = IfishUtil.format((Date) map.get("createTime"));
|
||||
map.put("createTime", createTime);
|
||||
}
|
||||
if (map.get("loginTime") != null) {
|
||||
String loginTime = IfishUtil.format((Date) map.get("loginTime"));
|
||||
map.put("loginTime", loginTime);
|
||||
Integer allCount = 0;
|
||||
key = redisKeyHelperI.getAllUserListCountRedisKey();
|
||||
redisString = redisHelperI.getRedis(key);
|
||||
try {
|
||||
if (StringUtils.isNotBlank(redisString)) {
|
||||
allCount = Integer.parseInt(redisString);
|
||||
} else {
|
||||
allCount = tbl_User_Mapper.getAllUsersCount();
|
||||
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", count);
|
||||
map.put("recordsTotal", allCount);
|
||||
map.put("recordsFiltered", count);
|
||||
return map;
|
||||
}
|
||||
|
|
@ -99,4 +150,165 @@ public class UserHelperI implements UserHelper {
|
|||
return "false";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID获取用户详情页
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
public Object getUserDetail(String userId) {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
if (StringUtils.isBlank(userId)) {
|
||||
mv.setViewName("redirect:/userlist");
|
||||
return mv;
|
||||
}
|
||||
|
||||
try {
|
||||
//用户信息
|
||||
Tbl_User user = getUserById(Integer.parseInt(userId));
|
||||
if (user != null) {
|
||||
mv.addObject("user", user);
|
||||
//用户性别
|
||||
if (StringUtils.isNotBlank(user.getUserSex())) {
|
||||
String userSex = user.getUserSex().equals("1") ? "男" : "女";
|
||||
mv.addObject("userSex", userSex);
|
||||
} else {
|
||||
mv.addObject("userSex", "未填写");
|
||||
}
|
||||
//注册时间
|
||||
if (user.getCreateTime() != null) {
|
||||
mv.addObject("createTime", IfishUtil.format(user.getCreateTime()));
|
||||
}
|
||||
//极光推送
|
||||
if (StringUtils.isNotBlank(user.getJiguangUserid())) {
|
||||
mv.addObject("jiguang", user.getUserId());
|
||||
} else {
|
||||
mv.addObject("jiguang", "未注册别名");
|
||||
}
|
||||
|
||||
List<Tbl_Device_User> list = deviceHelper.getDeviceUsersByUserId(user.getUserId());
|
||||
List<Map> deviceMaps = new ArrayList<Map>();
|
||||
List<Map> cameraMaps = new ArrayList<Map>();
|
||||
for (Tbl_Device_User tbl_Device_User : list) {
|
||||
Tbl_Device device = deviceHelper.getDeviceById(tbl_Device_User.getDeviceId());
|
||||
if (StringUtils.isNotBlank(device.getCameraId())) {
|
||||
//摄像头信息
|
||||
Map map = new HashMap();
|
||||
//摄像头ID
|
||||
map.put("cameraId", device.getCameraId());
|
||||
//显示名称
|
||||
map.put("cameraName", tbl_Device_User.getShowName());
|
||||
//是否主控
|
||||
map.put("isMaster", tbl_Device_User.getIsMaster().equals("1") ? "<span class='btn btn-xs btn-success'>是</span>" : "<span class='btn btn-xs btn-danger'>否</span>");
|
||||
//是否直播
|
||||
map.put("isLive", tbl_Device_User.getIsLive().equals("1") ? "<span class='btn btn-xs btn-success'>是</span>" : "<span class='btn btn-xs btn-danger'>否</span>");
|
||||
//绑定时间
|
||||
map.put("bindTime", IfishUtil.format(tbl_Device_User.getCreateTime()));
|
||||
//激活时间
|
||||
if (device.getActiveTime() != null) {
|
||||
map.put("firsttime", IfishUtil.format(device.getActiveTime()));
|
||||
} else {
|
||||
map.put("firsttime", " ");
|
||||
}
|
||||
|
||||
cameraMaps.add(map);
|
||||
} else {
|
||||
//设备信息
|
||||
Tbl_HardWare_Type hardWare_Type = hardWareTypeHelperI.getHardwareTypeByTypeCode(device.getHardwareType());
|
||||
Tbl_Vender vender = hardWareTypeHelperI.getVenderListByHardwareTypeCode(hardWare_Type.getHardwareType());
|
||||
Tbl_Device_Statistics device_Statistics = deviceHelper.getDeviceStatisticsByDeviceId(device.getDeviceId());
|
||||
Map map = new HashMap();
|
||||
//设备ID
|
||||
map.put("deviceId", tbl_Device_User.getDeviceId());
|
||||
//设备MAC
|
||||
map.put("deviceMac", device.getMacAddress());
|
||||
//设备类型方案
|
||||
map.put("hardwareName", hardWare_Type.getHardwareName());
|
||||
//厂家名称
|
||||
if (vender != null) {
|
||||
map.put("brandName", vender.getBrandName());
|
||||
} else {
|
||||
map.put("brandName", " ");
|
||||
}
|
||||
//连接次数
|
||||
map.put("logincount", device_Statistics.getLoginCount());
|
||||
//最后登录时间
|
||||
if (device_Statistics.getLoginTime() != null) {
|
||||
map.put("lastlogintime", IfishUtil.format(device_Statistics.getLoginTime()));
|
||||
} else {
|
||||
map.put("lastlogintime", " ");
|
||||
}
|
||||
//设备展示名称
|
||||
map.put("deviceName", tbl_Device_User.getShowName());
|
||||
//是否主控
|
||||
map.put("isMaster", tbl_Device_User.getIsMaster().equals("1") ? "<span class='btn btn-xs btn-success'>是</span>" : "<span class='btn btn-xs btn-danger'>否</span>");
|
||||
//绑定时间
|
||||
map.put("bindTime", IfishUtil.format(tbl_Device_User.getCreateTime()));
|
||||
//首次激活时间
|
||||
if (device_Statistics.getFirstActivate() != null) {
|
||||
map.put("firsttime", IfishUtil.format(device_Statistics.getFirstActivate()));
|
||||
} else {
|
||||
map.put("firsttime", " ");
|
||||
}
|
||||
//出厂时间
|
||||
if (device_Statistics.getCreateTime() != null) {
|
||||
map.put("createTime", IfishUtil.format(device_Statistics.getCreateTime()));
|
||||
} else {
|
||||
map.put("createTime", " ");
|
||||
}
|
||||
//是否授权
|
||||
map.put("isBlacklist", device.getIsBlacklist().equals("1") ? "<span class='btn btn-xs btn-success'>是</span>" : "<span class='btn btn-xs btn-danger'>否</span>");
|
||||
deviceMaps.add(map);
|
||||
}
|
||||
}
|
||||
mv.addObject("listmap", deviceMaps);
|
||||
mv.addObject("cameraMaps", cameraMaps);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
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>");
|
||||
mv.setViewName("userdetail");
|
||||
mv.addObject("title", "用户详情");
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户ID从缓存中获取用户对象
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Tbl_User getUserById(Integer userId) throws Exception {
|
||||
Tbl_User tmpUser = null;
|
||||
String userKey = redisKeyHelperI.getTbl_UserRedisKeyByUserId(userId);
|
||||
String userString = redisHelperI.getRedis(userKey);
|
||||
//1.从数据库或缓存中读取用户对象
|
||||
if (StringUtils.isNotBlank(userString)) {
|
||||
tmpUser = (Tbl_User) IfishUtil.JsonToBean(userString, Tbl_User.class);
|
||||
} else {
|
||||
tmpUser = tbl_User_Mapper.getUserByUserId(userId + "");
|
||||
if (tmpUser != null && tmpUser.getUserId() > 0) {
|
||||
redisHelperI.setRedis(userKey, IfishUtil.ObjectToJson(tmpUser));
|
||||
}
|
||||
}
|
||||
return tmpUser;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,4 +35,14 @@ public interface Tbl_Hardware_Type_Mapper {
|
|||
*/
|
||||
@Select("select brand_code,brand_name,brand_introduce,brand_logo from tbl_vender_list where brand_code=#{code}")
|
||||
Tbl_Vender getVenderListByBrandCode(@Param("code") String code);
|
||||
|
||||
/**
|
||||
* 根据设备型号获取厂家信息
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Select("select a.brand_code,brand_name,brand_introduce,brand_logo from tbl_vender_list a LEFT JOIN tbl_vender_hardware b ON a.brand_code = b.brand_code where b.hardware_type=#{code}")
|
||||
Tbl_Vender getVenderListByHardwareTypeCode(@Param("code") String code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ package com.ifish.mapper;
|
|||
import com.ifish.bean.Tbl_Push_List;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.SelectProvider;
|
||||
|
|
@ -49,7 +50,7 @@ public interface Tbl_Push_List_Mapper {
|
|||
Integer deletePushListById(@Param("id") Integer pushId);
|
||||
|
||||
/**
|
||||
* 分页获取用户推送消息
|
||||
* 获取用户推送消息总数
|
||||
*
|
||||
* @param userId
|
||||
* @param pushType
|
||||
|
|
@ -57,7 +58,17 @@ public interface Tbl_Push_List_Mapper {
|
|||
* @param firstResult
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT COUNT(1) FROM TBL_PUSH_LIST WHERE user_id = #{userid} AND push_type = #{pushtype} LIMIT ${first},${pagesize}")
|
||||
Integer getPushListCount(@Param("userid") Integer userId, @Param("pushtype") String pushType, @Param("pagesize") Integer pageSize, @Param("first") Integer firstResult);
|
||||
@SelectProvider(type = Tbl_Push_List_MapperSql.class, method = "getPushListCount")
|
||||
Integer getPushListCount(@Param("userid") Integer userId, @Param("pushtype") String pushType);
|
||||
|
||||
/**
|
||||
* 插入一条推送信息
|
||||
*
|
||||
* @param tbl_Push_List
|
||||
* @return
|
||||
*/
|
||||
@Insert("INSERT INTO TBL_PUSH_LIST(user_id,device_id,show_name,phone_type,push_type,push_title,push_context,create_time,push_link,jpush_status,google_status,report_id,mcu_count,modular_count,router_count,server_count,server_try_count) VALUES (#{push.userId},#{push.deviceId},#{push.showName},#{push.phoneType},"
|
||||
+ "#{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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,4 +27,16 @@ public class Tbl_Push_List_MapperSql {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getPushListCount(@Param("userid") Integer userId, @Param("pushtype") String pushType) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("SELECT count(1) FROM TBL_PUSH_LIST WHERE ");
|
||||
sb.append("user_id = #{userid} ");
|
||||
if (StringUtils.isNotBlank(pushType)) {
|
||||
sb.append("AND push_type = #{pushtype} ");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public interface Tbl_User_Mapper {
|
|||
* @return
|
||||
*/
|
||||
@SelectProvider(type = Tbl_User_MapperSql.class, method = "getUserList")
|
||||
List<Map> getUserList(@Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize);
|
||||
List<Map> getUserList(@Param("start") Integer start, @Param("length") Integer length, @Param("userid") String userId, @Param("phone") String phoneNumber, @Param("email") String userEmail, @Param("phonetype") String phoneType, @Param("isgwell") String isRegisterGwell, @Param("isjiguang") String isRegisterJiguang, @Param("sortfield") String sortField, @Param("sortmode") String sortMode, @Param("nickname") String nickName, @Param("remarks") String remarks, @Param("logintime1") String loginTime1, @Param("logintime2") String loginTime2, @Param("createtime1") String createTime1, @Param("createtime2") String createTime2);
|
||||
|
||||
/**
|
||||
* 根据条件查询用户列表总数
|
||||
|
|
@ -128,5 +128,13 @@ public interface Tbl_User_Mapper {
|
|||
* @return
|
||||
*/
|
||||
@SelectProvider(type = Tbl_User_MapperSql.class, method = "getUsersCount")
|
||||
Integer getUsersCount();
|
||||
Integer getUsersCount(@Param("userid") String userId, @Param("phone") String phoneNumber, @Param("email") String userEmail, @Param("phonetype") String phoneType, @Param("isgwell") String isRegisterGwell, @Param("isjiguang") String isRegisterJiguang, @Param("sortfield") String sortField, @Param("sortmode") String sortMode, @Param("nickname") String nickName, @Param("remarks") String remarks, @Param("logintime1") String loginTime1, @Param("logintime2") String loginTime2, @Param("createtime1") String createTime1, @Param("createtime2") String createTime2);
|
||||
|
||||
/**
|
||||
* 获取所有用户列表总数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT count(1) FROM tbl_user")
|
||||
Integer getAllUsersCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,25 +98,119 @@ public class Tbl_User_MapperSql {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
public String getUserList(@Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize) {
|
||||
public String getUserList(@Param("start") Integer start, @Param("length") Integer length, @Param("userid") String userId, @Param("phone") String phoneNumber, @Param("email") String userEmail, @Param("phonetype") String phoneType, @Param("isgwell") String isRegisterGwell, @Param("isjiguang") String isRegisterJiguang, @Param("sortfield") String sortField, @Param("sortmode") String sortMode, @Param("nickname") String nickName, @Param("remarks") String remarks, @Param("logintime1") String loginTime1, @Param("logintime2") String loginTime2, @Param("createtime1") String createTime1, @Param("createtime2") String createTime2) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("SELECT user_id userId,phone_number phoneNumber,user_email userEmail,nick_name nickName,create_time createTime,phone_type phoneType,login_type loginType,login_time loginTime,login_count loginCount,address,is_register_gwell isRegisterGwell,jiguang_userid jiguangUserid,remarks FROM tbl_user \n"
|
||||
+ " ORDER BY user_id DESC "
|
||||
+ "LIMIT " + pageNo + "," + pageSize);
|
||||
sb.append("SELECT user_id userId,phone_number phoneNumber,user_email userEmail,nick_name nickName,create_time createTime,phone_type phoneType,login_type loginType,login_time loginTime,login_count loginCount,address,is_register_gwell isRegisterGwell,jiguang_userid jiguangUserid,remarks FROM tbl_user ");
|
||||
sb.append(" WHERE 1 = 1 ");
|
||||
if (StringUtils.isNotBlank(userId)) {
|
||||
sb.append("AND user_id = #{userid} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(phoneNumber)) {
|
||||
sb.append("AND phone_number = #{phone} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(userEmail)) {
|
||||
sb.append("AND user_email = #{email} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(phoneType)) {
|
||||
sb.append("AND phone_type = #{phonetype} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(isRegisterGwell)) {
|
||||
sb.append("AND is_register_gwell = #{isgwell} ");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(isRegisterJiguang) && isRegisterJiguang.equals("1")) {
|
||||
sb.append("AND jiguang_userid is not null AND jiguang_userid <> '' ");
|
||||
} else if (StringUtils.isNotBlank(isRegisterJiguang) && isRegisterJiguang.equals("0")) {
|
||||
sb.append("AND ( jiguang_userid is null or jiguang_userid = '') ");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(nickName)) {
|
||||
sb.append("AND nick_name like '%" + nickName + "%'");
|
||||
}
|
||||
if (StringUtils.isNotBlank(remarks)) {
|
||||
sb.append("AND remarks like '%" + remarks + "%'");
|
||||
}
|
||||
if (StringUtils.isNotBlank(loginTime1) && StringUtils.isNotBlank(loginTime2)) {
|
||||
sb.append("AND login_time BETWEEN #{logintime1} AND #{logintime2} ");
|
||||
} else if (StringUtils.isNotBlank(loginTime1)) {
|
||||
sb.append("AND login_time < #{logintime1} ");
|
||||
} else if (StringUtils.isNotBlank(loginTime2)) {
|
||||
sb.append("AND login_time > #{logintime2} ");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(createTime1) && StringUtils.isNotBlank(createTime2)) {
|
||||
sb.append("AND create_time BETWEEN #{createtime1} AND #{createtime2} ");
|
||||
} else if (StringUtils.isNotBlank(createTime1)) {
|
||||
sb.append("AND create_time < #{createtime1} ");
|
||||
} else if (StringUtils.isNotBlank(createTime2)) {
|
||||
sb.append("AND create_time > #{createtime2} ");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(sortField)) {
|
||||
sortField = "user_id";
|
||||
}
|
||||
if (StringUtils.isBlank(sortMode)) {
|
||||
sortMode = "DESC";
|
||||
}
|
||||
|
||||
sb.append(" ORDER BY " + sortField + " " + sortMode + " LIMIT " + start + "," + length);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 注册用户页,获取用户列表总数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getUsersCount() {
|
||||
public String getUsersCount(@Param("userid") String userId, @Param("phone") String phoneNumber, @Param("email") String userEmail, @Param("phonetype") String phoneType, @Param("isgwell") String isRegisterGwell, @Param("isjiguang") String isRegisterJiguang, @Param("sortfield") String sortField, @Param("sortmode") String sortMode, @Param("nickname") String nickName, @Param("remarks") String remarks, @Param("logintime1") String loginTime1, @Param("logintime2") String loginTime2, @Param("createtime1") String createTime1, @Param("createtime2") String createTime2) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("SELECT count(1) FROM tbl_user ");
|
||||
sb.append(" WHERE 1 = 1 ");
|
||||
if (StringUtils.isNotBlank(userId)) {
|
||||
sb.append("AND user_id = #{userid} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(phoneNumber)) {
|
||||
sb.append("AND phone_number = #{phone} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(userEmail)) {
|
||||
sb.append("AND user_email = #{email} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(phoneType)) {
|
||||
sb.append("AND phone_type = #{phonetype} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(isRegisterGwell)) {
|
||||
sb.append("AND is_register_gwell = #{isgwell} ");
|
||||
}
|
||||
if (StringUtils.isNotBlank(isRegisterJiguang) && isRegisterJiguang.equals("1")) {
|
||||
sb.append("AND jiguang_userid is not null AND jiguang_userid <> '' ");
|
||||
} else if (StringUtils.isNotBlank(isRegisterJiguang) && isRegisterJiguang.equals("0")) {
|
||||
sb.append("AND ( jiguang_userid is null or jiguang_userid = '') ");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(nickName)) {
|
||||
sb.append("AND nick_name like '%" + nickName + "%'");
|
||||
}
|
||||
if (StringUtils.isNotBlank(remarks)) {
|
||||
sb.append("AND remarks like '%" + remarks + "%'");
|
||||
}
|
||||
if (StringUtils.isNotBlank(loginTime1) && StringUtils.isNotBlank(loginTime2)) {
|
||||
sb.append("AND login_time BETWEEN #{logintime1} AND #{logintime2} ");
|
||||
} else if (StringUtils.isNotBlank(loginTime1)) {
|
||||
sb.append("AND login_time < #{logintime1} ");
|
||||
} else if (StringUtils.isNotBlank(loginTime2)) {
|
||||
sb.append("AND login_time > #{logintime2} ");
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(createTime1) && StringUtils.isNotBlank(createTime2)) {
|
||||
sb.append("AND create_time BETWEEN #{createtime1} AND #{createtime2} ");
|
||||
} else if (StringUtils.isNotBlank(createTime1)) {
|
||||
sb.append("AND create_time < #{createtime1} ");
|
||||
} else if (StringUtils.isNotBlank(createTime2)) {
|
||||
sb.append("AND create_time > #{createtime2} ");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ public class RedisKey {
|
|||
* 用户缓存前缀,以id进行存储
|
||||
*/
|
||||
public static final String USER_ID_KEY = "userE:id_";
|
||||
|
||||
/**
|
||||
* 用户缓存前缀,以手机号进行存储
|
||||
*/
|
||||
|
|
@ -24,12 +23,22 @@ public class RedisKey {
|
|||
* 用户缓存前缀,以邮箱进行存储
|
||||
*/
|
||||
public static final String USER_EMAIL = "userE:ema_";
|
||||
|
||||
/**
|
||||
* 用户列表缓存前缀
|
||||
*/
|
||||
public static final String USER_LIST = "userlistE:";
|
||||
/**
|
||||
* 用户列表总数缓存前缀(带条件)
|
||||
*/
|
||||
public static final String USER_LIST_COUNT = "userlistcountE:";
|
||||
/**
|
||||
* 所有用户列表缓存前缀(不需条件)
|
||||
*/
|
||||
public static final String USER_LIST_COUNT_ALL = "alluserlistcountE";
|
||||
/**
|
||||
* 用户缓存前缀,以token进行存储
|
||||
*/
|
||||
public static final String USER_TOKEN = "userE:to_";
|
||||
|
||||
/**
|
||||
* 管理用户缓存前缀
|
||||
*/
|
||||
|
|
@ -90,6 +99,11 @@ public class RedisKey {
|
|||
*/
|
||||
public static final String LIVEROOM_ROOMID = "liveroomE:id_";
|
||||
|
||||
/**
|
||||
* 直播间详情表缓存前缀,以摄像头ID进行存储
|
||||
*/
|
||||
public static final String LIVEROOM_CAMERAID = "liveroomE:cid_";
|
||||
|
||||
/**
|
||||
* 直播间详情表缓存前缀,以直播间ID进行存储
|
||||
*/
|
||||
|
|
@ -110,6 +124,11 @@ public class RedisKey {
|
|||
*/
|
||||
public static final String LIVEMESSAGE_ROOMID = "livemessageE:rid_";
|
||||
|
||||
/**
|
||||
* 指定直播间评论总数
|
||||
*/
|
||||
public static final String LIVEMESSAGE_COUNT = "livemessageCtE:rid_";
|
||||
|
||||
/**
|
||||
* 推送信息表缓存前缀,以推送Id进行存储
|
||||
*/
|
||||
|
|
@ -119,4 +138,9 @@ public class RedisKey {
|
|||
* 邮箱验证有效缓存key
|
||||
*/
|
||||
public static final String EMAIL_REGIESTER = "emailkeyE:";
|
||||
|
||||
/**
|
||||
* 邮箱验证修改密码有效缓存key
|
||||
*/
|
||||
public static final String EMAIL_UPDATEPASSWORD = "emialupE:";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@
|
|||
<link rel="icon" href="static/assets/img/ico/favicon.ico" type="image/png">
|
||||
<!-- Windows8 touch icon ( http://www.buildmypinnedsite.com/ )-->
|
||||
<meta name="msapplication-TileColor" content="#3399cc" />
|
||||
<!--<script src="static/assets/plugins/tables/jquery-1.10.2.min.js"></script>-->
|
||||
<script src="static/assets/plugins/tables/jquery-1.10.2.min.js"></script>
|
||||
<!-- Javascripts -->
|
||||
<!-- Load pace first -->
|
||||
<script src="static/assets/plugins/core/pace/pace.min.js"></script>
|
||||
<!-- Important javascript libs(put in all pages) -->
|
||||
<script src="static/assets/js/jquery-1.8.3.min.js"></script>
|
||||
<!--<script src="static/assets/js/jquery-1.8.3.min.js"></script>-->
|
||||
<script>
|
||||
window.jQuery || document.write('<script src="static/assets/js/libs/jquery-2.1.1.min.js">\x3C/script>')
|
||||
</script>
|
||||
|
|
@ -66,7 +66,9 @@
|
|||
<script type="text/javascript" src="static/assets/js/libs/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Bootstrap plugins -->
|
||||
<script src="static/assets/js/bootstrap/bootstrap.js"></script>
|
||||
<!--<script src="static/assets/js/bootstrap/bootstrap.js"></script>-->
|
||||
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" type="text/javascript"></script>
|
||||
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
|
||||
<!-- Core plugins ( not remove ever) -->
|
||||
<!-- Handle responsive view functions -->
|
||||
<script src="static/assets/js/jRespond.min.js"></script>
|
||||
|
|
@ -174,7 +176,28 @@
|
|||
<!-- End .page-header -->
|
||||
</div>
|
||||
<!-- End .row -->
|
||||
<t:insertAttribute name="body" />
|
||||
<div class="outlet">
|
||||
<!-- Start .outlet -->
|
||||
<!-- Page start here ( usual with .row ) -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<!-- col-lg-12 start here -->
|
||||
<div class="panel panel-default plain toggle panelClose panelRefresh">
|
||||
<!-- Start .panel -->
|
||||
<div class="panel-heading white-bg">
|
||||
<h4 class="panel-title">${pagetitle}</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<t:insertAttribute name="body" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- End .panel -->
|
||||
</div>
|
||||
<!-- col-lg-12 end here -->
|
||||
</div>
|
||||
<!-- Page End here -->
|
||||
</div>
|
||||
<!-- End .outlet -->
|
||||
</div>
|
||||
<!-- End .content-wrapper -->
|
||||
<div class="clearfix"></div>
|
||||
|
|
|
|||
|
|
@ -26,4 +26,9 @@
|
|||
<put-attribute name="body" value="/WEB-INF/views/user/list.jsp" />
|
||||
</definition>
|
||||
|
||||
<!-- 用户详情 -->
|
||||
<definition name="userdetail" extends="base">
|
||||
<put-attribute name="body" value="/WEB-INF/views/user/detail.jsp" />
|
||||
</definition>
|
||||
|
||||
</tiles-definitions>
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
<%--
|
||||
Document : detail
|
||||
Created on : 2017-7-31, 14:25:00
|
||||
Author : Administrator
|
||||
--%>
|
||||
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<h4>用户信息</h4>
|
||||
<table class="dataTable cell-border no-footer" role="grid" style="width: 1611px;">
|
||||
<thead>
|
||||
<tr role="row"><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 62px;">ID</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 110px;">用户昵称</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 66px;">性别</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 88px;">手机号</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 156px;">累计登陆次数</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 212px;">注册时间</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 133px;">技威code1</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 133px;">技威code2</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 134px;">技威用户ID</th><th class="sorting_disabled" rowspan="1" colspan="1" style="width: 157px;">极光推送别名</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr role="row" class="odd">
|
||||
<td>${user.userId}</td>
|
||||
<td>${user.nickName}</td>
|
||||
<td>${userSex}</td>
|
||||
<td>${user.phoneNumber}</td>
|
||||
<td>${user.loginCount}</td>
|
||||
<td>${createTime}</td>
|
||||
<td>${user.p2pverifyCode1}</td>
|
||||
<td>${user.p2pverifyCode2}</td>
|
||||
<td>${user.gwellUserid}</td>
|
||||
<td>${jiguang}</td>
|
||||
</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>
|
||||
<table class="dataTable cell-border no-footer" role="grid" style="width: 1611px;">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1">ID</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1">硬件mac</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >设备方案</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >厂家名称</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >连接次数</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >最后一次登陆时间</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >显示名称</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >是否主控</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >绑定时间</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >首次激活时间</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >出厂时间</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >授权</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" >操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${listmap}" var="item">
|
||||
<tr role="row" class="odd">
|
||||
<td>${item.deviceId}</td>
|
||||
<td>${item.deviceMac}</td>
|
||||
<td>${item.hardwareName}</td>
|
||||
<td>${item.brandName}</td>
|
||||
<td>${item.logincount}</td>
|
||||
<td>${item.lastlogintime}</td>
|
||||
<td>${item.deviceName}</td>
|
||||
<td>${item.isMaster}</td>
|
||||
<td>${item.bindTime}</td>
|
||||
<td>${item.firsttime}</td>
|
||||
<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);" 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>
|
||||
<table class="dataTable cell-border no-footer" role="grid" style="width: 1611px;">
|
||||
<thead>
|
||||
<tr role="row">
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" style="width: 62px;">摄像头ID</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" style="width: 110px;">显示名称</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" style="width: 66px;">是否主控</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" style="width: 88px;">是否直播</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" style="width: 156px;">绑定时间</th>
|
||||
<th class="sorting_disabled" rowspan="1" colspan="1" style="width: 212px;">激活时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${cameraMaps}" var="item1">
|
||||
<tr role="row" class="odd">
|
||||
<td>${item1.cameraId}</td>
|
||||
<td>${item1.cameraName}</td>
|
||||
<td>${item1.isMaster}</td>
|
||||
<td>${item1.isLive}</td>
|
||||
<td>${item1.bindTime}</td>
|
||||
<td>${item1.firsttime}</td>
|
||||
</tr>
|
||||
</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>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#myModal').modal('hide')
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
var a = $('#crumb');
|
||||
a.children()[1].remove();
|
||||
a.append('<li>用户详情<li>');
|
||||
|
||||
//绑定摄像头
|
||||
$("#bindCameraBtn").click(function () {
|
||||
console.log(1);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -6,158 +6,138 @@
|
|||
|
||||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||||
<!DOCTYPE html>
|
||||
<div class="outlet">
|
||||
<!-- Start .outlet -->
|
||||
<!-- Page start here ( usual with .row ) -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<!-- col-lg-12 start here -->
|
||||
<div class="panel panel-default plain toggle panelClose panelRefresh">
|
||||
<!-- Start .panel -->
|
||||
<div class="panel-heading white-bg">
|
||||
<h4 class="panel-title">用户列表</h4>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table id="searchTable" class="table table-bordered">
|
||||
<tbody><tr>
|
||||
<td class="important">
|
||||
<label>ID</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" id="userId" name="userId" values="10026" class="input-medium searchClass" min="1">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>手机号</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="phoneNumber" name="phoneNumber" class="input-medium searchClass" maxlength="15">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>邮箱</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="userEmail" name="userEmail" class="input-medium searchClass" maxlength="20">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>手机类型</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="phoneType" name="phoneType" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="ios">ios</option>
|
||||
<option value="android">android</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<table id="searchTable" class="table table-bordered">
|
||||
<tbody><tr>
|
||||
<td class="important">
|
||||
<label>ID</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" id="userId" name="userId" values="10026" class="input-medium searchClass" min="1">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>手机号</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="phoneNumber" name="phoneNumber" class="input-medium searchClass" maxlength="15">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>邮箱</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="userEmail" name="userEmail" class="input-medium searchClass" maxlength="20">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>手机类型</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="phoneType" name="phoneType" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="ios">ios</option>
|
||||
<option value="android">android</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="important">
|
||||
<label>是否注册技威</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isRegisterGwell" name="isRegisterGwell" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="0">否</option>
|
||||
<option value="1">是</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>是否注册极光</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isRegisterJiguang" name="isRegisterJiguang" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="0">否</option>
|
||||
<option value="1">是</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>排序字段</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="sortField" name="sortField" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="createTime">注册时间</option>
|
||||
<option value="loginTime">登陆时间</option>
|
||||
<option value="loginCount">登陆次数</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>排序方式</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="sortMode" name="sortMode" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="asc">升序↑</option>
|
||||
<option value="desc">降序↓</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="important">
|
||||
<label>昵称</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="nickName" name="nickName" class="input-medium searchClass" maxlength="10">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>备注</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="remarks" name="remarks" class="input-medium searchClass" maxlength="10">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="important">
|
||||
<label>是否注册技威</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isRegisterGwell" name="isRegisterGwell" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="0">否</option>
|
||||
<option value="1">是</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>是否注册极光</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isRegisterJiguang" name="isRegisterJiguang" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="0">否</option>
|
||||
<option value="1">是</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>排序字段</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="sortField" name="sortField" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="createTime">注册时间</option>
|
||||
<option value="loginTime">登陆时间</option>
|
||||
<option value="loginCount">登陆次数</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>排序方式</label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="sortMode" name="sortMode" class="input-medium searchClass">
|
||||
<option value="">请选择</option>
|
||||
<option value="asc">升序↑</option>
|
||||
<option value="desc">降序↓</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="important">
|
||||
<label>昵称</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="nickName" name="nickName" class="input-medium searchClass" maxlength="10">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>备注</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="remarks" name="remarks" class="input-medium searchClass" maxlength="10">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td class="important">
|
||||
<label>登陆时间</label>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<input type="text" id="loginTime1" name="loginTime1" class="input-medium searchClass" maxlength="20">~~<input type="text" id="loginTime2" name="loginTime2" class="input-medium searchClass" maxlength="20">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>注册时间</label>
|
||||
</td>
|
||||
<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 class="important">
|
||||
<label>登陆时间</label>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<input type="text" id="loginTime1" name="loginTime1" class="input-medium searchClass" maxlength="20">~~<input type="text" id="loginTime2" name="loginTime2" class="input-medium searchClass" maxlength="20">
|
||||
</td>
|
||||
<td class="important">
|
||||
<label>注册时间</label>
|
||||
</td>
|
||||
<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>
|
||||
|
||||
</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>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>用户信息</th>
|
||||
<th>注册信息</th>
|
||||
<th>登陆信息</th>
|
||||
<th>注册地址</th>
|
||||
<th>注册技威</th>
|
||||
<th>注册极光</th>
|
||||
<th>备注</th>
|
||||
<th>操作</th>
|
||||
<th>详情</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End .panel -->
|
||||
</div>
|
||||
<!-- col-lg-12 end here -->
|
||||
</div>
|
||||
<!-- Page End here -->
|
||||
</div>
|
||||
<!-- End .outlet -->
|
||||
</table>
|
||||
|
||||
<script>
|
||||
function refreshTable() {
|
||||
|
|
@ -165,13 +145,6 @@
|
|||
table.ajax.reload(null, false);
|
||||
}
|
||||
|
||||
$.fn.dataTable.ext.search.push(
|
||||
function (settings, data, dataIndex) {
|
||||
var userId = parseInt($('#userId').val(), 10);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
//备注
|
||||
function remarks(userId, remarks) {
|
||||
if (remarks == 'undefined') {
|
||||
|
|
@ -367,7 +340,7 @@
|
|||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "";
|
||||
if (row.jiguangUserid != null && row.jiguangUserid == '') {
|
||||
if (row.jiguangUserid != null && row.jiguangUserid !== '') {
|
||||
str = "<span class='btn btn-success btn-alt'>是</span></br>";
|
||||
} else {
|
||||
str = "<span class='btn btn-danger btn-alt'>否</span></br>";
|
||||
|
|
@ -392,12 +365,24 @@
|
|||
return str;
|
||||
}
|
||||
},
|
||||
{"data": "userId"}
|
||||
{
|
||||
"data": "userId",
|
||||
render: function (data, type, row, meta) {
|
||||
var str = "<a href='userDetail?userId=" + row.userId + "' target='_blank' title='详情' class='label label-primary'><span class='im-profile'></span></a>";
|
||||
return str;
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
$('#userId').keyup(function () {
|
||||
//table.ajax.reload(null, true);
|
||||
$('#phoneType,#isRegisterGwell,#isRegisterJiguang,#sortField,#sortMode').change(function () {
|
||||
table.ajax.reload(null, true);
|
||||
});
|
||||
|
||||
$(document).keyup(function (event) {
|
||||
if (event.keyCode == 13) {
|
||||
table.ajax.reload(null, true);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue