代码结构调整

This commit is contained in:
ZZ 2021-07-21 18:07:56 +08:00
parent 49203c0879
commit a9559fd4b3
18 changed files with 228 additions and 134 deletions

View File

@ -9,7 +9,10 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<modules> <modules>
<module>xhpc-common</module>
<module>xhpc-general</module>
<module>xhpc-power-pile</module> <module>xhpc-power-pile</module>
<module>xhpc-charging-station</module>
<module>xhpc-user</module> <module>xhpc-user</module>
</modules> </modules>

View File

@ -12,7 +12,7 @@
<artifactId>xhpc-common</artifactId> <artifactId>xhpc-common</artifactId>
<description> <description>
公共服务 公共复用代码
</description> </description>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
@ -20,80 +20,10 @@
</properties> </properties>
<dependencies> <dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId> <artifactId>ruoyi-common-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.5</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>

View File

@ -1,10 +0,0 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
_ __ _ _
(_) / _|(_)| |
_ __ _ _ ___ _ _ _ ______ | |_ _ | | ___
| '__|| | | | / _ \ | | | || ||______|| _|| || | / _ \
| | | |_| || (_) || |_| || | | | | || || __/
|_| \__,_| \___/ \__, ||_| |_| |_||_| \___|
__/ |
|___/

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>xhpc-modules</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>xhpc-general</artifactId>
<description>
通用服务
</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common DataScope -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datascope</artifactId>
</dependency>
<!-- RuoYi Common Log -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-log</artifactId>
</dependency>
<!-- RuoYi Common Swagger -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-common</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.5</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -1,4 +1,4 @@
package com.xhpc.common; package com.xhpc.general;
import com.ruoyi.common.security.annotation.EnableCustomConfig; import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients; import com.ruoyi.common.security.annotation.EnableRyFeignClients;
@ -11,13 +11,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@EnableCustomSwagger2 @EnableCustomSwagger2
@EnableRyFeignClients @EnableRyFeignClients
@SpringBootApplication @SpringBootApplication
@MapperScan("com.xhpc.common.mapper") @MapperScan("com.xhpc.general.mapper")
public class XhpcCommon { public class XhpcGeneralApplication {
public static void main(String [] args){ public static void main(String[] args) {
SpringApplication.run(XhpcCommon.class,args); SpringApplication.run(XhpcGeneralApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 公共模块模块启动成功 ლ(´ڡ`ლ)゙ \n" + System.out.println("(♥◠‿◠)ノ゙ 通用模块启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" + " .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" + " | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" + " | ( ' ) | \\ _. / ' \n" +

View File

@ -1,8 +1,8 @@
package com.xhpc.common.controller; package com.xhpc.general.controller;
import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.AjaxResult;
import com.xhpc.common.service.IXhpcDictBizService; import com.xhpc.general.service.IXhpcDictBizService;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;

View File

@ -1,9 +1,8 @@
package com.xhpc.common.mapper; package com.xhpc.general.mapper;
import com.xhpc.common.domain.XhpcDictBiz; import com.xhpc.common.domain.XhpcDictBiz;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 业务字典Mapper接口 * 业务字典Mapper接口

View File

@ -1,9 +1,8 @@
package com.xhpc.common.service; package com.xhpc.general.service;
import com.xhpc.common.domain.XhpcDictBiz; import com.xhpc.common.domain.XhpcDictBiz;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 业务字典Service接口 * 业务字典Service接口

View File

@ -1,12 +1,11 @@
package com.xhpc.common.service; package com.xhpc.general.service;
import com.xhpc.common.domain.XhpcDictBiz; import com.xhpc.common.domain.XhpcDictBiz;
import com.xhpc.common.mapper.XhpcDictBizMapper; import com.xhpc.general.mapper.XhpcDictBizMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 业务字典Service业务层处理 * 业务字典Service业务层处理

View File

@ -0,0 +1,8 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
_____ _
/ ____| | |
| | __ ___ _ __ ___ _ __ __ _ | |
| | |_ | / _ \ | '_ \ / _ \ | '__| / _` | | |
| |__| | | __/ | | | | | __/ | | | (_| | | |
\_____| \___| |_| |_| \___| |_| \__,_| |_|

View File

@ -6,7 +6,7 @@ server:
spring: spring:
application: application:
# 应用名称 # 应用名称
name: xhpc-common name: xhpc-general
profiles: profiles:
# 环境配置 # 环境配置
active: dev active: dev

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false"> <configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 --> <!-- 日志存放路径 -->
<property name="log.path" value="logs/xphc-charging-station"/> <property name="log.path" value="logs/xphc-general"/>
<!-- 日志输出格式 --> <!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/> <property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
@ -13,7 +13,7 @@
</appender> </appender>
<!-- 系统日志输出 --> <!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="general_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file> <file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -35,7 +35,7 @@
</filter> </filter>
</appender> </appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="general_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file> <file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 --> <!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -68,7 +68,7 @@
<!--系统操作日志--> <!--系统操作日志-->
<root level="info"> <root level="info">
<appender-ref ref="file_info"/> <appender-ref ref="general_info"/>
<appender-ref ref="file_error"/> <appender-ref ref="general_error"/>
</root> </root>
</configuration> </configuration>

View File

@ -2,17 +2,17 @@
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.common.mapper.XhpcDictBizMapper"> <mapper namespace="com.xhpc.general.mapper.XhpcDictBizMapper">
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcDictBiz"> <resultMap id="BaseResultMap" type="com.xhpc.common.domain.XhpcDictBiz">
<result property="dictBizId" column="dict_biz_id" /> <result property="dictBizId" column="dict_biz_id"/>
<result property="parentId" column="parent_id" /> <result property="parentId" column="parent_id"/>
<result property="code" column="code" /> <result property="code" column="code"/>
<result property="dictKey" column="dict_key" /> <result property="dictKey" column="dict_key"/>
<result property="dictValue" column="dict_value" /> <result property="dictValue" column="dict_value"/>
<result property="sort" column="sort" /> <result property="sort" column="sort"/>
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />

View File

@ -3,8 +3,8 @@
xmlns="http://maven.apache.org/POM/4.0.0" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-modules</artifactId> <artifactId>xhpc-modules</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.0.0</version> <version>3.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -76,9 +76,10 @@
</dependency> </dependency>
<dependency> <dependency>
<artifactId>leaf-boot-starter</artifactId> <groupId>com.ruoyi</groupId>
<groupId>com.sankuai.inf.leaf</groupId> <artifactId>xhpc-common</artifactId>
<version>1.0.1-RELEASE</version> <version>3.0.0</version>
<scope>compile</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -31,8 +31,9 @@ public class RateModelRequestLogic implements ServiceLogic {
Object cacheStation = stations.get(stationId); //todo Object cacheStation = stations.get(stationId); //todo
String resultCode = ServiceResult.OK; String resultCode = ServiceResult.OK;
String hexCode = ServiceResult.HEX_OK; String hexCode = ServiceResult.HEX_OK;
// Integer rateModelIdCache = cacheStation.get("rateModelId"); // Integer rateModelIdCache = cacheStation.get("rateModelId");
// Object rateModelId = station.getRateModelId() ; // Object rateModelId = station.getRateModelId();
// if (rateModelId==null) { // if (rateModelId==null) {
// hexCode = ServiceResult.HEX_FAIL; // hexCode = ServiceResult.HEX_FAIL;
// resultCode = ServiceResult.FAIL; // resultCode = ServiceResult.FAIL;
@ -44,5 +45,4 @@ public class RateModelRequestLogic implements ServiceLogic {
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr)); resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
return new ServiceResult(HexUtils.toBytes(resultStr), resultCode); return new ServiceResult(HexUtils.toBytes(resultStr), resultCode);
} }
} }

View File

@ -0,0 +1,43 @@
package com.xhpc.pp.service;
//import com.xhpc.common.domain.XhpcChargeOrderStatus;
import com.xhpc.pp.tx.ServiceParameter;
import com.xhpc.pp.tx.ServiceResult;
import com.xhpc.pp.tx.logic.ServiceLogic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import java.util.Map;
import static com.xhpc.pp.server.ChargingPileServer.REDIS;
@Lazy
@Component("RealtimeDataLogic")
public class RealtimeDataLogic implements ServiceLogic {
private static Logger log = LoggerFactory.getLogger(RealtimeDataLogic.class);
@Override
public ServiceResult service(ServiceParameter sp) throws Exception {
Map<String, Object> req = sp.getParameters();
String pileNo = (String) req.get("pileNo");
String gunId = (String) req.get("gunId");
String status = (String) req.get("status");
String pileGun = pileNo.concat(gunId);
Map<String, Object> cacheGun = REDIS.getCacheMap(pileGun);
cacheGun.put("status", status);
// List<XhpcChargeOrderStatus> realTimeDataList = (List<XhpcChargeOrderStatus>) cacheGun.get("realTimeData");
// XhpcChargeOrderStatus newData = new XhpcChargeOrderStatus();
// newData.setStatus(Integer.parseInt(status));
// if(realTimeDataList==null) realTimeDataList = new ArrayList<>();
// realTimeDataList.add(newData);
// cacheGun.put("realTimeData", realTimeDataList);
REDIS.setCacheMap(pileGun, cacheGun);
return new ServiceResult(false);
}
}

View File

@ -12,5 +12,6 @@
<entry key="03" value-ref="HBLogic"/> <entry key="03" value-ref="HBLogic"/>
<entry key="05" value-ref="RateModelValidateLogic"/> <entry key="05" value-ref="RateModelValidateLogic"/>
<entry key="09" value-ref="RateModelRequestLogic"/> <entry key="09" value-ref="RateModelRequestLogic"/>
<entry key="13" value-ref="RealtimeDataLogic"/>
</util:map> </util:map>
</beans> </beans>

View File

@ -75,17 +75,6 @@
<version>1.6</version> <version>1.6</version>
</dependency> </dependency>
<dependency>
<artifactId>leaf-boot-starter</artifactId>
<groupId>com.sankuai.inf.leaf</groupId>
<version>1.0.1-RELEASE</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>