Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
聂康
ivccs
Commits
07602a7b
Commit
07602a7b
authored
Apr 18, 2023
by
kang.nie@inzymeits.com
Browse files
提交代码
parent
e0c7be76
Changes
479
Hide whitespace changes
Inline
Side-by-side
ivccs-vmm-backservice/src/main/java/com/ssi/controller/CraneInfoController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.CraneInfo
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.CraneInfoService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
/**
* 吊具信息控制器
*
* @author liheng
* @email
* @date 2020-09-01 16:29:29
*/
@Api
@RestController
@RequestMapping
(
"/craneInfo"
)
public
class
CraneInfoController
{
@Autowired
private
CraneInfoService
craneInfoService
;
/**
* 获取桥吊、场吊信息列表
*/
@LogAudit
@PostMapping
(
"/queryCraneList"
)
@ApiOperation
(
value
=
"获取桥吊、场吊信息列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
queryCraneList
(
@RequestBody
(
required
=
false
)
CraneInfo
craneInfo
)
{
return
craneInfoService
.
queryCraneList
(
craneInfo
);
}
/**
* 获取桥吊、场吊、龙锁装卸区信息列表
*/
@LogAudit
@PostMapping
(
"/queryCraneLockAreaList"
)
@ApiOperation
(
value
=
"获取桥吊、场吊、龙锁装卸区信息列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
queryCraneLockAreaList
(
@RequestBody
(
required
=
false
)
CraneInfo
craneInfo
)
{
return
craneInfoService
.
queryCraneLockAreaList
(
craneInfo
);
}
@GetMapping
(
"/craneColor"
)
@ApiOperation
(
value
=
"获取桥吊颜色配置"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
queryCraneColor
(
@RequestParam
(
required
=
false
)
String
craneNo
)
{
return
craneInfoService
.
queryCraneColor
(
craneNo
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/FileUploadController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.ssi.constant.enums.Status
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.utils.FileUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.ResourceLoader
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 文件上传控制器
*/
@Api
@RestController
@RequestMapping
(
"/file"
)
public
class
FileUploadController
{
@Value
(
"${LinuxFile.upload-url}"
)
private
String
url
;
@Value
(
"${LinuxFile.upload-path}"
)
private
String
path
;
private
final
ResourceLoader
resourceLoader
;
@Autowired
public
FileUploadController
(
ResourceLoader
resourceLoader
)
{
this
.
resourceLoader
=
resourceLoader
;
}
/**
* @param file 上传的文件
* @return
*/
@RequestMapping
(
"/fileUpload"
)
@ApiOperation
(
value
=
"上传文件"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
upload
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
long
size
=
file
.
getSize
();
//获得文件名字
String
fileName
=
file
.
getOriginalFilename
();
//上传失败提示
String
newFileName
=
FileUtils
.
upload
(
file
,
path
,
fileName
);
if
(
newFileName
!=
null
)
{
Map
<
String
,
String
>
fileMap
=
new
HashMap
<
String
,
String
>();
fileMap
.
put
(
"fileName"
,
newFileName
);
fileMap
.
put
(
"fileUrl"
,
url
+
File
.
separator
+
newFileName
);
return
SSIResponse
.
ok
(
fileMap
);
}
else
{
return
SSIResponse
.
no
(
Status
.
FILEUPLOADERROR
);
}
}
@GetMapping
(
value
=
"/getFile"
)
@ApiOperation
(
value
=
"获取文件"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
file
(
@RequestParam
String
fileName
)
{
return
SSIResponse
.
ok
(
url
+
File
.
separator
+
fileName
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/OperateExecuteController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.VmsVehicleOperateTask
;
import
com.ssi.mapper.VmsVehicleOperateTaskMapper
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.task.TaskOperateExecutor
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.io.IOException
;
/**
* @author ZhangLiYao
* @version 1.0
* @date 2020/8/8 8:31
*/
@Api
@RestController
@RequestMapping
(
"/screen"
)
public
class
OperateExecuteController
{
@Autowired
private
TaskOperateExecutor
taskOperateExecutor
;
@Autowired
private
VmsVehicleOperateTaskMapper
vmsVehicleOperateTaskMapper
;
/**
* 执行任务
*/
@LogAudit
@ApiOperation
(
value
=
"执行任务"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/submitTask"
)
public
SSIResponse
info
(
@RequestParam
String
vin
,
Long
startTime
,
Long
stopTime
)
throws
IOException
{
VmsVehicleOperateTask
vmsVehicleOperateTask
=
taskOperateExecutor
.
getVehicleOpreateByTime
(
vin
,
startTime
,
stopTime
);
int
count
=
vmsVehicleOperateTaskMapper
.
selectCount
(
new
LambdaQueryWrapper
<
VmsVehicleOperateTask
>()
.
eq
(
VmsVehicleOperateTask:
:
getVin
,
vin
)
.
eq
(
VmsVehicleOperateTask:
:
getTaskDate
,
vmsVehicleOperateTask
.
getTaskDate
()));
if
(
count
<=
0
){
vmsVehicleOperateTaskMapper
.
insert
(
vmsVehicleOperateTask
);
}
return
SSIResponse
.
ok
();
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/OperationAnalysisController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.dto.VehicleTaskOrderReq
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.OperationAnalysisService
;
import
com.ssi.service.VmsKpiAnalysisService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.time.LocalDateTime
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
/**
* 运行分析控制器
*/
@Api
(
tags
=
"运行分析控制器"
,
description
=
"运行分析"
)
@RestController
@RequestMapping
(
"/operationAnalysis"
)
public
class
OperationAnalysisController
{
@Autowired
private
OperationAnalysisService
operationAnalysisService
;
@Autowired
private
VmsKpiAnalysisService
vmsKpiAnalysisService
;
/**
* 各项总体数据
*/
@LogAudit
@ApiOperation
(
value
=
"各项总体数据"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/overall"
)
public
SSIResponse
queryOverall
(
@RequestParam
(
name
=
"vin"
,
required
=
false
)
List
<
String
>
vins
,
@RequestParam
(
name
=
"interval"
,
required
=
false
)
List
<
Date
>
interval
)
{
return
operationAnalysisService
.
overallData
(
vins
,
interval
);
}
/**
* 运输效率趋势图
*/
@LogAudit
@ApiOperation
(
value
=
"运输效率趋势图"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/getTaskTrend"
)
public
SSIResponse
getTaskTrend
(
@RequestParam
(
"timeType"
)
Integer
timeType
,
@RequestParam
(
value
=
"groupType"
,
required
=
false
)
Integer
groupType
)
throws
Exception
{
//return operationAnalysisService.getTaskTrend(timeType);
if
(
Objects
.
isNull
(
groupType
)){
groupType
=
3
;
}
return
vmsKpiAnalysisService
.
getTaskTrend
(
timeType
,
groupType
);
}
/**
* 停车等待时长分析
*/
@LogAudit
@ApiOperation
(
value
=
"停车等待时长分析"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/getStopWaitTimeRate"
)
public
SSIResponse
getStopWaitTimeRate
()
{
//计算一个月内执行任务的停车等待时长
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
add
(
Calendar
.
MONTH
,-
1
);
return
operationAnalysisService
.
getStopWaitTimeRate
(
calendar
.
getTime
().
getTime
());
}
/**
* 运载力趋势图(空载里程、满载里程)
*/
@LogAudit
@ApiOperation
(
value
=
"运载力趋势图(空载里程、满载里程)"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/getTaskMileTrend"
)
public
SSIResponse
getTaskMileTrend
(
Integer
timeType
)
throws
Exception
{
return
operationAnalysisService
.
getTaskMileTrend
(
timeType
);
}
/**
* 充电桩利用率、充电时长趋势图
*/
@LogAudit
@ApiOperation
(
value
=
"充电桩利用率、充电时长趋势图"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/getChargingPileUseTrend"
)
public
SSIResponse
getChargingPileUseTrend
(
Integer
timeType
)
throws
Exception
{
return
operationAnalysisService
.
getChargingPileUseTrend
(
timeType
);
}
/**
* 平均一周充电频次分析
*/
@LogAudit
@ApiOperation
(
value
=
"平均一周充电频次分析"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/getChargingFrequencyByVehicle"
)
public
SSIResponse
getChargingFrequencyByVehicle
()
{
return
operationAnalysisService
.
getChargingFrequencyByVehicle
();
}
/**
* 平均一周充电频次平均值
*/
@LogAudit
@ApiOperation
(
value
=
"平均一周充电频次平均值"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/getOverallChargingFrequency"
)
public
SSIResponse
getOverallChargingFrequency
()
{
return
operationAnalysisService
.
getOverallChargingFrequency
();
}
/**
* 车辆使用率/里程/时长/能耗分析
*/
@LogAudit
@ApiOperation
(
value
=
"车辆使用率/里程/时长/能耗分析"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/getUseInfoByVehicle"
)
public
SSIResponse
getUseInfoByVehicle
()
{
return
operationAnalysisService
.
getUseInfoByVehicle
();
}
/**
* 车辆任务分析
*/
@LogAudit
@ApiOperation
(
value
=
"车辆任务分析"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/getVehicleTaskOrder"
)
public
SSIResponse
getVehicleTaskOrder
(
@RequestBody
VehicleTaskOrderReq
vehicleTaskOrderReq
)
{
return
operationAnalysisService
.
getVehicleTaskOrder
(
vehicleTaskOrderReq
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/TaskTosSendController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.constant.URL
;
import
com.ssi.entity.dto.VmsTosOrdersDto
;
import
com.ssi.model.RedisDataModel
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.utils.RestTemplateUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.util.Assert
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
@Api
(
tags
=
"人工干预"
,
description
=
"命令"
)
//@Slf4j
@RestController
@RequestMapping
(
"/TaskToSend/data"
)
public
class
TaskTosSendController
{
@Value
(
"${command-url}"
)
private
String
odbuUrl
;
@Value
(
"${gear-url}"
)
private
String
gearUrl
;
@Autowired
private
RedisDataModel
redisDataModel
;
@Value
(
"${map-edit-url}"
)
private
String
mapEditUrl
;
// @Autowired
// private KafkaTemplate<String, String> kafkaTemplate;
// private int tempResult = 0;
/**
* tos 指令下发
*/
@LogAudit
@ApiOperation
(
value
=
"去堆场"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/gotoHeap"
)
public
SSIResponse
<?>
sendHeap
(
@RequestBody
VmsTosOrdersDto
dto
)
{
JSONObject
param
=
new
JSONObject
();
Date
date
=
new
Date
();
// param.put("seq", UUID.randomUUID().toString().replace("-", ""));// 序号
param
.
put
(
"taskAssociation"
,
""
);
// 任务关联
param
.
put
(
"vin"
,
dto
.
getVin
());
// 车辆编号
param
.
put
(
"taskLocationType"
,
dto
.
getTaskLocationType
());
// 任务类型 作业位置类型
// 1-去堆场(装箱或卸箱);2-去停车点(上扭锁,解扭锁,停车);3-去固定停车区;4-去临时停车区;5-去桥吊(装箱或卸箱);6-去充电
param
.
put
(
"taskType"
,
dto
.
getTaskType
());
// 作业类型 1-装箱,2-卸箱
param
.
put
(
"cartonConditon"
,
"0"
);
// 辆当前装箱状态
param
.
put
(
"vehicleTaskType"
,
dto
.
getVehicleTaskType
());
// 车辆任务类型 对应着前台 集装箱类型
param
.
put
(
"vehicleLocation"
,
dto
.
getVehicleLocation
());
// 车辆任务目标地点 对应前台 堆场贝位
param
.
put
(
"portType"
,
2
);
// 港机类型
if
(
null
!=
dto
.
getContainerWeight
())
{
param
.
put
(
"containerWeight"
,
dto
.
getContainerWeight
());
// 集装箱重量
}
else
{
param
.
put
(
"containerWeight"
,
5
);
// 集装箱重量
}
param
.
put
(
"taskSource"
,
2
);
// 1-TOS下发;2-手动下发;3-VMS下发
param
.
put
(
"collectTime"
,
date
);
// 作业时间
// param.put("voyuageNo","");//艘次编号
param
.
put
(
"lockLabel"
,
1
);
// 扭锁标签
if
(
dto
.
getTaskLocationType
().
equals
(
1
))
{
param
.
put
(
"containerLabel"
,
1
);
}
else
{
param
.
put
(
"containerLabel"
,
2
);
}
// if (dto.getTaskType().equals(1)) {
// param.put("vehicleTaskLabel", 1);
// }
// if (dto.getTaskType().equals(2)) {
// param.put("vehicleTaskLabel", 2);
// }
param
.
put
(
"vehicleTaskLabel"
,
dto
.
getVehicleTaskLabel
());
//车辆任务标签,1:装船;2:卸船;3:堆场间搬移;4:停车,5:充电,6:临时停车
// 如果车辆任务类型 为装船,那么作业类型必须为装箱
if
(
dto
.
getVehicleTaskLabel
()==
1
)
{
if
(
dto
.
getTaskType
()==
2
)
{
return
SSIResponse
.
no
(
"车辆任务类型为装船,作业类型必须为装箱"
);
}
}
if
(
null
!=
dto
.
getVoyageNo
())
{
param
.
put
(
"voyageNo"
,
dto
.
getVoyageNo
());
// 艘次编号 对应前台朝向 朝东16855朝西 16844
}
String
result
=
""
;
// 双小箱
if
(
dto
.
getVehicleTaskType
()
==
2
)
{
param
.
put
(
"containerNum"
,
2
);
// 集装箱个数
String
parentTaskNo
=
""
;
param
.
put
(
"containerType"
,
"20"
);
// 集装箱类型
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
param
.
put
(
"taskNo"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 任务编号
if
(
i
==
0
)
{
param
.
put
(
"containerId"
,
dto
.
getContainerId
());
// 前集装箱ID
param
.
put
(
"vehicleLocation"
,
dto
.
getVehicleLocation
());
// 车辆任务目标地点 对应前台 堆场贝位
param
.
put
(
"portCode"
,
dto
.
getPortCode
());
// 对应前台轮胎吊编号
param
.
put
(
"containerPosition"
,
01
);
// 集装箱位置
parentTaskNo
=
param
.
getString
(
"taskNo"
);
param
.
put
(
"parentTaskNo"
,
parentTaskNo
);
}
if
(
i
==
1
)
{
param
.
put
(
"containerId"
,
dto
.
getContainerIdT
());
// 后集装箱ID
param
.
put
(
"vehicleLocation"
,
dto
.
getVehicleLocationT
());
// 车辆任务目标地点 对应前台 后堆场贝位
param
.
put
(
"portCode"
,
dto
.
getPortCodeT
());
// 港机编码 对应前台轮胎吊编号
param
.
put
(
"containerPosition"
,
03
);
// 集装箱位置
param
.
put
(
"parentTaskNo"
,
parentTaskNo
);
}
param
.
put
(
"containerSize"
,
"20"
);
// temp+=sendTos(dto.getVin(),param.toString());// 推送kafa
if
(
i
==
0
)
{
redisDataModel
.
del
(
"harbor:command:twenty_foot:order:"
+
dto
.
getVin
());
//双小箱任务之前 先把这个key清掉
}
result
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
odbuUrl
,
URL
.
To_ODBU_URL
),
param
.
toString
(),
null
);
}
}
else
{
if
(
dto
.
getVehicleTaskType
()==
1
)
{
// 1-大箱;2-双小箱;3-单小箱;0-其它
param
.
put
(
"containerType"
,
"40"
);
// 集装箱类型
param
.
put
(
"containerSize"
,
"40"
);
// 集装箱车上位置, 1-前;2-中;3-后 (传给车端的数据 0x01: 中心 0x02: 前端 0x03: 后端)
param
.
put
(
"containerPosition"
,
02
);
// 集装箱类型
}
else
{
//单小箱
// 集装箱车上位置, 1-前;2-中;3-后 (传给车端的数据 0x01: 中心 0x02: 前端 0x03: 后端)
param
.
put
(
"containerPosition"
,
03
);
param
.
put
(
"containerType"
,
"20"
);
// 集装箱类型
param
.
put
(
"containerSize"
,
"20"
);
}
param
.
put
(
"containerNuber"
,
1
);
// 集装箱个数
param
.
put
(
"portCode"
,
dto
.
getPortCode
());
// 港机编码 对应前台轮胎吊编号
param
.
put
(
"containerId"
,
dto
.
getContainerId
());
// 集装箱ID
param
.
put
(
"taskNo"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 任务编号
param
.
put
(
"parentTaskNo"
,
param
.
getString
(
"taskNo"
));
// temp= sendTos(dto.getVin(),param.toString());// 推送kafa
result
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
odbuUrl
,
URL
.
To_ODBU_URL
),
param
.
toString
(),
null
);
}
// if(temp==-1 || temp==-2 || temp==0) {
// return SSIResponse.no("推送失败");
// }else {
// return SSIResponse.ok();
// }
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
return
SSIResponse
.
ok
(
jsonObject
);
}
/**
* tos 指令下发
*/
@LogAudit
@ApiOperation
(
value
=
"去桥吊"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/goBridgeCrane"
)
public
SSIResponse
<?>
goBridgeCrane
(
@RequestBody
VmsTosOrdersDto
dto
)
{
JSONObject
param
=
new
JSONObject
();
Date
date
=
new
Date
();
param
.
put
(
"seq"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 序号
param
.
put
(
"taskAssociation"
,
""
);
// 任务关联
param
.
put
(
"vin"
,
dto
.
getVin
());
// 车辆编号 ,
param
.
put
(
"taskLocationType"
,
dto
.
getTaskLocationType
());
// 任务类型 作业位置类型
param
.
put
(
"taskSource"
,
2
);
// 1-TOS下发;2-手动下发;3-VMS下发 // 1-去堆场(装箱或卸箱);2-去停车点(上扭锁,解扭锁,停车);3-去固定停车区;4-去临时停车区;5-去桥吊(装箱或卸箱);6-去充电
param
.
put
(
"taskType"
,
dto
.
getTaskType
());
// 作业类型 1-装箱,2-卸箱
param
.
put
(
"cartonConditon"
,
"0"
);
// 辆当前装箱状态
param
.
put
(
"vehicleTaskType"
,
dto
.
getVehicleTaskType
());
// 车辆任务类型 对应着前台 集装箱类型
String
tempvehicleLocation
=
""
;
if
(
dto
.
getPortCode
().
length
()<
3
)
{
if
(
dto
.
getPortCode
().
length
()==
2
)
{
tempvehicleLocation
=
dto
.
getVehicleLocation
()+
"0"
+
dto
.
getPortCode
();
}
if
(
dto
.
getPortCode
().
length
()==
1
)
{
tempvehicleLocation
=
dto
.
getVehicleLocation
()+
"00"
+
dto
.
getPortCode
();
}
}
else
{
tempvehicleLocation
=
dto
.
getVehicleLocation
()+
dto
.
getPortCode
();
}
param
.
put
(
"vehicleLocation"
,
tempvehicleLocation
);
// 车辆任务目标地点 对应前台 桥吊编号
param
.
put
(
"portCode"
,
dto
.
getPortCode
());
// 港机编码 对应前台车吊编号
param
.
put
(
"portType"
,
1
);
// 港机类型
if
(
null
!=
dto
.
getContainerWeight
())
{
param
.
put
(
"containerWeight"
,
dto
.
getContainerWeight
());
// 集装箱重量
}
else
{
param
.
put
(
"containerWeight"
,
5
);
// 集装箱重量
}
param
.
put
(
"voyageNo"
,
dto
.
getVoyageNo
());
// 艘次编号 对应前台朝向 朝东16855朝西 16844
param
.
put
(
"collectTime"
,
date
);
// 作业时间
// param.put("voyuageNo","");//艘次编号
param
.
put
(
"lockLabel"
,
1
);
// 扭锁标签
if
(
null
!=
dto
.
getContainerLabel
())
{
param
.
put
(
"containerLabel"
,
dto
.
getContainerLabel
());
}
else
{
param
.
put
(
"containerLabel"
,
1
);
}
// if (dto.getTaskLocationType().equals(1)) {
// param.put("containerLabel", "1");
// } else {
// param.put("containerLabel", "2");
// }
// if (dto.getTaskType().equals(1)) {
//
param
.
put
(
"vehicleTaskLabel"
,
dto
.
getVehicleTaskLabel
());
// param.put("vehicleTaskLabel", 2);// 车辆任务标签
// }
// if (dto.getTaskType().equals(2)) {
// param.put("vehicleTaskLabel", 1);
// }
// int temp = 0;
String
result
=
""
;
// 双小箱
if
(
dto
.
getVehicleTaskType
()
==
2
)
{
param
.
put
(
"containerType"
,
"20"
);
// 集装箱类型
param
.
put
(
"containerNuber"
,
2
);
// 集装箱个数
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
param
.
put
(
"taskNo"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 任务编号
if
(
i
==
0
)
{
param
.
put
(
"containerId"
,
dto
.
getContainerId
());
// 前集装箱ID
param
.
put
(
"containerPosition"
,
01
);
// 集装箱位置
}
if
(
i
==
1
)
{
param
.
put
(
"containerId"
,
dto
.
getContainerIdT
());
// 后集装箱ID
param
.
put
(
"containerPosition"
,
03
);
// 集装箱位置
}
param
.
put
(
"containerSize"
,
"20"
);
// temp+=sendTos(dto.getVin(),param.toString());// 推送kafa
result
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
odbuUrl
,
URL
.
To_ODBU_URL
),
param
.
toString
(),
null
);
}
}
else
{
param
.
put
(
"taskNo"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 任务编号
if
(
dto
.
getVehicleTaskType
()==
1
)
{
// 1-大箱;2-双小箱;3-单小箱;0-其它
param
.
put
(
"containerType"
,
"40"
);
// 集装箱类型
param
.
put
(
"containerSize"
,
"40"
);
// 集装箱车上位置, 1-前;2-中;3-后 (传给车端的数据 0x01: 中心 0x02: 前端 0x03: 后端)
param
.
put
(
"containerPosition"
,
02
);
// 集装箱位置
}
else
{
// 集装箱车上位置, 1-前;2-中;3-后 (传给车端的数据 0x01: 中心 0x02: 前端 0x03: 后端)
param
.
put
(
"containerPosition"
,
02
);
// 集装箱位置
param
.
put
(
"containerType"
,
"20"
);
// 集装箱类型
param
.
put
(
"containerSize"
,
"20"
);
}
// param.put("containerId",dto.getContainerId());//集装箱ID
param
.
put
(
"containerNuber"
,
1
);
// 集装箱个数
// param.put("taskNo", UUID.randomUUID().toString().replace("-", ""));// 任务编号
// temp= sendTos(dto.getVin(),param.toString());// 推送kafa
System
.
out
.
print
(
param
.
toString
());
result
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
odbuUrl
,
URL
.
To_ODBU_URL
),
param
.
toString
(),
null
);
}
// if(temp==-1 || temp==-2 || temp==0) {
// return SSIResponse.no("推送失败");
// }else {
// return SSIResponse.ok();
// }
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
return
SSIResponse
.
ok
(
jsonObject
);
}
/**
* tos 指令下发, 去停车场,去缓存区,去充电,取消充电,取消当前任务
*/
@LogAudit
@ApiOperation
(
value
=
"去停车场,去充电,去临时停车区,取消"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/gospace"
)
public
SSIResponse
<?>
gospace
(
@RequestBody
VmsTosOrdersDto
dto
)
{
JSONArray
resultMsg
=
new
JSONArray
();
String
vin
=
dto
.
getVin
();
String
[]
vins
=
vin
.
split
(
","
);
List
<
Map
>
parkList
=
new
ArrayList
();
if
(
"6"
.
equals
(
dto
.
getTaskType
())
&&
vins
.
length
>
1
)
{
//如果是批量去停车区 需要查询空闲的停车区
parkList
=
getParkList
();
if
(
parkList
==
null
||
(
parkList
!=
null
&&
parkList
.
size
()<
vins
.
length
)){
return
SSIResponse
.
ok
(
parkErrorInfo
());
}
}
for
(
int
i
=
0
;
i
<
vins
.
length
;
i
++)
{
String
tmpVin
=
vins
[
i
];
JSONObject
param
=
new
JSONObject
();
// Date date =new Date();
String
temp
=
URL
.
To_ODBU_URL
;
param
.
put
(
"vin"
,
tmpVin
);
// 车辆编号
param
.
put
(
"taskSource"
,
2
);
// 1-TOS下发;2-手动下发;3-VMS下发
// param.put("taskLocationType",dto.getTaskLocationType());// 任务类型 作业位置类型 1-去堆场(装箱或卸箱);2-去停车点(上扭锁,解扭锁,停车);3-去固定停车区;4-去临时停车区;5-去桥吊(装箱或卸箱);6-去充电 7 取消充电 8 取消当前任务
param
.
put
(
"taskNo"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 任务编号
param
.
put
(
"seq"
,
param
.
getString
(
"taskNo"
));
// 序号
if
(
null
!=
dto
.
getTaskType
())
{
param
.
put
(
"taskType"
,
dto
.
getTaskType
());
// 任务编号 6 停车 3 充电
if
(
dto
.
getTaskType
().
equals
(
3
))
{
// 车辆任务标签,1:装船;2:卸船;3:堆场间搬移;4:停车,5:充电,6:临时停车
param
.
put
(
"vehicleTaskLabel"
,
5
);
//
}
if
(
dto
.
getTaskType
().
equals
(
6
))
{
// 车辆任务标签,1:装船;2:卸船;3:堆场间搬移;4:停车,5:充电,6:临时停车
param
.
put
(
"vehicleTaskLabel"
,
4
);
//
}
if
(
dto
.
getTaskType
().
equals
(
4
))
{
// 车辆任务标签,1:装船;2:卸船;3:堆场间搬移;4:停车,5:充电,6:临时停车
param
.
put
(
"vehicleTaskLabel"
,
6
);
//
}
}
if
(
null
!=
dto
.
getTaskLocationType
())
{
// "任务类型, 1-去堆场(装箱或卸箱);2-去停车点(上扭锁,解扭锁,停车);3-去固定停车区;4-去临时停车区;5-去桥吊(装箱或卸箱);6-去充电"
param
.
put
(
"taskLocationType"
,
dto
.
getTaskLocationType
());
//
// if(dto.getTaskLocationType().equals("4")) {
// temp=URL.To_ODBU_EDIT_POSITION;
// }
}
// if (null != dto.getStatus()) {
// // 49 停车锁死, 65 开始行驶
// param.put("status", dto.getStatus()); //
// if(dto.getStatus().equals("49")) {
// temp=URL.To_ODBU_EDIT_STATUS;
// }
// }
if
(
null
!=
dto
.
getVehicleLocation
())
{
// param.put("portCode", dto.getPortCode());// 停车场编号
param
.
put
(
"vehicleLocation"
,
dto
.
getVehicleLocation
());
// 车辆任务目标地点 对应前台 车道编号
}
if
(
null
!=
dto
.
getTaskOperation
())
{
param
.
put
(
"taskOperation"
,
dto
.
getTaskOperation
());
// 任务操作:0-开始,1-取消,2-强制取消
if
(
dto
.
getTaskOperation
().
equals
(
2
))
{
temp
=
URL
.
To_ODBU_Cancle
;
}
}
if
(
null
!=
dto
.
getParkingAreaNo
()&&
vins
.
length
==
1
)
{
//批量停车不支持指定停车区
param
.
put
(
"parkingAreaNo"
,
dto
.
getParkingAreaNo
());
// 停车区编号,缓冲区编号,充电位编号
}
if
(
vins
.
length
>
1
&&
dto
.
getTaskType
().
equals
(
6
)){
param
.
put
(
"parkingAreaNo"
,
parkList
.
get
(
i
).
get
(
"name"
));
// 停车区编号,缓冲区编号,充电位编号
}
if
(
null
!=
dto
.
getVoyageNo
())
{
param
.
put
(
"voyageNo"
,
dto
.
getVoyageNo
());
// 艘次编号 对应前台朝向 朝东16855朝西 16844
}
if
(
null
!=
dto
.
getLatitude
())
{
param
.
put
(
"latitude"
,
dto
.
getLatitude
());
// 目的地维度
}
if
(
null
!=
dto
.
getLongitude
())
{
param
.
put
(
"longitude"
,
dto
.
getLongitude
());
// 目的地经度
}
if
(
null
!=
dto
.
getPointList
())
{
if
(
dto
.
getPointList
().
size
()
>
1
)
{
param
.
put
(
"pointList"
,
dto
.
getPointList
());
// 目的地经度
}
}
param
.
put
(
"backHeading"
,
StringUtils
.
isNotBlank
(
dto
.
getBackHeading
())?
dto
.
getBackHeading
():
0
);
param
.
put
(
"forwardHeading"
,
StringUtils
.
isNotBlank
(
dto
.
getForwardHeading
())?
dto
.
getForwardHeading
():
0
);
String
result
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
odbuUrl
,
temp
),
param
.
toString
(),
null
);
// int temp= sendTos(dto.getVin(),param.toString());
// if(temp==-1) {
// return SSIResponse.no("推送失败");
// }else {
// return SSIResponse.ok();
// }
//
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
JSONObject
statusObj
=
jsonObject
.
getJSONObject
(
"status"
);
if
(
statusObj
.
getInteger
(
"code"
)
==
9999
){
resultMsg
.
add
(
tmpVin
+
statusObj
.
getString
(
"details"
));
}
}
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"data"
,
""
);
JSONObject
status
=
new
JSONObject
();
result
.
put
(
"status"
,
status
);
status
.
put
(
"msg"
,
"成功"
);
status
.
put
(
"code"
,
"0000"
);
if
(
resultMsg
.
size
()>
0
){
status
.
put
(
"msg"
,
"失败"
);
status
.
put
(
"code"
,
"9999"
);
status
.
put
(
"details"
,
resultMsg
.
toJSONString
());
}
return
SSIResponse
.
ok
(
result
);
}
private
List
<
Map
>
getParkList
(){
Map
param
=
new
HashedMap
();
param
.
put
(
"state"
,
0
);
// 状态。0可用;1不可用(初始状态);2已计划;3有车
param
.
put
(
"type"
,
2
);
// 类型。1缓冲区;2停车区;3:充电区
String
paramData
=
JSONObject
.
toJSONString
(
param
);
String
parkResult
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
mapEditUrl
,
URL
.
MAP_QUERY_URL
),
paramData
,
null
);
Map
map
=
JSONObject
.
parseObject
(
parkResult
,
Map
.
class
);
List
<
Map
>
parkList
=
JSONArray
.
parseArray
(
map
.
get
(
"data"
)+
""
,
Map
.
class
);
return
parkList
;
}
private
Map
parkErrorInfo
(){
Map
result
=
new
HashMap
();
JSONObject
status
=
new
JSONObject
();
result
.
put
(
"status"
,
status
);
status
.
put
(
"msg"
,
"可用停车区不足"
);
status
.
put
(
"code"
,
"9999"
);
status
.
put
(
"details"
,
""
);
return
result
;
}
@LogAudit
@ApiOperation
(
value
=
"强制上档"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/forceGoShipCraneLane"
)
public
SSIResponse
<?>
upshift
(
@RequestBody
VmsTosOrdersDto
dto
)
{
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"vin"
,
dto
.
getVin
());
// 车辆编号
String
result
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
gearUrl
,
URL
.
upshift_URL
),
param
.
toString
(),
null
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
return
SSIResponse
.
ok
(
jsonObject
);
}
@LogAudit
@ApiOperation
(
value
=
"更改车辆位置"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/updatePosition"
)
public
SSIResponse
<?>
updatePosition
(
@RequestBody
VmsTosOrdersDto
dto
)
{
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"vin"
,
dto
.
getVin
());
// 车辆编号
param
.
put
(
"seq"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 序号
param
.
put
(
"taskNo"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 任务编号
param
.
put
(
"taskSource"
,
2
);
// 1-TOS下发;2-手动下发;3-VMS下发
if
(
null
!=
dto
.
getTaskLocationType
())
{
// "任务类型, 1-去堆场(装箱或卸箱);2-去停车点(上扭锁,解扭锁,停车);3-去固定停车区;4-去临时停车区;5-去桥吊(装箱或卸箱);6-去充电"
param
.
put
(
"taskLocationType"
,
dto
.
getTaskLocationType
());
//
}
// if (null != dto.getStatus()) {
// // 49 停车锁死, 65 开始行驶
// param.put("status", dto.getStatus()); //
// if(dto.getStatus().equals("49")) {
// temp=URL.To_ODBU_EDIT_STATUS;
// }
// }
if
(
null
!=
dto
.
getVehicleLocation
())
{
// param.put("portCode", dto.getPortCode());// 停车场编号
param
.
put
(
"vehicleLocation"
,
dto
.
getVehicleLocation
());
// 车辆任务目标地点 对应前台 车道编号
}
String
result
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
odbuUrl
,
URL
.
To_ODBU_EDIT_POSITION
),
param
.
toString
(),
null
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
return
SSIResponse
.
ok
(
jsonObject
);
}
@LogAudit
@ApiOperation
(
value
=
"更改任务状态"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/updateStatus"
)
public
SSIResponse
<?>
updataStatus
(
@RequestBody
VmsTosOrdersDto
dto
)
{
JSONObject
param
=
new
JSONObject
();
param
.
put
(
"vin"
,
dto
.
getVin
());
// 车辆编号
param
.
put
(
"seq"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 序号
param
.
put
(
"taskNo"
,
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
// 任务编号
param
.
put
(
"taskSource"
,
2
);
// 1-TOS下发;2-手动下发;3-VMS下发
if
(
null
!=
dto
.
getTaskLocationType
())
{
// "任务类型, 1-去堆场(装箱或卸箱);2-去停车点(上扭锁,解扭锁,停车);3-去固定停车区;4-去临时停车区;5-去桥吊(装箱或卸箱);6-去充电"
param
.
put
(
"taskLocationType"
,
dto
.
getTaskLocationType
());
//
}
if
(
null
!=
dto
.
getStatus
())
{
// 49 停车锁死, 65 开始行驶
param
.
put
(
"status"
,
dto
.
getStatus
());
//
}
String
result
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
odbuUrl
,
URL
.
To_ODBU_EDIT_STATUS
),
param
.
toString
(),
null
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
return
SSIResponse
.
ok
(
jsonObject
);
}
// public int sendTos(String key,String param) {
// ListenableFuture<SendResult<String, String>> send=
// kafkaTemplate.send(topic,key,param);
// send.addCallback(result -> {
// tempResult=1;
// log.info(String.format("推送成功:%s", result));
// }, ex -> {
// if (ex != null) {
// log.error("推送失败!", ex);
// tempResult=-1;
// }
// });
// kafkaTemplate.flush();
// return tempResult;
// }
@LogAudit
@ApiOperation
(
value
=
"紧急停止"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/emergeStop"
)
public
SSIResponse
<?>
emergeStop
(
@RequestBody
JSONObject
req
)
{
Assert
.
notNull
(
req
.
getString
(
"vin"
),
"vin 不能为null"
);
Assert
.
notNull
(
req
.
getString
(
"emergencyType"
),
"emergencyType 不能为null"
);
String
result
=
RestTemplateUtil
.
post
(
String
.
format
(
"%s%s"
,
odbuUrl
,
URL
.
EMERGENCY_COMMAND
),
req
.
toString
(),
null
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
return
SSIResponse
.
ok
(
jsonObject
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/V2xEventController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.constant.enums.V2xEventTypeEnums
;
import
com.ssi.entity.V2xEvent
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.V2xEventService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 车路协调接口控制器
*/
@Api
(
tags
=
"车路协调接口控制器"
,
description
=
"车路协调接口控制器"
)
@RestController
@RequestMapping
(
"/v2xEvent"
)
public
class
V2xEventController
{
@Autowired
private
V2xEventService
v2xEventService
;
@LogAudit
@ApiOperation
(
value
=
"车路协同历史数据"
)
@GetMapping
(
"/select"
)
public
SSIResponse
select
()
{
List
<
V2xEvent
>
list
=
v2xEventService
.
selectHistory
();
list
=
list
.
stream
().
map
(
x
->{
x
.
setTypeName
(
V2xEventTypeEnums
.
find
(
x
.
getType
()).
getDescript
());
return
x
;}).
collect
(
Collectors
.
toList
());
return
SSIResponse
.
ok
(
list
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VehicleCommandController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.constant.URL
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.VehicleCommandService
;
import
com.ssi.utils.RestTemplateUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.Assert
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
import
java.util.Objects
;
/**
*
*
* @author yinjianggqiao
* @email
* @date 2022-07-04 15:38:37
*/
@Api
@RestController
@RequestMapping
(
"/vehicleCommand"
)
public
class
VehicleCommandController
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
VehicleCommandController
.
class
);
@Value
(
"${command-url}"
)
private
String
odbuUrl
;
@Autowired
private
VehicleCommandService
vehicleCommandService
;
@LogAudit
@ApiOperation
(
value
=
"无人集卡作业明细"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/vehicleTypeCommandList"
)
public
SSIResponse
vehicleTypeCommandList
(
String
queryStartTime
,
String
queryEndTime
,
String
truckNo
,
@RequestParam
Integer
pageIndex
,
@RequestParam
Integer
pageSize
)
{
try
{
return
SSIResponse
.
ok
(
vehicleCommandService
.
vehicleTypeCommandList
(
queryStartTime
,
queryEndTime
,
truckNo
,
pageIndex
,
pageSize
));
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
return
SSIResponse
.
no
(
"系统异常"
);
}
}
/**
* 导出
*/
@LogAudit
@ApiOperation
(
value
=
"导出列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/export"
)
public
void
export
(
@RequestBody
Map
<
String
,
Object
>
params
,
HttpServletResponse
response
)
{
String
queryStartTime
=
Objects
.
nonNull
(
params
.
get
(
"queryStartTime"
))?
String
.
valueOf
(
params
.
get
(
"queryStartTime"
)):
null
;
String
queryEndTime
=
Objects
.
nonNull
(
params
.
get
(
"queryEndTime"
))?
String
.
valueOf
(
params
.
get
(
"queryEndTime"
)):
null
;
String
truckNo
=
Objects
.
nonNull
(
params
.
get
(
"truckNo"
))?
String
.
valueOf
(
params
.
get
(
"truckNo"
)):
null
;
Integer
pageIndex
=
Objects
.
nonNull
(
params
.
get
(
"pageIndex"
))?
Integer
.
valueOf
(
params
.
get
(
"pageIndex"
)+
""
):
1
;
Integer
pageSize
=
Objects
.
nonNull
(
params
.
get
(
"pageSize"
))?
Integer
.
valueOf
(
params
.
get
(
"pageSize"
)+
""
):
1000
;
String
exportType
=
String
.
valueOf
(
params
.
get
(
"exportType"
));
vehicleCommandService
.
export
(
queryStartTime
,
queryEndTime
,
truckNo
,
pageIndex
,
pageSize
,
exportType
,
response
);
}
@LogAudit
@ApiOperation
(
value
=
"远程上下电触发"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/trigger"
)
public
SSIResponse
triggerEngine
(
@RequestBody
JSONObject
jsonObject
){
Assert
.
notNull
(
jsonObject
.
getString
(
"vin"
),
"车辆VIN不能为空"
);
Assert
.
notNull
(
jsonObject
.
getInteger
(
"status"
),
"状态不能为空"
);
String
resultStr
=
RestTemplateUtil
.
post
(
odbuUrl
.
concat
(
URL
.
To_ODBU_TRIGGER
),
jsonObject
.
toJSONString
(),
null
);
JSONObject
result
=
JSONObject
.
parseObject
(
resultStr
);
return
SSIResponse
.
ok
(
result
);
}
@ApiOperation
(
value
=
"车辆任务取消"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/cancelTask"
)
public
SSIResponse
cancelTask
(
@RequestBody
JSONObject
jsonObject
){
Assert
.
notNull
(
jsonObject
.
getString
(
"vin"
),
"车辆VIN不能为空"
);
String
resultStr
=
RestTemplateUtil
.
post
(
odbuUrl
.
concat
(
URL
.
To_ODBU_CANCEL_TASK
),
jsonObject
.
toJSONString
(),
null
);
JSONObject
result
=
JSONObject
.
parseObject
(
resultStr
);
return
SSIResponse
.
ok
(
result
);
}
@ApiOperation
(
value
=
"车辆任务恢复"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/recoverTask"
)
public
SSIResponse
recoverTask
(
@RequestBody
JSONObject
jsonObject
){
Assert
.
notNull
(
jsonObject
.
getString
(
"vin"
),
"车辆VIN不能为空"
);
String
resultStr
=
RestTemplateUtil
.
post
(
odbuUrl
.
concat
(
URL
.
To_ODBU_RECOVERY_TASK
),
jsonObject
.
toJSONString
(),
null
);
JSONObject
result
=
JSONObject
.
parseObject
(
resultStr
);
return
SSIResponse
.
ok
(
result
);
}
@ApiOperation
(
value
=
"车辆变道 4是左 5是右"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/changeRoad"
)
public
SSIResponse
changeRoad
(
@RequestBody
JSONObject
jsonObject
){
Assert
.
notNull
(
jsonObject
.
getString
(
"vin"
),
"车辆VIN不能为空"
);
Assert
.
notNull
(
jsonObject
.
getString
(
"taskOperation"
),
"车辆VIN不能为空"
);
String
resultStr
=
RestTemplateUtil
.
post
(
odbuUrl
.
concat
(
URL
.
To_ODBU_CHANGE_ROAD
),
jsonObject
.
toJSONString
(),
null
);
JSONObject
result
=
JSONObject
.
parseObject
(
resultStr
);
return
SSIResponse
.
ok
(
result
);
}
@ApiOperation
(
value
=
"车辆任务状态"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/changeTaskStatus"
)
public
SSIResponse
changeTaskStatus
(
@RequestBody
JSONObject
jsonObject
){
Assert
.
notNull
(
jsonObject
.
getString
(
"vin"
),
"车辆VIN不能为空"
);
Assert
.
notNull
(
jsonObject
.
getInteger
(
"type"
),
"状态类型不能为空"
);
Integer
type
=
jsonObject
.
getInteger
(
"type"
);
String
resultStr
;
if
(
type
==
1
){
resultStr
=
RestTemplateUtil
.
post
(
odbuUrl
.
concat
(
URL
.
To_ODBU_RECOVERY_TASK
),
jsonObject
.
toJSONString
(),
null
);
}
else
{
resultStr
=
RestTemplateUtil
.
post
(
odbuUrl
.
concat
(
URL
.
To_ODBU_CANCEL_TASK
),
jsonObject
.
toJSONString
(),
null
);
}
JSONObject
result
=
JSONObject
.
parseObject
(
resultStr
);
return
SSIResponse
.
ok
(
result
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VehicleTroubleAnalysisController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.OperationAnalysisService
;
import
com.ssi.service.VehicleTroubleService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Calendar
;
import
java.util.Map
;
/**
* 故障分析控制器
*/
@Api
(
tags
=
"故障分析控制器"
,
description
=
"运行分析"
)
@Slf4j
@RestController
@RequestMapping
(
"/faultAnalysis"
)
public
class
VehicleTroubleAnalysisController
{
@Autowired
private
VehicleTroubleService
vehicleTroubleService
;
/**
* 运输效率趋势图
*/
@LogAudit
@ApiOperation
(
value
=
"故障趋势图"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/getFaultTrend"
)
public
SSIResponse
getFaultTrend
(
@RequestBody
Map
<
String
,
Object
>
params
){
try
{
return
vehicleTroubleService
.
getFaultTrend
(
params
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 停车等待时长分析
*/
@LogAudit
@ApiOperation
(
value
=
"故障分布图"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/getFaultDistribution"
)
public
SSIResponse
getFaultDistribution
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
try
{
return
vehicleTroubleService
.
getFaultDistribution
(
params
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
*故障类型分布图
*/
@LogAudit
@ApiOperation
(
value
=
"故障类型分布图"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/getFaultTypeTrend"
)
public
SSIResponse
getFaultTypeTrend
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
try
{
return
vehicleTroubleService
.
getFaultTypeTrend
(
params
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 故障等级分布图
*/
@LogAudit
@ApiOperation
(
value
=
"故障等级分布图"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/getFaultLevelTrend"
)
public
SSIResponse
getFaultLevelTrend
(
@RequestBody
Map
<
String
,
Object
>
params
)
throws
Exception
{
try
{
return
vehicleTroubleService
.
getFaultLevelTrend
(
params
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VehicleTroubleHistoryController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
java.util.Arrays
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.VmsVehicleAlertHistory
;
import
com.ssi.response.SSIPage
;
import
com.ssi.response.SSIResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
com.ssi.service.VehicleTroubleService
;
/**
* 车辆故障控制器
* @author zhang liyao
* @email
* @date 2020-07-17 09:47:00
*/
@Api
@Slf4j
@RestController
@RequestMapping
(
"/vehicletroublehistory"
)
public
class
VehicleTroubleHistoryController
{
@Autowired
private
VehicleTroubleService
vehicleTroubleService
;
/**
* 故障列表分页
*/
@LogAudit
@ApiOperation
(
value
=
"获得列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
SSIPage
page
=
vehicleTroubleService
.
queryPage
(
params
);
return
SSIResponse
.
ok
(
page
);
}
/**
* 故障列表分页导出
*/
@LogAudit
@ApiOperation
(
value
=
"导出列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/export"
)
public
void
export
(
@RequestBody
Map
<
String
,
Object
>
params
,
HttpServletResponse
response
)
{
vehicleTroubleService
.
export
(
params
,
response
);
}
/**
* 故障详细信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
String
id
)
{
try
{
VmsVehicleAlertHistory
vehicleTroubleHistory
=
vehicleTroubleService
.
getById
(
id
);
return
SSIResponse
.
ok
(
vehicleTroubleHistory
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 保存
*/
@LogAudit
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
save
(
@RequestBody
VmsVehicleAlertHistory
vehicleTroubleHistory
)
{
try
{
vehicleTroubleService
.
save
(
vehicleTroubleHistory
);
return
SSIResponse
.
ok
();
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 修改
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
VmsVehicleAlertHistory
vehicleTroubleHistory
)
{
try
{
vehicleTroubleService
.
saveOrUpdate
(
vehicleTroubleHistory
);
return
SSIResponse
.
ok
();
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 删除
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
)
{
try
{
vehicleTroubleService
.
removeByIds
(
Arrays
.
asList
(
ids
.
split
(
","
)));
return
SSIResponse
.
ok
();
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsAlertThresholdController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.VmsAlertThresholdNew
;
import
com.ssi.model.RedisDataModel
;
import
com.ssi.response.SSIPage
;
import
com.ssi.response.SSIResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.kafka.core.KafkaTemplate
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
com.ssi.entity.VmsAlertThreshold
;
import
com.ssi.service.VmsAlertThresholdService
;
import
java.util.Map
;
/**
* 报警阈值控制器
*
* @author zhang liyao
* @email
* @date 2020-07-16 09:32:59
*/
@Api
@RestController
@RequestMapping
(
"/alertThreshold"
)
@Slf4j
public
class
VmsAlertThresholdController
{
@Autowired
private
VmsAlertThresholdService
vmsAlertThresholdService
;
@Autowired
private
RedisDataModel
redisDataModel
;
// /**
// * 报警阀值信息
// */
// @ApiOperation(value = "获得单条详细信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
// @GetMapping("/info")
// public SSIResponse info() {
// VmsAlertThreshold current = vmsAlertThresholdService.getOne(new LambdaQueryWrapper<>());
// return SSIResponse.ok(current);
// }
// /**
// * 保存
// */
// @PostMapping("/add")
// @ApiOperation(value = "保存信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
// public SSIResponse save(@RequestBody VmsAlertThreshold vmsAlertThreshold) {
// if (vmsAlertThreshold.getId() == null) {
// VmsAlertThreshold current = vmsAlertThresholdService.getOne(new LambdaQueryWrapper<>());
// if (current != null) {
// vmsAlertThreshold.setId(current.getId());
// }
// }
// vmsAlertThresholdService.saveOrUpdate(vmsAlertThreshold);
// //保存到redis
// redisDataModel.set("ivccs:vms:threshold",JSONObject.toJSONString(vmsAlertThreshold));
//
// return SSIResponse.ok();
// }
/**
* 报警阀值信息列表
*/
@LogAudit
@ApiOperation
(
value
=
"获得信息列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
SSIPage
page
=
vmsAlertThresholdService
.
queryPage
(
params
);
return
SSIResponse
.
ok
(
page
);
}
/**
* 报警阀值信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
String
id
)
{
try
{
VmsAlertThreshold
current
=
vmsAlertThresholdService
.
getById
(
id
);
return
SSIResponse
.
ok
(
current
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 保存
*/
@LogAudit
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
save
(
@RequestBody
VmsAlertThreshold
vmsAlertThresholdNew
)
{
VmsAlertThreshold
info
=
new
VmsAlertThreshold
();
info
.
setParamKey
(
vmsAlertThresholdNew
.
getParamKey
());
VmsAlertThreshold
vmsAlertThresholdNew1
=
vmsAlertThresholdService
.
getOne
(
new
LambdaQueryWrapper
<>(
info
));
if
(
vmsAlertThresholdNew1
!=
null
){
return
SSIResponse
.
no
(
"key已存在,请重新设置"
);
}
vmsAlertThresholdService
.
save
(
vmsAlertThresholdNew
);
//保存到redis
//redisDataModel.set("ivccs:vms:thresholdNew", JSONObject.toJSONString(vmsAlertThresholdNew));
return
SSIResponse
.
ok
();
}
/**
* 修改
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
VmsAlertThreshold
vmsAlertThresholdNew
)
{
try
{
vmsAlertThresholdService
.
saveOrUpdate
(
vmsAlertThresholdNew
);
//保存到redis
// redisDataModel.get("ivccs:vms:thresholdNew");
return
SSIResponse
.
ok
();
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 删除
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
)
{
try
{
VmsAlertThreshold
vmsAlertThresholdNew
=
new
VmsAlertThreshold
();
vmsAlertThresholdNew
.
setId
(
Integer
.
parseInt
(
ids
));
vmsAlertThresholdNew
.
setIsDel
(
0
);
vmsAlertThresholdService
.
saveOrUpdate
(
vmsAlertThresholdNew
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 修改无人集卡状态
*/
@LogAudit
@ApiOperation
(
value
=
"修改无人集卡状态"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/vehicleTypeSwitchUpdate"
)
public
SSIResponse
vehicleTypeSwitchUpdate
()
{
try
{
VmsAlertThreshold
info
=
new
VmsAlertThreshold
();
info
.
setParamKey
(
"vehicle_type_switch"
);
VmsAlertThreshold
current
=
vmsAlertThresholdService
.
getOne
(
new
LambdaQueryWrapper
<>(
info
));
if
(
current
.
getParamValue
().
equals
(
"1"
)){
current
.
setParamValue
(
"0"
);
}
else
{
current
.
setParamValue
(
"1"
);
}
vmsAlertThresholdService
.
saveOrUpdate
(
current
);
redisDataModel
.
set
(
"ivccs:vms:vehicle_type_switch"
,
JSONObject
.
toJSONString
(
current
));
return
SSIResponse
.
ok
(
current
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 无人集卡状态详情
*/
@LogAudit
@ApiOperation
(
value
=
"无人集卡状态详情"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/vehicleTypeSwitchInfo"
)
public
SSIResponse
vehicleTypeSwitchInfo
()
{
try
{
VmsAlertThreshold
info
=
new
VmsAlertThreshold
();
info
.
setParamKey
(
"vehicle_type_switch"
);
VmsAlertThreshold
current
=
vmsAlertThresholdService
.
getOne
(
new
LambdaQueryWrapper
<>(
info
));
return
SSIResponse
.
ok
(
current
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsAlertThresholdNewController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.VmsAlertThreshold
;
import
com.ssi.entity.VmsAlertThresholdNew
;
import
com.ssi.entity.VmsVehicleAlertHistory
;
import
com.ssi.model.RedisDataModel
;
import
com.ssi.response.SSIPage
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.VmsAlertThresholdNewService
;
import
com.ssi.service.VmsAlertThresholdService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.velocity.runtime.directive.MacroParseException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Arrays
;
import
java.util.Map
;
/**
* 系统配置报警阈值控制器
*
* @author zhou ms
* @email
* @date 2022-03-25
*/
@Api
@RestController
@RequestMapping
(
"/alertThresholdNew"
)
@Slf4j
public
class
VmsAlertThresholdNewController
{
@Autowired
private
VmsAlertThresholdService
vmsAlertThresholdService
;
@Autowired
private
RedisDataModel
redisDataModel
;
/**
* 报警阀值信息列表
*/
@LogAudit
@ApiOperation
(
value
=
"获得信息列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
SSIPage
page
=
vmsAlertThresholdService
.
queryPage
(
params
);
return
SSIResponse
.
ok
(
page
);
}
/**
* 报警阀值信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
String
id
)
{
try
{
VmsAlertThreshold
current
=
vmsAlertThresholdService
.
getById
(
id
);
return
SSIResponse
.
ok
(
current
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 保存
*/
@LogAudit
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
save
(
@RequestBody
VmsAlertThreshold
vmsAlertThresholdNew
)
{
VmsAlertThreshold
info
=
new
VmsAlertThreshold
();
info
.
setParamKey
(
vmsAlertThresholdNew
.
getParamKey
());
info
.
setIsDel
(
1
);
VmsAlertThreshold
vmsAlertThresholdNew1
=
vmsAlertThresholdService
.
getOne
(
new
LambdaQueryWrapper
<>(
info
));
if
(
vmsAlertThresholdNew1
!=
null
){
return
SSIResponse
.
no
(
"key已存在,请重新设置"
);
}
vmsAlertThresholdService
.
save
(
vmsAlertThresholdNew
);
//保存到redis
//redisDataModel.set("ivccs:vms:thresholdNew", JSONObject.toJSONString(vmsAlertThresholdNew));
return
SSIResponse
.
ok
();
}
/**
* 修改
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
VmsAlertThreshold
vmsAlertThresholdNew
)
{
try
{
vmsAlertThresholdService
.
saveOrUpdate
(
vmsAlertThresholdNew
);
//保存到redis
// redisDataModel.get("ivccs:vms:thresholdNew");
return
SSIResponse
.
ok
();
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
/**
* 删除
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
)
{
try
{
VmsAlertThreshold
vmsAlertThresholdNew
=
new
VmsAlertThreshold
();
vmsAlertThresholdNew
.
setId
(
Integer
.
parseInt
(
ids
));
vmsAlertThresholdNew
.
setIsDel
(
0
);
vmsAlertThresholdService
.
saveOrUpdate
(
vmsAlertThresholdNew
);
return
SSIResponse
.
ok
();
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsAreaPositionController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.VmsAreaPosition
;
import
com.ssi.entity.VmsPositionInfo
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.VmsAreaPositionService
;
import
com.ssi.service.VmsPositionInfoService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
javax.validation.Valid
;
/**
* 龙锁装卸区控制器
*
* @author zhang liyao
* @email
* @date 2020-07-16 09:32:59
*/
@Api
@RestController
@RequestMapping
(
"/areaPosition"
)
public
class
VmsAreaPositionController
{
@Autowired
private
VmsAreaPositionService
vmsAreaPositionService
;
@Autowired
private
VmsPositionInfoService
vmsPositionInfoService
;
/**
* 龙锁装卸区分页列表
*/
@LogAudit
@ApiOperation
(
value
=
"获得列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
Integer
areaType
=
(
Integer
)
params
.
get
(
"areaType"
);
String
areaNum
=
(
String
)
params
.
get
(
"areaNum"
);
List
<
VmsAreaPosition
>
list
=
vmsAreaPositionService
.
list
(
new
LambdaQueryWrapper
<
VmsAreaPosition
>()
.
eq
(
areaType
!=
null
,
VmsAreaPosition:
:
getAreaType
,
areaType
)
.
like
(
StringUtils
.
isNotBlank
(
areaNum
),
VmsAreaPosition:
:
getAreaNum
,
areaNum
)
);
return
SSIResponse
.
ok
(
list
);
}
/**
* 龙锁装卸区详细信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
Integer
id
)
{
VmsAreaPosition
vmsAreaPosition
=
vmsAreaPositionService
.
getById
(
id
);
return
SSIResponse
.
ok
(
vmsAreaPosition
);
}
/**
* 添加龙锁装卸区
*/
@LogAudit
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
save
(
@RequestBody
@Valid
VmsAreaPosition
vmsAreaPosition
)
{
String
areaNum
=
vmsAreaPosition
.
getAreaNum
();
Integer
count
=
vmsAreaPositionService
.
lambdaQuery
().
eq
(
VmsAreaPosition:
:
getAreaNum
,
areaNum
).
count
();
if
(
count
>
0
){
return
SSIResponse
.
no
(
"编号已经存在"
);
}
vmsAreaPositionService
.
save
(
vmsAreaPosition
);
return
SSIResponse
.
ok
();
}
/**
* 修改龙锁装卸区
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
@Valid
VmsAreaPosition
vmsAreaPosition
)
{
String
areaNum
=
vmsAreaPosition
.
getAreaNum
();
Integer
id
=
vmsAreaPosition
.
getId
();
Integer
count
=
vmsAreaPositionService
.
lambdaQuery
().
eq
(
VmsAreaPosition:
:
getAreaNum
,
areaNum
).
ne
(
VmsAreaPosition:
:
getId
,
id
).
count
();
if
(
count
>
0
){
return
SSIResponse
.
no
(
"编号已经存在"
);
}
vmsAreaPositionService
.
saveOrUpdate
(
vmsAreaPosition
);
return
SSIResponse
.
ok
();
}
/**
* 删除龙锁装卸区
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
)
{
vmsAreaPositionService
.
removeByIds
(
Arrays
.
asList
(
ids
.
split
(
","
)));
return
SSIResponse
.
ok
();
}
/**
* 编号校验
*/
@LogAudit
@GetMapping
(
"/checkRepeat"
)
@ApiOperation
(
value
=
"编号校验"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
checkRepeat
(
@RequestParam
String
areaNum
,
Integer
areaType
)
{
int
count
=
vmsAreaPositionService
.
count
(
new
LambdaQueryWrapper
<
VmsAreaPosition
>()
.
eq
(
StringUtils
.
isNotBlank
(
areaNum
),
VmsAreaPosition:
:
getAreaNum
,
areaNum
)
.
eq
(
areaType
!=
null
,
VmsAreaPosition:
:
getAreaType
,
areaType
));
if
(
count
>
0
){
return
SSIResponse
.
no
(
"编号重复!"
);
}
return
SSIResponse
.
ok
();
}
/**
* 堆场贝位列表
*/
@LogAudit
@GetMapping
(
"/yardBayList"
)
@ApiOperation
(
value
=
"堆场贝位列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
yardBayList
(
@RequestParam
(
required
=
false
,
name
=
"yardNum"
)
String
yardNum
,
@RequestParam
(
required
=
false
,
name
=
"size"
)
String
size
)
{
List
<
VmsPositionInfo
>
list
=
vmsPositionInfoService
.
lambdaQuery
()
.
eq
(
StringUtils
.
isNotBlank
(
yardNum
),
VmsPositionInfo:
:
getYardNum
,
yardNum
)
.
and
(
i
->
i
.
like
(
VmsPositionInfo:
:
getYardNum
,
"F%"
).
or
().
like
(
VmsPositionInfo:
:
getYardNum
,
"E%"
))
.
list
();
List
<
VmsPositionInfo
>
distincts
=
list
.
stream
().
filter
(
e
->{
if
(
StringUtils
.
isBlank
(
size
)){
return
true
;}
else
if
(
"1"
.
equalsIgnoreCase
(
size
)){
return
Integer
.
parseInt
(
e
.
getBayNum
())%
2
==
0
;}
else
{
return
Integer
.
parseInt
(
e
.
getBayNum
())%
2
==
1
;}}).
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
o
->
o
.
getYardNum
()
+
";"
+
o
.
getBayNum
()))),
ArrayList:
:
new
));
Map
<
String
,
List
<
VmsPositionInfo
>>
collect
=
distincts
.
stream
().
sorted
(
Comparator
.
comparing
(
a
->
Integer
.
valueOf
(
a
.
getBayNum
()))).
collect
(
Collectors
.
groupingBy
(
VmsPositionInfo:
:
getYardNum
));
return
SSIResponse
.
ok
(
collect
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsCarControlCommandController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.VmsCarControlCommand
;
import
com.ssi.entity.dto.CarControlCommandParam
;
import
com.ssi.entity.vo.CarControlCommandVo
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.VehicleEmergencyService
;
import
com.ssi.service.VmsCarControlCommandService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 远程控车指令控制器
*
* @author liheng
* @email
* @date 2020-07-24 10:14:56
*/
@Api
(
tags
=
"远程指令清单控制器"
,
description
=
"远程指令清单"
)
@RestController
@RequestMapping
(
"/carControlCommand"
)
public
class
VmsCarControlCommandController
{
@Autowired
private
VmsCarControlCommandService
carControlCommandService
;
@Autowired
private
VehicleEmergencyService
vehicleEmergencyService
;
/**
* 控车指令
*/
@LogAudit
@ApiOperation
(
value
=
"控车指令"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/executeCommand"
)
public
SSIResponse
executeCommand
(
@RequestBody
@Validated
CarControlCommandParam
param
){
return
carControlCommandService
.
executeCommand
(
param
);
}
/**
* 控车指令分页列表
*/
@LogAudit
@ApiOperation
(
value
=
"获得列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
CarControlCommandVo
carControlCommandVo
){
return
SSIResponse
.
ok
(
carControlCommandService
.
queryPage
(
carControlCommandVo
));
}
/**
* 信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
Integer
id
){
VmsCarControlCommand
carControlCommand
=
carControlCommandService
.
getById
(
id
);
return
SSIResponse
.
ok
(
carControlCommand
);
}
/**
* 导出控车指令历史
*/
@LogAudit
@ApiOperation
(
value
=
"导出列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/export"
)
public
void
export
(
@RequestBody
CarControlCommandVo
carControlCommandVo
,
HttpServletResponse
response
)
{
carControlCommandService
.
export
(
carControlCommandVo
,
response
);
}
/**
* 步进接口
* @param vin 车辆vin
* @param direction 方向 1-前进 ;2-后退
* @param distance 行驶距离(单位:CM)
*/
@LogAudit
@ApiOperation
(
value
=
"步进接口"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/stepping"
)
public
SSIResponse
stepping
(
@RequestParam
String
vin
,
@RequestParam
Integer
direction
,
@RequestParam
Integer
distance
){
return
carControlCommandService
.
stepping
(
vin
,
direction
,
distance
);
}
/**
* 紧急停车
*/
@LogAudit
@ApiOperation
(
value
=
"紧急停车"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/emergency"
)
public
SSIResponse
emergency
(
@RequestParam
String
vin
,
@RequestParam
Integer
emergencyType
){
return
vehicleEmergencyService
.
emergency
(
vin
,
emergencyType
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsChargingPileController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
java.util.Arrays
;
import
java.util.Map
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.VmsChargingConnectorInfo
;
import
com.ssi.response.SSIPage
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.VmsChargingConnectorInfoService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
com.ssi.entity.VmsChargingPile
;
import
com.ssi.service.VmsChargingPileService
;
/**
* 充电桩控制器
*
* @author zhang liyao
* @email
* @date 2020-07-09 09:21:59
*/
@Api
@RestController
@RequestMapping
(
"/chargingPile"
)
public
class
VmsChargingPileController
{
@Autowired
private
VmsChargingPileService
vmsChargingPileService
;
@Autowired
private
VmsChargingConnectorInfoService
chargingConnectorInfoService
;
/**
* 分页列表
*/
@LogAudit
@ApiOperation
(
value
=
"获得列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
SSIPage
page
=
chargingConnectorInfoService
.
queryPage
(
params
);
return
SSIResponse
.
ok
(
page
);
}
/**
* 信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
Integer
id
)
{
VmsChargingConnectorInfo
vmsChargingPile
=
chargingConnectorInfoService
.
getById
(
id
);
return
SSIResponse
.
ok
(
vmsChargingPile
);
}
/**
* 保存
*/
@LogAudit
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
save
(
@RequestBody
VmsChargingConnectorInfo
vmsChargingPile
)
{
chargingConnectorInfoService
.
save
(
vmsChargingPile
);
return
SSIResponse
.
ok
();
}
/**
* 修改
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
VmsChargingConnectorInfo
vmsChargingPile
)
{
chargingConnectorInfoService
.
saveOrUpdate
(
vmsChargingPile
);
return
SSIResponse
.
ok
();
}
/**
* 删除
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
)
{
chargingConnectorInfoService
.
removeByIds
(
Arrays
.
asList
(
ids
.
split
(
","
)));
return
SSIResponse
.
ok
();
}
/**
* 删除
*/
@LogAudit
@GetMapping
(
"/checkIdentity"
)
@ApiOperation
(
value
=
"校验唯一"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
checkIdentity
(
@RequestParam
(
name
=
"pileNum"
)
String
pileNum
,
@RequestParam
(
name
=
"gunNum"
,
required
=
false
)
String
gunNum
)
{
Integer
count
=
chargingConnectorInfoService
.
lambdaQuery
().
eq
(
StringUtils
.
isNotBlank
(
pileNum
),
VmsChargingConnectorInfo:
:
getEquipmentId
,
pileNum
)
.
eq
(
StringUtils
.
isNotBlank
(
gunNum
),
VmsChargingConnectorInfo:
:
getConnectorId
,
gunNum
).
count
();
if
(
count
>
0
){
if
(
StringUtils
.
isNotBlank
(
gunNum
)){
return
SSIResponse
.
no
(
"充电枪编号已存在"
);
}
return
SSIResponse
.
no
(
"充电桩编号已存在"
);
}
return
SSIResponse
.
ok
();
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsCheckServiceController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ssi.constant.RedisKey
;
import
com.ssi.model.RedisDataModel
;
import
com.ssi.model.VehicleSocketDataCacheQueueModel
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.utils.RestTemplateUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"检查服务"
,
description
=
"命令"
)
@RestController
@Slf4j
@RequestMapping
(
"/CheckService"
)
public
class
VmsCheckServiceController
{
@Value
(
"${BridgeCrane-url}"
)
private
String
bcUrl
;
// 桥吊 url
@Value
(
"${Shift-url}"
)
private
String
shiftUrl
;
// 上档url
@Value
(
"${tos-url}"
)
private
String
tosUrl
;
// 上档url
@Value
(
"${PathPlanning-url}"
)
private
String
PathPlanningUrl
;
// 路径规划url
@Value
(
"${command-url}"
)
// 车辆服务url
private
String
vehicleUrl
;
@Autowired
private
RedisDataModel
redisDataModel
;
@Value
(
"${harbor.command.info_key:harbor:command:vin:info}"
)
private
String
infoKey
;
@Autowired
(
required
=
false
)
private
VehicleSocketDataCacheQueueModel
vehicleSocketDataCacheQueueModel
;
@Value
(
"${vehicle.status.redis.keyPrefix:harbor:vehicle:online}"
)
private
String
statusRedisKeyPrefix
;
@ApiOperation
(
value
=
"检查服务"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/CheckAllService"
)
public
SSIResponse
<?>
CheckService
()
{
JSONObject
result
=
new
JSONObject
();
Map
<
String
,
String
>
tempCheckShiftUrl
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
tempCheckPathPlanning
=
new
HashMap
<
String
,
String
>();
// String tempCheckPathPlanning = "";
List
<
Map
>
checkBridgeCraneStr
=
new
ArrayList
<
Map
>();
Set
<
String
>
portcodekes
=
redisDataModel
.
keys
(
RedisKey
.
CRANE_INFO
.
getKeyPrefix
()
+
"*"
);
portcodekes
.
stream
().
forEach
(
key
->
{
// System.out.println(key);
String
str1
=
redisDataModel
.
get
(
key
);
if
(
null
!=
str1
)
{
JSONObject
strJson
=
JSONObject
.
parseObject
(
str1
);
if
(
null
!=
strJson
.
get
(
"portType"
))
{
if
(
Integer
.
parseInt
(
strJson
.
get
(
"portType"
).
toString
())
==
1
)
{
String
tempResult
=
CheckBridgeCrane
(
strJson
.
get
(
"portCode"
).
toString
());
Map
<
String
,
String
>
temp
=
new
HashMap
<
String
,
String
>();
if
(
null
!=
tempResult
)
{
if
(
tempResult
.
equals
(
"服务异常,未开启"
))
{
// tempCheckBridgeCrane1 = "101桥吊服务运行异常,未开启";
temp
.
put
(
"depict"
,
strJson
.
get
(
"portCode"
).
toString
()
+
"桥吊服务运行异常,未开启"
);
temp
.
put
(
"status"
,
"1"
);
temp
.
put
(
"portCode"
,
strJson
.
get
(
"portCode"
).
toString
());
checkBridgeCraneStr
.
add
(
temp
);
}
else
{
JSONObject
CheckBridgeCrane
=
JSONObject
.
parseObject
(
tempResult
);
if
(
null
!=
CheckBridgeCrane
.
get
(
"latitude"
)
&&
null
!=
CheckBridgeCrane
.
get
(
"longitude"
))
{
// tempCheckBridgeCrane1 = "101桥吊服务运行正常";
temp
.
put
(
"depict"
,
strJson
.
get
(
"portCode"
).
toString
()
+
"桥吊服务运行正常"
);
temp
.
put
(
"status"
,
"0"
);
temp
.
put
(
"portCode"
,
strJson
.
get
(
"portCode"
).
toString
());
checkBridgeCraneStr
.
add
(
temp
);
}
else
{
temp
.
put
(
"depict"
,
strJson
.
get
(
"portCode"
).
toString
()
+
"桥吊服务运行异常"
);
temp
.
put
(
"status"
,
"1"
);
temp
.
put
(
"portCode"
,
strJson
.
get
(
"portCode"
).
toString
());
checkBridgeCraneStr
.
add
(
temp
);
// tempCheckBridgeCrane1 = "101桥吊服务运行异常";
}
}
}
else
{
temp
.
put
(
"depict"
,
strJson
.
get
(
"portCode"
).
toString
()
+
"桥吊服务运行异常,未开启"
);
temp
.
put
(
"status"
,
"1"
);
temp
.
put
(
"portCode"
,
strJson
.
get
(
"portCode"
).
toString
());
checkBridgeCraneStr
.
add
(
temp
);
// checkBridgeCraneStr.add(strJson.get("portCode").toString() + "桥吊服务运行异常,未开启");
// tempCheckBridgeCrane1 = "101桥吊服务运行异常";
}
}
}
}
});
// 检查上档服务
/* String tempResult2 = CheckShiftUrl();
if (null != tempResult2) {
if (tempResult2.equals("服务异常,未开启")) {
tempCheckShiftUrl.put("depict", "上档服务运行异常,未开启");
tempCheckShiftUrl.put("status", "1");
} else {
tempCheckShiftUrl.put("depict", "上档服务运行正常");
tempCheckShiftUrl.put("status", "0");
}
} else {
tempCheckShiftUrl.put("depict", "上档服务运行异常");
tempCheckShiftUrl.put("status", "1");
}*/
// 检查路径规划服务
String
tempResult3
=
CheckPathPlanning
();
if
(
null
!=
tempResult3
)
{
if
(
tempResult3
.
equals
(
"服务异常,未开启"
))
{
tempCheckPathPlanning
.
put
(
"depict"
,
"路径规划服务运行异常,未开启"
);
tempCheckPathPlanning
.
put
(
"status"
,
"1"
);
}
else
{
JSONObject
CheckPath
=
JSONObject
.
parseObject
(
tempResult3
);
if
(
CheckPath
.
get
(
"code"
).
equals
(
1
))
{
tempCheckPathPlanning
.
put
(
"depict"
,
"路径规划服务运行正常"
);
tempCheckPathPlanning
.
put
(
"status"
,
"0"
);
// tempCheckPathPlanning = "路径规划服务运行正常";
}
else
{
tempCheckPathPlanning
.
put
(
"depict"
,
"路径规划服务运行异常"
);
tempCheckPathPlanning
.
put
(
"status"
,
"1"
);
}
}
}
else
{
tempCheckPathPlanning
.
put
(
"depict"
,
"路径规划服务运行异常"
);
tempCheckPathPlanning
.
put
(
"status"
,
"1"
);
// tempCheckPathPlanning = "路径规划服务运行异常";
}
// 检查车管平台服务
List
<
Map
>
vehiclelist
=
CheckVehicle
();
//检查TOS服务
JSONObject
tosService
=
checkTosService
();
result
.
put
(
"CheckBridgeCrane"
,
checkBridgeCraneStr
);
result
.
put
(
"CheckShiftUrl"
,
tosService
);
result
.
put
(
"CheckPathPlanning"
,
tempCheckPathPlanning
);
result
.
put
(
"CheckVehicle"
,
vehiclelist
);
// result.put("CheckTosService", tosService);
return
SSIResponse
.
ok
(
result
);
}
private
JSONObject
checkTosService
()
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"status"
,
"1"
);
jsonObject
.
put
(
"depict"
,
"TOS服务异常"
);
try
{
String
depict
=
RestTemplateUtil
.
getInstance
().
getForObject
(
tosUrl
,
String
.
class
);
jsonObject
.
put
(
"status"
,
"0"
);
jsonObject
.
put
(
"depict"
,
depict
);
}
catch
(
Exception
e
)
{
log
.
info
(
"TOS服务异常"
,
e
);
}
return
jsonObject
;
}
/**
* 检查桥吊服务
*
* @param number
* @return
*/
public
String
CheckBridgeCrane
(
String
number
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"craneNum"
,
number
);
jsonObject
.
put
(
"laneNum"
,
4
);
jsonObject
.
put
(
"containerSize"
,
1
);
jsonObject
.
put
(
"containerPosition"
,
2
);
String
result
=
""
;
try
{
result
=
RestTemplateUtil
.
post
(
bcUrl
,
jsonObject
.
toString
(),
null
);
}
catch
(
Exception
e
)
{
result
=
"服务异常,未开启"
;
}
return
result
;
}
/**
* 检查上档服务
*
* @return
*/
public
String
CheckShiftUrl
()
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"cntr_id"
,
"BMOU2866464"
);
String
result
=
""
;
try
{
result
=
RestTemplateUtil
.
post
(
shiftUrl
,
jsonObject
.
toString
(),
null
);
}
catch
(
Exception
e
)
{
result
=
"服务异常,未开启"
;
}
return
result
;
}
/**
* 检查路径规划服务
*
* @return
*/
public
String
CheckPathPlanning
()
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"sourceLat"
,
24.45724154
);
jsonObject
.
put
(
"vehicleTaskLabel"
,
"3"
);
jsonObject
.
put
(
"isBeforehand"
,
false
);
jsonObject
.
put
(
"targetLng"
,
117.96814939
);
jsonObject
.
put
(
"berthWay"
,
0
);
jsonObject
.
put
(
"targetType"
,
1
);
jsonObject
.
put
(
"vin"
,
"LGAS4P659LD000050"
);
jsonObject
.
put
(
"targetLat"
,
24.45795811
);
jsonObject
.
put
(
"sourceLng"
,
117.96904188
);
jsonObject
.
put
(
"voyageNo"
,
"16844"
);
String
result
=
""
;
try
{
result
=
RestTemplateUtil
.
post
(
PathPlanningUrl
,
jsonObject
.
toString
(),
null
);
}
catch
(
Exception
e
)
{
result
=
"服务异常,未开启"
;
}
return
result
;
}
/**
* 检查车管平台服务
*
* @return
*/
public
List
<
Map
>
CheckVehicle
()
{
// JSONObject jsonObject = new JSONObject();
// String tempResult = "";
// String result="";
List
<
Map
>
resultlist
=
new
ArrayList
<
Map
>();
Map
<
String
,
Map
<
String
,
Object
>>
messages
=
vehicleSocketDataCacheQueueModel
.
getAllVehicleData
();
if
(!
messages
.
isEmpty
())
{
// 大屏列表推送
// log.info(String.format("进入无人集卡判断: %s", JSON.toJSONString(messages)));
for
(
Map
.
Entry
<
String
,
Map
<
String
,
Object
>>
entry
:
messages
.
entrySet
())
{
// String key="harbor:command:vin:info";
String
keys
=
String
.
format
(
"%s:%s"
,
infoKey
,
entry
.
getKey
());
String
vehicleMap
=
redisDataModel
.
get
(
keys
);
if
(
vehicleMap
!=
null
)
{
// 判断redis是否存在,不存在则查询数据库
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
vehicleMap
);
Integer
vehicleType
=
(
Integer
)
jsonObject
.
get
(
"vehicleType"
);
// 1:X69B ,2:X69C,3:有人集卡两秒
if
(
vehicleType
!=
3
)
{
Map
tempmap
=
new
HashMap
();
// JSONObject json = JSONObject.parseObject(entry.getValue().toString());
tempmap
.
put
(
"vehicleNum"
,
entry
.
getValue
().
get
(
"vehicleNum"
));
tempmap
.
put
(
"soc"
,
entry
.
getValue
().
get
(
"soc"
));
tempmap
.
put
(
"isOnline"
,
entry
.
getValue
().
get
(
"isOnline"
));
resultlist
.
add
(
tempmap
);
}
}
}
}
Collections
.
sort
(
resultlist
,
new
Comparator
<
Map
>()
{
@Override
public
int
compare
(
Map
s1
,
Map
s2
)
{
return
s1
.
get
(
"vehicleNum"
).
toString
().
compareTo
(
s2
.
get
(
"vehicleNum"
).
toString
());
}
});
// for(Map obj:resultlist) {
//
//
// }
// List<Map> vehicle = vmsVehicleServiceImpl.getVmsVehicle();
// for (Map<?, ?> map : vehicle) {
// map.get("vin");
// jsonObject.put("taskOperation", 2); // 任务操作:0-开始,1-取消,2-强制取消
// jsonObject.put("vin", map.get("vin")); // 任务操作:0-开始,1-取消,2-强制取消
// try {
// tempResult = RestTemplateUtil.post(String.format("%s%s", vehicleUrl, URL.To_ODBU_Cancle),
// jsonObject.toString(), null);
// } catch (Exception e) {
// tempResult = "服务异常,未开启";
// }
// if (null != tempResult) {
// if (tempResult.equals("服务异常,未开启")) {
//// result = ;
// resultlist.add(map.get("vehicleNum") + "车服务运行异常;");
// } else {
// JSONObject tmp = JSONObject.parseObject(tempResult);
// JSONObject tmp1 = JSONObject.parseObject(tmp.get("status").toString());
// if (tmp1.get("details").equals("车辆下线,任务执行失败")) {
//// result+=map.get("vehicleNum")+"车辆下线;";
// resultlist.add(map.get("vehicleNum") + "车辆下线;");
// }
// if (tmp1.get("details").equals("没有可取消的任务") || tmp1.get("details").equals("任务已完成,取消失败")
// || tmp1.get("code").equals("0000")) {
//// result+=map.get("vehicleNum")+"车辆在线;";
// resultlist.add(map.get("vehicleNum") + "车辆在线;");
// }
// }
// } else {
//// result = map.get("vehicleNum")+"车管平台服务运行异常;";
// resultlist.add(map.get("vehicleNum") + "车服务运行异常;");
// }
// System.out.println(map.get("vehicleNum") + tempResult);
// }
return
resultlist
;
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsCranePadBindController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
java.util.*
;
import
com.alibaba.fastjson.JSONObject
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.entity.VmsCranePadBind
;
import
com.ssi.entity.map.MapDataDto
;
import
com.ssi.entity.vo.CranePadBindVo
;
import
com.ssi.model.RedisDataModel
;
import
com.ssi.response.SSIResponse
;
import
com.ssi.service.VmsCranePadBindService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
/**
* 港机pad绑定控制器
*
* @author liheng
* @email
* @date 2020-08-10 16:29:29
*/
@Api
@RestController
@RequestMapping
(
"/cranePadBind"
)
public
class
VmsCranePadBindController
{
@Autowired
private
VmsCranePadBindService
vmsCranePadBindService
;
@Autowired
private
RedisDataModel
redisDataModel
;
/**
* 吊具pad绑定列表
*/
@LogAudit
@ApiOperation
(
value
=
"获得列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
CranePadBindVo
cranePadBindVo
)
{
return
SSIResponse
.
ok
(
vmsCranePadBindService
.
queryPage
(
cranePadBindVo
));
}
/**
* 吊具pad绑定详细信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
Integer
id
)
{
VmsCranePadBind
vmsCranePadBind
=
vmsCranePadBindService
.
getById
(
id
);
return
SSIResponse
.
ok
(
vmsCranePadBind
);
}
/**
* 保存吊具pad绑定关系
*/
@LogAudit
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
add
(
@RequestBody
@Validated
VmsCranePadBind
vmsCranePadBind
)
{
Integer
padNoCount
=
vmsCranePadBindService
.
lambdaQuery
().
eq
(
VmsCranePadBind:
:
getCraneNo
,
vmsCranePadBind
.
getCraneNo
()).
count
();
if
(
padNoCount
>
0
)
{
return
SSIResponse
.
no
(
"设备编号已存在"
);
}
vmsCranePadBind
.
setCreateTime
(
new
Date
());
vmsCranePadBindService
.
save
(
vmsCranePadBind
);
redisDataModel
.
set
(
"ivccs:vms:cranePadBind"
,
JSONObject
.
toJSONString
(
vmsCranePadBindService
.
list
()));
return
SSIResponse
.
ok
();
}
/**
* 修改吊具pad绑定关系
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
VmsCranePadBind
vmsCranePadBind
)
{
Integer
padNoCount
=
vmsCranePadBindService
.
lambdaQuery
()
.
eq
(
VmsCranePadBind:
:
getCraneNo
,
vmsCranePadBind
.
getCraneNo
())
.
ne
(
VmsCranePadBind:
:
getId
,
vmsCranePadBind
.
getId
())
.
count
();
if
(
padNoCount
>
0
)
{
return
SSIResponse
.
no
(
"设备编号已存在"
);
}
vmsCranePadBindService
.
updateById
(
vmsCranePadBind
);
redisDataModel
.
set
(
"ivccs:vms:cranePadBind"
,
JSONObject
.
toJSONString
(
vmsCranePadBindService
.
list
()));
return
SSIResponse
.
ok
();
}
/**
* 删除吊具pad绑定
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
)
{
vmsCranePadBindService
.
removeByIds
(
Arrays
.
asList
(
ids
.
split
(
","
)));
redisDataModel
.
set
(
"ivccs:vms:cranePadBind"
,
JSONObject
.
toJSONString
(
vmsCranePadBindService
.
list
()));
//放入redis缓存
return
SSIResponse
.
ok
();
}
/**
* 根据mac获取桥吊信息
*/
@LogAudit
@GetMapping
(
"/getCraneByMac"
)
@ApiOperation
(
value
=
"根据mac获取桥吊信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
getCraneByMac
(
@RequestParam
String
padMac
)
{
return
vmsCranePadBindService
.
getCraneByMac
(
padMac
);
}
/**
* 保存和更新扭锁区关联桥吊
* @param mapdata
* @return
*/
@LogAudit
@PostMapping
(
"/save"
)
@ApiOperation
(
value
=
"保存和更新扭锁区关联桥吊"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
saveCraneBind
(
@RequestBody
MapDataDto
mapdata
)
{
//符合扭锁区更新逻辑
vmsCranePadBindService
.
updateCraneBind
(
mapdata
.
getCraneIds
(),
mapdata
.
getId
(),
mapdata
.
getNumber
(),
mapdata
.
getBridgeNo
());
return
SSIResponse
.
ok
();
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsDebugAppController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
java.util.Arrays
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.response.SSIPage
;
import
com.ssi.response.SSIResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
com.ssi.entity.VmsDebugApp
;
import
com.ssi.service.VmsDebugAppService
;
import
javax.validation.Valid
;
/**
* 调试APP控制器
*
* @author zhang liyao
* @email
* @date 2020-09-01 08:36:06
*/
@Api
@RestController
@RequestMapping
(
"/debugApp"
)
public
class
VmsDebugAppController
{
@Autowired
private
VmsDebugAppService
vmsDebugAppService
;
/**
* 调试APP分页列表
*/
@LogAudit
@ApiOperation
(
value
=
"获得列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
Map
<
String
,
Object
>
params
){
SSIPage
page
=
vmsDebugAppService
.
queryPage
(
params
);
return
SSIResponse
.
ok
(
page
);
}
/**
* 调试APP详细信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
Integer
id
){
VmsDebugApp
vmsDebugApp
=
vmsDebugAppService
.
getById
(
id
);
return
SSIResponse
.
ok
(
vmsDebugApp
);
}
/**
* 保存调试APP信息
*/
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
add
(
@RequestBody
@Valid
VmsDebugApp
vmsDebugApp
){
if
(!
checkMacRepeat
(
vmsDebugApp
)){
return
SSIResponse
.
no
(
"mac地址不能重复"
);
}
vmsDebugAppService
.
save
(
vmsDebugApp
);
return
SSIResponse
.
ok
();
}
/**
* 修改调试APP信息
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
@Valid
VmsDebugApp
vmsDebugApp
){
if
(!
checkMacRepeat
(
vmsDebugApp
)){
return
SSIResponse
.
no
(
"mac地址不能重复"
);
}
vmsDebugAppService
.
saveOrUpdate
(
vmsDebugApp
);
return
SSIResponse
.
ok
();
}
private
boolean
checkMacRepeat
(
VmsDebugApp
vmsDebugApp
)
{
VmsDebugApp
getExist
=
vmsDebugAppService
.
getOne
(
new
LambdaQueryWrapper
<
VmsDebugApp
>().
eq
(
VmsDebugApp:
:
getAppMac
,
vmsDebugApp
.
getAppMac
()));
if
(
vmsDebugApp
.
getId
()
==
null
&&
getExist
!=
null
){
return
false
;
}
if
(
vmsDebugApp
.
getId
()
!=
null
&&
getExist
!=
null
&&
vmsDebugApp
.
getId
()
!=
getExist
.
getId
()){
return
false
;
}
return
true
;
}
/**
* 删除调试APP信息
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
){
vmsDebugAppService
.
removeByIds
(
Arrays
.
asList
(
ids
.
split
(
","
)));
return
SSIResponse
.
ok
();
}
/**
* 获取密钥
*/
@LogAudit
@GetMapping
(
"/getKey"
)
@ApiOperation
(
value
=
"获取密钥"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
getKey
(){
String
key
=
vmsDebugAppService
.
getKey
();
return
SSIResponse
.
ok
(
key
);
}
/**
* 修改密钥
*/
@GetMapping
(
"/updateKey"
)
@ApiOperation
(
value
=
"修改密钥"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
updateKey
(
@RequestParam
String
key
){
vmsDebugAppService
.
updateKey
(
key
);
return
SSIResponse
.
ok
();
}
/**
* 密钥校验
*/
@LogAudit
@GetMapping
(
"/checkApp"
)
@ApiOperation
(
value
=
"密钥校验"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
checkApp
(
@RequestParam
String
key
,
@RequestParam
String
appMac
){
return
vmsDebugAppService
.
checkApp
(
key
,
appMac
);
}
/**
* 修改遥控接管最大距离
*/
@LogAudit
@GetMapping
(
"/updateDiStance"
)
@ApiOperation
(
value
=
"修改遥控接管最大距离"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
updateDiStance
(
@RequestParam
Integer
distance
){
vmsDebugAppService
.
updateDiStance
(
distance
);
return
SSIResponse
.
ok
();
}
/**
* 获取遥控接管最大距离
*/
@LogAudit
@GetMapping
(
"/getDistance"
)
@ApiOperation
(
value
=
"获取遥控接管最大距离"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
getDistance
(){
Integer
distance
=
vmsDebugAppService
.
getDistance
();
return
SSIResponse
.
ok
(
distance
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsDeviceVersionController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
java.util.Arrays
;
import
java.util.Map
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.response.SSIPage
;
import
com.ssi.response.SSIResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
com.ssi.entity.VmsDeviceVersion
;
import
com.ssi.service.VmsDeviceVersionService
;
/**
* 设备版本控制器
*
* @author zhang liyao
* @email
* @date 2020-07-20 14:01:40
*/
@Api
@RestController
@RequestMapping
(
"/deviceVersion"
)
public
class
VmsDeviceVersionController
{
@Autowired
private
VmsDeviceVersionService
vmsDeviceVersionService
;
/**
* 设备版本分页列表
*/
@LogAudit
@ApiOperation
(
value
=
"获得列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
SSIPage
page
=
vmsDeviceVersionService
.
queryPage
(
params
);
return
SSIResponse
.
ok
(
page
);
}
/**
* 信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
Integer
id
)
{
VmsDeviceVersion
vmsDeviceVersion
=
vmsDeviceVersionService
.
getById
(
id
);
return
SSIResponse
.
ok
(
vmsDeviceVersion
);
}
/**
* 保存
*/
@LogAudit
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
save
(
@RequestBody
VmsDeviceVersion
vmsDeviceVersion
)
{
vmsDeviceVersionService
.
save
(
vmsDeviceVersion
);
return
SSIResponse
.
ok
();
}
/**
* 修改
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
VmsDeviceVersion
vmsDeviceVersion
)
{
vmsDeviceVersionService
.
saveOrUpdate
(
vmsDeviceVersion
);
return
SSIResponse
.
ok
();
}
/**
* 删除
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
)
{
vmsDeviceVersionService
.
removeByIds
(
Arrays
.
asList
(
ids
.
split
(
","
)));
return
SSIResponse
.
ok
();
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsEventController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
java.util.Arrays
;
import
java.util.Map
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.google.common.collect.Maps
;
import
com.ssi.constant.enums.EventTypeEnums
;
import
com.ssi.response.SSIPage
;
import
com.ssi.response.SSIResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
com.ssi.entity.VmsEvent
;
import
com.ssi.service.VmsEventService
;
/**
* 事件控制器
*
* @author zhang liyao
* @email
* @date 2020-07-20 13:12:42
*/
@Api
@RestController
@RequestMapping
(
"/event"
)
public
class
VmsEventController
{
@Autowired
private
VmsEventService
vmsEventService
;
/**
* 事件分页列表
*/
@LogAudit
@ApiOperation
(
value
=
"获得列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
SSIPage
page
=
vmsEventService
.
queryPage
(
params
);
return
SSIResponse
.
ok
(
page
);
}
/**
* 事件详细信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
Integer
id
)
{
VmsEvent
event
=
vmsEventService
.
getById
(
id
);
return
SSIResponse
.
ok
(
event
);
}
/**
* 保存
*/
@LogAudit
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
save
(
@RequestBody
VmsEvent
event
)
{
event
.
setEventSource
(
0
);
vmsEventService
.
save
(
event
);
return
SSIResponse
.
ok
();
}
/**
* 修改
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
VmsEvent
event
)
{
event
.
setEventSource
(
0
);
vmsEventService
.
saveOrUpdate
(
event
);
return
SSIResponse
.
ok
();
}
/**
* 删除
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
)
{
vmsEventService
.
removeByIds
(
Arrays
.
asList
(
ids
.
split
(
","
)));
return
SSIResponse
.
ok
();
}
/**
* 获取事件类型
*/
@LogAudit
@GetMapping
(
"/getEventType"
)
@ApiOperation
(
value
=
"获取事件类型"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
getEventType
(){
Map
<
String
,
String
>
resultMap
=
Maps
.
newHashMap
();
EventTypeEnums
[]
values
=
EventTypeEnums
.
values
();
for
(
EventTypeEnums
enums
:
EventTypeEnums
.
values
()){
resultMap
.
put
(
enums
.
getCode
(),
enums
.
getDescript
());
}
return
SSIResponse
.
ok
(
resultMap
);
}
}
ivccs-vmm-backservice/src/main/java/com/ssi/controller/VmsFaultCodeController.java
0 → 100644
View file @
07602a7b
package
com.ssi.controller
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.util.Arrays
;
import
java.util.Map
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dfssi.dataplatform.service.annotation.LogAudit
;
import
com.ssi.kafka.listener.FaultCodeListener
;
import
com.ssi.response.SSIPage
;
import
com.ssi.response.SSIResponse
;
import
org.apache.kafka.clients.consumer.ConsumerRecord
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.bind.annotation.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
com.ssi.entity.VmsFaultCode
;
import
com.ssi.service.VmsFaultCodeService
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
/**
* 故障码控制器
*
* @author zhang liyao
* @email
* @date 2020-07-16 13:36:49
*/
@Api
@RestController
@RequestMapping
(
"/faultCode"
)
public
class
VmsFaultCodeController
{
@Autowired
private
VmsFaultCodeService
vmsFaultCodeService
;
@Value
(
"${LinuxFile.faultCodePath}"
)
private
String
faultCodePath
;
/**
* 故障码列表分页
*/
@LogAudit
@ApiOperation
(
value
=
"获得列表"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@PostMapping
(
"/list"
)
public
SSIResponse
list
(
@RequestBody
Map
<
String
,
Object
>
params
)
{
SSIPage
page
=
vmsFaultCodeService
.
queryPage
(
params
);
return
SSIResponse
.
ok
(
page
);
}
/**
* 故障码详细信息
*/
@LogAudit
@ApiOperation
(
value
=
"获得单条详细信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
@GetMapping
(
"/info"
)
public
SSIResponse
info
(
@RequestParam
Integer
id
)
{
VmsFaultCode
vmsFaultCode
=
vmsFaultCodeService
.
getById
(
id
);
return
SSIResponse
.
ok
(
vmsFaultCode
);
}
/**
* 添加故障码
*/
@LogAudit
@PostMapping
(
"/add"
)
@ApiOperation
(
value
=
"保存信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
save
(
@RequestBody
@Valid
VmsFaultCode
vmsFaultCode
)
{
Integer
count
=
vmsFaultCodeService
.
lambdaQuery
().
eq
(
VmsFaultCode:
:
getFmi
,
vmsFaultCode
.
getFmi
())
.
eq
(
VmsFaultCode:
:
getSpn
,
vmsFaultCode
.
getSpn
())
.
eq
(
VmsFaultCode:
:
getSa
,
vmsFaultCode
.
getSa
())
.
count
();
if
(
count
>
0
)
{
return
SSIResponse
.
no
(
"相同FMI SPN SA的故障编码已经存在"
);
}
vmsFaultCodeService
.
save
(
vmsFaultCode
);
return
SSIResponse
.
ok
();
}
/**
* 修改故障码
*/
@LogAudit
@PostMapping
(
"/update"
)
@ApiOperation
(
value
=
"修改信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
update
(
@RequestBody
@Valid
VmsFaultCode
vmsFaultCode
)
{
Integer
count
=
vmsFaultCodeService
.
lambdaQuery
().
eq
(
VmsFaultCode:
:
getFmi
,
vmsFaultCode
.
getFmi
())
.
eq
(
VmsFaultCode:
:
getSpn
,
vmsFaultCode
.
getSpn
())
.
eq
(
VmsFaultCode:
:
getSa
,
vmsFaultCode
.
getSa
())
.
ne
(
VmsFaultCode:
:
getId
,
vmsFaultCode
.
getId
())
.
count
();
if
(
count
>
0
)
{
return
SSIResponse
.
no
(
"相同FMI SPN SA的故障编码已经存在"
);
}
vmsFaultCodeService
.
saveOrUpdate
(
vmsFaultCode
);
return
SSIResponse
.
ok
();
}
/**
* 删除故障码
*/
@LogAudit
@GetMapping
(
"/delete"
)
@ApiOperation
(
value
=
"删除信息"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
delete
(
@RequestParam
String
ids
)
{
vmsFaultCodeService
.
removeByIds
(
Arrays
.
asList
(
ids
.
split
(
","
)));
return
SSIResponse
.
ok
();
}
@LogAudit
@RequestMapping
(
value
=
"/template"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"下载模板"
)
public
void
downloadExcle
(
HttpServletResponse
response
)
throws
Exception
{
// String fileName = this.getClass().getClassLoader().getResource("crm2-template.xlsx").getPath();
// String fileName=System.getProperty("user.dir")+File.separator+"faultCode-template.xlsx";
InputStream
in
=
new
FileInputStream
(
faultCodePath
);
vmsFaultCodeService
.
downloadExcel
(
in
,
response
,
"故障码模板.xlsx"
);
}
@Autowired
private
FaultCodeListener
faultCodeListener
;
/**
* 导入故障码
*/
@LogAudit
@PostMapping
(
"/importList"
)
@ApiOperation
(
value
=
"导入故障码"
,
response
=
SSIResponse
.
class
,
produces
=
MimeTypeUtils
.
APPLICATION_JSON_VALUE
)
public
SSIResponse
importList
(
MultipartFile
file
)
{
return
vmsFaultCodeService
.
importList
(
file
);
}
/**
* 导入故障码
*/
@LogAudit
@PostMapping
(
"/testPushFunction"
)
public
SSIResponse
<
Void
>
testPushFunction
(
@RequestBody
JSONObject
obj
)
{
// faultCodeListener.alertFaultCode(new ConsumerRecord<String,String>("test",0,1,obj.getString("vin"),obj.toJSONString()));
return
null
;
}
}
Prev
1
2
3
4
5
6
7
…
24
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment