Browse Source

feat:邮件解析-定义估值表解析相关表

mozuwen 7 months ago
parent
commit
ea81a199d1

+ 8 - 0
service-base/src/main/java/com/simuwang/base/mapper/FundPositionDetailMapper.java

@@ -0,0 +1,8 @@
+package com.simuwang.base.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface FundPositionDetailMapper {
+
+}

+ 8 - 0
service-base/src/main/java/com/simuwang/base/mapper/PdfValuationRecordMapper.java

@@ -0,0 +1,8 @@
+package com.simuwang.base.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface PdfValuationRecordMapper {
+
+}

+ 8 - 0
service-base/src/main/java/com/simuwang/base/mapper/ValuationMarketCodeMapper.java

@@ -0,0 +1,8 @@
+package com.simuwang.base.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ValuationMarketCodeMapper {
+
+}

+ 8 - 0
service-base/src/main/java/com/simuwang/base/mapper/ValuationTableMapper.java

@@ -0,0 +1,8 @@
+package com.simuwang.base.mapper;
+
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface ValuationTableMapper {
+
+}

+ 134 - 0
service-base/src/main/java/com/simuwang/base/pojo/dos/FundPositionDetailDO.java

@@ -0,0 +1,134 @@
+package com.simuwang.base.pojo.dos;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@TableName("fund_position_detail")
+public class FundPositionDetailDO {
+    /**
+     * 主键id
+     */
+    @TableId(value = "id")
+    private Integer id;
+    /**
+     * 基金ID
+     */
+    @TableField(value = "fund_id")
+    private String fundId;
+    /**
+     * 估值日期
+     */
+    @TableField(value = "valuation_date")
+    private Date valuationDate;
+    /**
+     * 科目级别
+     */
+    @TableField(value = "level")
+    private Integer level;
+    /**
+     * 币种:1-人民币,2-美元,3-港元
+     */
+    @TableField(value = "currency")
+    private Integer currency;
+    /**
+     * 汇率
+     */
+    @TableField(value = "exchange_rate")
+    private BigDecimal exchangeRate;
+    /**
+     * 科目代码
+     */
+    @TableField(value = "subject_code")
+    private String subjectCode;
+    /**
+     * 证券代码
+     */
+    @TableField(value = "securities_code")
+    private String securitiesCode;
+    /**
+     * 证券名称
+     */
+    @TableField(value = "securities_name")
+    private String securitiesName;
+    /**
+     * 类型:0-股票,1-债券,2-现金,3-期货,4-期权,5-正逆回购,6-基金,7-其他衍生品
+     */
+    @TableField(value = "sec_type")
+    private Integer secType;
+    /**
+     * 证券数量
+     */
+    @TableField(value = "securities_amount")
+    private BigDecimal securitiesAmount;
+    /**
+     * 市值
+     */
+    @TableField(value = "market_value")
+    private BigDecimal marketValue;
+    /**
+     * 市值占净值
+     */
+    @TableField(value = "market_value_ratio")
+    private BigDecimal marketValueRatio;
+    /**
+     * 行情收市价
+     */
+    @TableField(value = "market_price")
+    private BigDecimal marketPrice;
+    /**
+     * 持仓性质:1-多头,2-空头
+     */
+    @TableField(value = "nature")
+    private Integer nature;
+    /**
+     * 资产类型:1-资产类,2-负债类,3-共同类,4-所有者权益类,6-损益类
+     */
+    @TableField(value = "subject_type")
+    private Integer subjectType;
+    /**
+     * 估值增值
+     */
+    @TableField(value = "increment")
+    private BigDecimal increment;
+    /**
+     * 停牌信息
+     */
+    @TableField(value = "halt_info")
+    private String haltInfo;
+    /**
+     * 成本
+     */
+    @TableField(value = "net_cost")
+    private BigDecimal netCost;
+    /**
+     * 成本占比
+     */
+    @TableField(value = "net_cost_ratio")
+    private BigDecimal netCostRatio;
+    /**
+     * 单位成本
+     */
+    @TableField(value = "unit_cost")
+    private BigDecimal unitCost;
+    /**
+     * 是否有效:0-无效,1-有效
+     */
+    @TableField(value = "isvalid")
+    private Integer isvalid;
+    /**
+     * 创建者Id
+     */
+    @TableField(value = "creatorid")
+    private Integer creatorId;
+    /**
+     * 创建时间
+     */
+    @TableField(value = "createtime")
+    private Date createTime;
+}

