From de0e52d1a54e1d1864557b203ff8607188a75e52 Mon Sep 17 00:00:00 2001 From: Trae AI Date: Fri, 9 Jan 2026 14:00:24 +0800 Subject: [PATCH] Initial commit --- .gitignore | 34 + init_deploy.sh | 319 +++++ web/.idea/.gitignore | 8 + web/.idea/compiler.xml | 27 + web/.idea/dataSources.xml | 31 + web/.idea/encodings.xml | 6 + web/.idea/jarRepositories.xml | 20 + web/.idea/misc.xml | 19 + web/.idea/uiDesigner.xml | 124 ++ web/.pom.xml.swp | Bin 0 -> 20480 bytes web/pom.xml | 164 +++ .../com/example/web/ServletInitializer.java | 13 + .../java/com/example/web/WebApplication.java | 19 + .../example/web/annotation/DataSource.java | 14 + .../example/web/aspect/DataSourceAspect.java | 50 + .../example/web/config/DataSourceConfig.java | 42 + .../web/config/DataSourceContextHolder.java | 33 + .../example/web/config/DynamicDataSource.java | 10 + .../example/web/config/SecurityConfig.java | 28 + .../web/controller/LoginController.java | 22 + .../web/controller/UserController.java | 94 ++ .../java/com/example/web/entity/Contacts.java | 147 +++ .../com/example/web/entity/Enterprise.java | 88 ++ .../java/com/example/web/entity/Login.java | 51 + .../java/com/example/web/entity/Managers.java | 124 ++ .../com/example/web/entity/Personnel.java | 28 + .../java/com/example/web/entity/Users.java | 233 ++++ .../example/web/entity/UsersManagements.java | 126 ++ .../com/example/web/mapper/LoginMapper.java | 9 + .../example/web/mapper/PersonnelMapper.java | 9 + .../web/mapper/UsersManagementsMapper.java | 14 + .../com/example/web/mapper/UsersMapper.java | 60 + .../com/example/web/service/LoginService.java | 13 + .../com/example/web/service/UserService.java | 17 + .../web/service/impl/LoginServiceImpl.java | 90 ++ .../web/service/impl/UserServiceImpl.java | 256 ++++ web/src/main/resources/application.yaml | 48 + web/src/main/resources/mapper/LoginMapper.xml | 7 + .../main/resources/mapper/PersonnelMapper.xml | 7 + .../mapper/UsersManagementsMapper.xml | 10 + web/src/main/resources/mapper/UsersMapper.xml | 193 +++ web/src/main/resources/static/index.html | 1075 +++++++++++++++++ web/src/main/resources/static/login.html | 147 +++ .../java/com/example/WebApplicationTests.java | 13 + 44 files changed, 3842 insertions(+) create mode 100644 .gitignore create mode 100644 init_deploy.sh create mode 100644 web/.idea/.gitignore create mode 100644 web/.idea/compiler.xml create mode 100644 web/.idea/dataSources.xml create mode 100644 web/.idea/encodings.xml create mode 100644 web/.idea/jarRepositories.xml create mode 100644 web/.idea/misc.xml create mode 100644 web/.idea/uiDesigner.xml create mode 100644 web/.pom.xml.swp create mode 100644 web/pom.xml create mode 100644 web/src/main/java/com/example/web/ServletInitializer.java create mode 100644 web/src/main/java/com/example/web/WebApplication.java create mode 100644 web/src/main/java/com/example/web/annotation/DataSource.java create mode 100644 web/src/main/java/com/example/web/aspect/DataSourceAspect.java create mode 100644 web/src/main/java/com/example/web/config/DataSourceConfig.java create mode 100644 web/src/main/java/com/example/web/config/DataSourceContextHolder.java create mode 100644 web/src/main/java/com/example/web/config/DynamicDataSource.java create mode 100644 web/src/main/java/com/example/web/config/SecurityConfig.java create mode 100644 web/src/main/java/com/example/web/controller/LoginController.java create mode 100644 web/src/main/java/com/example/web/controller/UserController.java create mode 100644 web/src/main/java/com/example/web/entity/Contacts.java create mode 100644 web/src/main/java/com/example/web/entity/Enterprise.java create mode 100644 web/src/main/java/com/example/web/entity/Login.java create mode 100644 web/src/main/java/com/example/web/entity/Managers.java create mode 100644 web/src/main/java/com/example/web/entity/Personnel.java create mode 100644 web/src/main/java/com/example/web/entity/Users.java create mode 100644 web/src/main/java/com/example/web/entity/UsersManagements.java create mode 100644 web/src/main/java/com/example/web/mapper/LoginMapper.java create mode 100644 web/src/main/java/com/example/web/mapper/PersonnelMapper.java create mode 100644 web/src/main/java/com/example/web/mapper/UsersManagementsMapper.java create mode 100644 web/src/main/java/com/example/web/mapper/UsersMapper.java create mode 100644 web/src/main/java/com/example/web/service/LoginService.java create mode 100644 web/src/main/java/com/example/web/service/UserService.java create mode 100644 web/src/main/java/com/example/web/service/impl/LoginServiceImpl.java create mode 100644 web/src/main/java/com/example/web/service/impl/UserServiceImpl.java create mode 100644 web/src/main/resources/application.yaml create mode 100644 web/src/main/resources/mapper/LoginMapper.xml create mode 100644 web/src/main/resources/mapper/PersonnelMapper.xml create mode 100644 web/src/main/resources/mapper/UsersManagementsMapper.xml create mode 100644 web/src/main/resources/mapper/UsersMapper.xml create mode 100644 web/src/main/resources/static/index.html create mode 100644 web/src/main/resources/static/login.html create mode 100644 web/src/test/java/com/example/WebApplicationTests.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7737e30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +# Maven +/target/ +web/target/ +/.m2/ + +# IDEs and editors +/.idea/ +/*.iml +/.classpath +/.project +/.settings/ +*.suo +*.ntvs* +*.njsproj +*.sln + +# OS generated files +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# Environment variables +.env +.env.local +.env.production.local +.env.development.local + +# Log files +logs +*.log \ No newline at end of file diff --git a/init_deploy.sh b/init_deploy.sh new file mode 100644 index 0000000..f76849c --- /dev/null +++ b/init_deploy.sh @@ -0,0 +1,319 @@ +#!/bin/bash + +# 初始化部署脚本 - 在云端服务器上生成部署文件并拉取代码 + +# 部署目录 +deploy_dir="/opt/project_web" +mkdir -p "$deploy_dir" +cd "$deploy_dir" + +echo "开始在云端服务器初始化部署环境..." + +# 1. 创建Dockerfile +echo "创建Dockerfile..." +cat > Dockerfile << 'EOF' +# 使用官方Tomcat 10.1作为基础镜像,兼容Spring Boot 3.x和Java 17 +FROM tomcat:10.1-jdk17-openjdk + +# 维护者信息 +LABEL maintainer="your-email@example.com" + +# 删除Tomcat默认的ROOT应用 +RUN rm -rf /usr/local/tomcat/webapps/ROOT + +# 将构建好的WAR文件复制到Tomcat的webapps目录下,并命名为KH.war,与配置文件中的上下文路径一致 +COPY web.war /usr/local/tomcat/webapps/KH.war + +# 暴露Tomcat端口,与application.yaml中的端口一致 +EXPOSE 8083 + +# 启动Tomcat服务 +CMD ["catalina.sh", "run"] +EOF + +# 2. 创建docker-compose.yml +echo "创建docker-compose.yml..." +cat > docker-compose.yml << 'EOF' +services: + tomcat-app: + image: web:latest + ports: + - "8083:8080" + environment: + - SPRING_DATASOURCE_PRIMARY_JDBC_URL=jdbc:mysql://1.95.162.61:3306/userlogin?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true + - SPRING_DATASOURCE_PRIMARY_USERNAME=root + - SPRING_DATASOURCE_PRIMARY_PASSWORD=schl@2025 + - SPRING_DATASOURCE_WECHAT_JDBC_URL=jdbc:mysql://1.95.162.61:3306/wechat_app?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true + - SPRING_DATASOURCE_WECHAT_USERNAME=root + - SPRING_DATASOURCE_WECHAT_PASSWORD=schl@2025 + - SERVER_SERVLET_CONTEXT_PATH=/KH + restart: always + container_name: followweb + logging: + driver: "json-file" + options: + max-size: "50m" + max-file: "3" +EOF + +# 3. 创建deploy.sh +echo "创建deploy.sh..." +cat > deploy.sh << 'EOF' +#!/bin/bash + +# 修复后的部署脚本 - 解决Maven构建找不到pom.xml的问题 + +# 配置信息 +GIT_REPO="http://8.137.125.67:4000/SwtTt29/web-follow.git" +BRANCH="KH" +PROJECT_NAME="web" +DOCKER_IMAGE="web" +CONTAINER_NAME="followweb" +PORT="8083" + +# 颜色定义 +GREEN="\033[0;32m" +RED="\033[0;31m" +YELLOW="\033[1;33m" +NC="\033[0m" # No Color + +echo -e "${YELLOW}开始部署应用...${NC}" + +# 1. 检查Git是否安装 +if ! command -v git &> /dev/null; then + echo -e "${RED}错误: Git未安装,请先安装Git${NC}" + exit 1 +fi + +# 2. 检查Docker是否安装 +if ! command -v docker &> /dev/null; then + echo -e "${RED}错误: Docker未安装,请先安装Docker${NC}" + exit 1 +fi + +# 3. 检查Docker Compose是否安装 +if ! command -v docker-compose &> /dev/null; then + echo -e "${RED}错误: Docker Compose未安装,请先安装Docker Compose${NC}" + exit 1 +fi + +# 4. 拉取或更新代码 +echo -e "${GREEN}1. 拉取/更新代码...${NC}" +if [ -d "$PROJECT_NAME" ]; then + cd "$PROJECT_NAME" + git pull origin "$BRANCH" + if [ $? -ne 0 ]; then + echo -e "${RED}错误: Git拉取失败${NC}" + exit 1 + fi +else + git clone "$GIT_REPO" "$PROJECT_NAME" + if [ $? -ne 0 ]; then + echo -e "${RED}错误: Git克隆失败${NC}" + exit 1 + fi + cd "$PROJECT_NAME" +fi + +# 5. 查找pom.xml文件,确定正确的构建目录 +echo -e "${GREEN}2. 查找pom.xml文件...${NC}" +pom_path=$(find . -name "pom.xml" -type f | head -1) + +if [ -z "$pom_path" ]; then + echo -e "${RED}错误: 未找到pom.xml文件,请检查Git仓库结构${NC}" + exit 1 +fi + +# 获取pom.xml所在目录 +maven_dir=$(dirname "$pom_path") +echo -e "${GREEN}3. 在目录 $maven_dir 中构建项目...${NC}" + +# 6. 构建项目 +cd "$maven_dir" +mvn clean package -DskipTests +if [ $? -ne 0 ]; then + echo -e "${RED}错误: Maven构建失败${NC}" + exit 1 +fi + +# 7. 查找生成的WAR文件(使用original版本,避免Spring Boot嵌入式Tomcat与外部Tomcat冲突) +war_path=$(find . -name "*.war.original" -type f | head -1) + +# 如果没有找到original版本,使用普通WAR文件 +if [ -z "$war_path" ]; then + war_path=$(find . -name "*.war" -type f | head -1) +fi + +if [ -z "$war_path" ]; then + echo -e "${RED}错误: 未找到生成的WAR文件,请检查Maven构建结果${NC}" + exit 1 +fi + +# 8. 获取绝对路径的WAR文件路径 +if [[ "$war_path" != /* ]]; then + war_path="$(pwd)/$war_path" +fi + +# 9. 返回项目根目录(当前在maven_dir,需要返回到/opt/project_web目录) +cd /opt/project_web + +# 9. 复制WAR文件到web子目录下,供Dockerfile使用 +cp "$war_path" ./web/web.war + +echo -e "${GREEN}4. 停止并移除旧容器...${NC}" + +# 确保旧容器被完全移除,即使docker-compose down失败 +old_container=$(docker ps -a -q -f name=followweb) +if [ ! -z "$old_container" ]; then + echo -e "${GREEN} 停止旧容器...${NC}" + docker stop "$old_container" > /dev/null 2>&1 + echo -e "${GREEN} 移除旧容器...${NC}" + docker rm "$old_container" > /dev/null 2>&1 +fi + +# 使用docker-compose down确保所有相关资源都被清理 +docker-compose down 2>/dev/null || true + +# 10. 构建新的Docker镜像 +echo -e "${GREEN}5. 构建Docker镜像...${NC}" +docker build -t web:latest ./web +if [ $? -ne 0 ]; then + echo -e "${RED}错误: Docker构建失败${NC}" + exit 1 +fi + +# 11. 启动新容器 +echo -e "${GREEN}6. 启动新容器...${NC}" +docker-compose up -d +if [ $? -ne 0 ]; then + echo -e "${RED}错误: Docker容器启动失败${NC}" + exit 1 +fi + +# 12. 检查容器状态 +echo -e "${GREEN}7. 检查容器状态...${NC}" +sleep 5 # 等待容器完全启动 +docker ps -a | grep followweb +if [ $? -ne 0 ]; then + echo -e "${RED}错误: 容器未找到,请检查启动日志${NC}" + docker-compose logs + exit 1 +fi + +# 13. 查看容器日志 +echo -e "${GREEN}8. 查看容器启动日志...${NC}" +docker logs followweb --tail 100 + +# 14. 检查应用健康状态 +echo -e "${GREEN}9. 检查应用健康状态...${NC}" +sleep 10 # 等待应用完全启动 + +# 尝试访问应用的健康检查端点 +response=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8083/KH) +if [ "$response" -eq 200 ] || [ "$response" -eq 302 ]; then + echo -e "${GREEN}应用健康检查通过,HTTP状态码: $response${NC}" +else + echo -e "${YELLOW}应用健康检查失败,HTTP状态码: $response${NC}" + echo -e "${YELLOW}尝试访问根路径...${NC}" + curl -s http://localhost:8083/KH || echo "无法访问应用根路径" +fi + +# 15. 检查容器内部进程 +echo -e "${GREEN}10. 检查容器内部进程...${NC}" +docker exec -it followweb ps aux | grep java + +# 16. 检查Tomcat日志 +echo -e "${GREEN}11. 检查Tomcat日志...${NC}" +docker exec -it followweb tail -n 100 /usr/local/tomcat/logs/catalina.out + +# 17. 检查Spring Boot应用日志 +echo -e "${GREEN}12. 检查Spring Boot应用日志...${NC}" +docker exec -it followweb find /usr/local/tomcat/webapps/KH -name "*.log" -type f | xargs -l1 echo "找到日志文件: {}" + +# 18. 检查应用部署状态 +echo -e "${GREEN}13. 检查应用部署状态...${NC}" +docker exec -it followweb ls -la /usr/local/tomcat/webapps/ + +echo -e "${GREEN}14. 检查应用目录结构...${NC}" +docker exec -it followweb ls -la /usr/local/tomcat/webapps/KH/ + +# 19. 检查Tomcat端口配置 +echo -e "${GREEN}15. 检查Tomcat端口配置...${NC}" +docker exec -it followweb cat /usr/local/tomcat/conf/server.xml | grep -A 5 -B 5 "Connector" + +# 20. 检查防火墙设置 +echo -e "${GREEN}16. 检查防火墙设置...${NC}" +sudo firewall-cmd --list-ports || echo "无法检查防火墙设置" + +# 12. 清理临时WAR文件 +rm -f ./web/web.war + +# 13. 设置日志自动清理任务 +echo -e "${GREEN}7. 设置日志自动清理任务...${NC}" + +# 创建日志清理脚本 +cat > /opt/project_web/cleanup_logs.sh << 'CLEANUP_EOF' +#!/bin/bash + +# 清理Docker容器日志 +container_name="followweb" + +# 检查容器是否存在 +if docker ps -a --format '{{.Names}}' | grep -q "^$container_name$"; then + # 清理容器日志 + docker logs $container_name > /dev/null 2>&1 + echo "日志清理完成: $(date)" +else + echo "容器 $container_name 不存在,跳过日志清理" +fi + +# 检查日志大小,超过50MB立即清理 +log_size=$(docker inspect --format '{{.LogPath}}' $container_name 2>/dev/null) +if [ -n "$log_size" ] && [ -f "$log_size" ]; then + current_size=$(du -m "$log_size" 2>/dev/null | cut -f1) + if [ "$current_size" -gt 50 ]; then + echo "日志大小超过50MB ($current_size MB),立即清理" + docker logs $container_name > /dev/null 2>&1 + echo "日志清理完成: $(date)" + fi +fi +CLEANUP_EOF + +# 设置脚本执行权限 +chmod +x /opt/project_web/cleanup_logs.sh + +# 设置cron任务,每三天执行一次 +(crontab -l 2>/dev/null | grep -v "cleanup_logs.sh"; echo "0 0 */3 * * /opt/project_web/cleanup_logs.sh >> /opt/project_web/cleanup.log 2>&1") | crontab - + +if [ $? -eq 0 ]; then + echo -e "${GREEN}日志自动清理任务已设置,每三天执行一次${NC}" +else + echo -e "${YELLOW}警告: 无法设置cron任务,请手动添加${NC}" + echo -e "${YELLOW}手动添加命令: (crontab -l 2>/dev/null | grep -v \"cleanup_logs.sh\"; echo \"0 0 */3 * * /opt/project_web/cleanup_logs.sh >> /opt/project_web/cleanup.log 2>&1\") | crontab -${NC}" +fi + +echo -e "${GREEN}部署完成!${NC}" +echo -e "${YELLOW}应用访问地址: http://8.137.125.67:${PORT}/KH${NC}" +echo -e "${YELLOW}容器名称: ${CONTAINER_NAME}${NC}" +echo -e "${YELLOW}查看日志命令: docker logs -f ${CONTAINER_NAME}${NC}" +echo -e "${YELLOW}日志清理脚本: /opt/project_web/cleanup_logs.sh${NC}" +echo -e "${YELLOW}日志清理日志: /opt/project_web/cleanup.log${NC}" +EOF + +# 4. 设置脚本执行权限 +echo "设置脚本执行权限..." +chmod +x deploy.sh + +# 5. 拉取Git代码 +echo "拉取Git代码..." +git clone http://8.137.125.67:4000/SwtTt29/web-follow.git web + +# 6. 将Dockerfile复制到web目录 +cp Dockerfile web/ + +echo "初始化完成!" +echo "部署文件已生成在: $deploy_dir" +echo "Git代码已拉取到: $deploy_dir/web" +echo "可以通过以下命令执行部署:" +echo " cd $deploy_dir" +echo " ./deploy.sh" \ No newline at end of file diff --git a/web/.idea/.gitignore b/web/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/web/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/web/.idea/compiler.xml b/web/.idea/compiler.xml new file mode 100644 index 0000000..b9a6358 --- /dev/null +++ b/web/.idea/compiler.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/.idea/dataSources.xml b/web/.idea/dataSources.xml new file mode 100644 index 0000000..7a7a1f6 --- /dev/null +++ b/web/.idea/dataSources.xml @@ -0,0 +1,31 @@ + + + + + mysql.8 + true + true + com.mysql.cj.jdbc.Driver + jdbc:mysql://1.95.162.61:3306/wechat_app?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true + + + + + + + $ProjectFileDir$ + + + mysql_aurora_aws + true + software.aws.rds.jdbc.mysql.Driver + jdbc:mysql:aws://1.95.162.61:3306/userlogin + + + + + + $ProjectFileDir$ + + + \ No newline at end of file diff --git a/web/.idea/encodings.xml b/web/.idea/encodings.xml new file mode 100644 index 0000000..63e9001 --- /dev/null +++ b/web/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/web/.idea/jarRepositories.xml b/web/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/web/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/web/.idea/misc.xml b/web/.idea/misc.xml new file mode 100644 index 0000000..130452f --- /dev/null +++ b/web/.idea/misc.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/.idea/uiDesigner.xml b/web/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/web/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/.pom.xml.swp b/web/.pom.xml.swp new file mode 100644 index 0000000000000000000000000000000000000000..4ad2752756db3a6dc7942bdba98ec8dc769e43c7 GIT binary patch literal 20480 zcmeI3du$v>9mfYsC@F-dRGDP2iOvACh9 zmtJ4y*uG=<6C*=qzC1Y8J8*NcZRtIJgW`5esT-Q2fOo8qKa z5pBy5ri@zKme>uZ0j7bDG*I_O`Q9}45{C!)??>oYCJ^YQ%qjFKbzVQA;Oa1Va{V)wM z4KNKb4KNKb4KNKb4KNKb4KNKb4KNKb4g420AghG*UrmSs==c99jz5d@m%{63-%H4| z;A`NMpbsppA>>u?bMPJT1)zcuSjspYS3JM?()`EpqguDO_f(ft_jDS429$dgi z$;03-FagFvKj;Q;K-s6jy>wxgR>zG7J(?|QhQIlQYWbw~H6B{5O3xrM4@ z)ooO_oT?BsG3v;MHfcE%0&PnYqY`mFDXlxwI-ci-{XTHR;bXa(CmuX^`T>sT7rVXK z%8I3uE&Fl_v}LHA6e3IKE!)#AQ?8Xfr>;q2d>Yr~aI_mZ#WF|rYTc1(8$42M6wP%l z=W>aA{=mKSKR!PDt^M=&-#z>FWB$O!{a(Th8=B*y!=-|d7rG=dI*qHQi>z7-Z^5u- zTaPUkSwu!d;p=)wBBP}h*eMd4xFI}$OS!*eN%KNMC}a^;b?Umxr%cWa0xC$Sl52WJ zuE-sUx1BzdJNM+#x%<97ck-c*g)0hOLU)E?G^Q&sRCk5aQI8Y05PF`@9nQe?R@#He z@oa^|;)Vm~msx68ff1HG&4sTE{$9pzn|*9h@sj!1xGzggzo6If77bn1)RjqL8Hx-A zTsk?j2ogKXC4Fb)Uh+b|S12YXA?Lq@X3pFfzK48sC<;@v2Yxhr{QL8V_s`$+rMV-I z`j$amQgkG}am_L+)IZ#&CMX!O4l!0#EcBC8-6iiZgEvQut^&V zMNlnIGaDKDZfJrn*K4jaHYq!wTW(dbLuG`hAO+h`Q#M z2nqU&>0)bGvC>QQ3O%G?@(7WR<4N6eo%p3`g>ktdFBb2S#HI^=IVt(1;EJlbilh5$ zvyv}=@P9Br6kg6)Wo!#zqqD_%yg3bsL5u#S&$-A}J}IWLT zh5naA&bjGs%8hxR-6x8M+|W!x#!!uE0-i6HhXzEym0VD=Z_3r<(vy>u!er4eSLo`> zi?gvD0CHe0SU~LmB-jUbfsNo=FoT%?DR2-tAP@eAIR7zl2&iBi;K6m^H;D5O0~?e< z9$XEcM{NHUV1XeZfa}02@H%Au2cRov{U;#8N?r|eWqJOU=ftN6;}?~YW{)eAFTs>KehJdaJ` zC59rY{=l-MCwFe*VdNHsaiM2xiH4)mms(9cybx+n3LPb(jhG5>c zlnL!pZk*B{(j(FR4twd1O&eNGlSkXTnImR5Rf|{K_bu{1Z?PS|b@-+#U=NX-d*F*RKYV=d(22P( z-{tS((D?rmta+;Vu1w>9JzW2sM~uH8d z=mk9>2VO($|5M8C~bKnfv2YSFYU;*FyFM{8JXTU)) z0!m;5pt%6AV|<Z_bISmbP)1JuM*1-1(0^jO8G-=6Lwuvsey7 zM=qS@AovaABn3AuOJT}YgVY7y--Qrxo+}X>-~Bn> + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.10 + + + com.example + web + 0.0.1-SNAPSHOT + war + web + web + + + 17 + 1.18.30 + + + + + org.springframework.boot + spring-boot-starter-web + + + me.paulschwarz + spring-dotenv + 4.0.0 + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + + com.mysql + mysql-connector-j + runtime + + + + org.projectlombok + lombok + 1.18.30 + true + + + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 3.0.4 + + + + + com.alibaba + druid-spring-boot-starter + 1.2.20 + + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.1.0 + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + + org.springframework.boot + spring-boot-starter-aop + + + + + org.springframework.boot + spring-boot-starter-security + + + + + me.paulschwarz + spring-dotenv + 4.0.0 + + + + org.hibernate.validator + hibernate-validator + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-websocket + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + -parameters + + + + org.projectlombok + lombok + ${lombok.version} + + + + + + org.springframework.boot + spring-boot-maven-plugin + 3.4.10 + + + + org.projectlombok + lombok + + + + + + + + \ No newline at end of file diff --git a/web/src/main/java/com/example/web/ServletInitializer.java b/web/src/main/java/com/example/web/ServletInitializer.java new file mode 100644 index 0000000..d1354ab --- /dev/null +++ b/web/src/main/java/com/example/web/ServletInitializer.java @@ -0,0 +1,13 @@ +package com.example.web; + +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; + +public class ServletInitializer extends SpringBootServletInitializer { + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application.sources(WebApplication.class); + } + +} diff --git a/web/src/main/java/com/example/web/WebApplication.java b/web/src/main/java/com/example/web/WebApplication.java new file mode 100644 index 0000000..a6642fd --- /dev/null +++ b/web/src/main/java/com/example/web/WebApplication.java @@ -0,0 +1,19 @@ +package com.example.web; + +import me.paulschwarz.springdotenv.DotenvPropertySource; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.PropertySource; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication +@MapperScan("com.example.web.mapper") +@EnableScheduling//定时任务 +/*@PropertySource(value = "classpath:.env", factory = DotenvPropertySource.class)*/ +public class WebApplication { + + public static void main(String[] args) { + SpringApplication.run(WebApplication.class, args); + } +} \ No newline at end of file diff --git a/web/src/main/java/com/example/web/annotation/DataSource.java b/web/src/main/java/com/example/web/annotation/DataSource.java new file mode 100644 index 0000000..c34eaa9 --- /dev/null +++ b/web/src/main/java/com/example/web/annotation/DataSource.java @@ -0,0 +1,14 @@ +// DataSource.java +package com.example.web.annotation; + +import java.lang.annotation.*; + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface DataSource { + // 数据源名称,对应配置中的"primary"和"wechat" + String value() default "primary"; + + +} \ No newline at end of file diff --git a/web/src/main/java/com/example/web/aspect/DataSourceAspect.java b/web/src/main/java/com/example/web/aspect/DataSourceAspect.java new file mode 100644 index 0000000..ac4faff --- /dev/null +++ b/web/src/main/java/com/example/web/aspect/DataSourceAspect.java @@ -0,0 +1,50 @@ +package com.example.web.aspect; + +import com.example.web.annotation.DataSource; +import com.example.web.config.DynamicDataSource; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; + +@Aspect +@Component +@Order(1) // 设置Order为1,确保在事务切面之前执行 +public class DataSourceAspect { + + // 拦截所有标注了 @DataSource 注解的类或方法 + @Pointcut("@annotation(com.example.web.annotation.DataSource) || @within(com.example.web.annotation.DataSource)") + public void dataSourcePointCut() {} + + @Around("dataSourcePointCut()") + public Object around(ProceedingJoinPoint joinPoint) throws Throwable { + // 获取目标方法和类上的 @DataSource 注解 + MethodSignature signature = (MethodSignature) joinPoint.getSignature(); + Method method = signature.getMethod(); + DataSource methodAnnotation = method.getAnnotation(DataSource.class); + DataSource classAnnotation = AnnotationUtils.findAnnotation(joinPoint.getTarget().getClass(), DataSource.class); + + // 方法注解优先于类注解 + String dataSourceKey = methodAnnotation != null ? methodAnnotation.value() : + (classAnnotation != null ? classAnnotation.value() : "primary"); + + try { + // 切换数据源 + com.example.web.config.DataSourceContextHolder.setDataSource(dataSourceKey); + // 执行目标方法 + System.out.println("切换到数据源: " + dataSourceKey); + return joinPoint.proceed(); + } finally { + // 清除数据源,避免线程池复用导致的问题 + com.example.web.config.DataSourceContextHolder.clearDataSource(); + } + + } + +} \ No newline at end of file diff --git a/web/src/main/java/com/example/web/config/DataSourceConfig.java b/web/src/main/java/com/example/web/config/DataSourceConfig.java new file mode 100644 index 0000000..d2f95d8 --- /dev/null +++ b/web/src/main/java/com/example/web/config/DataSourceConfig.java @@ -0,0 +1,42 @@ +package com.example.web.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; + +import javax.sql.DataSource; +import java.util.HashMap; +import java.util.Map; + +@Configuration +public class DataSourceConfig { + + // 主数据源(userlogin) + @Bean(name = "primaryDataSource") + @ConfigurationProperties(prefix = "spring.datasource.primary") + public DataSource primaryDataSource() { + return DataSourceBuilder.create().build(); + } + + // 第二个数据源(wechat_app) + @Bean(name = "wechatDataSource") + @ConfigurationProperties(prefix = "spring.datasource.wechat") + public DataSource wechatDataSource() { + return DataSourceBuilder.create().build(); + } + + // 动态数据源配置 + @Primary + @Bean(name = "dynamicDataSource") + public DataSource dynamicDataSource() { + DynamicDataSource dynamicDataSource = new DynamicDataSource(); + dynamicDataSource.setDefaultTargetDataSource(primaryDataSource()); + Map dataSources = new HashMap<>(); + dataSources.put("primary", primaryDataSource()); + dataSources.put("wechat", wechatDataSource()); + dynamicDataSource.setTargetDataSources(dataSources); + return dynamicDataSource; + } +} \ No newline at end of file diff --git a/web/src/main/java/com/example/web/config/DataSourceContextHolder.java b/web/src/main/java/com/example/web/config/DataSourceContextHolder.java new file mode 100644 index 0000000..c96bc3b --- /dev/null +++ b/web/src/main/java/com/example/web/config/DataSourceContextHolder.java @@ -0,0 +1,33 @@ +package com.example.web.config; + +import org.springframework.stereotype.Component; + +/** + * 数据源上下文持有者 + */ +@Component +public class DataSourceContextHolder { + + private static final ThreadLocal CONTEXT_HOLDER = new ThreadLocal<>(); + + /** + * 设置数据源 + */ + public static void setDataSource(String dataSource) { + CONTEXT_HOLDER.set(dataSource); + } + + /** + * 获取数据源 + */ + public static String getDataSource() { + return CONTEXT_HOLDER.get(); + } + + /** + * 清除数据源 + */ + public static void clearDataSource() { + CONTEXT_HOLDER.remove(); + } +} \ No newline at end of file diff --git a/web/src/main/java/com/example/web/config/DynamicDataSource.java b/web/src/main/java/com/example/web/config/DynamicDataSource.java new file mode 100644 index 0000000..f31ce39 --- /dev/null +++ b/web/src/main/java/com/example/web/config/DynamicDataSource.java @@ -0,0 +1,10 @@ +package com.example.web.config; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +public class DynamicDataSource extends AbstractRoutingDataSource { + @Override + protected Object determineCurrentLookupKey() { + return DataSourceContextHolder.getDataSource(); + } +} diff --git a/web/src/main/java/com/example/web/config/SecurityConfig.java b/web/src/main/java/com/example/web/config/SecurityConfig.java new file mode 100644 index 0000000..652b4bc --- /dev/null +++ b/web/src/main/java/com/example/web/config/SecurityConfig.java @@ -0,0 +1,28 @@ +package com.example.web.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.SecurityFilterChain; + +@Configuration +@EnableWebSecurity +public class SecurityConfig { + + @Bean + public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { + http + .authorizeRequests() + .requestMatchers("/login.html", "/index.html", "/api/login", "/api/users/**").permitAll() + .requestMatchers("/static/**").permitAll() + .anyRequest().authenticated() + .and() + .formLogin() + .disable() + .csrf() + .disable(); + + return http.build(); + } +} diff --git a/web/src/main/java/com/example/web/controller/LoginController.java b/web/src/main/java/com/example/web/controller/LoginController.java new file mode 100644 index 0000000..059cdf2 --- /dev/null +++ b/web/src/main/java/com/example/web/controller/LoginController.java @@ -0,0 +1,22 @@ +package com.example.web.controller; + +import com.example.web.entity.Login; +import com.example.web.service.LoginService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +@RestController +@RequestMapping("/api") +@CrossOrigin(origins = "*") +public class LoginController { + + @Autowired + private LoginService loginService; + + @PostMapping("/login") + public Map login(@RequestBody Login login) { + return loginService.login(login); + } +} diff --git a/web/src/main/java/com/example/web/controller/UserController.java b/web/src/main/java/com/example/web/controller/UserController.java new file mode 100644 index 0000000..14fe072 --- /dev/null +++ b/web/src/main/java/com/example/web/controller/UserController.java @@ -0,0 +1,94 @@ +package com.example.web.controller; + +import com.example.web.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + +@RestController +@RequestMapping("/api") +@CrossOrigin(origins = "*") +public class UserController { + + @Autowired + private UserService userService; + + @GetMapping("/users") + public Map getUserList( + @RequestParam(defaultValue = "1") int page, + @RequestParam(defaultValue = "10") int size, + @RequestParam(required = false) String type, + @RequestParam(required = false) String followup, + @RequestParam String userRole, + @RequestParam(required = false) String userName, + @RequestParam(required = false) String managercompany, + @RequestParam(required = false) String managerdepartment, + @RequestParam(required = false) String organization, + @RequestParam(required = false) String role) { + Map params = new java.util.HashMap<>(); + params.put("page", page); + params.put("size", size); + params.put("type", type); + params.put("followup", followup); + params.put("userRole", userRole); + params.put("userName", userName); + params.put("managercompany", managercompany); + params.put("managerdepartment", managerdepartment); + params.put("organization", organization); + params.put("role", role); + return userService.getUserList(params); + } + + @GetMapping("/users/personal") + public Map getPersonalUsers( + @RequestParam(defaultValue = "1") int page, + @RequestParam(defaultValue = "10") int size, + @RequestParam String userName) { + Map result = new java.util.HashMap<>(); + result.put("users", userService.getPersonalUsers(page, size, userName)); + return result; + } + + @GetMapping("/users/public") + public Map getPublicUsers( + @RequestParam(defaultValue = "1") int page, + @RequestParam(defaultValue = "10") int size, + @RequestParam String userRole, + @RequestParam(required = false) String userName, + @RequestParam(required = false) String managercompany, + @RequestParam(required = false) String managerdepartment, + @RequestParam(required = false) String organization, + @RequestParam(required = false) String role) { + Map params = new java.util.HashMap<>(); + params.put("page", page); + params.put("size", size); + params.put("userRole", userRole); + params.put("userName", userName); + params.put("managercompany", managercompany); + params.put("managerdepartment", managerdepartment); + params.put("organization", organization); + params.put("role", role); + return userService.getPublicUserList(params); + } + + @PostMapping("/users/followup") + public Map followup(@RequestBody Map params) { + return userService.followup(params); + } + + @PostMapping("/users/claim") + public Map claim(@RequestBody Map params) { + return userService.claim(params); + } + + @PostMapping("/users/return") + public Map returnCustomer(@RequestBody Map params) { + return userService.returnCustomer(params); + } + + @PostMapping("/users/jianDaoYun") + public Map jianDaoYun(@RequestBody Map params) { + return userService.jianDaoYun(params); + } +} diff --git a/web/src/main/java/com/example/web/entity/Contacts.java b/web/src/main/java/com/example/web/entity/Contacts.java new file mode 100644 index 0000000..9124afd --- /dev/null +++ b/web/src/main/java/com/example/web/entity/Contacts.java @@ -0,0 +1,147 @@ +package com.example.web.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @Description: 联系人实体类 + */ +@Data +public class Contacts { + private String contact_id;//联系人id + private String id;//用户id + private String nickName;//联系人姓名 + private String phoneNumber;//联系人电话 + private String wechat;//联系人微信 + private String account;//联系人账号 + private String accountNumber;//联系人账号 + private String bank;//联系人银行 + private String address;//联系人地址 + private String followup;//跟进信息 + private String notice;//通知状态(new/old/banold) + private LocalDateTime created_at;//创建时间 + private LocalDateTime updated_at;//更新时间 + + public LocalDateTime getCreated_at() { + return created_at; + } + + public void setCreated_at(LocalDateTime created_at) { + this.created_at = created_at; + } + + public LocalDateTime getUpdated_at() { + return updated_at; + } + + public void setUpdated_at(LocalDateTime updated_at) { + this.updated_at = updated_at; + } + + public Contacts() { + + } + public Contacts(String contact_id, String id, String nickName, String phoneNumber, String wechat, String account, String accountNumber, String bank, String address, String followup) { + this.contact_id = contact_id; + this.id = id; + this.nickName = nickName; + this.phoneNumber = phoneNumber; + this.wechat = wechat; + this.account = account; + this.accountNumber = accountNumber; + this.bank = bank; + this.address = address; + this.followup = followup; + } + + public String getContact_id() { + return contact_id; + } + + public void setContact_id(String contact_id) { + this.contact_id = contact_id; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getWechat() { + return wechat; + } + + public void setWechat(String wechat) { + this.wechat = wechat; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public String getBank() { + return bank; + } + + public void setBank(String bank) { + this.bank = bank; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getFollowup() { + return followup; + } + + public void setFollowup(String followup) { + this.followup = followup; + } + + public String getNotice() { + return notice; + } + + public void setNotice(String notice) { + this.notice = notice; + } +} diff --git a/web/src/main/java/com/example/web/entity/Enterprise.java b/web/src/main/java/com/example/web/entity/Enterprise.java new file mode 100644 index 0000000..119dd63 --- /dev/null +++ b/web/src/main/java/com/example/web/entity/Enterprise.java @@ -0,0 +1,88 @@ +package com.example.web.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 企业实体类 + */ +@Data +public class Enterprise { + private String id;//企业id + private String company;//企业名称 + private String region;//地区 + private String level;//企业等级 + private String type;//企业类型 + private String demand;//企业需求 + private String spec;//规格 + + // 无参构造器 + public Enterprise() { + } + public Enterprise(String id, String company, String region, String level, String type, String demand, String spec) { + this.id = id; + this.company = company; + this.region = region; + this.level = level; + this.type = type; + this.demand = demand; + this.spec = spec; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDemand() { + return demand; + } + + public void setDemand(String demand) { + this.demand = demand; + } + + public String getSpec() { + return spec; + } + + public void setSpec(String spec) { + this.spec = spec; + } +} diff --git a/web/src/main/java/com/example/web/entity/Login.java b/web/src/main/java/com/example/web/entity/Login.java new file mode 100644 index 0000000..36a0dcf --- /dev/null +++ b/web/src/main/java/com/example/web/entity/Login.java @@ -0,0 +1,51 @@ +package com.example.web.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description: 登录实体类 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Login { + private String projectName;//职位名称 + private String userName;//用户名 + private String password;//密码 + private Integer id;//用户id + + + public String getProjectName() { + return projectName; + } + + public void setProjectName(String projectName) { + this.projectName = projectName; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } +} diff --git a/web/src/main/java/com/example/web/entity/Managers.java b/web/src/main/java/com/example/web/entity/Managers.java new file mode 100644 index 0000000..c1030a3 --- /dev/null +++ b/web/src/main/java/com/example/web/entity/Managers.java @@ -0,0 +1,124 @@ +package com.example.web.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @Description: 管理员实体类 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class Managers { + private Integer manager_id;//管理员id + private String id;//企业id + private String managerId; // 负责人id + private String managercompany; // 负责公司 + private String managerdepartment; // 负责部门 + private String organization; // 负责小组 + private String role; // 角色 + private String root; // 权限 + private LocalDateTime created_at; // 创建时间 + private LocalDateTime updated_at; // 更新时间 + private String userName;//负责人姓名 + private String assistant;//协助人 + + public Integer getManager_id() { + return manager_id; + } + + public void setManager_id(Integer manager_id) { + this.manager_id = manager_id; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getManagerId() { + return managerId; + } + + public void setManagerId(String managerId) { + this.managerId = managerId; + } + + public String getManagercompany() { + return managercompany; + } + + public void setManagercompany(String managercompany) { + this.managercompany = managercompany; + } + + public String getManagerdepartment() { + return managerdepartment; + } + + public void setManagerdepartment(String managerdepartment) { + this.managerdepartment = managerdepartment; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getRoot() { + return root; + } + + public void setRoot(String root) { + this.root = root; + } + + public LocalDateTime getCreated_at() { + return created_at; + } + + public void setCreated_at(LocalDateTime created_at) { + this.created_at = created_at; + } + + public LocalDateTime getUpdated_at() { + return updated_at; + } + + public void setUpdated_at(LocalDateTime updated_at) { + this.updated_at = updated_at; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getAssistant() { + return assistant; + } + + public void setAssistant(String assistant) { + this.assistant = assistant; + } +} diff --git a/web/src/main/java/com/example/web/entity/Personnel.java b/web/src/main/java/com/example/web/entity/Personnel.java new file mode 100644 index 0000000..c2add57 --- /dev/null +++ b/web/src/main/java/com/example/web/entity/Personnel.java @@ -0,0 +1,28 @@ +package com.example.web.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.sql.Timestamp; + +/** + * @Description: 员工信息实体类 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class Personnel { + private Integer id; // 员工ID + private String managerId; // 负责人ID + private String managercompany; // 负责公司 + private String managerdepartment; // 负责部门 + private String organization; // 负责小组 + private String projectName; // 职位名称 + private String alias; // 负责人别名 + private String name; // 负责人名 + private String phoneNumber; // 负责人电话 + private Timestamp createdAt; // 创建时间 + private Timestamp updatedAt; // 更新时间 + private String avatarUrl; // 头像 +} diff --git a/web/src/main/java/com/example/web/entity/Users.java b/web/src/main/java/com/example/web/entity/Users.java new file mode 100644 index 0000000..b736bf6 --- /dev/null +++ b/web/src/main/java/com/example/web/entity/Users.java @@ -0,0 +1,233 @@ +package com.example.web.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * 用户实体类 + */ +@Data +@NoArgsConstructor +public class Users { + private Integer id;//用户id + private String openid;//用户唯一标识 + private String userId;//用户id + private String nickName;//用户昵称 + private String avatarUrl;//用户头像 + private String phoneNumber;//用户手机号 + private String type;//用户类型 + private Integer gender;//用户性别 + private String country;//国家 + private String province;//省份 + private String city;//城市 + private String language;//语言 + private String session_key;//会话密钥 + private LocalDateTime created_at;//创建时间 + private LocalDateTime updated_at;//更新时间 + private String company;//客户公司 + private String region;//客户地区 + private String level;//客户等级 + private String demand;//客户需求 + private String spec;//规格 + private String followup;//跟进信息 + private String notice;//通知状态(new/old/banold) + private String userlog;//用户操作日志 + private Integer sync_statuss;//同步状态 + + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getOpenid() { + return openid; + } + + public void setOpenid(String openid) { + this.openid = openid; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getAvatarUrl() { + return avatarUrl; + } + + public void setAvatarUrl(String avatarUrl) { + this.avatarUrl = avatarUrl; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public Integer getGender() { + return gender; + } + + public void setGender(Integer gender) { + this.gender = gender; + } + + public String getCountry() { + return country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getSession_key() { + return session_key; + } + + public void setSession_key(String session_key) { + this.session_key = session_key; + } + + public LocalDateTime getCreated_at() { + return created_at; + } + + public void setCreated_at(LocalDateTime created_at) { + this.created_at = created_at; + } + + public LocalDateTime getUpdated_at() { + return updated_at; + } + + public void setUpdated_at(LocalDateTime updated_at) { + this.updated_at = updated_at; + } + + public String getCompany() { + return company; + } + + public void setCompany(String company) { + this.company = company; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getDemand() { + return demand; + } + + public void setDemand(String demand) { + this.demand = demand; + } + + public String getSpec() { + return spec; + } + + public void setSpec(String spec) { + this.spec = spec; + } + + public String getFollowup() { + return followup; + } + + public void setFollowup(String followup) { + this.followup = followup; + } + + public String getNotice() { + return notice; + } + + public void setNotice(String notice) { + this.notice = notice; + } + + public String getUserlog() { + return userlog; + } + + public void setUserlog(String userlog) { + this.userlog = userlog; + } + + public Integer getSync_statuss() { + return sync_statuss; + } + + public void setSync_statuss(Integer sync_statuss) { + this.sync_statuss = sync_statuss; + } +} diff --git a/web/src/main/java/com/example/web/entity/UsersManagements.java b/web/src/main/java/com/example/web/entity/UsersManagements.java new file mode 100644 index 0000000..bce7d72 --- /dev/null +++ b/web/src/main/java/com/example/web/entity/UsersManagements.java @@ -0,0 +1,126 @@ +package com.example.web.entity; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * 负责人信息实体类 + * 对应wechat_app数据源中的用户管理表 + * 存储微信小程序用户的负责人信息 + */ +@Data +@NoArgsConstructor +public class UsersManagements { + + private Integer id; // 自增主键id + private String userId; // 用户id + private String managerId; // 负责人id + private String managercompany; // 负责公司 + private String managerdepartment; // 负责部门 + private String organization; // 负责小组 + private String role; // 角色 + private String root; // 权限 + private LocalDateTime created_at; // 创建时间 + private LocalDateTime updated_at; // 更新时间 + private String userName;//负责人姓名 + private String assistant;//协助人 + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getManagerId() { + return managerId; + } + + public void setManagerId(String managerId) { + this.managerId = managerId; + } + + public String getManagercompany() { + return managercompany; + } + + public void setManagercompany(String managercompany) { + this.managercompany = managercompany; + } + + public String getManagerdepartment() { + return managerdepartment; + } + + public void setManagerdepartment(String managerdepartment) { + this.managerdepartment = managerdepartment; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getRoot() { + return root; + } + + public void setRoot(String root) { + this.root = root; + } + + public LocalDateTime getCreated_at() { + return created_at; + } + + public void setCreated_at(LocalDateTime created_at) { + this.created_at = created_at; + } + + public LocalDateTime getUpdated_at() { + return updated_at; + } + + public void setUpdated_at(LocalDateTime updated_at) { + this.updated_at = updated_at; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getAssistant() { + return assistant; + } + + public void setAssistant(String assistant) { + this.assistant = assistant; + } +} diff --git a/web/src/main/java/com/example/web/mapper/LoginMapper.java b/web/src/main/java/com/example/web/mapper/LoginMapper.java new file mode 100644 index 0000000..277616d --- /dev/null +++ b/web/src/main/java/com/example/web/mapper/LoginMapper.java @@ -0,0 +1,9 @@ +package com.example.web.mapper; + +import com.example.web.entity.Login; +import com.example.web.annotation.DataSource; + +public interface LoginMapper { + @DataSource("primary") + Login findByUsernameAndPassword(Login login); +} diff --git a/web/src/main/java/com/example/web/mapper/PersonnelMapper.java b/web/src/main/java/com/example/web/mapper/PersonnelMapper.java new file mode 100644 index 0000000..cfc356e --- /dev/null +++ b/web/src/main/java/com/example/web/mapper/PersonnelMapper.java @@ -0,0 +1,9 @@ +package com.example.web.mapper; + +import com.example.web.entity.Personnel; +import com.example.web.annotation.DataSource; + +public interface PersonnelMapper { + @DataSource("primary") + Personnel findByName(String name); +} diff --git a/web/src/main/java/com/example/web/mapper/UsersManagementsMapper.java b/web/src/main/java/com/example/web/mapper/UsersManagementsMapper.java new file mode 100644 index 0000000..a587a49 --- /dev/null +++ b/web/src/main/java/com/example/web/mapper/UsersManagementsMapper.java @@ -0,0 +1,14 @@ +package com.example.web.mapper; + +import com.example.web.entity.UsersManagements; +import com.example.web.annotation.DataSource; + +import java.util.List; + +public interface UsersManagementsMapper { + @DataSource("wechat") + UsersManagements findByUserName(String userName); + + @DataSource("wechat") + List findByUserNameList(String userName); +} diff --git a/web/src/main/java/com/example/web/mapper/UsersMapper.java b/web/src/main/java/com/example/web/mapper/UsersMapper.java new file mode 100644 index 0000000..d735504 --- /dev/null +++ b/web/src/main/java/com/example/web/mapper/UsersMapper.java @@ -0,0 +1,60 @@ +package com.example.web.mapper; + +import com.example.web.entity.Users; +import com.example.web.annotation.DataSource; + +import java.util.List; +import java.util.Map; + +public interface UsersMapper { + @DataSource("wechat") + List findWithPagination(Map params); + + @DataSource("wechat") + Integer count(Map params); + + @DataSource("wechat") + List findByUserIds(Map params); + + @DataSource("wechat") + Integer countByUserIds(Map params); + + @DataSource("wechat") + List findAllWithPagination(Map params); + + @DataSource("wechat") + Integer countAll(Map params); + + @DataSource("wechat") + List findPublicWithPagination(Map params); + + @DataSource("wechat") + Integer countPublic(Map params); + + @DataSource("wechat") + List findPersonalWithPagination(Map params); + + @DataSource("wechat") + Integer countPersonal(Map params); + + @DataSource("wechat") + List findPublicAllWithPagination(Map params); + + @DataSource("wechat") + Integer countPublicAll(Map params); + + @DataSource("wechat") + int updateFollowup(Map params); + + @DataSource("wechat") + int updateUsersManagements(Map params); + + @DataSource("wechat") + int updateSyncStatus(Map params); + + @DataSource("wechat") + int updateUserTypeAndClearFollowup(Map params); + + @DataSource("wechat") + int clearUsersManagements(Map params); +} diff --git a/web/src/main/java/com/example/web/service/LoginService.java b/web/src/main/java/com/example/web/service/LoginService.java new file mode 100644 index 0000000..88efc82 --- /dev/null +++ b/web/src/main/java/com/example/web/service/LoginService.java @@ -0,0 +1,13 @@ +package com.example.web.service; + +import com.example.web.entity.Login; +import com.example.web.entity.Personnel; +import com.example.web.entity.UsersManagements; + +import java.util.Map; + +public interface LoginService { + Map login(Login login); + Personnel getPersonnelInfo(String name); + UsersManagements getUsersManagementsInfo(String userName); +} diff --git a/web/src/main/java/com/example/web/service/UserService.java b/web/src/main/java/com/example/web/service/UserService.java new file mode 100644 index 0000000..8e07f4b --- /dev/null +++ b/web/src/main/java/com/example/web/service/UserService.java @@ -0,0 +1,17 @@ +package com.example.web.service; + +import com.example.web.entity.Users; + +import java.util.List; +import java.util.Map; + +public interface UserService { + Map getUserList(Map params); + Map getPublicUserList(Map params); + Map followup(Map params); + Map claim(Map params); + Map returnCustomer(Map params); + Map jianDaoYun(Map params); + List getPersonalUsers(int page, int size, String userName); + List getPublicUsers(int page, int size); +} diff --git a/web/src/main/java/com/example/web/service/impl/LoginServiceImpl.java b/web/src/main/java/com/example/web/service/impl/LoginServiceImpl.java new file mode 100644 index 0000000..acf1ff1 --- /dev/null +++ b/web/src/main/java/com/example/web/service/impl/LoginServiceImpl.java @@ -0,0 +1,90 @@ +package com.example.web.service.impl; + +import com.example.web.entity.Login; +import com.example.web.entity.Personnel; +import com.example.web.entity.UsersManagements; +import com.example.web.mapper.LoginMapper; +import com.example.web.mapper.PersonnelMapper; +import com.example.web.mapper.UsersManagementsMapper; +import com.example.web.service.LoginService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class LoginServiceImpl implements LoginService { + + @Autowired + private LoginMapper loginMapper; + + @Autowired + private PersonnelMapper personnelMapper; + + @Autowired + private UsersManagementsMapper usersManagementsMapper; + + @Override + public Map login(Login login) { + Map result = new HashMap<>(); + + // 1. 验证登录信息 + Login loginInfo = loginMapper.findByUsernameAndPassword(login); + if (loginInfo == null) { + result.put("success", false); + result.put("message", "用户名或密码错误"); + return result; + } + + // 2. 查询Personnel信息 + Personnel personnel = personnelMapper.findByName(loginInfo.getUserName()); + if (personnel == null) { + result.put("success", false); + result.put("message", "未找到员工信息"); + return result; + } + + // 3. 查询UsersManagements信息(容错处理) + UsersManagements usersManagements = null; + try { + // 使用findByUserNameList方法获取所有结果 + List usersManagementsList = usersManagementsMapper.findByUserNameList(personnel.getName()); + if (usersManagementsList != null && !usersManagementsList.isEmpty()) { + // 只取第一个结果 + usersManagements = usersManagementsList.get(0); + } + } catch (Exception e) { + // 表不存在或其他错误,不影响登录 + System.out.println("查询UsersManagements时发生错误: " + e.getMessage()); + } + if (usersManagements == null) { + // 创建默认的用户管理信息 + usersManagements = new UsersManagements(); + usersManagements.setUserName(personnel.getName()); + usersManagements.setRole(personnel.getProjectName()); + usersManagements.setManagercompany(personnel.getManagercompany()); + usersManagements.setManagerdepartment(personnel.getManagerdepartment()); + usersManagements.setOrganization(personnel.getOrganization()); + } + + // 4. 构建返回结果 + result.put("success", true); + result.put("loginInfo", loginInfo); + result.put("personnel", personnel); + result.put("usersManagements", usersManagements); + + return result; + } + + @Override + public Personnel getPersonnelInfo(String name) { + return personnelMapper.findByName(name); + } + + @Override + public UsersManagements getUsersManagementsInfo(String userName) { + return usersManagementsMapper.findByUserName(userName); + } +} diff --git a/web/src/main/java/com/example/web/service/impl/UserServiceImpl.java b/web/src/main/java/com/example/web/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..d44aef1 --- /dev/null +++ b/web/src/main/java/com/example/web/service/impl/UserServiceImpl.java @@ -0,0 +1,256 @@ +package com.example.web.service.impl; + +import com.example.web.entity.Users; +import com.example.web.mapper.UsersMapper; +import com.example.web.service.UserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class UserServiceImpl implements UserService { + + @Autowired + private UsersMapper usersMapper; + + @Override + public Map getUserList(Map requestParams) { + Map result = new HashMap<>(); + Map params = new HashMap<>(); + + // 提取参数 + int page = (int) requestParams.getOrDefault("page", 1); + int size = (int) requestParams.getOrDefault("size", 10); + String type = (String) requestParams.getOrDefault("type", ""); + String followup = (String) requestParams.getOrDefault("followup", ""); + String userRole = (String) requestParams.getOrDefault("userRole", ""); + String userName = (String) requestParams.getOrDefault("userName", ""); + String managercompany = (String) requestParams.getOrDefault("managercompany", ""); + String managerdepartment = (String) requestParams.getOrDefault("managerdepartment", ""); + String organization = (String) requestParams.getOrDefault("organization", ""); + String role = (String) requestParams.getOrDefault("role", ""); + + // 计算偏移量 + int offset = (page - 1) * size; + params.put("offset", offset); + params.put("limit", size); + + // 设置认证参数过滤 + params.put("userName", userName); + params.put("managercompany", managercompany); + params.put("managerdepartment", managerdepartment); + params.put("organization", organization); + params.put("role", role); + + // 查询数据 + List usersList; + int total; + + // 管理员可以查看全部数据 + if ("管理员".equals(userRole)) { + // 管理员查看所有客户 + usersList = usersMapper.findAllWithPagination(params); + total = usersMapper.countAll(params); + } else { + // 普通用户查看数据 + usersList = usersMapper.findByUserIds(params); + total = usersMapper.countByUserIds(params); + } + + // 构建返回结果 + result.put("users", usersList); + result.put("total", total); + result.put("page", page); + result.put("size", size); + result.put("pages", (total + size - 1) / size); + + return result; + } + + @Override + public Map getPublicUserList(Map requestParams) { + Map result = new HashMap<>(); + Map params = new HashMap<>(); + + // 提取参数 + int page = (int) requestParams.getOrDefault("page", 1); + int size = (int) requestParams.getOrDefault("size", 10); + String userRole = (String) requestParams.getOrDefault("userRole", ""); + String userName = (String) requestParams.getOrDefault("userName", ""); + String managercompany = (String) requestParams.getOrDefault("managercompany", ""); + String managerdepartment = (String) requestParams.getOrDefault("managerdepartment", ""); + String organization = (String) requestParams.getOrDefault("organization", ""); + String role = (String) requestParams.getOrDefault("role", ""); + + // 计算偏移量 + int offset = (page - 1) * size; + params.put("offset", offset); + params.put("limit", size); + + // 设置认证参数过滤 + params.put("userName", userName); + params.put("managercompany", managercompany); + params.put("managerdepartment", managerdepartment); + params.put("organization", organization); + params.put("role", role); + + // 查询数据 + List usersList; + int total; + + // 管理员可以查看全部公海池数据 + if ("管理员".equals(userRole)) { + usersList = usersMapper.findPublicAllWithPagination(params); + total = usersMapper.countPublicAll(params); + } else { + // 普通用户只能查看自己权限范围内的公海池数据 + usersList = usersMapper.findPublicWithPagination(params); + total = usersMapper.countPublic(params); + } + + // 构建返回结果 + result.put("users", usersList); + result.put("total", total); + result.put("page", page); + result.put("size", size); + result.put("pages", (total + size - 1) / size); + + return result; + } + + @Override + public List getPersonalUsers(int page, int size, String userName) { + Map params = new HashMap<>(); + int offset = (page - 1) * size; + params.put("offset", offset); + params.put("limit", size); + params.put("followup", userName); // 个人数据有负责人信息 + return usersMapper.findWithPagination(params); + } + + @Override + public List getPublicUsers(int page, int size) { + Map params = new HashMap<>(); + int offset = (page - 1) * size; + params.put("offset", offset); + params.put("limit", size); + params.put("followup", ""); // 公海池数据没有负责人信息 + return usersMapper.findWithPagination(params); + } + + @Override + public Map followup(Map params) { + Map result = new HashMap<>(); + + try { + String userId = (String) params.get("userId"); + String followup = (String) params.get("followup"); + + if (userId == null || followup == null) { + result.put("success", false); + result.put("message", "缺少必要参数"); + return result; + } + + // 更新跟进信息 + usersMapper.updateFollowup(params); + + result.put("success", true); + result.put("message", "跟进成功"); + } catch (Exception e) { + result.put("success", false); + result.put("message", "跟进失败: " + e.getMessage()); + } + + return result; + } + + @Override + public Map claim(Map params) { + Map result = new HashMap<>(); + + try { + String userId = (String) params.get("userId"); + String userName = (String) params.get("userName"); + + if (userId == null || userName == null) { + result.put("success", false); + result.put("message", "缺少必要参数"); + return result; + } + + // 1. 更新 usermanagements 表,为客户添加认领人信息 + usersMapper.updateUsersManagements(params); + + // 2. 更新 users 表,设置 sync_status 为 0 + usersMapper.updateSyncStatus(params); + + result.put("success", true); + result.put("message", "认领成功"); + } catch (Exception e) { + result.put("success", false); + result.put("message", "认领失败: " + e.getMessage()); + } + + return result; + } + + @Override + public Map returnCustomer(Map params) { + Map result = new HashMap<>(); + + try { + String userId = (String) params.get("userId"); + String type = (String) params.get("type"); + + if (userId == null || type == null) { + result.put("success", false); + result.put("message", "缺少必要参数"); + return result; + } + + // 1. 更新 users 表,修改 type 字段并清空 followup 字段 + usersMapper.updateUserTypeAndClearFollowup(params); + + // 2. 清除 usermanagements 表中的记录 + usersMapper.clearUsersManagements(params); + + result.put("success", true); + result.put("message", "归还成功"); + } catch (Exception e) { + result.put("success", false); + result.put("message", "归还失败: " + e.getMessage()); + } + + return result; + } + + @Override + public Map jianDaoYun(Map params) { + Map result = new HashMap<>(); + + try { + String userId = (String) params.get("userId"); + + if (userId == null) { + result.put("success", false); + result.put("message", "缺少必要参数"); + return result; + } + + // 更新 users 表,设置 sync_statuss 字段值为 0 + usersMapper.updateSyncStatus(params); + + result.put("success", true); + result.put("message", "操作成功"); + } catch (Exception e) { + result.put("success", false); + result.put("message", "操作失败: " + e.getMessage()); + } + + return result; + } +} diff --git a/web/src/main/resources/application.yaml b/web/src/main/resources/application.yaml new file mode 100644 index 0000000..42681fd --- /dev/null +++ b/web/src/main/resources/application.yaml @@ -0,0 +1,48 @@ +spring: + datasource: + # userlogin数据库 + primary: + jdbc-url: jdbc:mysql://1.95.162.61:3306/userlogin?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true + username: root + password: schl@2025 + driver-class-name: com.mysql.cj.jdbc.Driver + hikari: + max-lifetime: 1200000 + idle-timeout: 600000 + minimum-idle: 5 + maximum-pool-size: 20 + # wechat_app数据库 + wechat: + jdbc-url: jdbc:mysql://1.95.162.61:3306/wechat_app?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true + username: root + password: schl@2025 + driver-class-name: com.mysql.cj.jdbc.Driver + hikari: + max-lifetime: 1200000 + idle-timeout: 600000 + minimum-idle: 5 + maximum-pool-size: 20 + +server: + port: 8083 + servlet: + context-path: /KH + # 在Tomcat中部署时,端口由Tomcat配置决定,这里不需要指定 + # address属性在Tomcat部署中不生效,由容器控制 + +mybatis: + type-aliases-package: com.example.web.entity + mapper-locations: classpath:mapper/*.xml + configuration: + # 确保这些配置存在 + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + call-setters-on-nulls: true + jdbc-type-for-null: null + +logging: + level: + com.example.web.mapper: DEBUG + com.example.web.config: DEBUG + com.example.web.aspect: DEBUG + + \ No newline at end of file diff --git a/web/src/main/resources/mapper/LoginMapper.xml b/web/src/main/resources/mapper/LoginMapper.xml new file mode 100644 index 0000000..1aa903f --- /dev/null +++ b/web/src/main/resources/mapper/LoginMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/web/src/main/resources/mapper/PersonnelMapper.xml b/web/src/main/resources/mapper/PersonnelMapper.xml new file mode 100644 index 0000000..c8e9ae4 --- /dev/null +++ b/web/src/main/resources/mapper/PersonnelMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/web/src/main/resources/mapper/UsersManagementsMapper.xml b/web/src/main/resources/mapper/UsersManagementsMapper.xml new file mode 100644 index 0000000..0998cd4 --- /dev/null +++ b/web/src/main/resources/mapper/UsersManagementsMapper.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/web/src/main/resources/mapper/UsersMapper.xml b/web/src/main/resources/mapper/UsersMapper.xml new file mode 100644 index 0000000..c39495a --- /dev/null +++ b/web/src/main/resources/mapper/UsersMapper.xml @@ -0,0 +1,193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE users + SET followup = #{followup}, + followup_at = NOW() + WHERE userId = #{userId} + + + + INSERT INTO usermanagements (userId, userName, managercompany, managerdepartment, organization, role, managerId) + VALUES (#{userId}, #{userName}, #{managercompany}, #{managerdepartment}, #{organization}, #{role}, #{userId}) + ON DUPLICATE KEY UPDATE + userName = #{userName}, + managercompany = #{managercompany}, + managerdepartment = #{managerdepartment}, + organization = #{organization}, + role = #{role}, + managerId = #{userId} + + + + UPDATE users + SET sync_statuss = 0 + WHERE userId = #{userId} + + + + UPDATE users + SET type = #{type}, + followup = NULL + WHERE userId = #{userId} + + + + UPDATE usermanagements + SET managercompany = NULL, + managerdepartment = NULL, + organization = NULL, + role = NULL, + userName = NULL + WHERE userId = #{userId} + + \ No newline at end of file diff --git a/web/src/main/resources/static/index.html b/web/src/main/resources/static/index.html new file mode 100644 index 0000000..4dee7a4 --- /dev/null +++ b/web/src/main/resources/static/index.html @@ -0,0 +1,1075 @@ + + + + + 客户管理系统 + + + +
+

