Browse Source

feature 代码提交

xiahan 1 week ago
parent
commit
93b0b63590

+ 158 - 0
qhse-common/src/main/java/com/rongwei/bscommon/system/config/MybatisConfig.java

@@ -0,0 +1,158 @@
+package com.rongwei.bscommon.system.config;
+
+import com.baomidou.mybatisplus.core.parser.ISqlParser;
+import com.baomidou.mybatisplus.core.parser.ISqlParserFilter;
+import com.baomidou.mybatisplus.core.parser.SqlParserHelper;
+import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
+import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
+import com.rongwei.rwcommonconfig.config.interceptor.SaasPaginationInterceptor;
+import net.sf.jsqlparser.expression.Expression;
+import net.sf.jsqlparser.expression.LongValue;
+import org.apache.ibatis.mapping.MappedStatement;
+import org.apache.ibatis.reflection.MetaObject;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by duyisong on 17/5/28.
+ */
+@EnableTransactionManagement
+@Configuration
+@MapperScan("com.rongwei.bscommon.system.dao")
+public class MybatisConfig {
+
+
+
+    @Value("${page.size:#{null}}")
+    private Long pageSize;
+    /**
+     * 自定义查询sql多数据库适配
+     * @return
+     */
+    @Bean
+    public QuerySqlAdaptationInterceptor querySqlAdaptationInterceptor(){
+        QuerySqlAdaptationInterceptor sqlAdaptation = new QuerySqlAdaptationInterceptor();
+        return sqlAdaptation;
+    }
+
+    /*
+     * 分页插件,自动识别数据库类型
+     * 多租户,请参考官网【插件扩展】
+     */
+    @Bean
+    public SaasPaginationInterceptor paginationInterceptor() {
+        SaasPaginationInterceptor paginationInterceptor = new SaasPaginationInterceptor();
+        /*
+         * 【测试多租户】 SQL 解析处理拦截器<br>
+         * 这里固定写成住户 1 实际情况你可以从cookie读取,因此数据看不到 【 麻花藤 】 这条记录( 注意观察 SQL )<br>
+         */
+        List<ISqlParser> sqlParserList = new ArrayList<>();
+        TenantSqlParser tenantSqlParser = new TenantSqlParser();
+        tenantSqlParser.setTenantHandler(new TenantHandler() {
+            @Override
+            public Expression getTenantId(boolean a) {
+                // 该 where 条件 3.2.0 版本开始添加的,用于分区是否为在 where 条件中使用
+                // 此判断用于支持返回多个租户 ID 场景,具体使用查看示例工程
+                // 查询redis缓存的租户ID
+                return new LongValue(1L);
+            }
+
+            @Override
+            public String getTenantIdColumn() {
+                return "TENANTID";
+            }
+
+            @Override
+            public boolean doTableFilter(String tableName) {
+                // 这里可以判断是否过滤表,true表示过滤、false不过滤
+                /*
+                if ("user".equals(tableName)) {
+                    return true;
+                }*/
+                return true;
+            }
+        });
+        sqlParserList.add(tenantSqlParser);
+        paginationInterceptor.setSqlParserList(sqlParserList);
+        paginationInterceptor.setSqlParserFilter(new ISqlParserFilter() {
+            @Override
+            public boolean doFilter(MetaObject metaObject) {
+                MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject);
+                // 过滤自定义查询此时无租户信息约束【 麻花藤 】出现
+                if ("com.rongwei.rwadmincommon.system.dao.getAll".equals(ms.getId())) {
+                    return true;
+                }
+                return false;
+            }
+        });
+        paginationInterceptor.setLimit(pageSize == null ? 10000 :pageSize);
+        return paginationInterceptor;
+    }
+
+    /**
+     * 打印 sql
+     */
+    /*@Bean
+    public PerformanceInterceptor performanceInterceptor() {
+        PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
+        //格式化sql语句
+        Properties properties = new Properties();
+        properties.setProperty("format", "true");
+        performanceInterceptor.setProperties(properties);
+        return performanceInterceptor;
+    }*/
+
+    /*@Bean
+    public MapperScannerConfigurer mapperScannerConfigurer() {
+        log.info("[config] 注册 tkMtBatis");
+        MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
+        mapperScannerConfigurer.setBasePackage("com.rongwei.rwadmin.system.dao");
+        Properties properties = new Properties();
+        properties.setProperty("markerInterface", "com.rongwei.rwadmin.common.mapper.BaseDao");
+        mapperScannerConfigurer.setProperties(properties);
+        return mapperScannerConfigurer;
+    }
+
+    @Bean
+    public PageHelper pageHelper(DataSource dataSource) {
+        log.info("[config] 注册 MyBatis分页插件PageHelper");
+        PageHelper pageHelper = new PageHelper();
+        Properties p = new Properties();
+        p.setProperty("offsetAsPageNum", "true");
+        p.setProperty("rowBoundsWithCount", "true");
+        p.setProperty("reasonable", "true");
+        pageHelper.setProperties(p);
+        return pageHelper;
+    }*/
+
+
+    // 配置sqlSessionFactory
+    /*@Bean(name = "sqlSessionFactory")
+    public SqlSessionFactory sqlSessionFactoryBean(DataSource dataSource
+            ,QuerySqlAdaptationInterceptor sqlAdaptation,PaginationInterceptor paginationInterceptor) {
+        SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
+        bean.setDataSource(dataSource);
+        if(StringUtils.isNotBlank(typeAliasesPackage)){
+            bean.setTypeAliasesPackage(typeAliasesPackage);
+        }
+
+        // 自定义的sql日志拦截器
+        Interceptor sqlLogInterceptor = new SqlLogInterceptor();
+        Interceptor[] plugins =  new Interceptor[]{ sqlLogInterceptor};
+        bean.setPlugins(plugins);
+        try {
+            bean.setMapperLocations(resolver.getResources(xmlLocation));
+            return bean.getObject();
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
+    }*/
+
+}

