|
|
|
@ -2,6 +2,7 @@ package com.cweb.controller; |
|
|
|
|
|
|
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
|
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; |
|
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.alipay.api.request.AlipaySystemOauthTokenRequest; |
|
|
|
|
import com.alipay.api.response.AlipaySystemOauthTokenResponse; |
|
|
|
@ -15,13 +16,17 @@ import com.hfkj.common.utils.HttpsUtils; |
|
|
|
|
import com.hfkj.common.utils.MemberValidateUtil; |
|
|
|
|
import com.hfkj.common.utils.RedisUtil; |
|
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hfkj.config.CommonSysConst; |
|
|
|
|
import com.hfkj.config.WxMaConfiguration; |
|
|
|
|
import com.hfkj.entity.BsAgentApiParam; |
|
|
|
|
import com.hfkj.entity.BsDiscountUser; |
|
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
|
|
import com.hfkj.service.agent.BsAgentApiParamService; |
|
|
|
|
import com.hfkj.service.discount.BsDiscountUserService; |
|
|
|
|
import com.hfkj.service.user.BsUserService; |
|
|
|
|
import com.hfkj.sysenum.discount.DiscountUserStatusEnum; |
|
|
|
|
import com.hfkj.sysenum.user.UserLoginPlatform; |
|
|
|
|
import com.hfkj.sysenum.user.UserLoginType; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
@ -55,6 +60,8 @@ public class BsUserController { |
|
|
|
|
@Resource |
|
|
|
|
private BsAgentApiParamService agentApiParamService; |
|
|
|
|
@Resource |
|
|
|
|
private BsDiscountUserService discountUserService; |
|
|
|
|
@Resource |
|
|
|
|
private BsUserService userService; |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/autoLogin", method = RequestMethod.POST) |
|
|
|
@ -218,11 +225,33 @@ public class BsUserController { |
|
|
|
|
@ApiOperation(value = "查询用户信息") |
|
|
|
|
public ResponseData queryUser() { |
|
|
|
|
try { |
|
|
|
|
UserSessionObject userSessionObject = userCenter.getSessionModel(UserSessionObject.class); |
|
|
|
|
JSONObject data = JSONObject.parseObject(JSONObject.toJSONString(userSessionObject), JSONObject.class); |
|
|
|
|
|
|
|
|
|
int totalDiscountCoupon = 0; |
|
|
|
|
// 加油优惠券数量
|
|
|
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
|
|
param.put("userId", userSessionObject.getUser().getId()); |
|
|
|
|
param.put("status", DiscountUserStatusEnum.type1.getCode()); |
|
|
|
|
totalDiscountCoupon += discountUserService.getUserDiscountList(param).size(); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(userCenter.getSessionModel(UserSessionObject.class)); |
|
|
|
|
// 非油优惠券数量
|
|
|
|
|
try { |
|
|
|
|
param.clear(); |
|
|
|
|
param.put("appid", CommonSysConst.getSysConfig().getPhgAppid()); |
|
|
|
|
param.put("phone", userSessionObject.getUser().getPhone()); |
|
|
|
|
param.put("status", 1); // 状态 0:已过期 1:未使用 2:已使用
|
|
|
|
|
param.put("sign", SignatureUtil.createSign(param, CommonSysConst.getSysConfig().getPhgAppSecret())); |
|
|
|
|
JSONObject response = HttpsUtils.doPost(CommonSysConst.getSysConfig().getPhgReqUrl()+"/crest/output/getListUserDiscount", JSONObject.toJSONString(param)); |
|
|
|
|
if (response.getString("return_code").equals("000000")) { |
|
|
|
|
totalDiscountCoupon += response.getJSONArray("return_data").size(); |
|
|
|
|
}; |
|
|
|
|
} catch (Exception e) {} |
|
|
|
|
data.put("couponNum", totalDiscountCoupon); |
|
|
|
|
return ResponseMsgUtil.success(data); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("LoginController --> wechatMaPhone() error!", e); |
|
|
|
|
log.error("LoginController --> queryUser() error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|