fast()预警报警,优化电子围栏
parent
32e2ff6ee6
commit
9b0a07484a
|
@ -11,6 +11,10 @@ import java.util.Date;
|
|||
|
||||
@Data
|
||||
public class BreakdownSel{
|
||||
/**
|
||||
* 车辆
|
||||
*/
|
||||
private String vin;
|
||||
/**
|
||||
* 多
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.business.common.domain;
|
||||
|
||||
import com.business.common.middle.GroupFenceDev;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -17,4 +18,9 @@ public class FenceGroups {
|
|||
* 围栏组名称
|
||||
*/
|
||||
private String groupsName;
|
||||
/**
|
||||
* 围栏组所属电子围栏
|
||||
*/
|
||||
private List<GroupFenceDev> fenceList;
|
||||
|
||||
}
|
||||
|
|
|
@ -6,14 +6,18 @@ import com.business.common.domain.FaultCode;
|
|||
import com.business.common.domain.Sources;
|
||||
import com.business.common.psvm.FaultInfo;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.goods.incident.mq.Producer;
|
||||
import com.muyu.goods.service.IBreakdownService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -27,21 +31,26 @@ public class BreakdownController extends BaseController {
|
|||
@Autowired
|
||||
private Producer producer;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 查询故障列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Breakdown>> list( )
|
||||
public Result<TableDataInfo<Breakdown>> list(Breakdown breakdown)
|
||||
{
|
||||
startPage();
|
||||
List<Breakdown> list = service.selectBreakdownList();
|
||||
List<Breakdown> list = service.selectBreakdownList(breakdown);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出故障列表
|
||||
*/
|
||||
@Log(title = "故障", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Breakdown breakdown)
|
||||
{
|
||||
List<Breakdown> list = service.selectBreakdownList(breakdown);
|
||||
ExcelUtil<Breakdown> util = new ExcelUtil<Breakdown>(Breakdown.class);
|
||||
util.exportExcel(response, list, "故障数据");
|
||||
}
|
||||
|
||||
@PostMapping("/lists")
|
||||
public Result<List<Breakdown>> lists() {
|
||||
List<Breakdown> list = service.lists();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.goods.controller;
|
||||
|
||||
import com.business.common.dev.CarFenceGroupsDev;
|
||||
import com.business.common.domain.Path;
|
||||
import com.business.common.middle.CarFenceDev;
|
||||
import com.business.common.middle.CarGroupsDev;
|
||||
import com.business.common.middle.GroupFenceDev;
|
||||
|
@ -45,7 +46,7 @@ public class MapController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@PostMapping("selectFenceGroupsById/{carId}")
|
||||
public Result<List<List<GroupFenceDev>>> selectFenceGroupsById(@PathVariable Long carId){
|
||||
public Result<List<GroupFenceDev>> selectFenceGroupsById(@PathVariable Long carId){
|
||||
return success(iMapService.selectFenceGroupsById(carId));
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,7 @@ public class MapController extends BaseController {
|
|||
* @return
|
||||
*/
|
||||
@PostMapping("getSel")
|
||||
public Result getSel(@RequestBody Pences list){
|
||||
public Result getSel(@RequestBody List<Path> list){
|
||||
return success(iMapService.getSel(list));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.business.common.Select.BreakdownSel;
|
|||
import com.business.common.domain.Breakdown;
|
||||
import com.business.common.domain.Car;
|
||||
import com.business.common.domain.FaultCode;
|
||||
import com.business.common.psvm.FaultInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -19,7 +18,13 @@ public interface BreakdownMapper {
|
|||
|
||||
Car selectVinCar(@Param("vin") String vin);
|
||||
|
||||
List<Breakdown> selectBreakdownList();
|
||||
/**
|
||||
* 查询故障列表
|
||||
*
|
||||
* @param breakdown 故障
|
||||
* @return 故障集合
|
||||
*/
|
||||
public List<Breakdown> selectBreakdownList(Breakdown breakdown);
|
||||
|
||||
List<Map<String, Object>> pies(BreakdownSel breakdownSel);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||
|
||||
public interface MapMapper {
|
||||
|
||||
List<FenceGroups> selectFenceGroups();
|
||||
List<FenceGroups> selectFenceGroups();
|
||||
|
||||
List<Fence> selectFence();
|
||||
|
||||
|
@ -43,4 +43,6 @@ public interface MapMapper {
|
|||
FenceGroups selectFenceGroupsByOne();
|
||||
|
||||
void indexCarGroupsDev(@Param("carId") Long carId, @Param("groupsId") Long groupsId);
|
||||
|
||||
void indexFence(Fence fence);
|
||||
}
|
||||
|
|
|
@ -4,17 +4,18 @@ import com.business.common.Select.BreakdownSel;
|
|||
import com.business.common.domain.Breakdown;
|
||||
import com.business.common.domain.FaultCode;
|
||||
import com.business.common.domain.Sources;
|
||||
import com.business.common.psvm.FaultInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IBreakdownService {
|
||||
/**
|
||||
* 故障记录
|
||||
* @return
|
||||
* 查询故障列表
|
||||
*
|
||||
* @param breakdown 故障
|
||||
* @return 故障集合
|
||||
*/
|
||||
List<Breakdown> selectBreakdownList();
|
||||
public List<Breakdown> selectBreakdownList(Breakdown breakdown);
|
||||
|
||||
List<Breakdown> lists();
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.goods.service;
|
||||
|
||||
import com.business.common.dev.CarFenceGroupsDev;
|
||||
import com.business.common.domain.Path;
|
||||
import com.business.common.middle.CarFenceDev;
|
||||
import com.business.common.middle.CarGroupsDev;
|
||||
import com.business.common.middle.GroupFenceDev;
|
||||
|
@ -17,9 +18,9 @@ public interface IMapService {
|
|||
|
||||
List<Fence> selectFence();
|
||||
|
||||
List<List<GroupFenceDev>> selectFenceGroupsById(Long carId);
|
||||
List<GroupFenceDev> selectFenceGroupsById(Long carId);
|
||||
|
||||
String getSel(Pences list);
|
||||
String getSel(List<Path> list);
|
||||
|
||||
String deleteFence(Long fenceId);
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.business.common.domain.Breakdown;
|
|||
import com.business.common.domain.Car;
|
||||
import com.business.common.domain.FaultCode;
|
||||
import com.business.common.domain.Sources;
|
||||
import com.business.common.psvm.FaultInfo;
|
||||
import com.muyu.common.goods.domain.Enterprise;
|
||||
import com.muyu.common.goods.remote.RemoteSourcesService;
|
||||
import com.muyu.common.system.domain.SysUser;
|
||||
|
@ -29,13 +28,15 @@ public class BreakdownService implements IBreakdownService {
|
|||
private RemoteSourcesService remoteSourcesService;
|
||||
|
||||
/**
|
||||
* 故障记录
|
||||
* @param breakdown
|
||||
* @return
|
||||
* 查询故障列表
|
||||
*
|
||||
* @param breakdown 故障
|
||||
* @return 故障
|
||||
*/
|
||||
@Override
|
||||
public List<Breakdown> selectBreakdownList() {
|
||||
return mapper.selectBreakdownList();
|
||||
public List<Breakdown> selectBreakdownList(Breakdown breakdown)
|
||||
{
|
||||
return mapper.selectBreakdownList(breakdown);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.goods.service.impl;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.business.common.dev.CarFenceGroupsDev;
|
||||
import com.business.common.domain.Path;
|
||||
import com.business.common.middle.CarFenceDev;
|
||||
import com.business.common.middle.CarGroupsDev;
|
||||
import com.business.common.middle.GroupFenceDev;
|
||||
|
@ -16,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
@ -30,6 +32,10 @@ public class MapService implements IMapService {
|
|||
@Override
|
||||
public List<FenceGroups> selectFenceGroups() {
|
||||
List<FenceGroups> fenceGroupsList = mapMapper.selectFenceGroups();
|
||||
for (FenceGroups fenceGroups : fenceGroupsList) {
|
||||
List<GroupFenceDev> groupFenceDevs = selectGroupFence().stream().filter(groupFenceDev -> groupFenceDev.getGroupsId() == fenceGroups.getGroupsId()).collect(Collectors.toList());
|
||||
fenceGroups.setFenceList(groupFenceDevs);
|
||||
}
|
||||
return fenceGroupsList;
|
||||
}
|
||||
|
||||
|
@ -49,16 +55,19 @@ public class MapService implements IMapService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<List<GroupFenceDev>> selectFenceGroupsById(Long carId) {
|
||||
public List<GroupFenceDev> selectFenceGroupsById(Long carId) {
|
||||
List<CarGroupsDev> carGroupsDevs = selectCarGroups();
|
||||
List<CarGroupsDev> carGroupsDevList = carGroupsDevs.stream().filter(group -> group.getCarId() == carId).collect(Collectors.toList());
|
||||
List<List<GroupFenceDev>> listList = new ArrayList<>();
|
||||
List<CarGroupsDev> groupsDevs = carGroupsDevs.stream().filter(carGroupsDev -> carGroupsDev.getCarId() == carId).collect(Collectors.toList());
|
||||
//围栏组和电子围栏
|
||||
List<GroupFenceDev> groupFenceDevs = selectGroupFence();
|
||||
for (CarGroupsDev carGroupsDev : carGroupsDevList) {
|
||||
List<GroupFenceDev> groupFenceDevList = groupFenceDevs.stream().filter(group -> group.getGroupsId() == carGroupsDev.getGroupsId()).collect(Collectors.toList());
|
||||
listList.add(groupFenceDevList);
|
||||
List<GroupFenceDev> groupFenceDevList = new ArrayList<>();
|
||||
for (CarGroupsDev groupsDev : groupsDevs) {
|
||||
for (GroupFenceDev groupFenceDev : groupFenceDevs.stream().filter(groupFenceDev -> groupFenceDev.getGroupsId() == groupsDev.getGroupsId()).collect(Collectors.toList())) {
|
||||
groupFenceDevList.add(groupFenceDev);
|
||||
}
|
||||
}
|
||||
return listList;
|
||||
System.out.println(groupFenceDevList);
|
||||
return groupFenceDevList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -67,9 +76,17 @@ public class MapService implements IMapService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getSel(Pences pences) {
|
||||
System.out.println(pences);
|
||||
return JSONObject.toJSONString(pences);
|
||||
public String getSel(List<Path> list) {
|
||||
Fence fence = new Fence();
|
||||
String jsonString = JSONObject.toJSONString(list);
|
||||
System.out.println(jsonString);
|
||||
fence.setPolygonPoints(jsonString);
|
||||
Random random = new Random();
|
||||
int i = random.nextInt(4);
|
||||
fence.setFenceName(String.valueOf(i));
|
||||
System.out.println(fence);
|
||||
// mapMapper.indexFence(fence);
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,14 +23,6 @@ spring:
|
|||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
kafka:
|
||||
bootstrap-servers: 129.211.23.219:9200 # kafka集群地址
|
||||
consumer:
|
||||
group-id: my-group #消费者组id
|
||||
auto-offset-reset: earliest #默认偏移量位置
|
||||
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer #键序列化器
|
||||
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer #值序列化器
|
||||
enable-auto-commit: false # 是否自动提交offset
|
||||
logging:
|
||||
level:
|
||||
com.muyu.rule.mapper: DEBUG
|
||||
|
|
|
@ -60,12 +60,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select *
|
||||
from car where vin = #{vin};
|
||||
</select>
|
||||
<select id="selectBreakdownList" resultType="com.business.common.domain.Breakdown">
|
||||
<include refid="selectBreakdownVo"></include>
|
||||
<select id="selectBreakdownList" resultType="com.business.common.domain.Breakdown" resultMap="BreakdownResult">
|
||||
<include refid="selectBreakdownVo"/>
|
||||
<where>
|
||||
<if test="vin != null and vin != ''"> and vin = #{vin}</if>
|
||||
<if test="faultStartTime != null">and fault_start_time >= #{faultStartTime} </if>
|
||||
<if test="faultEndTime != null ">and fault_start_time <= #{faultEndTime} </if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="pies" resultType="java.util.Map">
|
||||
select fault_code name, count(fault_code) value from breakdown
|
||||
<where>
|
||||
<if test="vin != null and vin != ''"> and vin = #{vin}</if>
|
||||
<if test="faultStartTime != null">and fault_start_time >= #{faultStartTime} </if>
|
||||
<if test="faultEndTime != null ">and fault_start_time <= #{faultEndTime} </if>
|
||||
</where>
|
||||
|
|
|
@ -32,7 +32,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="indexFence">
|
||||
insert into fence
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="groupId != null">group_id,</if>
|
||||
<if test="fenceName != null">fence_name,</if>
|
||||
<if test="fenceType != null">fence_type,</if>
|
||||
<if test="eventType != null">event_type,</if>
|
||||
|
@ -40,7 +39,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="polygonPoints != null">polygon_points,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="groupId != null">#{groupId},</if>
|
||||
<if test="fenceName != null">#{fenceName},</if>
|
||||
<if test="fenceType != null">#{fenceType},</if>
|
||||
<if test="eventType != null">#{eventType},</if>
|
||||
|
|
|
@ -43,4 +43,9 @@ public class CloudController {
|
|||
public Result<List<Status>> list(@RequestHeader("saas") String saas) {
|
||||
return Result.success(cloudService.list(saas));
|
||||
}
|
||||
|
||||
@PostMapping("index")
|
||||
public Result index(String name) {
|
||||
return Result.success(cloudService.index(name));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,5 @@ public interface CloudMapper extends BaseMapper<Status> {
|
|||
// List<Status> list();
|
||||
|
||||
<T> List<Status> list(QueryWrapper<T> tQueryWrapper);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,4 +8,6 @@ public interface CloudService {
|
|||
Object selSource();
|
||||
|
||||
List<Status> list(String saas);
|
||||
|
||||
Object index(String name);
|
||||
}
|
||||
|
|
|
@ -23,4 +23,9 @@ public class CloudServiceImpl implements CloudService {
|
|||
public List<Status> list(String saas) {
|
||||
return cloudMapper.list(new QueryWrapper<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object index(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.cloud.mapper.CloudMapper">
|
||||
|
||||
|
||||
<select id="selSource" resultType="java.lang.Object">
|
||||
select * from status
|
||||
</select>
|
||||
|
|
Loading…
Reference in New Issue