master:档口会员列表功能完善;
parent
ed88046bd8
commit
fe15b4a9cb
|
|
@ -4,9 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.web.controller.xkt.vo.store.StorePageVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeMember.StoreMemberCreateVO;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeMember.StoreMemberPageVO;
|
||||
import com.ruoyi.xkt.dto.store.StorePageDTO;
|
||||
import com.ruoyi.xkt.dto.store.StorePageResDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberCreateDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageResDTO;
|
||||
import com.ruoyi.xkt.service.IStoreMemberService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
|
@ -40,6 +47,13 @@ public class StoreMemberController extends XktBaseController {
|
|||
return R.ok(storeMemberService.create(BeanUtil.toBean(createVO, StoreMemberCreateDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "查询会员列表 ", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/page")
|
||||
public R<Page<StoreMemberPageResDTO>> page(@Validated @RequestBody StoreMemberPageVO pageVO) {
|
||||
return R.ok(storeMemberService.page(BeanUtil.toBean(pageVO, StoreMemberPageDTO.class)));
|
||||
}
|
||||
|
||||
// TODO 每天获取档口会员过期提醒
|
||||
// TODO 每天获取档口会员过期提醒
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeMember;
|
||||
|
||||
import com.ruoyi.web.controller.xkt.vo.BasePageVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel
|
||||
public class StoreMemberPageVO extends BasePageVO {
|
||||
|
||||
@ApiModelProperty(value = "档口名称")
|
||||
private String storeName;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.xkt.dto.storeMember;
|
||||
|
||||
import com.ruoyi.xkt.dto.BasePageDTO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel
|
||||
public class StoreMemberPageDTO extends BasePageDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口名称")
|
||||
private String storeName;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.ruoyi.xkt.dto.storeMember;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
public class StoreMemberPageResDTO {
|
||||
|
||||
@ApiModelProperty(value = "档口会员ID")
|
||||
private Long storeMemberId;
|
||||
@ApiModelProperty(value = "档口ID")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(value = "档口名称")
|
||||
private String storeName;
|
||||
@ApiModelProperty(value = "档口负责人")
|
||||
private String userName;
|
||||
@ApiModelProperty(value = "联系电话")
|
||||
private String contactPhone;
|
||||
@ApiModelProperty(value = "生效开始时间")
|
||||
private Date startTime;
|
||||
@ApiModelProperty(value = "生效结束时间")
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
|
|
@ -2,8 +2,12 @@ package com.ruoyi.xkt.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.xkt.domain.StoreMember;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageResDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 推广营销Mapper接口
|
||||
*
|
||||
|
|
@ -13,4 +17,12 @@ import org.springframework.stereotype.Repository;
|
|||
@Repository
|
||||
public interface StoreMemberMapper extends BaseMapper<StoreMember> {
|
||||
|
||||
/**
|
||||
* 档口会员列表
|
||||
*
|
||||
* @param pageDTO 列表入参
|
||||
* @return List<StoreMemberPageResDTO>
|
||||
*/
|
||||
List<StoreMemberPageResDTO> selectStoreMemberPage(StoreMemberPageDTO pageDTO);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package com.ruoyi.xkt.service;
|
||||
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberCreateDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageResDTO;
|
||||
|
||||
/**
|
||||
* 推广营销Service接口
|
||||
|
|
@ -17,4 +20,12 @@ public interface IStoreMemberService {
|
|||
* @return Integer
|
||||
*/
|
||||
Integer create(StoreMemberCreateDTO createDTO);
|
||||
|
||||
/**
|
||||
* 档口会员列表
|
||||
*
|
||||
* @param pageDTO 档口会员列表入参
|
||||
* @return Page<StoreMemberPageResDTO>
|
||||
*/
|
||||
Page<StoreMemberPageResDTO> page(StoreMemberPageDTO pageDTO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,10 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public Page<AdminAdRoundPageResDTO> page(AdminAdRoundPageDTO pageDTO) {
|
||||
// 用户是否为档口管理者或子账户
|
||||
if (!SecurityUtils.isAdmin() ) {
|
||||
throw new ServiceException("当前用户非管理员账号,无权限操作!", HttpStatus.ERROR);
|
||||
}
|
||||
Optional.ofNullable(pageDTO.getLaunchStatus()).orElseThrow(() -> new ServiceException("投放状态launchStatus必传", HttpStatus.ERROR));
|
||||
PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
|
||||
List<AdminAdRoundPageResDTO> list = this.advertRoundMapper.selectAdminAdvertPage(pageDTO);
|
||||
|
|
@ -95,6 +99,10 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
|
|||
@Override
|
||||
@Transactional
|
||||
public Integer auditPic(AdminAdRoundAuditDTO auditDTO) {
|
||||
// 用户是否为档口管理者或子账户
|
||||
if (!SecurityUtils.isAdmin() ) {
|
||||
throw new ServiceException("当前用户非管理员账号,无权限操作!", HttpStatus.ERROR);
|
||||
}
|
||||
AdvertRound advertRound = Optional.ofNullable(this.advertRoundMapper.selectOne(new LambdaQueryWrapper<AdvertRound>()
|
||||
.eq(AdvertRound::getId, auditDTO.getAdvertRoundId()).eq(AdvertRound::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("推广位不存在!", HttpStatus.ERROR));
|
||||
|
|
@ -125,6 +133,10 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
|
|||
@Override
|
||||
@Transactional
|
||||
public Integer unsubscribe(AdminAdRoundUnsubscribeDTO unsubscribeDTO) {
|
||||
// 用户是否为档口管理者或子账户
|
||||
if (!SecurityUtils.isAdmin() ) {
|
||||
throw new ServiceException("当前用户非管理员账号,无权限操作!", HttpStatus.ERROR);
|
||||
}
|
||||
AdvertRound advertRound = Optional.ofNullable(this.advertRoundMapper.selectOne(new LambdaQueryWrapper<AdvertRound>()
|
||||
.eq(AdvertRound::getId, unsubscribeDTO.getAdvertRoundId()).eq(AdvertRound::getDelFlag, Constants.UNDELETED)
|
||||
.eq(AdvertRound::getStoreId, unsubscribeDTO.getStoreId())))
|
||||
|
|
@ -153,6 +165,10 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
|
|||
@Override
|
||||
@Transactional
|
||||
public Integer uploadAdvertPic(AdRoundUpdateDTO picDTO) {
|
||||
// 用户是否为档口管理者或子账户
|
||||
if (!SecurityUtils.isAdmin() ) {
|
||||
throw new ServiceException("当前用户非管理员账号,无权限操作!", HttpStatus.ERROR);
|
||||
}
|
||||
AdvertRound advertRound = Optional.ofNullable(this.advertRoundMapper.selectOne(new LambdaQueryWrapper<AdvertRound>()
|
||||
.eq(AdvertRound::getId, picDTO.getAdvertRoundId()).eq(AdvertRound::getStoreId, picDTO.getStoreId())
|
||||
.eq(AdvertRound::getDelFlag, Constants.UNDELETED)))
|
||||
|
|
@ -181,6 +197,10 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
|
|||
@Override
|
||||
@Transactional
|
||||
public synchronized Integer sysIntercept(AdminAdRoundSysInterceptDTO interceptDTO) {
|
||||
// 用户是否为档口管理者或子账户
|
||||
if (!SecurityUtils.isAdmin() ) {
|
||||
throw new ServiceException("当前用户非管理员账号,无权限操作!", HttpStatus.ERROR);
|
||||
}
|
||||
final LocalDateTime nineThirty = LocalDateTime.of(LocalDate.now(), LocalTime.of(21, 30));
|
||||
final LocalDateTime tenFive = LocalDateTime.of(LocalDate.now(), LocalTime.of(22, 5));
|
||||
// 判断当前时间是否为晚上9:30 - 10:05区间,若是,则管理员不可操作推广拦截
|
||||
|
|
@ -261,6 +281,10 @@ public class AdminAdvertRoundServiceImpl implements IAdminAdvertRoundService {
|
|||
@Override
|
||||
@Transactional
|
||||
public Integer cancelIntercept(AdminAdRoundCancelInterceptDTO cancelInterceptDTO) {
|
||||
// 用户是否为档口管理者或子账户
|
||||
if (!SecurityUtils.isAdmin() ) {
|
||||
throw new ServiceException("当前用户非管理员账号,无权限操作!", HttpStatus.ERROR);
|
||||
}
|
||||
// 该推广位是否被拦截
|
||||
AdvertRound advertRound = Optional.ofNullable(this.advertRoundMapper.selectOne(new LambdaQueryWrapper<AdvertRound>()
|
||||
.eq(AdvertRound::getId, cancelInterceptDTO.getAdvertRoundId()).eq(AdvertRound::getDelFlag, Constants.UNDELETED)
|
||||
|
|
|
|||
|
|
@ -1,15 +1,20 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.core.page.Page;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.xkt.domain.Store;
|
||||
import com.ruoyi.xkt.domain.StoreMember;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberCreateDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageDTO;
|
||||
import com.ruoyi.xkt.dto.storeMember.StoreMemberPageResDTO;
|
||||
import com.ruoyi.xkt.enums.NoticeOwnerType;
|
||||
import com.ruoyi.xkt.enums.NoticeType;
|
||||
import com.ruoyi.xkt.enums.StoreMemberLevel;
|
||||
|
|
@ -20,11 +25,13 @@ import com.ruoyi.xkt.service.IAssetService;
|
|||
import com.ruoyi.xkt.service.INoticeService;
|
||||
import com.ruoyi.xkt.service.IStoreMemberService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
|
|
@ -52,6 +59,10 @@ public class StoreMemberServiceImpl implements IStoreMemberService {
|
|||
@Override
|
||||
@Transactional
|
||||
public Integer create(StoreMemberCreateDTO createDTO) {
|
||||
// 用户是否为档口管理者或子账户
|
||||
if (!SecurityUtils.isAdmin()) {
|
||||
throw new ServiceException("当前用户非管理员账号,无权限操作!", HttpStatus.ERROR);
|
||||
}
|
||||
Optional.ofNullable(createDTO.getStoreId()).orElseThrow(() -> new RuntimeException("档口ID不能为空!"));
|
||||
Optional.ofNullable(createDTO.getPayPrice()).orElseThrow(() -> new RuntimeException("购买金额不能为空!"));
|
||||
StoreMember storeMember = new StoreMember();
|
||||
|
|
@ -80,4 +91,24 @@ public class StoreMemberServiceImpl implements IStoreMemberService {
|
|||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取档口会员列表
|
||||
*
|
||||
* @param pageDTO 档口会员列表入参
|
||||
* @return Page<StoreMemberPageResDTO>
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public Page<StoreMemberPageResDTO> page(StoreMemberPageDTO pageDTO) {
|
||||
// 用户是否为档口管理者或子账户
|
||||
if (!SecurityUtils.isAdmin()) {
|
||||
throw new ServiceException("当前用户非管理员账号,无权限操作!", HttpStatus.ERROR);
|
||||
}
|
||||
PageHelper.startPage(pageDTO.getPageNum(), pageDTO.getPageSize());
|
||||
List<StoreMemberPageResDTO> list = this.storeMemberMapper.selectStoreMemberPage(pageDTO);
|
||||
return CollectionUtils.isEmpty(list) ? Page.empty(pageDTO.getPageSize(), pageDTO.getPageNum())
|
||||
: Page.convert(new PageInfo<>(list));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.xkt.mapper.StoreMemberMapper">
|
||||
|
||||
<select id="selectStoreMemberPage">
|
||||
SELECT
|
||||
sm.id AS storeMemberId,
|
||||
s.id AS storeId,
|
||||
s.store_name,
|
||||
u.user_name,
|
||||
s.contact_phone,
|
||||
sm.start_time,
|
||||
sm.end_time
|
||||
FROM
|
||||
store_member sm
|
||||
JOIN store s ON sm.store_id = s.id
|
||||
JOIN sys_user u ON s.user_id = u.user_id
|
||||
WHERE
|
||||
sm.del_flag = 0
|
||||
<if test="storeName != null and storeName != ''"> and s.store_name like concat('%', #{storeName}, '%')</if>
|
||||
ORDER BY
|
||||
sm.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue