浏览代码

更新了首页,新增了股份估值

LiRong 2 月之前
父节点
当前提交
8640ebdbfc

+ 23 - 2
ruoyi-admin/src/main/resources/application.yml

@@ -68,13 +68,13 @@ spring:
   # redis 配置
   redis:
     # 地址
-    host: 1.95.212.35
+    host: 127.0.0.1
     # 端口,默认为6379
     port: 6379
     # 数据库索引
     database: 0
     # 密码
-    password: 123456
+    # password: 123456
     # 连接超时时间
     timeout: 10s
     lettuce:
@@ -117,12 +117,33 @@ mybatis-plus:
   #可以指定实体类所在包路径
   typeAliasesPackage: com.ruoyi.**.domain
 
+
 # Swagger配置
 swagger:
   # 是否开启swagger
   enabled: true
   # 请求前缀
   pathMapping:
+knife4j:
+  enable: true
+  openapi:
+    title: Knife4j官方文档
+    description: "`我是测试`,**你知道吗**
+    # aaa"
+    email: xiaoymin@foxmail.com
+    concat: 八一菜刀
+    url: https://docs.xiaominfo.com
+    version: v4.0
+    license: Apache 2.0
+    license-url: https://stackoverflow.com/
+    terms-of-service-url: https://stackoverflow.com/
+    group:
+      test1:
+        group-name: 分组名称
+        api-rule: package
+        api-rule-resources:
+          - com.knife4j.demo.new3
+
 
 # 防止XSS攻击
 xss:

+ 13 - 61
ruoyi-equity/src/main/java/com/ruoyi/equity/domain/ShareholderInfo.java

@@ -1,10 +1,13 @@
 package com.ruoyi.equity.domain;
 
 import java.math.BigDecimal;
+import java.util.Objects;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ruoyi.common.utils.CommonUtils;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.*;
@@ -21,7 +24,8 @@ import org.springframework.stereotype.Component;
  * @date 2025-03-03
  */
 
-
+@AllArgsConstructor
+@NoArgsConstructor
 @EqualsAndHashCode(callSuper = true)
 @ApiModel(value = "ShareholderEntity", description = "股东实体")
 @Data
@@ -78,55 +82,17 @@ public class ShareholderInfo extends BaseEntity
     @ApiModelProperty("节点类型1控制主体2主体控制")
     private Long nodeType;
 
-    public void setShareholderId(Long shareholderId) 
-    {
-        this.shareholderId = shareholderId;
-    }
-
-    public void setParentId(Long parentId)
-    {
-        this.parentId = parentId;
-    }
-
-    public void setAncestors(String ancestors)
-    {
-        this.ancestors = ancestors;
+    @ApiModelProperty(value = "公司估值转换后")
+    @JsonProperty("companyValuationValue")
+    public String getCompanyValuationValue(){
+        if (Objects.isNull(companyValuation)){
+            return null;
+        }else {
+            return CommonUtils.changeBigDecimalUnit(companyValuation);
+        }
     }
 
-    public void setShareholderName(String shareholderName)
-    {
-        this.shareholderName = shareholderName;
-    }
 
-    public void setShareholderType(String shareholderType)
-    {
-        this.shareholderType = shareholderType;
-    }
-
-    public void setShareholdingRatio(BigDecimal shareholdingRatio)
-    {
-        this.shareholdingRatio = shareholdingRatio;
-    }
-
-    public void setControlledCompany(Long controlledCompany)
-    {
-        this.controlledCompany = controlledCompany;
-    }
-
-    public void setCompanyValuation(BigDecimal companyValuation)
-    {
-        this.companyValuation = companyValuation;
-    }
-
-    public void setIsSubject(Long isSubject)
-    {
-        this.isSubject = isSubject;
-    }
-
-    public void setNodeType(Long nodeType)
-    {
-        this.nodeType = nodeType;
-    }
 
     @Override
     public String toString() {
@@ -149,19 +115,5 @@ public class ShareholderInfo extends BaseEntity
             .toString();
     }
 
-    public ShareholderInfo() {
-    }
 
-    public ShareholderInfo(Long shareholderId, Long parentId, String ancestors, String shareholderName, String shareholderType, BigDecimal shareholdingRatio, Long controlledCompany, BigDecimal companyValuation, Long isSubject, Long nodeType) {
-        this.shareholderId = shareholderId;
-        this.parentId = parentId;
-        this.ancestors = ancestors;
-        this.shareholderName = shareholderName;
-        this.shareholderType = shareholderType;
-        this.shareholdingRatio = shareholdingRatio;
-        this.controlledCompany = controlledCompany;
-        this.companyValuation = companyValuation;
-        this.isSubject = isSubject;
-        this.nodeType = nodeType;
-    }
 }

