拍照时间表管理修改

master
liuguijing 2 years ago
parent 790066f8ab
commit 1401086e82

@ -5,10 +5,7 @@ import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.bean.ServiceStatus; import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.GetModel; import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.model.TerminalScheduleRuleListModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleTimeListModel;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.TerminalScheduleRuleService; import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -100,8 +97,8 @@ public class TerminalScheduleRuleController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/relateSchelduleRule") @RequestMapping("/relateSchelduleRule")
@Log(title = "关联任务规则", type = "修改") @Log(title = "关联任务规则", type = "修改")
public ResponseReult<GetModel> relateSchelduleRule(@RequestBody @Validated RelateTerminalListRuleIdVo vo) { public ResponseReult<GetListModel> relateSchelduleRule(@RequestBody @Validated RelateTerminalListRuleIdVo vo) {
ServiceBody<GetModel> serviceBody = terminalScheduleRuleService.relateSchelduleRule(vo); ServiceBody<GetListModel> serviceBody = terminalScheduleRuleService.relateSchelduleRule(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {

@ -0,0 +1,21 @@
package com.shxy.xymanager_common.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* ID
*/
@Data
@ApiModel(value = "触发查询信息列表", description = "触发查询信息列表")
public class GetListModel implements Serializable {
@ApiModelProperty(value = "请求ID", example = "123456")
private List<Integer> list;
}

@ -8,11 +8,11 @@ import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
@Data @Data
@ApiModel(value = "查询Cma结果requestid的Vo", description = "查询Cma结果requestid的Vo") @ApiModel(value = "查询Cma结果requestid的list", description = "查询Cma结果requestid的list")
public class RequestIdListVo { public class RequestIdListVo {
@NotNull(message = "查询编号不能缺少") @NotNull(message = "查询编号列表不能缺少")
@ApiModelProperty(value = "查询编号", example = "123455") @ApiModelProperty(value = "查询编号列表", example = "123455")
private List<Integer> list; private List<Integer> list;
} }

@ -15,7 +15,8 @@ public interface RequestResultsDao {
int updateByPrimaryKeySelective(RequestResults record); int updateByPrimaryKeySelective(RequestResults record);
int updateByPrimaryKeyWithBLOBs(RequestResults record);
int updateByPrimaryKey(RequestResults record); int updateByPrimaryKey(RequestResults record);
int updateByRequestIdList(@Param("list") List<Integer> requestidlist, @Param("status") Integer status);
} }

@ -4,6 +4,8 @@ import com.shxy.xymanager_common.entity.TerminalSchedule;
import com.shxy.xymanager_common.entity.TerminalScheduleDetails; import com.shxy.xymanager_common.entity.TerminalScheduleDetails;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import javax.xml.crypto.Data;
import java.util.Date;
import java.util.List; import java.util.List;
public interface TerminalScheduleDetailsDao { public interface TerminalScheduleDetailsDao {
@ -14,7 +16,7 @@ public interface TerminalScheduleDetailsDao {
int insert(TerminalScheduleDetails record); int insert(TerminalScheduleDetails record);
int insertList(@Param("list") List<TerminalScheduleDetails> record); int insertList(@Param("list") List<TerminalScheduleDetails> record, @Param("createat") Date createat, @Param("updateat") Date updateat);
int insertSelective(TerminalScheduleDetails record); int insertSelective(TerminalScheduleDetails record);

@ -77,18 +77,13 @@
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.shxy.xymanager_common.entity.RequestResults"> <update id="updateByRequestIdList">
update request_results update request_results
set term_id = #{termId,jdbcType=INTEGER}, set request_schedule_status = #{status}
request_type = #{requestType,jdbcType=TINYINT}, where request_id in
frame_no = #{frameNo,jdbcType=TINYINT}, <foreach collection="list" item="id" index="index" separator="," open="(" close=")">
client_id = #{clientId,jdbcType=TINYINT}, #{id}
request_id = #{requestId,jdbcType=INTEGER}, </foreach>
result = #{result,jdbcType=TINYINT},
request_time = #{requestTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
data = #{data,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.RequestResults"> <update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.RequestResults">
update request_results update request_results

@ -37,11 +37,9 @@
<insert id="insertList"> <insert id="insertList">
insert into terminal_schedule_details insert into terminal_schedule_details
(term_id, channel_id,start_time, end_time, span, create_time, update_time) (term_id, channel_id,start_time, end_time, span, create_time, update_time)
values (#{id,jdbcType=INTEGER}, #{scheduleId,jdbcType=INTEGER}, #{startTime,jdbcType=TIME}, values
#{endTime,jdbcType=TIME}, #{span,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.termId},#{item.channelId},#{item.startTime},#{item.endTime},#{span},#{createat},#{updateat}) (#{item.termId},#{item.channelId},#{item.startTime},#{item.endTime},#{item.span},#{createat},#{updateat})
</foreach> </foreach>
</insert> </insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleDetails"> <insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleDetails">

@ -21,7 +21,7 @@
where status = #{status} where status = #{status}
<if test="list != null and list.size>0"> <if test="list != null and list.size>0">
and and
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> <foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
term_id = #{item.termid} term_id = #{item.termid}
<if test="item.channelidlist != null and item.channelidlist.size>0"> <if test="item.channelidlist != null and item.channelidlist.size>0">
and channel_id in and channel_id in
@ -39,9 +39,9 @@
from terminal_schedules_temp from terminal_schedules_temp
where status = #{status} where status = #{status}
<if test="list != null and list.size>0"> <if test="list != null and list.size>0">
and and request_id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
request_id = #{item} #{item}
</foreach> </foreach>
</if> </if>
</select> </select>
@ -78,9 +78,6 @@
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp"> <insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">
insert into terminal_schedules_temp insert into terminal_schedules_temp
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="termId != null"> <if test="termId != null">
term_id, term_id,
</if> </if>
@ -90,6 +87,12 @@
<if test="scheduleId != null"> <if test="scheduleId != null">
schedule_id, schedule_id,
</if> </if>
<if test="requestId != null">
request_id,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null"> <if test="createTime != null">
create_time, create_time,
</if> </if>
@ -98,9 +101,6 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="termId != null"> <if test="termId != null">
#{termId,jdbcType=INTEGER}, #{termId,jdbcType=INTEGER},
</if> </if>
@ -110,6 +110,12 @@
<if test="scheduleId != null"> <if test="scheduleId != null">
#{scheduleId,jdbcType=INTEGER}, #{scheduleId,jdbcType=INTEGER},
</if> </if>
<if test="requestId != null">
#{requestId},
</if>
<if test="status != null">
#{status},
</if>
<if test="createTime != null"> <if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>

@ -81,7 +81,7 @@
where status = #{status} where status = #{status}
</select> </select>
<select id="selectByIdList" resultMap="BaseResultMap"> <select id="selectByIdList" resultMap="ChannelAndTerm">
select select
a.id as term_id, a.id as term_id,
a.line_id as line_id, a.line_id as line_id,
@ -95,7 +95,7 @@
where a.status = #{status} where a.status = #{status}
<if test="list != null and list.size>0"> <if test="list != null and list.size>0">
and and
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> <foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
a.id = #{item.termid} a.id = #{item.termid}
<if test="item.channelidlist != null and item.channelidlist.size>0"> <if test="item.channelidlist != null and item.channelidlist.size>0">
and c.id in and c.id in

@ -296,15 +296,20 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
public ServiceBody<Boolean> getReturnedPhoto(ReturnedPhotoVo vo) { public ServiceBody<Boolean> getReturnedPhoto(ReturnedPhotoVo vo) {
Boolean hasNew = false; Boolean hasNew = false;
TerminalPhoto photo = terminalPhotoDao.getLatestPhoto(vo.getTermId()); TerminalPhoto photo = terminalPhotoDao.getLatestPhoto(vo.getTermId());
if (photo != null) {
BigInteger localPhotoTime = MyDateUtils.TimeMillSecond2Second(vo.getPhotoTime()); BigInteger localPhotoTime = MyDateUtils.TimeMillSecond2Second(vo.getPhotoTime());
log.info("请求时间:{}",localPhotoTime); log.info("请求时间:{}", localPhotoTime);
log.info("装置凯斯处理时间:{}",photo.getRecvTime()); log.info("装置凯斯处理时间:{}", photo.getRecvTime());
hasNew = photo.getRecvTime().compareTo(localPhotoTime) < 0 ? false : true; hasNew = photo.getRecvTime().compareTo(localPhotoTime) < 0 ? false : true;
if(hasNew && photo.getMediaType() == 1){ if (hasNew && photo.getMediaType() == 1) {
if(!StringUtils.isNotBlank(photo.getThumb())){ if (!StringUtils.isNotBlank(photo.getThumb())) {
hasNew=false; hasNew = false;
} }
} }
}else {
hasNew = false;
}
return Asserts.success(hasNew); return Asserts.success(hasNew);
} }
@ -466,7 +471,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
JSONObject resultObj = JSONObject.parseObject(result); JSONObject resultObj = JSONObject.parseObject(result);
if (null != resultObj.get("groupData")) { if (null != resultObj.get("groupData")) {
List<PhotoTimeResultDto> resultDtoList = JSONArray.parseArray(resultObj.get("groupData").toString(), PhotoTimeResultDto.class); List<PhotoTimeResultDto> resultDtoList = JSONArray.parseArray(resultObj.get("groupData").toString(), PhotoTimeResultDto.class);
if(CollectionUtil.isNotEmpty(resultDtoList)) { if (CollectionUtil.isNotEmpty(resultDtoList)) {
List<String> resultList = Lists.newArrayList(); List<String> resultList = Lists.newArrayList();
String startTimeStr = resultDtoList.get(0).getHour() + ":" + resultDtoList.get(0).getMinute() + ":00"; String startTimeStr = resultDtoList.get(0).getHour() + ":" + resultDtoList.get(0).getMinute() + ":00";
String endTimeStr = resultDtoList.get(1).getHour() + ":" + resultDtoList.get(1).getMinute() + ":00"; String endTimeStr = resultDtoList.get(1).getHour() + ":" + resultDtoList.get(1).getMinute() + ":00";

@ -219,57 +219,37 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
*/ */
@Override @Override
@Transactional @Transactional
public ServiceBody<GetModel> relateSchelduleRule(RelateTerminalListRuleIdVo vo) { public ServiceBody<GetListModel> relateSchelduleRule(RelateTerminalListRuleIdVo vo) {
GetListModel model = new GetListModel();
GetModel model = new GetModel();
List<TerminalSchedulesTemp> list = terminalSchedulesTempDao.selectByTermAndChannel(vo.getList(), CommonStatus.DELETE.value()); List<TerminalSchedulesTemp> list = terminalSchedulesTempDao.selectByTermAndChannel(vo.getList(), CommonStatus.DELETE.value());
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
return Asserts.error("有装置时间尚未下发成功"); return Asserts.error("有装置时间尚未下发成功");
} }
List<RelateTerminalListRuleIdVo.Items> termlist = vo.getList(); List<RelateTerminalListRuleIdVo.Items> termlist = vo.getList();
Integer scheduleid = vo.getScheduleid(); Integer scheduleid = vo.getScheduleid();
List<TerminalSchedulesTemp> temps = new ArrayList<>();
List<Integer> termidlist = new ArrayList<>();
for (RelateTerminalListRuleIdVo.Items item : termlist) {
termidlist.add(item.getTermid());
List<Integer> channelidlist = item.getChannelidlist();
for (Integer it : channelidlist) {
TerminalSchedulesTemp temp = new TerminalSchedulesTemp();
temp.setTermId(item.getTermid());
temp.setScheduleId(scheduleid);
temp.setChannelId(it);
temps.add(temp);
}
}
Date date = new Date();
int i = terminalSchedulesTempDao.insertList(temps, CommonStatus.EFFECTIVE.value(), date, date);
List<ChannelAndTermDto> terminalsList = terminalsDao.selectByIdList(vo.getList(), CommonStatus.EFFECTIVE.value()); List<ChannelAndTermDto> terminalsList = terminalsDao.selectByIdList(termlist, CommonStatus.EFFECTIVE.value());
if (CollectionUtil.isEmpty(terminalsList)) {
if (CollectionUtil.isEmpty(termidlist)) {
return Asserts.error("没有该装置"); return Asserts.error("没有该装置");
} }
ScheduleAndRuleDto dto = schedulesDao.selectSingle(scheduleid, CommonStatus.EFFECTIVE.value()); ScheduleAndRuleDto dto = schedulesDao.selectSingle(scheduleid, CommonStatus.EFFECTIVE.value());
if (BeanUtil.isEmpty(dto)) {
return Asserts.error("没有该拍照时间规则");
}
List<ScheduleRuleDto> dtoList = dto.getList(); List<ScheduleRuleDto> dtoList = dto.getList();
if (CollectionUtil.isEmpty(dtoList)) { if (CollectionUtil.isEmpty(dtoList)) {
return Asserts.error("没有该拍照时间规则"); return Asserts.error("没有该拍照时间规则");
} }
StringBuffer timestr = new StringBuffer(); StringBuffer timestr = new StringBuffer();
for (int j = 0; j < dtoList.size(); j++) { for (int j = 0; j < dtoList.size(); j++) {
TerminalPhotosTimeModel.PhotosTimeBean bean = new TerminalPhotosTimeModel.PhotosTimeBean();
Integer span = dtoList.get(j).getSpan(); Integer span = dtoList.get(j).getSpan();
Date startTime = dtoList.get(j).getStartTime(); Date startTime = dtoList.get(j).getStartTime();
Short startHour = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[0]); Short startHour = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[0]);
Short startMin = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[1]); Short startMin = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[1]);
Date endTime = dtoList.get(j).getEndTime(); Date endTime = dtoList.get(j).getEndTime();
Short endTimeHour = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[0]); Short endTimeHour = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[0]);
Short endTimeMin = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[1]); Short endTimeMin = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[1]);
Integer span1 = -1; Integer span1 = -1;
Integer span2 = -1; Integer span2 = -1;
if (span / 60 > 0) { if (span / 60 > 0) {
@ -283,19 +263,29 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
+ "--preset2=255 --hour3=" + span1 + "\t" + "--min3=" + span2 + "\t" + "--preset3=255"; + "--preset2=255 --hour3=" + span1 + "\t" + "--min3=" + span2 + "\t" + "--preset3=255";
timestr.append(string); timestr.append(string);
} }
ArrayList<Integer> requestIdList = new ArrayList<>();
for (int x = 0; x < terminalsList.size(); x++) { for (int x = 0; x < terminalsList.size(); x++) {
ChannelAndTermDto channelAndTermDto = terminalsList.get(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 --flag=1 --cmdid=" + channelAndTermDto.getCmdid() + "\t" + "--channel=" + channelAndTermDto.getChannelid() + "\t" +
timestr.toString(); timestr.toString();
ProcessExecUtils.exec(cmd); // ProcessExecUtils.exec(cmd);
} int requestId = Integer.parseInt(Constants.REQUEST_ID.toString());
model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString()));
Constants.REQUEST_ID.addAndGet(1); Constants.REQUEST_ID.addAndGet(1);
if (i != 0) { requestIdList.add(requestId);
return Asserts.success(model); Date date = new Date();
} else { TerminalSchedulesTemp temp = new TerminalSchedulesTemp();
return Asserts.error("关联失败"); temp.setTermId(channelAndTermDto.getTermid());
temp.setChannelId(channelAndTermDto.getChannelid());
temp.setScheduleId(scheduleid);
temp.setRequestId(requestId);
temp.setStatus(CommonStatus.DELETE.value());
temp.setCreateTime(date);
temp.setUpdateTime(date);
terminalSchedulesTempDao.insertSelective(temp);
} }
model.setList(requestIdList);
return Asserts.success(model);
} }
@ -358,13 +348,8 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
} }
} }
terminalScheduleDetailsDao.deleteByTermidAndChannelIdList(terminalSchedules); terminalScheduleDetailsDao.deleteByTermidAndChannelIdList(terminalSchedules);
terminalScheduleDetailsDao.insertList(terminalScheduleDetails); terminalScheduleDetailsDao.insertList(terminalScheduleDetails, date, date);
int i = requestResultsDao.updateByRequestIdList(requestidlist, CommonStatus.EFFECTIVE.value());//根据requestid将结果表中的状态修改为已下发
int i = requestResultsDao.updateByPrimaryKey(new RequestResults());//根据requestid将结果表中的状态修改为已下发
//end
if (i != 0) { if (i != 0) {
return Asserts.success("下发成功"); return Asserts.success("下发成功");
} else { } else {
@ -372,7 +357,6 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
} }
} }
/** /**
* *
* *
@ -381,10 +365,10 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
*/ */
@Transactional @Transactional
public ServiceBody<GetModel> getSchedule(RelateTerminalListRuleIdVo vo) { public ServiceBody<GetModel> getSchedule(RelateTerminalListRuleIdVo vo) {
// GetModel model = new GetModel(); GetModel model = new GetModel();
// Integer requestid = 0; Integer requestid = 0;
// ArrayList<Integer> intlist = new ArrayList<>(); ArrayList<Integer> intlist = new ArrayList<>();
// RequestResults results = requestResultsDao.selectByRequestId(1); RequestResults results = requestResultsDao.selectByRequestId(1);
// /* // /*
// * 如果下发成功 // * 如果下发成功
// * 1,将临时表中的数据状态改成1下发成功状态 // * 1,将临时表中的数据状态改成1下发成功状态

@ -1,10 +1,7 @@
package com.shxy.xymanager_service.service; package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.GetModel; import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.model.TerminalScheduleRuleListModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleTimeListModel;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
/** /**
@ -57,7 +54,7 @@ public interface TerminalScheduleRuleService {
* @param vo * @param vo
* @return * @return
*/ */
ServiceBody<GetModel> relateSchelduleRule(RelateTerminalListRuleIdVo vo); ServiceBody<GetListModel> relateSchelduleRule(RelateTerminalListRuleIdVo vo);
/** /**
* *

Loading…
Cancel
Save