commit de4e9e514b3cd6334cb2f3ff39aa3ebaad3dc22a
Author: 李京通 <2405957150@qq.com>
Date: Wed May 28 09:39:26 2025 +0800
一体化系统优化—公务管理初始化代码
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5eac309
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
\ No newline at end of file
diff --git a/config/application.properties b/config/application.properties
new file mode 100644
index 0000000..81a23a9
--- /dev/null
+++ b/config/application.properties
@@ -0,0 +1,4 @@
+auth_key=5b6fc55e66849a26478d3dd3136c65b6
+auth_code=7dd01ab4b79c8b972b04350534bed3cfaa140aae
+smsid=SEND00001
+spid=111411
\ No newline at end of file
diff --git a/gather-app/pom.xml b/gather-app/pom.xml
new file mode 100644
index 0000000..2e721e3
--- /dev/null
+++ b/gather-app/pom.xml
@@ -0,0 +1,60 @@
+
+
+ 4.0.0
+
+ com.ruoyi
+ PublicAffairs
+ 4.0.0
+
+
+ gather-app
+
+
+
+
+ com.ruoyi
+ ruoyi-common
+
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ com.ruoyi
+ ruoyi-framework
+
+
+ io.swagger
+ swagger-annotations
+ 1.6.2
+ compile
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.14
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.80
+
+
+
+ cn.hutool
+ hutool-all
+ 5.8.16
+
+
+ org.jsoup
+ jsoup
+ 1.9.2
+
+
+
diff --git a/gather-app/src/main/java/com/ruoyi/aspect/ImportAspect.java b/gather-app/src/main/java/com/ruoyi/aspect/ImportAspect.java
new file mode 100644
index 0000000..c3023bb
--- /dev/null
+++ b/gather-app/src/main/java/com/ruoyi/aspect/ImportAspect.java
@@ -0,0 +1,96 @@
+package com.ruoyi.aspect;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.ReflectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.ruoyi.cache.DictCache;
+import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.bean.BeanValidators;
+import lombok.RequiredArgsConstructor;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.stereotype.Component;
+
+import javax.validation.Validator;
+import java.lang.reflect.Field;
+import java.util.List;
+
+@Aspect
+@Component
+@RequiredArgsConstructor
+public class ImportAspect {
+ protected final Validator validator;
+
+ @Around("execution(* com.ruoyi.database.service.*.*import*(..))")
+ public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
+ // 获取方法的入参
+ Object[] args = joinPoint.getArgs();
+ List> importList = (List>) args[0];
+
+
+ if (CollUtil.isEmpty(importList)) {
+ throw new ServiceException("导入数据为空");
+ }
+
+ // 获取list表中类的类型
+ Class> clazz = importList.get(0).getClass();
+
+ // 错误标记,判断是否有错误信息
+ boolean errorFlag = false;
+ // 遍历list表中的数据,回填字典值
+ for (Object obj : importList) {
+
+ // 记录属性中存在区域编码相关的属性的个数,判断如何回填区域编码
+ int codeCount = 0;
+ // 获取类中的所有属性
+ for (Field field : clazz.getDeclaredFields()) {
+ // 判断属性中是否有Cn结尾的属性
+ String fieldName = field.getName();
+ if (StrUtil.endWithIgnoreCase(fieldName, "Cn") && !field.getName().equals("structuredCameraTypeCn")) {
+ field.setAccessible(true);
+ // 获取非Cn属性名
+ String fieldName1 = StrUtil.subBefore(fieldName, "Cn", true);
+ String dictType = StrUtil.toUnderlineCase(fieldName1);
+ // 获取字典标签
+ Object dictLabel = field.get(obj);
+ int dictValue;
+ try {
+ // 获取字典值
+ dictValue = Integer.parseInt(DictCache.getDictValue(StrUtil.format("{}-{}", dictType, dictLabel)));
+ } catch (Exception e) {
+ // 字典值不存在,跳过
+ continue;
+ }
+ // 回填字典值
+ ReflectUtil.setFieldValue(obj, fieldName1, dictValue);
+ }
+
+
+// // 判断属性中是否存在区域编码相关的属性
+// if (StrUtil.equalsAny(fieldName, "placeCode", "gridCode", "buildingCode", "unitCode", "homeCode")) {
+// codeCount++;
+// }
+
+
+ }
+
+ // 校验数据,校验不通过则记录错误信息
+ try {
+ BeanValidators.validateWithException(validator, obj);
+ } catch (Exception e) {
+ ReflectUtil.setFieldValue(obj, "remark", e.getMessage());
+ errorFlag = true;
+ continue;
+ }
+
+ }
+
+ if (errorFlag) {
+ return importList;
+ }
+
+ // 执行目标方法
+ return joinPoint.proceed();
+ }
+}
diff --git a/gather-app/src/main/java/com/ruoyi/aspect/InsertAspect.java b/gather-app/src/main/java/com/ruoyi/aspect/InsertAspect.java
new file mode 100644
index 0000000..00dfe1b
--- /dev/null
+++ b/gather-app/src/main/java/com/ruoyi/aspect/InsertAspect.java
@@ -0,0 +1,64 @@
+package com.ruoyi.aspect;
+
+import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.utils.SecurityUtils;
+import lombok.RequiredArgsConstructor;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Field;
+
+@Aspect
+@Component
+@RequiredArgsConstructor
+public class InsertAspect {
+
+ @Around("execution(* com.ruoyi.business.controller.*.*insert*(..))")
+ public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
+ // 获取目标方法的参数
+ Object[] args = joinPoint.getArgs();
+
+ // 遍历参数,查找包含 areaAuthCode 字段的对象
+ for (Object arg : args) {
+ if (hasAreaAuthCodeField(arg)) {
+
+ LoginUser userinfo = SecurityUtils.getLoginUser();
+ String authCode = userinfo.getUser().getAreaAuthCode();
+ // 对包含 areaAuthCode 字段的对象进行处理
+ setAreaAuthCode(arg, authCode);
+ }
+ }
+
+ // 执行目标方法
+ return joinPoint.proceed();
+ }
+
+ // 判断对象是否包含 areaAuthCode 字段
+ private boolean hasAreaAuthCodeField(Object obj) {
+ Class> clazz = obj.getClass();
+ try {
+ // 使用反射获取对象的字段
+ Field areaAuthCodeField = clazz.getDeclaredField("areaAuthCode");
+ return areaAuthCodeField != null;
+ } catch (NoSuchFieldException e) {
+ return false;
+ }
+ }
+
+ // 设置对象的 areaAuthCode 字段的值
+ private void setAreaAuthCode(Object obj, String value) {
+ Class> clazz = obj.getClass();
+ try {
+ // 使用反射获取对象的字段
+ Field areaAuthCodeField = clazz.getDeclaredField("areaAuthCode");
+ // 设置字段为可访问
+ areaAuthCodeField.setAccessible(true);
+ // 设置字段的值
+ areaAuthCodeField.set(obj, value);
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
diff --git a/gather-app/src/main/java/com/ruoyi/aspect/UpdateAspect.java b/gather-app/src/main/java/com/ruoyi/aspect/UpdateAspect.java
new file mode 100644
index 0000000..d6ce1fb
--- /dev/null
+++ b/gather-app/src/main/java/com/ruoyi/aspect/UpdateAspect.java
@@ -0,0 +1,64 @@
+//package com.ruoyi.aspect;
+//
+//import com.ruoyi.common.core.domain.model.LoginUser;
+//import com.ruoyi.common.utils.SecurityUtils;
+//import lombok.RequiredArgsConstructor;
+//import org.aspectj.lang.ProceedingJoinPoint;
+//import org.aspectj.lang.annotation.Around;
+//import org.aspectj.lang.annotation.Aspect;
+//import org.springframework.stereotype.Component;
+//
+//import java.lang.reflect.Field;
+//
+//@Aspect
+//@Component
+//@RequiredArgsConstructor
+//public class UpdateAspect {
+//
+// @Around("execution(* com.ruoyi.business.controller.*.*update*(..))")
+// public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
+// // 获取目标方法的参数
+// Object[] args = joinPoint.getArgs();
+//
+// // 遍历参数,查找包含 areaAuthCode 字段的对象
+// for (Object arg : args) {
+// if (hasAreaAuthCodeField(arg)) {
+//
+// LoginUser userinfo = SecurityUtils.getLoginUser();
+// String authCode = userinfo.getUser().getAreaAuthCode();
+// // 对包含 areaAuthCode 字段的对象进行处理
+// setAreaAuthCode(arg, authCode);
+// }
+// }
+//
+// // 执行目标方法
+// return joinPoint.proceed();
+// }
+//
+// // 判断对象是否包含 areaAuthCode 字段
+// private boolean hasAreaAuthCodeField(Object obj) {
+// Class> clazz = obj.getClass();
+// try {
+// // 使用反射获取对象的字段
+// Field areaAuthCodeField = clazz.getDeclaredField("areaAuthCode");
+// return areaAuthCodeField != null;
+// } catch (NoSuchFieldException e) {
+// return false;
+// }
+// }
+//
+// // 设置对象的 areaAuthCode 字段的值
+// private void setAreaAuthCode(Object obj, String value) {
+// Class> clazz = obj.getClass();
+// try {
+// // 使用反射获取对象的字段
+// Field areaAuthCodeField = clazz.getDeclaredField("areaAuthCode");
+// // 设置字段为可访问
+// areaAuthCodeField.setAccessible(true);
+// // 设置字段的值
+// areaAuthCodeField.set(obj, value);
+// } catch (NoSuchFieldException | IllegalAccessException e) {
+// e.printStackTrace();
+// }
+// }
+//}
\ No newline at end of file
diff --git a/gather-app/src/main/java/com/ruoyi/aspect/responseAspect.java b/gather-app/src/main/java/com/ruoyi/aspect/responseAspect.java
new file mode 100644
index 0000000..9c398f5
--- /dev/null
+++ b/gather-app/src/main/java/com/ruoyi/aspect/responseAspect.java
@@ -0,0 +1,57 @@
+package com.ruoyi.aspect;
+
+import cn.hutool.core.util.DesensitizedUtil;
+import cn.hutool.core.util.ReflectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+import lombok.RequiredArgsConstructor;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+@Aspect
+@Component
+@RequiredArgsConstructor
+public class responseAspect {
+
+// @Around("execution(* com.ruoyi.business.controller.*.list(..))")
+// public TableDataInfo