Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/mx_charging_pile
29个文件已修改
1个文件已删除
68个文件已添加
| | |
| | | @ApiModelProperty(value = "额定功率", required = true) |
| | | @TableField("rated_power") |
| | | private BigDecimal ratedPower; |
| | | |
| | | @ApiModelProperty(value = "实时充电功率", required = true) |
| | | @TableField("charging_power") |
| | | private BigDecimal chargingPower; |
| | | |
| | | @ApiModelProperty(value = "车位号") |
| | | @TableField("parking_number") |
| | |
| | | @ApiModelProperty(value = "设备状态(1=工作中,2=离线,3=故障)") |
| | | @TableField("status") |
| | | private Integer status; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.factory; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.cloud.openfeign.FallbackFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 充电订单服务降级处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class ChargingOrderAccountingStrategyFallbackFactory implements FallbackFactory<ChargingOrderAccountingStrategyClient> |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(ChargingOrderAccountingStrategyFallbackFactory.class); |
| | | |
| | | @Override |
| | | public ChargingOrderAccountingStrategyClient create(Throwable throwable) { |
| | | log.error("充电订单调用失败:{}", throwable.getMessage()); |
| | | return new ChargingOrderAccountingStrategyClient() { |
| | | |
| | | |
| | | @Override |
| | | public R<List<List<Map<String, Object>>>> getTotalElectricQuantity(Integer days) { |
| | | return R.fail("获取给定天数每天的充电量统计数据失败:" + throwable.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<List<Double>> getDailyChargingDegree(Integer days) { |
| | | return R.fail("获取给定天数每天的充电度数失败:" + throwable.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.order.api.feignClient; |
| | | |
| | | import com.ruoyi.common.core.constant.ServiceNameConstants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.api.factory.ChargingOrderAccountingStrategyFallbackFactory; |
| | | import com.ruoyi.order.api.factory.ChargingOrderFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/14 19:09 |
| | | */ |
| | | @FeignClient(contextId = "ChargingOrderAccountingStrategyClient", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = ChargingOrderAccountingStrategyFallbackFactory.class) |
| | | public interface ChargingOrderAccountingStrategyClient { |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数每天的充电量统计数据 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-charging-order-accounting-strategy/getTotalElectricQuantity") |
| | | R<List<List<Map<String, Object>>>> getTotalElectricQuantity(Integer days, @RequestParam("siteIds") Set<Integer> siteIds); |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数每天的充电度数 |
| | | * @param days |
| | | * @return |
| | | */ |
| | | @GetMapping("/t-charging-order-getDailyChargingDegree-strategy/getUtilizationTrend") |
| | | R<List<Double>> getDailyChargingDegree(Integer days, @RequestParam("siteIds") Set<Integer> siteIds); |
| | | } |
| | |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.query.TChargingCountQuery; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | */ |
| | | @PostMapping(value = "/t-charging-order/getChargingCount") |
| | | public R<Integer> getChargingCount(@RequestBody TChargingCountQuery req); |
| | | |
| | | |
| | | /** |
| | | * 根据充电枪获取正在充电的订单 |
| | | * @param chargingGunId 充电枪id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/t-charging-order/getOrderDetailByGunId") |
| | | R<TChargingOrder> getOrderDetailByGunId(@RequestParam("chargingGunId") Integer chargingGunId); |
| | | } |
| | |
| | | @ApiModelProperty(value = "充电枪id") |
| | | @TableField("charging_gun_id") |
| | | private Integer chargingGunId; |
| | | |
| | | @ApiModelProperty(value = "充电总度数") |
| | | @TableField("charging_capacity") |
| | | private BigDecimal chargingCapacity; |
| | | |
| | | @ApiModelProperty(value = "充电功率") |
| | | @TableField("charging_power") |
| | | private BigDecimal chargingPower; |
| | | |
| | | @ApiModelProperty(value = "充电开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | |
| | | com.ruoyi.order.api.factory.ChargingOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.OrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ExchangeOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ExchangeOrderFallbackFactory |
| | | com.ruoyi.order.api.factory.ChargingOrderAccountingStrategyFallbackFactory |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.system.domain.SysConfig; |
| | |
| | | |
| | | /** |
| | | * 参数配置 信息操作处理 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/config") |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * 获取参数配置列表 |
| | | */ |
| | | @RequiresPermissions("system:config:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysConfig config) |
| | | { |
| | | startPage(); |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:config:export") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysConfig config) |
| | | { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | util.exportExcel(response, list, "参数数据"); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long configId) |
| | | { |
| | | return success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数键名查询参数值 |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) |
| | | { |
| | | return success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:add") |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setCreateBy(SecurityUtils.getUsername()); |
| | | return toAjax(configService.insertConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:edit") |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult remove(@PathVariable Long[] configIds) |
| | | { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新参数缓存 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | configService.resetConfigCache(); |
| | | return success(); |
| | | } |
| | | public class SysConfigController extends BaseController { |
| | | @Resource |
| | | private ISysConfigService configService; |
| | | |
| | | /** |
| | | * 获取参数配置列表 |
| | | */ |
| | | @RequiresPermissions("system:config:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysConfig config) { |
| | | startPage(); |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "参数管理", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:config:export") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysConfig config) { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | util.exportExcel(response, list, "参数数据"); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数编号获取详细信息 |
| | | */ |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long configId) { |
| | | return success(configService.selectConfigById(configId)); |
| | | } |
| | | |
| | | /** |
| | | * 根据参数键名查询参数值 |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) { |
| | | return success(configService.selectConfigByKey(configKey)); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:add") |
| | | @Log(title = "参数管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) { |
| | | if (!configService.checkConfigKeyUnique(config)) { |
| | | return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setCreateBy(SecurityUtils.getUsername()); |
| | | return toAjax(configService.insertConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:edit") |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) { |
| | | if (!configService.checkConfigKeyUnique(config)) { |
| | | return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在"); |
| | | } |
| | | config.setUpdateBy(SecurityUtils.getUsername()); |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult remove(@PathVariable Long[] configIds) { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | | |
| | | /** |
| | | * 刷新参数缓存 |
| | | */ |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "参数管理", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() { |
| | | configService.resetConfigCache(); |
| | | return success(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.service.ISysLoginLogService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @Resource |
| | | private ISysLoginLogService sysLoginLogService; |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | |
| | |
| | | |
| | | /** |
| | | * 参数配置表 sys_config |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class SysConfig extends BaseModel |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 参数主键 */ |
| | | @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) |
| | | private Long configId; |
| | | |
| | | /** 参数名称 */ |
| | | @Excel(name = "参数名称") |
| | | private String configName; |
| | | |
| | | /** 参数键名 */ |
| | | @Excel(name = "参数键名") |
| | | private String configKey; |
| | | |
| | | /** 参数键值 */ |
| | | @Excel(name = "参数键值") |
| | | private String configValue; |
| | | |
| | | /** 系统内置(Y是 N否) */ |
| | | @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") |
| | | private String configType; |
| | | |
| | | public Long getConfigId() |
| | | { |
| | | return configId; |
| | | } |
| | | |
| | | public void setConfigId(Long configId) |
| | | { |
| | | this.configId = configId; |
| | | } |
| | | |
| | | @NotBlank(message = "参数名称不能为空") |
| | | @Size(min = 0, max = 100, message = "参数名称不能超过100个字符") |
| | | public String getConfigName() |
| | | { |
| | | return configName; |
| | | } |
| | | |
| | | public void setConfigName(String configName) |
| | | { |
| | | this.configName = configName; |
| | | } |
| | | |
| | | @NotBlank(message = "参数键名长度不能为空") |
| | | @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") |
| | | public String getConfigKey() |
| | | { |
| | | return configKey; |
| | | } |
| | | |
| | | public void setConfigKey(String configKey) |
| | | { |
| | | this.configKey = configKey; |
| | | } |
| | | |
| | | @NotBlank(message = "参数键值不能为空") |
| | | @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") |
| | | public String getConfigValue() |
| | | { |
| | | return configValue; |
| | | } |
| | | |
| | | public void setConfigValue(String configValue) |
| | | { |
| | | this.configValue = configValue; |
| | | } |
| | | |
| | | public String getConfigType() |
| | | { |
| | | return configType; |
| | | } |
| | | |
| | | public void setConfigType(String configType) |
| | | { |
| | | this.configType = configType; |
| | | } |
| | | |
| | | |
| | | @ApiModelProperty(value = "备注说明") |
| | | @Excel(name = "备注说明") |
| | | private String remark; |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("configId", getConfigId()) |
| | | .append("configName", getConfigName()) |
| | | .append("configKey", getConfigKey()) |
| | | .append("configValue", getConfigValue()) |
| | | .append("configType", getConfigType()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | public class SysConfig extends BaseModel { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 参数主键 |
| | | */ |
| | | @Excel(name = "参数主键", cellType = ColumnType.NUMERIC) |
| | | private Long configId; |
| | | |
| | | /** |
| | | * 参数名称 |
| | | */ |
| | | @Excel(name = "参数名称") |
| | | private String configName; |
| | | |
| | | /** |
| | | * 参数键名 |
| | | */ |
| | | @Excel(name = "参数键名") |
| | | private String configKey; |
| | | |
| | | /** |
| | | * 参数键值 |
| | | */ |
| | | @Excel(name = "参数键值") |
| | | private String configValue; |
| | | |
| | | /** |
| | | * 系统内置(Y是 N否) |
| | | */ |
| | | @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") |
| | | private String configType; |
| | | |
| | | public Long getConfigId() { |
| | | return configId; |
| | | } |
| | | |
| | | public void setConfigId(Long configId) { |
| | | this.configId = configId; |
| | | } |
| | | |
| | | @NotBlank(message = "参数名称不能为空") |
| | | @Size(min = 0, max = 100, message = "参数名称不能超过100个字符") |
| | | public String getConfigName() { |
| | | return configName; |
| | | } |
| | | |
| | | public void setConfigName(String configName) { |
| | | this.configName = configName; |
| | | } |
| | | |
| | | @NotBlank(message = "参数键名长度不能为空") |
| | | @Size(min = 0, max = 100, message = "参数键名长度不能超过100个字符") |
| | | public String getConfigKey() { |
| | | return configKey; |
| | | } |
| | | |
| | | public void setConfigKey(String configKey) { |
| | | this.configKey = configKey; |
| | | } |
| | | |
| | | @NotBlank(message = "参数键值不能为空") |
| | | @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") |
| | | public String getConfigValue() { |
| | | return configValue; |
| | | } |
| | | |
| | | public void setConfigValue(String configValue) { |
| | | this.configValue = configValue; |
| | | } |
| | | |
| | | public String getConfigType() { |
| | | return configType; |
| | | } |
| | | |
| | | public void setConfigType(String configType) { |
| | | this.configType = configType; |
| | | } |
| | | |
| | | |
| | | @ApiModelProperty(value = "备注说明") |
| | | @Excel(name = "备注说明") |
| | | private String remark; |
| | | |
| | | public String getRemark() { |
| | | return remark; |
| | | } |
| | | |
| | | public void setRemark(String remark) { |
| | | this.remark = remark; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("configId", getConfigId()) |
| | | .append("configName", getConfigName()) |
| | | .append("configKey", getConfigKey()) |
| | | .append("configValue", getConfigValue()) |
| | | .append("configType", getConfigType()) |
| | | .append("createBy", getCreateBy()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("updateBy", getUpdateBy()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("remark", getRemark()) |
| | | .toString(); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * 参数配置 数据层 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Mapper |
| | | public interface SysConfigMapper |
| | | { |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig selectConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 通过ID查询配置 |
| | | * |
| | | * @param configId 参数ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig selectConfigById(Long configId); |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | public List<SysConfig> selectConfigList(SysConfig config); |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数键名 |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig checkConfigKeyUnique(String configKey); |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | * |
| | | * @param configId 参数ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteConfigById(Long configId); |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteConfigByIds(Long[] configIds); |
| | | public interface SysConfigMapper extends BaseMapper<SysConfig> { |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig selectConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 通过ID查询配置 |
| | | * |
| | | * @param configId 参数ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig selectConfigById(Long configId); |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | public List<SysConfig> selectConfigList(SysConfig config); |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数键名 |
| | | * @return 参数配置信息 |
| | | */ |
| | | public SysConfig checkConfigKeyUnique(String configKey); |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int insertConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | public int updateConfig(SysConfig config); |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | * |
| | | * @param configId 参数ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteConfigById(Long configId); |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | * @return 结果 |
| | | */ |
| | | public int deleteConfigByIds(Long[] configIds); |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.mapper.SysConfigMapper; |
| | |
| | | |
| | | /** |
| | | * 参数配置 服务层实现 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysConfigServiceImpl implements ISysConfigService |
| | | { |
| | | @Autowired |
| | | private SysConfigMapper configMapper; |
| | | |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | /** |
| | | * 项目启动时,初始化参数到缓存 |
| | | */ |
| | | @PostConstruct |
| | | public void init() |
| | | { |
| | | // TODO |
| | | public class SysConfigServiceImpl implements ISysConfigService { |
| | | @Resource |
| | | private SysConfigMapper configMapper; |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | /** |
| | | * 项目启动时,初始化参数到缓存 |
| | | */ |
| | | @PostConstruct |
| | | public void init() { |
| | | // TODO |
| | | // loadingConfigCache(); |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param configId 参数配置ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | @Override |
| | | public SysConfig selectConfigById(Long configId) |
| | | { |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigId(configId); |
| | | return configMapper.selectConfig(config); |
| | | } |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数key |
| | | * @return 参数键值 |
| | | */ |
| | | @Override |
| | | public String selectConfigByKey(String configKey) |
| | | { |
| | | String configValue = Convert.toStr(redisService.getCacheObject(getCacheKey(configKey))); |
| | | if (StringUtils.isNotEmpty(configValue)) |
| | | { |
| | | return configValue; |
| | | } |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigKey(configKey); |
| | | SysConfig retConfig = configMapper.selectConfig(config); |
| | | if (StringUtils.isNotNull(retConfig)) |
| | | { |
| | | redisService.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); |
| | | return retConfig.getConfigValue(); |
| | | } |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | @Override |
| | | public List<SysConfig> selectConfigList(SysConfig config) |
| | | { |
| | | return configMapper.selectConfigList(config); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertConfig(SysConfig config) |
| | | { |
| | | int row = configMapper.insertConfig(config); |
| | | if (row > 0) |
| | | { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateConfig(SysConfig config) |
| | | { |
| | | SysConfig temp = configMapper.selectConfigById(config.getConfigId()); |
| | | if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) |
| | | { |
| | | redisService.deleteObject(getCacheKey(temp.getConfigKey())); |
| | | } |
| | | |
| | | int row = configMapper.updateConfig(config); |
| | | if (row > 0) |
| | | { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | */ |
| | | @Override |
| | | public void deleteConfigByIds(Long[] configIds) |
| | | { |
| | | for (Long configId : configIds) |
| | | { |
| | | SysConfig config = selectConfigById(configId); |
| | | if (StringUtils.equals(UserConstants.YES, config.getConfigType())) |
| | | { |
| | | throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); |
| | | } |
| | | configMapper.deleteConfigById(configId); |
| | | redisService.deleteObject(getCacheKey(config.getConfigKey())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 加载参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void loadingConfigCache(){ |
| | | List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig()); |
| | | for (SysConfig config : configsList) |
| | | { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 清空参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void clearConfigCache() |
| | | { |
| | | Collection<String> keys = redisService.keys(CacheConstants.SYS_CONFIG_KEY + "*"); |
| | | redisService.deleteObject(keys); |
| | | } |
| | | |
| | | /** |
| | | * 重置参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void resetConfigCache() |
| | | { |
| | | clearConfigCache(); |
| | | loadingConfigCache(); |
| | | } |
| | | |
| | | /** |
| | | * 校验参数键名是否唯一 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkConfigKeyUnique(SysConfig config) |
| | | { |
| | | Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); |
| | | SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); |
| | | if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) |
| | | { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey 参数键 |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey(String configKey) |
| | | { |
| | | return CacheConstants.SYS_CONFIG_KEY + configKey; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置信息 |
| | | * |
| | | * @param configId 参数配置ID |
| | | * @return 参数配置信息 |
| | | */ |
| | | @Override |
| | | public SysConfig selectConfigById(Long configId) { |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigId(configId); |
| | | return configMapper.selectConfig(config); |
| | | } |
| | | |
| | | /** |
| | | * 根据键名查询参数配置信息 |
| | | * |
| | | * @param configKey 参数key |
| | | * @return 参数键值 |
| | | */ |
| | | @Override |
| | | public String selectConfigByKey(String configKey) { |
| | | String configValue = Convert.toStr(redisService.getCacheObject(getCacheKey(configKey))); |
| | | if (StringUtils.isNotEmpty(configValue)) { |
| | | return configValue; |
| | | } |
| | | SysConfig config = new SysConfig(); |
| | | config.setConfigKey(configKey); |
| | | SysConfig retConfig = configMapper.selectConfig(config); |
| | | if (StringUtils.isNotNull(retConfig)) { |
| | | redisService.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); |
| | | return retConfig.getConfigValue(); |
| | | } |
| | | return StringUtils.EMPTY; |
| | | } |
| | | |
| | | /** |
| | | * 查询参数配置列表 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 参数配置集合 |
| | | */ |
| | | @Override |
| | | public List<SysConfig> selectConfigList(SysConfig config) { |
| | | return configMapper.selectConfigList(config); |
| | | } |
| | | |
| | | /** |
| | | * 新增参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertConfig(SysConfig config) { |
| | | int row = configMapper.insertConfig(config); |
| | | if (row > 0) { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 修改参数配置 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateConfig(SysConfig config) { |
| | | SysConfig temp = configMapper.selectConfigById(config.getConfigId()); |
| | | if (!StringUtils.equals(temp.getConfigKey(), config.getConfigKey())) { |
| | | redisService.deleteObject(getCacheKey(temp.getConfigKey())); |
| | | } |
| | | |
| | | int row = configMapper.updateConfig(config); |
| | | if (row > 0) { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | return row; |
| | | } |
| | | |
| | | /** |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | */ |
| | | @Override |
| | | public void deleteConfigByIds(Long[] configIds) { |
| | | for (Long configId : configIds) { |
| | | SysConfig config = selectConfigById(configId); |
| | | if (StringUtils.equals(UserConstants.YES, config.getConfigType())) { |
| | | throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); |
| | | } |
| | | configMapper.deleteConfigById(configId); |
| | | redisService.deleteObject(getCacheKey(config.getConfigKey())); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 加载参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void loadingConfigCache() { |
| | | List<SysConfig> configsList = configMapper.selectConfigList(new SysConfig()); |
| | | for (SysConfig config : configsList) { |
| | | redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 清空参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void clearConfigCache() { |
| | | Collection<String> keys = redisService.keys(CacheConstants.SYS_CONFIG_KEY + "*"); |
| | | redisService.deleteObject(keys); |
| | | } |
| | | |
| | | /** |
| | | * 重置参数缓存数据 |
| | | */ |
| | | @Override |
| | | public void resetConfigCache() { |
| | | clearConfigCache(); |
| | | loadingConfigCache(); |
| | | } |
| | | |
| | | /** |
| | | * 校验参数键名是否唯一 |
| | | * |
| | | * @param config 参数配置信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public boolean checkConfigKeyUnique(SysConfig config) { |
| | | Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId(); |
| | | SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey()); |
| | | if (StringUtils.isNotNull(info) && info.getConfigId().longValue() != configId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | | } |
| | | |
| | | /** |
| | | * 设置cache key |
| | | * |
| | | * @param configKey 参数键 |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey(String configKey) { |
| | | return CacheConstants.SYS_CONFIG_KEY + configKey; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.system.api.domain.SysLoginLog; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.domain.SysLoginLog; |
| | | import com.ruoyi.system.mapper.SysLoginLogMapper; |
| | | import com.ruoyi.system.service.ISysLoginLogService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | nacos: |
| | | discovery: |
| | | # 服务注册地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | server-addr: 192.168.110.169:8848 |
| | | service: ${spring.application.name} |
| | | group: DEFAULT_GROUP |
| | | namespace: 87dfc9b5-3336-4273-906c-a31cc3925c47 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | username: nacos |
| | | password: nacos |
| | | config: |
| | | # 配置中心地址 |
| | | server-addr: 127.0.0.1:8848 |
| | | namespace: 87dfc9b5-3336-4273-906c-a31cc3925c47 |
| | | server-addr: 192.168.110.169:8848 |
| | | namespace: b5290bc2-e3aa-4988-8a7d-9c07e4e073cb |
| | | group: DEFAULT_GROUP |
| | | username: nacos |
| | | password: nacos |
| | | name: ${spring.application.name} |
| | | # 配置文件格式 |
| | | file-extension: yml |
| | |
| | | <mapper namespace="com.ruoyi.system.mapper.SysLoginLogMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.SysLoginLog"> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.api.domain.SysLoginLog"> |
| | | <id column="id" property="id" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="user_name" property="username" /> |
| | |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.ruoyi</groupId> |
| | | <artifactId>ruoyi-api-order</artifactId> |
| | | <version>3.6.2</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.model.TApplyChargingPile; |
| | | import com.ruoyi.chargingPile.api.model.TCarport; |
| | | import com.ruoyi.chargingPile.api.vo.TCarportVO; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.chargingPile.service.TApplyChargingPileService; |
| | | import com.ruoyi.chargingPile.service.TCarportService; |
| | | import com.ruoyi.chargingPile.service.TVehicleRampService; |
| | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.TChargingGunQuery; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunCountMonitoring; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/chargeMonitoring/{siteId}") |
| | | @ApiOperation(value = "获取充电设施监控数据", tags = {"管理后台-充电设备监控"}) |
| | | public AjaxResult<ChargeMonitoring> chargeMonitoring(@PathVariable Integer siteId){ |
| | | ChargeMonitoring chargeMonitoring = chargingPileService.chargeMonitoring(siteId); |
| | | return AjaxResult.success(chargeMonitoring); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getChargingGunCountMonitoring/{siteId}") |
| | | @ApiOperation(value = "获取充电枪各种状态汇总监控数据", tags = {"管理后台-充电设备监控"}) |
| | | public AjaxResult<ChargingGunCountMonitoring> getChargingGunCountMonitoring(@PathVariable Integer siteId){ |
| | | ChargingGunCountMonitoring chargingGunCountMonitoring = chargingPileService.getChargingGunCountMonitoring(siteId); |
| | | return AjaxResult.success(chargingGunCountMonitoring); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/getChargingGunMonitoring") |
| | | @ApiOperation(value = "获取充电枪监控数据", tags = {"管理后台-充电设备监控"}) |
| | | public AjaxResult<PageInfo<ChargingGunMonitoring>> getChargingGunMonitoring(GetChargingGunMonitoring query){ |
| | | PageInfo<ChargingGunMonitoring> chargingGunMonitoring = chargingPileService.getChargingGunMonitoring(query); |
| | | return AjaxResult.success(chargingGunMonitoring); |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.chargingPile.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/14 15:54 |
| | | */ |
| | | @ApiModel |
| | | @Data |
| | | public class ChargeMonitoring { |
| | | @ApiModelProperty("电站电话") |
| | | private String phone; |
| | | @ApiModelProperty("详细地址") |
| | | private String address; |
| | | @ApiModelProperty("终点总数") |
| | | private Integer terminalTotal; |
| | | @ApiModelProperty("充电中") |
| | | private Integer charging; |
| | | @ApiModelProperty("未充电") |
| | | private Integer notCharged; |
| | | @ApiModelProperty("额定功率") |
| | | private BigDecimal ratedPower; |
| | | @ApiModelProperty("实时功率") |
| | | private BigDecimal realTimePower; |
| | | @ApiModelProperty("需求功率满足率") |
| | | private BigDecimal demandPowerSatisfactionRate; |
| | | @ApiModelProperty("充电量趋势") |
| | | private Map<String, Object> chargeTrend; |
| | | @ApiModelProperty("利用率趋势") |
| | | private Map<String, Object> utilizationTrend; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/15 16:36 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class ChargingGunCountMonitoring { |
| | | @ApiModelProperty("空闲中") |
| | | private Long leisure; |
| | | @ApiModelProperty("已插枪") |
| | | private Long loaded; |
| | | @ApiModelProperty("充电中") |
| | | private Long charging; |
| | | @ApiModelProperty("离网") |
| | | private Long offline; |
| | | @ApiModelProperty("故障") |
| | | private Long breakdown; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/15 13:58 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class ChargingGunMonitoring { |
| | | @ApiModelProperty("充电枪id") |
| | | private Integer id; |
| | | @ApiModelProperty("充电枪状态(1=离线,2=空闲,3=已插枪,4=占用(充电中),7=故障)") |
| | | private Integer status; |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | @ApiModelProperty("充电比率") |
| | | private BigDecimal chargingRatio; |
| | | @ApiModelProperty("车位") |
| | | private String parkingNumber; |
| | | @ApiModelProperty("车牌号") |
| | | private String licensePlate; |
| | | @ApiModelProperty("电量") |
| | | private String electricQuantity; |
| | | @ApiModelProperty("当前SOC值") |
| | | private String soc; |
| | | @ApiModelProperty("实时A相电流") |
| | | private String electricCurrent; |
| | | @ApiModelProperty("实时A相电压") |
| | | private String voltage; |
| | | @ApiModelProperty("故障原因") |
| | | private String faultCause; |
| | | } |
New file |
| | |
| | | package com.ruoyi.chargingPile.dto; |
| | | |
| | | import com.ruoyi.common.core.web.page.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/8/15 13:48 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class GetChargingGunMonitoring extends BasePage { |
| | | @ApiModelProperty("站带你id") |
| | | private Integer siteId; |
| | | @ApiModelProperty("充电枪状态(1=离线,2=空闲,3=已插枪,4=占用(充电中),7=故障)") |
| | | private List<Integer> status; |
| | | @ApiModelProperty("soc开始值") |
| | | private Double socStart; |
| | | @ApiModelProperty("soc结束值") |
| | | private Double socEnd; |
| | | @ApiModelProperty("终端名称") |
| | | private String name; |
| | | |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.PageChargingPileList; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | * @return |
| | | */ |
| | | List<TChargingPileVO> getChargingGunList(@Param("siteId")Integer siteId); |
| | | |
| | | |
| | | /** |
| | | * 获取充电枪监控数据 |
| | | * @param pageInfo |
| | | * @param siteIds |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<ChargingGunMonitoring> getChargingGunMonitoring(PageInfo<ChargingGunMonitoring> pageInfo, @Param("siteIds") Set<Integer> siteIds, |
| | | @Param("query") GetChargingGunMonitoring query); |
| | | } |
| | |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | | import com.ruoyi.chargingPile.api.query.PageChargingPileList; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunCountMonitoring; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | * @return |
| | | */ |
| | | List<TChargingPileVO> getChargingGunList(Integer siteId,Integer type); |
| | | |
| | | |
| | | /** |
| | | * 获取充电设备监控数据 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | ChargeMonitoring chargeMonitoring(Integer siteId); |
| | | |
| | | |
| | | /** |
| | | * 获取充电枪各种状态汇总 |
| | | * @param siteId 站点id |
| | | * @return |
| | | */ |
| | | ChargingGunCountMonitoring getChargingGunCountMonitoring(Integer siteId); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取充电枪监控数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<ChargingGunMonitoring> getChargingGunMonitoring(GetChargingGunMonitoring query); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.feignClient.AppUserCarClient; |
| | | import com.ruoyi.account.api.model.TAppUserCar; |
| | | import com.ruoyi.chargingPile.api.dto.PageChargingPileListDTO; |
| | | import com.ruoyi.chargingPile.api.model.Site; |
| | | import com.ruoyi.chargingPile.api.model.TChargingGun; |
| | | import com.ruoyi.chargingPile.api.model.TChargingPile; |
| | | import com.ruoyi.chargingPile.api.query.BatchSetAccountingStrategy; |
| | |
| | | import com.ruoyi.chargingPile.api.vo.TChargingGunVO; |
| | | import com.ruoyi.chargingPile.api.vo.TChargingPileVO; |
| | | import com.ruoyi.chargingPile.domain.SiteMenu; |
| | | import com.ruoyi.chargingPile.dto.ChargeMonitoring; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunCountMonitoring; |
| | | import com.ruoyi.chargingPile.dto.ChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.dto.GetChargingGunMonitoring; |
| | | import com.ruoyi.chargingPile.mapper.TChargingPileMapper; |
| | | import com.ruoyi.chargingPile.service.IPartnerService; |
| | | import com.ruoyi.chargingPile.service.ISiteService; |
| | | import com.ruoyi.chargingPile.service.TChargingGunService; |
| | | import com.ruoyi.chargingPile.service.TChargingPileService; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderAccountingStrategyClient; |
| | | import com.ruoyi.order.api.feignClient.ChargingOrderClient; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Resource |
| | | private RoleSiteClient roleSiteClient; |
| | | |
| | | @Resource |
| | | private ISiteService siteService; |
| | | |
| | | @Resource |
| | | private ChargingOrderAccountingStrategyClient chargingOrderAccountingStrategyClient; |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | @Resource |
| | | private AppUserCarClient appUserCarClient; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | }); |
| | | return chargingPileVOS; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取监控设备监控数据 |
| | | * @param siteId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ChargeMonitoring chargeMonitoring(Integer siteId) { |
| | | //获取当前登录账户的站点权限数据 |
| | | Set<Integer> siteIds = new HashSet<>(); |
| | | if(null == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | if(2 == roleType){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = new HashSet<>(data); |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(siteId); |
| | | } |
| | | List<Site> sites = siteService.listByIds(siteIds); |
| | | List<TChargingGun> total = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getSiteId, siteIds).eq(TChargingGun::getDelFlag, 0)); |
| | | List<TChargingGun> charging = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getSiteId, siteIds).eq(TChargingGun::getStatus, 4).eq(TChargingGun::getDelFlag, 0)); |
| | | BigDecimal ratedPower = total.stream().map(TChargingGun::getRatedPower).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal realTimePower = charging.stream().map(TChargingGun::getChargingPower).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | ChargeMonitoring chargeMonitoring = new ChargeMonitoring(); |
| | | chargeMonitoring.setPhone(sites.size() == 1 ? sites.get(0).getPhone() : ""); |
| | | chargeMonitoring.setAddress(sites.size() == 1 ? sites.get(0).getAddress() : ""); |
| | | chargeMonitoring.setTerminalTotal(total.size()); |
| | | chargeMonitoring.setCharging(charging.size()); |
| | | chargeMonitoring.setNotCharged(total.size() - charging.size()); |
| | | chargeMonitoring.setRatedPower(ratedPower.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargeMonitoring.setRealTimePower(realTimePower.setScale(4, RoundingMode.HALF_EVEN)); |
| | | chargeMonitoring.setDemandPowerSatisfactionRate(realTimePower.divide(ratedPower).multiply(new BigDecimal(100)).setScale(2, RoundingMode.HALF_EVEN)); |
| | | |
| | | List<String> dates = new ArrayList<>(); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | for (int i = 6; i >= 0; i--) { |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - i); |
| | | dates.add(sdf.format(calendar.getTime())); |
| | | } |
| | | List<List<Map<String, Object>>> value1 = chargingOrderAccountingStrategyClient.getTotalElectricQuantity(6, siteIds).getData(); |
| | | Map<String, Object> chargeTrend = new HashMap<>(); |
| | | chargeTrend.put("date", dates); |
| | | chargeTrend.put("value", value1); |
| | | chargeMonitoring.setChargeTrend(chargeTrend); |
| | | |
| | | //每日利用率=当日充电度数/(总桩数量*桩总功率*24小时) |
| | | List<TChargingPile> list = this.list(new LambdaQueryWrapper<TChargingPile>().in(TChargingPile::getSiteId, siteIds).eq(TChargingPile::getDelFlag, 0)); |
| | | BigDecimal v = list.stream().map(TChargingPile::getRatedPower).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(4, RoundingMode.HALF_EVEN); |
| | | List<Double> data = chargingOrderAccountingStrategyClient.getDailyChargingDegree(6, siteIds).getData(); |
| | | List<Double> value2 = new ArrayList<>(); |
| | | for (Double datum : data) { |
| | | Double datum1 = new BigDecimal(datum).divide(new BigDecimal(list.size()).multiply(v).multiply(new BigDecimal(24))).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | | value2.add(datum1); |
| | | } |
| | | Map<String, Object> utilizationTrend = new HashMap<>(); |
| | | utilizationTrend.put("date", dates); |
| | | utilizationTrend.put("value", value2); |
| | | chargeMonitoring.setUtilizationTrend(utilizationTrend); |
| | | return chargeMonitoring; |
| | | } |
| | | |
| | | /** |
| | | * 获取充电枪各种状态汇总 |
| | | * @param siteId 站点id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public ChargingGunCountMonitoring getChargingGunCountMonitoring(Integer siteId) { |
| | | //获取当前登录账户的站点权限数据 |
| | | Set<Integer> siteIds = new HashSet<>(); |
| | | if(null == siteId){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | if(2 == roleType){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = new HashSet<>(data); |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(siteId); |
| | | } |
| | | List<TChargingGun> list = chargingGunService.list(new LambdaQueryWrapper<TChargingGun>().in(TChargingGun::getSiteId, siteIds).eq(TChargingGun::getDelFlag, 0)); |
| | | //空闲 |
| | | long leisure = list.stream().filter(s -> s.getStatus().equals(2)).count(); |
| | | //已插枪 |
| | | long loaded = list.stream().filter(s -> Arrays.asList(3, 5, 6).contains(s.getStatus())).count(); |
| | | //充电中 |
| | | long charging = list.stream().filter(s -> s.getStatus().equals(4)).count(); |
| | | //离网 |
| | | long offline = list.stream().filter(s -> s.getStatus().equals(0)).count(); |
| | | //故障 |
| | | long breakdown = list.stream().filter(s -> s.getStatus().equals(7)).count(); |
| | | ChargingGunCountMonitoring chargingGunCountMonitoring = new ChargingGunCountMonitoring(); |
| | | chargingGunCountMonitoring.setLeisure(leisure); |
| | | chargingGunCountMonitoring.setLoaded(loaded); |
| | | chargingGunCountMonitoring.setCharging(charging); |
| | | chargingGunCountMonitoring.setOffline(offline); |
| | | chargingGunCountMonitoring.setBreakdown(breakdown); |
| | | return chargingGunCountMonitoring; |
| | | } |
| | | |
| | | /** |
| | | * 获取充电枪监控数据 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public PageInfo<ChargingGunMonitoring> getChargingGunMonitoring(GetChargingGunMonitoring query) { |
| | | //获取当前登录账户的站点权限数据 |
| | | Set<Integer> siteIds = new HashSet<>(); |
| | | if(null == query.getSiteId()){ |
| | | SysUser sysUser = sysUserClient.getSysUser(SecurityUtils.getUserId()).getData(); |
| | | Integer roleType = sysUser.getRoleType(); |
| | | Integer objectId = sysUser.getObjectId(); |
| | | if(2 == roleType){ |
| | | siteIds = partnerService.authSite(objectId, SiteMenu.SITE_LIST); |
| | | }else{ |
| | | //非管理员需要根据角色和用户配置查询允许的站点数据 |
| | | if(!SecurityUtils.isAdmin(SecurityUtils.getUserId())){ |
| | | List<Integer> data = userSiteClient.getSiteIds(sysUser.getUserId()).getData(); |
| | | List<Integer> data1 = roleSiteClient.getSiteIds(sysUser.getRoleId()).getData(); |
| | | data.addAll(data1); |
| | | siteIds = new HashSet<>(data); |
| | | } |
| | | } |
| | | }else{ |
| | | siteIds.add(query.getSiteId()); |
| | | } |
| | | // todo 待完善 |
| | | if(null != query.getStatus() && 0 < query.getStatus().size()){ |
| | | if(query.getStatus().contains(3)){ |
| | | query.getStatus().add(6); |
| | | query.getStatus().add(7); |
| | | } |
| | | } |
| | | PageInfo<ChargingGunMonitoring> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | | List<ChargingGunMonitoring> chargingGunMonitoring = this.baseMapper.getChargingGunMonitoring(pageInfo, siteIds, query); |
| | | for (ChargingGunMonitoring gunMonitoring : chargingGunMonitoring) { |
| | | Integer status = gunMonitoring.getStatus(); |
| | | if(status == 5 || status == 6){ |
| | | gunMonitoring.setStatus(3); |
| | | } |
| | | if(status == 4){ |
| | | Integer id = gunMonitoring.getId(); |
| | | //根据订单数据查询车牌号 |
| | | TChargingOrder chargingOrder = chargingOrderClient.getOrderDetailByGunId(id).getData(); |
| | | Integer appUserCarId = chargingOrder.getAppUserCarId(); |
| | | if(null != appUserCarId){ |
| | | TAppUserCar tAppUserCar = appUserCarClient.getCarByIds(Arrays.asList(appUserCarId)).getData().get(0); |
| | | gunMonitoring.setLicensePlate(tAppUserCar.getLicensePlate()); |
| | | } |
| | | } |
| | | } |
| | | return pageInfo.setRecords(chargingGunMonitoring); |
| | | } |
| | | } |
| | |
| | | <result column="lower_limit_of_rated_voltage" property="lowerLimitOfRatedVoltage" /> |
| | | <result column="rated_current" property="ratedCurrent" /> |
| | | <result column="rated_power" property="ratedPower" /> |
| | | <result column="charging_power" property="chargingPower" /> |
| | | <result column="parking_number" property="parkingNumber" /> |
| | | <result column="parking_status" property="parkingStatus" /> |
| | | <result column="parking_lock_state" property="parkingLockState" /> |
| | |
| | | select id,code, `name`, `number` from t_charging_pile |
| | | where del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()} and site_id = #{siteId} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getChargingGunMonitoring" resultType="com.ruoyi.chargingPile.dto.ChargingGunMonitoring"> |
| | | select |
| | | a.id, |
| | | a.status, |
| | | CONCAT(b.number, a.name) as name, |
| | | a.parking_number as parkingNumber |
| | | from t_charging_gun a |
| | | left join t_charging_pile b on (a.charging_pile_id = b.id) |
| | | where a.del_flag = 0 |
| | | <if test="null != siteIds and siteIds.size() > 0"> |
| | | and a.site_id in |
| | | <foreach collection="siteIds" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != query.status and query.status.size() > 0"> |
| | | and a.status in |
| | | <foreach collection="query.status" item="item" index="index" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="null != query.name and '' != query.name"> |
| | | and a.name like CONCAT('%', #{query.name}, '%') |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <!--rocketmq--> |
| | | <dependency> |
| | | <groupId>com.alibaba.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-stream-rocketmq</artifactId> |
| | | <version>2.2.2.RELEASE</version> |
| | | <exclusions> |
| | | <exclusion> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-client</artifactId> |
| | | </exclusion> |
| | | <exclusion> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-acl</artifactId> |
| | | </exclusion> |
| | | </exclusions> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-client</artifactId> |
| | | <version>4.7.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.rocketmq</groupId> |
| | | <artifactId>rocketmq-acl</artifactId> |
| | | <version>4.7.1</version> |
| | | </dependency> |
| | | |
| | | <!--spirngboot集成mongodb--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩计费模型请求 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "acquisition_billing_mode") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class AcquisitionBillingMode { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | |
| | | } |
| | | |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 计费模型请求应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "acquisition_billing_mode_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class AcquisitionBillingModeReply { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号 |
| | | private BigDecimal sharp_peak_electricity_rate;// 尖费电费费率(精确到五位小数) |
| | | private BigDecimal sharp_peak_service_rate;// 尖服务费费率(精确到五位小数) |
| | | private BigDecimal peak_electricity_rate;// 峰电费费率(精确到五位小数) |
| | | private BigDecimal peak_service_rate;// 峰服务费费率(精确到五位小数) |
| | | private BigDecimal flat_peak_electricity_rate;// 平电费费率(精确到五位小数) |
| | | private BigDecimal flat_peak_service_rate;// 平服务费费率(精确到五位小数) |
| | | private BigDecimal low_peak_electricity_rate;// 谷电费费率(精确到五位小数) |
| | | private BigDecimal low_peak_service_rate;// 谷服务费费率(精确到五位小数) |
| | | private BigDecimal loss_ratio;// 计损比例 |
| | | private Integer time1;// 0:00~0:30 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time2;// 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time3;// 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time4; |
| | | private Integer time5; |
| | | private Integer time6; |
| | | private Integer time7; |
| | | private Integer time8; |
| | | private Integer time9; |
| | | private Integer time10; |
| | | private Integer time11; |
| | | private Integer time12; |
| | | private Integer time13; |
| | | private Integer time14; |
| | | private Integer time15; |
| | | private Integer time16; |
| | | private Integer time17; |
| | | private Integer time18; |
| | | private Integer time19; |
| | | private Integer time20; |
| | | private Integer time21; |
| | | private Integer time22; |
| | | private Integer time23; |
| | | private Integer time24; |
| | | private Integer time25; |
| | | private Integer time26; |
| | | private Integer time27; |
| | | private Integer time28; |
| | | private Integer time29; |
| | | private Integer time30; |
| | | private Integer time31; |
| | | private Integer time32; |
| | | private Integer time33; |
| | | private Integer time34; |
| | | private Integer time35; |
| | | private Integer time36; |
| | | private Integer time37; |
| | | private Integer time38; |
| | | private Integer time39; |
| | | private Integer time40; |
| | | private Integer time41; |
| | | private Integer time42; |
| | | private Integer time43; |
| | | private Integer time44; |
| | | private Integer time45; |
| | | private Integer time46; |
| | | private Integer time47;// 23:00~23:30 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time48;// 23:30~0:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 计费模型验证请求 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "billing_mode_verify") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BillingModeVerify { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String billing_model_code;// "计费模型编号,首次连接到平台时置零 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 计费模型验证请求应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "billing_mode_verify_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BillingModeVerifyReply { |
| | | |
| | | private String charging_pile_code; // 桩编 |
| | | private String billing_model_code; // 计费模型编 |
| | | private Integer billing_model_result; // 验证结果(0:桩计费模型与平台一致,1:桩计费模型与平台不一致) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电阶段BMS中止 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "bms_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsAbort { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer bms_stop_charging_reason; // BMS 中止充电原因(1-2 位——所需求的 SOC 目标值,3-4 位——达到总电压的设定值,5-6 位——达到单体电压设定值,7-8 位——充电机主动中止) |
| | | private Integer bms_aborted_charging_fault_cause; // BMS 中止充电故障原因(1-2 位——绝缘故障,3-4 位——输出连接器过温故障,5-6 位——BMS 元件、输出连接器过温,7-8 位——充电连接器故障,9-10 位——电池组温度过高故障,11-12 位——高压继电器故障,13 位-14 位——检测点 2 电压检测故障,15-16 位——其他故障) |
| | | private Integer bms_aborted_charging_error_cause; // BMS 中止充电错误原因(1-2 位——电流过大,3-4 位——电压异常,5-8 位——预留位) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电过程BMS需求、充电机输出 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "bms_demand_and_charger_exportation") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsDemandAndChargerExportation { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_voltage_requirements; // BMS 电压需求 |
| | | private BigDecimal bms_current_requirements; // BMS 电流需求 |
| | | private Integer bms_charging_mode; // BMS 充电模式(1:恒压充电;2:恒流充电) |
| | | private BigDecimal bms_voltage_measurement_value; // BMS 充电电压测量值 |
| | | private BigDecimal bms_current_measurement_value; // BMS 充电电流测量值 |
| | | private Integer bms_battery_voltage_and_group_number; // BMS 最高单体动力蓄电池电压及组号(1-12 位:最高单体动力蓄电池电压,数据分辨率:0.01 V/位,0 V 偏移量;数据范围:0~24 V;13-16 位:最高单体动力蓄电池电压所在组号,数据分辨率:1/位,0 偏移量;数据范围:0~15) |
| | | private BigDecimal bms_charged_status; // BMS 当前荷电状态 SOC( %) |
| | | private Integer bms_remaining_charging_time; // BMS 估算剩余充电时间 |
| | | private BigDecimal voltage_output_value; // 电桩电压输出值 |
| | | private BigDecimal current_output_value; // 电桩电流输出值 |
| | | private Integer cumulative_charging_time; // 累计充电时间 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电过程BMS信息 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "bms_information") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class BmsInformation { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer bms_highest_voltage_number; // BMS 最高单体动力蓄电池电压所在编号 |
| | | private String bms_maximum_battery_temperature; // BMS 最高动力蓄电池温度 |
| | | private Integer maximum_temperature_detection_point_number; // 最高温度检测点编号 |
| | | private String minimum_cell_temperature; // 最低动力蓄电池温度 |
| | | private Integer lowest_temperature_detection_pointt_number; // 最低动力蓄电池温度检测点编号 |
| | | private Integer bms_battery_voltage; // BMS 单体动力蓄电池电压过高 /过低(0:正常,1:过高,10:过低) |
| | | private Integer bms_battery_charging_status; // BMS 整车动力蓄电池荷电状态SOC 过高/过低(0:正常,1:过高,10:过低) |
| | | private Integer bms_charging_overcurrent; // BMS 动力蓄电池充电过电流(0:正常,1:过流,10:不可信状态) |
| | | private Integer bms_high_battery_temperature; // BMS 动力蓄电池温度过高(0:正常,1:过流,10:不可信状态) |
| | | private Integer bms_battery_insulation_status; // BMS 动力蓄电池绝缘状态(0:正常,1:过流,10:不可信状态) |
| | | private Integer bms_output_connector_connection_status; // BMS 动力蓄电池组输出连接器连接状态(0:正常,1:过流,10:不可信状态) |
| | | private Integer charge_prohibition; // 充电禁止(0:禁止,1:允许) |
| | | private Integer reserve; // 预留位 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电握手 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "charging_handshake") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingHandshake { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String bms_protocol_version;// BMS 通信协议版本号 |
| | | private Integer bms_battery_type;// BMS 电池类型(1:铅酸电池;2:氢:电池;3:磷酸铁锂电池;4:锰酸锂电池;5:钴酸锂电池;6:三元材料电池;7:聚合物锂离子电池;8:钛酸锂电池;FFH:其他) |
| | | private BigDecimal bms_battery_capacity;// BMS 整车动力蓄电池系统额定容量 |
| | | private BigDecimal bms_total_battery_voltage;// BMS 整车动力蓄电池系统额定总电压 |
| | | private String bms_battery_manufacturer;// BMS 电池生产厂商名称 |
| | | private String bms_battery_serial_number;// BMS 电池组序号 |
| | | private Integer bms_battery_production_year;// BMS 电池组生产日期年 |
| | | private Integer bms_battery_production_month;// BMS 电池组生产日期月 |
| | | private Integer bms_battery_production_day;// BMS 电池组生产日期日 |
| | | private Integer bms_battery_charging_times;// BMS 电池组充电次数 |
| | | private Integer bms_battery_property_rights;// BMS 电池组产权标识 |
| | | private Integer reserved;// 预留位 |
| | | private String vim;// BMS 车辆识别码 |
| | | private Integer bms_software_version;// BMS 软件版本号 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩返回数据(上行) |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "charging_pile_returns_ground_lock_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileReturnsGroundLockData { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer control_state; // 地锁控制返回标志(1:鉴权成功,0:鉴权失败) |
| | | private String reserve; // 预留位 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩主动申请启动充电 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "charging_pile_starts_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ChargingPileStartsCharging { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer start_method; // 启动方式(1:表示通过刷卡启动充电,2:表示通过帐号启动充电(暂不支持),3:表示vin码启动充电) |
| | | private Integer need_password; // 是否需要密码(0:不需要,1:需要) |
| | | private String account; // 账号或者物理卡号 |
| | | private String password; // 输入密码 |
| | | private String vin; // "VIN 码,启动方式为vin码启动充电时上送,其他方式置零( ASCII码),VIN码需要反序上送 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据清除 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "clear_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ClearOfflineCard { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer physical_card_number; // 清除离线卡的个数,最大 24 个 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据清除应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "clear_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ClearOfflineCardReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | private Integer clear_result1; // 清除标记(0:清除失败,1:清除成功) |
| | | private Integer clear_result2; |
| | | private Integer clear_result3; |
| | | private Integer clear_result4; |
| | | private Integer clear_result5; |
| | | private Integer clear_result6; |
| | | private Integer clear_result7; |
| | | private Integer clear_result8; |
| | | private Integer clear_result9; |
| | | private Integer clear_result10; |
| | | private Integer clear_result11; |
| | | private Integer clear_result12; |
| | | private Integer clear_result13; |
| | | private Integer clear_result14; |
| | | private Integer clear_result15; |
| | | private Integer clear_result16; |
| | | private Integer clear_result17; |
| | | private Integer clear_result18; |
| | | private Integer clear_result19; |
| | | private Integer clear_result20; |
| | | private Integer clear_result21; |
| | | private Integer clear_result22; |
| | | private Integer clear_result23; |
| | | private Integer clear_result24; |
| | | private Integer failure_cause1; // 失败原因(1:卡号格式错误,2:清除成功) |
| | | private Integer failure_cause2; |
| | | private Integer failure_cause3; |
| | | private Integer failure_cause4; |
| | | private Integer failure_cause5; |
| | | private Integer failure_cause6; |
| | | private Integer failure_cause7; |
| | | private Integer failure_cause8; |
| | | private Integer failure_cause9; |
| | | private Integer failure_cause10; |
| | | private Integer failure_cause11; |
| | | private Integer failure_cause12; |
| | | private Integer failure_cause13; |
| | | private Integer failure_cause14; |
| | | private Integer failure_cause15; |
| | | private Integer failure_cause16; |
| | | private Integer failure_cause17; |
| | | private Integer failure_cause18; |
| | | private Integer failure_cause19; |
| | | private Integer failure_cause20; |
| | | private Integer failure_cause21; |
| | | private Integer failure_cause22; |
| | | private Integer failure_cause23; |
| | | private Integer failure_cause24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 交易记录确认 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "confirm_transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ConfirmTransactionRecord { |
| | | |
| | | private String transaction_serial_number;// 桩编码 |
| | | private Integer confirm_result;// 确认结果(0:上传成功,1:非法账单) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 充电结束 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "end_charge") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class EndCharge { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_battery_charging_status; // BMS 中止荷电状态 SOC |
| | | private BigDecimal bms_minimum_battery_voltage; // BMS 动力蓄电池单体最低电压 |
| | | private BigDecimal bms_maximum_battery_voltage; // BMS 动力蓄电池单体最高电压 |
| | | private Integer bms_minimum_battery_temperature; // BMS 动力蓄电池最低温度 |
| | | private Integer bms_maximum_battery_temperature; // BMS 动力蓄电池最高温度 |
| | | private BigDecimal cumulative_charging_time; // 电桩累计充电时间 |
| | | private BigDecimal output_energy; // 电桩输出能量 |
| | | private String charger_code; // 电桩充电机编号 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 错误报文 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "error_message") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ErrorMessage { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charger_identification_0; // 接收 SPN2560=0x00 的充电机辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer charger_identification_170; // 接收 SPN2560=0xAA 的充电机辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charger_identification_reserve; // 预留位 |
| | | private Integer time_synchronization_and_maximum_output_charger; // 接收充电机的时间同步和充电机最大输出能力报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer charge_preparation; // 接收充电机完成充电准备报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charge_preparation_reserve; // 预留位 |
| | | private Integer charging_status; // 接收充电机充电状态报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer stop_charging; // 接收充电机中止充电报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String charge_reserve; // 预留位 |
| | | private Integer charging_statistics; // 接收充电机充电统计报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_other; // BMS 其他 |
| | | private Integer bms_and_vehicle_identification; // 接收 BMS 和车辆的辨识报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_and_vehicle_identification_reserve; // 预留位 |
| | | private Integer battery_charging_parameter; // 接收电池充电参数报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_completes_charging_preparation; // 接收 BMS 完成充电准备报文超时(0=正常,1=超时,10=不可信状态) |
| | | private String bms_completes_charging_preparation_reserve; // 预留位 |
| | | private Integer total_battery_charging_status; // 接收电池充电总状态报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer battery_charging_requirements; // 接收电池充电要求报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_stop_charging; // 接收 BMS 中止充电报文超时(0=正常,1=超时,10=不可信状态) |
| | | private Integer bms_reserve; // 预留位 |
| | | private Integer bms_charging_statistics; // 接收 BMS 充电统计报文超时0=正常,1=超时,10=不可信状态) |
| | | private String charger_other; // 充电机其他 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 地锁数据上送(充电桩上送) |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "ground_lock_real_time_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class GroundLockRealTimeData { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer parking_lock_status; // 车位锁状态(0:未到位状态,1:升锁到位状态,2:降锁到位状态) |
| | | private Integer parking_status; // 车位状态(0:无车辆,1:停放车辆) |
| | | private Integer ground_locking_capacity; // 地锁电量状态 |
| | | private Integer alarm_status; // 报警状态(0:正常无报警,1:待机状态摇臂破坏,2:摇臂升降异常(未到位)) |
| | | private String reserve; // 预留位 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电阶段充电机中止 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "motor_abort") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class MotorAbort { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charger_stops_charging_reason; // 充电机中止充电原因(1-2 位——达到充电机设定的条件中止,3-4 位——人工中止,5-6 位——异常中止) |
| | | private Integer charging_failure_cause; // 充电机中止充电故障原因(1-2 位——充电机过温故障,3-4 位——充电连接器故障,5-6 位——充电机内部过温故障,7-8 位——所需电量不能传送,9-10 位——充电机急停故障,11-12 位——其他故障,13-16 位——预留位) |
| | | private Integer charging_machine_stopped_charging_error_cause; // 充电机中止充电错误原因(1-2 位——电流不匹配,3-4 位——电压异常,5-8 位——预留位) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩登录认证 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "online") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Online { |
| | | private String charging_pile_code;// 充电桩编号 |
| | | private Integer charging_pile_type;// 充电桩类型(0 表示直流桩,1 表示交流桩) |
| | | private Integer charging_gun_number;// 充电枪数量 |
| | | private String protocol_version;// 通信协议版本 |
| | | private String program_version;// 程序版本 |
| | | private Integer network_link_type;// 网络链接类型(0:SIM 卡,1:LAN,2:WAN,3:其他) |
| | | private String sim;// Sim 卡 |
| | | private Integer operator;// 运营商(0: 移动,2:电信,3:联通,4:其他) |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 登录认证应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "online_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class OnlineReply { |
| | | private String charging_pile_code;// 桩编码 |
| | | private Integer online_result;// 登陆结果(0:成功,1:失败) |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 遥控地锁升锁与降锁命令 (下行) |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "open_or_close_ground_lock") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class OpenOrCloseGroundLock { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer operate; // 升/降地锁(1:升锁,2:降锁) |
| | | private String reserve; // 预留位 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 参数配置 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "parameter_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ParameterSetting { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private BigDecimal bms_maximum_charging_voltage; // BMS 单体动力蓄电池最高允许充电电压 |
| | | private BigDecimal bms_maximum_charging_current; // BMS 最高允许充电电流 |
| | | private BigDecimal bms_battery_total_energy; // BMS 动力蓄电池标称总能量 |
| | | private BigDecimal bms_total_charging_voltage; // BMS 最高允许充电总电压 |
| | | private Integer bms_maximum_temperature; // BMS 最高允许温度 |
| | | private BigDecimal bms_battery_charging_status; // BMS 整车动力蓄电池荷电状态 (soc) |
| | | private BigDecimal bms_battery_voltage; // BMS 整车动力蓄电池当前电池 电压 |
| | | private BigDecimal maximum_output_voltage; // 电桩最高输出电压 |
| | | private BigDecimal minimum_output_voltage; // 电桩最低输出电压 |
| | | private BigDecimal maximum_output_current; // 电桩最大输出电流 |
| | | private BigDecimal minimum_output_current; // 电桩最小输出电流 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩心跳包 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "ping") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Ping { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private Integer charging_gun_status;// 抢状态(0:正常,1:故障) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 运营平台确认启动充电 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_confirmation_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformConfirmationCharging { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private String card_number; // 逻辑卡号 |
| | | private BigDecimal account_balance; // 账户余额 |
| | | private Integer authentication; // 鉴权成功标志(0:失败,1:成功) |
| | | private Integer failure_cause; // 失败原因(1:账户不存在,2: 账户冻结,3:账户余额不足,4:该卡存在未结账记录,5: 桩停用,6:该账户不能在此桩上充电,7:密码错误,8:电站电容不足,9:系统中 vin 码不存在,10:该桩存在未结账记录,11:该桩不支持刷卡) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 远程更新 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_remote_update") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRemoteUpdate { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer charging_pile_type; // 桩型号(1:直流,2:交流) |
| | | private Integer charging_pile_power; // 桩功率 |
| | | private String upgrade_server_address; // 升级服务器地址 |
| | | private Integer upgrade_server_port; // 升级服务器端口 |
| | | private String username; // 用户名 |
| | | private String password; // 密码 |
| | | private String file_path; // 文件路径 |
| | | private Integer operate; // 执行控制(1:立即执行,2:空闲执行) |
| | | private Integer download_timeout; // 下载超时时间 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 远程更新应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_remote_update_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRemoteUpdateReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer escalation_state; // 升级状态(0:成功,1:编码错误,2:程序与桩型号不符,3:下载更新文件超时) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 远程重启 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_restart") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRestart { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer operate; // 执行控制 (1:立即执行,2:空闲执行) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 远程重启应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_restart_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformRestartReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; // 设置结果(0:失败,1:成功) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 运营平台远程控制启机 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_start_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartCharging { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private String card_number; // 逻辑卡号 |
| | | private String physical_card_number; // 物理卡号 |
| | | private BigDecimal account_balance; // 账户余额 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 远程启机命令回复 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_start_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStartChargingReply { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer startup_result; // 启动结果(0:失败,1:成功) |
| | | private Integer failure_cause; // "失败原因(0:无,1:设备编号不匹配,2:枪已在充电,3:设备故障,4:设备离线,5:未插枪桩在收到启充命令后,检测到未插枪则发送 0x33 报文回复充电失败。若在 60 秒(以收到 0x34 时间开始计算)内检测到枪重新连接,则补送 0x33 成功报文;超时或者离线等其他异常,桩不启充、不补发 0x33 报文)" |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 运营平台远程停机 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_stop_charging") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStopCharging { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 远程停机命令回复 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "platform_stop_charging_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class PlatformStopChargingReply { |
| | | |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer stop_result; // 停止结果(0:失败,1:成功) |
| | | private Integer failure_cause; // 失败原因(0:无,1:设备编号不匹配,2:枪未处于充电状态,3:其他) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 心跳包应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "pong") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class Pong { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private Integer charging_gun_status;// 心跳应答(0) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据查询 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "query_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QueryOfflineCard { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer physical_card_number; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据查询应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "query_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class QueryOfflineCardReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card1; // 第 1 个卡物理卡号,离线卡物理卡号 |
| | | private String physical_card2; |
| | | private String physical_card3; |
| | | private String physical_card4; |
| | | private String physical_card5; |
| | | private String physical_card6; |
| | | private String physical_card7; |
| | | private String physical_card8; |
| | | private String physical_card9; |
| | | private String physical_card10; |
| | | private String physical_card11; |
| | | private String physical_card12; |
| | | private String physical_card13; |
| | | private String physical_card14; |
| | | private String physical_card15; |
| | | private String physical_card16; |
| | | private String physical_card17; |
| | | private String physical_card18; |
| | | private String physical_card19; |
| | | private String physical_card20; |
| | | private String physical_card21; |
| | | private String physical_card22; |
| | | private String physical_card23; |
| | | private String physical_card24; |
| | | private Integer query_result1; // 查询结果(0:不存在,1:存在) |
| | | private Integer query_result2; |
| | | private Integer query_result3; |
| | | private Integer query_result4; |
| | | private Integer query_result5; |
| | | private Integer query_result6; |
| | | private Integer query_result7; |
| | | private Integer query_result8; |
| | | private Integer query_result9; |
| | | private Integer query_result10; |
| | | private Integer query_result11; |
| | | private Integer query_result12; |
| | | private Integer query_result13; |
| | | private Integer query_result14; |
| | | private Integer query_result15; |
| | | private Integer query_result16; |
| | | private Integer query_result17; |
| | | private Integer query_result18; |
| | | private Integer query_result19; |
| | | private Integer query_result20; |
| | | private Integer query_result21; |
| | | private Integer query_result22; |
| | | private Integer query_result23; |
| | | private Integer query_result24; |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 读取实时监测数据 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "read_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class ReadRealTimeMonitoringData { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 计费模型设置 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "setup_billing_model") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SetupBillingModel { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String billing_model_code; // 计费模型编号 |
| | | private BigDecimal sharp_peak_electricity_rate; // 尖费电费费率(精确到五位小数) |
| | | private BigDecimal sharp_peak_service_rate; // 尖服务费费率(精确到五位小数) |
| | | private BigDecimal peak_electricity_rate; // 峰电费费率(精确到五位小数) |
| | | private BigDecimal peak_service_rate; // 峰服务费费率(精确到五位小数) |
| | | private BigDecimal flat_peak_electricity_rate; // 平电费费率(精确到五位小数) |
| | | private BigDecimal flat_peak_service_rate; // 平服务费费率(精确到五位小数) |
| | | private BigDecimal low_peak_electricity_rate; // 谷电费费率(精确到五位小数) |
| | | private BigDecimal low_peak_service_rate; // 谷服务费费率(精确到五位小数) |
| | | private BigDecimal loss_ratio; // 计损比例 |
| | | private Integer time1; // 0:00~0:30 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time2; // 0:30~1:00 时段费率号(0:尖费率,1:峰费率,2:平费率,3:谷费率) |
| | | private Integer time3; |
| | | private Integer time4; |
| | | private Integer time5; |
| | | private Integer time6; |
| | | private Integer time7; |
| | | private Integer time8; |
| | | private Integer time9; |
| | | private Integer time10; |
| | | private Integer time11; |
| | | private Integer time12; |
| | | private Integer time13; |
| | | private Integer time14; |
| | | private Integer time15; |
| | | private Integer time16; |
| | | private Integer time17; |
| | | private Integer time18; |
| | | private Integer time19; |
| | | private Integer time20; |
| | | private Integer time21; |
| | | private Integer time22; |
| | | private Integer time23; |
| | | private Integer time24; |
| | | private Integer time25; |
| | | private Integer time26; |
| | | private Integer time27; |
| | | private Integer time28; |
| | | private Integer time29; |
| | | private Integer time30; |
| | | private Integer time31; |
| | | private Integer time32; |
| | | private Integer time33; |
| | | private Integer time34; |
| | | private Integer time35; |
| | | private Integer time36; |
| | | private Integer time37; |
| | | private Integer time38; |
| | | private Integer time39; |
| | | private Integer time40; |
| | | private Integer time41; |
| | | private Integer time42; |
| | | private Integer time43; |
| | | private Integer time44; |
| | | private Integer time45; |
| | | private Integer time46; |
| | | private Integer time47; |
| | | private Integer time48; |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 计费模型应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "setup_billing_model_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SetupBillingModelReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String set_result; //设置结果(0:失败,1:成功) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 离线卡数据同步 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "synchronize_offline_card") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SynchronizeOfflineCard { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer card_number; // 下发卡个数 |
| | | private String card1; // 第 1 个卡逻辑卡号,离线卡逻辑卡号 |
| | | private String card2; |
| | | private String card3; |
| | | private String card4; |
| | | private String card5; |
| | | private String card6; |
| | | private String card7; |
| | | private String card8; |
| | | private String card9; |
| | | private String card10; |
| | | private String card11; |
| | | private String card12; |
| | | private String card13; |
| | | private String card14; |
| | | private String card15; |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 卡数据同步应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "synchronize_offline_card_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class SynchronizeOfflineCardReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer save_result; // 保存结果(0:失败,1:成功) |
| | | private Integer failure_cause; // 失败原因(1:卡号格式错误,2:储存空间不足) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 对时设置 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "timing_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TimingSetting { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 对时设置应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "timing_setting_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TimingSettingReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String current_time; //当前时间 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 交易记录 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "transaction_record") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class TransactionRecord { |
| | | |
| | | private String transaction_serial_number;// 交易流水号 |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String start_time;// 开始时间 |
| | | private String end_time;// 结束时间 |
| | | private BigDecimal sharp_peak_unit_price;// 尖单价 |
| | | private BigDecimal sharp_peak_charge;// 尖电量 |
| | | private BigDecimal loss_sharp_peak_charge;// 计损尖电量 |
| | | private BigDecimal sharp_peak_amount;// 尖金额 |
| | | private BigDecimal peak_unit_price;// 峰单价 |
| | | private BigDecimal peak_charge;// 峰电量 |
| | | private BigDecimal loss_peak_charge;// 计损峰电量 |
| | | private BigDecimal peak_amount;// 峰金额 |
| | | private BigDecimal flat_peak_unit_price;// 平单价 |
| | | private BigDecimal flat_peak_charge;// 平电量 |
| | | private BigDecimal loss_flat_peak_charge;// 计损平电量 |
| | | private BigDecimal flat_peak_amount;// 平金额 |
| | | private BigDecimal low_peak_unit_price;// 谷单价 |
| | | private BigDecimal low_peak_charge;// 谷电量 |
| | | private BigDecimal loss_low_peak_charge;// 计损谷电量 |
| | | private BigDecimal low_peak_amount;// 谷金额 |
| | | private BigDecimal total_initial_value;// 电表总起值 |
| | | private BigDecimal total_stop_value;// 电表总止值 |
| | | private BigDecimal total_electricity;// 总电量 |
| | | private BigDecimal loss_total_electricity;// 计损总电量 |
| | | private BigDecimal payment_amount;// 消费金额 |
| | | private String vin;// 电动汽车唯一标识 |
| | | private Integer start_method;// 交易标识(1:app 启动,2:卡启动,4:离线卡启动,5: vin 码启动充电) |
| | | private String trade_date;// 交易日期、时间 |
| | | private Integer stop_reason;// 停止原因 |
| | | private String physical_card_number;// 物理卡号 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 远程账户余额更新 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "update_balance") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UpdateBalance { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private String physical_card_number; //物理卡号 |
| | | private BigDecimal account_balance; //修改结果(:0:修改成功,1:设备编号错误,2:卡号错误) |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 余额更新应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "update_balance_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UpdateBalanceReply { |
| | | |
| | | private String charging_pile_code;// 桩编码 |
| | | private String charging_gun_code;// 抢号 |
| | | private String physical_card_number;// 物理卡号 |
| | | private BigDecimal account_balance;// 修改后账户金额 |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 上传实时监测数据 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "upload_real_time_monitoring_data") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class UploadRealTimeMonitoringData { |
| | | |
| | | private String transaction_serial_number; // 交易流水号 |
| | | private String charging_pile_code; // 桩编码 |
| | | private String charging_gun_code; // 抢号 |
| | | private Integer charging_gun_status; // 状态(0:离线,1:故障,2:空闲,3:充电) |
| | | private Integer homing_status; // 枪是否归位(0:否,1:是,2:未知) |
| | | private Integer insertion_status; // 是否插枪(0:否,1:是) |
| | | private BigDecimal output_voltage; // 输出电压,精确到小数点后一位;待机置零 |
| | | private BigDecimal output_current; // 输出电流,精确到小数点后一位;待机置零 |
| | | private Integer gun_line_temperature; // 枪线温度,整形,偏移量-50;待机置零 |
| | | private String gun_line_code; // 枪线编码,没有置零 |
| | | private Integer soc; // SOC待机置零;交流桩置零 |
| | | private Integer battery_temperature; // 电池组最高温度,整形,偏移量-50 ºC;待机置零;交流桩置零 |
| | | private Integer cumulative_charging_time; // 累计充电时间,单位:min;待机置零 |
| | | private Integer time_remaining; // 剩余时间,单位:min;待机置零、交流桩置零 |
| | | private BigDecimal charging_degree; // 充电度数,精确到小数点后四位;待机置零 |
| | | private BigDecimal loss_of_charging_degree; // 计损充电度数,精确到小数点后四位;待机置零,未设置计损比例时等于充电度数 |
| | | private BigDecimal paid_amount; // 已充金额,精确到小数点后四位;待机置零(电费+服务费)*计损充电度数 |
| | | private Integer hardware_fault; // 硬件故障(1:急停按钮动作故障;2:无可用整流模块;3:出风口温度过高;4:交流防雷故障;5:交直流模块 DC20 通信中断;6:绝缘检测模块 FC08 通信中断;7:电度表通信中断;8:读卡器通信中断;9:RC10 通信中断;10:风扇调速板故障;11:直流熔断器故障;12:高压接触器故障;13:门打开) |
| | | |
| | | |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩工作参数设置 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "working_parameter_setting") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class WorkingParameterSetting { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer allow_work;// 是否允许工作(0:表示允许正常工作,1:表示停止使用,锁定充电桩) |
| | | private Integer maximum_output_power; // 充电桩最大允许输出功率 |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.model; |
| | | |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.data.mongodb.core.mapping.Document; |
| | | |
| | | /** |
| | | * 充电桩工作参数设置应答 |
| | | **/ |
| | | |
| | | @Data |
| | | @Document(collection = "working_parameter_setting_reply") //指定要对应的文档名(表名) |
| | | @Accessors(chain = true) |
| | | public class WorkingParameterSettingReply { |
| | | |
| | | private String charging_pile_code; //桩编码 |
| | | private Integer set_result; //设置结果(0:失败,1:成功) |
| | | } |
| | | |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | /** |
| | | * 登录认证应答接口 |
| | | */ |
| | | public interface OnlineReplyService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service; |
| | | |
| | | /** |
| | | * 充电桩登录认证接口 |
| | | */ |
| | | public interface OnlineService { |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.mongodb.service.OnlineReplyService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | /** |
| | | * 登录认证应答实现类 |
| | | **/ |
| | | @Service |
| | | public class OnlineReplyServiceImpl implements OnlineReplyService { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.mongodb.service.impl; |
| | | |
| | | import com.ruoyi.integration.mongodb.service.OnlineService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | /** |
| | | * 充电桩登录认证实现类 |
| | | **/ |
| | | @Service |
| | | public class OnlineServiceImpl implements OnlineService { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.base; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 消息实体,所有消息都需要继承此类 |
| | | */ |
| | | @Data |
| | | public abstract class BaseMessage { |
| | | /** |
| | | * 业务键,用于RocketMQ控制台查看消费情况 |
| | | */ |
| | | protected String key; |
| | | /** |
| | | * 发送消息来源,用于排查问题 |
| | | */ |
| | | protected String source = ""; |
| | | |
| | | /** |
| | | * 发送时间 |
| | | */ |
| | | protected LocalDateTime sendTime = LocalDateTime.now(); |
| | | |
| | | /** |
| | | * 重试次数,用于判断重试次数,超过重试次数发送异常警告 |
| | | */ |
| | | protected Integer retryTimes = 0; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.configuration; |
| | | |
| | | import org.apache.rocketmq.spring.support.DefaultRocketMQListenerContainer; |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.beans.factory.config.BeanPostProcessor; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | public class EnvironmentIsolationConfig implements BeanPostProcessor { |
| | | private RocketEnhanceProperties rocketEnhanceProperties; |
| | | |
| | | public EnvironmentIsolationConfig(RocketEnhanceProperties rocketEnhanceProperties) { |
| | | this.rocketEnhanceProperties = rocketEnhanceProperties; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 在装载Bean之前实现参数修改 |
| | | */ |
| | | @Override |
| | | public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { |
| | | if (bean instanceof DefaultRocketMQListenerContainer) { |
| | | |
| | | DefaultRocketMQListenerContainer container = (DefaultRocketMQListenerContainer) bean; |
| | | |
| | | if (rocketEnhanceProperties.isEnabledIsolation() && StringUtils.hasText(rocketEnhanceProperties.getEnvironment())) { |
| | | container.setTopic(String.join("_", container.getTopic(), rocketEnhanceProperties.getEnvironment())); |
| | | } |
| | | return container; |
| | | } |
| | | return bean; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.configuration; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | |
| | | @ConfigurationProperties(prefix = "rocketmq.enhance") |
| | | @Data |
| | | public class RocketEnhanceProperties { |
| | | |
| | | private boolean enabledIsolation; |
| | | |
| | | private String environment; |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.configuration; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate; |
| | | import org.apache.rocketmq.spring.core.RocketMQTemplate; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.messaging.converter.CompositeMessageConverter; |
| | | import org.springframework.messaging.converter.MappingJackson2MessageConverter; |
| | | import org.springframework.messaging.converter.MessageConverter; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Configuration |
| | | @EnableConfigurationProperties(RocketEnhanceProperties.class) |
| | | public class RocketMQEnhanceAutoConfiguration { |
| | | |
| | | /** |
| | | * 注入增强的RocketMQEnhanceTemplate |
| | | */ |
| | | @Bean |
| | | public RocketMQEnhanceTemplate rocketMQEnhanceTemplate(RocketMQTemplate rocketMQTemplate){ |
| | | return new RocketMQEnhanceTemplate(rocketMQTemplate); |
| | | } |
| | | |
| | | /** |
| | | * 解决RocketMQ Jackson不支持Java时间类型配置 |
| | | * 源码参考:{@link org.apache.rocketmq.spring.autoconfigure.MessageConverterConfiguration} |
| | | */ |
| | | @Bean |
| | | @Primary |
| | | public RocketMQMessageConverter enhanceRocketMQMessageConverter(){ |
| | | RocketMQMessageConverter converter = new RocketMQMessageConverter(); |
| | | CompositeMessageConverter compositeMessageConverter = (CompositeMessageConverter) converter.getMessageConverter(); |
| | | List<MessageConverter> messageConverterList = compositeMessageConverter.getConverters(); |
| | | for (MessageConverter messageConverter : messageConverterList) { |
| | | if(messageConverter instanceof MappingJackson2MessageConverter){ |
| | | MappingJackson2MessageConverter jackson2MessageConverter = (MappingJackson2MessageConverter) messageConverter; |
| | | ObjectMapper objectMapper = jackson2MessageConverter.getObjectMapper(); |
| | | objectMapper.registerModules(new JavaTimeModule()); |
| | | } |
| | | } |
| | | return converter; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 环境隔离配置 |
| | | */ |
| | | @Bean |
| | | @ConditionalOnProperty(name="rocketmq.enhance.enabledIsolation", havingValue="true") |
| | | public EnvironmentIsolationConfig environmentSetup(RocketEnhanceProperties rocketEnhanceProperties){ |
| | | return new EnvironmentIsolationConfig(rocketEnhanceProperties); |
| | | } |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.integration.rocket.configuration; |
| | | |
| | | import org.springframework.messaging.converter.*; |
| | | import org.springframework.util.ClassUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class RocketMQMessageConverter { |
| | | |
| | | private static final boolean JACKSON_PRESENT; |
| | | private static final boolean FASTJSON_PRESENT; |
| | | |
| | | static { |
| | | ClassLoader classLoader = RocketMQMessageConverter.class.getClassLoader(); |
| | | JACKSON_PRESENT = ClassUtils.isPresent("com.fasterxml.jackson,databind.ObjectMapper", classLoader) |
| | | && ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", classLoader); |
| | | FASTJSON_PRESENT = ClassUtils.isPresent("com.alibaba.fastjson.JSON", classLoader) |
| | | && ClassUtils.isPresent("com.alibaba.fastjson.support.config.FastJsonConfig", classLoader); |
| | | } |
| | | private final CompositeMessageConverter messageConverter; |
| | | |
| | | public RocketMQMessageConverter(){ |
| | | List<MessageConverter> messageConverters = new ArrayList<>(); |
| | | ByteArrayMessageConverter byteArrayMessageConverter = new ByteArrayMessageConverter(); |
| | | byteArrayMessageConverter.setContentTypeResolver(null); |
| | | messageConverters.add(byteArrayMessageConverter); |
| | | messageConverters.add(new StringMessageConverter()); |
| | | if (JACKSON_PRESENT) { |
| | | messageConverters.add(new MappingJackson2MessageConverter()); |
| | | } |
| | | if(FASTJSON_PRESENT) { |
| | | try { |
| | | messageConverters.add( |
| | | (MessageConverter) ClassUtils.forName( |
| | | "com.alibaba.fastjson.support.spring.messaging.MappingFastJsonMessageConverter", ClassUtils.getDefaultClassLoader()).newInstance()); |
| | | } catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) { |
| | | |
| | | } |
| | | } |
| | | messageConverter = new CompositeMessageConverter(messageConverters); |
| | | } |
| | | |
| | | public MessageConverter getMessageConverter(){ return messageConverter; } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.constant; |
| | | |
| | | public class EnhanceMessageConstant { |
| | | |
| | | /** |
| | | * 延时等级 |
| | | */ |
| | | public static final int FIVE_SECOND=5000; |
| | | /** |
| | | * 消息前缀 |
| | | */ |
| | | public static final String RETRY_PREFIX="retry_"; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.listener; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.ruoyi.integration.rocket.util.EnhanceMessageHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | import org.apache.rocketmq.spring.core.RocketMQListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | @RocketMQMessageListener( |
| | | consumerGroup = "enhance_consumer_group", |
| | | topic = "rocket_enhance", |
| | | selectorExpression = "*", |
| | | consumeThreadMax = 5 //默认是64个线程并发消息,配置 consumeThreadMax 参数指定并发消费线程数,避免太大导致资源不够 |
| | | ) |
| | | public class EnhanceMemberMessageListener extends EnhanceMessageHandler<MemberMessage> implements RocketMQListener<MemberMessage> { |
| | | |
| | | @Override |
| | | protected void handleMessage(MemberMessage message) throws Exception { |
| | | // 此时这里才是最终的业务处理,代码只需要处理资源类关闭异常,其他的可以交给父类重试 |
| | | System.out.println("业务消息处理:"+message.getUserName()); |
| | | } |
| | | |
| | | @Override |
| | | protected void handleMaxRetriesExceeded(MemberMessage message) { |
| | | // 当超过指定重试次数消息时此处方法会被调用 |
| | | // 生产中可以进行回退或其他业务操作 |
| | | log.error("消息消费失败,请执行后续处理"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否执行重试机制 |
| | | */ |
| | | @Override |
| | | protected boolean isRetry() { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | protected boolean throwException() { |
| | | // 是否抛出异常,false搭配retry自行处理异常 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 若需要处理消息过滤,在父级中进行统一处理,或者在此处实现之后,自行处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | @Override |
| | | protected boolean filter(MemberMessage message) { |
| | | // 此处可做消息过滤 |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 监听消费消息,不需要执行业务处理,委派给父类做基础操作,父类做完基础操作后会调用子类的实际处理类型 |
| | | */ |
| | | @Override |
| | | public void onMessage(MemberMessage memberMessage) { |
| | | super.dispatchMessage(memberMessage); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.produce; |
| | | |
| | | import com.ruoyi.integration.rocket.test.MemberMessage; |
| | | import com.ruoyi.integration.rocket.util.RocketMQEnhanceTemplate; |
| | | import lombok.Setter; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.UUID; |
| | | |
| | | @RestController |
| | | @RequestMapping("enhance") |
| | | @Slf4j |
| | | public class EnhanceProduceController { |
| | | |
| | | //注入增强后的模板,可以自动实现环境隔离,日志记录 |
| | | @Setter(onMethod_ = @Autowired) |
| | | private RocketMQEnhanceTemplate rocketMQEnhanceTemplate; |
| | | |
| | | private static final String topic = "rocket_enhance"; |
| | | private static final String tag = "member"; |
| | | |
| | | /** |
| | | * 发送实体消息 |
| | | */ |
| | | @GetMapping("/member") |
| | | public SendResult member() { |
| | | String key = UUID.randomUUID().toString(); |
| | | MemberMessage message = new MemberMessage(); |
| | | // 设置业务key |
| | | message.setKey(key); |
| | | // 设置消息来源,便于查询 |
| | | message.setSource("MEMBER"); |
| | | // 业务消息内容 |
| | | message.setUserName("Java日知录"); |
| | | message.setBirthday(LocalDate.now()); |
| | | |
| | | return rocketMQEnhanceTemplate.send(topic, tag, message); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.test; |
| | | |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | public class MemberMessage extends BaseMessage { |
| | | |
| | | private String userName; |
| | | private LocalDate birthday; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import com.ruoyi.integration.rocket.constant.EnhanceMessageConstant; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.apache.rocketmq.client.producer.SendStatus; |
| | | import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Slf4j |
| | | public abstract class EnhanceMessageHandler<T extends BaseMessage> { |
| | | /** |
| | | * 默认重试次数 |
| | | */ |
| | | private static final int MAX_RETRY_TIMES = 3; |
| | | |
| | | /** |
| | | * 延时等级 |
| | | */ |
| | | private static final int DELAY_LEVEL = EnhanceMessageConstant.FIVE_SECOND; |
| | | |
| | | |
| | | @Resource |
| | | private RocketMQEnhanceTemplate rocketMQEnhanceTemplate; |
| | | |
| | | /** |
| | | * 消息处理 |
| | | * |
| | | * @param message 待处理消息 |
| | | * @throws Exception 消费异常 |
| | | */ |
| | | protected abstract void handleMessage(T message) throws Exception; |
| | | |
| | | /** |
| | | * 超过重试次数消息,需要启用isRetry |
| | | * |
| | | * @param message 待处理消息 |
| | | */ |
| | | protected abstract void handleMaxRetriesExceeded(T message); |
| | | |
| | | |
| | | /** |
| | | * 是否需要根据业务规则过滤消息,去重逻辑可以在此处处理 |
| | | * @param message 待处理消息 |
| | | * @return true: 本次消息被过滤,false:不过滤 |
| | | */ |
| | | protected boolean filter(T message) { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 是否异常时重复发送 |
| | | * |
| | | * @return true: 消息重试,false:不重试 |
| | | */ |
| | | protected abstract boolean isRetry(); |
| | | |
| | | /** |
| | | * 消费异常时是否抛出异常 |
| | | * 返回true,则由rocketmq机制自动重试 |
| | | * false:消费异常(如果没有开启重试则消息会被自动ack) |
| | | */ |
| | | protected abstract boolean throwException(); |
| | | |
| | | /** |
| | | * 最大重试次数 |
| | | * |
| | | * @return 最大重试次数,默认5次 |
| | | */ |
| | | protected int getMaxRetryTimes() { |
| | | return MAX_RETRY_TIMES; |
| | | } |
| | | |
| | | /** |
| | | * isRetry开启时,重新入队延迟时间 |
| | | * @return -1:立即入队重试 |
| | | */ |
| | | protected int getDelayLevel() { |
| | | return DELAY_LEVEL; |
| | | } |
| | | |
| | | /** |
| | | * 使用模板模式构建消息消费框架,可自由扩展或删减 |
| | | */ |
| | | public void dispatchMessage(T message) { |
| | | // 基础日志记录被父类处理了 |
| | | log.info("消费者收到消息[{}]", JSONObject.toJSON(message)); |
| | | |
| | | if (filter(message)) { |
| | | log.info("消息id{}不满足消费条件,已过滤。",message.getKey()); |
| | | return; |
| | | } |
| | | // 超过最大重试次数时调用子类方法处理 |
| | | if (message.getRetryTimes() > getMaxRetryTimes()) { |
| | | handleMaxRetriesExceeded(message); |
| | | return; |
| | | } |
| | | try { |
| | | long now = System.currentTimeMillis(); |
| | | handleMessage(message); |
| | | long costTime = System.currentTimeMillis() - now; |
| | | log.info("消息{}消费成功,耗时[{}ms]", message.getKey(),costTime); |
| | | } catch (Exception e) { |
| | | log.error("消息{}消费异常", message.getKey(),e); |
| | | // 是捕获异常还是抛出,由子类决定 |
| | | if (throwException()) { |
| | | //抛出异常,由DefaultMessageListenerConcurrently类处理 |
| | | throw new RuntimeException(e); |
| | | } |
| | | //此时如果不开启重试机制,则默认ACK了 |
| | | if (isRetry()) { |
| | | handleRetry(message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | protected void handleRetry(T message) { |
| | | // 获取子类RocketMQMessageListener注解拿到topic和tag |
| | | RocketMQMessageListener annotation = this.getClass().getAnnotation(RocketMQMessageListener.class); |
| | | if (annotation == null) { |
| | | return; |
| | | } |
| | | //重新构建消息体 |
| | | String messageSource = message.getSource(); |
| | | if(!messageSource.startsWith(EnhanceMessageConstant.RETRY_PREFIX)){ |
| | | message.setSource(EnhanceMessageConstant.RETRY_PREFIX + messageSource); |
| | | } |
| | | message.setRetryTimes(message.getRetryTimes() + 1); |
| | | |
| | | SendResult sendResult; |
| | | |
| | | try { |
| | | // 如果消息发送不成功,则再次重新发送,如果发送异常则抛出由MQ再次处理(异常时不走延迟消息) |
| | | sendResult = rocketMQEnhanceTemplate.send(annotation.topic(), annotation.selectorExpression(), message, getDelayLevel()); |
| | | } catch (Exception ex) { |
| | | // 此处捕获之后,相当于此条消息被消息完成然后重新发送新的消息 |
| | | //由生产者直接发送 |
| | | throw new RuntimeException(ex); |
| | | } |
| | | // 发送失败的处理就是不进行ACK,由RocketMQ重试 |
| | | if (sendResult.getSendStatus() != SendStatus.SEND_OK) { |
| | | throw new RuntimeException("重试消息发送失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.integration.rocket.util; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.ruoyi.integration.rocket.base.BaseMessage; |
| | | import com.ruoyi.integration.rocket.configuration.RocketEnhanceProperties; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.rocketmq.client.producer.SendResult; |
| | | import org.apache.rocketmq.spring.core.RocketMQTemplate; |
| | | import org.apache.rocketmq.spring.support.RocketMQHeaders; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.messaging.Message; |
| | | import org.springframework.messaging.support.MessageBuilder; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | @Slf4j |
| | | @RequiredArgsConstructor(onConstructor = @__(@Autowired)) |
| | | public class RocketMQEnhanceTemplate { |
| | | private final RocketMQTemplate template; |
| | | |
| | | @Resource |
| | | private RocketEnhanceProperties rocketEnhanceProperties; |
| | | |
| | | public RocketMQTemplate getTemplate() { |
| | | return template; |
| | | } |
| | | |
| | | /** |
| | | * 根据系统上下文自动构建隔离后的topic |
| | | * 构建目的地 |
| | | */ |
| | | public String buildDestination(String topic, String tag) { |
| | | topic = reBuildTopic(topic); |
| | | return topic + ":" + tag; |
| | | } |
| | | |
| | | /** |
| | | * 根据环境重新隔离topic |
| | | * @param topic 原始topic |
| | | */ |
| | | private String reBuildTopic(String topic) { |
| | | if(rocketEnhanceProperties.isEnabledIsolation() && StringUtils.hasText(rocketEnhanceProperties.getEnvironment())){ |
| | | return topic +"_" + rocketEnhanceProperties.getEnvironment(); |
| | | } |
| | | return topic; |
| | | } |
| | | |
| | | /** |
| | | * 发送同步消息 |
| | | */ |
| | | public <T extends BaseMessage> SendResult send(String topic, String tag, T message) { |
| | | // 注意分隔符 |
| | | return send(buildDestination(topic,tag), message); |
| | | } |
| | | |
| | | |
| | | public <T extends BaseMessage> SendResult send(String destination, T message) { |
| | | // 设置业务键,此处根据公共的参数进行处理 |
| | | // 更多的其它基础业务处理... |
| | | Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build(); |
| | | SendResult sendResult = template.syncSend(destination, sendMessage); |
| | | // 此处为了方便查看给日志转了json,根据选择选择日志记录方式,例如ELK采集 |
| | | log.info("[{}]同步消息[{}]发送结果[{}]", destination, JSONObject.toJSON(message), JSONObject.toJSON(sendResult)); |
| | | return sendResult; |
| | | } |
| | | |
| | | /** |
| | | * 发送延迟消息 |
| | | */ |
| | | public <T extends BaseMessage> SendResult send(String topic, String tag, T message, int delayLevel) { |
| | | return send(buildDestination(topic,tag), message, delayLevel); |
| | | } |
| | | |
| | | public <T extends BaseMessage> SendResult send(String destination, T message, int delayLevel) { |
| | | Message<T> sendMessage = MessageBuilder.withPayload(message).setHeader(RocketMQHeaders.KEYS, message.getKey()).build(); |
| | | SendResult sendResult = template.syncSend(destination, sendMessage, 3000, delayLevel); |
| | | log.info("[{}]延迟等级[{}]消息[{}]发送结果[{}]", destination, delayLevel, JSONObject.toJSON(message), JSONObject.toJSON(sendResult)); |
| | | return sendResult; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/t-charging-order-accounting-strategy") |
| | | public class TChargingOrderAccountingStrategyController { |
| | | |
| | | @Resource |
| | | private TChargingOrderAccountingStrategyService chargingOrderAccountingStrategyService; |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数每天的充电量统计数据 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getTotalElectricQuantity/{days}") |
| | | public R<List<List<Map<String, Object>>>> getTotalElectricQuantity(@PathVariable Integer days, @RequestParam("siteIds") Set<Integer> siteIds){ |
| | | List<List<Map<String, Object>>> list = chargingOrderAccountingStrategyService.getTotalElectricQuantity(days, siteIds); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数每天的充电度数 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/getDailyChargingDegree/{days}") |
| | | public R<List<Double>> getDailyChargingDegree(@PathVariable Integer days, @RequestParam("siteIds") Set<Integer> siteIds){ |
| | | List<Double> list = chargingOrderAccountingStrategyService.getDailyChargingDegree(days, siteIds); |
| | | return R.ok(list); |
| | | } |
| | | } |
| | | |
| | |
| | | public R<TChargingOrder> detail(@RequestParam("orderId") Long orderId) { |
| | | return R.ok(chargingOrderService.getById(orderId)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据充电枪id获取正在进行中的订单 |
| | | * @param chargingGunId 充电枪id |
| | | * @return |
| | | */ |
| | | @GetMapping(value = "/getOrderDetailByGunId") |
| | | public R<TChargingOrder> getOrderDetailByGunId(@RequestParam("chargingGunId") Integer chargingGunId){ |
| | | TChargingOrder one = chargingOrderService.getOne(new LambdaQueryWrapper<TChargingOrder>().eq(TChargingOrder::getChargingGunId, chargingGunId) |
| | | .eq(TChargingOrder::getDelFlag, 0).eq(TChargingOrder::getStatus, 3)); |
| | | return R.ok(one); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @since 2024-08-07 |
| | | */ |
| | | public interface TChargingOrderAccountingStrategyService extends IService<TChargingOrderAccountingStrategy> { |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数范围内的充电量统计 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | List<List<Map<String, Object>>> getTotalElectricQuantity(Integer days, Set<Integer> siteIds); |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数每天的充电度数 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | List<Double> getDailyChargingDegree(Integer days, Set<Integer> siteIds); |
| | | } |
| | |
| | | package com.ruoyi.order.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.order.api.model.TChargingOrder; |
| | | import com.ruoyi.order.api.model.TChargingOrderAccountingStrategy; |
| | | import com.ruoyi.order.mapper.TChargingOrderAccountingStrategyMapper; |
| | | import com.ruoyi.order.service.TChargingOrderAccountingStrategyService; |
| | | import com.ruoyi.order.service.TChargingOrderService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Duration; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.LongStream; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TChargingOrderAccountingStrategyServiceImpl extends ServiceImpl<TChargingOrderAccountingStrategyMapper, TChargingOrderAccountingStrategy> implements TChargingOrderAccountingStrategyService { |
| | | |
| | | |
| | | @Resource |
| | | private TChargingOrderService chargingOrderService; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数范围内的充电量统计 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<List<Map<String, Object>>> getTotalElectricQuantity(Integer days, Set<Integer> siteIds) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - days); |
| | | String startTime = sdf.format(calendar.getTime()) + " 00:00:00"; |
| | | List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>().in(TChargingOrder::getSiteId, siteIds).eq(TChargingOrder::getStatus, 5) |
| | | .eq(TChargingOrder::getDelFlag, 0).last(" and end_time between '" + startTime + "' and DATE_FORMAT('%Y-%m-%d %H:%i:%s', now())")); |
| | | List<Long> orderId = list.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | List<TChargingOrderAccountingStrategy> list1 = this.list(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().in(TChargingOrderAccountingStrategy::getChargingOrderId, orderId)); |
| | | |
| | | List<List<Map<String, Object>>> list2 = new ArrayList<>(); |
| | | Calendar nowDateTime = Calendar.getInstance(); |
| | | for (int i = days; i >= 0; i--) { |
| | | nowDateTime.set(Calendar.DAY_OF_YEAR, nowDateTime.get(Calendar.DAY_OF_YEAR) - i); |
| | | List<TChargingOrder> collect = list.stream().filter(s -> sdf.format(s.getEndTime()).equals(sdf.format(nowDateTime.getTime()))).collect(Collectors.toList()); |
| | | List<Long> orderIds = collect.stream().map(TChargingOrder::getId).collect(Collectors.toList()); |
| | | |
| | | |
| | | List<Map<String, Object>> datas = new ArrayList<>(); |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("name", "尖"); |
| | | BigDecimal value1 = list1.stream().filter(s -> orderIds.contains(s.getChargingOrderId()) && s.getType() == 1) |
| | | .map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map1.put("value", value1.setScale(2, RoundingMode.HALF_EVEN)); |
| | | datas.add(map1); |
| | | |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("name", "峰"); |
| | | BigDecimal value2 = list1.stream().filter(s -> orderIds.contains(s.getChargingOrderId()) && s.getType() == 2) |
| | | .map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map1.put("value", value2.setScale(2, RoundingMode.HALF_EVEN)); |
| | | datas.add(map2); |
| | | |
| | | Map<String, Object> map3 = new HashMap<>(); |
| | | map3.put("name", "平"); |
| | | BigDecimal value3 = list1.stream().filter(s -> orderIds.contains(s.getChargingOrderId()) && s.getType() == 3) |
| | | .map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map1.put("value", value3.setScale(2, RoundingMode.HALF_EVEN)); |
| | | datas.add(map3); |
| | | |
| | | Map<String, Object> map4 = new HashMap<>(); |
| | | map4.put("name", "谷"); |
| | | BigDecimal value4 = list1.stream().filter(s -> orderIds.contains(s.getChargingOrderId()) && s.getType() == 4) |
| | | .map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | map1.put("value", value4.setScale(2, RoundingMode.HALF_EVEN)); |
| | | datas.add(map4); |
| | | list2.add(datas); |
| | | } |
| | | return list2; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取给定天数每天的充电度数 |
| | | * @param days 天数 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Double> getDailyChargingDegree(Integer days, Set<Integer> siteIds) { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) - days); |
| | | String startTime = sdf.format(calendar.getTime()) + " 00:00:00"; |
| | | List<TChargingOrder> list = chargingOrderService.list(new LambdaQueryWrapper<TChargingOrder>().in(TChargingOrder::getSiteId, siteIds).eq(TChargingOrder::getStatus, 5) |
| | | .eq(TChargingOrder::getDelFlag, 0).last(" and end_time between '" + startTime + "' and DATE_FORMAT('%Y-%m-%d %H:%i:%s', now())")); |
| | | |
| | | List<Double> list2 = new ArrayList<>(); |
| | | Calendar nowDateTime = Calendar.getInstance(); |
| | | //遍历获取每天的数值 |
| | | for (int i = days; i >= 0; i--) { |
| | | nowDateTime.set(Calendar.DAY_OF_YEAR, nowDateTime.get(Calendar.DAY_OF_YEAR) - i); |
| | | //充电量 |
| | | BigDecimal reduce = list.stream().filter(s -> sdf.format(s.getEndTime()).equals(sdf.format(nowDateTime.getTime()))) |
| | | .map(TChargingOrder::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | list2.add(reduce.doubleValue()); |
| | | } |
| | | return list2; |
| | | } |
| | | } |
| | |
| | | <result column="parking_lot_id" property="parkingLotId" /> |
| | | <result column="charging_pile_id" property="chargingPileId" /> |
| | | <result column="charging_gun_id" property="chargingGunId" /> |
| | | <result column="charging_capacity" property="chargingCapacity"/> |
| | | <result column="charging_power" property="chargingPower"/> |
| | | <result column="start_time" property="startTime" /> |
| | | <result column="end_time" property="endTime" /> |
| | | <result column="status" property="status" /> |