mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 09:11:52 +08:00
member:优化部分变量的命名
This commit is contained in:
parent
94c2ad5d1d
commit
728308cbc0
@ -23,7 +23,7 @@ public class UserCreateMessage extends AbstractStreamMessage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStreamKey() {
|
public String getStreamKey() {
|
||||||
return "member.create.send";
|
return "member.user.create";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
|||||||
import cn.iocoder.yudao.framework.common.util.string.StrUtils;
|
import cn.iocoder.yudao.framework.common.util.string.StrUtils;
|
||||||
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
|
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
|
||||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.pay.enums.DictTypeConstants;
|
import cn.iocoder.yudao.module.pay.enums.DictTypeConstants;
|
||||||
@ -241,7 +241,7 @@ public interface TradeOrderConvert {
|
|||||||
return reqBO;
|
return reqBO;
|
||||||
}
|
}
|
||||||
|
|
||||||
default AppTradeOrderSettlementRespVO convert(TradePriceCalculateRespBO calculate, AddressRespDTO address) {
|
default AppTradeOrderSettlementRespVO convert(TradePriceCalculateRespBO calculate, MemberAddressRespDTO address) {
|
||||||
AppTradeOrderSettlementRespVO respVO = convert0(calculate, address);
|
AppTradeOrderSettlementRespVO respVO = convert0(calculate, address);
|
||||||
if (address != null) {
|
if (address != null) {
|
||||||
respVO.getAddress().setAreaName(AreaUtils.format(address.getAreaId()));
|
respVO.getAddress().setAreaName(AreaUtils.format(address.getAreaId()));
|
||||||
@ -249,7 +249,7 @@ public interface TradeOrderConvert {
|
|||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
AppTradeOrderSettlementRespVO convert0(TradePriceCalculateRespBO calculate, AddressRespDTO address);
|
AppTradeOrderSettlementRespVO convert0(TradePriceCalculateRespBO calculate, MemberAddressRespDTO address);
|
||||||
|
|
||||||
List<AppOrderExpressTrackRespDTO> convertList02(List<ExpressTrackRespDTO> list);
|
List<AppOrderExpressTrackRespDTO> convertList02(List<ExpressTrackRespDTO> list);
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import cn.iocoder.yudao.framework.common.core.KeyValue;
|
|||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.address.AddressApi;
|
import cn.iocoder.yudao.module.member.api.address.MemberAddressApi;
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.PayOrderApi;
|
import cn.iocoder.yudao.module.pay.api.order.PayOrderApi;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
||||||
@ -98,7 +98,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
@Resource
|
@Resource
|
||||||
private PayOrderApi payOrderApi;
|
private PayOrderApi payOrderApi;
|
||||||
@Resource
|
@Resource
|
||||||
private AddressApi addressApi;
|
private MemberAddressApi addressApi;
|
||||||
@Resource
|
@Resource
|
||||||
private ProductCommentApi productCommentApi;
|
private ProductCommentApi productCommentApi;
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
@Override
|
@Override
|
||||||
public AppTradeOrderSettlementRespVO settlementOrder(Long userId, AppTradeOrderSettlementReqVO settlementReqVO) {
|
public AppTradeOrderSettlementRespVO settlementOrder(Long userId, AppTradeOrderSettlementReqVO settlementReqVO) {
|
||||||
// 1. 获得收货地址
|
// 1. 获得收货地址
|
||||||
AddressRespDTO address = getAddress(userId, settlementReqVO.getAddressId());
|
MemberAddressRespDTO address = getAddress(userId, settlementReqVO.getAddressId());
|
||||||
if (address != null) {
|
if (address != null) {
|
||||||
settlementReqVO.setAddressId(address.getId());
|
settlementReqVO.setAddressId(address.getId());
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
* @param addressId 地址编号
|
* @param addressId 地址编号
|
||||||
* @return 地址
|
* @return 地址
|
||||||
*/
|
*/
|
||||||
private AddressRespDTO getAddress(Long userId, Long addressId) {
|
private MemberAddressRespDTO getAddress(Long userId, Long addressId) {
|
||||||
if (addressId != null) {
|
if (addressId != null) {
|
||||||
return addressApi.getAddress(addressId, userId);
|
return addressApi.getAddress(addressId, userId);
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|||||||
// 物流信息
|
// 物流信息
|
||||||
order.setDeliveryType(createReqVO.getDeliveryType());
|
order.setDeliveryType(createReqVO.getDeliveryType());
|
||||||
if (Objects.equals(createReqVO.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getType())) {
|
if (Objects.equals(createReqVO.getDeliveryType(), DeliveryTypeEnum.EXPRESS.getType())) {
|
||||||
AddressRespDTO address = addressApi.getAddress(createReqVO.getAddressId(), userId);
|
MemberAddressRespDTO address = addressApi.getAddress(createReqVO.getAddressId(), userId);
|
||||||
Assert.notNull(address, "地址({}) 不能为空", createReqVO.getAddressId()); // 价格计算时,已经计算
|
Assert.notNull(address, "地址({}) 不能为空", createReqVO.getAddressId()); // 价格计算时,已经计算
|
||||||
order.setReceiverName(address.getName()).setReceiverMobile(address.getMobile())
|
order.setReceiverName(address.getName()).setReceiverMobile(address.getMobile())
|
||||||
.setReceiverAreaId(address.getAreaId()).setReceiverDetailAddress(address.getDetailAddress());
|
.setReceiverAreaId(address.getAreaId()).setReceiverDetailAddress(address.getDetailAddress());
|
||||||
|
@ -4,8 +4,8 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.module.member.api.address.AddressApi;
|
import cn.iocoder.yudao.module.member.api.address.MemberAddressApi;
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.config.TradeConfigDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.config.TradeConfigDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||||
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryExpressChargeModeEnum;
|
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryExpressChargeModeEnum;
|
||||||
@ -41,7 +41,7 @@ import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
|||||||
public class TradeDeliveryPriceCalculator implements TradePriceCalculator {
|
public class TradeDeliveryPriceCalculator implements TradePriceCalculator {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AddressApi addressApi;
|
private MemberAddressApi addressApi;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DeliveryPickUpStoreService deliveryPickUpStoreService;
|
private DeliveryPickUpStoreService deliveryPickUpStoreService;
|
||||||
@ -81,7 +81,7 @@ public class TradeDeliveryPriceCalculator implements TradePriceCalculator {
|
|||||||
// 价格计算时,如果为空就不算~最终下单,会校验该字段不允许空
|
// 价格计算时,如果为空就不算~最终下单,会校验该字段不允许空
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AddressRespDTO address = addressApi.getAddress(param.getAddressId(), param.getUserId());
|
MemberAddressRespDTO address = addressApi.getAddress(param.getAddressId(), param.getUserId());
|
||||||
Assert.notNull(address, "收件人({})的地址,不能为空", param.getUserId());
|
Assert.notNull(address, "收件人({})的地址,不能为空", param.getUserId());
|
||||||
|
|
||||||
// 情况一:全局包邮
|
// 情况一:全局包邮
|
||||||
|
@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.trade.service.order;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
|
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||||
import cn.iocoder.yudao.module.member.api.address.AddressApi;
|
import cn.iocoder.yudao.module.member.api.address.MemberAddressApi;
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.PayOrderApi;
|
import cn.iocoder.yudao.module.pay.api.order.PayOrderApi;
|
||||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
||||||
@ -77,7 +77,7 @@ public class TradeOrderUpdateServiceTest extends BaseDbUnitTest {
|
|||||||
@MockBean
|
@MockBean
|
||||||
private PayOrderApi payOrderApi;
|
private PayOrderApi payOrderApi;
|
||||||
@MockBean
|
@MockBean
|
||||||
private AddressApi addressApi;
|
private MemberAddressApi addressApi;
|
||||||
@MockBean
|
@MockBean
|
||||||
private CouponApi couponApi;
|
private CouponApi couponApi;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ public class TradeOrderUpdateServiceTest extends BaseDbUnitTest {
|
|||||||
.setStatus(ProductSpuStatusEnum.ENABLE.getStatus()));
|
.setStatus(ProductSpuStatusEnum.ENABLE.getStatus()));
|
||||||
when(productSpuApi.getSpuList(eq(asSet(11L, 21L)))).thenReturn(Arrays.asList(spu01, spu02));
|
when(productSpuApi.getSpuList(eq(asSet(11L, 21L)))).thenReturn(Arrays.asList(spu01, spu02));
|
||||||
// mock 方法(用户收件地址的校验)
|
// mock 方法(用户收件地址的校验)
|
||||||
AddressRespDTO addressRespDTO = new AddressRespDTO().setId(10L).setUserId(userId).setName("芋艿")
|
MemberAddressRespDTO addressRespDTO = new MemberAddressRespDTO().setId(10L).setUserId(userId).setName("芋艿")
|
||||||
.setMobile("15601691300").setAreaId(3306).setDetailAddress("土豆村");
|
.setMobile("15601691300").setAreaId(3306).setDetailAddress("土豆村");
|
||||||
when(addressApi.getAddress(eq(10L), eq(userId))).thenReturn(addressRespDTO);
|
when(addressApi.getAddress(eq(10L), eq(userId))).thenReturn(addressRespDTO);
|
||||||
// mock 方法(价格计算)
|
// mock 方法(价格计算)
|
||||||
|
@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.trade.service.price.calculator;
|
|||||||
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
|
||||||
import cn.iocoder.yudao.module.member.api.address.AddressApi;
|
import cn.iocoder.yudao.module.member.api.address.MemberAddressApi;
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.config.TradeConfigDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.config.TradeConfigDO;
|
||||||
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryExpressChargeModeEnum;
|
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryExpressChargeModeEnum;
|
||||||
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
|
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
|
||||||
@ -38,7 +38,7 @@ public class TradeDeliveryPriceCalculatorTest extends BaseMockitoUnitTest {
|
|||||||
private TradeDeliveryPriceCalculator calculator;
|
private TradeDeliveryPriceCalculator calculator;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private AddressApi addressApi;
|
private MemberAddressApi addressApi;
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
private DeliveryExpressTemplateService deliveryExpressTemplateService;
|
private DeliveryExpressTemplateService deliveryExpressTemplateService;
|
||||||
@ -80,7 +80,7 @@ public class TradeDeliveryPriceCalculatorTest extends BaseMockitoUnitTest {
|
|||||||
TradePriceCalculatorHelper.recountAllPrice(resultBO);
|
TradePriceCalculatorHelper.recountAllPrice(resultBO);
|
||||||
|
|
||||||
// 准备收件地址数据
|
// 准备收件地址数据
|
||||||
AddressRespDTO addressResp = randomPojo(AddressRespDTO.class, item -> item.setAreaId(10));
|
MemberAddressRespDTO addressResp = randomPojo(MemberAddressRespDTO.class, item -> item.setAreaId(10));
|
||||||
when(addressApi.getAddress(eq(10L), eq(1L))).thenReturn(addressResp);
|
when(addressApi.getAddress(eq(10L), eq(1L))).thenReturn(addressResp);
|
||||||
|
|
||||||
// 准备运费模板费用配置数据
|
// 准备运费模板费用配置数据
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.member.api.address;
|
package cn.iocoder.yudao.module.member.api.address;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户收件地址 API 接口
|
* 用户收件地址 API 接口
|
||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
public interface AddressApi {
|
public interface MemberAddressApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得用户收件地址
|
* 获得用户收件地址
|
||||||
@ -16,7 +16,7 @@ public interface AddressApi {
|
|||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
* @return 用户收件地址
|
* @return 用户收件地址
|
||||||
*/
|
*/
|
||||||
AddressRespDTO getAddress(Long id, Long userId);
|
MemberAddressRespDTO getAddress(Long id, Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得用户默认收件地址
|
* 获得用户默认收件地址
|
||||||
@ -24,6 +24,6 @@ public interface AddressApi {
|
|||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
* @return 用户收件地址
|
* @return 用户收件地址
|
||||||
*/
|
*/
|
||||||
AddressRespDTO getDefaultAddress(Long userId);
|
MemberAddressRespDTO getDefaultAddress(Long userId);
|
||||||
|
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ import lombok.Data;
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class AddressRespDTO {
|
public class MemberAddressRespDTO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编号
|
* 编号
|
@ -1,6 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.member.api.address;
|
package cn.iocoder.yudao.module.member.api.address;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.convert.address.AddressConvert;
|
import cn.iocoder.yudao.module.member.convert.address.AddressConvert;
|
||||||
import cn.iocoder.yudao.module.member.service.address.AddressService;
|
import cn.iocoder.yudao.module.member.service.address.AddressService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -15,18 +15,18 @@ import javax.annotation.Resource;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
public class AddressApiImpl implements AddressApi {
|
public class MemberAddressApiImpl implements MemberAddressApi {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AddressService addressService;
|
private AddressService addressService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressRespDTO getAddress(Long id, Long userId) {
|
public MemberAddressRespDTO getAddress(Long id, Long userId) {
|
||||||
return AddressConvert.INSTANCE.convert02(addressService.getAddress(userId, id));
|
return AddressConvert.INSTANCE.convert02(addressService.getAddress(userId, id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressRespDTO getDefaultAddress(Long userId) {
|
public MemberAddressRespDTO getDefaultAddress(Long userId) {
|
||||||
return AddressConvert.INSTANCE.convert02(addressService.getDefaultUserAddress(userId));
|
return AddressConvert.INSTANCE.convert02(addressService.getDefaultUserAddress(userId));
|
||||||
}
|
}
|
||||||
|
|
@ -2,13 +2,13 @@ package cn.iocoder.yudao.module.member.controller.admin.point;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
|
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO;
|
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO;
|
||||||
import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert;
|
import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||||
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -35,7 +35,7 @@ public class MemberPointRecordController {
|
|||||||
private MemberPointRecordService pointRecordService;
|
private MemberPointRecordService pointRecordService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberUserApi memberUserApi;
|
private MemberUserService memberUserService;
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得用户积分记录分页")
|
@Operation(summary = "获得用户积分记录分页")
|
||||||
@ -48,7 +48,7 @@ public class MemberPointRecordController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 拼接结果返回
|
// 拼接结果返回
|
||||||
List<MemberUserRespDTO> users = memberUserApi.getUserList(
|
List<MemberUserDO> users = memberUserService.getUserList(
|
||||||
convertSet(pageResult.getList(), MemberPointRecordDO::getUserId));
|
convertSet(pageResult.getList(), MemberPointRecordDO::getUserId));
|
||||||
return success(MemberPointRecordConvert.INSTANCE.convertPage(pageResult, users));
|
return success(MemberPointRecordConvert.INSTANCE.convertPage(pageResult, users));
|
||||||
}
|
}
|
||||||
|
@ -2,13 +2,13 @@ package cn.iocoder.yudao.module.member.controller.admin.signin;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordRespVO;
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordRespVO;
|
||||||
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
|
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
import cn.iocoder.yudao.module.member.service.signin.MemberSignInRecordService;
|
import cn.iocoder.yudao.module.member.service.signin.MemberSignInRecordService;
|
||||||
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
@ -35,7 +35,7 @@ public class MemberSignInRecordController {
|
|||||||
private MemberSignInRecordService signInRecordService;
|
private MemberSignInRecordService signInRecordService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberUserApi memberUserApi;
|
private MemberUserService memberUserService;
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得签到记录分页")
|
@Operation(summary = "获得签到记录分页")
|
||||||
@ -48,7 +48,7 @@ public class MemberSignInRecordController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 拼接结果返回
|
// 拼接结果返回
|
||||||
List<MemberUserRespDTO> users = memberUserApi.getUserList(
|
List<MemberUserDO> users = memberUserService.getUserList(
|
||||||
convertSet(pageResult.getList(), MemberSignInRecordDO::getUserId));
|
convertSet(pageResult.getList(), MemberSignInRecordDO::getUserId));
|
||||||
return success(MemberSignInRecordConvert.INSTANCE.convertPage(pageResult, users));
|
return success(MemberSignInRecordConvert.INSTANCE.convertPage(pageResult, users));
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.member.convert.address;
|
package cn.iocoder.yudao.module.member.convert.address;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.address.dto.AddressRespDTO;
|
import cn.iocoder.yudao.module.member.api.address.dto.MemberAddressRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.address.vo.AddressRespVO;
|
import cn.iocoder.yudao.module.member.controller.admin.address.vo.AddressRespVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressRespVO;
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressRespVO;
|
||||||
@ -33,7 +33,7 @@ public interface AddressConvert {
|
|||||||
|
|
||||||
List<AppAddressRespVO> convertList(List<MemberAddressDO> list);
|
List<AppAddressRespVO> convertList(List<MemberAddressDO> list);
|
||||||
|
|
||||||
AddressRespDTO convert02(MemberAddressDO bean);
|
MemberAddressRespDTO convert02(MemberAddressDO bean);
|
||||||
|
|
||||||
@Named("convertAreaIdToAreaName")
|
@Named("convertAreaIdToAreaName")
|
||||||
default String convertAreaIdToAreaName(Integer areaId) {
|
default String convertAreaIdToAreaName(Integer areaId) {
|
||||||
|
@ -2,10 +2,10 @@ package cn.iocoder.yudao.module.member.convert.point;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO;
|
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordRespVO;
|
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordRespVO;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
@ -24,10 +24,10 @@ public interface MemberPointRecordConvert {
|
|||||||
|
|
||||||
MemberPointRecordConvert INSTANCE = Mappers.getMapper(MemberPointRecordConvert.class);
|
MemberPointRecordConvert INSTANCE = Mappers.getMapper(MemberPointRecordConvert.class);
|
||||||
|
|
||||||
default PageResult<MemberPointRecordRespVO> convertPage(PageResult<MemberPointRecordDO> pageResult, List<MemberUserRespDTO> users) {
|
default PageResult<MemberPointRecordRespVO> convertPage(PageResult<MemberPointRecordDO> pageResult, List<MemberUserDO> users) {
|
||||||
PageResult<MemberPointRecordRespVO> voPageResult = convertPage(pageResult);
|
PageResult<MemberPointRecordRespVO> voPageResult = convertPage(pageResult);
|
||||||
// user 拼接
|
// user 拼接
|
||||||
Map<Long, MemberUserRespDTO> userMap = convertMap(users, MemberUserRespDTO::getId);
|
Map<Long, MemberUserDO> userMap = convertMap(users, MemberUserDO::getId);
|
||||||
voPageResult.getList().forEach(record -> MapUtils.findAndThen(userMap, record.getUserId(),
|
voPageResult.getList().forEach(record -> MapUtils.findAndThen(userMap, record.getUserId(),
|
||||||
memberUserRespDTO -> record.setNickname(memberUserRespDTO.getNickname())));
|
memberUserRespDTO -> record.setNickname(memberUserRespDTO.getNickname())));
|
||||||
return voPageResult;
|
return voPageResult;
|
||||||
|
@ -4,11 +4,11 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordRespVO;
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordRespVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.signin.vo.record.AppMemberSignInRecordRespVO;
|
import cn.iocoder.yudao.module.member.controller.app.signin.vo.record.AppMemberSignInRecordRespVO;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
@ -29,10 +29,10 @@ public interface MemberSignInRecordConvert {
|
|||||||
|
|
||||||
MemberSignInRecordConvert INSTANCE = Mappers.getMapper(MemberSignInRecordConvert.class);
|
MemberSignInRecordConvert INSTANCE = Mappers.getMapper(MemberSignInRecordConvert.class);
|
||||||
|
|
||||||
default PageResult<MemberSignInRecordRespVO> convertPage(PageResult<MemberSignInRecordDO> pageResult, List<MemberUserRespDTO> users) {
|
default PageResult<MemberSignInRecordRespVO> convertPage(PageResult<MemberSignInRecordDO> pageResult, List<MemberUserDO> users) {
|
||||||
PageResult<MemberSignInRecordRespVO> voPageResult = convertPage(pageResult);
|
PageResult<MemberSignInRecordRespVO> voPageResult = convertPage(pageResult);
|
||||||
// user 拼接
|
// user 拼接
|
||||||
Map<Long, MemberUserRespDTO> userMap = convertMap(users, MemberUserRespDTO::getId);
|
Map<Long, MemberUserDO> userMap = convertMap(users, MemberUserDO::getId);
|
||||||
voPageResult.getList().forEach(record -> MapUtils.findAndThen(userMap, record.getUserId(),
|
voPageResult.getList().forEach(record -> MapUtils.findAndThen(userMap, record.getUserId(),
|
||||||
memberUserRespDTO -> record.setNickname(memberUserRespDTO.getNickname())));
|
memberUserRespDTO -> record.setNickname(memberUserRespDTO.getNickname())));
|
||||||
return voPageResult;
|
return voPageResult;
|
||||||
|
@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class UserCreateMessage extends AbstractStreamMessage {
|
public class MemberUserCreateMessage extends AbstractStreamMessage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户编号
|
* 用户编号
|
||||||
@ -23,7 +23,7 @@ public class UserCreateMessage extends AbstractStreamMessage {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStreamKey() {
|
public String getStreamKey() {
|
||||||
return "member.create.send";
|
return "member.user.create";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,31 +1,31 @@
|
|||||||
package cn.iocoder.yudao.module.member.mq.producer.user;
|
package cn.iocoder.yudao.module.member.mq.producer.user;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate;
|
import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate;
|
||||||
import cn.iocoder.yudao.module.member.mq.message.user.UserCreateMessage;
|
import cn.iocoder.yudao.module.member.mq.message.user.MemberUserCreateMessage;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员用户创建 Producer
|
* 会员用户 Producer
|
||||||
*
|
*
|
||||||
* @author owen
|
* @author owen
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class UserCreateProducer {
|
public class MemberUserProducer {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RedisMQTemplate redisMQTemplate;
|
private RedisMQTemplate redisMQTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送 {@link UserCreateMessage} 消息
|
* 发送 {@link MemberUserCreateMessage} 消息
|
||||||
*
|
*
|
||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
*/
|
*/
|
||||||
public void sendUserCreateMessage(Long userId) {
|
public void sendUserCreateMessage(Long userId) {
|
||||||
redisMQTemplate.send(new UserCreateMessage().setUserId(userId));
|
redisMQTemplate.send(new MemberUserCreateMessage().setUserId(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -7,18 +7,18 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.signin.vo.record.AppMemberSignInRecordSummaryRespVO;
|
import cn.iocoder.yudao.module.member.controller.app.signin.vo.record.AppMemberSignInRecordSummaryRespVO;
|
||||||
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
|
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInRecordMapper;
|
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInRecordMapper;
|
||||||
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
|
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
|
||||||
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
|
||||||
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
import cn.iocoder.yudao.module.member.service.level.MemberLevelService;
|
||||||
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||||
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -53,7 +53,7 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
|
|||||||
private MemberLevelService memberLevelService;
|
private MemberLevelService memberLevelService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MemberUserApi memberUserApi;
|
private MemberUserService memberUserService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppMemberSignInRecordSummaryRespVO getSignInRecordSummary(Long userId) {
|
public AppMemberSignInRecordSummaryRespVO getSignInRecordSummary(Long userId) {
|
||||||
@ -124,12 +124,12 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
|
|||||||
// 根据用户昵称查询出用户ids
|
// 根据用户昵称查询出用户ids
|
||||||
Set<Long> userIds = null;
|
Set<Long> userIds = null;
|
||||||
if (StringUtils.isNotBlank(pageReqVO.getNickname())) {
|
if (StringUtils.isNotBlank(pageReqVO.getNickname())) {
|
||||||
List<MemberUserRespDTO> users = memberUserApi.getUserListByNickname(pageReqVO.getNickname());
|
List<MemberUserDO> users = memberUserService.getUserListByNickname(pageReqVO.getNickname());
|
||||||
// 如果查询用户结果为空直接返回无需继续查询
|
// 如果查询用户结果为空直接返回无需继续查询
|
||||||
if (CollUtil.isEmpty(users)) {
|
if (CollUtil.isEmpty(users)) {
|
||||||
return PageResult.empty();
|
return PageResult.empty();
|
||||||
}
|
}
|
||||||
userIds = convertSet(users, MemberUserRespDTO::getId);
|
userIds = convertSet(users, MemberUserDO::getId);
|
||||||
}
|
}
|
||||||
// 分页查询
|
// 分页查询
|
||||||
return signInRecordMapper.selectPage(pageReqVO, userIds);
|
return signInRecordMapper.selectPage(pageReqVO, userIds);
|
||||||
|
@ -7,7 +7,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserPageReqVO;
|
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserPageReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserUpdateReqVO;
|
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppMemberUserResetPasswordReqVO;
|
import cn.iocoder.yudao.module.member.controller.app.user.vo.AppMemberUserResetPasswordReqVO;
|
||||||
@ -18,7 +17,7 @@ import cn.iocoder.yudao.module.member.convert.auth.AuthConvert;
|
|||||||
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
|
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
|
||||||
import cn.iocoder.yudao.module.member.mq.producer.user.UserCreateProducer;
|
import cn.iocoder.yudao.module.member.mq.producer.user.MemberUserProducer;
|
||||||
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
|
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
|
||||||
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
|
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
|
||||||
@ -29,7 +28,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.support.TransactionSynchronization;
|
import org.springframework.transaction.support.TransactionSynchronization;
|
||||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
@ -54,8 +52,6 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
@Resource
|
@Resource
|
||||||
private MemberUserMapper memberUserMapper;
|
private MemberUserMapper memberUserMapper;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private FileApi fileApi;
|
|
||||||
@Resource
|
@Resource
|
||||||
private SmsCodeApi smsCodeApi;
|
private SmsCodeApi smsCodeApi;
|
||||||
|
|
||||||
@ -63,10 +59,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
private PasswordEncoder passwordEncoder;
|
private PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserCreateProducer registerCouponProducer;
|
private MemberUserProducer memberUserProducer;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private TransactionTemplate transactionTemplate;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemberUserDO getUserByMobile(String mobile) {
|
public MemberUserDO getUserByMobile(String mobile) {
|
||||||
@ -107,7 +100,7 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCommit() {
|
public void afterCommit() {
|
||||||
registerCouponProducer.sendUserCreateMessage(user.getId());
|
memberUserProducer.sendUserCreateMessage(user.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -14,12 +14,12 @@ public interface SocialClientApi {
|
|||||||
/**
|
/**
|
||||||
* 获得社交平台的授权 URL
|
* 获得社交平台的授权 URL
|
||||||
*
|
*
|
||||||
* @param type 社交平台的类型 {@link SocialTypeEnum}
|
* @param socialType 社交平台的类型 {@link SocialTypeEnum}
|
||||||
* @param userType 用户类型
|
* @param userType 用户类型
|
||||||
* @param redirectUri 重定向 URL
|
* @param redirectUri 重定向 URL
|
||||||
* @return 社交平台的授权 URL
|
* @return 社交平台的授权 URL
|
||||||
*/
|
*/
|
||||||
String getAuthorizeUrl(Integer type, Integer userType, String redirectUri);
|
String getAuthorizeUrl(Integer socialType, Integer userType, String redirectUri);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建微信公众号 JS SDK 初始化所需的签名
|
* 创建微信公众号 JS SDK 初始化所需的签名
|
||||||
|
@ -35,12 +35,12 @@ public interface SocialUserApi {
|
|||||||
* 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
|
* 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
|
||||||
*
|
*
|
||||||
* @param userType 用户类型
|
* @param userType 用户类型
|
||||||
* @param type 社交平台的类型
|
* @param socialType 社交平台的类型
|
||||||
* @param code 授权码
|
* @param code 授权码
|
||||||
* @param state state
|
* @param state state
|
||||||
* @return 社交用户
|
* @return 社交用户
|
||||||
*/
|
*/
|
||||||
SocialUserRespDTO getSocialUser(Integer userType, Integer type,
|
SocialUserRespDTO getSocialUser(Integer userType, Integer socialType,
|
||||||
String code, String state);
|
String code, String state);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ public class SocialClientApiImpl implements SocialClientApi {
|
|||||||
private SocialClientService socialClientService;
|
private SocialClientService socialClientService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAuthorizeUrl(Integer type, Integer userType, String redirectUri) {
|
public String getAuthorizeUrl(Integer socialType, Integer userType, String redirectUri) {
|
||||||
return socialClientService.getAuthorizeUrl(type, userType, redirectUri);
|
return socialClientService.getAuthorizeUrl(socialType, userType, redirectUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,8 +33,8 @@ public class SocialUserApiImpl implements SocialUserApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SocialUserRespDTO getSocialUser(Integer userType, Integer type, String code, String state) {
|
public SocialUserRespDTO getSocialUser(Integer userType, Integer socialType, String code, String state) {
|
||||||
return socialUserService.getSocialUser(userType, type, code, state);
|
return socialUserService.getSocialUser(userType, socialType, code, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,8 @@ public class AuthController {
|
|||||||
})
|
})
|
||||||
public CommonResult<String> socialLogin(@RequestParam("type") Integer type,
|
public CommonResult<String> socialLogin(@RequestParam("type") Integer type,
|
||||||
@RequestParam("redirectUri") String redirectUri) {
|
@RequestParam("redirectUri") String redirectUri) {
|
||||||
return success(socialClientService.getAuthorizeUrl(type, UserTypeEnum.ADMIN.getValue(), redirectUri));
|
return success(socialClientService.getAuthorizeUrl(
|
||||||
|
type, UserTypeEnum.ADMIN.getValue(), redirectUri));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/social-login")
|
@PostMapping("/social-login")
|
||||||
|
@ -16,7 +16,6 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface SocialUserService {
|
public interface SocialUserService {
|
||||||
|
|
||||||
// TODO @芋艿:需要传递 userType
|
|
||||||
/**
|
/**
|
||||||
* 获得指定用户的社交用户列表
|
* 获得指定用户的社交用户列表
|
||||||
*
|
*
|
||||||
@ -39,10 +38,10 @@ public interface SocialUserService {
|
|||||||
*
|
*
|
||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
* @param userType 全局用户类型
|
* @param userType 全局用户类型
|
||||||
* @param type 社交平台的类型 {@link SocialTypeEnum}
|
* @param socialType 社交平台的类型 {@link SocialTypeEnum}
|
||||||
* @param openid 社交平台的 openid
|
* @param openid 社交平台的 openid
|
||||||
*/
|
*/
|
||||||
void unbindSocialUser(Long userId, Integer userType, Integer type, String openid);
|
void unbindSocialUser(Long userId, Integer userType, Integer socialType, String openid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得社交用户
|
* 获得社交用户
|
||||||
@ -50,11 +49,11 @@ public interface SocialUserService {
|
|||||||
* 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
|
* 在认证信息不正确的情况下,也会抛出 {@link ServiceException} 业务异常
|
||||||
*
|
*
|
||||||
* @param userType 用户类型
|
* @param userType 用户类型
|
||||||
* @param type 社交平台的类型
|
* @param socialType 社交平台的类型
|
||||||
* @param code 授权码
|
* @param code 授权码
|
||||||
* @param state state
|
* @param state state
|
||||||
* @return 社交用户
|
* @return 社交用户
|
||||||
*/
|
*/
|
||||||
SocialUserRespDTO getSocialUser(Integer userType, Integer type, String code, String state);
|
SocialUserRespDTO getSocialUser(Integer userType, Integer socialType, String code, String state);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,9 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unbindSocialUser(Long userId, Integer userType, Integer type, String openid) {
|
public void unbindSocialUser(Long userId, Integer userType, Integer socialType, String openid) {
|
||||||
// 获得 openid 对应的 SocialUserDO 社交用户
|
// 获得 openid 对应的 SocialUserDO 社交用户
|
||||||
SocialUserDO socialUser = socialUserMapper.selectByTypeAndOpenid(type, openid);
|
SocialUserDO socialUser = socialUserMapper.selectByTypeAndOpenid(socialType, openid);
|
||||||
if (socialUser == null) {
|
if (socialUser == null) {
|
||||||
throw exception(SOCIAL_USER_NOT_FOUND);
|
throw exception(SOCIAL_USER_NOT_FOUND);
|
||||||
}
|
}
|
||||||
@ -92,9 +92,9 @@ public class SocialUserServiceImpl implements SocialUserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SocialUserRespDTO getSocialUser(Integer userType, Integer type, String code, String state) {
|
public SocialUserRespDTO getSocialUser(Integer userType, Integer socialType, String code, String state) {
|
||||||
// 获得社交用户
|
// 获得社交用户
|
||||||
SocialUserDO socialUser = authSocialUser(type, userType, code, state);
|
SocialUserDO socialUser = authSocialUser(socialType, userType, code, state);
|
||||||
Assert.notNull(socialUser, "社交用户不能为空");
|
Assert.notNull(socialUser, "社交用户不能为空");
|
||||||
|
|
||||||
// 如果未绑定的社交用户,则无法自动登录,进行报错
|
// 如果未绑定的社交用户,则无法自动登录,进行报错
|
||||||
|
Loading…
Reference in New Issue
Block a user