模版下载接口

This commit is contained in:
fl 2025-04-28 18:13:16 +08:00
parent c2df9da689
commit 8c64104b49
16 changed files with 334 additions and 15 deletions

View File

@ -114,5 +114,21 @@ public class EpcController extends BaseController {
}
}
/**
* EPC模版下载
* @param
* @return
*/
@ApiOperation(value = "EPC模版下载")
// @PreAuthorize("@ss.hasPermi('key:people:add')")
@PostMapping("/downloadEpcTemp")
public AjaxResult downloadEpcTemp(@RequestBody TbGwModelDto o) {
try {
return service.downloadEpcTemp(o);
}catch (Exception e){
log.info("国网模版修改失败{}",e.getMessage());
return error(e.getMessage());
}
}
}

View File

@ -115,5 +115,22 @@ public class SouthController extends BaseController {
}
}
/**
* 南网模版下载
* @param
* @return
*/
@ApiOperation(value = "南网模版下载")
// @PreAuthorize("@ss.hasPermi('key:people:add')")
@PostMapping("/downloadEpcTemp")
public AjaxResult downloadSouthTemp(@RequestBody TbGwModelDto o) {
try {
return service.downloadSouthTemp(o);
}catch (Exception e){
log.info("国网模版修改失败{}",e.getMessage());
return error(e.getMessage());
}
}
}

View File