+ 85 - 0
service-base/src/main/java/com/simuwang/base/pojo/dos/PdfValuationRecordDO.java

@@ -0,0 +1,85 @@
+package com.simuwang.base.pojo.dos;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import java.time.LocalDateTime;
+import java.sql.Timestamp;
+import java.time.LocalDate;
+import java.util.Date;
+
+@Data
+@TableName("pdf_valuation_record")
+public class PdfValuationRecordDO{
+   /**
+   *主键ID
+   */
+   @TableId(value="id")
+   private Integer id;
+   /**
+   *基金id
+   */
+   @TableField(value="fund_id")
+   private String fundId;
+   /**
+   *文件上传日期
+   */
+   @TableField(value="upload_date")
+   private Date uploadDate;
+   /**
+   *pdf文件名
+   */
+   @TableField(value="file_name")
+   private String fileName;
+   /**
+   *pdf文件路径
+   */
+   @TableField(value="pdf_url")
+   private String pdfUrl;
+   /**
+   *pdf转化为excel文件的路径
+   */
+   @TableField(value="excel_url")
+   private String excelUrl;
+   /**
+   *估值表来源:1-是
+   */
+   @TableField(value="from_email")
+   private Integer fromEmail;
+   /**
+   *是否成功解析:0-否,1-是
+   */
+   @TableField(value="is_success")
+   private Integer isSuccess;
+   /**
+   *pdf解析失败的原因
+   */
+   @TableField(value="reason")
+   private String reason;
+   /**
+   *是否有效:0-无效,1-有效
+   */
+   @TableField(value="isvalid")
+   private Integer isvalid;
+   /**
+   *创建者Id
+   */
+   @TableField(value="creatorid")
+   private Integer creatorId;
+   /**
+   *创建时间
+   */
+   @TableField(value="createtime")
+   private Date createTime;
+   /**
+   *修改者Id
+   */
+   @TableField(value="updaterid")
+   private Integer updaterId;
+   /**
+   *更新时间
+   */
+   @TableField(value="updatetime")
+   private Date updateTime;
+}

+ 58 - 0
service-base/src/main/java/com/simuwang/base/pojo/dos/ValuationMarketCodeDO.java

@@ -0,0 +1,58 @@
+package com.simuwang.base.pojo.dos;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("valuation_market_code")
+public class ValuationMarketCodeDO {
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id")
+    private Integer id;
+    /**
+     * 交易场所code
+     */
+    @TableField(value = "market_code")
+    private String marketCode;
+    /**
+     * 交易场所名称
+     */
+    @TableField(value = "market_name")
+    private String marketName;
+    /**
+     * 排序id
+     */
+    @TableField(value = "sort_id")
+    private Integer sortId;
+    /**
+     * 是否有效:0-无效,1-有效
+     */
+    @TableField(value = "isvalid")
+    private Integer isvalid;
+    /**
+     * 创建者Id
+     */
+    @TableField(value = "creatorid")
+    private Integer creatorId;
+    /**
+     * 创建时间
+     */
+    @TableField(value = "createtime")
+    private Date createTime;
+    /**
+     * 修改者Id
+     */
+    @TableField(value = "updaterid")
+    private Integer updaterId;
+    /**
+     * 更新时间
+     */
+    @TableField(value = "updatetime")
+    private Date updateTime;
+}

+ 135 - 0
service-base/src/main/java/com/simuwang/base/pojo/dos/ValuationTableDO.java

