|
|
@@ -2,26 +2,27 @@ package org.springblade.manager.service.impl;
|
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
-import com.alibaba.druid.support.json.JSONUtils;
|
|
|
import com.alibaba.nacos.common.utils.MD5Utils;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
-import org.springblade.core.tool.jackson.JsonUtil;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.core.tool.utils.CollectionUtil;
|
|
|
-import org.springblade.manager.dto.QProfilerOffsetResultDTO;
|
|
|
-import org.springblade.manager.entity.QProfilerData;
|
|
|
-import org.springblade.manager.entity.QProfilerOffset;
|
|
|
-import org.springblade.manager.entity.QProfilerStandardSectionBean;
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
+import org.springblade.manager.dto.ProfilerOffsetDTO;
|
|
|
+import org.springblade.manager.dto.ProfilerOffsetResultDTO;
|
|
|
+import org.springblade.manager.entity.ProfilerData;
|
|
|
+import org.springblade.manager.entity.ProfilerOffset;
|
|
|
+import org.springblade.manager.entity.ProfilerStandardSectionBean;
|
|
|
import org.springblade.manager.entity.profiler.ProfilerResult;
|
|
|
import org.springblade.manager.entity.profiler.ProfilerSaveDTO;
|
|
|
-import org.springblade.manager.service.QProfilerDataService;
|
|
|
-import org.springblade.manager.service.QProfilerOffsetService;
|
|
|
-import org.springblade.manager.mapper.QProfilerOffsetMapper;
|
|
|
-import org.springblade.manager.service.QProfilerStandardSectionBeanService;
|
|
|
-import org.springblade.manager.utils.FileUtils;
|
|
|
+import org.springblade.manager.service.ProfilerDataService;
|
|
|
+import org.springblade.manager.service.ProfilerOffsetService;
|
|
|
+import org.springblade.manager.mapper.ProfilerOffsetMapper;
|
|
|
+import org.springblade.manager.service.ProfilerStandardSectionBeanService;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -37,8 +38,8 @@ import java.util.List;
|
|
|
* @createDate 2025-10-27 15:58:56
|
|
|
*/
|
|
|
@Service
|
|
|
-public class QProfilerOffsetServiceImpl extends ServiceImpl<QProfilerOffsetMapper, QProfilerOffset>
|
|
|
- implements QProfilerOffsetService {
|
|
|
+public class ProfilerOffsetServiceImpl extends ServiceImpl<ProfilerOffsetMapper, ProfilerOffset>
|
|
|
+ implements ProfilerOffsetService {
|
|
|
|
|
|
//第三方的appKey 固定值
|
|
|
private final static String APP_KEY = "QDM123";
|
|
|
@@ -49,9 +50,9 @@ public class QProfilerOffsetServiceImpl extends ServiceImpl<QProfilerOffsetMappe
|
|
|
@Resource
|
|
|
private NewIOSSClient newIOSSClient;
|
|
|
@Resource
|
|
|
- private QProfilerDataService dataService;
|
|
|
+ private ProfilerDataService dataService;
|
|
|
@Resource
|
|
|
- private QProfilerStandardSectionBeanService beanService;
|
|
|
+ private ProfilerStandardSectionBeanService beanService;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -80,13 +81,13 @@ public class QProfilerOffsetServiceImpl extends ServiceImpl<QProfilerOffsetMappe
|
|
|
return ProfilerResult.error("10009","data参数格式错误","");
|
|
|
}
|
|
|
//获取基础信息 + 测量者信息
|
|
|
- QProfilerOffset offset = jsonObject.getBean("offset", QProfilerOffset.class);
|
|
|
+ ProfilerOffset offset = jsonObject.getBean("offset", ProfilerOffset.class);
|
|
|
if(offset == null){
|
|
|
- offset = new QProfilerOffset();
|
|
|
+ offset = new ProfilerOffset();
|
|
|
}
|
|
|
offset.setId(id);
|
|
|
offset.setDeviceCode(deviceCode);
|
|
|
- QProfilerOffset info = jsonObject.getBean("info", QProfilerOffset.class);
|
|
|
+ ProfilerOffset info = jsonObject.getBean("info", ProfilerOffset.class);
|
|
|
//把测量者信息赋值给基础信息对象
|
|
|
if(info != null){
|
|
|
offset.setChannelName(info.getChannelName());
|
|
|
@@ -98,9 +99,9 @@ public class QProfilerOffsetServiceImpl extends ServiceImpl<QProfilerOffsetMappe
|
|
|
}
|
|
|
//获取标准断面数据
|
|
|
JSONObject mStandardSectionDataBeanList = jsonObject.getJSONObject("standardSectionBean");
|
|
|
- List<QProfilerStandardSectionBean> standardSectionBean = null;
|
|
|
+ List<ProfilerStandardSectionBean> standardSectionBean = null;
|
|
|
if(mStandardSectionDataBeanList != null){
|
|
|
- standardSectionBean = mStandardSectionDataBeanList.getBeanList("mStandardSectionDataBeanList", QProfilerStandardSectionBean.class);
|
|
|
+ standardSectionBean = mStandardSectionDataBeanList.getBeanList("mStandardSectionDataBeanList", ProfilerStandardSectionBean.class);
|
|
|
if(standardSectionBean != null){
|
|
|
standardSectionBean.forEach(f ->{
|
|
|
f.setId(SnowFlakeUtil.getId());
|
|
|
@@ -109,7 +110,7 @@ public class QProfilerOffsetServiceImpl extends ServiceImpl<QProfilerOffsetMappe
|
|
|
}
|
|
|
}
|
|
|
//获取测量数据
|
|
|
- List<QProfilerData> data = jsonObject.getBeanList("data", QProfilerData.class);
|
|
|
+ List<ProfilerData> data = jsonObject.getBeanList("data", ProfilerData.class);
|
|
|
if(data != null){
|
|
|
data.forEach(f -> {
|
|
|
f.setId(SnowFlakeUtil.getId());
|
|
|
@@ -150,13 +151,13 @@ public class QProfilerOffsetServiceImpl extends ServiceImpl<QProfilerOffsetMappe
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public QProfilerOffsetResultDTO getOne(Long id) {
|
|
|
- QProfilerOffset byId = this.getById(id);
|
|
|
+ public ProfilerOffsetResultDTO getOne(Long id) {
|
|
|
+ ProfilerOffset byId = this.getById(id);
|
|
|
if(byId != null){
|
|
|
- QProfilerOffsetResultDTO resultDTO = BeanUtil.copyProperties(byId, QProfilerOffsetResultDTO.class);
|
|
|
+ ProfilerOffsetResultDTO resultDTO = BeanUtil.copyProperties(byId, ProfilerOffsetResultDTO.class);
|
|
|
if(resultDTO != null){
|
|
|
- List<QProfilerStandardSectionBean> list = beanService.list(Wrappers.<QProfilerStandardSectionBean>lambdaQuery().eq(QProfilerStandardSectionBean::getOffsetId, id));
|
|
|
- List<QProfilerData> list1 = dataService.list(Wrappers.<QProfilerData>lambdaQuery().eq(QProfilerData::getOffsetId, id));
|
|
|
+ List<ProfilerStandardSectionBean> list = beanService.list(Wrappers.<ProfilerStandardSectionBean>lambdaQuery().eq(ProfilerStandardSectionBean::getOffsetId, id));
|
|
|
+ List<ProfilerData> list1 = dataService.list(Wrappers.<ProfilerData>lambdaQuery().eq(ProfilerData::getOffsetId, id));
|
|
|
resultDTO.setSectionBeans(list);
|
|
|
resultDTO.setData(list1);
|
|
|
}
|
|
|
@@ -167,20 +168,30 @@ public class QProfilerOffsetServiceImpl extends ServiceImpl<QProfilerOffsetMappe
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public boolean edit(QProfilerOffsetResultDTO offset) {
|
|
|
- QProfilerOffset qProfilerOffset = BeanUtil.copyProperties(offset, QProfilerOffset.class);
|
|
|
+ public boolean edit(ProfilerOffsetResultDTO offset) {
|
|
|
+ ProfilerOffset qProfilerOffset = BeanUtil.copyProperties(offset, ProfilerOffset.class);
|
|
|
boolean update = this.updateById(qProfilerOffset);
|
|
|
|
|
|
- List<QProfilerStandardSectionBean> sectionBeans = offset.getSectionBeans();
|
|
|
+ List<ProfilerStandardSectionBean> sectionBeans = offset.getSectionBeans();
|
|
|
if(CollectionUtil.isNotEmpty(sectionBeans)){
|
|
|
beanService.updateBatchById(sectionBeans);
|
|
|
}
|
|
|
- List<QProfilerData> data = offset.getData();
|
|
|
+ List<ProfilerData> data = offset.getData();
|
|
|
if(CollectionUtil.isNotEmpty(data)){
|
|
|
dataService.updateBatchById(data);
|
|
|
}
|
|
|
return update;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<ProfilerOffset> getPage(ProfilerOffsetDTO offset) {
|
|
|
+ QueryWrapper<ProfilerOffset> qProfilerOffsetQueryWrapper = new QueryWrapper<>();
|
|
|
+ qProfilerOffsetQueryWrapper.lambda()
|
|
|
+ .eq(StringUtil.isNotBlank(offset.getUserName()), ProfilerOffset::getUserName, offset.getUserName())
|
|
|
+ .ge(StringUtil.isNotBlank(offset.getStartTime()), ProfilerOffset::getDate, offset.getStartTime())
|
|
|
+ .le(StringUtil.isNotBlank(offset.getEndTime()), ProfilerOffset::getDate, offset.getEndTime());
|
|
|
+ return baseMapper.selectPage(new Page<>(offset.getCurrent(), offset.getSize()),qProfilerOffsetQueryWrapper);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|