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.VmsIndividuationConfig;
import com.ssi.response.SSIPage;
import com.ssi.response.SSIResponse;
import com.ssi.service.VmsIndividuationConfigService;
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.util.List;
/**
* @author SunnyHotz
* @PackageName:com.ssi.controller
* @ClassName:VmsIndividuationController
* @Description:
* @date 2022/7/20 11:46
*/
@Api
@RestController
@RequestMapping("/individuation")
public class VmsIndividuationController {
@Autowired
private VmsIndividuationConfigService individuationConfigService;
@LogAudit
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/list")
public SSIResponse list(@RequestBody VmsIndividuationConfig config) {
SSIPage page = individuationConfigService.queryPage(config);
return SSIResponse.ok(page);
}
@LogAudit
@ApiOperation(value = "更新数据", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/update")
public SSIResponse update(@RequestBody VmsIndividuationConfig config) {
individuationConfigService.updateById(config);
return SSIResponse.ok();
}
@LogAudit
@ApiOperation(value = "删除数据", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/delete")
public SSIResponse delete(@RequestParam("ids") List<Integer> ids) {
individuationConfigService.removeByIds(ids);
return SSIResponse.ok();
}
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/listByParent")
public SSIResponse listByParent(@RequestParam("name") String name) {
List<VmsIndividuationConfig> vmsIndividuationConfigs = individuationConfigService.listByParent(name);
return SSIResponse.ok(vmsIndividuationConfigs);
}
}
package com.ssi.controller;
import com.ssi.entity.vo.KpiCostTimeVo;
import com.ssi.response.SSIResponse;
import com.ssi.service.VmsKpiAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping("/kpiData")
public class VmsKPIDataController {
@Autowired
private VmsKpiAnalysisService vmsKpiAnalysisService;
@PostMapping("/staticsWorkTime")
public SSIResponse staticsWorkTime(@RequestBody KpiCostTimeVo kpiCostTimeVo){
return SSIResponse.ok(vmsKpiAnalysisService.staticsWorkTime(kpiCostTimeVo));
}
@PostMapping("/taskAnalysis")
public SSIResponse taskAnalysis(@RequestBody KpiCostTimeVo kpiCostTimeVo){
return SSIResponse.ok(vmsKpiAnalysisService.taskAnalysis(kpiCostTimeVo));
}
@PostMapping("/exportExcel")
public void exportExcel(@RequestBody KpiCostTimeVo kpiCostTimeVo, HttpServletResponse response){
vmsKpiAnalysisService.exportExcel(kpiCostTimeVo,response);
}
@GetMapping("/getVoyageNo")
public SSIResponse getVoyageNo(){
return SSIResponse.ok(vmsKpiAnalysisService.getVoyageNo());
}
}
package com.ssi.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.dfssi.dataplatform.service.annotation.LogAudit;
import com.ssi.entity.vo.VmsRoadDeviceVo;
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.VmsRoadDevice;
import com.ssi.service.VmsRoadDeviceService;
/**
* 路测设备控制器
*
* @author zhang liyao
* @email
* @date 2020-07-09 13:37:13
*/
@Api
@RestController
@RequestMapping("/roadDevice")
public class VmsRoadDeviceController {
@Autowired
private VmsRoadDeviceService vmsRoadDeviceService;
/**
* 列表
*/
@LogAudit
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/list")
public SSIResponse list(@RequestBody Map<String, Object> params) {
SSIPage page = vmsRoadDeviceService.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) {
VmsRoadDevice vmsRoadDevice = vmsRoadDeviceService.getById(id);
return SSIResponse.ok(vmsRoadDevice);
}
/**
* 保存
*/
@LogAudit
@PostMapping("/add")
@ApiOperation(value = "保存信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse save(@RequestBody VmsRoadDevice vmsRoadDevice) {
vmsRoadDeviceService.save(vmsRoadDevice);
return SSIResponse.ok();
}
/**
* 修改
*/
@LogAudit
@PostMapping("/update")
@ApiOperation(value = "修改信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse update(@RequestBody VmsRoadDevice vmsRoadDevice) {
vmsRoadDeviceService.saveOrUpdate(vmsRoadDevice);
return SSIResponse.ok();
}
/**
* 删除
*/
@LogAudit
@GetMapping("/delete")
@ApiOperation(value = "删除信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse delete(@RequestParam String ids) {
vmsRoadDeviceService.removeByIds(Arrays.asList(ids.split(",")));
return SSIResponse.ok();
}
/**
* 视频播放列表
*/
@LogAudit
@ApiOperation(value = "视频播放列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/videoPlayUrlList")
public SSIResponse videoPlayUrlList() {
List<VmsRoadDeviceVo> list = vmsRoadDeviceService.videoPlayUrlList();
return SSIResponse.ok(list);
}
/**
* 路测安全消息信息
*/
@LogAudit
@ApiOperation(value = "路测安全消息信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/getRsmInfo")
public SSIResponse getRsmInfo(Long id) {
Map info = vmsRoadDeviceService.getRsmInfo(id);
return SSIResponse.ok(info);
}
}
package com.ssi.controller;
import com.dfssi.dataplatform.service.annotation.LogAudit;
import com.ssi.entity.DcvAllowGoShipLaneTxVo;
import com.ssi.entity.VmsShipInfo;
import com.ssi.entity.VmsShipsDrawing;
import com.ssi.response.SSIPage;
import com.ssi.response.SSIResponse;
import com.ssi.service.VmsShipsDrawingService;
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.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.List;
import java.util.Map;
/**
* 船图控制器
*
* @author lvyanfeng
* @email
* @date 2020-07-08 15:38:37
*/
@Api
@RestController
@RequestMapping("/shipsDrawing")
public class VmsShipsDrawingController {
@Autowired
private VmsShipsDrawingService vmsShipsDrawingService;
/**
* 船图接口
*/
@LogAudit
@PostMapping("/ShipsDrawinglist")
@ApiOperation(value = "查询船图", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse<VmsShipsDrawing> ShipsDrawinglist(@RequestBody Map<String, Object> params) {
VmsShipsDrawing vehicleList = vmsShipsDrawingService.getVmsShipsDrawing(params);
return SSIResponse.ok(vehicleList);
}
/**
* 船图贝位列表
*/
@LogAudit
@PostMapping("/ShipsDrawingBayNolist")
@ApiOperation(value = "查询船图贝位列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse<?> ShipsDrawingBayNolist(@RequestBody Map<String, Object> params) {
// System.out.println("----shipCod"+shipCod);
// List<VmsShipsDrawing> vehicleList = vmsShipsDrawingService.getVmsShipsDrawingBayNo(shipCod,bayNo);
SSIPage page = vmsShipsDrawingService.getVmsShipsDrawingBayNo(params);
return SSIResponse.ok(page);
}
/**
* 船信息列表
*/
@LogAudit
@ApiOperation(value = "获得船列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/ShipInfoList")
public SSIResponse<?> ShipInfoList(@RequestBody Map<String, Object> params) {
SSIPage page = vmsShipsDrawingService.queryPage(params);
return SSIResponse.ok(page);
}
/**
* 船信息列表
*/
@LogAudit
@ApiOperation(value = "获得船信息及坐标信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/ShipInfoCoor")
public SSIResponse<?> ShipInfoCoor(@RequestBody Map<String, Object> params) {
List<VmsShipInfo> list = vmsShipsDrawingService.getShipInfoCoor();
return SSIResponse.ok(list);
}
/**
* 根据桥吊获取船的编号
*/
@LogAudit
@ApiOperation(value = "根据桥吊获取船的编号", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/ShipInfoCod")
public SSIResponse<?> ShipInfoCod(@RequestBody Map<String, Object> params) {
// String BridgeNum = (String) params.get("BridgeNum");
// Map<String, Object> map=new HashMap<String, Object>();
VmsShipInfo shipInfo = new VmsShipInfo();
double BridgeXpoint = (double) params.get("BridgeXpoint");
List<VmsShipInfo> list = vmsShipsDrawingService.getShipInfoCoor();
for (VmsShipInfo ship : list) {
if (null != ship.getBegcoor() && null != ship.getEndcoor()) {
String[] begCoor = ship.getBegcoor().split(",");
String[] endCoor = ship.getEndcoor().split(",");
if (ship.getBerthWay().equals("L")) {
if (BridgeXpoint < Double.parseDouble(begCoor[0])
&& BridgeXpoint > Double.parseDouble(endCoor[0])) {
shipInfo = ship;
}
}
if (ship.getBerthWay().equals("R")) {
if (BridgeXpoint > Double.parseDouble(begCoor[0])
&& BridgeXpoint < Double.parseDouble(endCoor[0])) {
shipInfo = ship;
}
}
}
}
//查询该船在指定桥吊下 正在作业的贝位, 默认 000
String bayNo = "000";
if(shipInfo.getVoyageNo() != null && params.get("portCode") != null){
bayNo = vmsShipsDrawingService.getShipWorkingBay(shipInfo.getVoyageNo(), params.get("portCode").toString());
}
shipInfo.setWorkingBay(bayNo);
return SSIResponse.ok(shipInfo);
}
/**
* 获取缆装
*/
@LogAudit
@ApiOperation(value = "获取缆装", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/cableList")
public SSIResponse<?> cableList() {
return SSIResponse.ok(vmsShipsDrawingService.getCableList());
}
/**
* 保存箱体上船信息
*/
@LogAudit
@ApiOperation(value = "强制上船与禁止上船", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/saveShipTx")
public SSIResponse<?> saveShipTx(@RequestBody DcvAllowGoShipLaneTxVo shipList) {
if (shipList.getShipList().size() == 0) {
return SSIResponse.no("请选择箱体!");
}
return SSIResponse.ok(vmsShipsDrawingService.saveShipTx(shipList));
}
}
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.VmsTerminal;
import com.ssi.service.VmsTerminalService;
/**
* 终端控制器
*
* @author zhang liyao
* @email
* @date 2020-07-16 09:32:59
*/
@Api
@RestController
@RequestMapping("/terminal")
public class VmsTerminalController {
@Autowired
private VmsTerminalService vmsTerminalService;
/**
* 终端信息分页列表
*/
@LogAudit
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/list")
public SSIResponse list(@RequestBody Map<String, Object> params) {
SSIPage page = vmsTerminalService.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) {
VmsTerminal vmsTerminal = vmsTerminalService.getById(id);
return SSIResponse.ok(vmsTerminal);
}
/**
* 保存终端信息
*/
@LogAudit
@PostMapping("/add")
@ApiOperation(value = "保存信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse save(@RequestBody VmsTerminal vmsTerminal) {
return vmsTerminalService.saveTerminal(vmsTerminal);
}
/**
* 修改终端信息
*/
@LogAudit
@PostMapping("/update")
@ApiOperation(value = "修改信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse update(@RequestBody VmsTerminal vmsTerminal) {
return vmsTerminalService.saveTerminal(vmsTerminal);
}
/**
* 删除终端信息
*/
@LogAudit
@GetMapping("/delete")
@ApiOperation(value = "删除信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse delete(@RequestParam String ids) {
vmsTerminalService.removeByIds(Arrays.asList(ids.split(",")));
return SSIResponse.ok();
}
/**
* 视频监控
*/
@LogAudit
@GetMapping("/videoMonitor")
@ApiOperation(value = "视频监控", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse videoMonitor(String vin) {
return vmsTerminalService.videoMonitor(vin);
}
}
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.VmsTerminalVersion;
import com.ssi.service.VmsTerminalVersionService;
/**
* 终端版本控制器
*
* @author zhang liyao
* @email
* @date 2020-07-16 13:36:49
*/
@Api
@RestController
@RequestMapping("/terminalVersion")
public class VmsTerminalVersionController {
@Autowired
private VmsTerminalVersionService vmsTerminalVersionService;
/**
* 终端版本分页列表
*/
@LogAudit
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/list")
public SSIResponse list(@RequestBody Map<String, Object> params) {
SSIPage page = vmsTerminalVersionService.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) {
VmsTerminalVersion vmsTerminalVersion = vmsTerminalVersionService.getById(id);
return SSIResponse.ok(vmsTerminalVersion);
}
/**
* 保存终端版本信息
*/
@LogAudit
@PostMapping("/add")
@ApiOperation(value = "保存信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse save(@RequestBody VmsTerminalVersion vmsTerminalVersion) {
if(!checkVersionNumRepeat(vmsTerminalVersion)){
return SSIResponse.no("版本号不能重复");
}
vmsTerminalVersionService.save(vmsTerminalVersion);
return SSIResponse.ok();
}
/**
* 修改终端版本信息
*/
@LogAudit
@PostMapping("/update")
@ApiOperation(value = "修改信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse update(@RequestBody VmsTerminalVersion vmsTerminalVersion) {
if(!checkVersionNumRepeat(vmsTerminalVersion)){
return SSIResponse.no("版本号不能重复");
}
vmsTerminalVersionService.saveOrUpdate(vmsTerminalVersion);
return SSIResponse.ok();
}
private boolean checkVersionNumRepeat(VmsTerminalVersion vmsTerminalVersion) {
VmsTerminalVersion getExist = vmsTerminalVersionService.getOne(new LambdaQueryWrapper<VmsTerminalVersion>().eq(VmsTerminalVersion::getTerminalVersionNum, vmsTerminalVersion.getTerminalVersionNum()));
if(vmsTerminalVersion.getId() == null && getExist != null){
return false;
}if(vmsTerminalVersion.getId() != null && getExist != null && vmsTerminalVersion.getId() != getExist.getId()){
return false;
}
return true;
}
/**
* 删除终端版本信息
*/
@LogAudit
@GetMapping("/delete")
@ApiOperation(value = "删除信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse delete(@RequestParam String ids) {
vmsTerminalVersionService.removeByIds(Arrays.asList(ids.split(",")));
return SSIResponse.ok();
}
}
package com.ssi.controller;
import com.dfssi.dataplatform.service.annotation.LogAudit;
import com.ssi.response.SSIResponse;
import com.ssi.service.VmsTosOrdersAnalysisService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MimeTypeUtils;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
/**
* 任务分析控制器
*
* @author hli
* @email
* @date 2021-01-11 14:00:36
*/
@Api
@RestController
@RequestMapping("/vmsTosOrdersAnalysis")
public class VmsTosOrdersAnalysisController {
@Autowired
private VmsTosOrdersAnalysisService vmsTosOrdersAnalysisService;
/**
* 重新计算任务数据
*/
@LogAudit
@ApiOperation(value = "重新计算任务数据", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/reAnalysis")
public SSIResponse reAnalysis(Date date) {
LocalDate localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
vmsTosOrdersAnalysisService.reAnalysis(localDate);
return SSIResponse.ok();
}
}
package com.ssi.controller;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.dfssi.dataplatform.service.annotation.LogAudit;
import com.ssi.constant.enums.VmsTosOrderStatusEnum;
import com.ssi.entity.vo.VmsTosOrdersKPIVo;
import com.ssi.entity.vo.VmsTosOrdersVo;
import com.ssi.response.SSIPage;
import com.ssi.response.SSIResponse;
import com.ssi.service.*;
import com.ssi.utils.DateUtils;
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.VmsTosOrders;
import javax.servlet.http.HttpServletResponse;
/**
* TOS任务指令控制器
* @author zhang liyao
* @email
* @date 2020-07-11 13:12:01
*/
@Api(tags = "任务清单控制器",description = "任务清单")
@RestController
@RequestMapping("/vmsTosOrders")
public class VmsTosOrdersController {
@Autowired
private VmsTosOrdersService vmsTosOrdersService;
@Autowired
private VmsTosOriginalOrdersService vmsTosOriginalOrdersService;
@Autowired
private VmsOrdersVehicleAlterService vmsOrdersVehicleAlterService;
@Autowired
private VmsTosOrdersOeeService vmsTosOrdersOeeService;
@Autowired
private VmsTosOrderDailyKpiService vmsTosOrderDailyKpiService;
/**
* 任务详细信息
*/
@LogAudit
@ApiOperation(value = "获得单条详细信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/info")
public SSIResponse info(@RequestParam Integer id) {
VmsTosOrders vmsTosOrders = vmsTosOrdersService.getById(id);
return SSIResponse.ok(vmsTosOrders);
}
/**
* 保存
*/
@LogAudit
@PostMapping("/add")
@ApiOperation(value = "保存信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse save(@RequestBody VmsTosOrders vmsTosOrders) {
vmsTosOrdersService.save(vmsTosOrders);
return SSIResponse.ok();
}
/**
* 修改
*/
@LogAudit
@PostMapping("/update")
@ApiOperation(value = "修改信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse update(@RequestBody VmsTosOrders vmsTosOrders) {
vmsTosOrdersService.saveOrUpdate(vmsTosOrders);
return SSIResponse.ok();
}
/**
* 删除
*/
@LogAudit
@GetMapping("/delete")
@ApiOperation(value = "删除信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse delete(@RequestParam String ids) {
vmsTosOrdersService.removeByIds(Arrays.asList(ids.split(",")));
return SSIResponse.ok();
}
/**
* 获取车辆当前任务
*/
@LogAudit
@GetMapping("/getOrdersByVin")
@ApiOperation(value = "获取车辆当前任务", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse getOrdersByVin(@RequestParam String vin) {
return SSIResponse.ok(vmsTosOrdersService.getOrdersByVin(vin));
}
/**
* 车辆行程查询
*/
@LogAudit
@GetMapping("/getVehicleTrip")
@ApiOperation(value = "车辆行程查询", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse getVehicleTrip(@RequestParam String vin, Long startTime, Long stopTime, String faultGrade) {
return vmsTosOrdersService.getVehicleTrip(vin, startTime, stopTime, faultGrade);
}
/**
* 根据时间查询车辆能耗里程
*/
@LogAudit
@GetMapping("/getMileTimeByTime")
@ApiOperation(value = "根据时间查询车辆能耗里程", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse getMileTimeByTime(@RequestParam String vin, Long startTime, Long stopTime) {
return vmsTosOrdersService.getMileTimeByTime(vin, startTime, stopTime);
}
/**
* 根据异常报警查询行程
*/
@LogAudit
@GetMapping("/getTripByAlert")
@ApiOperation(value = "根据异常报警查询行程", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse getTripByAlert(@RequestParam String vin, String alertId ) {
return vmsTosOrdersService.getTripByAlert(vin, alertId);
}
/**
* 列表
*/
@LogAudit
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/list")
public SSIResponse list(@RequestBody VmsTosOrdersVo vmsTosOrdersVo) {
SSIPage page = vmsTosOrdersService.queryPage(vmsTosOrdersVo);
return SSIResponse.ok(page);
}
/**
* 列表
*/
@LogAudit
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/listOriginalOrder")
public SSIResponse listOriginalOrder(@RequestBody VmsTosOrdersVo vmsTosOrdersVo) {
SSIPage page = vmsTosOriginalOrdersService.queryPageByCondition(vmsTosOrdersVo);
return SSIResponse.ok(page);
}
/**
* 搬运集装箱的列表
*/
@LogAudit
@ApiOperation(value = "搬运集装箱的列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/listForContainerTask")
public SSIResponse listForContainerTask(@RequestBody VmsTosOrdersVo vmsTosOrdersVo) {
vmsTosOrdersVo.setVehicleTaskLabels(Arrays.asList(1,2,3));
SSIPage page = vmsTosOrdersService.queryPageByAllStatus(vmsTosOrdersVo);
return SSIResponse.ok(page);
}
/**
* 导出
*/
@LogAudit
@ApiOperation(value = "导出列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/export")
public void export(@RequestBody VmsTosOrdersVo vmsTosOrdersVo, HttpServletResponse response) {
vmsTosOrdersService.export(vmsTosOrdersVo,response);
}
/**
* 获取当前pad对应桥吊可选车辆
*/
@LogAudit
@GetMapping("/getVehicleByPadMac")
@ApiOperation(value = "获取当前pad对应桥吊可选车辆", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse getVehicleByPadMac(@RequestParam String padMac,@RequestParam String taskNo) {
return vmsTosOrdersService.getVehicleByPadMac(padMac,taskNo);
}
/**
* 确认任务车辆
*/
@LogAudit
@GetMapping("/confirmOrdersVehicle")
@ApiOperation(value = "确认任务车辆", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse confirmOrdersVehicle(@RequestParam String taskNo,@RequestParam String vin) {
return vmsOrdersVehicleAlterService.changeOrdersVehicle(taskNo,vin);
}
/**
* 查询任务status字段含义
*/
@LogAudit
@GetMapping("/getStatusConfig")
@ApiOperation(value = "查询任务status字段含义", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse getStatusConfig() {
VmsTosOrderStatusEnum[] values = VmsTosOrderStatusEnum.values();
return SSIResponse.ok(values);
}
/**
* 查询任务状态历史
*/
@LogAudit
@GetMapping("/getTaskHistory")
@ApiOperation(value = "查询任务状态历史", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse getTaskHistory(String taskNo) {
return vmsTosOrdersService.getTaskHistory(taskNo);
}
/**
* 进行中的任务列表
*/
@LogAudit
@ApiOperation(value = "进行中的任务列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/listInProcess")
public SSIResponse listInProcess(@RequestBody(required = false) VmsTosOrdersVo vmsTosOrdersVo) {
SSIPage page = vmsTosOrdersService.listInProcess(vmsTosOrdersVo);
return SSIResponse.ok(page);
}
/**
* 实时任务列表
*/
@LogAudit
@ApiOperation(value = "实时任务列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/realTimeTasks")
public SSIResponse realTimeTasks(@RequestBody(required = false) VmsTosOrdersVo vmsTosOrdersVo) {
SSIPage page = vmsTosOrdersService.realTimeTasks(vmsTosOrdersVo);
return SSIResponse.ok(page);
}
/**
* 获取某一天的任务KPI
*/
@LogAudit
@ApiOperation(value = "获取某一天的任务KPI", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/getDailyKpi")
public SSIResponse getDailyKpi(Date queryDate,String vehicleNum) {
if(queryDate == null){
queryDate = new Date();
}
LocalDateTime startTime = LocalDateTime.of(queryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalTime.MIN);
LocalDateTime endTime = LocalDateTime.of(queryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalTime.MAX);
List list = vmsTosOrdersService.getDailyKpi(startTime,endTime,vehicleNum);
return SSIResponse.ok(list);
}
/**
* 获取某一天的任务 KPI
* @param queryDate
* @param vehicleNum
* @return
*/
@LogAudit
@ApiOperation(value = "获取某一天的任务KPI查询预处理的表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/getOrderDailyKpi")
public SSIResponse getOrderDailyKpi(Date queryDate,String vehicleNum) {
if(queryDate == null){
queryDate = new Date();
}
List<Map<String, String>> orderDailyKpi = vmsTosOrderDailyKpiService.getOrderDailyKpi(DateUtils.format(queryDate, DateUtils.DATE_PATTERN), vehicleNum);
return SSIResponse.ok(orderDailyKpi);
}
/**
* 任务KPI-效率OEE分析
*/
@LogAudit
@ApiOperation(value = "任务KPI-效率OEE分析", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/taskKPI")
public SSIResponse taskKPI(@RequestBody VmsTosOrdersKPIVo vmsTosOrders) throws Exception{
//List list = vmsTosOrdersService.taskKPI(vmsTosOrders);
List list = vmsTosOrdersOeeService.taskOee(vmsTosOrders);
return SSIResponse.ok(list);
}
/**
* 车管平台强制取消
*/
@LogAudit
@ApiOperation(value = "车管平台强制取消", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/cancel")
public SSIResponse cancel(String taskNo) throws Exception{
return vmsTosOrdersService.forceCancel(taskNo);
}
}
package com.ssi.controller;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.dfssi.dataplatform.service.annotation.LogAudit;
import com.ssi.entity.VmsVehicle;
import com.ssi.entity.vo.VehicleControlStatusVo;
import com.ssi.response.SSIPage;
import com.ssi.response.SSIResponse;
import com.ssi.service.VehicleEmergencyService;
import com.ssi.service.VehicleRemoteInstructionService;
import com.ssi.service.VmsDebugAppService;
import com.ssi.service.VmsVehicleService;
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.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 车辆控制器
*
* @author zhang liyao
* @email
* @date 2020-07-08 15:38:37
*/
@Api
@RestController
@RequestMapping("/vehicle")
public class VmsVehicleController {
@Autowired
private VmsVehicleService vmsVehicleService;
@Autowired
private VmsDebugAppService vmsDebugAppService;
@Autowired
private VehicleEmergencyService vehicleEmergencyService;
@Autowired
private VehicleRemoteInstructionService remoteInstructionService;
/**
* 车辆分页列表
*/
@LogAudit
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/list")
public SSIResponse list(@RequestBody Map<String, Object> params) {
return SSIResponse.ok(vmsVehicleService.queryPage(params));
}
/**
* 车辆详细信息
*/
@LogAudit
@ApiOperation(value = "获得单条详细信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@GetMapping("/info")
public SSIResponse info(@RequestParam Integer id) {
VmsVehicle vehicle = vmsVehicleService.getById(id);
return SSIResponse.ok(vehicle);
}
/**
* 保存车辆
*/
@LogAudit
@PostMapping("/add")
@ApiOperation(value = "保存信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse save(@RequestBody VmsVehicle vehicle) {
return vmsVehicleService.saveVehicle(vehicle);
}
/**
* 修改车辆信息
*/
@LogAudit
@PostMapping("/update")
@ApiOperation(value = "修改信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse update(@RequestBody VmsVehicle vehicle) {
return vmsVehicleService.saveVehicle(vehicle);
}
/**
* 删除车辆
*/
@LogAudit
@GetMapping("/delete")
@ApiOperation(value = "删除信息", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse delete(@RequestParam String ids) {
vmsVehicleService.removeByIds(Arrays.asList(ids.split(",")));
return SSIResponse.ok();
}
/**
* 车辆启用禁用
*/
@LogAudit
@GetMapping("/updateVehicleStatus")
@ApiOperation(value = "车辆启用禁用", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse updateVehicleStatus(@RequestParam(name = "vin") String vin, @RequestParam(name = "status", defaultValue = "0") Integer status) {
vmsVehicleService.update(new LambdaUpdateWrapper<VmsVehicle>().set(VmsVehicle::getStatus, status).eq(VmsVehicle::getVin, vin));
return SSIResponse.ok();
}
/**
* 车辆监控列表接口
*/
@LogAudit
@GetMapping("/listForMonitor")
@ApiOperation(value = "车辆监控列表接口", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse listForMonitor(String vehicleNum,Integer vehicleType) {
// List<Vehicle> vehicleList = vehicleService.listAndCache();
List<VmsVehicle> vehicleList = vmsVehicleService.getNormalVehicleByVehicleNum(vehicleNum,vehicleType);
return vmsVehicleService.listForMonitor(vehicleList);
}
/**
* 车辆监控状态统计接口
*/
@LogAudit
@GetMapping("/vehicleStatusForMonitor")
@ApiOperation(value = "车辆监控状态统计接口", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse vehicleStatusForMonitor() {
// List<Vehicle> vehicleList = vehicleService.listAndCache();
List<VmsVehicle> vehicleList = vmsVehicleService.getNormalVehicle();
return vmsVehicleService.vehicleStatusForMonitor(vehicleList);
}
/**
* 获取当前定位周边车辆列表
*/
@LogAudit
@GetMapping("/getVehicleByLocation")
@ApiOperation(value = "获取当前定位周边车辆", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse getVehicleByLocation(@RequestParam String location, Integer distance) {
if (distance == null) {
Integer curDis = vmsDebugAppService.getDistance();
distance = curDis == null ? 100 : curDis;
}
List<VehicleControlStatusVo> vehicleList = vmsVehicleService.getVehicleByLocation(location, distance);
return SSIResponse.ok(vehicleList);
}
/**
* 急停列表分页
*/
@LogAudit
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/emergency/list")
public SSIResponse emergencyList(@RequestBody Map<String, Object> params) {
SSIPage page = vehicleEmergencyService.queryPage(params);
return SSIResponse.ok(page);
}
/**
* 远程指令列表分页
*/
@LogAudit
@ApiOperation(value = "获得列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/remote/instruction")
public SSIResponse remoteInstruction(@RequestBody Map<String, Object> params) {
SSIPage page = remoteInstructionService.queryPage(params);
return SSIResponse.ok(page);
}
}
package com.ssi.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.dfssi.dataplatform.service.annotation.LogAudit;
import com.ssi.constant.URL;
import com.ssi.entity.VmsVehicleAlertProcess;
import com.ssi.response.SSIResponse;
import com.ssi.service.VmsVehicleAlertProcessService;
import com.ssi.utils.RestTemplateUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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.util.Date;
import java.util.Objects;
/**
* @author SunnyHotz
* @PackageName:com.ssi.controller
* @ClassName:VmsVehicleFaultProcessController
* @Description:
* @date 2022/10/31 15:58
*/
@Api
@RestController
@RequestMapping("/faultProcess")
public class VmsVehicleFaultProcessController {
@Autowired
private VmsVehicleAlertProcessService vmsVehicleAlertProcessService;
@Value("${command-url}")
private String commandUrl;
@LogAudit
@GetMapping("/continueTask")
public SSIResponse<?> continueTask(@RequestParam("id") String id, @RequestParam("vin")String vin){
VmsVehicleAlertProcess byId = vmsVehicleAlertProcessService.getById(id);
if(Objects.isNull(byId)||Objects.nonNull(byId.getResolveStatus())){
return SSIResponse.no("请确认记录是否存在or已处理");
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("vin",vin);
jsonObject.put("status",56);
String result = RestTemplateUtil.post(commandUrl.concat(URL.To_CPS_TASK_STOP), jsonObject.toJSONString(), null);
//成功更新数据
JSONObject resultObject = JSONObject.parseObject(result);
if(Objects.nonNull(resultObject)&&resultObject.getInteger("code")==1){
byId.setResolveAlarmTime(new Date());
byId.setResolveStatus(1);
vmsVehicleAlertProcessService.updateById(byId);
return SSIResponse.ok();
}
return SSIResponse.no(resultObject.getString("msg"));
}
@LogAudit
@GetMapping("/stopTask")
public SSIResponse<?> stopTask(@RequestParam("id") String id, @RequestParam("vin")String vin){
VmsVehicleAlertProcess byId = vmsVehicleAlertProcessService.getById(id);
if(Objects.isNull(byId)||Objects.nonNull(byId.getResolveStatus())){
return SSIResponse.no("请确认记录是否存在or已处理");
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("vin",vin);
String result = RestTemplateUtil.post(commandUrl.concat(URL.To_CPS_TASK_STOP), jsonObject.toJSONString(), null);
//成功更新数据
JSONObject resultObject = JSONObject.parseObject(result);
if(Objects.nonNull(resultObject)&&resultObject.getInteger("code")==1){
byId.setResolveAlarmTime(new Date());
byId.setResolveStatus(0);
vmsVehicleAlertProcessService.updateById(byId);
return SSIResponse.ok();
}
return SSIResponse.no(resultObject.getString("msg"));
}
}
package com.ssi.controller;
import com.ssi.entity.dto.VmsVehicleVinFreeTimeDto;
import com.ssi.response.SSIResponse;
import com.ssi.service.VmsVehicleFreeTimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;
/**
* @description: 车辆 controller 层
* @author: dt
* @create: 2022-11-10 13:36
*/
@Api(tags = "查询车辆空闲时间")
@RestController
@RequestMapping("/vehicleFreeTime")
@Slf4j
public class VmsVehicleFreeTimeController {
private VmsVehicleFreeTimeService vmsVehicleFreeTimeService;
public VmsVehicleFreeTimeController(VmsVehicleFreeTimeService vmsVehicleFreeTimeService) {
this.vmsVehicleFreeTimeService = vmsVehicleFreeTimeService;
}
/**
* 查询车辆时间范围内的空闲时间
* @param vmsVehicleVinFreeTimeDto
* @return
*/
@PostMapping("/getVehicleFreeTime")
@ApiOperation(value = "查询车辆时间范围内的空闲时间", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
SSIResponse<VmsVehicleVinFreeTimeDto> getVehicleFreeTime(@RequestBody VmsVehicleVinFreeTimeDto vmsVehicleVinFreeTimeDto) {
VmsVehicleVinFreeTimeDto vehicleFreeTime = vmsVehicleFreeTimeService.getVehicleFreeTime(vmsVehicleVinFreeTimeDto);
return SSIResponse.ok(vehicleFreeTime);
}
}
package com.ssi.controller.map;
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.CraneInfo;
import com.ssi.entity.VmsAreaBusinessInfo;
import com.ssi.entity.map.MapDataDto;
import com.ssi.response.SSIResponse;
import com.ssi.service.CraneInfoService;
import com.ssi.service.VmsAreaBarrierService;
import com.ssi.service.VmsAreaBusinessInfoService;
import com.ssi.service.VmsCranePadBindService;
import com.ssi.utils.RestTemplateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
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.*;
import java.util.stream.Collectors;
@Api(tags = "地图图形数据", description = "地图")
@Slf4j
@RestController
@RequestMapping("/map/data")
public class MapController {
@Value("${map-edit-url}")
private String mapEditUrl;
@Autowired
private VmsAreaBusinessInfoService vmsAreaBusinessInfoService;
@Autowired
private VmsAreaBarrierService vmsAreaBarrierService;
@Autowired
private VmsCranePadBindService vmsCranePadBindService;
@Autowired
private CraneInfoService craneInfoService;
/**
* 保存地图图形数据
*/
@LogAudit
@ApiOperation(value = "保存地图图形数据", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/save")
public SSIResponse saveData(@RequestBody MapDataDto mapdata) {
if (StringUtils.isBlank(mapdata.getPoints())) {
return SSIResponse.no("区域绘制不规范!");
}
if (!mapdata.getType().equals("4")) {
if (StringUtils.isBlank(mapdata.getNumber())) {
return SSIResponse.no("请输入绘制区域编号");
}
}
if (mapdata.getNumber().length() < 4) {
return SSIResponse.no("请输入至少4位编号");
}
if (mapdata.getNumber().length() >10 ) {
return SSIResponse.no("输入编号过长,编号长度应小于10");
}
if("11".equals(mapdata.getType())){
//属于电子围栏
SSIResponse ssiResponse = vmsAreaBarrierService.saveMapData(mapdata);
return SSIResponse.ok(ssiResponse);
}
JSONObject param = new JSONObject();
List<Double> pointList = new ArrayList<>();
String[] points = mapdata.getPoints().split(";");
for (String point : points) {
String[] loglat = point.split(",");
pointList.add(Double.valueOf(loglat[0]));
pointList.add(Double.valueOf(loglat[1]));
}
if (StringUtils.isNumeric(mapdata.getNumber().substring(1))
&& StringUtils.isAlpha(mapdata.getNumber().substring(0, 1))) {
param.put("seq", mapdata.getNumber().substring(1));// 编号
} else {
return SSIResponse.no("请输入正确的编号,头一位为字母,后面为数字");
}
if (pointList.size() < 8) {
return SSIResponse.no("区域绘制不规范,请至少绘制4个点");
}
param.put("lng1", pointList.get(0));
param.put("lat1", pointList.get(1));
param.put("lng2", pointList.get(2));
param.put("lat2", pointList.get(3));
param.put("lng3", pointList.get(4));
param.put("lat3", pointList.get(5));
param.put("lng4", pointList.get(6));
param.put("lat4", pointList.get(7));
if (mapdata.getField().equals("E") || mapdata.getField().equals("F")) {
param.put("field", mapdata.getField());// 场区(E/F)
} else {
return SSIResponse.no("场区字段有误,请填写E/F");
}
// param.put("field",mapdata.getField());//场区(E/F)
param.put("placeType", mapdata.getPlacetype());// 区域类型。1桥下,2桥后
param.put("name", mapdata.getNumber());// 名称
param.put("type", mapdata.getType());// 类型。1缓冲区;2停车区;3:充电区
param.put("state", mapdata.getState());// 状态。0可用;1不可用(初始状态);2已计划;3有车
String paramData = JSONObject.toJSONString(param);
log.info(String.format("绘制地图区域保存请求发送:----%s", paramData));
String result = RestTemplateUtil.post(String.format("%s%s", mapEditUrl, URL.MAP_ADD_URL), paramData, null);
log.info(String.format("绘制地图区域保存返回结果:----%s", result));
JSONObject jsonObject = JSONObject.parseObject(result);
return SSIResponse.ok(jsonObject);
}
/**
* 删除地图图形数据
*/
@LogAudit
@ApiOperation(value = "删除地图图形数据", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/delete")
public SSIResponse deleteData(@RequestBody MapDataDto mapdata) {
JSONObject param = new JSONObject();
if (StringUtils.isBlank(mapdata.getId())||StringUtils.isBlank(mapdata.getType())) {
return SSIResponse.no("请输入ID");
}
if("11".equals(mapdata.getType())){
//属于电子围栏
SSIResponse ssiResponse = vmsAreaBarrierService.deleteMapData(mapdata);
return SSIResponse.ok(ssiResponse);
}
List<Integer> tempId = new ArrayList<>();
String[] ids = mapdata.getId().split(",");
for (String id : ids) {
if (StringUtils.isNumeric(id)) {
tempId.add(Integer.parseInt(id));
} else {
return SSIResponse.no("请输入数字ID");
}
}
String paramData = JSONObject.toJSONString(tempId);
log.info(String.format("绘制地图区域删除请求发送:----%s", paramData));
String result = RestTemplateUtil.post(String.format("%s%s", mapEditUrl, URL.MAP_Delete_URL), paramData, null);
log.info(String.format("绘制地图区域保删除返回结果:----%s", result));
JSONObject jsonObject = JSONObject.parseObject(result);
return SSIResponse.ok(jsonObject);
}
/**
* 修改图图形数据
*/
@LogAudit
@ApiOperation(value = "修改地图图形数据", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/updateMapData")
public SSIResponse updateMapData(@RequestBody MapDataDto mapdata) {
JSONObject param = new JSONObject();
if (StringUtils.isBlank(mapdata.getId())) {
return SSIResponse.no("请输入ID");
}
if("11".equals(mapdata.getType())){
//属于电子围栏
SSIResponse ssiResponse = vmsAreaBarrierService.updateMapData(mapdata);
return SSIResponse.ok(ssiResponse);
}
if (StringUtils.isNotBlank(mapdata.getPoints())) {
List<Double> pointList = new ArrayList<>();
String[] points = mapdata.getPoints().split(";");
for (String point : points) {
String[] loglat = point.split(",");
pointList.add(Double.valueOf(loglat[0]));
pointList.add(Double.valueOf(loglat[1]));
}
if (pointList.size() < 8) {
return SSIResponse.no("区域绘制不规范,请至少绘制4个点");
}
param.put("lng1", pointList.get(0));
param.put("lat1", pointList.get(1));
param.put("lng2", pointList.get(2));
param.put("lat2", pointList.get(3));
param.put("lng3", pointList.get(4));
param.put("lat3", pointList.get(5));
param.put("lng4", pointList.get(6));
param.put("lat4", pointList.get(7));
}
if (StringUtils.isNotBlank(mapdata.getField())) {
if (mapdata.getField().equals("E") || mapdata.getField().equals("F")) {
param.put("field", mapdata.getField());// 场区(E/F)
} else {
return SSIResponse.no("场区字段有误,请填写E/F");
}
}
if (StringUtils.isNotBlank(mapdata.getPlacetype())) {
param.put("placeType", mapdata.getPlacetype());// 区域类型。1桥下,2桥后
}
if (StringUtils.isNotBlank(mapdata.getNumber())) {
if (mapdata.getNumber().length() < 4) {
return SSIResponse.no("请输入至少4位编号");
}
param.put("name", mapdata.getNumber());// 名称
if (StringUtils.isNumeric(mapdata.getNumber().substring(1))
&& StringUtils.isAlpha(mapdata.getNumber().substring(0, 1))) {
param.put("seq", mapdata.getNumber().substring(1));// 编号
} else {
return SSIResponse.no("请输入正确的编号,头一位为字母,后面为数字");
}
// param.put("seq",Integer.valueOf(mapdata.getNumber().substring(1,4)));//编号
}
if (StringUtils.isNotBlank(mapdata.getType())) {
param.put("type", mapdata.getType());// 类型。1缓冲区;2停车区;3:充电区
}
param.put("id", mapdata.getId());// 区域类型。1桥下,2桥后
if (StringUtils.isNotBlank(mapdata.getState())) {
param.put("state", mapdata.getState());// 状态。0可用;1不可用(初始状态);2已计划;3有车
}
if (StringUtils.isNotBlank(mapdata.getPriority())) {
param.put("priority", mapdata.getPriority());// 状态。0可用;1不可用(初始状态);2已计划;3有车
}
param.put("bridgeNo", mapdata.getBridgeNo());
param.put("taskType", mapdata.getTaskType());
String paramData = JSONObject.toJSONString(param);
log.info(String.format("绘制地图区域update请求发送:----%s", paramData));
String result = RestTemplateUtil.post(String.format("%s%s", mapEditUrl, URL.MAP_EDIT_URL), paramData, null);
log.info(String.format("绘制地图区域update返回结果:----%s", result));
JSONObject jsonObject = JSONObject.parseObject(result);
if(Objects.nonNull(jsonObject)&&jsonObject.getInteger("code")==1){//成功则更新
vmsAreaBusinessInfoService.updatePassArea(mapdata);
}
return SSIResponse.ok(jsonObject);
}
@LogAudit
@ApiOperation(value = "批量修改地图图形数据", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/batchUpdateMapData")
public SSIResponse batchUpdateMapData(@RequestBody String mapdatas) {
if(StringUtils.isBlank(mapdatas)){
return SSIResponse.no("数据为空");
}
List<MapDataDto> list = JSONObject.parseArray(mapdatas,MapDataDto.class);
for(MapDataDto mapdata: list){
return this.updateMapData(mapdata);
}
return SSIResponse.no("数据为空");
}
/**
* 查询地图图形数据
*/
@LogAudit
@ApiOperation(value = "查询地图图形数据", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/query")
public SSIResponse queryData(@RequestBody MapDataDto mapdata) {
JSONObject param = new JSONObject();
if (StringUtils.isNotBlank(mapdata.getPoints())) {
param.put("priority", mapdata.getPoints());
}
if (StringUtils.isNotBlank(mapdata.getNumber())) {
param.put("name", mapdata.getNumber());// 名称
}
if (StringUtils.isNotBlank(mapdata.getType())) {
param.put("type", mapdata.getType());// 类型。1缓冲区;2停车区;3:充电区
}
if (StringUtils.isNotBlank(mapdata.getState())) {
param.put("state", mapdata.getState());// 状态。0可用;1不可用(初始状态);2已计划;3有车
}
if (StringUtils.isNotBlank((mapdata.getPlacetype()))) {
param.put("state", mapdata.getPlacetype());// 状态。0可用;1不可用(初始状态);2已计划;3有车
}
String paramData = JSONObject.toJSONString(param);
log.debug(String.format("绘制地图区域请求发送:----%s", paramData));
String result = RestTemplateUtil.post(String.format("%s%s", mapEditUrl, URL.MAP_QUERY_URL), paramData, null);
log.debug(String.format("绘制地图区域请求返回结果:----%s", result));
JSONObject jsonObject = JSONObject.parseObject(result);
if(Objects.nonNull(jsonObject)&&jsonObject.getInteger("code")==1){
vmsAreaBarrierService.addBarrierMap(mapdata,jsonObject);//添加电子围栏
vmsCranePadBindService.addCarineInfo(jsonObject);//添加绑定桥吊信息
componentBusinessParam(mapdata,jsonObject);//添加业务参数
}
return SSIResponse.ok(jsonObject);
}
private void componentBusinessParam(MapDataDto mapdata,JSONObject jsonObject) {
JSONArray dataList = jsonObject.getJSONArray("data");
Set<String> bindedAreas = qryBindedArea();
for(int i = 0; i< dataList.size();i++){
JSONObject object = dataList.getJSONObject(i);
List<VmsAreaBusinessInfo> vmsAreaBusinessInfos = vmsAreaBusinessInfoService.lambdaQuery().eq(VmsAreaBusinessInfo::getAreaId, object.getString("id"))
.eq(Objects.nonNull(mapdata.getTaskType()), VmsAreaBusinessInfo::getTaskType, mapdata.getTaskType())
.list();
object.put("taskType",null);
object.put("bridge",null);
object.put("isBinded",0);
List<String> collect = vmsAreaBusinessInfos.stream().map(VmsAreaBusinessInfo::getBridge).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(vmsAreaBusinessInfos)){
object.put("taskType",vmsAreaBusinessInfos.get(0).getTaskType());
object.put("bridge",StringUtils.join(collect,","));
}
//标记绑定缓冲区
if(bindedAreas.contains(object.getString("name"))){
object.put("isBinded",1);
}
}
}
private Set<String> qryBindedArea() {
Set<String> result = new TreeSet<>();
try{
CraneInfo craneInfo = new CraneInfo();
craneInfo.setCraneType(1);
craneInfo.setTaskTypes(Arrays.asList(1,2));
SSIResponse ssiResponse = craneInfoService.queryCraneList(craneInfo);
if(ssiResponse.getCode()==1){
List<JSONObject> data = (List<JSONObject>)ssiResponse.getData();
data.forEach( item -> {
JSONArray passArea = item.getJSONArray("passArea");
result.addAll(passArea.toJavaList(String.class));
});
}
}catch (Exception e){
log.error("qryBindedArea occur error:",e);
}
return result;
}
/**
* 车位优先级修改
*/
@LogAudit
@ApiOperation(value = "车位优先级修改(批量)", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/updatePri")
public SSIResponse updatePri(@RequestBody MapDataDto mapdata) {
JSONObject param = new JSONObject();
if (StringUtils.isBlank(mapdata.getId())) {
return SSIResponse.no("请输入ID");
}
if (StringUtils.isBlank(mapdata.getPriority())) {
return SSIResponse.no("请选择优先级");
}
List<Integer> tempId = new ArrayList<>();
String[] ids = mapdata.getId().split(",");
for (String id : ids) {
if (StringUtils.isNumeric(id)) {
tempId.add(Integer.parseInt(id));
} else {
return SSIResponse.no("请输入数字ID");
}
}
param.put("ids", tempId);
param.put("priority", mapdata.getPriority());
String paramData = JSONObject.toJSONString(param);
log.info(String.format("绘制地图区域保存请求发送:----%s", paramData));
String result = RestTemplateUtil.post(String.format("%s%s", mapEditUrl, URL.MAP_priority_URL), paramData, null);
log.info(String.format("绘制地图区域保存返回结果:----%s", result));
JSONObject jsonObject = JSONObject.parseObject(result);
return SSIResponse.ok(jsonObject);
}
/**
* 查询地图图形数据
*/
@LogAudit
@ApiOperation(value = "车位优先级修改(批量)", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/updateSate")
public SSIResponse updateSate(@RequestBody MapDataDto mapdata) {
JSONObject param = new JSONObject();
if (StringUtils.isBlank(mapdata.getId())) {
return SSIResponse.no("请输入ID");
}
if (StringUtils.isBlank(mapdata.getState())) {
return SSIResponse.no("请选择状态");
}
List<Integer> tempId = new ArrayList<>();
String[] ids = mapdata.getId().split(",");
for (String id : ids) {
if (StringUtils.isNumeric(id)) {
tempId.add(Integer.parseInt(id));
} else {
return SSIResponse.no("请输入数字ID");
}
}
param.put("ids", tempId);
param.put("state", mapdata.getState());
String paramData = JSONObject.toJSONString(param);
log.info(String.format("绘制地图区域保存请求发送:----%s", paramData));
String result = RestTemplateUtil.post(String.format("%s%s", mapEditUrl, URL.MAP_UPDATE_STATE_URL), paramData,
null);
log.info(String.format("绘制地图区域保存返回结果:----%s", result));
JSONObject jsonObject = JSONObject.parseObject(result);
return SSIResponse.ok(jsonObject);
}
// private SSIResponse<?> handleResult(String result) {
// JSONObject jsonObject = JSONObject.parseObject(result);
// for(String str:jsonObject.keySet()) {
// if(jsonObject.get("code").equals("1")) {
// return SSIResponse.ok();
// }else {
// log.error(jsonObject.get("msg").toString());
// return SSIResponse.no(jsonObject.get("msg").toString());
// }
//
// }
//
// return SSIResponse.ok();
// }
/**
* 查询地图图形数据
*/
@LogAudit
@ApiOperation(value = "查询地图图形数据", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/queryCacheArea")
public SSIResponse queryCacheArea(@RequestBody MapDataDto mapdata) {
JSONObject param = new JSONObject();
if (StringUtils.isNotBlank(mapdata.getPoints())) {
param.put("priority", mapdata.getPoints());
}
if (StringUtils.isNotBlank(mapdata.getNumber())) {
param.put("name", mapdata.getNumber());// 名称
}
if (StringUtils.isNotBlank(mapdata.getType())&&!"1".equalsIgnoreCase(mapdata.getType())) {
param.put("type", mapdata.getType());// 类型。1缓冲区;2停车区;3:充电区
}
if (StringUtils.isNotBlank(mapdata.getState())) {
param.put("state", mapdata.getState());// 状态。0可用;1不可用(初始状态);2已计划;3有车
}
if (StringUtils.isNotBlank((mapdata.getPlacetype()))) {
param.put("state", mapdata.getPlacetype());// 状态。0可用;1不可用(初始状态);2已计划;3有车
}
String paramData = JSONObject.toJSONString(param);
log.debug(String.format("绘制地图区域请求发送:----%s", paramData));
String result = RestTemplateUtil.post(String.format("%s%s", mapEditUrl, URL.MAP_QUERY_URL), paramData, null);
log.debug(String.format("绘制地图区域请求返回结果:----%s", result));
JSONObject jsonObject = JSONObject.parseObject(result);
if(Objects.nonNull(jsonObject)&&jsonObject.getInteger("code")==1){
JSONArray data = jsonObject.getJSONArray("data");
List<JSONObject> results = data.toJavaList(JSONObject.class).stream().filter((obj) -> {
if(StringUtils.isNotBlank(mapdata.getType())&&!"1".equalsIgnoreCase(mapdata.getType())){
return true;
}
if (!"1,5".contains(obj.getString("type"))) {
return false;
}
return true;
}).sorted((a, b) -> {
String oa = a.getString("name").replaceAll("^\\w","");
String ob = b.getString("name").replaceAll("^\\w","");
return Integer.valueOf(oa).compareTo(Integer.valueOf(ob));
}).collect(Collectors.toList());
jsonObject.put("data",results);
}
return SSIResponse.ok(jsonObject);
}
}
package com.ssi.controller.platform;
import com.ssi.task.ChargingManageTask;
import com.ssi.task.TELDStationSyncTask;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @author SunnyHotz
* @PackageName:com.ssi.controller.platform
* @ClassName:ChargingManualController
* @Description:
* @date 2022/8/31 13:16
*/
@Api(tags = "充电手动调用", description = "充电手动调用")
@RestController
@RequestMapping("/chargingManual")
@Slf4j
public class ChargingManualController {
@Autowired
private ChargingManageTask chargingManageTask;
@Autowired
private TELDStationSyncTask teldStationSyncTask;
@GetMapping("/invokeForCharging")
public void invokeForCharging() throws Exception {
chargingManageTask.invokeForCharging();
}
@GetMapping("/syncEquipment")
public void syncEquipment() throws Exception {
teldStationSyncTask.syncEquipmentInfo();
}
@GetMapping("/syncConnectorStatus")
public void syncConnectorStatus() throws Exception {
teldStationSyncTask.syncConnectorStatus();
}
@GetMapping("/getWorkableVehicle")
public String getWorkableVehicle(@RequestParam("taskNo") String taskNo) throws Exception {
return chargingManageTask.getWorkableVehicle(taskNo);
}
}
package com.ssi.controller.platform;
import com.google.common.collect.Sets;
import com.ssi.service.platform.RedisConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Description:
*
* @author LiXiaoCong
* @version 2019/10/17 10:29
*/
@Api(tags = "数据配置接口", description = "用于配置设置相关")
@RestController
@RequestMapping("/config")
@Slf4j
@CrossOrigin(allowCredentials = "true", exposedHeaders = "access-control-allow-headers,access-control-allow-methods,access-control-allow-origin,access-control-max-age,X-Frame-Options,userAuth")
public class RedisConfigController {
@Autowired
private RedisConfigService redisConfigService;
@ApiOperation(value = "设置单个配置")
@ApiImplicitParams({
@ApiImplicitParam(name = "group", value = "配置组", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "key", value = "key", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "value", value = "value", dataType = "String", paramType = "query", required = true),
})
@GetMapping(value = "setConfig", produces = {"application/json"})
public void setConfig(String group, String key, String value) {
redisConfigService.setConfig(group, key, value);
}
@ApiOperation(value = "获取单个配置")
@ApiImplicitParams({
@ApiImplicitParam(name = "group", value = "配置组", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "key", value = "key", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "defaultValue", value = "value", dataType = "String", paramType = "query"),
})
@GetMapping(value = "getConfigWithDefault", produces = {"application/json"})
public Object getConfigWithDefault(String group, String key, String defaultValue) {
return redisConfigService.getConfigWithDefault(group, key, defaultValue);
}
@ApiOperation(value = "获取单个配置")
@ApiImplicitParams({
@ApiImplicitParam(name = "group", value = "配置组", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "key", value = "key", dataType = "String", paramType = "query", required = true)
})
@GetMapping(value = "getConfig", produces = {"application/json"})
public Object getConfig(String group, String key) {
return redisConfigService.getConfig(group, key);
}
@ApiOperation(value = "获取多个配置")
@ApiImplicitParams({
@ApiImplicitParam(name = "group", value = "配置组", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "keys", value = "key", dataType = "String", paramType = "query", required = true)
})
@GetMapping(value = "getConfigs", produces = {"application/json"})
public Object getConfigs(String group, String keys) {
return redisConfigService.getConfigs(group, Sets.newHashSet(keys.split(",")));
}
@ApiOperation(value = "删除配置")
@ApiImplicitParams({
@ApiImplicitParam(name = "group", value = "配置组", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "keys", value = "key", dataType = "String", paramType = "query", required = true)
})
@GetMapping(value = "deteleConfigs", produces = {"application/json"})
public void deteles(String group, String keys) {
redisConfigService.deteles(group, keys.split(","));
}
}
package com.ssi.controller.platform;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ssi.entity.dto.RtkLocationDto;
import com.ssi.response.SSIResponse;
import com.ssi.utils.RestTemplateUtil;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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;
@RestController
@RequestMapping("/api/rtk")
@Slf4j
public class RtkLocationController {
/**
* 接收RTK定位
*/
@PostMapping("/location")
@ApiOperation(value = "缓冲区车位新增", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse location(@RequestBody RtkLocationDto dto) {
log.info("接收RTK定位请求:{}", JSON.toJSONString(dto));
String url = "http://10.11.10.33:8030/api/rtk/location";
String result = RestTemplateUtil.post(url, JSON.toJSONString(dto),null);
log.info("返回结果:{}",result);
JSONObject resultJson = JSONObject.parseObject(result);
Integer code = resultJson.getInteger("code");
if (code == 1) {
return SSIResponse.ok();
}
return SSIResponse.no("保存定位失败");
}
}
package com.ssi.controller.platform;
import com.ssi.entity.dto.SwitchAutoParamDto;
import com.ssi.entity.dto.TelecontrolParamDto;
import com.ssi.model.TelecontrolModel;
import com.ssi.response.SSIResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MimeTypeUtils;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* APP指令控制器
* @author ZhangLiYao
* @version 1.0
* @date 2020/9/01 10:20
*/
@Api
@RestController
@RequestMapping("/telecontrol")
public class TelecontrolTakeOverController {
@Autowired
private TelecontrolModel telecontrolModel;
/**
* APP接管指令下发
*/
@PostMapping("/vehicleTelecontrol")
@ApiOperation(value = "指令下发", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse vehicleTelecontrol(@RequestBody @Valid TelecontrolParamDto telecontrolParamDto) {
return telecontrolModel.vehicleTelecontrol(telecontrolParamDto);
}
@PostMapping("/testResult")
@ApiOperation(value = "", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public String testResult() {
String result = "{\"data\": {\"result\":1,\"ADCUStatus\":1}," +
"\"status\": {\"msg\": \"成功\",\"code\": \"0000\",\"details\": \"\"}}";
String result2 = "{\"data\": {\"result\":2,\"ADCUStatus\":1}," +
"\"status\": {\"msg\": \"成功\",\"code\": \"0000\",\"details\": \"\"}}";
String result3 = "{\"data\": {\"result\":1,\"ADCUStatus\":2}," +
"\"status\": {\"msg\": \"成功\",\"code\": \"0000\",\"details\": \"\"}}";
String result4 = "{\"data\": {\"result\":1,\"ADCUStatus\":2}," +
"\"status\": {\"msg\": \"成功\",\"code\": \"9999\",\"details\": \"\"}}";
int i = RandomUtils.nextInt(1,5);
if(i == 1){
return result;
}else if(i == 2){
return result2;
}else if(i == 3){
return result3;
}else if(i == 4){
return result4;
}
return result;
}
/**
* 切换自动驾驶下发
*/
@PostMapping("/switch/autopilot")
@ApiOperation(value = "切换自动驾驶下发", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
public SSIResponse switchAutopilot(@RequestBody @Valid SwitchAutoParamDto paramDto) {
return telecontrolModel.switchAutopilot(paramDto);
}
}
package com.ssi.controller.platform;
import com.ssi.entity.VmsTrafficLightInfo;
import com.ssi.response.SSIPage;
import com.ssi.response.SSIResponse;
import com.ssi.service.VmsTrafficLightInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.MimeTypeUtils;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
/**
* @author SunnyHotz
* @PackageName:com.ssi.controller.platform
* @ClassName:TrafficLightController
* @Description:
* @date 2022/9/7 16:29
*/
@Api("交通灯控制器")
@RestController
@RequestMapping("/trafficLight")
public class TrafficLightController{
@Autowired
private VmsTrafficLightInfoService vmsTrafficLightInfoService;
@ApiOperation(value = "获得交通灯列表", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/list")
public SSIResponse list(@RequestBody VmsTrafficLightInfo req) {
SSIPage page = vmsTrafficLightInfoService.queryPage(req);
return SSIResponse.ok(page);
}
@ApiOperation(value = "更新交通灯", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/update")
public SSIResponse update(@RequestBody VmsTrafficLightInfo req) {
vmsTrafficLightInfoService.updateById(req);
return SSIResponse.ok();
}
@ApiOperation(value = "控制交通灯", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/manual")
public SSIResponse manual(@RequestBody VmsTrafficLightInfo req) {
String manual = vmsTrafficLightInfoService.manual(req);
if(StringUtils.isNotBlank(manual)){
return SSIResponse.no(manual);
}
return SSIResponse.ok();
}
@ApiOperation(value = "新增", response = SSIResponse.class, produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
@PostMapping("/add")
public SSIResponse add(@RequestBody VmsTrafficLightInfo req) {
vmsTrafficLightInfoService.save(req);
return SSIResponse.ok();
}
@ApiOperation(value = "删除", response = SSIResponse.class)
@GetMapping("/delete")
public SSIResponse delete(@RequestParam("ids") String ids) {
vmsTrafficLightInfoService.removeByIds(Arrays.asList(ids.split(",")));
return SSIResponse.ok();
}
}
package com.ssi.controller.platform;
import com.ssi.service.platform.VehicleLatestDataService;
import com.ssi.service.platform.VehicleMonitorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* description:
*
* @author WangHD
* @version 1.0
* @date 2020/3/20 0020 9:53
*/
@Api(tags = "车辆监控接口", description = "实时监控")
@RestController
@RequestMapping("/vehicle/monitor/")
@Slf4j
@CrossOrigin(allowCredentials = "true", exposedHeaders = "access-control-allow-headers,access-control-allow-methods,access-control-allow-origin,access-control-max-age,X-Frame-Options,userAuth")
public class VehicleMonitorController {
@Autowired
private VehicleLatestDataService vehicleLatestDataService;
@Autowired
private VehicleMonitorService vehicleMonitorService;
/**
* key给车辆vin组合成的string
*/
@ApiOperation(value = "查询在线数据")
@ApiImplicitParams({@ApiImplicitParam(name = "key", value = "key", dataType = "String", paramType = "query", required = true)})
@RequestMapping(value = "getOnlineData", method = {RequestMethod.GET})
public Object getOnlineData(String key) {
return vehicleLatestDataService.getOnlineData(key);
}
@ApiOperation(value = "车辆状态")
@ApiImplicitParams({
@ApiImplicitParam(name = "vin", value = "vin", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "status", value = "status:0、离线,1、在线,2、行驶中", dataType = "String", paramType = "query", required = true)
})
@RequestMapping(value = "getVehicleStatus", method = {RequestMethod.GET})
public Object getVehicleStatus(String vin, Integer status) {
return vehicleLatestDataService.getVehicleStatus(vin, status);
}
@ApiOperation(value = "车载视频列表(内网)")
@ApiImplicitParams({
@ApiImplicitParam(name = "vin", value = "车辆唯一编码", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "isHistory", defaultValue = "", value = "是否历史回放", dataType = "String", paramType = "query", required = false),
})
@GetMapping(value = "getCarVideoList", produces = {"application/json"})
public Object getCarVideoList(@RequestParam(value = "vin") String vin, String isHistory) {
if ("1".equals(isHistory)) {
//演示用
return vehicleMonitorService.getCarHistoryVideoList(vin);
}
return vehicleMonitorService.getCarVideoList(vin);
// return vehicleMonitorService.getCarVideoPlayingList(vin);
}
@ApiOperation(value = "车载视频播放列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "vin", value = "车辆唯一编码", dataType = "String", paramType = "query", required = true)
})
@GetMapping(value = "getCarVideoPlayingList", produces = {"application/json"})
public Object getCarVideoPlayingList(@RequestParam(value = "vin") String vin) {
return vehicleMonitorService.getCarVideoPlayingList(vin);
}
@ApiOperation(value = "离线车辆列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "vehicleCompany", defaultValue = "", value = "车企", dataType = "String", paramType = "query", required = false),
@ApiImplicitParam(name = "vehicleType", defaultValue = "", value = "车型", dataType = "String", paramType = "query", required = false),
@ApiImplicitParam(name = "offlineDays", defaultValue = "", value = "离线天数", dataType = "String", paramType = "query", required = false)
})
@GetMapping(value = "getOfflineVehicleList", produces = {"application/json"})
public Object getOfflineVehicleList(String vehicleCompany, String vehicleType, @RequestParam("offlineDays") Integer offlineDays) {
return vehicleMonitorService.getOfflineVehicleList(vehicleCompany, vehicleType, offlineDays, 1, 1000);
}
}
package com.ssi.controller.platform;
import com.ssi.entity.ScrollTrackLocationEntity;
import com.ssi.response.SSIResponse;
import com.ssi.service.platform.VehicleTrackService;
import com.ssi.websocket.ReplaySocketServer;
import com.ssi.websocket.push.task.ReplayTask;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
* Description:
* 车辆轨迹查询控制器
*
* @author LiXiaoCong
* @version 2020/2/8 12:54
*/
@Api(tags = "车辆轨迹查询控制器", description = "车辆历史轨迹查询")
@RestController
@RequestMapping("/vehicle/track")
@Slf4j
@CrossOrigin(allowCredentials = "true", exposedHeaders = "access-control-allow-headers,access-control-allow-methods,access-control-allow-origin,access-control-max-age,X-Frame-Options,userAuth")
public class VehicleTrackController {
@Autowired
private VehicleTrackService vehicleTrackService;
@ApiOperation(value = "车辆历史轨迹 游标分页查询 - 适用于结果数据大于1w条的轨迹查询", produces = "application/json")
@RequestMapping(value = "scrollTrack", method = {RequestMethod.POST})
public Object scrollTrack(@RequestBody @Valid ScrollTrackLocationEntity scrollTrackLocationEntity) {
return vehicleTrackService.scrollTrack(scrollTrackLocationEntity);
}
@ApiOperation(value = "车辆历史轨迹 - 厦门港查询两小时内全部数据", produces = "application/json")
@RequestMapping(value = "smallTrack", method = {RequestMethod.GET})
@ApiImplicitParams({
@ApiImplicitParam(name = "vin", value = "车辆vin,仅支持单个", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "startTime", value = "轨迹开始时间", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "stopTime", value = "轨迹结束时间", dataType = "String", paramType = "query", required = true),
@ApiImplicitParam(name = "posType", value = "目标坐标系, 高德:gcj02, 百度:bd09 ", dataType = "String", paramType = "query")
})
public Object smallTrack(@RequestParam String vin, @RequestParam Long startTime, @RequestParam Long stopTime,
String posType) {
return vehicleTrackService.smallTrack(vin, startTime, stopTime, posType);
}
@ApiOperation(value = "车辆历史轨迹 - 厦门港查询两小时内全部数据", produces = "application/json")
@RequestMapping(value = "replayVehicle", method = {RequestMethod.GET})
public void replayVehicle(@RequestParam String vin, @RequestParam Long startTime, @RequestParam Long stopTime,
String posType) {
SSIResponse response = vehicleTrackService.smallTrack(vin, startTime, stopTime, posType);
ReplayTask.setReplayCache((List<Map<String, Object>>) response.getData());
}
}
package com.ssi.dcvp;
import lombok.Data;
@Data
public class BasePageParam {
private int pageIndex;
private int pageSize;
}
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