Compare commits

...

3 Commits

15 changed files with 94 additions and 73 deletions

View File

@ -19,7 +19,7 @@ import java.time.LocalDateTime;
*/
@Getter
@Setter
@TableName("mp_activities")
@TableName("mp_activity")
@Schema(name = "MpAgentActivityEntity对象", description = "活动表")
public class MpActivityEntity extends BaseEntity {

View File

@ -17,7 +17,7 @@ import lombok.Setter;
*/
@Getter
@Setter
@TableName("mp_agent_activity_participants")
@TableName("mp_agent_activity_participant")
@Schema(name = "MpAgentActivityParticipantEntity对象", description = "代理商活动参与记录表")
public class MpAgentActivityParticipantEntity extends BaseEntity {

View File

@ -17,7 +17,7 @@ import lombok.Setter;
*/
@Getter
@Setter
@TableName("mp_agent_employee_relations")
@TableName("mp_agent_employee_relation")
@Schema(name = "MpAgentEmployeeRelationEntity对象", description = "代理商员工关联表")
public class MpAgentEmployeeRelationEntity extends BaseEntity {

View File

@ -8,7 +8,7 @@ import lombok.Data;
* 代理商实体类
*/
@Data
@TableName("mp_agents")
@TableName("mp_agent")
public class MpAgentEntity extends BaseEntity {
/**

View File

@ -12,6 +12,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -30,9 +31,9 @@ public class AdminActivityController {
private final IAdminActivityService agentActivityService;
@Operation(summary = "活动列表")
@GetMapping("/page-list")
@PostMapping("/page-list")
@SaCheckPermission("mp:admin:agent:activity:list")
public ResultBean<PageListBean<AdminActivityResp>> pageList(MpActivityQueryReq query) {
public ResultBean<PageListBean<AdminActivityResp>> pageList(@RequestBody @Validated MpActivityQueryReq query) {
return ResultBean.success(agentActivityService.pageList(query));
}

View File

@ -10,6 +10,7 @@ import com.seer.teach.mp.admin.service.IAdminAgentActivityLogService;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -24,9 +25,9 @@ public class AdminAgentActivityLogController {
private final IAdminAgentActivityLogService adminAgentActivityLogService;
@Operation(summary = "代理商活动操作日志列表")
@GetMapping("/page-list")
@PostMapping("/page-list")
@SaCheckPermission("mp:admin:agent:activity:log:list")
public ResultBean<PageListBean<AdminAgentActivityLogResp>> pageList(AgentActivityLogQueryReq query) {
public ResultBean<PageListBean<AdminAgentActivityLogResp>> pageList(@RequestBody @Validated AgentActivityLogQueryReq query) {
return ResultBean.success(adminAgentActivityLogService.pageList(query));
}

View File

@ -11,14 +11,7 @@ import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -63,10 +56,6 @@ public class AdminAgentActivityParticipantController {
@DeleteMapping
@SaCheckPermission("mp:admin:agent:activity:participant:delete")
public ResultBean<Boolean> delete(@RequestBody List<Integer> ids) {
boolean result = true;
for (Integer id : ids) {
result &= adminAgentActivityParticipantService.deleteParticipant(id);
}
return ResultBean.success(result);
return ResultBean.success(adminAgentActivityParticipantService.deleteById(ids));
}
}

View File

@ -11,6 +11,7 @@ import com.seer.teach.mp.entity.MpAgentEntity;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -25,9 +26,9 @@ public class AdminAgentController {
private final AdminAgentService adminAgentService;
@Operation(summary = "代理商列表")
@GetMapping("/page-list")
@PostMapping("/page-list")
@SaCheckPermission("mp:admin:agent:list")
public ResultBean<PageListBean<AgentResp>> pageList(AgentQueryReq query) {
public ResultBean<PageListBean<AgentResp>> pageList(@RequestBody @Validated AgentQueryReq query) {
return ResultBean.success(adminAgentService.pageList(query));
}

View File

@ -12,6 +12,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -30,9 +31,9 @@ public class AdminAgentEmployeeRelationController {
private final IAdminAgentEmployeeRelationService agentEmployeeRelationService;
@Operation(summary = "代理商员工关联列表")
@GetMapping("/page-list")
@PostMapping("/page-list")
@SaCheckPermission("mp:admin:agent:employee:list")
public ResultBean<PageListBean<AgentEmployeeRelationResp>> pageList(AgentEmployeeRelationQueryReq query) {
public ResultBean<PageListBean<AgentEmployeeRelationResp>> pageList(@RequestBody @Validated AgentEmployeeRelationQueryReq query) {
return ResultBean.success(agentEmployeeRelationService.pageList(query));
}

View File

@ -27,7 +27,4 @@ public class AgentActivityParticipantQueryReq {
@Schema(description = "代理商ID")
private Integer agentId;
@Schema(description = "家长ID")
private Integer parentId;
}

View File

@ -25,6 +25,12 @@ public class AdminAgentActivityParticipantResp {
@Schema(description = "代理商ID")
private Integer agentId;
@Schema(description = "代理商名称")
private String agentName;
@Schema(description = "活动名称")
private String activityName;
@Schema(description = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;

View File

@ -36,7 +36,10 @@ public class AdminAgentService {
MpAgentEntity query = AgentConvert.INSTANCE.convertOne(pageReq);
IPage<MpAgentEntity> resultPage = mpAgentService.page(pageParam, new LambdaQueryWrapper<>(MpAgentEntity.class)
.like(StringUtils.isNotBlank(query.getAgentName()), MpAgentEntity::getAgentName, query.getAgentName())
.eq(query.getStatus() != null, MpAgentEntity::getStatus, query.getStatus())
.like(StringUtils.isNotBlank(query.getContactName()), MpAgentEntity::getContactName, query.getContactName())
.like(StringUtils.isNotBlank(query.getAgentCode()), MpAgentEntity::getAgentCode, query.getAgentCode())
.like(StringUtils.isNotBlank(query.getAgentLevel()), MpAgentEntity::getAgentLevel, query.getAgentLevel())
.like(StringUtils.isNotBlank(query.getContactPhone()), MpAgentEntity::getContactPhone, query.getContactPhone()));
return PageConverterUtils.convertPageListBean(resultPage, AgentConvert.INSTANCE::convertRespList);
@ -84,13 +87,13 @@ public class AdminAgentService {
* @return 是否成功
*/
public Boolean deleteById(List<Integer> ids) {
if(ids == null || ids.isEmpty()){
if (ids == null || ids.isEmpty()) {
log.warn("删除代理商时ID列表为空");
return false;
}
boolean result = mpAgentService.removeByIds(ids);
log.info("删除代理商结果: {}", result);
if(result){
if (result) {
log.info("删除代理商成功ID列表: {}", ids);
}
return result;

View File

@ -5,6 +5,8 @@ import com.seer.teach.mp.admin.controller.req.AgentActivityParticipantQueryReq;
import com.seer.teach.mp.admin.controller.resp.AdminAgentActivityParticipantResp;
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
import java.util.List;
/**
* <p>
* 代理商活动参与记录表 管理端服务类
@ -39,14 +41,6 @@ public interface IAdminAgentActivityParticipantService {
*/
boolean updateParticipant(MpAgentActivityParticipantEntity entity);
/**
* 根据ID删除代理商活动参与记录管理端
*
* @param id 参与记录ID
* @return 操作是否成功
*/
boolean deleteParticipant(Integer id);
/**
* 根据ID获取代理商活动参与记录详情管理端
*
@ -54,4 +48,12 @@ public interface IAdminAgentActivityParticipantService {
* @return 参与记录详情
*/
AdminAgentActivityParticipantResp getById(Integer id);
/**
* 根据ID删除代理商活动参与记录管理端
*
* @param ids 参与记录ID
* @return 操作是否成功
*/
Boolean deleteById(List<Integer> ids);
}

View File

@ -13,8 +13,6 @@ import com.seer.teach.mp.service.IMpAgentActivityLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 代理商活动操作日志表 管理端服务实现类
@ -32,31 +30,13 @@ public class AdminAgentActivityLogServiceImpl implements IAdminAgentActivityLogS
@Override
public PageListBean<AdminAgentActivityLogResp> pageList(AgentActivityLogQueryReq query) {
Page<MpAgentActivityLogEntity> page = new Page<>(query.getPageNum(), query.getPageSize());
LambdaQueryWrapper<MpAgentActivityLogEntity> wrapper = new LambdaQueryWrapper<>();
// 根据活动ID查询
if (query.getActivityId() != null) {
wrapper.eq(MpAgentActivityLogEntity::getActivityId, query.getActivityId());
}
// 根据操作人ID查询
if (query.getOperatorId() != null) {
wrapper.eq(MpAgentActivityLogEntity::getOperatorId, query.getOperatorId());
}
// 根据操作类型查询
if (query.getOperationType() != null && !query.getOperationType().isEmpty()) {
wrapper.eq(MpAgentActivityLogEntity::getOperationType, query.getOperationType());
}
// 根据创建时间范围查询
if (query.getStartTime() != null) {
wrapper.ge(MpAgentActivityLogEntity::getCreateTime, query.getStartTime());
}
if (query.getEndTime() != null) {
wrapper.le(MpAgentActivityLogEntity::getCreateTime, query.getEndTime());
}
wrapper.eq(query.getActivityId() != null, MpAgentActivityLogEntity::getActivityId, query.getActivityId())
.eq(query.getOperatorId() != null, MpAgentActivityLogEntity::getOperatorId, query.getOperatorId())
.eq(query.getOperationType() != null, MpAgentActivityLogEntity::getOperationType, query.getOperationType())
.ge(query.getStartTime() != null, MpAgentActivityLogEntity::getCreateTime, query.getStartTime())
.le(query.getEndTime() != null, MpAgentActivityLogEntity::getCreateTime, query.getEndTime())
.orderByDesc(MpAgentActivityLogEntity::getUpdateTime);
IPage<MpAgentActivityLogEntity> result = mpAgentActivityLogService.page(page, wrapper);

View File

@ -4,16 +4,20 @@ 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.admin.controller.req.AgentActivityParticipantQueryReq;
import com.seer.teach.mp.admin.controller.resp.AdminAgentActivityParticipantResp;
import com.seer.teach.mp.admin.convert.AdminAgentActivityParticipantConvert;
import com.seer.teach.mp.admin.service.IAdminAgentActivityParticipantService;
import com.seer.teach.mp.entity.MpAgentActivityParticipantEntity;
import com.seer.teach.mp.service.IMpActivityService;
import com.seer.teach.mp.service.IMpAgentActivityParticipantService;
import com.seer.teach.mp.service.IMpAgentService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 代理商活动参与记录表 管理端服务实现类
@ -28,25 +32,58 @@ public class AdminAgentActivityParticipantServiceImpl implements IAdminAgentActi
private final IMpAgentActivityParticipantService mpAgentActivityParticipantService;
private final IMpAgentService mpAgentService;
private final IMpActivityService mpActivityService;
@Override
public PageListBean<AdminAgentActivityParticipantResp> pageList(AgentActivityParticipantQueryReq query) {
Page<MpAgentActivityParticipantEntity> page = new Page<>(query.getPageNum(), query.getPageSize());
LambdaQueryWrapper<MpAgentActivityParticipantEntity> wrapper = new LambdaQueryWrapper<>();
// 根据活动ID查询
if (query.getActivityId() != null) {
wrapper.eq(MpAgentActivityParticipantEntity::getActivityId, query.getActivityId());
}
// 根据代理商ID查询
if (query.getAgentId() != null) {
wrapper.eq(MpAgentActivityParticipantEntity::getAgentId, query.getAgentId());
}
IPage<MpAgentActivityParticipantEntity> result = mpAgentActivityParticipantService.page(page, wrapper);
return PageConverterUtils.convertPageListBean(result, AdminAgentActivityParticipantConvert.INSTANCE::convertToRespList);
// 转换为响应对象列表
List<AdminAgentActivityParticipantResp> respList = result.getRecords().stream()
.map(entity -> {
AdminAgentActivityParticipantResp resp = AdminAgentActivityParticipantConvert.INSTANCE.convertToResp(entity);
// 设置代理商名称
if (entity.getAgentId() != null) {
var agent = mpAgentService.getAgentById(entity.getAgentId());
if (agent != null) {
resp.setAgentName(agent.getAgentName());
}
}
// 设置活动名称
if (entity.getActivityId() != null) {
var activity = mpActivityService.getById(entity.getActivityId());
if (activity != null) {
resp.setActivityName(activity.getActivityName());
}
}
return resp;
})
.collect(Collectors.toList());
// 构建分页结果
PageListBean<AdminAgentActivityParticipantResp> pageResult = new PageListBean<>();
pageResult.setList(respList);
pageResult.setTotalPage(result.getCurrent());
pageResult.setPageSize(result.getSize());
pageResult.setTotal(result.getTotal());
pageResult.setPage(result.getPages());
return pageResult;
}
@Override
public boolean saveParticipant(MpAgentActivityParticipantEntity entity) {
@ -79,15 +116,18 @@ public class AdminAgentActivityParticipantServiceImpl implements IAdminAgentActi
return mpAgentActivityParticipantService.updateById(entity);
}
@Override
public boolean deleteParticipant(Integer id) {
return mpAgentActivityParticipantService.removeById(id);
}
@Override
public AdminAgentActivityParticipantResp getById(Integer id) {
MpAgentActivityParticipantEntity entity = mpAgentActivityParticipantService.getById(id);
return AdminAgentActivityParticipantConvert.INSTANCE.convertToResp(entity);
}
@Override
public Boolean deleteById(List<Integer> ids) {
if (ids == null || ids.isEmpty()) {
return false;
}
return mpAgentActivityParticipantService.removeByIds(ids);
}
}