Commit 5318ced4 by ping.wu

Merge branches 'featur/20210609-会员信息-zy' and 'master' of…

Merge branches 'featur/20210609-会员信息-zy' and 'master' of http://gitlab.freemud.com/order-group-application/order-group

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
parents cc944ee2 c3c52a50
......@@ -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.15-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,13 @@ 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.alibaba.fastjson.JSON;
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 +103,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 +115,19 @@ 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);;
String jsonObject = JSON.toJSONString(customerInfoVo);
CustomerInfoVo customerInfoVo1 = JSON.parseObject(jsonObject,CustomerInfoVo.class);
// BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return customerInfoVo1;
}
public UserLoginInfoDto convert2UserLoginInfoDto(CustomerInfoVo assortmentCustomerInfoVo) {
......
......@@ -14,6 +14,9 @@ import cn.freemud.service.thirdparty.CustomerApplicationClient;
import cn.freemud.utils.BeanUtil;
import cn.freemud.utils.LogUtil;
import cn.freemud.utils.ResponseUtil;
import com.alibaba.fastjson.JSON;
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 +32,8 @@ public class OpenStoreIappWxappConfigServiceImpl implements OpenStoreIappWxappCo
@Autowired
private CustomerApplicationClient customerApplicationClient;
@Autowired
private AssortmentCustomerInfoManager customerInfoManager;
public BaseResponse getOpenStoreIappWxappConfig(OpenStoreIappWxappConfigRequestVo openStoreIappWxappConfigRequestVo){
// 获取用户信息
......@@ -56,13 +61,19 @@ 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);
String jsonObject = JSON.toJSONString(customerInfoVo);
CustomerInfoVo customerInfoVo1 = JSON.parseObject(jsonObject,CustomerInfoVo.class);
// 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,20 @@ 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);;
String jsonObject = JSON.toJSONString(customerInfoVo);
CustomerInfoVo customerInfoVo1 = JSON.parseObject(jsonObject,CustomerInfoVo.class);
// BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return customerInfoVo1;
}
private List<CalculationSharingDiscountRequestDto.CalculationDiscountCoupon> buildCoupons(List<CalculationSharingDiscountRequestDto.CalculationDiscountCoupon> oldCoupons, List<ShoppingCartInfoRequestVo.couponCode> coupons){
......
......@@ -21,10 +21,8 @@ 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.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo;
......@@ -702,14 +700,20 @@ 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;
String jsonObject = JSON.toJSONString(customerInfoVo);
CustomerInfoVo customerInfoVo1 = JSON.parseObject(jsonObject,CustomerInfoVo.class);
// 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;
......@@ -2372,14 +2373,20 @@ 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);;
String jsonObject = JSON.toJSONString(customerInfoVo);
CustomerInfoVo customerInfoVo1 = JSON.parseObject(jsonObject,CustomerInfoVo.class);
// BeanUtil.convertBean(customerInfoVo,customerInfoVo1);
return customerInfoVo1;
}
/**
......
......@@ -37,6 +37,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;
......@@ -119,6 +121,9 @@ public class ShoppingCartMCoffeeServiceImpl {
@Autowired
private BuySendCalculation buySendCalculation;
@Autowired
private AssortmentCustomerInfoManager customerInfoManager;
private static final String nullSeat = "508106";
@Value("${mccafe.universal.coupon.code}")
......@@ -1877,14 +1882,23 @@ 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();
String jsonObject = JSON.toJSONString(customerInfoVo);
CustomerInfoVo customerInfoVo1 = JSON.parseObject(jsonObject,CustomerInfoVo.class);
// 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