Commit 6c3e08a41efdf718277807a1cfef851e2dc3a493
1 parent
3a58c193
DSM管理
Showing
8 changed files
with
523 additions
and
54 deletions
src/main/java/com/bsth/controller/dsm/DMSController.java
0 → 100644
| 1 | +package com.bsth.controller.dsm; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.bsth.service.dsm.DSMService; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 9 | +import org.springframework.web.bind.annotation.RestController; | ||
| 10 | +import java.util.Map; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * | ||
| 14 | + * @ClassName: DMSController(DSM控制器) | ||
| 15 | + * | ||
| 16 | + * @Author YM | ||
| 17 | + * | ||
| 18 | + */ | ||
| 19 | +@RestController | ||
| 20 | +@RequestMapping("dsm") | ||
| 21 | +public class DMSController{ | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + @Autowired | ||
| 26 | + private DSMService dsmService; | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + @RequestMapping(value = "findAll", method = RequestMethod.GET) | ||
| 30 | + public Map<String, Object> findAll(@RequestParam Map<String,Object> params) { | ||
| 31 | + return dsmService.query(params); | ||
| 32 | + } | ||
| 33 | +} |
src/main/java/com/bsth/controller/kl/KlController.java
| 1 | package com.bsth.controller.kl; | 1 | package com.bsth.controller.kl; |
| 2 | 2 | ||
| 3 | -import com.bsth.common.ResponseCode; | ||
| 4 | -import com.bsth.controller.BaseController; | ||
| 5 | -import com.bsth.entity.Line; | ||
| 6 | -import com.bsth.entity.LineVersions; | 3 | + |
| 4 | + | ||
| 7 | import com.bsth.service.Kl.KlService; | 5 | import com.bsth.service.Kl.KlService; |
| 8 | -import com.bsth.service.LineService; | ||
| 9 | -import com.bsth.service.LineVersionsService; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.web.bind.annotation.RequestMapping; | 7 | import org.springframework.web.bind.annotation.RequestMapping; |
| 12 | import org.springframework.web.bind.annotation.RequestMethod; | 8 | import org.springframework.web.bind.annotation.RequestMethod; |
| 13 | import org.springframework.web.bind.annotation.RequestParam; | 9 | import org.springframework.web.bind.annotation.RequestParam; |
| 14 | import org.springframework.web.bind.annotation.RestController; | 10 | import org.springframework.web.bind.annotation.RestController; |
| 15 | - | ||
| 16 | -import java.text.ParseException; | ||
| 17 | -import java.text.SimpleDateFormat; | ||
| 18 | -import java.util.Date; | ||
| 19 | -import java.util.HashMap; | ||
| 20 | -import java.util.List; | ||
| 21 | import java.util.Map; | 11 | import java.util.Map; |
| 22 | 12 | ||
| 23 | /** | 13 | /** |
| 24 | - * | ||
| 25 | - * @ClassName: LineController(线路控制器) | ||
| 26 | - * | ||
| 27 | - * @Extends : BaseController | ||
| 28 | - * | ||
| 29 | - * @Description: TODO(线路控制层) | ||
| 30 | - * | ||
| 31 | - * @Author bsth@lq | ||
| 32 | - * | ||
| 33 | - * @Date 2016年4月28日 上午9:21:17 | ||
| 34 | * | 14 | * |
| 35 | - * @Version 公交调度系统BS版 0.1 | ||
| 36 | - * | 15 | + * @ClassName: KlController(客流控制器) |
| 16 | + * | ||
| 17 | + * @Author YM | ||
| 18 | + * | ||
| 37 | */ | 19 | */ |
| 38 | @RestController | 20 | @RestController |
| 39 | @RequestMapping("kl") | 21 | @RequestMapping("kl") |
| 40 | -public class KlController extends BaseController<Line, Integer> { | 22 | +public class KlController{ |
| 41 | 23 | ||
| 42 | 24 | ||
| 43 | 25 | ||
| 44 | @Autowired | 26 | @Autowired |
| 45 | private KlService klService; | 27 | private KlService klService; |
| 46 | 28 | ||
| 47 | - /** | ||
| 48 | - * 获取线路编码与ID | ||
| 49 | - * | ||
| 50 | - * @return int <lineCode:线路编码> | ||
| 51 | - */ | 29 | + |
| 52 | @RequestMapping(value = "findAllKl", method = RequestMethod.GET) | 30 | @RequestMapping(value = "findAllKl", method = RequestMethod.GET) |
| 53 | public Map<String, Object> findAllKl(@RequestParam Map<String,Object> params) { | 31 | public Map<String, Object> findAllKl(@RequestParam Map<String,Object> params) { |
| 54 | return klService.query(params); | 32 | return klService.query(params); |
src/main/java/com/bsth/service/Kl/impl/KlServiceImpl.java
| @@ -6,9 +6,11 @@ import com.bsth.service.Kl.KlService; | @@ -6,9 +6,11 @@ import com.bsth.service.Kl.KlService; | ||
| 6 | import org.slf4j.Logger; | 6 | import org.slf4j.Logger; |
| 7 | import org.slf4j.LoggerFactory; | 7 | import org.slf4j.LoggerFactory; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | -import org.springframework.jdbc.core.BeanPropertyRowMapper; | 9 | +import org.springframework.beans.factory.annotation.Value; |
| 10 | import org.springframework.jdbc.core.JdbcTemplate; | 10 | import org.springframework.jdbc.core.JdbcTemplate; |
| 11 | import org.springframework.stereotype.Service; | 11 | import org.springframework.stereotype.Service; |
| 12 | +import java.time.LocalDate; | ||
| 13 | +import java.time.format.DateTimeFormatter; | ||
| 12 | import java.util.*; | 14 | import java.util.*; |
| 13 | 15 | ||
| 14 | @Service | 16 | @Service |
| @@ -19,28 +21,45 @@ public class KlServiceImpl implements KlService { | @@ -19,28 +21,45 @@ public class KlServiceImpl implements KlService { | ||
| 19 | @Autowired | 21 | @Autowired |
| 20 | JdbcTemplate jdbcTemplate; | 22 | JdbcTemplate jdbcTemplate; |
| 21 | 23 | ||
| 24 | + private static DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy-MM-dd"); | ||
| 25 | + | ||
| 26 | + @Value("${passengerFlow.url}") | ||
| 27 | + private String url; | ||
| 22 | 28 | ||
| 23 | @Override | 29 | @Override |
| 24 | public Map<String, Object> query(Map<String, Object> map) { | 30 | public Map<String, Object> query(Map<String, Object> map) { |
| 25 | Map<String, Object> modelMap = new HashMap<>(); | 31 | Map<String, Object> modelMap = new HashMap<>(); |
| 26 | - StringBuffer sql=new StringBuffer("SELECT * FROM bsth_c_kl where 1=1 "); | ||
| 27 | - if(map.get("line")!=null && !map.get("line").equals("")){ | ||
| 28 | - sql.append(" and line_code ='"+map.get("line")+"'"); | ||
| 29 | - } | ||
| 30 | - if(map.get("deviceId_like")!=null && !map.get("deviceId_like").equals("")){ | ||
| 31 | - sql.append(" and deviceId like '%"+map.get("deviceId_like")+"%'"); | ||
| 32 | - } | ||
| 33 | - List<Map<String,Object>> query = jdbcTemplate.queryForList(sql.toString()); | ||
| 34 | - Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0"); | ||
| 35 | - int end = (page+1)*10>query.size()?query.size():(page+1)*10; | ||
| 36 | - List<Map<String,Object>> result=query.subList(page*10, end); | ||
| 37 | - for (Map<String, Object> m : result) { | ||
| 38 | - m.put("time",m.get("createDate").toString().substring(0,19)); | 32 | + try { |
| 33 | + StringBuffer sql=new StringBuffer("SELECT * FROM bsth_c_kl where 1=1 "); | ||
| 34 | + if(map.get("line")!=null && !map.get("line").equals("")){ | ||
| 35 | + sql.append(" and line_code ='"+map.get("line")+"'"); | ||
| 36 | + } | ||
| 37 | + if(map.get("deviceId_like")!=null && !map.get("deviceId_like").equals("")){ | ||
| 38 | + sql.append(" and deviceId like '%"+map.get("deviceId_like")+"%'"); | ||
| 39 | + } | ||
| 40 | + String date = LocalDate.now().format(dtf); | ||
| 41 | + if(map.get("date")!=null){ | ||
| 42 | + date=map.get("date").toString(); | ||
| 43 | + } | ||
| 44 | + sql.append(" and createDate >='"+date+" 00:00:00'"); | ||
| 45 | + sql.append(" and createDate <='"+date+" 23:59:59'"); | ||
| 46 | + List<Map<String,Object>> query = jdbcTemplate.queryForList(sql.toString()); | ||
| 47 | + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0"); | ||
| 48 | + int end = (page+1)*10>query.size()?query.size():(page+1)*10; | ||
| 49 | + List<Map<String,Object>> result=query.subList(page*10, end); | ||
| 50 | + for (Map<String, Object> m : result) { | ||
| 51 | + m.put("time",m.get("createDate").toString().substring(0,19)); | ||
| 52 | + m.put("photo",url+m.get("photo")); | ||
| 53 | + } | ||
| 54 | + modelMap.put("dataList", result); | ||
| 55 | + modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10); | ||
| 56 | + modelMap.put("code","00"); | ||
| 57 | + return modelMap; | ||
| 58 | + } catch (Exception e) { | ||
| 59 | + logger.error("客流查询异常", e); | ||
| 60 | + modelMap.put("code","502"); | ||
| 61 | + return modelMap; | ||
| 39 | } | 62 | } |
| 40 | - modelMap.put("dataList", result); | ||
| 41 | - modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10); | ||
| 42 | - modelMap.put("code","00"); | ||
| 43 | - return modelMap; | ||
| 44 | } | 63 | } |
| 45 | 64 | ||
| 46 | 65 |
src/main/java/com/bsth/service/dsm/DSMService.java
0 → 100644
src/main/java/com/bsth/service/dsm/impl/DSMServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.dsm.impl; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.alibaba.fastjson.JSON; | ||
| 5 | +import com.bsth.service.dsm.DSMService; | ||
| 6 | +import com.bsth.util.HttpClientUtils; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | +import org.springframework.beans.factory.annotation.Value; | ||
| 11 | +import org.springframework.jdbc.core.JdbcTemplate; | ||
| 12 | +import org.springframework.stereotype.Service; | ||
| 13 | +import java.time.LocalDate; | ||
| 14 | +import java.time.format.DateTimeFormatter; | ||
| 15 | +import java.util.*; | ||
| 16 | + | ||
| 17 | +@Service | ||
| 18 | +public class DSMServiceImpl implements DSMService { | ||
| 19 | + | ||
| 20 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 21 | + | ||
| 22 | + @Autowired | ||
| 23 | + JdbcTemplate jdbcTemplate; | ||
| 24 | + | ||
| 25 | + @Value("${dsm.url}") | ||
| 26 | + private String url; | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + private static DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy-MM-dd"); | ||
| 31 | + @Override | ||
| 32 | + public Map<String, Object> query(Map<String, Object> map) { | ||
| 33 | + Map<String, Object> modelMap = new HashMap<>(); | ||
| 34 | + try { | ||
| 35 | + String dateS = LocalDate.now().format(dtf); | ||
| 36 | + String dateE = LocalDate.now().plusDays(1).format(dtf); | ||
| 37 | + if(map.get("date")!=null){ | ||
| 38 | + dateS=map.get("date").toString(); | ||
| 39 | + dateE=LocalDate.parse(map.get("date").toString(),dtf).plusDays(1).format(dtf); | ||
| 40 | + } | ||
| 41 | + StringBuilder sb= HttpClientUtils.get(url+"?startime="+dateS+"&endtime="+dateE); | ||
| 42 | + List<Map> query = JSON.parseArray(sb.toString(),Map.class); | ||
| 43 | + Iterator it = query.iterator(); | ||
| 44 | + | ||
| 45 | + while (it.hasNext()) { | ||
| 46 | + Map m = (Map) it.next(); | ||
| 47 | + if(map.get("line")!=null && !map.get("line").equals("") && !map.get("line").equals(m.get("lineid").toString())){ | ||
| 48 | + it.remove(); | ||
| 49 | + } | ||
| 50 | + else if(map.get("nbbm_like")!=null && !map.get("nbbm_like").equals("") && !m.get("nbbm").toString().contains(map.get("nbbm_like").toString())){ | ||
| 51 | + it.remove(); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + Integer page = Integer.valueOf(map.containsKey("page")?map.get("page").toString():"0"); | ||
| 57 | + int end = (page+1)*10>query.size()?query.size():(page+1)*10; | ||
| 58 | + List<Map> result=query.subList(page*10, end); | ||
| 59 | + modelMap.put("dataList", result); | ||
| 60 | + modelMap.put("totalPages", query.size()%10>0?query.size()/10+1:query.size()/10); | ||
| 61 | + modelMap.put("code","00"); | ||
| 62 | + return modelMap; | ||
| 63 | + } catch (Exception e) { | ||
| 64 | + logger.error("DSM查询异常", e); | ||
| 65 | + modelMap.put("code","502"); | ||
| 66 | + return modelMap; | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + | ||
| 71 | +} |
src/main/resources/application-test.properties
| @@ -78,4 +78,9 @@ wvp.login.url=http://127.0.0.1:18080/api/user/login | @@ -78,4 +78,9 @@ wvp.login.url=http://127.0.0.1:18080/api/user/login | ||
| 78 | wvp.channel.list.url=http://127.0.0.1:18080/api/device/query/query/channel/carNo/{carNo} | 78 | wvp.channel.list.url=http://127.0.0.1:18080/api/device/query/query/channel/carNo/{carNo} |
| 79 | wvp.channel.list.img.url=http://127.0.0.1:18080/api/device/query/snap/ | 79 | wvp.channel.list.img.url=http://127.0.0.1:18080/api/device/query/snap/ |
| 80 | wvp.channel.play.url =http://192.168.169.100:1091/rtp/ | 80 | wvp.channel.play.url =http://192.168.169.100:1091/rtp/ |
| 81 | -wvp.channel.history.list.url=http://127.0.0.1:18080/api/gb_record/query/{device}/{channel}?startTime={startTimeStr}&endTime={endTimeStr} | ||
| 82 | \ No newline at end of file | 81 | \ No newline at end of file |
| 82 | +wvp.channel.history.list.url=http://127.0.0.1:18080/api/gb_record/query/{device}/{channel}?startTime={startTimeStr}&endTime={endTimeStr} | ||
| 83 | + | ||
| 84 | +#客流图像 | ||
| 85 | +passengerFlow.url = http://58.247.254.118:9999/images/ | ||
| 86 | +#DSM图像视频 | ||
| 87 | +dsm.url = http://211.95.61.66:9008/safedriving/SafeDrivingInterface_for_jcpt | ||
| 83 | \ No newline at end of file | 88 | \ No newline at end of file |
src/main/resources/static/pages/dsm/list.html
0 → 100644
| 1 | +<div class="page-head"> | ||
| 2 | + <div class="page-title"> | ||
| 3 | + <h1>安全驾驶查询</h1> | ||
| 4 | + </div> | ||
| 5 | +</div> | ||
| 6 | +<style> | ||
| 7 | + #imageModal { | ||
| 8 | + position: fixed; | ||
| 9 | + top: 0; | ||
| 10 | + left: 0; | ||
| 11 | + width: 100%; | ||
| 12 | + height: 100%; | ||
| 13 | + background-color: rgba(0, 0, 0, 0.5); | ||
| 14 | + display: none; | ||
| 15 | + justify-content: center; | ||
| 16 | + align-items: center; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + #videoModal { | ||
| 20 | + position: fixed; | ||
| 21 | + top: 0; | ||
| 22 | + left: 0; | ||
| 23 | + width: 100%; | ||
| 24 | + height: 100%; | ||
| 25 | + background-color: rgba(0, 0, 0, 0.5); | ||
| 26 | + display: none; | ||
| 27 | + justify-content: center; | ||
| 28 | + align-items: center; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + .container { | ||
| 32 | + display: flex; | ||
| 33 | + justify-content: center; | ||
| 34 | + align-items: center; | ||
| 35 | + margin-top: 200px; | ||
| 36 | + } | ||
| 37 | +</style> | ||
| 38 | +<!--<script src="/assets/plugins/uk3.0/uikit.min.js"></script> | ||
| 39 | +<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script> | ||
| 40 | +<link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>--> | ||
| 41 | +<script src="/real_control_v2/mapmonitor/js/playback.js"></script> | ||
| 42 | +<ul class="page-breadcrumb breadcrumb"> | ||
| 43 | + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | ||
| 44 | + <li><span class="active">安全驾驶管理</span> <i class="fa fa-circle"></i></li> | ||
| 45 | + <li><span class="active">安全驾驶查询</span></li> | ||
| 46 | +</ul> | ||
| 47 | + | ||
| 48 | +<div class="row"> | ||
| 49 | + <div class="col-md-12"> | ||
| 50 | + <div class="portlet light portlet-fit portlet-datatable bordered"> | ||
| 51 | + <div class="portlet-title"> | ||
| 52 | + <div class="caption"> | ||
| 53 | + <i class="fa fa-users font-dark"></i> <span | ||
| 54 | + class="caption-subject font-dark sbold uppercase">安全驾驶查询</span> | ||
| 55 | + </div> | ||
| 56 | + </div> | ||
| 57 | + <div class="portlet-body"> | ||
| 58 | + <div class="table-container" style="margin-top: 10px"> | ||
| 59 | + <table | ||
| 60 | + class="table table-striped table-bordered table-hover table-checkable" id="datatable_user"> | ||
| 61 | + <thead> | ||
| 62 | + <tr role="row" class="heading"> | ||
| 63 | + <th width="3%">#</th> | ||
| 64 | + <th width="15%">线路</th> | ||
| 65 | + <th width="15%">车辆自编号</th> | ||
| 66 | + <th width="15%">设备号</th> | ||
| 67 | + <th width="15%">异常类型</th> | ||
| 68 | + <th width="15%">时间</th> | ||
| 69 | + <th width="15%">操作</th> | ||
| 70 | + </tr> | ||
| 71 | + <tr role="row" class="filter"> | ||
| 72 | + <td></td> | ||
| 73 | + <td> | ||
| 74 | + <select name="line" class="form-control" style="width:100%" id="line"> | ||
| 75 | + | ||
| 76 | + </select> | ||
| 77 | + <!--<input type="text" class="form-control form-filter input-sm" name="name_like">--> | ||
| 78 | + </td> | ||
| 79 | + <td> | ||
| 80 | + <input type="text" class="form-control form-filter input-sm" name="nbbm_like"> | ||
| 81 | + </td> | ||
| 82 | + <td></td> | ||
| 83 | + <td></td> | ||
| 84 | + <td> | ||
| 85 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 86 | + </td> | ||
| 87 | + <td> | ||
| 88 | + <button class="btn btn-sm green btn-outline filter-submit margin-bottom" ><i class="fa fa-search"></i> 搜索</button> | ||
| 89 | + <button class="btn btn-sm red btn-outline filter-cancel"><i class="fa fa-times"></i> 重置</button> | ||
| 90 | + </td> | ||
| 91 | + </tr> | ||
| 92 | + </thead> | ||
| 93 | + <tbody></tbody> | ||
| 94 | + </table> | ||
| 95 | + <div style="text-align: right;"> | ||
| 96 | + <ul id="pagination" class="pagination"></ul> | ||
| 97 | + </div> | ||
| 98 | + </div> | ||
| 99 | + </div> | ||
| 100 | + </div> | ||
| 101 | + </div> | ||
| 102 | +</div> | ||
| 103 | + | ||
| 104 | +<div id="imageModal"> | ||
| 105 | + <div class="container"> | ||
| 106 | + <img id="img" style="width: 768px;height: 432px"> | ||
| 107 | + </div> | ||
| 108 | +</div> | ||
| 109 | +<div id="videoModal"> | ||
| 110 | + <div class="container"> | ||
| 111 | + <video id="myVideo" width="768px" height="432px" controls> | ||
| 112 | + <source src="" type="video/mp4"> | ||
| 113 | + </video> | ||
| 114 | + </div> | ||
| 115 | +</div> | ||
| 116 | + | ||
| 117 | +<script id="dsm_list_temp" type="text/html"> | ||
| 118 | +{{each list as obj i}} | ||
| 119 | +<tr> | ||
| 120 | + <td style="vertical-align: middle;"> | ||
| 121 | + {{++i}} | ||
| 122 | + </td> | ||
| 123 | + <td> | ||
| 124 | + {{obj.line}} | ||
| 125 | + </td> | ||
| 126 | + <td> | ||
| 127 | + {{obj.nbbm}} | ||
| 128 | + </td> | ||
| 129 | + <td> | ||
| 130 | + {{obj.safeid}} | ||
| 131 | + </td> | ||
| 132 | + <td> | ||
| 133 | + {{obj.shlx_name}} | ||
| 134 | + </td> | ||
| 135 | + <td> | ||
| 136 | + {{obj.Startime}} | ||
| 137 | + </td> | ||
| 138 | + <td> | ||
| 139 | + <a class="btn btn-sm blue btn-outline" onclick="javascript:showPhoto('{{obj.ImagePath}}')" data-pjax></i>图像</a> | ||
| 140 | + <a class="btn btn-sm blue btn-outline" onclick="javascript:showVideo('{{obj.VedioPath}}')" data-pjax></i>视频</a> | ||
| 141 | + </td> | ||
| 142 | +</tr> | ||
| 143 | +{{/each}} | ||
| 144 | +{{if list.length == 0}} | ||
| 145 | +<tr> | ||
| 146 | + <td colspan=8><h6 class="muted">没有找到相关数据</h6></td> | ||
| 147 | +</tr> | ||
| 148 | +{{/if}} | ||
| 149 | +</script> | ||
| 150 | +<script> | ||
| 151 | +$(function(){ | ||
| 152 | + var d = new Date(); | ||
| 153 | + var year = d.getFullYear(); | ||
| 154 | + var month = d.getMonth() + 1; | ||
| 155 | + var day = d.getDate(); | ||
| 156 | + if(month < 10) | ||
| 157 | + month = "0" + month; | ||
| 158 | + if(day < 10) | ||
| 159 | + day = "0" + day; | ||
| 160 | + var dateTime = year + "-" + month + "-" + day; | ||
| 161 | + //日期插件 | ||
| 162 | + $("#date").datetimepicker({ | ||
| 163 | + format : 'YYYY-MM-DD', | ||
| 164 | + locale : 'zh-cn' | ||
| 165 | + }); | ||
| 166 | + $("#date").val(dateTime); | ||
| 167 | + // 当弹出框背景或图片被点击时触发 | ||
| 168 | + $('#imageModal, #img').click(function() { | ||
| 169 | + $('#imageModal').fadeOut(); // 隐藏弹出框 | ||
| 170 | + }); | ||
| 171 | + // 当弹出框背景被点击时触发 | ||
| 172 | + $('#videoModal').click(function(e) { | ||
| 173 | + if (e.target.id.indexOf("myVideo") == -1) { | ||
| 174 | + $('#videoModal').fadeOut(); // 隐藏弹出框 | ||
| 175 | + var video = $("#myVideo").get(0); | ||
| 176 | + video.pause(); | ||
| 177 | + } | ||
| 178 | + }); | ||
| 179 | + var page = 0, initPagination; | ||
| 180 | + var icheckOptions = { | ||
| 181 | + checkboxClass: 'icheckbox_flat-blue', | ||
| 182 | + increaseArea: '20%' | ||
| 183 | + }; | ||
| 184 | + jsDoQuery(null,true); | ||
| 185 | + | ||
| 186 | + //重置 | ||
| 187 | + $('tr.filter .filter-cancel').on('click', function(){ | ||
| 188 | + $('tr.filter input, select').val('').change(); | ||
| 189 | + jsDoQuery(null, true); | ||
| 190 | + }); | ||
| 191 | + | ||
| 192 | + | ||
| 193 | + //提交 | ||
| 194 | + $('tr.filter .filter-submit').on('click', function(){ | ||
| 195 | + var params =getParams(); | ||
| 196 | + jsDoQuery(params, true); | ||
| 197 | + }); | ||
| 198 | + | ||
| 199 | + /* | ||
| 200 | + * 获取数据 p: 要提交的参数, pagination: 是否重新分页 | ||
| 201 | + */ | ||
| 202 | + function jsDoQuery(p, pagination){ | ||
| 203 | + var params = {}; | ||
| 204 | + if(p) | ||
| 205 | + params = p; | ||
| 206 | + params['page'] = page; | ||
| 207 | + var i = layer.load(2); | ||
| 208 | + $get('/dsm/findAll' ,params, function(data){ | ||
| 209 | + var list = data.dataList; | ||
| 210 | + var bodyHtm = template('dsm_list_temp', {list: list}); | ||
| 211 | + | ||
| 212 | + $('#datatable_user tbody').html(bodyHtm) | ||
| 213 | + .find('.icheck').iCheck(icheckOptions) | ||
| 214 | + .on('ifChanged', iCheckChange); | ||
| 215 | + if(pagination && list.length > 0){ | ||
| 216 | + //重新分页 | ||
| 217 | + initPagination = true; | ||
| 218 | + showPagination(data); | ||
| 219 | + } | ||
| 220 | + layer.close(i); | ||
| 221 | + | ||
| 222 | + }); | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + | ||
| 226 | + function getParams() { | ||
| 227 | + var cells = $('tr.filter')[0].cells | ||
| 228 | + ,params = {} | ||
| 229 | + ,name; | ||
| 230 | + $.each(cells, function(i, cell){ | ||
| 231 | + var items = $('input,select', cell); | ||
| 232 | + for(var j = 0, item; item = items[j++];){ | ||
| 233 | + name = $(item).attr('name'); | ||
| 234 | + if(name){ | ||
| 235 | + params[name] = $(item).val(); | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + }); | ||
| 239 | + var date = $("#date").val(); | ||
| 240 | + params['date'] = date; | ||
| 241 | + return params; | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + | ||
| 245 | + function iCheckChange() { | ||
| 246 | + var tr = $(this).parents('tr'); | ||
| 247 | + if (this.checked) | ||
| 248 | + tr.addClass('row-active'); | ||
| 249 | + else | ||
| 250 | + tr.removeClass('row-active'); | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + //分页插件 | ||
| 254 | + var page = 0, initPagination; | ||
| 255 | + function showPagination(data) { | ||
| 256 | + //分页 | ||
| 257 | + $('#pagination').jqPaginator({ | ||
| 258 | + totalPages: data.totalPages, | ||
| 259 | + visiblePages: 6, | ||
| 260 | + currentPage: page + 1, | ||
| 261 | + first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | ||
| 262 | + prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | ||
| 263 | + next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | ||
| 264 | + last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | ||
| 265 | + page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | ||
| 266 | + onPageChange: function (num, type) { | ||
| 267 | + if (initPagination) { | ||
| 268 | + initPagination = false; | ||
| 269 | + return; | ||
| 270 | + } | ||
| 271 | + | ||
| 272 | + var params = getParams(); | ||
| 273 | + | ||
| 274 | + page = num - 1; | ||
| 275 | + jsDoQuery(params, true); | ||
| 276 | + } | ||
| 277 | + }); | ||
| 278 | + | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + /*$.get('/report/lineList',function(xlList){ | ||
| 282 | + var data = []; | ||
| 283 | + $.get('/user/companyData', function(result){ | ||
| 284 | + for(var i = 0; i < result.length; i++){ | ||
| 285 | + var companyCode = result[i].companyCode; | ||
| 286 | + var children = result[i].children; | ||
| 287 | + data.push({id: '', text: ''}); | ||
| 288 | + for(var j = 0; j < children.length; j++){ | ||
| 289 | + var code = children[j].code; | ||
| 290 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 291 | + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){ | ||
| 292 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 293 | + } | ||
| 294 | + } | ||
| 295 | + } | ||
| 296 | + } | ||
| 297 | + initPinYinSelect2('#line',data,''); | ||
| 298 | + }); | ||
| 299 | + }); | ||
| 300 | +});*/ | ||
| 301 | + | ||
| 302 | + $.get('/report/lineList',function(xlList){ | ||
| 303 | + var data = []; | ||
| 304 | + data.push({id: '', text: ''}); | ||
| 305 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 306 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 307 | + } | ||
| 308 | + initPinYinSelect2('#line',data,''); | ||
| 309 | + }); | ||
| 310 | +}); | ||
| 311 | + | ||
| 312 | + | ||
| 313 | +function showPhoto(imageUrl) { | ||
| 314 | + // 当按钮被点击时触发 | ||
| 315 | + $('#img').attr('src', imageUrl); // 设置弹出框中图片的路径 | ||
| 316 | + $('#imageModal').fadeIn(); // 显示弹出框 | ||
| 317 | +}; | ||
| 318 | + | ||
| 319 | +function showVideo(videoUrl) { | ||
| 320 | + // 当按钮被点击时触发 | ||
| 321 | + $('#myVideo').attr('src', videoUrl); // 设置弹出框中图片的路径 | ||
| 322 | + $('#videoModal').fadeIn(); // 显示弹出框 | ||
| 323 | + var video = $("#myVideo").get(0); | ||
| 324 | + video.play(); | ||
| 325 | +}; | ||
| 326 | +</script> | ||
| 327 | + |
src/main/resources/static/pages/kl/list.html
| 1 | <div class="page-head"> | 1 | <div class="page-head"> |
| 2 | <div class="page-title"> | 2 | <div class="page-title"> |
| 3 | - <h1>客流管理</h1> | 3 | + <h1>客流查询</h1> |
| 4 | </div> | 4 | </div> |
| 5 | </div> | 5 | </div> |
| 6 | <style> | 6 | <style> |
| @@ -30,7 +30,7 @@ | @@ -30,7 +30,7 @@ | ||
| 30 | <ul class="page-breadcrumb breadcrumb"> | 30 | <ul class="page-breadcrumb breadcrumb"> |
| 31 | <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> | 31 | <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li> |
| 32 | <li><span class="active">客流管理</span> <i class="fa fa-circle"></i></li> | 32 | <li><span class="active">客流管理</span> <i class="fa fa-circle"></i></li> |
| 33 | - <li><span class="active">客流管理</span></li> | 33 | + <li><span class="active">客流查询</span></li> |
| 34 | </ul> | 34 | </ul> |
| 35 | 35 | ||
| 36 | <div class="row"> | 36 | <div class="row"> |
| @@ -71,7 +71,9 @@ | @@ -71,7 +71,9 @@ | ||
| 71 | <td></td> | 71 | <td></td> |
| 72 | <td></td> | 72 | <td></td> |
| 73 | <td></td> | 73 | <td></td> |
| 74 | - <td></td> | 74 | + <td> |
| 75 | + <input class="form-control" type="text" id="date" style="width: 180px;"/> | ||
| 76 | + </td> | ||
| 75 | <td> | 77 | <td> |
| 76 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" ><i class="fa fa-search"></i> 搜索</button> | 78 | <button class="btn btn-sm green btn-outline filter-submit margin-bottom" ><i class="fa fa-search"></i> 搜索</button> |
| 77 | <button class="btn btn-sm red btn-outline filter-cancel"><i class="fa fa-times"></i> 重置</button> | 79 | <button class="btn btn-sm red btn-outline filter-cancel"><i class="fa fa-times"></i> 重置</button> |
| @@ -137,6 +139,21 @@ | @@ -137,6 +139,21 @@ | ||
| 137 | </script> | 139 | </script> |
| 138 | <script> | 140 | <script> |
| 139 | $(function(){ | 141 | $(function(){ |
| 142 | + var d = new Date(); | ||
| 143 | + var year = d.getFullYear(); | ||
| 144 | + var month = d.getMonth() + 1; | ||
| 145 | + var day = d.getDate(); | ||
| 146 | + if(month < 10) | ||
| 147 | + month = "0" + month; | ||
| 148 | + if(day < 10) | ||
| 149 | + day = "0" + day; | ||
| 150 | + var dateTime = year + "-" + month + "-" + day; | ||
| 151 | + //日期插件 | ||
| 152 | + $("#date").datetimepicker({ | ||
| 153 | + format : 'YYYY-MM-DD', | ||
| 154 | + locale : 'zh-cn' | ||
| 155 | + }); | ||
| 156 | + $("#date").val(dateTime); | ||
| 140 | // 当弹出框背景或图片被点击时触发 | 157 | // 当弹出框背景或图片被点击时触发 |
| 141 | $('#imageModal, #img').click(function() { | 158 | $('#imageModal, #img').click(function() { |
| 142 | $('#imageModal').fadeOut(); // 隐藏弹出框 | 159 | $('#imageModal').fadeOut(); // 隐藏弹出框 |
| @@ -201,6 +218,8 @@ $(function(){ | @@ -201,6 +218,8 @@ $(function(){ | ||
| 201 | } | 218 | } |
| 202 | } | 219 | } |
| 203 | }); | 220 | }); |
| 221 | + var date = $("#date").val(); | ||
| 222 | + params['date'] = date; | ||
| 204 | return params; | 223 | return params; |
| 205 | } | 224 | } |
| 206 | 225 | ||
| @@ -241,7 +260,7 @@ $(function(){ | @@ -241,7 +260,7 @@ $(function(){ | ||
| 241 | 260 | ||
| 242 | } | 261 | } |
| 243 | 262 | ||
| 244 | - $.get('/report/lineList',function(xlList){ | 263 | + /*$.get('/report/lineList',function(xlList){ |
| 245 | var data = []; | 264 | var data = []; |
| 246 | $.get('/user/companyData', function(result){ | 265 | $.get('/user/companyData', function(result){ |
| 247 | for(var i = 0; i < result.length; i++){ | 266 | for(var i = 0; i < result.length; i++){ |
| @@ -259,6 +278,15 @@ $(function(){ | @@ -259,6 +278,15 @@ $(function(){ | ||
| 259 | } | 278 | } |
| 260 | initPinYinSelect2('#line',data,''); | 279 | initPinYinSelect2('#line',data,''); |
| 261 | }); | 280 | }); |
| 281 | + });*/ | ||
| 282 | + | ||
| 283 | + $.get('/report/lineList',function(xlList){ | ||
| 284 | + var data = []; | ||
| 285 | + data.push({id: '', text: ''}); | ||
| 286 | + for(var k=0;k < xlList.length;k++ ){ | ||
| 287 | + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]}); | ||
| 288 | + } | ||
| 289 | + initPinYinSelect2('#line',data,''); | ||
| 262 | }); | 290 | }); |
| 263 | 291 | ||
| 264 | }); | 292 | }); |
| @@ -266,7 +294,7 @@ $(function(){ | @@ -266,7 +294,7 @@ $(function(){ | ||
| 266 | 294 | ||
| 267 | function showPhoto(imageUrl) { | 295 | function showPhoto(imageUrl) { |
| 268 | // 当按钮被点击时触发 | 296 | // 当按钮被点击时触发 |
| 269 | - $('#img').attr('src', 'http://58.247.254.118:9999/images/'+imageUrl); // 设置弹出框中图片的路径 | 297 | + $('#img').attr('src', imageUrl); // 设置弹出框中图片的路径 |
| 270 | $('#imageModal').fadeIn(); // 显示弹出框 | 298 | $('#imageModal').fadeIn(); // 显示弹出框 |
| 271 | }; | 299 | }; |
| 272 | </script> | 300 | </script> |