| @@ -170,7 +170,7 @@ public class WxOrderController extends BaseController { | |||
| } | |||
| try { | |||
| WxCUser user = wxCUserService.getById(orderSaveDto.getUserId()); | |||
| WxCUserBasicInfo user = wxCUserBasicInfoService.getById(orderSaveDto.getUserId()); | |||
| if(null == user) { | |||
| logger.error("wxcuser未找到:"+orderSaveDto.getUserId()); | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | |||
| @@ -186,15 +186,8 @@ public class WxOrderController extends BaseController { | |||
| if (!wxOrderService.checkCouponIsFree(coupon)) { | |||
| return new ResultData(ErrorCode.COUPON_IS_NOT_FREE); | |||
| } | |||
| if(!user.isBasicInfo()) { | |||
| return new ResultData(ErrorCode.USER_IS_NOT_MEMBER); | |||
| } | |||
| WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(orderSaveDto.getUserId()); | |||
| if (null == basicInfo) { | |||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"会员用户未找到. "+orderSaveDto.getUserId()); | |||
| } | |||
| // 免费券 | |||
| order = wxOrderService.saveFreeOrderForCoupon(basicInfo, coupon, orderSaveDto.getCouponChannelId(), orderSaveDto.getFormId(), null); | |||
| order = wxOrderService.saveFreeOrderForCoupon(user, coupon, orderSaveDto.getCouponChannelId(), orderSaveDto.getFormId(), null); | |||
| return new ResultData(order); | |||
| } catch (MallinkException e) { | |||
| logger.error(e.getMessage()); | |||
| @@ -95,12 +95,13 @@ public class WxCUserController extends BaseController { | |||
| if (wxCUserFromB == null) { | |||
| //TODO phone可能为空 | |||
| String phone = wxCUser.getPhone(); | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.findInfoByPhone(bUser, phone); | |||
| //查询会员信息 | |||
| List<WxCUserBasicInfo> byPhone = wxCUserBasicInfoService.findByPhone(bUser, phone); | |||
| //List<WxCUserBasicInfo> byPhone = wxCUserBasicInfoService.findByPhone(bUser, phone); | |||
| //存在会员信息 | |||
| if (!byPhone.isEmpty()) { | |||
| if (wxCUserBasicInfo != null) { | |||
| //更新会员信息 | |||
| WxCUserBasicInfo wxCUserBasicInfo = byPhone.get(0); | |||
| if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) { | |||
| wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); | |||
| } | |||
| @@ -133,7 +134,7 @@ public class WxCUserController extends BaseController { | |||
| } else { | |||
| //新增来自B端的会员 | |||
| long cUserId = idWorker.nextId(); | |||
| WxCUserBasicInfo wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo = new WxCUserBasicInfo(); | |||
| wxCUserBasicInfo.setId(cUserId); | |||
| if (!StringUtils.isEmpty(wxCUserFromBDto.getName())) { | |||
| wxCUserBasicInfo.setName(wxCUserFromBDto.getName()); | |||
| @@ -67,25 +67,25 @@ public class WxMemController extends BaseController { | |||
| WxMerchantBUser bUser = getUser(); | |||
| WxCUser cUser = userService.getById(id); | |||
| if(cUser == null) { | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| } | |||
| // WxCUser cUser = userService.getById(id); | |||
| // if(cUser == null) { | |||
| // return new ResultData(ErrorCode.USER_IS_EMPTY); | |||
| // } | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(cUser.getId()); | |||
| WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(id); | |||
| if (null != wxCUserBasicInfo && EnumCreditLockedStatus.CLOSE.getCode().equals(wxCUserBasicInfo.getStatus())) { | |||
| return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | |||
| } | |||
| WxCUserVo userVo = new WxCUserVo(); | |||
| org.springframework.beans.BeanUtils.copyProperties(cUser, userVo); | |||
| if (wxCUserBasicInfo != null) { | |||
| userVo.setName(wxCUserBasicInfo.getName()); | |||
| userVo.setBirthdate(wxCUserBasicInfo.getBirthdate()); | |||
| userVo.setSex(wxCUserBasicInfo.getSex()); | |||
| userVo.setAddress(wxCUserBasicInfo.getAddress()); | |||
| } | |||
| org.springframework.beans.BeanUtils.copyProperties(wxCUserBasicInfo, userVo); | |||
| // if (wxCUserBasicInfo != null) { | |||
| // userVo.setName(wxCUserBasicInfo.getName()); | |||
| // userVo.setBirthdate(wxCUserBasicInfo.getBirthdate()); | |||
| // userVo.setSex(wxCUserBasicInfo.getSex()); | |||
| // userVo.setAddress(wxCUserBasicInfo.getAddress()); | |||
| // } | |||
| userVo.setLevelName(WxLevelConfigService.DEFAULT_LEVEL); | |||
| userVo.setDiscountRate(WxLevelConfigService.DEFAULT_MERCHANT_DISCOUNT); | |||
| @@ -311,7 +311,7 @@ public class WxMicroPayController extends BaseController { | |||
| } | |||
| // 获取C用户 | |||
| WxCUser cUser = null; | |||
| WxCUserBasicInfo cUser = null; | |||
| if (StringUtils.isNotBlank(cUserIdStr)) { | |||
| Long cUserId = 0L; | |||
| try { | |||
| @@ -321,12 +321,9 @@ public class WxMicroPayController extends BaseController { | |||
| logger.error("cUserId参数不正确: " + paramMap.toString()); | |||
| return new ResultData(ErrorCode.SYS_CLASSCAST_ERROR); | |||
| } | |||
| cUser = wxCUserService.getById(cUserId); | |||
| cUser = wxCUserBasicInfoService.getById(cUserId); | |||
| } else { | |||
| WxCUser userQ = new WxCUser(); | |||
| userQ.updateTenantInfo(user); | |||
| userQ.setPhone(phone); | |||
| cUser = wxCUserService.getByObject(userQ); | |||
| cUser = wxCUserBasicInfoService.findInfoByPhone(user,phone); | |||
| } | |||
| if (cUser == null) { | |||
| logger.error("cUser不存在: " + cUserIdStr); | |||
| @@ -342,15 +339,8 @@ public class WxMicroPayController extends BaseController { | |||
| WxOrder order = null; | |||
| try { | |||
| if (!cUser.isBasicInfo()) { | |||
| return new ResultData(ErrorCode.USER_IS_NOT_MEMBER); | |||
| } | |||
| WxCUserBasicInfo basicInfo = wxCUserBasicInfoService.getById(cUser.getUserId()); | |||
| if ( null == basicInfo) { | |||
| logger.error("会员用户未找到."+cUser.getUserId()); | |||
| return new ResultData(ErrorCode.USER_IS_EMPTY.getCode(),"会员用户未找到."+cUser.getUserId()); | |||
| } | |||
| order = wxOrderService.saveMicroPayOrderV2(user, basicInfo, payment); | |||
| order = wxOrderService.saveMicroPayOrderV2(user, cUser, payment); | |||
| } catch (MallinkException e) { | |||
| logger.error("saveMicopayOrder 1" + e.getMessage()); | |||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||
| @@ -55,6 +55,9 @@ public class WxCarCYFCallBackController extends BaseController { | |||
| @Autowired | |||
| WxCarPayRecordService wxCarPayRecordService; | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| /** | |||
| * @description 车易付 车辆入场通知 | |||
| * @Params [paramMap] | |||
| @@ -114,7 +117,7 @@ public class WxCarCYFCallBackController extends BaseController { | |||
| for (WxCUserCar userCar : userCarList) { | |||
| userCar.setParentTenantId(park.getParentTenantId()); | |||
| wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.CAR_STOP, userCar); | |||
| WxCUser cUser = wxCUserService.getById(userCar.getCUserId()); | |||
| WxCUserBasicInfo cUser = wxCUserBasicInfoService.getById(userCar.getCUserId()); | |||
| if(cUser != null){ | |||
| if(bFirst) { | |||
| phoneStrs = cUser.getPhone(); | |||
| @@ -56,6 +56,9 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| @Autowired | |||
| WxCUserService wxCUserService; | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| /** | |||
| @@ -359,7 +362,7 @@ public class WxCarETCPCallBackController extends BaseController { | |||
| for (WxCUserCar userCar : userCarList) { | |||
| userCar.setParentTenantId(park.getParentTenantId()); | |||
| wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.CAR_STOP, userCar); | |||
| WxCUser cUser = wxCUserService.getById(userCar.getCUserId()); | |||
| WxCUserBasicInfo cUser = wxCUserBasicInfoService.getById(userCar.getCUserId()); | |||
| if(cUser != null){ | |||
| if(bFirst) { | |||
| phoneStrs = cUser.getPhone(); | |||
| @@ -51,6 +51,9 @@ public class WxCarTJDCallBackController extends BaseController { | |||
| @Autowired | |||
| WxCUserService wxCUserService; | |||
| @Autowired | |||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||
| /** | |||
| * 注册车牌 | |||
| * @param paramMap | |||
| @@ -166,7 +169,7 @@ public class WxCarTJDCallBackController extends BaseController { | |||
| for (WxCUserCar userCar : userCarList) { | |||
| userCar.setParentTenantId(park.getParentTenantId()); | |||
| wxCouponSendService.sendCouponToUser(EnumCouponSendSendType.CAR_STOP, userCar); | |||
| WxCUser cUser = wxCUserService.getById(userCar.getCUserId()); | |||
| WxCUserBasicInfo cUser = wxCUserBasicInfoService.getById(userCar.getCUserId()); | |||
| if(cUser != null){ | |||
| if(bFirst) { | |||
| phoneStrs = cUser.getPhone(); | |||
| @@ -41,7 +41,7 @@ public class PosServiceImpl implements PosService { | |||
| private final WxMallService mallService; | |||
| private final PosMallConfigService posMallConfigService; | |||
| private final WxCUserService cUserService; | |||
| private final WxCUserBasicInfoService cUserBasicInfoService; | |||
| private final WxLevelConfigService levelConfigService; | |||
| private final WxCouponOrderService couponOrderService; | |||
| private final WxMerchantService merchantService; | |||
| @@ -286,7 +286,7 @@ public class PosServiceImpl implements PosService { | |||
| dataMap.put(WxPayConstant.ORDER_AMOUNT_LEFT, orderAmountLeftStr); | |||
| } | |||
| WxCUser user = null; | |||
| WxCUserBasicInfo user = null; | |||
| if (StringUtils.isNotBlank(cardIdStr)) { | |||
| Long cardId; | |||
| try { | |||
| @@ -299,7 +299,7 @@ public class PosServiceImpl implements PosService { | |||
| if (couponOrder == null) { | |||
| throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); | |||
| } | |||
| user = cUserService.getById(couponOrder.getOwnerId()); | |||
| user = cUserBasicInfoService.getById(couponOrder.getOwnerId()); | |||
| } else { | |||
| if (StringUtils.isBlank(memIdStr) && StringUtils.isBlank(memPhoneStr)) { | |||
| errParam2(WxPayConstant.MEM_ID, WxPayConstant.MEM_PHONE); | |||
| @@ -687,8 +687,8 @@ public class PosServiceImpl implements PosService { | |||
| 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)) { | |||
| Long memId; | |||
| try { | |||
| @@ -697,14 +697,10 @@ public class PosServiceImpl implements PosService { | |||
| logger.error(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)) { | |||
| WxCUser q = new WxCUser(); | |||
| q.updateTenantInfo(tenantEntity); | |||
| q.setPhone(memPhoneStr); | |||
| user = cUserService.getByObject(q); | |||
| user = cUserBasicInfoService.findInfoByPhone(tenantEntity,memPhoneStr); | |||
| } | |||
| return user; | |||
| } | |||
| @@ -718,7 +714,8 @@ public class PosServiceImpl implements PosService { | |||
| * @param merchantId | |||
| * @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(); | |||
| Integer discount = 100; | |||
| if (discountConfig.equals(EnumPosEnableType.Enable.getCode())) { | |||
| @@ -727,7 +724,7 @@ public class PosServiceImpl implements PosService { | |||
| List<WxLevelConfig> levelList = levelConfigService.getByTenantId(tenantEntity.getTenantId()); | |||
| Long levelId = 0L; | |||
| for (WxLevelConfig levelConfig : levelList) { | |||
| if (user.getScore() >= levelConfig.getPoints()) { | |||
| if (user.getPoins() >= levelConfig.getPoints()) { | |||
| if (levelConfig.getDiscountEnable().equals(EnumLevelConfigDiscountStatus.ENABLE.getCode())) | |||
| levelId = levelConfig.getId(); | |||
| level = levelConfig.getLevel(); | |||
| @@ -912,7 +909,7 @@ public class PosServiceImpl implements PosService { | |||
| errParam2(WxPayConstant.MEM_ID, WxPayConstant.MEM_PHONE); | |||
| } | |||
| // 10. 获取会员信息 | |||
| WxCUser user = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| WxCUserBasicInfo user = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| if (user == null) { | |||
| logger.error(ErrorCode.USER_NOT_MEMBER.getMessage()); | |||
| 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); | |||
| } | |||
| // 10. 获取会员信息 | |||
| WxCUser user = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| WxCUserBasicInfo user = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| if (user == null) { | |||
| logger.error(ErrorCode.USER_NOT_MEMBER.getMessage()); | |||
| throw new MallinkException(ErrorCode.USER_NOT_MEMBER); | |||
| @@ -1600,7 +1597,7 @@ public class PosServiceImpl implements PosService { | |||
| throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); | |||
| } | |||
| if (StringUtils.isNotBlank(memIdStr) || StringUtils.isNotBlank(memPhoneStr)) { | |||
| WxCUser cuUser = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| WxCUserBasicInfo cuUser = getMemUser(merchant, memIdStr, memPhoneStr); | |||
| if (cuUser == null) { | |||
| logger.error(ErrorCode.USER_NOT_MEMBER.getMessage()); | |||
| throw new MallinkException(ErrorCode.USER_NOT_MEMBER); | |||