开通会员接口
This commit is contained in:
@@ -201,11 +201,11 @@ public class LoginContoller {
|
||||
String data = WxMaCryptUtils.decrypt(sessionKey, encryptedData, ivStr);
|
||||
try {
|
||||
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"));
|
||||
}
|
||||
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());
|
||||
// }
|
||||
// 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());
|
||||
}
|
||||
} catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
@@ -277,6 +277,7 @@ public class LoginContoller {
|
||||
String userId = TokenUtil.parseParamFromToken(token).getString("userId");
|
||||
userInfo.setId(Integer.valueOf(userId));
|
||||
userInfo.setUpdatedAt(System.currentTimeMillis());
|
||||
// log.info("更新用户信息 param,{}",JSONObject.toJSONString(userInfo));
|
||||
return loginService.upUserInfo(userInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ 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.IntegralVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo;
|
||||
import com.chaozhanggui.system.cashierservice.service.UserService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
||||
@@ -61,6 +62,12 @@ public class UserContoller {
|
||||
// jsonObject.put("data",object);
|
||||
// return jsonObject;
|
||||
// }
|
||||
|
||||
@PostMapping("/openMember")
|
||||
public Result openMember(@RequestBody OpenMemberVo memberVo){
|
||||
return userService.openMember(memberVo);
|
||||
}
|
||||
|
||||
@GetMapping("/shopUserInfo")
|
||||
public Result shopUserInfo(@RequestParam("userId") String userId, @RequestHeader("openId") String openId, @RequestParam("shopId") String shopId) throws Exception {
|
||||
TbShopUser shopUser = new TbShopUser();
|
||||
|
||||
@@ -63,7 +63,10 @@ public class TbShopUser implements Serializable {
|
||||
private Long updatedAt;
|
||||
|
||||
private String miniOpenId;
|
||||
private String shopName;
|
||||
private String shopName="";
|
||||
private String lat="";
|
||||
private String lng="";
|
||||
private String address="";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -307,4 +310,29 @@ public class TbShopUser implements Serializable {
|
||||
public void setMiniOpenId(String miniOpenId) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -146,7 +146,8 @@ public class DefaultExceptionAdvice {
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(MsgException.class)
|
||||
public ResponseEntity handleException(MsgException e) {
|
||||
LOGGER.error("业务异常", e);
|
||||
// LOGGER.error("业务异常", e);
|
||||
LOGGER.error("业务异常", e.getMessage());
|
||||
Result response = Result.fail(e.getMessage());
|
||||
response.setMsg(e.getMessage());
|
||||
return new ResponseEntity<>(response, HttpStatus.OK);
|
||||
|
||||
@@ -5,11 +5,17 @@ import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.IntegralVo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.OpenMemberVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
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.wxUtil.WxAccountUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@@ -263,4 +269,22 @@ public class UserService {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user