离线数据上传
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
@@ -83,6 +86,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
|
|
||||||
private final EvtDataMapper evtDataMapper;
|
private final EvtDataMapper evtDataMapper;
|
||||||
|
|
||||||
|
private final MqttPublisher publisher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||||
Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
||||||
@@ -238,8 +243,9 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
boolean minFlag = true;
|
boolean minFlag = true;
|
||||||
//开始上传文件、记录上传日志、解析的文件结果入库
|
//开始上传文件、记录上传日志、解析的文件结果入库
|
||||||
//最外层便利所有文件确保所有文件都上传及记录上传日志
|
//最外层便利所有文件确保所有文件都上传及记录上传日志
|
||||||
|
int nowStep = 0;
|
||||||
for(MultipartFile file : uploadDataParam.getFiles()){
|
for(MultipartFile file : uploadDataParam.getFiles()){
|
||||||
|
|
||||||
//初始上传日志基本信息
|
//初始上传日志基本信息
|
||||||
PortableOfflLog portableOfflLog = new PortableOfflLog();
|
PortableOfflLog portableOfflLog = new PortableOfflLog();
|
||||||
portableOfflLog.setName(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("/")+1));
|
portableOfflLog.setName(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("/")+1));
|
||||||
@@ -433,6 +439,10 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
nowStep++;
|
||||||
|
String json = "{allStep:"+uploadDataParam.getFiles().size()+",nowStep:"+nowStep+"}";
|
||||||
|
|
||||||
|
publisher.send("/dataOnlineRecruitment/Progress/" + uploadDataParam.getLineId(), new Gson().toJson(json), 1, false);
|
||||||
this.baseMapper.insert(portableOfflLog);
|
this.baseMapper.insert(portableOfflLog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user