@@ -0,0 +1,135 @@
+package com.simuwang.base.pojo.dos;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+
+@Data
+@TableName("valuation_table")
+public class ValuationTableDO {
+    /**
+     * 主键id,估值表id
+     */
+    @TableId(value = "id")
+    private Integer id;
+    /**
+     * 基金id
+     */
+    @TableField(value = "fund_id")
+    private String fundId;
+    /**
+     * 估值表标题
+     */
+    @TableField(value = "title")
+    private String title;
+    /**
+     * 估值日期
+     */
+    @TableField(value = "valuation_date")
+    private Date valuationDate;
+    /**
+     * 单位净值
+     */
+    @TableField(value = "nav")
+    private BigDecimal nav;
+    /**
+     * 估值表头部信息
+     */
+    @TableField(value = "head_info")
+    private String headInfo;
+    /**
+     * 估值表尾部信息
+     */
+    @TableField(value = "tail_info")
+    private String tailInfo;
+    /**
+     * 原文件名称
+     */
+    @TableField(value = "original_file")
+    private String originalFile;
+    /**
+     * 转换后的文件名称(原文件名加密)
+     */
+    @TableField(value = "converted_file")
+    private String convertedFile;
+    /**
+     * 文件保存路径
+     */
+    @TableField(value = "file_url")
+    private String fileUrl;
+    /**
+     * 表格类型:1-赢时胜,2-恒生,3-金证
+     */
+    @TableField(value = "table_type")
+    private Integer tableType;
+    /**
+     * 是否完成分析:1-完成,0-未完成
+     */
+    @TableField(value = "is_analyzed")
+    private Integer isAnalyzed;
+    /**
+     * 估值表导入的总市值
+     */
+    @TableField(value = "total_market_value")
+    private BigDecimal totalMarketValue;
+    /**
+     * 资产净值(单位:元)
+     */
+    @TableField(value = "net_assets_value")
+    private BigDecimal netAssetsValue;
+    /**
+     * 估值增值
+     */
+    @TableField(value = "increment")
+    private Integer increment;
+    /**
+     * 估值表来源:1-邮件
+     */
+    @TableField(value = "from_email")
+    private Integer fromEmail;
+    /**
+     * 是否包含股票:0-否,1-是
+     */
+    @TableField(value = "has_stock")
+    private Integer hasStock;
+    /**
+     * 是否包含债券:0-否,1-是
+     */
+    @TableField(value = "has_bond")
+    private Integer hasBond;
+    /**
+     * 是否包含期货:0-否,1-是
+     */
+    @TableField(value = "has_future")
+    private Integer hasFuture;
+    /**
+     * 是否有效:0-无效,1-有效
+     */
+    @TableField(value = "isvalid")
+    private Integer isvalid;
+    /**
+     * 创建者Id
+     */
+    @TableField(value = "creatorid")
+    private Integer creatorId;
+    /**
+     * 创建时间
+     */
+    @TableField(value = "createtime")
+    private Date createTime;
+    /**
+     * 修改者Id
+     */
+    @TableField(value = "updaterid")
+    private Integer updaterId;
+    /**
+     * 更新时间
+     */
+    @TableField(value = "updatetime")
+    private Date updateTime;
+}

+ 32 - 0
service-base/src/main/resources/mapper/FundPositionDetailMapper.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.simuwang.base.mapper.FundPositionDetailMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FundPositionDetailDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="valuation_date" property="valuationDate"/>
+        <result column="level" property="level"/>
+        <result column="currency" property="currency"/>
+        <result column="exchange_rate " property="exchangeRate"/>
+        <result column="subject_code" property="subjectCode"/>
+        <result column="securities_code" property="securitiesCode"/>
+        <result column="securities_name" property="securitiesName"/>
+        <result column="sec_type" property="secType"/>
+        <result column="securities_amount" property="securitiesAmount"/>
+        <result column="market_value" property="marketValueRatio"/>
+        <result column="market_value_ratio" property="marketValue"/>
+        <result column="market_price" property="marketPrice"/>
+        <result column="nature" property="nature"/>
+        <result column="subject_type" property="subjectType"/>
+        <result column="increment" property="increment"/>
+        <result column="halt_info" property="haltInfo"/>
+        <result column="net_cost" property="netCost"/>
+        <result column="net_cost_ratio" property="netCostRatio"/>
+        <result column="unit_cost" property="unitCost"/>
+        <result column="isvalid" property="isvalid"/>
+        <result column="creatorid" property="creatorId"/>
+        <result column="createtime" property="createTime"/>
+    </resultMap>
+
+
+</mapper>