客户管理系统

+ +
+ +
+
+

用户信息

+
+
+
职位名称
+
+
+
+
用户名
+
+
+
+
负责公司
+
+
+
+
负责部门
+
+
+
+
负责小组
+
+
+
+
角色
+
+
+
+
+ +
+
+
+ + +
+
+ + +
+
+
+ + +
+ + + + + + + + + + + + + + +
昵称手机号类型创建时间跟进内容响应时间操作
+
暂无个人数据
+ +
+ + +
+
+ + +
+ + + + + + + + + + + + + + +
昵称手机号类型创建时间跟进内容响应时间操作
+
暂无公海池数据
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/web/src/main/resources/static/login.html b/web/src/main/resources/static/login.html new file mode 100644 index 0000000..f1255a3 --- /dev/null +++ b/web/src/main/resources/static/login.html @@ -0,0 +1,147 @@ + + + + + + 登录 + + + + + + + + \ No newline at end of file diff --git a/web/src/test/java/com/example/WebApplicationTests.java b/web/src/test/java/com/example/WebApplicationTests.java new file mode 100644 index 0000000..6a70368 --- /dev/null +++ b/web/src/test/java/com/example/WebApplicationTests.java @@ -0,0 +1,13 @@ +package com.example; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class WebApplicationTests { + + @Test + void contextLoads() { + } + +}