5.6-5.8工作记录2—改造ssh
前言
作战过程
5.7项目上篇——分页模糊查询
jsp
找到对应的action并且复制
ctirl+f搜索对应的
dtmfacesnapshotHeartSearchIndexCommon
ctrl+鼠标点开
ssm PK ssh
都是mvc架构
区别 | ssm | ssh |
---|---|---|
控制层controller | controller | action |
逻辑层service | XXXservice | XXXXLogic(逻辑层) |
模型层model | XXXdto/entity | bean |
需求:实现这个页面
准备ssm
DtmFacesnapShotHeartController
package svs.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import svs.service.CommonJsonService;
@Controller
public class DtmFacesnapShotHeartController {
@Resource
private CommonJsonService objCommonJsonService;
@RequestMapping("/dtmfacesnapshotHeartSearchIndexCommon")
public String heartTongjiIndex(HttpSession session, HttpServletRequest request, Model model) {
//判断Session是否失效
return "device/deviceFacesnapshotHeartInfoSearchCommon";//跳转jsp
}
}
DtmFacesnapShotHeartJsonController
package svs.controller;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import svs.dao.ISearchDao;
import svs.service.CommonJsonService;
import svs.service.TongJiJsonService;
@Controller
public class DtmFacesnapShotHeartJsonController {
// service层
// @Resource
// private DeviceEventLogic objDeviceEventLogic;
// 实体类
// @Resource
// private DeviceEventReBean objDeviceEventReBean;
@Resource
private CommonJsonService objCommonJsonService;
// 每页数量
private int intPageNum;
// 总记录数
private int intAllCount;
// 当前页
private int intCpage;
private String jsonMsg;
private int jsonFlag;
@RequestMapping("/SearchDtmfacesnapshotHeart")
@ResponseBody
public Map<String, Object> SearchDtmfacesnapshotHeart(HttpSession session, HttpServletRequest request) {
Map<String, Object> mpList = new HashMap<String, Object>();
// 判断Session是否失效
if (!objCommonJsonService.SystemBool(session)) {
mpList.put("jsonFlag", -2);
mpList.put("jsonMsg", "Session失效,请重新登录!");
return mpList;
}
try {
//数据字典(下拉框)
// 用户区县权限
String areaID = (String) session.getAttribute("areaID");
// 用户类型2.单位5.管理7.内保
String loginUserType = (String) session.getAttribute("loginUserType");
//调用service层人脸心跳识别初始化逻辑
// objDeviceEventLogic.setObjDeviceEventReBean(objDeviceEventReBean);
// if(objDeviceEventLogic.dtmfacesnapshotHeartSearchIndexCommonLogic(areaID,loginUserType)){
// return "success";
// }
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return mpList;
}
return mpList;
}
}
对比ssh:
/**
*人脸抓拍系统心跳信息查询 初始化
*
* @param areaID 用户区县权限
* @return
*/
public boolean dtmfacesnapshotHeartSearchIndexCommonLogic(String areaID,String loginUserType) {
try {
// 办公 区县合集
List<DictionaryArea> listDictionaryAreaSearch =null;
//用户类型2.单位5.管理7.内保
if(loginUserType.equals("7")) {
listDictionaryAreaSearch = objFeverSvsSystemCommonLogic.dictionaryAreaSearch(areaID,"310100000000");
objDeviceEventReBean.setListDictionaryAreaFacesnapshotHeartSearch(listDictionaryAreaSearch);
}else {
objDeviceEventReBean.setListDictionaryAreaFacesnapshotHeartSearch(null);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
工作bug记录
尝试解决1:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [javax.enterprise.inject.Model]: Specified class is an interface
尝试二:试想应该是导入错了类的包
注意
加了/就搜不到,这样是错误的做法
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
解决:
.toString()
[org.springframework.jdbc.support.SQLErrorCodesFactory] - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
打怪
查询以及分页
主要用户区县的权限得到的null,
思路:想到了去logincontroller找是否有这个session
发现是大小写问题,我晕
然后是解决这个list
到service层发现逻辑返回的是null(笑哭)
修改后
又一个null
又是没有对应好的问题
第二:优先使用String.valueOf() 代替toString()
sql语句问题(由三部分组成)
select ase_id, ase01, ase02, ase03, ase04, ase05, ase06, ase07, ase08, ase09, ase10, ase11, ase12, ase13, ase14, ase15, ase16, ase17, ase18, ase19, ase20, ase21, ase22, ase23, ase24, ase25, ase26, ase27, ase28, ase29, ase30, ase31, dfh01, dfh02, dfh03
from dtm_facesnapshot_heart where 1=1
LEFT OUTER JOIN dtm_usecompany_trade ON dtm_usecompany_device.dud07 = dtm_usecompany_trade.dut04 WHERE 1=1 AND dtm_usecompany_device.dud04 IN (1,2) AND dut02 = ‘15’
查询后定位到第二部分
正确的sql
select * from dtm_facesnapshot_heart
LEFT JOIN dtm_usecompany_device ON dtm_facesnapshot_heart.ase01 = dtm_usecompany_device.dud02
LEFT JOIN dtm_usecompany_info ON dtm_usecompany_device.dud07 = dtm_usecompany_info.dui_id
LEFT JOIN dtm_usecompany_trade ON dtm_usecompany_device.dud07 = dtm_usecompany_trade.dut04
LEFT JOIN dtm_neibaouser_trade ON dtm_usecompany_trade.dut02 = dtm_neibaouser_trade.dnt02
WHERE 1=1 AND dtm_usecompany_device.dud04 IN (1,2) AND dut02 = ‘15’
知识点
如何把stringbuffer转成string
当然不可以直接强制转换。不过可以相互转换。从String到StringBuffer:StringBuffer sb = New StringBuffer("abcd");从StringBuffer到String:String str = sb.toString();
Java避免NullPointerException
优先使用String.valueOf() 代替toString()
当您代码中的某个对象需要用字符串的方式来表示时,请避免使用该对象的toString方法;因为若你的对象引用为null,则会抛出 NullPointerException。
相反,考虑使用静态String.valueOf方法,该方法不会抛出任何异常,若对象引用为空,则打印「null」字符串。
换个思路:发现是调用的sql错了 这不仅仅是一个单表查询
ssh
准备第二天工作:下拉框数据字典
参考
页面
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html>
<head>
<meta charset="utf-8"/>
<meta name="renderer" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all"/>
<link rel="stylesheet" href="layuiadmin/style/admin.css" media="all"/>
<script src="js/jquery-1.7.1.js"></script>
<script src="js/userjs/common.js"></script>
</head>
<body>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-form" style="margin-bottom: 10px;" >
单位名称:
<div class="layui-inline" style='text-align:left;width:165px;'>
<input class="layui-input" name="dtmUsecompanyInfoEditSearchDui02" id="dtmUsecompanyInfoEditSearchDui02" autocomplete="off"/>
</div>
<label style='width:130px;display:inline-block;'>统一社会信用代码:</label>
<div class="layui-inline" style='text-align:left;width:165px;'>
<input class="layui-input" name="dtmUsecompanyInfoEditSearchDui01" id="dtmUsecompanyInfoEditSearchDui01" autocomplete="off"/>
</div>
</div>
<div class="layui-form" style="margin-bottom: 10px;" >
办公区县:
<div class="layui-inline" style='text-align:left;width:165px;'>
<select name="dtmUsecompanyInfoEditSearchDui32" id="dtmUsecompanyInfoEditSearchDui32" lay-filter="setAreaEditSearch" >
<option value="-1"> 请选择</option>
<c:forEach items="${listDictionaryAreaUsecompanyInfoEditSearch }" var="listDictionaryArea">
<option value="${listDictionaryArea.da02 }">${listDictionaryArea.da01 }</option>
</c:forEach>
</select>
</div>
<label style='width:130px;display:inline-block;'>所属派出所:</label>
<div class="layui-inline" style='text-align:left;width:165px;'>
<select id="dtmUsecompanyInfoEditSearchDui36" name="dtmUsecompanyInfoEditSearchDui36">
</select>
</div>
<button class="layui-btn" onclick="dtmUsecompanyInfoEditSearchBtn();"><i class="layui-icon layui-icon-search"></i>搜索</button>
</div>
</div>
<div>
<table class="layui-table" lay-filter="dtmUsecompanyInfoEditSearchTable" lay-data="{height:'full-160',cellMinWidth: 80 }">
<thead id="dtmUsecompanyInfoEditSearchthead">
</thead>
<tbody id="dtmUsecompanyInfoEditSearchtbody">
</tbody>
</table>
<div id="dtmUsecompanyInfoEditSearchPage"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 单位名称 -->
<input type="hidden" name="dtmUsecompanyInfoEditSearchHiddenDui02" id="dtmUsecompanyInfoEditSearchHiddenDui02" />
<!-- 单位编码 -->
<input type="hidden" name="dtmUsecompanyInfoEditSearchHiddenDui01" id="dtmUsecompanyInfoEditSearchHiddenDui01" />
<!-- 办公区县 -->
<input type="hidden" name="dtmUsecompanyInfoEditSearchHiddenDui32" id="dtmUsecompanyInfoEditSearchHiddenDui32" />
<!--所属派出所 -->
<input type="hidden" name="dtmUsecompanyInfoEditSearchHiddenDui36" id="dtmUsecompanyInfoEditSearchHiddenDui36" />
<!-- 分页必需 -->
<input type="hidden" id="dtmUsecompanyInfoEditSearchHiddenCpage" name="dtmUsecompanyInfoEditSearchHiddenCpage" value="1"/>
<input type="hidden" id="dtmUsecompanyInfoEditSearchHiddenTotalNum" name="dtmUsecompanyInfoEditSearchHiddenTotalNum" value="-1"/>
<!-- 派出所权限 -->
<input type="hidden" id="dtmUsecompanyInfoEditSearchHiddenPoliceID" name="dtmUsecompanyInfoEditSearchHiddenPoliceID" value="${strPoliceID }"/>
<script src="layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['table','laypage', 'layer','index', 'form', 'laydate'], function(){
var laypage = layui.laypage
,table=layui.table
,$ = layui.$
,admin = layui.admin
,element = layui.element
,layer = layui.layer
,laydate = layui.laydate
,form = layui.form;
//初始化分页
laypage.render({
elem:'dtmUsecompanyInfoEditSearchPage'
,count:0
,limit:15
,curr:1
,layout: [ 'prev', 'page', 'next','count', 'skip']
});
//表单重新渲染
form.render();
//监听区联动注册
form.on('select(setAreaEditSearch)', function(data){
//加载派出所下拉框,并选中办公派出所
setAreaPoliceQx($("#dtmUsecompanyInfoEditSearchDui32").val(),'dtmUsecompanyInfoEditSearchDui36',$("#dtmUsecompanyInfoEditSearchDui36").val(),$("#dtmUsecompanyInfoEditSearchHiddenPoliceID").val());
});
});
//检索
function dtmUsecompanyInfoEditSearchBtn(){
//单位名称
$("#dtmUsecompanyInfoEditSearchHiddenDui02").val($("#dtmUsecompanyInfoEditSearchDui02").val());
//单位编码
$("#dtmUsecompanyInfoEditSearchHiddenDui01").val($("#dtmUsecompanyInfoEditSearchDui01").val());
//办公区县
$("#dtmUsecompanyInfoEditSearchHiddenDui32").val($("#dtmUsecompanyInfoEditSearchDui32").val());
//所属派出所
$("#dtmUsecompanyInfoEditSearchHiddenDui36").val($("#dtmUsecompanyInfoEditSearchDui36").val());
$("#dtmUsecompanyInfoEditSearchHiddenCpage").val(1);
$("#dtmUsecompanyInfoEditSearchHiddenTotalNum").val(-1);
dtmUsecompanyInfoEditSearchSubmit();
}
//提交检索
function dtmUsecompanyInfoEditSearchSubmit(){
//单位名称
var dui02 = $("#dtmUsecompanyInfoEditSearchHiddenDui02").val();
//单位编码
var dui01 = $("#dtmUsecompanyInfoEditSearchHiddenDui01").val();
//办公区县
var dui32 = $("#dtmUsecompanyInfoEditSearchHiddenDui32").val();
//所属派出所
var dui36 = $("#dtmUsecompanyInfoEditSearchHiddenDui36").val();
//当前页
var Cpage = $("#dtmUsecompanyInfoEditSearchHiddenCpage").val();
//总页数
var totalNum = $("#dtmUsecompanyInfoEditSearchHiddenTotalNum").val();
//加载数据层
var indexs=layer.load(3);
$.ajax({
url : "dtmUsecompanyInfoEditSearch.action",
type : "POST",
data : {
dui02 : dui02,
dui01 : dui01,
dui32 : dui32,
dui36 : dui36,
Cpage : Cpage,
totalNum : totalNum
},
dataType : "json",
async:false,
success : function(data) {
var strTable = "";
var intPageNum = data["intPageNum"];
var totalPageSize = data["intAllCount"];
var jsonFlag = data["jsonFlag"];
var listUserDtmUsecompanyInfoEditSearch = data["listUserDtmUsecompanyInfoEditSearch"];
$("#dtmUsecompanyInfoEditSearchtbody").text("");//先清空原先内容
if (jsonFlag == 1) {
//有数据
if(listUserDtmUsecompanyInfoEditSearch != null && listUserDtmUsecompanyInfoEditSearch.length > 0){
for(var i=0;i<listUserDtmUsecompanyInfoEditSearch.length;i++){
strTable = strTable + "<tr>";
if(listUserDtmUsecompanyInfoEditSearch[i].dui02 != null && listUserDtmUsecompanyInfoEditSearch[i].dui02 != ""){
strTable = strTable + "<td><a style='color:blue;text-decoration:underline;' lay-text='单位编辑' lay-href='dtmUsecompanyInfoEditIndex.action?duiId="+listUserDtmUsecompanyInfoEditSearch[i].duiId+"' >"+listUserDtmUsecompanyInfoEditSearch[i].dui02+"</a></td>";
}else{
strTable = strTable + "<td></td>";
}
if(listUserDtmUsecompanyInfoEditSearch[i].dui01 != null && listUserDtmUsecompanyInfoEditSearch[i].dui01 != ""){
strTable = strTable + "<td>"+listUserDtmUsecompanyInfoEditSearch[i].dui01+"</td>";
}else{
strTable = strTable + "<td></td>";
}
if(listUserDtmUsecompanyInfoEditSearch[i].dui05 != null && listUserDtmUsecompanyInfoEditSearch[i].dui05 != ""){
strTable = strTable + "<td>"+listUserDtmUsecompanyInfoEditSearch[i].dui05+"</td>";
}else{
strTable = strTable + "<td></td>";
}
if(listUserDtmUsecompanyInfoEditSearch[i].dui06 != null && listUserDtmUsecompanyInfoEditSearch[i].dui06 != ""){
strTable = strTable + "<td>"+listUserDtmUsecompanyInfoEditSearch[i].dui06+"</td>";
}else{
strTable = strTable + "<td></td>";
}
if(listUserDtmUsecompanyInfoEditSearch[i].dui03 != null && listUserDtmUsecompanyInfoEditSearch[i].dui03 != ""){
strTable = strTable + "<td>"+listUserDtmUsecompanyInfoEditSearch[i].dui03+"</td>";
}else{
strTable = strTable + "<td></td>";
}
if(listUserDtmUsecompanyInfoEditSearch[i].dui04 != null && listUserDtmUsecompanyInfoEditSearch[i].dui04 != ""){
strTable = strTable + "<td>"+listUserDtmUsecompanyInfoEditSearch[i].dui04+"万元</td>";
}else{
strTable = strTable + "<td></td>";
}
strTable = strTable + "</tr>";
}
$("#dtmUsecompanyInfoEditSearchtbody").html(strTable);
}else{
layer.msg('没有查询到数据!', {offset: '150px',icon: 1});
}
//显示表格
layui.use(['table'], function(){//------
var table = layui.table;
//初始化表格
table.init('dtmUsecompanyInfoEditSearchTable', {
height: 'full-160' //设置高度
,limit:intPageNum
//支持所有基础参数
,page: false //是否分页
});
})//------
//分页
layui.use(['laypage'], function(){//------
var laypage = layui.laypage;
//初始化分页
laypage.render({
elem:'dtmUsecompanyInfoEditSearchPage'
,count:totalPageSize
,limit:intPageNum
,curr:Cpage
,layout: [ 'prev', 'page', 'next','count', 'skip']
,jump: function(obj, first){
if(!first){
$("#dtmUsecompanyInfoEditSearchHiddenCpage").val(obj.curr);
dtmUsecompanyInfoEditSearchSubmit();
}
}
});
})//------
} else if (jsonFlag == -2) {
layer.msg("Session失效,请重新登录!",{
icon: 2,
time: 2000
}, function(){
window.location = "${pageContext.request.contextPath}/communitySessionError.jsp";
});
} else if (jsonFlag == -1) {
layer.msg('单位查询失败!', {offset: '15px',icon: 2});
} else {
layer.msg('单位查询失败!', {offset: '15px',icon: 2});
}
//加载数据层关闭
layer.close(indexs);
return false;
}
});
}
//表头初始化
function dtmUsecompanyInfoEditSearchTableInit(){
$("#dtmUsecompanyInfoEditSearchthead").text("");//先清空原先内容
var thead = document.getElementById('dtmUsecompanyInfoEditSearchthead');
var tr = document.createElement("tr");
tr.innerHTML=
'<th lay-data="{field:\'dui02\', width:230}">单位名称</th>' +
'<th lay-data="{field:\'dui01\', width:200}">统一社会信用代码</th>' +
'<th lay-data="{field:\'dui05\', width:130}">单位规模</th>' +
'<th lay-data="{field:\'dui06\', width:120}">单位性质</th>' +
'<th lay-data="{field:\'dui03\', width:180}">成立日期</th>' +
'<th lay-data="{field:\'dui04\', width:130}">注册资金</th>'
thead.appendChild(tr);
}
dtmUsecompanyInfoEditSearchTableInit();
</script>
</body>
</html>
主要部分
5.8项目下篇——数据字典下拉框加载
整理
跳转页面初始化数据(调到jsp页面,加载下拉框)——》
DeviceEventController
package svs.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import svs.dto.DictionaryArea;
import svs.dto.DictionaryCity;
import svs.dto.DtmFacesnapshotHeart;
import svs.service.CommonJsonService;
import svs.service.DeviceEventJsonService;
import svs.service.DeviceEventService;
@Controller
public class DeviceEventController {
@Resource
private DeviceEventService objDeviceEventService;
@Resource
private CommonJsonService objCommonJsonService;
@RequestMapping("/dtmfacesnapshotHeartSearchIndexCommon")
public String dtmfacesnapshotHeartSearchIndexCommon(HttpSession session, HttpServletRequest request, Model model) {
// 判断Session是否失效
if (!objCommonJsonService.SystemBool(session)) {
request.setAttribute("strErrorMsg", "Session失效,请重新登录!");
return "communitySessionError";
}
try {
// 用户区县权限
String areaId = session.getAttribute("AreaID").toString();
// 派出所
String policeId = session.getAttribute("PoliceID").toString();
// // 用户类型2.单位5.管理7.内保
String loginUserType = session.getAttribute("loginUserType").toString();
if (objDeviceEventService.searchdtmfacesnapshotHeartSearchIndexCommon(areaId, loginUserType, model) > 0) {
return "device/deviceFacesnapshotHeartInfoSearchCommon";// 跳转jsp
}
return "communitySessionError";// jsp页面
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
return "communitySessionError";// jsp页面
}
}
}
package svs.service;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import svs.dao.IInsertOperDao;
import svs.dao.ISearchDao;
import svs.dao.IUpDeOperDao;
import svs.dao.IUserSearchDao;
import svs.dto.DictionaryArea;
import svs.dto.DictionaryCity;
import svs.dto.DtmFacesnapshotHeart;
@Service("DeviceEventService")
public class DeviceEventService {
@Resource
private ISearchDao objSearchDao;
@Resource
private IInsertOperDao objInsertOperDao;
@Resource
private IUpDeOperDao objUpDeOperDao;
@Resource
private IUserSearchDao objIUserSearchDao;
@Resource
private CommonJsonService objCommonJsonService;
/**
* 人脸抓拍系统心跳信息查询 初始化
*
* @param areaID 用户区县权限
* @param loginUserType
* @return
*/
public int searchdtmfacesnapshotHeartSearchIndexCommon(String areaID, String loginUserType, Model model) {
try {
// 办公 区县合集 下拉框
List<DictionaryArea> listDictionaryAreaSearch = null;
// 用户类型2.单位5.管理7.内保
if (loginUserType.equals("7")) {
// 区县集合表,用于区县集合初始化
listDictionaryAreaSearch = objCommonJsonService.searchDictionaryAreaQx(areaID, "310100000000");
model.addAttribute("listDictionaryAreadeviceFacesnapshotHeartInfoSearch", listDictionaryAreaSearch);
// 派出所下拉框
// model.addAttribute("strPoliceID", policeId);
} else {
model.addAttribute("listDictionaryAreadeviceFacesnapshotHeartInfoSearch", null);
}
return 1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
}
DeviceEventService
package svs.service;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import svs.dao.IInsertOperDao;
import svs.dao.ISearchDao;
import svs.dao.IUpDeOperDao;
import svs.dao.IUserSearchDao;
import svs.dto.DictionaryArea;
import svs.dto.DictionaryCity;
import svs.dto.DtmFacesnapshotHeart;
@Service("DeviceEventService")
public class DeviceEventService {
@Resource
private ISearchDao objSearchDao;
@Resource
private IInsertOperDao objInsertOperDao;
@Resource
private IUpDeOperDao objUpDeOperDao;
@Resource
private IUserSearchDao objIUserSearchDao;
@Resource
private CommonJsonService objCommonJsonService;
/**
* 人脸抓拍系统心跳信息查询 初始化
*
* @param areaID 用户区县权限
* @param loginUserType
* @return
*/
public int searchdtmfacesnapshotHeartSearchIndexCommon(String areaID, String loginUserType, Model model) {
try {
// 办公 区县合集 下拉框
List<DictionaryArea> listDictionaryAreaSearch = null;
// 用户类型2.单位5.管理7.内保
if (loginUserType.equals("7")) {
// 区县集合表,用于区县集合初始化
listDictionaryAreaSearch = objCommonJsonService.searchDictionaryAreaQx(areaID, "310100000000");
model.addAttribute("listDictionaryAreadeviceFacesnapshotHeartInfoSearch", listDictionaryAreaSearch);
// 派出所下拉框
// model.addAttribute("strPoliceID", policeId);
} else {
model.addAttribute("listDictionaryAreadeviceFacesnapshotHeartInfoSearch", null);
}
return 1;
} catch (Exception e) {
e.printStackTrace();
return -1;
}
}
}
package svs.service;
import org.springframework.stereotype.Service;
@Service("objSqlConstant")
public class SqlConstant {
/自定义信息表 开始 ///
// 内保用户区县派出所 信息表
public static String sqlUserDtmNeiBaouserPolice = "select ROW_NUMBER() OVER() as dnp_id,array_to_string(array(select a.dnp01 FROM dtm_neibaouser_police a WHERE a.dnp03=c.dnp03), ',') AS policewybm, array_to_string(array(select b.dnp02 FROM dtm_neibaouser_police b WHERE b.dnp03=c.dnp03), ',') AS areawybm,c.dnp03 FROM dtm_neibaouser_police c where 1=1 ";
// 管理用户权限菜单表
public static String sqlUserDtmSystemuserAuthority = "select dsa03 as systemMenuId,array_to_string(array(select dsa02 FROM dtm_systemuser_authority WHERE dsa03=dsa03), ',') as systemMenuString from dtm_systemuser_authority where 1=1 ";
// 内保用户系统权限菜单关系表
public static String sqlDtmNeibaouserAuthoritymenu = "select dna_id, dna01, dna02, dna03 from dtm_neibaouser_authoritymenu where 1=1 ";
// 内保用户权限菜单表
public static String sqlUserDtmNeibaouserAuthoritymenu = "select dna03 as systemMenuId,array_to_string(array(select dna02 FROM dtm_neibaouser_authoritymenu WHERE dna03=dna03), ',') as systemMenuString from dtm_neibaouser_authoritymenu where 1=1 ";
// 单位用户权限菜单表
public static String sqlUserDtmUsecompanyAuthoritymenu = "select a.dua03 as systemMenuId,array_to_string(array(select b.dua02 FROM dtm_usecompany_authoritymenu b WHERE b.dua03=a.dua03), ',') as systemMenuString from dtm_usecompany_authoritymenu a where 1=1 ";
// 自定义 用户信息表
public static String sqlUserDtmNeiBaoUser = "select dnu_id, array_to_string(array(select dnu02 FROM dtm_neibao_user WHERE dnu01=tempa.dnu01 and dnu07=1), ',') AS dnu02 , array_to_string(array(select dnu08 FROM dtm_neibao_user WHERE dnu01=tempa.dnu01 and dnu07=1), ',') AS dnu08 FROM dtm_neibao_user as tempa where 1=1 ";
// 自定义 用户信息表
public static String sqlUserDtmUsecompanyInfo = "select dui_id,dui01,dui02,dui03,dui04,(select dcs01 from dictionary_company_scale where dcs_id=dui05) as dui05,(select det01 from dictionary_economic_type where det_id=dui06) as dui06 FROM dtm_usecompany_info where 1=1 ";
// 派出所
public static String sqlUserDictionaryPoliceStation = "select dps_id, dps01, dps04, (select da01 from dictionary_area where da02 = dps05 ) as dps05Name FROM dictionary_police_station where 1=1 ";
// 用户列表
public static String sqlUserDtmNeiBaoUserSearch = "select distinct dnu_id, dnu01, dnu02, dnu03, dnu04, dnu07 FROM dtm_neibao_user LEFT OUTER JOIN dtm_neibaouser_police on dnp03 = dnu_id where 1 = 1";
// 区域信息表
public static String sqlUserDtmCommunity = "select dc_id, dc01, dc02, dc03, dc04, dc05, dc06, dc07, dc08, dc09, dc10, dc11, dc12, dc13, dc14, dc15, dc16, dc17, dc18, dc19, dc20, dc21, dc22, dc23, dc24, dc25, (select dr03 from dictionary_road where dr01=dc07) as dc07Name from dtm_community where 1=1 ";
// 区域实有装备信息表
public static String sqlUserDtmCommunityEquipment = "select dce_id, dce01, dce02, dce03, dce04, dce05, dce06, dce07, dce08, dce09, dce10, dce11, dce12, dce13, dce14, dce15, dce16, dce17, dce18,(select det01 from dictionary_equipment_type where det_id=dce02) as dce02Name from dtm_community_equipment where 1=1 ";
// 人员信息表
public static String sqlUserDtmPersonInfoSearch = "SELECT distinct dpi_id,dpi01,(SELECT dct01 FROM dictionary_card_type WHERE dct03=dpi01 ) AS dpi01Name,dpi02,dpi03,dpi04,to_char(dpi06, 'YYYY-MM-DD') AS dpi06,dpi16 from dtm_person_info LEFT OUTER JOIN dtm_person_label ON dpl01 = dpi02 where 1=1 ";
// 人员信息表
public static String sqlUserDtmPersonInfo = "SELECT dpi_id, dpi01, dpi02, dpi03, dpi04, dpi05, to_char(dpi06, 'YYYY-MM-DD') AS dpi06, dpi07, dpi08, dpi09, dpi10, dpi11, dpi12, dpi13, dpi14, dpi15, dpi16, dpi17, dpi18, dpi19, dpi20, dpi21, dpi22, dpi23, dpi24, dpi25, dpi26, dpi27, dpi28, dpi29, dpi30, dpi31, dpi32, dpi33, dpi34, dpi35, dpi36, dpi37, dpi38, dpi39, dpi40, dpi41, dpi42, dpi43, dpi44, dpi45, dpi46, dpi47, dpi48, dpi49, dpi50, dpi51, dpi52, dpi53, dpi54, dpi55, dpi56 from dtm_person_info where 1=1 ";
// 人员标签信息 list (自定义)
public static String sqlUserDtmPersonLabelSearch = "SELECT dpl_id,(select dis02 from dictionary_information_source where dis01=dpl03) as dsi02,(select dil01 from dictionary_information_level where dil_id=dpl04)as dil01,(select dpf01 from dictionary_person_feature where dpf_id=dpl05) as dpf01 FROM dtm_person_label where 1=1 ";
// 区域实有力量信息表
public static String sqlUserDtmCommunityPower = "select dcp_id, dcp01, dcp02, dcp03, dcp04, dcp05, dcp06, dcp07, dcp08, dcp09, dcp10, dcp11, dcp12, dcp13, dcp14, dcp15, dcp16, dcp17,(select df03 from dtm_floor where df01=dcp01 and df02=dcp02) as dcp02Name, (select dct01 from dictionary_card_type where dct03=dcp04 and dct04 = '1' ) as dcp04Name, (select dpt01 from dictionary_power_type where dpt_id=dcp08) as dcp08Name from dtm_community_power where 1=1 ";
// 区域出入口信息表
public static String sqlUserDtmCommunityEntrance = "SELECT dce_id, dce01, dce02, dce03, dce04, dce05, dce06, dce07, dce08, dce09, dce10, dce11, dce12, dce13, dce14, dce15, dce16, dce17, dce18, dce19, dce20, dce21, dce22, dce23,dcp15,dcp02 FROM dtm_community_entrance left outer join dtm_community_parking on dtm_community_entrance.dce19=dtm_community_parking.dcp02 where 1=1";
// 系统输入信息表(设备信息)
public static String sqlUserAgentSystemEnter = "select ase_id, ase01, (select dst01 from dictionary_system_type where dst02 = ase02) as ase02, ase05, ase06, ase07, ase11, ase17 from agent_system_enter where 1=1 ";
// 事件统计表
public static String sqlUserDtmEventTongjiSearch = "SELECT det_id,dui.dui02,det02, det03, det04, det05, det06, det07, det08 FROM dtm_event_tongji as det left outer join dtm_usecompany_info as dui on dui.dui_id=det.det01 left outer join dtm_usecompany_trade as dut on dut.dut04=dui.dui_id where 1=1 ";
// 心跳统计表
public static String sqlUserHeartTongJiSearch = "SELECT dht_id, dht01, dht02, dht03, dht04, dht05, dht06, dht07 FROM dtm_heart_tongji where 1=1 ";
// 用户人脸心跳表
public static String sqlUserDtmFacesnapshotHeart = "SELECT ase_id,ase01,ase30,ase31,dfh01,dfh02,dfh03 from dtm_facesnapshot_heart LEFT JOIN dtm_usecompany_info ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_info.dui_id LEFT JOIN dtm_usecompany_trade ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_trade.dut04 WHERE 1=1";
/ 自定义信息表 开始
/ ///
/信息表 开始 ///
// 人脸心跳表
public static String sqlDtmFacesnapshotHeart = "select ase_id, ase01, ase02, ase03, ase04, ase05, ase06, ase07, ase08, ase09, ase10, ase11, ase12, ase13, ase14, ase15, ase16, ase17, ase18, ase19, ase20, ase21, ase22, ase23, ase24, ase25, ase26, ase27, ase28, ase29, ase30, ase31, dfh01, dfh02, dfh03 from dtm_facesnapshot_heart where 1=1 ";
// 人脸事件表
public static String sqlDtmFacesnapshotEvent = "select dde_id, dde01, dde02, dde03, dde04, dde05, dde06, dde07, dde08, dde09, dde10, dde11, dde12, dde13, dde14, dde15, dde16, dde17, dde18, dde19, dde20, dfe01, dfe02, dfe03, dfe04, dfe05, dfe06, dfe07 from dtm_facesnapshot_event where 1=1 ";
// 系统输入组件表(前端信息)
public static String sqlAgentSystemEnterPart = "select asep_id, asep01, asep02, asep03, asep04, asep05, asep06, asep07, asep08, asep09, asep10, asep11, asep12, asep13, asep14, asep15, asep16, asep17, asep18, asep19, asep20, asep21, asep22, asep23, asep24, asep25 from agent_system_enter_part where 1=1 ";
// 系统输入信息表(设备信息)
public static String sqlAgentSystemEnter = "select ase_id, ase01, ase02, ase03, ase04, ase05, ase06, ase07, ase08, ase09, ase10, ase11, ase12, ase13, ase14, ase15, ase16, ase17, ase18, ase19, ase20, ase21, ase22, ase23, ase24, ase25, ase26, ase27, ase28, ase29 from agent_system_enter where 1=1 ";
// 使用单位行业关系表
public static String sqlDtmUsecompanyTrade = "select dut_id, dut01, dut02, dut03, dut04, dut05, dut06, dut07, dut08 from dtm_usecompany_trade where 1=1 ";
// 使用单位信息表
public static String sqlDtmUsecompanyInfo = "select dui_id, dui01, dui02, dui03, dui04, dui05, dui06, dui07, dui08, dui09, dui10,dui11, dui12, dui13, dui14, dui15, dui16, dui17, dui18, dui19, dui20, dui21, dui22,dui23, dui24, dui25, dui26, dui27, dui28, dui29, dui30, dui31, dui32, dui33, dui34,dui35, dui36, dui37, dui38, dui39, dui40, dui41, dui42, dui43, dui44, dui45, dui46,dui47 from dtm_usecompany_info where 1=1 ";
// 使用单位设备关系表
public static String sqlDtmUsecompanyDevice = "select dud_id, dud01, dud02, dud03, dud04, dud05, dud06, dud07 from dtm_usecompany_device where 1=1 ";
// 使用单位用户系统权限菜单关系表
public static String sqlDtmUsecompanyAuthoritymenu = "select dua_id, dua01, dua02, dua03 from dtm_usecompany_authoritymenu where 1=1 ";
// 系统菜单信息表
public static String sqlDtmSystemMenu = "select dsm_id, dsm01, dsm02, dsm03, dsm04 from dtm_system_menu where 1=1 ";
// 系统权限信息表
public static String sqlDtmSystemAuthority = "select dsa_id, dsa01, dsa02, dsa03 from dtm_system_authority where 1=1 ";
// 系统日志表
public static String sqlDtmSvssystemLog = "select dsl_id, dsl01, dsl02, dsl03, dsl04, dsl05, dsl06, dsl07, dsl08, dsl09, dsl10, dsl11, dsl12, dsl13, dsl14, dsl15, dsl16, dsl17, dsl18, dsl19, dsl20, dsl21, dsl22, dsl23, dsl24, dsl25, dsl26, dsl27, dsl28, dsl29 from dtm_svssystem_log where 1=1 ";
// 内保用户-行业关系表
public static String sqlDtmNeibaouserTrade = "select dnt_id, dnt01, dnt02 from dtm_neibaouser_trade where 1=1 ";
// 内保用户派出所关系表
public static String sqlDtmNeibaouserPolice = "select dnp_id, dnp01, dnp02, dnp03 from dtm_neibaouser_police where 1=1 ";
// 内保用户信息表
public static String sqlDtmNeibaoUser = "select dnu_id, dnu01, dnu02, dnu03, dnu04, dnu05, dnu06, dnu07, dnu08, dnu09, dnu10, dnu11, dnu12 from dtm_neibao_user where 1=1 ";
// 内保用户系统权限菜单关系表
// 日志表
public static String sqlDtmLog = "select dl_id, dl01, dl02, dl03, dl04, dl05, dl06, dl07, dl08, dl09, dl10 from dtm_log where 1=1 ";
// 房屋信息表
public static String sqlDtmHouse = "select dh_id, dh01, dh02, dh03, dh04, dh05, dh06, dh07, dh08, dh09, dh10, dh11, dh12, dh13, dh14, dh15, dh16, dh17, dh18, dh19, dh20, dh21, dh22, dh23 from dtm_house where 1=1 ";
// 楼栋信息表
public static String sqlDtmFloor = "select df_id, df01, df02, df03, df04, df05, df06, df07, df08, df09, df10, df11, df12, df13, df14, df15, df16, df17, df18 from dtm_floor where 1=1 ";
// 区域实有力量信息表
public static String sqlDtmCommunityPower = "select dcp_id, dcp01, dcp02, dcp03, dcp04, dcp05, dcp06, dcp07, dcp08, dcp09, dcp10, dcp11, dcp12, dcp13, dcp14, dcp15, dcp16, dcp17 from dtm_community_power where 1=1 ";
// 区域停车库(场)信息表
public static String sqlDtmCommunityParking = "select dcp_id, dcp01, dcp02, dcp03, dcp04, dcp05, dcp06, dcp07, dcp08, dcp09, dcp10, dcp11, dcp12, dcp13, dcp14, dcp15, dcp16, dcp17, dcp18, dcp19 from dtm_community_parking where 1=1 ";
// 区域信息表
public static String sqlDtmCommunity = "select dc_id, dc01, dc02, dc03, dc04, dc05, dc06, dc07, dc08, dc09, dc10, dc11, dc12, dc13, dc14, dc15, dc16, dc17, dc18, dc19, dc20, dc21, dc22, dc23, dc24, dc25 from dtm_community where 1=1 ";
// 区域实有装备信息表
public static String sqlDtmCommunityEquipment = "select dce_id, dce01, dce02, dce03, dce04, dce05, dce06, dce07, dce08, dce09, dce10, dce11, dce12, dce13, dce14, dce15, dce16, dce17, dce18 from dtm_community_equipment where 1=1 ";
// 区域出入口信息表
public static String sqlDtmCommunityEntrance = "select dce_id, dce01, dce02, dce03, dce04, dce05, dce06, dce07, dce08, dce09, dce10, dce11, dce12, dce13, dce14, dce15, dce16, dce17, dce18, dce19, dce20, dce21, dce22, dce23 from dtm_community_entrance where 1=1 ";
// 单位区域关系表
public static String sqlDtmUsecompanyCommunity = "select duc_id, duc01, duc02, duc03, duc04, duc05, duc06, duc07, duc08, duc09, duc10 from dtm_usecompany_community where 1=1 ";
// 人员信息表
public static String sqlDtmPersonInfo = "select dpi_id, dpi01, dpi02, dpi03, dpi04, dpi05, dpi06, dpi07, dpi08, dpi09, dpi10, dpi11, dpi12, dpi13, dpi14, dpi15, dpi16, dpi17, dpi18, dpi19, dpi20, dpi21, dpi22, dpi23, dpi24, dpi25, dpi26, dpi27, dpi28, dpi29, dpi30, dpi31, dpi32, dpi33, dpi34, dpi35, dpi36, dpi37, dpi38, dpi39, dpi40, dpi41, dpi42, dpi43, dpi44, dpi45, dpi46, dpi47, dpi48, dpi49, dpi50, dpi51, dpi52, dpi53, dpi54, dpi55, dpi56 from dtm_person_info where 1=1 ";
// 人员标签信息表
public static String sqlDtmPersonLabel = "select dpl_id,dpl01,dpl02,dpl03,dpl04,dpl05,dpl06,dpl07 from dtm_person_label where 1=1 ";
// 人员房屋关系表
public static String sqlDtmPersonCommunity = "select dpc_id, dpc01, dpc02, dpc03, dpc04, dpc05, dpc06, dpc07, dpc08, dpc09, dpc10, dpc11, dpc12 from dtm_person_community where 1=1 ";
/信息表 结束 ///
/字典表 开始 ///
// 坐标系信息表
public static String sqlDictionaryZuobiao = "select dz_id, dz01, dz02 from dictionary_zuobiao where 1=1 ";
// 行业信息表
public static String sqlDictionaryTrade = "select dt_id, dt01, dt02 from dictionary_trade where 1=1 ";
// 街道信息表
public static String sqlDictionaryStreet = "select ds_id, ds01, ds02, ds03, ds04 from dictionary_street where 1=1 ";
// 道路信息表
public static String sqlDictionaryRoad = "select dr_id, dr01, dr02, dr03 from dictionary_road where 1=1 ";
// 省信息表'
public static String sqlDictionaryProvince = "select dp_id, dp01, dp02, dp03 from dictionary_province where 1=1 ";
// 实有力量分类信息表
public static String sqlDictionaryPowerType = "select dpt_id, dpt01, dpt02 from dictionary_power_type where 1=1 ";
// 派出所信息表
public static String sqlDictionaryPoliceStation = "select dps_id, dps01, dps02, dps03, dps04, dps05, dps06, dps07, dps08, dps09, dps10, dps11, dps12, dps13, dps14, dps15, dps16, dps17, dps18, dps19 from dictionary_police_station where 1=1 ";
// 日志类型
public static String sqlDictionaryLogType = "select dlt_id, dlt01, dlt02, dlt03 from dictionary_log_type where 1=1 ";
// 信息等级表
public static String sqlDictionaryInformationLevel = "select dil_id, dil01, dil02 from dictionary_information_level where 1=1 ";
// 房屋用途信息表
public static String sqlDictionaryHouseUse = "select dhu_id, dhu01, dhu02 from dictionary_house_use where 1=1 ";
// 房屋类别信息表
public static String sqlDictionaryHouseType = "select dht_id, dht01, dht02 from dictionary_house_type where 1=1 ";
// 实有装备类型信息表
public static String sqlDictionaryEquipmentType = "select det_id, det01, det02 from dictionary_equipment_type where 1=1 ";
// 出入口类型
public static String sqlDictionaryEntranceType = "select det_id, det01, det02 from dictionary_entrance_type where 1=1 ";
// 单位性质信息表
public static String sqlDictionaryEconomicType = "select det_id, det01, det02 from dictionary_economic_type where 1=1 ";
// 单位规模信息表
public static String sqlDictionaryCompanyScale = "select dcs_id, dcs01, dcs02 from dictionary_company_scale where 1=1 ";
// 市信息表
public static String sqlDictionaryCity = "select dc_id, dc01, dc02, dc03, dc04 from dictionary_city where 1=1 ";
// 证件类别信息表
public static String sqlDictionaryCardType = "select dct_id, dct01, dct02, dct03, dct04 from dictionary_card_type where 1=1 ";
// 区县信息表
public static String sqlDictionaryArea = "select da_id, da01, da02, da03, da04, da05, da06, da07, da08 from dictionary_area where 1=1 ";
// 人员特征信息表
public static String sqlDictionaryPersonFeature = "select dpf_id, dpf01, dpf02 from dictionary_person_feature where 1=1 ";
// 人屋关系信息表
public static String sqlDictionaryPersonHouse = "select dph_id, dph01, dph02 from dictionary_person_house where 1=1 ";
// 人员类别信息表
public static String sqlDictionaryPersonType = "select dpt_id, dpt01, dpt02 from dictionary_person_type where 1=1 ";
// 文化程度信息表
public static String sqlDictionaryCulturalLevel = "select dcl_id, dcl01, dcl02 from dictionary_cultural_level where 1=1 ";
// 信息来源表
public static String sqlDictionaryInformationSource = "select dis_id, dis01, dis02, dis03 from dictionary_information_source where 1=1 ";
// 婚姻状况信息表
public static String sqlDictionaryMarriageSituation = "select dms_id, dms01, dms02 from public.dictionary_marriage_situation where 1=1 ";
// 国家信息表
public static String sqlDictionaryNation = "select dn_id, dn01, dn02, dn03, dn04, dn05, dn06 from public.dictionary_nation where 1=1 ";
// 民族信息表
public static String sqlDictionaryNationpeople = "select dn_id, dn01, dn02, dn03 from public.dictionary_nationpeople where 1=1 ";
// 系统类型分类表
public static String sqlDictionarySystemType = "select dst_id, dst01, dst02, dst03, dst04, dst05 from dictionary_system_type where 1=1 ";
/字典表 结束 ///
}
重要的人脸心跳信息查询sql
SELECT ase_id,ase01,ase30,ase31,dfh01,dfh02,dfh03 from dtm_facesnapshot_heart
LEFT JOIN dtm_usecompany_info ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_info.dui_id
LEFT JOIN dtm_usecompany_trade ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_trade.dut04
WHERE 1=1
ase14=1 and ase19 in (1,2)
AND dut02 = '15'
逻辑处理数据(按下搜索按钮才会加载分页数据)——》带json的controller+service
SELECT ase_id,ase01,ase30,ase31,dfh01,dfh02,dfh03 from dtm_facesnapshot_heart
LEFT JOIN dtm_usecompany_info ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_info.dui_id
LEFT JOIN dtm_usecompany_trade ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_trade.dut04
WHERE 1=1
service层
package svs.service;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import svs.dao.IInsertOperDao;
import svs.dao.ISearchDao;
import svs.dao.IUpDeOperDao;
import svs.dao.IUserSearchDao;
import svs.dto.DtmFacesnapshotHeart;
import svs.dto.DtmSvssystemLog;
@Service("DeviceEventJsonService")
public class DeviceEventJsonService {
@Resource
private SqlConstant sqlConstant;
@Resource
private ISearchDao objSearchDao;
@Resource
private IInsertOperDao objInsertOperDao;
@Resource
private IUpDeOperDao objUpDeOperDao;
@Resource
private IUserSearchDao objIUserSearchDao;
@Resource
private CommonJsonService objCommonJsonService;
/**
* 人脸抓拍心跳信息表 查询 List
*
* @param objDtmSvssystemLog
* @param areaId
* @param policeId
* @param dui02 单位名称
* @param dfh01 设备编码
* @param dfh02Start 开始时间
* @param dfh02End 结束时间
* @param dfh02Type 心跳时间1.有2.没有
* @param deviceHeartSql 权限
* @param intPageNum
* @param intCpage
* @return
*/
public List<DtmFacesnapshotHeart> searchdtmDeviceFacesnapshotHeartFind(DtmSvssystemLog objDtmSvssystemLog,
String dnu08, String areaId, String policeId, String dui02, String dfh01, String dfh02Start,
String dfh02End, String dfh02Type, String deviceHeartSql, int intPageNum, int intCpage) {
try {
StringBuffer strSql = new StringBuffer(sqlConstant.sqlUserDtmFacesnapshotHeart+" And ase14=1 and ase19 in (1,2) ");
// 行业ID
if (dnu08 != null && "".equals(dnu08) == false) {
strSql.append(" AND dut02 in (" + dnu08 + ") ");
}
// 区县
if (areaId != null && "".equals(areaId) == false && "-1".equals(areaId) == false) {
strSql.append(" AND dui32 in (" + areaId + ") ");
}
// 派出所
if (policeId != null && "".equals(policeId) == false && "-1".equals(policeId) == false) {
strSql.append(" AND dui36 in (" + policeId + ") ");
}
// 单位名称
if (dui02 != null && "".equals(dui02) == false) {
strSql.append(" AND dui02 LIKE '%" + dui02 + "%' ");
}
// 设备编码
if (dfh01 != null && "".equals(dfh01) == false) {
strSql.append(" and dfh01 like '%" + dfh01 + "%' ");
}
// 是否有心跳时间1.有2.没有
if (dfh02Type.equals("1")) {
// 开始时间
if (dfh02Start != null && "".equals(dfh02Start) == false) {
strSql.append(" and dfh02 >= '" + dfh02Start + "' ");
}
// 结束时间
if (dfh02End != null && "".equals(dfh02End) == false) {
strSql.append(" and dfh02 <= '" + dfh02End + "' ");
}
strSql.append(" AND dfh02 IS not NULL ");
} else {
strSql.append(" AND dfh02 IS NULL ");
}
strSql.append(" order by dfh02 desc limit ").append(intPageNum).append(" offset ")
.append((intCpage - 1) * intPageNum);
// 记录应用系统日志-OpType 操作行为类型0.登录1.查询 2.新增3.修改4.删除5.退出
objDtmSvssystemLog.setDsl16(1);
// 记录应用系统日志-OperateCondition 操作类型为1-查询 3-修改
// 4-删除类型时,记录用户进行操作时的数据筛选条件,填写数据操作SQL语句where子句内容
objDtmSvssystemLog
.setDsl17(strSql.substring(strSql.indexOf("where") + 5).replace("'", "''").replace("1=1", ""));
// 记录应用系统日志-FuncModuleName 操作人所操作的应用内的具体功能模块名称
objDtmSvssystemLog.setDsl25("人脸抓拍-心跳查询");
// 记录应用系统日志-Query Sql 当操作执行为SQL语句时,填写SQL语句
objDtmSvssystemLog.setDsl28(strSql.toString().replace("'", "''").replace("1=1", ""));
// 记录应用系统日志-OperateResult 操作人的操作结果0.失败1.成功
objDtmSvssystemLog.setDsl18(1);
// 最终调用日志入库
objCommonJsonService.feverSvsSystemLog(objDtmSvssystemLog);
return objSearchDao.selectDtmFacesnapshotHeart(strSql.toString());
} catch (Exception e) {
// TODO: handle exception
return null;
}
}
/**
* 人脸抓拍心跳信息表 查询 List 的count
*
* @param dui02 单位名称
* @param dfh01 设备编码
* @param dfh02Start 开始时间
* @param dfh02End 结束时间
* @param dfh02Type 心跳时间1.有2.没有
* @param deviceSql 权限
* @param totalNum
* @return
*/
public int searchdtmDeviceFacesnapshotHeartFindCount(String areaId, String policeId, String dui02, String dfh01,
String dnu08,String dfh02Start, String dfh02End, String dfh02Type, String deviceHeartSql, String totalNum) {
try {
int intTotalNum = Integer.valueOf(totalNum);
if (intTotalNum > 0) {
return intTotalNum;
} else {
StringBuffer strSql = new StringBuffer("select COUNT(DISTINCT dfh_id) from dtm_facesnapshot_heart LEFT JOIN dtm_usecompany_info ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_info.dui_id LEFT JOIN dtm_usecompany_trade ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_trade.dut04 WHERE 1=1 ");
// 行业ID
if (dnu08 != null && "".equals(dnu08) == false) {
strSql.append(" AND dut02 in (" + dnu08 + ") ");
}
// 区县
if (areaId != null && "".equals(areaId) == false && "-1".equals(areaId) == false) {
strSql.append(" AND dui32 in (" + areaId + ") ");
}
// 派出所
if (policeId != null && "".equals(policeId) == false && "-1".equals(policeId) == false) {
strSql.append(" AND dui36 in (" + policeId + ") ");
}
// 单位名称
if (dui02 != null && "".equals(dui02) == false) {
strSql.append(" AND dui02 LIKE '%" + dui02 + "%' ");
}
// 设备编码
if (dfh01 != null && "".equals(dfh01) == false) {
strSql.append(" and dfh01 like '%" + dfh01 + "%' ");
}
// 是否有心跳时间1.有2.没有
if (dfh02Type.equals("1")) {
// 开始时间
if (dfh02Start != null && "".equals(dfh02Start) == false) {
strSql.append(" and dfh02 >= '" + dfh02Start + "' ");
}
// 结束时间
if (dfh02End != null && "".equals(dfh02End) == false) {
strSql.append(" and dfh02 <= '" + dfh02End + "' ");
}
strSql.append(" AND dfh02 IS not NULL ");
} else {
strSql.append(" AND dfh02 IS NULL ");
}
return objSearchDao.selectCountList(strSql.toString());
}
} catch (Exception e) {
// TODO: handle exception
return -1;
}
}
}
controller
package svs.service;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import svs.dao.IInsertOperDao;
import svs.dao.ISearchDao;
import svs.dao.IUpDeOperDao;
import svs.dao.IUserSearchDao;
import svs.dto.DtmFacesnapshotHeart;
import svs.dto.DtmSvssystemLog;
@Service("DeviceEventJsonService")
public class DeviceEventJsonService {
@Resource
private SqlConstant sqlConstant;
@Resource
private ISearchDao objSearchDao;
@Resource
private IInsertOperDao objInsertOperDao;
@Resource
private IUpDeOperDao objUpDeOperDao;
@Resource
private IUserSearchDao objIUserSearchDao;
@Resource
private CommonJsonService objCommonJsonService;
/**
* 人脸抓拍心跳信息表 查询 List
*
* @param objDtmSvssystemLog
* @param areaId
* @param policeId
* @param dui02 单位名称
* @param dfh01 设备编码
* @param dfh02Start 开始时间
* @param dfh02End 结束时间
* @param dfh02Type 心跳时间1.有2.没有
* @param deviceHeartSql 权限
* @param intPageNum
* @param intCpage
* @return
*/
public List<DtmFacesnapshotHeart> searchdtmDeviceFacesnapshotHeartFind(DtmSvssystemLog objDtmSvssystemLog,
String dnu08, String areaId, String policeId, String dui02, String dfh01, String dfh02Start,
String dfh02End, String dfh02Type, String deviceHeartSql, int intPageNum, int intCpage) {
try {
StringBuffer strSql = new StringBuffer(sqlConstant.sqlUserDtmFacesnapshotHeart+" And ase14=1 and ase19 in (1,2) ");
// 行业ID
if (dnu08 != null && "".equals(dnu08) == false) {
strSql.append(" AND dut02 in (" + dnu08 + ") ");
}
// 区县
if (areaId != null && "".equals(areaId) == false && "-1".equals(areaId) == false) {
strSql.append(" AND dui32 in (" + areaId + ") ");
}
// 派出所
if (policeId != null && "".equals(policeId) == false && "-1".equals(policeId) == false) {
strSql.append(" AND dui36 in (" + policeId + ") ");
}
// 单位名称
if (dui02 != null && "".equals(dui02) == false) {
strSql.append(" AND dui02 LIKE '%" + dui02 + "%' ");
}
// 设备编码
if (dfh01 != null && "".equals(dfh01) == false) {
strSql.append(" and dfh01 like '%" + dfh01 + "%' ");
}
// 是否有心跳时间1.有2.没有
if (dfh02Type.equals("1")) {
// 开始时间
if (dfh02Start != null && "".equals(dfh02Start) == false) {
strSql.append(" and dfh02 >= '" + dfh02Start + "' ");
}
// 结束时间
if (dfh02End != null && "".equals(dfh02End) == false) {
strSql.append(" and dfh02 <= '" + dfh02End + "' ");
}
strSql.append(" AND dfh02 IS not NULL ");
} else {
strSql.append(" AND dfh02 IS NULL ");
}
strSql.append(" order by dfh02 desc limit ").append(intPageNum).append(" offset ")
.append((intCpage - 1) * intPageNum);
// 记录应用系统日志-OpType 操作行为类型0.登录1.查询 2.新增3.修改4.删除5.退出
objDtmSvssystemLog.setDsl16(1);
// 记录应用系统日志-OperateCondition 操作类型为1-查询 3-修改
// 4-删除类型时,记录用户进行操作时的数据筛选条件,填写数据操作SQL语句where子句内容
objDtmSvssystemLog
.setDsl17(strSql.substring(strSql.indexOf("where") + 5).replace("'", "''").replace("1=1", ""));
// 记录应用系统日志-FuncModuleName 操作人所操作的应用内的具体功能模块名称
objDtmSvssystemLog.setDsl25("人脸抓拍-心跳查询");
// 记录应用系统日志-Query Sql 当操作执行为SQL语句时,填写SQL语句
objDtmSvssystemLog.setDsl28(strSql.toString().replace("'", "''").replace("1=1", ""));
// 记录应用系统日志-OperateResult 操作人的操作结果0.失败1.成功
objDtmSvssystemLog.setDsl18(1);
// 最终调用日志入库
objCommonJsonService.feverSvsSystemLog(objDtmSvssystemLog);
return objSearchDao.selectDtmFacesnapshotHeart(strSql.toString());
} catch (Exception e) {
// TODO: handle exception
return null;
}
}
/**
* 人脸抓拍心跳信息表 查询 List 的count
*
* @param dui02 单位名称
* @param dfh01 设备编码
* @param dfh02Start 开始时间
* @param dfh02End 结束时间
* @param dfh02Type 心跳时间1.有2.没有
* @param deviceSql 权限
* @param totalNum
* @return
*/
public int searchdtmDeviceFacesnapshotHeartFindCount(String areaId, String policeId, String dui02, String dfh01,
String dnu08,String dfh02Start, String dfh02End, String dfh02Type, String deviceHeartSql, String totalNum) {
try {
int intTotalNum = Integer.valueOf(totalNum);
if (intTotalNum > 0) {
return intTotalNum;
} else {
StringBuffer strSql = new StringBuffer("select COUNT(DISTINCT ase_id) from dtm_facesnapshot_heart LEFT JOIN dtm_usecompany_info ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_info.dui_id LEFT JOIN dtm_usecompany_trade ON dtm_facesnapshot_heart.ase20 = dtm_usecompany_trade.dut04 WHERE 1=1 ");
// 行业ID
if (dnu08 != null && "".equals(dnu08) == false) {
strSql.append(" AND dut02 in (" + dnu08 + ") ");
}
// 区县
if (areaId != null && "".equals(areaId) == false && "-1".equals(areaId) == false) {
strSql.append(" AND dui32 in (" + areaId + ") ");
}
// 派出所
if (policeId != null && "".equals(policeId) == false && "-1".equals(policeId) == false) {
strSql.append(" AND dui36 in (" + policeId + ") ");
}
// 单位名称
if (dui02 != null && "".equals(dui02) == false) {
strSql.append(" AND dui02 LIKE '%" + dui02 + "%' ");
}
// 设备编码
if (dfh01 != null && "".equals(dfh01) == false) {
strSql.append(" and dfh01 like '%" + dfh01 + "%' ");
}
// 是否有心跳时间1.有2.没有
if (dfh02Type.equals("1")) {
// 开始时间
if (dfh02Start != null && "".equals(dfh02Start) == false) {
strSql.append(" and dfh02 >= '" + dfh02Start + "' ");
}
// 结束时间
if (dfh02End != null && "".equals(dfh02End) == false) {
strSql.append(" and dfh02 <= '" + dfh02End + "' ");
}
strSql.append(" AND dfh02 IS not NULL ");
} else {
strSql.append(" AND dfh02 IS NULL ");
}
return objSearchDao.selectCountList(strSql.toString());
}
} catch (Exception e) {
// TODO: handle exception
return -1;
}
}
}
jsp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<html>
<head>
<meta charset="utf-8" />
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<link rel="stylesheet" href="layuiadmin/layui/css/layui.css" media="all" />
<link rel="stylesheet" href="layuiadmin/style/admin.css" media="all" />
<script src="js/jquery-1.7.1.js"></script>
<script src="js/userjs/common.js"></script>
<style type="text/css">
a {
text-decoration: none;
color: blue;
text-decoration: underline;
}
a:hover {
color: #FF5907;
}
.layui-disabled, .layui-disabled:hover {
color: black !important;
cursor: not-allowed !important
}
</style>
</head>
<body>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div id="deviceFacesnapshotHeartInfoSearchCommonDiv"
class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-form" style="margin-bottom: 10px;">
单位名称:
<div class="layui-inline" style="width:163px">
<input class="layui-input"
name="deviceFacesnapshotHeartInfoSearchCommonDui02"
id="deviceFacesnapshotHeartInfoSearchCommonDui02"
autocomplete="off" />
</div>
设备编码:
<div class="layui-inline" style="width:163px">
<input class="layui-input"
name="deviceFacesnapshotHeartInfoSearchCommonDeh01"
id="deviceFacesnapshotHeartInfoSearchCommonDeh01"
autocomplete="off" />
</div>
<c:if test="${sessionScope.loginUserType == 7}">
所属区县:
<div class="layui-inline" style='width:163px;'>
<select name="deviceFacesnapshotHeartInfoSearchCommonAreaId"
id="deviceFacesnapshotHeartInfoSearchCommonAreaId"
lay-filter="setAreaSearch">
<option value="-1">请选择</option>
<c:forEach
items="${listDictionaryAreadeviceFacesnapshotHeartInfoSearch }"
var="listDictionaryArea">
<option value="${listDictionaryArea.da02 }">${listDictionaryArea.da01 }</option>
</c:forEach>
</select>
</div>
所属派出所:
<div class="layui-inline" style='width:163px;'>
<select id="deviceFacesnapshotHeartInfoSearchCommonPoliceId"
name="deviceFacesnapshotHeartInfoSearchCommonPoliceId">
</select>
</div>
</c:if>
<c:else>
所属区县:
<div class="layui-inline" style='width:165px;'>
<select id="deviceFacesnapshotHeartInfoSearchCommonAreaId"
name="deviceFacesnapshotHeartInfoSearchCommonAreaId">
<option value='-1'>请选择</option>
</select>
</div>
<label style='width:85px;display:inline-block;'>所属派出所:</label>
<div class="layui-inline" style='width:165px;'>
<select id="deviceFacesnapshotHeartInfoSearchCommonPoliceId"
name="deviceFacesnapshotHeartInfoSearchCommonPoliceId">
<option value='-1'>请选择</option>
</select>
</div>
</c:else>
</div>
<div class="layui-form" style="margin-bottom: 10px;">
心跳时间:
<div class="layui-inline" style="width:163px">
<select id="deviceFacesnapshotHeartInfoSearchCommonDeh02Type"
name="deviceFacesnapshotHeartInfoSearchCommonDeh02Type"
lay-filter="deviceFacesnapshotHeartInfoSearchCommonType">
<option value="1">有</option>
<option value="2">无</option>
</select>
</div>
开始时间:
<div class="layui-inline" style="width:163px">
<input type="text" class="layui-input"
id="deviceFacesnapshotHeartInfoSearchCommonDeh02Start"
name="deviceFacesnapshotHeartInfoSearchCommonDeh02Start" />
</div>
结束时间:
<div class="layui-inline" style="width:163px">
<input type="text" class="layui-input"
id="deviceFacesnapshotHeartInfoSearchCommonDeh02End"
name="deviceFacesnapshotHeartInfoSearchCommonDeh02End" />
</div>
<button type="button" class="layui-btn"
onclick="deviceFacesnapshotHeartInfoSearchCommonBtn();">
<i class="layui-icon layui-icon-search"></i>搜索
</button>
</div>
</div>
<div id="deviceFacesnapshotHeartInfoSearchCommonList">
<table id="deviceFacesnapshotHeartInfoSearchCommondg"
class="layui-table"
lay-filter="deviceFacesnapshotHeartInfoSearchCommonTable"
lay-data="{height:'full-210',cellMinWidth: 80 }">
<thead id="deviceFacesnapshotHeartInfoSearchCommonthead">
</thead>
<tbody id="deviceFacesnapshotHeartInfoSearchCommontbody">
</tbody>
</table>
<div id="deviceFacesnapshotHeartInfoSearchCommonPage"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<input type="hidden"
id="deviceFacesnapshotHeartInfoSearchCommonHiddenCpage"
name="deviceFacesnapshotHeartInfoSearchCommonHiddenCpage" value="1" />
<input type="hidden"
id="deviceFacesnapshotHeartInfoSearchCommonHiddenTotalNum"
name="deviceFacesnapshotHeartInfoSearchCommonHiddenTotalNum"
value="-1" />
<!-- 办公区县 -->
<input type="hidden" name="deviceFacesnapshotHeartInfoSearchCommonAreaIdHidden"
id="deviceFacesnapshotHeartInfoSearchCommonAreaIdHidden" />
<!--所属派出所 -->
<input type="hidden" name="deviceFacesnapshotHeartInfoSearchCommonPoliceIdHidden"
id="deviceFacesnapshotHeartInfoSearchCommonPoliceIdHidden" />
<!-- 派出所权限 -->
<input type="hidden"
id="deviceFacesnapshotHeartInfoSearchCommonHiddenPoliceID"
name="deviceFacesnapshotHeartInfoSearchCommonHiddenPoliceID"
value="${strPoliceID }" />
<script src="layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base : 'layuiadmin/' //静态资源所在路径
}).extend({
index : 'lib/index' //主入口模块
}).use([ 'table', 'laypage', 'layer', 'index', 'form', 'laydate' ], function() {
var laypage = layui.laypage,
table = layui.table,
$ = layui.$,
admin = layui.admin,
element = layui.element,
layer = layui.layer,
laydate = layui.laydate,
form = layui.form;
//初始化分页
laypage.render({
elem : 'deviceFacesnapshotHeartInfoSearchCommonPage',
count : 0,
limit : 15,
curr : 1,
layout : [ 'prev', 'page', 'next', 'count', 'skip' ]
});
//日期选择器初始化 开始时间
laydate.render({
elem : '#deviceFacesnapshotHeartInfoSearchCommonDeh02Start', //指定元素
type : 'datetime'
});
//日期选择器初始化 结束时间
laydate.render({
elem : '#deviceFacesnapshotHeartInfoSearchCommonDeh02End', //指定元素
type : 'datetime'
});
//获取当前时间
var myDate = new Date;
//当前年
var yearStart = myDate.getFullYear();
//当前月
var monthStart = myDate.getMonth() + 1;
if (monthStart.toString().length == "1") {
monthStart = '0' + monthStart;
}
//当前日
var dayStart = myDate.getDate();
if (dayStart.toString().length == "1") {
dayStart = '0' + dayStart;
}
//开始时间
var strStartTime = yearStart + "-" + monthStart + "-" + dayStart + " 00:00:00";
//时间加一天
myDate.setDate(myDate.getDate() + 1);
//时间加一天后年
var yearEnd = myDate.getFullYear();
//时间加一天后月
var monthEnd = myDate.getMonth() + 1;
if (monthEnd.toString().length == "1") {
monthEnd = '0' + monthEnd;
}
//时间加一天后日
var dayEnd = myDate.getDate();
if (dayEnd.toString().length == "1") {
dayEnd = '0' + dayEnd;
}
//结束时间
var strEndTime = yearEnd + "-" + monthEnd + "-" + dayEnd + " 00:00:00";
//开始时间 初始化当前日期
$("#deviceFacesnapshotHeartInfoSearchCommonDeh02Start").val(strStartTime);
//结束时间 初始化当前日期
$("#deviceFacesnapshotHeartInfoSearchCommonDeh02End").val(strEndTime);
//表单重新渲染
form.render();
//监听区联动注册
form.on('select(setAreaSearch)', function(data) {
//加载派出所下拉框,并选中办公派出所
setAreaPoliceQx($("#deviceFacesnapshotHeartInfoSearchCommonAreaId").val()
, 'deviceFacesnapshotHeartInfoSearchCommonPoliceId'
, $("#deviceFacesnapshotHeartInfoSearchCommonPoliceId").val()
, $("#deviceFacesnapshotHeartInfoSearchCommonHiddenPoliceID").val()); //隐藏派出所
});
});
layui.use([ 'form' ], function() {
var form = layui.form;
form.on('select(deviceFacesnapshotHeartInfoSearchCommonType)', function(data) {
var type = data.value;
if (type == 1) { //心跳时间1.有2.无
var myDate1 = new Date;
var year1 = myDate1.getFullYear(); //获取当前年
var mon1 = myDate1.getMonth() + 1; //获取当前月
if (mon1.toString().length == "1") {
mon1 = "0" + mon1;
}
var date1 = myDate1.getDate(); //获取当前日
if (date1.toString().length == "1") {
date1 = "0" + date1;
}
var strStartTime1 = year1 + "-" + mon1 + "-" + date1 + " 00:00:00";
var strEndTime1 = year1 + "-" + mon1 + "-" + (date1 + 1) + " 00:00:00";
//开始时间 初始化当前日期
$("#deviceFacesnapshotHeartInfoSearchCommonDeh02Start").val(strStartTime1);
//结束时间 初始化当前日期
$("#deviceFacesnapshotHeartInfoSearchCommonDeh02End").val(strEndTime1);
document.getElementById("deviceFacesnapshotHeartInfoSearchCommonDeh02Start").disabled = false;
document.getElementById("deviceFacesnapshotHeartInfoSearchCommonDeh02End").disabled = false;
} else {
$("#deviceFacesnapshotHeartInfoSearchCommonDeh02Start").val("");
$("#deviceFacesnapshotHeartInfoSearchCommonDeh02End").val("");
document.getElementById("deviceFacesnapshotHeartInfoSearchCommonDeh02Start").disabled = true;
document.getElementById("deviceFacesnapshotHeartInfoSearchCommonDeh02End").disabled = true;
}
});
});
function searchDtmUsecompanyInfoByDeviceCoding(dfe01) {
layer.open({
type : 2,
title : '设备单位信息',
maxmin : false,
resize : false,
move : false,
area : [ '1000px', '700px' ],
content : 'dtmUsecompanyInfoByDeviceCodingAction.action?dfe01=' + dfe01
});
}
//检索
function deviceFacesnapshotHeartInfoSearchCommonBtn() {
$("#deviceFacesnapshotHeartInfoSearchCommonHiddenCpage").val(1);
$("#deviceFacesnapshotHeartInfoSearchCommonHiddenTotalNum").val(-1);
deviceFacesnapshotHeartInfoSearchCommonSubmit();
}
//提交检索
function deviceFacesnapshotHeartInfoSearchCommonSubmit() {
//单位名称
var dui02 = $("#deviceFacesnapshotHeartInfoSearchCommonDui02").val();
//设备编号
var dfh01 = $("#deviceFacesnapshotHeartInfoSearchCommonDeh01").val();
//开始时间
var dfh02Start = $("#deviceFacesnapshotHeartInfoSearchCommonDeh02Start").val();
//结束时间
var dfh02End = $("#deviceFacesnapshotHeartInfoSearchCommonDeh02End").val();
//心跳时间
var dfh02Type = $("#deviceFacesnapshotHeartInfoSearchCommonDeh02Type").val();
//所属区县
var areaId = $("#deviceFacesnapshotHeartInfoSearchCommonAreaId").val();
//所属派出所
var policeId = $("#deviceFacesnapshotHeartInfoSearchCommonPoliceId").val();
//当前页
var Cpage = $("#deviceFacesnapshotHeartInfoSearchCommonHiddenCpage").val();
//总页数
var totalNum = $("#deviceFacesnapshotHeartInfoSearchCommonHiddenTotalNum").val();
//加载数据层
var indexs = layer.load(3);
$.ajax({
url : "searchdtmDeviceFacesnapshotHeartFindCommon.action",
type : "POST",
data : {
dui02 : dui02,
dfh01 : dfh01,
dfh02Start : dfh02Start,
dfh02End : dfh02End,
dfh02Type : dfh02Type,
areaId : areaId,
policeId : policeId,
Cpage : Cpage,
totalNum : totalNum
},
dataType : "json",
async : false,
success : function(data) {
var strTable = "";
var intPageNum = data.intPageNum;
var totalPageSize = data.intAllCount;
$("#deviceFacesnapshotHeartInfoSearchCommontbody").text(""); //先清空原先内容
if (data.jsonFlag == 1) {
//有数据
if (data.listDtmFacesnapshotHeartFind != null && data.listDtmFacesnapshotHeartFind.length > 0) {
for (var i = 0; i < data.listDtmFacesnapshotHeartFind.length; i++) {
strTable = strTable + "<tr>";
dfh03 dfh04 dfh01 dfh02 dfh03,dfh04,dfh05 ,dfh06
//是否在线
var dfh03 = "";
if (data.listDtmFacesnapshotHeartFind[i].dfh03 == 1) {
dfh03 = "在线";
} else if (data.listDtmFacesnapshotHeartFind[i].dfh03 == -1) {
dfh03 = "不在线";
}
//是否屏蔽
var dfh04 = "";
if (data.listDtmFacesnapshotHeartFind[i].dfh04 == 1) {
dfh04 = "屏蔽";
} else if (data.listDtmFacesnapshotHeartFind[i].dfh04 == -1) {
dfh04 = "不屏蔽";
}
if (data.listDtmFacesnapshotHeartFind[i].dfh01 != null && data.listDtmFacesnapshotHeartFind[i].dfh01 != "") {
var str = '<td><a href="#" onclick="searchDtmUsecompanyInfoByDeviceCoding(\'' + data.listDtmFacesnapshotHeartFind[i].dfh01 + '\');">' + data.listDtmFacesnapshotHeartFind[i].dfh01 + '</a></td>';
strTable = strTable + str;
} else {
strTable = strTable + "<td></td>";
}
if (data.listDtmFacesnapshotHeartFind[i].dfh02 != null && data.listDtmFacesnapshotHeartFind[i].dfh02 != "") {
strTable = strTable + "<td>" + data.listDtmFacesnapshotHeartFind[i].dfh02 + "</td>";
} else {
strTable = strTable + "<td></td>";
}
if (dfh03 != null && dfh03 != "") {
strTable = strTable + "<td>" + dfh03 + "</td>";
} else {
strTable = strTable + "<td></td>";
}
if (dfh04 != null && dfh04 != "") {
strTable = strTable + "<td>" + dfh04 + "</td>";
} else {
strTable = strTable + "<td></td>";
}
if (data.listDtmFacesnapshotHeartFind[i].dfh05 != null && data.listDtmFacesnapshotHeartFind[i].dfh05 != "") {
strTable = strTable + "<td>" + data.listDtmFacesnapshotHeartFind[i].dfh05 + "</td>";
} else {
strTable = strTable + "<td></td>";
}
if (data.listDtmFacesnapshotHeartFind[i].dfh06 != null && data.listDtmFacesnapshotHeartFind[i].dfh06 != "") {
strTable = strTable + "<td>" + data.listDtmFacesnapshotHeartFind[i].dfh06 + "</td>";
} else {
strTable = strTable + "<td></td>";
}
//操作
strTable = strTable + "<td><a class='layui-btn layui-btn-xs' lay-href='dtmDevicefacesnapshotHeartFindIndex.action?dfhId=" + data.listDtmFacesnapshotHeartFind[i].dfhId + "' ><i class='layui-icon layui-icon-edit'></i>详情</a></td>";
strTable = strTable + "</tr>";
}
$("#deviceFacesnapshotHeartInfoSearchCommontbody").html(strTable);
} else {
layer.msg('没有查询到数据!', {
offset : '15px',
icon : 1
});
}
//显示表格
layui.use([ 'table' ], function() { //------
var table = layui.table;
//初始化表格
table.init('deviceFacesnapshotHeartInfoSearchCommonTable', {
height : 'full-210', //设置高度
limit : intPageNum, //支持所有基础参数
page : false //是否分页
});
}) //------
//分页
layui.use([ 'laypage' ], function() { //------
var laypage = layui.laypage;
//初始化分页
laypage.render({
elem : 'deviceFacesnapshotHeartInfoSearchCommonPage',
count : totalPageSize,
limit : intPageNum,
curr : Cpage,
layout : [ 'prev', 'page', 'next', 'count', 'skip' ],
jump : function(obj, first) {
if (!first) {
$("#deviceFacesnapshotHeartInfoSearchCommonHiddenCpage").val(obj.curr);
deviceFacesnapshotHeartInfoSearchCommonSubmit();
}
}
});
}) //------
} else if (data.jsonFlag == -2) {
layer.msg("Session失效,请重新登录!", {
icon : 2,
time : 2000
}, function() {
window.location = "${pageContext.request.contextPath}/communitySessionError.jsp";
});
} else if (data.jsonFlag == -1) {
layer.msg('人脸抓拍心跳查询失败!', {
offset : '15px',
icon : 2
});
} else {
layer.msg('人脸抓拍心跳查询失败!', {
offset : '15px',
icon : 2
});
}
//加载数据层关闭
layer.close(indexs);
return false;
}
});
}
//表头初始化
function deviceFacesnapshotHeartInfoSearchCommonTableInit() {
$("#deviceFacesnapshotHeartInfoSearchCommonthead").text(""); //先清空原先内容
var thead = document.getElementById('deviceFacesnapshotHeartInfoSearchCommonthead');
var tr = document.createElement("tr");
tr.innerHTML = '<th lay-data="{field:\'dfh01\', width:180}">设备编码</th>' +
'<th lay-data="{field:\'dfh02\', width:171}">心跳时间</th>' +
'<th lay-data="{field:\'dfh03\', width:120}">是否在线</th>' +
'<th lay-data="{field:\'dfh04\', width:120}">是否屏蔽</th>' +
'<th lay-data="{field:\'dfh05\', width:171}">屏蔽时间</th>' +
'<th lay-data="{field:\'dfh06\', width:120}">屏蔽次数</th>' +
'<th lay-data="{field:\'btn2\', width:92}">详情</th>';
thead.appendChild(tr);
}
deviceFacesnapshotHeartInfoSearchCommonTableInit();
</script>
</body>
</html>