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; |
| | | } |
| | |
| | | |
| | | @Data |
| | | public class ListInfoCouponDto { |
| | | List<InfoCouponDto> infoCouponDtoList1; |
| | | List<InfoCouponDto> infoCouponDtoList2; |
| | | 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); |
| | | |
| | | /** |
| | | * 通过手机号查询用户 |
| | |
| | | |
| | | @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; |
| | | } |
| | |
| | | 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); |
| | | |
| | | |
| | |
| | | InfoCouponDto infoCouponDto = new InfoCouponDto(); |
| | | BeanUtils.copyProperties(coupon, infoCouponDto); |
| | | infoCouponDto.setId(tAppCoupon.getId()); |
| | | infoCouponDto.setEndTime(tAppCoupon.getEndTime()); |
| | | couponDtos1.add(infoCouponDto); |
| | | |
| | | } |
| | |
| | | InfoCouponDto infoCouponDto = new InfoCouponDto(); |
| | | BeanUtils.copyProperties(coupon, infoCouponDto); |
| | | infoCouponDto.setId(tAppCoupon.getId()); |
| | | infoCouponDto.setEndTime(tAppCoupon.getEndTime()); |
| | | couponDtos2.add(infoCouponDto); |
| | | } |
| | | for (TAppCoupon tAppCoupon : list2) { |
| | |
| | | InfoCouponDto infoCouponDto = new InfoCouponDto(); |
| | | BeanUtils.copyProperties(coupon, infoCouponDto); |
| | | infoCouponDto.setId(tAppCoupon.getId()); |
| | | infoCouponDto.setEndTime(tAppCoupon.getEndTime()); |
| | | couponDtos2.add(infoCouponDto); |
| | | } |
| | | |
| | | |
| | | ListInfoCouponDto listInfoCouponDto = new ListInfoCouponDto(); |
| | | listInfoCouponDto.setInfoCouponDtoList1(couponDtos1); |
| | | listInfoCouponDto.setInfoCouponDtoList2(couponDtos2); |
| | | 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) { |
| | |
| | | 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 < split1.length; i++) { |
| | | Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>() |
| | | .eq("order_type",1) |
| | | .ne("status",4) |
| | | .eq("goods_id", split[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){ |
| | |
| | | time += between; |
| | | } |
| | | // 总收入 |
| | | if (chargingOrderVO.getRefundStatus() == 2){ |
| | | if (chargingOrderVO.getRefundStatus() !=null && chargingOrderVO.getRefundStatus() == 2){ |
| | | income = income.add(chargingOrderVO.getPaymentAmount().subtract(chargingOrderVO.getRefundAmount())); |
| | | }else{ |
| | | if (chargingOrderVO.getPaymentAmount()!=null){ |
| | | income = income.add(chargingOrderVO.getPaymentAmount()); |
| | | } |
| | | } |
| | | for (TChargingOrderAccountingStrategy tChargingOrderAccountingStrategy : chargingOrderId) { |
| | | // 累计电费 |
| | |
| | | // 车牌号 |
| | | chargingOrderVO.setPhone(data.getPhone()); |
| | | List<Long> longs = new ArrayList<>(); |
| | | 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); |
| | | tCharingOrderVO.setTime(time); |
| | |
| | | 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"))); |
| | |
| | | |
| | | |
| | | @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); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | <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 original_price,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> |