Commit bceb4171 authored by KeYong's avatar KeYong

更新

parent 8ae6dde1
...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.bus.sqlsync.mapper.CheckInputMapper; import com.boot.bus.sqlsync.mapper.CheckInputMapper;
import com.boot.bus.sqlsync.service.infc.ICheckInputService; import com.boot.bus.sqlsync.service.infc.ICheckInputService;
import com.yeejoin.amos.patrol.dao.entity.CheckInput; import com.yeejoin.amos.patrol.dao.entity.CheckInput;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
...@@ -22,7 +24,12 @@ public class CheckInputServiceImpl extends ServiceImpl<CheckInputMapper, CheckIn ...@@ -22,7 +24,12 @@ public class CheckInputServiceImpl extends ServiceImpl<CheckInputMapper, CheckIn
@Override @Override
public void asfSaveOrUpdateBatch(List<CheckInput> list) { public void asfSaveOrUpdateBatch(List<CheckInput> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
saveOrUpdateBatch(list); List<CheckInput> checkInputs = list.stream().map(x -> {
CheckInput checkInput = new CheckInput();
BeanUtils.copyProperties(x, checkInput);
return checkInput;
}).collect(Collectors.toList());
saveOrUpdateBatch(checkInputs);
} }
} }
} }
\ No newline at end of file
...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.bus.sqlsync.mapper.CheckMapper; import com.boot.bus.sqlsync.mapper.CheckMapper;
import com.boot.bus.sqlsync.service.infc.ICheckService; import com.boot.bus.sqlsync.service.infc.ICheckService;
import com.yeejoin.amos.patrol.dao.entity.Check; import com.yeejoin.amos.patrol.dao.entity.Check;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
...@@ -22,7 +24,12 @@ public class CheckServiceImpl extends ServiceImpl<CheckMapper, Check> implements ...@@ -22,7 +24,12 @@ public class CheckServiceImpl extends ServiceImpl<CheckMapper, Check> implements
@Override @Override
public void asfSaveOrUpdateBatch(List<Check> list) { public void asfSaveOrUpdateBatch(List<Check> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
saveOrUpdateBatch(list); List<Check> checks = list.stream().map(x -> {
Check check = new Check();
BeanUtils.copyProperties(x, check);
return check;
}).collect(Collectors.toList());
saveOrUpdateBatch(checks);
} }
} }
} }
\ No newline at end of file
package com.boot.bus.sqlsync.service.impl; package com.boot.bus.sqlsync.service.impl;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.bus.sqlsync.mapper.CheckShotMapper; import com.boot.bus.sqlsync.mapper.CheckShotMapper;
import com.boot.bus.sqlsync.service.infc.ICheckShotService; import com.boot.bus.sqlsync.service.infc.ICheckShotService;
import com.yeejoin.amos.patrol.dao.entity.CheckShot; import com.yeejoin.amos.patrol.dao.entity.CheckShot;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
...@@ -22,7 +25,17 @@ public class CheckShotServiceImpl extends ServiceImpl<CheckShotMapper, CheckShot ...@@ -22,7 +25,17 @@ public class CheckShotServiceImpl extends ServiceImpl<CheckShotMapper, CheckShot
@Override @Override
public void asfSaveOrUpdateBatch(List<CheckShot> list) { public void asfSaveOrUpdateBatch(List<CheckShot> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
saveOrUpdateBatch(list); List<CheckShot> checkShots = list.stream().map(x -> {
CheckShot checkShot = new CheckShot();
BeanUtils.copyProperties(x, checkShot);
if (!StringUtils.isNotEmpty(checkShot.getShotType())) {
checkShot.setShotType("");
}
return checkShot;
}).collect(Collectors.toList());
if (0 < checkShots.stream().filter(x -> null != x.getShotType()).collect(Collectors.toList()).size()) {
saveOrUpdateBatch(checkShots);
}
} }
} }
} }
\ No newline at end of file
...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.bus.sqlsync.mapper.LatentDangerFlowRecordMapper; import com.boot.bus.sqlsync.mapper.LatentDangerFlowRecordMapper;
import com.boot.bus.sqlsync.service.infc.ILatentDangerFlowRecordService; import com.boot.bus.sqlsync.service.infc.ILatentDangerFlowRecordService;
import com.yeejoin.amos.patrol.dao.entity.LatentDangerFlowRecord; import com.yeejoin.amos.patrol.dao.entity.LatentDangerFlowRecord;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
...@@ -22,7 +24,14 @@ public class LatentDangerFlowRecordServiceImpl extends ServiceImpl<LatentDangerF ...@@ -22,7 +24,14 @@ public class LatentDangerFlowRecordServiceImpl extends ServiceImpl<LatentDangerF
@Override @Override
public void asfSaveOrUpdateBatch(List<LatentDangerFlowRecord> list) { public void asfSaveOrUpdateBatch(List<LatentDangerFlowRecord> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
saveOrUpdateBatch(list); List<LatentDangerFlowRecord> latentDangerFlowRecords = list.stream().map(x -> {
LatentDangerFlowRecord latentDangerFlowRecord = new LatentDangerFlowRecord();
BeanUtils.copyProperties(x, latentDangerFlowRecord);
return latentDangerFlowRecord;
}).collect(Collectors.toList());
if (0 < latentDangerFlowRecords.stream().filter(x -> null != x.getDangerId()).collect(Collectors.toList()).size()) {
saveOrUpdateBatch(latentDangerFlowRecords);
}
} }
} }
} }
\ No newline at end of file
...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.bus.sqlsync.mapper.LatentDangerPatrolMapper; import com.boot.bus.sqlsync.mapper.LatentDangerPatrolMapper;
import com.boot.bus.sqlsync.service.infc.ILatentDangerPatrolService; import com.boot.bus.sqlsync.service.infc.ILatentDangerPatrolService;
import com.yeejoin.amos.patrol.dao.entity.LatentDangerPatrol; import com.yeejoin.amos.patrol.dao.entity.LatentDangerPatrol;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
...@@ -22,7 +24,12 @@ public class LatentDangerPatrolServiceImpl extends ServiceImpl<LatentDangerPatro ...@@ -22,7 +24,12 @@ public class LatentDangerPatrolServiceImpl extends ServiceImpl<LatentDangerPatro
@Override @Override
public void asfSaveOrUpdateBatch(List<LatentDangerPatrol> list) { public void asfSaveOrUpdateBatch(List<LatentDangerPatrol> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
saveOrUpdateBatch(list); List<LatentDangerPatrol> latentDangerPatrols = list.stream().map(x -> {
LatentDangerPatrol latentDangerPatrol = new LatentDangerPatrol();
BeanUtils.copyProperties(x, latentDangerPatrol);
return latentDangerPatrol;
}).collect(Collectors.toList());
saveOrUpdateBatch(latentDangerPatrols);
} }
} }
} }
\ No newline at end of file
...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.bus.sqlsync.mapper.LatentDangerPhotoMapper; import com.boot.bus.sqlsync.mapper.LatentDangerPhotoMapper;
import com.boot.bus.sqlsync.service.infc.ILatentDangerPhotoService; import com.boot.bus.sqlsync.service.infc.ILatentDangerPhotoService;
import com.yeejoin.amos.patrol.dao.entity.LatentDangerPhoto; import com.yeejoin.amos.patrol.dao.entity.LatentDangerPhoto;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
...@@ -22,7 +24,12 @@ public class LatentDangerPhotoServiceImpl extends ServiceImpl<LatentDangerPhotoM ...@@ -22,7 +24,12 @@ public class LatentDangerPhotoServiceImpl extends ServiceImpl<LatentDangerPhotoM
@Override @Override
public void asfSaveOrUpdateBatch(List<LatentDangerPhoto> list) { public void asfSaveOrUpdateBatch(List<LatentDangerPhoto> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
saveOrUpdateBatch(list); List<LatentDangerPhoto> latentDangerPhotos = list.stream().map(x -> {
LatentDangerPhoto latentDangerPhoto = new LatentDangerPhoto();
BeanUtils.copyProperties(x, latentDangerPhoto);
return latentDangerPhoto;
}).collect(Collectors.toList());
saveOrUpdateBatch(latentDangerPhotos);
} }
} }
} }
\ No newline at end of file
package com.boot.bus.sqlsync.service.impl; package com.boot.bus.sqlsync.service.impl;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.bus.sqlsync.mapper.LatentDangerMapper; import com.boot.bus.sqlsync.mapper.LatentDangerMapper;
import com.boot.bus.sqlsync.service.infc.ILatentDangerService; import com.boot.bus.sqlsync.service.infc.ILatentDangerService;
import com.yeejoin.amos.patrol.dao.entity.LatentDanger; import com.yeejoin.amos.patrol.dao.entity.LatentDanger;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
...@@ -22,7 +25,14 @@ public class LatentDangerServiceImpl extends ServiceImpl<LatentDangerMapper, Lat ...@@ -22,7 +25,14 @@ public class LatentDangerServiceImpl extends ServiceImpl<LatentDangerMapper, Lat
@Override @Override
public void asfSaveOrUpdateBatch(List<LatentDanger> list) { public void asfSaveOrUpdateBatch(List<LatentDanger> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
saveOrUpdateBatch(list); List<LatentDanger> latentDangers = list.stream().map(x -> {
LatentDanger latentDanger = new LatentDanger();
BeanUtils.copyProperties(x, latentDanger);
return latentDanger;
}).collect(Collectors.toList());
if (0 < latentDangers.stream().filter(x -> null != x.getDangerName()).collect(Collectors.toList()).size()) {
saveOrUpdateBatch(latentDangers);
}
} }
} }
} }
\ No newline at end of file
...@@ -10,6 +10,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance; ...@@ -10,6 +10,7 @@ import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo; import com.yeejoin.amos.fas.datasync.bo.ContingencyOriginalDataSyncBo;
import com.yeejoin.amos.fas.datasync.bo.PlanDetailSyncBo; import com.yeejoin.amos.fas.datasync.bo.PlanDetailSyncBo;
import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo; import com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo;
import com.yeejoin.amos.patrol.dao.entity.*;
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.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -44,6 +45,33 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -44,6 +45,33 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Autowired @Autowired
private IContingencyPlanInstance contingencyPlanInstance; private IContingencyPlanInstance contingencyPlanInstance;
@Autowired
private ICheckService checkService;
@Autowired
private ICheckInputService checkInputService;
@Autowired
private ICheckShotService checkShotService;
@Autowired
private ILatentDangerService latentDangerService;
@Autowired
private ILatentDangerPhotoService latentDangerPhotoService;
@Autowired
private ILatentDangerFlowRecordService latentDangerFlowRecordService;
@Autowired
private ILatentDangerPatrolService latentDangerPatrolService;
@Autowired
private IPlanTaskService planTaskService;
@Autowired
private IPlanTaskDetailService planTaskDetailService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void handlerMqttIncrementMessage(String topic, String message) { public void handlerMqttIncrementMessage(String topic, String message) {
...@@ -107,99 +135,99 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -107,99 +135,99 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
case PATROL_CHECK: { case PATROL_CHECK: {
switch (operation) { switch (operation) {
case DELETE: { case DELETE: {
checkService.asfDeleteByIds(data.stream().map(x -> ((JSONObject) x).toJavaObject(Check.class).getId()).collect(Collectors.toList()));
break; break;
} }
default: { default: {
checkService.asfSaveOrUpdateBatch(data.stream().map(x -> ((JSONObject) x).toJavaObject(Check.class)).collect(Collectors.toList()));
} }
} }
} }
case PATROL_CHECK_INPUT: { case PATROL_CHECK_INPUT: {
switch (operation) { switch (operation) {
case DELETE: { case DELETE: {
checkInputService.asfDeleteByIds(data.stream().map(x -> ((JSONObject) x).toJavaObject(CheckInput.class).getId()).collect(Collectors.toList()));
break; break;
} }
default: { default: {
checkInputService.asfSaveOrUpdateBatch(data.stream().map(x -> ((JSONObject) x).toJavaObject(CheckInput.class)).collect(Collectors.toList()));
} }
} }
} }
case PATROL_CHECK_SHOT: { case PATROL_CHECK_SHOT: {
switch (operation) { switch (operation) {
case DELETE: { case DELETE: {
checkShotService.asfDeleteByIds(data.stream().map(x -> ((JSONObject) x).toJavaObject(CheckShot.class).getId()).collect(Collectors.toList()));
break; break;
} }
default: { default: {
checkShotService.asfSaveOrUpdateBatch(data.stream().map(x -> ((JSONObject) x).toJavaObject(CheckShot.class)).collect(Collectors.toList()));
} }
} }
} }
case PATROL_LATENT_DANGER: { case PATROL_LATENT_DANGER: {
switch (operation) { switch (operation) {
case DELETE: { case DELETE: {
latentDangerService.asfDeleteByIds(data.stream().map(x -> ((JSONObject) x).toJavaObject(LatentDanger.class).getId()).collect(Collectors.toList()));
break; break;
} }
default: { default: {
latentDangerService.asfSaveOrUpdateBatch(data.stream().map(x -> ((JSONObject) x).toJavaObject(LatentDanger.class)).collect(Collectors.toList()));
} }
} }
} }
case PATROL_LATENT_DANGER_FLOW_RECORD: { case PATROL_LATENT_DANGER_FLOW_RECORD: {
switch (operation) { switch (operation) {
case DELETE: { case DELETE: {
latentDangerFlowRecordService.asfDeleteByIds(data.stream().map(x -> ((JSONObject) x).toJavaObject(LatentDangerFlowRecord.class).getId()).collect(Collectors.toList()));
break; break;
} }
default: { default: {
latentDangerFlowRecordService.asfSaveOrUpdateBatch(data.stream().map(x -> ((JSONObject) x).toJavaObject(LatentDangerFlowRecord.class)).collect(Collectors.toList()));
} }
} }
} }
case PATROL_LATENT_DANGER_PATROL: { case PATROL_LATENT_DANGER_PATROL: {
switch (operation) { switch (operation) {
case DELETE: { case DELETE: {
latentDangerPatrolService.asfDeleteByIds(data.stream().map(x -> ((JSONObject) x).toJavaObject(LatentDangerPatrol.class).getId()).collect(Collectors.toList()));
break; break;
} }
default: { default: {
latentDangerPatrolService.asfSaveOrUpdateBatch(data.stream().map(x -> ((JSONObject) x).toJavaObject(LatentDangerPatrol.class)).collect(Collectors.toList()));
} }
} }
} }
case PATROL_LATENT_DANGER_PHOTO: { case PATROL_LATENT_DANGER_PHOTO: {
switch (operation) { switch (operation) {
case DELETE: { case DELETE: {
latentDangerPhotoService.asfDeleteByIds(data.stream().map(x -> ((JSONObject) x).toJavaObject(LatentDangerPhoto.class).getId()).collect(Collectors.toList()));
break; break;
} }
default: { default: {
latentDangerPhotoService.asfSaveOrUpdateBatch(data.stream().map(x -> ((JSONObject) x).toJavaObject(LatentDangerPhoto.class)).collect(Collectors.toList()));
} }
} }
} }
case PATROL_PLAN_TASK: { case PATROL_PLAN_TASK: {
switch (operation) { switch (operation) {
case DELETE: { case DELETE: {
planTaskService.asfDeleteByIds(data.stream().map(x -> ((JSONObject) x).toJavaObject(PlanTask.class).getId()).collect(Collectors.toList()));
break; break;
} }
default: { default: {
planTaskService.asfSaveOrUpdateBatch(data.stream().map(x -> ((JSONObject) x).toJavaObject(PlanTask.class)).collect(Collectors.toList()));
} }
} }
} }
case PATROL_PLAN_TASK_DETAIL: { case PATROL_PLAN_TASK_DETAIL: {
switch (operation) { switch (operation) {
case DELETE: { case DELETE: {
planTaskDetailService.asfDeleteByIds(data.stream().map(x -> ((JSONObject) x).toJavaObject(PlanTaskDetail.class).getId()).collect(Collectors.toList()));
break; break;
} }
default: { default: {
planTaskDetailService.asfSaveOrUpdateBatch(data.stream().map(x -> ((JSONObject) x).toJavaObject(PlanTaskDetail.class)).collect(Collectors.toList()));
} }
} }
} }
......
...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.bus.sqlsync.mapper.PlanTaskDetailMapper; import com.boot.bus.sqlsync.mapper.PlanTaskDetailMapper;
import com.boot.bus.sqlsync.service.infc.IPlanTaskDetailService; import com.boot.bus.sqlsync.service.infc.IPlanTaskDetailService;
import com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail; import com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
...@@ -22,7 +24,12 @@ public class PlanTaskDetailServiceImpl extends ServiceImpl<PlanTaskDetailMapper, ...@@ -22,7 +24,12 @@ public class PlanTaskDetailServiceImpl extends ServiceImpl<PlanTaskDetailMapper,
@Override @Override
public void asfSaveOrUpdateBatch(List<PlanTaskDetail> list) { public void asfSaveOrUpdateBatch(List<PlanTaskDetail> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
saveOrUpdateBatch(list); List<PlanTaskDetail> planTaskDetails = list.stream().map(x -> {
PlanTaskDetail planTaskDetail = new PlanTaskDetail();
BeanUtils.copyProperties(x, planTaskDetail);
return planTaskDetail;
}).collect(Collectors.toList());
saveOrUpdateBatch(planTaskDetails);
} }
} }
} }
\ No newline at end of file
...@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.bus.sqlsync.mapper.PlanTaskMapper; import com.boot.bus.sqlsync.mapper.PlanTaskMapper;
import com.boot.bus.sqlsync.service.infc.IPlanTaskService; import com.boot.bus.sqlsync.service.infc.IPlanTaskService;
import com.yeejoin.amos.patrol.dao.entity.PlanTask; import com.yeejoin.amos.patrol.dao.entity.PlanTask;
import org.apache.commons.beanutils.PropertyUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
...@@ -22,7 +25,12 @@ public class PlanTaskServiceImpl extends ServiceImpl<PlanTaskMapper, PlanTask> i ...@@ -22,7 +25,12 @@ public class PlanTaskServiceImpl extends ServiceImpl<PlanTaskMapper, PlanTask> i
@Override @Override
public void asfSaveOrUpdateBatch(List<PlanTask> list) { public void asfSaveOrUpdateBatch(List<PlanTask> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
saveOrUpdateBatch(list); List<PlanTask> planTasks = list.stream().map(x -> {
PlanTask planTask = new PlanTask();
BeanUtils.copyProperties(x, planTask);
return planTask;
}).collect(Collectors.toList());
saveOrUpdateBatch(planTasks);
} }
} }
} }
\ No newline at end of file
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