Commit 07602a7b authored by kang.nie@inzymeits.com's avatar kang.nie@inzymeits.com
Browse files

提交代码

parent e0c7be76
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);
}
}
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);
}
}
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();
}
}
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);
}
}
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);
}
}
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);
}
}
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment