Merge remote-tracking branch 'origin/master'
| | |
| | | |
| | | |
| | | |
| | | return null; |
| | | //return R.status(alarmService.saveOrUpdate(alarm)); |
| | | //return null; |
| | | return R.status(alarmService.saveOrUpdate(alarm)); |
| | | } |
| | | |
| | | |
| | |
| | | types = Arrays.asList(type); |
| | | //获取时间集合数据(今天及今天之前6天的日期) |
| | | times = DateUtils.pastDay(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); |
| | | //1.统计7天内一键求助警情数量数据 |
| | | //1.统计7天内一键求助警情数量数据 3-20 修改展示紧急求助 |
| | | Map<String,Object> alarmData = alarmService.selectAlarmData(); |
| | | alarmData.put("name","一键求助"); |
| | | //2.统计7天内违禁品的数量数据 |
| | |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | alarmService.updateJtype(operation.getJid(),operation.getJtype(),operation.getBz(),operation.getZctime()); |
| | | alarmService.updateJtype(operation.getJid(),operation.getJtype(),operation.getBz()); |
| | | alarmService.updatePoliceStatus(operation.getRid(),"0"); |
| | | operationService.save(operation); |
| | | return R.success("修改成功"); |
| | | } |
| | | |
| | | /** |
| | | * 查询所有保安信息 |
| | | */ |
| | | @PostMapping("/queryBa") |
| | | public R queryBa(OperationVO operation, HttpServletResponse response) { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | return R.data(alarmService.queryBa()); |
| | | } |
| | | |
| | | } |
| | |
| | | void deletejj(String id); |
| | | |
| | | void s(Alarm alarm); |
| | | void updateJtype(String id, String jtype, String bz,String jjtime); |
| | | void updateJtype(String id, String jtype, String bz); |
| | | void updatePoliceStatus(String id, String status); |
| | | void updateOne(Alarm alarm); |
| | | |
| | |
| | | List<Map<String, Object>> queryPolice(); |
| | | |
| | | List<Map<String, Object>> queryPoliceTime(List policeIdArr); |
| | | |
| | | List<Map<String, Object>> queryBa(); |
| | | } |
| | |
| | | </delete> |
| | | |
| | | <!--新增--> |
| | | <insert id="s" parameterType="org.springblade.jfpt.alarm.entity.Alarm"> |
| | | INSERT INTO sys_alarm (alarmType,alarmPeople,alarmTime,galarmPeople,sex,phoneNumber,place,content,waringType,deviceNumber, |
| | | <insert id="s" parameterType="org.springblade.jfpt.alarm.entity.Alarm" useGeneratedKeys="true" keyProperty="id"> |
| | | INSERT INTO sys_alarm (alarmType,jjTime,alarmPeople,alarmTime,galarmPeople,sex,phoneNumber,place,content,waringType,deviceNumber, |
| | | region,district,alarmId,level,rname,coordinate,jd,wd,jtype,province,city,cid) VALUES |
| | | (#{alarmType},#{alarmPeople},#{alarmTime},#{galarmPeople},#{sex},#{phoneNumber},#{place},#{content},#{waringType}, |
| | | (#{alarmType},#{jjTime},#{alarmPeople},#{alarmTime},#{galarmPeople},#{sex},#{phoneNumber},#{place},#{content},#{waringType}, |
| | | #{deviceNumber},#{region},#{district},#{alarmId},#{level},#{rname},POINT(#{jd},#{wd}), |
| | | #{jd},#{wd},#{jtype},#{province},#{city},#{cid}) |
| | | </insert> |
| | |
| | | |
| | | |
| | | <update id="updateJtype"> |
| | | update sys_alarm SET jtype=#{jtype},bz=#{bz},jjTime=#{jjtime} where id=#{id} |
| | | update sys_alarm SET jtype=#{jtype},bz=#{bz} where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updatePoliceStatus"> |
| | |
| | | <select id="selectAlarmCount" resultType="java.lang.Integer"> |
| | | SELECT count(*) FROM `sys_alarm` |
| | | where |
| | | waringType != '系统测试' |
| | | and |
| | | waringType!='主机重新上电' |
| | | waringType = '紧急求救' |
| | | and |
| | | to_days(alarmTime) = to_days(curdate()) |
| | | </select> |
| | |
| | | left join |
| | | ( |
| | | select DATE_FORMAT(alarmTime,'%Y-%m-%d') as datetime, count(*) as count from sys_alarm |
| | | where alarmType = '一键求助' |
| | | where waringType = '紧急求救' |
| | | group by DATE_FORMAT(alarmTime,'%Y-%m-%d') |
| | | ) b |
| | | on |
| | |
| | | <!--查询本日,本周,本月 主动报警的数量--> |
| | | <select id="selectAlarmSum" resultType="java.util.HashMap"> |
| | | select '一键求助' name,ifnull(count(*),0 ) value from sys_alarm |
| | | where alarmType = '一键求助' |
| | | where waringType = '紧急求救' |
| | | <if test="conditionVo.status==0"> |
| | | and to_days(alarmTime) = to_days(now()) |
| | | </if> |
| | |
| | | </if> |
| | | union all |
| | | select '电话报警' name,ifnull(count(*),0 ) value from sys_alarm |
| | | where alarmType = '电话报警' |
| | | where waringType = '电话报警' |
| | | <if test="conditionVo.status==0"> |
| | | and to_days(alarmTime) = to_days(now()) |
| | | </if> |
| | |
| | | LIMIT 1 |
| | | |
| | | </select> |
| | | |
| | | <select id="queryBa" resultType="java.util.HashMap"> |
| | | SELECT |
| | | s.id, |
| | | s.CODE, |
| | | s.NAME, |
| | | s.real_name, |
| | | s.phone, |
| | | p.jd, |
| | | p.wd, |
| | | ST_ASTEXT ( e.coordinate ) |
| | | FROM |
| | | jfpth.blade_user s |
| | | LEFT JOIN sys_position p ON p.snumber = s. |
| | | CODE LEFT JOIN sys_enclosure e ON e.anumber = s.CODE |
| | | WHERE |
| | | is_deleted != '1' |
| | | AND role_id = "1370562810882502657" |
| | | </select> |
| | | </mapper> |
| | |
| | | void updateOne(Alarm alarm); |
| | | List<Map<String, Object>> selectScount(String time); |
| | | List<AlarmVO> selectListSe(String beginTime, String endTime); |
| | | void updateJtype(String id, String jtype, String bz, String jjtime); |
| | | void updateJtype(String id, String jtype, String bz); |
| | | |
| | | void updatePoliceStatus(String id, String status); |
| | | |
| | |
| | | List<Map<String, Object>> queryPolice(); |
| | | |
| | | List<Map<String, Object>> queryPoliceTime(List policeIdArr); |
| | | |
| | | List<Map<String, Object>> queryBa(); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateJtype(String id,String jtype,String bz,String jjtime) { |
| | | baseMapper.updateJtype(id,jtype,bz,jjtime); |
| | | public void updateJtype(String id,String jtype,String bz) { |
| | | baseMapper.updateJtype(id,jtype,bz); |
| | | } |
| | | |
| | | @Override |
| | |
| | | public List<Map<String, Object>> queryPoliceTime(List policeIdArr) { |
| | | return baseMapper.queryPoliceTime(policeIdArr); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryBa() { |
| | | return baseMapper.queryBa(); |
| | | } |
| | | } |
| | |
| | | <if test="animalHeatVo.status!=null"> |
| | | and status=#{animalHeatVo.status} |
| | | </if> |
| | | <if test="animalHeatVo.begTime!=null and animalHeatVo.begTime!='' and animalHeatVo.endTime!=null and animalHeatVo.endTime!='' "> |
| | | and date(create_time) between #{animalHeatVo.begTime} and #{animalHeatVo.endTime} |
| | | </if> |
| | | ORDER BY create_time desc |
| | | </select> |
| | | |
| | |
| | | <if test="healthcodeVO.type!=null"> |
| | | and type=#{healthcodeVO.type} |
| | | </if> |
| | | <if test="healthcodeVO.province!=null"> |
| | | and province like concat('%',#{healthcodeVO.province},'%') |
| | | </if> |
| | | <if test="healthcodeVO.city!=null"> |
| | | and city like concat('%',#{healthcodeVO.city},'%') |
| | | </if> |
| | | <if test="healthcodeVO.district!=null"> |
| | | and district like concat('%',#{healthcodeVO.district},'%') |
| | | </if> |
| | | <if test="healthcodeVO.begTime!=null and healthcodeVO.begTime!='' and healthcodeVO.endTime!=null and healthcodeVO.endTime!='' "> |
| | | and date(dtime) between #{healthcodeVO.begTime} and #{healthcodeVO.endTime} |
| | | </if> |
| | | ORDER BY dtime desc |
| | | </select> |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public IPage<Healthcode> selectHealthcodeListPage(IPage<Healthcode> page, HealthcodeVO healthcodeVO) { |
| | | //判断城市 |
| | | if(null != healthcodeVO.getProvince()){ |
| | | //根据拿到的省id 查询出城市名称 |
| | | } |
| | | return page.setRecords(baseMapper.selectHealthcodeListPage(page,healthcodeVO)); |
| | | } |
| | | } |
| | |
| | | import org.springblade.jfpt.animalheat.service.AnimalHeatService; |
| | | import org.springblade.jfpt.catalog.service.catalogService; |
| | | import org.springblade.jfpt.equipment.service.IEquipmentService; |
| | | import org.springblade.jfpt.operation.service.IOperationService; |
| | | import org.springblade.jfpt.operation.vo.OperationVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private IAlarmService alarmService; |
| | | |
| | | @Autowired |
| | | private IOperationService operationService; |
| | | |
| | | private static ServerHandler serverHandler; |
| | | |
| | |
| | | if (police.size() != 0){ |
| | | alarm.setAlarmId( police.get(0).get("alarmId").toString()); |
| | | alarm.setAlarmPeople( police.get(0).get("alarmPeople").toString()); |
| | | // Date date = new Date(); |
| | | // SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // alarm.setJjTime(dateFormat.format(date)); |
| | | Date date = new Date(); |
| | | SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | alarm.setJjTime(dateFormat.format(date)); |
| | | |
| | | serverHandler.alarmService.updatePoliceStatus( police.get(0).get("alarmId").toString(),"1"); |
| | | }else { |
| | | alarm.setAlarmId( online_police.get(0).get("id").toString()); |
| | | alarm.setAlarmPeople(online_police.get(0).get("name").toString()); |
| | | // Date date = new Date(); |
| | | // SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // alarm.setJjTime(dateFormat.format(date)); |
| | | Date date = new Date(); |
| | | SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | alarm.setJjTime(dateFormat.format(date)); |
| | | |
| | | serverHandler.alarmService.updatePoliceStatus(online_police.get(0).get("id").toString(),"1"); |
| | | } |
| | | |
| | | serverHandler.alarmService.s(alarm); |
| | | |
| | | OperationVO operation = new OperationVO(); |
| | | operation.setSnumber(alarm.getAlarmId()); |
| | | operation.setSname(alarm.getAlarmPeople()); |
| | | operation.setJid(alarm.getId().toString()); |
| | | operation.setZc("接警"); |
| | | operation.setZctime(alarm.getJjTime()); |
| | | serverHandler.operationService.save(operation); |
| | | |
| | | outData.add("LEOK#@"); |
| | | long endTime1 = System.currentTimeMillis(); //获取结束时间 |
| | | |
| | |
| | | return R.data(parcelService.getParcelStatis(conditionVo)); |
| | | } |
| | | |
| | | /** |
| | | * 获取图片地址 |
| | | * @param imgUrl 图片url |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @GetMapping("/getParcelPic") |
| | | public R getParcelPic(String imgUrl,HttpServletResponse response){ |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials","true"); |
| | | return R.data(parcelService.getParcelPic(imgUrl)); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | Map<String, Object> selectParcelData(); |
| | | |
| | | |
| | | /** |
| | | * 获取图片地址 |
| | | * @param imgUrl 图片Url |
| | | * @return |
| | | */ |
| | | Map<String, String> getParcelPic(String imgUrl); |
| | | } |
| | |
| | | @Value("${PARCEL_URL}") |
| | | private String PARCEL_URL; |
| | | |
| | | @Value("${PARCEL_PICTURE_URL}") |
| | | private String PARCEL_PICTURE_URL; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | Map<String, Object> objectMap = (Map<String, Object>) object;//取出list里面的值转为map |
| | | //对比时间和objCode,危险品,刀具,枪支等 |
| | | if (time.equals(objectMap.get("dateStr").toString()) ){ |
| | | //枪支 |
| | | if (objectMap.get("objCode").toString().equals("gan")) { |
| | | count += Integer.parseInt(objectMap.get("objCount").toString()); |
| | | } |
| | | //刀具 |
| | | if (objectMap.get("objCode").toString().equals("knife")) { |
| | | count += Integer.parseInt(objectMap.get("objCount").toString()); |
| | | } |
| | | //爆炸物 |
| | | if (objectMap.get("objCode").toString().equals("boomExplosive")) { |
| | | count += Integer.parseInt(objectMap.get("objCount").toString()); |
| | | } |
| | | // //枪支 |
| | | // if (objectMap.get("objCode").toString().equals("gan")) { |
| | | // count += Integer.parseInt(objectMap.get("objCount").toString()); |
| | | // } |
| | | // //刀具 |
| | | // if (objectMap.get("objCode").toString().equals("knife")) { |
| | | // count += Integer.parseInt(objectMap.get("objCount").toString()); |
| | | // } |
| | | // //爆炸物 |
| | | // if (objectMap.get("objCode").toString().equals("boomExplosive")) { |
| | | // count += Integer.parseInt(objectMap.get("objCount").toString()); |
| | | // } |
| | | //3-20 修改不筛选危险品,由第三方筛选好 |
| | | count += Integer.parseInt(objectMap.get("objCount").toString()); |
| | | } |
| | | } |
| | | list.add(count); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 获取图片地址 |
| | | * @param imgUrl 图片Url |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Map<String, String> getParcelPic(String imgUrl) { |
| | | //截取图片imgKey信息 |
| | | String[] imgKeys = imgUrl.split("=", imgUrl.length()); |
| | | String imgKey = imgKeys[1]; |
| | | //封装成map对象 |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("imgKey",imgKey); |
| | | //执行http远程调用 |
| | | String s = HttpClientUtils.doGetHeaderPictureBase64(PARCEL_PICTURE_URL, PARCEL_KEY, PARCEL_SECRET, map); |
| | | map.put("imgBase64",s); |
| | | return map; |
| | | } |
| | | } |
| | |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.ssl.SSLContextBuilder; |
| | | import org.apache.http.util.EntityUtils; |
| | | import sun.misc.BASE64Encoder; |
| | | |
| | | import javax.net.ssl.SSLContext; |
| | | |
| | |
| | | |
| | | HttpGet get = new HttpGet(builder.build()); |
| | | |
| | | |
| | | response = httpclient.execute(get); |
| | | |
| | | System.out.println(response.getStatusLine()); |
| | | |
| | | if (200 == response.getStatusLine().getStatusCode()) { |
| | | HttpEntity entity = response.getEntity(); |
| | | System.out.println(entity.toString()); |
| | | resultString = EntityUtils.toString(entity, "utf-8"); |
| | | System.out.println(resultString.toString()); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | return resultString; |
| | | } |
| | | |
| | | /** |
| | | * 执行有参GET请求,带请求头 |
| | | * |
| | | * @param url 请求url |
| | | * @param params 参数 |
| | | * @param key 请求头Key |
| | | * @param secretKey 秘钥 |
| | | * @return |
| | | */ |
| | | public static String doGetHeader(String url, String key, String secretKey,Map<String, String> params) { |
| | | |
| | | //获取httpclient客户端 |
| | | CloseableHttpClient httpclient = HttpClients.createDefault(); |
| | | |
| | | String resultString = ""; |
| | | |
| | | CloseableHttpResponse response = null; |
| | | |
| | | try { |
| | | URIBuilder builder = new URIBuilder(url); |
| | | |
| | | if (null != params) { |
| | | for (String keys : params.keySet()) { |
| | | builder.addParameter(keys,params.get(keys)); |
| | | //builder.setParameter(keys, params.get(keys)); |
| | | } |
| | | } |
| | | |
| | | HttpGet httpGet = new HttpGet(builder.build()); |
| | | |
| | | //设置请求头 |
| | | httpGet.addHeader(key,secretKey); |
| | | // 传输的类型 |
| | | httpGet.addHeader("Content-Type", "application/x-www-form-urlencoded"); |
| | | //执行Http请求调用 |
| | | response = httpclient.execute(httpGet); |
| | | //判断是否请求成功返回 |
| | | if (200 == response.getStatusLine().getStatusCode()) { |
| | | HttpEntity entity = response.getEntity(); |
| | | resultString = EntityUtils.toString(entity, "utf-8"); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (null != response) { |
| | | try { |
| | | response.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if (null != httpclient) { |
| | | try { |
| | | httpclient.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return resultString; |
| | | } |
| | | |
| | | /** |
| | | * 执行有参GET请求,带请求头,接收图片流 |
| | | * |
| | | * @param url 请求url |
| | | * @param params 参数 |
| | | * @param key 请求头Key |
| | | * @param secretKey 秘钥 |
| | | * @return |
| | | */ |
| | | public static String doGetHeaderPictureBase64(String url, String key, String secretKey,Map<String, String> params) { |
| | | |
| | | //获取httpclient客户端 |
| | | CloseableHttpClient httpclient = HttpClients.createDefault(); |
| | | String resultString = ""; |
| | | CloseableHttpResponse response = null; |
| | | try { |
| | | URIBuilder builder = new URIBuilder(url); |
| | | if (null != params) { |
| | | for (String keys : params.keySet()) { |
| | | builder.addParameter(keys,params.get(keys)); |
| | | } |
| | | } |
| | | HttpGet httpGet = new HttpGet(builder.build()); |
| | | //设置请求头 |
| | | httpGet.addHeader(key,secretKey); |
| | | // 传输的类型 |
| | | httpGet.addHeader("Content-Type", "application/x-www-form-urlencoded"); |
| | | //执行Http请求调用 |
| | | response = httpclient.execute(httpGet); |
| | | // 将返回的图片或者文件转化成字节数组的形式 |
| | | byte[] data = EntityUtils.toByteArray(response.getEntity()); |
| | | BASE64Encoder encoder = new BASE64Encoder(); |
| | | //String imageBase64 = "data:image/png;base64," + encoder.encodeBuffer(data).trim(); |
| | | return encoder.encodeBuffer(data).trim().replaceAll("\n", "").replaceAll("\r", "").replaceAll(" ", "");//删除 \r\n |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (null != response) { |
| | | try { |
| | | response.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if (null != httpclient) { |
| | | try { |
| | | httpclient.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return resultString; |
| | | } |
| | | |
| | | /** |
| | | * 执行无参GET请求 |
| | | * |