+ 22 - 0
service-base/src/main/resources/mapper/PdfValuationRecordMapper.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.simuwang.base.mapper.PdfValuationRecordMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.PdfValuationRecordDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="upload_date" property="uploadDate"/>
+        <result column="file_name" property="fileName"/>
+        <result column="pdf_url" property="pdfUrl"/>
+        <result column="excel_url" property="excelUrl"/>
+        <result column="from_email" property="fromEmail"/>
+        <result column="is_success" property="isSuccess"/>
+        <result column="reason" property="reason"/>
+        <result column="isvalid" property="isvalid"/>
+        <result column="creatorid" property="creatorId"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updaterid" property="updaterId"/>
+        <result column="updatetime" property="updateTime"/>
+    </resultMap>
+
+
+</mapper>

+ 17 - 0
service-base/src/main/resources/mapper/ValuationMarketCodeMapper.xml

@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.simuwang.base.mapper.ValuationMarketCodeMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.ValuationMarketCodeDO">
+        <id column="id" property="id"/>
+        <result column="market_code" property="marketCode"/>
+        <result column="market_name" property="marketName"/>
+        <result column="sort_id" property="sortId"/>
+        <result column="isvalid" property="isvalid"/>
+        <result column="creatorid" property="creatorId"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updaterid" property="updaterId"/>
+        <result column="updatetime" property="updateTime"/>
+    </resultMap>
+
+
+</mapper>

+ 33 - 0
service-base/src/main/resources/mapper/ValuationTableMapper.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.simuwang.base.mapper.ValuationTableMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.ValuationTableDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="title" property="title"/>
+        <result column="valuation_date" property="valuationDate"/>
+        <result column="head_info" property="headInfo"/>
+        <result column="tail_info" property="tailInfo"/>
+        <result column="original_file" property="originalFile"/>
+        <result column="converted_file" property="convertedFile"/>
+        <result column="file_url" property="fileUrl"/>
+        <result column="table_type" property="tableType"/>
+        <result column="is_analyzed" property="isAnalyzed"/>
+        <result column="total_market_value" property="totalMarketValue"/>
+        <result column="net_assets_value" property="netAssetsValue"/>
+        <result column="nav" property="nav"/>
+        <result column="increment" property="increment"/>
+        <result column="from_email" property="fromEmail"/>
+        <result column="has_stock" property="hasStock"/>
+        <result column="has_bond" property="hasBond"/>
+        <result column="has_future" property="hasFuture"/>
+        <result column="isvalid" property="isvalid"/>
+        <result column="creatorid" property="creatorId"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updaterid" property="updaterId"/>
+        <result column="updatetime" property="updateTime"/>
+    </resultMap>
+
+
+
+</mapper>

+ 27 - 0
service-daq/src/main/java/com/simuwang/daq/service/ValuationEmailParser.java

@@ -0,0 +1,27 @@
+package com.simuwang.daq.service;
+
+import cn.hutool.core.collection.CollUtil;
+import com.simuwang.base.pojo.dto.EmailContentInfoDTO;
+import com.simuwang.base.pojo.dto.EmailFundNavDTO;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author mozuwen
+ * @date 2024-09-12
+ * @description 估值表邮件解析器
+ */
+@Component
+public class ValuationEmailParser extends AbstractEmailParser {
+
+    @Override
+    public List<EmailFundNavDTO> parse(EmailContentInfoDTO emailContentInfoDTO, Map<String, List<String>> emailFieldMap) {
+        List<EmailFundNavDTO> emailFundNavDTOList = CollUtil.newArrayList();
+
+
+        return emailFundNavDTOList;
+    }
+
+}