dev:导出用户修改
parent
e6114208fd
commit
b01cec1375
|
|
@ -117,17 +117,9 @@ public class UserController {
|
|||
}
|
||||
|
||||
@ApiOperation("导出用户列表")
|
||||
@PostMapping("/exportUserTable")
|
||||
public void exportUserTable(@Validated @RequestBody UserExportQry qry, HttpServletResponse httpServletResponse) {
|
||||
List<Long> dataIds = Collections.emptyList();
|
||||
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()));
|
||||
@GetMapping("/exportUserTable")
|
||||
public void exportUserTable(@RequestParam(value = "ids") Long[] ids, HttpServletResponse httpServletResponse) {
|
||||
userService.exportUserTable(httpServletResponse, ids, AuthContext.getTenantId());
|
||||
}
|
||||
|
||||
@ApiOperation("导入用户列表")
|
||||
|
|
|
|||
|
|
@ -23,10 +23,7 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -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<>();
|
||||
params.put("corpinfoId", corpinfoId);
|
||||
if(dataIds != null && !dataIds.isEmpty()) {
|
||||
params.put("userIdList", dataIds);
|
||||
if(ids != null && ids.length > 0) {
|
||||
params.put("userIdList", Arrays.asList(ids));
|
||||
}
|
||||
List<UserDO> userDOList = userRepository.listAll(params);
|
||||
List<UserExcelExportEntity> userExcelExportEntities = userCoConvertor.converDOsToExcelEntitys(userDOList);
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ public class UserServiceImpl implements UserServiceI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void exportUserTable(HttpServletResponse httpServletResponse, List<Long> dataIds, Long corpinfoId) {
|
||||
userQueryExe.exportUserTable(httpServletResponse, dataIds, corpinfoId);
|
||||
public void exportUserTable(HttpServletResponse httpServletResponse, Long[] ids, Long corpinfoId) {
|
||||
userQueryExe.exportUserTable(httpServletResponse, ids, corpinfoId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public interface UserServiceI {
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,11 +27,10 @@ public class UserExportQry extends PageQuery {
|
|||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||
*/
|
||||
@ApiModelProperty(value = "人员id列表", name = "ids")
|
||||
private String[] ids;
|
||||
private Long[] ids;
|
||||
|
||||
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
|
||||
@NotEmpty(message = "企业id不能为空")
|
||||
private String corpinfoId;
|
||||
@ApiModelProperty(value = "企业id", name = "eqCorpinfoId")
|
||||
private String eqCorpinfoId;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ public class UserE extends BaseE {
|
|||
}
|
||||
|
||||
if(CollUtil.isNotEmpty(errList)){
|
||||
throw new BizException("导入信息有误,请检查后重新导入。", String.join("", errList));
|
||||
throw new BizException("导入信息有误,请检查后重新导入。错误信息:" + String.join("", errList));
|
||||
}
|
||||
|
||||
// 映射
|
||||
|
|
|
|||
Loading…
Reference in New Issue