Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TChargingOrderController.java
| | |
| | | return R.fail("修改用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R change(PointChangeDto points) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R changeDown(PointChangeDto points) { |
| | |
| | | @PostMapping("/t-app-user/user/updateAppUser") |
| | | R updateAppUser(@RequestBody TAppUser appUser); |
| | | |
| | | @PostMapping("/t-app-user/user/points/change") |
| | | R change(@RequestBody PointChangeDto points); |
| | | // @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); |
| | | |
| | |
| | | @TableField("code") |
| | | private String code; |
| | | |
| | | @ApiModelProperty(value = "对应跳转订单号") |
| | | @TableField("order_code") |
| | | private String orderCode; |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | | private Long appUserId; |
| | |
| | | public R<String> platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate) { |
| | | return R.fail("远程更新调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> setupBillingModel1(String deviceId) { |
| | | return R.fail("远程更新硬件:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | public R<String> stopCharging(String id) { |
| | | return R.fail("手动停止充电失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void chargingOrderWXCallback(String out_trade_no, String transaction_id, String attach) { |
| | | log.error("充电支付成功回调通知失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void chargingOrderStartupFailureWxRefund(String out_refund_no, String refund_id, String tradeState, String success_time) { |
| | | log.error("远程启动失败后退款通知失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> exchangeCreate(ExchangeDto exchangeDto) { |
| | | public R<ExchangeBackDto> exchangeCreate(ExchangeDto exchangeDto) { |
| | | return R.fail("创建订单" + cause.getMessage()); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PutMapping(value = "/t-charging-order/stopCharging/{id}") |
| | | R<String> stopCharging(@PathVariable("id") String id); |
| | | |
| | | |
| | | /** |
| | | * 充电支付成功回调通知 |
| | | * @param out_trade_no |
| | | * @param transaction_id |
| | | * @param attach |
| | | */ |
| | | @PostMapping("/t-charging-order/chargingOrderWXCallback") |
| | | void chargingOrderWXCallback(@RequestParam("out_trade_no") String out_trade_no, |
| | | @RequestParam("transaction_id") String transaction_id, |
| | | @RequestParam("attach") String attach); |
| | | |
| | | |
| | | /** |
| | | * 远程启动失败后退款回调 |
| | | * @param out_refund_no |
| | | * @param refund_id |
| | | * @param tradeState |
| | | * @param success_time |
| | | */ |
| | | @PostMapping("/t-charging-order/chargingOrderStartupFailureWxRefund") |
| | | void chargingOrderStartupFailureWxRefund(@RequestParam("out_trade_no") String out_refund_no, |
| | | @RequestParam("out_trade_no") String refund_id, |
| | | @RequestParam("out_trade_no") String tradeState, |
| | | @RequestParam("out_trade_no") String success_time); |
| | | } |
| | |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.dto.ExchangeDto; |
| | | import com.ruoyi.order.api.factory.OrderFallbackFactory; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | |
| | | public R<Long> getExchangeById(@RequestParam("goodId") Integer goodId,@RequestParam("userId") Long userId,@RequestParam("goodType") Integer goodType); |
| | | |
| | | @PostMapping("/t-exchange-order/create") |
| | | public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | public R<ExchangeBackDto> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-vip-order//addVipOrder") |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder vipOrder); |
| | | @PostMapping("/t-shopping-order/create") |
| | |
| | | import java.time.LocalDateTime; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.io.Serializable; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | |
| | | @ApiModelProperty(value = "退款成功时间") |
| | | @TableField("refund_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime refundTime; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | |
| | | private BigDecimal paymentAmount; |
| | | @ApiModelProperty(value = "支付时间") |
| | | @TableField(exist = false) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime payTime; |
| | | |
| | | |
| | | @ApiModelProperty(value = "订单id") |
| | | @TableField(exist = false) |
| | | private String orderId; |
| | | @TableField(exist = false) |
| | | private String userId; |
| | | } |
| | |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "状态(1=待发货,2=待收货,3=已完成,4=已取消)") |
| | | @ApiModelProperty(value = "状态(1=待发货,2=待收货,3=已完成,4=已取消 5=交易关闭)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | |
| | | @ApiModelProperty(value = "userUid") |
| | | @TableField(exist = false) |
| | | private String userUid; |
| | | @ApiModelProperty(value = "购买用户") |
| | | @TableField(exist = false) |
| | | private String userPhone; |
| | | |
| | | } |
| | |
| | | private String name; |
| | | @ApiModelProperty(value = "1现金购买 2积分兑换 ") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "1全部 2已售罄 ") |
| | | @ApiModelProperty(value = "1全部 2已售罄 3已下架") |
| | | private Integer otherState; |
| | | } |
| | |
| | | public R<Map<String, Object>> orderPay(PaymentOrder paymentOrder) { |
| | | return R.fail("调起微信支付失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Map<String, Object>> payNotify(HttpServletRequest request) { |
| | | return R.fail("微信支付回调失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void ack() { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void close(String outTradeNo) { |
| | |
| | | @Override |
| | | public R<String> refundOrderR(WxPaymentRefundModel model) { |
| | | return R.fail("微信退款失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<WxRefundNotifyResp> refundNotify(HttpServletRequest request) { |
| | | return R.fail("微信退款回调失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | |
| | | R<Map<String, Object>> orderPay(@RequestBody PaymentOrder paymentOrder); |
| | | |
| | | |
| | | /** |
| | | * 支付回调 |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @PostMapping("/wx/pay/notify") |
| | | R<Map<String, Object>> payNotify(HttpServletRequest request); |
| | | |
| | | /** |
| | | * 支付回调成功后的成功应答 |
| | | */ |
| | | @PostMapping("/wx/pay/ack") |
| | | void ack(); |
| | | |
| | | |
| | | /** |
| | | * 关闭订单 |
| | |
| | | @ApiOperation("订单退款") |
| | | @PostMapping(value = "/wx/refundOrderR") |
| | | public R<String> refundOrderR(@RequestBody WxPaymentRefundModel model); |
| | | |
| | | |
| | | |
| | | @ApiOperation("订单退款回调") |
| | | @PostMapping(value = "/wx/refund/notify") |
| | | R<WxRefundNotifyResp> refundNotify(HttpServletRequest request); |
| | | } |
| | |
| | | /** |
| | | * 回调地址 |
| | | */ |
| | | private String notifyUrl ="http://221.182.45.100:9000/payment/wx/pay/notify"; |
| | | private String notifyUrl ="/payment/wx/pay/notify"; |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.core.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExchangeBackDto { |
| | | private Long id; |
| | | private String code; |
| | | } |
| | |
| | | private Integer points; |
| | | private String remark; |
| | | private Integer type; |
| | | private String code; |
| | | } |
| | |
| | | @DeleteMapping(value = "/unit/delete") |
| | | @Log(title = "【单位管理】删除单位", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | public R add(@RequestParam String ids) { |
| | | List<TAppUser> list = appUserService.lambdaQuery().in(TAppUser::getCompanyId, Arrays.asList(ids.split(","))).list(); |
| | | if (!list.isEmpty()){ |
| | | return R.fail("当前单位已存在用户,无法删除!"); |
| | | } |
| | | String[] split = ids.split(","); |
| | | for (String s : split) { |
| | | otherClient.unitDelete(Integer.valueOf(s)); |
| | |
| | | Page<TAppUser> page = appUserService.lambdaQuery() |
| | | .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) |
| | | .eq(userListQueryDto.getCompanyId() != null, TAppUser::getCompanyId, userListQueryDto.getCompanyId()) |
| | | .like(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .eq(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) |
| | | .eq(userListQueryDto.getStatus() != null, TAppUser::getStatus, userListQueryDto.getStatus()) |
| | | .eq(userListQueryDto.getVipTypeId() != null, TAppUser::getVipId, userListQueryDto.getVipTypeId()) |
| | |
| | | if (userListQueryDto.getUserTagId() != null){ |
| | | userIds = appUserTagService.lambdaQuery().eq(TAppUserTag::getUserTagId, userListQueryDto.getUserTagId()).list().stream().map(TAppUserTag::getAppUserId).collect(Collectors.toList()); |
| | | } |
| | | LocalDateTime end1 = null; |
| | | LocalDateTime end2 = null ; |
| | | if (userListQueryDto.getVipEndTime1()!=null) { |
| | | end1 = LocalDateTime.now().plusDays(userListQueryDto.getVipEndTime1()); |
| | | } |
| | | if (userListQueryDto.getVipEndTime2()!=null){ |
| | | end2 = LocalDateTime.now().plusDays(userListQueryDto.getVipEndTime2()); |
| | | } |
| | | //列表查询 |
| | | Page<TAppUser> page = appUserService.lambdaQuery() |
| | | .ge(TAppUser::getVipEndTime, LocalDateTime.now()) |
| | | .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) |
| | | .eq(userListQueryDto.getCompanyId() != null, TAppUser::getCompanyId, userListQueryDto.getCompanyId()) |
| | | .eq(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) |
| | | .eq(userListQueryDto.getStatus() != null, TAppUser::getStatus, userListQueryDto.getStatus()) |
| | | .eq(userListQueryDto.getVipTypeId() != null, TAppUser::getVipId, userListQueryDto.getVipTypeId()) |
| | | .ge(userListQueryDto.getVipEndTime1() != null, TAppUser::getVipEndTime, userListQueryDto.getVipEndTime1() == null ? null : LocalDateTime.now().plusDays(userListQueryDto.getVipEndTime1())) |
| | | .le(userListQueryDto.getVipEndTime2() != null, TAppUser::getVipEndTime, userListQueryDto.getVipEndTime2() == null ? null : LocalDateTime.now().plusDays(userListQueryDto.getVipEndTime2())) |
| | | .ge(userListQueryDto.getVipEndTime1() != null, TAppUser::getVipEndTime, end1 ) |
| | | .le(userListQueryDto.getVipEndTime2() != null, TAppUser::getVipEndTime, end2) |
| | | .in(!userIds.isEmpty(), TAppUser::getId, userIds) |
| | | .page(Page.of(userListQueryDto.getPageCurr(), userListQueryDto.getPageSize())); |
| | | if (page.getRecords().isEmpty()){ |
| | |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | List<TAppUser> list = appUserService.lambdaQuery().eq(TAppUser::getPhone, tAppUser.getPhone()).list(); |
| | | if (!list.isEmpty()){ |
| | | return R.fail("该手机号已注册"); |
| | | } |
| | | } |
| | | appUserService.saveOrUpdate(tAppUser); |
| | | return R.ok(); |
| | |
| | | @GetMapping(value = "/user/detail/{id}") |
| | | public R<UserDetailDto> userDetail(@PathVariable Long id) { |
| | | TAppUser user = appUserService.getById(id); |
| | | UserDetailDto userDetailDto = new UserDetailDto(); |
| | | BeanUtils.copyProperties(user,userDetailDto); |
| | | if (user.getVipId()!=null) { |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(Arrays.asList(user.getVipId())); |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(Collections.singletonList(user.getVipId())); |
| | | if (user.getVipEndTime()!=null&&user.getVipEndTime().isAfter(LocalDateTime.now())) { |
| | | //匹配vipMap的值 |
| | | user.setVipName(vipMap.getData().get(user.getVipId())); |
| | | } |
| | | |
| | | |
| | | UserDetailDto userDetailDto = new UserDetailDto(); |
| | | BeanUtils.copyProperties(user,userDetailDto); |
| | | |
| | | //获取累计充电数量 |
| | | R<Long> useOrderCount = chargingOrderClient.useOrderCount(user.getId()); |
| | | userDetailDto.setOrderCount(useOrderCount.getData()); |
| | |
| | | userDetailDto.setTagName(tagMap.getData().values() |
| | | .stream() |
| | | .collect(Collectors.joining(","))); |
| | | |
| | | |
| | | |
| | | return R.ok(userDetailDto); |
| | | } |
| | | |
| | |
| | | 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(); |
| | | Long coupons = appCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).ge(TAppCoupon::getEndTime, LocalDateTime.now()).eq(TAppCoupon::getStatus, 1).count(); |
| | | appUserInfoDto.setCouponNum(Math.toIntExact(coupons)); |
| | | //当前绑定的车辆 |
| | | List<TAppUserCar> list = carService.lambdaQuery().eq(TAppUserCar::getAppUserId, userId).list(); |
| | |
| | | signService.updateById(appUserSign); |
| | | } |
| | | } |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+points,1,userId,"每日签到","JF"); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+points,1,userId,"每日签到","JF",""); |
| | | byId.setPoints(byId.getPoints()+points); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | |
| | | |
| | | |
| | | //积分变化记录用 |
| | | @PostMapping(value = "/user/points/change") |
| | | public R change(@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(); |
| | | } |
| | | // @PostMapping(value = "/user/points/change") |
| | | // public R change(@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(); |
| | | // } |
| | | |
| | | @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"); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()-points.getPoints(),points.getType(),points.getUserId(),points.getRemark(),"JF",points.getCode()); |
| | | byId.setPoints(byId.getPoints()-points.getPoints()); |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | |
| | | } |
| | | |
| | | //增加积分记录 |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),""); |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),"",""); |
| | | byId.setPoints(byId.getPoints()+point); |
| | | byId.setFirstAdd(1); |
| | | |
| | |
| | | public R delete(String ids) { |
| | | //拿到单位列表 |
| | | String[] split = ids.split(","); |
| | | |
| | | List<TAppUserTag> list = appUserTagService.lambdaQuery().in(TAppUserTag::getUserTagId).list(); |
| | | if (!list.isEmpty()){ |
| | | return R.fail("当前标签已有用户获取,无法删除"); |
| | | } |
| | | for (String id : split) { |
| | | otherClient.deleteTag(Integer.valueOf(id)); |
| | | } |
| | |
| | | @ApiOperation(value = "生效会员列表", tags = {"小程序-个人中心"}) |
| | | public R<List<TAppUserVipDetail>> getVipUseDetail(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | List<TAppUserVipDetail> list = appUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, userId).last(" and now() between start_time and end_time order by start_time desc").list(); |
| | | List<TAppUserVipDetail> list = appUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, userId).last(" and now() between start_time and end_time order by start_time asc").list(); |
| | | |
| | | for (TAppUserVipDetail tAppUserVipDetail : list) { |
| | | if(null != tAppUserVipDetail.getVipId()){ |
| | |
| | | public class PointDetailUtil { |
| | | @Resource |
| | | private TAppUserIntegralChangeService appUserIntegralChangeService; |
| | | public void addDetail(Integer old,Integer now,Integer type,Long userId,String extension,String code){ |
| | | public void addDetail(Integer old,Integer now,Integer type,Long userId,String extension,String code,String orderCode){ |
| | | |
| | | TAppUserIntegralChange tAppUserIntegralChange= new TAppUserIntegralChange(); |
| | | tAppUserIntegralChange.setCode(OrderCodeUtil.getOrderCode(code)); |
| | |
| | | tAppUserIntegralChange.setCurrentIntegral(now); |
| | | tAppUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | tAppUserIntegralChange.setExtension(extension); |
| | | tAppUserIntegralChange.setOrderCode(orderCode); |
| | | appUserIntegralChangeService.save(tAppUserIntegralChange); |
| | | |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.TAccountingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.query.TAccountingStrategyQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | |
| | | 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.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | @Resource |
| | | @Autowired |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyController(TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | |
| | | |
| | | return AjaxResult.ok(accountingStrategyService.pageList(query)); |
| | | } |
| | | @Resource |
| | | private IntegrationClient integrationClient; |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "审核") |
| | | @PostMapping(value = "/auth/pass") |
| | |
| | | } |
| | | |
| | | //硬件 |
| | | List<TChargingPile> list = chargingPileService.lambdaQuery().eq(TChargingPile::getSiteId, byId.getSiteId()).list(); |
| | | for (TChargingPile tChargingPile : list) { |
| | | integrationClient.setupBillingModel1(tChargingPile.getCode()); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | return R.ok(message); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "远程重启",tags = {"硬件接口"}) |
| | | @PostMapping(value = "/platformRestart") |
| | | public R platformRestart(String deviceId) { |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletInputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | |
| | | |
| | | /** |
| | | * 充电充值支付回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingOrderWXCallback") |
| | | public void chargingOrderWXCallback(HttpServletRequest request) { |
| | | System.err.println("-------------------支付回调通知-------------------"); |
| | | Map<String, Object> data = wxPaymentClient.payNotify(request).getData(); |
| | | if (null != data) { |
| | | String out_trade_no = data.get("out_trade_no").toString(); |
| | | String transaction_id = data.get("transaction_id").toString(); |
| | | String attach = data.get("attach").toString(); |
| | | AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(1, out_trade_no, transaction_id, attach); |
| | | if (ajaxResult.isSuccess()) { |
| | | wxPaymentClient.ack(); |
| | | } |
| | | } |
| | | public void chargingOrderWXCallback(@RequestParam("out_trade_no") String out_trade_no, @RequestParam("transaction_id") String transaction_id, |
| | | @RequestParam("attach") String attach) { |
| | | AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(1, out_trade_no, transaction_id, attach); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | /** |
| | | * 远程启动失败后退款回调 |
| | | * @param request |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingOrderStartupFailureWxRefund") |
| | | public void chargingOrderStartupFailureWxRefund(HttpServletRequest request){ |
| | | WxRefundNotifyResp data = wxPaymentClient.refundNotify(request).getData(); |
| | | if(null != data){ |
| | | String out_refund_no = data.getOut_refund_no(); |
| | | String refund_id = data.getRefund_id(); |
| | | String tradeState = data.getTradeState(); |
| | | String success_time = data.getSuccess_time(); |
| | | chargingOrderService.chargingOrderStartupFailureWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | } |
| | | public void chargingOrderStartupFailureWxRefund(@RequestParam("out_trade_no") String out_refund_no, |
| | | @RequestParam("out_trade_no") String refund_id, |
| | | @RequestParam("out_trade_no") String tradeState, |
| | | @RequestParam("out_trade_no") String success_time){ |
| | | chargingOrderService.chargingOrderStartupFailureWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | } |
| | | |
| | | |
| | |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | if (statisticsQueryDto.getDayType()==1) { |
| | | List<Map<String,Object>> charMap = chargingOrderService.getHourType(siteIds,statisticsQueryDto); |
| | | List<Map<String,Object>> charMap1 = chargingOrderService.getHourType(siteIds,statisticsQueryDto); |
| | | List<Map<String, Object>> charMap = new ArrayList<>(); |
| | | // 生成从 "00:00" 到 "23:00" 的时间数据 |
| | | for (int hour = 0; hour < 24; hour++) { |
| | | String time = String.format("%02d:00", hour); |
| | | Map<String, Object> mapWithTimeValue = findMapWithTimeValue(charMap1, time); |
| | | if (mapWithTimeValue!=null){ |
| | | charMap.add(mapWithTimeValue); |
| | | }else { |
| | | Map<String, Object> timeMap = new HashMap<>(); |
| | | timeMap.put("time", time); // 初始化值为 null |
| | | timeMap.put("electrovalence", 0); |
| | | timeMap.put("orderCount", 0); |
| | | timeMap.put("servicecharge", 0); |
| | | timeMap.put("electricity", 0); |
| | | charMap.add(timeMap); |
| | | } |
| | | } |
| | | return R.ok(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==2){ |
| | | List<Map<String,Object>> charMap = chargingOrderService.getDateType(siteIds,statisticsQueryDto); |
| | | return R.ok(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==3){ |
| | | List<Map<String,Object>> charMap = chargingOrderService.getMonthType(siteIds,statisticsQueryDto); |
| | | } |
| | | return R.ok(charMap); |
| | | |
| | | } |
| | | return R.ok(); |
| | | |
| | | |
| | | } |
| | | |
| | | private static Map<String, Object> findMapWithTimeValue(List<Map<String, Object>> charMap1,String timeValue) { |
| | | for (Map<String, Object> map : charMap1) { |
| | | if (map.containsKey("time") && map.get("time").equals(timeValue)) { |
| | | return map; |
| | | } |
| | | } |
| | | return null; // 如果没有找到,返回 null |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/use") |
| | |
| | | @Resource |
| | | private TOrderInvoiceService invoiceService; |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/shopOrder") |
| | | @GetMapping(value = "/work/shopOrder") |
| | | @ApiOperation(value = "购物订单统计", tags = {"管理后台-工作台"}) |
| | | public R shopOrder(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | public R shopOrder() { |
| | | Long count = shoppingOrderService.lambdaQuery().eq(TShoppingOrder::getStatus, 1).count(); |
| | | Long count1 = shoppingOrderService.lambdaQuery().eq(TShoppingOrder::getStatus, 2).count(); |
| | | List<Long> counts = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/invoice") |
| | | @GetMapping(value = "/work/invoice") |
| | | @ApiOperation(value = "开票统计", tags = {"管理后台-工作台"}) |
| | | public R invoice(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | public R invoice() { |
| | | Long count = invoiceService.lambdaQuery().eq(TOrderInvoice::getStatus, 1).count(); |
| | | Long count1 = invoiceService.lambdaQuery().eq(TOrderInvoice::getStatus, 3).count(); |
| | | List<Long> counts = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/users/count") |
| | | @GetMapping(value = "/work/users/count") |
| | | @ApiOperation(value = "用户数量", tags = {"管理后台-工作台"}) |
| | | public R usersCount(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | public R usersCount() { |
| | | List<Map<String,Object>> userMap = chargingOrderService.countAllUserData(); |
| | | return R.ok(userMap); |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | } |
| | | |
| | | @PostMapping("/create") |
| | | public R<Long> exchangeCreate(@RequestBody ExchangeDto exchangeDto){ |
| | | public R<ExchangeBackDto> exchangeCreate(@RequestBody ExchangeDto exchangeDto){ |
| | | TExchangeOrder tExchangeOrder = new TExchangeOrder(); |
| | | tExchangeOrder.setCode(OrderCodeUtil.getOrderCode("DH")); |
| | | tExchangeOrder.setAppUserId(exchangeDto.getUserId()); |
| | |
| | | tExchangeOrder.setCreateTime(LocalDateTime.now()); |
| | | tExchangeOrder.setDelFlag(false); |
| | | exchangeOrderService.save(tExchangeOrder); |
| | | return R.ok(tExchangeOrder.getId()); |
| | | ExchangeBackDto exchangeBackDto = new ExchangeBackDto(); |
| | | exchangeBackDto.setId(tExchangeOrder.getId()); |
| | | exchangeBackDto.setCode(tExchangeOrder.getCode()); |
| | | return R.ok(exchangeBackDto); |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.order.api.query.ShoppingOrderQuery; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | |
| | | byId.setReceivingAddress(data.getAddress()); |
| | | } |
| | | } |
| | | if (byId.getOrderType()==1){ |
| | | TGoods data = goodsClient.getGoodsById(byId.getGoodsId()).getData(); |
| | | if (data!=null){ |
| | | byId.setName(data.getName()); |
| | | } |
| | | }else { |
| | | TCoupon data = couponClient.getCouponById1(byId.getCouponId()).getData(); |
| | | if (data!=null){ |
| | | byId.setName(data.getName()); |
| | | } |
| | | } |
| | | return AjaxResult.success(byId); |
| | | } |
| | | |
| | |
| | | @PostMapping("/addVipOrder") |
| | | @ApiOperation(value = "添加会员订单", tags = {"管理后台-会员订单"}) |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder dto) { |
| | | List<TVipOrder> list = vipOrderService.lambdaQuery().eq(TVipOrder::getCode, dto.getCode()).list(); |
| | | if (!list.isEmpty())return R.fail("订单编号已存在"); |
| | | vipOrderService.saveOrUpdate(dto); |
| | | return R.ok(dto.getId()); |
| | | } |
| | |
| | | paymentOrder.setAmount(addChargingOrder.getPaymentAmount()); |
| | | paymentOrder.setOpenId(appUser.getWxOpenid()); |
| | | paymentOrder.setDescription("充电充值"); |
| | | paymentOrder.setNotifyUrl("/order/t-charging-order/chargingOrderWXCallback"); |
| | | paymentOrder.setNotifyUrl("/payment/wx/pay/notify"); |
| | | Map<String, Object> data = wxPaymentClient.orderPay(paymentOrder).getData(); |
| | | return AjaxResult.success(data); |
| | | } |
| | |
| | | model.setOut_trade_no(chargingOrder.getCode()); |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setReason("充电失败,取消充电订单"); |
| | | model.setNotify_url("/order/t-charging-order/chargingOrderStartupFailureWxRefund"); |
| | | model.setNotify_url("/payment/wx/refund/notify"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(rechargeAmount.multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(rechargeAmount.multiply(new BigDecimal(100)).intValue()); |
| | |
| | | model.setOut_trade_no(chargingOrder.getCode()); |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setReason("充电完成退款"); |
| | | model.setNotify_url("/order/t-charging-order/chargingOrderStartupFailureWxRefund"); |
| | | model.setNotify_url("/payment/wx/refund/notify"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(refundAmount.multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(rechargeAmount.multiply(new BigDecimal(100)).intValue()); |
| | |
| | | if (data1!=null){ |
| | | tShoppingOrder.setName(data1.getName()); |
| | | } |
| | | tShoppingOrder.setStatus(3); |
| | | break; |
| | | } |
| | | if (tShoppingOrder.getAppUserId() != null){ |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Override |
| | | public PageInfo<TVipOrder> pageList(VipShoppingOrderQuery query) { |
| | | String startTime1 = null; |
| | |
| | | tVipOrder.setUid(tVipOrder.getId().toString()); |
| | | tVipOrder.setUserUid(tVipOrder.getAppUserId().toString()); |
| | | TVip data = vipClient.getInfo(tVipOrder.getVipId()).getData(); |
| | | |
| | | if (data!=null){ |
| | | tVipOrder.setName(data.getName()); |
| | | } |
| | | TAppUser data1 = appUserClient.getUserById(tVipOrder.getAppUserId()).getData(); |
| | | if (data1!=null)tVipOrder.setUserPhone(data1.getPhone()); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
New file |
| | |
| | | package com.ruoyi.order.util.task; |
| | | |
| | | import com.alibaba.fastjson2.util.UUIDUtils; |
| | | import com.alibaba.nacos.common.utils.UuidUtils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.order.api.model.TChargingBill; |
| | | import com.ruoyi.order.service.TChargingBillService; |
| | | import org.apache.logging.log4j.core.util.UuidUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Random; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @date 2023/7/11 8:39 |
| | | */ |
| | | @Component |
| | | public class TaskUtil { |
| | | |
| | | @Resource |
| | | private TChargingBillService chargingBillService; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | public static void main(String[] args) { |
| | | LocalDate firstDayOfLastMonth = LocalDate.now().minusMonths(1). |
| | | withDayOfMonth(2); |
| | | String string = firstDayOfLastMonth.toString(); |
| | | // 将-替换为空字符串 |
| | | string = string.replace("-", ""); |
| | | System.err.println(string); |
| | | } |
| | | // 每月2号凌晨12点执行的定时任务 |
| | | @Scheduled(cron = "0 0 0 2 * ?") |
| | | public void taskMonth() { |
| | | try { |
| | | // 获取上个月的开始和结束日期 |
| | | LocalDate firstDayOfLastMonth = LocalDate.now().minusMonths(1). |
| | | withDayOfMonth(2); |
| | | String string = firstDayOfLastMonth.toString(); |
| | | // 将-替换为空字符串 |
| | | string = string.replace("-", ""); |
| | | // 生成一次全站订单 |
| | | TChargingBill tChargingBill = new TChargingBill(); |
| | | // 订单生成规则JSD+20231201(账单所属月份)+1131304205(随机10位数)+001(当月账单序号,每月重置) |
| | | Random random = new Random(); |
| | | String randomDigits = random.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 |
| | | .mapToObj(String::valueOf) |
| | | .collect(Collectors.joining()); // 将其连接成一个字符串 |
| | | tChargingBill.setCode("JSD"+string+randomDigits+"001" ); |
| | | tChargingBill.setType(1); |
| | | tChargingBill.setBillTime(LocalDateTime.now()); |
| | | tChargingBill.setStatus(1); |
| | | tChargingBill.setOrderState(2); |
| | | chargingBillService.save(tChargingBill); |
| | | // 每月二号给每个站点生成上月账单 |
| | | List<Integer> collect = siteClient.getSiteAll().getData().stream().map(Site::getId).collect(Collectors.toList()); |
| | | List<TChargingBill> tChargingBills = new ArrayList<>(); |
| | | for (int i = 1; i <= collect.size(); i++) { |
| | | TChargingBill tChargingBill1 = new TChargingBill(); |
| | | Random random1 = new Random(); |
| | | String randomDigits1 = random1.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 |
| | | .mapToObj(String::valueOf) |
| | | .collect(Collectors.joining()); // 将其连接成一个字符串 |
| | | tChargingBill1.setCode("JSD"+string+randomDigits1+i ); |
| | | tChargingBill1.setType(2); |
| | | tChargingBill1.setSiteId(collect.get(i)); |
| | | tChargingBill1.setBillTime(LocalDateTime.now()); |
| | | tChargingBill1.setStatus(1); |
| | | tChargingBill1.setOrderState(2); |
| | | tChargingBills.add(tChargingBill1); |
| | | } |
| | | if (!tChargingBills.isEmpty())chargingBillService.saveBatch(tChargingBills); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | // 每个月最后一天23点执行的定时任务 |
| | | @Scheduled(cron = "0 0 23 L * ?") |
| | | public void taskLastDay() { |
| | | try { |
| | | // 获取上个月的开始和结束日期 |
| | | LocalDate firstDayOfLastMonth = LocalDate.now().minusMonths(1). |
| | | withDayOfMonth(1); |
| | | LocalDate lastDayOfLastMonth = LocalDate.now().minusMonths(1). |
| | | withDayOfMonth(firstDayOfLastMonth.lengthOfMonth()); |
| | | // 将 LocalDate 转换为 LocalDateTime,并设定时间为一天的开始 |
| | | LocalDateTime startDateTime = firstDayOfLastMonth.atStartOfDay(); |
| | | LocalDateTime endDateTime = lastDayOfLastMonth.atTime(23, 59, 59); // 设定到最后一秒 |
| | | // 构建查询条件 |
| | | LambdaQueryWrapper<TChargingBill> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.ge(TChargingBill::getBillTime, |
| | | Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant())) |
| | | .le(TChargingBill::getBillTime, |
| | | Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())); // 使用 le 包括最后一天的记录 |
| | | List<TChargingBill> list = chargingBillService.list(queryWrapper); |
| | | for (TChargingBill tChargingBill : list) { |
| | | tChargingBill.setStatus(2); |
| | | } |
| | | chargingBillService.updateBatchById(list); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | </if> |
| | | </select> |
| | | <select id="payOrderQuery" resultType="com.ruoyi.order.dto.PayOrderDto"> |
| | | SELECT * FROM (SELECT |
| | | SELECT o.*,i.phone FROM (SELECT |
| | | id, |
| | | `code`, |
| | | 1 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount, |
| | | payment_amount , |
| | |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | del_flag, |
| | | app_user_id |
| | | FROM |
| | | charging_pile_order.t_charging_order |
| | | where recharge_payment_status = 2 |
| | |
| | | `code`, |
| | | 2 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount, |
| | | payment_amount , |
| | |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | del_flag, |
| | | app_user_id |
| | | FROM |
| | | charging_pile_order.t_shopping_order |
| | | where payment_status = 2 |
| | |
| | | `code`, |
| | | 3 as type, |
| | | title, |
| | | phone, |
| | | payment_status AS `status`, |
| | | order_amount, |
| | | payment_amount , |
| | |
| | | pay_time, |
| | | refund_status, |
| | | (payment_amount-refund_amount) as final_amount, |
| | | del_flag |
| | | del_flag, |
| | | app_user_id |
| | | |
| | | FROM |
| | | charging_pile_order.t_vip_order |
| | |
| | | `code`, |
| | | 4 as type, |
| | | title, |
| | | phone, |
| | | `status`, |
| | | order_amount , |
| | | order_amount as payment_amount, |
| | |
| | | out_parking_time as pay_time, |
| | | null as refund_status, |
| | | 0 as final_amount, |
| | | 0 as del_flag |
| | | 0 as del_flag, |
| | | app_user_id |
| | | FROM |
| | | charging_pile_service.t_parking_record ) o |
| | | LEFT JOIN `charging_pile_account`.`t_app_user` i on o.app_user_id = i.id |
| | | <where> |
| | | o.del_flag = 0 |
| | | <if test="data.code != null and data.code != ''"> |
| | |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="data.isRefund == 1"> |
| | | AND o.refund_status is not null |
| | | </if> |
| | | <if test="data.isRefund == 1"> |
| | | AND o.refund_status is null |
| | | </if> |
| | | |
| | | </where> |
| | | ORDER BY o.create_time desc |
| | | |
| | |
| | | re.refund_remark, |
| | | co.recharge_serial_number as serail_number, |
| | | co.payment_amount, |
| | | co.pay_time |
| | | co.create_time as pay_time, |
| | | co.id as order_id, |
| | | co.app_user_id as user_id |
| | | FROM t_charging_order_refund re |
| | | LEFT JOIN t_charging_order co ON re.charging_order_id = co.id |
| | | UNION ALL |
| | |
| | | re.refund_remark, |
| | | so.serial_number, |
| | | so.payment_amount, |
| | | so.pay_time |
| | | so.create_time as pay_time, |
| | | so.id as order_id, |
| | | so.app_user_id as user_id |
| | | FROM t_shopping_order_refund re |
| | | LEFT JOIN t_shopping_order so on re.shopping_order_id = so.id |
| | | UNION ALL |
| | |
| | | vr.refund_remark, |
| | | vo.serial_number, |
| | | vo.payment_amount, |
| | | vo.pay_time |
| | | vo.create_time as pay_time, |
| | | vo.id as order_id, |
| | | vo.app_user_id as user_id |
| | | FROM t_vip_order_refund vr |
| | | LEFT JOIN t_vip_order vo on vr.vip_order_id = vo.id |
| | | |
| | |
| | | AND o.refund_code LIKE CONCAT('%',#{data.refundCode},'%') |
| | | </if> |
| | | </where> |
| | | |
| | | order by o.refund_time desc |
| | | |
| | | </select> |
| | | <select id="chargingOrderGroup" resultType="com.ruoyi.common.core.dto.ChargingOrderGroup"> |
| | |
| | | <if test="statisticsQueryDto.type == 2"> |
| | | end_time |
| | | </if> |
| | | , '%Y-%m-%d %H' ) as time, |
| | | , '%H:00' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | SUM(electricity) as electricity, |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | |
| | | , '%Y-%m-%d' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | count(1) as orderCount |
| | | count(1) as orderCount, |
| | | SUM(electricity) as electricity |
| | | FROM |
| | | t_charging_order |
| | | |
| | | WHERE del_flag = 0 and recharge_payment_status = 2 and DATE( |
| | | <if test="statisticsQueryDto.type == 1"> |
| | | start_time |
| | |
| | | , '%Y-%m' ) as time, |
| | | SUM(service_charge) as servicecharge, |
| | | SUM(electrovalence) as electrovalence, |
| | | count(1) as orderCount |
| | | count(1) as orderCount, |
| | | SUM(electricity) as electricity |
| | | FROM |
| | | t_charging_order |
| | | |
| | |
| | | </if> |
| | | and t1.payment_status = 2 |
| | | AND t1.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="sixBefore" resultType="com.ruoyi.order.dto.SixShopDto"> |
| | | SELECT |
| | |
| | | payment_amount |
| | | FROM |
| | | t_shopping_order |
| | | <where> |
| | | WHERE del_flag = 0 and payment_status = 2 and ISNULL(refund_status) and status!=4 |
| | | WHERE del_flag = 0 and payment_status = 2 and ISNULL(refund_status) and status!=4 and |
| | | |
| | | DATE_FORMAT(create_time, '%Y-%m-%d') between #{statisticsQueryDto.startTime} and #{statisticsQueryDto.endTime} |
| | | |
| | | |
| | | </where> |
| | | |
| | | |
| | | ) AS subquery |
| | | GROUP BY |
| | | DATE_FORMAT( subquery.create_time, '%Y-%m-%d' ); |
| | | DATE_FORMAT( subquery.create_time, '%Y-%m-%d' ) |
| | | |
| | | |
| | | </select> |
| | |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.create_time between #{startTime1} and #{startTime2} |
| | | </if> |
| | | and t1.payment_status = 2 |
| | | AND t1.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="sixBefore" resultType="com.ruoyi.order.dto.SixVipDto"> |
| | | SELECT |
| | |
| | | public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { |
| | | Page<TCompany> page = companyService.lambdaQuery() |
| | | .orderByDesc(TCompany::getCreateTime) |
| | | .like(unitListQueryDto.getCompanyName() != null && unitListQueryDto.getCompanyName().isEmpty(), TCompany::getName, unitListQueryDto.getCompanyName()) |
| | | .like(unitListQueryDto.getCompanyName() != null && unitListQueryDto.getCompanyName()!="", TCompany::getName, unitListQueryDto.getCompanyName()) |
| | | .page(Page.of(unitListQueryDto.getPageCurr(), unitListQueryDto.getPageSize())); |
| | | return R.ok(page); |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | public AjaxResult<PageInfo<TCoupon>> pageList(@RequestBody CouponQuery dto) { |
| | | return AjaxResult.ok(tCouponService.pageList(dto)); |
| | | } |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券列表分页查询") |
| | | @PostMapping(value = "/pageList3") |
| | | public AjaxResult<List<TCoupon>> pageList() { |
| | | List<TCoupon> tCoupons = new ArrayList<>(); |
| | | |
| | | List<TCoupon> list = tCouponService.lambdaQuery().eq(TCoupon::getStatus, 1) |
| | | .orderByDesc(TCoupon::getCreateTime).list(); |
| | | for (TCoupon tCoupon : list) { |
| | | if (tCoupon.getValidityPeriodMode()==1){ |
| | | if (LocalDateTime.now().isBefore(tCoupon.getEndTime())){ |
| | | tCoupons.add(tCoupon); |
| | | } |
| | | }else{ |
| | | tCoupons.add(tCoupon); |
| | | } |
| | | } |
| | | return AjaxResult.ok(tCoupons); |
| | | } |
| | | |
| | | /** |
| | | * 小程序远程调用 获取优惠券信息 |
| | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.AppGoodQuery; |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.dto.PointChangeDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | |
| | | return R.ok(); |
| | | |
| | | } |
| | | @ApiOperation(tags = {"小程序-" + |
| | | "兑换商城"},value = "积分兑换商品") |
| | | @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("当前用户已兑换"+count+"张"); |
| | | }else { |
| | | //减少库存 |
| | | good.setInventory(good.getInventory()-exchangeDto.getNum()); |
| | | } |
| | | if (user.getPoints()<good.getRedeemPoints()){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | |
| | | point = coupon.getRedeemPoints(); |
| | | |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { |
| | | return AjaxResult.error("当前用户已到达兑换"+coupon+"次"); |
| | | } |
| | | if (user.getPoints()<point){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | | } |
| | | if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { |
| | | return AjaxResult.error("当前用户已到达兑换"+coupon+"次"); |
| | | }else { |
| | | coupon.setInventoryQuantity(coupon.getInventoryQuantity()-exchangeDto.getNum()); |
| | | } |
| | | |
| | | |
| | | } |
| | | exchangeDto.setPoint(point); |
| | | exchangeDto.setUserId(userId); |
| | | //生成积分兑换成功的订单 |
| | | R<Long> longR = orderClient.exchangeCreate(exchangeDto); |
| | | R<ExchangeBackDto> longR = orderClient.exchangeCreate(exchangeDto); |
| | | if (exchangeDto.getGoodType()==2) { |
| | | TCoupon coupon = couponService.getById(exchangeDto.getGoodId()); |
| | | |
| | |
| | | pointChangeDto.setPoints(point); |
| | | pointChangeDto.setRemark(longR.getData().toString()); |
| | | pointChangeDto.setType(6); |
| | | pointChangeDto.setCode(longR.getData().getCode()); |
| | | appUserClient.changeDown(pointChangeDto); |
| | | return AjaxResult.success(); |
| | | |
| | |
| | | public R<Page<TUserTag>> page(@RequestBody TagListQueryDto tagListQueryDto) { |
| | | Page<TUserTag> page = tUserTagService.lambdaQuery() |
| | | .orderByDesc(TUserTag::getCreateTime) |
| | | .like(tagListQueryDto.getTagName()!=null&& tagListQueryDto.getTagName().isEmpty(), TUserTag::getName, tagListQueryDto.getTagName()) |
| | | .like(tagListQueryDto.getTagName()!=null&& tagListQueryDto.getTagName()!="", TUserTag::getName, tagListQueryDto.getTagName()) |
| | | .page(Page.of(tagListQueryDto.getPageCurr(), tagListQueryDto.getPageSize())); |
| | | return R.ok(page); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo/pay") |
| | | public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, |
| | |
| | | <if test="req.otherState != null and req.otherState == 2"> |
| | | AND inventory = 0 |
| | | </if> |
| | | <if test="req.otherState != null and req.otherState ==3"> |
| | | AND status = #{req.status} |
| | | </if> |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY create_time DESC |
| | |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import com.ruoyi.payment.api.vo.WxRefundNotifyResp; |
| | |
| | | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | |
| | |
| | | log.info("支付回调:{}", params); |
| | | String outRefundNo = (String) params.get("transaction_id"); |
| | | String out_trade_no = params.get("out_trade_no").toString(); |
| | | String attach = params.get("attach").toString(); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | |
| | | case "HY": |
| | | orderClient.vipCallBack(out_trade_no,outRefundNo); |
| | | System.err.println("----收到会员回调"); |
| | | break; |
| | | case "CD": |
| | | chargingOrderClient.chargingOrderWXCallback(out_trade_no, outRefundNo, attach); |
| | | System.err.println("----充电支付回调"); |
| | | break; |
| | | } |
| | | |
| | |
| | | // 时间不对的话,可以调用 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, 3); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "CDF": |
| | | chargingOrderClient.chargingOrderStartupFailureWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | System.err.println("----充电启动失败退款回调通知"); |
| | | break; |
| | | } |
| | | |
| | | WxRefundNotifyResp resp = new WxRefundNotifyResp(); |
| | | resp.setOut_trade_no(out_trade_no); |
| | | resp.setOut_refund_no(out_refund_no); |