Compare commits
No commits in common. "master" and "健康" have entirely different histories.
|
@ -1,38 +0,0 @@
|
||||||
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
|
|
|
@ -1,8 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
|
@ -1,22 +1,22 @@
|
||||||
<?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://$APPLICATION_HOME_DIR$/jbr/bin/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$APPLICATION_HOME_DIR$/jbr/bin/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-auth/src/main/java" charset="UTF-8" />
|
<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-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-gateway/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-cases/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-es/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-formation/src/main/java" charset="UTF-8" />
|
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-health/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-health/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-trees/src/main/java" 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/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/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$/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" />
|
||||||
<file url="file://$APPLICATION_HOME_DIR$/jbr/bin/src/main/java" charset="UTF-8" />
|
|
||||||
<file url="file://$APPLICATION_HOME_DIR$/jbr/bin/src/main/resources" charset="UTF-8" />
|
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -4,7 +4,6 @@
|
||||||
<option name="originalFiles">
|
<option name="originalFiles">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/pom.xml" />
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
<option value="$PROJECT_DIR$/bwie-modules/bwie-cases/pom.xml" />
|
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -1,134 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="AutoImportSettings">
|
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
|
||||||
</component>
|
|
||||||
<component name="ChangeListManager">
|
|
||||||
<list default="true" id="22f6834d-badb-4960-b20c-230dd62138eb" name="Changes" comment="">
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/bwie-modules/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/pom.xml" afterDir="false" />
|
|
||||||
</list>
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
||||||
</component>
|
|
||||||
<component name="FileTemplateManagerImpl">
|
|
||||||
<option name="RECENT_TEMPLATES">
|
|
||||||
<list>
|
|
||||||
<option value="Interface" />
|
|
||||||
<option value="mapper.xml" />
|
|
||||||
<option value="Class" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="Git.Settings">
|
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectColorInfo"><![CDATA[{
|
|
||||||
"associatedIndex": 1
|
|
||||||
}]]></component>
|
|
||||||
<component name="ProjectId" id="2ZeGwUKqC4hiI7DWBCSZlktoN5x" />
|
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
|
||||||
<ConfirmationsSetting value="2" id="Add" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectViewState">
|
|
||||||
<option name="showLibraryContents" value="true" />
|
|
||||||
<option name="showVisibilityIcons" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent">{
|
|
||||||
"keyToString": {
|
|
||||||
"RequestMappingsPanelOrder0": "0",
|
|
||||||
"RequestMappingsPanelOrder1": "1",
|
|
||||||
"RequestMappingsPanelWidth0": "75",
|
|
||||||
"RequestMappingsPanelWidth1": "75",
|
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
|
||||||
"WebServerToolWindowFactoryState": "false",
|
|
||||||
"git-widget-placeholder": "master",
|
|
||||||
"jdk.selected.JAVA_MODULE": "1.8",
|
|
||||||
"last_opened_file_path": "Z:/JavaHeathl/bwie-modules/bwie-health/src/main/resources",
|
|
||||||
"node.js.detected.package.eslint": "true",
|
|
||||||
"node.js.detected.package.tslint": "true",
|
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
|
||||||
"nodejs_package_manager_path": "npm",
|
|
||||||
"vue.rearranger.settings.migration": "true"
|
|
||||||
}
|
|
||||||
}</component>
|
|
||||||
<component name="ReactorSettings">
|
|
||||||
<option name="notificationShown" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="RecentsManager">
|
|
||||||
<key name="CreateClassDialog.RecentsKey">
|
|
||||||
<recent name="com.bwie.health.mapper" />
|
|
||||||
<recent name="com.bwie.health.service" />
|
|
||||||
</key>
|
|
||||||
<key name="CopyFile.RECENT_KEYS">
|
|
||||||
<recent name="Z:\JavaHeathl\bwie-modules\bwie-health\src\main\resources" />
|
|
||||||
<recent name="Z:\JavaHeathl\bwie-modules\bwie-health\src\main\java\com\bwie\health\service" />
|
|
||||||
<recent name="Z:\JavaHeathl\bwie-modules\bwie-health\src\main\java\com\bwie\health" />
|
|
||||||
</key>
|
|
||||||
<key name="CopyClassDialog.RECENTS_KEY">
|
|
||||||
<recent name="com.bwie.health.service.impl" />
|
|
||||||
</key>
|
|
||||||
</component>
|
|
||||||
<component name="RunDashboard">
|
|
||||||
<option name="configurationTypes">
|
|
||||||
<set>
|
|
||||||
<option value="SpringBootApplicationConfigurationType" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="RunManager">
|
|
||||||
<configuration name="HealthApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
|
|
||||||
<module name="bwie-health" />
|
|
||||||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bwie.health.HealthApplication" />
|
|
||||||
<extension name="coverage">
|
|
||||||
<pattern>
|
|
||||||
<option name="PATTERN" value="com.bwie.health.*" />
|
|
||||||
<option name="ENABLED" value="true" />
|
|
||||||
</pattern>
|
|
||||||
</extension>
|
|
||||||
<method v="2">
|
|
||||||
<option name="Make" enabled="true" />
|
|
||||||
</method>
|
|
||||||
</configuration>
|
|
||||||
<recent_temporary>
|
|
||||||
<list>
|
|
||||||
<item itemvalue="Spring Boot.HealthApplication" />
|
|
||||||
</list>
|
|
||||||
</recent_temporary>
|
|
||||||
</component>
|
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
||||||
<component name="SshConsoleOptionsProvider">
|
|
||||||
<option name="myEncoding" value="UTF-8" />
|
|
||||||
</component>
|
|
||||||
<component name="TaskManager">
|
|
||||||
<task active="true" id="Default" summary="Default task">
|
|
||||||
<changelist id="22f6834d-badb-4960-b20c-230dd62138eb" name="Changes" comment="" />
|
|
||||||
<created>1702775369535</created>
|
|
||||||
<option name="number" value="Default" />
|
|
||||||
<option name="presentableId" value="Default" />
|
|
||||||
<updated>1702775369535</updated>
|
|
||||||
<workItem from="1702775370735" duration="3984000" />
|
|
||||||
<workItem from="1702795938832" duration="394000" />
|
|
||||||
</task>
|
|
||||||
<servers />
|
|
||||||
</component>
|
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
|
||||||
<option name="version" value="3" />
|
|
||||||
</component>
|
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
|
||||||
<option name="TAB_STATES">
|
|
||||||
<map>
|
|
||||||
<entry key="MAIN">
|
|
||||||
<value>
|
|
||||||
<State />
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
|
@ -5,10 +5,10 @@ import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
//@Configuration
|
||||||
public class FeignConfig {
|
//public class FeignConfig {
|
||||||
@Bean
|
// @Bean
|
||||||
public Retryer retry(){
|
// public Retryer retry(){
|
||||||
return new Retryer.Default(5000,30000,3);
|
// return new Retryer.Default(50000,30000,5);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.bwie.common.domain.User;
|
||||||
import com.bwie.common.domain.request.LoginRequest;
|
import com.bwie.common.domain.request.LoginRequest;
|
||||||
|
|
||||||
import com.bwie.common.domain.response.JwtResponse;
|
import com.bwie.common.domain.response.JwtResponse;
|
||||||
|
import com.bwie.common.exception.auth.AuthException;
|
||||||
import com.bwie.common.result.Result;
|
import com.bwie.common.result.Result;
|
||||||
import com.bwie.common.utils.JwtUtils;
|
import com.bwie.common.utils.JwtUtils;
|
||||||
import com.bwie.feign.AuthFeign;
|
import com.bwie.feign.AuthFeign;
|
||||||
|
@ -20,6 +21,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author gxb
|
* @author gxb
|
||||||
* @description TODO
|
* @description TODO
|
||||||
|
@ -58,13 +60,9 @@ public class AuthServicelmpl implements AuthService {
|
||||||
if (!user.getPassword().equals(loginRequest.getPassword())){
|
if (!user.getPassword().equals(loginRequest.getPassword())){
|
||||||
return Result.error("密码输入错误,请重新输入");
|
return Result.error("密码输入错误,请重新输入");
|
||||||
}
|
}
|
||||||
Integer role = user.getRole();
|
Boolean role = user.getRole().intValue() == loginRequest.getRole();
|
||||||
Integer role1 = loginRequest.getRole();
|
|
||||||
|
|
||||||
int a = role;
|
if (!role){
|
||||||
int b = role1;
|
|
||||||
boolean c = a == b;
|
|
||||||
if (!c){
|
|
||||||
return Result.error("登录身份选择错误");
|
return Result.error("登录身份选择错误");
|
||||||
}
|
}
|
||||||
JwtResponse token = this.getToken(user);
|
JwtResponse token = this.getToken(user);
|
||||||
|
@ -109,4 +107,4 @@ public class AuthServicelmpl implements AuthService {
|
||||||
String str= "^1[3-9]\\d{9}$";
|
String str= "^1[3-9]\\d{9}$";
|
||||||
return userPhone.matches(str);
|
return userPhone.matches(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -155,5 +155,19 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- servlet -api -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>servlet-api</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
|
<artifactId>tomcat-embed-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
|
<artifactId>tomcat-embed-core</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Handsome boy
|
|
||||||
* @Package com.bwie.common.domain
|
|
||||||
* @date 2023/12/8 20:22
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Case {
|
|
||||||
private Integer caseId;
|
|
||||||
private Integer userId;
|
|
||||||
|
|
||||||
private String caseName;
|
|
||||||
private String caseTime;
|
|
||||||
private String caseMessage;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Handsome boy
|
|
||||||
* @Package com.bwie.common.domain
|
|
||||||
* @date 2023/12/16 11:51
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class CaseRequest {
|
|
||||||
private Integer pageSize;
|
|
||||||
private Integer pageNum;
|
|
||||||
|
|
||||||
|
|
||||||
private Integer roleId;
|
|
||||||
private Integer userId;
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
package com.bwie.common.domain;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class Formation {
|
|
||||||
|
|
||||||
private Integer formationId;//用户具体信息表
|
|
||||||
private Integer formationPress;//血压
|
|
||||||
private Integer formationSugar;//血糖
|
|
||||||
private Date formationDate;//加入时间
|
|
||||||
private String formationAddress;//住址
|
|
||||||
private Integer userId; //用户Id
|
|
||||||
private String userName;//用户名
|
|
||||||
private String userPwd;//密码
|
|
||||||
private String formationPhone;//手机号
|
|
||||||
private Integer formationAge; //年龄
|
|
||||||
private String formationSex;//性别
|
|
||||||
private String formationName;//昵称
|
|
||||||
private Integer isDele;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bwie.common.domain;
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -11,14 +12,24 @@ import java.util.Date;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class Health{
|
public class Health{
|
||||||
|
/*教育ID*/
|
||||||
private Integer healthId;
|
private Integer healthId;
|
||||||
|
/*标题*/
|
||||||
private String healthTitle;
|
private String healthTitle;
|
||||||
|
/*内容*/
|
||||||
private String healthContent;
|
private String healthContent;
|
||||||
|
/*发布时间*/
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
private Date healthDate;
|
private Date healthDate;
|
||||||
|
/*用户ID*/
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
/*逻辑删除ID*/
|
||||||
private Integer isDele;
|
private Integer isDele;
|
||||||
|
/*用户名*/
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
/*分页*/
|
||||||
private Integer pageNum;
|
private Integer pageNum;
|
||||||
private Integer pageSize;
|
private Integer pageSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author gxb
|
|
||||||
* @description TODO
|
|
||||||
* @date 2023-12-22 20:28
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
public class Manage {
|
|
||||||
// 管理员ID
|
|
||||||
private Integer manageId;
|
|
||||||
// 案件ID
|
|
||||||
private Integer caseId;
|
|
||||||
// 问题ID
|
|
||||||
private Integer id;
|
|
||||||
// 案件名称
|
|
||||||
private String caseName;
|
|
||||||
// 案件时间
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
|
||||||
private Date caseTime;
|
|
||||||
// 案件信息
|
|
||||||
private String caseMessage;
|
|
||||||
// 用户名
|
|
||||||
private String username;
|
|
||||||
}
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bwie.common.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class Trees{
|
||||||
|
private Integer id;
|
||||||
|
private Integer treesId;
|
||||||
|
private String treesName;
|
||||||
|
private List<Trees> children = new ArrayList<>();
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.bwie.common.exception.auth;
|
||||||
|
|
||||||
|
public class AuthException extends RuntimeException{
|
||||||
|
/*状态码*/
|
||||||
|
private int code;
|
||||||
|
/*错误信息*/
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
|
||||||
|
public AuthException(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public AuthException(String message){
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public AuthException(int code,String message){
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.bwie.common.handler;
|
||||||
|
|
||||||
|
import com.bwie.common.exception.auth.AuthException;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: ZhangYao
|
||||||
|
* @create: 2023-12-19 21:10
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@RestControllerAdvice
|
||||||
|
public class GlobalExceptionHandler{
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||||
|
|
||||||
|
/*处理auth exception 程序出现了 AuthException 则会进入这个方法*/
|
||||||
|
@ExceptionHandler(AuthException.class)
|
||||||
|
public Result authExceptionHandler(HttpServletRequest request, AuthException ex){
|
||||||
|
String requestURI = request.getRequestURI();
|
||||||
|
logger.info("请求URI: {},出现了异常 , 异常信息: {}",requestURI,ex.getMessage());
|
||||||
|
return Result.error(ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,8 +9,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
* @date 2023-12-16 8:35
|
* @date 2023-12-16 8:35
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class GatewayApplication {
|
public class GatewayAppliction {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(GatewayApplication.class,args);
|
SpringApplication.run(GatewayAppliction.class,args);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,10 +18,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -1,66 +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-cases</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>
|
|
||||||
<!-- test -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.tobato</groupId>
|
|
||||||
<artifactId>fastdfs-client</artifactId>
|
|
||||||
<version>1.26.5</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.bwie.xxxxxx;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Handsome boy
|
|
||||||
* @Package com.bwie.xxxxxx
|
|
||||||
* @date 2023/12/16 12:02
|
|
||||||
*/
|
|
||||||
@SpringBootApplication
|
|
||||||
public class CasesApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(CasesApplication.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,73 +0,0 @@
|
||||||
package com.bwie.xxxxxx.controller;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Case;
|
|
||||||
import com.bwie.common.domain.CaseRequest;
|
|
||||||
import com.bwie.common.result.PageResult;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.xxxxxx.service.CaseService;
|
|
||||||
import lombok.extern.log4j.Log4j2;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Handsome boy
|
|
||||||
* @Package com.bwie.xxxxxx.controller
|
|
||||||
* @date 2023/12/8 20:21
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@Log4j2
|
|
||||||
public class CaseController {
|
|
||||||
final CaseService caseService;
|
|
||||||
|
|
||||||
public CaseController(CaseService caseService) {
|
|
||||||
this.caseService = caseService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加病例
|
|
||||||
*
|
|
||||||
* @param cases;
|
|
||||||
*/
|
|
||||||
@PostMapping("/case")
|
|
||||||
public Result<Object> insertCase(@RequestBody Case cases) {
|
|
||||||
log.info(cases);
|
|
||||||
return caseService.insertCase(cases);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除病例
|
|
||||||
*
|
|
||||||
* @param caseId;
|
|
||||||
*/
|
|
||||||
@DeleteMapping("/case/{caseId}")
|
|
||||||
public Result<Object> deleteCase(@PathVariable Integer caseId) {
|
|
||||||
return caseService.deleteCase(caseId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改病例
|
|
||||||
*
|
|
||||||
* @param cases;
|
|
||||||
*/
|
|
||||||
@PutMapping("/case")
|
|
||||||
public Result<Object> updateCase(@RequestBody Case cases) {
|
|
||||||
return caseService.updateCase(cases);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询病历表
|
|
||||||
*
|
|
||||||
* @return ;
|
|
||||||
*/
|
|
||||||
@GetMapping("/case")
|
|
||||||
public Result<PageResult<Case>> selCase(@RequestBody CaseRequest caseRequest) {
|
|
||||||
System.out.println(caseRequest + "---------");
|
|
||||||
return caseService.selCase(caseRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
package com.bwie.xxxxxx.mapper;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Case;
|
|
||||||
import com.bwie.common.domain.CaseRequest;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Handsome boy
|
|
||||||
* @Package com.bwie.xxxxxx.mapper
|
|
||||||
* @date 2023/12/8 20:21
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface CaseMapper {
|
|
||||||
/**
|
|
||||||
* 添加病历表
|
|
||||||
* @return ;
|
|
||||||
* @param cases;
|
|
||||||
*/
|
|
||||||
int insertCase(Case cases);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除病例
|
|
||||||
* @return ;
|
|
||||||
* @param caseId;
|
|
||||||
*/
|
|
||||||
int deleteCase(Integer caseId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改病历
|
|
||||||
* @param cases ;
|
|
||||||
* @return ;
|
|
||||||
*/
|
|
||||||
int updateCase(Case cases);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询病例表
|
|
||||||
* @param caseRequest;
|
|
||||||
* @return ;
|
|
||||||
*/
|
|
||||||
List<Case> selCase(CaseRequest caseRequest);
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
package com.bwie.xxxxxx.service;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Case;
|
|
||||||
import com.bwie.common.domain.CaseRequest;
|
|
||||||
import com.bwie.common.result.PageResult;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Handsome boy
|
|
||||||
* @Package com.bwie.xxxxxx.service
|
|
||||||
* @date 2023/12/8 20:21
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface CaseService {
|
|
||||||
/**
|
|
||||||
* 添加病例
|
|
||||||
* @return ;
|
|
||||||
* @param cases;
|
|
||||||
*/
|
|
||||||
Result<Object> insertCase(Case cases);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除病例
|
|
||||||
* @return ;
|
|
||||||
* @param caseId;
|
|
||||||
*/
|
|
||||||
Result<Object> deleteCase(Integer caseId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改病例
|
|
||||||
* @return ;
|
|
||||||
* @param cases;
|
|
||||||
*/
|
|
||||||
Result<Object> updateCase(Case cases);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询病例
|
|
||||||
* @param caseRequest;
|
|
||||||
* @return ;
|
|
||||||
*/
|
|
||||||
Result<PageResult<Case>> selCase(CaseRequest caseRequest);
|
|
||||||
}
|
|
|
@ -1,138 +0,0 @@
|
||||||
package com.bwie.xxxxxx.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.bwie.common.constants.TokenConstants;
|
|
||||||
import com.bwie.common.domain.Case;
|
|
||||||
import com.bwie.common.domain.CaseRequest;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.result.PageResult;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.common.utils.JwtUtils;
|
|
||||||
import com.bwie.xxxxxx.mapper.CaseMapper;
|
|
||||||
import com.bwie.xxxxxx.service.CaseService;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Handsome boy
|
|
||||||
* @Package com.bwie.xxxxxx.service.impl
|
|
||||||
* @date 2023/12/8 20:21
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class CaseServiceImpl implements CaseService {
|
|
||||||
|
|
||||||
final CaseMapper caseMapper;
|
|
||||||
final HttpServletRequest request;
|
|
||||||
final RedisTemplate<String, String> redisTemplate;
|
|
||||||
|
|
||||||
public CaseServiceImpl(CaseMapper caseMapper, HttpServletRequest request, RedisTemplate<String, String> redisTemplate) {
|
|
||||||
this.caseMapper = caseMapper;
|
|
||||||
this.request = request;
|
|
||||||
this.redisTemplate = redisTemplate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加病例
|
|
||||||
*
|
|
||||||
* @param cases;
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Result<Object> insertCase(Case cases) {
|
|
||||||
int row;
|
|
||||||
try {
|
|
||||||
// 调用caseMapper的insertCase方法,插入cases
|
|
||||||
row = caseMapper.insertCase(cases);
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 抛出运行时异常
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
// 如果row等于0,抛出非法访问错误
|
|
||||||
if (row == 0) {
|
|
||||||
throw new IllegalAccessError("添加异常");
|
|
||||||
}
|
|
||||||
// 返回添加病例成功的结果
|
|
||||||
return Result.success("添加病例成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除病例
|
|
||||||
*
|
|
||||||
* @param caseId;
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Result<Object> deleteCase(Integer caseId) {
|
|
||||||
int row;
|
|
||||||
try {
|
|
||||||
row = caseMapper.deleteCase(caseId);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
if (row == 0) {
|
|
||||||
throw new IllegalAccessError("删除异常");
|
|
||||||
}
|
|
||||||
return Result.success("删除病例成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改病例
|
|
||||||
*
|
|
||||||
* @param cases;
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Result<Object> updateCase(Case cases) {
|
|
||||||
int row;
|
|
||||||
try {
|
|
||||||
row = caseMapper.updateCase(cases);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
if (row == 0) {
|
|
||||||
throw new IllegalAccessError("修改异常");
|
|
||||||
}
|
|
||||||
return Result.success("修改病例成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<PageResult<Case>> selCase(CaseRequest caseRequest) {
|
|
||||||
// 调用PageHelper的startPage方法,传入当前页码和每页条数
|
|
||||||
PageHelper.startPage(caseRequest.getPageNum(), caseRequest.getPageSize());
|
|
||||||
//获取登录人信息
|
|
||||||
// User user = getToken();
|
|
||||||
// if (user == null){
|
|
||||||
// return Result.error("未登录");
|
|
||||||
// }
|
|
||||||
// caseRequest.setRoleId(user.getRole());
|
|
||||||
// caseRequest.setUserId(user.getId());
|
|
||||||
// 调用caseMapper的selCase方法,传入CaseRequest参数
|
|
||||||
List<Case> list = caseMapper.selCase(caseRequest);
|
|
||||||
// 调用PageInfo的构造方法,传入list参数
|
|
||||||
PageInfo<Case> page = new PageInfo<>(list);
|
|
||||||
// 调用Result的success方法,传入PageResult.toPageResult方法,传入page.getTotal()和list参数
|
|
||||||
return PageResult.toResult(page.getTotal() ,list);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取登录人信息
|
|
||||||
*
|
|
||||||
* @return ;
|
|
||||||
*/
|
|
||||||
private User getToken() {
|
|
||||||
//获取token
|
|
||||||
String token = request.getHeader("token");
|
|
||||||
//获取用户key
|
|
||||||
String userKey = JwtUtils.getUserKey(token);
|
|
||||||
//从redis中获取用户信息
|
|
||||||
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
|
|
||||||
//将用户信息转换为User对象
|
|
||||||
return JSON.parseObject(s, User.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
package com.bwie.xxxxxx.util;
|
|
||||||
|
|
||||||
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
|
|
||||||
import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @BelongsProject: 0107day02
|
|
||||||
* @BelongsPackage: com.bw.config
|
|
||||||
* @Author: zhupengfei
|
|
||||||
* @CreateTime: 2023-02-01 08:52
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class FastUtil {
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(FastUtil.class);
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private FastFileStorageClient storageClient ;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传文件
|
|
||||||
*/
|
|
||||||
public String upload(MultipartFile multipartFile) throws Exception{
|
|
||||||
String originalFilename = multipartFile.getOriginalFilename().
|
|
||||||
substring(multipartFile.getOriginalFilename().
|
|
||||||
lastIndexOf(".") + 1);
|
|
||||||
StorePath storePath = this.storageClient.uploadImageAndCrtThumbImage(
|
|
||||||
multipartFile.getInputStream(),
|
|
||||||
multipartFile.getSize(),originalFilename , null);
|
|
||||||
return storePath.getFullPath() ;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 删除文件
|
|
||||||
*/
|
|
||||||
public String deleteFile(String fileUrl) {
|
|
||||||
if (StringUtils.isEmpty(fileUrl)) {
|
|
||||||
log.info("fileUrl == >>文件路径为空...");
|
|
||||||
return "文件路径不能为空";
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
StorePath storePath = StorePath.parseFromUrl(fileUrl);
|
|
||||||
storageClient.deleteFile(storePath.getGroup(), storePath.getPath());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e.getMessage());
|
|
||||||
}
|
|
||||||
return "删除成功";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,39 +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.xxxxxx.mapper.CaseMapper">
|
|
||||||
|
|
||||||
<!-- 添加病历表 -->
|
|
||||||
<insert id="insertCase">
|
|
||||||
insert into cases
|
|
||||||
values (null, #{caseName}, #{caseMessage}, #{caseTime}, #{userId})
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<!-- 修改病历表 -->
|
|
||||||
<update id="updateCase">
|
|
||||||
update cases
|
|
||||||
set case_name=#{caseName},
|
|
||||||
case_message=#{caseMessage},
|
|
||||||
case_Time=#{caseTime}
|
|
||||||
where case_id = #{caseId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<!-- 删除病例表 -->
|
|
||||||
<delete id="deleteCase">
|
|
||||||
delete
|
|
||||||
from cases
|
|
||||||
where case_id = #{caseId}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<!-- 查询病历表 -->
|
|
||||||
<select id="selCase" resultType="com.bwie.common.domain.Case">
|
|
||||||
select *
|
|
||||||
from cases
|
|
||||||
<where>
|
|
||||||
<if test="2==roleId">
|
|
||||||
case.user_id = #{userId}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?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>Java-Heathl</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bwie-es</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.elasticsearch.client</groupId>
|
||||||
|
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper</artifactId>
|
||||||
|
<version>5.3.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bwie.es;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: ZhangYao
|
||||||
|
* @create: 2023-12-19 20:49
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableFeignClients
|
||||||
|
public class EsApplication{
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(EsApplication.class,args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.bwie.es.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.http.HttpHost;
|
||||||
|
import org.elasticsearch.client.RestClient;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "es")
|
||||||
|
@Data
|
||||||
|
public class EsConfig{
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
private int port;
|
||||||
|
|
||||||
|
private String scheme;
|
||||||
|
|
||||||
|
//初始化
|
||||||
|
@Bean
|
||||||
|
public RestHighLevelClient restHighLevelClient(){
|
||||||
|
return new RestHighLevelClient(RestClient.builder(new HttpHost(host,port,scheme)));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.bwie.es.controller;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
||||||
|
import com.bwie.common.domain.Health;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.es.domain.request.HealthRequest;
|
||||||
|
import com.bwie.es.service.EsService;
|
||||||
|
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.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: ZhangYao
|
||||||
|
* @create: 2023-12-19 20:28
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/es")
|
||||||
|
public class EsController{
|
||||||
|
@Autowired
|
||||||
|
private EsService esService;
|
||||||
|
|
||||||
|
@PostMapping("/esList")
|
||||||
|
public PageResult<List<Health>> esList(@RequestBody HealthRequest healthRequest){
|
||||||
|
return esService.esList(healthRequest);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.bwie.es.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: ZhangYao
|
||||||
|
* @create: 2023-12-19 20:31
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class HealthRequest{
|
||||||
|
private String healthTitle;
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.bwie.es.feign;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Health;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
@FeignClient(name = "bwie-health")
|
||||||
|
public interface EsFeign{
|
||||||
|
@PostMapping("/health/list")
|
||||||
|
public Result<PageInfo<Health>> list(@RequestBody Health health);
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.bwie.es.service;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Health;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.es.domain.request.HealthRequest;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface EsService{
|
||||||
|
PageResult<List<Health>> esList(HealthRequest healthRequest);
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.bwie.es.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.json.ObjectMapper;
|
||||||
|
import com.bwie.common.domain.Health;
|
||||||
|
import com.bwie.common.result.PageResult;
|
||||||
|
import com.bwie.es.domain.request.HealthRequest;
|
||||||
|
import com.bwie.es.feign.EsFeign;
|
||||||
|
import com.bwie.es.service.EsService;
|
||||||
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
|
import org.elasticsearch.action.search.SearchResponse;
|
||||||
|
import org.elasticsearch.client.RequestOptions;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.elasticsearch.common.text.Text;
|
||||||
|
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||||
|
import org.elasticsearch.index.query.MatchQueryBuilder;
|
||||||
|
import org.elasticsearch.index.query.QueryBuilders;
|
||||||
|
import org.elasticsearch.search.SearchHit;
|
||||||
|
import org.elasticsearch.search.SearchHits;
|
||||||
|
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||||
|
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
|
||||||
|
import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
|
||||||
|
import org.elasticsearch.search.sort.FieldSortBuilder;
|
||||||
|
import org.elasticsearch.search.sort.SortOrder;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EsServiceImpl implements EsService{
|
||||||
|
@Autowired
|
||||||
|
private RestHighLevelClient client;
|
||||||
|
@Override
|
||||||
|
public PageResult<List<Health>> esList(HealthRequest healthRequest) {
|
||||||
|
//
|
||||||
|
SearchRequest searchRequest = new SearchRequest("health");
|
||||||
|
//
|
||||||
|
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
|
||||||
|
//
|
||||||
|
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||||
|
|
||||||
|
if(healthRequest!=null){
|
||||||
|
MatchQueryBuilder healthTitle = QueryBuilders.matchQuery(healthRequest.getHealthTitle(), "healthTitle");
|
||||||
|
boolQueryBuilder.must(healthTitle);
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceBuilder.sort(new FieldSortBuilder("healthId").order(SortOrder.ASC));//排序
|
||||||
|
|
||||||
|
long total = 0L;
|
||||||
|
//高亮设置
|
||||||
|
HighlightBuilder highlightBuilder = new HighlightBuilder();
|
||||||
|
|
||||||
|
//设置高属性
|
||||||
|
highlightBuilder.field("healthTitle");
|
||||||
|
//前缀
|
||||||
|
highlightBuilder.preTags("<span style=\"color:red\">");
|
||||||
|
//后缀
|
||||||
|
highlightBuilder.postTags("</span>");
|
||||||
|
sourceBuilder.highlighter(highlightBuilder);
|
||||||
|
|
||||||
|
//绑定请求对象和请求条件
|
||||||
|
SearchRequest source = searchRequest.source(sourceBuilder);
|
||||||
|
ArrayList<Health> health = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
SearchResponse search = client.search(source, RequestOptions.DEFAULT);
|
||||||
|
SearchHits hits = search.getHits();
|
||||||
|
for (SearchHit hit : hits.getHits()) {
|
||||||
|
Map<String, HighlightField> highlightFields = hit.getHighlightFields();
|
||||||
|
HighlightField name = highlightFields.get("healthTitle");
|
||||||
|
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
for (Text fragment : name.getFragments()) {
|
||||||
|
System.out.println("fragment"+fragment);
|
||||||
|
stringBuffer.append(fragment);
|
||||||
|
}
|
||||||
|
|
||||||
|
String sourceAsString = hit.getSourceAsString();
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.bwie.es.sync;
|
||||||
|
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.es.feign.EsFeign;
|
||||||
|
import com.bwie.es.service.EsService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.elasticsearch.client.RestHighLevelClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: ZhangYao
|
||||||
|
* @create: 2023-12-19 20:31
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class HealthSync{
|
||||||
|
@Autowired
|
||||||
|
private EsService esService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EsFeign esFeign;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RestHighLevelClient client;
|
||||||
|
|
||||||
|
@Scheduled(cron = " * * * * * * ")
|
||||||
|
public void esHealth(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9099
|
port: 9006
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
main:
|
main:
|
||||||
|
@ -10,29 +10,31 @@ spring:
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
application:
|
application:
|
||||||
# 应用名称
|
# 应用名称
|
||||||
name: bwie-case
|
name: bwie-es
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: dev
|
active: dev
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
|
||||||
|
|
||||||
fdfs:
|
fdfs:
|
||||||
so-timeout: 1500 # socket 连接时长
|
so-timeout: 1500 # socket 连接时长
|
||||||
connect-timeout: 600 # 连接 tracker 服务器超时时长
|
connect-timeout: 600 # 连接 tracker 服务器超时时长
|
||||||
# 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
|
# 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
|
||||||
tracker-list: 43.143.161.183:22122
|
tracker-list: 124.221.211.96:22122
|
||||||
web-server-url: 43.143.161.183:8888
|
web-server-url: 124.221.211.96:8888
|
||||||
pool:
|
pool:
|
||||||
jmx-enabled: false
|
jmx-enabled: false
|
||||||
# 生成缩略图
|
# 生成缩略图
|
|
@ -1,38 +0,0 @@
|
||||||
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
|
|
|
@ -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>bwie-modules</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>bwie-formation</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,13 +0,0 @@
|
||||||
package com.bwie.formaiton;
|
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
@MapperScan("com.bwie.formaiton.mapper")
|
|
||||||
public class FormaitonAppliaction {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(FormaitonAppliaction.class,args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.bwie.formaiton.controller;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Formation;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.formaiton.service.FormationService;
|
|
||||||
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 java.util.List;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
public class FormationController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FormationService formationService;
|
|
||||||
|
|
||||||
@PostMapping("/list")
|
|
||||||
public Result<List<Formation>> list(){
|
|
||||||
return formationService.list();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/insert")
|
|
||||||
public Result<Integer> insert(@RequestBody Formation formation){
|
|
||||||
return formationService.insert(formation);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.bwie.formaiton.mapper;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Formation;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface FormationMapper {
|
|
||||||
List<Formation> list();
|
|
||||||
|
|
||||||
Integer insert(Formation formation);
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
package com.bwie.formaiton.service;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Formation;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface FormationService {
|
|
||||||
Result<List<Formation>> list();
|
|
||||||
|
|
||||||
Result<Integer> insert(Formation formation);
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
package com.bwie.formaiton.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.bwie.common.constants.TokenConstants;
|
|
||||||
import com.bwie.common.domain.Formation;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.common.utils.JwtUtils;
|
|
||||||
import com.bwie.formaiton.mapper.FormationMapper;
|
|
||||||
import com.bwie.formaiton.service.FormationService;
|
|
||||||
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;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class FormationServiceImpl implements FormationService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private FormationMapper formationMapper;
|
|
||||||
@Autowired
|
|
||||||
private StringRedisTemplate redisTemplate;
|
|
||||||
@Autowired
|
|
||||||
private HttpServletRequest request;
|
|
||||||
@Override
|
|
||||||
public Result<List<Formation>> list() {
|
|
||||||
// 调用formationMapper的list方法,获取Formation列表
|
|
||||||
List<Formation> list = formationMapper.list();
|
|
||||||
// 返回成功结果,包含Formation列表
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result<Integer> insert(Formation formation) {
|
|
||||||
// 获取token
|
|
||||||
String token = request.getHeader(TokenConstants.TOKEN);
|
|
||||||
// 获取用户key
|
|
||||||
String userKey = JwtUtils.getUserKey(token);
|
|
||||||
// 从redis中获取用户信息
|
|
||||||
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
|
|
||||||
// 将用户信息转换成User对象
|
|
||||||
User user = JSON.parseObject(s, User.class);
|
|
||||||
// 将用户信息设置到formation对象中
|
|
||||||
formation.setUserId(user.getId());
|
|
||||||
formation.setUserName(user.getUsername());
|
|
||||||
formation.setUserPwd(user.getPassword());
|
|
||||||
// 插入formation表
|
|
||||||
Integer i = formationMapper.insert(formation);
|
|
||||||
// 返回插入的条数
|
|
||||||
return Result.success(i);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
# Tomcat
|
|
||||||
server:
|
|
||||||
port: 9002
|
|
||||||
# Spring
|
|
||||||
spring:
|
|
||||||
main:
|
|
||||||
allow-circular-references: true
|
|
||||||
jackson:
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
time-zone: GMT+8
|
|
||||||
application:
|
|
||||||
# 应用名称
|
|
||||||
name: bwie-formation
|
|
||||||
profiles:
|
|
||||||
# 环境配置
|
|
||||||
active: dev
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: 122.51.35.58:8848
|
|
||||||
config:
|
|
||||||
# 配置中心地址
|
|
||||||
server-addr: 122.51.35.58:8848
|
|
||||||
# 配置文件格式
|
|
||||||
file-extension: yml
|
|
||||||
# 共享配置
|
|
||||||
shared-configs:
|
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
|
@ -1,13 +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.formaiton.mapper.FormationMapper">
|
|
||||||
<insert id="insert">
|
|
||||||
INSERT INTO `health`.`formation` (`formation_press`, `formation_sugar`, `formation_date`, `formation_address`, `user_id`, `user_name`, `user_pwd`, `formation_phone`,`formation_age`, `formation_sex`, `formation_name`, `is_dele`) VALUES
|
|
||||||
(#{formationPress}, #{formationSugar}, now(), #{formationAddress}, #{userId}, #{userName}, #{userPwd}, #{formationPhone},#{formationAge}, #{formationSex}, #{formationName}, 1);
|
|
||||||
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<select id="list" resultType="com.bwie.common.domain.Formation">
|
|
||||||
select * from formation f left join user u on f.user_id=u.id
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -1,38 +0,0 @@
|
||||||
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
|
|
|
@ -18,6 +18,7 @@ public class HealthController{
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public Result<PageInfo<Health>> list(@RequestBody Health health){
|
public Result<PageInfo<Health>> list(@RequestBody Health health){
|
||||||
|
System.out.println(health);
|
||||||
return healthService.list(health);
|
return healthService.list(health);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ public class HealthController{
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/deleteHealth")
|
@PostMapping("/deleteHealth")
|
||||||
public Result<Integer> deleteHealth(@RequestParam String healthId){
|
public Result<Integer> deleteHealth(@RequestParam Integer healthId){
|
||||||
return healthService.deleteHealth(healthId);
|
return healthService.deleteHealth(healthId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package com.bwie.health.mapper;
|
||||||
import com.bwie.common.domain.Health;
|
import com.bwie.common.domain.Health;
|
||||||
import com.bwie.common.result.Result;
|
import com.bwie.common.result.Result;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -14,5 +16,5 @@ public interface HealthMapper{
|
||||||
|
|
||||||
Integer updateHealth(Health health);
|
Integer updateHealth(Health health);
|
||||||
|
|
||||||
Integer deleteHealth(String healthId);
|
Integer deleteHealth(@Param("healthId") Integer healthId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@ public interface HealthService{
|
||||||
|
|
||||||
Result<Integer> updateHealth(Health health);
|
Result<Integer> updateHealth(Health health);
|
||||||
|
|
||||||
Result<Integer> deleteHealth(String healthId);
|
Result<Integer> deleteHealth(Integer healthId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import com.bwie.common.constants.TokenConstants;
|
import com.bwie.common.constants.TokenConstants;
|
||||||
import com.bwie.common.domain.Health;
|
import com.bwie.common.domain.Health;
|
||||||
import com.bwie.common.domain.User;
|
import com.bwie.common.domain.User;
|
||||||
|
import com.bwie.common.exception.auth.AuthException;
|
||||||
import com.bwie.common.result.Result;
|
import com.bwie.common.result.Result;
|
||||||
import com.bwie.common.utils.JwtUtils;
|
import com.bwie.common.utils.JwtUtils;
|
||||||
import com.bwie.health.mapper.HealthMapper;
|
import com.bwie.health.mapper.HealthMapper;
|
||||||
|
@ -28,35 +29,25 @@ public class HealthServiceImpl implements HealthService{
|
||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
|
|
||||||
/*查看内容*/
|
/*查看内容*/
|
||||||
@Override
|
@Override
|
||||||
public Result<PageInfo<Health>> list(Health health) {
|
public Result<PageInfo<Health>> list(Health health) {
|
||||||
// 调用PageHelper的startPage方法,传入当前页码和每页条数
|
|
||||||
PageHelper.startPage(health.getPageNum(),health.getPageSize());
|
PageHelper.startPage(health.getPageNum(),health.getPageSize());
|
||||||
// 调用healthMapper的list方法,传入health参数
|
|
||||||
List<Health> list = healthMapper.list(health);
|
List<Health> list = healthMapper.list(health);
|
||||||
// 创建PageInfo对象,传入list
|
|
||||||
PageInfo<Health> info = new PageInfo<>(list);
|
PageInfo<Health> info = new PageInfo<>(list);
|
||||||
// 返回Result.success方法,传入info
|
|
||||||
return Result.success(info);
|
return Result.success(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*健康教育信息录入*/
|
/*健康教育信息录入*/
|
||||||
@Override
|
@Override
|
||||||
public Result<Integer> addHealth(Health health) {
|
public Result<Integer> addHealth(Health health) {
|
||||||
//获取token
|
String token1 = request.getHeader(TokenConstants.TOKEN);
|
||||||
String token1 = request.getHeader("token");
|
|
||||||
//根据token获取用户key
|
|
||||||
String userKey = JwtUtils.getUserKey(token1);
|
String userKey = JwtUtils.getUserKey(token1);
|
||||||
//根据用户key获取token
|
|
||||||
String token = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY+userKey);
|
String token = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY+userKey);
|
||||||
//根据token解析出用户信息
|
|
||||||
User o = JSONObject.parseObject(token, User.class);
|
User o = JSONObject.parseObject(token, User.class);
|
||||||
//将用户信息设置到health中
|
|
||||||
health.setUserId(o.getId());
|
health.setUserId(o.getId());
|
||||||
|
|
||||||
//调用healthMapper的addHealth方法添加health
|
|
||||||
Integer i = healthMapper.addHealth(health);
|
Integer i = healthMapper.addHealth(health);
|
||||||
|
|
||||||
//根据返回结果返回对应信息
|
|
||||||
return Result.success(i,i>0?"录入成功":"录入失败");
|
return Result.success(i,i>0?"录入成功":"录入失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +60,7 @@ public class HealthServiceImpl implements HealthService{
|
||||||
|
|
||||||
/*健康教育记录删除*/
|
/*健康教育记录删除*/
|
||||||
@Override
|
@Override
|
||||||
public Result<Integer> deleteHealth(String healthId) {
|
public Result<Integer> deleteHealth(Integer healthId) {
|
||||||
Integer i = healthMapper.deleteHealth(healthId);
|
Integer i = healthMapper.deleteHealth(healthId);
|
||||||
return Result.success(i,i>0?"删除成功":"删除失败");
|
return Result.success(i,i>0?"删除成功":"删除失败");
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,11 @@ spring:
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地43.143.161.183
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -17,16 +17,17 @@
|
||||||
WHERE `health_id` = #{healthId}
|
WHERE `health_id` = #{healthId}
|
||||||
</update>
|
</update>
|
||||||
<update id="deleteHealth">
|
<update id="deleteHealth">
|
||||||
|
UPDATE `health`.`health` SET `is_dele` = 2 WHERE `health_id` = #{healthId};
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="list" resultType="com.bwie.common.domain.Health">
|
<select id="list" resultType="com.bwie.common.domain.Health">
|
||||||
select * from health h left join user u on h.user_id=u.id
|
select * from health h left join user u on h.user_id=u.id
|
||||||
<!-- <where>-->
|
<where>
|
||||||
<!-- <if test="">-->
|
<if test="healthTitle!=null and healthTitle!=''">
|
||||||
|
and h.health_title like concat('%',#{healthTitle},'%')
|
||||||
<!-- </if>-->
|
</if>
|
||||||
<!-- </where>-->
|
</where>
|
||||||
|
and h.is_dele = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -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>bwie-modules</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>bwie-manage</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,11 +0,0 @@
|
||||||
package com.bwie.manage;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
public class ManageApp {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(ManageApp.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
package com.bwie.manage.controller;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Case;
|
|
||||||
import com.bwie.common.domain.Manage;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.manage.service.ManageService;
|
|
||||||
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.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
public class ManageController {
|
|
||||||
@Autowired
|
|
||||||
private ManageService manageService;
|
|
||||||
|
|
||||||
@PostMapping("/list")
|
|
||||||
public Result list(){
|
|
||||||
return manageService.list();
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/add")
|
|
||||||
public Result add(@RequestBody Manage manage){
|
|
||||||
return manageService.add(manage);
|
|
||||||
}
|
|
||||||
@PostMapping("/upd")
|
|
||||||
public Result upd(@RequestBody Manage manage){
|
|
||||||
return manageService.upd(manage);
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/del")
|
|
||||||
public Result del(@RequestParam Integer manageId){
|
|
||||||
return manageService.del(manageId);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package com.bwie.manage.mapper;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Manage;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
@Component
|
|
||||||
public interface ManageMapper {
|
|
||||||
List<Manage> list();
|
|
||||||
|
|
||||||
Integer add(Manage manage);
|
|
||||||
|
|
||||||
Integer upd(Manage manage);
|
|
||||||
|
|
||||||
Integer del(Integer manageId);
|
|
||||||
|
|
||||||
Manage findAll(Manage manage);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.bwie.manage.service;
|
|
||||||
|
|
||||||
import com.bwie.common.domain.Manage;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
|
|
||||||
public interface ManageService {
|
|
||||||
Result list();
|
|
||||||
|
|
||||||
Result add(Manage manage);
|
|
||||||
|
|
||||||
Result upd(Manage manage);
|
|
||||||
|
|
||||||
Result del(Integer manageId);
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
package com.bwie.manage.service.impl;
|
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.bwie.common.constants.TokenConstants;
|
|
||||||
import com.bwie.common.domain.Manage;
|
|
||||||
import com.bwie.common.domain.User;
|
|
||||||
import com.bwie.common.result.Result;
|
|
||||||
import com.bwie.common.utils.JwtUtils;
|
|
||||||
import com.bwie.manage.mapper.ManageMapper;
|
|
||||||
import com.bwie.manage.service.ManageService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ManageServiceCs implements ManageService {
|
|
||||||
@Autowired
|
|
||||||
private ManageMapper manageMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisTemplate<String ,String > redisTemplate;
|
|
||||||
@Autowired
|
|
||||||
private HttpServletRequest request;
|
|
||||||
@Override
|
|
||||||
public Result list() {
|
|
||||||
List<Manage> list = manageMapper.list();
|
|
||||||
return Result.success(list,"列表");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result add(Manage manage) {
|
|
||||||
|
|
||||||
String token = request.getHeader("token");
|
|
||||||
String userKey = JwtUtils.getUserKey(token);
|
|
||||||
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
|
|
||||||
User user = JSONObject.parseObject(s, User.class);
|
|
||||||
manage.setId(user.getId());
|
|
||||||
Manage all = manageMapper.findAll(manage);
|
|
||||||
if (all!=null){
|
|
||||||
return Result.error("存在此病人不能添加");
|
|
||||||
}
|
|
||||||
Integer add=manageMapper.add(manage);
|
|
||||||
return Result.success(add>0?200:500,add>0?"添加成功":"添加失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result upd(Manage manage) {
|
|
||||||
Integer upd=manageMapper.upd(manage);
|
|
||||||
return Result.success(upd>0?200:500,upd>0?"添加成功":"添加失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Result del(Integer manageId) {
|
|
||||||
Integer del=manageMapper.del(manageId);
|
|
||||||
return Result.success(del>0?200:500,del>0?"删除成功":"删除失败");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
# Tomcat
|
|
||||||
server:
|
|
||||||
port: 9005
|
|
||||||
# Spring
|
|
||||||
spring:
|
|
||||||
main:
|
|
||||||
allow-circular-references: true
|
|
||||||
jackson:
|
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
time-zone: GMT+8
|
|
||||||
application:
|
|
||||||
# 应用名称
|
|
||||||
name: bwie-manage
|
|
||||||
profiles:
|
|
||||||
# 环境配置
|
|
||||||
active: dev
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
# 服务注册地址
|
|
||||||
server-addr: 43.143.161.183:8848
|
|
||||||
config:
|
|
||||||
# 配置中心地址
|
|
||||||
server-addr: 43.143.161.183:8848
|
|
||||||
# 配置文件格式
|
|
||||||
file-extension: yml
|
|
||||||
# 共享配置
|
|
||||||
shared-configs:
|
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
|
|
@ -1,23 +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.manage.mapper.ManageMapper">
|
|
||||||
<insert id="add">
|
|
||||||
INSERT INTO `health`.`t_manage` (`case_id`, `id`)
|
|
||||||
VALUES (#{caseId}, #{id});
|
|
||||||
</insert>
|
|
||||||
<update id="upd">
|
|
||||||
UPDATE `health`.`t_manage` SET `case_id` = #{caseId},
|
|
||||||
`id` = #{id}
|
|
||||||
WHERE `manage_id` = #{manageId};
|
|
||||||
</update>
|
|
||||||
<delete id="del">
|
|
||||||
delete from t_manage where manage_id=#{manageId}
|
|
||||||
</delete>
|
|
||||||
<select id="list" resultType="com.bwie.common.domain.Manage">
|
|
||||||
select m.*,c.case_name,c.case_time,c.case_message,u.username from t_manage m left join cases c on m.case_id=c.case_id
|
|
||||||
left join user u on m.id=u.id
|
|
||||||
</select>
|
|
||||||
<select id="findAll" resultType="com.bwie.common.domain.Manage">
|
|
||||||
select *from t_manage where case_id=#{caseId} and id=#{id}
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
<?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>Java-Heathl</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bwie-trees</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>
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.bwie.trees;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class TreesApplication{
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(TreesApplication.class,args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.bwie.trees.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Trees;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.trees.service.TreesService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
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.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Log4j2
|
||||||
|
@RequestMapping("/tress")
|
||||||
|
public class TreesController{
|
||||||
|
@Autowired
|
||||||
|
private TreesService treesService;
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
@PostMapping("/selectOne")
|
||||||
|
public Result<List<Trees>> Select(){
|
||||||
|
return treesService.treesSelect();
|
||||||
|
}
|
||||||
|
// @PostMapping("/SelectOne")
|
||||||
|
// public Result<List<Trees>> SelectOne(){
|
||||||
|
// return treesService.treesSelectOne();
|
||||||
|
// }
|
||||||
|
@PostMapping("/selectTwo")
|
||||||
|
public Result<List<Trees>> SelectTwo(){
|
||||||
|
return treesService.treesSelectTwo();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.trees.mapper;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Trees;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TreesMapper{
|
||||||
|
List<Trees> treesSelect();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.trees.service;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Trees;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TreesService{
|
||||||
|
Result<List<Trees>> treesSelect();
|
||||||
|
|
||||||
|
// Result<List<Trees>> treesSelectOne();
|
||||||
|
|
||||||
|
Result<List<Trees>> treesSelectTwo();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.bwie.trees.service.impl;
|
||||||
|
|
||||||
|
import com.bwie.common.domain.Trees;
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.trees.mapper.TreesMapper;
|
||||||
|
import com.bwie.trees.service.TreesService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class TreesServiceImpl implements TreesService{
|
||||||
|
@Autowired
|
||||||
|
private TreesMapper treesMapper;
|
||||||
|
|
||||||
|
@Override/*1.查询表*/
|
||||||
|
public Result<List<Trees>> treesSelect() {
|
||||||
|
List<Trees> list = treesMapper.treesSelect();
|
||||||
|
return Result.success(list,"查询成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public Result<List<Trees>> treesSelectOne() {
|
||||||
|
// Result<List<Trees>> listResult = this.treesSelect();
|
||||||
|
// List<Trees> treesList = listResult.getData();
|
||||||
|
// List<Trees> collect = treesList.stream().
|
||||||
|
// filter(trees -> trees.getTreesId() == 0).
|
||||||
|
// peek(trees -> trees.setChildren(getChildren(trees,treesList).isEmpty() ? null : getChildren(trees,treesList))).
|
||||||
|
// sorted().
|
||||||
|
// collect(Collectors.toList());
|
||||||
|
// return Result.success(collect);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Result<List<Trees>> treesSelectTwo() {
|
||||||
|
Result<List<Trees>> listResult = this.treesSelect();
|
||||||
|
List<Trees> treesList = listResult.getData();
|
||||||
|
List<Trees> collect = treesList
|
||||||
|
.stream()
|
||||||
|
.filter(trees -> trees.getTreesId() == 0)
|
||||||
|
.peek(trees -> trees.setChildren(getChildren(trees, treesList).isEmpty() ? null : getChildren(trees,treesList)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return Result.success(collect);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Trees> getChildren(Trees tree, List<Trees> treesList){
|
||||||
|
List<Trees> collect = treesList.stream()//转Stream型
|
||||||
|
.filter(trees -> trees.getTreesId() == tree.getId())//过滤父类ID是否等于主键ID
|
||||||
|
.peek(trees -> trees.setChildren(getChildren(trees, treesList).isEmpty() ? null : getChildren(trees, treesList)))//给属性设置
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return collect;
|
||||||
|
}
|
||||||
|
|
||||||
|
// private List<Trees> getCidrens(//对象 ,//list集合)
|
||||||
|
// {
|
||||||
|
// 将list集合转stream
|
||||||
|
// .filter来进行一个过滤
|
||||||
|
// .peek设置属性
|
||||||
|
// .collect存入list
|
||||||
|
// }
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9005
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bwie-trees
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地
|
||||||
|
server-addr: 124.221.211.96:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 124.221.211.96: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.221.211.96:22122
|
||||||
|
web-server-url: 124.221.211.96:8888
|
||||||
|
pool:
|
||||||
|
jmx-enabled: false
|
||||||
|
# 生成缩略图
|
||||||
|
thumb-image:
|
||||||
|
height: 500
|
||||||
|
width: 500
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?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.trees.mapper.TreesMapper">
|
||||||
|
|
||||||
|
<select id="treesSelect" resultType="com.bwie.common.domain.Trees">
|
||||||
|
select * from trees
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -1,6 +1,6 @@
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server:
|
server:
|
||||||
port: 9009
|
port: 9002
|
||||||
# Spring
|
# Spring
|
||||||
spring:
|
spring:
|
||||||
main:
|
main:
|
||||||
|
@ -18,10 +18,10 @@ spring:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.143.161.183:8848
|
server-addr: 124.221.211.96:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
<modules>
|
<modules>
|
||||||
<module>bwie-user</module>
|
<module>bwie-user</module>
|
||||||
<module>bwie-health</module>
|
<module>bwie-health</module>
|
||||||
<module>bwie-formation</module>
|
|
||||||
<module>bwie-cases</module>
|
|
||||||
<module>bwie-manage</module>
|
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -25,4 +22,4 @@
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
4
pom.xml
4
pom.xml
|
@ -13,6 +13,8 @@
|
||||||
<module>bwie-gateway</module>
|
<module>bwie-gateway</module>
|
||||||
<module>bwie-modules</module>
|
<module>bwie-modules</module>
|
||||||
<module>bwie-auth</module>
|
<module>bwie-auth</module>
|
||||||
|
<module>bwie-modules/bwie-trees</module>
|
||||||
|
<module>bwie-modules/bwie-es</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -63,4 +65,4 @@
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in New Issue