代码结构调整

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>
<modules>
<module>xhpc-common</module>
<module>xhpc-general</module>
<module>xhpc-power-pile</module>
<module>xhpc-charging-station</module>
<module>xhpc-user</module>
</modules>

View File

@ -12,7 +12,7 @@
<artifactId>xhpc-common</artifactId>
<description>
公共服务
公共复用代码
</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
@ -20,80 +20,10 @@
</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>
<!-- 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>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
</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>
<build>
<finalName>${project.artifactId}</finalName>
@ -112,4 +42,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

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.EnableRyFeignClients;
@ -11,13 +11,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringBootApplication
@MapperScan("com.xhpc.common.mapper")
public class XhpcCommon {
@MapperScan("com.xhpc.general.mapper")
public class XhpcGeneralApplication {
public static void main(String [] args){
public static void main(String[] args) {
SpringApplication.run(XhpcCommon.class,args);
System.out.println("(♥◠‿◠)ノ゙ 公共模块模块启动成功 ლ(´ڡ`ლ)゙ \n" +
SpringApplication.run(XhpcGeneralApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 通用模块启动成功 ლ(´ڡ`ლ)゙ \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.domain.AjaxResult;
import com.xhpc.common.service.IXhpcDictBizService;
import com.xhpc.general.service.IXhpcDictBizService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -31,6 +31,6 @@ public class XhpcDictBizController extends BaseController {
{
return AjaxResult.success(xhpcDictBizService.getCode(code));
}
}

View File

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

View File

@ -1,9 +1,8 @@
package com.xhpc.common.service;
package com.xhpc.general.service;
import com.xhpc.common.domain.XhpcDictBiz;
import java.util.List;
import java.util.Map;
/**
* 业务字典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.mapper.XhpcDictBizMapper;
import com.xhpc.general.mapper.XhpcDictBizMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 业务字典Service业务层处理

View File

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

View File

@ -3,10 +3,10 @@ server:
port: 9802
# Spring
spring:
spring:
application:
# 应用名称
name: xhpc-common
name: xhpc-general
profiles:
# 环境配置
active: dev

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<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"/>
@ -13,7 +13,7 @@
</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>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -35,7 +35,7 @@
</filter>
</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>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -68,7 +68,7 @@
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
<appender-ref ref="general_info"/>
<appender-ref ref="general_error"/>
</root>
</configuration>

View File

@ -2,17 +2,17 @@
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"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">
<result property="dictBizId" column="dict_biz_id" />
<result property="parentId" column="parent_id" />
<result property="code" column="code" />
<result property="dictKey" column="dict_key" />
<result property="dictValue" column="dict_value" />
<result property="sort" column="sort" />
<result property="delFlag" column="del_flag" />
<result property="createTime" column="create_time" />
<result property="dictBizId" column="dict_biz_id"/>
<result property="parentId" column="parent_id"/>
<result property="code" column="code"/>
<result property="dictKey" column="dict_key"/>
<result property="dictValue" column="dict_value"/>
<result property="sort" column="sort"/>
<result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
@ -24,4 +24,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select code, dict_key, dict_value, sort, remark from xhpc_dict_biz where code = #{code} and parent_id > 0 and del_flag = 0
</select>
</mapper>
</mapper>

View File

@ -3,8 +3,8 @@
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">
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-modules</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -76,9 +76,10 @@
</dependency>
<dependency>
<artifactId>leaf-boot-starter</artifactId>
<groupId>com.sankuai.inf.leaf</groupId>
<version>1.0.1-RELEASE</version>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-common</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -31,8 +31,9 @@ public class RateModelRequestLogic implements ServiceLogic {
Object cacheStation = stations.get(stationId); //todo
String resultCode = ServiceResult.OK;
String hexCode = ServiceResult.HEX_OK;
// Integer rateModelIdCache = cacheStation.get("rateModelId");
// Object rateModelId = station.getRateModelId() ;
// Object rateModelId = station.getRateModelId();
// if (rateModelId==null) {
// hexCode = ServiceResult.HEX_FAIL;
// resultCode = ServiceResult.FAIL;
@ -44,5 +45,4 @@ public class RateModelRequestLogic implements ServiceLogic {
resultStr = resultStr.concat(CRCCalculator.calcCrc(resultStr));
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="05" value-ref="RateModelValidateLogic"/>
<entry key="09" value-ref="RateModelRequestLogic"/>
<entry key="13" value-ref="RealtimeDataLogic"/>
</util:map>
</beans>

View File

@ -75,17 +75,6 @@
<version>1.6</version>
</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>
<build>