fix: 获取Seata模拟数据完善

This commit is contained in:
郝先瑞 2022-04-18 00:44:45 +08:00
parent 5e1758b957
commit 59bd74857d
7 changed files with 42 additions and 13 deletions

View File

@ -35,7 +35,6 @@ public interface SkuFeignClient {
@PutMapping("/app-api/v1/sku/_deduct")
Result deductStock(@RequestParam String orderToken);
/**
* 订单商品验价
*
@ -44,7 +43,6 @@ public interface SkuFeignClient {
@PostMapping("/app-api/v1/sku/price/_check")
Result<Boolean> checkPrice(@RequestBody CheckPriceDTO checkPriceDTO);
/**
* 实验室修改商品库存
*

View File

@ -4,6 +4,7 @@ import com.youlai.common.result.Result;
import com.youlai.mall.pms.pojo.vo.ProductHistoryVO;
import com.youlai.mall.ums.dto.MemberAuthInfoDTO;
import com.youlai.mall.ums.dto.MemberDTO;
import com.youlai.mall.ums.dto.MemberInfoDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@ -83,8 +84,8 @@ public interface MemberFeignClient {
* @param memberId
* @return
*/
@GetMapping("/api/v1/members/{memberId}")
Result<MemberDTO> getMemberInfo(@PathVariable Long memberId);
@GetMapping("/api/v1/members/{memberId}/info")
Result<MemberInfoDTO> getMemberInfo(@PathVariable Long memberId);
}

View File

@ -0,0 +1,23 @@
package com.youlai.mall.ums.dto;
import lombok.Data;
import java.time.LocalDate;
/**
* 会员传输层对象
*
* @author haoxr
* @date 2022/2/12
*/
@Data
public class MemberInfoDTO {
private String nickName;
private String avatarUrl;
private Long balance;
}

View File

@ -7,6 +7,7 @@ import com.youlai.common.constant.GlobalConstants;
import com.youlai.common.result.PageResult;
import com.youlai.common.result.Result;
import com.youlai.mall.ums.dto.MemberDTO;
import com.youlai.mall.ums.dto.MemberInfoDTO;
import com.youlai.mall.ums.pojo.entity.UmsMember;
import com.youlai.mall.ums.service.IUmsMemberService;
import io.swagger.annotations.Api;
@ -39,11 +40,11 @@ public class UmsMemberController {
@ApiOperation(value = "获取会员信息")
@GetMapping("/{memberId}/info")
public Result<MemberDTO> getMemberInfo(
public Result<MemberInfoDTO> getMemberInfo(
@ApiParam("会员ID") @PathVariable Long memberId
) {
MemberDTO memberDTO = memberService.getMemberInfo(memberId);
return Result.success(memberDTO);
MemberInfoDTO memberInfoDTO = memberService.getMemberInfo(memberId);
return Result.success(memberInfoDTO);
}
@ApiOperation(value = "修改会员")

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.youlai.mall.pms.pojo.vo.ProductHistoryVO;
import com.youlai.mall.ums.dto.MemberAuthInfoDTO;
import com.youlai.mall.ums.dto.MemberDTO;
import com.youlai.mall.ums.dto.MemberInfoDTO;
import com.youlai.mall.ums.pojo.entity.UmsMember;
import com.youlai.mall.ums.pojo.vo.MemberVO;
@ -82,5 +83,5 @@ public interface IUmsMemberService extends IService<UmsMember> {
* @param memberId
* @return
*/
MemberDTO getMemberInfo(Long memberId);
MemberInfoDTO getMemberInfo(Long memberId);
}

View File

@ -16,6 +16,7 @@ import com.youlai.mall.pms.pojo.vo.ProductHistoryVO;
import com.youlai.mall.ums.constant.UmsConstants;
import com.youlai.mall.ums.dto.MemberAuthInfoDTO;
import com.youlai.mall.ums.dto.MemberDTO;
import com.youlai.mall.ums.dto.MemberInfoDTO;
import com.youlai.mall.ums.mapper.UmsMemberMapper;
import com.youlai.mall.ums.pojo.entity.UmsMember;
import com.youlai.mall.ums.pojo.vo.MemberVO;
@ -193,12 +194,12 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
* @return
*/
@Override
public MemberDTO getMemberInfo(Long memberId) {
MemberDTO memberDTO = new MemberDTO();
public MemberInfoDTO getMemberInfo(Long memberId) {
MemberInfoDTO memberInfoDTO = new MemberInfoDTO();
UmsMember umsMember = this.getById(memberId);
if (umsMember != null) {
BeanUtil.copyProperties(umsMember, memberDTO);
BeanUtil.copyProperties(umsMember, memberInfoDTO);
}
return memberDTO;
return memberInfoDTO;
}
}

View File

@ -9,6 +9,7 @@ import com.youlai.mall.pms.api.SkuFeignClient;
import com.youlai.mall.pms.pojo.dto.SkuInfoDTO;
import com.youlai.mall.ums.api.MemberFeignClient;
import com.youlai.mall.ums.dto.MemberDTO;
import com.youlai.mall.ums.dto.MemberInfoDTO;
import io.seata.spring.annotation.GlobalTransactional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -69,15 +70,18 @@ public class SeataServiceImpl implements ISeataService {
SkuInfoDTO skuInfoDTO = skuFeignClient.getSkuInfo(skuId).getData();
SeataDataVO.SkuInfo skuInfo = new SeataDataVO.SkuInfo();
BeanUtil.copyProperties(skuInfoDTO, skuInfo);
skuInfo.setName(skuInfoDTO.getSkuName());
seataDataVO.setSkuInfo(skuInfo);
MemberDTO memberInfoDTO = memberFeignClient.getMemberInfo(memberId).getData();
MemberInfoDTO memberInfoDTO = memberFeignClient.getMemberInfo(memberId).getData();
SeataDataVO.MemberInfo memberInfo = new SeataDataVO.MemberInfo();
BeanUtil.copyProperties(memberInfoDTO, memberInfo);
seataDataVO.setMemberInfo(memberInfo);
OrderInfoDTO orderInfoDTO = orderFeignClient.getOrderInfo(orderId).getData();
SeataDataVO.OrderInfo orderInfo = new SeataDataVO.OrderInfo();
BeanUtil.copyProperties(orderInfoDTO, orderInfo);
seataDataVO.setOrderInfo(orderInfo);
return seataDataVO;
}