Merge remote-tracking branch 'origin/master'
| | |
| | | private Long userId; |
| | | @ApiModelProperty("预付价格") |
| | | private BigDecimal payMoney; |
| | | @ApiModelProperty("桩编号") |
| | | private Integer number; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.vo; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "CarListVO对象",description = "小程序-扫一扫选择车辆") |
| | | public class CarListVO { |
| | | |
| | | @ApiModelProperty(value = "图片") |
| | | private String reviewRate; |
| | | |
| | | @ApiModelProperty(value = "车型-车牌号") |
| | | private String evaluateCount; |
| | | @ApiModelProperty(value = "车辆id") |
| | | private Long driverId; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | private Integer isUse; |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private Long couponId; |
| | | @ApiModelProperty(value = "优惠券id") |
| | | private BigDecimal payMoney; |
| | | @ApiModelProperty(value = "最高折扣金额 用于判断哪一张优惠券优惠力度最大 前端忽略") |
| | | @ApiModelProperty(value = "使用了优惠券后的服务费 用于判断哪一张优惠券优惠力度最大 前端忽略") |
| | | private BigDecimal money; |
| | | @ApiModelProperty(value = "当前用户是否为会员0否1是 前端忽略") |
| | | private Integer isVip; |
| | |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "关联订单") |
| | | private String orderId; |
| | | @ApiModelProperty(value = "封面图") |
| | | private String coverPicture; |
| | | @ApiModelProperty(value = "详情图") |
| | | private String detailsPicture; |
| | | @ApiModelProperty(value = " 前端忽略 获取方式 1=积分兑换 2现金购买") |
| | | private Integer waysToObtain; |
| | | @ApiModelProperty(value = "优惠券id") |
| | |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(Integer siteId) { |
| | | return R.fail("通过站点id获取充电桩列表失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<BigDecimal> getServiceMoney(String param) { |
| | | return R.fail("根据会员折扣、预付金额 计算服务费失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @PostMapping(value = "/t-charging-pile/getChargingPileBySiteId") |
| | | public R<List<TChargingPile>> getChargingPileBySiteId(@RequestParam("siteId") Integer siteId); |
| | | |
| | | |
| | | /** |
| | | * 小程序远程调用 根据会员折扣、预付金额 计算服务费 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getServiceMoney") |
| | | public R<BigDecimal> getServiceMoney(@RequestParam("param") String param); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "充电车辆 id") |
| | | @TableField("app_user_car_id") |
| | | private Integer appUserCarId; |
| | | private Long appUserCarId; |
| | | |
| | | @ApiModelProperty(value = "站点 id") |
| | | @TableField("site_id") |
| | |
| | | @TableField("explain") |
| | | private String explain; |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | @TableField("cover_picture") |
| | | private String coverPicture; |
| | | @ApiModelProperty(value = "详情图片") |
| | | @TableField("details_picture") |
| | | private String detailsPicture; |
| | | |
| | | @ApiModelProperty(value = "说明") |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "状态(1=上架,2=下架)") |
| | | @TableField("status") |
| | | private Integer status; |
| | |
| | | @ApiModelProperty(value = "内部会员折扣") |
| | | @TableField("discount") |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "会员类型 1常规 2内部") |
| | | @ApiModelProperty(value = "添加的会员类型 1常规 2内部") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
New file |
| | |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import com.obs.services.ObsClient; |
| | | import com.obs.services.model.ObjectMetadata; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.UUID; |
| | | |
| | | public class ObsUploadUtil { |
| | | |
| | | public static String endPoint = "obs.cn-southwest-2.myhuaweicloud.com"; |
| | | public static String accessKeyId = "LP9N1TLAYN8ERS1PVIYK"; |
| | | public static String accessKeySecret = "bV55lFHi1cG0SYBvnab8yIgDX6etKRSLh5j1gkPR"; |
| | | public static String bucketName = "haitunyingyu"; |
| | | public static String oss_domain = "https://haitunyingyu.obs.cn-southwest-2.myhuaweicloud.com/"; |
| | | // 创建ObsClient实例 |
| | | public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | |
| | | public static String obsUpload(MultipartFile file) throws IOException{ |
| | | //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | String fileName = ""; |
| | | if(file!=null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename()!=null){ |
| | | InputStream content = file.getInputStream();//获得指定文件的输入流 |
| | | ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata |
| | | meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | String originalFilename = file.getOriginalFilename(); |
| | | if (originalFilename.contains("apk")){ |
| | | fileName = "bf2fe5c5499341e5bc0d56c0c7d5fb2e.apk"; |
| | | System.err.println("apk"); |
| | | }else{ |
| | | fileName = UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | } |
| | | obsClient.putObject(bucketName,"admin/"+fileName,content,meta);// 上传Object. |
| | | if(fileName != null && !"".equals(fileName)){ |
| | | System.out.println(fileName); |
| | | fileName = oss_domain+"admin/"+fileName; |
| | | } |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | /** |
| | | * 删除某个Object |
| | | * |
| | | * @param bucketUrl |
| | | * @return |
| | | */ |
| | | public static boolean deleteObject(String bucketUrl) { |
| | | try { |
| | | bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // 删除Object. |
| | | obsClient.deleteObject(bucketName, bucketUrl); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } finally { |
| | | //ossClient.shutdown(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // public static void createBucket(String bucketName) |
| | | // { |
| | | // //初始化 OSSClient |
| | | //// ossClient = new OssClient(endPoint, accessKeyId, accessKeySecret); |
| | | // |
| | | // // 新建一个Bucket |
| | | // Bucket bucket = ossClient.createBucket(bucketName); |
| | | // System.out.println(bucket.getName()); |
| | | // System.out.println(bucket.getCreationDate()); |
| | | // } |
| | | // |
| | | // public static void main(String[] args) { |
| | | // OssUploadUtil.createBucket("ssfdfsd"); |
| | | // } |
| | | } |
| | |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | |
| | | @ApiOperation(value = "选择优惠券分页查询", tags = {"小程序-扫一扫"}) |
| | | @PostMapping(value = "/scan/couponList") |
| | | public AjaxResult<PageInfo<CouponListVOVO>> couponList(@RequestBody CouponListDto dto) { |
| | | |
| | | PageInfo<CouponListVOVO> res = tAppCouponService.couponList(dto); |
| | | return AjaxResult.ok(res); |
| | | } |
| | | /** |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "选择车辆列表", tags = {"小程序-扫一扫"}) |
| | | @PostMapping(value = "/scan/carList") |
| | | public AjaxResult<CouponListVOVO> carList(@RequestBody CouponListDto dto) { |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 管理后台远程调用 根据优惠券ids 查询对应的发放数量 |
| | |
| | | import com.ruoyi.account.service.TAppCouponService; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | |
| | | PageInfo<CouponListVOVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<CouponListVOVO> list = this.baseMapper.couponList(pageInfo,dto.getUserId()); |
| | | TAppUser tAppUser = tAppUserMapper.selectById(dto.getUserId()); |
| | | Integer isVip = 0;// 是否能享受会员折扣 |
| | | Integer isVip = 0;// 是否能享受会员折扣 0否 1是普通会员 2内部会员 |
| | | // 会员折扣 |
| | | Double discount = 0.0; |
| | | // 普通会员最高折扣金额 |
| | | Double discountMoney = 0.0; |
| | | if (tAppUser.getVipEndTime() == null){ |
| | | // 不是会员 |
| | | isVip = 0; |
| | | }else { |
| | | // 判断会员有没有过期 |
| | | if (tAppUser.getVipEndTime().isAfter(java.time.LocalDateTime.now())){ |
| | |
| | | TVip data1 = vipClient.getInfo1(vipId).getData(); |
| | | Integer discountTimes = data1.getDiscountTimes(); |
| | | if (data>=discountTimes){ |
| | | // 不能再享受会员折扣 |
| | | // 折扣次数用光了 不能再享受会员折扣 |
| | | isVip = 0; |
| | | }else{ |
| | | isVip = 1; |
| | | if (data1.getType() == 2){ |
| | | // 如果内部会员 使用该折扣 |
| | | discount = data1.getDiscount().doubleValue(); |
| | | isVip = 2; |
| | | }else{ |
| | | // 普通会员 最高折扣金额 |
| | | discountMoney = data1.getMaximumDeduction().doubleValue(); |
| | | isVip = 1; |
| | | } |
| | | |
| | | } |
| | | }else{ |
| | | // 会员过期 不能享受 |
| | | isVip = 0; |
| | | } |
| | | } |
| | | for (CouponListVOVO couponListVOVO : list) { |
| | | couponListVOVO.setValidityTime("有效期:"+format.format(couponListVOVO.getCreateTime())+" - "+format.format(couponListVOVO.getEndTime())); |
| | | } |
| | | List<CouponListVOVO> data = otherClient.getCouponInfoByCouponIds(list).getData(); |
| | | // 桩编号 + 是否是会员 + 内部会员折扣 + 普通会员最高折扣金额 + 预付金额 |
| | | String temp = dto.getNumber()+"-"+isVip+"-"+discount+"-"+discountMoney+"-"+dto.getPayMoney(); |
| | | // 根据当前时间段和预付金额计算服务费 |
| | | BigDecimal serviceMoney = chargingPileClient.getServiceMoney(temp).getData(); |
| | | for (CouponListVOVO datum : data) { |
| | | // 根据当前时间段和预付金额计算服务费 |
| | | |
| | | // 判断优惠券类型 |
| | | switch (datum.getPreferentialMode()){ |
| | | case 1: |
| | | datum.setIsUse(1); |
| | | // 满减券 判断服务费是否满足满减条件 |
| | | if (datum.getMeetTheConditions().compareTo(new BigDecimal(BigInteger.ZERO)) == 0){ |
| | | // 无门槛优惠券 |
| | | datum.setMoney(serviceMoney.subtract(datum.getDiscountAmount())); |
| | | }else if (serviceMoney.compareTo(datum.getMeetTheConditions())>=0){ |
| | | // 满足条件 |
| | | datum.setMoney(serviceMoney.subtract(datum.getDiscountAmount())); |
| | | }else{ |
| | | // 不满足条件 |
| | | datum.setMoney(serviceMoney); |
| | | datum.setIsUse(0); |
| | | } |
| | | break; |
| | | case 2: |
| | | datum.setIsUse(1); |
| | | // 折扣券 判断 |
| | | if (datum.getMeetTheConditions().compareTo(new BigDecimal(BigInteger.ZERO)) == 0){ |
| | | // 无门槛优惠券 |
| | | datum.setMoney(serviceMoney.subtract(datum.getDiscountAmount())); |
| | | }else if (serviceMoney.compareTo(datum.getMeetTheConditions())>=0){ |
| | | // 折扣后的服务费 |
| | | BigDecimal divide = serviceMoney.multiply(datum.getDiscount()).divide(new BigDecimal(10), 2, BigDecimal.ROUND_HALF_UP); |
| | | // 计算折扣了多少钱 判断是否超过最高折扣金额 |
| | | BigDecimal subtract = serviceMoney.subtract(divide); |
| | | if (subtract.compareTo(datum.getMaximumDiscountAmount())>0){ |
| | | // 超过最高折扣金额 减去最高折扣金额 |
| | | datum.setMoney(serviceMoney.subtract(datum.getMaximumDiscountAmount())); |
| | | }else{ |
| | | // 没超过最高折扣金额 |
| | | datum.setMoney(divide); |
| | | } |
| | | }else{ |
| | | // 不满足条件 |
| | | datum.setMoney(serviceMoney); |
| | | datum.setIsUse(0); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | // 通过集合的money字段 将money从大到小排序 |
| | | data.sort(Comparator.comparing(CouponListVOVO::getMoney).reversed()); |
| | | pageInfo.setRecords(data); |
| | | return pageInfo; |
| | | } |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.chargingPile.api.dto.TAccountingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.model.TCarport; |
| | | import com.ruoyi.chargingPile.api.model.TVehicleRamp; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.TAccountingStrategyQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | private final TAccountingStrategyService accountingStrategyService; |
| | | private final TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | @Autowired |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | |
| | | return AjaxResult.ok(accountingStrategyService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 小程序远程调用 根据会员折扣、预付金额 计算服务费 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getServiceMoney") |
| | | public R<BigDecimal> getServiceMoney(@RequestParam("param") String param){ |
| | | // 桩编号 + 是否是会员 + 内部会员折扣金额 + 普通会员最高折扣金额 + 预付金额 |
| | | String[] split = param.split("-"); |
| | | // 根据桩编号 查询电站 |
| | | TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getNumber, split[0]).one(); |
| | | Site byId = siteService.getById(one.getSiteId()); |
| | | // 计费策略 |
| | | TAccountingStrategy one1 = accountingStrategyService.lambdaQuery().eq(TAccountingStrategy::getSiteId, byId.getId()) |
| | | .eq(TAccountingStrategy::getAuditStatus, 3).one(); |
| | | // 会员折扣 |
| | | BigDecimal discount = one1.getDiscount(); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, one1.getId()) |
| | | .list(); |
| | | // 当前时间属于哪个计费策略 |
| | | LocalTime now = LocalTime.now(); |
| | | // 电价 |
| | | BigDecimal electronic = new BigDecimal(BigInteger.ZERO); |
| | | // 最终服务费 |
| | | BigDecimal serviceMoney = new BigDecimal(BigInteger.ZERO); |
| | | // 预付金额 |
| | | BigDecimal beforeMoney = new BigDecimal(split[4]); |
| | | // 普通会员最高折扣金额 |
| | | BigDecimal discountMoney = new BigDecimal(split[3]); |
| | | // 内部会员折扣 |
| | | BigDecimal discountInner = new BigDecimal(split[2]); |
| | | // 最终服务费 |
| | | BigDecimal res = new BigDecimal(BigInteger.ZERO); |
| | | for (TAccountingStrategyDetail tAccountingStrategyDetail : list) { |
| | | if (now.isAfter(LocalTime.parse(tAccountingStrategyDetail.getStartTime())) && now.isBefore(LocalTime.parse(tAccountingStrategyDetail.getEndTime()))){ |
| | | electronic = tAccountingStrategyDetail.getElectrovalence(); |
| | | // 非会员下的服务费 |
| | | BigDecimal multiply = beforeMoney.multiply(tAccountingStrategyDetail.getServiceCharge()).divide(electronic, 2, RoundingMode.HALF_UP); |
| | | if (byId.getBusinessCategory() == 1){ |
| | | // 直营才享受会员折扣 |
| | | // 根据电价和预付金额 是否有会员折扣 计算最终服务费 |
| | | if (split[1].equals("1")){ |
| | | // 抵扣金额 |
| | | BigDecimal multiply1 = multiply.multiply(discount); |
| | | if (multiply1.compareTo(discountMoney)>0){ |
| | | multiply1 = discountMoney; |
| | | } |
| | | // 普通最终服务费 |
| | | res = multiply.subtract(multiply1); |
| | | } |
| | | if (split[1].equals("2")){ |
| | | // 内部会员折扣 最终服务费 |
| | | res = discountInner.multiply(multiply); |
| | | } |
| | | }else{ |
| | | // 非直营 |
| | | res = multiply; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | return R.ok(res); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | /** |
| | | * 查询用户最近一次充电记录使用的车辆 |
| | | * @param |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getCar") |
| | | public R<Long> getCar() { |
| | | // todo 获取用户id |
| | | List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getAppUserId, 11) |
| | | .isNotNull(TChargingOrder::getAppUserCarId)); |
| | | if (!list.isEmpty()){ |
| | | // 最近使用的车辆id |
| | | Long size = list.get(0).getAppUserCarId(); |
| | | return R.ok(size); |
| | | }else{ |
| | | return R.ok(-1L); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询会员在本月有多少次享受了充电折扣 |
New file |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.utils.ObsUploadUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | @RestController |
| | | @RequestMapping("/base/oss") |
| | | @Api(value = "文件上传", tags = "文件上传", description = "文件上传") |
| | | public class OssController { |
| | | private static final String endpoint = "obs.cn-north-4.myhuaweicloud.com"; |
| | | private static final String accessKeyId = "DRJFJRVQ9KVLQUSJUROI"; |
| | | private static final String accessKeySecret = "3zpPkULh0a8CTTYjKL4f7szQZECkvVol4SwNab0f"; |
| | | private static final String bucketName = "jkjianshen"; |
| | | @PostMapping("/upload") |
| | | @ApiOperation(value = "文件上传") |
| | | public String upload(@RequestParam("file") MultipartFile file) throws IOException { |
| | | String s = ObsUploadUtil.obsUpload(file); |
| | | return s; |
| | | } |
| | | // @PostMapping("/uploadVideo") |
| | | // @ApiOperation(value = "视频上传",tags = "文件上传") |
| | | // public String uploadVideo(@RequestParam("file") MultipartFile file) throws Exception { |
| | | // // 获取文件名 |
| | | // String fileName = file.getOriginalFilename(); |
| | | // // 构建目标文件路径 |
| | | // String filePath = "/usr/local/temp" + fileName; |
| | | //// String filePath = "C:/temp/" + fileName; |
| | | // // 创建目标文件对象 |
| | | // File targetFile = new File(filePath); |
| | | // // 将 MultipartFile 内容写入目标文件 |
| | | // try (FileOutputStream fos = new FileOutputStream(targetFile)) { |
| | | // fos.write(file.getBytes()); |
| | | // } |
| | | // String s = UploadVideoUtil.endUpload(targetFile.toString(), UUIDUtil.getRandomCode(5)+fileName); |
| | | // // 创建要删除的文件对象 |
| | | // File fileToDelete = new File(targetFile.toString()); |
| | | // // 检查文件是否存在,并删除文件 |
| | | // if (fileToDelete.exists()) { |
| | | // fileToDelete.delete(); |
| | | // } |
| | | // return s; |
| | | // } |
| | | |
| | | // @PostMapping("/upload") |
| | | // @ApiOperation(value = "文件上传",tags = "文件上传") |
| | | // public ResponseEntity<String> upload(@RequestParam("file") MultipartFile file) throws IOException { |
| | | // // 创建 OSSClient 实例 |
| | | // OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret); |
| | | // |
| | | // |
| | | // // 创建 PutObjectRequest 对象 |
| | | // PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, file.getOriginalFilename(), file.getInputStream()); |
| | | // |
| | | // ObjectMetadata metadata = new ObjectMetadata(); |
| | | // // 取消文件缓存,文件每次都会从OSS服务器获取 |
| | | // metadata.setHeader("Cache-Control", "no-cache"); |
| | | // metadata.setHeader("Expires", "0"); |
| | | // |
| | | // |
| | | // // 上传文件 |
| | | // PutObjectResult putObjectResult = ossClient.putObject(putObjectRequest); |
| | | // |
| | | // // 关闭 OSSClient 实例 |
| | | // ossClient.shutdown(); |
| | | // |
| | | // String fileUrl = "https://" + bucketName + "." + endpoint + "/" + file.getOriginalFilename(); |
| | | // return ResponseEntity.ok(fileUrl); |
| | | // } |
| | | |
| | | |
| | | } |
| | |
| | | }else{ |
| | | record.setMeetTheConditions("满"+byId.getMeetTheConditions()+"元可用"); |
| | | } |
| | | record.setCoverPicture(byId.getCoverPicture()); |
| | | record.setDetailsPicture(byId.getDetailsPicture()); |
| | | } |
| | | } |
| | | return AjaxResult.ok(data); |
| | |
| | | @Autowired |
| | | private TIntegralRuleService integralRuleService; |
| | | @GetMapping("/getSet") |
| | | @ApiOperation(value = "获取积分设置") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "获取积分设置") |
| | | public R<TIntegralRule> getSet() { |
| | | TIntegralRule res = integralRuleService.getOne(new QueryWrapper<>()); |
| | | return R.ok(res); |
| | | } |
| | | @PostMapping("/saveSet") |
| | | @ApiOperation(value = "保存积分设置") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分设置") |
| | | public R saveSet(@RequestBody TIntegralRule dto) { |
| | | integralRuleService.updateById(dto); |
| | | return R.ok(); |
| | | } |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(value = "type 1=积分规则说明," + |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "type 1=积分规则说明," + |
| | | "2=会员折扣说明," + |
| | | "3=优惠券说明," + |
| | | "4=双倍积分说明," + |
| | |
| | | return R.ok(g.getContent()); |
| | | } |
| | | @GetMapping("/saveInfo") |
| | | @ApiOperation(value = "保存积分说明") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分说明") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "info", value = "内容", required = true), |
| | | @ApiImplicitParam(name = "type", value = "type 1=积分规则说明,\" +\n" + |
| | |
| | | @Autowired |
| | | private TVipService vipService; |
| | | @PostMapping("/saveVip") |
| | | @ApiOperation(value = "会员添加") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员添加") |
| | | public AjaxResult saveVip(@RequestBody TVip dto) { |
| | | vipService.save(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/delete") |
| | | @ApiOperation(value = "会员删除") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员删除") |
| | | public AjaxResult delete(Integer id) { |
| | | vipService.removeById(id); |
| | | return AjaxResult.success(); |
| | | } |
| | | @PostMapping("/updateVip") |
| | | @ApiOperation(value = "会员修改") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员修改") |
| | | public AjaxResult updateVip(@RequestBody TVip dto) { |
| | | vipService.updateById(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(value = "会员查看详情") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员查看详情") |
| | | public AjaxResult<TVip> getInfo(Integer id) { |
| | | return AjaxResult.ok(vipService.getById(id)); |
| | | } |
| | |
| | | public R<TVip> getInfo1(@RequestParam("id")Integer id) { |
| | | return R.ok(vipService.getById(id)); |
| | | } |
| | | @ApiOperation(value = "会员列表分页查询") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "pageCurr", value = "分页参数,当前页码", required = true), |
| | |
| | | <result column="double_integration" property="doubleIntegration" /> |
| | | <result column="mall_exclusive_price" property="mallExclusivePrice" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="discount" property="discount" /> |
| | | <result column="type" property="type" /> |
| | | <result column="del_flag" property="delFlag" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, name, reveal, monthly_card, monthly_card_reveal, monthly_card_discount, monthly_card_discount_start, monthly_card_discount_end, monthly_card_discount_reveal, season_card, season_card_reveal, season_card_discount, season_card_discount_start, season_card_discount_end, season_card_discount_reveal, annual_card, annual_card_reveal, annual_card_discount, annual_card_discount_start, annual_card_discount_end, annual_card_discount_reveal, discount_times, maximum_deduction, deduction_type, coupon, double_integration, mall_exclusive_price, create_time, del_flag |
| | | ,discount, type |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.other.api.domain.TVip"> |
| | | select * from t_vip |