瀏覽代碼

2022-10-27 9:50 RMS报告管理系统提交 添加部分基础文件 修改冗余部分

沈永艺 2 年之前
父節點
當前提交
4849b21623

+ 2 - 5
RMS/src/main/java/cn/cslg/report/common/utils/CacheUtils.java

@@ -3,9 +3,6 @@ package cn.cslg.report.common.utils;
 import cn.cslg.report.common.core.base.RedisConf;
 import cn.cslg.report.common.model.dto.CommonData;
 import cn.cslg.report.common.model.dto.ProjectFieldOrderDTO;
-//import cn.cslg.report.common.model.dto.analysis.AnalysisItemResultDTO;
-//import cn.cslg.report.domain.PatentField;
-//import cn.cslg.report.domain.User;
 import cn.cslg.report.common.model.vo.PersonnelVO;
 import cn.dev33.satoken.exception.NotLoginException;
 import cn.hutool.core.lang.tree.Tree;
@@ -37,7 +34,7 @@ public class CacheUtils {
         }
     }
 
-//    public void setLoginUser(User user) {
+    //    public void setLoginUser(User user) {
 //        redisUtil.set(RedisConf.LOGIN_USER + RedisConf.SYMBOL_COLON + user.getId(), JsonUtils.objectToJson(user));
 //    }
 //
@@ -50,7 +47,7 @@ public class CacheUtils {
         }
     }
 
-    public  PersonnelVO getLoginUserPersonnel(Object userId) {
+    public PersonnelVO getLoginUserPersonnel(Object userId) {
         String json = redisUtil.get(RedisConf.LOGIN_USER + RedisConf.SYMBOL_COLON + userId);
         if (StringUtils.isEmpty(json)) {
             throw new NotLoginException("无数据", "user", "");

+ 11 - 12
RMS/src/main/java/cn/cslg/report/common/utils/DataUtils.java

@@ -2,7 +2,6 @@ package cn.cslg.report.common.utils;
 
 import cn.cslg.report.common.model.BaseVO;
 import cn.dev33.satoken.secure.SaSecureUtil;
-import cn.dev33.satoken.stp.StpUtil;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -10,6 +9,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
@@ -68,23 +68,22 @@ public class DataUtils {
     }
 
     /**
-     * @return 租户ID
+     * @return 去重后的数据
      * @author 沈永艺
-     * @description 获取租户ID
+     * @description 在对象数组中按照某一类属性进行去重
      */
-    public Integer getTenantId() {
-        return cacheUtils.getLoginUser(StpUtil.getLoginIdAsInt()).getTenantId();
+    //用例:待去重List.stream().filter(DataUtils.distinctByKey(对象::get属性字段)).collect(Collectors.toList());
+    public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
+        Map<Object, Boolean> seen = new ConcurrentHashMap<>();
+        return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
     }
 
-
     /**
-     * @return 去重后的数据
+     * @return 计算完成度
      * @author 沈永艺
-     * @description 在对象数组中按照某一属性进行去重
+     * @description 输入完成数量和全部数量计算完成百分比
      */
-    //用例:待去重List.stream().filter(DataUtils.distinctByKey(对象::get属性字段)).collect(Collectors.toList());
-    public static <T> Predicate<T> distinctByKey(java.util.function.Function<? super T, ?> keyExtractor) {
-        Map<Object, Boolean> seen = new ConcurrentHashMap<>();
-        return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
+    public String calculateCompletion(Integer finishNum, Integer allNum) {
+        return finishNum / allNum + "%";
     }
 }

+ 15 - 0
RMS/src/main/java/cn/cslg/report/controller/FeatureController.java

@@ -0,0 +1,15 @@
+package cn.cslg.report.controller;
+
+import cn.cslg.report.common.core.base.Constants;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Tag(name = "特征管理")
+@RestController
+@RequestMapping(Constants.REPORT_API + "/feature")
+@RequiredArgsConstructor(onConstructor_ = {@Lazy})
+public class FeatureController {
+}

+ 14 - 0
RMS/src/main/java/cn/cslg/report/entity/Feature.java

@@ -0,0 +1,14 @@
+package cn.cslg.report.entity;
+
+import cn.cslg.report.common.model.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = true)
+@TableName(value = "FEATURE")
+public class Feature extends BaseEntity<Feature> {
+}

+ 1 - 1
RMS/src/main/java/cn/cslg/report/entity/Report.java

@@ -9,6 +9,6 @@ import lombok.experimental.Accessors;
 @Data
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = true)
-@TableName(value = "APPLICATION")
+@TableName(value = "REPORT")
 public class Report extends BaseEntity<Report> {
 }

+ 9 - 0
RMS/src/main/java/cn/cslg/report/mapper/FeatureMapper.java

@@ -0,0 +1,9 @@
+package cn.cslg.report.mapper;
+
+import cn.cslg.report.entity.Feature;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface FeatureMapper extends BaseMapper<Feature> {
+}

+ 10 - 0
RMS/src/main/java/cn/cslg/report/service/FeatureService.java

@@ -0,0 +1,10 @@
+package cn.cslg.report.service;
+
+import cn.cslg.report.entity.Feature;
+import cn.cslg.report.mapper.FeatureMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+@Service
+public class FeatureService extends ServiceImpl<FeatureMapper, Feature> {
+}