Commit 3a3584a7 authored by caotao's avatar caotao

解决循环依赖问题

parent ea6f6147
...@@ -12,6 +12,7 @@ import com.yeejoin.equipmanage.service.ICarService; ...@@ -12,6 +12,7 @@ import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce; import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -25,27 +26,22 @@ import java.util.stream.Collectors; ...@@ -25,27 +26,22 @@ import java.util.stream.Collectors;
/** /**
* 赋码动作 * 赋码动作
*
* @author DELL * @author DELL
*/ */
@Component @Component
@RuleActionBean(beanLabel = "动态预案") @RuleActionBean(beanLabel = "动态预案")
@Slf4j @Slf4j
public class UpdateQrCodeAction { public class UpdateQrCodeAction {
@Autowired
private ICarService carService;
@Autowired
private IEquipmentSpecificSerivce equipmentSpecificSerivce;
private final String SOURCE_ID = "sourceId";
private final String SOURCE_CAR = "car";
private final String SOURCE_EQUIP = "equip";
/** /**
* 开闭区间正则表达式 * 开闭区间正则表达式
*/ */
private static final Pattern NUM_RANGE_PATTERN = Pattern.compile("[\\[|\\(]\\s?\\d+\\s?,\\s?\\d+\\s?[\\)|\\]]"); private static final Pattern NUM_RANGE_PATTERN = Pattern.compile("[\\[|\\(]\\s?\\d+\\s?,\\s?\\d+\\s?[\\)|\\]]");
private final String SOURCE_ID = "sourceId";
private final String SOURCE_CAR = "car";
private final String SOURCE_EQUIP = "equip";
@Autowired
private IEquipmentSpecificSerivce equipmentSpecificSerivce;
@RuleMethod(methodLabel = "更新码", project = "车辆更新码颜色") @RuleMethod(methodLabel = "更新码", project = "车辆更新码颜色")
public void updateCarQrCode(@MethodParam(paramLabel = "判断值") String value, @MethodParam(paramLabel = "赋码颜色") String color, public void updateCarQrCode(@MethodParam(paramLabel = "判断值") String value, @MethodParam(paramLabel = "赋码颜色") String color,
...@@ -86,7 +82,7 @@ public class UpdateQrCodeAction { ...@@ -86,7 +82,7 @@ public class UpdateQrCodeAction {
if (!CollectionUtils.isEmpty(collect)) { if (!CollectionUtils.isEmpty(collect)) {
switch (source) { switch (source) {
case SOURCE_CAR: case SOURCE_CAR:
carService.updateCarQrCode(collect, color); equipmentSpecificSerivce.updateCarQrCode(collect, color);
break; break;
case SOURCE_EQUIP: case SOURCE_EQUIP:
equipmentSpecificSerivce.updateEquipQrCode(collect, color); equipmentSpecificSerivce.updateEquipQrCode(collect, color);
...@@ -99,7 +95,7 @@ public class UpdateQrCodeAction { ...@@ -99,7 +95,7 @@ public class UpdateQrCodeAction {
} }
} }
private Map<String, String> getId (Map<String, String> map, String rule, String value, String compareValue) { private Map<String, String> getId(Map<String, String> map, String rule, String value, String compareValue) {
Map<String, String> mapNew = new HashMap<>(); Map<String, String> mapNew = new HashMap<>();
CalculationRulesEnum anEnum = CalculationRulesEnum.getEnum(rule); CalculationRulesEnum anEnum = CalculationRulesEnum.getEnum(rule);
switch (anEnum) { switch (anEnum) {
......
...@@ -7,7 +7,7 @@ import com.yeejoin.equipmanage.common.entity.Car; ...@@ -7,7 +7,7 @@ import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.WlCarMileage; import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.common.utils.CoordinateUtil; import com.yeejoin.equipmanage.common.utils.CoordinateUtil;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.service.ICarService; import com.yeejoin.equipmanage.mapper.CarMapper;
import com.yeejoin.equipmanage.service.IWlCarMileageService; import com.yeejoin.equipmanage.service.IWlCarMileageService;
import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -36,7 +36,7 @@ public class CarIotListener extends EmqxListener { ...@@ -36,7 +36,7 @@ public class CarIotListener extends EmqxListener {
private IWlCarMileageService iWlCarMileageService; private IWlCarMileageService iWlCarMileageService;
@Autowired @Autowired
private ICarService iCarService; private CarMapper carMapper;
@Autowired @Autowired
private IotFeign iotFeign; private IotFeign iotFeign;
...@@ -154,7 +154,7 @@ public class CarIotListener extends EmqxListener { ...@@ -154,7 +154,7 @@ public class CarIotListener extends EmqxListener {
int direction = jsonObject.getIntValue("direction"); int direction = jsonObject.getIntValue("direction");
// 地图推送消息 // 地图推送消息
Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode)); Car car = carMapper.selectOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && startLongitude != 0 && startLatitude != 0) { if (car != null && startLongitude != 0 && startLatitude != 0) {
JSONArray sendArr = new JSONArray(); JSONArray sendArr = new JSONArray();
JSONObject sendObj = new JSONObject(); JSONObject sendObj = new JSONObject();
...@@ -169,7 +169,7 @@ public class CarIotListener extends EmqxListener { ...@@ -169,7 +169,7 @@ public class CarIotListener extends EmqxListener {
mqttMessage.setPayload(sendArr.toJSONString().getBytes()); mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude); car.setLongitude(startLongitude);
car.setLatitude(startLatitude); car.setLatitude(startLatitude);
iCarService.updateById(car); carMapper.updateById(car);
emqkeeper.getMqttClient().publish("car/location", mqttMessage); emqkeeper.getMqttClient().publish("car/location", mqttMessage);
} }
} }
...@@ -186,7 +186,6 @@ public class CarIotListener extends EmqxListener { ...@@ -186,7 +186,6 @@ public class CarIotListener extends EmqxListener {
StringBuilder res = new StringBuilder(); StringBuilder res = new StringBuilder();
BufferedReader in = null; BufferedReader in = null;
try { try {
System.out.println(api.toString());
URL url = new URL(api.toString()); URL url = new URL(api.toString());
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true); conn.setDoOutput(true);
......
...@@ -299,4 +299,6 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> { ...@@ -299,4 +299,6 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
String getEquipRealtimeSignal(long id); String getEquipRealtimeSignal(long id);
EquipmentSpecific getEquipSpecificEntityByCode(String code); EquipmentSpecific getEquipSpecificEntityByCode(String code);
void updateCarQrCode(List<Map<String, String>> carIds, String status);
} }
...@@ -68,8 +68,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -68,8 +68,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
@Autowired @Autowired
EquipmentSpecificMapper equipmentSpecificMapper; EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
IEquipmentSpecificSerivce equipmentSpecificService;
@Autowired @Autowired
IEquipmentDetailService iEquipmentDetailService; IEquipmentDetailService iEquipmentDetailService;
...@@ -326,7 +324,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -326,7 +324,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
public Map<String, Object> getSpecificInfoById(Long id) { public Map<String, Object> getSpecificInfoById(Long id) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
EquipmentSpecificAlarmLog alarm = equipmentSpecificAlarmLogMapper.selectById(id); EquipmentSpecificAlarmLog alarm = equipmentSpecificAlarmLogMapper.selectById(id);
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getById(alarm.getEquipmentSpecificId()); EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectById(alarm.getEquipmentSpecificId());
Map<String, Object> equipmentSpecificInfo = equipmentSpecificMapper.getEquipSpeInfo(alarm.getEquipmentSpecificId()); Map<String, Object> equipmentSpecificInfo = equipmentSpecificMapper.getEquipSpeInfo(alarm.getEquipmentSpecificId());
// equipmentSpecific.setFullqrCode("01#" + equipmentSpecific.getQrCode()); // equipmentSpecific.setFullqrCode("01#" + equipmentSpecific.getQrCode());
// EquipmentDetail equipmentDetail = iEquipmentDetailService.getOneById(equipmentSpecific.getEquipmentDetailId()); // EquipmentDetail equipmentDetail = iEquipmentDetailService.getOneById(equipmentSpecific.getEquipmentDetailId());
...@@ -369,7 +367,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -369,7 +367,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
public Map<String, Object> getSpecificInfoByCode(String code) { public Map<String, Object> getSpecificInfoByCode(String code) {
QueryWrapper<EquipmentSpecific> queryWrapper = new QueryWrapper<>(); QueryWrapper<EquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", code); queryWrapper.eq("code", code);
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getOne(queryWrapper); EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectOne(queryWrapper);
if (!ObjectUtils.isEmpty(equipmentSpecific)) { if (!ObjectUtils.isEmpty(equipmentSpecific)) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Long id = equipmentSpecific.getId(); Long id = equipmentSpecific.getId();
......
...@@ -79,144 +79,6 @@ import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DA ...@@ -79,144 +79,6 @@ import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DA
@Slf4j @Slf4j
public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificMapper, EquipmentSpecific> implements IEquipmentSpecificSerivce { public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificMapper, EquipmentSpecific> implements IEquipmentSpecificSerivce {
@Autowired
IStockDetailService stockDetailService;
@Autowired
@Lazy
IStockService stockService;
@Autowired
IEquPropertyService equPropertyService;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private SystemctlFeign systemctlFeign;
@Autowired
@Lazy
IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
@Autowired
IStockBillDetailService stockBillDetailService;
@Autowired
IStockBillService stockBillService;
@Autowired
EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper;
@Autowired
UploadFileMapper uploadFileMapper;
@Autowired
EquipmentIndexMapper equipmentIndexMapper;
@Autowired
ISystemDicService iSystemDicService;
@Autowired
IEquipmentDetailService equipmentDetailService;
@Autowired
IWarehouseService warehouseService;
@Autowired
IWarehouseStructureService warehouseStructureService;
@Autowired
private Sequence sequence;
@Autowired
IEquipmentService equipmentService;
@Autowired
IEquipmentCategoryService iEquipmentCategoryService;
@Autowired
IFireFightingSystemService iFireFightingSystemService;
@Autowired
private IUploadFileService iUploadFileService;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
IEquipmentSystemSourceStatisticsService equipmentSystemSourceStatisticsService;
@Autowired
IEquipmentCategoryService equipmentCategoryService;
@Autowired
IEquipmentIndexService iEquipmentIndexService;
@Autowired
private IVideoService videoService;
@Autowired
private ICarService carService;
@Autowired
private IVideoEquipmentSpecificService videoEquipmentSpecificService;
@Autowired
private IFormInstanceService formInstanceService;
@Autowired
private IFormInstanceEquipService formInstanceEquipService;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
@Value("${equipment.filter.code}")
private String codes;
@Autowired
EquipQrcodeRecordMapper equipQrcodeRecordMapper;
@Value("${equipment.type}")
String equipmentCategoryLeftTypeCode;
@Value("${equipment.scrap.day}")
String equipmentScrapDay;
@Autowired
private ISyncDataService syncDataService;
@Autowired
private RedisUtils redisUtils;
@Autowired
private RelationRedisUtil relationRedisUtil;
@Autowired
private VideoMapper videoMapper;
@Autowired
SignalClassifyMapper signalClassifyMapper;
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
@Lazy
IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
@Autowired
WarehouseStructureMapper warehouseStructureMapper;
@Autowired
FormInstanceMapper formInstanceMapper;
@Autowired
FormInstanceEquipMapper formInstanceEquipMapper;
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private IdxFeign idxFeign;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Value("classpath:/json/equipmentCode.json")
private Resource equipmentCode;
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Autowired
protected EmqKeeper emqKeeper;
private final String injection = "{\n" + private final String injection = "{\n" +
"\n" + "\n" +
" \"items\": [\n" + " \"items\": [\n" +
...@@ -417,6 +279,101 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -417,6 +279,101 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
" ]\n" + " ]\n" +
"\n" + "\n" +
" }"; " }";
@Autowired
protected EmqKeeper emqKeeper;
@Autowired
IStockDetailService stockDetailService;
@Autowired
@Lazy
IStockService stockService;
@Autowired
@Lazy
IEquipmentSpecificIndexSerivce equipmentSpecificIndexSerivce;
@Autowired
IStockBillDetailService stockBillDetailService;
@Autowired
IStockBillService stockBillService;
@Autowired
EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper;
@Autowired
UploadFileMapper uploadFileMapper;
@Autowired
IEquipmentDetailService equipmentDetailService;
@Autowired
IWarehouseService warehouseService;
@Autowired
IWarehouseStructureService warehouseStructureService;
@Autowired
@Lazy
IEquipmentService equipmentService;
@Autowired
IFireFightingSystemService iFireFightingSystemService;
@Autowired
IEquipmentSystemSourceStatisticsService equipmentSystemSourceStatisticsService;
@Autowired
IEquipmentIndexService iEquipmentIndexService;
@Value("${equipment.type}")
String equipmentCategoryLeftTypeCode;
@Value("${equipment.scrap.day}")
String equipmentScrapDay;
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
@Autowired
WarehouseStructureMapper warehouseStructureMapper;
@Autowired
FormInstanceMapper formInstanceMapper;
@Autowired
FormInstanceEquipMapper formInstanceEquipMapper;
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private RemoteSecurityService remoteSecurityService;
@Autowired
private SystemctlFeign systemctlFeign;
@Autowired
private Sequence sequence;
@Autowired
private IUploadFileService iUploadFileService;
@Autowired
private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
private IVideoService videoService;
@Autowired
private ICarService carService;
@Autowired
private IVideoEquipmentSpecificService videoEquipmentSpecificService;
@Autowired
private IFormInstanceService formInstanceService;
@Autowired
private IFormInstanceEquipService formInstanceEquipService;
@Value("${systemctl.dict.iot-core-param}")
private String iotCoreParam;
@Value("${equipment.filter.code}")
private String codes;
@Autowired
private ISyncDataService syncDataService;
@Autowired
private RedisUtils redisUtils;
@Autowired
private RelationRedisUtil relationRedisUtil;
@Autowired
private VideoMapper videoMapper;
@Autowired
private IdxFeign idxFeign;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Value("classpath:/json/equipmentCode.json")
private Resource equipmentCode;
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
private StockBill buildStockBills(EquipmentSpecific equipmentSpecific, ReginParams reginParams, AgencyUserModel agencyUserModel) { private StockBill buildStockBills(EquipmentSpecific equipmentSpecific, ReginParams reginParams, AgencyUserModel agencyUserModel) {
StockBill stockBill = new StockBill(); StockBill stockBill = new StockBill();
...@@ -486,7 +443,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -486,7 +443,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
List<EquipmentSpecificAlarm> alarms = equipmentSpecificAlarmService.getBaseMapper().selectList(queryWrapper); List<EquipmentSpecificAlarm> alarms = equipmentSpecificAlarmService.getBaseMapper().selectList(queryWrapper);
if (0 < alarms.size()) { if (0 < alarms.size()) {
alarms.stream().map(x -> x.setLocation(equipmentSpecific.getPosition() + " " alarms.stream().map(x -> x.setLocation(equipmentSpecific.getPosition() + " "
+ (null == equipmentSpecific.getStockDetail().getDescription() ? "" : equipmentSpecific.getStockDetail().getDescription()))).collect(Collectors.toList()); + (null == equipmentSpecific.getStockDetail().getDescription() ? "" : equipmentSpecific.getStockDetail().getDescription()))).collect(Collectors.toList());
equipmentSpecificAlarmService.updateBatchById(alarms); equipmentSpecificAlarmService.updateBatchById(alarms);
} }
} }
...@@ -567,7 +524,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -567,7 +524,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public Map<String, Object> getAll(Long id) { public Map<String, Object> getAll(Long id) {
QueryWrapper<EquipmentSpecificAlarm> wrapper = new QueryWrapper<>(); QueryWrapper<EquipmentSpecificAlarm> wrapper = new QueryWrapper<>();
...@@ -998,7 +954,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -998,7 +954,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
if (res > 0 && syncSwitch) { if (res > 0 && syncSwitch) {
//数据同步 //数据同步
delEquipmentSpecificSyncData(id); delEquipmentSpecificSyncData(id);
} }
//判断装备表剩余数量,无剩余删除模板 //判断装备表剩余数量,无剩余删除模板
QueryWrapper<EquipmentSpecific> wrapper = new QueryWrapper<>(); QueryWrapper<EquipmentSpecific> wrapper = new QueryWrapper<>();
...@@ -1086,8 +1042,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1086,8 +1042,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
public void delEquipmentSpecificSyncData(Long id){ public void delEquipmentSpecificSyncData(Long id) {
//数据同步 //数据同步
syncDataService.syncDeletedEquipmentSpecific(Arrays.asList(id)); syncDataService.syncDeletedEquipmentSpecific(Arrays.asList(id));
List<EquipmentIndexVO> indexBySpecificIdIn = equipmentSpecificIndexSerivce.getEquipIndexBySpecificIdIn(Arrays.asList(String.valueOf(id))); List<EquipmentIndexVO> indexBySpecificIdIn = equipmentSpecificIndexSerivce.getEquipIndexBySpecificIdIn(Arrays.asList(String.valueOf(id)));
if (!indexBySpecificIdIn.isEmpty()) { if (!indexBySpecificIdIn.isEmpty()) {
...@@ -1097,6 +1053,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1097,6 +1053,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
syncDataService.syncDeletedFireEquipMeasurement(fireEquipMeasurementCollect); syncDataService.syncDeletedFireEquipMeasurement(fireEquipMeasurementCollect);
} }
} }
@Override @Override
public Object getOneCard(Long id, String type) { public Object getOneCard(Long id, String type) {
if (BitmapEnum.video.getKey().equals(type)) { if (BitmapEnum.video.getKey().equals(type)) {
...@@ -1217,7 +1174,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1217,7 +1174,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return equipmentSpecificMapper.getEquipSpecificLocationInfo(equipmentSpecificId, fieldName); return equipmentSpecificMapper.getEquipSpecificLocationInfo(equipmentSpecificId, fieldName);
} }
public Map<String,Double> getEquipLocationInfo(Long equipmentSpecificId) { public Map<String, Double> getEquipLocationInfo(Long equipmentSpecificId) {
return equipmentSpecificMapper.getEquipLocationInfo(equipmentSpecificId); return equipmentSpecificMapper.getEquipLocationInfo(equipmentSpecificId);
} }
...@@ -1541,7 +1498,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1541,7 +1498,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
public FireEquipment getEquipSpecificDetail(EquipmentSpecific equipmentSpecific) { public FireEquipment getEquipSpecificDetail(EquipmentSpecific equipmentSpecific) {
FireEquipment fireEquipment = equipmentSpecificMapper.getEquipSpecificDetail(equipmentSpecific.getId()); FireEquipment fireEquipment = equipmentSpecificMapper.getEquipSpecificDetail(equipmentSpecific.getId());
String fullName = fireEquipment.getFullName(); String fullName = fireEquipment.getFullName();
if (StringUtils.isNotBlank(fullName) && fullName.indexOf("-") != -1){ if (StringUtils.isNotBlank(fullName) && fullName.indexOf("-") != -1) {
fireEquipment.setBuildName(fullName.split("-")[0]); fireEquipment.setBuildName(fullName.split("-")[0]);
} }
return fireEquipment; return fireEquipment;
...@@ -1571,8 +1528,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1571,8 +1528,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
if (0 == warehouseStructure.getParentId()) { if (0 == warehouseStructure.getParentId()) {
return warehouseStructure; return warehouseStructure;
} else { } else {
warehouseStructure = warehouseStructureMapper.selectById(warehouseStructure.getParentId()); warehouseStructure = warehouseStructureMapper.selectById(warehouseStructure.getParentId());
return getWarehouseStructure(warehouseStructure); return getWarehouseStructure(warehouseStructure);
} }
} }
...@@ -1672,7 +1629,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1672,7 +1629,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
Long equipDetailId = specific.getEquipmentDetailId(); Long equipDetailId = specific.getEquipmentDetailId();
// // 1.删除相关主表数据 // // 1.删除相关主表数据
// this.baseMapper.deleteEquipDataBySpecificId(specificId, equipDetailId); // this.baseMapper.deleteEquipDataBySpecificId(specificId, equipDetailId);
try{ try {
this.baseMapper.deleteEquipDetail(equipDetailId); this.baseMapper.deleteEquipDetail(equipDetailId);
this.baseMapper.deleteEquipAlarmLog(specificId); this.baseMapper.deleteEquipAlarmLog(specificId);
this.baseMapper.deleteEquipAlarm(specificId); this.baseMapper.deleteEquipAlarm(specificId);
...@@ -1696,7 +1653,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1696,7 +1653,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
if (syncSwitch) { if (syncSwitch) {
//数据同步 //数据同步
delEquipmentSpecificSyncData(specificId); delEquipmentSpecificSyncData(specificId);
} }
return Boolean.TRUE; return Boolean.TRUE;
...@@ -1750,15 +1707,15 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1750,15 +1707,15 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
// TODO Auto-generated method stub // TODO Auto-generated method stub
if (!ObjectUtils.isEmpty(index.getEquipmentSpecificId())) { if (!ObjectUtils.isEmpty(index.getEquipmentSpecificId())) {
EquipmentSpecific es = equipmentSpecificMapper.selectById(index.getEquipmentSpecificId()); EquipmentSpecific es = equipmentSpecificMapper.selectById(index.getEquipmentSpecificId());
if(!ObjectUtils.isEmpty(es)){ if (!ObjectUtils.isEmpty(es)) {
es.setRealtimeIotEsIndexId(index.getId()); es.setRealtimeIotEsIndexId(index.getId());
es.setRealtimeIotIndexKey(index.getNameKey()); es.setRealtimeIotIndexKey(index.getNameKey());
es.setRealtimeIotIndexName(index.getEquipmentSpecificIndexName()); es.setRealtimeIotIndexName(index.getEquipmentSpecificIndexName());
es.setRealtimeIotIndexValue(index.getValue()); es.setRealtimeIotIndexValue(index.getValue());
es.setRealtimeIotIndexId(index.getEquipmentIndexId()); es.setRealtimeIotIndexId(index.getEquipmentIndexId());
es.setRealtimeIotIndexUpdateDate(index.getUpdateDate()); es.setRealtimeIotIndexUpdateDate(index.getUpdateDate());
es.setValueLabel(index.getValueLabel()); es.setValueLabel(index.getValueLabel());
equipmentSpecificMapper.updateById(es); equipmentSpecificMapper.updateById(es);
} }
} }
} }
...@@ -1795,27 +1752,27 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1795,27 +1752,27 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
List<Long> videoIdList = videoOnEquipmentSpecificVo.getVideoIdList(); List<Long> videoIdList = videoOnEquipmentSpecificVo.getVideoIdList();
if (equipmentSpecificId != null) { if (equipmentSpecificId != null) {
EquipmentSpecific equipmentSpecific = this.baseMapper.selectById(equipmentSpecificId); EquipmentSpecific equipmentSpecific = this.baseMapper.selectById(equipmentSpecificId);
if (!ObjectUtils.isEmpty(equipmentSpecific)) { if (!ObjectUtils.isEmpty(equipmentSpecific)) {
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>(); QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipment_specific_id", equipmentSpecificId); queryWrapper.eq("equipment_specific_id", equipmentSpecificId);
if (0 == videoIdList.size()) { if (0 == videoIdList.size()) {
videoEquipmentSpecificService.remove(queryWrapper); videoEquipmentSpecificService.remove(queryWrapper);
return Boolean.TRUE; return Boolean.TRUE;
} }
List<VideoEquipmentSpecific> list = videoEquipmentSpecificService.getBaseMapper().selectList(queryWrapper); List<VideoEquipmentSpecific> list = videoEquipmentSpecificService.getBaseMapper().selectList(queryWrapper);
if (0 < list.size()) { if (0 < list.size()) {
boolean remove = videoEquipmentSpecificService.remove(queryWrapper); boolean remove = videoEquipmentSpecificService.remove(queryWrapper);
if (remove) { if (remove) {
this.bingEquipmentRelationshipToVideo(videoIdList, equipmentSpecificId);
}
} else {
this.bingEquipmentRelationshipToVideo(videoIdList, equipmentSpecificId); this.bingEquipmentRelationshipToVideo(videoIdList, equipmentSpecificId);
} }
return Boolean.FALSE;
} else { } else {
throw new RuntimeException("未获取到此设备!"); this.bingEquipmentRelationshipToVideo(videoIdList, equipmentSpecificId);
} }
return Boolean.FALSE;
} else {
throw new RuntimeException("未获取到此设备!");
}
} else { } else {
throw new RuntimeException("设备ID为空!"); throw new RuntimeException("设备ID为空!");
...@@ -1824,11 +1781,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1824,11 +1781,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public Boolean videoOnEquipmentSpecificbj(Map<String,List<String>> date) { public Boolean videoOnEquipmentSpecificbj(Map<String, List<String>> date) {
List<String> equipmentSpecificIds = date.get("eqid"); List<String> equipmentSpecificIds = date.get("eqid");
List<String> videoIdList = date.get("videoid"); List<String> videoIdList = date.get("videoid");
if (equipmentSpecificIds != null) { if (equipmentSpecificIds != null) {
for (String equipmentSpecificId : equipmentSpecificIds) { for (String equipmentSpecificId : equipmentSpecificIds) {
EquipmentSpecific equipmentSpecific = this.baseMapper.selectById(equipmentSpecificId); EquipmentSpecific equipmentSpecific = this.baseMapper.selectById(equipmentSpecificId);
...@@ -1836,9 +1792,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1836,9 +1792,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>(); QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipment_specific_id", equipmentSpecificId); queryWrapper.eq("equipment_specific_id", equipmentSpecificId);
List<VideoEquipmentSpecific> list = videoEquipmentSpecificService.getBaseMapper().selectList(queryWrapper); List<VideoEquipmentSpecific> list = videoEquipmentSpecificService.getBaseMapper().selectList(queryWrapper);
if(list!=null&&list.size()>0){ if (list != null && list.size() > 0) {
for (VideoEquipmentSpecific videoEquipmentSpecific : list) { for (VideoEquipmentSpecific videoEquipmentSpecific : list) {
if(videoIdList.contains(String.valueOf(videoEquipmentSpecific.getVideoId()))){ if (videoIdList.contains(String.valueOf(videoEquipmentSpecific.getVideoId()))) {
videoIdList.remove(String.valueOf(videoEquipmentSpecific.getVideoId())); videoIdList.remove(String.valueOf(videoEquipmentSpecific.getVideoId()));
} }
} }
...@@ -1864,8 +1820,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1864,8 +1820,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public Boolean delVideoOnEquipmentSpecific(Long equipmentSpecificId, Long videoId) { public Boolean delVideoOnEquipmentSpecific(Long equipmentSpecificId, Long videoId) {
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>(); QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
...@@ -1897,21 +1851,21 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1897,21 +1851,21 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public List<Map<String, Object>> getListByEquipmentCodeJ(String code,String bizOrgCode) { public List<Map<String, Object>> getListByEquipmentCodeJ(String code, String bizOrgCode) {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
if (StringUtil.isNotEmpty(code)) { if (StringUtil.isNotEmpty(code)) {
String[] strings = code.split(","); String[] strings = code.split(",");
list = equipmentSpecificMapper.getFirePumpInfo(strings,bizOrgCode); list = equipmentSpecificMapper.getFirePumpInfo(strings, bizOrgCode);
} }
return list; return list;
} }
@Override @Override
public List<Map<String, Object>> getFirePumpInfoEQ(String code,String bizCode) { public List<Map<String, Object>> getFirePumpInfoEQ(String code, String bizCode) {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
if (StringUtil.isNotEmpty(code)) { if (StringUtil.isNotEmpty(code)) {
String[] strings = code.split(","); String[] strings = code.split(",");
list = equipmentSpecificMapper.getFirePumpInfoEQ(strings,bizCode); list = equipmentSpecificMapper.getFirePumpInfoEQ(strings, bizCode);
} }
return list; return list;
} }
...@@ -1935,26 +1889,26 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1935,26 +1889,26 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeTrend(iotCode, isTrend, fieldKey); List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeTrend(iotCode, isTrend, fieldKey);
if (!ObjectUtils.isEmpty(indexes)) { if (!ObjectUtils.isEmpty(indexes)) {
Map<String, EquipmentSpecificIndex> collect = indexes.stream().collect(Collectors.toMap(EquipmentSpecificIndex::getNameKey, equipmentSpecificIndex -> equipmentSpecificIndex)); Map<String, EquipmentSpecificIndex> collect = indexes.stream().collect(Collectors.toMap(EquipmentSpecificIndex::getNameKey, equipmentSpecificIndex -> equipmentSpecificIndex));
for(Map<String, String> mapList : listObject){ for (Map<String, String> mapList : listObject) {
String dateStr = null; String dateStr = null;
String deviceName = String.valueOf(mapList.get("deviceName")); String deviceName = String.valueOf(mapList.get("deviceName"));
try { try {
String value = String.valueOf(mapList.get("time")); String value = String.valueOf(mapList.get("time"));
String strDate = value.substring(0, 19); String strDate = value.substring(0, 19);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC); SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
sdf.setTimeZone(TimeZone.getTimeZone("UTC")); sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date =sdf.parse(strDate); Date date = sdf.parse(strDate);
dateStr = DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC); dateStr = DateTimeUtil.format(date, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
} catch (Exception e) { } catch (Exception e) {
log.error("日期转换失败"); log.error("日期转换失败");
} }
for (Map.Entry entry : mapList.entrySet()){ for (Map.Entry entry : mapList.entrySet()) {
if (!ObjectUtils.isEmpty(entry.getValue()) && !"null".equals(entry.getValue())) { if (!ObjectUtils.isEmpty(entry.getValue()) && !"null".equals(entry.getValue())) {
EquipmentSpecificIndex equipmentSpecificIndex = collect.get(entry.getKey()); EquipmentSpecificIndex equipmentSpecificIndex = collect.get(entry.getKey());
if (!ObjectUtils.isEmpty(equipmentSpecificIndex)) { if (!ObjectUtils.isEmpty(equipmentSpecificIndex)) {
IotIndexInfoVo iotIndexInfoVo = new IotIndexInfoVo(); IotIndexInfoVo iotIndexInfoVo = new IotIndexInfoVo();
iotIndexInfoVo.setType(equipmentSpecificIndex.getTypeName()!=null?equipmentSpecificIndex.getTypeName(): equipmentSpecificIndex.getIndexName()); iotIndexInfoVo.setType(equipmentSpecificIndex.getTypeName() != null ? equipmentSpecificIndex.getTypeName() : equipmentSpecificIndex.getIndexName());
iotIndexInfoVo.setNumber(deviceName); iotIndexInfoVo.setNumber(deviceName);
if (equipmentSpecificIndex.getIsTrend() == 1) { if (equipmentSpecificIndex.getIsTrend() == 1) {
...@@ -1986,11 +1940,11 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1986,11 +1940,11 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void equipmentScrap() throws Exception { public void equipmentScrap() throws Exception {
List<Map<String, Object>> equipSpecificScrap = equipmentSpecificIndexMapper.getEquipSpecificScrap(); List<Map<String, Object>> equipSpecificScrap = equipmentSpecificIndexMapper.getEquipSpecificScrap();
equipSpecificScrap.forEach(e->{ equipSpecificScrap.forEach(e -> {
try { try {
if(e.get("weExpiry") != null) { if (e.get("weExpiry") != null) {
int year = Integer.parseInt(e.get("weExpiry").toString()); int year = Integer.parseInt(e.get("weExpiry").toString());
Date productDate = DateUtils.dateParse(e.get("product").toString(),DateUtils.DATE_TIME_TT_PATTERN); Date productDate = DateUtils.dateParse(e.get("product").toString(), DateUtils.DATE_TIME_TT_PATTERN);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(productDate); calendar.setTime(productDate);
calendar.add(Calendar.YEAR, year); calendar.add(Calendar.YEAR, year);
...@@ -1998,10 +1952,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1998,10 +1952,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
Date now = new Date(); Date now = new Date();
String scrapTime = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(calendar.getTime()); String scrapTime = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(calendar.getTime());
int day = DateUtils.dateBetween(now,calendar.getTime()); int day = DateUtils.dateBetween(now, calendar.getTime());
if(day < Integer.parseInt(equipmentScrapDay) && day > -1 ) { if (day < Integer.parseInt(equipmentScrapDay) && day > -1) {
syncSystemctlMsg(e, scrapTime, day); syncSystemctlMsg(e, scrapTime, day);
} else if (day == -1 ){ } else if (day == -1) {
// 发送emq消息转kafka // 发送emq消息转kafka
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
...@@ -2028,7 +1982,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -2028,7 +1982,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
void syncSystemctlMsg(Map<String, Object> map,String scrapTime, int i) { void syncSystemctlMsg(Map<String, Object> map, String scrapTime, int i) {
try { try {
MessageModel model = new MessageModel(); MessageModel model = new MessageModel();
model.setTitle("报废到期提醒"); model.setTitle("报废到期提醒");
...@@ -2151,7 +2105,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -2151,7 +2105,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public void updateEquipSpecificStatus(String status, String id){ public void updateEquipSpecificStatus(String status, String id) {
Integer num = equipmentSpecificMapper.updateEquipSpecificStatus(status, id); Integer num = equipmentSpecificMapper.updateEquipSpecificStatus(status, id);
if (0 < num) { if (0 < num) {
...@@ -2179,14 +2133,14 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -2179,14 +2133,14 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public String updateEquipSpecificStatusByCheckInput( String id){ public String updateEquipSpecificStatusByCheckInput(String id) {
return equipmentSpecificMapper.updateEquipSpecificStatusByCheckInput(id); return equipmentSpecificMapper.updateEquipSpecificStatusByCheckInput(id);
} }
@Override @Override
public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage) { public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage) {
IPage<EquipTypeImgAmountVO> record = equipmentSpecificMapper.getMonitoringUnitList(equipTypeAmountPage.getPage(),equipTypeAmountPage); IPage<EquipTypeImgAmountVO> record = equipmentSpecificMapper.getMonitoringUnitList(equipTypeAmountPage.getPage(), equipTypeAmountPage);
record.getRecords().forEach(e-> { record.getRecords().forEach(e -> {
e.setEquip(equipmentSpecificMapper.getMonitoringEquip(String.valueOf(e.getId())).get("num").toString()); e.setEquip(equipmentSpecificMapper.getMonitoringEquip(String.valueOf(e.getId())).get("num").toString());
e.setOther(equipmentSpecificMapper.getMonitoringOther(String.valueOf(e.getId())).get("num").toString()); e.setOther(equipmentSpecificMapper.getMonitoringOther(String.valueOf(e.getId())).get("num").toString());
}); });
...@@ -2194,7 +2148,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -2194,7 +2148,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public List<Map<String, Object >> getMonitoringCount(String bizOrgCode) { public List<Map<String, Object>> getMonitoringCount(String bizOrgCode) {
return equipmentSpecificMapper.getMonitoringCount(bizOrgCode); return equipmentSpecificMapper.getMonitoringCount(bizOrgCode);
} }
...@@ -2221,4 +2175,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -2221,4 +2175,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
public EquipmentSpecific getEquipSpecificEntityByCode(String code) { public EquipmentSpecific getEquipSpecificEntityByCode(String code) {
return equipmentSpecificMapper.getEquipSpecificEntityByCode(code); return equipmentSpecificMapper.getEquipSpecificEntityByCode(code);
} }
@Override
public void updateCarQrCode(List<Map<String, String>> carIds, String status) {
carService.updateCarQrCode(carIds, status);
}
} }
...@@ -11,6 +11,7 @@ import com.yeejoin.equipmanage.common.entity.Car; ...@@ -11,6 +11,7 @@ import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.CarSpeedWarningRecord; import com.yeejoin.equipmanage.common.entity.CarSpeedWarningRecord;
import com.yeejoin.equipmanage.common.entity.WlCarMileage; import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.CarMapper;
import com.yeejoin.equipmanage.mapper.WlCarSpeedWaringRecordMapper; import com.yeejoin.equipmanage.mapper.WlCarSpeedWaringRecordMapper;
import com.yeejoin.equipmanage.service.ICarService; import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService; import com.yeejoin.equipmanage.service.IWlCarMileageService;
...@@ -48,7 +49,7 @@ public class JxiopCarIotListerServiceImpl { ...@@ -48,7 +49,7 @@ public class JxiopCarIotListerServiceImpl {
@Autowired @Autowired
private IWlCarMileageService iWlCarMileageService; private IWlCarMileageService iWlCarMileageService;
@Autowired @Autowired
private ICarService iCarService; private CarMapper carMapper;
@Autowired @Autowired
private IotFeign iotFeign; private IotFeign iotFeign;
@Autowired @Autowired
...@@ -179,7 +180,7 @@ public class JxiopCarIotListerServiceImpl { ...@@ -179,7 +180,7 @@ public class JxiopCarIotListerServiceImpl {
} }
} }
// 地图推送消息 // 地图推送消息
Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode)); Car car = carMapper.selectOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && startLongitude != 0 && startLatitude != 0) { if (car != null && startLongitude != 0 && startLatitude != 0) {
JSONArray sendArr = new JSONArray(); JSONArray sendArr = new JSONArray();
JSONObject sendObj = new JSONObject(); JSONObject sendObj = new JSONObject();
...@@ -200,7 +201,7 @@ public class JxiopCarIotListerServiceImpl { ...@@ -200,7 +201,7 @@ public class JxiopCarIotListerServiceImpl {
} }
car.setExtra2(power.toString()); car.setExtra2(power.toString());
logger.info("----------------更新车辆电池电量信息成功----------------"); logger.info("----------------更新车辆电池电量信息成功----------------");
iCarService.updateById(car); carMapper.updateById(car);
logger.info("车牌号::" + car.getCarNum() + "最大车速:" + maxSpeed + "当前车速::" + speed); logger.info("车牌号::" + car.getCarNum() + "最大车速:" + maxSpeed + "当前车速::" + speed);
if ((speed - maxSpeed)>0) { if ((speed - maxSpeed)>0) {
List<CarSpeedWarningRecord> list = wlCarSpeedWaringRecordMapper.selectList(new QueryWrapper<CarSpeedWarningRecord>().eq("car_num",car.getCarNum()). List<CarSpeedWarningRecord> list = wlCarSpeedWaringRecordMapper.selectList(new QueryWrapper<CarSpeedWarningRecord>().eq("car_num",car.getCarNum()).
......
...@@ -74,9 +74,9 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -74,9 +74,9 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Autowired @Autowired
IotFeign iotFeign; IotFeign iotFeign;
@Autowired @Autowired
ICarService iCarService;
@Autowired
WlCarMileageMapper wlCarMileageMapper; WlCarMileageMapper wlCarMileageMapper;
@Autowired
CarMapper carMapper;
@Value("${car.max.speed:100}") @Value("${car.max.speed:100}")
private Integer CAR_MAX_SPEED; private Integer CAR_MAX_SPEED;
@Value("${mileage.parameter}") @Value("${mileage.parameter}")
...@@ -84,12 +84,8 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -84,12 +84,8 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Resource @Resource
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
@Autowired @Autowired
@Lazy
private IWlCarMileageService iWlCarMileageService;
@Autowired
private RedisTemplate redisTemplate; private RedisTemplate redisTemplate;
@Autowired
CarMapper carMapper;
public static List<String> getDayByMonth(Date date) { public static List<String> getDayByMonth(Date date) {
List<String> data = new ArrayList<>(); List<String> data = new ArrayList<>();
try { try {
...@@ -268,7 +264,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -268,7 +264,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
public Map<String, Boolean> getCalender(long id, Date date) { public Map<String, Boolean> getCalender(long id, Date date) {
List<String> daylist = new ArrayList<String>(); List<String> daylist = new ArrayList<String>();
Map<String, Boolean> map = new HashMap<>(); Map<String, Boolean> map = new HashMap<>();
Car car = iCarService.getById(id); Car car = carMapper.selectById(id);
if (car == null || car.getIotCode() == null || date == null) { if (car == null || car.getIotCode() == null || date == null) {
return map; return map;
} }
...@@ -378,21 +374,21 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -378,21 +374,21 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
// 里程耗时 // 里程耗时
long takeTime = (date.getTime()) - (item.getStartTime().getTime()); long takeTime = (date.getTime()) - (item.getStartTime().getTime());
// 查询车辆最新位置 // 查询车辆最新位置
// 修改0点未结束里程记录 // 修改0点未结束里程记录
item.setEndSpeed(v.intValue()); item.setEndSpeed(v.intValue());
item.setEndTime(date); item.setEndTime(date);
item.setEndLatitude(startLatitude); item.setEndLatitude(startLatitude);
item.setEndLongitude(startLongitude); item.setEndLongitude(startLongitude);
item.setEndName("无效坐标"); item.setEndName("无效坐标");
if(travel>0.5){ if (travel > 0.5) {
String address = getAddress(startLongitude, startLatitude); String address = getAddress(startLongitude, startLatitude);
item.setEndName(address); item.setEndName(address);
} }
item.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue()); item.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
item.setTakeTime(takeTime); item.setTakeTime(takeTime);
this.getBaseMapper().updateById(item); this.getBaseMapper().updateById(item);
log.info("-----------跨天轨迹切分任更新车辆坐标成功:::" + JSONObject.toJSONString(item) + "-----------------"); log.info("-----------跨天轨迹切分任更新车辆坐标成功:::" + JSONObject.toJSONString(item) + "-----------------");
} }
}); });
...@@ -407,7 +403,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -407,7 +403,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get(item.getIotCode()))) { if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get(item.getIotCode()))) {
if (!ObjectUtils.isEmpty(item.getIotCode()) && item.getIotCode().length() > 8) { if (!ObjectUtils.isEmpty(item.getIotCode()) && item.getIotCode().length() > 8) {
// 查询车辆上报信息 // 查询车辆上报信息
Date date =new Date(); Date date = new Date();
ResponseModel<List<Object>> result = iotFeign.getLiveData(item.getIotCode().substring(0, 8), item.getIotCode().substring(8), ResponseModel<List<Object>> result = iotFeign.getLiveData(item.getIotCode().substring(0, 8), item.getIotCode().substring(8),
item.getStartTime(), new Date(new Date().getTime() + 2000)); item.getStartTime(), new Date(new Date().getTime() + 2000));
List<Object> list1 = result.getResult(); List<Object> list1 = result.getResult();
...@@ -459,15 +455,15 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -459,15 +455,15 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
item.setEndLatitude(startLatitude); item.setEndLatitude(startLatitude);
item.setEndLongitude(startLongitude); item.setEndLongitude(startLongitude);
item.setEndName("无效坐标"); item.setEndName("无效坐标");
if(travel>0.5){ if (travel > 0.5) {
String address = getAddress(startLongitude, startLatitude); String address = getAddress(startLongitude, startLatitude);
item.setEndName(address); item.setEndName(address);
} }
item.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue()); item.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
item.setTakeTime(takeTime); item.setTakeTime(takeTime);
if(travel>0.5){ if (travel > 0.5) {
this.getBaseMapper().updateById(item); this.getBaseMapper().updateById(item);
}else { } else {
this.getBaseMapper().deleteById(item.getId()); this.getBaseMapper().deleteById(item.getId());
} }
log.info("-----------正常结束轨迹更新车辆坐标成功:::" + JSONObject.toJSONString(item) + "-----------------"); log.info("-----------正常结束轨迹更新车辆坐标成功:::" + JSONObject.toJSONString(item) + "-----------------");
...@@ -535,7 +531,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -535,7 +531,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
wrapper.isNotNull(WlCarMileage::getEndTime); wrapper.isNotNull(WlCarMileage::getEndTime);
wrapper.isNotNull(WlCarMileage::getStartTime); wrapper.isNotNull(WlCarMileage::getStartTime);
wrapper.like(WlCarMileage::getStartTime, date); wrapper.like(WlCarMileage::getStartTime, date);
List<WlCarMileage> list = iWlCarMileageService.list(wrapper); List<WlCarMileage> list = this.list(wrapper);
for (WlCarMileage wl : list) { for (WlCarMileage wl : list) {
//判断当前车辆全程是否异常,如果时速小于阈值 则对数据进行返回 否则不予返回 //判断当前车辆全程是否异常,如果时速小于阈值 则对数据进行返回 否则不予返回
if (!org.springframework.util.ObjectUtils.isEmpty(wl.getTakeTime()) && !org.springframework.util.ObjectUtils.isEmpty(wl.getTravel()) && ((wl.getTravel() / (wl.getTakeTime() / 3600000.0)) < CAR_MAX_SPEED)) { if (!org.springframework.util.ObjectUtils.isEmpty(wl.getTakeTime()) && !org.springframework.util.ObjectUtils.isEmpty(wl.getTravel()) && ((wl.getTravel() / (wl.getTakeTime() / 3600000.0)) < CAR_MAX_SPEED)) {
...@@ -555,7 +551,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -555,7 +551,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
wrapper.isNotNull(WlCarMileage::getStartTime); wrapper.isNotNull(WlCarMileage::getStartTime);
wrapper.ge(WlCarMileage::getDate, startDate); wrapper.ge(WlCarMileage::getDate, startDate);
wrapper.le(WlCarMileage::getDate, endDate); wrapper.le(WlCarMileage::getDate, endDate);
List<WlCarMileage> list = iWlCarMileageService.list(wrapper); List<WlCarMileage> list = this.list(wrapper);
for (WlCarMileage wl : list) { for (WlCarMileage wl : list) {
//判断当前车辆全程是否异常,如果时速小于阈值 则对数据进行返回 否则不予返回 //判断当前车辆全程是否异常,如果时速小于阈值 则对数据进行返回 否则不予返回
if (!org.springframework.util.ObjectUtils.isEmpty(wl.getTakeTime()) && !org.springframework.util.ObjectUtils.isEmpty(wl.getTravel()) && ((wl.getTravel() / (wl.getTakeTime() / 3600000.0)) < CAR_MAX_SPEED)) { if (!org.springframework.util.ObjectUtils.isEmpty(wl.getTakeTime()) && !org.springframework.util.ObjectUtils.isEmpty(wl.getTravel()) && ((wl.getTravel() / (wl.getTakeTime() / 3600000.0)) < CAR_MAX_SPEED)) {
......
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