增加代理商,活动,代理商员工关,代理商活动参与者相关功能
This commit is contained in:
parent
da1f49001d
commit
893a441d6c
@ -0,0 +1,37 @@
|
|||||||
|
package com.seer.teach.mp.api.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(name = "AgentActivityDTO", description = "代理商活动DTO")
|
||||||
|
@Data
|
||||||
|
public class AgentActivityDTO {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "活动名称")
|
||||||
|
private String activityName;
|
||||||
|
|
||||||
|
@Schema(description = "活动描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "活动开始时间")
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
@Schema(description = "活动结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@Schema(description = "活动状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "创建人ID")
|
||||||
|
private Integer creatorId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.seer.teach.mp.api.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商DTO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(name = "代理商DTO")
|
||||||
|
public class AgentDTO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(name = "代理商ID")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(name = "代理商名称")
|
||||||
|
private String agentName;
|
||||||
|
|
||||||
|
@Schema(name = "代理商编码")
|
||||||
|
private String agentCode;
|
||||||
|
|
||||||
|
@Schema(name = "代理商等级")
|
||||||
|
private String agentLevel;
|
||||||
|
|
||||||
|
@Schema(name = "联系人姓名")
|
||||||
|
private String contactName;
|
||||||
|
|
||||||
|
@Schema(name = "联系电话")
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
@Schema(name = "代理商地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Schema(name = "代理商状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(name = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(name = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.seer.teach.mp.api.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(name = "AgentEmployeeRelationDTO", description = "代理商员工关联DTO")
|
||||||
|
@Data
|
||||||
|
public class AgentEmployeeRelationDTO {
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("mp_activities")
|
||||||
|
@Schema(name = "MpAgentActivityEntity对象", description = "活动表")
|
||||||
|
public class MpAgentActivityEntity extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动名称,如千人助学计划
|
||||||
|
*/
|
||||||
|
@TableField("activity_name")
|
||||||
|
private String activityName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动描述
|
||||||
|
*/
|
||||||
|
@TableField("description")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动开始时间
|
||||||
|
*/
|
||||||
|
@TableField("start_time")
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动结束时间
|
||||||
|
*/
|
||||||
|
@TableField("end_time")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动状态:0-禁用,1-启用
|
||||||
|
*/
|
||||||
|
@TableField("status")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动操作日志表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("mp_agent_activity_log")
|
||||||
|
@Schema(name = "MpAgentActivityLogEntity对象", description = "代理商活动操作日志表")
|
||||||
|
public class MpAgentActivityLogEntity extends BaseEntity {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动ID
|
||||||
|
*/
|
||||||
|
@TableField("activity_id")
|
||||||
|
private Integer activityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人ID
|
||||||
|
*/
|
||||||
|
@TableField("operator_id")
|
||||||
|
private Integer operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
*/
|
||||||
|
@TableField("operation_type")
|
||||||
|
private String operationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作描述
|
||||||
|
*/
|
||||||
|
@TableField("description")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作前数据(JSON格式)
|
||||||
|
*/
|
||||||
|
@TableField("before_data")
|
||||||
|
private String beforeData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作后数据(JSON格式)
|
||||||
|
*/
|
||||||
|
@TableField("after_data")
|
||||||
|
private String afterData;
|
||||||
|
}
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动参与记录表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("mp_agent_activity_participants")
|
||||||
|
@Schema(name = "MpAgentActivityParticipantEntity对象", description = "代理商活动参与记录表")
|
||||||
|
public class MpAgentActivityParticipantEntity extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动ID
|
||||||
|
*/
|
||||||
|
@TableField("activity_id")
|
||||||
|
private Integer activityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商ID(对应user表的ID)
|
||||||
|
*/
|
||||||
|
@TableField("agent_id")
|
||||||
|
private Integer agentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 家长ID(对应user表的ID)
|
||||||
|
*/
|
||||||
|
@TableField("parent_id")
|
||||||
|
private Integer parentId;
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商员工关联表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("mp_agent_employee_relations")
|
||||||
|
@Schema(name = "MpAgentEmployeeRelationEntity对象", description = "代理商员工关联表")
|
||||||
|
public class MpAgentEmployeeRelationEntity extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商ID(对应user表的ID)
|
||||||
|
*/
|
||||||
|
@TableField("agent_id")
|
||||||
|
private Integer agentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工用户ID(对应user表的ID)
|
||||||
|
*/
|
||||||
|
@TableField("employee_user_id")
|
||||||
|
private Integer employeeUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工职位
|
||||||
|
*/
|
||||||
|
@TableField("position")
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工状态:0-禁用,1-启用
|
||||||
|
*/
|
||||||
|
@TableField("status")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
package com.seer.teach.mp.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.seer.teach.common.entity.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商实体类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("mp_agents")
|
||||||
|
public class MpAgentEntity extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商名称
|
||||||
|
*/
|
||||||
|
private String agentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商编码
|
||||||
|
*/
|
||||||
|
private String agentCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商等级
|
||||||
|
*/
|
||||||
|
private String agentLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人姓名
|
||||||
|
*/
|
||||||
|
private String contactName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商状态:0-禁用,1-启用
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.seer.teach.mp.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityLogEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动操作日志表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MpAgentActivityLogMapper extends BaseMapper<MpAgentActivityLogEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.seer.teach.mp.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MpAgentActivityMapper extends BaseMapper<MpAgentActivityEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.seer.teach.mp.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动参与记录表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MpAgentActivityParticipantMapper extends BaseMapper<MpAgentActivityParticipantEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.seer.teach.mp.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商员工关联表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MpAgentEmployeeRelationMapper extends BaseMapper<MpAgentEmployeeRelationEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package com.seer.teach.mp.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商Mapper接口
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface MpAgentMapper extends BaseMapper<MpAgentEntity> {
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
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.AgentActivityQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentActivityReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AgentActivityResp;
|
||||||
|
import com.seer.teach.mp.admin.service.IAdminAgentActivityService;
|
||||||
|
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.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@LogPrint
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@Tag(name = "管理端 - 代理商活动")
|
||||||
|
@RequestMapping("/mp/agent/activity")
|
||||||
|
public class AdminAgentActivityController {
|
||||||
|
|
||||||
|
private final IAdminAgentActivityService agentActivityService;
|
||||||
|
|
||||||
|
@Operation(summary = "代理商活动列表")
|
||||||
|
@GetMapping("/page-list")
|
||||||
|
@SaCheckPermission("mp:admin:agent:activity:list")
|
||||||
|
public ResultBean<PageListBean<AgentActivityResp>> pageList(AgentActivityQueryReq query) {
|
||||||
|
return ResultBean.success(agentActivityService.pageList(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "创建或更新代理商活动")
|
||||||
|
@PostMapping("/save")
|
||||||
|
@SaCheckPermission("mp:admin:agent:activity:save")
|
||||||
|
public ResultBean<Boolean> save(@Valid @RequestBody AgentActivityReq request) {
|
||||||
|
return ResultBean.success(agentActivityService.saveOrUpdateActivity(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除代理商活动")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@SaCheckPermission("mp:admin:agent:activity:delete")
|
||||||
|
public ResultBean<Boolean> delete(@PathVariable Integer id) {
|
||||||
|
return ResultBean.success(agentActivityService.deleteActivity(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "详情")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@SaCheckPermission("mp:admin:agent:activity:get")
|
||||||
|
public ResultBean<AgentActivityResp> get(@PathVariable Integer id) {
|
||||||
|
AgentActivityResp result = agentActivityService.getById(id);
|
||||||
|
return ResultBean.success(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
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.AgentQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AgentResp;
|
||||||
|
import com.seer.teach.mp.admin.service.AdminAgentService;
|
||||||
|
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.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@LogPrint
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@Tag(name = "管理端 - 代理商")
|
||||||
|
@RequestMapping("/mp/agent")
|
||||||
|
public class AdminAgentController {
|
||||||
|
|
||||||
|
private final AdminAgentService adminAgentService;
|
||||||
|
|
||||||
|
@Operation(summary = "代理商列表")
|
||||||
|
@GetMapping("/page-list")
|
||||||
|
@SaCheckPermission("mp:admin:agent:list")
|
||||||
|
public ResultBean<PageListBean<AgentResp>> pageList(AgentQueryReq query) {
|
||||||
|
return ResultBean.success(adminAgentService.pageList(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "详情")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@SaCheckPermission("mp:admin:agent:get")
|
||||||
|
public ResultBean<AgentResp> getAgent(@PathVariable Integer id) {
|
||||||
|
return ResultBean.success(adminAgentService.getAgentById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "新增")
|
||||||
|
@PostMapping
|
||||||
|
@SaCheckPermission("mp:admin:agent:save")
|
||||||
|
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 MpAgentEntity agentEntity) {
|
||||||
|
return ResultBean.success(adminAgentService.updateAgent(agentEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除")
|
||||||
|
@DeleteMapping
|
||||||
|
@SaCheckPermission("mp:admin:agent:delete")
|
||||||
|
public ResultBean<Boolean> delete(@RequestBody List<Integer> ids) {
|
||||||
|
return ResultBean.success(adminAgentService.deleteById(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
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.AgentEmployeeRelationQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||||
|
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
|
||||||
|
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.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@LogPrint
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@Tag(name = "管理端 - 代理商员工")
|
||||||
|
@RequestMapping("/mp/agent/employee")
|
||||||
|
public class AdminAgentEmployeeRelationController {
|
||||||
|
|
||||||
|
private final IAdminAgentEmployeeRelationService agentEmployeeRelationService;
|
||||||
|
|
||||||
|
@Operation(summary = "代理商员工关联列表")
|
||||||
|
@GetMapping("/page-list")
|
||||||
|
@SaCheckPermission("mp:admin:agent:employee:list")
|
||||||
|
public ResultBean<PageListBean<AgentEmployeeRelationResp>> pageList(AgentEmployeeRelationQueryReq query) {
|
||||||
|
return ResultBean.success(agentEmployeeRelationService.pageList(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "创建或更新代理商员工关联")
|
||||||
|
@PostMapping("/save")
|
||||||
|
@SaCheckPermission("mp:admin:agent:employee:save")
|
||||||
|
public ResultBean<Boolean> save(@Valid @RequestBody AgentEmployeeRelationReq request) {
|
||||||
|
return ResultBean.success(agentEmployeeRelationService.saveOrUpdateRelation(request));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除代理商员工关联")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@SaCheckPermission("mp:admin:agent:employee:delete")
|
||||||
|
public ResultBean<Boolean> delete(@PathVariable Integer id) {
|
||||||
|
return ResultBean.success(agentEmployeeRelationService.deleteRelation(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "详情")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@SaCheckPermission("mp:admin:agent:employee:get")
|
||||||
|
public ResultBean<AgentEmployeeRelationResp> get(@PathVariable Integer id) {
|
||||||
|
AgentEmployeeRelationResp result = agentEmployeeRelationService.getById(id);
|
||||||
|
return ResultBean.success(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据代理商ID获取员工列表")
|
||||||
|
@GetMapping("/by-agent/{agentId}")
|
||||||
|
@SaCheckPermission("mp:admin:agent:employee:by-agent")
|
||||||
|
public ResultBean<java.util.List<AgentEmployeeRelationResp>> getByAgent(@PathVariable Integer agentId) {
|
||||||
|
return ResultBean.success(agentEmployeeRelationService.getEmployeeRelationsByAgentId(agentId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,13 +1,13 @@
|
|||||||
package com.seer.teach.mp.controller;
|
package com.seer.teach.mp.admin.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
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.mp.controller.req.MpDealerApplyQueryReq;
|
import com.seer.teach.mp.admin.controller.req.MpDealerApplyQueryReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpDealerApplyResp;
|
import com.seer.teach.mp.admin.controller.resp.MpDealerApplyResp;
|
||||||
import com.seer.teach.mp.request.DealerApplyReq;
|
import com.seer.teach.mp.request.DealerApplyReq;
|
||||||
import com.seer.teach.mp.service.AdminDealerApplicationsService;
|
import com.seer.teach.mp.admin.service.AdminDealerApplicationsService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.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.core.metadata.IPage;
|
||||||
@ -6,11 +6,11 @@ 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.utils.PageConverterUtils;
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupReq;
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupQueryReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupQueryReq;
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupUpdateReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupUpdateReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpMessageGroupResp;
|
import com.seer.teach.mp.admin.controller.resp.MpMessageGroupResp;
|
||||||
import com.seer.teach.mp.convert.MpMessageGroupConvert;
|
import com.seer.teach.mp.admin.convert.MpMessageGroupConvert;
|
||||||
import com.seer.teach.mp.entity.MpMessageGroupEntity;
|
import com.seer.teach.mp.entity.MpMessageGroupEntity;
|
||||||
import com.seer.teach.mp.service.IMqMessageGroupService;
|
import com.seer.teach.mp.service.IMqMessageGroupService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -33,9 +33,8 @@ public class AdminMessageGroupController {
|
|||||||
@PostMapping
|
@PostMapping
|
||||||
@Operation(summary = "创建消息组")
|
@Operation(summary = "创建消息组")
|
||||||
@SaCheckPermission("admin:mp:message-group:create")
|
@SaCheckPermission("admin:mp:message-group:create")
|
||||||
public ResultBean create(@RequestBody @Validated MpMessageGroupReq params) {
|
public ResultBean<Boolean> create(@RequestBody @Validated MpMessageGroupReq params) {
|
||||||
mqMessageGroupService.crateMesGroup(MpMessageGroupConvert.INSTANCE.convertOne(params));
|
return ResultBean.success(mqMessageGroupService.crateMesGroup(MpMessageGroupConvert.INSTANCE.convertOne(params))) ;
|
||||||
return ResultBean.success() ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -59,7 +58,7 @@ public class AdminMessageGroupController {
|
|||||||
Page<MpMessageGroupEntity> pageParam = new Page<>(params.getPageNo(), params.getPageSize());
|
Page<MpMessageGroupEntity> pageParam = new Page<>(params.getPageNo(), params.getPageSize());
|
||||||
MpMessageGroupEntity queryParam = MpMessageGroupConvert.INSTANCE.convertQueryOne(params);
|
MpMessageGroupEntity queryParam = MpMessageGroupConvert.INSTANCE.convertQueryOne(params);
|
||||||
IPage<MpMessageGroupEntity> pageList = mqMessageGroupService.pageList(pageParam, queryParam);
|
IPage<MpMessageGroupEntity> pageList = mqMessageGroupService.pageList(pageParam, queryParam);
|
||||||
PageListBean resultBean = PageConverterUtils.convertPageListBean(pageList, MpMessageGroupConvert.INSTANCE::convertRespList);
|
PageListBean<MpMessageGroupResp> resultBean = PageConverterUtils.convertPageListBean(pageList, MpMessageGroupConvert.INSTANCE::convertRespList);
|
||||||
return ResultBean.success(resultBean);
|
return ResultBean.success(resultBean);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,11 +68,10 @@ public class AdminMessageGroupController {
|
|||||||
@PostMapping("/{id}")
|
@PostMapping("/{id}")
|
||||||
@Operation(summary = "更新消息组")
|
@Operation(summary = "更新消息组")
|
||||||
@SaCheckPermission("admin:mp:message-group:update")
|
@SaCheckPermission("admin:mp:message-group:update")
|
||||||
public ResultBean update(@RequestBody @Validated MpMessageGroupUpdateReq params,
|
public ResultBean<Boolean> update(@RequestBody @Validated MpMessageGroupUpdateReq params,
|
||||||
@PathVariable Integer id) {
|
@PathVariable Integer id) {
|
||||||
MpMessageGroupEntity entity = MpMessageGroupConvert.INSTANCE.convertUpdateOne( params);
|
MpMessageGroupEntity entity = MpMessageGroupConvert.INSTANCE.convertUpdateOne( params);
|
||||||
mqMessageGroupService.updateMesGroup(entity, id);
|
return ResultBean.success(mqMessageGroupService.updateMesGroup(entity, id));
|
||||||
return ResultBean.success();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,8 +80,7 @@ public class AdminMessageGroupController {
|
|||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
@Operation(summary = "根据ID删除消息组")
|
@Operation(summary = "根据ID删除消息组")
|
||||||
@SaCheckPermission("admin:mp:message-group:delete")
|
@SaCheckPermission("admin:mp:message-group:delete")
|
||||||
public ResultBean delete(@PathVariable Integer id) {
|
public ResultBean<Boolean> delete(@PathVariable Integer id) {
|
||||||
mqMessageGroupService.deleteById(id);
|
return ResultBean.success(mqMessageGroupService.deleteById(id));
|
||||||
return ResultBean.success();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,14 +1,14 @@
|
|||||||
package com.seer.teach.mp.controller;
|
package com.seer.teach.mp.admin.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
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.ResultBean;
|
||||||
import com.seer.teach.common.utils.PageConverterUtils;
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupUserReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupUserReq;
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupUserQueryReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupUserQueryReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpMessageGroupUserResp;
|
import com.seer.teach.mp.admin.controller.resp.MpMessageGroupUserResp;
|
||||||
import com.seer.teach.mp.convert.MpMessageGroupUserConvert;
|
import com.seer.teach.mp.admin.convert.MpMessageGroupUserConvert;
|
||||||
import com.seer.teach.mp.entity.MpMessageGroupUserEntity;
|
import com.seer.teach.mp.entity.MpMessageGroupUserEntity;
|
||||||
import com.seer.teach.mp.service.IMqMessageGroupUserService;
|
import com.seer.teach.mp.service.IMqMessageGroupUserService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -1,12 +1,12 @@
|
|||||||
package com.seer.teach.mp.controller;
|
package com.seer.teach.mp.admin.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
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.mp.controller.req.MpAccountPageReq;
|
import com.seer.teach.mp.admin.controller.req.MpAccountPageReq;
|
||||||
import com.seer.teach.mp.controller.req.MpAccountReq;
|
import com.seer.teach.mp.admin.controller.req.MpAccountReq;
|
||||||
import com.seer.teach.mp.controller.resp.AdminMpAccountResp;
|
import com.seer.teach.mp.admin.controller.resp.AdminMpAccountResp;
|
||||||
import com.seer.teach.mp.service.AdminMpAccountService;
|
import com.seer.teach.mp.admin.service.AdminMpAccountService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.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.core.metadata.IPage;
|
||||||
@ -8,10 +8,10 @@ import com.seer.teach.common.ResultBean;
|
|||||||
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.controller.req.MpTemplateMessageConfigPageQueryReq;
|
import com.seer.teach.mp.admin.controller.req.MpTemplateMessageConfigPageQueryReq;
|
||||||
import com.seer.teach.mp.controller.req.MpTemplateMessageConfigReq;
|
import com.seer.teach.mp.admin.controller.req.MpTemplateMessageConfigReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpTemplateMessageConfigResp;
|
import com.seer.teach.mp.admin.controller.resp.MpTemplateMessageConfigResp;
|
||||||
import com.seer.teach.mp.convert.AdminMpTemplateMessageConfigConvert;
|
import com.seer.teach.mp.admin.convert.AdminMpTemplateMessageConfigConvert;
|
||||||
import com.seer.teach.mp.entity.MpTemplateMessageConfigEntity;
|
import com.seer.teach.mp.entity.MpTemplateMessageConfigEntity;
|
||||||
import com.seer.teach.mp.service.IMpTemplateMessageConfigService;
|
import com.seer.teach.mp.service.IMpTemplateMessageConfigService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -1,15 +1,15 @@
|
|||||||
package com.seer.teach.mp.controller;
|
package com.seer.teach.mp.admin.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.seer.teach.common.ResultBean;
|
import com.seer.teach.common.ResultBean;
|
||||||
import com.seer.teach.mp.controller.req.MpTemplateMessageReq;
|
import com.seer.teach.mp.admin.controller.req.MpTemplateMessageReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpTemplateMessageResp;
|
import com.seer.teach.mp.admin.controller.resp.MpTemplateMessageResp;
|
||||||
import com.seer.teach.mp.controller.resp.MpWxMpTemplateResp;
|
import com.seer.teach.mp.admin.controller.resp.MpWxMpTemplateResp;
|
||||||
import com.seer.teach.mp.convert.MpWxMpTemplateConvert;
|
import com.seer.teach.mp.admin.convert.MpWxMpTemplateConvert;
|
||||||
import com.seer.teach.mp.entity.MpTemplateMessageEntity;
|
import com.seer.teach.mp.entity.MpTemplateMessageEntity;
|
||||||
import com.seer.teach.mp.service.AdminTemplateMessageService;
|
import com.seer.teach.mp.admin.service.AdminTemplateMessageService;
|
||||||
import com.seer.teach.mp.utils.ClassFieldUtils;
|
import com.seer.teach.mp.admin.utils.ClassFieldUtils;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.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.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
@Schema(name = "AgentActivityQueryReq", description = "代理商活动查询请求参数")
|
||||||
|
@Data
|
||||||
|
public class AgentActivityQueryReq extends PageRequest {
|
||||||
|
|
||||||
|
@Schema(description = "活动名称")
|
||||||
|
private String activityName;
|
||||||
|
|
||||||
|
@Schema(description = "活动状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(name = "AgentActivityReq", description = "代理商活动请求参数")
|
||||||
|
@Data
|
||||||
|
public class AgentActivityReq {
|
||||||
|
|
||||||
|
@Schema(description = "活动ID")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotBlank(message = "活动名称不能为空")
|
||||||
|
@Schema(description = "活动名称")
|
||||||
|
private String activityName;
|
||||||
|
|
||||||
|
@Schema(description = "活动描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@NotNull(message = "活动开始时间不能为空")
|
||||||
|
@Schema(description = "活动开始时间")
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
@NotNull(message = "活动结束时间不能为空")
|
||||||
|
@Schema(description = "活动结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@Schema(description = "活动状态:0-禁用,1-启用")
|
||||||
|
private Integer status = 1;
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
@Schema(name = "AgentEmployeeRelationQueryReq", description = "代理商员工关联查询请求参数")
|
||||||
|
@Data
|
||||||
|
public class AgentEmployeeRelationQueryReq extends PageRequest {
|
||||||
|
|
||||||
|
@Schema(description = "代理商ID")
|
||||||
|
private Integer agentId;
|
||||||
|
|
||||||
|
@Schema(description = "员工用户ID")
|
||||||
|
private Integer employeeUserId;
|
||||||
|
|
||||||
|
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(name = "AgentEmployeeRelationReq", description = "代理商员工关联请求参数")
|
||||||
|
@Data
|
||||||
|
public class AgentEmployeeRelationReq {
|
||||||
|
|
||||||
|
@Schema(description = "关联ID")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@NotNull(message = "代理商ID不能为空")
|
||||||
|
@Schema(description = "代理商ID")
|
||||||
|
private Integer agentId;
|
||||||
|
|
||||||
|
@NotNull(message = "员工用户ID不能为空")
|
||||||
|
@Schema(description = "员工用户ID")
|
||||||
|
private Integer employeeUserId;
|
||||||
|
|
||||||
|
@Schema(description = "员工职位")
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||||
|
private Integer status = 1;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
@Schema(description = "代理商查询参数")
|
||||||
|
@Data
|
||||||
|
public class AgentQueryReq extends PageRequest {
|
||||||
|
|
||||||
|
@Schema(description = "代理商名称")
|
||||||
|
private String agentName;
|
||||||
|
|
||||||
|
@Schema(description = "代理商编码")
|
||||||
|
private String agentCode;
|
||||||
|
|
||||||
|
@Schema(description = "代理商等级")
|
||||||
|
private String agentLevel;
|
||||||
|
|
||||||
|
@Schema(description = "联系人姓名")
|
||||||
|
private String contactName;
|
||||||
|
|
||||||
|
@Schema(description = "联系电话")
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
@Schema(description = "代理商状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
|
|
||||||
import com.seer.teach.common.request.PageRequest;
|
import com.seer.teach.common.request.PageRequest;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
import com.seer.teach.common.request.PageRequest;
|
import com.seer.teach.common.request.PageRequest;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
import com.seer.teach.common.request.PageRequest;
|
import com.seer.teach.common.request.PageRequest;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
import com.seer.teach.common.request.PageRequest;
|
import com.seer.teach.common.request.PageRequest;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.api.dto;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
import com.seer.teach.common.request.PageRequest;
|
import com.seer.teach.common.request.PageRequest;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.req;
|
package com.seer.teach.mp.admin.controller.req;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.resp;
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(name = "AgentActivityResp", description = "代理商活动响应参数")
|
||||||
|
@Data
|
||||||
|
public class AgentActivityResp {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "活动名称")
|
||||||
|
private String activityName;
|
||||||
|
|
||||||
|
@Schema(description = "活动描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "活动开始时间")
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
@Schema(description = "活动结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@Schema(description = "活动状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "创建人ID")
|
||||||
|
private Integer creatorId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(name = "AgentEmployeeRelationResp", description = "代理商员工关联响应参数")
|
||||||
|
@Data
|
||||||
|
public class AgentEmployeeRelationResp {
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(name = "AgentResp", description = "代理商Response")
|
||||||
|
@Data
|
||||||
|
public class AgentResp {
|
||||||
|
|
||||||
|
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 = "联系电话")
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
@Schema(description = "代理商地址")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
@Schema(description = "代理商状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.resp;
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.resp;
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.resp;
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.resp;
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.resp;
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.controller.resp;
|
package com.seer.teach.mp.admin.controller.resp;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.seer.teach.mp.admin.convert;
|
||||||
|
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentActivityQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentActivityReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AgentActivityResp;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AdminAgentActivityConvert {
|
||||||
|
|
||||||
|
AdminAgentActivityConvert INSTANCE = Mappers.getMapper(AdminAgentActivityConvert.class);
|
||||||
|
|
||||||
|
MpAgentActivityEntity convert(AgentActivityReq req);
|
||||||
|
|
||||||
|
MpAgentActivityEntity convert(AgentActivityQueryReq req);
|
||||||
|
|
||||||
|
AgentActivityResp convertToResp(MpAgentActivityEntity entity);
|
||||||
|
|
||||||
|
List<AgentActivityResp> convertToRespList(List<MpAgentActivityEntity> list);
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
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.resp.AgentEmployeeRelationResp;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AdminAgentEmployeeRelationConvert {
|
||||||
|
|
||||||
|
AdminAgentEmployeeRelationConvert INSTANCE = Mappers.getMapper(AdminAgentEmployeeRelationConvert.class);
|
||||||
|
|
||||||
|
MpAgentEmployeeRelationEntity convert(AgentEmployeeRelationReq req);
|
||||||
|
|
||||||
|
MpAgentEmployeeRelationEntity convert(AgentEmployeeRelationQueryReq req);
|
||||||
|
|
||||||
|
AgentEmployeeRelationResp convertToResp(MpAgentEmployeeRelationEntity entity);
|
||||||
|
|
||||||
|
List<AgentEmployeeRelationResp> convertToRespList(List<MpAgentEmployeeRelationEntity> mpAgentEmployeeRelationEntities);
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.seer.teach.mp.convert;
|
package com.seer.teach.mp.admin.convert;
|
||||||
|
|
||||||
import com.seer.teach.mp.controller.req.MpDealerApplyQueryReq;
|
import com.seer.teach.mp.admin.controller.req.MpDealerApplyQueryReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpDealerApplyResp;
|
import com.seer.teach.mp.admin.controller.resp.MpDealerApplyResp;
|
||||||
import com.seer.teach.mp.entity.MpDealerApplicationsEntity;
|
import com.seer.teach.mp.entity.MpDealerApplicationsEntity;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.seer.teach.mp.convert;
|
package com.seer.teach.mp.admin.convert;
|
||||||
|
|
||||||
import com.seer.teach.mp.controller.req.MpAccountReq;
|
import com.seer.teach.mp.admin.controller.req.MpAccountReq;
|
||||||
import com.seer.teach.mp.controller.resp.AdminMpAccountResp;
|
import com.seer.teach.mp.admin.controller.resp.AdminMpAccountResp;
|
||||||
import com.seer.teach.mp.entity.MpAccountEntity;
|
import com.seer.teach.mp.entity.MpAccountEntity;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.seer.teach.mp.convert;
|
package com.seer.teach.mp.admin.convert;
|
||||||
|
|
||||||
import com.seer.teach.mp.controller.req.MpTemplateMessageConfigPageQueryReq;
|
import com.seer.teach.mp.admin.controller.req.MpTemplateMessageConfigPageQueryReq;
|
||||||
import com.seer.teach.mp.controller.req.MpTemplateMessageConfigReq;
|
import com.seer.teach.mp.admin.controller.req.MpTemplateMessageConfigReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpTemplateMessageConfigResp;
|
import com.seer.teach.mp.admin.controller.resp.MpTemplateMessageConfigResp;
|
||||||
import com.seer.teach.mp.entity.MpTemplateMessageConfigEntity;
|
import com.seer.teach.mp.entity.MpTemplateMessageConfigEntity;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.seer.teach.mp.admin.convert;
|
||||||
|
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AgentResp;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AgentConvert {
|
||||||
|
|
||||||
|
AgentConvert INSTANCE = Mappers.getMapper(AgentConvert.class);
|
||||||
|
|
||||||
|
AgentResp convertOne(MpAgentEntity entity);
|
||||||
|
|
||||||
|
List<AgentResp> convertRespList(List<MpAgentEntity> list);
|
||||||
|
|
||||||
|
MpAgentEntity convertOne(AgentQueryReq req);
|
||||||
|
|
||||||
|
AgentQueryReq convertToReq(MpAgentEntity entity);
|
||||||
|
}
|
||||||
@ -1,9 +1,9 @@
|
|||||||
package com.seer.teach.mp.convert;
|
package com.seer.teach.mp.admin.convert;
|
||||||
|
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupQueryReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupQueryReq;
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupReq;
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupUpdateReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupUpdateReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpMessageGroupResp;
|
import com.seer.teach.mp.admin.controller.resp.MpMessageGroupResp;
|
||||||
import com.seer.teach.mp.entity.MpMessageGroupEntity;
|
import com.seer.teach.mp.entity.MpMessageGroupEntity;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.seer.teach.mp.convert;
|
package com.seer.teach.mp.admin.convert;
|
||||||
|
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupUserQueryReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupUserQueryReq;
|
||||||
import com.seer.teach.mp.controller.req.MpMessageGroupUserReq;
|
import com.seer.teach.mp.admin.controller.req.MpMessageGroupUserReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpMessageGroupUserResp;
|
import com.seer.teach.mp.admin.controller.resp.MpMessageGroupUserResp;
|
||||||
import com.seer.teach.mp.entity.MpMessageGroupUserEntity;
|
import com.seer.teach.mp.entity.MpMessageGroupUserEntity;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.seer.teach.mp.convert;
|
package com.seer.teach.mp.admin.convert;
|
||||||
|
|
||||||
import com.seer.teach.mp.controller.resp.MpTemplateMessageResp;
|
import com.seer.teach.mp.admin.controller.resp.MpTemplateMessageResp;
|
||||||
import com.seer.teach.mp.controller.resp.MpWxMpTemplateResp;
|
import com.seer.teach.mp.admin.controller.resp.MpWxMpTemplateResp;
|
||||||
import com.seer.teach.mp.entity.MpTemplateMessageEntity;
|
import com.seer.teach.mp.entity.MpTemplateMessageEntity;
|
||||||
import me.chanjar.weixin.mp.bean.template.WxMpTemplate;
|
import me.chanjar.weixin.mp.bean.template.WxMpTemplate;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
package com.seer.teach.mp.admin.service;
|
||||||
|
|
||||||
|
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.utils.PageConverterUtils;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentQueryReq;
|
||||||
|
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 lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class AdminAgentService {
|
||||||
|
|
||||||
|
private final IMpAgentService mpAgentService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取代理商列表
|
||||||
|
*
|
||||||
|
* @param pageReq 分页参数
|
||||||
|
* @return 代理商列表
|
||||||
|
*/
|
||||||
|
public PageListBean<AgentResp> pageList(AgentQueryReq pageReq) {
|
||||||
|
Page<MpAgentEntity> pageParam = new Page<>(pageReq.getPageNo(), pageReq.getPageSize());
|
||||||
|
|
||||||
|
MpAgentEntity query = AgentConvert.INSTANCE.convertOne(pageReq);
|
||||||
|
IPage<MpAgentEntity> resultPage = mpAgentService.pageList(pageParam, query);
|
||||||
|
|
||||||
|
return PageConverterUtils.convertPageListBean(resultPage, AgentConvert.INSTANCE::convertRespList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取代理商详情
|
||||||
|
*
|
||||||
|
* @param id 代理商Id
|
||||||
|
* @return 代理商详情
|
||||||
|
*/
|
||||||
|
public AgentResp getAgentById(Integer id) {
|
||||||
|
MpAgentEntity agentEntity = mpAgentService.getAgentById(id);
|
||||||
|
return AgentConvert.INSTANCE.convertOne(agentEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存代理商
|
||||||
|
*
|
||||||
|
* @param agentEntity 代理商实体
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
public Boolean saveAgent(MpAgentEntity agentEntity) {
|
||||||
|
boolean result = mpAgentService.saveAgent(agentEntity);
|
||||||
|
log.info("保存代理商结果: {}", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新代理商
|
||||||
|
*
|
||||||
|
* @param agentEntity 代理商实体
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
public Boolean updateAgent(MpAgentEntity agentEntity) {
|
||||||
|
boolean result = mpAgentService.updateAgent(agentEntity);
|
||||||
|
log.info("更新代理商结果: {}", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除代理商
|
||||||
|
*
|
||||||
|
* @param ids 代理商ID列表
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
public Boolean deleteById(List<Integer> ids) {
|
||||||
|
if(ids == null || ids.isEmpty()){
|
||||||
|
log.warn("删除代理商时,ID列表为空");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean result = mpAgentService.removeByIds(ids);
|
||||||
|
log.info("删除代理商结果: {}", result);
|
||||||
|
if(result){
|
||||||
|
log.info("删除代理商成功,ID列表: {}", ids);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.service;
|
package com.seer.teach.mp.admin.service;
|
||||||
|
|
||||||
import cn.dev33.satoken.stp.StpUtil;
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@ -8,11 +8,12 @@ import com.seer.teach.common.enums.ResultCodeEnum;
|
|||||||
import com.seer.teach.common.enums.RoleEnum;
|
import com.seer.teach.common.enums.RoleEnum;
|
||||||
import com.seer.teach.common.exception.CommonException;
|
import com.seer.teach.common.exception.CommonException;
|
||||||
import com.seer.teach.common.utils.PageConverterUtils;
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
import com.seer.teach.mp.controller.req.MpDealerApplyQueryReq;
|
import com.seer.teach.mp.admin.controller.req.MpDealerApplyQueryReq;
|
||||||
import com.seer.teach.mp.controller.resp.MpDealerApplyResp;
|
import com.seer.teach.mp.admin.controller.resp.MpDealerApplyResp;
|
||||||
import com.seer.teach.mp.convert.AdminDealerApplicationsConvert;
|
import com.seer.teach.mp.admin.convert.AdminDealerApplicationsConvert;
|
||||||
import com.seer.teach.mp.entity.MpDealerApplicationsEntity;
|
import com.seer.teach.mp.entity.MpDealerApplicationsEntity;
|
||||||
import com.seer.teach.mp.request.DealerApplyReq;
|
import com.seer.teach.mp.request.DealerApplyReq;
|
||||||
|
import com.seer.teach.mp.service.IMpDealerApplicationsService;
|
||||||
import com.seer.teach.user.api.UserInfoServiceApi;
|
import com.seer.teach.user.api.UserInfoServiceApi;
|
||||||
import com.seer.teach.user.api.dto.UserInfoDTO;
|
import com.seer.teach.user.api.dto.UserInfoDTO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
package com.seer.teach.mp.service;
|
package com.seer.teach.mp.admin.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@ -8,12 +8,13 @@ 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.utils.PageConverterUtils;
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
import com.seer.teach.mp.api.WechatOfficialAccountApi;
|
import com.seer.teach.mp.api.WechatOfficialAccountApi;
|
||||||
import com.seer.teach.mp.controller.req.MpAccountPageReq;
|
import com.seer.teach.mp.admin.controller.req.MpAccountPageReq;
|
||||||
import com.seer.teach.mp.controller.req.MpAccountReq;
|
import com.seer.teach.mp.admin.controller.req.MpAccountReq;
|
||||||
import com.seer.teach.mp.controller.resp.AdminMpAccountResp;
|
import com.seer.teach.mp.admin.controller.resp.AdminMpAccountResp;
|
||||||
import com.seer.teach.mp.convert.AdminMpAccountConvert;
|
import com.seer.teach.mp.admin.convert.AdminMpAccountConvert;
|
||||||
import com.seer.teach.mp.entity.MpAccountEntity;
|
import com.seer.teach.mp.entity.MpAccountEntity;
|
||||||
import com.seer.teach.mp.factory.MpServiceFactory;
|
import com.seer.teach.mp.factory.MpServiceFactory;
|
||||||
|
import com.seer.teach.mp.service.IMpAccountService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.chanjar.weixin.common.error.WxErrorException;
|
import me.chanjar.weixin.common.error.WxErrorException;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.service;
|
package com.seer.teach.mp.admin.service;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.seer.teach.common.enums.ResultCodeEnum;
|
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||||
@ -7,9 +7,10 @@ import com.seer.teach.common.utils.AssertUtils;
|
|||||||
import com.seer.teach.common.utils.BeanToMapConverter;
|
import com.seer.teach.common.utils.BeanToMapConverter;
|
||||||
import com.seer.teach.mall.api.MallOrderApi;
|
import com.seer.teach.mall.api.MallOrderApi;
|
||||||
import com.seer.teach.mall.api.resp.OrderDTO;
|
import com.seer.teach.mall.api.resp.OrderDTO;
|
||||||
import com.seer.teach.mp.controller.req.MpTemplateMessageReq;
|
import com.seer.teach.mp.admin.controller.req.MpTemplateMessageReq;
|
||||||
import com.seer.teach.mp.entity.MpTemplateMessageEntity;
|
import com.seer.teach.mp.entity.MpTemplateMessageEntity;
|
||||||
import com.seer.teach.mp.factory.MpServiceFactory;
|
import com.seer.teach.mp.factory.MpServiceFactory;
|
||||||
|
import com.seer.teach.mp.service.IMpTemplateMessageService;
|
||||||
import com.seer.teach.mp.service.dto.MpTemplateMessageDTO;
|
import com.seer.teach.mp.service.dto.MpTemplateMessageDTO;
|
||||||
import com.seer.teach.user.api.UserInfoServiceApi;
|
import com.seer.teach.user.api.UserInfoServiceApi;
|
||||||
import com.seer.teach.user.api.dto.UserInfoDTO;
|
import com.seer.teach.user.api.dto.UserInfoDTO;
|
||||||
@ -34,7 +35,7 @@ public class AdminTemplateMessageService {
|
|||||||
private MallOrderApi mallOrderApi;
|
private MallOrderApi mallOrderApi;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IMpTemplateMessageService mpTemplateMessageService;
|
private IMpTemplateMessageService mpTemplateMessageService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MpServiceFactory mpServiceFactory;
|
private MpServiceFactory mpServiceFactory;
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
package com.seer.teach.mp.admin.service;
|
||||||
|
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AgentActivityResp;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentActivityQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentActivityReq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 管理端代理商活动服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-30
|
||||||
|
*/
|
||||||
|
public interface IAdminAgentActivityService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询代理商活动列表(管理端)
|
||||||
|
*
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 代理商活动分页列表
|
||||||
|
*/
|
||||||
|
PageListBean<AgentActivityResp> pageList(AgentActivityQueryReq query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建或更新代理商活动(管理端)
|
||||||
|
*
|
||||||
|
* @param request 活动请求对象
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean saveOrUpdateActivity(AgentActivityReq request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除代理商活动(管理端)
|
||||||
|
*
|
||||||
|
* @param id 活动ID
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean deleteActivity(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取活动详情(管理端)
|
||||||
|
*
|
||||||
|
* @param id 活动ID
|
||||||
|
* @return 活动详情
|
||||||
|
*/
|
||||||
|
AgentActivityResp getById(Integer id);
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
package com.seer.teach.mp.admin.service;
|
||||||
|
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 管理端代理商员工关系服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-30
|
||||||
|
*/
|
||||||
|
public interface IAdminAgentEmployeeRelationService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询代理商员工关联列表(管理端)
|
||||||
|
*
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 代理商员工关联分页列表
|
||||||
|
*/
|
||||||
|
PageListBean<AgentEmployeeRelationResp> pageList(AgentEmployeeRelationQueryReq query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建或更新代理商员工关联(管理端)
|
||||||
|
*
|
||||||
|
* @param request 关联请求对象
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean saveOrUpdateRelation(AgentEmployeeRelationReq request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除代理商员工关联(管理端)
|
||||||
|
*
|
||||||
|
* @param id 关联ID
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean deleteRelation(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取详情(管理端)
|
||||||
|
*
|
||||||
|
* @param id 关联ID
|
||||||
|
* @return 关联详情
|
||||||
|
*/
|
||||||
|
AgentEmployeeRelationResp getById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据代理商ID获取员工列表(管理端)
|
||||||
|
*
|
||||||
|
* @param agentId 代理商ID
|
||||||
|
* @return 员工关联列表
|
||||||
|
*/
|
||||||
|
List<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId);
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
package com.seer.teach.mp.admin.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
|
import com.seer.teach.mp.admin.service.IAdminAgentActivityService;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentActivityQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentActivityReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AgentActivityResp;
|
||||||
|
import com.seer.teach.mp.admin.convert.AdminAgentActivityConvert;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 管理端代理商活动服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-30
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AdminAgentActivityServiceImpl implements IAdminAgentActivityService {
|
||||||
|
|
||||||
|
private final IMpAgentActivityService agentActivityService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageListBean<AgentActivityResp> pageList(AgentActivityQueryReq query) {
|
||||||
|
Page<MpAgentActivityEntity> page = new Page<>(query.getPageNo(), query.getPageSize());
|
||||||
|
var pageResult = agentActivityService.page(page, new LambdaQueryWrapper<>(MpAgentActivityEntity.class)
|
||||||
|
.like(StringUtils.isNotBlank(query.getActivityName()), MpAgentActivityEntity::getActivityName, query.getActivityName())
|
||||||
|
.eq(Objects.nonNull(query.getStatus()), MpAgentActivityEntity::getStatus, query.getStatus()));
|
||||||
|
return PageConverterUtils.convertPageListBean(pageResult, AdminAgentActivityConvert.INSTANCE::convertToRespList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveOrUpdateActivity(AgentActivityReq request) {
|
||||||
|
MpAgentActivityEntity entity = AdminAgentActivityConvert.INSTANCE.convert(request);
|
||||||
|
return agentActivityService.saveOrUpdateActivity(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteActivity(Integer id) {
|
||||||
|
return agentActivityService.deleteActivity(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AgentActivityResp getById(Integer id) {
|
||||||
|
MpAgentActivityEntity entity = agentActivityService.getById(id);
|
||||||
|
return AdminAgentActivityConvert.INSTANCE.convertToResp(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,69 @@
|
|||||||
|
package com.seer.teach.mp.admin.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.common.utils.PageConverterUtils;
|
||||||
|
import com.seer.teach.mp.admin.service.IAdminAgentEmployeeRelationService;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationQueryReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.req.AgentEmployeeRelationReq;
|
||||||
|
import com.seer.teach.mp.admin.controller.resp.AgentEmployeeRelationResp;
|
||||||
|
import com.seer.teach.mp.admin.convert.AdminAgentEmployeeRelationConvert;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentEmployeeRelationService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 管理端代理商员工关系服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-30
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AdminAgentEmployeeRelationServiceImpl implements IAdminAgentEmployeeRelationService {
|
||||||
|
|
||||||
|
private final IMpAgentEmployeeRelationService agentEmployeeRelationService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageListBean<AgentEmployeeRelationResp> pageList(AgentEmployeeRelationQueryReq query) {
|
||||||
|
Page<MpAgentEmployeeRelationEntity> pageParm = new Page<>(query.getPageNo(), query.getPageSize());
|
||||||
|
var pageResult = agentEmployeeRelationService.page(pageParm, new LambdaQueryWrapper<>(MpAgentEmployeeRelationEntity.class)
|
||||||
|
.eq(Objects.nonNull(query.getAgentId()), MpAgentEmployeeRelationEntity::getAgentId, query.getAgentId())
|
||||||
|
.eq(Objects.nonNull(query.getEmployeeUserId()), MpAgentEmployeeRelationEntity::getEmployeeUserId, query.getEmployeeUserId())
|
||||||
|
.eq(Objects.nonNull(query.getStatus()), MpAgentEmployeeRelationEntity::getStatus, query.getStatus()));
|
||||||
|
|
||||||
|
return PageConverterUtils.convertPageListBean(pageResult, AdminAgentEmployeeRelationConvert.INSTANCE::convertToRespList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveOrUpdateRelation(AgentEmployeeRelationReq request) {
|
||||||
|
MpAgentEmployeeRelationEntity entity = AdminAgentEmployeeRelationConvert.INSTANCE.convert(request);
|
||||||
|
return agentEmployeeRelationService.saveOrUpdateRelation(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteRelation(Integer id) {
|
||||||
|
return agentEmployeeRelationService.deleteRelation(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AgentEmployeeRelationResp getById(Integer id) {
|
||||||
|
MpAgentEmployeeRelationEntity entity = agentEmployeeRelationService.getById(id);
|
||||||
|
return AdminAgentEmployeeRelationConvert.INSTANCE.convertToResp(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AgentEmployeeRelationResp> getEmployeeRelationsByAgentId(Integer agentId) {
|
||||||
|
var relations = agentEmployeeRelationService.getEmployeeRelationsByAgentId(agentId);
|
||||||
|
return relations.stream()
|
||||||
|
.map(AdminAgentEmployeeRelationConvert.INSTANCE::convertToResp)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.seer.teach.mp.utils;
|
package com.seer.teach.mp.admin.utils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||||
import com.fasterxml.jackson.databind.BeanDescription;
|
import com.fasterxml.jackson.databind.BeanDescription;
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package com.seer.teach.mp.app.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.common.ResultBean;
|
||||||
|
import com.seer.teach.common.annotation.DecryptionAnnotation;
|
||||||
|
import com.seer.teach.common.annotation.EncryptionAnnotation;
|
||||||
|
import com.seer.teach.common.annotation.LogPrint;
|
||||||
|
import com.seer.teach.mp.app.controller.req.AppAgentActivityQueryReq;
|
||||||
|
import com.seer.teach.mp.app.controller.resp.AppAgentActivityResp;
|
||||||
|
import com.seer.teach.mp.app.convert.AppAgentActivityConvert;
|
||||||
|
import com.seer.teach.mp.app.service.IAppAgentActivityService;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动App控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Tag(name = "APP - 代理商活动")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/agent/activity")
|
||||||
|
@LogPrint
|
||||||
|
@EncryptionAnnotation
|
||||||
|
@DecryptionAnnotation
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AppAgentActivityController {
|
||||||
|
|
||||||
|
private final IAppAgentActivityService agentActivityService;
|
||||||
|
|
||||||
|
@Operation(summary = "代理商活动列表")
|
||||||
|
@GetMapping("/page-list")
|
||||||
|
@SaCheckPermission("mp:app:agent:activity:list")
|
||||||
|
public ResultBean<PageListBean<AppAgentActivityResp>> pageList(AppAgentActivityQueryReq query) {
|
||||||
|
return ResultBean.success(agentActivityService.pageList(query));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "查看活动详情")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@SaCheckPermission("mp:app:agent:activity:get")
|
||||||
|
public ResultBean<AppAgentActivityResp> get(@PathVariable Integer id) {
|
||||||
|
return ResultBean.success(agentActivityService.getById(id));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
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;
|
||||||
|
import com.seer.teach.common.annotation.EncryptionAnnotation;
|
||||||
|
import com.seer.teach.common.annotation.LogPrint;
|
||||||
|
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
||||||
|
import com.seer.teach.user.api.dto.UserInfoDTO;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动参与记录App控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Tag(name = "APP - 代理商活动参与记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/app/agent/activity/participant")
|
||||||
|
@LogPrint
|
||||||
|
@EncryptionAnnotation
|
||||||
|
@DecryptionAnnotation
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AppAgentActivityParticipantController {
|
||||||
|
|
||||||
|
private final com.seer.teach.mp.app.service.IAppAgentActivityParticipantService agentActivityParticipantService;
|
||||||
|
|
||||||
|
|
||||||
|
@Operation(summary = "获取代理商参与的活动中的家长列表")
|
||||||
|
@GetMapping("/parents-by-agent")
|
||||||
|
@SaCheckPermission("mp:app:agent:participant:parents")
|
||||||
|
public ResultBean<List<AgentActivityParticipantResp>> getParentsByAgentAndActivity(
|
||||||
|
@RequestParam("activityId") Integer activityId,@RequestParam("agentId") Integer agentId) {
|
||||||
|
return ResultBean.success(agentActivityParticipantService.getParticipantsByActivityAndAgent(activityId, agentId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
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 = "AppAgentActivityQueryReq", description = "代理商活动查询请求参数")
|
||||||
|
@Data
|
||||||
|
public class AppAgentActivityQueryReq extends PageRequest {
|
||||||
|
|
||||||
|
@Schema(description = "活动名称")
|
||||||
|
private String activityName;
|
||||||
|
|
||||||
|
@Schema(description = "活动状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
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 = "AppAgentEmployeeRelationQueryReq", description = "代理商员工关联查询请求参数")
|
||||||
|
@Data
|
||||||
|
public class AppAgentEmployeeRelationQueryReq extends PageRequest {
|
||||||
|
|
||||||
|
@Schema(description = "员工职位")
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.seer.teach.mp.app.controller.resp;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(name = "AgentActivityParticipant", description = "代理商活动参与记录")
|
||||||
|
@Data
|
||||||
|
public class AgentActivityParticipantResp {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "活动ID")
|
||||||
|
private Integer activityId;
|
||||||
|
|
||||||
|
@Schema(description = "代理商ID")
|
||||||
|
private Integer agentId;
|
||||||
|
|
||||||
|
@Schema(description = "家长ID")
|
||||||
|
private Integer parentId;
|
||||||
|
|
||||||
|
@Schema(description = "家长手机号")
|
||||||
|
private String parentMobile;
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
package com.seer.teach.mp.app.controller.resp;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(name = "AppAgentActivityResp", description = "代理商活动响应参数")
|
||||||
|
@Data
|
||||||
|
public class AppAgentActivityResp {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "活动名称")
|
||||||
|
private String activityName;
|
||||||
|
|
||||||
|
@Schema(description = "活动描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "活动开始时间")
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
@Schema(description = "活动结束时间")
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@Schema(description = "活动状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.seer.teach.mp.app.controller.resp;
|
||||||
|
|
||||||
|
import com.seer.teach.user.api.dto.UserInfoDTO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(name = "AppAgentEmployeeRelationResp", description = "代理商员工关联响应参数")
|
||||||
|
@Data
|
||||||
|
public class AppAgentEmployeeRelationResp {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "代理商ID")
|
||||||
|
private Integer agentId;
|
||||||
|
|
||||||
|
@Schema(description = "员工用户信息")
|
||||||
|
private UserInfoDTO employeeUserInfo;
|
||||||
|
|
||||||
|
@Schema(description = "员工职位")
|
||||||
|
private String position;
|
||||||
|
|
||||||
|
@Schema(description = "员工状态:0-禁用,1-启用")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.seer.teach.mp.app.convert;
|
||||||
|
|
||||||
|
import com.seer.teach.mp.app.controller.req.AppAgentActivityQueryReq;
|
||||||
|
import com.seer.teach.mp.app.controller.resp.AppAgentActivityResp;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AppAgentActivityConvert {
|
||||||
|
|
||||||
|
AppAgentActivityConvert INSTANCE = Mappers.getMapper(AppAgentActivityConvert.class);
|
||||||
|
|
||||||
|
MpAgentActivityEntity convert(AppAgentActivityQueryReq req);
|
||||||
|
|
||||||
|
@Mapping(target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Mapping(target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
AppAgentActivityResp convertToResp(MpAgentActivityEntity entity);
|
||||||
|
|
||||||
|
List<AppAgentActivityResp> convertToRespList(List<MpAgentActivityEntity> mpAgentActivityEntities);
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.seer.teach.mp.app.service;
|
||||||
|
|
||||||
|
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* APP端代理商活动参与记录服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-30
|
||||||
|
*/
|
||||||
|
public interface IAppAgentActivityParticipantService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据活动ID和代理商ID获取参与记录
|
||||||
|
*
|
||||||
|
* @param activityId 活动ID
|
||||||
|
* @param agentId 代理商ID
|
||||||
|
* @return 参与记录列表
|
||||||
|
*/
|
||||||
|
List<AgentActivityParticipantResp> getParticipantsByActivityAndAgent(Integer activityId, Integer agentId);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.seer.teach.mp.app.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.seer.teach.common.PageListBean;
|
||||||
|
import com.seer.teach.mp.app.controller.resp.AppAgentActivityResp;
|
||||||
|
import com.seer.teach.mp.app.controller.req.AppAgentActivityQueryReq;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* APP端代理商活动服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-30
|
||||||
|
*/
|
||||||
|
public interface IAppAgentActivityService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询代理商活动列表
|
||||||
|
*
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 代理商活动分页列表
|
||||||
|
*/
|
||||||
|
PageListBean<AppAgentActivityResp> pageList(AppAgentActivityQueryReq query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取活动详情
|
||||||
|
*
|
||||||
|
* @param id 活动ID
|
||||||
|
* @return 活动详情
|
||||||
|
*/
|
||||||
|
AppAgentActivityResp getById(Integer id);
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.seer.teach.mp.app.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.seer.teach.mp.app.controller.resp.AgentActivityParticipantResp;
|
||||||
|
import com.seer.teach.mp.app.service.IAppAgentActivityParticipantService;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||||
|
import com.seer.teach.user.api.UserInfoServiceApi;
|
||||||
|
import com.seer.teach.user.api.dto.UserInfoDTO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* APP端代理商活动参与记录服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-30
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AppAgentActivityParticipantServiceImpl implements IAppAgentActivityParticipantService {
|
||||||
|
|
||||||
|
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||||
|
|
||||||
|
private final UserInfoServiceApi userInfoServiceApi;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AgentActivityParticipantResp> getParticipantsByActivityAndAgent(Integer activityId, Integer agentId) {
|
||||||
|
var participants = agentActivityParticipantService.getParticipantsByActivityAndAgent(activityId, agentId);
|
||||||
|
|
||||||
|
if (CollectionUtil.isEmpty(participants)) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
// 提取家长ID
|
||||||
|
Set<Integer> parentIds = participants.stream().map(MpAgentActivityParticipantEntity::getParentId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
List<UserInfoDTO> parentInfos = userInfoServiceApi.getListByUserIds(parentIds);
|
||||||
|
|
||||||
|
var parentInfoMap = parentInfos.stream().collect(Collectors.toMap(UserInfoDTO::getId, parentInfo -> parentInfo));
|
||||||
|
|
||||||
|
return participants.stream()
|
||||||
|
.map(entity -> convertToDto(entity, parentInfoMap))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private AgentActivityParticipantResp convertToDto(MpAgentActivityParticipantEntity entity, Map<Integer,UserInfoDTO> parentInfoMap) {
|
||||||
|
AgentActivityParticipantResp resp = new AgentActivityParticipantResp();
|
||||||
|
resp.setId(entity.getId());
|
||||||
|
resp.setActivityId(entity.getActivityId());
|
||||||
|
resp.setAgentId(entity.getAgentId());
|
||||||
|
resp.setParentId(entity.getParentId());
|
||||||
|
UserInfoDTO userInfoDTO = parentInfoMap.get(entity.getParentId());
|
||||||
|
if(Objects.nonNull(userInfoDTO)){
|
||||||
|
resp.setParentMobile(userInfoDTO.getMobile());
|
||||||
|
}
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package com.seer.teach.mp.app.service.impl;
|
||||||
|
|
||||||
|
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.utils.PageConverterUtils;
|
||||||
|
import com.seer.teach.mp.app.controller.req.AppAgentActivityQueryReq;
|
||||||
|
import com.seer.teach.mp.app.controller.resp.AppAgentActivityResp;
|
||||||
|
import com.seer.teach.mp.app.convert.AppAgentActivityConvert;
|
||||||
|
import com.seer.teach.mp.app.service.IAppAgentActivityService;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* APP端代理商活动服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-30
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AppAgentActivityServiceImpl implements IAppAgentActivityService {
|
||||||
|
|
||||||
|
private final IMpAgentActivityService agentActivityService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageListBean<AppAgentActivityResp> pageList(AppAgentActivityQueryReq query) {
|
||||||
|
log.info("查询参数:{}", query);
|
||||||
|
IPage<MpAgentActivityEntity> page = new Page<>(query.getPageNo(), query.getPageSize());
|
||||||
|
var pageResult = agentActivityService.page(page, new LambdaQueryWrapper<>(MpAgentActivityEntity.class)
|
||||||
|
.like(StringUtils.isNotBlank(query.getActivityName()), MpAgentActivityEntity::getActivityName, query.getActivityName())
|
||||||
|
.eq(Objects.nonNull(query.getStatus()), MpAgentActivityEntity::getStatus, query.getStatus()));
|
||||||
|
if(Objects.isNull(pageResult) || CollectionUtil.isEmpty(pageResult.getRecords())){
|
||||||
|
log.info("查询结果为空");
|
||||||
|
}
|
||||||
|
log.info("查询代理商活动数量:{}", pageResult.getTotal());
|
||||||
|
return PageConverterUtils.convertPageListBean(pageResult, AppAgentActivityConvert.INSTANCE::convertToRespList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppAgentActivityResp getById(Integer id) {
|
||||||
|
MpAgentActivityEntity entity = agentActivityService.getById(id);
|
||||||
|
return AppAgentActivityConvert.INSTANCE.convertToResp(entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package com.seer.teach.mp.api.impl;
|
||||||
|
|
||||||
|
import com.seer.teach.common.ResultBean;
|
||||||
|
import com.seer.teach.mp.api.dto.AgentActivityParticipantDTO;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MpAgentServiceApiImpl implements MpAgentServiceApi {
|
||||||
|
|
||||||
|
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultBean<List<AgentActivityParticipantDTO>> getParticipantParents(Integer activityId, Integer agentId) {
|
||||||
|
var participants = agentActivityParticipantService.getParticipantsByActivityAndAgent(activityId, agentId);
|
||||||
|
List<AgentActivityParticipantDTO> result = participants.stream()
|
||||||
|
.map(participant -> {
|
||||||
|
AgentActivityParticipantDTO dto = new AgentActivityParticipantDTO();
|
||||||
|
dto.setId(participant.getId());
|
||||||
|
dto.setActivityId(participant.getActivityId());
|
||||||
|
dto.setAgentId(participant.getAgentId());
|
||||||
|
dto.setParentId(participant.getParentId());
|
||||||
|
dto.setCreateTime(participant.getCreateTime());
|
||||||
|
dto.setUpdateTime(participant.getUpdateTime());
|
||||||
|
return dto;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
return ResultBean.success(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
108
seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/cache/MpAgentActivityCache.java
vendored
Normal file
108
seer-mp/seer-mp-service/src/main/java/com/seer/teach/mp/cache/MpAgentActivityCache.java
vendored
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
package com.seer.teach.mp.cache;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.seer.teach.common.utils.RedisUtil;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商活动缓存服务
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MpAgentActivityCache {
|
||||||
|
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
|
||||||
|
private static final String AGENT_ACTIVITY_PREFIX = "mp:agent:activity:";
|
||||||
|
private static final String AGENT_ACTIVITY_LIST_PREFIX = "mp:agent:activity:list:";
|
||||||
|
private static final Duration CACHE_TTL = Duration.ofMinutes(30);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取活动详情缓存
|
||||||
|
*/
|
||||||
|
public MpAgentActivityEntity getActivityById(Integer id) {
|
||||||
|
String key = AGENT_ACTIVITY_PREFIX + id;
|
||||||
|
String value = redisUtil.get(key);
|
||||||
|
if (value != null) {
|
||||||
|
try {
|
||||||
|
return cn.hutool.json.JSONUtil.toBean(value, MpAgentActivityEntity.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("从缓存获取活动详情失败, id: {}", id, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置活动详情缓存
|
||||||
|
*/
|
||||||
|
public void setActivityById(Integer id, MpAgentActivityEntity entity) {
|
||||||
|
String key = AGENT_ACTIVITY_PREFIX + id;
|
||||||
|
try {
|
||||||
|
String value = cn.hutool.json.JSONUtil.toJsonStr(entity);
|
||||||
|
redisUtil.set(key, value, CACHE_TTL.toSeconds());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("设置活动详情缓存失败, id: {}", id, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除活动详情缓存
|
||||||
|
*/
|
||||||
|
public void deleteActivityById(Integer id) {
|
||||||
|
String key = AGENT_ACTIVITY_PREFIX + id;
|
||||||
|
redisUtil.del(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取活动列表缓存
|
||||||
|
*/
|
||||||
|
public List<MpAgentActivityEntity> getActivityList(String keySuffix) {
|
||||||
|
String key = AGENT_ACTIVITY_LIST_PREFIX + keySuffix;
|
||||||
|
String value = redisUtil.get(key);
|
||||||
|
if (value != null) {
|
||||||
|
try {
|
||||||
|
return cn.hutool.json.JSONUtil.toList(value, MpAgentActivityEntity.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("从缓存获取活动列表失败, key: {}", key, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置活动列表缓存
|
||||||
|
*/
|
||||||
|
public void setActivityList(String keySuffix, List<MpAgentActivityEntity> entities) {
|
||||||
|
String key = AGENT_ACTIVITY_LIST_PREFIX + keySuffix;
|
||||||
|
try {
|
||||||
|
String value = cn.hutool.json.JSONUtil.toJsonStr(entities);
|
||||||
|
redisUtil.set(key, value, CACHE_TTL.toSeconds());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("设置活动列表缓存失败, key: {}", key, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除活动列表缓存
|
||||||
|
*/
|
||||||
|
public void deleteActivityList(String keySuffix) {
|
||||||
|
String key = AGENT_ACTIVITY_LIST_PREFIX + keySuffix;
|
||||||
|
redisUtil.del(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除所有活动相关缓存
|
||||||
|
*/
|
||||||
|
public void clearAllActivityCache() {
|
||||||
|
// 可以通过通配符删除,但这里简单地提供一个清理方法
|
||||||
|
log.info("清除所有代理商活动缓存");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.seer.teach.mp.exception;
|
||||||
|
|
||||||
|
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商活动错误码枚举
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum AgentActivityErrorCodeEnum implements ResultCodeEnum {
|
||||||
|
|
||||||
|
ACTIVITY_NOT_FOUND(404, "活动不存在"),
|
||||||
|
ACTIVITY_ALREADY_EXISTS(409, "活动已存在"),
|
||||||
|
ACTIVITY_NOT_ACTIVE(400, "活动未开始或已结束"),
|
||||||
|
PARTICIPATION_FAILED(500, "参与活动失败"),
|
||||||
|
INVALID_AGENT(403, "无效的代理商"),
|
||||||
|
AGENT_NOT_FOUND(404, "代理商不存在"),
|
||||||
|
PARENT_NOT_FOUND(404, "家长不存在"),
|
||||||
|
INVALID_ACTIVITY_STATUS(400, "无效的活动状态");
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
private final String message;
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.seer.teach.mp.exception;
|
||||||
|
|
||||||
|
import com.seer.teach.common.enums.ResultCodeEnum;
|
||||||
|
import com.seer.teach.common.exception.CommonException;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商活动相关异常
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public class AgentActivityException extends CommonException {
|
||||||
|
|
||||||
|
public AgentActivityException(ResultCodeEnum resultCodeEnum) {
|
||||||
|
super(resultCodeEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgentActivityException(ResultCodeEnum resultCodeEnum, String message) {
|
||||||
|
super(resultCodeEnum, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgentActivityException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.seer.teach.mp.exception;
|
||||||
|
|
||||||
|
import com.seer.teach.common.exception.ErrorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商相关错误码枚举
|
||||||
|
*/
|
||||||
|
public enum AgentErrorCodeEnum implements ErrorCode {
|
||||||
|
|
||||||
|
AGENT_NOT_FOUND(40001, "代理商不存在"),
|
||||||
|
AGENT_CODE_EXISTS(40002, "代理商编码已存在"),
|
||||||
|
AGENT_STATUS_INVALID(40003, "代理商状态无效"),
|
||||||
|
AGENT_CONTACT_INFO_INVALID(40004, "联系信息无效");
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
private final String message;
|
||||||
|
|
||||||
|
AgentErrorCodeEnum(int code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.seer.teach.mp.exception;
|
||||||
|
|
||||||
|
import com.seer.teach.common.exception.BusinessException;
|
||||||
|
import com.seer.teach.common.exception.ErrorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商业务异常类
|
||||||
|
*/
|
||||||
|
public class AgentException extends BusinessException {
|
||||||
|
|
||||||
|
public AgentException(ErrorCode errorCode) {
|
||||||
|
super(errorCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgentException(ErrorCode errorCode, String detailMessage) {
|
||||||
|
super(errorCode, detailMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgentException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AgentException(ErrorCode errorCode, String detailMessage, Throwable cause) {
|
||||||
|
super(errorCode, detailMessage, cause);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package com.seer.teach.mp.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityLogEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动操作日志表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
public interface IMpAgentActivityLogService extends IService<MpAgentActivityLogEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录代理商活动操作日志
|
||||||
|
*
|
||||||
|
* @param activityId 活动ID
|
||||||
|
* @param operatorId 操作人ID
|
||||||
|
* @param operationType 操作类型
|
||||||
|
* @param description 操作描述
|
||||||
|
* @param beforeData 操作前数据
|
||||||
|
* @param afterData 操作后数据
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean logOperation(Integer activityId, Integer operatorId, String operationType,
|
||||||
|
String description, String beforeData, String afterData);
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.seer.teach.mp.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动参与记录表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
public interface IMpAgentActivityParticipantService extends IService<MpAgentActivityParticipantEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询活动参与记录列表
|
||||||
|
*
|
||||||
|
* @param pageParm 分页参数
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 活动参与记录分页列表
|
||||||
|
*/
|
||||||
|
IPage<MpAgentActivityParticipantEntity> pageList(com.baomidou.mybatisplus.extension.plugins.pagination.Page<MpAgentActivityParticipantEntity> pageParm, MpAgentActivityParticipantEntity query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加活动参与记录
|
||||||
|
*
|
||||||
|
* @param entity 参与记录实体
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean addParticipant(MpAgentActivityParticipantEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据活动ID和代理商ID获取参与记录
|
||||||
|
*
|
||||||
|
* @param activityId 活动ID
|
||||||
|
* @param agentId 代理商ID
|
||||||
|
* @return 参与记录列表
|
||||||
|
*/
|
||||||
|
List<MpAgentActivityParticipantEntity> getParticipantsByActivityAndAgent(Integer activityId, Integer agentId);
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package com.seer.teach.mp.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
public interface IMpAgentActivityService extends IService<MpAgentActivityEntity> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建或更新代理商活动
|
||||||
|
*
|
||||||
|
* @param entity 活动实体
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean saveOrUpdateActivity(MpAgentActivityEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除代理商活动
|
||||||
|
*
|
||||||
|
* @param id 活动ID
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean deleteActivity(Integer id);
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.seer.teach.mp.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商员工关联表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
public interface IMpAgentEmployeeRelationService extends IService<MpAgentEmployeeRelationEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询代理商员工关联列表
|
||||||
|
*
|
||||||
|
* @param pageParm 分页参数
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 代理商员工关联分页列表
|
||||||
|
*/
|
||||||
|
IPage<MpAgentEmployeeRelationEntity> pageList(com.baomidou.mybatisplus.extension.plugins.pagination.Page<MpAgentEmployeeRelationEntity> pageParm, MpAgentEmployeeRelationEntity query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建或更新代理商员工关联
|
||||||
|
*
|
||||||
|
* @param entity 关联实体
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean saveOrUpdateRelation(MpAgentEmployeeRelationEntity entity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除代理商员工关联
|
||||||
|
*
|
||||||
|
* @param id 关联ID
|
||||||
|
* @return 操作是否成功
|
||||||
|
*/
|
||||||
|
boolean deleteRelation(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据代理商ID获取员工列表
|
||||||
|
*
|
||||||
|
* @param agentId 代理商ID
|
||||||
|
* @return 员工关联列表
|
||||||
|
*/
|
||||||
|
java.util.List<MpAgentEmployeeRelationEntity> getEmployeeRelationsByAgentId(Integer agentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查用户是否为代理商的员工
|
||||||
|
*
|
||||||
|
* @param agentId 代理商ID
|
||||||
|
* @param employeeUserId 员工用户ID
|
||||||
|
* @return 是否为员工
|
||||||
|
*/
|
||||||
|
boolean isEmployeeOfAgent(Integer agentId, Integer employeeUserId);
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package com.seer.teach.mp.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||||
|
import com.seer.teach.common.utils.PageUtils;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商服务接口
|
||||||
|
*/
|
||||||
|
public interface IMpAgentService extends IService<MpAgentEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询代理商列表
|
||||||
|
* @param params 查询参数
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询代理商列表
|
||||||
|
* @param page 分页参数
|
||||||
|
* @param query 查询条件
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
IPage<MpAgentEntity> pageList(Page<MpAgentEntity> page, MpAgentEntity query);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据ID获取代理商信息
|
||||||
|
* @param id 代理商ID
|
||||||
|
* @return 代理商实体
|
||||||
|
* @throws AgentException 当代理商不存在时抛出异常
|
||||||
|
*/
|
||||||
|
MpAgentEntity getAgentById(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存代理商信息
|
||||||
|
* @param agentEntity 代理商实体
|
||||||
|
* @throws AgentException 当代理商信息验证失败或编码已存在时抛出异常
|
||||||
|
*/
|
||||||
|
boolean saveAgent(MpAgentEntity agentEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新代理商信息
|
||||||
|
* @param agentEntity 代理商实体
|
||||||
|
* @throws AgentException 当代理商不存在、信息验证失败或编码已存在时抛出异常
|
||||||
|
*/
|
||||||
|
boolean updateAgent(MpAgentEntity agentEntity);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除代理商
|
||||||
|
* @param id 代理商ID
|
||||||
|
* @throws AgentException 当代理商不存在时抛出异常
|
||||||
|
*/
|
||||||
|
void deleteAgent(Integer id);
|
||||||
|
}
|
||||||
@ -20,7 +20,7 @@ public interface IMqMessageGroupService extends IService<MpMessageGroupEntity> {
|
|||||||
* 创建消息群组
|
* 创建消息群组
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
void crateMesGroup(MpMessageGroupEntity params);
|
boolean crateMesGroup(MpMessageGroupEntity params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID查询消息群组
|
* 根据ID查询消息群组
|
||||||
@ -42,11 +42,11 @@ public interface IMqMessageGroupService extends IService<MpMessageGroupEntity> {
|
|||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void updateMesGroup(MpMessageGroupEntity params, Integer id);
|
boolean updateMesGroup(MpMessageGroupEntity params, Integer id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除消息群组
|
* 删除消息群组
|
||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
void deleteById(Integer id);
|
boolean deleteById(Integer id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,48 @@
|
|||||||
|
package com.seer.teach.mp.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityLogEntity;
|
||||||
|
import com.seer.teach.mp.mapper.MpAgentActivityLogMapper;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityLogService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动操作日志表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MpAgentActivityLogServiceImpl extends ServiceImpl<MpAgentActivityLogMapper, MpAgentActivityLogEntity> implements IMpAgentActivityLogService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean logOperation(Integer activityId, Integer operatorId, String operationType,
|
||||||
|
String description, String beforeData, String afterData) {
|
||||||
|
try {
|
||||||
|
MpAgentActivityLogEntity logEntity = new MpAgentActivityLogEntity();
|
||||||
|
logEntity.setActivityId(activityId);
|
||||||
|
logEntity.setOperatorId(operatorId);
|
||||||
|
logEntity.setOperationType(operationType);
|
||||||
|
logEntity.setDescription(description);
|
||||||
|
logEntity.setBeforeData(beforeData);
|
||||||
|
logEntity.setAfterData(afterData);
|
||||||
|
|
||||||
|
boolean result = this.save(logEntity);
|
||||||
|
if (result) {
|
||||||
|
log.info("代理商活动操作日志记录成功,活动ID: {}, 操作类型: {}", activityId, operationType);
|
||||||
|
} else {
|
||||||
|
log.warn("代理商活动操作日志记录失败,活动ID: {}", activityId);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("记录代理商活动操作日志时发生异常,活动ID: {}", activityId, e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,120 @@
|
|||||||
|
package com.seer.teach.mp.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||||
|
import com.seer.teach.mp.exception.AgentActivityErrorCodeEnum;
|
||||||
|
import com.seer.teach.mp.mapper.MpAgentActivityParticipantMapper;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityLogService;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动参与记录表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MpAgentActivityParticipantServiceImpl extends ServiceImpl<MpAgentActivityParticipantMapper, MpAgentActivityParticipantEntity> implements IMpAgentActivityParticipantService {
|
||||||
|
|
||||||
|
private final IMpAgentActivityLogService agentActivityLogService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<MpAgentActivityParticipantEntity> pageList(Page<MpAgentActivityParticipantEntity> pageParm, MpAgentActivityParticipantEntity query) {
|
||||||
|
LambdaQueryWrapper<MpAgentActivityParticipantEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
if (query != null) {
|
||||||
|
if (query.getActivityId() != null) {
|
||||||
|
queryWrapper.eq(MpAgentActivityParticipantEntity::getActivityId, query.getActivityId());
|
||||||
|
}
|
||||||
|
if (query.getAgentId() != null) {
|
||||||
|
queryWrapper.eq(MpAgentActivityParticipantEntity::getAgentId, query.getAgentId());
|
||||||
|
}
|
||||||
|
if (query.getParentId() != null) {
|
||||||
|
queryWrapper.eq(MpAgentActivityParticipantEntity::getParentId, query.getParentId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
queryWrapper.orderByDesc(MpAgentActivityParticipantEntity::getCreateTime);
|
||||||
|
|
||||||
|
return baseMapper.selectPage(pageParm, queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addParticipant(MpAgentActivityParticipantEntity entity) {
|
||||||
|
// 验证参与记录数据
|
||||||
|
validateParticipant(entity);
|
||||||
|
|
||||||
|
// 检查是否已存在相同的参与记录
|
||||||
|
LambdaQueryWrapper<MpAgentActivityParticipantEntity> queryWrapper =
|
||||||
|
new LambdaQueryWrapper<MpAgentActivityParticipantEntity>()
|
||||||
|
.eq(MpAgentActivityParticipantEntity::getActivityId, entity.getActivityId())
|
||||||
|
.eq(MpAgentActivityParticipantEntity::getAgentId, entity.getAgentId())
|
||||||
|
.eq(MpAgentActivityParticipantEntity::getParentId, entity.getParentId());
|
||||||
|
|
||||||
|
long count = this.count(queryWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
// 如果已存在,则不重复添加
|
||||||
|
throw new com.seer.teach.mp.exception.AgentActivityException(AgentActivityErrorCodeEnum.PARTICIPATION_FAILED, "已参与该活动");
|
||||||
|
}
|
||||||
|
|
||||||
|
entity.setCreateTime(LocalDateTime.now());
|
||||||
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
|
|
||||||
|
boolean result = this.save(entity);
|
||||||
|
|
||||||
|
// 记录操作日志
|
||||||
|
if (result) {
|
||||||
|
String beforeData = "";
|
||||||
|
String afterData = JSONUtil.toJsonStr(entity);
|
||||||
|
String description = "代理商参与活动,代理商ID: " + entity.getAgentId() + ", 家长ID: " + entity.getParentId();
|
||||||
|
|
||||||
|
agentActivityLogService.logOperation(
|
||||||
|
entity.getActivityId(),
|
||||||
|
entity.getAgentId(),
|
||||||
|
"参与活动",
|
||||||
|
description,
|
||||||
|
beforeData,
|
||||||
|
afterData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证参与记录数据
|
||||||
|
*/
|
||||||
|
private void validateParticipant(MpAgentActivityParticipantEntity entity) {
|
||||||
|
AssertUtils.notNull(entity.getActivityId(), AgentActivityErrorCodeEnum.ACTIVITY_NOT_FOUND, "活动ID不能为空");
|
||||||
|
AssertUtils.notNull(entity.getAgentId(), AgentActivityErrorCodeEnum.INVALID_AGENT, "代理商ID不能为空");
|
||||||
|
AssertUtils.notNull(entity.getParentId(), AgentActivityErrorCodeEnum.PARENT_NOT_FOUND, "家长ID不能为空");
|
||||||
|
|
||||||
|
// 检查活动是否存在
|
||||||
|
// 这里可以调用活动服务检查活动是否存在,暂时跳过
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MpAgentActivityParticipantEntity> getParticipantsByActivityAndAgent(Integer activityId, Integer agentId) {
|
||||||
|
LambdaQueryWrapper<MpAgentActivityParticipantEntity> queryWrapper =
|
||||||
|
new LambdaQueryWrapper<MpAgentActivityParticipantEntity>()
|
||||||
|
.eq(MpAgentActivityParticipantEntity::getActivityId, activityId)
|
||||||
|
.eq(MpAgentActivityParticipantEntity::getAgentId, agentId);
|
||||||
|
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,166 @@
|
|||||||
|
package com.seer.teach.mp.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.seer.teach.common.utils.AssertUtils;
|
||||||
|
import com.seer.teach.mp.cache.MpAgentActivityCache;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityEntity;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityLogEntity;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
|
||||||
|
import com.seer.teach.mp.exception.AgentActivityErrorCodeEnum;
|
||||||
|
import com.seer.teach.mp.mapper.MpAgentActivityMapper;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityLogService;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityService;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商活动表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MpAgentActivityServiceImpl extends ServiceImpl<MpAgentActivityMapper, MpAgentActivityEntity> implements IMpAgentActivityService {
|
||||||
|
|
||||||
|
private final IMpAgentActivityParticipantService agentActivityParticipantService;
|
||||||
|
private final MpAgentActivityCache agentActivityCache;
|
||||||
|
private final IMpAgentActivityLogService agentActivityLogService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveOrUpdateActivity(MpAgentActivityEntity entity) {
|
||||||
|
// 验证活动数据
|
||||||
|
validateActivity(entity);
|
||||||
|
|
||||||
|
MpAgentActivityEntity oldEntity = null;
|
||||||
|
String operationType = "创建";
|
||||||
|
|
||||||
|
if (entity.getId() != null) {
|
||||||
|
// 更新操作,先获取旧数据用于日志记录
|
||||||
|
oldEntity = super.getById(entity.getId());
|
||||||
|
operationType = "更新";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entity.getId() == null) {
|
||||||
|
// 新增时设置创建时间
|
||||||
|
entity.setCreateTime(LocalDateTime.now());
|
||||||
|
}
|
||||||
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
|
|
||||||
|
boolean result = this.saveOrUpdate(entity);
|
||||||
|
|
||||||
|
// 记录操作日志
|
||||||
|
if (result) {
|
||||||
|
String beforeData = oldEntity != null ? JSONUtil.toJsonStr(oldEntity) : "";
|
||||||
|
String afterData = JSONUtil.toJsonStr(entity);
|
||||||
|
String description = operationType + "代理商活动: " + entity.getActivityName();
|
||||||
|
|
||||||
|
agentActivityLogService.logOperation(
|
||||||
|
entity.getId(),
|
||||||
|
entity.getCreatorId(),
|
||||||
|
operationType,
|
||||||
|
description,
|
||||||
|
beforeData,
|
||||||
|
afterData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证活动数据
|
||||||
|
*/
|
||||||
|
private void validateActivity(MpAgentActivityEntity entity) {
|
||||||
|
AssertUtils.notBlank(entity.getActivityName(), AgentActivityErrorCodeEnum.ACTIVITY_ALREADY_EXISTS, "活动名称不能为空");
|
||||||
|
AssertUtils.notNull(entity.getStartTime(), AgentActivityErrorCodeEnum.INVALID_ACTIVITY_STATUS, "活动开始时间不能为空");
|
||||||
|
AssertUtils.notNull(entity.getEndTime(), AgentActivityErrorCodeEnum.INVALID_ACTIVITY_STATUS, "活动结束时间不能为空");
|
||||||
|
|
||||||
|
// 检查开始时间不能晚于结束时间
|
||||||
|
if (entity.getStartTime().isAfter(entity.getEndTime())) {
|
||||||
|
throw new com.seer.teach.mp.exception.AgentActivityException(AgentActivityErrorCodeEnum.INVALID_ACTIVITY_STATUS, "活动开始时间不能晚于结束时间");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是更新操作,检查活动是否存在
|
||||||
|
if (entity.getId() != null) {
|
||||||
|
MpAgentActivityEntity existing = super.getById(entity.getId());
|
||||||
|
AssertUtils.notNull(existing, AgentActivityErrorCodeEnum.ACTIVITY_NOT_FOUND, "活动不存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteActivity(Integer id) {
|
||||||
|
// 检查活动是否存在
|
||||||
|
MpAgentActivityEntity existing = super.getById(id);
|
||||||
|
AssertUtils.notNull(existing, AgentActivityErrorCodeEnum.ACTIVITY_NOT_FOUND, "活动不存在");
|
||||||
|
|
||||||
|
// 删除活动前先删除相关的参与记录
|
||||||
|
LambdaQueryWrapper<MpAgentActivityParticipantEntity> participantWrapper =
|
||||||
|
new LambdaQueryWrapper<MpAgentActivityParticipantEntity>()
|
||||||
|
.eq(MpAgentActivityParticipantEntity::getActivityId, id);
|
||||||
|
agentActivityParticipantService.remove(participantWrapper);
|
||||||
|
|
||||||
|
// 删除缓存
|
||||||
|
agentActivityCache.deleteActivityById(id);
|
||||||
|
|
||||||
|
boolean result = this.removeById(id);
|
||||||
|
|
||||||
|
// 记录操作日志
|
||||||
|
if (result) {
|
||||||
|
String beforeData = JSONUtil.toJsonStr(existing);
|
||||||
|
String afterData = "";
|
||||||
|
String description = "删除代理商活动: " + existing.getActivityName();
|
||||||
|
|
||||||
|
agentActivityLogService.logOperation(
|
||||||
|
id,
|
||||||
|
existing.getCreatorId(),
|
||||||
|
"删除",
|
||||||
|
description,
|
||||||
|
beforeData,
|
||||||
|
afterData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MpAgentActivityEntity getById(Integer id) {
|
||||||
|
// 先从缓存获取
|
||||||
|
MpAgentActivityEntity cached = agentActivityCache.getActivityById(id);
|
||||||
|
if (cached != null) {
|
||||||
|
return cached;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从数据库获取
|
||||||
|
MpAgentActivityEntity entity = super.getById(id);
|
||||||
|
if (entity != null) {
|
||||||
|
// 存入缓存
|
||||||
|
agentActivityCache.setActivityById(id, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveOrUpdate(MpAgentActivityEntity entity) {
|
||||||
|
boolean result = super.saveOrUpdate(entity);
|
||||||
|
if (result && entity.getId() != null) {
|
||||||
|
// 更新缓存
|
||||||
|
agentActivityCache.setActivityById(entity.getId(), entity);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,113 @@
|
|||||||
|
package com.seer.teach.mp.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEmployeeRelationEntity;
|
||||||
|
import com.seer.teach.mp.mapper.MpAgentEmployeeRelationMapper;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentEmployeeRelationService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 代理商员工关联表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author Lingma
|
||||||
|
* @since 2025-12-29
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class MpAgentEmployeeRelationServiceImpl extends ServiceImpl<MpAgentEmployeeRelationMapper, MpAgentEmployeeRelationEntity> implements IMpAgentEmployeeRelationService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<MpAgentEmployeeRelationEntity> pageList(Page<MpAgentEmployeeRelationEntity> pageParm, MpAgentEmployeeRelationEntity query) {
|
||||||
|
LambdaQueryWrapper<MpAgentEmployeeRelationEntity> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|
||||||
|
if (query != null) {
|
||||||
|
if (query.getAgentId() != null) {
|
||||||
|
queryWrapper.eq(MpAgentEmployeeRelationEntity::getAgentId, query.getAgentId());
|
||||||
|
}
|
||||||
|
if (query.getEmployeeUserId() != null) {
|
||||||
|
queryWrapper.eq(MpAgentEmployeeRelationEntity::getEmployeeUserId, query.getEmployeeUserId());
|
||||||
|
}
|
||||||
|
if (query.getStatus() != null) {
|
||||||
|
queryWrapper.eq(MpAgentEmployeeRelationEntity::getStatus, query.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
queryWrapper.orderByDesc(MpAgentEmployeeRelationEntity::getCreateTime);
|
||||||
|
|
||||||
|
return baseMapper.selectPage(pageParm, queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveOrUpdateRelation(MpAgentEmployeeRelationEntity entity) {
|
||||||
|
// 验证数据
|
||||||
|
validateRelation(entity);
|
||||||
|
|
||||||
|
if (entity.getId() == null) {
|
||||||
|
// 检查是否已存在相同的关联关系
|
||||||
|
LambdaQueryWrapper<MpAgentEmployeeRelationEntity> checkWrapper =
|
||||||
|
new LambdaQueryWrapper<MpAgentEmployeeRelationEntity>()
|
||||||
|
.eq(MpAgentEmployeeRelationEntity::getAgentId, entity.getAgentId())
|
||||||
|
.eq(MpAgentEmployeeRelationEntity::getEmployeeUserId, entity.getEmployeeUserId());
|
||||||
|
|
||||||
|
long count = this.count(checkWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new com.seer.teach.mp.exception.AgentActivityException(
|
||||||
|
com.seer.teach.mp.exception.AgentActivityErrorCodeEnum.PARTICIPATION_FAILED,
|
||||||
|
"员工已关联到代理商"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增时设置创建时间
|
||||||
|
entity.setCreateTime(LocalDateTime.now());
|
||||||
|
}
|
||||||
|
entity.setUpdateTime(LocalDateTime.now());
|
||||||
|
return this.saveOrUpdate(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteRelation(Integer id) {
|
||||||
|
return this.removeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MpAgentEmployeeRelationEntity> getEmployeeRelationsByAgentId(Integer agentId) {
|
||||||
|
LambdaQueryWrapper<MpAgentEmployeeRelationEntity> queryWrapper =
|
||||||
|
new LambdaQueryWrapper<MpAgentEmployeeRelationEntity>()
|
||||||
|
.eq(MpAgentEmployeeRelationEntity::getAgentId, agentId)
|
||||||
|
.orderByDesc(MpAgentEmployeeRelationEntity::getCreateTime);
|
||||||
|
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmployeeOfAgent(Integer agentId, Integer employeeUserId) {
|
||||||
|
LambdaQueryWrapper<MpAgentEmployeeRelationEntity> queryWrapper =
|
||||||
|
new LambdaQueryWrapper<MpAgentEmployeeRelationEntity>()
|
||||||
|
.eq(MpAgentEmployeeRelationEntity::getAgentId, agentId)
|
||||||
|
.eq(MpAgentEmployeeRelationEntity::getEmployeeUserId, employeeUserId)
|
||||||
|
.eq(MpAgentEmployeeRelationEntity::getStatus, 1); // 只检查启用状态的关联
|
||||||
|
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证关联数据
|
||||||
|
*/
|
||||||
|
private void validateRelation(MpAgentEmployeeRelationEntity entity) {
|
||||||
|
com.seer.teach.common.utils.AssertUtils.notNull(entity.getAgentId(),
|
||||||
|
com.seer.teach.mp.exception.AgentActivityErrorCodeEnum.INVALID_AGENT, "代理商ID不能为空");
|
||||||
|
com.seer.teach.common.utils.AssertUtils.notNull(entity.getEmployeeUserId(),
|
||||||
|
com.seer.teach.mp.exception.AgentActivityErrorCodeEnum.PARENT_NOT_FOUND, "员工用户ID不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,168 @@
|
|||||||
|
package com.seer.teach.mp.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.seer.teach.common.utils.PageUtils;
|
||||||
|
import com.seer.teach.mp.entity.MpAgentEntity;
|
||||||
|
import com.seer.teach.mp.exception.AgentErrorCodeEnum;
|
||||||
|
import com.seer.teach.mp.exception.AgentException;
|
||||||
|
import com.seer.teach.mp.mapper.MpAgentMapper;
|
||||||
|
import com.seer.teach.mp.service.IMpAgentService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理商服务实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MpAgentServiceImpl extends ServiceImpl<MpAgentMapper, MpAgentEntity> implements IMpAgentService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
|
IPage<MpAgentEntity> page = this.page(
|
||||||
|
new Page<MpAgentEntity>(Long.parseLong(params.getOrDefault("current", "1").toString()),
|
||||||
|
Long.parseLong(params.getOrDefault("size", "10").toString()))
|
||||||
|
);
|
||||||
|
return new PageUtils(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<MpAgentEntity> pageList(Page<MpAgentEntity> page, MpAgentEntity query) {
|
||||||
|
QueryWrapper<MpAgentEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
if (query != null) {
|
||||||
|
if (query.getAgentName() != null && !query.getAgentName().trim().isEmpty()) {
|
||||||
|
queryWrapper.like("agent_name", query.getAgentName());
|
||||||
|
}
|
||||||
|
if (query.getAgentCode() != null && !query.getAgentCode().trim().isEmpty()) {
|
||||||
|
queryWrapper.eq("agent_code", query.getAgentCode());
|
||||||
|
}
|
||||||
|
if (query.getAgentLevel() != null && !query.getAgentLevel().trim().isEmpty()) {
|
||||||
|
queryWrapper.eq("agent_level", query.getAgentLevel());
|
||||||
|
}
|
||||||
|
if (query.getContactName() != null && !query.getContactName().trim().isEmpty()) {
|
||||||
|
queryWrapper.like("contact_name", query.getContactName());
|
||||||
|
}
|
||||||
|
if (query.getContactPhone() != null && !query.getContactPhone().trim().isEmpty()) {
|
||||||
|
queryWrapper.eq("contact_phone", query.getContactPhone());
|
||||||
|
}
|
||||||
|
if (query.getStatus() != null) {
|
||||||
|
queryWrapper.eq("status", query.getStatus());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
queryWrapper.orderByDesc("create_time");
|
||||||
|
|
||||||
|
return this.page(page, queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MpAgentEntity getAgentById(Integer id) {
|
||||||
|
if (id == null || id <= 0) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_NOT_FOUND, "代理商ID不能为空");
|
||||||
|
}
|
||||||
|
MpAgentEntity agent = this.getById(id);
|
||||||
|
if (agent == null) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_NOT_FOUND);
|
||||||
|
}
|
||||||
|
return agent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean saveAgent(MpAgentEntity agentEntity) {
|
||||||
|
validateAgent(agentEntity);
|
||||||
|
|
||||||
|
// 检查代理商编码是否已存在
|
||||||
|
QueryWrapper<MpAgentEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("agent_code", agentEntity.getAgentCode());
|
||||||
|
int count = this.count(queryWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_CODE_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
agentEntity.setCreateTime(LocalDateTime.now());
|
||||||
|
agentEntity.setUpdateTime(LocalDateTime.now());
|
||||||
|
|
||||||
|
boolean result = this.save(agentEntity);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public boolean updateAgent(MpAgentEntity agentEntity) {
|
||||||
|
validateAgent(agentEntity);
|
||||||
|
|
||||||
|
if (agentEntity.getId() == null || agentEntity.getId() <= 0) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_NOT_FOUND, "代理商ID不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查代理商是否存在
|
||||||
|
MpAgentEntity existingAgent = this.getById(agentEntity.getId());
|
||||||
|
if (existingAgent == null) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查代理商编码是否被其他代理商使用
|
||||||
|
QueryWrapper<MpAgentEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("agent_code", agentEntity.getAgentCode());
|
||||||
|
queryWrapper.ne("id", agentEntity.getId());
|
||||||
|
int count = this.count(queryWrapper);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_CODE_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
agentEntity.setUpdateTime(LocalDateTime.now());
|
||||||
|
|
||||||
|
boolean result = this.updateById(agentEntity);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void deleteAgent(Integer id) {
|
||||||
|
if (id == null || id <= 0) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_NOT_FOUND, "代理商ID不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
MpAgentEntity agent = this.getById(id);
|
||||||
|
if (agent == null) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.removeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证代理商实体
|
||||||
|
*/
|
||||||
|
private void validateAgent(MpAgentEntity agentEntity) {
|
||||||
|
if (agentEntity == null) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_NOT_FOUND, "代理商信息不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (agentEntity.getAgentName() == null || agentEntity.getAgentName().trim().isEmpty()) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_NOT_FOUND, "代理商名称不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (agentEntity.getAgentCode() == null || agentEntity.getAgentCode().trim().isEmpty()) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_NOT_FOUND, "代理商编码不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (agentEntity.getStatus() != null && (agentEntity.getStatus() != 0 && agentEntity.getStatus() != 1)) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_STATUS_INVALID, "代理商状态必须为0或1");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (agentEntity.getContactPhone() != null && !agentEntity.getContactPhone().trim().isEmpty()) {
|
||||||
|
// 简单验证手机号格式
|
||||||
|
if (!agentEntity.getContactPhone().matches("^1[3-9]\d{9}$")) {
|
||||||
|
throw new AgentException(AgentErrorCodeEnum.AGENT_CONTACT_INFO_INVALID, "联系电话格式不正确");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -33,7 +33,7 @@ public class MqMessageGroupServiceImpl extends ServiceImpl<MqMessageGroupMapper,
|
|||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void crateMesGroup(MpMessageGroupEntity params) {
|
public boolean crateMesGroup(MpMessageGroupEntity params) {
|
||||||
MpMessageGroupEntity one = getOne(new LambdaQueryWrapper<MpMessageGroupEntity>()
|
MpMessageGroupEntity one = getOne(new LambdaQueryWrapper<MpMessageGroupEntity>()
|
||||||
.eq(MpMessageGroupEntity::getGroupName, params.getGroupName()));
|
.eq(MpMessageGroupEntity::getGroupName, params.getGroupName()));
|
||||||
if(one != null){
|
if(one != null){
|
||||||
@ -42,8 +42,7 @@ public class MqMessageGroupServiceImpl extends ServiceImpl<MqMessageGroupMapper,
|
|||||||
MpMessageGroupEntity entity = new MpMessageGroupEntity();
|
MpMessageGroupEntity entity = new MpMessageGroupEntity();
|
||||||
entity.setGroupName(params.getGroupName());
|
entity.setGroupName(params.getGroupName());
|
||||||
entity.setDescription(params.getDescription());
|
entity.setDescription(params.getDescription());
|
||||||
save(entity);
|
return save(entity);
|
||||||
log.info("群组创建成功");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,15 +77,14 @@ public class MqMessageGroupServiceImpl extends ServiceImpl<MqMessageGroupMapper,
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateMesGroup(MpMessageGroupEntity params, Integer id) {
|
public boolean updateMesGroup(MpMessageGroupEntity params, Integer id) {
|
||||||
MpMessageGroupEntity entity = getById(id);
|
MpMessageGroupEntity entity = getById(id);
|
||||||
if(entity == null){
|
if(entity == null){
|
||||||
throw new CommonException(ResultCodeEnum.MESSAGE_GROUP_NOT_FOUND);
|
throw new CommonException(ResultCodeEnum.MESSAGE_GROUP_NOT_FOUND);
|
||||||
}
|
}
|
||||||
entity.setGroupName(params.getGroupName());
|
entity.setGroupName(params.getGroupName());
|
||||||
entity.setDescription(params.getDescription());
|
entity.setDescription(params.getDescription());
|
||||||
updateById(entity);
|
return updateById(entity);
|
||||||
log.info("群组更新成功{}", entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,7 +92,7 @@ public class MqMessageGroupServiceImpl extends ServiceImpl<MqMessageGroupMapper,
|
|||||||
* @param id
|
* @param id
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void deleteById(Integer id) {
|
public boolean deleteById(Integer id) {
|
||||||
MpMessageGroupEntity entity = getById(id);
|
MpMessageGroupEntity entity = getById(id);
|
||||||
if(entity == null){
|
if(entity == null){
|
||||||
throw new CommonException(ResultCodeEnum.MESSAGE_GROUP_NOT_FOUND);
|
throw new CommonException(ResultCodeEnum.MESSAGE_GROUP_NOT_FOUND);
|
||||||
@ -104,6 +102,7 @@ public class MqMessageGroupServiceImpl extends ServiceImpl<MqMessageGroupMapper,
|
|||||||
if(!result){
|
if(!result){
|
||||||
throw new CommonException(ResultCodeEnum.MESSAGE_GROUP_DELETE_FAILED);
|
throw new CommonException(ResultCodeEnum.MESSAGE_GROUP_DELETE_FAILED);
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user