master:续费档口及购买会员功能BUG修复;

pull/1121/head
liujiang 2025-12-04 16:23:32 +08:00
parent 7b3ce01b64
commit 4a30f3c9a0
4 changed files with 51 additions and 16 deletions

View File

@ -39,9 +39,25 @@ public interface StoreMapper extends BaseMapper<Store> {
/**
* 访 3
*
* @param threeMonthAgo
* @param yesterday
* @param yesterday
* @return
*/
List<StoreAppViewRankResDTO.SAVRViewCountDTO> selectTop10AppViewCount(@Param("threeMonthAgo") Date threeMonthAgo, @Param("yesterday") Date yesterday);
/**
* serviceAmountnull
*
* @param storeId ID
*/
void updateServiceAmountNull(@Param("storeId") Long storeId);
/**
* memberAmountnull
*
* @param storeId ID
*/
void updateMemberAmountNull(@Param("storeId") Long storeId);
}

View File

@ -161,14 +161,24 @@ public class StoreMemberServiceImpl implements IStoreMemberService {
.in(StoreMember::getMemberStatus, Arrays.asList(StoreMemberStatus.WAIT_AUDIT.getValue(), StoreMemberStatus.BOUGHT_WAIT_AUDIT.getValue()))))
.orElseThrow(() -> new ServiceException("购买会员记录不存在!", HttpStatus.ERROR));
if (Objects.equals(auditDTO.getMemberStatus(), StoreMemberStatus.AUDIT_PASS.getValue())) {
// 若结束时间在当前时间之前,则直接设置为当前时间
Date startTime = ObjectUtils.isEmpty(storeMember.getEndTime()) ? new Date()
: (storeMember.getEndTime().after(new Date()) ? storeMember.getEndTime() : new Date());
// 直接增加一年
Date endTime = Date.from(startTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
.plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
storeMember.setStartTime(startTime);
storeMember.setEndTime(endTime);
// 未购买待审核
if (Objects.equals(storeMember.getMemberStatus(), StoreMemberStatus.WAIT_AUDIT.getValue())) {
// 若结束时间在当前时间之前,则直接设置为当前时间
Date startTime = ObjectUtils.isEmpty(storeMember.getEndTime()) ? new Date()
: (storeMember.getEndTime().after(new Date()) ? storeMember.getEndTime() : new Date());
// 直接增加一年
Date endTime = Date.from(startTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
.plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
storeMember.setStartTime(startTime);
storeMember.setEndTime(endTime);
// 已购买待审核(续费状态)
} else if (Objects.equals(storeMember.getMemberStatus(), StoreMemberStatus.BOUGHT_WAIT_AUDIT.getValue())) {
Date oldEndTime = ObjectUtils.isEmpty(storeMember.getEndTime()) ? new Date() : storeMember.getEndTime();
// 直接增加一年
Date endTime = Date.from(oldEndTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
.plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant());
storeMember.setEndTime(endTime);
}
storeMember.setUpdateBy(SecurityUtils.getUsername());
storeMember.setMemberStatus(StoreMemberStatus.AUDIT_PASS.getValue());
// 最低等级会员:实力质造
@ -178,10 +188,10 @@ public class StoreMemberServiceImpl implements IStoreMemberService {
Store store = Optional.ofNullable(this.storeMapper.selectOne(new LambdaQueryWrapper<Store>()
.eq(Store::getId, storeMember.getStoreId()).eq(Store::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
// 将档口购买优惠金额置为null
store.setMemberAmount(null);
store.setStoreWeight(ObjectUtils.defaultIfNull(store.getStoreWeight(), 0) + 1);
this.storeMapper.updateById(store);
// 将档口购买金额置为null
this.storeMapper.updateMemberAmountNull(store.getId());
// 将档口会员信息添加到 redis 中
redisCache.setCacheObject(CacheConstants.STORE_MEMBER + storeMember.getStoreId(), storeMember);
// 新增订购成功的消息通知

View File

@ -536,8 +536,6 @@ public class StoreServiceImpl implements IStoreService {
if (!Objects.equals(serviceAmount, buyAnnualDTO.getPayPrice())) {
throw new ServiceException("付费金额与核定金额不一致!请联系平台客服", HttpStatus.ERROR);
}
// 年费续费成功之后,就将优惠金额清空,下一年再有优惠就需重新设置
store.setServiceAmount(null);
// 如果是使用版 storeStatus 为3更新为正式版 storeStatus 为4
if (Objects.equals(store.getStoreStatus(), StoreStatus.TRIAL_PERIOD.getValue())) {
store.setStoreStatus(StoreStatus.FORMAL_USE.getValue());
@ -547,6 +545,8 @@ public class StoreServiceImpl implements IStoreService {
store.setServiceEndTime(Date.from(serviceEndTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
.plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant()));
int count = this.storeMapper.updateById(store);
// 年费续费成功之后,就将优惠金额清空,下一年再有优惠就需重新设置
this.storeMapper.updateServiceAmountNull(store.getId());
// 更新redis 中的 store信息
this.redisCache.setCacheObject(CacheConstants.STORE_KEY + store.getId(), store);
// 新增续缴年费成功的消息通知
@ -571,8 +571,6 @@ public class StoreServiceImpl implements IStoreService {
throw new ServiceException("当前用户非超级管理员,无权限操作!", HttpStatus.ERROR);
}
Store store = Optional.ofNullable(storeMapper.selectById(storeId)).orElseThrow(() -> new ServiceException("档口不存在!", HttpStatus.ERROR));
// 年费续费成功之后,就将优惠金额清空,下一年再有优惠就需重新设置
store.setServiceAmount(null);
// 如果是使用版 storeStatus 为3更新为正式版 storeStatus 为4
if (Objects.equals(store.getStoreStatus(), StoreStatus.TRIAL_PERIOD.getValue())) {
store.setStoreStatus(StoreStatus.FORMAL_USE.getValue());
@ -583,7 +581,10 @@ public class StoreServiceImpl implements IStoreService {
.plusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant()));
// 更新redis 中的 store信息
this.redisCache.setCacheObject(CacheConstants.STORE_KEY + store.getId(), store);
return this.storeMapper.updateById(store);
int count = this.storeMapper.updateById(store);
// 年费续费成功之后,就将优惠金额清空,下一年再有优惠就需重新设置
this.storeMapper.updateServiceAmountNull(store.getId());
return count;
}
/**

View File

@ -61,5 +61,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 10
</select>
<update id="updateServiceAmountNull">
UPDATE store SET service_amount = null WHERE id = #{storeId}
</update>
<update id="updateMemberAmountNull">
UPDATE store SET member_amount = null WHERE id = #{storeId}
</update>
</mapper>