Compare commits
No commits in common. "liguangyao2" and "master" have entirely different histories.
liguangyao
...
master
|
@ -1,7 +1,7 @@
|
||||||
# 默认忽略的文件
|
# Default ignored files
|
||||||
/shelf/
|
/shelf/
|
||||||
/workspace.xml
|
/workspace.xml
|
||||||
# 基于编辑器的 HTTP 客户端请求
|
# Editor-based HTTP Client requests
|
||||||
/httpRequests/
|
/httpRequests/
|
||||||
# Datasource local storage ignored files
|
# Datasource local storage ignored files
|
||||||
/dataSources/
|
/dataSources/
|
||||||
|
|
|
@ -1,20 +1,13 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="Encoding">
|
<component name="Encoding">
|
||||||
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/resources" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-common/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-blood/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-lists/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-blood/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-lists/src/main/resources" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-user/src/main/java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-user/src/main/resources" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-mq/src/main/java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-mq/src/main/resources" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
<component name="InspectionProjectProfileManager">
|
|
||||||
<profile version="1.0">
|
|
||||||
<option name="myName" value="Project Default" />
|
|
||||||
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="AliArrayNamingShouldHaveBracket" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
|
||||||
</profile>
|
|
||||||
</component>
|
|
|
@ -1,124 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="Palette2">
|
|
||||||
<group name="Swing">
|
|
||||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
|
||||||
</item>
|
|
||||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
|
||||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
|
||||||
<initial-values>
|
|
||||||
<property name="text" value="Button" />
|
|
||||||
</initial-values>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
|
||||||
<initial-values>
|
|
||||||
<property name="text" value="RadioButton" />
|
|
||||||
</initial-values>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
|
||||||
<initial-values>
|
|
||||||
<property name="text" value="CheckBox" />
|
|
||||||
</initial-values>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
|
||||||
<initial-values>
|
|
||||||
<property name="text" value="Label" />
|
|
||||||
</initial-values>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
|
||||||
<preferred-size width="150" height="-1" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
|
||||||
<preferred-size width="150" height="-1" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
|
||||||
<preferred-size width="150" height="-1" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
|
||||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
|
||||||
<preferred-size width="150" height="50" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
|
||||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
|
||||||
<preferred-size width="150" height="50" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
|
||||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
|
||||||
<preferred-size width="150" height="50" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
|
||||||
<preferred-size width="150" height="50" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
|
||||||
<preferred-size width="150" height="50" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
|
||||||
<preferred-size width="150" height="50" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
|
||||||
<preferred-size width="200" height="200" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
|
||||||
<preferred-size width="200" height="200" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
|
||||||
<preferred-size width="-1" height="20" />
|
|
||||||
</default-constraints>
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
|
||||||
</item>
|
|
||||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
|
||||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
|
||||||
</item>
|
|
||||||
</group>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -1,33 +0,0 @@
|
||||||
<?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>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.bwie</groupId>
|
|
||||||
<artifactId>day_12_10_1</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>bwie-auth</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- 项目公共 依赖 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.bwie</groupId>
|
|
||||||
<artifactId>bwie-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- SpringBoot Web-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.bwie;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:31
|
|
||||||
*/
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableFeignClients
|
|
||||||
public class AuthApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(AuthApplication.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.bwie.config;
|
|
||||||
|
|
||||||
import feign.Retryer;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 下午 4:13
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class FeignConfig {
|
|
||||||
@Bean
|
|
||||||
public Retryer retry(){
|
|
||||||
return new Retryer.Default(5000,30000,3);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
package com.bwie.controller;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.request.UserRequest;
|
|
||||||
import com.bwie.common.domain.response.JwtResponse;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.service.AuthService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.jws.Oneway;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:27
|
|
||||||
*/
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
public class AuthController {
|
|
||||||
@Autowired
|
|
||||||
private AuthService authService;
|
|
||||||
|
|
||||||
@PostMapping("/userLogin")
|
|
||||||
public Result userLogin(@RequestBody UserRequest userRequest){
|
|
||||||
Result<JwtResponse> result = authService.userLogin(userRequest);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/adminLogin")
|
|
||||||
public Result adminLogin(@RequestBody UserRequest userRequest){
|
|
||||||
Result<JwtResponse> result = authService.adminLogin(userRequest);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.bwie.feign;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Admin;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.domain.request.UserRequest;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:31
|
|
||||||
*/
|
|
||||||
@FeignClient(name = "bwie-user")
|
|
||||||
public interface UserFeign {
|
|
||||||
@PostMapping("/userLogin")
|
|
||||||
public Result<User> userLogin(@RequestBody UserRequest userRequest);
|
|
||||||
@PostMapping("/adminLogin")
|
|
||||||
public Result<Admin> adminLogin(@RequestBody UserRequest userRequest);
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.bwie.service;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.request.UserRequest;
|
|
||||||
import com.bwie.common.domain.response.JwtResponse;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:30
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface AuthService {
|
|
||||||
Result<JwtResponse> userLogin(UserRequest userRequest);
|
|
||||||
|
|
||||||
Result<JwtResponse> adminLogin(UserRequest userRequest);
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
package com.bwie.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.bwie.common.constants.JwtConstants;
|
|
||||||
import com.bwie.common.domain.Admin;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.domain.request.UserRequest;
|
|
||||||
import com.bwie.common.domain.response.JwtResponse;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.common.utils.JwtUtils;
|
|
||||||
import com.bwie.feign.UserFeign;
|
|
||||||
import com.bwie.service.AuthService;
|
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:30
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class AuthServiceImpl implements AuthService {
|
|
||||||
@Autowired
|
|
||||||
private UserFeign userFeign;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private StringRedisTemplate redisTemplate;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<JwtResponse> userLogin(UserRequest userRequest) {
|
|
||||||
Result<User> result = userFeign.userLogin(userRequest);
|
|
||||||
User user = result.getData();
|
|
||||||
if(user==null){
|
|
||||||
return Result.error("没有该用户,请先前往注册");
|
|
||||||
}
|
|
||||||
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
String useKey = UUID.randomUUID().toString().replaceAll("-","");
|
|
||||||
map.put(JwtConstants.USER_KEY,useKey);
|
|
||||||
String token = JwtUtils.createToken(map);
|
|
||||||
redisTemplate.opsForValue().set(JwtConstants.USER_KEY+token, JSON.toJSONString(user),15, TimeUnit.MINUTES);
|
|
||||||
|
|
||||||
JwtResponse jwtResponse = new JwtResponse();
|
|
||||||
jwtResponse.setToken(token);
|
|
||||||
jwtResponse.setTokenMIN("15MIN");
|
|
||||||
return Result.success(jwtResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<JwtResponse> adminLogin(UserRequest userRequest) {
|
|
||||||
Result<Admin> result = userFeign.adminLogin(userRequest);
|
|
||||||
Admin admin = result.getData();
|
|
||||||
if(admin==null){
|
|
||||||
return Result.error("没有该用户,请先前往注册");
|
|
||||||
}
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
String useKey = UUID.randomUUID().toString().replaceAll("-","");
|
|
||||||
map.put(JwtConstants.USER_KEY,useKey);
|
|
||||||
String token = JwtUtils.createToken(map);
|
|
||||||
redisTemplate.opsForValue().set(JwtConstants.USER_KEY+token, JSON.toJSONString(admin),15, TimeUnit.MINUTES);
|
|
||||||
|
|
||||||
JwtResponse jwtResponse = new JwtResponse();
|
|
||||||
jwtResponse.setToken(token);
|
|
||||||
jwtResponse.setTokenMIN("15MIN");
|
|
||||||
return Result.success(jwtResponse);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
# Tomcat
|
|
||||||
server:
|
|
||||||
port: 9001
|
|
||||||
# Spring
|
|
||||||
spring:
|
|
||||||
main:
|
|
||||||
allow-circular-references: true
|
|
||||||
jackson:
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
time-zone: GMT+8
|
|
||||||
application:
|
|
||||||
# 应用名称
|
|
||||||
name: bwie-auth
|
|
||||||
profiles:
|
|
||||||
# 环境配置
|
|
||||||
active: dev
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: 124.221.202.137:8848
|
|
||||||
config:
|
|
||||||
# 配置中心地址
|
|
||||||
server-addr: 124.221.202.137:8848
|
|
||||||
# 配置文件格式
|
|
||||||
file-extension: yml
|
|
||||||
# 共享配置
|
|
||||||
shared-configs:
|
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
feign:
|
|
||||||
client:
|
|
||||||
config:
|
|
||||||
default:
|
|
||||||
connectTimeout: 5000 # 改成5秒
|
|
||||||
readTimeout: 5000 # 改成5秒
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -4,8 +4,8 @@
|
||||||
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">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bwie</groupId>
|
<groupId>com.bw</groupId>
|
||||||
<artifactId>day_12_10_1</artifactId>
|
<artifactId>day02</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -98,11 +98,41 @@
|
||||||
<version>3.12.0</version>
|
<version>3.12.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- <!–mq 依赖–>
|
|
||||||
<dependency>
|
<!--短信依赖 5条依赖-->
|
||||||
<groupId>org.springframework.boot</groupId>
|
<dependency>
|
||||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
<groupId>com.alibaba</groupId>
|
||||||
</dependency>-->
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>1.2.15</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpclient</artifactId>
|
||||||
|
<version>4.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
|
<artifactId>httpcore</artifactId>
|
||||||
|
<version>4.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-util</artifactId>
|
||||||
|
<version>9.3.7.v20160115</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--MQ-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!--fastDfs文件上传-->
|
<!--fastDfs文件上传-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.bwie.common.config;//package com.bw.config;
|
|
||||||
//
|
|
||||||
//import com.bw.job.MyJob;
|
|
||||||
//import com.bw.job.MyJob2;
|
|
||||||
//import org.quartz.*;
|
|
||||||
//import org.springframework.context.annotation.Bean;
|
|
||||||
//import org.springframework.context.annotation.Configuration;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * @BelongsProject: demo02
|
|
||||||
// * @BelongsPackage: com.bw.config
|
|
||||||
// * @Author: zhupengfei
|
|
||||||
// * @CreateTime: 2022-12-22 14:59
|
|
||||||
// */
|
|
||||||
////把当前类定义为 一个配置文件类
|
|
||||||
//@Configuration
|
|
||||||
//public class QuartzConfig {
|
|
||||||
// @Bean
|
|
||||||
// public JobDetail downloadDetail() {
|
|
||||||
// return JobBuilder.newJob(MyJob.class) //具体任务类
|
|
||||||
// .withIdentity("downloadJobDetail")
|
|
||||||
// .usingJobData("job_download","download movie")
|
|
||||||
// .storeDurably()
|
|
||||||
// .build();
|
|
||||||
// }
|
|
||||||
// //构建 Trigger 及 Scheduler
|
|
||||||
// @Bean
|
|
||||||
// public Trigger downloadTrigger() {
|
|
||||||
// return TriggerBuilder.newTrigger()
|
|
||||||
// .forJob(downloadDetail()) //关联上面的 jobDetail
|
|
||||||
// .withIdentity("downloadTrigger")
|
|
||||||
// .usingJobData("trigger_download","download")
|
|
||||||
// //cron 表达式设置每隔 15 秒执行一次
|
|
||||||
// .withSchedule(CronScheduleBuilder.cronSchedule("*/15 * * * * ?"))
|
|
||||||
// .build();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
|
@ -1,11 +1,6 @@
|
||||||
package com.bwie.common.constants;
|
package com.bwie.common.constants;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DongZl
|
|
||||||
* @description: Jwt常量
|
|
||||||
*/
|
|
||||||
public class JwtConstants {
|
public class JwtConstants {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户ID字段
|
* 用户ID字段
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +9,7 @@ public class JwtConstants {
|
||||||
/**
|
/**
|
||||||
* 用户名字段
|
* 用户名字段
|
||||||
*/
|
*/
|
||||||
public static final String DETAILS_USERNAME = "username";
|
public static final String DETAILS_USERNAME = "user_name";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户标识
|
* 用户标识
|
||||||
|
@ -26,4 +21,14 @@ public class JwtConstants {
|
||||||
*/
|
*/
|
||||||
public final static String SECRET = "abcdefghijklmnopqrstuvwxyz";
|
public final static String SECRET = "abcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机
|
||||||
|
*/
|
||||||
|
public static final String USER_PHONE = "user_phone";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户token 的键的前缀
|
||||||
|
*/
|
||||||
|
public static final String LOGIN_TOKEN = "login_token:";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:43
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Admin {
|
|
||||||
private Integer adminId;//管理员ID
|
|
||||||
private String username;//用户名
|
|
||||||
private String password;//密码
|
|
||||||
private String name;//姓名
|
|
||||||
private String contact;//联系方式
|
|
||||||
}
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zhx
|
||||||
|
* @Package: com.bwie.common.domain
|
||||||
|
* @Datetime: 2023/12/10 11:20
|
||||||
|
* @Filename: BloodPressure
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BloodPressure {
|
||||||
|
private Integer bpId;
|
||||||
|
private String userId;
|
||||||
|
private String userName;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date measurementTime;
|
||||||
|
private Integer systolicPressure;
|
||||||
|
private Integer diastolicPressure;
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zhx
|
||||||
|
* @Package: com.bwie.common.domain
|
||||||
|
* @Datetime: 2023/12/10 10:35
|
||||||
|
* @Filename: BloodSuger
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BloodSuger {
|
||||||
|
private Integer bsId;
|
||||||
|
private Integer userId;
|
||||||
|
private String userName;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date measurementTime;
|
||||||
|
private BigDecimal bloodSugarValue;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zhx
|
||||||
|
* @Package: com.bwie.common.domain
|
||||||
|
* @Datetime: 2023/12/10 11:56
|
||||||
|
* @Filename: DiabetesPatient
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DiabetesPatient {
|
||||||
|
|
||||||
|
private Integer patientId;
|
||||||
|
private Integer userId;
|
||||||
|
private String userName;
|
||||||
|
private Integer doctorId;
|
||||||
|
private String doctorName;
|
||||||
|
private String managementStatus;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:52
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Education {
|
|
||||||
private Integer contentId;//健康教育内容ID
|
|
||||||
private String title;//标题
|
|
||||||
private String content;//内容
|
|
||||||
@DateTimeFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒")
|
|
||||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒",timezone = "GTM+8")
|
|
||||||
private Date publishTime;//发布时间
|
|
||||||
}
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zhx
|
||||||
|
* @Package: com.bwie.common.domain
|
||||||
|
* @Datetime: 2023/12/10 11:31
|
||||||
|
* @Filename: HealthEducation
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HealthEducation {
|
||||||
|
|
||||||
|
private Integer contentId;
|
||||||
|
private String title;
|
||||||
|
private String content;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date publishTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zhx
|
||||||
|
* @Package: com.bwie.common.domain
|
||||||
|
* @Datetime: 2023/12/10 11:37
|
||||||
|
* @Filename: HealthRecords
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HealthRecords {
|
||||||
|
|
||||||
|
private Integer recordId;
|
||||||
|
private Integer userId;
|
||||||
|
private String userName;
|
||||||
|
private String medicalHistory;
|
||||||
|
private String drugAllergies;
|
||||||
|
private String surgicalHistory;
|
||||||
|
private String familyHistory;
|
||||||
|
|
||||||
|
}
|
|
@ -1,26 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 10:02
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class History {
|
|
||||||
private Integer historyId;//过往病史ID
|
|
||||||
private Integer userId;//用户ID
|
|
||||||
private String diseaseName;//疾病名称
|
|
||||||
@DateTimeFormat(pattern = "yyyy年MM月dd日")
|
|
||||||
@JsonFormat(pattern = "yyyy年MM月dd日",timezone = "GTM+8")
|
|
||||||
private Date onsetTime;//发病时间
|
|
||||||
private String treatmentStatus;//治疗情况
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:49
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Patient {
|
|
||||||
private Integer patientId;//糖尿病患者ID
|
|
||||||
private Integer userId;//用户ID
|
|
||||||
private Integer adminId;//医生ID
|
|
||||||
private Integer managementStatus;//管理状态
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:44
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Pressure {
|
|
||||||
private Integer bpId;//血压数据ID
|
|
||||||
private Integer userId;//用户ID
|
|
||||||
@DateTimeFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒")
|
|
||||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒",timezone = "GTM+8")
|
|
||||||
private Date measurementTime;//测量时间
|
|
||||||
private Integer systolicPressure;//收缩压
|
|
||||||
private Integer diastolicPressure;//舒张压
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:59
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Records {
|
|
||||||
private Integer recordId;//健康档案ID
|
|
||||||
private Integer userId;//用户ID
|
|
||||||
private String medicalHistory;//过往病史
|
|
||||||
private String drugAllergies;//药物过敏史
|
|
||||||
private String surgicalHistory;//手术史
|
|
||||||
private String familyHistory;//家族史
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:46
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Sugar {
|
|
||||||
private Integer bsId;//血糖数据ID
|
|
||||||
private Integer userId;//用户ID
|
|
||||||
@DateTimeFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒")
|
|
||||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒",timezone = "GTM+8")
|
|
||||||
private Date measurementTime;//测量时间
|
|
||||||
private Double bloodSugarValue;//血糖值
|
|
||||||
}
|
|
|
@ -2,19 +2,15 @@ package com.bwie.common.domain;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 10:03
|
|
||||||
*/
|
|
||||||
@Data
|
@Data
|
||||||
public class User {
|
public class User {
|
||||||
private Integer userId;//用户ID
|
private Integer userId;
|
||||||
private String username;//用户名
|
private String userName;
|
||||||
private String password;//密码
|
|
||||||
private String name;//姓名
|
private String code;
|
||||||
private String gender;//性别
|
private String token;
|
||||||
private Integer age;//年龄
|
|
||||||
private String contact;//联系方式
|
private String userPwd;
|
||||||
private Integer rank;//用户等级
|
private String phone;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
package com.bwie.common.domain.request;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 11:24
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class HistoryRequest {
|
|
||||||
private Integer rank;//用户ID
|
|
||||||
private Integer userId;//用户ID
|
|
||||||
@DateTimeFormat(pattern = "yyyy年MM月dd日")
|
|
||||||
@JsonFormat(pattern = "yyyy年MM月dd日",timezone = "GTM+8")
|
|
||||||
private Date StartDate;//开始时间
|
|
||||||
@DateTimeFormat(pattern = "yyyy年MM月dd日")
|
|
||||||
@JsonFormat(pattern = "yyyy年MM月dd日",timezone = "GTM+8")
|
|
||||||
private Date EndDate;//结束时间
|
|
||||||
private Integer pageNum=1;//分页页数
|
|
||||||
private Integer pageSize=5;//每页条数
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
package com.bwie.common.domain.request;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 11:21
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class UserLevel {
|
|
||||||
private Integer rank;//用户ID
|
|
||||||
private Integer userId;//用户ID
|
|
||||||
@DateTimeFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒")
|
|
||||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒",timezone = "GTM+8")
|
|
||||||
private Date StartDate;//开始时间
|
|
||||||
@DateTimeFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒")
|
|
||||||
@JsonFormat(pattern = "yyyy年MM月dd日 HH时mm分ss秒",timezone = "GTM+8")
|
|
||||||
private Date EndDate;//结束时间
|
|
||||||
private Integer pageNum=1;//分页页数
|
|
||||||
private Integer pageSize=5;//每页条数
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.bwie.common.domain.request;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 10:07
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class UserRequest {
|
|
||||||
private String name;
|
|
||||||
private String pwd;
|
|
||||||
}
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.bwie.common.domain.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName Userlogin
|
||||||
|
* @Description
|
||||||
|
* @Author zhengshixian
|
||||||
|
* @Date 2023/10/19 9:16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Userlogin {
|
||||||
|
private String phone;
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
public Userlogin(String phone, String code) {
|
||||||
|
this.phone = phone;
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Userlogin() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,14 +0,0 @@
|
||||||
package com.bwie.common.domain.response;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 10:07
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class JwtResponse {
|
|
||||||
private String token;
|
|
||||||
private String tokenMIN;
|
|
||||||
}
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.bwie.common.domain.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName UserResponse
|
||||||
|
* @Description
|
||||||
|
* @Author zhengshixian
|
||||||
|
* @Date 2023/10/19 9:17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserResponse {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 令牌
|
||||||
|
*/
|
||||||
|
private String token;
|
||||||
|
/**
|
||||||
|
* 保存时间
|
||||||
|
*/
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.bwie.common.utils;
|
package com.bwie.common.utils;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.RandomStringUtils;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.util.Base64Utils;
|
import org.springframework.util.Base64Utils;
|
||||||
|
@ -235,12 +236,8 @@ public class AESUtils {
|
||||||
|
|
||||||
|
|
||||||
//加密
|
//加密
|
||||||
String encrypt1 = encrypt ("12345", "1234567890004422");
|
String encrypt1 = encrypt ("123", "1234567890000000");
|
||||||
System.out.println ("12345加密后 1====================={"+encrypt1);
|
System.out.println ("123加密后 1====================={"+encrypt1);
|
||||||
String encrypt2 = encrypt ("23456", "1234567890004422");
|
|
||||||
System.out.println ("23456加密后 1====================={"+encrypt2);
|
|
||||||
String encrypt3 = encrypt ("56789", "1234567890004422");
|
|
||||||
System.out.println ("56789加密后 1====================={"+encrypt3);
|
|
||||||
|
|
||||||
//解密
|
//解密
|
||||||
// decrypt ("/83VCGvDN+C5pvYN/19pBQ==")
|
// decrypt ("/83VCGvDN+C5pvYN/19pBQ==")
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.common.utils;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CodeEntity {
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,19 @@
|
||||||
package com.bwie.common.utils;
|
package com.bwie.common.utils;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.security.KeyManagementException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.security.cert.X509Certificate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLContext;
|
||||||
|
import javax.net.ssl.TrustManager;
|
||||||
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.NameValuePair;
|
import org.apache.http.NameValuePair;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
|
@ -17,294 +31,282 @@ import org.apache.http.entity.StringEntity;
|
||||||
import org.apache.http.impl.client.DefaultHttpClient;
|
import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
import org.apache.http.message.BasicNameValuePair;
|
import org.apache.http.message.BasicNameValuePair;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
|
||||||
import javax.net.ssl.TrustManager;
|
|
||||||
import javax.net.ssl.X509TrustManager;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
import java.security.KeyManagementException;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.security.cert.X509Certificate;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class HttpUtils {
|
public class HttpUtils {
|
||||||
|
/**
|
||||||
|
* get
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doGet(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
/**
|
HttpGet request = new HttpGet(buildUrl(host, path, querys));
|
||||||
* get
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
*
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
* @param host
|
}
|
||||||
* @param path
|
|
||||||
* @param method
|
|
||||||
* @param headers
|
|
||||||
* @param querys
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static HttpResponse doGet(String host, String path, String method,
|
|
||||||
Map<String, String> headers,
|
|
||||||
Map<String, String> querys)
|
|
||||||
throws Exception {
|
|
||||||
HttpClient httpClient = wrapClient(host);
|
|
||||||
|
|
||||||
HttpGet request = new HttpGet(buildUrl(host, path, querys));
|
return httpClient.execute(request);
|
||||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
}
|
||||||
request.addHeader(e.getKey(), e.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
return httpClient.execute(request);
|
/**
|
||||||
}
|
* post form
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param bodys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
Map<String, String> bodys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
/**
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
* post form
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
*
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
* @param host
|
}
|
||||||
* @param path
|
|
||||||
* @param method
|
|
||||||
* @param headers
|
|
||||||
* @param querys
|
|
||||||
* @param bodys
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static HttpResponse doPost(String host, String path, String method,
|
|
||||||
Map<String, String> headers,
|
|
||||||
Map<String, String> querys,
|
|
||||||
Map<String, String> bodys)
|
|
||||||
throws Exception {
|
|
||||||
HttpClient httpClient = wrapClient(host);
|
|
||||||
|
|
||||||
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
if (bodys != null) {
|
||||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
|
||||||
request.addHeader(e.getKey(), e.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bodys != null) {
|
for (String key : bodys.keySet()) {
|
||||||
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
|
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
|
||||||
|
}
|
||||||
|
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
|
||||||
|
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
|
||||||
|
request.setEntity(formEntity);
|
||||||
|
}
|
||||||
|
|
||||||
for (String key : bodys.keySet()) {
|
return httpClient.execute(request);
|
||||||
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
|
}
|
||||||
}
|
|
||||||
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
|
|
||||||
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
|
|
||||||
request.setEntity(formEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
return httpClient.execute(request);
|
/**
|
||||||
}
|
* Post String
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
String body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
/**
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
* Post String
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
*
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
* @param host
|
}
|
||||||
* @param path
|
|
||||||
* @param method
|
|
||||||
* @param headers
|
|
||||||
* @param querys
|
|
||||||
* @param body
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static HttpResponse doPost(String host, String path, String method,
|
|
||||||
Map<String, String> headers,
|
|
||||||
Map<String, String> querys,
|
|
||||||
String body)
|
|
||||||
throws Exception {
|
|
||||||
HttpClient httpClient = wrapClient(host);
|
|
||||||
|
|
||||||
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
if (StringUtils.isNotBlank(body)) {
|
||||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
request.setEntity(new StringEntity(body, "utf-8"));
|
||||||
request.addHeader(e.getKey(), e.getValue());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(body)) {
|
return httpClient.execute(request);
|
||||||
request.setEntity(new StringEntity(body, "utf-8"));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return httpClient.execute(request);
|
/**
|
||||||
}
|
* Post stream
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPost(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
byte[] body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
/**
|
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||||
* Post stream
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
*
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
* @param host
|
}
|
||||||
* @param path
|
|
||||||
* @param method
|
|
||||||
* @param headers
|
|
||||||
* @param querys
|
|
||||||
* @param body
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static HttpResponse doPost(String host, String path, String method,
|
|
||||||
Map<String, String> headers,
|
|
||||||
Map<String, String> querys,
|
|
||||||
byte[] body)
|
|
||||||
throws Exception {
|
|
||||||
HttpClient httpClient = wrapClient(host);
|
|
||||||
|
|
||||||
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
if (body != null) {
|
||||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
request.setEntity(new ByteArrayEntity(body));
|
||||||
request.addHeader(e.getKey(), e.getValue());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (body != null) {
|
return httpClient.execute(request);
|
||||||
request.setEntity(new ByteArrayEntity(body));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return httpClient.execute(request);
|
/**
|
||||||
}
|
* Put String
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPut(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
String body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
/**
|
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||||
* Put String
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
* @param host
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
* @param path
|
}
|
||||||
* @param method
|
|
||||||
* @param headers
|
|
||||||
* @param querys
|
|
||||||
* @param body
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static HttpResponse doPut(String host, String path, String method,
|
|
||||||
Map<String, String> headers,
|
|
||||||
Map<String, String> querys,
|
|
||||||
String body)
|
|
||||||
throws Exception {
|
|
||||||
HttpClient httpClient = wrapClient(host);
|
|
||||||
|
|
||||||
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
if (StringUtils.isNotBlank(body)) {
|
||||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
request.setEntity(new StringEntity(body, "utf-8"));
|
||||||
request.addHeader(e.getKey(), e.getValue());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(body)) {
|
return httpClient.execute(request);
|
||||||
request.setEntity(new StringEntity(body, "utf-8"));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return httpClient.execute(request);
|
/**
|
||||||
}
|
* Put stream
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @param body
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doPut(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys,
|
||||||
|
byte[] body)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
/**
|
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||||
* Put stream
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
* @param host
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
* @param path
|
}
|
||||||
* @param method
|
|
||||||
* @param headers
|
|
||||||
* @param querys
|
|
||||||
* @param body
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static HttpResponse doPut(String host, String path, String method,
|
|
||||||
Map<String, String> headers,
|
|
||||||
Map<String, String> querys,
|
|
||||||
byte[] body)
|
|
||||||
throws Exception {
|
|
||||||
HttpClient httpClient = wrapClient(host);
|
|
||||||
|
|
||||||
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
if (body != null) {
|
||||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
request.setEntity(new ByteArrayEntity(body));
|
||||||
request.addHeader(e.getKey(), e.getValue());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (body != null) {
|
return httpClient.execute(request);
|
||||||
request.setEntity(new ByteArrayEntity(body));
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return httpClient.execute(request);
|
/**
|
||||||
}
|
* Delete
|
||||||
|
*
|
||||||
|
* @param host
|
||||||
|
* @param path
|
||||||
|
* @param method
|
||||||
|
* @param headers
|
||||||
|
* @param querys
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static HttpResponse doDelete(String host, String path, String method,
|
||||||
|
Map<String, String> headers,
|
||||||
|
Map<String, String> querys)
|
||||||
|
throws Exception {
|
||||||
|
HttpClient httpClient = wrapClient(host);
|
||||||
|
|
||||||
/**
|
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
|
||||||
* Delete
|
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||||
*
|
request.addHeader(e.getKey(), e.getValue());
|
||||||
* @param host
|
}
|
||||||
* @param path
|
|
||||||
* @param method
|
|
||||||
* @param headers
|
|
||||||
* @param querys
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static HttpResponse doDelete(String host, String path, String method,
|
|
||||||
Map<String, String> headers,
|
|
||||||
Map<String, String> querys)
|
|
||||||
throws Exception {
|
|
||||||
HttpClient httpClient = wrapClient(host);
|
|
||||||
|
|
||||||
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
|
return httpClient.execute(request);
|
||||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
}
|
||||||
request.addHeader(e.getKey(), e.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
return httpClient.execute(request);
|
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
|
||||||
}
|
StringBuilder sbUrl = new StringBuilder();
|
||||||
|
sbUrl.append(host);
|
||||||
|
if (!StringUtils.isBlank(path)) {
|
||||||
|
sbUrl.append(path);
|
||||||
|
}
|
||||||
|
if (null != querys) {
|
||||||
|
StringBuilder sbQuery = new StringBuilder();
|
||||||
|
for (Map.Entry<String, String> query : querys.entrySet()) {
|
||||||
|
if (0 < sbQuery.length()) {
|
||||||
|
sbQuery.append("&");
|
||||||
|
}
|
||||||
|
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
|
||||||
|
sbQuery.append(query.getValue());
|
||||||
|
}
|
||||||
|
if (!StringUtils.isBlank(query.getKey())) {
|
||||||
|
sbQuery.append(query.getKey());
|
||||||
|
if (!StringUtils.isBlank(query.getValue())) {
|
||||||
|
sbQuery.append("=");
|
||||||
|
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (0 < sbQuery.length()) {
|
||||||
|
sbUrl.append("?").append(sbQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
|
return sbUrl.toString();
|
||||||
StringBuilder sbUrl = new StringBuilder();
|
}
|
||||||
sbUrl.append(host);
|
|
||||||
if (!StringUtils.isBlank(path)) {
|
|
||||||
sbUrl.append(path);
|
|
||||||
}
|
|
||||||
if (null != querys) {
|
|
||||||
StringBuilder sbQuery = new StringBuilder();
|
|
||||||
for (Map.Entry<String, String> query : querys.entrySet()) {
|
|
||||||
if (0 < sbQuery.length()) {
|
|
||||||
sbQuery.append("&");
|
|
||||||
}
|
|
||||||
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
|
|
||||||
sbQuery.append(query.getValue());
|
|
||||||
}
|
|
||||||
if (!StringUtils.isBlank(query.getKey())) {
|
|
||||||
sbQuery.append(query.getKey());
|
|
||||||
if (!StringUtils.isBlank(query.getValue())) {
|
|
||||||
sbQuery.append("=");
|
|
||||||
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (0 < sbQuery.length()) {
|
|
||||||
sbUrl.append("?").append(sbQuery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sbUrl.toString();
|
private static HttpClient wrapClient(String host) {
|
||||||
}
|
HttpClient httpClient = new DefaultHttpClient();
|
||||||
|
if (host.startsWith("https://")) {
|
||||||
|
sslClient(httpClient);
|
||||||
|
}
|
||||||
|
|
||||||
private static HttpClient wrapClient(String host) {
|
return httpClient;
|
||||||
HttpClient httpClient = new DefaultHttpClient();
|
}
|
||||||
if (host.startsWith("https://")) {
|
|
||||||
sslClient(httpClient);
|
|
||||||
}
|
|
||||||
|
|
||||||
return httpClient;
|
private static void sslClient(HttpClient httpClient) {
|
||||||
}
|
try {
|
||||||
|
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||||
|
X509TrustManager tm = new X509TrustManager() {
|
||||||
|
public X509Certificate[] getAcceptedIssuers() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public void checkClientTrusted(X509Certificate[] xcs, String str) {
|
||||||
|
|
||||||
private static void sslClient(HttpClient httpClient) {
|
}
|
||||||
try {
|
public void checkServerTrusted(X509Certificate[] xcs, String str) {
|
||||||
SSLContext ctx = SSLContext.getInstance("TLS");
|
|
||||||
X509TrustManager tm = new X509TrustManager() {
|
|
||||||
public X509Certificate[] getAcceptedIssuers() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public void checkClientTrusted(X509Certificate[] xcs, String str) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void checkServerTrusted(X509Certificate[] xcs, String str) {
|
};
|
||||||
|
ctx.init(null, new TrustManager[] { tm }, null);
|
||||||
|
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
|
||||||
|
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||||
|
ClientConnectionManager ccm = httpClient.getConnectionManager();
|
||||||
|
SchemeRegistry registry = ccm.getSchemeRegistry();
|
||||||
|
registry.register(new Scheme("https", 443, ssf));
|
||||||
|
} catch (KeyManagementException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
ctx.init(null, new TrustManager[] { tm }, null);
|
|
||||||
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
|
|
||||||
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
|
||||||
ClientConnectionManager ccm = httpClient.getConnectionManager();
|
|
||||||
SchemeRegistry registry = ccm.getSchemeRegistry();
|
|
||||||
registry.register(new Scheme("https", 443, ssf));
|
|
||||||
} catch (KeyManagementException ex) {
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,41 +1,66 @@
|
||||||
package com.bwie.common.utils;
|
package com.bwie.common.utils;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.springframework.cache.annotation.CachePut;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author
|
|
||||||
* @version 1.0.0
|
|
||||||
* @ClassName MsgUtil.java
|
|
||||||
* @Description TODO
|
|
||||||
* @createTime 2022年05月26日 15:49:00
|
|
||||||
*/
|
|
||||||
@Component
|
@Component
|
||||||
public class MsgUtil {
|
public class MsgUtil {
|
||||||
|
//取code
|
||||||
|
@Cacheable(key = "#phone",value = "bbb")
|
||||||
|
public String getCacheCode(String phone){
|
||||||
|
|
||||||
public void sendMsg(String phone,String code){
|
return null;
|
||||||
String host = "http://dingxin.market.alicloudapi.com";
|
}
|
||||||
String path = "/dx/sendSms";
|
|
||||||
|
//把当前注解的返回值装进去 //存code
|
||||||
|
@CachePut(key = "#codeEntity.phone",value = "bbb")
|
||||||
|
public String saveCacheCode(CodeEntity codeEntity){
|
||||||
|
|
||||||
|
return codeEntity.getCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String sendMsg(String phone,String code){
|
||||||
|
String result = null;
|
||||||
|
String host = "https://gyytz.market.alicloudapi.com";
|
||||||
|
String path = "/sms/smsSend";
|
||||||
String method = "POST";
|
String method = "POST";
|
||||||
String appcode = "dcb3dabebd3843a7a138901659ed112e";
|
String appcode = "7ac0173f69ac4737a4ec5a5c4c6ca3b5";
|
||||||
Map<String, String> headers = new HashMap<String, String>();
|
Map<String, String> headers = new HashMap<String, String>();
|
||||||
|
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
||||||
headers.put("Authorization", "APPCODE " + appcode);
|
headers.put("Authorization", "APPCODE " + appcode);
|
||||||
Map<String, String> querys = new HashMap<String, String>();
|
Map<String, String> querys = new HashMap<String, String>();
|
||||||
querys.put("mobile", phone);
|
querys.put("mobile", phone);
|
||||||
querys.put("param", "code:"+code);
|
querys.put("param", "**code**:"+code+",**minute**:5");
|
||||||
querys.put("tpl_id", "TP1711063");
|
|
||||||
|
//smsSignId(短信前缀)和templateId(短信模板),可登录国阳云控制台自助申请。参考文档:http://help.guoyangyun.com/Problem/Qm.html
|
||||||
|
|
||||||
|
querys.put("smsSignId", "2e65b1bb3d054466b82f0c9d125465e2");
|
||||||
|
querys.put("templateId", "908e94ccf08b4476ba6c876d13f084ad");
|
||||||
Map<String, String> bodys = new HashMap<String, String>();
|
Map<String, String> bodys = new HashMap<String, String>();
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
/**
|
||||||
|
* 重要提示如下:
|
||||||
|
* HttpUtils请从\r\n\t \t* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java\r\n\t \t* 下载
|
||||||
|
*
|
||||||
|
* 相应的依赖请参照
|
||||||
|
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
|
||||||
|
*/
|
||||||
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
||||||
System.out.println(response.toString());
|
// System.out.println(response.toString());
|
||||||
|
//获取response的body
|
||||||
|
result = EntityUtils.toString(response.getEntity());
|
||||||
|
System.out.println(result);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -4,8 +4,8 @@
|
||||||
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">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bwie</groupId>
|
<groupId>com.bw</groupId>
|
||||||
<artifactId>day_12_10_1</artifactId>
|
<artifactId>day02</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- 公共模块 -->
|
<!-- 公共模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.bwie</groupId>
|
<groupId>com.bw</groupId>
|
||||||
<artifactId>bwie-common</artifactId>
|
<artifactId>bwie-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 网关依赖 -->
|
<!-- 网关依赖 -->
|
||||||
|
|
|
@ -4,13 +4,16 @@ import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version: java version 1.8
|
* @Author: zhx
|
||||||
* @author: liguangyao
|
* @Package: com.bwie
|
||||||
* @date: 2023-12-10 上午 10:39
|
* @Datetime: 2023/12/10 14:43
|
||||||
|
* @Filename: GateWayApplication
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class GatApplication {
|
public class GateWayApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(GatApplication.class);
|
|
||||||
|
SpringApplication.run(GateWayApplication.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.bwie.gateway.filters;
|
||||||
|
|
||||||
|
import com.bwie.common.constants.JwtConstants;
|
||||||
|
import com.bwie.common.utils.JwtUtils;
|
||||||
|
import com.bwie.common.utils.StringUtils;
|
||||||
|
import com.bwie.gateway.config.IgnoreWhiteConfig;
|
||||||
|
import com.bwie.gateway.utils.GatewayUtils;
|
||||||
|
|
||||||
|
import io.jsonwebtoken.Claims;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
||||||
|
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
||||||
|
import org.springframework.core.Ordered;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.server.ServerWebExchange;
|
||||||
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class AuthFilter implements GlobalFilter, Ordered {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String,Object> redisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IgnoreWhiteConfig ignoreWhiteConfig;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
||||||
|
|
||||||
|
//获取白名单
|
||||||
|
List<String> whites = ignoreWhiteConfig.getWhites();
|
||||||
|
|
||||||
|
//路径
|
||||||
|
ServerHttpRequest request = exchange.getRequest();
|
||||||
|
String path = request.getURI().getPath();
|
||||||
|
System.out.println("路径>>>>>>"+path);
|
||||||
|
|
||||||
|
//放行
|
||||||
|
if (StringUtils.matches(path,whites)){
|
||||||
|
return chain.filter(exchange);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// //获取token
|
||||||
|
// String token = request.getHeaders().getFirst("token");
|
||||||
|
// if(token==null){
|
||||||
|
// return GatewayUtils.errorResponse(exchange,"token不存在");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //token合法性
|
||||||
|
// Claims claims = null;
|
||||||
|
// try {
|
||||||
|
// claims = JwtUtils.parseToken(token);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// return GatewayUtils.errorResponse(exchange,"token不合法");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (!redisTemplate.hasKey(JwtConstants.LOGIN_TOKEN+token)){
|
||||||
|
// return GatewayUtils.errorResponse(exchange,"token过期");
|
||||||
|
// }
|
||||||
|
// redisTemplate.expire(JwtConstants.LOGIN_TOKEN+token,10, TimeUnit.MINUTES);
|
||||||
|
return chain.filter(exchange);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOrder() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,79 +0,0 @@
|
||||||
package com.bwie.gateway.filters;
|
|
||||||
|
|
||||||
import cn.hutool.db.Page;
|
|
||||||
import com.bwie.common.constants.JwtConstants;
|
|
||||||
import com.bwie.common.utils.JwtUtils;
|
|
||||||
import com.bwie.common.utils.StringUtils;
|
|
||||||
import com.bwie.gateway.config.IgnoreWhiteConfig;
|
|
||||||
import com.bwie.gateway.utils.GatewayUtils;
|
|
||||||
import io.jsonwebtoken.Claims;
|
|
||||||
import io.jsonwebtoken.Jwt;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
|
|
||||||
import org.springframework.cloud.gateway.filter.GlobalFilter;
|
|
||||||
import org.springframework.core.Ordered;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.server.ServerWebExchange;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 10:29
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@Log4j2
|
|
||||||
public class GatewayFilers implements GlobalFilter, Ordered {
|
|
||||||
@Autowired
|
|
||||||
private IgnoreWhiteConfig ignoreWhiteConfig;
|
|
||||||
@Autowired
|
|
||||||
private StringRedisTemplate redisTemplate;
|
|
||||||
@Override
|
|
||||||
public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
|
|
||||||
|
|
||||||
//获取白名单
|
|
||||||
List<String> whites = ignoreWhiteConfig.getWhites();
|
|
||||||
//获取操作路径
|
|
||||||
ServerHttpRequest request = exchange.getRequest();
|
|
||||||
String path = request.getURI().getPath();
|
|
||||||
log.info("用户操作的路径是{}",path);
|
|
||||||
//对路径进行匹配
|
|
||||||
if(StringUtils.matches(path,whites)){
|
|
||||||
//通过就放行
|
|
||||||
return chain.filter(exchange);
|
|
||||||
}
|
|
||||||
//获取token
|
|
||||||
String token = request.getHeaders().getFirst("token");
|
|
||||||
if(token==null) {
|
|
||||||
return GatewayUtils.errorResponse(exchange,"token必须携带");
|
|
||||||
}
|
|
||||||
//判断token的合法性
|
|
||||||
try {
|
|
||||||
Claims claims = JwtUtils.parseToken(token);
|
|
||||||
} catch (Exception e) {
|
|
||||||
//不合法
|
|
||||||
return GatewayUtils.errorResponse(exchange,"token不合法");
|
|
||||||
}
|
|
||||||
//判断token的时效性
|
|
||||||
Long expire = redisTemplate.getExpire(JwtConstants.USER_KEY + token);
|
|
||||||
//存入的token是15分钟也就是900秒在token剩余10分钟的时候在进行续期
|
|
||||||
if (expire<=600L){
|
|
||||||
//小于10分钟进行续期操作
|
|
||||||
log.info("token进行续期续期15分钟");
|
|
||||||
redisTemplate.expire(JwtConstants.USER_KEY+token,15, TimeUnit.MINUTES);
|
|
||||||
}
|
|
||||||
log.info("token通过");
|
|
||||||
return chain.filter(exchange);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOrder() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,10 +18,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 124.221.202.137:8848
|
server-addr: 124.223.114.120:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 124.221.202.137:8848
|
server-addr: 124.223.114.120:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -4,12 +4,12 @@
|
||||||
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">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bwie</groupId>
|
<groupId>com.bw</groupId>
|
||||||
<artifactId>bwie-modules</artifactId>
|
<artifactId>bwie-modules</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bwie-lists</artifactId>
|
<artifactId>bwie-blood</artifactId>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- 系统公共 依赖 -->
|
<!-- 系统公共 依赖 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.bwie</groupId>
|
<groupId>com.bw</groupId>
|
||||||
<artifactId>bwie-common</artifactId>
|
<artifactId>bwie-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- SpringBoot Web-->
|
<!-- SpringBoot Web-->
|
|
@ -4,14 +4,18 @@ import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version: java version 1.8
|
* @Author: zhx
|
||||||
* @author: liguangyao
|
* @Package: com.bwie
|
||||||
* @date: 2023-12-10 上午 9:36
|
* @Datetime: 2023/12/10 10:46
|
||||||
|
* @Filename: BloodApplication
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class UserApplication {
|
public class BloodApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(UserApplication.class);
|
|
||||||
|
SpringApplication.run(BloodApplication.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.bwie.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.service.BloodService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zhx
|
||||||
|
* @Package: com.bwie.controller
|
||||||
|
* @Datetime: 2023/12/10 10:39
|
||||||
|
* @Filename: BloodController
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Log4j2
|
||||||
|
public class BloodController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BloodService bloodService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
@GetMapping("/bloodList")
|
||||||
|
public Result bloodList(){
|
||||||
|
|
||||||
|
log.info("功能名称:获取个人血糖数据,请求URI:{},请求方式:{},请求参数:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),null);
|
||||||
|
Result result = bloodService.bloodList();
|
||||||
|
log.info("功能名称:获取个人血糖数据,请求URI:{},请求方式:{},响应结果:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/BloodPressureList")
|
||||||
|
public Result BloodPressure(){
|
||||||
|
log.info("功能名称:获取个人血压数据,请求URI:{},请求方式:{},请求参数:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),null);
|
||||||
|
Result result = bloodService.BloodPressure();
|
||||||
|
log.info("功能名称:获取个人血压数据,请求URI:{},请求方式:{},响应结果:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/HealthEducationList")
|
||||||
|
public Result HealthEducationList(){
|
||||||
|
log.info("功能名称:获取健康教育内容,请求URI:{},请求方式:{},请求参数:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),null);
|
||||||
|
Result result = bloodService.HealthEducationList();
|
||||||
|
log.info("功能名称:获取健康教育内容,请求URI:{},请求方式:{},响应结果:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@GetMapping("/HealthRecordsList")
|
||||||
|
public Result HealthRecordsList(){
|
||||||
|
log.info("功能名称:获取健康档案,请求URI:{},请求方式:{},请求参数:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),null);
|
||||||
|
Result result = bloodService.HealthRecordsList();
|
||||||
|
log.info("功能名称:获取获取健康档案,请求URI:{},请求方式:{},响应结果:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/DiabetesPatientList")
|
||||||
|
public Result DiabetesPatientList(){
|
||||||
|
log.info("功能名称:获取糖尿病列表,请求URI:{},请求方式:{},请求参数:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(),null);
|
||||||
|
Result result = bloodService.DiabetesPatientList();
|
||||||
|
log.info("功能名称:获取糖尿病列表,请求URI:{},请求方式:{},响应结果:{}",
|
||||||
|
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.bwie.mapper;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.*;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zhx
|
||||||
|
* @Package: com.bwie.mapper
|
||||||
|
* @Datetime: 2023/12/10 10:41
|
||||||
|
* @Filename: BloodMapper
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BloodMapper {
|
||||||
|
|
||||||
|
|
||||||
|
List<BloodSuger> bloodList(@Param("userId") Integer userId);
|
||||||
|
|
||||||
|
|
||||||
|
List<BloodPressure> BloodPressure(@Param("userId") Integer userId);
|
||||||
|
|
||||||
|
List<HealthEducation> HealthEducationList();
|
||||||
|
|
||||||
|
|
||||||
|
List<HealthRecords> HealthRecordsList(@Param("userId") Integer userId);
|
||||||
|
|
||||||
|
List<DiabetesPatient> DiabetesPatientList(@Param("userId") Integer userId);
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.bwie.service;
|
||||||
|
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zhx
|
||||||
|
* @Package: com.bwie.service
|
||||||
|
* @Datetime: 2023/12/10 10:40
|
||||||
|
* @Filename: BloodService
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface BloodService {
|
||||||
|
Result bloodList();
|
||||||
|
|
||||||
|
|
||||||
|
Result BloodPressure();
|
||||||
|
|
||||||
|
|
||||||
|
Result HealthEducationList();
|
||||||
|
|
||||||
|
|
||||||
|
Result HealthRecordsList();
|
||||||
|
|
||||||
|
|
||||||
|
Result DiabetesPatientList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.bwie.service.impl;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.*;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.mapper.BloodMapper;
|
||||||
|
import com.bwie.service.BloodService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: zhx
|
||||||
|
* @Package: com.bwie.service.impl
|
||||||
|
* @Datetime: 2023/12/10 10:40
|
||||||
|
* @Filename: BloodServiceImpl
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BloodServiceImpl implements BloodService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BloodMapper bloodMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result bloodList() {
|
||||||
|
Integer userId = null;
|
||||||
|
List<BloodSuger> list = bloodMapper.bloodList(userId);
|
||||||
|
Result result = Result.success(list);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result BloodPressure() {
|
||||||
|
|
||||||
|
Integer userId = null;
|
||||||
|
|
||||||
|
|
||||||
|
List<BloodPressure> list = bloodMapper.BloodPressure(userId);
|
||||||
|
Result result = Result.success(list);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result HealthEducationList() {
|
||||||
|
List<HealthEducation> list = bloodMapper.HealthEducationList();
|
||||||
|
Result result = Result.success(list);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result HealthRecordsList() {
|
||||||
|
Integer userId = null;
|
||||||
|
|
||||||
|
|
||||||
|
List<HealthRecords> list = bloodMapper.HealthRecordsList(userId);
|
||||||
|
Result result = Result.success(list);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result DiabetesPatientList() {
|
||||||
|
|
||||||
|
Integer userId = null;
|
||||||
|
|
||||||
|
|
||||||
|
List<DiabetesPatient> list = bloodMapper.DiabetesPatientList(userId);
|
||||||
|
Result result = Result.success(list);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9006
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bwie-blood
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 124.223.114.120:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 124.223.114.120:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
fdfs:
|
||||||
|
so-timeout: 1500 # socket 连接时长
|
||||||
|
connect-timeout: 600 # 连接 tracker 服务器超时时长
|
||||||
|
# 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
|
||||||
|
tracker-list: 124.223.114.120:22122
|
||||||
|
web-server-url: 124.223.114.120:8888
|
||||||
|
pool:
|
||||||
|
jmx-enabled: false
|
||||||
|
# 生成缩略图
|
||||||
|
thumb-image:
|
||||||
|
height: 500
|
||||||
|
width: 500
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.bwie.mapper.BloodMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="bloodList" resultType="com.bwie.common.domain.BloodSuger">
|
||||||
|
select b.*,u.username from blood_sugar b left join user_info u on b.user_id=u.user_id
|
||||||
|
<where>
|
||||||
|
<if test="userId!=null">
|
||||||
|
u.user_id=#{userId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="BloodPressure" resultType="com.bwie.common.domain.BloodPressure">
|
||||||
|
select b.*,u.username from blood_pressure b left join user_info u on b.user_id=u.user_id
|
||||||
|
<where>
|
||||||
|
<if test="userId!=null">
|
||||||
|
u.user_id=#{userId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="HealthEducationList" resultType="com.bwie.common.domain.HealthEducation">
|
||||||
|
select * from health_education
|
||||||
|
</select>
|
||||||
|
<select id="HealthRecordsList" resultType="com.bwie.common.domain.HealthRecords">
|
||||||
|
select h.*,u.username from health_records h left join user_info u on h.user_id=u.user_id
|
||||||
|
<where>
|
||||||
|
<if test="userId!=null">
|
||||||
|
u.user_id=#{userId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
<select id="DiabetesPatientList" resultType="com.bwie.common.domain.DiabetesPatient">
|
||||||
|
select d.*,u.username,a.username from diabetes_patient d left join user_info u on d.user_id=u.user_id left join admin_account a on a.admin_id=d.doctor_id
|
||||||
|
<where>
|
||||||
|
<if test="userId!=null">
|
||||||
|
u.user_id=#{userId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -1,18 +0,0 @@
|
||||||
package com.bwie;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:39
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableFeignClients
|
|
||||||
public class ListsApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(ListsApplication.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.bwie.config;
|
|
||||||
|
|
||||||
import com.bwie.service.feign.mqFeign;
|
|
||||||
import feign.Retryer;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-11 上午 9:35
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class FeignClient implements mqFeign {
|
|
||||||
@Bean
|
|
||||||
public Retryer retryer(){
|
|
||||||
return new Retryer.Default(5000,30000,3);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,210 +0,0 @@
|
||||||
package com.bwie.controller;
|
|
||||||
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Education;
|
|
||||||
import com.bwie.common.domain.History;
|
|
||||||
import com.bwie.common.domain.Patient;
|
|
||||||
import com.bwie.common.domain.Pressure;
|
|
||||||
import com.bwie.common.domain.Records;
|
|
||||||
import com.bwie.common.domain.Sugar;
|
|
||||||
import com.bwie.common.domain.request.HistoryRequest;
|
|
||||||
import com.bwie.common.domain.request.UserLevel;
|
|
||||||
import com.bwie.common.result.PageResult;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.service.ListsService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:35
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
public class ListsController {
|
|
||||||
@Autowired
|
|
||||||
private ListsService listsService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述
|
|
||||||
* 健康列表
|
|
||||||
* @author liguangyao
|
|
||||||
* @Date 2023/12/10
|
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/educationList")
|
|
||||||
public Result<List<Education>> educationList(){
|
|
||||||
Result<List<Education>> result = listsService.educationList();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/educationAdd")
|
|
||||||
public Result educationAdd(@RequestBody Education education){
|
|
||||||
Result result = listsService.educationAdd(education);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/educationDel")
|
|
||||||
public Result educationDel(@RequestParam("contentId")String contentId){
|
|
||||||
Result result = listsService.educationDel(contentId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/educationUpd")
|
|
||||||
public Result educationUpd(@RequestBody Education education){
|
|
||||||
Result result = listsService.educationUpd(education);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//以下的功能是根据登录人进行查看各自只能看各自的管理员登录查看所有并且可以操作
|
|
||||||
/**
|
|
||||||
* 功能描述
|
|
||||||
* 过往病史列表History
|
|
||||||
* @author liguangyao
|
|
||||||
* @Date 2023/12/10
|
|
||||||
* @param historyRequest
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/historyList")
|
|
||||||
public Result<PageResult<History>> historyList(@RequestBody HistoryRequest historyRequest){
|
|
||||||
Result<PageResult<History>> result = listsService.historyList(historyRequest);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/historyAdd")
|
|
||||||
public Result historyAdd(@RequestBody History history){
|
|
||||||
Result result = listsService.historyAdd(history);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/historyUpd")
|
|
||||||
public Result historyUpd(@RequestBody History history){
|
|
||||||
Result result = listsService.historyUpd(history);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/historyDel")
|
|
||||||
public Result historyDel(@RequestParam("historyId") String historyId){
|
|
||||||
Result result = listsService.historyDel(historyId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 功能描述
|
|
||||||
* 糖尿病管理列表Patient只能管理员进行查看
|
|
||||||
* @author liguangyao
|
|
||||||
* @Date 2023/12/10
|
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/patientList")
|
|
||||||
public Result<PageResult<Patient>> patientList(@RequestBody UserLevel userLevel){
|
|
||||||
Result<PageResult<Patient>> result = listsService.patientList(userLevel);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/patientDel")
|
|
||||||
public Result patientDel(@RequestParam("patientId") String patientId){
|
|
||||||
Result result = listsService.patientDel(patientId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/patientAdd")
|
|
||||||
public Result patientAdd(@RequestBody Patient patient){
|
|
||||||
Result result = listsService.patientAdd(patient);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/patientUpd")
|
|
||||||
public Result patientUpd(@RequestBody Patient patient){
|
|
||||||
Result result = listsService.patientUpd(patient);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 功能描述
|
|
||||||
* 血压数据列表Pressure
|
|
||||||
* @author liguangyao
|
|
||||||
* @Date 2023/12/10
|
|
||||||
* @param userLevel
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/pressureList")
|
|
||||||
public Result<PageResult<Pressure>> pressureList(@RequestBody UserLevel userLevel){
|
|
||||||
Result<PageResult<Pressure>> result = listsService.pressureList(userLevel);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/pressureDel")
|
|
||||||
public Result pressureDel(@RequestParam("pressureId") String pressureId){
|
|
||||||
Result result = listsService.pressureDel(pressureId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/pressureAdd")
|
|
||||||
public Result pressureAdd(@RequestBody Pressure pressure){
|
|
||||||
Result result = listsService.pressureAdd(pressure);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/pressureUpd")
|
|
||||||
public Result pressureUpd(@RequestBody Pressure pressure){
|
|
||||||
Result result = listsService.pressureUpd(pressure);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 功能描述
|
|
||||||
* 健康档案表Records
|
|
||||||
* @author liguangyao
|
|
||||||
* @Date 2023/12/10
|
|
||||||
* @param userLevel
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/recordsList")
|
|
||||||
public Result<PageResult<Records>> recordsList(@RequestBody UserLevel userLevel){
|
|
||||||
Result<PageResult<Records>> result = listsService.recordsList(userLevel);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/recordsDel")
|
|
||||||
public Result recordsDel(@RequestParam("records") String recordsId){
|
|
||||||
Result result = listsService.recordsDel(recordsId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/recordsAdd")
|
|
||||||
public Result recordsAdd(@RequestBody Records records){
|
|
||||||
Result result = listsService.recordsAdd(records);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/recordsUpd")
|
|
||||||
public Result recordsUpd(@RequestBody Records records){
|
|
||||||
Result result = listsService.recordsUpd(records);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 功能描述
|
|
||||||
* 血糖表Sugar
|
|
||||||
* @author liguangyao
|
|
||||||
* @Date 2023/12/10
|
|
||||||
* @param userLevel
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@PostMapping("/sugarList")
|
|
||||||
public Result<PageResult<Sugar>> sugarList(@RequestBody UserLevel userLevel){
|
|
||||||
Result<PageResult<Sugar>> result = listsService.sugarList(userLevel);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/sugarDel")
|
|
||||||
public Result sugarDel(@RequestParam("sugarId") Sugar sugarId){
|
|
||||||
Result result = listsService.sugarDel(sugarId);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/sugarAdd")
|
|
||||||
public Result sugarAdd(@RequestBody Sugar sugar){
|
|
||||||
Result result = listsService.sugarAdd(sugar);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@PostMapping("/sugarUpd")
|
|
||||||
public Result sugarUpd(@RequestBody Sugar sugar){
|
|
||||||
Result result = listsService.sugarUpd(sugar);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
package com.bwie.mapper;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Education;
|
|
||||||
import com.bwie.common.domain.History;
|
|
||||||
import com.bwie.common.domain.Patient;
|
|
||||||
import com.bwie.common.domain.Pressure;
|
|
||||||
import com.bwie.common.domain.Records;
|
|
||||||
import com.bwie.common.domain.Sugar;
|
|
||||||
import com.bwie.common.domain.request.HistoryRequest;
|
|
||||||
import com.bwie.common.domain.request.UserLevel;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:38
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface ListsMapper {
|
|
||||||
List<Education> educationList();
|
|
||||||
|
|
||||||
List<History> historyList(HistoryRequest historyRequest);
|
|
||||||
|
|
||||||
List<Patient> patientList(UserLevel userLevel);
|
|
||||||
|
|
||||||
List<Pressure> pressureList(UserLevel userLevel);
|
|
||||||
|
|
||||||
List<Records> recordsList(UserLevel userLevel);
|
|
||||||
|
|
||||||
List<Sugar> sugarList(UserLevel userLevel);
|
|
||||||
|
|
||||||
Integer getUser(String name);
|
|
||||||
|
|
||||||
Integer educationAdd(Education education);
|
|
||||||
|
|
||||||
Integer educationDel(@Param("contentId") String contentId);
|
|
||||||
|
|
||||||
Integer educationUpd(Education education);
|
|
||||||
|
|
||||||
Integer historyAdd(History history);
|
|
||||||
|
|
||||||
Integer historyUpd(History history);
|
|
||||||
|
|
||||||
Integer historyDel(@Param("historyId") String historyId);
|
|
||||||
|
|
||||||
Integer patientDel(@Param("patientId") String patientId);
|
|
||||||
|
|
||||||
Integer patientAdd(Patient patient);
|
|
||||||
|
|
||||||
Integer patientUpd(Patient patient);
|
|
||||||
|
|
||||||
Integer pressureDel(@Param("pressureId") String pressureId);
|
|
||||||
|
|
||||||
Integer pressureAdd(Pressure pressure);
|
|
||||||
|
|
||||||
Integer pressureUpd(Pressure pressure);
|
|
||||||
|
|
||||||
Integer recordsDel(@Param("recordsId") String recordsId);
|
|
||||||
|
|
||||||
Integer recordsAdd(Records records);
|
|
||||||
|
|
||||||
Integer recordsUpd(Records records);
|
|
||||||
|
|
||||||
Integer sugarDel(@Param("sugarId") Sugar sugarId);
|
|
||||||
|
|
||||||
Integer sugarAdd(Sugar sugar);
|
|
||||||
|
|
||||||
Integer sugarUpd(Sugar sugar);
|
|
||||||
}
|
|
|
@ -1,69 +0,0 @@
|
||||||
package com.bwie.service;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Education;
|
|
||||||
import com.bwie.common.domain.History;
|
|
||||||
import com.bwie.common.domain.Patient;
|
|
||||||
import com.bwie.common.domain.Pressure;
|
|
||||||
import com.bwie.common.domain.Records;
|
|
||||||
import com.bwie.common.domain.Sugar;
|
|
||||||
import com.bwie.common.domain.request.HistoryRequest;
|
|
||||||
import com.bwie.common.domain.request.UserLevel;
|
|
||||||
import com.bwie.common.result.PageResult;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:37
|
|
||||||
*/
|
|
||||||
public interface ListsService {
|
|
||||||
Result<List<Education>> educationList();
|
|
||||||
|
|
||||||
Result<PageResult<History>> historyList(HistoryRequest historyRequest);
|
|
||||||
|
|
||||||
Result<PageResult<Patient>> patientList(UserLevel userLevel);
|
|
||||||
|
|
||||||
Result<PageResult<Pressure>> pressureList(UserLevel userLevel);
|
|
||||||
|
|
||||||
Result<PageResult<Records>> recordsList(UserLevel userLevel);
|
|
||||||
|
|
||||||
Result<PageResult<Sugar>> sugarList(UserLevel userLevel);
|
|
||||||
|
|
||||||
Result educationAdd(Education education);
|
|
||||||
|
|
||||||
Result educationDel(String contentId);
|
|
||||||
|
|
||||||
Result educationUpd(Education education);
|
|
||||||
|
|
||||||
Result historyAdd(History history);
|
|
||||||
|
|
||||||
Result historyUpd(History history);
|
|
||||||
|
|
||||||
Result historyDel(String historyId);
|
|
||||||
|
|
||||||
Result patientAdd(Patient patient);
|
|
||||||
|
|
||||||
Result patientUpd(Patient patient);
|
|
||||||
|
|
||||||
Result pressureDel(String pressureId);
|
|
||||||
|
|
||||||
Result pressureAdd(Pressure pressure);
|
|
||||||
|
|
||||||
Result pressureUpd(Pressure pressure);
|
|
||||||
|
|
||||||
Result recordsDel(String recordsId);
|
|
||||||
|
|
||||||
Result recordsAdd(Records records);
|
|
||||||
|
|
||||||
Result recordsUpd(Records records);
|
|
||||||
|
|
||||||
Result sugarDel(Sugar sugarId);
|
|
||||||
|
|
||||||
Result sugarAdd(Sugar sugar);
|
|
||||||
|
|
||||||
Result sugarUpd(Sugar sugar);
|
|
||||||
|
|
||||||
Result patientDel(String patientId);
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
package com.bwie.service.feign;
|
|
||||||
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-11 上午 9:34
|
|
||||||
*/
|
|
||||||
@FeignClient(name = "bwie-mq")
|
|
||||||
public interface mqFeign {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,342 +0,0 @@
|
||||||
package com.bwie.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.bwie.common.constants.JwtConstants;
|
|
||||||
import com.bwie.common.domain.Admin;
|
|
||||||
import com.bwie.common.domain.Education;
|
|
||||||
import com.bwie.common.domain.History;
|
|
||||||
import com.bwie.common.domain.Patient;
|
|
||||||
import com.bwie.common.domain.Pressure;
|
|
||||||
import com.bwie.common.domain.Records;
|
|
||||||
import com.bwie.common.domain.Sugar;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.domain.request.HistoryRequest;
|
|
||||||
import com.bwie.common.domain.request.UserLevel;
|
|
||||||
import com.bwie.common.result.PageResult;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.mapper.ListsMapper;
|
|
||||||
import com.bwie.service.ListsService;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import okio.HashingSink;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:38
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ListsServiceImpl implements ListsService {
|
|
||||||
@Autowired
|
|
||||||
private ListsMapper listsMapper;
|
|
||||||
@Autowired
|
|
||||||
private StringRedisTemplate redisTemplate;
|
|
||||||
@Autowired
|
|
||||||
private HttpServletRequest request;
|
|
||||||
|
|
||||||
//查询健康列表
|
|
||||||
@Override
|
|
||||||
public Result<List<Education>> educationList() {
|
|
||||||
List<Education> list = listsMapper.educationList();
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
//查询用户病史列表
|
|
||||||
@Override
|
|
||||||
public Result<PageResult<History>> historyList(HistoryRequest historyRequest) {
|
|
||||||
Result<Integer> user = getUser();
|
|
||||||
if(user.getCode()==500){
|
|
||||||
//用户登录超时
|
|
||||||
return Result.error(user.getMsg());
|
|
||||||
}
|
|
||||||
historyRequest.setRank(user.getData());
|
|
||||||
if(user.getData()==2){
|
|
||||||
Integer userId = Integer.valueOf(user.getMsg());
|
|
||||||
historyRequest.setUserId(userId);
|
|
||||||
}
|
|
||||||
PageHelper.startPage(historyRequest.getPageNum(),historyRequest.getPageSize());
|
|
||||||
List<History> list = listsMapper.historyList(historyRequest);
|
|
||||||
PageInfo<History> info = new PageInfo<>(list);
|
|
||||||
return PageResult.toResult(info.getTotal(),list);
|
|
||||||
}
|
|
||||||
|
|
||||||
//糖尿病管理
|
|
||||||
@Override
|
|
||||||
public Result<PageResult<Patient>> patientList(UserLevel userLevel) {
|
|
||||||
Result<Integer> user = getUser();
|
|
||||||
//判断用户是否登录token
|
|
||||||
if(user.getCode()==500){
|
|
||||||
//用户登录超时
|
|
||||||
return Result.error(user.getMsg());
|
|
||||||
}
|
|
||||||
userLevel.setRank(user.getData());
|
|
||||||
//判断是用户登录还是管理员登录用户登录2 管理员登录1
|
|
||||||
if(user.getData()==2){
|
|
||||||
Integer userId = Integer.valueOf(user.getMsg());
|
|
||||||
userLevel.setUserId(userId);
|
|
||||||
}
|
|
||||||
//列表查询
|
|
||||||
PageHelper.startPage(userLevel.getPageNum(),userLevel.getPageSize());
|
|
||||||
List<Patient> list = listsMapper.patientList(userLevel);
|
|
||||||
PageInfo<Patient> info = new PageInfo<>(list);
|
|
||||||
|
|
||||||
return PageResult.toResult(info.getTotal(),list);
|
|
||||||
}
|
|
||||||
|
|
||||||
//用户血压表
|
|
||||||
@Override
|
|
||||||
public Result<PageResult<Pressure>> pressureList(UserLevel userLevel) {
|
|
||||||
Result<Integer> user = getUser();
|
|
||||||
//判断用户是否登录token
|
|
||||||
if(user.getCode()==500){
|
|
||||||
//用户登录超时
|
|
||||||
return Result.error(user.getMsg());
|
|
||||||
}
|
|
||||||
userLevel.setRank(user.getData());
|
|
||||||
//判断是用户登录还是管理员登录用户登录2 管理员登录1
|
|
||||||
if(user.getData()==2){
|
|
||||||
Integer userId = Integer.valueOf(user.getMsg());
|
|
||||||
userLevel.setUserId(userId);
|
|
||||||
}
|
|
||||||
PageHelper.startPage(userLevel.getPageNum(),userLevel.getPageSize());
|
|
||||||
List<Pressure> list = listsMapper.pressureList(userLevel);
|
|
||||||
PageInfo<Pressure> info = new PageInfo<>(list);
|
|
||||||
return PageResult.toResult(info.getTotal(),list);
|
|
||||||
}
|
|
||||||
|
|
||||||
//用户健康档案列表
|
|
||||||
@Override
|
|
||||||
public Result<PageResult<Records>> recordsList(UserLevel userLevel) {
|
|
||||||
Result<Integer> user = getUser();
|
|
||||||
//判断用户是否登录token
|
|
||||||
if(user.getCode()==500){
|
|
||||||
//用户登录超时
|
|
||||||
return Result.error(user.getMsg());
|
|
||||||
}
|
|
||||||
userLevel.setRank(user.getData());
|
|
||||||
//判断是用户登录还是管理员登录用户登录2 管理员登录1
|
|
||||||
if(user.getData()==2){
|
|
||||||
Integer userId = Integer.valueOf(user.getMsg());
|
|
||||||
userLevel.setUserId(userId);
|
|
||||||
}
|
|
||||||
PageHelper.startPage(userLevel.getPageNum(),userLevel.getPageSize());
|
|
||||||
List<Records> list = listsMapper.recordsList(userLevel);
|
|
||||||
PageInfo<Records> info = new PageInfo<>(list);
|
|
||||||
return PageResult.toResult(info.getTotal(),list);
|
|
||||||
}
|
|
||||||
|
|
||||||
//用户血糖列表
|
|
||||||
@Override
|
|
||||||
public Result<PageResult<Sugar>> sugarList(UserLevel userLevel) {
|
|
||||||
Result<Integer> user = getUser();
|
|
||||||
//判断用户是否登录token
|
|
||||||
if(user.getCode()==500){
|
|
||||||
//用户登录超时
|
|
||||||
return Result.error(user.getMsg());
|
|
||||||
}
|
|
||||||
userLevel.setRank(user.getData());
|
|
||||||
//判断是用户登录还是管理员登录用户登录2 管理员登录1
|
|
||||||
if(user.getData()==2){
|
|
||||||
Integer userId = Integer.valueOf(user.getMsg());
|
|
||||||
userLevel.setUserId(userId);
|
|
||||||
}
|
|
||||||
PageHelper.startPage(userLevel.getPageNum(),userLevel.getPageSize());
|
|
||||||
List<Sugar> list = listsMapper.sugarList(userLevel);
|
|
||||||
PageInfo<Sugar> info = new PageInfo<>(list);
|
|
||||||
return PageResult.toResult(info.getTotal(),list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result educationAdd(Education education) {
|
|
||||||
Integer num = listsMapper.educationAdd(education);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result educationDel(String contentId) {
|
|
||||||
Integer num =listsMapper.educationDel(contentId);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result educationUpd(Education education) {
|
|
||||||
Integer num =listsMapper.educationUpd(education);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result historyAdd(History history) {
|
|
||||||
Integer num =listsMapper.historyAdd(history);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result historyUpd(History history) {
|
|
||||||
Integer num =listsMapper.historyUpd(history);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result historyDel(String historyId) {
|
|
||||||
Integer num =listsMapper.historyDel(historyId);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result patientDel(String patientId) {
|
|
||||||
Integer num =listsMapper.patientDel(patientId);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Result patientAdd(Patient patient) {
|
|
||||||
Integer num =listsMapper.patientAdd(patient);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result patientUpd(Patient patient) {
|
|
||||||
Integer num =listsMapper.patientUpd(patient);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result pressureDel(String pressureId) {
|
|
||||||
Integer num =listsMapper.pressureDel(pressureId);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result pressureAdd(Pressure pressure) {
|
|
||||||
Integer num =listsMapper.pressureAdd(pressure);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result pressureUpd(Pressure pressure) {
|
|
||||||
Integer num =listsMapper.pressureUpd(pressure);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result recordsDel(String recordsId) {
|
|
||||||
Integer num =listsMapper.recordsDel(recordsId);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result recordsAdd(Records records) {
|
|
||||||
Integer num =listsMapper.recordsAdd(records);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result recordsUpd(Records records) {
|
|
||||||
Integer num =listsMapper.recordsUpd(records);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result sugarDel(Sugar sugarId) {
|
|
||||||
Integer num =listsMapper.sugarDel(sugarId);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result sugarAdd(Sugar sugar) {
|
|
||||||
Integer num =listsMapper.sugarAdd(sugar);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result sugarUpd(Sugar sugar) {
|
|
||||||
Integer num =listsMapper.sugarUpd(sugar);
|
|
||||||
if(num>0){
|
|
||||||
return Result.success("成功");
|
|
||||||
}
|
|
||||||
return Result.error("失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//获取用户登录值
|
|
||||||
private Result<Integer> getUser(){
|
|
||||||
String token = request.getHeader("token");
|
|
||||||
if(token==null){
|
|
||||||
return Result.error("用户登录超时请重新登录");
|
|
||||||
}
|
|
||||||
String s = redisTemplate.opsForValue().get(JwtConstants.USER_KEY + token);
|
|
||||||
|
|
||||||
User user = JSON.parseObject(s, User.class);
|
|
||||||
|
|
||||||
String name = user.getUsername();
|
|
||||||
Integer num = listsMapper.getUser(name);
|
|
||||||
if (num!=null){
|
|
||||||
if(user!=null){
|
|
||||||
return Result.success(2,String.valueOf(user.getUserId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Admin admin = JSON.parseObject(s,Admin.class);
|
|
||||||
if(admin!=null){
|
|
||||||
return Result.success(1);
|
|
||||||
}
|
|
||||||
return Result.error("用户登录超时请重新登录");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
# Tomcat
|
|
||||||
server:
|
|
||||||
port: 9003
|
|
||||||
# Spring
|
|
||||||
spring:
|
|
||||||
main:
|
|
||||||
allow-circular-references: true
|
|
||||||
jackson:
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
time-zone: GMT+8
|
|
||||||
application:
|
|
||||||
# 应用名称
|
|
||||||
name: bwie-system
|
|
||||||
profiles:
|
|
||||||
# 环境配置
|
|
||||||
active: dev
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: 124.221.202.137:8848
|
|
||||||
config:
|
|
||||||
# 配置中心地址
|
|
||||||
server-addr: 124.221.202.137:8848
|
|
||||||
# 配置文件格式
|
|
||||||
file-extension: yml
|
|
||||||
# 共享配置
|
|
||||||
shared-configs:
|
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
#rabbitmq:
|
|
||||||
# host: 124.221.202.137
|
|
||||||
# port: 5672
|
|
||||||
# username: guest
|
|
||||||
# password: guest
|
|
||||||
# virtualHost: /
|
|
||||||
# listener:
|
|
||||||
# simple:
|
|
||||||
# prefetch: 1 # 每次消费1条 多劳多得
|
|
||||||
# acknowledge-mode: manual # 手动确认
|
|
||||||
# retry:
|
|
||||||
# enabled: true # 是否支持重试
|
|
||||||
# publisher-confirm-type: correlated # 交换机的确认
|
|
||||||
# publisher-returns: true # 队列的确认
|
|
||||||
|
|
||||||
|
|
|
@ -1,159 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.bwie.mapper.ListsMapper">
|
|
||||||
<insert id="educationAdd">
|
|
||||||
INSERT INTO `day_12_8_2`.`health_education` (`title`, `content`, `publish_time`) VALUES
|
|
||||||
(#{title},#{content},now());
|
|
||||||
</insert>
|
|
||||||
<insert id="historyAdd">
|
|
||||||
INSERT INTO `day_12_8_2`.`medical_history` (`user_id`, `disease_name`, `onset_time`, `treatment_status`) VALUES
|
|
||||||
(#{userId}, #{diseaseName}, #{onsetTime}, #{treatmentStatus});
|
|
||||||
</insert>
|
|
||||||
<insert id="patientAdd">
|
|
||||||
INSERT INTO `day_12_8_2`.`diabetes_patient` (`patient_id`, `user_id`, `admin_id`, `management_status`) VALUES
|
|
||||||
(#{patientId}, #{userId}, #{adminId}, #{managementStatus});
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
<insert id="pressureAdd">
|
|
||||||
INSERT INTO `day_12_8_2`.`blood_pressure` (`user_id`, `measurement_time`, `systolic_pressure`, `diastolic_pressure`) VALUES
|
|
||||||
(#{userId}, now(), #{systolicPressure}, #{diastolicPressure});
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
<insert id="recordsAdd">
|
|
||||||
INSERT INTO `day_12_8_2`.`health_records` ( `user_id`, `medical_history`, `drug_allergies`, `surgical_history`, `family_history`) VALUES
|
|
||||||
( #{userId}, #{medicalHistory}, #{drugAllergies}, #{surgicalHistory}, #{familyHistory});
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
<insert id="sugarAdd">
|
|
||||||
INSERT INTO `day_12_8_2`.`blood_sugar` (`user_id`, `measurement_time`, `blood_sugar_value`) VALUES
|
|
||||||
(#{userId}, #{measurementTime}, #{bloodSugarValue});
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="educationUpd">
|
|
||||||
UPDATE `day_12_8_2`.`health_education` SET `title` = #{title}, `content` = #{content}, `publish_time` = now() WHERE `content_id` = #{contentId};
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="historyUpd">
|
|
||||||
UPDATE `day_12_8_2`.`medical_history` SET `user_id` = #{userId}, `disease_name` = #{diseaseName}, `onset_time` = #{onsetTime}, `treatment_status` = #{treatmentStatus} WHERE `history_id` = #{historyId};
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="patientUpd">
|
|
||||||
UPDATE `day_12_8_2`.`diabetes_patient` SET `user_id` = #{userId}, `admin_id` = #{adminId}, `management_status` = #{managementStatus} WHERE `patient_id` = #{patientId};
|
|
||||||
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<update id="pressureUpd">
|
|
||||||
UPDATE `day_12_8_2`.`blood_pressure` SET `user_id` = #{userId}, `measurement_time` = now(), `systolic_pressure` = #{systolicPressure}, `diastolic_pressure` = #{diastolicPressure} WHERE `bp_id` = #{bpId};
|
|
||||||
</update>
|
|
||||||
<update id="recordsUpd">
|
|
||||||
UPDATE `day_12_8_2`.`health_records` SET `user_id` = #{userId}, `medical_history` = #{medicalHistory}, `drug_allergies` = #{drugAllergies}, `surgical_history` = #{surgicalHistory}, `family_history` = #{familyHistory} WHERE `record_id` = #{recordId};
|
|
||||||
|
|
||||||
</update>
|
|
||||||
<update id="sugarUpd">
|
|
||||||
UPDATE `day_12_8_2`.`blood_sugar` SET `user_id` = #{userId}, `measurement_time` = #{measurementTime}, `blood_sugar_value` = #{bloodSugarValue} WHERE `bs_id` = #{bsId};
|
|
||||||
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="educationDel">
|
|
||||||
delete
|
|
||||||
from health_education
|
|
||||||
where
|
|
||||||
`content_id` = #{contentId};
|
|
||||||
</delete>
|
|
||||||
<delete id="historyDel">
|
|
||||||
delete
|
|
||||||
from medical_history
|
|
||||||
where history_id = #{historyId}
|
|
||||||
</delete>
|
|
||||||
<delete id="patientDel">
|
|
||||||
delete
|
|
||||||
from diabetes_patient
|
|
||||||
where patient_id = #{patientId};
|
|
||||||
</delete>
|
|
||||||
<delete id="pressureDel">
|
|
||||||
delete
|
|
||||||
from blood_pressure
|
|
||||||
where bp_id=#{pressureId};
|
|
||||||
</delete>
|
|
||||||
<delete id="recordsDel">
|
|
||||||
delete
|
|
||||||
from health_records
|
|
||||||
where records_id = #{recordsId}
|
|
||||||
</delete>
|
|
||||||
<delete id="sugarDel">
|
|
||||||
delete
|
|
||||||
from blood_sugar
|
|
||||||
where bs_id = #{sugarId};
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<select id="educationList" resultType="com.bwie.common.domain.Education">
|
|
||||||
select * from health_education
|
|
||||||
</select>
|
|
||||||
<select id="historyList" resultType="com.bwie.common.domain.History">
|
|
||||||
select h.*,u.username,u.gender,u.age,u.contact from medical_history h left join user_info u on h.user_id=u.user_id
|
|
||||||
<where>
|
|
||||||
<if test="rank!=1">
|
|
||||||
and h.user_id = #{userId}
|
|
||||||
</if>
|
|
||||||
<if test="StartDate!=null">
|
|
||||||
and onsetTime >= #{StartDate}
|
|
||||||
</if>
|
|
||||||
<if test="EndDate!=null">
|
|
||||||
and onsetTime <= #{EndDate}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="patientList" resultType="com.bwie.common.domain.Patient">
|
|
||||||
SELECT p.*, u.username, u.gender, u.age, u.contact, a.username AS admin_username
|
|
||||||
FROM diabetes_patient p
|
|
||||||
LEFT JOIN user_info u ON p.user_id = u.user_id
|
|
||||||
LEFT JOIN admin_account a ON p.admin_id = a.admin_id
|
|
||||||
<where>
|
|
||||||
<if test="rank!=1">
|
|
||||||
and p.user_id = #{userId}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="pressureList" resultType="com.bwie.common.domain.Pressure">
|
|
||||||
select p.*,u.username,u.gender,u.age,u.contact from blood_pressure p left join user_info u on p.user_id=u.user_id
|
|
||||||
<where>
|
|
||||||
<if test="rank!=1">
|
|
||||||
and p.user_id = #{userId}
|
|
||||||
</if>
|
|
||||||
<if test="StartDate!=null">
|
|
||||||
and measurement_time >= #{StartDate}
|
|
||||||
</if>
|
|
||||||
<if test="EndDate!=null">
|
|
||||||
and measurement_time <= #{EndDate}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="recordsList" resultType="com.bwie.common.domain.Records">
|
|
||||||
select r.*,u.username,u.gender,u.age,u.contact from health_records r left join user_info u on r.user_id=u.user_id
|
|
||||||
<where>
|
|
||||||
<if test="rank!=1">
|
|
||||||
and r.user_id = #{userId}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="sugarList" resultType="com.bwie.common.domain.Sugar">
|
|
||||||
select s.*,u.username,u.gender,u.age,u.contact from blood_sugar s left join user_info u on s.user_id=u.user_id
|
|
||||||
<where>
|
|
||||||
<if test="rank!=1">
|
|
||||||
and s.user_id = #{userId}
|
|
||||||
</if>
|
|
||||||
<if test="StartDate!=null">
|
|
||||||
and measurement_time >= #{StartDate}
|
|
||||||
</if>
|
|
||||||
<if test="EndDate!=null">
|
|
||||||
and measurement_time <= #{EndDate}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
<select id="getUser" resultType="java.lang.Integer">
|
|
||||||
select * from user_info where username = #{name}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,57 +0,0 @@
|
||||||
<?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>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.bwie</groupId>
|
|
||||||
<artifactId>bwie-modules</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>bwie-user</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- 系统公共 依赖 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.bwie</groupId>
|
|
||||||
<artifactId>bwie-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- SpringBoot Web-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- Druid -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
|
||||||
<version>1.2.8</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Mysql Connector -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- Mybatis 依赖配置 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
|
||||||
<version>2.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Pagehelper -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.pagehelper</groupId>
|
|
||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
|
||||||
<version>1.4.1</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,33 +0,0 @@
|
||||||
package com.bwie.controller;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Admin;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.domain.request.UserRequest;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.service.UserService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:34
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
public class UserController {
|
|
||||||
@Autowired
|
|
||||||
private UserService userService;
|
|
||||||
|
|
||||||
@PostMapping("/userLogin")
|
|
||||||
public Result<User> userLogin(@RequestBody UserRequest userRequest){
|
|
||||||
User user = userService.userLogin(userRequest);
|
|
||||||
return Result.success(user);
|
|
||||||
}
|
|
||||||
@PostMapping("/adminLogin")
|
|
||||||
public Result<Admin> adminLogin(@RequestBody UserRequest userRequest){
|
|
||||||
Admin admin = userService.adminLogin(userRequest);
|
|
||||||
return Result.success(admin);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package com.bwie.mapper;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Admin;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.domain.request.UserRequest;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:36
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface UserMapper {
|
|
||||||
User userLogin(UserRequest userRequest);
|
|
||||||
|
|
||||||
Admin adminLogin(UserRequest userRequest);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.bwie.service;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Admin;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.domain.request.UserRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:35
|
|
||||||
*/
|
|
||||||
public interface UserService {
|
|
||||||
User userLogin(UserRequest userRequest);
|
|
||||||
|
|
||||||
Admin adminLogin(UserRequest userRequest);
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.bwie.service.impl;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Admin;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.domain.request.UserRequest;
|
|
||||||
import com.bwie.mapper.UserMapper;
|
|
||||||
import com.bwie.service.UserService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:35
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class UserServiceImpl implements UserService {
|
|
||||||
@Autowired
|
|
||||||
private UserMapper userMapper;
|
|
||||||
@Override
|
|
||||||
public User userLogin(UserRequest userRequest) {
|
|
||||||
return userMapper.userLogin(userRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Admin adminLogin(UserRequest userRequest) {
|
|
||||||
|
|
||||||
return userMapper.adminLogin(userRequest);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
# Tomcat
|
|
||||||
server:
|
|
||||||
port: 9004
|
|
||||||
# Spring
|
|
||||||
spring:
|
|
||||||
main:
|
|
||||||
allow-circular-references: true
|
|
||||||
jackson:
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
time-zone: GMT+8
|
|
||||||
application:
|
|
||||||
# 应用名称
|
|
||||||
name: bwie-user
|
|
||||||
profiles:
|
|
||||||
# 环境配置
|
|
||||||
active: dev
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: 124.221.202.137:8848
|
|
||||||
config:
|
|
||||||
# 配置中心地址
|
|
||||||
server-addr: 124.221.202.137:8848
|
|
||||||
# 配置文件格式
|
|
||||||
file-extension: yml
|
|
||||||
# 共享配置
|
|
||||||
shared-configs:
|
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
#rabbitmq:
|
|
||||||
# host: 124.221.202.137
|
|
||||||
# port: 5672
|
|
||||||
# username: guest
|
|
||||||
# password: guest
|
|
||||||
# virtualHost: /
|
|
||||||
# listener:
|
|
||||||
# simple:
|
|
||||||
# prefetch: 1 # 每次消费1条 多劳多得
|
|
||||||
# acknowledge-mode: manual # 手动确认
|
|
||||||
# retry:
|
|
||||||
# enabled: true # 是否支持重试
|
|
||||||
# publisher-confirm-type: correlated # 交换机的确认
|
|
||||||
# publisher-returns: true # 队列的确认
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.bwie.mapper.UserMapper">
|
|
||||||
|
|
||||||
<select id="userLogin" resultType="com.bwie.common.domain.User">
|
|
||||||
select * from user_info where username=#{name} and password=#{pwd}
|
|
||||||
</select>
|
|
||||||
<select id="adminLogin" resultType="com.bwie.common.domain.Admin">
|
|
||||||
select * from admin_account where username=#{name} and password=#{pwd}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -4,16 +4,15 @@
|
||||||
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">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.bwie</groupId>
|
<groupId>com.bw</groupId>
|
||||||
<artifactId>day_12_10_1</artifactId>
|
<artifactId>day02</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>bwie-modules</artifactId>
|
<artifactId>bwie-modules</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>bwie-user</module>
|
<module>bwie-blood</module>
|
||||||
<module>bwie-lists</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
<?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>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.bwie</groupId>
|
|
||||||
<artifactId>day_12_10_1</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>bwie-mq</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- 系统公共 依赖 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.bwie</groupId>
|
|
||||||
<artifactId>bwie-common</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- SpringBoot Web-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- Druid -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>druid-spring-boot-starter</artifactId>
|
|
||||||
<version>1.2.8</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Mysql Connector -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- Mybatis 依赖配置 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
|
||||||
<version>2.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
<!-- Pagehelper -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.pagehelper</groupId>
|
|
||||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
|
||||||
<version>1.4.1</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.bwie;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:41
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableFeignClients
|
|
||||||
public class MQApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(MQApplication.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package com.bwie.controller;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:40
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MQController {
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package com.bwie.mq;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:40
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class Consumer {
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package com.bwie.mq.config;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version: java version 1.8
|
|
||||||
* @author: liguangyao
|
|
||||||
* @date: 2023-12-10 上午 9:40
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MQConfig {
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
# Tomcat
|
|
||||||
server:
|
|
||||||
port: 9006
|
|
||||||
# Spring
|
|
||||||
spring:
|
|
||||||
main:
|
|
||||||
allow-circular-references: true
|
|
||||||
jackson:
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
time-zone: GMT+8
|
|
||||||
application:
|
|
||||||
# 应用名称
|
|
||||||
name: bwie-mq
|
|
||||||
profiles:
|
|
||||||
# 环境配置
|
|
||||||
active: dev
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: 124.221.202.137:8848
|
|
||||||
config:
|
|
||||||
# 配置中心地址
|
|
||||||
server-addr: 124.221.202.137:8848
|
|
||||||
# 配置文件格式
|
|
||||||
file-extension: yml
|
|
||||||
# 共享配置
|
|
||||||
shared-configs:
|
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
||||||
#rabbitmq:
|
|
||||||
# host: 124.221.202.137
|
|
||||||
# port: 5672
|
|
||||||
# username: guest
|
|
||||||
# password: guest
|
|
||||||
# virtualHost: /
|
|
||||||
# listener:
|
|
||||||
# simple:
|
|
||||||
# prefetch: 1 # 每次消费1条 多劳多得
|
|
||||||
# acknowledge-mode: manual # 手动确认
|
|
||||||
# retry:
|
|
||||||
# enabled: true # 是否支持重试
|
|
||||||
# publisher-confirm-type: correlated # 交换机的确认
|
|
||||||
# publisher-returns: true # 队列的确认
|
|
||||||
|
|
||||||
|
|
10
pom.xml
10
pom.xml
|
@ -4,16 +4,14 @@
|
||||||
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">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.bwie</groupId>
|
<groupId>com.bw</groupId>
|
||||||
<artifactId>day_12_10_1</artifactId>
|
<artifactId>day02</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>bwie-auth</module>
|
|
||||||
<module>bwie-common</module>
|
<module>bwie-common</module>
|
||||||
<module>bwie-gateway</module>
|
|
||||||
<module>bwie-modules</module>
|
<module>bwie-modules</module>
|
||||||
<module>bwie-mq</module>
|
<module>bwie-gateway</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -57,7 +55,7 @@
|
||||||
|
|
||||||
<!-- 系统公共 依赖 版本号定义-->
|
<!-- 系统公共 依赖 版本号定义-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.bwie</groupId>
|
<groupId>com.bw</groupId>
|
||||||
<artifactId>bwie-common</artifactId>
|
<artifactId>bwie-common</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
Loading…
Reference in New Issue