finikes 2 жил өмнө
commit
2fb4680e17

+ 103 - 0
pom.xml

@@ -0,0 +1,103 @@
+<?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">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.finikes</groupId>
+    <artifactId>ocv1-server</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.0.5.RELEASE</version>
+    </parent>
+
+    <name>oc</name>
+    <!-- FIXME change it to the project's website -->
+    <url>http://www.example.com</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+            <version>3.4.4</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-aop</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>8.0.11</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>1.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
+            <plugins>
+                <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
+                <plugin>
+                    <artifactId>maven-clean-plugin</artifactId>
+                    <version>3.1.0</version>
+                </plugin>
+                <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
+                <plugin>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <version>3.0.2</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>3.8.0</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.22.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>3.0.2</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-install-plugin</artifactId>
+                    <version>2.5.2</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-deploy-plugin</artifactId>
+                    <version>2.8.2</version>
+                </plugin>
+                <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
+                <plugin>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <version>3.7.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-project-info-reports-plugin</artifactId>
+                    <version>3.0.0</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+</project>

+ 11 - 0
src/main/java/com/finikes/oc/App.java

@@ -0,0 +1,11 @@
+package com.finikes.oc;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class App {
+	public static void main(String[] args) {
+		SpringApplication.run(App.class, args);
+	}
+}

+ 16 - 0
src/main/java/com/finikes/oc/base/entity/BaseController.java

@@ -0,0 +1,16 @@
+package com.finikes.oc.base.entity;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@RequestMapping("/cardTrans")
+@Controller
+public class BaseController {
+	@ResponseBody
+    @RequestMapping("/cardTradeQuery")
+    R cardTradeQuery(@RequestBody Map<String, Object> map) {
+		
+	}
+}

+ 10 - 0
src/main/java/com/finikes/oc/base/entity/Passport.java

@@ -0,0 +1,10 @@
+package com.finikes.oc.base.entity;
+
+/**
+ * 账号通行证
+ */
+public class Passport {
+	private int id;
+	private String mobile; // 手机号码
+	private String password; // 密码
+}

+ 66 - 0
src/main/java/com/finikes/oc/ds/DatasourceConfig.java

@@ -0,0 +1,66 @@
+package com.finikes.oc.ds;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.mybatis.spring.SqlSessionFactoryBean;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+
+@Configuration
+@MapperScan(basePackages = MasterDatasourceConfig.PACKAGE, sqlSessionFactoryRef = "masterSqlSessionFactory")
+public class DatasourceConfig {
+
+    static final String PACKAGE = "com.ruixiang.rxpserver.dao.master";
+    static final String MAPPER_LOCATION = "classpath:mapper/master/*.xml";
+
+    @Bean
+    @ConfigurationProperties("spring.datasource.master")
+    public DataSourceProperties dataSourceMasterProperties() {
+        return new DataSourceProperties();
+    }
+
+    @Bean(name = "masterDataSource")
+    @Primary
+    public DataSource masterDataSource() {
+        DruidDataSource dataSource = (DruidDataSource) dataSourceMasterProperties().initializeDataSourceBuilder().build();
+        // 为了支持Druid审计
+        try {
+            dataSource.addFilters("stat");
+            dataSource.addFilters("wall");
+            dataSource.addFilters("slf4j");
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+        return dataSource;
+        // -fixme return dataSourceMasterProperties().initializeDataSourceBuilder().build();
+    }
+
+    @Bean(name = "masterTransactionManager")
+    @Primary
+    public DataSourceTransactionManager masterTransactionManager() {
+        return new DataSourceTransactionManager(masterDataSource());
+    }
+
+    @Bean(name = "masterSqlSessionFactory")
+    @Primary
+    public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource)
+            throws Exception {
+        final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
+        sessionFactory.setDataSource(masterDataSource);
+        sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
+                .getResources(MasterDatasourceConfig.MAPPER_LOCATION));
+        sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
+        return sessionFactory.getObject();
+    }
+
+}

+ 13 - 0
src/main/java/com/finikes/oc/estate/entity/EstateUnit.java

