diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/MemberController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/MemberController.java index 6197198bc..4f8b8c0e9 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/MemberController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/MemberController.java @@ -39,494 +39,500 @@ import java.util.Map; @RequestMapping("/uniapp/member") public class MemberController extends BaseController { - @Autowired - private MemberService memberService; + @Autowired + private MemberService memberService; - @Autowired - private MemberBasicInfoService memberBasicInfoService; + @Autowired + private MemberBasicInfoService memberBasicInfoService; - @Autowired - private PileMerchantInfoService pileMerchantInfoService; + @Autowired + private PileMerchantInfoService pileMerchantInfoService; - @Autowired - private MemberPlateNumberRelationService memberPlateNumberRelationService; + @Autowired + private MemberPlateNumberRelationService memberPlateNumberRelationService; - /** - * 下发短信接口 business - * http://localhost:8080/uniapp/member/sendSMS - */ - @PostMapping("/sendSMS") - public RestApiResponse sendSMS(HttpServletRequest request, @RequestBody MemberRegisterAndLoginDTO dto) { - logger.info("下发短信接口 param:{}", JSONObject.toJSONString(dto)); - 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); - } - logger.info("下发短信接口 result:{}", JSONObject.toJSONString(response)); - return response; - } + /** + * 下发短信接口 business + * http://localhost:8080/uniapp/member/sendSMS + */ + @PostMapping("/sendSMS") + public RestApiResponse sendSMS(HttpServletRequest request, @RequestBody MemberRegisterAndLoginDTO dto) { + logger.info("下发短信接口 param:{}", JSONObject.toJSONString(dto)); + 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); + } + logger.info("下发短信接口 result:{}", JSONObject.toJSONString(response)); + return response; + } - /** - * 会员登录注册 - * 登录成功,返回memberToken - * http://localhost:8080/uniapp/member/memberRegisterAndLogin - */ - @PostMapping("/memberRegisterAndLogin") - public RestApiResponse memberRegisterAndLogin(HttpServletRequest request, @RequestBody MemberRegisterAndLoginDTO dto) { - logger.info("会员登录注册接口 param:{}", JSONObject.toJSONString(dto)); - RestApiResponse response = null; - try { - String appId = request.getHeader("appId"); - if (StringUtils.isNotBlank(appId)) { - String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(appId); - if (StringUtils.isNotBlank(firstLevelMerchantId)) { - dto.setMerchantId(firstLevelMerchantId); - } - } + /** + * 会员登录注册 + * 登录成功,返回memberToken + * http://localhost:8080/uniapp/member/memberRegisterAndLogin + */ + @PostMapping("/memberRegisterAndLogin") + public RestApiResponse memberRegisterAndLogin(HttpServletRequest request, @RequestBody MemberRegisterAndLoginDTO dto) { + logger.info("会员登录注册接口 param:{}", JSONObject.toJSONString(dto)); + RestApiResponse response = null; + try { + String appId = request.getHeader("appId"); + if (StringUtils.isNotBlank(appId)) { + String firstLevelMerchantId = pileMerchantInfoService.getFirstLevelMerchantIdByAppId(appId); + if (StringUtils.isNotBlank(firstLevelMerchantId)) { + dto.setMerchantId(firstLevelMerchantId); + } + } - // 执行登录(查这个手机号在后台有没有数据,如果没有就静默注册) - String memberToken = memberService.memberRegisterAndLogin(dto); + // 执行登录(查这个手机号在后台有没有数据,如果没有就静默注册) + String memberToken = memberService.memberRegisterAndLogin(dto); - // 返回前端成功 - Map 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; - } + // 返回前端成功 + Map 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) { - 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; - } + /** + * 微信一键登录 + * http://localhost:8080/uniapp/member/wechatLogin + */ + @PostMapping("/wechatLogin") + public RestApiResponse wechatLogin(HttpServletRequest request, @RequestBody WechatLoginDTO dto) { + 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; + } - /** - * 接收并处理前端用户信息 - * - * http://localhost:8080/uniapp/member/saveUserInfo - */ - @PostMapping("/saveUserInfo") - public RestApiResponse saveUserInfo(HttpServletRequest request, @RequestBody MemberRegisterDTO dto) { - logger.info("接受前端用户信息并处理 param:{}", JSONObject.toJSONString(dto)); - 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); - } - logger.info("接受前端用户信息并处理 result:{}", response); - return response; - } + /** + * 接收并处理前端用户信息 + *

+ * http://localhost:8080/uniapp/member/saveUserInfo + */ + @PostMapping("/saveUserInfo") + public RestApiResponse saveUserInfo(HttpServletRequest request, @RequestBody MemberRegisterDTO dto) { + logger.info("接受前端用户信息并处理 param:{}", JSONObject.toJSONString(dto)); + 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); + } + logger.info("接受前端用户信息并处理 result:{}", response); + 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; - } + /** + * 查询用户账户信息 + * 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 - */ - @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; - } + /** + * 获取openId + * http://localhost:8080/uniapp/member/getOpenId + */ + @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; + } - /** - * 获取用户账户余额变动信息 - * 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; - } + /** + * 获取用户账户余额变动信息 + * 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; - } + /** + * 获取用户账户余额变动信息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){ - String memberId = getMemberIdByAuthorization(request); - logger.info("通过 memberId 查询用户个人基本信息 param:{}", memberId); - RestApiResponse response = null; - try { - MemberPlateNumberRelation info = new MemberPlateNumberRelation(); - info.setMemberId(memberId); - List resultList = memberPlateNumberRelationService.selectMemberPlateNumberRelationList(info); - response = new RestApiResponse<>(resultList); - } catch (Exception e) { - logger.error("通过 memberId 查询用户个人基本信息 error", e); - response = new RestApiResponse<>(e); - } - logger.info("通过 memberId 查询用户个人基本信息 result:{}", response); - return response; - } + /** + * 通过 memberId 查询用户绑定车牌信息 + * http://localhost:8080/uniapp/member/getMemberCarNoInfo + * + * @return + */ + @GetMapping("/getMemberCarNoInfo") + public RestApiResponse getMemberCarNoInfo(HttpServletRequest request) { + String memberId = getMemberIdByAuthorization(request); + logger.info("通过 memberId 查询用户个人基本信息 param:{}", memberId); + RestApiResponse response = null; + try { + MemberPlateNumberRelation info = new MemberPlateNumberRelation(); + info.setMemberId(memberId); + List resultList = memberPlateNumberRelationService.selectMemberPlateNumberRelationList(info); + response = new RestApiResponse<>(resultList); + } catch (Exception e) { + logger.error("通过 memberId 查询用户个人基本信息 error", e); + response = new RestApiResponse<>(e); + } + logger.info("通过 memberId 查询用户个人基本信息 result:{}", response); + return response; + } - /** - * 用户绑定车牌号、vin - * http://localhost:8080/uniapp/member/memberBindingCarNo - * - * @return - */ - @PostMapping("/memberBindingCarNo") - public RestApiResponse memberBindingCarNo(HttpServletRequest request, @RequestBody BindingCarNoDTO dto){ - logger.info("用户绑定车牌号 param:{}", JSONObject.toJSONString(dto)); - 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); - } - logger.info("用户绑定车牌号 result:{}", response); - return response; - } + /** + * 用户绑定车牌号、vin + * http://localhost:8080/uniapp/member/memberBindingCarNo + * + * @return + */ + @PostMapping("/memberBindingCarNo") + public RestApiResponse memberBindingCarNo(HttpServletRequest request, @RequestBody BindingCarNoDTO dto) { + logger.info("用户绑定车牌号 param:{}", JSONObject.toJSONString(dto)); + 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); + } + logger.info("用户绑定车牌号 result:{}", response); + return response; + } - /** - * 用户修改车牌号 - * http://localhost:8080/uniapp/member/memberUpdatePlateNumber - * - * @return - */ - @PostMapping("/memberUpdatePlateNumber") - public RestApiResponse memberUpdatePlateNumber(HttpServletRequest request, @RequestBody BindingCarNoDTO dto){ - logger.info("用户修改车牌号 params:{}", JSONObject.toJSONString(dto)); - 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/memberUpdatePlateNumber + * + * @return + */ + @PostMapping("/memberUpdatePlateNumber") + public RestApiResponse memberUpdatePlateNumber(HttpServletRequest request, @RequestBody BindingCarNoDTO dto) { + logger.info("用户修改车牌号 params:{}", JSONObject.toJSONString(dto)); + 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){ - logger.info("用户解绑车牌号 params:{}", JSONObject.toJSONString(dto)); - 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; - } + /** + * 用户解除绑定 + * http://localhost:8080/uniapp/member/memberUnbindCarNo + * + * @return + */ + @PostMapping("/memberUnbindCarNo") + public RestApiResponse memberUnbindCarNo(@RequestBody BindingCarNoDTO dto) { + logger.info("用户解绑车牌号 params:{}", JSONObject.toJSONString(dto)); + 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; + } - /** - * 用户绑定鉴权卡接口 - * http://localhost:8080/uniapp/member/memberBindingCard - * @param dto - * @return - */ - @PostMapping("/memberBindingCard") - public RestApiResponse memberBindingCard(HttpServletRequest request, @RequestBody BindingCardDTO dto){ - logger.info("用户绑定鉴权卡 param:{}", JSONObject.toJSONString(dto)); - 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; - } + /** + * 用户绑定鉴权卡接口 + * http://localhost:8080/uniapp/member/memberBindingCard + * + * @param dto + * @return + */ + @PostMapping("/memberBindingCard") + public RestApiResponse memberBindingCard(HttpServletRequest request, @RequestBody BindingCardDTO dto) { + logger.info("用户绑定鉴权卡 param:{}", JSONObject.toJSONString(dto)); + 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) { - logger.info("用户解绑鉴权卡 param:{}", JSONObject.toJSONString(dto)); - 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; - } + /** + * 用户解绑鉴权卡 + * + * @param request + * @param dto + * @return + */ + @PostMapping("/memberUnbindingCard") + public RestApiResponse memberUnbindingCard(HttpServletRequest request, @RequestBody BindingCardDTO dto) { + logger.info("用户解绑鉴权卡 param:{}", JSONObject.toJSONString(dto)); + 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/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) { - logger.info("修改会员发票抬头 param:{}", JSONObject.toJSONString(dto)); - 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; - } + /** + * 修改会员发票抬头 + * http://localhost:8080/uniapp/member/updateMemberInvoiceTitle + */ + @PostMapping("/updateMemberInvoiceTitle") + public RestApiResponse updateMemberInvoiceTitle(HttpServletRequest request, @RequestBody InvoiceTitleDTO dto) { + logger.info("修改会员发票抬头 param:{}", JSONObject.toJSONString(dto)); + 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) { - logger.info("修改会员发票抬头 param:{}", JSONObject.toJSONString(dto)); - 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; - } + /** + * 删除会员发票抬头 + * + * @param request + * @param dto + * @return + */ + @PostMapping("/deleteMemberInvoiceTitle") + public RestApiResponse deleteMemberInvoiceTitle(HttpServletRequest request, @RequestBody InvoiceTitleDTO dto) { + logger.info("修改会员发票抬头 param:{}", JSONObject.toJSONString(dto)); + 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 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/queryMemberInvoiceTitles + */ + @GetMapping("/queryMemberInvoiceTitles") + public RestApiResponse queryMemberInvoiceTitles(HttpServletRequest request) { + RestApiResponse response = null; + try { + String memberId = getMemberIdByAuthorization(request); + List 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 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; - } + /** + * 查询会员钱包列表 + * http://localhost:8080/uniapp/member/queryMemberWalletList + */ + @GetMapping("/queryMemberWalletList") + public RestApiResponse queryMemberWalletList(HttpServletRequest request) { + RestApiResponse response = null; + try { + String memberId = getMemberIdByAuthorization(request); + List 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; + } }