|
@@ -36,6 +36,7 @@ import org.springframework.web.bind.annotation.PutMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestPart;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
@@ -154,9 +155,9 @@ public class WmTeamController {
|
|
* @param teamExcelModelList
|
|
* @param teamExcelModelList
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @SysLog("团队批量导入")
|
|
|
|
- @PostMapping("/batch-import/{teamId}")
|
|
|
|
- public R<?> batchImport(@PathVariable("teamId") Integer teamId, @RequestExcel List<WmTeamExcelModel> teamExcelModelList) {
|
|
|
|
|
|
+ @SysLog("团队成员批量导入")
|
|
|
|
+ @PostMapping("/batch-import")
|
|
|
|
+ public R<?> batchImport(@RequestExcel(ignoreEmptyRow = true) List<WmTeamExcelModel> teamExcelModelList, @RequestParam("teamId") String teamId) {
|
|
// 参数校验
|
|
// 参数校验
|
|
if (CollectionUtils.isEmpty(teamExcelModelList)) {
|
|
if (CollectionUtils.isEmpty(teamExcelModelList)) {
|
|
log.error("空报表,不能上传");
|
|
log.error("空报表,不能上传");
|
|
@@ -164,10 +165,17 @@ public class WmTeamController {
|
|
}
|
|
}
|
|
|
|
|
|
Map<String, List<WmTeamExcelModel>> excelMap = teamExcelModelList.stream()
|
|
Map<String, List<WmTeamExcelModel>> excelMap = teamExcelModelList.stream()
|
|
|
|
+ .filter(wmTeamExcelModel -> StrUtil.isNotBlank(wmTeamExcelModel.getId()))
|
|
|
|
+ .map(wmTeamExcelModel -> {
|
|
|
|
+ wmTeamExcelModel.setId(StrUtil.trim(wmTeamExcelModel.getId()));
|
|
|
|
+ wmTeamExcelModel.setRealname(StrUtil.trim(wmTeamExcelModel.getRealname()));
|
|
|
|
+ wmTeamExcelModel.setUsername(StrUtil.trim(wmTeamExcelModel.getUsername()));
|
|
|
|
+ return wmTeamExcelModel;
|
|
|
|
+ })
|
|
.collect(Collectors.groupingBy(WmTeamExcelModel::getUsername));
|
|
.collect(Collectors.groupingBy(WmTeamExcelModel::getUsername));
|
|
|
|
|
|
// 实际的处理业务
|
|
// 实际的处理业务
|
|
- Map<String, String> errorMap = wmTeamService.batchImport(teamId, excelMap);
|
|
|
|
|
|
+ Map<String, String> errorMap = wmTeamService.batchImport(Integer.valueOf(teamId), excelMap);
|
|
|
|
|
|
// 返回上传结果
|
|
// 返回上传结果
|
|
Map<String, Object> result = new HashMap<>(3);
|
|
Map<String, Object> result = new HashMap<>(3);
|
|
@@ -287,7 +295,7 @@ public class WmTeamController {
|
|
/**
|
|
/**
|
|
* 查询团队可选择人员
|
|
* 查询团队可选择人员
|
|
*
|
|
*
|
|
- * @param teamId 团队id
|
|
|
|
|
|
+ * @param teamId 团队id
|
|
* @param realNameOrPhone 姓名或手机号
|
|
* @param realNameOrPhone 姓名或手机号
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|