EmailFileInfoMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.smppw.modaq.domain.mapper.EmailFileInfoMapper">
  4. <resultMap id="BaseResultMap" type="com.smppw.modaq.domain.entity.EmailFileInfoDO">
  5. <id column="id" property="id"/>
  6. <result column="email_id" property="emailId"/>
  7. <result column="file_name" property="fileName"/>
  8. <result column="file_path" property="filePath"/>
  9. <result column="ai_parse" property="aiParse"/>
  10. <!-- <result column="ai_file_id" property="aiFileId"/>-->
  11. <result column="isvalid" property="isvalid"/>
  12. <result column="creatorid" property="creatorId"/>
  13. <result column="createtime" property="createTime"/>
  14. <result column="updaterid" property="updaterId"/>
  15. <result column="updatetime" property="updateTime"/>
  16. </resultMap>
  17. <insert id="insertById" parameterType="com.smppw.modaq.domain.entity.EmailFileInfoDO" useGeneratedKeys="true"
  18. keyProperty="id" keyColumn="id">
  19. insert into mo_email_file_info(email_id, file_name, file_path,
  20. isvalid, creatorid, createtime, updaterid, updatetime)
  21. values (#{itemDo.emailId}, #{itemDo.fileName}, #{itemDo.filePath},
  22. #{itemDo.isvalid}, #{itemDo.creatorId}, #{itemDo.createTime}, #{itemDo.updaterId}, #{itemDo.updateTime})
  23. </insert>
  24. <!-- <select id="getEmailFileById" resultMap="BaseResultMap"-->
  25. <!-- parameterType="java.lang.Integer">-->
  26. <!-- select id ,email_id, file_name, file_path,ai_parse,ai_file_id,-->
  27. <!-- isvalid, creatorid, createtime, updaterid, updatetime-->
  28. <!-- from mo_email_file_info where id=#{id} and isvalid=1-->
  29. <!-- </select>-->
  30. <!-- <select id="getEmailFileByEmailId" resultMap="BaseResultMap"-->
  31. <!-- parameterType="java.lang.Integer">-->
  32. <!-- select id ,email_id, file_name, file_path,ai_parse,ai_file_id,-->
  33. <!-- isvalid, creatorid, createtime, updaterid, updatetime-->
  34. <!-- from mo_email_file_info where email_id=#{emailId} and isvalid=1-->
  35. <!-- </select>-->
  36. <select id="queryByEmailId" resultMap="BaseResultMap">
  37. select id, file_name, file_path,ai_parse
  38. from mo_email_file_info
  39. where email_id = #{emailId}
  40. and isvalid = 1
  41. </select>
  42. <!-- <select id="searchFundFileInfo" resultType="com.simuwang.base.pojo.vo.FundFileInfoVO">-->
  43. <!-- SELECT DISTINCT efi.id as "fileId",-->
  44. <!-- <if test="fileType != 3">-->
  45. <!-- efn.fund_id as "fundId",-->
  46. <!-- efn.fund_name as "fundName",-->
  47. <!-- </if>-->
  48. <!-- <if test="fileType == 3">-->
  49. <!-- info.fund_id as "fundId",-->
  50. <!-- efn.fund_name as "fundName",-->
  51. <!-- </if>-->
  52. <!-- efi.file_name as "fileName",-->
  53. <!-- efi.file_path as "filePath",-->
  54. <!-- efi.createtime as "createTime"-->
  55. <!-- FROM-->
  56. <!-- PPW_EMAIL.EMAIL_FILE_INFO efi-->
  57. <!-- <if test="fileType != 3">-->
  58. <!-- JOIN PPW_EMAIL.EMAIL_FUND_NAV efn-->
  59. <!-- ON efi.id = efn.file_id-->
  60. <!-- </if>-->
  61. <!-- <if test="fileType == 3">-->
  62. <!-- JOIN PPW_EMAIL.AMAC_REPORT_FUND_INFO efn-->
  63. <!-- ON efi.id = efn.file_id-->
  64. <!-- left join PPW_EMAIL.PVN_FUND_INFO info-->
  65. <!-- on efn.register_number=info.register_number and info.isvalid=1-->
  66. <!-- </if>-->
  67. <!-- JOIN PPW_EMAIL.EMAIL_PARSE_INFO epi-->
  68. <!-- ON epi.id = efi.email_id-->
  69. <!-- WHERE efi.isvalid = 1-->
  70. <!-- AND efn.isvalid = 1-->
  71. <!-- AND epi.isvalid = 1-->
  72. <!-- AND epi.EMAIL_TYPE = #{fileType}-->
  73. <!-- <if test="fileType != 3">-->
  74. <!-- and efn.fund_id=#{fundId}-->
  75. <!-- </if>-->
  76. <!-- <if test="fileType == 3">-->
  77. <!-- and info.fund_id=#{fundId}-->
  78. <!-- </if>-->
  79. <!-- order by efi.createtime desc-->
  80. <!-- limit #{offset},#{pageSize}-->
  81. <!-- </select>-->
  82. <!-- <resultMap id="BaseDetailMap" type="com.smppw.modaq.domain.entity.EmailParseDetailDO">-->
  83. <!-- <result column="fund_id" property="fundId"/>-->
  84. <!-- <result column="fund_name" property="fundName"/>-->
  85. <!-- <result column="register_number" property="registerNumber"/>-->
  86. <!-- <result column="price_date" property="priceDate"/>-->
  87. <!-- <result column="nav" property="nav"/>-->
  88. <!-- <result column="cumulative_nav_withdrawal" property="cumulativeNavWithdrawal"/>-->
  89. <!-- <result column="asset_net" property="assetNet"/>-->
  90. <!-- <result column="asset_share" property="assetShare"/>-->
  91. <!-- <result column="nav_is_stored" property="navIsStored"/>-->
  92. <!-- <result column="nav_exception_status" property="navExceptionStatus"/>-->
  93. <!-- <result column="asset_is_stored" property="assetIsStored"/>-->
  94. <!-- <result column="asset_exception_status" property="assetExceptionStatus"/>-->
  95. <!-- <result column="updatetime" property="updateTime"/>-->
  96. <!-- </resultMap>-->
  97. <!-- <select id="searchEmailDetailById" resultMap="BaseDetailMap">-->
  98. <!-- SELECT distinct-->
  99. <!-- IFNULL(nav.fund_id,asset.fund_id) as fund_id,-->
  100. <!-- IFNULL(nav.fund_name,asset.fund_name) as fund_name,-->
  101. <!-- IFNULL(nav.register_number,asset.register_number) as register_number,-->
  102. <!-- IFNULL(nav.price_date,asset.price_date) as price_date,-->
  103. <!-- nav.nav,-->
  104. <!-- nav.cumulative_nav_withdrawal,-->
  105. <!-- asset.asset_net,-->
  106. <!-- asset.asset_share,-->
  107. <!-- nav.is_stored as nav_is_stored,-->
  108. <!-- nav.exception_status as nav_exception_status,-->
  109. <!-- asset.is_stored as asset_is_stored,-->
  110. <!-- asset.exception_status as asset_exception_status,-->
  111. <!-- case-->
  112. <!-- when nav.updatetime is null then-->
  113. <!-- asset.updatetime-->
  114. <!-- when asset.updatetime is null then-->
  115. <!-- nav.updatetime-->
  116. <!-- when nav.updatetime >= asset.updatetime then-->
  117. <!-- nav.updatetime-->
  118. <!-- else-->
  119. <!-- asset.updatetime-->
  120. <!-- end as updatetime-->
  121. <!-- FROM-->
  122. <!-- PPW_EMAIL.EMAIL_FILE_INFO efi-->
  123. <!-- LEFT JOIN PPW_EMAIL.email_fund_nav nav-->
  124. <!-- ON efi.id = nav.file_id-->
  125. <!-- AND nav.isvalid = 1-->
  126. <!-- LEFT JOIN PPW_EMAIL.email_fund_asset asset-->
  127. <!-- ON efi.id = asset.file_id-->
  128. <!-- 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-->
  129. <!-- WHERE efi.isvalid = 1-->
  130. <!-- AND efi.id =#{fileId}-->
  131. <!-- order by fund_name desc,price_date desc-->
  132. <!-- limit #{offset},#{pageSize}-->
  133. <!-- </select>-->
  134. <!-- <select id="countFundFileInfo" resultType="java.lang.Long"-->
  135. <!-- parameterType="com.simuwang.base.pojo.dto.query.FundFilePageQuery">-->
  136. <!-- select count(1) from (-->
  137. <!-- SELECT DISTINCT efi.id as "fileId",-->
  138. <!-- <if test="fileType != 3">-->
  139. <!-- efn.fund_id as "fundId",-->
  140. <!-- efn.fund_name as "fundName",-->
  141. <!-- </if>-->
  142. <!-- <if test="fileType == 3">-->
  143. <!-- info.fund_id as "fundId",-->
  144. <!-- efn.fund_name as "fundName",-->
  145. <!-- </if>-->
  146. <!-- efi.file_name as "fileName",-->
  147. <!-- efi.file_path as "filePath",-->
  148. <!-- efi.createtime as "createTime"-->
  149. <!-- FROM-->
  150. <!-- PPW_EMAIL.EMAIL_FILE_INFO efi-->
  151. <!-- <if test="fileType != 3">-->
  152. <!-- JOIN PPW_EMAIL.EMAIL_FUND_NAV efn-->
  153. <!-- ON efi.id = efn.file_id-->
  154. <!-- </if>-->
  155. <!-- <if test="fileType == 3">-->
  156. <!-- JOIN PPW_EMAIL.AMAC_REPORT_FUND_INFO efn-->
  157. <!-- ON efi.id = efn.file_id-->
  158. <!-- left join PPW_EMAIL.PVN_FUND_INFO info-->
  159. <!-- on efn.register_number=info.register_number and info.isvalid=1-->
  160. <!-- </if>-->
  161. <!-- JOIN PPW_EMAIL.EMAIL_PARSE_INFO epi-->
  162. <!-- ON epi.id = efi.email_id-->
  163. <!-- WHERE efi.isvalid = 1-->
  164. <!-- AND efn.isvalid = 1-->
  165. <!-- AND epi.isvalid = 1-->
  166. <!-- AND epi.EMAIL_TYPE = #{fileType}-->
  167. <!-- <if test="fileType != 3">-->
  168. <!-- and efn.fund_id=#{fundId}-->
  169. <!-- </if>-->
  170. <!-- <if test="fileType == 3">-->
  171. <!-- and info.fund_id=#{fundId}-->
  172. <!-- </if>) a-->
  173. <!-- </select>-->
  174. <!-- <select id="countEmailDetailById" resultType="java.lang.Long"-->
  175. <!-- parameterType="com.simuwang.base.pojo.dto.query.EmailFileQuery">-->
  176. <!-- select count(1) from (-->
  177. <!-- SELECT distinct-->
  178. <!-- IFNULL(nav.fund_id,asset.fund_id) as fund_id,-->
  179. <!-- IFNULL(nav.fund_name,asset.fund_name) as fund_name,-->
  180. <!-- IFNULL(nav.register_number,asset.register_number) as register_number,-->
  181. <!-- IFNULL(nav.price_date,asset.price_date) as price_date,-->
  182. <!-- nav.nav,-->
  183. <!-- nav.cumulative_nav_withdrawal,-->
  184. <!-- asset.asset_net,-->
  185. <!-- asset.asset_share-->
  186. <!-- FROM-->
  187. <!-- PPW_EMAIL.EMAIL_FILE_INFO efi-->
  188. <!-- LEFT JOIN PPW_EMAIL.email_fund_nav nav-->
  189. <!-- ON efi.id = nav.file_id-->
  190. <!-- AND nav.isvalid = 1-->
  191. <!-- LEFT JOIN PPW_EMAIL.email_fund_asset asset-->
  192. <!-- ON efi.id = asset.file_id-->
  193. <!-- 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-->
  194. <!-- WHERE efi.isvalid = 1-->
  195. <!-- AND efi.id =#{fileId}) a-->
  196. <!-- </select>-->
  197. <!-- <select id="selectValuationFileId" resultType="java.lang.Integer"-->
  198. <!-- parameterType="java.util.List">-->
  199. <!-- SELECT-->
  200. <!-- distinct file.id-->
  201. <!-- FROM-->
  202. <!-- PPW_EMAIL.EMAIL_FILE_INFO file-->
  203. <!-- JOIN PPW_EMAIL.EMAIL_PARSE_INFO info-->
  204. <!-- ON file.email_id = info.id-->
  205. <!-- WHERE info.email_type = 2-->
  206. <!-- AND file.id IN-->
  207. <!-- <foreach collection="fileIdList" item="fileId" index="index" separator=",">-->
  208. <!-- #{fileId}-->
  209. <!-- </foreach>-->
  210. <!-- </select>-->
  211. <!-- <select id="getAllPriceDateByFileId" resultType="java.lang.String" parameterType="java.lang.Integer">-->
  212. <!-- select * from (select distinct price_date from PPW_EMAIL.EMAIL_FUND_NAV WHERE file_id=#{fileId} and isvalid=1-->
  213. <!-- union-->
  214. <!-- select distinct price_date from PPW_EMAIL.EMAIL_FUND_ASSET WHERE file_id=#{fileId} and isvalid=1) a order by price_date desc-->
  215. <!-- </select>-->
  216. <update id="updateTimeById">
  217. update mo_email_file_info
  218. set updatetime = #{parseDate}
  219. where isvalid = 1
  220. and id = #{id}
  221. </update>
  222. <!-- <update id="updateAiParseByFileId">-->
  223. <!-- update mo_email_file_info-->
  224. <!-- set updatetime = now(),-->
  225. <!-- ai_parse = #{aiParse},-->
  226. <!-- ai_file_id = #{aiFileId}-->
  227. <!-- where isvalid = 1-->
  228. <!-- and id = #{fileId}-->
  229. <!-- </update>-->
  230. <update id="batchUpdateByFileId">
  231. <foreach collection="entityList" item="entity">
  232. update mo_email_file_info
  233. set ai_parse = #{entity.aiParse},
  234. parse_status = #{entity.parseStatus},
  235. fail_reason = #{entity.failReason},
  236. updatetime = now()
  237. where id = #{entity.id};
  238. </foreach>
  239. </update>
  240. <select id="getLetterFilenameSuccessCount" resultType="int">
  241. select count(1)
  242. from mo_email_file_info a
  243. join mo_email_parse_info e on e.id = a.email_id and e.email_title = #{emailTitle}
  244. join mo_report_base_info b on b.file_id = a.id and b.report_type = 'LETTER'
  245. join mo_report_fund_transaction c on a.id = c.file_id and c.fund_name is not null
  246. join mo_report_investor_info d on a.id = d.file_id and d.investor_name is not null
  247. where a.file_name = #{filename} and a.isvalid = 1
  248. </select>
  249. <select id="getAmacFilenameSuccessCount" resultType="int">
  250. select count(1)
  251. from mo_email_file_info a
  252. join mo_email_parse_info e on e.id = a.email_id and e.email_title = #{emailTitle} and e.attr_size = #{fileSize}
  253. join mo_report_base_info b on b.file_id = a.id and b.report_type in ('MONTHLY', 'QUARTERLY', 'ANNUALLY')
  254. join mo_report_fund_info c on a.id = c.file_id and (c.fund_name is not null or c.fund_code is not null)
  255. where a.file_name = #{filename} and a.isvalid = 1
  256. </select>
  257. <select id="getWeeklyFilenameSuccessCount" resultType="int">
  258. select count(1)
  259. from mo_email_file_info a
  260. join mo_email_parse_info e on e.id = a.email_id and e.email_title = #{emailTitle} and e.attr_size = #{fileSize}
  261. join mo_report_base_info b on b.file_id = a.id and b.report_type = 'WEEKLY'
  262. join mo_report_fund_info c on a.id = c.file_id and (c.fund_name is not null or c.fund_code is not null)
  263. where a.file_name = #{filename} and a.isvalid = 1
  264. </select>
  265. <select id="getOtherFilenameSuccessCount" resultType="int">
  266. select count(1)
  267. from mo_email_file_info a
  268. join mo_email_parse_info e on e.id = a.email_id and e.email_title = #{emailTitle} and e.attr_size = #{fileSize}
  269. join mo_report_base_info b on b.file_id = a.id and b.report_type = 'OTHER'
  270. where a.file_name = #{filename} and a.isvalid = 1
  271. </select>
  272. </mapper>