#1

Merged
zhouzhou merged 1 commits from zhou into master 2023-12-21 17:30:12 +08:00
47 changed files with 1724 additions and 27 deletions

View File

@ -4,7 +4,9 @@
<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-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-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-modules/bwie-health/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-mq/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/bwie-modules/bwie-mq/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-notice/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/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" />

View File

@ -0,0 +1,124 @@
<?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>

View File

@ -5,15 +5,29 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="2264b00c-a866-471a-9769-9a0864968167" name="Changes" comment="后台框架"> <list default="true" id="2264b00c-a866-471a-9769-9a0864968167" name="Changes" comment="后台框架">
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/bwie-auth/bootstrap.yml" beforeDir="false" /> <change beforePath="$PROJECT_DIR$/bwie-common/src/main/java/com/bwie/common/domain/User.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/bwie-common/src/main/java/com/bwie/common/domain/request/Userlogin.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-common/src/main/java/com/bwie/common/domain/request/Userlogin.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bwie-common/src/main/java/com/bwie/common/domain/response/UserResponse.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-common/src/main/java/com/bwie/common/domain/response/UserResponse.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bwie-common/src/main/java/com/bwie/common/result/Result.java" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-common/src/main/java/com/bwie/common/result/Result.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bwie-modules/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/bwie-modules/pom.xml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" /> <option name="LAST_RESOLUTION" value="IGNORE" />
</component> </component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Interface" />
<option value="Mapper" />
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
@ -34,30 +48,141 @@
</component> </component>
<component name="PropertiesComponent"><![CDATA[{ <component name="PropertiesComponent"><![CDATA[{
"keyToString": { "keyToString": {
"RequestMappingsPanelOrder0": "0",
"RequestMappingsPanelOrder1": "1",
"RequestMappingsPanelWidth0": "75",
"RequestMappingsPanelWidth1": "75",
"RunOnceActivity.OpenProjectViewOnStart": "true", "RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true",
"WebServerToolWindowFactoryState": "false", "WebServerToolWindowFactoryState": "false",
"git-widget-placeholder": "master", "git-widget-placeholder": "master",
"jdk.selected.JAVA_MODULE": "1.8", "jdk.selected.JAVA_MODULE": "1.8",
"last_opened_file_path": "F:/task/mqis/bwie-modules/bwie-mq/src/main/resources", "last_opened_file_path": "F:/task/day09/bwie-modules/bwie-health/src/main/resources",
"node.js.detected.package.eslint": "true", "node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true", "node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)", "node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)", "node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm", "nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "project.propVCSSupport.DirectoryMappings", "settings.editor.selected.configurable": "project.propVCSSupport.DirectoryMappings",
"spring.configuration.checksum": "e4efe4188c98b300da52f5e1a650a8f9", "spring.configuration.checksum": "5de7b6514bd4a64f9d0445dc77c1e5fd",
"vue.rearranger.settings.migration": "true" "vue.rearranger.settings.migration": "true"
} }
}]]></component> }]]></component>
<component name="ReactorSettings">
<option name="notificationShown" value="true" />
</component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS"> <key name="CreateClassDialog.RecentsKey">
<recent name="F:\task\mqis\bwie-modules\bwie-mq\src\main\resources" /> <recent name="com.bwie.mapper" />
<recent name="F:\task\mqis\bwie-modules\bwie-mq\src\main\java" /> <recent name="com.bwie.service" />
<recent name="F:\task\mqis\bwie-modules\bwie-user\src\main\resources" /> <recent name="com.bwie.feign" />
<recent name="F:\task\mqis\bwie-modules\bwie-user\src\main\java" />
<recent name="F:\task\mqis\bwie-gateway\src\main\java" />
</key> </key>
<key name="CopyFile.RECENT_KEYS">
<recent name="F:\task\day09\bwie-modules\bwie-health\src\main\resources" />
<recent name="F:\task\day09\bwie-modules\bwie-health\src\main\java" />
<recent name="F:\task\day09\bwie-modules\bwie-notice\src\main\resources" />
<recent name="F:\task\day09\bwie-modules\bwie-notice\src\main\java" />
<recent name="F:\task\day09\bwie-gateway\src\main\resources" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="com.bwie.common.domain.request" />
<recent name="com.bwie" />
<recent name="com.bwie.gateway" />
</key>
</component>
<component name="RunDashboard">
<option name="configurationTypes">
<set>
<option value="SpringBootApplicationConfigurationType" />
</set>
</option>
</component>
<component name="RunManager" selected="Spring Boot.HealthApplication">
<configuration default="true" type="JetRunConfigurationType">
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType">
<option name="filePath" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="AuthApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
<module name="bwie-auth" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bwie.AuthApplication" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.bwie.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="GatewayApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
<module name="bwie-gateway" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bwie.gateway.GatewayApplication" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.bwie.gateway.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<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.HealthApplication" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.bwie.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="NoticeApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
<module name="bwie-notice" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bwie.NoticeApplication" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.bwie.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="UserApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" temporary="true" nameIsGenerated="true">
<module name="bwie-user" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.bwie.UserApplication" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.bwie.*" />
<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" />
<item itemvalue="Spring Boot.NoticeApplication" />
<item itemvalue="Spring Boot.AuthApplication" />
<item itemvalue="Spring Boot.UserApplication" />
<item itemvalue="Spring Boot.GatewayApplication" />
</list>
</recent_temporary>
</component> </component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="SshConsoleOptionsProvider"> <component name="SshConsoleOptionsProvider">
@ -74,6 +199,8 @@
<workItem from="1702861158235" duration="1921000" /> <workItem from="1702861158235" duration="1921000" />
<workItem from="1702863474710" duration="1170000" /> <workItem from="1702863474710" duration="1170000" />
<workItem from="1702865515208" duration="937000" /> <workItem from="1702865515208" duration="937000" />
<workItem from="1702886885348" duration="11341000" />
<workItem from="1702947297029" duration="2921000" />
</task> </task>
<task id="LOCAL-00001" summary="后台框架"> <task id="LOCAL-00001" summary="后台框架">
<option name="closed" value="true" /> <option name="closed" value="true" />

View File

@ -0,0 +1,21 @@
package com.bwie;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @Author: zhx
* @Package: com.bwie
* @Datetime: 2023/12/18 16:12
* @Filename: AuthApplication
*/
@SpringBootApplication
@EnableFeignClients
public class AuthApplication {
public static void main(String[] args) {
SpringApplication.run(AuthApplication.class);
}
}

View File

@ -0,0 +1,49 @@
package com.bwie.controller;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.domain.request.Userlogin;
import com.bwie.common.result.Result;
import com.bwie.service.AuthService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* @Author: zhx
* @Package: com.bwie.controller
* @Datetime: 2023/12/18 16:10
* @Filename: AuthController
*/
@RestController
@Log4j2
public class AuthController {
@Autowired
private AuthService authService;
@Autowired
private HttpServletRequest request;
@GetMapping("/getCode/{phone}")
public Result getCode(@PathVariable String phone){
log.info("功能名称:获取登录验证码,请求URI:{},请求方式:{},请求参数:{}",
request.getRequestURI(),request.getMethod(),phone);
Result result = authService.getCode(phone);
log.info("功能名称:获取登录验证码,请求URI:{},请求方式:{},响应结果:{}",
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
@PostMapping("/login")
public Result login(@RequestBody Userlogin userlogin){
log.info("功能名称:xxx,请求URI:{},请求方式:{},请求参数:{}",
request.getRequestURI(),request.getMethod(),userlogin);
Result result = authService.login(userlogin);
log.info("功能名称:xxx,请求URI:{},请求方式:{},响应结果:{}",
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
}

View File

@ -0,0 +1,19 @@
package com.bwie.feign;
import com.bwie.common.domain.Admin;
import com.bwie.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Author: zhx
* @Package: com.bwie.feign
* @Datetime: 2023/12/18 16:14
* @Filename: AuthFeign
*/
@FeignClient("bwie-user")
public interface AuthFeign {
@GetMapping("/findPhone")
public Result<Admin> findPhone(@RequestParam String phone);
}

View File

@ -0,0 +1,17 @@
package com.bwie.service;
import com.bwie.common.domain.request.Userlogin;
import com.bwie.common.result.Result;
/**
* @Author: zhx
* @Package: com.bwie.service
* @Datetime: 2023/12/18 16:11
* @Filename: AuthService
*/
public interface AuthService {
Result getCode(String phone);
Result login(Userlogin userlogin);
}

View File

@ -0,0 +1,86 @@
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.request.Userlogin;
import com.bwie.common.result.Result;
import com.bwie.common.utils.JwtUtils;
import com.bwie.feign.AuthFeign;
import com.bwie.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Random;
import java.util.concurrent.TimeUnit;
/**
* @Author: zhx
* @Package: com.bwie.service.impl
* @Datetime: 2023/12/18 16:11
* @Filename: AuthServiceImpl
*/
@Service
public class AuthServiceImpl implements AuthService {
@Autowired
private AuthFeign authFeign;
@Autowired
private RedisTemplate<String,Object> redisTemplate;
@Override
public Result getCode(String phone) {
Result<Admin> result = authFeign.findPhone(phone);
Admin data = result.getData();
if(data==null){
return Result.error("用户不存在");
}
String code = "";
for (int i = 0; i < 4; i++) {
code+=new Random().nextInt(10);
}
System.out.println("生成的验证码为:"+code);
redisTemplate.opsForValue().set(phone,code,15, TimeUnit.MINUTES);
return Result.success(code,"获取验证码成功");
}
@Override
public Result login(Userlogin userlogin) {
Result<Admin> result = authFeign.findPhone(userlogin.getPhone());
Admin admin = result.getData();
if(admin==null){
return Result.error("用户不存在");
}
if(!redisTemplate.hasKey(userlogin.getPhone())){
return Result.error("验证码过期");
}
Object o = redisTemplate.opsForValue().get(userlogin.getPhone());
String o1 = (String) o;
if(!userlogin.getCode().equals(redisTemplate.opsForValue().get(userlogin.getPhone()))) {
return Result.error("验证码有误");
}
HashMap<String, Object> map = new HashMap<>();
map.put(JwtConstants.USER_PHONE,userlogin.getPhone());
String token = JwtUtils.createToken(map);
admin.setToken(token);
redisTemplate.opsForValue().set(JwtConstants.LOGIN_TOKEN+token, JSON.toJSONString(admin),30,TimeUnit.MINUTES);
return Result.success(admin,"登录成功");
}
}

View File

@ -0,0 +1,59 @@
package com.bwie.common.domain;
import lombok.Data;
/**
* @Author: zhx
* @Package: com.bwie.common.domain
* @Datetime: 2023/12/18 16:15
* @Filename: Admin
*/
@Data
public class Admin {
/**
*
*/
private String adminId;
/**
*
*/
private String userName;
/**
*
*/
private String passWord;
/**
*
*/
private String name;
/**
* 1 2
*/
private String gender;
/**
*
*/
private String age;
/**
*
*/
private String phoneNum;
/**
*
*/
private String email;
/**
*
*/
private String avatar;
/**
* token
*/
private String token;
/**
*
*/
private String code;
}

View File

@ -0,0 +1,54 @@
package com.bwie.common.domain;
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @Author: zhx
* @Package: com.bwie.common.domain
* @Datetime: 2023/12/19 9:11
* @Filename: Aop
*/
@Data
public class Aop {
/**
*
*/
/**
* id
*/
private Integer aopId;
/**
*
*/
private String aopName;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date aopTime;
/**
*
*/
private Integer adminId;
public Aop() {
}
public Aop(String aopName, Integer adminId) {
this.aopName = aopName;
this.adminId = adminId;
}
}

View File

@ -0,0 +1,54 @@
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/18 20:30
* @Filename: Health
*/
@Data
public class Health {
/**
*
*/
private Integer healthId;
/**
*
*/
private String healthText;
/**
*
*/
private String healthPic;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date healthTime;
/**
*id
*/
private Integer stuId;
/**
*
*/
private String name;
/**
*id
*/
private Integer clazzId;
/**
*
*/
private String clazzName;
}

View File

@ -0,0 +1,41 @@
package com.bwie.common.domain;
import lombok.Data;
/**
* @Author: zhx
* @Package: com.bwie.common.domain
* @Datetime: 2023/12/18 17:19
* @Filename: Notice
*/
@Data
public class Notice {
/**
*
*/
/**
*
*/
private String id;
/**
*
*/
private String title;
/**
*
*/
private String content;
/**
*
*/
private String author;
/**
*
*/
private String releaseTime;
}

View File

@ -1,16 +0,0 @@
package com.bwie.common.domain;
import lombok.Data;
@Data
public class User {
private Integer userId;
private String userName;
private String code;
private String token;
private String userPwd;
private String phone;
}

View File

@ -0,0 +1,45 @@
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;
/**
* @Author: zhx
* @Package: com.bwie.common.domain.request
* @Datetime: 2023/12/18 19:08
* @Filename: HealthRequest
*/
@Data
public class HealthRequest {
/**
*
*/
private String healthText;;
/**
*
*/
private Integer stuId;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/**
*
*/
private Integer pageNum = 1;
private Integer pageSize = 4;
}

View File

@ -0,0 +1,50 @@
package com.bwie.common.domain.request;
import com.bwie.common.result.PageResult;
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.request
* @Datetime: 2023/12/18 19:08
* @Filename: NoticeRequest
*/
@Data
public class NoticeRequest {
/**
*
*/
private String title;
/**
*
*/
private String author;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/**
*
*/
private Integer pageNum = 1;
private Integer pageSize = 4;
}

View File

@ -0,0 +1,50 @@
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;
/**
* @Author: zhx
* @Package: com.bwie.common.domain.request
* @Datetime: 2023/12/18 20:55
* @Filename: PutHealth
*/
@Data
public class PutHealth {
/**
*
*/
/**
*
*/
private Integer healthId;
/**
*
*/
private String healthText;
/**
*
*/
private String healthPic;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date healthTime;
/**
*id
*/
private Integer stuId;
/**
*id
*/
private Integer clazzId;
}

View File

@ -1,4 +1,4 @@
package com.bw.common.domain.request; package com.bwie.common.domain.request;
import lombok.Data; import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.bw.common.domain.response; package com.bwie.common.domain.response;
import lombok.Data; import lombok.Data;

View File

@ -45,6 +45,9 @@ public class Result<T> implements Serializable {
public static <T> Result<T> success(T data, String msg) { public static <T> Result<T> success(T data, String msg) {
return restResult(data, SUCCESS, msg); return restResult(data, SUCCESS, msg);
} }
public static <T> Result<T> success(String msg) {
return restResult(null, SUCCESS, msg);
}
public static <T> Result<T> error() { public static <T> Result<T> error() {
return restResult(null, FAIL, Constants.ERROR_MSG); return restResult(null, FAIL, Constants.ERROR_MSG);

View File

@ -0,0 +1,20 @@
package com.bwie.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @Author: zhx
* @Package: com.bwie
* @Datetime: 2023/12/18 16:12
* @Filename: AuthApplication
*/
@SpringBootApplication
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class);
}
}

View File

@ -0,0 +1,80 @@
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.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;
@Component
public class AuthFilter implements GlobalFilter, Ordered {
@Autowired
private StringRedisTemplate 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过期");
}
Long expire = redisTemplate.getExpire(JwtConstants.LOGIN_TOKEN+token);
// if(expire<jwt原定过期时间的一半){
// redisTemplate.expire("token:"+userId, 60, TimeUnit.SECONDS);
// }
//自动续期 15分钟
redisTemplate.expire(JwtConstants.LOGIN_TOKEN+token,15, TimeUnit.MINUTES);
return chain.filter(exchange);
}
@Override
public int getOrder() {
return 0;
}
}

View File

@ -0,0 +1,29 @@
# Tomcat
server:
port: 18080
# Spring
spring:
application:
# 应用名称
name: bwie-gateway
profiles:
# 环境配置
active: dev
main:
# 允许使用循环引用
allow-circular-references: true
# 允许定义相同的bean对象 去覆盖原有的
allow-bean-definition-overriding: true
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}

View File

@ -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

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.bwie</groupId>
<artifactId>bwie-modules</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>bwie-health</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>

View File

@ -0,0 +1,19 @@
package com.bwie;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @Author: zhx
* @Package: com.bwie
* @Datetime: 2023/12/18 16:12
* @Filename: NoticeApplication
*/
@SpringBootApplication
public class HealthApplication {
public static void main(String[] args) {
SpringApplication.run(HealthApplication.class);
}
}

View File

@ -0,0 +1,66 @@
package com.bwie.controller;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.domain.Health;
import com.bwie.common.domain.Notice;
import com.bwie.common.domain.request.HealthRequest;
import com.bwie.common.domain.request.NoticeRequest;
import com.bwie.common.domain.request.PutHealth;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.service.HealthService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* @Author: zhx
* @Package: com.bwie.controller
* @Datetime: 2023/12/18 17:28
* @Filename: NoticeController
*/
@RestController
@Log4j2
public class HealthController {
@Autowired
private HealthService healthService;
@Autowired
private HttpServletRequest request;
/**
*
* @param healthRequest
* @return
*/
@GetMapping("/list")
public PageResult<Health> list(@RequestBody HealthRequest healthRequest){
log.info("功能名称:分页查询卫生列表,请求URI:{},请求方式:{},请求参数:{}",
request.getRequestURI(),request.getMethod(),healthRequest);
PageResult result = healthService.list(healthRequest);
log.info("功能名称:分页查询卫生列表,请求URI:{},请求方式:{},响应结果:{}",
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
@PutMapping()
public Result updateHealth(@RequestBody PutHealth putHealth){
log.info("功能名称:修改卫生信息,请求URI:{},请求方式:{},请求参数:{}",
request.getRequestURI(),request.getMethod(),putHealth);
Result result = healthService.updateHealth(putHealth);
log.info("功能名称:修改卫生信息,请求URI:{},请求方式:{},响应结果:{}",
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
}

View File

@ -0,0 +1,28 @@
package com.bwie.mapper;
import com.bwie.common.domain.Aop;
import com.bwie.common.domain.Health;
import com.bwie.common.domain.Notice;
import com.bwie.common.domain.request.HealthRequest;
import com.bwie.common.domain.request.NoticeRequest;
import com.bwie.common.domain.request.PutHealth;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author: zhx
* @Package: com.bwie.mapper
* @Datetime: 2023/12/18 19:31
* @Filename: NoticeMapper
*/
@Mapper
public interface HealthMapper {
List<Health> list(HealthRequest healthRequest);
int updateHealth(PutHealth putHealth);
void addAop(Aop aop);
}

View File

@ -0,0 +1,22 @@
package com.bwie.service;
import com.bwie.common.domain.request.HealthRequest;
import com.bwie.common.domain.request.PutHealth;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
/**
* @Author: zhx
* @Package: com.bwie.service
* @Datetime: 2023/12/18 19:30
* @Filename: NoticeService
*/
public interface HealthService {
PageResult list(HealthRequest healthRequest);
Result updateHealth(PutHealth putHealth);
}

View File

@ -0,0 +1,52 @@
package com.bwie.service.impl;
import com.bwie.common.domain.Aop;
import com.bwie.common.domain.Health;
import com.bwie.common.domain.request.HealthRequest;
import com.bwie.common.domain.request.PutHealth;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.mapper.HealthMapper;
import com.bwie.service.HealthService;
import com.github.pagehelper.PageHelper;
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/18 19:30
* @Filename: NoticeServiceImpl
*/
@Service
public class HealthServiceImpl implements HealthService {
@Autowired
private HealthMapper healthMapper;
@Override
public PageResult list(HealthRequest healthRequest) {
PageHelper.startPage(healthRequest.getPageNum(),healthRequest.getPageSize());
List<Health> list = healthMapper.list(healthRequest);
long total = list.stream().count();
return PageResult.toPageResult(total,list);
}
@Override
public Result updateHealth(PutHealth putHealth) {
int upd = healthMapper.updateHealth(putHealth);
if(upd>0){
Aop aop = new Aop("卫生修改", 1);
healthMapper.addAop(aop);
}
return Result.success(upd>0?"修改成功":"修改失败");
}
}

View File

@ -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-health
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

View File

@ -0,0 +1,36 @@
<?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.HealthMapper">
<insert id="addAop">
INSERT INTO `qmis`.`aop` ( `aop_name`, `aop_time`, `admin_id`)
VALUES ( #{aopName}, now(), #{adminId})
</insert>
<update id="updateHealth">
UPDATE `qmis`.`health` SET `health_text` = #{healthText},
`health_pic` = #{healthPic}, `health_time` = #{healthTime},
`stu_id` = #{stuId}, `clazz_id` = #{clazzId}
WHERE `health_id` = #{healthId}
</update>
<select id="list" resultType="com.bwie.common.domain.Health">
select h.*,s.name,c.clazz_name from health h left join student s on h.stu_id = s.stu_id
left join clazz c on h.clazz_id = c.clazz_id
<where>
<if test="healthText!=null and healthText !=''">
and health_text like concat('%',#{healthText},'%')
</if>
<if test="stuId!=null and stuId!=''">
and s.stu_id = #{stuId}
</if>
<if test="startTime!=null">
and release_time &gt;= #{startTime}
</if>
<if test="endTime!=null">
and release_time &lt;= #{endTime}
</if>
</where>
</select>
</mapper>

View File

@ -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

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.bwie</groupId>
<artifactId>bwie-modules</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>bwie-notice</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>

View File

@ -0,0 +1,19 @@
package com.bwie;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @Author: zhx
* @Package: com.bwie
* @Datetime: 2023/12/18 16:12
* @Filename: NoticeApplication
*/
@SpringBootApplication
public class NoticeApplication {
public static void main(String[] args) {
SpringApplication.run(NoticeApplication.class);
}
}

View File

@ -0,0 +1,44 @@
package com.bwie.controller;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.domain.Notice;
import com.bwie.common.domain.request.NoticeRequest;
import com.bwie.common.result.PageResult;
import com.bwie.service.NoticeService;
import lombok.extern.java.Log;
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.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* @Author: zhx
* @Package: com.bwie.controller
* @Datetime: 2023/12/18 17:28
* @Filename: NoticeController
*/
@RestController
@Log4j2
public class NoticeController {
@Autowired
private NoticeService noticeService;
@Autowired
private HttpServletRequest request;
@GetMapping("/list")
public PageResult<Notice> list(@RequestBody NoticeRequest noticeRequest){
log.info("功能名称:分页查询公告列表,请求URI:{},请求方式:{},请求参数:{}",
request.getRequestURI(),request.getMethod(),noticeRequest);
PageResult result = noticeService.list(noticeRequest);
log.info("功能名称:xxx,请求URI:{},请求方式:{},响应结果:{}",
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
}

View File

@ -0,0 +1,19 @@
package com.bwie.mapper;
import com.bwie.common.domain.Health;
import com.bwie.common.domain.request.NoticeRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Author: zhx
* @Package: com.bwie.mapper
* @Datetime: 2023/12/18 19:31
* @Filename: NoticeMapper
*/
@Mapper
public interface NoticeMapper {
List<Health> list(NoticeRequest noticeRequest);
}

View File

@ -0,0 +1,15 @@
package com.bwie.service;
import com.bwie.common.domain.request.NoticeRequest;
import com.bwie.common.result.PageResult;
/**
* @Author: zhx
* @Package: com.bwie.service
* @Datetime: 2023/12/18 19:30
* @Filename: NoticeService
*/
public interface NoticeService {
PageResult list(NoticeRequest noticeRequest);
}

View File

@ -0,0 +1,42 @@
package com.bwie.service.impl;
import com.bwie.common.domain.Health;
import com.bwie.common.domain.Notice;
import com.bwie.common.domain.request.NoticeRequest;
import com.bwie.common.result.PageResult;
import com.bwie.mapper.NoticeMapper;
import com.bwie.service.NoticeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
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/18 19:30
* @Filename: NoticeServiceImpl
*/
@Service
public class NoticeServiceImpl implements NoticeService {
@Autowired
private NoticeMapper noticeMapper;
@Override
public PageResult list(NoticeRequest noticeRequest) {
/*
*/
PageHelper.startPage(noticeRequest.getPageNum(),noticeRequest.getPageSize());
List<Health> list = noticeMapper.list(noticeRequest);
long total = list.stream().count();
return PageResult.toPageResult(total,list);
}
}

View File

@ -0,0 +1,41 @@
# 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-notice
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

View File

@ -0,0 +1,23 @@
<?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.NoticeMapper">
<select id="list" resultType="com.bwie.common.domain.Notice">
select * from notice
<where>
<if test="title!=null and title !=''">
and title like concat('%',#{title},'%')
</if>
<if test="author!=null and author !=''">
and author = #{author}
</if>
<if test="startTime!=null">
and release_time &gt;= #{startTime}
</if>
<if test="endTime!=null">
and release_time &lt;= #{endTime}
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,20 @@
package com.bwie;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @Author: zhx
* @Package: com.bwie
* @Datetime: 2023/12/18 16:12
* @Filename: AuthApplication
*/
@SpringBootApplication
public class UserApplication {
public static void main(String[] args) {
SpringApplication.run(UserApplication.class);
}
}

View File

@ -0,0 +1,43 @@
package com.bwie.controller;
import com.alibaba.fastjson.JSONObject;
import com.bwie.common.domain.Admin;
import com.bwie.common.result.Result;
import com.bwie.service.UserService;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* @Author: zhx
* @Package: com.bwie.controller
* @Datetime: 2023/12/18 16:20
* @Filename: UserController
*/
@RestController
@Log4j2
public class UserController {
@Autowired
private UserService userService;
@Autowired
private HttpServletRequest request;
@GetMapping("/findPhone")
public Result<Admin> findPhone(@RequestParam String phone){
log.info("功能名称:查询用户是否存在,请求URI:{},请求方式:{},请求参数:{}",
request.getRequestURI(),request.getMethod(),phone);
Admin admin = userService.findPhone(phone);
Result<Admin> result = Result.success(admin);
log.info("功能名称:查询用户是否存在,请求URI:{},请求方式:{},响应结果:{}",
request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(result));
return result;
}
}

View File

@ -0,0 +1,17 @@
package com.bwie.mapper;
import com.bwie.common.domain.Admin;
import org.apache.ibatis.annotations.Mapper;
/**
* @Author: zhx
* @Package: com.bwie.mapper
* @Datetime: 2023/12/18 16:21
* @Filename: UserMapper
*/
@Mapper
public interface UserMapper {
Admin findPhone(String phone);
}

View File

@ -0,0 +1,14 @@
package com.bwie.service;
import com.bwie.common.domain.Admin;
/**
* @Author: zhx
* @Package: com.bwie.service
* @Datetime: 2023/12/18 16:21
* @Filename: UserService
*/
public interface UserService {
Admin findPhone(String phone);
}

View File

@ -0,0 +1,26 @@
package com.bwie.service.impl;
import com.bwie.common.domain.Admin;
import com.bwie.mapper.UserMapper;
import com.bwie.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Author: zhx
* @Package: com.bwie.service.impl
* @Datetime: 2023/12/18 16:21
* @Filename: UserServiceImpl
*/
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Override
public Admin findPhone(String phone) {
return userMapper.findPhone(phone);
}
}

View File

@ -0,0 +1,10 @@
<?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="findPhone" resultType="com.bwie.common.domain.Admin">
select * from admin where phone_num = #{phone}
</select>
</mapper>

View File

@ -13,6 +13,8 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>bwie-user</module> <module>bwie-user</module>
<module>bwie-notice</module>
<module>bwie-health</module>
</modules> </modules>
<properties> <properties>