Compare commits
14 Commits
0803646604
...
7a3f604763
| Author | SHA1 | Date | |
|---|---|---|---|
| 7a3f604763 | |||
|
|
baccd3a433 | ||
|
|
550a576a2f | ||
|
|
323f730255 | ||
|
|
a092e38c08 | ||
|
|
fb2bd56e10 | ||
|
|
83be471093 | ||
|
|
b4d5112698 | ||
|
|
2d07ffc645 | ||
|
|
6e57358626 | ||
|
|
67711fc3d7 | ||
|
|
677748bebf | ||
|
|
fadc42f2c2 | ||
|
|
29da542823 |
@ -329,6 +329,7 @@ public enum ResultCodeEnum {
|
||||
INVALID_AGENT(13004, "代理商不存在或已失效"),
|
||||
AGENT_STATUS_INVALID(13005, "代理商状态无效"),
|
||||
AGENT_EMPLOYEE_ALREADY_EXISTS(130051, "代理商员工已存在"),
|
||||
AGENT_EMPLOYEE_NOT_FOUND(130052, "代理商员工不存在"),
|
||||
AGENT_CONTACT_INFO_INVALID(13006, "联系信息无效"),
|
||||
AGENT_NON_PARTICIPANT_ACTIVE(130061, "代理商没有参与该活动"),
|
||||
ACTIVITY_NOT_FOUND(13007, "活动不存在"),
|
||||
@ -338,6 +339,7 @@ public enum ResultCodeEnum {
|
||||
PARENT_NOT_FOUND(13011, "家长不存在"),
|
||||
INVALID_ACTIVITY_STATUS(13012, "无效的活动状态"),
|
||||
AGENT_NOT_FOUND(13013, "代理商不存在"),
|
||||
AGENT_IS_EXISTS(13014, "代理商已存在"),
|
||||
PARENT_ALREADY_SIGN_UP(130121, "已经报名参加该活动"),
|
||||
UNAUTHORIZED_UPDATE_EMPLOYEE(13013, "无权限更新员工信息"),
|
||||
DATA_REPEAT_ERROR(130014, "数据重复"),
|
||||
|
||||
@ -2,6 +2,7 @@ package com.seer.teach.mp.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import com.seer.teach.common.entity.BaseEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@ -56,7 +57,7 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
||||
* 孩子性别(M-男,F-女)
|
||||
*/
|
||||
@TableField("child_gender")
|
||||
private String childGender;
|
||||
private Integer childGender;
|
||||
|
||||
/**
|
||||
* 出生年月
|
||||
@ -68,7 +69,7 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
||||
* 年级
|
||||
*/
|
||||
@TableField("grade")
|
||||
private String grade;
|
||||
private Integer grade;
|
||||
|
||||
/**
|
||||
* 学校
|
||||
@ -76,6 +77,12 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
||||
@TableField("school")
|
||||
private String school;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@TableField("mobile")
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 地区
|
||||
*/
|
||||
@ -103,13 +110,13 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
||||
/**
|
||||
* 薄弱科目
|
||||
*/
|
||||
@TableField("weak_subject_ids")
|
||||
@TableField(value = "weak_subject_ids",typeHandler = JacksonTypeHandler.class)
|
||||
private List<Integer> weakSubjectIds;
|
||||
|
||||
/**
|
||||
* 优势科目
|
||||
*/
|
||||
@TableField("strong_subject_ids")
|
||||
@TableField(value = "strong_subject_ids",typeHandler = JacksonTypeHandler.class)
|
||||
private List<Integer> strongSubjectIds;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.seer.teach.mp.admin.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.seer.teach.common.PageListBean;
|
||||
import com.seer.teach.common.ResultBean;
|
||||
import com.seer.teach.common.annotation.LogPrint;
|
||||
@ -8,18 +9,14 @@ import com.seer.teach.mp.admin.controller.req.MpActivityQueryReq;
|
||||
import com.seer.teach.mp.admin.controller.req.MpActivityReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AdminActivityResp;
|
||||
import com.seer.teach.mp.admin.service.IAdminActivityService;
|
||||
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||
import com.seer.teach.mp.service.IMpAgentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@LogPrint
|
||||
@RequiredArgsConstructor
|
||||
@ -30,6 +27,8 @@ public class AdminActivityController {
|
||||
|
||||
private final IAdminActivityService agentActivityService;
|
||||
|
||||
private final IMpAgentService mpAgentService;
|
||||
|
||||
@Operation(summary = "活动列表")
|
||||
@PostMapping("/page-list")
|
||||
@SaCheckPermission("mp:admin:agent:activity:list")
|
||||
@ -58,4 +57,14 @@ public class AdminActivityController {
|
||||
AdminActivityResp result = agentActivityService.getById(id);
|
||||
return ResultBean.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取活动二维码")
|
||||
@GetMapping("/{activityId}/qrcode")
|
||||
@SaCheckPermission("mp:admin:agent:activity:qrcode")
|
||||
public ResultBean<String> getQrCode(@PathVariable("activityId") Integer activityId, @RequestParam("appId") String appId) {
|
||||
Integer userId = StpUtil.getLoginIdAsInt();
|
||||
MpAgentEntity one = mpAgentService.lambdaQuery().eq(MpAgentEntity::getContactUserId, userId).one();
|
||||
Integer agentId = one.getId();
|
||||
return ResultBean.success(agentActivityService.getQrCode(agentId, activityId, appId));
|
||||
}
|
||||
}
|
||||
@ -33,6 +33,14 @@ public class AdminActivityInfoCollectionController {
|
||||
return ResultBean.success(result);
|
||||
}
|
||||
|
||||
@PostMapping("/list/{activityId}")
|
||||
@SaCheckPermission("admin:activity:info:collection:list")
|
||||
@Operation(summary = "获取活动信息收集记录列表")
|
||||
public ResultBean<PageListBean<AdminActivityInfoCollectionResp>> list(@RequestBody @Validated ActivityInfoCollectionQueryReq req,
|
||||
@PathVariable Integer activityId) {
|
||||
return ResultBean.success(adminActivityInfoCollectionService.list(req, activityId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@SaCheckPermission("admin:activity:info:collection:detail")
|
||||
|
||||
@ -6,20 +6,14 @@ import com.seer.teach.common.ResultBean;
|
||||
import com.seer.teach.common.annotation.LogPrint;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentQueryReq;
|
||||
import com.seer.teach.mp.admin.controller.req.MpAgentReq;
|
||||
import com.seer.teach.mp.admin.controller.req.MpAgentSaveReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AgentResp;
|
||||
import com.seer.teach.mp.admin.service.AdminAgentService;
|
||||
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.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -49,14 +43,14 @@ public class AdminAgentController {
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping
|
||||
@SaCheckPermission("mp:admin:agent:save")
|
||||
public ResultBean<Boolean> save(@RequestBody MpAgentReq req) {
|
||||
public ResultBean<Boolean> save(@RequestBody @Validated MpAgentSaveReq req) {
|
||||
return ResultBean.success(adminAgentService.saveAgent(req));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新")
|
||||
@PutMapping
|
||||
@SaCheckPermission("mp:admin:agent:update")
|
||||
public ResultBean<Boolean> update(@RequestBody MpAgentReq req) {
|
||||
public ResultBean<Boolean> update(@RequestBody @Validated MpAgentReq req) {
|
||||
return ResultBean.success(adminAgentService.updateAgent(req));
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ 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.AgentEmployeeRelationQueryReq;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeUpdateReq;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
|
||||
@ -41,8 +41,8 @@ public class AdminAgentEmployeeRelationController {
|
||||
@Operation(summary = "更新代理商员工关联")
|
||||
@PostMapping("/update")
|
||||
@SaCheckPermission("mp:admin:agent:employee:update")
|
||||
public ResultBean<Boolean> update(@RequestBody @Validated AgentEmployeeRelationReq request) {
|
||||
return ResultBean.success(agentEmployeeRelationService.saveOrUpdateRelation(request));
|
||||
public ResultBean<Boolean> update(@RequestBody @Validated AgentEmployeeUpdateReq request) {
|
||||
return ResultBean.success(agentEmployeeRelationService.update(request));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除代理商员工关联")
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
package com.seer.teach.mp.admin.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(name = "AgentEmployeeRelationReq", description = "代理商员工关联请求参数")
|
||||
@Data
|
||||
public class AgentEmployeeRelationReq {
|
||||
|
||||
@Schema(description = "关联ID")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "代理商ID")
|
||||
private Integer agentId;
|
||||
|
||||
@Schema(description = "员工用户ID")
|
||||
private Integer employeeUserId;
|
||||
|
||||
@Schema(description = "员工职位")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||
private Integer status = 1;
|
||||
}
|
||||
@ -1,7 +1,9 @@
|
||||
package com.seer.teach.mp.admin.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ -9,19 +11,27 @@ import lombok.Data;
|
||||
public class AgentEmployeeSaveReq {
|
||||
|
||||
|
||||
@Schema(description = "代理商名称")
|
||||
@NotNull(message = "代理商名称不能为空")
|
||||
private String agentName;
|
||||
@Schema(description = "代理商Id")
|
||||
@NotNull(message = "代理商Id不能为空")
|
||||
private Integer agentId;
|
||||
|
||||
@Schema(description = "员工名称")
|
||||
@NotNull(message = "员工名称不能为空")
|
||||
@NotBlank(message = "员工名称不能为空")
|
||||
private String employeeName;
|
||||
|
||||
@Schema(description = "员工密码")
|
||||
@NotBlank(message = "员工密码不能为空")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "员工手机号")
|
||||
@NotBlank(message = "员工手机号不能为空")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "请输入正确的手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "员工职位")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||
private Integer status = 1;
|
||||
|
||||
private String password;
|
||||
}
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
package com.seer.teach.mp.admin.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(name = "AgentEmployeeRelationReq", description = "代理商员工关联请求参数")
|
||||
@Data
|
||||
public class AgentEmployeeUpdateReq {
|
||||
|
||||
@Schema(description = "关联ID")
|
||||
@NotNull(message = "关联ID不能为空")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "员工名称")
|
||||
private String employeeName;
|
||||
|
||||
@Schema(description = "员工职位")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "员工密码")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "员工手机号")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "请输入正确的手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||
private Integer status = 1;
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.seer.teach.mp.admin.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "生成服务号二维码请求参数")
|
||||
@Data
|
||||
public class AgentGenerateQrCodeReq {
|
||||
|
||||
@Schema(description = "场景值")
|
||||
private String sceneStr;
|
||||
|
||||
@Schema(description = "小程序appid")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "二维码类型 1-临时 2-永久")
|
||||
private Integer type = 2;
|
||||
|
||||
@Schema(description = "二维码有效期")
|
||||
private Integer expireSeconds;
|
||||
}
|
||||
@ -1,54 +1,62 @@
|
||||
package com.seer.teach.mp.admin.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(name = "MpAgentReq", description = "代理商请求参数")
|
||||
@Data
|
||||
public class MpAgentReq {
|
||||
|
||||
@Schema(description = "代理商ID")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 代理商名称
|
||||
*/
|
||||
@Schema(description = "代理商名称")
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 代理商编码
|
||||
*/
|
||||
@Schema(description = "代理商编码")
|
||||
private String agentCode;
|
||||
|
||||
/**
|
||||
* 代理商等级
|
||||
*/
|
||||
@Schema(description = "代理商等级")
|
||||
private String agentLevel;
|
||||
|
||||
/**
|
||||
* 联系人姓名
|
||||
*/
|
||||
@Schema(description = "联系人姓名")
|
||||
private String contactName;
|
||||
|
||||
/**
|
||||
* 联系人用户Id
|
||||
*/
|
||||
private Integer contactUserId;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Schema(description = "联系电话")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "请输入正确的手机号")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 登录密码
|
||||
*/
|
||||
@Schema(description = "登录密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 代理商地址
|
||||
*/
|
||||
@Schema(description = "代理商地址")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 代理商状态:0-禁用,1-启用
|
||||
*/
|
||||
@Schema(description = "代理商状态:0-禁用,1-启用")
|
||||
private Integer status;
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.seer.teach.mp.admin.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(name = "MpAgentSaveReq", description = "新增代理商请求参数")
|
||||
public class MpAgentSaveReq {
|
||||
|
||||
/**
|
||||
* 代理商名称
|
||||
*/
|
||||
@Schema(description = "代理商名称")
|
||||
@NotBlank(message = "代理商名称不能为空")
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 代理商编码
|
||||
*/
|
||||
@Schema(description = "代理商编码")
|
||||
private String agentCode;
|
||||
|
||||
/**
|
||||
* 代理商等级
|
||||
*/
|
||||
@Schema(description = "代理商等级")
|
||||
private String agentLevel;
|
||||
|
||||
/**
|
||||
* 联系人姓名
|
||||
*/
|
||||
@Schema(description = "联系人姓名")
|
||||
@NotBlank(message = "联系人姓名不能为空")
|
||||
private String contactName;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Schema(description = "联系电话")
|
||||
@NotBlank(message = "联系电话不能为空")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "请输入正确的手机号")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 登录密码
|
||||
*/
|
||||
@Schema(description = "登录密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 代理商地址
|
||||
*/
|
||||
@Schema(description = "代理商地址")
|
||||
@NotBlank(message = "代理商地址不能为空")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 代理商状态:0-禁用,1-启用
|
||||
*/
|
||||
@Schema(description = "代理商状态:0-禁用,1-启用")
|
||||
private Integer status;
|
||||
}
|
||||
@ -10,6 +10,10 @@ import java.time.LocalDateTime;
|
||||
@Schema(name = "AdminActivityInfoCollectionResp", description = "活动信息收集响应参数")
|
||||
public class AdminActivityInfoCollectionResp {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Schema(description = "ID")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
@ -51,6 +55,12 @@ public class AdminActivityInfoCollectionResp {
|
||||
@Schema(description = "出生年月")
|
||||
private LocalDate childBirthDate;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 年级
|
||||
*/
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.seer.teach.mp.admin.controller.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "服务号二维码响应")
|
||||
@Data
|
||||
public class AdminAgentQrCodeResp {
|
||||
|
||||
@Schema(description = "二维码图片URL")
|
||||
private String qrCodeUrl;
|
||||
|
||||
@Schema(description = "二维码ticket")
|
||||
private String ticket;
|
||||
|
||||
@Schema(description = "二维码有效时间(单位:秒)")
|
||||
private Integer expireSeconds;
|
||||
}
|
||||
@ -23,6 +23,9 @@ public class AgentEmployeeRelationResp {
|
||||
@Schema(description = "员工名称")
|
||||
private String employeeName;
|
||||
|
||||
@Schema(description = "员工手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "员工职位")
|
||||
private String position;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ 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.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
@ -12,6 +13,7 @@ public interface AdminActivityInfoCollectionConvert {
|
||||
|
||||
AdminActivityInfoCollectionConvert INSTANCE = Mappers.getMapper(AdminActivityInfoCollectionConvert.class);
|
||||
|
||||
@Mapping(source = "mobile", target = "mobile")
|
||||
AdminActivityInfoCollectionResp convertToResp(MpActivityInfoCollectionEntity entity);
|
||||
|
||||
List<AdminActivityInfoCollectionResp> convertToRespList(List<MpActivityInfoCollectionEntity> entity);
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
package com.seer.teach.mp.admin.convert;
|
||||
|
||||
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.req.AgentEmployeeUpdateReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
@ -15,10 +16,11 @@ public interface AdminAgentEmployeeRelationConvert {
|
||||
|
||||
AdminAgentEmployeeRelationConvert INSTANCE = Mappers.getMapper(AdminAgentEmployeeRelationConvert.class);
|
||||
|
||||
MpAgentEmployeeRelationEntity convert(AgentEmployeeRelationReq req);
|
||||
MpAgentEmployeeRelationEntity convert(AgentEmployeeUpdateReq req);
|
||||
|
||||
MpAgentEmployeeRelationEntity convert(AgentEmployeeRelationQueryReq req);
|
||||
|
||||
@Mapping(source = "contactPhone", target = "mobile")
|
||||
AgentEmployeeRelationResp convertToResp(MpAgentEmployeeRelationEntity entity);
|
||||
|
||||
List<AgentEmployeeRelationResp> convertToRespList(List<MpAgentEmployeeRelationEntity> mpAgentEmployeeRelationEntities);
|
||||
|
||||
@ -2,6 +2,7 @@ package com.seer.teach.mp.admin.convert;
|
||||
|
||||
import com.seer.teach.mp.admin.controller.req.AgentQueryReq;
|
||||
import com.seer.teach.mp.admin.controller.req.MpAgentReq;
|
||||
import com.seer.teach.mp.admin.controller.req.MpAgentSaveReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AgentResp;
|
||||
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
@ -22,5 +23,7 @@ public interface AgentConvert {
|
||||
|
||||
MpAgentEntity convertOne2Entity(MpAgentReq req);
|
||||
|
||||
MpAgentEntity convertOneSave(MpAgentSaveReq req);
|
||||
|
||||
AgentQueryReq convertToReq(MpAgentEntity entity);
|
||||
}
|
||||
@ -43,6 +43,7 @@ public class AdminActivityInfoCollectionService {
|
||||
|
||||
/**
|
||||
* 获取活动信息收集记录详情
|
||||
*
|
||||
* @param id 记录ID
|
||||
* @return 详情
|
||||
*/
|
||||
@ -53,10 +54,29 @@ public class AdminActivityInfoCollectionService {
|
||||
|
||||
/**
|
||||
* 删除活动信息收集记录
|
||||
*
|
||||
* @param ids 删除的ID列表
|
||||
* @return 删除结果
|
||||
*/
|
||||
public boolean delete(List<Integer> ids) {
|
||||
return mpActivityInfoCollectionService.removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取活动信息收集记录列表
|
||||
*
|
||||
* @param activityId 活动Id
|
||||
* @return 返回活动列表
|
||||
*/
|
||||
public PageListBean<AdminActivityInfoCollectionResp> list(ActivityInfoCollectionQueryReq req, Integer activityId) {
|
||||
LambdaQueryWrapper<MpActivityInfoCollectionEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MpActivityInfoCollectionEntity::getActivityId, activityId)
|
||||
.like(Objects.nonNull(req.getChildName()) && !req.getChildName().isEmpty(), MpActivityInfoCollectionEntity::getChildName, req.getChildName())
|
||||
.eq(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(new Page<>(req.getPageNo(), req.getPageSize()), wrapper);
|
||||
return PageConverterUtils.convertPageListBean(result, AdminActivityInfoCollectionConvert.INSTANCE::convertToRespList);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,19 +4,25 @@ 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.enums.ResultCodeEnum;
|
||||
import com.seer.teach.common.utils.AssertUtils;
|
||||
import com.seer.teach.common.utils.PageConverterUtils;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentQueryReq;
|
||||
import com.seer.teach.mp.admin.controller.req.MpAgentReq;
|
||||
import com.seer.teach.mp.admin.controller.req.MpAgentSaveReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AgentResp;
|
||||
import com.seer.teach.mp.admin.convert.AgentConvert;
|
||||
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||
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.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@ -25,6 +31,8 @@ public class AdminAgentService {
|
||||
|
||||
private final IMpAgentService mpAgentService;
|
||||
|
||||
private final UserInfoServiceApi userInfoServiceApi;
|
||||
|
||||
/**
|
||||
* 获取代理商列表
|
||||
*
|
||||
@ -63,8 +71,10 @@ public class AdminAgentService {
|
||||
* @param req 代理商
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean saveAgent(MpAgentReq req) {
|
||||
MpAgentEntity agentEntity = AgentConvert.INSTANCE.convertOne2Entity(req);
|
||||
public Boolean saveAgent(MpAgentSaveReq req) {
|
||||
boolean userIdByMobile = userInfoServiceApi.getUserIdByMobile(req.getContactPhone());
|
||||
AssertUtils.isTrue(userIdByMobile, ResultCodeEnum.AGENT_IS_EXISTS);
|
||||
MpAgentEntity agentEntity = AgentConvert.INSTANCE.convertOneSave(req);
|
||||
boolean result = mpAgentService.saveAgent(agentEntity, req.getPassword());
|
||||
log.info("保存代理商结果: {}", result);
|
||||
return result;
|
||||
@ -77,10 +87,31 @@ public class AdminAgentService {
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean updateAgent(MpAgentReq req) {
|
||||
MpAgentEntity agentEntity = AgentConvert.INSTANCE.convertOne2Entity(req);
|
||||
boolean result = mpAgentService.updateAgent(agentEntity);
|
||||
MpAgentEntity agent = mpAgentService.getById(req.getId());
|
||||
AssertUtils.notNull(agent, ResultCodeEnum.AGENT_NOT_FOUND);
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setId(agent.getContactUserId());
|
||||
userInfoDTO.setUserName(req.getContactName());
|
||||
userInfoDTO.setMobile(req.getContactPhone());
|
||||
if (StringUtils.isNotBlank(req.getPassword())) {
|
||||
userInfoDTO.setPassword(req.getPassword());
|
||||
}
|
||||
boolean updateUserResult = userInfoServiceApi.updateUserInfo(userInfoDTO);
|
||||
log.info("更新用户结果: {}", updateUserResult);
|
||||
|
||||
agent.setId(req.getId());
|
||||
agent.setAgentName(req.getAgentName());
|
||||
agent.setAgentCode(req.getAgentCode());
|
||||
agent.setAgentLevel(req.getAgentLevel());
|
||||
agent.setContactName(req.getContactName());
|
||||
Integer contactUserId = userInfoServiceApi.getUserIdByUserName(agent.getContactName());
|
||||
agent.setContactUserId(contactUserId);
|
||||
agent.setContactPhone(req.getContactPhone());
|
||||
agent.setAddress(req.getAddress());
|
||||
agent.setStatus(req.getStatus());
|
||||
boolean result = mpAgentService.updateAgent(agent);
|
||||
log.info("更新代理商结果: {}", result);
|
||||
return result;
|
||||
return result && updateUserResult;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,10 +125,17 @@ public class AdminAgentService {
|
||||
log.warn("删除代理商时,ID列表为空");
|
||||
return false;
|
||||
}
|
||||
List<MpAgentEntity> agentList = mpAgentService.lambdaQuery().in(MpAgentEntity::getId, ids)
|
||||
.select(MpAgentEntity::getContactUserId).list();
|
||||
List<Integer> contactUserIdList = agentList.stream().map(MpAgentEntity::getContactUserId)
|
||||
.filter(Objects::nonNull).toList();
|
||||
log.info("待删除代理商关联的用户ID列表: {}", contactUserIdList);
|
||||
boolean result = mpAgentService.removeByIds(ids);
|
||||
log.info("删除代理商结果: {}", result);
|
||||
if (result) {
|
||||
log.info("删除代理商成功,ID列表: {}", ids);
|
||||
// 删除关联的用户数据
|
||||
userInfoServiceApi.deleteUserRoleByUserId(contactUserIdList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
package com.seer.teach.mp.admin.service;
|
||||
|
||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||
import com.seer.teach.common.exception.CommonException;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentGenerateQrCodeReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AdminAgentQrCodeResp;
|
||||
import com.seer.teach.mp.factory.MpServiceFactory;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpQrcodeService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AdminOfficialQrCodeService {
|
||||
|
||||
private final MpServiceFactory mpServiceFactory;
|
||||
|
||||
@Value("${zs.mp.qrcode.expire-time:3}")
|
||||
private Integer mpQrCodeExpireTime;
|
||||
|
||||
public AdminAgentQrCodeResp generateQrCode(@Valid AgentGenerateQrCodeReq req) {
|
||||
try {
|
||||
WxMpService wxMpService = mpServiceFactory.getRequiredMpService(req.getAppId());
|
||||
|
||||
Integer expireSeconds = mpQrCodeExpireTime * 60 *60;
|
||||
|
||||
WxMpQrcodeService qrcodeService = wxMpService.getQrcodeService();
|
||||
WxMpQrCodeTicket ticket;
|
||||
if(req.getType() == 1) {
|
||||
ticket = qrcodeService.qrCodeCreateTmpTicket(req.getSceneStr(), expireSeconds);
|
||||
}else{
|
||||
ticket = qrcodeService.qrCodeCreateLastTicket(req.getSceneStr());
|
||||
}
|
||||
String qrCodeUrl = wxMpService.getQrcodeService().qrCodePictureUrl(ticket.getTicket());
|
||||
|
||||
AdminAgentQrCodeResp resp = new AdminAgentQrCodeResp();
|
||||
resp.setQrCodeUrl(qrCodeUrl);
|
||||
resp.setTicket(ticket.getTicket());
|
||||
resp.setExpireSeconds(ticket.getExpireSeconds());
|
||||
return resp;
|
||||
} catch (WxErrorException e) {
|
||||
log.error("生成微信服务号二维码, req: {}",req, e);
|
||||
throw new CommonException(ResultCodeEnum.MP_QRCODE_CREATE_TMP_TICKET_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -46,4 +46,13 @@ public interface IAdminActivityService {
|
||||
* @return 活动详情
|
||||
*/
|
||||
AdminActivityResp getById(Integer id);
|
||||
|
||||
/**
|
||||
* 获取活动二维码
|
||||
* @param agentId 代理商ID
|
||||
* @param activityId 活动ID
|
||||
* @param appId 微信公众号ID
|
||||
* @return 活动二维码
|
||||
*/
|
||||
String getQrCode(Integer agentId, Integer activityId, String appId);
|
||||
}
|
||||
@ -2,9 +2,9 @@ package com.seer.teach.mp.admin.service;
|
||||
|
||||
import com.seer.teach.common.PageListBean;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeUpdateReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -32,7 +32,7 @@ public interface IAdminAgentEmployeeRelationService {
|
||||
* @param request 关联请求对象
|
||||
* @return 操作是否成功
|
||||
*/
|
||||
boolean saveOrUpdateRelation(AgentEmployeeRelationReq request);
|
||||
boolean update(AgentEmployeeUpdateReq request);
|
||||
|
||||
/**
|
||||
* 删除代理商员工关联(管理端)
|
||||
|
||||
@ -3,14 +3,22 @@ package com.seer.teach.mp.admin.service.impl;
|
||||
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.enums.ResultCodeEnum;
|
||||
import com.seer.teach.common.exception.CommonException;
|
||||
import com.seer.teach.common.utils.AssertUtils;
|
||||
import com.seer.teach.common.utils.PageConverterUtils;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentGenerateQrCodeReq;
|
||||
import com.seer.teach.mp.admin.controller.req.MpActivityQueryReq;
|
||||
import com.seer.teach.mp.admin.controller.req.MpActivityReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AdminActivityResp;
|
||||
import com.seer.teach.mp.admin.service.IAdminActivityService;
|
||||
import com.seer.teach.mp.admin.controller.resp.AdminAgentQrCodeResp;
|
||||
import com.seer.teach.mp.admin.convert.AdminActivityConvert;
|
||||
import com.seer.teach.mp.admin.service.AdminOfficialQrCodeService;
|
||||
import com.seer.teach.mp.admin.service.IAdminActivityService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -31,6 +39,10 @@ public class AdminActivityServiceImpl implements IAdminActivityService {
|
||||
|
||||
private final IMpActivityService agentActivityService;
|
||||
|
||||
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||
|
||||
private final AdminOfficialQrCodeService officialQrCodeService;
|
||||
|
||||
@Override
|
||||
public PageListBean<AdminActivityResp> pageList(MpActivityQueryReq query) {
|
||||
Page<MpActivityEntity> page = new Page<>(query.getPageNo(), query.getPageSize());
|
||||
@ -56,4 +68,27 @@ public class AdminActivityServiceImpl implements IAdminActivityService {
|
||||
MpActivityEntity entity = agentActivityService.getById(id);
|
||||
return AdminActivityConvert.INSTANCE.convertToResp(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQrCode(Integer agentId, Integer activityId, String appId) {
|
||||
MpActivityEntity activity = agentActivityService.getById(activityId);
|
||||
AssertUtils.notNull(activity, ResultCodeEnum.INVALID_ACTIVITY);
|
||||
|
||||
if (activity.getStatus() != 1) {
|
||||
throw new CommonException(ResultCodeEnum.INVALID_ACTIVITY);
|
||||
}
|
||||
MpAgentActivityParticipantEntity relation = agentActivityParticipantService.getParticipantsByActivityAndAgent(activityId, agentId);
|
||||
AssertUtils.notNull(relation, ResultCodeEnum.INVALID_ACTIVITY);
|
||||
if (StringUtils.isNotBlank(relation.getQrCodeUrl())) {
|
||||
return relation.getQrCodeUrl();
|
||||
}
|
||||
AgentGenerateQrCodeReq req = new AgentGenerateQrCodeReq();
|
||||
req.setSceneStr("agentId=" + agentId + "&activityId=" + activityId);
|
||||
req.setAppId(appId);
|
||||
req.setType(2);
|
||||
AdminAgentQrCodeResp QrCodeResp = officialQrCodeService.generateQrCode(req);
|
||||
relation.setQrCodeUrl(QrCodeResp.getQrCodeUrl());
|
||||
agentActivityParticipantService.updateById(relation);
|
||||
return QrCodeResp.getQrCodeUrl();
|
||||
}
|
||||
}
|
||||
@ -8,18 +8,18 @@ import com.seer.teach.common.enums.RoleEnum;
|
||||
import com.seer.teach.common.utils.AssertUtils;
|
||||
import com.seer.teach.common.utils.PageConverterUtils;
|
||||
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.req.AgentEmployeeUpdateReq;
|
||||
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 lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@ -34,6 +34,7 @@ import java.util.Objects;
|
||||
* @since 2025-12-30
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmployeeRelationService {
|
||||
|
||||
@ -55,9 +56,33 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean saveOrUpdateRelation(AgentEmployeeRelationReq request) {
|
||||
MpAgentEmployeeRelationEntity entity = AdminAgentEmployeeRelationConvert.INSTANCE.convert(request);
|
||||
return agentEmployeeRelationService.saveOrUpdateRelation(entity);
|
||||
public boolean update(AgentEmployeeUpdateReq request) {
|
||||
log.info("更新代理商员工关系,参数: {}", request);
|
||||
MpAgentEmployeeRelationEntity existingRelation = agentEmployeeRelationService.getById(request.getId());
|
||||
AssertUtils.notNull(existingRelation, ResultCodeEnum.AGENT_EMPLOYEE_NOT_FOUND);
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setId(existingRelation.getEmployeeUserId());
|
||||
userInfoDTO.setUserName(request.getEmployeeName());
|
||||
userInfoDTO.setMobile(request.getMobile());
|
||||
if (request.getPassword() != null) {
|
||||
userInfoDTO.setPassword(request.getPassword());
|
||||
}
|
||||
userInfoServiceApi.updateUserInfo(userInfoDTO);
|
||||
// 更新关联表中的用户信息
|
||||
MpAgentEmployeeRelationEntity updateEntity = getUpdateEntity(request, existingRelation);
|
||||
return agentEmployeeRelationService.updateById(updateEntity);
|
||||
}
|
||||
|
||||
private static MpAgentEmployeeRelationEntity getUpdateEntity(AgentEmployeeUpdateReq request, MpAgentEmployeeRelationEntity existingRelation) {
|
||||
MpAgentEmployeeRelationEntity updateEntity = new MpAgentEmployeeRelationEntity();
|
||||
updateEntity.setId(request.getId());
|
||||
updateEntity.setAgentId(existingRelation.getAgentId());
|
||||
updateEntity.setEmployeeUserId(existingRelation.getEmployeeUserId());
|
||||
updateEntity.setStatus(request.getStatus());
|
||||
updateEntity.setPosition(request.getPosition());
|
||||
updateEntity.setEmployeeName(request.getEmployeeName());
|
||||
updateEntity.setContactPhone(request.getMobile());
|
||||
return updateEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -87,16 +112,17 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setUserName(request.getEmployeeName());
|
||||
userInfoDTO.setPassword(request.getPassword());
|
||||
userInfoDTO.setMobile(request.getMobile());
|
||||
userInfoDTO.setRoleCode(RoleEnum.AGENT);
|
||||
Integer userId = userInfoServiceApi.addUserInfoAndAssignRole(userInfoDTO);
|
||||
Integer agentId = mpAgentService.lambdaQuery().eq(MpAgentEntity::getAgentName, request.getAgentName()).one().getId();
|
||||
MpAgentEmployeeRelationEntity entity = new MpAgentEmployeeRelationEntity();
|
||||
entity.setAgentId(agentId);
|
||||
entity.setAgentId(request.getAgentId());
|
||||
entity.setAgentName(mpAgentService.getById(request.getAgentId()).getAgentName());
|
||||
entity.setEmployeeUserId(userId);
|
||||
entity.setEmployeeName(request.getEmployeeName());
|
||||
entity.setAgentName(request.getAgentName());
|
||||
entity.setPosition(request.getPosition());
|
||||
entity.setStatus(request.getStatus());
|
||||
entity.setContactPhone(request.getMobile());
|
||||
agentEmployeeRelationService.save(entity);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -131,16 +131,17 @@ CREATE TABLE `mp_activity_info_collection` (
|
||||
`activity_id` int NOT NULL COMMENT '活动ID',
|
||||
`parent_id` int NOT NULL COMMENT '家长ID',
|
||||
`child_name` varchar(100) COMMENT '孩子姓名',
|
||||
`child_gender` varchar(10) COMMENT '孩子性别(M-男,F-女)',
|
||||
`child_gender` int COMMENT '孩子性别(1-男,0-女)',
|
||||
`child_birth_date` date COMMENT '出生年月',
|
||||
`grade` varchar(20) COMMENT '年级',
|
||||
`grade` int COMMENT '年级',
|
||||
`school` varchar(255) COMMENT '学校',
|
||||
`mobile` varchar(20) COMMENT '手机号',
|
||||
`region` varchar(255) COMMENT '地区',
|
||||
`parent_identity` varchar(20) COMMENT '家长身份(爸爸,妈妈)',
|
||||
`learning_situation` varchar(20) COMMENT '学习情况(优、良、中、差)',
|
||||
`contact_call_count` int NOT NULL DEFAULT 0 COMMENT '代理商拨打电话联系家长次数',
|
||||
`weak_subject_ids` varchar(50) COMMENT '薄弱科目',
|
||||
`strong_subject_ids` varchar(50) COMMENT '优势科目',
|
||||
`weak_subject_ids` json COMMENT '薄弱科目',
|
||||
`strong_subject_ids` json 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 '创建人',
|
||||
|
||||
@ -13,14 +13,13 @@ 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 jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.RestController;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代理商活动参与家长信息App控制器
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package com.seer.teach.mp.app.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.seer.teach.common.PageListBean;
|
||||
import com.seer.teach.common.ResultBean;
|
||||
import com.seer.teach.common.annotation.LogPrint;
|
||||
@ -31,8 +30,6 @@ public class AppAgentEmployeeRelationController {
|
||||
@PostMapping("/page-list")
|
||||
@SaCheckLogin
|
||||
public ResultBean<PageListBean<AppAgentEmployeeRelationResp>> pageList(@RequestBody @Validated AppAgentEmployeeRelationQueryReq query) {
|
||||
Integer agentId = StpUtil.getLoginIdAsInt();
|
||||
query.setAgentId(agentId);
|
||||
return ResultBean.success(agentEmployeeRelationService.pageList(query));
|
||||
}
|
||||
|
||||
@ -40,8 +37,6 @@ public class AppAgentEmployeeRelationController {
|
||||
@PostMapping("/add")
|
||||
@SaCheckLogin
|
||||
public ResultBean<Boolean> addEmployee(@RequestBody @Validated AppAgentEmployeeRelationReq request) {
|
||||
Integer agentId = StpUtil.getLoginIdAsInt();
|
||||
request.setAgentId(agentId);
|
||||
return ResultBean.success(agentEmployeeRelationService.addEmployee(request));
|
||||
}
|
||||
|
||||
@ -49,8 +44,7 @@ public class AppAgentEmployeeRelationController {
|
||||
@PostMapping("/update")
|
||||
@SaCheckLogin
|
||||
public ResultBean<Boolean> updateEmployee(@RequestBody @Validated AppAgentEmployeeRelationReq request) {
|
||||
Integer agentId = StpUtil.getLoginIdAsInt();
|
||||
boolean belongsToAgent = agentEmployeeRelationService.isEmployeeBelongsToAgent(request.getId(), agentId);
|
||||
boolean belongsToAgent = agentEmployeeRelationService.isEmployeeBelongsToAgent(request.getId(),request.getAgentId());
|
||||
if (!belongsToAgent) {
|
||||
return ResultBean.error(ResultCodeEnum.UNAUTHORIZED_UPDATE_EMPLOYEE);
|
||||
}
|
||||
@ -60,8 +54,7 @@ public class AppAgentEmployeeRelationController {
|
||||
@Operation(summary = "删除员工")
|
||||
@DeleteMapping("/{id}")
|
||||
@SaCheckLogin
|
||||
public ResultBean<Boolean> deleteEmployee(@PathVariable Integer id) {
|
||||
Integer agentId = StpUtil.getLoginIdAsInt();
|
||||
public ResultBean<Boolean> deleteEmployee(@PathVariable Integer id, @RequestParam Integer agentId) {
|
||||
boolean belongsToAgent = agentEmployeeRelationService.isEmployeeBelongsToAgent(id,agentId);
|
||||
if (!belongsToAgent) {
|
||||
return ResultBean.error(ResultCodeEnum.UNAUTHORIZED_UPDATE_EMPLOYEE);
|
||||
@ -72,8 +65,7 @@ public class AppAgentEmployeeRelationController {
|
||||
@Operation(summary = "员工详情")
|
||||
@GetMapping("/{id}")
|
||||
@SaCheckLogin
|
||||
public ResultBean<AppAgentEmployeeRelationResp> getEmployee(@PathVariable Integer id) {
|
||||
Integer agentId = StpUtil.getLoginIdAsInt();
|
||||
public ResultBean<AppAgentEmployeeRelationResp> getEmployee(@PathVariable Integer id,@RequestParam Integer agentId) {
|
||||
boolean belongsToAgent = agentEmployeeRelationService.isEmployeeBelongsToAgent(id,agentId);
|
||||
if (!belongsToAgent) {
|
||||
return ResultBean.error(ResultCodeEnum.UNAUTHORIZED_UPDATE_EMPLOYEE);
|
||||
@ -85,8 +77,7 @@ public class AppAgentEmployeeRelationController {
|
||||
@Operation(summary = "获取所有员工列表")
|
||||
@GetMapping("/all")
|
||||
@SaCheckLogin
|
||||
public ResultBean<List<AppAgentEmployeeRelationResp>> getAllEmployees() {
|
||||
Integer agentId = StpUtil.getLoginIdAsInt();
|
||||
public ResultBean<List<AppAgentEmployeeRelationResp>> getAllEmployees(@RequestParam Integer agentId) {
|
||||
return ResultBean.success(agentEmployeeRelationService.getAllEmployeesByAgentId(agentId));
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@ -34,7 +35,7 @@ public class AppParentAgentActivityController {
|
||||
@PostMapping("/sign-up")
|
||||
@SaCheckLogin
|
||||
@Operation(summary = "家长报名参加代理商活动")
|
||||
public ResultBean<Boolean> signUpForActivity(@RequestBody AppMpSignUpActivityReq request) {
|
||||
public ResultBean<Boolean> signUpForActivity(@RequestBody @Validated AppMpSignUpActivityReq request) {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appParentAgentActivityService.signUpForActivityWithInfo(request, parentId));
|
||||
}
|
||||
@ -42,7 +43,7 @@ public class AppParentAgentActivityController {
|
||||
@PostMapping("/update-info")
|
||||
@SaCheckLogin
|
||||
@Operation(summary = "家长更新活动信息")
|
||||
public ResultBean<Boolean> updateActivityInfo(@RequestBody AppMpSignUpActivityReq request) {
|
||||
public ResultBean<Boolean> updateActivityInfo(@RequestBody @Validated AppMpSignUpActivityReq request) {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appParentAgentActivityService.updateActivityInfo(request, parentId));
|
||||
}
|
||||
|
||||
@ -4,16 +4,17 @@ import com.seer.teach.common.request.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(name = "AppAgentEmployeeRelationQueryReq", description = "代理商员工关联查询请求参数")
|
||||
@Data
|
||||
@Schema(name = "AppAgentEmployeeRelationQueryReq", description = "代理商员工关联查询请求参数")
|
||||
public class AppAgentEmployeeRelationQueryReq extends PageRequest {
|
||||
|
||||
@Schema(description = "代理商ID")
|
||||
private Integer agentId; // 用于限制只能查询当前代理商的员工
|
||||
|
||||
@Schema(description = "员工职位")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "员工名称")
|
||||
private String employeeName;
|
||||
}
|
||||
@ -1,10 +1,9 @@
|
||||
package com.seer.teach.mp.app.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Schema(name = "AppAgentEmployeeRelationReq", description = "App端代理商员工关联请求参数")
|
||||
@Data
|
||||
public class AppAgentEmployeeRelationReq {
|
||||
@ -21,8 +20,9 @@ public class AppAgentEmployeeRelationReq {
|
||||
@Schema(description = "员工密码")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "联系电话")
|
||||
private String contactPhone;
|
||||
@Schema(description = "员工手机号")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "请输入正确的手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "员工职位")
|
||||
private String position;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.seer.teach.mp.app.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
@ -10,6 +11,9 @@ import java.util.List;
|
||||
@Data
|
||||
public class AppMpSignUpActivityReq {
|
||||
|
||||
@Schema (description = "ID")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "活动ID")
|
||||
private Integer activityId;
|
||||
|
||||
@ -17,6 +21,7 @@ public class AppMpSignUpActivityReq {
|
||||
private Integer agentId;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "请输入正确的手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "孩子姓名")
|
||||
|
||||
@ -11,7 +11,7 @@ import java.time.LocalDate;
|
||||
public class TestChildCharacterReq {
|
||||
|
||||
@NotNull(message = "孩子性别不能为空")
|
||||
@Schema(description = "孩子性别(M-男,F-女)")
|
||||
@Schema(description = "孩子性别(男,女)")
|
||||
private String childGender;
|
||||
|
||||
@NotNull(message = "出生年月不能为空")
|
||||
|
||||
@ -28,18 +28,21 @@ public class AgentActivityParentInfoResp {
|
||||
@Schema(description = "孩子姓名")
|
||||
private String childName;
|
||||
|
||||
@Schema(description = "孩子性别(M-男,F-女)")
|
||||
private String childGender;
|
||||
@Schema(description = "孩子性别(1-男,0-女)")
|
||||
private Integer childGender;
|
||||
|
||||
@Schema(description = "出生年月")
|
||||
private LocalDate childBirthDate;
|
||||
|
||||
@Schema(description = "年级")
|
||||
private String grade;
|
||||
private Integer grade;
|
||||
|
||||
@Schema(description = "学校")
|
||||
private String school;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "地区")
|
||||
private String region;
|
||||
|
||||
|
||||
@ -39,6 +39,9 @@ public class AppMpSignUpActivityResp {
|
||||
@Schema(description = "学校")
|
||||
private String school;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "地区")
|
||||
private String region;
|
||||
|
||||
@ -50,4 +53,7 @@ public class AppMpSignUpActivityResp {
|
||||
|
||||
@Schema(description = "薄弱科目")
|
||||
private String weakSubject;
|
||||
|
||||
@Schema(description = "代理商拨打电话联系家长的次数")
|
||||
private Integer contactCallCount;
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.seer.teach.mp.app.controller.req.AppMpSignUpActivityReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AppMpSignUpActivityResp;
|
||||
import com.seer.teach.mp.entity.MpActivityInfoCollectionEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
@ -16,6 +17,8 @@ public interface AppMpActivityInfoCollectionConvert {
|
||||
* @param entity 实体
|
||||
* @return 响应参数
|
||||
*/
|
||||
@Mapping(source = "mobile", target = "mobile")
|
||||
@Mapping(source = "contactCallCount", target = "contactCallCount")
|
||||
AppMpSignUpActivityResp convert2Resp(MpActivityInfoCollectionEntity entity);
|
||||
|
||||
|
||||
|
||||
@ -8,16 +8,8 @@ import com.seer.teach.mp.app.controller.req.TestChildCharacterReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AppMpSignUpActivityResp;
|
||||
import com.seer.teach.mp.app.controller.resp.TestChildCharacterResp;
|
||||
import com.seer.teach.mp.app.convert.AppMpActivityInfoCollectionConvert;
|
||||
import com.seer.teach.mp.entity.MpActivityEntity;
|
||||
import com.seer.teach.mp.entity.MpActivityInfoCollectionEntity;
|
||||
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||
import com.seer.teach.mp.entity.MpParentAgentActivityRelationEntity;
|
||||
import com.seer.teach.mp.service.IMpActivityInfoCollectionService;
|
||||
import com.seer.teach.mp.service.IMpActivityService;
|
||||
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||
import com.seer.teach.mp.service.IMpAgentService;
|
||||
import com.seer.teach.mp.service.IMpParentAgentActivityRelationService;
|
||||
import com.seer.teach.mp.entity.*;
|
||||
import com.seer.teach.mp.service.*;
|
||||
import com.seer.teach.teacher.service.AiModelCallService;
|
||||
import com.seer.teach.teacher.service.platform.LlmResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -27,7 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@ -35,10 +26,15 @@ import java.util.Objects;
|
||||
public class AppParentAgentActivityService implements IAppParentAgentActivityService {
|
||||
|
||||
private final IMpParentAgentActivityRelationService parentAgentActivityRelationService;
|
||||
|
||||
private final IMpActivityInfoCollectionService activityInfoCollectionService;
|
||||
|
||||
private final IMpActivityService activityService;
|
||||
|
||||
private final IMpAgentService agentService;
|
||||
|
||||
private final IMpAgentActivityParticipantService mpAgentActivityParticipantService;
|
||||
|
||||
private final AiModelCallService aiModelCallService;
|
||||
|
||||
/**
|
||||
@ -78,6 +74,7 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
if (saved) {
|
||||
MpActivityInfoCollectionEntity mpActivityInfoCollectionEntity = AppMpActivityInfoCollectionConvert.INSTANCE.convertOne2Entity(request);
|
||||
mpActivityInfoCollectionEntity.setRelationId(relation.getId());
|
||||
mpActivityInfoCollectionEntity.setParentId(parentId);
|
||||
boolean activityInfoCollectionResult = activityInfoCollectionService.save(mpActivityInfoCollectionEntity);
|
||||
log.info("活动信息收集结果:{}", activityInfoCollectionResult);
|
||||
return activityInfoCollectionResult;
|
||||
@ -93,29 +90,47 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
* @return true表示成功,false表示失败
|
||||
*/
|
||||
public boolean updateActivityInfo(AppMpSignUpActivityReq request, Integer parentId) {
|
||||
MpActivityInfoCollectionEntity entity = activityInfoCollectionService.getById(request.getId());
|
||||
if (entity == null) {
|
||||
return false;
|
||||
}
|
||||
Integer agentId = request.getAgentId();
|
||||
Integer activityId = request.getActivityId();
|
||||
MpParentAgentActivityRelationEntity relation = parentAgentActivityRelationService.getByAgentIdAndActivityIdAndParentId(agentId, activityId, parentId);
|
||||
AssertUtils.notNull(relation, ResultCodeEnum.PARENT_NOT_SIGNED_UP);
|
||||
MpActivityInfoCollectionEntity mpActivityInfoCollectionEntity = AppMpActivityInfoCollectionConvert.INSTANCE.convertOne2Entity(request);
|
||||
mpActivityInfoCollectionEntity.setRelationId(relation.getId());
|
||||
return activityInfoCollectionService.updateById(mpActivityInfoCollectionEntity);
|
||||
entity.setRelationId(relation.getId());
|
||||
entity.setParentId(parentId);
|
||||
entity.setMobile(request.getMobile());
|
||||
entity.setChildName(request.getChildName());
|
||||
entity.setChildGender(request.getChildGender());
|
||||
entity.setChildBirthDate(request.getChildBirthDate());
|
||||
entity.setGrade(request.getGrade());
|
||||
entity.setSchool(request.getSchool());
|
||||
entity.setRegion(request.getRegion());
|
||||
entity.setParentIdentity(request.getParentIdentity());
|
||||
entity.setLearningSituation(request.getLearningSituation());
|
||||
entity.setWeakSubjectIds(request.getWeakSubjectIds());
|
||||
entity.setStrongSubjectIds(request.getStrongSubjectIds());
|
||||
return activityInfoCollectionService.updateById(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消报名
|
||||
*
|
||||
* @param relationId 关系ID
|
||||
* @param id 报名ID
|
||||
* @param parentId 家长ID
|
||||
* @return true表示成功,false表示失败
|
||||
*/
|
||||
public boolean cancelSignUp(Integer relationId, Integer parentId) {
|
||||
MpParentAgentActivityRelationEntity relation = parentAgentActivityRelationService.getById(relationId);
|
||||
if (Objects.nonNull(relation) && relation.getParentId().equals(parentId)) {
|
||||
relation.setStatus(0);
|
||||
boolean result = parentAgentActivityRelationService.updateById(relation);
|
||||
log.info("取消报名结果:{}", result);
|
||||
return result;
|
||||
@Transactional(rollbackFor = Exception.class, timeout = 120)
|
||||
public boolean cancelSignUp(Integer id, Integer parentId) {
|
||||
MpActivityInfoCollectionEntity entity = activityInfoCollectionService.getById(id);
|
||||
if (entity == null) {
|
||||
return false;
|
||||
}
|
||||
boolean activityResult = activityInfoCollectionService.removeById(entity);
|
||||
if (activityResult) {
|
||||
Integer relationId = entity.getRelationId();
|
||||
return parentAgentActivityRelationService.removeById(relationId);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -133,9 +148,13 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
LambdaQueryWrapper<MpParentAgentActivityRelationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MpParentAgentActivityRelationEntity::getActivityId, activityId)
|
||||
.eq(MpParentAgentActivityRelationEntity::getParentId, parentId)
|
||||
.eq(MpParentAgentActivityRelationEntity::getStatus, 1)
|
||||
.eq(MpParentAgentActivityRelationEntity::getAgentId, agentId);
|
||||
MpParentAgentActivityRelationEntity one = parentAgentActivityRelationService.getOne(wrapper);
|
||||
AssertUtils.notNull(one, ResultCodeEnum.INVALID_ACTIVITY);
|
||||
if (one == null) {
|
||||
log.info("活动不存在或已失效");
|
||||
return new AppMpSignUpActivityResp();
|
||||
}
|
||||
MpActivityInfoCollectionEntity activityInfoCollection = activityInfoCollectionService.getByActivityIdAndParentId(agentId, activityId, parentId);
|
||||
return AppMpActivityInfoCollectionConvert.INSTANCE.convert2Resp(activityInfoCollection);
|
||||
}
|
||||
@ -181,21 +200,19 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
* @return 提示词内容
|
||||
*/
|
||||
private String buildCharacterTestPrompt(TestChildCharacterReq request) {
|
||||
StringBuilder prompt = new StringBuilder();
|
||||
prompt.append("请根据以下孩子信息分析其性格特点,并给出教育建议:\n");
|
||||
prompt.append("- 性别: ").append(request.getChildGender()).append("\n");
|
||||
prompt.append("- 出生日期: ").append(request.getChildBirthDate()).append("\n");
|
||||
prompt.append("- 星座: ").append(request.getConstellation() != null ? request.getConstellation() : "未知").append("\n");
|
||||
prompt.append("- 年级: ").append(request.getGrade()).append("\n");
|
||||
prompt.append("- 学习情况: ").append(request.getLearningSituation()).append("\n");
|
||||
prompt.append("- 偏科情况: ").append(request.getWeakSubject()).append("\n");
|
||||
prompt.append("\n请按照以下格式返回分析结果:\n");
|
||||
prompt.append("1. 性格分析:[具体分析内容]\n");
|
||||
prompt.append("2. 性格特征:[关键特征]\n");
|
||||
prompt.append("3. 教育建议:[针对性建议]\n");
|
||||
prompt.append("4. 性格类型:[简要分类]");
|
||||
|
||||
return prompt.toString();
|
||||
return "请根据以下孩子信息分析其性格特点,并给出教育建议:\n" +
|
||||
"- 性别: " + request.getChildGender() + "\n" +
|
||||
"- 出生日期: " + request.getChildBirthDate() + "\n" +
|
||||
"- 星座: " + (request.getConstellation() != null ? request.getConstellation() : "未知") + "\n" +
|
||||
"- 年级: " + request.getGrade() + "\n" +
|
||||
"- 学习情况: " + request.getLearningSituation() + "\n" +
|
||||
"- 偏科情况: " + request.getWeakSubject() + "\n" +
|
||||
"\n请按照以下格式返回分析结果:\n" +
|
||||
"1. 性格分析:[具体分析内容]\n" +
|
||||
"2. 性格特征:[关键特征]\n" +
|
||||
"3. 教育建议:[针对性建议]\n" +
|
||||
"4. 性格类型:[简要分类]";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,25 +224,62 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
private TestChildCharacterResp parseAiResponse(String aiResponse) {
|
||||
TestChildCharacterResp resp = new TestChildCharacterResp();
|
||||
|
||||
// 简单解析AI返回的内容
|
||||
String[] parts = aiResponse.split("\n");
|
||||
for (String part : parts) {
|
||||
if (part.startsWith("1. 性格分析:") || part.contains("性格分析")) {
|
||||
resp.setCharacterAnalysis(part.replaceFirst("^[0-9]+\\.\\s*", "").replace("性格分析:", "").trim());
|
||||
} else if (part.startsWith("2. 性格特征:") || part.contains("性格特征")) {
|
||||
resp.setCharacterTraits(part.replaceFirst("^[0-9]+\\.\\s*", "").replace("性格特征:", "").trim());
|
||||
} else if (part.startsWith("3. 教育建议:") || part.contains("教育建议")) {
|
||||
resp.setSuggestions(part.replaceFirst("^[0-9]+\\.\\s*", "").replace("教育建议:", "").trim());
|
||||
} else if (part.startsWith("4. 性格类型:") || part.contains("性格类型")) {
|
||||
resp.setCharacterType(part.replaceFirst("^[0-9]+\\.\\s*", "").replace("性格类型:", "").trim());
|
||||
String[] lines = aiResponse.split("\n");
|
||||
StringBuilder currentSection = new StringBuilder();
|
||||
String currentHeader = null;
|
||||
|
||||
for (String line : lines) {
|
||||
// 检查是否为新的章节头部
|
||||
if (line.matches("^\\d+\\.\\s*[\\u4e00-\\u9fa5]+:.*|^\\s*[\\u4e00-\\u9fa5]+:.*")) {
|
||||
// 保存之前的章节
|
||||
if (currentHeader != null && !currentSection.isEmpty()) {
|
||||
setResponseField(resp, currentHeader, currentSection.toString().trim());
|
||||
}
|
||||
|
||||
// 开始新章节
|
||||
String[] parts = line.split(":", 2);
|
||||
if (parts.length >= 2) {
|
||||
currentHeader = parts[0].replaceAll("^\\d+\\.\\s*", "").trim();
|
||||
currentSection = new StringBuilder(parts[1]);
|
||||
}
|
||||
} else if (currentHeader != null) {
|
||||
// 添加到当前章节内容
|
||||
if (!currentSection.isEmpty()) {
|
||||
currentSection.append("\n");
|
||||
}
|
||||
currentSection.append(line.trim());
|
||||
}
|
||||
}
|
||||
|
||||
// 如果解析失败,将整个内容作为性格分析
|
||||
// 处理最后一个章节
|
||||
if (currentHeader != null && !currentSection.isEmpty()) {
|
||||
setResponseField(resp, currentHeader, currentSection.toString().trim());
|
||||
}
|
||||
|
||||
if (resp.getCharacterAnalysis() == null || resp.getCharacterAnalysis().isEmpty()) {
|
||||
resp.setCharacterAnalysis(aiResponse);
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
private void setResponseField(TestChildCharacterResp resp, String header, String content) {
|
||||
switch (header) {
|
||||
case "性格分析":
|
||||
resp.setCharacterAnalysis(content);
|
||||
break;
|
||||
case "性格特征":
|
||||
resp.setCharacterTraits(content);
|
||||
break;
|
||||
case "教育建议":
|
||||
resp.setSuggestions(content);
|
||||
break;
|
||||
case "性格类型":
|
||||
resp.setCharacterType(content);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -69,7 +69,7 @@ public interface IAppAgentEmployeeRelationService {
|
||||
* 验证员工是否属于指定代理商
|
||||
*
|
||||
* @param relationId 关联ID
|
||||
* @param agentId 代理商ID
|
||||
* @param employeeUserId 代理商ID
|
||||
* @return 是否属于
|
||||
*/
|
||||
boolean isEmployeeBelongsToAgent(Integer relationId, Integer agentId);
|
||||
|
||||
@ -113,6 +113,8 @@ public class AppAgentActivityParentInfoServiceImpl implements IAppAgentActivityP
|
||||
resp.setChildBirthDate(entity.getChildBirthDate());
|
||||
resp.setGrade(entity.getGrade());
|
||||
resp.setSchool(entity.getSchool());
|
||||
resp.setMobile(entity.getMobile());
|
||||
resp.setContactCallCount(entity.getContactCallCount());
|
||||
resp.setRegion(entity.getRegion());
|
||||
resp.setParentIdentity(entity.getParentIdentity());
|
||||
resp.setLearningSituation(entity.getLearningSituation());
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.seer.teach.mp.app.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -16,6 +17,7 @@ import com.seer.teach.mp.app.controller.resp.AppAgentEmployeeRelationResp;
|
||||
import com.seer.teach.mp.app.service.IAppAgentEmployeeRelationService;
|
||||
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||
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;
|
||||
@ -40,16 +42,37 @@ import java.util.stream.Collectors;
|
||||
public class AppAgentEmployeeRelationServiceImpl implements IAppAgentEmployeeRelationService {
|
||||
|
||||
private final IMpAgentEmployeeRelationService mpAgentEmployeeRelationService;
|
||||
|
||||
private final IMpAgentService mpAgentService;
|
||||
|
||||
private final UserInfoServiceApi userInfoServiceApi;
|
||||
|
||||
@Override
|
||||
public PageListBean<AppAgentEmployeeRelationResp> pageList(AppAgentEmployeeRelationQueryReq query) {
|
||||
log.info("查询参数:{}", query);
|
||||
IPage<MpAgentEmployeeRelationEntity> page = new Page<>(query.getPageNo(), query.getPageSize());
|
||||
var pageResult = mpAgentEmployeeRelationService.page(page, new LambdaQueryWrapper<>(MpAgentEmployeeRelationEntity.class)
|
||||
.eq(MpAgentEmployeeRelationEntity::getAgentId, query.getAgentId())
|
||||
// 获取当前登录用户ID
|
||||
Integer employeeUserId = StpUtil.getLoginIdAsInt();
|
||||
MpAgentEmployeeRelationEntity one = mpAgentEmployeeRelationService.lambdaQuery().eq(MpAgentEmployeeRelationEntity::getEmployeeUserId, employeeUserId).one();
|
||||
if (one == null) {
|
||||
return PageConverterUtils.convertPageListBean(page, null);
|
||||
}
|
||||
// 获取代理商ID
|
||||
Integer agentId = one.getAgentId();
|
||||
LambdaQueryWrapper<MpAgentEmployeeRelationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MpAgentEmployeeRelationEntity::getAgentId, agentId)
|
||||
.like(StringUtils.isNotBlank(query.getPosition()), MpAgentEmployeeRelationEntity::getPosition, query.getPosition())
|
||||
.eq(query.getStatus() != null, MpAgentEmployeeRelationEntity::getStatus, query.getStatus()));
|
||||
.eq(query.getStatus() != null, MpAgentEmployeeRelationEntity::getStatus, query.getStatus());
|
||||
|
||||
if (StringUtils.isNotBlank(query.getEmployeeName())) {
|
||||
List<Integer> matchUserIds = userInfoServiceApi.getUserIdsByUserNameLike(query.getEmployeeName());
|
||||
if (CollectionUtil.isEmpty(matchUserIds)) {
|
||||
log.info("无匹配员工");
|
||||
return PageConverterUtils.convertPageListBean(page, null);
|
||||
}
|
||||
wrapper.in(MpAgentEmployeeRelationEntity::getEmployeeUserId, matchUserIds);
|
||||
}
|
||||
IPage<MpAgentEmployeeRelationEntity> pageResult = mpAgentEmployeeRelationService.page(page, wrapper);
|
||||
|
||||
if (CollectionUtil.isEmpty(pageResult.getRecords())) {
|
||||
log.info("查询结果为空");
|
||||
@ -61,9 +84,10 @@ public class AppAgentEmployeeRelationServiceImpl implements IAppAgentEmployeeRel
|
||||
|
||||
@Override
|
||||
public boolean addEmployee(AppAgentEmployeeRelationReq request) {
|
||||
log.info("新增员工参数:{}", request);
|
||||
LambdaQueryWrapper<MpAgentEmployeeRelationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MpAgentEmployeeRelationEntity::getAgentId, request.getAgentId())
|
||||
.eq(MpAgentEmployeeRelationEntity::getContactPhone, request.getContactPhone());
|
||||
.eq(MpAgentEmployeeRelationEntity::getContactPhone, request.getMobile());
|
||||
|
||||
MpAgentEmployeeRelationEntity existing = mpAgentEmployeeRelationService.getOne(wrapper);
|
||||
if (existing != null) {
|
||||
@ -71,13 +95,16 @@ public class AppAgentEmployeeRelationServiceImpl implements IAppAgentEmployeeRel
|
||||
}
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setUserName(request.getEmployeeName());
|
||||
userInfoDTO.setMobile(request.getContactPhone());
|
||||
userInfoDTO.setMobile(request.getMobile());
|
||||
userInfoDTO.setPassword(request.getPassword());
|
||||
userInfoDTO.setRoleCode(RoleEnum.AGENT);
|
||||
Integer userId = userInfoServiceApi.addUserInfoAndAssignRole(userInfoDTO);
|
||||
|
||||
MpAgentEmployeeRelationEntity entity = new MpAgentEmployeeRelationEntity();
|
||||
entity.setAgentId(request.getAgentId());
|
||||
entity.setEmployeeName(request.getEmployeeName());
|
||||
entity.setContactPhone(request.getMobile());
|
||||
entity.setAgentName(mpAgentService.getById(request.getAgentId()).getAgentName());
|
||||
entity.setEmployeeUserId(userId);
|
||||
entity.setPosition(request.getPosition());
|
||||
entity.setStatus(request.getStatus());
|
||||
@ -99,8 +126,12 @@ public class AppAgentEmployeeRelationServiceImpl implements IAppAgentEmployeeRel
|
||||
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setUserName(request.getEmployeeName());
|
||||
userInfoDTO.setMobile(request.getContactPhone());
|
||||
userInfoDTO.setMobile(request.getMobile());
|
||||
userInfoDTO.setId(existing.getEmployeeUserId());
|
||||
if (StringUtils.isNotBlank(request.getPassword())) {
|
||||
userInfoDTO.setPassword(request.getPassword());
|
||||
log.info("更新员工密码");
|
||||
}
|
||||
boolean updateUserResult = userInfoServiceApi.updateUserInfo(userInfoDTO);
|
||||
log.info("更新员工结果:{}", updateUserResult);
|
||||
|
||||
@ -109,19 +140,24 @@ public class AppAgentEmployeeRelationServiceImpl implements IAppAgentEmployeeRel
|
||||
updateEntity.setPosition(request.getPosition());
|
||||
updateEntity.setStatus(request.getStatus());
|
||||
updateEntity.setEmployeeName(request.getEmployeeName());
|
||||
existing.setContactPhone(request.getContactPhone());
|
||||
boolean result = mpAgentEmployeeRelationService.updateById(existing);
|
||||
updateEntity.setContactPhone(request.getMobile());
|
||||
updateEntity.setAgentName(mpAgentService.getById(request.getAgentId()).getAgentName());
|
||||
updateEntity.setAgentId(request.getAgentId());
|
||||
updateEntity.setEmployeeUserId(existing.getEmployeeUserId());
|
||||
boolean result = mpAgentEmployeeRelationService.updateById(updateEntity);
|
||||
log.info("更新员工结果:{}", result);
|
||||
return result;
|
||||
return result && updateUserResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteEmployee(Integer id) {
|
||||
MpAgentEmployeeRelationEntity existing = mpAgentEmployeeRelationService.getById(id);
|
||||
AssertUtils.notNull(existing, ResultCodeEnum.DATA_NOT_EXIST);
|
||||
Integer userId = existing.getEmployeeUserId();
|
||||
boolean result = mpAgentEmployeeRelationService.removeById(id);
|
||||
log.info("删除员工结果:{}", result);
|
||||
return result;
|
||||
boolean deleteUserResult = userInfoServiceApi.deleteUserRoleByUserId(userId);
|
||||
return result && deleteUserResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -150,11 +186,11 @@ public class AppAgentEmployeeRelationServiceImpl implements IAppAgentEmployeeRel
|
||||
|
||||
@Override
|
||||
public boolean isEmployeeBelongsToAgent(Integer relationId, Integer agentId) {
|
||||
MpAgentEmployeeRelationEntity entity = mpAgentEmployeeRelationService.getById(relationId);
|
||||
if (entity == null) {
|
||||
return false;
|
||||
}
|
||||
return entity.getAgentId().equals(agentId);
|
||||
MpAgentEmployeeRelationEntity entity = mpAgentEmployeeRelationService.lambdaQuery()
|
||||
.eq(MpAgentEmployeeRelationEntity::getId, relationId)
|
||||
.eq(MpAgentEmployeeRelationEntity::getAgentId, agentId)
|
||||
.one();
|
||||
return entity != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,13 +1,15 @@
|
||||
package com.seer.teach.mp.app.service.impl;
|
||||
|
||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||
import com.seer.teach.common.utils.AssertUtils;
|
||||
import com.seer.teach.mp.app.controller.resp.AppMpAgentResp;
|
||||
import com.seer.teach.mp.app.convert.AppAgentConvert;
|
||||
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;
|
||||
|
||||
import java.util.Objects;
|
||||
@ -24,11 +26,10 @@ public class AppAgentServiceImpl implements IAppAgentService {
|
||||
|
||||
@Override
|
||||
public AppMpAgentResp getAgentRespByUserId(Integer userId) {
|
||||
MpAgentEmployeeRelationEntity mpAgentEmployeeRelationEntity = mpAgentEmployeeRelationService.getOneByUserId(userId);
|
||||
if (mpAgentEmployeeRelationEntity == null) {
|
||||
return null;
|
||||
}
|
||||
MpAgentEntity agentEntity = mpAgentService.getAgentById(mpAgentEmployeeRelationEntity.getAgentId());
|
||||
MpAgentEntity one = mpAgentService.lambdaQuery().eq(MpAgentEntity::getContactUserId, userId).one();
|
||||
AssertUtils.notNull(one, ResultCodeEnum.AGENT_NOT_FOUND);
|
||||
Integer agentId = one.getId();
|
||||
MpAgentEntity agentEntity = mpAgentService.getAgentById(agentId);
|
||||
if (Objects.isNull(agentEntity)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package com.seer.teach.mp.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.seer.teach.common.enums.RoleEnum;
|
||||
import com.seer.teach.common.utils.CommonUtils;
|
||||
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||
import com.seer.teach.mp.mapper.MpAgentMapper;
|
||||
import com.seer.teach.mp.service.IMpAgentService;
|
||||
@ -32,7 +31,7 @@ public class MpAgentServiceImpl extends ServiceImpl<MpAgentMapper, MpAgentEntity
|
||||
@Override
|
||||
public Boolean saveAgent(MpAgentEntity agentEntity,String password) {
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setUserName(agentEntity.getAgentName());
|
||||
userInfoDTO.setUserName(agentEntity.getContactName());
|
||||
userInfoDTO.setPassword(password);
|
||||
userInfoDTO.setMobile(agentEntity.getContactPhone());
|
||||
userInfoDTO.setRoleCode(RoleEnum.AGENT);
|
||||
|
||||
@ -2,11 +2,7 @@ package com.seer.teach.user.api;
|
||||
|
||||
import com.seer.teach.user.api.dto.*;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -193,4 +189,16 @@ public interface UserInfoServiceApi {
|
||||
@GetMapping("/getUserIdByUserName")
|
||||
Integer getUserIdByUserName(@RequestParam("userName") String userName);
|
||||
|
||||
@GetMapping("/getUserIdsByUserNameLike")
|
||||
List< Integer> getUserIdsByUserNameLike(@RequestParam("userName") String userName);
|
||||
|
||||
@GetMapping("/getUserIdByMobile")
|
||||
boolean getUserIdByMobile(@RequestParam("mobile") String mobile);
|
||||
|
||||
@DeleteMapping("/deleteUserRoleByUserIds")
|
||||
boolean deleteUserRoleByUserId(@RequestParam("userIds") List<Integer> userIds);
|
||||
|
||||
@DeleteMapping("/deleteUserRoleByUserId")
|
||||
boolean deleteUserRoleByUserId(@RequestParam("userId") Integer userId);
|
||||
|
||||
}
|
||||
@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.seer.teach.common.entity.BaseEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -21,6 +19,8 @@ import lombok.Setter;
|
||||
@TableName("za_user_role")
|
||||
@Schema(name = "UserRoleEntity对象", description = "")
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserRoleEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
|
||||
@ -3,9 +3,9 @@ package com.seer.teach.user.admin.api;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.seer.teach.common.dto.mq.im.MqUserInfoDTO;
|
||||
import com.seer.teach.common.enums.im.ImMqTopicEnum;
|
||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||
import com.seer.teach.common.enums.RoleEnum;
|
||||
import com.seer.teach.common.enums.im.ImMqTopicEnum;
|
||||
import com.seer.teach.common.enums.im.UserInfoTopiTagEnum;
|
||||
import com.seer.teach.common.enums.iot.IsInfoEnum;
|
||||
import com.seer.teach.common.exception.CommonException;
|
||||
@ -222,8 +222,16 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
||||
|
||||
@Override
|
||||
public boolean updateUserInfo(UserInfoDTO userInfoDTO) {
|
||||
UserEntity UserEntity = UserInfoConvert.INSTANCE.convertOne(userInfoDTO);
|
||||
return userService.updateById(UserEntity);
|
||||
UserEntity oldUser = userService.getById(userInfoDTO.getId());
|
||||
UserEntity userEntity = UserInfoConvert.INSTANCE.convertOne(userInfoDTO);
|
||||
// 密码加密(只有传入的密码不为空时,才加密并更新,否则保留原密码)
|
||||
if (StringUtils.hasText(userInfoDTO.getPassword())) {
|
||||
userEntity.setPassword(CommonUtils.encryptPassword(userInfoDTO.getPassword()));
|
||||
} else {
|
||||
// 保留原密码
|
||||
userEntity.setPassword(oldUser.getPassword());
|
||||
}
|
||||
return userService.updateById(userEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -308,6 +316,45 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
||||
return userEntity.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getUserIdsByUserNameLike(String userName) {
|
||||
return userService.lambdaQuery().select(UserEntity::getId).like(UserEntity::getUserName, userName)
|
||||
.list().stream().map(UserEntity::getId).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getUserIdByMobile(String mobile) {
|
||||
UserEntity one = userService.lambdaQuery().eq(UserEntity::getMobile, mobile).one();
|
||||
return one == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteUserRoleByUserId(List<Integer> userIds) {
|
||||
log.info("删除用户角色,用户id{}", userIds);
|
||||
List<UserRoleEntity> userRolesList = userRoleService.lambdaQuery().in(UserRoleEntity::getUserId, userIds).list();
|
||||
List<Integer> ids = userRolesList.stream().map(UserRoleEntity::getId).filter(Objects::nonNull).toList();
|
||||
log.info("准备删除角色记录,ID列表: {}", ids);
|
||||
boolean result = userRoleService.removeByIds(ids);
|
||||
log.info("删除角色结果: {}", result);
|
||||
// 删除用户信息
|
||||
boolean userResult = userService.removeByIds(userIds);
|
||||
log.info("删除用户信息结果: {}", userResult);
|
||||
return result && userResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteUserRoleByUserId(Integer userId) {
|
||||
UserRoleEntity one = userRoleService.lambdaQuery().eq(UserRoleEntity::getUserId, userId).one();
|
||||
if (one != null) {
|
||||
// 删除用户信息
|
||||
userService.removeById(userId);
|
||||
// 删除用户角色
|
||||
return userRoleService.removeById(one);
|
||||
}
|
||||
log.info("用户角色不存在");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送更新孩子信息的MQ消息
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user