@ -11,7 +11,7 @@ import java.util.List;
* @date 2025/4/21
*/
@Data
public class ComCorePersonBean {
public class ComCorePersonBean extends PersonFileBean{
private Long parentId;

View File

@ -3,12 +3,14 @@ package com.bonus.tool.dto;
import com.bonus.common.annotation.Excel;
import lombok.Data;
import java.util.List;
/**
* @author fly
* @date 2025/4/21
*/
@Data
public class ComOtherPersonBean {
public class ComOtherPersonBean extends PersonFileBean{
private Long parentId;

View File

@ -59,7 +59,6 @@ public class ComPerformanceBean {
/**
* 承包范围
*/
@Excel(name = "承包范围", sort = 8)
private String contractRang;
/**
@ -72,5 +71,10 @@ public class ComPerformanceBean {
*/
private String ownerPhone;
/**
* 文件
*/
private List<TbFileSourceVo> fileList;
}

View File

@ -0,0 +1,30 @@
package com.bonus.tool.dto;
import lombok.Data;
import java.util.List;
/**
* @author fly
* @date 2025/4/21
*/
@Data
public class PersonFileBean {
/**
* 身份证照片 第一个正面 第二个反面
*/
private List<TbFileSourceVo> idCardFileList;
/**
* 资格证书照片
*/
private List<TbFileSourceVo> diplomaFileList;
/**
* 其他资质照片
*/
private List<TbFileSourceVo> otherFileList;
}

View File

@ -36,4 +36,9 @@ public class SubBean {
*/
private List<SubOtherPeopleBean> subPersonList;
/**
* 文件
*/
private List<TbFileSourceVo> subFileList;
}

View File

@ -11,7 +11,7 @@ import java.util.List;
* @date 2025/4/22
*/
@Data
public class SubOtherPeopleBean {
public class SubOtherPeopleBean extends PersonFileBean{
private Long parentId;

View File

@ -71,9 +71,9 @@ public class SubPerformanceBean {
*/
private String htRemark;
/**
* 文件
*/
private List<TbFileSourceVo> subPerfFileList;
}

View File

@ -121,4 +121,12 @@ public interface StateGridMapper {
* @return
*/
int updateStateGridTemp(TbGwModelDto o);
/**
* 根据表名和id获取对应附件列表
* @param id
* @param tableName
* @return
*/
List<TbFileSourceVo> getFileSourceList(@Param("id") Long id,@Param("tableName") String tableName);
}

View File

@ -41,4 +41,11 @@ public interface EpcService {
* @return
*/
AjaxResult updateEpcTemp(TbGwModelDto o);
/**
* EPC模版下载
* @param
* @return
*/
AjaxResult downloadEpcTemp(TbGwModelDto o);
}

View File

@ -41,4 +41,11 @@ public interface SouthService {
* @return
*/
AjaxResult updateSouthTemp(TbGwModelDto o);
/**
* 南网模版下载
* @param o
* @return
*/
AjaxResult downloadSouthTemp(TbGwModelDto o);
}

View File

@ -1,15 +1,18 @@
package com.bonus.tool.service.impl;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.enums.TableType;
import com.bonus.common.utils.SecurityUtils;
import com.bonus.tool.dto.*;
import com.bonus.tool.mapper.EpcMapper;
import com.bonus.tool.mapper.StateGridMapper;
import com.bonus.tool.service.EpcService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -23,6 +26,9 @@ public class EpcServiceImpl implements EpcService {
@Resource
private EpcMapper mapper;
@Resource
private StateGridMapper stateGridMapper;
/**
* Epc模版列表查询
*
@ -146,6 +152,69 @@ public class EpcServiceImpl implements EpcService {
return AjaxResult.success("Epc模板修改成功");
}
@Override
public AjaxResult downloadEpcTemp(TbGwModelDto o) {
AjaxResult ajaxResult = getEpcTempById(o);
if (ajaxResult.isSuccess()) {
TbGwModelVo data = (TbGwModelVo) ajaxResult.get("data");
//将每种数据的文件查出来封装进去
//1.2公司核心人员文件
data.getComCoreList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> comCoreList = stateGridMapper.getFileSourceList(item.getId(),TableType.TB_KEY_PEOPLE.getCode());
personFileGroup(item, comCoreList);
});
//1.3公司其他人员文件
data.getComOtherList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> comOtherList = stateGridMapper.getFileSourceList(item.getId(),TableType.TB_OTHER_PEOPLE.getCode());
personFileGroup(item, comOtherList);
});
//2.2拟派人员材料
data.getSubPersonList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> comOtherList = stateGridMapper.getFileSourceList(item.getId(),TableType.TB_SUB_PEOPLE.getCode());
personFileGroup(item, comOtherList);
});
}
return AjaxResult.success();
}
/**
* 根据文件类型对文件列表进行分组并设置到item对象中
* @param <T> 继承自PersonFileBean的类型
* @param item 继承自PersonFileBean的具体实例
* @param list 文件源列表
*/
private <T extends PersonFileBean> void personFileGroup(T item, List<TbFileSourceVo> list) {
List<TbFileSourceVo> type1List = new ArrayList<>();
List<TbFileSourceVo> type2List = new ArrayList<>();
List<TbFileSourceVo> type3List = new ArrayList<>();
for (TbFileSourceVo file : list) {
int fileType = Integer.parseInt(file.getFileType());
switch (fileType) {
case 1:
type1List.add(file);
break;
case 2:
type2List.add(file);
break;
case 3:
type3List.add(file);
break;
default:
// 如果有其他 fileType可以在这里处理
break;
}
}
// 设置到 item 对应的字段中
item.setIdCardFileList(type1List);
item.setDiplomaFileList(type2List);
item.setOtherFileList(type3List);
}
/**
* 删除Epc模版关联数据
*

View File

@ -1,18 +1,18 @@
package com.bonus.tool.service.impl;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.enums.TableType;
import com.bonus.common.utils.SecurityUtils;
import com.bonus.tool.dto.ComCorePersonBean;
import com.bonus.tool.dto.ComOtherPersonBean;
import com.bonus.tool.dto.TbGwModelDto;
import com.bonus.tool.dto.TbGwModelVo;
import com.bonus.tool.dto.*;
import com.bonus.tool.mapper.SouthMapper;
import com.bonus.tool.mapper.StateGridMapper;
import com.bonus.tool.service.SouthService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -26,6 +26,9 @@ public class SouthServiceImpl implements SouthService {
@Resource
private SouthMapper mapper;
@Resource
private StateGridMapper stateGridMapper;
/**
* 南网模版列表查询
*
@ -149,6 +152,69 @@ public class SouthServiceImpl implements SouthService {
return AjaxResult.success("South模板修改成功");
}
@Override
public AjaxResult downloadSouthTemp(TbGwModelDto o) {
AjaxResult ajaxResult = getSouthTempById(o);
if (ajaxResult.isSuccess()) {
TbGwModelVo data = (TbGwModelVo) ajaxResult.get("data");
//将每种数据的文件查出来封装进去
//1.2公司核心人员文件
data.getComCoreList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> comCoreList = stateGridMapper.getFileSourceList(item.getId(), TableType.TB_KEY_PEOPLE.getCode());
personFileGroup(item, comCoreList);
});
//1.3公司其他人员文件
data.getComOtherList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> comOtherList = stateGridMapper.getFileSourceList(item.getId(),TableType.TB_OTHER_PEOPLE.getCode());
personFileGroup(item, comOtherList);
});
//2.2拟派人员材料
data.getSubPersonList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> comOtherList = stateGridMapper.getFileSourceList(item.getId(),TableType.TB_SUB_PEOPLE.getCode());
personFileGroup(item, comOtherList);
});
}
return AjaxResult.success();
}
/**
* 根据文件类型对文件列表进行分组并设置到item对象中
* @param <T> 继承自PersonFileBean的类型
* @param item 继承自PersonFileBean的具体实例
* @param list 文件源列表
*/
private <T extends PersonFileBean> void personFileGroup(T item, List<TbFileSourceVo> list) {
List<TbFileSourceVo> type1List = new ArrayList<>();
List<TbFileSourceVo> type2List = new ArrayList<>();
List<TbFileSourceVo> type3List = new ArrayList<>();
for (TbFileSourceVo file : list) {
int fileType = Integer.parseInt(file.getFileType());
switch (fileType) {
case 1:
type1List.add(file);
break;
case 2:
type2List.add(file);
break;
case 3:
type3List.add(file);
break;
default:
// 如果有其他 fileType可以在这里处理
break;
}
}
// 设置到 item 对应的字段中
item.setIdCardFileList(type1List);
item.setDiplomaFileList(type2List);
item.setOtherFileList(type3List);
}
/**
* 删除南网模版关联数据
*

View File

@ -1,6 +1,7 @@
package com.bonus.tool.service.impl;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.enums.TableType;
import com.bonus.common.utils.SecurityUtils;
import com.bonus.tool.dto.*;
import com.bonus.tool.mapper.StateGridMapper;
@ -10,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -195,15 +197,95 @@ public class StateGridServiceImpl implements StateGridService {
if (ajaxResult.isSuccess()) {
TbGwModelVo data = (TbGwModelVo) ajaxResult.get("data");
//将每种数据的文件查出来封装进去
//1.1公司业绩文件
data.getComPerfList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> comPerfFileList = getFileSourceList(item.getId(),TableType.TB_COMPANY_PERF.getCode());
item.setFileList(comPerfFileList);
});
//1.2公司核心人员文件
data.getComCoreList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> comCoreList = getFileSourceList(item.getId(),TableType.TB_KEY_PEOPLE.getCode());
personFileGroup(item, comCoreList);
});
//1.3公司其他人员文件
data.getComOtherList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> comOtherList = getFileSourceList(item.getId(),TableType.TB_OTHER_PEOPLE.getCode());
personFileGroup(item, comOtherList);
});
//1.4 分包资质
data.getSubList().forEach(item -> {
//获取附件信息
List<TbFileSourceVo> subFileList = getFileSourceList(item.getId(),TableType.TB_SUB.getCode());
item.setSubFileList(subFileList);
//2.1分包业绩证明材料
item.getSubPerfList().forEach(perfItem -> {
//获取附件信息
List<TbFileSourceVo> subPerfList = getFileSourceList(perfItem.getId(),TableType.TB_SUB_PERF.getCode());
perfItem.setSubPerfFileList(subPerfList);
});
//2.2拟派人员材料
item.getSubPersonList().forEach(personItem -> {
//获取附件信息
List<TbFileSourceVo> comOtherList = getFileSourceList(personItem.getId(),TableType.TB_SUB_PEOPLE.getCode());
personFileGroup(personItem, comOtherList);
});
});
}
return null;
return AjaxResult.success();
}
private List<TbFileSourceVo> getFileSourceList(TbGwModelDto o) {
return null;
/**
* 根据文件类型对文件列表进行分组并设置到item对象中
* @param <T> 继承自PersonFileBean的类型
* @param item 继承自PersonFileBean的具体实例
* @param list 文件源列表
*/
private <T extends PersonFileBean> void personFileGroup(T item, List<TbFileSourceVo> list) {
List<TbFileSourceVo> type1List = new ArrayList<>();
List<TbFileSourceVo> type2List = new ArrayList<>();
List<TbFileSourceVo> type3List = new ArrayList<>();
for (TbFileSourceVo file : list) {
int fileType = Integer.parseInt(file.getFileType());
switch (fileType) {
case 1:
type1List.add(file);
break;
case 2:
type2List.add(file);
break;
case 3:
type3List.add(file);
break;
default:
// 如果有其他 fileType可以在这里处理
break;
}
}
// 设置到 item 对应的字段中
item.setIdCardFileList(type1List);
item.setDiplomaFileList(type2List);
item.setOtherFileList(type3List);
}
/**
* 查询文件源信息
* @param id
* @param tableName
* @return
*/
private List<TbFileSourceVo> getFileSourceList(Long id, String tableName) {
return mapper.getFileSourceList(id,tableName);
}
/**
* 删除国网模版关联数据
*

View File

@ -242,4 +242,10 @@
AND tgsu.sub_id = #{subId}
</select>
<select id="getFileSourceList" resultType="com.bonus.tool.dto.TbFileSourceVo">
select id,table_name as tableName,table_id as tableId,file_path as filePath,file_type as fileType,
file_name as fileName,file_suffix as fileSuffix,create_time as createTime,upload_user as uploadUser
from tb_file_source where del_flag=0 and table_name = #{tableName} and table_id = #{id}
</select>
</mapper>