Commit 1736e103 by 梁家彪

完善数据汇聚日志

parent 33ece2e3
......@@ -27,9 +27,9 @@ public class DataCollectLogController {
// }
@ApiOperation("分页获取数据汇聚日志")
@PostMapping(value = "/page")
public ResultVo getDataCollectDetails(@RequestBody DataCollectLogReq req) {
return ResultVo.success(dataCollectLogService.page(req));
@PostMapping(value = "/list")
public ResultVo getList(@RequestBody DataCollectLogReq req) {
return ResultVo.success(dataCollectLogService.getList(req));
}
@ApiOperation("删除数据汇聚日志")
......@@ -42,9 +42,15 @@ public class DataCollectLogController {
@ApiOperation("批量删除数据汇聚设置")
@DeleteMapping(value = "/batchDelete")
public ResultVo batchDelete(@RequestBody List<Long> ids) {
public ResultVo batchDelete(@RequestBody List<Integer> ids) {
boolean b = dataCollectLogService.removeByIds(ids);
AssertUtils.isTrue(b, "操作失败");
return ResultVo.success("操作成功");
}
@ApiOperation("获取文件汇聚日志")
@GetMapping(value = "/file/{id}")
public ResultVo file(@PathVariable Integer id) {
return ResultVo.success(dataCollectLogService.file(id));
}
}
\ No newline at end of file
package com.zq.dataoperation.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.dataoperation.entity.DataCollectFileLog;
public interface DataCollectFileLogDao extends BaseMapper<DataCollectFileLog> {
}
\ No newline at end of file
package com.zq.dataoperation.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DataCollectFileLog {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 文件汇聚id
*/
private Integer dataCollectSettingFileId;
/**
* 文件存储目录
*/
private String fileFolder;
/**
* 文件名称
*/
private String fileName;
/**
* OCR(0未做 1完成)
*/
private String ocrFlag;
/**
* createTime
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
* updateTime
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;;
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ public class DataCollectSettingFile {
* id
*/
@TableId(type = IdType.AUTO)
private Long id;
private Integer id;
/**
* 数据汇聚id
......
......@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.dataoperation.dao.DataCollectFileLogDao;
import com.zq.dataoperation.dao.DataCollectTaskLogDao;
import com.zq.dataoperation.entity.DataCollectSetting;
import com.zq.dataoperation.entity.DataCollectFileLog;
import com.zq.dataoperation.entity.DataCollectTaskLog;
import com.zq.dataoperation.vo.DataCollectLogReq;
import com.zq.dataoperation.vo.DataCollectTaskLogResp;
......@@ -26,30 +28,20 @@ public class DataCollectLogService extends ServiceImpl<DataCollectTaskLogDao, Da
@Resource
private DataCollectService dataCollectService;
public PageVo getPageDataCollectLog(DataCollectLogReq req) {
@Resource
private DataCollectFileLogDao dataCollectFileLogDao;
public PageVo getList(DataCollectLogReq req) {
LambdaQueryWrapper<DataCollectTaskLog> wrapper = new LambdaQueryWrapper<>();
PageVo pageVo = PagingUtils.paging(req, dataCollectTaskLogDao, DataCollectTaskLog.class, wrapper);
List<DataCollectTaskLogResp> taskLogRespList = new ArrayList<>(pageVo.getRows().size());
for (Object row : pageVo.getRows()) {
DataCollectTaskLog dataCollectTaskLog = (DataCollectTaskLog) row;
DataCollectTaskLogResp resp = new DataCollectTaskLogResp();
DataCollectSetting dataCollectSetting = dataCollectService.getById(dataCollectTaskLog.getDataCollectSettingId());
resp.setTaskName(dataCollectSetting.getTaskName());
BeanUtil.copyProperties(dataCollectTaskLog, resp);
taskLogRespList.add(resp);
}
pageVo.setRows(taskLogRespList);
return pageVo;
if(null == dataCollectSetting){
continue;
}
public PageVo page(DataCollectLogReq req) {
LambdaQueryWrapper<DataCollectTaskLog> wrapper = new LambdaQueryWrapper<>();
PageVo pageVo = PagingUtils.paging(req, dataCollectTaskLogDao, DataCollectTaskLog.class, wrapper);
List<DataCollectTaskLogResp> taskLogRespList = new ArrayList<>(pageVo.getRows().size());
for (Object row : pageVo.getRows()) {
DataCollectTaskLog dataCollectTaskLog = (DataCollectTaskLog) row;
DataCollectTaskLogResp resp = new DataCollectTaskLogResp();
DataCollectSetting dataCollectSetting = dataCollectService.getById(dataCollectTaskLog.getDataCollectSettingId());
resp.setTaskName(dataCollectSetting.getTaskName());
BeanUtil.copyProperties(dataCollectTaskLog, resp);
taskLogRespList.add(resp);
......@@ -57,4 +49,8 @@ public class DataCollectLogService extends ServiceImpl<DataCollectTaskLogDao, Da
pageVo.setRows(taskLogRespList);
return pageVo;
}
public List<DataCollectFileLog> file(Integer id){
return dataCollectFileLogDao.selectList(new LambdaQueryWrapper<DataCollectFileLog>().eq(DataCollectFileLog::getDataCollectSettingFileId, id));
}
}
\ No newline at end of file
......@@ -29,8 +29,8 @@ import java.util.HashMap;
import java.util.List;
@Slf4j
@RequiredArgsConstructor
@Service
@RequiredArgsConstructor
public class DataCollectService extends ServiceImpl<DataCollectDao, DataCollectSetting> {
@Resource
......@@ -110,7 +110,6 @@ public class DataCollectService extends ServiceImpl<DataCollectDao, DataCollectS
AssertUtils.isTrue(updateById(dataCollectSettingAddReq), "修改失败");
}
@Transactional
public void delete(Integer id){
DataCollectSetting dataCollectSetting = getById(id);
UpdateWrapper wrapper = new UpdateWrapper();
......@@ -119,6 +118,7 @@ public class DataCollectService extends ServiceImpl<DataCollectDao, DataCollectS
AssertUtils.isTrue(removeById(id), "删除失败");
}
@Transactional
public void batchDelete(List<Integer> ids){
for (Integer id : ids) {
delete(id);
......@@ -139,29 +139,4 @@ public class DataCollectService extends ServiceImpl<DataCollectDao, DataCollectS
throw new BusinessException("不支持的类型");
}
}
public Object getObj(int dataType){
switch (dataType) {
case 1:
return new DataCollectSettingDb();
case 2:
return new DataCollectSettingFile();
case 3:
return new DataCollectSettingApi();
case 4:
return new DataCollectSettingSite();
default:
throw new BusinessException("不支持的类型");
}
}
public<T> List<T> objToList(Object obj, Class<T> clazz){
List<T> list = new ArrayList<>();
if(obj instanceof List<?>){
for (Object o : (List<?>) obj) {
list.add(clazz.cast(o));
}
}
return list;
}
}
\ 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