Kaynağa Gözat

华晓金属代码提交

zfc 1 yıl önce
ebeveyn
işleme
94e1fece19

+ 3 - 1
.idea/compiler.xml

@@ -6,9 +6,10 @@
         <sourceOutputDir name="target/generated-sources/annotations" />
         <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
         <outputRelativeToContentRoot value="true" />
-        <module name="mjava" />
         <module name="mjava-dongfangxinhua" />
         <module name="mjava-yibaoju" />
+        <module name="mjava" />
+        <module name="mjava-huaxiaojinshu" />
       </profile>
     </annotationProcessing>
   </component>
@@ -17,6 +18,7 @@
       <module name="java-mcli" options="-Xlint:unchecked" />
       <module name="mjava" options="-Xlint:unchecked" />
       <module name="mjava-dongfangxinhua" options="-Xlint:unchecked" />
+      <module name="mjava-huaxiaojinshu" options="-Xlint:unchecked" />
       <module name="mjava-yibaoju" options="-Xlint:unchecked" />
     </option>
   </component>

+ 54 - 0
mjava-huaxiaojinshu/pom.xml

@@ -0,0 +1,54 @@
+<?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>java-mcli</artifactId>
+        <groupId>com.malk</groupId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>mjava-huaxiaojinshu</artifactId>
+    <description>华晓金属</description>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <!-- 核心模块-->
+        <dependency>
+            <groupId>com.malk</groupId>
+            <artifactId>mjava</artifactId>
+            <version>${mjava.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.1.1.RELEASE</version>
+                <configuration>
+                    <includeSystemScope>true</includeSystemScope>
+                    <!-- 如果没有该配置,devtools不会生效: 打包时关闭 -->
+                    <fork>false</fork>
+                    <!-- 避免中文乱码 -->
+                    <jvmArguments>-Dfile.encoding=UTF-8</jvmArguments>
+                </configuration>
+                <!-- 允许生成可运行jar -->
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+        <finalName>${project.artifactId}</finalName>
+    </build>
+</project>

+ 32 - 0
mjava-huaxiaojinshu/src/main/java/com/malk/huaxiaojinshu/Boot.java

@@ -0,0 +1,32 @@
+package com.malk.huaxiaojinshu;
+
+import com.querydsl.jpa.impl.JPAQueryFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
+
+import javax.persistence.EntityManager;
+
+/**
+ * corp项目: 扫描公共模块
+ * -
+ * 若是无需数据库模块, 配置无效地址也可启动, 引入mjava不支持直接 @SpringBootApplication(exclude = DataSourceAutoConfiguration.class) 配置
+ * 需要配置 jpa.hibernate.ddl-auto 为 none. 标识对表没有任何操作. 若不设置为 none, flyway.enabled 配置会无效, 在没有数库连接情况下程序无法启动
+ */
+@EnableJpaAuditing
+@SpringBootApplication(scanBasePackages = {"com.malk"})
+public class Boot {
+
+    public static void main(String... args) {
+        SpringApplication.run(Boot.class, args);
+    }
+
+    /**
+     * 让Spring管理JPAQueryFactory [不使用Qualifier详见mjava-Boot]
+     */
+    @Bean
+    public JPAQueryFactory jpaQueryFactory(EntityManager entityManager) {
+        return new JPAQueryFactory(entityManager);
+    }
+}

+ 30 - 0
mjava-huaxiaojinshu/src/main/java/com/malk/huaxiaojinshu/controller/HXJSController.java

@@ -0,0 +1,30 @@
+package com.malk.huaxiaojinshu.controller;
+
+
+import com.malk.server.common.McR;
+import com.malk.service.aliwork.YDClient;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+
+/**
+ * 错误抛出与拦截详见 CatchException
+ */
+@Slf4j
+@RestController
+@RequestMapping()
+public class HXJSController {
+
+
+    @Autowired
+    private YDClient ydClient;
+
+    @RequestMapping("test")
+    McR test(HttpServletRequest request) {
+        return McR.success();
+    }
+
+}

+ 52 - 0
mjava-huaxiaojinshu/src/main/resources/application-dev.yml

@@ -0,0 +1,52 @@
+# 环境配置
+server:
+  port: 9001
+  servlet:
+    context-path: /api/huaxiaojinshu
+
+# condition
+spel:
+  scheduling: false        # 定时任务是否执行
+  multiSource: false      # 是否多数据源配置
+
+spring:
+  # database
+  datasource:
+    hikari:
+      connection-init-sql: SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci           # SqlServer, Oracle 无需设置类型
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    username: root
+    password: mu123
+    url: jdbc:mysql://127.0.0.1:3306/mjava?serverTimezone=Asia/Shanghai&useUnicode=yes&characterEncoding=UTF-8&useSSL=true
+  jpa:
+    database: MYSQL
+    database-platform: org.hibernate.dialect.MySQL57Dialect
+
+# filepath
+file:
+  path:
+    file: C:/Users/fly/server/_Tool/var/mjava/tmp/file/
+    image: C:/Users/fly/server/_Tool/var/mjava/tmp/image/
+    tmp: C:/Users/fly/server/_Tool/var/mjava/tmp/
+  source:
+    fonts: C:/Users/fly/server/_Tool/fonts/simsun.ttc
+logging:
+  file:
+    path: C:/Users/fly/server/_Tool/var/mjava/log
+
+
+# dingtalk
+dingtalk:
+  agentId: 2855972914
+  appKey: dingb1kydxxkseemaybo
+  appSecret: 1dm8Mxmd-CAxQQQpEs4HfHzdS-hngd6G-dnddz0eSEEs0I8BzB7TLh9adGx6TNPJ
+  corpId: ding2ac6c08d3685357135c2f4657eb6378f
+  aesKey:
+  token:
+  robotCode:
+  operator: ""   # 管理员 [开头0, 需要转一下字符串]
+
+# aliwork
+aliwork:
+  appType: "APP_YIDJ71B8QORD2YHNZ26Q"
+  systemToken: "RH766AC1707FCUZQAKET09YV8I8K3VZA1GVNLN2"

+ 39 - 0
mjava-huaxiaojinshu/src/main/resources/application-prod.yml

@@ -0,0 +1,39 @@
+# 环境配置
+server:
+  port: 9025
+  servlet:
+    context-path: /api/huaxiaojinshu
+
+# condition
+spel:
+  scheduling: true        # 定时任务是否执行
+  multiSource: false      # 是否多数据源配置
+
+spring:
+  # database
+  datasource:
+    hikari:
+      connection-init-sql: SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci           # SqlServer, Oracle 无需设置类型
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    username: root
+    password: mu123
+    url: jdbc:mysql://127.0.0.1:3306/mjava?serverTimezone=Asia/Shanghai&useUnicode=yes&characterEncoding=UTF-8&useSSL=true
+  jpa:
+    database: MYSQL
+    database-platform: org.hibernate.dialect.MySQL57Dialect
+# dingtalk
+dingtalk:
+  agentId: 2855972914
+  appKey: dingb1kydxxkseemaybo
+  appSecret: 1dm8Mxmd-CAxQQQpEs4HfHzdS-hngd6G-dnddz0eSEEs0I8BzB7TLh9adGx6TNPJ
+  corpId: ding2ac6c08d3685357135c2f4657eb6378f
+  aesKey:
+  token:
+  robotCode:
+  operator: ""   # 管理员 [开头0, 需要转一下字符串]
+
+# aliwork
+aliwork:
+  appType: "APP_YIDJ71B8QORD2YHNZ26Q"
+  systemToken: "RH766AC1707FCUZQAKET09YV8I8K3VZA1GVNLN2"
+

+ 35 - 0
mjava-huaxiaojinshu/src/test/resources/server.sh

@@ -0,0 +1,35 @@
+#!/bin/bash
+appname='mjava-huaxiaojinshu'
+if [ "$1" == "dev" ]; then
+  java -Xms256m -Xmx256m -jar $appname.jar --spring.profiles.active=dev
+else
+  if [ "$1" == "start" ]; then
+    nohup java -Xms256m -Xmx256m -jar $appname.jar &
+    echo "server prod is starting"
+  else
+    if [ "$1" == "test" ]; then
+      nohup java -Xms256m -Xmx256m -jar $appname.jar --spring.profiles.active=test &
+      echo "server test is starting"
+    else
+      if [ "$1" == "stop" ]; then
+        PID=$(ps -ef | grep $appname.jar | grep -v grep | awk '{ print $2 }')
+        if [ -z "$PID" ]; then
+          echo "server is already stopped"
+        else
+          echo kill $PID
+          kill $PID
+        fi
+      else
+        if [ "$1" == "status" ]; then
+          PID=$(ps -ef | grep $appname.jar | grep -v grep | awk '{ print $2 }')
+          if [ -z "$PID" ]; then
+            echo "server is stopped"
+          else
+            echo "server is running"
+            echo $PID
+          fi
+        fi
+      fi
+    fi
+  fi
+fi

+ 1 - 0
pom.xml

@@ -12,6 +12,7 @@
         <module>mjava</module>
         <module>mjava-dongfangxinhua</module>
         <module>mjava-yibaoju</module>
+        <module>mjava-huaxiaojinshu</module>
     </modules>
     <packaging>pom</packaging>