Commit 0cbab998 by 张跃

Merge branch 'featur/20210609-会员信息-zy' into develop

parents 6ad191ac c7bcb011
......@@ -61,7 +61,7 @@
<dependency>
<artifactId>assortment-data-manager</artifactId>
<groupId>com.freemud.sdk.api.assortment</groupId>
<version>5.5.10-SNAPSHOT</version>
<version>5.5.11-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.freemud.application.service.sdk</groupId>
......
......@@ -16,6 +16,8 @@ import cn.freemud.enums.ResponseResult;
import cn.freemud.interceptor.ServiceException;
import cn.freemud.service.thirdparty.CustomScoreClient;
import cn.freemud.service.thirdparty.CustomerApplicationClient;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
import com.freemud.application.sdk.api.constant.FMStatusCode;
import com.freemud.application.sdk.api.log.ErrorLog;
import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest;
......@@ -40,27 +42,35 @@ public class KgdCustomerServceImpl implements CustomerService {
private CustomerDTO2BOAdapter customerDTO2BOAdapter;
@Autowired
private CustomerBO2DTOAdapter customerBO2DTOAdapter;
@Autowired
private AssortmentCustomerInfoManager customerInfoManager;
@Override
public CustomerInfo getUserInfoByUserId(String sessionId) {
GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
getSessionUserInfoDto.setIsGetPaid(true);
getSessionUserInfoDto.setSessionId(sessionId);
BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
// BaseResponse<CustomerInfoVo> sessionUserInfo =
// customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
// if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() ==
// null) {
// throw new ServiceException(ResponseResult.NOT_LOGIN);
// }
AssortmentCustomerInfoVo customerInfoVo = customerInfoManager.getCustomerInfoByObject(sessionId);
if (customerInfoVo == null)
throw new ServiceException(ResponseResult.NOT_LOGIN);
}
CustomerInfoVo result = sessionUserInfo.getResult();
// CustomerInfoVo result = sessionUserInfo.getResult();
CustomerInfo customerInfo = new CustomerInfo();
if(CollectionUtils.isEmpty(result.getMemberPaids())){
customerInfo.setIsMember(false);
} else {
boolean isMember = result.getMemberPaids().stream().anyMatch(item -> item.getExpiryTime().getTime() > System.currentTimeMillis());
customerInfo.setIsMember(isMember);
}
customerInfo.setUserId(result.getMemberId());
// if(CollectionUtils.isEmpty(result.getMemberPaids())){
// customerInfo.setIsMember(false);
// } else {
// boolean isMember = result.getMemberPaids().stream().anyMatch(item -> item.getExpiryTime().getTime() >
// System.currentTimeMillis());
// customerInfo.setIsMember(isMember);
//
// }
customerInfo.setUserId(customerInfoVo.getMemberId());
customerInfo.setIsMember(customerInfoVo.isMemberPaid());
return customerInfo;
}
......
......@@ -21,9 +21,12 @@ import cn.freemud.service.ShoppingCartNewService;
import cn.freemud.service.impl.*;
import cn.freemud.service.thirdparty.CustomerApplicationClient;
import cn.freemud.service.thirdparty.StockClient;
import cn.freemud.utils.BeanUtil;
import cn.freemud.utils.PromotionFactory;
import com.freemud.api.assortment.datamanager.entity.db.AssortmentOpenPlatformPartnerStoreDeliveryConfig;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformPartnerStoreDeliveryConfigManager;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
import com.freemud.application.sdk.api.log.ApiLog;
import com.freemud.application.sdk.api.log.LogThreadLocal;
......@@ -99,7 +102,8 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
@Autowired
private AssortmentSdkService assortmentSdkService;
@Autowired
private AssortmentCustomerInfoManager customerInfoManager;
// 配送费逻辑是否使用旧的
@Value("${store.delivery.use.old:true}")
private boolean storeDeliveryUseOld;
......@@ -110,14 +114,18 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
* @return
*/
public CustomerInfoVo getCustomerInfoVo(String sessionId) {
GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
getSessionUserInfoDto.setIsGetPaid(true);
getSessionUserInfoDto.setSessionId(sessionId);
BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
throw new ServiceException(ResponseResult.NOT_LOGIN);
}
return sessionUserInfo.getResult();
// GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
// getSessionUserInfoDto.setIsGetPaid(true);
// getSessionUserInfoDto.setSessionId(sessionId);
// BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
// if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
// throw new ServiceException(ResponseResult.NOT_LOGIN);
// }
AssortmentCustomerInfoVo customerInfoVo = customerInfoManager.getCustomerInfoByObject(sessionId);
if(customerInfoVo == null) throw new ServiceException(ResponseResult.NOT_LOGIN);;
CustomerInfoVo customerInfoVo1 = new CustomerInfoVo();
BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return customerInfoVo1;
}
public UserLoginInfoDto convert2UserLoginInfoDto(CustomerInfoVo assortmentCustomerInfoVo) {
......
......@@ -14,6 +14,8 @@ import cn.freemud.service.thirdparty.CustomerApplicationClient;
import cn.freemud.utils.BeanUtil;
import cn.freemud.utils.LogUtil;
import cn.freemud.utils.ResponseUtil;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
import com.freemud.application.sdk.api.log.ApiLog;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
......@@ -29,6 +31,8 @@ public class OpenStoreIappWxappConfigServiceImpl implements OpenStoreIappWxappCo
@Autowired
private CustomerApplicationClient customerApplicationClient;
@Autowired
private AssortmentCustomerInfoManager customerInfoManager;
public BaseResponse getOpenStoreIappWxappConfig(OpenStoreIappWxappConfigRequestVo openStoreIappWxappConfigRequestVo){
// 获取用户信息
......@@ -56,13 +60,18 @@ public class OpenStoreIappWxappConfigServiceImpl implements OpenStoreIappWxappCo
}
private CustomerInfoVo getCustomerInfoVo(String sessionId) {
GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
getSessionUserInfoDto.setIsGetPaid(true);
getSessionUserInfoDto.setSessionId(sessionId);
BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
throw new ServiceException(ResponseResult.NOT_LOGIN);
}
return sessionUserInfo.getResult();
// GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
// getSessionUserInfoDto.setIsGetPaid(true);
// getSessionUserInfoDto.setSessionId(sessionId);
// BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
// if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
// throw new ServiceException(ResponseResult.NOT_LOGIN);
// }
// return sessionUserInfo.getResult();
AssortmentCustomerInfoVo customerInfoVo = customerInfoManager.getCustomerInfoByObject(sessionId);
if(customerInfoVo == null) throw new ServiceException(ResponseResult.NOT_LOGIN);;
CustomerInfoVo customerInfoVo1 = new CustomerInfoVo();
BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return customerInfoVo1;
}
}
......@@ -34,6 +34,7 @@ import cn.freemud.service.impl.calculate.*;
import cn.freemud.service.shoppingCart.ShoppingCartRelationFactory;
import cn.freemud.service.shoppingCart.ShoppingCartRelationService;
import cn.freemud.service.thirdparty.*;
import cn.freemud.utils.BeanUtil;
import cn.freemud.utils.PromotionFactory;
import cn.freemud.utils.ResponseUtil;
import com.alibaba.fastjson.JSON;
......@@ -894,14 +895,19 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
}
private CustomerInfoVo getCustomerInfoVo(String sessionId) {
GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
getSessionUserInfoDto.setIsGetPaid(true);
getSessionUserInfoDto.setSessionId(sessionId);
BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
throw new ServiceException(ResponseResult.NOT_LOGIN);
}
return sessionUserInfo.getResult();
// GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
// getSessionUserInfoDto.setIsGetPaid(true);
// getSessionUserInfoDto.setSessionId(sessionId);
// BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
// if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
// throw new ServiceException(ResponseResult.NOT_LOGIN);
// }
// return sessionUserInfo.getResult();
AssortmentCustomerInfoVo customerInfoVo = customerInfoManager.getCustomerInfoByObject(sessionId);
if(customerInfoVo == null) throw new ServiceException(ResponseResult.NOT_LOGIN);;
CustomerInfoVo customerInfoVo1 = new CustomerInfoVo();
BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return customerInfoVo1;
}
private List<CalculationSharingDiscountRequestDto.CalculationDiscountCoupon> buildCoupons(List<CalculationSharingDiscountRequestDto.CalculationDiscountCoupon> oldCoupons, List<ShoppingCartInfoRequestVo.couponCode> coupons){
......
......@@ -21,10 +21,7 @@ import cn.freemud.service.CommonService;
import cn.freemud.service.ShoppingCartNewService;
import cn.freemud.service.thirdparty.ActivityClient;
import cn.freemud.service.thirdparty.CustomerApplicationClient;
import cn.freemud.utils.PromotionFactory;
import cn.freemud.utils.PropertyConvertUtil;
import cn.freemud.utils.RedisLock;
import cn.freemud.utils.ResponseUtil;
import cn.freemud.utils.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
......@@ -702,14 +699,19 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
}
private CustomerInfoVo getCustomerInfoVo(String sessionId) {
GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
getSessionUserInfoDto.setIsGetPaid(true);
getSessionUserInfoDto.setSessionId(sessionId);
BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
return null;
}
return sessionUserInfo.getResult();
// GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
// getSessionUserInfoDto.setIsGetPaid(true);
// getSessionUserInfoDto.setSessionId(sessionId);
// BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
// if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
// return null;
// }
// return sessionUserInfo.getResult();
AssortmentCustomerInfoVo customerInfoVo = customerInfoManager.getCustomerInfoByObject(sessionId);
if(customerInfoVo == null) return null;
CustomerInfoVo customerInfoVo1 = new CustomerInfoVo();
BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return customerInfoVo1;
}
}
......@@ -54,6 +54,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.freemud.api.assortment.datamanager.entity.db.AssortmentOpenPlatformPartnerStoreDeliveryConfig;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformPartnerStoreDeliveryConfigManager;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
......@@ -2371,14 +2372,19 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
private CustomerInfoVo getCustomerInfoVo(String sessionId) {
GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
getSessionUserInfoDto.setIsGetPaid(true);
getSessionUserInfoDto.setSessionId(sessionId);
BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
throw new ServiceException(ResponseResult.NOT_LOGIN);
}
return sessionUserInfo.getResult();
// GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
// getSessionUserInfoDto.setIsGetPaid(true);
// getSessionUserInfoDto.setSessionId(sessionId);
// BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
// if (!ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null) {
// throw new ServiceException(ResponseResult.NOT_LOGIN);
// }
// return sessionUserInfo.getResult();
AssortmentCustomerInfoVo customerInfoVo = customerInfoManager.getCustomerInfoByObject(sessionId);
if(customerInfoVo == null) throw new ServiceException(ResponseResult.NOT_LOGIN);;
CustomerInfoVo customerInfoVo1 = new CustomerInfoVo();
BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return customerInfoVo1;
}
/**
......
......@@ -36,6 +36,8 @@ import cn.freemud.utils.ResponseUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
import com.freemud.application.sdk.api.base.SDKCommonBaseContextWare;
import com.freemud.application.sdk.api.log.ApiLog;
import com.freemud.application.sdk.api.log.ErrorLog;
......@@ -115,7 +117,9 @@ public class ShoppingCartMCoffeeServiceImpl {
private ProductClient productClient;
@Autowired
private ShoppingCartConvertAdapter shoppingCartConvertAdapter;
@Autowired
private AssortmentCustomerInfoManager customerInfoManager;
private static final String nullSeat = "508106";
@Value("${mccafe.universal.coupon.code}")
......@@ -1616,14 +1620,22 @@ public class ShoppingCartMCoffeeServiceImpl {
* @return
*/
private CustomerInfoVo getCustomerInfoVo(String sessionId) {
GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
getSessionUserInfoDto.setIsGetPaid(true);
getSessionUserInfoDto.setSessionId(sessionId);
BaseResponse<CustomerInfoVo> sessionUserInfo = customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
if (sessionUserInfo == null || !ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) || sessionUserInfo.getResult() == null || sessionUserInfo.getResult().getMemberId() == null) {
// GetSessionUserInfoDto getSessionUserInfoDto = new GetSessionUserInfoDto();
// getSessionUserInfoDto.setIsGetPaid(true);
// getSessionUserInfoDto.setSessionId(sessionId);
// BaseResponse<CustomerInfoVo> sessionUserInfo =
// customerApplicationClient.getSessionUserInfo(getSessionUserInfoDto);
// if (sessionUserInfo == null || !ResponseResult.SUCCESS.getCode().equals(sessionUserInfo.getCode()) ||
// sessionUserInfo.getResult() == null || sessionUserInfo.getResult().getMemberId() == null) {
// throw new ServiceException(ResponseResult.NOT_LOGIN);
// }
// return sessionUserInfo.getResult();
AssortmentCustomerInfoVo customerInfoVo = customerInfoManager.getCustomerInfoByObject(sessionId);
if (customerInfoVo == null)
throw new ServiceException(ResponseResult.NOT_LOGIN);
}
return sessionUserInfo.getResult();
CustomerInfoVo customerInfoVo1 = new CustomerInfoVo();
BeanUtil.convertBean(customerInfoVo, customerInfoVo1);
return customerInfoVo1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment