Merge remote-tracking branch 'origin/master'
| | |
| | | public R<List<TAppUserCar>> getCarByIds(List<Long> carIds) { |
| | | return R.fail("根据用户车辆id查询车辆信息失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public R<TAppUserCar> getCarById(String id) { |
| | | return R.fail("根据用户车辆id查询车辆信息失败:"+throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TAppUserCar> getAppUserCarByLicensePlate(String licensePlate) { |
| | | return R.fail("根据车牌号查询数据失败:" + throwable.getMessage()); |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | */ |
| | | @PostMapping(value = "/t-app-user-car/t-app-user-car/getCarByIds") |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Long> carIds); |
| | | @PostMapping(value = "/t-app-user-car/t-app-user-car/getCarById/{id}") |
| | | public R<TAppUserCar> getCarById(@PathVariable("id") String id); |
| | | |
| | | |
| | | /** |
| | |
| | | @TableField("create_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | @TableField(exist = false) |
| | | private Integer continueDays; |
| | | |
| | | |
| | | } |
| | |
| | | @TableField(exist = false) |
| | | private Integer type; |
| | | |
| | | @TableField(exist = false) |
| | | private TVip vip; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @TableField("create_time") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private LocalDateTime createTime; |
| | | @TableField(exist = false) |
| | | private String avatar; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.account.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | | * </p> |
| | | * |
| | | * @author 无关风月 |
| | | * @since 2024-08-06 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_vip") |
| | | @ApiModel(value="TVip对象", description="") |
| | | public class TVip extends BasePojo { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "会员名称") |
| | | @TableField("name") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "前端是否显示(0=否,1=是)") |
| | | @TableField("reveal") |
| | | private Integer reveal; |
| | | |
| | | @ApiModelProperty(value = "月卡价格") |
| | | @TableField("monthly_card") |
| | | private BigDecimal monthlyCard; |
| | | |
| | | @ApiModelProperty(value = "月卡显示(0=否,1=是)") |
| | | @TableField("monthly_card_reveal") |
| | | private Integer monthlyCardReveal; |
| | | |
| | | @ApiModelProperty(value = "月卡折扣") |
| | | @TableField("monthly_card_discount") |
| | | private BigDecimal monthlyCardDiscount; |
| | | |
| | | @ApiModelProperty(value = "月卡折扣开始时间") |
| | | @TableField("monthly_card_discount_start") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime monthlyCardDiscountStart; |
| | | |
| | | @ApiModelProperty(value = "月卡折扣结束时间") |
| | | @TableField("monthly_card_discount_end") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime monthlyCardDiscountEnd; |
| | | |
| | | @ApiModelProperty(value = "月卡折扣显示(0=否,1=是)") |
| | | @TableField("monthly_card_discount_reveal") |
| | | private Integer monthlyCardDiscountReveal; |
| | | |
| | | @ApiModelProperty(value = "季卡价格") |
| | | @TableField("season_card") |
| | | private BigDecimal seasonCard; |
| | | |
| | | @ApiModelProperty(value = "季卡显示(0=否,1=是)") |
| | | @TableField("season_card_reveal") |
| | | private Integer seasonCardReveal; |
| | | |
| | | @ApiModelProperty(value = "季卡折扣") |
| | | @TableField("season_card_discount") |
| | | private BigDecimal seasonCardDiscount; |
| | | |
| | | @ApiModelProperty(value = "季卡折扣开始时间") |
| | | @TableField("season_card_discount_start") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime seasonCardDiscountStart; |
| | | |
| | | @ApiModelProperty(value = "季卡折扣结束时间") |
| | | @TableField("season_card_discount_end") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime seasonCardDiscountEnd; |
| | | |
| | | @ApiModelProperty(value = "季卡折扣显示(0=否,1=是)") |
| | | @TableField("season_card_discount_reveal") |
| | | private Integer seasonCardDiscountReveal; |
| | | |
| | | @ApiModelProperty(value = "年卡价格") |
| | | @TableField("annual_card") |
| | | private BigDecimal annualCard; |
| | | |
| | | @ApiModelProperty(value = "年卡显示(0=否,1=是)") |
| | | @TableField("annual_card_reveal") |
| | | private Integer annualCardReveal; |
| | | |
| | | @ApiModelProperty(value = "年卡折扣") |
| | | @TableField("annual_card_discount") |
| | | private BigDecimal annualCardDiscount; |
| | | |
| | | @ApiModelProperty(value = "年卡折扣开始时间") |
| | | @TableField("annual_card_discount_start") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime annualCardDiscountStart; |
| | | |
| | | @ApiModelProperty(value = "年卡折扣结束时间") |
| | | @TableField("annual_card_discount_end") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") |
| | | private LocalDateTime annualCardDiscountEnd; |
| | | |
| | | @ApiModelProperty(value = "年卡折扣显示(0=否,1=是)") |
| | | @TableField("annual_card_discount_reveal") |
| | | private Integer annualCardDiscountReveal; |
| | | |
| | | @ApiModelProperty(value = "折扣次数") |
| | | @TableField("discount_times") |
| | | private Integer discountTimes; |
| | | |
| | | @ApiModelProperty(value = "最高抵扣金额") |
| | | @TableField("maximum_deduction") |
| | | private BigDecimal maximumDeduction; |
| | | |
| | | @ApiModelProperty(value = "抵扣类型(1=服务费)") |
| | | @TableField("deduction_type") |
| | | private Integer deductionType; |
| | | |
| | | @ApiModelProperty(value = "优惠券[{\"id\":1,\"number\":1}]") |
| | | @TableField("coupon") |
| | | private String coupon; |
| | | |
| | | @ApiModelProperty(value = "双倍积分开关(0=否,1=是)") |
| | | @TableField("double_integration") |
| | | private Integer doubleIntegration; |
| | | |
| | | @ApiModelProperty(value = "商城专享价开关(0=否,1=是)") |
| | | @TableField("mall_exclusive_price") |
| | | private Integer mallExclusivePrice; |
| | | @ApiModelProperty(value = "内部会员折扣") |
| | | @TableField("discount") |
| | | private BigDecimal discount; |
| | | @ApiModelProperty(value = "添加的会员类型 1常规 2内部") |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称和张数 后台列表展示使用") |
| | | @TableField(exist = false) |
| | | private String couponName; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @GetMapping("/site/getSiteList/byUserId") |
| | | R<List<GetSiteListDTO>> getSiteListByUserId(@RequestParam("userId") Long userId); |
| | | @GetMapping("/getPartnerR/{id}") |
| | | @GetMapping("/partner/getPartnerR/{id}") |
| | | R<Partner> getPartnerR(@PathVariable("id") Integer id); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R<List<UploadRealTimeMonitoringData>> getAll(MongoChargingOrderQuery mongoChargingOrderQuery) { |
| | | public R<UploadRealTimeMonitoringPageData> getAll(MongoChargingOrderQuery mongoChargingOrderQuery) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public R delete(String id) { |
| | | return null; |
| | | } |
| | | }; |
| | |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import com.ruoyi.integration.api.factory.UploadRealTimeMonitoringDataFallbackFactory; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | |
| | | R<List<UploadRealTimeMonitoringData>> getDataByOrderCode(@RequestParam("code") String code); |
| | | |
| | | @PostMapping("/uploadRealTimeMonitoringData/getAll") |
| | | R<List<UploadRealTimeMonitoringData>> getAll(@RequestBody MongoChargingOrderQuery mongoChargingOrderQuery); |
| | | R<UploadRealTimeMonitoringPageData> getAll(@RequestBody MongoChargingOrderQuery mongoChargingOrderQuery); |
| | | |
| | | @PostMapping("/uploadRealTimeMonitoringData/delete") |
| | | R delete(@RequestParam("id") String id); |
| | | } |
| | |
| | | public class ChargingOrderAndUploadRealTimeMonitoringDataDto extends BaseModel { |
| | | |
| | | private String id; |
| | | private Integer index; |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
New file |
| | |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 上传实时监测数据 |
| | | **/ |
| | | |
| | | @Data |
| | | public class PageChargingOrderAndUploadRealTimeMonitoringDataDto extends BaseModel { |
| | | |
| | | private List<ChargingOrderAndUploadRealTimeMonitoringDataDto> records; |
| | | private Long total; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | @Document(collection = "upload_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UploadRealTimeMonitoringData extends BaseModel { |
| | | @Id |
| | | private String id; |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | |
| | | |
| | | private BigDecimal period_charging_degree;// @ApiModelProperty("时段充电度数") |
| | | |
| | | |
| | | |
| | | |
| | | private Integer orderType; //1=充电订单(小程序),2=充电订单(刷卡)) |
| | | private Integer siteId; |
| | | private Integer status; //状态(0=未知,1=等待中/已插枪,2=启动中,3=充电中,4=停止中,5=已结束)" |
New file |
| | |
| | | package com.ruoyi.integration.api.model; |
| | | |
| | | import jdk.internal.dynalink.linker.LinkerServices; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 上传实时监测数据 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "upload_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UploadRealTimeMonitoringPageData extends BaseModel { |
| | | Long count; |
| | | List<UploadRealTimeMonitoringData> records; |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | @ApiModelProperty(value = "序号") |
| | | @TableField(exist = false) |
| | | private Integer xuhao; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | |
| | | @TableField("site_id") |
| | | private Integer siteId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "停车场id") |
| | | @TableField("parking_lot_id") |
| | | private Integer parkingLotId; |
| | |
| | | @TableId(value = "id", type = IdType.NONE) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "地址json") |
| | | @TableField("address_json") |
| | | private String addressJson; |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | | private String code; |
| | |
| | | @TableField("vip_id") |
| | | private Integer vipId; |
| | | @ApiModelProperty(value = "购买的会员id") |
| | | @TableField("vip_id") |
| | | @TableField("order_amount") |
| | | private BigDecimal orderAmount; |
| | | } |
| | |
| | | @ApiModelProperty(value = "结算服务费备注") |
| | | @TableField("service_remark") |
| | | private String serviceRemark; |
| | | @ApiModelProperty(value = "电费结算方编码") |
| | | @TableField("confirm_code") |
| | | private String confirmCode; |
| | | |
| | | @ApiModelProperty(value = "计量电量(电量合计)") |
| | | @TableField("metering_electronic") |
| | |
| | | @ApiModelProperty(value = "合作商充电服务费根据合同约定分成比例") |
| | | @TableField("service_partner") |
| | | private BigDecimal servicePartner; |
| | | @ApiModelProperty(value = "合作商充电服务费根据合同约定分成比例") |
| | | @TableField(exist = false) |
| | | private String servicePartnerString; |
| | | @ApiModelProperty(value = "平台充电服务费根据合同约定分成比例") |
| | | @TableField(exist = false) |
| | | private String platformString; |
| | | @ApiModelProperty(value = "合作商充电服务费根据合同约定分成金额") |
| | | @TableField("service_money") |
| | | private BigDecimal serviceMoney; |
| | |
| | | @ApiModelProperty(value = "站点名称") |
| | | @TableField(exist = false) |
| | | private String siteName; |
| | | @ApiModelProperty(value = "服务费:合计可分配金额") |
| | | @TableField(exist = false) |
| | | private String serviceChargeTotal; |
| | | @ApiModelProperty(value = "合作商名称") |
| | | @TableField(exist = false) |
| | | private String partnerName; |
| | |
| | | @TableField("refund_serial_number") |
| | | private String refundSerialNumber; |
| | | |
| | | @ApiModelProperty(value = "地址json") |
| | | @TableField("address_json") |
| | | private String addressJson; |
| | | |
| | | @ApiModelProperty(value = "退款成功时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("refund_time") |
| | |
| | | @ApiModelProperty(value = "主键") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | @ApiModelProperty(value = "退款状态(1=退款中,2=退款成功)") |
| | | @TableField("refund_status") |
| | | private Integer refundStatus; |
| | | |
| | | @ApiModelProperty(value = "订单编号") |
| | | @TableField("code") |
| | |
| | | @ApiModelProperty(value = "类型(1=开始,2=结束)") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "站点ids 选择全部 不传") |
| | | private List<Integer> siteIds; |
| | | private Integer siteIds; |
| | | @ApiModelProperty(value = "合作商id ") |
| | | private Integer partnerId; |
| | | @ApiModelProperty(value = "开始时间2020-01-01 00:00:00") |
| | |
| | | @ApiModelProperty(value = "结束时间2021-01-01 23:59:59") |
| | | private String endTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @ApiModel(value = "SettlementExportVO对象", description = "结算下载导出信息") |
| | | public class SettlementExportVO extends TChargingOrder { |
| | | |
| | | @ApiModelProperty(value = "站点编号") |
| | | private String siteCode; |
| | | @ApiModelProperty(value = "站点名称") |
| | | private String siteName; |
| | | @ApiModelProperty(value = "终端名称") |
| | | private String name; |
| | | @ApiModelProperty(value = "所属城市") |
| | | private String city; |
| | | @ApiModelProperty(value = "所属市区") |
| | | private String districts; |
| | | @ApiModelProperty(value = "所属合作商") |
| | | private String partnerName; |
| | | @ApiModelProperty(value = "电站类型") |
| | | private String siteType; |
| | | @ApiModelProperty(value = "售电模式") |
| | | private String electronicType; |
| | | @ApiModelProperty(value = "站点状态") |
| | | private String siteStatus; |
| | | @ApiModelProperty(value = "运营类型") |
| | | private String businessCategory; |
| | | @ApiModelProperty(value = "计费策略") |
| | | private String accountingStrategy; |
| | | @ApiModelProperty(value = "收款方式") |
| | | private String payTypeName; |
| | | @ApiModelProperty(value = "订单创建时间") |
| | | private String createTime1; |
| | | @ApiModelProperty(value = "充电开始时间") |
| | | private String startTime1; |
| | | @ApiModelProperty(value = "充电结束时间") |
| | | private String endTime1; |
| | | @ApiModelProperty(value = "订单状态") |
| | | private String statusName; |
| | | @ApiModelProperty(value = "订单类型") |
| | | private String orderTypeName; |
| | | @ApiModelProperty(value = "充电形式") |
| | | private String chargingType; |
| | | @ApiModelProperty(value = "充电结束账号") |
| | | private String phone; |
| | | @ApiModelProperty(value = "是否免费订单") |
| | | private String isFree; |
| | | @ApiModelProperty(value = "平均电费单价") |
| | | private String averageElectronic; |
| | | @ApiModelProperty(value = "平均服务费实际单价") |
| | | private String averageServiceChargeReal; |
| | | @ApiModelProperty(value = "平均服务费挂牌单价") |
| | | private String averageServiceCharge; |
| | | |
| | | @ApiModelProperty(value = "充电时长(分钟)") |
| | | private String chargingSecond; |
| | | @ApiModelProperty(value = "充电前soc") |
| | | private String startSoc; |
| | | @ApiModelProperty(value = "充电后soc") |
| | | private String endSoc; |
| | | @ApiModelProperty(value = "是否限制SOC") |
| | | private String isSoc; |
| | | @ApiModelProperty(value = "限制SOC方式") |
| | | private String socType; |
| | | @ApiModelProperty(value = "限制Soc值") |
| | | private String socValue; |
| | | @ApiModelProperty(value = "客户类型") |
| | | private String userType; |
| | | @ApiModelProperty(value = "会员类型") |
| | | private String vipType; |
| | | @ApiModelProperty(value = "是否PLUS订单") |
| | | private String isPlus; |
| | | @ApiModelProperty(value = "客户编号") |
| | | private String userCode; |
| | | @ApiModelProperty(value = "真实姓名") |
| | | private String realName; |
| | | @ApiModelProperty(value = "设备号") |
| | | private String deviceCode; |
| | | @ApiModelProperty(value = "手机号") |
| | | private String userPhone; |
| | | @ApiModelProperty(value = "车牌号") |
| | | private String licensePlate; |
| | | @ApiModelProperty(value = "选择车型") |
| | | private String vehicleModel; |
| | | @ApiModelProperty(value = "车辆品牌") |
| | | private String vehicleBrand; |
| | | |
| | | @ApiModelProperty(value = "电费结算方编码") |
| | | private String confirmCode; |
| | | @ApiModelProperty(value = "电费结算方法名称(管理公司)") |
| | | private String companyName; |
| | | @ApiModelProperty(value = "计费方式") |
| | | private String moneyType; |
| | | @ApiModelProperty(value = "设备接入方式") |
| | | private String deviceType; |
| | | @ApiModelProperty(value = "预支付类型") |
| | | private String beforePayType; |
| | | @ApiModelProperty(value = "是否安全防护订单") |
| | | private String isSafe; |
| | | } |
| | |
| | | private List<Map<String,Object>> maps; |
| | | @ApiModelProperty("下方折线图") |
| | | private List<Map<String,Object>> maps1; |
| | | private BigDecimal allMoney; |
| | | private BigDecimal commissionAmount; |
| | | } |
| | |
| | | * 用户名id |
| | | */ |
| | | private Long userId; |
| | | private String userIdStr; |
| | | |
| | | /** |
| | | * 用户手机号 |
| | |
| | | // 计算预付金额能充多少度普通电 |
| | | BigDecimal divide1 = money.divide(electrovalence, 2, BigDecimal.ROUND_HALF_UP); |
| | | // 计算冲会员电能充多少度会员电 |
| | | BigDecimal divide = vipElectrovalence.divide(electrovalence, 2, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal divide = money.divide(vipElectrovalence, 2, BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal subtract = divide.subtract(divide1); |
| | | // 优惠金额 |
| | | data.setMoney(subtract.multiply(vipElectrovalence).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | data.setMoney(subtract.multiply(electrovalence.subtract(vipElectrovalence)).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | return AjaxResult.ok(data); |
| | | } |
| | | /** |
| | |
| | | public R<List<TAppUserCar>> getCarByIds(@RequestBody List<Long> carIds){ |
| | | return R.ok(appUserCarService.list(Wrappers.lambdaQuery(TAppUserCar.class).in(TAppUserCar::getId,carIds))); |
| | | } |
| | | |
| | | @PostMapping(value = "/t-app-user-car/getCarById/{id}") |
| | | public R<TAppUserCar> getCarById(@PathVariable("id")String id){ |
| | | return R.ok(appUserCarService.lambdaQuery().eq(TAppUserCar::getId,id).one()); |
| | | } |
| | | |
| | | /** |
| | | * 根据车牌号查询数据 |
| | |
| | | import com.ruoyi.order.api.model.TGrantVip; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.dto.UnitListQueryDto; |
| | | import com.ruoyi.other.api.feignClient.IntegralRuleClient; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | |
| | | |
| | | |
| | | @ApiOperation(value = "优惠卷详情(1可使用2不可用)", tags = {"小程序-个人中心"}) |
| | | @GetMapping(value = "/user/coupon/getById") |
| | | @PostMapping(value = "/user/coupon/getById") |
| | | public R<TAppCoupon> couponGetById(@RequestParam("id")Long id) { |
| | | TAppCoupon appCoupon = appCouponService.getById(id); |
| | | appCoupon.setUid(id.toString()); |
| | |
| | | TVip info = vipClient.getInfo1(giveVipDto.getVipId()).getData(); |
| | | switch (giveVipDto.getType()){ |
| | | case 1: |
| | | bigDecimal = bigDecimal.add(info.getMonthlyCard()); |
| | | bigDecimal = bigDecimal.add(info.getMonthlyCard()==null?new BigDecimal(0):info.getMonthlyCard()); |
| | | break; |
| | | case 2: |
| | | bigDecimal = bigDecimal.add(info.getSeasonCard()); |
| | | bigDecimal = bigDecimal.add(info.getSeasonCard()==null?new BigDecimal(0):info.getSeasonCard()); |
| | | break; |
| | | case 3: |
| | | bigDecimal = bigDecimal.add(info.getAnnualCard()); |
| | | bigDecimal = bigDecimal.add(info.getAnnualCard()==null?new BigDecimal(0):info.getAnnualCard()); |
| | | break; |
| | | } |
| | | //增加vipDetail |
| | |
| | | @PostMapping(value = "/user/invite/page") |
| | | public R<Page<TInviteUser>> invitePage(@RequestBody BasePage basePage) { |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | |
| | | Page<TInviteUser> page = inviteUserService.lambdaQuery().eq(TInviteUser::getAppUserId, userId).isNotNull(TInviteUser::getAward).orderByDesc(TInviteUser::getCreateTime).page(Page.of(basePage.getPageCurr(), basePage.getPageSize())); |
| | | for (TInviteUser record : page.getRecords()) { |
| | | TAppUser byId = appUserService.getById(record.getBeInvitedAppUserId()); |
| | | record.setAvatar(byId.getAvatar()); |
| | | } |
| | | return R.ok(page); |
| | | } |
| | | |
| | |
| | | .eq(TAppUserSign::getAppUserId, userId) |
| | | .orderByDesc(TAppUserSign::getSignDay) |
| | | .list(); |
| | | for (TAppUserSign signRecord : signRecords) { |
| | | int i = signDayUtil.calculateContinuousSignDays1(signRecord.getAppUserId(), signRecord.getSignDay()); |
| | | signRecord.setContinueDays(i); |
| | | } |
| | | return R.ok(signRecords); |
| | | |
| | | } |
| | |
| | | public R getModel(String id) throws Exception { |
| | | String modelById = CarBrandUtil.getModelById(id); |
| | | JSONObject jsonObject = JSON.parseObject(modelById); |
| | | Integer code = jsonObject.getInteger("code"); |
| | | if (code==701){ |
| | | return R.fail("当前品牌暂无分类"); |
| | | } |
| | | JSONArray data = jsonObject.getJSONArray("data"); |
| | | JSONArray backList = new JSONArray(); |
| | | for (Object datum : data) { |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.dto.SendCouponDto; |
| | | import com.ruoyi.account.api.model.TAppUserVipDetail; |
| | | import com.ruoyi.account.api.model.TVip; |
| | | import com.ruoyi.account.api.vo.GetAppUserVipDetail; |
| | | import com.ruoyi.account.service.TAppUserVipDetailService; |
| | | import com.ruoyi.account.util.VipInfoDto; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.TCoupon; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.dto.VipCouponDto; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | |
| | | |
| | | for (TAppUserVipDetail tAppUserVipDetail : list) { |
| | | if(null != tAppUserVipDetail.getVipId()){ |
| | | TVip data = vipClient.getInfo1(tAppUserVipDetail.getVipId()).getData(); |
| | | tAppUserVipDetail.setVipName(data.getName()); |
| | | tAppUserVipDetail.setType(data.getType()); |
| | | TVip tVip = JSONObject.parseObject(tAppUserVipDetail.getVipJson(), TVip.class); |
| | | // TVip data = vipClient.getInfo1(tAppUserVipDetail.getVipId()).getData(); |
| | | tAppUserVipDetail.setVipName(tVip.getName()); |
| | | tAppUserVipDetail.setType(tVip.getType()); |
| | | tAppUserVipDetail.setVip(tVip); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.account.mapper.TAppUserMapper; |
| | | import com.ruoyi.account.service.TAppUserService; |
| | | import com.ruoyi.account.service.TInviteUserService; |
| | | import com.ruoyi.account.util.RptUtils; |
| | | import com.ruoyi.account.wx.model.WeixinProperties; |
| | | import com.ruoyi.account.wx.pojo.AppletUserDecodeData; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | |
| | | import com.ruoyi.system.api.model.LoginUserApplet; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.HashMap; |
| | |
| | | break; |
| | | } |
| | | } |
| | | appUser.setAvatar(appletUserDecodeData.getAvatarUrl()); |
| | | |
| | | appUser.setAvatar(StringUtils.hasLength(appUser.getAvatar())?appUser.getAvatar():"http://221.182.45.100:8090/2024-10-26/logo.png"); |
| | | appUser.setName(StringUtils.hasLength(appUser.getName())?appUser.getName():RptUtils.around(appletUserDecodeData.getPhoneNumber(),3,4)); |
| | | appUser.setCity(appletUserDecodeData.getCity()); |
| | | appUser.setName(appletUserDecodeData.getNickName()); |
| | | appUser.setProvince(appletUserDecodeData.getProvince()); |
| | | appUser.setWxOpenid(appletUserDecodeData.getOpenId()); |
| | | this.saveOrUpdate(appUser); |
| | |
| | | } |
| | | } |
| | | appUser.setAliOpenid(response.getOpenId()); |
| | | appUser.setAvatar(StringUtils.hasLength(appUser.getAvatar())?appUser.getAvatar():"http://221.182.45.100:8090/2024-10-26/logo.png"); |
| | | appUser.setName(StringUtils.hasLength(appUser.getName())?appUser.getName():RptUtils.around(phone,3,4)); |
| | | this.saveOrUpdate(appUser); |
| | | if(Objects.nonNull(inviteUserId)){ |
| | | inviteUserService.saveInviteUser(appUser.getId(), inviteUserId); |
| | |
| | | LoginUserApplet loginUserApplet = new LoginUserApplet(); |
| | | if(ObjectUtils.isNotNull(appUser)){ |
| | | loginUserApplet.setUserId(appUser.getId()); |
| | | loginUserApplet.setUserIdStr(appUser.getId().toString()); |
| | | loginUserApplet.setName(appUser.getName()); |
| | | loginUserApplet.setPhone(appUser.getPhone()); |
| | | loginUserApplet.setAvatar(appUser.getAvatar()); |
| | |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京B\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京C\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京D\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京E\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京F\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京G\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京H\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京J\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京K\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京L\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京M\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"京Y\",\n" + |
| | | " \"city\": \"北京\",\n" + |
| | | " \"province\": \"北京\",\n" + |
| | | " \"Pcode\": \"BJ\",\n" + |
| | | " \"AreaCode\": \"110000\"\n" + |
| | | " \"AreaCode\": \"110100\"\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " \"Hp\": \"豫A\",\n" + |
New file |
| | |
| | | package com.ruoyi.account.util; |
| | | |
| | | /** |
| | | * 脱敏工具类 |
| | | */ |
| | | public class RptUtils { |
| | | private static final String SYMBOL = "*"; |
| | | |
| | | /** |
| | | * 脱敏 |
| | | * @param str 待脱敏字符串 |
| | | * @param left 左边保留多少位 |
| | | * @param right 右边保留多少位 |
| | | * @return 脱敏结果,除左右外,其余字符将被替换为* |
| | | */ |
| | | public static String around(String str, int left, int right){ |
| | | if (str == null || (str.length() < left + right +1)){ |
| | | return str; |
| | | } |
| | | String regex = String.format("(?<=\\w{%d})\\w(?=\\w{%d})", left, right); |
| | | return str.replaceAll(regex, SYMBOL); |
| | | } |
| | | |
| | | /** |
| | | * 正则表达式实现金额数据脱敏 |
| | | * @param money |
| | | * @return |
| | | */ |
| | | public static String getMoney(String money){ |
| | | //保留0个数到0个结束 |
| | | return around(money,0,0); |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.ruoyi.account.api.model.TAppUserSign; |
| | | import com.ruoyi.account.service.TAppUserSignService; |
| | | import org.springframework.cglib.core.Local; |
| | | import org.springframework.stereotype.Component; |
| | | import sun.rmi.server.LoaderHandler; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | |
| | | return calculateMaxContinuousSignDays(signDays); |
| | | } |
| | | |
| | | public int calculateContinuousSignDays1(Long userId, LocalDate date) { |
| | | DateTime startOfMonth = DateUtil.beginOfMonth(new Date()); |
| | | // DateTime endOfMonth = DateUtil.endOfMonth(new Date()); |
| | | // 获取用户的所有签到记录 |
| | | List<TAppUserSign> signRecords = signService.lambdaQuery() |
| | | .between(TAppUserSign::getSignDay, startOfMonth, date) |
| | | .eq(TAppUserSign::getAppUserId, userId) |
| | | .orderByDesc(TAppUserSign::getSignDay) |
| | | .list(); |
| | | |
| | | // 如果没有签到记录,则返回0 |
| | | if (signRecords.isEmpty()) { |
| | | return 0; |
| | | } |
| | | |
| | | // 将签到日期转换为 LocalDate 列表,并按照日期排序 |
| | | List<LocalDate> signDays = signRecords.stream() |
| | | .map(TAppUserSign::getSignDay) |
| | | .sorted() |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 计算连续签到的最大天数 |
| | | return calculateMaxContinuousSignDays(signDays); |
| | | } |
| | | |
| | | /** |
| | | * 根据签到日期列表计算连续签到的最大天数 |
| | | * @param signDays 签到日期列表 |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.chargingPile.api.dto.GetSiteListDTO; |
| | | import com.ruoyi.chargingPile.api.feignClient.ParkingLotClient; |
| | | import com.ruoyi.chargingPile.api.model.*; |
| | |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | 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.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.other.api.feignClient.VipClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | |
| | | |
| | | @Resource |
| | | private SysUserRoleClient userRoleClient; |
| | | |
| | | @Resource |
| | | private VipClient vipClient; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | /** |
| | |
| | | Site byId = siteService.getById(one.getSiteId()); |
| | | TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId()); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list(); |
| | | list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); |
| | | for (TAccountingStrategyDetail tAccountingStrategyDetail : list) { |
| | | // 当前时间属于那个阶段 取哪个阶段的电价 |
| | | if(LocalTime.now().isAfter(LocalTime.parse(tAccountingStrategyDetail.getStartTime())) && LocalTime.now().isBefore(LocalTime.parse(tAccountingStrategyDetail.getEndTime()))){ |
| | | siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | if(null != byId1.getDiscount()){ |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().multiply(byId1.getDiscount()).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | }else{ |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | } |
| | | if(DateUtils.string2LocalTime(tAccountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(tAccountingStrategyDetail.getEndTime() + ("23:59:59".equals(tAccountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | } |
| | | siteInfoVO.setChargingGunId(chargingGun.getId()); |
| | |
| | | Site byId = siteService.getById(one.getSiteId()); |
| | | TAccountingStrategy byId1 = accountingStrategyService.getById(byId.getAccountingStrategyId()); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.lambdaQuery().eq(TAccountingStrategyDetail::getAccountingStrategyId, byId1.getId()).list(); |
| | | list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); |
| | | for (TAccountingStrategyDetail tAccountingStrategyDetail : list) { |
| | | // 当前时间属于那个阶段 取哪个阶段的电价 |
| | | if(LocalTime.now().isAfter(LocalTime.parse(tAccountingStrategyDetail.getStartTime())) && LocalTime.now().isBefore(LocalTime.parse(tAccountingStrategyDetail.getEndTime()))){ |
| | | siteInfoVO.setElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | if(null != byId1.getDiscount()){ |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().multiply(byId1.getDiscount()).setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | }else{ |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence()); |
| | | } |
| | | if(DateUtils.string2LocalTime(tAccountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(tAccountingStrategyDetail.getEndTime() + ("23:59:59".equals(tAccountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ |
| | | siteInfoVO.setVipElectrovalence(tAccountingStrategyDetail.getElectrovalence().setScale(4, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | } |
| | | siteInfoVO.setChargingPileId(one.getId()); |
| | |
| | | import com.ruoyi.chargingPile.service.*; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalTime; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | public R<TAccountingStrategyDetail> getDetailBySiteId(@RequestParam("siteId") Integer siteId){ |
| | | Site site = siteService.getById(siteId); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | TAccountingStrategyDetail one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | return R.ok(one); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.list(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId())); |
| | | list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); |
| | | for (TAccountingStrategyDetail accountingStrategyDetail : list) { |
| | | if(DateUtils.string2LocalTime(accountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(accountingStrategyDetail.getEndTime() + ("23:59:59".equals(accountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ |
| | | return R.ok(accountingStrategyDetail); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 通过桩id查询当前时段使用的策略明细 |
| | |
| | | public R<TAccountingStrategyDetail> getDetailByCode(@RequestParam("code") String code){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,code) |
| | | .eq(TChargingPile::getCode,code).eq(TChargingPile::getDelFlag, 0) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(chargingPile)){ |
| | | return R.fail("未查询到该桩设备"); |
| | | } |
| | | TChargingGun chargingGun = chargingGunService.getOne(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getChargingPileId, chargingPile.getId()) |
| | | .eq(TChargingGun::getChargingPileId, chargingPile.getId()).eq(TChargingGun::getDelFlag, 0) |
| | | .last("LIMIT 1")); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(chargingGun.getAccountingStrategyId()); |
| | | TAccountingStrategyDetail one; |
| | | TAccountingStrategyDetail one = null; |
| | | if(Objects.nonNull(accountingStrategy)){ |
| | | one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.list(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId())); |
| | | list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); |
| | | for (TAccountingStrategyDetail accountingStrategyDetail : list) { |
| | | if(DateUtils.string2LocalTime(accountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(accountingStrategyDetail.getEndTime() + ("23:59:59".equals(accountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ |
| | | return R.ok(accountingStrategyDetail); |
| | | } |
| | | } |
| | | }else { |
| | | Site site = siteService.getById(chargingPile.getSiteId()); |
| | | accountingStrategy = accountingStrategyService.getById(site.getAccountingStrategyId()); |
| | | one = accountingStrategyDetailService.getOne(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId()) |
| | | .last(" and DATE_FORMAT(now(), '%H:%i') between start_time and end_time")); |
| | | List<TAccountingStrategyDetail> list = accountingStrategyDetailService.list(Wrappers.<TAccountingStrategyDetail>lambdaQuery() |
| | | .eq(TAccountingStrategyDetail::getAccountingStrategyId, accountingStrategy.getId())); |
| | | list.stream().filter(item -> "00:00".equals(item.getEndTime())).forEach(item -> item.setEndTime("23:59:59")); |
| | | for (TAccountingStrategyDetail accountingStrategyDetail : list) { |
| | | if(DateUtils.string2LocalTime(accountingStrategyDetail.getStartTime() + ":00").compareTo(LocalTime.now()) <= 0 |
| | | && DateUtils.string2LocalTime(accountingStrategyDetail.getEndTime() + ("23:59:59".equals(accountingStrategyDetail.getEndTime())?"":":00")).compareTo(LocalTime.now()) > 0){ |
| | | return R.ok(accountingStrategyDetail); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(one); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 校验充电桩计费模版是否准确 |
| | |
| | | public R<Boolean> checkChargingStrategy(@RequestBody CheckChargingStrategyDTO dto){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,dto.getCode()) |
| | | .eq(TChargingPile::getCode,dto.getCode()).eq(TChargingPile::getDelFlag, 0) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(chargingPile)){ |
| | | return R.ok(false); |
| | |
| | | public R<List<TAccountingStrategyDetail>> getDetailListByCode(@RequestParam("code") String code){ |
| | | // 查询桩 |
| | | TChargingPile chargingPile = chargingPileService.getOne(Wrappers.lambdaQuery(TChargingPile.class) |
| | | .eq(TChargingPile::getCode,code) |
| | | .eq(TChargingPile::getCode,code).eq(TChargingPile::getDelFlag, 0) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(chargingPile)){ |
| | | return R.fail("未查询到该桩设备"); |
| | | } |
| | | TChargingGun chargingGun = chargingGunService.getOne(Wrappers.lambdaQuery(TChargingGun.class) |
| | | .eq(TChargingGun::getChargingPileId, chargingPile.getId()) |
| | | .eq(TChargingGun::getChargingPileId, chargingPile.getId()).eq(TChargingGun::getDelFlag, 0) |
| | | .last("LIMIT 1")); |
| | | TAccountingStrategy accountingStrategy = accountingStrategyService.getById(chargingGun.getAccountingStrategyId()); |
| | | if(Objects.nonNull(accountingStrategy)){ |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.math.BigDecimal; |
| | | |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUser; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingGunClient; |
| | | import com.ruoyi.chargingPile.api.feignClient.SiteClient; |
| | | import com.ruoyi.chargingPile.api.model.Partner; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | 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.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.order.api.model.ExportUidDto; |
| | | import com.ruoyi.order.api.feignClient.OrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TSettlementConfirm; |
| | | import com.ruoyi.order.api.vo.AccountListVO; |
| | | import com.ruoyi.order.api.vo.ChargingBillListVO; |
| | | import com.ruoyi.order.api.vo.*; |
| | | |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.ChargingListQuery; |
| | | import com.ruoyi.order.api.vo.ChargingBillVO; |
| | | import com.ruoyi.order.api.vo.SettlementTotalVO; |
| | | import com.ruoyi.other.api.feignClient.OtherClient; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.codec.CharEncoding; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | import java.util.regex.Pattern; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private OrderClient orderClient; |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | @Resource |
| | | private ChargingGunClient chargingGunClient; |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | @Autowired |
| | | public TApplyChargingPileController(TApplyChargingPileService applyChargingPileService, TokenService tokenService, RedisService redisService) { |
| | |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @Resource |
| | | private OtherClient otherClient; |
| | | @Resource |
| | | private UploadRealTimeMonitoringDataClient uploadRealTimeMonitoringDataClient; |
| | | @ApiOperation(value = "下载", tags = {"管理后台-结算表记录"}) |
| | | @PutMapping("/downloadSettlement") |
| | | @Log(title = "【结算表记录】下载结算表", businessType = BusinessType.EXPORT) |
| | | public R downloadSettlement(@RequestBody ExportUidDto uid,HttpServletResponse response) |
| | | { |
| | | TSettlementConfirm data = chargingOrderClient.downloadSettlement(uid.getUid()).getData(); |
| | | for (TChargingOrder chargingOrder : data.getList()) { |
| | | SettlementExportVO settlementExportVO = new SettlementExportVO(); |
| | | |
| | | BeanUtils.copyProperties(data, settlementExportVO); |
| | | List<Site> data3 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData(); |
| | | if (data3!=null && (!data3.isEmpty())){ |
| | | TAppUser data4 = appUserClient.getUserById(chargingOrder.getAppUserId()).getData(); |
| | | if (data4.getVipId()== null ){ |
| | | settlementExportVO.setVipType("非会员"); |
| | | }else{ |
| | | List<Integer> vipIds = new ArrayList<>(); |
| | | //获取会员map |
| | | R<Map<Integer, String>> vipMap = otherClient.getVipMap(vipIds); |
| | | settlementExportVO.setVipType(vipMap.getData().get(data4.getVipId())); |
| | | } |
| | | settlementExportVO.setPhone(data4.getPhone()); |
| | | settlementExportVO.setRealName(data4.getName()); |
| | | if (chargingOrder.getAppUserCarId()!=null){ |
| | | List<TAppUserCar> data5 = appUserCarClient.getCarByIds(Arrays.asList(chargingOrder.getAppUserCarId())).getData(); |
| | | if (!data5.isEmpty()){ |
| | | settlementExportVO.setLicensePlate(data5.get(0).getLicensePlate()); |
| | | settlementExportVO.setVehicleModel(data5.get(0).getVehicleModel()); |
| | | settlementExportVO.setVehicleBrand(data5.get(0).getVehicleBrand()); |
| | | } |
| | | |
| | | } |
| | | settlementExportVO.setSiteCode(data3.get(0).getCode()); |
| | | settlementExportVO.setSiteName(data3.get(0).getName()); |
| | | settlementExportVO.setCity(data3.get(0).getCity()); |
| | | settlementExportVO.setDistricts(data3.get(0).getDistricts()); |
| | | Partner data1 = siteClient.getPartnerR(data3.get(0).getPartnerId()).getData(); |
| | | if (data1!=null){ |
| | | settlementExportVO.setPartnerName(data1.getName()); |
| | | } |
| | | switch (data3.get(0).getSiteType()){ |
| | | case 0: |
| | | settlementExportVO.setSiteType("其他"); |
| | | break; |
| | | case 1: |
| | | settlementExportVO.setSiteType("公共"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setSiteType("个人"); |
| | | break; |
| | | case 3: |
| | | settlementExportVO.setSiteType("公交(专业)"); |
| | | break; |
| | | case 4: |
| | | settlementExportVO.setSiteType("环卫(专用)"); |
| | | break; |
| | | case 5: |
| | | settlementExportVO.setSiteType("物流(专用)"); |
| | | break; |
| | | case 6: |
| | | settlementExportVO.setSiteType("出租车(专用)"); |
| | | break; |
| | | } |
| | | switch (data3.get(0).getStatus()){ |
| | | case 1: |
| | | settlementExportVO.setSiteStatus("正常使用"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setSiteStatus("维修中"); |
| | | break; |
| | | case 3: |
| | | settlementExportVO.setSiteStatus("关闭下线"); |
| | | break; |
| | | } |
| | | switch (data3.get(0).getBusinessCategory()){ |
| | | case 1: |
| | | settlementExportVO.setBusinessCategory("直营"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setBusinessCategory("非直营"); |
| | | break; |
| | | } |
| | | // todo 查询站点计费策略名称 |
| | | // settlementExportVO.setAccountingStrategy(); |
| | | |
| | | |
| | | } |
| | | TChargingGun data4 = chargingGunClient.getChargingGunById(settlementExportVO.getChargingGunId()) |
| | | .getData(); |
| | | if (data4!=null){ |
| | | settlementExportVO.setName(data4.getName()); |
| | | settlementExportVO.setDeviceCode(data4.getCode()); |
| | | } |
| | | |
| | | settlementExportVO.setElectronicType("转售"); |
| | | settlementExportVO.setPayTypeName("线上结算"); |
| | | LocalDateTime createTime = settlementExportVO.getCreateTime(); |
| | | LocalDateTime startTime = settlementExportVO.getStartTime(); |
| | | LocalDateTime endTime = settlementExportVO.getEndTime(); |
| | | settlementExportVO.setCreateTime1(createTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | settlementExportVO.setStartTime1(startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | settlementExportVO.setEndTime1(endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | switch (settlementExportVO.getStatus()){ |
| | | case 0: |
| | | settlementExportVO.setStatusName("未知"); |
| | | break; |
| | | case 1: |
| | | settlementExportVO.setStatusName("等待中/已插枪"); |
| | | break; |
| | | case 2: |
| | | settlementExportVO.setStatusName("启动中"); |
| | | break; |
| | | case 3: |
| | | settlementExportVO.setStatusName("充电中"); |
| | | break; |
| | | case 4: |
| | | settlementExportVO.setStatusName("停止中"); |
| | | break; |
| | | case 5: |
| | | settlementExportVO.setStatusName("已结束"); |
| | | break; |
| | | |
| | | } |
| | | settlementExportVO.setOrderTypeName("充电订单"); |
| | | settlementExportVO.setChargingType("单桩双充"); |
| | | settlementExportVO.setIsFree("否"); |
| | | settlementExportVO.setAverageElectronic(""); |
| | | settlementExportVO.setAverageServiceChargeReal(""); |
| | | settlementExportVO.setAverageServiceCharge(""); |
| | | // 获取充电时间 |
| | | UploadRealTimeMonitoringData data5 = uploadRealTimeMonitoringDataClient.chargingOrderInfo(chargingOrder.getCode()).getData(); |
| | | if (data5!=null){ |
| | | if (data5.getCumulative_charging_time()!=null){ |
| | | settlementExportVO.setChargingSecond(data5.getCumulative_charging_time()+""); |
| | | |
| | | } |
| | | } |
| | | // 获取开始SOC 结束soc |
| | | if (chargingOrder.getCode()!=null){ |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getDataByOrderCode(chargingOrder.getCode()).getData(); |
| | | if (data6!=null && !data6.isEmpty()){ |
| | | // 第一条数据soc为开始 最后一条数据soc为结束soc |
| | | settlementExportVO.setStartSoc(data6.get(0).getSoc()+"%"); |
| | | settlementExportVO.setEndSoc(data6.get(data6.size()-1).getSoc()+"%"); |
| | | } |
| | | } |
| | | settlementExportVO.setIsSoc("否"); |
| | | settlementExportVO.setSocType(""); |
| | | settlementExportVO.setSocValue(""); |
| | | settlementExportVO.setUserType("普通个人用户"); |
| | | |
| | | if (chargingOrder.getVipDiscountAmount()!=null && chargingOrder.getVipDiscountAmount().compareTo(BigDecimal.ZERO)>0){ |
| | | settlementExportVO.setIsPlus("是"); |
| | | |
| | | }else { |
| | | settlementExportVO.setIsPlus("否"); |
| | | |
| | | } |
| | | settlementExportVO.setUserCode(""); |
| | | |
| | | |
| | | settlementExportVO.setConfirmCode(data.getConfirmCode()); |
| | | settlementExportVO.setCompanyName("四川明星新能源有限科技公司"); |
| | | settlementExportVO.setMoneyType("线上计费"); |
| | | settlementExportVO.setDeviceType("设备直连(自由集控)"); |
| | | settlementExportVO.setBeforePayType("先付后退"); |
| | | settlementExportVO.setIsSafe("是"); |
| | | // 顶部合计数据 |
| | | data.setServiceChargeTotal(data.getServiceCharge().add(data.getVenue()) |
| | | .add(data.getVenue()).add(data.getMaintain()).add(data.getClean())+""); |
| | | |
| | | data.setServicePartnerString(data.getServicePartner()+"%"); |
| | | BigDecimal bigDecimal = new BigDecimal("100"); |
| | | data.setPlatformString(bigDecimal.subtract(data.getServicePartner())+"%"); |
| | | } |
| | | |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(data.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | | data.setSiteName(data1.get(0).getName()); |
| | |
| | | WriteSheet writeSheet = EasyExcel.writerSheet().build(); |
| | | WriteSheet writeSheet2 = EasyExcel.writerSheet().build(); |
| | | WriteSheet writeSheet3 = EasyExcel.writerSheet().build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.HORIZONTAL).build(); |
| | | FillConfig fillConfig = FillConfig.builder().direction(WriteDirectionEnum.VERTICAL).build(); |
| | | excelWriter.fill(new FillWrapper("data1", chargingBillVOS), fillConfig, writeSheet); |
| | | excelWriter.fill(new FillWrapper("data2", chargingBillVOS), fillConfig, writeSheet2); |
| | | excelWriter.fill(new FillWrapper("data3", data.getList()), fillConfig, writeSheet3); |
| | | excelWriter.fill(new FillWrapper("data4", data.getList()), fillConfig, writeSheet3); |
| | | excelWriter.finish(); |
| | | } catch (Exception e) { |
| | | return R.fail("excel导出失败!"); |
| | |
| | | List<TParkingRecord> list = parkingRecordService.lambdaQuery().eq(parkingRecordQueryDto.getParkingLotId() != null, TParkingRecord::getParkingLotId, parkingRecordQueryDto.getParkingLotId()).list(); |
| | | int count1 = list.size(); |
| | | //统计出list中chargingOrderId为null的数据个数 |
| | | int count2 = list.stream().filter(item -> item.getChargingOrderId() == null).collect(Collectors.toList()).size(); |
| | | int count3 = count1-count2; |
| | | int count2 = list.stream().filter(item -> item.getChargingOrderId() != null).collect(Collectors.toList()).size(); |
| | | int count3 = list.stream().filter(item -> item.getOutParkingType() == 2).collect(Collectors.toList()).size(); |
| | | //计算出list中parkingDuration的总和 |
| | | int count4 = 0; |
| | | for (TParkingRecord tParkingRecord : list) { |
| | |
| | | } |
| | | // 查询所有的停车场的站点id |
| | | List<TParkingLot> list = parkingLotService.list(); |
| | | List<Integer> siteIds = list.stream().map(TParkingLot::getSiteId).collect(Collectors.toList()); |
| | | List<Integer> siteIds = list.stream().map(TParkingLot::getSiteId).distinct().collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids) && !CollectionUtils.isEmpty(siteIds)){ |
| | | ids.addAll(siteIds); |
| | | Iterator<Integer> iterator = ids.iterator(); |
| | | while (iterator.hasNext()){ |
| | | Integer next = iterator.next(); |
| | | if(siteIds.contains(next)){ |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | } |
| | | return this.baseMapper.getSiteListParkLot(ids); |
| | | } |
| | |
| | | Site site = this.getById(id); |
| | | site.setAccountingStrategyId(accountingStrategyId); |
| | | this.updateById(site); |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getChargingPileId, id).eq(TChargingGun::getDelFlag, 0)); |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getSiteId, id).eq(TChargingGun::getDelFlag, 0)); |
| | | for (TChargingGun tChargingGun : list) { |
| | | tChargingGun.setAccountingStrategyId(accountingStrategyId); |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | |
| | | |
| | | @Override |
| | | public TParkingRecordPageInfoVO pageList(ParkingRecordQuery query) { |
| | | PageInfo<TParkingRecordVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | // 查询站点的停车场id |
| | | if(Objects.nonNull(query.getSiteId())){ |
| | | Site site = siteMapper.selectById(query.getSiteId()); |
| | |
| | | List<TParkingLot> tParkingLots = parkingLotMapper.selectList(Wrappers.lambdaQuery(TParkingLot.class) |
| | | .eq(TParkingLot::getSiteId, site.getId())); |
| | | List<Integer> lotIds = tParkingLots.stream().map(TParkingLot::getId).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(lotIds)){ |
| | | TParkingRecordPageInfoVO tParkingRecordPageInfoVO = new TParkingRecordPageInfoVO(); |
| | | tParkingRecordPageInfoVO.setParkingRecordVOS(new PageInfo<TParkingRecordVO>()); |
| | | return tParkingRecordPageInfoVO; |
| | | } |
| | | query.setLotIds(lotIds); |
| | | } |
| | | |
| | | } |
| | | PageInfo<TParkingRecordVO> pageInfo = new PageInfo<>(query.getPageCurr(),query.getPageSize()); |
| | | List<TParkingRecordVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | // 查询总数 |
| | |
| | | </appender> |
| | | |
| | | <!-- 系统模块日志级别控制 --> |
| | | <logger name="com.ruoyi" level="debug" /> |
| | | <logger name="com.ruoyi" level="info" /> |
| | | <!-- Spring日志级别控制 --> |
| | | <logger name="org.springframework" level="debug" /> |
| | | |
| | | <root level="debug"> |
| | | <root level="info"> |
| | | <appender-ref ref="console" /> |
| | | </root> |
| | | |
| | |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | <if test="null != query.cityCode and '' != query.cityCode"> |
| | | and ts.cityCode = #{query.cityCode} |
| | | and ts.city_code = #{query.cityCode} |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()} |
| | |
| | | and ts.`name` like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | <if test="null != query.cityCode and '' != query.cityCode"> |
| | | and ts.cityCode = #{query.cityCode} |
| | | and ts.city_code = #{query.cityCode} |
| | | </if> |
| | | AND ts.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | AND ts.status = ${@com.ruoyi.common.core.enums.status.SiteStatusEnum@NORMAL_USE.getCode()} |
| | |
| | | <select id="getStatusModeStatistics" resultType="com.ruoyi.chargingPile.api.vo.StatusModeStatisticsVO"> |
| | | SELECT |
| | | charge_mode, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 2 AND charge_mode = #{chargeMode}),0) AS freeCount, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 5 AND charge_mode = #{chargeMode}),0) AS filledCount, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 3 AND charge_mode = #{chargeMode}),0) AS insertCount, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 4 AND charge_mode = #{chargeMode}),0) AS chargingCount |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 2 AND charge_mode = #{chargeMode} and del_flag = 0),0) AS freeCount, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 5 AND charge_mode = #{chargeMode} and del_flag = 0),0) AS filledCount, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 3 AND charge_mode = #{chargeMode} and del_flag = 0),0) AS insertCount, |
| | | IFNULL((SELECT COUNT(*) FROM t_charging_gun WHERE status = 4 AND charge_mode = #{chargeMode} and del_flag = 0),0) AS chargingCount |
| | | FROM t_charging_gun |
| | | WHERE del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} AND charge_mode = #{chargeMode} |
| | | AND charging_pile_id in ( |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, app_user_id, license_plate, vehicle_color, charging_order_id, parking_lot_id, in_parking_time, out_parking_time, parking_duration, order_amount, status, out_parking_type, create_time |
| | | id, code,app_user_id, license_plate, vehicle_color, charging_order_id, parking_lot_id, in_parking_time, out_parking_time, parking_duration, order_amount, status, out_parking_type, create_time |
| | | </sql> |
| | | <select id="getSum" resultType="java.math.BigDecimal"> |
| | | select sum(timeout_amount) from t_parking_record where in_parking_time >= #{sixBefore} |
| | | </select> |
| | | <select id="pageList" resultType="com.ruoyi.chargingPile.api.vo.TParkingRecordVO"> |
| | | select |
| | | tpr.id, tpr.app_user_id, tpr.license_plate, tpr.vehicle_color, tpr.charging_order_id, tpr.parking_lot_id, tpr.in_parking_time, tpr.out_parking_time, |
| | | tpr.parking_duration, tpr.order_amount, tpr.status, tpr.out_parking_type, tpr.create_time,(tpr.order_amount - tpr.timeout_amount) as parkingFee, |
| | | (tpr.parking_duration - tpr.free_duration) as feeDuration,ts.name as siteName |
| | | tpr.id, tpr.code,tpr.app_user_id, tpr.license_plate, tpr.vehicle_color, tpr.charging_order_id, tpr.parking_lot_id, tpr.in_parking_time, tpr.out_parking_time, |
| | | tpr.parking_duration, tpr.order_amount, tpr.status, tpr.out_parking_type, tpr.create_time,(tpr.order_amount - tpr.timeout_amount) as parkingFee,tpr.timeout_amount, |
| | | tpr.free_duration,(tpr.parking_duration - tpr.free_duration) as feeDuration,ts.name as siteName |
| | | from t_parking_record tpr |
| | | left join t_parking_lot tpl on tpr.parking_lot_id = tpl.id |
| | | left join t_site ts on tpl.site_id = ts.id |
| | |
| | | AND code LIKE concat('%',#{query.code},'%') |
| | | </if> |
| | | <if test="query.licensePlate != null and query.licensePlate != ''"> |
| | | AND licensePlate LIKE concat('%',#{query.licensePlate},'%') |
| | | AND license_plate LIKE concat('%',#{query.licensePlate},'%') |
| | | </if> |
| | | <if test="query.lotIds != null and query.lotIds.size()>0"> |
| | | AND parking_lot_id IN |
| | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | |
| | | @PostMapping(value = "/getAll") |
| | | public R<List<UploadRealTimeMonitoringData>> getAll(@RequestBody MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException { |
| | | List<UploadRealTimeMonitoringData> list = uploadRealTimeMonitoringDataService.getDataAll(mongoChargingOrderQuery); |
| | | public R<UploadRealTimeMonitoringPageData> getAll(@RequestBody MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException { |
| | | UploadRealTimeMonitoringPageData list = uploadRealTimeMonitoringDataService.getDataAll(mongoChargingOrderQuery); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @PostMapping(value = "/delete") |
| | | public R delete(@RequestParam String id) throws ParseException { |
| | | uploadRealTimeMonitoringDataService.delete(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.integration.mongodb.base.BaseService; |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | List<UploadRealTimeMonitoringData> getDataByOrderCode(String code); |
| | | List<UploadRealTimeMonitoringData> getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException; |
| | | UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException; |
| | | |
| | | /** |
| | | * 查询订单最新一条数据 |
| | |
| | | */ |
| | | UploadRealTimeMonitoringData getLastDataById(String transaction_serial_number); |
| | | |
| | | void delete(String id); |
| | | } |
| | |
| | | import cn.hutool.db.sql.Direction; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.integration.iotda.constant.IotConstant; |
| | | import com.ruoyi.integration.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UploadRealTimeMonitoringData> getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException { |
| | | public UploadRealTimeMonitoringPageData getDataAll(MongoChargingOrderQuery mongoChargingOrderQuery) throws ParseException { |
| | | Query query = new Query(); |
| | | // if (!values.isEmpty()){ |
| | | // query.addCriteria(Criteria.where("transaction_serial_number").in(values)); |
| | |
| | | query.addCriteria(Criteria.where("transaction_serial_number").regex(mongoChargingOrderQuery.getCode(), "i")); // "i" 表示不区分大小写 |
| | | } |
| | | if (mongoChargingOrderQuery.getOrderType() !=null){ |
| | | query.addCriteria(Criteria.where("order_type").is(mongoChargingOrderQuery.getOrderType())); |
| | | query.addCriteria(Criteria.where("orderType").is(mongoChargingOrderQuery.getOrderType())); |
| | | } |
| | | if (mongoChargingOrderQuery.getSiteId() != null){ |
| | | query.addCriteria(Criteria.where("site_id").is(mongoChargingOrderQuery.getSiteId())); |
| | | query.addCriteria(Criteria.where("siteId").is(mongoChargingOrderQuery.getSiteId())); |
| | | } |
| | | if (mongoChargingOrderQuery.getChargingPileCode() != null && !mongoChargingOrderQuery.getChargingPileCode().isEmpty()) { |
| | | query.addCriteria(Criteria.where("charging_pile_code").is(mongoChargingOrderQuery.getChargingPileCode())); |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | long totalElements = mongoTemplate.count(query, UploadRealTimeMonitoringData.class); |
| | | // 设置分页 |
| | | Pageable pageable = PageRequest.of(mongoChargingOrderQuery.getPageCurr(), mongoChargingOrderQuery.getPageSize()); |
| | | query.with(pageable); |
| | | |
| | | query.with(Sort.by(Sort.Direction.DESC,"create_time")); |
| | | List<UploadRealTimeMonitoringData> uploadRealTimeMonitoringData = mongoTemplate.find( |
| | | query.with(Sort.by("create_time")) |
| | | query |
| | | , UploadRealTimeMonitoringData.class); |
| | | return uploadRealTimeMonitoringData; |
| | | |
| | | UploadRealTimeMonitoringPageData uploadRealTimeMonitoringPageData = new UploadRealTimeMonitoringPageData(); |
| | | uploadRealTimeMonitoringPageData.setCount(totalElements); |
| | | uploadRealTimeMonitoringPageData.setRecords(uploadRealTimeMonitoringData); |
| | | return uploadRealTimeMonitoringPageData; |
| | | } |
| | | |
| | | @Override |
| | |
| | | return mongoTemplate.findOne(query, UploadRealTimeMonitoringData.class); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(String id) { |
| | | UploadRealTimeMonitoringData byId = findById(id.toString()); |
| | | mongoTemplate.remove(byId); |
| | | } |
| | | |
| | | } |
| | |
| | | uploadRealTimeMonitoringData.setElectrovalence_all(accountingStrategyDetail.getElectrovalence()); |
| | | uploadRealTimeMonitoringData.setService_charge(accountingStrategyDetail.getServiceCharge()); |
| | | if (Objects.nonNull(data)) { |
| | | uploadRealTimeMonitoringData.setLast_time(data.getLast_time()); |
| | | data.setLast_time(new Date()); |
| | | uploadRealTimeMonitoringData.setPeriod_electric_price(uploadRealTimeMonitoringDataMessage.getPaid_amount().subtract(data.getPaid_amount())); |
| | | uploadRealTimeMonitoringData.setPeriod_charging_degree(uploadRealTimeMonitoringDataMessage.getCharging_degree().subtract(data.getCharging_degree())); |
| | | uploadRealTimeMonitoringData.setPeriod_service_price(uploadRealTimeMonitoringDataMessage.getCharging_degree().multiply(accountingStrategyDetail.getServiceCharge()).setScale(4, RoundingMode.HALF_UP)); |
| | |
| | | uploadRealTimeMonitoringData.setOrderType(chargingOrder.getOrderType()); |
| | | uploadRealTimeMonitoringData.setSiteId(chargingOrder.getSiteId()); |
| | | uploadRealTimeMonitoringData.setStatus(chargingOrder.getStatus()); |
| | | uploadRealTimeMonitoringData.setStartTime(chargingOrder.getStartTime()); |
| | | uploadRealTimeMonitoringData.setEndTime(chargingOrder.getEndTime()); |
| | | // uploadRealTimeMonitoringData.setStartTime(chargingOrder.getStartTime()); |
| | | // uploadRealTimeMonitoringData.setEndTime(chargingOrder.getEndTime()); |
| | | int i = uploadRealTimeMonitoringDataService.create(uploadRealTimeMonitoringData); |
| | | if(i == 0){ |
| | | log.error("数据存储mongo失败"); |
| | |
| | | TransactionRecordMessageVO vo = new TransactionRecordMessageVO(); |
| | | BeanUtils.copyProperties(transactionRecordMessage,vo); |
| | | chargingOrderClient.endChargeBillingCharge(vo); |
| | | // 添加实时上传记录结束记录 |
| | | // 查询mogondb上一条数据 |
| | | UploadRealTimeMonitoringData data = uploadRealTimeMonitoringDataService.getLastDataById(transactionRecordMessage.getTransaction_serial_number()); |
| | | UploadRealTimeMonitoringData uploadRealTimeMonitoringData = new UploadRealTimeMonitoringData(); |
| | | BeanUtils.copyProperties(data,uploadRealTimeMonitoringData); |
| | | uploadRealTimeMonitoringData.setStatus(5); |
| | | uploadRealTimeMonitoringDataService.create(uploadRealTimeMonitoringData); |
| | | break; |
| | | case SendTagConstant.UPDATE_BALANCE_REPLY: |
| | | UpdateBalanceReplyMessage updateBalanceReplyMessage = message.getUpdateBalanceReplyMessage(); |
| | |
| | | chargingBillExport.setCode(byId.getCode()); |
| | | chargingBillExport.setAccountType("微信商户"); |
| | | chargingBillExport.setType(byId.getType().toString()); |
| | | chargingBillExport.setBillType("月账单"); |
| | | LocalDateTime billTime = byId.getBillTime(); |
| | | // 将billTime 减去一个月 转化为yyyy-MM格式字符串 |
| | | billTime = billTime.minusMonths(1); |
| | | chargingBillExport.setBillWeek(DateUtils.parseDateToStr("yyyy-MM",DateUtils.toDate(billTime))); |
| | | |
| | | chargingBillExport.setBillTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(billTime))); |
| | | chargingBillExport.setState("未出账"); |
| | | List<Site> data = siteClient.getSiteByIds(Arrays.asList(byId.getSiteId())).getData(); |
| | | if (!data.isEmpty()){ |
| | | chargingBillExport.setSiteName(data.get(0).getName()); |
| | |
| | | int i =1; |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | // 账单信息 |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); |
| | | if (tChargingOrder.getRefundStatus()!=null && tChargingOrder.getRefundStatus()==2){ |
| | | refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); |
| | | } |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); |
| | | |
| | | // 退款信息 |
| | | ChargingBillRefundExport chargingBillRefundExport = new ChargingBillRefundExport(); |
| | | ChargingBillPayExport chargingBillPayExport = new ChargingBillPayExport(); |
| | |
| | | chargingBillPayExport.setPlatformPay("支付宝小程序支付"); |
| | | |
| | | } |
| | | List<TChargingOrderRefund> one1 = tChargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); |
| | | List<TChargingOrderRefund> one1 = tChargingOrderRefundService.lambdaQuery() |
| | | .eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()) |
| | | .eq(TChargingOrderRefund::getRefundStatus, 2) |
| | | .list(); |
| | | for (TChargingOrderRefund one : one1) { |
| | | refundAmount= refundAmount.add(one.getRefundAmount()); |
| | | chargingBillRefundExport.setRechargeSerialNumber(tChargingOrder.getRechargeSerialNumber()); |
| | | chargingBillRefundExport.setCode(tChargingOrder.getCode()); |
| | | chargingBillRefundExport.setPayTime(tChargingOrder.getCreateTime()!=null?DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getCreateTime())):""); |
| | | if (tChargingOrder.getRefundTime()!=null){ |
| | | chargingBillRefundExport.setRefundTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(tChargingOrder.getRefundTime()))); |
| | | if (one.getRefundTime()!=null){ |
| | | chargingBillRefundExport.setRefundTime(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",DateUtils.toDate(one.getRefundTime()))); |
| | | } |
| | | chargingBillRefundExport.setRefundMoney(one.getRefundAmount().toString()); |
| | | chargingBillRefundExport.setRefundRemark(one.getRefundReason()); |
| | |
| | | .between(TChargingOrder::getStartTime, byId.getStartTime(), byId.getEndTime()) |
| | | .eq(TChargingOrder::getStatus, 5) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).list(); |
| | | int i = 1; |
| | | for (TChargingOrder chargingOrder : list) { |
| | | |
| | | } |
| | | byId.setList(list); |
| | | String format = byId.getStartTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")); |
| | | String format1 = byId.getEndTime().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm:ss")); |
| | |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.DecimalFormat; |
| | | import java.time.*; |
| | | |
| | | |
| | |
| | | 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.integration.api.model.PageChargingOrderAndUploadRealTimeMonitoringDataDto; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.ChargingOrderAndUploadRealTimeMonitoringDataDto; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | | import com.ruoyi.common.core.dto.MongoChargingOrderQuery; |
| | |
| | | chargingOrderInfoVO.setSurplus(byId.getTotalElectricity()!=null?byId.getTotalElectricity().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); |
| | | chargingOrderInfoVO.setTotalPower(byId.getPower()!=null?byId.getPower().setScale(2, BigDecimal.ROUND_HALF_DOWN)+"":""); |
| | | if (byId.getAppUserCarId()!=null){ |
| | | List<TAppUserCar> data = appUserCarClient.getCarByIds(Arrays.asList(byId.getAppUserCarId())).getData(); |
| | | if (!data.isEmpty()){ |
| | | chargingOrderInfoVO.setLicensePlate(data.get(0).getLicensePlate()); |
| | | chargingOrderInfoVO.setVehicleBrand(data.get(0).getVehicleBrand()); |
| | | chargingOrderInfoVO.setVehicleModel(data.get(0).getVehicleModel()); |
| | | chargingOrderInfoVO.setVehicleUse(data.get(0).getVehicleUse()); |
| | | TAppUserCar data = appUserCarClient.getCarById(byId.getAppUserCarId()+"").getData(); |
| | | if (data!=null){ |
| | | chargingOrderInfoVO.setLicensePlate(data.getLicensePlate()); |
| | | chargingOrderInfoVO.setVehicleBrand(data.getVehicleBrand()); |
| | | chargingOrderInfoVO.setVehicleModel(data.getVehicleModel()); |
| | | chargingOrderInfoVO.setVehicleUse(data.getVehicleUse()); |
| | | } |
| | | } |
| | | // 时段总服务费 |
| | |
| | | @PostMapping(value = "/watch/chargingOrder") |
| | | @ApiOperation(value = "监控订单", tags = {"管理后台-订单管理"}) |
| | | public R watchChargingOrder(@RequestBody MongoChargingOrderQuery mongoChargingOrderQuery) { |
| | | // Integer page = dto.getPageCurr(); |
| | | // Integer pageSize = dto.getPageSize(); |
| | | // List<Long> data = appUserClient.getUserIdsByPhone(dto.getPhone()).getData(); |
| | | // dto.setUserIds(data); |
| | | // dto.setPageCurr(1); |
| | | // dto.setPageSize(99999); |
| | | |
| | | // Map<String,TChargingOrder> map = new HashMap<>(); |
| | | // //吧list放入map中 |
| | | // for (ChargingOrderVO record : res.getList().getRecords()) { |
| | | // map.put(record.getCode(),record); |
| | | // } |
| | | // Set<String> strings = map.keySet(); |
| | | |
| | | |
| | | List<UploadRealTimeMonitoringData> data1 = uploadRealTimeMonitoringDataClient.getAll(mongoChargingOrderQuery).getData(); |
| | | mongoChargingOrderQuery.setPageSize(10); |
| | | UploadRealTimeMonitoringPageData data1 = uploadRealTimeMonitoringDataClient.getAll(mongoChargingOrderQuery).getData(); |
| | | |
| | | List<ChargingOrderAndUploadRealTimeMonitoringDataDto> dtos = new ArrayList<>(); |
| | | Map<String,ChargingOrderVO> map = new HashMap<>(); |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data1) { |
| | | for (UploadRealTimeMonitoringData uploadRealTimeMonitoringData : data1.getRecords()) { |
| | | ChargingOrderAndUploadRealTimeMonitoringDataDto dataDto = new ChargingOrderAndUploadRealTimeMonitoringDataDto(); |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData,dataDto); |
| | | ChargingOrderQuery dto = new ChargingOrderQuery(); |
| | | dto.setCode(uploadRealTimeMonitoringData.getTransaction_serial_number()); |
| | | TCharingOrderVO vo = chargingOrderService.chargingOrder(dto); |
| | | if (!vo.getList().getRecords().isEmpty()) { |
| | | ChargingOrderVO chargingOrderVO = vo.getList().getRecords().get(0); |
| | | if (chargingOrderVO != null) { |
| | | BeanUtils.copyProperties(chargingOrderVO, dataDto); |
| | | |
| | | if (map.get(uploadRealTimeMonitoringData.getTransaction_serial_number())==null) { |
| | | TCharingOrderVO vo = chargingOrderService.chargingOrder(dto); |
| | | map.put(uploadRealTimeMonitoringData.getTransaction_serial_number(),vo.getList().getRecords().get(0)); |
| | | if (!vo.getList().getRecords().isEmpty()) { |
| | | ChargingOrderVO chargingOrderVO = vo.getList().getRecords().get(0); |
| | | if (chargingOrderVO != null) { |
| | | BeanUtils.copyProperties(chargingOrderVO, dataDto); |
| | | } |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData, dataDto); |
| | | dataDto.setStartTime(uploadRealTimeMonitoringData.getStartTime()); |
| | | dataDto.setEndTime(uploadRealTimeMonitoringData.getEndTime() == null ? null : uploadRealTimeMonitoringData.getEndTime()); |
| | | dataDto.setStatus(uploadRealTimeMonitoringData.getStatus()); |
| | | dtos.add(dataDto); |
| | | } |
| | | dtos.add(dataDto); |
| | | }else { |
| | | continue; |
| | | ChargingOrderVO vo = map.get(uploadRealTimeMonitoringData.getTransaction_serial_number()); |
| | | BeanUtils.copyProperties(vo, dataDto); |
| | | BeanUtils.copyProperties(uploadRealTimeMonitoringData, dataDto); |
| | | dataDto.setStartTime(uploadRealTimeMonitoringData.getStartTime()); |
| | | dataDto.setEndTime(uploadRealTimeMonitoringData.getEndTime() == null ? null : uploadRealTimeMonitoringData.getEndTime()); |
| | | dataDto.setStatus(uploadRealTimeMonitoringData.getStatus()); |
| | | dtos.add(dataDto); |
| | | } |
| | | } |
| | | for (int i = 0; i < dtos.size(); i++) { |
| | | dtos.get(i).setIndex(i); |
| | | } |
| | | |
| | | PageChargingOrderAndUploadRealTimeMonitoringDataDto page = new PageChargingOrderAndUploadRealTimeMonitoringDataDto(); |
| | | page.setTotal(data1.getCount()); |
| | | page.setRecords(dtos); |
| | | |
| | | return R.ok(dtos); |
| | | return R.ok(page); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping(value = "/watch/deletes") |
| | | @ApiOperation(value = "监控订单-删除", tags = {"管理后台-订单管理"}) |
| | | public R watchChargingOrder(@RequestParam String id) { |
| | | uploadRealTimeMonitoringDataClient.delete(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 处理充电订单实时监控数据相关的业务逻辑 |
| | |
| | | |
| | | if (statisticsQueryDto.getDayType()==1){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getDateData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | List<Map<String, Object>> charMap = new ArrayList<>(); |
| | | // 生成从 "00:00" 到 "23:00" 的时间数据 |
| | | for (int hour = 0; hour < 24; hour++) { |
| | | String time = String.format("%02d:00", hour); |
| | | Map<String, Object> mapWithTimeValue = findMapWithTimeValue(maps1, time); |
| | | if (mapWithTimeValue!=null){ |
| | | charMap.add(mapWithTimeValue); |
| | | }else { |
| | | Map<String, Object> timeMap = new HashMap<>(); |
| | | timeMap.put("time", time); // 初始化值为 null |
| | | timeMap.put("electrovalence", 0); |
| | | timeMap.put("orderCount", 0); |
| | | timeMap.put("paymentAmount", 0); |
| | | timeMap.put("paymoney", 0); |
| | | timeMap.put("servicecharge", 0); |
| | | |
| | | charMap.add(timeMap); |
| | | } |
| | | } |
| | | |
| | | tCharingOrderMapVO.setMaps1(charMap); |
| | | }else if (statisticsQueryDto.getDayType()==2){ |
| | | |
| | | |
| | | |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getWeekData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(maps1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("paymentAmount", 0); |
| | | dateMap.put("paymoney", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | tCharingOrderMapVO.setMaps1(dateRangeStatistics); |
| | | }else if (statisticsQueryDto.getDayType()==3){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getMonthData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(maps1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("paymentAmount", 0); |
| | | dateMap.put("paymoney", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | tCharingOrderMapVO.setMaps1(dateRangeStatistics); |
| | | }else if (statisticsQueryDto.getDayType()==4){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getYearData(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(maps1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("paymentAmount", 0); |
| | | dateMap.put("paymoney", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | tCharingOrderMapVO.setMaps1(dateRangeStatistics); |
| | | }else if (statisticsQueryDto.getDayType()==5){ |
| | | List<Map<String,Object>> maps1 = chargingOrderService.getByDate(chargingOrderIds); |
| | | tCharingOrderMapVO.setMaps1(maps1); |
| | | |
| | | LocalDate startDate = statisticsQueryDto.getStartTime(); |
| | | LocalDate endDate = statisticsQueryDto.getEndTime(); |
| | | |
| | | List<Map<String, Object>> dateRangeStatistics = new ArrayList<>(); |
| | | |
| | | // 遍历日期范围 |
| | | while (!startDate.isAfter(endDate)) { |
| | | String formattedDate = startDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> dailyStats = findMapWithDateValue(maps1, formattedDate); |
| | | |
| | | if (dailyStats != null) { |
| | | dateRangeStatistics.add(dailyStats); |
| | | } else { |
| | | Map<String, Object> dateMap = new HashMap<>(); |
| | | dateMap.put("time", formattedDate); |
| | | dateMap.put("electrovalence", 0); |
| | | dateMap.put("orderCount", 0); |
| | | dateMap.put("paymentAmount", 0); |
| | | dateMap.put("paymoney", 0); |
| | | dateMap.put("servicecharge", 0); |
| | | dateRangeStatistics.add(dateMap); |
| | | } |
| | | |
| | | // 移动到下一天 |
| | | startDate = startDate.plusDays(1); |
| | | } |
| | | tCharingOrderMapVO.setMaps1(dateRangeStatistics); |
| | | } |
| | | |
| | | |
| | | tCharingOrderMapVO.setMaps(maps); |
| | | BigDecimal allMoney = new BigDecimal(0); |
| | | for (Map<String, Object> map : maps) { |
| | | BigDecimal periodElectricPrice = (BigDecimal) map.get("period_electric_price"); |
| | | allMoney = allMoney.add(periodElectricPrice); |
| | | BigDecimal total_amount = (BigDecimal) map.get("total_amount"); |
| | | allMoney = allMoney.add(total_amount); |
| | | } |
| | | allMoney = allMoney.multiply(new BigDecimal("0.006")); |
| | | |
| | | |
| | | tCharingOrderMapVO.setAllMoney(allMoney); |
| | | return R.ok(tCharingOrderMapVO); |
| | | |
| | | } |
| | |
| | | return R.ok(tCharingUserEquimentVO); |
| | | } |
| | | |
| | | |
| | | private static double calculateAveragePercent(List<Map<String, Object>> mapList1, List<Map<String, Object>> mapList2) { |
| | | private static final DecimalFormat DF = new DecimalFormat("#.00"); |
| | | public static double calculateAveragePercent(List<Map<String, Object>> mapList1, List<Map<String, Object>> mapList2) { |
| | | int totalElements = mapList1.size() + mapList2.size(); |
| | | double sum = 0.0; |
| | | |
| | |
| | | } |
| | | |
| | | // 计算平均值 |
| | | return sum / totalElements; |
| | | double average = sum / totalElements; |
| | | |
| | | // 格式化为两位小数 |
| | | return Double.parseDouble(DF.format(average)); |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | //当日的订单总数 |
| | | int size = list.size(); |
| | | //计算list中paymentAmount的总和 |
| | | BigDecimal totalPaymentAmount = list.stream().map(TChargingOrder::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalPaymentAmount = list.stream().map(TChargingOrder::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //计算list中electrovalence的总和 |
| | | BigDecimal totalElectrovalence = list.stream().map(TChargingOrder::getElectrovalence).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | //计算list中serviceCharge的总和 |
| | |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.account.api.feignClient.AppUserAddressClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.chargingPile.api.feignClient.ChargingPileClient; |
| | |
| | | return R.ok(exchangeOrderService.lambdaQuery().eq(TExchangeOrder::getCouponId,goodId).eq(TExchangeOrder::getAppUserId,userId).ne(TExchangeOrder::getStatus,4).count()); |
| | | } |
| | | } |
| | | @Resource |
| | | private AppUserAddressClient appUserAddressClient; |
| | | |
| | | @PostMapping("/create") |
| | | public R<ExchangeBackDto> exchangeCreate(@RequestBody ExchangeDto exchangeDto){ |
| | |
| | | } |
| | | tExchangeOrder.setCreateTime(LocalDateTime.now()); |
| | | tExchangeOrder.setDelFlag(false); |
| | | |
| | | TAppUserAddress data = appUserAddressClient.getAppUserAddressById(exchangeDto.getAddressId()).getData(); |
| | | tExchangeOrder.setAddressJson(JSON.toJSONString(data)); |
| | | |
| | | exchangeOrderService.save(tExchangeOrder); |
| | | ExchangeBackDto exchangeBackDto = new ExchangeBackDto(); |
| | | exchangeBackDto.setId(tExchangeOrder.getId()); |
| | | exchangeBackDto.setCode(tExchangeOrder.getCode()); |
| | | |
| | | return R.ok(exchangeBackDto); |
| | | |
| | | } |
| | |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true), |
| | | @ApiImplicitParam(value = "订单类型(1=充电订单,2=购物订单,3=兑换订单,4=会员订单)", name = "orderType", required = true), |
| | | }) |
| | | public AjaxResult<OrderEvaluateVo> getOrderEvaluate(Integer orderId, Integer orderType){ |
| | | public AjaxResult<OrderEvaluateVo> getOrderEvaluate(String orderId, Integer orderType){ |
| | | OrderEvaluateVo orderEvaluate = orderEvaluateService.getOrderEvaluate(orderId, orderType); |
| | | return AjaxResult.success(orderEvaluate); |
| | | } |
| | |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.ruoyi.account.api.feignClient.AppCouponClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserAddressClient; |
| | | import com.ruoyi.account.api.feignClient.AppUserClient; |
| | | import com.ruoyi.account.api.model.TAppUserAddress; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | List<MyShoppingOrderList> list = shoppingOrderService.getNoInvoicedOrder(query); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private AppUserAddressClient appUserAddressClient; |
| | | @PostMapping("/create") |
| | | public R<TShoppingOrder> shopCreate(@RequestBody ExchangeDto exchangeDto) { |
| | | TShoppingOrder shoppingOrder = new TShoppingOrder(); |
| | |
| | | shoppingOrder.setPhone(exchangeDto.getPhone()); |
| | | shoppingOrder.setCreateTime(LocalDateTime.now()); |
| | | shoppingOrder.setDelFlag(false); |
| | | |
| | | |
| | | TAppUserAddress data = appUserAddressClient.getAppUserAddressById(exchangeDto.getAddressId()).getData(); |
| | | shoppingOrder.setAddressJson(JSON.toJSONString(data)); |
| | | shoppingOrderService.save(shoppingOrder); |
| | | |
| | | return R.ok(shoppingOrder); |
| | |
| | | private String accountType; |
| | | @Excel(name = "账单分类",width = 30,replace = {"全站账单_1","各个站点账单_2"}) |
| | | private String type; |
| | | @Excel(name = "账单类型",width = 30) |
| | | private String billType; |
| | | |
| | | @Excel(name = "账单周期",width = 30 ) |
| | | private String billWeek; |
| | | @Excel(name = "账单生成日期",width = 30) |
| | | private String billTime; |
| | | @Excel(name = "状态",width = 30) |
| | | private String state; |
| | | |
| | | @Excel(name = "站点名称",width = 30) |
| | | private String siteName; |
| | | @Excel(name = "支付金额",width = 30) |
| | |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | OrderEvaluateVo getOrderEvaluate(Integer orderId, Integer orderType); |
| | | OrderEvaluateVo getOrderEvaluate(String orderId, Integer orderType); |
| | | |
| | | List<Map<String, Object>> goodTop(List<Integer> siteIds); |
| | | |
| | |
| | | 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.api.model.TChargingOrderRefund; |
| | | import com.ruoyi.order.api.vo.ChargingBillListVO; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | import com.ruoyi.order.mapper.TChargingBillMapper; |
| | | import com.ruoyi.order.mapper.TChargingOrderMapper; |
| | | import com.ruoyi.order.service.TChargingBillService; |
| | | import com.ruoyi.order.service.TChargingOrderRefundService; |
| | | import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ; |
| | | import org.omg.CORBA.PRIVATE_MEMBER; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | private AppUserClient appUserClient; |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | @Resource |
| | | private TChargingOrderRefundService chargingOrderRefundService; |
| | | @Override |
| | | public ChargingBillVO chargingBillList1(ChargingListQuery dto) { |
| | | if (dto.getState()!=null){ |
| | |
| | | if (data5.getTime_remaining()!=null){ |
| | | chargingSecond+=data5.getTime_remaining()*60; |
| | | } |
| | | Integer cumulativeChargingTime = data5.getCumulative_charging_time(); |
| | | // 将其转化为xx小时xx分钟xx秒显示 如果是0小时则不展示小时 如果是0分钟则不展示分钟 |
| | | if (cumulativeChargingTime!=null){ |
| | | // 计算小时、分钟和秒 |
| | | int hours = cumulativeChargingTime / 60; |
| | | int minutes = cumulativeChargingTime % 60; |
| | | int seconds = 0; // 如果没有秒数,则默认是0 |
| | | StringBuilder result = new StringBuilder(); |
| | | if (hours > 0) { |
| | | result.append(hours).append("小时"); |
| | | } |
| | | if (minutes > 0) { |
| | | result.append(minutes).append("分钟"); |
| | | } |
| | | if (seconds > 0 || result.length() == 0) { // 如果秒数大于0,或者小时和分钟都为0,则显示秒数 |
| | | result.append(seconds).append("秒"); |
| | | } |
| | | tChargingOrder.setChargingTime(result.toString()); |
| | | } |
| | | tChargingOrder.setEndSoc(data5.getSoc().toString()); |
| | | } |
| | | Integer cumulativeChargingTime = data5.getCumulative_charging_time(); |
| | | // 将其转化为xx小时xx分钟xx秒显示 如果是0小时则不展示小时 如果是0分钟则不展示分钟 |
| | | if (cumulativeChargingTime!=null){ |
| | | // 计算小时、分钟和秒 |
| | | int hours = cumulativeChargingTime / 60; |
| | | int minutes = cumulativeChargingTime % 60; |
| | | int seconds = 0; // 如果没有秒数,则默认是0 |
| | | StringBuilder result = new StringBuilder(); |
| | | if (hours > 0) { |
| | | result.append(hours).append("小时"); |
| | | } |
| | | if (minutes > 0) { |
| | | result.append(minutes).append("分钟"); |
| | | } |
| | | if (seconds > 0 || result.length() == 0) { // 如果秒数大于0,或者小时和分钟都为0,则显示秒数 |
| | | result.append(seconds).append("秒"); |
| | | } |
| | | tChargingOrder.setChargingTime(result.toString()); |
| | | } |
| | | tChargingOrder.setEndSoc(data5.getSoc().toString()); |
| | | |
| | | TAppUser data3 = appUserClient.getUserById(tChargingOrder.getAppUserId()).getData(); |
| | | if (tChargingOrder.getAppUserCarId()!=null){ |
| | | List<TAppUserCar> data4 = appUserCarClient.getCarByIds(Arrays.asList(tChargingOrder.getAppUserCarId())).getData(); |
| | |
| | | } |
| | | } |
| | | if (data3!=null)tChargingOrder.setUserName(data3.getName()); |
| | | // 累加实收金额 支付金额减去退款金额 |
| | | if (tChargingOrder.getPaymentAmount()!=null){ |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getPaymentAmount()); |
| | | // 累加实收金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | paymentAmount = paymentAmount.add(tChargingOrder.getOrderAmount()); |
| | | } |
| | | // 累加订单金额 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | |
| | | if (tChargingOrder.getElectrovalence()!=null){ |
| | | electrovalence = electrovalence.add(tChargingOrder.getElectrovalence()); |
| | | } |
| | | if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getRefundStatus()!=null && tChargingOrder.getRefundStatus()== 2){ |
| | | refundAmount = refundAmount.add(tChargingOrder.getRefundAmount()); |
| | | List<TChargingOrderRefund> list2 = chargingOrderRefundService.lambdaQuery().eq(TChargingOrderRefund::getRefundStatus, 2) |
| | | .eq(TChargingOrderRefund::getChargingOrderId, tChargingOrder.getId()).list(); |
| | | for (TChargingOrderRefund tChargingOrderRefund : list2) { |
| | | refundAmount = refundAmount.add(tChargingOrderRefund.getRefundAmount()); |
| | | } |
| | | // 累加累计服务费 |
| | | if (tChargingOrder.getServiceCharge()!=null){ |
| | |
| | | } |
| | | // 累加平台手续费 |
| | | if (tChargingOrder.getOrderAmount()!=null){ |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006)) |
| | | .setScale(2,RoundingMode.HALF_DOWN)); |
| | | commissionAmount = commissionAmount.add(tChargingOrder.getOrderAmount().multiply(BigDecimal.valueOf(0.006))); |
| | | } |
| | | // 累加平台分佣 |
| | | if (tChargingOrder.getSharingAmount()!=null){ |
| | |
| | | BigDecimal commissionAmount = new BigDecimal("0"); |
| | | BigDecimal sharingAmount = new BigDecimal("0"); |
| | | BigDecimal chargingCapacity = new BigDecimal("0"); |
| | | orderCount+=tChargingOrders.size(); |
| | | chargingBillVO.setCategory(""); |
| | | chargingBillListVO.setOrderCount(tChargingOrders.size()); |
| | | chargingBillVO.setExportList(tChargingOrders); |
| | |
| | | eq.eq("site_id", chargingBillListVO.getSiteId()); |
| | | } |
| | | List<TChargingOrder> tChargingOrders = chargingOrderList.selectList(eq); |
| | | int chargingSecond = 0; |
| | | orderCount+=tChargingOrders.size(); |
| | | BigDecimal paymentAmount = new BigDecimal("0"); |
| | | BigDecimal orderAmount = new BigDecimal("0"); |
| | | BigDecimal electrovalence = new BigDecimal("0"); |
| | |
| | | BigDecimal commissionAmount = new BigDecimal("0"); |
| | | BigDecimal sharingAmount = new BigDecimal("0"); |
| | | BigDecimal chargingCapacity = new BigDecimal("0"); |
| | | orderCount+=tChargingOrders.size(); |
| | | chargingBillListVO.setOrderCount(tChargingOrders.size()); |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | // 累加实收金额 支付金额减去退款金额 |
| | | if (tChargingOrder.getRefundAmount()!=null && tChargingOrder.getPaymentAmount()!=null){ |
| | |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.other.api.domain.*; |
| | | import com.ruoyi.order.vo.ChargingOrderListInfoVO; |
| | | import com.ruoyi.other.api.domain.TVip; |
| | | import com.ruoyi.other.api.feignClient.*; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | |
| | | private TShoppingOrderService shoppingOrderService; |
| | | @Resource |
| | | private TShoppingOrderRefundService shoppingOrderRefundService; |
| | | @Resource |
| | | private TVipOrderService vipOrderService; |
| | | @Resource |
| | | private TVipOrderRefundService vipOrderRefundService; |
| | | @Override |
| | | public R payRefund(PayOrderRefundDto payOrderQueryDto) { |
| | | if (payOrderQueryDto.getType()==1){ |
| | |
| | | |
| | | } |
| | | |
| | | if (payOrderQueryDto.getType()==3){ |
| | | TVipOrder tChargingOrder = vipOrderService.getById(payOrderQueryDto.getOrderId()); |
| | | if (tChargingOrder.getPaymentAmount().compareTo(payOrderQueryDto.getRefundAmount())==-1){ |
| | | return R.fail("退款金额需小于支付金额"); |
| | | } |
| | | TVipOrderRefund chargingOrderRefund = new TVipOrderRefund(); |
| | | chargingOrderRefund.setVipOrderId(tChargingOrder.getId()); |
| | | chargingOrderRefund.setRefundAmount(payOrderQueryDto.getRefundAmount()); |
| | | chargingOrderRefund.setRefundStatus(1); |
| | | chargingOrderRefund.setPayType(tChargingOrder.getPaymentType()); |
| | | chargingOrderRefund.setRefundTime(LocalDateTime.now()); |
| | | chargingOrderRefund.setCode(tChargingOrder.getCode()); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); |
| | | chargingOrderRefund.setRefundCode("GDF" + sdf.format(new Date()) + (Double.valueOf(Math.random() * 1000).intValue())); |
| | | chargingOrderRefund.setRefundTitle("后台退款"); |
| | | chargingOrderRefund.setRefundContent("后台退款"); |
| | | chargingOrderRefund.setRefundReason("后台退款"); |
| | | chargingOrderRefund.setRefundRemark(payOrderQueryDto.getRemark()); |
| | | chargingOrderRefund.setRefundTotalAmount(tChargingOrder.getRefundAmount().add(payOrderQueryDto.getRefundAmount())); |
| | | chargingOrderRefund.setPayAmount(tChargingOrder.getPaymentAmount()); |
| | | |
| | | if(1 == tChargingOrder.getPaymentType()){ |
| | | WxPaymentRefundModel model = new WxPaymentRefundModel(); |
| | | model.setOut_trade_no(tChargingOrder.getCode()); |
| | | model.setOut_refund_no(chargingOrderRefund.getRefundCode()); |
| | | model.setTransaction_id(tChargingOrder.getSerialNumber()); |
| | | model.setReason("取消订单"); |
| | | model.setNotify_url("/order/t-shopping-order/cancelShoppingOrderWxRefund"); |
| | | WxPaymentRefundModel.RefundAmount amount = new WxPaymentRefundModel.RefundAmount(); |
| | | amount.setRefund(payOrderQueryDto.getRefundAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setTotal(tChargingOrder.getPaymentAmount().multiply(new BigDecimal(100)).intValue()); |
| | | amount.setCurrency("CNY"); |
| | | model.setAmount(amount); |
| | | R<String> orderR = wxPaymentClient.refundOrderR(model); |
| | | if(200 == orderR.getCode()){ |
| | | tChargingOrder.setRefundStatus(2); |
| | | tChargingOrder.setRefundAmount((tChargingOrder.getRefundAmount()==null? BigDecimal.valueOf(0) :tChargingOrder.getRefundAmount()).add(payOrderQueryDto.getRefundAmount())); |
| | | vipOrderService.updateById(tChargingOrder); |
| | | vipOrderRefundService.save(chargingOrderRefund); |
| | | } |
| | | } |
| | | |
| | | if(2 == tChargingOrder.getPaymentType()){ |
| | | RefundReq dto = new RefundReq(); |
| | | dto.setOutTradeNo(tChargingOrder.getCode()); |
| | | dto.setOutRequestNo(tChargingOrder.getCode()); |
| | | dto.setRefundAmount(payOrderQueryDto.getRefundAmount().toString()); |
| | | dto.setRefundReason("取消订单"); |
| | | RefundResp resp = aliPaymentClient.refund(dto).getData(); |
| | | if(null != resp){ |
| | | SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-DDTHH:mm:ss+TIMEZONE"); |
| | | |
| | | 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(); |
| | |
| | | // 根据站点id和开始时间和结束时间和归属日期 查询充电订单列表 |
| | | QueryWrapper<TChargingOrder> eq = new QueryWrapper<TChargingOrder>() |
| | | .eq("site_id", dto.getSiteId()) |
| | | .eq("status", 5) |
| | | .eq("recharge_payment_status",2); |
| | | switch (dto.getType()){ |
| | | case 1: |
| | |
| | | // 三方交易手续费 三方收费*0.6% |
| | | commissionAmount = sharingAmount.multiply(new BigDecimal("0.006")); |
| | | // 订单手续费 订单支付金额 - 退款金额*0.6% |
| | | orderCommission = paymentAmount.multiply(new BigDecimal("0.006")); |
| | | orderCommission = paymentAmount.multiply(new BigDecimal("0.006").setScale(2,RoundingMode.HALF_DOWN)); |
| | | tSettlementConfirm.setSharingAmount(sharingAmount.setScale(2, RoundingMode.HALF_DOWN)); |
| | | tSettlementConfirm.setCommissionAmount(commissionAmount.setScale(2, RoundingMode.HALF_DOWN)); |
| | | tSettlementConfirm.setElectrovalence(electrovalence); |
| | | // 服务费=总服务费-三费收费-交易手续费-交易手续费-服务费会员抵扣-服务费优惠券抵扣 |
| | | tSettlementConfirm.setServiceCharge(serviceCharge.subtract(commissionAmount).subtract(sharingAmount).subtract(orderCommission).subtract(vipDiscount).subtract(couponDiscount)); |
| | | tSettlementConfirm.setElectrovalence(electrovalence.setScale(2, RoundingMode.HALF_DOWN)); |
| | | tSettlementConfirm.setServiceCharge(serviceCharge.setScale(2, RoundingMode.HALF_DOWN)); |
| | | tSettlementConfirm.setOrderCommission(orderCommission); |
| | | tSettlementConfirm.setVipDiscount(vipDiscount); |
| | | tSettlementConfirm.setCouponDiscount(couponDiscount); |
| | | tSettlementConfirm.setSiteId(dto.getSiteId()); |
| | | tSettlementConfirm.setChargingElectronic(chargingElectronic); |
| | | tSettlementConfirm.setIncome(chargingElectronic.add(serviceCharge)); |
| | | tSettlementConfirm.setProfitMoney(new BigDecimal("0")); |
| | | tSettlementConfirm.setNewMoney(new BigDecimal("0")); |
| | | tSettlementConfirm.setNewSettlement(new BigDecimal("0")); |
| | | tSettlementConfirm.setVipDiscount(vipDiscount); |
| | | tSettlementConfirm.setCouponDiscount(couponDiscount); |
| | | tSettlementConfirm.setType(dto.getType()); |
| | |
| | | tSettlementConfirm.setRemark(dto.getRemark()); |
| | | tSettlementConfirm.setServicePartner(dto.getServicePartner()); |
| | | tSettlementConfirm.setServiceMoney(dto.getServiceMoney()); |
| | | BigDecimal subtract = new BigDecimal("1").subtract(dto.getProportionPartner()); |
| | | // 总电损费用 |
| | | BigDecimal divide = tSettlementConfirm.getProportionMoney().divide(subtract, 2, RoundingMode.HALF_DOWN); |
| | | // 平台承担电损 |
| | | BigDecimal subtract1 = divide.subtract(tSettlementConfirm.getProportionMoney()); |
| | | BigDecimal multiply = dto.getServiceMoney().multiply(subtract); |
| | | BigDecimal subtract2 = multiply.subtract(subtract1); |
| | | tSettlementConfirm.setNewMoney(subtract2); |
| | | |
| | | tSettlementConfirm.setTotalService(dto.getTotalService()); |
| | | tSettlementConfirm.setServiceRemark(dto.getServiceRemark()); |
| | | tSettlementConfirm.setDistribution(dto.getDistribution()); |
| | | tSettlementConfirm.setIncome(dto.getElectrovalence().add(dto.getServiceCharge())); |
| | | tSettlementConfirm.setCost(dto.getVenue().add(dto.getClean()).add(dto.getMaintain())); |
| | | tSettlementConfirm.setCost(dto.getVenue().add(dto.getClean()).add(dto.getMaintain()).add(dto.getMetering())); |
| | | tSettlementConfirm.setProfitMoney(chargingElectronic.add(serviceCharge).subtract(tSettlementConfirm.getCost())); |
| | | tSettlementConfirm.setNewSettlement(subtract2.subtract(tSettlementConfirm.getCost())); |
| | | |
| | | tSettlementConfirmMapper.insert(tSettlementConfirm); |
| | | } |
| | | return tSettlementConfirm; |
| | |
| | | |
| | | @Override |
| | | public PageInfo<TSettlementConfirm> settlementList(SettlementListQuery dto) { |
| | | if (StringUtils.hasLength(dto.getStartTime())){ |
| | | dto.setType(1); |
| | | String[] split = dto.getStartTime().split(" - "); |
| | | dto.setStartTime(split[0]); |
| | | dto.setEndTime(split[1]); |
| | | } |
| | | if (StringUtils.hasLength(dto.getEndTime())){ |
| | | dto.setType(2); |
| | | String[] split = dto.getStartTime().split(" - "); |
| | | dto.setStartTime(split[0]); |
| | | dto.setEndTime(split[1]); |
| | | } |
| | | PageInfo<TSettlementConfirm> pageInfo = new PageInfo<>(dto.getPageCurr(),dto.getPageSize()); |
| | | List<TSettlementConfirm> list = tSettlementConfirmMapper.settlementList(pageInfo,dto); |
| | | for (TSettlementConfirm tSettlementConfirm : list) { |
| | |
| | | // tSettlementConfirm1.setIncomePercentage(); |
| | | // tSettlementConfirm1.setTotalPercentage(); |
| | | tSettlementConfirm1.setElectronicRefund(0); |
| | | // 上月成本合计 |
| | | // 上月成本合计 |
| | | BigDecimal beforeCost= new BigDecimal("0"); |
| | | // 上月利润合计 |
| | | BigDecimal beforeIncome= new BigDecimal("0"); |
| | | for (TSettlementConfirm tSettlementConfirm : list1) { |
| | | tSettlementConfirm.setMetering(tSettlementConfirm.getSupplyElectronic()); |
| | | List<Site> data1 = siteClient.getSiteByIds(Arrays.asList(tSettlementConfirm.getSiteId())).getData(); |
| | | if (!data1.isEmpty()){ |
| | | tSettlementConfirm.setSiteName(data1.get(0).getName()); |
| | |
| | | StringBuilder stringBuilder = new StringBuilder(); |
| | | for (TChargingOrder tChargingOrder : tChargingOrders) { |
| | | stringBuilder.append(tChargingOrder.getCode()).append(","); |
| | | |
| | | } |
| | | // 充电总时长 |
| | | |
| | | Long temp = 0L; |
| | | if (StringUtils.hasLength(stringBuilder.toString())){ |
| | | List<UploadRealTimeMonitoringData> data6 = uploadRealTimeMonitoringDataClient.getOrderInfoByCodes(stringBuilder.substring(0,stringBuilder.length()-1)).getData(); |
| | | temp+=data6.stream().mapToLong(UploadRealTimeMonitoringData::getCumulative_charging_time).sum(); |
| | | temp+=(data6.stream().mapToLong(UploadRealTimeMonitoringData::getCumulative_charging_time).sum()*60); |
| | | } |
| | | List<TChargingPile> data = siteClient.getPileListBySiteId(tSettlementConfirm.getSiteId()).getData(); |
| | | // 计算充电桩的功率平均值 |
| | |
| | | |
| | | |
| | | tSettlementConfirm.setIncome(tSettlementConfirm.getElectrovalence().add(tSettlementConfirm.getServiceCharge())); |
| | | // todo 计算利用率 该电站充电桩本月利用率: |
| | | //利用率=充电量/(桩数量*功率*时间) |
| | | 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) { |
| | | settlementConfirm.setIncome(settlementConfirm.getElectrovalence().add(settlementConfirm.getServiceCharge())); |
| | | tSettlementConfirm.setMetering(tSettlementConfirm.getSupplyElectronic()); |
| | | if (tSettlementConfirm.getSiteId().equals(settlementConfirm.getSiteId())){ |
| | | // 电站相同比较收入涨幅跌幅 |
| | | if (tSettlementConfirm.getIncome().compareTo(BigDecimal.ZERO)>0){ |
| | |
| | | // 统计有图,好评,中差评数量 |
| | | long imgUrlCount = this.count(Wrappers.lambdaQuery(TOrderEvaluate.class) |
| | | .isNotNull(TOrderEvaluate::getImgUrl)); |
| | | packageTagCount(imgUrlCount,"有图",tagList); |
| | | packageTagCount(imgUrlCount,"有图",2,tagList); |
| | | long goodCount = this.count(Wrappers.lambdaQuery(TOrderEvaluate.class) |
| | | .ge(TOrderEvaluate::getMark,4)); |
| | | packageTagCount(goodCount,"好评",tagList); |
| | | packageTagCount(goodCount,"好评",3,tagList); |
| | | long badCount = this.count(Wrappers.lambdaQuery(TOrderEvaluate.class) |
| | | .le(TOrderEvaluate::getMark,3)); |
| | | packageTagCount(badCount,"中差评",tagList); |
| | | packageTagCount(badCount,"中差评",4,tagList); |
| | | return tagList; |
| | | } |
| | | |
| | |
| | | List<TEvaluationTag> data = evaluationTagClient.getListByIds(tagIds).getData(); |
| | | tOrderEvaluateVO.setOrderEvaluateTags(data); |
| | | } |
| | | TAppUser data = appUserClient.getUserById(tOrderEvaluateVO.getAppUserId()).getData(); |
| | | if(Objects.nonNull(data)){ |
| | | tOrderEvaluateVO.setName(data.getName()); |
| | | tOrderEvaluateVO.setAvatar(data.getAvatar()); |
| | | } |
| | | } |
| | | } |
| | | siteDetailEvaluateVO.setOrderEvaluateVOS(collect); |
| | |
| | | * @param name |
| | | * @param tagList |
| | | */ |
| | | private void packageTagCount(Long count,String name,List<TEvaluationTagVO> tagList){ |
| | | private void packageTagCount(Long count,String name,Integer type,List<TEvaluationTagVO> tagList){ |
| | | if(count>0){ |
| | | TEvaluationTagVO evaluationTagVO = new TEvaluationTagVO(); |
| | | evaluationTagVO.setName(name); |
| | | evaluationTagVO.setTagCount(Integer.parseInt(String.valueOf(count))); |
| | | evaluationTagVO.setType(type); |
| | | tagList.add(evaluationTagVO); |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public OrderEvaluateVo getOrderEvaluate(Integer orderId, Integer orderType) { |
| | | 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){ |
| | | OrderEvaluateVo orderEvaluateVo = new OrderEvaluateVo(); |
| | |
| | | } |
| | | e.setElectricityTariff(orderInvoiceDetailList.get(0).getElectricityTariff()); |
| | | e.setAddedServiceTariff(orderInvoiceDetailList.get(0).getAddedServiceTariff()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | e.setAddedService(orderInvoiceDetailList.stream().filter(t->t.getOrderInvoiceId().equals(e.getId()) &&t.getAddedService()!=null).map(TOrderInvoiceDetail::getAddedService).reduce(BigDecimal::add).get()); |
| | | e.setElectrovalence(orderInvoiceDetailList.stream().filter(t->t.getOrderInvoiceId().equals(e.getId()) &&t.getElectrovalence()!=null).map(TOrderInvoiceDetail::getElectrovalence).reduce(BigDecimal::add).get()); |
| | | e.setServiceCharge(orderInvoiceDetailList.stream().filter(t->t.getOrderInvoiceId().equals(e.getId()) && t.getServiceCharge()!=null).map(TOrderInvoiceDetail::getServiceCharge).reduce(BigDecimal::add).get()); |
| | | }); |
| | | } |
| | | |
| | |
| | | List<TActivityStatisticslVO> list = this.baseMapper.activityStatistics(pageInfo,dto); |
| | | List<TActivityStatisticslVO> list1 = this.baseMapper.activityStatistics(pageInfo1,dto); |
| | | |
| | | list.sort((o1, o2) -> o2.getCreateTime().compareTo(o1.getCreateTime())); |
| | | // 优惠券金额 |
| | | BigDecimal coupon = new BigDecimal("0"); |
| | | // 会员抵扣金额 |
| | |
| | | BigDecimal vipActivity = new BigDecimal("0"); |
| | | // 赠送会员 |
| | | BigDecimal grantVip = new BigDecimal("0"); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | for (TActivityStatisticslVO tActivityStatisticslVO : list1) { |
| | | TAppUser data = appUserClient.getUserById(tActivityStatisticslVO.getAppUserId()).getData(); |
| | | if (data!=null){ |
| | |
| | | break; |
| | | case 3: |
| | | // 会员订单 优惠金额大于0 |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null){ |
| | | vipActivity = vipActivity.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | } |
| | | tActivityStatisticslVO.setType("会员活动"); |
| | |
| | | } |
| | | } |
| | | for (TActivityStatisticslVO tActivityStatisticslVO : list) { |
| | | |
| | | // 判断享有了哪些类型 |
| | | switch (tActivityStatisticslVO.getOrderType()){ |
| | | case 1: |
| | |
| | | // 充电订单 优惠券金额大于0 |
| | | if (tActivityStatisticslVO.getCouponDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | coupon = coupon.add(tActivityStatisticslVO.getCouponDiscountAmount()); |
| | | stringBuilder.append("优惠券抵扣").append("+"); |
| | | } |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | stringBuilder.append("优惠券抵扣").append("+"); |
| | | } |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null &&(tActivityStatisticslVO.getVipDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | discount = discount.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | stringBuilder.append("会员抵扣").append("+"); |
| | | } |
| | | if (stringBuilder.length()>0){ |
| | |
| | | if (tActivityStatisticslVO.getCouponDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | coupon = coupon.add(tActivityStatisticslVO.getCouponDiscountAmount()); |
| | | stringBuilder1.append("优惠券抵扣").append("+"); |
| | | } |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getVipDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | discount = discount.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | stringBuilder1.append("会员抵扣").append("+"); |
| | | } |
| | | if (stringBuilder1.length()>0){ |
| | |
| | | break; |
| | | case 3: |
| | | // 会员订单 优惠金额大于0 |
| | | if (tActivityStatisticslVO.getVipDiscountAmount()!=null |
| | | && |
| | | (tActivityStatisticslVO.getCouponDiscountAmount().compareTo(BigDecimal.ZERO)>0)){ |
| | | vipActivity = vipActivity.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | } |
| | | tActivityStatisticslVO.setType("会员活动"); |
| | | tActivityStatisticslVO.setTime(tActivityStatisticslVO.getCreateTime()); |
| | | break; |
| | | case 4: |
| | | // 赠送会员订单 如果支付金额为0 那么就是后台赠送的会员 |
| | | if (tActivityStatisticslVO.getPaymentAmount().compareTo(BigDecimal.ZERO)==0){ |
| | | grantVip = grantVip.add(tActivityStatisticslVO.getOrderAmount()); |
| | | tActivityStatisticslVO.setType("赠送会员"); |
| | | tActivityStatisticslVO.setTime(tActivityStatisticslVO.getCreateTime()); |
| | | }else{ |
| | | // 赠送 |
| | | grantVip = grantVip.add(tActivityStatisticslVO.getVipDiscountAmount()); |
| | | tActivityStatisticslVO.setType("赠送会员"); |
| | | tActivityStatisticslVO.setTime(tActivityStatisticslVO.getCreateTime()); |
| | | } |
| | |
| | | tChargingBill3.setType(2); |
| | | tChargingBill3.setSiteId(collect.get(i)); |
| | | tChargingBill3.setBillTime(LocalDateTime.now()); |
| | | tChargingBill3.setBillType(1); |
| | | tChargingBill3.setBillType(2); |
| | | tChargingBill3.setStatus(1); |
| | | tChargingBill3.setOrderState(2); |
| | | tChargingBills1.add(tChargingBill3); |
| | |
| | | </if> |
| | | and t1.billType = 1 |
| | | and t1.del_flag = 0 |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="chargingBillList1" resultType="com.ruoyi.order.api.vo.ChargingBillListVO"> |
| | | select t1.* from t_charging_bill t1 |
| | |
| | | </select> |
| | | <select id="getDateData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT( create_time, '%Y-%m-%d %H' ) as time, |
| | | DATE_FORMAT( create_time, '%H:00' ) as time, |
| | | CAST(SUM(service_charge-coupon_discount_amount) AS DECIMAL(20, 6)) as servicecharge, |
| | | CAST(SUM(charging_capacity) AS DECIMAL(20, 6)) as electrovalence, |
| | | CAST(SUM(electrovalence) AS DECIMAL(20, 4)) AS paymentAmount, |
| | | SUM(payment_amount) AS paymoney, |
| | | count(1) as orderCount |
| | | FROM |
| | | t_charging_order |
| | |
| | | 315360 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and tc.type = 4 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.start_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | 864 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | 6048 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | 25920 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | 315360 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | WHERE |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 |
| | | co.start_time IS NOT NULL AND co.end_time IS NOT NULL and tc.type in (2,3) |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | 864 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | 6048 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | 25920 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | 315360 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 |
| | | ), 2) AS percent,cp.name |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =2 |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =2 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | |
| | | and DATE(co.create_time) >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | |
| | | |
| | | and DATE(co.create_time) <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | GROUP BY cp.name |
| | | |
| | | |
| | | </select> |
| | |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | 864 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | 6048 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | 25920 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | 315360 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 |
| | | ), 2) AS percent,cp.name |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =2 |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type in (2,3) and co.status =2 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | AND YEAR( co.create_time ) = YEAR(CURDATE() ) |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | <if test="statisticsQueryDto.startTime != null"> |
| | | |
| | | and DATE(co.create_time) >= #{statisticsQueryDto.startTime} |
| | | </if> |
| | | <if test="statisticsQueryDto.endTime != null"> |
| | | |
| | | and DATE(co.create_time) <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | GROUP BY cp.name |
| | | |
| | | |
| | | </select> |
| | |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | 864 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | 6048 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | 25920 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | 315360 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 |
| | | ), 2) AS percent,cp.name |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | |
| | | and DATE(co.create_time) <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | GROUP BY cp.name |
| | | </select> |
| | | <select id="equipmentMapOut2" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT(SUM(TIME_TO_SEC(TIMEDIFF(co.end_time, co.down_time)) / |
| | | <if test="statisticsQueryDto.dayType == 1"> |
| | | 86400 |
| | | 864 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 2"> |
| | | 604800 |
| | | 6048 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 3"> |
| | | 2592000 |
| | | 25920 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 4"> |
| | | 31536000 |
| | | 315360 |
| | | </if> |
| | | <if test="statisticsQueryDto.dayType == 5"> |
| | | (86400*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | (864*(SELECT TIMESTAMPDIFF(DAY, #{statisticsQueryDto.startTime}, #{statisticsQueryDto.endTime}) +1 AS days_difference |
| | | )) |
| | | </if> |
| | | |
| | | ), 2) AS percent,co.charging_gun_id,tc.name,cp.name as name1 |
| | | ), 2) AS percent,cp.name |
| | | FROM |
| | | `charging_pile_service`.`t_fault_message` co |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc on co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on tc.charging_pile_id = cp.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp on co.charging_pile_id = cp.id |
| | | WHERE |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 2 and co.status =1 |
| | | co.down_time IS NOT NULL AND co.end_time IS NOT NULL and cp.type = 1 and co.status =1 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | and DATE(co.create_time) <= #{statisticsQueryDto.endTime} |
| | | </if> |
| | | </if> |
| | | GROUP BY tc.name,cp.name,co.charging_gun_id |
| | | GROUP BY cp.name |
| | | |
| | | </select> |
| | | <select id="needElec" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT((SUM(co.current) / SUM(co.need_elec)), 2) AS percent, |
| | | FORMAT((SUM(co.current)*100 / SUM(co.need_elec)), 2) AS percent, |
| | | co.charging_gun_id, |
| | | tc.name as name, |
| | | cp.name AS siteName |
| | |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc ON co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp ON tc.charging_pile_id = cp.id |
| | | <where> |
| | | cp.type = 1 and co.need_elec != 0 |
| | | tc.type = 4 and co.need_elec != 0 |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | </select> |
| | | <select id="needElec1" resultType="java.util.Map"> |
| | | SELECT |
| | | FORMAT((SUM(co.current) / SUM(co.need_elec)), 2) AS percent, |
| | | FORMAT((SUM(co.current)*100 / SUM(co.need_elec)), 2) AS percent, |
| | | co.charging_gun_id, |
| | | tc.name as name, |
| | | cp.name AS siteName |
| | |
| | | LEFT JOIN `charging_pile_service`.`t_charging_gun` tc ON co.charging_gun_id = tc.id |
| | | LEFT JOIN `charging_pile_service`.`t_charging_pile` cp ON tc.charging_pile_id = cp.id |
| | | <where> |
| | | cp.type = 2 |
| | | tc.type in (2,3) |
| | | <if test="siteIds != null and siteIds.size() > 0"> |
| | | and co.site_id IN |
| | | <foreach collection="siteIds" item="siteId" open="(" separator="," close=")"> |
| | |
| | | select t1.* from |
| | | t_settlement_confirm t1 |
| | | where 1=1 |
| | | <if test="req.type != null "> |
| | | and t1.type = #{req.type} |
| | | </if> |
| | | <if test="req.partnerId != null "> |
| | | and t1.partnerId = #{req.partnerId} |
| | | and t1.partner_id = #{req.partnerId} |
| | | </if> |
| | | <if test="req.siteIds != null "> |
| | | and t1.site_id = #{req.siteIds} |
| | | </if> |
| | | <if test="req.type == 1 "> |
| | | <if test="req.startTime != null and req.startTime!=''"> |
| | | and (t1.start_time between #{req.startTime} and #{req.endTime} |
| | | </if> |
| | | </if> |
| | | <if test="req.siteIds != null and req.siteIds.size() > 0"> |
| | | AND t1.site_id IN |
| | | <foreach collection="req.siteIds" item="siteId" open="(" separator="," close=")"> |
| | | #{siteId} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.type == 2 "> |
| | | <if test="req.startTime != null and req.startTime!=''"> |
| | | and (t1.end_time between #{req.startTime} and #{req.endTime} |
| | | </if> |
| | | </if> |
| | | and t1.del_flag = 0 |
| | | and t1.del_flag = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | id, code, app_user_id, order_type, goods_id, coupon_id, purchase_quantity, app_user_address_id, order_amount, app_coupon_id, coupon_discount_amount, vip_discount, vip_discount_amount, payment_amount, payment_status, payment_type, serial_number, remark, status, express_company, express_number, consigner_id, consigner_time, receiving_time, cancellation_time, cancellation_id, refund_code, refund_amount, refund_status, refund_serial_number, refund_time, create_time, del_flag |
| | | </sql> |
| | | <select id="activityStatistics" resultType="com.ruoyi.order.api.vo.TActivityStatisticslVO"> |
| | | select * from ( |
| | | select t9.code ,t9.order_amount as orderAmount, |
| | | t9.coupon_discount_amount as couponDiscountAmount, |
| | | t9.vip_discount_amount as vipDiscountAmount, |
| | |
| | | t9.app_user_id as appUserId, |
| | | 1 as orderType |
| | | from t_charging_order t9 |
| | | where t9.id = 0 limit 1 |
| | | where t9.id = 0 |
| | | <if test="req.orderType == null or req.orderType == 1"> |
| | | <if test="req.type == null or req.type == 1 or req.type == 2"> |
| | | union all |
| | | select t1.code ,t1.order_amount as orderAmount, |
| | | t1.coupon_discount_amount as couponDiscountAmount, |
| | | t1.vip_discount_amount as vipDiscountAmount, |
| | | t1.payment_amount as paymentAmount, |
| | | t1.create_time as createTime, |
| | | select |
| | | t1.code , |
| | | t1.order_amount as orderAmount, |
| | | t1.coupon_discount_amount as couponDiscountAmount, |
| | | t1.vip_discount_amount as vipDiscountAmount, |
| | | t1.payment_amount as paymentAmount, |
| | | t1.create_time as createTime, |
| | | t1.app_user_id as appUserId, |
| | | 1 as orderType |
| | | 1 as orderType |
| | | from t_charging_order t1 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t1.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 1"> |
| | | <if test="req.type != null and req.type == 1"> |
| | | and t1.coupon_discount_amount > 0 |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 2"> |
| | | <if test="req.type != null and req.type == 2"> |
| | | and t1.vip_discount_amount > 0 |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and (t1.vip_discount_amount > 0 or t1.coupon_discount_amount > 0) |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t1.app_user_id in |
| | |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t1.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t1.recharge_payment_status =2 |
| | | and t1.refund_status !=2 |
| | | and (t1.vip_discount_amount > 0 or t1.coupon_discount_amount > 0) |
| | | and t1.recharge_payment_status =2 |
| | | and t1.refund_status !=2 |
| | | AND t1.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 2"> |
| | | <if test="req.type == null or req.type == 1 or req.type == 2"> |
| | | union all |
| | | select t2.code ,t2.order_amount as paymentAmount, |
| | | t2.coupon_discount_amount as couponDiscountAmount, |
| | | t2.vip_discount_amount as vipDiscountAmount, |
| | | t2.payment_amount as orderAmount, |
| | | t2.create_time as createTime, |
| | | t2.app_user_id as appUserId, |
| | | 2 as orderType |
| | | from t_shopping_order t2 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t2.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 1"> |
| | | and (t2.coupon_discount_amount > 0) |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 2"> |
| | | and ( t2.vip_discount_amount > 0) |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and (t2.vip_discount_amount > 0 or t2.coupon_discount_amount > 0) |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t2.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t2.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t2.payment_status =2 |
| | | AND t2.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 3"> |
| | | <if test="req.type == null or req.type == 3"> |
| | | union all |
| | | select t3.code ,t3.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | t3.discount_amount as vipDiscountAmount, |
| | | t3.payment_amount as paymentAmount, |
| | | t3.create_time as createTime, |
| | | t3.app_user_id as appUserId, |
| | | 3 as orderType |
| | | from t_vip_order t3 |
| | | where 1 = 1 |
| | | and t3.type =1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t3.code LIKE CONCAT('%',#{req.code},'%') |
| | | <if test="req.siteId == null"> |
| | | <if test="req.orderType == null or req.orderType == 2"> |
| | | <if test="req.type == null or req.type == 1 or req.type == 2"> |
| | | union all |
| | | select t2.code ,t2.order_amount as paymentAmount, |
| | | t2.coupon_discount_amount as couponDiscountAmount, |
| | | t2.vip_discount_amount as vipDiscountAmount, |
| | | t2.payment_amount as orderAmount, |
| | | t2.create_time as createTime, |
| | | t2.app_user_id as appUserId, |
| | | 2 as orderType |
| | | from t_shopping_order t2 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t2.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 1"> |
| | | and (t2.coupon_discount_amount > 0) |
| | | </if> |
| | | <if test="req.type != null and req.type != '' and req.type == 2"> |
| | | and ( t2.vip_discount_amount > 0) |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and (t2.vip_discount_amount > 0 or t2.coupon_discount_amount > 0) |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t2.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t2.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t2.payment_status =2 |
| | | AND t2.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and t3.discount_amount > 0 |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 3"> |
| | | <if test="req.type == null or req.type == 3"> |
| | | union all |
| | | select t3.code ,t3.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | t3.discount_amount as vipDiscountAmount, |
| | | t3.payment_amount as paymentAmount, |
| | | t3.create_time as createTime, |
| | | t3.app_user_id as appUserId, |
| | | 3 as orderType |
| | | from t_vip_order t3 |
| | | where 1 = 1 |
| | | and t3.type =1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t3.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and t3.discount_amount > 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t3.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t3.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t3.payment_status =2 |
| | | AND t3.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t3.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 4"> |
| | | <if test="req.type == null or req.type == 4"> |
| | | union all |
| | | select t5.code ,t5.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | 0 as vipDiscountAmount, |
| | | 0 as paymentAmount, |
| | | t5.create_time as createTime, |
| | | t5.app_user_id as appUserId, |
| | | 4 as orderType |
| | | from t_grant_vip t5 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t5.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t5.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t5.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | AND t5.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t3.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t3.payment_status =2 |
| | | AND t3.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 4"> |
| | | <if test="req.type == null or req.type == 4"> |
| | | union all |
| | | select t4.code ,t4.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | t4.discount_amount as vipDiscountAmount, |
| | | t4.payment_amount as paymentAmount, |
| | | t4.create_time as createTime, |
| | | t4.app_user_id as appUserId, |
| | | 4 as orderType |
| | | from t_vip_order t4 |
| | | where 1 = 1 |
| | | and t4.type =2 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t4.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="req.type == null "> |
| | | and t4.discount_amount > 0 |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t4.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t4.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | and t4.payment_status =2 |
| | | AND t4.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | </if> |
| | | </if> |
| | | <if test="req.orderType == null or req.orderType == 4"> |
| | | <if test="req.type == null or req.type == 4"> |
| | | union all |
| | | select t5.code ,t5.order_amount as orderAmount, |
| | | 0 as couponDiscountAmount, |
| | | 0 as vipDiscountAmount, |
| | | 0 as paymentAmount, |
| | | t5.create_time as createTime, |
| | | t5.app_user_id as appUserId, |
| | | 4 as orderType |
| | | from t_grant_vip t5 |
| | | where 1 = 1 |
| | | <if test="null != req.code and req.code!=''"> |
| | | and t5.code LIKE CONCAT('%',#{req.code},'%') |
| | | </if> |
| | | <if test="null != req.userIds and req.userIds.size()>0" > |
| | | and t5.app_user_id in |
| | | <foreach collection="req.userIds" item="item" index="index" separator="," open="(" close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="req.endTime != null and req.endTime != '' and req.startTime != null and req.startTime != ''"> |
| | | AND (t5.create_time between CONCAT(#{req.startTime},':00') and CONCAT(#{req.endTime},':59')) |
| | | </if> |
| | | AND t5.del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} |
| | | |
| | | </if> |
| | | </if> |
| | | ) |
| | | order by createTime DESC |
| | | </select> |
| | | |
| | | |
| | |
| | | //调起支付 |
| | | PaymentOrder paymentOrder = new PaymentOrder(); |
| | | paymentOrder.setCode(shopOrder.getCode()); |
| | | paymentOrder.setAmount(exchangeDto.getOrderPrice()); |
| | | paymentOrder.setAmount(exchangeDto.getPayPrice()); |
| | | paymentOrder.setOpenId(user.getWxOpenid()); |
| | | paymentOrder.setDescription("购买商品"); |
| | | R<Map<String, Object>> mapR = wxPaymentClient.orderPay(paymentOrder); |
| | | mapR.getData().put("orderId",shopOrder.getId().toString()); |
| | | return mapR; |
| | | }else { |
| | | //todo 罗 支付宝支付 |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.110.169:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | name: ${spring.application.name} |
| | |
| | | type: nacos |
| | | nacos: |
| | | # 开发环境 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | data-id: seata-server.properties |
| | |
| | | nacos: |
| | | application: seata-server |
| | | # 开发环境 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | |
| | | nacos: |
| | | discovery: |
| | | # 开发环境 |
| | | server-addr: 127.0.0.1:8848 # nacos注册中心地址 |
| | | server-addr: 192.168.110.169:8848 # nacos注册中心地址 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb # 命名空间 |
| | | group: DEFAULT_GROUP |
| | | application: seata-server #Nacos 中 Seata 名称 |