Compare commits
No commits in common. "29da542823a176eff269980abad268c4ef772ef9" and "54728dec3e9e3129e0b5f863e114307de6caa1ec" have entirely different histories.
29da542823
...
54728dec3e
@ -24,8 +24,6 @@ spring:
|
||||
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml
|
||||
- optional:nacos:shared-database.yaml
|
||||
- optional:nacos:shared-redis.yaml
|
||||
- optional:nacos:shared-sa-token.yaml
|
||||
- optional:nacos:shared-minio.yaml
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
|
||||
@ -58,10 +58,5 @@
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-redis-template</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1,4 +1,4 @@
|
||||
package com.seer.teach.admin.config;
|
||||
package com.seer.teach.common.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ -30,7 +30,6 @@ public enum ResultCodeEnum {
|
||||
USER_MOBILE_EXIST(1002, "该账号号已经被注册"),
|
||||
PHONE_IS_REPEAT(1009, "账号已被注册,请重新输入"),
|
||||
USER_NOT_FOUND(1003, "用户不存在"),
|
||||
USER_SAVE_ERROR(10031, "用户保存失败"),
|
||||
USER_PERMISSION_DENIED_ERROR(1004, "用户权限不足"),
|
||||
PLEASE_LOGIN(1005, "请先登录"),
|
||||
USERNAME_IS_REPEAT(1006, "用户名重复"),
|
||||
@ -329,7 +328,6 @@ 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, "活动不存在"),
|
||||
@ -339,11 +337,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, "数据重复"),
|
||||
DATA_NOT_EXIST(130015, "数据不存在");
|
||||
PARENT_ALREADY_SIGN_UP(130121, "已经报名参加该活动");
|
||||
|
||||
private int code;
|
||||
private String msg;
|
||||
|
||||
@ -45,12 +45,7 @@ public enum RoleEnum implements ArrayValuable<String> {
|
||||
/**
|
||||
* 访客
|
||||
*/
|
||||
GUEST("GUEST", "GUEST", "访客"),
|
||||
|
||||
/**
|
||||
* 代理商
|
||||
*/
|
||||
AGENT("AGENT", "代理商", "代理商角色");
|
||||
GUEST("GUEST", "GUEST", "访客"),;
|
||||
|
||||
public static final String[] ARRAYS = Arrays.stream(values()).map(RoleEnum::getCode).toArray(String[]::new);
|
||||
|
||||
|
||||
@ -115,23 +115,14 @@ public interface CommonFileService {
|
||||
String uploadTextBook(InputStream inputStream, String fileName, String folderName, String contentType);
|
||||
|
||||
/**
|
||||
* 通过输入流上传
|
||||
* 通过输入流上传视频
|
||||
*
|
||||
* @param inputStream 要上传的输入流
|
||||
* @param inputStream 要上传视频的输入流
|
||||
* @param folderName 文件夹名称
|
||||
* @return 文件在OSS上的访问地址
|
||||
* @return 视频在OSS上的访问地址
|
||||
*/
|
||||
String upload(InputStream inputStream,String bucketName, String folderName,String fileName,String contentType);
|
||||
|
||||
/**
|
||||
* 通过输入流上传
|
||||
*
|
||||
* @param inputStream 要上传的输入流
|
||||
* @param folderName 文件夹名称
|
||||
* @return 文件在OSS上的访问地址
|
||||
*/
|
||||
String upload(InputStream inputStream,String bucketName, String folderName,String contentType);
|
||||
|
||||
/**
|
||||
* 从MinIO下载文件
|
||||
*
|
||||
|
||||
@ -304,13 +304,6 @@ public class CommonFileServiceImpl implements CommonFileService {
|
||||
return MinioConfig.URL + "/" + bucketName + "/" + folderName + "/" + originalFilename;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String upload(InputStream inputStream, String bucketName, String folderName, String contentType) {
|
||||
String originalFilename = CommonUtils.generateUniqueFileName();
|
||||
minioService.upload(bucketName, folderName, originalFilename, inputStream, contentType);
|
||||
return MinioConfig.URL + "/" + bucketName + "/" + folderName + "/" + originalFilename;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从MinIO下载文件
|
||||
*
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -287,7 +287,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-redis-template</artifactId>
|
||||
<artifactId>sa-token-redis</artifactId>
|
||||
<version>${sa-token-version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ public class LoadBalancerConfig {
|
||||
String ip = Optional.ofNullable(exchange.getRequest().getRemoteAddress())
|
||||
.map(addr -> addr.getAddress().getHostAddress())
|
||||
.orElse("unknown");
|
||||
log.info("ipForwardFilter 请求来自客户端: {}", ip);
|
||||
log.info("请求来自客户端: {}", ip);
|
||||
ServerHttpRequest mutatedRequest = exchange.getRequest().mutate()
|
||||
.header("X-Forwarded-For", ip)
|
||||
.build();
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package com.seer.teach.filter.cors;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.server.RequestPath;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
import org.springframework.http.server.reactive.ServerHttpResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.reactive.CorsUtils;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
import org.springframework.web.server.WebFilter;
|
||||
import org.springframework.web.server.WebFilterChain;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CorsFilter implements WebFilter {
|
||||
|
||||
private static final String MAX_AGE = String.valueOf(1000 * 60 * 60 * 24);
|
||||
|
||||
@Override
|
||||
public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
|
||||
ServerHttpRequest request = exchange.getRequest();
|
||||
if (!CorsUtils.isCorsRequest(request)) {
|
||||
log.info("Not a CORS request");
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
RequestPath path = exchange.getRequest().getPath();
|
||||
log.info("request path: {},method : {}", path, request.getMethod());
|
||||
ServerHttpResponse response = exchange.getResponse();
|
||||
HttpHeaders headers = response.getHeaders();
|
||||
headers.add(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, CorsConfiguration.ALL);
|
||||
headers.add(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, CorsConfiguration.ALL);
|
||||
headers.add(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, CorsConfiguration.ALL);
|
||||
headers.add(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS, CorsConfiguration.ALL);
|
||||
headers.add(HttpHeaders.ACCESS_CONTROL_MAX_AGE, MAX_AGE);
|
||||
if (request.getMethod() == HttpMethod.OPTIONS) {
|
||||
response.setStatusCode(HttpStatus.OK);
|
||||
log.info("CORS preflight request,OK");
|
||||
return Mono.empty();
|
||||
}
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
|
||||
}
|
||||
@ -47,8 +47,6 @@ public class MpActivityEntity extends BaseEntity {
|
||||
@TableField("end_time")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 活动状态:0-禁用,1-启用
|
||||
*/
|
||||
|
||||
@ -2,10 +2,10 @@ 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;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
@ -18,7 +18,8 @@ import java.util.List;
|
||||
* @author Lingma
|
||||
* @since 2025-12-30
|
||||
*/
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("mp_activity_info_collection")
|
||||
@Schema(name = "MpActivityInfoCollectionEntity对象", description = "活动信息收集表")
|
||||
public class MpActivityInfoCollectionEntity extends BaseEntity {
|
||||
@ -57,7 +58,7 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
||||
* 孩子性别(M-男,F-女)
|
||||
*/
|
||||
@TableField("child_gender")
|
||||
private Integer childGender;
|
||||
private String childGender;
|
||||
|
||||
/**
|
||||
* 出生年月
|
||||
@ -69,7 +70,7 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
||||
* 年级
|
||||
*/
|
||||
@TableField("grade")
|
||||
private Integer grade;
|
||||
private String grade;
|
||||
|
||||
/**
|
||||
* 学校
|
||||
@ -77,12 +78,6 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
||||
@TableField("school")
|
||||
private String school;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@TableField("mobile")
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 地区
|
||||
*/
|
||||
@ -110,20 +105,13 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
||||
/**
|
||||
* 薄弱科目
|
||||
*/
|
||||
@TableField(value = "weak_subject_ids",typeHandler = JacksonTypeHandler.class)
|
||||
@TableField("weak_subject_ids")
|
||||
private List<Integer> weakSubjectIds;
|
||||
|
||||
/**
|
||||
* 优势科目
|
||||
*/
|
||||
@TableField(value = "strong_subject_ids",typeHandler = JacksonTypeHandler.class)
|
||||
@TableField("strong_subject_ids")
|
||||
private List<Integer> strongSubjectIds;
|
||||
|
||||
/**
|
||||
* 代理商拨打电话联系家长的次数
|
||||
*/
|
||||
@TableField("contact_call_count")
|
||||
private Integer contactCallCount = 0;
|
||||
|
||||
|
||||
}
|
||||
@ -44,10 +44,4 @@ public class MpAgentActivityParticipantEntity extends BaseEntity {
|
||||
*/
|
||||
@TableField("agent_name")
|
||||
private String agentName;
|
||||
|
||||
/**
|
||||
* 活动二维码 url
|
||||
*/
|
||||
@TableField("qr_code_url")
|
||||
private String qrCodeUrl;
|
||||
}
|
||||
@ -40,9 +40,6 @@ public class MpAgentEmployeeRelationEntity extends BaseEntity {
|
||||
@TableField("employee_name")
|
||||
private String employeeName;
|
||||
|
||||
@TableField("contact_phone")
|
||||
private String contactPhone;
|
||||
|
||||
/**
|
||||
* 员工职位
|
||||
*/
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.seer.teach.mp.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.seer.teach.common.entity.BaseEntity;
|
||||
import lombok.Data;
|
||||
@ -32,9 +31,6 @@ public class MpAgentEntity extends BaseEntity {
|
||||
*/
|
||||
private String contactName;
|
||||
|
||||
@TableField("contact_user_id")
|
||||
private Integer contactUserId;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
|
||||
@ -5,12 +5,11 @@ 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.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 com.seer.teach.mp.entity.MpAgentEntity;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -43,15 +42,15 @@ public class AdminAgentController {
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping
|
||||
@SaCheckPermission("mp:admin:agent:save")
|
||||
public ResultBean<Boolean> save(@RequestBody @Validated MpAgentSaveReq req) {
|
||||
return ResultBean.success(adminAgentService.saveAgent(req));
|
||||
public ResultBean<Boolean> save(@RequestBody MpAgentEntity agentEntity) {
|
||||
return ResultBean.success(adminAgentService.saveAgent(agentEntity));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新")
|
||||
@PutMapping
|
||||
@SaCheckPermission("mp:admin:agent:update")
|
||||
public ResultBean<Boolean> update(@RequestBody @Validated MpAgentReq req) {
|
||||
return ResultBean.success(adminAgentService.updateAgent(req));
|
||||
public ResultBean<Boolean> update(@RequestBody MpAgentEntity agentEntity) {
|
||||
return ResultBean.success(adminAgentService.updateAgent(agentEntity));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
|
||||
@ -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.AgentEmployeeUpdateReq;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
||||
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||
import com.seer.teach.mp.admin.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 AgentEmployeeUpdateReq request) {
|
||||
return ResultBean.success(agentEmployeeRelationService.update(request));
|
||||
public ResultBean<Boolean> update(@RequestBody @Validated AgentEmployeeRelationReq request) {
|
||||
return ResultBean.success(agentEmployeeRelationService.saveOrUpdateRelation(request));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除代理商员工关联")
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
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,9 +1,7 @@
|
||||
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
|
||||
@ -11,27 +9,17 @@ import lombok.Data;
|
||||
public class AgentEmployeeSaveReq {
|
||||
|
||||
|
||||
@Schema(description = "代理商Id")
|
||||
@NotNull(message = "代理商Id不能为空")
|
||||
private Integer agentId;
|
||||
@Schema(description = "代理商名称")
|
||||
@NotNull(message = "代理商名称不能为空")
|
||||
private String agentName;
|
||||
|
||||
@Schema(description = "员工名称")
|
||||
@NotBlank(message = "员工名称不能为空")
|
||||
@NotNull(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;
|
||||
|
||||
}
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@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;
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@ -23,9 +23,6 @@ public class AgentEmployeeRelationResp {
|
||||
@Schema(description = "员工名称")
|
||||
private String employeeName;
|
||||
|
||||
@Schema(description = "员工手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "员工职位")
|
||||
private String position;
|
||||
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
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;
|
||||
@ -16,11 +15,10 @@ public interface AdminAgentEmployeeRelationConvert {
|
||||
|
||||
AdminAgentEmployeeRelationConvert INSTANCE = Mappers.getMapper(AdminAgentEmployeeRelationConvert.class);
|
||||
|
||||
MpAgentEmployeeRelationEntity convert(AgentEmployeeUpdateReq req);
|
||||
MpAgentEmployeeRelationEntity convert(AgentEmployeeRelationReq req);
|
||||
|
||||
MpAgentEmployeeRelationEntity convert(AgentEmployeeRelationQueryReq req);
|
||||
|
||||
@Mapping(source = "contactPhone", target = "mobile")
|
||||
AgentEmployeeRelationResp convertToResp(MpAgentEmployeeRelationEntity entity);
|
||||
|
||||
List<AgentEmployeeRelationResp> convertToRespList(List<MpAgentEmployeeRelationEntity> mpAgentEmployeeRelationEntities);
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
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;
|
||||
@ -21,9 +19,5 @@ public interface AgentConvert {
|
||||
|
||||
MpAgentEntity convertOne(AgentQueryReq req);
|
||||
|
||||
MpAgentEntity convertOne2Entity(MpAgentReq req);
|
||||
|
||||
MpAgentEntity convertOneSave(MpAgentSaveReq req);
|
||||
|
||||
AgentQueryReq convertToReq(MpAgentEntity entity);
|
||||
}
|
||||
@ -4,18 +4,12 @@ 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;
|
||||
@ -30,8 +24,6 @@ public class AdminAgentService {
|
||||
|
||||
private final IMpAgentService mpAgentService;
|
||||
|
||||
private final UserInfoServiceApi userInfoServiceApi;
|
||||
|
||||
/**
|
||||
* 获取代理商列表
|
||||
*
|
||||
@ -67,14 +59,11 @@ public class AdminAgentService {
|
||||
/**
|
||||
* 保存代理商
|
||||
*
|
||||
* @param req 代理商
|
||||
* @param agentEntity 代理商实体
|
||||
* @return 是否成功
|
||||
*/
|
||||
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());
|
||||
public Boolean saveAgent(MpAgentEntity agentEntity) {
|
||||
boolean result = mpAgentService.saveAgent(agentEntity);
|
||||
log.info("保存代理商结果: {}", result);
|
||||
return result;
|
||||
}
|
||||
@ -82,35 +71,13 @@ public class AdminAgentService {
|
||||
/**
|
||||
* 更新代理商
|
||||
*
|
||||
* @param req 代理商
|
||||
* @param agentEntity 代理商实体
|
||||
* @return 是否成功
|
||||
*/
|
||||
public Boolean updateAgent(MpAgentReq req) {
|
||||
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);
|
||||
public Boolean updateAgent(MpAgentEntity agentEntity) {
|
||||
boolean result = mpAgentService.updateAgent(agentEntity);
|
||||
log.info("更新代理商结果: {}", result);
|
||||
return result && updateUserResult;
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -76,7 +76,7 @@ public class AdminDealerApplicationsService {
|
||||
userInfoDTO.setRealName(application.getApplicantName());
|
||||
userInfoDTO.setMobile(application.getPhone());
|
||||
userInfoDTO.setIdCardNumber(application.getIdCardNumber());
|
||||
userInfoDTO.setRoleCode(RoleEnum.DISTRIBUTOR);
|
||||
userInfoDTO.setRoleCode(RoleEnum.DISTRIBUTOR.getCode());
|
||||
boolean updated = userInfoServiceApi.updateUserInfoAndAssignRole(userInfoDTO);
|
||||
log.info("更新用户[{}]信息结果: {}",application.getApplicantUserId(), updated);
|
||||
if(updated){
|
||||
|
||||
@ -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 update(AgentEmployeeUpdateReq request);
|
||||
boolean saveOrUpdateRelation(AgentEmployeeRelationReq request);
|
||||
|
||||
/**
|
||||
* 删除代理商员工关联(管理端)
|
||||
|
||||
@ -4,22 +4,20 @@ 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.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,7 +32,6 @@ import java.util.Objects;
|
||||
* @since 2025-12-30
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmployeeRelationService {
|
||||
|
||||
@ -56,33 +53,9 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
||||
}
|
||||
|
||||
@Override
|
||||
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;
|
||||
public boolean saveOrUpdateRelation(AgentEmployeeRelationReq request) {
|
||||
MpAgentEmployeeRelationEntity entity = AdminAgentEmployeeRelationConvert.INSTANCE.convert(request);
|
||||
return agentEmployeeRelationService.saveOrUpdateRelation(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,20 +82,15 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
||||
MpAgentEmployeeRelationEntity one = agentEmployeeRelationService.lambdaQuery()
|
||||
.eq(MpAgentEmployeeRelationEntity::getEmployeeName, request.getEmployeeName()).one();
|
||||
AssertUtils.isNull(one, ResultCodeEnum.AGENT_EMPLOYEE_ALREADY_EXISTS);
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setUserName(request.getEmployeeName());
|
||||
userInfoDTO.setPassword(request.getPassword());
|
||||
userInfoDTO.setMobile(request.getMobile());
|
||||
userInfoDTO.setRoleCode(RoleEnum.AGENT);
|
||||
Integer userId = userInfoServiceApi.addUserInfoAndAssignRole(userInfoDTO);
|
||||
Integer agentId = mpAgentService.lambdaQuery().eq(MpAgentEntity::getAgentName, request.getAgentName()).one().getId();
|
||||
Integer employeeId = userInfoServiceApi.getUserIdByUserName(request.getEmployeeName());
|
||||
MpAgentEmployeeRelationEntity entity = new MpAgentEmployeeRelationEntity();
|
||||
entity.setAgentId(request.getAgentId());
|
||||
entity.setAgentName(mpAgentService.getById(request.getAgentId()).getAgentName());
|
||||
entity.setEmployeeUserId(userId);
|
||||
entity.setAgentId(agentId);
|
||||
entity.setEmployeeUserId(employeeId);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -24,8 +24,6 @@ spring:
|
||||
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml
|
||||
- optional:nacos:shared-database.yaml
|
||||
- optional:nacos:shared-redis.yaml
|
||||
- optional:nacos:shared-sa-token.yaml
|
||||
- optional:nacos:shared-minio.yaml
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
|
||||
@ -67,7 +67,6 @@ CREATE TABLE `mp_agent_activity_participant` (
|
||||
`activity_id` int DEFAULT NULL COMMENT '活动ID',
|
||||
`activity_name` varchar(100) NOT NULL COMMENT '活动名称',
|
||||
`agent_name` varchar(100) NOT NULL COMMENT '代理商名称',
|
||||
`qr_code_url` varchar(255) NOT NULL COMMENT '二维码url',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
@ -131,16 +130,15 @@ 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` int COMMENT '孩子性别(1-男,0-女)',
|
||||
`child_gender` varchar(10) COMMENT '孩子性别(M-男,F-女)',
|
||||
`child_birth_date` date COMMENT '出生年月',
|
||||
`grade` int COMMENT '年级',
|
||||
`grade` varchar(20) COMMENT '年级',
|
||||
`school` varchar(255) COMMENT '学校',
|
||||
`mobile` varchar(20) COMMENT '手机号',
|
||||
`region` varchar(255) COMMENT '地区',
|
||||
`parent_identity` varchar(20) COMMENT '家长身份(爸爸,妈妈)',
|
||||
`learning_situation` varchar(20) COMMENT '学习情况(优、良、中、差)',
|
||||
`weak_subject_ids` json COMMENT '薄弱科目',
|
||||
`strong_subject_ids` json COMMENT '优势科目',
|
||||
`weak_subject_ids` varchar(50) COMMENT '薄弱科目',
|
||||
`strong_subject_ids` varchar(50) COMMENT '优势科目',
|
||||
`weak_subject` varchar(50) COMMENT '偏科(数学、英语等)',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||
|
||||
@ -25,12 +25,6 @@
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>seer-user-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
@ -52,16 +46,6 @@
|
||||
<artifactId>lombok-mapstruct-binding</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>seer-teacher-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>seer-teacher-service</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -16,7 +16,6 @@ import lombok.RequiredArgsConstructor;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
@ -34,7 +33,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@EncryptionAnnotation
|
||||
@DecryptionAnnotation
|
||||
@RequiredArgsConstructor
|
||||
public class AppMpActivityController {
|
||||
public class AppAgentActivityController {
|
||||
|
||||
private final IAppActivityService agentActivityService;
|
||||
|
||||
@ -52,12 +51,4 @@ public class AppMpActivityController {
|
||||
public ResultBean<AppActivityResp> getDetail(@PathVariable Integer id) {
|
||||
return ResultBean.success(agentActivityService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "活动二维码")
|
||||
@GetMapping("/{agentId}/{activityId}/qrcode")
|
||||
@SaCheckPermission("mp:app:agent:activity:qrcode")
|
||||
public ResultBean<String> getQrCode(@PathVariable("agentId") Integer agentId, @PathVariable("activityId") Integer activityId, @RequestParam("appId") String appId) {
|
||||
Integer userId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(agentActivityService.getQrCode(userId,agentId,activityId,appId));
|
||||
}
|
||||
}
|
||||
@ -2,24 +2,22 @@ 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.DecryptionAnnotation;
|
||||
import com.seer.teach.common.annotation.EncryptionAnnotation;
|
||||
import com.seer.teach.common.annotation.LogPrint;
|
||||
import com.seer.teach.mp.app.controller.req.AgentActivityParentQueryReq;
|
||||
import com.seer.teach.mp.app.controller.req.RecordContactCallReq;
|
||||
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.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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 代理商活动参与家长信息App控制器
|
||||
@ -40,18 +38,12 @@ public class AppAgentActivityParentInfoController {
|
||||
private final IAppAgentActivityParentInfoService agentActivityParentInfoService;
|
||||
|
||||
@Operation(summary = "获取参加指定活动的家长列表")
|
||||
@PostMapping("/page-list")
|
||||
@GetMapping("/getActivityParents")
|
||||
@SaCheckLogin
|
||||
public ResultBean<PageListBean<AgentActivityParentInfoResp>> getActivityParents(@RequestBody @Valid AgentActivityParentQueryReq queryReq) {
|
||||
public ResultBean<List<AgentActivityParentInfoResp>> getActivityParents(
|
||||
@RequestParam("activityId") Integer activityId,
|
||||
@RequestParam("agentId") Integer agentId) {
|
||||
Integer userId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(agentActivityParentInfoService.getParentsByActivityAndAgent(userId, queryReq));
|
||||
}
|
||||
|
||||
@Operation(summary = "记录代理商拨打电话联系家长的次数")
|
||||
@PostMapping("/record-contact-call")
|
||||
@SaCheckLogin
|
||||
public ResultBean<Boolean> recordContactCall(@RequestBody @Valid RecordContactCallReq req) {
|
||||
Integer userId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(agentActivityParentInfoService.recordContactCall(req.getCollectionId(), req.getIncrementCount(),userId));
|
||||
return ResultBean.success(agentActivityParentInfoService.getParentsByActivityAndAgent(activityId, agentId,userId));
|
||||
}
|
||||
}
|
||||
@ -6,15 +6,12 @@ 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.req.AppMpAgentActivityQrCodeQueryReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
||||
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.GetMapping;
|
||||
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;
|
||||
@ -29,7 +26,7 @@ import java.util.List;
|
||||
* @author Lingma
|
||||
* @since 2025-12-29
|
||||
*/
|
||||
@Tag(name = "APP - 代理商参与活动")
|
||||
@Tag(name = "APP - 代理商参与活动记录")
|
||||
@RestController
|
||||
@RequestMapping("/app/agent/activity/participant")
|
||||
@LogPrint
|
||||
@ -47,12 +44,4 @@ public class AppAgentActivityParticipantController {
|
||||
Integer userId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(agentActivityParticipantService.getParticipantsByActivityAndAgent(agentId,userId));
|
||||
}
|
||||
|
||||
@Operation(summary = "获取代理参与活动的二维码")
|
||||
@PostMapping("/qrcode")
|
||||
@SaCheckPermission("mp:app:agent:activity:qrcode")
|
||||
public ResultBean<String> getQrCode(@RequestBody AppMpAgentActivityQrCodeQueryReq req) {
|
||||
Integer userId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(agentActivityParticipantService.getQrCode(req,userId));
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
package com.seer.teach.mp.app.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.seer.teach.common.ResultBean;
|
||||
import com.seer.teach.common.annotation.DecryptionAnnotation;
|
||||
@ -38,7 +37,6 @@ public class AppAgentController {
|
||||
|
||||
@Operation(summary = "获取代理商详情")
|
||||
@GetMapping("/detail")
|
||||
@SaCheckPermission("mp:app:agent:detail")
|
||||
public ResultBean<AppMpAgentResp> getAgent() {
|
||||
Integer userId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appAgentService.getAgentRespByUserId(userId));
|
||||
|
||||
@ -1,83 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckLogin;
|
||||
import com.seer.teach.common.PageListBean;
|
||||
import com.seer.teach.common.ResultBean;
|
||||
import com.seer.teach.common.annotation.LogPrint;
|
||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||
import com.seer.teach.mp.app.controller.req.AppAgentEmployeeRelationQueryReq;
|
||||
import com.seer.teach.mp.app.controller.req.AppAgentEmployeeRelationReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AppAgentEmployeeRelationResp;
|
||||
import com.seer.teach.mp.app.service.IAppAgentEmployeeRelationService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@LogPrint
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@Tag(name = "App - 代理商员工管理")
|
||||
@RequestMapping("/app/agent/employee")
|
||||
public class AppAgentEmployeeRelationController {
|
||||
|
||||
private final IAppAgentEmployeeRelationService agentEmployeeRelationService;
|
||||
|
||||
@Operation(summary = "我的员工列表")
|
||||
@PostMapping("/page-list")
|
||||
@SaCheckLogin
|
||||
public ResultBean<PageListBean<AppAgentEmployeeRelationResp>> pageList(@RequestBody @Validated AppAgentEmployeeRelationQueryReq query) {
|
||||
return ResultBean.success(agentEmployeeRelationService.pageList(query));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增员工")
|
||||
@PostMapping("/add")
|
||||
@SaCheckLogin
|
||||
public ResultBean<Boolean> addEmployee(@RequestBody @Validated AppAgentEmployeeRelationReq request) {
|
||||
return ResultBean.success(agentEmployeeRelationService.addEmployee(request));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新员工信息")
|
||||
@PostMapping("/update")
|
||||
@SaCheckLogin
|
||||
public ResultBean<Boolean> updateEmployee(@RequestBody @Validated AppAgentEmployeeRelationReq request) {
|
||||
boolean belongsToAgent = agentEmployeeRelationService.isEmployeeBelongsToAgent(request.getId(),request.getAgentId());
|
||||
if (!belongsToAgent) {
|
||||
return ResultBean.error(ResultCodeEnum.UNAUTHORIZED_UPDATE_EMPLOYEE);
|
||||
}
|
||||
return ResultBean.success(agentEmployeeRelationService.updateEmployee(request));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除员工")
|
||||
@DeleteMapping("/{id}")
|
||||
@SaCheckLogin
|
||||
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);
|
||||
}
|
||||
return ResultBean.success(agentEmployeeRelationService.deleteEmployee(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "员工详情")
|
||||
@GetMapping("/{id}")
|
||||
@SaCheckLogin
|
||||
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);
|
||||
}
|
||||
AppAgentEmployeeRelationResp result = agentEmployeeRelationService.getById(id);
|
||||
return ResultBean.success(result);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取所有员工列表")
|
||||
@GetMapping("/all")
|
||||
@SaCheckLogin
|
||||
public ResultBean<List<AppAgentEmployeeRelationResp>> getAllEmployees(@RequestParam Integer agentId) {
|
||||
return ResultBean.success(agentEmployeeRelationService.getAllEmployeesByAgentId(agentId));
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
package com.seer.teach.mp.app.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.seer.teach.common.ResultBean;
|
||||
import com.seer.teach.common.annotation.DecryptionAnnotation;
|
||||
import com.seer.teach.common.annotation.EncryptionAnnotation;
|
||||
@ -39,7 +38,6 @@ public class AppMpQrCodeController {
|
||||
*/
|
||||
@Operation(summary = "生成微信服务号二维码")
|
||||
@PostMapping("/official/generate")
|
||||
@SaCheckPermission("mp:app:qrcode:generate")
|
||||
public ResultBean<MpQrCodeResp> generateOfficialQrCode(@Valid @RequestBody MpGenerateQrCodeReq req) {
|
||||
return ResultBean.success(appOfficialQrCodeService.generateQrCode(req));
|
||||
}
|
||||
@ -50,9 +48,8 @@ public class AppMpQrCodeController {
|
||||
*/
|
||||
@Operation(summary = "生成微信小程序二维码")
|
||||
@PostMapping("/mini/generate")
|
||||
@SaCheckPermission("mp:app:qrcode:mini-generate")
|
||||
public ResultBean<String> generateQrCode(@Valid @RequestBody GetQrCodeReq reqParams) {
|
||||
OssImageUploadResp resp = wechatMiniProgramService.createQrcode(reqParams);
|
||||
return ResultBean.success(resp.getUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
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.req.JsapiSignatureReq;
|
||||
import com.seer.teach.mp.app.controller.resp.JsapiSignatureResp;
|
||||
import com.seer.teach.mp.app.service.IAppMpSignatureService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
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;
|
||||
|
||||
@EncryptionAnnotation
|
||||
@DecryptionAnnotation
|
||||
@Tag(name = "APP - 微信JS-SDK签名")
|
||||
@RestController
|
||||
@RequestMapping("/app/signature")
|
||||
@LogPrint
|
||||
@RequiredArgsConstructor
|
||||
public class AppMpSignatureController {
|
||||
|
||||
private final IAppMpSignatureService appMpSignatureService;
|
||||
|
||||
@Operation(summary = "生成JS-SDK签名")
|
||||
@PostMapping("/jsapi")
|
||||
@SaCheckPermission("mp:app:signature:jsapi")
|
||||
public ResultBean<JsapiSignatureResp> generateJsapiSignature(@Valid @RequestBody JsapiSignatureReq req) {
|
||||
JsapiSignatureResp resp = appMpSignatureService.generateJsapiSignature(req);
|
||||
return ResultBean.success(resp);
|
||||
}
|
||||
}
|
||||
@ -4,15 +4,11 @@ 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.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.service.AppParentAgentActivityService;
|
||||
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;
|
||||
@ -24,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
/**
|
||||
* 家长参与代理商活动控制器 - 应用端
|
||||
*/
|
||||
@Tag(name = "App - 家长参与代理商活动管理")
|
||||
@Tag(name = "应用端 - 家长参与代理商活动管理")
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/app/parent/agent/activity")
|
||||
@ -35,7 +31,7 @@ public class AppParentAgentActivityController {
|
||||
@PostMapping("/sign-up")
|
||||
@SaCheckLogin
|
||||
@Operation(summary = "家长报名参加代理商活动")
|
||||
public ResultBean<Boolean> signUpForActivity(@RequestBody @Validated AppMpSignUpActivityReq request) {
|
||||
public ResultBean<Boolean> signUpForActivity(@RequestBody AppMpSignUpActivityReq request) {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appParentAgentActivityService.signUpForActivityWithInfo(request, parentId));
|
||||
}
|
||||
@ -43,7 +39,7 @@ public class AppParentAgentActivityController {
|
||||
@PostMapping("/update-info")
|
||||
@SaCheckLogin
|
||||
@Operation(summary = "家长更新活动信息")
|
||||
public ResultBean<Boolean> updateActivityInfo(@RequestBody @Validated AppMpSignUpActivityReq request) {
|
||||
public ResultBean<Boolean> updateActivityInfo(@RequestBody AppMpSignUpActivityReq request) {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appParentAgentActivityService.updateActivityInfo(request, parentId));
|
||||
}
|
||||
@ -63,12 +59,4 @@ public class AppParentAgentActivityController {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appParentAgentActivityService.getByActivityIdAndParentId(agentId,activityId,parentId));
|
||||
}
|
||||
|
||||
@PostMapping("/test-child-character")
|
||||
@SaCheckLogin
|
||||
@Operation(summary = "测试孩子性格")
|
||||
public ResultBean<TestChildCharacterResp> testChildCharacter(@RequestBody @Valid TestChildCharacterReq request) {
|
||||
Integer parentId = StpUtil.getLoginIdAsInt();
|
||||
return ResultBean.success(appParentAgentActivityService.testChildCharacter(request, parentId));
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller.req;
|
||||
|
||||
import com.seer.teach.common.request.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(name = "AgentActivityParentQueryReq", description = "代理商活动家长查询请求参数")
|
||||
@Data
|
||||
public class AgentActivityParentQueryReq extends PageRequest {
|
||||
|
||||
@Schema(description = "活动ID")
|
||||
private Integer activityId;
|
||||
|
||||
@Schema(description = "代理商ID")
|
||||
private Integer agentId;
|
||||
}
|
||||
@ -4,17 +4,13 @@ import com.seer.teach.common.request.PageRequest;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(name = "AppAgentEmployeeRelationQueryReq", description = "代理商员工关联查询请求参数")
|
||||
@Data
|
||||
public class AppAgentEmployeeRelationQueryReq extends PageRequest {
|
||||
|
||||
|
||||
@Schema(description = "员工职位")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "员工名称")
|
||||
private String employeeName;
|
||||
}
|
||||
@ -1,32 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(name = "AppAgentEmployeeRelationReq", description = "App端代理商员工关联请求参数")
|
||||
@Data
|
||||
public class AppAgentEmployeeRelationReq {
|
||||
|
||||
@Schema(description = "关联ID")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "代理商ID")
|
||||
private Integer agentId;
|
||||
|
||||
@Schema(description = "员工名称")
|
||||
private String employeeName;
|
||||
|
||||
@Schema(description = "员工密码")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "员工手机号")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "请输入正确的手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "员工职位")
|
||||
private String position;
|
||||
|
||||
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||
private Integer status = 1;
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "App 代理商活动二维码查询请求参数")
|
||||
public class AppMpAgentActivityQrCodeQueryReq {
|
||||
|
||||
@Schema(description = "代理商id",example = "1")
|
||||
private Integer agentId;
|
||||
|
||||
@Schema(description = "活动id",example = "1")
|
||||
private Integer activityId;
|
||||
|
||||
@Schema(description = "公众号appId",example = "wx1234567890")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "二维码类型 1:临时 2:永久",example = "1")
|
||||
private Integer qrCodeType;
|
||||
}
|
||||
@ -1,19 +1,16 @@
|
||||
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;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(name = "AppMpSignUpActivityReq", description = "家长报名参加代理商活动Req")
|
||||
@Data
|
||||
public class AppMpSignUpActivityReq {
|
||||
|
||||
@Schema (description = "ID")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "活动ID")
|
||||
private Integer activityId;
|
||||
|
||||
@ -21,7 +18,6 @@ public class AppMpSignUpActivityReq {
|
||||
private Integer agentId;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "请输入正确的手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "孩子姓名")
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* JS-SDK签名请求参数
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "JS-SDK签名请求参数")
|
||||
public class JsapiSignatureReq {
|
||||
|
||||
@NotEmpty(message = "URL不能为空")
|
||||
@Schema(description = "当前网页的URL,不包含#及其后面部分")
|
||||
private String url;
|
||||
|
||||
@NotEmpty(message = "appId不能为空")
|
||||
@Schema(description = "公众号的唯一标识")
|
||||
private String appId;
|
||||
}
|
||||
@ -14,8 +14,5 @@ public class MpGenerateQrCodeReq {
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "二维码类型 1-临时 2-永久")
|
||||
private Integer type = 2;
|
||||
|
||||
@Schema(description = "二维码有效期")
|
||||
private Integer expireSeconds;
|
||||
private Integer type;
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "记录代理商拨打电话联系家长次数请求对象")
|
||||
@Data
|
||||
public class RecordContactCallReq {
|
||||
|
||||
@NotNull(message = "活动信息收集记录ID不能为空")
|
||||
@Schema(description = "活动信息收集记录ID")
|
||||
private Integer collectionId;
|
||||
|
||||
@Schema(description = "增加的联系次数,默认为1")
|
||||
private Integer incrementCount = 1;
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Schema(description = "测试孩子性格请求对象")
|
||||
@Data
|
||||
public class TestChildCharacterReq {
|
||||
|
||||
@NotNull(message = "孩子性别不能为空")
|
||||
@Schema(description = "孩子性别(男,女)")
|
||||
private String childGender;
|
||||
|
||||
@NotNull(message = "出生年月不能为空")
|
||||
@Schema(description = "出生年月")
|
||||
private LocalDate childBirthDate;
|
||||
|
||||
@Schema(description = "星座")
|
||||
private String constellation;
|
||||
|
||||
@NotNull(message = "年级不能为空")
|
||||
@Schema(description = "年级")
|
||||
private String grade;
|
||||
|
||||
@NotNull(message = "学习情况不能为空")
|
||||
@Schema(description = "学习情况(优、良、中、差)")
|
||||
private String learningSituation;
|
||||
|
||||
@NotNull(message = "偏科情况不能为空")
|
||||
@Schema(description = "偏科(数学、英语等)")
|
||||
private String weakSubject;
|
||||
}
|
||||
@ -28,21 +28,18 @@ public class AgentActivityParentInfoResp {
|
||||
@Schema(description = "孩子姓名")
|
||||
private String childName;
|
||||
|
||||
@Schema(description = "孩子性别(1-男,0-女)")
|
||||
private Integer childGender;
|
||||
@Schema(description = "孩子性别(M-男,F-女)")
|
||||
private String childGender;
|
||||
|
||||
@Schema(description = "出生年月")
|
||||
private LocalDate childBirthDate;
|
||||
|
||||
@Schema(description = "年级")
|
||||
private Integer grade;
|
||||
private String grade;
|
||||
|
||||
@Schema(description = "学校")
|
||||
private String school;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "地区")
|
||||
private String region;
|
||||
|
||||
@ -58,8 +55,5 @@ public class AgentActivityParentInfoResp {
|
||||
@Schema(description = "劣势学科ID列表")
|
||||
private List<Integer> weakSubjectIds;
|
||||
|
||||
@Schema(description = "代理商拨打电话联系家长的次数")
|
||||
private Integer contactCallCount;
|
||||
|
||||
|
||||
}
|
||||
@ -27,7 +27,4 @@ public class AppMpAgentResp {
|
||||
|
||||
@Schema(description = "代理商地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "是否是代理商联系人")
|
||||
private Boolean isContactPerson;
|
||||
}
|
||||
|
||||
@ -39,9 +39,6 @@ public class AppMpSignUpActivityResp {
|
||||
@Schema(description = "学校")
|
||||
private String school;
|
||||
|
||||
@Schema(description = "手机号码")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "地区")
|
||||
private String region;
|
||||
|
||||
@ -53,7 +50,4 @@ public class AppMpSignUpActivityResp {
|
||||
|
||||
@Schema(description = "薄弱科目")
|
||||
private String weakSubject;
|
||||
|
||||
@Schema(description = "代理商拨打电话联系家长的次数")
|
||||
private Integer contactCallCount;
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* JS-SDK签名响应参数
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "JS-SDK签名响应参数")
|
||||
public class JsapiSignatureResp {
|
||||
|
||||
@Schema(description = "生成签名的时间戳")
|
||||
private Long timestamp;
|
||||
|
||||
@Schema(description = "生成签名的随机串")
|
||||
private String nonceStr;
|
||||
|
||||
@Schema(description = "签名")
|
||||
private String signature;
|
||||
|
||||
@Schema(description = "公众号的唯一标识")
|
||||
private String appId;
|
||||
|
||||
public JsapiSignatureResp() {
|
||||
}
|
||||
|
||||
public JsapiSignatureResp(Long timestamp, String nonceStr, String signature, String appId) {
|
||||
this.timestamp = timestamp;
|
||||
this.nonceStr = nonceStr;
|
||||
this.signature = signature;
|
||||
this.appId = appId;
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package com.seer.teach.mp.app.controller.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "测试孩子性格响应对象")
|
||||
@Data
|
||||
public class TestChildCharacterResp {
|
||||
|
||||
@Schema(description = "性格分析结果")
|
||||
private String characterAnalysis;
|
||||
|
||||
@Schema(description = "性格特征")
|
||||
private String characterTraits;
|
||||
|
||||
@Schema(description = "建议")
|
||||
private String suggestions;
|
||||
|
||||
@Schema(description = "性格类型")
|
||||
private String characterType;
|
||||
}
|
||||
@ -3,8 +3,7 @@ package com.seer.teach.mp.app.convert;
|
||||
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.apache.ibatis.annotations.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
@ -12,20 +11,7 @@ public interface AppMpActivityInfoCollectionConvert {
|
||||
|
||||
AppMpActivityInfoCollectionConvert INSTANCE = Mappers.getMapper(AppMpActivityInfoCollectionConvert.class);
|
||||
|
||||
/**
|
||||
* 实体转换成响应参数
|
||||
* @param entity 实体
|
||||
* @return 响应参数
|
||||
*/
|
||||
@Mapping(source = "mobile", target = "mobile")
|
||||
@Mapping(source = "contactCallCount", target = "contactCallCount")
|
||||
AppMpSignUpActivityResp convert2Resp(MpActivityInfoCollectionEntity entity);
|
||||
|
||||
|
||||
/**
|
||||
* 请求参数转换成实体
|
||||
* @param request 请求参数
|
||||
* @return 实体
|
||||
*/
|
||||
MpActivityInfoCollectionEntity convertOne2Entity(AppMpSignUpActivityReq request);
|
||||
MpActivityInfoCollectionEntity convert2Entity(AppMpSignUpActivityReq request);
|
||||
}
|
||||
@ -4,9 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||
import com.seer.teach.common.utils.AssertUtils;
|
||||
import com.seer.teach.mp.app.controller.req.AppMpSignUpActivityReq;
|
||||
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;
|
||||
@ -18,42 +16,31 @@ 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.teacher.service.AiModelCallService;
|
||||
import com.seer.teach.teacher.service.platform.LlmResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Objects;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AppParentAgentActivityService implements IAppParentAgentActivityService {
|
||||
public class AppParentAgentActivityService {
|
||||
|
||||
private final IMpParentAgentActivityRelationService parentAgentActivityRelationService;
|
||||
|
||||
private final IMpActivityInfoCollectionService activityInfoCollectionService;
|
||||
|
||||
private final IMpActivityService activityService;
|
||||
|
||||
private final IMpAgentService agentService;
|
||||
|
||||
private final IMpAgentActivityParticipantService mpAgentActivityParticipantService;
|
||||
|
||||
private final AiModelCallService aiModelCallService;
|
||||
|
||||
/**
|
||||
* 报名活动
|
||||
*
|
||||
* @param request 报名信息
|
||||
* @param request 报名信息
|
||||
* @param parentId 家长ID
|
||||
* @return true表示成功,false表示失败
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class, timeout = 120)
|
||||
public boolean signUpForActivityWithInfo(AppMpSignUpActivityReq request, Integer parentId) {
|
||||
Integer agentId = request.getAgentId();
|
||||
Integer activityId = request.getActivityId();
|
||||
@ -80,10 +67,9 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
boolean saved = parentAgentActivityRelationService.save(relation);
|
||||
log.info("报名结果:{},关系ID:{}", saved, relation.getId());
|
||||
|
||||
if (saved) {
|
||||
MpActivityInfoCollectionEntity mpActivityInfoCollectionEntity = AppMpActivityInfoCollectionConvert.INSTANCE.convertOne2Entity(request);
|
||||
if(saved){
|
||||
MpActivityInfoCollectionEntity mpActivityInfoCollectionEntity = AppMpActivityInfoCollectionConvert.INSTANCE.convert2Entity(request);
|
||||
mpActivityInfoCollectionEntity.setRelationId(relation.getId());
|
||||
mpActivityInfoCollectionEntity.setParentId(parentId);
|
||||
boolean activityInfoCollectionResult = activityInfoCollectionService.save(mpActivityInfoCollectionEntity);
|
||||
log.info("活动信息收集结果:{}", activityInfoCollectionResult);
|
||||
return activityInfoCollectionResult;
|
||||
@ -94,33 +80,19 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
/**
|
||||
* 更新活动信息
|
||||
*
|
||||
* @param request 活动信息
|
||||
* @param request 活动信息
|
||||
* @param parentId 家长ID
|
||||
* @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);
|
||||
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);
|
||||
|
||||
MpActivityInfoCollectionEntity mpActivityInfoCollectionEntity = AppMpActivityInfoCollectionConvert.INSTANCE.convert2Entity(request);
|
||||
mpActivityInfoCollectionEntity.setRelationId(relation.getId());
|
||||
return activityInfoCollectionService.updateById(mpActivityInfoCollectionEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -161,92 +133,4 @@ public class AppParentAgentActivityService implements IAppParentAgentActivitySer
|
||||
return AppMpActivityInfoCollectionConvert.INSTANCE.convert2Resp(activityInfoCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试孩子性格
|
||||
*
|
||||
* @param request 测试请求对象
|
||||
* @param parentId 家长ID
|
||||
* @return 性格测试结果
|
||||
*/
|
||||
public TestChildCharacterResp testChildCharacter(TestChildCharacterReq request, Integer parentId) {
|
||||
log.info("开始测试孩子性格,家长ID: {},请求参数: {}", parentId, request);
|
||||
|
||||
// 构建AI模型的提示词
|
||||
String prompt = buildCharacterTestPrompt(request);
|
||||
|
||||
// 调用AI模型获取性格分析
|
||||
LlmResponse response = aiModelCallService.callModel("child_character_analysis", prompt, new HashMap<>(), parentId);
|
||||
|
||||
TestChildCharacterResp result = new TestChildCharacterResp();
|
||||
|
||||
if (response != null && response.getChoices() != null && !response.getChoices().isEmpty()) {
|
||||
// 获取AI返回的内容
|
||||
String content = response.getChoices().get(0).getMessage().getContent();
|
||||
result = parseAiResponse(content);
|
||||
} else {
|
||||
// 如果AI调用失败,返回默认响应
|
||||
result.setCharacterAnalysis("暂时无法分析孩子的性格,请稍后重试。");
|
||||
result.setCharacterTraits("未知");
|
||||
result.setSuggestions("请尝试重新分析或咨询专业教育专家。");
|
||||
result.setCharacterType("待定");
|
||||
}
|
||||
|
||||
log.info("性格测试完成,返回结果: {}", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建性格测试的提示词
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @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();
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析AI返回的结果
|
||||
*
|
||||
* @param aiResponse AI返回的原始内容
|
||||
* @return 解析后的响应对象
|
||||
*/
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
// 如果解析失败,将整个内容作为性格分析
|
||||
if (resp.getCharacterAnalysis() == null || resp.getCharacterAnalysis().isEmpty()) {
|
||||
resp.setCharacterAnalysis(aiResponse);
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@ -30,14 +30,4 @@ public interface IAppActivityService {
|
||||
* @return 活动详情
|
||||
*/
|
||||
AppActivityResp getById(Integer id);
|
||||
|
||||
/**
|
||||
* 获取活动二维码
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param agentId 代理商ID
|
||||
* @param activityId 活动ID
|
||||
* @return 活动二维码
|
||||
*/
|
||||
String getQrCode(Integer userId,Integer agentId,Integer activityId,String appId);
|
||||
}
|
||||
@ -1,7 +1,5 @@
|
||||
package com.seer.teach.mp.app.service;
|
||||
|
||||
import com.seer.teach.common.PageListBean;
|
||||
import com.seer.teach.mp.app.controller.req.AgentActivityParentQueryReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AgentActivityParentInfoResp;
|
||||
|
||||
import java.util.List;
|
||||
@ -25,22 +23,4 @@ public interface IAppAgentActivityParentInfoService {
|
||||
* @return 参与活动的家长信息列表
|
||||
*/
|
||||
List<AgentActivityParentInfoResp> getParentsByActivityAndAgent(Integer activityId, Integer agentId,Integer userId);
|
||||
|
||||
/**
|
||||
* 分页获取参加指定活动的家长信息列表
|
||||
*
|
||||
* @param queryReq 查询请求参数
|
||||
* @return 分页的家长信息列表
|
||||
*/
|
||||
PageListBean<AgentActivityParentInfoResp> getParentsByActivityAndAgent(Integer userId,AgentActivityParentQueryReq queryReq);
|
||||
|
||||
/**
|
||||
* 记录代理商拨打电话联系家长的次数
|
||||
*
|
||||
* @param collectionId 活动信息收集记录ID
|
||||
* @param incrementCount 增加的联系次数
|
||||
* @param userId 用户ID
|
||||
* @return 更新后的联系次数
|
||||
*/
|
||||
boolean recordContactCall(Integer collectionId, Integer incrementCount,Integer userId);
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
package com.seer.teach.mp.app.service;
|
||||
|
||||
import com.seer.teach.mp.app.controller.req.AppMpAgentActivityQrCodeQueryReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
||||
|
||||
import java.util.List;
|
||||
@ -24,12 +23,4 @@ public interface IAppAgentActivityParticipantService {
|
||||
*/
|
||||
List<AgentActivityParticipantResp> getParticipantsByActivityAndAgent(Integer agentId,Integer userId);
|
||||
|
||||
/**
|
||||
* 获取二维码
|
||||
*
|
||||
* @param req 请求参数
|
||||
* @param userId 用户Id
|
||||
* @return 二维码的url
|
||||
*/
|
||||
String getQrCode(AppMpAgentActivityQrCodeQueryReq req, Integer userId);
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.seer.teach.mp.app.service;
|
||||
|
||||
import com.seer.teach.common.PageListBean;
|
||||
import com.seer.teach.mp.app.controller.req.AppAgentEmployeeRelationQueryReq;
|
||||
import com.seer.teach.mp.app.controller.req.AppAgentEmployeeRelationReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AppAgentEmployeeRelationResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* App端代理商员工关系服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Lingma
|
||||
* @since 2025-12-30
|
||||
*/
|
||||
public interface IAppAgentEmployeeRelationService {
|
||||
|
||||
/**
|
||||
* 分页查询我的员工列表
|
||||
*
|
||||
* @param query 查询条件
|
||||
* @return 员工关联分页列表
|
||||
*/
|
||||
PageListBean<AppAgentEmployeeRelationResp> pageList(AppAgentEmployeeRelationQueryReq query);
|
||||
|
||||
/**
|
||||
* 新增员工
|
||||
*
|
||||
* @param request 员工关联请求对象
|
||||
* @return 操作是否成功
|
||||
*/
|
||||
boolean addEmployee(AppAgentEmployeeRelationReq request);
|
||||
|
||||
/**
|
||||
* 更新员工信息
|
||||
*
|
||||
* @param request 员工关联请求对象
|
||||
* @return 操作是否成功
|
||||
*/
|
||||
boolean updateEmployee(AppAgentEmployeeRelationReq request);
|
||||
|
||||
/**
|
||||
* 删除员工
|
||||
*
|
||||
* @param id 关联ID
|
||||
* @return 操作是否成功
|
||||
*/
|
||||
boolean deleteEmployee(Integer id);
|
||||
|
||||
/**
|
||||
* 根据ID获取详情
|
||||
*
|
||||
* @param id 关联ID
|
||||
* @return 关联详情
|
||||
*/
|
||||
AppAgentEmployeeRelationResp getById(Integer id);
|
||||
|
||||
/**
|
||||
* 根据代理商ID获取所有员工列表
|
||||
*
|
||||
* @param agentId 代理商ID
|
||||
* @return 员工关联列表
|
||||
*/
|
||||
List<AppAgentEmployeeRelationResp> getAllEmployeesByAgentId(Integer agentId);
|
||||
|
||||
/**
|
||||
* 验证员工是否属于指定代理商
|
||||
*
|
||||
* @param relationId 关联ID
|
||||
* @param employeeUserId 代理商ID
|
||||
* @return 是否属于
|
||||
*/
|
||||
boolean isEmployeeBelongsToAgent(Integer relationId, Integer agentId);
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
package com.seer.teach.mp.app.service;
|
||||
|
||||
import com.seer.teach.mp.app.controller.resp.JsapiSignatureResp;
|
||||
import com.seer.teach.mp.app.controller.req.JsapiSignatureReq;
|
||||
|
||||
/**
|
||||
* 微信公众号JS-SDK签名服务接口
|
||||
*/
|
||||
public interface IAppMpSignatureService {
|
||||
|
||||
/**
|
||||
* 生成JS-SDK签名
|
||||
*
|
||||
* @param req 签名请求参数
|
||||
* @return JS-SDK签名响应参数
|
||||
*/
|
||||
JsapiSignatureResp generateJsapiSignature(JsapiSignatureReq req);
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
package com.seer.teach.mp.app.service;
|
||||
|
||||
import com.seer.teach.mp.app.controller.req.AppMpSignUpActivityReq;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 家长参与代理商活动服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Lingma
|
||||
* @since 2025-12-30
|
||||
*/
|
||||
public interface IAppParentAgentActivityService {
|
||||
|
||||
/**
|
||||
* 报名活动
|
||||
*
|
||||
* @param request 报名信息
|
||||
* @param parentId 家长ID
|
||||
* @return true表示成功,false表示失败
|
||||
*/
|
||||
boolean signUpForActivityWithInfo(AppMpSignUpActivityReq request, Integer parentId);
|
||||
|
||||
/**
|
||||
* 更新活动信息
|
||||
*
|
||||
* @param request 活动信息
|
||||
* @param parentId 家长ID
|
||||
* @return true表示成功,false表示失败
|
||||
*/
|
||||
boolean updateActivityInfo(AppMpSignUpActivityReq request, Integer parentId);
|
||||
|
||||
/**
|
||||
* 取消报名
|
||||
*
|
||||
* @param id 关系ID
|
||||
* @param parentId 家长ID
|
||||
* @return true表示成功,false表示失败
|
||||
*/
|
||||
boolean cancelSignUp(Integer id, Integer parentId);
|
||||
|
||||
/**
|
||||
* 获取报名信息
|
||||
*
|
||||
* @param agentId 代理商ID
|
||||
* @param activityId 活动ID
|
||||
* @param parentId 家长ID
|
||||
* @return 报名信息
|
||||
*/
|
||||
AppMpSignUpActivityResp getByActivityIdAndParentId(Integer agentId, Integer activityId, Integer parentId);
|
||||
|
||||
/**
|
||||
* 测试孩子性格
|
||||
*
|
||||
* @param request 测试请求对象
|
||||
* @param parentId 家长ID
|
||||
* @return 性格测试结果
|
||||
*/
|
||||
TestChildCharacterResp testChildCharacter(TestChildCharacterReq request, Integer parentId);
|
||||
}
|
||||
@ -5,22 +5,13 @@ 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.exception.CommonException;
|
||||
import com.seer.teach.common.utils.AssertUtils;
|
||||
import com.seer.teach.common.utils.PageConverterUtils;
|
||||
import com.seer.teach.mp.app.controller.req.AppAgentActivityQueryReq;
|
||||
import com.seer.teach.mp.app.controller.req.MpGenerateQrCodeReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AppActivityResp;
|
||||
import com.seer.teach.mp.app.controller.resp.MpQrCodeResp;
|
||||
import com.seer.teach.mp.app.convert.AppAgentActivityConvert;
|
||||
import com.seer.teach.mp.app.service.AppOfficialQrCodeService;
|
||||
import com.seer.teach.mp.app.service.IAppActivityService;
|
||||
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.mp.service.IMpAgentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -43,10 +34,6 @@ public class AppActivityServiceImpl implements IAppActivityService {
|
||||
|
||||
private final IMpActivityService activityService;
|
||||
|
||||
private final AppOfficialQrCodeService officialQrCodeService;
|
||||
|
||||
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||
|
||||
@Override
|
||||
public PageListBean<AppActivityResp> pageList(AppAgentActivityQueryReq query, Integer agentId) {
|
||||
log.info("查询参数:{}", query);
|
||||
@ -66,27 +53,4 @@ public class AppActivityServiceImpl implements IAppActivityService {
|
||||
MpActivityEntity entity = activityService.getById(id);
|
||||
return AppAgentActivityConvert.INSTANCE.convertToResp(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQrCode(Integer userId,Integer agentId,Integer activityId,String appId) {
|
||||
MpActivityEntity activity = activityService.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();
|
||||
}
|
||||
MpGenerateQrCodeReq req = new MpGenerateQrCodeReq();
|
||||
req.setSceneStr("agentId=" + agentId + "&activityId=" + activityId);
|
||||
req.setAppId(appId);
|
||||
req.setType(2);
|
||||
MpQrCodeResp mpQrCodeResp = officialQrCodeService.generateQrCode(req);
|
||||
relation.setQrCodeUrl(mpQrCodeResp.getQrCodeUrl());
|
||||
agentActivityParticipantService.updateById(relation);
|
||||
return mpQrCodeResp.getQrCodeUrl();
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,8 @@
|
||||
package com.seer.teach.mp.app.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.PageConverterUtils;
|
||||
import com.seer.teach.mp.app.controller.req.AgentActivityParentQueryReq;
|
||||
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;
|
||||
@ -42,7 +38,7 @@ public class AppAgentActivityParentInfoServiceImpl implements IAppAgentActivityP
|
||||
if (Objects.isNull(userAgentId)) {
|
||||
return List.of();
|
||||
}
|
||||
log.info("getParentsByActivityAndAgent userAgentId:{}", userAgentId);
|
||||
log.info("userAgentId:{}", userAgentId);
|
||||
if(userAgentId.intValue() != agentId){
|
||||
throw new CommonException(ResultCodeEnum.RELATION_NOT_FOUND);
|
||||
}
|
||||
@ -59,48 +55,6 @@ public class AppAgentActivityParentInfoServiceImpl implements IAppAgentActivityP
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageListBean<AgentActivityParentInfoResp> getParentsByActivityAndAgent(Integer userId,AgentActivityParentQueryReq queryReq) {
|
||||
var userAgentId = appAgentService.getAgentIdByUserId(userId);
|
||||
if (Objects.isNull(userAgentId)) {
|
||||
return new PageListBean<>();
|
||||
}
|
||||
log.info("userAgentId:{}", userAgentId);
|
||||
if(userAgentId.intValue() != queryReq.getAgentId()){
|
||||
throw new CommonException(ResultCodeEnum.RELATION_NOT_FOUND);
|
||||
}
|
||||
// 创建分页对象
|
||||
Page<MpActivityInfoCollectionEntity> page = new Page<>(queryReq.getPageNo(), queryReq.getPageSize());
|
||||
|
||||
// 构建查询条件
|
||||
LambdaQueryWrapper<MpActivityInfoCollectionEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(MpActivityInfoCollectionEntity::getActivityId, queryReq.getActivityId())
|
||||
.eq(MpActivityInfoCollectionEntity::getAgentId, userAgentId);
|
||||
|
||||
// 执行分页查询
|
||||
Page<MpActivityInfoCollectionEntity> pageResult = activityInfoCollectionService.page(page, queryWrapper);
|
||||
|
||||
// 返回分页结果
|
||||
return PageConverterUtils.convertPageList(pageResult,this::convertToResp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recordContactCall(Integer collectionId, Integer incrementCount,Integer userId) {
|
||||
// 查询指定的活动信息收集记录
|
||||
MpActivityInfoCollectionEntity entity = activityInfoCollectionService.getById(collectionId);
|
||||
if (entity == null) {
|
||||
throw new CommonException(ResultCodeEnum.ACTIVITY_NOT_FOUND);
|
||||
}
|
||||
// 更新联系次数
|
||||
Integer currentCount = entity.getContactCallCount();
|
||||
if (currentCount == null) {
|
||||
currentCount = 0;
|
||||
}
|
||||
Integer newCount = currentCount + incrementCount;
|
||||
entity.setContactCallCount(newCount);
|
||||
return activityInfoCollectionService.updateById(entity);
|
||||
}
|
||||
|
||||
private AgentActivityParentInfoResp convertToResp(MpActivityInfoCollectionEntity entity) {
|
||||
AgentActivityParentInfoResp resp = new AgentActivityParentInfoResp();
|
||||
resp.setId(entity.getId());
|
||||
@ -113,8 +67,6 @@ 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,30 +1,20 @@
|
||||
package com.seer.teach.mp.app.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.http.HttpDownloader;
|
||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||
import com.seer.teach.common.exception.CommonException;
|
||||
import com.seer.teach.common.service.CommonFileService;
|
||||
import com.seer.teach.common.utils.AssertUtils;
|
||||
import com.seer.teach.mp.app.controller.req.AppMpAgentActivityQrCodeQueryReq;
|
||||
import com.seer.teach.mp.app.controller.req.MpGenerateQrCodeReq;
|
||||
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
||||
import com.seer.teach.mp.app.controller.resp.MpQrCodeResp;
|
||||
import com.seer.teach.mp.app.service.AppOfficialQrCodeService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@ -46,14 +36,12 @@ public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivity
|
||||
|
||||
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||
|
||||
private final UserInfoServiceApi userInfoServiceApi;
|
||||
|
||||
private final IAppAgentService appAgentService;
|
||||
|
||||
private final IMpActivityService mpActivityService;
|
||||
|
||||
private final AppOfficialQrCodeService officialQrCodeService;
|
||||
|
||||
private final CommonFileService commonFileService;
|
||||
|
||||
@Override
|
||||
public List<AgentActivityParticipantResp> getParticipantsByActivityAndAgent(Integer agentId, Integer userId) {
|
||||
var userAgentId = appAgentService.getAgentIdByUserId(userId);
|
||||
@ -80,42 +68,6 @@ public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivity
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getQrCode(AppMpAgentActivityQrCodeQueryReq req, Integer userId) {
|
||||
Integer activityId = req.getActivityId();
|
||||
Integer agentId = req.getAgentId();
|
||||
log.info("getQrCode param activityId:{},agentId:{}", activityId, agentId);
|
||||
MpActivityEntity activity = mpActivityService.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();
|
||||
}
|
||||
MpGenerateQrCodeReq generateQrCodeReq = new MpGenerateQrCodeReq();
|
||||
generateQrCodeReq.setSceneStr("agentId=" + agentId + "&activityId=" + activityId);
|
||||
generateQrCodeReq.setAppId(req.getAppId());
|
||||
generateQrCodeReq.setType(2);
|
||||
MpQrCodeResp mpQrCodeResp = officialQrCodeService.generateQrCode(generateQrCodeReq);
|
||||
if(StringUtils.isNotEmpty(mpQrCodeResp.getQrCodeUrl())){
|
||||
try {
|
||||
byte[] bytes = HttpDownloader.downloadBytes(mpQrCodeResp.getQrCodeUrl());
|
||||
InputStream inputStream = new ByteArrayInputStream(bytes);
|
||||
String url = commonFileService.upload(inputStream,"qrcode", "agent_activity", MediaType.IMAGE_PNG_VALUE);
|
||||
relation.setQrCodeUrl(url);
|
||||
}catch (Exception e){
|
||||
log.error("download qrcode error", e);
|
||||
relation.setQrCodeUrl(mpQrCodeResp.getQrCodeUrl());
|
||||
}
|
||||
}
|
||||
agentActivityParticipantService.updateById(relation);
|
||||
return mpQrCodeResp.getQrCodeUrl();
|
||||
}
|
||||
|
||||
|
||||
private AgentActivityParticipantResp convertToDto(MpAgentActivityParticipantEntity entity, Map<Integer, MpActivityEntity> activityInfoMap) {
|
||||
AgentActivityParticipantResp resp = new AgentActivityParticipantResp();
|
||||
|
||||
@ -1,221 +0,0 @@
|
||||
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;
|
||||
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.enums.RoleEnum;
|
||||
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.app.controller.req.AppAgentEmployeeRelationQueryReq;
|
||||
import com.seer.teach.mp.app.controller.req.AppAgentEmployeeRelationReq;
|
||||
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;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* App端代理商员工关系服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Lingma
|
||||
* @since 2025-12-30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppAgentEmployeeRelationServiceImpl implements IAppAgentEmployeeRelationService {
|
||||
|
||||
private final IMpAgentEmployeeRelationService mpAgentEmployeeRelationService;
|
||||
|
||||
private final IMpAgentService mpAgentService;
|
||||
|
||||
private final UserInfoServiceApi userInfoServiceApi;
|
||||
|
||||
@Override
|
||||
public PageListBean<AppAgentEmployeeRelationResp> pageList(AppAgentEmployeeRelationQueryReq query) {
|
||||
Integer employeeUserId = StpUtil.getLoginIdAsInt();
|
||||
Integer agentId = mpAgentEmployeeRelationService.lambdaQuery().eq(MpAgentEmployeeRelationEntity::getEmployeeUserId, employeeUserId).one().getAgentId();
|
||||
AssertUtils.notNull(agentId, ResultCodeEnum.AGENT_EMPLOYEE_NOT_FOUND);
|
||||
log.info("查询参数:{}", query);
|
||||
IPage<MpAgentEmployeeRelationEntity> page = new Page<>(query.getPageNo(), query.getPageSize());
|
||||
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());
|
||||
|
||||
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("查询结果为空");
|
||||
}
|
||||
log.info("查询代理商员工数量:{}", pageResult.getTotal());
|
||||
|
||||
return PageConverterUtils.convertPageListBean(pageResult, this::convertToRespList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addEmployee(AppAgentEmployeeRelationReq request) {
|
||||
log.info("新增员工参数:{}", request);
|
||||
LambdaQueryWrapper<MpAgentEmployeeRelationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MpAgentEmployeeRelationEntity::getAgentId, request.getAgentId())
|
||||
.eq(MpAgentEmployeeRelationEntity::getContactPhone, request.getMobile());
|
||||
|
||||
MpAgentEmployeeRelationEntity existing = mpAgentEmployeeRelationService.getOne(wrapper);
|
||||
if (existing != null) {
|
||||
throw new CommonException(ResultCodeEnum.DATA_REPEAT_ERROR, "该员工已属于当前代理商");
|
||||
}
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setUserName(request.getEmployeeName());
|
||||
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());
|
||||
|
||||
boolean result = mpAgentEmployeeRelationService.save(entity);
|
||||
log.info("新增员工结果:{}", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateEmployee(AppAgentEmployeeRelationReq request) {
|
||||
// 验证员工是否属于当前代理商(通过ID查询并验证)
|
||||
MpAgentEmployeeRelationEntity existing = mpAgentEmployeeRelationService.getById(request.getId());
|
||||
AssertUtils.notNull(existing, ResultCodeEnum.DATA_NOT_EXIST);
|
||||
|
||||
if (!existing.getAgentId().equals(request.getAgentId())) {
|
||||
throw new CommonException(ResultCodeEnum.PERMISSION_DENIED, "无权限操作此员工");
|
||||
}
|
||||
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setUserName(request.getEmployeeName());
|
||||
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);
|
||||
|
||||
MpAgentEmployeeRelationEntity updateEntity = new MpAgentEmployeeRelationEntity();
|
||||
updateEntity.setId(request.getId());
|
||||
updateEntity.setPosition(request.getPosition());
|
||||
updateEntity.setStatus(request.getStatus());
|
||||
updateEntity.setEmployeeName(request.getEmployeeName());
|
||||
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 && updateUserResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteEmployee(Integer id) {
|
||||
MpAgentEmployeeRelationEntity existing = mpAgentEmployeeRelationService.getById(id);
|
||||
AssertUtils.notNull(existing, ResultCodeEnum.DATA_NOT_EXIST);
|
||||
boolean result = mpAgentEmployeeRelationService.removeById(id);
|
||||
log.info("删除员工结果:{}", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppAgentEmployeeRelationResp getById(Integer id) {
|
||||
MpAgentEmployeeRelationEntity entity = mpAgentEmployeeRelationService.getById(id);
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
return convertToResp(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppAgentEmployeeRelationResp> getAllEmployeesByAgentId(Integer agentId) {
|
||||
List<MpAgentEmployeeRelationEntity> entities = mpAgentEmployeeRelationService.list(
|
||||
new LambdaQueryWrapper<MpAgentEmployeeRelationEntity>()
|
||||
.eq(MpAgentEmployeeRelationEntity::getAgentId, agentId)
|
||||
);
|
||||
|
||||
if (CollectionUtil.isEmpty(entities)) {
|
||||
return List.of();
|
||||
}
|
||||
return entities.stream()
|
||||
.map(this::convertToResp)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmployeeBelongsToAgent(Integer relationId, Integer agentId) {
|
||||
MpAgentEmployeeRelationEntity entity = mpAgentEmployeeRelationService.lambdaQuery()
|
||||
.eq(MpAgentEmployeeRelationEntity::getId, relationId)
|
||||
.eq(MpAgentEmployeeRelationEntity::getAgentId, agentId)
|
||||
.one();
|
||||
return entity != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将实体转换为响应对象
|
||||
*/
|
||||
private AppAgentEmployeeRelationResp convertToResp(MpAgentEmployeeRelationEntity entity) {
|
||||
AppAgentEmployeeRelationResp resp = new AppAgentEmployeeRelationResp();
|
||||
resp.setId(entity.getId());
|
||||
resp.setAgentId(entity.getAgentId());
|
||||
resp.setPosition(entity.getPosition());
|
||||
resp.setStatus(entity.getStatus());
|
||||
resp.setCreateTime(entity.getCreateTime());
|
||||
resp.setUpdateTime(entity.getUpdateTime());
|
||||
|
||||
// 通过用户服务获取员工的详细信息
|
||||
if (entity.getEmployeeUserId() != null) {
|
||||
UserInfoDTO userInfo = userInfoServiceApi.getByUserId(entity.getEmployeeUserId());
|
||||
resp.setEmployeeUserInfo(userInfo);
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量转换实体为响应对象
|
||||
*/
|
||||
private List<AppAgentEmployeeRelationResp> convertToRespList(List<MpAgentEmployeeRelationEntity> entities) {
|
||||
if (CollectionUtil.isEmpty(entities)) {
|
||||
return List.of();
|
||||
}
|
||||
return entities.stream()
|
||||
.map(this::convertToResp)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@ -10,8 +10,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import com.seer.teach.mp.app.convert.AppAgentConvert;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* App端代理商服务实现类
|
||||
*/
|
||||
@ -29,13 +27,10 @@ public class AppAgentServiceImpl implements IAppAgentService {
|
||||
return null;
|
||||
}
|
||||
MpAgentEntity agentEntity = mpAgentService.getAgentById(mpAgentEmployeeRelationEntity.getAgentId());
|
||||
if (Objects.isNull(agentEntity)) {
|
||||
if (agentEntity == null) {
|
||||
return null;
|
||||
}
|
||||
AppMpAgentResp appMpAgentResp = AppAgentConvert.INSTANCE.entityToResp(agentEntity);
|
||||
Boolean isContactPerson = Objects.nonNull(agentEntity.getContactUserId()) && agentEntity.getContactUserId().equals(userId);
|
||||
appMpAgentResp.setIsContactPerson(isContactPerson);
|
||||
return appMpAgentResp;
|
||||
return AppAgentConvert.INSTANCE.entityToResp(agentEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
package com.seer.teach.mp.app.service.impl;
|
||||
|
||||
import com.seer.teach.mp.app.controller.req.JsapiSignatureReq;
|
||||
import com.seer.teach.mp.app.controller.resp.JsapiSignatureResp;
|
||||
import com.seer.teach.mp.app.service.IAppMpSignatureService;
|
||||
import com.seer.teach.mp.factory.MpServiceFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import me.chanjar.weixin.common.bean.WxJsapiSignature;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 微信公众号JS-SDK签名服务实现类
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AppMpSignatureServiceImpl implements IAppMpSignatureService {
|
||||
|
||||
private final MpServiceFactory mpServiceFactory;
|
||||
|
||||
@Override
|
||||
public JsapiSignatureResp generateJsapiSignature(JsapiSignatureReq req) {
|
||||
try {
|
||||
// 获取WxMpService实例
|
||||
var mpService = mpServiceFactory.getRequiredMpService(req.getAppId());
|
||||
|
||||
WxJsapiSignature wxJsapiSignature = mpService.createJsapiSignature(req.getUrl());
|
||||
|
||||
return new JsapiSignatureResp(wxJsapiSignature.getTimestamp(), wxJsapiSignature.getNonceStr(), wxJsapiSignature.getSignature(), req.getAppId());
|
||||
} catch (WxErrorException e) {
|
||||
log.error("生成JS-SDK签名失败,appId: {}, url: {}", req.getAppId(), req.getUrl(), e);
|
||||
throw new RuntimeException("生成JS-SDK签名失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -31,12 +31,4 @@ public interface IMpAgentActivityParticipantService extends IService<MpAgentActi
|
||||
* @return 参与记录列表
|
||||
*/
|
||||
List<MpAgentActivityParticipantEntity> getListByAgentId(Integer agentId);
|
||||
|
||||
/**
|
||||
* 根据活动ID获取所有参与记录
|
||||
*
|
||||
* @param activityId 活动ID
|
||||
* @return 参与记录列表
|
||||
*/
|
||||
List<MpAgentActivityParticipantEntity> getOneByActivityId(Integer activityId);
|
||||
}
|
||||
@ -22,10 +22,9 @@ public interface IMpAgentService extends IService<MpAgentEntity> {
|
||||
* 保存代理商
|
||||
*
|
||||
* @param agentEntity 代理商实体
|
||||
* @param password m密码
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean saveAgent(MpAgentEntity agentEntity,String password);
|
||||
Boolean saveAgent(MpAgentEntity agentEntity);
|
||||
|
||||
/**
|
||||
* 更新代理商
|
||||
|
||||
@ -42,9 +42,4 @@ public class MpAgentActivityParticipantServiceImpl extends ServiceImpl<MpAgentAc
|
||||
return super.list(new LambdaQueryWrapper<MpAgentActivityParticipantEntity>()
|
||||
.eq(MpAgentActivityParticipantEntity::getAgentId, agentId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MpAgentActivityParticipantEntity> getOneByActivityId(Integer activityId) {
|
||||
return super.list(new LambdaQueryWrapper<MpAgentActivityParticipantEntity>().eq(MpAgentActivityParticipantEntity::getActivityId, activityId));
|
||||
}
|
||||
}
|
||||
@ -1,14 +1,9 @@
|
||||
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.mp.entity.MpAgentEntity;
|
||||
import com.seer.teach.mp.mapper.MpAgentMapper;
|
||||
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;
|
||||
@ -16,28 +11,16 @@ import java.util.List;
|
||||
/**
|
||||
* 代理商服务实现类
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MpAgentServiceImpl extends ServiceImpl<MpAgentMapper, MpAgentEntity> implements IMpAgentService {
|
||||
|
||||
private final UserInfoServiceApi userInfoServiceApi;
|
||||
|
||||
@Override
|
||||
public MpAgentEntity getAgentById(Integer id) {
|
||||
return this.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean saveAgent(MpAgentEntity agentEntity,String password) {
|
||||
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||
userInfoDTO.setUserName(agentEntity.getContactName());
|
||||
userInfoDTO.setPassword(password);
|
||||
userInfoDTO.setMobile(agentEntity.getContactPhone());
|
||||
userInfoDTO.setRoleCode(RoleEnum.AGENT);
|
||||
Integer userId = userInfoServiceApi.addUserInfoAndAssignRole(userInfoDTO);
|
||||
log.info("用户id:{}", userId);
|
||||
agentEntity.setContactUserId(userId);
|
||||
public Boolean saveAgent(MpAgentEntity agentEntity) {
|
||||
return this.save(agentEntity);
|
||||
}
|
||||
|
||||
|
||||
@ -47,6 +47,12 @@ public interface GradeServiceApi {
|
||||
@PostMapping("/addGrade")
|
||||
ResultBean addGrade(@RequestParam("status") Integer status, @RequestParam("grade") String grade);
|
||||
|
||||
/**
|
||||
* 删除年级
|
||||
* @param ids
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
void deleteGrade(@RequestBody List<Integer> ids);
|
||||
|
||||
/**
|
||||
* 修改年级状态
|
||||
|
||||
@ -2,7 +2,10 @@ 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.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -121,24 +124,6 @@ public interface UserInfoServiceApi {
|
||||
@PostMapping("/update-user-assign-role")
|
||||
boolean updateUserInfoAndAssignRole(@RequestBody UserInfoDTO userInfoDTO);
|
||||
|
||||
/**
|
||||
* 跟新用户信息
|
||||
*
|
||||
* @param userInfoDTO 用户信息
|
||||
* @return 用户ID
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
boolean updateUserInfo(@RequestBody UserInfoDTO userInfoDTO);
|
||||
|
||||
/**
|
||||
* 新增用户信息并分配角色
|
||||
*
|
||||
* @param userInfoDTO 用户信息
|
||||
* @return 用户ID
|
||||
*/
|
||||
@PostMapping("/add-user-assign-role")
|
||||
Integer addUserInfoAndAssignRole(@RequestBody UserInfoDTO userInfoDTO);
|
||||
|
||||
/**
|
||||
* 根据孩子Id获取家长信息
|
||||
*
|
||||
@ -189,10 +174,6 @@ 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);
|
||||
|
||||
@PostMapping("/save-agentInfo")
|
||||
boolean saveAgentInfo(@RequestBody UserInfoDTO userInfoDTO);
|
||||
}
|
||||
@ -2,28 +2,12 @@ package com.seer.teach.user.api;
|
||||
|
||||
import com.seer.teach.user.api.dto.UserRelationDTO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@FeignClient(name = ApiConstants.SERVER_NAME, contextId = "userRelationServiceApi", path = "/seer/user/internal")
|
||||
public interface UserRelationServiceApi {
|
||||
|
||||
/**
|
||||
* 保存用户关系
|
||||
*
|
||||
* @param userRelationDTO 用户关系信息
|
||||
* @return 保存结果
|
||||
*/
|
||||
@PostMapping("/save-relation")
|
||||
boolean saveUserRelation(@RequestBody UserRelationDTO userRelationDTO);
|
||||
|
||||
/**
|
||||
* 删除用户关系
|
||||
*
|
||||
* @param userRelationDTO 用户关系信息
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
boolean deleteUserRelation(@RequestBody UserRelationDTO userRelationDTO);
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package com.seer.teach.user.api.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.seer.teach.common.enums.RoleEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -63,5 +62,5 @@ public class UserInfoDTO {
|
||||
private Integer experience;
|
||||
|
||||
@Schema(description = "角色编码")
|
||||
private RoleEnum roleCode;
|
||||
private String roleCode;
|
||||
}
|
||||
@ -1,23 +1,18 @@
|
||||
package com.seer.teach.user.api.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "用户关系DTO")
|
||||
@Data
|
||||
public class UserRelationDTO {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@NotNull(message = "用户ID不能为空")
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 关联的用户ID
|
||||
*/
|
||||
@NotNull(message = "关联的用户ID不能为空")
|
||||
private Integer relationId;
|
||||
|
||||
/**
|
||||
|
||||
@ -21,8 +21,6 @@ spring:
|
||||
- optional:nacos:${spring.application.name}-${spring.profiles.active}.yaml
|
||||
- optional:nacos:shared-database.yaml
|
||||
- optional:nacos:shared-redis.yaml
|
||||
- optional:nacos:shared-sa-token.yaml
|
||||
- optional:nacos:shared-minio.yaml
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
|
||||
@ -45,9 +45,6 @@ public class OfficialOauthWithAccountLoginStrategy extends AbstractLoginStrategy
|
||||
UserEntity accountUser = null;
|
||||
if (request.getUserName() != null && !request.getUserName().isEmpty()) {
|
||||
accountUser = userService.getOneByUserName(request.getUserName());
|
||||
if (accountUser == null) {
|
||||
accountUser = userService.getOneByMobile(request.getUserName());
|
||||
}
|
||||
} else if (request.getPhoneNumber() != null && !request.getPhoneNumber().isEmpty()) {
|
||||
accountUser = userService.getOneByMobile(request.getPhoneNumber());
|
||||
}
|
||||
|
||||
@ -95,6 +95,19 @@ public class GradeServiceApiImpl implements GradeServiceApi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除年级
|
||||
* @param ids
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteGrade(List<Integer> ids) {
|
||||
AssertUtils.notEmpty(ids, ResultCodeEnum.PLEASE_SELECT_THE_GRADE_TO_DELETED);
|
||||
List<Integer> distinctIds = ids.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
gradeService.removeByIds(distinctIds);
|
||||
log.info("删除年级成功,ids={}", distinctIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultBean updateGradeStatus(GradeUpdateDTO params) {
|
||||
GradeEntity grade = gradeService.getById(params.getId());
|
||||
|
||||
@ -3,12 +3,11 @@ 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;
|
||||
import com.seer.teach.common.utils.AssertUtils;
|
||||
import com.seer.teach.common.utils.CommonUtils;
|
||||
import com.seer.teach.iot.api.UserDeviceServiceApi;
|
||||
@ -216,37 +215,10 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
||||
@Override
|
||||
public boolean updateUserInfoAndAssignRole(UserInfoDTO userInfoDTO) {
|
||||
UserEntity UserEntity = UserInfoConvert.INSTANCE.convertOne(userInfoDTO);
|
||||
userRoleService.assignUserRoleByRoleCode(UserEntity.getId(), userInfoDTO.getRoleCode().getCode());
|
||||
userRoleService.assignUserRoleByRoleCode(UserEntity.getId(), userInfoDTO.getRoleCode());
|
||||
return userService.updateById(UserEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateUserInfo(UserInfoDTO userInfoDTO) {
|
||||
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
|
||||
public Integer addUserInfoAndAssignRole(UserInfoDTO userInfoDTO) {
|
||||
UserEntity userEntity = UserInfoConvert.INSTANCE.convertOne(userInfoDTO);
|
||||
userEntity.setPassword(CommonUtils.encryptPassword(userInfoDTO.getPassword()));
|
||||
boolean saved = userService.save(userEntity);
|
||||
log.info("保存用户信息:{}", saved);
|
||||
if(saved){
|
||||
userRoleService.assignUserRoleByRoleCode(userEntity.getId(), userInfoDTO.getRoleCode().getCode());
|
||||
return userEntity.getId();
|
||||
}
|
||||
throw new CommonException(ResultCodeEnum.USER_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getParentIdByChildrenId(Integer childrenId) {
|
||||
return userRelationService.getParentIdByChildrenId(childrenId);
|
||||
@ -298,6 +270,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
||||
log.info("注册默认Children User:{}", userEntity);
|
||||
return userEntity.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer checkUserInfo(Integer userId) {
|
||||
UserExtendEntity byUserId = userExtendService.getByUserId(userId);
|
||||
@ -316,15 +289,15 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
||||
}
|
||||
|
||||
@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;
|
||||
public boolean saveAgentInfo(UserInfoDTO userInfoDTO) {
|
||||
UserEntity one = userService.getOne(new LambdaQueryWrapper<UserEntity>()
|
||||
.eq(UserEntity::getUserName, userInfoDTO.getUserName()));
|
||||
AssertUtils.isNull(one, ResultCodeEnum.USERNAME_IS_EXIST);
|
||||
UserEntity user = new UserEntity();
|
||||
user.setUserName(userInfoDTO.getUserName());
|
||||
String password = CommonUtils.encryptPassword(userInfoDTO.getPassword());
|
||||
user.setPassword(password);
|
||||
return userService.save(user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -22,11 +22,4 @@ public class UserRelationServiceApiImpl implements UserRelationServiceApi {
|
||||
UserRelationEntity userRelation = UserRelationConvert.INSTANCE.convertOne(userRelationDTO);
|
||||
return userRelationService.save(userRelation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteUserRelation(UserRelationDTO userRelationDTO) {
|
||||
log.info("删除用户关系:{}", userRelationDTO);
|
||||
UserRelationEntity userRelation = UserRelationConvert.INSTANCE.convertOne(userRelationDTO);
|
||||
return userRelationService.deleteUserRelation(userRelation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,12 +117,4 @@ public interface IUserRelationService extends IService<UserRelationEntity> {
|
||||
* @return 用户关系列表
|
||||
*/
|
||||
List<UserRelationEntity> getUserRelationByUserIdAndFamilyId(Integer userId, Integer familyId);
|
||||
|
||||
/**
|
||||
* 删除用户关系
|
||||
*
|
||||
* @param userRelation 用户关系
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean deleteUserRelation(UserRelationEntity userRelation);
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ public interface IUserRoleService extends IService<UserRoleEntity> {
|
||||
* @param userId 角色编号
|
||||
* @param roleIds 角色编号集合
|
||||
*/
|
||||
boolean assignUserRole(Integer userId, Set<Integer> roleIds);
|
||||
void assignUserRole(Integer userId, Set<Integer> roleIds);
|
||||
|
||||
/**
|
||||
* 为用户分配角色
|
||||
@ -48,7 +48,7 @@ public interface IUserRoleService extends IService<UserRoleEntity> {
|
||||
* @param userId 角色编号
|
||||
* @param roleId 角色编号集合
|
||||
*/
|
||||
boolean assignUserRole(Integer userId, Integer roleId);
|
||||
void assignUserRole(Integer userId, Integer roleId);
|
||||
|
||||
/**
|
||||
* 为用户分配角色
|
||||
|
||||
@ -16,7 +16,6 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -106,12 +105,4 @@ public class UserRelationServiceImpl extends ServiceImpl<UserRelationMapper, Use
|
||||
.eq(UserRelationEntity::getFamilyId, familyId)
|
||||
.eq(UserRelationEntity::getUserId, userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteUserRelation(UserRelationEntity userRelation) {
|
||||
return super.remove(new LambdaQueryWrapper<>(UserRelationEntity.class)
|
||||
.eq(UserRelationEntity::getUserId, userRelation.getUserId())
|
||||
.eq(UserRelationEntity::getRelationId, userRelation.getRelationId())
|
||||
.eq(Objects.nonNull(userRelation.getType()),UserRelationEntity::getType, userRelation.getType()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,38 +58,42 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRoleEnt
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean assignUserRole(Integer userId, Set<Integer> roleIds) {
|
||||
public void assignUserRole(Integer userId, Set<Integer> roleIds) {
|
||||
List<UserRoleEntity> userRoleList = this.getListByUserId(userId);
|
||||
if(CollectionUtils.isEmpty(userRoleList)){
|
||||
List<UserRoleEntity> userRoles = roleIds.stream().map(roleId -> UserRoleEntity.builder().userId(userId).roleId(roleId.intValue()).build()).collect(Collectors.toList());
|
||||
boolean savedBatch = super.saveBatch(userRoles);
|
||||
log.info("分配角色[{}] result:{}", userRoles, savedBatch);
|
||||
return savedBatch;
|
||||
return;
|
||||
}
|
||||
Set<Integer> roleIdSet = userRoleList.stream().map(UserRoleEntity::getRoleId).collect(Collectors.toSet());
|
||||
Collection<Integer> createRoleIds = CollUtil.subtract(roleIds, roleIdSet);
|
||||
Collection<Integer> deleteRoleIds = CollUtil.subtract(roleIdSet, roleIds);
|
||||
if (CollUtil.isNotEmpty(createRoleIds)) {
|
||||
List<UserRoleEntity> userRoles = createRoleIds.stream().map(roleId -> UserRoleEntity.builder().userId(userId).roleId(roleId.intValue()).build()).collect(Collectors.toList());
|
||||
boolean savedBatch = super.saveBatch(userRoles);
|
||||
log.info("新增角色[{}] result:{}", userRoles, savedBatch);
|
||||
return savedBatch;
|
||||
}
|
||||
return true;
|
||||
if (CollUtil.isNotEmpty(deleteRoleIds)) {
|
||||
super.remove(new LambdaQueryWrapper<>(UserRoleEntity.class).eq(UserRoleEntity::getUserId, userId).in(UserRoleEntity::getRoleId, deleteRoleIds));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean assignUserRole(Integer userId, Integer roleId) {
|
||||
public void assignUserRole(Integer userId, Integer roleId) {
|
||||
Set<Integer> roleIds = new HashSet<>();
|
||||
roleIds.add(roleId);
|
||||
return assignUserRole(userId, roleIds);
|
||||
assignUserRole(userId, roleIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean assignUserRoleByRoleCode(Integer userId, String roleCode) {
|
||||
Optional<RoleEntity> role = roleService.getRoleByCode(roleCode);
|
||||
if(role.isPresent()){
|
||||
return assignUserRole(userId, role.get().getId());
|
||||
if(!role.isPresent()){
|
||||
return false;
|
||||
}
|
||||
assignUserRole(userId, role.get().getId());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user