From bc07473d29ec7f8de64cbd38ee0668668c5d1b4d Mon Sep 17 00:00:00 2001 From: wen <1455474577@qq.com> Date: Mon, 29 Nov 2021 09:34:22 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xhpc-charging-station/src/main/resources/bootstrap.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml index 5a7a4521..7071cc93 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml @@ -24,7 +24,6 @@ spring: shared-configs: - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} - #二维码Logo图片获取位置: #imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\xhcd_logo.png" imgPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/logo.png" From ed876cdb1fe08bb75dda00d325d79d331d49cc60 Mon Sep 17 00:00:00 2001 From: wen <1455474577@qq.com> Date: Mon, 29 Nov 2021 09:55:10 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=AD=A3=E5=BC=8F=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/bootstrap.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml index 7071cc93..bb5f3399 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-charging-station/src/main/resources/bootstrap.yml @@ -26,16 +26,16 @@ spring: #二维码Logo图片获取位置: #imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\xhcd_logo.png" -imgPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/logo.png" +imgPath: "/www/wwwroot/www.scxhua.cn/xhpc-charging-stion/logo.png" #生成的二维码存放位置: #destPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs" -destPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs" +destPath: "/www/wwwroot/www.scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs" #生成的最终完整图片的存放位置: #fullImgDestPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs\\" -fullImgDestPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs/" +fullImgDestPath: "/www/wwwroot/www.scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs/" #底图图片存放位置: #bottomImg: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\BottomImg.png" -bottomImg: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/BottomImg.png" +bottomImg: "/www/wwwroot/www.scxhua.cn/xhpc-charging-stion/BottomImg.png" #生成的二维码zip包位置 #zipLocation: "D:\\Enterprise_Resources\\QrZip" -zipLocation: "/www/wwwroot/xhpc.scxhua.com/dist" \ No newline at end of file +zipLocation: "/www/wwwroot/www.scxhua.cn/dist" \ No newline at end of file From 77f99d897d6e9e53ca6ca7aae97a5781114bc177 Mon Sep 17 00:00:00 2001 From: wen <1455474577@qq.com> Date: Mon, 29 Nov 2021 18:28:26 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=EF=BC=8C=E5=86=99=E4=BA=86=E4=B8=89=E4=B8=AAMapper=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../general/controller/XhpcSmsController.java | 10 ++++- .../xhpc/general/mapper/XhpcSmsMapper.java | 33 ++++++++++++++- .../xhpc/general/service/IXhpcSmsService.java | 11 +++++ .../general/service/XhpcSmsServiceImpl.java | 42 +++++++++---------- .../main/resources/mapper/XhpcSmsMapper.xml | 27 +++++++++++- 5 files changed, 97 insertions(+), 26 deletions(-) diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java index 5d09fe6f..948e30fe 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java @@ -25,7 +25,7 @@ public class XhpcSmsController extends BaseController { * 注册获取手机号验证码 */ @GetMapping(value = "/getLogonPhoneCode") - public AjaxResult getLogonPhoneCode(@RequestParam("phone") String phone) throws Exception { + public AjaxResult getLogonPhoneCode(@RequestParam("phone") String phone) { String signatureName = null; String templateId = null; @@ -75,4 +75,12 @@ public class XhpcSmsController extends BaseController { xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap); } + + @GetMapping(value = "/getAliyunShortMessageInfo") + public AjaxResult getAliyunShortMessageInfo() { + + Object messageInfo = xhpcSmsService.getAliyunShortMessageInfo(); + return AjaxResult.success(); + } + } diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/mapper/XhpcSmsMapper.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/mapper/XhpcSmsMapper.java index 2fe05bde..3cfc434b 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/mapper/XhpcSmsMapper.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/mapper/XhpcSmsMapper.java @@ -14,6 +14,37 @@ public interface XhpcSmsMapper { int addXhpcSms(XhpcSms xhpcSms); + List> getList(@Param("status") Integer status, @Param("phone") String phone); + + /** + * 查询阿里云中发送失败的短信条数 + * + * @return 返回发送失败的条数 + * @author WH + * @date 2021/11/29 14:11 + * @since version-1.0 + */ + Long querySumOfFailMessage(); + + /** + * 查询阿里云中的发送成功的短信条数 + * + * @return 发送成功的短信的条数 + * @author WH + * @date 2021/11/29 + * @since version-1.0 + */ + Long querySumOfSuccessMessage(); + + /** + * 查询发送的短信的总记录数 + * + * @return 返回发送过的短信的总记录数 + * @author WH + * @date 2021/11/29 14:25 + * @since version-1.0 + */ + Long querySumOfMessage(); + - List> getList(@Param("status") Integer status,@Param("phone") String phone); } diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcSmsService.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcSmsService.java index 5f92e39f..9b6c2abd 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcSmsService.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcSmsService.java @@ -46,4 +46,15 @@ public interface IXhpcSmsService { * @param paramMap 模板中的参数 */ void sendNotice(String phone, String signatureName, String templateId, Map paramMap); + + /** + * 获取阿里云短信服务信息 + * + * @return 一个装有阿里云短信信息的对象 + * @author WH + * @date 2021/11/29 10:31 + * @since version-1.0 + */ + Object getAliyunShortMessageInfo(); + } diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java index 06d7e023..3466f71c 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java @@ -10,11 +10,11 @@ import com.xhpc.common.redis.service.RedisService; import com.xhpc.general.domain.XhpcSms; import com.xhpc.general.mapper.XhpcSmsMapper; import com.xhpc.general.util.sms.SmsUtil; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; -import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; @@ -24,6 +24,7 @@ import java.util.regex.Pattern; * @author yuyang * @date 2021/7/30 18:50 */ +@Slf4j @Service public class XhpcSmsServiceImpl implements IXhpcSmsService { @@ -78,12 +79,20 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService { //用户频繁调用的判断的Key String token = "token:" + phone; String cacheObject = REDIS.getCacheObject(token); + System.out.println("过了redis"); if (cacheObject != null) { return AjaxResult.error("1012", "操作过于频繁,请于1分钟后重试"); } //使用阿里云发送通知短信 - Map neededParam = aliyunSmsNotice(phone, signatureName, templateId, paramMap); + Map neededParam = null; + try { + neededParam = aliyunSmsNotice(phone, signatureName, templateId, paramMap); + } catch (Exception e) { + System.out.println(e.getMessage()); + throw new RuntimeException("阿里短信服务异常,neededParam为null"); + } + System.out.println("过了阿里云"); if (!"".equals(random) && random != null) { xhpcSms.setCode(random); @@ -155,6 +164,12 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService { xhpcSmsMapper.addXhpcSms(xhpcSms); } + @Override + public Object getAliyunShortMessageInfo() { + //todo + return null; + } + public static void main(String[] args) { for (int i = 0; i < 50; i++) { @@ -191,39 +206,20 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService { String templateParam = JSONUtil.toJsonStr(paramMap); sendSmsRequest.setTemplateParam(templateParam); SendSmsResponse sendSmsResponse = client.sendSms(sendSmsRequest); - //获取发送结果状态码 String statusCode = sendSmsResponse.getBody().getCode(); - //获取短信的Biz号 - //String bizId = sendSmsResponse.getBody().getBizId(); - //获取短信的发送日期,并将其转换为yyyyMMdd的格式 - //String date = sendSmsResponse.getHeaders().get("date"); - //Date realDate = new Date(date); - //SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); - //String formatData = sdf.format(realDate); - //获取实际的模板内容 String templateContent = getTemplateContent(templateId, paramMap); - -// //获取所发送的模板信息 -// QuerySendDetailsRequest querySendDetailsRequest = new QuerySendDetailsRequest(); -// querySendDetailsRequest.setPhoneNumber(phone); -// querySendDetailsRequest.setBizId(bizId); -// querySendDetailsRequest.setSendDate(formatData); -// querySendDetailsRequest.setCurrentPage(1L); -// querySendDetailsRequest.setPageSize(10L); -// Thread.sleep(400); -// String templateContent = client.querySendDetails(querySendDetailsRequest).getBody().getSmsSendDetailDTOs().getSmsSendDetailDTO().get(0).getContent(); - //获取阿里云的返回值json字符串 SendSmsResponseBody body = sendSmsResponse.getBody(); String jsonResult = JSONUtil.toJsonStr(body); - + System.out.println("阿里云返回值的json字符串=============》" + jsonResult); //存放后面需要使用的返回值 HashMap valueParam = new HashMap<>(); valueParam.put("statusCode", statusCode); valueParam.put("templateContent", templateContent); valueParam.put("jsonResult", jsonResult); + System.out.println(("valueParam的值===========》" + valueParam)); return valueParam; } diff --git a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcSmsMapper.xml b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcSmsMapper.xml index c703459c..a3e3902c 100644 --- a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcSmsMapper.xml +++ b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcSmsMapper.xml @@ -98,7 +98,7 @@ phone, content, status, - create_time as createTime + create_time as createTime from xhpc_sms where del_flag=0 @@ -108,4 +108,29 @@ and phone like concat('%',#{phone},'%') + + + + + + + From 7396b5b4fd2479bcb5321641277cfc6c16a994c8 Mon Sep 17 00:00:00 2001 From: ZZ Date: Mon, 29 Nov 2021 11:22:50 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E8=B4=B9=E7=8E=87=E7=94=A8=E8=BF=87?= =?UTF-8?q?=E5=B0=B1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/XhpcChargeOrderMapper.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml index 2de4113c..0592ccf4 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml +++ b/xhpc-modules/xhpc-order/src/main/resources/mapper/XhpcChargeOrderMapper.xml @@ -470,7 +470,9 @@ + + insert into xhpc_charging_station diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcChargingPile.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcChargingPile.java index d9a21842..4caa7ffb 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcChargingPile.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/domain/XhpcChargingPile.java @@ -1,5 +1,6 @@ package com.xhpc.common.domain; +import com.xhpc.common.core.annotation.Excel; import com.xhpc.common.core.web.domain.BaseEntity; /** @@ -15,41 +16,66 @@ public class XhpcChargingPile extends BaseEntity { private Long chargingPileId; /** 场站id */ private Long chargingStationId; + + /** 场站名称 */ + @Excel(name = "电站", cellType = Excel.ColumnType.STRING) + private String chargingStationName; /** 名称 */ + @Excel(name = "电桩名称(号桩 )", cellType = Excel.ColumnType.STRING) private String name; /** 品牌型号 */ + @Excel(name = "品牌型号", cellType = Excel.ColumnType.STRING) private String brandModel; /** 国标 */ + @Excel(name = "电桩国际", cellType = Excel.ColumnType.STRING) private String nationalStandard; /** 功率 */ + @Excel(name = "电桩功率(KW)", cellType = Excel.ColumnType.STRING) private Double power; /** 辅助电源支持 */ + @Excel(name = "辅助电源支持(V)", cellType = Excel.ColumnType.STRING) private Double auxiliaryPowerSupply; /** 输入电压 */ + @Excel(name = "输入电压(V)", cellType = Excel.ColumnType.STRING) private Double inputVoltage; /** 最大电压 */ + @Excel(name = "最大电压(V)", cellType = Excel.ColumnType.STRING) private Double maxVoltage; /** 最小电压 */ + @Excel(name = "最小电压(V)", cellType = Excel.ColumnType.STRING) private Double minVoltage; /** 最大电流 */ + @Excel(name = "最大电流(A)", cellType = Excel.ColumnType.STRING) private Double maxElectricCurrent; /** 最小电流 */ + @Excel(name = "最小电流(A)", cellType = Excel.ColumnType.STRING) private Double minElectriCurrent; /** 桩编号 */ + @Excel(name = "桩编码", cellType = Excel.ColumnType.STRING) private String serialNumber; /** 桩类型 */ private Integer type; + + @Excel(name = "电桩类型", type= Excel.Type.IMPORT) + private String typeName; + /** 程序版本 */ + @Excel(name = "程序版本", cellType = Excel.ColumnType.STRING) private String programVersion; /** 网络链接类型 */ + @Excel(name = "网络连接类型", cellType = Excel.ColumnType.STRING) private String networkLinkType; /** 终端数量 */ + @Excel(name = "终端数量", cellType = Excel.ColumnType.STRING) private Integer gunNumber; /** 通讯协议版本 */ + @Excel(name = "通讯协议版本", cellType = Excel.ColumnType.STRING) private String communicationProtocolVersion; /** 通讯运营商 */ + @Excel(name = "通讯运营商", cellType = Excel.ColumnType.STRING) private String communicationOperator; /** Sim卡 */ + @Excel(name = "SIMK", cellType = Excel.ColumnType.STRING) private String simCard; /** 状态(0正常 1停用) */ private Integer status; @@ -60,11 +86,13 @@ public class XhpcChargingPile extends BaseEntity { /** * 设备生产日期(格式YYYY-MM-DD) */ + @Excel(name = "设备生产日期", cellType = Excel.ColumnType.STRING) private String productionDate; /** * 设备生产商名称 */ + @Excel(name = "设备生产商名称", cellType = Excel.ColumnType.STRING) private String manufactureName; /** @@ -72,9 +100,16 @@ public class XhpcChargingPile extends BaseEntity { */ private Integer connectorType; + + /** + * 充电设备接口类型,导入Excel使用 + */ + @Excel(name = "充电设备类型", cellType = Excel.ColumnType.STRING) + private String connectorTypeName; /** * 额定电流(单位A) */ + @Excel(name = "额定电流(A)", cellType = Excel.ColumnType.STRING) private Integer current; /** @@ -82,13 +117,47 @@ public class XhpcChargingPile extends BaseEntity { */ private Integer equipmentType; - public Integer getEquipmentType() { + /** + * 设备类型,导入Excel使用 + */ + @Excel(name = "设备类型", cellType = Excel.ColumnType.STRING, type = Excel.Type.IMPORT) + private String equipmentTypeName; + public String getTypeName() { + + return typeName; + } + + public void setTypeName(String typeName) { + + this.typeName = typeName; + } + + public String getConnectorTypeName() { + + return connectorTypeName; + } + + public void setConnectorTypeName(String connectorTypeName) { + + this.connectorTypeName = connectorTypeName; + } + + public String getEquipmentTypeName() { + + return equipmentTypeName; + } + + public void setEquipmentTypeName(String equipmentTypeName) { + + this.equipmentTypeName = equipmentTypeName; + } + + public Integer getEquipmentType() { return equipmentType; } public void setEquipmentType(Integer equipmentType) { - this.equipmentType = equipmentType; } @@ -362,4 +431,14 @@ public class XhpcChargingPile extends BaseEntity { this.brandModel = brandModel; } + public String getChargingStationName() { + + return chargingStationName; + } + + public void setChargingStationName(String chargingStationName) { + + this.chargingStationName = chargingStationName; + } + } diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/enums/ConnectorTypeEnum.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/enums/ConnectorTypeEnum.java new file mode 100644 index 00000000..91ed6118 --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/enums/ConnectorTypeEnum.java @@ -0,0 +1,67 @@ +package com.xhpc.common.enums; + + +/** + * 充电设备类型 + */ +public enum ConnectorTypeEnum { + + // connectorTypeList: [ +// { dictLabel: "", value: 1 }, +// { dictLabel: "", value: 2 }, +// { dictLabel: "", value: 3 }, +// { dictLabel: "", value: 4 }, +// { dictLabel: "", value: 5 }, +// { dictLabel: "", value: 6 } +// ], + + + HOME_OUTLET(1, "家用插座"), + AC_OUTLET(2, "交流接口插座"), + AC_PLUG(3, "交流接口插头"), + DC_PLUG(4, "直流接口枪头"), + WIRELESS_OUTLET(5, "无线充电座"), + OTHER(6, "其他"), + ; + + private final int code; + private final String name; + + ConnectorTypeEnum(int code, String name){ + this.code = code; + this.name = name; + } + + //根据code获取name + public static String getNameByCode(int code) { + for (ConnectorTypeEnum typeEnum : ConnectorTypeEnum.values()) { + //移除交办 + if (typeEnum.code == code) { + return typeEnum.name; + } + } + return ""; + } + + //根据code获取name + public static Integer getCodeByName(String name) { + for (ConnectorTypeEnum typeEnum : ConnectorTypeEnum.values()) { + //移除交办 + if (typeEnum.name.equals(name)) { + return typeEnum.code; + } + } + return null; + } + + public int getCode() { + + return code; + } + + public String getName() { + + return name; + } + +} diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/enums/EquipmentTypeEnum.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/enums/EquipmentTypeEnum.java new file mode 100644 index 00000000..42500e8b --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/enums/EquipmentTypeEnum.java @@ -0,0 +1,63 @@ +package com.xhpc.common.enums; + + +/** + * 设备类型 + */ +public enum EquipmentTypeEnum { + + // equipmentTypeList: [ +// { dictLabel: "", value: 1 }, +// { dictLabel: "", value: 2 }, +// { dictLabel: "", value: 3 }, +// { dictLabel: "", value: 4 }, +// { dictLabel: "", value: 5 } +// ], + + DC(1, "直流设备"), + AC(2, "交流设备"), + DC_AC(3, "交直流一体设备"), + WIRELESS(4, "无线设备"), + OTHER(5, "其他"), + ; + + private final int code; + private final String name; + + EquipmentTypeEnum(int code, String name){ + this.code = code; + this.name = name; + } + + //根据code获取name + public static String getNameByCode(int code) { + for (EquipmentTypeEnum typeEnum : EquipmentTypeEnum.values()) { + //移除交办 + if (typeEnum.code == code) { + return typeEnum.name; + } + } + return ""; + } + + //根据code获取name + public static Integer getCodeByName(String name) { + for (EquipmentTypeEnum typeEnum : EquipmentTypeEnum.values()) { + //移除交办 + if (typeEnum.name.equals(name)) { + return typeEnum.code; + } + } + return null; + } + + public int getCode() { + + return code; + } + + public String getName() { + + return name; + } +} diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/enums/PowerTypeEnum.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/enums/PowerTypeEnum.java new file mode 100644 index 00000000..09dca821 --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/common/enums/PowerTypeEnum.java @@ -0,0 +1,51 @@ +package com.xhpc.common.enums; + +/** + * 电桩类型 + */ +public enum PowerTypeEnum { + + DC(1, "直流"), + AC(2, "交流"), + ; + + private final int code; + private final String name; + + PowerTypeEnum(int code, String name){ + this.code = code; + this.name = name; + } + + //根据code获取name + public static String getNameByCode(int code) { + for (PowerTypeEnum typeEnum : PowerTypeEnum.values()) { + //移除交办 + if (typeEnum.code == code) { + return typeEnum.name; + } + } + return ""; + } + + //根据code获取name + public static Integer getCodeByName(String name) { + for (PowerTypeEnum typeEnum : PowerTypeEnum.values()) { + //移除交办 + if (typeEnum.name.equals(name)) { + return typeEnum.code; + } + } + return null; + } + + public int getCode() { + + return code; + } + + public String getName() { + + return name; + } +} From 0b771ef87ca3bbc3dbd6c772e9a331d82561b1d7 Mon Sep 17 00:00:00 2001 From: ZZ Date: Mon, 29 Nov 2021 14:13:13 +0800 Subject: [PATCH 06/12] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83nacos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml index 82582f47..dde4d751 100644 --- a/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml +++ b/xhpc-modules/xhpc-order/src/main/resources/bootstrap.yml @@ -14,10 +14,10 @@ spring: nacos: discovery: # 服务注册地址 - server-addr: 118.24.137.203:8848 + server-addr: 172.31.183.135:8848 config: # 配置中心地址 - server-addr: 118.24.137.203:8848 + server-addr: 172.31.183.135:8848 # 配置文件格式 file-extension: yml # 共享配置 From afa483fdb3009e72c490625bf1d4e8df0aec4a1a Mon Sep 17 00:00:00 2001 From: ZZ Date: Mon, 29 Nov 2021 15:09:39 +0800 Subject: [PATCH 07/12] =?UTF-8?q?1=E5=88=86=E9=92=9F=E5=86=85=E4=B8=8B?= =?UTF-8?q?=E5=8F=91=E6=96=B0=E8=B4=B9=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xhpc/pp/server/RateModelTask.java | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/RateModelTask.java diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/RateModelTask.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/RateModelTask.java new file mode 100644 index 00000000..7a7f9349 --- /dev/null +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/RateModelTask.java @@ -0,0 +1,61 @@ +package com.xhpc.pp.server; + +import com.xhpc.common.api.dto.ChargingStationDto; +import com.xhpc.pp.logic.RateModelRequestLogic; +import com.xhpc.pp.utils.HexUtils; +import lombok.extern.slf4j.Slf4j; +import org.quickserver.net.server.ClientHandler; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.Collection; +import java.util.Set; + +import static cn.hutool.core.util.NumberUtil.isInteger; +import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS; +import static com.xhpc.pp.server.ChargingPileServer.getHandler; + +@Slf4j +@Component +public class RateModelTask { + + @Scheduled(fixedRate = 60000) + protected void run() { + + Collection stationKeys = REDIS.keys("station:*"); + for (String stationKey : stationKeys) { + ChargingStationDto stationDto = REDIS.getCacheObject(stationKey); + Long rateModelIdStation = stationDto.getRateModelId(); + if (rateModelIdStation != null) { + Set pks = stationDto.getPiles(); + if (pks != null) for (String pk : pks) { + Long rateModelIdPile = REDIS.getCacheMapValue(pk, "rateModelId"); + if (rateModelIdPile == null || !rateModelIdStation.equals(rateModelIdPile)) { + String gkPattern = ("gun:").concat(pk).concat("*"); + Collection gks = REDIS.keys(gkPattern); + boolean charging = false; + for (String gk : gks) { + if (isInteger(REDIS.getCacheMapValue(gk, "status"))) { + charging = true; + break; + } + } + if (!charging) { + ClientHandler handler = getHandler(pk.substring(5)); + if (handler != null && handler.isOpen()) { + String rsmsg = RateModelRequestLogic.translate(pk.substring(5), rateModelIdStation, "0058"); + try { + handler.sendClientBinary(HexUtils.toBytes(rsmsg)); + } catch (IOException e) { + log.error("{} rate model not sent.", pk); + } + } + } + } + } + } + } + } + +} From 26911576aaee9b49d80fb5c972d701bc40e590da Mon Sep 17 00:00:00 2001 From: panshulin Date: Mon, 29 Nov 2021 16:10:50 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E7=94=B5=E6=A1=A9=E6=8E=A5=E5=8F=A3=E7=9A=84=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../station/controller/XhpcChargingPileController.java | 2 +- .../station/service/XhpcChargingStationServiceImpl.java | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java index 47eb5d4c..f8879ae8 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/controller/XhpcChargingPileController.java @@ -112,7 +112,7 @@ public class XhpcChargingPileController extends BaseController { * @return * @throws Exception */ - @PostMapping("/import") + @PostMapping("/importData") public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { ExcelUtil util = new ExcelUtil(XhpcChargingPile.class); List pileList = util.importExcel(file.getInputStream()); diff --git a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java index 2453df16..d0674788 100644 --- a/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java +++ b/xhpc-modules/xhpc-charging-station/src/main/java/com/xhpc/charging/station/service/XhpcChargingStationServiceImpl.java @@ -1144,11 +1144,14 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi for (String st:terminal) { Map cacheMap = redisService.getCacheMap("gun:" + st); if(!cacheMap.isEmpty()){ - if ("离线".equals(cacheMap.get("status").toString())){ + if (cacheMap.containsKey("status") && + "离线".equals(cacheMap.get("status").toString())){ offLine++; - }else if("故障".equals(cacheMap.get("status").toString())){ + }else if(cacheMap.containsKey("status") && + "故障".equals(cacheMap.get("status").toString())){ fault++; - }else if("空闲".equals(cacheMap.get("status").toString())){ + }else if(cacheMap.containsKey("status") && + "空闲".equals(cacheMap.get("status").toString())){ freeTime++; }else{ charge++; From 39de732990838ac3f008494bbf918a7a786549f7 Mon Sep 17 00:00:00 2001 From: "2265829957@qq.com" Date: Mon, 29 Nov 2021 17:44:07 +0800 Subject: [PATCH 09/12] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/XhpcStatisticsController.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java index 30bf2ec3..154bbc13 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/controller/XhpcStatisticsController.java @@ -206,6 +206,22 @@ public class XhpcStatisticsController extends BaseController { return xhpcStatisticsService.getTerminalList(chargingStationId, userId, type); } + /** + * 订单来源(第三方、支付宝、微信、运营商),权限划分 + * @param chargingStationId 电站id + * @param userId 用户id + * @param type 1 平台 2 运营商 3流量方 + * @return + */ + @GetMapping("/getSourceList") + public AjaxResult getSourceList(Long chargingStationId, @RequestParam("userId") Long userId, @RequestParam("type") Integer type) { + if (type == null || type == 3) { + return AjaxResult.success(); + } + return xhpcStatisticsService.getTerminalList(chargingStationId, userId, type); + } + + // -------- 导出数据 ------------ From 068d9d8bcb34311a2faced2926abde1b34434eec Mon Sep 17 00:00:00 2001 From: wen <1455474577@qq.com> Date: Tue, 30 Nov 2021 14:28:45 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=98=BF=E9=87=8C?= =?UTF-8?q?=E4=BA=91=E7=9F=AD=E4=BF=A1=E6=9C=8D=E5=8A=A1=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xhpc/general/controller/XhpcSmsController.java | 5 +---- .../java/com/xhpc/general/mapper/XhpcSmsMapper.java | 2 +- .../com/xhpc/general/service/XhpcSmsServiceImpl.java | 11 +++++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java index 948e30fe..5b902214 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcSmsController.java @@ -75,12 +75,9 @@ public class XhpcSmsController extends BaseController { xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap); } - @GetMapping(value = "/getAliyunShortMessageInfo") public AjaxResult getAliyunShortMessageInfo() { - Object messageInfo = xhpcSmsService.getAliyunShortMessageInfo(); - return AjaxResult.success(); + return AjaxResult.success(messageInfo); } - } diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/mapper/XhpcSmsMapper.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/mapper/XhpcSmsMapper.java index 3cfc434b..f427cb9a 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/mapper/XhpcSmsMapper.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/mapper/XhpcSmsMapper.java @@ -37,7 +37,7 @@ public interface XhpcSmsMapper { Long querySumOfSuccessMessage(); /** - * 查询发送的短信的总记录数 + * 查询所有发送的短信的总记录数(包括异常,失败) * * @return 返回发送过的短信的总记录数 * @author WH diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java index 3466f71c..3747f628 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java @@ -166,8 +166,15 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService { @Override public Object getAliyunShortMessageInfo() { - //todo - return null; + + Long successMessage = xhpcSmsMapper.querySumOfSuccessMessage(); + Long failMessage = xhpcSmsMapper.querySumOfFailMessage(); + Long sumOfMessage = successMessage + failMessage; + Map messageInfoMap = new HashMap<>(); + messageInfoMap.put("successMessage", successMessage); + messageInfoMap.put("failMessage", failMessage); + messageInfoMap.put("sumOfMessage", sumOfMessage); + return messageInfoMap; } public static void main(String[] args) { From db0b2d1685c43ddeac849a42c30c1270255592a5 Mon Sep 17 00:00:00 2001 From: wen <1455474577@qq.com> Date: Tue, 30 Nov 2021 14:50:41 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9soc=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E4=BA=86=E9=98=BF=E9=87=8C=E4=BA=91?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E6=80=BB=E6=95=B0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XhpcServiceDataUpdateController.java | 4 ++-- .../IXhpcServiceDataUpdateService.java | 20 +++++++++++++++++-- .../XhpcServiceDataUpdateServiceImpl.java | 20 ++++++++++++------- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcServiceDataUpdateController.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcServiceDataUpdateController.java index 9a3daf03..80703e03 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcServiceDataUpdateController.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/controller/XhpcServiceDataUpdateController.java @@ -24,8 +24,8 @@ public class XhpcServiceDataUpdateController { } @PostMapping("/update") - public AjaxResult update(@RequestParam(required = false) String SOC, @RequestParam(required = false) String version, @RequestParam(required = false) String phone){ + public AjaxResult update(@RequestParam(required = false) String SOC, @RequestParam(required = false) String version, @RequestParam(required = false) String phone, @RequestParam(required = false) String aliyunMessageCount) { - return xhpcServiceDataUpdateService.update(SOC, version, phone); + return xhpcServiceDataUpdateService.update(SOC, version, phone, aliyunMessageCount); } } diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcServiceDataUpdateService.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcServiceDataUpdateService.java index a9510c71..bd8707e6 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcServiceDataUpdateService.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcServiceDataUpdateService.java @@ -11,9 +11,25 @@ import java.util.Map; */ public interface IXhpcServiceDataUpdateService { - Map list(); + /** + * 得到一个包含了soc,phone,version的列表 + * + * @return 一个装着soc,phone,version的值的map集合 + * @author WH + * @date 2021/11/30 14:37 + * @since version-1.0 + */ + Map list(); - AjaxResult update(String SOC, String version, String phone); + /** + * 编辑全局soc,全局phone,全局version,全局短信总条数 + * + * @return 返回一个用于发送响应信息的AjaxResult对象 + * @author WH + * @date 2021/11/30 14:44 + * @since version-1.0 + */ + AjaxResult update(String SOC, String version, String phone, String aliyunMessageCount); } diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcServiceDataUpdateServiceImpl.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcServiceDataUpdateServiceImpl.java index 46532ae9..c39b7efb 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcServiceDataUpdateServiceImpl.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcServiceDataUpdateServiceImpl.java @@ -25,31 +25,37 @@ public class XhpcServiceDataUpdateServiceImpl implements IXhpcServiceDataUpdateS String cacheSOC = redisService.getCacheObject("global:SOC"); String cacheVersion = redisService.getCacheObject("global:version"); String cachePhone = redisService.getCacheObject("global:phone"); + String cacheAliyunMessageCount = redisService.getCacheObject("global:AliyunMessageCount"); list.put("SOC",cacheSOC); list.put("version",cacheVersion); - list.put("phone",cachePhone); + list.put("phone", cachePhone); + list.put("AliyunMessageCount", cacheAliyunMessageCount); return list; } @Override - public AjaxResult update(String SOC, String version, String phone) { + public AjaxResult update(String SOC, String version, String phone, String aliyunMessageCount) { - if(SOC!=null) { + if (SOC != null) { int soc = Integer.parseInt(SOC); if (!(soc >= 1 && soc <= 100)) { return AjaxResult.error("范围应为[1-100]"); } } - if(phone!=null) { + if (phone != null) { if (phone.length() > 20) { return AjaxResult.error("号码格式错误"); } } + if (aliyunMessageCount == null && "".equals(aliyunMessageCount)) { + return AjaxResult.error("短信条数为空"); + } - redisService.setCacheObject("global:SOC",SOC); - redisService.setCacheObject("global:version",version); - redisService.setCacheObject("global:phone",phone); + redisService.setCacheObject("global:SOC", SOC); + redisService.setCacheObject("global:version", version); + redisService.setCacheObject("global:phone", phone); + redisService.setCacheObject("global:AliyunMessageCount", aliyunMessageCount); return AjaxResult.success(); } From 0ebae2e0190c389d24af4004de088e6c7b518b04 Mon Sep 17 00:00:00 2001 From: wen <1455474577@qq.com> Date: Tue, 30 Nov 2021 15:27:42 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E5=AE=8C=E5=96=84soc=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E7=BC=96=E8=BE=91-=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xhpc/general/service/XhpcServiceDataUpdateServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcServiceDataUpdateServiceImpl.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcServiceDataUpdateServiceImpl.java index c39b7efb..2ca0963a 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcServiceDataUpdateServiceImpl.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcServiceDataUpdateServiceImpl.java @@ -57,6 +57,7 @@ public class XhpcServiceDataUpdateServiceImpl implements IXhpcServiceDataUpdateS redisService.setCacheObject("global:phone", phone); redisService.setCacheObject("global:AliyunMessageCount", aliyunMessageCount); + return AjaxResult.success(); } }