#20230510 欣影管理平台装置信息查询代码

master
18616268358 2 years ago
parent 4488c1d148
commit 02666e57a4

@ -39,11 +39,24 @@ public class TerminalController extends BaseController {
}
}
@ApiOperation(value = "获取绘制图标", notes = "绘制坐标保存接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getCoordinate")
@Log(title = "获取绘制图标", type = "查询")
public ResponseReult<PhotoMarkModel> getCoordinate(@RequestBody @Validated MarkReqVo vo) {
ServiceBody<PhotoMarkModel> serviceBody = terminalService.getCoordinate(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
@ApiOperation(value = "绘制坐标保存", notes = "绘制坐标保存接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/updateCoordinate")
@Log(title = "绘制坐标保存", type = "查询")
public ResponseReult<String> Coordinate(@RequestBody @Validated PhotoMarkVo vo) {
@Log(title = "绘制坐标保存", type = "更新")
public ResponseReult<String> coordinate(@RequestBody @Validated PhotoMarkVo vo) {
ServiceBody<String> serviceBody = terminalService.updateCoordinate(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());

@ -0,0 +1,28 @@
package com.shxy.xymanager_common.dto;
import lombok.Data;
import java.util.List;
@Data
public class PhotoMarkDto {
private Integer id;
private Integer termId;
private Integer channelId;
private Integer width;
private Integer height;
private String color;
private String path;
private Short boderWidth;
private List<TermChannelCoordinateDto> lineList;
}

@ -8,7 +8,6 @@ import lombok.Data;
@Data
public class TermChannelCoordinateDto {
private Integer pathId;
private float x1;

@ -3,26 +3,15 @@ package com.shxy.xymanager_common.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class TerminalChannelsDto implements Serializable {
private Integer id;
private Integer photoId;
private String name;
private String path;
private float x1;
private float x2;
private float y2;
private float y1;
private static final long serialVersionUID = 1L;
}

@ -52,8 +52,6 @@ public class TerminalsAndLineAndChannelDto implements Serializable {
private Short boderWidth;
private List<TermChannelCoordinateDto> lineList;
private List<TerminalChannelsDto> list;
private static final long serialVersionUID = 1L;

@ -0,0 +1,59 @@
package com.shxy.xymanager_common.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
*
*/
@Data
@ApiModel(value = "获取绘制信息", description = "获取绘制信息")
public class PhotoMarkModel implements Serializable {
@ApiModelProperty(value = "通道编号", example = "213")
private Integer termId;
@ApiModelProperty(value = "绘制ID", example = "213")
private Integer markId;
@NotNull(message = "通道编号")
@ApiModelProperty(value = "通道编号", example = "213")
private Integer channelId;
@ApiModelProperty(value = "参考图片宽", example = "213")
private Integer width;
@ApiModelProperty(value = "参考图片高", example = "213")
private Integer height;
@ApiModelProperty(value = "线条颜色", example = "213")
private String color;
@ApiModelProperty(value = "线条宽度", example = "213")
private Short boderWidth;
@ApiModelProperty(value = "图片地址", example = "213")
private String path;
@ApiModelProperty(value = "通道编号和名称", example = "213")
private List<CoordinateBeans> list;
@Data
public static class CoordinateBeans {
@ApiModelProperty(value = "线段起始坐标x", example = "213")
private float x1;
@ApiModelProperty(value = "线段结束坐标x", example = "213")
private float x2;
@ApiModelProperty(value = "线段起始坐标y", example = "213")
private float y1;
@ApiModelProperty(value = "线段结束坐标y", example = "213")
private float y2;
}
}

@ -82,22 +82,6 @@ public class TerminalListModel implements Serializable {
@ApiModelProperty(value = "经度", example = "213")
private Double longitude;
@ApiModelProperty(value = "绘制ID", example = "213")
private Integer markId;
@ApiModelProperty(value = "参考图片宽", example = "213")
private Integer width;
@ApiModelProperty(value = "参考图片高", example = "213")
private Integer height;
@ApiModelProperty(value = "线条颜色", example = "213")
private String color;
@ApiModelProperty(value = "线条宽度", example = "213")
private Short boderWidth;
@ApiModelProperty(value = "通道编号和名称", example = "213")
private List<ChannelBeans> list;
@ -108,19 +92,9 @@ public class TerminalListModel implements Serializable {
public static class ChannelBeans {
@ApiModelProperty(value = "通道编号", example = "213")
private Integer id;
@ApiModelProperty(value = "照片编号", example = "213")
private Integer photoId;
@ApiModelProperty(value = "通道名称", example = "213")
private String name;
@ApiModelProperty(value = "图片地址", example = "213")
private String path;
@ApiModelProperty(value = "线段起始坐标x", example = "213")
private float x1;
@ApiModelProperty(value = "线段结束坐标x", example = "213")
private float x2;
@ApiModelProperty(value = "线段起始坐标y", example = "213")
private float y1;
@ApiModelProperty(value = "线段结束坐标y", example = "213")
private float y2;
}
}

@ -0,0 +1,27 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel(value = "绘制坐标请求对象", description = "绘制坐标请求对象")
public class MarkReqVo {
@NotNull(message = "装置编号不能为空")
@ApiModelProperty(value = "装置编号", required = true, example = "A0001")
private Integer termId;
@NotNull(message = "通道编号不能为空")
@ApiModelProperty(value = "通道编号", required = true, example = "A0001")
private Integer channelId;
@NotNull(message = "是否需要图片")
@ApiModelProperty(value = "是否需要图片", required = true, example = "0:需要 1:不需要")
private Integer needPic;
}

@ -7,7 +7,7 @@ import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "拍照时间表触发请求参数", description = "拍照时间表触发请求参数")
@ApiModel(value = "触发请求参数", description = "拍照时间表触发请求参数")
public class TerminalPhotoTimeGetVo {
@NotNull(message = "通道号")

@ -1,9 +1,6 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.dto.PhotoAndLineAndChannelDto;
import com.shxy.xymanager_common.dto.PhotoParamsDto;
import com.shxy.xymanager_common.dto.TermAndChannelLatestPhotoMapperDto;
import com.shxy.xymanager_common.dto.TerminalPhotoScheduleDto;
import com.shxy.xymanager_common.dto.*;
import com.shxy.xymanager_common.entity.TerminalPhoto;
import com.shxy.xymanager_common.vo.*;
import org.apache.ibatis.annotations.Param;
@ -63,4 +60,9 @@ public interface TerminalPhotoDao {
void updatePhotoMarkId(PhotoMarkVo vo);
PhotoMarkDto selectPhotoMark(MarkReqVo vo);
PhotoMarkDto selectPhotoWithoutPic(MarkReqVo vo);
}

@ -18,6 +18,21 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
</resultMap>
<resultMap id="PhotoMarkMap" type="com.shxy.xymanager_common.dto.PhotoMarkDto">
<result column="width" jdbcType="INTEGER" property="width"/>
<result column="mark_id" jdbcType="INTEGER" property="markId"/>
<result column="height" jdbcType="INTEGER" property="height"/>
<result column="color" jdbcType="VARCHAR" property="color"/>
<result column="boder_width" jdbcType="SMALLINT" property="boderWidth"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.TerminalChannelsDto">
<result column="x1" jdbcType="FLOAT" property="x1"/>
<result column="x2" jdbcType="FLOAT" property="x2"/>
<result column="y1" jdbcType="FLOAT" property="y1"/>
<result column="y2" jdbcType="FLOAT" property="y2"/>
</collection>
</resultMap>
<resultMap id="PhotoAndLineAndChannelMap" type="com.shxy.xymanager_common.dto.PhotoAndLineAndChannelDto">
<result column="term_id" jdbcType="INTEGER" property="termid"/>
<result column="display_name" jdbcType="VARCHAR" property="displayname"/>
@ -438,19 +453,54 @@
where id = #{id}
</update>
<update id="updatePhotoMarkId" parameterType="com.shxy.xymanager_common.vo.PhotoMarkVo">
update `terminal_photos`
<set>
<if test="id != null">
mark_id = #{id,jdbcType=VARCHAR},
</if>
</set>
where term_id = #{termId} and channel_id = #{channelId}
</update>
<delete id="deleteByMarkId">
delete from terminal_photo_mark_paths
where mark_id = #{markId}
</delete>
<select id="selectPhotoMark" resultMap="PhotoMarkMap" parameterType="com.shxy.xymanager_common.vo.MarkReqVo">
select
tpm.width as width,
tpm.height as height,
tpm.color as color,
tpm.boder_width as boder_width,
tpm.id as mark_id,
tpmp.id as path_id,
tpmp.x1 as x1,
tpmp.x2 as x2,
tpmp.y1 as y1,
tpmp.y2 as y2,
tp.path as path
from
terminal_photo_marks tpm left join terminal_photo_mark_paths tpmp on tpmp.mark_id = tpm.id
left join
(
SELECT path,term_id,channel_id
from terminal_photos where id = (select max(id) from terminal_photos where media_type =0 and
term_id = #{termId} and channel_id = #{channelId})
)tp on tpm.term_id = tp.term_id and tpm.channel_id = tp.channel_id
where tpm.term_id = #{termId} and tpm.channel_id = #{channelId}
</select>
<select id="selectPhotoWithoutPic" resultMap="PhotoMarkMap" parameterType="com.shxy.xymanager_common.vo.MarkReqVo">
select
tpm.width as width,
tpm.height as height,
tpm.color as color,
tpm.boder_width as boder_width,
tpm.id as mark_id,
tpmp.id as path_id,
tpmp.x1 as x1,
tpmp.x2 as x2,
tpmp.y1 as y1,
tpmp.y2 as y2
from
terminal_photo_marks tpm left join terminal_photo_mark_paths tpmp on tpmp.mark_id = tpm.id
where tpm.term_id = #{termId} and tpm.channel_id = #{channelId}
</select>
</mapper>

@ -17,7 +17,7 @@
<select id="selectByTermAndChannel" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_schedules_temp
from terminal_schedule_temp
where status = #{status}
<if test="list != null and list.size>0">
and
@ -36,7 +36,7 @@
<select id="selectByRequestId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_schedules_temp
from terminal_schedule_temp
where status = #{status}
<if test="list != null and list.size>0">
and request_id in
@ -49,16 +49,16 @@
<select id="selectByPrimaryKey" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_schedules_temp
from terminal_schedule_temp
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from terminal_schedules_temp
delete from terminal_schedule_temp
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">
insert into terminal_schedules_temp (id, term_id, channel_id,
insert into terminal_schedule_temp (id, term_id, channel_id,
schedule_id, create_time, update_time
)
values (#{id,jdbcType=INTEGER}, #{termId,jdbcType=INTEGER}, #{channelId,jdbcType=INTEGER},
@ -67,7 +67,7 @@
</insert>
<insert id="insertList" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">
insert into terminal_schedules_temp
insert into terminal_schedule_temp
(term_id, channel_id,
schedule_id, request_id,status,create_time, update_time)
values
@ -76,7 +76,7 @@
</foreach>
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">
insert into terminal_schedules_temp
insert into terminal_schedule_temp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="termId != null">
term_id,
@ -125,7 +125,7 @@
</trim>
</insert>
<update id="updateStatusByRequestIdList">
update terminal_schedules_temp
update terminal_schedule_temp
<set>
<if test="status != null">
status = #{status},
@ -143,7 +143,7 @@
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">
update terminal_schedules_temp
update terminal_schedule_temp
<set>
<if test="termId != null">
term_id = #{termId,jdbcType=INTEGER},
@ -164,7 +164,7 @@
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">
update terminal_schedules_temp
update terminal_schedule_temp
set term_id = #{termId,jdbcType=INTEGER},
channel_id = #{channelId,jdbcType=INTEGER},
schedule_id = #{scheduleId,jdbcType=INTEGER},

@ -40,20 +40,9 @@
<result column="bs_identifier" jdbcType="VARCHAR" property="bsIdentifier"/>
<result column="latitude" jdbcType="DOUBLE" property="latitude"/>
<result column="longitude" jdbcType="DOUBLE" property="longitude"/>
<result column="width" jdbcType="INTEGER" property="width"/>
<result column="mark_id" jdbcType="INTEGER" property="markId"/>
<result column="height" jdbcType="INTEGER" property="height"/>
<result column="color" jdbcType="VARCHAR" property="color"/>
<result column="boder_width" jdbcType="SMALLINT" property="boderWidth"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.TerminalChannelsDto">
<result column="channel_id" jdbcType="INTEGER" property="id"/>
<result column="channel_name" jdbcType="VARCHAR" property="name"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<result column="photoId" jdbcType="VARCHAR" property="photoId"/>
<result column="x1" jdbcType="FLOAT" property="x1"/>
<result column="x2" jdbcType="FLOAT" property="x2"/>
<result column="y1" jdbcType="FLOAT" property="y1"/>
<result column="y2" jdbcType="FLOAT" property="y2"/>
</collection>
</resultMap>
@ -150,32 +139,12 @@
a.latitude as latitude,
a.longitude as longitude,
e.id as channel_id,
e.channel_name as channel_name,
tpm.width as width,
tpm.height as height,
tpm.color as color,
tpm.boder_width as boder_width,
tpm.id as mark_id,
tpmp.id as path_id,
tpmp.x1 as x1,
tpmp.x2 as x2,
tpmp.y1 as y1,
tpmp.y2 as y2,
tp.path as path,
tp.id as photoId
e.channel_name as channel_name
from
(((((((terminals a left join `lines` b on a.line_id = b.id )
((((terminals a left join `lines` b on a.line_id = b.id )
left join tower c on a.tower_id = c.id)
left join terminal_channel_mapper d on a.id = d.term_id)
left join terminal_channels e on d.channel_id = e.id)
left join terminal_photo_marks tpm on a.id = tpm.term_id and e.id = tpm.channel_id)
left join terminal_photo_mark_paths tpmp on tpmp.mark_id = tpm.id)
left join
(
SELECT path,term_id,channel_id,id
from terminal_photos
where id in (select max(id) from terminal_photos where media_type =0 GROUP BY term_id,channel_id)
) tp on tp.channel_id = e.id and tp.term_id = a.id )
WHERE a.status = 1
order by a.create_time desc
</select>

@ -242,6 +242,7 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
return Asserts.error("没有该拍照时间规则");
}
StringBuffer timestr = new StringBuffer();
int index = 1;
for (int j = 0; j < dtoList.size(); j++) {
Integer span = dtoList.get(j).getSpan();
Date startTime = dtoList.get(j).getStartTime();
@ -259,17 +260,21 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
span1 = 0;
span2 = span;
}
String string = "--hour1=" + startHour + "\t" + "--min1=" + startMin + "\t" + "--preset1=255 --hour2=" + endTimeHour + "\t" + "--min2=" + endTimeMin + "\t"
+ "--preset2=255 --hour3=" + span1 + "\t" + "--min3=" + span2 + "\t" + "--preset3=255";
int indexOri = index;
int indexAdd = indexOri+1;
int indexAddT = indexAdd+1;
String string = "--hour"+indexOri+"="+ startHour + "\t" + "--min"+indexOri+"=" + startMin + "\t" + "--preset"+indexOri+"=255 --hour="+(indexAdd)+"=" + endTimeHour + "\t" + "--min"+(indexAdd)+"=" + endTimeMin + "\t"
+ "--preset"+(indexAdd)+"=255 --hour"+indexAddT+"=" + span1 + "\t" + "--min"+indexAddT+"=" + span2 + "\t" + "--preset"+indexAddT+"=255";
timestr.append(string);
index++;
}
ArrayList<Integer> requestIdList = new ArrayList<>();
for (int x = 0; x < terminalsList.size(); x++) {
ChannelAndTermDto channelAndTermDto = terminalsList.get(x);
String cmd = Constants.CMD + "schedule --flag=1 --cmdid=" + channelAndTermDto.getCmdid() + "\t" + "--channel=" + channelAndTermDto.getChannelid() + "\t" +
String cmd = Constants.CMD + "schedule --group="+dtoList.size()+"--flag=1 --cmdid=" + channelAndTermDto.getCmdid() + "\t" + "--channel=" + channelAndTermDto.getChannelid() + "\t" +
timestr.toString();
// ProcessExecUtils.exec(cmd);
ProcessExecUtils.exec(cmd);
int requestId = Integer.parseInt(Constants.REQUEST_ID.toString());
Constants.REQUEST_ID.addAndGet(1);
requestIdList.add(requestId);

@ -9,6 +9,7 @@ import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.dto.DyLineAndTerminalNoHeartDto;
import com.shxy.xymanager_common.dto.PhotoMarkDto;
import com.shxy.xymanager_common.dto.TerminalInfoDto;
import com.shxy.xymanager_common.dto.TerminalsAndLineAndChannelDto;
import com.shxy.xymanager_common.entity.TerminalChannelMapper;
@ -83,15 +84,6 @@ public class TerminalServiceImpl implements TerminalService {
if (empty) {
model.setList(new ArrayList<>());
} else {
list.forEach(var->{
if(CollectionUtil.isNotEmpty(var.getList())) {
var.getList().stream().forEach(line -> {
if (StringUtils.isNotBlank(line.getPath())) {
line.setPath(photoaddress + line.getPath());
}
});
}
});
List<TerminalListModel.TerminalBean> beans = BeanUtil.copyToList(list, TerminalListModel.TerminalBean.class, CopyOptions.create().ignoreCase());
model.setList(beans);
}
@ -338,9 +330,27 @@ public class TerminalServiceImpl implements TerminalService {
if(CollectionUtil.isNotEmpty(vo.getList())) {
terminalPhotoDao.addPhotoMarkPath(vo.getList(), vo.getId());
}
terminalPhotoDao.updatePhotoMarkId(vo);
return Asserts.success("保存成功");
}
@Override
public ServiceBody<PhotoMarkModel> getCoordinate(MarkReqVo vo) {
PhotoMarkModel model = new PhotoMarkModel();
PhotoMarkDto dto = null;
if(vo.getNeedPic()==0) {
dto = terminalPhotoDao.selectPhotoMark(vo);
if(null!=dto&&StringUtils.isNotBlank(dto.getPath())){
dto.setPath(photoaddress+dto.getPath());
}
}else{
dto = terminalPhotoDao.selectPhotoWithoutPic(vo);
}
if (null!=dto) {
BeanUtils.copyProperties(dto,model);
}
return Asserts.success(model);
}
}

@ -87,4 +87,7 @@ public interface TerminalService {
ServiceBody<String> updateCoordinate(PhotoMarkVo vo);
ServiceBody<PhotoMarkModel> getCoordinate(MarkReqVo vo);
}

Loading…
Cancel
Save