feat:管理端活动信息收集管理和家长参与代理商活动管理

This commit is contained in:
嘉多宝宝 2026-01-08 14:38:44 +08:00
parent c596fb3db8
commit 7792e17438
5 changed files with 89 additions and 28 deletions

View File

@ -17,6 +17,10 @@ public class AgentEmployeeSaveReq {
@NotNull(message = "员工名称不能为空") @NotNull(message = "员工名称不能为空")
private String employeeName; private String employeeName;
@Schema(description = "员工密码")
@NotNull(message = "员工密码不能为空")
private String password;
@Schema(description = "员工职位") @Schema(description = "员工职位")
private String position; private String position;

View File

@ -31,7 +31,7 @@ public class AdminParentAgentActivityService {
LambdaQueryWrapper<MpParentAgentActivityRelationEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<MpParentAgentActivityRelationEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Objects.nonNull(query.getActivityId()), MpParentAgentActivityRelationEntity::getActivityId, query.getActivityId()) wrapper.eq(Objects.nonNull(query.getActivityId()), MpParentAgentActivityRelationEntity::getActivityId, query.getActivityId())
.eq(Objects.nonNull(query.getAgentId()), MpParentAgentActivityRelationEntity::getAgentId, query.getAgentId()) .eq(Objects.nonNull(query.getAgentId()), MpParentAgentActivityRelationEntity::getAgentId, query.getAgentId())
.eq(Objects.nonNull(query.getAgentId()), MpParentAgentActivityRelationEntity::getParentId, query.getAgentId()) .eq(Objects.nonNull(query.getParentId()), MpParentAgentActivityRelationEntity::getParentId, query.getParentId())
.like(Objects.nonNull(query.getActivityName()) && !query.getActivityName().isEmpty(), MpParentAgentActivityRelationEntity::getActivityName, query.getActivityName()) .like(Objects.nonNull(query.getActivityName()) && !query.getActivityName().isEmpty(), MpParentAgentActivityRelationEntity::getActivityName, query.getActivityName())
.like(Objects.nonNull(query.getAgentName()) && !query.getAgentName().isEmpty(), MpParentAgentActivityRelationEntity::getAgentName, query.getAgentName()) .like(Objects.nonNull(query.getAgentName()) && !query.getAgentName().isEmpty(), MpParentAgentActivityRelationEntity::getAgentName, query.getAgentName())
.eq(Objects.nonNull(query.getStatus()), MpParentAgentActivityRelationEntity::getStatus, query.getStatus()) .eq(Objects.nonNull(query.getStatus()), MpParentAgentActivityRelationEntity::getStatus, query.getStatus())

View File

@ -6,16 +6,18 @@ import com.seer.teach.common.PageListBean;
import com.seer.teach.common.enums.ResultCodeEnum; import com.seer.teach.common.enums.ResultCodeEnum;
import com.seer.teach.common.utils.AssertUtils; import com.seer.teach.common.utils.AssertUtils;
import com.seer.teach.common.utils.PageConverterUtils; import com.seer.teach.common.utils.PageConverterUtils;
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq; import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq; import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp; import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
import com.seer.teach.mp.admin.convert.AdminAgentEmployeeRelationConvert; import com.seer.teach.mp.admin.convert.AdminAgentEmployeeRelationConvert;
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity; import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
import com.seer.teach.mp.entity.MpAgentEntity; import com.seer.teach.mp.entity.MpAgentEntity;
import com.seer.teach.mp.service.IMpAgentEmployeeRelationService; import com.seer.teach.mp.service.IMpAgentEmployeeRelationService;
import com.seer.teach.mp.service.IMpAgentService; import com.seer.teach.mp.service.IMpAgentService;
import com.seer.teach.user.api.UserInfoServiceApi;
import com.seer.teach.user.api.dto.UserInfoDTO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -38,6 +40,8 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
private final IMpAgentService mpAgentService; private final IMpAgentService mpAgentService;
private final UserInfoServiceApi userInfoServiceApi;
@Override @Override
public PageListBean<AgentEmployeeRelationResp> pageList(AgentEmployeeRelationQueryReq query) { public PageListBean<AgentEmployeeRelationResp> pageList(AgentEmployeeRelationQueryReq query) {
Page<MpAgentEmployeeRelationEntity> pageParm = new Page<>(query.getPageNo(), query.getPageSize()); Page<MpAgentEmployeeRelationEntity> pageParm = new Page<>(query.getPageNo(), query.getPageSize());
@ -76,9 +80,23 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
@Override @Override
public boolean save(AgentEmployeeSaveReq request) { public boolean save(AgentEmployeeSaveReq request) {
AssertUtils.isNull(request.getAgentName(), ResultCodeEnum.AGENT_EMPLOYEE_ALREADY_EXISTS); MpAgentEmployeeRelationEntity one = agentEmployeeRelationService.lambdaQuery()
MpAgentEmployeeRelationEntity relation = AdminAgentEmployeeRelationConvert.INSTANCE.convert(request); .eq(MpAgentEmployeeRelationEntity::getEmployeeName, request.getEmployeeName()).one();
AssertUtils.isNull(one, ResultCodeEnum.AGENT_EMPLOYEE_ALREADY_EXISTS);
UserInfoDTO userInfoDTO = new UserInfoDTO();
userInfoDTO.setUserName(request.getEmployeeName());
userInfoDTO.setPassword(request.getPassword());
userInfoServiceApi.saveAgentInfo(userInfoDTO);
Integer employeeUserId = userInfoServiceApi.getUserIdByUserName(request.getEmployeeName());
Integer agentId = mpAgentService.lambdaQuery().eq(MpAgentEntity::getAgentName, request.getAgentName()).one().getId(); Integer agentId = mpAgentService.lambdaQuery().eq(MpAgentEntity::getAgentName, request.getAgentName()).one().getId();
MpAgentEmployeeRelationEntity entity = new MpAgentEmployeeRelationEntity();
entity.setAgentId(agentId);
entity.setEmployeeUserId(employeeUserId);
entity.setEmployeeName(request.getEmployeeName());
entity.setAgentName(request.getAgentName());
entity.setPosition(request.getPosition());
entity.setStatus(request.getStatus());
agentEmployeeRelationService.save(entity);
return true; return true;
} }
} }

View File

@ -170,4 +170,10 @@ public interface UserInfoServiceApi {
@GetMapping("/checkUserInfo") @GetMapping("/checkUserInfo")
Integer checkUserInfo(@RequestParam("userId") Integer userId); Integer checkUserInfo(@RequestParam("userId") Integer userId);
@GetMapping("/getUserIdByUserName")
Integer getUserIdByUserName(@RequestParam("userName") String userName);
@PostMapping("/save-agentInfo")
boolean saveAgentInfo(@RequestBody UserInfoDTO userInfoDTO);
} }

View File

@ -61,6 +61,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 根据用户ID获取用户信息 * 根据用户ID获取用户信息
*
* @param id 用户ID * @param id 用户ID
* @return 用户信息DTO对象 * @return 用户信息DTO对象
*/ */
@ -100,6 +101,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 根据OpenId获取用户信息 * 根据OpenId获取用户信息
*
* @param openId 微信OpenId * @param openId 微信OpenId
* @return 用户信息DTO对象 * @return 用户信息DTO对象
*/ */
@ -115,6 +117,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 获取用户权限信息 * 获取用户权限信息
*
* @param userId 用户ID * @param userId 用户ID
* @return 用户权限DTO对象 * @return 用户权限DTO对象
*/ */
@ -130,6 +133,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 为用户添加经验值 * 为用户添加经验值
*
* @param userId 用户ID * @param userId 用户ID
* @param experienceValue 要添加的经验值 * @param experienceValue 要添加的经验值
*/ */
@ -145,6 +149,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 获取孩子信息 * 获取孩子信息
*
* @param userId 孩子用户ID * @param userId 孩子用户ID
* @return 孩子信息DTO对象 * @return 孩子信息DTO对象
*/ */
@ -168,6 +173,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 获取孩子年级ID * 获取孩子年级ID
*
* @param userId 孩子用户ID * @param userId 孩子用户ID
* @return 年级ID * @return 年级ID
*/ */
@ -179,6 +185,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 保存用户信息 * 保存用户信息
*
* @param userInfoDTO 用户信息DTO对象 * @param userInfoDTO 用户信息DTO对象
* @return 用户ID如果用户已存在则返回已存在的用户ID * @return 用户ID如果用户已存在则返回已存在的用户ID
*/ */
@ -233,6 +240,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 根据用户ID列表获取用户信息 * 根据用户ID列表获取用户信息
*
* @param userIds * @param userIds
* @return * @return
*/ */
@ -244,6 +252,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 根据用户ID获取用户信息 * 根据用户ID获取用户信息
*
* @param userId * @param userId
* @return * @return
*/ */
@ -271,8 +280,31 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
return IsInfoEnum.HAS_INFO.getCode(); return IsInfoEnum.HAS_INFO.getCode();
} }
@Override
public Integer getUserIdByUserName(String userName) {
UserEntity userEntity = userService.getOne(new LambdaQueryWrapper<UserEntity>()
.eq(UserEntity::getUserName, userName));
if (Objects.nonNull(userEntity)) {
return userEntity.getId();
}
return null;
}
@Override
public boolean saveAgentInfo(UserInfoDTO userInfoDTO) {
UserEntity one = userService.getOne(new LambdaQueryWrapper<UserEntity>()
.eq(UserEntity::getUserName, userInfoDTO.getUserName()));
AssertUtils.isNull(one, ResultCodeEnum.USERNAME_IS_EXIST);
UserEntity user = new UserEntity();
user.setUserName(userInfoDTO.getUserName());
String password = CommonUtils.encryptPassword(userInfoDTO.getPassword());
user.setPassword(password);
return userService.save(user);
}
/** /**
* 推送更新孩子信息的MQ消息 * 推送更新孩子信息的MQ消息
*
* @param children 孩子用户实体对象 * @param children 孩子用户实体对象
* @param userExtendEntity 用户扩展信息实体对象 * @param userExtendEntity 用户扩展信息实体对象
* @param device 设备信息 * @param device 设备信息
@ -295,6 +327,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/** /**
* 实际保存用户信息的私有方法 * 实际保存用户信息的私有方法
*
* @param userInfoDTO 用户信息DTO对象 * @param userInfoDTO 用户信息DTO对象
* @return 保存后的用户ID * @return 保存后的用户ID
*/ */