From f0924f311ed3b8381cf3bf230416c1685d8e0ed2 Mon Sep 17 00:00:00 2001 From: 刘小明 <liuxm_a@163.com> Date: 星期二, 18 六月 2024 09:01:23 +0800 Subject: [PATCH] 免登录模块 --- pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/claim/ClaimCtrl.java | 23 ++++ pms-parent/pms-web-nologin/src/main/resources/log4j2.yml | 73 ++++++++++++++ pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/NoLoginApplication.java | 17 +++ pms-parent/pms-global/src/main/resources/application-global.yml | 3 pms-parent/pms-web-nologin/src/main/resources/application.yml | 14 ++ pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/tracking/TrackingCtrl.java | 14 ++ pms-parent/pms-web-nologin/pom.xml | 118 +++++++++++++++++++++++ 7 files changed, 262 insertions(+), 0 deletions(-) diff --git a/pms-parent/pms-global/src/main/resources/application-global.yml b/pms-parent/pms-global/src/main/resources/application-global.yml index 423c456..48fed10 100644 --- a/pms-parent/pms-global/src/main/resources/application-global.yml +++ b/pms-parent/pms-global/src/main/resources/application-global.yml @@ -69,6 +69,9 @@ other: webPort: 12348 idSuffix: 5 + nologin: + webPort: 12349 + idSuffix: 6 file: idSuffix: 99 file1: diff --git a/pms-parent/pms-web-nologin/pom.xml b/pms-parent/pms-web-nologin/pom.xml new file mode 100644 index 0000000..eeae682 --- /dev/null +++ b/pms-parent/pms-web-nologin/pom.xml @@ -0,0 +1,118 @@ +<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>pms-parent</artifactId> + <groupId>com.dy</groupId> + <version>1.0.0</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <packaging>jar</packaging> + <groupId>com.dy</groupId> + <artifactId>pms-web-nologin</artifactId> + <version>1.0.0</version> + <name>pms-web-noLogin</name> + <description>鍏嶇櫥褰曟ā鍧�</description> + + + <dependencies> + <dependency> + <groupId>com.dy</groupId> + <artifactId>pms-common</artifactId> + <version>1.0.0</version> + </dependency> + <dependency> + <groupId>com.dy</groupId> + <artifactId>pms-global</artifactId> + <version>1.0.0</version> + </dependency> + + <dependency> + <groupId>net.coobird</groupId> + <artifactId>thumbnailator</artifactId> + <version>${thumbnailator.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <!-- 鎷疯礉渚濊禆鐨刯ar鍖呭埌lib鐩綍--> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <executions> + <execution> + <configuration> + <!-- 涓嶅姞鐨勮瘽鏈�缁堝寘鍚嶄负: ${artifactId}-${version}.jar, 鍔犱簡鐨勮瘽鏈�缁堝寘鍚�: ${artifactId}-${version}-${classifier}.jar + <classifier>execute</classifier> + --> + <!-- ${project.build.directory}鏄痬aven鍙橀噺锛屽唴缃殑锛岃〃绀簍arget鐩綍,濡傛灉涓嶅啓锛屽皢鍦ㄦ牴鐩綍涓嬪垱寤�/lib --> + <outputDirectory>${project.build.directory}/lib</outputDirectory> + <!-- excludeTransitive:鏄惁涓嶅寘鍚棿鎺ヤ緷璧栧寘锛屾瘮濡傛垜浠緷璧朅锛屼絾鏄疉鍙堜緷璧栦簡B锛屾垜浠槸鍚︿篃瑕佹妸B鎵撹繘鍘� 榛樿涓嶆墦--> + <excludeTransitive>false</excludeTransitive> + <!-- 澶嶅埗鐨刯ar鏂囦欢鍘绘帀鐗堟湰淇℃伅 --> + <stripVersion>false</stripVersion> + <finalName>${project.artifactId}-${project.version}</finalName> + <layout>ZIP</layout> + <mainClass>com.dy.pmsBase.PmsBaseApplication</mainClass> + <includes> + <include> + <groupId>com.dy</groupId> + <artifactId>pms-common</artifactId> + </include> + <include> + <groupId>com.dy</groupId> + <artifactId>pms-global</artifactId> + </include> + </includes> + <excludes> + <exclude> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </exclude> + </excludes> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <!-- 璁剧疆java缂栬瘧鐗堟湰锛岃繍琛岀幆澧冪増鏈� --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <!-- source锛� 婧愪唬鐮佺紪璇戠増鏈紱target锛� 鐩爣骞冲彴缂栬瘧鐗堟湰锛沞ncoding锛� 瀛楃闆嗙紪鐮併�� --> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + <encoding>${encoding}</encoding> + </configuration> + </plugin> + <plugin> + <!-- 瑙e喅璧勬簮鏂囦欢鐨勭紪鐮侀棶棰� --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <configuration> + <encoding>${encoding}</encoding> + </configuration> + </plugin> + <plugin> + <!-- maven閲屾墽琛屾祴璇曠敤渚嬬殑鎻掍欢 --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <skipTests>true</skipTests> + </configuration> + </plugin> + <plugin> + <!-- 涓嬮潰瑙e喅锛氬綋杩涜Maven Lifecycle package鏃舵姤閿欙細Could not find artifact org.apache.mina:mina-core:bundle:2.2.1 in maven (https://repo1.maven.org/maven2/)--> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + </plugin> + </plugins> + </build> +</project> + diff --git a/pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/NoLoginApplication.java b/pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/NoLoginApplication.java new file mode 100644 index 0000000..d3ea9f1 --- /dev/null +++ b/pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/NoLoginApplication.java @@ -0,0 +1,17 @@ +package com.dy.pmsNoLogin; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.EnableAspectJAutoProxy; + +@SpringBootApplication +@EnableAspectJAutoProxy +@ComponentScan(basePackages = {"com.dy.common", "com.dy.pmsGlobal", "com.dy.pmsNoLogin"}) +@MapperScan(basePackages={"com.dy.pmsGlobal.dao*"}) +public class NoLoginApplication { + public static void main(String[] args) { + SpringApplication.run(NoLoginApplication.class, args); + } +} diff --git a/pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/claim/ClaimCtrl.java b/pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/claim/ClaimCtrl.java new file mode 100644 index 0000000..1180c8c --- /dev/null +++ b/pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/claim/ClaimCtrl.java @@ -0,0 +1,23 @@ +package com.dy.pmsNoLogin.claim; + +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 鐢熶骇浠诲姟璁ら鎺у埗鍣� + */ +@Slf4j +@RestController +@RequestMapping(path = "claim") +public class ClaimCtrl { + + @GetMapping(path = "test") + public BaseResponse test() { + log.info("test"); + return BaseResponseUtils.buildSuccess("test"); + } +} diff --git a/pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/tracking/TrackingCtrl.java b/pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/tracking/TrackingCtrl.java new file mode 100644 index 0000000..d58ca37 --- /dev/null +++ b/pms-parent/pms-web-nologin/src/main/java/com/dy/pmsNoLogin/tracking/TrackingCtrl.java @@ -0,0 +1,14 @@ +package com.dy.pmsNoLogin.tracking; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * + */ +@Slf4j +@RestController +@RequestMapping(path = "tracking") +public class TrackingCtrl { +} diff --git a/pms-parent/pms-web-nologin/src/main/resources/application.yml b/pms-parent/pms-web-nologin/src/main/resources/application.yml new file mode 100644 index 0000000..8e5a366 --- /dev/null +++ b/pms-parent/pms-web-nologin/src/main/resources/application.yml @@ -0,0 +1,14 @@ +spring: + profiles: + include: global, database + +#web鏈嶅姟绔彛锛宼omcat榛樿鏄�8080 +server: + port: ${pms.nologin.webPort} + servlet: + context-path: /nologin #web璁块棶涓婁笅鏂囪矾寰� + context-parameters: + #GenerateIdSetSuffixListener涓簲鐢紝鍙栧�艰寖鍥存槸0-99 + idSuffix: ${pms.nologin.idSuffix} + #ConfigListener涓簲鐢� + #configFileNames: config-global.xml,config-demo.xml diff --git a/pms-parent/pms-web-nologin/src/main/resources/log4j2.yml b/pms-parent/pms-web-nologin/src/main/resources/log4j2.yml new file mode 100644 index 0000000..18562d3 --- /dev/null +++ b/pms-parent/pms-web-nologin/src/main/resources/log4j2.yml @@ -0,0 +1,73 @@ +Configuration: + #status锛岃繖涓敤浜庤缃甽og4j2鑷韩鍐呴儴鐨勪俊鎭緭鍑猴紝鍙互涓嶈缃紝褰撹缃垚trace鏃讹紝浣犱細鐪嬪埌log4j2鍐呴儴鍚勭璇︾粏杈撳嚭锛涘彲浠ヨ缃垚Off(鍏抽棴)鎴朎rror(鍙緭鍑洪敊璇俊鎭�) + status: Error + + Properties: # 瀹氫箟鍏ㄥ眬鍙橀噺 + Property: + #鏃ュ織鏂囦欢瀛樺偍鐨勭洰褰� + - name: log.path + value: ./logs + #鏃ュ織鏂囦欢瀛樺偍鍚嶇О + - name: project.name + value: pmsNologin + + #瀹氫箟杈撳嚭鍣紝鍙互杈撳嚭鍒版帶鍒跺彴鍜屾枃浠�. + Appenders: + #杈撳嚭鍒版帶鍒跺彴 + Console: + #Appender鍛藉悕 + name: CONSOLE + target: SYSTEM_OUT + ThresholdFilter: + level: debug #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 + onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 + onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� + #鏃ュ織鍐呭鏍峰紡 + PatternLayout: + #%n-鎹㈣ + #%m-鏃ュ織鍐呭锛岃緭鍑轰唬鐮佷腑鎸囧畾鐨勬棩蹇椾俊鎭� + #%p-杈撳嚭浼樺厛绾э紝鍗矰EBUG,INFO,WARN,ERROR,FATAL + #%r-绋嬪簭鍚姩鍒扮幇鍦ㄧ殑姣鏁� + #%%- 杈撳嚭涓�涓�"%" 瀛楃 + #%t-褰撳墠绾跨▼鍚� + #%d-鏃ユ湡鍜屾椂闂�, 甯哥敤鐨勬牸寮忔湁%d{DATE},%d{ABSOLUTE},%d{HH:mm:ss,SSS},%d{ddMMyyyyHH:mm:ss,SSS} + #%l-鍚�%F%L%C%M + #%F-java婧愭枃浠跺悕 + #%L-java婧愮爜琛屾暟 + #%C-java绫诲悕,%C{1}杈撳嚭鏈�鍚庝竴涓厓绱� + #%M-java鏂规硶鍚� + pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" + # 杈撳嚭鍒版枃浠讹紝瓒呰繃10MB褰掓。 + RollingFile: + - name: ROLLING_FILE + ignoreExceptions: false + fileName: ${log.path}/${project.name}.log + filePattern: "${log.path}/$${date:yyyy-MM}/${project.name}-%d{yyyy-MM-dd}-%i.log.gz" + ThresholdFilter: + level: error #杈撳嚭鏃ュ織绾у埆锛岃緭鍑烘棩蹇楁椂锛岄鍏堢敱Loggers.Root.level鎴朙oggers.Logger.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢辨湰level鍒ゆ柇鏄惁杈撳嚭 + onMatch: ACCEPT #onMatch=ACCEPT 澶т簬绛変簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織杈撳嚭 + onMismatch: DENY #onMismatch=DENY 灏忎簬 "level" 閰嶇疆鐨勭瓑绾у湴鏃ュ織涓嶈緭鍑� + #鏃ュ織鍐呭鏍峰紡 + PatternLayout: + pattern: "%d{yyyy-MM-dd HH:mm:ss,SSS}:%4p %t (%C.%M:%L) - %m%n" + Policies: + SizeBasedTriggeringPolicy: + size: "10 MB" + DefaultRolloverStrategy: + max: 1000 + + Loggers: + Root: + level: info #鏃ュ織杈撳嚭绾у埆锛屽叡鏈�8涓骇鍒紝鎸夌収浠庝綆鍒伴珮涓猴細all < trace < debug < info < warn < error < fatal < off + AppenderRef: #Root鐨勫瓙鑺傜偣锛岀敤鏉ユ寚瀹氳鏃ュ織杈撳嚭鍒板摢涓狝ppender. + - ref: CONSOLE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.Console.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 + - ref: ROLLING_FILE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.RollingFile.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 + # 涓哄寘閰嶇疆鐗规畩鐨凩og绾у埆锛屾柟渚胯皟璇曪紝 + # 涓嶅彈Loggers.Root.level闄愬埗 + #Logger: + # - name: com.dy.pmsGlobal.daoBa + # additivity: false #鍘婚櫎閲嶅鐨刲og + # level: debug #杈撳嚭鏃ュ織绾у埆 + # AppenderRef: + # - ref: CONSOLE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰.level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.Console.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 + # - ref: ROLLING_FILE #杈撳嚭鏃ュ織鏃讹紝棣栧厛鐢辨湰level鍒ゆ柇鏄惁杈撳嚭锛岀劧鍚庡啀鐢变笂闈㈢殑Appenders.RollingFile.ThresholdFilter.level鍒ゆ柇鏄惁杈撳嚭 -- Gitblit v1.8.0