Przeglądaj źródła

pos

release_toaliyun_real
xhxu 5 lat temu
rodzic
commit
c76e9a6b0f
1 zmienionych plików z 13 dodań i 16 usunięć
  1. +13
    -16
      mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java

+ 13
- 16
mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java Wyświetl plik

@@ -41,7 +41,7 @@ public class PosServiceImpl implements PosService {


private final WxMallService mallService; private final WxMallService mallService;
private final PosMallConfigService posMallConfigService; private final PosMallConfigService posMallConfigService;
private final WxCUserService cUserService;
private final WxCUserBasicInfoService cUserBasicInfoService;
private final WxLevelConfigService levelConfigService; private final WxLevelConfigService levelConfigService;
private final WxCouponOrderService couponOrderService; private final WxCouponOrderService couponOrderService;
private final WxMerchantService merchantService; private final WxMerchantService merchantService;
@@ -286,7 +286,7 @@ public class PosServiceImpl implements PosService {
dataMap.put(WxPayConstant.ORDER_AMOUNT_LEFT, orderAmountLeftStr); dataMap.put(WxPayConstant.ORDER_AMOUNT_LEFT, orderAmountLeftStr);
} }


WxCUser user = null;
WxCUserBasicInfo user = null;
if (StringUtils.isNotBlank(cardIdStr)) { if (StringUtils.isNotBlank(cardIdStr)) {
Long cardId; Long cardId;
try { try {
@@ -299,7 +299,7 @@ public class PosServiceImpl implements PosService {
if (couponOrder == null) { if (couponOrder == null) {
throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND);
} }
user = cUserService.getById(couponOrder.getOwnerId());
user = cUserBasicInfoService.getById(couponOrder.getOwnerId());
} else { } else {
if (StringUtils.isBlank(memIdStr) && StringUtils.isBlank(memPhoneStr)) { if (StringUtils.isBlank(memIdStr) && StringUtils.isBlank(memPhoneStr)) {
errParam2(WxPayConstant.MEM_ID, WxPayConstant.MEM_PHONE); errParam2(WxPayConstant.MEM_ID, WxPayConstant.MEM_PHONE);
@@ -687,8 +687,8 @@ public class PosServiceImpl implements PosService {
return couponOrderCVo; return couponOrderCVo;
} }


private WxCUser getMemUser(TenantEntity tenantEntity, String memIdStr, String memPhoneStr) {
WxCUser user = null;
private WxCUserBasicInfo getMemUser(TenantEntity tenantEntity, String memIdStr, String memPhoneStr) {
WxCUserBasicInfo user = null;
if (StringUtils.isNotBlank(memIdStr)) { if (StringUtils.isNotBlank(memIdStr)) {
Long memId; Long memId;
try { try {
@@ -697,14 +697,10 @@ public class PosServiceImpl implements PosService {
logger.error(e.getMessage()); logger.error(e.getMessage());
throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage());
} }

user = cUserService.getById(memId);
user = cUserBasicInfoService.getById(memId);
} }
if (StringUtils.isNotBlank(memPhoneStr)) { if (StringUtils.isNotBlank(memPhoneStr)) {
WxCUser q = new WxCUser();
q.updateTenantInfo(tenantEntity);
q.setPhone(memPhoneStr);
user = cUserService.getByObject(q);
user = cUserBasicInfoService.findInfoByPhone(tenantEntity,memPhoneStr);
} }
return user; return user;
} }
@@ -718,7 +714,8 @@ public class PosServiceImpl implements PosService {
* @param merchantId * @param merchantId
* @return * @return
*/ */
private JSONObject getMemLevelDiscount(PromotionCalc promotionCalc, Integer discountConfig, TenantEntity tenantEntity, WxCUser user, Long merchantId) {
private JSONObject getMemLevelDiscount(PromotionCalc promotionCalc, Integer discountConfig,
TenantEntity tenantEntity, WxCUserBasicInfo user, Long merchantId) {
JSONObject discountObj = new JSONObject(); JSONObject discountObj = new JSONObject();
Integer discount = 100; Integer discount = 100;
if (discountConfig.equals(EnumPosEnableType.Enable.getCode())) { if (discountConfig.equals(EnumPosEnableType.Enable.getCode())) {
@@ -727,7 +724,7 @@ public class PosServiceImpl implements PosService {
List<WxLevelConfig> levelList = levelConfigService.getByTenantId(tenantEntity.getTenantId()); List<WxLevelConfig> levelList = levelConfigService.getByTenantId(tenantEntity.getTenantId());
Long levelId = 0L; Long levelId = 0L;
for (WxLevelConfig levelConfig : levelList) { for (WxLevelConfig levelConfig : levelList) {
if (user.getScore() >= levelConfig.getPoints()) {
if (user.getPoins() >= levelConfig.getPoints()) {
if (levelConfig.getDiscountEnable().equals(EnumLevelConfigDiscountStatus.ENABLE.getCode())) if (levelConfig.getDiscountEnable().equals(EnumLevelConfigDiscountStatus.ENABLE.getCode()))
levelId = levelConfig.getId(); levelId = levelConfig.getId();
level = levelConfig.getLevel(); level = levelConfig.getLevel();
@@ -912,7 +909,7 @@ public class PosServiceImpl implements PosService {
errParam2(WxPayConstant.MEM_ID, WxPayConstant.MEM_PHONE); errParam2(WxPayConstant.MEM_ID, WxPayConstant.MEM_PHONE);
} }
// 10. 获取会员信息 // 10. 获取会员信息
WxCUser user = getMemUser(merchant, memIdStr, memPhoneStr);
WxCUserBasicInfo user = getMemUser(merchant, memIdStr, memPhoneStr);
if (user == null) { if (user == null) {
logger.error(ErrorCode.USER_NOT_MEMBER.getMessage()); logger.error(ErrorCode.USER_NOT_MEMBER.getMessage());
throw new MallinkException(ErrorCode.USER_NOT_MEMBER); throw new MallinkException(ErrorCode.USER_NOT_MEMBER);
@@ -1179,7 +1176,7 @@ public class PosServiceImpl implements PosService {
throw new MallinkException(ErrorCode.POS_COUPON_REFUND_ERROR.getCode(), errMesg); throw new MallinkException(ErrorCode.POS_COUPON_REFUND_ERROR.getCode(), errMesg);
} }
// 10. 获取会员信息 // 10. 获取会员信息
WxCUser user = getMemUser(merchant, memIdStr, memPhoneStr);
WxCUserBasicInfo user = getMemUser(merchant, memIdStr, memPhoneStr);
if (user == null) { if (user == null) {
logger.error(ErrorCode.USER_NOT_MEMBER.getMessage()); logger.error(ErrorCode.USER_NOT_MEMBER.getMessage());
throw new MallinkException(ErrorCode.USER_NOT_MEMBER); throw new MallinkException(ErrorCode.USER_NOT_MEMBER);
@@ -1600,7 +1597,7 @@ public class PosServiceImpl implements PosService {
throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND);
} }
if (StringUtils.isNotBlank(memIdStr) || StringUtils.isNotBlank(memPhoneStr)) { if (StringUtils.isNotBlank(memIdStr) || StringUtils.isNotBlank(memPhoneStr)) {
WxCUser cuUser = getMemUser(merchant, memIdStr, memPhoneStr);
WxCUserBasicInfo cuUser = getMemUser(merchant, memIdStr, memPhoneStr);
if (cuUser == null) { if (cuUser == null) {
logger.error(ErrorCode.USER_NOT_MEMBER.getMessage()); logger.error(ErrorCode.USER_NOT_MEMBER.getMessage());
throw new MallinkException(ErrorCode.USER_NOT_MEMBER); throw new MallinkException(ErrorCode.USER_NOT_MEMBER);


Ładowanie…
Anuluj
Zapisz