Merge remote-tracking branch 'origin/master'
# Conflicts:
# ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TChargingPileServiceImpl.java
3个文件已删除
5个文件已添加
146个文件已修改
New file |
| | |
| | | package com.ruoyi.chargingPile.api.domain; |
| | | |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/9 15:28 |
| | | */ |
| | | public enum SiteMenu { |
| | | //站点管理 |
| | | SITE_LIST("/data/site"), |
| | | //站点计费策略 |
| | | SITE_ACCOUNTING_STRATEGY("/data/site/accounting_strategy"), |
| | | //站点编辑 |
| | | SITE_UPDATE("/data/site/update"), |
| | | //站点删除 |
| | | SITE_DELETE("/data/site/delete"), |
| | | //充电桩信息 |
| | | CHARGING_PILE("/data/charging_pile"), |
| | | //充电桩查看 |
| | | CHARGING_PILE_QUERY_INFO("/data/charging_pile/query_info"), |
| | | //充电桩编辑 |
| | | CHARGING_PILE_UPDATE("/data/charging_pile/update"), |
| | | //充电桩删除 |
| | | CHARGING_PILE_DELETE("/data/charging_pile/delete"), |
| | | //充电桩新增接口 |
| | | CHARGING_PILE_ADD_CHARGING_GUN("/data/charging_pile/add_charging_gun"), |
| | | //接口信息 |
| | | CHARGING_GUN("/data/charging_gun"), |
| | | //接口编辑 |
| | | CHARGING_GUN_UPDATE("/data/charging_gun/update"), |
| | | //接口删除 |
| | | CHARGING_GUN_DELETE("/data/charging_gun/delete"), |
| | | //接口查看费率 |
| | | CHARGING_GUN_VIEW_RATES("/data/charging_gun/view_rates"), |
| | | //接口下载二维码 |
| | | CHARGING_GUN_DOWNLOAD_QR_CODE("/data/charging_gun/download_qr_code"), |
| | | //接口查看详情 |
| | | CHARGING_GUN_QUERY_INFO("/data/charging_gun/query_info"), |
| | | //接口结束充电 |
| | | CHARGING_GUN_END_CHARGE("/data/charging_gun/end_charge"), |
| | | //停车场配置 |
| | | PARKING_LOT("/data/parking_lot"), |
| | | //停车场查看 |
| | | PARKING_LOT_QUERY_INFO("/data/parking_lot/query_info"), |
| | | //停车场编辑 |
| | | PARKING_LOT_UPDATE("/data/parking_lot/update"), |
| | | //停车场删除 |
| | | PARKING_LOT_DELETE("/data/parking_lot/delete"), |
| | | //停车场监控 |
| | | PARKING_LOT_MONITOR("/data/parking_lot/monitor"), |
| | | //停车场新增车库 |
| | | PARKING_LOT_ADD_GARAGE("/data/parking_lot/add_garage"), |
| | | //监控管理 |
| | | MONITOR("/data/monitor"), |
| | | //监控查看 |
| | | MONITOR_QUERY_INFO("/data/monitor/query_info"), |
| | | //充电桩订单 |
| | | CHARGING_PILE_ORDER("/data/charging_pile_order"), |
| | | //记录 |
| | | CHARGING_PILE_ORDER_RECORD("/data/charging_pile_order/record"), |
| | | //充电订单监控记录 |
| | | CHARGING_PILE_ORDER_MONITORING_RECORD("/data/charging_pile_order/monitoring_record"), |
| | | //详情 |
| | | CHARGING_PILE_ORDER_MONITORING_RECORD_INFO("/data/charging_pile_order/monitoring_record/info"), |
| | | //删除 |
| | | CHARGING_PILE_ORDER_MONITORING_RECORD_DEL("/data/charging_pile_order/monitoring_record/del"), |
| | | //订单申诉 |
| | | ORDER_APPEAL("/data/order_appeal"), |
| | | //查看 |
| | | ORDER_APPEAL_VIEW("/data/order_appeal/view"), |
| | | //处理 |
| | | ORDER_APPEAL_HANDLE("/data/order_appeal/handle"), |
| | | //停车记录 |
| | | PARKING_RECORD("/data/parking_record"), |
| | | //查看 |
| | | PARKING_RECORD_VIEW("/data/parking_record/view"), |
| | | //已出场 |
| | | PARKING_RECORD_EXIT_PARKING_LOT("/data/parking_record/exit_parking_lot"), |
| | | //充电评价 |
| | | CHARGE_EVALUATION("/data/charge_evaluation"), |
| | | //回复 |
| | | CHARGE_EVALUATION_ANSWER("/data/charge_evaluation/answer"), |
| | | //删除 |
| | | CHARGE_EVALUATION_DEL("/data/charge_evaluation/del"), |
| | | //充电时段统计 |
| | | CHARGING_PERIOD_STATISTICS("/data/charging_period_statistics"), |
| | | //订单详情 |
| | | CHARGING_PERIOD_STATISTICS_ORDER_INFO("/data/charging_period_statistics/order_info"), |
| | | //充电曲线 |
| | | CHARGING_PERIOD_STATISTICS_CHARGING_CURVE("/data/charging_period_statistics/charging_curve"), |
| | | //充电算账单 |
| | | CHARGE_BILL_ORDER("/data/charge_bill_order"), |
| | | //下载 |
| | | CHARGE_BILL_ORDER_DOWNLOAD("/data/charge_bill_order/download"), |
| | | //停车缴费订单 |
| | | PARKING_PAYMENT_ORDER("/data/parking_payment_order"), |
| | | //账户结算账单 |
| | | ACCOUNT_SETTLEMENT("/data/account_settlement"), |
| | | //下载 |
| | | ACCOUNT_SETTLEMENT_DOWNLOAD("/data/account_settlement/download"), |
| | | //结算汇总表 |
| | | SETTLEMENT_SUMMARY("/data/settlement_summary"), |
| | | //结算表记录 |
| | | BALANCE_SHEET_RECORD("/data/balance_sheet_record"), |
| | | //下载 |
| | | BALANCE_SHEET_RECORD_DOWNLOAD("/data/balance_sheet_record/download"), |
| | | //删除 |
| | | BALANCE_SHEET_RECORD_DEL("/data/balance_sheet_record/del"), |
| | | //生成结算表 |
| | | GENERATE_STATEMENT("/data/generate_statement"), |
| | | //充电设施监控 |
| | | CHARGING_FACILITY_MONITORING("/data/charging_facility_monitoring"), |
| | | //故障信息列表 |
| | | FAULT_INFORMATION_LIST("/data/fault_information_list"), |
| | | //删除 |
| | | FAULT_INFORMATION_LIST_DEL("/data/fault_information_list/del"), |
| | | //报修记录 |
| | | REPAIR_RECORD("/data/repair_record"), |
| | | //删除 |
| | | REPAIR_RECORD_DEL("/data/repair_record/del"), |
| | | //电站分布 |
| | | POWER_STATION_DISTRIBUTION("/data/power_station_distribution"), |
| | | //充电运营分析 |
| | | CHARGING_OPERATION_ANALYSIS("/data/charging_operation_analysis"), |
| | | //充电用户分析 |
| | | CHARGING_USER_ANALYSIS("/data/charging_user_analysis"), |
| | | //设备运营分析 |
| | | PLANT_OPERATION_ANALYSIS("/data/plant_operation_analysis"), |
| | | //车场运营分析 |
| | | PARKING_OPERATION_ANALYSIS("/data/parking_operation_analysis") |
| | | ; |
| | | private String value; |
| | | |
| | | |
| | | SiteMenu(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public String getValue() { |
| | | return value; |
| | | } |
| | | |
| | | public void setValue(String value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | public static SiteMenu getSiteMenu(String v){ |
| | | SiteMenu siteMenu = Arrays.stream(SiteMenu.values()).filter(s -> s.getValue().equals(v)).findFirst().get(); |
| | | return siteMenu; |
| | | } |
| | | } |
| | |
| | | public R<TParkingLot> getParkingLotByAppKey(String appKey) { |
| | | return R.fail("根据停车场标识查询失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<Integer> getSiteIdByOrderId(Long id) { |
| | | return null; |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | |
| | |
| | | public R<Set<Integer>> authSite(Integer partnerId, String siteMenu) { |
| | | return R.fail("获取合作商授权的站点数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean authMenu(Integer partnerId, Integer siteId, String siteMenu) { |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Boolean>> getChargingBillMenu(Integer partnerId, Integer siteId) { |
| | | return R.fail("获取合作商授权的充电算帐单按钮权限失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Boolean>> getChargingOrderMenu(Integer partnerId, Integer siteId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Boolean>> getChargingListMenu(Integer partnerId, Integer siteId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Boolean>> getSettlementListMenu(Integer partnerId, Integer siteId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Boolean>> getAccountMenu(Integer partnerId, Integer siteId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Boolean>> managePageListMenu(Integer partnerId, Integer siteId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Boolean>> parkingRecordListMenu(Integer partnerId, Integer siteId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Boolean>> watchChargingOrder(Integer partnerId, Integer siteId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Boolean>> chargeEvaluation(Integer partnerId, Integer siteId) { |
| | | return null; |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | */ |
| | | @PostMapping(value = "/t-parking-lot/getParkingLotByAppKey") |
| | | R<TParkingLot> getParkingLotByAppKey(@RequestParam("appKey") String appKey); |
| | | @PostMapping(value = "/t-parking-lot/getSiteIdByOrderId") |
| | | R<Integer> getSiteIdByOrderId(@RequestParam("id") Long id); |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @PostMapping("/partner/authSite/{partnerId}") |
| | | R<Set<Integer>> authSite(@PathVariable("partnerId") Integer partnerId, @RequestParam("siteMenu") String siteMenu); |
| | | |
| | | /** |
| | | * 判断合作商权限 |
| | | * @param partnerId |
| | | * @param siteId |
| | | * @param siteMenu |
| | | * @return |
| | | */ |
| | | @PostMapping("/partner/authMenu/{partnerId}") |
| | | Boolean authMenu(@PathVariable("partnerId") Integer partnerId, @RequestParam("siteId") Integer siteId, @RequestParam("siteMenu") String siteMenu); |
| | | @PostMapping("/partner/getChargingBillMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getChargingBillMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId); |
| | | @PostMapping("/partner/getChargingOrderMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getChargingOrderMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId); |
| | | @PostMapping("/partner/getChargingListMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getChargingListMenu(@PathVariable("partnerId")Integer partnerId, @PathVariable("siteId") Integer siteId); |
| | | @PostMapping("/partner/getSettlementListMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getSettlementListMenu(@PathVariable("partnerId")Integer partnerId, @PathVariable("siteId") Integer siteId); |
| | | @PostMapping("/partner/getAccountMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getAccountMenu(@PathVariable("partnerId")Integer partnerId, @PathVariable("siteId") Integer siteId); |
| | | @PostMapping("/partner/managePageListMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> managePageListMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId); |
| | | @PostMapping("/partner/parkingRecordListMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> parkingRecordListMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId); |
| | | @PostMapping("/partner/watchChargingOrder/{partnerId}/{siteId}") |
| | | R<List<Boolean>> watchChargingOrder(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId); |
| | | @PostMapping("/partner/chargeEvaluation/{partnerId}/{siteId}") |
| | | R<List<Boolean>> chargeEvaluation(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId); |
| | | } |
| | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("end_time") |
| | | private LocalDateTime endTime; |
| | | @ApiModelProperty(value = "删除权限") |
| | | @TableField(exist = false) |
| | | private boolean authDelete = true; |
| | | |
| | | } |
| | |
| | | |
| | | @TableField(exist = false) |
| | | private String parkName; |
| | | @ApiModelProperty(value = "查看按钮权限 ") |
| | | @TableField(exist = false) |
| | | |
| | | private Boolean authInfo = true; |
| | | @ApiModelProperty(value = "已出场按钮权限 ") |
| | | @TableField(exist = false) |
| | | |
| | | private Boolean authOut = true; |
| | | |
| | | } |
| | |
| | | @DateTimeFormat(pattern = "yyyy-MM-ddTHH:mm:ss") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime repairTime; |
| | | @ApiModelProperty(value = "删除权限") |
| | | @TableField(exist = false) |
| | | private boolean authDelete = true; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "停车场id集合 前端忽略") |
| | | private List<Integer> lotIds; |
| | | @ApiModelProperty(value = "站点id集合 前端忽略") |
| | | private List<Integer> siteIds; |
| | | |
| | | } |
| | |
| | | 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 com.ruoyi.integration.api.vo.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | public R<DeleteDeviceResp> deleteDevice(String deviceId) { |
| | | return R.fail("删除设备失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<ShowDeviceResp> showDeviceRequest(String deviceId) { |
| | | return R.fail("查询设备失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | 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.ShowDeviceResp; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | */ |
| | | @PostMapping("/iotInterface/deleteDevice") |
| | | R<DeleteDeviceResp> deleteDevice(@RequestParam("deviceId") String deviceId); |
| | | |
| | | /** |
| | | * 查询设备 |
| | | * @param deviceId |
| | | * @return |
| | | */ |
| | | @PostMapping("/iotInterface/showDeviceRequest") |
| | | R<ShowDeviceResp> showDeviceRequest(@RequestParam("deviceId") String deviceId); |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "时段数") |
| | | private Integer count; |
| | | |
| | | @ApiModelProperty(value = "查看按钮权限 ") |
| | | private Boolean authInfo = true; |
| | | @ApiModelProperty(value = "删除按钮权限 ") |
| | | private Boolean authDelete = true; |
| | | |
| | | |
| | | } |
| | |
| | | @Document(collection = "confirm_transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ConfirmTransactionRecord extends BaseModel { |
| | | private String transaction_serial_number;// 桩编码 |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private Integer confirm_result;// 确认结果(0:上传成功,1:非法账单) |
| | | |
| | | } |
| | |
| | | private Integer status; //状态(0=未知,1=等待中/已插枪,2=启动中,3=充电中,4=停止中,5=已结束)" |
| | | private LocalDateTime startTime; //充电开始时间 |
| | | private LocalDateTime endTime; //充电结束时间 |
| | | @ApiModelProperty(value = "查看按钮权限 ") |
| | | private Boolean authInfo = true; |
| | | @ApiModelProperty(value = "删除按钮权限 ") |
| | | private Boolean authDelete = true; |
| | | |
| | | } |
| | | |
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/12/31 16:19 |
| | | */ |
| | | @Data |
| | | public class ShowDeviceResp { |
| | | @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; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<SettlementTotalVO> settlementTotalR(String time) { |
| | | public R<SettlementTotalVO> settlementTotalR(String time,Long userId) { |
| | | return R.fail("查询结算汇总表导出列表失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void chargingOrderALICallback(String out_trade_no, String transaction_id, String attach) { |
| | | log.error("充电支付成功回调通知失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public void chargingOrderStartupFailureWxRefund(String out_refund_no, String refund_id, String tradeState, String success_time) { |
| | | log.error("远程启动失败后退款通知失败:" + throwable.getMessage()); |
| | | } |
| | |
| | | @GetMapping(value = "/financial/settlement/downloadSettlement/{uid}") |
| | | public R<TSettlementConfirm> downloadSettlement(@PathVariable("uid") String uid); |
| | | |
| | | @GetMapping(value = "/financial/settlement/settlementTotalR/{time}") |
| | | public R<SettlementTotalVO> settlementTotalR(@PathVariable("time")String time); |
| | | @GetMapping(value = "/financial/settlement/settlementTotalR/{time}/{userId}") |
| | | public R<SettlementTotalVO> settlementTotalR(@PathVariable("time")String time,@PathVariable("userId")Long userId); |
| | | |
| | | /** |
| | | * 修改充电订单 |
| | |
| | | |
| | | |
| | | /** |
| | | * 充电支付成功回调通知 |
| | | * @param out_trade_no |
| | | * @param transaction_id |
| | | * @param attach |
| | | */ |
| | | @PostMapping("/t-charging-order/chargingOrderALICallback") |
| | | void chargingOrderALICallback(@RequestParam("out_trade_no") String out_trade_no, |
| | | @RequestParam("transaction_id") String transaction_id, |
| | | @RequestParam("attach") String attach); |
| | | |
| | | /** |
| | | * 远程启动失败后退款回调 |
| | | * @param out_refund_no |
| | | * @param refund_id |
| | |
| | | private List<Long> userIds; |
| | | @ApiModelProperty("车辆ids 前端忽略") |
| | | private List<Long> carIds; |
| | | @ApiModelProperty("站点ids 前端忽略") |
| | | private List<Integer> siteIds; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "uid") |
| | | @TableField(exist = false) |
| | | private String uid; |
| | | @ApiModelProperty(value = "订单类型(1=充电订单,2=购物订单,3=兑换订单,4=会员订单)") |
| | | @TableField("order_type") |
| | | private Integer orderType; |
| | |
| | | @ApiModelProperty(value = "申诉反馈") |
| | | @TableField("feedback") |
| | | private String feedback; |
| | | @TableField(exist = false) |
| | | private String uid; |
| | | |
| | | @ApiModelProperty(value = "查看按钮权限 ") |
| | | @TableField(exist = false) |
| | | private Boolean authInfo = true; |
| | | @TableField(exist = false) |
| | | @ApiModelProperty(value = "处理按钮权限 ") |
| | | private Boolean authHandle = true; |
| | | @ApiModelProperty(value = "反馈人id") |
| | | @TableField("feedback_user_id") |
| | | private Integer feedbackUserId; |
| | |
| | | @TableField(exist = false) |
| | | private Integer electronicRefund; |
| | | |
| | | @ApiModelProperty(value = "下载权限") |
| | | @TableField(exist = false) |
| | | private boolean authDownLoad = true; |
| | | |
| | | @ApiModelProperty(value = "删除权限") |
| | | @TableField(exist = false) |
| | | private boolean authDelete = true; |
| | | } |
| | |
| | | private Integer orderSource; |
| | | @ApiModelProperty(value = "用户ids 前端忽略") |
| | | private List<Long> userIds; |
| | | @ApiModelProperty(value = "站点ids 前端忽略") |
| | | private List<Integer> siteIds; |
| | | } |
| | |
| | | private Integer type; |
| | | @ApiModelProperty(value = "站点ids 选择全部 不传") |
| | | private Integer siteIds; |
| | | @ApiModelProperty(value = "站点ids 选择全部 不传") |
| | | private List<Integer> siteIdss; |
| | | @ApiModelProperty(value = "合作商id ") |
| | | private Integer partnerId; |
| | | @ApiModelProperty(value = "开始时间2020-01-01 00:00:00") |
| | |
| | | |
| | | @ApiModelProperty(value = "充电订单id") |
| | | private Long chargingOrderId; |
| | | |
| | | private Long start; |
| | | private Long end; |
| | | private BigDecimal chargingCapacity; |
| | | } |
| | |
| | | private BigDecimal chargingCapacity; |
| | | @ApiModelProperty(value = "入账金额") |
| | | private BigDecimal billMoney; |
| | | @ApiModelProperty(value = "下载按钮权限 ") |
| | | private Boolean authDownLoad = true; |
| | | } |
| | |
| | | private Long id; |
| | | @ApiModelProperty(value = "订单uid") |
| | | private String uid; |
| | | @ApiModelProperty(value = "订单详情按钮权限 ") |
| | | private Boolean authInfo = true; |
| | | @ApiModelProperty(value = "充电曲线按钮权限 ") |
| | | private Boolean authCurve = true; |
| | | } |
| | |
| | | private String phone; |
| | | @ApiModelProperty(value = "uid") |
| | | private String uid; |
| | | @ApiModelProperty(value = "记录按钮权限 ") |
| | | private Boolean authRecord = true; |
| | | |
| | | |
| | | @ApiModelProperty(value = "时段数") |
| | |
| | | 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 |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/ali/payment") |
| | | R<AliPaymentResp> payment(AliPaymentReq req); |
| | | R<AliPaymentResp> payment(@RequestBody AliPaymentReq req); |
| | | |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/ali/query") |
| | | R<AliQueryOrder> query(String outTradeNo); |
| | | R<AliQueryOrder> query(@RequestParam("outTradeNo") String outTradeNo); |
| | | |
| | | /** |
| | | * 关闭订单 |
| | | * @param outTradeNo |
| | | */ |
| | | @PostMapping("/ali/close") |
| | | void close(String outTradeNo); |
| | | void close(@RequestParam("outTradeNo") String outTradeNo); |
| | | /** |
| | | * 后台退款 远程调用 |
| | | */ |
| | |
| | | * 如果请求时传递了该参数,支付宝会在异步通知时将该参数原样返回。 |
| | | */ |
| | | private String passbackParams; |
| | | /** |
| | | * 支付回调通知 |
| | | */ |
| | | private String notifyUrl; |
| | | |
| | | /** |
| | | * 初始化默认数据 |
| | |
| | | */ |
| | | private String passbackParams; |
| | | /** |
| | | * 支付回调通知 |
| | | */ |
| | | private String notifyUrl; |
| | | /** |
| | | * 初始化默认数据 |
| | | */ |
| | | public AliPaymentReq() { |
| | |
| | | */ |
| | | @ApiModelProperty("支付单号") |
| | | private String tradeNo; |
| | | /** |
| | | * 回调通知地址 |
| | | */ |
| | | @ApiModelProperty("回调通知地址") |
| | | private String notifyUrl; |
| | | private String orderId; |
| | | } |
| | |
| | | * 用户信息 |
| | | */ |
| | | private SysUser sysUser; |
| | | /** |
| | | * 用户类型(系统用户,小程序用户) |
| | | */ |
| | | private String userType; |
| | | |
| | | public String getToken() |
| | | { |
| | |
| | | { |
| | | this.sysUser = sysUser; |
| | | } |
| | | |
| | | public String getUserType() { |
| | | return userType; |
| | | } |
| | | |
| | | public void setUserType(String userType) { |
| | | this.userType = userType; |
| | | } |
| | | } |
| | |
| | | spring: |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | # 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控制台地址 |
| | |
| | | * 缓存有效期,默认720(分钟) |
| | | */ |
| | | public final static long EXPIRATION = 720; |
| | | public final static long EXPIRATION_APPLET = 7*24*60*60; |
| | | public final static long EXPIRATION_APPLET = 7 * 24 * 60; |
| | | |
| | | /** |
| | | * 缓存刷新时间,默认120(分钟) |
| | |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Data |
| | | public class ChargingPercentProvinceDto { |
| | | String provinceCode; |
| | | LocalDate date1; |
| | | LocalDate date2; |
| | | Set<Integer> siteIds; |
| | | } |
| | |
| | | private Integer orderSource; |
| | | @ApiModelProperty(value = "用户ids 前端忽略") |
| | | private List<Long> userIds; |
| | | private List<Integer> siteIds; |
| | | } |
| | |
| | | import java.util.Collection; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | import com.ruoyi.common.core.utils.JwtUtils; |
| | | import com.ruoyi.common.security.handler.GlobalExceptionHandler; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.util.PatternMatchUtils; |
| | | import com.ruoyi.common.core.context.SecurityContextHolder; |
| | | import com.ruoyi.common.core.exception.auth.NotLoginException; |
| | |
| | | */ |
| | | public class AuthLogic |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(AuthLogic.class); |
| | | /** 所有权限标识 */ |
| | | private static final String ALL_PERMISSION = "*:*:*"; |
| | | |
| | |
| | | { |
| | | throw new NotLoginException("未提供token"); |
| | | } |
| | | Claims claims = JwtUtils.parseToken(token); |
| | | String userType = JwtUtils.getUserType(claims); |
| | | LoginUser loginUser = SecurityUtils.getLoginUser(); |
| | | if (loginUser == null) |
| | | if (loginUser == null && "system".equals(userType)) |
| | | { |
| | | throw new NotLoginException("无效的token"); |
| | | } |
| | | if(loginUser == null && "applet".equals(userType)){ |
| | | loginUser = new LoginUser(); |
| | | } |
| | | loginUser.setUserType(userType); |
| | | return loginUser; |
| | | } |
| | | |
| | |
| | | public void checkPermiAnd(String... permissions) |
| | | { |
| | | Set<String> permissionList = getPermiList(); |
| | | if(null == permissionList || permissionList.size() == 0){ |
| | | return; |
| | | } |
| | | for (String permission : permissions) |
| | | { |
| | | if (!hasPermi(permissionList, permission)) |
| | |
| | | try |
| | | { |
| | | LoginUser loginUser = getLoginUser(); |
| | | if(null == loginUser.getPermissions()){ |
| | | return new HashSet<>(); |
| | | } |
| | | return loginUser.getPermissions(); |
| | | } |
| | | catch (Exception e) |
| | |
| | | </dependency> |
| | | |
| | | <!-- Swagger --> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>${swagger.fox.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | <version>${swagger.fox.version}</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>io.springfox</groupId>--> |
| | | <!-- <artifactId>springfox-swagger-ui</artifactId>--> |
| | | <!-- <version>${swagger.fox.version}</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>io.springfox</groupId>--> |
| | | <!-- <artifactId>springfox-swagger2</artifactId>--> |
| | | <!-- <version>${swagger.fox.version}</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <dependency> |
| | | <groupId>com.github.xiaoymin</groupId> |
| | | <artifactId>knife4j-micro-spring-boot-starter</artifactId> |
| | | <version>2.0.8</version> |
| | | </dependency> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>com.github.xiaoymin</groupId>--> |
| | | <!-- <artifactId>knife4j-micro-spring-boot-starter</artifactId>--> |
| | | <!-- <version>2.0.8</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- 引入Druid依赖,阿里巴巴所提供的数据源 --> |
| | | <dependency> |
| | |
| | | package com.ruoyi.gateway.config; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cloud.gateway.config.GatewayProperties; |
| | | import org.springframework.cloud.gateway.route.RouteLocator; |
| | | import org.springframework.cloud.gateway.support.NameUtils; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.reactive.config.ResourceHandlerRegistry; |
| | | import org.springframework.web.reactive.config.WebFluxConfigurer; |
| | | import springfox.documentation.swagger.web.SwaggerResource; |
| | | import springfox.documentation.swagger.web.SwaggerResourcesProvider; |
| | | |
| | | /** |
| | | * 聚合系统接口 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class SwaggerProvider implements SwaggerResourcesProvider, WebFluxConfigurer { |
| | | /** |
| | | * Swagger2默认的url后缀 |
| | | */ |
| | | public static final String SWAGGER2URL = "/v2/api-docs"; |
| | | |
| | | /** |
| | | * 网关路由 |
| | | */ |
| | | @Lazy |
| | | @Autowired |
| | | private RouteLocator routeLocator; |
| | | |
| | | @Autowired |
| | | private GatewayProperties gatewayProperties; |
| | | |
| | | /** |
| | | * 聚合其他服务接口 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SwaggerResource> get() { |
| | | List<SwaggerResource> resourceList = new ArrayList<>(); |
| | | List<String> routes = new ArrayList<>(); |
| | | // 获取网关中配置的route |
| | | routeLocator.getRoutes().subscribe(route -> routes.add(route.getId())); |
| | | gatewayProperties.getRoutes().stream() |
| | | .filter(routeDefinition -> routes |
| | | .contains(routeDefinition.getId())) |
| | | .forEach(routeDefinition -> routeDefinition.getPredicates().stream() |
| | | .filter(predicateDefinition -> "Path".equalsIgnoreCase(predicateDefinition.getName())) |
| | | .filter(predicateDefinition -> !"ruoyi-auth".equalsIgnoreCase(routeDefinition.getId())) |
| | | .forEach(predicateDefinition -> resourceList |
| | | .add(swaggerResource(routeDefinition.getId(), predicateDefinition.getArgs() |
| | | .get(NameUtils.GENERATED_NAME_PREFIX + "0").replace("/**", SWAGGER2URL))))); |
| | | return resourceList; |
| | | } |
| | | |
| | | private SwaggerResource swaggerResource(String name, String location) { |
| | | SwaggerResource swaggerResource = new SwaggerResource(); |
| | | swaggerResource.setName(name); |
| | | swaggerResource.setLocation(location); |
| | | swaggerResource.setSwaggerVersion("2.0"); |
| | | return swaggerResource; |
| | | } |
| | | |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | /** swagger-ui 地址 */ |
| | | registry.addResourceHandler("/swagger-ui/**", "*/doc.html") |
| | | .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); |
| | | } |
| | | } |
| | | //package com.ruoyi.gateway.config; |
| | | // |
| | | //import java.util.ArrayList; |
| | | //import java.util.List; |
| | | // |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.cloud.gateway.config.GatewayProperties; |
| | | //import org.springframework.cloud.gateway.route.RouteLocator; |
| | | //import org.springframework.cloud.gateway.support.NameUtils; |
| | | //import org.springframework.context.annotation.Lazy; |
| | | //import org.springframework.stereotype.Component; |
| | | //import org.springframework.web.reactive.config.ResourceHandlerRegistry; |
| | | //import org.springframework.web.reactive.config.WebFluxConfigurer; |
| | | //import springfox.documentation.swagger.web.SwaggerResource; |
| | | //import springfox.documentation.swagger.web.SwaggerResourcesProvider; |
| | | // |
| | | ///** |
| | | // * 聚合系统接口 |
| | | // * |
| | | // * @author ruoyi |
| | | // */ |
| | | //@Component |
| | | //public class SwaggerProvider implements SwaggerResourcesProvider, WebFluxConfigurer { |
| | | // /** |
| | | // * Swagger2默认的url后缀 |
| | | // */ |
| | | // public static final String SWAGGER2URL = "/v2/api-docs"; |
| | | // |
| | | // /** |
| | | // * 网关路由 |
| | | // */ |
| | | // @Lazy |
| | | // @Autowired |
| | | // private RouteLocator routeLocator; |
| | | // |
| | | // @Autowired |
| | | // private GatewayProperties gatewayProperties; |
| | | // |
| | | // /** |
| | | // * 聚合其他服务接口 |
| | | // * |
| | | // * @return |
| | | // */ |
| | | // @Override |
| | | // public List<SwaggerResource> get() { |
| | | // List<SwaggerResource> resourceList = new ArrayList<>(); |
| | | // List<String> routes = new ArrayList<>(); |
| | | // // 获取网关中配置的route |
| | | // routeLocator.getRoutes().subscribe(route -> routes.add(route.getId())); |
| | | // gatewayProperties.getRoutes().stream() |
| | | // .filter(routeDefinition -> routes |
| | | // .contains(routeDefinition.getId())) |
| | | // .forEach(routeDefinition -> routeDefinition.getPredicates().stream() |
| | | // .filter(predicateDefinition -> "Path".equalsIgnoreCase(predicateDefinition.getName())) |
| | | // .filter(predicateDefinition -> !"ruoyi-auth".equalsIgnoreCase(routeDefinition.getId())) |
| | | // .forEach(predicateDefinition -> resourceList |
| | | // .add(swaggerResource(routeDefinition.getId(), predicateDefinition.getArgs() |
| | | // .get(NameUtils.GENERATED_NAME_PREFIX + "0").replace("/**", SWAGGER2URL))))); |
| | | // return resourceList; |
| | | // } |
| | | // |
| | | // private SwaggerResource swaggerResource(String name, String location) { |
| | | // SwaggerResource swaggerResource = new SwaggerResource(); |
| | | // swaggerResource.setName(name); |
| | | // swaggerResource.setLocation(location); |
| | | // swaggerResource.setSwaggerVersion("2.0"); |
| | | // return swaggerResource; |
| | | // } |
| | | // |
| | | // @Override |
| | | // public void addResourceHandlers(ResourceHandlerRegistry registry) { |
| | | // /** swagger-ui 地址 */ |
| | | // registry.addResourceHandler("/swagger-ui/**", "*/doc.html") |
| | | // .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); |
| | | // } |
| | | //} |
| | |
| | | package com.ruoyi.gateway.handler; |
| | | |
| | | import java.util.Optional; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import reactor.core.publisher.Mono; |
| | | import springfox.documentation.swagger.web.SecurityConfiguration; |
| | | import springfox.documentation.swagger.web.SecurityConfigurationBuilder; |
| | | import springfox.documentation.swagger.web.SwaggerResourcesProvider; |
| | | import springfox.documentation.swagger.web.UiConfiguration; |
| | | import springfox.documentation.swagger.web.UiConfigurationBuilder; |
| | | |
| | | @RestController |
| | | @RequestMapping("/swagger-resources") |
| | | public class SwaggerHandler { |
| | | private final SwaggerResourcesProvider swaggerResources; |
| | | @Autowired(required = false) |
| | | private SecurityConfiguration securityConfiguration; |
| | | @Autowired(required = false) |
| | | private UiConfiguration uiConfiguration; |
| | | |
| | | @Autowired |
| | | public SwaggerHandler(SwaggerResourcesProvider swaggerResources) { |
| | | this.swaggerResources = swaggerResources; |
| | | } |
| | | |
| | | @GetMapping("/configuration/security") |
| | | public Mono<ResponseEntity<SecurityConfiguration>> securityConfiguration() { |
| | | return Mono.just(new ResponseEntity<>( |
| | | Optional.ofNullable(securityConfiguration).orElse(SecurityConfigurationBuilder.builder().build()), |
| | | HttpStatus.OK)); |
| | | } |
| | | |
| | | @GetMapping("/configuration/ui") |
| | | public Mono<ResponseEntity<UiConfiguration>> uiConfiguration() { |
| | | return Mono.just(new ResponseEntity<>( |
| | | Optional.ofNullable(uiConfiguration).orElse(UiConfigurationBuilder.builder().build()), HttpStatus.OK)); |
| | | } |
| | | |
| | | @SuppressWarnings("rawtypes") |
| | | @GetMapping("") |
| | | public Mono<ResponseEntity> swaggerResources() { |
| | | return Mono.just((new ResponseEntity<>(swaggerResources.get(), HttpStatus.OK))); |
| | | } |
| | | } |
| | | //package com.ruoyi.gateway.handler; |
| | | // |
| | | //import java.util.Optional; |
| | | // |
| | | //import org.springframework.beans.factory.annotation.Autowired; |
| | | //import org.springframework.http.HttpStatus; |
| | | //import org.springframework.http.ResponseEntity; |
| | | //import org.springframework.web.bind.annotation.GetMapping; |
| | | //import org.springframework.web.bind.annotation.RequestMapping; |
| | | //import org.springframework.web.bind.annotation.RestController; |
| | | //import reactor.core.publisher.Mono; |
| | | //import springfox.documentation.swagger.web.SecurityConfiguration; |
| | | //import springfox.documentation.swagger.web.SecurityConfigurationBuilder; |
| | | //import springfox.documentation.swagger.web.SwaggerResourcesProvider; |
| | | //import springfox.documentation.swagger.web.UiConfiguration; |
| | | //import springfox.documentation.swagger.web.UiConfigurationBuilder; |
| | | // |
| | | //@RestController |
| | | //@RequestMapping("/swagger-resources") |
| | | //public class SwaggerHandler { |
| | | // private final SwaggerResourcesProvider swaggerResources; |
| | | // @Autowired(required = false) |
| | | // private SecurityConfiguration securityConfiguration; |
| | | // @Autowired(required = false) |
| | | // private UiConfiguration uiConfiguration; |
| | | // |
| | | // @Autowired |
| | | // public SwaggerHandler(SwaggerResourcesProvider swaggerResources) { |
| | | // this.swaggerResources = swaggerResources; |
| | | // } |
| | | // |
| | | // @GetMapping("/configuration/security") |
| | | // public Mono<ResponseEntity<SecurityConfiguration>> securityConfiguration() { |
| | | // return Mono.just(new ResponseEntity<>( |
| | | // Optional.ofNullable(securityConfiguration).orElse(SecurityConfigurationBuilder.builder().build()), |
| | | // HttpStatus.OK)); |
| | | // } |
| | | // |
| | | // @GetMapping("/configuration/ui") |
| | | // public Mono<ResponseEntity<UiConfiguration>> uiConfiguration() { |
| | | // return Mono.just(new ResponseEntity<>( |
| | | // Optional.ofNullable(uiConfiguration).orElse(UiConfigurationBuilder.builder().build()), HttpStatus.OK)); |
| | | // } |
| | | // |
| | | // @SuppressWarnings("rawtypes") |
| | | // @GetMapping("") |
| | | // public Mono<ResponseEntity> swaggerResources() { |
| | | // return Mono.just((new ResponseEntity<>(swaggerResources.get(), HttpStatus.OK))); |
| | | // } |
| | | //} |
| | |
| | | allow-bean-definition-overriding: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.service.ISysLoginLogService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/entryLog"}, logical = Logical.OR) |
| | | @GetMapping("/pageList") |
| | | @ApiOperation(value = "获取登录日志列表", tags = {"管理后台-登录日志"}) |
| | | public AjaxResult<PageInfo<SysLoginLog>> pageList(String name, BasePage basePage){ |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/entryLog/add"}, logical = Logical.OR) |
| | | @PostMapping("/addLoginLog") |
| | | @ApiOperation(value = "添加登录日志", tags = {"管理后台-登录日志"}) |
| | | public AjaxResult addLoginLog(@RequestBody SysLoginLog loginLog){ |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.domain.SysMenu; |
| | | import com.ruoyi.system.domain.SysMenus; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.service.ISysMenuService; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 菜单信息 |
| | | * |
| | |
| | | /** |
| | | * 获取菜单列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/roleManagement"}, logical = Logical.OR) |
| | | @GetMapping("/list") |
| | | @ApiOperation("所有菜单列表") |
| | | public AjaxResult list() |
| | |
| | | { |
| | | return success(menuService.selectMenuById(menuId)); |
| | | } |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | /** |
| | | * 获取菜单下拉树列表 |
| | | */ |
| | | @GetMapping("/treeselect") |
| | | public AjaxResult treeselect(SysMenu menu) |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | List<SysMenu> menus = menuService.selectMenuList(menu, userId); |
| | | ArrayList<SysMenus> sysMenus = new ArrayList<>(); |
| | | for (SysMenu sysMenu : menus) { |
| | |
| | | @GetMapping(value = "/roleMenuTreeselect/{roleId}") |
| | | public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | List<SysMenu> menus = menuService.selectMenuList(userId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); |
| | |
| | | @GetMapping("getRouters") |
| | | public AjaxResult getRouters() |
| | | { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId); |
| | | return success(menuService.buildMenus(menus)); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.system.query.SysOperLogQuery; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private ISysOperLogService operLogService; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/operationLog/list"}, logical = Logical.OR) |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取操作日志列表", tags = {"管理后台-操作日志"}) |
| | | public AjaxResult<PageInfo<SysOperLog>> list(SysOperLogQuery query) { |
| | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.other.api.domain.TRoleSite; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.system.api.model.GetSysRoleByIds; |
| | |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement", "/systemUserManagement/add", "/systemUserManagement/update", "/roleManagement", "/partners", |
| | | "/partners/add", "/partners/seleete", "/partners/update"}, logical = Logical.OR) |
| | | @ApiOperation(value = "获取角色列表", tags = {"管理后台-系统用户管理"}) |
| | | @GetMapping("/list") |
| | | public AjaxResult list() { |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/roleManagement"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/listPage") |
| | | @ApiOperation(value = "获取角色列表", tags = {"管理后台-角色管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/roleManagement/add"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/roleAdd") |
| | | @ApiOperation(value = "添加角色", tags = {"管理后台-角色管理"}) |
| | |
| | | role.setCreateBy(SecurityUtils.getUsername()); |
| | | role.setCreateTime(new Date()); |
| | | roleService.insertRole(role); |
| | | |
| | | //添加站点权限 |
| | | if(null != dto.getSiteIds()){ |
| | | List<TRoleSite> roleSites = new ArrayList<>(); |
| | | for (Integer siteId : dto.getSiteIds()) { |
| | | TRoleSite roleSite = new TRoleSite(); |
| | |
| | | roleSites.add(roleSite); |
| | | } |
| | | roleSiteClient.addRoleSite(roleSites); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/roleManagement/info", "/roleManagement/update"}, logical = Logical.OR) |
| | | @GetMapping("/roleInfo") |
| | | @ApiOperation(value = "角色详情", tags = {"管理后台-角色管理"}) |
| | | public AjaxResult roleInfo(@RequestParam Long id) { |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/roleManagement/update"}, logical = Logical.OR) |
| | | @PostMapping("/roleUpdate") |
| | | @ApiOperation(value = "编辑角色", tags = {"管理后台-角色管理"}) |
| | | @GlobalTransactional(rollbackFor = Exception.class)//分布式事务 |
| | |
| | | /** |
| | | * 删除角色 |
| | | */ |
| | | @RequiresPermissions(value = {"/roleManagement/del"}, logical = Logical.OR) |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | @ApiOperation(value = "删除角色", tags = {"管理后台-角色管理"}) |
| | |
| | | /** |
| | | * 查询已分配用户角色列表 |
| | | */ |
| | | @RequiresPermissions("/roleManagement") |
| | | @GetMapping("/authUser/allocatedList") |
| | | public TableDataInfo allocatedList(SysUser user) { |
| | | startPage(); |
| | |
| | | /** |
| | | * 查询未分配用户角色列表 |
| | | */ |
| | | @RequiresPermissions("/roleManagement") |
| | | @GetMapping("/authUser/unallocatedList") |
| | | public TableDataInfo unallocatedList(SysUser user) { |
| | | startPage(); |
| | |
| | | /** |
| | | * 获取对应角色部门树列表 |
| | | */ |
| | | @RequiresPermissions("") |
| | | @GetMapping(value = "/deptTree/{roleId}") |
| | | public AjaxResult deptTree(@PathVariable("roleId") Long roleId) { |
| | | AjaxResult ajax = AjaxResult.success(); |
| | |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.other.api.domain.TUserSite; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | |
| | | /** |
| | | * 获取用户列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement", "/roleManagement/info"}, logical = Logical.OR) |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取系统用户列表", tags = {"管理后台-系统用户管理", "管理后台-角色管理"}) |
| | | public AjaxResult list(GetSysUserList getSysUserList) { |
| | |
| | | /** |
| | | * 新增用户 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/add"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.INSERT) |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "添加系统用户", tags = {"管理后台-系统用户管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement/add", "/systemUserManagement/update"}, logical = Logical.OR) |
| | | @GetMapping("/verifyUserNameRepeat/{username}") |
| | | @ApiOperation(value = "校验账号是否重复", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult verifyUserNameRepeat(@PathVariable String username){ |
| | |
| | | return success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement/update"}, logical = Logical.OR) |
| | | @GetMapping("/getRoleSiteName/{roleId}") |
| | | @ApiOperation(value = "获取角色对应的站点名称", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult<List<String>> getRoleSiteName(@PathVariable Integer roleId){ |
| | |
| | | /** |
| | | * 修改用户 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/update"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/update") |
| | | @ApiOperation(value = "编辑系统用户", tags = {"管理后台-系统用户管理"}) |
| | |
| | | user.setUpdateTime(new Date()); |
| | | userService.updateUser(user); |
| | | |
| | | //删除旧的角色数据,添加新的角色 |
| | | userRoleService.remove(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, user.getUserId())); |
| | | //添加新的角色数据 |
| | | SysUserRole userRole = new SysUserRole(); |
| | | userRole.setUserId(user.getUserId()); |
| | | userRole.setRoleId(user.getRoleId()); |
| | | userRoleService.save(userRole); |
| | | |
| | | //删除旧的站点数据后添加新的 |
| | | userSiteClient.delUserSite(user.getUserId()); |
| | | List<Integer> siteIds = user.getSiteIds(); |
| | |
| | | return success(); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/del"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | @ApiOperation(value = "删除系统用户", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | | if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { |
| | | if (ArrayUtils.contains(userIds, tokenService.getLoginUser().getUserid())) { |
| | | return error("当前用户不能删除"); |
| | | } |
| | | return toAjax(userService.deleteUserByIds(userIds)); |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement/forbidden"}, logical = Logical.OR) |
| | | @PostMapping("/shopUserStart") |
| | | @ApiOperation(value = "账号管理--禁用/启用", tags = {"管理后台-系统用户管理"}) |
| | | public AjaxResult shopUserStart(@RequestBody ShopUserStart shopUserStart) { |
| | |
| | | */ |
| | | @GetMapping("/getInfo") |
| | | public AjaxResult getInfo() { |
| | | SysUser user = userService.selectUserById(SecurityUtils.getUserId()); |
| | | SysUser user = userService.selectUserById(tokenService.getLoginUser().getUserid()); |
| | | // 角色集合 |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | |
| | | /** |
| | | * 重置密码 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/reset_passwords"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/resetPwd") |
| | | @ApiOperation(value = "重置密码", tags = {"管理后台-系统用户管理"}) |
| | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.domain.vo.TreeSelect; |
| | | import com.ruoyi.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.system.mapper.SysRoleMapper; |
| | |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 部门管理 服务实现 |
| | | * |
| | |
| | | { |
| | | @Autowired |
| | | private SysDeptMapper deptMapper; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private SysRoleMapper roleMapper; |
| | | |
| | |
| | | @Override |
| | | public void checkDeptDataScope(Long deptId) |
| | | { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) |
| | | if (!SysUser.isAdmin(tokenService.getLoginUser().getUserid())) |
| | | { |
| | | SysDept dept = new SysDept(); |
| | | dept.setDeptId(deptId); |
| | |
| | | import java.util.Set; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.domain.SysRoleDept; |
| | | import com.ruoyi.system.domain.SysRoleMenu; |
| | | import com.ruoyi.system.domain.SysUserRole; |
| | |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 角色 业务层处理 |
| | | * |
| | |
| | | public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService { |
| | | @Autowired |
| | | private SysRoleMapper roleMapper; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private SysRoleMenuMapper roleMenuMapper; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public void checkRoleDataScope(Long roleId) { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) { |
| | | if (!SysUser.isAdmin(tokenService.getLoginUser().getUserid())) { |
| | | SysRole role = new SysRole(); |
| | | role.setRoleId(roleId); |
| | | List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role); |
| | |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.query.ChangeUserQuery; |
| | |
| | | |
| | | @Resource |
| | | private ISysRoleService sysRoleService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public void checkUserAllowed(SysUser user) { |
| | | if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | if (StringUtils.isNotNull(user.getUserId()) && !userid.equals(user.getUserId()) && user.isAdmin()) { |
| | | throw new ServiceException("不允许操作超级管理员用户"); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public void checkUserDataScope(Long userId) { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) { |
| | | if (!SysUser.isAdmin(tokenService.getLoginUser().getUserid())) { |
| | | SysUser user = new SysUser(); |
| | | user.setUserId(userId); |
| | | List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user); |
| | |
| | | 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控制台地址 |
| | |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "设置默认地址") |
| | | @GetMapping(value = "/setDefaultAddress") |
| | | public AjaxResult<String> setDefaultAddress(@RequestParam(value = "id") Long id) { |
| | | TAppUserAddress appUserAddress = appUserAddressService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!appUserAddress.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | // 修改用户默认地址 |
| | | appUserAddressService.updateDefaultAddress(1,tokenService.getLoginUserApplet().getUserId()); |
| | | TAppUserAddress appUserAddress = appUserAddressService.getById(id); |
| | | appUserAddress.setDefaultAddress(1); |
| | | appUserAddressService.updateById(appUserAddress); |
| | | return AjaxResult.success(); |
| | |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "修改用户地址") |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<Boolean> update(@RequestBody TAppUserAddress dto) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUserAddress userAddress = appUserAddressService.getById(dto.getId()); |
| | | if(!userAddress.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | // 用户id |
| | | dto.setAppUserId(tokenService.getLoginUserApplet().getUserId()); |
| | | dto.setAppUserId(userId); |
| | | // 修改用户默认地址 |
| | | appUserAddressService.updateDefaultAddress(dto.getDefaultAddress(),dto.getAppUserId()); |
| | | return AjaxResult.ok(appUserAddressService.updateById(dto)); |
| | |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TAppUserAddress> getDetailById(@RequestParam(value = "id")Long id) { |
| | | TAppUserAddress appUserAddress = appUserAddressService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!appUserAddress.getAppUserId().equals(userId)){ |
| | | return R.fail("权限不足"); |
| | | } |
| | | appUserAddress.setUid(appUserAddress.getId().toString()); |
| | | return R.ok(appUserAddress); |
| | | } |
| | |
| | | @ApiOperation(tags = {"小程序-用户地址"},value = "删除用户地址") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Long id) { |
| | | TAppUserAddress appUserAddress = appUserAddressService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!appUserAddress.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | return AjaxResult.ok(appUserAddressService.removeById(id)); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.auth.AuthUtil; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import com.ruoyi.system.api.model.LoginUserApplet; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/company"}, logical = Logical.OR) |
| | | @ApiOperation(value = "单位管理列表", tags = {"用户管理-单位管理"}) |
| | | @PostMapping(value = "/unit/page") |
| | | public R<Page<TCompany>> unitPage(@RequestBody UnitListQueryDto unitListQueryDto) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appUser/list", "/appUser/add", "/appUser/update", "/appUser/updateCompany"}, logical = Logical.OR) |
| | | @ApiOperation(value = "单位下拉框", tags = {"用户管理-单位管理"}) |
| | | @GetMapping(value = "/unit/select") |
| | | public R<List<TCompany>> unitSelect() { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/company/add", "/company/update"}, logical = Logical.OR) |
| | | @ApiOperation(value = "单位管理添加或编辑", tags = {"用户管理-单位管理"}) |
| | | @PostMapping(value = "/unit/addOrUpdate") |
| | | @Log(title = "【单位管理】添加或编辑单位", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/company/del"}, logical = Logical.OR) |
| | | @ApiOperation(value = "单位管理删除", tags = {"用户管理-单位管理"}) |
| | | @DeleteMapping(value = "/unit/delete") |
| | | @Log(title = "【单位管理】删除单位", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appUser/list"}, logical = Logical.OR) |
| | | @ApiOperation(value = "用户列表", tags = {"用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/page") |
| | | public R<Page<TAppUser>> userPage(@RequestBody UserListQueryDto userListQueryDto) { |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipList"}, logical = Logical.OR) |
| | | @ApiOperation(value = "会员列表", tags = {"用户管理-会员列表"}) |
| | | @PostMapping(value = "/user/vip/page") |
| | | public R<Page<TAppUser>> vipPage(@RequestBody UserListQueryDto userListQueryDto) { |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/coupon/send"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券发放-选择人员") |
| | | @PostMapping("/choiceUser") |
| | | public R<Page<TAppUser>> choiceUser(@RequestBody ChoiceUserListQueryDto userListQueryDto) { |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appUser/add", "/appUser/update"}, logical = Logical.OR) |
| | | @ApiOperation(value = "用户添加编辑", tags = {"用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/addOrUpdate") |
| | | @Log(title = "【用户列表】添加编辑用户", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appUser/select", "/vipList/select"}, logical = Logical.OR) |
| | | @ApiOperation(value = "用户详情", tags = {"用户管理-用户列表"}) |
| | | @GetMapping(value = "/user/detail/{id}") |
| | | public R<UserDetailDto> userDetail(@PathVariable Long id) { |
| | |
| | | return R.ok(userDetailDto); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户详情积分明细", tags = {"后台-用户管理-用户列表","小程序-个人中心"}) |
| | | @RequiresPermissions(value = {"/appUser/select", "/vipList/select"}, logical = Logical.OR) |
| | | @ApiOperation(value = "用户详情积分明细", tags = {"后台-用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/points/page") |
| | | public R<Page<TAppUserIntegralChange>> pointsDetail(@RequestBody PointsQueryDto pointsQueryDto) { |
| | | if (pointsQueryDto.getUserId()==null){ |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "用户详情积分明细", tags = {"小程序-个人中心"}) |
| | | @PostMapping(value = "/user/points/page1") |
| | | public R<Page<TAppUserIntegralChange>> pointsDetail1(@RequestBody PointsQueryDto pointsQueryDto) { |
| | | if (pointsQueryDto.getUserId()==null){ |
| | | pointsQueryDto.setUserId(tokenService.getLoginUserApplet().getUserId()); |
| | | } |
| | | List<Integer> types = new ArrayList<>(); |
| | | if (pointsQueryDto.getType()==null){ |
| | | types.add(1); |
| | | types.add(2); |
| | | types.add(3); |
| | | types.add(4); |
| | | types.add(5); |
| | | types.add(6); |
| | | }else if (pointsQueryDto.getType()==1){ |
| | | types.add(1); |
| | | types.add(2); |
| | | types.add(3); |
| | | types.add(4); |
| | | types.add(5); |
| | | }else if (pointsQueryDto.getType()==2){ |
| | | types.add(6); |
| | | } |
| | | Page<TAppUserIntegralChange> page = integralChangeService.lambdaQuery() |
| | | .eq(TAppUserIntegralChange::getAppUserId, pointsQueryDto.getUserId()) |
| | | .orderByDesc(TAppUserIntegralChange::getCreateTime) |
| | | .eq(pointsQueryDto.getChangeType() != null, TAppUserIntegralChange::getChangeType, pointsQueryDto.getChangeType()) |
| | | .in(!types.isEmpty(), TAppUserIntegralChange::getChangeType, types).page(Page.of(pointsQueryDto.getPageCurr(), pointsQueryDto.getPageSize())); |
| | | |
| | | for (TAppUserIntegralChange record : page.getRecords()) { |
| | | record.setDateTime(record.getCreateTime()); |
| | | record.setUid(record.getId().toString()); |
| | | if (record.getChangeType()==2||record.getChangeType()==3){ |
| | | R<TChargingOrder> tChargingOrderR = chargingOrderClient.orderDetail(Long.valueOf(record.getExtension())); |
| | | if (tChargingOrderR.getData()!=null) { |
| | | record.setOrderNum(tChargingOrderR.getData().getCode()); |
| | | } |
| | | } |
| | | if (record.getChangeType()==6){ |
| | | R<TExchangeOrder> tExchangeOrderR = exchangeOrderClient.orderDetail(Long.valueOf(record.getExtension())); |
| | | if (tExchangeOrderR.getData()!=null){ |
| | | record.setOrderNum(tExchangeOrderR.getData().getCode()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.ok(page); |
| | | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "积分详情", tags = {"小程序-个人中心"}) |
| | | @GetMapping(value = "/user/points/detail") |
| | | public R<TAppUserIntegralChange> pointsDetail(String id) { |
| | | TAppUserIntegralChange byId = integralChangeService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!byId.getAppUserId().equals(userId)){ |
| | | return R.fail("权限不足"); |
| | | } |
| | | if (byId.getChangeType()==6) { |
| | | TExchangeOrder data = exchangeOrderClient.orderDetail(Long.valueOf(byId.getExtension())).getData(); |
| | | if (data != null) { |
| | |
| | | return R.ok(byId); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/appUser/freeze"}, logical = Logical.OR) |
| | | @ApiOperation(value = "冻结解冻用户", tags = {"后台-用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/status/change") |
| | | @Log(title = "【用户列表】冻结解冻用户", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appUser/updateCompany"}, logical = Logical.OR) |
| | | @ApiOperation(value = "修改单位", tags = {"后台-用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/unit/change") |
| | | @Log(title = "【用户列表】修改用户单位", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appUser/del"}, logical = Logical.OR) |
| | | @ApiOperation(value = "删除用户", tags = {"后台-用户管理-用户列表"}) |
| | | @DeleteMapping(value = "/user/delete") |
| | | @Log(title = "【用户列表】删除用户", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | |
| | | appUserInfoDto.setVipCouponNum(count); |
| | | appUserInfoDto.setIsVip(1); |
| | | appUserInfoDto.setVipExpireTime(byId.getVipEndTime()); |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | //判断当天是否签到 |
| | | Long count = signService.lambdaQuery().eq(TAppUserSign::getAppUserId,userId).eq(TAppUserSign::getSignDay, LocalDate.now()).count(); |
| | |
| | | appUserInfoDto.setUserCars(list); |
| | | appUserInfoDto.setFirstAdd(byId.getFirstAdd()!=null?byId.getFirstAdd():0); |
| | | appUserInfoDto.setPoints(byId.getPoints()==null?0:byId.getPoints()); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | return R.ok(appUserInfoDto); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | TAppUser byId = appUserService.getById(userId); |
| | | byId.setAvatar(url); |
| | | appUserService.updateById(byId); |
| | | |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "优惠卷列表不分页(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | |
| | | @PostMapping(value = "/user/coupon/getById") |
| | | public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { |
| | | TAppCoupon appCoupon = appCouponService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!appCoupon.getAppUserId().equals(userId)){ |
| | | return R.fail("权限不足"); |
| | | } |
| | | appCoupon.setUid(id.toString()); |
| | | return R.ok(appCoupon); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appUser/giftVip", "/appUser/gift_vip"}, logical = Logical.OR) |
| | | @ApiOperation(value = "赠送会员", tags = {"用户管理-用户列表"}) |
| | | @PostMapping(value = "/user/give/vip") |
| | | @Log(title = "【用户列表】赠送会员", businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE) |
| | |
| | | } |
| | | // 获取当前用户信息 |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser appUser = appUserService.getById(userId); |
| | | appUser.setPhone(dto.getPhone()); |
| | | appUserService.updateById(appUser); |
| | | TAppUser appUser = appUserService.getOne(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhone, dto.getPhone()).eq(TAppUser::getDelFlag, 0).eq(TAppUser::getStatus, 3)); |
| | | if (Objects.nonNull(appUser)){ |
| | | return AjaxResult.error("手机号已使用,请更换其他手机号"); |
| | | } |
| | | TAppUser appUser1 = appUserService.getById(userId); |
| | | appUser1.setPhone(dto.getPhone()); |
| | | appUserService.updateById(appUser1); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"}) |
| | | @PostMapping(value = "/user/car/addOrUpdate") |
| | | public R carAdd(@RequestBody TAppUserCar appUserCar) { |
| | | |
| | | if(null != appUserCar.getId()){ |
| | | TAppUserCar userCar = appUserCarService.getById(appUserCar.getId()); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!userCar.getAppUserId().equals(userId)){ |
| | | return R.fail("权限不足"); |
| | | } |
| | | } |
| | | LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet(); |
| | | Long userId = loginUserApplet.getUserId(); |
| | | TAppUser byId = appUserService.getById(userId); |
| | |
| | | @ApiOperation(value = "添加编辑车辆", tags = {"小程序-个人中心-车辆"}) |
| | | @GetMapping(value = "/user/car/delete") |
| | | public R carDelete(String id) { |
| | | TAppUserCar appUserCar = appUserCarService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!appUserCar.getAppUserId().equals(userId)){ |
| | | return R.fail("权限不足"); |
| | | } |
| | | boolean b = appUserCarService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | |
| | | @GetMapping(value = "/user/car/detail") |
| | | public R<TAppUserCar> carDetail(String id) { |
| | | TAppUserCar byId = appUserCarService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!byId.getAppUserId().equals(userId)){ |
| | | return R.fail("权限不足"); |
| | | } |
| | | return R.ok(byId); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping(value = "/user/logOut") |
| | | @ApiOperation(value = "退出登录", tags = {"小程序-个人中心"}) |
| | | public AjaxResult logOut(){ |
| | | String token = tokenService.getLoginUserApplet().getToken(); |
| | | redisService.deleteObject("login_tokens:" + token); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/refresh") |
| | | @ApiOperation(value = "刷新token过期时间", tags = {"小程序-个人中心"}) |
| | | public R<?> refresh(HttpServletRequest request) { |
| | | LoginUserApplet loginUser = tokenService.getLoginUserAppletToken(request); |
| | | if (StringUtils.isNotNull(loginUser)) { |
| | | // 刷新令牌有效期 |
| | | tokenService.refreshToken1(loginUser); |
| | | return R.ok(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.dto.TagListQueryDto; |
| | | import com.ruoyi.account.api.model.TAppUserTag; |
| | | import com.ruoyi.account.service.TAppUserTagService; |
| | |
| | | @Resource |
| | | private TAppUserTagService appUserTagService; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/coupon", "/userTag"}, logical = Logical.OR) |
| | | @ApiOperation(value = "标签管理列表", tags = {"用户管理-用户标签管理"}) |
| | | @PostMapping(value = "/tags/page") |
| | | public R<Page<TUserTag>> tagPage(@RequestBody TagListQueryDto tagListQueryDto) { |
| | |
| | | } |
| | | return R.ok(data); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appUser/list"}, logical = Logical.OR) |
| | | @ApiOperation(value = "标签管理列表", tags = {"用户管理-用户标签管理"}) |
| | | @GetMapping(value = "/tags/select") |
| | | public R<List<TUserTag>> select() { |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/userTag/add", "/userTag/update"}, logical = Logical.OR) |
| | | @ApiOperation(value = "标签添加或修改", tags = {"用户管理-用户标签管理"}) |
| | | @PostMapping(value = "/tags/add") |
| | | @Log(title = "【用户标签管理】标签添加或修改", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/userTag/del"}, logical = Logical.OR) |
| | | @ApiOperation(value = "标签删除", tags = {"用户管理-用户标签管理"}) |
| | | @DeleteMapping(value = "/tags/delete") |
| | | @Log(title = "【用户标签管理】删除标签", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | |
| | | @ApiOperation(value = "获取开票抬头详情数据", tags = {"小程序-充电发票"}) |
| | | public AjaxResult<TInvoiceInformation> getInvoiceInformationInfo(@PathVariable String id){ |
| | | TInvoiceInformation information = invoiceInformationService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!information.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | return AjaxResult.success(information); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "编辑开票抬头数据", tags = {"小程序-充电发票"}) |
| | | public AjaxResult editInvoiceInformation(@RequestBody TInvoiceInformation invoiceInformation){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TInvoiceInformation information = invoiceInformationService.getById(invoiceInformation.getId()); |
| | | if(!information.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | |
| | | //如果当前是默认抬头,则需要去除其他的默认配置 |
| | | if(null != invoiceInformation.getIsDefault() && 1 == invoiceInformation.getIsDefault()){ |
| | | TInvoiceInformation one = invoiceInformationService.getOne(new LambdaQueryWrapper<TInvoiceInformation>().eq(TInvoiceInformation::getDelFlag, 0) |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | # 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控制台地址 |
| | |
| | | package com.ruoyi.account; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.model.LoginUserApplet; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiAccountApplication.class) |
| | | public class RuoYiAccountApplicationTests { |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | @Test |
| | | public void test(){ |
| | | LoginUserApplet loginUserApplet = new LoginUserApplet(); |
| | | loginUserApplet.setUserId(1839480334642704385L); |
| | | loginUserApplet.setUserIdStr("1839480334642704385"); |
| | | loginUserApplet.setName("158****3127"); |
| | | loginUserApplet.setPhone("15828353127"); |
| | | loginUserApplet.setAvatar(""); |
| | | loginUserApplet.setAddress(""); |
| | | Map<String, Object> tokenInfos = new HashMap<>(); |
| | | System.err.println(tokenService.createTokenApplet(loginUserApplet)); |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | @Autowired |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | |
| | | */ |
| | | @ApiOperation(value = "获取验证码",notes = "获取验证码",tags = {"更换手机号获取验证码"}) |
| | | @GetMapping("/getCode") |
| | | public AjaxResult getCode(@RequestParam("phone") String phone) |
| | | { |
| | | public AjaxResult getCode(@RequestParam("phone") String phone) { |
| | | String regex = "^1[3-9]\\d{9}$"; |
| | | if(!phone.matches(regex)){ |
| | | return AjaxResult.error("无效的手机号"); |
| | | } |
| | | Map<String, Object> cacheMap = redisService.getCacheMap("sms_code_" + phone); |
| | | if(null == cacheMap || cacheMap.size() == 0){ |
| | | cacheMap = new HashMap<>(); |
| | | cacheMap.put("timestamp", System.currentTimeMillis()); |
| | | cacheMap.put("time", 1); |
| | | redisService.setCacheMap("sms_code_" + phone, cacheMap, 300); |
| | | }else{ |
| | | Integer time = (Integer) cacheMap.get("time"); |
| | | Long timestamp = (Long) cacheMap.get("timestamp"); |
| | | if(System.currentTimeMillis() - timestamp > 60000){ |
| | | cacheMap.put("timestamp", System.currentTimeMillis()); |
| | | cacheMap.put("time", 1); |
| | | redisService.setCacheMap("sms_code_" + phone, cacheMap, 300); |
| | | } else if(System.currentTimeMillis() - timestamp <= 60000 && time < 3){ |
| | | time++; |
| | | cacheMap.put("time", time); |
| | | redisService.setCacheMap("sms_code_" + phone, cacheMap, 300); |
| | | }else if(System.currentTimeMillis() - timestamp < 60000 && time >= 3){ |
| | | return AjaxResult.error("请求太频繁,请稍后再试!"); |
| | | } |
| | | } |
| | | |
| | | TAppUser appUser = appUserClient.selectByPhone(phone).getData(); |
| | | if (Objects.nonNull(appUser)){ |
| | | return AjaxResult.error("该手机号已绑定账号"); |
| | | return AjaxResult.error(); |
| | | } |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.UPDATE_PHONE,code,5L, TimeUnit.MINUTES); |
| | |
| | | */ |
| | | @ApiOperation(value = "获取验证码",notes = "获取验证码",tags = {"申请建桩获取验证码"}) |
| | | @GetMapping("/getApplyCode") |
| | | public AjaxResult getApplyCode(@RequestParam("phone") String phone) |
| | | { |
| | | public AjaxResult getApplyCode(@RequestParam("phone") String phone) { |
| | | String regex = "^1[3-9]\\d{9}$"; |
| | | if(!phone.matches(regex)){ |
| | | return AjaxResult.error("无效的手机号"); |
| | | } |
| | | Map<String, Object> cacheMap = redisService.getCacheMap("sms_code_" + phone); |
| | | if(null == cacheMap || cacheMap.size() == 0){ |
| | | cacheMap = new HashMap<>(); |
| | | cacheMap.put("timestamp", System.currentTimeMillis()); |
| | | cacheMap.put("time", 1); |
| | | redisService.setCacheMap("sms_code_" + phone, cacheMap, 300); |
| | | }else{ |
| | | Integer time = (Integer) cacheMap.get("time"); |
| | | Long timestamp = (Long) cacheMap.get("timestamp"); |
| | | if(System.currentTimeMillis() - timestamp > 60000){ |
| | | cacheMap.put("timestamp", System.currentTimeMillis()); |
| | | cacheMap.put("time", 1); |
| | | redisService.setCacheMap("sms_code_" + phone, cacheMap, 300); |
| | | } else if(System.currentTimeMillis() - timestamp <= 60000 && time < 3){ |
| | | time++; |
| | | cacheMap.put("time", time); |
| | | redisService.setCacheMap("sms_code_" + phone, cacheMap, 300); |
| | | }else if(System.currentTimeMillis() - timestamp < 60000 && time >= 3){ |
| | | return AjaxResult.error("请求太频繁,请稍后再试!"); |
| | | } |
| | | } |
| | | |
| | | String code = MsgUtil.createCode(); |
| | | redisService.setCacheObject(phone+ Constants.APPLY_CHARGING,code,5L, TimeUnit.MINUTES); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | |
| | | package com.ruoyi.chargingPile.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.ruoyi.chargingPile.api.dto.GetPermissionConfigurationDTO; |
| | | import com.ruoyi.chargingPile.api.dto.PartnerListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.model.TPartnerSite; |
| | | import com.ruoyi.chargingPile.api.model.TSiteMenu; |
| | | import com.ruoyi.chargingPile.api.query.GetPartnerList; |
| | | import com.ruoyi.chargingPile.api.query.SetPermissionConfiguration; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ResetPassword; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TPartnerSiteService; |
| | | import com.ruoyi.chargingPile.service.TSiteMenuService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | @Resource |
| | | private TSiteMenuService siteMenuService; |
| | | |
| | | @Resource |
| | | private TPartnerSiteService partnerSiteService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/balanceSheetRecord", "/partners", "/chargingPile/add", "/chargingPile/select", "/chargingPile/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getPartnerList") |
| | | @ApiOperation(value = "获取合作商列表", tags = {"管理后台-合作商管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/partners/add"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/addPartner") |
| | | @ApiOperation(value = "添加合作商", tags = {"管理后台-合作商管理"}) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/partners/seleete", "/partners/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getPartner/{id}") |
| | | @ApiOperation(value = "获取合作商详情", tags = {"管理后台-合作商管理", "管理后台-充电桩信息"}) |
| | |
| | | Partner partner = partnerService.getPartner(id); |
| | | return AjaxResult.success(partner); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getPartnerR/{id}") |
| | | public R<Partner> getPartnerR(@PathVariable("id") Integer id){ |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/partners/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/editPartner") |
| | | @ApiOperation(value = "编辑合作商", tags = {"管理后台-合作商管理"}) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/partners/del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delPartner") |
| | | @ApiOperation(value = "删除合作商", tags = {"管理后台-合作商管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/partners/resetPassword"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/resetPassword") |
| | | @ApiOperation(value = "合作商重置密码", tags = {"管理后台-合作商管理"}) |
| | |
| | | return partnerService.resetPassword(resetPassword); |
| | | } |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/add", "/site/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getPartner") |
| | | @ApiOperation(value = "获取所有合作商", tags = {"管理后台-站点管理"}) |
| | | public AjaxResult<List<Partner>> getPartner(){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | LambdaQueryWrapper<Partner> wrapper = new LambdaQueryWrapper<Partner>().eq(Partner::getDelFlag, 0); |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/partner_authority"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getPermissionConfiguration/{siteId}") |
| | | @ApiOperation(value = "获取合作商权限设置", tags = {"管理后台-站点管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/partner_authority"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/setPermissionConfiguration/{siteId}") |
| | | @ApiOperation(value = "设置合作商权限", tags = {"管理后台-站点管理"}) |
| | |
| | | */ |
| | | @PostMapping("/authSite/{partnerId}") |
| | | public R<Set<Integer>> authSite(@PathVariable("partnerId") Integer partnerId, @RequestParam("siteMenu") String siteMenu){ |
| | | Set<Integer> integers = partnerService.authSite(partnerId, SiteMenu.valueOf(siteMenu)); |
| | | Set<Integer> integers = partnerService.authSite(partnerId, SiteMenu.getSiteMenu(siteMenu)); |
| | | return R.ok(integers); |
| | | } |
| | | |
| | | /** |
| | | * 判断合作商权限 |
| | | * @param partnerId |
| | | * @param siteId |
| | | * @param siteMenu |
| | | * @return |
| | | */ |
| | | @PostMapping("/authMenu/{partnerId}") |
| | | public Boolean authMenu(@PathVariable("partnerId") Integer partnerId, @RequestParam("siteId") Integer siteId, @RequestParam("siteMenu") String siteMenu){ |
| | | return partnerService.authMenu(partnerId, siteId, SiteMenu.getSiteMenu(siteMenu)); |
| | | } |
| | | // 充电算帐单按钮权限 |
| | | @PostMapping("/getChargingBillMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getChargingBillMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId){ |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charge_bill_order/download").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu two = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charge_bill_order").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite1 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, two.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | List<Boolean> booleans = new ArrayList<>(); |
| | | if (partnerSite!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite1!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | return R.ok(booleans); |
| | | } |
| | | // 充电时段统计按钮权限 |
| | | @PostMapping("/getChargingListMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getChargingListMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId){ |
| | | List<Boolean> booleans = new ArrayList<>(); |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charging_period_statistics/order_info").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu two = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charging_period_statistics/charging_curve").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite1 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, two.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu three = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charging_period_statistics").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite2 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, three.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | if (partnerSite!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite1!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite2!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | return R.ok(booleans); |
| | | } |
| | | // 账户结算帐单按钮权限 |
| | | @PostMapping("/getAccountMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getAccountMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId){ |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/account_settlement/download").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu two = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/account_settlement").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite1 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, two.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | List<Boolean> booleans = new ArrayList<>(); |
| | | if (partnerSite!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite1!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | return R.ok(booleans); |
| | | } |
| | | // 结算表记录按钮权限 |
| | | @PostMapping("/getSettlementListMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getSettlementListMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId){ |
| | | List<Boolean> booleans = new ArrayList<>(); |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/balance_sheet_record/download").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu two = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/balance_sheet_record/del").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite1 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, two.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu three = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/balance_sheet_record").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite2 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, three.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | if (partnerSite!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite1!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite2!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | return R.ok(booleans); |
| | | } |
| | | // 充电桩订单按钮权限 |
| | | @PostMapping("/getChargingOrderMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> getChargingOrderMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId){ |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charging_pile_order/record").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu two = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charging_pile_order").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite1 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, two.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | List<Boolean> booleans = new ArrayList<>(); |
| | | if (partnerSite!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite1!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | return R.ok(booleans); |
| | | } |
| | | // 订单申诉按钮权限 |
| | | @PostMapping("/managePageListMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> managePageListMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId){ |
| | | List<Boolean> booleans = new ArrayList<>(); |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/order_appeal/view").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu two = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/order_appeal/handle").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite1 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, two.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu three = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/order_appeal").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite2 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, three.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | if (partnerSite!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite1!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite2!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | return R.ok(booleans); |
| | | } |
| | | // 停车记录按钮权限 |
| | | @PostMapping("/parkingRecordListMenu/{partnerId}/{siteId}") |
| | | R<List<Boolean>> parkingRecordListMenu(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId){ |
| | | List<Boolean> booleans = new ArrayList<>(); |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/parking_record/view").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu two = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/parking_record/exit_parking_lot").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite1 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, two.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu three = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/parking_record").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite2 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, three.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | if (partnerSite!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite1!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite2!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | return R.ok(booleans); |
| | | } |
| | | // 充电监控记录按钮权限 |
| | | @PostMapping("/watchChargingOrder/{partnerId}/{siteId}") |
| | | R<List<Boolean>> watchChargingOrder(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId){ |
| | | List<Boolean> booleans = new ArrayList<>(); |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charging_pile_order/monitoring_record/info").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu two = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charging_pile_order/monitoring_record/del").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite1 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, two.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | TSiteMenu three = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charging_pile_order/monitoring_record").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite2 = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, three.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | if (partnerSite!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite1!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | if (partnerSite2!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | return R.ok(booleans); |
| | | } |
| | | // 充电评价数据权限 |
| | | @PostMapping("/chargeEvaluation/{partnerId}/{siteId}") |
| | | R<List<Boolean>> chargeEvaluation(@PathVariable("partnerId")Integer partnerId,@PathVariable("siteId") Integer siteId){ |
| | | List<Boolean> booleans = new ArrayList<>(); |
| | | TSiteMenu one = siteMenuService.getOne(new LambdaQueryWrapper<TSiteMenu>().eq(TSiteMenu::getPath, "/data/charge_evaluation").eq(TSiteMenu::getStatus, 0)); |
| | | TPartnerSite partnerSite = partnerSiteService.getOne(new LambdaQueryWrapper<TPartnerSite>() |
| | | .eq(TPartnerSite::getPartnerId, partnerId) |
| | | .eq(TPartnerSite::getSiteMenuId, one.getMenuId()) |
| | | .eq(TPartnerSite::getSiteId, siteId)); |
| | | if (partnerSite!=null){ |
| | | booleans.add(true); |
| | | }else{ |
| | | booleans.add(false); |
| | | } |
| | | return R.ok(booleans); |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.account.api.vo.GetAppUserVipDetail; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | 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.*; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ChargingPercentBack; |
| | | import com.ruoyi.common.core.dto.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.*; |
| | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | @Resource |
| | | private ParkingLotClient parkingLotClient; |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | @Resource |
| | | private TChargingPileService chargingPileService; |
| | | @Resource |
| | |
| | | return R.ok(siteInfoVO); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement/update", "/site", "/platformRevenueAnalysis", "/chargingOperationAnalysis", |
| | | "/chargingUserAnalysis", "/operationMaintenanceAnalysis", "/chargingEquipmentMonitoring", "/activityExpense", "/chargeEvaluation/list", |
| | | "/parkingLot", "/workbench"}, logical = Logical.OR) |
| | | @GetMapping("/getSiteList") |
| | | @ApiOperation(value = "获取站点列表", tags = {"管理后台-站点管理"}) |
| | | public AjaxResult<PageInfo<GetSiteListDTO>> getSiteList(GetSiteList siteList){ |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeDistribution"}, logical = Logical.OR) |
| | | @GetMapping("/map/getSiteList") |
| | | @ApiOperation(value = "获取站点", tags = {"管理后台-数据分析-电站分析"}) |
| | | public R<List<GetSiteListDTO>> getMapSiteList(GetSiteList siteList){ |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeDistribution"}, logical = Logical.OR) |
| | | @GetMapping("/map/getPercent") |
| | | @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"}) |
| | | public R getPercent(Integer siteId){ |
| | |
| | | return R.ok(divide); |
| | | } |
| | | |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeDistribution"}, logical = Logical.OR) |
| | | @PostMapping("/map/getPercentByprovinceCode") |
| | | @ApiOperation(value = "获取该充电站的利用率", tags = {"管理后台-数据分析-电站分析"}) |
| | | public R getPercentByCityCode(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto){ |
| | | |
| | | |
| | | |
| | | Set<Integer> ids = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | R<Integer> admin = sysUserClient.isAdmin(SecurityUtils.getUserId()); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | //改用roleId=1来判断 |
| | | if(admin.getData()!=1){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | if(data2.size() > 0){ |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | } |
| | | ids = new HashSet<>(data); |
| | | } |
| | | } |
| | | chargingPercentProvinceDto.setSiteIds(ids); |
| | | |
| | | |
| | | GetSiteList siteList = new GetSiteList(); |
| | |
| | | return AjaxResult.success(siteService.list(new QueryWrapper<>())); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/systemUserManagement", "/site", "/faultInformationList", "/repairRecord", "/balanceSheetRecord", "/chargingPileOrder", |
| | | "/chargeOrderMonitoring", "/chargingPile", "/chargingGun"}, logical = Logical.OR) |
| | | @GetMapping("/getSiteListGun") |
| | | @ApiOperation(value = "获取站点列表 不分页", tags = {"管理后台-接口信息使用"}) |
| | | public AjaxResult<List<Site>> getSiteListGun(){ |
| | | return AjaxResult.success(siteService.getSiteListGun()); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/parkingLot/add", "/parkingLot/select", "/parkingLot/update"}, logical = Logical.OR) |
| | | @GetMapping("/getSiteListParkLot") |
| | | @ApiOperation(value = "获取站点列表不分页", tags = {"管理后台-停车场绑定"}) |
| | | public AjaxResult<List<Site>> getSiteListParkLot(){ |
| | | return AjaxResult.success(siteService.getSiteListParkLot()); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点分页列表", tags = {"小程序-站点管理-首页"}) |
| | | @PostMapping("/pageList") |
| | | public AjaxResult<PageInfo<SiteVO>> pageList(@Validated @RequestBody SiteQuery query, HttpServletRequest request){ |
| | | int isLogin = StringUtils.isEmpty(SecurityUtils.getToken(request)) ? 0 : 1; |
| | | return AjaxResult.success(siteService.pageList(query,isLogin)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取站点列表", tags = {"小程序-站点管理-地图导航站点"}) |
| | | @PostMapping("/getMapSiteList") |
| | |
| | | return AjaxResult.success(chargingPileService.getChargingGunList(siteId,type)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"小程序-站点管理-站点详情","管理后台-数据分析-电站分析"}) |
| | | @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"管理后台-数据分析-电站分析"}) |
| | | @GetMapping("/getChargingGunCount") |
| | | public AjaxResult<Map<String,ChargingGunCountVO>> getChargingGunCount(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId){ |
| | | return AjaxResult.success(chargingGunService.getChargingGunCount(siteId)); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取站点下充电枪数量统计", tags = {"小程序-站点管理-站点详情"}) |
| | | @GetMapping("/getChargingGunCount1") |
| | | public AjaxResult<Map<String,ChargingGunCountVO>> getChargingGunCount1(@RequestParam(value = "siteId")@ApiParam(value = "站点id", required = true)Integer siteId){ |
| | | return AjaxResult.success(chargingGunService.getChargingGunCount(siteId)); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/site/add"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/addSite") |
| | | @ApiOperation(value = "添加站点", tags = {"管理后台-站点管理"}) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/getSiteInfo/{id}") |
| | | @ApiOperation(value = "获取站点详情", tags = {"管理后台-站点管理"}) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/editSite") |
| | | @ApiOperation(value = "编辑站点", tags = {"管理后台-站点管理"}) |
| | |
| | | return siteService.editSite(site); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/del", "/site/batch_del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delSite") |
| | | @ApiOperation(value = "删除站点", tags = {"管理后台-站点管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/site/accounting_strategy"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/setAccountingStrategy/{id}") |
| | | @ApiOperation(value = "设置站点计费策略", tags = {"管理后台-站点管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/roleManagement/add", "/roleManagement/info", "/roleManagement/update", "/systemNotification", "/chargingPeriodStatistics", |
| | | "/parkingPaymentOrder", "/generateStatement", "/chargingPile/add", "/chargingPile/select", "/chargingPile/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getAllSiteList") |
| | | @ApiOperation(value = "获取所有站点数据", tags = {"管理后台-充电桩信息", "管理后台-系统用户管理", "管理后台-角色管理", "管理后台-系统通知", "管理后台-充电评价"}) |
| | | public AjaxResult<List<Site>> getAllSiteList(){ |
| | | //校验当前账户站点权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | LambdaQueryWrapper<Site> wrapper = new LambdaQueryWrapper<Site>().eq(Site::getDelFlag, 0); |
| | |
| | | wrapper.in(Site::getId, list); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = userRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | |
| | | /** |
| | | * 查询计费策略列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/site/add", "/site/update", "/site/accounting_strategy", "/chargingPile/add_charging_gun", "/chargingPile/accountingStrategy", |
| | | "/chargingGun/update", "/accountingStrategy"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "查询计费策略分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TAccountingStrategyVO>> pageList(@RequestBody TAccountingStrategyQuery query) { |
| | |
| | | /** |
| | | * 查询计费策略明细列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/billingTemplateAudit/info", "/site/accounting_strategy", "/chargingGun/select_rate", "/accountingStrategy", |
| | | "/accountingStrategy/select", "/accountingStrategy/update"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理", "管理后台-充电桩信息"},value = "查询计费策略明细列表") |
| | | @GetMapping(value = "/queryAccountingStrategyDetailByStrategyId") |
| | | public AjaxResult<List<TAccountingStrategyDetailVO>> queryAccountingStrategyDetailByStrategyId(@RequestParam("strategyId") Integer strategyId) { |
| | |
| | | /** |
| | | * 修改计费策略 |
| | | */ |
| | | @RequiresPermissions(value = {"/accountingStrategy/update"}, logical = Logical.OR) |
| | | @Log(title = "【计费策略】修改计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "修改计费策略") |
| | | @PostMapping(value = "/update") |
| | |
| | | /** |
| | | * 查看计费策略详情 |
| | | */ |
| | | @RequiresPermissions(value = {"/site/accounting_strategy", "/accountingStrategy/select", "/accountingStrategy/update"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-计费策略", "管理后台-站点管理"},value = "查看计费策略详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TAccountingStrategyVO> getDetailById(@RequestParam("id") Integer id) { |
| | |
| | | /** |
| | | * 删除计费策略 |
| | | */ |
| | | @RequiresPermissions(value = {"/accountingStrategy/del"}, logical = Logical.OR) |
| | | @Log(title = "【计费策略】删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "删除计费策略") |
| | | @DeleteMapping(value = "/deleteById") |
| | |
| | | /** |
| | | * 批量删除计费策略 |
| | | */ |
| | | @RequiresPermissions(value = {"/accountingStrategy/del"}, logical = Logical.OR) |
| | | @Log(title = "【计费策略】批量删除计费策略", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-计费策略"},value = "批量删除计费策略") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/billingTemplateAudit"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "查询计费审核分页列表") |
| | | @PostMapping(value = "/auth/pageList") |
| | | public AjaxResult<PageInfo<TAccountingStrategyVO>> authPageList(@RequestBody TAccountingStrategyQuery query) { |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/billingTemplateAudit/audit"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-计费模板审核"},value = "审核") |
| | | @PostMapping(value = "/auth/pass") |
| | | @Log(title = "【计费模板审核】审核计费模板", businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE) |
| | |
| | | import com.ruoyi.common.core.utils.WebUtils; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.ExportUidDto; |
| | |
| | | return AjaxResult.ok(applyChargingPileService.save(dto)); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/add"}, logical = Logical.OR) |
| | | @Log(title = "【申请建桩】添加建桩申请", businessType = BusinessType.INSERT) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "建桩申请") |
| | | @PostMapping(value = "/manage/add") |
| | |
| | | return AjaxResult.ok(applyChargingPileService.save(dto)); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "列表") |
| | | @PostMapping(value = "/page") |
| | | public AjaxResult<Page<TApplyChargingPile>> page(@RequestBody ApplyChargingQuery applyChargingQuery) { |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/export"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "导出") |
| | | @PutMapping(value = "/export") |
| | | @Log(title = "【申请建桩】导出建桩申请列表", businessType = BusinessType.EXPORT) |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeBill/download"}, logical = Logical.OR) |
| | | @ApiOperation(value = "下载-已出账", tags = {"管理后台-充电算账单"}) |
| | | @PutMapping("/downloadBill") |
| | | @Log(title = "【充电算账单】下载算账单", businessType = BusinessType.EXPORT) |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/accountSettlementStatement/download"}, logical = Logical.OR) |
| | | @ApiOperation(value = "下载", tags = {"管理后台-账户结算账单"}) |
| | | @PutMapping("/downloadAccount") |
| | | @Log(title = "【账户结算账单】下载账单", businessType = BusinessType.EXPORT) |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/summarySettlement/export", "/balanceSheetRecord/download"}, logical = Logical.OR) |
| | | @ApiOperation(value = "导出", tags = {"管理后台-结算汇总表"}) |
| | | @PutMapping("/downloadSettlementTotal") |
| | | @Log(title = "【结算汇总表】下载汇总表", businessType = BusinessType.EXPORT) |
| | | public R downloadSettlementTotal(@RequestBody ExportUidDto uid,HttpServletResponse response) |
| | | { |
| | | SettlementTotalVO data = chargingOrderClient.settlementTotalR(uid.getTime()).getData(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | SettlementTotalVO data = chargingOrderClient.settlementTotalR(uid.getTime(),userId).getData(); |
| | | try { |
| | | response.setCharacterEncoding(Constants.UTF8); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | @Resource |
| | |
| | | return pattern.matcher(url).matches(); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/select"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "详情") |
| | | @PostMapping(value = "/detail/{id}") |
| | | public AjaxResult<TApplyChargingPile> detail(@PathVariable Integer id) { |
| | |
| | | return AjaxResult.ok(applyChargingPileService.getById(id)); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/remark"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "修改备注") |
| | | @PostMapping(value = "/remark") |
| | | @Log(title = "【申请建桩】修改备注", businessType = BusinessType.UPDATE) |
| | |
| | | applyChargingPileService.updateById(byId); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/pileApplication/del"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-申请建桩"},value = "删除") |
| | | @DeleteMapping(value = "/remark") |
| | | @Log(title = "【申请建桩】删除建桩申请", businessType = BusinessType.DELETE) |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 通过停车场id查询车库及车道信息 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-车库"},value = "通过停车场id查询车库及车道信息") |
| | | @GetMapping(value = "/queryCarportByParkId") |
| | | public AjaxResult<List<TCarportVO>> queryCarportByParkId(@RequestParam(value = "parkingLotId", required = true) Integer parkingLotId) { |
| | |
| | | /** |
| | | * 添加车库管理 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/add_garage"}, logical = Logical.OR) |
| | | @Log(title = "【车库】添加车库", businessType = BusinessType.INSERT) |
| | | @ApiOperation(tags = {"后台-车库"},value = "添加车库") |
| | | @PostMapping(value = "/add") |
| | |
| | | /** |
| | | * 修改车库 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/update_garage"}, logical = Logical.OR) |
| | | @Log(title = "【车库】修改车库", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "修改车库") |
| | | @PostMapping(value = "/update") |
| | |
| | | /** |
| | | * 查看车库详情 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/update_garage"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-车库"},value = "查看车库详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TCarport> getDetailById(@RequestParam("id") Integer id) { |
| | |
| | | /** |
| | | * 删除车库 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/del_garage"}, logical = Logical.OR) |
| | | @Log(title = "【车库】删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "删除车库") |
| | | @DeleteMapping(value = "/deleteById") |
| | |
| | | /** |
| | | * 批量删除车库 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/del_garage"}, logical = Logical.OR) |
| | | @Log(title = "【车库】批量删除车库", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车库"},value = "批量删除车库") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import io.swagger.annotations.Api; |
| | |
| | | /** |
| | | * 查询充电枪列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/chargingPile", "/chargingGun"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-充电枪", "管理后台-充电桩信息"},value = "查询充电枪分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TChargingGunVO>> pageList(@RequestBody TChargingGunQuery query) { |
| | |
| | | /** |
| | | * 添加充电枪管理 |
| | | */ |
| | | @RequiresPermissions(value = {"/chargingPile/add_charging_gun"}, logical = Logical.OR) |
| | | @Log(title = "【充电桩信息】添加充电枪", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"管理后台-充电桩信息"},value = "添加充电枪") |
| | | @PostMapping(value = "/add") |
| | |
| | | /** |
| | | * 修改充电枪 |
| | | */ |
| | | @RequiresPermissions(value = {"/chargingGun/update"}, logical = Logical.OR) |
| | | @Log(title = "【充电桩信息】修改充电枪", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"管理后台-充电桩信息"},value = "修改充电枪") |
| | | @PostMapping(value = "/update") |
| | |
| | | /** |
| | | * 查看充电枪详情 |
| | | */ |
| | | @RequiresPermissions(value = {"/chargingGun/update", "/chargingGun/select"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-充电枪", "管理后台-充电桩信息"},value = "查看充电枪详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TChargingGun> getDetailById(@RequestParam("id") Integer id) { |
| | |
| | | /** |
| | | * 删除充电枪 |
| | | */ |
| | | @RequiresPermissions(value = {"/chargingGun/del"}, logical = Logical.OR) |
| | | @Log(title = "【充电桩信息】删除充电枪", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"管理后台-充电桩信息"},value = "删除充电枪") |
| | | @DeleteMapping(value = "/deleteById") |
| | |
| | | /** |
| | | * 批量删除充电枪 |
| | | */ |
| | | @RequiresPermissions(value = {"/chargingGun/del"}, logical = Logical.OR) |
| | | @Log(title = "【充电桩信息】批量删除充电枪", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-充电枪"},value = "批量删除充电枪") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | |
| | | /** |
| | | * 结束充电 |
| | | */ |
| | | @RequiresPermissions(value = {"/chargingGun/end_charging"}, logical = Logical.OR) |
| | | @Log(title = "【充电桩信息】结束充电", businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-充电枪"},value = "结束充电") |
| | | @PutMapping(value = "/stopCharging") |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingGun/download_qr_code"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"管理后台-充电桩信息"},value = "下载二维码") |
| | | @GetMapping(value = "/downloadQRCode/{id}") |
| | | @Log(title = "【充电桩信息】下载二维码", businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE) |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | /** |
| | | * 设备状态统计 |
| | | */ |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-工作台"},value = "设备状态统计") |
| | | @PutMapping(value = "/gunStatusStatistics") |
| | | public R<GunStatusStatisticsVO> gunStatusStatistics() { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | PageInfo<GetSiteListDTO> siteList1 = siteService.getSiteList1(userId); |
| | | for (GetSiteListDTO datum : siteList1.getRecords()) { |
| | |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.vo.TChargingOrderVo; |
| | |
| | | .in(!siteIds.isEmpty(),TChargingPile::getSiteId,siteIds))); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPile", "/chargingGun"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/pageChargingPileList") |
| | | @ApiOperation(value = "获取充电桩列表数据", tags = {"管理后台-充电桩信息"}) |
| | |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPile/add"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @Log(title = "【充电桩信息】添加充电桩数据", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @PostMapping("/addChargingPile") |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPile/select", "/chargingPile/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getChargingPile/{id}") |
| | | @ApiOperation(value = "获取充电桩详情数据", tags = {"管理后台-充电桩信息"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPile/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @Log(title = "【充电桩信息】编辑充电桩数据", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @PostMapping("/editChargingPile") |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPile/del", "/chargingPile/batch_del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delChargingPile") |
| | | @Log(title = "【充电桩信息】删除充电桩", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPile/accountingStrategy"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @Log(title = "【充电桩信息】批量设置计费策略", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @PostMapping("/batchSetAccountingStrategy") |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingEquipmentMonitoring"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/chargeMonitoring/{siteId}") |
| | | @ApiOperation(value = "获取充电设施监控数据", tags = {"管理后台-充电设备监控"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingEquipmentMonitoring"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getChargingGunCountMonitoring/{siteId}") |
| | | @ApiOperation(value = "获取充电枪各种状态汇总监控数据", tags = {"管理后台-充电设备监控"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/operationMaintenanceAnalysis", "/chargingEquipmentMonitoring"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getChargingGunMonitoring") |
| | | @ApiOperation(value = "获取充电枪监控数据", tags = {"管理后台-充电设备监控"}) |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemNotification"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/chargingPileNotificationPageList") |
| | | @ApiOperation(value = "获取系统通知列表数据", tags = {"管理后台-系统通知"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/systemNotification/del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delChargingPileNotification") |
| | | @ApiOperation(value = "删除系统通知", tags = {"管理后台-系统通知"}) |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | * @param basePage |
| | | * @return |
| | | */ |
| | | @RequiresPermissions(value = {"/faultInformationList"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getFaultMessageList") |
| | | @ApiOperation(value = "获取故障信息列表数据", tags = {"管理后台-设备监控"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/faultInformationList/add"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/addFaultMessage") |
| | | @ApiOperation(value = "添加故障信息", tags = {"管理后台-设备监控"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/faultInformationList/del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delFaultMessage/{id}") |
| | | @ApiOperation(value = "删除故障信息", tags = {"管理后台-设备监控"}) |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | /** |
| | | * 查询停车场列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "查询停车场分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TParkingLotVO>> pageList(@RequestBody TParkingLotQuery query) { |
| | |
| | | /** |
| | | * 查询停车场列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingOperationAnalysis", "/workbench"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "查询停车场列表") |
| | | @PostMapping(value = "/list") |
| | | public AjaxResult<List<TParkingLotVO>> list(@RequestBody TParkingLotQuery query) { |
| | |
| | | /** |
| | | * 添加停车场管理 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/add"}, logical = Logical.OR) |
| | | @Log(title = "【停车场】添加停车场", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "添加停车场") |
| | | @PostMapping(value = "/add") |
| | |
| | | /** |
| | | * 修改停车场 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/update"}, logical = Logical.OR) |
| | | @Log(title = "【停车场】修改停车场", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "修改停车场") |
| | | @PostMapping(value = "/update") |
| | |
| | | /** |
| | | * 查看停车场详情 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/select", "/parkingLot/update"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "查看停车场详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TParkingLot> getDetailById(@RequestParam("id") Integer id) { |
| | |
| | | /** |
| | | * 删除停车场 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/del"}, logical = Logical.OR) |
| | | @Log(title = "【停车场】删除停车场", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "删除停车场") |
| | | @DeleteMapping(value = "/deleteById") |
| | |
| | | /** |
| | | * 批量删除停车场 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/batch_del"}, logical = Logical.OR) |
| | | @Log(title = "【停车场】批量删除停车场", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-停车场"},value = "批量删除停车场") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | |
| | | .eq(TParkingLot::getSiteId, siteId))); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/paymentOrder/order"}, logical = Logical.OR) |
| | | @GetMapping(value = "/getRecordById") |
| | | public R<TParkingRecord> getRecordById(@RequestParam("id") Long id){ |
| | | return R.ok(parkingRecordService.getById(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping(value = "/getRecordAmount") |
| | | public R<BigDecimal> getRecordAmount(@RequestParam("sixBefore") LocalDate sixBefore){ |
| | | BigDecimal sum = parkingRecordService.getSum(sixBefore); |
| | |
| | | .eq(TParkingLot::getAppKey, appKey).eq(TParkingLot::getDelFlag, 0)); |
| | | return R.ok(parkingLot); |
| | | } |
| | | @PostMapping(value = "/getSiteIdByOrderId") |
| | | R<Integer> getSiteIdByOrderId(@RequestParam("id") Long id){ |
| | | TParkingRecord byId = parkingRecordService.getById(id); |
| | | TParkingLot parkingLot = parkingLotService.getById(byId.getParkingLotId()); |
| | | return R.ok(parkingLot.getId()); |
| | | } |
| | | } |
| | | |
| | |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.query.ParkingRecordQuery; |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TCharingUserEquimentVO; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | private TParkingRecordService parkingRecordService; |
| | | @Resource |
| | | private TParkingLotService parkingLotService; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private PartnerClient partnerClient; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | @RequiresPermissions(value = {"/parkingRecord"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "列表") |
| | | @PostMapping(value = "/page") |
| | | public R<Page<TParkingRecord>> page(@RequestBody ParkingRecordPageQuery query) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userid).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | }else{ |
| | | if (roleType == 2){ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.parkingRecordListMenu(sysUser.getObjectId(),siteId).getData(); |
| | | |
| | | Boolean b = t1.get(1); |
| | | if (b){ |
| | | integers.add(siteId); |
| | | } |
| | | } |
| | | siteIds = integers; |
| | | } |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | List<TParkingLot> list = parkingLotService.lambdaQuery().in( TParkingLot::getSiteId, siteIds).list(); |
| | | List<Integer> ids = new ArrayList<>(); |
| | | for (TParkingLot tParkingLot : list) { |
| | | ids.add(tParkingLot.getId()); |
| | | } |
| | | |
| | | |
| | | String s1 = ""; |
| | | String s2 = ""; |
| | | if (query.getTimePeriod()!=null){ |
| | |
| | | s2 = query.getTimePeriod().split(" - ")[1]; |
| | | } |
| | | Page<TParkingRecord> page = parkingRecordService.lambdaQuery() |
| | | .in(TParkingRecord::getParkingLotId,ids) |
| | | .like(query.getLicensePlate() != null, TParkingRecord::getLicensePlate, query.getLicensePlate()) |
| | | .eq(query.getStatus() != null, TParkingRecord::getStatus, query.getStatus()) |
| | | .eq(query.getOutParkingType() != null, TParkingRecord::getOutParkingType, query.getOutParkingType()) |
| | |
| | | record.setUid(record.getId().toString()); |
| | | if (byId!=null) { |
| | | record.setParkName(byId.getName()); |
| | | if (roleType==2){ |
| | | List<Boolean> data1 = partnerClient.parkingRecordListMenu(sysUser.getObjectId(), byId.getSiteId()).getData(); |
| | | record.setAuthInfo(data1.get(0)); |
| | | record.setAuthOut(data1.get(1)); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/parkingPaymentOrder"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "停车缴费订单列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<TParkingRecordPageInfoVO> pageList(@RequestBody ParkingRecordQuery query) { |
| | | return R.ok(parkingRecordService.pageList(query)); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/parkingPaymentOrder/export"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "导出") |
| | | @PutMapping("/export") |
| | | @Log(title = "【停车记录】导出停车记录", businessType = BusinessType.EXPORT,operatorType = OperatorType.MANAGE) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "详情") |
| | | @GetMapping(value = "/detail") |
| | | public R<TParkingRecord> detail(Long id) { |
| | | return R.ok(parkingRecordService.getById(id)); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/parkingRecord/already_appeared"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "出场") |
| | | @GetMapping(value = "/out") |
| | | @Log(title = "【停车记录】修改出场状态", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | |
| | | parkingRecordService.save(parkingRecord); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/parkingOperationAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/parking/data") |
| | | @ApiOperation(value = "统计", tags = {"管理后台-数据分析-车场运营分析"}) |
| | | public R<TParkLotRecordVO> data(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){ |
| | | //上方折线图 |
| | | TParkLotRecordVO tParkLotRecordVO = new TParkLotRecordVO(); |
| | | |
| | | // 查询当前登陆人按钮权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data2 = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data2) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | parkingRecordQueryDto.setSiteIds(siteIds); |
| | | if (parkingRecordQueryDto.getDayType()==1) { |
| | | List<Map<String, Object>> maps = parkingRecordService.parkingData(parkingRecordQueryDto); |
| | | |
| | |
| | | return R.ok(tParkLotRecordVO); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | private static Map<String, Object> findMapWithTimeValue(List<Map<String, Object>> charMap1,String timeValue) { |
| | | for (Map<String, Object> map : charMap1) { |
| | | if (map.containsKey("time") && map.get("time").equals(timeValue)) { |
| | |
| | | return null; // 如果没有找到,返回 null |
| | | } |
| | | |
| | | |
| | | |
| | | private Map<String, Object> findMapWithDateValue(List<Map<String, Object>> list, String date) { |
| | | for (Map<String, Object> map : list) { |
| | | if (date.equals(map.get("time"))) { |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/parking/work") |
| | | @ApiOperation(value = "停车订单统计", tags = {"管理后台-工作台"}) |
| | |
| | | return R.ok(tParkLotRecordCountVo); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/parking/work1") |
| | | @ApiOperation(value = "停车订单统计", tags = {"管理后台-工作台"}) |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/parking/income") |
| | | @ApiOperation(value = "停车收入统计", tags = {"管理后台-工作台"}) |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/repairRecord"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getRepairList") |
| | | @ApiOperation(value = "获取报修记录列表数据", tags = {"管理后台-设备监控"}) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/repairRecord/add"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/addRepair") |
| | | @ApiOperation(value = "添加报修记录", tags = {"管理后台-设备监控"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/repairRecord/del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delRepair/{id}") |
| | | @ApiOperation(value = "删除报修记录", tags = {"管理后台-设备监控"}) |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.integration.api.feignClient.SwitchwayGateClient; |
| | | import com.ruoyi.integration.api.vo.SwitchwayGateReq; |
| | | import io.swagger.annotations.Api; |
| | |
| | | /** |
| | | * 添加车道管理 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/add_lane"}, logical = Logical.OR) |
| | | @Log(title = "【停车场配置】添加车道", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "添加车道") |
| | | @PostMapping(value = "/add") |
| | |
| | | /** |
| | | * 修改车道 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/update_lane"}, logical = Logical.OR) |
| | | @Log(title = "【停车场配置】修改车道", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "修改车道") |
| | | @PostMapping(value = "/update") |
| | |
| | | /** |
| | | * 查看车道详情 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/update_lane"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-车道"},value = "查看车道详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TVehicleRamp> getDetailById(@RequestParam("id") Integer id) { |
| | |
| | | /** |
| | | * 删除车道 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/del_lane"}, logical = Logical.OR) |
| | | @Log(title = "【停车场配置】删除车道", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "删除车道") |
| | | @DeleteMapping(value = "/deleteById") |
| | |
| | | /** |
| | | * 批量删除车道 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/del_lane"}, logical = Logical.OR) |
| | | @Log(title = "【停车场配置】批量删除车道", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "批量删除车道") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | |
| | | /** |
| | | * 开关闸车道 |
| | | */ |
| | | @RequiresPermissions(value = {"/parkingLot/open_gate", "/parkingLot/close_gate"}, logical = Logical.OR) |
| | | @Log(title = "【停车场配置】开关闸车道", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | | @ApiOperation(tags = {"后台-车道"},value = "开关闸车道") |
| | | @PostMapping(value = "/openOrDown") |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ParkingRecordQueryDto { |
| | |
| | | private LocalDate startTime; |
| | | @ApiModelProperty("结束时间") |
| | | private LocalDate endTime; |
| | | @ApiModelProperty("站点ids") |
| | | private List<Integer> siteIds; |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.query.GetPartnerList; |
| | | import com.ruoyi.chargingPile.api.query.SetPermissionConfiguration; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ResetPassword; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.GetPartnerList; |
| | | import com.ruoyi.chargingPile.api.query.SetPermissionConfiguration; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ResetPassword; |
| | | import com.ruoyi.chargingPile.mapper.PartnerMapper; |
| | | import com.ruoyi.chargingPile.service.*; |
| | |
| | | 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.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysRole; |
| | |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.GetSysRoleByIds; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import io.seata.core.context.RootContext; |
| | | import io.seata.core.exception.TransactionException; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import io.seata.tm.api.GlobalTransaction; |
| | | import io.seata.tm.api.GlobalTransactionContext; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | 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.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | 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.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | @Resource |
| | | private TAccountingStrategyDetailService accountingStrategyDetailService; |
| | | |
| | | @Resource |
| | | private TPartnerSiteService partnerSiteService; |
| | | |
| | | |
| | | /** |
| | | * 获取站点管理列表数据 |
| | |
| | | public PageInfo<GetSiteListDTO> getSiteList(GetSiteList siteList) { |
| | | Set<Integer> ids = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | R<Integer> admin = sysUserClient.isAdmin(SecurityUtils.getUserId()); |
| | | R<Integer> admin = sysUserClient.isAdmin(tokenService.getLoginUser().getUserid()); |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | //改用roleId=1来判断 |
| | | if(admin.getData()!=1){ |
| | | // if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | if(data2.size() > 0){ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public PageInfo<GetSiteListDTO> getSiteList1(Long userId) { |
| | | GetSiteList siteList = new GetSiteList(); |
| | |
| | | SysUser sysUser = sysUserClient.getSysUser(userId).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | R<Integer> admin = sysUserClient.isAdmin(SecurityUtils.getUserId()); |
| | | R<Integer> admin = sysUserClient.isAdmin(tokenService.getLoginUser().getUserid()); |
| | | |
| | | //合作商 |
| | | if(roleType == 2){ |
| | |
| | | if(null != one && !one.getCode().equals(site.getCode())){ |
| | | return AjaxResult.error("站点编号重复"); |
| | | } |
| | | |
| | | Site site1 = this.getById(site.getId()); |
| | | if(!site1.getPartnerId().equals(site.getPartnerId())){ |
| | | List<TPartnerSite> list = partnerSiteService.list(new LambdaQueryWrapper<TPartnerSite>().eq(TPartnerSite::getPartnerId, site1.getPartnerId()).eq(TPartnerSite::getSiteId, site.getId())); |
| | | for (TPartnerSite partnerSite : list) { |
| | | partnerSite.setPartnerId(site.getPartnerId()); |
| | | partnerSiteService.updateById(partnerSite); |
| | | } |
| | | } |
| | | |
| | | this.updateById(site); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | public List<Site> getSiteListParkLot() { |
| | | Set<Integer> ids = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | |
| | | ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | public List<Site> getSiteListGun() { |
| | | Set<Integer> ids = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | |
| | | ids = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | } |
| | | // 查询最高折扣的会员 |
| | | TVip monthlyCardDiscount = vipClient.getVipInfoByType(3).getData(); |
| | | strategyPriceVO.setServiceFeeDiscount(monthlyCardDiscount.getMonthlyCardDiscount()); |
| | | strategyPriceVO.setServiceFeeDiscount(null == monthlyCardDiscount ? new BigDecimal(10) : monthlyCardDiscount.getMonthlyCardDiscount()); |
| | | // 查询最高优惠的会员 |
| | | TVip maximumDeduction = vipClient.getVipInfoByType(1).getData(); |
| | | strategyPriceVO.setMaxDiscountAmount(maximumDeduction.getMaximumDeduction()); |
| | | strategyPriceVO.setMaxDiscountAmount(null == maximumDeduction ? new BigDecimal(10) : maximumDeduction.getMaximumDeduction()); |
| | | // 查询最低起步价会员 |
| | | TVip monthlyCard = vipClient.getVipInfoByType(2).getData(); |
| | | strategyPriceVO.setVipStartPrice(monthlyCard.getMonthlyCard()); |
| | | strategyPriceVO.setVipStartPrice(null == monthlyCard ? new BigDecimal(10) : monthlyCard.getMonthlyCard()); |
| | | // 模板折扣 |
| | | strategyPriceVO.setDiscount(accountingStrategy.getDiscount()); |
| | | return strategyPriceVO; |
| | |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | 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.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.*; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TChargingGunMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TAccountingStrategyService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.enums.status.ChargingGunModeEnum; |
| | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | 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.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | | import com.ruoyi.integration.api.model.QrCodeDelivery; |
| | |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Override |
| | | public PageInfo<TChargingGunVO> pageList(TChargingGunQuery query) { |
| | | Set<Integer> siteIds = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.CHARGING_GUN); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | StatusModeStatisticsVO statusModeStatistics1 = this.baseMapper.getStatusModeStatistics(siteIds,1); |
| | | StatusModeStatisticsVO statusModeStatistics2 = this.baseMapper.getStatusModeStatistics(siteIds,2); |
| | | StatusModeStatisticsVO statusModeStatistics3 = this.baseMapper.getStatusModeStatistics(siteIds,3); |
| | | if (statusModeStatistics1==null){ |
| | | StatusModeStatisticsVO vo = new StatusModeStatisticsVO(); |
| | | vo.setChargeMode(1); |
| | | vo.setFreeCount(0); |
| | | vo.setFilledCount(0); |
| | | vo.setInsertCount(0); |
| | | vo.setChargingCount(0); |
| | | statusModeStatistics1 =vo; |
| | | } |
| | | statusModeStatisticsVOS.add(statusModeStatistics1); |
| | | if (statusModeStatistics2==null){ |
| | | StatusModeStatisticsVO vo = new StatusModeStatisticsVO(); |
| | | vo.setChargeMode(2); |
| | | vo.setFreeCount(0); |
| | | vo.setFilledCount(0); |
| | | vo.setInsertCount(0); |
| | | vo.setChargingCount(0); |
| | | statusModeStatistics2 =vo; |
| | | } |
| | | statusModeStatisticsVOS.add(statusModeStatistics2); |
| | | |
| | | if (statusModeStatistics3==null){ |
| | | StatusModeStatisticsVO vo = new StatusModeStatisticsVO(); |
| | | vo.setChargeMode(3); |
| | | vo.setFreeCount(0); |
| | | vo.setFilledCount(0); |
| | | vo.setInsertCount(0); |
| | | vo.setChargingCount(0); |
| | | statusModeStatistics3 =vo; |
| | | } |
| | | statusModeStatisticsVOS.add(statusModeStatistics3); |
| | | gunStatusStatisticsVO.setStatusModeStatistics(statusModeStatisticsVOS); |
| | | return gunStatusStatisticsVO; |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPileNotification; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TChargingPileNotificationMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | |
| | | //校验当前账户站点权限 |
| | | Set<Integer> siteIds = null; |
| | | if(null == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | LambdaQueryWrapper<Site> wrapper = new LambdaQueryWrapper<Site>().eq(Site::getDelFlag, 0); |
| | |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.query.PageChargingPileList; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunCountMonitoring; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunMonitoring; |
| | |
| | | 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.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.IntegrationClient; |
| | | import com.ruoyi.integration.api.feignClient.IotInterfaceClient; |
| | |
| | | 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.ShowDeviceResp; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private SendMessageClient sendMessageClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private TChargingPileNotificationService chargingPileNotificationService; |
| | | |
| | | @Resource |
| | |
| | | public PageInfo<PageChargingPileListDTO> pageChargingPileList(PageChargingPileList page) { |
| | | Set<Integer> siteIds = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.CHARGING_PILE); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | return AjaxResult.error("设备编号已存在"); |
| | | } |
| | | //调用华为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()); |
| | | // } |
| | | // } |
| | | 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()); |
| | | }else{ |
| | | log.error("华为创建设备失败" + JSON.toJSONString(deviceResp)); |
| | | return AjaxResult.error("华为创建设备失败"); |
| | | } |
| | | }else{ |
| | | return AjaxResult.error("华为创建设备失败"); |
| | | } |
| | | this.save(chargingPile); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | if(null != one && !one.getId().equals(chargingPile.getId())){ |
| | | return AjaxResult.error("设备编号已存在"); |
| | | } |
| | | TChargingPile tChargingPile = this.getById(chargingPile.getId()); |
| | | ShowDeviceResp showDeviceResp = iotInterfaceClient.showDeviceRequest(tChargingPile.getCode()).getData(); |
| | | if(null != showDeviceResp){ |
| | | DeleteDeviceResp deleteDeviceResp = iotInterfaceClient.deleteDevice(tChargingPile.getCode()).getData(); |
| | | if(null == deleteDeviceResp || (deleteDeviceResp.getHttpStatusCode() != 200 && deleteDeviceResp.getHttpStatusCode() != 201 && deleteDeviceResp.getHttpStatusCode() != 204)){ |
| | | return AjaxResult.error("删除设备异常,请查看华为设备管理"); |
| | | } |
| | | } |
| | | |
| | | |
| | | //调用华为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()); |
| | | }else{ |
| | | log.error("华为创建设备失败" + JSON.toJSONString(deviceResp)); |
| | | return AjaxResult.error("华为创建设备失败"); |
| | | } |
| | | }else{ |
| | | return AjaxResult.error("华为创建设备失败"); |
| | | } |
| | | this.updateById(chargingPile); |
| | | |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().eq(TChargingGun::getChargingPileId, chargingPile.getId()).eq(TChargingGun::getDelFlag, 0)); |
| | |
| | | for (Integer id : ids) { |
| | | TChargingPile chargingPile = this.getById(id); |
| | | //调用华为Iot删除设备 |
| | | // if(StringUtils.isNotEmpty(chargingPile.getIotdDeviceId())){ |
| | | // DeleteDeviceResp deviceResp = iotInterfaceClient.deleteDevice(chargingPile.getIotdDeviceId()).getData(); |
| | | // if(null != deviceResp && deviceResp.getHttpStatusCode() == 0){ |
| | | // } |
| | | // } |
| | | if(StringUtils.isNotEmpty(chargingPile.getIotdDeviceId())){ |
| | | ShowDeviceResp showDeviceResp = iotInterfaceClient.showDeviceRequest(chargingPile.getCode()).getData(); |
| | | if(null != showDeviceResp){ |
| | | DeleteDeviceResp deleteDeviceResp = iotInterfaceClient.deleteDevice(chargingPile.getCode()).getData(); |
| | | if(null == deleteDeviceResp || (deleteDeviceResp.getHttpStatusCode() != 200 && deleteDeviceResp.getHttpStatusCode() != 201 && deleteDeviceResp.getHttpStatusCode() != 204)){ |
| | | return AjaxResult.error("删除设备异常,请查看华为设备管理"); |
| | | } |
| | | chargingPile.setIotdDeviceId(""); |
| | | } |
| | | |
| | | } |
| | | this.removeById(chargingPile); |
| | | } |
| | | return AjaxResult.success(); |
| | |
| | | //获取当前登录账户的站点权限数据 |
| | | Set<Integer> siteIds = new HashSet<>(); |
| | | if(0 == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | if(2 == roleType){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.CHARGING_FACILITY_MONITORING); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | //获取当前登录账户的站点权限数据 |
| | | Set<Integer> siteIds = new HashSet<>(); |
| | | if(0 == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | if(2 == roleType){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.CHARGING_FACILITY_MONITORING); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | //获取当前登录账户的站点权限数据 |
| | | Set<Integer> siteIds = new HashSet<>(); |
| | | if(0 == query.getSiteId()){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | R<Integer> admin = sysUserClient.isAdmin(SecurityUtils.getUserId()); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | R<Integer> admin = sysUserClient.isAdmin(tokenService.getLoginUser().getUserid()); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | if(2 == roleType){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.CHARGING_FACILITY_MONITORING); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(admin.getData()!=1){ |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TFaultMessage; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TFaultMessageMapper; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | |
| | | @Slf4j |
| | | @Service |
| | | public class TFaultMessageServiceImpl extends ServiceImpl<TFaultMessageMapper, TFaultMessage> implements TFaultMessageService { |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private ISiteService siteService; |
| | | @Autowired |
| | |
| | | @Override |
| | | public List<TFaultMessage> getFaultMessageList(PageInfo<TFaultMessage> pageInfo, Integer siteId) { |
| | | //校验合作商权限 |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == siteId || 0 == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == siteId || 0 == siteId){ |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | Set<Integer> data = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | Set<Integer> data = partnerService.authSite(objectId, SiteMenu.FAULT_INFORMATION_LIST); |
| | | siteIds = new ArrayList<>(data); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | }else{ |
| | | siteIds.add(siteId); |
| | | } |
| | | return this.baseMapper.getFaultMessageList(pageInfo, siteIds); |
| | | List<TFaultMessage> faultMessageList = this.baseMapper.getFaultMessageList(pageInfo, siteIds); |
| | | for (TFaultMessage faultMessage : faultMessageList) { |
| | | faultMessage.setAuthDelete(roleType == 1 ? true : partnerService.authMenu(objectId, faultMessage.getSiteId(), SiteMenu.FAULT_INFORMATION_LIST_DEL)); |
| | | } |
| | | return faultMessageList; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.query.TMonitoringEquipmentQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TMonitoringEquipmentVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingLotVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TMonitoringEquipmentMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TMonitoringEquipmentService; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | public class TMonitoringEquipmentServiceImpl extends ServiceImpl<TMonitoringEquipmentMapper, TMonitoringEquipment> implements TMonitoringEquipmentService { |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | |
| | | @Override |
| | | public PageInfo<TMonitoringEquipmentVO> pageList(TMonitoringEquipmentQuery query) { |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | // 查询管理站点下的停车场 |
| | |
| | | package com.ruoyi.chargingPile.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.query.TParkingLotQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingLotVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TParkingLotMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.TParkingLotService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | |
| | | public class TParkingLotServiceImpl extends ServiceImpl<TParkingLotMapper, TParkingLot> implements TParkingLotService { |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | |
| | | |
| | | Set<Integer> siteIds = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.PARKING_LOT); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | public List<TParkingLotVO> getList(String name) { |
| | | Set<Integer> siteIds = null; |
| | | //校验合作商权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | //合作商 |
| | |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.PARKING_LOT); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TParkingLot; |
| | | import com.ruoyi.chargingPile.api.model.TParkingRecord; |
| | | import com.ruoyi.chargingPile.api.query.ParkingRecordQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingLotVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO; |
| | | import com.ruoyi.chargingPile.api.vo.TParkingRecordVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto; |
| | | import com.ruoyi.chargingPile.mapper.SiteMapper; |
| | | import com.ruoyi.chargingPile.mapper.TParkingLotMapper; |
| | | import com.ruoyi.chargingPile.mapper.TParkingRecordMapper; |
| | | import com.ruoyi.chargingPile.service.TParkingRecordService; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | |
| | | private SiteMapper siteMapper; |
| | | @Autowired |
| | | private TParkingLotMapper parkingLotMapper; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | @Override |
| | | public BigDecimal getSum(LocalDate sixBefore) { |
| | | return this.baseMapper.getSum(sixBefore); |
| | | } |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Override |
| | | public TParkingRecordPageInfoVO pageList(ParkingRecordQuery query) { |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (query.getSiteId()==null){ |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | }else { |
| | | siteIds.add(query.getSiteId()); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | query.setSiteIds(siteIds); |
| | | PageInfo<TParkingRecordVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | // 查询站点的停车场id |
| | | if(Objects.nonNull(query.getSiteId())){ |
| | |
| | | |
| | | } |
| | | List<TParkingRecordVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | for (TParkingRecordVO tParkingRecordVO : list) { |
| | | if (tParkingRecordVO.getParkingDuration()==null){ |
| | | tParkingRecordVO.setFeeDuration(0); |
| | | }else if(tParkingRecordVO.getFreeDuration()==null){ |
| | | tParkingRecordVO.setFeeDuration(tParkingRecordVO.getParkingDuration()); |
| | | }else{ |
| | | tParkingRecordVO.setFeeDuration(tParkingRecordVO.getParkingDuration()-tParkingRecordVO.getFreeDuration()); |
| | | } |
| | | tParkingRecordVO.setOrderAmount(tParkingRecordVO.getOrderAmount()!=null?tParkingRecordVO.getOrderAmount():new BigDecimal("0") |
| | | .add(tParkingRecordVO.getTimeoutAmount()!=null?tParkingRecordVO.getTimeoutAmount():new BigDecimal("0"))); |
| | | tParkingRecordVO.setParkingFee(tParkingRecordVO.getOrderAmount()); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | // 查询总数 |
| | | TParkingRecordPageInfoVO infoVO = this.baseMapper.getParkingRecordCount(query); |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TRepair; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.mapper.TRepairMapper; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.constant.MsgConstants; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.core.utils.MsgUtil; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import jdk.nashorn.internal.parser.Token; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | /** |
| | | * 获取报修记录列表 |
| | |
| | | public List<TRepair> getRepairList(PageInfo<TRepair> pageInfo, String name, Integer siteId) { |
| | | //校验合作商权限 |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == siteId || 0 == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | if(null == siteId || 0 == siteId){ |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | Set<Integer> data = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | Set<Integer> data = partnerService.authSite(objectId, SiteMenu.REPAIR_RECORD); |
| | | siteIds = new ArrayList<>(data); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | }else{ |
| | | siteIds.add(siteId); |
| | | } |
| | | return this.baseMapper.getRepairList(pageInfo, name, siteIds); |
| | | List<TRepair> repairList = this.baseMapper.getRepairList(pageInfo, name, siteIds); |
| | | for (TRepair repair : repairList) { |
| | | repair.setAuthDelete(roleType == 1 ? true : partnerService.authMenu(objectId, repair.getSiteId(), SiteMenu.REPAIR_RECORD_DEL)); |
| | | } |
| | | return repairList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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 |
| | | 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 |
| | | # 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 id="pageList" resultType="com.ruoyi.chargingPile.api.vo.TParkingRecordVO"> |
| | | select |
| | | tpr.id, tpr.code,tpr.app_user_id, tpr.license_plate, tpr.vehicle_color, tpr.charging_order_id, tpr.parking_lot_id, tpr.in_parking_time, tpr.out_parking_time, |
| | | tpr.parking_duration, tpr.order_amount, tpr.status, tpr.out_parking_type, tpr.create_time,(tpr.order_amount - tpr.timeout_amount) as parkingFee,tpr.timeout_amount, |
| | | tpr.parking_duration, tpr.order_amount, tpr.status, tpr.out_parking_type, tpr.create_time,(tpr.order_amount + tpr.timeout_amount) as parkingFee,tpr.timeout_amount, |
| | | tpr.free_duration,(tpr.parking_duration - tpr.free_duration) as feeDuration,ts.name as siteName |
| | | from t_parking_record tpr |
| | | left join t_parking_lot tpl on tpr.parking_lot_id = tpl.id |
| | |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != query.siteIds and query.siteIds.size()>0" > |
| | | and tpl.site_id in |
| | | <foreach collection="query.siteIds" close=")" open="(" item="item" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | AND tpr.status = 3 |
| | | </where> |
| | | ORDER BY tpr.create_time DESC |
| | | </select> |
| | | <select id="getParkingRecordCount" resultType="com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO"> |
| | | SELECT count(id) as orderCount, |
| | | sum(timeout_amount) as timeoutAmountSum, |
| | | sum(parking_duration - free_duration) as feeDurationSum, |
| | | sum(parking_duration) as parkingDurationSum |
| | | from t_parking_record |
| | | SELECT count(tpr.id) as orderCount, |
| | | sum(tpr.timeout_amount) as timeoutAmountSum, |
| | | sum(tpr.parking_duration - tpr.free_duration) as feeDurationSum, |
| | | sum(tpr.parking_duration) as parkingDurationSum |
| | | from t_parking_record tpr |
| | | left join t_parking_lot tpl on tpr.parking_lot_id = tpl.id |
| | | |
| | | <where> |
| | | <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''"> |
| | | AND create_time BETWEEN #{query.startTime} AND #{query.endTime} |
| | |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != query.siteIds and query.siteIds.size()>0" > |
| | | and tpl.site_id in |
| | | <foreach collection="query.siteIds" close=")" open="(" item="item" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | AND status = 3 |
| | | </where> |
| | | |
| | | </select> |
| | | <select id="parkingData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%H:00' ) AS time, |
| | | DATE_FORMAT( t1.create_time, '%H:00' ) AS time, |
| | | count( 1 ) AS orders, |
| | | SUM( timeout_amount ) AS timeoutAmount |
| | | SUM( t1.timeout_amount ) AS timeoutAmount |
| | | FROM |
| | | t_parking_record |
| | | where DATE(create_time ) = CURDATE() |
| | | t_parking_record t1 |
| | | left join t_parking_lot t2 on t2.id = t1.parking_lot_id |
| | | where DATE(t1.create_time ) = CURDATE() |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | AND t1.parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | <if test="null != parkingRecordQueryDto.siteIds and parkingRecordQueryDto.siteIds.size()>0" > |
| | | and t2.site_id in |
| | | <foreach collection="parkingRecordQueryDto.siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | time |
| | |
| | | </select> |
| | | <select id="parkingDataByDate" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d' ) AS time, |
| | | DATE_FORMAT( t1.create_time, '%Y-%m-%d' ) AS time, |
| | | count( 1 ) AS orders, |
| | | SUM( timeout_amount ) AS timeoutAmount |
| | | SUM( t1.timeout_amount ) AS timeoutAmount |
| | | FROM |
| | | t_parking_record |
| | | t_parking_record t1 |
| | | left join t_parking_lot t2 on t2.id = t1.parking_lot_id |
| | | <where> |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | AND t1.parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | AND WEEKOFYEAR( t1. |
| | | create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 3"> |
| | | AND MONTH( create_time ) = MONTH(CURDATE()) |
| | | AND MONTH( t1.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 4"> |
| | | AND YEAR( create_time ) = YEAR(CURDATE() ) |
| | | AND YEAR( t1.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 5"> |
| | | <if test="parkingRecordQueryDto.startTime != null"> |
| | | AND create_time >= #{parkingRecordQueryDto.startTime} |
| | | AND t1.create_time >= #{parkingRecordQueryDto.startTime} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.endTime != null"> |
| | | AND create_time <= #{parkingRecordQueryDto.endTime} |
| | | AND t1.create_time <= #{parkingRecordQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | <if test="null != parkingRecordQueryDto.siteIds and parkingRecordQueryDto.siteIds.size()>0" > |
| | | and t2.site_id in |
| | | <foreach collection="parkingRecordQueryDto.siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | |
| | | </select> |
| | | <select id="getCarColor" resultType="java.util.Map"> |
| | | SELECT |
| | | vehicle_color,count(1) as counts |
| | | t1.vehicle_color,count(1) as counts |
| | | FROM |
| | | t_parking_record |
| | | t_parking_record t1 |
| | | left join t_parking_lot t2 on t2.id = t1.parking_lot_id |
| | | |
| | | <where> |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | AND t1.parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 1"> |
| | | AND DATE( create_time ) = CURDATE() |
| | | AND DATE( t1.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | AND WEEKOFYEAR( t1.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 3"> |
| | | AND MONTH( create_time ) = MONTH(CURDATE()) |
| | | AND MONTH( t1.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 4"> |
| | | AND YEAR( create_time ) = YEAR(CURDATE() ) |
| | | AND YEAR( t1.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 5"> |
| | | <if test="parkingRecordQueryDto.startTime != null"> |
| | | AND create_time >= #{parkingRecordQueryDto.startTime} |
| | | AND t1.create_time >= #{parkingRecordQueryDto.startTime} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.endTime != null"> |
| | | AND create_time <= #{parkingRecordQueryDto.endTime} |
| | | AND t1.create_time <= #{parkingRecordQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | <if test="null != parkingRecordQueryDto.siteIds and parkingRecordQueryDto.siteIds.size()>0" > |
| | | and t2.site_id in |
| | | <foreach collection="parkingRecordQueryDto.siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY vehicle_color |
| | | GROUP BY t1.vehicle_color |
| | | |
| | | </select> |
| | | <select id="getOutType" resultType="java.util.Map"> |
| | | SELECT |
| | | out_parking_type,count(1) as counts |
| | | t1.out_parking_type,count(1) as counts |
| | | FROM |
| | | t_parking_record |
| | | t_parking_record t1 |
| | | left join t_parking_lot t2 on t2.id = t1.parking_lot_id |
| | | <where> |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | AND t1.parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 1"> |
| | | AND DATE( create_time ) = CURDATE() |
| | | AND DATE( t1.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | AND WEEKOFYEAR( t1.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 3"> |
| | | AND MONTH( create_time ) = MONTH(CURDATE()) |
| | | AND MONTH( t1.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 4"> |
| | | AND YEAR( create_time ) = YEAR(CURDATE() ) |
| | | AND YEAR( t1.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 5"> |
| | | <if test="parkingRecordQueryDto.startTime != null"> |
| | | AND create_time >= #{parkingRecordQueryDto.startTime} |
| | | AND t1.create_time >= #{parkingRecordQueryDto.startTime} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.endTime != null"> |
| | | AND create_time <= #{parkingRecordQueryDto.endTime} |
| | | AND t1.create_time <= #{parkingRecordQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | <if test="null != parkingRecordQueryDto.siteIds and parkingRecordQueryDto.siteIds.size()>0" > |
| | | and t2.site_id in |
| | | <foreach collection="parkingRecordQueryDto.siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY out_parking_type |
| | | GROUP BY t1.out_parking_type |
| | | </select> |
| | | <select id="getIsCharge" resultType="java.util.Map"> |
| | | SELECT |
| | | CASE |
| | | WHEN charging_order_id IS NOT NULL THEN 'WithChargingOrder' |
| | | WHEN t1.charging_order_id IS NOT NULL THEN 'WithChargingOrder' |
| | | ELSE 'WithoutChargingOrder' |
| | | END AS order_status, |
| | | COUNT(*) AS counts |
| | | FROM |
| | | `t_parking_record` |
| | | `t_parking_record` t1 |
| | | left join t_parking_lot t2 on t2.id = t1.parking_lot_id |
| | | <where> |
| | | <if test="parkingRecordQueryDto.parkingLotId !=null"> |
| | | AND parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | AND t1.parking_lot_id = #{parkingRecordQueryDto.parkingLotId} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 1"> |
| | | AND DATE( create_time ) = CURDATE() |
| | | AND DATE( t1.create_time ) = CURDATE() |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 2"> |
| | | AND WEEKOFYEAR( create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | AND WEEKOFYEAR( t1.create_time ) = WEEKOFYEAR( CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 3"> |
| | | AND MONTH( create_time ) = MONTH(CURDATE()) |
| | | AND MONTH( t1.create_time ) = MONTH(CURDATE()) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 4"> |
| | | AND YEAR( create_time ) = YEAR(CURDATE() ) |
| | | AND YEAR( t1.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="parkingRecordQueryDto.dayType == 5"> |
| | | <if test="parkingRecordQueryDto.startTime != null"> |
| | | AND create_time >= #{parkingRecordQueryDto.startTime} |
| | | AND t1.create_time >= #{parkingRecordQueryDto.startTime} |
| | | </if> |
| | | <if test="parkingRecordQueryDto.endTime != null"> |
| | | AND create_time <= #{parkingRecordQueryDto.endTime} |
| | | AND t1.create_time <= #{parkingRecordQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | <if test="null != parkingRecordQueryDto.siteIds and parkingRecordQueryDto.siteIds.size()>0" > |
| | | and t2.site_id in |
| | | <foreach collection="parkingRecordQueryDto.siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | order_status |
| | |
| | | package com.ruoyi.chargingPile; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.chargingPile.api.dto.GetPermissionConfigurationDTO; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiChargingPileApplicationTests.class) |
| | | public class RuoYiChargingPileApplicationTests { |
| | | import javax.annotation.Resource; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiChargingPileApplication.class) |
| | | public class RuoYiChargingPileApplicationTests { |
| | | @Resource |
| | | private IPartnerService partnerService; |
| | | |
| | | @Test |
| | | public void test(){ |
| | | GetPermissionConfigurationDTO permissionConfiguration = partnerService.getPermissionConfiguration(9, 15); |
| | | System.err.println(JSON.toJSONString(permissionConfiguration)); |
| | | } |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/getCoupon") |
| | | public BaseResponse<GetCouponResp> getCoupon(GetCouponReq req){ |
| | | log.warn("停车获取优惠券请求参数:{}", JSON.toJSONString(req)); |
| | | log.info("停车获取优惠券请求参数:{}", JSON.toJSONString(req)); |
| | | GetCouponResp coupon = couponService.getCoupon(req); |
| | | log.info("停车获取优惠券结果:{}", JSON.toJSONString(coupon)); |
| | | return BaseResponse.ok(coupon); |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/usedCoupon") |
| | | public BaseResponse usedCoupon(UsedCoupon req){ |
| | | log.warn("停车使用优惠券请求参数:{}", JSON.toJSONString(req)); |
| | | log.info("停车使用优惠券请求参数:{}", JSON.toJSONString(req)); |
| | | couponService.usedCoupon(req); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingInOrder") |
| | | public BaseResponse cloudParkingInOrder(@RequestBody CloudParkingOrder order){ |
| | | log.warn("云停车入场请求参数:{}", JSON.toJSONString(order)); |
| | | log.info("云停车入场请求参数:{}", JSON.toJSONString(order)); |
| | | parkingOrderService.cloudParkingInOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingOutOrder") |
| | | public BaseResponse cloudParkingOutOrder(@RequestBody CloudParkingOrder order){ |
| | | log.warn("云停车出场请求参数:{}", JSON.toJSONString(order)); |
| | | log.info("云停车出场请求参数:{}", JSON.toJSONString(order)); |
| | | parkingOrderService.cloudParkingOutOrder(order); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/cloudParkingSpace") |
| | | public BaseResponse cloudParkingSpace(@RequestBody CloudParkingSpace parkingSpace){ |
| | | log.warn("云停车实时车位请求参数:{}", JSON.toJSONString(parkingSpace)); |
| | | log.info("云停车实时车位请求参数:{}", JSON.toJSONString(parkingSpace)); |
| | | parkingOrderService.cloudParkingSpace(parkingSpace); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingInOrder") |
| | | public BaseResponse offlineParkingInOrder(@RequestBody OfflineParkingOrder order){ |
| | | log.warn("线下停车场入场请求参数:{}", JSON.toJSONString(order)); |
| | | log.info("线下停车场入场请求参数:{}", JSON.toJSONString(order)); |
| | | parkingOrderService.offlineParkingInOrder(order); |
| | | OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse(); |
| | | offlineParkingResponse.setCode(0); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingOutOrder") |
| | | public BaseResponse offlineParkingOutOrder(@RequestBody OfflineParkingOrder order){ |
| | | log.warn("线下停车场出场请求参数:{}", JSON.toJSONString(order)); |
| | | log.info("线下停车场出场请求参数:{}", JSON.toJSONString(order)); |
| | | parkingOrderService.offlineParkingOutOrder(order); |
| | | OfflineParkingResponse offlineParkingResponse = new OfflineParkingResponse(); |
| | | offlineParkingResponse.setCode(0); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/offlineParkingSpace") |
| | | public BaseResponse offlineParkingSpace(@RequestBody OfflineParkingSpace parkingSpace){ |
| | | log.warn("线下停车场实时车位请求参数:{}", JSON.toJSONString(parkingSpace)); |
| | | log.info("线下停车场实时车位请求参数:{}", JSON.toJSONString(parkingSpace)); |
| | | parkingOrderService.offlineParkingSpace(parkingSpace); |
| | | return BaseResponse.ok(); |
| | | } |
| | |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appKey; |
| | | private String appkey; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | |
| | | /** |
| | | * 停车场appkey |
| | | */ |
| | | private String appKey; |
| | | private String appkey; |
| | | /** |
| | | * 车牌号 |
| | | */ |
| | |
| | | public GetCouponResp getCoupon(GetCouponReq req){ |
| | | //根据车牌查询入场时间,后再根据入场时间和车牌查询是否有充电订单 |
| | | String carNumber = req.getCarNumber(); |
| | | String appKey = req.getAppKey(); |
| | | String appKey = req.getAppkey(); |
| | | TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(appKey).getData(); |
| | | if(null == parkingLot){ |
| | | return null; |
| | |
| | | GetCouponResp resp = new GetCouponResp(); |
| | | resp.setRecordId(data.getId()); |
| | | resp.setCarNumber(carNumber); |
| | | resp.setSysOrgId("MXCD7QjHapTJGZ8TZZz3"); |
| | | resp.setSysOrgId("MXCD0001"); |
| | | resp.setPosName("明星电力"); |
| | | resp.setLssuer("admin"); |
| | | resp.setType(4); |
| | |
| | | }else{ |
| | | resp.setCouponName("充电停车时长优惠"); |
| | | parameter.setTime(parkingLot.getChargeFreeDuration()); |
| | | data.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | data.setChargingOrderId(tChargingOrder.getId()); |
| | | data.setAppUserId(tChargingOrder.getAppUserId()); |
| | | parkingRecordClient.updateParkingRecord(data); |
| | | } |
| | | resp.setParameter(parameter); |
| | | return resp; |
| | |
| | | package com.ruoyi.integration.barrierGate.server; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingRecordClient; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | |
| | | query.setLicensePlate(order.getPlate()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | LocalDateTime parse = LocalDateTime.parse(order.getLeaveDateTime(), DateTimeFormatter.ISO_DATE_TIME); |
| | | parse = parse.plusHours(8); |
| | | parkingRecord.setOutParkingTime(parse); |
| | |
| | | TChargingOrder chargingOrder = data.get(0); |
| | | parkingRecord.setAppUserId(chargingOrder.getAppUserId()); |
| | | parkingRecord.setChargingOrderId(chargingOrder.getId()); |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | parkingRecord.setPhone(appUser.getPhone()); |
| | | parkingRecord.setFreeDuration(parkingLot.getChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | |
| | | }else{ |
| | | parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getNonChargeFreeDuration() ? new BigDecimal(m - parkingLot.getNonChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | } |
| | | } |
| | | parkingRecord.setFreeAmount(parkingRecord.getOrderAmount().subtract(parkingRecord.getPayment())); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |
| | | |
| | |
| | | query.setLicensePlate(order.getPlatenumber()); |
| | | query.setStatus(1); |
| | | TParkingRecord parkingRecord = parkingRecordClient.getParkingRecord(query).getData(); |
| | | LocalDateTime parse = LocalDateTime.parse(order.getLeavetime(), DateTimeFormatter.ISO_DATE_TIME); |
| | | parse = parse.plusHours(8); |
| | | parkingRecord.setOutParkingTime(parse); |
| | | TParkingLot parkingLot = parkingLotClient.getParkingLotByAppKey(order.getAppkey()).getData(); |
| | | parkingRecord.setOutParkingTime(LocalDateTime.now()); |
| | | parkingRecord.setParkingDuration(Integer.valueOf(order.getLongTime())); |
| | | parkingRecord.setOrderAmount(new BigDecimal(order.getMoney())); |
| | | parkingRecord.setPayment(new BigDecimal(order.getMoney())); |
| | |
| | | TChargingOrder chargingOrder = data.get(0); |
| | | parkingRecord.setAppUserId(chargingOrder.getAppUserId()); |
| | | parkingRecord.setChargingOrderId(chargingOrder.getId()); |
| | | TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | parkingRecord.setPhone(appUser.getPhone()); |
| | | parkingRecord.setFreeDuration(parkingLot.getChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getChargeFreeDuration() ? new BigDecimal(m - parkingLot.getChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | |
| | | }else{ |
| | | parkingRecord.setFreeDuration(parkingLot.getNonChargeFreeDuration()); |
| | | long m = parkingRecord.getParkingDuration() - parkingRecord.getFreeDuration(); |
| | | parkingRecord.setTimeoutAmount(m > parkingLot.getNonChargeFreeDuration() ? new BigDecimal(m - parkingLot.getNonChargeFreeDuration()).multiply(parkingLot.getChargeRate()) : BigDecimal.ZERO); |
| | | } |
| | | } |
| | | parkingRecord.setFreeAmount(parkingRecord.getOrderAmount().subtract(parkingRecord.getPayment())); |
| | | parkingRecordClient.updateParkingRecord(parkingRecord); |
| | | } |
| | | |
| | |
| | | JSONObject jsonObject = JSON.parseObject(result); |
| | | Boolean success = jsonObject.getBoolean("success"); |
| | | if(!success){ |
| | | log.warn("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result); |
| | | log.info("调用开关道闸失败:\n请求参数:{}\n返回结果:{}", body, result); |
| | | } |
| | | return success; |
| | | } |
| | |
| | | * Instance-Id配置 d21a37d3-c578-43aa-a1ab-be3854e7c337 |
| | | */ |
| | | private String instanceId; |
| | | /** |
| | | * 设备ID |
| | | */ |
| | | private String deviceId; |
| | | /** |
| | | * 是否开启测试 |
| | | */ |
| | | private Boolean test; |
| | | /** |
| | | * 测试设备ID |
| | | */ |
| | | private String testDeviceId; |
| | | /** |
| | | * 测试充电桩号 |
| | | */ |
| | | private String testDriverCode; |
| | | |
| | | } |
| | |
| | | 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.ShowDeviceResp; |
| | | import com.ruoyi.integration.iotda.utils.api.IotInterfaceUtil; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | public R<DeleteDeviceResp> deleteDevice(@RequestParam("deviceId") String deviceId){ |
| | | return iotInterfaceUtil.deleteDeviceRequest(deviceId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询设备 |
| | | * @param deviceId |
| | | * @return |
| | | */ |
| | | @PostMapping("/showDeviceRequest") |
| | | public R<ShowDeviceResp> showDeviceRequest(@RequestParam("deviceId") String deviceId){ |
| | | return iotInterfaceUtil.showDeviceRequest(deviceId); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.integration.iotda.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.ruoyi.integration.api.model.*; |
| | | import com.ruoyi.integration.iotda.enums.ServiceIdMenu; |
| | | import com.ruoyi.integration.iotda.utils.produce.IotMessageProduce; |
| | |
| | | * @param confirmTransactionRecord 实体对象 |
| | | * @return |
| | | */ |
| | | @PostMapping("/confirmTransactionRecord") |
| | | public String confirmTransactionRecord(@RequestBody ConfirmTransactionRecord confirmTransactionRecord){ |
| | | return iotMessageProduce.sendMessage(confirmTransactionRecord.getTransaction_serial_number(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord)); |
| | | } |
| | | // @PostMapping("/confirmTransactionRecord") |
| | | // public String confirmTransactionRecord(@RequestBody ConfirmTransactionRecord confirmTransactionRecord){ |
| | | // return iotMessageProduce.sendMessage(confirmTransactionRecord.getTransaction_serial_number(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord)); |
| | | // } |
| | | |
| | | /** |
| | | * 远程账户余额更新 |
| | |
| | | */ |
| | | @PostMapping("/qrCodeDelivery") |
| | | public String qrCodeDelivery(@RequestBody QrCodeDelivery qrCodeDelivery){ |
| | | log.info("二维码下发:{}", JSON.toJSONString(qrCodeDelivery)); |
| | | return iotMessageProduce.sendMessage(qrCodeDelivery.getCharging_pile_code(), ServiceIdMenu.QR_CODE_DELIVERY.getKey(),messageUtil.qrCodeDelivery(qrCodeDelivery)); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.utils.CodeGenerateUtils; |
| | | import com.ruoyi.integration.api.vo.AddDeviceResp; |
| | | import com.ruoyi.integration.api.vo.DeleteDeviceResp; |
| | | import com.ruoyi.integration.api.vo.ShowDeviceResp; |
| | | import com.ruoyi.integration.iotda.builder.IotBuilder; |
| | | import com.ruoyi.integration.iotda.config.IotDAConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询设备 |
| | | * @param deviceId |
| | | * @return |
| | | */ |
| | | public R<ShowDeviceResp> showDeviceRequest(String deviceId) { |
| | | ShowDeviceRequest request = new ShowDeviceRequest(); |
| | | request.withDeviceId(deviceId); |
| | | try { |
| | | ShowDeviceResponse response = iotBuilder.buildIot().showDevice(request); |
| | | log.info("查询设备:{}",response.toString()); |
| | | ShowDeviceResp showDeviceResp = new ShowDeviceResp(); |
| | | BeanUtils.copyProperties(response, showDeviceResp); |
| | | return R.ok(showDeviceResp); |
| | | } catch (ConnectionException e) { |
| | | e.printStackTrace(); |
| | | } catch (RequestTimeoutException e) { |
| | | e.printStackTrace(); |
| | | } catch (ServiceResponseException e) { |
| | | e.printStackTrace(); |
| | | System.out.println(e.getHttpStatusCode()); |
| | | System.out.println(e.getRequestId()); |
| | | System.out.println(e.getErrorCode()); |
| | | System.out.println(e.getErrorMsg()); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | } |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.FileWriter; |
| | |
| | | private MessageUtil messageUtil; |
| | | @Autowired |
| | | private IotMessageProduce iotMessageProduce; |
| | | @Autowired |
| | | @Resource |
| | | private AccountingStrategyDetailClient accountingStrategyDetailClient; |
| | | /** |
| | | * 设备消息监听 |
| | |
| | | OnlineReply onlineReply = new OnlineReply(); |
| | | onlineReply.setCharging_pile_code(onlineMessage.getCharging_pile_code()); |
| | | onlineReply.setOnline_result(0); |
| | | result = iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ONLINE_REPLY.getKey(), messageUtil.onlineReply(onlineReply)); |
| | | result = iotMessageProduce.sendMessage(onlineReply.getCharging_pile_code(), 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)); |
| | | iotMessageProduce.sendMessage(timingSettingReplyOnline.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReplyOnline)); |
| | | sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | break; |
| | | case SendTagConstant.PING: |
| | |
| | | pong.setCharging_pile_code(pingMessage.getCharging_pile_code()); |
| | | pong.setCharging_gun_code(pingMessage.getCharging_gun_code()); |
| | | pong.setCharging_gun_status(0); |
| | | result = iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); |
| | | result = iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); |
| | | log.info("充电桩心跳包-返回结果:{}",result); |
| | | sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | break; |
| | |
| | | billingModeVerifyReply.setBilling_model_result(1); |
| | | } |
| | | } |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply)); |
| | | iotMessageProduce.sendMessage(billingModeVerifyReply.getCharging_pile_code(), ServiceIdMenu.BILLING_MODE_VERIFY_REPLY.getKey(),messageUtil.billingModeVerifyReply(billingModeVerifyReply)); |
| | | sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | break; |
| | | case SendTagConstant.ACQUISITION_BILLING_MODE: |
| | |
| | | acquisitionBillingModeReply.setBilling_model_code(accountingStrategyDetail.getId().toString()); |
| | | acquisitionBillingModeReply.setCharging_pile_code(acquisitionBillingModeMessage.getCharging_pile_code()); |
| | | acquisitionBillingModeReply.setLoss_ratio(BigDecimal.ZERO); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply)); |
| | | iotMessageProduce.sendMessage(acquisitionBillingModeReply.getCharging_pile_code(), ServiceIdMenu.ACQUISITION_BILLING_MODE_REPLY.getKey(),messageUtil.acquisitionBillingModeReply(acquisitionBillingModeReply)); |
| | | sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | break; |
| | | case SendTagConstant.UPLOAD_REAL_TIME_MONITORING_DATA: |
| | |
| | | platformConfirmationCharging.setAccount_balance(BigDecimal.ZERO); |
| | | platformConfirmationCharging.setAuthentication(1); |
| | | // TODO 若是失败,给出失败原因 |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.PLATFORM_CONFIRMATION_CHARGING.getKey(),messageUtil.platformConfirmationCharging(platformConfirmationCharging)); |
| | | iotMessageProduce.sendMessage(platformConfirmationCharging.getCharging_pile_code(), ServiceIdMenu.PLATFORM_CONFIRMATION_CHARGING.getKey(),messageUtil.platformConfirmationCharging(platformConfirmationCharging)); |
| | | sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | break; |
| | | case SendTagConstant.PLATFORM_START_CHARGING_REPLY: |
| | |
| | | break; |
| | | case SendTagConstant.TRANSACTION_RECORD: |
| | | TransactionRecordMessage transactionRecordMessage = JSON.parseObject(content.toJSONString(),TransactionRecordMessage.class); |
| | | transactionRecordMessage.setResult(content.toJSONString()); |
| | | chargingMessage.setTransactionRecordMessage(transactionRecordMessage); |
| | | // 响应硬件 |
| | | ConfirmTransactionRecord confirmTransactionRecord = new ConfirmTransactionRecord(); |
| | | confirmTransactionRecord.setTransaction_serial_number(transactionRecordMessage.getTransaction_serial_number()); |
| | | confirmTransactionRecord.setConfirm_result(0); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord)); |
| | | iotMessageProduce.sendMessage(transactionRecordMessage.getCharging_pile_code(), ServiceIdMenu.CONFIRM_TRANSACTION_RECORD.getKey(),messageUtil.confirmTransactionRecord(confirmTransactionRecord)); |
| | | sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | break; |
| | | case SendTagConstant.UPDATE_BALANCE_REPLY: |
| | |
| | | TimingSettingReply timingSettingReply = new TimingSettingReply(); |
| | | timingSettingReply.setCharging_pile_code(timingSettingMessage.getCharging_pile_code()); |
| | | timingSettingReply.setCurrent_time(CP56Time2aConverter.convertToCP56Time2a(new Date())); |
| | | iotMessageProduce.sendMessage(deviceId, ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply)); |
| | | iotMessageProduce.sendMessage(timingSettingReply.getCharging_pile_code(), ServiceIdMenu.TIMING_SETTING_REPLY.getKey(),messageUtil.timingSettingReply(timingSettingReply)); |
| | | sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | break; |
| | | case SendTagConstant.SETUP_BILLING_MODEL_REPLY: |
| | |
| | | @Autowired |
| | | private IotBuilder iotBuilder; |
| | | |
| | | @Autowired |
| | | private IotDAConfig config; |
| | | |
| | | |
| | | /** |
| | | * 设备消息下发 |
| | | * @param deviceId 设备id |
| | | * @param name 消息名称 |
| | | * @param message 消息内容 |
| | | * @return |
| | | */ |
| | | @PostMapping("/sendMessage") |
| | | public String sendMessage(String deviceId, String name, JSONObject message){ |
| | | public String sendMessage(String code, String name, JSONObject message){ |
| | | log.info("消息下发至设备:code={},name={},message={}", code, name, message); |
| | | CreateMessageRequest request = new CreateMessageRequest(); |
| | | request.withDeviceId(deviceId); |
| | | System.err.println(code); |
| | | System.err.println(JSONObject.toJSONString(config)); |
| | | request.withDeviceId(code); |
| | | DeviceMessageRequest body = new DeviceMessageRequest(); |
| | | body.withMessageId(UUID.randomUUID().toString()); |
| | | body.withName(name); |
| | |
| | | if (mongoChargingOrderQuery.getSiteId() != null){ |
| | | query.addCriteria(Criteria.where("siteId").is(mongoChargingOrderQuery.getSiteId())); |
| | | } |
| | | if (!mongoChargingOrderQuery.getSiteIds().isEmpty()){ |
| | | query.addCriteria(Criteria.where("siteId").in(mongoChargingOrderQuery.getSiteIds())); |
| | | } |
| | | if (mongoChargingOrderQuery.getChargingPileCode() != null && !mongoChargingOrderQuery.getChargingPileCode().isEmpty()) { |
| | | query.addCriteria(Criteria.where("charging_pile_code").is(mongoChargingOrderQuery.getChargingPileCode())); |
| | | } |
| | |
| | | private BigDecimal valley_charge12;// 谷电量 |
| | | private BigDecimal loss_valley_charge12;// 计损谷电量 |
| | | private BigDecimal valley_amount12;// 谷金额 |
| | | |
| | | private String result;//原始字符串 |
| | | |
| | | } |
| | | |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | --- |
| | | spring: |
| | | cloud: |
| | | stream: |
| | | rocketmq: |
| | | binder: |
| | | name-server: 127.0.0.1:9876 |
| | | # active: dev |
| | | active: prod |
| | | |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 192.168.110.169:8848 |
| | | server-addr: 127.0.0.1:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.169:8848 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | |
| | | 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: 127.0.0.1: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: 127.0.0.1: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: 127.0.0.1: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 com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.barrierGate.model.CloudParkingOrder; |
| | | import com.ruoyi.integration.barrierGate.server.ParkingOrderService; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | |
| | | public class RuoYiIntegrationApplicationTests { |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataService uploadRealTimeMonitoringDataService; |
| | | |
| | | @Resource |
| | | private ParkingOrderService parkingOrderService; |
| | | @Test |
| | | public void test(){ |
| | | List<UploadRealTimeMonitoringData> list = uploadRealTimeMonitoringDataService.getDataByOrderCode("CD93220241022154810850"); |
| | | System.err.println(JSON.toJSONString(list)); |
| | | String json = "{\"appkey\":\"842ae0c027e64b3590af9eea6\",\"enterChannel\":\"001\",\"enterChannelName\":\"进口\",\"enterDateTime\":\"2024-11-01T11:25:15.677Z\",\"id\":\"17B51DA0983C11EFA99CA979A8A8386B\",\"kind\":\"临时卡\",\"name\":\"临时识别\",\"plate\":\"川JD34056\",\"plateColor\":\"绿色\",\"sign\":\"29A902820C2657C51FBE90235152534F\"}"; |
| | | CloudParkingOrder order = JSON.parseObject(json, CloudParkingOrder.class); |
| | | parkingOrderService.cloudParkingInOrder(order); |
| | | } |
| | | } |
| | |
| | | import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; |
| | | import com.alibaba.nacos.shaded.com.google.common.collect.Maps; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.AccountListVO; |
| | |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private SiteClient siteClient; |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | @Resource |
| | | private TChargingOrderRefundService tChargingOrderRefundService; |
| | | @Resource |
| | | private TChargingBillService tChargingBillService; |
| | | @GetMapping(value = "/test") |
| | | public R accountAdd() { |
| | | // List<TChargingBill> list = tChargingBillService.lambdaQuery().list(); |
| | | // for (TChargingBill tChargingBill : list) { |
| | | // tChargingBill.setStatus(2); |
| | | // } |
| | | // tChargingBillService.updateBatchById(list); |
| | | // List<TChargingOrder> list = chargingOrderService.lambdaQuery().list(); |
| | | // for (TChargingOrder chargingOrder : list) { |
| | | // chargingOrder.setSharingAmount(new BigDecimal("0")); |
| | | // List<TChargingOrderRefund> list1 = tChargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, chargingOrder.getId()).list(); |
| | | // tChargingOrderRefundService.removeBatchByIds(list1); |
| | | // chargingOrderService.removeById(chargingOrder); |
| | | // } |
| | | // chargingOrderService.updateBatchById(list); |
| | | // TChargingBill tChargingBill = new TChargingBill(); |
| | | // Random random = new Random(); |
| | | // String randomDigits = random.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 |
| | | // .mapToObj(String::valueOf) |
| | | // .collect(Collectors.joining()); // 将其连接成一个字符串 |
| | | // tChargingBill.setCode("JSD"+randomDigits ); |
| | | // tChargingBill.setType(1); |
| | | // tChargingBill.setSiteId(0); |
| | | // tChargingBill.setBillTime(LocalDateTime.now().plusDays(1)); |
| | | // tChargingBill.setStatus(1); |
| | | // tChargingBill.setOrderState(2); |
| | | // tChargingBill.setBillType(1); |
| | | // chargingBillService.save(tChargingBill); |
| | | // TChargingBill tChargingBill1 = new TChargingBill(); |
| | | // Random random1 = new Random(); |
| | | // String randomDigits1 = random1.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 |
| | | // .mapToObj(String::valueOf) |
| | | // .collect(Collectors.joining()); // 将其连接成一个字符串 |
| | | // tChargingBill1.setCode("JSD"+randomDigits1); |
| | | // tChargingBill1.setType(2); |
| | | // tChargingBill1.setSiteId(13); |
| | | // tChargingBill1.setBillTime(LocalDateTime.now().plusDays(1)); |
| | | // tChargingBill1.setStatus(1); |
| | | // tChargingBill1.setOrderState(2); |
| | | // tChargingBill1.setBillType(1); |
| | | // chargingBillService.save(tChargingBill1); |
| | | // |
| | | // TChargingBill tChargingBil3 = new TChargingBill(); |
| | | // Random random2 = new Random(); |
| | | // String randomDigits2 = random2.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 |
| | | // .mapToObj(String::valueOf) |
| | | // .collect(Collectors.joining()); // 将其连接成一个字符串 |
| | | // tChargingBil3.setCode("JSD"+randomDigits2 ); |
| | | // tChargingBil3.setType(1); |
| | | // tChargingBil3.setSiteId(0); |
| | | // tChargingBil3.setBillTime(LocalDateTime.now().plusDays(1)); |
| | | // tChargingBil3.setStatus(1); |
| | | // tChargingBil3.setOrderState(2); |
| | | // tChargingBil3.setBillType(2); |
| | | // chargingBillService.save(tChargingBil3); |
| | | // TChargingBill tChargingBill14 = new TChargingBill(); |
| | | // Random random3 = new Random(); |
| | | // String randomDigits3 = random3.ints(10, 0, 10) // 生成10个随机数字,范围在0-9 |
| | | // .mapToObj(String::valueOf) |
| | | // .collect(Collectors.joining()); // 将其连接成一个字符串 |
| | | // tChargingBill14.setCode("JSD"+randomDigits3); |
| | | // tChargingBill14.setType(2); |
| | | // tChargingBill14.setSiteId(13); |
| | | // tChargingBill14.setBillTime(LocalDateTime.now().plusDays(1)); |
| | | // tChargingBill14.setStatus(1); |
| | | // tChargingBill14.setOrderState(2); |
| | | // tChargingBill14.setBillType(2); |
| | | // chargingBillService.save(tChargingBill14); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/accountSettlementStatement"}, logical = Logical.OR) |
| | | @PostMapping(value = "/accountBillList") |
| | | @ApiOperation(value = "列表查询", tags = {"管理后台-账户结算账单"}) |
| | | public R<AccountListVO> accountBillList(@RequestBody ChargingListQuery dto) { |
| | |
| | | ChargingBillVO res = chargingBillService.chargingBillList1(dto); |
| | | List<ChargingBillListVO> records = res.getList().getRecords(); |
| | | accountListVO.setBillCount(records.size()); |
| | | accountListVO.setTotalAmount(res.getPaymentAmount().subtract(res.getRefundAmount()) |
| | | .subtract(res.getCommissionAmount().setScale(2,BigDecimal.ROUND_DOWN)).subtract(res.getSharingAmount()).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setTotalAmount(res.getPaymentAmount().subtract(res.getRefundAmount()).subtract(res.getCommissionAmount()).subtract(res.getSharingAmount()).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setPaymentAmount(res.getPaymentAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setRefundAmount(res.getRefundAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | | accountListVO.setCommissionAmount(res.getCommissionAmount().setScale(2, BigDecimal.ROUND_DOWN)); |
| | |
| | | accountListVO.setOrderList(res.getExportList()); |
| | | return R.ok(accountListVO); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/chargeBill"}, logical = Logical.OR) |
| | | @PostMapping(value = "/chargingBillList") |
| | | @ApiOperation(value = "充电算帐单列表查询", tags = {"管理后台-充电算账单"}) |
| | | public AjaxResult<ChargingBillVO> chargingBillList(@RequestBody ChargingListQuery dto) { |
| | |
| | | public R<ChargingBillVO> chargingBillListExport(String uid) { |
| | | return R.ok(null); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeBill/export"}, logical = Logical.OR) |
| | | @ApiOperation(value = "导出", tags = {"管理后台-充电算账单"}) |
| | | @PutMapping("/export") |
| | | public void export(@RequestBody ChargingListQuery dto) |
| | | { |
| | | |
| | | ChargingBillVO res = chargingBillService.chargingBillList(dto); |
| | | List<ChargingBillListVO> list = res.getList().getRecords(); |
| | | List<TChargingBillExport> tChargingBillExports = new ArrayList<>(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/accountSettlementStatement/export"}, logical = Logical.OR) |
| | | @ApiOperation(value = "导出", tags = {"管理后台-账户结算账单"}) |
| | | @PutMapping("/exportAccount") |
| | | public void exportAccount(@RequestBody ChargingListQuery dto) |
| | |
| | | } |
| | | } |
| | | |
| | | @Autowired |
| | | private TChargingOrderRefundService tChargingOrderRefundService; |
| | | |
| | | |
| | | @ApiOperation(value = "下载-未出账", tags = {"管理后台-充电算账单"}) |
| | | @PutMapping("/download") |
| | | public void download(@RequestBody ExportUidDto uid) |
| | |
| | | chargingBillExport.setSiteName(data.get(0).getName()); |
| | | } |
| | | // // 根据账单的出账时间 查询上个月的充电订单 |
| | | // LocalDateTime localDate = byId.getBillTime().minusMonths(1); |
| | | LocalDateTime localDate = byId.getBillTime().minusMonths(1); |
| | | // // 账单周期 |
| | | // // 获取 LocalDate 对象 |
| | | // LocalDate date = localDate.toLocalDate(); |
| | | // // 获取该月份的第一天 |
| | | // LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | LocalDateTime localDate = byId.getBillTime().minusDays(1); |
| | | // todo 临时修改为前一天 |
| | | // 获取 LocalDate 对象 |
| | | LocalDate date = localDate.toLocalDate(); |
| | | // // 获取该月份的第一天 |
| | | // LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // // 获取该月份的最后一天 |
| | | // LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // todo 临时修改为查询昨天凌晨00:00:00 到 23:59:59 |
| | | LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN); |
| | | LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX); |
| | | // 获取该月份的第一天 |
| | | LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // 获取该月份的最后一天 |
| | | LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // 获取该月份的最后一天 |
| | | // LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | |
| | | BigDecimal paymentAmount = new BigDecimal("0"); |
| | | BigDecimal refundAmount = new BigDecimal("0"); |
| | | BigDecimal commissionAmount = new BigDecimal("0"); |
| | | BigDecimal sharingAmount = new BigDecimal("0"); |
| | | |
| | | List<TChargingOrder> tChargingOrders = chargingOrderService.list(eq); |
| | | // 累加支付金额 |
| | |
| | | int i =1; |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | // 账单信息 |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getChargeAmount()); |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(bigDecimal1)); |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getRechargeAmount()); |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(bigDecimal1).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | sharingAmount = sharingAmount.add(tChargingOrder.getSharingAmount()!=null?tChargingOrder.getSharingAmount():new BigDecimal("0")); |
| | | // 退款信息 |
| | | ChargingBillRefundExport chargingBillRefundExport = new ChargingBillRefundExport(); |
| | | ChargingBillPayExport chargingBillPayExport = new ChargingBillPayExport(); |
| | |
| | | chargingBillPayExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); |
| | | chargingBillPayExport.setCode(tChargingOrder.getCode()); |
| | | chargingBillPayExport.setPayTime(tChargingOrder.getPayTime()!=null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getPayTime())):""); |
| | | chargingBillPayExport.setPaymentAmount(tChargingOrder.getChargeAmount().toString()); |
| | | chargingBillPayExport.setPaymentAmount(tChargingOrder.getRechargeAmount().toString()); |
| | | chargingBillPayExport.setTotal(""); |
| | | chargingBillPayExports.add(chargingBillPayExport); |
| | | i++; |
| | | bigDecimal = bigDecimal.add(tChargingOrder.getChargeAmount()); |
| | | bigDecimal = bigDecimal.add(tChargingOrder.getRechargeAmount()); |
| | | } |
| | | if (!chargingBillPayExports.isEmpty()){ |
| | | chargingBillPayExports.get(0).setTotal(bigDecimal+""); |
| | |
| | | } |
| | | chargingBillExport.setPaymentAmount(paymentAmount); |
| | | chargingBillExport.setRefundAmount(refundAmount); |
| | | chargingBillExport.setIncome(paymentAmount.subtract(refundAmount).subtract(commissionAmount).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillExport.setIncome(paymentAmount.subtract(refundAmount).subtract(commissionAmount) |
| | | .subtract(sharingAmount).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillExports.add(chargingBillExport); |
| | | // 导出 |
| | | List<Map<String, Object>> sheetsList = new ArrayList<>(); |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | |
| | | private TSettlementConfirmService tSettlementConfirmService; |
| | | @Resource |
| | | private VipClient vipClient; |
| | | @PostMapping(value = "/chargingList") |
| | | @ApiOperation(value = "充电时段统计列表", tags = {"管理后台-财务结算"}) |
| | | public AjaxResult<ChargingOrderTimeVO> chargingList(@RequestBody ChargingListQuery dto) { |
| | | ChargingOrderTimeVO res = chargingOrderService.chargingList(dto); |
| | | return AjaxResult.success(res); |
| | | } |
| | | @GetMapping(value = "/chargingInfo") |
| | | @ApiOperation(value = "充电时段统计列表-查看详情", tags = {"管理后台-财务结算"}) |
| | | public AjaxResult<ChargingOrderListInfoVO> chargingInfo(String uid) { |
| | | ChargingOrderListInfoVO res = chargingOrderService.chargingInfo(uid); |
| | | return AjaxResult.success(res); |
| | | } |
| | | @Autowired |
| | | private SiteClient siteClient; |
| | | @Autowired |
| | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPeriodStatistics"}, logical = Logical.OR) |
| | | @PostMapping(value = "/chargingList") |
| | | @ApiOperation(value = "充电时段统计列表", tags = {"管理后台-财务结算"}) |
| | | public AjaxResult<ChargingOrderTimeVO> chargingList(@RequestBody ChargingListQuery dto) { |
| | | ChargingOrderTimeVO res = chargingOrderService.chargingList(dto); |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPeriodStatistics/order_info", "/chargingPeriodStatistics/charging_curve"}, logical = Logical.OR) |
| | | @GetMapping(value = "/chargingInfo") |
| | | @ApiOperation(value = "充电时段统计列表-查看详情", tags = {"管理后台-财务结算"}) |
| | | public AjaxResult<ChargingOrderListInfoVO> chargingInfo(String uid) { |
| | | ChargingOrderListInfoVO res = chargingOrderService.chargingInfo(uid); |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/chargingPeriodStatistics/export"}, logical = Logical.OR) |
| | | @ApiOperation(value = "充电时段统计-导出", tags = {"管理后台-财务结算"}) |
| | | @PutMapping("/export") |
| | | public void export(@RequestBody ChargingListQuery dto) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/summarySettlement"}, logical = Logical.OR) |
| | | @GetMapping(value = "/settlementTotal") |
| | | @ApiOperation(value = "结算汇总-列表查询", tags = {"管理后台-财务结算"}) |
| | | @ApiParam(name = "time", value = "汇报时间2024-01") |
| | |
| | | SettlementTotalVO res = chargingOrderService.settlementTotal(time); |
| | | return AjaxResult.success(res); |
| | | } |
| | | @GetMapping(value = "/settlementTotalR/{time}") |
| | | public R<SettlementTotalVO> settlementTotalR(@PathVariable("time")String time) { |
| | | |
| | | |
| | | |
| | | @GetMapping(value = "/settlementTotalR/{time}/{userId}") |
| | | public R<SettlementTotalVO> settlementTotalR(@PathVariable("time")String time,@PathVariable("userId")Long userId) { |
| | | time = time+"-01 00:00:00"; |
| | | SettlementTotalVO res = chargingOrderService.settlementTotal(time); |
| | | SettlementTotalVO res = chargingOrderService.settlementTotalR(time,userId); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/generateStatement"}, logical = Logical.OR) |
| | | @PostMapping(value = "/settlementAdd") |
| | | @ApiOperation(value = "结算确认表-生成/保存结算确认表", tags = {"管理后台-财务结算"}) |
| | | public R<TSettlementConfirm> settlementAdd(@RequestBody SettlementConfirmAdd dto) { |
| | | TSettlementConfirm res = chargingOrderService.settlementAdd(dto); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/balanceSheetRecord"}, logical = Logical.OR) |
| | | @PostMapping(value = "/settlementList") |
| | | @ApiOperation(value = "结算表记录-列表查询", tags = {"管理后台-财务结算"}) |
| | | public R<PageInfo<TSettlementConfirm>> settlementList(@RequestBody SettlementListQuery dto) { |
| | | PageInfo<TSettlementConfirm> res = chargingOrderService.settlementList(dto); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/balanceSheetRecord/del"}, logical = Logical.OR) |
| | | @GetMapping(value = "/deleteSettlement") |
| | | @ApiOperation(value = "结算表记录-删除", tags = {"管理后台-财务结算"}) |
| | | public R deleteSettlement(String uid) { |
| | | tSettlementConfirmService.removeById(uid); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping(value = "/downloadSettlement/{uid}") |
| | | public R<TSettlementConfirm> downloadSettlement(@PathVariable("uid") String uid) { |
| | | TSettlementConfirm byId = tSettlementConfirmService.getById(uid); |
| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.*; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | |
| | | @Resource |
| | | private TOrderInvoiceService invoiceService; |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 远程调用 增加管理后台赠送会员记录 |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceManagement/select_order", "/paymentOrder/order"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/list") |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"}) |
| | | public R<PageInfo<PayOrderDto>> payOrderList(@RequestBody PayOrderQueryDto payOrderQueryDto) { |
| | | return chargingOrderService.payOrderQuery(payOrderQueryDto); |
| | | Integer pageCurr = payOrderQueryDto.getPageCurr(); |
| | | Integer pageSize = payOrderQueryDto.getPageSize(); |
| | | payOrderQueryDto.setPageCurr(1); |
| | | payOrderQueryDto.setPageSize(10000999); |
| | | PageInfo<PayOrderDto> data = chargingOrderService.payOrderQuery(payOrderQueryDto).getData(); |
| | | List<PayOrderDto> res = new ArrayList<>(); |
| | | // 查询当前登陆人按钮权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data2 = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data2) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | |
| | | for (PayOrderDto record : data.getRecords()) { |
| | | if (record.getType() == 1){ |
| | | TChargingOrder byId = chargingOrderService.getById(record.getId()); |
| | | record.setSiteId(byId.getSiteId()); |
| | | } |
| | | if (record.getType()==4){ |
| | | Integer siteId=parkingLotClient.getSiteIdByOrderId(Long.valueOf(record.getId())).getData(); |
| | | if (siteId!=null){ |
| | | record.setSiteId(siteId); |
| | | } |
| | | } |
| | | if (roleType==1||(record.getType()!=1&&record.getType()!=4)){ |
| | | res.add(record); |
| | | continue; |
| | | } |
| | | if (roleType==2 && (record.getType()==1||record.getType()==4) && siteIds.contains(record.getSiteId())){ |
| | | res.add(record); |
| | | } |
| | | |
| | | } |
| | | List<PayOrderDto> res1 = testing5(res.size(), pageCurr, pageSize, res); |
| | | data.setTotal(res.size()); |
| | | data.setRecords(res1); |
| | | return R.ok(data); |
| | | } |
| | | public static List<PayOrderDto> testing5(long total, long current, long size, List<PayOrderDto> str){ |
| | | List<PayOrderDto> result = new ArrayList<>(); |
| | | //获取初始化分页结构 |
| | | com.ruoyi.order.util.Page<PayOrderDto> page = new com.ruoyi.order.util.Page().getPage(total, size, current - 1); |
| | | //获取集合下标初始值 |
| | | long startIndex = page.getStartIndex(); |
| | | //获取集合下标结束值 |
| | | long endInddex = 0; |
| | | if(startIndex + page.getCurrent() >= total || size > total){ |
| | | endInddex = total; |
| | | }else { |
| | | endInddex = Math.min(startIndex + page.getSize(), total); |
| | | } |
| | | //如果输入的开始查询下标大于集合大小,则查询为空值 |
| | | if(startIndex > total){ |
| | | result = Collections.emptyList(); |
| | | }else{ |
| | | result = str.subList((int)startIndex,(int)endInddex); |
| | | } |
| | | return result; |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund") |
| | |
| | | return chargingOrderService.payRefund(payOrderQueryDto); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/paymentOrder/order"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/pay/order/pay/detail") |
| | | @ApiOperation(value = "支付信息", tags = {"管理后台-支付订单-订单信息"}) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/paymentOrder/refund"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund/list") |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-退款订单"}) |
| | | public R<PageInfo<TChargingOrderRefund>> refundList(@RequestBody ChargingRefundDto chargingRefundDto) { |
| | | R<PageInfo<TChargingOrderRefund>> refundList = chargingOrderService.getRefundList(chargingRefundDto); |
| | | for (TChargingOrderRefund record : refundList.getData().getRecords()) { |
| | | record.setUid(record.getId().toString()); |
| | | Integer pageCurr = chargingRefundDto.getPageCurr(); |
| | | Integer pageSize = chargingRefundDto.getPageSize(); |
| | | // R<PageInfo<TChargingOrderRefund>> refundList = chargingOrderService.getRefundList(chargingRefundDto); |
| | | chargingRefundDto.setPageCurr(1); |
| | | chargingRefundDto.setPageSize(199999999); |
| | | R<PageInfo<TChargingOrderRefund>> refundList1 = chargingOrderService.getRefundList(chargingRefundDto); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | return refundList; |
| | | } |
| | | |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | // 查询当前登陆人按钮权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | List<TChargingOrderRefund> tChargingOrderRefunds = new ArrayList<>(); |
| | | for (TChargingOrderRefund record : refundList1.getData().getRecords()) { |
| | | if (roleType==1){ |
| | | tChargingOrderRefunds.add(record); |
| | | continue; |
| | | } |
| | | if (record.getType()!=1){ |
| | | tChargingOrderRefunds.add(record); |
| | | } |
| | | TChargingOrder byId = chargingOrderService.getById(record.getOrderId()); |
| | | record.setUid(record.getId().toString()); |
| | | if (byId==null){ |
| | | continue; |
| | | } |
| | | if (roleType==2&&siteIds.contains(byId.getSiteId())){ |
| | | |
| | | tChargingOrderRefunds.add(record); |
| | | } |
| | | } |
| | | PageInfo<TChargingOrderRefund> data = refundList1.getData(); |
| | | |
| | | List<TChargingOrderRefund> res1 = testing4(tChargingOrderRefunds.size(), pageCurr, pageSize, tChargingOrderRefunds); |
| | | data.setTotal(tChargingOrderRefunds.size()); |
| | | data.setRecords(res1); |
| | | return refundList1; |
| | | |
| | | } |
| | | public static List<TChargingOrderRefund> testing4(long total, long current, long size, List<TChargingOrderRefund> str){ |
| | | List<TChargingOrderRefund> result = new ArrayList<>(); |
| | | //获取初始化分页结构 |
| | | com.ruoyi.order.util.Page<TChargingOrderRefund> page = new com.ruoyi.order.util.Page().getPage(total, size, current - 1); |
| | | //获取集合下标初始值 |
| | | long startIndex = page.getStartIndex(); |
| | | //获取集合下标结束值 |
| | | long endInddex = 0; |
| | | if(startIndex + page.getCurrent() >= total || size > total){ |
| | | endInddex = total; |
| | | }else { |
| | | endInddex = Math.min(startIndex + page.getSize(), total); |
| | | } |
| | | //如果输入的开始查询下标大于集合大小,则查询为空值 |
| | | if(startIndex > total){ |
| | | result = Collections.emptyList(); |
| | | }else{ |
| | | result = str.subList((int)startIndex,(int)endInddex); |
| | | } |
| | | return result; |
| | | } |
| | | @ResponseBody |
| | | @PostMapping(value = "/pay/order/refund/list1") |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPileOrder"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingOrder") |
| | | @ApiOperation(value = "充电桩订单列表", tags = {"管理后台-订单管理"}) |
| | |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPileOrder/monitoring_record"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/chargingOrderInfo") |
| | | @ApiOperation(value = "充电桩订单列表查看详情", tags = {"管理后台-订单管理"}) |
| | |
| | | @GetMapping(value = "/getMyChargingOrderInfo") |
| | | @ApiOperation(value = "获取充电记订单明细", tags = {"小程序-充电记录"}) |
| | | public AjaxResult<MyChargingOrderInfo> getMyChargingOrderInfo(String id) { |
| | | TChargingOrder tChargingOrder = chargingOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!tChargingOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | MyChargingOrderInfo myChargingOrderInfo = chargingOrderService.getMyChargingOrderInfo(id); |
| | | return AjaxResult.success(myChargingOrderInfo); |
| | | } |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping(value = "/chargingOrderALICallback") |
| | | public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { |
| | | try { |
| | | String out_trade_no = aliQueryOrder.getOutTradeNo(); |
| | | String transaction_id = aliQueryOrder.getTradeNo(); |
| | | String attach = aliQueryOrder.getPassbackParams(); |
| | | AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | if (ajaxResult.isSuccess()) { |
| | | PrintWriter writer = response.getWriter(); |
| | | writer.println("success"); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | public void chargingOrderALICallback(@RequestParam("out_trade_no") String out_trade_no, |
| | | @RequestParam("transaction_id") String transaction_id, |
| | | @RequestParam("attach") String attach) { |
| | | chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | // @PostMapping("/endChargeBillingCharge1") |
| | | // public void endChargeBillingCharge1(@RequestBody TransactionRecordMessageVO vo){ |
| | | // log.info("-------------------停止充电返回账单后计算费用及修改业务状态-------------------:" + vo); |
| | | // chargingOrderService.endChargeBillingCharge1(vo); |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/six/charge") |
| | | @ApiOperation(value = "电站收入分析", tags = {"后台-数据分析-平台收入分析"}) |
| | | public R<List<SixChargingDto>> charge(Integer siteId) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (siteId==null){ |
| | |
| | | } |
| | | }else { |
| | | siteIds.add(siteId); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | //通过siteIds进行sql查询统计 |
| | |
| | | return months; |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/six/circle") |
| | | @ApiOperation(value = "电站收入占比", tags = {"后台-数据分析-平台收入分析"}) |
| | | public R<List<SixCircleDto>> circle() { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | |
| | | } |
| | | //进行统计groupBySiteId |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | List<SixCircleDto> sixCircleDtos = chargingOrderService.circle(siteIds,sixBefore); |
| | | for (SixCircleDto sixCircleDto : sixCircleDtos) { |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(sixCircleDto.getSiteId())).getData().get(0); |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/six/shop") |
| | | @ApiOperation(value = "购物收入", tags = {"后台-数据分析-平台收入分析"}) |
| | |
| | | return months; |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/shop") |
| | | @ApiOperation(value = "购物收入", tags = {"后台-工作台"}) |
| | |
| | | return R.ok(shopData); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/six/vip") |
| | | @ApiOperation(value = "vip收入", tags = {"后台-数据分析-平台收入分析"}) |
| | |
| | | return R.ok(vipDtos); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/six/total") |
| | | @ApiOperation(value = "底部数据分类", tags = {"后台-数据分析-平台收入分析"}) |
| | | public R<Map<String,Object>> total() { |
| | | //count近6个月的数据 |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | Map<String,Object> map = chargingOrderService.countAll(sixBefore); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | List<GetSiteListDTO> data9 = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data9) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | //进行统计groupBySiteId |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | Map<String,Object> map = chargingOrderService.countAll(sixBefore,siteIds); |
| | | BigDecimal data = parkingLotClient.getRecordAmount(sixBefore).getData(); |
| | | if (map ==null){ |
| | | map = new HashMap<String,Object>(); |
| | |
| | | } |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | private PartnerClient partnerClient; |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | @RequiresPermissions(value = {"/chargeOrderMonitoring"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/watch/chargingOrder") |
| | | @ApiOperation(value = "监控订单", tags = {"管理后台-订单管理"}) |
| | | public R watchChargingOrder(@RequestBody MongoChargingOrderQuery mongoChargingOrderQuery) { |
| | | |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (mongoChargingOrderQuery.getSiteId()==null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userid).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | }else { |
| | | siteIds.add(mongoChargingOrderQuery.getSiteId()); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | }else{ |
| | | if (roleType == 2){ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.watchChargingOrder(sysUser.getObjectId(),siteId).getData(); |
| | | Boolean b = t1.get(1); |
| | | if (b){ |
| | | integers.add(siteId); |
| | | } |
| | | } |
| | | siteIds = integers; |
| | | } |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | mongoChargingOrderQuery.setSiteIds(siteIds); |
| | | mongoChargingOrderQuery.setPageSize(10); |
| | | R<UploadRealTimeMonitoringPageData> all = uploadRealTimeMonitoringDataClient.getAll(mongoChargingOrderQuery); |
| | | UploadRealTimeMonitoringPageData data1 = all.getData(); |
| | | |
| | | List<ChargingOrderAndUploadRealTimeMonitoringDataDto> dtos = new ArrayList<>(); |
| | | Map<String,ChargingOrderVO> map = new HashMap<>(); |
| | | |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data1.getRecords()) { |
| | | if (roleType==2){ |
| | | List<Boolean> data = partnerClient.watchChargingOrder(sysUser.getObjectId(), uploadRealTimeMonitoringData.getSiteId()).getData(); |
| | | uploadRealTimeMonitoringData.setAuthInfo(data.get(0)); |
| | | uploadRealTimeMonitoringData.setAuthDelete(data.get(1)); |
| | | } |
| | | ChargingOrderAndUploadRealTimeMonitoringDataDto dataDto = new ChargingOrderAndUploadRealTimeMonitoringDataDto(); |
| | | ChargingOrderQuery dto = new ChargingOrderQuery(); |
| | | dto.setCode(uploadRealTimeMonitoringData.getTransaction_serial_number()); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeOrderMonitoring/del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/watch/deletes") |
| | | @ApiOperation(value = "监控订单-删除", tags = {"管理后台-订单管理"}) |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingOperationAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/charging/statistics") |
| | | @ApiOperation(value = "统计,充电订单分析", tags = {"管理后台-数据分析-充电运营分析"}) |
| | | public R<TCharingOrderMapVO> watchChargingOrder(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | List<Integer> siteIds =new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId()==null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | |
| | | }else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | if (siteIds.isEmpty())siteIds.add(-1); |
| | | TCharingOrderMapVO tCharingOrderMapVO = new TCharingOrderMapVO(); |
| | | |
| | | |
| | |
| | | public R<TCharingOrderPowerMapVO> power(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingUserAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/charging/users") |
| | | @ApiOperation(value = "除电站流量外", tags = {"管理后台-数据分析-充电用户分析"}) |
| | | public R<TCharingUserMapVO> users(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId()==null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | }else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | if (siteIds.isEmpty())siteIds.add(-1); |
| | | statisticsQueryDto.setSiteIds(siteIds); |
| | | |
| | | |
| | | TCharingUserMapVO tCharingUserMapVO = new TCharingUserMapVO(); |
| | | //上方折现 |
| | | if (statisticsQueryDto.getDayType()==1){ |
| | | List<Map<String,Object>> map = chargingOrderService.usersDay(); |
| | | List<Map<String,Object>> map = chargingOrderService.usersDay(statisticsQueryDto); |
| | | |
| | | List<Map<String, Object>> charMap = new ArrayList<>(); |
| | | // 生成从 "00:00" 到 "23:00" 的时间数据 |
| | |
| | | brands.add(objectMap.get("vehicle_brand").toString()); |
| | | } |
| | | |
| | | if (carBrandMap.size()>=5) { |
| | | Long count = chargingOrderService.countCar(brands); |
| | | Map<String, Object> others = new HashMap<>(); |
| | | others.put("vehicle_brand","其他"); |
| | | others.put("counts",count); |
| | | carBrandMap.add(others); |
| | | } |
| | | //本地车数量 |
| | | Map<String,Object> localCarMap = chargingOrderService.countLocalCar(); |
| | | |
| | |
| | | return R.ok(tCharingUserMapVO); |
| | | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingUserAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/charging/sites") |
| | | @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-充电用户分析"}) |
| | | public R<TCharingUserEvaluateVO> sites(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | List<Integer> siteIds =new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId()==null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | |
| | | return R.ok(tCharingUserEvaluateVO); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/operationMaintenanceAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/charging/equipment") |
| | | @ApiOperation(value = "电站评价", tags = {"管理后台-数据分析-设备运维分析"}) |
| | | public R<TCharingUserEquimentVO> equipment(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto){ |
| | | List<Integer> siteIds =new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId()==null||statisticsQueryDto.getSiteId()==0) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | |
| | | return Double.parseDouble(DF.format(average)); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/charge") |
| | | @ApiOperation(value = "上方充电数据统计", tags = {"管理后台-工作台"}) |
| | | public R<TCharingWorkVO> workCharge(@RequestBody ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/chargeDetail") |
| | | @ApiOperation(value = "运营情况", tags = {"管理后台-工作台"}) |
| | | public R workCharge(@RequestBody ChargingDetailQueryDto statisticsQueryDto) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/work/use") |
| | | @ApiOperation(value = "利用率", tags = {"管理后台-工作台"}) |
| | | public R workUse(@RequestBody ChargingDetailQueryDto statisticsQueryDto) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (statisticsQueryDto.getSiteId() == null) { |
| | | Long userId = SecurityUtils.getUserId(); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/work/shopOrder") |
| | | @ApiOperation(value = "购物订单统计", tags = {"管理后台-工作台"}) |
| | |
| | | return R.ok(counts); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/work/invoice") |
| | | @ApiOperation(value = "开票统计", tags = {"管理后台-工作台"}) |
| | |
| | | return R.ok(counts); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/workbench"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/work/users/count") |
| | | @ApiOperation(value = "用户数量", tags = {"管理后台-工作台"}) |
| | |
| | | import com.ruoyi.common.core.dto.ExchangeBackDto; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | |
| | | @Resource |
| | | private CouponClient couponClient; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/exchangeOrder"}, logical = Logical.OR) |
| | | @PostMapping("/getExchangeOrderList") |
| | | @ApiOperation(value = "列表查询", tags = {"管理后台-兑换订单"}) |
| | | public AjaxResult<PageInfo<TExchangeOrder>> getExchangeOrderList(@RequestBody ShoppingOrderQuery query) { |
| | |
| | | PageInfo<TExchangeOrder> res = exchangeOrderService.pageList(query); |
| | | return AjaxResult.success(res); |
| | | } |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/exchangeOrder/deliver_goods"}, logical = Logical.OR) |
| | | @GetMapping("/getShoppingOrderInfoById") |
| | | @ApiOperation(value = "根据订单id查看订单详情", tags = {"管理后台-兑换订单"}) |
| | | public AjaxResult<TExchangeOrder> getShoppingOrderList(String id) { |
| | |
| | | } |
| | | return AjaxResult.success(byId); |
| | | } |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/exchangeOrder/del"}, logical = Logical.OR) |
| | | @GetMapping("/deleteShoppingOrder") |
| | | @ApiOperation(value = "批量删除订单", tags = {"管理后台-兑换订单"}) |
| | | public AjaxResult<TExchangeOrder> deleteShoppingOrder(String ids) { |
| | | exchangeOrderService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/exchangeOrder/cancel"}, logical = Logical.OR) |
| | | @GetMapping("/cancelShoppingOrder") |
| | | @ApiOperation(value = "取消订单", tags = {"管理后台-兑换订单"}) |
| | | public AjaxResult cancelShoppingOrder(String id) { |
| | |
| | | appUserClient.refundPoints(byId.getAppUserId()+"-"+points); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/exchangeOrder/deliver_goods"}, logical = Logical.OR) |
| | | @GetMapping("/consignerShoppingOrder") |
| | | @ApiOperation(value = "发货", tags = {"管理后台-兑换订单"}) |
| | | public AjaxResult consignerShoppingOrder(String id,String companyName,String code) { |
| | |
| | | @ApiOperation(value = "获取兑换订单详情", tags = {"小程序-兑换记录"}) |
| | | public AjaxResult<ExchangeOrderGoodsInfo> getGoodsExchangeOrder(@PathVariable String id){ |
| | | ExchangeOrderGoodsInfo goodsExchangeOrder = exchangeOrderService.getGoodsExchangeOrder(id); |
| | | |
| | | TExchangeOrder exchangeOrder = exchangeOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!exchangeOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | return AjaxResult.success(goodsExchangeOrder); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "确认收货操作", tags = {"小程序-兑换记录"}) |
| | | public AjaxResult confirmReceipt(@PathVariable String id){ |
| | | TExchangeOrder tExchangeOrder = exchangeOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!tExchangeOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | if(tExchangeOrder.getStatus() == 3){ |
| | | return AjaxResult.error("不能重复确认收货"); |
| | | } |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.query.TOrderAppealQuery; |
| | | import com.ruoyi.order.api.vo.ChargingOrderVO; |
| | | import com.ruoyi.order.api.vo.TOrderAppealVO; |
| | | import com.ruoyi.order.dto.ManageFeedbackDto; |
| | | import com.ruoyi.order.dto.ManageOrderAppealQuery; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Resource |
| | | private TVipOrderService vipOrderService; |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | @Resource |
| | | private PartnerClient partnerService; |
| | | |
| | | @Resource |
| | | private UserSiteClient userSiteClient; |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private SysUserRoleClient sysUserRoleClient; |
| | | @Resource |
| | | private PartnerClient partnerClient; |
| | | |
| | | @Autowired |
| | | public TOrderAppealController(TOrderAppealService orderAppealService, TokenService tokenService) { |
| | | this.orderAppealService = orderAppealService; |
| | | this.tokenService = tokenService; |
| | | } |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appealOrder"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-订单管理-订单申诉"},value = "列表") |
| | | @PostMapping(value = "/manage/pageList") |
| | | public R<Page<TOrderAppeal>> managePageList(@RequestBody ManageOrderAppealQuery manageOrderAppealQuery) { |
| | | |
| | | Integer pageCurr = manageOrderAppealQuery.getPageCurr(); |
| | | Integer pageSize = manageOrderAppealQuery.getPageSize(); |
| | | Page<TOrderAppeal> page = orderAppealService.lambdaQuery().eq(manageOrderAppealQuery.getStatus() != null, TOrderAppeal::getStatus, manageOrderAppealQuery.getStatus()) |
| | | .like(manageOrderAppealQuery.getCode() != null, TOrderAppeal::getCode, manageOrderAppealQuery.getCode()) |
| | | .like(manageOrderAppealQuery.getPhone() != null, TOrderAppeal::getPhone, manageOrderAppealQuery.getPhone()) |
| | | .eq(manageOrderAppealQuery.getOrderType() != null, TOrderAppeal::getOrderType, manageOrderAppealQuery.getOrderType()) |
| | | .in(TOrderAppeal::getOrderType, 1, 2) |
| | | .orderByDesc(TOrderAppeal::getCreateTime) |
| | | .page(Page.of(manageOrderAppealQuery.getPageCurr(), manageOrderAppealQuery.getPageSize())); |
| | | |
| | | .page(Page.of(1, 99999999)); |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | List<TOrderAppeal> res = new ArrayList<>(); |
| | | for (TOrderAppeal record : page.getRecords()) { |
| | | record.setUid(record.getId().toString()); |
| | | record.setUid(record.getId()+""); |
| | | if (record.getOrderType()!=1){ |
| | | res.add(record); |
| | | continue; |
| | | } |
| | | if(roleType!=2){ |
| | | res.add(record); |
| | | continue; |
| | | } |
| | | if (roleType == 2 && record.getOrderType()==1){ |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (sysUser.getUserId() != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(sysUser.getUserId()).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | }else{ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.managePageListMenu(sysUser.getObjectId(),siteId).getData(); |
| | | |
| | | Boolean b = t1.get(2); |
| | | if (b){ |
| | | integers.add(siteId); |
| | | } |
| | | } |
| | | siteIds = integers; |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | TChargingOrder byId = chargingOrderService.getById(record.getOrderId()); |
| | | if (byId!=null&&siteIds.contains(byId.getSiteId())){ |
| | | res.add(record); |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> data = partnerClient.managePageListMenu(sysUser.getObjectId(), byId.getSiteId()).getData(); |
| | | record.setAuthInfo(data.get(0)); |
| | | record.setAuthHandle(data.get(1)); |
| | | } |
| | | if (byId==null){ |
| | | record.setAuthInfo(false); |
| | | record.setAuthHandle(false); |
| | | } |
| | | } |
| | | } |
| | | List<TOrderAppeal> res1 = testing4(res.size(), pageCurr, pageSize, res); |
| | | page.setCurrent(pageCurr); |
| | | page.setSize(pageSize); |
| | | page.setTotal(res.size()); |
| | | page.setRecords(res1); |
| | | return R.ok(page); |
| | | |
| | | |
| | | } |
| | | public static List<TOrderAppeal> testing4(long total, long current, long size, List<TOrderAppeal> str){ |
| | | List<TOrderAppeal> result = new ArrayList<>(); |
| | | //获取初始化分页结构 |
| | | com.ruoyi.order.util.Page<TOrderAppeal> page = new com.ruoyi.order.util.Page().getPage(total, size, current - 1); |
| | | //获取集合下标初始值 |
| | | long startIndex = page.getStartIndex(); |
| | | //获取集合下标结束值 |
| | | long endInddex = 0; |
| | | if(startIndex + page.getCurrent() >= total || size > total){ |
| | | endInddex = total; |
| | | }else { |
| | | endInddex = Math.min(startIndex + page.getSize(), total); |
| | | } |
| | | //如果输入的开始查询下标大于集合大小,则查询为空值 |
| | | if(startIndex > total){ |
| | | result = Collections.emptyList(); |
| | | }else{ |
| | | result = str.subList((int)startIndex,(int)endInddex); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/appealOrder/del"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-订单管理-订单申诉"},value = "删除") |
| | | @DeleteMapping (value = "/manage/delete") |
| | | public R<Page<TOrderAppeal>> delete(String ids) { |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appealOrder/select", "/appealOrder/handle"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-订单管理-订单申诉"},value = "后台-订单管理-订单申诉") |
| | | @PostMapping(value = "/manage/feedback") |
| | | public R manageFeedback(@RequestBody ManageFeedbackDto manageFeedbackDto) { |
| | |
| | | @GetMapping(value = "/getDetailById") |
| | | @ApiOperation(tags = {"小程序-订单申诉"},value = "查询订单申诉详情") |
| | | public AjaxResult<TOrderAppealVO> getDetailById(String id) { |
| | | TOrderAppeal orderAppeal = orderAppealService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!orderAppeal.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | return AjaxResult.ok(orderAppealService.getDetailById(id)); |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TOrderEvaluate; |
| | | import com.ruoyi.order.api.model.TOrderEvaluateTag; |
| | | import com.ruoyi.order.api.query.TOrderEvaluateQuery; |
| | |
| | | @Resource |
| | | private TOrderEvaluateTagService orderEvaluateTagService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeEvaluation/list"}, logical = Logical.OR) |
| | | @PostMapping(value = "/getPageList") |
| | | @ApiOperation(value = "获取充电评价列表", tags = {"管理后台-充电评价"}) |
| | | public AjaxResult<PageInfo<GetOrderEvaluatePageListDTO>> getPageList(@RequestBody GetOrderEvaluatePageList pageList){ |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeEvaluation/del"}, logical = Logical.OR) |
| | | @DeleteMapping(value = "/delOrderEvaluate/{id}") |
| | | @ApiOperation(value = "删除充电评价", tags = {"管理后台-充电评价"}) |
| | | public AjaxResult delOrderEvaluate(@PathVariable("id") Long id){ |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeEvaluation/reply"}, logical = Logical.OR) |
| | | @PostMapping(value = "/replyEvaluation") |
| | | @ApiOperation(value = "充电评价回复", tags = {"管理后台-充电评价"}) |
| | | public AjaxResult replyEvaluation(@RequestBody ReplyEvaluationVO vo){ |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargeEvaluation/del"}, logical = Logical.OR) |
| | | @DeleteMapping(value = "/delOrderEvaluateReply/{id}") |
| | | @ApiOperation(value = "删除充电评价回复", tags = {"管理后台-充电评价"}) |
| | | public AjaxResult delOrderEvaluateReply(@PathVariable("id") Long id){ |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TOrderInvoice; |
| | | import com.ruoyi.order.api.query.TOrderInvoiceQuery; |
| | | import com.ruoyi.order.api.vo.TOrderInvoiceVO; |
| | |
| | | @Resource |
| | | private TOrderInvoiceService orderInvoiceService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | return orderInvoiceService.addOrderInvoice(addOrderInvoice); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceManagement"}, logical = Logical.OR) |
| | | @PostMapping("/pageList") |
| | | @ApiOperation(value = "查询开票分页列表", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<PageInfo<TOrderInvoiceVO>> pageList(@RequestBody TOrderInvoiceQuery query){ |
| | | return AjaxResult.success(orderInvoiceService.pageList(query)); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceManagement/accept_hear_case"}, logical = Logical.OR) |
| | | @GetMapping("/uploadPdf") |
| | | @ApiOperation(value = "上传发票", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<String> uploadPdf(@RequestParam("id") Long id, |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceManagement"}, logical = Logical.OR) |
| | | @PostMapping("/statusCount") |
| | | @ApiOperation(value = "查询开票状态数量", tags = {"管理后台-发票管理"}) |
| | | public AjaxResult<Map<String,Integer>> statusCount(@RequestBody TOrderInvoiceQuery query){ |
| | |
| | | /** |
| | | * 发票管理导出 |
| | | */ |
| | | @RequiresPermissions(value = {"/invoiceManagement/export"}, logical = Logical.OR) |
| | | @ApiOperation(value = "发票管理导出", tags = {"管理后台-发票管理"}) |
| | | @Log(title = "发票管理导出", businessType = BusinessType.EXPORT) |
| | | @PutMapping("/export") |
| | |
| | | @GetMapping("/getMyOrderInvoiceInfo/{id}") |
| | | @ApiOperation(value = "获取开票记录详情", tags = {"小程序-充电发票"}) |
| | | public AjaxResult<MyOrderInvoiceInfo> getMyOrderInvoiceInfo(@PathVariable String id){ |
| | | TOrderInvoice orderInvoice = orderInvoiceService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!orderInvoice.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | MyOrderInvoiceInfo myOrderInvoiceInfo = orderInvoiceService.getMyOrderInvoiceInfo(id); |
| | | return AjaxResult.success(myOrderInvoiceInfo); |
| | | } |
| | |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.model.TChargingOrderRefund; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | |
| | | } |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder"}, logical = Logical.OR) |
| | | @PostMapping("/getShoppingOrderList") |
| | | @ApiOperation(value = "列表查询", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult<PageInfo<TShoppingOrder>> getShoppingOrderList(@RequestBody ShoppingOrderQuery query) { |
| | |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder/deliver_goods"}, logical = Logical.OR) |
| | | @GetMapping("/getShoppingOrderInfoById") |
| | | @ApiOperation(value = "根据订单id查看订单详情", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult<TShoppingOrder> getShoppingOrderList(String id) { |
| | |
| | | return AjaxResult.success(byId); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder/del"}, logical = Logical.OR) |
| | | @GetMapping("/deleteShoppingOrder") |
| | | @ApiOperation(value = "批量删除订单", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult<TShoppingOrder> deleteShoppingOrder(String ids) { |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder/cancel"}, logical = Logical.OR) |
| | | @GetMapping("/cancelShoppingOrder") |
| | | @ApiOperation(value = "取消订单", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult cancelShoppingOrder(String id) { |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/shoppingOrder/deliver_goods"}, logical = Logical.OR) |
| | | @GetMapping("/consignerShoppingOrder") |
| | | @ApiOperation(value = "发货", tags = {"管理后台-购物订单"}) |
| | | public AjaxResult consignerShoppingOrder(String id, String companyName, String code) { |
| | |
| | | |
| | | |
| | | @GetMapping("/getMyShoppingOrderInfo/{id}") |
| | | @ApiOperation(value = "获取购买订单详情", tags = {"小程序-商城购买订单", "管理后台-支付订单-订单信息"}) |
| | | @ApiOperation(value = "获取购买订单详情", tags = {"管理后台-支付订单-订单信息"}) |
| | | public AjaxResult<MyShoppingOrderInfo> getMyShoppingOrderInfo(@PathVariable String id) { |
| | | TShoppingOrder shoppingOrder = shoppingOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!shoppingOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | MyShoppingOrderInfo info = shoppingOrderService.getMyShoppingOrderInfo(id); |
| | | return AjaxResult.success(info); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getMyShoppingOrderInfo1/{id}") |
| | | @ApiOperation(value = "获取购买订单详情", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult<MyShoppingOrderInfo> getMyShoppingOrderInfo1(@PathVariable String id) { |
| | | TShoppingOrder shoppingOrder = shoppingOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!shoppingOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | MyShoppingOrderInfo info = shoppingOrderService.getMyShoppingOrderInfo(id); |
| | | return AjaxResult.success(info); |
| | | } |
| | |
| | | @ApiOperation(value = "确认收货操作", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult confirmReceipt(@PathVariable String id) { |
| | | TShoppingOrder shoppingOrder = shoppingOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!shoppingOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | if (shoppingOrder.getStatus() == 3) { |
| | | return AjaxResult.error("不能重复确认收货"); |
| | | } |
| | |
| | | @PutMapping("/cancelOrder/{id}") |
| | | @ApiOperation(value = "取消订单操作", tags = {"小程序-商城购买订单"}) |
| | | public AjaxResult cancelOrder(@PathVariable String id) { |
| | | TShoppingOrder shoppingOrder = shoppingOrderService.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!shoppingOrder.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | return shoppingOrderService.cancelOrder(id); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.order.api.model.TExchangeOrder; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | | import com.ruoyi.order.api.model.TVipOrder; |
| | |
| | | private TVipOrderService vipOrderService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipOrder"}, logical = Logical.OR) |
| | | @PostMapping("/getVipOrderList") |
| | | @ApiOperation(value = "列表查询", tags = {"管理后台-会员订单"}) |
| | | public AjaxResult<PageInfo<TVipOrder>> getVipOrderList(@RequestBody VipShoppingOrderQuery query) { |
| | |
| | | PageInfo<TVipOrder> res = vipOrderService.pageList(query); |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipOrder/add"}, logical = Logical.OR) |
| | | @PostMapping("/addVipOrder") |
| | | @ApiOperation(value = "添加会员订单", tags = {"管理后台-会员订单"}) |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder dto) { |
| | |
| | | vipOrderService.saveOrUpdate(dto); |
| | | return R.ok(dto.getId()); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipOrder/del"}, logical = Logical.OR) |
| | | @GetMapping("/deleteVipOrder") |
| | | @ApiOperation(value = "批量删除会员订单", tags = {"管理后台-会员订单"}) |
| | | public AjaxResult deleteVipOrder(String id) { |
| | | vipOrderService.removeBatchByIds(Arrays.asList(id.split(","))); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/callBack") |
| | | public R callBack(@RequestParam("code")String code,@RequestParam("outTradeNo")String outTradeNo){ |
| | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | |
| | | |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "导出") |
| | | @PutMapping(value = "/export") |
| | |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ChargingStatisticsQueryDto { |
| | |
| | | @ApiModelProperty("工作台用查询参数") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GTM+8") |
| | | private LocalDateTime selectDate; |
| | | private List<Integer> siteIds; |
| | | } |
| | |
| | | private List<String> tags; |
| | | @ApiModelProperty("回复内容") |
| | | private String recover; |
| | | @ApiModelProperty("回复按钮权限") |
| | | private Boolean authReply; |
| | | @ApiModelProperty("删除按钮权限") |
| | | private Boolean authDelete; |
| | | } |
| | |
| | | private String id; |
| | | @ApiModelProperty("1充电订单2购物订单3vip订单4停车订单") |
| | | private Integer type; |
| | | @ApiModelProperty("站点id") |
| | | private Integer siteId; |
| | | @ApiModelProperty("订单编号") |
| | | private String code; |
| | | @ApiModelProperty("订单标题") |
| | |
| | | |
| | | List<SixCircleDto> circle(@Param("siteIds")List<Integer> siteIds,@Param("sixBefore")LocalDate sixBefore); |
| | | |
| | | Map<String, Object> countAll(@Param("sixBefore")LocalDate sixBefore); |
| | | Map<String, Object> countAll(@Param("sixBefore")LocalDate sixBefore,@Param("siteIds")List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> getSumByType(@Param("chargingOrderIds")List<Long> chargingOrderIds); |
| | | |
| | |
| | | |
| | | List<Map<String, Object>> queryOrderCountAndMoneyBySiteIdDate(@Param("siteIds")List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> usersDay(); |
| | | List<Map<String, Object>> usersDay(@Param("statisticsQueryDto")ChargingStatisticsQueryDto statisticsQueryDto); |
| | | List<Map<String, Object>> usersDay1(); |
| | | |
| | | List<Map<String, Object>> usersByQuery(@Param("statisticsQueryDto") ChargingStatisticsQueryDto statisticsQueryDto); |
| | |
| | | |
| | | List<TSettlementConfirm> settlementList(@Param("pageInfo") PageInfo<TSettlementConfirm> pageInfo, @Param("req") SettlementListQuery dto); |
| | | |
| | | List<TSettlementConfirm> settlementTotal(@Param("time") String time); |
| | | List<TSettlementConfirm> settlementTotal(@Param("time") String time,@Param("siteIds")List<Integer> siteIds); |
| | | } |
| | |
| | | |
| | | List<SixCircleDto> circle(List<Integer> siteIds,LocalDate sixBefore); |
| | | |
| | | Map<String, Object> countAll(LocalDate sixBefore); |
| | | Map<String, Object> countAll(LocalDate sixBefore,List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> getSumByType(List<Long> chargingOrderIds); |
| | | |
| | |
| | | */ |
| | | void endChargeBillingCharge(TransactionRecordMessageVO vo); |
| | | |
| | | // /** |
| | | // * 停止充电返回账单后计算费用 |
| | | // * @param vo |
| | | // */ |
| | | // void endChargeBillingCharge1(TransactionRecordMessageVO vo); |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | List<Map<String, Object>> queryOrderCountAndMoneyBySiteIdDate(List<Integer> siteIds); |
| | | |
| | | List<Map<String, Object>> usersDay(); |
| | | List<Map<String, Object>> usersDay(ChargingStatisticsQueryDto statisticsQueryDto); |
| | | List<Map<String, Object>> usersDay1(); |
| | | |
| | | List<Map<String, Object>> usersByQuery(ChargingStatisticsQueryDto statisticsQueryDto); |
| | |
| | | PageInfo<TSettlementConfirm> settlementList(SettlementListQuery dto); |
| | | |
| | | SettlementTotalVO settlementTotal(String time); |
| | | SettlementTotalVO settlementTotalR(String time,Long userId); |
| | | |
| | | List<Map<String, Object>> countBySource(List<Integer> siteIds,ChargingStatisticsQueryDto statisticsQueryDto); |
| | | |
| | |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.service.TChargingBillService; |
| | | import com.ruoyi.order.service.TChargingOrderRefundService; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Service |
| | | public class TChargingBillServiceImpl extends ServiceImpl<TChargingBillMapper, TChargingBill> implements TChargingBillService { |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | @Resource |
| | | private TChargingOrderMapper chargingOrderList; |
| | | @Resource |
| | |
| | | private AppUserCarClient appUserCarClient; |
| | | @Resource |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private PartnerClient partnerClient; |
| | | |
| | | |
| | | @Override |
| | | public ChargingBillVO chargingBillList1(ChargingListQuery dto) { |
| | | if (dto.getState()!=null){ |
| | |
| | | startTime1 = split[0]; |
| | | startTime2 = split[1]; |
| | | } |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | // 查询当前登陆人按钮权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | if (dto.getSiteId()==null){ |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | }else { |
| | | siteIds.add(dto.getSiteId()); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | }else{ |
| | | if (roleType == 2){ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.getAccountMenu(sysUser.getObjectId(),siteId).getData(); |
| | | |
| | | Boolean b = t1.get(1); |
| | | if (b){ |
| | | integers.add(siteId); |
| | | } |
| | | } |
| | | siteIds = integers; |
| | | } |
| | | } |
| | | if (siteIds.isEmpty())siteIds.add(-1); |
| | | dto.setSiteIds(siteIds); |
| | | |
| | | |
| | | PageInfo<ChargingBillListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | PageInfo<ChargingBillListVO> pageInfo1 = new PageInfo<>(1,9999999); |
| | | List<ChargingBillListVO> list = this.baseMapper.chargingBillList1(pageInfo,dto,startTime1,startTime2); |
| | | List<ChargingBillListVO> list1 = this.baseMapper.chargingBillList1(pageInfo1,dto,startTime1,startTime2); |
| | | chargingBillVO.setOrderCount(list1.size()); |
| | | |
| | | BigDecimal paymentAmountTotal = new BigDecimal("0"); |
| | | BigDecimal orderAmountTotal = new BigDecimal("0"); |
| | | BigDecimal refundAmountTotal = new BigDecimal("0"); |
| | |
| | | BigDecimal chargingCapacityTotal = new BigDecimal("0"); |
| | | BigDecimal discountTotal = new BigDecimal("0"); |
| | | int orderCount = 0; |
| | | |
| | | for (ChargingBillListVO chargingBillListVO : list) { |
| | | if (roleType==2){ |
| | | List<Boolean> data = partnerClient.getAccountMenu(sysUser.getObjectId(), chargingBillListVO.getSiteId()).getData(); |
| | | chargingBillListVO.setAuthDownLoad(data.get(0)); |
| | | if (chargingBillListVO.getType()==1){ |
| | | continue; |
| | | } |
| | | } |
| | | String temp = ""; |
| | | String temp1 = ""; |
| | | switch (chargingBillListVO.getType()){ |
| | |
| | | |
| | | chargingBillListVO.setUid(chargingBillListVO.getId().toString()); |
| | | // 根据账单的出账时间 查询上个月的充电订单 |
| | | // LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1); |
| | | // todo 临时修改为查询昨天的充电订单 |
| | | LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1); |
| | | LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1); |
| | | // LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1); |
| | | // 账单周期 |
| | | chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM"))); |
| | | // 获取 LocalDate 对象 |
| | | LocalDate date = localDate.toLocalDate(); |
| | | // // 获取该月份的第一天 |
| | | // LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // // 获取该月份的最后一天 |
| | | // LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // todo 临时修改为查询昨天凌晨00:00:00 到 23:59:59 |
| | | LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN); |
| | | LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX); |
| | | LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // 获取该月份的最后一天 |
| | | LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | | .between("create_time", firstDayOfMonth, lastDayOfMonth) |
| | | .eq("status", 5) |
| | |
| | | List<TChargingOrder> tChargingOrders = chargingOrderList.selectList(eq); |
| | | int chargingSecond = 0; |
| | | BigDecimal paymentAmount = new BigDecimal("0"); |
| | | BigDecimal rechargeAmount = new BigDecimal("0"); |
| | | BigDecimal orderAmount = new BigDecimal("0"); |
| | | BigDecimal electrovalence = new BigDecimal("0"); |
| | | BigDecimal serviceCharge = new BigDecimal("0"); |
| | |
| | | if (data3!=null)tChargingOrder.setUserName(data3.getName()); |
| | | // 累加实收金额 支付结算金额 |
| | | if (tChargingOrder.getChargeAmount()!=null){ |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getChargeAmount()); |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getRechargeAmount()); |
| | | } |
| | | // 总金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | |
| | | // 累加累计电费 |
| | | if (tChargingOrder.getElectrovalence()!=null){ |
| | | electrovalence = electrovalence.add(tChargingOrder.getElectrovalence()); |
| | | } |
| | | if (tChargingOrder.getRechargeAmount()!=null){ |
| | | rechargeAmount = rechargeAmount.add(tChargingOrder.getRechargeAmount()); |
| | | } |
| | | List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) |
| | | .eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); |
| | |
| | | } |
| | | // 累加平台手续费 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006))); |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006)) |
| | | .setScale(2,BigDecimal.ROUND_DOWN)); |
| | | } |
| | | // 累加平台分佣 |
| | | if (tChargingOrder.getSharingAmount()!=null){ |
| | |
| | | chargingBillVO.setPaymentAmount(BigDecimal.ZERO); |
| | | } |
| | | |
| | | chargingBillListVO.setPaymentAmount(paymentAmount); |
| | | chargingBillListVO.setPaymentAmount(rechargeAmount); |
| | | chargingBillListVO.setOrderAmount(paymentAmount == null?BigDecimal.ZERO:orderAmount.subtract(sharingAmount).subtract(commissionAmount)); |
| | | chargingBillListVO.setRefundAmount(refundAmount == null?BigDecimal.ZERO:refundAmount); |
| | | chargingBillListVO.setElectrovalence(electrovalence == null?BigDecimal.ZERO:electrovalence); |
| | |
| | | chargingBillListVO.setCommissionAmount(commissionAmount == null?BigDecimal.ZERO:commissionAmount.setScale(2,BigDecimal.ROUND_DOWN)); |
| | | chargingBillListVO.setSharingAmount(sharingAmount == null?BigDecimal.ZERO:sharingAmount); |
| | | chargingBillListVO.setChargingCapacity(chargingCapacity == null?BigDecimal.ZERO:chargingCapacity); |
| | | chargingBillListVO.setBillMoney(paymentAmount.subtract(refundAmount==null?BigDecimal.ZERO:refundAmount) |
| | | chargingBillListVO.setBillMoney(rechargeAmount.subtract(refundAmount==null?BigDecimal.ZERO:refundAmount) |
| | | .subtract(commissionAmount.setScale(2,BigDecimal.ROUND_DOWN)).subtract(sharingAmount).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | switch (chargingBillListVO.getType()){ |
| | | case 1: |
| | |
| | | chargingBillListVO.setChargingSecond(chargingSecond); |
| | | } |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | |
| | | int i = 0; |
| | | for (ChargingBillListVO chargingBillListVO : list1) { |
| | | if (chargingBillListVO.getType()==2){ |
| | | if (chargingBillListVO.getSiteId()!=0&&!siteIds.contains(chargingBillListVO.getSiteId())){ |
| | | continue; |
| | | } |
| | | if (chargingBillListVO.getType()==1){ |
| | | continue; |
| | | } |
| | | i++; |
| | | LocalDateTime billTime = chargingBillListVO.getBillTime(); |
| | | // 将其转化为yyyy-MM格式字符串 |
| | | chargingBillVO.setCreateTime(billTime.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | |
| | | chargingBillVO.setBillWeek(billTime.minusMonths(1).format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM"))); |
| | | |
| | | chargingBillListVO.setUid(chargingBillListVO.getId().toString()); |
| | | // LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1); |
| | | // todo 临时修改为查询昨天的充电订单 |
| | | LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1); |
| | | LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1); |
| | | // 账单周期 |
| | | chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM"))); |
| | | // 获取 LocalDate 对象 |
| | | LocalDate date = localDate.toLocalDate(); |
| | | // // 获取该月份的第一天 |
| | | // LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // // 获取该月份的最后一天 |
| | | // LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // todo 临时修改为查询昨天凌晨00:00:00 到 23:59:59 |
| | | LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN); |
| | | LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX); |
| | | // 获取该月份的第一天 |
| | | LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // 获取该月份的最后一天 |
| | | LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | | .between("create_time", firstDayOfMonth, lastDayOfMonth) |
| | | .eq("status", 5) |
| | |
| | | chargingBillVO.setExportList(tChargingOrders); |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getChargeAmount()); |
| | | paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getRechargeAmount()); |
| | | } |
| | | |
| | | // 累加订单金额 |
| | |
| | | } |
| | | // 累加平台手续费 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006"))); |
| | | commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")) |
| | | .setScale(2,BigDecimal.ROUND_DOWN)); |
| | | } |
| | | // 累加平台分佣 |
| | | if (tChargingOrder.getSharingAmount()!=null){ |
| | |
| | | } |
| | | } |
| | | } |
| | | chargingBillVO.setOrderCount(i); |
| | | chargingBillVO.setChargingCapacity(chargingCapacityTotal); |
| | | chargingBillVO.setPaymentAmount(paymentAmountTotal); |
| | | chargingBillVO.setOrderAmount(paymentAmountTotal.subtract(refundAmountTotal).subtract(commissionAmountTotal).subtract(sharingAmountTotal)); |
| | |
| | | chargingBillVO.setList(pageInfo); |
| | | return chargingBillVO; |
| | | } |
| | | |
| | | @Override |
| | | public ChargingBillVO chargingBillList(ChargingListQuery dto) { |
| | | if (dto.getState()!=null){ |
| | |
| | | } |
| | | PageInfo<ChargingBillListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | PageInfo<ChargingBillListVO> pageInfo1 = new PageInfo<>(1,9999999); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | // 查询当前登陆人按钮权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | if (dto.getSiteId()==null){ |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | }else { |
| | | siteIds.add(dto.getSiteId()); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | }else{ |
| | | if (roleType == 2){ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.getChargingBillMenu(sysUser.getObjectId(),siteId).getData(); |
| | | |
| | | Boolean b = t1.get(1); |
| | | if (b){ |
| | | integers.add(siteId); |
| | | } |
| | | } |
| | | siteIds = integers; |
| | | } |
| | | } |
| | | |
| | | if (roleType==1){ |
| | | siteIds.add(0); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | dto.setSiteIds(siteIds); |
| | | |
| | | List<ChargingBillListVO> list = this.baseMapper.chargingBillList(pageInfo,dto,startTime1,startTime2); |
| | | List<ChargingBillListVO> list1 = this.baseMapper.chargingBillList(pageInfo1,dto,startTime1,startTime2); |
| | | BigDecimal paymentAmountTotal = new BigDecimal("0"); |
| | |
| | | BigDecimal sharingAmountTotal = new BigDecimal("0"); |
| | | BigDecimal chargingCapacityTotal = new BigDecimal("0"); |
| | | BigDecimal discountTotal = new BigDecimal("0"); |
| | | BigDecimal refundAmount = new BigDecimal("0"); |
| | | BigDecimal refundAmountTotal = new BigDecimal("0"); |
| | | int orderCount = 0; |
| | | |
| | | |
| | | List<ChargingBillListVO> chargingBillListVOS = new ArrayList<>(); |
| | | for (ChargingBillListVO chargingBillListVO : list) { |
| | | if (roleType==2 && chargingBillListVO.getSiteId()!=0){ |
| | | chargingBillListVOS.add(chargingBillListVO); |
| | | } |
| | | if (roleType ==1 && (siteIds.contains(chargingBillListVO.getSiteId())|| chargingBillListVO.getSiteId()==0)){ |
| | | chargingBillListVOS.add(chargingBillListVO); |
| | | } |
| | | } |
| | | for (ChargingBillListVO chargingBillListVO : chargingBillListVOS) { |
| | | if (chargingBillListVO.getSiteId()!=0&&!siteIds.contains(chargingBillListVO.getSiteId())){ |
| | | continue; |
| | | } |
| | | if (roleType == 2){ |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.getChargingBillMenu(sysUser.getObjectId(),chargingBillListVO.getSiteId()).getData(); |
| | | chargingBillListVO.setAuthDownLoad(t1.get(0)); |
| | | if (chargingBillListVO.getSiteId()==0){ |
| | | continue; |
| | | } |
| | | } |
| | | String temp = ""; |
| | | String temp1 = ""; |
| | | switch (chargingBillListVO.getType()){ |
| | |
| | | |
| | | chargingBillListVO.setUid(chargingBillListVO.getId().toString()); |
| | | // 根据账单的出账时间 查询上个月的充电订单 |
| | | // LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1); |
| | | // todo 临时修改为查询昨天的充电订单 |
| | | LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1); |
| | | LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1); |
| | | // LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1); |
| | | // 账单周期 |
| | | chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM"))); |
| | | // 获取 LocalDate 对象 |
| | | LocalDate date = localDate.toLocalDate(); |
| | | // // 获取该月份的第一天 |
| | | // LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // // 获取该月份的最后一天 |
| | | // LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // todo 临时修改为查询昨天凌晨00:00:00 到 23:59:59 |
| | | LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN); |
| | | LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX); |
| | | LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // 获取该月份的最后一天 |
| | | LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | | .between("create_time", firstDayOfMonth, lastDayOfMonth) |
| | | .eq("status", 5) |
| | |
| | | BigDecimal commissionAmount = new BigDecimal("0"); |
| | | BigDecimal sharingAmount = new BigDecimal("0"); |
| | | BigDecimal chargingCapacity = new BigDecimal("0"); |
| | | BigDecimal refundAmount = new BigDecimal("0"); |
| | | chargingBillVO.setCategory(""); |
| | | chargingBillListVO.setOrderCount(tChargingOrders.size()); |
| | | chargingBillVO.setExportList(tChargingOrders); |
| | |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); |
| | | } |
| | | // 总金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount()); |
| | | if (tChargingOrder.getRechargeAmount()!=null){ |
| | | orderAmount = orderAmount.add(tChargingOrder.getRechargeAmount()); |
| | | } |
| | | // 累加累计电费 |
| | | if (tChargingOrder.getElectrovalence()!=null){ |
| | |
| | | } |
| | | // 累加平台手续费 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006))); |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(BigDecimal.valueOf(0.006)) |
| | | .setScale(2,BigDecimal.ROUND_DOWN)); |
| | | } |
| | | // 累加平台分佣 |
| | | if (tChargingOrder.getSharingAmount()!=null){ |
| | |
| | | // 格式化为字符串 |
| | | String timeString = String.format("%d小时%d分钟%d秒", hours, minutes, seconds); |
| | | chargingBillVO.setChargingTime(timeString); |
| | | chargingBillListVO.setOrderAmount(orderAmount.subtract(refundAmount)); |
| | | |
| | | chargingBillListVO.setPaymentAmount(orderAmount.subtract(commissionAmount).subtract(sharingAmount).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | chargingBillListVO.setOrderAmount(orderAmount); |
| | | chargingBillListVO.setPaymentAmount(chargingBillListVO.getOrderAmount().subtract(commissionAmount).subtract(sharingAmount).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | chargingBillListVO.setElectrovalence(electrovalence); |
| | | chargingBillListVO.setServiceCharge(serviceCharge.setScale(2,BigDecimal.ROUND_DOWN)); |
| | | chargingBillListVO.setCommissionAmount(commissionAmount.setScale(2,BigDecimal.ROUND_DOWN)); |
| | |
| | | chargingBillListVO.setChargingSecond(chargingSecond); |
| | | } |
| | | for (ChargingBillListVO chargingBillListVO : list1) { |
| | | if (chargingBillListVO.getType() ==1){ |
| | | if (chargingBillListVO.getSiteId()!=0&&!siteIds.contains(chargingBillListVO.getSiteId())){ |
| | | continue; |
| | | } |
| | | if (roleType == 2){ |
| | | if (chargingBillListVO.getSiteId()==0){ |
| | | continue; |
| | | } |
| | | } |
| | | LocalDateTime billTime = chargingBillListVO.getBillTime(); |
| | | // 将其转化为yyyy-MM格式字符串 |
| | |
| | | |
| | | chargingBillListVO.setUid(chargingBillListVO.getId().toString()); |
| | | // 根据账单的出账时间 查询上个月的充电订单 |
| | | // LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1); |
| | | // todo 临时修改为查询昨天的充电订单 |
| | | LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1); |
| | | LocalDateTime localDate = chargingBillListVO.getBillTime().minusMonths(1); |
| | | // LocalDateTime localDate = chargingBillListVO.getBillTime().minusDays(1); |
| | | // 账单周期 |
| | | chargingBillListVO.setBillWeek(localDate.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM"))); |
| | | // 获取 LocalDate 对象 |
| | | LocalDate date = localDate.toLocalDate(); |
| | | // // 获取该月份的第一天 |
| | | // LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // // 获取该月份的最后一天 |
| | | // LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // todo 临时修改为查询昨天凌晨00:00:00 到 23:59:59 |
| | | LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN); |
| | | LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX); |
| | | LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // 获取该月份的最后一天 |
| | | LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | // LocalDateTime firstDayOfMonth = LocalDateTime.of(date, LocalTime.MIN); |
| | | // LocalDateTime lastDayOfMonth = LocalDateTime.of(date, LocalTime.MAX); |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | | .between("create_time", firstDayOfMonth, lastDayOfMonth) |
| | | .eq("status", 5) |
| | |
| | | paymentAmountTotal = paymentAmountTotal.add(tChargingOrder.getPaymentAmount()); |
| | | } |
| | | // 累加订单金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | orderAmount = orderAmount.add(tChargingOrder.getPaymentAmount()); |
| | | orderAmountTotal = orderAmountTotal.add(tChargingOrder.getPaymentAmount()); |
| | | if (tChargingOrder.getRechargeAmount()!=null){ |
| | | orderAmount = orderAmount.add(tChargingOrder.getRechargeAmount()); |
| | | orderAmountTotal = orderAmountTotal.add(tChargingOrder.getRechargeAmount()); |
| | | } |
| | | // 累加累计电费 |
| | | if (tChargingOrder.getElectrovalence()!=null){ |
| | |
| | | electrovalenceTotal = electrovalenceTotal.add(tChargingOrder.getElectrovalence()); |
| | | } |
| | | if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getRefundStatus() !=null && tChargingOrder.getRefundStatus() == 2){ |
| | | refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); |
| | | refundAmountTotal = refundAmountTotal.add(tChargingOrder.getRefundAmount()); |
| | | } |
| | | // 累加累计服务费 |
| | | if (tChargingOrder.getServiceCharge()!=null){ |
| | |
| | | } |
| | | // 累加平台手续费 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006"))); |
| | | commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006"))); |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | commissionAmountTotal = commissionAmountTotal.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")) |
| | | .setScale(2,BigDecimal.ROUND_DOWN)); |
| | | } |
| | | // 累加平台分佣 |
| | | if (tChargingOrder.getSharingAmount()!=null){ |
| | |
| | | } |
| | | } |
| | | chargingBillVO.setChargingCapacity(chargingCapacityTotal); |
| | | chargingBillVO.setPaymentAmount(orderAmountTotal.subtract(commissionAmountTotal).subtract(sharingAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setOrderAmount(orderAmountTotal.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setPaymentAmount(paymentAmountTotal.subtract(commissionAmountTotal).subtract(sharingAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setOrderAmount(orderAmountTotal.subtract(refundAmountTotal).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setElectrovalence(electrovalenceTotal.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setServiceCharge(serviceChargeTotal.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setOrderCount(orderCount); |
| | | chargingBillVO.setCommissionAmount(commissionAmountTotal.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setSharingAmount(sharingAmountTotal.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | chargingBillVO.setDiscount(discountTotal.setScale(2, BigDecimal.ROUND_DOWN)); |
| | | pageInfo.setRecords(list); |
| | | pageInfo.setRecords(chargingBillListVOS); |
| | | chargingBillVO.setList(pageInfo); |
| | | return chargingBillVO; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | int i = 8 % 20; |
| | | System.err.println(i); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 将时间转化为字符串 只保留年月日 格式为yyyy-MM-dd |
| | | String format = now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.account.api.vo.GetAppUserVipDetail; |
| | | import com.ruoyi.account.api.vo.GetInviteUser; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.*; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | | import com.ruoyi.chargingPile.api.vo.GetChargingGunByCode; |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.ChargingHandshakeClient; |
| | | import com.ruoyi.integration.api.feignClient.PlatformStartChargingReplyClient; |
| | | import com.ruoyi.integration.api.feignClient.SendMessageClient; |
| | |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.vo.*; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private TSettlementConfirmMapper tSettlementConfirmMapper; |
| | | |
| | | @Resource |
| | | private PartnerClient partnerClient; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | |
| | | if(2 == addChargingOrder.getPaymentType()){ |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(chargingOrder.getCode()); |
| | | req.setTotalAmount(chargingOrder.getPaymentAmount().toString()); |
| | | req.setTotalAmount(addChargingOrder.getPaymentAmount().toString()); |
| | | req.setSubject("充电充值"); |
| | | req.setBuyerOpenId(appUser.getAliOpenid()); |
| | | req.setBody("充电充值"); |
| | | req.setNotifyUrl("/payment/ali/callBack"); |
| | | AliPaymentResp data = aliPaymentClient.payment(req).getData(); |
| | | if(null != data){ |
| | | data.setNotifyUrl(data.getNotifyUrl() + "/order/t-charging-order/chargingOrderALICallback"); |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
| | |
| | | dto.setRefundReason("充电失败,取消充电订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date())); |
| | | AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", null); |
| | | if(success.isSuccess()){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TChargingOrder one = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, userId).eq(TChargingOrder::getChargingGunId, id) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).eq(TChargingOrder::getDelFlag, 0).orderByDesc(TChargingOrder::getStartTime).last(" limit 0, 1")); |
| | | if(null == one){ |
| | | if(null == one || !one.getAppUserId().equals(userId)){ |
| | | return null; |
| | | } |
| | | ChargingDetails chargingDetails = new ChargingDetails(); |
| | |
| | | Integer h = Integer.valueOf(data.getCumulative_charging_time() / 60); |
| | | Integer m = Integer.valueOf(data.getCumulative_charging_time() % 60); |
| | | chargingDetails.setChargedTime(String.format("%02d", h) + ":" + String.format("%02d", m)); |
| | | if(null != one.getAppUserCarId()){ |
| | | TAppUserCar appUserCar = appUserCarClient.getCarById(one.getAppUserCarId().toString()).getData(); |
| | | // 续航 = 续航里程 * soc |
| | | BigDecimal multiply = new BigDecimal(data.getSoc()).divide(new BigDecimal(100)).multiply(new BigDecimal(appUserCar.getEndurance())); |
| | | chargingDetails.setEndurance(multiply.setScale(2, RoundingMode.HALF_EVEN)); |
| | | } |
| | | //转换成UTC时间 |
| | | ChargingHandshake chargingHandshake = chargingHandshakeClient.getDataByOrderCode(one.getCode()).getData(); |
| | | if(null != chargingHandshake && null != data && null != one.getAppUserCarId()){ |
| | | BigDecimal bms_battery_capacity = chargingHandshake.getBms_battery_capacity(); |
| | | TAppUserCar appUserCar = appUserCarClient.getCarByIds(Arrays.asList(one.getAppUserCarId())).getData().get(0); |
| | | // 续航 = 电池容量 / 续航里程 * soc |
| | | BigDecimal divide = bms_battery_capacity.divide(new BigDecimal(appUserCar.getEndurance())); |
| | | BigDecimal multiply = new BigDecimal(data.getSoc() / 100).multiply(divide); |
| | | chargingDetails.setEndurance(multiply); |
| | | } |
| | | return chargingDetails; |
| | | } |
| | |
| | | } |
| | | if(status == 4 || status == 5){ |
| | | return AjaxResult.error("不能重复操作"); |
| | | } |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!order.getAppUserId().equals(userId)){ |
| | | return AjaxResult.error("权限不足"); |
| | | } |
| | | TChargingOrder chargingOrder = new TChargingOrder(); |
| | | chargingOrder.setId(Long.valueOf(id)); |
| | |
| | | if(1 == doubleIntegration){ |
| | | num1 *= 2; |
| | | } |
| | | |
| | | } |
| | | |
| | | GetInviteUser query = new GetInviteUser(); |
| | |
| | | } |
| | | dto.setUserIds(data); |
| | | } |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | // 查询当前登陆人按钮权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (dto.getSiteId()==null){ |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | }else { |
| | | siteIds.add(dto.getSiteId()); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | }else{ |
| | | if (roleType == 2){ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.getChargingOrderMenu(sysUser.getObjectId(),siteId).getData(); |
| | | |
| | | Boolean b = t1.get(1); |
| | | if (b){ |
| | | integers.add(siteId); |
| | | } |
| | | } |
| | | siteIds = integers; |
| | | } |
| | | } |
| | | if (siteIds.isEmpty())siteIds.add(-1); |
| | | dto.setSiteIds(siteIds); |
| | | List<ChargingOrderVO> list = this.baseMapper.chargingOrder(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); |
| | | List<ChargingOrderVO> list1 = this.baseMapper.chargingOrder(pageInfo1,dto,startTime1,startTime2,endTime1,endTime2); |
| | | BigDecimal total = new BigDecimal("0"); |
| | |
| | | BigDecimal income = new BigDecimal("0"); |
| | | BigDecimal electronicMoney = new BigDecimal("0"); |
| | | BigDecimal serviceMoney = new BigDecimal("0"); |
| | | BigDecimal commissionMoney = new BigDecimal("0"); |
| | | BigDecimal refundMoney = new BigDecimal("0"); |
| | | BigDecimal paymentMoney = new BigDecimal("0"); |
| | | |
| | | for (ChargingOrderVO chargingOrderVO : list) { |
| | | chargingOrderVO.setCommissionAmount(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006"))); |
| | | chargingOrderVO.setPlatFormMoney(chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006"))); |
| | | if (roleType == 2){ |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.getChargingOrderMenu(sysUser.getObjectId(),siteId).getData(); |
| | | chargingOrderVO.setAuthRecord(t1.get(0)); |
| | | } |
| | | |
| | | } |
| | | chargingOrderVO.setCommissionAmount(chargingOrderVO.getOrderAmount()!=null?chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006")):new BigDecimal("0")); |
| | | chargingOrderVO.setPlatFormMoney(chargingOrderVO.getOrderAmount()!=null?chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006")).setScale(2,BigDecimal.ROUND_DOWN):new BigDecimal("0")); |
| | | chargingOrderVO.setUid(chargingOrderVO.getId()+""); |
| | | TChargingGun data3 = chargingGunClient.getChargingGunById(chargingOrderVO.getChargingGunId()).getData(); |
| | | TChargingPile data2 = chargingPileClient.getChargingPileById(chargingOrderVO.getChargingPileId()).getData(); |
| | |
| | | List<TChargingOrderAccountingStrategy> chargingOrderId = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>() |
| | | .eq("charging_order_id", chargingOrderVO.getId())); |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderVO.getCode()).getData(); |
| | | if (data5!=null){ |
| | | if (data5!=null && data5.getCumulative_charging_time()!=null){ |
| | | long l = data5.getCumulative_charging_time() * 60L; |
| | | chargingOrderVO.setChargingSecond(l); |
| | | } |
| | |
| | | } |
| | | } |
| | | for (ChargingOrderVO chargingOrderVO : list1) { |
| | | paymentMoney= paymentMoney.add(chargingOrderVO.getPaymentAmount()!=null?chargingOrderVO.getPaymentAmount():new BigDecimal("0")); |
| | | commissionMoney = commissionMoney.add(chargingOrderVO.getOrderAmount()!=null?chargingOrderVO.getOrderAmount().multiply(new BigDecimal("0.006")):new BigDecimal("0")); |
| | | if (chargingOrderVO.getChargingCapacity()!=null){ |
| | | total = total.add(chargingOrderVO.getElectricity()); |
| | | total = total.add(chargingOrderVO.getElectricity()!=null?chargingOrderVO.getElectricity():new BigDecimal("0")); |
| | | } |
| | | // 充电订单 明细记录 |
| | | List<TChargingOrderAccountingStrategy> chargingOrderId = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>() |
| | | .eq("charging_order_id", chargingOrderVO.getId())); |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderVO.getCode()).getData(); |
| | | if (data5!=null){ |
| | | if (data5!=null && data5.getCumulative_charging_time()!=null){ |
| | | long l = data5.getCumulative_charging_time() * 60L; |
| | | chargingOrderVO.setChargingSecond(l); |
| | | time+=l; |
| | | } |
| | | electronicMoney = electronicMoney.add(chargingOrderVO.getElectrovalence()); |
| | | serviceMoney = serviceMoney.add(chargingOrderVO.getServiceCharge()); |
| | | |
| | | income = income.add(chargingOrderVO.getPaymentAmount()); |
| | | |
| | | |
| | | |
| | | List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) |
| | | .eq(TChargingOrderRefund::getChargingOrderId, chargingOrderVO.getId()).list(); |
| | | for (TChargingOrderRefund tChargingOrderRefund : list2) { |
| | | if (tChargingOrderRefund.getRefundStatus()==2){ |
| | | refundMoney = refundMoney.add(tChargingOrderRefund.getRefundTotalAmount()); |
| | | } |
| | | } |
| | | electronicMoney = electronicMoney.add(chargingOrderVO.getElectrovalence()!=null?chargingOrderVO.getElectrovalence():new BigDecimal("0")); |
| | | serviceMoney = serviceMoney.add(chargingOrderVO.getServiceCharge()!=null?chargingOrderVO.getServiceCharge():new BigDecimal("0")); |
| | | } |
| | | tCharingOrderVO.setTotal(total); |
| | | tCharingOrderVO.setTime(time); |
| | | tCharingOrderVO.setIncome(income); |
| | | tCharingOrderVO.setIncome(paymentMoney.subtract(commissionMoney)); |
| | | tCharingOrderVO.setElectronicMoney(electronicMoney); |
| | | tCharingOrderVO.setServiceMoney(serviceMoney); |
| | | pageInfo.setRecords(list); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> countAll(LocalDate sixBefore) { |
| | | return this.baseMapper.countAll(sixBefore); |
| | | public Map<String, Object> countAll(LocalDate sixBefore,List<Integer> siteIds) { |
| | | return this.baseMapper.countAll(sixBefore,siteIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return this.baseMapper.getYearData(chargingOrderIds); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | @Override |
| | | public ChargingOrderTimeVO chargingList(ChargingListQuery dto) { |
| | | String startTime1 = null; |
| | |
| | | dto.setCarIds(carIds); |
| | | } |
| | | } |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | // 查询当前登陆人按钮权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (dto.getSiteId()==null){ |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | }else { |
| | | siteIds.add(dto.getSiteId()); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | }else{ |
| | | if (roleType == 2){ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.getChargingOrderMenu(sysUser.getObjectId(),siteId).getData(); |
| | | |
| | | Boolean b = t1.get(1); |
| | | if (b){ |
| | | integers.add(siteId); |
| | | } |
| | | } |
| | | siteIds = integers; |
| | | } |
| | | } |
| | | dto.setSiteIds(siteIds); |
| | | PageInfo<ChargingOrderListVO> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<ChargingOrderListVO> list = this.baseMapper.chargingList(pageInfo,dto,startTime1,startTime2,endTime1,endTime2); |
| | | |
| | | for (ChargingOrderListVO chargingOrderListVO : list) { |
| | | if (roleType==2){ |
| | | List<Boolean> data = partnerClient.getChargingListMenu(sysUser.getObjectId(), chargingOrderListVO.getSiteId()).getData(); |
| | | chargingOrderListVO.setAuthInfo(data.get(0)); |
| | | chargingOrderListVO.setAuthCurve(data.get(1)); |
| | | } |
| | | chargingOrderListVO.setChargingCapacity(chargingOrderListVO.getElectricity()); |
| | | BigDecimal bigDecimal = new BigDecimal("0.006"); |
| | | if (chargingOrderListVO.getOrderAmount()!=null){ |
| | |
| | | chargingOrderListInfoVO.setStatus(chargingOrder.getStatus()); |
| | | BigDecimal bigDecimal = new BigDecimal("0.006"); |
| | | if (chargingOrder.getOrderAmount()!=null){ |
| | | chargingOrderListInfoVO.setCommissionAmount(chargingOrder.getOrderAmount().multiply(bigDecimal)); |
| | | BigDecimal multiply = chargingOrder.getPaymentAmount().multiply(bigDecimal); |
| | | chargingOrderListInfoVO.setCommissionAmount(multiply.setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | chargingOrderListInfoVO.setElectrovalence(chargingOrder.getElectrovalence()); |
| | | chargingOrderListInfoVO.setServiceCharge(chargingOrder.getServiceCharge()); |
| | |
| | | } |
| | | } |
| | | } |
| | | chargingOrderListInfoVO.setChargingCapacity(chargingOrder.getChargingCapacity()); |
| | | |
| | | chargingOrderListInfoVO.setEndMode(chargingOrder.getEndMode()); |
| | | |
| | |
| | | } |
| | | } |
| | | if (!data6.isEmpty()){ |
| | | // 第一条数据soc为开始 最后一条数据soc为结束soc |
| | | chargingOrderListInfoVO.setStartSoc(data6.get(data6.size()-1).getSoc().toString()); |
| | | chargingOrderListInfoVO.setEndSoc(data6.get(0).getSoc().toString()); |
| | | chargingOrderListInfoVO.setChargingCapacity(data6.get(data6.size()-1).getCharging_degree()); |
| | | int min = 100; |
| | | int max = 0; |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { |
| | | if (uploadRealTimeMonitoringData.getSoc()>max){ |
| | | max = uploadRealTimeMonitoringData.getSoc(); |
| | | } |
| | | if (uploadRealTimeMonitoringData.getSoc()!=0 &&uploadRealTimeMonitoringData.getSoc()<min){ |
| | | min = uploadRealTimeMonitoringData.getSoc(); |
| | | } |
| | | } |
| | | chargingOrderListInfoVO.setEndSoc(max+""); |
| | | chargingOrderListInfoVO.setStartSoc(min+""); |
| | | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data6) { |
| | |
| | | chargingOrderAccountingStrategyService.remove(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId())); |
| | | SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | List<AccountingStrategyDetailOrderVo> lists = new ArrayList<>(); |
| | | try { |
| | | //跨天 |
| | | if(!vo.getStart_time().split(" ")[0].equals(vo.getEnd_time().split(" ")[0])){ |
| | | //当天的 |
| | | //开始通过计费策略遍历解析每个时段的费用明细 |
| | | String start_time = vo.getStart_time(); |
| | | String end_time = vo.getEnd_time(); |
| | | long start = sdfs.parse(start_time).getTime(); |
| | | long end = sdfs.parse(end_time).getTime(); |
| | | Class<? extends TransactionRecordMessageVO> clazz = vo.getClass(); |
| | | /** |
| | | * "start_time": "2025-01-03 23:06:43.00", |
| | | * "end_time": "2025-01-04 00:39:39.00", |
| | | */ |
| | | for (int i = accountingStrategyDetailOrderList.size(); i > 0; i--) { |
| | | AccountingStrategyDetailOrder strategyDetail = accountingStrategyDetailOrderList.get(i - 1); |
| | | long time = sdfs.parse(start_time.split(" ")[0] + " " + strategyDetail.getEndTime() + ":00").getTime(); |
| | | if(time < start){ |
| | | break; |
| | | } |
| | | //阶段(1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段) |
| | | Object invoke = null; |
| | | switch (strategyDetail.getType()){ |
| | | case 1: |
| | | //充电度数 |
| | | invoke = clazz.getMethod("getSpike_charge" + (i)).invoke(vo); |
| | | break; |
| | | case 2: |
| | | //充电度数 |
| | | invoke = clazz.getMethod("getPeak_charge" + (i)).invoke(vo); |
| | | break; |
| | | case 3: |
| | | //充电度数 |
| | | invoke = clazz.getMethod("getFlat_charge" + (i)).invoke(vo); |
| | | break; |
| | | case 4: |
| | | //充电度数 |
| | | invoke = clazz.getMethod("getValley_charge" + (i)).invoke(vo); |
| | | break; |
| | | } |
| | | if(null == invoke || Double.valueOf(invoke.toString()) == 0){ |
| | | continue; |
| | | } |
| | | BigDecimal sharp_peak_charge = new BigDecimal(invoke.toString()); |
| | | AccountingStrategyDetailOrderVo vo1 = new AccountingStrategyDetailOrderVo(); |
| | | BeanUtils.copyProperties(strategyDetail, vo1); |
| | | vo1.setChargingCapacity(sharp_peak_charge); |
| | | lists.add(vo1); |
| | | } |
| | | |
| | | //第二天的 |
| | | //开始通过计费策略遍历解析每个时段的费用明细 |
| | | for (int i = 0; i < accountingStrategyDetailOrderList.size(); i++) { |
| | | AccountingStrategyDetailOrder strategyDetail = accountingStrategyDetailOrderList.get(i); |
| | | long time = sdfs.parse(end_time.split(" ")[0] + " " + strategyDetail.getStartTime() + ":00").getTime(); |
| | | if(time > end){ |
| | | break; |
| | | } |
| | | //阶段(1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段) |
| | | Object invoke = null; |
| | | switch (strategyDetail.getType()){ |
| | | case 1: |
| | | //充电度数 |
| | | invoke = clazz.getMethod("getSpike_charge" + (i + 1)).invoke(vo); |
| | | break; |
| | | case 2: |
| | | //充电度数 |
| | | invoke = clazz.getMethod("getPeak_charge" + (i + 1)).invoke(vo); |
| | | break; |
| | | case 3: |
| | | //充电度数 |
| | | invoke = clazz.getMethod("getFlat_charge" + (i + 1)).invoke(vo); |
| | | break; |
| | | case 4: |
| | | //充电度数 |
| | | invoke = clazz.getMethod("getValley_charge" + (i + 1)).invoke(vo); |
| | | break; |
| | | } |
| | | if(null == invoke || Double.valueOf(invoke.toString()) == 0){ |
| | | continue; |
| | | } |
| | | BigDecimal sharp_peak_charge = new BigDecimal(invoke.toString()); |
| | | AccountingStrategyDetailOrderVo vo1 = new AccountingStrategyDetailOrderVo(); |
| | | BeanUtils.copyProperties(strategyDetail, vo1); |
| | | vo1.setChargingCapacity(sharp_peak_charge); |
| | | lists.add(vo1); |
| | | } |
| | | }else{ |
| | | for (int i = 0; i < accountingStrategyDetailOrderList.size(); i++) { |
| | | Class<? extends TransactionRecordMessageVO> clazz = vo.getClass(); |
| | | try { |
| | | AccountingStrategyDetailOrder strategyDetail = accountingStrategyDetailOrderList.get(i); |
| | | //阶段(1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段) |
| | | Object invoke = null; |
| | |
| | | BigDecimal sharp_peak_charge = new BigDecimal(invoke.toString()); |
| | | AccountingStrategyDetailOrderVo vo1 = new AccountingStrategyDetailOrderVo(); |
| | | BeanUtils.copyProperties(strategyDetail, vo1); |
| | | vo1.setStart(sdfs.parse(vo.getStart_time().split(" ")[0] + " " + strategyDetail.getStartTime() + ":00").getTime()); |
| | | vo1.setEnd(sdfs.parse(vo.getStart_time().split(" ")[0] + " " + strategyDetail.getEndTime() + ":00").getTime()); |
| | | vo1.setChargingCapacity(sharp_peak_charge); |
| | | lists.add(vo1); |
| | | } catch (IllegalAccessException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (InvocationTargetException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (NoSuchMethodException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | Collections.sort(lists, new Comparator<AccountingStrategyDetailOrderVo>() { |
| | | public int compare(AccountingStrategyDetailOrderVo s1, AccountingStrategyDetailOrderVo s2) { |
| | | return s1.getStart() < s2.getStart() ? -1 : s1.getStart() == s2.getStart() ? 0 : 1; |
| | | } |
| | | }); |
| | | if(!vo.getStart_time().split(" ")[0].equals(vo.getEnd_time().split(" ")[0])){ |
| | | List<AccountingStrategyDetailOrderVo> list1 = new ArrayList<>(lists); |
| | | for (AccountingStrategyDetailOrderVo orderVo : list1) { |
| | | Calendar start = Calendar.getInstance(); |
| | | start.setTimeInMillis(orderVo.getStart()); |
| | | start.set(Calendar.DAY_OF_YEAR, start.get(Calendar.DAY_OF_YEAR) + 1); |
| | | orderVo.setStart(start.getTimeInMillis()); |
| | | Calendar end = Calendar.getInstance(); |
| | | end.setTimeInMillis(orderVo.getEnd()); |
| | | end.set(Calendar.DAY_OF_YEAR, end.get(Calendar.DAY_OF_YEAR) + 1); |
| | | orderVo.setEnd(end.getTimeInMillis()); |
| | | } |
| | | lists.addAll(list1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | //开始处理明细 |
| | | SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SS"); |
| | | SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm"); |
| | | Date start = null; |
| | | Date end = null; |
| | | try { |
| | | start = sdf3.parse(vo.getStart_time()); |
| | | end = sdf3.parse(vo.getEnd_time()); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | for (AccountingStrategyDetailOrderVo strategyDetail : lists) { |
| | | for (int i = 0; i < lists.size(); i++) { |
| | | AccountingStrategyDetailOrderVo strategyDetail = lists.get(i); |
| | | BigDecimal sharp_peak_charge = strategyDetail.getChargingCapacity(); |
| | | TChargingOrderAccountingStrategy chargingOrderAccountingStrategy = new TChargingOrderAccountingStrategy(); |
| | | chargingOrderAccountingStrategy.setChargingOrderId(chargingOrder.getId()); |
| | |
| | | chargingOrderAccountingStrategy.setElectrovalence(strategyDetail.getElectrovalence()); |
| | | chargingOrderAccountingStrategy.setServiceCharge(strategyDetail.getServiceCharge()); |
| | | chargingOrderAccountingStrategy.setCostServiceCharge(strategyDetail.getCostServiceCharge()); |
| | | |
| | | if(start.getTime() >= strategyDetail.getStart()){ |
| | | chargingOrderAccountingStrategy.setStartTime(sdf2.format(start)); |
| | | if(i == 0){ |
| | | String time = vo.getStart_time().split(" ")[1]; |
| | | chargingOrderAccountingStrategy.setStartTime(time.substring(0, time.lastIndexOf(":"))); |
| | | }else{ |
| | | chargingOrderAccountingStrategy.setStartTime(strategyDetail.getStartTime()); |
| | | } |
| | | if(end.getTime() >= strategyDetail.getEnd()){ |
| | | chargingOrderAccountingStrategy.setEndTime(strategyDetail.getEndTime()); |
| | | if(i == lists.size() - 1){ |
| | | String time = vo.getEnd_time().split(" ")[1]; |
| | | chargingOrderAccountingStrategy.setEndTime(time.substring(0, time.lastIndexOf(":"))); |
| | | }else{ |
| | | chargingOrderAccountingStrategy.setEndTime(sdf2.format(end)); |
| | | chargingOrderAccountingStrategy.setEndTime(strategyDetail.getEndTime()); |
| | | } |
| | | |
| | | //已充电总度数 |
| | | BigDecimal electrovalenc = strategyDetail.getElectrovalence().multiply(sharp_peak_charge).setScale(2, RoundingMode.DOWN); |
| | | BigDecimal originalServicePrice = strategyDetail.getServiceCharge().multiply(sharp_peak_charge).setScale(2, RoundingMode.DOWN); |
| | | BigDecimal electrovalenc = strategyDetail.getElectrovalence().multiply(sharp_peak_charge); |
| | | BigDecimal originalServicePrice = strategyDetail.getServiceCharge().multiply(sharp_peak_charge); |
| | | BigDecimal serviceCharge = originalServicePrice; |
| | | BigDecimal vipDiscountAmount = BigDecimal.ZERO; |
| | | //计算优惠金额 |
| | | if(null != chargingOrder.getVipDiscount()){ |
| | | vipDiscountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(chargingOrder.getVipDiscount())).setScale(2, RoundingMode.DOWN); |
| | | serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()).setScale(2, RoundingMode.DOWN); |
| | | vipDiscountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(chargingOrder.getVipDiscount())); |
| | | serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()); |
| | | } |
| | | chargingOrderAccountingStrategy.setChargingCapacity(sharp_peak_charge); |
| | | chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setCreateTime(LocalDateTime.now()); |
| | | chargingOrderAccountingStrategyService.save(chargingOrderAccountingStrategy); |
| | | |
| | | periodElectricPrice_total = periodElectricPrice_total.add(electrovalenc.setScale(2, RoundingMode.DOWN)); |
| | | periodServicePrice_total = periodServicePrice_total.add(originalServicePrice.setScale(2, RoundingMode.DOWN)); |
| | | total = total.add(electrovalenc.add(originalServicePrice.setScale(2, RoundingMode.DOWN))); |
| | | } |
| | | periodElectricPrice_total = periodElectricPrice_total.add(electrovalenc); |
| | | periodServicePrice_total = periodServicePrice_total.add(originalServicePrice); |
| | | total = total.add(electrovalenc.add(originalServicePrice)); |
| | | |
| | | } |
| | | |
| | | |
| | | //原金额 |
| | |
| | | //总金额(充值金额+会员折扣金额) |
| | | BigDecimal decimal = rechargeAmount.add(vipDiscountAmount); |
| | | //退款金额(已经计算了折扣优惠部分) |
| | | //如果充电总金额未使用完,则需要退回费用=(原金额/总金额)*(总金额-实际充电金额) |
| | | BigDecimal refundAmount = rechargeAmount.divide(decimal, new MathContext(4, RoundingMode.HALF_EVEN)).multiply(decimal.subtract(total)); |
| | | BigDecimal orderAmount = BigDecimal.valueOf(total.doubleValue()); |
| | | BigDecimal payAmount = BigDecimal.valueOf(total.doubleValue()); |
| | |
| | | |
| | | //服务费折扣 |
| | | discountAmount = periodServicePrice_total.multiply((new BigDecimal(1).subtract(chargingOrder.getVipDiscount()))); |
| | | periodServicePrice_total = periodServicePrice_total.multiply(chargingOrder.getVipDiscount()); |
| | | |
| | | TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | BigDecimal maximumDeduction = vip.getMaximumDeduction(); |
| | | //普通会员有最高优惠限制 |
| | |
| | | } |
| | | } |
| | | } |
| | | //会员折扣金额 |
| | | discountAmount = discountAmount.setScale(4, RoundingMode.HALF_EVEN); |
| | | payAmount = payAmount.subtract(discountAmount); |
| | | periodServicePrice_total = periodServicePrice_total.subtract(discountAmount); |
| | | |
| | | TChargingOrder order = new TChargingOrder(); |
| | | order.setId(chargingOrder.getId()); |
| | |
| | | }else{ |
| | | order.setEndMode(1); |
| | | } |
| | | order.setResidualAmount(rechargeAmount.subtract(total).setScale(2, RoundingMode.DOWN)); |
| | | order.setResidualAmount(rechargeAmount.subtract(total).setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setStartTime(LocalDateTime.parse(vo.getStart_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | order.setEndTime(LocalDateTime.parse(vo.getEnd_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | order.setStatus(5); |
| | | order.setOrderAmount(orderAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setVipDiscountAmount(discountAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setElectrovalence(periodElectricPrice_total.setScale(2, RoundingMode.DOWN)); |
| | | order.setOrderAmount(orderAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setVipDiscountAmount(discountAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setElectrovalence(periodElectricPrice_total.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setChargingCapacity(vo.getTotal_electricity()); |
| | | order.setElectricity(vo.getTotal_electricity()); |
| | | |
| | | //计算优惠券 |
| | | BigDecimal couponDiscount = BigDecimal.ZERO; |
| | | if(null != chargingOrder.getAppCouponId()){ |
| | | //判断实际充电金额是否满足优惠券使用条件,如果不满足则不适用优惠券。 |
| | | TAppCoupon appCoupon = appCouponClient.getAppCouponById(chargingOrder.getAppCouponId()).getData(); |
| | |
| | | BigDecimal couponDiscountAmount = tCoupon.getDiscountAmount(); |
| | | //如果优惠金额大于服务费金额,以服务费作为最大限制 |
| | | if(periodServicePrice_total.compareTo(couponDiscountAmount) < 0){ |
| | | refundAmount = refundAmount.add(periodServicePrice_total); |
| | | order.setCouponDiscountAmount(periodServicePrice_total); |
| | | payAmount = payAmount.subtract(periodServicePrice_total); |
| | | couponDiscount = periodServicePrice_total; |
| | | periodServicePrice_total = BigDecimal.ZERO; |
| | | }else{ |
| | | refundAmount = refundAmount.add(couponDiscountAmount); |
| | | order.setCouponDiscountAmount(couponDiscountAmount); |
| | | payAmount = payAmount.subtract(couponDiscountAmount); |
| | | periodServicePrice_total = periodServicePrice_total.subtract(couponDiscountAmount); |
| | | couponDiscount = couponDiscountAmount; |
| | | } |
| | | |
| | | appCoupon.setStatus(2); |
| | | appCouponClient.updateAppCoupon(appCoupon); |
| | | }else{ |
| | |
| | | divide = divide.compareTo(tCoupon.getMaximumDiscountAmount()) > 0 ? tCoupon.getMaximumDiscountAmount() : divide; |
| | | //如果优惠金额大于服务费金额,以服务费作为最大限制 |
| | | if(periodServicePrice_total.compareTo(divide) < 0){ |
| | | refundAmount = refundAmount.add(periodServicePrice_total); |
| | | order.setCouponDiscountAmount(periodServicePrice_total); |
| | | payAmount = payAmount.subtract(periodServicePrice_total); |
| | | couponDiscount = periodServicePrice_total; |
| | | periodServicePrice_total = BigDecimal.ZERO; |
| | | }else{ |
| | | refundAmount = refundAmount.add(divide); |
| | | order.setCouponDiscountAmount(divide); |
| | | payAmount = payAmount.subtract(divide); |
| | | periodServicePrice_total = periodServicePrice_total.subtract(divide); |
| | | couponDiscount = divide; |
| | | } |
| | | |
| | | appCoupon.setStatus(2); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.DOWN)); |
| | | order.setPaymentAmount(payAmount.setScale(2, RoundingMode.DOWN)); |
| | | order.setRefundAmount(refundAmount.setScale(2, RoundingMode.DOWN)); |
| | | //优惠券优惠金额 |
| | | couponDiscount = couponDiscount.setScale(4, RoundingMode.HALF_EVEN); |
| | | refundAmount = refundAmount.add(couponDiscount); |
| | | payAmount = payAmount.subtract(couponDiscount); |
| | | if(periodServicePrice_total.compareTo(BigDecimal.ZERO) > 0){ |
| | | periodServicePrice_total = periodServicePrice_total.subtract(couponDiscount); |
| | | } |
| | | order.setCouponDiscountAmount(couponDiscount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setPaymentAmount(payAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setRefundAmount(refundAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | order.setRefundStatus(1); |
| | | this.updateById(order); |
| | | chargingOrder = this.getById(order.getId()); |
| | |
| | | BigDecimal periodServicePrice = chargingOrderAccountingStrategy.getPeriodServicePrice(); |
| | | BigDecimal multiply = couponDiscountAmount.multiply(periodServicePrice.divide(reduce, new MathContext(4, RoundingMode.HALF_EVEN))); |
| | | periodServicePrice = periodServicePrice.subtract(multiply); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(periodServicePrice.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setCouponDiscountAmount(multiply.setScale(2, RoundingMode.DOWN)); |
| | | chargingOrderAccountingStrategy.setPeriodServicePrice(periodServicePrice.setScale(2, RoundingMode.HALF_EVEN)); |
| | | chargingOrderAccountingStrategy.setCouponDiscountAmount(multiply.setScale(2, RoundingMode.HALF_EVEN)); |
| | | } |
| | | chargingOrderAccountingStrategyService.updateBatchById(list); |
| | | } |
| | |
| | | dto.setRefundReason("充电完成退款"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", sdf1.format(new Date())); |
| | | AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", null); |
| | | if(success.isSuccess()){ |
| | | chargingOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | // /** |
| | | // * 停止充电返回账单后计算费用 |
| | | // * @param vo |
| | | // */ |
| | | // @Override |
| | | // @GlobalTransactional(rollbackFor = Exception.class) |
| | | // public void endChargeBillingCharge1(TransactionRecordMessageVO vo) { |
| | | // TChargingOrder chargingOrder = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getCode, vo.getTransaction_serial_number())); |
| | | // Integer status = chargingOrder.getStatus(); |
| | | //// if(status == 5){ |
| | | //// return; |
| | | //// } |
| | | // |
| | | // //如果使用优惠券需要判断优惠券是否满足使用条件 |
| | | // //根据实际的充电金额计算退款金额 退回费用=(原金额/总金额)*(总金额-实际充电金额) |
| | | // //退款金额=优惠券金额+剩余充电金额 |
| | | // BigDecimal periodElectricPrice_total = BigDecimal.ZERO; |
| | | // BigDecimal periodServicePrice_total = BigDecimal.ZERO; |
| | | // BigDecimal total = BigDecimal.ZERO; |
| | | // |
| | | // //获取订单的计费策略 |
| | | // List<AccountingStrategyDetailOrder> accountingStrategyDetailOrderList = accountingStrategyDetailOrderClient.getAllAccountingStrategyDetailOrder(chargingOrder.getId()).getData(); |
| | | // accountingStrategyDetailOrderList.get(accountingStrategyDetailOrderList.size() - 1).setEndTime("23:59"); |
| | | // //开始处理计费明细数据和优惠数据 |
| | | //// chargingOrderAccountingStrategyService.remove(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrder.getId())); |
| | | // SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // List<AccountingStrategyDetailOrderVo> lists = new ArrayList<>(); |
| | | // try { |
| | | // //跨天 |
| | | // if(!vo.getStart_time().split(" ")[0].equals(vo.getEnd_time().split(" ")[0])){ |
| | | // //当天的 |
| | | // //开始通过计费策略遍历解析每个时段的费用明细 |
| | | // String start_time = vo.getStart_time(); |
| | | // String end_time = vo.getEnd_time(); |
| | | // long start = sdfs.parse(start_time).getTime(); |
| | | // long end = sdfs.parse(end_time).getTime(); |
| | | // Class<? extends TransactionRecordMessageVO> clazz = vo.getClass(); |
| | | // /** |
| | | // * "start_time": "2025-01-03 23:06:43.00", |
| | | // * "end_time": "2025-01-04 00:39:39.00", |
| | | // */ |
| | | // for (int i = accountingStrategyDetailOrderList.size(); i > 0; i--) { |
| | | // AccountingStrategyDetailOrder strategyDetail = accountingStrategyDetailOrderList.get(i - 1); |
| | | // long time = sdfs.parse(start_time.split(" ")[0] + " " + strategyDetail.getEndTime() + ":00").getTime(); |
| | | // if(time < start){ |
| | | // break; |
| | | // } |
| | | // //阶段(1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段) |
| | | // Object invoke = null; |
| | | // switch (strategyDetail.getType()){ |
| | | // case 1: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getSpike_charge" + (i)).invoke(vo); |
| | | // break; |
| | | // case 2: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getPeak_charge" + (i)).invoke(vo); |
| | | // break; |
| | | // case 3: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getFlat_charge" + (i)).invoke(vo); |
| | | // break; |
| | | // case 4: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getValley_charge" + (i)).invoke(vo); |
| | | // break; |
| | | // } |
| | | // if(null == invoke || Double.valueOf(invoke.toString()) == 0){ |
| | | // continue; |
| | | // } |
| | | // BigDecimal sharp_peak_charge = new BigDecimal(invoke.toString()); |
| | | // AccountingStrategyDetailOrderVo vo1 = new AccountingStrategyDetailOrderVo(); |
| | | // BeanUtils.copyProperties(strategyDetail, vo1); |
| | | // vo1.setChargingCapacity(sharp_peak_charge); |
| | | // lists.add(vo1); |
| | | // } |
| | | // |
| | | // //第二天的 |
| | | // //开始通过计费策略遍历解析每个时段的费用明细 |
| | | // for (int i = 0; i < accountingStrategyDetailOrderList.size(); i++) { |
| | | // AccountingStrategyDetailOrder strategyDetail = accountingStrategyDetailOrderList.get(i); |
| | | // long time = sdfs.parse(end_time.split(" ")[0] + " " + strategyDetail.getStartTime() + ":00").getTime(); |
| | | // if(time > end){ |
| | | // break; |
| | | // } |
| | | // //阶段(1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段) |
| | | // Object invoke = null; |
| | | // switch (strategyDetail.getType()){ |
| | | // case 1: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getSpike_charge" + (i + 1)).invoke(vo); |
| | | // break; |
| | | // case 2: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getPeak_charge" + (i + 1)).invoke(vo); |
| | | // break; |
| | | // case 3: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getFlat_charge" + (i + 1)).invoke(vo); |
| | | // break; |
| | | // case 4: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getValley_charge" + (i + 1)).invoke(vo); |
| | | // break; |
| | | // } |
| | | // if(null == invoke || Double.valueOf(invoke.toString()) == 0){ |
| | | // continue; |
| | | // } |
| | | // BigDecimal sharp_peak_charge = new BigDecimal(invoke.toString()); |
| | | // AccountingStrategyDetailOrderVo vo1 = new AccountingStrategyDetailOrderVo(); |
| | | // BeanUtils.copyProperties(strategyDetail, vo1); |
| | | // vo1.setChargingCapacity(sharp_peak_charge); |
| | | // lists.add(vo1); |
| | | // } |
| | | // }else{ |
| | | // for (int i = 0; i < accountingStrategyDetailOrderList.size(); i++) { |
| | | // Class<? extends TransactionRecordMessageVO> clazz = vo.getClass(); |
| | | // AccountingStrategyDetailOrder strategyDetail = accountingStrategyDetailOrderList.get(i); |
| | | // //阶段(1=尖阶段,2=峰阶段,3=平阶段,4=谷阶段) |
| | | // Object invoke = null; |
| | | // switch (strategyDetail.getType()){ |
| | | // case 1: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getSpike_charge" + (i + 1)).invoke(vo); |
| | | // break; |
| | | // case 2: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getPeak_charge" + (i + 1)).invoke(vo); |
| | | // break; |
| | | // case 3: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getFlat_charge" + (i + 1)).invoke(vo); |
| | | // break; |
| | | // case 4: |
| | | // //充电度数 |
| | | // invoke = clazz.getMethod("getValley_charge" + (i + 1)).invoke(vo); |
| | | // break; |
| | | // } |
| | | // if(null == invoke || Double.valueOf(invoke.toString()) == 0){ |
| | | // continue; |
| | | // } |
| | | // BigDecimal sharp_peak_charge = new BigDecimal(invoke.toString()); |
| | | // AccountingStrategyDetailOrderVo vo1 = new AccountingStrategyDetailOrderVo(); |
| | | // BeanUtils.copyProperties(strategyDetail, vo1); |
| | | // vo1.setChargingCapacity(sharp_peak_charge); |
| | | // lists.add(vo1); |
| | | // } |
| | | // } |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // } |
| | | // |
| | | // //开始处理明细 |
| | | // for (int i = 0; i < lists.size(); i++) { |
| | | // AccountingStrategyDetailOrderVo strategyDetail = lists.get(i); |
| | | // BigDecimal sharp_peak_charge = strategyDetail.getChargingCapacity(); |
| | | // TChargingOrderAccountingStrategy chargingOrderAccountingStrategy = new TChargingOrderAccountingStrategy(); |
| | | // chargingOrderAccountingStrategy.setChargingOrderId(chargingOrder.getId()); |
| | | // chargingOrderAccountingStrategy.setAccountingStrategyDetailId(strategyDetail.getId()); |
| | | // chargingOrderAccountingStrategy.setType(strategyDetail.getType()); |
| | | // chargingOrderAccountingStrategy.setElectrovalence(strategyDetail.getElectrovalence()); |
| | | // chargingOrderAccountingStrategy.setServiceCharge(strategyDetail.getServiceCharge()); |
| | | // chargingOrderAccountingStrategy.setCostServiceCharge(strategyDetail.getCostServiceCharge()); |
| | | // if(i == 0){ |
| | | // String time = vo.getStart_time().split(" ")[1]; |
| | | // chargingOrderAccountingStrategy.setStartTime(time.substring(0, time.lastIndexOf(":"))); |
| | | // }else{ |
| | | // chargingOrderAccountingStrategy.setStartTime(strategyDetail.getStartTime()); |
| | | // } |
| | | // if(i == lists.size() - 1){ |
| | | // String time = vo.getEnd_time().split(" ")[1]; |
| | | // chargingOrderAccountingStrategy.setEndTime(time.substring(0, time.lastIndexOf(":"))); |
| | | // }else{ |
| | | // chargingOrderAccountingStrategy.setEndTime(strategyDetail.getEndTime()); |
| | | // } |
| | | // |
| | | // //已充电总度数 |
| | | // BigDecimal electrovalenc = strategyDetail.getElectrovalence().multiply(sharp_peak_charge); |
| | | // BigDecimal originalServicePrice = strategyDetail.getServiceCharge().multiply(sharp_peak_charge); |
| | | // BigDecimal serviceCharge = originalServicePrice; |
| | | // BigDecimal vipDiscountAmount = BigDecimal.ZERO; |
| | | // //计算优惠金额 |
| | | // if(null != chargingOrder.getVipDiscount()){ |
| | | // vipDiscountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(chargingOrder.getVipDiscount())); |
| | | // serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()); |
| | | // } |
| | | // chargingOrderAccountingStrategy.setChargingCapacity(sharp_peak_charge); |
| | | // chargingOrderAccountingStrategy.setPeriodElectricPrice(electrovalenc.setScale(4, RoundingMode.HALF_EVEN)); |
| | | // chargingOrderAccountingStrategy.setPeriodServicePrice(serviceCharge.setScale(4, RoundingMode.HALF_EVEN)); |
| | | // chargingOrderAccountingStrategy.setPeriodOriginalServicePrice(originalServicePrice.setScale(4, RoundingMode.HALF_EVEN)); |
| | | // chargingOrderAccountingStrategy.setVipDiscountAmount(vipDiscountAmount.setScale(4, RoundingMode.HALF_EVEN)); |
| | | // chargingOrderAccountingStrategy.setCreateTime(LocalDateTime.now()); |
| | | //// chargingOrderAccountingStrategyService.save(chargingOrderAccountingStrategy); |
| | | // System.err.println("----------"+JSON.toJSONString(chargingOrderAccountingStrategy)); |
| | | // |
| | | // periodElectricPrice_total = periodElectricPrice_total.add(electrovalenc); |
| | | // periodServicePrice_total = periodServicePrice_total.add(originalServicePrice); |
| | | // total = total.add(electrovalenc.add(originalServicePrice)); |
| | | // |
| | | // } |
| | | // |
| | | // |
| | | // //原金额 |
| | | // BigDecimal rechargeAmount = chargingOrder.getRechargeAmount(); |
| | | // BigDecimal vipDiscountAmount = chargingOrder.getVipDiscountAmount(); |
| | | // //总金额(充值金额+会员折扣金额) |
| | | // BigDecimal decimal = rechargeAmount.add(vipDiscountAmount); |
| | | // //退款金额(已经计算了折扣优惠部分) |
| | | // //如果充电总金额未使用完,则需要退回费用=(原金额/总金额)*(总金额-实际充电金额) |
| | | // BigDecimal refundAmount = rechargeAmount.divide(decimal, new MathContext(4, RoundingMode.HALF_EVEN)).multiply(decimal.subtract(total)); |
| | | // BigDecimal orderAmount = BigDecimal.valueOf(total.doubleValue()); |
| | | // BigDecimal payAmount = BigDecimal.valueOf(total.doubleValue()); |
| | | // //折扣金额 |
| | | // BigDecimal discountAmount = BigDecimal.ZERO; |
| | | //// if(null != chargingOrder.getVipDiscount()){ |
| | | //// TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | //// //判断会员是否还有充电优惠次数 |
| | | //// GetAppUserVipDetail getAppUserVipDetail = new GetAppUserVipDetail(); |
| | | //// getAppUserVipDetail.setAppUserId(chargingOrder.getAppUserId()); |
| | | //// getAppUserVipDetail.setVipId(appUser.getVipId()); |
| | | //// TAppUserVipDetail data = appUserVipDetailClient.getAppUserVipDetail(getAppUserVipDetail).getData(); |
| | | //// if(null != data && data.getChargeNum() > 0){ |
| | | //// data.setChargeNum(data.getChargeNum() - 1); |
| | | //// appUserVipDetailClient.updateAppUserVipDetail(data); |
| | | //// |
| | | //// //服务费折扣 |
| | | //// discountAmount = periodServicePrice_total.multiply((new BigDecimal(1).subtract(chargingOrder.getVipDiscount()))); |
| | | //// TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | //// BigDecimal maximumDeduction = vip.getMaximumDeduction(); |
| | | //// //普通会员有最高优惠限制 |
| | | //// if(vip.getType() == 1 && discountAmount.compareTo(maximumDeduction) > 0){ |
| | | //// discountAmount = maximumDeduction; |
| | | //// } |
| | | //// } |
| | | //// } |
| | | // //会员折扣金额 |
| | | // discountAmount = discountAmount.setScale(4, RoundingMode.HALF_EVEN); |
| | | // payAmount = payAmount.subtract(discountAmount); |
| | | // periodServicePrice_total = periodServicePrice_total.subtract(discountAmount); |
| | | // |
| | | // TChargingOrder order = new TChargingOrder(); |
| | | // order.setId(chargingOrder.getId()); |
| | | // order.setAppUserId(chargingOrder.getAppUserId()); |
| | | // UploadRealTimeMonitoringData uploadRealTimeMonitoringData = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | // if(null != uploadRealTimeMonitoringData && null == chargingOrder.getEndMode()){ |
| | | // Integer soc = uploadRealTimeMonitoringData.getSoc(); |
| | | // order.setEndMode(soc > 98 ? 2 : 3); |
| | | // }else{ |
| | | // order.setEndMode(1); |
| | | // } |
| | | // order.setResidualAmount(rechargeAmount.subtract(total).setScale(2, RoundingMode.HALF_EVEN)); |
| | | // order.setStartTime(LocalDateTime.parse(vo.getStart_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | // order.setEndTime(LocalDateTime.parse(vo.getEnd_time(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SS"))); |
| | | // order.setStatus(5); |
| | | // order.setOrderAmount(orderAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | // order.setVipDiscountAmount(discountAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | // order.setElectrovalence(periodElectricPrice_total.setScale(2, RoundingMode.HALF_EVEN)); |
| | | // order.setChargingCapacity(vo.getTotal_electricity()); |
| | | // order.setElectricity(vo.getTotal_electricity()); |
| | | // |
| | | // //计算优惠券 |
| | | // BigDecimal couponDiscount = BigDecimal.ZERO; |
| | | //// if(null != chargingOrder.getAppCouponId()){ |
| | | //// //判断实际充电金额是否满足优惠券使用条件,如果不满足则不适用优惠券。 |
| | | //// TAppCoupon appCoupon = appCouponClient.getAppCouponById(chargingOrder.getAppCouponId()).getData(); |
| | | //// String couponJson = appCoupon.getCouponJson(); |
| | | //// TCoupon tCoupon = JSON.parseObject(couponJson, TCoupon.class); |
| | | //// Integer preferentialMode = tCoupon.getPreferentialMode(); |
| | | //// if(1 == preferentialMode){ |
| | | //// //满减 |
| | | //// if(payAmount.compareTo(tCoupon.getMeetTheConditions()) >= 0){ |
| | | //// BigDecimal couponDiscountAmount = tCoupon.getDiscountAmount(); |
| | | //// //如果优惠金额大于服务费金额,以服务费作为最大限制 |
| | | //// if(periodServicePrice_total.compareTo(couponDiscountAmount) < 0){ |
| | | //// couponDiscount = periodServicePrice_total; |
| | | //// periodServicePrice_total = BigDecimal.ZERO; |
| | | //// }else{ |
| | | //// couponDiscount = couponDiscountAmount; |
| | | //// } |
| | | //// appCoupon.setStatus(2); |
| | | ////// appCouponClient.updateAppCoupon(appCoupon); |
| | | //// }else{ |
| | | //// order.setAppCouponId(null); |
| | | //// order.setCouponDiscountAmount(BigDecimal.ZERO); |
| | | ////// appCouponClient.refund(chargingOrder.getAppCouponId().toString()); |
| | | //// } |
| | | //// } |
| | | //// if(2 == preferentialMode){ |
| | | //// //抵扣 |
| | | //// if(payAmount.compareTo(tCoupon.getMeetTheConditions()) >= 0){ |
| | | //// //折扣金额 |
| | | //// BigDecimal divide = payAmount.multiply(new BigDecimal(10).subtract(tCoupon.getDiscount())).divide(new BigDecimal(10)); |
| | | //// divide = divide.compareTo(tCoupon.getMaximumDiscountAmount()) > 0 ? tCoupon.getMaximumDiscountAmount() : divide; |
| | | //// //如果优惠金额大于服务费金额,以服务费作为最大限制 |
| | | //// if(periodServicePrice_total.compareTo(divide) < 0){ |
| | | //// couponDiscount = periodServicePrice_total; |
| | | //// periodServicePrice_total = BigDecimal.ZERO; |
| | | //// }else{ |
| | | //// couponDiscount = divide; |
| | | //// } |
| | | //// |
| | | //// appCoupon.setStatus(2); |
| | | //// appCouponClient.updateAppCoupon(appCoupon); |
| | | //// }else{ |
| | | //// order.setAppCouponId(null); |
| | | //// order.setCouponDiscountAmount(BigDecimal.ZERO); |
| | | //// appCouponClient.refund(chargingOrder.getAppCouponId().toString()); |
| | | //// } |
| | | //// } |
| | | //// } |
| | | // //优惠券优惠金额 |
| | | // couponDiscount = couponDiscount.setScale(4, RoundingMode.HALF_EVEN); |
| | | // refundAmount = refundAmount.add(couponDiscount); |
| | | // payAmount = payAmount.subtract(couponDiscount); |
| | | // if(periodServicePrice_total.compareTo(BigDecimal.ZERO) > 0){ |
| | | // periodServicePrice_total = periodServicePrice_total.subtract(couponDiscount); |
| | | // } |
| | | // order.setCouponDiscountAmount(couponDiscount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | // order.setServiceCharge(periodServicePrice_total.setScale(2, RoundingMode.HALF_EVEN)); |
| | | // order.setPaymentAmount(payAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | // order.setRefundAmount(refundAmount.setScale(2, RoundingMode.HALF_EVEN)); |
| | | // order.setRefundStatus(1); |
| | | //// this.updateById(order); |
| | | // System.err.println("----------"+JSON.toJSONString(order)); |
| | | //// chargingOrder = this.getById(order.getId()); |
| | | //// |
| | | //// //开始将优惠券优惠的金额添加到明细中 |
| | | //// BigDecimal couponDiscountAmount = order.getCouponDiscountAmount(); |
| | | //// if(null != couponDiscountAmount && couponDiscountAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | //// List<TChargingOrderAccountingStrategy> list = chargingOrderAccountingStrategyService.list(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, order.getId())); |
| | | //// BigDecimal reduce = list.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //// for (TChargingOrderAccountingStrategy chargingOrderAccountingStrategy : list) { |
| | | //// BigDecimal periodServicePrice = chargingOrderAccountingStrategy.getPeriodServicePrice(); |
| | | //// BigDecimal multiply = couponDiscountAmount.multiply(periodServicePrice.divide(reduce, new MathContext(4, RoundingMode.HALF_EVEN))); |
| | | //// periodServicePrice = periodServicePrice.subtract(multiply); |
| | | //// chargingOrderAccountingStrategy.setPeriodServicePrice(periodServicePrice.setScale(2, RoundingMode.HALF_EVEN)); |
| | | //// chargingOrderAccountingStrategy.setCouponDiscountAmount(multiply.setScale(2, RoundingMode.HALF_EVEN)); |
| | | //// } |
| | | ////// chargingOrderAccountingStrategyService.updateBatchById(list); |
| | | //// } |
| | | //// |
| | | //// // 将枪状态重置为空闲 |
| | | //// TChargingGun chargingGun = new TChargingGun(); |
| | | //// chargingGun.setId(chargingOrder.getChargingGunId()); |
| | | //// chargingGun.setStatus(2); |
| | | //// chargingGun.setChargingPower(BigDecimal.ZERO); |
| | | ////// chargingGunClient.updateChargingGunById(chargingGun); |
| | | //// |
| | | //// //添加积分 |
| | | //// TIntegralRule integralRule = integralRuleClient.getSet().getData(); |
| | | //// if(null != integralRule){ |
| | | //// TAppUser appUser = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | //// Integer num1 = JSON.parseObject(integralRule.getChargeCredit()).getInteger("num1"); |
| | | //// Integer integral = chargingOrder.getServiceCharge().intValue() * num1; |
| | | //// if(null != appUser.getVipId()){ |
| | | //// TVip vip = vipClient.getInfo1(appUser.getVipId()).getData(); |
| | | //// Integer doubleIntegration = vip.getDoubleIntegration(); |
| | | //// //双倍积分 |
| | | //// if(1 == doubleIntegration){ |
| | | //// integral *= 2; |
| | | //// } |
| | | //// } |
| | | //// |
| | | //// if(integral > 0){ |
| | | //// TAppUserIntegralChange appUserIntegralChange = new TAppUserIntegralChange(); |
| | | //// appUserIntegralChange.setAppUserId(appUser.getId()); |
| | | //// appUserIntegralChange.setChangeType(2); |
| | | //// appUserIntegralChange.setHistoricalIntegral(appUser.getPoints()); |
| | | //// appUser.setPoints(appUser.getPoints() + integral); |
| | | //// appUserIntegralChange.setCurrentIntegral(appUser.getPoints()); |
| | | //// appUserIntegralChange.setCreateTime(LocalDateTime.now()); |
| | | //// appUserIntegralChange.setOrderCode(chargingOrder.getCode()); |
| | | //// appUserIntegralChange.setExtension(chargingOrder.getId().toString()); |
| | | //// appUserClient.updateAppUser(appUser); |
| | | //// appUserIntegralChangeClient.addAppUserIntegralChange(appUserIntegralChange); |
| | | //// } |
| | | //// } |
| | | //// |
| | | //// //计算用户标签 |
| | | //// editUserTag(chargingOrder); |
| | | //// //用户推荐奖励 |
| | | //// referralReward(chargingOrder); |
| | | //// |
| | | //// //开始构建退款费用 |
| | | //// if(refundAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | //// Integer rechargePaymentType = chargingOrder.getRechargePaymentType(); |
| | | //// //构建退款明细 |
| | | //// TChargingOrderRefund chargingOrderRefund = new TChargingOrderRefund(); |
| | | //// chargingOrderRefund.setChargingOrderId(chargingOrder.getId()); |
| | | //// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | //// chargingOrderRefund.setRefundCode("CDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); |
| | | //// chargingOrderRefund.setRefundAmount(refundAmount); |
| | | //// chargingOrderRefund.setRefundStatus(1); |
| | | //// chargingOrderRefund.setPayType(rechargePaymentType); |
| | | //// chargingOrderRefund.setRefundStatus(1); |
| | | //// chargingOrderRefund.setCode(chargingOrder.getCode()); |
| | | //// chargingOrderRefund.setRefundTitle("充电完成退款"); |
| | | //// chargingOrderRefund.setRefundContent("充电完成退款"); |
| | | //// chargingOrderRefund.setRefundReason("充电完成退款"); |
| | | //// chargingOrderRefund.setRefundRemark("实际充电消费金额:" + chargingOrder.getPaymentAmount()); |
| | | //// chargingOrderRefund.setRefundTotalAmount(refundAmount); |
| | | //// chargingOrderRefund.setPayAmount(rechargeAmount); |
| | | //// if(1 == rechargePaymentType){ |
| | | //// WxPaymentRefundModel model = new WxPaymentRefundModel(); |
| | | //// model.setOut_trade_no(chargingOrder.getCode()); |
| | | //// model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | //// model.setReason("充电完成退款"); |
| | | //// model.setNotify_url("/payment/wx/refund/notify"); |
| | | //// WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | //// amount.setRefund(refundAmount.multiply(new BigDecimal(100)).intValue()); |
| | | //// amount.setTotal(rechargeAmount.multiply(new BigDecimal(100)).intValue()); |
| | | //// amount.setCurrency("CNY"); |
| | | //// model.setAmount(amount); |
| | | //// R<String> orderR = wxPaymentClient.refundOrderR(model); |
| | | //// if(200 == orderR.getCode()){ |
| | | //// chargingOrderRefundService.save(chargingOrderRefund); |
| | | //// } |
| | | //// } |
| | | //// if(2 == rechargePaymentType){ |
| | | //// RefundReq dto = new RefundReq(); |
| | | //// dto.setOutTradeNo(chargingOrder.getCode()); |
| | | //// dto.setOutRequestNo(chargingOrderRefund.getCode()); |
| | | //// dto.setRefundAmount(refundAmount.toString()); |
| | | //// dto.setRefundReason("充电完成退款"); |
| | | //// RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | //// if(null != resp){ |
| | | //// AjaxResult success = chargingOrderStartupFailureWxRefund(resp.getOutTradeNo(), resp.getTradeNo(), "SUCCESS", null); |
| | | //// if(success.isSuccess()){ |
| | | //// chargingOrderRefundService.save(chargingOrderRefund); |
| | | //// } |
| | | //// } |
| | | //// } |
| | | //// |
| | | //// } |
| | | // } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getByDate(List<Long> chargingOrderIds) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> usersDay() { |
| | | return this.baseMapper.usersDay(); |
| | | public List<Map<String, Object>> usersDay(ChargingStatisticsQueryDto statisticsQueryDto) { |
| | | return this.baseMapper.usersDay(statisticsQueryDto); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | if (tChargingOrder.getPaymentAmount()!=null){ |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); |
| | | orderCommission = orderCommission.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")) |
| | | .setScale(2,BigDecimal.ROUND_DOWN)); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 三方交易手续费 三方收费*0.6% |
| | | commissionAmount = sharingAmount.multiply(new BigDecimal("0.006")); |
| | | // 订单手续费 订单支付金额 - 退款金额*0.6% |
| | | orderCommission = paymentAmount.multiply(new BigDecimal("0.006")); |
| | | tSettlementConfirm.setSharingAmount(sharingAmount.setScale(2, RoundingMode.HALF_DOWN)); |
| | | tSettlementConfirm.setCommissionAmount(commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); |
| | | tSettlementConfirm.setElectrovalence(electrovalence.setScale(2, RoundingMode.HALF_DOWN)); |
| | | tSettlementConfirm.setServiceCharge(serviceCharge.subtract(orderCommission).setScale(2, RoundingMode.HALF_DOWN)); |
| | | tSettlementConfirm.setOrderCommission(orderCommission.setScale(2,BigDecimal.ROUND_DOWN)); |
| | | tSettlementConfirm.setOrderCommission(orderCommission); |
| | | tSettlementConfirm.setVipDiscount(vipDiscount); |
| | | tSettlementConfirm.setCouponDiscount(couponDiscount); |
| | | tSettlementConfirm.setSiteId(dto.getSiteId()); |
| | |
| | | BigDecimal subtract = new BigDecimal("1").subtract(dto.getProportionPartner()); |
| | | BigDecimal subtract9 = new BigDecimal("1").subtract(dto.getServicePartner()); |
| | | // 总电损费用 |
| | | BigDecimal divide = tSettlementConfirm.getProportionMoney().divide(subtract, 2, RoundingMode.HALF_DOWN); |
| | | BigDecimal divide = tSettlementConfirm.getProportionMoney().divide(subtract, 2, BigDecimal.ROUND_DOWN); |
| | | // 平台承担电损 |
| | | BigDecimal subtract1 = divide.subtract(tSettlementConfirm.getProportionMoney()); |
| | | BigDecimal multiply = dto.getServiceMoney().multiply(subtract); |
| | |
| | | } |
| | | dto.setStartTime(startTime); |
| | | dto.setEndTime(endTime); |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | // 查询当前登陆人按钮权限 |
| | | SysUser sysUser = sysUserClient.getSysUser(tokenService.getLoginUser().getUserid()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (dto.getSiteIds()==null){ |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | }else { |
| | | siteIds.add(dto.getSiteIds()); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | }else{ |
| | | if (roleType == 2){ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.getSettlementListMenu(sysUser.getObjectId(),siteId).getData(); |
| | | |
| | | Boolean b = t1.get(2); |
| | | if (b){ |
| | | integers.add(siteId); |
| | | } |
| | | } |
| | | siteIds = integers; |
| | | } |
| | | } |
| | | dto.setSiteIdss(siteIds); |
| | | PageInfo<TSettlementConfirm> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<TSettlementConfirm> list = tSettlementConfirmMapper.settlementList(pageInfo,dto); |
| | | |
| | | for (TSettlementConfirm tSettlementConfirm : list) { |
| | | if (roleType==2){ |
| | | List<Boolean> data = partnerClient.getSettlementListMenu(sysUser.getObjectId(), tSettlementConfirm.getSiteId()).getData(); |
| | | tSettlementConfirm.setAuthDownLoad(data.get(0)); |
| | | tSettlementConfirm.setAuthDelete(data.get(1)); |
| | | } |
| | | tSettlementConfirm.setUid(tSettlementConfirm.getId().toString()); |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(tSettlementConfirm.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | |
| | | |
| | | @Override |
| | | public SettlementTotalVO settlementTotal(String time) { |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | SettlementTotalVO res = new SettlementTotalVO(); |
| | | List<TSettlementConfirm> list1 = tSettlementConfirmMapper.settlementTotal(time); |
| | | List<TSettlementConfirm> list1 = tSettlementConfirmMapper.settlementTotal(time,siteIds); |
| | | LocalDateTime parse = LocalDateTime.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | // 减少一个月 |
| | | LocalDateTime minus = parse.minusMonths(1); |
| | | List<TSettlementConfirm> list2 = tSettlementConfirmMapper.settlementTotal(time); |
| | | List<TSettlementConfirm> list2 = tSettlementConfirmMapper.settlementTotal(time,siteIds); |
| | | // 合计 |
| | | List<TSettlementConfirm> total = new ArrayList<>(); |
| | | |
| | | TSettlementConfirm tSettlementConfirm1 = new TSettlementConfirm(); |
| | | BigDecimal meteringElectronic = new BigDecimal("0"); |
| | | BigDecimal chargingElectronic = new BigDecimal("0"); |
| | | BigDecimal lossElectronic = new BigDecimal("0"); |
| | | BigDecimal income = new BigDecimal("0"); |
| | | BigDecimal venue = new BigDecimal("0"); |
| | | BigDecimal metering = new BigDecimal("0"); |
| | | BigDecimal clean = new BigDecimal("0"); |
| | | BigDecimal maintain = new BigDecimal("0"); |
| | | BigDecimal cost = new BigDecimal("0"); |
| | | BigDecimal profitMoney = new BigDecimal("0"); |
| | | BigDecimal newMoney = new BigDecimal("0"); |
| | | BigDecimal newSettlement = new BigDecimal("0"); |
| | | BigDecimal supplyElectronic = new BigDecimal("0"); |
| | | BigDecimal proportionPartner = new BigDecimal("0"); |
| | | BigDecimal proportionMoney = new BigDecimal("0"); |
| | | BigDecimal totalElectronic = new BigDecimal("0"); |
| | | BigDecimal totalService = new BigDecimal("0"); |
| | | BigDecimal servicePartner = new BigDecimal("0"); |
| | | BigDecimal serviceMoney = new BigDecimal("0"); |
| | | BigDecimal sharingAmount = new BigDecimal("0"); |
| | | BigDecimal commissionAmount = new BigDecimal("0"); |
| | | BigDecimal electrovalence = new BigDecimal("0"); |
| | | BigDecimal serviceCharge = new BigDecimal("0"); |
| | | BigDecimal orderCommission = new BigDecimal("0"); |
| | | BigDecimal vipDiscount = new BigDecimal("0"); |
| | | BigDecimal couponDiscount = new BigDecimal("0"); |
| | | // tSettlementConfirm1.setIncomePercentage(); |
| | | // tSettlementConfirm1.setTotalPercentage(); |
| | | tSettlementConfirm1.setElectronicRefund(0); |
| | | // 上月成本合计 |
| | | BigDecimal beforeCost= new BigDecimal("0"); |
| | | // 上月利润合计 |
| | | BigDecimal beforeIncome= new BigDecimal("0"); |
| | | int i = 1; |
| | | for (TSettlementConfirm tSettlementConfirm : list1) { |
| | | tSettlementConfirm.setXuhao(i); |
| | | tSettlementConfirm.setMetering(tSettlementConfirm.getSupplyElectronic()); |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(tSettlementConfirm.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | | tSettlementConfirm.setSiteName(data1.get(0).getName()); |
| | | } |
| | | if (tSettlementConfirm.getMeteringElectronic()!=null){ |
| | | meteringElectronic = meteringElectronic.add(tSettlementConfirm.getMeteringElectronic()); |
| | | chargingElectronic = chargingElectronic.add(tSettlementConfirm.getChargingElectronic()); |
| | | } |
| | | if (tSettlementConfirm.getLossElectronic()!=null){ |
| | | lossElectronic = lossElectronic.add(tSettlementConfirm.getLossElectronic()); |
| | | } |
| | | income = income.add(tSettlementConfirm.getIncome()); |
| | | venue = venue.add(tSettlementConfirm.getVenue()); |
| | | metering = metering.add(tSettlementConfirm.getMetering()); |
| | | clean = clean.add(tSettlementConfirm.getClean()); |
| | | maintain = maintain.add(tSettlementConfirm.getMaintain()); |
| | | cost = cost.add(tSettlementConfirm.getCost()); |
| | | profitMoney = profitMoney.add(tSettlementConfirm.getProfitMoney()); |
| | | newMoney = newMoney.add(tSettlementConfirm.getNewMoney()); |
| | | newSettlement = newSettlement.add(tSettlementConfirm.getNewSettlement()); |
| | | supplyElectronic = supplyElectronic.add(tSettlementConfirm.getSupplyElectronic()); |
| | | proportionPartner = proportionPartner.add(tSettlementConfirm.getProportionPartner()); |
| | | proportionMoney = proportionMoney.add(tSettlementConfirm.getProportionMoney()); |
| | | totalElectronic = totalElectronic.add(tSettlementConfirm.getTotalElectronic()); |
| | | totalService = totalService.add(tSettlementConfirm.getTotalService()); |
| | | servicePartner = servicePartner.add(tSettlementConfirm.getServicePartner()); |
| | | serviceMoney = serviceMoney.add(tSettlementConfirm.getServiceMoney()); |
| | | sharingAmount = sharingAmount.add(tSettlementConfirm.getSharingAmount()); |
| | | commissionAmount = commissionAmount.add(tSettlementConfirm.getCommissionAmount()); |
| | | electrovalence = electrovalence.add(tSettlementConfirm.getElectrovalence()); |
| | | serviceCharge = serviceCharge.add(tSettlementConfirm.getServiceCharge()); |
| | | orderCommission = orderCommission.add(tSettlementConfirm.getOrderCommission()); |
| | | vipDiscount = vipDiscount.add(tSettlementConfirm.getVipDiscount()); |
| | | couponDiscount = couponDiscount.add(tSettlementConfirm.getCouponDiscount()); |
| | | |
| | | // 查询结算确认单开始时间和结束时间的单子 |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | | .eq("site_id", tSettlementConfirm.getSiteId()) |
| | | .eq("recharge_payment_status",2); |
| | | switch (tSettlementConfirm.getType()){ |
| | | case 1: |
| | | eq.between("start_time", tSettlementConfirm.getStartTime(), tSettlementConfirm.getEndTime()); |
| | | break; |
| | | case 2: |
| | | eq.between("end_time", tSettlementConfirm.getStartTime(), tSettlementConfirm.getEndTime()); |
| | | break; |
| | | } |
| | | List<TChargingOrder> tChargingOrders = this.baseMapper.selectList(eq); |
| | | Map<String,TChargingOrder> map = new HashMap<>(); |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | stringBuilder.append(tChargingOrder.getCode()).append(","); |
| | | |
| | | } |
| | | // 充电总时长 |
| | | |
| | | Long temp = 1L; |
| | | if (StringUtils.hasLength(stringBuilder.toString())){ |
| | | String substring = stringBuilder.substring(0, stringBuilder.length() - 1); |
| | | for (String s : substring.split(",")) { |
| | | UploadRealTimeMonitoringData data6 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(s).getData(); |
| | | if (data6!=null){ |
| | | temp+=(data6.getCumulative_charging_time()*60); |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | List<TChargingPile> data = siteClient.getPileListBySiteId(tSettlementConfirm.getSiteId()).getData(); |
| | | // 计算充电桩的功率平均值 |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | for (TChargingPile datum : data) { |
| | | bigDecimal = bigDecimal.add(datum.getRatedPower()); |
| | | } |
| | | |
| | | |
| | | tSettlementConfirm.setIncome(tSettlementConfirm.getElectrovalence().add(tSettlementConfirm.getServiceCharge())); |
| | | //利用率=充电量/(桩数量*功率*时间) |
| | | List<TChargingPile> data2 = chargingPileClient.getChargingPileBySiteId(tSettlementConfirm.getSiteId()).getData(); |
| | | BigDecimal bigDecimal2 = new BigDecimal("0"); |
| | | |
| | | if (data2!=null && (!data2.isEmpty())){ |
| | | for (TChargingPile tChargingPile : data2) { |
| | | bigDecimal2 = bigDecimal2.add(tChargingPile.getRatedPower()); |
| | | } |
| | | BigDecimal bigDecimal1 = new BigDecimal(data2.size()+""); |
| | | // 平均功率 |
| | | BigDecimal divide = bigDecimal2.divide(bigDecimal1, 2, RoundingMode.HALF_DOWN); |
| | | // 充电量 |
| | | BigDecimal chargingElectronic1 = tSettlementConfirm.getChargingElectronic(); |
| | | // 桩数量 |
| | | BigDecimal bigDecimal3 = new BigDecimal(data2.size()); |
| | | BigDecimal multiply = chargingElectronic1.multiply(new BigDecimal("24")); |
| | | BigDecimal multiply1 = bigDecimal3.multiply(divide).multiply(new BigDecimal(temp)); |
| | | tSettlementConfirm.setRate(chargingElectronic1.divide(multiply1,2,RoundingMode.HALF_DOWN)+""); |
| | | }else{ |
| | | tSettlementConfirm.setRate(""); |
| | | } |
| | | |
| | | |
| | | for (TSettlementConfirm settlementConfirm : list2) { |
| | | int value = parse.getMonth().getValue(); |
| | | settlementConfirm.setMonth(value); |
| | | settlementConfirm.setIncome(settlementConfirm.getElectrovalence().add(settlementConfirm.getServiceCharge())); |
| | | tSettlementConfirm.setMetering(tSettlementConfirm.getSupplyElectronic()); |
| | | if (tSettlementConfirm.getSiteId().equals(settlementConfirm.getSiteId())){ |
| | | // 电站相同比较收入涨幅跌幅 |
| | | if (tSettlementConfirm.getIncome().compareTo(BigDecimal.ZERO)>0){ |
| | | BigDecimal subtract = tSettlementConfirm.getIncome().subtract(settlementConfirm.getIncome()).divide(tSettlementConfirm.getIncome(),2, RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); |
| | | tSettlementConfirm.setIncomePercentage(subtract+"%"); |
| | | }else { |
| | | tSettlementConfirm.setIncomePercentage("100"+"%"); |
| | | |
| | | } |
| | | |
| | | // 比较总利润 收入合计-成本合计 |
| | | BigDecimal subtract1 = tSettlementConfirm.getIncome().subtract(tSettlementConfirm.getCost()); |
| | | BigDecimal subtract2 = settlementConfirm.getIncome().subtract(settlementConfirm.getCost()); |
| | | BigDecimal bigDecimal1 = subtract1.subtract(subtract2) |
| | | .divide(subtract2, 2, RoundingMode.HALF_DOWN) |
| | | .multiply(new BigDecimal("100")) |
| | | .setScale(2, RoundingMode.HALF_DOWN); |
| | | tSettlementConfirm.setTotalPercentage(bigDecimal1+"%"); } |
| | | beforeCost = beforeCost.add(settlementConfirm.getCost()); |
| | | beforeIncome = beforeIncome.add(settlementConfirm.getIncome()); |
| | | } |
| | | i++; |
| | | } |
| | | TSettlementConfirm tSettlementConfirm = new TSettlementConfirm(); |
| | | tSettlementConfirm.setMonth(parse.getMonthValue()); |
| | | tSettlementConfirm.setMeteringElectronic(meteringElectronic); |
| | | tSettlementConfirm.setChargingElectronic(chargingElectronic); |
| | | tSettlementConfirm.setLossElectronic(lossElectronic); |
| | | tSettlementConfirm.setIncome(income); |
| | | tSettlementConfirm.setVenue(venue); |
| | | tSettlementConfirm.setMetering(metering); |
| | | tSettlementConfirm.setClean(clean); |
| | | tSettlementConfirm.setMaintain(maintain); |
| | | tSettlementConfirm.setCost(cost); |
| | | tSettlementConfirm.setProfitMoney(profitMoney); |
| | | tSettlementConfirm.setNewMoney(newMoney); |
| | | tSettlementConfirm.setNewSettlement(newSettlement); |
| | | tSettlementConfirm.setSupplyElectronic(supplyElectronic); |
| | | tSettlementConfirm.setProportionPartner(proportionPartner); |
| | | tSettlementConfirm.setProportionMoney(proportionMoney); |
| | | tSettlementConfirm.setTotalElectronic(totalElectronic); |
| | | tSettlementConfirm.setTotalService(totalService); |
| | | tSettlementConfirm.setServicePartner(servicePartner); |
| | | tSettlementConfirm.setServiceMoney(serviceMoney); |
| | | tSettlementConfirm.setSharingAmount(sharingAmount); |
| | | tSettlementConfirm.setCommissionAmount(commissionAmount); |
| | | tSettlementConfirm.setElectrovalence(electrovalence); |
| | | tSettlementConfirm.setServiceCharge(serviceCharge); |
| | | tSettlementConfirm.setOrderCommission(orderCommission); |
| | | tSettlementConfirm.setVipDiscount(vipDiscount); |
| | | tSettlementConfirm.setCouponDiscount(couponDiscount); |
| | | // 本月 |
| | | if (beforeIncome.compareTo(new BigDecimal("0")) == 0){ |
| | | tSettlementConfirm.setIncomePercentage(0+"%"); |
| | | tSettlementConfirm.setIncomePercentage(0+"%"); |
| | | }else{ |
| | | BigDecimal subtract = income.subtract(beforeIncome).divide(beforeIncome,2,RoundingMode.HALF_DOWN).multiply(new BigDecimal("100")); |
| | | tSettlementConfirm.setIncomePercentage(subtract+"%"); |
| | | tSettlementConfirm.setIncomePercentage(subtract+"%"); |
| | | |
| | | } |
| | | // 比较总利润 收入合计-成本合计 |
| | | BigDecimal subtract1 = income.subtract(cost); |
| | | BigDecimal subtract2 = beforeIncome.subtract(beforeCost); |
| | | if (subtract2.compareTo(new BigDecimal("0")) == 0){ |
| | | tSettlementConfirm.setTotalPercentage(0+"%"); |
| | | }else{ |
| | | tSettlementConfirm.setTotalPercentage(subtract1.subtract(subtract2).divide(subtract2,2, RoundingMode.HALF_DOWN).setScale(2, RoundingMode.HALF_DOWN).multiply(new BigDecimal("100"))+"%"); |
| | | } |
| | | tSettlementConfirm.setElectronicRefund(0); |
| | | // 查询上次汇报数据 进行比对涨幅跌幅 |
| | | total.add(tSettlementConfirm); |
| | | res.setList1(list1); |
| | | res.setList2(total); |
| | | return res; |
| | | } |
| | | @Override |
| | | public SettlementTotalVO settlementTotalR(String time,Long userId) { |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (userId != null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | SettlementTotalVO res = new SettlementTotalVO(); |
| | | List<TSettlementConfirm> list1 = tSettlementConfirmMapper.settlementTotal(time,siteIds); |
| | | LocalDateTime parse = LocalDateTime.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | // 减少一个月 |
| | | LocalDateTime minus = parse.minusMonths(1); |
| | | List<TSettlementConfirm> list2 = tSettlementConfirmMapper.settlementTotal(time,siteIds); |
| | | // 合计 |
| | | List<TSettlementConfirm> total = new ArrayList<>(); |
| | | |
| | |
| | | public EndOfChargePageInfo getEndOfChargePageInfo(String id) { |
| | | EndOfChargePageInfo info = new EndOfChargePageInfo(); |
| | | TChargingOrder chargingOrder = this.getById(id); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!chargingOrder.getAppUserId().equals(userId)){ |
| | | throw new RuntimeException("权限不足"); |
| | | } |
| | | info.setId(id); |
| | | info.setCode(chargingOrder.getCode()); |
| | | info.setPaymentAmount(chargingOrder.getPaymentAmount()); |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import cn.hutool.db.DaoTemplate; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.ruoyi.account.api.feignClient.AppUserIntegralChangeClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserIntegralChange; |
| | | import com.ruoyi.chargingPile.api.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.api.feignClient.PartnerClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.vo.TAccountingStrategyVO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | 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.system.api.model.SysUserRoleVo; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private PartnerClient partnerClient; |
| | | /** |
| | | * 获取充电评价列表 |
| | | * @param pageList |
| | |
| | | |
| | | //校验合作商权限 |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if(null == pageList.getSiteId() || 0 == pageList.getSiteId()){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | if(null == pageList.getSiteId() || 0 == pageList.getSiteId()){ |
| | | //合作商 |
| | | if(roleType == 2){ |
| | | Set<Integer> data = partnerService.authSite(objectId, "/data/site").getData(); |
| | | Set<Integer> data = partnerService.authSite(objectId, SiteMenu.CHARGE_EVALUATION.getValue()).getData(); |
| | | siteIds = new ArrayList<>(data); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | if(!SecurityUtils.isAdmin(tokenService.getLoginUser().getUserid())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<SysUserRoleVo> data2 = sysUserRoleClient.getRoleByUserId(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(data2.get(0).getRoleId()).getData(); |
| | |
| | | }else{ |
| | | siteIds.add(pageList.getSiteId()); |
| | | } |
| | | |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | }else{ |
| | | List<Integer> integers = new ArrayList<>(); |
| | | for (Integer siteId : siteIds) { |
| | | // 校验有没有这个站点的权限 |
| | | List<Boolean> t1= partnerClient.chargeEvaluation(sysUser.getObjectId(),siteId).getData(); |
| | | Boolean b = t1.get(0); |
| | | if (b){ |
| | | integers.add(siteId); |
| | | } |
| | | } |
| | | siteIds = integers; |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | List<GetOrderEvaluatePageListDTO> list = this.baseMapper.getPageList(pageList, evaluationTagIds, siteIds, pageInfo); |
| | | for (GetOrderEvaluatePageListDTO dto : list) { |
| | | TAppUser appUser = appUserClient.getUserById(dto.getAppUserId()).getData(); |
| | |
| | | List<String> collect = data.stream().map(TEvaluationTag::getName).collect(Collectors.toList()); |
| | | dto.setTags(collect); |
| | | } |
| | | dto.setAuthReply(roleType == 1 ? true : partnerService.authMenu(objectId, dto.getSiteId(), SiteMenu.CHARGE_EVALUATION_ANSWER.getValue())); |
| | | dto.setAuthDelete(roleType == 1 ? true : partnerService.authMenu(objectId, dto.getSiteId(), SiteMenu.CHARGE_EVALUATION_DEL.getValue())); |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | |
| | | public OrderEvaluateVo getOrderEvaluate(String orderId, Integer orderType) { |
| | | TOrderEvaluate orderEvaluate = this.getOne(new LambdaQueryWrapper<TOrderEvaluate>().eq(TOrderEvaluate::getOrderId, orderId).eq(TOrderEvaluate::getOrderType, orderType)); |
| | | if(null != orderEvaluate){ |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | if(!orderEvaluate.getAppUserId().equals(userId)){ |
| | | throw new RuntimeException("权限不足"); |
| | | } |
| | | OrderEvaluateVo orderEvaluateVo = new OrderEvaluateVo(); |
| | | BeanUtils.copyProperties(orderEvaluate, orderEvaluateVo); |
| | | List<TOrderEvaluateTag> tOrderEvaluateTags = orderEvaluateTagMapper.selectList(new LambdaQueryWrapper<TOrderEvaluateTag>().eq(TOrderEvaluateTag::getOrderEvaluateId, orderEvaluate.getId())); |
New file |
| | |
| | | package com.ruoyi.order.util; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class Page<T> implements Serializable { |
| | | |
| | | private List<T> records; //最终查询的结果记录 |
| | | private long total; //共有多少条记录 |
| | | private long size; //一页显示多少条 |
| | | private long current; //取第几页显示 |
| | | private long pages; //总共几页 |
| | | private long startIndex; //从哪里开始截取集合的下标 |
| | | //获取初始化分页对象 这里用long类型是为了与mybatisplus保持一致 |
| | | public Page<String> getPage(long total, long size ,long current){ |
| | | Page<String> page = new Page<>(); |
| | | page.setTotal(total); |
| | | page.setSize(size); |
| | | //总页数的计算 如果集合总记录数能被入参size(一页几条)整除,则为对应商,否则多出部分也独立算一页 |
| | | page.setPages(total % size == 0 ? total / size : total / size + 1); |
| | | //前端约定入参从1开始,但此处入参调用时会减1,此处+1恢复原值供前端展示 |
| | | page.setCurrent(current + 1); |
| | | //开始索引的设置 |
| | | page.setStartIndex(size * current); |
| | | return page; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | public boolean unlock() { |
| | | String identifier = redisTemplate.opsForValue().get(lockKey); |
| | | if (identifier != null && identifier.equals(UUID.randomUUID().toString())) { |
| | | redisTemplate.delete(lockKey); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | public static void main(String[] args) { |
| | | LocalDate firstDayOfLastMonth = LocalDate.now().minusMonths(1). |
| | | withDayOfMonth(2); |
| | | String string = firstDayOfLastMonth.toString(); |
| | | // 将-替换为空字符串 |
| | | string = string.replace("-", ""); |
| | | System.err.println(string); |
| | | } |
| | | // 每月2号凌晨12点执行的定时任务 |
| | | // @Scheduled(cron = "0 0 0 2 * ?") |
| | | // 每天凌晨12点执行的定时任务 |
| | | |
| | | |
| | | @Scheduled(cron = "0 0 0 * * ?") |
| | | //@Scheduled(fixedRate = 60000) |
| | | @Scheduled(cron = "0 0 0 2 * ?") |
| | | public void taskMonth() { |
| | | try { |
| | | // 获取上个月的开始和结束日期 |
| | |
| | | } |
| | | } |
| | | |
| | | // 每天晚上23:59:59执行的定时任务 |
| | | // 每个月最后一天凌晨23点执行的定时任务 |
| | | @Scheduled(cron = "0 0 23 * * ?") |
| | | public void taskLastDay() { |
| | | try { |
| | |
| | | LocalDateTime endDateTime = lastDayOfLastMonth.atTime(23, 59, 59); // 设定到最后一秒 |
| | | // 构建查询条件 |
| | | LambdaQueryWrapper<TChargingBill> queryWrapper = new LambdaQueryWrapper<>(); |
| | | // queryWrapper.ge(TChargingBill::getBillTime, |
| | | // Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant())) |
| | | // .le(TChargingBill::getBillTime, |
| | | // Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())); // 使用 le 包括最后一天的记录 |
| | | queryWrapper.ge(TChargingBill::getBillTime, |
| | | Date.from(startDateTime.atZone(ZoneId.systemDefault()).toInstant())) |
| | | .le(TChargingBill::getBillTime, |
| | | Date.from(endDateTime.atZone(ZoneId.systemDefault()).toInstant())); // 使用 le 包括最后一天的记录 |
| | | List<TChargingBill> list = chargingBillService.list(queryWrapper); |
| | | for (TChargingBill tChargingBill : list) { |
| | | tChargingBill.setStatus(2); |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 192.168.110.169:8848 |
| | | server-addr: 127.0.0.1:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.169:8848 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | |
| | | 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: 127.0.0.1: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: 127.0.0.1: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 |
| | | 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: 127.0.0.1:8848 |
| | | # 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控制台地址 |
| | |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | ip: 192.168.110.111 |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | |
| | | <if test="req.uid != null and req.uid!=''"> |
| | | and t1.id = #{req.uid} |
| | | </if> |
| | | <if test="null != req.siteIds and req.siteIds.size()>0" > |
| | | and t1.site_id in |
| | | <foreach collection="req.siteIds" close=")" open="(" item="item" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | and t1.billType = 1 |
| | | and t1.del_flag = 0 |
| | | order by t1.create_time desc |
| | |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.bill_time between #{startTime1} and #{startTime2} |
| | | </if> |
| | | <if test="req.uid != null and req.uid!=''"> |
| | | <if test="req.uid != null "> |
| | | and t1.id = #{req.uid} |
| | | </if> |
| | | <if test="null != req.siteIds and req.siteIds.size()>0" > |
| | | and t1.site_id in |
| | | <foreach collection="req.siteIds" close=")" open="(" item="item" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | and t1.billType = 2 |
| | | and t1.del_flag = 0 |
| | | order by t1.create_time desc |
| | | </select> |
| | | </mapper> |
| | |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != req.siteIds and req.siteIds.size()>0" > |
| | | and t1.site_id in |
| | | <foreach collection="req.siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.orderType != null "> |
| | | and t1.order_type = #{req.orderType} |
| | | </if> |
| | |
| | | co.payment_amount, |
| | | co.create_time as pay_time, |
| | | co.id as order_id, |
| | | co.app_user_id as user_id |
| | | co.app_user_id as user_id, |
| | | 1 as type |
| | | FROM t_charging_order_refund re |
| | | LEFT JOIN t_charging_order co ON re.charging_order_id = co.id |
| | | UNION ALL |
| | |
| | | so.payment_amount, |
| | | so.create_time as pay_time, |
| | | so.id as order_id, |
| | | so.app_user_id as user_id |
| | | so.app_user_id as user_id, |
| | | 2 as type |
| | | FROM t_shopping_order_refund re |
| | | LEFT JOIN t_shopping_order so on re.shopping_order_id = so.id |
| | | UNION ALL |
| | |
| | | vo.payment_amount, |
| | | vo.create_time as pay_time, |
| | | vo.id as order_id, |
| | | vo.app_user_id as user_id |
| | | vo.app_user_id as user_id, |
| | | 3 as type |
| | | FROM t_vip_order_refund vr |
| | | LEFT JOIN t_vip_order vo on vr.vip_order_id = vo.id |
| | | |
| | |
| | | <if test="chargingPercentProvinceDto.provinceCode != null"> |
| | | AND ts.province_code = #{chargingPercentProvinceDto.provinceCode} |
| | | </if> |
| | | |
| | | <if test="chargingPercentProvinceDto.siteIds != null and chargingPercentProvinceDto.siteIds.size() > 0"> |
| | | AND site_id IN |
| | | <foreach collection="chargingPercentProvinceDto.siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY site_id |
| | | |
| | |
| | | select sum(electrovalence) as electrovalence,sum(service_charge) as service_charge,ROUND(sum(electrovalence+service_charge) * 0.006, 2) as commission_amount,sum(sharing_amount) as sharing_amount |
| | | from t_charging_order |
| | | where create_time >= #{sixBefore} and del_flag = 0 and recharge_payment_status = 2 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | AND site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | <select id="getSumByType" resultType="java.util.Map"> |
| | | SELECT |
| | |
| | | <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.siteIds and req.siteIds.size()>0" > |
| | | and t1.site_id in |
| | | <foreach collection="req.siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | |
| | | select count(1) |
| | | from |
| | | charging_pile_account.t_app_user_car |
| | | where del_flag = 0 and vehicle_brand not in |
| | | where del_flag = 0 |
| | | |
| | | <if test="brands != null and brands.size() > 0"> |
| | | and vehicle_brand not in |
| | | <foreach collection="brands" item="brand" open="(" separator="," close=")"> |
| | | #{brand} |
| | | </foreach> |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | select t1.* from |
| | | t_settlement_confirm t1 |
| | | where 1=1 |
| | | <if test="null != siteIds and siteIds.size()>0" > |
| | | and t1.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="time != null and time!='' "> |
| | | AND DATE_FORMAT(t1.start_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m') |
| | | </if> |
| | |
| | | <if test="req.siteIds != null "> |
| | | and t1.site_id = #{req.siteIds} |
| | | </if> |
| | | <if test="null != req.siteIdss and req.siteIdss.size()>0" > |
| | | and t1.site_id in |
| | | <foreach collection="req.siteIdss" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.type == 1 "> |
| | | <if test="req.startTime != null and req.startTime!=''"> |
| | | and (t1.start_time between #{req.startTime} and #{req.endTime}) |
| | |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.feignClient.AccountingStrategyDetailOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import com.ruoyi.order.api.vo.AccountingStrategyDetailOrderVo; |
| | | import com.ruoyi.order.api.vo.ChargingOrderInfoVO; |
| | | import com.ruoyi.order.api.vo.TransactionRecordMessageVO; |
| | | import com.ruoyi.order.dto.ChargingDetails; |
| | | import com.ruoyi.order.dto.MyChargingOrderInfo; |
| | | import com.ruoyi.order.mapper.TSettlementConfirmMapper; |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.UserTagClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | |
| | | import javax.annotation.Resource; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | import java.util.*; |
| | | |
| | | @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = RuoYiOrderApplication.class) |
| | | public class RuoYiOrderApplicationTests { |
| | |
| | | |
| | | @Test |
| | | public void test(){ |
| | | Integer id = 75; |
| | | TChargingOrder one = chargingOrderService.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getAppUserId, 1839480334642704385L).eq(TChargingOrder::getChargingGunId, id) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).eq(TChargingOrder::getDelFlag, 0).orderByDesc(TChargingOrder::getStartTime).last(" limit 0, 1")); |
| | | ChargingDetails chargingDetails = new ChargingDetails(); |
| | | chargingDetails.setId(one.getId().toString()); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(id).getData(); |
| | | TChargingPile chargingPile = chargingPileClient.getChargingPileById(chargingGun.getChargingPileId()).getData(); |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(chargingPile.getSiteId())).getData().get(0); |
| | | chargingDetails.setName(site.getName() + "-" + chargingPile.getName()); |
| | | chargingDetails.setCode(one.getCode()); |
| | | chargingDetails.setStatus(one.getStatus()); |
| | | chargingDetails.setChargingCost(one.getResidualAmount()); |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataClient.chargingOrderInfo(one.getCode()).getData(); |
| | | if(null != data){ |
| | | chargingDetails.setChargeCurrent(data.getOutput_current()); |
| | | chargingDetails.setChargeVoltage(data.getOutput_voltage()); |
| | | BigDecimal power = data.getOutput_current().multiply(data.getOutput_voltage()).divide(new BigDecimal(1000)); |
| | | chargingDetails.setChargePower(power); |
| | | chargingDetails.setCompletionRatio(data.getSoc()); |
| | | chargingDetails.setRemainingChargeTime(data.getTime_remaining()); |
| | | chargingDetails.setChargedDegrees(data.getCharging_degree()); |
| | | Integer h = Integer.valueOf(data.getCumulative_charging_time() / 60); |
| | | Integer m = Integer.valueOf(data.getCumulative_charging_time() % 60); |
| | | chargingDetails.setChargedTime(String.format("%02d", h) + ":" + String.format("%02d", m)); |
| | | } |
| | | ChargingHandshake chargingHandshake = chargingHandshakeClient.getDataByOrderCode(one.getCode()).getData(); |
| | | if(null != chargingHandshake && null != data && null != one.getAppUserCarId()){ |
| | | BigDecimal bms_battery_capacity = chargingHandshake.getBms_battery_capacity(); |
| | | TAppUserCar appUserCar = appUserCarClient.getCarByIds(Arrays.asList(one.getAppUserCarId())).getData().get(0); |
| | | // 续航 = 电池容量 / 续航里程 * soc |
| | | BigDecimal divide = bms_battery_capacity.divide(new BigDecimal(appUserCar.getEndurance())); |
| | | BigDecimal multiply = new BigDecimal(data.getSoc() / 100).multiply(divide); |
| | | chargingDetails.setEndurance(multiply); |
| | | } |
| | | System.err.println(JSON.toJSONString(chargingDetails)); |
| | | MyChargingOrderInfo myChargingOrderInfo = chargingOrderService.getMyChargingOrderInfo("1852288949187297282"); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.Region; |
| | | import com.ruoyi.other.service.IRegionService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | private IRegionService regionService; |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/coupon", "/appUser/list", "/vipList", "/coupon/send"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getRegion/{pid}") |
| | | @ApiOperation(value = "获取省市区数据", tags = {"管理后台-站点管理"}) |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TActivity; |
| | | import com.ruoyi.other.api.domain.TAdvertising; |
| | | import com.ruoyi.other.api.dto.AdvertisingDTO; |
| | |
| | | |
| | | @Autowired |
| | | private TActivityService activityService; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/activity/add"}, logical = Logical.OR) |
| | | @PostMapping("/saveActivity") |
| | | @ApiOperation(tags = {"管理后台-活动管理"},value = "活动添加") |
| | | @Log(title = "【活动管理】添加活动", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | |
| | | activityService.save(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/activity/del"}, logical = Logical.OR) |
| | | @GetMapping("/delete") |
| | | @ApiOperation(tags = {"管理后台-活动管理"},value = "活动删除") |
| | | @Log(title = "【活动管理】删除活动", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | |
| | | activityService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/activity/update"}, logical = Logical.OR) |
| | | @PostMapping("/updateVip") |
| | | @ApiOperation(tags = {"管理后台-活动管理"},value = "活动修改") |
| | | @Log(title = "【活动管理】修改活动", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | |
| | | activityService.updateById(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/activity/select"}, logical = Logical.OR) |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(tags = {"管理后台-活动管理","小程序-个人中心-活动列表"},value = "活动查看详情") |
| | | @ApiOperation(tags = {"管理后台-活动管理"},value = "活动查看详情") |
| | | public AjaxResult<TActivity> getInfo(Integer id) { |
| | | return AjaxResult.ok(activityService.getById(id)); |
| | | } |
| | | @ApiOperation(tags = {"管理后台-活动管理","小程序-个人中心-活动列表"},value = "活动列表分页查询") |
| | | |
| | | |
| | | @GetMapping("/getInfo1") |
| | | @ApiOperation(tags = {"小程序-个人中心-活动列表"},value = "活动查看详情") |
| | | public AjaxResult<TActivity> getInfo1(Integer id) { |
| | | return AjaxResult.ok(activityService.getById(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"管理后台-活动管理"},value = "活动列表分页查询") |
| | | @RequiresPermissions(value = {"/activity/list"}, logical = Logical.OR) |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TActivity>> pageList(@RequestBody AdvertisingDTO dto) { |
| | | return AjaxResult.ok(activityService.pageList(dto)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-个人中心-活动列表"},value = "活动列表分页查询") |
| | | @PostMapping(value = "/pageList1") |
| | | public AjaxResult<PageInfo<TActivity>> pageList1(@RequestBody AdvertisingDTO dto) { |
| | | return AjaxResult.ok(activityService.pageList(dto)); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.query.TActivityStatisticsQuery; |
| | | import com.ruoyi.order.api.vo.TActivityStatisticslVO; |
| | |
| | | private OrderClient orderClient; |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/activityExpense"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"管理后台-活动费用统计"},value = "管理后台活动费用统计") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<TActivityVO> pageList(@RequestBody TActivityStatisticsQuery query) { |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TAdvertising; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.dto.AdvertisingDTO; |
| | |
| | | |
| | | @Autowired |
| | | private TAdvertisingService advertisingService; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/advertisement/add"}, logical = Logical.OR) |
| | | @PostMapping("/saveAdvertising") |
| | | @ApiOperation(tags = {"管理后台-广告管理"},value = "广告添加") |
| | | @Log(title = "【广告管理】添加广告", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | |
| | | advertisingService.save(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/advertisement/del"}, logical = Logical.OR) |
| | | @GetMapping("/delete") |
| | | @ApiOperation(tags = {"管理后台-广告管理"},value = "广告删除") |
| | | @Log(title = "【广告管理】删除广告", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | |
| | | advertisingService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/advertisement/update"}, logical = Logical.OR) |
| | | @PostMapping("/updateVip") |
| | | @ApiOperation(tags = {"管理后台-广告管理"},value = "广告修改") |
| | | @Log(title = "【广告管理】修改广告", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/advertisement/select"}, logical = Logical.OR) |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(tags = {"管理后台-广告管理"},value = "广告查看详情") |
| | | public AjaxResult<TAdvertising> getInfo(Integer id) { |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/advertisement"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"管理后台-广告管理"},value = "广告列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TAdvertising>> pageList(@RequestBody AdvertisingDTO dto) { |
| | |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.Region; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TGoods; |
| | |
| | | @Autowired |
| | | private AppCouponClient appCouponClient; |
| | | |
| | | @Autowired |
| | | private IRegionService regionService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 远程调用 根据名称 查询优惠券ids |
| | | * @return |
| | |
| | | .eq("name", name)).stream().map(TCoupon::getId).collect(Collectors.toList()); |
| | | return R.ok(collect); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/coupon/add"}, logical = Logical.OR) |
| | | @PostMapping("/saveGoods") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券添加") |
| | | @Log(title = "【优惠券管理】添加优惠券", businessType = BusinessType.INSERT,operatorType = OperatorType.MANAGE) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/coupon/del"}, logical = Logical.OR) |
| | | @GetMapping("/delete") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券删除") |
| | | @Log(title = "【优惠券管理】删除优惠券", businessType = BusinessType.DELETE,operatorType = OperatorType.MANAGE) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/coupon/update"}, logical = Logical.OR) |
| | | @PostMapping("/updateVip") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券修改") |
| | | @Log(title = "【优惠券管理】修改优惠券", businessType = BusinessType.UPDATE,operatorType = OperatorType.MANAGE) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/coupon/select"}, logical = Logical.OR) |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券查看详情") |
| | | public AjaxResult<TCoupon> getInfo(Integer id) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/coupon/select"}, logical = Logical.OR) |
| | | @PostMapping("/exchangeRecord") |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券查看详情-兑换记录") |
| | | public AjaxResult<PageInfo<ExchangeRecordVO>> exchangeRecord(@RequestBody ExchangeRecordGoodsQuery dto) { |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private IRegionService regionService; |
| | | |
| | | @RequiresPermissions(value = {"/coupon/send"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "发放优惠券") |
| | | @PostMapping(value = "/grantCoupon") |
| | | @Log(title = "【优惠券管理】发放优惠券", businessType = BusinessType.OTHER,operatorType = OperatorType.MANAGE) |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/coupon"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TCoupon>> pageList(@RequestBody CouponQuery dto) { |
| | | return AjaxResult.ok(tCouponService.pageList(dto)); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipSetting/list"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"管理后台-优惠券管理"},value = "优惠券列表分页查询") |
| | | @PostMapping(value = "/pageList3") |
| | | public AjaxResult<List<TCoupon>> pageList() { |
| | |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TEnterpriseUserApplication; |
| | | import com.ruoyi.other.query.PassDto; |
| | |
| | | return AjaxResult.ok(enterpriseUserApplicationService.save(dto)); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/groupUserApplication/add"}, logical = Logical.OR) |
| | | @Log(title = "【集团用户申请】添加集团用户申请", businessType = BusinessType.INSERT) |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "后台添加集团用户申请") |
| | | @PostMapping(value = "/back/add") |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/groupUserApplication"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "集团用户列表") |
| | | @PostMapping(value = "/page") |
| | | public R<Page<TEnterpriseUserApplication>> page(@RequestBody EnterpriseQuery enterpriseQuery) { |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/groupUserApplication/export"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "导出") |
| | | @PutMapping(value = "/export") |
| | | @Log(title = "【申请建桩】导出建桩申请列表", businessType = BusinessType.EXPORT) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/groupUserApplication/remark"}, logical = Logical.OR) |
| | | @Log(title = "【集团用户申请】填写备注", businessType = BusinessType.INSERT) |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "备注") |
| | | @PostMapping(value = "/remark") |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/groupUserApplication/del"}, logical = Logical.OR) |
| | | @Log(title = "【集团用户申请】删除申请数据", businessType = BusinessType.DELETE) |
| | | @ApiOperation(tags = {"后台-申请表单-集团用户"},value = "删除") |
| | | @DeleteMapping(value = "/delete") |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TEvaluationTag; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.api.vo.TEvaluationTagVO; |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/evaluationTag"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/pageList") |
| | | @ApiOperation(value = "获取评价标签列表", tags = {"管理后台-评价标签设置"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/evaluationTag/add"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/addEvaluationTag") |
| | | @ApiOperation(value = "添加评价标签", tags = {"管理后台-评价标签设置"}) |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/evaluationTag/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getEvaluationTagInfo/{id}") |
| | | @ApiOperation(value = "获取评价标签详情", tags = {"管理后台-评价标签设置"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/evaluationTag/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/editEvaluationTag") |
| | | @ApiOperation(value = "编辑评价标签", tags = {"管理后台-评价标签设置"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/evaluationTag/del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delEvaluationTag") |
| | | @ApiOperation(value = "删除评价标签", tags = {"管理后台-评价标签设置"}) |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TShoppingOrder; |
| | |
| | | import com.ruoyi.other.service.TActivityService; |
| | | import com.ruoyi.other.service.TCouponService; |
| | | import com.ruoyi.other.service.TGoodsService; |
| | | import com.ruoyi.other.util.RedisLock; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.vo.AliPaymentReq; |
| | | import com.ruoyi.payment.api.vo.AliPaymentResp; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private TGoodsService goodsService; |
| | | @Autowired |
| | | private TActivityService activityService; |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | |
| | | private TCouponService couponService; |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | @Autowired |
| | | public RedisTemplate redisTemplate; |
| | | |
| | | |
| | | /** |
| | |
| | | return R.ok(collect); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/goods/add"}, logical = Logical.OR) |
| | | @PostMapping("/saveGoods") |
| | | @ApiOperation(tags = {"管理后台-商品管理"},value = "商品添加") |
| | | @Log(title = "【商品管理】添加商品", businessType = BusinessType.INSERT) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/goods/del"}, logical = Logical.OR) |
| | | @GetMapping("/delete") |
| | | @ApiOperation(tags = {"管理后台-商品管理"},value = "商品删除") |
| | | @Log(title = "【商品管理】删除商品", businessType = BusinessType.DELETE) |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/goods/update"}, logical = Logical.OR) |
| | | @PostMapping("/updateVip") |
| | | @ApiOperation(tags = {"管理后台-商品管理"},value = "商品修改") |
| | | @Log(title = "【商品管理】修改商品", businessType = BusinessType.UPDATE) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/goods/select"}, logical = Logical.OR) |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(tags = {"管理后台-商品管理"},value = "商品查看详情") |
| | | public AjaxResult<TGoods> getInfo(Integer id) { |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/goods"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"管理后台-商品管理"},value = "商品列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TGoods>> pageList(@RequestBody GoodsDTO dto) { |
| | |
| | | //检查当前用户积分是否够 |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | Integer point = 0; |
| | | |
| | | if (exchangeDto.getGoodType()==1) { |
| | | //查询当前商品信息 |
| | | TGoods good = goodsService.getById(exchangeDto.getGoodId()); |
| | |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(tags = {"小程序-兑换商城"},value = "积分兑换商品") |
| | | @PostMapping(value = "/app/shop") |
| | | public AjaxResult<PageInfo<TGoods>> shop(@RequestBody ExchangeDto exchangeDto) { |
| | | //检查当前用户积分是否够 |
| | | //redis锁 和支付使用同一个锁 |
| | | RedisLock redisLock = new RedisLock(redisTemplate, "POINT_EXCHANGE_LOCK", 5, 30000); |
| | | try { |
| | | redisLock.lock(); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | Integer point = 0; |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | |
| | | if (exchangeDto.getGoodType()==1) { |
| | | //查询当前商品信息 |
| | | TGoods good = goodsService.getById(exchangeDto.getGoodId()); |
| | | point = good.getRedeemPoints(); |
| | | if (user.getPoints().compareTo(good.getRedeemPoints()) < 0){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | | } |
| | | //检查当前用户是否到达兑换上限 |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (good.getLimitExchangeTimes() != -1 && count >= good.getLimitExchangeTimes()) { |
| | |
| | | goodsService.updateById(good); |
| | | } |
| | | } |
| | | if (user.getPoints()<good.getRedeemPoints()){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | | } |
| | | }else { |
| | | TCoupon coupon = couponService.getById(exchangeDto.getGoodId()); |
| | | point = coupon.getRedeemPoints(); |
| | | |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (user.getPoints()<point){ |
| | | if (user.getPoints().compareTo(coupon.getRedeemPoints()) < 0){ |
| | | return AjaxResult.error("当前用户积分不足"); |
| | | } |
| | | Long count = orderClient.getExchangeById(exchangeDto.getGoodId(), userId,exchangeDto.getGoodType()).getData(); |
| | | if (coupon.getInventoryQuantity() != -1 && count >= coupon.getInventoryQuantity()) { |
| | | return AjaxResult.error("当前用户已到达兑换"+coupon+"次"); |
| | | }else { |
| | |
| | | couponService.updateById(coupon); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | exchangeDto.setPoint(point); |
| | | exchangeDto.setUserId(userId); |
| | |
| | | pointChangeDto.setCode(longR.getData().getCode()); |
| | | appUserClient.changeDown(pointChangeDto); |
| | | return AjaxResult.success(longR.getData().getId()); |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | }finally { |
| | | //解锁 |
| | | redisLock.unlock(); |
| | | } |
| | | return AjaxResult.success(); |
| | | |
| | | } |
| | | |
| | | @Resource |
| | | private AliPaymentClient aliPaymentClient; |
| | | |
| | | @ApiOperation(tags = {"小程序-现金商城"},value = "支付商品") |
| | | @PostMapping(value = "/app/pay") |
| | | public R<Map<String, Object>> pay(@RequestBody ExchangeDto exchangeDto) { |
| | | public Object pay(@RequestBody ExchangeDto exchangeDto) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | boolean isVip = false; |
| | |
| | | mapR.getData().put("orderId",shopOrder.getId().toString()); |
| | | return mapR; |
| | | }else { |
| | | //todo 罗 支付宝支付 |
| | | return R.ok(); |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(shopOrder.getCode()); |
| | | req.setTotalAmount(shopOrder.getPaymentAmount().toString()); |
| | | req.setSubject("购买商品"); |
| | | req.setBuyerOpenId(user.getAliOpenid()); |
| | | req.setBody("购买商品"); |
| | | req.setNotifyUrl("/payment/ali/callBack"); |
| | | AliPaymentResp data = aliPaymentClient.payment(req).getData(); |
| | | if(null != data){ |
| | | data.setOrderId(shopOrder.getId().toString()); |
| | | return AjaxResult.success(data); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.THtml; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.service.THtmlService; |
| | |
| | | private THtmlService htmlService; |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/protocolServerDescription"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-内容设置-协议服务"},value = "新增修改") |
| | | @PostMapping(value = "/saveOrUpdate") |
| | | @Log(title = "【协议服务】新增修改协议", businessType = BusinessType.INSERT) |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/protocolServerDescription"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-内容设置-协议服务"},value = "查询") |
| | | @GetMapping(value = "/selectByType/{type}") |
| | | public AjaxResult selectByType(@PathVariable Integer type) { |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.THtml; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private TVipService vipService; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/IntegralSetting"}, logical = Logical.OR) |
| | | @GetMapping("/getSet") |
| | | @ApiOperation(tags = {"管理后台-积分管理","小程序-个人中心-签到"},value = "获取积分设置") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "获取积分设置") |
| | | public R<TIntegralRule> getSet() { |
| | | TIntegralRule res = integralRuleService.getOne(new QueryWrapper<>()); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/getSet1") |
| | | @ApiOperation(tags = {"小程序-个人中心-签到"},value = "获取积分设置") |
| | | public R<TIntegralRule> getSet1() { |
| | |
| | | return R.ok(res); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/IntegralSetting"}, logical = Logical.OR) |
| | | @PostMapping("/saveSet") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分设置") |
| | | @Log(title = "【积分管理】保存积分设置", businessType = BusinessType.INSERT) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipSetting/html"}, logical = Logical.OR) |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "type 1=积分规则说明," + |
| | | "2=会员折扣说明," + |
| | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipSetting/html"}, logical = Logical.OR) |
| | | @PostMapping("/saveInfo") |
| | | @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分说明") |
| | | @Log(title = "【积分管理】保存积分说明", businessType = BusinessType.INSERT) |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TInvoiceType; |
| | | import com.ruoyi.other.query.InvoiceTypePageList; |
| | | import com.ruoyi.other.service.TInvoiceTypeService; |
| | |
| | | private TInvoiceTypeService invoiceTypeService; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceType"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/pageList") |
| | | @ApiOperation(value = "获取发票类型列表", tags = {"管理后台-发票类型管理"}) |
| | |
| | | PageInfo<TInvoiceType> pageInfo = invoiceTypeService.pageList(pageList); |
| | | return AjaxResult.success(pageInfo); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceManagement"}, logical = Logical.OR) |
| | | @GetMapping("/pageListR") |
| | | @ApiOperation(value = "获取开票公司和类型列表", tags = {"管理后台-发票管理"}) |
| | | public R<List<TInvoiceType>> pageListR(String invoicingCompany ){ |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceType/add"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/addInvoiceType") |
| | | @ApiOperation(value = "添加发票类型", tags = {"管理后台-发票类型管理"}) |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceType/select", "/invoiceType/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping("/getInvoiceTypeInfo/{id}") |
| | | @ApiOperation(value = "获取发票类型详情", tags = {"管理后台-发票类型管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceType/update"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping("/editInvoiceType") |
| | | @ApiOperation(value = "编辑发票类型", tags = {"管理后台-发票类型管理"}) |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/invoiceType/del"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @DeleteMapping("/delInvoiceType") |
| | | @ApiOperation(value = "删除发票类型", tags = {"管理后台-发票类型管理"}) |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TNotice; |
| | | import com.ruoyi.other.api.dto.NoticeQueryDto; |
| | | import com.ruoyi.other.mapper.SysNoticeMapper; |
| | |
| | | @Resource |
| | | private TNoticeService noticeService; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/publicAnnouncementManagement/add", "/publicAnnouncementManagement/update"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "新增修改") |
| | | @PostMapping(value = "/saveOrUpdate") |
| | | @Log(title = "【公告管理】新增修改公告", businessType = BusinessType.INSERT) |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/publicAnnouncementManagement/del"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "删除") |
| | | @DeleteMapping(value = "/deleteById") |
| | | @Log(title = "【公告管理】删除公告", businessType = BusinessType.DELETE) |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/publicAnnouncementManagement"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-内容设置-公告管理"},value = "查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<Page<TNotice>> authPageList(@RequestBody NoticeQueryDto query) { |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.other.api.domain.TSystemConfiguration; |
| | | import com.ruoyi.other.service.TSystemConfigurationService; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | /** |
| | | * 查看系统设置 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-系统设置","后台-内容设置"},value = "联系客服,查询设置") |
| | | @RequiresPermissions(value = {"/customerServiceInformation", "/systemContentSetting"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-内容设置"},value = "联系客服,查询设置") |
| | | @GetMapping(value = "/getDetailById") |
| | | public AjaxResult<TSystemConfiguration> getDetailById(@RequestParam("type")@ApiParam(value = "1=客服信息,2=系统设置") Integer type) { |
| | | return AjaxResult.ok(systemConfigurationService.getOne(Wrappers.lambdaQuery(TSystemConfiguration.class) |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查看系统设置 |
| | | */ |
| | | @ApiOperation(tags = {"小程序-系统设置"},value = "联系客服,查询设置") |
| | | @GetMapping(value = "/getDetailById1") |
| | | public AjaxResult<TSystemConfiguration> getDetailById1(@RequestParam("type")@ApiParam(value = "1=客服信息,2=系统设置") Integer type) { |
| | | return AjaxResult.ok(systemConfigurationService.getOne(Wrappers.lambdaQuery(TSystemConfiguration.class) |
| | | .eq(TSystemConfiguration::getType, type))); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/customerServiceInformation", "/systemContentSetting"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"后台-内容设置"},value = "客户信息,系统内容设置") |
| | | @PostMapping(value = "/save") |
| | | @Log(title = "【系统内容设置】保存系统内容设置", businessType = BusinessType.INSERT) |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.annotation.Logical; |
| | | import com.ruoyi.common.security.annotation.RequiresPermissions; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TIntegralRule; |
| | |
| | | private TCouponService couponService; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipSetting/addOrdinaryMember", "/vipSetting/addInternalMember"}, logical = Logical.OR) |
| | | @PostMapping("/saveVip") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员添加") |
| | | @Log(title = "【会员管理】添加会员", businessType = BusinessType.INSERT) |
| | |
| | | vipService.save(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipSetting/del"}, logical = Logical.OR) |
| | | @GetMapping("/delete") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员删除") |
| | | @Log(title = "【会员管理】删除会员", businessType = BusinessType.DELETE) |
| | |
| | | vipService.removeBatchByIds(Arrays.asList(ids.split(","))); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipSetting/update"}, logical = Logical.OR) |
| | | @PostMapping("/updateVip") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员修改") |
| | | @Log(title = "【会员管理】修改会员", businessType = BusinessType.UPDATE) |
| | |
| | | vipService.updateById(dto); |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipSetting/select"}, logical = Logical.OR) |
| | | @GetMapping("/getInfo") |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员查看详情") |
| | | public AjaxResult<TVip> getInfo(Integer id) { |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipSetting/list", "/vipOrder"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"管理后台-会员管理"},value = "会员列表分页查询") |
| | | @PostMapping(value = "/pageList") |
| | | public AjaxResult<PageInfo<TVip>> pageList(@RequestBody BasePage basePage) { |
| | | return AjaxResult.ok(vipService.pageList(basePage.getPageCurr(), basePage.getPageSize())); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/appUser/list", "/appUser/giftVip", "/appUser/gift_vip", "/vipList"}, logical = Logical.OR) |
| | | @ApiOperation(tags = {"会员下拉框"},value = "会员列表分页查询") |
| | | @GetMapping(value = "/select") |
| | | public AjaxResult<List<TVip>> select() { |
| | |
| | | |
| | | @ApiOperation(value = "购买会员", tags = {"小程序-个人中心"}) |
| | | @GetMapping("/vipInfo/pay") |
| | | public R vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, |
| | | public Object vipInfoPay(@RequestParam("vipId")Integer vipId,@RequestParam("buyType") Integer buyType, |
| | | @RequestParam("payType") Integer payType |
| | | ) { |
| | | |
| | |
| | | |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | |
| | | return R.ok(vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId)); |
| | | return vipService.vipInfoPay(byId,payMoney,payType,discountMoney,discount,buyType,userId); |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.other.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | |
| | |
| | | paymentOrder.setAmount(shopOrder.getPaymentAmount()); |
| | | paymentOrder.setOpenId(user.getWxOpenid()); |
| | | paymentOrder.setDescription("购买会员"); |
| | | return wxPaymentClient.orderPay(paymentOrder).getData(); |
| | | return AjaxResult.success(wxPaymentClient.orderPay(paymentOrder).getData()); |
| | | }else { |
| | | AliPaymentReq req = new AliPaymentReq(); |
| | | req.setOutTradeNo(shopOrder.getCode()); |
| | |
| | | req.setSubject("充电充值"); |
| | | req.setBuyerOpenId(user.getAliOpenid()); |
| | | req.setBody("充电充值"); |
| | | req.setNotifyUrl("/payment/ali/callBack"); |
| | | AliPaymentResp data = aliPaymentClient.payment(req).getData(); |
| | | if(null != data){ |
| | | data.setNotifyUrl(data.getNotifyUrl() + "/callBack/ali/all"); |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.other.util; |
| | | |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | |
| | | import java.util.UUID; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/9/26 18:43 |
| | | */ |
| | | public class RedisLock { |
| | | private RedisTemplate<String, String> redisTemplate; |
| | | private String lockKey; |
| | | private int expireTime; // 锁的超时时间 |
| | | private int timeout; // 获取锁的超时时间 |
| | | |
| | | |
| | | public RedisLock(RedisTemplate<String, String> redisTemplate, String lockKey, int expireTime, int timeout) { |
| | | this.redisTemplate = redisTemplate; |
| | | this.lockKey = lockKey; |
| | | this.expireTime = expireTime; |
| | | this.timeout = timeout; |
| | | } |
| | | |
| | | public boolean lock() { |
| | | String identifier = UUID.randomUUID().toString(); |
| | | long end = System.currentTimeMillis() + timeout; |
| | | while (System.currentTimeMillis() < end) { |
| | | if (redisTemplate.opsForValue().setIfAbsent(lockKey, identifier, expireTime, TimeUnit.SECONDS)) { |
| | | return true; |
| | | } |
| | | // 可以使用延时来减少CPU占用 |
| | | try { |
| | | Thread.sleep(100); |
| | | } catch (InterruptedException e) { |
| | | Thread.currentThread().interrupt(); |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public boolean unlock() { |
| | | redisTemplate.delete(lockKey); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: prod |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 192.168.110.169:8848 |
| | | server-addr: 127.0.0.1:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.169:8848 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | |
| | | 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: 127.0.0.1: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: 127.0.0.1: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: 127.0.0.1:8848 |
| | | # 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 lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Data |
| | | @Component |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "payment.ali") |
| | | public class AliProperties { |
| | | /** |
| | |
| | | //异步返回参数 |
| | | model.setPassbackParams(pojo.getPassbackParams()); |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(aliProperties.getNotifyUrl() + pojo.getNotifyUrl()); |
| | | |
| | | AlipayTradeCreateResponse response = alipayClient.execute(request); |
| | | log.info("-----调起支付宝支付-----"); |
| | | log.info("请求参数:{}", pojo); |
| | | log.info("请求参数:{}", JSON.toJSONString(request)); |
| | | log.info("返回结果:{}", response.getBody()); |
| | | if (response.isSuccess()) { |
| | | return PaymentResp.build(response.getOutTradeNo(), response.getTradeNo()); |
| | |
| | | package com.ruoyi.payment.controller; |
| | | |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.internal.util.AlipaySignature; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.payment.ali.config.AliProperties; |
| | | import com.ruoyi.payment.ali.v2.AppletPayUtil; |
| | | import com.ruoyi.payment.api.model.*; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.util.HashMap; |
| | | import java.util.Iterator; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | if(null != payment){ |
| | | AliPaymentResp aliPaymentResp = new AliPaymentResp(); |
| | | aliPaymentResp.setTradeNo(payment.getTradeNo()); |
| | | aliPaymentResp.setNotifyUrl(aliProperties.getNotifyUrl()); |
| | | return R.ok(aliPaymentResp); |
| | | } |
| | | return R.ok(); |
| | |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | @ResponseBody |
| | | @PostMapping(value = "/allCallBack") |
| | | public void chargingOrderALICallback(@RequestBody AliQueryOrder aliQueryOrder, HttpServletResponse response) { |
| | | @PostMapping(value = "/callBack") |
| | | public void chargingOrderALICallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | String out_trade_no = aliQueryOrder.getOutTradeNo(); |
| | | String transaction_id = aliQueryOrder.getTradeNo(); |
| | | String attach = aliQueryOrder.getPassbackParams(); |
| | | // AjaxResult ajaxResult = chargingOrderService.chargingOrderCallback(2, out_trade_no, transaction_id, attach); |
| | | // if (ajaxResult.isSuccess()) { |
| | | // PrintWriter writer = response.getWriter(); |
| | | // writer.println("success"); |
| | | // writer.flush(); |
| | | // writer.close(); |
| | | // } |
| | | Map<String, String> callback = alipayCallback(request); |
| | | if(null != callback){ |
| | | String out_trade_no = callback.get("out_trade_no"); |
| | | String attach = callback.get("subject"); |
| | | String total_amount = callback.get("total_amount"); |
| | | String transaction_id = callback.get("trade_no"); |
| | | String substring = out_trade_no.substring(0, 2); |
| | | switch (substring){ |
| | | //购物订单 |
| | | case "GW": |
| | | R r = orderClient.callBack(out_trade_no, transaction_id); |
| | | System.err.println("----收到购物回调"); |
| | | break; |
| | | case "HY": |
| | | orderClient.vipCallBack(out_trade_no,transaction_id); |
| | | System.err.println("----收到会员回调"); |
| | | break; |
| | | case "CD": |
| | | chargingOrderClient.chargingOrderALICallback(out_trade_no, transaction_id, attach); |
| | | System.err.println("----充电支付回调"); |
| | | break; |
| | | } |
| | | PrintWriter writer = response.getWriter(); |
| | | writer.println("success"); |
| | | writer.flush(); |
| | | writer.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | public Map<String, String> alipayCallback(HttpServletRequest request){ |
| | | Map<String,String> params = new HashMap<String,String>(); |
| | | Map requestParams = request.getParameterMap(); |
| | | for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) { |
| | | String name = (String) iter.next(); |
| | | String[] values = (String[]) requestParams.get(name); |
| | | String valueStr = ""; |
| | | for (int i = 0; i < values.length; i++) { |
| | | valueStr = (i == values.length - 1) ? valueStr + values[i] |
| | | : valueStr + values[i] + ","; |
| | | } |
| | | params.put(name, valueStr); |
| | | } |
| | | try { |
| | | boolean flag = AlipaySignature.rsaCheckV1(params, aliProperties.getAlipayPublicKey(), "UTF-8","RSA2"); |
| | | if(flag){ |
| | | Map<String, String> map = new HashMap<>(); |
| | | String out_trade_no = params.get("out_trade_no"); |
| | | String subject = params.get("subject"); |
| | | String total_amount = params.get("total_amount"); |
| | | String trade_no = params.get("trade_no"); |
| | | map.put("out_trade_no", out_trade_no);//商家订单号 |
| | | map.put("subject", subject); |
| | | map.put("total_amount", total_amount); |
| | | map.put("trade_no", trade_no);//支付宝交易号 |
| | | return map; |
| | | } |
| | | |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | allow-circular-references: true |
| | | profiles: |
| | | # 环境配置 |
| | | active: dev |
| | | # active: dev |
| | | active: prod |
| | | --- |
| | | spring: |
| | | config: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 192.168.110.169:8848 |
| | | server-addr: 127.0.0.1:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 192.168.110.169:8848 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | |
| | | |
| | | |
| | | --- |
| | | |
| | | seata: |
| | | enabled: true |
| | | application-id: ${spring.application.name} |
| | |
| | | config: |
| | | type: nacos |
| | | nacos: |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # 开发环境 |
| | | # server-addr: 127.0.0.1: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 |
| | |
| | | type: nacos |
| | | nacos: |
| | | application: seata-server |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # 开发环境 |
| | | # server-addr: 127.0.0.1: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 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # 开发环境 |
| | | # server-addr: 127.0.0.1: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 |
| | |
| | | transport: |
| | | dashboard: 127.0.0.1:8080 # Sentinel控制台地址 |
| | | eager: true |
| | | |
| | | |
| | | --- |
| | | spring: |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 3452d750-b08d-4485-a1e9-4fb0548f1fc2 |
| | | server-addr: 192.168.0.137:8848,192.168.0.123:8848 |
| | | namespace: c6cf40b5-44e8-43f9-be61-8d10fa830e2a |
| | | username: nacos |
| | | password: nacos |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |