Merge remote-tracking branch 'origin/master'
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "结束时间") |
| | | @TableField("end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "开始时间") |
| | | @TableField("start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private LocalDateTime startTime; |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ListInfoCouponDto { |
| | | List<InfoCouponDto> infoCouponDtoList; |
| | | Integer num1; |
| | | Integer num2; |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R changeDown(PointChangeDto points) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<TAppUser> selectByPhone(String phone) { |
| | | return R.fail("积分变化失败:"+throwable.getMessage()); |
| | | } |
| | |
| | | |
| | | @PostMapping("/t-app-user/user/points/change") |
| | | R change(@RequestBody PointChangeDto points); |
| | | @PostMapping("/t-app-user/user/points/change/down") |
| | | R changeDown(@RequestBody PointChangeDto points); |
| | | |
| | | /** |
| | | * 通过手机号查询用户 |
| | |
| | | @TableId("id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableField(exist = false) |
| | | private String uid; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | |
| | | @TableField("phone") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty(value = "省名称") |
| | | @TableField("province") |
| | | private String province; |
| | | |
| | | @ApiModelProperty(value = "省编号") |
| | | @TableField("province_code") |
| | | private String provinceCode; |
| | | |
| | | @ApiModelProperty(value = "市名称") |
| | | @TableField("city") |
| | | private String city; |
| | |
| | | @TableField("city_code") |
| | | private String cityCode; |
| | | |
| | | @ApiModelProperty(value = "区县") |
| | | @TableField("district") |
| | | private String district; |
| | | |
| | | @ApiModelProperty(value = "区县code") |
| | | @TableField("district_code") |
| | | private String districtCode; |
| | | |
| | | @ApiModelProperty(value = "详细地址") |
| | | @TableField("address") |
| | | private String address; |
| | | |
| | | @ApiModelProperty(value = "门牌号") |
| | | @TableField("house_number") |
| | | private String houseNumber; |
| | | |
| | | @ApiModelProperty(value = "经度") |
| | | @TableField("lon") |
| | | private String lon; |
| | |
| | | @ApiModel(value = "ChargingGunCountVO对象",description = "充电枪数量VO") |
| | | public class ChargingGunCountVO extends Site { |
| | | |
| | | @ApiModelProperty(value = "充电枪在线数量") |
| | | @ApiModelProperty(value = "充电枪空闲数量") |
| | | private Integer freeCount; |
| | | @ApiModelProperty(value = "充电枪总数数量") |
| | | private Integer totalCount; |
| | |
| | | |
| | | @ApiModelProperty("月卡价格") |
| | | private BigDecimal monthlyCard; |
| | | @ApiModelProperty(value = "月卡折扣") |
| | | private BigDecimal monthlyCardDiscount; |
| | | @ApiModelProperty("季卡价格") |
| | | private BigDecimal seasonCard; |
| | | @ApiModelProperty(value = "季卡折扣") |
| | | private BigDecimal seasonCardDiscount; |
| | | @ApiModelProperty("年卡价格") |
| | | private BigDecimal annualCard; |
| | | @ApiModelProperty(value = "年卡折扣") |
| | | private BigDecimal annualCardDiscount; |
| | | @ApiModelProperty("最高抵扣价格") |
| | | private BigDecimal maximumDeduction; |
| | | private BigDecimal timeAmount; |
| | | @ApiModelProperty("抵扣次数") |
| | | private Integer discountTimes; |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "最高总折扣") |
| | | private BigDecimal totalDiscount; |
| | | |
| | | @ApiModelProperty(value = "会员名称") |
| | | private String name; |
| | | } |
| | |
| | | public AjaxResult<List<TAppUserAddress>> queryAddress() { |
| | | // 用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | return AjaxResult.ok(appUserAddressService.list(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, userId))); |
| | | List<TAppUserAddress> list = appUserAddressService.list(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, userId)); |
| | | list.forEach(e->e.setUid(e.getId().toString())); |
| | | return AjaxResult.ok(list); |
| | | } |
| | | |
| | | /** |
| | | * 查询用户默认地址列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "查询用户默认地址列表") |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "查询用户默认地址") |
| | | @GetMapping(value = "/queryDefaultAddress") |
| | | public AjaxResult<TAppUserAddress> queryDefaultAddress() { |
| | | // 用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | return AjaxResult.ok(appUserAddressService.getOne(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, userId) |
| | | .eq(TAppUserAddress::getDefaultAddress,1))); |
| | | TAppUserAddress appUserAddress = appUserAddressService.getOne(Wrappers.<TAppUserAddress>lambdaQuery().eq(TAppUserAddress::getAppUserId, userId) |
| | | .eq(TAppUserAddress::getDefaultAddress, 1)); |
| | | appUserAddress.setUid(appUserAddress.getId().toString()); |
| | | return AjaxResult.ok(appUserAddress); |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * 修改用户地址 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "设置默认地址") |
| | | @GetMapping(value = "/setDefaultAddress") |
| | | public AjaxResult<String> setDefaultAddress(@RequestParam(value = "id") Long id) { |
| | | // 修改用户默认地址 |
| | | appUserAddressService.updateDefaultAddress(1,tokenService.getLoginUserApplet().getUserId()); |
| | | TAppUserAddress appUserAddress = appUserAddressService.getById(id); |
| | | appUserAddress.setDefaultAddress(1); |
| | | appUserAddressService.updateById(appUserAddress); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 修改用户地址 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "修改用户地址") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TAppUserAddress dto) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过地址id 查询地址信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "查询用户地址详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TAppUserAddress> getDetailById(@RequestParam(value = "id")Long id) { |
| | | return R.ok(appUserAddressService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除用户地址 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "删除用户地址") |
| | |
| | | //累计充电次数 |
| | | 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")); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | public static String getDetailById(String brandId) throws Exception { |
| | | // Create a new request. |
| | | Request httpClientRequest = new Request(); |
| | | try { |
| | | // Set the request parameters. |
| | | // AppKey, AppSecrect, Method and Url are required parameters. |
| | | // Directly writing AK/SK in code is risky. For security, encrypt your AK/SK and store them in the configuration file or environment variables. |
| | | // In this example, the AK/SK are stored in environment variables for identity authentication. |
| | | // Before running this example, set environment variables HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK. |
| | | httpClientRequest.setKey("9a4a2b69afe141718f6843c5d39961ec"); |
| | | httpClientRequest.setSecret("541845f206324bbc933065b44fc98c47"); |
| | | httpClientRequest.setMethod("POST"); |
| | | // Set a request URL in the format of https://{Endpoint}/{URI}. |
| | | httpClientRequest.setUrl("https://vehiclequery.apistore.huaweicloud.com/vehicle/query/detail"); |
| | | httpClientRequest.addHeader("Content-Type", "text/plain"); |
| | | httpClientRequest.addQueryStringParam("modelId",brandId); |
| | | // Set a body for http request. |
| | | // httpClientRequest.setBody("put your request body here"); |
| | | } catch (Exception e) { |
| | | // LOGGER.error(e.getMessage()); |
| | | return ""; |
| | | } |
| | | CloseableHttpClient client = null; |
| | | try { |
| | | // Sign the request. |
| | | HttpRequestBase signedRequest = Client.sign(httpClientRequest, Constant.SIGNATURE_ALGORITHM_SDK_HMAC_SHA256); |
| | | if (Constant.DO_VERIFY) { |
| | | // creat httpClient and verify ssl certificate |
| | | HostName.setUrlHostName(httpClientRequest.getHost()); |
| | | client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClientWithVerify(Constant.INTERNATIONAL_PROTOCOL); |
| | | } else { |
| | | // creat httpClient and do not verify ssl certificate |
| | | client = (CloseableHttpClient) SSLCipherSuiteUtil.createHttpClient(Constant.INTERNATIONAL_PROTOCOL); |
| | | } |
| | | HttpResponse response = client.execute(signedRequest); |
| | | // Print the body of the response. |
| | | HttpEntity resEntity = response.getEntity(); |
| | | if (resEntity != null) { |
| | | // LOGGER.info("Processing Body with name: {} and value: {}", System.getProperty("line.separator"), |
| | | // EntityUtils.toString(resEntity, "UTF-8")); |
| | | String string = EntityUtils.toString(resEntity, "UTF-8"); |
| | | return string; |
| | | } |
| | | } catch (Exception e) { |
| | | LOGGER.error(e.getMessage()); |
| | | } finally { |
| | | if (client != null) { |
| | | client.close(); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | } |
| | |
| | | <result column="app_user_id" property="appUserId" /> |
| | | <result column="name" property="name" /> |
| | | <result column="phone" property="phone" /> |
| | | <result column="province" property="province" /> |
| | | <result column="provinceCode" property="provinceCode" /> |
| | | <result column="city" property="city" /> |
| | | <result column="city_code" property="cityCode" /> |
| | | <result column="district" property="district" /> |
| | | <result column="district_code" property="districtCode" /> |
| | | <result column="address" property="address" /> |
| | | <result column="house_number" property="houseNumber" /> |
| | | <result column="lon" property="lon" /> |
| | | <result column="lat" property="lat" /> |
| | | <result column="default_address" property="defaultAddress" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, app_user_id, name, phone, city, city_code, address, lon, lat, default_address, create_time, del_flag |
| | | id, app_user_id, name, phone, province,provinceCode,city, city_code,district,district_code, address,house_number, lon, lat, default_address, create_time, del_flag |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | String[] split = goodsIds.split("-"); |
| | | // 取出最后一位字符 类型1查询现金购买 类型2查询积分兑换 |
| | | String s = split[split.length - 1]; |
| | | String[] split1 = split[0].split(","); |
| | | List<Integer> res = new ArrayList<>(); |
| | | switch (Integer.parseInt(s)){ |
| | | case 1: |
| | | for (int i = 0; i < split.length-1; i++) { |
| | | for (int i = 0; i < split1.length; i++) { |
| | | Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() |
| | | .eq("order_type",1) |
| | | .eq("goods_id", split[i]) |
| | | .eq("payment_status", 2) |
| | | .ne("refund_status", 2)) |
| | | .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | res.add(reduce); |
| | | } |
| | | break; |
| | | case 2: |
| | | for (int i = 0; i < split.length-1; i++) { |
| | | Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>() |
| | | .eq("order_type",1) |
| | | .ne("status",4) |
| | | .eq("goods_id", split[i]) |
| | | ) |
| | | for (int i = 0; i < split1.length; i++) { |
| | | Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",1).ne("status",4).eq("goods_id", split1[i])) |
| | | .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | res.add(reduce); |
| | | } |
| | |
| | | tExchangeOrder.setCouponId(exchangeDto.getGoodId()); |
| | | } |
| | | tExchangeOrder.setPurchaseQuantity(1); |
| | | tExchangeOrder.setAppUserAddressId(Long.valueOf(exchangeDto.getAddressId())); |
| | | tExchangeOrder.setAppUserAddressId(exchangeDto.getAddressId()==null?null:Long.valueOf(exchangeDto.getAddressId())); |
| | | tExchangeOrder.setPoints(exchangeDto.getPoint()); |
| | | tExchangeOrder.setRemark(""); |
| | | if (exchangeDto.getGoodType()==1){ |
| | |
| | | BigDecimal electronicMoney = new BigDecimal("0"); |
| | | BigDecimal serviceMoney = new BigDecimal("0"); |
| | | for (ChargingOrderVO chargingOrderVO : list) { |
| | | total = total.add(chargingOrderVO.getChargingCapacity()); |
| | | if (chargingOrderVO.getChargingCapacity()!=null){ |
| | | total = total.add(chargingOrderVO.getChargingCapacity()); |
| | | } |
| | | // 充电订单 明细记录 |
| | | List<TChargingOrderAccountingStrategy> chargingOrderId = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>() |
| | | .eq("charging_order_id", chargingOrderVO.getId())); |
| | |
| | | LocalDateTime startTime = chargingOrderVO.getStartTime(); |
| | | LocalDateTime endTime = chargingOrderVO.getEndTime(); |
| | | // 计算时间差 秒 充电时长 |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | chargingOrderVO.setChargingSecond(between); |
| | | time += between; |
| | | if (startTime!=null && endTime!=null){ |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | chargingOrderVO.setChargingSecond(between); |
| | | time += between; |
| | | } |
| | | // 总收入 |
| | | if (chargingOrderVO.getRefundStatus() == 2){ |
| | | if (chargingOrderVO.getRefundStatus() !=null && chargingOrderVO.getRefundStatus() == 2){ |
| | | income = income.add(chargingOrderVO.getPaymentAmount().subtract(chargingOrderVO.getRefundAmount())); |
| | | }else{ |
| | | income = income.add(chargingOrderVO.getPaymentAmount()); |
| | | if (chargingOrderVO.getPaymentAmount()!=null){ |
| | | income = income.add(chargingOrderVO.getPaymentAmount()); |
| | | } |
| | | } |
| | | for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : chargingOrderId) { |
| | | // 累计电费 |
| | |
| | | // 车牌号 |
| | | chargingOrderVO.setPhone(data.getPhone()); |
| | | List<Long> longs = new ArrayList<>(); |
| | | longs.add(chargingOrderVO.getAppUserCarId()); |
| | | List<TAppUserCar> data1 = appUserCarClient.getCarByIds(longs).getData(); |
| | | if (!data1.isEmpty()){ |
| | | chargingOrderVO.setLicensePlate(data1.get(0).getLicensePlate()); |
| | | if (chargingOrderVO.getAppUserCarId()!=null){ |
| | | longs.add(chargingOrderVO.getAppUserCarId()); |
| | | List<TAppUserCar> data1 = appUserCarClient.getCarByIds(longs).getData(); |
| | | if (!data1.isEmpty()){ |
| | | chargingOrderVO.setLicensePlate(data1.get(0).getLicensePlate()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | tCharingOrderVO.setTotal(total); |
| | |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | }else{ |
| | | TCoupon coupon = couponClient.getCouponById1(tExchangeOrder.getGoodsId()).getData(); |
| | | TCoupon coupon = couponClient.getCouponById1(tExchangeOrder.getCouponId()).getData(); |
| | | name = coupon.getName(); |
| | | imgUrl = coupon.getCoverPicture(); |
| | | } |
| | |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | }else{ |
| | | TCoupon coupon = couponClient.getCouponById1(exchangeOrder.getGoodsId()).getData(); |
| | | TCoupon coupon = couponClient.getCouponById1(exchangeOrder.getCouponId()).getData(); |
| | | info.setCouponType(coupon.getType()); |
| | | info.setDays(coupon.getDays()); |
| | | info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | |
| | | return R.ok(coupon); |
| | | } |
| | | |
| | | @PostMapping(value = "/getCouponById") |
| | | public R<TCoupon> getCouponById(@RequestParam("id") Integer id){ |
| | | TCoupon coupon = tCouponService.getById(id); |
| | | return R.ok(coupon); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(tags = {"管理后台-商品管理","小程序-兑换商城"},value = "商品查看详情") |
| | | @ApiOperation(tags = {"管理后台-商品管理"},value = "商品查看详情") |
| | | public AjaxResult<TGoods> getInfo(Integer id) { |
| | | return AjaxResult.ok(goodsService.getById(id)); |
| | | TGoods byId = goodsService.getById(id); |
| | | return AjaxResult.ok(byId); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getInfoByType") |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "商品查看详情") |
| | | public AjaxResult getInfoByType(Integer goodType,Integer id) { |
| | | if (goodType==1){ |
| | | TGoods byId = goodsService.getById(id); |
| | | return AjaxResult.ok(byId);} |
| | | else { |
| | | TCoupon byId = couponService.getById(id); |
| | | return AjaxResult.ok(byId); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | return AjaxResult.ok(goodsService.pageList1(appGoodQuery)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品检查数量") |
| | | @PostMapping(value = "/app/shop/check") |
| | | public R check(@RequestBody ExchangeDto exchangeDto) { |
| | | //检查当前用户积分是否够 |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | Integer point = 0; |
| | | |
| | | if (exchangeDto.getGoodType()==1) { |
| | | //查询当前商品信息 |
| | | TGoods good = goodsService.getById(exchangeDto.getGoodId()); |
| | | point = good.getRedeemPoints(); |
| | | //检查当前用户是否到达兑换上限 |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) { |
| | | return R.fail("当前用户已兑换"+count+"张"); |
| | | } |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | if (user.getPoints()<good.getRedeemPoints()){ |
| | | return R.fail("当前用户积分不足"); |
| | | } |
| | | }else { |
| | | TCoupon coupon = couponService.getById(exchangeDto.getGoodId()); |
| | | point = coupon.getRedeemPoints(); |
| | | |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { |
| | | return R.fail("当前用户已到达兑换"+coupon+"次"); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | |
| | | } |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品") |
| | | @PostMapping(value = "/app/shop") |
| | | public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { |
| | |
| | | //检查当前用户是否到达兑换上限 |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) { |
| | | return AjaxResult.error("当前用户已到达兑换上限"); |
| | | return AjaxResult.error("当前用户已兑换"+count+"张"); |
| | | } |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | if (user.getPoints()<good.getRedeemPoints()){ |
| | |
| | | |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { |
| | | return AjaxResult.error("当前用户已到达兑换上限"); |
| | | return AjaxResult.error("当前用户已到达兑换"+coupon+"次"); |
| | | } |
| | | } |
| | | exchangeDto.setPoint(point); |
| | | exchangeDto.setUserId(userId); |
| | | //生成积分兑换成功的订单 |
| | | R<Long> longR = orderClient.exchangeCreate(exchangeDto); |
| | | if (exchangeDto.getGoodType()==2) { |
| | |
| | | pointChangeDto.setPoints(point); |
| | | pointChangeDto.setRemark(longR.getData().toString()); |
| | | pointChangeDto.setType(6); |
| | | appUserClient.change(pointChangeDto); |
| | | appUserClient.changeDown(pointChangeDto); |
| | | return AjaxResult.success(); |
| | | |
| | | |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "会员信息", tags = {"小程序-个人中心"}) |
| | | @PostMapping("/vipInfo") |
| | | public AjaxResult<VipInfoDto> vipInfo() { |
| | | @GetMapping("/vipInfo") |
| | | public R<List<VipInfoDto>> vipInfo() { |
| | | List<VipInfoDto> vipInfoDtos = new ArrayList<>(); |
| | | List<TVip> vips = vipService.lambdaQuery().eq(TVip::getReveal, 1).list(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | for (TVip vip : vips) { |
| | | VipInfoDto vipInfoDto = new VipInfoDto(); |
| | | vipInfoDto.setMonthlyCard(vip.getMonthlyCardReveal()==1?vip.getMonthlyCard():null); |
| | | vipInfoDto.setSeasonCard(vip.getSeasonCardReveal()==1?vip.getSeasonCard():null); |
| | | vipInfoDto.setAnnualCard(vip.getAnnualCardReveal()==1?vip.getAnnualCard():null); |
| | | //判断是否在折扣时间内,然后设置折扣价格 |
| | | if (vip.getMonthlyCardDiscountStart()!=null&&(now.isAfter(vip.getMonthlyCardDiscountStart())&&now.isBefore(vip.getMonthlyCardDiscountEnd()))){ |
| | | vipInfoDto.setMonthlyCardDiscount(vip.getMonthlyCardDiscount()); |
| | | } |
| | | if (vip.getSeasonCardDiscountStart()!=null&&(now.isAfter(vip.getSeasonCardDiscountStart())&&now.isBefore(vip.getSeasonCardDiscountEnd()))){ |
| | | vipInfoDto.setSeasonCardDiscount(vip.getSeasonCardDiscount()); |
| | | } |
| | | if (vip.getAnnualCardDiscountStart()!=null&&(now.isAfter(vip.getAnnualCardDiscountStart())&&now.isBefore(vip.getAnnualCardDiscountEnd()))){ |
| | | vipInfoDto.setAnnualCardDiscount(vip.getAnnualCardDiscount()); |
| | | } |
| | | |
| | | |
| | | |
| | | vipInfoDto.setMaximumDeduction(vip.getMaximumDeduction()); |
| | | vipInfoDto.setDiscountTimes(vip.getDiscountTimes()); |
| | | vipInfoDto.setDoubleIntegration(vip.getDoubleIntegration()); |
| | | vipInfoDto.setMallExclusivePrice(vip.getMallExclusivePrice()); |
| | | vipInfoDto.setName(vip.getName()); |
| | | List<SendCouponDto> javaList = JSON.parseArray(vip.getCoupon()).toJavaList(SendCouponDto.class); |
| | | List<VipCouponDto> vipCouponDtos = new ArrayList<>(); |
| | | if (!javaList.isEmpty()){ |
| | |
| | | total = total.add(vip.getMaximumDeduction().multiply(BigDecimal.valueOf(vip.getDiscountTimes()))); |
| | | for (VipCouponDto vipCouponDto : vipCouponDtos) { |
| | | TCoupon tCoupon = vipCouponDto.getTCoupon(); |
| | | total.add(tCoupon.getDiscount()); |
| | | total.add(tCoupon.getMaximumDiscountAmount()); |
| | | } |
| | | vipInfoDto.setTotalDiscount(total); |
| | | vipInfoDto.setTimeAmount(vip.getMaximumDeduction().multiply(BigDecimal.valueOf(vip.getDiscountTimes()))); |
| | | vipInfoDtos.add(vipInfoDto); |
| | | } |
| | | return AjaxResult.success(vipInfoDtos); |
| | | return R.ok(vipInfoDtos); |
| | | } |
| | | |
| | | } |
| | |
| | | // 订单号加上商品类型 |
| | | String res = string+"-"+dto.getType(); |
| | | |
| | | List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setSalesCount(data.get(i)); |
| | | } |
| | | // List<Integer> data = orderClient.getSalesCountByGoodsId(res).getData(); |
| | | // for (int i = 0; i < list.size(); i++) { |
| | | // list.get(i).setSalesCount(data.get(i)); |
| | | // } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | |
| | | <select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods"> |
| | | SELECT |
| | | id,name,redeem_points,inventory,original_price,preferential_price,vip_price |
| | | id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture |
| | | FROM |
| | | t_goods |
| | | WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type} |
| | | UNION ALL |
| | | SELECT |
| | | id,name,redeem_points,inventory_quantity as inventory,payment_amount as preferential_price,vip_payment_amount as vip_price |
| | | id,name,redeem_points as redeemPoints,inventory_quantity as inventory,payment_amount as originalPrice,payment_amount as preferentiaPrice,vip_payment_amount as vipPrice,2 as goodType,cover_picture as coverPicture |
| | | FROM |
| | | t_coupon |
| | | WHERE `status`= 1 and del_flag = 0 and type = #{appGoodQuery.type} |
| | | WHERE `status`= 1 and del_flag = 0 and ways_to_obtain != #{appGoodQuery.type} |
| | | ORDER BY |
| | | CASE |
| | | |
| | | WHEN `inventory` = 0 THEN |
| | | 0 ELSE 1 |
| | | END DESC, |
| | | `redeem_points` ASC; |
| | | `redeemPoints` ASC |
| | | </select> |
| | | |
| | | </mapper> |