Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
| | |
| | | </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; |
| | |
| | | public class UserListQueryDto extends BasePage { |
| | | @ApiModelProperty(value = "用户手机号") |
| | | String userPhone; |
| | | @ApiModelProperty(value = "所在省code") |
| | | String provinceCode; |
| | | @ApiModelProperty(value = "所在地code") |
| | | String cityCode; |
| | | @ApiModelProperty(value = "状态 1正常2冻结 3注销") |
| | |
| | | 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(value = "标签名称") |
| | | @TableField(exist = false) |
| | | private String tagName; |
| | | |
| | | @ApiModelProperty(value = "单位名称") |
| | | @TableField(exist = false) |
| | | private String companyName; |
| | | @ApiModelProperty(value = "vip名称") |
| | | @TableField(exist = false) |
| | | private String vipName; |
| | |
| | | @ApiModelProperty("剩余天数") |
| | | @TableField(exist = false) |
| | | private Long lastDays; |
| | | @ApiModelProperty(value = "单位名称") |
| | | @TableField(exist = false) |
| | | private String companyName; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("vip_id") |
| | | private Integer vipId; |
| | | |
| | | @ApiModelProperty(value = "1月卡2季卡3年卡") |
| | | @TableField("vip_type") |
| | | private Integer vipType; |
| | | |
| | | @ApiModelProperty(value = "会员开始时间") |
| | | @TableField("start_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | |
| | | @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 |
| | |
| | | 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 = "状态统计根据类型分组") |
| | |
| | | public class SiteInfoVO { |
| | | @ApiModelProperty(value = "电站名称") |
| | | private String name; |
| | | @ApiModelProperty(value = "桩id") |
| | | private Integer chargingPileId; |
| | | @ApiModelProperty(value = "桩编号") |
| | | private String number; |
| | | @ApiModelProperty(value = "充电枪id") |
| | |
| | | </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> |
| | |
| | | @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; |
| | |
| | | <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 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> |
| | |
| | | private String avatar; |
| | | |
| | | /** 密码 */ |
| | | @NotBlank(message = "密码不能为空") |
| | | private String password; |
| | | |
| | | /** 帐号状态(0正常 1停用) */ |
| | |
| | | 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()); |
| | | 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} |
| | | # 配置文件格式 |
| | |
| | | |
| | | /** |
| | | * 全局异常处理器 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestControllerAdvice |
| | | public class GlobalExceptionHandler |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); |
| | | |
| | | @Value("${spring.servlet.multipart.max-file-size:4MB}") |
| | | private String maxFileSize; |
| | | @Value("${spring.servlet.multipart.max-request-size:100MB}") |
| | | private String maxRequestSize; |
| | | |
| | | |
| | | /** |
| | | * 权限码异常 |
| | | */ |
| | | @ExceptionHandler(NotPermissionException.class) |
| | | public AjaxResult handleNotPermissionException(NotPermissionException e, HttpServletRequest request) |
| | | { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',权限码校验失败'{}'", requestURI, e.getMessage()); |
| | | return AjaxResult.error(HttpStatus.FORBIDDEN, "没有访问权限,请联系管理员授权"); |
| | | } |
| | | |
| | | /** |
| | | * 角色权限异常 |
| | | */ |
| | | @ExceptionHandler(NotRoleException.class) |
| | | public AjaxResult handleNotRoleException(NotRoleException e, HttpServletRequest request) |
| | | { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',角色权限校验失败'{}'", requestURI, e.getMessage()); |
| | | return AjaxResult.error(HttpStatus.FORBIDDEN, "没有访问权限,请联系管理员授权"); |
| | | } |
| | | |
| | | /** |
| | | * 请求方式不支持 |
| | | */ |
| | | @ExceptionHandler(HttpRequestMethodNotSupportedException.class) |
| | | public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e, |
| | | HttpServletRequest request) |
| | | { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod()); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 业务异常 |
| | | */ |
| | | @ExceptionHandler(ServiceException.class) |
| | | public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request) |
| | | { |
| | | log.error(e.getMessage(), e); |
| | | Integer code = e.getCode(); |
| | | return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截未知的运行时异常 |
| | | */ |
| | | @ExceptionHandler(RuntimeException.class) |
| | | public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) |
| | | { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',发生未知异常.", requestURI, e); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 系统异常 |
| | | */ |
| | | @ExceptionHandler(Exception.class) |
| | | public AjaxResult handleException(Exception e, HttpServletRequest request) |
| | | { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',发生系统异常.", requestURI, e); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 自定义验证异常 |
| | | */ |
| | | @ExceptionHandler(BindException.class) |
| | | public AjaxResult handleBindException(BindException e) |
| | | { |
| | | log.error(e.getMessage(), e); |
| | | String message = e.getAllErrors().get(0).getDefaultMessage(); |
| | | return AjaxResult.error(message); |
| | | } |
| | | |
| | | /** |
| | | * 自定义验证异常 |
| | | */ |
| | | @ExceptionHandler(MethodArgumentNotValidException.class) |
| | | public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) |
| | | { |
| | | log.error(e.getMessage(), e); |
| | | String message = e.getBindingResult().getFieldError().getDefaultMessage(); |
| | | return AjaxResult.error(message); |
| | | } |
| | | |
| | | /** |
| | | * 内部认证异常 |
| | | */ |
| | | @ExceptionHandler(InnerAuthException.class) |
| | | public AjaxResult handleInnerAuthException(InnerAuthException e) |
| | | { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 演示模式异常 |
| | | */ |
| | | @ExceptionHandler(DemoModeException.class) |
| | | public AjaxResult handleDemoModeException(DemoModeException e) |
| | | { |
| | | return AjaxResult.error("演示模式,不允许操作"); |
| | | } |
| | | |
| | | @ExceptionHandler(MaxUploadSizeExceededException.class) |
| | | public AjaxResult fileUpLoad(MaxUploadSizeExceededException e) { |
| | | log.error("上传文件异常 => : {}", e.getMessage()); |
| | | return AjaxResult.error("文件识别大小超出限制,允许的大小在" + maxFileSize); |
| | | } |
| | | |
| | | /** |
| | | * 学生端单点登录-异常信息 |
| | | */ |
| | | @ExceptionHandler(UserAppletException.class) |
| | | public AjaxResult<String> studyLoginExceptionHandler(UserAppletException e) { |
| | | return AjaxResult.error(e.getCode(), e.getMessage()); |
| | | } |
| | | public class GlobalExceptionHandler { |
| | | private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); |
| | | |
| | | @Value("${spring.servlet.multipart.max-file-size:50MB}") |
| | | private String maxFileSize; |
| | | @Value("${spring.servlet.multipart.max-request-size:100MB}") |
| | | private String maxRequestSize; |
| | | |
| | | |
| | | /** |
| | | * 权限码异常 |
| | | */ |
| | | @ExceptionHandler(NotPermissionException.class) |
| | | public AjaxResult handleNotPermissionException(NotPermissionException e, HttpServletRequest request) { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',权限码校验失败'{}'", requestURI, e.getMessage()); |
| | | return AjaxResult.error(HttpStatus.FORBIDDEN, "没有访问权限,请联系管理员授权"); |
| | | } |
| | | |
| | | /** |
| | | * 角色权限异常 |
| | | */ |
| | | @ExceptionHandler(NotRoleException.class) |
| | | public AjaxResult handleNotRoleException(NotRoleException e, HttpServletRequest request) { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',角色权限校验失败'{}'", requestURI, e.getMessage()); |
| | | return AjaxResult.error(HttpStatus.FORBIDDEN, "没有访问权限,请联系管理员授权"); |
| | | } |
| | | |
| | | /** |
| | | * 请求方式不支持 |
| | | */ |
| | | @ExceptionHandler(HttpRequestMethodNotSupportedException.class) |
| | | public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e, |
| | | HttpServletRequest request) { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',不支持'{}'请求", requestURI, e.getMethod()); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 业务异常 |
| | | */ |
| | | @ExceptionHandler(ServiceException.class) |
| | | public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request) { |
| | | log.error(e.getMessage(), e); |
| | | Integer code = e.getCode(); |
| | | return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截未知的运行时异常 |
| | | */ |
| | | @ExceptionHandler(RuntimeException.class) |
| | | public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',发生未知异常.", requestURI, e); |
| | | throw new RuntimeException(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 系统异常 |
| | | */ |
| | | @ExceptionHandler(Exception.class) |
| | | public AjaxResult handleException(Exception e, HttpServletRequest request) { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',发生系统异常.", requestURI, e); |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 自定义验证异常 |
| | | */ |
| | | @ExceptionHandler(BindException.class) |
| | | public AjaxResult handleBindException(BindException e) { |
| | | log.error(e.getMessage(), e); |
| | | String message = e.getAllErrors().get(0).getDefaultMessage(); |
| | | return AjaxResult.error(message); |
| | | } |
| | | |
| | | /** |
| | | * 自定义验证异常 |
| | | */ |
| | | @ExceptionHandler(MethodArgumentNotValidException.class) |
| | | public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) { |
| | | log.error(e.getMessage(), e); |
| | | String message = e.getBindingResult().getFieldError().getDefaultMessage(); |
| | | return AjaxResult.error(message); |
| | | } |
| | | |
| | | /** |
| | | * 内部认证异常 |
| | | */ |
| | | @ExceptionHandler(InnerAuthException.class) |
| | | public AjaxResult handleInnerAuthException(InnerAuthException e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 演示模式异常 |
| | | */ |
| | | @ExceptionHandler(DemoModeException.class) |
| | | public AjaxResult handleDemoModeException(DemoModeException e) { |
| | | return AjaxResult.error("演示模式,不允许操作"); |
| | | } |
| | | |
| | | @ExceptionHandler(MaxUploadSizeExceededException.class) |
| | | public AjaxResult fileUpLoad(MaxUploadSizeExceededException e) { |
| | | log.error("上传文件异常 => : {}", e.getMessage()); |
| | | return AjaxResult.error("文件识别大小超出限制,允许的大小在" + maxFileSize); |
| | | } |
| | | |
| | | /** |
| | | * 学生端单点登录-异常信息 |
| | | */ |
| | | @ExceptionHandler(UserAppletException.class) |
| | | public AjaxResult<String> studyLoginExceptionHandler(UserAppletException e) { |
| | | return AjaxResult.error(e.getCode(), e.getMessage()); |
| | | } |
| | | } |
| | |
| | | <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 com.ruoyi.common.security.annotation.EnableCustomConfig; |
| | | import com.ruoyi.common.security.annotation.EnableRyFeignClients; |
| | | import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | | |
| | | /** |
| | |
| | | @EnableTransactionManagement |
| | | public class RuoYiSystemApplication |
| | | { |
| | | public static void main(String[] args) |
| | | { |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(RuoYiSystemApplication.class, args); |
| | | System.out.println("(♥◠‿◠)ノ゙ 系统模块启动成功 ლ(´ڡ`ლ)゙ \n" + |
| | | " .-------. ____ __ \n" + |
| | |
| | | import com.ruoyi.system.query.GetSysUserList; |
| | | import com.ruoyi.system.query.ShopUserStart; |
| | | import com.ruoyi.system.service.*; |
| | | import io.seata.core.context.RootContext; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @ResponseBody |
| | | @PostMapping("/addSysUser") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addSysUser(@RequestBody SysUser user){ |
| | | public R addSysUser(@RequestBody SysUser user) { |
| | | System.err.println("事务ID:" + RootContext.getXID()); |
| | | if(StringUtils.isEmpty(user.getUserName())){ |
| | | user.setUserName(user.getPhonenumber()); |
| | | } |
| | |
| | | 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} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: false #关闭数据库代理 |
| | | enable-auto-data-source-proxy: false |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | |
| | | 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} |
| | | # 配置文件格式 |
| | |
| | | <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> |
| | | select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1 |
| | | </select> |
| | | <select id="getList" resultType="com.ruoyi.system.api.domain.SysUser"> |
| | | select *,nick_name nickName,login_date loginDate,create_time createTime,user_id userId from sys_user where 1=1 |
| | | <select id="getList" resultMap="SysUserResult"> |
| | | select * from sys_user where 1=1 |
| | | <if test="req.search !=null and req.search !=''"> |
| | | and (phonenumber like concat("%", #{phonenumber},"%") or nick_name like concat("%", #{phonenumber},"%")) |
| | | and (phonenumber like concat("%", #{req.search},"%") or nick_name like concat("%", #{req.search},"%")) |
| | | </if> |
| | | <if test="null != req.siteId"> |
| | | and user_id in (select user_id from t_user_site where site_id = #{req.siteId}) |
| | |
| | | <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> |
| | |
| | | Page<TAppUser> page = appUserService.lambdaQuery() |
| | | .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) |
| | | .eq(userListQueryDto.getCompanyId() != null, TAppUser::getCompanyId, userListQueryDto.getCompanyId()) |
| | | .like(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) |
| | | .eq(userListQueryDto.getStatus() != null, TAppUser::getStatus, userListQueryDto.getStatus()) |
| | | .eq(userListQueryDto.getVipTypeId() != null, TAppUser::getVipId, userListQueryDto.getVipTypeId()) |
| | |
| | | pointsQueryDto.setUserId(tokenService.getLoginUserApplet().getUserId()); |
| | | } |
| | | List<Integer> types = new ArrayList<>(); |
| | | if (pointsQueryDto.getType()!=null){ |
| | | if (pointsQueryDto.getType()==null){ |
| | | types.add(1); |
| | | types.add(2); |
| | | types.add(3); |
| | | types.add(4); |
| | | types.add(5); |
| | | types.add(6); |
| | | }else if (pointsQueryDto.getType()==1){ |
| | | types.add(1); |
| | | types.add(2); |
| | | types.add(3); |
| | | types.add(4); |
| | | types.add(5); |
| | | }else if (pointsQueryDto.getType()==2){ |
| | | types.add(6); |
| | | } |
| | | Page<TAppUserIntegralChange> page = integralChangeService.lambdaQuery() |
| | | .eq(TAppUserIntegralChange::getAppUserId, pointsQueryDto.getUserId()) |
| | |
| | | plusDay = 12; |
| | | } |
| | | //增加vipDetail |
| | | giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay); |
| | | giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType()); |
| | | appUserService.updateById(nowUser); |
| | | } |
| | | return R.ok(); |
| | |
| | | if (signService.lambdaQuery().eq(TAppUserSign::getSignDay, LocalDate.now()).eq(TAppUserSign::getAppUserId, userId).count()>0){ |
| | | return R.fail("今日已签到"); |
| | | } |
| | | |
| | | //判断当前生效的vipDetail |
| | | TAppUserVipDetail one = tAppUserVipDetailService.lambdaQuery().le(TAppUserVipDetail::getStartTime, LocalDateTime.now()).ge(TAppUserVipDetail::getEndTime, LocalDateTime.now()).eq(TAppUserVipDetail::getAppUserId, userId).last("limit 1").one(); |
| | | boolean doubleVip = false; |
| | | if (one!=null){ |
| | | TVip tVip = JSONObject.parseObject(one.getVipJson(), TVip.class); |
| | | if (tVip.getDoubleIntegration()==1){ |
| | | doubleVip = true; |
| | | } |
| | | } |
| | | |
| | | //签到业务 |
| | | TAppUserSign appUserSign = new TAppUserSign(); |
| | | appUserSign.setSignDay(LocalDate.now()); |
| | |
| | | Integer points = 0; |
| | | Integer point = jsonObject.getInteger("num1"); |
| | | points= points+point; |
| | | if (doubleVip){ |
| | | points= points+point; |
| | | } |
| | | JSONArray num2 = jsonObject.getJSONArray("num2"); |
| | | if (num2!=null) { |
| | | //获取连续签到的规则放入map |
| | |
| | | Integer i = map.get(days); |
| | | if (i!=null){ |
| | | points= points+i; |
| | | if (doubleVip){ |
| | | points= points+i; |
| | | } |
| | | appUserSign.setIsGift(1); |
| | | signService.updateById(appUserSign); |
| | | } |
| | |
| | | appUserService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | //已签到日期 |
| | | @ApiOperation(value = "本月已签到日期", tags = {"小程序-个人中心-签到"}) |
| | | @GetMapping(value = "/user/has/sign") |
| | |
| | | TAppUser byId = appUserService.getById(userId); |
| | | appUserCar.setAppUserId(userId); |
| | | |
| | | //判断当前生效的vipDetail |
| | | TAppUserVipDetail one = tAppUserVipDetailService.lambdaQuery().le(TAppUserVipDetail::getStartTime, LocalDateTime.now()).ge(TAppUserVipDetail::getEndTime, LocalDateTime.now()).eq(TAppUserVipDetail::getAppUserId, userId).last("limit 1").one(); |
| | | boolean doubleVip = false; |
| | | if (one!=null){ |
| | | TVip tVip = JSONObject.parseObject(one.getVipJson(), TVip.class); |
| | | if (tVip.getDoubleIntegration()==1){ |
| | | doubleVip = true; |
| | | } |
| | | } |
| | | |
| | | //如果是第一次添加车辆,增加积分 |
| | | Long count = appUserCarService.lambdaQuery().eq(TAppUserCar::getAppUserId, userId).count(); |
| | | |
| | |
| | | Integer point = 0; |
| | | //增加车牌50分,必填 |
| | | point = point+jsonObject.getInteger("num1"); |
| | | if (doubleVip){ |
| | | point = point+jsonObject.getInteger("num1"); |
| | | } |
| | | //增加车型分 |
| | | if (StringUtils.isNotEmpty(appUserCar.getVehicleModel())){ |
| | | point = point+jsonObject.getInteger("num2"); |
| | | if (doubleVip){ |
| | | point = point+jsonObject.getInteger("num2"); |
| | | } |
| | | } |
| | | //增加车辆用途分 |
| | | if (StringUtils.isNotEmpty(appUserCar.getVehicleUse())){ |
| | | point = point+jsonObject.getInteger("num3"); |
| | | if (doubleVip){ |
| | | point = point+jsonObject.getInteger("num3"); |
| | | } |
| | | } |
| | | //增加续航分 |
| | | if (StringUtils.isNotEmpty(appUserCar.getEndurance())){ |
| | | point = point+jsonObject.getInteger("num4"); |
| | | if (doubleVip){ |
| | | point = point+jsonObject.getInteger("num4"); |
| | | } |
| | | } |
| | | |
| | | //增加积分记录 |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),""); |
| | | byId.setPoints(byId.getPoints()+point); |
| | | byId.setFirstAdd(1); |
| | | appUserService.updateById(byId); |
| | | |
| | | |
| | | } |
| | | CarNumDto carNumDto = CarUtil.carNum(appUserCar.getLicensePlate()); |
| | | if (carNumDto==null){ |
| | | return R.fail("请输入正确的车牌"); |
| | | } |
| | | |
| | | byId.setCityCode(carNumDto.getAreaCode()); |
| | | byId.setProvinceCode(carNumDto.getAreaCode().substring(0,2)+"0000"); |
| | | appUserService.updateById(byId); |
| | | |
| | | // |
| | | appUserCarService.saveOrUpdate(appUserCar); |
| | |
| | | public AjaxResult editInvoiceInformation(@RequestBody TInvoiceInformation invoiceInformation){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | //如果当前是默认抬头,则需要去除其他的默认配置 |
| | | if(1 == invoiceInformation.getIsDefault()){ |
| | | if(null != invoiceInformation.getIsDefault() && 1 == invoiceInformation.getIsDefault()){ |
| | | TInvoiceInformation one = invoiceInformationService.getOne(new LambdaQueryWrapper<TInvoiceInformation>().eq(TInvoiceInformation::getDelFlag, 0) |
| | | .eq(TInvoiceInformation::getIsDefault, 1).eq(TInvoiceInformation::getAppUserId, userId)); |
| | | if(null != one && !one.getId().equals(invoiceInformation.getId())){ |
| | |
| | | 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 javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | |
| | | @Scheduled(fixedRate = 1000 * 60) |
| | | public void changeVipId(){ |
| | | LocalDate currentDate = LocalDate.now(); |
| | | LocalDateTime currentDate = LocalDateTime.now(); |
| | | List<TAppUserVipDetail> recentDetails = tAppUserVipDetailService.lambdaQuery() |
| | | .le(TAppUserVipDetail::getStartTime, currentDate) |
| | | .ge(TAppUserVipDetail::getEndTime, currentDate) |
| | |
| | | private String pcode; |
| | | private String province; |
| | | private String city; |
| | | private String code; |
| | | private String Hp; |
| | | private String AreaCode; |
| | | } |
| | |
| | | private OtherClient otherClient; |
| | | @Resource |
| | | private TAppCouponService appCouponService; |
| | | public void sendVip(TAppUser nowUser,Integer vipId,Integer plusDay){ |
| | | public void sendVip(TAppUser nowUser,Integer vipId,Integer plusDay,Integer type){ |
| | | if (nowUser.getVipEndTime()==null||nowUser.getVipEndTime().isBefore(LocalDateTime.now())) { |
| | | |
| | | nowUser.setVipEndTime(LocalDateTime.now().plusMonths(plusDay)); |
| | | |
| | | nowUser.setVipEndTime(LocalDateTime.now().plusMonths(plusDay).minusDays(1)); |
| | | nowUser.setVipId(vipId); |
| | | //直接再detail里新增数据,因为不是续费 |
| | | TAppUserVipDetail tAppUserVipDetail = new TAppUserVipDetail(); |
| | | tAppUserVipDetail.setAppUserId(nowUser.getId()); |
| | |
| | | tAppUserVipDetail.setChargeNum(vip.getDiscountTimes()); |
| | | tAppUserVipDetail.setDiscountMoney(vip.getMaximumDeduction()); |
| | | tAppUserVipDetail.setSendMonth(1); |
| | | tAppUserVipDetail.setVipJson(JSON.toJSONString(info.getData())); |
| | | tAppUserVipDetail.setVipType(type); |
| | | tAppUserVipDetailService.save(tAppUserVipDetail); |
| | | //直接赠送优惠卷 |
| | | for (SendCouponDto sendCouponDto : javaList) { |
| | |
| | | |
| | | |
| | | }else { |
| | | nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(plusDay).minusDays(1)); |
| | | // nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(plusDay).minusDays(1)); |
| | | //获取detail里结束时间大于当前时间的数据,并将enttime延长 |
| | | TAppUserVipDetail tAppUserVipDetail = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getVipId,vipId).eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).orderByDesc(TAppUserVipDetail::getEndTime).last("limit 1").one(); |
| | | if (tAppUserVipDetail!=null) { |
| | | List<TAppUserVipDetail> list = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).ge(TAppUserVipDetail::getStartTime, tAppUserVipDetail.getEndTime()).list(); |
| | | for (TAppUserVipDetail appUserVipDetail : list) { |
| | | appUserVipDetail.setStartTime(appUserVipDetail.getStartTime().plusMonths(plusDay).minusDays(1)); |
| | | appUserVipDetail.setEndTime(appUserVipDetail.getEndTime().plusMonths(plusDay).minusDays(1)); |
| | | } |
| | | tAppUserVipDetailService.updateBatchById(list); |
| | | tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().plusMonths(plusDay).minusDays(1)); |
| | | |
| | | tAppUserVipDetailService.updateById(tAppUserVipDetail); |
| | | }else { |
| | | // TAppUserVipDetail tAppUserVipDetail = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getVipId,vipId).eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).orderByDesc(TAppUserVipDetail::getEndTime).last("limit 1").one(); |
| | | // if (tAppUserVipDetail!=null) { |
| | | // List<TAppUserVipDetail> list = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).ge(TAppUserVipDetail::getStartTime, tAppUserVipDetail.getEndTime()).list(); |
| | | // for (TAppUserVipDetail appUserVipDetail : list) { |
| | | // appUserVipDetail.setStartTime(appUserVipDetail.getStartTime().plusMonths(plusDay).minusDays(1)); |
| | | // appUserVipDetail.setEndTime(appUserVipDetail.getEndTime().plusMonths(plusDay).minusDays(1)); |
| | | // } |
| | | // tAppUserVipDetailService.updateBatchById(list); |
| | | // tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().plusMonths(plusDay).minusDays(1)); |
| | | // |
| | | // tAppUserVipDetailService.updateById(tAppUserVipDetail); |
| | | // }else |
| | | // { |
| | | TAppUserVipDetail tAppUserVipDetail2 = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).orderByDesc(TAppUserVipDetail::getEndTime).last("limit 1").one(); |
| | | |
| | | TAppUserVipDetail tAppUserVipDetail1 = new TAppUserVipDetail(); |
| | |
| | | |
| | | R<TVip> info = vipClient.getInfo1(vipId); |
| | | TVip vip = info.getData(); |
| | | List<SendCouponDto> javaList = new ArrayList<>(); |
| | | if (vip.getCoupon()!=null) { |
| | | javaList = JSON.parseArray(vip.getCoupon()).toJavaList(SendCouponDto.class); |
| | | } |
| | | |
| | | |
| | | tAppUserVipDetail1.setCouponIds(vip.getCoupon()); |
| | | tAppUserVipDetail1.setSendChargeNum(vip.getDiscountTimes()); |
| | | tAppUserVipDetail1.setChargeNum(vip.getDiscountTimes()); |
| | | tAppUserVipDetail1.setDiscountMoney(vip.getMaximumDeduction()); |
| | | tAppUserVipDetail1.setSendMonth(1); |
| | | tAppUserVipDetail1.setVipType(type); |
| | | tAppUserVipDetail1.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} |
| | | # 配置文件格式 |
| | |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| | | import org.springframework.boot.web.servlet.ServletComponentScan; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | import org.springframework.transaction.annotation.EnableTransactionManagement; |
| | |
| | | * @param number |
| | | * @return |
| | | */ |
| | | @PostMapping("/getSiteInfoByNumber") |
| | | @GetMapping("/getSiteInfoByNumber") |
| | | @ApiOperation(value = "扫一扫后通过桩编号获取电站信息", tags = {"小程序-扫一扫"}) |
| | | public R<SiteInfoVO> getSiteInfoByNumber(@RequestParam("number") String number){ |
| | | SiteInfoVO siteInfoVO = new SiteInfoVO(); |
| | | TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getNumber, number).one(); |
| | | TChargingPile one = chargingPileService.lambdaQuery().eq(TChargingPile::getCode, number).one(); |
| | | Site byId = siteService.getById(one.getSiteId()); |
| | | TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId()); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list(); |
| | |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().multiply(byId1.getDiscount()).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | } |
| | | siteInfoVO.setChargingPileId(one.getId()); |
| | | siteInfoVO.setName(byId.getName()); |
| | | siteInfoVO.setNumber(one.getNumber().toString()); |
| | | siteInfoVO.setSpaceChargeExplain(byId.getSpaceChargeExplain()); |
| | | return R.ok(siteInfoVO); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getSiteList") |
| | | @ApiOperation(value = "获取站点列表", tags = {"管理后台-站点管理"}) |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.dto.TAccountingStrategyDTO; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.TAccountingStrategyQuery; |
| | |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.dto.SteategyPassDto; |
| | | import com.ruoyi.common.core.enums.AuditStateEnum; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BaseDelete; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | 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.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private TChargingPileService chargingPileService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | @Autowired |
| | | private SysUserClient sysUserClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Autowired |
| | | public TAccountingStrategyController(TAccountingStrategyService accountingStrategyService, TAccountingStrategyDetailService accountingStrategyDetailService) { |
| | |
| | | return AjaxResult.error("同阶段费率值需一致"); |
| | | } |
| | | // 判断修改的计费策略是否为已通过 |
| | | if(dto.getAuditStatus() == 3 || dto.getAuditStatus() == 4){ |
| | | if(null != dto.getAuditStatus() && (dto.getAuditStatus() == 3 || dto.getAuditStatus() == 4)){ |
| | | // 查询是否有下级审核中的策略 |
| | | TAccountingStrategy children = accountingStrategyService.getOne(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .eq(TAccountingStrategy::getParentId, dto.getId()) |
| | |
| | | |
| | | } |
| | | }else { |
| | | if (byId.getAuditStatus()==1){ |
| | | |
| | | byId.setFirstRemark(steategyPassDto.getRemark()); |
| | | |
| | | }else if (byId.getAuditStatus()==2){ |
| | | byId.setTwoRemark(steategyPassDto.getRemark()); |
| | | } |
| | | |
| | | byId.setAuditStatus(4); |
| | | } |
| | | accountingStrategyService.updateById(byId); |
| | |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "列表") |
| | | @PostMapping(value = "/page") |
| | | public AjaxResult<Page<TApplyChargingPile>> page(ApplyChargingQuery applyChargingQuery) { |
| | | public AjaxResult<Page<TApplyChargingPile>> page(@RequestBody ApplyChargingQuery applyChargingQuery) { |
| | | Page<TApplyChargingPile> page = applyChargingPileService.lambdaQuery() |
| | | .like(applyChargingQuery.getLandlordPhone() != null && !applyChargingQuery.getLandlordPhone().equals(""), TApplyChargingPile::getLandlordPhone, applyChargingQuery.getLandlordPhone()) |
| | | .page(Page.of(applyChargingQuery.getPageCurr(), applyChargingQuery.getPageSize())); |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | import com.ruoyi.chargingPile.dto.ChargingGunCountMonitoring; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | private final TChargingPileService chargingPileService; |
| | | private final TChargingGunService chargingGunService; |
| | | |
| | | @Resource |
| | | private TAccountingStrategyService accountingStrategyService; |
| | | |
| | | @Resource |
| | | private TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | |
| | | |
| | | @Autowired |
| | |
| | | TChargingPile chargingPile = chargingPileService.getById(id); |
| | | return R.ok(chargingPile); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | 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; |
| | |
| | | return; |
| | | } |
| | | } |
| | | filterChain.doFilter(request, response); |
| | | filterChain.doFilter(servletRequest, servletResponse); |
| | | } |
| | | |
| | | |
| | |
| | | * @param siteIds |
| | | * @return |
| | | */ |
| | | Map<Integer, Integer> getModeStatistics(@Param("siteIds")List<Integer> siteIds); |
| | | List<Map<Integer, Integer>> getModeStatistics(@Param("siteIds")List<Integer> siteIds); |
| | | |
| | | /** |
| | | * 统计充电枪状态 |
| | |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.GetSysRoleByIds; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import io.seata.core.context.RootContext; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | @Override |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | | public AjaxResult addPartner(Partner partner) { |
| | | System.err.println("事务ID:" + RootContext.getXID()); |
| | | //校验参数和重复数据 |
| | | AjaxResult ajaxResult = addPartnerParameterCheck(partner); |
| | | if(ajaxResult.isError()){ |
| | |
| | | user.setRoleId(partner.getRoleId().longValue()); |
| | | user.setRoleType(2); |
| | | user.setObjectId(partner.getId()); |
| | | sysUserClient.addSysUser(user); |
| | | R r = sysUserClient.addSysUser(user); |
| | | if(r.getCode() != 200){ |
| | | // 手动进行全局事务回滚 |
| | | try { |
| | | GlobalTransactionContext.getCurrent().rollback(); |
| | | } catch (TransactionException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | return AjaxResult.error(r.getMsg()); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | List<TAccountingStrategyVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | List<Integer> parentIds = list.stream().map(TAccountingStrategyVO::getId).collect(Collectors.toList()); |
| | | List<TAccountingStrategy> list1 = this.list(Wrappers.lambdaQuery(TAccountingStrategy.class) |
| | | .in(TAccountingStrategy::getParentId, parentIds) |
| | | .in(!parentIds.isEmpty(),TAccountingStrategy::getParentId, parentIds) |
| | | .in(TAccountingStrategy::getAuditStatus, Arrays.asList(1,2))); |
| | | for (TAccountingStrategyVO tAccountingStrategyVO : list) { |
| | | SysUser data = sysUserClient.getSysUser(tAccountingStrategyVO.getUserId()).getData(); |
| | |
| | | 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); |
| | | if(CollectionUtils.isEmpty(modeStatistics)){ |
| | | Map<Integer, Integer> modeStatistics1 = new HashMap<>(3,0); |
| | | modeStatistics1.put(1, 0); |
| | | modeStatistics1.put(2, 0); |
| | | modeStatistics1.put(3, 0); |
| | | modeStatistics.add(modeStatistics1); |
| | | } |
| | | 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<>(); |
| | |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds = new HashSet<>(siteId); |
| | | siteIds = new HashSet<>(); |
| | | siteIds.add(siteId); |
| | | } |
| | | PageInfo<TChargingPileNotification> pageInfo = new PageInfo<>(basePage.getPageCurr(), basePage.getPageSize()); |
| | | List<TChargingPileNotification> list = this.baseMapper.chargingPileNotificationPageList(pageInfo, siteIds); |
| | |
| | | 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} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: false #关闭数据库代理 |
| | | enable-auto-data-source-proxy: false |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | |
| | | 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> |
| | |
| | | /** |
| | | * 创建设备 |
| | | * @param productId 产品ID |
| | | * @param nodeId 设备标识码 通常使用IMEI、MAC地址或Serial No作为node_id |
| | | * @param deviceId 设备ID 使用设备标识码 |
| | | * @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.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; |
| | |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/iot") |
| | | public class IotMessageListener { |
| | | |
| | | @Autowired |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @PostMapping(value = "/message/sendMessage") |
| | | public R sendMessage() { |
| | | |
| | | @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("4200002375202409185150427245"); |
| | | // platformStartCharging.setCharging_pile_code("3401231001200202"); |
| | | // platformStartCharging.setCharging_gun_code("1"); |
| | | // platformStartCharging.setCard_number("1833063878153543681"); |
| | | // platformStartCharging.setAccount_balance(new BigDecimal(50)); |
| | | // String message = iotMessageProduce.sendMessage(platformStartCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_START_CHARGING.getKey(), messageUtil.platformStartCharging(platformStartCharging)); |
| | | 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("3401231001200202"); |
| | | // platformStopCharging.setCharging_gun_code("1"); |
| | | // String message = iotMessageProduce.sendMessage(platformStopCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_STOP_CHARGING.getKey(),messageUtil.platformStopCharging(platformStopCharging)); |
| | | 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("3401231001200202"); |
| | | // updateBalance.setCharging_gun_code("1"); |
| | | // updateBalance.setPhysical_card_number("1833063878153543681"); |
| | | // updateBalance.setAccount_balance(new BigDecimal(20)); |
| | | // String message = iotMessageProduce.sendMessage(updateBalance.getCharging_pile_code(), ServiceIdMenu.UPDATE_BALANCE.getKey(),messageUtil.updateBalance(updateBalance)); |
| | | 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("3401231001200202"); |
| | | // 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)); |
| | | 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("3401231001200202"); |
| | | // System.err.println(CP56Time2aConverter.convertToCP56Time2a(new Date())); |
| | | // timingSetting.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date())); |
| | | // String message = iotMessageProduce.sendMessage(timingSetting.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING.getKey(),messageUtil.timingSetting(timingSetting)); |
| | | 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("3401231001200202").getData(); |
| | | // Map<Integer, TAccountingStrategyDetail> strategyPrice = StrategyUtil.getStrategyPrice(accountingStrategyDetails); |
| | | // // 价格设置 |
| | | // AcquisitionBillingModeReply acquisitionBillingModeReply = new AcquisitionBillingModeReply(); |
| | | // StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply); |
| | | // // 时段设置 |
| | | // StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply); |
| | | // TAccountingStrategyDetail accountingStrategyDetail = accountingStrategyDetailClient.getDetailByCode("3401231001200202").getData(); |
| | | // acquisitionBillingModeReply.setBilling_model_code(accountingStrategyDetail.getId().toString()); |
| | | // acquisitionBillingModeReply.setCharging_pile_code("3401231001200202"); |
| | | // 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)); |
| | | 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("3401231001200202"); |
| | | 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); |
| | |
| | | package com.ruoyi.integration.iotda.utils.produce; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.huaweicloud.sdk.core.exception.ConnectionException; |
| | | import com.huaweicloud.sdk.core.exception.RequestTimeoutException; |
| | | import com.huaweicloud.sdk.core.exception.ServiceResponseException; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/sendMessage") |
| | | public String sendMessage(String deviceId,String name,String message){ |
| | | public String sendMessage(String deviceId, String name, JSONObject message){ |
| | | CreateMessageRequest request = new CreateMessageRequest(); |
| | | request.withDeviceId(deviceId); |
| | | DeviceMessageRequest body = new DeviceMessageRequest(); |
| | |
| | | * @param onlineReply 实体对象 |
| | | * @return |
| | | */ |
| | | public String onlineReply(OnlineReply onlineReply){ |
| | | public JSONObject onlineReply(OnlineReply onlineReply){ |
| | | onlineReplyService.create(onlineReply); |
| | | return getMessageJsonString(onlineReply, ServiceIdMenu.ONLINE_REPLY.getValue()); |
| | | } |
| | |
| | | * @param pong 实体对象 |
| | | * @return |
| | | */ |
| | | public String pong(Pong pong){ |
| | | public JSONObject pong(Pong pong){ |
| | | pongService.create(pong); |
| | | return getMessageJsonString(pong, ServiceIdMenu.PONG.getValue()); |
| | | } |
| | |
| | | * @param billingModeVerifyReply 实体对象 |
| | | * @return |
| | | */ |
| | | public String billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){ |
| | | public JSONObject billingModeVerifyReply(BillingModeVerifyReply billingModeVerifyReply){ |
| | | billingModeVerifyReplyService.create(billingModeVerifyReply); |
| | | return getMessageJsonString(billingModeVerifyReply, ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getValue()); |
| | | } |
| | |
| | | * @param acquisitionBillingModeReply 实体对象 |
| | | * @return |
| | | */ |
| | | public String acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply){ |
| | | public JSONObject acquisitionBillingModeReply(AcquisitionBillingModeReply acquisitionBillingModeReply){ |
| | | acquisitionBillingModeReplyService.create(acquisitionBillingModeReply); |
| | | return getMessageJsonString(acquisitionBillingModeReply, ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getValue()); |
| | | } |
| | |
| | | * @param readRealTimeMonitoringData 实体对象 |
| | | * @return |
| | | */ |
| | | public String readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData){ |
| | | public JSONObject readRealTimeMonitoringData(ReadRealTimeMonitoringData readRealTimeMonitoringData){ |
| | | readRealTimeMonitoringDataService.create(readRealTimeMonitoringData); |
| | | return getMessageJsonString(readRealTimeMonitoringData, ServiceIdMenu.READ_REAL_TIME_MONITORING_DATA.getValue()); |
| | | } |
| | |
| | | * @param platformConfirmationCharging 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging){ |
| | | public JSONObject platformConfirmationCharging(PlatformConfirmationCharging platformConfirmationCharging){ |
| | | platformConfirmationChargingService.create(platformConfirmationCharging); |
| | | return getMessageJsonString(platformConfirmationCharging, ServiceIdMenu.PLATFORM_CONFIRMATION_CHARGING.getValue()); |
| | | } |
| | |
| | | * @param platformStartCharging 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformStartCharging(PlatformStartCharging platformStartCharging){ |
| | | public JSONObject platformStartCharging(PlatformStartCharging platformStartCharging){ |
| | | platformStartChargingService.create(platformStartCharging); |
| | | return getMessageJsonString(platformStartCharging, ServiceIdMenu.PLATFORM_START_CHARGING.getValue()); |
| | | } |
| | |
| | | * @param platformStopCharging 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformStopCharging(PlatformStopCharging platformStopCharging){ |
| | | public JSONObject platformStopCharging(PlatformStopCharging platformStopCharging){ |
| | | platformStopChargingService.create(platformStopCharging); |
| | | return getMessageJsonString(platformStopCharging, ServiceIdMenu.PLATFORM_STOP_CHARGING.getValue()); |
| | | } |
| | |
| | | * @param confirmTransactionRecord 实体对象 |
| | | * @return |
| | | */ |
| | | public String confirmTransactionRecord(ConfirmTransactionRecord confirmTransactionRecord){ |
| | | public JSONObject confirmTransactionRecord(ConfirmTransactionRecord confirmTransactionRecord){ |
| | | confirmTransactionRecordService.create(confirmTransactionRecord); |
| | | return getMessageJsonString(confirmTransactionRecord, ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getValue()); |
| | | } |
| | |
| | | * @param updateBalance 实体对象 |
| | | * @return |
| | | */ |
| | | public String updateBalance(UpdateBalance updateBalance){ |
| | | public JSONObject updateBalance(UpdateBalance updateBalance){ |
| | | updateBalanceService.create(updateBalance); |
| | | return getMessageJsonString(updateBalance, ServiceIdMenu.UPDATE_BALANCE.getValue()); |
| | | } |
| | |
| | | * @param synchronizeOfflineCard 实体对象 |
| | | * @return |
| | | */ |
| | | public String synchronizeOfflineCard(SynchronizeOfflineCard synchronizeOfflineCard){ |
| | | public JSONObject synchronizeOfflineCard(SynchronizeOfflineCard synchronizeOfflineCard){ |
| | | synchronizeOfflineCardService.create(synchronizeOfflineCard); |
| | | return getMessageJsonString(synchronizeOfflineCard, ServiceIdMenu.SYNCHRONIZE_OFFLINE_CARD.getValue()); |
| | | } |
| | |
| | | * @param clearOfflineCard 实体对象 |
| | | * @return |
| | | */ |
| | | public String clearOfflineCard(ClearOfflineCard clearOfflineCard){ |
| | | public JSONObject clearOfflineCard(ClearOfflineCard clearOfflineCard){ |
| | | clearOfflineCardService.create(clearOfflineCard); |
| | | return getMessageJsonString(clearOfflineCard, ServiceIdMenu.CLEAR_OFFLINE_CARD.getValue()); |
| | | } |
| | |
| | | * @param queryOfflineCard 实体对象 |
| | | * @return |
| | | */ |
| | | public String queryOfflineCard(QueryOfflineCard queryOfflineCard){ |
| | | public JSONObject queryOfflineCard(QueryOfflineCard queryOfflineCard){ |
| | | queryOfflineCardService.create(queryOfflineCard); |
| | | return getMessageJsonString(queryOfflineCard, ServiceIdMenu.QUERY_OFFLINE_CARD.getValue()); |
| | | } |
| | |
| | | * @param workingParameterSetting 实体对象 |
| | | * @return |
| | | */ |
| | | public String workingParameterSetting(WorkingParameterSetting workingParameterSetting){ |
| | | public JSONObject workingParameterSetting(WorkingParameterSetting workingParameterSetting){ |
| | | workingParameterSettingService.create(workingParameterSetting); |
| | | return getMessageJsonString(workingParameterSetting, ServiceIdMenu.WORKING_PARAMETER_SETTING.getValue()); |
| | | } |
| | |
| | | * @param timingSetting 实体对象 |
| | | * @return |
| | | */ |
| | | public String timingSetting(TimingSetting timingSetting){ |
| | | public JSONObject timingSetting(TimingSetting timingSetting){ |
| | | timingSettingService.create(timingSetting); |
| | | return getMessageJsonString(timingSetting, ServiceIdMenu.TIMING_SETTING.getValue()); |
| | | } |
| | |
| | | * @param timingSettingReply 实体对象 |
| | | * @return |
| | | */ |
| | | public String timingSettingReply(TimingSettingReply timingSettingReply){ |
| | | public JSONObject timingSettingReply(TimingSettingReply timingSettingReply){ |
| | | timingSettingReplyService.create(timingSettingReply); |
| | | return getMessageJsonString(timingSettingReply, ServiceIdMenu.TIMING_SETTING_REPLY.getValue()); |
| | | } |
| | |
| | | * @param setupBillingModel 实体对象 |
| | | * @return |
| | | */ |
| | | public String setupBillingModel(SetupBillingModel setupBillingModel){ |
| | | public JSONObject setupBillingModel(SetupBillingModel setupBillingModel){ |
| | | setupBillingModelService.create(setupBillingModel); |
| | | return getMessageJsonString(setupBillingModel, ServiceIdMenu.SETUP_BILLING_MODEL.getValue()); |
| | | } |
| | |
| | | * @param openOrCloseGroundLock 实体对象 |
| | | * @return |
| | | */ |
| | | public String openOrCloseGroundLock(OpenOrCloseGroundLock openOrCloseGroundLock){ |
| | | public JSONObject openOrCloseGroundLock(OpenOrCloseGroundLock openOrCloseGroundLock){ |
| | | openOrCloseGroundLockService.create(openOrCloseGroundLock); |
| | | return getMessageJsonString(openOrCloseGroundLock, ServiceIdMenu.OPEN_OR_CLOSE_GROUND_LOCK.getValue()); |
| | | } |
| | |
| | | * @param platformRestart 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformRestart(PlatformRestart platformRestart){ |
| | | public JSONObject platformRestart(PlatformRestart platformRestart){ |
| | | platformRestartService.create(platformRestart); |
| | | return getMessageJsonString(platformRestart, ServiceIdMenu.PLATFORM_RESTART.getValue()); |
| | | } |
| | |
| | | * @param platformRemoteUpdate 实体对象 |
| | | * @return |
| | | */ |
| | | public String platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate){ |
| | | public JSONObject platformRemoteUpdate(PlatformRemoteUpdate platformRemoteUpdate){ |
| | | platformRemoteUpdateService.create(platformRemoteUpdate); |
| | | return getMessageJsonString(platformRemoteUpdate, ServiceIdMenu.PLATFORM_REMOTE_UPDATE.getValue()); |
| | | } |
| | |
| | | * @param serviceId 服务ID |
| | | * @return |
| | | */ |
| | | public String getMessageJsonString(Object object, String serviceId){ |
| | | public JSONObject getMessageJsonString(Object object, String serviceId){ |
| | | JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(object)); |
| | | jsonObject.put("service_id", serviceId); |
| | | return jsonObject.toJSONString(); |
| | | return jsonObject; |
| | | } |
| | | } |
| | |
| | | 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} |
| | | # 配置文件格式 |
| | |
| | | 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; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | } |
| | | @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; |
| | | @Excel(name = "申请时间",width = 30) |
| | | 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 com.ruoyi.other.api.domain.TGoods; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.*; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | |
| | | 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; |
| | |
| | | |
| | | @Resource |
| | | private IntegralRuleClient integralRuleClient; |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | |
| | | //计数器 |
| | | private Map<String, Integer> counter_map = new HashMap<>(); |
| | |
| | | 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()); |
| | |
| | | String inviteUsersToEarnPoints = integralRule.getInviteUsersToEarnPoints(); |
| | | JSONObject jsonObject = JSON.parseObject(inviteUsersToEarnPoints); |
| | | Integer num1 = jsonObject.getInteger("num1"); |
| | | |
| | | TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); |
| | | if(null != appUser1.getVipId()){ |
| | | TVip vip = vipClient.getInfo(appUser1.getVipId()).getData(); |
| | | Integer doubleIntegration = vip.getDoubleIntegration(); |
| | | //双倍积分 |
| | | if(1 == doubleIntegration){ |
| | | num1 *= 2; |
| | | } |
| | | } |
| | | |
| | | GetInviteUser query = new GetInviteUser(); |
| | | query.setAppUserId(appUser.getInviteUserId()); |
| | | query.setAppUserId(appUser1.getId()); |
| | | query.setBeInvitedAppUserId(chargingOrder.getAppUserId()); |
| | | TInviteUser inviteUser = inviteUserClient.getInviteUser(query).getData(); |
| | | if(null == inviteUser){ |
| | | inviteUser = new TInviteUser(); |
| | | inviteUser.setAppUserId(appUser.getInviteUserId()); |
| | | inviteUser.setAppUserId(appUser1.getId()); |
| | | inviteUser.setBeInvitedAppUserId(chargingOrder.getAppUserId()); |
| | | inviteUser.setAward(num1); |
| | | inviteUser.setCreateTime(LocalDateTime.now()); |
| | |
| | | inviteUser.setAward(num1); |
| | | inviteUserClient.updateInviteUser(inviteUser); |
| | | } |
| | | TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChange.setAppUserId(appUser.getInviteUserId()); |
| | | appUserIntegralChange.setAppUserId(appUser1.getId()); |
| | | appUserIntegralChange.setChangeType(5); |
| | | appUserIntegralChange.setHistoricalIntegral(appUser1.getPoints()); |
| | | appUserIntegralChange.setCurrentIntegral(appUser1.getPoints() + num1); |
| | |
| | | chargingOrder.setStatus(5); |
| | | chargingOrder.setPaymentAmount(payAmount); |
| | | this.updateById(chargingOrder); |
| | | |
| | | |
| | | //添加积分 |
| | | TIntegralRule integralRule = integralRuleClient.getSet().getData(); |
| | | if(null != integralRule){ |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | Integer num1 = JSON.parseObject(integralRule.getChargeCredit()).getInteger("num1"); |
| | | Integer integral = payAmount.multiply(new BigDecimal(num1)).intValue(); |
| | | if(null != appUser.getVipId()){ |
| | | TVip vip = vipClient.getInfo(appUser.getVipId()).getData(); |
| | | Integer doubleIntegration = vip.getDoubleIntegration(); |
| | | //双倍积分 |
| | | if(1 == doubleIntegration){ |
| | | integral *= 2; |
| | | } |
| | | } |
| | | |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | appUserIntegralChange.setAppUserId(appUser.getId()); |
| | | appUserIntegralChange.setChangeType(2); |
| | | appUserIntegralChange.setHistoricalIntegral(appUser.getPoints()); |
| | | appUser.setPoints(appUser.getPoints() + integral); |
| | | appUserIntegralChange.setCurrentIntegral(appUser.getPoints()); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserClient.updateAppUser(appUser); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | } |
| | | |
| | | //计算优惠券 |
| | | if(null != chargingOrder.getAppCouponId()){ |
| | | //判断实际充电金额是否满足优惠券使用条件,如果不满足则不适用优惠券。 |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | //计算费用,处理退款 |
| | | endCharge(chargingOrder); |
| | | |
| | | |
| | | //处理推荐奖励(被推荐首单奖励) |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | long count = this.count(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, chargingOrder.getAppUserId()) |
| | |
| | | String inviteUsersToEarnPoints = integralRule.getInviteUsersToEarnPoints(); |
| | | JSONObject jsonObject = JSON.parseObject(inviteUsersToEarnPoints); |
| | | Integer num1 = jsonObject.getInteger("num1"); |
| | | |
| | | TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); |
| | | if(null != appUser1.getVipId()){ |
| | | TVip vip = vipClient.getInfo(appUser1.getVipId()).getData(); |
| | | Integer doubleIntegration = vip.getDoubleIntegration(); |
| | | //双倍积分 |
| | | if(1 == doubleIntegration){ |
| | | num1 *= 2; |
| | | } |
| | | } |
| | | |
| | | GetInviteUser query = new GetInviteUser(); |
| | | query.setAppUserId(appUser.getInviteUserId()); |
| | | query.setAppUserId(appUser1.getId()); |
| | | query.setBeInvitedAppUserId(chargingOrder.getAppUserId()); |
| | | TInviteUser inviteUser = inviteUserClient.getInviteUser(query).getData(); |
| | | if(null == inviteUser){ |
| | | inviteUser = new TInviteUser(); |
| | | inviteUser.setAppUserId(appUser.getInviteUserId()); |
| | | inviteUser.setAppUserId(appUser1.getId()); |
| | | inviteUser.setBeInvitedAppUserId(chargingOrder.getAppUserId()); |
| | | inviteUser.setAward(num1); |
| | | inviteUser.setCreateTime(LocalDateTime.now()); |
| | |
| | | inviteUser.setAward(num1); |
| | | inviteUserClient.updateInviteUser(inviteUser); |
| | | } |
| | | TAppUser appUser1 = appUserClient.getUserById(appUser.getInviteUserId()).getData(); |
| | | TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | String code = Double.valueOf(Math.random() * 1000).intValue() + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")); |
| | | appUserIntegralChange.setCode(code); |
| | | appUserIntegralChange.setAppUserId(appUser.getInviteUserId()); |
| | | appUserIntegralChange.setAppUserId(appUser1.getId()); |
| | | appUserIntegralChange.setChangeType(5); |
| | | appUserIntegralChange.setHistoricalIntegral(appUser1.getPoints()); |
| | | appUserIntegralChange.setCurrentIntegral(appUser1.getPoints() + num1); |
| | | appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | |
| | | |
| | | appUser1.setPoints(appUser1.getPoints() + num1); |
| | | appUserClient.updateAppUser(appUser1); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | @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(); |
| | | } |
| | | |
| | | |
| | |
| | | String imgUrl = ""; |
| | | if(tExchangeOrder.getOrderType() == 1){ |
| | | TGoods goods = goodsClient.getGoodsById(tExchangeOrder.getGoodsId()).getData(); |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | if(null != goods){ |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | } |
| | | }else{ |
| | | TCoupon coupon = couponClient.getCouponById1(tExchangeOrder.getCouponId()).getData(); |
| | | name = coupon.getName(); |
| | | imgUrl = coupon.getCoverPicture(); |
| | | if(null != coupon){ |
| | | name = coupon.getName(); |
| | | imgUrl = coupon.getCoverPicture(); |
| | | } |
| | | } |
| | | exchangeOrderList.setName(name); |
| | | exchangeOrderList.setImgUrl(imgUrl); |
| | |
| | | String imgUrl = ""; |
| | | if(exchangeOrder.getOrderType() == 1){ |
| | | TGoods goods = goodsClient.getGoodsById(exchangeOrder.getGoodsId()).getData(); |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | if(null != goods){ |
| | | name = goods.getName(); |
| | | imgUrl = goods.getCoverPicture(); |
| | | } |
| | | }else{ |
| | | TCoupon coupon = couponClient.getCouponById1(exchangeOrder.getCouponId()).getData(); |
| | | info.setCouponType(coupon.getType()); |
| | | info.setDays(coupon.getDays()); |
| | | info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | name = coupon.getName(); |
| | | imgUrl = coupon.getCoverPicture(); |
| | | if(null != coupon){ |
| | | info.setCouponType(coupon.getType()); |
| | | info.setDays(coupon.getDays()); |
| | | info.setEndTime(coupon.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | name = coupon.getName(); |
| | | imgUrl = coupon.getCoverPicture(); |
| | | } |
| | | } |
| | | info.setName(name); |
| | | info.setImgUrl(imgUrl); |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | PageInfo<TOrderAppealVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TOrderAppealVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | List<Long> orderIds = list.stream().map(TOrderAppealVO::getOrderId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(orderIds)){ |
| | | return new PageInfo<>(); |
| | | } |
| | | // 查询当前页的订单 |
| | | List<TChargingOrder> chargingOrders = chargingOrderMapper.selectList(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | .in(TChargingOrder::getId, orderIds)); |
| | |
| | | import com.ruoyi.order.service.TOrderEvaluateService; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.TEvaluationTagClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | |
| | | @Resource |
| | | private AppUserIntegralChangeClient appUserIntegralChangeClient; |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | |
| | | |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | Integer num1 = JSON.parseObject(credit).getInteger("num1"); |
| | | if(null != num1 && 0 < num1){ |
| | | TAppUser appUser = appUserClient.getUserById(userid).getData(); |
| | | if(null != appUser.getVipId()){ |
| | | TVip vip = vipClient.getInfo(appUser.getVipId()).getData(); |
| | | Integer doubleIntegration = vip.getDoubleIntegration(); |
| | | //双倍积分 |
| | | if(1 == doubleIntegration){ |
| | | num1 *= 2; |
| | | } |
| | | } |
| | | Integer points = appUser.getPoints(); |
| | | appUser.setPoints(appUser.getPoints() + num1); |
| | | appUserClient.updateAppUser(appUser); |
| | |
| | | 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} |
| | | # 配置文件格式 |
| | |
| | | </select> |
| | | <select id="getchargingCapacity" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) as time, |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) as time, |
| | | SUM(charging_capacity) as chargingCapacity |
| | | FROM |
| | | t_charging_order |
| | |
| | | </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> |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | 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") |
| | |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.dto.SendCouponDto; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | | .eq(TVip::getReveal,1) |
| | | .orderByDesc(TVip::getMaximumDeduction) |
| | | .orderByDesc(TVip::getCreateTime) |
| | | .last("LIMIT 1"))); |
| | | case 2: |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | |
| | | return R.ok(vipService.getOne(Wrappers.lambdaQuery(TVip.class) |
| | | .eq(TVip::getReveal,1) |
| | | .orderByDesc(TVip::getMonthlyCardDiscount) |
| | | .orderByDesc(TVip::getCreateTime) |
| | | .last("LIMIT 1"))); |
| | | } |
| | | } |
| | |
| | | |
| | | return R.ok(vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | | |
| | |
| | | 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()); |
| | |
| | | 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: |
| | |
| | | # 共享配置 |
| | | 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} |
| | | # 配置文件格式 |