Merge remote-tracking branch 'origin/master'
1 文件已重命名
28个文件已修改
1个文件已添加
| | |
| | | public R grantCoupon(GrantCouponDto dto) { |
| | | return R.fail("给用户发放优惠券:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R refund(String id) { |
| | | return R.fail("后台退款 退回优惠券失败:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R refundPoints(String param) { |
| | | return R.fail("后台兑换订单退款回退用户积分失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TAppUser>> getUserByIds(List<Long> appUserIds) { |
| | | return R.fail("根据用户id查询用户信息失败:"+throwable.getMessage()); |
| | | } |
| | |
| | | */ |
| | | @PostMapping("/t-app-coupon/grantCoupon") |
| | | R grantCoupon(@RequestBody GrantCouponDto dto); |
| | | @PostMapping(value = "/t-app-coupon/refund/{id}") |
| | | R refund(@PathVariable("id") String id); |
| | | } |
| | |
| | | */ |
| | | @GetMapping("/t-app-user/user/selectByPhone") |
| | | R<TAppUser> selectByPhone(@RequestParam("phone") String phone); |
| | | /** |
| | | * 远程调用 积分兑换订单 退款回退积分 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user/refundPoints/{param}") |
| | | public R refundPoints(@PathVariable("param")String param); |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.dto; |
| | | |
| | | import com.ruoyi.chargingPile.api.model.TApplyChargingPile; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TApplyChargingPileDTO对象",description = "申请建桩") |
| | | public class TApplyChargingPileDTO extends TApplyChargingPile { |
| | | |
| | | @ApiModelProperty(value = "验证码") |
| | | private String code; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "充电枪总数数量") |
| | | private Integer totalCount; |
| | | |
| | | public ChargingGunCountVO(Integer freeCount, Integer totalCount) { |
| | | this.freeCount = freeCount; |
| | | this.totalCount = totalCount; |
| | | } |
| | | public ChargingGunCountVO() { |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | |
| | | public void close(String outTradeNo) { |
| | | throw new RuntimeException("关闭支付订单失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<RefundResp> refund(RefundReq dto) { |
| | | throw new RuntimeException("支付宝退款失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.vo.NotifyV3PayDecodeRespBody; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import org.slf4j.Logger; |
| | |
| | | public void close(String outTradeNo) { |
| | | throw new RuntimeException("关闭支付订单失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> refundOrderR(WxPaymentRefundModel model) { |
| | | return R.fail("微信退款失败:" + throwable.getMessage()); |
| | | |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.payment.api.factory.WxPaymentFallbackFactory; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | */ |
| | | @PostMapping("/ali/close") |
| | | void close(String outTradeNo); |
| | | /** |
| | | * 后台退款 远程调用 |
| | | */ |
| | | @PostMapping("/ali/refund") |
| | | public R<RefundResp> refund(@RequestBody RefundReq dto); |
| | | } |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.payment.api.factory.WxPaymentFallbackFactory; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.vo.NotifyV3PayDecodeRespBody; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | */ |
| | | @PostMapping("/wx/pay/close") |
| | | void close(String outTradeNo); |
| | | |
| | | @ApiOperation("订单退款") |
| | | @PostMapping(value = "/wx/refundOrderR") |
| | | public R<String> refundOrderR(@RequestBody WxPaymentRefundModel model); |
| | | } |
File was renamed from ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/model/WxPaymentRefundModel.java |
| | |
| | | package com.ruoyi.payment.wx.model; |
| | | package com.ruoyi.payment.api.model; |
| | | |
| | | import lombok.*; |
| | | |
| | |
| | | public static final String DATE_FORMATTER_TIME = "yyyy-MM-dd HH:mm:ss"; |
| | | public static final String DATE_FORMATTER_DATE = "yyyy-MM-dd"; |
| | | /** |
| | | * 后缀 |
| | | * 修改手机号后缀 |
| | | */ |
| | | public static final String APPLET = "_applet"; |
| | | public static final String UPDATE_PHONE = "_updatePhone"; |
| | | /** |
| | | * 申请建桩后缀 |
| | | */ |
| | | public static final String APPLY_CHARGING = "_applyCharging"; |
| | | /** |
| | | * 定时任务违规的字符 |
| | | */ |
| | |
| | | public static final String SEND_URL = "http://112.35.1.155:1992/sms/tmpsubmit"; |
| | | /** 更换手机号短信验证码 TEMPLATE_ID */ |
| | | public static final String CODE_TEMPLATE_ID = "5bf3949463e54c03a25c6fce3ad48139"; |
| | | /** 建桩申请短信验证码 TEMPLATE_ID */ |
| | | public static final String APPLY_TEMPLATE_ID = "44ac24b86a9f4dd6bee41577e2703472"; |
| | | |
| | | /** 停车占位提醒 TEMPLATE_ID */ |
| | | public static final String STOP_TEMPLATE_ID = "4940ce98a3f94f67aa9f5cd2d4e05cbd"; |
| | |
| | | public static final String FAULT_TEMPLATE_ID = "37956469a14a47e484a747a1e7e462de"; |
| | | /** 更换手机号短信验证码 AP_ID */ |
| | | public static final String CODE_AP_ID = "GH123"; |
| | | /** 建桩短信验证码 AP_ID */ |
| | | public static final String APPLY_AP_ID = "JZ123"; |
| | | |
| | | /** 停车占位提醒 AP_ID */ |
| | | public static final String STOP_AP_ID = "TC123"; |
| | |
| | | return encode; |
| | | } |
| | | |
| | | /** |
| | | * 更换手机号:【签名】验证码:XXX,用于更换手机号。请勿转发。 |
| | | * @param phone 手机号 |
| | | * @param code 验证码 |
| | | * @return |
| | | */ |
| | | public static String applyCodeMsg(String phone,String code){ |
| | | SubmitTempletReq submitReq = new SubmitTempletReq(); |
| | | String[] paramss = {code}; |
| | | submitReq.setApId(MsgConstants.APPLY_AP_ID); |
| | | submitReq.setEcName(ecName); |
| | | submitReq.setSecretKey(secretKey); |
| | | submitReq.setParams(JSON.toJSONString(paramss)); |
| | | submitReq.setMobiles(phone); |
| | | submitReq.setAddSerial(""); |
| | | submitReq.setSign(sign); |
| | | submitReq.setTemplateId(MsgConstants.APPLY_TEMPLATE_ID); |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | stringBuffer.append(submitReq.getEcName()); |
| | | stringBuffer.append(submitReq.getApId()); |
| | | stringBuffer.append(submitReq.getSecretKey()); |
| | | stringBuffer.append(submitReq.getTemplateId()); |
| | | stringBuffer.append(submitReq.getMobiles()); |
| | | stringBuffer.append(submitReq.getParams()); |
| | | stringBuffer.append(submitReq.getSign()); |
| | | stringBuffer.append(submitReq.getAddSerial()); |
| | | submitReq.setMac(MD5Util.getMD5(stringBuffer.toString())); |
| | | String reqText = JSON.toJSONString(submitReq); |
| | | //加密 |
| | | String encode = Base64.encodeBase64String(reqText.getBytes()); |
| | | System.err.println(encode); |
| | | return encode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 停车占位提醒:车辆已在3小时前完成充电,请及时取车,避免长时间占用充电资源。 |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | |
| | | |
| | | /** |
| | | * 后台退款 回退优惠券使用状态 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/refund/{id}") |
| | | public R refund(@PathVariable("id") String id) { |
| | | TAppCoupon byId = tAppCouponService.getById(id); |
| | | byId.setStatus(1); |
| | | tAppCouponService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 小程序扫一扫 添加车辆 |
| | | * @param dto |
| | |
| | | return R.ok(tAppCouponService.pagelist(couponId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "优惠卷可用数量", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping(value = "/couponCount") |
| | | public R<Long> couponCount() { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | return R.ok(tAppCouponService.lambdaQuery().le(TAppCoupon::getStartTime, now).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, 1).count()); |
| | | } |
| | | |
| | | @Autowired |
| | | private TAppUserTagService appUserTagService; |
| | | @Autowired |
| | |
| | | private TInviteUserService inviteUserService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 远程调用 积分兑换订单 退款回退积分 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/refundPoints/{param}") |
| | | public R refundPoints(@PathVariable("param")String param) { |
| | | String[] split = param.split("-"); |
| | | String userId = split[0]; |
| | | String points = split[1]; |
| | | TAppUser byId = appUserService.getById(userId); |
| | | byId.setPoints(byId.getPoints()+Integer.parseInt(points)); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询当前用户是否为会员 0否1是", tags = {"小程序--查询当前用户是否为会员"}) |
| | | @PostMapping(value = "/getUserInfo") |
| | |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | |
| | | @ApiOperation(value = "优惠卷详情(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | @PostMapping(value = "/user/coupon/getById") |
| | | public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { |
| | | TAppCoupon appCoupon = appCouponService.getById(id); |
| | |
| | | @ApiOperation(value = "更换手机号", tags = {"小程序-用户管理-更换手机号"}) |
| | | @PostMapping(value = "/user/updatePhone") |
| | | public AjaxResult<String> updatePhone(@Validated @RequestBody UpdatePhoneDTO dto) { |
| | | String code = redisService.getCacheObject(dto.getPhone() + Constants.APPLET); |
| | | String code = redisService.getCacheObject(dto.getPhone() + Constants.UPDATE_PHONE); |
| | | if(StringUtils.isEmpty(code)){ |
| | | return AjaxResult.error("验证码已过期,请重新获取验证码!"); |
| | | } |
| | |
| | | return AjaxResult.error("该手机号已绑定账号"); |
| | | } |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.APPLET,code,5L, TimeUnit.MINUTES); |
| | | redisService.setCacheObject(phone+ Constants.UPDATE_PHONE,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.codeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | /** |
| | | * 获取验证码 |
| | | * |
| | | * @param phone 手机号 |
| | | * @return 结果 |
| | | */ |
| | | @ApiOperation(value = "获取验证码",notes = "获取验证码",tags = {"申请建桩"}) |
| | | @GetMapping("getApplyCode") |
| | | public AjaxResult getApplyCode(@RequestParam("phone") String phone) |
| | | { |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.APPLY_CHARGING,code,5L, TimeUnit.MINUTES); |
| | | String reqStr = MsgUtil.applyCodeMsg(phone, code); |
| | | String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | // 记录短信发送 |
| | | chargingPileNotificationService.saveData(1,null,null,phone,"验证码:"+code+",用于申请建桩。请勿转发。"); |
| | | return AjaxResult.success(result); |
| | | } |
| | | |
| | | } |
| | |
| | | @ApiOperation(value = "获取站点下充电桩及充电枪列表", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping("/getChargingGunList") |
| | | public AjaxResult<List<TChargingPileVO>> getChargingGunList(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId, |
| | | @RequestParam(value = "siteId",required = false)@ApiParam(value = "类型 1=超充,2=快充,3=慢充")Integer type){ |
| | | @RequestParam(value = "type",required = false)@ApiParam(value = "类型 1=超充,2=快充,3=慢充")Integer type){ |
| | | return AjaxResult.success(chargingPileService.getChargingGunList(siteId,type)); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | @RequestMapping("/t-accounting-strategy-detail") |
| | | public class TAccountingStrategyDetailController { |
| | | |
| | | private final ISiteService siteService; |
| | | private final TAccountingStrategyService accountingStrategyService; |
| | | private final TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyDetailController(TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | public TAccountingStrategyDetailController(ISiteService siteService, TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | | this.siteService = siteService; |
| | | this.accountingStrategyService = accountingStrategyService; |
| | | this.accountingStrategyDetailService = accountingStrategyDetailService; |
| | | } |
| | |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过站点id查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailBySiteId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailBySiteId(@RequestParam("siteId") Integer siteId) { |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getSiteId, siteId) |
| | | .last("limit 1")); |
| | | Site site = siteService.getById(siteId); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.chargingPile.api.dto.ApplyChargingQuery; |
| | | import com.ruoyi.chargingPile.api.dto.ApplyChargingRemarkDto; |
| | | import com.ruoyi.chargingPile.api.dto.TApplyChargingPileDTO; |
| | | import com.ruoyi.chargingPile.api.model.TApplyChargingPile; |
| | | import com.ruoyi.chargingPile.dto.TApplyChargingPileExportDto; |
| | | import com.ruoyi.chargingPile.service.TApplyChargingPileService; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.codec.CharEncoding; |
| | |
| | | |
| | | private final TApplyChargingPileService applyChargingPileService; |
| | | private final TokenService tokenService; |
| | | private final RedisService redisService; |
| | | |
| | | @Autowired |
| | | public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService, TokenService tokenService) { |
| | | public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService, TokenService tokenService, RedisService redisService) { |
| | | this.applyChargingPileService = applyChargingPileService; |
| | | this.tokenService = tokenService; |
| | | this.redisService = redisService; |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "建桩申请", businessType = BusinessType.INSERT,operatorType = OperatorType.MOBILE) |
| | | @ApiOperation(tags = {"小程序-建桩申请"},value = "建桩申请") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TApplyChargingPile dto) { |
| | | public AjaxResult<Boolean> add(@RequestBody TApplyChargingPileDTO dto) { |
| | | // 验证验证码 |
| | | String code = redisService.getCacheObject(dto.getLandlordPhone() + Constants.APPLY_CHARGING); |
| | | if(StringUtils.isEmpty(code)){ |
| | | return AjaxResult.error("验证码已过期,请重新获取验证码!"); |
| | | } |
| | | if(!code.equals(dto.getCode())){ |
| | | return AjaxResult.error("验证码错误!"); |
| | | } |
| | | // 用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | dto.setAppUserId(userId); |
| | |
| | | * 查询充电桩列表 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-充电桩"},value = "通过站点id查询充电桩列表") |
| | | @PostMapping(value = "/list") |
| | | @GetMapping(value = "/list") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "siteId", value = "站点id") |
| | | }) |
| | |
| | | accountingStrategyDetailVO.setEndTime("23:59:59".equals(accountingStrategyDetailVO.getEndTime())? "00:00":accountingStrategyDetailVO.getEndTime()); |
| | | accountingStrategyDetailNext = list.stream().filter(detail -> detail.getStartTime().compareTo(accountingStrategyDetailVO.getEndTime()) == 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | accountingStrategyDetailVO.setDiscount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(vip.getDiscount())); |
| | | accountingStrategyDetailNext.setDiscount(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(vip.getDiscount())); |
| | | if(Objects.nonNull(vip)) { |
| | | if (vip.getType() == 2) { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(vip.getDiscount())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(vip.getDiscount())); |
| | | } else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | } |
| | | }else { |
| | | accountingStrategyDetailVO.setDiscount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailNext.setDiscount(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge())); |
| | | } |
| | | list = new ArrayList<>(); |
| | | list.add(accountingStrategyDetailVO); |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.ChargingGunCountVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | |
| | | import com.ruoyi.chargingPile.mapper.TChargingGunMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.enums.status.ChargingGunModeEnum; |
| | | import com.ruoyi.common.core.enums.status.ChargingGunStatusEnum; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Autowired |
| | | private TChargingPileService chargingPileService; |
| | | |
| | | |
| | | |
| | |
| | | @Override |
| | | public Map<String, ChargingGunCountVO> getChargingGunCount(Integer siteId) { |
| | | Map<String, ChargingGunCountVO> map = new HashMap<>(4); |
| | | //查询充电桩 |
| | | List<TChargingPile> pileList = chargingPileService.list(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getSiteId, siteId)); |
| | | if(CollectionUtils.isEmpty(pileList)){ |
| | | map.put("superSufficient", new ChargingGunCountVO(0,0)); |
| | | map.put("fastSufficient", new ChargingGunCountVO(0,0)); |
| | | map.put("slowSufficient", new ChargingGunCountVO(0,0)); |
| | | map.put("totalSufficient", new ChargingGunCountVO(0,0)); |
| | | return map; |
| | | } |
| | | Set<Integer> pileIds = pileList.stream().map(TChargingPile::getId).collect(Collectors.toSet()); |
| | | // 查询全部充电枪 |
| | | List<TChargingGun> list = this.list(Wrappers.lambdaQuery(TChargingGun.class).eq(TChargingGun::getSiteId, siteId)); |
| | | List<TChargingGun> list = this.list(Wrappers.lambdaQuery(TChargingGun.class).eq(TChargingGun::getSiteId, siteId) |
| | | .in(TChargingGun::getChargingPileId, pileIds)); |
| | | int freeCount = 0; |
| | | // 超级充 |
| | | ChargingGunCountVO superSufficient = getGunCount(ChargingGunModeEnum.SUPER_SUFFICIENT.getCode(), list); |
| | |
| | | @Override |
| | | public List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type) { |
| | | List<TChargingPileVO> chargingPileVOS = this.baseMapper.getChargingGunList(siteId); |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getSiteId, siteId) |
| | | .eq(TChargingGun::getChargeMode, type)); |
| | | LambdaQueryWrapper<TChargingGun> wrapper = new LambdaQueryWrapper<>(); |
| | | if(Objects.nonNull(type)){ |
| | | wrapper.eq(TChargingGun::getChargeMode, type); |
| | | } |
| | | wrapper.eq(TChargingGun::getSiteId, siteId); |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(wrapper); |
| | | // 查询充电枪信息 |
| | | chargingPileVOS.forEach(item -> { |
| | | item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList())); |
| | |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.Api; |
| | |
| | | private GoodsClient goodsClient; |
| | | @Resource |
| | | private CouponClient couponClient; |
| | | |
| | | |
| | | @PostMapping("/getExchangeOrderList") |
| | | @ApiOperation(value = "列表查询", tags = {"管理后台-兑换订单"}) |
| | |
| | | public AjaxResult cancelShoppingOrder(String id) { |
| | | TExchangeOrder byId = exchangeOrderService.getById(id); |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | // todo 根据支付方式 取消订单 |
| | | byId.setCancellationId(userid); |
| | | byId.setCancellationTime(LocalDateTime.now()); |
| | | byId.setStatus(4); |
| | | exchangeOrderService.updateById(byId); |
| | | // 回退积分 |
| | | Integer points = byId.getPoints(); |
| | | appUserClient.refundPoints(byId.getAppUserId()+"-"+points); |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/consignerShoppingOrder") |
| | |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.Api; |
| | |
| | | } |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | @Resource |
| | | private AppCouponClient appCouponClient; |
| | | @GetMapping("/cancelShoppingOrder") |
| | | @ApiOperation(value = "取消订单", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult cancelShoppingOrder(String id) { |
| | |
| | | switch (byId.getPaymentType()){ |
| | | case 1: |
| | | // 微信 |
| | | WxPaymentRefundModel wxPaymentRefundModel = new WxPaymentRefundModel(); |
| | | wxPaymentRefundModel.setTransaction_id(byId.getSerialNumber()); |
| | | wxPaymentRefundModel.setOut_trade_no(byId.getCode()); |
| | | wxPaymentRefundModel.setOut_refund_no(OrderCodeUtil.getOrderCode("GW")); |
| | | // todo 部署到线上之后写回调地址 |
| | | // wxPaymentRefundModel.setNotify_url(""); |
| | | String string = byId.getPaymentAmount().multiply(new BigDecimal("100")).toString(); |
| | | int i = Integer.parseInt(string); |
| | | WxPaymentRefundModel.RefundAmount refundAmount = new WxPaymentRefundModel.RefundAmount(); |
| | | refundAmount.setTotal(i); |
| | | refundAmount.setRefund(i); |
| | | wxPaymentRefundModel.setAmount(refundAmount); |
| | | wxPaymentClient.refundOrderR(wxPaymentRefundModel); |
| | | break; |
| | | case 2: |
| | | // 支付宝 |
| | | RefundReq refundReq = new RefundReq(); |
| | | refundReq.setOutTradeNo(byId.getSerialNumber()); |
| | | String gw = OrderCodeUtil.getOrderCode("GW"); |
| | | refundReq.setOutRequestNo(gw); |
| | | refundReq.setRefundAmount(byId.getPaymentAmount().toString()); |
| | | refundReq.setRefundReason("后台退款"); |
| | | RefundResp data = aliPaymentClient.refund(refundReq).getData(); |
| | | if (data!=null){ |
| | | // 退款成功 回退优惠券 |
| | | // byId.setStatus(4); |
| | | if (byId.getAppCouponId()!=null){ |
| | | appCouponClient.refund(byId.getAppCouponId().toString()); |
| | | byId.setRefundCode(gw); |
| | | byId.setRefundAmount(byId.getPaymentAmount()); |
| | | byId.setRefundStatus(2); |
| | | byId.setRefundSerialNumber(data.getTradeNo()); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | shoppingOrderService.updateById(byId); |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.payment.ali.config.AliProperties; |
| | | import com.ruoyi.payment.ali.v2.AppletPayUtil; |
| | | import com.ruoyi.payment.api.model.PaymentReq; |
| | | import com.ruoyi.payment.api.model.PaymentResp; |
| | | import com.ruoyi.payment.api.model.QueryResp; |
| | | import com.ruoyi.payment.api.model.*; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | |
| | | throw new RuntimeException("关闭支付宝订单失败"); |
| | | } |
| | | } |
| | | /** |
| | | * 后台退款 远程调用 |
| | | */ |
| | | @PostMapping("/refund") |
| | | public R<RefundResp> refund(@RequestBody RefundReq dto){ |
| | | return R.ok(appletPayUtil.refund(dto)); |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import com.ruoyi.payment.wx.enums.RefundEnum; |
| | | import com.ruoyi.payment.wx.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.wx.resp.NotifyV3PayDecodeRespBody; |
| | | import com.ruoyi.payment.wx.utils.WxV3Pay; |
| | | import io.swagger.annotations.Api; |
| | |
| | | // TODO 退款业务处理 |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 微信v3支付-订单退款 远程调用 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation("订单退款") |
| | | @PostMapping(value = "refundOrderR") |
| | | public R<String> refundOrderR(@RequestBody WxPaymentRefundModel model) { |
| | | Map<String, Object> result = wxV3Pay.refund(model); |
| | | log.info("退款结果:{}", result); |
| | | // 微信支付退款单号 |
| | | String refund_id = result.get("refund_id").toString(); |
| | | // 商户退款单号 |
| | | String out_refund_no = result.get("out_refund_no").toString(); |
| | | // 微信支付订单号 |
| | | String transaction_id = result.get("transaction_id").toString(); |
| | | // 商户订单号 tradeNo |
| | | String out_trade_no = result.get("out_trade_no").toString(); |
| | | // 退款成功时间 |
| | | String success_time = Objects.nonNull(result.get("success_time")) ? result.get("success_time").toString() : null; |
| | | // 退款状态 RefundEnum |
| | | String status = result.get("status").toString(); |
| | | return R.ok(status); |
| | | } |
| | | /** |
| | | * 支付回调 |
| | | */ |
| | |
| | | // 时间不对的话,可以调用 WxTimeUtils.toRfc3339Date(success_time)转换一下 |
| | | String success_time = params.get("success_time").toString(); |
| | | if (tradeState.equals(RefundEnum.SUCCESS.name())) { |
| | | String substring = out_refund_no.substring(0, 2); |
| | | switch (substring){ |
| | | case "GW": |
| | | break; |
| | | |
| | | } |
| | | // TODO 退款成功处理 |
| | | wxV3Pay.ack(); |
| | | } else { |
| | |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.payment.wx.model.WxCloseOrderModel; |
| | | import com.ruoyi.payment.wx.model.WxPaymentInfoModel; |
| | | import com.ruoyi.payment.wx.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.wx.resp.NotifyV3PayDecodeRespBody; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.Verifier; |
| | |
| | | import com.ruoyi.payment.wx.model.WeixinProperties; |
| | | import com.ruoyi.payment.wx.model.WxCloseOrderModel; |
| | | import com.ruoyi.payment.wx.model.WxPaymentInfoModel; |
| | | import com.ruoyi.payment.wx.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.wx.resp.NotifyV3PayDecodeRespBody; |
| | | import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder; |
| | | import com.wechat.pay.contrib.apache.httpclient.auth.PrivateKeySigner; |