From 8a038cf6f0792cfe260a94e86d954b50f068e758 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 07 二月 2025 16:55:41 +0800 Subject: [PATCH] bug修改 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java | 143 +++++++++++++++++++++++++++++++---------------- 1 files changed, 95 insertions(+), 48 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java index 1d17e96..5ad844e 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserController.java @@ -84,9 +84,8 @@ private TAppUserService appUserService; @Resource private TAppUserTagService appUserTagService; - @Autowired + @Resource private OrderClient orderClient; - @Resource private TAppUserVipDetailService tAppUserVipDetailService; @Resource @@ -798,35 +797,32 @@ public R giveVip(@RequestBody GiveVipDto giveVipDto) { String[] split = giveVipDto.getUserIds().split(","); for (String s : split) { - - - TAppUser nowUser = appUserService.getById(s); - - int plusDay = 0; - if (giveVipDto.getType() == 1) { - plusDay = 1; - } else if (giveVipDto.getType() == 2) { - plusDay = 3; - } else if (giveVipDto.getType() == 3) { - plusDay = 12; - } + TAppUser nowUser = appUserService.getById(s); + int plusDay = 0; + if (giveVipDto.getType() == 1) { + plusDay = 1; + } else if (giveVipDto.getType() == 2) { + plusDay = 3; + } else if (giveVipDto.getType() == 3) { + plusDay = 12; + } BigDecimal bigDecimal = new BigDecimal("0"); TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData(); - switch (giveVipDto.getType()){ - case 1: - bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard()); - break; - case 2: - bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard()); - break; - case 3: - bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard()); - break; - } + switch (giveVipDto.getType()){ + case 1: + bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard()); + break; + case 2: + bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard()); + break; + case 3: + bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard()); + break; + } //增加vipDetail - giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType()); - appUserService.updateById(nowUser); - // 新增后台赠送记录 + giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType()); + appUserService.updateById(nowUser); + // 新增后台赠送记录 TGrantVip tGrantVip = new TGrantVip(); tGrantVip.setCode(OrderCodeUtil.getOrderCode("ZS")); tGrantVip.setAppUserId(nowUser.getId()); @@ -838,6 +834,51 @@ } return R.ok(); } + + + + @PostMapping(value = "/user/give/vip1") + public R giveVip1(@RequestBody GiveVipDto giveVipDto) { + String[] split = giveVipDto.getUserIds().split(","); + for (String s : split) { + TAppUser nowUser = appUserService.getById(s); + int plusDay = 0; + if (giveVipDto.getType() == 1) { + plusDay = 1; + } else if (giveVipDto.getType() == 2) { + plusDay = 3; + } else if (giveVipDto.getType() == 3) { + plusDay = 12; + } + BigDecimal bigDecimal = new BigDecimal("0"); + TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData(); + switch (giveVipDto.getType()){ + case 1: + bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard()); + break; + case 2: + bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard()); + break; + case 3: + bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard()); + break; + } + //增加vipDetail + giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType()); + appUserService.updateById(nowUser); + // 新增后台赠送记录 + TGrantVip tGrantVip = new TGrantVip(); + tGrantVip.setCode(OrderCodeUtil.getOrderCode("ZS")); + tGrantVip.setAppUserId(nowUser.getId()); + tGrantVip.setVipId(giveVipDto.getVipId()); + tGrantVip.setOrderAmount(bigDecimal); + tGrantVip.setCreateTime(LocalDateTime.now()); + tGrantVip.setAppUserId(nowUser.getId()); + orderClient.managementGiveVip(tGrantVip); + } + return R.ok(); + } + @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) @PostMapping(value = "/user/invite/page") @@ -929,6 +970,10 @@ TAppUser appUser = appUserService.getById(id); return R.ok(appUser); } + @PostMapping(value = "/user/getAllUser") + public R<List<TAppUser>> getAllUser(){ + return R.ok(appUserService.list(null)); + } /** @@ -970,14 +1015,10 @@ public R sign() { LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet(); Long userId = loginUserApplet.getUserId(); - TAppUser byId = appUserService.getById(userId); - - if (signService.lambdaQuery().eq(TAppUserSign::getSignDay, LocalDate.now()).eq(TAppUserSign::getAppUserId, userId).count()>0){ return R.fail("今日已签到"); } - //判断当前生效的vipDetail TAppUserVipDetail one = tAppUserVipDetailService.lambdaQuery().le(TAppUserVipDetail::getStartTime, LocalDateTime.now()).ge(TAppUserVipDetail::getEndTime, LocalDateTime.now()).eq(TAppUserVipDetail::getAppUserId, userId).last("limit 1").one(); boolean doubleVip = false; @@ -1120,43 +1161,41 @@ if (count==0){ R<TIntegralRule> set = integralRuleClient.getSet(); TIntegralRule data = set.getData(); - JSONObject jsonObject = JSON.parseObject(data.getAddVehiclesEarnsPoints()); - - - Integer point = 0; - //增加车牌50分,必填 + if(null != data){ + JSONObject jsonObject = JSON.parseObject(data.getAddVehiclesEarnsPoints()); + Integer point = 0; + //增加车牌50分,必填 point = point+jsonObject.getInteger("num1"); if (doubleVip){ point = point+jsonObject.getInteger("num1"); } - //增加车型分 + //增加车型分 if (StringUtils.isNotEmpty(appUserCar.getVehicleModel())){ point = point+jsonObject.getInteger("num2"); if (doubleVip){ point = point+jsonObject.getInteger("num2"); } } - //增加车辆用途分 + //增加车辆用途分 if (StringUtils.isNotEmpty(appUserCar.getVehicleUse())){ point = point+jsonObject.getInteger("num3"); if (doubleVip){ point = point+jsonObject.getInteger("num3"); } } - //增加续航分 + //增加续航分 if (StringUtils.isNotEmpty(appUserCar.getEndurance())){ point = point+jsonObject.getInteger("num4"); if (doubleVip){ point = point+jsonObject.getInteger("num4"); } } - - //增加积分记录 - pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),"",""); - byId.setPoints(byId.getPoints()+point); + + //增加积分记录 + pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),"",""); + byId.setPoints(byId.getPoints()+point); + } byId.setFirstAdd(1); - - } CarNumDto carNumDto = CarUtil.carNum(appUserCar.getLicensePlate()); if (carNumDto==null){ @@ -1289,8 +1328,16 @@ return R.ok(result3); } } - - + + + public static void main(String[] args) { +// String reqStr1 = MsgUtil.codeMsg("19983174515", "123456"); +// String result1 = HttpUtils.post(MsgConstants.SEND_URL, reqStr1); + + String reqStr3 = MsgUtil.faultMsg("18398968484", "长河服务区充电站(遂", "123"); + String result3 = HttpUtils.post(MsgConstants.SEND_URL, reqStr3); + System.err.println(result3); + } @PostMapping(value = "/user/logOut") @ApiOperation(value = "退出登录", tags = {"小程序-个人中心"}) public AjaxResult logOut(){ -- Gitblit v1.7.1