feat: 新增导入任务和填报逻辑优化
This commit is contained in:
parent
7d95fd9b27
commit
3c59926bf9
@ -0,0 +1,162 @@
|
||||
package com.yfd.platform.data.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.common.DataSourceLoadOptionsBase;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.data.domain.ImportTask;
|
||||
import com.yfd.platform.data.service.IImportTaskService;
|
||||
import com.yfd.platform.utils.KendoUtil;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 导入任务表 前端控制器
|
||||
* </p>
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/data/importTask")
|
||||
@Tag(name = "导入任务管理")
|
||||
public class ImportTaskController {
|
||||
|
||||
@Resource
|
||||
private IImportTaskService importTaskService;
|
||||
|
||||
// @GetMapping("/page")
|
||||
// @Operation(summary = "分页查询导入任务")
|
||||
// public ResponseResult queryPageList(
|
||||
// @RequestParam(defaultValue = "1") Integer current,
|
||||
// @RequestParam(defaultValue = "10") Integer size,
|
||||
// @RequestParam(required = false) String bizType,
|
||||
// @RequestParam(required = false) String status,
|
||||
// @RequestParam(required = false) Long uploadUserId) {
|
||||
// Page<ImportTask> page = new Page<>(current, size);
|
||||
// Page<ImportTask> result = importTaskService.queryPageList(page, bizType, status, uploadUserId);
|
||||
// return ResponseResult.successData(result);
|
||||
// }
|
||||
@PostMapping("/page")
|
||||
@Operation(summary = "分页查询导入任务")
|
||||
public ResponseResult queryPageList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
Page page = KendoUtil.getPage(dataSourceRequest);
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
|
||||
String bizType = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "bizType");
|
||||
String status = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "status");
|
||||
String uploadUserId = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "uploadUserId");
|
||||
Page<ImportTask> result = importTaskService.queryPageList(page, bizType, status, uploadUserId);
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "查询导入任务列表")
|
||||
public ResponseResult list() {
|
||||
List<ImportTask> list = importTaskService.list();
|
||||
return ResponseResult.successData(list);
|
||||
}
|
||||
|
||||
@GetMapping("/getById")
|
||||
@Operation(summary = "根据ID查询")
|
||||
public ResponseResult getById(@RequestParam Long id) {
|
||||
ImportTask importTask = importTaskService.getById(id);
|
||||
return ResponseResult.successData(importTask);
|
||||
}
|
||||
|
||||
@GetMapping("/getByImportNo")
|
||||
@Operation(summary = "根据任务编号查询")
|
||||
public ResponseResult getByImportNo(@RequestParam String importNo) {
|
||||
ImportTask importTask = importTaskService.getByImportNo(importNo);
|
||||
return ResponseResult.successData(importTask);
|
||||
}
|
||||
|
||||
@GetMapping("/getByBizType")
|
||||
@Operation(summary = "根据业务类型查询")
|
||||
public ResponseResult getByBizType(@RequestParam String bizType) {
|
||||
List<ImportTask> list = importTaskService.getByBizType(bizType);
|
||||
return ResponseResult.successData(list);
|
||||
}
|
||||
|
||||
@GetMapping("/getByStatus")
|
||||
@Operation(summary = "根据状态查询")
|
||||
public ResponseResult getByStatus(@RequestParam String status) {
|
||||
List<ImportTask> list = importTaskService.getByStatus(status);
|
||||
return ResponseResult.successData(list);
|
||||
}
|
||||
|
||||
@PostMapping("/createTask")
|
||||
@Operation(summary = "创建导入任务")
|
||||
public ResponseResult createTask(@RequestBody ImportTask importTask) {
|
||||
boolean result = importTaskService.createTask(importTask);
|
||||
return result ? ResponseResult.success("创建成功") : ResponseResult.error("创建失败");
|
||||
}
|
||||
|
||||
@PostMapping("/updateStatus")
|
||||
@Operation(summary = "更新任务状态")
|
||||
public ResponseResult updateStatus(@RequestParam String id,
|
||||
@RequestParam String status,
|
||||
@RequestParam(required = false) String errorMsg) {
|
||||
boolean result = importTaskService.updateStatus(id, status, errorMsg);
|
||||
return result ? ResponseResult.success("更新成功") : ResponseResult.error("更新失败");
|
||||
}
|
||||
|
||||
@PostMapping("/updateProgress")
|
||||
@Operation(summary = "更新解析进度")
|
||||
public ResponseResult updateProgress(@RequestParam String id,
|
||||
@RequestParam(required = false) Integer totalCount,
|
||||
@RequestParam(required = false) Integer successCount,
|
||||
@RequestParam(required = false) Integer failCount) {
|
||||
boolean result = importTaskService.updateProgress(id, totalCount, successCount, failCount);
|
||||
return result ? ResponseResult.success("更新成功") : ResponseResult.error("更新失败");
|
||||
}
|
||||
|
||||
@PostMapping("/markFailed")
|
||||
@Operation(summary = "标记任务失败")
|
||||
public ResponseResult markFailed(@RequestParam String id,
|
||||
@RequestParam String errorMsg) {
|
||||
boolean result = importTaskService.markFailed(id, errorMsg);
|
||||
return result ? ResponseResult.success("标记失败") : ResponseResult.error("标记失败");
|
||||
}
|
||||
|
||||
@PostMapping("/markSuccess")
|
||||
@Operation(summary = "标记任务成功")
|
||||
public ResponseResult markSuccess(@RequestParam String id) {
|
||||
boolean result = importTaskService.markSuccess(id);
|
||||
return result ? ResponseResult.success("标记成功") : ResponseResult.error("标记失败");
|
||||
}
|
||||
|
||||
@PostMapping("/deleteExpired")
|
||||
@Operation(summary = "删除过期任务")
|
||||
public ResponseResult deleteExpired() {
|
||||
boolean result = importTaskService.deleteExpiredTasks();
|
||||
return result ? ResponseResult.success("清理完成") : ResponseResult.error("清理失败");
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增导入任务")
|
||||
public ResponseResult add(@RequestBody ImportTask importTask) {
|
||||
importTask.setCreatedAt(new Date());
|
||||
importTask.setUpdatedAt(new Date());
|
||||
boolean result = importTaskService.save(importTask);
|
||||
return result ? ResponseResult.success("新增成功") : ResponseResult.error("新增失败");
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "修改导入任务")
|
||||
public ResponseResult update(@RequestBody ImportTask importTask) {
|
||||
importTask.setUpdatedAt(new Date());
|
||||
boolean result = importTaskService.updateById(importTask);
|
||||
return result ? ResponseResult.success("修改成功") : ResponseResult.error("修改失败");
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@Operation(summary = "删除导入任务")
|
||||
public ResponseResult delete(@RequestParam Long id) {
|
||||
boolean result = importTaskService.removeById(id);
|
||||
return result ? ResponseResult.success("删除成功") : ResponseResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
@ -53,6 +53,13 @@ public class SysUserDataScopeController {
|
||||
return result ? ResponseResult.success("新增成功") : ResponseResult.error("新增失败");
|
||||
}
|
||||
|
||||
@PostMapping("/batchAdd")
|
||||
@Operation(summary = "新增数据填报权限")
|
||||
public ResponseResult batchAdd(@RequestBody List<SysUserDataScope> dataScopeList) {
|
||||
boolean result = dataScopeService.batchAddDataScope(dataScopeList);
|
||||
return result ? ResponseResult.success("新增成功") : ResponseResult.error("新增失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据填报权限
|
||||
*/
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package com.yfd.platform.data.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -65,5 +63,6 @@ public class ApprovalChangeLog implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createdAt;
|
||||
}
|
||||
@ -1,8 +1,6 @@
|
||||
package com.yfd.platform.data.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -55,5 +53,7 @@ public class ApprovalLog implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createdAt;
|
||||
}
|
||||
@ -1,8 +1,6 @@
|
||||
package com.yfd.platform.data.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ -75,10 +73,12 @@ public class ApprovalMain implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updatedAt;
|
||||
}
|
||||
@ -1,13 +1,11 @@
|
||||
package com.yfd.platform.data.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -124,6 +122,32 @@ public class FishDraftData implements Serializable {
|
||||
*/
|
||||
private Date submitTime;
|
||||
|
||||
/**
|
||||
* 水温
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private BigDecimal wt;
|
||||
|
||||
|
||||
/**
|
||||
* 电站名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String engName;
|
||||
|
||||
/**
|
||||
* 基地名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String baseName;
|
||||
|
||||
/**
|
||||
* 设施名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String fPname;
|
||||
|
||||
|
||||
/**
|
||||
* 审批完成时间
|
||||
*/
|
||||
@ -147,6 +171,7 @@ public class FishDraftData implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
@ -157,6 +182,7 @@ public class FishDraftData implements Serializable {
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updatedAt;
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,109 @@
|
||||
package com.yfd.platform.data.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 导入任务表(ZIP导入全过程管理)
|
||||
* </p>
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("IMPORT_TASK")
|
||||
public class ImportTask implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 导入任务编号(唯一)
|
||||
*/
|
||||
private String importNo;
|
||||
|
||||
/**
|
||||
* 业务类型(FISH过鱼数据)
|
||||
*/
|
||||
private String bizType;
|
||||
|
||||
/**
|
||||
* 上传压缩包文件名
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件大小(字节)
|
||||
*/
|
||||
private Long fileSize;
|
||||
|
||||
/**
|
||||
* 原始压缩包存储路径
|
||||
*/
|
||||
private String filePath;
|
||||
|
||||
/**
|
||||
* 解压后的临时目录路径
|
||||
*/
|
||||
private String tempDir;
|
||||
|
||||
/**
|
||||
* 总数据条数
|
||||
*/
|
||||
private Integer totalCount;
|
||||
|
||||
/**
|
||||
* 校验通过条数
|
||||
*/
|
||||
private Integer successCount;
|
||||
|
||||
/**
|
||||
* 校验失败条数
|
||||
*/
|
||||
private Integer failCount;
|
||||
|
||||
/**
|
||||
* 任务状态(UPLOADED已上传 / PARSING解析中 / VALIDATED已校验 / FAILED失败 / CONFIRMED已入库)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 错误信息(异常时记录)
|
||||
*/
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 上传人ID
|
||||
*/
|
||||
private Long uploadUserId;
|
||||
|
||||
/**
|
||||
* 上传时间
|
||||
*/
|
||||
private Date uploadTime;
|
||||
|
||||
/**
|
||||
* 过期时间(用于清理临时文件)
|
||||
*/
|
||||
private Date expireTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updatedAt;
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.yfd.platform.data.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.data.domain.ImportTask;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 导入任务表 Mapper 接口
|
||||
* </p>
|
||||
*/
|
||||
public interface ImportTaskMapper extends BaseMapper<ImportTask> {
|
||||
|
||||
/**
|
||||
* 根据任务编号查询
|
||||
*/
|
||||
@Select("SELECT * FROM IMPORT_TASK WHERE IMPORT_NO = #{importNo}")
|
||||
ImportTask selectByImportNo(@Param("importNo") String importNo);
|
||||
|
||||
/**
|
||||
* 根据业务类型查询
|
||||
*/
|
||||
@Select("SELECT * FROM IMPORT_TASK WHERE BIZ_TYPE = #{bizType} ORDER BY CREATED_AT DESC")
|
||||
List<ImportTask> selectByBizType(@Param("bizType") String bizType);
|
||||
|
||||
/**
|
||||
* 根据状态查询
|
||||
*/
|
||||
@Select("SELECT * FROM IMPORT_TASK WHERE STATUS = #{status} ORDER BY CREATED_AT DESC")
|
||||
List<ImportTask> selectByStatus(@Param("status") String status);
|
||||
|
||||
/**
|
||||
* 根据上传人查询
|
||||
*/
|
||||
@Select("SELECT * FROM IMPORT_TASK WHERE UPLOAD_USER_ID = #{uploadUserId} ORDER BY CREATED_AT DESC")
|
||||
List<ImportTask> selectByUploadUserId(@Param("uploadUserId") Long uploadUserId);
|
||||
|
||||
/**
|
||||
* 查询过期的任务
|
||||
*/
|
||||
@Select("SELECT * FROM IMPORT_TASK WHERE EXPIRE_TIME < SYSDATE AND EXPIRE_TIME IS NOT NULL")
|
||||
List<ImportTask> selectExpiredTasks();
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.yfd.platform.data.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.platform.data.domain.ImportTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 导入任务表 服务类
|
||||
* </p>
|
||||
*/
|
||||
public interface IImportTaskService extends IService<ImportTask> {
|
||||
|
||||
/**
|
||||
* 分页查询导入任务
|
||||
*/
|
||||
Page<ImportTask> queryPageList(Page<ImportTask> page, String bizType, String status, String uploadUserId);
|
||||
|
||||
/**
|
||||
* 根据任务编号查询
|
||||
*/
|
||||
ImportTask getByImportNo(String importNo);
|
||||
|
||||
/**
|
||||
* 根据业务类型查询
|
||||
*/
|
||||
List<ImportTask> getByBizType(String bizType);
|
||||
|
||||
/**
|
||||
* 根据状态查询
|
||||
*/
|
||||
List<ImportTask> getByStatus(String status);
|
||||
|
||||
/**
|
||||
* 创建导入任务
|
||||
*/
|
||||
boolean createTask(ImportTask importTask);
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
*/
|
||||
boolean updateStatus(String id, String status, String errorMsg);
|
||||
|
||||
/**
|
||||
* 更新解析进度
|
||||
*/
|
||||
boolean updateProgress(String id, Integer totalCount, Integer successCount, Integer failCount);
|
||||
|
||||
/**
|
||||
* 标记任务失败
|
||||
*/
|
||||
boolean markFailed(String id, String errorMsg);
|
||||
|
||||
/**
|
||||
* 标记任务成功
|
||||
*/
|
||||
boolean markSuccess(String id);
|
||||
|
||||
/**
|
||||
* 删除过期任务
|
||||
*/
|
||||
boolean deleteExpiredTasks();
|
||||
}
|
||||
@ -52,4 +52,6 @@ public interface ISysUserDataScopeService extends IService<SysUserDataScope> {
|
||||
* 查询用户有效权限(状态=1且在有效期内的)
|
||||
*/
|
||||
List<SysUserDataScope> getValidPermissions(String userId);
|
||||
|
||||
boolean batchAddDataScope(List<SysUserDataScope> dataScopeList);
|
||||
}
|
||||
|
||||
@ -0,0 +1,140 @@
|
||||
package com.yfd.platform.data.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.data.domain.ImportTask;
|
||||
import com.yfd.platform.data.mapper.ImportTaskMapper;
|
||||
import com.yfd.platform.data.service.IImportTaskService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 导入任务表 服务实现类
|
||||
* </p>
|
||||
*/
|
||||
@Service
|
||||
public class ImportTaskServiceImpl extends ServiceImpl<ImportTaskMapper, ImportTask> implements IImportTaskService {
|
||||
|
||||
@Resource
|
||||
private ImportTaskMapper importTaskMapper;
|
||||
|
||||
@Override
|
||||
public Page<ImportTask> queryPageList(Page<ImportTask> page, String bizType, String status, String uploadUserId) {
|
||||
return this.page(page, this.lambdaQuery()
|
||||
.eq(StringUtils.hasText(bizType), ImportTask::getBizType, bizType)
|
||||
.eq(StringUtils.hasText(status), ImportTask::getStatus, status)
|
||||
.eq(uploadUserId != null, ImportTask::getUploadUserId, uploadUserId)
|
||||
.orderByDesc(ImportTask::getCreatedAt)
|
||||
.getWrapper());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImportTask getByImportNo(String importNo) {
|
||||
return importTaskMapper.selectByImportNo(importNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImportTask> getByBizType(String bizType) {
|
||||
return importTaskMapper.selectByBizType(bizType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImportTask> getByStatus(String status) {
|
||||
return importTaskMapper.selectByStatus(status);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean createTask(ImportTask importTask) {
|
||||
importTask.setStatus("UPLOADED");
|
||||
importTask.setCreatedAt(new Date());
|
||||
importTask.setUpdatedAt(new Date());
|
||||
if (importTask.getTotalCount() == null) {
|
||||
importTask.setTotalCount(0);
|
||||
}
|
||||
if (importTask.getSuccessCount() == null) {
|
||||
importTask.setSuccessCount(0);
|
||||
}
|
||||
if (importTask.getFailCount() == null) {
|
||||
importTask.setFailCount(0);
|
||||
}
|
||||
return this.save(importTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateStatus(String id, String status, String errorMsg) {
|
||||
ImportTask importTask = this.getById(id);
|
||||
if (importTask == null) {
|
||||
return false;
|
||||
}
|
||||
importTask.setStatus(status);
|
||||
if (StringUtils.hasText(errorMsg)) {
|
||||
importTask.setErrorMsg(errorMsg);
|
||||
}
|
||||
importTask.setUpdatedAt(new Date());
|
||||
return this.updateById(importTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateProgress(String id, Integer totalCount, Integer successCount, Integer failCount) {
|
||||
ImportTask importTask = this.getById(id);
|
||||
if (importTask == null) {
|
||||
return false;
|
||||
}
|
||||
if (totalCount != null) {
|
||||
importTask.setTotalCount(totalCount);
|
||||
}
|
||||
if (successCount != null) {
|
||||
importTask.setSuccessCount(successCount);
|
||||
}
|
||||
if (failCount != null) {
|
||||
importTask.setFailCount(failCount);
|
||||
}
|
||||
importTask.setUpdatedAt(new Date());
|
||||
return this.updateById(importTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean markFailed(String id, String errorMsg) {
|
||||
ImportTask importTask = this.getById(id);
|
||||
if (importTask == null) {
|
||||
return false;
|
||||
}
|
||||
importTask.setStatus("FAILED");
|
||||
importTask.setErrorMsg(errorMsg);
|
||||
importTask.setUpdatedAt(new Date());
|
||||
return this.updateById(importTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean markSuccess(String id) {
|
||||
ImportTask importTask = this.getById(id);
|
||||
if (importTask == null) {
|
||||
return false;
|
||||
}
|
||||
importTask.setStatus("CONFIRMED");
|
||||
importTask.setUpdatedAt(new Date());
|
||||
return this.updateById(importTask);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteExpiredTasks() {
|
||||
List<ImportTask> expiredTasks = importTaskMapper.selectExpiredTasks();
|
||||
if (expiredTasks == null || expiredTasks.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
List<String> ids = expiredTasks.stream().map(ImportTask::getId).toList();
|
||||
return this.removeByIds(ids);
|
||||
}
|
||||
}
|
||||
@ -73,4 +73,9 @@ public class SysUserDataScopeServiceImpl extends ServiceImpl<SysUserDataScopeMap
|
||||
.orderByDesc(SysUserDataScope::getCreatedAt)
|
||||
.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean batchAddDataScope(List<SysUserDataScope> dataScopeList) {
|
||||
return this.saveOrUpdateBatch(dataScopeList);
|
||||
}
|
||||
}
|
||||
|
||||
@ -70,6 +70,7 @@ public class TreeStructureServiceImpl implements ITreeStructureService {
|
||||
rvcdNode.put("code", rvcdDic.getRvcd());
|
||||
rvcdNode.put("name", rvcdDic.getRvnm());
|
||||
rvcdNode.put("path", rvcdDic.getPath());
|
||||
rvcdNode.put("orgLevel", 0);
|
||||
rvcdNode.put("grd", rvcdDic.getGrd());
|
||||
rvcdNode.put("lgtd", rvcdDic.getLgtd());
|
||||
rvcdNode.put("lttd", rvcdDic.getLttd());
|
||||
@ -102,6 +103,7 @@ public class TreeStructureServiceImpl implements ITreeStructureService {
|
||||
baseNode.put("shortname", base.getShortname());
|
||||
baseNode.put("grd", base.getGrd());
|
||||
baseNode.put("parentId", rvcdDic.getRvcd());
|
||||
baseNode.put("orgLevel", 1);
|
||||
List<Map<String, Object>> engChildren = new ArrayList<>();
|
||||
for (SdEngInfoBH eng : baseEngList) {
|
||||
Map<String, Object> engNode = new LinkedHashMap<>();
|
||||
@ -115,6 +117,7 @@ public class TreeStructureServiceImpl implements ITreeStructureService {
|
||||
engNode.put("bldstt", eng.getBldstt());
|
||||
engNode.put("engtp", eng.getEngtp());
|
||||
engNode.put("parentId", base.getBaseid());
|
||||
engNode.put("orgLevel", 2);
|
||||
engChildren.add(engNode);
|
||||
}
|
||||
baseNode.put("children", engChildren);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user