开通会员接口

This commit is contained in:
2024-08-14 09:46:28 +08:00
parent a9b32b4e57
commit 57472bdf00
6 changed files with 83 additions and 7 deletions

View File

@@ -201,11 +201,11 @@ public class LoginContoller {
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr); String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
try { try {
if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) { if (ObjectUtil.isNotEmpty(data) && JSONObject.parseObject(data).containsKey("phoneNumber")) {
if (!map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))) { // if (!map.containsKey("shopId") || ObjectUtil.isEmpty(map.get("shopId"))) {
return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber")); return Result.success(CodeEnum.SUCCESS, JSONObject.parseObject(data).get("phoneNumber"));
} // }
log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber")); // log.info("登录传参 获取手机号成功 sessionKey:{}\n encryptedData:{} \nivStr:{} \n data:{},",sessionKey,encryptedData,ivStr,JSONObject.parseObject(data).get("phoneNumber"));
return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString()); // return loginService.upPhone(openId,JSONObject.parseObject(data).get("phoneNumber").toString(),map.get("shopId").toString());
} }
} catch (Exception e){ } catch (Exception e){
// e.printStackTrace(); // e.printStackTrace();
@@ -277,6 +277,7 @@ public class LoginContoller {
String userId = TokenUtil.parseParamFromToken(token).getString("userId"); String userId = TokenUtil.parseParamFromToken(token).getString("userId");
userInfo.setId(Integer.valueOf(userId)); userInfo.setId(Integer.valueOf(userId));
userInfo.setUpdatedAt(System.currentTimeMillis()); userInfo.setUpdatedAt(System.currentTimeMillis());
// log.info("更新用户信息 param,{}",JSONObject.toJSONString(userInfo));
return loginService.upUserInfo(userInfo); return loginService.upUserInfo(userInfo);
} }

View File

@@ -12,6 +12,7 @@ import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo; import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo; import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo; import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo;
import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo;
import com.chaozhanggui.system.cashierservice.service.UserService; import com.chaozhanggui.system.cashierservice.service.UserService;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result; import com.chaozhanggui.system.cashierservice.sign.Result;
@@ -61,6 +62,12 @@ public class UserContoller {
// jsonObject.put("data",object); // jsonObject.put("data",object);
// return jsonObject; // return jsonObject;
// } // }
@PostMapping("/openMember")
public Result openMember(@RequestBody OpenMemberVo memberVo){
return userService.openMember(memberVo);
}
@GetMapping("/shopUserInfo") @GetMapping("/shopUserInfo")
public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception { public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
TbShopUser shopUser = new TbShopUser(); TbShopUser shopUser = new TbShopUser();

View File

@@ -63,7 +63,10 @@ public class TbShopUser implements Serializable {
private Long updatedAt; private Long updatedAt;
private String miniOpenId; private String miniOpenId;
private String shopName; private String shopName="";
private String lat="";
private String lng="";
private String address="";
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -307,4 +310,29 @@ public class TbShopUser implements Serializable {
public void setMiniOpenId(String miniOpenId) { public void setMiniOpenId(String miniOpenId) {
this.miniOpenId = miniOpenId == null ? null : miniOpenId.trim(); this.miniOpenId = miniOpenId == null ? null : miniOpenId.trim();
} }
public String getLat() {
return lat;
}
public void setLat(String lat) {
this.lat = lat;
}
public String getLng() {
return lng;
}
public void setLng(String lng) {
this.lng = lng;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
} }

View File

@@ -0,0 +1,15 @@
package com.chaozhanggui.system.cashierservice.entity.vo;
import lombok.Data;
@Data
public class OpenMemberVo {
private Integer id;
private Integer shopId;
private String headImg;
private String nickName;
private String telephone;
private String birthDay;
}

View File

@@ -146,7 +146,8 @@ public class DefaultExceptionAdvice {
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ExceptionHandler(MsgException.class) @ExceptionHandler(MsgException.class)
public ResponseEntity handleException(MsgException e) { public ResponseEntity handleException(MsgException e) {
LOGGER.error("业务异常", e); // LOGGER.error("业务异常", e);
LOGGER.error("业务异常", e.getMessage());
Result response = Result.fail(e.getMessage()); Result response = Result.fail(e.getMessage());
response.setMsg(e.getMessage()); response.setMsg(e.getMessage());
return new ResponseEntity<>(response, HttpStatus.OK); return new ResponseEntity<>(response, HttpStatus.OK);

View File

@@ -5,11 +5,17 @@ import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.hutool.extra.qrcode.QrConfig; import cn.hutool.extra.qrcode.QrConfig;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.chaozhanggui.system.cashierservice.dao.*; import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*; import com.chaozhanggui.system.cashierservice.entity.TbReleaseFlow;
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
import com.chaozhanggui.system.cashierservice.entity.TbShopUser;
import com.chaozhanggui.system.cashierservice.entity.TbUserInfo;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo; import com.chaozhanggui.system.cashierservice.entity.vo.IntegralFlowVo;
import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo; import com.chaozhanggui.system.cashierservice.entity.vo.IntegralVo;
import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo;
import com.chaozhanggui.system.cashierservice.exception.MsgException; import com.chaozhanggui.system.cashierservice.exception.MsgException;
import com.chaozhanggui.system.cashierservice.redis.RedisCst; import com.chaozhanggui.system.cashierservice.redis.RedisCst;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.chaozhanggui.system.cashierservice.util.*; import com.chaozhanggui.system.cashierservice.util.*;
import com.chaozhanggui.system.cashierservice.wxUtil.WxAccountUtil; import com.chaozhanggui.system.cashierservice.wxUtil.WxAccountUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@@ -263,4 +269,22 @@ public class UserService {
return fileService.uploadFileByInputStream("png", new ByteArrayInputStream(outputStream.toByteArray())); return fileService.uploadFileByInputStream("png", new ByteArrayInputStream(outputStream.toByteArray()));
} }
public Result openMember(OpenMemberVo memberVo) {
// TbUserInfo userInfo = new TbUserInfo();
// userInfo.setId(memberVo.getId());
// userInfo.setHeadImg(memberVo.getHeadImg());
// userInfo.setNickName(memberVo.getNickName());
// userInfo.setTelephone(memberVo.getTelephone());
// userInfo.setBirthDay(memberVo.getBirthDay());
// userInfoMapper.updateByPrimaryKeySelective(userInfo);
TbShopUser tbShopUser = shopUserMapper.selectByUserIdAndShopId(memberVo.getId().toString(), memberVo.getShopId().toString());
tbShopUser.setName(memberVo.getNickName());
tbShopUser.setHeadImg(memberVo.getHeadImg());
tbShopUser.setTelephone(memberVo.getTelephone());
tbShopUser.setBirthDay(memberVo.getBirthDay());
tbShopUser.setIsVip(Byte.parseByte("1"));
shopUserMapper.updateByPrimaryKey(tbShopUser);
return Result.success(CodeEnum.SUCCESS);
}
} }