mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-06-10 11:44:04 +08:00
fixed: 学员批量导入邮箱
This commit is contained in:
parent
e215fbb59c
commit
afc82856f6
34
playedu-api/src/main/java/xyz/playedu/api/bus/UserBus.java
Normal file
34
playedu-api/src/main/java/xyz/playedu/api/bus/UserBus.java
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 杭州白书科技有限公司
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package xyz.playedu.api.bus;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import xyz.playedu.common.constant.ConfigConstant;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class UserBus {
|
||||||
|
|
||||||
|
public String getUserDefaultAvatar(Map<String, String> configData) {
|
||||||
|
String memberDefaultAvatar = configData.get(ConfigConstant.MEMBER_DEFAULT_AVATAR);
|
||||||
|
if (memberDefaultAvatar == null || memberDefaultAvatar.trim().isEmpty()) {
|
||||||
|
return configData.get(ConfigConstant.SYSTEM_API_URL) + "/images/default_avatar.png";
|
||||||
|
}
|
||||||
|
return memberDefaultAvatar;
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import xyz.playedu.api.bus.UserBus;
|
||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
import xyz.playedu.common.constant.BusinessTypeConstant;
|
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||||
import xyz.playedu.common.constant.ConfigConstant;
|
import xyz.playedu.common.constant.ConfigConstant;
|
||||||
@ -45,6 +46,8 @@ public class SystemController {
|
|||||||
|
|
||||||
@Autowired private CategoryService categoryService;
|
@Autowired private CategoryService categoryService;
|
||||||
|
|
||||||
|
@Autowired private UserBus userBus;
|
||||||
|
|
||||||
@GetMapping("/config")
|
@GetMapping("/config")
|
||||||
@Log(title = "其它-系统配置", businessType = BusinessTypeConstant.GET)
|
@Log(title = "其它-系统配置", businessType = BusinessTypeConstant.GET)
|
||||||
public JsonResponse config() {
|
public JsonResponse config() {
|
||||||
@ -68,12 +71,7 @@ public class SystemController {
|
|||||||
data.put(ConfigConstant.SYSTEM_H5_URL, configData.get(ConfigConstant.SYSTEM_H5_URL));
|
data.put(ConfigConstant.SYSTEM_H5_URL, configData.get(ConfigConstant.SYSTEM_H5_URL));
|
||||||
|
|
||||||
// 学员的默认头像
|
// 学员的默认头像
|
||||||
String memberDefaultAvatar = configData.get(ConfigConstant.MEMBER_DEFAULT_AVATAR);
|
data.put(ConfigConstant.MEMBER_DEFAULT_AVATAR, userBus.getUserDefaultAvatar(configData));
|
||||||
if (memberDefaultAvatar == null || memberDefaultAvatar.trim().isEmpty()) {
|
|
||||||
data.put(ConfigConstant.MEMBER_DEFAULT_AVATAR, apiUrl + "/images/default_avatar.png");
|
|
||||||
} else {
|
|
||||||
data.put(ConfigConstant.MEMBER_DEFAULT_AVATAR, memberDefaultAvatar);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 内置的三个线上课封面
|
// 内置的三个线上课封面
|
||||||
List<String> defaultCourseThumbs = new ArrayList<>();
|
List<String> defaultCourseThumbs = new ArrayList<>();
|
||||||
|
@ -28,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import xyz.playedu.api.bus.UserBus;
|
||||||
import xyz.playedu.api.event.UserCourseHourRecordDestroyEvent;
|
import xyz.playedu.api.event.UserCourseHourRecordDestroyEvent;
|
||||||
import xyz.playedu.api.event.UserCourseRecordDestroyEvent;
|
import xyz.playedu.api.event.UserCourseRecordDestroyEvent;
|
||||||
import xyz.playedu.api.event.UserDestroyEvent;
|
import xyz.playedu.api.event.UserDestroyEvent;
|
||||||
@ -37,7 +38,6 @@ import xyz.playedu.common.annotation.BackendPermission;
|
|||||||
import xyz.playedu.common.annotation.Log;
|
import xyz.playedu.common.annotation.Log;
|
||||||
import xyz.playedu.common.constant.BPermissionConstant;
|
import xyz.playedu.common.constant.BPermissionConstant;
|
||||||
import xyz.playedu.common.constant.BusinessTypeConstant;
|
import xyz.playedu.common.constant.BusinessTypeConstant;
|
||||||
import xyz.playedu.common.constant.ConfigConstant;
|
|
||||||
import xyz.playedu.common.constant.SystemConstant;
|
import xyz.playedu.common.constant.SystemConstant;
|
||||||
import xyz.playedu.common.context.BCtx;
|
import xyz.playedu.common.context.BCtx;
|
||||||
import xyz.playedu.common.domain.*;
|
import xyz.playedu.common.domain.*;
|
||||||
@ -232,7 +232,7 @@ public class UserController {
|
|||||||
@PostMapping("/store-batch")
|
@PostMapping("/store-batch")
|
||||||
@Transactional
|
@Transactional
|
||||||
@Log(title = "学员-批量导入", businessType = BusinessTypeConstant.INSERT)
|
@Log(title = "学员-批量导入", businessType = BusinessTypeConstant.INSERT)
|
||||||
public JsonResponse batchStore(@RequestBody @Validated UserImportRequest req) {
|
public JsonResponse batchStore(@RequestBody @Validated UserImportRequest req, UserBus userBus) {
|
||||||
List<UserImportRequest.UserItem> users = req.getUsers();
|
List<UserImportRequest.UserItem> users = req.getUsers();
|
||||||
if (users.isEmpty()) {
|
if (users.isEmpty()) {
|
||||||
return JsonResponse.error("数据为空");
|
return JsonResponse.error("数据为空");
|
||||||
@ -245,7 +245,7 @@ public class UserController {
|
|||||||
Integer startLine = req.getStartLine();
|
Integer startLine = req.getStartLine();
|
||||||
|
|
||||||
// 默认的学员头像
|
// 默认的学员头像
|
||||||
String defaultAvatar = BCtx.getConfig().get(ConfigConstant.MEMBER_DEFAULT_AVATAR);
|
String defaultAvatar = userBus.getUserDefaultAvatar(BCtx.getConfig());
|
||||||
|
|
||||||
List<String[]> errorLines = new ArrayList<>();
|
List<String[]> errorLines = new ArrayList<>();
|
||||||
errorLines.add(new String[] {"错误行", "错误信息"}); // 错误表-表头
|
errorLines.add(new String[] {"错误行", "错误信息"}); // 错误表-表头
|
||||||
|
Loading…
x
Reference in New Issue
Block a user