Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/TAppUserAddressController.java
1 文件已重命名
26个文件已添加
89个文件已修改
| | |
| | | * @param carIds 车辆id集合 |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/getCarByIds") |
| | | @PostMapping(value = "/t-app-user-car/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Long> carIds); |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.factory; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class PartnerFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<PartnerClient> { |
| | | private static final Logger log = LoggerFactory.getLogger(PartnerFallbackFactory.class); |
| | | |
| | | @Override |
| | | public PartnerClient create(Throwable throwable) { |
| | | log.error("调用失败:{}", throwable.getMessage()); |
| | | return new PartnerClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<Partner> getPartnerById(Integer id) { |
| | | return R.fail("根据id获取合作商信息失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.api.feignClient; |
| | | |
| | | import com.ruoyi.chargingPile.api.factory.PartnerFallbackFactory; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/30 9:36 |
| | | */ |
| | | @FeignClient(contextId = "PartnerClient", value = ServiceNameConstants.CHARGINGPILE_SERVICE, fallbackFactory = PartnerFallbackFactory.class) |
| | | public interface PartnerClient { |
| | | |
| | | |
| | | /** |
| | | * 根据id获取合作商信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/partner/getPartnerById/{id}") |
| | | R<Partner> getPartnerById(@PathVariable("id") Integer id); |
| | | } |
| | |
| | | @TableField("remark") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "已充电百分比") |
| | | @TableField(exist = false) |
| | | private Integer soc; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "设备状态(1=工作中,2=离线,3=故障)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "iotd设备id") |
| | | @TableField("iotd_device_id") |
| | | private String iotdDeviceId; |
| | | } |
| | |
| | | @NotNull(message = "地址纬度不能为空") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty(value = "城市code") |
| | | private String cityCode; |
| | | |
| | | } |
| | |
| | | private Integer fastFreeCount; |
| | | @ApiModelProperty(value = "慢充空闲数量") |
| | | private Integer slowFreeCount; |
| | | @ApiModelProperty(value = "原始电价") |
| | | private BigDecimal electrovalenceOriginal; |
| | | @ApiModelProperty(value = "服务费") |
| | | private BigDecimal serviceCharge; |
| | | @ApiModelProperty(value = "普通电价") |
| | | private BigDecimal electrovalence; |
| | | @ApiModelProperty(value = "会员电价") |
| | |
| | | @ApiModelProperty(value = "服务费折扣") |
| | | private BigDecimal serviceFeeDiscount; |
| | | |
| | | @ApiModelProperty(value = "折扣") |
| | | private BigDecimal discount; |
| | | |
| | | } |
| | |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyDetailFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.AccountingStrategyFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.ParkingRecordFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.FaultMessageFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.FaultMessageFallbackFactory |
| | | com.ruoyi.chargingPile.api.factory.PartnerFallbackFactory |
New file |
| | |
| | | package com.ruoyi.integration.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.feignClient.IotInterfaceClient; |
| | | import com.ruoyi.integration.api.feignClient.SwitchwayGateClient; |
| | | import com.ruoyi.integration.api.vo.AddDevice; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.integration.api.vo.SwitchwayGateReq; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class IotInterfaceFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<IotInterfaceClient> { |
| | | private static final Logger log = LoggerFactory.getLogger(IotInterfaceFallbackFactory.class); |
| | | |
| | | @Override |
| | | public IotInterfaceClient create(Throwable throwable) { |
| | | log.error("调用失败:{}", throwable.getMessage()); |
| | | return new IotInterfaceClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<AddDeviceResp> addDevice(AddDevice addDevice) { |
| | | return R.fail("添加设备失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<DeleteDeviceResp> deleteDevice(String deviceId) { |
| | | return R.fail("删除设备失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.feignClient.SecurityDetectionClient; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 充电桩服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SecurityDetectionFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<SecurityDetectionClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(SecurityDetectionFallbackFactory.class); |
| | | |
| | | @Override |
| | | public SecurityDetectionClient create(Throwable throwable) { |
| | | log.error("调用失败:{}", throwable.getMessage()); |
| | | return new SecurityDetectionClient() { |
| | | |
| | | @Override |
| | | public R<SecurityDetection> getSecurityDetection(String transactionSerialNumber) { |
| | | return R.fail("获取安全检测数据失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.integration.api.model.ChargingHandshake; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | |
| | | public String platformStopCharging(PlatformStopCharging platformStopCharging) { |
| | | return "远程停机失败"; |
| | | } |
| | | |
| | | @Override |
| | | public String qrCodeDelivery(QrCodeDelivery qrCodeDelivery) { |
| | | return "二维码下发失败"; |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.factory.IotInterfaceFallbackFactory; |
| | | import com.ruoyi.integration.api.vo.AddDevice; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:24 |
| | | */ |
| | | @FeignClient(contextId = "IotInterfaceClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = IotInterfaceFallbackFactory.class) |
| | | public interface IotInterfaceClient { |
| | | |
| | | |
| | | /** |
| | | * 添加设备 |
| | | * @param addDevice |
| | | * @return |
| | | */ |
| | | @PostMapping("/iotInterface/addDevice") |
| | | R<AddDeviceResp> addDevice(@RequestBody AddDevice addDevice); |
| | | |
| | | |
| | | /** |
| | | * 删除设备 |
| | | * @param deviceId |
| | | * @return |
| | | */ |
| | | @PostMapping("/iotInterface/deleteDevice") |
| | | R<DeleteDeviceResp> deleteDevice(@RequestParam("deviceId") String deviceId); |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.factory.SecurityDetectionFallbackFactory; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 14:23 |
| | | */ |
| | | @FeignClient(contextId = "SecurityDetectionClient", value = ServiceNameConstants.INTEGRATION_SERVICE, fallbackFactory = SecurityDetectionFallbackFactory.class) |
| | | public interface SecurityDetectionClient { |
| | | |
| | | |
| | | /** |
| | | * 获取安全检测数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | @PostMapping("/securityDetection/getSecurityDetection") |
| | | R<SecurityDetection> getSecurityDetection(@RequestParam("transactionSerialNumber") String transactionSerialNumber); |
| | | } |
| | |
| | | import com.ruoyi.integration.api.factory.SendMessageFallbackFactory; |
| | | import com.ruoyi.integration.api.model.PlatformStartCharging; |
| | | import com.ruoyi.integration.api.model.PlatformStopCharging; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | */ |
| | | @PostMapping("/sendMessage/platformStopCharging") |
| | | String platformStopCharging(@RequestBody PlatformStopCharging platformStopCharging); |
| | | |
| | | |
| | | /** |
| | | * 二维码下发 |
| | | * @param qrCodeDelivery |
| | | * @return |
| | | */ |
| | | @PostMapping("/sendMessage/qrCodeDelivery") |
| | | String qrCodeDelivery(@RequestBody QrCodeDelivery qrCodeDelivery); |
| | | } |
| | |
| | | private BigDecimal low_peak_electricity_rate;// 谷电费费率(精确到五位小数) |
| | | private BigDecimal low_peak_service_rate;// 谷服务费费率(精确到五位小数) |
| | | private BigDecimal loss_ratio;// 计损比例 |
| | | // private DayTimeBase day_time_base; |
| | | private Integer time1;// 0:00~0:30 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time2;// 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time3;// 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | |
| | | @Document(collection = "platform_start_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartChargingReply extends BaseModel { |
| | | @Id |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
New file |
| | |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | @Data |
| | | @Document(collection = "qr_code_delivery") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QrCodeDelivery { |
| | | |
| | | @Id |
| | | private String charging_pile_code; // 桩编码 |
| | | private Integer code_format; // "0:第一种前缀+桩编号 1:第二种前缀+桩编号+枪编号" |
| | | private Integer prefix_length; // 二维码前缀长度长度最大不超过200 字节 |
| | | private String code_prefix; // 如:“www.baidu.com?No=” |
| | | private String qr_code; // 二维码内容,如:“www.baidu.com?No=3422000100023301” |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | @Data |
| | | @Document(collection = "qr_code_delivery_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QrCodeDeliveryReply { |
| | | |
| | | @Id |
| | | private String charging_pile_code; // 桩编码 |
| | | private Integer delivery_result; // 设置结果(0:成功,1:失败) |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.annotation.Id; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | @Data |
| | | @Document(collection = "security_detection") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SecurityDetection { |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer secure_connection; // 车枪连接(0=未连接,1=连接) |
| | | private Integer nsulation_detection; // 绝缘检测(0=安全,1=不安全) |
| | | private Integer electronic_lock_lock; // 电磁锁状态(0=未锁,1=已锁) |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:26 |
| | | */ |
| | | @Data |
| | | public class AddDevice { |
| | | /** |
| | | * 产品ID |
| | | */ |
| | | private String productId; |
| | | /** |
| | | * 设备标识码 设备编号 |
| | | */ |
| | | private String nodeId; |
| | | /** |
| | | * 设备名称 |
| | | */ |
| | | private String deviceName; |
| | | /** |
| | | * 设备描述 |
| | | */ |
| | | private String description; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:37 |
| | | */ |
| | | @Data |
| | | public class AddDeviceResp { |
| | | private int httpStatusCode; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("app_id") |
| | | private String appId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("app_name") |
| | | private String appName; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("device_id") |
| | | private String deviceId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("node_id") |
| | | private String nodeId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("gateway_id") |
| | | private String gatewayId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("device_name") |
| | | private String deviceName; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("node_type") |
| | | private String nodeType; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("description") |
| | | private String description; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("fw_version") |
| | | private String fwVersion; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("sw_version") |
| | | private String swVersion; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("device_sdk_version") |
| | | private String deviceSdkVersion; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("product_id") |
| | | private String productId; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("product_name") |
| | | private String productName; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("status") |
| | | private String status; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("create_time") |
| | | private String createTime; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("connection_status_update_time") |
| | | private String connectionStatusUpdateTime; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("active_time") |
| | | private String activeTime; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("extension_info") |
| | | private Object extensionInfo; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.api.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:40 |
| | | */ |
| | | @Data |
| | | public class DeleteDeviceResp { |
| | | @JsonIgnore |
| | | private int httpStatusCode; |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @JsonProperty("body") |
| | | private String body; |
| | | } |
| | |
| | | com.ruoyi.integration.api.factory.SendMessageFallbackFactory |
| | | com.ruoyi.integration.api.factory.PlatformStartChargingReplyFallbackFactory |
| | | com.ruoyi.integration.api.factory.PlatformStopChargingReplyFallbackFactory |
| | | com.ruoyi.integration.api.factory.SwitchwayGateFallbackFactory |
| | | com.ruoyi.integration.api.factory.SwitchwayGateFallbackFactory |
| | | com.ruoyi.integration.api.factory.IotInterfaceFallbackFactory |
| | | com.ruoyi.integration.api.factory.SecurityDetectionFallbackFactory |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public ChargingOrderClient create(Throwable throwable) { |
| | | log.error("充电订单调用失败:{}", throwable.getMessage()); |
| | | return new ChargingOrderClient() { |
| | | |
| | | @Override |
| | | public R<String> queryOrderByGunId(String id) { |
| | | return R.fail("远程调用根据枪id 查询最新的订单id 用户后台结束充电" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> useOrderCount(Long userId) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<Long> getCar() { |
| | | public R<Long> getCar(@PathVariable("id")String id) { |
| | | return R.fail("获取用户最近使用车辆充电的车辆id:" + throwable.getMessage()); |
| | | } |
| | | |
| | |
| | | public void chargingOrderStartupFailureWxRefund(String out_refund_no, String refund_id, String tradeState, String success_time) { |
| | | log.error("远程启动失败后退款通知失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void shoppingOrderWxRefund(String out_refund_no, String refund_id, String tradeState, String success_time) { |
| | | log.error("购物订单退款回调通知失败:" + throwable.getMessage()); |
| | | |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.factory; |
| | | |
| | | import com.ruoyi.order.api.feignClient.ShoppingOrderClient; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | |
| | | /** |
| | | * 充电订单服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class ShoppingOrderFallbackFactory implements org.springframework.cloud.openfeign.FallbackFactory<ShoppingOrderClient> { |
| | | private static final Logger log = LoggerFactory.getLogger(ShoppingOrderFallbackFactory.class); |
| | | |
| | | |
| | | @Override |
| | | public ShoppingOrderClient create(Throwable cause) { |
| | | log.error("调用失败:{}", cause.getMessage()); |
| | | return new ShoppingOrderClient() { |
| | | |
| | | |
| | | @Override |
| | | public void cancelShoppingOrderWxRefund(String out_refund_no, String refund_id, String tradeState, String success_time) { |
| | | log.error("商城订单去掉退款回调通知失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @FeignClient(contextId = "ChargingOrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = ChargingOrderFallbackFactory.class) |
| | | public interface ChargingOrderClient { |
| | | |
| | | @PostMapping(value = "/t-charging-order/queryOrderByGunId/{id}") |
| | | R<String> queryOrderByGunId(@PathVariable("id") String id); |
| | | @PostMapping(value = "/t-charging-order/useOrderCount") |
| | | R<Long> useOrderCount(@RequestParam("userId") Long userId); |
| | | @PostMapping(value = "/t-charging-order/chargingBillListR") |
| | |
| | | * 获取用户最近使用车辆充电的车辆id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/t-charging-order/getCar") |
| | | public R<Long> getCar(); |
| | | @GetMapping(value = "/t-charging-order/getCar/{id}") |
| | | public R<Long> getCar(@PathVariable("id")String id); |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PutMapping(value = "/t-charging-order/stopCharging/{id}") |
| | | R<String> stopCharging(@PathVariable("id") String id); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 充电支付成功回调通知 |
| | |
| | | @RequestParam("out_trade_no") String refund_id, |
| | | @RequestParam("out_trade_no") String tradeState, |
| | | @RequestParam("out_trade_no") String success_time); |
| | | /** |
| | | * 管理后台取消购物订单后退款回调 |
| | | * @param out_refund_no |
| | | * @param refund_id |
| | | * @param tradeState |
| | | * @param success_time |
| | | */ |
| | | @PostMapping("/t-shopping-order/shoppingOrderWxRefund") |
| | | void shoppingOrderWxRefund(@RequestParam("out_trade_no") String out_refund_no, |
| | | @RequestParam("out_trade_no") String refund_id, |
| | | @RequestParam("out_trade_no") String tradeState, |
| | | @RequestParam("out_trade_no") String success_time); |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.order.api.factory.ShoppingOrderFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/29 16:23 |
| | | */ |
| | | @FeignClient(contextId = "ShoppingOrderClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = ShoppingOrderFallbackFactory.class) |
| | | public interface ShoppingOrderClient { |
| | | |
| | | |
| | | /** |
| | | * 商城订单去掉退款回调通知 |
| | | * @param out_refund_no |
| | | * @param refund_id |
| | | * @param tradeState |
| | | * @param success_time |
| | | */ |
| | | @PostMapping("/t-shopping-order/cancelShoppingOrderWxRefund") |
| | | void cancelShoppingOrderWxRefund(@RequestParam("out_refund_no") String out_refund_no, |
| | | @RequestParam("refund_id") String refund_id, |
| | | @RequestParam("tradeState") String tradeState, |
| | | @RequestParam("success_time") String success_time); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "添加时间") |
| | | @TableField("create_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "开票时间") |
| | |
| | | com.ruoyi.order.api.factory.ExchangeOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ChargingOrderAccountingStrategyFallbackFactory |
| | | com.ruoyi.order.api.factory.AccountingStrategyDetailOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.AccountingStrategyOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.AccountingStrategyOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ShoppingOrderFallbackFactory |
| | |
| | | public R<List<TEvaluationTagVO>> getTagList(Integer type) { |
| | | return R.fail("获取标签列表:" + throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<List<TEvaluationTagVO>> getList() { |
| | | return R.fail("获取标签列表失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<TEvaluationTag>> getListByIds(List<Integer> tagIds) { |
| | | return R.fail("根据id集合获取数据失败:" + throwable.getMessage()); |
| | |
| | | */ |
| | | @PostMapping("/t-evaluation-tag/getTagList") |
| | | R<List<TEvaluationTagVO>> getTagList(Integer type); |
| | | |
| | | /** |
| | | * 获取标签列表 |
| | | * @return |
| | | */ |
| | | @PostMapping("/t-evaluation-tag/getList") |
| | | R<List<TEvaluationTagVO>> getList(); |
| | | |
| | | |
| | | /** |
| | | * 根据id集合获取数据 |
| | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | |
| | | @TableField("login_time") |
| | | @ApiModelProperty(value = "登录时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private LocalDateTime loginTime; |
| | | /** |
| | | * 登录状态(1=成功,2=失败) |
| | |
| | | * @param loginLog |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveLoginLog") |
| | | @PostMapping("/sysLoginLog/saveLoginLog") |
| | | R saveLoginLog(@RequestBody SysLoginLog loginLog); |
| | | } |
| | |
| | | <artifactId>hutool-crypto</artifactId> |
| | | <version>${hutool.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-chargingPile</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | |
| | | @Resource |
| | | private SysUserClient userClient; |
| | | |
| | | @Resource |
| | | private PartnerClient partnerClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("login") |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | |
| | | |
| | | map.put("roleName",roles.get(0).getRoleName()); |
| | | map.put("info", userInfo); |
| | | if(userInfo.getSysUser().getRoleType() == 2){ |
| | | Partner partner = partnerClient.getPartnerById(userInfo.getSysUser().getObjectId()).getData(); |
| | | map.put("partnerName", partner.getName()); |
| | | } |
| | | // 修改用户最后登录时间 |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserId(userInfo.getSysUser().getUserId()); |
| | |
| | | spring: |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | application: |
| | | # 应用名称 |
| | | name: ruoyi-auth |
| | |
| | | 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 |
| | | # 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 |
| | | # 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 |
| | | # 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控制台地址 |
| | |
| | | /** |
| | | * 登录成功状态 |
| | | */ |
| | | public static final String LOGIN_SUCCESS_STATUS = "0"; |
| | | public static final String LOGIN_SUCCESS_STATUS = "1"; |
| | | |
| | | /** |
| | | * 登录失败状态 |
| | | */ |
| | | public static final String LOGIN_FAIL_STATUS = "1"; |
| | | public static final String LOGIN_FAIL_STATUS = "2"; |
| | | |
| | | /** |
| | | * 登录成功 |
File was renamed from ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/utils/FileUploadUtils.java |
| | |
| | | package com.ruoyi.file.utils; |
| | | package com.ruoyi.common.core.utils; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | |
| | | import com.ruoyi.common.core.exception.file.FileNameLengthLimitExceededException; |
| | | import com.ruoyi.common.core.exception.file.FileSizeLimitExceededException; |
| | | import com.ruoyi.common.core.exception.file.InvalidExtensionException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.file.FileTypeUtils; |
| | | import com.ruoyi.common.core.utils.file.MimeTypeUtils; |
| | | import com.ruoyi.common.core.utils.uuid.Seq; |
| | |
| | | allow-bean-definition-overriding: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.ruoyi.file.utils.FileUploadUtils; |
| | | import com.ruoyi.common.core.utils.FileUploadUtils; |
| | | |
| | | /** |
| | | * 本地文件存储 |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import com.alibaba.nacos.common.utils.IoUtils; |
| | | import com.ruoyi.file.config.MinioConfig; |
| | | import com.ruoyi.file.utils.FileUploadUtils; |
| | | import com.ruoyi.common.core.utils.FileUploadUtils; |
| | | import io.minio.MinioClient; |
| | | import io.minio.PutObjectArgs; |
| | | |
| | |
| | | |
| | | /** |
| | | * 角色 业务层处理 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService |
| | | { |
| | | @Autowired |
| | | private SysRoleMapper roleMapper; |
| | | |
| | | @Autowired |
| | | private SysRoleMenuMapper roleMenuMapper; |
| | | |
| | | @Autowired |
| | | private SysUserRoleMapper userRoleMapper; |
| | | |
| | | @Autowired |
| | | private SysRoleDeptMapper roleDeptMapper; |
| | | |
| | | /** |
| | | * 根据条件分页查询角色数据 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 角色数据集合信息 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d") |
| | | public List<SysRole> selectRoleList(SysRole role) |
| | | { |
| | | return roleMapper.selectRoleList(role); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户ID查询角色 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 角色列表 |
| | | */ |
| | | @Override |
| | | public List<SysRole> selectRolesByUserId(Long userId) |
| | | { |
| | | List<SysRole> userRoles = roleMapper.selectRolePermissionByUserId(userId); |
| | | List<SysRole> roles = selectRoleAll(); |
| | | for (SysRole role : roles) |
| | | { |
| | | for (SysRole userRole : userRoles) |
| | | { |
| | | if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) |
| | | { |
| | | role.setFlag(true); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return roles; |
| | | } |
| | | |
| | | /** |
| | | * 根据用户ID查询权限 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 权限列表 |
| | | */ |
| | | @Override |
| | | public Set<String> selectRolePermissionByUserId(Long userId) |
| | | { |
| | | List<SysRole> perms = roleMapper.selectRolePermissionByUserId(userId); |
| | | Set<String> permsSet = new HashSet<>(); |
| | | for (SysRole perm : perms) |
| | | { |
| | | if (StringUtils.isNotNull(perm)) |
| | | { |
| | | permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); |
| | | } |
| | | } |
| | | return permsSet; |
| | | } |
| | | |
| | | /** |
| | | * 查询所有角色 |
| | | * |
| | | * @return 角色列表 |
| | | */ |
| | | @Override |
| | | public List<SysRole> selectRoleAll() |
| | | { |
| | | return SpringUtils.getAopProxy(this).selectRoleList(new SysRole()); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户ID获取角色选择框列表 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 选中角色ID列表 |
| | | */ |
| | | @Override |
| | | public List<Long> selectRoleListByUserId(Long userId) |
| | | { |
| | | return roleMapper.selectRoleListByUserId(userId); |
| | | } |
| | | |
| | | /** |
| | | * 通过角色ID查询角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 角色对象信息 |
| | | */ |
| | | @Override |
| | | public SysRole selectRoleById(Long roleId) |
| | | { |
| | | return roleMapper.selectRoleById(roleId); |
| | | } |
| | | |
| | | /** |
| | | * 校验角色名称是否唯一 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkRoleNameUnique(SysRole role) |
| | | { |
| | | Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); |
| | | SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName()); |
| | | if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) |
| | | { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 校验角色权限是否唯一 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkRoleKeyUnique(SysRole role) |
| | | { |
| | | Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); |
| | | SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey()); |
| | | if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) |
| | | { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 校验角色是否允许操作 |
| | | * |
| | | * @param role 角色信息 |
| | | */ |
| | | @Override |
| | | public void checkRoleAllowed(SysRole role) |
| | | { |
| | | if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) |
| | | { |
| | | throw new ServiceException("不允许操作超级管理员角色"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验角色是否有数据权限 |
| | | * |
| | | * @param roleId 角色id |
| | | */ |
| | | @Override |
| | | public void checkRoleDataScope(Long roleId) |
| | | { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) |
| | | { |
| | | SysRole role = new SysRole(); |
| | | role.setRoleId(roleId); |
| | | List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role); |
| | | if (StringUtils.isEmpty(roles)) |
| | | { |
| | | throw new ServiceException("没有权限访问角色数据!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通过角色ID查询角色使用数量 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int countUserRoleByRoleId(Long roleId) |
| | | { |
| | | return userRoleMapper.countUserRoleByRoleId(roleId); |
| | | } |
| | | |
| | | /** |
| | | * 新增保存角色信息 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int insertRole(SysRole role) |
| | | { |
| | | // 新增角色信息 |
| | | roleMapper.insertRole(role); |
| | | return insertRoleMenu(role); |
| | | } |
| | | |
| | | /** |
| | | * 修改保存角色信息 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int updateRole(SysRole role) |
| | | { |
| | | // 修改角色信息 |
| | | public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService { |
| | | @Autowired |
| | | private SysRoleMapper roleMapper; |
| | | |
| | | @Autowired |
| | | private SysRoleMenuMapper roleMenuMapper; |
| | | |
| | | @Autowired |
| | | private SysUserRoleMapper userRoleMapper; |
| | | |
| | | @Autowired |
| | | private SysRoleDeptMapper roleDeptMapper; |
| | | |
| | | /** |
| | | * 根据条件分页查询角色数据 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 角色数据集合信息 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d") |
| | | public List<SysRole> selectRoleList(SysRole role) { |
| | | return roleMapper.selectRoleList(role); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户ID查询角色 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 角色列表 |
| | | */ |
| | | @Override |
| | | public List<SysRole> selectRolesByUserId(Long userId) { |
| | | List<SysRole> userRoles = roleMapper.selectRolePermissionByUserId(userId); |
| | | List<SysRole> roles = selectRoleAll(); |
| | | for (SysRole role : roles) { |
| | | for (SysRole userRole : userRoles) { |
| | | if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) { |
| | | role.setFlag(true); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return roles; |
| | | } |
| | | |
| | | /** |
| | | * 根据用户ID查询权限 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 权限列表 |
| | | */ |
| | | @Override |
| | | public Set<String> selectRolePermissionByUserId(Long userId) { |
| | | List<SysRole> perms = roleMapper.selectRolePermissionByUserId(userId); |
| | | Set<String> permsSet = new HashSet<>(); |
| | | for (SysRole perm : perms) { |
| | | if (StringUtils.isNotNull(perm)) { |
| | | permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); |
| | | } |
| | | } |
| | | return permsSet; |
| | | } |
| | | |
| | | /** |
| | | * 查询所有角色 |
| | | * |
| | | * @return 角色列表 |
| | | */ |
| | | @Override |
| | | public List<SysRole> selectRoleAll() { |
| | | return SpringUtils.getAopProxy(this).selectRoleList(new SysRole()); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户ID获取角色选择框列表 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 选中角色ID列表 |
| | | */ |
| | | @Override |
| | | public List<Long> selectRoleListByUserId(Long userId) { |
| | | return roleMapper.selectRoleListByUserId(userId); |
| | | } |
| | | |
| | | /** |
| | | * 通过角色ID查询角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 角色对象信息 |
| | | */ |
| | | @Override |
| | | public SysRole selectRoleById(Long roleId) { |
| | | return roleMapper.selectRoleById(roleId); |
| | | } |
| | | |
| | | /** |
| | | * 校验角色名称是否唯一 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkRoleNameUnique(SysRole role) { |
| | | Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); |
| | | SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName()); |
| | | if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 校验角色权限是否唯一 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkRoleKeyUnique(SysRole role) { |
| | | Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); |
| | | SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey()); |
| | | if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 校验角色是否允许操作 |
| | | * |
| | | * @param role 角色信息 |
| | | */ |
| | | @Override |
| | | public void checkRoleAllowed(SysRole role) { |
| | | if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) { |
| | | throw new ServiceException("不允许操作超级管理员角色"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验角色是否有数据权限 |
| | | * |
| | | * @param roleId 角色id |
| | | */ |
| | | @Override |
| | | public void checkRoleDataScope(Long roleId) { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) { |
| | | SysRole role = new SysRole(); |
| | | role.setRoleId(roleId); |
| | | List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role); |
| | | if (StringUtils.isEmpty(roles)) { |
| | | throw new ServiceException("没有权限访问角色数据!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通过角色ID查询角色使用数量 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int countUserRoleByRoleId(Long roleId) { |
| | | return userRoleMapper.countUserRoleByRoleId(roleId); |
| | | } |
| | | |
| | | /** |
| | | * 新增保存角色信息 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int insertRole(SysRole role) { |
| | | // 新增角色信息 |
| | | roleMapper.insertRole(role); |
| | | return insertRoleMenu(role); |
| | | } |
| | | |
| | | /** |
| | | * 修改保存角色信息 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int updateRole(SysRole role) { |
| | | // 修改角色信息 |
| | | // roleMapper.updateRole(role); |
| | | // 删除角色与菜单关联 |
| | | // 删除角色与菜单关联 |
| | | // roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId()); |
| | | return roleMapper.updateRole(role); |
| | | } |
| | | |
| | | /** |
| | | * 修改角色状态 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateRoleStatus(SysRole role) |
| | | { |
| | | return roleMapper.updateRole(role); |
| | | } |
| | | |
| | | /** |
| | | * 修改数据权限信息 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int authDataScope(SysRole role) |
| | | { |
| | | // 修改角色信息 |
| | | roleMapper.updateRole(role); |
| | | // 删除角色与部门关联 |
| | | roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId()); |
| | | // 新增角色和部门信息(数据权限) |
| | | return insertRoleDept(role); |
| | | } |
| | | |
| | | /** |
| | | * 新增角色菜单信息 |
| | | * |
| | | * @param role 角色对象 |
| | | */ |
| | | public int insertRoleMenu(SysRole role) |
| | | { |
| | | int rows = 1; |
| | | // 新增用户与角色管理 |
| | | List<SysRoleMenu> list = new ArrayList<SysRoleMenu>(); |
| | | Long[] menuIds = role.getMenuIds(); |
| | | return roleMapper.updateRole(role); |
| | | } |
| | | |
| | | /** |
| | | * 修改角色状态 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateRoleStatus(SysRole role) { |
| | | return roleMapper.updateRole(role); |
| | | } |
| | | |
| | | /** |
| | | * 修改数据权限信息 |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int authDataScope(SysRole role) { |
| | | // 修改角色信息 |
| | | roleMapper.updateRole(role); |
| | | // 删除角色与部门关联 |
| | | roleDeptMapper.deleteRoleDeptByRoleId(role.getRoleId()); |
| | | // 新增角色和部门信息(数据权限) |
| | | return insertRoleDept(role); |
| | | } |
| | | |
| | | /** |
| | | * 新增角色菜单信息 |
| | | * |
| | | * @param role 角色对象 |
| | | */ |
| | | public int insertRoleMenu(SysRole role) { |
| | | int rows = 1; |
| | | // 新增用户与角色管理 |
| | | List<SysRoleMenu> list = new ArrayList<SysRoleMenu>(); |
| | | Long[] menuIds = role.getMenuIds(); |
| | | // List<Long> longs = Arrays.asList(menuIds); |
| | | List<Long> longs = new ArrayList<>(); |
| | | for (Long menuId : menuIds) { |
| | | longs.add(menuId); |
| | | } |
| | | if(!longs.contains(1061L)){ |
| | | longs.add(1061L); |
| | | longs.add(1062L); |
| | | longs.add(1065L); |
| | | longs.add(1073L); |
| | | longs.add(1161L); |
| | | longs.add(1203L); |
| | | } |
| | | |
| | | for (Long menuId : longs) |
| | | { |
| | | SysRoleMenu rm = new SysRoleMenu(); |
| | | rm.setRoleId(role.getRoleId()); |
| | | rm.setMenuId(menuId); |
| | | list.add(rm); |
| | | } |
| | | if (list.size() > 0) |
| | | { |
| | | rows = roleMenuMapper.batchRoleMenu(list); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * 新增角色部门信息(数据权限) |
| | | * |
| | | * @param role 角色对象 |
| | | */ |
| | | public int insertRoleDept(SysRole role) |
| | | { |
| | | int rows = 1; |
| | | // 新增角色与部门(数据权限)管理 |
| | | List<SysRoleDept> list = new ArrayList<SysRoleDept>(); |
| | | for (Long deptId : role.getDeptIds()) |
| | | { |
| | | SysRoleDept rd = new SysRoleDept(); |
| | | rd.setRoleId(role.getRoleId()); |
| | | rd.setDeptId(deptId); |
| | | list.add(rd); |
| | | } |
| | | if (list.size() > 0) |
| | | { |
| | | rows = roleDeptMapper.batchRoleDept(list); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * 通过角色ID删除角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteRoleById(Long roleId) |
| | | { |
| | | // 删除角色与菜单关联 |
| | | roleMenuMapper.deleteRoleMenuByRoleId(roleId); |
| | | // 删除角色与部门关联 |
| | | roleDeptMapper.deleteRoleDeptByRoleId(roleId); |
| | | return roleMapper.deleteRoleById(roleId); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除角色信息 |
| | | * |
| | | * @param roleIds 需要删除的角色ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteRoleByIds(Long[] roleIds) { |
| | | for (Long roleId : roleIds) |
| | | { |
| | | checkRoleAllowed(new SysRole(roleId)); |
| | | checkRoleDataScope(roleId); |
| | | SysRole role = selectRoleById(roleId); |
| | | if (countUserRoleByRoleId(roleId) > 0) |
| | | { |
| | | throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); |
| | | } |
| | | } |
| | | // 删除角色与菜单关联 |
| | | roleMenuMapper.deleteRoleMenu(roleIds); |
| | | // 删除角色与部门关联 |
| | | roleDeptMapper.deleteRoleDept(roleIds); |
| | | return roleMapper.deleteRoleByIds(roleIds); |
| | | } |
| | | |
| | | /** |
| | | * 取消授权用户角色 |
| | | * |
| | | * @param userRole 用户和角色关联信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteAuthUser(SysUserRole userRole) |
| | | { |
| | | return userRoleMapper.deleteUserRoleInfo(userRole); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要取消授权的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteAuthUsers(Long roleId, Long[] userIds) |
| | | { |
| | | return userRoleMapper.deleteUserRoleInfos(roleId, userIds); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要授权的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertAuthUsers(Long roleId, Long[] userIds) |
| | | { |
| | | // 新增用户与角色管理 |
| | | List<SysUserRole> list = new ArrayList<SysUserRole>(); |
| | | for (Long userId : userIds) |
| | | { |
| | | SysUserRole ur = new SysUserRole(); |
| | | ur.setUserId(userId); |
| | | ur.setRoleId(roleId); |
| | | list.add(ur); |
| | | } |
| | | return userRoleMapper.batchUserRole(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysRole> isExitUpdate(String roleName, Long roleId,Integer companyId) { |
| | | return roleMapper.isExitUpdate(roleName,roleId,companyId); |
| | | } |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * @param ids 数据id集合 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SysRole> getSysRoleByIds(List<Integer> ids) { |
| | | return this.baseMapper.getSysRoleByIds(ids); |
| | | } |
| | | List<Long> longs = new ArrayList<>(); |
| | | for (Long menuId : menuIds) { |
| | | longs.add(menuId); |
| | | } |
| | | if (!longs.contains(1061L)) { |
| | | longs.add(1061L); |
| | | longs.add(1062L); |
| | | longs.add(1065L); |
| | | longs.add(1073L); |
| | | longs.add(1161L); |
| | | longs.add(1203L); |
| | | } |
| | | |
| | | for (Long menuId : longs) { |
| | | SysRoleMenu rm = new SysRoleMenu(); |
| | | rm.setRoleId(role.getRoleId()); |
| | | rm.setMenuId(menuId); |
| | | list.add(rm); |
| | | } |
| | | if (list.size() > 0) { |
| | | rows = roleMenuMapper.batchRoleMenu(list); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * 新增角色部门信息(数据权限) |
| | | * |
| | | * @param role 角色对象 |
| | | */ |
| | | public int insertRoleDept(SysRole role) { |
| | | int rows = 1; |
| | | // 新增角色与部门(数据权限)管理 |
| | | List<SysRoleDept> list = new ArrayList<SysRoleDept>(); |
| | | for (Long deptId : role.getDeptIds()) { |
| | | SysRoleDept rd = new SysRoleDept(); |
| | | rd.setRoleId(role.getRoleId()); |
| | | rd.setDeptId(deptId); |
| | | list.add(rd); |
| | | } |
| | | if (list.size() > 0) { |
| | | rows = roleDeptMapper.batchRoleDept(list); |
| | | } |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | | * 通过角色ID删除角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteRoleById(Long roleId) { |
| | | // 删除角色与菜单关联 |
| | | roleMenuMapper.deleteRoleMenuByRoleId(roleId); |
| | | // 删除角色与部门关联 |
| | | roleDeptMapper.deleteRoleDeptByRoleId(roleId); |
| | | return roleMapper.deleteRoleById(roleId); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除角色信息 |
| | | * |
| | | * @param roleIds 需要删除的角色ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int deleteRoleByIds(Long[] roleIds) { |
| | | for (Long roleId : roleIds) { |
| | | checkRoleAllowed(new SysRole(roleId)); |
| | | checkRoleDataScope(roleId); |
| | | SysRole role = selectRoleById(roleId); |
| | | if (countUserRoleByRoleId(roleId) > 0) { |
| | | throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); |
| | | } |
| | | } |
| | | // 删除角色与菜单关联 |
| | | roleMenuMapper.deleteRoleMenu(roleIds); |
| | | // 删除角色与部门关联 |
| | | roleDeptMapper.deleteRoleDept(roleIds); |
| | | return roleMapper.deleteRoleByIds(roleIds); |
| | | } |
| | | |
| | | /** |
| | | * 取消授权用户角色 |
| | | * |
| | | * @param userRole 用户和角色关联信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteAuthUser(SysUserRole userRole) { |
| | | return userRoleMapper.deleteUserRoleInfo(userRole); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要取消授权的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteAuthUsers(Long roleId, Long[] userIds) { |
| | | return userRoleMapper.deleteUserRoleInfos(roleId, userIds); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要授权的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertAuthUsers(Long roleId, Long[] userIds) { |
| | | // 新增用户与角色管理 |
| | | List<SysUserRole> list = new ArrayList<SysUserRole>(); |
| | | for (Long userId : userIds) { |
| | | SysUserRole ur = new SysUserRole(); |
| | | ur.setUserId(userId); |
| | | ur.setRoleId(roleId); |
| | | list.add(ur); |
| | | } |
| | | return userRoleMapper.batchUserRole(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysRole> isExitUpdate(String roleName, Long roleId, Integer companyId) { |
| | | return roleMapper.isExitUpdate(roleName, roleId, companyId); |
| | | } |
| | | |
| | | /** |
| | | * 根据id获取数据 |
| | | * |
| | | * @param ids 数据id集合 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SysRole> getSysRoleByIds(List<Integer> ids) { |
| | | return this.baseMapper.getSysRoleByIds(ids); |
| | | } |
| | | } |
| | |
| | | allow-bean-definition-overriding: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | 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 |
| | | # 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 |
| | | # 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 |
| | | # 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控制台地址 |
| | |
| | | select |
| | | user_id AS userId, |
| | | nick_name AS nickName, |
| | | user_name AS userName, |
| | | create_time AS createTime, |
| | | remark AS remark |
| | | from sys_user |
| | |
| | | AND nick_name LIKE concat('%',#{query.nickName},'%') |
| | | </if> |
| | | AND del_flag = '0' |
| | | AND roleType = 1 |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | |
| | | String plainData = null; |
| | | if (isDataEncrypted) { |
| | | try { |
| | | plainData = AlipayEncrypt.decryptContent(content, encryptType, "XABBSOeWDakvuG9TDez4Qg====", charset); |
| | | plainData = AlipayEncrypt.decryptContent(content, encryptType, "84iAz9sTR7siFxTmAD6sfw==", charset); |
| | | } catch (AlipayApiException e) { |
| | | //解密异常, 记录日志 |
| | | throw new ServiceException("解密异常"); |
New file |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.AlipayConfig; |
| | | import com.alipay.api.response.AlipayOpenAppQrcodeCreateResponse; |
| | | import com.alipay.api.request.AlipayOpenAppQrcodeCreateRequest; |
| | | import com.alipay.api.domain.AlipayOpenAppQrcodeCreateModel; |
| | | |
| | | import com.alipay.api.FileItem; |
| | | import java.util.Base64; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 生成支付宝小程序二维码 |
| | | */ |
| | | public class AlipayOpenAppQrcodeCreate { |
| | | |
| | | public static void main(String[] args) throws AlipayApiException { |
| | | // 初始化SDK |
| | | AlipayClient alipayClient = new DefaultAlipayClient(getAlipayConfig()); |
| | | // 构造请求参数以调用接口 |
| | | AlipayOpenAppQrcodeCreateRequest request = new AlipayOpenAppQrcodeCreateRequest(); |
| | | AlipayOpenAppQrcodeCreateModel model = new AlipayOpenAppQrcodeCreateModel(); |
| | | // 设置跳转小程序的页面路径 |
| | | model.setUrlParam("pages/index/index"); |
| | | // 设置小程序的启动参数 |
| | | model.setQueryParam("x=1"); |
| | | // 设置码描述 |
| | | model.setDescribe("二维码描述"); |
| | | request.setBizModel(model); |
| | | AlipayOpenAppQrcodeCreateResponse response = alipayClient.execute(request); |
| | | System.out.println(response.getBody()); |
| | | String qrCodeUrl = response.getQrCodeUrl(); |
| | | System.err.println(qrCodeUrl); |
| | | if (response.isSuccess()) { |
| | | System.out.println("调用成功"); |
| | | } else { |
| | | System.out.println("调用失败"); |
| | | } |
| | | } |
| | | |
| | | private static AlipayConfig getAlipayConfig() { |
| | | String privateKey = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCdf1zyOndfbhI67zoFtjuVMYMJkr1UHBOpX1kWe4z8uqo5F7ESpJzsUNRcV/Mgz4QPOYGMV6C5KsT6QH2in5XDumIlY3FVFLOeXrVczJSTJdeY+00Ky9MMB5/Hsg/0GqdBvbDMxY/A6EQ1jH7BnV5wpq8gsNDTJLRKfTpnh0jyjH4nNormnLNgah9SBdxTOccWqP3VblpuqLNMYCIvoF5ukD3Z/GCIQ4FUTMwzdXW69uVEzCTucwxsylHmj3lE8Th4Lf4Nr4+oq2LfkNoHv1ygDluKA2oy5AaUg/pfEEeQYSzAJXc23AAdEgj5oS2eIkbthuC70Ns8clTgVfiWj5mvAgMBAAECggEBAJHvj/pLPo1Ies/tF0BvqSoHJLpcI96p3XYViYERnoQXmt8oGsWBjn5SL1QZkokWf/FzgZy/HYg2HysbUs67PJSOQZ8PU9ZYRk86xqZkUk8+w1VXlf2o+7er4NuzHKE9iTmbQRWdAiTnkzxjIJja7sVHTgLmk7jxy7Ux8Eo5ytgi7M7eFjr/jOErHikEImdiM77T1SDD7rbEtXhocr6vyAMgI02/ZEAO4w9Cui+fqrDWUouMeHzgRZxJ1Mp1GGlsZ5X3P3Fd6oGyznvsuqS6h803O+zdg+0GdtmudjVHuHi/clOpMI3YB9JfBZPli5lCMSO2yrr+zRnvXBQM94MfaQECgYEA2rqA1G1sKbWakH1N3ZKH4Jferat/sKc5KDa9ws1vyIwGA1emwG7zuettaAlQBbzXUmOC8O0m/a5vyu029p9BuWpi2upeo8SX66Cm8RenjOJ/giaPmIYtbFC5PwSeIFk3rLQK6gsMQAsiYvul/5ZySus1+7YOFPq/y5J4pGNqwO8CgYEAuFXOfN/gIPsiy3FuKiAcC72QLe4dtk4WE96UADKZ6jpcIfuf2szNFJbbn/MZS4iWJ4QmPQMw4aRhDGxzVcpZkYrNFDZBarMTfYYlD8ZYOXhf7JG+IRqSWTVK/3Zpspdwi90CKKPlcglboOMl4vRHiR2tB7ff1A47EIcvRlJLM0ECgYEArSbhn8jzzF0IfAPGJXa/fCudy2wtjIIE/HHBbTpGmMNIa1LzHfl3liHqnWZp4/DnoEBIw0NqD38M3t9FGJ1gYVD36weIXirefVjTb55jNGOFv1mZaYwm301UKLAWIdOfAGgTD84pJ3XpBeTjN185IVfsh1RK9469UIGmYbSWKR8CgYEAozWGD9aAsXLqCcsyySWI73Q1thUARau5rHoD/HDRCiwF6yjJDocKhVJUvrgVC2Wx3OcKnDa5Du/l5YQYUjtJNq34ig7HuNs5RIiDRAZPkwLbm7Am8VR/g3DGKI4FY9TmF0/lW2pR+rgCYt77aojy1Zpq20yYZz76WNX4q4CtiIECgYBxaN8iMXuKkGigDq+DWiw3RSt9XalqJEWdLKXLJZto1ESN+KC6ZQaCM+j9L+2A4n2N10UjjABdvcztK7EFw5LFI5nDEFEQu7VUfi2eKIS2hUKm2QGQPxeCbNd5mUL4kXsmetKHcZnxZlG1CBinWXCUbJAIRbl9Cc4ax85evX+ChA=="; |
| | | String alipayPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkoPidM7vHL/74FhOWARjkMDZN0GktpVEQaYz6qpIjTuKLcQsR74CUv9LoiGD9uquYAI52TdmxzMWbuMEvrdVIT6pWyJuCvScX2U5Zwn9Bk8bE5RmTobUrU3LFudMYIGFU3qUHqnTJFQxLsSUibTtxbov1bpCQNwk3/2RdYOpJHKDjkXzNcjJrkuNcGcuzNW/3+L5CMaVm0dxqxx0dhJ4H0xvpMw2uvdxdLXN/KoYszfps4j61x0KFwkulvD1WHzR1f/ot9NU8FZe+dkNm5cXb9HbwQIbfARyB5bd0EYHSr4fJIUJx1GnjpfT6/traxEoyOcI6diJa4b2hZpR3WvxTQIDAQAB"; |
| | | AlipayConfig alipayConfig = new AlipayConfig(); |
| | | alipayConfig.setServerUrl("https://openapi.alipay.com/gateway.do"); |
| | | alipayConfig.setAppId("2021004173610331"); |
| | | alipayConfig.setPrivateKey(privateKey); |
| | | alipayConfig.setFormat("json"); |
| | | alipayConfig.setAlipayPublicKey(alipayPublicKey); |
| | | alipayConfig.setCharset("UTF-8"); |
| | | alipayConfig.setSignType("RSA2"); |
| | | return alipayConfig; |
| | | } |
| | | } |
| | |
| | | import java.math.BigDecimal; |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | List<TAppUserCar> cars = appUserCarService.list(new QueryWrapper<TAppUserCar>() |
| | | .eq("app_user_id",tokenService.getLoginUserApplet().getUserId()) |
| | | .orderByDesc("create_time")); |
| | | Long data1 = chargingOrderClient.getCar().getData(); |
| | | Long data1 = chargingOrderClient.getCar(tokenService.getLoginUserApplet().getUserId().toString()).getData(); |
| | | Integer data2 = otherClient.getAddCarIntegral().getData(); |
| | | data.setIntegral(data2); |
| | | if (!cars.isEmpty()){ |
| | |
| | | @ApiOperation(value = "优惠卷可用数量", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping(value = "/couponCount") |
| | | public R<Long> couponCount() { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | return R.ok(tAppCouponService.lambdaQuery().le(TAppCoupon::getStartTime, now).ge(TAppCoupon::getEndTime, now).eq(TAppCoupon::getStatus, 1).count()); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | Long count = tAppCouponService.lambdaQuery().eq(TAppCoupon::getAppUserId, userId).ge(TAppCoupon::getEndTime, LocalDateTime.now()).eq(TAppCoupon::getStatus, 1).count(); |
| | | if(Objects.isNull(count)){ |
| | | count = 0L; |
| | | } |
| | | return R.ok(count); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | @PostMapping("/grantCoupon") |
| | | public R grantCoupon(@RequestBody GrantCouponDto dto){ |
| | | dto.setWaysToObtain(3); |
| | | List<TAppCoupon> res = new ArrayList<>(); |
| | | TCoupon coupon = otherClient.getCouponById(dto.getCouponId()).getData(); |
| | | |
| | |
| | | break; |
| | | case 2: |
| | | // 根据市codes 查询用户ids |
| | | List<Long> collect1 = appUserService.list(new QueryWrapper<TAppUser>() |
| | | .in("city_code", Arrays.asList(dto.getCityCode().split(",")))) |
| | | .stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | List<Long> collect1 = new ArrayList<>(); |
| | | // 根据市codes 查询用户ids |
| | | if (StringUtils.hasLength(dto.getProvinceCode())){ |
| | | List<Long> collect2 = appUserService.list(new QueryWrapper<TAppUser>() |
| | | .in("province_code", Arrays.asList(dto.getProvinceCode().split(",")))) |
| | | .stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | collect1.addAll(collect2); |
| | | } |
| | | if (StringUtils.hasLength(dto.getCityCode())){ |
| | | List<Long> collect2 = appUserService.list(new QueryWrapper<TAppUser>() |
| | | .in("city_code", Arrays.asList(dto.getCityCode().split(",")))) |
| | | .stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | collect1.addAll(collect2); |
| | | } |
| | | for (Long l : collect1) { |
| | | TAppCoupon tAppCoupon = new TAppCoupon(); |
| | | tAppCoupon.setAppUserId(l); |
| | |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "查询用户地址详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TAppUserAddress> getDetailById(@RequestParam(value = "id")Long id) { |
| | | TAppUserAddress byId = appUserAddressService.getById(id); |
| | | byId.setUid(byId.getId().toString()); |
| | | return R.ok(byId); |
| | | TAppUserAddress appUserAddress = appUserAddressService.getById(id); |
| | | appUserAddress.setUid(appUserAddress.getId().toString()); |
| | | return R.ok(appUserAddress); |
| | | } |
| | | |
| | | /** |
| | |
| | | Page<TAppUser> page = appUserService.lambdaQuery() |
| | | .like(userListQueryDto.getUserPhone() != null && !"".equals(userListQueryDto.getUserPhone()), TAppUser::getPhone, userListQueryDto.getUserPhone()) |
| | | .eq(userListQueryDto.getCityCode() != null && !"".equals(userListQueryDto.getCityCode()), TAppUser::getCityCode, userListQueryDto.getCityCode()) |
| | | .eq(userListQueryDto.getProvinceCode() != null && !"".equals(userListQueryDto.getProvinceCode()), TAppUser::getProvinceCode, userListQueryDto.getProvinceCode()) |
| | | .in(!userIds.isEmpty(),TAppUser::getId,userIds) |
| | | .eq(TAppUser::getStatus,1) |
| | | .page(Page.of(userListQueryDto.getPageCurr(), userListQueryDto.getPageSize())); |
| | |
| | | TAppUser byId = appUserService.getById(userId); |
| | | AppUserInfoDto appUserInfoDto = new AppUserInfoDto(); |
| | | TVip data = vipClient.getVipInfoByType(2).getData(); |
| | | appUserInfoDto.setMinPrice(data.getMonthlyCard()); |
| | | if(null != data){ |
| | | appUserInfoDto.setMinPrice(data.getMonthlyCard()); |
| | | } |
| | | |
| | | //判断会员 |
| | | if (byId.getVipEndTime()==null||byId.getVipEndTime().isBefore(LocalDateTime.now())){ |
| | |
| | | @ApiOperation(value = "获取开票抬头数据列表", tags = {"小程序-充电发票"}) |
| | | public AjaxResult<List<InvoiceInformationVo>> getInvoiceInformationList(){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | List<TInvoiceInformation> list = invoiceInformationService.list(new LambdaQueryWrapper<TInvoiceInformation>().eq(TInvoiceInformation::getAppUserId, userId).eq(TInvoiceInformation::getDelFlag, 0)); |
| | | List<TInvoiceInformation> list = invoiceInformationService.list(new LambdaQueryWrapper<TInvoiceInformation>() |
| | | .eq(TInvoiceInformation::getAppUserId, userId).eq(TInvoiceInformation::getDelFlag, 0).orderByDesc(TInvoiceInformation::getIsDefault)); |
| | | List<InvoiceInformationVo> lists = new ArrayList<>(); |
| | | for (TInvoiceInformation tInvoiceInformation : list) { |
| | | InvoiceInformationVo vo = new InvoiceInformationVo(); |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.internal.util.codec.Base64; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | |
| | | import com.ruoyi.account.wx.tools.WxAppletTools; |
| | | import com.ruoyi.account.wx.tools.WxUtils; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.FileUploadUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | //import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.security.SecureRandom; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | | * 微信小程序登录 前端控制器 |
| | |
| | | private WeixinProperties wxConfig; |
| | | @Autowired |
| | | private RestTemplate wxRestTemplate; |
| | | // /** |
| | | // * 上传文件存储在本地的根路径 |
| | | // */ |
| | | // @Value("${file.path}") |
| | | // private String localFilePath; |
| | | @ApiOperation(value = "通过code获得openid,获取用户信息",tags = {"微信小程序登录"}) |
| | | @PostMapping("/openIdByJsCode") |
| | | public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestBody AppletUserEncrypteData data) { |
| | |
| | | public AjaxResult<Map<String, Object>> openIdByJsCode(@RequestBody AppletUserDecodeData appletUserDecodeData) { |
| | | return AjaxResult.success(appUserService.wxLogin(appletUserDecodeData, null)); |
| | | } |
| | | // public static MultipartFile convertInputStreamToMultipartFile(InputStream inputStream, String fileName, String contentType) throws IOException { |
| | | // return new MockMultipartFile(fileName, fileName, contentType, inputStream); |
| | | // } |
| | | @ApiOperation(value = "获取微信小程序二维码",tags = {"获取微信小程序二维码"}) |
| | | @PostMapping("/getQRCode") |
| | | public AjaxResult getQRCode() { |
| | | InputStream inputStream = null; |
| | | OutputStream outputStream = null; |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig); |
| | | String accessToken = appletTools.getAccessToken(""); |
| | | try { |
| | | String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | // param.put("page", "pageA/houseDetail"); |
| | | param.put("check_path", false); |
| | | param.put("env_version", "trial"); |
| | | param.put("width", 200); //二维码尺寸 |
| | | param.put("is_hyaline", true); // 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码 参数仅对小程序码生效 |
| | | param.put("auto_color", true); // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 参数仅对小程序码生效 |
| | | Map<String, Object> line_color = new HashMap<>(); |
| | | line_color.put("r", 0); |
| | | line_color.put("g", 0); |
| | | line_color.put("b", 0); |
| | | param.put("line_color", line_color); |
| | | System.err.println("调用生成微信URL接口传参:" + param); |
| | | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| | | HttpEntity requestEntity = new HttpEntity(param, headers); |
| | | ResponseEntity<byte[]> entity = wxRestTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); |
| | | System.err.println("调用小程序生成微信永久小程序码URL接口返回结果:" + entity.getBody()); |
| | | byte[] result = entity.getBody(); |
| | | System.err.println(Base64.encodeBase64String(result)); |
| | | inputStream = new ByteArrayInputStream(result); |
| | | String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpeg"; |
| | | // MultipartFile multipartFile = convertInputStreamToMultipartFile(inputStream, finalFileName, "image/jpeg"); |
| | | // String name = FileUploadUtils.upload(localFilePath, multipartFile); |
| | | // System.err.println(name); |
| | | return AjaxResult.success(null); |
| | | } catch (Exception e) { |
| | | System.err.println("调用小程序生成微信永久小程序码URL接口异常" + e); |
| | | } finally { |
| | | if (inputStream != null) { |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if (outputStream != null) { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public void init(FilterConfig filterConfig) throws ServletException { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { |
| | | HttpServletRequest request = (HttpServletRequest) servletRequest; |
| | | HttpServletResponse response = (HttpServletResponse) servletResponse; |
| | |
| | | } |
| | | filterChain.doFilter(request, response); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void destroy() { |
| | | |
| | | } |
| | | |
| | | |
| | | private void unauthorizedResponse(HttpServletResponse response, String msg) { |
| | | response.setStatus(HttpStatus.OK.value()); |
| | | response.setHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_UTF8_VALUE); |
| | |
| | | if(collect.isEmpty()){ |
| | | collect.add(-1L); |
| | | } |
| | | wrapper.in("id",collect); |
| | | wrapper.in("app_user_id",collect); |
| | | } |
| | | if (dto.getStatus()!=null){ |
| | | wrapper.eq("status",dto.getStatus()); |
| | |
| | | import com.ruoyi.account.wx.body.resq.Code2SessionResqBody; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | 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 |
| | | # 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 |
| | | # 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 |
| | | # 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: 192.168.0.137:8080 # Sentinel控制台地址 |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取合作商信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getPartnerById/{id}") |
| | | public R<Partner> getPartnerById(@PathVariable("id") Integer id){ |
| | | Partner partner = partnerService.getPartner(id); |
| | | return R.ok(partner); |
| | | } |
| | | } |
| | |
| | | PageInfo<GetSiteListDTO> list = siteService.getSiteList(siteList); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getSiteList/byUserId") |
| | | @ApiOperation(value = "获取站点列表", tags = {"管理后台-站点管理"}) |
| | | public R<List<GetSiteListDTO>> getSiteListByUserId(@RequestParam("userId") Long userId){ |
| | |
| | | return AjaxResult.success(siteService.getSiteListGun()); |
| | | } |
| | | |
| | | @PostMapping("/getSiteListParkLot") |
| | | @GetMapping("/getSiteListParkLot") |
| | | @ApiOperation(value = "获取站点列表不分页", tags = {"管理后台-停车场绑定"}) |
| | | public AjaxResult<List<Site>> getSiteListParkLot(){ |
| | | return AjaxResult.success(siteService.getSiteListParkLot()); |
| | |
| | | @ApiOperation(value = "获取站点详细信息", tags = {"小程序-站点管理-站点详情"}) |
| | | @PostMapping("/getDetailById") |
| | | public AjaxResult<SiteDetailVO> getDetailById(@Validated @RequestBody SiteDetailQuery query){ |
| | | SiteDetailVO siteDetailVO = siteService.getDetailById(query.getSiteId()); |
| | | SiteDetailVO siteDetailVO = siteService.getDetailById(query); |
| | | // 查询合作商名称 |
| | | Partner partner = partnerService.getById(siteDetailVO.getPartnerId()); |
| | | if(Objects.nonNull(partner)){ |
| | | siteDetailVO.setPartnerName(partner.getName()); |
| | | } |
| | | // 计算距离 |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(query.getLat() + "," + query.getLon(), siteDetailVO.getLat() + "," + siteDetailVO.getLon()); |
| | | siteDetailVO.setDistance(distance.get("WGS84")); |
| | | // Map<String, Double> distance = GeodesyUtil.getDistance(query.getLat() + "," + query.getLon(), siteDetailVO.getLat() + "," + siteDetailVO.getLon()); |
| | | // siteDetailVO.setDistance(distance.get("WGS84")); |
| | | // 查询绑定车牌提示文案 |
| | | TParkingLot parkingLot = parkingLotService.getOne(Wrappers.lambdaQuery(TParkingLot.class) |
| | | .eq(TParkingLot::getSiteId, query.getSiteId())); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/getSiteByIds") |
| | | public R<List<Site>> getSiteByIds(@RequestBody List<Integer> ids){ |
| | | List<Site> sites = siteService.listByIds(ids); |
| | | List<Site> sites = siteService.list(new LambdaQueryWrapper<Site>().in(Site::getId, ids).eq(Site::getDelFlag, 0)); |
| | | return R.ok(sites); |
| | | } |
| | | |
| | |
| | | Long userId = SecurityUtils.getLoginUser().getUserid(); |
| | | dto.setUserId(userId); |
| | | dto.setAuditStatus(1); |
| | | dto.setId(null); |
| | | dto.setParentId(dto.getId()); |
| | | dto.setId(null); |
| | | accountingStrategyService.save(dto); |
| | | // 添加明细 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = dto.getAccountingStrategyDetails(); |
| | |
| | | String twoUserName = sysUserClient.getSysUser(children.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | } |
| | | if(null != children.getUserId()){ |
| | | String userName = sysUserClient.getSysUser(children.getUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setUserName(userName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, children.getId()))); |
| | | }else { |
| | |
| | | String twoUserName = sysUserClient.getSysUser(accountingStrategy.getTwoUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setTwoUserName(twoUserName); |
| | | } |
| | | if(null != children.getUserId()){ |
| | | String userName = sysUserClient.getSysUser(children.getUserId()).getData().getNickName(); |
| | | accountingStrategyVO.setUserName(userName); |
| | | } |
| | | accountingStrategyVO.setAccountingStrategyDetailList(accountingStrategyDetailService.list(Wrappers.lambdaQuery(TAccountingStrategyDetail.class) |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, id))); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 通过站点id查询当前时间段计费策略展示 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "通过枪id查询当前时间段计费策略展示") |
| | | @GetMapping(value = "/queryStrategyByGunIdAndTime") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryStrategyByGunIdAndTime(@RequestParam("gunId") Integer gunId) { |
| | | return AjaxResult.ok(accountingStrategyDetailService.queryStrategyByGunIdAndTime(gunId)); |
| | | } |
| | | |
| | | /** |
| | | * 价格说明金额返回,会员开通金额说明 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-站点管理-站点详情"},value = "价格说明金额返回,会员开通金额说明") |
| | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.BufferedReader; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileReader; |
| | | import java.io.PrintWriter; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | @ApiOperation(tags = {"后台-充电枪"},value = "结束充电") |
| | | @PutMapping(value = "/stopCharging") |
| | | public AjaxResult<String> stopCharging(@RequestParam("id") String id) { |
| | | // 根据充电枪id 查询最新的一笔订单 |
| | | String data = chargingOrderClient.queryOrderByGunId(id).getData(); |
| | | // 硬件 结束充电 |
| | | chargingOrderClient.stopCharging(id); |
| | | chargingOrderClient.stopCharging(data); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | response.setContentType("application/force-download"); |
| | | response.addHeader("Content-Disposition", "attachment;fileName=" + fileName); |
| | | String url = "https://mxcd.zhinenganguan.com?No=" + code; |
| | | String filePath = fileUploadConfig.getLocation(); |
| | | String filePath = fileUploadConfig.getLocation() + fileName; |
| | | QRCodeUtils.encode(url, filePath); |
| | | FileInputStream inputStream = new FileInputStream(filePath); |
| | | ServletOutputStream out = response.getOutputStream(); |
| | |
| | | out.flush(); |
| | | out.close(); |
| | | inputStream.close(); |
| | | |
| | | //清楚服务器上的文件 |
| | | Process process = null; |
| | | try { |
| | | process = Runtime.getRuntime().exec("sudo rm -rf " + filePath); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | if (process != null) { |
| | | process.destroy(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteDetailQuery; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteDetailVO; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | SiteDetailVO getDetailById(@Param("siteId")Integer siteId); |
| | | SiteDetailVO getDetailById(@Param("query") SiteDetailQuery query); |
| | | |
| | | /** |
| | | * 获取站点列表不分页 管理后台-停车场绑定 |
| | |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteDetailQuery; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteDetailVO; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | |
| | | |
| | | /** |
| | | * 获取站点详情 |
| | | * @param siteId |
| | | * @param query |
| | | * @return |
| | | */ |
| | | SiteDetailVO getDetailById(Integer siteId); |
| | | SiteDetailVO getDetailById(SiteDetailQuery query); |
| | | |
| | | /** |
| | | * 获取站点列表不分页 管理后台-停车场绑定 |
| | |
| | | */ |
| | | Boolean isStrategyPriceConsistent(List<TAccountingStrategyDetail> accountingStrategyDetails); |
| | | |
| | | /** |
| | | * 通过枪id查询当前时间段计费策略展示 |
| | | * @param gunId |
| | | * @return |
| | | */ |
| | | List<TAccountingStrategyDetailVO> queryStrategyByGunIdAndTime(Integer gunId); |
| | | } |
| | |
| | | List<SysRole> data = r.getData(); |
| | | for (PartnerListDTO partnerListDTO : list) { |
| | | Integer roleId = partnerListDTO.getRoleId(); |
| | | if(null != roleId){ |
| | | if(null == roleId){ |
| | | continue; |
| | | } |
| | | SysRole sysRole = data.stream().filter(s -> roleId.equals(s.getRoleId())).findFirst().get(); |
| | | SysRole sysRole = data.stream().filter(s -> roleId.compareTo(s.getRoleId().intValue()) == 0).findFirst().get(); |
| | | if(null != sysRole){ |
| | | partnerListDTO.setRoleName(sysRole.getRoleName()); |
| | | } |
| | |
| | | //站点 |
| | | long count = siteService.count(new LambdaQueryWrapper<Site>().in(Site::getPartnerId, Arrays.asList(ids)).eq(Site::getDelFlag, 0)); |
| | | if(count > 0){ |
| | | return AjaxResult.error("当前合作商有关联站点,删除失败!"); |
| | | return AjaxResult.error("该合作商已关联站点不可删除!"); |
| | | } |
| | | //充电桩 |
| | | long count1 = chargingPileService.count(new LambdaQueryWrapper<TChargingPile>().eq(TChargingPile::getPartnerId, Arrays.asList(ids)).eq(TChargingPile::getDelFlag, 0)); |
| | | long count1 = chargingPileService.count(new LambdaQueryWrapper<TChargingPile>().in(TChargingPile::getPartnerId, Arrays.asList(ids)).eq(TChargingPile::getDelFlag, 0)); |
| | | if(count1 > 0){ |
| | | return AjaxResult.error("当前合作商有关联充电桩,删除失败!"); |
| | | return AjaxResult.error("该合作商已关联充电桩不可删除!"); |
| | | } |
| | | for (Integer id : ids) { |
| | | Partner partner = this.getById(id); |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.query.GetSiteList; |
| | | import com.ruoyi.chargingPile.api.query.SiteDetailQuery; |
| | | import com.ruoyi.chargingPile.api.query.SiteQuery; |
| | | import com.ruoyi.chargingPile.api.vo.SiteDetailVO; |
| | | import com.ruoyi.chargingPile.api.vo.SiteVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | private VipClient vipClient; |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | @Resource |
| | | private TParkingLotService parkingLotService; |
| | | |
| | | |
| | | |
| | |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | if(Objects.nonNull(vip) && vip.getType() == 2){ |
| | | list.forEach(item -> { |
| | | item.setVipElectrovalence(vip.getDiscount().multiply(item.getElectrovalence())); |
| | | item.setVipElectrovalence(vip.getDiscount().multiply(item.getServiceCharge()).add(item.getElectrovalenceOriginal())); |
| | | }); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public SiteDetailVO getDetailById(Integer siteId) { |
| | | return this.baseMapper.getDetailById(siteId); |
| | | public SiteDetailVO getDetailById(SiteDetailQuery query) { |
| | | return this.baseMapper.getDetailById(query); |
| | | } |
| | | |
| | | @Override |
| | |
| | | ids = new HashSet<>(data); |
| | | } |
| | | } |
| | | // 查询所有的停车场的站点id |
| | | List<TParkingLot> list = parkingLotService.list(); |
| | | List<Integer> siteIds = list.stream().map(TParkingLot::getSiteId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids) && !CollectionUtils.isEmpty(siteIds)){ |
| | | ids.addAll(siteIds); |
| | | } |
| | | return this.baseMapper.getSiteListParkLot(ids); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.vo.StrategyPriceVO; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO; |
| | | import com.ruoyi.chargingPile.mapper.TAccountingStrategyDetailMapper; |
| | | import com.ruoyi.chargingPile.mapper.TAccountingStrategyMapper; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyDetailService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | @Autowired |
| | | private TChargingGunService chargingGunService; |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | @Override |
| | |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | if(Objects.nonNull(vip)) { |
| | | if (vip.getType() == 2) { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(vip.getDiscount())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(vip.getDiscount())); |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge().multiply(vip.getDiscount()))); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge().multiply(vip.getDiscount()))); |
| | | } else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge()).multiply(accountingStrategy.getDiscount())); |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount()))); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge().multiply(accountingStrategy.getDiscount()))); |
| | | } |
| | | }else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge())); |
| | |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO = list.stream().filter(detail -> DateUtils.string2LocalTime(detail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(detail.getEndTime() + ("23:59:59".equals(detail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | strategyPriceVO.setDiscountAmount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()) |
| | | // strategyPriceVO.setDiscountAmount(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge()) |
| | | // .subtract(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount())).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | strategyPriceVO.setDiscountAmount(accountingStrategyDetailVO.getServiceCharge() |
| | | .subtract(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount())).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | // 查询最高折扣的会员 |
| | | TVip monthlyCardDiscount = vipClient.getVipInfoByType(3).getData(); |
| | | strategyPriceVO.setServiceFeeDiscount(monthlyCardDiscount.getMonthlyCardDiscount()); |
| | | // 查询最高抵扣的会员 |
| | | TVip maximumDeduction = vipClient.getVipInfoByType(1).getData(); |
| | | strategyPriceVO.setMaxDiscountAmount(maximumDeduction.getMaximumDeduction()); |
| | | // 查询最低起步价会员 |
| | | TVip monthlyCard = vipClient.getVipInfoByType(2).getData(); |
| | | strategyPriceVO.setVipStartPrice(monthlyCard.getMonthlyCard()); |
| | | // 查询最高折扣的会员 |
| | | TVip monthlyCardDiscount = vipClient.getVipInfoByType(3).getData(); |
| | | strategyPriceVO.setServiceFeeDiscount(monthlyCardDiscount.getMonthlyCardDiscount()); |
| | | // 模板折扣 |
| | | strategyPriceVO.setDiscount(accountingStrategy.getDiscount()); |
| | | return strategyPriceVO; |
| | | } |
| | | |
| | |
| | | @Override |
| | | public Boolean isStrategyPriceConsistent(List<TAccountingStrategyDetail> accountingStrategyDetails) { |
| | | Map<Integer, BigDecimal> phaseToServiceFee = new HashMap<>(); |
| | | Map<Integer, BigDecimal> phaseToCostServiceFee = new HashMap<>(); |
| | | for (TAccountingStrategyDetail detail : accountingStrategyDetails) { |
| | | Integer type = detail.getType(); |
| | | BigDecimal serviceFee = detail.getServiceCharge(); |
| | | BigDecimal costServiceCharge = detail.getCostServiceCharge(); |
| | | |
| | | if (phaseToServiceFee.containsKey(type)) { |
| | | BigDecimal existingFee = phaseToServiceFee.get(type); |
| | | if (!existingFee.equals(serviceFee)) { |
| | | BigDecimal existingCostServiceCharge = phaseToCostServiceFee.get(type); |
| | | if (existingFee.compareTo(serviceFee) != 0) { |
| | | return false; // 发现不一致的服务费 |
| | | } |
| | | if (existingCostServiceCharge.compareTo(costServiceCharge) != 0) { |
| | | return false; // 发现不一致的原价服务费 |
| | | } |
| | | } else { |
| | | phaseToServiceFee.put(type, serviceFee); |
| | | phaseToCostServiceFee.put(type, costServiceCharge); |
| | | } |
| | | } |
| | | return true; // 所有相同阶段的服务费一致 |
| | | } |
| | | |
| | | @Override |
| | | public List<TAccountingStrategyDetailVO> queryStrategyByGunIdAndTime(Integer gunId) { |
| | | TChargingGun chargingGun = chargingGunService.getById(gunId); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyMapper.selectById(chargingGun.getAccountingStrategyId()); |
| | | if(Objects.isNull(accountingStrategy)){ |
| | | throw new ServiceException("未查询到计费策略"); |
| | | } |
| | | List<TAccountingStrategyDetailVO> list = this.queryAccountingStrategyDetailByStrategyId(accountingStrategy.getId()); |
| | | list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); |
| | | // 获取当前登录用户id |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // 根据id查询用户信息 |
| | | TAppUser appUser = appUserClient.getUserById(userId).getData(); |
| | | if(Objects.nonNull(appUser)){ |
| | | // 查询会员信息 |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | TAccountingStrategyDetailVO accountingStrategyDetailVO; |
| | | TAccountingStrategyDetailVO accountingStrategyDetailNext; |
| | | // 获取当前时间段的计费策略明细 |
| | | accountingStrategyDetailVO = list.stream().filter(detail -> DateUtils.string2LocalTime(detail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(detail.getEndTime() + ("23:59:59".equals(detail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("当前时间段未查询到计费策略明细")); |
| | | // 获取后一次的计费策略明细 |
| | | accountingStrategyDetailVO.setEndTime("23:59:59".equals(accountingStrategyDetailVO.getEndTime())? "00:00":accountingStrategyDetailVO.getEndTime()); |
| | | accountingStrategyDetailNext = list.stream().filter(detail -> detail.getStartTime().compareTo(accountingStrategyDetailVO.getEndTime()) == 0) |
| | | .findFirst().orElseThrow(() -> new ServiceException("未查询到下一时间段的计费策略明细")); |
| | | if(Objects.nonNull(vip)) { |
| | | if (vip.getType() == 2) { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge().multiply(vip.getDiscount()))); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge().multiply(vip.getDiscount()))); |
| | | } else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge().multiply(accountingStrategy.getDiscount()))); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge().multiply(accountingStrategy.getDiscount()))); |
| | | } |
| | | }else { |
| | | accountingStrategyDetailVO.setTotalPrice(accountingStrategyDetailVO.getElectrovalence().add(accountingStrategyDetailVO.getServiceCharge())); |
| | | accountingStrategyDetailNext.setTotalPrice(accountingStrategyDetailNext.getElectrovalence().add(accountingStrategyDetailNext.getServiceCharge())); |
| | | } |
| | | list = new ArrayList<>(); |
| | | list.add(accountingStrategyDetailVO); |
| | | list.add(accountingStrategyDetailNext); |
| | | return list; |
| | | } |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | @Resource |
| | | private SendMessageClient sendMessageClient; |
| | | |
| | | |
| | | |
| | |
| | | return ajaxResult; |
| | | } |
| | | long count = this.count(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getCode, dto.getCode()) |
| | | .eq(TChargingGun::getDelFlag, 0)); |
| | | .eq(TChargingGun::getDelFlag, 0).eq(TChargingGun::getChargingPileId, dto.getChargingPileId())); |
| | | if(count > 0){ |
| | | return AjaxResult.error("接口编码已存在"); |
| | | } |
| | | this.save(dto); |
| | | TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); |
| | | |
| | | //下发硬件充电二维码 |
| | | String code_prefix = "https://mxcd.zhinenganguan.com?No="; |
| | | QrCodeDelivery qrCodeDelivery = new QrCodeDelivery(); |
| | | qrCodeDelivery.setCharging_pile_code(chargingPile.getCode()); |
| | | qrCodeDelivery.setCode_format(1); |
| | | qrCodeDelivery.setPrefix_length(code_prefix.length()); |
| | | qrCodeDelivery.setCode_prefix(code_prefix); |
| | | qrCodeDelivery.setQr_code(code_prefix + chargingPile.getCode() + dto.getCode()); |
| | | sendMessageClient.qrCodeDelivery(qrCodeDelivery); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | return ajaxResult; |
| | | } |
| | | TChargingGun one = this.getOne(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getCode, dto.getCode()) |
| | | .eq(TChargingGun::getDelFlag, 0)); |
| | | .eq(TChargingGun::getDelFlag, 0).eq(TChargingGun::getChargingPileId, dto.getChargingPileId())); |
| | | if(null != one && !dto.getId().equals(one.getId())){ |
| | | return AjaxResult.error("接口编码已存在"); |
| | | } |
| | | this.updateById(dto); |
| | | TChargingPile chargingPile = chargingPileService.getById(dto.getChargingPileId()); |
| | | |
| | | //下发硬件充电二维码 |
| | | String code_prefix = "https://mxcd.zhinenganguan.com?No="; |
| | | QrCodeDelivery qrCodeDelivery = new QrCodeDelivery(); |
| | | qrCodeDelivery.setCharging_pile_code(chargingPile.getCode()); |
| | | qrCodeDelivery.setCode_format(1); |
| | | qrCodeDelivery.setPrefix_length(code_prefix.length()); |
| | | qrCodeDelivery.setCode_prefix(code_prefix); |
| | | qrCodeDelivery.setQr_code(code_prefix + chargingPile.getCode() + dto.getCode()); |
| | | sendMessageClient.qrCodeDelivery(qrCodeDelivery); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IotInterfaceClient; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.vo.AddDevice; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | @Resource |
| | | private IotInterfaceClient iotInterfaceClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | if(count > 0){ |
| | | return AjaxResult.error("设备编号已存在"); |
| | | } |
| | | this.save(chargingPile); |
| | | //调用华为Iot创建设备 |
| | | AddDevice addDevice = new AddDevice(); |
| | | addDevice.setProductId("66da68d21837002b28b34ec0"); |
| | | addDevice.setNodeId(chargingPile.getCode()); |
| | | addDevice.setDeviceName(chargingPile.getName()); |
| | | addDevice.setDescription(chargingPile.getNumber().toString()); |
| | | AddDeviceResp deviceResp = iotInterfaceClient.addDevice(addDevice).getData(); |
| | | if(null != deviceResp){ |
| | | int httpStatusCode = deviceResp.getHttpStatusCode(); |
| | | if(httpStatusCode == 201){ |
| | | chargingPile.setIotdDeviceId(deviceResp.getDeviceId()); |
| | | this.save(chargingPile); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public AjaxResult delChargingPile(Integer[] ids) { |
| | | //检查是否有关联数据 |
| | | //接口 |
| | | long count = chargingGunService.count(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getChargingPileId, Arrays.asList(ids)) |
| | | .eq(TChargingGun::getDelFlag, 0)); |
| | | if(count > 0){ |
| | |
| | | } |
| | | for (Integer id : ids) { |
| | | TChargingPile chargingPile = this.getById(id); |
| | | this.removeById(chargingPile); |
| | | //调用华为Iot删除设备 |
| | | if(StringUtils.isNotEmpty(chargingPile.getIotdDeviceId())){ |
| | | DeleteDeviceResp deviceResp = iotInterfaceClient.deleteDevice(chargingPile.getIotdDeviceId()).getData(); |
| | | if(null != deviceResp && deviceResp.getHttpStatusCode() == 201){ |
| | | this.removeById(chargingPile); |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | List<TChargingGun> chargingGuns = chargingGunService.list(wrapper); |
| | | // 查询充电枪信息 |
| | | chargingPileVOS.forEach(item -> { |
| | | item.setChargingGunList(chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList())); |
| | | List<TChargingGun> chargingGunList = chargingGuns.stream().filter(gun -> gun.getChargingPileId().equals(item.getId())).collect(Collectors.toList()); |
| | | for (TChargingGun chargingGun : chargingGunList) { |
| | | if(chargingGun.getStatus().equals(4)){ |
| | | // TODO 查询正在充电的单子的实时记录 |
| | | chargingGun.setSoc(100); |
| | | } |
| | | if(chargingGun.getStatus().equals(5)){ |
| | | chargingGun.setSoc(100); |
| | | } |
| | | } |
| | | item.setChargingGunList(chargingGunList); |
| | | }); |
| | | return chargingPileVOS; |
| | | } |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | | tx-service-group: seata_tx_group #此处配置自定义的seata事务分组名称 |
| | | enable-auto-data-source-proxy: true |
| | | enable-auto-data-source-proxy: false |
| | | service: |
| | | vgroup-mapping: |
| | | seata_tx_group: default |
| | |
| | | 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 |
| | | # 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 |
| | | # 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 |
| | | # 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控制台地址 |
| | |
| | | a.phone, |
| | | a.service_phone as servicePhone, |
| | | a.parking_space as parkingSpace, |
| | | DATE_FORMAT('%Y-%m-%d %H:%i:%s', a.establishment_time) as establishmentTime, |
| | | DATE_FORMAT(a.establishment_time, '%Y-%m-%d %H:%i:%s') as establishmentTime, |
| | | c.num as chargingPileNumber, |
| | | a.sort, |
| | | a.accounting_strategy_id as accountingStrategyId, |
| | |
| | | ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status, ts.construction_site, ts.img_url, |
| | | ts.lon, ts.lat, ts.address, ts.country_code, ts.phone,ts.guide, ts.service_description, ts.vehicle_description, |
| | | ts.parking_space, ts.rate_description, ts.space_charge_explain, ts.accounting_strategy_id,ts.del_flag,tcg.fastCount, |
| | | tcg.slowCount,tcg.superCount,tasd.electrovalence,tasd.vipElectrovalence,tcg.superFreeCount,tcg.fastFreeCount,tcg.slowFreeCount, |
| | | tcg.slowCount,tcg.superCount,tasd.electrovalence,tasd.vipElectrovalence,tasd.serviceCharge,tasd.electrovalenceOriginal,tcg.superFreeCount,tcg.fastFreeCount,tcg.slowFreeCount, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | |
| | | left join ( |
| | | select |
| | | a.accounting_strategy_id, |
| | | a.service_charge AS serviceCharge, |
| | | a.electrovalence AS electrovalenceOriginal, |
| | | (a.electrovalence+a.service_charge) AS electrovalence, |
| | | ((a.electrovalence+a.service_charge)*b.discount) AS vipElectrovalence |
| | | (a.electrovalence + (a.service_charge*b.discount)) AS vipElectrovalence |
| | | from |
| | | t_accounting_strategy_detail a |
| | | left join |
| | |
| | | <where> |
| | | <if test="null != query.name and '' != query.name"> |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | <if test="null != query.cityCode and '' != query.cityCode"> |
| | | and ts.cityCode = #{query.cityCode} |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()} |
| | |
| | | </if> |
| | | </select> |
| | | <select id="getDetailById" resultType="com.ruoyi.chargingPile.api.vo.SiteDetailVO"> |
| | | SELECT <include refid="Base_Column_List"></include> |
| | | FROM t_site WHERE id = #{siteId} AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | SELECT id, partner_id, code, `name`, site_type, business_category, status, construction_site, img_url, province, province_code, |
| | | city, city_code, districts, districts_code, lon, lat, address, country_code, phone, service_phone, guide, start_service_time, |
| | | end_service_time, service_description, vehicle_description, parking_space, rate_description, space_charge_explain, |
| | | accounting_strategy_id, establishment_time, sort, remark, create_time, del_flag, mark, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | | POW( |
| | | SIN( |
| | | ( |
| | | #{query.lat} * PI() / 180 - ts.lat * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) + COS(#{query.lat} * PI() / 180) * COS(ts.lat * PI() / 180) * POW( |
| | | SIN( |
| | | ( |
| | | #{query.lon} * PI() / 180 - ts.lon * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) |
| | | ) |
| | | ) * 1000 |
| | | ) AS distance |
| | | FROM t_site WHERE id = #{query.siteId} AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </select> |
| | | <select id="getSiteListParkLot" resultType="com.ruoyi.chargingPile.api.model.Site"> |
| | | select ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status,tpl.id AS parkingLotId |
| | | select ts.id, ts.partner_id, ts.code, ts.`name`, ts.site_type, ts.business_category, ts.status |
| | | from t_site ts |
| | | left join t_parking_lot tpl on (ts.id = tpl.site_id) |
| | | <where> |
| | | <if test="null != ids and ids.size()>0"> |
| | | AND ts.id IN |
| | |
| | | </foreach> |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND tpl.id IS NULL |
| | | </where> |
| | | </select> |
| | | <select id="getSiteListGun" resultType="com.ruoyi.chargingPile.api.model.Site"> |
| | |
| | | <if test="null != query.name and '' != query.name"> |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | <if test="null != query.cityCode and '' != query.cityCode"> |
| | | and ts.cityCode = #{query.cityCode} |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()} |
| | | </where> |
New file |
| | |
| | | package com.ruoyi.integration.controller; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.integration.mongodb.service.SecurityDetectionService; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 14:25 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/securityDetection") |
| | | public class SecurityDetectionController { |
| | | |
| | | @Resource |
| | | private SecurityDetectionService securityDetectionService; |
| | | |
| | | /** |
| | | * 获取安全检测数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | @PostMapping("/getSecurityDetection") |
| | | public R<SecurityDetection> getSecurityDetection(@RequestParam("transactionSerialNumber") String transactionSerialNumber){ |
| | | SecurityDetection securityDetection = securityDetectionService.getSecurityDetection(transactionSerialNumber); |
| | | return R.ok(securityDetection); |
| | | } |
| | | } |
| | |
| | | * 远程更新应答 |
| | | */ |
| | | public final static String PLATFORM_REMOTE_UPDATE_REPLY ="platform_remote_update_reply"; |
| | | /** |
| | | * 二维码下发应答 |
| | | */ |
| | | public final static String QR_CODE_DELIVERY_REPLY ="qr_code_delivery_reply"; |
| | | /** |
| | | * 安全监测 |
| | | */ |
| | | public final static String SECURITY_DETECTION ="security_detection"; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.iotda.controller; |
| | | |
| | | import com.huaweicloud.sdk.iotda.v5.model.AddDeviceResponse; |
| | | import com.huaweicloud.sdk.iotda.v5.model.DeleteDeviceResponse; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.vo.AddDevice; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.integration.iotda.utils.api.IotInterfaceUtil; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/10/8 10:29 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/iotInterface") |
| | | public class IotInterfaceController { |
| | | |
| | | @Resource |
| | | private IotInterfaceUtil iotInterfaceUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 添加设备 |
| | | * @return |
| | | */ |
| | | @PostMapping("/addDevice") |
| | | public R<AddDeviceResp> addDevice(@RequestBody AddDevice addDevice){ |
| | | return iotInterfaceUtil.addDeviceRequest(addDevice.getProductId(), addDevice.getNodeId(), addDevice.getDeviceName(), addDevice.getDescription()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除设备 |
| | | * @param deviceId |
| | | * @return |
| | | */ |
| | | @PostMapping("/deleteDevice") |
| | | public R<DeleteDeviceResp> deleteDevice(@RequestParam("deviceId") String deviceId){ |
| | | return iotInterfaceUtil.deleteDeviceRequest(deviceId); |
| | | } |
| | | } |
| | |
| | | public String platformRemoteUpdate(@RequestBody PlatformRemoteUpdate platformRemoteUpdate){ |
| | | return iotMessageProduce.sendMessage(platformRemoteUpdate.getCharging_pile_code(), ServiceIdMenu.PLATFORM_REMOTE_UPDATE.getKey(),messageUtil.platformRemoteUpdate(platformRemoteUpdate)); |
| | | } |
| | | /** |
| | | * 二维码下发 |
| | | * @param qrCodeDelivery 实体对象 |
| | | * @return |
| | | */ |
| | | @PostMapping("/qrCodeDelivery") |
| | | public String qrCodeDelivery(@RequestBody QrCodeDelivery qrCodeDelivery){ |
| | | return iotMessageProduce.sendMessage(qrCodeDelivery.getCharging_pile_code(), ServiceIdMenu.QR_CODE_DELIVERY.getKey(),messageUtil.qrCodeDelivery(qrCodeDelivery)); |
| | | } |
| | | |
| | | } |
| | |
| | | * 远程更新 |
| | | */ |
| | | PLATFORM_REMOTE_UPDATE ("远程更新","platform_remote_update"), |
| | | /** |
| | | * 二维码下发 |
| | | */ |
| | | QR_CODE_DELIVERY ("二维码下发","qr_code_delivery"), |
| | | ; |
| | | private String key; |
| | | private String value; |
| | |
| | | package com.ruoyi.integration.iotda.utils.api; |
| | | |
| | | import com.huaweicloud.sdk.core.auth.AbstractCredentials; |
| | | import com.huaweicloud.sdk.core.auth.ICredential; |
| | | import com.huaweicloud.sdk.core.exception.ConnectionException; |
| | | import com.huaweicloud.sdk.core.exception.RequestTimeoutException; |
| | | import com.huaweicloud.sdk.core.exception.ServiceResponseException; |
| | | import com.huaweicloud.sdk.iotda.v5.IoTDAClient; |
| | | import com.huaweicloud.sdk.iotda.v5.model.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.CodeGenerateUtils; |
| | | import com.ruoyi.common.core.utils.uuid.UUID; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.integration.iotda.builder.IotBuilder; |
| | | import com.ruoyi.integration.iotda.config.IotAccountConfig; |
| | | import com.ruoyi.integration.iotda.config.IotDAConfig; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | |
| | | * iot接口调用工具类 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @Component |
| | | public class IotInterfaceUtil { |
| | | |
| | | private static final String dataFormat = "json"; |
| | |
| | | * @param description 设备描述 |
| | | * @return AddDeviceResponse |
| | | */ |
| | | public AddDeviceResponse addDeviceRequest(String productId,String nodeId,String deviceName,String description) { |
| | | public R<AddDeviceResp> addDeviceRequest(String productId,String nodeId,String deviceName,String description) { |
| | | AddDeviceRequest request = new AddDeviceRequest(); |
| | | AddDevice body = new AddDevice(); |
| | | body.withDeviceId(nodeId); |
| | |
| | | try { |
| | | AddDeviceResponse response = iotBuilder.buildIot().addDevice(request); |
| | | log.info("创建设备:{}",response.toString()); |
| | | return response; |
| | | |
| | | AddDeviceResp addDeviceResp = new AddDeviceResp(); |
| | | BeanUtils.copyProperties(response, addDeviceResp); |
| | | return R.ok(addDeviceResp); |
| | | } catch (ConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (RequestTimeoutException e) { |
| | |
| | | System.out.println(e.getErrorCode()); |
| | | System.out.println(e.getErrorMsg()); |
| | | } |
| | | return null; |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param deviceId 设备ID 使用已有设备编号 |
| | | * @return DeleteDeviceResponse |
| | | */ |
| | | public DeleteDeviceResponse deleteDeviceRequest(String deviceId) { |
| | | public R<DeleteDeviceResp> deleteDeviceRequest(String deviceId) { |
| | | DeleteDeviceRequest request = new DeleteDeviceRequest(); |
| | | request.withDeviceId(deviceId); |
| | | try { |
| | | DeleteDeviceResponse response = iotBuilder.buildIot().deleteDevice(request); |
| | | log.info("删除设备:{}",response.toString()); |
| | | return response; |
| | | DeleteDeviceResp deleteDeviceResp = new DeleteDeviceResp(); |
| | | BeanUtils.copyProperties(response, deleteDeviceResp); |
| | | return R.ok(deleteDeviceResp); |
| | | } catch (ConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (RequestTimeoutException e) { |
| | |
| | | System.out.println(e.getErrorCode()); |
| | | System.out.println(e.getErrorMsg()); |
| | | } |
| | | return null; |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileWriter; |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * iotda消息监听 |
| | |
| | | String productId = header.getString("product_id"); // 产品id |
| | | String service_id = content.getString("service_id"); |
| | | log.info("服务id:{}",service_id); |
| | | // 写入文件 |
| | | FileWriter writer = new FileWriter("D:/sample.txt",true); |
| | | writer.write("接收到消息中转:"+jsonObject+"\n"); |
| | | writer.write("服务id:"+service_id+"\n"); |
| | | writer.close(); |
| | | SendResult sendResult; |
| | | // 设备消息下发 |
| | | String result; |
| | |
| | | onlineReply.setOnline_result(0); |
| | | result = iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply)); |
| | | log.info("充电桩登录认证-返回结果:{}",result); |
| | | // 响应硬件 对时设置应答 |
| | | TimingSettingReply timingSettingReplyOnline = new TimingSettingReply(); |
| | | timingSettingReplyOnline.setCharging_pile_code(onlineMessage.getCharging_pile_code()); |
| | | timingSettingReplyOnline.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date())); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReplyOnline)); |
| | | break; |
| | | case SendTagConstant.PING: |
| | | PingMessage pingMessage = JSON.parseObject(content.toJSONString(),PingMessage.class); |
| | |
| | | AcquisitionBillingModeMessage acquisitionBillingModeMessage = JSON.parseObject(content.toJSONString(),AcquisitionBillingModeMessage.class); |
| | | sendResult = enhanceProduce.acquisitionBillingModeMessage(acquisitionBillingModeMessage); |
| | | // 响应硬件 计费模型请求应答 1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段 |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(acquisitionBillingModeMessage.getCharging_pile_code()).getData(); |
| | | List<TAccountingStrategyDetail> accountingStrategyDetails = accountingStrategyDetailClient.getDetailListByCode(acquisitionBillingModeMessage.getCharging_pile_code().substring(0,14)).getData(); |
| | | Map<Integer, TAccountingStrategyDetail> strategyPrice = StrategyUtil.getStrategyPrice(accountingStrategyDetails); |
| | | // 价格设置 |
| | | AcquisitionBillingModeReply acquisitionBillingModeReply = new AcquisitionBillingModeReply(); |
| | | StrategyUtil.setStrategyPrice(strategyPrice,acquisitionBillingModeReply); |
| | | // 时段设置 |
| | | StrategyUtil.setTime(accountingStrategyDetails,acquisitionBillingModeReply); |
| | | TAccountingStrategyDetail accountingStrategyDetail = accountingStrategyDetailClient.getDetailByCode(acquisitionBillingModeMessage.getCharging_pile_code()).getData(); |
| | | TAccountingStrategyDetail accountingStrategyDetail = accountingStrategyDetailClient.getDetailByCode(acquisitionBillingModeMessage.getCharging_pile_code().substring(0,14)).getData(); |
| | | acquisitionBillingModeReply.setBilling_model_code(accountingStrategyDetail.getId().toString()); |
| | | acquisitionBillingModeReply.setCharging_pile_code(acquisitionBillingModeMessage.getCharging_pile_code()); |
| | | acquisitionBillingModeReply.setLoss_ratio(BigDecimal.ZERO); |
| | |
| | | sendResult = enhanceProduce.platformRestartReplyMessage(platformRestartReplyMessage); |
| | | // 响应硬件 |
| | | break; |
| | | case SendTagConstant.QR_CODE_DELIVERY_REPLY: |
| | | QrCodeDeliveryReplyMessage qrCodeDeliveryReplyMessage = JSON.parseObject(content.toJSONString(),QrCodeDeliveryReplyMessage.class); |
| | | sendResult = enhanceProduce.qrCodeDeliveryReplyMessage(qrCodeDeliveryReplyMessage); |
| | | // 响应硬件 |
| | | break; |
| | | case SendTagConstant.SECURITY_DETECTION: |
| | | SecurityDetectionMessage securityDetectionMessage = JSON.parseObject(content.toJSONString(),SecurityDetectionMessage.class); |
| | | sendResult = enhanceProduce.securityDetectionMessage(securityDetectionMessage); |
| | | // 响应硬件 |
| | | break; |
| | | default: |
| | | PlatformRemoteUpdateReplyMessage platformRemoteUpdateReplyMessage = JSON.parseObject(content.toJSONString(),PlatformRemoteUpdateReplyMessage.class); |
| | | sendResult = enhanceProduce.platformRemoteUpdateReplyMessage(platformRemoteUpdateReplyMessage); |
| | |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "测试",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/test") |
| | | public R test() { |
| | | String orderNum = "2024092646526785213546"; |
| | | String deviceId = "3401231001200202"; |
| | | Long orderId = 2024065544L; |
| | | BigDecimal money = new BigDecimal(50); |
| | | PlatformStartCharging platformStartCharging = new PlatformStartCharging(); |
| | | platformStartCharging.setTransaction_serial_number(orderNum); |
| | | platformStartCharging.setCharging_pile_code(deviceId); |
| | | platformStartCharging.setCharging_gun_code("02"); |
| | | 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)); |
| | | System.err.println(platformStartCharging); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | @ApiOperation(value = "测试",tags = {"硬件接口"}) |
| | | @GetMapping(value = "/stop") |
| | | public R test1() { |
| | | PlatformStopCharging platformStopCharging = new PlatformStopCharging(); |
| | | platformStopCharging.setCharging_pile_code("3401231001200202"); |
| | | platformStopCharging.setCharging_gun_code("02"); |
| | | String message = iotMessageProduce.sendMessage(platformStopCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_STOP_CHARGING.getKey(),messageUtil.platformStopCharging(platformStopCharging)); |
| | | return R.ok(message); |
| | | } |
| | | |
| | | } |
| | |
| | | private PlatformRestartService platformRestartService; |
| | | @Autowired |
| | | private PlatformRemoteUpdateService platformRemoteUpdateService; |
| | | @Autowired |
| | | private QrCodeDeliveryService qrCodeDeliveryService; |
| | | |
| | | /** |
| | | * 登录认证应答 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 二维码下发 |
| | | * @param qrCodeDelivery 实体对象 |
| | | * @return |
| | | */ |
| | | public JSONObject qrCodeDelivery(QrCodeDelivery qrCodeDelivery){ |
| | | qrCodeDeliveryService.create(qrCodeDelivery); |
| | | return getMessageJsonString(qrCodeDelivery, ServiceIdMenu.QR_CODE_DELIVERY.getValue()); |
| | | } |
| | | |
| | | /** |
| | | * 统一封装消息 |
| | | * @param object 实体对象 |
| | | * @param serviceId 服务ID |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.QrCodeDeliveryReply; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | /** |
| | | */ |
| | | public interface QrCodeDeliveryReplyService extends BaseService<QrCodeDeliveryReply> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.Pong; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | /** |
| | | */ |
| | | public interface QrCodeDeliveryService extends BaseService<QrCodeDelivery> { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | |
| | | /** |
| | | */ |
| | | public interface SecurityDetectionService extends BaseService<SecurityDetection> { |
| | | |
| | | |
| | | /** |
| | | * 根据业务流水号查询数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | SecurityDetection getSecurityDetection(String transactionSerialNumber); |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.QrCodeDeliveryReply; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.QrCodeDeliveryReplyService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class QrCodeDeliveryReplyServiceImpl implements QrCodeDeliveryReplyService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(QrCodeDeliveryReply qrCodeDeliveryReply) { |
| | | mongoTemplate.save(qrCodeDeliveryReply); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public QrCodeDeliveryReply findById(String id) { |
| | | return mongoTemplate.findById(id, QrCodeDeliveryReply.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QrCodeDeliveryReply> findAll() { |
| | | return mongoTemplate.findAll(QrCodeDeliveryReply.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.QrCodeDeliveryService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class QrCodeDeliveryServiceImpl implements QrCodeDeliveryService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(QrCodeDelivery qrCodeDelivery) { |
| | | mongoTemplate.save(qrCodeDelivery); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public QrCodeDelivery findById(String id) { |
| | | return mongoTemplate.findById(id, QrCodeDelivery.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<QrCodeDelivery> findAll() { |
| | | return mongoTemplate.findAll(QrCodeDelivery.class); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.SecurityDetectionService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * 心跳包应答实现类 |
| | | **/ |
| | | @Service |
| | | public class SecurityDetectionServiceImpl implements SecurityDetectionService { |
| | | @Autowired |
| | | private MongoTemplate mongoTemplate; |
| | | |
| | | @Override |
| | | public int create(SecurityDetection securityDetection) { |
| | | mongoTemplate.save(securityDetection); |
| | | return IotConstant.SUCCESS; |
| | | } |
| | | |
| | | @Override |
| | | public SecurityDetection findById(String id) { |
| | | return mongoTemplate.findById(id, SecurityDetection.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<SecurityDetection> findAll() { |
| | | return mongoTemplate.findAll(SecurityDetection.class); |
| | | } |
| | | |
| | | /** |
| | | * 根据业务流水号查询数据 |
| | | * @param transactionSerialNumber |
| | | * @return |
| | | */ |
| | | @Override |
| | | public SecurityDetection getSecurityDetection(String transactionSerialNumber) { |
| | | List<SecurityDetection> securityDetectionList = mongoTemplate.find(new Query().addCriteria(Criteria.where("transaction_serial_number") |
| | | .is(transactionSerialNumber)), SecurityDetection.class); |
| | | return securityDetectionList.size() > 0 ? securityDetectionList.get(0) : null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | **/ |
| | | |
| | | @Data |
| | | public class QrCodeDeliveryMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private Integer code_format; // "0:第一种前缀+桩编号 1:第二种前缀+桩编号+枪编号" |
| | | private Integer prefix_length; // 二维码前缀长度长度最大不超过200 字节 |
| | | private String code_prefix; // 如:“www.baidu.com?No=” |
| | | private String qr_code; // 二维码内容,如:“www.baidu.com?No=3422000100023301” |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | **/ |
| | | |
| | | @Data |
| | | public class QrCodeDeliveryReplyMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private Integer delivery_result; // 设置结果(0:成功,1:失败) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.rocket.model; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * |
| | | **/ |
| | | |
| | | @Data |
| | | public class SecurityDetectionMessage extends BaseMessage { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer secure_connection; // 车枪连接(0=未连接,1=连接) |
| | | private Integer nsulation_detection; // 绝缘检测(0=安全,1=不安全) |
| | | private Integer electronic_lock_lock; // 电磁锁状态(0=未锁,1=已锁) |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.integration.api.model.ErrorMessage; |
| | | import com.ruoyi.integration.api.model.ParameterSetting; |
| | | import com.ruoyi.integration.api.model.QrCodeDeliveryReply; |
| | | import com.ruoyi.integration.api.model.SecurityDetection; |
| | | import com.ruoyi.integration.iotda.constant.SendTagConstant; |
| | | import com.ruoyi.integration.rocket.model.*; |
| | | import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate; |
| | |
| | | message.setSource(SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY, SendTagConstant.PLATFORM_REMOTE_UPDATE_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | | * 二维码下发应答 |
| | | */ |
| | | public SendResult qrCodeDeliveryReplyMessage(QrCodeDeliveryReplyMessage message) { |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagConstant.QR_CODE_DELIVERY_REPLY); |
| | | return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.QR_CODE_DELIVERY_REPLY, SendTagConstant.QR_CODE_DELIVERY_REPLY, message); |
| | | } |
| | | |
| | | /** |
| | | * 安全监测 |
| | | */ |
| | | public SendResult securityDetectionMessage(SecurityDetectionMessage message) { |
| | | // 设置业务key |
| | | message.setKey(UUID.randomUUID().toString()); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource(SendTagConstant.SECURITY_DETECTION); |
| | | return rocketMQEnhanceTemplate.send(TOPIC+SendTagConstant.SECURITY_DETECTION, SendTagConstant.SECURITY_DETECTION, message); |
| | | } |
| | | |
| | | } |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | |
| | | --- |
| | | spring: |
| | |
| | | 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 |
| | | # 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 |
| | | # 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 |
| | | # 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控制台地址 |
| | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.models.auth.In; |
| | | import jdk.nashorn.internal.runtime.ListAdapter; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 远程调用根据枪id 查询最新的订单id 用户后台结束充电 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/queryOrderByGunId/{id}") |
| | | public R<String> queryOrderByGunId(@PathVariable("id") String id) { |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(2); |
| | | integers.add(3); |
| | | integers.add(4); |
| | | TChargingOrder one = chargingOrderService.lambdaQuery() |
| | | .eq(TChargingOrder::getChargingGunId, id) |
| | | .in(TChargingOrder::getStatus, integers) |
| | | .one(); |
| | | if (one!=null){ |
| | | return R.ok(one.getId().toString()); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/list") |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"}) |
| | |
| | | * @param |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/getCar") |
| | | public R<Long> getCar() { |
| | | @GetMapping(value = "/getCar/{id}") |
| | | public R<Long> getCar(@PathVariable("id")String id) { |
| | | List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>() |
| | | .eq(TChargingOrder::getAppUserId, tokenService.getLoginUserApplet().getUserId()) |
| | | .eq(TChargingOrder::getAppUserId, id) |
| | | .isNotNull(TChargingOrder::getAppUserCarId)); |
| | | if (!list.isEmpty()){ |
| | | // 最近使用的车辆id |
| | |
| | | for (int i = 0; i < split1.length; i++) { |
| | | Integer reduce = tShoppingOrderService.list(new QueryWrapper<TShoppingOrder>() |
| | | .eq("order_type",1) |
| | | .ne("refund_status", 2)) |
| | | .eq("goods_id", split1[i]) |
| | | .isNull("refund_status")) |
| | | .stream().map(TShoppingOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | res.add(reduce); |
| | | } |
| | | break; |
| | | case 2: |
| | | for (int i = 0; i < split1.length; i++) { |
| | | Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",1).ne("status",4).eq("goods_id", split1[i])) |
| | | Integer reduce = exchangeOrderService.list(new QueryWrapper<TExchangeOrder>().eq("order_type",1) |
| | | .ne("status",4).eq("goods_id", split1[i])) |
| | | .stream().map(TExchangeOrder::getPurchaseQuantity).reduce(0, Integer::sum); |
| | | res.add(reduce); |
| | | } |
| | |
| | | @RequestParam("invoiceUrl") String invoiceUrl){ |
| | | TOrderInvoice orderInvoice = orderInvoiceService.getById(id); |
| | | orderInvoice.setInvoiceUrl(invoiceUrl); |
| | | orderInvoice.setStatus(3); |
| | | orderInvoiceService.updateById(orderInvoice); |
| | | // 发送邮箱 |
| | | // 收件人电子邮箱,TODO 换成自己的收件箱 |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TChargingOrderRefund; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrderRefund; |
| | | import com.ruoyi.order.api.query.ShoppingOrderQuery; |
| | | import com.ruoyi.order.dto.*; |
| | | import com.ruoyi.order.service.TShoppingOrderRefundService; |
| | | import com.ruoyi.order.service.TShoppingOrderService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private AppCouponClient appCouponClient; |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private TShoppingOrderRefundService shoppingOrderRefundService; |
| | | /** |
| | | * 远程管理后台取消订单后退款回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/shoppingOrderWxRefund") |
| | | public void shoppingOrderWxRefund(@RequestParam("out_trade_no") String out_refund_no, |
| | | @RequestParam("out_trade_no") String refund_id, |
| | | @RequestParam("out_trade_no") String tradeState, |
| | | @RequestParam("out_trade_no") String success_time){ |
| | | if("SUCCESS".equals(tradeState)){ |
| | | TShoppingOrderRefund one = shoppingOrderRefundService.getOne(new LambdaQueryWrapper<TShoppingOrderRefund>().eq(TShoppingOrderRefund::getRefundCode, out_refund_no)); |
| | | one.setRefundSerialNumber(refund_id); |
| | | one.setRefundStatus(2); |
| | | one.setRefundTime(LocalDateTime.parse(success_time, DateTimeFormatter.ofPattern("yyyy-MM-DDTHH:mm:ss+TIMEZONE"))); |
| | | shoppingOrderRefundService.updateById(one); |
| | | TShoppingOrder byId = shoppingOrderService.getById(one.getShoppingOrderId()); |
| | | byId.setStatus(4); |
| | | shoppingOrderService.updateById(byId); |
| | | if (byId.getAppCouponId() != null) { |
| | | appCouponClient.refund(byId.getAppCouponId().toString()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/getShoppingOrderList") |
| | | @ApiOperation(value = "列表查询", tags = {"管理后台-购物订单"}) |
| | |
| | | TAppUserAddress data = appUserClient.getAddressById(byId.getAppUserAddressId()).getData(); |
| | | if (data != null) { |
| | | byId.setReceivingName(data.getName() + "-" + data.getPhone()); |
| | | byId.setReceivingAddress(data.getAddress()); |
| | | byId.setReceivingAddress(data.getProvince()+data.getCity() |
| | | +(data.getDistrict()==null?"":data.getDistrict()) |
| | | +(data.getAddress()==null?"":data.getAddress()) |
| | | +(data.getHouseNumber()==null?"":data.getHouseNumber())); |
| | | } |
| | | } |
| | | if (byId.getOrderType()==1){ |
| | |
| | | shoppingOrderService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/cancelShoppingOrder") |
| | | @ApiOperation(value = "取消订单", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult cancelShoppingOrder(String id) { |
| | |
| | | byId.setCancellationId(userid); |
| | | byId.setCancellationTime(LocalDateTime.now()); |
| | | byId.setStatus(4); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | TShoppingOrderRefund tShoppingOrderRefund = new TShoppingOrderRefund(); |
| | | tShoppingOrderRefund.setPayTime(byId.getPayTime()); |
| | | tShoppingOrderRefund.setPayCode(byId.getSerialNumber()); |
| | | tShoppingOrderRefund.setPayAmount(byId.getPaymentAmount()); |
| | | tShoppingOrderRefund.setPayType(1); |
| | | tShoppingOrderRefund.setShoppingOrderId(byId.getId()); |
| | | tShoppingOrderRefund.setRefundAmount(byId.getPaymentAmount()); |
| | | tShoppingOrderRefund.setRefundStatus(1); |
| | | tShoppingOrderRefund.setCode("GWF" + sdf.format(new Date()) + Double.valueOf(Math.random() * 1000).intValue()); |
| | | tShoppingOrderRefund.setRefundTitle("后台取消订单"); |
| | | tShoppingOrderRefund.setRefundContent("后台取消订单"); |
| | | tShoppingOrderRefund.setRefundReason("后台取消订单"); |
| | | tShoppingOrderRefund.setRefundRemark("全额退款"); |
| | | tShoppingOrderRefund.setRefundTotalAmount(byId.getPaymentAmount()); |
| | | switch (byId.getPaymentType()) { |
| | | case 1: |
| | | // 微信 |
| | | WxPaymentRefundModel wxPaymentRefundModel = new WxPaymentRefundModel(); |
| | | wxPaymentRefundModel.setTransaction_id(byId.getSerialNumber()); |
| | | wxPaymentRefundModel.setOut_trade_no(byId.getCode()); |
| | | wxPaymentRefundModel.setOut_refund_no(OrderCodeUtil.getOrderCode("GW")); |
| | | // todo 部署到线上之后写回调地址 |
| | | // wxPaymentRefundModel.setNotify_url(""); |
| | | wxPaymentRefundModel.setOut_refund_no(OrderCodeUtil.getOrderCode("GWTK")); |
| | | wxPaymentRefundModel.setReason("后台购物订单退款"); |
| | | wxPaymentRefundModel.setNotify_url("/payment/wx/refund/notify"); |
| | | String string = byId.getPaymentAmount().multiply(new BigDecimal("100")).toString(); |
| | | if (string.contains(".")) { |
| | | string = string.substring(0, string.indexOf(".")); |
| | |
| | | int i = Integer.parseInt(string); |
| | | WxPaymentRefundModel.RefundAmount refundAmount = new WxPaymentRefundModel.RefundAmount(); |
| | | refundAmount.setTotal(i); |
| | | refundAmount.setCurrency("CNY"); |
| | | refundAmount.setRefund(i); |
| | | wxPaymentRefundModel.setAmount(refundAmount); |
| | | wxPaymentClient.refundOrderR(wxPaymentRefundModel); |
| | | R<String> stringR = wxPaymentClient.refundOrderR(wxPaymentRefundModel); |
| | | if(200 == stringR.getCode()){ |
| | | shoppingOrderRefundService.save(tShoppingOrderRefund); |
| | | } |
| | | break; |
| | | case 2: |
| | | // 支付宝 |
| | | RefundReq refundReq = new RefundReq(); |
| | | refundReq.setOutTradeNo(byId.getSerialNumber()); |
| | | String gw = OrderCodeUtil.getOrderCode("GW"); |
| | | String gw = OrderCodeUtil.getOrderCode("GWF"); |
| | | refundReq.setOutRequestNo(gw); |
| | | refundReq.setRefundAmount(byId.getPaymentAmount().toString()); |
| | | refundReq.setRefundReason("后台退款"); |
| | | refundReq.setRefundReason("后台购物订单退款"); |
| | | RefundResp data = aliPaymentClient.refund(refundReq).getData(); |
| | | if (data != null) { |
| | | // 退款成功 回退优惠券 |
| | | // byId.setStatus(4); |
| | | byId.setStatus(4); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | TShoppingOrderRefund one = shoppingOrderRefundService.getOne(new LambdaQueryWrapper<TShoppingOrderRefund>().eq(TShoppingOrderRefund::getRefundCode, data.getOutTradeNo())); |
| | | one.setRefundSerialNumber(data.getTradeNo()); |
| | | one.setRefundStatus(2); |
| | | one.setRefundTime(LocalDateTime.parse(sdf1.format(new Date()), DateTimeFormatter.ofPattern("yyyy-MM-DDTHH:mm:ss+TIMEZONE"))); |
| | | shoppingOrderRefundService.updateById(one); |
| | | if (byId.getAppCouponId() != null) { |
| | | // 退款成功 回退优惠券 |
| | | appCouponClient.refund(byId.getAppCouponId().toString()); |
| | | byId.setRefundCode(gw); |
| | | byId.setRefundAmount(byId.getPaymentAmount()); |
| | | byId.setRefundStatus(2); |
| | | byId.setRefundSerialNumber(data.getTradeNo()); |
| | | } |
| | | byId.setRefundCode(gw); |
| | | byId.setRefundAmount(byId.getPaymentAmount()); |
| | | byId.setRefundStatus(2); |
| | | byId.setRefundSerialNumber(data.getTradeNo()); |
| | | shoppingOrderService.updateById(byId); |
| | | } |
| | | break; |
| | | } |
| | |
| | | public AjaxResult<Map<String, Object>> getMyShoppingOrderListNum() { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | long dfh = shoppingOrderService.count(new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0) |
| | | .eq(TShoppingOrder::getStatus, 1).eq(TShoppingOrder::getAppUserId, userId)); |
| | | .eq(TShoppingOrder::getStatus, 1).eq(TShoppingOrder::getAppUserId, userId).eq(TShoppingOrder::getPaymentStatus, 2)); |
| | | long dsh = shoppingOrderService.count(new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0) |
| | | .eq(TShoppingOrder::getStatus, 2).eq(TShoppingOrder::getAppUserId, userId)); |
| | | .eq(TShoppingOrder::getStatus, 2).eq(TShoppingOrder::getAppUserId, userId).eq(TShoppingOrder::getPaymentStatus, 2)); |
| | | long ywc = shoppingOrderService.count(new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0) |
| | | .eq(TShoppingOrder::getStatus, 3).eq(TShoppingOrder::getAppUserId, userId)); |
| | | .eq(TShoppingOrder::getStatus, 3).eq(TShoppingOrder::getAppUserId, userId).eq(TShoppingOrder::getPaymentStatus, 2)); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("dfh", dfh); |
| | | map.put("dsh", dsh); |
| | |
| | | return AjaxResult.error("订单已取消,不允许操作。"); |
| | | } |
| | | shoppingOrder.setStatus(3); |
| | | shoppingOrder.setReceivingTime(LocalDateTime.now()); |
| | | shoppingOrderService.updateById(shoppingOrder); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | * 商城订单取消微信退款回调 |
| | | */ |
| | | @PostMapping("/cancelShoppingOrderWxRefund") |
| | | public void cancelShoppingOrderWxRefund(HttpServletRequest request) { |
| | | // WxRefundNotifyResp data = wxPaymentClient.refundNotify(request).getData(); |
| | | // if (null != data) { |
| | | // String out_refund_no = data.getOut_refund_no(); |
| | | // String refund_id = data.getRefund_id(); |
| | | // String tradeState = data.getTradeState(); |
| | | // String success_time = data.getSuccess_time(); |
| | | // shoppingOrderService.cancelShoppingOrderWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | // } |
| | | public void cancelShoppingOrderWxRefund(@RequestParam("out_refund_no") String out_refund_no, |
| | | @RequestParam("refund_id") String refund_id, |
| | | @RequestParam("tradeState") String tradeState, |
| | | @RequestParam("success_time") String success_time) { |
| | | shoppingOrderService.cancelShoppingOrderWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | } |
| | | |
| | | |
| | |
| | | @PostMapping("/addVipOrder") |
| | | @ApiOperation(value = "添加会员订单", tags = {"管理后台-会员订单"}) |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder dto) { |
| | | List<TVipOrder> list = vipOrderService.lambdaQuery().eq(TVipOrder::getCode, dto.getCode()).list(); |
| | | if (!list.isEmpty())return R.fail("订单编号已存在"); |
| | | if (dto.getId()!=null){ |
| | | List<TVipOrder> list = vipOrderService.lambdaQuery().eq(TVipOrder::getCode, dto.getCode()) |
| | | .ne(TVipOrder::getId, dto.getId()).list(); |
| | | if (!list.isEmpty())return R.fail("订单编号已存在"); |
| | | }else{ |
| | | List<TVipOrder> list = vipOrderService.lambdaQuery().eq(TVipOrder::getCode, dto.getCode()).list(); |
| | | if (!list.isEmpty())return R.fail("订单编号已存在"); |
| | | } |
| | | vipOrderService.saveOrUpdate(dto); |
| | | return R.ok(dto.getId()); |
| | | } |
| | |
| | | |
| | | @Resource |
| | | private AppUserTagClient appUserTagClient; |
| | | |
| | | @Resource |
| | | private SecurityDetectionClient securityDetectionClient; |
| | | |
| | | //计数器 |
| | | private Map<String, Integer> counter_map = new HashMap<>(); |
| | |
| | | //执行5分钟的定时任务检测 |
| | | ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); |
| | | scheduler.scheduleAtFixedRate(()->{ |
| | | //获取安全校验 |
| | | SecurityDetection securityDetection = securityDetectionClient.getSecurityDetection(chargingOrder.getCode()).getData(); |
| | | if(null != securityDetection){ |
| | | PreChargeCheck preChargeCheck1 = redisService.getCacheObject("AQJC_" + chargingOrder.getChargingGunId()); |
| | | if(null != preChargeCheck1){ |
| | | preChargeCheck1.setElectronicLockLock(preChargeCheck1.getElectronicLockLock()); |
| | | preChargeCheck1.setInsulationTesting(true); |
| | | preChargeCheck1.setSecureConnectionDetection(preChargeCheck1.getSecureConnectionDetection()); |
| | | preChargeCheck1.setStartupSuccess(1); |
| | | redisService.setCacheObject("AQJC_" + chargingOrder.getChargingGunId(), preChargeCheck1); |
| | | } |
| | | } |
| | | |
| | | List<PlatformStartChargingReply> data = platformStartChargingReplyClient.getPlatformStartChargingReply(code).getData(); |
| | | System.err.println("-------------------开始检查调起充电结果-------------------"); |
| | | System.err.println(data.toString()); |
| | |
| | | Integer failure_cause = platformStartChargingReply.getFailure_cause(); |
| | | Integer counter = counter_map.get(code); |
| | | PreChargeCheck preChargeCheck1 = redisService.getCacheObject(key); |
| | | //状态为5的时候,硬件会间隔60秒后再次检测,依然未插枪,则不启动充电 |
| | | //因这里是间隔5秒执行检测,所以累计次数在30次以上 |
| | | if(failure_cause == 5 && (null == counter || counter < 35)){ |
| | | counter++; |
| | | //5分钟内还未插枪则取消充电,退回金额。 |
| | | if(failure_cause == 5 && (null == counter || counter < 300)){ |
| | | counter = (null == counter ? 0 : counter) + 1; |
| | | counter_map.put(code, counter); |
| | | //启动失败 |
| | | preChargeCheck1.setStartupSuccess(3); |
| | |
| | | redisService.setCacheObject(key, preChargeCheck1); |
| | | return; |
| | | } |
| | | |
| | | //清除计时器中的无效数据 |
| | | counter_map.remove(code); |
| | | //开始处理退款 |
| | | TChargingOrder order = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, code)); |
| | | if(0 == startup_result){ |
| | | //启动失败 |
| | |
| | | order.setStatus(-1); |
| | | order.setEndMode(0); |
| | | }else{ |
| | | //启动成功 |
| | | preChargeCheck1.setStartupSuccess(2); |
| | | order.setStatus(3); |
| | | order.setStartTime(LocalDateTime.now()); |
| | |
| | | redisService.setCacheObject(key, preChargeCheck1); |
| | | //提前结束定时任务 |
| | | scheduler.shutdown(); |
| | | }else{ |
| | | log.error("未上传开启充电结果........"); |
| | | } |
| | | }, 5, 300, TimeUnit.SECONDS); |
| | | }, 5, 1, TimeUnit.SECONDS); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | throw new RuntimeException(failure_cause); |
| | | } |
| | | |
| | | // 将枪状态重置为空闲 |
| | | chargingGun.setStatus(2); |
| | | chargingGunClient.updateChargingGunById(chargingGun); |
| | | //计算费用,处理退款 |
| | | endCharge(chargingOrder); |
| | | break; |
| | |
| | | for (ChargingOrderVO chargingOrderVO : list) { |
| | | TChargingGun data3 = chargingGunClient.getChargingGunById(chargingOrderVO.getChargingGunId()).getData(); |
| | | TChargingPile data2 = chargingPileClient.getChargingPileById(chargingOrderVO.getChargingPileId()).getData(); |
| | | if (chargingOrderVO.getSiteId()!=null){ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(chargingOrderVO.getSiteId()); |
| | | List<Site> data = siteClient.getSiteByIds(integers).getData(); |
| | | if (!data.isEmpty())chargingOrderVO.setSiteName(data.get(0).getName()); |
| | | } |
| | | if (data2!=null && data3!=null){ |
| | | chargingOrderVO.setTerminalName(data2.getName()+"-"+data3.getName()); |
| | | |
| | |
| | | // 单个订单累计服务费 |
| | | BigDecimal serviceMoney1 = new BigDecimal("0"); |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderVO.getCode()).getData(); |
| | | chargingOrderVO.setChargingSecond(data5.getTime_remaining()*60L); |
| | | if (data5!=null){ |
| | | chargingOrderVO.setChargingSecond(data5.getTime_remaining()*60L); |
| | | } |
| | | // 总收入 |
| | | if (chargingOrderVO.getRefundStatus() !=null && chargingOrderVO.getRefundStatus() == 2){ |
| | | income = income.add(chargingOrderVO.getPaymentAmount().subtract(chargingOrderVO.getRefundAmount())); |
| | |
| | | @Override |
| | | public List<TEvaluationTagVO> getTagCount() { |
| | | // 查询标签列表 |
| | | R<List<TEvaluationTagVO>> r = evaluationTagClient.getTagList(null); |
| | | R<List<TEvaluationTagVO>> r = evaluationTagClient.getList(); |
| | | List<TEvaluationTagVO> tagList = r.getData(); |
| | | List<Integer> tagIds = tagList.stream().map(TEvaluationTagVO::getId).collect(Collectors.toList()); |
| | | // 统计标签使用数量 |
| | |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | String code = Double.valueOf(Math.random() * 1000).intValue() + sdf.format(new Date()); |
| | | //获取开票类型 |
| | | TInvoiceType invoiceType = invoiceTypeClient.getInvoiceType(addOrderInvoice.getInvoiceTypeId()).getData(); |
| | | addOrderInvoice.setInvoicingCompany(invoiceType.getInvoicingCompany()); |
| | | addOrderInvoice.setInvoiceType(invoiceType.getName()); |
| | | addOrderInvoice.setInvoiceMaterial(2); |
| | | addOrderInvoice.setInvoicingMethod(invoiceType.getInvoicingMethod()); |
| | | addOrderInvoice.setAppUserId(userId); |
| | | addOrderInvoice.setCode(code); |
| | | addOrderInvoice.setStatus(1); |
| | | addOrderInvoice.setCreateTime(LocalDateTime.now()); |
| | | this.save(addOrderInvoice); |
| | | //获取开票类型 |
| | | TInvoiceType invoiceType = invoiceTypeClient.getInvoiceType(addOrderInvoice.getInvoiceTypeId()).getData(); |
| | | for (Long orderId : orderIds) { |
| | | List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.list(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>() |
| | | .eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId)); |
| | |
| | | List<TOrderInvoiceVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | for (TOrderInvoiceVO tOrderInvoiceVO : list) { |
| | | tOrderInvoiceVO.setUid(tOrderInvoiceVO.getId().toString()); |
| | | List<Long> collect = orderInvoiceDetailService.lambdaQuery().eq(TOrderInvoiceDetail::getOrderInvoiceId, tOrderInvoiceVO.getId()) |
| | | .eq(TOrderInvoiceDetail::getOrderType, 1).list().stream() |
| | | List<Long> collect = orderInvoiceDetailService.lambdaQuery().eq(TOrderInvoiceDetail::getOrderInvoiceId, tOrderInvoiceVO.getId()).list().stream() |
| | | .map(TOrderInvoiceDetail::getOrderId).collect(Collectors.toList()); |
| | | // 将其全部转化为String |
| | | tOrderInvoiceVO.setIds(collect.stream().map(String::valueOf).collect(Collectors.toList())); |
| | | } |
| | | // 查询这个开票的订单ids |
| | | |
| | | List<Long> ids = list.stream().map(TOrderInvoiceVO::getId).collect(Collectors.toList()); |
| | | if (!list.isEmpty()){ |
| | | List<Long> ids = list.stream().map(TOrderInvoiceVO::getId).collect(Collectors.toList()); |
| | | |
| | | List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() |
| | | .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); |
| | | List<TOrderInvoiceDetail> orderInvoiceDetailList = orderInvoiceDetailService.list(new LambdaQueryWrapper<TOrderInvoiceDetail>() |
| | | .in(TOrderInvoiceDetail::getOrderInvoiceId, ids)); |
| | | |
| | | List<TAppUser> finalTAppUsers = tAppUsers; |
| | | list.forEach(e->{ |
| | | e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); |
| | | e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); |
| | | e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | if (e.getBillingUserId()!=null){ |
| | | e.setUserPhone(finalTAppUsers.stream().filter(t->t.getId()!=null).filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | } |
| | | }); |
| | | List<TAppUser> finalTAppUsers = tAppUsers; |
| | | list.forEach(e->{ |
| | | if (e.getOrderType()!=null&&e.getOrderType()==1){ |
| | | e.setServiceTariff(orderInvoiceDetailList.get(0).getServiceTariff()); |
| | | }else{ |
| | | e.setServiceTariff(new BigDecimal("0")); |
| | | } |
| | | e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); |
| | | e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | if (e.getBillingUserId()!=null){ |
| | | e.setUserPhone(finalTAppUsers.stream().filter(t->t.getId()!=null).filter(m->m.getId().equals(Long.parseLong(e.getBillingUserId().toString()))).findFirst().get().getPhone()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | |
| | | public Map<String, Object> getMyShoppingOrderList(GetMyShoppingOrderList query) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | LambdaQueryWrapper<TShoppingOrder> wrapper = new LambdaQueryWrapper<TShoppingOrder>().eq(TShoppingOrder::getDelFlag, 0) |
| | | .eq(TShoppingOrder::getAppUserId, userId); |
| | | .eq(TShoppingOrder::getAppUserId, userId).eq(TShoppingOrder::getPaymentStatus, 2); |
| | | if(query.getStatus() != 0){ |
| | | wrapper.eq(TShoppingOrder::getStatus, query.getStatus()); |
| | | } |
| | |
| | | TAppUserAddress userAddress = appUserAddressClient.getAppUserAddressById(shoppingOrder.getAppUserAddressId()).getData(); |
| | | info.setConsignee(userAddress.getName()); |
| | | info.setPhone(userAddress.getPhone()); |
| | | info.setAddress(userAddress.getAddress()); |
| | | info.setAddress(userAddress.getProvince() + userAddress.getCity() + userAddress.getDistrict() + userAddress.getAddress()); |
| | | info.setExpressCompany(shoppingOrder.getExpressCompany()); |
| | | info.setExpressNumber(shoppingOrder.getExpressNumber()); |
| | | String name = ""; |
| | |
| | | shoppingOrderRefund.setRefundRemark("全额退款"); |
| | | shoppingOrderRefund.setRefundTotalAmount(refundAmount.add(bigDecimal)); |
| | | shoppingOrderRefund.setPayAmount(shoppingOrder.getPaymentAmount()); |
| | | |
| | | shoppingOrder.setCancellationTime(LocalDateTime.now()); |
| | | shoppingOrder.setCancellationId(shoppingOrder.getAppUserId()); |
| | | if(1 == paymentType){ |
| | | WxPaymentRefundModel model = new WxPaymentRefundModel(); |
| | | model.setOut_trade_no(shoppingOrder.getCode()); |
| | |
| | | model.setAmount(amount); |
| | | R<String> orderR = wxPaymentClient.refundOrderR(model); |
| | | if(200 == orderR.getCode()){ |
| | | this.updateById(shoppingOrder); |
| | | shoppingOrderRefundService.save(shoppingOrderRefund); |
| | | } |
| | | } |
| | |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | this.updateById(shoppingOrder); |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | AjaxResult success = cancelShoppingOrderWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date())); |
| | | if(success.isSuccess()){ |
| | | shoppingOrderRefundService.save(shoppingOrderRefund); |
| | | //商品 |
| | | if(shoppingOrder.getOrderType() == 1){ |
| | | //redis锁 和支付使用同一个锁 |
| | | RedisLock redisLock = new RedisLock(redisTemplate, "SHOPPING_GOODS_LOCK", 5, 30000); |
| | | try { |
| | | redisLock.lock(); |
| | | TGoods goods = goodsClient.getGoodsById(shoppingOrder.getGoodsId()).getData(); |
| | | Integer inventory = goods.getInventory(); |
| | | if(-1 != inventory){ |
| | | goods.setInventory(inventory + shoppingOrder.getPurchaseQuantity()); |
| | | goodsClient.updateGoods(goods); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | }finally { |
| | | //解锁 |
| | | redisLock.unlock(); |
| | | } |
| | | } |
| | | //优惠券 |
| | | if(shoppingOrder.getOrderType() == 2){ |
| | | //redis锁 和支付使用同一个锁 |
| | | RedisLock redisLock = new RedisLock(redisTemplate, "SHOPPING_COUPON_LOCK", 5, 30000); |
| | | try { |
| | | redisLock.lock(); |
| | | TCoupon coupon = couponClient.getCouponById1(shoppingOrder.getCouponId()).getData(); |
| | | Integer inventory = coupon.getInventoryQuantity(); |
| | | if(-1 != inventory){ |
| | | coupon.setInventoryQuantity(inventory + shoppingOrder.getPurchaseQuantity()); |
| | | couponClient.updateCoupon(coupon); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | }finally { |
| | | //解锁 |
| | | redisLock.unlock(); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | |
| | | shoppingOrderRefundService.updateById(one); |
| | | //判断是否需要回退库存 |
| | | TShoppingOrder shoppingOrder = this.getById(one.getShoppingOrderId()); |
| | | shoppingOrder.setStatus(4); |
| | | shoppingOrder.setRefundCode(one.getRefundSerialNumber()); |
| | | shoppingOrder.setRefundAmount(one.getRefundAmount()); |
| | | shoppingOrder.setRefundStatus(2); |
| | | shoppingOrder.setRefundTime(one.getRefundTime()); |
| | | this.updateById(shoppingOrder); |
| | | |
| | | //商品 |
| | | if(shoppingOrder.getOrderType() == 1){ |
| | | //redis锁 和支付使用同一个锁 |
| | |
| | | tVipOrder.setUid(tVipOrder.getId().toString()); |
| | | tVipOrder.setUserUid(tVipOrder.getAppUserId().toString()); |
| | | TVip data = vipClient.getInfo(tVipOrder.getVipId()).getData(); |
| | | |
| | | if (data!=null){ |
| | | tVipOrder.setName(data.getName()); |
| | | } |
| | | if (StringUtils.hasLength(tVipOrder.getTitle())) |
| | | { |
| | | // 去除最后两个字符 |
| | | tVipOrder.setName(tVipOrder.getTitle().substring(0, tVipOrder.getTitle().length() - 2)); |
| | | } |
| | | TAppUser data1 = appUserClient.getUserById(tVipOrder.getAppUserId()).getData(); |
| | | if (data1!=null)tVipOrder.setUserPhone(data1.getPhone()); |
| | | } |
| | |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | username: nacos |
| | | password: nacos |
| | | ip: 192.168.110.85 |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.169:8848 |
| | |
| | | </if> |
| | | </select> |
| | | <select id="getNoInvoicedOrder" resultMap="BaseResultMap"> |
| | | select * from t_charging_order where del_flag = 0 and app_user_id = #{appUserId} |
| | | select * from t_charging_order where del_flag = 0 and status = 5 and recharge_payment_status = 2 and payment_amount is null and app_user_id = #{appUserId} |
| | | <if test="null != month and '' != month"> |
| | | and DATE_FORMAT(end_time, '%Y-%m') = #{month} |
| | | </if> |
| | |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="null != req.status"> |
| | | and t1.status = #{req.status} |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t1.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != req.couponIds and req.couponIds.size()>0 or null != req.couponIds and req.couponIds.size()>0" > |
| | | and (t1.goods_id in |
| | | <foreach collection="req.goodsIds" item="item" index="index" separator="," open="(" close=")"> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t1.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | or |
| | | </if> |
| | | |
| | | <if test="null != req.couponIds and req.couponIds.size()>0" > |
| | | and t1.coupon_id in |
| | | <foreach collection="req.couponIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | <if test="null != req.goodsIds and req.goodsIds.size()>0" > |
| | | and t1.goods_id in |
| | | <foreach collection="req.goodsIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.create_time between #{startTime1} and #{startTime2} |
| | | and (t1.create_time between #{startTime1} and #{startTime2}) |
| | | </if> |
| | | AND t1.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | order by t1.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | |
| | | <select id="getNoInvoicedOrder" resultMap="BaseResultMap"> |
| | | select * from t_shopping_order where del_flag = 0 and app_user_id = #{appUserId} |
| | | select * from t_shopping_order where del_flag = 0 and payment_status = 2 and status = 3 and app_user_id = #{appUserId} |
| | | <if test="null != month and '' != month"> |
| | | and DATE_FORMAT(create_time, '%Y-%m') = #{month} |
| | | </if> |
| | |
| | | <select id="pageList" resultType="com.ruoyi.order.api.model.TShoppingOrder"> |
| | | select t1.* |
| | | from t_shopping_order t1 |
| | | where 1=1 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="null != req.status"> |
| | | and t1.status = #{req.status} |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t1.app_user_id in |
| | |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="null != req.couponIds and req.couponIds.size()>0 or null != req.couponIds and req.couponIds.size()>0" > |
| | | and (t1.goods_id in |
| | | <foreach collection="req.goodsIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | or |
| | | <if test="null != req.couponIds and req.couponIds.size()>0" > |
| | | and t1.coupon_id in |
| | | <foreach collection="req.couponIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | <if test="null != req.goodsIds and req.goodsIds.size()>0" > |
| | | and t1.goods_id in |
| | | <foreach collection="req.goodsIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.create_time between #{startTime1} and #{startTime2} |
| | | and (t1.create_time between #{startTime1} and #{startTime2}) |
| | | </if> |
| | | and t1.payment_status = 2 |
| | | AND t1.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | |
| | | and t1.vip_id = #{req.vipId} |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.create_time between #{startTime1} and #{startTime2} |
| | | and t1.create_time between #{startTime1} and #{startTime2} |
| | | </if> |
| | | and t1.payment_status = 2 |
| | | AND t1.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | |
| | | package com.ruoyi.other.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.core.enums.status.AdvertisingStatusEnum; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.security.SecureRandom; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiOperation(tags = {"管理后台-广告管理"},value = "广告修改") |
| | | @Log(title = "【广告管理】修改广告", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | public AjaxResult updateVip(@RequestBody TAdvertising dto) { |
| | | advertisingService.updateById(dto); |
| | | if (dto.getJumpType() == 2){ |
| | | // 清空跳转地址 |
| | | advertisingService.updateById(dto); |
| | | LambdaUpdateWrapper<TAdvertising> tAdvertisingLambdaUpdateWrapper = new LambdaUpdateWrapper<>(); |
| | | tAdvertisingLambdaUpdateWrapper.eq(TAdvertising::getId,dto.getId()) |
| | | .set(TAdvertising::getJumpUrl,null); |
| | | advertisingService.update(tAdvertisingLambdaUpdateWrapper); |
| | | }else{ |
| | | advertisingService.updateById(dto); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/getInfo") |
| | |
| | | public AjaxResult<List<TAdvertising>> list(@RequestParam("position") Integer position) { |
| | | return AjaxResult.ok(advertisingService.list(Wrappers.lambdaQuery(TAdvertising.class) |
| | | .eq(TAdvertising::getStatus, AdvertisingStatusEnum.YES.getCode()) |
| | | .eq(TAdvertising::getPosition,position))); |
| | | .eq(TAdvertising::getPosition,position) |
| | | .le(TAdvertising::getStartTime, LocalDateTime.now()) |
| | | .ge(TAdvertising::getEndTime,LocalDateTime.now()))); |
| | | } |
| | | } |
| | | |
| | |
| | | public R<List<TEvaluationTagVO>> getTagList(@RequestParam("type") Integer type) { |
| | | return R.ok(evaluationTagService.getTagList(type)); |
| | | } |
| | | |
| | | @GetMapping("/getList") |
| | | public R<List<TEvaluationTagVO>> getList() { |
| | | return R.ok(evaluationTagService.getList()); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | * @return |
| | | */ |
| | | List<TEvaluationTag> pageList(PageInfo<TEvaluationTag> pageInfo, @Param("name") String name); |
| | | |
| | | /** |
| | | * 获取列表数据 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getList(); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | PageInfo<TEvaluationTag> pageList(String name, BasePage basePage); |
| | | /** |
| | | * 查询标签列表 |
| | | * @return |
| | | */ |
| | | List<TEvaluationTagVO> getList(); |
| | | |
| | | } |
| | |
| | | StringBuilder couponIds = new StringBuilder(); |
| | | for (TCoupon tCoupon : list) { |
| | | couponIds.append(tCoupon.getId()).append(","); |
| | | // 如果优惠券库存为0 那么将优惠券状态改为下架 不启用 |
| | | if (tCoupon.getInventoryQuantity()==0){ |
| | | tCoupon.setStatus(2); |
| | | this.baseMapper.updateById(tCoupon); |
| | | |
| | | } |
| | | |
| | | } |
| | | if (!list.isEmpty()){ |
| | | if (StringUtils.hasLength(couponIds)){ |
| | |
| | | List<TEvaluationTag> list = this.baseMapper.pageList(pageInfo, name); |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | @Override |
| | | public List<TEvaluationTagVO> getList() { |
| | | return this.baseMapper.getList(); |
| | | } |
| | | } |
| | |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | username: nacos |
| | | password: nacos |
| | | ip: 192.168.110.85 |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.169:8848 |
| | |
| | | </if> |
| | | order by create_time desc |
| | | </select> |
| | | <select id="getList" resultType="com.ruoyi.other.api.vo.TEvaluationTagVO"> |
| | | select <include refid="Base_Column_List"></include> |
| | | from t_evaluation_tag where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </select> |
| | | </mapper> |
| | |
| | | AND inventory = 0 |
| | | </if> |
| | | <if test="req.otherState != null and req.otherState ==3"> |
| | | AND status = #{req.status} |
| | | AND status = 2 |
| | | </if> |
| | | AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </where> |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.feignClient.ShoppingOrderClient; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import com.ruoyi.payment.api.vo.WxRefundNotifyResp; |
| | | import com.ruoyi.payment.wx.enums.RefundEnum; |
| | |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | @Resource |
| | | private ShoppingOrderClient shoppingOrderClient; |
| | | |
| | | |
| | | |
| | |
| | | if (tradeState.equals(RefundEnum.SUCCESS.name())) { |
| | | String substring = out_refund_no.substring(0, 3); |
| | | switch (substring){ |
| | | //购物订单 |
| | | //充电订单 |
| | | case "CDF": |
| | | chargingOrderClient.chargingOrderStartupFailureWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | System.err.println("----充电启动失败退款回调通知"); |
| | | break; |
| | | case "GDF": |
| | | shoppingOrderClient.cancelShoppingOrderWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | System.err.println("----商城订单取消退款回调通知"); |
| | | break; |
| | | //充电订单 |
| | | case "GWF": |
| | | chargingOrderClient.shoppingOrderWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | System.err.println("----管理后台取消购物订单退款回调通知"); |
| | | break; |
| | | } |
| | | |
| | | WxRefundNotifyResp resp = new WxRefundNotifyResp(); |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | 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 |
| | | # 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 |
| | | # 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 |
| | | # 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控制台地址 |