Commit 3a3584a7 authored by caotao's avatar caotao

解决循环依赖问题

parent ea6f6147
......@@ -12,6 +12,7 @@ import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
......@@ -25,27 +26,22 @@ import java.util.stream.Collectors;
/**
* 赋码动作
*
* @author DELL
*/
@Component
@RuleActionBean(beanLabel = "动态预案")
@Slf4j
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 final String SOURCE_ID = "sourceId";
private final String SOURCE_CAR = "car";
private final String SOURCE_EQUIP = "equip";
@Autowired
private IEquipmentSpecificSerivce equipmentSpecificSerivce;
@RuleMethod(methodLabel = "更新码", project = "车辆更新码颜色")
public void updateCarQrCode(@MethodParam(paramLabel = "判断值") String value, @MethodParam(paramLabel = "赋码颜色") String color,
......@@ -86,7 +82,7 @@ public class UpdateQrCodeAction {
if (!CollectionUtils.isEmpty(collect)) {
switch (source) {
case SOURCE_CAR:
carService.updateCarQrCode(collect, color);
equipmentSpecificSerivce.updateCarQrCode(collect, color);
break;
case SOURCE_EQUIP:
equipmentSpecificSerivce.updateEquipQrCode(collect, color);
......@@ -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<>();
CalculationRulesEnum anEnum = CalculationRulesEnum.getEnum(rule);
switch (anEnum) {
......
......@@ -7,7 +7,7 @@ import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.common.utils.CoordinateUtil;
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 org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -36,7 +36,7 @@ public class CarIotListener extends EmqxListener {
private IWlCarMileageService iWlCarMileageService;
@Autowired
private ICarService iCarService;
private CarMapper carMapper;
@Autowired
private IotFeign iotFeign;
......@@ -154,7 +154,7 @@ public class CarIotListener extends EmqxListener {
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) {
JSONArray sendArr = new JSONArray();
JSONObject sendObj = new JSONObject();
......@@ -169,7 +169,7 @@ public class CarIotListener extends EmqxListener {
mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude);
car.setLatitude(startLatitude);
iCarService.updateById(car);
carMapper.updateById(car);
emqkeeper.getMqttClient().publish("car/location", mqttMessage);
}
}
......@@ -186,7 +186,6 @@ public class CarIotListener extends EmqxListener {
StringBuilder res = new StringBuilder();
BufferedReader in = null;
try {
System.out.println(api.toString());
URL url = new URL(api.toString());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
......
......@@ -299,4 +299,6 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
String getEquipRealtimeSignal(long id);
EquipmentSpecific getEquipSpecificEntityByCode(String code);
void updateCarQrCode(List<Map<String, String>> carIds, String status);
}
......@@ -68,8 +68,6 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
@Autowired
EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
IEquipmentSpecificSerivce equipmentSpecificService;
@Autowired
IEquipmentDetailService iEquipmentDetailService;
......@@ -326,7 +324,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
public Map<String, Object> getSpecificInfoById(Long id) {
Map<String, Object> map = new HashMap<>();
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());
// equipmentSpecific.setFullqrCode("01#" + equipmentSpecific.getQrCode());
// EquipmentDetail equipmentDetail = iEquipmentDetailService.getOneById(equipmentSpecific.getEquipmentDetailId());
......@@ -369,7 +367,7 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
public Map<String, Object> getSpecificInfoByCode(String code) {
QueryWrapper<EquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("code", code);
EquipmentSpecific equipmentSpecific = equipmentSpecificService.getOne(queryWrapper);
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectOne(queryWrapper);
if (!ObjectUtils.isEmpty(equipmentSpecific)) {
Map<String, Object> map = new HashMap<>();
Long id = equipmentSpecific.getId();
......
......@@ -79,144 +79,6 @@ import static org.typroject.tyboot.core.foundation.utils.DateTimeUtil.ISO8601_DA
@Slf4j
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" +
"\n" +
" \"items\": [\n" +
......@@ -417,6 +279,101 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
" ]\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) {
StockBill stockBill = new StockBill();
......@@ -486,7 +443,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
List<EquipmentSpecificAlarm> alarms = equipmentSpecificAlarmService.getBaseMapper().selectList(queryWrapper);
if (0 < alarms.size()) {
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);
}
}
......@@ -567,7 +524,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
public Map<String, Object> getAll(Long id) {
QueryWrapper<EquipmentSpecificAlarm> wrapper = new QueryWrapper<>();
......@@ -998,7 +954,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
if (res > 0 && syncSwitch) {
//数据同步
delEquipmentSpecificSyncData(id);
delEquipmentSpecificSyncData(id);
}
//判断装备表剩余数量,无剩余删除模板
QueryWrapper<EquipmentSpecific> wrapper = new QueryWrapper<>();
......@@ -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));
List<EquipmentIndexVO> indexBySpecificIdIn = equipmentSpecificIndexSerivce.getEquipIndexBySpecificIdIn(Arrays.asList(String.valueOf(id)));
if (!indexBySpecificIdIn.isEmpty()) {
......@@ -1097,6 +1053,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
syncDataService.syncDeletedFireEquipMeasurement(fireEquipMeasurementCollect);
}
}
@Override
public Object getOneCard(Long id, String type) {
if (BitmapEnum.video.getKey().equals(type)) {
......@@ -1217,7 +1174,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return equipmentSpecificMapper.getEquipSpecificLocationInfo(equipmentSpecificId, fieldName);
}
public Map<String,Double> getEquipLocationInfo(Long equipmentSpecificId) {
public Map<String, Double> getEquipLocationInfo(Long equipmentSpecificId) {
return equipmentSpecificMapper.getEquipLocationInfo(equipmentSpecificId);
}
......@@ -1541,7 +1498,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
public FireEquipment getEquipSpecificDetail(EquipmentSpecific equipmentSpecific) {
FireEquipment fireEquipment = equipmentSpecificMapper.getEquipSpecificDetail(equipmentSpecific.getId());
String fullName = fireEquipment.getFullName();
if (StringUtils.isNotBlank(fullName) && fullName.indexOf("-") != -1){
if (StringUtils.isNotBlank(fullName) && fullName.indexOf("-") != -1) {
fireEquipment.setBuildName(fullName.split("-")[0]);
}
return fireEquipment;
......@@ -1571,8 +1528,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
if (0 == warehouseStructure.getParentId()) {
return warehouseStructure;
} else {
warehouseStructure = warehouseStructureMapper.selectById(warehouseStructure.getParentId());
return getWarehouseStructure(warehouseStructure);
warehouseStructure = warehouseStructureMapper.selectById(warehouseStructure.getParentId());
return getWarehouseStructure(warehouseStructure);
}
}
......@@ -1672,7 +1629,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
Long equipDetailId = specific.getEquipmentDetailId();
// // 1.删除相关主表数据
// this.baseMapper.deleteEquipDataBySpecificId(specificId, equipDetailId);
try{
try {
this.baseMapper.deleteEquipDetail(equipDetailId);
this.baseMapper.deleteEquipAlarmLog(specificId);
this.baseMapper.deleteEquipAlarm(specificId);
......@@ -1696,7 +1653,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
if (syncSwitch) {
//数据同步
delEquipmentSpecificSyncData(specificId);
delEquipmentSpecificSyncData(specificId);
}
return Boolean.TRUE;
......@@ -1750,15 +1707,15 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
// TODO Auto-generated method stub
if (!ObjectUtils.isEmpty(index.getEquipmentSpecificId())) {
EquipmentSpecific es = equipmentSpecificMapper.selectById(index.getEquipmentSpecificId());
if(!ObjectUtils.isEmpty(es)){
es.setRealtimeIotEsIndexId(index.getId());
es.setRealtimeIotIndexKey(index.getNameKey());
es.setRealtimeIotIndexName(index.getEquipmentSpecificIndexName());
es.setRealtimeIotIndexValue(index.getValue());
es.setRealtimeIotIndexId(index.getEquipmentIndexId());
es.setRealtimeIotIndexUpdateDate(index.getUpdateDate());
es.setValueLabel(index.getValueLabel());
equipmentSpecificMapper.updateById(es);
if (!ObjectUtils.isEmpty(es)) {
es.setRealtimeIotEsIndexId(index.getId());
es.setRealtimeIotIndexKey(index.getNameKey());
es.setRealtimeIotIndexName(index.getEquipmentSpecificIndexName());
es.setRealtimeIotIndexValue(index.getValue());
es.setRealtimeIotIndexId(index.getEquipmentIndexId());
es.setRealtimeIotIndexUpdateDate(index.getUpdateDate());
es.setValueLabel(index.getValueLabel());
equipmentSpecificMapper.updateById(es);
}
}
}
......@@ -1795,27 +1752,27 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
List<Long> videoIdList = videoOnEquipmentSpecificVo.getVideoIdList();
if (equipmentSpecificId != null) {
EquipmentSpecific equipmentSpecific = this.baseMapper.selectById(equipmentSpecificId);
if (!ObjectUtils.isEmpty(equipmentSpecific)) {
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipment_specific_id", equipmentSpecificId);
if (0 == videoIdList.size()) {
videoEquipmentSpecificService.remove(queryWrapper);
return Boolean.TRUE;
}
List<VideoEquipmentSpecific> list = videoEquipmentSpecificService.getBaseMapper().selectList(queryWrapper);
if (0 < list.size()) {
boolean remove = videoEquipmentSpecificService.remove(queryWrapper);
if (remove) {
this.bingEquipmentRelationshipToVideo(videoIdList, equipmentSpecificId);
}
} else {
EquipmentSpecific equipmentSpecific = this.baseMapper.selectById(equipmentSpecificId);
if (!ObjectUtils.isEmpty(equipmentSpecific)) {
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipment_specific_id", equipmentSpecificId);
if (0 == videoIdList.size()) {
videoEquipmentSpecificService.remove(queryWrapper);
return Boolean.TRUE;
}
List<VideoEquipmentSpecific> list = videoEquipmentSpecificService.getBaseMapper().selectList(queryWrapper);
if (0 < list.size()) {
boolean remove = videoEquipmentSpecificService.remove(queryWrapper);
if (remove) {
this.bingEquipmentRelationshipToVideo(videoIdList, equipmentSpecificId);
}
return Boolean.FALSE;
} else {
throw new RuntimeException("未获取到此设备!");
this.bingEquipmentRelationshipToVideo(videoIdList, equipmentSpecificId);
}
return Boolean.FALSE;
} else {
throw new RuntimeException("未获取到此设备!");
}
} else {
throw new RuntimeException("设备ID为空!");
......@@ -1824,11 +1781,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@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> videoIdList = date.get("videoid");
List<String> videoIdList = date.get("videoid");
if (equipmentSpecificIds != null) {
for (String equipmentSpecificId : equipmentSpecificIds) {
EquipmentSpecific equipmentSpecific = this.baseMapper.selectById(equipmentSpecificId);
......@@ -1836,9 +1792,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipment_specific_id", equipmentSpecificId);
List<VideoEquipmentSpecific> list = videoEquipmentSpecificService.getBaseMapper().selectList(queryWrapper);
if(list!=null&&list.size()>0){
if (list != null && list.size() > 0) {
for (VideoEquipmentSpecific videoEquipmentSpecific : list) {
if(videoIdList.contains(String.valueOf(videoEquipmentSpecific.getVideoId()))){
if (videoIdList.contains(String.valueOf(videoEquipmentSpecific.getVideoId()))) {
videoIdList.remove(String.valueOf(videoEquipmentSpecific.getVideoId()));
}
}
......@@ -1864,8 +1820,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
public Boolean delVideoOnEquipmentSpecific(Long equipmentSpecificId, Long videoId) {
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
......@@ -1897,21 +1851,21 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@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<>();
if (StringUtil.isNotEmpty(code)) {
String[] strings = code.split(",");
list = equipmentSpecificMapper.getFirePumpInfo(strings,bizOrgCode);
list = equipmentSpecificMapper.getFirePumpInfo(strings, bizOrgCode);
}
return list;
}
@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<>();
if (StringUtil.isNotEmpty(code)) {
String[] strings = code.split(",");
list = equipmentSpecificMapper.getFirePumpInfoEQ(strings,bizCode);
list = equipmentSpecificMapper.getFirePumpInfoEQ(strings, bizCode);
}
return list;
}
......@@ -1935,26 +1889,26 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
List<EquipmentSpecificIndex> indexes = equipmentSpecificIndexMapper.getEquipmentSpeIndexByIotCodeTrend(iotCode, isTrend, fieldKey);
if (!ObjectUtils.isEmpty(indexes)) {
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 deviceName = String.valueOf(mapList.get("deviceName"));
try {
String value = String.valueOf(mapList.get("time"));
String value = String.valueOf(mapList.get("time"));
String strDate = value.substring(0, 19);
SimpleDateFormat sdf = new SimpleDateFormat(ISO8601_DATE_HOUR_MIN_SEC);
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);
} catch (Exception e) {
log.error("日期转换失败");
}
for (Map.Entry entry : mapList.entrySet()){
for (Map.Entry entry : mapList.entrySet()) {
if (!ObjectUtils.isEmpty(entry.getValue()) && !"null".equals(entry.getValue())) {
EquipmentSpecificIndex equipmentSpecificIndex = collect.get(entry.getKey());
if (!ObjectUtils.isEmpty(equipmentSpecificIndex)) {
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);
if (equipmentSpecificIndex.getIsTrend() == 1) {
......@@ -1986,11 +1940,11 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Transactional(rollbackFor = Exception.class)
public void equipmentScrap() throws Exception {
List<Map<String, Object>> equipSpecificScrap = equipmentSpecificIndexMapper.getEquipSpecificScrap();
equipSpecificScrap.forEach(e->{
equipSpecificScrap.forEach(e -> {
try {
if(e.get("weExpiry") != null) {
int year = Integer.parseInt(e.get("weExpiry").toString());
Date productDate = DateUtils.dateParse(e.get("product").toString(),DateUtils.DATE_TIME_TT_PATTERN);
if (e.get("weExpiry") != null) {
int year = Integer.parseInt(e.get("weExpiry").toString());
Date productDate = DateUtils.dateParse(e.get("product").toString(), DateUtils.DATE_TIME_TT_PATTERN);
Calendar calendar = Calendar.getInstance();
calendar.setTime(productDate);
calendar.add(Calendar.YEAR, year);
......@@ -1998,10 +1952,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
Date now = new Date();
String scrapTime = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN).format(calendar.getTime());
int day = DateUtils.dateBetween(now,calendar.getTime());
if(day < Integer.parseInt(equipmentScrapDay) && day > -1 ) {
int day = DateUtils.dateBetween(now, calendar.getTime());
if (day < Integer.parseInt(equipmentScrapDay) && day > -1) {
syncSystemctlMsg(e, scrapTime, day);
} else if (day == -1 ){
} else if (day == -1) {
// 发送emq消息转kafka
JSONObject jsonObject = new JSONObject();
Map<String, String> map = new HashMap<>();
......@@ -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 {
MessageModel model = new MessageModel();
model.setTitle("报废到期提醒");
......@@ -2151,7 +2105,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
public void updateEquipSpecificStatus(String status, String id){
public void updateEquipSpecificStatus(String status, String id) {
Integer num = equipmentSpecificMapper.updateEquipSpecificStatus(status, id);
if (0 < num) {
......@@ -2179,14 +2133,14 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
@Override
public String updateEquipSpecificStatusByCheckInput( String id){
return equipmentSpecificMapper.updateEquipSpecificStatusByCheckInput(id);
public String updateEquipSpecificStatusByCheckInput(String id) {
return equipmentSpecificMapper.updateEquipSpecificStatusByCheckInput(id);
}
@Override
public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage) {
IPage<EquipTypeImgAmountVO> record = equipmentSpecificMapper.getMonitoringUnitList(equipTypeAmountPage.getPage(),equipTypeAmountPage);
record.getRecords().forEach(e-> {
IPage<EquipTypeImgAmountVO> record = equipmentSpecificMapper.getMonitoringUnitList(equipTypeAmountPage.getPage(), equipTypeAmountPage);
record.getRecords().forEach(e -> {
e.setEquip(equipmentSpecificMapper.getMonitoringEquip(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
}
@Override
public List<Map<String, Object >> getMonitoringCount(String bizOrgCode) {
public List<Map<String, Object>> getMonitoringCount(String bizOrgCode) {
return equipmentSpecificMapper.getMonitoringCount(bizOrgCode);
}
......@@ -2221,4 +2175,9 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
public EquipmentSpecific getEquipSpecificEntityByCode(String 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;
import com.yeejoin.equipmanage.common.entity.CarSpeedWarningRecord;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.CarMapper;
import com.yeejoin.equipmanage.mapper.WlCarSpeedWaringRecordMapper;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService;
......@@ -48,7 +49,7 @@ public class JxiopCarIotListerServiceImpl {
@Autowired
private IWlCarMileageService iWlCarMileageService;
@Autowired
private ICarService iCarService;
private CarMapper carMapper;
@Autowired
private IotFeign iotFeign;
@Autowired
......@@ -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) {
JSONArray sendArr = new JSONArray();
JSONObject sendObj = new JSONObject();
......@@ -200,7 +201,7 @@ public class JxiopCarIotListerServiceImpl {
}
car.setExtra2(power.toString());
logger.info("----------------更新车辆电池电量信息成功----------------");
iCarService.updateById(car);
carMapper.updateById(car);
logger.info("车牌号::" + car.getCarNum() + "最大车速:" + maxSpeed + "当前车速::" + speed);
if ((speed - maxSpeed)>0) {
List<CarSpeedWarningRecord> list = wlCarSpeedWaringRecordMapper.selectList(new QueryWrapper<CarSpeedWarningRecord>().eq("car_num",car.getCarNum()).
......
......@@ -74,9 +74,9 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Autowired
IotFeign iotFeign;
@Autowired
ICarService iCarService;
@Autowired
WlCarMileageMapper wlCarMileageMapper;
@Autowired
CarMapper carMapper;
@Value("${car.max.speed:100}")
private Integer CAR_MAX_SPEED;
@Value("${mileage.parameter}")
......@@ -84,12 +84,8 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Resource
private EmqKeeper emqKeeper;
@Autowired
@Lazy
private IWlCarMileageService iWlCarMileageService;
@Autowired
private RedisTemplate redisTemplate;
@Autowired
CarMapper carMapper;
public static List<String> getDayByMonth(Date date) {
List<String> data = new ArrayList<>();
try {
......@@ -268,7 +264,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
public Map<String, Boolean> getCalender(long id, Date date) {
List<String> daylist = new ArrayList<String>();
Map<String, Boolean> map = new HashMap<>();
Car car = iCarService.getById(id);
Car car = carMapper.selectById(id);
if (car == null || car.getIotCode() == null || date == null) {
return map;
}
......@@ -378,21 +374,21 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
// 里程耗时
long takeTime = (date.getTime()) - (item.getStartTime().getTime());
// 查询车辆最新位置
// 查询车辆最新位置
// 修改0点未结束里程记录
item.setEndSpeed(v.intValue());
item.setEndTime(date);
item.setEndLatitude(startLatitude);
item.setEndLongitude(startLongitude);
item.setEndName("无效坐标");
if(travel>0.5){
String address = getAddress(startLongitude, startLatitude);
item.setEndName(address);
}
item.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
item.setTakeTime(takeTime);
this.getBaseMapper().updateById(item);
// 修改0点未结束里程记录
item.setEndSpeed(v.intValue());
item.setEndTime(date);
item.setEndLatitude(startLatitude);
item.setEndLongitude(startLongitude);
item.setEndName("无效坐标");
if (travel > 0.5) {
String address = getAddress(startLongitude, startLatitude);
item.setEndName(address);
}
item.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
item.setTakeTime(takeTime);
this.getBaseMapper().updateById(item);
log.info("-----------跨天轨迹切分任更新车辆坐标成功:::" + JSONObject.toJSONString(item) + "-----------------");
}
});
......@@ -407,7 +403,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
if (ObjectUtils.isEmpty(redisTemplate.opsForValue().get(item.getIotCode()))) {
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),
item.getStartTime(), new Date(new Date().getTime() + 2000));
List<Object> list1 = result.getResult();
......@@ -459,15 +455,15 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
item.setEndLatitude(startLatitude);
item.setEndLongitude(startLongitude);
item.setEndName("无效坐标");
if(travel>0.5){
if (travel > 0.5) {
String address = getAddress(startLongitude, startLatitude);
item.setEndName(address);
}
item.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
item.setTakeTime(takeTime);
if(travel>0.5){
this.getBaseMapper().updateById(item);
}else {
if (travel > 0.5) {
this.getBaseMapper().updateById(item);
} else {
this.getBaseMapper().deleteById(item.getId());
}
log.info("-----------正常结束轨迹更新车辆坐标成功:::" + JSONObject.toJSONString(item) + "-----------------");
......@@ -535,7 +531,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
wrapper.isNotNull(WlCarMileage::getEndTime);
wrapper.isNotNull(WlCarMileage::getStartTime);
wrapper.like(WlCarMileage::getStartTime, date);
List<WlCarMileage> list = iWlCarMileageService.list(wrapper);
List<WlCarMileage> list = this.list(wrapper);
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)) {
......@@ -555,7 +551,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
wrapper.isNotNull(WlCarMileage::getStartTime);
wrapper.ge(WlCarMileage::getDate, startDate);
wrapper.le(WlCarMileage::getDate, endDate);
List<WlCarMileage> list = iWlCarMileageService.list(wrapper);
List<WlCarMileage> list = this.list(wrapper);
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)) {
......
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