Merge remote-tracking branch 'origin/master'
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | package com.ruoyi.account.api.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @ApiModelProperty("最低会员价格") |
| | | private BigDecimal minPrice; |
| | | @ApiModelProperty("vip结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDateTime vipExpireTime; |
| | | @ApiModelProperty("当天是否签到") |
| | | private Integer isSign; |
| | |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.PointChangeDto; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<TAppUser> getUserById(Long id) { |
| | | throw new RuntimeException("根据id查询用户失败:"+throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("根据id查询用户失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.api.vo.GetAppUserVipDetail; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<TAppUserVipDetail> getAppUserVipDetail(GetAppUserVipDetail getAppUserVipDetail) { |
| | | throw new RuntimeException("获取用户当前有效的VIP明细调用失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("获取用户当前有效的VIP明细调用失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void updateAppUserVipDetail(TAppUserVipDetail appUserVipDetail) { |
| | | throw new RuntimeException(throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | R.fail(throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | private Integer vipId; |
| | | |
| | | @ApiModelProperty(value = "会员到期时间") |
| | | |
| | | @TableField("vip_end_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime vipEndTime; |
| | | |
| | | @ApiModelProperty(value = "单位id") |
| | |
| | | @ApiModelProperty("剩余天数") |
| | | @TableField(exist = false) |
| | | private Long lastDays; |
| | | @ApiModelProperty(value = "单位名称") |
| | | @TableField(exist = false) |
| | | private String companyName; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("send_month") |
| | | private Integer sendMonth; |
| | | |
| | | |
| | | @ApiModelProperty(value = "当时购买的vipJson") |
| | | @TableField("vip_json") |
| | | private String vipJson; |
| | | @ApiModelProperty(value = "要赠送的优惠卷") |
| | | @TableField("coupon_ids") |
| | | private String couponIds; |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<List<TAccountingStrategyDetail>> getListByAccountingStrategyId(Integer id) { |
| | | throw new RuntimeException("根据计费策略主表id策略明细失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("根据计费策略主表id策略明细失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<TAccountingStrategy> getAccountingStrategyById(Integer id) { |
| | | throw new RuntimeException("根据id查询计费策略失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("根据id查询计费策略失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.api.vo.SiteNameVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<TChargingGun> getChargingGunById(Integer id) { |
| | | throw new RuntimeException("根据id获取充电枪失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("根据id获取充电枪失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getDetailBySiteId") |
| | | @GetMapping("/t-accounting-strategy-detail/getDetailBySiteId") |
| | | R<TAccountingStrategyDetail> getDetailBySiteId(@RequestParam("siteId") Integer siteId); |
| | | /** |
| | | * 通过桩编号查询当前时段使用的策略明细 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getDetailByCode") |
| | | @GetMapping("/t-accounting-strategy-detail/getDetailByCode") |
| | | R<TAccountingStrategyDetail> getDetailByCode(@RequestParam("code") String code); |
| | | /** |
| | | * 校验充电桩计费模版是否准确 |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getListByAccountingStrategyId") |
| | | @GetMapping("/t-accounting-strategy-detail/getListByAccountingStrategyId") |
| | | R<List<TAccountingStrategyDetail>> getListByAccountingStrategyId(@RequestParam("id") Integer id); |
| | | /** |
| | | * 通过桩编号查询当前使用的策略明细列表 |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getDetailListByCode") |
| | | @GetMapping("/t-accounting-strategy-detail/getDetailListByCode") |
| | | R<List<TAccountingStrategyDetail>> getDetailListByCode(@RequestParam("code") String code); |
| | | } |
| | |
| | | public class GunStatusStatisticsVO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "充电桩类型统计 key:充电模式(1=超级快充,2=快充,3=慢充)") |
| | | private Map<Integer,Integer> modeStatistics; |
| | | private List<Map<Integer,Integer>> modeStatistics; |
| | | @ApiModelProperty(value = "状态统计 key:充电模式(1=离线,2=故障,3=充电中)") |
| | | private Map<Integer,Integer> statusStatistics; |
| | | @ApiModelProperty(value = "状态统计根据类型分组") |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public String platformStartCharging(PlatformStartCharging platformStartCharging) { |
| | | throw new RuntimeException("远程启机失败" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return "远程启机失败"; |
| | | } |
| | | |
| | | @Override |
| | | public String platformStopCharging(PlatformStopCharging platformStopCharging) { |
| | | throw new RuntimeException("远程停机失败" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return "远程停机失败"; |
| | | } |
| | | }; |
| | | } |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-other</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | return R.fail("支付回调:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R vipCallBack(String code, String outTradeNo) { |
| | | return R.fail("会员订单回调失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<TActivityVO> activityStatistics(TActivityStatisticsQuery dto) { |
| | |
| | | @PostMapping("/t-vip-order/callBack") |
| | | public R vipCallBack(@RequestParam("code")String code,@RequestParam("outTradeNo")String outTradeNo); |
| | | |
| | | |
| | | /** |
| | | * 管理后台 活动费用统计 |
| | | * @param |
| | |
| | | @TableName("t_accounting_strategy_order") |
| | | public class AccountingStrategyOrder extends BasePojo { |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableField(value = "id") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "站点id") |
| | | @TableField("site_id") |
| | | private Integer siteId; |
| | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | | private String code; |
| | | @ApiModelProperty(value = "标题") |
| | | @TableField("title") |
| | | private String title; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | @TableField("app_user_id") |
| | |
| | | |
| | | @ApiModelProperty(value = "服务费税率") |
| | | private BigDecimal serviceTariff; |
| | | |
| | | @ApiModelProperty(value = "uid") |
| | | private String uid; |
| | | @ApiModelProperty(value = "增值服务费税率") |
| | | private BigDecimal addedServiceTariff; |
| | | @ApiModelProperty(value = "电费") |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-account</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | import java.util.List; |
| | | @Data |
| | | public class VipInfoDto { |
| | | |
| | | private Integer id; |
| | | @ApiModelProperty("月卡价格") |
| | | private BigDecimal monthlyCard; |
| | | @ApiModelProperty(value = "月卡折扣") |
| | |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R updateCoupon(TCoupon coupon) { |
| | | throw new RuntimeException("修改优惠券失败"); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("修改优惠券失败"); |
| | | } |
| | | }; |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R updateGoods(TGoods goods) { |
| | | throw new RuntimeException("修改商品异常"); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("修改商品异常"); |
| | | } |
| | | }; |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.api.feignClient.InvoiceTypeClient; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<TInvoiceType> getInvoiceType(Integer id) { |
| | | throw new RuntimeException(throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail(throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.dto.TagListQueryDto; |
| | | import com.ruoyi.other.api.dto.UnitListQueryDto; |
| | |
| | | public R<TCoupon> getCouponById(Integer id) { |
| | | return R.fail("查询优惠卷:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TEnterpriseUserApplication>> getTnterPrise() { |
| | | return R.fail("查询:"+throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TUserSite; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R addUserSite(List<TUserSite> userSite) { |
| | | throw new RuntimeException("添加用户站点失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("添加用户站点失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R delUserSite(Long userId) { |
| | | throw new RuntimeException("删除用户站点失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("删除用户站点失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.other.api.domain.TCompany; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.api.domain.TUserTag; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.api.dto.TagListQueryDto; |
| | | import com.ruoyi.other.api.dto.UnitListQueryDto; |
| | | import com.ruoyi.other.api.factory.OtherFallbackFactory; |
| | | import com.ruoyi.other.api.vo.CouponListVOVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @PostMapping(value = "/t-coupon/getCouponById") |
| | | R<TCoupon> getCouponById(@RequestParam("id") Integer id); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @PutMapping(value = "/t-enterprise-user-application/export") |
| | | R<List<TEnterpriseUserApplication>> getTnterPrise(); |
| | | } |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<AliPaymentResp> payment(AliPaymentReq req) { |
| | | throw new RuntimeException("调起支付宝小程序支付失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("调起支付宝小程序支付失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<AliQueryOrder> query(String outTradeNo) { |
| | | throw new RuntimeException("查询支付订单失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("查询支付订单失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void close(String outTradeNo) { |
| | | throw new RuntimeException("关闭支付订单失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | R.fail("关闭支付订单失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<RefundResp> refund(RefundReq dto) { |
| | | throw new RuntimeException("支付宝退款失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("支付宝退款失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | |
| | | import com.ruoyi.payment.api.vo.NotifyV3PayDecodeRespBody; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import com.ruoyi.payment.api.vo.WxRefundNotifyResp; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | |
| | | @Override |
| | | public R<NotifyV3PayDecodeRespBody> queryOrderInfo(String orderId) { |
| | | throw new RuntimeException("查询支付订单信息失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("查询支付订单信息失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Map<String, Object>> orderPay(PaymentOrder paymentOrder) { |
| | | throw new RuntimeException("调起微信支付失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("调起微信支付失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void close(String outTradeNo) { |
| | | throw new RuntimeException("关闭支付订单失败:" + throwable.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | R.fail("关闭支付订单失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<String> refundOrderR(WxPaymentRefundModel model) { |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("微信退款失败:" + throwable.getMessage()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-alibaba-seata</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.model.*; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | |
| | | |
| | | @Override |
| | | public R<Boolean> updateSysUser(SysUser sysUser) { |
| | | throw new RuntimeException("更新用户失败:" + cause.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("更新用户失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public R addSysUser(SysUser user) { |
| | | throw new RuntimeException("添加用户失败:" + cause.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("添加用户失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R resetPassword(SysUser user) { |
| | | throw new RuntimeException("重置用户密码失败:" + cause.getMessage()); |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return R.fail("重置用户密码失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | |
| | | server: |
| | | port: 9100 |
| | | tomcat: |
| | | basedir: /data/tomcat |
| | | # Spring |
| | | spring: |
| | | profiles: |
| | |
| | | name: ruoyi-auth |
| | | main: |
| | | allow-bean-definition-overriding: true |
| | | allow-circular-references: true |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-account</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-system</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
New file |
| | |
| | | package com.ruoyi.gateway.config.properties; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.cloud.context.config.annotation.RefreshScope; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | | @RefreshScope |
| | | @ConfigurationProperties(prefix = "security.anti-shake") |
| | | public class AntiShakeProperties { |
| | | |
| | | private Boolean enable; |
| | | |
| | | private Long interval; |
| | | |
| | | public Boolean getEnable() { |
| | | return enable; |
| | | } |
| | | |
| | | public void setEnable(Boolean enable) { |
| | | this.enable = enable; |
| | | } |
| | | |
| | | public Long getInterval() { |
| | | return interval; |
| | | } |
| | | |
| | | public void setInterval(Long interval) { |
| | | this.interval = interval; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.gateway.config.properties; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.cloud.context.config.annotation.RefreshScope; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | | @RefreshScope |
| | | @ConfigurationProperties(prefix = "security.sign") |
| | | public class SignProperties { |
| | | |
| | | private Boolean enable; |
| | | |
| | | public Boolean getEnable() { |
| | | return enable; |
| | | } |
| | | |
| | | public void setEnable(Boolean enable) { |
| | | this.enable = enable; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.gateway.filter; |
| | | |
| | | import com.ruoyi.gateway.config.properties.AntiShakeProperties; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | // 排除过滤的 uri 地址,nacos自行添加 |
| | | @Autowired |
| | | private IgnoreWhiteProperties ignoreWhite; |
| | | @Autowired |
| | | private AntiShakeProperties antiShakeProperties; |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | try { |
| | | antiShake(request); |
| | | }catch (Exception e){ |
| | | log.error("[重复提交]请求路径:{}", exchange.getRequest().getPath()); |
| | | log.error(e.getMessage()); |
| | | return ServletUtils.webFluxResponseWriter(exchange.getResponse(), e.getMessage(), HttpStatus.SUCCESS); |
| | | } |
| | | |
| | |
| | | */ |
| | | public void antiShake(ServerHttpRequest request) throws Exception{ |
| | | HttpMethod method = request.getMethod(); |
| | | if(HttpMethod.OPTIONS == method){ |
| | | if(HttpMethod.OPTIONS == method || !antiShakeProperties.getEnable()){ |
| | | return; |
| | | } |
| | | HttpHeaders headers = request.getHeaders(); |
| | |
| | | Long old_timestamp = Long.valueOf(o.toString()); |
| | | Long new_timestamp = Long.valueOf(timestamp); |
| | | //两个请求时间差小于1秒,判定为重复提交 |
| | | if((new_timestamp - old_timestamp) <= 500){ |
| | | throw new RuntimeException("重复提交"); |
| | | if((new_timestamp - old_timestamp) <= antiShakeProperties.getInterval()){ |
| | | throw new RuntimeException(url + "----->重复提交"); |
| | | }else{ |
| | | cacheMap.put(url, timestamp); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.constant.HttpStatus; |
| | | import com.ruoyi.common.core.constant.SecurityConstants; |
| | | import com.ruoyi.common.core.constant.TokenConstants; |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.gateway.config.properties.IgnoreWhiteProperties; |
| | | import io.jsonwebtoken.Claims; |
| | | import com.ruoyi.gateway.config.properties.SignProperties; |
| | | import org.apache.commons.codec.binary.Base64; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.cloud.gateway.filter.GatewayFilterChain; |
| | | import org.springframework.cloud.gateway.filter.GlobalFilter; |
| | | import org.springframework.core.Ordered; |
| | | import org.springframework.core.io.buffer.DataBuffer; |
| | | import org.springframework.core.io.buffer.DataBufferUtils; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.server.reactive.ServerHttpRequest; |
| | | import org.springframework.http.server.reactive.ServerHttpRequestDecorator; |
| | |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicReference; |
| | | |
| | | /** |
| | | * 网关鉴权 |
| | |
| | | public class SignFilter implements GlobalFilter, Ordered { |
| | | private static final Logger log = LoggerFactory.getLogger(SignFilter.class); |
| | | |
| | | @Value("${security.sign}") |
| | | private boolean parameter_signature; |
| | | |
| | | @Autowired |
| | | private IgnoreWhiteProperties ignoreWhite; |
| | | |
| | | @Autowired |
| | | private SignProperties signProperties; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | String sign = request.getHeaders().getFirst(TokenConstants.SIGN); |
| | | String nonce_str = request.getHeaders().getFirst(TokenConstants.NONCE_STR); |
| | | if (parameter_signature && StringUtils.isEmpty(sign)) { |
| | | if (signProperties.getEnable() && StringUtils.isEmpty(sign)) { |
| | | return unauthorizedResponse(exchange, "签名不能为空!"); |
| | | } |
| | | if (parameter_signature && StringUtils.isEmpty(nonce_str)) { |
| | | if (signProperties.getEnable() && StringUtils.isEmpty(nonce_str)) { |
| | | return unauthorizedResponse(exchange, "签名不能为空!"); |
| | | } |
| | | if(parameter_signature){ |
| | | if(signProperties.getEnable()){ |
| | | return authSign(exchange, chain, sign, nonce_str); |
| | | } |
| | | return chain.filter(exchange.mutate().request(mutate.build()).build()); |
| | |
| | | server: |
| | | port: 9000 |
| | | tomcat: |
| | | basedir: /data/tomcat |
| | | max-swallow-size: 100MB |
| | | # Spring |
| | | spring: |
| | | application: |
| | |
| | | server-addr: 192.168.110.169:8848 |
| | | dataId: sentinel-ruoyi-gateway |
| | | groupId: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | data-type: json |
| | | rule-type: gw-flow |
| | | --- |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: c2f47d1c-6355-4a68-b357-7523d73b2d13 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: c2f47d1c-6355-4a68-b357-7523d73b2d13 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | |
| | | eager: true |
| | | transport: |
| | | # 控制台地址 |
| | | dashboard: 122.9.150.46:8718 |
| | | dashboard: 192.168.0.137:8718 |
| | | # nacos配置持久化 |
| | | datasource: |
| | | ds1: |
| | | nacos: |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | dataId: sentinel-ruoyi-gateway |
| | | groupId: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | data-type: json |
| | | rule-type: gw-flow |
| | | --- |
| | |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | server: |
| | | port: 9800 |
| | | tomcat: |
| | | basedir: /data/tomcat |
| | | # Spring |
| | | spring: |
| | | application: |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | |
| | | <version>3.6.2</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | |
| | | <modules> |
| | | <module>ruoyi-account</module> |
| | | <module>ruoyi-chargingPile</module> |
| | |
| | | <version>1.0.4</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.huaweicloud.apigateway</groupId> |
| | | <artifactId>apigateway</artifactId> |
| | | <version>3.2.5</version> |
| | | <scope>system</scope> |
| | | <systemPath>${project.basedir}/lib/java-sdk-core-3.2.5.jar</systemPath> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | <directory>src/main/resources</directory> |
| | | </resource> |
| | | <resource> |
| | | <directory>lib</directory> |
| | | <targetPath>/BOOT-INF/lib/</targetPath> |
| | | <includes> |
| | | <include>**/*.jar</include> |
| | | </includes> |
| | | </resource> |
| | | <resource> |
| | | <directory>src/main/java</directory> |
| | | <includes> |
| | | <include>**/*.xml</include> |
| | |
| | | return R.ok(page); |
| | | } |
| | | List<Integer> vipIds = new ArrayList<>(); |
| | | vipIds = page.getRecords().stream().map(TAppUser::getVipId).collect(Collectors.toList()); |
| | | // vipIds = page.getRecords().stream().map(TAppUser::getVipId).collect(Collectors.toList()); |
| | | //获取会员map |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(vipIds); |
| | | //循环处理 |
| | |
| | | appUser.setTagName(byIdTag.getData().getName()); |
| | | } |
| | | } |
| | | //匹配vipMap的值 |
| | | appUser.setVipName(vipMap.getData().get(appUser.getVipId())); |
| | | if (appUser.getVipEndTime()!=null&&appUser.getVipEndTime().isAfter(LocalDateTime.now())) { |
| | | //匹配vipMap的值 |
| | | appUser.setVipName(vipMap.getData().get(appUser.getVipId())); |
| | | } |
| | | //累计充电次数 |
| | | R<Long> useOrderCount = chargingOrderClient.useOrderCount(appUser.getId()); |
| | | appUser.setOrderCount(useOrderCount.getData()); |
| | | appUser.setUid(appUser.getId().toString()); |
| | | if (appUser.getCompanyId()!=null){ |
| | | TCompany data = otherClient.unitDetail(appUser.getCompanyId()).getData(); |
| | | if (data!=null){ |
| | | appUser.setCompanyName(data.getName()); |
| | | } |
| | | } |
| | | |
| | | TAppUserCar one1 = appUserCarService.lambdaQuery().eq(TAppUserCar::getAppUserId, appUser.getId()).orderByDesc(BasePojo::getCreateTime).last("limit 1").one(); |
| | | if (one1!=null){ |
| | |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | //已签到日期 |
| | | @ApiOperation(value = "本月已签到日期", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/has/sign") |
| | |
| | | TAppUser byId = appUserService.getById(userId); |
| | | appUserCar.setAppUserId(userId); |
| | | |
| | | //判断当前用户是否为vip |
| | | |
| | | |
| | | |
| | | //如果是第一次添加车辆,增加积分 |
| | | Long count = appUserCarService.lambdaQuery().eq(TAppUserCar::getAppUserId, userId).count(); |
| | | |
| | |
| | | appletUserDecodeData.setOpenId(openid); |
| | | return AjaxResult.success(appUserService.wxLogin(appletUserDecodeData,data.getInviteUserId())); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 测试用 |
| | | * @param appletUserDecodeData |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "通过code获得openid,获取用户信息",tags = {"微信小程序登录"}) |
| | | @PostMapping("/openIdByJsCodeTest") |
| | | public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestBody AppletUserDecodeData appletUserDecodeData) { |
| | | return AjaxResult.success(appUserService.wxLogin(appletUserDecodeData, null)); |
| | | } |
| | | } |
| | |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(1); |
| | | integers.add(2); |
| | | |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | QueryWrapper<TAppCoupon> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("coupon_id",dto.getCouponId()); |
| | | wrapper.in("ways_to_obtain",integers); |
| | | if (StringUtils.hasLength(dto.getPhone())){ |
| | | List<Long> collect = tAppUserMapper.selectList(new QueryWrapper<TAppUser>().like("phone", dto.getPhone())).stream() |
| | | .map(TAppUser::getId).collect(Collectors.toList()); |
| | | if(collect.isEmpty()){ |
| | | collect.add(-1L); |
| | | } |
| | | wrapper.in("id",collect); |
| | | } |
| | | if (dto.getStatus()!=null){ |
| | | wrapper.eq("status",dto.getStatus()); |
| | | } |
| | |
| | | package com.ruoyi.account.task; |
| | | |
| | | |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import org.intellij.lang.annotations.RegExp; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | @Resource |
| | | private TAppUserVipDetailService tAppUserVipDetailService; |
| | | |
| | | @Resource |
| | | private TAppUserService appUserService; |
| | | |
| | | |
| | | /** |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void changeVipId(){ |
| | | LocalDate currentDate = LocalDate.now(); |
| | | List<TAppUserVipDetail> recentDetails = tAppUserVipDetailService.lambdaQuery() |
| | | .le(TAppUserVipDetail::getStartTime, currentDate) |
| | | .ge(TAppUserVipDetail::getEndTime, currentDate) |
| | | .orderByDesc(TAppUserVipDetail::getStartTime).list(); |
| | | for (TAppUserVipDetail recentDetail : recentDetails) { |
| | | TAppUser byId = appUserService.getById(recentDetail.getAppUserId()); |
| | | if (byId!=null) { |
| | | byId.setVipId(recentDetail.getVipId()); |
| | | appUserService.updateById(byId); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | "]}"; |
| | | String hp = num.substring(0, 2);// |
| | | JSONObject jsonObject = JSONObject.parseObject(jsonStr); |
| | | JSONArray data = jsonObject.getJSONArray("data"); |
| | | JSONArray data = jsonObject.getJSONArray("date"); |
| | | List<CarNumDto> carNumDtos = JSONObject.parseArray(data.toJSONString(), CarNumDto.class); |
| | | CarNumDto carNumDto = new CarNumDto(); |
| | | for (CarNumDto carNumDtoTemp : carNumDtos) { |
| | | if (StringUtils.equals(carNumDto.getCode(), hp)) { |
| | | if (carNumDtoTemp.getCode().equals(hp)) { |
| | | carNumDto.setCity(carNumDtoTemp.getCity()); |
| | | carNumDto.setCode(carNumDtoTemp.getCode()); |
| | | carNumDto.setProvince(carNumDtoTemp.getProvince()); |
| | |
| | | tAppUserVipDetail.setChargeNum(vip.getDiscountTimes()); |
| | | tAppUserVipDetail.setDiscountMoney(vip.getMaximumDeduction()); |
| | | tAppUserVipDetail.setSendMonth(1); |
| | | tAppUserVipDetail.setVipJson(JSON.toJSONString(info.getData())); |
| | | tAppUserVipDetailService.save(tAppUserVipDetail); |
| | | //直接赠送优惠卷 |
| | | for (SendCouponDto sendCouponDto : javaList) { |
| | |
| | | tAppUserVipDetail1.setChargeNum(vip.getDiscountTimes()); |
| | | tAppUserVipDetail1.setDiscountMoney(vip.getMaximumDeduction()); |
| | | tAppUserVipDetail1.setSendMonth(1); |
| | | tAppUserVipDetail.setVipJson(JSON.toJSONString(info.getData())); |
| | | tAppUserVipDetailService.save(tAppUserVipDetail1); |
| | | |
| | | } |
| | |
| | | server: |
| | | port: 9200 |
| | | tomcat: |
| | | basedir: /data/tomcat |
| | | # Spring |
| | | spring: |
| | | application: |
| | |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | dashboard: 192.168.0.137:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | @PostMapping("/getDetailBySiteId") |
| | | @GetMapping("/getDetailBySiteId") |
| | | public R<TAccountingStrategyDetail> getDetailBySiteId(@RequestParam("siteId") Integer siteId){ |
| | | Site site = siteService.getById(siteId); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | |
| | | * @param code 设备编号 |
| | | * @return |
| | | */ |
| | | @PostMapping("/getDetailByCode") |
| | | public R<TAccountingStrategyDetail> getDetailByPileId(@RequestParam("code") String code){ |
| | | @GetMapping("/getDetailByCode") |
| | | public R<TAccountingStrategyDetail> getDetailByCode(@RequestParam("code") String code){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,code) |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getListByAccountingStrategyId") |
| | | @GetMapping("/getListByAccountingStrategyId") |
| | | public R<List<TAccountingStrategyDetail>> getListByAccountingStrategyId(@RequestParam("id") Integer id){ |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.list(new LambdaQueryWrapper<TAccountingStrategyDetail>().eq(TAccountingStrategyDetail::getAccountingStrategyId, id)); |
| | | return R.ok(list); |
| | |
| | | * @param code |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-accounting-strategy-detail/getDetailListByCode") |
| | | @GetMapping("/getDetailListByCode") |
| | | public R<List<TAccountingStrategyDetail>> getDetailListByCode(@RequestParam("code") String code){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | |
| | | @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"}) |
| | | @PutMapping("/downloadSettlement") |
| | | @Log(title = "【结算表记录】下载结算表", businessType = BusinessType.EXPORT) |
| | | public R downloadSettlement(String uid,HttpServletResponse response) |
| | | public R downloadSettlement(@RequestBody ExportUidDto uid,HttpServletResponse response) |
| | | { |
| | | TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid).getData(); |
| | | TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid.getUid()).getData(); |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | | data.setSiteName(data1.get(0).getName()); |
| | |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | * @param siteIds |
| | | * @return |
| | | */ |
| | | Map<Integer, Integer> getModeStatistics(@Param("siteIds")List<Integer> siteIds); |
| | | List<Map<Integer, Integer>> getModeStatistics(@Param("siteIds")List<Integer> siteIds); |
| | | |
| | | /** |
| | | * 统计充电枪状态 |
| | |
| | | SysUser data = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData(); |
| | | tAccountingStrategyVO.setUserName(data.getNickName()); |
| | | if (tAccountingStrategyVO.getFirstUserId()!=null){ |
| | | SysUser first = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData(); |
| | | SysUser first = sysUserClient.getSysUser(tAccountingStrategyVO.getFirstUserId()).getData(); |
| | | tAccountingStrategyVO.setFirstUserName(first==null?null:first.getNickName()); |
| | | } |
| | | if (tAccountingStrategyVO.getTwoUserId()!=null){ |
| | | SysUser two = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData(); |
| | | SysUser two = sysUserClient.getSysUser(tAccountingStrategyVO.getTwoUserId()).getData(); |
| | | tAccountingStrategyVO.setTwoUserName(two==null?null:two.getNickName()); |
| | | } |
| | | // 匹配编辑后的未审核的 |
| | |
| | | GunStatusStatisticsVO gunStatusStatisticsVO = new GunStatusStatisticsVO(); |
| | | |
| | | if(CollectionUtils.isEmpty(siteIds)){ |
| | | Map<Integer, Integer> modeStatisticsNull = new HashMap<>(); |
| | | modeStatisticsNull.put(1, 0); |
| | | modeStatisticsNull.put(2, 0); |
| | | modeStatisticsNull.put(3, 0); |
| | | List<Map<Integer, Integer>> modeStatisticsNull = new ArrayList<>(); |
| | | modeStatisticsNull.add(new HashMap<>(1,0)); |
| | | modeStatisticsNull.add(new HashMap<>(2,0)); |
| | | modeStatisticsNull.add(new HashMap<>(3,0)); |
| | | gunStatusStatisticsVO.setModeStatistics(modeStatisticsNull); |
| | | Map<Integer, Integer> statusStatisticsNull = new HashMap<>(); |
| | | statusStatisticsNull.put(1, 0); |
| | |
| | | gunStatusStatisticsVO.setStatusModeStatistics(statusModeStatistics); |
| | | } |
| | | |
| | | Map<Integer, Integer> modeStatistics = this.baseMapper.getModeStatistics(siteIds); |
| | | List<Map<Integer, Integer>> modeStatistics = this.baseMapper.getModeStatistics(siteIds); |
| | | gunStatusStatisticsVO.setModeStatistics(modeStatistics); |
| | | |
| | | Map<Integer, Integer> statusStatistics = new HashMap<>(); |
| | | List<Map<Integer, Integer>> statusStatistics = new ArrayList<>(); |
| | | // 离线 |
| | | Long count = this.baseMapper.selectCount(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getStatus, 1)); |
| | | statusStatistics.put(1, count.intValue()); |
| | | statusStatistics.add(new HashMap<>(1,count.intValue())); |
| | | // statusStatistics.put(1, count.intValue()); |
| | | // 故障 |
| | | count = this.baseMapper.selectCount(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getStatus, 7)); |
| | | statusStatistics.put(2, count.intValue()); |
| | | statusStatistics.add(new HashMap<>(2,count.intValue())); |
| | | |
| | | // statusStatistics.put(2, count.intValue()); |
| | | // 充电中 |
| | | count = this.baseMapper.selectCount(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .in(TChargingGun::getStatus, Arrays.asList(3,4,5,6))); |
| | | statusStatistics.put(3, count.intValue()); |
| | | statusStatistics.add(new HashMap<>(3,count.intValue())); |
| | | |
| | | // statusStatistics.put(3, count.intValue()); |
| | | gunStatusStatisticsVO.setModeStatistics(statusStatistics); |
| | | |
| | | List<StatusModeStatisticsVO> statusModeStatisticsVOS = new ArrayList<>(); |
| | |
| | | server: |
| | | port: 9300 |
| | | tomcat: |
| | | basedir: /data/tomcat |
| | | # Spring |
| | | spring: |
| | | application: |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | |
| | | <select id="getStatusModeStatistics" resultType="com.ruoyi.chargingPile.api.vo.StatusModeStatisticsVO"> |
| | | SELECT |
| | | charge_mode, |
| | | IFNULL((SELECT COUNT(*) FROM your_table WHERE status = 2),0) AS freeCount, |
| | | IFNULL((SELECT COUNT(*) FROM your_table WHERE status = 5),0) AS filledCount, |
| | | IFNULL((SELECT COUNT(*) FROM your_table WHERE status = 3),0) AS insertCount, |
| | | IFNULL((SELECT COUNT(*) FROM your_table WHERE status = 4),0) AS chargingCount |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 2),0) AS freeCount, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 5),0) AS filledCount, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 3),0) AS insertCount, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 4),0) AS chargingCount |
| | | FROM t_charging_gun |
| | | WHERE del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} AND charge_mode = #{chargeMode} |
| | | <if test="siteIds != null and siteIds.size()>0"> |
| | |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY charge_mode |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | */ |
| | | public static final String END_CHARGE = "end_charge"; |
| | | /** |
| | | * 错误报文 |
| | | */ |
| | | public static final String ERROR_MESSAGE = "error_message"; |
| | | /** |
| | | * 计费模型验证请求 |
| | | */ |
| | | public static final String BILLING_MODE_VERIFY ="billing_mode_verify"; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 对时设置 |
| | | * @param timingSetting 实体对象 |
| | | * @return |
| | | */ |
| | | @PostMapping("/timingSetting") |
| | | public String timingSetting(@RequestBody TimingSetting timingSetting){ |
| | | return iotMessageProduce.sendMessage(timingSetting.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING.getKey(),messageUtil.timingSetting(timingSetting)); |
| | | } |
| | | |
| | | /** |
| | | * 对时设置应答 |
| | | * @param timingSettingReply 实体对象 |
| | | * @return |
| | |
| | | */ |
| | | WORKING_PARAMETER_SETTING ("充电桩工作参数设置","working_parameter_setting"), |
| | | /** |
| | | * 对时设置 |
| | | */ |
| | | TIMING_SETTING ("对时设置","timing_setting"), |
| | | /** |
| | | * 对时设置应答 |
| | | */ |
| | | TIMING_SETTING_REPLY ("对时设置应答","timing_setting_reply"), |
| | |
| | | /** |
| | | * 创建设备 |
| | | * @param productId 产品ID |
| | | * @param nodeId 设备标识码 通常使用IMEI、MAC地址或Serial No作为node_id |
| | | * @param deviceId 设备ID 使用CodeGenerateUtils.generateVolumeSn() |
| | | * @param nodeId 设备标识码 设备编号 |
| | | * @param deviceName 设备名称 |
| | | * @param description 设备描述 |
| | | * @return AddDeviceResponse |
| | | */ |
| | | public AddDeviceResponse addDeviceRequest(String productId,String nodeId,String deviceId,String deviceName,String description) { |
| | | public AddDeviceResponse addDeviceRequest(String productId,String nodeId,String deviceName,String description) { |
| | | AddDeviceRequest request = new AddDeviceRequest(); |
| | | AddDevice body = new AddDevice(); |
| | | body.withDeviceId(deviceId); |
| | | body.withDeviceId(nodeId); |
| | | body.withNodeId(nodeId); |
| | | body.withDeviceName(deviceName); |
| | | body.withProductId(productId); |
| | |
| | | import com.ruoyi.chargingPile.api.dto.CheckChargingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.integration.iotda.constant.SendTagConstant; |
| | |
| | | import com.ruoyi.integration.iotda.utils.tools.StrategyUtil; |
| | | import com.ruoyi.integration.rocket.model.*; |
| | | import com.ruoyi.integration.rocket.produce.EnhanceProduce; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * iotda消息监听 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/iot") |
| | | public class IotMessageListener { |
| | | |
| | | @Autowired |
| | |
| | | sendResult = enhanceProduce.endChargeMessage(endChargeMessage); |
| | | // 响应硬件 |
| | | break; |
| | | case SendTagConstant.ERROR_MESSAGE: |
| | | ErrorMessageMessage errorMessageMessage = JSON.parseObject(content.toJSONString(),ErrorMessageMessage.class); |
| | | sendResult = enhanceProduce.errorMessageMessage(errorMessageMessage); |
| | | // 响应硬件 |
| | | break; |
| | | case SendTagConstant.BILLING_MODE_VERIFY: |
| | | BillingModeVerifyMessage billingModeVerifyMessage = JSON.parseObject(content.toJSONString(),BillingModeVerifyMessage.class); |
| | | sendResult = enhanceProduce.billingModeVerifyMessage(billingModeVerifyMessage); |
| | |
| | | }else { |
| | | // 查询桩使用的模版 |
| | | CheckChargingStrategyDTO dto = new CheckChargingStrategyDTO(); |
| | | dto.setCode(billingModeVerifyMessage.getBilling_model_code()); |
| | | dto.setCode(billingModeVerifyMessage.getCharging_pile_code()); |
| | | dto.setStrategyDetailId(Integer.valueOf(billingModeVerifyMessage.getBilling_model_code())); |
| | | Boolean check = accountingStrategyDetailClient.checkChargingStrategy(dto).getData(); |
| | | // 校验计费模版是否准确 |
| | |
| | | StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply); |
| | | // 时段设置 |
| | | StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply); |
| | | TAccountingStrategyDetail accountingStrategyDetail = accountingStrategyDetailClient.getDetailByCode(acquisitionBillingModeMessage.getCharging_pile_code()).getData(); |
| | | acquisitionBillingModeReply.setBilling_model_code(accountingStrategyDetail.getId().toString()); |
| | | acquisitionBillingModeReply.setCharging_pile_code(acquisitionBillingModeMessage.getCharging_pile_code()); |
| | | acquisitionBillingModeReply.setLoss_ratio(BigDecimal.ZERO); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply)); |
| | | break; |
| | | case SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA: |
| | |
| | | ChargingPileStartsChargingMessage chargingPileStartsChargingMessage = JSON.parseObject(content.toJSONString(),ChargingPileStartsChargingMessage.class); |
| | | sendResult = enhanceProduce.chargingPileStartsChargingMessage(chargingPileStartsChargingMessage); |
| | | // 响应硬件 |
| | | PlatformConfirmationCharging platformConfirmationCharging = new PlatformConfirmationCharging(); |
| | | platformConfirmationCharging.setCharging_pile_code(chargingPileStartsChargingMessage.getCharging_pile_code()); |
| | | platformConfirmationCharging.setCharging_gun_code(chargingPileStartsChargingMessage.getCharging_gun_code()); |
| | | platformConfirmationCharging.setCard_number(chargingPileStartsChargingMessage.getAccount()); |
| | | platformConfirmationCharging.setAccount_balance(BigDecimal.ZERO); |
| | | platformConfirmationCharging.setAuthentication(1); |
| | | // TODO 若是失败,给出失败原因 |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.PLATFORM_CONFIRMATION_CHARGING.getKey(),messageUtil.platformConfirmationCharging(platformConfirmationCharging)); |
| | | break; |
| | | case SendTagConstant.PLATFORM_START_CHARGING_REPLY: |
| | | PlatformStartChargingReplyMessage platformStartChargingReplyMessage = JSON.parseObject(content.toJSONString(),PlatformStartChargingReplyMessage.class); |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "运营平台远程控制启机",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/platformStartCharging") |
| | | public R platformStartCharging(String orderNum,String deviceId,Long orderId,BigDecimal money) { |
| | | // 运营平台远程控制启机 |
| | | PlatformStartCharging platformStartCharging = new PlatformStartCharging(); |
| | | platformStartCharging.setTransaction_serial_number(orderNum); |
| | | platformStartCharging.setCharging_pile_code(deviceId); |
| | | platformStartCharging.setCharging_gun_code("1"); |
| | | platformStartCharging.setCard_number(orderId.toString()); |
| | | platformStartCharging.setAccount_balance(money); |
| | | String message = iotMessageProduce.sendMessage(platformStartCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_START_CHARGING.getKey(), messageUtil.platformStartCharging(platformStartCharging)); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "运营平台远程停机",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/platformStopCharging") |
| | | public R platformStopCharging(String deviceId) { |
| | | // 运营平台远程停机 |
| | | PlatformStopCharging platformStopCharging = new PlatformStopCharging(); |
| | | platformStopCharging.setCharging_pile_code(deviceId); |
| | | platformStopCharging.setCharging_gun_code("1"); |
| | | String message = iotMessageProduce.sendMessage(platformStopCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_STOP_CHARGING.getKey(),messageUtil.platformStopCharging(platformStopCharging)); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "修改余额",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/updateBalance") |
| | | public R updateBalance(String deviceId,Long orderId) { |
| | | // 修改余额 |
| | | UpdateBalance updateBalance = new UpdateBalance(); |
| | | updateBalance.setCharging_pile_code(deviceId); |
| | | updateBalance.setCharging_gun_code("1"); |
| | | updateBalance.setPhysical_card_number(orderId.toString()); |
| | | updateBalance.setAccount_balance(new BigDecimal(20)); |
| | | String message = iotMessageProduce.sendMessage(updateBalance.getCharging_pile_code(), ServiceIdMenu.UPDATE_BALANCE.getKey(),messageUtil.updateBalance(updateBalance)); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "充电桩工作参数设置",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/workingParameterSetting") |
| | | public R workingParameterSetting(String deviceId) { |
| | | // 充电桩工作参数设置 |
| | | WorkingParameterSetting workingParameterSetting = new WorkingParameterSetting(); |
| | | workingParameterSetting.setCharging_pile_code(deviceId); |
| | | workingParameterSetting.setAllow_work(0); |
| | | workingParameterSetting.setMaximum_output_power(220); |
| | | String message = iotMessageProduce.sendMessage(workingParameterSetting.getCharging_pile_code(), ServiceIdMenu.WORKING_PARAMETER_SETTING.getKey(),messageUtil.workingParameterSetting(workingParameterSetting)); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "对时设置",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/timingSetting") |
| | | public R timingSetting(String deviceId) { |
| | | // 对时设置 |
| | | TimingSetting timingSetting = new TimingSetting(); |
| | | timingSetting.setCharging_pile_code(deviceId); |
| | | timingSetting.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date())); |
| | | String message = iotMessageProduce.sendMessage(timingSetting.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING.getKey(),messageUtil.timingSetting(timingSetting)); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "计费模型设置",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/setupBillingModel") |
| | | public R setupBillingModel(String deviceId) { |
| | | // TODO 罗 计费模型设置 |
| | | SetupBillingModel setupBillingModel = new SetupBillingModel(); |
| | | // 计费模型 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(deviceId).getData(); |
| | | Map<Integer, TAccountingStrategyDetail> strategyPrice = StrategyUtil.getStrategyPrice(accountingStrategyDetails); |
| | | // 价格设置 |
| | | AcquisitionBillingModeReply acquisitionBillingModeReply = new AcquisitionBillingModeReply(); |
| | | StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply); |
| | | // 时段设置 |
| | | StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply); |
| | | TAccountingStrategyDetail accountingStrategyDetail = accountingStrategyDetailClient.getDetailByCode(deviceId).getData(); |
| | | acquisitionBillingModeReply.setBilling_model_code(accountingStrategyDetail.getId().toString()); |
| | | acquisitionBillingModeReply.setCharging_pile_code(deviceId); |
| | | acquisitionBillingModeReply.setLoss_ratio(BigDecimal.ZERO); |
| | | BeanUtils.copyProperties(acquisitionBillingModeReply,setupBillingModel); |
| | | System.err.println(setupBillingModel); |
| | | String message = iotMessageProduce.sendMessage(setupBillingModel.getCharging_pile_code(), ServiceIdMenu.SETUP_BILLING_MODEL.getKey(),messageUtil.setupBillingModel(setupBillingModel)); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "远程重启",tags = {"硬件接口"}) |
| | | @PostMapping(value = "/platformRestart") |
| | | public R platformRestart(String deviceId) { |
| | | // 远程重启 |
| | | PlatformRestart platformRestart = new PlatformRestart(); |
| | | platformRestart.setCharging_pile_code(deviceId); |
| | | platformRestart.setOperate(2); |
| | | String message = iotMessageProduce.sendMessage(platformRestart.getCharging_pile_code(), ServiceIdMenu.PLATFORM_RESTART.getKey(),messageUtil.platformRestart(platformRestart)); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | } |
| | |
| | | @Autowired |
| | | private WorkingParameterSettingService workingParameterSettingService; |
| | | @Autowired |
| | | private TimingSettingService timingSettingService; |
| | | @Autowired |
| | | private TimingSettingReplyService timingSettingReplyService; |
| | | @Autowired |
| | | private SetupBillingModelService setupBillingModelService; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 对时设置 |
| | | * @param timingSetting 实体对象 |
| | | * @return |
| | | */ |
| | | public String timingSetting(TimingSetting timingSetting){ |
| | | timingSettingService.create(timingSetting); |
| | | return getMessageJsonString(timingSetting, ServiceIdMenu.TIMING_SETTING.getValue()); |
| | | } |
| | | /** |
| | | * 对时设置应答 |
| | | * @param timingSettingReply 实体对象 |
| | | * @return |
| | |
| | | } |
| | | accountingStrategyDetails = accountingStrategyDetails.stream().sorted(Comparator.comparing(TAccountingStrategyDetail::getStartTime)).collect(Collectors.toList()); |
| | | for (TAccountingStrategyDetail accountingStrategyDetail : accountingStrategyDetails) { |
| | | if(DateUtils.string2LocalTime(accountingStrategyDetail.getStartTime()).isBefore(time) |
| | | && DateUtils.string2LocalTime(accountingStrategyDetail.getEndTime()).isAfter(time)){ |
| | | String startTime = accountingStrategyDetail.getStartTime(); |
| | | String endTime = accountingStrategyDetail.getEndTime(); |
| | | if("00:00".equals(endTime)){ |
| | | endTime = "23:59"; |
| | | } |
| | | if(DateUtils.string2LocalTime(startTime + ":00").isBefore(time) |
| | | && DateUtils.string2LocalTime(endTime + ":00").isAfter(time)){ |
| | | switch (i){ |
| | | case 1: |
| | | acquisitionBillingModeReply.setTime1(accountingStrategyDetail.getType().equals(1)?0 |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.integration.rocket.model.ErrorMessageMessage; |
| | | |
| | | public interface ErrorMessageMessageService extends BaseService<ErrorMessageMessage> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.EndCharge; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.EndChargeService; |
| | | import com.ruoyi.integration.mongodb.service.ErrorMessageMessageService; |
| | | import com.ruoyi.integration.rocket.model.ErrorMessageMessage; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | @Service |
| | | public class ErrorMessageMessageServiceImpl implements ErrorMessageMessageService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(ErrorMessageMessage errorMessageMessage) { |
| | | mongoTemplate.save(errorMessageMessage); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public ErrorMessageMessage findById(String id) { |
| | | return mongoTemplate.findById(id, ErrorMessageMessage.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<ErrorMessageMessage> findAll() { |
| | | return mongoTemplate.findAll(ErrorMessageMessage.class); |
| | | } |
| | | } |
| | |
| | | BeanUtils.copyProperties(message,acquisitionBillingMode); |
| | | acquisitionBillingModeService.create(acquisitionBillingMode); |
| | | // 业务处理 计费模型请求应答 1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(message.getCharging_pile_code()).getData(); |
| | | Map<Integer, TAccountingStrategyDetail> strategyPrice = StrategyUtil.getStrategyPrice(accountingStrategyDetails); |
| | | // 价格设置 |
| | | AcquisitionBillingModeReply acquisitionBillingModeReply = new AcquisitionBillingModeReply(); |
| | | StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply); |
| | | // 时段设置 |
| | | StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply); |
| | | iotMessageProduce.sendMessage(acquisitionBillingModeReply.getCharging_pile_code(), ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply)); |
| | | // List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(message.getCharging_pile_code()).getData(); |
| | | // Map<Integer, TAccountingStrategyDetail> strategyPrice = StrategyUtil.getStrategyPrice(accountingStrategyDetails); |
| | | // // 价格设置 |
| | | // AcquisitionBillingModeReply acquisitionBillingModeReply = new AcquisitionBillingModeReply(); |
| | | // StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply); |
| | | // // 时段设置 |
| | | // StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply); |
| | | // iotMessageProduce.sendMessage(acquisitionBillingModeReply.getCharging_pile_code(), ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply)); |
| | | } |
| | | |
| | | @Override |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.mongodb.service.ErrorMessageMessageService; |
| | | import com.ruoyi.integration.rocket.model.ErrorMessageMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.MessageModel; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | messageModel = MessageModel.CLUSTERING, |
| | | consumerGroup = "charge_error_message", |
| | | topic = "charge_error_message", |
| | | selectorExpression = "error_message", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class ErrorMessageMessageListener extends EnhanceMessageHandler<ErrorMessageMessage> implements RocketMQListener<ErrorMessageMessage> { |
| | | |
| | | @Autowired |
| | | private ErrorMessageMessageService errorMessageMessageService; |
| | | |
| | | |
| | | @Override |
| | | protected void handleMessage(ErrorMessageMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | log.info("错误报文-业务消息处理:{}",message); |
| | | // 持久化消息 |
| | | ErrorMessageMessage errorMessageMessage = new ErrorMessageMessage(); |
| | | BeanUtils.copyProperties(message,errorMessageMessage); |
| | | errorMessageMessageService.create(errorMessageMessage); |
| | | // 业务处理 |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(ErrorMessageMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(ErrorMessageMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(ErrorMessageMessage message) { |
| | | super.dispatchMessage(message); |
| | | } |
| | | } |
| | |
| | | private Integer bms_charging_mode; // BMS 充电模式(1:恒压充电;2:恒流充电) |
| | | private BigDecimal bms_voltage_measurement_value; // BMS 充电电压测量值 |
| | | private BigDecimal bms_current_measurement_value; // BMS 充电电流测量值 |
| | | private Integer bms_battery_voltage_and_group_number; // BMS 最高单体动力蓄电池电压及组号(1-12 位:最高单体动力蓄电池电压,数据分辨率:0.01 V/位,0 V 偏移量;数据范围:0~24 V;13-16 位:最高单体动力蓄电池电压所在组号,数据分辨率:1/位,0 偏移量;数据范围:0~15) |
| | | private BigDecimal bms_battery_voltage; // 最高电压 BMS 最高单体动力蓄电池电压及组号(1-12 位:最高单体动力蓄电池电压,数据分辨率:0.01 V/位,0 V 偏移量;数据范围:0~24 V;13-16 位:最高单体动力蓄电池电压所在组号,数据分辨率:1/位,0 偏移量;数据范围:0~15) |
| | | private Integer bms_group_number; // 所在组号 BMS 最高单体动力蓄电池电压及组号(1-12 位:最高单体动力蓄电池电压,数据分辨率:0.01 V/位,0 V 偏移量;数据范围:0~24 V;13-16 位:最高单体动力蓄电池电压所在组号,数据分辨率:1/位,0 偏移量;数据范围:0~15) |
| | | private BigDecimal bms_charged_status; // BMS 当前荷电状态 SOC( %) |
| | | private Integer bms_remaining_charging_time; // BMS 估算剩余充电时间 |
| | | private BigDecimal voltage_output_value; // 电桩电压输出值 |
| | |
| | | private BigDecimal bms_battery_charging_status; // BMS 中止荷电状态 SOC |
| | | private BigDecimal bms_minimum_battery_voltage; // BMS 动力蓄电池单体最低电压 |
| | | private BigDecimal bms_maximum_battery_voltage; // BMS 动力蓄电池单体最高电压 |
| | | private Integer bms_minimum_battery_temperature; // BMS 动力蓄电池最低温度 |
| | | private Integer bms_maximum_battery_temperature; // BMS 动力蓄电池最高温度 |
| | | private BigDecimal bms_minimum_battery_temperature; // BMS 动力蓄电池最低温度 |
| | | private BigDecimal bms_maximum_battery_temperature; // BMS 动力蓄电池最高温度 |
| | | private BigDecimal cumulative_charging_time; // 电桩累计充电时间 |
| | | private BigDecimal output_energy; // 电桩输出能量 |
| | | private String charger_code; // 电桩充电机编号 |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ErrorMessageMessage extends BaseMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charger_identification_0; // 接收 SPN2560=0x00 的充电机辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer charger_identification_170; // 接收 SPN2560=0xAA 的充电机辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charger_identification_reserve; // 预留位 |
| | | private Integer time_synchronization_and_maximum_output_charger; // 接收充电机的时间同步和充电机最大输出能力报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer charge_preparation; // 接收充电机完成充电准备报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charge_preparation_reserve; // 预留位 |
| | | private Integer charging_status; // 接收充电机充电状态报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer stop_charging; // 接收充电机中止充电报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charge_reserve; // 预留位 |
| | | private Integer charging_statistics; // 接收充电机充电统计报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_other; // BMS 其他 |
| | | private Integer bms_and_vehicle_identification; // 接收 BMS 和车辆的辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_and_vehicle_identification_reserve; // 预留位 |
| | | private Integer battery_charging_parameter; // 接收电池充电参数报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_completes_charging_preparation; // 接收 BMS 完成充电准备报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_completes_charging_preparation_reserve; // 预留位 |
| | | private Integer total_battery_charging_status; // 接收电池充电总状态报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer battery_charging_requirements; // 接收电池充电要求报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_stop_charging; // 接收 BMS 中止充电报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_reserve; // 预留位 |
| | | private Integer bms_charging_statistics; // 接收 BMS 充电统计报文超时0=正常,1=超时,10=不可信状态) |
| | | private String charger_other; // 充电机其他 |
| | | |
| | | } |
| | |
| | | private BigDecimal bms_maximum_charging_current; // BMS 最高允许充电电流 |
| | | private BigDecimal bms_battery_total_energy; // BMS 动力蓄电池标称总能量 |
| | | private BigDecimal bms_total_charging_voltage; // BMS 最高允许充电总电压 |
| | | private Integer bms_maximum_temperature; // BMS 最高允许温度 |
| | | private BigDecimal bms_maximum_temperature; // BMS 最高允许温度 |
| | | private BigDecimal bms_battery_charging_status; // BMS 整车动力蓄电池荷电状态 (soc) |
| | | private BigDecimal bms_battery_voltage; // BMS 整车动力蓄电池当前电池 电压 |
| | | private BigDecimal maximum_output_voltage; // 电桩最高输出电压 |
| | |
| | | private Integer insertion_status; // 是否插枪(0:否,1:是) |
| | | private BigDecimal output_voltage; // 输出电压,精确到小数点后一位;待机置零 |
| | | private BigDecimal output_current; // 输出电流,精确到小数点后一位;待机置零 |
| | | private Integer gun_line_temperature; // 枪线温度,整形,偏移量-50;待机置零 |
| | | private BigDecimal gun_line_temperature; // 枪线温度,整形,偏移量-50;待机置零 |
| | | private String gun_line_code; // 枪线编码,没有置零 |
| | | private Integer soc; // SOC待机置零;交流桩置零 |
| | | private Integer battery_temperature; // 电池组最高温度,整形,偏移量-50 ºC;待机置零;交流桩置零 |
| | | private BigDecimal battery_temperature; // 电池组最高温度,整形,偏移量-50 ºC;待机置零;交流桩置零 |
| | | private Integer cumulative_charging_time; // 累计充电时间,单位:min;待机置零 |
| | | private Integer time_remaining; // 剩余时间,单位:min;待机置零、交流桩置零 |
| | | private BigDecimal charging_degree; // 充电度数,精确到小数点后四位;待机置零 |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.integration.api.model.ErrorMessage; |
| | | import com.ruoyi.integration.api.model.ParameterSetting; |
| | | import com.ruoyi.integration.iotda.constant.SendTagConstant; |
| | | import com.ruoyi.integration.rocket.model.*; |
| | |
| | | message.setSource(SendTagConstant.END_CHARGE); |
| | | return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.END_CHARGE, SendTagConstant.END_CHARGE, message); |
| | | } |
| | | /** |
| | | * 错误报文 |
| | | */ |
| | | public SendResult errorMessageMessage(ErrorMessageMessage message) { |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagConstant.ERROR_MESSAGE); |
| | | return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.ERROR_MESSAGE, SendTagConstant.ERROR_MESSAGE, message); |
| | | } |
| | | |
| | | /** |
| | | * 计费模型验证请求 |
| | |
| | | server: |
| | | port: 9700 |
| | | tomcat: |
| | | basedir: /data/tomcat |
| | | # Spring |
| | | spring: |
| | | application: |
| | |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | |
| | | --- |
| | | spring: |
| | | cloud: |
| | | stream: |
| | | rocketmq: |
| | | binder: |
| | | name-server: 127.0.0.1:9876 |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | |
| | | </description> |
| | | |
| | | <dependencies> |
| | | <!--网易邮件--> |
| | | <dependency> |
| | | <groupId>javax.mail</groupId> |
| | | <artifactId>javax.mail-api</artifactId> |
| | | <version>1.6.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.sun.mail</groupId> |
| | | <artifactId>jakarta.mail</artifactId> |
| | | <version>1.6.5</version> |
| | | </dependency> |
| | | <!-- ruoyi-modules-other-api --> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | |
| | | import com.ruoyi.order.service.TOrderInvoiceService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.compress.utils.IOUtils; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.activation.DataHandler; |
| | | import javax.activation.FileDataSource; |
| | | import javax.annotation.Resource; |
| | | import javax.mail.*; |
| | | import javax.mail.internet.*; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.*; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | TOrderInvoice orderInvoice = orderInvoiceService.getById(id); |
| | | orderInvoice.setInvoiceUrl(invoiceUrl); |
| | | orderInvoiceService.updateById(orderInvoice); |
| | | // 发送邮箱 |
| | | // 收件人电子邮箱,TODO 换成自己的收件箱 |
| | | String to = orderInvoice.getMailbox(); |
| | | // 发件人电子邮箱,TODO 换成自己的发件箱 |
| | | String from = "13281306557@163.com"; |
| | | // 指定发送邮件的主机为 |
| | | String host = "smtp.163.com"; |
| | | // 获取系统属性 |
| | | Properties properties = new Properties(); |
| | | // 设置邮件服务器 |
| | | properties.setProperty("mail.smtp.host", host); |
| | | // 邮件发送协议 |
| | | properties.setProperty("mail.transport.protocol", "smtp"); |
| | | //是否启用调试模式(启用调试模式可打印客户端与服务器交互过程时一问一答的响应消息) |
| | | properties.setProperty("mail.debug","true"); |
| | | properties.setProperty("mail.smtp.auth", "true"); |
| | | // 获取默认session对象 |
| | | Session session = Session.getDefaultInstance(properties,new Authenticator(){ |
| | | @Override |
| | | public PasswordAuthentication getPasswordAuthentication() |
| | | { |
| | | //发件人邮件用户名、授权码,换成自己的发件箱及授权码 |
| | | return new PasswordAuthentication("13281306557@163.com", "NUSdxDQqadYvVek2"); |
| | | } |
| | | }); |
| | | |
| | | try{ |
| | | // 创建默认的 MimeMessage 对象 |
| | | MimeMessage message = new MimeMessage(session); |
| | | // Set From,设置发件人 |
| | | InternetAddress fromMail = new InternetAddress(from); |
| | | //设置发件人名称,TODO 换成自己的发件箱 |
| | | fromMail.setPersonal(MimeUtility.encodeText("明星电力<13281306557@163.com>")); |
| | | message.setFrom(fromMail); |
| | | // Set To: 设置收件人 |
| | | InternetAddress toMail = new InternetAddress(to); |
| | | // TODO 换成自己的收件箱 |
| | | InternetAddress toMail2 = new InternetAddress(to); |
| | | //发多个邮箱 |
| | | Address[] allRecipients = {toMail, toMail2}; |
| | | message.setRecipients(Message.RecipientType.TO, allRecipients); |
| | | // Set Subject: 邮件主体 |
| | | message.setSubject("明星电力"); |
| | | // 设置消息体 |
| | | message.setSentDate(new Date()); |
| | | // 指定为混合关系 |
| | | MimeMultipart msgMultipart = new MimeMultipart("mixed"); |
| | | message.setContent(msgMultipart); |
| | | // 邮件信息组装 |
| | | //组装的顺序非常重要,一定要先组装文本域,再组装文件 |
| | | MimeBodyPart htmlPart = new MimeBodyPart(); |
| | | // 组装内容 |
| | | htmlPart.setContent("This is message content", "text/html;charset=UTF-8"); |
| | | msgMultipart.addBodyPart(htmlPart); |
| | | |
| | | // 组装附件 |
| | | MimeBodyPart filePart = new MimeBodyPart(); |
| | | String imageUrl = invoiceUrl; |
| | | try { |
| | | // 下载数据 |
| | | URL url = new URL(imageUrl); |
| | | InputStream inputStream = url.openStream(); |
| | | byte[] imageBytes = IOUtils.toByteArray(inputStream); |
| | | |
| | | // 创建临时文件 |
| | | File tempFile = File.createTempFile("tempImage", ".png"); |
| | | try (FileOutputStream fos = new FileOutputStream(tempFile)) { |
| | | fos.write(imageBytes); |
| | | } |
| | | |
| | | // 创建 FileDataSource |
| | | FileDataSource fileDataSource = new FileDataSource(tempFile); |
| | | System.out.println("FileDataSource created: " + fileDataSource.getName()); |
| | | // 如果需要,可以使用 DataHandler 进行进一步处理 |
| | | DataHandler dh = new DataHandler(fileDataSource); |
| | | // 清理:删除临时文件(如果不再需要) |
| | | tempFile.deleteOnExit(); // 可根据需要保留或删除 |
| | | filePart.setDataHandler(dh); |
| | | // 附件区别内嵌内容的一个特点是有文件名,为防止中文乱码要编码 |
| | | filePart.setFileName(MimeUtility.encodeText(dh.getName())); |
| | | msgMultipart.addBodyPart(filePart); |
| | | message.saveChanges(); |
| | | //发送 |
| | | //Transport.send(message, message.getAllRecipients()); |
| | | Transport.send(message); |
| | | System.out.println("发送成功"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }catch (MessagingException | UnsupportedEncodingException mex) { |
| | | mex.printStackTrace(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.ruoyi.account.api.dto.GiveVipDto; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.order.api.query.ShoppingOrderQuery; |
| | | import com.ruoyi.order.api.query.VipShoppingOrderQuery; |
| | | import com.ruoyi.order.dto.TEnterpriseExport; |
| | | import com.ruoyi.order.service.TVipOrderService; |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | TVipOrder one = vipOrderService.lambdaQuery().eq(TVipOrder::getCode, code).one(); |
| | | one.setSerialNumber(outTradeNo); |
| | | one.setPaymentStatus(2); |
| | | vipOrderService.updateById(one); |
| | | GiveVipDto giveVipDto = new GiveVipDto(); |
| | | giveVipDto.setVipId(one.getVipId()); |
| | |
| | | } |
| | | |
| | | |
| | | } |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "导出") |
| | | @PutMapping(value = "/export") |
| | | @Log(title = "【申请建桩】导出建桩申请列表", businessType = BusinessType.EXPORT) |
| | | public void export(String landlordPhone) { |
| | | |
| | | R<List<TEnterpriseUserApplication>> tnterPrise = otherClient.getTnterPrise(); |
| | | List<TEnterpriseUserApplication> list = tnterPrise.getData(); |
| | | List<TEnterpriseExport> orderInvoiceExports = new ArrayList<>(); |
| | | for (TEnterpriseUserApplication orderInvoiceVO : list) { |
| | | TEnterpriseExport orderInvoiceExport = new TEnterpriseExport(); |
| | | BeanUtils.copyProperties(orderInvoiceVO,orderInvoiceExport); |
| | | orderInvoiceExport.setCreateTime(DateUtils.localDateTimeToString(orderInvoiceVO.getCreateTime())); |
| | | orderInvoiceExports.add(orderInvoiceExport); |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TEnterpriseExport.class, orderInvoiceExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("集团用户导出.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | workbook.close(); |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.order.dto; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel(value = "导出公司") |
| | | public class TEnterpriseExport implements Serializable { |
| | | |
| | | @Excel(name = "公司名称",width = 30) |
| | | private String companyName; |
| | | @Excel(name = "新能源电动汽车保有量",width = 30) |
| | | private Integer vehiclesNumber; |
| | | @Excel(name = "联系人",width = 30) |
| | | private String contactName; |
| | | @Excel(name = "联系电话",width = 30) |
| | | private String phone; |
| | | @Excel(name = "备注",width = 30) |
| | | private String remark; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "申请时间",width = 30,exportFormat="yyyy-MM-dd HH:mm:ss") |
| | | private String createTime; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpStatus; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | model.setOut_trade_no(chargingOrder.getCode()); |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setReason("充电失败,取消充电订单"); |
| | | model.setNotify_url("http://221.182.45.100:9000/order/t-charging-order/chargingOrderStartupFailureWxRefund"); |
| | | model.setNotify_url("/order/t-charging-order/chargingOrderStartupFailureWxRefund"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(rechargeAmount.multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(rechargeAmount.multiply(new BigDecimal(100)).intValue()); |
| | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private TShoppingOrderService shoppingOrderService; |
| | | @Override |
| | | public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | if (payOrderQueryDto.getType()==1){ |
| | |
| | | |
| | | |
| | | } |
| | | if (payOrderQueryDto.getType()==2){ |
| | | TShoppingOrder tChargingOrder = shoppingOrderService.getById(payOrderQueryDto.getOrderId()); |
| | | TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); |
| | | chargingOrderRefund.setChargingOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | | chargingOrderRefund.setRefundStatus(1); |
| | | chargingOrderRefund.setPayType(tChargingOrder.getPaymentType()); |
| | | chargingOrderRefund.setRefundTime(LocalDateTime.now()); |
| | | chargingOrderRefund.setCode(tChargingOrder.getCode()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); |
| | | chargingOrderRefund.setRefundTitle("后台退款"); |
| | | chargingOrderRefund.setRefundContent("后台退款"); |
| | | chargingOrderRefund.setRefundReason("后台退款"); |
| | | chargingOrderRefund.setRefundRemark("后台退款"); |
| | | chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); |
| | | chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); |
| | | |
| | | if(1 == tChargingOrder.getPaymentType()){ |
| | | WxPaymentRefundModel model = new WxPaymentRefundModel(); |
| | | model.setOut_trade_no(tChargingOrder.getCode()); |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setTransaction_id(tChargingOrder.getSerialNumber()); |
| | | model.setReason("取消订单"); |
| | | model.setNotify_url("http://221.182.45.100:9000/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setCurrency("CNY"); |
| | | model.setAmount(amount); |
| | | R<String> orderR = wxPaymentClient.refundOrderR(model); |
| | | if(200 == orderR.getCode()){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | | } |
| | | |
| | | if(2 == tChargingOrder.getPaymentType()){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(tChargingOrder.getCode()); |
| | | dto.setOutRequestNo(tChargingOrder.getCode()); |
| | | dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | return null; |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | for (TChargingPile datum : data) { |
| | | bigDecimal = bigDecimal.add(datum.getRatedPower()); |
| | | } |
| | | BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(data.size())).setScale(2, RoundingMode.HALF_DOWN); |
| | | |
| | | |
| | | tSettlementConfirm.setIncome(tSettlementConfirm.getElectrovalence().add(tSettlementConfirm.getServiceCharge())); |
| | | // todo 计算利用率 该电站充电桩本月利用率: |
| | |
| | | dto.setSiteName(site.getName()); |
| | | List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, dto.getId())); |
| | | List<Integer> tagIds = tOrderEvaluateTags.stream().map(TOrderEvaluateTag::getEvaluationTagId).collect(Collectors.toList()); |
| | | List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagIds).getData(); |
| | | List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); |
| | | dto.setTags(collect); |
| | | if(tagIds.size() > 0){ |
| | | List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagIds).getData(); |
| | | List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); |
| | | dto.setTags(collect); |
| | | } |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | addOrderInvoice.setAppUserId(userId); |
| | | addOrderInvoice.setCode(code); |
| | | addOrderInvoice.setStatus(1); |
| | | addOrderInvoice.setCreateTime(LocalDateTime.now()); |
| | | this.save(addOrderInvoice); |
| | | //获取开票类型 |
| | | TInvoiceType invoiceType = invoiceTypeClient.getInvoiceType(addOrderInvoice.getInvoiceTypeId()).getData(); |
| | |
| | | PageInfo<TOrderInvoiceVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TOrderInvoiceVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | for (TOrderInvoiceVO tOrderInvoiceVO : list) { |
| | | tOrderInvoiceVO.setUid(tOrderInvoiceVO.getId().toString()); |
| | | List<Long> collect = orderInvoiceDetailService.lambdaQuery().eq(TOrderInvoiceDetail::getOrderInvoiceId, tOrderInvoiceVO.getId()) |
| | | .eq(TOrderInvoiceDetail::getOrderType, 1).list().stream() |
| | | .map(TOrderInvoiceDetail::getOrderId).collect(Collectors.toList()); |
| | |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | }else{ |
| | | TCoupon coupon = couponClient.getCouponById1(tShoppingOrder.getGoodsId()).getData(); |
| | | TCoupon coupon = couponClient.getCouponById1(tShoppingOrder.getCouponId()).getData(); |
| | | name = coupon.getName(); |
| | | imgUrl = coupon.getCoverPicture(); |
| | | } |
| | |
| | | server: |
| | | port: 9400 |
| | | tomcat: |
| | | basedir: /data/tomcat |
| | | # Spring |
| | | spring: |
| | | application: |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | |
| | | <if test="data.createTime2 != null"> |
| | | AND o.create_time <= #{data.createTime2} |
| | | </if> |
| | | <if test="data.ids != null and data.ids() > 0"> |
| | | <if test="data.ids != null and data.ids.size() > 0"> |
| | | AND o.id IN |
| | | <foreach collection="data.ids" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | |
| | | </description> |
| | | |
| | | <dependencies> |
| | | |
| | | <!-- SpringCloud Alibaba Nacos --> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-payment</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel-core</artifactId> |
| | | <version>RELEASE</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | public R delete(@RequestParam("id") Integer id) { |
| | | return R.ok(companyService.removeById(id)); |
| | | } |
| | | |
| | | @PostMapping(value = "/unit/detail") |
| | | public R detail(@RequestParam("id") Integer id) { |
| | | return R.ok(companyService.getById(id)); |
| | | } |
| | | } |
| | | |
| | |
| | | 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.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.query.PassDto; |
| | | import com.ruoyi.other.service.TEnterpriseUserApplicationService; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "集团用户列表") |
| | | @PostMapping(value = "/page") |
| | | public R<Page<TEnterpriseUserApplication>> page(EnterpriseQuery enterpriseQuery) { |
| | | public R<Page<TEnterpriseUserApplication>> page(@RequestBody EnterpriseQuery enterpriseQuery) { |
| | | // 用户id |
| | | if (enterpriseQuery.getPhone()!=null) { |
| | | List<Long> userIds = appUserClient.getUserIdsByPhone(enterpriseQuery.getPhone()).getData(); |
| | | if (userIds.isEmpty()){ |
| | | return R.ok(); |
| | | } |
| | | Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().in(TEnterpriseUserApplication::getAppUserId, userIds).page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); |
| | | return R.ok(page); |
| | | }else { |
| | | Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); |
| | | // if (enterpriseQuery.getPhone()!=null) { |
| | | // List<Long> userIds = appUserClient.getUserIdsByPhone(enterpriseQuery.getPhone()).getData(); |
| | | // if (userIds.isEmpty()){ |
| | | // return R.ok(); |
| | | // } |
| | | // Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().in(TEnterpriseUserApplication::getAppUserId, userIds).page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); |
| | | // return R.ok(page); |
| | | // }else { |
| | | Page<TEnterpriseUserApplication> page = enterpriseUserApplicationService.lambdaQuery().eq(enterpriseQuery.getPhone()!=null&&enterpriseQuery.getPhone()!="",TEnterpriseUserApplication::getPhone,enterpriseQuery.getPhone()).page(Page.of(enterpriseQuery.getPageCurr(), enterpriseQuery.getPageSize())); |
| | | return R.ok(page); |
| | | } |
| | | // } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "导出") |
| | | @PutMapping(value = "/export") |
| | | @Log(title = "【申请建桩】导出建桩申请列表", businessType = BusinessType.EXPORT) |
| | | public R<List<TEnterpriseUserApplication>> export() { |
| | | |
| | | |
| | | List<TEnterpriseUserApplication> list = enterpriseUserApplicationService.lambdaQuery().list(); |
| | | |
| | | return R.ok(list); |
| | | // Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TEnterpriseExport.class, orderInvoiceExports); |
| | | // HttpServletResponse response = WebUtils.response(); |
| | | // response.setCharacterEncoding("utf-8"); |
| | | // ServletOutputStream outputStream = null; |
| | | // try { |
| | | // String fileName = URLEncoder.encode("公司导出.xls", "utf-8"); |
| | | // response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | // response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | // response.setHeader("Pragma", "no-cache"); |
| | | // response.setHeader("Cache-Control", "no-cache"); |
| | | // outputStream = response.getOutputStream(); |
| | | // workbook.write(outputStream); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } finally { |
| | | // try { |
| | | // workbook.close(); |
| | | // outputStream.close(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | |
| | | |
| | | @Log(title = "【集团用户申请】填写备注", businessType = BusinessType.INSERT) |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "备注") |
| | | @PostMapping(value = "/remark") |
| | |
| | | vipInfoDto.setDoubleIntegration(vip.getDoubleIntegration()); |
| | | vipInfoDto.setMallExclusivePrice(vip.getMallExclusivePrice()); |
| | | vipInfoDto.setName(vip.getName()); |
| | | vipInfoDto.setId(vip.getId()); |
| | | List<SendCouponDto> javaList = JSON.parseArray(vip.getCoupon()).toJavaList(SendCouponDto.class); |
| | | List<VipCouponDto> vipCouponDtos = new ArrayList<>(); |
| | | if (!javaList.isEmpty()){ |
| | |
| | | |
| | | @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo/pay") |
| | | public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam(name = "1月2季3年",value = "buyType") Integer buyType, |
| | | @RequestParam(name = "1微信2支付宝",value = "payType") Integer payType |
| | | public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, |
| | | @RequestParam("payType") Integer payType |
| | | ) { |
| | | |
| | | TVip byId = vipService.getById(vipId); |
| | |
| | | import org.apache.logging.log4j.core.config.Order; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | | String userid = request.getHeader("user_id"); |
| | | if(StringUtils.isEmpty(userid)){ |
| | | filterChain.doFilter(request, response); |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | | return; |
| | | } |
| | | String userType = request.getHeader("user_type"); |
| | |
| | | return; |
| | | } |
| | | } |
| | | filterChain.doFilter(request, response); |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | | } |
| | | |
| | | |
| | |
| | | } else { |
| | | tAdvertising.setStartState(2); |
| | | } |
| | | if (tAdvertising.getStatus() == 0 ){ |
| | | // 未上架 |
| | | tAdvertising.setStartState(3); |
| | | |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.other.mapper.TCouponMapper; |
| | | import com.ruoyi.other.mapper.TVipMapper; |
| | | import com.ruoyi.other.service.TVipService; |
| | |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | @Override |
| | | public Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId) { |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | |
| | | |
| | | //生成会员购买订单 |
| | | |
| | | TVipOrder shopOrder = new TVipOrder(); |
| | | shopOrder.setCode(OrderCodeUtil.getOrderCode("HY")); |
| | | shopOrder.setType(1); |
| | | |
| | | shopOrder.setAppUserId(userId); |
| | | shopOrder.setType(1); |
| | | shopOrder.setVipId(byId.getId()); |
| | | shopOrder.setTitle(byId.getName()); |
| | | if (buyType==1){ |
| | | shopOrder.setTitle(byId.getName()+"月卡"); |
| | | }else if (buyType==2){ |
| | | shopOrder.setTitle(byId.getName()+"季卡"); |
| | | }else { |
| | | shopOrder.setTitle(byId.getName()+"年卡"); |
| | | } |
| | | shopOrder.setVipType(buyType); |
| | | shopOrder.setOrderAmount(payMoney.add(discountMoney)); |
| | | shopOrder.setDiscount(discount); |
| | |
| | | paymentOrder.setAmount(shopOrder.getPaymentAmount()); |
| | | paymentOrder.setOpenId(user.getWxOpenid()); |
| | | paymentOrder.setDescription("购买会员"); |
| | | return wxPaymentClient.orderPay(paymentOrder); |
| | | return wxPaymentClient.orderPay(paymentOrder).getData(); |
| | | }else { |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(shopOrder.getCode()); |
| | |
| | | server: |
| | | port: 9600 |
| | | tomcat: |
| | | basedir: /data/tomcat |
| | | # Spring |
| | | spring: |
| | | application: |
| | |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | |
| | | alipayConfig.setSignType(SignType.RSA2.getType()); |
| | | //判断加签方式 |
| | | String signType = aliProperties.getSignType(); |
| | | if(SignType.CERT.getType().equals(signType)){ |
| | | if(SignType.SECRET_KEY.getType().equals(signType)){ |
| | | alipayConfig.setPrivateKey(aliProperties.getPrivateKey()); |
| | | alipayConfig.setAlipayPublicKey(aliProperties.getAlipayPublicKey()); |
| | | return alipayConfig; |
| | | } |
| | | if(SignType.SECRET_KEY.getType().equals(signType)){ |
| | | if(SignType.CERT.getType().equals(signType)){ |
| | | alipayConfig.setAppCertPath(aliProperties.getAppCertPath()); |
| | | alipayConfig.setAlipayPublicCertPath(aliProperties.getAlipayPublicCertPath()); |
| | | alipayConfig.setRootCertPath(aliProperties.getRootCertPath()); |
| | |
| | | System.err.println("----收到购物回调"); |
| | | break; |
| | | case "HY": |
| | | orderClient.vipCallBack(out_trade_no,outRefundNo); |
| | | System.err.println("----收到会员回调"); |
| | | break; |
| | | } |
| | |
| | | import org.apache.poi.util.IOUtils; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | |
| | |
| | | public InputStream getPrivateKeyStream() { |
| | | // 需要证书释放 |
| | | byte[] certData; |
| | | InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(this.privateKeyPath); |
| | | // InputStream certStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(this.privateKeyPath); |
| | | InputStream certStream = null; |
| | | try { |
| | | certStream = new FileInputStream(this.privateKeyPath); |
| | | certData = IOUtils.toByteArray(certStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("私钥文件未找到"); |
| | | }finally { |
| | | try { |
| | | certStream.close(); |
| | | } catch (IOException e) { |
| | | log.error("私钥流关闭异常"); |
| | | if(null != certStream){ |
| | | try { |
| | | certStream.close(); |
| | | } catch (IOException e) { |
| | | log.error("私钥流关闭异常"); |
| | | } |
| | | } |
| | | } |
| | | return new ByteArrayInputStream(certData); |
| | |
| | | public void setMchId(String mchId) { |
| | | this.mchId = mchId; |
| | | } |
| | | |
| | | public String getCallBackUrl() { |
| | | return callBackUrl; |
| | | } |
| | | |
| | | public void setCallBackUrl(String callBackUrl) { |
| | | this.callBackUrl = callBackUrl; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.payment.wx.utils; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.payment.wx.model.WxCloseOrderModel; |
| | |
| | | */ |
| | | protected String buildBaseParam(WxPaymentInfoModel requestBody, String notifyUrl) { |
| | | // 封装基础数据 |
| | | // requestBody.setNotify_url(notifyUrl); |
| | | requestBody.setNotify_url(notifyUrl + requestBody.getNotify_url()); |
| | | String reqBody = WxJsonUtils.toJsonString(requestBody); |
| | | return reqBody; |
| | | } |
| | |
| | | url |
| | | , socketTimeout |
| | | , connectTimeout); |
| | | String repBody = result(httpClient, httpGet); |
| | | NotifyV3PayDecodeRespBody body = WxJsonUtils.parseObject(repBody, NotifyV3PayDecodeRespBody.class); |
| | | return body; |
| | | CloseableHttpResponse response = null; |
| | | try { |
| | | response = httpClient.execute(httpGet); |
| | | int statusCode = response.getStatusLine().getStatusCode(); |
| | | String respBodyStr = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); |
| | | if (WxUtils.getLogger().isDebugEnabled()) { |
| | | WxUtils.debug("请求成功:{}", respBodyStr); |
| | | } |
| | | if(404 == statusCode){ |
| | | return null; |
| | | } |
| | | // 成功相应 |
| | | if (STATUS_CODE == statusCode || OTHER_STATUS_CODE == statusCode ) { |
| | | NotifyV3PayDecodeRespBody body = WxJsonUtils.parseObject(respBodyStr, NotifyV3PayDecodeRespBody.class); |
| | | return body; |
| | | } else { |
| | | WxUtils.error("failed,resp code = {},return body = {}", statusCode, respBodyStr); |
| | | throw new RuntimeException(respBodyStr); |
| | | } |
| | | } catch (ConnectTimeoutException e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("接口超时"); |
| | | } catch (SocketTimeoutException e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("读取接口数据超时"); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException("接口请求失败,请尝试检查网络环境或请求接口是否能正常访问"); |
| | | } finally { |
| | | // 关闭响应 |
| | | try { |
| | | if (response != null) { |
| | | //关闭结果集 |
| | | response.getEntity().getContent().close(); |
| | | response.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | throw new RuntimeException("关闭流异常"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | Map<String, Object> body = WxJsonUtils.parseObject(repBody, Map.class); |
| | | return body; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 请求结果 |
| | |
| | | */ |
| | | @Override |
| | | public Map<String, Object> refund(WxPaymentRefundModel refundModel) { |
| | | // refundModel.setNotify_url(this.config.getV3().getNotifyRefundUrl()); |
| | | refundModel.setNotify_url(this.config.getV3().getNotifyRefundUrl() + refundModel.getNotify_url()); |
| | | return refund(this.httpClient, "/v3/refund/domestic/refunds", this.config.getHttpReadTimeoutMs(), this.config.getHttpConnectTimeoutMs(), refundModel); |
| | | } |
| | | |
| | |
| | | server: |
| | | port: 9500 |
| | | tomcat: |
| | | basedir: /data/tomcat |
| | | # Spring |
| | | spring: |
| | | application: |
| | |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | username: nacos |
| | | password: nacos |
| | | ip: 192.168.110.85 |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.169:8848 |
| | |
| | | # 共享配置 |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | | # username: nacos |
| | | # password: nacos |
| | | registry: |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | | # password: nacos |
| | | cloud: |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |
| | | username: nacos |
| | | password: nacos |
| | | # 生产环境 |
| | | # server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | # namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | | # username: nacos |
| | | # password: nacos |
| | | sentinel: |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |