浏览代码

feat: 数据同步任务开发

chenjianhua 8 月之前
父节点
当前提交
de2ee7c13f
共有 44 个文件被更改,包括 4221 次插入5 次删除
  1. 18 0
      service-base/src/main/java/com/simuwang/base/mapper/core/CoreDistributionMapper.java
  2. 18 0
      service-base/src/main/java/com/simuwang/base/mapper/core/SrcNavMapper.java
  3. 2 0
      service-base/src/main/java/com/simuwang/base/mapper/daq/DistributionMapper.java
  4. 9 0
      service-base/src/main/java/com/simuwang/base/mapper/daq/NavMapper.java
  5. 2 0
      service-base/src/main/java/com/simuwang/base/mapper/daq/system/SysConfigMapper.java
  6. 90 0
      service-base/src/main/java/com/simuwang/base/pojo/dos/core/CoreDistributionDO.java
  7. 92 0
      service-base/src/main/java/com/simuwang/base/pojo/dos/core/SrcNavDO.java
  8. 31 0
      service-base/src/main/resources/mapper/core/CoreDistributionMapper.xml
  9. 57 0
      service-base/src/main/resources/mapper/core/SrcNavMapper.xml
  10. 76 0
      service-base/src/main/resources/mapper/daq/AssetMapper.xml
  11. 117 0
      service-base/src/main/resources/mapper/daq/CompanyEmailConfigMapper.xml
  12. 168 0
      service-base/src/main/resources/mapper/daq/CompanyEmailHistoryMapper.xml
  13. 285 0
      service-base/src/main/resources/mapper/daq/DeletionInfoMapper.xml
  14. 150 0
      service-base/src/main/resources/mapper/daq/DistributionMapper.xml
  15. 25 0
      service-base/src/main/resources/mapper/daq/EmailFieldMappingMapper.xml
  16. 227 0
      service-base/src/main/resources/mapper/daq/EmailFileInfoMapper.xml
  17. 242 0
      service-base/src/main/resources/mapper/daq/EmailFundAssetMapper.xml
  18. 280 0
      service-base/src/main/resources/mapper/daq/EmailFundNavMapper.xml
  19. 62 0
      service-base/src/main/resources/mapper/daq/EmailFundNavService.xml
  20. 237 0
      service-base/src/main/resources/mapper/daq/EmailParseInfoMapper.xml
  21. 89 0
      service-base/src/main/resources/mapper/daq/EmailTaskInfoMapper.xml
  22. 66 0
      service-base/src/main/resources/mapper/daq/EmailTemplateApplicationRuleMapper.xml
  23. 61 0
      service-base/src/main/resources/mapper/daq/EmailTemplateDataRuleMapper.xml
  24. 79 0
      service-base/src/main/resources/mapper/daq/EmailTemplateInfoMapper.xml
  25. 102 0
      service-base/src/main/resources/mapper/daq/EmailTemplateMappingMapper.xml
  26. 31 0
      service-base/src/main/resources/mapper/daq/EmailTypeRuleMapper.xml
  27. 170 0
      service-base/src/main/resources/mapper/daq/FundAliasMapper.xml
  28. 23 0
      service-base/src/main/resources/mapper/daq/FundAliasService.xml
  29. 221 0
      service-base/src/main/resources/mapper/daq/FundInfoMapper.xml
  30. 95 0
      service-base/src/main/resources/mapper/daq/FundNavAssetMapper.xml
  31. 59 0
      service-base/src/main/resources/mapper/daq/FundPositionDetailMapper.xml
  32. 35 0
      service-base/src/main/resources/mapper/daq/FundReportFrequencyMapper.xml
  33. 68 0
      service-base/src/main/resources/mapper/daq/MailBoxInfoMapper.xml
  34. 136 0
      service-base/src/main/resources/mapper/daq/NavMapper.xml
  35. 34 0
      service-base/src/main/resources/mapper/daq/PdfValuationRecordMapper.xml
  36. 23 0
      service-base/src/main/resources/mapper/daq/TradeDateMapper.xml
  37. 53 0
      service-base/src/main/resources/mapper/daq/ValuationTableAttributeMapper.xml
  38. 72 0
      service-base/src/main/resources/mapper/daq/ValuationTableMapper.xml
  39. 137 0
      service-base/src/main/resources/mapper/daq/system/SysConfigMapper.xml
  40. 54 0
      service-base/src/main/resources/mapper/daq/system/SysLogMapper.xml
  41. 33 0
      service-base/src/main/resources/mapper/daq/system/SysRoleMapper.xml
  42. 205 0
      service-base/src/main/resources/mapper/daq/system/SysUserMapper.xml
  43. 27 5
      service-manage/src/main/java/com/simuwang/manage/init/CompleteScheduleConfig.java
  44. 160 0
      service-manage/src/main/java/com/simuwang/manage/task/DataSynchronizationTask.java

+ 18 - 0
service-base/src/main/java/com/simuwang/base/mapper/core/CoreDistributionMapper.java

@@ -0,0 +1,18 @@
+package com.simuwang.base.mapper.core;
+
+import com.simuwang.base.pojo.dos.core.CoreDistributionDO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * FileName: CoreDistributionMapper
+ * Author:   chenjianhua
+ * Date:     2024/10/25 17:18
+ * Description: ${DESCRIPTION}
+ */
+@Mapper
+public interface CoreDistributionMapper {
+    void saveCoreDistribution(@Param("list") List<CoreDistributionDO> coreDistributionDOList);
+}

+ 18 - 0
service-base/src/main/java/com/simuwang/base/mapper/core/SrcNavMapper.java

@@ -0,0 +1,18 @@
+package com.simuwang.base.mapper.core;
+
+import com.simuwang.base.pojo.dos.core.SrcNavDO;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * FileName: SrcNavMapper
+ * Author:   chenjianhua
+ * Date:     2024/10/25 11:20
+ * Description: ${DESCRIPTION}
+ */
+@Mapper
+public interface SrcNavMapper {
+    public void saveSrcNav(@Param("list") List<SrcNavDO> srcNavDOList);
+}

+ 2 - 0
service-base/src/main/java/com/simuwang/base/mapper/daq/DistributionMapper.java

@@ -39,4 +39,6 @@ public interface DistributionMapper {
     BigDecimal getSumDistributeByFundId(@Param("fundId")String fundId,@Param("distributeDate") String distributeDate);
 
     Long countDistributionTotal();
+
+    List<DistributionDO> selectDistributeListByTime(@Param("startDate") String startDate, @Param("endDate")String endDate);
 }

+ 9 - 0
service-base/src/main/java/com/simuwang/base/mapper/daq/NavMapper.java

@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 @Mapper
 public interface NavMapper {
@@ -30,4 +31,12 @@ public interface NavMapper {
     void batchDeleteNav(@Param("fundId")String sourceFundId, @Param("priceDateList")List<String> priceDateList);
 
     Long countNavTotal();
+
+    long countNavByTime(@Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    List<NavDO> selectNavListByTime(@Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    Map<String, Long> selectMaxMinId(@Param("startDate")String startDate, @Param("endDate")String endDate);
+
+    List<NavDO> selectNavListById(@Param("minId") Long minId,@Param("maxId") Long maxId, @Param("startDate")String startDate, @Param("endDate")String endDate);
 }

+ 2 - 0
service-base/src/main/java/com/simuwang/base/mapper/daq/system/SysConfigMapper.java

@@ -84,4 +84,6 @@ public interface SysConfigMapper {
     String selectConfigByKey(@Param("configKey") String configKey);
 
     long countConfigList(ConfigPageQuery query);
+
+    void updateConfigByKey(SysConfigDO sysConfigDO);
 }

+ 90 - 0
service-base/src/main/java/com/simuwang/base/pojo/dos/core/CoreDistributionDO.java

@@ -0,0 +1,90 @@
+package com.simuwang.base.pojo.dos.core;
+import lombok.Data;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * FileName: CoreDistributionDO
+ * Author:   chenjianhua
+ * Date:     2024/10/25 16:54
+ * Description: ${DESCRIPTION}
+ */
+@Data
+public class CoreDistributionDO {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 基金ID
+     */
+    private String fundId;
+    /**
+     * 分红日期
+     */
+    private Date distributeDate;
+    /**
+     * 基金分配类型标志:-1-其他,1-分红,2-拆分,3-业绩报酬,4-注资,5-撤资
+     */
+    private Integer distributeType;
+    /**
+     * 现金分红发放日
+     */
+    private Date executeDate;
+    /**
+     * 分红方式:1-现金分红 2-分红再投 3-同时支持(现金分红和分红再投)
+     */
+    private Integer distributeMethod;
+    /**
+     * 红利再投资日
+     */
+    private Date reinvestDate;
+    /**
+     * 除息日
+     */
+    private Date exDistributeDate;
+    /**
+     * 收益分配基准日
+     */
+    private Date profitDistributeDate;
+    /**
+     * 权益登记日
+     */
+    private Date registrationDate;
+    /**
+     * 分红/拆分比例
+     */
+    private BigDecimal distribution;
+    /**
+     * 数据来源:1-公告 2-计算
+     */
+    private BigDecimal sourceType;
+    /**
+     * 来源ID
+     */
+    private Integer sourceId;
+    /**
+     * 来源表名
+     */
+    private String sourceTable;
+    /**
+     * 有效标识
+     */
+    private Integer isvalid;
+    /**
+     * 创建者Id
+     */
+    private Integer creatorId;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改者Id
+     */
+    private Integer updaterId;
+    /**
+     * 更新时间
+     */
+    private Date updateTime;
+}

+ 92 - 0
service-base/src/main/java/com/simuwang/base/pojo/dos/core/SrcNavDO.java

@@ -0,0 +1,92 @@
+package com.simuwang.base.pojo.dos.core;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * FileName: SrcNavDO
+ * Author:   chenjianhua
+ * Date:     2024/10/25 11:27
+ * Description: ${DESCRIPTION}
+ */
+@Data
+@TableName("src_nav")
+public class SrcNavDO {
+    /**
+     * ID
+     */
+    @TableField(value = "id")
+    private Integer id;
+    /**
+     * 基金ID
+     */
+    @TableField(value = "fund_id")
+    private String fundId;
+    /**
+     * 基金净值日期
+     */
+    @TableField(value = "price_date")
+    private Date priceDate;
+    /**
+     * 单位净值
+     */
+    @TableField(value = "nav")
+    private BigDecimal nav;
+    /**
+     * 累计净值
+     */
+    @TableField(value = "cumulative_nav_crawl")
+    private BigDecimal cumulativeNavCrawl;
+    /**
+     * 备注
+     */
+    @TableField(value = "nav_mark")
+    private String navMark;
+    /**
+     * 修改者Id;第一次创建时与Creator值相同,修改时与修改人值相同
+     */
+    @TableField(value = "source_id")
+    private Integer sourceId;
+    /**
+     * 是否可见
+     */
+    @TableField(value = "isvisible")
+    private Integer isvisible;
+    /**
+     * 目标应用
+     */
+    @TableField(value = "app_type")
+    private Integer appType;
+    /**
+     * 净值来源:1-托管 2-私募报送 3-托管用印(私募转送)
+     */
+    @TableField(value = "nav_source")
+    private Integer navSource;
+
+    @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;
+}

+ 31 - 0
service-base/src/main/resources/mapper/core/CoreDistributionMapper.xml

@@ -0,0 +1,31 @@
+<?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.core.CoreDistributionMapper">
+    <update id="saveCoreDistribution" parameterType="java.util.List">
+        MERGE INTO RZ_HFDB_CORE.distribution t2
+        USING(
+        <foreach collection="list" item="distribute" index="index" separator="union all">
+            SELECT
+            #{distribute.distributeDate} DISTRIBUTE_DATE,
+            #{distribute.distributeType} DISTRIBUTE_TYPE,
+            #{distribute.distribution} DISTRIBUTION,
+            #{distribute.fundId} FUND_ID,
+            #{distribute.isvalid} ISVALID,
+            #{distribute.creatorId} CREATORID,
+            #{distribute.createTime} CREATETIME,
+            #{distribute.updaterId} UPDATERID,
+            #{distribute.updateTime} UPDATETIME
+            from DUAL
+        </foreach>
+        )t1
+        ON (t2.fund_id=t1.fund_id)
+        WHEN MATCHED THEN
+        UPDATE SET
+        t2.DISTRIBUTE_TYPE=t1.DISTRIBUTE_TYPE,t2.DISTRIBUTION=t1.DISTRIBUTION,t2.isvalid=t1.isvalid,t2.creatorid=t1.creatorid,t2.createtime=t1.createtime,
+        t2.updaterid=t1.updaterid,t2.updatetime=t1.updatetime where t2.fund_id=t1.fund_id and t2.distribute_date=t1.distribute_date
+        WHEN NOT MATCHED THEN
+        INSERT (t2.DISTRIBUTION,t2.DISTRIBUTE_TYPE,t2.FUND_ID,t2.DISTRIBUTE_DATE,t2.isvalid,t2.creatorid,t2.createtime,t2.updaterid,t2.updatetime)
+        VALUES
+        (t1.DISTRIBUTION,t1.DISTRIBUTE_TYPE,t1.FUND_ID,t1.DISTRIBUTE_DATE,t1.isvalid,t1.creatorid,t1.createtime,t1.updaterid,t1.updatetime)
+    </update>
+</mapper>

+ 57 - 0
service-base/src/main/resources/mapper/core/SrcNavMapper.xml

@@ -0,0 +1,57 @@
+<?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.core.SrcNavMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.core.SrcNavDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="price_date" property="priceDate"/>
+        <result column="nav" property="nav"/>
+        <result column="cumulative_nav_crawl" property="cumulativeNavCrawl"/>
+        <result column="source_id" property="sourceId"/>
+        <result column="nav_source" property="navSource"/>
+        <result column="app_type" property="appType"/>
+        <result column="isvisible" property="isvisible"/>
+        <result column="nav_mark" property="navMark"/>
+        <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>
+    <update id="saveSrcNav" parameterType="java.util.List">
+        MERGE INTO RZ_HFDB_CORE.src_nav t2
+        USING(
+        <foreach collection="list" item="nav" index="index" separator="union all">
+            SELECT
+            #{nav.fundId} fund_id,
+            #{nav.priceDate} price_date,
+            #{nav.nav} nav,
+            #{nav.cumulativeNavCrawl} cumulative_nav_crawl,
+            #{nav.sourceId} source_id,
+            #{nav.navSource} nav_source,
+            #{nav.appType} app_type,
+            #{nav.isvisible} isvisible,
+            #{nav.navMark} nav_mark,
+            #{nav.isvalid} isvalid,
+            #{nav.creatorId} creatorid,
+            #{nav.createTime} createtime,
+            #{nav.updaterId} updaterid,
+            #{nav.updateTime} updatetime
+            from DUAL
+        </foreach>
+        )t1
+        ON (t2.fund_id=t1.fund_id)
+        WHEN MATCHED THEN
+        UPDATE SET
+        t2.nav=t1.nav,t2.cumulative_nav_crawl=t1.cumulative_nav_crawl,
+        t2.source_id=t1.source_id,t2.nav_source=t1.nav_source,t2.app_type=t1.app_type,t2.isvisible=t1.isvisible,
+        t2.nav_mark=t1.nav_mark,t2.isvalid=t1.isvalid,t2.creatorid=t1.creatorid,t2.createtime=t1.createtime,
+        t2.updaterid=t1.updaterid,t2.updatetime=t1.updatetime where t2.fund_id=t1.fund_id and t2.price_date=t1.price_date
+        WHEN NOT MATCHED THEN
+        INSERT (t2.fund_id,t2.price_date,t2.nav,t2.cumulative_nav_crawl,t2.source_id,t2.nav_source,t2.app_type,t2.isvisible,
+        t2.nav_mark,t2.isvalid,t2.creatorid,t2.createtime,t2.updaterid,t2.updatetime)
+        VALUES
+        (t1.fund_id,t1.price_date,t1.nav,t1.cumulative_nav_crawl,t1.source_id,t1.nav_source,t1.app_type,t1.isvisible,
+        t1.nav_mark,t1.isvalid,t1.creatorid,t1.createtime,t1.updaterid,t1.updatetime)
+    </update>
+</mapper>

+ 76 - 0
service-base/src/main/resources/mapper/daq/AssetMapper.xml

@@ -0,0 +1,76 @@
+<?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.daq.AssetMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.AssetDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="price_date" property="priceDate"/>
+        <result column="asset_net" property="assetNet"/>
+        <result column="asset_share" property="assetShare"/>
+        <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>
+
+    <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.AssetDO">
+        insert into PPW_EMAIL.asset(fund_id,price_date,asset_net,asset_share,
+                                              isvalid, creatorid, createtime, updaterid, updatetime)
+        values
+        <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
+            (#{itemDo.fundId},#{itemDo.priceDate},#{itemDo.assetNet},#{itemDo.assetShare},
+            #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+        </foreach>
+    </insert>
+
+    <insert id="batchUpdate">
+        <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
+            update PPW_EMAIL.asset
+            <set>
+                asset_net = #{itemDo.assetNet},
+                asset_share = #{itemDo.assetShare},
+                updatetime=#{itemDo.updateTime}
+            </set>
+            where isvalid = 1
+            and fund_id = #{itemDo.fundId}
+            and price_date = #{itemDo.priceDate}
+        </foreach>
+    </insert>
+    <delete id="deleteAsset">
+        update PPW_EMAIL.asset set isvalid=0,updatetime=sysdate(),updaterid=#{updaterId}  where fund_id=#{fundId} and price_date=#{priceDate}
+    </delete>
+    <delete id="batchDeleteAsset">
+        update PPW_EMAIL.asset set isvalid=0,updatetime=sysdate() where fund_id=#{fundId}
+        and price_date in
+        <foreach collection="priceDateList" index="index" item="priceDate" separator="," open="(" close=")">
+            #{priceDate}
+        </foreach>
+    </delete>
+
+    <select id="queryFundNavByDate" resultType="java.lang.String">
+        select price_date
+        from PPW_EMAIL.asset
+        where isvalid = 1
+        and fund_id = #{fundId}
+        and price_date in
+        <foreach collection="priceDateList" index="index" item="priceDate" separator="," open="(" close=")">
+            #{priceDate}
+        </foreach>
+    </select>
+    <select id="queryFundAsset" resultMap="BaseResultMap"
+            parameterType="com.simuwang.base.pojo.dos.AssetDO">
+        select id,fund_id,price_date,asset_net,asset_share,
+               isvalid, creatorid, createtime, updaterid, updatetime
+        from PPW_EMAIL.asset where isvalid=1 and fund_id=#{fundId} and price_date=#{priceDate}
+    </select>
+    <select id="selectAssetByFundId" resultMap="BaseResultMap">
+        select id,fund_id,price_date,asset_net,asset_share,
+               isvalid, creatorid, createtime, updaterid, updatetime
+        from PPW_EMAIL.asset where isvalid=1 and fund_id=#{fundId}
+    </select>
+    <select id="countAssetTotal" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.asset where isvalid=1
+    </select>
+
+</mapper>

+ 117 - 0
service-base/src/main/resources/mapper/daq/CompanyEmailConfigMapper.xml

@@ -0,0 +1,117 @@
+<?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.daq.CompanyEmailConfigMapper">
+    <insert id="saveCompanyEmailConfig">
+        insert into PPW_EMAIL.company_email_config(
+        <if test="companyId != null and companyId != ''">company_id,</if>
+        <if test="companyName != null and companyName != ''">company_name,</if>
+        <if test="email != null and email != ''">email,</if>
+        <if test="openStatus != null">open_status,</if>
+        <if test="remark != null and remark != ''">remark,</if>
+        <if test="creatorId != null and creatorId != ''">creatorid,</if>
+        <if test="updaterId != null and updaterId != ''">updaterId,</if>
+        isvalid,
+        createtime,
+        updatetime
+        )values(
+        <if test="companyId != null and companyId != ''">#{companyId},</if>
+        <if test="companyName != null and companyName != ''">#{companyName},</if>
+        <if test="email != null and email != ''">#{email},</if>
+        <if test="openStatus != null">#{openStatus},</if>
+        <if test="remark != null and remark != ''">#{remark},</if>
+        <if test="creatorId != null and creatorId != ''">#{creatorId},</if>
+        <if test="updaterId != null and updaterId != ''">#{updaterId},</if>
+        1,
+        sysdate(),
+        sysdate()
+        )
+    </insert>
+
+    <update id="updateCompanyEmailConfig">
+        update PPW_EMAIL.company_email_config
+        <set>
+            <if test="companyId != null and companyId != ''">company_id=#{companyId},</if>
+            <if test="companyName != null and companyName != ''">company_name=#{companyName},</if>
+            <if test="email != null and email != ''">email=#{email},</if>
+            <if test="openStatus != null">open_status=#{openStatus},</if>
+            <if test="remark != null and remark != ''">remark=#{remark},</if>
+            <if test="updaterId != null and updaterId != ''">updaterid=#{updaterId},</if>
+            <if test="updateTime != null">updatetime=#{updateTime},</if>
+        </set>
+        where id = #{id} and isvalid=1
+    </update>
+
+    <update id="deleteCompanyEmailConfig">
+        update PPW_EMAIL.company_email_config set isvalid =0,updatetime=sysdate(),updaterid=#{updaterId} where id=#{id}
+    </update>
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.CompanyEmailConfigDO">
+        <id column="id" property="id"/>
+        <result column="company_id" property="companyId"/>
+        <result column="company_name" property="companyName"/>
+        <result column="email" property="email"/>
+        <result column="open_status" property="openStatus"/>
+        <result column="remark" property="remark"/>
+        <result column="creatorid" property="creatorId"/>
+        <result column="updaterid" property="updaterId"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updatetime" property="updateTime"/>
+        <result column="isvalid" property="isvalid"/>
+    </resultMap>
+    <sql id="selectCompanyEmailConfigDo">
+        select id,company_id, company_name, email, open_status,remark, creatorid, createtime, updaterid, updatetime,isvalid
+        from PPW_EMAIL.company_email_config
+    </sql>
+    <!-- 查询条件 -->
+    <sql id="sqlwhereSearch">
+        <where>
+            isvalid=1
+            <if test="id !=null">
+                and id = #{id}
+            </if>
+        </where>
+    </sql>
+    <select id="selectCompanyEmailConfigById" resultMap="BaseResultMap">
+        <include refid="selectCompanyEmailConfigDo"/>
+        <include refid="sqlwhereSearch"/>
+    </select>
+    <select id="searchEmailByCompanyId" resultType="java.lang.String" parameterType="java.lang.String">
+        select email from PPW_EMAIL.company_email_config where company_id = #{companyId} and isvalid =1
+    </select>
+
+    <resultMap id="BaseVOMap" type="com.simuwang.base.pojo.vo.CompanyEmailConfigVO">
+        <id column="id" property="id"/>
+        <result column="company_id" property="companyId"/>
+        <result column="company_name" property="companyName"/>
+        <result column="email" property="email"/>
+        <result column="open_status" property="openStatus"/>
+        <result column="remark" property="sendRemark"/>
+    </resultMap>
+    <select id="searchEmailConfig" resultMap="BaseVOMap">
+        select id,company_id,company_name,email,open_status,remark from
+         PPW_EMAIL.company_email_config where isvalid =1 and company_id=#{companyId}
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countEmailConfig" resultType="java.lang.Long" parameterType="java.lang.String">
+        select count(1) from PPW_EMAIL.company_email_config where isvalid =1 and company_id=#{companyId}
+    </select>
+    <select id="searchEmailConfigByCompanyId" resultMap="BaseVOMap">
+        select id,company_id,company_name,email,open_status,remark from
+            PPW_EMAIL.company_email_config where isvalid =1 and company_id=#{companyId}
+    </select>
+    <select id="selectEmailConfig"  resultMap="BaseResultMap">
+        select id,company_id,company_name,email,open_status,remark from
+            PPW_EMAIL.company_email_config where isvalid =1 and company_id=#{companyId} and email=#{email} limit 1
+    </select>
+    <select id="getAllCompanyConfig" resultMap="BaseResultMap">
+        select id,company_id,company_name,email,open_status,remark from
+            PPW_EMAIL.company_email_config where isvalid =1 and open_status=1
+    </select>
+    <select id="selectCompanyEmailConfigByIdList" resultMap="BaseResultMap">
+        select id,company_id,company_name,email,open_status,remark from
+            PPW_EMAIL.company_email_config where isvalid =1 and open_status=1
+        and id in
+        <foreach item="id" collection="idList" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+</mapper>

+ 168 - 0
service-base/src/main/resources/mapper/daq/CompanyEmailHistoryMapper.xml

@@ -0,0 +1,168 @@
+<?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.daq.CompanyEmailSendHistoryMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.CompanyEmailSendHistoryDO">
+        <id column="id" property="id"/>
+        <result column="company_id" property="companyId"/>
+        <result column="company_name" property="companyName"/>
+        <result column="email" property="email"/>
+        <result column="send_status" property="sendStatus"/>
+        <result column="send_time" property="sendTime"/>
+        <result column="send_remark" property="sendRemark"/>
+        <result column="isvalid" property="isvalid"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updatetime" property="updateTime"/>
+        <result column="creatorid" property="creatorId"/>
+        <result column="updaterid" property="updaterId"/>
+    </resultMap>
+    <insert id="saveCompanyEmailSendHistory"
+            parameterType="com.simuwang.base.pojo.dos.CompanyEmailSendHistoryDO">
+        insert into PPW_EMAIL.company_email_send_history(company_id,email,send_status,send_time,send_remark,isvalid,createtime,updatetime,creatorid,updaterid)
+        values (#{companyId},#{email},#{sendStatus},#{sendTime},#{sendRemark},#{isvalid},#{createTime},#{updateTime},#{creatorId},#{updaterId})
+    </insert>
+    <update id="deleteEmailHistory">
+        update PPW_EMAIL.company_email_send_history set isvalid =0,updatetime=sysdate() where email in
+        <foreach item="email" collection="emailList" open="(" separator="," close=")">
+            #{email}
+        </foreach>
+    </update>
+    <update id="deleteEmailHistoryByIds">
+        update PPW_EMAIL.company_email_send_history set isvalid =0,updatetime=sysdate(),updaterid=#{userId} where id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <select id="searchCompanyEmailList" resultMap="BaseResultMap">
+        SELECT
+            cec.id,
+            cec.company_id,
+            c.company_name,
+            cec.email,
+            maxce.send_time as send_time,
+            maxce.send_remark,
+            ifnull(maxce.send_status,-1) as send_status
+        FROM
+        PPW_EMAIL.company_email_config cec
+        JOIN PPW_EMAIL.pvn_company_info c
+        ON cec.company_id = c.company_id
+        LEFT JOIN
+        (SELECT
+        me.email AS email,
+        me.send_time AS send_time,
+        me.company_id,
+        me.send_remark,
+        me.send_status
+        FROM
+        PPW_EMAIL.company_email_send_history me
+        join (select mx.company_id,mx.email,max(mx.send_time) as max_send_time from PPW_EMAIL.company_email_send_history mx where mx.isvalid=1
+        GROUP BY mx.email,
+        mx.company_id) as mx on me.email=mx.email and me.company_id=mx.company_id and me.send_time=mx.max_send_time
+        WHERE me.isvalid = 1) maxce
+        ON cec.email = maxce.email and cec.company_id = maxce.company_id
+        WHERE cec.isvalid = 1 and c.isvalid=1
+        <if test="companyName != null and companyName !=''">
+            and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%') or c.register_number like concat('%',#{companyName},'%'))
+        </if>
+        <if test="email != null and email !=''">
+            and cec.email like concat('%',#{email},'%')
+        </if>
+        <if test="sendStatus != null and sendStatus != -1">
+            and maxce.send_status=#{sendStatus}
+        </if>
+        <if test="sendStatus == -1">
+            and maxce.send_status is null
+        </if>
+        order by
+        CASE
+            WHEN send_time IS NULL THEN 1
+        ELSE 0
+        END,
+            send_time desc
+        limit #{offset},#{pageSize}
+    </select>
+
+    <select id="countCompanyEmailList" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.CompanyEmailPageQuery">
+        SELECT
+        count(cec.company_id)
+        from
+        PPW_EMAIL.company_email_config cec
+        JOIN PPW_EMAIL.pvn_company_info c
+        ON cec.company_id = c.company_id
+        LEFT JOIN
+        (SELECT
+        me.email AS email,
+        me.send_time AS send_time,
+        me.company_id,
+        me.send_remark,
+        me.send_status
+        FROM
+        PPW_EMAIL.company_email_send_history me
+        join (select mx.company_id,mx.email,max(mx.send_time) as max_send_time from PPW_EMAIL.company_email_send_history mx where mx.isvalid=1
+        GROUP BY mx.email,
+        mx.company_id) as mx on me.email=mx.email and me.company_id=mx.company_id and me.send_time=mx.max_send_time
+        WHERE me.isvalid = 1) maxce
+        ON cec.email = maxce.email and cec.company_id = maxce.company_id
+        WHERE cec.isvalid = 1 and c.isvalid=1
+        <if test="companyName != null and companyName !=''">
+            and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%') or c.register_number like concat('%',#{companyName},'%'))
+        </if>
+        <if test="email != null and email !=''">
+            and cec.email like concat('%',#{email},'%')
+        </if>
+        <if test="sendStatus != null and sendStatus != -1">
+            and maxce.send_status=#{sendStatus}
+        </if>
+        <if test="sendStatus == -1">
+            and maxce.send_status is null
+        </if>
+    </select>
+
+    <select id="searchEmailHistory" resultMap="BaseResultMap">
+        SELECT distinct
+        cesh.id,
+            cec.company_id,
+            c.company_name,
+            cesh.email,
+            cesh.send_time,
+            cesh.send_remark,
+            cesh.send_status
+        FROM
+            PPW_EMAIL.company_email_send_history cesh
+            JOIN PPW_EMAIL.company_email_config cec
+            ON cec.email = cesh.email
+            JOIN PPW_EMAIL.pvn_company_info c
+            ON cec.company_id = c.company_id
+        WHERE cec.isvalid = 1
+        AND cesh.isvalid = 1 and c.isvalid =1
+        <if test="companyId != null and companyId !=''">
+            and c.company_id=#{companyId}
+        </if>
+        <if test="email != null and email !=''">
+            and cesh.email=#{email}
+        </if>
+        order by cesh.send_time desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countCompanyEmailhistory" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.CompanyEmailHistoryPageQuery">
+        SELECT
+        count(distinct cesh.id)
+        FROM
+        PPW_EMAIL.company_email_send_history cesh
+        JOIN PPW_EMAIL.company_email_config cec
+        ON cec.email = cesh.email
+        JOIN PPW_EMAIL.pvn_company_info c
+        ON cec.company_id = c.company_id
+        WHERE cec.isvalid = 1
+        AND cesh.isvalid = 1 and c.isvalid =1
+        <if test="companyId != null and companyId !=''">
+            and c.company_id=#{companyId}
+        </if>
+        <if test="email != null and email !=''">
+            and cesh.email=#{email}
+        </if>
+    </select>
+
+</mapper>

+ 285 - 0
service-base/src/main/resources/mapper/daq/DeletionInfoMapper.xml

@@ -0,0 +1,285 @@
+<?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.daq.DeletionInfoMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.DeletionInfoDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="deletion_date" property="deletionDate"/>
+        <result column="deletion_type" property="deletionType"/>
+        <result column="company_name" property="companyName"/>
+        <result column="fund_name" property="fundName"/>
+        <result column="deletion_num" property="deletionNum"/>
+        <result column="processed_num" property="processedNum"/>
+        <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"/>
+        <result column="is_send" property="isSend"/>
+    </resultMap>
+    <insert id="saveDeletionInfoDO" parameterType="com.simuwang.base.pojo.dos.DeletionInfoDO">
+        insert into PPW_EMAIL.deletion_info(fund_id,deletion_type,deletion_date,isvalid,createtime,updatetime,is_send)
+        values (#{fundId},#{deletionType},#{deletionDate},#{isvalid},#{createTime},#{updateTime},#{isSend})
+    </insert>
+    <update id="update" parameterType="com.simuwang.base.pojo.dos.FundDeletionInfoDO">
+        update PPW_EMAIL.deletion_info set fund_id=#{fundId},deletion_type=#{deletionType},deletion_date=#{deletionDate},remark=#{remark},updatetime=#{updateTime}
+        where id=#{id} and isvalid=1
+    </update>
+    <update id="batchUpdate">
+        <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
+            update PPW_EMAIL.deletion_info
+            <set>
+                fund_id=#{itemDo.fundId},
+                deletion_type = #{itemDo.deletionType},
+                deletion_date=#{itemDo.deletionDate},
+                remark=#{itemDo.remark},
+                updatetime=sysdate(),
+                updaterid=#{itemDo.updaterId}
+            </set>
+            where isvalid = 1 and id=#{itemDo.id}
+        </foreach>
+    </update>
+    <update id="updateRemark">
+        update PPW_EMAIL.deletion_info set remark=#{remark},updaterid=#{updaterId} where isvalid=1 and remark is null
+        <if test="fundId != null and fundId !=''">
+            and fund_id=#{fundId}
+        </if>
+        <if test="deletionType != null and deletionType !=''">
+            and deletion_type=#{deletionType}
+        </if>
+        <if test="deletionDate != null and deletionDate !=''">
+            and deletion_date=#{deletionDate}
+        </if>
+    </update>
+    <delete id="deleteDeletionRemark">
+        update PPW_EMAIL.deletion_info  set isvalid=0,updatetime=sysdate() where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType}
+        <if test="tradeDate != null and tradeDate !=''">
+            and deletion_date=#{tradeDate}
+        </if>
+    </delete>
+    <delete id="deleteDeletion">
+        update PPW_EMAIL.deletion_info  set isvalid=0,updatetime=sysdate() where isvalid=1 and fund_id=#{fundId} and deletion_type=#{deletionType} and remark is null
+    </delete>
+    <select id="searchDeletionList" resultMap="BaseResultMap"
+            parameterType="com.simuwang.base.pojo.dto.query.DeletionPageQuery">
+        SELECT distinct
+        d.fund_id,
+        info.fund_name,
+        c.company_name,
+        d.deletion_type,
+        ddn.deletion_num,
+        ddp.processed_num
+        FROM
+        PPW_EMAIL.deletion_info d
+        LEFT JOIN PPW_EMAIL.pvn_fund_info info
+        ON d.fund_id = info.fund_id and info.isvalid=1
+        LEFT JOIN PPW_EMAIL.pvn_company_info c
+        ON info.trust_id = c.company_id and c.isvalid=1
+        LEFT JOIN
+        (SELECT
+        di.fund_id,
+        di.deletion_type,
+        COUNT(di.fund_id) AS deletion_num
+        FROM
+        PPW_EMAIL.deletion_info di
+        WHERE di.isvalid = 1
+        AND di.remark IS NULL
+        GROUP BY di.fund_id,
+        di.deletion_type) ddn
+        ON ddn.fund_id = d.fund_id
+        AND d.deletion_type = ddn.deletion_type
+        LEFT JOIN
+        (SELECT
+        dip.fund_id,
+        dip.deletion_type,
+        COUNT(dip.fund_id) AS processed_num
+        FROM
+        PPW_EMAIL.deletion_info dip
+        WHERE dip.isvalid = 1
+        AND dip.remark IS NOT NULL
+        GROUP BY dip.fund_id,
+        dip.deletion_type) ddp
+        ON ddp.fund_id = d.fund_id
+        AND d.deletion_type = ddp.deletion_type
+        WHERE d.isvalid = 1
+        <if test="companyName != null and companyName !=''">
+            and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
+        </if>
+        <if test="fundName != null and fundName !=''">
+            and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%') or info.fund_id like concat('%',#{fundName},'%'))
+        </if>
+        <if test="deletionType != null and deletionType != -1">
+            and d.deletion_type=#{deletionType}
+        </if>
+        <if test="deletionStartNum != null and deletionStartNum != ''">
+            and ddn.deletion_num >= #{deletionStartNum}
+        </if>
+        <if test="deletionEndNum != null and deletionEndNum != ''">
+            and ddn.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
+        </if>
+        group by d.fund_id,d.deletion_type
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countDeletion" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.DeletionPageQuery">
+        select count(1) from (select distinct
+        d.fund_id,
+        info.fund_name,
+        c.company_name,
+        d.deletion_type,
+        ddn.deletion_num,
+        ddp.processed_num
+        FROM
+        PPW_EMAIL.deletion_info d
+        LEFT JOIN PPW_EMAIL.pvn_fund_info info
+        ON d.fund_id = info.fund_id and info.isvalid=1
+        LEFT JOIN PPW_EMAIL.pvn_company_info c
+        ON info.trust_id = c.company_id and c.isvalid=1
+        LEFT JOIN
+        (SELECT
+        di.fund_id,
+        di.deletion_type,
+        COUNT(di.fund_id) AS deletion_num
+        FROM
+        PPW_EMAIL.deletion_info di
+        WHERE di.isvalid = 1
+        AND di.remark IS NULL
+        GROUP BY di.fund_id,
+        di.deletion_type) ddn
+        ON ddn.fund_id = d.fund_id
+        AND d.deletion_type = ddn.deletion_type
+        LEFT JOIN
+        (SELECT
+        dip.fund_id,
+        dip.deletion_type,
+        COUNT(dip.fund_id) AS processed_num
+        FROM
+        PPW_EMAIL.deletion_info dip
+        WHERE dip.isvalid = 1
+        AND dip.remark IS NOT NULL
+        GROUP BY dip.fund_id,
+        dip.deletion_type) ddp
+        ON ddp.fund_id = d.fund_id
+        AND d.deletion_type = ddp.deletion_type
+        WHERE d.isvalid = 1
+        <if test="companyName != null and companyName !=''">
+            and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
+        </if>
+        <if test="fundName != null and fundName !=''">
+            and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%')  or info.fund_id like concat('%',#{fundName},'%'))
+        </if>
+        <if test="deletionType != null and deletionType != -1">
+            and d.deletion_type=#{deletionType}
+        </if>
+        <if test="deletionStartNum != null and deletionStartNum != ''">
+            and ddn.deletion_num >= #{deletionStartNum}
+        </if>
+        <if test="deletionEndNum != null and deletionEndNum != ''">
+            and ddn.deletion_num <![CDATA[ <= ]]> #{deletionEndNum}
+        </if>
+        group by d.fund_id,d.deletion_type) a
+    </select>
+    <select id="getLastDeletionDateByFundId" resultType="java.lang.String">
+        select max(deletion_date) from PPW_EMAIL.deletion_info where fund_id=#{fundId} and deletion_type=#{deletionType}
+    </select>
+
+    <resultMap id="BaseMap" type="com.simuwang.base.pojo.dos.FundDeletionInfoDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="fund_name" property="fundName"/>
+        <result column="deletion_date" property="deletionDate"/>
+        <result column="deletion_type" property="deletionType"/>
+        <result column="remark" property="remark"/>
+        <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>
+    <select id="searchFundDeletionList" resultMap="BaseMap"
+            parameterType="com.simuwang.base.pojo.dto.query.FundDeletionPageQuery">
+        SELECT
+            d.id,
+            d.fund_id,
+            info.fund_name,
+            d.deletion_type,
+            d.deletion_date,
+            d.remark,
+            d.isvalid,
+            d.creatorid,
+            d.updaterid,
+            d.createtime,
+            d.updatetime
+        FROM
+            PPW_EMAIL.deletion_info d
+        left join PPW_EMAIL.pvn_fund_info info
+        on d.fund_id =info.fund_id and info.isvalid=1
+        WHERE d.isvalid = 1
+          AND d.fund_id = #{fundId}
+          AND d.deletion_type = #{deletionType}
+        ORDER BY deletion_date DESC
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countFundDeletionList" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.FundDeletionPageQuery">
+        select count(d.id)
+        FROM
+            PPW_EMAIL.deletion_info d
+                left join PPW_EMAIL.pvn_fund_info info
+                          on d.fund_id =info.fund_id and info.isvalid=1
+        WHERE d.isvalid = 1
+          AND d.fund_id = #{fundId}
+          AND d.deletion_type = #{deletionType}
+        ORDER BY deletion_date DESC
+    </select>
+    <select id="selectFundDeletionInfoVOList" resultType="com.simuwang.base.pojo.dos.FundDeletionInfoDO"
+            parameterType="java.util.List">
+        select id,fund_id,deletion_type,deletion_date,remark,isvalid,creatorid,updaterid,createtime,updatetime
+        from PPW_EMAIL.deletion_info where isvalid=1 and remark is null
+        <if test="fundId != null and fundId !=''">
+            and fund_id = #{fundId}
+        </if>
+        <if test="deletionType != null">
+            and deletion_type=#{deletionType}
+        </if>
+        order by fund_id desc,deletion_type desc ,deletion_date desc
+    </select>
+    <select id="getDeletionInfoDO" resultType="com.simuwang.base.pojo.dos.DeletionInfoDO"
+            parameterType="com.simuwang.base.pojo.dos.DeletionInfoDO">
+        select id,fund_id,deletion_type,deletion_date,remark,isvalid,creatorid,updaterid,createtime,updatetime
+        from PPW_EMAIL.deletion_info where fund_id=#{fundId} and deletion_date=#{deletionDate} and deletion_type=#{deletionType} limit 1
+    </select>
+
+    <resultMap id="BaseEmailMap" type="com.simuwang.base.pojo.dos.EmailDeletionInfoDO">
+        <result column="fund_name" property="fundName"/>
+        <result column="company_name" property="companyName"/>
+        <result column="deletion_date" property="deletionDate"/>
+        <result column="deletion_type" property="deletionType"/>
+    </resultMap>
+    <select id="getDeletionInfoByFundId" resultType="com.simuwang.base.pojo.dos.EmailDeletionInfoDO">
+            select info.fund_name,c.company_name,d.deletion_type,d.deletion_date
+            from PPW_EMAIL.deletion_info d
+            join PPW_EMAIL.pvn_fund_info info on d.fund_id=info.fund_id
+            join PPW_EMAIL.pvn_company_info c on c.company_id=info.trust_id
+            where d.isvalid=1 and info.isvalid=1 and c.isvalid=1 and d.remark is null and d.is_send=0
+            and d.fund_id in
+            <foreach collection="fundIdList" index="index" item="fundId" separator="," open="(" close=")">
+                #{fundId}
+            </foreach>
+            order by info.fund_id desc,d.deletion_type desc,d.deletion_date desc
+    </select>
+    <update id="removeDistributeDeletion" parameterType="java.lang.String">
+        update PPW_EMAIL.deletion_info set isvalid=0,updatetime=sysdate() where fund_id=#{fundId} and remark is null
+    </update>
+    <update id="updateSendStatusByFundId">
+        update PPW_EMAIL.deletion_info d set is_send=1,updatetime=sysdate() where isvalid=1
+        and d.fund_id in
+        <foreach collection="fundIdList" index="index" item="fundId" separator="," open="(" close=")">
+            #{fundId}
+        </foreach>
+    </update>
+    <update id="updateDeletionInfoDO">
+        update PPW_EMAIL.deletion_info d set isvalid=1,updatetime=sysdate() where id=#{id}
+    </update>
+
+</mapper>

+ 150 - 0
service-base/src/main/resources/mapper/daq/DistributionMapper.xml

@@ -0,0 +1,150 @@
+<?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.daq.DistributionMapper">
+    <resultMap id="BaseMap" type="com.simuwang.base.pojo.dos.DistributionDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="distribute_date" property="distributeDate"/>
+        <result column="distribute_type" property="distributeType"/>
+        <result column="distribution" property="distribution"/>
+        <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>
+
+    <resultMap id="BasePageMap" type="com.simuwang.base.pojo.dos.DistributionTablePageDO">
+        <id column="id" property="id"/>
+        <result column="fund_name" property="fundName"/>
+        <result column="company_name" property="companyName"/>
+        <result column="register_number" property="registerNumber"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="distribute_date" property="distributeDate"/>
+        <result column="distribute_type" property="distributeType"/>
+        <result column="distribution" property="distribution"/>
+        <result column="nav" property="nav"/>
+        <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
+        <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>
+    <insert id="saveDistribution" parameterType="com.simuwang.base.pojo.dos.DistributionDO">
+        insert into PPW_EMAIL.distribution(fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid)
+        values (#{fundId},#{distributeDate},#{distributeType},#{distribution},#{isvalid},#{creatorId},#{createTime},#{updateTime},#{updaterId})
+    </insert>
+    <update id="updateDistributionById" parameterType="com.simuwang.base.pojo.dos.DistributionDO">
+        update PPW_EMAIL.distribution set distribute_date=#{distributeDate},distribute_type=#{distributeType},distribution=#{distribution},updatetime=#{updateTime},updaterid=#{updaterId}
+        where id=#{id} and isvalid =1
+    </update>
+    <delete id="deleteDistribution" parameterType="com.simuwang.base.pojo.vo.IdListVO">
+        update PPW_EMAIL.distribution set isvalid =0,updatetime=sysdate(),updaterid=#{updaterId} where isvalid =1 and id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+    <select id="searchDistributionList" resultMap="BasePageMap"
+            parameterType="com.simuwang.base.pojo.dto.query.DistributionPageQuery">
+        SELECT DISTINCT
+            d.id,
+            d.fund_id,
+            info.fund_name,
+            info.register_number,
+            c.company_name,
+            d.distribute_date,
+            d.distribute_type,
+            d.distribution,
+            n.nav,
+            n.cumulative_nav_withdrawal,
+            d.updatetime,
+            d.isvalid,
+            d.creatorid,
+            d.createtime,
+            d.updatetime
+        FROM
+            PPW_EMAIL.distribution d
+            JOIN PPW_EMAIL.pvn_fund_info info
+            ON d.fund_id = info.fund_id
+            left JOIN PPW_EMAIL.pvn_company_info c
+            ON info.trust_id = c.company_id AND c.isvalid = 1
+            JOIN PPW_EMAIL.nav n
+            ON n.fund_id = d.fund_id and d.distribute_date=n.price_date
+            AND n.isvalid = 1
+        WHERE d.isvalid = 1
+            AND info.isvalid = 1
+        <if test="companyName != null and companyName !=''">
+            and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
+        </if>
+        <if test="fundName != null and fundName !=''">
+            and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
+        </if>
+        <if test="distributeType != null">
+            and d.distribute_type = #{distributeType}
+        </if>
+        <if test="startDate != null and startDate !=''">
+            and d.distribute_date >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate !=''">
+            and d.distribute_date <![CDATA[ <= ]]> #{endDate}
+        </if>
+        order by d.updatetime desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countDistributionList" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.DistributionPageQuery">
+        select count(distinct d.id)
+        FROM
+        PPW_EMAIL.distribution d
+        JOIN PPW_EMAIL.pvn_fund_info info
+        ON d.fund_id = info.fund_id
+        left JOIN PPW_EMAIL.pvn_company_info c
+        ON info.trust_id = c.company_id AND c.isvalid = 1
+        JOIN PPW_EMAIL.nav n
+        ON n.fund_id = d.fund_id and d.distribute_date=n.price_date
+        WHERE d.isvalid = 1 AND info.isvalid = 1
+        AND n.isvalid = 1
+        <if test="companyName != null and companyName !=''">
+            and (c.company_name like concat('%',#{companyName},'%') or c.company_short_name like concat('%',#{companyName},'%'))
+        </if>
+        <if test="fundName != null and fundName !=''">
+            and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%'))
+        </if>
+        <if test="distributeType != null">
+            and d.distribute_type = #{distributeType}
+        </if>
+        <if test="startDate != null and startDate !=''">
+            and d.distribute_date >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate !=''">
+            and d.distribute_date <![CDATA[ <= ]]> #{endDate}
+        </if>
+    </select>
+    <select id="selectDistributionById" resultMap="BaseMap"
+            parameterType="java.lang.Integer">
+        select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
+        from PPW_EMAIL.distribution where isvalid =1 and id=#{id}
+    </select>
+    <select id="selectDistributionByDate" resultMap="BaseMap">
+        select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
+        from PPW_EMAIL.distribution where isvalid =1 and fund_id=#{fundId} and distribute_date=#{distributeDate}
+    </select>
+    <select id="getDistributionByFundId" resultMap="BaseMap">
+        select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
+        from PPW_EMAIL.distribution where isvalid =1 and fund_id=#{fundId} and distribute_type=#{distributeType}
+    </select>
+    <select id="getSumDistributeByFundId" resultType="java.math.BigDecimal" parameterType="java.lang.String">
+        select sum(distribution) from PPW_EMAIL.distribution where isvalid =1 and fund_id=#{fundId} and distribute_date <![CDATA[ <= ]]> #{distributeDate}
+    </select>
+    <select id="countDistributionTotal" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.distribution where isvalid =1
+    </select>
+    <select id="selectDistributeListByTime" resultMap="BaseMap">
+        select id,fund_id,distribute_date,distribute_type,distribution,isvalid,creatorid,createtime,updatetime,updaterid
+        from PPW_EMAIL.distribution where updatetime <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate !=''">
+            and updatetime >= #{startDate}
+        </if>
+    </select>
+</mapper>

+ 25 - 0
service-base/src/main/resources/mapper/daq/EmailFieldMappingMapper.xml

@@ -0,0 +1,25 @@
+<?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.daq.EmailFieldMappingMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailFieldMappingDO">
+        <id column="id" property="id"/>
+        <result column="code" property="code"/>
+        <result column="name" property="name"/>
+        <result column="type" property="type"/>
+        <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>
+
+    <select id="getEmailFieldMapping" resultMap="BaseResultMap">
+        select *
+        from PPW_EMAIL.email_field_mapping
+        where isvalid = 1
+        <if test="type != null">
+            and (TYPE = #{type} or TYPE = 0)
+        </if>
+    </select>
+
+</mapper>

+ 227 - 0
service-base/src/main/resources/mapper/daq/EmailFileInfoMapper.xml

@@ -0,0 +1,227 @@
+<?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.daq.EmailFileInfoMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailFileInfoDO">
+        <id column="id" property="id"/>
+        <result column="email_id" property="emailId"/>
+        <result column="file_name" property="fileName"/>
+        <result column="file_path" property="filePath"/>
+        <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>
+
+    <insert id="insert" parameterType="com.simuwang.base.pojo.dos.EmailFileInfoDO" useGeneratedKeys="true"
+            keyProperty="id" keyColumn="id">
+        insert into PPW_EMAIL.email_file_info(email_id, file_name, file_path,
+                                              isvalid, creatorid, createtime, updaterid, updatetime)
+        values (#{itemDo.emailId}, #{itemDo.fileName}, #{itemDo.filePath},
+                #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+    </insert>
+
+    <select id="getEmailFileById" resultMap="BaseResultMap"
+            parameterType="java.lang.Integer">
+        select id ,email_id, file_name, file_path,
+               isvalid, creatorid, createtime, updaterid, updatetime
+        from PPW_EMAIL.email_file_info where id=#{id} and isvalid=1
+    </select>
+
+    <select id="getEmailFileByEmailId" resultMap="BaseResultMap"
+            parameterType="java.lang.Integer">
+        select id ,email_id, file_name, file_path,
+               isvalid, creatorid, createtime, updaterid, updatetime
+        from PPW_EMAIL.email_file_info where email_id=#{emailId} and isvalid=1
+    </select>
+
+    <select id="queryByEmailId" resultMap="BaseResultMap">
+        select id, file_name, file_path
+        from PPW_EMAIL.email_file_info
+        where email_id = #{emailId}
+          and isvalid = 1
+    </select>
+    <select id="searchFundFileInfo" resultType="com.simuwang.base.pojo.vo.FundFileInfoVO">
+        SELECT DISTINCT efi.id as "fileId",
+        <if test="fileType != 3">
+            efn.fund_id as "fundId",
+            efn.fund_name as "fundName",
+        </if>
+        <if test="fileType == 3">
+            info.fund_id as "fundId",
+            efn.fund_name as "fundName",
+        </if>
+            efi.file_name as "fileName",
+            efi.file_path as "filePath",
+            efi.createtime as "createTime"
+        FROM
+            PPW_EMAIL.EMAIL_FILE_INFO efi
+            <if test="fileType != 3">
+                JOIN PPW_EMAIL.EMAIL_FUND_NAV efn
+                ON efi.id = efn.file_id
+            </if>
+            <if test="fileType == 3">
+                JOIN PPW_EMAIL.AMAC_REPORT_FUND_INFO efn
+                ON efi.id = efn.file_id
+                left join PPW_EMAIL.PVN_FUND_INFO info
+                on efn.register_number=info.register_number and info.isvalid=1
+            </if>
+                JOIN PPW_EMAIL.EMAIL_PARSE_INFO epi
+                     ON epi.id = efi.email_id
+        WHERE efi.isvalid = 1
+          AND efn.isvalid = 1
+          AND epi.isvalid = 1
+          AND epi.EMAIL_TYPE = #{fileType}
+        <if test="fileType != 3">
+            and efn.fund_id=#{fundId}
+        </if>
+        <if test="fileType == 3">
+            and info.fund_id=#{fundId}
+        </if>
+        order by efi.createtime desc
+        limit #{offset},#{pageSize}
+    </select>
+
+    <resultMap id="BaseDetailMap" type="com.simuwang.base.pojo.dos.EmailParseDetailDO">
+        <result column="fund_id" property="fundId"/>
+        <result column="fund_name" property="fundName"/>
+        <result column="register_number" property="registerNumber"/>
+        <result column="price_date" property="priceDate"/>
+        <result column="nav" property="nav"/>
+        <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
+        <result column="asset_net" property="assetNet"/>
+        <result column="asset_share" property="assetShare"/>
+        <result column="nav_is_stored" property="navIsStored"/>
+        <result column="nav_exception_status" property="navExceptionStatus"/>
+        <result column="asset_is_stored" property="assetIsStored"/>
+        <result column="asset_exception_status" property="assetExceptionStatus"/>
+        <result column="updatetime" property="updateTime"/>
+    </resultMap>
+    <select id="searchEmailDetailById" resultMap="BaseDetailMap">
+        SELECT distinct
+            IFNULL(nav.fund_id,asset.fund_id) as fund_id,
+            IFNULL(nav.fund_name,asset.fund_name) as fund_name,
+            IFNULL(nav.register_number,asset.register_number) as register_number,
+            IFNULL(nav.price_date,asset.price_date) as price_date,
+            nav.nav,
+            nav.cumulative_nav_withdrawal,
+            asset.asset_net,
+            asset.asset_share,
+            nav.is_stored as nav_is_stored,
+            nav.exception_status as nav_exception_status,
+            asset.is_stored as asset_is_stored,
+            asset.exception_status as asset_exception_status,
+            case
+            when nav.updatetime is null then
+            asset.updatetime
+            when asset.updatetime is null then
+            nav.updatetime
+            when nav.updatetime >= asset.updatetime then
+                nav.updatetime
+            else
+                asset.updatetime
+         end as updatetime
+        FROM
+            PPW_EMAIL.EMAIL_FILE_INFO efi
+                LEFT JOIN PPW_EMAIL.email_fund_nav nav
+                          ON efi.id = nav.file_id
+                              AND nav.isvalid = 1
+                LEFT JOIN PPW_EMAIL.email_fund_asset asset
+                          ON efi.id = asset.file_id
+                              AND asset.isvalid = 1 AND (nav.fund_id=asset.fund_id OR nav.register_number=asset.register_number OR nav.fund_name= asset.fund_name) AND nav.price_date=asset.price_date
+        WHERE efi.isvalid = 1
+          AND efi.id =#{fileId}
+        order by fund_name desc,price_date desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countFundFileInfo" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.FundFilePageQuery">
+        select count(1) from (
+        SELECT DISTINCT efi.id as "fileId",
+        <if test="fileType != 3">
+            efn.fund_id as "fundId",
+            efn.fund_name as "fundName",
+        </if>
+        <if test="fileType == 3">
+            info.fund_id as "fundId",
+            efn.fund_name as "fundName",
+        </if>
+        efi.file_name as "fileName",
+        efi.file_path as "filePath",
+        efi.createtime as "createTime"
+        FROM
+        PPW_EMAIL.EMAIL_FILE_INFO efi
+        <if test="fileType != 3">
+            JOIN PPW_EMAIL.EMAIL_FUND_NAV efn
+            ON efi.id = efn.file_id
+        </if>
+        <if test="fileType == 3">
+            JOIN PPW_EMAIL.AMAC_REPORT_FUND_INFO efn
+            ON efi.id = efn.file_id
+            left join PPW_EMAIL.PVN_FUND_INFO info
+            on efn.register_number=info.register_number and info.isvalid=1
+        </if>
+        JOIN PPW_EMAIL.EMAIL_PARSE_INFO epi
+        ON epi.id = efi.email_id
+        WHERE efi.isvalid = 1
+        AND efn.isvalid = 1
+        AND epi.isvalid = 1
+        AND epi.EMAIL_TYPE = #{fileType}
+        <if test="fileType != 3">
+            and efn.fund_id=#{fundId}
+        </if>
+        <if test="fileType == 3">
+            and info.fund_id=#{fundId}
+        </if>) a
+    </select>
+    <select id="countEmailDetailById" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.EmailFileQuery">
+            select count(1) from (
+            SELECT distinct
+            IFNULL(nav.fund_id,asset.fund_id) as fund_id,
+            IFNULL(nav.fund_name,asset.fund_name) as fund_name,
+            IFNULL(nav.register_number,asset.register_number) as register_number,
+            IFNULL(nav.price_date,asset.price_date) as price_date,
+            nav.nav,
+            nav.cumulative_nav_withdrawal,
+            asset.asset_net,
+            asset.asset_share
+        FROM
+            PPW_EMAIL.EMAIL_FILE_INFO efi
+                LEFT JOIN PPW_EMAIL.email_fund_nav nav
+                          ON efi.id = nav.file_id
+                              AND nav.isvalid = 1
+                LEFT JOIN PPW_EMAIL.email_fund_asset asset
+                          ON efi.id = asset.file_id
+                              AND asset.isvalid = 1 AND (nav.fund_id=asset.fund_id OR nav.register_number=asset.register_number OR nav.fund_name= asset.fund_name) AND nav.price_date=asset.price_date
+        WHERE efi.isvalid = 1
+          AND efi.id =#{fileId}) a
+    </select>
+    <select id="selectValuationFileId" resultType="java.lang.Integer"
+            parameterType="java.util.List">
+        SELECT
+            distinct file.id
+        FROM
+            PPW_EMAIL.EMAIL_FILE_INFO file
+                JOIN PPW_EMAIL.EMAIL_PARSE_INFO info
+                     ON file.email_id = info.id
+        WHERE info.email_type = 2
+          AND file.id IN
+        <foreach collection="fileIdList" item="fileId" index="index" separator=",">
+            #{fileId}
+        </foreach>
+    </select>
+    <select id="getAllPriceDateByFileId" resultType="java.lang.String" parameterType="java.lang.Integer">
+        select * from (select distinct price_date from PPW_EMAIL.EMAIL_FUND_NAV WHERE file_id=#{fileId}and isvalid=1
+        union
+        select distinct price_date from PPW_EMAIL.EMAIL_FUND_ASSET WHERE file_id=#{fileId}and isvalid=1) a order by price_date desc
+    </select>
+
+    <update id="updateTimeById">
+        update PPW_EMAIL.EMAIL_FILE_INFO
+        set updatetime = #{parseDate}
+        where isvalid = 1
+          and id = #{id}
+    </update>
+
+</mapper>

+ 242 - 0
service-base/src/main/resources/mapper/daq/EmailFundAssetMapper.xml

@@ -0,0 +1,242 @@
+<?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.daq.EmailFundAssetMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailFundAssetDO">
+        <id column="id" property="id"/>
+        <result column="file_id" property="fileId"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="fund_name" property="fundName"/>
+        <result column="register_number" property="registerNumber"/>
+        <result column="price_date" property="priceDate"/>
+        <result column="asset_net" property="assetNet"/>
+        <result column="asset_share" property="assetShare"/>
+        <result column="is_stored" property="isStored"/>
+        <result column="exception_status" property="exceptionStatus"/>
+        <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"/>
+        <result column="email_title" property="emailTitle"/>
+        <result column="email_id" property="emailId"/>
+        <result column="target_fund_name" property="targetFundName"/>
+        <result column="target_fund_id" property="targetFundId"/>
+    </resultMap>
+
+    <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.EmailFundAssetDO">
+        insert into PPW_EMAIL.email_fund_asset(file_id, fund_id, fund_name,register_number,price_date,asset_net,asset_share,is_stored,exception_status,
+                                              isvalid, creatorid, createtime, updaterid, updatetime)
+        values
+        <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
+            (#{itemDo.fileId},#{itemDo.fundId},#{itemDo.fundName},#{itemDo.registerNumber},#{itemDo.priceDate},#{itemDo.assetNet},#{itemDo.assetShare},#{itemDo.isStored},#{itemDo.exceptionStatus},
+            #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+        </foreach>
+
+    </insert>
+    <update id="batchUpdate">
+        <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
+            update PPW_EMAIL.email_fund_asset
+            <set>
+                fund_id = #{itemDo.fundId},
+                exception_status = #{itemDo.exceptionStatus},
+                updatetime=#{itemDo.updateTime},
+                is_stored=#{itemDo.isStored}
+            </set>
+            where isvalid = 1
+            and id = #{itemDo.id}
+        </foreach>
+    </update>
+    <select id="searchAssetDetail" resultMap="BaseResultMap"
+            parameterType="com.simuwang.base.pojo.dto.query.ParseDetailPageQuery">
+        select distinct asset.id,
+                        asset.fund_id,
+                        asset.fund_name,
+                        info.fund_id as target_fund_id,
+                        info.fund_name as target_fund_name,
+                        asset.register_number,
+                        asset.price_date,
+                        asset.asset_net,
+                        asset.asset_share,
+                        asset.is_stored,
+                        asset.exception_status,
+                        asset.updatetime,
+                        parse.email_title,
+                        parse.id as email_id
+        from PPW_EMAIL.email_fund_asset asset
+        join PPW_EMAIL.email_file_info file
+        on asset.file_id = file.id
+        join PPW_EMAIL.email_parse_info parse
+        on file.email_id = parse.id
+        left join PPW_EMAIL.pvn_fund_info info
+        on asset.fund_id=info.fund_id and info.isvalid=1
+        where asset.isvalid=1 and file.isvalid=1 and parse.isvalid=1
+        <if test="fundName != null and fundName !=''">
+            and asset.fund_name like concat('%',#{fundName},'%')
+        </if>
+        <if test="priceStartDate != null and priceStartDate !=''">
+            and asset.price_date >= #{priceStartDate}
+        </if>
+        <if test="priceEndDate != null and priceEndDate !=''">
+            and asset.price_date  <![CDATA[ <= ]]> #{priceEndDate}
+        </if>
+        <if test="updateStartDate != null and updateStartDate !=''">
+            and asset.updatetime  <![CDATA[ >= ]]> #{updateStartDate}
+        </if>
+        <if test="updateEndDate != null and updateEndDate !=''">
+            and asset.updatetime  <![CDATA[ <= ]]> #{updateEndDate}
+        </if>
+        <if test="isStore != null">
+            and asset.is_stored = #{isStore}
+        </if>
+        <if test="emailTitle != null and emailTitle != ''">
+            and parse.email_title like concat('%',#{emailTitle},'%')
+        </if>
+        <if test="emailId != null and emailId !=''">
+            and parse.id =#{emailId}
+        </if>
+        <if test="exceptionStatusList != null">
+            and asset.exception_status in
+            <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
+                #{exceptionStatus}
+            </foreach>
+        </if>
+        order by asset.updatetime desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countAssetDetail" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.ParseDetailPageQuery">
+        select count(1) from (
+        select distinct asset.id,
+            asset.fund_id,
+            asset.fund_name,
+            info.fund_id as target_fund_id,
+            info.fund_name as target_fund_name,
+            asset.register_number,
+            asset.price_date,
+            asset.asset_net,
+            asset.asset_share,
+            asset.is_stored,
+            asset.exception_status,
+            asset.updatetime,
+            parse.email_title,
+            parse.id as email_id
+        from PPW_EMAIL.email_fund_asset asset
+        join PPW_EMAIL.email_file_info file
+        on asset.file_id = file.id
+        join PPW_EMAIL.email_parse_info parse
+        on file.email_id = parse.id
+        left join PPW_EMAIL.pvn_fund_info info
+        on asset.fund_id=info.fund_id and info.isvalid=1
+        where asset.isvalid=1 and file.isvalid=1 and parse.isvalid=1
+        <if test="fundName != null and fundName !=''">
+            and asset.fund_name like concat('%',#{fundName},'%')
+        </if>
+        <if test="priceStartDate != null and priceStartDate !=''">
+            and asset.price_date >= #{priceStartDate}
+        </if>
+        <if test="priceEndDate != null and priceEndDate !=''">
+            and asset.price_date  <![CDATA[ <= ]]> #{priceEndDate}
+        </if>
+        <if test="updateStartDate != null and updateStartDate !=''">
+            and asset.updatetime  <![CDATA[ >= ]]> #{updateStartDate}
+        </if>
+        <if test="updateEndDate != null and updateEndDate !=''">
+            and asset.updatetime  <![CDATA[ <= ]]> #{updateEndDate}
+        </if>
+        <if test="isStore != null">
+            and asset.is_stored = #{isStore}
+        </if>
+        <if test="emailTitle != null and emailTitle != ''">
+            and parse.email_title like concat('%',#{emailTitle},'%')
+        </if>
+        <if test="emailId != null and emailId !=''">
+            and parse.id =#{emailId}
+        </if>
+        <if test="exceptionStatusList != null">
+            and asset.exception_status in
+            <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
+                #{exceptionStatus}
+            </foreach>
+        </if>
+        )a
+    </select>
+    <select id="countNoStoreAsset" resultType="java.lang.Integer" parameterType="java.lang.String">
+        select count(id)
+        from PPW_EMAIL.email_fund_asset
+        where isvalid =1 and exception_status=3
+        <if test="fundName != null and fundName !=''">
+            and fund_name=#{fundName}
+        </if>
+        <if test="registerNumber != null and registerNumber !=''">
+            and register_number=#{registerNumber}
+        </if>
+    </select>
+    <select id="selectNotMappingAsset" resultMap="BaseResultMap"
+            parameterType="java.lang.String">
+        select distinct id,fund_id,file_id, fund_name,register_number,price_date,asset_net,asset_share,is_stored,exception_status,
+                        updatetime
+        from PPW_EMAIL.email_fund_asset
+        where isvalid =1 and exception_status=3
+        <if test="fundName != null and fundName !=''">
+            and fund_name=#{fundName}
+        </if>
+        <if test="registerNumber != null and registerNumber !=''">
+            and register_number=#{registerNumber}
+        </if>
+    </select>
+    <resultMap id="BaseDetailMap" type="com.simuwang.base.pojo.dos.EmailParseDetailDO">
+        <result column="fund_id" property="fundId"/>
+        <result column="fund_name" property="fundName"/>
+        <result column="register_number" property="registerNumber"/>
+        <result column="price_date" property="priceDate"/>
+        <result column="nav" property="nav"/>
+        <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
+        <result column="asset_net" property="assetNet"/>
+        <result column="asset_share" property="assetShare"/>
+        <result column="nav_is_stored" property="navIsStored"/>
+        <result column="nav_exception_status" property="navExceptionStatus"/>
+        <result column="asset_is_stored" property="assetIsStored"/>
+        <result column="asset_exception_status" property="assetExceptionStatus"/>
+        <result column="updatetime" property="updateTime"/>
+    </resultMap>
+    <select id="selectFundAssetByFielId" resultMap="BaseDetailMap">
+        SELECT DISTINCT
+            asset.fund_id,
+            asset.fund_name,
+            asset.register_number,
+            asset.price_date,
+            null as nav,
+            null as cumulative_nav_withdrawal,
+            asset.asset_net as asset_net,
+            asset.asset_share as asset_share,
+            null AS nav_is_stored,
+            null AS nav_exception_status,
+            asset.is_stored as asset_is_stored,
+            asset.exception_status as asset_exception_status,
+            asset.updatetime
+        FROM
+            PPW_EMAIL.EMAIL_FILE_INFO efi
+                JOIN PPW_EMAIL.email_fund_asset asset
+                     ON efi.id = asset.file_id
+                         AND asset.isvalid = 1
+        WHERE efi.isvalid = 1
+          AND efi.id = #{fileId} and asset.price_date=#{priceDate}
+    </select>
+    <select id="selectAssetByFundId" resultMap="BaseResultMap">
+        select id,file_id, fund_id, fund_name,register_number,price_date,asset_net,asset_share,is_stored,exception_status,
+               isvalid, creatorid, createtime, updaterid, updatetime
+        from PPW_EMAIL.email_fund_asset where isvalid=1 and fund_id=#{fundId}
+    </select>
+    <select id="countEmailAssetTotal" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.email_fund_asset where isvalid=1
+    </select>
+
+    <delete id="deleteByFileId">
+        update PPW_EMAIL.email_fund_asset
+        set isvalid   = 0,
+            updatetime= now()
+        where isvalid = 1
+          and file_id = #{fileId}
+    </delete>
+
+</mapper>

+ 280 - 0
service-base/src/main/resources/mapper/daq/EmailFundNavMapper.xml

@@ -0,0 +1,280 @@
+<?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.daq.EmailFundNavMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailFundNavDO">
+        <id column="id" property="id"/>
+        <result column="file_id" property="fileId"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="fund_name" property="fundName"/>
+        <result column="register_number" property="registerNumber"/>
+        <result column="price_date" property="priceDate"/>
+        <result column="nav" property="nav"/>
+        <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
+        <result column="is_stored" property="isStored"/>
+        <result column="exception_status" property="exceptionStatus"/>
+        <result column="template_id" property="templateId"/>
+        <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"/>
+        <result column="email_title" property="emailTitle"/>
+        <result column="target_fund_name" property="targetFundName"/>
+        <result column="target_fund_id" property="targetFundId"/>
+    </resultMap>
+
+    <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.EmailFundNavDO">
+        insert into PPW_EMAIL.email_fund_nav(file_id, fund_id, fund_name,register_number,price_date,
+                                              nav,cumulative_nav_withdrawal,is_stored,exception_status,template_id,
+                                              isvalid, creatorid, createtime, updaterid, updatetime)
+        values
+        <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
+            (#{itemDo.fileId},#{itemDo.fundId},#{itemDo.fundName},#{itemDo.registerNumber},#{itemDo.priceDate},
+             #{itemDo.nav},#{itemDo.cumulativeNavWithdrawal},#{itemDo.isStored},#{itemDo.exceptionStatus},#{itemDo.templateId},
+            #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+        </foreach>
+    </insert>
+    <update id="batchUpdate">
+        <foreach collection="navList" item="itemDo" index="index" open="" close="" separator=";">
+            update PPW_EMAIL.email_fund_nav
+            <set>
+                fund_id = #{itemDo.fundId},
+                exception_status = #{itemDo.exceptionStatus},
+                updatetime=#{itemDo.updateTime},
+                is_stored=#{itemDo.isStored}
+            </set>
+            where isvalid = 1
+            and id = #{itemDo.id}
+        </foreach>
+    </update>
+    <delete id="deleteByFileId" parameterType="java.lang.Integer">
+        update PPW_EMAIL.email_fund_nav nav set isvalid = 0,updatetime=sysdate() where file_id=#{fileId}
+    </delete>
+    <select id="searchNavDetail" resultMap="BaseResultMap">
+        SELECT distinct nav.id,nav.file_id,
+            nav.fund_id,
+            nav.fund_name,
+            info.fund_id as target_fund_id,
+            info.fund_name as target_fund_name,
+            nav.register_number,
+            nav.price_date,
+            nav.nav,
+            nav.cumulative_nav_withdrawal,
+            nav.exception_status,
+            nav.is_stored,
+            nav.updatetime,
+            parse.email_title,
+            parse.id as email_id
+        FROM
+            PPW_EMAIL.email_fund_nav nav
+            join PPW_EMAIL.email_file_info file
+                on nav.file_id = file.id
+            join PPW_EMAIL.email_parse_info parse
+                on file.email_id = parse.id
+            left join PPW_EMAIL.pvn_fund_info info
+                on nav.fund_id=info.fund_id and info.isvalid=1
+        WHERE nav.isvalid = 1  and file.isvalid=1 and parse.isvalid=1
+        <if test="fundName != null and fundName !=''">
+            and nav.fund_name like concat('%',#{fundName},'%')
+        </if>
+        <if test="priceStartDate != null and priceStartDate !=''">
+            and nav.price_date >= #{priceStartDate}
+        </if>
+        <if test="priceEndDate != null and priceEndDate !=''">
+            and nav.price_date  <![CDATA[ <= ]]> #{priceEndDate}
+        </if>
+        <if test="exceptionStatusList != null">
+            and nav.exception_status in
+            <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
+                #{exceptionStatus}
+            </foreach>
+        </if>
+        <if test="updateStartDate != null and updateStartDate !=''">
+            and nav.updatetime  <![CDATA[ >= ]]> #{updateStartDate}
+        </if>
+        <if test="updateEndDate != null and updateEndDate !=''">
+            and nav.updatetime  <![CDATA[ <= ]]> #{updateEndDate}
+        </if>
+        <if test="isStore != null">
+            and nav.is_stored = #{isStore}
+        </if>
+        <if test="emailTitle != null and emailTitle != ''">
+            and parse.email_title like concat('%',#{emailTitle},'%')
+        </if>
+        <if test="emailId != null and emailId !=''">
+            and parse.id =#{emailId}
+        </if>
+        order by nav.updatetime desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countNavDetail" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.ParseDetailPageQuery">
+        select count(1) from (
+            SELECT distinct nav.id,nav.file_id,
+            nav.fund_id,
+            nav.fund_name,
+            info.fund_id as target_fund_id,
+            info.fund_name as target_fund_name,
+            nav.register_number,
+            nav.price_date,
+            nav.nav,
+            nav.cumulative_nav_withdrawal,
+            nav.exception_status,
+            nav.is_stored,
+            nav.updatetime
+        FROM
+        PPW_EMAIL.email_fund_nav nav
+        join PPW_EMAIL.email_file_info file
+        on nav.file_id = file.id
+        join PPW_EMAIL.email_parse_info parse
+        on file.email_id = parse.id
+        left join PPW_EMAIL.pvn_fund_info info
+        on nav.fund_id=info.fund_id and info.isvalid=1
+        WHERE nav.isvalid = 1  and file.isvalid=1 and parse.isvalid=1
+        <if test="fundName != null and fundName !=''">
+            and nav.fund_name like concat('%',#{fundName},'%')
+        </if>
+        <if test="priceStartDate != null and priceStartDate !=''">
+            and nav.price_date >= #{priceStartDate}
+        </if>
+        <if test="priceEndDate != null and priceEndDate !=''">
+            and nav.price_date  <![CDATA[ <= ]]> #{priceEndDate}
+        </if>
+        <if test="exceptionStatusList != null">
+            and nav.exception_status in
+            <foreach collection="exceptionStatusList" index="index" item="exceptionStatus" separator="," open="(" close=")">
+                #{exceptionStatus}
+            </foreach>
+        </if>
+        <if test="updateStartDate != null and updateStartDate !=''">
+            and nav.updatetime  <![CDATA[ >= ]]> #{updateStartDate}
+        </if>
+        <if test="updateEndDate != null and updateEndDate !=''">
+            and nav.updatetime  <![CDATA[ <= ]]> #{updateEndDate}
+        </if>
+        <if test="isStore != null">
+            and nav.is_stored = #{isStore}
+        </if>
+        <if test="emailTitle != null and emailTitle != ''">
+            and parse.email_title like concat('%',#{emailTitle},'%')
+        </if>
+        <if test="emailId != null and emailId != ''">
+            and parse.id=#{emailId}
+        </if>
+        ) a
+    </select>
+    <select id="countNoStoreNav" resultType="java.lang.Integer" parameterType="java.lang.String">
+        select count(nav.id)
+        from PPW_EMAIL.email_fund_nav nav
+        where nav.isvalid =1 and nav.exception_status=3
+        <if test="fundName != null and fundName != ''">
+            and nav.fund_name=#{fundName}
+        </if>
+        <if test="registerNumber != null and registerNumber != ''">
+            and nav.register_number=#{registerNumber}
+        </if>
+    </select>
+    <select id="selectFileIdByFundName" resultType="java.lang.Integer" parameterType="java.lang.String">
+        select distinct nav.file_id from PPW_EMAIL.email_fund_nav nav where nav.isvalid =1 and nav.exception_status in(1,3)
+        <if test="fundName != null and fundName != ''">
+            and nav.fund_name=#{fundName}
+        </if>
+        <if test="registerNumber != null and registerNumber != ''">
+            and nav.register_number=#{registerNumber}
+        </if>
+    </select>
+    <select id="selectNotMappingNav" resultMap="BaseResultMap"
+            parameterType="java.lang.String">
+        select nav.id,
+               nav.file_id,
+               nav.fund_id,
+               nav.fund_name,
+               nav.register_number,
+               nav.price_date,
+               nav.nav,
+               nav.cumulative_nav_withdrawal,
+               nav.exception_status,
+               nav.is_stored,
+               nav.isvalid,
+               nav.creatorid,
+               nav.updaterid,
+               nav.updatetime,
+               nav.createtime
+        from PPW_EMAIL.email_fund_nav nav
+        where nav.isvalid =1 and nav.exception_status in (1,3)
+        <if test="fundName != null and fundName != ''">
+            and nav.fund_name=#{fundName}
+        </if>
+        <if test="registerNumber != null and registerNumber != ''">
+            and nav.register_number=#{registerNumber}
+        </if>
+        order by nav.updatetime desc
+    </select>
+    <select id="getMaxPriceDate" resultType="java.lang.String" parameterType="java.lang.String">
+        select max(nav.price_date) from PPW_EMAIL.email_fund_nav nav where nav.isvalid =1 and nav.exception_status in (1,3)
+                                                                        and nav.fund_name=#{fundName}
+    </select>
+    <resultMap id="BaseDetailMap" type="com.simuwang.base.pojo.dos.EmailParseDetailDO">
+        <result column="fund_id" property="fundId"/>
+        <result column="fund_name" property="fundName"/>
+        <result column="register_number" property="registerNumber"/>
+        <result column="price_date" property="priceDate"/>
+        <result column="nav" property="nav"/>
+        <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
+        <result column="asset_net" property="assetNet"/>
+        <result column="asset_share" property="assetShare"/>
+        <result column="nav_is_stored" property="navIsStored"/>
+        <result column="nav_exception_status" property="navExceptionStatus"/>
+        <result column="asset_is_stored" property="assetIsStored"/>
+        <result column="asset_exception_status" property="assetExceptionStatus"/>
+        <result column="updatetime" property="updateTime"/>
+    </resultMap>
+    <select id="selectFundNavByFielId" resultMap="BaseDetailMap">
+        SELECT DISTINCT
+            nav.fund_id,
+            nav.fund_name,
+            nav.register_number,
+            nav.price_date,
+            nav.nav,
+            nav.cumulative_nav_withdrawal,
+            null as asset_net,
+            null as asset_share,
+            nav.is_stored AS nav_is_stored,
+            nav.exception_status AS nav_exception_status,
+            null as asset_is_stored,
+            null as asset_exception_status,
+            nav.updatetime
+        FROM
+            PPW_EMAIL.EMAIL_FILE_INFO efi
+                JOIN PPW_EMAIL.email_fund_nav nav
+                     ON efi.id = nav.file_id
+                      AND nav.isvalid = 1
+        WHERE efi.isvalid = 1
+          AND efi.id = #{fileId} and nav.price_date=#{priceDate}
+    </select>
+    <select id="selectNavByFundId" resultMap="BaseResultMap">
+        select nav.id,
+               nav.file_id,
+               nav.fund_id,
+               nav.fund_name,
+               nav.register_number,
+               nav.price_date,
+               nav.nav,
+               nav.cumulative_nav_withdrawal,
+               nav.exception_status,
+               nav.is_stored,
+               nav.isvalid,
+               nav.creatorid,
+               nav.updaterid,
+               nav.updatetime,
+               nav.createtime
+        from PPW_EMAIL.email_fund_nav nav
+        where nav.isvalid =1 and nav.exception_status=1
+        and nav.fund_id = #{fundId}
+    </select>
+    <select id="countEmailNavTotal" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.email_fund_nav where isvalid=1
+    </select>
+
+
+</mapper>

+ 62 - 0
service-base/src/main/resources/mapper/daq/EmailFundNavService.xml

@@ -0,0 +1,62 @@
+<?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.daq.CompanyInformationMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.CompanyInformationDO">
+        <id column="company_id" property="companyId"/>
+        <result column="is_amac_show" property="isAmacShow"/>
+        <result column="fund_practitioners_count" property="fundPractitionersCount"/>
+        <result column="managed_fund_count" property="managedFundCount"/>
+        <result column="cancel_date" property="cancelDate"/>
+        <result column="cancel_type" property="cancelType"/>
+        <result column="credit_code" property="creditCode"/>
+        <result column="employee_cnts" property="employeeCnts"/>
+        <result column="company_asset_size" property="companyAssetSize"/>
+        <result column="paid_capital" property="paidCapital"/>
+        <result column="capital_paid_rate" property="capitalPaidRate"/>
+        <result column="nature_business_type" property="natureBusinessType"/>
+        <result column="business_type" property="businessType"/>
+        <result column="member_type" property="memberType"/>
+        <result column="join_date" property="joinDate"/>
+        <result column="is_member" property="isMember"/>
+        <result column="register_date" property="registerDate"/>
+        <result column="register_status" property="registerStatus"/>
+        <result column="register_number" property="registerNumber"/>
+        <result column="registered_capital" property="registeredCapital"/>
+        <result column="reg_country" property="regCountry"/>
+        <result column="reg_province" property="regProvince"/>
+        <result column="reg_city" property="regCity"/>
+        <result column="country" property="country"/>
+        <result column="province" property="province"/>
+        <result column="city" property="city"/>
+        <result column="company_address2" property="companyAddress2"/>
+        <result column="company_address" property="companyAddress"/>
+        <result column="domicile_id" property="domicileId"/>
+        <result column="establish_date" property="establishDate"/>
+        <result column="organization_number" property="organizationNumber"/>
+        <result column="company_type" property="companyType"/>
+        <result column="company_name" property="companyName"/>
+        <result column="company_short_name" property="companyShortName"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updatetime" property="updateTime"/>
+        <result column="isvalid" property="isvalid"/>
+    </resultMap>
+    <select id="searchCompanyInfoByKeyword" resultType="java.util.Map" parameterType="java.lang.String">
+        select c.company_id as `companyId`,
+        c.company_name as `companyName`,
+        c.register_number as `registerNumber`
+        from PPW_EMAIL.pvn_company_info c where c.isvalid =1
+        <if test="keyword != null and keyword !=''">
+            and (c.company_name like concat('%',#{keyword},'%') or c.company_short_name like concat('%',#{keyword},'%') or c.register_number like concat('%',#{keyword},'%'))
+        </if>
+    </select>
+    <select id="getCompanyNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
+        select distinct company_name from PPW_EMAIL.pvn_company_info c join PPW_EMAIL.pvn_fund_info f
+        on f.trust_id = c.company_id
+        where c.isvalid=1 and f.isvalid=1
+        and f.fund_id=#{fundId}
+    </select>
+    <select id="countCompanyTotal" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.pvn_company_info where isvalid=1
+    </select>
+
+</mapper>

+ 237 - 0
service-base/src/main/resources/mapper/daq/EmailParseInfoMapper.xml

@@ -0,0 +1,237 @@
+<?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.daq.EmailParseInfoMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailParseInfoDO">
+        <id column="id" property="id"/>
+        <result column="email" property="email"/>
+        <result column="sender_email" property="senderEmail"/>
+        <result column="email_date" property="emailDate" />
+        <result column="parse_date" property="parseDate" />
+        <result column="email_title" property="emailTitle"/>
+        <result column="email_type" property="emailType"/>
+        <result column="parse_status" property="parseStatus"/>
+        <result column="fail_reason" property="failReason"/>
+        <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"/>
+        <result column="sender_email" property="senderEmail"/>
+    </resultMap>
+
+
+    <insert id="insert" parameterType="com.simuwang.base.pojo.dos.EmailParseInfoDO" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
+        insert into PPW_EMAIL.email_parse_info(email, sender_email, email_date, parse_date, email_title, email_type, parse_status,
+                                     isvalid, creatorid, createtime, updaterid, updatetime)
+        values (#{itemDo.email}, #{itemDo.senderEmail}, #{itemDo.emailDate}, #{itemDo.parseDate}, #{itemDo.emailTitle}, #{itemDo.emailType}, #{itemDo.parseStatus},
+                #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+    </insert>
+
+    <update id="updateParseStatus">
+        update PPW_EMAIL.email_parse_info
+        set parse_status = #{parseStatus},
+            fail_reason = #{failReason}
+        where isvalid = 1
+          and id = #{id}
+    </update>
+    <sql id="selectEmailParse">
+        SELECT
+            epi.id,
+            epi.email,
+            epi.email_date,
+            epi.parse_date,
+            epi.email_title,
+            epi.email_type,
+            epi.parse_status,
+            epi.fail_reason,
+            epi.isvalid,
+            epi.creatorid,
+            epi.createtime,
+            epi.updatetime,
+            epi.updaterid,
+            epi.sender_email
+        FROM
+            PPW_EMAIL.email_parse_info epi
+    </sql>
+    <!-- 查询条件 -->
+    <sql id="sqlwhereSearch">
+        <where>
+            epi.isvalid=1
+            <if test="emailTitle !=null and emailTitle !=''">
+                and epi.email_title like concat('%',#{emailTitle},'%')
+            </if>
+            <if test="emailType !=null">
+                and epi.email_type = #{emailType}
+            </if>
+            <if test="parseStatus !=null">
+                and epi.parse_status = #{parseStatus}
+            </if>
+            <if test="startDate !=null and startDate != ''">
+                and epi.parse_date <![CDATA[ >= ]]> #{startDate}
+            </if>
+            <if test="endDate !=null and endDate != ''">
+                and epi.parse_date <![CDATA[ <= ]]> #{endDate}
+            </if>
+            <if test="emailStartDate !=null and emailStartDate != ''">
+                and epi.email_date <![CDATA[ >= ]]> #{emailStartDate}
+            </if>
+            <if test="emailEndDate !=null and emailEndDate != ''">
+                and epi.email_date <![CDATA[ <= ]]> #{emailEndDate}
+            </if>
+            <if test="id !=null">
+                and epi.id = #{id}
+            </if>
+            <if test="email !=null and email !=''">
+                and epi.email like concat('%',#{email},'%')
+            </if>
+            <if test="senderEmail !=null and senderEmail !=''">
+                and epi.sender_email like concat('%',#{senderEmail},'%')
+            </if>
+        </where>
+    </sql>
+    <select id="searchEmailList" resultMap="BaseResultMap">
+        <include refid="selectEmailParse"/>
+        <include refid="sqlwhereSearch"/>
+        <choose>
+            <when test="sort != null and sort !='' and sort=='parseDate' and order != null and order !=''">
+                order by epi.parse_date ${order}
+            </when>
+            <when test="sort != null and sort !='' and sort=='emailDate'  and order != null and order !=''">
+                order by epi.email_date ${order}
+            </when>
+            <otherwise>
+                order by epi.parse_date desc
+            </otherwise>
+        </choose>
+     limit #{offset},#{pageSize}
+    </select>
+    <select id="searchEmailById" resultMap="BaseResultMap">
+        <include refid="selectEmailParse"/>
+        where epi.isvalid =1 and epi.id =#{id}
+    </select>
+
+    <select id="searchEmailCount" resultType="java.lang.Integer">
+        select count(1) from PPW_EMAIL.email_parse_info where isvalid=1
+        <if test="parseStatus != null and parseStatus != -1">
+            and parse_status=#{parseStatus}
+        </if>
+        <if test="parseStatus != null and parseStatus == -1">
+            and parse_status != 1
+        </if>
+        <if test="startDate != null  and startDate != ''">
+            and parse_date >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != ''">
+            and parse_date <![CDATA[ <= ]]> #{endDate}
+        </if>
+    </select>
+
+    <select id="queryById" resultMap="BaseResultMap">
+        select id, email, email_date, parse_date, email_title, email_type, sender_email,parse_status
+        from PPW_EMAIL.email_parse_info
+        where isvalid = 1
+          and id = #{id}
+    </select>
+    <select id="countEmailList" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.EmailParseQuery">
+        select count(*) from PPW_EMAIL.email_parse_info epi
+        <include refid="sqlwhereSearch"/>
+    </select>
+
+    <update id="updateParseTime">
+        update PPW_EMAIL.email_parse_info
+        set updatetime = #{parseDate},
+            parse_date = #{parseDate}
+        where isvalid = 1
+          and id = #{id}
+    </update>
+
+    <select id="queryValuationEmailByFileId" resultType="com.simuwang.base.pojo.dto.EmailInfoDTO">
+        select t1.id as id,
+               t1.email as email,
+               t1.email_date as emailDate,
+               t1.email_title as emailTitle,
+               t1.email_type as emailType,
+               t2.id as fileId,
+               t2.file_name as fileName,
+               t2.file_path as filePath
+        from PPW_EMAIL.email_parse_info t1
+        join PPW_EMAIL.email_file_info t2 on t1.id = t2.email_id and t2.isvalid = 1
+        where t1.isvalid = 1
+          and t1.email_type = 2
+          and t2.id in
+        <foreach collection="fileIdList" item="fileId" index="index" open="(" separator="," close=")">
+        #{fileId}
+        </foreach>
+    </select>
+    <select id="searchEmailDataBoard" resultType="java.util.Map"
+            parameterType="com.simuwang.base.pojo.dto.query.DataboardQuery">
+        select parse_status as "parse_status",count(id) as "total" from PPW_EMAIL.email_parse_info
+        where isvalid=1
+        <if test="startDate != null  and startDate != ''">
+            and email_date >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != ''">
+            and email_date <![CDATA[ <= ]]> #{endDate}
+        </if>
+        <if test="email !=null and email !=''">
+            and email like concat('%',#{email},'%')
+        </if>
+        <if test="senderEmail !=null and senderEmail !=''">
+            and sender_email like concat('%',#{senderEmail},'%')
+        </if>
+        <if test="emailType !=null">
+            and email_type = #{emailType}
+        </if>
+        group by parse_status
+        order by parse_status
+    </select>
+    <select id="searchEmailTypeCount" resultType="java.util.Map"
+            parameterType="com.simuwang.base.pojo.dto.query.DataboardQuery">
+        select email_type as "email_type",count(id)  as "total" from PPW_EMAIL.email_parse_info
+        where isvalid=1
+        <if test="startDate != null  and startDate != ''">
+            and email_date >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate != ''">
+            and email_date <![CDATA[ <= ]]> #{endDate}
+        </if>
+        <if test="email !=null and email !=''">
+            and email like concat('%',#{email},'%')
+        </if>
+        <if test="senderEmail !=null and senderEmail !=''">
+            and sender_email like concat('%',#{senderEmail},'%')
+        </if>
+        group by email_type
+        order by email_type
+    </select>
+    <select id="countpdfNoData" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.email_parse_info
+        where isvalid=1
+        <if test="item.startDate != null  and item.startDate != ''">
+            and email_date >= #{item.startDate}
+        </if>
+        <if test="item.endDate != null and item.endDate != ''">
+            and email_date <![CDATA[ <= ]]> #{item.endDate}
+        </if>
+        <if test="item.email !=null and item.email !=''">
+            and email like concat('%',#{item.email},'%')
+        </if>
+        <if test="item.senderEmail !=null and item.senderEmail !=''">
+            and sender_email like concat('%',#{item.senderEmail},'%')
+        </if>
+        <if test="item.emailType !=null">
+            and email_type = #{item.emailType}
+        </if>
+        <if test="errorInfo !=null">
+            and fail_reason like concat('%',#{errorInfo},'%')
+        </if>
+    </select>
+    <select id="countEmailTotal" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.email_parse_info where isvalid=1
+        <if test="emailType !=null">
+            and email_type = #{emailType}
+        </if>
+    </select>
+
+</mapper>

+ 89 - 0
service-base/src/main/resources/mapper/daq/EmailTaskInfoMapper.xml

@@ -0,0 +1,89 @@
+<?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.daq.EmailTaskInfoMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTaskInfoDO">
+        <id column="id" property="id"/>
+        <result column="email" property="email"/>
+        <result column="task_name" property="taskName"/>
+        <result column="task_type" property="taskType"/>
+        <result column="start_time" property="startTime" />
+        <result column="end_time" property="endTime" />
+        <result column="task_status" property="taskStatus"/>
+        <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>
+
+
+    <insert id="insert" parameterType="com.simuwang.base.pojo.dos.EmailTaskInfoDO" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
+        insert into PPW_EMAIL.email_task_info(email, task_name,task_type, start_time, end_time, task_status,
+                                     isvalid, creatorid, createtime, updaterid, updatetime)
+        values (#{itemDo.email}, #{itemDo.taskName}, #{itemDo.taskType}, #{itemDo.startTime}, #{itemDo.endTime}, #{itemDo.taskStatus},
+                #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+    </insert>
+    <update id="updateTaskStatus">
+        update PPW_EMAIL.email_task_info set task_status=#{taskStatus},updatetime=sysdate() where email=#{email} and start_time=#{startTime} and end_time=#{endTime}
+    </update>
+    <update id="updateTaskStatusById">
+        update PPW_EMAIL.email_task_info set task_status=#{taskStatus},updatetime=#{updateTime},end_time=#{endTime} where id=#{id}
+    </update>
+    <delete id="deleteTaskLog">
+        update PPW_EMAIL.email_task_info set isvalid=0,updatetime=sysdate(),updaterid=#{userId} where isvalid=1
+        and id in
+        <foreach collection="idList" index="index" item="id" separator="," open="(" close=")">
+            #{id}
+        </foreach>
+    </delete>
+    <select id="searchTaskList" resultMap="BaseResultMap"
+            parameterType="com.simuwang.base.pojo.dto.query.TaskPageQuery">
+        select task.id,task.email, task.task_name,task.task_type, task.start_time, task.end_time, task.task_status,
+        task.isvalid, task.creatorid, task.createtime, task.updaterid, task.updatetime,u.user_name
+        from PPW_EMAIL.email_task_info task
+        left join PPW_EMAIL.sys_user u
+        on task.creatorid=u.user_id
+        where task.isvalid=1
+        <if test="email != null and email !=''">
+            and task.email like concat('%',#{email},'%')
+        </if>
+        <if test="taskName != null and taskName !=''">
+            and task.task_name like concat('%',#{taskName},'%')
+        </if>
+        <if test="startDate != null and startDate !=''">
+            and task.updatetime >= #{startDate}
+        </if>
+        <if test="taskType != null">
+            and task.task_type = #{taskType}
+        </if>
+        <if test="endDate != null and endDate !=''">
+            and task.updatetime <![CDATA[ <= ]]> #{endDate}
+        </if>
+        order by task.updatetime desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countTaskList" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.TaskPageQuery">
+        select count(1)
+        from PPW_EMAIL.email_task_info task
+        left join PPW_EMAIL.sys_user u
+        on task.creatorid=u.user_id
+        where task.isvalid=1
+        <if test="email != null and email !=''">
+            and task.email like concat('%',#{email},'%')
+        </if>
+        <if test="taskName != null and taskName !=''">
+            and task.task_name like concat('%',#{taskName},'%')
+        </if>
+        <if test="startDate != null and startDate !=''">
+            and task.updatetime >= #{startDate}
+        </if>
+        <if test="endDate != null and endDate !=''">
+            and task.updatetime <![CDATA[ <= ]]> #{endDate}
+        </if>
+        <if test="taskType != null">
+            and task.task_type = #{taskType}
+        </if>
+    </select>
+
+</mapper>

+ 66 - 0
service-base/src/main/resources/mapper/daq/EmailTemplateApplicationRuleMapper.xml

@@ -0,0 +1,66 @@
+<?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.daq.EmailTemplateApplicationRuleMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTemplateApplicationRuleDO">
+        <id column="id" property="id"/>
+        <result column="template_id" property="templateId"/>
+        <result column="type" property="type"/>
+        <result column="row" property="row"/>
+        <result column="column" property="column"/>
+        <result column="contain_keyword" property="containKeyword"/>
+        <result column="not_contain_keyword" property="notContainKeyword"/>
+        <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>
+    <insert id="batchInsert">
+        insert into PPW_EMAIL.email_template_application_rule(template_id,`TYPE`,`ROW`,`COLUMN`,contain_keyword,not_contain_keyword,isvalid,creatorid,createtime,updaterid,updatetime)
+        values
+        <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
+            (#{itemDo.templateId},#{itemDo.type},#{itemDo.row},#{itemDo.column},#{itemDo.containKeyword},#{itemDo.notContainKeyword},
+            #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+        </foreach>
+    </insert>
+    <update id="batchUpdate">
+        <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
+            update PPW_EMAIL.email_template_application_rule
+            <set>
+                template_id=#{itemDo.templateId},
+                `TYPE` = #{itemDo.type},
+                `ROW`=#{itemDo.row},
+                `COLUMN`=#{itemDo.column},
+                contain_keyword=#{itemDo.containKeyword},
+                not_contain_keyword=#{itemDo.notContainKeyword},
+                updatetime=#{itemDo.updateTime},
+                updaterid=#{itemDo.updaterId}
+            </set>
+            where isvalid = 1 and id=#{itemDo.id}
+        </foreach>
+    </update>
+    <update id="deleteByTemplateId">
+        update PPW_EMAIL.email_template_application_rule set isvalid=0,updatetime=sysdate(),updaterid=#{userId}
+        where isvalid=1 and  template_id in
+        <foreach collection="templateIdList" index="index" item="templateId" open="(" separator="," close=")">
+            #{templateId}
+        </foreach>
+    </update>
+    <delete id="deleteByIdList">
+        update PPW_EMAIL.email_template_application_rule set isvalid=0,updatetime=sysdate(),updaterid=#{userId}
+        where isvalid = 1 and id in
+        <foreach collection="idList" index="index" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="queryByTemplateId" resultMap="BaseResultMap">
+        select *
+        from PPW_EMAIL.email_template_application_rule
+        where isvalid = 1
+        and template_id in
+        <foreach collection="templateIdList" index="index" item="templateId" open="(" separator="," close=")">
+            #{templateId}
+        </foreach>
+    </select>
+</mapper>

+ 61 - 0
service-base/src/main/resources/mapper/daq/EmailTemplateDataRuleMapper.xml

@@ -0,0 +1,61 @@
+<?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.daq.EmailTemplateDataRuleMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTemplateDataRuleDO">
+        <id column="id" property="id"/>
+        <result column="template_id" property="templateId"/>
+        <result column="field_name" property="fieldName"/>
+        <result column="position" property="position"/>
+        <result column="row" property="row"/>
+        <result column="column" property="column"/>
+        <result column="field_rule" property="fieldRule"/>
+        <result column="unit_convert" property="unitConvert"/>
+        <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>
+    <insert id="batchInsert">
+        insert into PPW_EMAIL.email_template_data_rule(template_id,field_name,`POSITION`,`ROW`,`COLUMN`,field_rule,unit_convert,isvalid,creatorid,createtime,updaterid,updatetime)
+        values
+        <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
+            (#{itemDo.templateId},#{itemDo.fieldName},#{itemDo.position},#{itemDo.row},#{itemDo.column},#{itemDo.fieldRule},#{itemDo.unitConvert},
+            #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+        </foreach>
+    </insert>
+    <update id="batchUpdate">
+        <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
+            update PPW_EMAIL.email_template_data_rule
+            <set>
+                template_id = #{itemDo.templateId},
+                field_name = #{itemDo.fieldName},
+                `POSITION` = #{itemDo.position},
+                `ROW` = #{itemDo.row},
+                `COLUMN` = #{itemDo.column},
+                field_rule = #{itemDo.fieldRule},
+                unit_convert = #{itemDo.unitConvert},
+                updatetime = #{itemDo.updateTime},
+                updaterid = #{itemDo.updaterId}
+            </set>
+            where isvalid = 1 and id=#{itemDo.id}
+        </foreach>
+    </update>
+    <update id="deleteByTemplateId">
+        update PPW_EMAIL.email_template_data_rule set isvalid=0,updatetime=sysdate(),updaterid=#{userId}
+        where isvalid=1 and template_id in
+        <foreach collection="templateIdList" index="index" item="templateId" open="(" separator="," close=")">
+            #{templateId}
+        </foreach>
+    </update>
+
+    <select id="queryByTemplateId" resultMap="BaseResultMap">
+        select *
+        from PPW_EMAIL.email_template_data_rule
+        where isvalid = 1
+        and template_id in
+        <foreach collection="templateIdList" index="index" item="templateId" open="(" separator="," close=")">
+            #{templateId}
+        </foreach>
+    </select>
+</mapper>

+ 79 - 0
service-base/src/main/resources/mapper/daq/EmailTemplateInfoMapper.xml

@@ -0,0 +1,79 @@
+<?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.daq.EmailTemplateInfoMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTemplateInfoDO">
+        <id column="id" property="id"/>
+        <result column="name" property="name"/>
+        <result column="type" property="type"/>
+        <result column="direction" property="direction"/>
+        <result column="start_index" property="startIndex"/>
+        <result column="end_index" property="endIndex"/>
+        <result column="description" property="description"/>
+        <result column="status" property="status"/>
+        <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>
+    <insert id="saveTemplateInfo"  useGeneratedKeys="true" keyProperty="id">
+        insert into PPW_EMAIL.email_template_info(name,type,direction,start_index,end_index,description,status,isvalid,creatorid,createtime,updaterid,updatetime)
+        values
+            (#{name},#{type},#{direction},#{startIndex},#{endIndex},#{description},#{status},#{isvalid},#{creatorId},#{createTime},#{updaterId},#{updateTime})
+    </insert>
+    <update id="deleteTemplateList">
+        update PPW_EMAIL.email_template_info set isvalid=0,updatetime=sysdate(),updaterid=#{userId} where isvalid=1
+        and id in
+        <foreach item="id" collection="idList" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+    <update id="updateTemplateInfo">
+        update PPW_EMAIL.email_template_info set name=#{name},type=#{type},direction=#{direction},description=#{description},status=#{status},updatetime=#{updateTime},updaterid=#{updaterId}
+        where id=#{id} and isvalid=1
+    </update>
+    <select id="searchTemplateList" resultMap="BaseResultMap">
+        select id,name,type,direction,start_index,end_index,description,status,isvalid,creatorid,createtime,updaterid,updatetime
+        from PPW_EMAIL.email_template_info where isvalid=1
+        <if test="name != null and name !=''">
+            and name like concat('%',#{name},'%')
+        </if>
+        <if test="keyword != null and keyword !=''">
+            and name like concat('%',#{keyword},'%')
+        </if>
+        <if test="type != null">
+            and type =#{type}
+        </if>
+        <if test="status != null">
+            and status =#{status}
+        </if>
+        order by updatetime desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countTemplateList" resultType="java.lang.Long">
+        select count(1)
+        from PPW_EMAIL.email_template_info where isvalid=1
+        <if test="name != null and name !=''">
+            and name like concat('%',#{name},'%')
+        </if>
+        <if test="keyword != null and keyword !=''">
+            and name like concat('%',#{keyword},'%')
+        </if>
+        <if test="type != null">
+            and type =#{type}
+        </if>
+        <if test="status != null">
+            and status =#{status}
+        </if>
+    </select>
+    <select id="searchTemplateById" resultMap="BaseResultMap">
+        select id,name,type,direction,start_index,end_index,description,status,isvalid,creatorid,createtime,updaterid,updatetime
+        from PPW_EMAIL.email_template_info where isvalid=1 and id=#{id}
+    </select>
+    <select id="searchTemplateByName" resultType="com.simuwang.base.pojo.dos.EmailTemplateInfoDO">
+        select id,name,type,direction,start_index,end_index,description,status,isvalid,creatorid,createtime,updaterid,updatetime
+        from PPW_EMAIL.email_template_info where isvalid=1 and name=#{name} limit 1
+    </select>
+
+
+</mapper>

+ 102 - 0
service-base/src/main/resources/mapper/daq/EmailTemplateMappingMapper.xml

@@ -0,0 +1,102 @@
+<?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.daq.EmailTemplateMappingMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTemplateMappingDO">
+        <id column="id" property="id"/>
+        <result column="template_id" property="templateId"/>
+        <result column="title" property="title"/>
+        <result column="email" property="email"/>
+        <result column="company_name" property="companyName"/>
+        <result column="company_id" property="companyId"/>
+        <result column="status" property="status"/>
+        <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"/>
+        <result column="template_name" property="templateName"/>
+    </resultMap>
+    <insert id="saveEmailTemplateMappingDO">
+        insert into PPW_EMAIL.email_template_mapping(template_id,title,email,company_name,company_id,status,isvalid,creatorid,createtime,updaterid,updatetime)
+        values
+            (#{templateId},#{title},#{email},#{companyName},#{companyId},#{status},#{isvalid},#{creatorId},#{createTime},#{updaterId},#{updateTime})
+    </insert>
+    <update id="deleteTemplateSetting">
+        update  PPW_EMAIL.email_template_mapping set isvalid=0,updatetime=sysdate(),updaterid=#{userId}
+        where isvalid=1 and id in
+        <foreach item="id" collection="idList" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+    <update id="updateEmailTemplateMappingDO">
+        update PPW_EMAIL.email_template_mapping set template_id=#{templateId},title=#{title},email=#{email},company_name=#{companyName},company_id=#{companyId},
+                                                    status=#{status},updatetime=#{updateTime},updaterid=#{updaterId}
+        where isvalid=1 and id=#{id}
+    </update>
+
+    <select id="queryByEmail" resultType="com.simuwang.base.pojo.dos.EmailTemplateInfoDO">
+        select t1.template_id as id,
+               t2.direction as direction,
+               t2.type as type,
+               t2.start_index as startIndex,
+               t2.end_index as endIndex
+        from PPW_EMAIL.email_template_mapping t1
+            join PPW_EMAIL.email_template_info t2 on t2.id = t1.template_id and t2.isvalid = 1 and t2.status = 1
+        where t1.email = #{email}
+          and t2.type = #{type}
+          and t1.isvalid = 1
+          and t1.status = 1
+    </select>
+    <select id="searchTemplateSettingList" resultMap="BaseResultMap">
+        select mapping.id,mapping.template_id,mapping.title,mapping.email,mapping.company_name,mapping.company_id,mapping.status,
+        t.name as template_name
+        from PPW_EMAIL.email_template_mapping mapping
+            join PPW_EMAIL.email_template_info t on t.id = mapping.template_id and t.isvalid = 1 and t.status = 1
+        where mapping.isvalid=1
+        <if test="title != null and title != ''">
+            and mapping.title like concat('%',#{title},'%')
+        </if>
+        <if test="email != null and email != ''">
+            and mapping.email like concat('%',#{email},'%')
+        </if>
+        <if test="companyName != null and companyName != ''">
+            and mapping.company_name like concat('%',#{companyName},'%')
+        </if>
+        <if test="templateName != null and templateName != ''">
+            and t.name like concat('%',#{templateName},'%')
+        </if>
+        <if test="status != null">
+            and mapping.status=#{status}
+        </if>
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countTemplateSettingList" resultType="java.lang.Long">
+        select count(mapping.id)
+        from PPW_EMAIL.email_template_mapping mapping
+        join PPW_EMAIL.email_template_info t on t.id = mapping.template_id and t.isvalid = 1 and t.status = 1
+        where mapping.isvalid=1
+        <if test="title != null and title != ''">
+            and mapping.title like concat('%',#{title},'%')
+        </if>
+        <if test="email != null and email != ''">
+            and mapping.email like concat('%',#{email},'%')
+        </if>
+        <if test="companyName != null and companyName != ''">
+            and mapping.company_name like concat('%',#{companyName},'%')
+        </if>
+        <if test="templateName != null and templateName != ''">
+            and t.name like concat('%',#{templateName},'%')
+        </if>
+        <if test="status != null">
+            and mapping.status=#{status}
+        </if>
+    </select>
+    <select id="searchTemplateById" resultMap="BaseResultMap">
+        select mapping.id,mapping.template_id,mapping.title,mapping.email,mapping.company_name,mapping.company_id,mapping.status,
+               t.name as template_name
+        from PPW_EMAIL.email_template_mapping mapping
+                 join PPW_EMAIL.email_template_info t on t.id = mapping.template_id and t.isvalid = 1 and t.status = 1
+        where mapping.isvalid=1 and mapping.id=#{id}
+    </select>
+
+</mapper>

+ 31 - 0
service-base/src/main/resources/mapper/daq/EmailTypeRuleMapper.xml

@@ -0,0 +1,31 @@
+<?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.daq.EmailTypeRuleMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTypeRuleDO">
+        <id column="id" property="id"/>
+        <result column="nav" property="nav"/>
+        <result column="valuation" property="valuation"/>
+        <result column="report" property="report"/>
+        <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>
+
+    <select id="getEmailTypeRule" resultMap="BaseResultMap">
+        select *
+        from PPW_EMAIL.email_type_rule
+        where isvalid = 1 limit 1
+    </select>
+    <select id="searchEmailType" resultMap="BaseResultMap">
+        select id,nav,valuation,report,isvalid,creatorid,createtime,updaterid,updatetime from PPW_EMAIL.email_type_rule where isvalid =1 limit 1
+    </select>
+    <insert id="saveEmailType">
+        insert into PPW_EMAIL.email_type_rule(nav,valuation,report,isvalid,creatorid,createtime,updaterid,updatetime)
+        values (#{nav},#{valuation},#{report},1,#{creatorId},#{createTime},#{updaterId},#{updateTime})
+    </insert>
+    <update id="updateEmailType">
+        update PPW_EMAIL.email_type_rule set nav=#{nav},valuation=#{valuation},report=#{report},updatetime=sysdate(),updaterid=#{updaterId} where id=#{id} and isvalid =1
+    </update>
+</mapper>

+ 170 - 0
service-base/src/main/resources/mapper/daq/FundAliasMapper.xml

@@ -0,0 +1,170 @@
+<?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.daq.FundAliasMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FundAliasDO">
+        <id column="id" property="id"/>
+        <result column="source_fund_name" property="sourceFundName"/>
+        <result column="source_register_number" property="sourceRegisterNumber"/>
+        <result column="target_fund_id" property="targetFundId"/>
+        <result column="target_fund_name" property="targetFundName"/>
+        <result column="target_register_number" property="targetRegisterNumber"/>
+        <result column="company_name" property="companyName"/>
+        <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>
+    <update id="saveFundAlias" parameterType="com.simuwang.base.pojo.dos.FundAliasDO">
+        update PPW_EMAIL.fund_alias set target_fund_id=#{targetFundId},updatetime=#{updateTime}
+        where isvalid =1 and id=#{id}
+    </update>
+    <update id="batchDelete">
+        update PPW_EMAIL.fund_alias set isvalid=0,updatetime=sysdate(),updaterid=#{updaterId} where isvalid =1 and id in
+        <foreach collection="idList" index="index" item="id" separator="," open="(" close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <select id="queryFundByNameAndRegisterNumber" resultMap="BaseResultMap">
+        select alias.target_fund_id,
+               info.fund_name as target_fund_name,
+               info.register_number as target_register_number
+        from PPW_EMAIL.fund_alias alias
+                 join PPW_EMAIL.pvn_fund_info info
+                           on alias.target_fund_id = info.fund_id and info.isvalid=1
+        where alias.isvalid = 1
+          and alias.source_fund_name = #{fundName}
+          and alias.source_register_number = #{registerNumber}
+    </select>
+
+    <select id="queryFundIdByNameAndRegisterNumber" resultMap="BaseResultMap">
+        select *
+        from PPW_EMAIL.fund_alias
+        where isvalid = 1
+          and source_fund_name = #{fundName}
+          and source_register_number = #{registerNumber}
+    </select>
+
+    <select id="queryFundByName" resultMap="BaseResultMap">
+        select alias.target_fund_id,
+               info.fund_name as target_fund_name,
+               info.register_number as target_register_number
+        from PPW_EMAIL.fund_alias alias
+                join PPW_EMAIL.pvn_fund_info info
+                           on alias.target_fund_id = info.fund_id and info.isvalid=1
+        where alias.isvalid = 1
+          and alias.source_fund_name = #{fundName}
+    </select>
+
+    <select id="queryFundIdByName" resultMap="BaseResultMap">
+        select *
+        from PPW_EMAIL.fund_alias
+        where isvalid = 1
+          and source_fund_name = #{fundName}
+    </select>
+
+    <select id="queryFundByRegisterNumber" resultMap="BaseResultMap">
+        select alias.target_fund_id,
+               info.fund_name as target_fund_name,
+               info.register_number as target_register_number
+        from PPW_EMAIL.fund_alias alias
+                 join PPW_EMAIL.pvn_fund_info info
+                           on alias.target_fund_id = info.fund_id and info.isvalid=1
+        where alias.isvalid = 1
+          and alias.source_register_number = #{registerNumber}
+    </select>
+
+    <select id="queryFundIdByRegisterNumber" resultMap="BaseResultMap">
+        select *
+        from PPW_EMAIL.fund_alias
+        where isvalid = 1
+          and source_register_number = #{registerNumber}
+    </select>
+
+    <select id="searchFundAlias" resultMap="BaseResultMap"
+            parameterType="com.simuwang.base.pojo.dto.query.FundAliasPageQuery">
+        select alias.id,
+        alias.source_fund_name,
+        alias.source_register_number,
+        alias.target_fund_id,
+        info.fund_name as target_fund_name,
+        info.register_number as target_register_number,
+        c.company_name as company_name,
+        alias.isvalid,
+        alias.creatorid,
+        alias.createtime,
+        alias.updatetime,
+        alias.updaterid
+        from PPW_EMAIL.fund_alias alias
+        left join PPW_EMAIL.pvn_fund_info info
+        on alias.target_fund_id = info.fund_id and info.isvalid=1
+        left join PPW_EMAIL.pvn_company_info c
+        on c.company_id = info.trust_id and c.isvalid=1
+        where alias.isvalid=1
+        <if test="fundName != null and fundName !=''">
+            and (alias.source_fund_name like concat('%',#{fundName},'%') or alias.source_register_number like concat('%',#{fundName},'%') )
+        </if>
+        <if test="fundAliasName != null and fundAliasName !=''">
+            and (info.fund_name like concat('%',#{fundAliasName},'%')  or info.fund_short_name like concat('%',#{fundAliasName},'%')  or info.register_number like concat('%',#{fundAliasName},'%') )
+        </if>
+        <if test="isMapping != null and isMapping == 0">
+            and alias.target_fund_id is null
+        </if>
+        <if test="isMapping != null and isMapping == 1">
+            and alias.target_fund_id is not null
+        </if>
+        order by alias.updatetime desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countFundAlias" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.FundAliasPageQuery">
+        select count(1) from PPW_EMAIL.fund_alias alias
+        left join PPW_EMAIL.pvn_fund_info info
+        on alias.target_fund_id = info.fund_id and info.isvalid=1
+        left join PPW_EMAIL.pvn_company_info c
+        on c.company_id = info.trust_id and c.isvalid=1
+        where alias.isvalid=1
+        <if test="fundName != null and fundName !=''">
+            and (alias.source_fund_name like concat('%',#{fundName},'%') or alias.source_register_number like concat('%',#{fundName},'%') )
+        </if>
+        <if test="fundAliasName != null and fundAliasName !=''">
+            and (info.fund_name like concat('%',#{fundAliasName},'%')  or info.fund_short_name like concat('%',#{fundAliasName},'%')  or info.register_number like concat('%',#{fundAliasName},'%') )
+        </if>
+        <if test="isMapping != null and isMapping == 0">
+            and alias.target_fund_id is null
+        </if>
+        <if test="isMapping != null and isMapping == 1">
+            and alias.target_fund_id is not null
+        </if>
+    </select>
+    <select id="searchFundAliasById" resultType="com.simuwang.base.pojo.dos.FundAliasDO"
+            parameterType="java.lang.Integer">
+        select alias.id,
+               alias.source_fund_name,
+               alias.source_register_number,
+               alias.target_fund_id,
+               info.fund_name as target_fund_name,
+               info.register_number as target_register_number,
+               alias.isvalid,
+               alias.creatorid,
+               alias.createtime,
+               alias.updatetime,
+               alias.updaterid
+        from PPW_EMAIL.fund_alias alias
+                 left join PPW_EMAIL.pvn_fund_info info
+                           on alias.target_fund_id = info.fund_id and info.isvalid=1
+        where alias.isvalid=1 and alias.id=#{id}
+    </select>
+
+    <insert id="batchInsert">
+        insert into PPW_EMAIL.fund_alias(source_fund_name, source_register_number,target_fund_id,
+                                         isvalid,creatorid,createtime,updaterid,updatetime)
+        values
+        <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
+            (#{itemDo.sourceFundName},#{itemDo.sourceRegisterNumber},#{itemDo.targetFundId},
+            #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+        </foreach>
+    </insert>
+
+</mapper>

+ 23 - 0
service-base/src/main/resources/mapper/daq/FundAliasService.xml

@@ -0,0 +1,23 @@
+<?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.daq.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>
+
+    <select id="queryMarketCode" resultType="java.lang.String">
+        select market_code
+        from PPW_EMAIL.valuation_market_code
+        where isvalid = 1
+        order by sort_id
+    </select>
+
+</mapper>

+ 221 - 0
service-base/src/main/resources/mapper/daq/FundInfoMapper.xml

@@ -0,0 +1,221 @@
+<?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.daq.FundInfoMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FundInfoDO">
+        <id column="id" property="id"/>
+        <result column="p_fund_id" property="pFundId"/>
+        <result column="fund_name" property="fundName"/>
+        <result column="fund_short_name" property="fundShortName"/>
+        <result column="fund_type" property="fundType"/>
+        <result column="manager_type" property="managerType"/>
+        <result column="base_currency" property="baseCurrency"/>
+        <result column="inception_date" property="inceptionDate"/>
+        <result column="advisor_id" property="advisorId"/>
+        <result column="issuer_id" property="issuerId"/>
+        <result column="issuer_company_name" property="issuerCompanyName"/>
+        <result column="advisor_company_name" property="advisorCompanyName"/>
+        <result column="custodian_id" property="custodianId"/>
+        <result column="register_number" property="registerNumber"/>
+        <result column="register_date" property="registerDate"/>
+        <result column="is_amac_show" property="isAmacShow"/>
+        <result column="fund_status" property="fundStatus"/>
+        <result column="amac_source_type" property="amacSourceType"/>
+        <result column="investment_type" property="investmentType"/>
+        <result column="liquidate_date" property="liquidateDate"/>
+        <result column="performance_start_date" property="performanceStartDate"/>
+        <result column="is_shareclass" property="isShareclass"/>
+        <result column="trust_id" property="trustId"/>
+        <result column="trust_company_name" property="trustCompanyName"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updatetime" property="updateTime"/>
+        <result column="isvalid" property="isvalid"/>
+    </resultMap>
+    <select id="searchFundInfoByKeyword" resultType="java.util.Map">
+        select f.fund_id as "fundId",
+        f.fund_short_name as "fundShortName",
+        f.register_number as "registerNumber"
+        from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
+        <if test="keyword != null and keyword !=''">
+            and (f.fund_name like concat('%',#{keyword},'%') or f.fund_short_name like concat('%',#{keyword},'%') or f.register_number like concat('%',#{keyword},'%') or f.fund_id like concat('%',#{keyword},'%'))
+        </if>
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="searchFundInfoList" resultType="com.simuwang.base.pojo.dos.FundInformationDO">
+        select * from (
+        select f.id as id,
+               f.fund_id as fundId,
+               f.fund_short_name as fundShortName,
+               f.register_number as registerNumber,
+               c.company_id as companyId,
+               c.company_short_name as companyShortName,
+               c.company_name as companyName,
+               c.credit_code as creditCode,
+               f.inception_date as inceptionDate,
+               ifnull(n.last_price_date,'') as lastPriceDate,
+               r.nav_frequency as navFrequency,
+               r.asset_Frequency as assetFrequency,
+               r.valuation_Frequency as valuationFrequency,
+               r.frequency_remark as frequencyRemark
+        from PPW_EMAIL.pvn_fund_info f
+        left join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id and c.isvalid =1
+        left join (select nv.fund_id,max(nv.price_date) as last_price_date from PPW_EMAIL.nav nv where nv.isvalid =1 group by nv.fund_id) n
+        on f.fund_id = n .fund_id
+        left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
+        where f.isvalid =1
+        <if test="fundId != null and fundId !=''">
+            and f.fund_id like concat('%',#{fundId},'%')
+        </if>
+        <if test="fundShortName != null and fundShortName !=''">
+            and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%') or f.register_number like concat('%',#{fundShortName},'%'))
+        </if>
+        <if test="companyShortName != null and companyShortName !=''">
+            and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%')  or c.register_number like concat('%',#{companyShortName},'%'))
+        </if>
+        <if test="navFrequency != null and navFrequency !=''">
+            and r.nav_frequency = #{navFrequency}
+        </if>
+        <if test="assetFrequency != null and assetFrequency !=''">
+            and r.asset_Frequency = #{assetFrequency}
+        </if>
+        <if test="valuationFrequency != null and valuationFrequency !=''">
+            and r.valuation_Frequency = #{valuationFrequency}
+        </if>
+        <if test="startDate != null and startDate !=''">
+            and f.inception_date <![CDATA[ >= ]]> #{startDate}
+        </if>
+        <if test="endDate != null and endDate !=''">
+            and f.inception_date <![CDATA[ <= ]]> #{endDate}
+        </if>) a
+        limit #{offset},#{pageSize}
+        order by a.lastPriceDate desc
+    </select>
+
+    <select id="queryFundByNameAndRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
+        select fund_id         as fundId,
+               fund_name       as fundName,
+               register_number as registerNumber
+        from PPW_EMAIL.pvn_fund_info
+        where isvalid = 1
+          and fund_name = #{fundName}
+          and register_number = #{registerNumber}
+    </select>
+
+    <select id="queryFundByName" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
+        select fund_id         as fundId,
+               fund_name       as fundName,
+               register_number as registerNumber
+        from PPW_EMAIL.pvn_fund_info
+        where isvalid = 1
+          and fund_name = #{fundName}
+    </select>
+
+    <select id="queryFundByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundInfoDO">
+        select fund_id         as fundId,
+               fund_name       as fundName,
+               register_number as registerNumber
+        from PPW_EMAIL.pvn_fund_info
+        where isvalid = 1
+          and register_number = #{registerNumber}
+    </select>
+    <select id="countFundInfoByKeyword" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.FundInputPageQuery">
+        select count(f.fund_id)
+        from PPW_EMAIL.pvn_fund_info f where f.isvalid =1
+        <if test="keyword != null and keyword !=''">
+            and (f.fund_name like concat('%',#{keyword},'%') or f.fund_short_name like concat('%',#{keyword},'%') or f.register_number like concat('%',#{keyword},'%') or f.fund_id like concat('%',#{keyword},'%'))
+        </if>
+    </select>
+    <select id="countFundInfo" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.FundInfoPageQuery">
+        select count(f.fund_id)
+        from PPW_EMAIL.pvn_fund_info f
+        left join PPW_EMAIL.pvn_company_info c on f.trust_id = c.company_id and c.isvalid =1
+        left join (select nv.fund_id,max(nv.price_date) as last_price_date from PPW_EMAIL.nav nv where nv.isvalid =1 group by nv.fund_id) n
+        on f.fund_id = n .fund_id
+        left join PPW_EMAIL.fund_report_frequency r on r.fund_id = f.fund_id and r.isvalid =1
+        where f.isvalid =1
+        <if test="fundId != null and fundId !=''">
+            and f.fund_id like concat('%',#{fundId},'%')
+        </if>
+        <if test="fundShortName != null and fundShortName !=''">
+            and (f.fund_name like concat('%',#{fundShortName},'%') or f.fund_short_name like concat('%',#{fundShortName},'%')  or f.register_number like concat('%',#{fundShortName},'%'))
+        </if>
+        <if test="companyShortName != null and companyShortName !=''">
+            and (c.company_name like concat('%',#{companyShortName},'%') or c.company_short_name like concat('%',#{companyShortName},'%')  or c.register_number like concat('%',#{companyShortName},'%'))
+        </if>
+        <if test="navFrequency != null and navFrequency !=''">
+            and r.nav_frequency = #{navFrequency}
+        </if>
+        <if test="assetFrequency != null and assetFrequency !=''">
+            and r.asset_Frequency = #{assetFrequency}
+        </if>
+        <if test="valuationFrequency != null and valuationFrequency !=''">
+            and r.valuation_Frequency = #{valuationFrequency}
+        </if>
+        <if test="startDate != null and startDate !=''">
+            and f.inception_date <![CDATA[ >= ]]> #{startDate}
+        </if>
+        <if test="endDate != null and endDate !=''">
+            and f.inception_date <![CDATA[ <= ]]> #{endDate}
+        </if>
+    </select>
+    <select id="getFundNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
+        select fund_name from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
+    </select>
+    <select id="queryFundIdByName" resultType="java.lang.String" parameterType="java.lang.String">
+        select fund_id
+        from PPW_EMAIL.pvn_fund_info
+        where isvalid = 1
+          and fund_name = #{fundName} limit 1
+    </select>
+    <select id="getCompanyNameByFundId" resultType="java.lang.String" parameterType="java.lang.String">
+        select c.company_name from PPW_EMAIL.pvn_company_info c
+        join PPW_EMAIL.pvn_fund_info info on info.trust_id=c.company_id
+        where info.fund_id=#{fundId} and info.isvalid=1 and c.isvalid=1
+    </select>
+    <select id="getLiquidateDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
+        select liquidate_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
+    </select>
+    <select id="getFundIdByCompanyId" resultType="java.lang.String" parameterType="java.lang.String">
+        select info.fund_id from PPW_EMAIL.pvn_fund_info info join PPW_EMAIL.pvn_company_info c on info.trust_id=c.company_id
+        where info.isvalid=1 and c.isvalid=1 and c.company_id=#{companyId}
+    </select>
+    <select id="getInceptionDateByFundId" resultType="java.lang.String" parameterType="java.lang.String">
+        select inception_date from PPW_EMAIL.pvn_fund_info where fund_id=#{fundId} and isvalid=1
+    </select>
+
+    <select id="queryFundAndTrustByRegisterNumber" resultType="com.simuwang.base.pojo.dos.FundAndCompanyInfoDO">
+        select t.fund_id         as fundId,
+               t.fund_name       as fundName,
+               t.register_number as registerNumber,
+               t1.company_id as companyId,
+               t1.company_name as companyName
+        from PPW_EMAIL.pvn_fund_info t
+            left join PPW_EMAIL.pvn_company_info t1 on t1.isvalid = 1 and t1.company_id = t.trust_id
+        where t.isvalid = 1
+          and t.register_number = #{registerNumber}
+        limit 1
+    </select>
+    <select id="searchFundDetail" resultMap="BaseResultMap"
+            parameterType="java.lang.String">
+        select info.id,info.p_fund_id,info.fund_id,info.fund_name,
+               info.fund_short_name,info.fund_type,info.manager_type,
+               info.base_currency,info.inception_date,info.advisor_id,a.company_name as advisor_company_name,
+               info.issuer_id,ic.company_name as issuer_company_name,t.company_name as trust_company_name,info.custodian_id,info.trust_id,
+               info.register_number,info.register_date,info.createtime,
+               info.is_amac_show,info.fund_status,info.amac_source_type,
+               info.investment_type,info.liquidate_date,info.performance_start_date,
+               info.is_shareclass,info.amac_url
+        from PPW_EMAIL.pvn_fund_info info
+        left join PPW_EMAIL.pvn_company_info a
+                  on info.advisor_id = a.company_id and a.isvalid=1
+        left join PPW_EMAIL.pvn_company_info t
+                  on info.trust_id = t.company_id and t.isvalid=1
+        left join PPW_EMAIL.pvn_company_info ic
+                  on info.issuer_id = ic.company_id and ic.isvalid=1
+        where info.isvalid=1 and info.fund_id=#{fundId}
+    </select>
+    <select id="countFundTotal" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.pvn_fund_info where isvalid=1
+    </select>
+</mapper>

+ 95 - 0
service-base/src/main/resources/mapper/daq/FundNavAssetMapper.xml

@@ -0,0 +1,95 @@
+<?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.daq.FundNavAssetMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FundNavAssetDO">
+        <result column="fund_id" property="fundId"/>
+        <result column="fund_short_name" property="fundName"/>
+        <result column="price_date" property="priceDate"/>
+        <result column="nav" property="nav"/>
+        <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
+        <result column="asset_share" property="assetShare"/>
+        <result column="asset_net" property="assetNet"/>
+        <result column="updatetime" property="updateTime"/>
+    </resultMap>
+    <select id="searchNavAssetList" resultMap="BaseResultMap"
+            parameterType="com.simuwang.base.pojo.dto.query.FundNavAssetPageQuery">
+        SELECT distinct
+        info.fund_id,
+        info.fund_short_name,
+        IFNULL(
+        nav.price_date,
+        asset.price_date
+        ) AS price_date,
+        nav.nav,
+        nav.cumulative_nav_withdrawal,
+        asset.asset_share,
+        asset.asset_net,
+        CASE
+        WHEN nav.updatetime is null
+        THEN asset.updatetime
+        WHEN asset.updatetime is null
+        THEN nav.updatetime
+        WHEN asset.updatetime >= nav.updatetime
+        THEN asset.updatetime
+        ELSE nav.updatetime
+        END AS updatetime
+        FROM
+        PPW_EMAIL.pvn_fund_info info
+        LEFT JOIN PPW_EMAIL.nav nav
+        ON info.fund_id = nav.fund_id
+        AND nav.isvalid = 1
+        LEFT JOIN PPW_EMAIL.asset asset
+        ON info.fund_id = asset.fund_id
+        AND nav.price_date = asset.price_date
+        AND asset.isvalid = 1
+        WHERE info.isvalid = 1
+        and (nav.nav is not null or asset.asset_share is not null or asset.asset_net is not null)
+        <if test="fundName != null and fundName !=''">
+            and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%') or info.register_number like concat('%',#{fundName},'%'))
+        </if>
+        <if test="priceStartDate != null and priceStartDate !=''">
+            and (nav.price_date >= #{priceStartDate} or asset.price_date >= #{priceStartDate})
+        </if>
+        <if test="priceEndDate != null and priceEndDate !=''">
+            and (nav.price_date <![CDATA[ <= ]]> #{priceEndDate} or asset.price_date <![CDATA[ <= ]]> #{priceEndDate})
+        </if>
+        <if test="updateStartDate != null and updateStartDate !=''">
+            and (nav.updatetime >= #{updateStartDate} or asset.updatetime >= #{updateStartDate})
+        </if>
+        <if test="updateEndDate != null and updateEndDate !=''">
+            and (nav.updatetime <![CDATA[ <= ]]> #{updateEndDate} or asset.updatetime <![CDATA[ <= ]]> #{updateEndDate})
+        </if>
+        order by updatetime desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countNavAssetList" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.FundNavAssetPageQuery">
+        SELECT count(1)
+        FROM
+        PPW_EMAIL.pvn_fund_info info
+        LEFT JOIN PPW_EMAIL.nav nav
+        ON info.fund_id = nav.fund_id
+        AND nav.isvalid = 1
+        LEFT JOIN PPW_EMAIL.asset asset
+        ON info.fund_id = asset.fund_id
+        AND nav.price_date = asset.price_date
+        AND asset.isvalid = 1
+        WHERE info.isvalid = 1
+        and (nav.nav is not null or asset.asset_share is not null or asset.asset_net is not null)
+        <if test="fundName != null and fundName !=''">
+            and (info.fund_name like concat('%',#{fundName},'%') or info.fund_short_name like concat('%',#{fundName},'%') or info.register_number like concat('%',#{fundName},'%'))
+        </if>
+        <if test="priceStartDate != null and priceStartDate !=''">
+            and (nav.price_date >= #{priceStartDate} or asset.price_date >= #{priceStartDate})
+        </if>
+        <if test="priceEndDate != null and priceEndDate !=''">
+            and (nav.price_date <![CDATA[ <= ]]> #{priceEndDate} or asset.price_date <![CDATA[ <= ]]> #{priceEndDate})
+        </if>
+        <if test="updateStartDate != null and updateStartDate !=''">
+            and (nav.updatetime >= #{updateStartDate} or asset.updatetime >= #{updateStartDate})
+        </if>
+        <if test="updateEndDate != null and updateEndDate !=''">
+            and (nav.updatetime <![CDATA[ <= ]]> #{updateEndDate} or asset.updatetime <![CDATA[ <= ]]> #{updateEndDate})
+        </if>
+    </select>
+</mapper>

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

@@ -0,0 +1,59 @@
+<?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.daq.FundPositionDetailMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FundPositionDetailDO">
+        <id column="id" property="id"/>
+        <result column="valuation_id" property="valuationId"/>
+        <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>
+
+    <delete id="deleteUnUsed">
+        update PPW_EMAIL.fund_position_detail
+        set isvalid    = 0
+        where fund_id = #{fundId}
+          and valuation_date = #{valuationDate}
+    </delete>
+    <select id="fundPositionDetailByFundId" resultMap="BaseResultMap"
+            parameterType="java.lang.String">
+        select distinct fund_id,valuation_date from PPW_EMAIL.fund_position_detail where fund_id=#{fundId} and isvalid=1
+    </select>
+
+    <insert id="insertMulti" parameterType="com.simuwang.base.pojo.dos.FundPositionDetailDO">
+        INSERT INTO PPW_EMAIL.fund_position_detail (
+        fund_id,valuation_id,valuation_date,LEVEL,currency,exchange_rate,subject_code,
+        securities_amount, securities_code,securities_name, sec_type,market_value,
+        market_value_ratio,nature,subject_type,increment,halt_info,net_cost,net_cost_ratio,market_price,
+        unit_cost,isvalid,creatorid,createtime
+        ) VALUES
+        <foreach collection="details" index="index" item="detail" separator=",">
+            (#{detail.fundId},#{detail.valuationId},#{detail.valuationDate},#{detail.level}, #{detail.currency}, #{detail.exchangeRate}, #{detail.subjectCode},
+             #{detail.securitiesAmount},#{detail.securitiesCode}, #{detail.securitiesName}, #{detail.secType},#{detail.marketValue},
+             #{detail.marketValueRatio}, #{detail.nature},
+             #{detail.subjectType},#{detail.increment},#{detail.haltInfo},#{detail.netCost},#{detail.netCostRatio},#{detail.marketPrice},
+             #{detail.unitCost},#{detail.isvalid},0,#{detail.createTime})
+        </foreach>
+    </insert>
+
+</mapper>

+ 35 - 0
service-base/src/main/resources/mapper/daq/FundReportFrequencyMapper.xml

@@ -0,0 +1,35 @@
+<?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.daq.FundReportFrequencyMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FundReportFrequencyDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="nav_frequency" property="navFrequency"/>
+        <result column="asset_frequency" property="assetFrequency"/>
+        <result column="valuation_frequency" property="valuationFrequency"/>
+        <result column="frequency_remark" property="frequencyRemark"/>
+        <result column="creatorid" property="creatorId"/>
+        <result column="updaterid" property="updaterId"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updatetime" property="updateTime"/>
+        <result column="isvalid" property="isvalid"/>
+    </resultMap>
+    <sql id="selectFundReportFrequencyVo">
+        select id, fund_id, nav_frequency, frequency_remark, asset_frequency, creatorid, updaterid, updatetime, createtime, isvalid,valuation_frequency
+        from PPW_EMAIL.fund_report_frequency
+    </sql>
+    <sql id="sqlwhereSearch">
+        <where>
+            isvalid =1
+            <if test="fundId !=null and fundId != ''">
+                and fund_id = #{fundId}
+            </if>
+        </where>
+    </sql>
+    <select id="getFrequencyByFundId" resultType="com.simuwang.base.pojo.dos.FundReportFrequencyDO"
+            parameterType="java.lang.String">
+        <include refid="selectFundReportFrequencyVo"/>
+        <include refid="sqlwhereSearch"/>
+    </select>
+
+</mapper>

+ 68 - 0
service-base/src/main/resources/mapper/daq/MailBoxInfoMapper.xml

@@ -0,0 +1,68 @@
+<?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.daq.MailboxInfoMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.MailboxInfoDO">
+        <id column="id" property="id"/>
+        <result column="type" property="type"/>
+        <result column="email" property="email"/>
+        <result column="password" property="password"/>
+        <result column="protocol" property="protocol"/>
+        <result column="server" property="server"/>
+        <result column="port" property="port"/>
+        <result column="cron" property="cron"/>
+        <result column="open_status" property="openStatus"/>
+        <result column="description" property="description"/>
+        <result column="creatorid" property="creatorId"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updaterid" property="updaterId"/>
+        <result column="updatetime" property="updateTime"/>
+        <result column="isvalid" property="isvalid"/>
+    </resultMap>
+    <update id="deleteEmailConfigByIds">
+        update PPW_EMAIL.mailbox_info set isvalid =0,updatetime=sysdate(),updaterid=#{updaterId} where id in
+        <foreach item="id" collection="ids" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <select id="listMailboxInfo" resultMap="BaseResultMap">
+        select *
+        from PPW_EMAIL.mailbox_info
+        where isvalid = 1
+          and open_status = 1
+    </select>
+    <select id="searchEmailConfigList" resultMap="BaseResultMap">
+        select id, type, email, password, protocol, server, port, cron, open_status,description,isvalid,creatorid,createtime,updaterid,updatetime from PPW_EMAIL.mailbox_info
+        where isvalid = 1
+        <if test="email != null and email != ''">
+            and email like concat('%',#{email},'%')
+        </if>
+        limit #{offset},#{pageSize}
+    </select>
+    <sql id="selectConfigVo">
+        select id, type, email, password, protocol, server, port, cron, open_status,description,isvalid,creatorid,createtime,updaterid,updatetime
+        from PPW_EMAIL.mailbox_info
+    </sql>
+    <select id="selectEmailConfigByEmail" resultType="com.simuwang.base.pojo.dos.MailboxInfoDO">
+        <include refid="selectConfigVo"/>
+        where email = #{email} and isvalid =1 limit 1
+    </select>
+    <select id="countEmailConfig" resultType="java.lang.Long"
+            parameterType="com.simuwang.base.pojo.dto.query.EmailPageQuery">
+        select count(1) from PPW_EMAIL.mailbox_info
+        where isvalid = 1
+        <if test="email != null and email != ''">
+            and email like concat('%',#{email},'%')
+        </if>
+    </select>
+    <select id="searchEmailConfigById" resultMap="BaseResultMap"
+            parameterType="java.lang.Integer">
+        <include refid="selectConfigVo"/>
+        where id = #{id}
+    </select>
+    <select id="getAll" resultMap="BaseResultMap">
+        <include refid="selectConfigVo"/>
+        where isvalid = 1
+    </select>
+
+</mapper>

+ 136 - 0
service-base/src/main/resources/mapper/daq/NavMapper.xml

@@ -0,0 +1,136 @@
+<?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.daq.NavMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.NavDO">
+        <id column="id" property="id"/>
+        <result column="fund_id" property="fundId"/>
+        <result column="price_date" property="priceDate"/>
+        <result column="nav" property="nav"/>
+        <result column="cumulative_nav" property="cumulativeNav"/>
+        <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>
+        <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>
+
+    <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.NavDO">
+        insert into PPW_EMAIL.nav(fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
+                                  isvalid, creatorid, createtime, updaterid, updatetime)
+        values
+        <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
+            (#{itemDo.fundId},#{itemDo.priceDate},#{itemDo.nav},#{itemDo.cumulativeNav},#{itemDo.cumulativeNavWithdrawal},
+            #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+        </foreach>
+
+    </insert>
+
+    <insert id="batchUpdate">
+        <foreach collection="itemDoList" item="itemDo" index="index" open="" close="" separator=";">
+            update PPW_EMAIL.nav
+            <set>
+                nav = #{itemDo.nav},
+                cumulative_nav_withdrawal = #{itemDo.cumulativeNavWithdrawal},
+                updatetime=#{itemDo.updateTime}
+            </set>
+            where isvalid = 1
+            and fund_id = #{itemDo.fundId}
+            and price_date = #{itemDo.priceDate}
+        </foreach>
+    </insert>
+    <insert id="saveNav" parameterType="com.simuwang.base.pojo.dos.NavDO">
+        insert into PPW_EMAIL.nav(fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
+        isvalid, creatorid, createtime, updaterid, updatetime)
+        values
+            (#{fundId},#{priceDate},#{nav},#{cumulativeNav},#{cumulativeNavWithdrawal},
+            #{isvalid}, #{creatorId}, #{createTime}, #{updaterId}, #{updateTime})
+    </insert>
+    <update id="updateNav" parameterType="com.simuwang.base.pojo.dos.NavDO">
+        update PPW_EMAIL.nav
+        <set>
+            nav = #{nav},
+            cumulative_nav_withdrawal = #{cumulativeNavWithdrawal},
+            updatetime=#{updateTime}
+        </set>
+        where isvalid = 1
+        and id=#{id}
+    </update>
+    <update id="batchDeleteNav">
+        update PPW_EMAIL.nav set isvalid=0,updatetime=sysdate() where fund_id=#{fundId}
+        and price_date in
+        <foreach collection="priceDateList" index="index" item="priceDate" separator="," open="(" close=")">
+            #{priceDate}
+        </foreach>
+    </update>
+    <delete id="deleteNav">
+        update PPW_EMAIL.nav set isvalid=0,updatetime=sysdate(),updaterid=#{updaterId} where fund_id=#{fundId} and price_date=#{priceDate}
+    </delete>
+
+    <select id="queryFundNavByDate" resultType="java.lang.String">
+        select price_date
+        from PPW_EMAIL.nav
+        where isvalid = 1
+          and fund_id = #{fundId}
+        and price_date in
+        <foreach collection="priceDateList" index="index" item="priceDate" separator="," open="(" close=")">
+            #{priceDate}
+        </foreach>
+    </select>
+    <select id="queryFundNav" resultMap="BaseResultMap"
+            parameterType="com.simuwang.base.pojo.dos.NavDO">
+        SELECT id, fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
+               isvalid, creatorid, createtime, updaterid, updatetime
+        from PPW_EMAIL.nav
+        where isvalid = 1
+          and fund_id = #{fundId}
+          and price_date=#{priceDate}
+    </select>
+    <select id="getAllFundId" resultType="java.lang.String">
+        select distinct fund_id from PPW_EMAIL.nav where isvalid=1
+    </select>
+    <select id="selectNavByFundId" resultMap="BaseResultMap"
+            parameterType="java.lang.String">
+        SELECT id, fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
+               isvalid, creatorid, createtime, updaterid, updatetime
+        from PPW_EMAIL.nav
+        where isvalid = 1
+          and fund_id = #{fundId}
+        order by price_date
+    </select>
+    <select id="countNavTotal" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.nav where isvalid=1
+    </select>
+    <select id="countNavByTime" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.nav where updatetime <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate !=''">
+            and updatetime >= #{startDate}
+        </if>
+    </select>
+    <select id="selectNavListByTime" resultMap="BaseResultMap">
+        select id,fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
+               isvalid, creatorid, createtime, updaterid, updatetime
+        from PPW_EMAIL.nav where updatetime <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate !=''">
+            and updatetime >= #{startDate}
+        </if>
+        order by id
+    </select>
+    <select id="selectMaxMinId" resultType="java.util.Map">
+        select max(id) as maxId,min(id) as minId from PPW_EMAIL.nav where updatetime <![CDATA[ <= ]]> #{endDate}
+        <if test="startDate != null and startDate !=''">
+            and updatetime >= #{startDate}
+        </if>
+    </select>
+    <select id="selectNavListById" resultType="com.simuwang.base.pojo.dos.NavDO">
+        select id,fund_id,price_date,nav,cumulative_nav,cumulative_nav_withdrawal,
+        isvalid, creatorid, createtime, updaterid, updatetime
+        from PPW_EMAIL.nav where updatetime <![CDATA[ <= ]]> #{endDate} and id >= #{minId} and id <![CDATA[ <= ]]> #{maxId}
+        <if test="startDate != null and startDate !=''">
+            and updatetime >= #{startDate}
+        </if>
+        order by id
+    </select>
+
+
+</mapper>

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

@@ -0,0 +1,34 @@
+<?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.daq.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>
+
+    <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.PdfValuationRecordDO"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into PPW_EMAIL.pdf_valuation_record ( fund_id, upload_date, file_name, pdf_url,
+        excel_url,from_email,is_success,reason,
+        creatorid, createtime, updaterid, updatetime, isvalid)
+        values
+        <foreach collection="itemDoList" index="index" item="itemDo" separator=",">
+            (#{itemDo.fundId},#{itemDo.uploadDate},#{itemDo.fileName}, #{itemDo.pdfUrl},
+            #{itemDo.excelUrl},#{itemDo.fromEmail},#{itemDo.isSuccess},#{itemDo.reason},
+            #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime}, #{itemDo.isvalid})
+        </foreach>
+    </insert>
+
+</mapper>

+ 23 - 0
service-base/src/main/resources/mapper/daq/TradeDateMapper.xml

@@ -0,0 +1,23 @@
+<?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.daq.TradeDateMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.TradeDateDO">
+        <id column="id" property="id"/>
+        <result column="trade_date" property="tradeDate"/>
+        <result column="end_year" property="endYear"/>
+        <result column="yearmonth" property="yearmonth"/>
+        <result column="week_of_year" property="weekOfYear"/>
+        <result column="year_week" property="yearWeek"/>
+        <result column="day_of_week" property="dayOfWeek"/>
+        <result column="isholiday" property="isholiday"/>
+        <result column="isvalid" property="isvalid"/>
+        <result column="createtime" property="createTime"/>
+        <result column="updatetime" property="updateTime"/>
+    </resultMap>
+    <select id="selectTradeDate" resultMap="BaseResultMap">
+        select id,trade_date,end_year,yearmonth,week_of_year,year_week,day_of_week,isholiday,isvalid,createtime,updatetime
+        from PPW_EMAIL.pvn_trade_date where isvalid=1 and isholiday=0 and trade_date>=#{startDate} and trade_date <![CDATA[ <= ]]> #{endDate}
+    </select>
+
+
+</mapper>

+ 53 - 0
service-base/src/main/resources/mapper/daq/ValuationTableAttributeMapper.xml

@@ -0,0 +1,53 @@
+<?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.daq.ValuationTableAttributeMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.ValuationTableAttributeDO">
+        <id column="id" property="id"/>
+        <result column="valuation_id" property="valuationId"/>
+        <result column="subject_code" property="subjectCode"/>
+        <result column="subject_name" property="subjectName"/>
+        <result column="currency" property="currency"/>
+        <result column="exchange_rate" property="exchangeRate"/>
+        <result column="securities_amount" property="securitiesAmount"/>
+        <result column="unit_cost" property="unitCost"/>
+        <result column="ori_currency_cost" property="oriCurrencyCost"/>
+        <result column="net_cost" property="netCost"/>
+        <result column="net_cost_ratio" property="netCostRatio"/>
+        <result column="market_price" property="marketPrice"/>
+        <result column="ori_currency_market_value" property="oriCurrencyMarketValue"/>
+        <result column="market_value" property="marketValue"/>
+        <result column="market_value_ratio" property="marketValueRatio"/>
+        <result column="ori_currency_increment" property="oriCurrencyIncrement"/>
+        <result column="increment" property="increment"/>
+        <result column="halt_info" property="haltInfo"/>
+        <result column="rights_interests_info" property="rightsInterestsInfo"/>
+        <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>
+
+    <delete id="deleteByValuationId">
+        delete
+        from PPW_EMAIL.valuation_table_attribute
+        where valuation_id = #{valuationId}
+          and isvalid = 1
+    </delete>
+
+    <insert id="batchInsert" parameterType="com.simuwang.base.pojo.dos.ValuationTableAttributeDO">
+        insert into PPW_EMAIL.valuation_table_attribute(valuation_id, subject_code, subject_name, currency, exchange_rate, securities_amount,
+                                                        unit_cost, ori_currency_cost, net_cost, net_cost_ratio, market_price, ori_currency_market_value,
+                                                        market_value, market_value_ratio, ori_currency_increment, increment, halt_info, rights_interests_info,
+                                                        isvalid, creatorid, createtime, updaterid, updatetime)
+        values
+        <foreach collection="itemDoList" item="itemDo" index="index" separator=",">
+            (#{itemDo.valuationId},#{itemDo.subjectCode},#{itemDo.subjectName},#{itemDo.currency},#{itemDo.exchangeRate},#{itemDo.securitiesAmount},
+             #{itemDo.unitCost},#{itemDo.oriCurrencyCost},#{itemDo.netCost},#{itemDo.netCostRatio},#{itemDo.marketPrice},#{itemDo.oriCurrencyMarketValue},
+             #{itemDo.marketValue},#{itemDo.marketValueRatio},#{itemDo.oriCurrencyIncrement},#{itemDo.increment},#{itemDo.haltInfo},#{itemDo.rightsInterestsInfo},
+            #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
+        </foreach>
+    </insert>
+
+
+</mapper>

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

@@ -0,0 +1,72 @@
+<?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.daq.ValuationTableMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.ValuationTableDO">
+        <id column="id" property="id"/>
+        <result column="file_id" property="fileId"/>
+        <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>
+
+    <update id="unValid">
+        update  PPW_EMAIL.valuation_table
+        set isvalid = 0
+        where file_id = #{fileId}
+    </update>
+    <select id="selectValuationTableByFundId" resultMap="BaseResultMap"
+            parameterType="java.lang.String">
+        select distinct fund_id,valuation_date from PPW_EMAIL.valuation_table where fund_id=#{fundId} and isvalid=1 and valuation_date is not null
+    </select>
+
+    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.simuwang.base.pojo.dos.ValuationTableDO" useGeneratedKeys="true">
+        <!--@mbg.generated-->
+        insert into PPW_EMAIL.valuation_table (fund_id,file_id,
+        title, valuation_date, nav,
+        head_info, tail_info, original_file,
+        converted_file, file_url, table_type,
+        isvalid, creatorid, createtime,
+        updaterid, updatetime, is_analyzed,
+        total_market_value,net_assets_value,increment,from_email)
+        values (#{fundId,jdbcType=VARCHAR},#{fileId,jdbcType=INTEGER},
+        #{title,jdbcType=VARCHAR}, #{valuationDate,jdbcType=DATE}, #{nav,jdbcType=DECIMAL},
+        #{headInfo,jdbcType=VARCHAR}, #{tailInfo,jdbcType=VARCHAR}, #{originalFile,jdbcType=VARCHAR},
+        #{convertedFile,jdbcType=VARCHAR}, #{fileUrl,jdbcType=VARCHAR}, #{tableType,jdbcType=TINYINT},
+        #{isvalid,jdbcType=INTEGER}, #{creatorId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
+        #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{isAnalyzed,jdbcType=TINYINT},
+        #{totalMarketValue,jdbcType=DECIMAL},#{netAssetsValue,jdbcType=DECIMAL},#{increment,jdbcType=DECIMAL},
+        #{fromEmail,jdbcType=TINYINT})
+    </insert>
+
+    <update id="updateUpdateAnalyzed">
+        update PPW_EMAIL.valuation_table
+        set is_analyzed = 1,
+            has_stock = #{hasStock},
+            has_bond = #{hasBond},
+            has_future = #{hasFuture}
+        where valuation_date = #{valuationDate}
+          and fund_id = #{fundId}
+          and isvalid = 1
+    </update>
+
+</mapper>

+ 137 - 0
service-base/src/main/resources/mapper/daq/system/SysConfigMapper.xml

@@ -0,0 +1,137 @@
+<?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.daq.system.SysConfigMapper">
+    
+    <resultMap type="com.simuwang.base.pojo.dos.SysConfigDO" id="SysConfigResult">
+    	<id     property="configId"      column="config_id"      />
+        <result property="configName"    column="config_name"    />
+        <result property="configKey"     column="config_key"     />
+        <result property="configValue"   column="config_value"   />
+        <result property="configType"    column="config_type"    />
+        <result property="creatorId"     column="creatorid"      />
+        <result property="createTime"    column="createtime"    />
+        <result property="updaterId"     column="updaterid"      />
+        <result property="updateTime"    column="updatetime"    />
+        <result property="isvalid"       column="isvalid"    />
+    </resultMap>
+    
+    <sql id="selectConfigDo">
+        select config_id, config_name, config_key, config_value, config_type, creatorid, createtime, updaterid, updatetime, remark,isvalid
+		from PPW_EMAIL.sys_config
+    </sql>
+    
+    <!-- 查询条件 -->
+	<sql id="sqlwhereSearch">
+		<where>
+            isvalid=1
+			<if test="configId !=null">
+				and config_id = #{configId}
+			</if>
+			<if test="configKey !=null and configKey != ''">
+				and config_key = #{configKey}
+			</if>
+		</where>
+	</sql>
+    
+    <select id="selectConfig" parameterType="com.simuwang.base.pojo.dos.SysConfigDO" resultMap="SysConfigResult">
+        <include refid="selectConfigDo"/>
+        <include refid="sqlwhereSearch"/>
+    </select>
+    
+    <select id="selectConfigList" resultMap="SysConfigResult">
+        <include refid="selectConfigDo"/>
+        <where>
+            isvalid=1
+			<if test="configName != null and configName != ''">
+				AND config_name like concat('%', #{configName}, '%')
+			</if>
+			<if test="configKey != null and configKey != ''">
+				AND config_key like concat('%', #{configKey}, '%')
+			</if>
+		</where>
+		order by updatetime desc
+		limit #{offset},#{pageSize}
+    </select>
+    
+    <select id="selectConfigById" resultMap="SysConfigResult">
+        <include refid="selectConfigDo"/>
+        where config_id = #{configId} and isvalid =1
+    </select>
+	
+    <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
+        <include refid="selectConfigDo"/>
+        where config_key = #{configKey}  and isvalid =1 limit 1
+    </select>
+    <select id="selectConfigByKey" resultType="java.lang.String">
+            select config_value from PPW_EMAIL.sys_config where config_key = #{configKey}  and isvalid =1 limit 1
+    </select>
+    <select id="countConfigList" resultType="java.lang.Long">
+        select count(1) from PPW_EMAIL.sys_config
+        <where>
+            isvalid=1
+            <if test="configName != null and configName != ''">
+                AND config_name like concat('%', #{configName}, '%')
+            </if>
+            <if test="configKey != null and configKey != ''">
+                AND config_key like concat('%', #{configKey}, '%')
+            </if>
+        </where>
+    </select>
+
+    <insert id="insertConfig" parameterType="com.simuwang.base.pojo.dos.SysConfigDO">
+        insert into sys_config (
+			<if test="configName != null and configName != '' ">config_name,</if>
+			<if test="configKey != null and configKey != '' ">config_key,</if>
+			<if test="configValue != null and configValue != '' ">config_value,</if>
+			<if test="configType != null and configType != '' ">config_type,</if>
+			<if test="creatorId != null and creatorId != ''">creatorid,</if>
+            <if test="updaterId != null and updaterId != ''">updaterid,</if>
+			<if test="remark != null and remark != ''">remark,</if>
+            isvalid,
+ 			createtime,
+            updatetime
+        )values(
+			<if test="configName != null and configName != ''">#{configName},</if>
+			<if test="configKey != null and configKey != ''">#{configKey},</if>
+			<if test="configValue != null and configValue != ''">#{configValue},</if>
+			<if test="configType != null and configType != ''">#{configType},</if>
+			<if test="creatorId != null and creatorId != ''">#{creatorId},</if>
+            <if test="updaterId != null and updaterId != ''">#{updaterId},</if>
+			<if test="remark != null and remark != ''">#{remark},</if>
+            1,
+ 			sysdate(),
+            sysdate()
+		)
+    </insert>
+	 
+    <update id="updateConfig" parameterType="com.simuwang.base.pojo.dos.SysConfigDO">
+        update sys_config 
+        <set>
+            <if test="configName != null and configName != ''">config_name = #{configName},</if>
+            <if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
+            <if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
+            <if test="configType != null and configType != ''">config_type = #{configType},</if>
+            <if test="updaterId != null and updaterId != ''">updaterid = #{updaterId},</if>
+            <if test="remark != null">remark = #{remark},</if>
+ 			updatetime = sysdate()
+        </set>
+        where config_id = #{configId} and isvalid=1
+    </update>
+    <update id="updateConfigByKey" parameterType="com.simuwang.base.pojo.dos.SysConfigDO">
+        update sys_config set config_value = #{configValue},updatetime = sysdate() where config_key = #{configKey} and isvalid=1
+    </update>
+
+    <delete id="deleteConfigById" parameterType="Long">
+        UPDATE sys_config SET isvalid=0  where config_id = #{configId}
+    </delete>
+    
+    <delete id="deleteConfigByIds" parameterType="Long">
+        UPDATE sys_config SET isvalid=0,updaterid=#{userId} where config_id in
+        <foreach item="configId" collection="configIds" open="(" separator="," close=")">
+        	#{configId}
+        </foreach>
+    </delete>
+    
+</mapper>

+ 54 - 0
service-base/src/main/resources/mapper/daq/system/SysLogMapper.xml

@@ -0,0 +1,54 @@
+<?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.daq.system.SysLogMapper">
+    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.LoggingDO">
+        <id column="id" property="id"/>
+        <result column="title" property="title"/>
+        <result column="type" property="type"/>
+        <result column="request_uri" property="requestUri"/>
+        <result column="method" property="method"/>
+        <result column="remote_addr" property="remoteAddr"/>
+        <result column="execute_time" property="executeTime"/>
+        <result column="params" property="params"/>
+        <result column="user_name" property="userName"/>
+        <result column="createtime" property="createTime"/>
+    </resultMap>
+    <update id="deleteLog">
+        delete from  PPW_EMAIL.sys_log where id in
+        <foreach item="id" collection="idList" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+    <select id="searchLogList" resultMap="BaseResultMap">
+          select distinct log.id,log.title,log.type,log.request_uri,log.method,log.remote_addr,log.execute_time,log.params,log.params,log.createtime,u.user_name
+          from PPW_EMAIL.sys_log log
+          left join PPW_EMAIL.sys_user u
+          on log.creatorid=u.user_id and u.isvalid=1
+        <where>
+            <if test="title != null and title !=''">
+                and log.title like concat ('%',#{title},'%')
+            </if>
+            <if test="userName != null and userName !=''">
+                and u.user_name like concat ('%',#{userName},'%')
+            </if>
+        </where>
+        order by log.createtime desc
+        limit #{offset},#{pageSize}
+    </select>
+    <select id="countLogList" resultType="java.lang.Long">
+        select count(distinct log.id)
+        from PPW_EMAIL.sys_log log
+        left join PPW_EMAIL.sys_user u
+        on log.creatorid=u.user_id and u.isvalid=1
+        <where>
+            <if test="title != null and title !=''">
+                and log.title like concat ('%',#{title},'%')
+            </if>
+            <if test="userName != null and userName !=''">
+                and u.user_name like concat ('%',#{userName},'%')
+            </if>
+        </where>
+    </select>
+
+
+</mapper>

+ 33 - 0
service-base/src/main/resources/mapper/daq/system/SysRoleMapper.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.daq.system.SysRoleMapper">
+    <select id="listAssignPerms" resultType="com.simuwang.base.common.support.dos.OnlyIdNameDO">
+        select sm.menu_id    as id,
+               sm.menu_name  as name
+        from sys_menu sm
+                 join sys_role_menu srm on sm.menu_id = srm.menu_id
+                 join sys_role sr on sr.role_id = srm.role_id and sr.isvalid = 1 and sr.status = 1
+        where sr.role_id = #{roleId}
+          and sm.isvalid = 1 and sm.status = 1
+        order by sm.menu_id
+    </select>
+
+    <select id="allPerms" resultType="com.simuwang.base.common.support.dos.OnlyIdNameDO">
+        select sm.menu_id    as id,
+               sm.menu_name  as name
+        from sys_menu sm
+        where sm.isvalid = 1 and sm.status = 1
+        order by sm.menu_id
+    </select>
+
+    <delete id="delRoleMenuByUserId" parameterType="int">
+        delete from sys_role_menu where role_id =#{roleId}
+    </delete>
+
+    <insert id="batchRoleMenus">
+        insert into sys_role_menu(role_id, menu_id) values
+        <foreach collection="menuIds" item="menuId" separator=",">
+            (#{roleId}, #{menuId})
+        </foreach>
+    </insert>
+</mapper>

+ 205 - 0
service-base/src/main/resources/mapper/daq/system/SysUserMapper.xml

@@ -0,0 +1,205 @@
+<?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.daq.system.SysUserMapper">
+    <select id="listBindRoles" resultType="com.simuwang.base.common.support.dos.OnlyIdNameDO">
+        select t.role_id    as id,
+               t.role_name  as name
+        from sys_role t
+                 join sys_user_role t1 on t.role_id = t1.role_id
+                 join sys_user t2 on t1.user_id = t2.user_id and t2.isvalid = 1 and t2.status = 1
+        where t2.user_id = #{userId}
+          and t.isvalid = 1 and t.status = 1
+        order by t.role_id
+    </select>
+
+    <select id="allRoles" resultType="com.simuwang.base.common.support.dos.OnlyIdNameDO">
+        select t.role_id    as id,
+               t.role_name  as name
+        from sys_role t
+        where t.isvalid = 1 and t.status = 1
+        order by t.role_id
+    </select>
+
+    <select id="selectRoleByUserId" resultType="com.simuwang.base.pojo.dos.sys.SysRoleDO">
+        select t.role_id    as roleId,
+               t.role_name  as roleName,
+               t.role_key   as roleKey,
+               t.role_sort  as roleSort,
+               t.status     as status,
+               t.data_scope as dataScope,
+               t.remark,
+               t.creatorid  as creatorId,
+               t.createtime as createTime,
+               t.updaterid  as updaterId,
+               t.updatetime as updateTime
+        from sys_role t
+                 join sys_user_role t1 on t.role_id = t1.role_id
+                 join sys_user t2 on t1.user_id = t2.user_id and t2.isvalid = 1 and t2.status = 1
+        where t2.user_id = #{userId}
+          and t.isvalid = 1 and t.status = 1
+        order by t.role_id
+    </select>
+
+    <select id="selectAllRole" resultType="com.simuwang.base.pojo.dos.sys.SysRoleDO">
+        select t.role_id    as roleId,
+               t.role_name  as roleName,
+               t.role_key   as roleKey,
+               t.role_sort  as roleSort,
+               t.status     as status,
+               t.data_scope as dataScope,
+               t.remark,
+               t.creatorid  as creatorId,
+               t.createtime as createTime,
+               t.updaterid  as updaterId,
+               t.updatetime as updateTime
+        from sys_role t
+        where t.isvalid = 1 and t.status = 1
+        order by t.role_id
+    </select>
+
+    <select id="selectMenuByUserId" resultType="com.simuwang.base.pojo.dos.sys.SysMenuDO">
+        select sm.menu_id    as menuId,
+               sm.menu_name  as menuName,
+               sm.parent_id  as parentId,
+               sm.perms      as perms,
+               sm.icon       as icon,
+               sm.order_num  as orderNum,
+               sm.path       as path,
+               sm.component  as component,
+               sm.query      as query,
+               sm.is_frame   as isFrame,
+               sm.is_cache   as isCache,
+               sm.menu_type  as menuType,
+               sm.visible    as visible,
+               sm.status     as status,
+               sm.remark,
+               sm.creatorid  as creatorId,
+               sm.createtime as createTime,
+               sm.updaterid  as updaterId,
+               sm.updatetime as updateTime
+        from sys_menu sm
+                 join sys_role_menu srm on sm.menu_id = srm.menu_id
+                 join sys_role sr on sr.role_id = srm.role_id and sr.isvalid = 1 and sr.status = 1
+                 join sys_user_role t1 on sr.role_id = t1.role_id
+                 join sys_user t2 on t1.user_id = t2.user_id and t2.isvalid = 1 and t2.status = 1
+        where t2.user_id = #{userId}
+          and sm.isvalid = 1
+        <if test="status != null">
+            and sm.status = #{status}
+        </if>
+        order by sm.menu_id
+    </select>
+
+    <select id="selectAllMenu" resultType="com.simuwang.base.pojo.dos.sys.SysMenuDO">
+        select sm.menu_id    as menuId,
+               sm.menu_name  as menuName,
+               sm.parent_id  as parentId,
+               sm.perms      as perms,
+               sm.icon       as icon,
+               sm.order_num  as orderNum,
+               sm.path       as path,
+               sm.component  as component,
+               sm.query      as query,
+               sm.is_frame   as isFrame,
+               sm.is_cache   as isCache,
+               sm.menu_type  as menuType,
+               sm.visible    as visible,
+               sm.status     as status,
+               sm.remark,
+               sm.creatorid  as creatorId,
+               sm.createtime as createTime,
+               sm.updaterid  as updaterId,
+               sm.updatetime as updateTime
+        from sys_menu sm
+        where sm.isvalid = 1
+        <if test="status != null">
+            and sm.status = #{status}
+        </if>
+        order by sm.menu_id
+    </select>
+
+    <select id="roleUserPage" resultType="com.simuwang.base.pojo.dos.sys.SysRoleUserDO"
+            parameterType="com.simuwang.base.pojo.dto.sys.RoleUserQuery">
+        select t.role_id    as roleId,
+               t.role_name  as roleName,
+               t.role_key   as roleKey,
+               t.role_sort  as roleSort,
+               t.status     as status,
+               t.data_scope as dataScope,
+               t.remark,
+               t.creatorid  as creatorId,
+               t.createtime as createTime,
+               t.updaterid  as updaterId,
+               t.updatetime as updateTime,
+               t2.user_id   as userId,
+               t2.user_name as userName,
+               t2.email,
+               t2.phonenumber,
+               t2.status    as userStatus
+        from sys_role t
+                 join sys_user_role t1 on t.role_id = t1.role_id
+                 join sys_user t2 on t1.user_id = t2.user_id and t2.isvalid = 1
+        where t.isvalid = 1
+        <if test="keyword != null and keyword != ''">
+            and (
+                t.role_name like concat('%', #{keyword}, '%')
+                or
+                t.role_key like concat('%', #{keyword}, '%')
+                or
+                t2.user_name like concat('%', #{keyword}, '%')
+                or
+                t2.email like concat('%', #{keyword}, '%')
+                or
+                t2.phonenumber like concat('%', #{keyword}, '%')
+            )
+        </if>
+        <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
+            and t.createtime between #{beginTime} and #{endTime}
+        </if>
+        <choose>
+            <when test="orderItems != null and !orderItems.isEmpty()">
+                order by
+                <foreach collection="orderItems" item="item" separator=",">
+                    ${item.column} ${item.asc}
+                </foreach>
+            </when>
+            <otherwise>order by t.createtime</otherwise>
+        </choose>
+        limit #{offset}, #{pageSize}
+    </select>
+
+    <select id="countRoleUser" parameterType="com.simuwang.base.pojo.dto.sys.RoleUserQuery">
+        select count(t.role_id)
+        from sys_role t
+                 join sys_user_role t1 on t.role_id = t1.role_id
+                 join sys_user t2 on t1.user_id = t2.user_id and t2.isvalid = 1
+        where t.isvalid = 1
+        <if test="keyword != null and keyword != ''">
+            and (
+            t.role_name like concat('%', #{keyword}, '%')
+            or
+            t.role_key like concat('%', #{keyword}, '%')
+            or
+            t2.user_name like concat('%', #{keyword}, '%')
+            or
+            t2.email like concat('%', #{keyword}, '%')
+            or
+            t2.phonenumber like concat('%', #{keyword}, '%')
+            )
+        </if>
+        <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
+            and t.createtime between #{beginTime} and #{endTime}
+        </if>
+    </select>
+
+    <delete id="delUserRoleByUserId" parameterType="int">
+        delete from sys_user_role where user_id =#{userId}
+    </delete>
+
+    <insert id="batchUserRoles">
+        insert into sys_user_role(user_id, role_id) values
+        <foreach collection="roleIds" item="roleId" separator=",">
+            (#{userId}, #{roleId})
+        </foreach>
+    </insert>
+</mapper>

+ 27 - 5
service-manage/src/main/java/com/simuwang/manage/init/CompleteScheduleConfig.java

@@ -2,6 +2,7 @@ package com.simuwang.manage.init;
 
 import com.simuwang.base.common.util.DateUtils;
 import com.simuwang.base.mapper.daq.system.SysConfigMapper;
+import com.simuwang.manage.task.DataSynchronizationTask;
 import com.simuwang.manage.task.FundDeletionTask;
 import com.simuwang.manage.task.SendCompanyEmailTask;
 import org.slf4j.Logger;
@@ -37,6 +38,9 @@ public class CompleteScheduleConfig implements SchedulingConfigurer {
 
     @Autowired
     private SysConfigMapper sysConfigMapper;
+
+    @Autowired
+    private DataSynchronizationTask dataSynchronizationTask;
     /**
      * 执行定时任务.
      */
@@ -59,14 +63,13 @@ public class CompleteScheduleConfig implements SchedulingConfigurer {
                     }
                 },
                 //2.设置执行周期(Trigger)
-                loadFtpFileTriggerContext -> {
+                fundDeletionTaskContext -> {
                     String cron = sysConfigMapper.selectConfigByKey("deletion_cron");
                     logger.info("缺失统计定时任务执行时间:"+cron);
                     //2.2 返回执行周期(Date)
-                    return new CronTrigger(cron).nextExecutionTime(loadFtpFileTriggerContext).toInstant();
+                    return new CronTrigger(cron).nextExecutionTime(fundDeletionTaskContext).toInstant();
                 }
         );
-        //增量补数
         taskRegistrar.addTriggerTask(
                 //1.添加任务内容(Runnable)
                 () -> {
@@ -79,11 +82,30 @@ public class CompleteScheduleConfig implements SchedulingConfigurer {
                     }
                 },
                 //2.设置执行周期(Trigger)
-                loadFtpFileUpdateTriggerContext -> {
+                sendCompanyEmailTaskContext -> {
                     String cron = sysConfigMapper.selectConfigByKey("send_company_email");
                     logger.info("给管理人发送基金缺失预警邮件定时任务轮训时间:"+cron);
                     //2.2 返回执行周期(Date)
-                    return new CronTrigger(cron).nextExecutionTime(loadFtpFileUpdateTriggerContext).toInstant();
+                    return new CronTrigger(cron).nextExecutionTime(sendCompanyEmailTaskContext).toInstant();
+                }
+        );
+        taskRegistrar.addTriggerTask(
+                //1.添加任务内容(Runnable)
+                () -> {
+                    try {
+                        logger.info("数据同步任务开始执行"+DateUtils.getTime());
+                        dataSynchronizationTask.synchronization();//定时同步数据
+                        logger.info("数据同步任务结束执行========="+ DateUtils.getTime());
+                    } catch (Exception e) {
+                        logger.error("数据同步任务结束执行异常========="+e.getMessage()+ DateUtils.getTime(),e);
+                    }
+                },
+                //2.设置执行周期(Trigger)
+                dataSynchronizationTaskContext -> {
+                    String cron = sysConfigMapper.selectConfigByKey("data_synchronization_cron");
+                    logger.info("数据同步任务轮训时间:"+cron);
+                    //2.2 返回执行周期(Date)
+                    return new CronTrigger(cron).nextExecutionTime(dataSynchronizationTaskContext).toInstant();
                 }
         );
     }

+ 160 - 0
service-manage/src/main/java/com/simuwang/manage/task/DataSynchronizationTask.java

@@ -0,0 +1,160 @@
+package com.simuwang.manage.task;
+
+import cn.hutool.core.date.DateUtil;
+import com.simuwang.base.common.util.DateUtils;
+import com.simuwang.base.common.util.StringUtil;
+import com.simuwang.base.mapper.core.CoreDistributionMapper;
+import com.simuwang.base.mapper.core.SrcNavMapper;
+import com.simuwang.base.mapper.daq.DistributionMapper;
+import com.simuwang.base.mapper.daq.NavMapper;
+import com.simuwang.base.mapper.daq.system.SysConfigMapper;
+import com.simuwang.base.pojo.dos.DistributionDO;
+import com.simuwang.base.pojo.dos.NavDO;
+import com.simuwang.base.pojo.dos.SysConfigDO;
+import com.simuwang.base.pojo.dos.core.CoreDistributionDO;
+import com.simuwang.base.pojo.dos.core.SrcNavDO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 数据同步
+ * Author:   chenjianhua
+ * Date:     2024/10/25 13:59
+ * Description: ${DESCRIPTION}
+ */
+@Component
+public class DataSynchronizationTask {
+
+    @Autowired
+    private NavMapper navMapper;
+
+    @Autowired
+    private SrcNavMapper srcNavMapper;
+
+    @Autowired
+    private SysConfigMapper sysConfigMapper;
+
+    @Autowired
+    private DistributionMapper distributionMapper;
+    @Autowired
+    private CoreDistributionMapper coreDistributionMapper;
+
+    private static final Integer maxNum = 100000;
+
+    public void synchronization() {
+        String startDate = sysConfigMapper.selectConfigByKey("last_data_synchronization_time");
+        if (StringUtil.isNull(startDate)) {
+            //沒有配置就新增一个
+            saveConfig();
+        }
+        String endDate = DateUtil.now();
+        long total = navMapper.countNavByTime(startDate, endDate);
+        if (total > maxNum) {
+            Map<String,Long> idMap = navMapper.selectMaxMinId(startDate, endDate);
+            Long minId = idMap.get("minId");
+            Long maxId = idMap.get("maxId");
+            long times = (maxId-minId)%maxNum==0?(maxId-minId)/maxNum:(maxId-minId)/maxNum+1;
+            long startIdx = minId;
+            for(int idx=1;idx <= times;idx++){
+                long endIdx = startIdx+idx*maxNum;
+                if(endIdx >= maxId){
+                    endIdx = maxId;
+                }
+                List<NavDO> navDOList = navMapper.selectNavListById(minId,maxId,startDate, endDate);
+                saveSrcNavList(navDOList);
+                startIdx = endIdx;
+            }
+            return;
+        }
+        List<NavDO> navDOList = navMapper.selectNavListByTime(startDate, endDate);
+        saveSrcNavList(navDOList);
+        //更新分红
+        List<DistributionDO> distributionDOList = distributionMapper.selectDistributeListByTime(startDate, endDate);
+        saveDistribute(distributionDOList);
+        //更新最后任务时间
+        updateConfig(endDate);
+    }
+
+    private void saveDistribute(List<DistributionDO> distributionDOList) {
+        List<CoreDistributionDO> coreDistributionDOList = new ArrayList<>();
+        for(DistributionDO distribution : distributionDOList){
+            CoreDistributionDO coreDistributionDO = new CoreDistributionDO();
+            coreDistributionDO.setDistribution(distribution.getDistribution());
+            coreDistributionDO.setDistributeDate(distribution.getDistributeDate());
+            coreDistributionDO.setDistributeType(distribution.getDistributeType());
+            coreDistributionDO.setFundId(distribution.getFundId());
+            coreDistributionDO.setCreateTime(distribution.getCreateTime());
+            coreDistributionDO.setUpdaterId(distribution.getUpdaterId());
+            coreDistributionDO.setCreatorId(distribution.getCreatorId());
+            coreDistributionDO.setUpdateTime(distribution.getUpdateTime());
+            coreDistributionDO.setIsvalid(distribution.getIsvalid());
+            coreDistributionDOList.add(coreDistributionDO);
+            if(coreDistributionDOList.size() >= 500){
+                coreDistributionMapper.saveCoreDistribution(coreDistributionDOList);
+                coreDistributionDOList.clear();
+            }
+        }
+        if(coreDistributionDOList.size() > 0){
+            coreDistributionMapper.saveCoreDistribution(coreDistributionDOList);
+            coreDistributionDOList.clear();
+        }
+    }
+
+    private void updateConfig(String endDate) {
+        SysConfigDO sysConfigDO = new SysConfigDO();
+        sysConfigDO.setConfigKey("last_data_synchronization_time");
+        sysConfigDO.setConfigName("数据同步最后时间");
+        sysConfigDO.setConfigValue(endDate);
+        sysConfigMapper.updateConfigByKey(sysConfigDO);
+    }
+
+    private void saveConfig() {
+        SysConfigDO sysConfigDO = new SysConfigDO();
+        sysConfigDO.setIsvalid(1);
+        sysConfigDO.setCreateTime(DateUtils.getNowDate());
+        sysConfigDO.setUpdateTime(DateUtils.getNowDate());
+        sysConfigDO.setConfigType("1");
+        sysConfigDO.setConfigKey("last_data_synchronization_time");
+        sysConfigDO.setConfigName("数据同步最后时间");
+        sysConfigDO.setConfigValue(DateUtil.now());
+        sysConfigDO.setRemark("数据同步最后时间");
+        sysConfigDO.setCreatorId(1);
+        sysConfigDO.setUpdaterId(1);
+        sysConfigMapper.insertConfig(sysConfigDO);
+    }
+
+    public void saveSrcNavList(List<NavDO> navDOList){
+        List<SrcNavDO> srcNavDOList = new ArrayList<>();
+        for (NavDO navDO : navDOList) {
+            SrcNavDO srcNavDO = new SrcNavDO();
+//            srcNavDO.setId(navDO.getId());
+            srcNavDO.setPriceDate(navDO.getPriceDate());
+            srcNavDO.setFundId(navDO.getFundId());
+            srcNavDO.setNav(navDO.getNav());
+            srcNavDO.setCumulativeNavCrawl(navDO.getCumulativeNavWithdrawal());
+            srcNavDO.setAppType(1);
+            srcNavDO.setNavSource(1);
+            srcNavDO.setCreateTime(navDO.getCreateTime());
+            srcNavDO.setUpdateTime(navDO.getUpdateTime());
+            srcNavDO.setCreatorId(navDO.getCreatorId());
+            srcNavDO.setUpdaterId(navDO.getUpdaterId());
+            srcNavDO.setIsvisible(1);
+            srcNavDO.setSourceId(1);
+            srcNavDO.setIsvalid(navDO.getIsvalid());
+            srcNavDO.setNavMark(null);
+            srcNavDOList.add(srcNavDO);
+            if(srcNavDOList.size() >= 500){
+                srcNavMapper.saveSrcNav(srcNavDOList);
+                srcNavDOList.clear();
+            }
+        }
+        if(srcNavDOList.size() > 0){
+            srcNavMapper.saveSrcNav(srcNavDOList);
+            srcNavDOList.clear();
+        }
+    }
+}