@@ -0,0 +1,13 @@
+package com.finikes.oc.estate.entity;
+
+/**
+ * 物业单元
+ */
+public class EstateUnit {
+	private int id;
+	private int parentId; // 父单元ID
+	private int level; // 级别
+	private String name; // 名称
+	private String exp; // 扩展名
+	private boolean leaf; // 是否是叶节点
+}

+ 12 - 0
src/main/java/com/finikes/oc/estate/entity/House.java

@@ -0,0 +1,12 @@
+package com.finikes.oc.estate.entity;
+
+/**
+ * 房产
+ */
+public class House {
+	private int unitId; // 属于那个单元(肯定是个物业单元的叶节点)
+	private int id;
+	private String name; // 名称
+	private float area; // 面积
+	private String function; // 使用性质
+}

+ 10 - 0
src/main/java/com/finikes/oc/management/entity/Authority.java

@@ -0,0 +1,10 @@
+package com.finikes.oc.management.entity;
+
+/**
+ * 权限
+ */
+public class Authority {
+	private int roleId; // 角色ID
+	private int resourceId; // 资源ID
+	private boolean state; // 状态
+}

+ 10 - 0
src/main/java/com/finikes/oc/management/entity/HouseRelation.java

@@ -0,0 +1,10 @@
+package com.finikes.oc.management.entity;
+
+/**
+ * 房产关系
+ */
+public class HouseRelation {
+	private int passportId; // 账号ID
+	private String certificateNo; // 房产证号码
+	private String certificateUrl; // 房产证图片地址(相对)
+}

+ 9 - 0
src/main/java/com/finikes/oc/management/entity/Manager.java

@@ -0,0 +1,9 @@
+package com.finikes.oc.management.entity;
+
+/**
+ * 管理者
+ */
+public class Manager {
+	private int passportId; // 账号ID
+	private int roleId; // 角色ID
+}

+ 10 - 0
src/main/java/com/finikes/oc/management/entity/Resource.java

@@ -0,0 +1,10 @@
+package com.finikes.oc.management.entity;
+
+/**
+ * 资源
+ */
+public class Resource {
+	private int id;
+	private String url; // url
+	private String httpMethod; // http方法
+}

+ 9 - 0
src/main/java/com/finikes/oc/management/entity/Role.java

@@ -0,0 +1,9 @@
+package com.finikes.oc.management.entity;
+
+/**
+ * 角色
+ */
+public class Role {
+	private int id;
+	private String name; // 角色名
+}

+ 13 - 0
src/main/java/com/finikes/oc/vote/entity/Choice.java

@@ -0,0 +1,13 @@
+package com.finikes.oc.vote.entity;
+
+/**
+ * 选择
+ */
+public class Choice {
+	private long id;
+	private int optionId; // 选项ID
+	private int passportId; // 账号ID
+	private long chooseTime; // 选择的时间
+	private boolean proxy; // 是否代理投票
+	private int assigneeId; // 代理者ID
+}

+ 10 - 0
src/main/java/com/finikes/oc/vote/entity/Option.java

@@ -0,0 +1,10 @@
+package com.finikes.oc.vote.entity;
+
+/**
+ * 选项
+ */
+public class Option {
+    private int id;
+    private String value; // 选项值
+    private int voteId; // 从属于哪个投票
+}

+ 12 - 0
src/main/java/com/finikes/oc/vote/entity/Vote.java

@@ -0,0 +1,12 @@
+package com.finikes.oc.vote.entity;
+
+/**
+ * 投票
+ */
+public class Vote {
+	private int id;
+	private int activityId; // 活动ID
+	private int sequence; // 排序
+	private String title; // 标题
+	private String content; // 内容
+}

+ 12 - 0
src/main/java/com/finikes/oc/vote/entity/VoteActivity.java

@@ -0,0 +1,12 @@
+package com.finikes.oc.vote.entity;
+
+/**
+ * 投票活动
+ */
+public class VoteActivity {
+	private int id;
+	private String title; // 标题
+	private String content; // 内容
+	private long startTime; // 开始时间
+	private long endTime; // 结束时间
+}