refactor: 重命名 ruoyi-info-collection 模块为 ccdi-info-collection
- 重命名模块目录 ruoyi-info-collection -> ccdi-info-collection - 更新所有 pom.xml 中的模块引用 - 更新 IDEA 配置文件 (compiler.xml, encodings.xml) - Java 包名保持不变 (com.ruoyi.info.collection) - 编译测试通过
This commit is contained in:
@@ -0,0 +1,205 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiBaseStaffAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiBaseStaffEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiBaseStaffQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiBaseStaffExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.*;
|
||||
import com.ruoyi.info.collection.service.ICcdiBaseStaffImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiBaseStaffService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 员工信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-01-28
|
||||
*/
|
||||
@Tag(name = "员工信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/baseStaff")
|
||||
public class CcdiBaseStaffController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiBaseStaffService baseStaffService;
|
||||
|
||||
@Resource
|
||||
private ICcdiBaseStaffImportService importAsyncService;
|
||||
|
||||
/**
|
||||
* 查询员工列表
|
||||
*/
|
||||
@Operation(summary = "查询员工列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiBaseStaffQueryDTO queryDTO) {
|
||||
// 使用MyBatis Plus分页
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiBaseStaffVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
Page<CcdiBaseStaffVO> result = baseStaffService.selectBaseStaffPage(page, queryDTO);
|
||||
return getDataTable(result.getRecords(), result.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询员工下拉列表
|
||||
*/
|
||||
@Operation(summary = "查询员工下拉列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:list')")
|
||||
@GetMapping("/options")
|
||||
public AjaxResult getStaffOptions(@RequestParam(required = false) String query) {
|
||||
List<CcdiBaseStaffOptionVO> list = baseStaffService.selectStaffOptions(query);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出员工列表
|
||||
*/
|
||||
@Operation(summary = "导出员工列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:export')")
|
||||
@Log(title = "员工信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CcdiBaseStaffQueryDTO queryDTO) {
|
||||
List<CcdiBaseStaffExcel> list = baseStaffService.selectBaseStaffListForExport(queryDTO);
|
||||
EasyExcelUtil.exportExcel(response, list, CcdiBaseStaffExcel.class, "员工信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工详细信息
|
||||
*/
|
||||
@Operation(summary = "获取员工详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:query')")
|
||||
@GetMapping(value = "/{staffId}")
|
||||
public AjaxResult getInfo(@PathVariable Long staffId) {
|
||||
return success(baseStaffService.selectBaseStaffById(staffId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增员工
|
||||
*/
|
||||
@Operation(summary = "新增员工")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:add')")
|
||||
@Log(title = "员工信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody CcdiBaseStaffAddDTO addDTO) {
|
||||
return toAjax(baseStaffService.insertBaseStaff(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改员工
|
||||
*/
|
||||
@Operation(summary = "修改员工")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:edit')")
|
||||
@Log(title = "员工信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody CcdiBaseStaffEditDTO editDTO) {
|
||||
return toAjax(baseStaffService.updateBaseStaff(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除员工
|
||||
*/
|
||||
@Operation(summary = "删除员工")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:remove')")
|
||||
@Log(title = "员工信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{staffIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] staffIds) {
|
||||
return toAjax(baseStaffService.deleteBaseStaffByIds(staffIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载带字典下拉框的导入模板
|
||||
* 使用@DictDropdown注解自动添加下拉框
|
||||
*/
|
||||
@Operation(summary = "下载导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiBaseStaffExcel.class, "员工信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入员工信息(异步)
|
||||
*/
|
||||
@Operation(summary = "导入员工信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:import')")
|
||||
@Log(title = "员工信息", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
|
||||
List<CcdiBaseStaffExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiBaseStaffExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = baseStaffService.importBaseStaff(list, updateSupport);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入状态
|
||||
*/
|
||||
@Operation(summary = "查询员工导入状态")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:import')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable String taskId) {
|
||||
try {
|
||||
ImportStatusVO status = importAsyncService.getImportStatus(taskId);
|
||||
return success(status);
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询导入失败记录")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:baseStaff:import')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<ImportFailureVO> failures = importAsyncService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<ImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiCustEnterpriseRelationAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiCustEnterpriseRelationEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiCustEnterpriseRelationQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiCustEnterpriseRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiCustEnterpriseRelationVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CustEnterpriseRelationImportFailureVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResultVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.service.ICcdiCustEnterpriseRelationImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiCustEnterpriseRelationService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 信贷客户实体关联信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-12
|
||||
*/
|
||||
@Tag(name = "信贷客户实体关联信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/custEnterpriseRelation")
|
||||
public class CcdiCustEnterpriseRelationController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiCustEnterpriseRelationService relationService;
|
||||
|
||||
@Resource
|
||||
private ICcdiCustEnterpriseRelationImportService relationImportService;
|
||||
|
||||
/**
|
||||
* 查询信贷客户实体关联列表
|
||||
*/
|
||||
@Operation(summary = "查询信贷客户实体关联列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custEnterpriseRelation:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiCustEnterpriseRelationQueryDTO queryDTO) {
|
||||
// 使用MyBatis Plus分页
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiCustEnterpriseRelationVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
Page<CcdiCustEnterpriseRelationVO> result = relationService.selectRelationPage(page, queryDTO);
|
||||
return getDataTable(result.getRecords(), result.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出信贷客户实体关联列表
|
||||
*/
|
||||
@Operation(summary = "导出信贷客户实体关联列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custEnterpriseRelation:export')")
|
||||
@Log(title = "信贷客户实体关联信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CcdiCustEnterpriseRelationQueryDTO queryDTO) {
|
||||
List<CcdiCustEnterpriseRelationExcel> list = relationService.selectRelationListForExport(queryDTO);
|
||||
EasyExcelUtil.exportExcel(response, list, CcdiCustEnterpriseRelationExcel.class, "信贷客户实体关联信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信贷客户实体关联详细信息
|
||||
*/
|
||||
@Operation(summary = "获取信贷客户实体关联详细信息")
|
||||
@Parameter(name = "id", description = "主键ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custEnterpriseRelation:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id) {
|
||||
return success(relationService.selectRelationById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增信贷客户实体关联
|
||||
*/
|
||||
@Operation(summary = "新增信贷客户实体关联")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custEnterpriseRelation:add')")
|
||||
@Log(title = "信贷客户实体关联信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody CcdiCustEnterpriseRelationAddDTO addDTO) {
|
||||
return toAjax(relationService.insertRelation(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改信贷客户实体关联
|
||||
*/
|
||||
@Operation(summary = "修改信贷客户实体关联")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custEnterpriseRelation:edit')")
|
||||
@Log(title = "信贷客户实体关联信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody CcdiCustEnterpriseRelationEditDTO editDTO) {
|
||||
return toAjax(relationService.updateRelation(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信贷客户实体关联
|
||||
*/
|
||||
@Operation(summary = "删除信贷客户实体关联")
|
||||
@Parameter(name = "ids", description = "主键ID数组", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custEnterpriseRelation:remove')")
|
||||
@Log(title = "信贷客户实体关联信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(relationService.deleteRelationByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载导入模板
|
||||
*/
|
||||
@Operation(summary = "下载导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiCustEnterpriseRelationExcel.class, "信贷客户实体关联信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步导入信贷客户实体关联
|
||||
*/
|
||||
@Operation(summary = "异步导入信贷客户实体关联")
|
||||
@Parameter(name = "file", description = "导入文件", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custEnterpriseRelation:import')")
|
||||
@Log(title = "信贷客户实体关联信息", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(@Parameter(description = "导入文件") MultipartFile file) throws Exception {
|
||||
List<CcdiCustEnterpriseRelationExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiCustEnterpriseRelationExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = relationService.importRelation(list);
|
||||
|
||||
// 立即返回
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入状态
|
||||
*/
|
||||
@Operation(summary = "查询导入状态")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custEnterpriseRelation:import')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable String taskId) {
|
||||
ImportStatusVO statusVO = relationImportService.getImportStatus(taskId);
|
||||
return success(statusVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询导入失败记录")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@Parameter(name = "pageNum", description = "页码", required = false)
|
||||
@Parameter(name = "pageSize", description = "每页条数", required = false)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custEnterpriseRelation:import')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<CustEnterpriseRelationImportFailureVO> failures = relationImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<CustEnterpriseRelationImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiCustFmyRelationAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiCustFmyRelationEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiCustFmyRelationQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiCustFmyRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiCustFmyRelationVO;
|
||||
import com.ruoyi.info.collection.domain.vo.CustFmyRelationImportFailureVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResultVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.service.ICcdiCustFmyRelationImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiCustFmyRelationService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 信贷客户家庭关系Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-11
|
||||
*/
|
||||
@Tag(name = "信贷客户家庭关系管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/custFmyRelation")
|
||||
public class CcdiCustFmyRelationController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiCustFmyRelationService relationService;
|
||||
|
||||
@Resource
|
||||
private ICcdiCustFmyRelationImportService relationImportService;
|
||||
|
||||
/**
|
||||
* 查询信贷客户家庭关系列表
|
||||
*/
|
||||
@Operation(summary = "查询信贷客户家庭关系列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custFmyRelation:query')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiCustFmyRelationQueryDTO query) {
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiCustFmyRelationVO> page = relationService.selectRelationPage(
|
||||
query, pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
return getDataTable(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询信贷客户家庭关系详情
|
||||
*/
|
||||
@Operation(summary = "查询信贷客户家庭关系详情")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custFmyRelation:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
CcdiCustFmyRelationVO relation = relationService.selectRelationById(id);
|
||||
return success(relation);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增信贷客户家庭关系
|
||||
*/
|
||||
@Operation(summary = "新增信贷客户家庭关系")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custFmyRelation:add')")
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody CcdiCustFmyRelationAddDTO addDTO) {
|
||||
return toAjax(relationService.insertRelation(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改信贷客户家庭关系
|
||||
*/
|
||||
@Operation(summary = "修改信贷客户家庭关系")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custFmyRelation:edit')")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody CcdiCustFmyRelationEditDTO editDTO) {
|
||||
return toAjax(relationService.updateRelation(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除信贷客户家庭关系
|
||||
*/
|
||||
@Operation(summary = "删除信贷客户家庭关系")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custFmyRelation:remove')")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(relationService.deleteRelationByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出信贷客户家庭关系
|
||||
*/
|
||||
@Operation(summary = "导出信贷客户家庭关系")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custFmyRelation:export')")
|
||||
@Log(title = "信贷客户家庭关系", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CcdiCustFmyRelationQueryDTO query) {
|
||||
relationService.exportRelations(query, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载带字典下拉框的导入模板
|
||||
* 使用@DictDropdown注解自动添加下拉框
|
||||
*/
|
||||
@Operation(summary = "下载导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiCustFmyRelationExcel.class, "信贷客户家庭关系");
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步导入信贷客户家庭关系
|
||||
*/
|
||||
@Operation(summary = "异步导入信贷客户家庭关系")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custFmyRelation:import')")
|
||||
@Log(title = "信贷客户家庭关系", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
List<CcdiCustFmyRelationExcel> excels = EasyExcelUtil.importExcel(
|
||||
file.getInputStream(),
|
||||
CcdiCustFmyRelationExcel.class
|
||||
);
|
||||
|
||||
if (excels == null || excels.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = relationService.importRelations(excels);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入状态
|
||||
*/
|
||||
@Operation(summary = "查询导入状态")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custFmyRelation:query')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable("taskId") String taskId) {
|
||||
ImportStatusVO statusVO = relationImportService.getImportStatus(taskId);
|
||||
return success(statusVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询导入失败记录")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:custFmyRelation:query')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(
|
||||
@PathVariable("taskId") String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<CustFmyRelationImportFailureVO> failures = relationImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<CustFmyRelationImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.ruoyi.info.collection.domain.vo.EnumOptionVO;
|
||||
import com.ruoyi.info.collection.enums.*;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* DPC枚举接口Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Tag(name = "枚举接口", description = "中介黑名单相关枚举选项接口")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/enum")
|
||||
public class CcdiEnumController {
|
||||
|
||||
/**
|
||||
* 获取人员类型选项
|
||||
*/
|
||||
@Operation(summary = "获取人员类型选项")
|
||||
@GetMapping("/indivType")
|
||||
public AjaxResult getIndivTypeOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (IndivType type : IndivType.values()) {
|
||||
options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取性别选项
|
||||
*/
|
||||
@Operation(summary = "获取性别选项")
|
||||
@GetMapping("/gender")
|
||||
public AjaxResult getGenderOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (Gender gender : Gender.values()) {
|
||||
options.add(new EnumOptionVO(gender.getCode(), gender.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取证件类型选项
|
||||
*/
|
||||
@Operation(summary = "获取证件类型选项")
|
||||
@GetMapping("/certType")
|
||||
public AjaxResult getCertTypeOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (CertType type : CertType.values()) {
|
||||
options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关联关系选项
|
||||
*/
|
||||
@Operation(summary = "获取关联关系选项")
|
||||
@GetMapping("/relationType")
|
||||
public AjaxResult getRelationTypeOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (RelationType type : RelationType.values()) {
|
||||
options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主体类型选项
|
||||
*/
|
||||
@Operation(summary = "获取主体类型选项")
|
||||
@GetMapping("/corpType")
|
||||
public AjaxResult getCorpTypeOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (CorpType type : CorpType.values()) {
|
||||
options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取企业性质选项
|
||||
*/
|
||||
@Operation(summary = "获取企业性质选项")
|
||||
@GetMapping("/corpNature")
|
||||
public AjaxResult getCorpNatureOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (CorpNature nature : CorpNature.values()) {
|
||||
options.add(new EnumOptionVO(nature.getCode(), nature.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取中介类型选项
|
||||
*/
|
||||
@Operation(summary = "获取中介类型选项")
|
||||
@GetMapping("/intermediaryType")
|
||||
public AjaxResult getIntermediaryTypeOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (IntermediaryType type : IntermediaryType.values()) {
|
||||
options.add(new EnumOptionVO(type.getCode(), type.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取中介状态选项
|
||||
*/
|
||||
@Operation(summary = "获取中介状态选项")
|
||||
@GetMapping("/intermediaryStatus")
|
||||
public AjaxResult getIntermediaryStatusOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (IntermediaryStatus status : IntermediaryStatus.values()) {
|
||||
options.add(new EnumOptionVO(status.getCode(), status.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据来源选项
|
||||
*/
|
||||
@Operation(summary = "获取数据来源选项")
|
||||
@GetMapping("/dataSource")
|
||||
public AjaxResult getDataSourceOptions() {
|
||||
List<EnumOptionVO> options = new ArrayList<>();
|
||||
for (DataSource source : DataSource.values()) {
|
||||
options.add(new EnumOptionVO(source.getCode(), source.getDesc()));
|
||||
}
|
||||
return AjaxResult.success(options);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,318 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.*;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryEntityExcel;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiIntermediaryPersonExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.*;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryEntityImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryPersonImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiIntermediaryService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 中介信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-04
|
||||
*/
|
||||
@Tag(name = "中介信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/intermediary")
|
||||
public class CcdiIntermediaryController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiIntermediaryService intermediaryService;
|
||||
|
||||
@Resource
|
||||
private ICcdiIntermediaryPersonImportService personImportService;
|
||||
|
||||
@Resource
|
||||
private ICcdiIntermediaryEntityImportService entityImportService;
|
||||
|
||||
/**
|
||||
* 查询中介列表
|
||||
*/
|
||||
@Operation(summary = "查询中介列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiIntermediaryQueryDTO queryDTO) {
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiIntermediaryVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
Page<CcdiIntermediaryVO> result = intermediaryService.selectIntermediaryPage(page, queryDTO);
|
||||
return getDataTable(result.getRecords(), result.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询个人中介详情
|
||||
*/
|
||||
@Operation(summary = "查询个人中介详情")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:query')")
|
||||
@GetMapping("/person/{bizId}")
|
||||
public AjaxResult getPersonInfo(@PathVariable String bizId) {
|
||||
CcdiIntermediaryPersonDetailVO vo = intermediaryService.selectIntermediaryPersonDetail(bizId);
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实体中介详情
|
||||
*/
|
||||
@Operation(summary = "查询实体中介详情")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:query')")
|
||||
@GetMapping("/entity/{socialCreditCode}")
|
||||
public AjaxResult getEntityInfo(@PathVariable String socialCreditCode) {
|
||||
CcdiIntermediaryEntityDetailVO vo = intermediaryService.selectIntermediaryEntityDetail(socialCreditCode);
|
||||
return success(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增个人中介
|
||||
*/
|
||||
@Operation(summary = "新增个人中介")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:add')")
|
||||
@Log(title = "个人中介", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/person")
|
||||
public AjaxResult addPerson(@Validated @RequestBody CcdiIntermediaryPersonAddDTO addDTO) {
|
||||
return toAjax(intermediaryService.insertIntermediaryPerson(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改个人中介
|
||||
*/
|
||||
@Operation(summary = "修改个人中介")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:edit')")
|
||||
@Log(title = "个人中介", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/person")
|
||||
public AjaxResult editPerson(@Validated @RequestBody CcdiIntermediaryPersonEditDTO editDTO) {
|
||||
return toAjax(intermediaryService.updateIntermediaryPerson(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增实体中介
|
||||
*/
|
||||
@Operation(summary = "新增实体中介")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:add')")
|
||||
@Log(title = "实体中介", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/entity")
|
||||
public AjaxResult addEntity(@Validated @RequestBody CcdiIntermediaryEntityAddDTO addDTO) {
|
||||
return toAjax(intermediaryService.insertIntermediaryEntity(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改实体中介
|
||||
*/
|
||||
@Operation(summary = "修改实体中介")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:edit')")
|
||||
@Log(title = "实体中介", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/entity")
|
||||
public AjaxResult editEntity(@Validated @RequestBody CcdiIntermediaryEntityEditDTO editDTO) {
|
||||
return toAjax(intermediaryService.updateIntermediaryEntity(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除中介
|
||||
*/
|
||||
@Operation(summary = "删除中介")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:remove')")
|
||||
@Log(title = "中介信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
return toAjax(intermediaryService.deleteIntermediaryByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验人员ID唯一性
|
||||
*/
|
||||
@Operation(summary = "校验人员ID唯一性")
|
||||
@GetMapping("/checkPersonIdUnique")
|
||||
public AjaxResult checkPersonIdUnique(@RequestParam String personId, @RequestParam(required = false) String bizId) {
|
||||
boolean unique = intermediaryService.checkPersonIdUnique(personId, bizId);
|
||||
return success(unique);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验统一社会信用代码唯一性
|
||||
*/
|
||||
@Operation(summary = "校验统一社会信用代码唯一性")
|
||||
@GetMapping("/checkSocialCreditCodeUnique")
|
||||
public AjaxResult checkSocialCreditCodeUnique(@RequestParam String socialCreditCode, @RequestParam(required = false) String excludeId) {
|
||||
boolean unique = intermediaryService.checkSocialCreditCodeUnique(socialCreditCode, excludeId);
|
||||
return success(unique);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载个人中介导入模板
|
||||
*/
|
||||
@Operation(summary = "下载个人中介导入模板")
|
||||
@PostMapping("/importPersonTemplate")
|
||||
public void importPersonTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiIntermediaryPersonExcel.class, "个人中介信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载实体中介导入模板
|
||||
*/
|
||||
@Operation(summary = "下载实体中介导入模板")
|
||||
@PostMapping("/importEntityTemplate")
|
||||
public void importEntityTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiIntermediaryEntityExcel.class, "实体中介信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入个人中介数据(异步)
|
||||
*/
|
||||
@Operation(summary = "导入个人中介数据")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:import')")
|
||||
@Log(title = "个人中介", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importPersonData")
|
||||
public AjaxResult importPersonData(MultipartFile file) throws Exception {
|
||||
List<CcdiIntermediaryPersonExcel> list = EasyExcelUtil.importExcel(
|
||||
file.getInputStream(), CcdiIntermediaryPersonExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = intermediaryService.importIntermediaryPerson(list);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入实体中介数据(异步)
|
||||
*/
|
||||
@Operation(summary = "导入实体中介数据")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:import')")
|
||||
@Log(title = "实体中介", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importEntityData")
|
||||
public AjaxResult importEntityData(MultipartFile file) throws Exception {
|
||||
List<CcdiIntermediaryEntityExcel> list = EasyExcelUtil.importExcel(
|
||||
file.getInputStream(), CcdiIntermediaryEntityExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = intermediaryService.importIntermediaryEntity(list);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询个人中介导入状态
|
||||
*/
|
||||
@Operation(summary = "查询个人中介导入状态")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:import')")
|
||||
@GetMapping("/importPersonStatus/{taskId}")
|
||||
public AjaxResult getPersonImportStatus(@PathVariable String taskId) {
|
||||
try {
|
||||
ImportStatusVO status = personImportService.getImportStatus(taskId);
|
||||
return success(status);
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询个人中介导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询个人中介导入失败记录")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:import')")
|
||||
@GetMapping("/importPersonFailures/{taskId}")
|
||||
public TableDataInfo getPersonImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<IntermediaryPersonImportFailureVO> failures =
|
||||
personImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<IntermediaryPersonImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实体中介导入状态
|
||||
*/
|
||||
@Operation(summary = "查询实体中介导入状态")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:import')")
|
||||
@GetMapping("/importEntityStatus/{taskId}")
|
||||
public AjaxResult getEntityImportStatus(@PathVariable String taskId) {
|
||||
try {
|
||||
ImportStatusVO status = entityImportService.getImportStatus(taskId);
|
||||
return success(status);
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实体中介导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询实体中介导入失败记录")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:intermediary:import')")
|
||||
@GetMapping("/importEntityFailures/{taskId}")
|
||||
public TableDataInfo getEntityImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<IntermediaryEntityImportFailureVO> failures =
|
||||
entityImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<IntermediaryEntityImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiPurchaseTransactionAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiPurchaseTransactionEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiPurchaseTransactionQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiPurchaseTransactionExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiPurchaseTransactionVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResultVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.domain.vo.PurchaseTransactionImportFailureVO;
|
||||
import com.ruoyi.info.collection.service.ICcdiPurchaseTransactionImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiPurchaseTransactionService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 采购交易信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-06
|
||||
*/
|
||||
@Tag(name = "采购交易信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/purchaseTransaction")
|
||||
public class CcdiPurchaseTransactionController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiPurchaseTransactionService transactionService;
|
||||
|
||||
@Resource
|
||||
private ICcdiPurchaseTransactionImportService transactionImportService;
|
||||
|
||||
/**
|
||||
* 查询采购交易列表
|
||||
*/
|
||||
@Operation(summary = "查询采购交易列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:purchaseTransaction:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiPurchaseTransactionQueryDTO queryDTO) {
|
||||
// 使用MyBatis Plus分页
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiPurchaseTransactionVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
Page<CcdiPurchaseTransactionVO> result = transactionService.selectTransactionPage(page, queryDTO);
|
||||
return getDataTable(result.getRecords(), result.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出采购交易列表
|
||||
*/
|
||||
@Operation(summary = "导出采购交易列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:purchaseTransaction:export')")
|
||||
@Log(title = "采购交易信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CcdiPurchaseTransactionQueryDTO queryDTO) {
|
||||
List<CcdiPurchaseTransactionExcel> list = transactionService.selectTransactionListForExport(queryDTO);
|
||||
EasyExcelUtil.exportExcel(response, list, CcdiPurchaseTransactionExcel.class, "采购交易信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取采购交易详细信息
|
||||
*/
|
||||
@Operation(summary = "获取采购交易详细信息")
|
||||
@Parameter(name = "purchaseId", description = "采购事项ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:purchaseTransaction:query')")
|
||||
@GetMapping(value = "/{purchaseId}")
|
||||
public AjaxResult getInfo(@PathVariable String purchaseId) {
|
||||
return success(transactionService.selectTransactionById(purchaseId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增采购交易
|
||||
*/
|
||||
@Operation(summary = "新增采购交易")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:purchaseTransaction:add')")
|
||||
@Log(title = "采购交易信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody CcdiPurchaseTransactionAddDTO addDTO) {
|
||||
return toAjax(transactionService.insertTransaction(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改采购交易
|
||||
*/
|
||||
@Operation(summary = "修改采购交易")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:purchaseTransaction:edit')")
|
||||
@Log(title = "采购交易信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody CcdiPurchaseTransactionEditDTO editDTO) {
|
||||
return toAjax(transactionService.updateTransaction(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除采购交易
|
||||
*/
|
||||
@Operation(summary = "删除采购交易")
|
||||
@Parameter(name = "purchaseIds", description = "采购事项ID数组", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:purchaseTransaction:remove')")
|
||||
@Log(title = "采购交易信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{purchaseIds}")
|
||||
public AjaxResult remove(@PathVariable String[] purchaseIds) {
|
||||
return toAjax(transactionService.deleteTransactionByIds(purchaseIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载带字典下拉框的导入模板
|
||||
* 使用@DictDropdown注解自动添加下拉框
|
||||
*/
|
||||
@Operation(summary = "下载导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiPurchaseTransactionExcel.class, "采购交易信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步导入采购交易
|
||||
*/
|
||||
@Operation(summary = "异步导入采购交易")
|
||||
@Parameter(name = "file", description = "导入文件", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:purchaseTransaction:import')")
|
||||
@Log(title = "采购交易信息", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(@Parameter(description = "导入文件") MultipartFile file) throws Exception {
|
||||
List<CcdiPurchaseTransactionExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiPurchaseTransactionExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = transactionService.importTransaction(list);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入状态
|
||||
*/
|
||||
@Operation(summary = "查询导入状态")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:purchaseTransaction:import')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable String taskId) {
|
||||
ImportStatusVO statusVO = transactionImportService.getImportStatus(taskId);
|
||||
return success(statusVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询导入失败记录")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@Parameter(name = "pageNum", description = "页码", required = false)
|
||||
@Parameter(name = "pageSize", description = "每页条数", required = false)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:purchaseTransaction:import')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<PurchaseTransactionImportFailureVO> failures = transactionImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<PurchaseTransactionImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffEnterpriseRelationAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffEnterpriseRelationEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffEnterpriseRelationQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiStaffEnterpriseRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiStaffEnterpriseRelationVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResultVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.domain.vo.StaffEnterpriseRelationImportFailureVO;
|
||||
import com.ruoyi.info.collection.service.ICcdiStaffEnterpriseRelationImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiStaffEnterpriseRelationService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 员工实体关系信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-09
|
||||
*/
|
||||
@Tag(name = "员工实体关系信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/staffEnterpriseRelation")
|
||||
public class CcdiStaffEnterpriseRelationController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiStaffEnterpriseRelationService relationService;
|
||||
|
||||
@Resource
|
||||
private ICcdiStaffEnterpriseRelationImportService relationImportService;
|
||||
|
||||
/**
|
||||
* 查询员工实体关系列表
|
||||
*/
|
||||
@Operation(summary = "查询员工实体关系列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffEnterpriseRelation:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiStaffEnterpriseRelationQueryDTO queryDTO) {
|
||||
// 使用MyBatis Plus分页
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiStaffEnterpriseRelationVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
Page<CcdiStaffEnterpriseRelationVO> result = relationService.selectRelationPage(page, queryDTO);
|
||||
return getDataTable(result.getRecords(), result.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出员工实体关系列表
|
||||
*/
|
||||
@Operation(summary = "导出员工实体关系列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffEnterpriseRelation:export')")
|
||||
@Log(title = "员工实体关系信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CcdiStaffEnterpriseRelationQueryDTO queryDTO) {
|
||||
List<CcdiStaffEnterpriseRelationExcel> list = relationService.selectRelationListForExport(queryDTO);
|
||||
EasyExcelUtil.exportExcel(response, list, CcdiStaffEnterpriseRelationExcel.class, "员工实体关系信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工实体关系详细信息
|
||||
*/
|
||||
@Operation(summary = "获取员工实体关系详细信息")
|
||||
@Parameter(name = "id", description = "主键ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffEnterpriseRelation:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id) {
|
||||
return success(relationService.selectRelationById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增员工实体关系
|
||||
*/
|
||||
@Operation(summary = "新增员工实体关系")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffEnterpriseRelation:add')")
|
||||
@Log(title = "员工实体关系信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody CcdiStaffEnterpriseRelationAddDTO addDTO) {
|
||||
return toAjax(relationService.insertRelation(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改员工实体关系
|
||||
*/
|
||||
@Operation(summary = "修改员工实体关系")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffEnterpriseRelation:edit')")
|
||||
@Log(title = "员工实体关系信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody CcdiStaffEnterpriseRelationEditDTO editDTO) {
|
||||
return toAjax(relationService.updateRelation(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除员工实体关系
|
||||
*/
|
||||
@Operation(summary = "删除员工实体关系")
|
||||
@Parameter(name = "ids", description = "主键ID数组", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffEnterpriseRelation:remove')")
|
||||
@Log(title = "员工实体关系信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(relationService.deleteRelationByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载带字典下拉框的导入模板
|
||||
* 使用@DictDropdown注解自动添加下拉框
|
||||
*/
|
||||
@Operation(summary = "下载导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiStaffEnterpriseRelationExcel.class, "员工实体关系信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步导入员工实体关系
|
||||
*/
|
||||
@Operation(summary = "异步导入员工实体关系")
|
||||
@Parameter(name = "file", description = "导入文件", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffEnterpriseRelation:import')")
|
||||
@Log(title = "员工实体关系信息", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(@Parameter(description = "导入文件") MultipartFile file) throws Exception {
|
||||
List<CcdiStaffEnterpriseRelationExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiStaffEnterpriseRelationExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = relationService.importRelation(list);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入状态
|
||||
*/
|
||||
@Operation(summary = "查询导入状态")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffEnterpriseRelation:import')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable String taskId) {
|
||||
ImportStatusVO statusVO = relationImportService.getImportStatus(taskId);
|
||||
return success(statusVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询导入失败记录")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@Parameter(name = "pageNum", description = "页码", required = false)
|
||||
@Parameter(name = "pageSize", description = "每页条数", required = false)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffEnterpriseRelation:import')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<StaffEnterpriseRelationImportFailureVO> failures = relationImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<StaffEnterpriseRelationImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffFmyRelationAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffFmyRelationEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffFmyRelationQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiStaffFmyRelationExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiStaffFmyRelationVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResultVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.domain.vo.StaffFmyRelationImportFailureVO;
|
||||
import com.ruoyi.info.collection.service.ICcdiStaffFmyRelationImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiStaffFmyRelationService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 员工亲属关系Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-09
|
||||
*/
|
||||
@Tag(name = "员工亲属关系管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/staffFmyRelation")
|
||||
public class CcdiStaffFmyRelationController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiStaffFmyRelationService relationService;
|
||||
|
||||
@Resource
|
||||
private ICcdiStaffFmyRelationImportService relationImportService;
|
||||
|
||||
/**
|
||||
* 查询员工亲属关系列表
|
||||
*/
|
||||
@Operation(summary = "查询员工亲属关系列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiStaffFmyRelationQueryDTO queryDTO) {
|
||||
// 使用MyBatis Plus分页
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiStaffFmyRelationVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
Page<CcdiStaffFmyRelationVO> result = relationService.selectRelationPage(page, queryDTO);
|
||||
return getDataTable(result.getRecords(), result.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出员工亲属关系列表
|
||||
*/
|
||||
@Operation(summary = "导出员工亲属关系列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:export')")
|
||||
@Log(title = "员工亲属关系", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CcdiStaffFmyRelationQueryDTO queryDTO) {
|
||||
List<CcdiStaffFmyRelationExcel> list = relationService.selectRelationListForExport(queryDTO);
|
||||
EasyExcelUtil.exportExcel(response, list, CcdiStaffFmyRelationExcel.class, "员工亲属关系信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工亲属关系详细信息
|
||||
*/
|
||||
@Operation(summary = "获取员工亲属关系详细信息")
|
||||
@Parameter(name = "id", description = "主键ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id) {
|
||||
return success(relationService.selectRelationById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增员工亲属关系
|
||||
*/
|
||||
@Operation(summary = "新增员工亲属关系")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:add')")
|
||||
@Log(title = "员工亲属关系", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody CcdiStaffFmyRelationAddDTO addDTO) {
|
||||
return toAjax(relationService.insertRelation(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改员工亲属关系
|
||||
*/
|
||||
@Operation(summary = "修改员工亲属关系")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:edit')")
|
||||
@Log(title = "员工亲属关系", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody CcdiStaffFmyRelationEditDTO editDTO) {
|
||||
return toAjax(relationService.updateRelation(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除员工亲属关系
|
||||
*/
|
||||
@Operation(summary = "删除员工亲属关系")
|
||||
@Parameter(name = "ids", description = "主键ID数组", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:remove')")
|
||||
@Log(title = "员工亲属关系", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(relationService.deleteRelationByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载带字典下拉框的导入模板
|
||||
* 使用@DictDropdown注解自动添加下拉框
|
||||
*/
|
||||
@Operation(summary = "下载导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiStaffFmyRelationExcel.class, "员工亲属关系信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步导入员工亲属关系
|
||||
*/
|
||||
@Operation(summary = "异步导入员工亲属关系")
|
||||
@Parameter(name = "file", description = "导入文件", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:import')")
|
||||
@Log(title = "员工亲属关系", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(@Parameter(description = "导入文件") MultipartFile file) throws Exception {
|
||||
List<CcdiStaffFmyRelationExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiStaffFmyRelationExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = relationService.importRelation(list);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入状态
|
||||
*/
|
||||
@Operation(summary = "查询导入状态")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:import')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable String taskId) {
|
||||
ImportStatusVO statusVO = relationImportService.getImportStatus(taskId);
|
||||
return success(statusVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询导入失败记录")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@Parameter(name = "pageNum", description = "页码", required = false)
|
||||
@Parameter(name = "pageSize", description = "每页条数", required = false)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:import')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<StaffFmyRelationImportFailureVO> failures = relationImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<StaffFmyRelationImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffRecruitmentAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffRecruitmentEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffRecruitmentQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiStaffRecruitmentExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiStaffRecruitmentVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResultVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.domain.vo.RecruitmentImportFailureVO;
|
||||
import com.ruoyi.info.collection.service.ICcdiStaffRecruitmentImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiStaffRecruitmentService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 员工招聘信息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-05
|
||||
*/
|
||||
@Tag(name = "员工招聘信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/staffRecruitment")
|
||||
public class CcdiStaffRecruitmentController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiStaffRecruitmentService recruitmentService;
|
||||
|
||||
@Resource
|
||||
private ICcdiStaffRecruitmentImportService recruitmentImportService;
|
||||
|
||||
/**
|
||||
* 查询招聘信息列表
|
||||
*/
|
||||
@Operation(summary = "查询招聘信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffRecruitment:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiStaffRecruitmentQueryDTO queryDTO) {
|
||||
// 使用MyBatis Plus分页
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiStaffRecruitmentVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
Page<CcdiStaffRecruitmentVO> result = recruitmentService.selectRecruitmentPage(page, queryDTO);
|
||||
return getDataTable(result.getRecords(), result.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出招聘信息列表
|
||||
*/
|
||||
@Operation(summary = "导出招聘信息列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffRecruitment:export')")
|
||||
@Log(title = "员工招聘信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CcdiStaffRecruitmentQueryDTO queryDTO) {
|
||||
List<CcdiStaffRecruitmentExcel> list = recruitmentService.selectRecruitmentListForExport(queryDTO);
|
||||
EasyExcelUtil.exportExcel(response, list, CcdiStaffRecruitmentExcel.class, "员工招聘信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取招聘信息详细信息
|
||||
*/
|
||||
@Operation(summary = "获取招聘信息详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffRecruitment:query')")
|
||||
@GetMapping(value = "/{recruitId}")
|
||||
public AjaxResult getInfo(@PathVariable String recruitId) {
|
||||
return success(recruitmentService.selectRecruitmentById(recruitId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增招聘信息
|
||||
*/
|
||||
@Operation(summary = "新增招聘信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffRecruitment:add')")
|
||||
@Log(title = "员工招聘信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody CcdiStaffRecruitmentAddDTO addDTO) {
|
||||
return toAjax(recruitmentService.insertRecruitment(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改招聘信息
|
||||
*/
|
||||
@Operation(summary = "修改招聘信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffRecruitment:edit')")
|
||||
@Log(title = "员工招聘信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody CcdiStaffRecruitmentEditDTO editDTO) {
|
||||
return toAjax(recruitmentService.updateRecruitment(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除招聘信息
|
||||
*/
|
||||
@Operation(summary = "删除招聘信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffRecruitment:remove')")
|
||||
@Log(title = "员工招聘信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{recruitIds}")
|
||||
public AjaxResult remove(@PathVariable String[] recruitIds) {
|
||||
return toAjax(recruitmentService.deleteRecruitmentByIds(recruitIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载带字典下拉框的导入模板
|
||||
* 使用@DictDropdown注解自动添加下拉框
|
||||
*/
|
||||
@Operation(summary = "下载导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiStaffRecruitmentExcel.class, "员工招聘信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步导入招聘信息
|
||||
*/
|
||||
@Operation(summary = "异步导入招聘信息")
|
||||
@Parameter(name = "file", description = "导入文件", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffRecruitment:import')")
|
||||
@Log(title = "员工招聘信息", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(@Parameter(description = "导入文件") MultipartFile file) throws Exception {
|
||||
List<CcdiStaffRecruitmentExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiStaffRecruitmentExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = recruitmentService.importRecruitment(list);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入状态
|
||||
*/
|
||||
@Operation(summary = "查询导入状态")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffRecruitment:import')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable String taskId) {
|
||||
ImportStatusVO statusVO = recruitmentImportService.getImportStatus(taskId);
|
||||
return success(statusVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询导入失败记录")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@Parameter(name = "pageNum", description = "页码", required = false)
|
||||
@Parameter(name = "pageSize", description = "每页条数", required = false)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffRecruitment:import')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<RecruitmentImportFailureVO> failures = recruitmentImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<RecruitmentImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
package com.ruoyi.info.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffTransferAddDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffTransferEditDTO;
|
||||
import com.ruoyi.info.collection.domain.dto.CcdiStaffTransferQueryDTO;
|
||||
import com.ruoyi.info.collection.domain.excel.CcdiStaffTransferExcel;
|
||||
import com.ruoyi.info.collection.domain.vo.CcdiStaffTransferVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportResultVO;
|
||||
import com.ruoyi.info.collection.domain.vo.ImportStatusVO;
|
||||
import com.ruoyi.info.collection.domain.vo.StaffTransferImportFailureVO;
|
||||
import com.ruoyi.info.collection.service.ICcdiStaffTransferImportService;
|
||||
import com.ruoyi.info.collection.service.ICcdiStaffTransferService;
|
||||
import com.ruoyi.info.collection.utils.EasyExcelUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 员工调动记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-10
|
||||
*/
|
||||
@Tag(name = "员工调动记录管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/staffTransfer")
|
||||
public class CcdiStaffTransferController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private ICcdiStaffTransferService transferService;
|
||||
|
||||
@Resource
|
||||
private ICcdiStaffTransferImportService transferImportService;
|
||||
|
||||
/**
|
||||
* 查询员工调动记录列表
|
||||
*/
|
||||
@Operation(summary = "查询员工调动记录列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffTransfer:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CcdiStaffTransferQueryDTO queryDTO) {
|
||||
// 使用MyBatis Plus分页
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Page<CcdiStaffTransferVO> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
Page<CcdiStaffTransferVO> result = transferService.selectTransferPage(page, queryDTO);
|
||||
return getDataTable(result.getRecords(), result.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出员工调动记录列表
|
||||
*/
|
||||
@Operation(summary = "导出员工调动记录列表")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffTransfer:export')")
|
||||
@Log(title = "员工调动记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CcdiStaffTransferQueryDTO queryDTO) {
|
||||
List<CcdiStaffTransferExcel> list = transferService.selectTransferListForExport(queryDTO);
|
||||
EasyExcelUtil.exportExcel(response, list, CcdiStaffTransferExcel.class, "员工调动记录信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工调动记录详细信息
|
||||
*/
|
||||
@Operation(summary = "获取员工调动记录详细信息")
|
||||
@Parameter(name = "id", description = "主键ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffTransfer:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id) {
|
||||
return success(transferService.selectTransferById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增员工调动记录
|
||||
*/
|
||||
@Operation(summary = "新增员工调动记录")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffTransfer:add')")
|
||||
@Log(title = "员工调动记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody CcdiStaffTransferAddDTO addDTO) {
|
||||
return toAjax(transferService.insertTransfer(addDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改员工调动记录
|
||||
*/
|
||||
@Operation(summary = "修改员工调动记录")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffTransfer:edit')")
|
||||
@Log(title = "员工调动记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody CcdiStaffTransferEditDTO editDTO) {
|
||||
return toAjax(transferService.updateTransfer(editDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除员工调动记录
|
||||
*/
|
||||
@Operation(summary = "删除员工调动记录")
|
||||
@Parameter(name = "ids", description = "主键ID数组", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffTransfer:remove')")
|
||||
@Log(title = "员工调动记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(transferService.deleteTransferByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载带字典下拉框的导入模板
|
||||
* 使用@DictDropdown注解自动添加下拉框
|
||||
*/
|
||||
@Operation(summary = "下载导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiStaffTransferExcel.class, "员工调动记录信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 异步导入员工调动记录
|
||||
*/
|
||||
@Operation(summary = "异步导入员工调动记录")
|
||||
@Parameter(name = "file", description = "导入文件", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffTransfer:import')")
|
||||
@Log(title = "员工调动记录", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(@Parameter(description = "导入文件") MultipartFile file) throws Exception {
|
||||
List<CcdiStaffTransferExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiStaffTransferExcel.class);
|
||||
|
||||
if (list == null || list.isEmpty()) {
|
||||
return error("至少需要一条数据");
|
||||
}
|
||||
|
||||
// 提交异步任务
|
||||
String taskId = transferService.importTransfer(list);
|
||||
|
||||
// 立即返回,不等待后台任务完成
|
||||
ImportResultVO result = new ImportResultVO();
|
||||
result.setTaskId(taskId);
|
||||
result.setStatus("PROCESSING");
|
||||
result.setMessage("导入任务已提交,正在后台处理");
|
||||
|
||||
return AjaxResult.success("导入任务已提交,正在后台处理", result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入状态
|
||||
*/
|
||||
@Operation(summary = "查询导入状态")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffTransfer:import')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable String taskId) {
|
||||
ImportStatusVO statusVO = transferImportService.getImportStatus(taskId);
|
||||
return success(statusVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询导入失败记录")
|
||||
@Parameter(name = "taskId", description = "任务ID", required = true)
|
||||
@Parameter(name = "pageNum", description = "页码", required = false)
|
||||
@Parameter(name = "pageSize", description = "每页条数", required = false)
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffTransfer:import')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(
|
||||
@PathVariable String taskId,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
|
||||
List<StaffTransferImportFailureVO> failures = transferImportService.getImportFailures(taskId);
|
||||
|
||||
// 手动分页
|
||||
int fromIndex = (pageNum - 1) * pageSize;
|
||||
int toIndex = Math.min(fromIndex + pageSize, failures.size());
|
||||
|
||||
// 检查 fromIndex 是否超出范围
|
||||
if (fromIndex >= failures.size()) {
|
||||
return getDataTable(new ArrayList<>(), failures.size());
|
||||
}
|
||||
|
||||
List<StaffTransferImportFailureVO> pageData = failures.subList(fromIndex, toIndex);
|
||||
|
||||
return getDataTable(pageData, failures.size());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user