+ 1 - 150
qhse-common/src/main/java/com/rongwei/bscommon/system/config/QuerySqlAdaptationInterceptor.java

@@ -1,22 +1,11 @@
 package com.rongwei.bscommon.system.config;
 
 import com.alibaba.druid.pool.DruidDataSource;
-import com.rongwei.commonservice.service.RedisService;
-import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.utils.SqlAdaptationUtil;
-import com.rongwei.rwcommon.utils.StringUtils;
-import org.apache.ibatis.binding.MapperMethod;
 import org.apache.ibatis.executor.statement.StatementHandler;
 import org.apache.ibatis.mapping.BoundSql;
 import org.apache.ibatis.plugin.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
 import java.lang.reflect.Field;
 import java.sql.Connection;
 import java.util.Properties;
@@ -27,89 +16,26 @@ import java.util.Properties;
 @Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
 public class QuerySqlAdaptationInterceptor implements Interceptor {
 
-    private static final Logger logger = LoggerFactory.getLogger(QuerySqlAdaptationInterceptor.class);
-
-    @Value("${saas.tenantmode:NONE}")
-    private String saasmode;
-
-    @Autowired
-    private RedisService redisService;
-
     @Autowired
     private DruidDataSource datasource;
 
     @Override
     public Object intercept(Invocation invocation) throws Throwable {
-//        DruidDataSource datasource = (DruidDataSource)DynamicDataSource.dataSourcesMap.get(DynamicDataSource.getDataSource());
         // 获取数据库类型
         String dbType = datasource.getDbType();
         // 方法一
         StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
-        //映射工具
-//        MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
-//        MetaObject metaObject = MetaObject.forObject(statementHandler, SystemMetaObject.DEFAULT_OBJECT_FACTORY, SystemMetaObject.DEFAULT_OBJECT_WRAPPER_FACTORY, new DefaultReflectorFactory());
-        //先拦截到RoutingStatementHandler,里面有个StatementHandler类型的delegate变量,其实现类是BaseStatementHandler,然后就到BaseStatementHandler的成员变量mappedStatement
-//        MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
-        //id为执行的mapper方法的全路径名,如com.uv.dao.UserMapper.insertUser
         BoundSql boundSql = statementHandler.getBoundSql();
-
         //获取到原始sql语句
         String sql = boundSql.getSql();
         // dao参数
         Object parObj = statementHandler.getParameterHandler().getParameterObject();
         SqlAdaptationUtil sqlAdaptation = new SqlAdaptationUtil();
-        String mSql = sqlAdaptation.modifySql(sqlAdaptation.commonRuleAnalysis(sql),dbType,parObj);
+        String mSql = sqlAdaptation.modifySql(sqlAdaptation.commonRuleAnalysis(sql), dbType, parObj);
         //通过反射修改sql语句
         Field field = boundSql.getClass().getDeclaredField("sql");
         field.setAccessible(true);
-
-        // SaaS环境下schema切换
-        if("DATASOURCE".equals(saasmode)){
-            System.out.println("saas切换");
-            logger.info("saas切换");
-            String schema = null;
-            try{
-                schema = this.getSchema();
-            }catch (Exception e){
-                e.printStackTrace();
-            }
-            // 判断是否有参数(appointSchema)指定schema
-            if(parObj instanceof MapperMethod.ParamMap){
-                MapperMethod.ParamMap paramMap = (MapperMethod.ParamMap)parObj;
-                if(paramMap.containsKey("appointSchema") && paramMap.get("appointSchema") != null){
-                    String appointSchema = paramMap.get("appointSchema").toString();
-                    schema = appointSchema;
-                }
-            }
-            System.out.println("schema:"+schema);
-            logger.info("schema:"+schema);
-            if(StringUtils.isNotBlank(schema)){
-                // 多租户schema切换方案一:通过 USE databaseName; 实现切换
-                mSql = "USE " + schema + ";" + mSql;
-                System.out.println("mSql:"+mSql);
-                logger.info("mSql:"+mSql);
-                // 多租户schema切换方案二:直接获取Connection设置schema
-                /*Object[] objs = invocation.getArgs();
-                Connection conn = (Connection)objs[0];
-                conn.setSchema(schema);*/
-            }else{
-//                throw new Exception("SaaS模式下查不到相应schema");
-                System.out.println("SaaS模式下查不到相应schema");
-                logger.warn("SaaS模式下查不到相应schema");
-            }
-            /*Connection o = (Connection)invocation.getArgs()[0];
-            System.out.println("o.getSchema():"+o.getSchema());
-            o.setSchema(schema);
-            System.out.println("o.getSchema():"+o.getSchema());*/
-        }
-
         field.set(boundSql, mSql);
-        //sql语句类型 select、delete、insert、update
-        /*if(SqlCommandType.SELECT == mappedStatement.getSqlCommandType()){
-            System.out.println("sql:"+sql);
-        }*/
-
-        // 返回
         return invocation.proceed();
     }
 
@@ -122,79 +48,4 @@ public class QuerySqlAdaptationInterceptor implements Interceptor {
     public void setProperties(Properties properties) {
 
     }
-
-    /**
-     * SaaS模式下获取当前租户的数据库名
-     * @return
-     * @throws Exception
-     */
-    private String getSchema() throws Exception{
-        Long startTime = System.currentTimeMillis();
-        String schema = null;
-        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-        if(attributes == null){
-            logger.error("ServletRequestAttributes为null");
-            throw new Exception("ServletRequestAttributes为null");
-        }
-        HttpServletRequest request = attributes.getRequest();
-        if(request == null){
-            logger.error("HttpServletRequest为null");
-            throw new Exception("HttpServletRequest为null");
-        }
-
-        schema = request.getHeader("schema");
-        if(StringUtils.isNotBlank(schema)) {
-            return schema;
-        }
-
-        String token = request.getHeader("token");
-        System.out.println("token:"+token);
-        logger.info("token:"+token);
-//        if(StringUtils.isBlank(token)){
-//            String incontrolToken = request.getHeader("incontrol-token");
-//            Object tokenDskey = request.getAttribute(Constants.SAAS_LOGIN_TOKEN);
-//            // 登录功能特殊处理获取DsKey
-//            if(tokenDskey != null){
-//                logger.info("tokenDskey:"+tokenDskey);
-//                schema = (String) tokenDskey;
-//            }
-//            // 某些特殊功能incontrolToken也可以作为token
-//            else if(StringUtils.isNotBlank(incontrolToken)){
-//                logger.info("incontrolToken:"+incontrolToken);
-//                schema = getSchemaByToken(incontrolToken);
-//            }
-//            // 某些特殊功能token放入线程全局变量中
-//            else if(StringUtils.isNotBlank(ThreadLocalResource.token.get())){
-//                logger.info("ThreadToken:"+ThreadLocalResource.token.get());
-//                token = ThreadLocalResource.token.get();
-//                schema = getSchemaByToken(token);
-//            }
-//        } else{
-//            schema = getSchemaByToken(token);
-//            System.out.println("Dskey:"+schema);
-//        }
-        schema = getSchemaByToken(token);
-        System.out.println("Dskey:"+schema);
-        Long endTime = System.currentTimeMillis();
-        System.out.println("查找schema时间为:"+(endTime-startTime));
-        return schema;
-    }
-
-    /**
-     * 根据token获取多租户模式的schema
-     * @param token
-     * @return
-     */
-    private String getSchemaByToken(String token){
-        SysUserVo currUser = null;
-        if(StringUtils.isNotEmpty(token)){
-            currUser = redisService.getLoginUser(token);
-        }
-        String schema = null;
-        if(currUser != null){
-            schema = currUser.getTenantDo().getDskey();
-        }
-        return schema;
-    }
-
 }

+ 84 - 0
qhse-common/src/main/java/com/rongwei/bscommon/system/excelImportListener/UserPointsRegistrationListener.java

@@ -0,0 +1,84 @@
+package com.rongwei.bscommon.system.excelImportListener;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.rongwei.bsentity.domain.QhsePointsDetailsUserDo;
+import com.rongwei.bsentity.dto.UserPointsRegistrationImportDto;
+import com.rongwei.rwcommon.base.exception.CustomException;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.math.BigDecimal;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * UserPointsEegistrationListener class
+ *
+ * @author XH
+ * @date 2025/09/10
+ */
+public class UserPointsRegistrationListener extends AnalysisEventListener<UserPointsRegistrationImportDto> {
+    private static final Logger log = LoggerFactory.getLogger(UserPointsRegistrationListener.class);
+    private final List<QhsePointsDetailsUserDo> saveList = new ArrayList<>();
+    public static LocalDate now = LocalDate.now();
+
+    @Override
+    public void invoke(UserPointsRegistrationImportDto currentRowDto, AnalysisContext analysisContext) {
+
+        // 必填项校验
+        if (StringUtils.isBlank(currentRowDto.getName()) ||
+                StringUtils.isBlank(currentRowDto.getJobNo()) ||
+                StringUtils.isBlank(currentRowDto.getDesc()) ||
+                currentRowDto.getDateOfOccurrence() == null ||
+                currentRowDto.getPoint() == null
+        ) {
+            log.error("第{}行的数据,存在必填项未填的数据", analysisContext.readRowHolder().getRowIndex());
+            throw new RuntimeException("存在必填字段为空的数据");
+        }
+        // 发送时间比当前时间晚 抛出异常
+        if (currentRowDto.getDateOfOccurrence().isAfter(now)) {
+            throw new RuntimeException("存在发生日期大于当前日期的数据");
+        }
+
+        /**
+         * 发生时间校验
+         *  当前时间为1月份 可以导入 前一年的数据
+         *  为其他月份只可以导入当前年份的数据
+         */
+        if (now.getMonth().getValue() == 1) {
+            if (!(currentRowDto.getDateOfOccurrence().getYear() + 1 == now.getYear() || currentRowDto.getDateOfOccurrence().getYear() == now.getYear())) {
+                throw new RuntimeException("发生日期不能早于" + (now.getYear() - 1));
+            }
+        } else {
+            if (currentRowDto.getDateOfOccurrence().getYear() != now.getYear()) {
+                throw new RuntimeException("存在发生日期所在的年份和当前年份不一致的数据");
+            }
+        }
+        Instant instant = currentRowDto.getDateOfOccurrence().atTime(LocalTime.MIDNIGHT).atZone(ZoneId.systemDefault()).toInstant();
+
+        saveList.add(new QhsePointsDetailsUserDo().setPoints(currentRowDto.getPoint())
+                .setPersonname(currentRowDto.getName())
+                .setPersoncode(currentRowDto.getJobNo())
+                .setDescription(currentRowDto.getDesc())
+                .setPoints(currentRowDto.getPoint())
+                .setHappentime(Date.from(instant)));
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+
+    }
+
+    // 获取Excel 中的数据
+    public List<QhsePointsDetailsUserDo> getData() {
+        return saveList;
+    }
+
+}

+ 13 - 0
qhse-common/src/main/java/com/rongwei/bscommon/system/service/ExcelImportService.java

@@ -0,0 +1,13 @@
+package com.rongwei.bscommon.system.service;
+
+import com.rongwei.rwcommon.base.R;
+
+/**
+ * ExcelImportService class
+ *
+ * @author XH
+ * @date 2025/09/10
+ */
+public interface ExcelImportService {
+    R userPointsRegistration(String fileId);
+}

+ 55 - 0
qhse-common/src/main/java/com/rongwei/bscommon/system/service/impl/ExcelImportServiceImpl.java

@@ -0,0 +1,55 @@
+package com.rongwei.bscommon.system.service.impl;
+
+import com.alibaba.excel.EasyExcel;
+import com.rongwei.bscommon.system.excelImportListener.UserPointsRegistrationListener;
+import com.rongwei.bscommon.system.service.ExcelImportService;
+import com.rongwei.bsentity.domain.QhsePointsDetailsUserDo;
+import com.rongwei.bsentity.dto.UserPointsRegistrationImportDto;
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.rwcommon.utils.StringUtils;
+import com.rongwei.rwcommonentity.commonservers.domain.SysFileItemDo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.List;
+
+import static com.rongwei.rwcommon.utils.UtilsChecks.parameterCheck;
+
+/**
+ * ExcelImportServiceImpl class
+ *
+ * @author XH
+ * @date 2025/09/10
+ */
+@Service
+public class ExcelImportServiceImpl implements ExcelImportService {
+    @Autowired
+    private QHSEFileItemServiceImpl qhseFileItemServiceImpl;
+
+    @Override
+    public R userPointsRegistration(String fileId) {
+        File file = fileCheck(fileId);
+        UserPointsRegistrationListener userPointsRegistrationListener = new UserPointsRegistrationListener();
+        EasyExcel.read(file, UserPointsRegistrationImportDto.class, userPointsRegistrationListener).sheet().doRead();
+        // 解析后的数据
+        List<QhsePointsDetailsUserDo> parsedData = userPointsRegistrationListener.getData();
+        return null;
+    }
+
+
+
+    public File fileCheck(String fileId) {
+        parameterCheck(() -> StringUtils.isBlank(fileId), "请上传文件", "文件ID为空");
+        SysFileItemDo sysFileItemDo = qhseFileItemServiceImpl.getById(fileId);
+        parameterCheck(() -> sysFileItemDo == null, "文件解析有误!请联系管理员", "无法根据文件ID:{},获取到文件信息", fileId);
+
+        String realPath = sysFileItemDo.getFullpath();
+        parameterCheck(() -> StringUtils.isBlank(realPath), "文件解析有误!请联系管理员", "根据文件ID:{},无法获取到文件路径", fileId);
+        File file = new File(realPath);
+        parameterCheck(() -> !file.exists(), "文件解析有误!请联系管理员", "根据文件地址:{},无法获取文件", realPath);
+        return file;
+
+    }
+
+}

+ 24 - 0
qhse-common/src/main/java/com/rongwei/bscommon/system/utils/QHSEUtils.java

@@ -51,6 +51,12 @@ public class QHSEUtils {
         return currUser;
     }
 
+    /**
+     * 通用数据初始化
+     * @param t
+     * @param userVo
+     * @param <T>
+     */
     public static <T extends BaseDo> void initModelGeneralParameters(T t, SysUserDo userVo) {
         if (userVo == null) {
             userVo = getCurrentUser();
@@ -66,6 +72,24 @@ public class QHSEUtils {
         t.setDeleted("0");
     }
 
+    /**
+     * 修改数据初始化
+     * @param t
+     * @param userVo
+     * @param <T>
+     */
+    public static <T extends BaseDo> void initModelModifyParameters(T t, SysUserDo userVo) {
+        if (userVo == null) {
+            userVo = getCurrentUser();
+        }
+        t.setModifydate(new Date());
+        if (userVo != null) {
+            t.setModifyuserid(userVo.getId());
+            t.setModifyusername(userVo.getName());
+        }
+        t.setDeleted("0");
+    }
+
     public static BigDecimal CALCULATE_Y3(BigDecimal x1, BigDecimal y1, BigDecimal x2, BigDecimal y2, BigDecimal x3) {
         // 检查x1是否等于x2,以避免除以零的错误
         if (x1.compareTo(x2) == 0) {

+ 5 - 0
qhse-entity/pom.xml

@@ -39,5 +39,10 @@
             <artifactId>spring-web</artifactId>
             <version>5.3.7</version>
         </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>4.0.3</version>
+        </dependency>
     </dependencies>
 </project>

+ 65 - 0
qhse-entity/src/main/java/com/rongwei/bsentity/Dto/UserPointsRegistrationImportDto.java

@@ -0,0 +1,65 @@
+package com.rongwei.bsentity.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.time.LocalDate;
+import java.util.Date;
+
+/**
+ * UserPointsRegistrationImportDto class
+ *
+ * @author XH
+ * @date 2025/09/10
+ */
+@Data
+public class UserPointsRegistrationImportDto {
+    /**
+     * 姓名
+     */
+    @ExcelProperty(index = 0)
+    private String name;
+    /**
+     * 工号
+     */
+    @ExcelProperty(index = 1)
+    private String jobNo;
+
+    /**
+     * 身份证
+     */
+    @ExcelProperty(index = 2)
+    private String idCard;
+
+
+    /**
+     * 所属部门
+     */
+    @ExcelProperty(index = 3)
+    private String deptName;
+
+
+    /**
+     * 所属分包商
+     */
+    @ExcelProperty(index = 4)
+    private String subcontractor;
+
+    /**
+     * 加扣分说明
+     */
+    @ExcelProperty(index = 5)
+    private String desc;
+
+    /**
+     * 加扣分分值
+     */
+    @ExcelProperty(index = 6)
+    private Integer point;
+
+    /**
+     * 发生事件
+     */
+    @ExcelProperty(index = 7)
+    private LocalDate dateOfOccurrence;
+}

+ 4 - 0
qhse-entity/src/main/java/com/rongwei/bsentity/domain/QhsePointsDetailsUserDo.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.rongwei.rwcommon.base.BaseDo;
 import lombok.Data;
+import lombok.experimental.Accessors;
 
 import java.util.Date;
 
@@ -14,6 +15,7 @@ import java.util.Date;
  */
 @TableName(value = "qhse_points_details_user")
 @Data
+@Accessors(chain = true)
 public class QhsePointsDetailsUserDo extends BaseDo {
     /**
      * 主键
@@ -127,4 +129,6 @@ public class QhsePointsDetailsUserDo extends BaseDo {
     private String mainid;
 
     private int state;
+
+    private String idcard;
 }

+ 38 - 0
qhse-server/src/main/java/com/rongwei/controller/ExcelImportController.java

@@ -0,0 +1,38 @@
+package com.rongwei.controller;
+
+import com.rongwei.bscommon.system.service.impl.ExcelImportServiceImpl;
+import com.rongwei.rwcommon.base.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * ExcelImportController class
+ *
+ * @author XH
+ * @date 2025/09/10
+ */
+@RestController
+@RequestMapping("/excel/import")
+public class ExcelImportController {
+    private static final Logger log = LoggerFactory.getLogger(ExcelImportController.class);
+
+    @Autowired
+    private ExcelImportServiceImpl excelImportService;
+
+    /**
+     * 开始用户积分兑换
+     *
+     * @param fileId 文件Id
+     * @return 结果
+     */
+    @PostMapping("/user/point")
+    public R userPointsRegistration(@RequestBody String fileId) {
+        log.info("开始用户积分兑换");
+        return excelImportService.userPointsRegistration(fileId);
+    }
+}