Commit 0038bb64 authored by Carit Zhu's avatar Carit Zhu 🎱

Add getWarehouseAlarm interface for AlarmLogController and modify to realize…

Add getWarehouseAlarm interface for AlarmLogController and modify to realize paging for getAlarm and getWarehouseAlarm.
parent df813d4c
Pipeline #440 passed with stage
in 0 seconds
package com.example.tdl.domain.vo;
public class ResultWarehouseAlarmLogVo {
private String warehouseNo;
private String warehouseName;
private String description;
private String data;
private Long alarmTime;
public String getWarehouseNo() {
return warehouseNo;
}
public void setWarehouseNo(String warehouseNo) {
this.warehouseNo = warehouseNo;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public Long getAlarmTime() {
return alarmTime;
}
public void setAlarmTime(Long alarmTime) {
this.alarmTime = alarmTime;
}
}
package com.example.tdl.domain.vo;
public class WarehouseAlarmTermVo {
private String companyNo;
private String warehouseNo;
private String warehouseName;
private String description;
private Long startTime;
private Long endTime;
public String getCompanyNo() {
return companyNo;
}
public void setCompanyNo(String companyNo) {
this.companyNo = companyNo;
}
public String getWarehouseNo() {
return warehouseNo;
}
public void setWarehouseNo(String warehouseNo) {
this.warehouseNo = warehouseNo;
}
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
}
......@@ -31,7 +31,13 @@ public interface AlarmLogMapper {
Integer getByTime(@Param("transportationNo") String transportationNo,@Param("startTime") Long startTime, @Param("endTime") Long endTime);
List<ResultAlarmLogVo> getAlarm(AlarmTermVo alarmTermVo);
Integer getAlarmForCount(AlarmTermVo alarmTermVo);
List<ResultAlarmLogVo> getAlarm(@Param("alarmTermVo")AlarmTermVo alarmTermVo, @Param("initialValue")Integer initialValue, @Param("rows") Integer rows);
Integer getAlarmWarehouseForCount(WarehouseAlarmTermVo warehouseAlarmTermVo);
List<ResultWarehouseAlarmLogVo> getAlarmWarehouse(@Param("warehouseAlarmTermVo")WarehouseAlarmTermVo warehouseAlarmTermVo, @Param("initialValue")Integer initialValue, @Param("rows") Integer rows);
List<AlarmLogVo> getRealTimeAlarm(String companyNo);
......
......@@ -54,8 +54,20 @@ public class AlarmLogService {
return alarmLogMapper.getByTime(transportationNo,startTime,endTime);
}
public List<ResultAlarmLogVo> getAlarm(AlarmTermVo alarmTermVo){
return alarmLogMapper.getAlarm(alarmTermVo);
public Integer getAlarmForCount(AlarmTermVo alarmTermVo){
return alarmLogMapper.getAlarmForCount(alarmTermVo);
}
public List<ResultAlarmLogVo> getAlarm(AlarmTermVo alarmTermVo,Integer initialValue,Integer rows){
return alarmLogMapper.getAlarm(alarmTermVo,initialValue,rows);
}
public Integer getAlarmWarehouseForCount(WarehouseAlarmTermVo warehouseAlarmTermVo){
return alarmLogMapper.getAlarmWarehouseForCount(warehouseAlarmTermVo);
}
public List<ResultWarehouseAlarmLogVo> getAlarmWarehouse(WarehouseAlarmTermVo warehouseAlarmTermVo,Integer initialValue,Integer rows){
return alarmLogMapper.getAlarmWarehouse(warehouseAlarmTermVo,initialValue,rows);
}
public List<AlarmLogVo> getRealTimeAlarm(String companyNo){
......
......@@ -79,28 +79,33 @@ public class AlarmLogController {
//获取报警信息
@ApiOperation(value = "获取报警信息",notes = "获取报警信息" +
" transportationNo:运输编号" +
" description:报警内容" +
" startCity:启运城市" +
" endCity:目的城市" +
" startTime:出发时间(时间戳)" +
" endTime:结束时间(时间戳)" +
"返回值: transportationNo:运输编号" +
" cargoNo:货号" +
" startCity:启运城市" +
" endCity:目的城市" +
" description:报警内容" +
" alarmTime:报警时间" )
@ApiOperation(value = "获取运输报警信息",notes = "获取运输报警信息: " +
"\n transportationNo:运输编号" +
"\n description:报警内容" +
"\n startCity:启运城市(仓库查询时为空)" +
"\n endCity:目的城市(仓库查询时为空)" +
"\n startTime:出发时间(时间戳ms)" +
"\n endTime:结束时间(时间戳ms)" +
"\n运输告警返回值: " +
"\n transportationNo:运输编号" +
"\n cargoNo:货号" +
"\n startCity:启运城市" +
"\n endCity:目的城市" +
"\n description:报警内容" +
"\n alarmTime:报警时间"
)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@PostMapping("/getAlarm")
public Object getAlarm(@RequestBody AlarmTermVo alarmTermVo ,HttpServletRequest request){
public Object getAlarm(@RequestParam(value ="page",defaultValue = "1")Integer page,
@RequestParam(value = "rows",defaultValue = "10")Integer rows,
@RequestBody AlarmTermVo alarmTermVo ,HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" + token);
UserRedisVo user = gson.fromJson(datum, UserRedisVo.class);
if(StringUtils.isEmpty(alarmTermVo.getTransportationNo())){
alarmTermVo.setTransportationNo(null);
}
......@@ -116,11 +121,68 @@ public class AlarmLogController {
if(alarmTermVo.getStartTime()==null){
alarmTermVo.setStartTime(null);
}
if(alarmTermVo.getDescription()==null){
if(alarmTermVo.getEndTime()==null){
alarmTermVo.setEndTime(null);
}
alarmTermVo.setCompanyNo(user.getCompanyNo());
return alarmLogServcie.getAlarm(alarmTermVo);
Integer total = alarmLogServcie.getAlarmForCount(alarmTermVo);
List<ResultAlarmLogVo> resultAlarmLogVos = alarmLogServcie.getAlarm(
alarmTermVo, (page - 1) * rows, rows);
return new EasyUIResult(total, resultAlarmLogVos);
}
//获取报警信息
@ApiOperation(value = "获取仓库报警信息",notes = "获取仓库报警信息: " +
"\n warehouseNo: 仓库编号" +
"\n warehouseName: 仓库名称" +
"\n description:报警内容" +
"\n startTime:出发时间(时间戳ms)" +
"\n endTime:结束时间(时间戳ms)" +
"\n仓库告警返回值: " +
"\n {" +
"\n total:总数" +
"\n rows: [" +
"\n warehouseNo:仓库编号" +
"\n warehouseName:仓库名称" +
"\n description:报警内容" +
"\n data:告警值" +
"\n alarmTime:报警时间" +
"\n ]" +
"\n }"
)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@PostMapping("/getWarehouseAlarm")
public Object getWarehouseAlarm(@RequestParam(value ="page",defaultValue = "1")Integer page,
@RequestParam(value = "rows",defaultValue = "10")Integer rows,
@RequestBody WarehouseAlarmTermVo warehouseAlarmTermVo ,HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" + token);
UserRedisVo user = gson.fromJson(datum, UserRedisVo.class);
if(StringUtils.isEmpty(warehouseAlarmTermVo.getDescription())){
warehouseAlarmTermVo.setDescription(null);
}
if(warehouseAlarmTermVo.getStartTime()==null){
warehouseAlarmTermVo.setStartTime(null);
}
if(warehouseAlarmTermVo.getEndTime()==null){
warehouseAlarmTermVo.setEndTime(null);
}
if (StringUtils.isBlank(warehouseAlarmTermVo.getWarehouseNo())){
warehouseAlarmTermVo.setWarehouseNo(null);
}
if (StringUtils.isBlank(warehouseAlarmTermVo.getWarehouseName())){
warehouseAlarmTermVo.setWarehouseName(null);
}
warehouseAlarmTermVo.setCompanyNo(user.getCompanyNo());
Integer total = alarmLogServcie.getAlarmWarehouseForCount(warehouseAlarmTermVo);
List<ResultWarehouseAlarmLogVo> resultAlarmLogVos = alarmLogServcie.getAlarmWarehouse(warehouseAlarmTermVo,
(page - 1) * rows, rows);
return new EasyUIResult(total, resultAlarmLogVos);
}
//获取最新报警
......
......@@ -102,8 +102,8 @@
and alarmTime between #{startTime,jdbcType=BIGINT} and #{endTime,jdbcType=BIGINT}
</select>
<select id="getAlarm" parameterType="com.example.tdl.domain.vo.AlarmTermVo" resultType="com.example.tdl.domain.vo.ResultAlarmLogVo">
select c.transportationNo,al.startCity,al.endCity,c.cargoNo,al.description,al.alarmTime
<select id="getAlarmForCount" parameterType="com.example.tdl.domain.vo.AlarmTermVo" resultType="java.lang.Integer">
select count(al.id)
from alarm_log al,circuit c,company co
where al.transportationNo =c.transportationNo
and c.company_id = co.id
......@@ -129,6 +129,83 @@
order by al.alarmTime DESC
</select>
<select id="getAlarm" resultType="com.example.tdl.domain.vo.ResultAlarmLogVo">
select c.transportationNo,al.startCity,al.endCity,c.cargoNo,al.description,al.alarmTime
from alarm_log al,circuit c,company co
where al.transportationNo =c.transportationNo
and c.company_id = co.id
and co.companyNo =#{alarmTermVo.companyNo,jdbcType=VARCHAR}
<if test="alarmTermVo.transportationNo!=null">
AND c.transportationNo = #{alarmTermVo.transportationNo,jdbcType=VARCHAR}
</if>
<if test="alarmTermVo.description!=null">
AND al.description = #{alarmTermVo.description,jdbcType=VARCHAR}
</if>
<if test="alarmTermVo.startCity!=null">
AND al.startCity = #{alarmTermVo.startCity,jdbcType=VARCHAR}
</if>
<if test="alarmTermVo.endCity!=null">
AND al.endCity = #{alarmTermVo.endCity,jdbcType=VARCHAR}
</if>
<if test="alarmTermVo.startTime!=null">
AND c.startTime &gt;= #{alarmTermVo.startTime,jdbcType=INTEGER}
</if>
<if test="alarmTermVo.endTime!=null">
AND c.endTime &lt;= #{alarmTermVo.endTime,jdbcType=INTEGER}
</if>
order by al.alarmTime DESC
LIMIT #{initialValue,jdbcType=INTEGER},#{rows,jdbcType=INTEGER}
</select>
<select id="getAlarmWarehouseForCount" parameterType="com.example.tdl.domain.vo.WarehouseAlarmTermVo" resultType="java.lang.Integer">
select count(wal.id)
from warehouse_alarmlog wal, warehouse w,company co
where wal.warehouseNo = w.warehouseNo
and w.company_id = co.id
and co.companyNo = #{companyNo,jdbcType=VARCHAR}
<if test="warehouseNo!=null">
AND w.warehouseNo = #{warehouseNo,jdbcType=VARCHAR}
</if>
<if test="warehouseName!=null">
AND w.warehouseName = #{warehouseName,jdbcType=VARCHAR}
</if>
<if test="description!=null">
AND wal.description = #{description,jdbcType=VARCHAR}
</if>
<if test="startTime!=null">
AND wal.alarmTime &gt;= #{startTime,jdbcType=INTEGER}
</if>
<if test="endTime!=null">
AND wal.alarmTime &lt;= #{endTime,jdbcType=INTEGER}
</if>
order by wal.alarmTime DESC
</select>
<select id="getAlarmWarehouse" resultType="com.example.tdl.domain.vo.ResultWarehouseAlarmLogVo">
select w.warehouseNo, w.warehouseName, wal.description, wal.data, wal.alarmTime
from warehouse_alarmlog wal, warehouse w,company co
where wal.warehouseNo = w.warehouseNo
and w.company_id = co.id
and co.companyNo = #{warehouseAlarmTermVo.companyNo,jdbcType=VARCHAR}
<if test="warehouseAlarmTermVo.warehouseNo!=null">
AND w.warehouseNo = #{warehouseAlarmTermVo.warehouseNo,jdbcType=VARCHAR}
</if>
<if test="warehouseAlarmTermVo.warehouseName!=null">
AND w.warehouseName = #{warehouseAlarmTermVo.warehouseName,jdbcType=VARCHAR}
</if>
<if test="warehouseAlarmTermVo.description!=null">
AND wal.description = #{warehouseAlarmTermVo.description,jdbcType=VARCHAR}
</if>
<if test="warehouseAlarmTermVo.startTime!=null">
AND wal.alarmTime &gt;= #{warehouseAlarmTermVo.startTime,jdbcType=INTEGER}
</if>
<if test="warehouseAlarmTermVo.endTime!=null">
AND wal.alarmTime &lt;= #{warehouseAlarmTermVo.endTime,jdbcType=INTEGER}
</if>
order by wal.alarmTime DESC
LIMIT #{initialValue,jdbcType=INTEGER},#{rows,jdbcType=INTEGER}
</select>
<select id="getRealTimeAlarm" parameterType="java.lang.String" resultType="com.example.tdl.domain.vo.AlarmLogVo">
select transportationNo,description,ifnull(FORMAT(data,2),"") data,alarmTime from alarm_log
where transportationNo in (select transportationNo from circuit where company_id =(
......
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