账单异步生成优化
This commit is contained in:
@@ -3,13 +3,18 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ar.mapper.ArBillExportMapper">
|
||||
<!-- 导出任务和历史记录;PROCESSING/SUCCESS/FAILED 由异步执行器更新。 -->
|
||||
<resultMap id="ArBillExportResult" type="ArBillExport">
|
||||
<id property="exportId" column="export_id"/>
|
||||
<result property="arBillId" column="ar_bill_id"/>
|
||||
<result property="fileName" column="file_name"/>
|
||||
<result property="fileType" column="file_type"/>
|
||||
<result property="templateId" column="template_id"/>
|
||||
<result property="templateCode" column="template_code"/>
|
||||
<result property="templateVersion" column="template_version"/>
|
||||
<result property="templateStorageType" column="template_storage_type"/>
|
||||
<result property="templateStorageKey" column="template_storage_key"/>
|
||||
<result property="templateHash" column="template_hash"/>
|
||||
<result property="storageKey" column="storage_key"/>
|
||||
<result property="fileSize" column="file_size"/>
|
||||
<result property="fileHash" column="file_hash"/>
|
||||
@@ -21,8 +26,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectExportColumns">
|
||||
select export_id, ar_bill_id, file_name, file_type, template_code, template_version,
|
||||
storage_key, file_size, file_hash, row_count, export_status, export_by, export_time, remark
|
||||
select export_id,
|
||||
ar_bill_id,
|
||||
file_name,
|
||||
file_type,
|
||||
template_id,
|
||||
template_code,
|
||||
template_version,
|
||||
template_storage_type,
|
||||
template_storage_key,
|
||||
template_hash,
|
||||
storage_key,
|
||||
file_size,
|
||||
file_hash,
|
||||
row_count,
|
||||
export_status,
|
||||
export_by,
|
||||
export_time,
|
||||
remark
|
||||
from ar_bill_export
|
||||
</sql>
|
||||
|
||||
@@ -40,13 +61,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by export_time desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectProcessingByBillId" parameterType="long" resultMap="ArBillExportResult">
|
||||
<include refid="selectExportColumns"/>
|
||||
where ar_bill_id = #{arBillId} and export_status = 'PROCESSING'
|
||||
order by export_id desc limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="ArBillExport" useGeneratedKeys="true" keyProperty="exportId">
|
||||
insert into ar_bill_export (
|
||||
ar_bill_id, file_name, file_type, template_code, template_version, storage_key,
|
||||
ar_bill_id, file_name, file_type, template_id, template_code, template_version,
|
||||
template_storage_type, template_storage_key, template_hash, storage_key,
|
||||
file_size, file_hash, row_count, export_status, export_by, export_time, remark
|
||||
) values (
|
||||
#{arBillId}, #{fileName}, #{fileType}, #{templateCode}, #{templateVersion}, #{storageKey},
|
||||
#{arBillId}, #{fileName}, #{fileType}, #{templateId}, #{templateCode}, #{templateVersion},
|
||||
#{templateStorageType}, #{templateStorageKey}, #{templateHash}, #{storageKey},
|
||||
#{fileSize}, #{fileHash}, #{rowCount}, #{exportStatus}, #{exportBy}, sysdate(), #{remark}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="markSuccess" parameterType="ArBillExport">
|
||||
update ar_bill_export
|
||||
set storage_key = #{storageKey},
|
||||
file_size = #{fileSize},
|
||||
file_hash = #{fileHash},
|
||||
export_status = 'SUCCESS',
|
||||
remark = null
|
||||
where export_id = #{exportId} and export_status = 'PROCESSING'
|
||||
</update>
|
||||
|
||||
<update id="markFailed">
|
||||
update ar_bill_export
|
||||
set export_status = 'FAILED', remark = #{remark}
|
||||
where export_id = #{exportId} and export_status = 'PROCESSING'
|
||||
</update>
|
||||
|
||||
<update id="markExpiredProcessingAsFailed">
|
||||
update ar_bill_export
|
||||
set export_status = 'FAILED', remark = #{remark}
|
||||
where export_status = 'PROCESSING' and export_time < #{expiredBefore}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user