+ 21 - 0
ruoyi-equity/src/main/java/com/ruoyi/equity/domain/vo/ShareholderDownPicVO.java

@@ -1,15 +1,23 @@
 package com.ruoyi.equity.domain.vo;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.ruoyi.common.utils.CommonUtils;
 import com.ruoyi.equity.utils.INode;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
+@AllArgsConstructor
+@NoArgsConstructor
 @Data
 public class ShareholderDownPicVO implements INode<ShareholderDownPicVO> {
 
@@ -42,5 +50,18 @@ public class ShareholderDownPicVO implements INode<ShareholderDownPicVO> {
     @ApiModelProperty(value = "名称")
     private String name;
 
+    @ApiModelProperty(value = "股份估值")
+    private BigDecimal valuation;
+
+    @ApiModelProperty(value = "股份估值")
+    @JsonProperty("equityValuation")
+    public String getEquityValuation(){
+        if (Objects.isNull(valuation)){
+            return null;
+        }else {
+            return CommonUtils.changeBigDecimalUnit(valuation);
+        }
+    }
+
 
 }

+ 4 - 12
ruoyi-equity/src/main/java/com/ruoyi/equity/domain/vo/ShareholderPicVO.java

@@ -6,8 +6,10 @@ import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.utils.CommonUtils;
 import com.ruoyi.equity.config.BigDecimalSerializer;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -16,6 +18,8 @@ import java.util.Objects;
 
 @Data
 @Builder
+@AllArgsConstructor
+@NoArgsConstructor
 public class ShareholderPicVO{
 
     @ApiModelProperty(value = "id")
@@ -52,16 +56,4 @@ public class ShareholderPicVO{
     public String getPercent(){
         return shareholdingRatio.stripTrailingZeros().toPlainString()+"%";
     }
-
-    public ShareholderPicVO() {
-    }
-
-    public ShareholderPicVO(Long id, String name, BigDecimal companyValuation, List<ShareholderUpPicVO> parents, List<ShareholderDownPicVO> children, BigDecimal shareholdingRatio) {
-        this.id = id;
-        this.name = name;
-        this.companyValuation = companyValuation;
-        this.parents = parents;
-        this.children = children;
-        this.shareholdingRatio = shareholdingRatio;
-    }
 }

+ 11 - 9
ruoyi-equity/src/main/java/com/ruoyi/equity/service/impl/ShareholderInfoServiceImpl.java

@@ -40,7 +40,7 @@ import org.springframework.util.CollectionUtils;
 @Service
 @Slf4j
 public class ShareholderInfoServiceImpl extends ServiceImpl<ShareholderInfoMapper, ShareholderInfo> implements IShareholderInfoService {
-    public static final long USER_ROLE_ID = 102 ;
+    public static final long USER_ROLE_ID = 102;
     @Autowired
     private ShareholderInfoMapper shareholderInfoMapper;
 
@@ -121,6 +121,7 @@ public class ShareholderInfoServiceImpl extends ServiceImpl<ShareholderInfoMappe
             info = shareholderInfoMapper.getSubjectCompany();
         } catch (Exception e) {
             //如果是多主体公司,抛出自定义异常
+            //throw new RuntimeException(e);
             throw new OnlyOneMainCompanyAllowedException();
         }
         if (Objects.isNull(info)) {
@@ -142,7 +143,7 @@ public class ShareholderInfoServiceImpl extends ServiceImpl<ShareholderInfoMappe
             ShareholderInfo shareholderInfo = shareholderInfoMapper.selectShareholderInfoByUserId(userId);
             Long shareholderId = shareholderInfo.getShareholderId();
             String[] str = shareholderInfo.getAncestors().split(",");
-            List<Long> ancestors = Arrays.stream(str) .map(Long::parseLong).collect(Collectors.toList());
+            List<Long> ancestors = Arrays.stream(str).map(Long::parseLong).collect(Collectors.toList());
             //获取股东的role_id
             Long shareholderRoleId = shareholderInfoMapper.selectShareholderRoleIdByUserId(userId);
 
@@ -150,14 +151,14 @@ public class ShareholderInfoServiceImpl extends ServiceImpl<ShareholderInfoMappe
 
 
             List<ShareholderUpPicVO> ups;
-            //如果是管理员 查什么写好的,如果不是查我们自己的
-            if (shareholderRoleId == USER_ROLE_ID){
-                List<ShareholderUpPicVO> oneselfNodes = shareholderInfoMapper.getOneSelfNode(shareholderId,ancestors);
-          ups = ForestNodeMerger2.merge(oneselfNodes);
-            }else{
+            //如果是普通股东,查普通股东自己的
+            if (shareholderRoleId == USER_ROLE_ID) {
+                List<ShareholderUpPicVO> oneselfNodes = shareholderInfoMapper.getOneSelfNode(shareholderId, ancestors);
+                ups = ForestNodeMerger2.merge(oneselfNodes);
+            } else {
                 //获取主体上层的所有节点
                 List<ShareholderUpPicVO> upNodes = shareholderInfoMapper.getAllUpNode();
-                 ups = ForestNodeMerger2.merge(upNodes);
+                ups = ForestNodeMerger2.merge(upNodes);
             }
 
 
@@ -179,7 +180,8 @@ public class ShareholderInfoServiceImpl extends ServiceImpl<ShareholderInfoMappe
             }
             return vo;
         } catch (Exception e) {
-            throw  new urNotshareholderException();
+            throw new RuntimeException(e);
+           // throw new urNotshareholderException();
         }
 
     }

+ 6 - 4
ruoyi-equity/src/main/resources/mapper/equity/ShareholderInfoMapper.xml

@@ -42,18 +42,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where shareholder_id = #{shareholderId}
     </select>
     <select id="getAllUpNode" resultType="com.ruoyi.equity.domain.vo.ShareholderUpPicVO">
-        select shareholder_id as id,parent_id as parentId,shareholder_name as name,shareholding_ratio as shareholdingRatio,
-            shareholding_ratio as shareholdingRatio
+        select shareholder_id as id,parent_id as parentId,shareholder_name as name,shareholding_ratio as shareholdingRatio
         from e_shareholder_info
         where node_type = 1 or is_subject = 1
     </select>
     <select id="getSubjectCompany" resultType="com.ruoyi.equity.domain.ShareholderInfo">
-        select *
+         select shareholder_id, parent_id, ancestors, shareholder_name, shareholder_type, shareholding_ratio,
+                   controlled_company, company_valuation as companyValuation
         from e_shareholder_info
         where is_subject = 1
     </select>
     <select id="getAllDownNode" resultType="com.ruoyi.equity.domain.vo.ShareholderDownPicVO">
-        select shareholder_id as id,parent_id as parentId,shareholder_name as name
+        select shareholder_id as id,parent_id as parentId,shareholder_name as name ,
+        shareholding_ratio  as shareholdingRatio ,
+        company_valuation as valuation
         from e_shareholder_info
         where node_type = 2 or is_subject = 1
     </select>