Merge remote-tracking branch 'origin/master'
2个文件已删除
141个文件已修改
6个文件已添加
| | |
| | | @PostMapping(value = "/t-app-user/refundPoints/{param}") |
| | | public R refundPoints(@PathVariable("param")String param); |
| | | |
| | | @PostMapping(value = "/t-app-user/user/give/vip") |
| | | @PostMapping(value = "/t-app-user/user/give/vip1") |
| | | public R giveVip(@RequestBody GiveVipDto giveVipDto); |
| | | |
| | | |
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 String end_time;// 结束时间 |
| | | private BigDecimal total_electricity;// 总电量 |
| | | private BigDecimal loss_total_electricity;// 计损总电量 |
| | | private BigDecimal pay_amount;// 消费金额 |
| | | private BigDecimal payment_amount;// 消费金额 |
| | | private Integer method;// 交易标识(1:app 启动,2:卡启动,4:离线卡启动,5: vin 码启动充电) |
| | | private String trade_date;// 交易日期、时间 |
| | | private Integer stop_reason;// 停止原因 |
| | |
| | | private BigDecimal valley_charge12;// 谷电量 |
| | | private BigDecimal loss_valley_charge12;// 计损谷电量 |
| | | private BigDecimal valley_amount12;// 谷金额 |
| | | private String result;//原始字符串 |
| | | } |
| | | |
| | | |
| | |
| | | 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()); |
| | | } |
| | | |
| | |
| | | @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); |
| | | |
| | | /** |
| | | * 修改充电订单 |
| | |
| | | |
| | | @PostMapping("/t-exchange-order/create") |
| | | public R<ExchangeBackDto> exchangeCreate(@RequestBody ExchangeDto exchangeDto); |
| | | @PostMapping("/t-vip-order//addVipOrder") |
| | | @PostMapping("/t-vip-order/addVipOrder1") |
| | | public R<Long> addVipOrder(@RequestBody TVipOrder vipOrder); |
| | | @PostMapping("/t-shopping-order/create") |
| | | public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto); |
| | |
| | | private List<Long> userIds; |
| | | @ApiModelProperty("车辆ids 前端忽略") |
| | | private List<Long> carIds; |
| | | @ApiModelProperty("站点ids 前端忽略") |
| | | private List<Integer> siteIds; |
| | | |
| | | } |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | |
| | | @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 = "时段数") |
| | |
| | | private String end_time;// 结束时间 |
| | | private BigDecimal total_electricity;// 总电量 |
| | | private BigDecimal loss_total_electricity;// 计损总电量 |
| | | private BigDecimal pay_amount;// 消费金额 |
| | | private BigDecimal payment_amount;// 消费金额 |
| | | private Integer method;// 交易标识(1:app 启动,2:卡启动,4:离线卡启动,5: vin 码启动充电) |
| | | private String trade_date;// 交易日期、时间 |
| | | private Integer stop_reason;// 停止原因 |
| | |
| | | private BigDecimal valley_charge12;// 谷电量 |
| | | private BigDecimal loss_valley_charge12;// 计损谷电量 |
| | | private BigDecimal valley_amount12;// 谷金额 |
| | | private String result;//原始字符串 |
| | | |
| | | } |
| | | |
| | |
| | | * 获取积分设置 |
| | | * @return |
| | | */ |
| | | @GetMapping("/integral/getSet") |
| | | @PostMapping("/integral/getSet2") |
| | | R<TIntegralRule> getSet(); |
| | | } |
| | |
| | | @Data |
| | | public class RefundResp { |
| | | /** |
| | | * 支付宝交易号 |
| | | * 状态 |
| | | */ |
| | | @JsonSetter("code") |
| | | private String code; |
| | | /** |
| | | * 描述 |
| | | */ |
| | | @JsonSetter("msg") |
| | | private String msg; |
| | | /** |
| | | * 退款时间 |
| | | */ |
| | | @JsonSetter("gmt_refund_pay") |
| | | private String gmtRefundPay; |
| | | /** |
| | | * 支付宝退款交易号 |
| | | */ |
| | | @JsonSetter("trade_no") |
| | | private String tradeNo; |
| | |
| | | * 用户信息 |
| | | */ |
| | | 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; |
| | | } |
| | | } |
| | |
| | | * 缓存有效期,默认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) |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.auth.NotLoginException; |
| | | import com.ruoyi.common.core.exception.user.UserAppletException; |
| | | import org.apache.commons.fileupload.FileUploadBase; |
| | | import org.slf4j.Logger; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 没有登录异常 |
| | | * @param e |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ExceptionHandler(NotLoginException.class) |
| | | public AjaxResult notLoginException(NotLoginException e, HttpServletRequest request) { |
| | | String requestURI = request.getRequestURI(); |
| | | log.error("请求地址'{}',登录校验失败'{}'", requestURI, e.getMessage()); |
| | | return AjaxResult.error(HttpStatus.UNAUTHORIZED, e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 请求方式不支持 |
| | | */ |
| | | @ExceptionHandler(HttpRequestMethodNotSupportedException.class) |
| | |
| | | import java.util.concurrent.TimeUnit; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.ruoyi.common.core.exception.auth.NotLoginException; |
| | | import com.ruoyi.common.core.exception.user.UserAppletException; |
| | | import com.ruoyi.system.api.model.LoginUserApplet; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public LoginUserApplet getLoginUserApplet() { |
| | | LoginUserApplet loginUserAppletToken = getLoginUserAppletToken(ServletUtils.getRequest()); |
| | | if (loginUserAppletToken == null) { |
| | | throw new RuntimeException("令牌已过期,请重新登录!"); |
| | | throw new NotLoginException("令牌已过期,请重新登录!"); |
| | | } |
| | | return loginUserAppletToken; |
| | | } |
| | |
| | | public LoginUser getLoginUser() { |
| | | LoginUser loginUser = getLoginUser(ServletUtils.getRequest()); |
| | | if (loginUser == null) { |
| | | throw new RuntimeException("令牌已过期,请重新登录!"); |
| | | throw new NotLoginException("令牌已过期,请重新登录!"); |
| | | } |
| | | return loginUser; |
| | | } |
| | |
| | | </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.filter; |
| | | |
| | | import com.ruoyi.common.core.exception.auth.NotLoginException; |
| | | import com.ruoyi.gateway.config.properties.AntiShakeProperties; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | public void verifyToken(ServerHttpRequest request) throws Exception{ |
| | | String token = getToken(request); |
| | | if (StringUtils.isEmpty(token)) { |
| | | throw new RuntimeException("令牌不能为空"); |
| | | throw new NotLoginException("令牌不能为空"); |
| | | } |
| | | Claims claims = JwtUtils.parseToken(token); |
| | | if (claims == null) { |
| | | throw new RuntimeException("令牌已过期或验证不正确!"); |
| | | throw new NotLoginException("令牌已过期或验证不正确!"); |
| | | } |
| | | String userid = JwtUtils.getUserId(claims); |
| | | if (StringUtils.isEmpty(userid)) { |
| | | throw new RuntimeException("令牌验证失败"); |
| | | throw new NotLoginException("令牌验证失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | 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))); |
| | | // } |
| | | //} |
| | |
| | | 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); |
| | |
| | | */ |
| | | @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); |
| | |
| | | @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; |
| | |
| | | private TAppUserService appUserService; |
| | | @Resource |
| | | private TAppUserTagService appUserTagService; |
| | | @Autowired |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | @Resource |
| | | private TAppUserVipDetailService tAppUserVipDetailService; |
| | | @Resource |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @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) |
| | | public R giveVip(@RequestBody GiveVipDto giveVipDto) { |
| | | String[] split = giveVipDto.getUserIds().split(","); |
| | | for (String s : split) { |
| | | |
| | | |
| | | TAppUser nowUser = appUserService.getById(s); |
| | | |
| | | int plusDay = 0; |
| | | if (giveVipDto.getType() == 1) { |
| | | plusDay = 1; |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping(value = "/user/give/vip1") |
| | | public R giveVip1(@RequestBody GiveVipDto giveVipDto) { |
| | | String[] split = giveVipDto.getUserIds().split(","); |
| | | for (String s : split) { |
| | | TAppUser nowUser = appUserService.getById(s); |
| | | int plusDay = 0; |
| | | if (giveVipDto.getType() == 1) { |
| | | plusDay = 1; |
| | | } else if (giveVipDto.getType() == 2) { |
| | | plusDay = 3; |
| | | } else if (giveVipDto.getType() == 3) { |
| | | plusDay = 12; |
| | | } |
| | | BigDecimal bigDecimal = new BigDecimal("0"); |
| | | TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData(); |
| | | switch (giveVipDto.getType()){ |
| | | case 1: |
| | | bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard()); |
| | | break; |
| | | case 2: |
| | | bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard()); |
| | | break; |
| | | case 3: |
| | | bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard()); |
| | | break; |
| | | } |
| | | //增加vipDetail |
| | | giveVipUtil.sendVip(nowUser, giveVipDto.getVipId(),plusDay,giveVipDto.getType()); |
| | | appUserService.updateById(nowUser); |
| | | // 新增后台赠送记录 |
| | | TGrantVip tGrantVip = new TGrantVip(); |
| | | tGrantVip.setCode(OrderCodeUtil.getOrderCode("ZS")); |
| | | tGrantVip.setAppUserId(nowUser.getId()); |
| | | tGrantVip.setVipId(giveVipDto.getVipId()); |
| | | tGrantVip.setOrderAmount(bigDecimal); |
| | | tGrantVip.setCreateTime(LocalDateTime.now()); |
| | | tGrantVip.setAppUserId(nowUser.getId()); |
| | | orderClient.managementGiveVip(tGrantVip); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "已赠送列表", tags = {"小程序-个人中心-邀请好友"}) |
| | | @PostMapping(value = "/user/invite/page") |
| | |
| | | } |
| | | // 获取当前用户信息 |
| | | 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(); |
| | | } |
| | | |
| | |
| | | public R sign() { |
| | | LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet(); |
| | | Long userId = loginUserApplet.getUserId(); |
| | | |
| | | TAppUser byId = appUserService.getById(userId); |
| | | |
| | | |
| | | if (signService.lambdaQuery().eq(TAppUserSign::getSignDay, LocalDate.now()).eq(TAppUserSign::getAppUserId, userId).count()>0){ |
| | | return R.fail("今日已签到"); |
| | | } |
| | | |
| | | //判断当前生效的vipDetail |
| | | TAppUserVipDetail one = tAppUserVipDetailService.lambdaQuery().le(TAppUserVipDetail::getStartTime, LocalDateTime.now()).ge(TAppUserVipDetail::getEndTime, LocalDateTime.now()).eq(TAppUserVipDetail::getAppUserId, userId).last("limit 1").one(); |
| | | boolean doubleVip = false; |
| | |
| | | @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); |
| | |
| | | if (count==0){ |
| | | R<TIntegralRule> set = integralRuleClient.getSet(); |
| | | TIntegralRule data = set.getData(); |
| | | if(null != data){ |
| | | JSONObject jsonObject = JSON.parseObject(data.getAddVehiclesEarnsPoints()); |
| | | |
| | | |
| | | Integer point = 0; |
| | | //增加车牌50分,必填 |
| | | point = point+jsonObject.getInteger("num1"); |
| | |
| | | //增加积分记录 |
| | | pointDetailUtil.addDetail(byId.getPoints(),byId.getPoints()+point,5,userId,appUserCar.getLicensePlate(),"",""); |
| | | byId.setPoints(byId.getPoints()+point); |
| | | } |
| | | byId.setFirstAdd(1); |
| | | |
| | | |
| | | } |
| | | CarNumDto carNumDto = CarUtil.carNum(appUserCar.getLicensePlate()); |
| | | if (carNumDto==null){ |
| | |
| | | @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) |
| | |
| | | private TAppCouponService appCouponService; |
| | | public void sendVip(TAppUser nowUser,Integer vipId,Integer plusDay,Integer type){ |
| | | if (nowUser.getVipEndTime()==null||nowUser.getVipEndTime().isBefore(LocalDateTime.now())) { |
| | | |
| | | nowUser.setVipEndTime(LocalDateTime.now().plusMonths(plusDay).minusDays(1)); |
| | | nowUser.setVipId(vipId); |
| | | //直接再detail里新增数据,因为不是续费 |
| | |
| | | tAppUserVipDetail.setSendMonth(1); |
| | | tAppUserVipDetail.setVipJson(JSON.toJSONString(info.getData())); |
| | | tAppUserVipDetail.setVipType(type); |
| | | tAppUserVipDetail.setCreateTime(LocalDateTime.now()); |
| | | tAppUserVipDetailService.save(tAppUserVipDetail); |
| | | //直接赠送优惠卷 |
| | | for (SendCouponDto sendCouponDto : javaList) { |
| | |
| | | appCouponService.save(tAppCoupon); |
| | | } |
| | | } |
| | | |
| | | |
| | | }else { |
| | | // nowUser.setVipEndTime(nowUser.getVipEndTime().plusDays(plusDay).minusDays(1)); |
| | | //获取detail里结束时间大于当前时间的数据,并将enttime延长 |
| | | // TAppUserVipDetail tAppUserVipDetail = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getVipId,vipId).eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).orderByDesc(TAppUserVipDetail::getEndTime).last("limit 1").one(); |
| | | // if (tAppUserVipDetail!=null) { |
| | | // List<TAppUserVipDetail> list = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).ge(TAppUserVipDetail::getStartTime, tAppUserVipDetail.getEndTime()).list(); |
| | | // for (TAppUserVipDetail appUserVipDetail : list) { |
| | | // appUserVipDetail.setStartTime(appUserVipDetail.getStartTime().plusMonths(plusDay).minusDays(1)); |
| | | // appUserVipDetail.setEndTime(appUserVipDetail.getEndTime().plusMonths(plusDay).minusDays(1)); |
| | | // } |
| | | // tAppUserVipDetailService.updateBatchById(list); |
| | | // tAppUserVipDetail.setEndTime(tAppUserVipDetail.getEndTime().plusMonths(plusDay).minusDays(1)); |
| | | // |
| | | // tAppUserVipDetailService.updateById(tAppUserVipDetail); |
| | | // }else |
| | | // { |
| | | TAppUserVipDetail tAppUserVipDetail2 = tAppUserVipDetailService.lambdaQuery().eq(TAppUserVipDetail::getAppUserId, nowUser.getId()).orderByDesc(TAppUserVipDetail::getEndTime).last("limit 1").one(); |
| | | |
| | | TAppUserVipDetail tAppUserVipDetail1 = new TAppUserVipDetail(); |
| | | tAppUserVipDetail1.setAppUserId(nowUser.getId()); |
| | | tAppUserVipDetail1.setStartTime(tAppUserVipDetail2.getEndTime()); |
| | | tAppUserVipDetail1.setEndTime(tAppUserVipDetail2.getEndTime().plusMonths(plusDay).minusDays(1)); |
| | | tAppUserVipDetail1.setVipId(vipId); |
| | | |
| | | R<TVip> info = vipClient.getInfo1(vipId); |
| | | TVip vip = info.getData(); |
| | | |
| | | |
| | | tAppUserVipDetail1.setCouponIds(vip.getCoupon()); |
| | | tAppUserVipDetail1.setSendChargeNum(vip.getDiscountTimes()); |
| | | tAppUserVipDetail1.setChargeNum(vip.getDiscountTimes()); |
| | |
| | | tAppUserVipDetail1.setSendMonth(1); |
| | | tAppUserVipDetail1.setVipType(type); |
| | | tAppUserVipDetail1.setVipJson(JSON.toJSONString(info.getData())); |
| | | tAppUserVipDetail1.setCreateTime(LocalDateTime.now()); |
| | | tAppUserVipDetailService.save(tAppUserVipDetail1); |
| | | |
| | | // } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | 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){ |
| | |
| | | } |
| | | BigDecimal multiply = bigDecimal1.multiply(new BigDecimal("24")); |
| | | |
| | | BigDecimal divide = bigDecimal.divide(multiply, 0, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal divide = bigDecimal.divide(multiply, 4, BigDecimal.ROUND_HALF_EVEN).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | record.setP1(divide); |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @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.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.chargingPile.api.dto.TChargingGunDTO; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.account.api.dto.SendMessageDTO; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | 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.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileNotificationService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TFaultMessageService; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | 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; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | public class TFaultMessageController { |
| | | |
| | | private final TFaultMessageService faultMessageService; |
| | | |
| | | private final ISiteService siteService; |
| | | private final TChargingPileService chargingPileService; |
| | | private final TChargingPileNotificationService chargingPileNotificationService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Autowired |
| | | public TFaultMessageController(TFaultMessageService faultMessageService) { |
| | | public TFaultMessageController(TFaultMessageService faultMessageService, ISiteService siteService, TChargingPileService chargingPileService, TChargingPileNotificationService chargingPileNotificationService) { |
| | | this.faultMessageService = faultMessageService; |
| | | this.siteService = siteService; |
| | | this.chargingPileService = chargingPileService; |
| | | this.chargingPileNotificationService = chargingPileNotificationService; |
| | | } |
| | | |
| | | /** |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取故障信息列表 |
| | | * @param siteId |
| | | * @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 = {"管理后台-设备监控"}) |
| | |
| | | @PostMapping("/createFaultMessage") |
| | | public R<String> createFaultMessage(@RequestBody TFaultMessage faultMessage){ |
| | | faultMessageService.save(faultMessage); |
| | | |
| | | Site site = siteService.getById(faultMessage.getSiteId()); |
| | | TChargingPile chargingPile = chargingPileService.getById(faultMessage.getChargingPileId()); |
| | | String siteName = site.getName(); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(site.getPhone()); |
| | | sendMessageDTO.setSite(site.getName()); |
| | | sendMessageDTO.setChargeGun(chargingPile.getNumber() + ""); |
| | | sendMessageDTO.setType(3); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | if(siteName.length()>10){ |
| | | siteName = siteName.substring(0,10); |
| | | } |
| | | chargingPileNotificationService.saveData(4,faultMessage.getSiteId(),faultMessage.getChargingPileId(),site.getPhone(),"检测到"+siteName+"..."+chargingPile.getNumber()+"号桩设备离线,请及时查看处理!"); |
| | | 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 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(null != ids && ids.size() > 0, 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(); |
| | |
| | | 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.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | | 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 |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | |
| | |
| | | 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()); |
| | | // } |
| | | // } |
| | | ShowDeviceResp showDeviceResp = iotInterfaceClient.showDeviceRequest(chargingPile.getCode()).getData(); |
| | | if(null == showDeviceResp){ |
| | | //调用华为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("华为创建设备失败"); |
| | | } |
| | | }else{ |
| | | chargingPile.setIotdDeviceId(showDeviceResp.getDeviceId()); |
| | | } |
| | | this.save(chargingPile); |
| | | return AjaxResult.success(); |
| | | } |
| | |
| | | if(null != one && !one.getId().equals(chargingPile.getId())){ |
| | | return AjaxResult.error("设备编号已存在"); |
| | | } |
| | | TChargingPile tChargingPile = this.getById(chargingPile.getId()); |
| | | //桩号不相同,需要重新绑定设备 |
| | | if(!tChargingPile.getCode().equals(chargingPile.getCode())){ |
| | | ShowDeviceResp showDeviceResp = iotInterfaceClient.showDeviceRequest(tChargingPile.getCode()).getData(); |
| | | if(null != showDeviceResp){ |
| | | DeleteDeviceResp deleteDeviceResp = iotInterfaceClient.deleteDevice(tChargingPile.getCode()).getData(); |
| | | if(null == deleteDeviceResp){ |
| | | return AjaxResult.error("删除设备异常,请查看华为设备管理"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | ShowDeviceResp showDeviceResp = iotInterfaceClient.showDeviceRequest(tChargingPile.getCode()).getData(); |
| | | if(null == showDeviceResp){ |
| | | //调用华为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)); |
| | |
| | | TChargingGun chargingGun1 = new TChargingGun(); |
| | | chargingGun1.setId(chargingGun.getId()); |
| | | chargingGun1.setFullNumber(chargingPile.getCode() + chargingGun.getCode()); |
| | | chargingGun1.setSiteId(chargingPile.getSiteId()); |
| | | chargingGunService.updateById(chargingGun1); |
| | | |
| | | //下发硬件充电二维码 |
| | |
| | | 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(); |
| | |
| | | BigDecimal v = list.stream().map(TChargingPile::getRatedPower).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_EVEN); |
| | | List<Double> data = chargingOrderAccountingStrategyClient.getDailyChargingDegree(6, siteIds).getData(); |
| | | List<Double> value2 = new ArrayList<>(); |
| | | BigDecimal multiply = new BigDecimal(list.size()).multiply(v).multiply(new BigDecimal(24)); |
| | | for (Double datum : data) { |
| | | if(list.size() == 0){ |
| | | value2.add(0D); |
| | | }else{ |
| | | Double datum1 = new BigDecimal(datum).divide(new BigDecimal(list.size()).multiply(v).multiply(new BigDecimal(24)), new MathContext(4, RoundingMode.HALF_EVEN)).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | Double datum1 = new BigDecimal(datum).divide(multiply, new MathContext(4, RoundingMode.HALF_EVEN)) |
| | | .multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | value2.add(datum1); |
| | | } |
| | | } |
| | |
| | | //获取当前登录账户的站点权限数据 |
| | | 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){ |
| | |
| | | faultMessage.setDelFlag(false); |
| | | faultMessage.setContent("设备离线"); |
| | | faultMessageService.save(faultMessage); |
| | | |
| | | // 发送故障短信 |
| | | Site site = siteService.getById(faultMessage.getSiteId()); |
| | | String siteName = site.getName(); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(site.getPhone()); |
| | | sendMessageDTO.setSite(site.getName()); |
| | | sendMessageDTO.setChargeGun(chargingPile.getNumber() + ""); |
| | | sendMessageDTO.setType(3); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | | if(siteName.length()>10){ |
| | | siteName = siteName.substring(0,10); |
| | | } |
| | | chargingPileNotificationService.saveData(4,faultMessage.getSiteId(),faultMessage.getChargingPileId(),site.getPhone(),"检测到"+siteName+"..."+chargingPile.getNumber()+"号桩设备离线,请及时查看处理!"); |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 |
| | |
| | | // String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr); |
| | | SendMessageDTO sendMessageDTO = new SendMessageDTO(); |
| | | sendMessageDTO.setPhone(site.getPhone()); |
| | | sendMessageDTO.setCode(site.getName()); |
| | | sendMessageDTO.setSite(site.getName()); |
| | | sendMessageDTO.setChargeGun(chargingPile.getNumber() + ""); |
| | | sendMessageDTO.setType(3); |
| | | String result = appUserClient.sendMessage(sendMessageDTO).getData(); |
| | |
| | | @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())){ |
| | |
| | | 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 |
| | |
| | | from |
| | | t_charging_gun |
| | | where |
| | | |
| | | del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | group by |
| | | site_id) tcg on (ts.id = tcg.site_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 |
| | | time |
| | | ORDER BY |
| | | time |
| | | |
| | | |
| | | GROUP BY time |
| | | </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)); |
| | | } |
| | | } |
| | |
| | | * 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)); |
| | | log.info("充电桩心跳包-返回结果:{}",result); |
| | | iotMessageProduce.sendMessage(pong.getCharging_pile_code(), ServiceIdMenu.PONG.getKey(), messageUtil.pong(pong)); |
| | | sendResult = enhanceProduce.chargingMessage(chargingMessage); |
| | | break; |
| | | case SendTagConstant.END_CHARGE: |
| | |
| | | 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: |
| | |
| | | package com.ruoyi.integration.iotda.utils.produce; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.huaweicloud.sdk.core.exception.ConnectionException; |
| | | import com.huaweicloud.sdk.core.exception.RequestTimeoutException; |
| | |
| | | @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); |
| | | request.withDeviceId(code); |
| | | DeviceMessageRequest body = new DeviceMessageRequest(); |
| | | body.withMessageId(UUID.randomUUID().toString()); |
| | | body.withName(name); |
| | |
| | | request.withBody(body); |
| | | try { |
| | | CreateMessageResponse response = iotBuilder.buildIot().createMessage(request); |
| | | System.out.println(response.toString()); |
| | | } catch (ConnectionException e) { |
| | | log.info("消息下发至设备结果:{}", JSON.toJSONString(response)); |
| | | return JSON.toJSONString(response); |
| | | } catch (Exception 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()); |
| | | log.info("消息下发至设备异常:code---{},msg---{}", code, e.getMessage()); |
| | | log.error("消息下发至设备异常:code---{},msg---{}", code, e.getMessage()); |
| | | return e.getMessage(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | 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 String end_time;// 结束时间 |
| | | private BigDecimal total_electricity;// 总电量 |
| | | private BigDecimal loss_total_electricity;// 计损总电量 |
| | | private BigDecimal pay_amount;// 消费金额 |
| | | private BigDecimal payment_amount;// 消费金额 |
| | | private Integer method;// 交易标识(1:app 启动,2:卡启动,4:离线卡启动,5: vin 码启动充电) |
| | | private String trade_date;// 交易日期、时间 |
| | | private Integer stop_reason;// 停止原因 |
| | |
| | | private BigDecimal valley_charge12;// 谷电量 |
| | | private BigDecimal loss_valley_charge12;// 计损谷电量 |
| | | private BigDecimal valley_amount12;// 谷金额 |
| | | |
| | | private String result;//原始字符串 |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.integration.rocket.produce; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.chargingPile.api.feignClient.AccountingStrategyDetailClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | |
| | | case SendTagConstant.TRANSACTION_RECORD: |
| | | TransactionRecordMessage transactionRecordMessage = message.getTransactionRecordMessage(); |
| | | log.info("交易记录-业务消息处理:{}",transactionRecordMessage); |
| | | transactionRecordMessage.setResult(JSONObject.toJSONString(message)); |
| | | // 持久化消息 |
| | | TransactionRecord transactionRecord = new TransactionRecord(); |
| | | BeanUtils.copyProperties(transactionRecordMessage,transactionRecord); |
| | |
| | | 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 |
| | | # server-addr: 127.0.0.1:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | # server-addr: 192.168.110.169:8848 |
| | | # server-addr: 127.0.0.1:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | # server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | # server-addr: 127.0.0.1:8848 # nacos注册中心地址 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | |
| | | |
| | | 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 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; |
| | |
| | | // 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) { |
| | |
| | | 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) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @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>() |
| | |
| | | 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) { |
| | |
| | | |
| | | ChargingOrderTimeVO res = chargingOrderService.chargingList(dto); |
| | | List<TChargingOrderExport> tChargingOrderExports = new ArrayList<>(); |
| | | List<ChargingOrderListVO> exportList = res.getList().getRecords(); |
| | | List<ChargingOrderListVO> exportList = res.getExportList(); |
| | | int i = 0; |
| | | for (ChargingOrderListVO chargingOrderListVO : exportList) { |
| | | TChargingOrderExport tChargingOrderExport = new TChargingOrderExport(); |
| | |
| | | break; |
| | | } |
| | | } |
| | | if (chargingOrderListVO.getCreateTime()!=null){ |
| | | String s1 = DateUtils.localDateTimeToString(chargingOrderListVO.getCreateTime()); |
| | | String s2 = DateUtils.localDateTimeToString(chargingOrderListVO.getStartTime()); |
| | | String s3 = DateUtils.localDateTimeToString(chargingOrderListVO.getEndTime()); |
| | | tChargingOrderExport.setCreateTime(s1); |
| | | } |
| | | if (chargingOrderListVO.getStartTime()!=null){ |
| | | String s2 = DateUtils.localDateTimeToString(chargingOrderListVO.getStartTime()); |
| | | tChargingOrderExport.setStartTime(s2); |
| | | } |
| | | if (chargingOrderListVO.getEndTime()!=null){ |
| | | String s3 = DateUtils.localDateTimeToString(chargingOrderListVO.getEndTime()); |
| | | tChargingOrderExport.setEndTime(s3); |
| | | } |
| | | tChargingOrderExport.setRechargePaymentStatus(chargingOrderListVO.getRechargePaymentStatus()+""); |
| | | tChargingOrderExport.setType("充电订单"); |
| | | tChargingOrderExport.setChargingType("单桩双充"); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @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); |
| | |
| | | package com.ruoyi.order.controller; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | 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; |
| | | @Resource |
| | | private PartnerClient partnerClient; |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 远程调用 增加管理后台赠送会员记录 |
| | |
| | | } |
| | | 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") |
| | | @ApiOperation(value = "退款", tags = {"管理后台-支付订单-订单信息"}) |
| | |
| | | return chargingOrderService.payRefund(payOrderQueryDto); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/paymentOrder/order"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/pay/order/pay/detail") |
| | | @ApiOperation(value = "支付信息", tags = {"管理后台-支付订单-订单信息"}) |
| | |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/pay/order/refund/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") |
| | | @ApiOperation(value = "列表1", tags = {"管理后台-支付订单-退款订单"}) |
| | |
| | | |
| | | |
| | | |
| | | @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 = {"管理后台-订单管理"}) |
| | |
| | | .between(TChargingOrder::getStartTime, req.getStartTime(), req.getEndTime())).size(); |
| | | return R.ok(size); |
| | | } |
| | | |
| | | |
| | | //用户订单数量 |
| | | @PostMapping(value = "/useOrderCount") |
| | | public R<Long> useOrderCount(@RequestParam("userId") Long userId) { |
| | |
| | | return R.ok(count); |
| | | } |
| | | |
| | | |
| | | |
| | | //订单详情 |
| | | @PostMapping(value = "/detail") |
| | | public R<TChargingOrder> detail(@RequestParam("orderId") Long orderId) { |
| | | return R.ok(chargingOrderService.getById(orderId)); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping(value = "/getList") |
| | | public R<List<TChargingOrder>> getList(@RequestParam("siteId") Integer siteId) { |
| | |
| | | List<TChargingOrder> list = chargingOrderService.lambdaQuery().eq(TChargingOrder::getSiteId, siteId).list(); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping(value = "/getBySiteIdAndTime") |
| | | public R<List<ChargingOrderGroup>> getBySiteIdAndTime(@RequestBody ChargingPercentProvinceDto chargingPercentProvinceDto) { |
| | |
| | | @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); |
| | | } |
| | |
| | | |
| | | |
| | | |
| | | |
| | | @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>(); |
| | |
| | | return R.ok(map); |
| | | } |
| | | |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | |
| | | @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" 的时间数据 |
| | |
| | | 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) { |
| | |
| | | } |
| | | List<Map<String,Object>> capMap = chargingOrderService.getchargingCapacity(siteIds,statisticsQueryDto); |
| | | List<TChargingPile> chargingPiles = chargingPileClient.getChargingPileBySiteIds(siteIds).getData(); |
| | | //获取chargingPiles的ratedPower的总和再乘以chargingPiles的数量再乘以24 |
| | | BigDecimal totalRatedPower = chargingPiles.stream().map(TChargingPile::getRatedPower).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(new BigDecimal(chargingPiles.size())).multiply(new BigDecimal(24)); |
| | | BigDecimal totalRatedPower = chargingPiles.stream().map(TChargingPile::getRatedPower).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | //将capMap的chargingCapacity除以totalRatedPower保留两位数 |
| | | //每日利用率=当日充电度数/(总桩数量*桩总功率*24小时) |
| | | BigDecimal multiply1 = new BigDecimal(chargingPiles.size()).multiply(totalRatedPower).multiply(new BigDecimal(24)); |
| | | System.err.println(JSON.toJSONString(capMap) + "---" + chargingPiles.size() + "---" + totalRatedPower + "---" + multiply1); |
| | | capMap.forEach(map -> { |
| | | BigDecimal chargingCapacity = (BigDecimal) map.get("chargingCapacity"); |
| | | BigDecimal result = chargingCapacity.divide(totalRatedPower, 4, RoundingMode.HALF_UP); |
| | | BigDecimal result = chargingCapacity.divide(multiply1, 4, RoundingMode.HALF_UP); |
| | | BigDecimal multiply = result.multiply(new BigDecimal(100)); |
| | | map.put("chargingCapacity", multiply); |
| | | }); |
| | | |
| | | |
| | | |
| | | // |
| | | // 解析 startTime 和 endTime 为 LocalDate |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | return R.ok(dateRangeStatistics); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @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 = {"管理后台-工作台"}) |
| | |
| | | |
| | | |
| | | |
| | | private static List<TChargingOrder> getSampleData() { |
| | | // 这里可以替换为实际查询逻辑 |
| | | List<TChargingOrder> list = new ArrayList<>(); |
| | | // 示例数据 |
| | | for (int i = 0; i < 24; i++) { |
| | | TChargingOrder order = new TChargingOrder(); |
| | | order.setStartTime(LocalDateTime.now().minusHours(23 - i)); |
| | | order.setOrderAmount(BigDecimal.valueOf(i + 1)); |
| | | list.add(order); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | private static List<Map<String, BigDecimal>> processData(List<TChargingOrder> list) { |
| | | Map<LocalDateTime, BigDecimal> hourlySum = new HashMap<>(); |
| | | |
| | | // 按每个小时分组并求和 |
| | | for (TChargingOrder order : list) { |
| | | LocalDateTime hour = order.getStartTime().truncatedTo(ChronoUnit.HOURS); |
| | | BigDecimal amount = order.getOrderAmount(); |
| | | hourlySum.merge(hour, amount, BigDecimal::add); |
| | | } |
| | | |
| | | // 创建结果列表 |
| | | List<Map<String, BigDecimal>> resultList = new ArrayList<>(); |
| | | for (int i = 1; i <= 23; i++) { |
| | | LocalDateTime keyHour = LocalDateTime.now().withHour(i); |
| | | BigDecimal sum = BigDecimal.ZERO; |
| | | |
| | | // 计算键之后的一小时的数据之和 |
| | | for (int j = i + 1; j <= 23; j++) { |
| | | LocalDateTime nextHour = LocalDateTime.now().withHour(j); |
| | | sum = sum.add(hourlySum.getOrDefault(nextHour, BigDecimal.ZERO)); |
| | | } |
| | | |
| | | Map<String, BigDecimal> entry = new HashMap<>(); |
| | | entry.put(String.valueOf(i), sum); |
| | | resultList.add(entry); |
| | | } |
| | | |
| | | return resultList; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 硬件充电结束后的处理逻辑 |
| | |
| | | chargingOrderService.endCharge(code, 2); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 硬件异常结束充电后的处理逻辑 |
| | | * @param code |
| | |
| | | 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()); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/addVipOrder1") |
| | | public R<Long> addVipOrder1(@RequestBody TVipOrder dto) { |
| | | if (dto.getId()!=null){ |
| | | List<TVipOrder> list = vipOrderService.lambdaQuery().eq(TVipOrder::getCode, dto.getCode()) |
| | | .ne(TVipOrder::getId, dto.getId()).list(); |
| | | if (!list.isEmpty())return R.fail("订单编号已存在"); |
| | | }else{ |
| | | List<TVipOrder> list = vipOrderService.lambdaQuery().eq(TVipOrder::getCode, dto.getCode()).list(); |
| | | if (!list.isEmpty())return R.fail("订单编号已存在"); |
| | | } |
| | | vipOrderService.saveOrUpdate(dto); |
| | | return R.ok(dto.getId()); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/vipOrder/del"}, logical = Logical.OR) |
| | | @GetMapping("/deleteVipOrder") |
| | | @ApiOperation(value = "批量删除会员订单", tags = {"管理后台-会员订单"}) |
| | | public AjaxResult deleteVipOrder(String id) { |
| | |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/callBack") |
| | | public R callBack(@RequestParam("code")String code,@RequestParam("outTradeNo")String outTradeNo){ |
| | | |
| | | TVipOrder one = vipOrderService.lambdaQuery().eq(TVipOrder::getCode, code).one(); |
| | | one.setSerialNumber(outTradeNo); |
| | | one.setPaymentStatus(2); |
| | |
| | | giveVipDto.setVipId(one.getVipId()); |
| | | giveVipDto.setType(one.getVipType()); |
| | | giveVipDto.setUserIds(one.getAppUserId().toString()); |
| | | |
| | | |
| | | |
| | | appUserClient.giveVip(giveVipDto); |
| | | |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | |
| | | @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); |
| | | |
| | |
| | | |
| | | 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) |
| | | .between("pay_time", firstDayOfMonth.atTime(0, 0, 0), lastDayOfMonth.atTime(23, 59, 59)) |
| | | .eq("status", 5) |
| | | .eq("recharge_payment_status", 2); |
| | | if (chargingBillListVO.getType() == 2) { |
| | |
| | | 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.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 discountTotal = 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) |
| | | .between("pay_time", firstDayOfMonth.atTime(0, 0, 0), lastDayOfMonth.atTime(23, 59, 59)) |
| | | .eq("status", 5) |
| | | .eq("recharge_payment_status", 2); |
| | | if (chargingBillListVO.getType() == 2) { |
| | |
| | | chargingBillListVO.setChargingSecond(chargingSecond); |
| | | } |
| | | for (ChargingBillListVO chargingBillListVO : list1) { |
| | | if (chargingBillListVO.getType() ==2){ |
| | | 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) |
| | |
| | | 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) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 将时间转化为字符串 只保留年月日 格式为yyyy-MM-dd |
| | | String format = now.format(java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | LocalDateTime localDateTime = LocalDateTime.now().minusMonths(1); |
| | | // 获取 LocalDate 对象 |
| | | LocalDate date = localDateTime.toLocalDate(); |
| | | // // 获取该月份的第一天 |
| | | LocalDate firstDayOfMonth = date.withDayOfMonth(1); |
| | | // 获取该月份的最后一天 |
| | | LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); |
| | | System.err.println(firstDayOfMonth); |
| | | System.err.println(lastDayOfMonth); |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | |
| | | import java.time.*; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.format.TextStyle; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.time.temporal.WeekFields; |
| | | import java.util.*; |
| | | import java.util.concurrent.*; |
| | |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private TSettlementConfirmMapper tSettlementConfirmMapper; |
| | | |
| | | @Resource |
| | | private PartnerClient partnerClient; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | |
| | |
| | | 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); |
| | | try { |
| | | Thread.sleep(1000); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | chargingOrderStartupFailureWxRefund(chargingOrderRefund.getRefundCode(), resp.getTradeNo(), "SUCCESS", null); |
| | | } |
| | | } |
| | | |
| | |
| | | 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(); |
| | |
| | | } |
| | | 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)); |
| | |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunByCode(code).getData(); |
| | | TChargingOrder order = this.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, chargingGun.getId()) |
| | | .orderByDesc(TChargingOrder::getEndTime).eq(TChargingOrder::getRechargePaymentStatus, 2).last(" limit 0, 1")); |
| | | if(null != order && order.getStatus() != 3){ |
| | | if(null != order && order.getStatus() != 4){ |
| | | return; |
| | | } |
| | | |
| | |
| | | } |
| | | 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 commissionMoney = new BigDecimal("0"); |
| | | BigDecimal refundMoney = new BigDecimal("0"); |
| | | BigDecimal paymentMoney = new BigDecimal("0"); |
| | | List<String> collect2 = list.stream().map(TChargingOrder::getCode).collect(Collectors.toList()); |
| | | for (ChargingOrderVO chargingOrderVO : list) { |
| | | 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()+""); |
| | |
| | | // 充电订单 明细记录 |
| | | List<TChargingOrderAccountingStrategy> chargingOrderId = chargingOrderAccountingStrategyService.list(new QueryWrapper<TChargingOrderAccountingStrategy>() |
| | | .eq("charging_order_id", chargingOrderVO.getId())); |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderVO.getCode()).getData(); |
| | | if (data5!=null){ |
| | | long l = data5.getCumulative_charging_time() * 60L; |
| | | chargingOrderVO.setChargingSecond(l); |
| | | if (chargingOrderVO.getStartTime()!=null && chargingOrderVO.getEndTime()!=null){ |
| | | LocalDateTime startTime = chargingOrderVO.getStartTime(); |
| | | LocalDateTime endTime = chargingOrderVO.getEndTime(); |
| | | // 计算时间差 单位秒 |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | chargingOrderVO.setChargingSecond(between); |
| | | |
| | | } |
| | | // 充电时段数 |
| | | int size = chargingOrderId.size(); |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | List<Long> orderIds = list1.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | if(orderIds.isEmpty())orderIds.add(-1L); |
| | | List<TChargingOrderRefund> chargingOrderRefunds = chargingOrderRefundService.lambdaQuery() |
| | | .in(TChargingOrderRefund::getChargingOrderId, orderIds) |
| | | .eq(TChargingOrderRefund::getRefundStatus,2).list(); |
| | | |
| | | 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){ |
| | | long l = data5.getCumulative_charging_time() * 60L; |
| | | chargingOrderVO.setChargingSecond(l); |
| | | time+=l; |
| | | if (chargingOrderVO.getStartTime()!=null && chargingOrderVO.getEndTime()!=null){ |
| | | LocalDateTime startTime = chargingOrderVO.getStartTime(); |
| | | LocalDateTime endTime = chargingOrderVO.getEndTime(); |
| | | // 计算时间差 单位秒 |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | time+=between; |
| | | } |
| | | List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) |
| | | .eq(TChargingOrderRefund::getChargingOrderId, chargingOrderVO.getId()).list(); |
| | | List<TChargingOrderRefund> list2 = chargingOrderRefunds.stream().filter(e -> e.getChargingOrderId() != null && e.getChargingOrderId().equals(chargingOrderVO.getId())) |
| | | .collect(Collectors.toList()); |
| | | 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")); |
| | |
| | | } |
| | | |
| | | @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); |
| | | List<Integer> siteIdsList = list.stream().map(ChargingOrderListVO::getSiteId).collect(Collectors.toList()); |
| | | if (siteIdsList.isEmpty())siteIdsList.add(-1); |
| | | List<Site> sites = siteClient.getSiteByIds(siteIdsList).getData(); |
| | | |
| | | 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){ |
| | |
| | | chargingOrderListVO.setUid(chargingOrderListVO.getId()+""); |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(chargingOrderListVO.getSiteId()); |
| | | List<Site> data = siteClient.getSiteByIds(integers).getData(); |
| | | if (!data.isEmpty()) { |
| | | chargingOrderListVO.setSiteName(data.get(0).getName()); |
| | | Site site = sites.stream().filter(e -> e.getId().equals(chargingOrderListVO.getSiteId())).findFirst().orElse(null); |
| | | if (site!=null){ |
| | | chargingOrderListVO.setSiteName(site.getName()); |
| | | } |
| | | if (chargingOrderListVO.getChargingGunId()!=null && chargingOrderListVO.getChargingPileId()!=null){ |
| | | TChargingGun data1 = chargingGunClient.getChargingGunById(chargingOrderListVO.getChargingGunId()).getData(); |
| | |
| | | chargingOrderListVO.setTerminalName(data2.getName() + "-" + data1.getName()); |
| | | } |
| | | } |
| | | // 获取充电时间 |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrderListVO.getCode()).getData(); |
| | | if (data5!=null){ |
| | | if (data5.getTime_remaining()!=null){ |
| | | chargingOrderListVO.setChargingSecond(data5.getCumulative_charging_time()*60L); |
| | | |
| | | } |
| | | if (chargingOrderListVO.getStartTime()!=null && chargingOrderListVO.getEndTime()!=null){ |
| | | LocalDateTime startTime = chargingOrderListVO.getStartTime(); |
| | | LocalDateTime endTime = chargingOrderListVO.getEndTime(); |
| | | // 计算时间差 单位秒 |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | chargingOrderListVO.setChargingSecond(between); |
| | | } |
| | | // 获取开始SOC 结束soc |
| | | if (chargingOrderListVO.getCode()!=null){ |
| | |
| | | } |
| | | } |
| | | chargingOrderListVO.setPhone(data3.getPhone()); |
| | | |
| | | } |
| | | } |
| | | List<TChargingOrderAccountingStrategy> list2 = chargingOrderAccountingStrategyService.lambdaQuery() |
| | |
| | | // 不分页 |
| | | PageInfo<ChargingOrderListVO> pageInfo1 = new PageInfo<>(1,999999999); |
| | | List<ChargingOrderListVO> list1 = this.baseMapper.chargingList(pageInfo1,dto,startTime1,startTime2,endTime1,endTime2); |
| | | for (ChargingOrderListVO chargingOrderListVO : list1) { |
| | | List<Integer> integers = new ArrayList<>(); |
| | | integers.add(chargingOrderListVO.getSiteId()); |
| | | Site site = sites.stream().filter(e -> e.getId().equals(chargingOrderListVO.getSiteId())).findFirst().orElse(null); |
| | | if (site!=null){ |
| | | chargingOrderListVO.setSiteName(site.getName()); |
| | | } |
| | | if (chargingOrderListVO.getStartTime()!=null && chargingOrderListVO.getEndTime()!=null){ |
| | | LocalDateTime startTime = chargingOrderListVO.getStartTime(); |
| | | LocalDateTime endTime = chargingOrderListVO.getEndTime(); |
| | | // 计算时间差 单位秒 |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | chargingOrderListVO.setChargingSecond(between); |
| | | } |
| | | if (chargingOrderListVO.getChargingGunId()!=null && chargingOrderListVO.getChargingPileId()!=null){ |
| | | TChargingGun data1 = chargingGunClient.getChargingGunById(chargingOrderListVO.getChargingGunId()).getData(); |
| | | TChargingPile data2 = chargingPileClient.getChargingPileById(chargingOrderListVO.getChargingPileId()).getData(); |
| | | if (data2 != null && data1 != null) { |
| | | chargingOrderListVO.setTerminalName(data2.getName() + "-" + data1.getName()); |
| | | } |
| | | } |
| | | } |
| | | chargingOrderTimeVO.setExportList(list1); |
| | | chargingOrderTimeVO.setOrderCount(list1.size()); |
| | | // 计算充电总度数 |
| | |
| | | BigDecimal feng = new BigDecimal("0"); |
| | | BigDecimal ping = new BigDecimal("0"); |
| | | BigDecimal gu = new BigDecimal("0"); |
| | | List<Long> collect = list1.stream().map(ChargingOrderListVO::getId).collect(Collectors.toList()); |
| | | List<TChargingOrderAccountingStrategy> chargingOrderAccountingStrategies = chargingOrderAccountingStrategyService.lambdaQuery() |
| | | .in(TChargingOrderAccountingStrategy::getChargingOrderId,collect).list(); |
| | | for (ChargingOrderListVO chargingOrderListVO : list1) { |
| | | if (chargingOrderListVO.getChargingCapacity()!=null)electronic = electronic.add(chargingOrderListVO.getElectricity()); |
| | | |
| | | if (chargingOrderListVO.getPaymentAmount()!=null)paymentAmount = paymentAmount.add(chargingOrderListVO.getPaymentAmount()); |
| | | if (chargingOrderListVO.getElectrovalence()!=null)electrovalence = electrovalence.add(chargingOrderListVO.getElectrovalence()); |
| | | if (chargingOrderListVO.getServiceCharge()!=null)serviceCharge = serviceCharge.add(chargingOrderListVO.getServiceCharge()); |
| | | List<TChargingOrderAccountingStrategy> list2 = chargingOrderAccountingStrategyService.lambdaQuery() |
| | | .eq(TChargingOrderAccountingStrategy::getChargingOrderId, chargingOrderListVO.getId()).list(); |
| | | List<TChargingOrderAccountingStrategy> list2 = chargingOrderAccountingStrategies.stream().filter(e -> e.getChargingOrderId().equals(chargingOrderListVO.getId())) |
| | | .collect(Collectors.toList()); |
| | | for (TChargingOrderAccountingStrategy temp : list2) { |
| | | switch (temp.getType()){ |
| | | case 1: |
| | |
| | | public ChargingOrderListInfoVO chargingInfo(String uid) { |
| | | TChargingOrder chargingOrder= this.getById(uid); |
| | | ChargingOrderListInfoVO chargingOrderListInfoVO = new ChargingOrderListInfoVO(); |
| | | chargingOrderListInfoVO.setStartTime(chargingOrder.getStartTime()); |
| | | chargingOrderListInfoVO.setEndTime(chargingOrder.getEndTime()); |
| | | chargingOrderListInfoVO.setStatus(chargingOrder.getStatus()); |
| | | BigDecimal bigDecimal = new BigDecimal("0.006"); |
| | | if (chargingOrder.getOrderAmount()!=null){ |
| | |
| | | |
| | | chargingOrderListInfoVO.setList(data6); |
| | | } |
| | | // 获取充电时间 |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | if (data5!=null){ |
| | | if (data5.getTime_remaining()!=null){ |
| | | chargingOrderListInfoVO.setChargingSecond(data5.getCumulative_charging_time()*60L+""); |
| | | |
| | | } |
| | | if (chargingOrderListInfoVO.getStartTime()!=null && chargingOrderListInfoVO.getEndTime()!=null){ |
| | | LocalDateTime startTime = chargingOrderListInfoVO.getStartTime(); |
| | | LocalDateTime endTime = chargingOrderListInfoVO.getEndTime(); |
| | | // 计算时间差 单位秒 |
| | | long between = ChronoUnit.SECONDS.between(startTime, endTime); |
| | | chargingOrderListInfoVO.setChargingSecond(between+""); |
| | | } |
| | | |
| | | if (chargingOrder.getAppUserCarId()!=null){ |
| | |
| | | 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 vipDiscountAmount = BigDecimal.ZERO; |
| | | //计算优惠金额 |
| | | if(null != chargingOrder.getVipDiscount()){ |
| | | //0.58折 |
| | | vipDiscountAmount = serviceCharge.multiply(new BigDecimal(1).subtract(chargingOrder.getVipDiscount())); |
| | | serviceCharge = serviceCharge.multiply(chargingOrder.getVipDiscount()); |
| | | } |
| | |
| | | periodServicePrice_total = periodServicePrice_total.add(originalServicePrice); |
| | | total = total.add(electrovalenc.add(originalServicePrice)); |
| | | } |
| | | |
| | | |
| | | |
| | | //原金额 |
| | | BigDecimal rechargeAmount = chargingOrder.getRechargeAmount(); |
| | |
| | | referralReward(chargingOrder); |
| | | |
| | | //开始构建退款费用 |
| | | refundAmount = refundAmount.setScale(2, RoundingMode.HALF_EVEN); |
| | | if(refundAmount.compareTo(BigDecimal.ZERO) > 0){ |
| | | Integer rechargePaymentType = chargingOrder.getRechargePaymentType(); |
| | | //构建退款明细 |
| | |
| | | if(2 == rechargePaymentType){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(chargingOrder.getCode()); |
| | | dto.setOutRequestNo(chargingOrderRefund.getCode()); |
| | | dto.setOutRequestNo(chargingOrderRefund.getRefundCode()); |
| | | 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); |
| | | } |
| | | this.chargingOrderStartupFailureWxRefund(chargingOrderRefund.getRefundCode(), resp.getTradeNo(), "SUCCESS", null); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @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 |
| | |
| | | private TVipOrderService vipOrderService; |
| | | @Resource |
| | | private TVipOrderRefundService vipOrderRefundService; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | if (payOrderQueryDto.getType()==1){ |
| | |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | chargingOrderRefund.setRefundStatus(2); |
| | | chargingOrderRefund.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | | this.baseMapper.updateById(tChargingOrder); |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | if (payOrderQueryDto.getType()==2){ |
| | | TShoppingOrder tChargingOrder = shoppingOrderService.getById(payOrderQueryDto.getOrderId()); |
| | |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | |
| | | tChargingOrder.setRefundStatus(2); |
| | | tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | | |
| | | |
| | | shoppingOrderService.updateById(tChargingOrder); |
| | | |
| | | shoppingOrderRefundService.save(chargingOrderRefund); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ |
| | | return R.fail("退款金额需小于支付金额"); |
| | | } |
| | | |
| | | |
| | | TVipOrderRefund chargingOrderRefund = new TVipOrderRefund(); |
| | | chargingOrderRefund.setVipOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | |
| | | tChargingOrder.setRefundStatus(2); |
| | | tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | | |
| | | |
| | | vipOrderService.updateById(tChargingOrder); |
| | | |
| | | vipOrderRefundService.save(chargingOrderRefund); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | .eq("recharge_payment_status",2); |
| | | switch (dto.getType()){ |
| | | case 1: |
| | | eq.between("start_time", localDateTime, localDateTime1); |
| | | eq.between("pay_time", localDateTime, localDateTime1); |
| | | break; |
| | | case 2: |
| | | eq.between("end_time", localDateTime, localDateTime1); |
| | |
| | | } |
| | | 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(); |
| | |
| | | siteIds = data; |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(pageList.getSiteId()); |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | } |
| | |
| | | @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); |
| | |
| | | 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 |
| | | # server-addr: 127.0.0.1:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | # server-addr: 192.168.110.169:8848 |
| | | # server-addr: 127.0.0.1:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | # server-addr: 192.168.110.169:8848 |
| | | # server-addr: 127.0.0.1:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | |
| | | <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 |
| | |
| | | and t1.status = #{req.state} |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.bill_time between #{startTime1} and #{startTime2} |
| | | 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> |
| | |
| | | and t1.charging_gun_id = #{req.gunId} |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.start_time between #{startTime1} and #{startTime2}) |
| | | and (t1.pay_time between #{startTime1} and #{startTime2}) |
| | | </if> |
| | | <if test="endTime1 != null and endTime1!=''"> |
| | | and (t1.end_time between #{endTime1} and #{endTime2}) |
| | |
| | | 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 |
| | |
| | | |
| | | </select> |
| | | <select id="chargingList" resultType="com.ruoyi.order.api.vo.ChargingOrderListVO"> |
| | | select t1.* ,t1.current as chargingCapacity,t1.payment_amount as paymentAmount,t1.electricity as chargingCapacity from t_charging_order t1 |
| | | select t1.*, |
| | | t1.current as chargingCapacity,t1.payment_amount as paymentAmount,t1.electricity as chargingCapacity from t_charging_order t1 |
| | | where 1=1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | |
| | | #{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> |
| | |
| | | and t1.site_id = #{req.siteId} |
| | | </if> |
| | | <if test="startTime1 != null and startTime1!=''"> |
| | | and (t1.start_time between #{startTime1} and #{startTime2}) |
| | | and (t1.pay_time between #{startTime1} and #{startTime2}) |
| | | </if> |
| | | <if test="endTime1 != null and endTime1!=''"> |
| | | and (t1.end_time between #{endTime1} and #{endTime2}) |
| | |
| | | </foreach> |
| | | </if> |
| | | GROUP BY |
| | | time |
| | | ORDER BY |
| | | time |
| | | </select> |
| | | <select id="countAllUserData" resultType="java.util.Map"> |
| | |
| | | <if test="null != query.content and '' != query.content"> |
| | | and a.content like CONCAT('%', #{query.content}, '%') |
| | | </if> |
| | | <if test="null != query.evaluateType"> |
| | | <if test="null != evaluationTagIds and evaluationTagIds.size() > 0"> |
| | | and a.id in (select order_evaluate_id from t_order_evaluate_tag where evaluation_tag_id in |
| | | <foreach collection="evaluationTagIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | |
| | | 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.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(); |
| | | |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | | @PostMapping("/getSet2") |
| | | public R<TIntegralRule> getSet2() { |
| | | 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=会员折扣说明," + |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("/getInfo1") |
| | | @ApiOperation(tags = {"小程序-积分管理"},value = "type 1=积分规则说明," + |
| | | "2=会员折扣说明," + |
| | | "3=优惠券说明," + |
| | | "4=双倍积分说明," + |
| | | "5=商城专享价说明," + |
| | | "6=会员协议," + |
| | | "7=用户协议," + |
| | | "8=隐私协议," + |
| | | "9=邀请好友说明," + |
| | | "10=资质证明," + |
| | | "11=开票说明") |
| | | public R<String> getInfo1(Integer type) { |
| | | THtml g = htmlService.getOne(new QueryWrapper<THtml>().eq("type",type)); |
| | | if (g == null){ |
| | | return R.ok(""); |
| | | } |
| | | return R.ok(g.getContent()); |
| | | } |
| | | |
| | | |
| | | |
| | | @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() { |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.OrderCodeUtil; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | |
| | | @Override |
| | | public Object vipInfoPay(TVip byId, BigDecimal payMoney, Integer payType,BigDecimal discountMoney,BigDecimal discount,Integer buyType, Long userId) { |
| | | TAppUser user = appUserClient.getUserById(userId).getData(); |
| | | |
| | | |
| | | //生成会员购买订单 |
| | | |
| | | TVipOrder shopOrder = new TVipOrder(); |
| | | shopOrder.setCode(OrderCodeUtil.getOrderCode("HY")); |
| | | shopOrder.setType(1); |
| | | |
| | | shopOrder.setAppUserId(userId); |
| | | shopOrder.setType(1); |
| | | shopOrder.setVipId(byId.getId()); |
| | |
| | | shopOrder.setPaymentStatus(1); |
| | | shopOrder.setPaymentType(payType); |
| | | shopOrder.setPayTime(LocalDateTime.now()); |
| | | orderClient.addVipOrder(shopOrder).getData(); |
| | | |
| | | R<Long> longR = orderClient.addVipOrder(shopOrder); |
| | | if(200 != longR.getCode()){ |
| | | return AjaxResult.error(longR.getMsg()); |
| | | } |
| | | |
| | | if (payType==1){ |
| | | //调起支付 |
| | |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | } |
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; |
| | | } |
| | | } |
| | |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | # server-addr: 127.0.0.1:8848 # nacos注册中心地址 |
| | | # server-addr: 127.0.0.1:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |
| | |
| | | package com.ruoyi.payment.ali.v2; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.AlipayConfig; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | |
| | | log.info("请求参数:{}", req); |
| | | log.info("返回结果:{}", response.getBody()); |
| | | if (response.isSuccess()) { |
| | | return JSON.parseObject(response.getBody(), RefundResp.class); |
| | | JSONObject jsonObject = JSON.parseObject(response.getBody()); |
| | | RefundResp alipay_trade_refund_response = jsonObject.getObject("alipay_trade_refund_response", RefundResp.class); |
| | | return alipay_trade_refund_response; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | 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 |
| | | # server-addr: 127.0.0.1:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # data-id: seata-server.properties |
| | |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | # server-addr: 192.168.110.169:8848 |
| | | # server-addr: 127.0.0.1:8848 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | # group: DEFAULT_GROUP |
| | | # username: nacos |
| | |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | # server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | # server-addr: 127.0.0.1:8848 # nacos注册中心地址 |
| | | # namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | # group: DEFAULT_GROUP |
| | | # application: seata-server #Nacos 中 Seata 名称 |