2023-03-04 16:29:55 +08:00
|
|
|
|
package com.jsowell.api.uniapp;
|
|
|
|
|
|
|
2023-07-24 15:32:19 +08:00
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
2023-03-04 16:29:55 +08:00
|
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
|
import com.jsowell.common.annotation.Anonymous;
|
|
|
|
|
|
import com.jsowell.common.core.controller.BaseController;
|
|
|
|
|
|
import com.jsowell.common.core.page.PageResponse;
|
|
|
|
|
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
|
|
|
|
|
import com.jsowell.common.exception.BusinessException;
|
|
|
|
|
|
import com.jsowell.common.exception.ServiceException;
|
|
|
|
|
|
import com.jsowell.common.response.RestApiResponse;
|
|
|
|
|
|
import com.jsowell.common.util.SMSUtil;
|
|
|
|
|
|
import com.jsowell.common.util.StringUtils;
|
2023-03-07 11:12:01 +08:00
|
|
|
|
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
2023-07-04 14:16:50 +08:00
|
|
|
|
import com.jsowell.pile.dto.*;
|
2024-01-06 15:20:28 +08:00
|
|
|
|
import com.jsowell.pile.service.MemberBasicInfoService;
|
|
|
|
|
|
import com.jsowell.pile.service.MemberPlateNumberRelationService;
|
|
|
|
|
|
import com.jsowell.pile.service.PileMerchantInfoService;
|
2023-11-21 15:10:54 +08:00
|
|
|
|
import com.jsowell.pile.vo.base.MemberWalletVO;
|
2023-04-13 15:31:04 +08:00
|
|
|
|
import com.jsowell.pile.vo.uniapp.InvoiceTitleVO;
|
2023-03-04 16:29:55 +08:00
|
|
|
|
import com.jsowell.pile.vo.uniapp.MemberVO;
|
2023-07-24 15:32:19 +08:00
|
|
|
|
import com.jsowell.pile.vo.uniapp.MemberWalletInfoVO;
|
2023-03-04 16:29:55 +08:00
|
|
|
|
import com.jsowell.service.MemberService;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
2023-07-04 14:16:50 +08:00
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
2023-03-04 16:29:55 +08:00
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
2023-03-06 15:17:04 +08:00
|
|
|
|
import java.util.List;
|
2023-03-04 16:29:55 +08:00
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 小程序接口
|
|
|
|
|
|
*/
|
|
|
|
|
|
// 不登录直接访问
|
|
|
|
|
|
@Anonymous
|
|
|
|
|
|
@RestController
|
|
|
|
|
|
@RequestMapping("/uniapp/member")
|
|
|
|
|
|
public class MemberController extends BaseController {
|
|
|
|
|
|
|
2024-03-18 14:01:57 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private MemberService memberService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private MemberBasicInfoService memberBasicInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private PileMerchantInfoService pileMerchantInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private MemberPlateNumberRelationService memberPlateNumberRelationService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 下发短信接口 business
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/sendSMS
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/sendSMS")
|
|
|
|
|
|
public RestApiResponse<?> sendSMS(HttpServletRequest request, @RequestBody MemberRegisterAndLoginDTO dto) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
// logger.info("下发短信接口 param:{}", JSON.toJSONString(dto));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (StringUtils.isBlank(dto.getMobileNumber())) {
|
|
|
|
|
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
String sendSMSResult = SMSUtil.sendSMS(request, dto.getMobileNumber());
|
|
|
|
|
|
response = new RestApiResponse<>(sendSMSResult);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("下发短信接口 发生异常 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_SEND_SMS_ERROR);
|
|
|
|
|
|
}
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("下发短信接口, param:{}, result:{}", JSON.toJSONString(dto), JSON.toJSONString(response));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 会员登录注册
|
|
|
|
|
|
* 登录成功,返回memberToken
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/memberRegisterAndLogin
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/memberRegisterAndLogin")
|
|
|
|
|
|
public RestApiResponse<?> memberRegisterAndLogin(HttpServletRequest request, @RequestBody MemberRegisterAndLoginDTO dto) {
|
2024-06-11 17:01:44 +08:00
|
|
|
|
logger.info("会员登录注册接口 param:{}, user-agent:{}", JSON.toJSONString(dto), request.getHeader("user-agent"));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String appId = request.getHeader("appId");
|
|
|
|
|
|
if (StringUtils.isNotBlank(appId)) {
|
2024-06-11 17:01:44 +08:00
|
|
|
|
String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByWxAppId(appId);
|
2024-03-18 14:01:57 +08:00
|
|
|
|
if (StringUtils.isNotBlank(firstLevelMerchantId)) {
|
|
|
|
|
|
dto.setMerchantId(firstLevelMerchantId);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 执行登录(查这个手机号在后台有没有数据,如果没有就静默注册)
|
|
|
|
|
|
String memberToken = memberService.memberRegisterAndLogin(dto);
|
|
|
|
|
|
|
|
|
|
|
|
// 返回前端成功
|
|
|
|
|
|
Map<String, String> map = Maps.newHashMap();
|
|
|
|
|
|
map.put("memberToken", memberToken);
|
|
|
|
|
|
response = new RestApiResponse<>(map);
|
|
|
|
|
|
} catch (ServiceException e) {
|
|
|
|
|
|
logger.warn("会员登录注册接口 warn", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("会员登录注册接口 发生异常 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_MEMBER_REGISTER_AND_LOGIN_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 微信一键登录
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/wechatLogin
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/wechatLogin")
|
|
|
|
|
|
public RestApiResponse<?> wechatLogin(HttpServletRequest request, @RequestBody WechatLoginDTO dto) {
|
2024-06-11 17:02:52 +08:00
|
|
|
|
logger.info("微信小程序登录param:{}, user-agent:{}", JSON.toJSONString(dto), request.getHeader("user-agent"));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
// 获取小程序appid
|
|
|
|
|
|
String appId = request.getHeader("appId");
|
|
|
|
|
|
dto.setAppId(appId);
|
|
|
|
|
|
String memberToken = memberService.wechatLogin(dto);
|
|
|
|
|
|
response = new RestApiResponse<>(ImmutableMap.of("memberToken", memberToken));
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("微信登录异常 param:{}", JSON.toJSONString(dto), e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_WECHAT_LOGIN_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-10 09:44:52 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 支付寶一键登录
|
2024-06-11 16:30:42 +08:00
|
|
|
|
* http://localhost:8080/uniapp/member/alipayLogin
|
2024-05-10 09:44:52 +08:00
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/alipayLogin")
|
2024-06-11 16:30:42 +08:00
|
|
|
|
public RestApiResponse<?> alipayLogin(HttpServletRequest request, @RequestBody AlipayLoginDTO dto) {
|
2024-06-11 17:02:52 +08:00
|
|
|
|
logger.info("支付宝小程序登录param:{}, user-agent:{}", JSON.toJSONString(dto), request.getHeader("user-agent"));
|
2024-05-10 09:44:52 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
// 获取小程序appid
|
|
|
|
|
|
String appId = request.getHeader("appId");
|
|
|
|
|
|
dto.setAppId(appId);
|
2024-06-07 11:33:26 +08:00
|
|
|
|
String memberToken = memberService.alipayLogin(dto);
|
2024-05-10 09:44:52 +08:00
|
|
|
|
response = new RestApiResponse<>(ImmutableMap.of("memberToken", memberToken));
|
|
|
|
|
|
} catch (Exception e) {
|
2024-05-22 10:47:37 +08:00
|
|
|
|
logger.error("支付宝登录异常 param:{}", JSON.toJSONString(dto), e);
|
2024-06-11 16:30:42 +08:00
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_ALIPAY_LOGIN_ERROR);
|
2024-05-10 09:44:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-18 14:01:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 接收并处理前端用户信息
|
|
|
|
|
|
* <p>
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/saveUserInfo
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/saveUserInfo")
|
|
|
|
|
|
public RestApiResponse<?> saveUserInfo(HttpServletRequest request, @RequestBody MemberRegisterDTO dto) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
// logger.info("接受前端用户信息并处理 param:{}", JSON.toJSONString(dto));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
memberService.handleUserInfo(memberId, dto);
|
|
|
|
|
|
response = new RestApiResponse<>();
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("处理用户信息异常", e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_HANDLE_USER_INFO_ERROR);
|
|
|
|
|
|
}
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("接受前端用户信息并处理, param:{}, result:{}", JSON.toJSONString(dto), JSON.toJSONString(response));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询用户账户信息
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/getMemberInfo
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return 用户账户信息
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("/getMemberInfo")
|
|
|
|
|
|
public RestApiResponse<?> getMemberInfo(HttpServletRequest request) {
|
|
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
String memberId = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
// logger.info("查询用户账户信息 param memberId:{}", memberId);
|
|
|
|
|
|
MemberVO memberVO = memberService.getMemberInfoByMemberId(memberId);
|
|
|
|
|
|
response = new RestApiResponse<>(memberVO);
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("查询用户账户信息", e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_MEMBER_ACCOUNT_AMOUNT_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("查询用户账户信息 param memberId:{}, result:{}", memberId, response);
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取openId
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/getOpenId
|
|
|
|
|
|
*/
|
2024-06-11 16:30:42 +08:00
|
|
|
|
// @PostMapping("/getOpenId")
|
|
|
|
|
|
// public RestApiResponse<?> getOpenId(HttpServletRequest request, @RequestBody WeixinPayDTO dto) {
|
|
|
|
|
|
// logger.info("获取openId param:{}", dto.toString());
|
|
|
|
|
|
// RestApiResponse<?> response;
|
|
|
|
|
|
// try {
|
|
|
|
|
|
// getMemberIdByAuthorization(request);
|
|
|
|
|
|
// String openId = memberService.getOpenIdByCode(dto.getCode());
|
|
|
|
|
|
// response = new RestApiResponse<>(ImmutableMap.of("openId", openId));
|
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
|
// logger.error("获取openId error", e);
|
|
|
|
|
|
// response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_OPEN_ID_BY_CODE_ERROR);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// logger.info("获取openId result:{}", response);
|
|
|
|
|
|
// return response;
|
|
|
|
|
|
// }
|
2024-03-18 14:01:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取用户账户余额变动信息
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/getMemberBalanceChanges
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param dto
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/getMemberBalanceChanges")
|
|
|
|
|
|
public RestApiResponse<?> getMemberBalanceChanges(HttpServletRequest request, @RequestBody UniAppQueryMemberBalanceDTO dto) {
|
|
|
|
|
|
logger.info("查询用户账户余额变动信息 params:{}", JSON.toJSONString(dto));
|
|
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
dto.setMemberId(memberId);
|
|
|
|
|
|
PageResponse pageResponse = memberService.getMemberBalanceChanges(dto);
|
|
|
|
|
|
// PageResponse pageResponse = memberService.getMemberWalletLog(dto);
|
|
|
|
|
|
// MemberWalletInfoVO memberWalletInfo = memberService.getMemberWalletInfo (dto);
|
|
|
|
|
|
response = new RestApiResponse<>(pageResponse);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("查询用户账户余额变动信息 error:", e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_BALANCE_CHANGES_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("查询用户账户余额变动信息 result:{}", response);
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取用户账户余额变动信息V2
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/getMemberBalanceChangesV2
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param dto
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/getMemberBalanceChangesV2")
|
|
|
|
|
|
public RestApiResponse<?> getMemberBalanceChangesV2(HttpServletRequest request, @RequestBody UniAppQueryMemberBalanceDTO dto) {
|
|
|
|
|
|
// logger.info("查询用户账户余额变动信息 params:{}", JSON.toJSONString(dto));
|
|
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
String memberId = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (StringUtils.isBlank(dto.getMemberId())) {
|
|
|
|
|
|
memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
dto.setMemberId(memberId);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isBlank(dto.getMemberId()) || StringUtils.isBlank(dto.getWalletCode())) {
|
|
|
|
|
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
MemberWalletInfoVO memberWalletInfo = memberService.getMemberWalletInfo(dto);
|
|
|
|
|
|
response = new RestApiResponse<>(memberWalletInfo);
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("查询用户账户余额变动信息 error:", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("查询用户账户余额变动信息 error:", e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_BALANCE_CHANGES_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("查询用户账户余额变动信息memberId:{}, params:{}, result:{}", memberId, JSON.toJSONString(dto), JSON.toJSONString(response));
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 通过 memberId 查询用户绑定车牌信息
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/getMemberCarNoInfo
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("/getMemberCarNoInfo")
|
|
|
|
|
|
public RestApiResponse<?> getMemberCarNoInfo(HttpServletRequest request) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
// logger.info("通过 memberId 查询用户个人基本信息 param:{}", memberId);
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
2024-03-19 16:05:38 +08:00
|
|
|
|
String memberId = null;
|
2024-03-18 14:01:57 +08:00
|
|
|
|
try {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
memberId = getMemberIdByAuthorization(request);
|
2024-03-18 14:01:57 +08:00
|
|
|
|
MemberPlateNumberRelation info = new MemberPlateNumberRelation();
|
|
|
|
|
|
info.setMemberId(memberId);
|
|
|
|
|
|
List<MemberPlateNumberRelation> resultList = memberPlateNumberRelationService.selectMemberPlateNumberRelationList(info);
|
|
|
|
|
|
response = new RestApiResponse<>(resultList);
|
2024-03-19 16:05:38 +08:00
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("通过 memberId 查询用户个人基本信息 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
2024-03-18 14:01:57 +08:00
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("通过 memberId 查询用户个人基本信息 error", e);
|
2024-03-19 16:05:38 +08:00
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_GET_MEMBER_CAR_NO_INFO_ERROR);
|
2024-03-18 14:01:57 +08:00
|
|
|
|
}
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("通过memberId查询用户个人基本信息, memberId:{}, result:{}", memberId, JSON.toJSONString(response));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 用户绑定车牌号、vin
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/memberBindingCarNo
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/memberBindingCarNo")
|
|
|
|
|
|
public RestApiResponse<?> memberBindingCarNo(HttpServletRequest request, @RequestBody BindingCarNoDTO dto) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
// logger.info("用户绑定车牌号 param:{}", JSON.toJSONString(dto));
|
|
|
|
|
|
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
// 参数校验
|
|
|
|
|
|
if (StringUtils.isBlank(dto.getCarNo())) {
|
|
|
|
|
|
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
dto.setMemberId(memberId);
|
|
|
|
|
|
memberService.memberBindingCarNo(dto);
|
|
|
|
|
|
response = new RestApiResponse<>();
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("用户绑定车牌号 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("用户绑定车牌号 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_USER_BINDING_CARNO_ERROR);
|
|
|
|
|
|
}
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("用户绑定车牌号, param:{}, result:{}", JSON.toJSONString(dto), response);
|
2024-03-18 14:01:57 +08:00
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 用户修改车牌号
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/memberUpdatePlateNumber
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/memberUpdatePlateNumber")
|
|
|
|
|
|
public RestApiResponse<?> memberUpdatePlateNumber(HttpServletRequest request, @RequestBody BindingCarNoDTO dto) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("用户修改车牌号 params:{}", JSON.toJSONString(dto));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
MemberPlateNumberRelation relation = MemberPlateNumberRelation.builder()
|
|
|
|
|
|
.id(Integer.valueOf(dto.getId()))
|
|
|
|
|
|
.memberId(memberId)
|
|
|
|
|
|
.licensePlateNumber(dto.getCarNo())
|
|
|
|
|
|
.build();
|
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getVinCode())) {
|
|
|
|
|
|
relation.setVinCode(dto.getVinCode());
|
|
|
|
|
|
}
|
|
|
|
|
|
int i = memberPlateNumberRelationService.updatePlateNumber(relation);
|
|
|
|
|
|
response = new RestApiResponse<>(i);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("用户修改车牌号 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_USER_UNBIND_CARNO_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("用户修改车牌号 result:{}", response);
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 用户解除绑定
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/memberUnbindCarNo
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/memberUnbindCarNo")
|
|
|
|
|
|
public RestApiResponse<?> memberUnbindCarNo(@RequestBody BindingCarNoDTO dto) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("用户解绑车牌号 params:{}", JSON.toJSONString(dto));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
// String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
// dto.setMemberId(memberId);
|
|
|
|
|
|
int i = memberPlateNumberRelationService.deleteCarNoByParams(dto.getIds());
|
|
|
|
|
|
response = new RestApiResponse<>(i);
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("用户解绑车牌号 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(ReturnCodeEnum.CODE_USER_UNBIND_CARNO_ERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("用户解绑车牌号 result:{}", response);
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2024-05-22 10:47:37 +08:00
|
|
|
|
* 用户绑定鉴权卡接口-小程序
|
2024-03-18 14:01:57 +08:00
|
|
|
|
* http://localhost:8080/uniapp/member/memberBindingCard
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param dto
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/memberBindingCard")
|
|
|
|
|
|
public RestApiResponse<?> memberBindingCard(HttpServletRequest request, @RequestBody BindingCardDTO dto) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("用户绑定鉴权卡 param:{}", JSON.toJSONString(dto));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
dto.setMemberId(memberId);
|
|
|
|
|
|
int i = memberService.memberBindCard(dto);
|
|
|
|
|
|
response = new RestApiResponse<>(i);
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("用户绑定鉴权卡 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("用户绑定鉴权卡 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("用户绑定鉴权卡 result:{}", response);
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 用户解绑鉴权卡
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param dto
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/memberUnbindingCard")
|
|
|
|
|
|
public RestApiResponse<?> memberUnbindingCard(HttpServletRequest request, @RequestBody BindingCardDTO dto) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("用户解绑鉴权卡 param:{}", JSON.toJSONString(dto));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
dto.setMemberId(memberId);
|
|
|
|
|
|
int i = memberService.memberUnbindCard(dto);
|
|
|
|
|
|
response = new RestApiResponse<>(i);
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("用户解绑鉴权卡 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("用户解绑鉴权卡 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("用户解绑鉴权卡 result:{}", response);
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 新增会员发票抬头
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/createMemberInvoiceTitle
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/createMemberInvoiceTitle")
|
|
|
|
|
|
public RestApiResponse<?> createMemberInvoiceTitle(HttpServletRequest request, @RequestBody InvoiceTitleDTO dto) {
|
|
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
dto.setMemberId(memberId);
|
|
|
|
|
|
memberService.createMemberInvoiceTitle(dto);
|
|
|
|
|
|
response = new RestApiResponse<>();
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("新增会员发票抬头 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("新增会员发票抬头 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 修改会员发票抬头
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/updateMemberInvoiceTitle
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/updateMemberInvoiceTitle")
|
|
|
|
|
|
public RestApiResponse<?> updateMemberInvoiceTitle(HttpServletRequest request, @RequestBody InvoiceTitleDTO dto) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("修改会员发票抬头 param:{}", JSON.toJSONString(dto));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
dto.setMemberId(memberId);
|
|
|
|
|
|
memberService.updateMemberInvoiceTitle(dto);
|
|
|
|
|
|
response = new RestApiResponse<>();
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("修改会员发票抬头 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("修改会员发票抬头 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 删除会员发票抬头
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param request
|
|
|
|
|
|
* @param dto
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@PostMapping("/deleteMemberInvoiceTitle")
|
|
|
|
|
|
public RestApiResponse<?> deleteMemberInvoiceTitle(HttpServletRequest request, @RequestBody InvoiceTitleDTO dto) {
|
2024-03-19 16:05:38 +08:00
|
|
|
|
logger.info("修改会员发票抬头 param:{}", JSON.toJSONString(dto));
|
2024-03-18 14:01:57 +08:00
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
dto.setMemberId(memberId);
|
|
|
|
|
|
memberService.deleteMemberInvoiceTitle(dto);
|
|
|
|
|
|
response = new RestApiResponse<>();
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("修改会员发票抬头 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("修改会员发票抬头 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询会员发票抬头列表
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/queryMemberInvoiceTitles
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("/queryMemberInvoiceTitles")
|
|
|
|
|
|
public RestApiResponse<?> queryMemberInvoiceTitles(HttpServletRequest request) {
|
|
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
List<InvoiceTitleVO> list = memberService.queryMemberInvoiceTitles(memberId);
|
|
|
|
|
|
response = new RestApiResponse<>(ImmutableMap.of("list", list));
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("查询会员发票抬头列表 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("查询会员发票抬头列表 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("查询会员发票抬头列表 result:{}", response);
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询会员钱包列表
|
|
|
|
|
|
* http://localhost:8080/uniapp/member/queryMemberWalletList
|
|
|
|
|
|
*/
|
|
|
|
|
|
@GetMapping("/queryMemberWalletList")
|
|
|
|
|
|
public RestApiResponse<?> queryMemberWalletList(HttpServletRequest request) {
|
|
|
|
|
|
RestApiResponse<?> response = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
String memberId = getMemberIdByAuthorization(request);
|
|
|
|
|
|
List<MemberWalletVO> list = memberService.queryMemberWalletList(memberId);
|
|
|
|
|
|
response = new RestApiResponse<>(ImmutableMap.of("list", list));
|
|
|
|
|
|
} catch (BusinessException e) {
|
|
|
|
|
|
logger.error("查询会员钱包列表 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e.getCode(), e.getMessage());
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
logger.error("查询会员钱包列表 error", e);
|
|
|
|
|
|
response = new RestApiResponse<>(e);
|
|
|
|
|
|
}
|
|
|
|
|
|
logger.info("查询会员钱包列表 result:{}", response);
|
|
|
|
|
|
return response;
|
|
|
|
|
|
}
|
2023-03-04 16:29:55 +08:00
|
|
|
|
}
|