多监测点趋势对比
This commit is contained in:
@@ -4,8 +4,11 @@ import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsTouristDataParm;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -29,23 +32,32 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsTouristDataPOServiceImpl extends ServiceImpl<CsTouristDataPOMapper, CsTouristDataPO> implements CsTouristDataPOService{
|
||||
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean add(List<CsTouristDataParm> csTouristDataParms) {
|
||||
QueryWrapper<CsTouristDataPO> QueryWrapper = new QueryWrapper<>();
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
this.getBaseMapper().delete(null);
|
||||
List<CsTouristDataPO> list = new ArrayList<>();
|
||||
csTouristDataParms.forEach(temp->{
|
||||
QueryWrapper.clear();
|
||||
QueryWrapper.eq(CsTouristDataPO.COL_DEVICE_ID,temp.getDeviceId());
|
||||
CsTouristDataPO csTouristDataPO = this.getBaseMapper().selectOne(QueryWrapper);
|
||||
if(Objects.isNull(csTouristDataPO)){
|
||||
if(!Objects.isNull(csTouristDataPO)){
|
||||
return;
|
||||
}
|
||||
CsTouristDataPO csTouristDataPO1 = new CsTouristDataPO();
|
||||
BeanUtils.copyProperties(temp, csTouristDataPO1);
|
||||
list.add(csTouristDataPO1);
|
||||
csTouristDataPO = new CsTouristDataPO();
|
||||
csTouristDataPO.setDeviceId(temp.getDeviceId());
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("id",temp.getDeviceId());
|
||||
CsLedger csLedger = csLedgerMapper.selectOne(csLedgerQueryWrapper);
|
||||
String[] split = csLedger.getPids().split(",");
|
||||
csTouristDataPO.setEnginerId(split[1]);
|
||||
csTouristDataPO.setProjectId(split[2]);
|
||||
list.add(csTouristDataPO);
|
||||
|
||||
});
|
||||
boolean b = this.saveBatch(list);
|
||||
|
||||
Reference in New Issue
Block a user