Merge remote-tracking branch 'origin/dev-chenjiajian'
This commit is contained in:
commit
9e733f71ff
@ -2,7 +2,6 @@ package com.seer.teach.mp.entity;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.seer.teach.common.config.mybatis.hanler.IntegerListTypeHandler;
|
|
||||||
import com.seer.teach.common.entity.BaseEntity;
|
import com.seer.teach.common.entity.BaseEntity;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -29,18 +28,18 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
|||||||
@TableField("relation_id")
|
@TableField("relation_id")
|
||||||
private Integer relationId;
|
private Integer relationId;
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动ID
|
|
||||||
*/
|
|
||||||
@TableField("activity_id")
|
|
||||||
private Integer activityId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 代理商ID
|
* 代理商ID
|
||||||
*/
|
*/
|
||||||
@TableField("agent_id")
|
@TableField("agent_id")
|
||||||
private Integer agentId;
|
private Integer agentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动ID
|
||||||
|
*/
|
||||||
|
@TableField("activity_id")
|
||||||
|
private Integer activityId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 家长ID
|
* 家长ID
|
||||||
*/
|
*/
|
||||||
@ -96,14 +95,21 @@ public class MpActivityInfoCollectionEntity extends BaseEntity {
|
|||||||
private String learningSituation;
|
private String learningSituation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 优势学科(数学、英语等)
|
* 偏科(数学、英语等)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "strong_subject_ids",typeHandler = IntegerListTypeHandler.class)
|
@TableField("weak_subject")
|
||||||
private List<Integer> strongSubjectIds;
|
private String weakSubject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 劣势学科(数学、英语等)
|
* 薄弱科目
|
||||||
*/
|
*/
|
||||||
@TableField(value = "weak_subject_ids",typeHandler = IntegerListTypeHandler.class)
|
@TableField("weak_subject_ids")
|
||||||
private List<Integer> weakSubjectIds;
|
private List<Integer> weakSubjectIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优势科目
|
||||||
|
*/
|
||||||
|
@TableField("strong_subject_ids")
|
||||||
|
private List<Integer> strongSubjectIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.common.ResultBean;
|
||||||
|
import com.seer.teach.common.annotation.LogPrint;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.ActivityInfoCollectionQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AdminActivityInfoCollectionResp;
|
||||||
|
import com.seer.teach.mp.admin.service.AdminActivityInfoCollectionService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Tag(name = "管理端 - 活动信息收集管理")
|
||||||
|
@LogPrint
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mp/activity/info/collection")
|
||||||
|
public class AdminActivityInfoCollectionController {
|
||||||
|
|
||||||
|
private final AdminActivityInfoCollectionService adminActivityInfoCollectionService;
|
||||||
|
|
||||||
|
@PostMapping("/page")
|
||||||
|
@SaCheckPermission("admin:activity:info:collection:page")
|
||||||
|
@Operation(summary = "分页查询活动信息收集记录")
|
||||||
|
public ResultBean<PageListBean<AdminActivityInfoCollectionResp>> pageList(
|
||||||
|
@RequestBody @Validated ActivityInfoCollectionQueryReq req) {
|
||||||
|
PageListBean<AdminActivityInfoCollectionResp> result = adminActivityInfoCollectionService.pageList(req);
|
||||||
|
return ResultBean.success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@SaCheckPermission("admin:activity:info:collection:detail")
|
||||||
|
@Operation(summary = "获取活动信息收集记录详情")
|
||||||
|
public ResultBean<AdminActivityInfoCollectionResp> detail(@PathVariable Integer id) {
|
||||||
|
return ResultBean.success(adminActivityInfoCollectionService.getDetail(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("delete")
|
||||||
|
@SaCheckPermission("admin:activity:info:collection:delete")
|
||||||
|
@Operation(summary = "删除活动信息收集记录")
|
||||||
|
public ResultBean<Boolean> delete(@RequestBody List<Integer> ids) {
|
||||||
|
return ResultBean.success(adminActivityInfoCollectionService.delete(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,30 +1,26 @@
|
|||||||
package com.seer.teach.mp.admin.controller;
|
package com.seer.teach.mp.admin.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.seer.teach.common.PageListBean;
|
import com.seer.teach.common.PageListBean;
|
||||||
import com.seer.teach.common.ResultBean;
|
import com.seer.teach.common.ResultBean;
|
||||||
import com.seer.teach.common.annotation.LogPrint;
|
import com.seer.teach.common.annotation.LogPrint;
|
||||||
import com.seer.teach.common.utils.PageConverterUtils;
|
|
||||||
import com.seer.teach.mp.admin.controller.req.ParentAgentActivityQueryReq;
|
import com.seer.teach.mp.admin.controller.req.ParentAgentActivityQueryReq;
|
||||||
import com.seer.teach.mp.admin.controller.resp.AdminParentAgentActivityResp;
|
import com.seer.teach.mp.admin.controller.resp.AdminParentAgentActivityResp;
|
||||||
import com.seer.teach.mp.admin.controller.resp.MpParentAgentActivityResp;
|
|
||||||
import com.seer.teach.mp.admin.service.AdminParentAgentActivityService;
|
import com.seer.teach.mp.admin.service.AdminParentAgentActivityService;
|
||||||
import com.seer.teach.mp.entity.MpParentAgentActivityRelationEntity;
|
|
||||||
import com.seer.teach.mp.service.IMpParentAgentActivityRelationService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 家长参与代理商活动控制器 - 管理端
|
* 家长参与代理商活动控制器 - 管理端
|
||||||
*/
|
*/
|
||||||
@Tag(name = "管理端 - 家长参与代理商活动管理")
|
@Tag(name = "管理端 - 家长参与代理商活动管理")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/mp/admin/parent/agent/activity")
|
@RequestMapping("/mp/parent/agent/activity")
|
||||||
public class AdminParentAgentActivityController {
|
public class AdminParentAgentActivityController {
|
||||||
|
|
||||||
private final AdminParentAgentActivityService adminParentAgentActivityService;
|
private final AdminParentAgentActivityService adminParentAgentActivityService;
|
||||||
@ -45,4 +41,12 @@ public class AdminParentAgentActivityController {
|
|||||||
public ResultBean<AdminParentAgentActivityResp> detail(@PathVariable Integer id) {
|
public ResultBean<AdminParentAgentActivityResp> detail(@PathVariable Integer id) {
|
||||||
return ResultBean.success(adminParentAgentActivityService.getDetail(id));
|
return ResultBean.success(adminParentAgentActivityService.getDetail(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("delete")
|
||||||
|
@SaCheckPermission("admin:parent:agent:activity:delete")
|
||||||
|
@Operation(summary = "删除家长参与代理商活动记录")
|
||||||
|
@LogPrint
|
||||||
|
public ResultBean<Boolean> delete(@RequestBody List<Integer> ids) {
|
||||||
|
return ResultBean.success(adminParentAgentActivityService.delete(ids));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
|
import com.seer.teach.common.request.PageRequest;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Schema(description = "活动信息收集查询请求")
|
||||||
|
public class ActivityInfoCollectionQueryReq extends PageRequest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 孩子姓名
|
||||||
|
*/
|
||||||
|
@Schema(description = "孩子姓名")
|
||||||
|
private String childName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 孩子性别(M-男,F-女)
|
||||||
|
*/
|
||||||
|
@Schema(description = "孩子性别")
|
||||||
|
private String childGender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 年级
|
||||||
|
*/
|
||||||
|
@Schema(description = "年级")
|
||||||
|
private String grade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学校
|
||||||
|
*/
|
||||||
|
@Schema(description = "学校")
|
||||||
|
private String school;
|
||||||
|
|
||||||
|
}
|
||||||
@ -17,6 +17,10 @@ public class AgentEmployeeSaveReq {
|
|||||||
@NotNull(message = "员工名称不能为空")
|
@NotNull(message = "员工名称不能为空")
|
||||||
private String employeeName;
|
private String employeeName;
|
||||||
|
|
||||||
|
@Schema(description = "员工密码")
|
||||||
|
@NotNull(message = "员工密码不能为空")
|
||||||
|
private String password;
|
||||||
|
|
||||||
@Schema(description = "员工职位")
|
@Schema(description = "员工职位")
|
||||||
private String position;
|
private String position;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,95 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(name = "AdminActivityInfoCollectionResp", description = "活动信息收集响应参数")
|
||||||
|
public class AdminActivityInfoCollectionResp {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联的家长参与代理商活动关系ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "关联的家长参与代理商活动关系ID")
|
||||||
|
private Integer relationId;
|
||||||
|
|
||||||
|
@Schema(description = "代理商ID")
|
||||||
|
private Integer agentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "活动ID")
|
||||||
|
private Integer activityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 家长ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "家长ID")
|
||||||
|
private Integer parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 孩子姓名
|
||||||
|
*/
|
||||||
|
@Schema(description = "孩子姓名")
|
||||||
|
private String childName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 孩子性别(M-男,F-女)
|
||||||
|
*/
|
||||||
|
@Schema(description = "孩子性别")
|
||||||
|
private String childGender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出生年月
|
||||||
|
*/
|
||||||
|
@Schema(description = "出生年月")
|
||||||
|
private LocalDate childBirthDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 年级
|
||||||
|
*/
|
||||||
|
@Schema(description = "年级")
|
||||||
|
private String grade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学校
|
||||||
|
*/
|
||||||
|
@Schema(description = "学校")
|
||||||
|
private String school;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 地区
|
||||||
|
*/
|
||||||
|
@Schema(description = "地区")
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 家长身份(爸爸,妈妈)
|
||||||
|
*/
|
||||||
|
@Schema(description = "家长身份(爸爸,妈妈)")
|
||||||
|
private String parentIdentity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 学习情况(优、良、中、差)
|
||||||
|
*/
|
||||||
|
@Schema(description = "学习情况(优、良、中、差)")
|
||||||
|
private String learningSituation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优势学科(数学、英语等)
|
||||||
|
*/
|
||||||
|
@Schema(description = "偏科(数学、英语等)")
|
||||||
|
private String weakSubject;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -42,4 +42,8 @@ public class AdminParentAgentActivityResp {
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.seer.teach.mp.admin.convert;
|
||||||
|
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AdminActivityInfoCollectionResp;
|
||||||
|
import com.seer.teach.mp.entity.MpActivityInfoCollectionEntity;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AdminActivityInfoCollectionConvert {
|
||||||
|
|
||||||
|
AdminActivityInfoCollectionConvert INSTANCE = Mappers.getMapper(AdminActivityInfoCollectionConvert.class);
|
||||||
|
|
||||||
|
AdminActivityInfoCollectionResp convertToResp(MpActivityInfoCollectionEntity entity);
|
||||||
|
|
||||||
|
List<AdminActivityInfoCollectionResp> convertToRespList(List<MpActivityInfoCollectionEntity> entity);
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ import org.mapstruct.factory.Mappers;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@org.mapstruct.Mapper
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface AdminParentAgentActivityConvert {
|
public interface AdminParentAgentActivityConvert {
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,62 @@
|
|||||||
|
package com.seer.teach.mp.admin.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.ActivityInfoCollectionQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AdminActivityInfoCollectionResp;
|
||||||
|
import com.seer.teach.mp.admin.convert.AdminActivityInfoCollectionConvert;
|
||||||
|
import com.seer.teach.mp.entity.MpActivityInfoCollectionEntity;
|
||||||
|
import com.seer.teach.mp.service.IMpActivityInfoCollectionService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AdminActivityInfoCollectionService {
|
||||||
|
|
||||||
|
private final IMpActivityInfoCollectionService mpActivityInfoCollectionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询活动信息收集记录
|
||||||
|
*
|
||||||
|
* @param req 查询参数
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
public PageListBean<AdminActivityInfoCollectionResp> pageList(ActivityInfoCollectionQueryReq req) {
|
||||||
|
Page<MpActivityInfoCollectionEntity> page = new Page<>(req.getPageNo(), req.getPageSize());
|
||||||
|
LambdaQueryWrapper<MpActivityInfoCollectionEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.like(Objects.nonNull(req.getChildName()) && !req.getChildName().isEmpty(), MpActivityInfoCollectionEntity::getChildName, req.getChildName())
|
||||||
|
.like(Objects.nonNull(req.getGrade()) && !req.getGrade().isEmpty(), MpActivityInfoCollectionEntity::getGrade, req.getGrade())
|
||||||
|
.like(Objects.nonNull(req.getSchool()) && !req.getSchool().isEmpty(), MpActivityInfoCollectionEntity::getSchool, req.getSchool())
|
||||||
|
.like(Objects.nonNull(req.getChildGender()) && !req.getChildGender().isEmpty(), MpActivityInfoCollectionEntity::getChildGender, req.getChildGender())
|
||||||
|
.orderByDesc(MpActivityInfoCollectionEntity::getCreateTime);
|
||||||
|
Page<MpActivityInfoCollectionEntity> result = mpActivityInfoCollectionService.page(page, wrapper);
|
||||||
|
return PageConverterUtils.convertPageListBean(result, AdminActivityInfoCollectionConvert.INSTANCE::convertToRespList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取活动信息收集记录详情
|
||||||
|
* @param id 记录ID
|
||||||
|
* @return 详情
|
||||||
|
*/
|
||||||
|
public AdminActivityInfoCollectionResp getDetail(Integer id) {
|
||||||
|
MpActivityInfoCollectionEntity entity = mpActivityInfoCollectionService.getById(id);
|
||||||
|
return AdminActivityInfoCollectionConvert.INSTANCE.convertToResp(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除活动信息收集记录
|
||||||
|
* @param ids 删除的ID列表
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
public boolean delete(List<Integer> ids) {
|
||||||
|
return mpActivityInfoCollectionService.removeByIds(ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -4,11 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.seer.teach.common.PageListBean;
|
import com.seer.teach.common.PageListBean;
|
||||||
import com.seer.teach.common.ResultBean;
|
|
||||||
import com.seer.teach.common.utils.PageConverterUtils;
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
import com.seer.teach.mp.admin.controller.req.ParentAgentActivityQueryReq;
|
import com.seer.teach.mp.admin.controller.req.ParentAgentActivityQueryReq;
|
||||||
import com.seer.teach.mp.admin.controller.resp.AdminParentAgentActivityResp;
|
import com.seer.teach.mp.admin.controller.resp.AdminParentAgentActivityResp;
|
||||||
import com.seer.teach.mp.admin.controller.resp.MpParentAgentActivityResp;
|
|
||||||
import com.seer.teach.mp.admin.convert.AdminParentAgentActivityConvert;
|
import com.seer.teach.mp.admin.convert.AdminParentAgentActivityConvert;
|
||||||
import com.seer.teach.mp.entity.MpParentAgentActivityRelationEntity;
|
import com.seer.teach.mp.entity.MpParentAgentActivityRelationEntity;
|
||||||
import com.seer.teach.mp.service.IMpParentAgentActivityRelationService;
|
import com.seer.teach.mp.service.IMpParentAgentActivityRelationService;
|
||||||
@ -16,6 +14,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@ -32,7 +31,7 @@ public class AdminParentAgentActivityService {
|
|||||||
LambdaQueryWrapper<MpParentAgentActivityRelationEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<MpParentAgentActivityRelationEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(Objects.nonNull(query.getActivityId()), MpParentAgentActivityRelationEntity::getActivityId, query.getActivityId())
|
wrapper.eq(Objects.nonNull(query.getActivityId()), MpParentAgentActivityRelationEntity::getActivityId, query.getActivityId())
|
||||||
.eq(Objects.nonNull(query.getAgentId()), MpParentAgentActivityRelationEntity::getAgentId, query.getAgentId())
|
.eq(Objects.nonNull(query.getAgentId()), MpParentAgentActivityRelationEntity::getAgentId, query.getAgentId())
|
||||||
.eq(Objects.nonNull(query.getAgentId()), MpParentAgentActivityRelationEntity::getParentId, query.getAgentId())
|
.eq(Objects.nonNull(query.getParentId()), MpParentAgentActivityRelationEntity::getParentId, query.getParentId())
|
||||||
.like(Objects.nonNull(query.getActivityName()) && !query.getActivityName().isEmpty(), MpParentAgentActivityRelationEntity::getActivityName, query.getActivityName())
|
.like(Objects.nonNull(query.getActivityName()) && !query.getActivityName().isEmpty(), MpParentAgentActivityRelationEntity::getActivityName, query.getActivityName())
|
||||||
.like(Objects.nonNull(query.getAgentName()) && !query.getAgentName().isEmpty(), MpParentAgentActivityRelationEntity::getAgentName, query.getAgentName())
|
.like(Objects.nonNull(query.getAgentName()) && !query.getAgentName().isEmpty(), MpParentAgentActivityRelationEntity::getAgentName, query.getAgentName())
|
||||||
.eq(Objects.nonNull(query.getStatus()), MpParentAgentActivityRelationEntity::getStatus, query.getStatus())
|
.eq(Objects.nonNull(query.getStatus()), MpParentAgentActivityRelationEntity::getStatus, query.getStatus())
|
||||||
@ -47,4 +46,8 @@ public class AdminParentAgentActivityService {
|
|||||||
MpParentAgentActivityRelationEntity entity = parentAgentActivityRelationService.getById(id);
|
MpParentAgentActivityRelationEntity entity = parentAgentActivityRelationService.getById(id);
|
||||||
return AdminParentAgentActivityConvert.INSTANCE.convertToResp(entity);
|
return AdminParentAgentActivityConvert.INSTANCE.convertToResp(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean delete(List<Integer> ids) {
|
||||||
|
return parentAgentActivityRelationService.removeByIds(ids);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,16 +6,18 @@ import com.seer.teach.common.PageListBean;
|
|||||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||||
import com.seer.teach.common.utils.AssertUtils;
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
import com.seer.teach.common.utils.PageConverterUtils;
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
|
||||||
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
|
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
||||||
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeSaveReq;
|
||||||
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||||
import com.seer.teach.mp.admin.convert.AdminAgentEmployeeRelationConvert;
|
import com.seer.teach.mp.admin.convert.AdminAgentEmployeeRelationConvert;
|
||||||
|
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
|
||||||
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||||
import com.seer.teach.mp.entity.MpAgentEntity;
|
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||||
import com.seer.teach.mp.service.IMpAgentEmployeeRelationService;
|
import com.seer.teach.mp.service.IMpAgentEmployeeRelationService;
|
||||||
import com.seer.teach.mp.service.IMpAgentService;
|
import com.seer.teach.mp.service.IMpAgentService;
|
||||||
|
import com.seer.teach.user.api.UserInfoServiceApi;
|
||||||
|
import com.seer.teach.user.api.dto.UserInfoDTO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@ -38,6 +40,8 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
|||||||
|
|
||||||
private final IMpAgentService mpAgentService;
|
private final IMpAgentService mpAgentService;
|
||||||
|
|
||||||
|
private final UserInfoServiceApi userInfoServiceApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageListBean<AgentEmployeeRelationResp> pageList(AgentEmployeeRelationQueryReq query) {
|
public PageListBean<AgentEmployeeRelationResp> pageList(AgentEmployeeRelationQueryReq query) {
|
||||||
Page<MpAgentEmployeeRelationEntity> pageParm = new Page<>(query.getPageNo(), query.getPageSize());
|
Page<MpAgentEmployeeRelationEntity> pageParm = new Page<>(query.getPageNo(), query.getPageSize());
|
||||||
@ -70,15 +74,29 @@ public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmploye
|
|||||||
public List<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId) {
|
public List<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId) {
|
||||||
var relations = agentEmployeeRelationService.getEmployeeRelationsByAgentId(agentId);
|
var relations = agentEmployeeRelationService.getEmployeeRelationsByAgentId(agentId);
|
||||||
return relations.stream()
|
return relations.stream()
|
||||||
.map(AdminAgentEmployeeRelationConvert.INSTANCE::convertToResp)
|
.map(AdminAgentEmployeeRelationConvert.INSTANCE::convertToResp)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean save(AgentEmployeeSaveReq request) {
|
public boolean save(AgentEmployeeSaveReq request) {
|
||||||
AssertUtils.isNull(request.getAgentName(), ResultCodeEnum.AGENT_EMPLOYEE_ALREADY_EXISTS);
|
MpAgentEmployeeRelationEntity one = agentEmployeeRelationService.lambdaQuery()
|
||||||
MpAgentEmployeeRelationEntity relation = AdminAgentEmployeeRelationConvert.INSTANCE.convert(request);
|
.eq(MpAgentEmployeeRelationEntity::getEmployeeName, request.getEmployeeName()).one();
|
||||||
|
AssertUtils.isNull(one, ResultCodeEnum.AGENT_EMPLOYEE_ALREADY_EXISTS);
|
||||||
|
UserInfoDTO userInfoDTO = new UserInfoDTO();
|
||||||
|
userInfoDTO.setUserName(request.getEmployeeName());
|
||||||
|
userInfoDTO.setPassword(request.getPassword());
|
||||||
|
userInfoServiceApi.saveAgentInfo(userInfoDTO);
|
||||||
|
Integer employeeUserId = userInfoServiceApi.getUserIdByUserName(request.getEmployeeName());
|
||||||
Integer agentId = mpAgentService.lambdaQuery().eq(MpAgentEntity::getAgentName, request.getAgentName()).one().getId();
|
Integer agentId = mpAgentService.lambdaQuery().eq(MpAgentEntity::getAgentName, request.getAgentName()).one().getId();
|
||||||
|
MpAgentEmployeeRelationEntity entity = new MpAgentEmployeeRelationEntity();
|
||||||
|
entity.setAgentId(agentId);
|
||||||
|
entity.setEmployeeUserId(employeeUserId);
|
||||||
|
entity.setEmployeeName(request.getEmployeeName());
|
||||||
|
entity.setAgentName(request.getAgentName());
|
||||||
|
entity.setPosition(request.getPosition());
|
||||||
|
entity.setStatus(request.getStatus());
|
||||||
|
agentEmployeeRelationService.save(entity);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,6 +127,7 @@ DROP TABLE IF EXISTS `mp_activity_info_collection`;
|
|||||||
CREATE TABLE `mp_activity_info_collection` (
|
CREATE TABLE `mp_activity_info_collection` (
|
||||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '信息收集ID',
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '信息收集ID',
|
||||||
`relation_id` int NOT NULL COMMENT '关联的家长参与代理商活动关系ID',
|
`relation_id` int NOT NULL COMMENT '关联的家长参与代理商活动关系ID',
|
||||||
|
`agent_id` int NOT NULL COMMENT '代理商ID',
|
||||||
`activity_id` int NOT NULL COMMENT '活动ID',
|
`activity_id` int NOT NULL COMMENT '活动ID',
|
||||||
`parent_id` int NOT NULL COMMENT '家长ID',
|
`parent_id` int NOT NULL COMMENT '家长ID',
|
||||||
`child_name` varchar(100) COMMENT '孩子姓名',
|
`child_name` varchar(100) COMMENT '孩子姓名',
|
||||||
@ -137,6 +138,8 @@ CREATE TABLE `mp_activity_info_collection` (
|
|||||||
`region` varchar(255) COMMENT '地区',
|
`region` varchar(255) COMMENT '地区',
|
||||||
`parent_identity` varchar(20) COMMENT '家长身份(爸爸,妈妈)',
|
`parent_identity` varchar(20) COMMENT '家长身份(爸爸,妈妈)',
|
||||||
`learning_situation` varchar(20) COMMENT '学习情况(优、良、中、差)',
|
`learning_situation` varchar(20) COMMENT '学习情况(优、良、中、差)',
|
||||||
|
`weak_subject_ids` varchar(50) COMMENT '薄弱科目',
|
||||||
|
`strong_subject_ids` varchar(50) COMMENT '优势科目',
|
||||||
`weak_subject` varchar(50) COMMENT '偏科(数学、英语等)',
|
`weak_subject` varchar(50) COMMENT '偏科(数学、英语等)',
|
||||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP 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 '创建人',
|
`create_by` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_german2_ci NULL DEFAULT NULL COMMENT '创建人',
|
||||||
|
|||||||
@ -170,4 +170,10 @@ public interface UserInfoServiceApi {
|
|||||||
|
|
||||||
@GetMapping("/checkUserInfo")
|
@GetMapping("/checkUserInfo")
|
||||||
Integer checkUserInfo(@RequestParam("userId") Integer userId);
|
Integer checkUserInfo(@RequestParam("userId") Integer userId);
|
||||||
|
|
||||||
|
@GetMapping("/getUserIdByUserName")
|
||||||
|
Integer getUserIdByUserName(@RequestParam("userName") String userName);
|
||||||
|
|
||||||
|
@PostMapping("/save-agentInfo")
|
||||||
|
boolean saveAgentInfo(@RequestBody UserInfoDTO userInfoDTO);
|
||||||
}
|
}
|
||||||
@ -61,6 +61,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID获取用户信息
|
* 根据用户ID获取用户信息
|
||||||
|
*
|
||||||
* @param id 用户ID
|
* @param id 用户ID
|
||||||
* @return 用户信息DTO对象
|
* @return 用户信息DTO对象
|
||||||
*/
|
*/
|
||||||
@ -72,7 +73,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
log.info("userEntity:{}", userEntity);
|
log.info("userEntity:{}", userEntity);
|
||||||
UserExtendEntity userExtendEntity = userExtendService.getUserExtendByUserId(id);
|
UserExtendEntity userExtendEntity = userExtendService.getUserExtendByUserId(id);
|
||||||
log.info("userExtendEntity:{}", userExtendEntity);
|
log.info("userExtendEntity:{}", userExtendEntity);
|
||||||
return UserInfoConvert.INSTANCE.convertOne(userEntity,userExtendEntity);
|
return UserInfoConvert.INSTANCE.convertOne(userEntity, userExtendEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -93,20 +94,21 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserAuthDTO> getUserAuthListByUserIdsAndAppId(UserAuthQueryDTO userAuthQueryDTO){
|
public List<UserAuthDTO> getUserAuthListByUserIdsAndAppId(UserAuthQueryDTO userAuthQueryDTO) {
|
||||||
List<UserAuthEntity> userAuthList = userAuthService.getUserAuthListByUserIdsAndAppId(userAuthQueryDTO.getUserIds(), userAuthQueryDTO.getAppId());
|
List<UserAuthEntity> userAuthList = userAuthService.getUserAuthListByUserIdsAndAppId(userAuthQueryDTO.getUserIds(), userAuthQueryDTO.getAppId());
|
||||||
return UserInfoConvert.INSTANCE.convertUserAuthList(userAuthList);
|
return UserInfoConvert.INSTANCE.convertUserAuthList(userAuthList);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据OpenId获取用户信息
|
* 根据OpenId获取用户信息
|
||||||
|
*
|
||||||
* @param openId 微信OpenId
|
* @param openId 微信OpenId
|
||||||
* @return 用户信息DTO对象
|
* @return 用户信息DTO对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public UserInfoDTO getByOpenId(String openId) {
|
public UserInfoDTO getByOpenId(String openId) {
|
||||||
UserAuthEntity userAuthEntity = userAuthService.getOneByOpenId(openId);
|
UserAuthEntity userAuthEntity = userAuthService.getOneByOpenId(openId);
|
||||||
if(Objects.isNull(userAuthEntity)){
|
if (Objects.isNull(userAuthEntity)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
UserEntity userEntity = userService.getById(userAuthEntity.getUserId());
|
UserEntity userEntity = userService.getById(userAuthEntity.getUserId());
|
||||||
@ -115,13 +117,14 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户权限信息
|
* 获取用户权限信息
|
||||||
|
*
|
||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
* @return 用户权限DTO对象
|
* @return 用户权限DTO对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public UserPermissionDTO getUserPermission(Integer userId) {
|
public UserPermissionDTO getUserPermission(Integer userId) {
|
||||||
UserEntity userEntity = userService.getById(userId);
|
UserEntity userEntity = userService.getById(userId);
|
||||||
if(Objects.isNull(userEntity)){
|
if (Objects.isNull(userEntity)) {
|
||||||
return new UserPermissionDTO();
|
return new UserPermissionDTO();
|
||||||
}
|
}
|
||||||
List<AuthorityEntity> permissions = authorityService.getPermissionsByUserId(userId);
|
List<AuthorityEntity> permissions = authorityService.getPermissionsByUserId(userId);
|
||||||
@ -130,7 +133,8 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 为用户添加经验值
|
* 为用户添加经验值
|
||||||
* @param userId 用户ID
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
* @param experienceValue 要添加的经验值
|
* @param experienceValue 要添加的经验值
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@ -140,11 +144,12 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
UserExtendEntity userExtend = userExtendService.extraPoints(userId, experienceValue);
|
UserExtendEntity userExtend = userExtendService.extraPoints(userId, experienceValue);
|
||||||
Integer parentId = userInfoServiceApi.getParentIdByChildrenId(children.getId());
|
Integer parentId = userInfoServiceApi.getParentIdByChildrenId(children.getId());
|
||||||
UserCoinAccountRespDTO userCoinAccount = coinAccountServiceApi.getUserCoinAccount(parentId);
|
UserCoinAccountRespDTO userCoinAccount = coinAccountServiceApi.getUserCoinAccount(parentId);
|
||||||
pushUpdateChildrenInfoMessage(children,userExtend,device,userId,userCoinAccount);
|
pushUpdateChildrenInfoMessage(children, userExtend, device, userId, userCoinAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取孩子信息
|
* 获取孩子信息
|
||||||
|
*
|
||||||
* @param userId 孩子用户ID
|
* @param userId 孩子用户ID
|
||||||
* @return 孩子信息DTO对象
|
* @return 孩子信息DTO对象
|
||||||
*/
|
*/
|
||||||
@ -168,6 +173,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取孩子年级ID
|
* 获取孩子年级ID
|
||||||
|
*
|
||||||
* @param userId 孩子用户ID
|
* @param userId 孩子用户ID
|
||||||
* @return 年级ID
|
* @return 年级ID
|
||||||
*/
|
*/
|
||||||
@ -179,24 +185,25 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存用户信息
|
* 保存用户信息
|
||||||
|
*
|
||||||
* @param userInfoDTO 用户信息DTO对象
|
* @param userInfoDTO 用户信息DTO对象
|
||||||
* @return 用户ID,如果用户已存在则返回已存在的用户ID
|
* @return 用户ID,如果用户已存在则返回已存在的用户ID
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Integer save(UserInfoDTO userInfoDTO) {
|
public Integer save(UserInfoDTO userInfoDTO) {
|
||||||
// 根据UnionId判断用户是否已存在
|
// 根据UnionId判断用户是否已存在
|
||||||
if(StringUtils.hasText(userInfoDTO.getUnionId())){
|
if (StringUtils.hasText(userInfoDTO.getUnionId())) {
|
||||||
UserAuthEntity userAuthEntity = userAuthService.getOneByUnionId(userInfoDTO.getUnionId());
|
UserAuthEntity userAuthEntity = userAuthService.getOneByUnionId(userInfoDTO.getUnionId());
|
||||||
if(Objects.nonNull(userAuthEntity)){
|
if (Objects.nonNull(userAuthEntity)) {
|
||||||
log.info("用户已存在,请勿重复添加");
|
log.info("用户已存在,请勿重复添加");
|
||||||
return userAuthEntity.getId();
|
return userAuthEntity.getId();
|
||||||
}
|
}
|
||||||
return save0(userInfoDTO);
|
return save0(userInfoDTO);
|
||||||
}
|
}
|
||||||
// 根据OpenId判断用户是否已存在
|
// 根据OpenId判断用户是否已存在
|
||||||
if(StringUtils.hasText(userInfoDTO.getOpenId())){
|
if (StringUtils.hasText(userInfoDTO.getOpenId())) {
|
||||||
UserAuthEntity one = userAuthService.getOneByOpenId(userInfoDTO.getOpenId());
|
UserAuthEntity one = userAuthService.getOneByOpenId(userInfoDTO.getOpenId());
|
||||||
if(Objects.nonNull(one)){
|
if (Objects.nonNull(one)) {
|
||||||
log.info("用户已存在,请勿重复添加");
|
log.info("用户已存在,请勿重复添加");
|
||||||
return one.getId();
|
return one.getId();
|
||||||
}
|
}
|
||||||
@ -220,7 +227,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
@Override
|
@Override
|
||||||
public List<UserInfoDTO> listByMobile(String mobile) {
|
public List<UserInfoDTO> listByMobile(String mobile) {
|
||||||
List<UserEntity> userList = userService.list(new LambdaQueryWrapper<UserEntity>()
|
List<UserEntity> userList = userService.list(new LambdaQueryWrapper<UserEntity>()
|
||||||
.like(UserEntity::getMobile, mobile));
|
.like(UserEntity::getMobile, mobile));
|
||||||
return UserInfoConvert.INSTANCE.convertList(userList);
|
return UserInfoConvert.INSTANCE.convertList(userList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,6 +240,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID列表获取用户信息
|
* 根据用户ID列表获取用户信息
|
||||||
|
*
|
||||||
* @param userIds
|
* @param userIds
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -244,6 +252,7 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户ID获取用户信息
|
* 根据用户ID获取用户信息
|
||||||
|
*
|
||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -265,40 +274,64 @@ public class UserInfoServiceApiImpl implements UserInfoServiceApi {
|
|||||||
@Override
|
@Override
|
||||||
public Integer checkUserInfo(Integer userId) {
|
public Integer checkUserInfo(Integer userId) {
|
||||||
UserExtendEntity byUserId = userExtendService.getByUserId(userId);
|
UserExtendEntity byUserId = userExtendService.getByUserId(userId);
|
||||||
if (Objects.isNull(byUserId)){
|
if (Objects.isNull(byUserId)) {
|
||||||
return IsInfoEnum.NO_INFO.getCode();
|
return IsInfoEnum.NO_INFO.getCode();
|
||||||
}
|
}
|
||||||
return IsInfoEnum.HAS_INFO.getCode();
|
return IsInfoEnum.HAS_INFO.getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getUserIdByUserName(String userName) {
|
||||||
|
UserEntity userEntity = userService.getOne(new LambdaQueryWrapper<UserEntity>()
|
||||||
|
.eq(UserEntity::getUserName, userName));
|
||||||
|
if (Objects.nonNull(userEntity)) {
|
||||||
|
return userEntity.getId();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveAgentInfo(UserInfoDTO userInfoDTO) {
|
||||||
|
UserEntity one = userService.getOne(new LambdaQueryWrapper<UserEntity>()
|
||||||
|
.eq(UserEntity::getUserName, userInfoDTO.getUserName()));
|
||||||
|
AssertUtils.isNull(one, ResultCodeEnum.USERNAME_IS_EXIST);
|
||||||
|
UserEntity user = new UserEntity();
|
||||||
|
user.setUserName(userInfoDTO.getUserName());
|
||||||
|
String password = CommonUtils.encryptPassword(userInfoDTO.getPassword());
|
||||||
|
user.setPassword(password);
|
||||||
|
return userService.save(user);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送更新孩子信息的MQ消息
|
* 推送更新孩子信息的MQ消息
|
||||||
* @param children 孩子用户实体对象
|
*
|
||||||
|
* @param children 孩子用户实体对象
|
||||||
* @param userExtendEntity 用户扩展信息实体对象
|
* @param userExtendEntity 用户扩展信息实体对象
|
||||||
* @param device 设备信息
|
* @param device 设备信息
|
||||||
* @param userId 用户ID
|
* @param userId 用户ID
|
||||||
*/
|
*/
|
||||||
public void pushUpdateChildrenInfoMessage(UserEntity children,UserExtendEntity userExtendEntity, String device, Integer userId,UserCoinAccountRespDTO userCoinAccount) {
|
public void pushUpdateChildrenInfoMessage(UserEntity children, UserExtendEntity userExtendEntity, String device, Integer userId, UserCoinAccountRespDTO userCoinAccount) {
|
||||||
// 获取年级和等级信息
|
// 获取年级和等级信息
|
||||||
GradeEntity grade = gradeService.getById(userExtendEntity.getGradeId());
|
GradeEntity grade = gradeService.getById(userExtendEntity.getGradeId());
|
||||||
LevelEntity level = levelService.getById(userExtendEntity.getLevelId());
|
LevelEntity level = levelService.getById(userExtendEntity.getLevelId());
|
||||||
MqUserInfoDTO userInfoDTO = UserInfoConvert.INSTANCE.toMqUserInfoDTO(children, userExtendEntity,grade,level,device);
|
MqUserInfoDTO userInfoDTO = UserInfoConvert.INSTANCE.toMqUserInfoDTO(children, userExtendEntity, grade, level, device);
|
||||||
userInfoDTO.setExperience(CommonUtils.calculatePercentage(userExtendEntity.getExperience(), level.getPoint()));
|
userInfoDTO.setExperience(CommonUtils.calculatePercentage(userExtendEntity.getExperience(), level.getPoint()));
|
||||||
userInfoDTO.setCoinNumber(userCoinAccount.getAvailableBalance().intValue());
|
userInfoDTO.setCoinNumber(userCoinAccount.getAvailableBalance().intValue());
|
||||||
String userJson = JSONUtil.toJsonStr(userInfoDTO);
|
String userJson = JSONUtil.toJsonStr(userInfoDTO);
|
||||||
String topic = ImMqTopicEnum.USER_INFO.getTopic();
|
String topic = ImMqTopicEnum.USER_INFO.getTopic();
|
||||||
String tag = UserInfoTopiTagEnum.UPDATE_CHILDREN_INFO.getTag();
|
String tag = UserInfoTopiTagEnum.UPDATE_CHILDREN_INFO.getTag();
|
||||||
log.info("发送更新孩子[{}]MQ消息开始 Device: [{}],Topic:{}, Tag:{}",userId,device,topic,tag);
|
log.info("发送更新孩子[{}]MQ消息开始 Device: [{}],Topic:{}, Tag:{}", userId, device, topic, tag);
|
||||||
mqProducer.sendMsg(topic, tag,device, userJson);
|
mqProducer.sendMsg(topic, tag, device, userJson);
|
||||||
log.info("发送更新孩子[{}]MQ消息成功 Device: [{}]",userId,device);
|
log.info("发送更新孩子[{}]MQ消息成功 Device: [{}]", userId, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实际保存用户信息的私有方法
|
* 实际保存用户信息的私有方法
|
||||||
|
*
|
||||||
* @param userInfoDTO 用户信息DTO对象
|
* @param userInfoDTO 用户信息DTO对象
|
||||||
* @return 保存后的用户ID
|
* @return 保存后的用户ID
|
||||||
*/
|
*/
|
||||||
private int save0(UserInfoDTO userInfoDTO){
|
private int save0(UserInfoDTO userInfoDTO) {
|
||||||
UserEntity UserEntity = UserInfoConvert.INSTANCE.convertOne(userInfoDTO);
|
UserEntity UserEntity = UserInfoConvert.INSTANCE.convertOne(userInfoDTO);
|
||||||
boolean saveOrUpdate = userService.saveOrUpdate(UserEntity);
|
boolean saveOrUpdate = userService.saveOrUpdate(UserEntity);
|
||||||
log.info("保存用户信息:{}", saveOrUpdate);
|
log.info("保存用户信息:{}", saveOrUpdate);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user