店铺会员信息修改
This commit is contained in:
@@ -150,6 +150,17 @@ public class ShopUserController {
|
||||
return CzgResult.success(shopUserService.updateInfo(StpKit.USER.getHeadShopIdBySession(), shopUserEditDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺会员信息修改
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckPermission(parentName = "店铺用户",value = "shopUser:edit", name = "店铺用户修改")
|
||||
@PutMapping
|
||||
public CzgResult<Boolean> editVip(@RequestBody @Validated ShopUserVipEditDTO vipEditDTO) {
|
||||
return CzgResult.success(shopUserService.editVip(vipEditDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺用户余额修改
|
||||
*
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.czg.account.dto.shopuser;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class ShopUserVipEditDTO {
|
||||
/**
|
||||
* 对应shopUserid
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 是否会员 0否 1是
|
||||
*/
|
||||
private Integer isVip;
|
||||
/**
|
||||
* 会员等级id
|
||||
*/
|
||||
private Long memberLevelId;
|
||||
|
||||
/**
|
||||
* 会员开始时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime startTime;
|
||||
/**
|
||||
* 会员结束时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商户储值会员 服务层。
|
||||
@@ -20,11 +19,14 @@ public interface AShopUserService {
|
||||
Page<ShopUser> getPage(String key, Integer isVip);
|
||||
|
||||
Page<ShopUserDTO> getPage(String key, Integer isVip, BigDecimal amount);
|
||||
|
||||
Page<ShopUser> getPushEventUser(SmsPushEventUser smsPushEventUser);
|
||||
|
||||
Page<ShopUser> getAcPushEventUser(SmsPushEventUser smsPushEventUser);
|
||||
|
||||
void exportUserList(String key, Integer isVip, HttpServletResponse response);
|
||||
|
||||
Boolean editVip(ShopUserVipEditDTO vipEditDTO);
|
||||
|
||||
Boolean add(Long shopId, ShopUserAddDTO shopUserAddDTO);
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.DesensitizedUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.shopuser.*;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
@@ -38,6 +37,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -147,6 +147,27 @@ public class AShopUserServiceImpl implements AShopUserService {
|
||||
ExcelExportUtil.exportToResponse(exportList, ShopUserExportDTO.class, shopInfo == null ? "店铺用户列表" : shopInfo.getShopName() + "_用户列表", response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean editVip(ShopUserVipEditDTO vipEditDTO) {
|
||||
ShopUser shopUser = getUserInfo(vipEditDTO.getId());
|
||||
if (vipEditDTO.getIsVip() != null && vipEditDTO.getIsVip() == 1) {
|
||||
shopUser.setIsVip(vipEditDTO.getIsVip());
|
||||
if (vipEditDTO.getMemberLevelId() != null) {
|
||||
shopUser.setMemberLevelId(vipEditDTO.getMemberLevelId());
|
||||
if (shopUser.getStartTime() == null) {
|
||||
shopUser.setStartTime(LocalDateTime.now());
|
||||
}
|
||||
shopUser.setEndTime(vipEditDTO.getEndTime());
|
||||
}
|
||||
} else if (vipEditDTO.getIsVip() != null && vipEditDTO.getIsVip() == 0) {
|
||||
shopUser.setIsVip(0);
|
||||
shopUser.setStartTime(null);
|
||||
shopUser.setEndTime(null);
|
||||
shopUser.setMemberLevelId(null);
|
||||
}
|
||||
return shopUserService.updateById(shopUser, false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean updateInfo(Long shopId, ShopUserEditDTO shopUserEditDTO) {
|
||||
|
||||
Reference in New Issue
Block a user