Commit 192840e9 by YANGYANG

任务关联人接口

parent 51604de2
package com.founder.commonutils.ZdryAndZdryApiVo;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author yangyang
* @since 2021-06-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="UsersAndOnlineAndTasksVo对象", description="UsersAndOnlineAndTasksVo对象")
public class UsersAndOnlineAndTasksVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "姓名")
private String xm;
@ApiModelProperty(value = "性别 1男 2女 0未知")
private Integer xb;
@ApiModelProperty(value = "家庭住址")
private String jtZz;
@ApiModelProperty(value = "是否有前科 1是 0否")
private Integer sfyQk;
@ApiModelProperty(value = "现住址")
private String xzz;
@ApiModelProperty(value = "病史")
private String bs;
@ApiModelProperty(value = "病情等级 1低 2中 3高 4极高")
private Integer bqDj;
@ApiModelProperty(value = "监护人1姓名")
private String jhr1Xm;
@ApiModelProperty(value = "监护人1关系")
private String jhr1Gx;
@ApiModelProperty(value = "监护人1联系电话")
private String jhr1Lxdh;
@ApiModelProperty(value = "监护人1紧急电话")
private String jhr1Jjdh;
@ApiModelProperty(value = "监护人2姓名")
private String jhr2Xm;
@ApiModelProperty(value = "监护人2关系")
private String jhr2Gx;
@ApiModelProperty(value = "监护人2联系电话")
private String jhr2Lxdh;
@ApiModelProperty(value = "监护人2紧急电话")
private String jhr2Jjdh;
@ApiModelProperty(value = "设备IMEI")
private String sbImei;
@ApiModelProperty(value = "设备型号")
private String sbXh;
@ApiModelProperty(value = "身份证号码")
private String sfzhm;
@ApiModelProperty(value = "是否在线 1在线 0离线")
private String online;
@ApiModelProperty(value = "是否佩戴 1佩戴 0位佩戴")
private String WearFlag;
@ApiModelProperty(value = "最新发生时间")
private String locationUpdatedAt;
@ApiModelProperty(value = "最新位置经度")
private String lastLocationX;
@ApiModelProperty(value = "最新位置纬度")
private String lastLocationY;
@ApiModelProperty(value = "最新位置地址")
private String lastAddress;
@ApiModelProperty(value = "电子围栏名称")
@TableField(value = "name")
private String name;
@ApiModelProperty(value = "开始时间例早上八点:8")
@TableField(value = "time_begin")
private String timeBegin;
@ApiModelProperty(value = "结束时间例下午六点:18")
@TableField(value = "time_end")
private String timeEnd;
@ApiModelProperty(value = "A;B;C;D;A")
@TableField(value = "safe_area")
private String safeArea;
@ApiModelProperty(value = "任务类型")
@TableField(value = "task_type")
private String taskType;
@ApiModelProperty(value = "预警")
@TableField(value = "warn")
private int warn;
@ApiModelProperty(value = "1进入区域 2离开区域 3异常预警")
@TableField(value = "gklx")
private int gklx;
}
package com.founder.commonutils.ZdryAndZdryApiVo;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -8,7 +7,6 @@ import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
......
......@@ -70,4 +70,8 @@ public class FenceTask implements Serializable {
@ApiModelProperty(value = "预警")
@TableField(value = "warn")
private int warn;
@ApiModelProperty(value = "1进入区域 2离开区域 3异常预警")
@TableField(value = "gklx")
private int gklx;
}
......@@ -3,6 +3,7 @@ package com.founder.zdry.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import com.founder.commonutils.publicEntity.MapRestResult;
import com.founder.commonutils.publicEntity.ResultCode;
......@@ -14,7 +15,9 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -64,6 +67,43 @@ public class FenceTaskController {
return MapRestResult.build(ResultCode.SUCCESS,"成功获取任务列表信息",total,records);
}
@ApiOperation(value = "分页任务关联人列表")
@GetMapping("fenceTaskPeopleList/{page}/{limit}")
public MapRestResult fenceTaskPeopleList(
@ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Long page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Long limit,
@ApiParam(name = "xm", value = "姓名")
@RequestParam(required = false) String xm,
@ApiParam(name = "bs", value = "病史")
@RequestParam(required = false) String bs,
@ApiParam(name = "sbimei", value = "设备IMEI")
@RequestParam(required = false) String sbimei,
@ApiParam(name = "bqdj", value = "病情等级")
@RequestParam(required = false) String bqdj,
@ApiParam(name = "sfzhm", value = "身份证号码")
@RequestParam(required = false) String sfzhm
){
Map map = new HashMap();
map.put("page",page);
map.put("limit",limit);
map.put("sbimei",sbimei);
map.put("xm",xm);
map.put("bs",bs);
map.put("bqdj",bqdj);
map.put("sfzhm",sfzhm);
List<UsersAndOnlineAndTasksVo> list = fenceTaskService.fenceTaskPeopleList(map);
Integer total = fenceTaskService.fenceTaskPeopleListCount(map);
return MapRestResult.build(ResultCode.SUCCESS,"分页任务关联人列表",total,list);
}
}
package com.founder.zdry.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineVo;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import com.founder.commonutils.zdryEntity.Users;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
......@@ -23,5 +22,8 @@ import java.util.Map;
@Component
public interface FenceTaskMapper extends BaseMapper<FenceTask> {
List<UsersAndOnlineAndTasksVo> fenceTaskPeopleList(Map map);
Integer fenceTaskPeopleListCount(Map map);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.founder.zdry.mapper.FenceTaskMapper">
<sql id="queryTlWhere">
<if test="xm!= null and xm!=''">
AND users.xm LIKE '%' || #{xm , jdbcType=VARCHAR } || '%'
</if>
<if test="sbimei!= null and sbimei != ''">
AND users.sb_imei= #{ sbimei , jdbcType=INTEGER }
</if>
<if test="bs!= null and bs != ''">
AND users.bs LIKE '%' || #{xm , jdbcType=VARCHAR } || '%'
</if>
<if test="sfzhm!= null and sfzhm != ''">
AND users.sfzhm LIKE '%' || #{sfzhm , jdbcType=VARCHAR } || '%'
</if>
<if test="bq_dj!= null and bq_dj != ''">
AND users.bq_dj= #{ bq_dj , jdbcType=INTEGER }
</if>
<if test="online!= null and online != ''">
AND online.online= #{ online , jdbcType=INTEGER }
</if>
<if test="wearFlag!= null and wearFlag != ''">
AND online.wear_flag= #{ wearFlag , jdbcType=INTEGER }
</if>
</sql>
<select id="fenceTaskPeopleList" parameterType="java.util.Map" resultType="com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo">
select
users.xm as xm,
users.xb as xb,
users. jt_zz as jtZz,
users.sfy_qk as sfyQk,
users.xzz as xzz,
users.bs as bs,
users.bq_dj as bqDj,
users.jhr1_xm as jhr1Xm,
users.jhr1_gx as jhr1Gx,
users.jhr1_lxdh as jhr1Lxdh,
users.jhr1_jjdh as jhr1Jjdh,
users.jhr2_xm as jhr2Xm,
users. jhr2_gx as jhr2Gx,
users.jhr2_lxdh as jhr2Lxdh,
users. jhr2_jjdh as jhr2Jjdh,
users. sb_imei as sbImei,
users. sb_xh as sbXh,
users.sfzhm as sfzhm,
online.online as online,
online.Wear_flag as WearFlag,
online.location_updated_at as locationUpdatedAt,
online.last_location_x as lastLocationX,
online.last_location_y as lastLocationY,
online.last_address as lastAddress,
task.name as name,
task.time_begin as timeBegin,
task.time_end as timeEnd,
task.safe_area as safeArea,
task.task_type as taskType,
task.warn as warn,
task.gklx as gklx
from gk_users users,gk_online online,gk_fencetask task
where users.sb_imei = online.sb_imei
and users.sb_imei = task.sb_imei
and users.xxsc_pdbz = 0
<include refid="queryTlWhere"/>
limit #{ page },#{ limit}
</select>
<select id="fenceTaskPeopleListCount" parameterType="java.util.Map" resultType="java.lang.Integer">
select
count(*)
from gk_users users,gk_online online,gk_fencetask task
where users.sb_imei = online.sb_imei
and users.sb_imei = task.sb_imei
and users.xxsc_pdbz = 0
<include refid="queryTlWhere"/>
</select>
</mapper>
......@@ -53,6 +53,7 @@
count(*)
from gk_users users,gk_online online
where users.sb_imei = online.sb_imei
and users.xxsc_pdbz = 0
<include refid="queryTlWhere"/>
</select>
</mapper>
package com.founder.zdry.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -14,4 +18,8 @@ import com.founder.commonutils.ZdryApiEntity.FenceTask;
*/
public interface FenceTaskService extends IService<FenceTask> {
List<UsersAndOnlineAndTasksVo> fenceTaskPeopleList(Map map);
Integer fenceTaskPeopleListCount(Map map);
}
package com.founder.zdry.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.founder.commonutils.ZdryAndZdryApiVo.UsersAndOnlineAndTasksVo;
import com.founder.commonutils.ZdryApiEntity.FenceTask;
import com.founder.zdry.mapper.FenceTaskMapper;
import com.founder.zdry.service.FenceTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
......@@ -18,5 +23,16 @@ import org.springframework.stereotype.Service;
*/
@Service
public class FenceTaskServiceImpl extends ServiceImpl<FenceTaskMapper, FenceTask> implements FenceTaskService {
@Autowired
private FenceTaskMapper fenceTaskMapper;
@Override
public List<UsersAndOnlineAndTasksVo> fenceTaskPeopleList(Map map) {
return fenceTaskMapper.fenceTaskPeopleList(map);
}
@Override
public Integer fenceTaskPeopleListCount(Map map) {
return fenceTaskMapper.fenceTaskPeopleListCount(map);
}
}
......@@ -87,10 +87,12 @@ public class ZdryApiController {
@ApiParam(name = "time_end", value = "结束时间例下午六点:18:00", required = true)
@RequestParam(value = "time_end") String time_end,
@ApiParam(name = "safe_area", value = "A;B;C;D;A", required = true)
@RequestParam(value = "safe_area") String safe_area
@RequestParam(value = "safe_area") String safe_area,
@ApiParam(name = "gklx", value = "1进入区域 2离开区域 3异常预警", required = true)
@RequestParam(value = "gklx") int gklx
) {
return zdryApiService.deviceFenceTask(sbImei,name,time_begin,time_end,safe_area);
return zdryApiService.deviceFenceTask(sbImei,name,time_begin,time_end,safe_area,gklx);
}
@ApiOperation(value = "电子围栏预警")
......
......@@ -23,7 +23,7 @@ public interface ZdryApiService {
MapRestResult onlineAndWeardata();
MapRestResult deviceFenceTask(String sbImei,String name,String time_begin, String time_end, String safe_area);
MapRestResult deviceFenceTask(String sbImei,String name,String time_begin, String time_end, String safe_area,int gklx);
public MapRestResult FenceWarning();
}
......@@ -364,7 +364,7 @@ public class ZdryApiServiceImpl implements ZdryApiService {
}
@Override
public MapRestResult deviceFenceTask(String sbImei,String name, String time_begin, String time_end, String safe_area) {
public MapRestResult deviceFenceTask(String sbImei,String name, String time_begin, String time_end, String safe_area,int gklx) {
SimpleDateFormat sf = new SimpleDateFormat("HH");
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/x-www-form-urlencoded");
......@@ -401,6 +401,7 @@ public class ZdryApiServiceImpl implements ZdryApiService {
fenceTask.setSafeArea(safe_area);
fenceTask.setSbImei(sbImei);
fenceTask.setTaskType("dzwl");
fenceTask.setGklx(gklx);
// 执行更新
zdryFenceTaskMapper.updateById(fenceTask);
......@@ -412,6 +413,7 @@ public class ZdryApiServiceImpl implements ZdryApiService {
fenceTasks.setSafeArea(safe_area);
fenceTasks.setSbImei(sbImei);
fenceTasks.setTaskType("dzwl");
fenceTasks.setGklx(gklx);
// 插入数据
int flag = zdryFenceTaskMapper.insert(fenceTasks);
......@@ -439,6 +441,7 @@ public class ZdryApiServiceImpl implements ZdryApiService {
fenceTask.setSafeArea(safe_area);
fenceTask.setSbImei(sbImei);
fenceTask.setTaskType("dzwl");
fenceTask.setGklx(gklx);
// 执行更新
zdryFenceTaskMapper.updateById(fenceTask);
......@@ -450,6 +453,7 @@ public class ZdryApiServiceImpl implements ZdryApiService {
fenceTasks.setSafeArea(safe_area);
fenceTasks.setSbImei(sbImei);
fenceTasks.setTaskType("dzwl");
fenceTasks.setGklx(gklx);
// 插入数据
int flag = zdryFenceTaskMapper.insert(fenceTasks);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment