Merge remote-tracking branch 'origin/dev-chenjiajian'

This commit is contained in:
Wang 2026-01-08 14:46:27 +08:00
commit 9e733f71ff
15 changed files with 393 additions and 49 deletions

View File

@ -2,7 +2,6 @@ package com.seer.teach.mp.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.seer.teach.common.config.mybatis.hanler.IntegerListTypeHandler;
import com.seer.teach.common.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -29,18 +28,18 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
@TableField("relation_id")
private Integer relationId;
/**
* 活动ID
*/
@TableField("activity_id")
private Integer activityId;
/**
* 代理商ID
*/
@TableField("agent_id")
private Integer agentId;
/**
* 活动ID
*/
@TableField("activity_id")
private Integer activityId;
/**
* 家长ID
*/
@ -96,14 +95,21 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
private String learningSituation;
/**
* 优势学(数学英语等)
* (数学英语等)
*/
@TableField(value = "strong_subject_ids",typeHandler = IntegerListTypeHandler.class)
private List<Integer> strongSubjectIds;
@TableField("weak_subject")
private String weakSubject;
/**
* 劣势学科(数学英语等)
* 薄弱科目
*/
@TableField(value = "weak_subject_ids",typeHandler = IntegerListTypeHandler.class)
@TableField("weak_subject_ids")
private List<Integer> weakSubjectIds;
/**
* 优势科目
*/
@TableField("strong_subject_ids")
private List<Integer> strongSubjectIds;
}

View File

@ -0,0 +1,50 @@
package com.seer.teach.mp.admin.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.mp.admin.controller.req.ActivityInfoCollectionQueryReq;
import com.seer.teach.mp.admin.controller.resp.AdminActivityInfoCollectionResp;
import com.seer.teach.mp.admin.service.AdminActivityInfoCollectionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Tag(name = "管理端 - 活动信息收集管理")
@LogPrint
@RequiredArgsConstructor
@RestController
@RequestMapping("/mp/activity/info/collection")
public class AdminActivityInfoCollectionController {
private final AdminActivityInfoCollectionService adminActivityInfoCollectionService;
@PostMapping("/page")
@SaCheckPermission("admin:activity:info:collection:page")
@Operation(summary = "分页查询活动信息收集记录")
public ResultBean<PageListBean<AdminActivityInfoCollectionResp>> pageList(
@RequestBody @Validated ActivityInfoCollectionQueryReq req) {
PageListBean<AdminActivityInfoCollectionResp> result = adminActivityInfoCollectionService.pageList(req);
return ResultBean.success(result);
}
@GetMapping("/{id}")
@SaCheckPermission("admin:activity:info:collection:detail")
@Operation(summary = "获取活动信息收集记录详情")
public ResultBean<AdminActivityInfoCollectionResp> detail(@PathVariable Integer id) {
return ResultBean.success(adminActivityInfoCollectionService.getDetail(id));
}
@PostMapping("delete")
@SaCheckPermission("admin:activity:info:collection:delete")
@Operation(summary = "删除活动信息收集记录")
public ResultBean<Boolean> delete(@RequestBody List<Integer> ids) {
return ResultBean.success(adminActivityInfoCollectionService.delete(ids));
}
}

View File

@ -1,30 +1,26 @@
package com.seer.teach.mp.admin.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.annotation.LogPrint;
import com.seer.teach.common.utils.PageConverterUtils;
import com.seer.teach.mp.admin.controller.req.ParentAgentActivityQueryReq;
import com.seer.teach.mp.admin.controller.resp.AdminParentAgentActivityResp;
import com.seer.teach.mp.admin.controller.resp.MpParentAgentActivityResp;
import com.seer.teach.mp.admin.service.AdminParentAgentActivityService;
import com.seer.teach.mp.entity.MpParentAgentActivityRelationEntity;
import com.seer.teach.mp.service.IMpParentAgentActivityRelationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 家长参与代理商活动控制器 - 管理端
*/
@Tag(name = "管理端 - 家长参与代理商活动管理")
@AllArgsConstructor
@RestController
@RequestMapping("/mp/admin/parent/agent/activity")
@RequestMapping("/mp/parent/agent/activity")
public class AdminParentAgentActivityController {
private final AdminParentAgentActivityService adminParentAgentActivityService;
@ -45,4 +41,12 @@ public class AdminParentAgentActivityController {
public ResultBean<AdminParentAgentActivityResp> detail(@PathVariable Integer id) {
return ResultBean.success(adminParentAgentActivityService.getDetail(id));
}
@PostMapping("delete")
@SaCheckPermission("admin:parent:agent:activity:delete")
@Operation(summary = "删除家长参与代理商活动记录")
@LogPrint
public ResultBean<Boolean> delete(@RequestBody List<Integer> ids) {
return ResultBean.success(adminParentAgentActivityService.delete(ids));
}
}

View File

@ -0,0 +1,37 @@
package com.seer.teach.mp.admin.controller.req;
import com.seer.teach.common.request.PageRequest;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "活动信息收集查询请求")
public class ActivityInfoCollectionQueryReq extends PageRequest {
/**
* 孩子姓名
*/
@Schema(description = "孩子姓名")
private String childName;
/**
* 孩子性别(M-,F-)
*/
@Schema(description = "孩子性别")
private String childGender;
/**
* 年级
*/
@Schema(description = "年级")
private String grade;
/**
* 学校
*/
@Schema(description = "学校")
private String school;
}

View File

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

View File

@ -0,0 +1,95 @@
package com.seer.teach.mp.admin.controller.resp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
@Schema(name = "AdminActivityInfoCollectionResp", description = "活动信息收集响应参数")
public class AdminActivityInfoCollectionResp {
private Integer id;
/**
* 关联的家长参与代理商活动关系ID
*/
@Schema(description = "关联的家长参与代理商活动关系ID")
private Integer relationId;
@Schema(description = "代理商ID")
private Integer agentId;
/**
* 活动ID
*/
@Schema(description = "活动ID")
private Integer activityId;
/**
* 家长ID
*/
@Schema(description = "家长ID")
private Integer parentId;
/**
* 孩子姓名
*/
@Schema(description = "孩子姓名")
private String childName;
/**
* 孩子性别(M-,F-)
*/
@Schema(description = "孩子性别")
private String childGender;
/**
* 出生年月
*/
@Schema(description = "出生年月")
private LocalDate childBirthDate;
/**
* 年级
*/
@Schema(description = "年级")
private String grade;
/**
* 学校
*/
@Schema(description = "学校")
private String school;
/**
* 地区
*/
@Schema(description = "地区")
private String region;
/**
* 家长身份(爸爸,妈妈)
*/
@Schema(description = "家长身份(爸爸,妈妈)")
private String parentIdentity;
/**
* 学习情况()
*/
@Schema(description = "学习情况(优、良、中、差)")
private String learningSituation;
/**
* 优势学科(数学英语等)
*/
@Schema(description = "偏科(数学、英语等)")
private String weakSubject;
@Schema(description = "创建时间")
private LocalDateTime createTime;
@Schema(description = "更新时间")
private LocalDateTime updateTime;
}

View File

@ -42,4 +42,8 @@ public class AdminParentAgentActivityResp {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
@Schema(description = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime updateTime;
}

View File

@ -0,0 +1,18 @@
package com.seer.teach.mp.admin.convert;
import com.seer.teach.mp.admin.controller.resp.AdminActivityInfoCollectionResp;
import com.seer.teach.mp.entity.MpActivityInfoCollectionEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface AdminActivityInfoCollectionConvert {
AdminActivityInfoCollectionConvert INSTANCE = Mappers.getMapper(AdminActivityInfoCollectionConvert.class);
AdminActivityInfoCollectionResp convertToResp(MpActivityInfoCollectionEntity entity);
List<AdminActivityInfoCollectionResp> convertToRespList(List<MpActivityInfoCollectionEntity> entity);
}

View File

@ -7,6 +7,7 @@ import org.mapstruct.factory.Mappers;
import java.util.List;
@org.mapstruct.Mapper
@Mapper
public interface AdminParentAgentActivityConvert {

View File

@ -0,0 +1,62 @@
package com.seer.teach.mp.admin.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.utils.PageConverterUtils;
import com.seer.teach.mp.admin.controller.req.ActivityInfoCollectionQueryReq;
import com.seer.teach.mp.admin.controller.resp.AdminActivityInfoCollectionResp;
import com.seer.teach.mp.admin.convert.AdminActivityInfoCollectionConvert;
import com.seer.teach.mp.entity.MpActivityInfoCollectionEntity;
import com.seer.teach.mp.service.IMpActivityInfoCollectionService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
@Service
@Slf4j
@RequiredArgsConstructor
public class AdminActivityInfoCollectionService {
private final IMpActivityInfoCollectionService mpActivityInfoCollectionService;
/**
* 分页查询活动信息收集记录
*
* @param req 查询参数
* @return 分页结果
*/
public PageListBean<AdminActivityInfoCollectionResp> pageList(ActivityInfoCollectionQueryReq req) {
Page<MpActivityInfoCollectionEntity> page = new Page<>(req.getPageNo(), req.getPageSize());
LambdaQueryWrapper<MpActivityInfoCollectionEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.like(Objects.nonNull(req.getChildName()) && !req.getChildName().isEmpty(), MpActivityInfoCollectionEntity::getChildName, req.getChildName())
.like(Objects.nonNull(req.getGrade()) && !req.getGrade().isEmpty(), MpActivityInfoCollectionEntity::getGrade, req.getGrade())
.like(Objects.nonNull(req.getSchool()) && !req.getSchool().isEmpty(), MpActivityInfoCollectionEntity::getSchool, req.getSchool())
.like(Objects.nonNull(req.getChildGender()) && !req.getChildGender().isEmpty(), MpActivityInfoCollectionEntity::getChildGender, req.getChildGender())
.orderByDesc(MpActivityInfoCollectionEntity::getCreateTime);
Page<MpActivityInfoCollectionEntity> result = mpActivityInfoCollectionService.page(page, wrapper);
return PageConverterUtils.convertPageListBean(result, AdminActivityInfoCollectionConvert.INSTANCE::convertToRespList);
}
/**
* 获取活动信息收集记录详情
* @param id 记录ID
* @return 详情
*/
public AdminActivityInfoCollectionResp getDetail(Integer id) {
MpActivityInfoCollectionEntity entity = mpActivityInfoCollectionService.getById(id);
return AdminActivityInfoCollectionConvert.INSTANCE.convertToResp(entity);
}
/**
* 删除活动信息收集记录
* @param ids 删除的ID列表
* @return 删除结果
*/
public boolean delete(List<Integer> ids) {
return mpActivityInfoCollectionService.removeByIds(ids);
}
}

View File

@ -4,11 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.seer.teach.common.PageListBean;
import com.seer.teach.common.ResultBean;
import com.seer.teach.common.utils.PageConverterUtils;
import com.seer.teach.mp.admin.controller.req.ParentAgentActivityQueryReq;
import com.seer.teach.mp.admin.controller.resp.AdminParentAgentActivityResp;
import com.seer.teach.mp.admin.controller.resp.MpParentAgentActivityResp;
import com.seer.teach.mp.admin.convert.AdminParentAgentActivityConvert;
import com.seer.teach.mp.entity.MpParentAgentActivityRelationEntity;
import com.seer.teach.mp.service.IMpParentAgentActivityRelationService;
@ -16,6 +14,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
@RequiredArgsConstructor
@ -32,7 +31,7 @@ public class AdminParentAgentActivityService {
LambdaQueryWrapper<MpParentAgentActivityRelationEntity> wrapper = new LambdaQueryWrapper<>();
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::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.getAgentName()) && !query.getAgentName().isEmpty(), MpParentAgentActivityRelationEntity::getAgentName, query.getAgentName())
.eq(Objects.nonNull(query.getStatus()), MpParentAgentActivityRelationEntity::getStatus, query.getStatus())
@ -47,4 +46,8 @@ public class AdminParentAgentActivityService {
MpParentAgentActivityRelationEntity entity = parentAgentActivityRelationService.getById(id);
return AdminParentAgentActivityConvert.INSTANCE.convertToResp(entity);
}
public boolean delete(List<Integer> ids) {
return parentAgentActivityRelationService.removeByIds(ids);
}
}

View File

@ -6,16 +6,18 @@ import com.seer.teach.common.PageListBean;
import com.seer.teach.common.enums.ResultCodeEnum;
import com.seer.teach.common.utils.AssertUtils;
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.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.convert.AdminAgentEmployeeRelationConvert;
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
import com.seer.teach.mp.entity.MpAgentEntity;
import com.seer.teach.mp.service.IMpAgentEmployeeRelationService;
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 org.springframework.stereotype.Service;
@ -38,6 +40,8 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
private final IMpAgentService mpAgentService;
private final UserInfoServiceApi userInfoServiceApi;
@Override
public PageListBean<AgentEmployeeRelationResp> pageList(AgentEmployeeRelationQueryReq query) {
Page<MpAgentEmployeeRelationEntity> pageParm = new Page<>(query.getPageNo(), query.getPageSize());
@ -76,9 +80,23 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
@Override
public boolean save(AgentEmployeeSaveReq request) {
AssertUtils.isNull(request.getAgentName(), ResultCodeEnum.AGENT_EMPLOYEE_ALREADY_EXISTS);
MpAgentEmployeeRelationEntity relation = AdminAgentEmployeeRelationConvert.INSTANCE.convert(request);
MpAgentEmployeeRelationEntity one = agentEmployeeRelationService.lambdaQuery()
.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();
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;
}
}

View File

@ -127,6 +127,7 @@ DROP TABLE IF EXISTS `mp_activity_info_collection`;
CREATE TABLE `mp_activity_info_collection` (
`id` int NOT NULL AUTO_INCREMENT COMMENT '信息收集ID',
`relation_id` int NOT NULL COMMENT '关联的家长参与代理商活动关系ID',
`agent_id` int NOT NULL COMMENT '代理商ID',
`activity_id` int NOT NULL COMMENT '活动ID',
`parent_id` int NOT NULL COMMENT '家长ID',
`child_name` varchar(100) COMMENT '孩子姓名',
@ -137,6 +138,8 @@ CREATE TABLE `mp_activity_info_collection` (
`region` varchar(255) COMMENT '地区',
`parent_identity` varchar(20) COMMENT '家长身份(爸爸,妈妈)',
`learning_situation` varchar(20) COMMENT '学习情况(优、良、中、差)',
`weak_subject_ids` varchar(50) COMMENT '薄弱科目',
`strong_subject_ids` varchar(50) COMMENT '优势科目',
`weak_subject` varchar(50) COMMENT '偏科(数学、英语等)',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',

View File

@ -170,4 +170,10 @@ public interface UserInfoServiceApi {
@GetMapping("/checkUserInfo")
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获取用户信息
*
* @param id 用户ID
* @return 用户信息DTO对象
*/
@ -100,6 +101,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/**
* 根据OpenId获取用户信息
*
* @param openId 微信OpenId
* @return 用户信息DTO对象
*/
@ -115,6 +117,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/**
* 获取用户权限信息
*
* @param userId 用户ID
* @return 用户权限DTO对象
*/
@ -130,6 +133,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/**
* 为用户添加经验值
*
* @param userId 用户ID
* @param experienceValue 要添加的经验值
*/
@ -145,6 +149,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/**
* 获取孩子信息
*
* @param userId 孩子用户ID
* @return 孩子信息DTO对象
*/
@ -168,6 +173,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/**
* 获取孩子年级ID
*
* @param userId 孩子用户ID
* @return 年级ID
*/
@ -179,6 +185,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/**
* 保存用户信息
*
* @param userInfoDTO 用户信息DTO对象
* @return 用户ID如果用户已存在则返回已存在的用户ID
*/
@ -233,6 +240,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/**
* 根据用户ID列表获取用户信息
*
* @param userIds
* @return
*/
@ -244,6 +252,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/**
* 根据用户ID获取用户信息
*
* @param userId
* @return
*/
@ -271,8 +280,31 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
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消息
*
* @param children 孩子用户实体对象
* @param userExtendEntity 用户扩展信息实体对象
* @param device 设备信息
@ -295,6 +327,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
/**
* 实际保存用户信息的私有方法
*
* @param userInfoDTO 用户信息DTO对象
* @return 保存后的用户ID
*/