| | |
| | | //累计充电次数 |
| | | R<Long> useOrderCount = chargingOrderClient.useOrderCount(appUser.getId()); |
| | | appUser.setOrderCount(useOrderCount.getData()); |
| | | appUser.setUid(appUser.getId().toString()); |
| | | |
| | | } |
| | | return R.ok(page); |
| | |
| | | appUserInfoDto.setVipExpireTime(byId.getVipEndTime()); |
| | | } |
| | | //判断当天是否签到 |
| | | Long count = signService.lambdaQuery().eq(TAppUserSign::getSignDay, LocalDate.now()).count(); |
| | | Long count = signService.lambdaQuery().eq(TAppUserSign::getAppUserId,userId).eq(TAppUserSign::getSignDay, LocalDate.now()).count(); |
| | | appUserInfoDto.setIsSign(count>0?1:0); |
| | | //获取当前拥有的优惠卷数量 |
| | | Long coupons = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).eq(TAppCoupon::getStatus, 1).count(); |
| | |
| | | } |
| | | appUserInfoDto.setUserCars(list); |
| | | appUserInfoDto.setFirstAdd(byId.getFirstAdd()!=null?byId.getFirstAdd():0); |
| | | appUserInfoDto.setPoints(byId.getPoints()==null?0:byId.getPoints()); |
| | | return R.ok(appUserInfoDto); |
| | | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | @PostMapping(value = "/user/coupon") |
| | | public R<List<InfoCouponDto>> userCoupon(@RequestParam("type") Integer type) { |
| | | @GetMapping(value = "/user/coupon") |
| | | public R<ListInfoCouponDto> userCoupon(@RequestParam("type") Integer type) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | List<InfoCouponDto> couponDtos = new ArrayList<>(); |
| | | List<TAppCoupon> list = appCouponService.lambdaQuery().le(TAppCoupon::getStartTime, now).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, type).list(); |
| | | for (TAppCoupon tAppCoupon : list) { |
| | | List<InfoCouponDto> couponDtos1 = new ArrayList<>(); |
| | | |
| | | List<TAppCoupon> list = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, 1).list(); |
| | | for (TAppCoupon tAppCoupon : list) { |
| | | TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class); |
| | | InfoCouponDto infoCouponDto = new InfoCouponDto(); |
| | | BeanUtils.copyProperties(coupon, infoCouponDto); |
| | | infoCouponDto.setId(tAppCoupon.getId()); |
| | | infoCouponDto.setEndTime(tAppCoupon.getEndTime()); |
| | | couponDtos1.add(infoCouponDto); |
| | | |
| | | } |
| | | |
| | | List<TAppCoupon> list1 = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).eq(TAppCoupon::getStatus, 2).list(); |
| | | List<TAppCoupon> list2 = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).lt(TAppCoupon::getEndTime, now).list(); |
| | | |
| | | List<InfoCouponDto> couponDtos2 = new ArrayList<>(); |
| | | for (TAppCoupon tAppCoupon : list1) { |
| | | TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class); |
| | | InfoCouponDto infoCouponDto = new InfoCouponDto(); |
| | | BeanUtils.copyProperties(coupon,infoCouponDto); |
| | | BeanUtils.copyProperties(coupon, infoCouponDto); |
| | | infoCouponDto.setId(tAppCoupon.getId()); |
| | | couponDtos.add(infoCouponDto); |
| | | |
| | | infoCouponDto.setEndTime(tAppCoupon.getEndTime()); |
| | | couponDtos2.add(infoCouponDto); |
| | | } |
| | | for (TAppCoupon tAppCoupon : list2) { |
| | | TCoupon coupon = JSON.toJavaObject(JSON.parseObject(tAppCoupon.getCouponJson()), TCoupon.class); |
| | | InfoCouponDto infoCouponDto = new InfoCouponDto(); |
| | | BeanUtils.copyProperties(coupon, infoCouponDto); |
| | | infoCouponDto.setId(tAppCoupon.getId()); |
| | | infoCouponDto.setEndTime(tAppCoupon.getEndTime()); |
| | | couponDtos2.add(infoCouponDto); |
| | | } |
| | | |
| | | |
| | | return R.ok(couponDtos); |
| | | |
| | | ListInfoCouponDto listInfoCouponDto = new ListInfoCouponDto(); |
| | | if (type==1){ |
| | | listInfoCouponDto.setInfoCouponDtoList(couponDtos1); |
| | | }else { |
| | | listInfoCouponDto.setInfoCouponDtoList(couponDtos2); |
| | | } |
| | | listInfoCouponDto.setNum1(couponDtos1.size()); |
| | | listInfoCouponDto.setNum2(couponDtos2.size()); |
| | | return R.ok(listInfoCouponDto); |
| | | |
| | | } |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/user/points/change/down") |
| | | public R changeDown(@RequestBody PointChangeDto points) { |
| | | TAppUser byId = appUserService.getById(points.getUserId()); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()-points.getPoints(),points.getType(),points.getUserId(),points.getRemark(),"JF"); |
| | | byId.setPoints(byId.getPoints()-points.getPoints()); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"}) |
| | | @PostMapping(value = "/user/car/addOrUpdate") |
| | | public R carAdd(@RequestBody TAppUserCar appUserCar) { |
| | |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"}) |
| | | @DeleteMapping(value = "/user/car/delete") |
| | | @GetMapping(value = "/user/car/delete") |
| | | public R carDelete(String id) { |
| | | boolean b = appUserCarService.removeById(id); |
| | | return R.ok(); |
| | |
| | | public R getSeries(String id) throws Exception { |
| | | String modelById = CarBrandUtil.getSeriesById(id); |
| | | JSONObject jsonObject = JSON.parseObject(modelById); |
| | | JSONArray data = jsonObject.getJSONArray("data"); |
| | | JSONArray backList = new JSONArray(); |
| | | for (Object datum : data) { |
| | | JSONObject jsonObject1 = JSON.parseObject(datum.toString()); |
| | | JSONArray list = jsonObject1.getJSONArray("list"); |
| | | backList.addAll(list); |
| | | } |
| | | return R.ok(backList); |
| | | JSONObject data1 = jsonObject.getJSONObject("data"); |
| | | JSONArray data = data1.getJSONArray("list"); |
| | | // JSONArray data = jsonObject.getJSONArray(data1.get("list").toString()); |
| | | // JSONArray backList = new JSONArray(); |
| | | // for (Object datum : data) { |
| | | // JSONObject jsonObject1 = JSON.parseObject(datum.toString()); |
| | | // JSONArray list = jsonObject1.getJSONArray("list"); |
| | | // backList.addAll(jsonObject1); |
| | | // } |
| | | return R.ok(data); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "根据车型获取详情", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/getDetail") |
| | | public R getDetail(String id) throws Exception { |
| | | String detailById = CarBrandUtil.getDetailById(id); |
| | | JSONObject jsonObject = JSON.parseObject(detailById); |
| | | |
| | | return R.ok(jsonObject.getJSONObject("data")); |
| | | } |
| | | } |
| | | |