提交资产导入拆分当前进展
This commit is contained in:
@@ -28,12 +28,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 亲属资产信息Controller
|
||||
* 资产信息导入Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-03-12
|
||||
*/
|
||||
@Tag(name = "亲属资产信息管理")
|
||||
@Tag(name = "资产信息导入管理")
|
||||
@RestController
|
||||
@RequestMapping("/ccdi/assetInfo")
|
||||
public class CcdiAssetInfoController extends BaseController {
|
||||
@@ -44,18 +44,18 @@ public class CcdiAssetInfoController extends BaseController {
|
||||
/**
|
||||
* 下载导入模板
|
||||
*/
|
||||
@Operation(summary = "下载亲属资产导入模板")
|
||||
@Operation(summary = "下载资产导入模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiAssetInfoExcel.class, "亲属资产信息");
|
||||
EasyExcelUtil.importTemplateWithDictDropdown(response, CcdiAssetInfoExcel.class, "资产信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入亲属资产信息
|
||||
* 导入资产信息
|
||||
*/
|
||||
@Operation(summary = "导入亲属资产信息")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:import')")
|
||||
@Log(title = "亲属资产信息", businessType = BusinessType.IMPORT)
|
||||
@Operation(summary = "导入资产信息")
|
||||
@PreAuthorize("@ss.hasAnyPermi('ccdi:employee:import,ccdi:staffFmyRelation:import')")
|
||||
@Log(title = "资产信息", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file) throws Exception {
|
||||
List<CcdiAssetInfoExcel> list = EasyExcelUtil.importExcel(file.getInputStream(), CcdiAssetInfoExcel.class);
|
||||
@@ -74,8 +74,8 @@ public class CcdiAssetInfoController extends BaseController {
|
||||
/**
|
||||
* 查询导入状态
|
||||
*/
|
||||
@Operation(summary = "查询亲属资产导入状态")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:import')")
|
||||
@Operation(summary = "查询资产导入状态")
|
||||
@PreAuthorize("@ss.hasAnyPermi('ccdi:employee:import,ccdi:staffFmyRelation:import')")
|
||||
@GetMapping("/importStatus/{taskId}")
|
||||
public AjaxResult getImportStatus(@PathVariable String taskId) {
|
||||
return success(assetInfoImportService.getImportStatus(taskId));
|
||||
@@ -84,8 +84,8 @@ public class CcdiAssetInfoController extends BaseController {
|
||||
/**
|
||||
* 查询导入失败记录
|
||||
*/
|
||||
@Operation(summary = "查询亲属资产导入失败记录")
|
||||
@PreAuthorize("@ss.hasPermi('ccdi:staffFmyRelation:import')")
|
||||
@Operation(summary = "查询资产导入失败记录")
|
||||
@PreAuthorize("@ss.hasAnyPermi('ccdi:employee:import,ccdi:staffFmyRelation:import')")
|
||||
@GetMapping("/importFailures/{taskId}")
|
||||
public TableDataInfo getImportFailures(
|
||||
@PathVariable String taskId,
|
||||
|
||||
@@ -24,8 +24,8 @@ public class CcdiAssetInfoExcel implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 关系人证件号 */
|
||||
@ExcelProperty(value = "关系人证件号*", index = 0)
|
||||
/** 资产实际持有人证件号 */
|
||||
@ExcelProperty(value = "资产实际持有人证件号*", index = 0)
|
||||
@ColumnWidth(22)
|
||||
@Required
|
||||
@TextFormat
|
||||
|
||||
@@ -75,6 +75,14 @@ public interface CcdiAssetInfoMapper extends BaseMapper<CcdiAssetInfo> {
|
||||
*/
|
||||
int insertBatch(@Param("list") List<CcdiAssetInfo> list);
|
||||
|
||||
/**
|
||||
* 按资产实际持有人证件号查询员工本人归属候选
|
||||
*
|
||||
* @param personIds 资产实际持有人证件号列表
|
||||
* @return 归属映射
|
||||
*/
|
||||
List<Map<String, String>> selectOwnerCandidatesByPersonIds(@Param("personIds") List<String> personIds);
|
||||
|
||||
/**
|
||||
* 按关系人证件号查询归属员工候选
|
||||
*
|
||||
|
||||
@@ -97,10 +97,10 @@ public class CcdiAssetInfoImportServiceImpl implements ICcdiAssetInfoImportServi
|
||||
validateExcel(excel);
|
||||
Set<String> familyIds = ownerMap.get(excel.getPersonId());
|
||||
if (familyIds == null || familyIds.isEmpty()) {
|
||||
throw new RuntimeException("未找到亲属资产归属员工");
|
||||
throw new RuntimeException("未找到资产归属员工");
|
||||
}
|
||||
if (familyIds.size() > 1) {
|
||||
throw new RuntimeException("亲属资产归属员工不唯一");
|
||||
throw new RuntimeException("资产归属员工不唯一");
|
||||
}
|
||||
|
||||
CcdiAssetInfo assetInfo = new CcdiAssetInfo();
|
||||
@@ -164,7 +164,19 @@ public class CcdiAssetInfoImportServiceImpl implements ICcdiAssetInfoImportServi
|
||||
|
||||
private Map<String, Set<String>> buildOwnerMap(List<String> personIds) {
|
||||
Map<String, Set<String>> result = new LinkedHashMap<>();
|
||||
mergeOwnerMappings(result, assetInfoMapper.selectOwnerCandidatesByRelationCertNos(personIds));
|
||||
if (personIds == null || personIds.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
List<Map<String, String>> selfMappings = assetInfoMapper.selectOwnerCandidatesByPersonIds(personIds);
|
||||
mergeOwnerMappings(result, selfMappings);
|
||||
|
||||
Set<String> selfMatchedIds = result.keySet();
|
||||
List<String> relationPersonIds = personIds.stream()
|
||||
.filter(personId -> !selfMatchedIds.contains(personId))
|
||||
.toList();
|
||||
if (!relationPersonIds.isEmpty()) {
|
||||
mergeOwnerMappings(result, assetInfoMapper.selectOwnerCandidatesByRelationCertNos(relationPersonIds));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -184,7 +196,7 @@ public class CcdiAssetInfoImportServiceImpl implements ICcdiAssetInfoImportServi
|
||||
|
||||
private void validateExcel(CcdiAssetInfoExcel excel) {
|
||||
if (StringUtils.isEmpty(excel.getPersonId())) {
|
||||
throw new RuntimeException("关系人证件号不能为空");
|
||||
throw new RuntimeException("资产实际持有人证件号不能为空");
|
||||
}
|
||||
if (StringUtils.isEmpty(excel.getAssetMainType())) {
|
||||
throw new RuntimeException("资产大类不能为空");
|
||||
|
||||
@@ -77,6 +77,17 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectOwnerCandidatesByPersonIds" resultType="map">
|
||||
SELECT
|
||||
id_card AS personId,
|
||||
id_card AS familyId
|
||||
FROM ccdi_base_staff
|
||||
WHERE id_card IN
|
||||
<foreach collection="personIds" item="personId" open="(" separator="," close=")">
|
||||
#{personId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectOwnerCandidatesByRelationCertNos" resultType="map">
|
||||
SELECT
|
||||
relation_cert_no AS personId,
|
||||
|
||||
Reference in New Issue
Block a user