|
@@ -2,7 +2,6 @@ package com.fuint.module.clientApi.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.fuint.common.dto.AssetDto;
|
|
import com.fuint.common.dto.AssetDto;
|
|
-import com.fuint.common.dto.OpenWxCardDto;
|
|
|
|
import com.fuint.common.dto.UserDto;
|
|
import com.fuint.common.dto.UserDto;
|
|
import com.fuint.common.dto.UserInfo;
|
|
import com.fuint.common.dto.UserInfo;
|
|
import com.fuint.common.enums.*;
|
|
import com.fuint.common.enums.*;
|
|
@@ -12,8 +11,6 @@ import com.fuint.framework.exception.BusinessCheckException;
|
|
import com.fuint.framework.web.BaseController;
|
|
import com.fuint.framework.web.BaseController;
|
|
import com.fuint.framework.web.ResponseObject;
|
|
import com.fuint.framework.web.ResponseObject;
|
|
import com.fuint.repository.model.*;
|
|
import com.fuint.repository.model.*;
|
|
-import com.fuint.utils.Digests;
|
|
|
|
-import com.fuint.utils.Encodes;
|
|
|
|
import com.fuint.utils.StringUtil;
|
|
import com.fuint.utils.StringUtil;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -146,36 +143,25 @@ public class ClientUserController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- outParams.put("isMerchant", isMerchant);
|
|
|
|
|
|
|
|
// 是否开通微信会员卡
|
|
// 是否开通微信会员卡
|
|
|
|
+ boolean openWxCard = false;
|
|
if (mtUser != null && StringUtil.isNotEmpty(mtUser.getOpenId())) {
|
|
if (mtUser != null && StringUtil.isNotEmpty(mtUser.getOpenId())) {
|
|
MtSetting cardSetting = settingService.querySettingByName(mtUser.getMerchantId(), UserSettingEnum.OPEN_WX_CARD.getKey());
|
|
MtSetting cardSetting = settingService.querySettingByName(mtUser.getMerchantId(), UserSettingEnum.OPEN_WX_CARD.getKey());
|
|
if (cardSetting != null && cardSetting.getValue().equals(YesOrNoEnum.TRUE.getKey())) {
|
|
if (cardSetting != null && cardSetting.getValue().equals(YesOrNoEnum.TRUE.getKey())) {
|
|
MtSetting cardIdSetting = settingService.querySettingByName(mtUser.getMerchantId(), UserSettingEnum.WX_MEMBER_CARD_ID.getKey());
|
|
MtSetting cardIdSetting = settingService.querySettingByName(mtUser.getMerchantId(), UserSettingEnum.WX_MEMBER_CARD_ID.getKey());
|
|
if (cardIdSetting != null) {
|
|
if (cardIdSetting != null) {
|
|
- String apiTicket = weixinService.getApiTicket(mtUser.getMerchantId());
|
|
|
|
- if (StringUtil.isNotEmpty(apiTicket)) {
|
|
|
|
- String cardId = cardIdSetting.getValue();
|
|
|
|
- String openId = mtUser.getOpenId();
|
|
|
|
- String code = mtUser.getUserNo();
|
|
|
|
- String timestamp = (System.currentTimeMillis()/1000) + "";
|
|
|
|
- String nonceStr = "WeApp";
|
|
|
|
- String str = nonceStr + timestamp + apiTicket + cardId;
|
|
|
|
- byte[] signatureByte = Digests.sha1(str.getBytes());
|
|
|
|
- String signature = Encodes.encodeHex(signatureByte);
|
|
|
|
- OpenWxCardDto openWxCardDto = new OpenWxCardDto();
|
|
|
|
- openWxCardDto.setCode(code);
|
|
|
|
- openWxCardDto.setOpenId(openId);
|
|
|
|
- openWxCardDto.setTimestamp(timestamp);
|
|
|
|
- openWxCardDto.setSignature(signature);
|
|
|
|
- openWxCardDto.setCardId(cardId);
|
|
|
|
- openWxCardDto.setNonceStr(nonceStr);
|
|
|
|
- outParams.put("openCardPara", openWxCardDto);
|
|
|
|
|
|
+ boolean isOpen = weixinService.isOpenCard(mtUser.getMerchantId(), cardIdSetting.getValue(), mtUser.getOpenId());
|
|
|
|
+ if (!isOpen) {
|
|
|
|
+ openWxCard = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ outParams.put("isMerchant", isMerchant);
|
|
|
|
+ outParams.put("openWxCard", openWxCard);
|
|
|
|
+
|
|
return getSuccessResult(outParams);
|
|
return getSuccessResult(outParams);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -364,9 +350,17 @@ public class ClientUserController extends BaseController {
|
|
logger.error(e.getMessage(), e);
|
|
logger.error(e.getMessage(), e);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 微信会员卡领取二维码
|
|
|
|
+ String wxCardQrCode = "";
|
|
|
|
+ MtSetting cardIdSetting = settingService.querySettingByName(mtUser.getMerchantId(), UserSettingEnum.WX_MEMBER_CARD_ID.getKey());
|
|
|
|
+ if (cardIdSetting != null) {
|
|
|
|
+ wxCardQrCode = weixinService.createCardQrCode(mtUser.getMerchantId(), cardIdSetting.getValue(), mtUser.getUserNo());
|
|
|
|
+ }
|
|
|
|
+
|
|
Map<String, Object> outParams = new HashMap<>();
|
|
Map<String, Object> outParams = new HashMap<>();
|
|
outParams.put("qrCode", qrCode);
|
|
outParams.put("qrCode", qrCode);
|
|
outParams.put("userInfo", mtUser);
|
|
outParams.put("userInfo", mtUser);
|
|
|
|
+ outParams.put("wxCardQrCode", wxCardQrCode);
|
|
|
|
|
|
return getSuccessResult(outParams);
|
|
return getSuccessResult(outParams);
|
|
}
|
|
}
|