dev:导出用户修改

main
SondonYong 2025-11-13 10:56:39 +08:00
parent e6114208fd
commit b01cec1375
6 changed files with 14 additions and 26 deletions

View File

@ -117,17 +117,9 @@ public class UserController {
} }
@ApiOperation("导出用户列表") @ApiOperation("导出用户列表")
@PostMapping("/exportUserTable") @GetMapping("/exportUserTable")
public void exportUserTable(@Validated @RequestBody UserExportQry qry, HttpServletResponse httpServletResponse) { public void exportUserTable(@RequestParam(value = "ids") Long[] ids, HttpServletResponse httpServletResponse) {
List<Long> dataIds = Collections.emptyList(); userService.exportUserTable(httpServletResponse, ids, AuthContext.getTenantId());
if(qry.getIds() != null && qry.getIds().length > 0){
dataIds = Arrays.stream(qry.getIds())
.filter(Objects::nonNull) // 过滤掉null
.filter(str -> !str.trim().isEmpty()) // 过滤掉空字符串
.map(Long::valueOf)
.collect(Collectors.toList());
}
userService.exportUserTable(httpServletResponse, dataIds, Long.valueOf(qry.getCorpinfoId()));
} }
@ApiOperation("导入用户列表") @ApiOperation("导入用户列表")

View File

@ -23,10 +23,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Collection; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
@ -118,11 +115,11 @@ public class UserQueryExe {
/** /**
* *
*/ */
public void exportUserTable(HttpServletResponse httpServletResponse, List<Long> dataIds, Long corpinfoId) { public void exportUserTable(HttpServletResponse httpServletResponse, Long[] ids, Long corpinfoId) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("corpinfoId", corpinfoId); params.put("corpinfoId", corpinfoId);
if(dataIds != null && !dataIds.isEmpty()) { if(ids != null && ids.length > 0) {
params.put("userIdList", dataIds); params.put("userIdList", Arrays.asList(ids));
} }
List<UserDO> userDOList = userRepository.listAll(params); List<UserDO> userDOList = userRepository.listAll(params);
List<UserExcelExportEntity> userExcelExportEntities = userCoConvertor.converDOsToExcelEntitys(userDOList); List<UserExcelExportEntity> userExcelExportEntities = userCoConvertor.converDOsToExcelEntitys(userDOList);

View File

@ -59,8 +59,8 @@ public class UserServiceImpl implements UserServiceI {
} }
@Override @Override
public void exportUserTable(HttpServletResponse httpServletResponse, List<Long> dataIds, Long corpinfoId) { public void exportUserTable(HttpServletResponse httpServletResponse, Long[] ids, Long corpinfoId) {
userQueryExe.exportUserTable(httpServletResponse, dataIds, corpinfoId); userQueryExe.exportUserTable(httpServletResponse, ids, corpinfoId);
} }
@Override @Override

View File

@ -27,7 +27,7 @@ public interface UserServiceI {
void edit(UserUpdateCmd cmd); void edit(UserUpdateCmd cmd);
void exportUserTable(HttpServletResponse httpServletResponse, List<Long> dataIds, Long corpinfoId); void exportUserTable(HttpServletResponse httpServletResponse, Long[] ids, Long corpinfoId);
void importUserTable(MultipartFile file); void importUserTable(MultipartFile file);

View File

@ -27,11 +27,10 @@ public class UserExportQry extends PageQuery {
* - `ne`: SQL!= * - `ne`: SQL!=
*/ */
@ApiModelProperty(value = "人员id列表", name = "ids") @ApiModelProperty(value = "人员id列表", name = "ids")
private String[] ids; private Long[] ids;
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true) @ApiModelProperty(value = "企业id", name = "eqCorpinfoId")
@NotEmpty(message = "企业id不能为空") private String eqCorpinfoId;
private String corpinfoId;
} }

View File

@ -278,7 +278,7 @@ public class UserE extends BaseE {
} }
if(CollUtil.isNotEmpty(errList)){ if(CollUtil.isNotEmpty(errList)){
throw new BizException("导入信息有误,请检查后重新导入。", String.join("", errList)); throw new BizException("导入信息有误,请检查后重新导入。错误信息:" + String.join("", errList));
} }
// 映射 // 映射