master:档口购买会员调整;
parent
25c2f98c6b
commit
b2b60f6e38
|
|
@ -0,0 +1,40 @@
|
|||
package com.ruoyi.web.controller.xkt;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeMember.StoreMemberCreateVO;
|
||||
import com.ruoyi.xkt.service.IStoreMemberService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 档口购买会员controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Api(tags = "档口购买会员")
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/rest/v1/store-members")
|
||||
public class StoreMemberController extends XktBaseController {
|
||||
|
||||
final IStoreMemberService storeMemberService;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')")
|
||||
@Log(title = "", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Integer> create(@Validated @RequestBody StoreMemberCreateVO createVO) {
|
||||
return R.ok(storeMemberService.create(createVO.getStoreId()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -148,9 +148,6 @@ public class StoreProductController extends XktBaseController {
|
|||
BeanUtil.toBean(cateCountVO, StoreProdStatusCateNumDTO.class)), StoreProdStatusCateCountResVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出档口商品列表
|
||||
*/
|
||||
@Log(title = "档口商品", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, StoreProduct storeProduct) {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ public class AdRoundStoreBoughtResVO {
|
|||
private Long storeId;
|
||||
@ApiModelProperty(value = "推广展示类型 时间范围 位置枚举")
|
||||
private Integer showType;
|
||||
@ApiModelProperty(value = "广告位置类型 时间范围 位置枚举")
|
||||
private Integer displayType;
|
||||
@ApiModelProperty(value = "投放开始时间")
|
||||
@JsonFormat(pattern = "MM月dd日", timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeMember;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("档口购买会员")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class StoreMemberCreateVO {
|
||||
|
||||
@NotNull(message = "档口ID不能为空!")
|
||||
@ApiModelProperty(value = "档口ID", required = true)
|
||||
private Long storeId;
|
||||
@NotNull(message = "会员金额不能为空!")
|
||||
@ApiModelProperty(value = "会员金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
}
|
||||
|
|
@ -257,5 +257,9 @@ public class CacheConstants {
|
|||
* 所有的推广
|
||||
*/
|
||||
public static final String ADVERT_KEY = "advert:";
|
||||
/**
|
||||
* 档口会员
|
||||
*/
|
||||
public static final String STORE_MEMBER = "store_member:";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -674,6 +674,9 @@ public class XktTask {
|
|||
*/
|
||||
public void autoCloseTimeoutStore() {
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO 更新未交年费档口
|
||||
// TODO 更新未交年费档口
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package com.ruoyi.xkt.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.ruoyi.common.core.domain.XktBaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 档口会员 store_member
|
||||
*
|
||||
* @author liujiang
|
||||
* @date 2025-06-25
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class StoreMember extends XktBaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 广告ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 档口ID
|
||||
*/
|
||||
private Long storeId;
|
||||
/**
|
||||
* 会员等级
|
||||
*/
|
||||
private Integer level;
|
||||
/**
|
||||
* 生效日期 yyyy-MM-dd
|
||||
*/
|
||||
private Date startTime;
|
||||
/**
|
||||
* 截止日期 yyyy-MM-dd
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
|
|
@ -30,6 +30,8 @@ public class AdRoundStoreBoughtResDTO {
|
|||
private String typeName;
|
||||
@ApiModelProperty(value = "推广档口ID")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(value = "广告位置类型 时间范围 位置枚举")
|
||||
private Integer displayType;
|
||||
@ApiModelProperty(value = "1 时间范围 2位置枚举")
|
||||
private Integer showType;
|
||||
@ApiModelProperty(value = "投放开始时间")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.xkt.enums;
|
||||
|
||||
import com.ruoyi.common.constant.HttpStatus;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 档口会员类型
|
||||
*
|
||||
* @author liujiang
|
||||
* @date 2025-04-02 23:42
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum StoreMemberLevel {
|
||||
|
||||
// 实力质造
|
||||
STRENGTH_CONSTRUCT(1, "实力质造"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final Integer value;
|
||||
private final String label;
|
||||
|
||||
public static StoreMemberLevel of(Integer value) {
|
||||
for (StoreMemberLevel e : StoreMemberLevel.values()) {
|
||||
if (e.getValue().equals(value)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
throw new ServiceException("档口会员类型不存在!", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.xkt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.xkt.domain.StoreMember;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 推广营销Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Repository
|
||||
public interface StoreMemberMapper extends BaseMapper<StoreMember> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.ruoyi.xkt.service;
|
||||
|
||||
/**
|
||||
* 推广营销Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
public interface IStoreMemberService {
|
||||
|
||||
/**
|
||||
* 档口购买会员
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @return Integer
|
||||
*/
|
||||
Integer create(Long storeId);
|
||||
}
|
||||
|
|
@ -259,7 +259,8 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
|
|||
}
|
||||
resList.add(typeRoundResDTO);
|
||||
});
|
||||
return resList;
|
||||
// 按照roundId升序排
|
||||
return resList.stream().sorted(Comparator.comparing(AdRoundTypeRoundResDTO::getRoundId)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -360,7 +361,10 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
|
|||
// 如果是最近的播放轮次,且当前时间在 晚上10:00:01 之后到 当天23:59:59 都显示 biddingTempStatus 字段
|
||||
final Integer biddingStatus = tenClockAfter && roundIdList.contains(x.getRoundId()) ? x.getBiddingTempStatus() : x.getBiddingStatus();
|
||||
return BeanUtil.toBean(x, AdRoundStoreBoughtResDTO.class).setAdvertRoundId(x.getId()).setBiddingStatus(biddingStatus)
|
||||
.setBiddingStatusName(AdBiddingStatus.of(biddingStatus).getLabel()).setTypeName(AdType.of(x.getTypeId()).getLabel())
|
||||
// 如果是已出价,则显示 "已出价:50"
|
||||
.setBiddingStatusName(AdBiddingStatus.of(biddingStatus).getLabel() +
|
||||
(Objects.equals(biddingStatus, AdBiddingStatus.BIDDING.getValue()) ? ":" + x.getPayPrice() : ""))
|
||||
.setTypeName(AdType.of(x.getTypeId()).getLabel())
|
||||
// 如果是时间范围则不返回position
|
||||
.setPosition(Objects.equals(x.getShowType(), AdShowType.TIME_RANGE.getValue()) ? null : x.getPosition());
|
||||
})
|
||||
|
|
@ -408,8 +412,7 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
|
|||
boughtRoundList.add(BeanUtil.toBean(record, AdRoundStoreBoughtResDTO.class)
|
||||
.setTypeName(AdType.of(record.getTypeId()).getLabel())
|
||||
.setBiddingStatusName(AdBiddingStatus.of(record.getBiddingStatus()).getLabel()
|
||||
+ ",最新出价:" + positionEnumMaxPriceMap.get(record.getAdvertRoundId()))
|
||||
);
|
||||
+ ",最新出价:" + positionEnumMaxPriceMap.get(record.getAdvertRoundId())));
|
||||
});
|
||||
}
|
||||
return boughtRoundList;
|
||||
|
|
@ -581,9 +584,9 @@ public class AdvertRoundServiceImpl implements IAdvertRoundService {
|
|||
@Transactional
|
||||
public Integer create(AdRoundStoreCreateDTO createDTO) {
|
||||
// 判断截止时间是否超时,并且只会处理马上播放的这一轮。比如 5.1-5.3,当前为4.30,处理这一轮;当前为5.2,处理这一轮;当前为5.3(最后一天),处理下一轮。
|
||||
if (DateUtils.getTime().compareTo(this.getDeadline(createDTO.getSymbol())) > 0) {
|
||||
/*if (DateUtils.getTime().compareTo(this.getDeadline(createDTO.getSymbol())) > 0) {
|
||||
throw new ServiceException("竞价失败,已过系统截止时间!", HttpStatus.ERROR);
|
||||
}
|
||||
}*/
|
||||
Store store = redisCache.getCacheObject(CacheConstants.STORE_KEY + createDTO.getStoreId());
|
||||
if (ObjectUtils.isEmpty(store)) {
|
||||
throw new ServiceException("档口不存在!", HttpStatus.ERROR);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import com.ruoyi.common.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.redis.RedisCache;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.xkt.domain.StoreMember;
|
||||
import com.ruoyi.xkt.enums.StoreMemberLevel;
|
||||
import com.ruoyi.xkt.mapper.StoreMemberMapper;
|
||||
import com.ruoyi.xkt.service.IStoreMemberService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 推广营销Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-03-26
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class StoreMemberServiceImpl implements IStoreMemberService {
|
||||
|
||||
final StoreMemberMapper storeMemberMapper;
|
||||
final RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 档口购买会员
|
||||
*
|
||||
* @param storeId 档口ID
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Integer create(Long storeId) {
|
||||
Optional.ofNullable(storeId).orElseThrow(() -> new RuntimeException("档口ID不能为空"));
|
||||
StoreMember storeMember = new StoreMember();
|
||||
storeMember.setStoreId(storeId);
|
||||
// 最低等级会员:实力质造
|
||||
storeMember.setLevel(StoreMemberLevel.STRENGTH_CONSTRUCT.getValue());
|
||||
storeMember.setStartTime(java.sql.Date.valueOf(LocalDate.now()));
|
||||
// 过期时间设置为1年后
|
||||
storeMember.setEndTime(java.sql.Date.valueOf(LocalDate.now().plusYears(1)));
|
||||
storeMember.setCreateBy(SecurityUtils.getUsername());
|
||||
int count = this.storeMemberMapper.insert(storeMember);
|
||||
// 将档口会员信息添加到 redis 中
|
||||
redisCache.setCacheObject(CacheConstants.STORE_MEMBER + storeId, StoreMemberLevel.STRENGTH_CONSTRUCT.getValue());
|
||||
return count;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue