From 42bd6576eb4f6d05bf518242a28b25626e43fc3a Mon Sep 17 00:00:00 2001 From: Wang Date: Tue, 30 Dec 2025 17:59:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=90=86=E5=95=86?= =?UTF-8?q?=EF=BC=8C=E6=B4=BB=E5=8A=A8=EF=BC=8C=E4=BB=A3=E7=90=86=E5=95=86?= =?UTF-8?q?=E5=91=98=E5=B7=A5=E5=85=B3=EF=BC=8C=E4=BB=A3=E7=90=86=E5=95=86?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E5=8F=82=E4=B8=8E=E8=80=85=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teach/common/enums/ResultCodeEnum.java | 3 +- .../MpAgentActivityParticipantEntity.java | 6 -- seer-mp/seer-mp-service-app/pom.xml | 17 ++++ .../AppAgentActivityController.java | 27 ++++--- .../AppAgentActivityParentInfoController.java | 49 ++++++++++++ ...AppAgentActivityParticipantController.java | 22 +++--- .../mp/app/controller/AppAgentController.java | 44 +++++++++++ .../AppParentAgentActivityController.java | 3 +- .../req/AppMpSignUpActivityReq.java | 7 +- .../resp/AgentActivityParentInfoResp.java | 59 ++++++++++++++ .../resp/AgentActivityParticipantResp.java | 6 +- ...ActivityResp.java => AppActivityResp.java} | 4 +- .../app/controller/resp/AppMpAgentResp.java | 30 ++++++++ .../app/convert/AppAgentActivityConvert.java | 6 +- .../teach/mp/app/convert/AppAgentConvert.java | 19 +++++ .../AppMpActivityInfoCollectionConvert.java | 3 +- ...yService.java => IAppActivityService.java} | 8 +- .../IAppAgentActivityParentInfoService.java | 26 +++++++ .../IAppAgentActivityParticipantService.java | 6 +- .../mp/app/service/IAppAgentService.java | 25 ++++++ ...eImpl.java => AppActivityServiceImpl.java} | 10 +-- ...AppAgentActivityParentInfoServiceImpl.java | 77 +++++++++++++++++++ ...ppAgentActivityParticipantServiceImpl.java | 43 +++++++---- .../app/service/impl/AppAgentServiceImpl.java | 44 +++++++++++ .../IMpAgentActivityParticipantService.java | 10 +++ .../IMpAgentEmployeeRelationService.java | 8 ++ .../teach/mp/service/IMpAgentService.java | 22 ++++++ ...MpAgentActivityParticipantServiceImpl.java | 12 +-- .../MpAgentEmployeeRelationServiceImpl.java | 34 +++----- .../mp/service/impl/MpAgentServiceImpl.java | 14 ++++ 30 files changed, 545 insertions(+), 99 deletions(-) create mode 100644 seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityParentInfoController.java create mode 100644 seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentController.java create mode 100644 seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AgentActivityParentInfoResp.java rename seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/{AppAgentActivityResp.java => AppActivityResp.java} (86%) create mode 100644 seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppMpAgentResp.java create mode 100644 seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppAgentConvert.java rename seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/{IAppAgentActivityService.java => IAppActivityService.java} (68%) create mode 100644 seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityParentInfoService.java create mode 100644 seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentService.java rename seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/{AppAgentActivityServiceImpl.java => AppActivityServiceImpl.java} (84%) create mode 100644 seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityParentInfoServiceImpl.java create mode 100644 seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentServiceImpl.java diff --git a/seer-common/common-enums/src/main/java/com/seer/teach/common/enums/ResultCodeEnum.java b/seer-common/common-enums/src/main/java/com/seer/teach/common/enums/ResultCodeEnum.java index aaedb35..ff2e9cf 100644 --- a/seer-common/common-enums/src/main/java/com/seer/teach/common/enums/ResultCodeEnum.java +++ b/seer-common/common-enums/src/main/java/com/seer/teach/common/enums/ResultCodeEnum.java @@ -327,8 +327,9 @@ public enum ResultCodeEnum { INVALID_ACTIVITY(13003, "活动不存在或已失效"), INVALID_AGENT(13004, "代理商不存在或已失效"), AGENT_STATUS_INVALID(13005, "代理商状态无效"), - AGENT_NON_PARTICIPANT_ACTIVE(130061, "代理商没有参与该活动"), + AGENT_EMPLOYEE_ALREADY_EXISTS(130051, "代理商员工已存在"), AGENT_CONTACT_INFO_INVALID(13006, "联系信息无效"), + AGENT_NON_PARTICIPANT_ACTIVE(130061, "代理商没有参与该活动"), ACTIVITY_NOT_FOUND(13007, "活动不存在"), ACTIVITY_ALREADY_EXISTS(13008, "活动已存在"), ACTIVITY_NOT_ACTIVE(13009, "活动未开始或已结束"), diff --git a/seer-mp/seer-mp-data-module/src/main/java/com/seer/teach/mp/entity/MpAgentActivityParticipantEntity.java b/seer-mp/seer-mp-data-module/src/main/java/com/seer/teach/mp/entity/MpAgentActivityParticipantEntity.java index a34abd7..821d79d 100644 --- a/seer-mp/seer-mp-data-module/src/main/java/com/seer/teach/mp/entity/MpAgentActivityParticipantEntity.java +++ b/seer-mp/seer-mp-data-module/src/main/java/com/seer/teach/mp/entity/MpAgentActivityParticipantEntity.java @@ -32,10 +32,4 @@ public class MpAgentActivityParticipantEntity extends BaseEntity { */ @TableField("agent_id") private Integer agentId; - - /** - * 家长ID(对应user表的ID) - */ - @TableField("parent_id") - private Integer parentId; } \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/pom.xml b/seer-mp/seer-mp-service-app/pom.xml index 349aab7..31a2b7f 100644 --- a/seer-mp/seer-mp-service-app/pom.xml +++ b/seer-mp/seer-mp-service-app/pom.xml @@ -29,6 +29,23 @@ org.springdoc springdoc-openapi-starter-webmvc-ui + + + org.mapstruct + mapstruct + + + + org.mapstruct + mapstruct-processor + provided + + + + org.projectlombok + lombok-mapstruct-binding + provided + \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityController.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityController.java index e417baf..47db2c6 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityController.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityController.java @@ -8,12 +8,15 @@ import com.seer.teach.common.annotation.DecryptionAnnotation; import com.seer.teach.common.annotation.EncryptionAnnotation; import com.seer.teach.common.annotation.LogPrint; import com.seer.teach.mp.app.controller.req.AppAgentActivityQueryReq; -import com.seer.teach.mp.app.controller.resp.AppAgentActivityResp; -import com.seer.teach.mp.app.service.IAppAgentActivityService; -import io.swagger.v3.oas.annotations.tags.Tag; +import com.seer.teach.mp.app.controller.resp.AppActivityResp; +import com.seer.teach.mp.app.service.IAppActivityService; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; /** *

@@ -23,29 +26,29 @@ import org.springframework.web.bind.annotation.*; * @author Lingma * @since 2025-12-29 */ -@Tag(name = "APP - 代理商活动") +@Tag(name = "APP - 活动列表") @RestController -@RequestMapping("/app/agent/activity") +@RequestMapping("/app/activity") @LogPrint @EncryptionAnnotation @DecryptionAnnotation @RequiredArgsConstructor public class AppAgentActivityController { - private final IAppAgentActivityService agentActivityService; + private final IAppActivityService agentActivityService; - @Operation(summary = "代理商活动列表") + @Operation(summary = "活动列表") @GetMapping("/page-list") @SaCheckPermission("mp:app:agent:activity:list") - public ResultBean> pageList(AppAgentActivityQueryReq query) { - Integer agentId = StpUtil.getLoginIdAsInt(); - return ResultBean.success(agentActivityService.pageList(query,agentId)); + public ResultBean> pageList(AppAgentActivityQueryReq query) { + Integer userId = StpUtil.getLoginIdAsInt(); + return ResultBean.success(agentActivityService.pageList(query,userId)); } @Operation(summary = "查看活动详情") @GetMapping("/{id}") @SaCheckPermission("mp:app:agent:activity:detail") - public ResultBean getDetail(@PathVariable Integer id) { + public ResultBean getDetail(@PathVariable Integer id) { return ResultBean.success(agentActivityService.getById(id)); } } \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityParentInfoController.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityParentInfoController.java new file mode 100644 index 0000000..bcd4568 --- /dev/null +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityParentInfoController.java @@ -0,0 +1,49 @@ +package com.seer.teach.mp.app.controller; + +import cn.dev33.satoken.annotation.SaCheckLogin; +import cn.dev33.satoken.stp.StpUtil; +import com.seer.teach.common.ResultBean; +import com.seer.teach.common.annotation.DecryptionAnnotation; +import com.seer.teach.common.annotation.EncryptionAnnotation; +import com.seer.teach.common.annotation.LogPrint; +import com.seer.teach.mp.app.controller.resp.AgentActivityParentInfoResp; +import com.seer.teach.mp.app.service.IAppAgentActivityParentInfoService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + *

+ * 代理商活动参与家长信息App控制器 + *

+ * + * @author Lingma + * @since 2025-12-30 + */ +@Tag(name = "APP - 代理商活动参与家长信息") +@RestController +@RequestMapping("/app/agent/activity/parent-info") +@LogPrint +@EncryptionAnnotation +@DecryptionAnnotation +@RequiredArgsConstructor +public class AppAgentActivityParentInfoController { + + private final IAppAgentActivityParentInfoService agentActivityParentInfoService; + + @Operation(summary = "获取参加指定活动的家长列表") + @GetMapping("/getActivityParents") + @SaCheckLogin + public ResultBean> getActivityParents( + @RequestParam("activityId") Integer activityId, + @RequestParam("agentId") Integer agentId) { + Integer userId = StpUtil.getLoginIdAsInt(); + return ResultBean.success(agentActivityParentInfoService.getParentsByActivityAndAgent(activityId, agentId,userId)); + } +} \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityParticipantController.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityParticipantController.java index 5d4c472..87400e6 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityParticipantController.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentActivityParticipantController.java @@ -7,11 +7,14 @@ import com.seer.teach.common.annotation.DecryptionAnnotation; import com.seer.teach.common.annotation.EncryptionAnnotation; import com.seer.teach.common.annotation.LogPrint; import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp; -import com.seer.teach.user.api.dto.UserInfoDTO; -import io.swagger.v3.oas.annotations.tags.Tag; +import com.seer.teach.mp.app.service.IAppAgentActivityParticipantService; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -32,14 +35,13 @@ import java.util.List; @RequiredArgsConstructor public class AppAgentActivityParticipantController { - private final com.seer.teach.mp.app.service.IAppAgentActivityParticipantService agentActivityParticipantService; + private final IAppAgentActivityParticipantService agentActivityParticipantService; - - @Operation(summary = "获取代理商参与的活动中的家长列表") - @GetMapping("/parents-by-agent") + @Operation(summary = "获取代理商参加的活动列表") + @GetMapping() @SaCheckPermission("mp:app:agent:participant:parents") - public ResultBean> getParentsByAgentAndActivity( - @RequestParam("activityId") Integer activityId,@RequestParam("agentId") Integer agentId) { - return ResultBean.success(agentActivityParticipantService.getParticipantsByActivityAndAgent(activityId, agentId)); + public ResultBean> getParentsByAgentAndActivity(@RequestParam("agentId") Integer agentId) { + Integer userId = StpUtil.getLoginIdAsInt(); + return ResultBean.success(agentActivityParticipantService.getParticipantsByActivityAndAgent(agentId,userId)); } } \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentController.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentController.java new file mode 100644 index 0000000..2df2e42 --- /dev/null +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppAgentController.java @@ -0,0 +1,44 @@ +package com.seer.teach.mp.app.controller; + +import cn.dev33.satoken.stp.StpUtil; +import com.seer.teach.common.ResultBean; +import com.seer.teach.common.annotation.DecryptionAnnotation; +import com.seer.teach.common.annotation.EncryptionAnnotation; +import com.seer.teach.common.annotation.LogPrint; +import com.seer.teach.mp.app.controller.resp.AppMpAgentResp; +import com.seer.teach.mp.app.service.IAppActivityService; +import com.seer.teach.mp.app.service.IAppAgentService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 代理商App控制器 + *

+ * + * @author Lingma + * @since 2025-12-29 + */ +@Tag(name = "APP - 代理商管理接口") +@RestController +@RequestMapping("/app/agent") +@LogPrint +@EncryptionAnnotation +@DecryptionAnnotation +@RequiredArgsConstructor +public class AppAgentController { + + private final IAppActivityService agentActivityService; + private final IAppAgentService appAgentService; + + @Operation(summary = "获取代理商详情") + @GetMapping("/detail") + public ResultBean getAgent() { + Integer userId = StpUtil.getLoginIdAsInt(); + return ResultBean.success(appAgentService.getAgentRespByUserId(userId)); + } +} \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppParentAgentActivityController.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppParentAgentActivityController.java index 0eabe28..35b1837 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppParentAgentActivityController.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/AppParentAgentActivityController.java @@ -3,9 +3,9 @@ package com.seer.teach.mp.app.controller; import cn.dev33.satoken.annotation.SaCheckLogin; import cn.dev33.satoken.stp.StpUtil; import com.seer.teach.common.ResultBean; +import com.seer.teach.mp.app.controller.req.AppMpSignUpActivityReq; import com.seer.teach.mp.app.controller.resp.AppMpSignUpActivityResp; import com.seer.teach.mp.app.service.AppParentAgentActivityService; -import com.seer.teach.mp.app.controller.req.AppMpSignUpActivityReq; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.AllArgsConstructor; @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/req/AppMpSignUpActivityReq.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/req/AppMpSignUpActivityReq.java index f9065a2..907729d 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/req/AppMpSignUpActivityReq.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/req/AppMpSignUpActivityReq.java @@ -17,17 +17,20 @@ public class AppMpSignUpActivityReq { @Schema(description = "代理商ID") private Integer agentId; + @Schema(description = "手机号码") + private String mobile; + @Schema(description = "孩子姓名") private String childName; @Schema(description = "孩子性别") - private String childGender; + private Integer childGender; @Schema(description = "孩子出生日期") private LocalDate childBirthDate; @Schema(description = "年级") - private String grade; + private Integer grade; @Schema(description = "学校") private String school; diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AgentActivityParentInfoResp.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AgentActivityParentInfoResp.java new file mode 100644 index 0000000..7611267 --- /dev/null +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AgentActivityParentInfoResp.java @@ -0,0 +1,59 @@ +package com.seer.teach.mp.app.controller.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDate; +import java.util.List; + +@Schema(name = "AgentActivityParentInfoResp", description = "代理商活动参与家长信息Resp") +@Data +public class AgentActivityParentInfoResp { + + @Schema(description = "信息收集记录ID") + private Integer id; + + @Schema(description = "关联的家长参与代理商活动关系ID") + private Integer relationId; + + @Schema(description = "活动ID") + private Integer activityId; + + @Schema(description = "代理商ID") + private Integer agentId; + + @Schema(description = "家长ID") + private Integer parentId; + + @Schema(description = "孩子姓名") + private String childName; + + @Schema(description = "孩子性别(M-男,F-女)") + 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 = "优势学科ID列表") + private List strongSubjectIds; + + @Schema(description = "劣势学科ID列表") + private List weakSubjectIds; + + +} \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AgentActivityParticipantResp.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AgentActivityParticipantResp.java index 181d1a4..2c50ec5 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AgentActivityParticipantResp.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AgentActivityParticipantResp.java @@ -15,9 +15,7 @@ public class AgentActivityParticipantResp { @Schema(description = "代理商ID") private Integer agentId; - @Schema(description = "家长ID") - private Integer parentId; + private String activityName; + - @Schema(description = "家长手机号") - private String parentMobile; } \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppAgentActivityResp.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppActivityResp.java similarity index 86% rename from seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppAgentActivityResp.java rename to seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppActivityResp.java index 2389372..9be7d43 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppAgentActivityResp.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppActivityResp.java @@ -5,9 +5,9 @@ import lombok.Data; import java.time.LocalDateTime; -@Schema(name = "AppAgentActivityResp", description = "代理商活动响应参数") +@Schema(name = "AppActivityResp", description = "活动响应参数") @Data -public class AppAgentActivityResp { +public class AppActivityResp { private Integer id; diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppMpAgentResp.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppMpAgentResp.java new file mode 100644 index 0000000..e78b77d --- /dev/null +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/controller/resp/AppMpAgentResp.java @@ -0,0 +1,30 @@ +package com.seer.teach.mp.app.controller.resp; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "App端代理商响应对象") +public class AppMpAgentResp { + + @Schema(description = "代理商ID") + private Integer agentId; + + @Schema(description = "代理商名称") + private String agentName; + + @Schema(description = "代理商编码") + private String agentCode; + + @Schema(description = "代理商等级") + private String agentLevel; + + @Schema(description = "联系人姓名") + private String contactName; + + @Schema(description = "联系电话") + private String contactPhone; + + @Schema(description = "代理商地址") + private String address; +} diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppAgentActivityConvert.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppAgentActivityConvert.java index aa50833..9358763 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppAgentActivityConvert.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppAgentActivityConvert.java @@ -1,7 +1,7 @@ package com.seer.teach.mp.app.convert; import com.seer.teach.mp.app.controller.req.AppAgentActivityQueryReq; -import com.seer.teach.mp.app.controller.resp.AppAgentActivityResp; +import com.seer.teach.mp.app.controller.resp.AppActivityResp; import com.seer.teach.mp.entity.MpActivityEntity; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @@ -18,7 +18,7 @@ public interface AppAgentActivityConvert { @Mapping(target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss") @Mapping(target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss") - AppAgentActivityResp convertToResp(MpActivityEntity entity); + AppActivityResp convertToResp(MpActivityEntity entity); - List convertToRespList(List mpAgentActivityEntities); + List convertToRespList(List mpAgentActivityEntities); } \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppAgentConvert.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppAgentConvert.java new file mode 100644 index 0000000..8b967ef --- /dev/null +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppAgentConvert.java @@ -0,0 +1,19 @@ +package com.seer.teach.mp.app.convert; + +import com.seer.teach.mp.app.controller.resp.AppMpAgentResp; +import com.seer.teach.mp.entity.MpAgentEntity; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +/** + * 代理商实体转换器 + */ +@Mapper +public interface AppAgentConvert { + + AppAgentConvert INSTANCE = Mappers.getMapper(AppAgentConvert.class); + + @Mapping(source = "id", target = "agentId") + AppMpAgentResp entityToResp(MpAgentEntity entity); +} \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppMpActivityInfoCollectionConvert.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppMpActivityInfoCollectionConvert.java index 228987a..36c2cf3 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppMpActivityInfoCollectionConvert.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/convert/AppMpActivityInfoCollectionConvert.java @@ -13,6 +13,5 @@ public interface AppMpActivityInfoCollectionConvert { AppMpSignUpActivityResp convert2Resp(MpActivityInfoCollectionEntity entity); - MpActivityInfoCollectionEntity convert2Entity(AppMpSignUpActivityReq request); -} +} \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityService.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppActivityService.java similarity index 68% rename from seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityService.java rename to seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppActivityService.java index 82aaa9e..89f6753 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityService.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppActivityService.java @@ -1,7 +1,7 @@ package com.seer.teach.mp.app.service; import com.seer.teach.common.PageListBean; -import com.seer.teach.mp.app.controller.resp.AppAgentActivityResp; +import com.seer.teach.mp.app.controller.resp.AppActivityResp; import com.seer.teach.mp.app.controller.req.AppAgentActivityQueryReq; /** @@ -12,7 +12,7 @@ import com.seer.teach.mp.app.controller.req.AppAgentActivityQueryReq; * @author Lingma * @since 2025-12-30 */ -public interface IAppAgentActivityService { +public interface IAppActivityService { /** * 分页查询代理商活动列表 @@ -21,7 +21,7 @@ public interface IAppAgentActivityService { * @param agentId 代理商ID * @return 代理商活动分页列表 */ - PageListBean pageList(AppAgentActivityQueryReq query,Integer agentId); + PageListBean pageList(AppAgentActivityQueryReq query, Integer agentId); /** * 根据ID获取活动详情 @@ -29,5 +29,5 @@ public interface IAppAgentActivityService { * @param id 活动ID * @return 活动详情 */ - AppAgentActivityResp getById(Integer id); + AppActivityResp getById(Integer id); } \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityParentInfoService.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityParentInfoService.java new file mode 100644 index 0000000..38829b6 --- /dev/null +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityParentInfoService.java @@ -0,0 +1,26 @@ +package com.seer.teach.mp.app.service; + +import com.seer.teach.mp.app.controller.resp.AgentActivityParentInfoResp; + +import java.util.List; + +/** + *

+ * 代理商活动参与家长信息服务类 + *

+ * + * @author Lingma + * @since 2025-12-30 + */ +public interface IAppAgentActivityParentInfoService { + + /** + * 根据活动ID获取参与的家长信息列表 + * + * @param activityId 活动ID + * @param agentId 代理商ID + * @param userId 用户ID + * @return 参与活动的家长信息列表 + */ + List getParentsByActivityAndAgent(Integer activityId, Integer agentId,Integer userId); +} \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityParticipantService.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityParticipantService.java index a24788c..7e3a46f 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityParticipantService.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentActivityParticipantService.java @@ -17,10 +17,10 @@ public interface IAppAgentActivityParticipantService { /** * 根据活动ID和代理商ID获取参与记录 * - * @param activityId 活动ID - * @param agentId 代理商ID + * @param agentId 代理商ID + * @param userId 用户Id * @return 参与记录列表 */ - List getParticipantsByActivityAndAgent(Integer activityId, Integer agentId); + List getParticipantsByActivityAndAgent(Integer agentId,Integer userId); } \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentService.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentService.java new file mode 100644 index 0000000..7f868dd --- /dev/null +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/IAppAgentService.java @@ -0,0 +1,25 @@ +package com.seer.teach.mp.app.service; + +import com.seer.teach.mp.app.controller.resp.AppMpAgentResp; + +/** + * App端代理商服务接口 + */ +public interface IAppAgentService { + + /** + * 根据用户ID获取代理商响应对象 + * + * @param userId 用户ID + * @return 代理商响应对象 + */ + AppMpAgentResp getAgentRespByUserId(Integer userId); + + /** + * 根据用户ID获取代理商ID + * + * @param userId 用户ID + * @return 代理商ID + */ + Integer getAgentIdByUserId(Integer userId); +} \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityServiceImpl.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppActivityServiceImpl.java similarity index 84% rename from seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityServiceImpl.java rename to seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppActivityServiceImpl.java index bfb14db..e238fff 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityServiceImpl.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppActivityServiceImpl.java @@ -7,9 +7,9 @@ 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.app.controller.req.AppAgentActivityQueryReq; -import com.seer.teach.mp.app.controller.resp.AppAgentActivityResp; +import com.seer.teach.mp.app.controller.resp.AppActivityResp; import com.seer.teach.mp.app.convert.AppAgentActivityConvert; -import com.seer.teach.mp.app.service.IAppAgentActivityService; +import com.seer.teach.mp.app.service.IAppActivityService; import com.seer.teach.mp.entity.MpActivityEntity; import com.seer.teach.mp.service.IMpActivityService; import lombok.RequiredArgsConstructor; @@ -30,12 +30,12 @@ import java.util.Objects; @Slf4j @Service @RequiredArgsConstructor -public class AppAgentActivityServiceImpl implements IAppAgentActivityService { +public class AppActivityServiceImpl implements IAppActivityService { private final IMpActivityService activityService; @Override - public PageListBean pageList(AppAgentActivityQueryReq query,Integer agentId) { + public PageListBean pageList(AppAgentActivityQueryReq query, Integer agentId) { log.info("查询参数:{}", query); IPage page = new Page<>(query.getPageNo(), query.getPageSize()); var pageResult = activityService.page(page, new LambdaQueryWrapper<>(MpActivityEntity.class) @@ -49,7 +49,7 @@ public class AppAgentActivityServiceImpl implements IAppAgentActivityService { } @Override - public AppAgentActivityResp getById(Integer id) { + public AppActivityResp getById(Integer id) { MpActivityEntity entity = activityService.getById(id); return AppAgentActivityConvert.INSTANCE.convertToResp(entity); } diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityParentInfoServiceImpl.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityParentInfoServiceImpl.java new file mode 100644 index 0000000..363cf4d --- /dev/null +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityParentInfoServiceImpl.java @@ -0,0 +1,77 @@ +package com.seer.teach.mp.app.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.seer.teach.common.enums.ResultCodeEnum; +import com.seer.teach.common.exception.CommonException; +import com.seer.teach.mp.app.controller.resp.AgentActivityParentInfoResp; +import com.seer.teach.mp.app.service.IAppAgentActivityParentInfoService; +import com.seer.teach.mp.app.service.IAppAgentService; +import com.seer.teach.mp.entity.MpActivityInfoCollectionEntity; +import com.seer.teach.mp.service.IMpActivityInfoCollectionService; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

+ * 代理商活动参与家长信息服务实现类 + *

+ * + * @author Lingma + * @since 2025-12-30 + */ +@Slf4j +@Service +@AllArgsConstructor +public class AppAgentActivityParentInfoServiceImpl implements IAppAgentActivityParentInfoService { + + private final IMpActivityInfoCollectionService activityInfoCollectionService; + private final IAppAgentService appAgentService; + + @Override + public List getParentsByActivityAndAgent(Integer activityId, Integer agentId,Integer userId) { + var userAgentId = appAgentService.getAgentIdByUserId(userId); + if (Objects.isNull(userAgentId)) { + return List.of(); + } + log.info("userAgentId:{}", userAgentId); + if(userAgentId.intValue() != agentId){ + throw new CommonException(ResultCodeEnum.RELATION_NOT_FOUND); + } + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(MpActivityInfoCollectionEntity::getActivityId, activityId) + .eq(MpActivityInfoCollectionEntity::getAgentId, agentId); + + // 查询所有符合条件的记录 + List entities = activityInfoCollectionService.list(queryWrapper); + + // 转换为响应对象列表 + return entities.stream() + .map(this::convertToResp) + .collect(Collectors.toList()); + } + + private AgentActivityParentInfoResp convertToResp(MpActivityInfoCollectionEntity entity) { + AgentActivityParentInfoResp resp = new AgentActivityParentInfoResp(); + resp.setId(entity.getId()); + resp.setRelationId(entity.getRelationId()); + resp.setActivityId(entity.getActivityId()); + resp.setAgentId(entity.getAgentId()); + resp.setParentId(entity.getParentId()); + resp.setChildName(entity.getChildName()); + resp.setChildGender(entity.getChildGender()); + resp.setChildBirthDate(entity.getChildBirthDate()); + resp.setGrade(entity.getGrade()); + resp.setSchool(entity.getSchool()); + resp.setRegion(entity.getRegion()); + resp.setParentIdentity(entity.getParentIdentity()); + resp.setLearningSituation(entity.getLearningSituation()); + resp.setStrongSubjectIds(entity.getStrongSubjectIds()); + resp.setWeakSubjectIds(entity.getWeakSubjectIds()); + return resp; + } +} \ No newline at end of file diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityParticipantServiceImpl.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityParticipantServiceImpl.java index f84fd72..540773e 100644 --- a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityParticipantServiceImpl.java +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentActivityParticipantServiceImpl.java @@ -1,13 +1,18 @@ package com.seer.teach.mp.app.service.impl; import cn.hutool.core.collection.CollectionUtil; +import com.seer.teach.common.enums.ResultCodeEnum; +import com.seer.teach.common.exception.CommonException; import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp; import com.seer.teach.mp.app.service.IAppAgentActivityParticipantService; +import com.seer.teach.mp.app.service.IAppAgentService; +import com.seer.teach.mp.entity.MpActivityEntity; import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity; +import com.seer.teach.mp.service.IMpActivityService; import com.seer.teach.mp.service.IMpAgentActivityParticipantService; import com.seer.teach.user.api.UserInfoServiceApi; -import com.seer.teach.user.api.dto.UserInfoDTO; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import java.util.List; @@ -24,6 +29,7 @@ import java.util.stream.Collectors; * @author Lingma * @since 2025-12-30 */ +@Slf4j @Service @RequiredArgsConstructor public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivityParticipantService { @@ -32,36 +38,45 @@ public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivity private final UserInfoServiceApi userInfoServiceApi; + private final IAppAgentService appAgentService; + + private final IMpActivityService mpActivityService; + @Override - public List getParticipantsByActivityAndAgent(Integer activityId, Integer agentId) { - var participants = agentActivityParticipantService.getParticipantsByActivityAndAgent(activityId, agentId); + public List getParticipantsByActivityAndAgent(Integer agentId, Integer userId) { + var userAgentId = appAgentService.getAgentIdByUserId(userId); + if (Objects.isNull(userAgentId)) { + return List.of(); + } + log.info("userAgentId:{}", userAgentId); + if(userAgentId.intValue() != agentId){ + throw new CommonException(ResultCodeEnum.RELATION_NOT_FOUND); + } + var participants = agentActivityParticipantService.getListByAgentId(agentId); if (CollectionUtil.isEmpty(participants)) { return List.of(); } - // 提取家长ID - Set parentIds = participants.stream().map(MpAgentActivityParticipantEntity::getParentId).collect(Collectors.toSet()); + Set activityIds = participants.stream().map(MpAgentActivityParticipantEntity::getActivityId).collect(Collectors.toSet()); - List parentInfos = userInfoServiceApi.getListByUserIds(parentIds); + List parentInfos = mpActivityService.listByIds(activityIds); - var parentInfoMap = parentInfos.stream().collect(Collectors.toMap(UserInfoDTO::getId, parentInfo -> parentInfo)); + var activityInfoMap = parentInfos.stream().collect(Collectors.toMap(MpActivityEntity::getId, activity -> activity)); return participants.stream() - .map(entity -> convertToDto(entity, parentInfoMap)) + .map(entity -> convertToDto(entity, activityInfoMap)) .collect(Collectors.toList()); } - - private AgentActivityParticipantResp convertToDto(MpAgentActivityParticipantEntity entity, Map parentInfoMap) { + private AgentActivityParticipantResp convertToDto(MpAgentActivityParticipantEntity entity, Map activityInfoMap) { AgentActivityParticipantResp resp = new AgentActivityParticipantResp(); resp.setId(entity.getId()); resp.setActivityId(entity.getActivityId()); resp.setAgentId(entity.getAgentId()); - resp.setParentId(entity.getParentId()); - UserInfoDTO userInfoDTO = parentInfoMap.get(entity.getParentId()); - if(Objects.nonNull(userInfoDTO)){ - resp.setParentMobile(userInfoDTO.getMobile()); + MpActivityEntity activity = activityInfoMap.get(entity.getActivityId()); + if(Objects.nonNull(activity)){ + resp.setActivityName(activity.getActivityName()); } return resp; } diff --git a/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentServiceImpl.java b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentServiceImpl.java new file mode 100644 index 0000000..cc0e587 --- /dev/null +++ b/seer-mp/seer-mp-service-app/src/main/java/com/seer/teach/mp/app/service/impl/AppAgentServiceImpl.java @@ -0,0 +1,44 @@ +package com.seer.teach.mp.app.service.impl; + +import com.seer.teach.mp.app.controller.resp.AppMpAgentResp; +import com.seer.teach.mp.app.service.IAppAgentService; +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 lombok.RequiredArgsConstructor; +import com.seer.teach.mp.app.convert.AppAgentConvert; +import org.springframework.stereotype.Service; + +/** + * App端代理商服务实现类 + */ +@Service +@RequiredArgsConstructor +public class AppAgentServiceImpl implements IAppAgentService { + + private final IMpAgentService mpAgentService; + private final IMpAgentEmployeeRelationService mpAgentEmployeeRelationService; + + @Override + public AppMpAgentResp getAgentRespByUserId(Integer userId) { + MpAgentEmployeeRelationEntity mpAgentEmployeeRelationEntity = mpAgentEmployeeRelationService.getOneByUserId(userId); + if (mpAgentEmployeeRelationEntity == null) { + return null; + } + MpAgentEntity agentEntity = mpAgentService.getAgentById(mpAgentEmployeeRelationEntity.getAgentId()); + if (agentEntity == null) { + return null; + } + return AppAgentConvert.INSTANCE.entityToResp(agentEntity); + } + + @Override + public Integer getAgentIdByUserId(Integer userId) { + MpAgentEmployeeRelationEntity mpAgentEmployeeRelationEntity = mpAgentEmployeeRelationService.getOneByUserId(userId); + if (mpAgentEmployeeRelationEntity == null) { + return null; + } + return mpAgentEmployeeRelationEntity.getAgentId(); + } +} \ No newline at end of file diff --git a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentActivityParticipantService.java b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentActivityParticipantService.java index 4fddc20..9bba32e 100644 --- a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentActivityParticipantService.java +++ b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentActivityParticipantService.java @@ -3,6 +3,8 @@ package com.seer.teach.mp.service; import com.baomidou.mybatisplus.extension.service.IService; import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity; +import java.util.List; + /** *

* 代理商活动参与记录表 服务类 @@ -21,4 +23,12 @@ public interface IMpAgentActivityParticipantService extends IService getListByAgentId(Integer agentId); } \ No newline at end of file diff --git a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentEmployeeRelationService.java b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentEmployeeRelationService.java index b75e157..fd7a546 100644 --- a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentEmployeeRelationService.java +++ b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/IMpAgentEmployeeRelationService.java @@ -55,4 +55,12 @@ public interface IMpAgentEmployeeRelationService extends IService { + /** + * 根据ID获取代理商信息 + * + * @param id 代理商ID + * @return 代理商实体 + */ + MpAgentEntity getAgentById(Integer id); + /** + * 保存代理商 + * + * @param agentEntity 代理商实体 + * @return 是否成功 + */ + Boolean saveAgent(MpAgentEntity agentEntity); + + /** + * 更新代理商 + * + * @param agentEntity 代理商实体 + * @return 是否成功 + */ + Boolean updateAgent(MpAgentEntity agentEntity); } \ No newline at end of file diff --git a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentActivityParticipantServiceImpl.java b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentActivityParticipantServiceImpl.java index ae0b59a..280c5fb 100644 --- a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentActivityParticipantServiceImpl.java +++ b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentActivityParticipantServiceImpl.java @@ -1,13 +1,8 @@ package com.seer.teach.mp.service.impl; -import cn.hutool.json.JSONUtil; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.seer.teach.common.utils.AssertUtils; import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity; -import com.seer.teach.mp.exception.AgentActivityErrorCodeEnum; import com.seer.teach.mp.mapper.MpAgentActivityParticipantMapper; import com.seer.teach.mp.service.IMpAgentActivityLogService; import com.seer.teach.mp.service.IMpAgentActivityParticipantService; @@ -15,7 +10,6 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import java.time.LocalDateTime; import java.util.List; /** @@ -42,4 +36,10 @@ public class MpAgentActivityParticipantServiceImpl extends ServiceImpl getListByAgentId(Integer agentId) { + return super.list(new LambdaQueryWrapper() + .eq(MpAgentActivityParticipantEntity::getAgentId, agentId)); + } } \ No newline at end of file diff --git a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentEmployeeRelationServiceImpl.java b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentEmployeeRelationServiceImpl.java index 96bdeac..3d24be3 100644 --- a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentEmployeeRelationServiceImpl.java +++ b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentEmployeeRelationServiceImpl.java @@ -4,6 +4,8 @@ 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.seer.teach.common.enums.ResultCodeEnum; +import com.seer.teach.common.exception.CommonException; import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity; import com.seer.teach.mp.mapper.MpAgentEmployeeRelationMapper; import com.seer.teach.mp.service.IMpAgentEmployeeRelationService; @@ -50,29 +52,20 @@ public class MpAgentEmployeeRelationServiceImpl extends ServiceImpl checkWrapper = + LambdaQueryWrapper checkWrapper = new LambdaQueryWrapper() .eq(MpAgentEmployeeRelationEntity::getAgentId, entity.getAgentId()) .eq(MpAgentEmployeeRelationEntity::getEmployeeUserId, entity.getEmployeeUserId()); - long count = this.count(checkWrapper); + long count = super.count(checkWrapper); if (count > 0) { - throw new com.seer.teach.mp.exception.AgentActivityException( - com.seer.teach.mp.exception.AgentActivityErrorCodeEnum.PARTICIPATION_FAILED, - "员工已关联到代理商" - ); + throw new CommonException(ResultCodeEnum.AGENT_EMPLOYEE_ALREADY_EXISTS); } - - // 新增时设置创建时间 entity.setCreateTime(LocalDateTime.now()); } entity.setUpdateTime(LocalDateTime.now()); - return this.saveOrUpdate(entity); + return super.saveOrUpdate(entity); } @Override @@ -87,7 +80,7 @@ public class MpAgentEmployeeRelationServiceImpl extends ServiceImpl 0; + return super.count(queryWrapper) > 0; } - /** - * 验证关联数据 - */ - private void validateRelation(MpAgentEmployeeRelationEntity entity) { - com.seer.teach.common.utils.AssertUtils.notNull(entity.getAgentId(), - com.seer.teach.mp.exception.AgentActivityErrorCodeEnum.INVALID_AGENT, "代理商ID不能为空"); - com.seer.teach.common.utils.AssertUtils.notNull(entity.getEmployeeUserId(), - com.seer.teach.mp.exception.AgentActivityErrorCodeEnum.PARENT_NOT_FOUND, "员工用户ID不能为空"); + @Override + public MpAgentEmployeeRelationEntity getOneByUserId(Integer userId) { + return super.getOne(new LambdaQueryWrapper<>(MpAgentEmployeeRelationEntity.class).eq(MpAgentEmployeeRelationEntity::getEmployeeUserId, userId)); } } \ No newline at end of file diff --git a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentServiceImpl.java b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentServiceImpl.java index f6b540e..50ac091 100644 --- a/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentServiceImpl.java +++ b/seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/service/impl/MpAgentServiceImpl.java @@ -12,4 +12,18 @@ import org.springframework.stereotype.Service; @Service public class MpAgentServiceImpl extends ServiceImpl implements IMpAgentService { + @Override + public MpAgentEntity getAgentById(Integer id) { + return this.getById(id); + } + + @Override + public Boolean saveAgent(MpAgentEntity agentEntity) { + return this.save(agentEntity); + } + + @Override + public Boolean updateAgent(MpAgentEntity agentEntity) { + return this.updateById(agentEntity); + } } \ No newline at end of file