feat: 会议ID应用赋值 + 会议表单/详情优化 + admin工作台统计与用户管理
- meetingId 由 DB 自增改为应用赋值 10 位数字 (yyMMdd + 4 位序列, Redis 按日期计数) - 会议开始时间不能晚于结束时间校验; 参会人表单身份证附件/角色单独一行 - 会议详情左右列比例 7:3 -> 8:2 (材料审核列收窄) - admin/workbench 用户总数/角色类型数/各角色分布统计修复 (改用 listByRole 按 role_type 过滤) - 新增 admin 用户管理接口 + 门户页脚 + H5 签到/上传优化
This commit is contained in:
@@ -41,10 +41,13 @@
|
||||
<select id="selectList" resultMap="BizExpertResult" parameterType="BizExpert">
|
||||
<include refid="selectFields"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name = #{name}</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||
<if test="workUnit != null and workUnit != ''"> and work_unit like concat('%', #{workUnit}, '%')</if>
|
||||
<if test="department != null and department != ''"> and department = #{department}</if>
|
||||
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
order by expert_id desc
|
||||
</select>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<id property="meetingId" column="meeting_id" />
|
||||
<result property="businessId" column="business_id" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="executionUnitId" column="execution_unit_id" />
|
||||
<result property="projectNo" column="project_no" />
|
||||
<result property="projectName" column="project_name" />
|
||||
<result property="meetingName" column="meeting_name" />
|
||||
@@ -15,6 +16,7 @@
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="orgName" column="org_name" />
|
||||
<result property="address" column="address" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="currentStage" column="current_stage" />
|
||||
<result property="supervisionOpinion" column="supervision_opinion" />
|
||||
<result property="supervisionBy" column="supervision_by" />
|
||||
@@ -49,7 +51,7 @@
|
||||
<result property="isDeleted" column="is_deleted" />
|
||||
</resultMap>
|
||||
<sql id="selectFields">
|
||||
meeting_id, business_id, project_id, project_no, project_name, meeting_name, period_no, total_periods, project_form, start_time, end_time, address, current_stage, supervision_opinion, supervision_by, supervision_time, material_audit_stage, is_executed, execute_time, is_settled, settle_time, is_finished, finish_time, is_frozen, freeze_time, material_audit_time, material_compliance_approved, submit_deadline, invitation_url, schedule_url, poster_url, labor_signed, labor_fee, meeting_fee, total_fee, fee_calc_status, create_by, create_time, update_by, update_time, is_deleted
|
||||
meeting_id, business_id, project_id, execution_unit_id, project_no, project_name, meeting_name, period_no, total_periods, project_form, start_time, end_time, address, remark, current_stage, supervision_opinion, supervision_by, supervision_time, material_audit_stage, is_executed, execute_time, is_settled, settle_time, is_finished, finish_time, is_frozen, freeze_time, material_audit_time, material_compliance_approved, submit_deadline, invitation_url, schedule_url, poster_url, labor_signed, labor_fee, meeting_fee, total_fee, fee_calc_status, create_by, create_time, update_by, update_time, is_deleted
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" resultMap="BizMeetingResult" parameterType="Long">
|
||||
select
|
||||
@@ -101,6 +103,10 @@
|
||||
select distinct a.project_id from biz_project_executor_assign a
|
||||
where a.is_deleted = 0 and a.staff_user_id = #{params.executorStaffUserId}
|
||||
)</if>
|
||||
<!-- 合规人员(manager) 数据权限: 只看本人创建项目的会议 -->
|
||||
<if test="params.managerCreateUserId != null">and project_id in (
|
||||
select project_id from biz_project where create_user_id = #{params.managerCreateUserId} and is_deleted = 0
|
||||
)</if>
|
||||
</where>
|
||||
order by meeting_id desc
|
||||
</select>
|
||||
@@ -110,6 +116,7 @@
|
||||
<if test="meetingId != null">meeting_id,</if>
|
||||
<if test="businessId != null and businessId != ''">business_id,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="executionUnitId != null">execution_unit_id,</if>
|
||||
<if test="projectNo != null and projectNo != ''">project_no,</if>
|
||||
<if test="projectName != null and projectName != ''">project_name,</if>
|
||||
<if test="meetingName != null and meetingName != ''">meeting_name,</if>
|
||||
@@ -119,6 +126,7 @@
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="address != null and address != ''">address,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="currentStage != null and currentStage != ''">current_stage,</if>
|
||||
<if test="supervisionOpinion != null and supervisionOpinion != ''">supervision_opinion,</if>
|
||||
<if test="supervisionBy != null and supervisionBy != ''">supervision_by,</if>
|
||||
@@ -138,6 +146,7 @@
|
||||
<if test="meetingId != null">#{meetingId},</if>
|
||||
<if test="businessId != null and businessId != ''">#{businessId},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="executionUnitId != null">#{executionUnitId},</if>
|
||||
<if test="projectNo != null and projectNo != ''">#{projectNo},</if>
|
||||
<if test="projectName != null and projectName != ''">#{projectName},</if>
|
||||
<if test="meetingName != null and meetingName != ''">#{meetingName},</if>
|
||||
@@ -147,6 +156,7 @@
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="address != null and address != ''">#{address},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="currentStage != null and currentStage != ''">#{currentStage},</if>
|
||||
<if test="supervisionOpinion != null and supervisionOpinion != ''">#{supervisionOpinion},</if>
|
||||
<if test="supervisionBy != null and supervisionBy != ''">#{supervisionBy},</if>
|
||||
@@ -168,6 +178,7 @@
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="businessId != null and businessId != ''">business_id = #{businessId},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="executionUnitId != null">execution_unit_id = #{executionUnitId},</if>
|
||||
<if test="projectNo != null and projectNo != ''">project_no = #{projectNo},</if>
|
||||
<if test="projectName != null and projectName != ''">project_name = #{projectName},</if>
|
||||
<if test="meetingName != null and meetingName != ''">meeting_name = #{meetingName},</if>
|
||||
@@ -178,6 +189,7 @@
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="address != null and address != ''">address = #{address},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="currentStage != null and currentStage != ''">current_stage = #{currentStage},</if>
|
||||
<if test="supervisionOpinion != null and supervisionOpinion != ''">supervision_opinion = #{supervisionOpinion},</if>
|
||||
<if test="supervisionBy != null and supervisionBy != ''">supervision_by = #{supervisionBy},</if>
|
||||
@@ -224,6 +236,17 @@
|
||||
<select id="countByProjectId" resultType="int" parameterType="Long">
|
||||
select count(*) from biz_meeting where project_id = #{projectId} and is_deleted = 0
|
||||
</select>
|
||||
<!-- 建会限额用 (执行方隔离): 某项目下、某执行方未软删的会议数 -->
|
||||
<select id="countByProjectIdAndExecutionUnit" resultType="int">
|
||||
select count(*) from biz_meeting where project_id = #{projectId} and is_deleted = 0
|
||||
and execution_unit_id = #{executionUnitId}
|
||||
</select>
|
||||
<!-- 建会校验用 (执行方隔离): 某项目下、某执行方、某期数的未软删会议数 (相同期数冲突检测) -->
|
||||
<select id="countByProjectIdExecutionUnitPeriod" resultType="int">
|
||||
select count(*) from biz_meeting where project_id = #{projectId} and is_deleted = 0
|
||||
and execution_unit_id = #{executionUnitId}
|
||||
and period_no = #{periodNo}
|
||||
</select>
|
||||
<!-- 自动流转 (MeetingStageScheduler 每分钟调): start_time 已过 且 material 未提交 且未执行的会议 → is_executed=1 + RUNNING. 已软删/已冻结/已提交材料的不动. -->
|
||||
<update id="markExecuted">
|
||||
update biz_meeting
|
||||
@@ -250,19 +273,6 @@
|
||||
and submit_deadline is not null
|
||||
and submit_deadline <= NOW()
|
||||
</update>
|
||||
<!-- 自动流转 (MeetingStageScheduler 每分钟调): 材料 APPROVED 且 材料审核时间已过 1 自然日 → AWAITING_SETTLEMENT (待结算 24h 慢路径) -->
|
||||
<update id="markSettlementReady">
|
||||
update biz_meeting
|
||||
set current_stage = 'AWAITING_SETTLEMENT'
|
||||
where is_deleted = 0
|
||||
and is_frozen = 0
|
||||
and is_settled = 0
|
||||
and is_finished = 0
|
||||
and material_audit_stage = 'APPROVED'
|
||||
and current_stage = 'SUPERVISION_APPROVED'
|
||||
and material_audit_time is not null
|
||||
and material_audit_time <= (NOW() - INTERVAL 1 DAY)
|
||||
</update>
|
||||
<!-- 费用汇总调度器: 查 fee_calc_status=0 且未软删的会议 id -->
|
||||
<select id="selectPendingFeeCalcIds" resultType="Long">
|
||||
select meeting_id from biz_meeting where fee_calc_status = 0 and is_deleted = 0
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<result property="projectForm" column="project_form" />
|
||||
<result property="isFinished" column="is_finished" />
|
||||
<result property="isSettled" column="is_settled" />
|
||||
<result property="isPublished" column="is_published" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createUserId" column="create_user_id" />
|
||||
<result property="createUserName" column="create_user_name" />
|
||||
@@ -49,7 +50,13 @@
|
||||
<result property="isDeleted" column="is_deleted" />
|
||||
</resultMap>
|
||||
<sql id="selectFields">
|
||||
select p.project_id, p.project_no, p.project_name, p.total_sessions, p.done_sessions, p.todo_sessions, p.total_amount, p.available_amount, p.paid_labor_amount, p.paid_meeting_amount, p.manager_score, p.sponsor_score, p.project_form, p.is_finished, p.is_settled, p.sponsor_org_id, p.lead_user_id, p.is_bid_project, p.create_by, p.create_user_id, p.create_time, p.update_by, p.update_time, p.manage_fee, p.role_labor, p.start_time, p.end_time, p.submit_deadline_days, p.support_contract_url, p.execute_contract_url, p.invitation_url, p.support_letter_url, p.publish_url, p.schedule_url, p.open_deadline, p.open_status, p.is_deleted,
|
||||
select p.project_id, p.project_no, p.project_name, p.total_sessions, p.done_sessions, p.todo_sessions, p.total_amount,
|
||||
(select ifnull(sum(m.labor_fee), 0) from biz_meeting m where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0) as paid_labor_amount,
|
||||
(select ifnull(sum(m.meeting_fee), 0) from biz_meeting m where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0) as paid_meeting_amount,
|
||||
(p.total_amount - ifnull(p.manage_fee, 0)
|
||||
- (select ifnull(sum(m.labor_fee), 0) from biz_meeting m where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0)
|
||||
- (select ifnull(sum(m.meeting_fee), 0) from biz_meeting m where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0)) as available_amount,
|
||||
p.manager_score, p.sponsor_score, p.project_form, p.is_finished, p.is_settled, p.is_published, p.sponsor_org_id, p.lead_user_id, p.is_bid_project, p.create_by, p.create_user_id, p.create_time, p.update_by, p.update_time, p.manage_fee, p.role_labor, p.start_time, p.end_time, p.submit_deadline_days, p.support_contract_url, p.execute_contract_url, p.invitation_url, p.support_letter_url, p.publish_url, p.schedule_url, p.open_deadline, p.open_status, p.is_deleted,
|
||||
o.org_name as sponsor_org_name,
|
||||
su.user_name as sponsor_admin_user_name,
|
||||
lu.user_name as lead_user_name,
|
||||
@@ -68,8 +75,13 @@
|
||||
<!-- sponsor 端专属查询: 与 selectFields 等价 (sponsor 评分改走 biz_project_rating 子表, 这里只查项目本体) -->
|
||||
<sql id="selectFieldsForSponsor">
|
||||
select p.project_id, p.project_no, p.project_name, p.total_sessions, p.done_sessions, p.todo_sessions,
|
||||
p.total_amount, p.available_amount, p.paid_labor_amount, p.paid_meeting_amount,
|
||||
p.manager_score, p.sponsor_score, p.project_form, p.is_finished, p.is_settled,
|
||||
p.total_amount,
|
||||
(select ifnull(sum(m.labor_fee), 0) from biz_meeting m where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0) as paid_labor_amount,
|
||||
(select ifnull(sum(m.meeting_fee), 0) from biz_meeting m where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0) as paid_meeting_amount,
|
||||
(p.total_amount - ifnull(p.manage_fee, 0)
|
||||
- (select ifnull(sum(m.labor_fee), 0) from biz_meeting m where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0)
|
||||
- (select ifnull(sum(m.meeting_fee), 0) from biz_meeting m where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0)) as available_amount,
|
||||
p.manager_score, p.sponsor_score, p.project_form, p.is_finished, p.is_settled, p.is_published,
|
||||
p.sponsor_org_id, p.lead_user_id, p.is_bid_project,
|
||||
p.create_by, p.create_user_id, p.create_time, p.update_by, p.update_time, p.manage_fee, p.role_labor,
|
||||
p.start_time, p.end_time, p.submit_deadline_days,
|
||||
@@ -147,9 +159,11 @@
|
||||
1) a.exec_user_id = 当前 user_id (子账号直接被指派)
|
||||
2) a.execution_unit_id = 当前 user_id 对应的 executor biz_org.org_id (主账号整公司被指派)
|
||||
注: executor 角色无评分/聚合分需求, 复用 selectFields (含 sponsor_score / manager_score)
|
||||
金额列口径 (执行方级): 总金额=assigned_amount(本执行方被分配), 已支付劳务/会务/可用金额 均按
|
||||
biz_meeting.execution_unit_id = 本执行方 org 过滤, 与项目级 total_amount/available_amount 无关.
|
||||
-->
|
||||
<select id="selectExecutorList" resultMap="BizProjectResult" parameterType="BizProject">
|
||||
select distinct p.project_id, p.project_no, p.project_name, p.total_sessions, p.done_sessions, p.todo_sessions, p.total_amount, p.available_amount, p.paid_labor_amount, p.paid_meeting_amount, p.manager_score, p.sponsor_score, p.project_form, p.is_finished, p.is_settled, p.sponsor_org_id, p.lead_user_id, p.is_bid_project, p.create_by, p.create_user_id, p.create_time, p.update_by, p.update_time, p.manage_fee, p.role_labor, p.start_time, p.end_time, p.submit_deadline_days, p.support_contract_url, p.execute_contract_url, p.invitation_url, p.support_letter_url, p.publish_url,
|
||||
select distinct p.project_id, p.project_no, p.project_name, p.total_sessions, p.done_sessions, p.todo_sessions, p.total_amount, p.manager_score, p.sponsor_score, p.project_form, p.is_finished, p.is_settled, p.is_published, p.sponsor_org_id, p.lead_user_id, p.is_bid_project, p.create_by, p.create_user_id, p.create_time, p.update_by, p.update_time, p.manage_fee, p.role_labor, p.start_time, p.end_time, p.submit_deadline_days, p.support_contract_url, p.execute_contract_url, p.invitation_url, p.support_letter_url, p.publish_url,
|
||||
o.org_name as sponsor_org_name,
|
||||
su.user_name as sponsor_admin_user_name,
|
||||
lu.user_name as lead_user_name,
|
||||
@@ -168,7 +182,37 @@
|
||||
where bpa4.project_id = p.project_id
|
||||
and bpa4.is_deleted = 0
|
||||
and bpa4.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as assigned_amount,
|
||||
(select count(*) from biz_meeting m where m.project_id = p.project_id and m.is_deleted = 0) as meeting_count
|
||||
(select ifnull(sum(m.labor_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id
|
||||
and m.is_settled = 1
|
||||
and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as paid_labor_amount,
|
||||
(select ifnull(sum(m.meeting_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id
|
||||
and m.is_settled = 1
|
||||
and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as paid_meeting_amount,
|
||||
(select coalesce(sum(bpa5.amount), 0)
|
||||
from biz_project_assign bpa5
|
||||
where bpa5.project_id = p.project_id
|
||||
and bpa5.is_deleted = 0
|
||||
and bpa5.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor'))
|
||||
- (select ifnull(sum(m.labor_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id
|
||||
and m.is_settled = 1
|
||||
and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor'))
|
||||
- (select ifnull(sum(m.meeting_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id
|
||||
and m.is_settled = 1
|
||||
and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as available_amount,
|
||||
(select count(*) from biz_meeting m where m.project_id = p.project_id and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as meeting_count
|
||||
from biz_project p
|
||||
<!-- 执行方专属 join: 把 executor 限定条件放进 ON (而不是 WHERE), 这样 join 只命中分给当前执行方的 assignment, 1 行/项目. SELECT DISTINCT 保留以防 LEFT JOIN 副作用 -->
|
||||
join biz_project_assign a on a.project_id = p.project_id
|
||||
@@ -194,9 +238,10 @@
|
||||
(主账号把执行人派到项目上后, 执行人登录看自己被派到的项目)
|
||||
严格隔离: 不 JOIN biz_project_assign (避免主账号过滤), 不 UNION intent (executor 与 biz_*_intent 完全无关)
|
||||
场次/金额列 assigned_sessions/assigned_amount 按 params.executorUserId (主账号/本公司) 聚合 — 执行人看到的是公司数据, 不是个人数据
|
||||
已支付劳务/会务/可用金额同样按 biz_meeting.execution_unit_id = 本公司 org 过滤 (执行方级).
|
||||
-->
|
||||
<select id="selectExecutorStaffList" resultMap="BizProjectResult" parameterType="BizProject">
|
||||
select p.project_id, p.project_no, p.project_name, p.total_sessions, p.done_sessions, p.todo_sessions, p.total_amount, p.available_amount, p.paid_labor_amount, p.paid_meeting_amount, p.manager_score, p.sponsor_score, p.project_form, p.is_finished, p.is_settled, p.sponsor_org_id, p.lead_user_id, p.is_bid_project, p.create_by, p.create_user_id, p.create_time, p.update_by, p.update_time, p.manage_fee, p.role_labor, p.start_time, p.end_time, p.submit_deadline_days, p.support_contract_url, p.execute_contract_url, p.invitation_url, p.support_letter_url, p.publish_url,
|
||||
select p.project_id, p.project_no, p.project_name, p.total_sessions, p.done_sessions, p.todo_sessions, p.total_amount, p.manager_score, p.sponsor_score, p.project_form, p.is_finished, p.is_settled, p.is_published, p.sponsor_org_id, p.lead_user_id, p.is_bid_project, p.create_by, p.create_user_id, p.create_time, p.update_by, p.update_time, p.manage_fee, p.role_labor, p.start_time, p.end_time, p.submit_deadline_days, p.support_contract_url, p.execute_contract_url, p.invitation_url, p.support_letter_url, p.publish_url,
|
||||
o.org_name as sponsor_org_name,
|
||||
su.user_name as sponsor_admin_user_name,
|
||||
lu.user_name as lead_user_name,
|
||||
@@ -215,7 +260,37 @@
|
||||
where bpa4.project_id = p.project_id
|
||||
and bpa4.is_deleted = 0
|
||||
and bpa4.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as assigned_amount,
|
||||
(select count(*) from biz_meeting m where m.project_id = p.project_id and m.is_deleted = 0) as meeting_count
|
||||
(select ifnull(sum(m.labor_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id
|
||||
and m.is_settled = 1
|
||||
and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as paid_labor_amount,
|
||||
(select ifnull(sum(m.meeting_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id
|
||||
and m.is_settled = 1
|
||||
and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as paid_meeting_amount,
|
||||
(select coalesce(sum(bpa5.amount), 0)
|
||||
from biz_project_assign bpa5
|
||||
where bpa5.project_id = p.project_id
|
||||
and bpa5.is_deleted = 0
|
||||
and bpa5.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor'))
|
||||
- (select ifnull(sum(m.labor_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id
|
||||
and m.is_settled = 1
|
||||
and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor'))
|
||||
- (select ifnull(sum(m.meeting_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id
|
||||
and m.is_settled = 1
|
||||
and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as available_amount,
|
||||
(select count(*) from biz_meeting m where m.project_id = p.project_id and m.is_deleted = 0
|
||||
and m.execution_unit_id = (select org_id from biz_org where user_id = #{params.executorUserId} and org_type = 'executor')) as meeting_count
|
||||
from biz_project p
|
||||
left join biz_org o on o.org_id = p.sponsor_org_id and o.org_type = 'sponsor'
|
||||
left join sys_user su on su.user_id = o.user_id
|
||||
@@ -241,6 +316,8 @@
|
||||
<include refid="selectFields"/>
|
||||
<where>
|
||||
p.is_deleted = 0
|
||||
<if test="params.createUserId != null">and create_user_id = #{params.createUserId}</if>
|
||||
<if test="isPublished != null and isPublished != ''">and p.is_published = #{isPublished}</if>
|
||||
<if test="params.projectIds != null and params.projectIds.size() > 0">
|
||||
and project_id in
|
||||
<foreach collection="params.projectIds" item="id" open="(" separator="," close=")">
|
||||
@@ -289,14 +366,12 @@
|
||||
<if test="doneSessions != null">done_sessions,</if>
|
||||
<if test="todoSessions != null">todo_sessions,</if>
|
||||
<if test="totalAmount != null">total_amount,</if>
|
||||
<if test="availableAmount != null">available_amount,</if>
|
||||
<if test="paidLaborAmount != null">paid_labor_amount,</if>
|
||||
<if test="paidMeetingAmount != null">paid_meeting_amount,</if>
|
||||
<if test="managerScore != null">manager_score,</if>
|
||||
<if test="sponsorScore != null">sponsor_score,</if>
|
||||
<if test="projectForm != null and projectForm != ''">project_form,</if>
|
||||
<if test="isFinished != null and isFinished != ''">is_finished,</if>
|
||||
<if test="isSettled != null and isSettled != ''">is_settled,</if>
|
||||
<if test="isPublished != null and isPublished != ''">is_published,</if>
|
||||
<if test="sponsorOrgId != null">sponsor_org_id,</if>
|
||||
<if test="leadUserId != null">lead_user_id,</if>
|
||||
<if test="isBidProject != null and isBidProject != ''">is_bid_project,</if>
|
||||
@@ -335,6 +410,7 @@
|
||||
<if test="projectForm != null and projectForm != ''">#{projectForm},</if>
|
||||
<if test="isFinished != null and isFinished != ''">#{isFinished},</if>
|
||||
<if test="isSettled != null and isSettled != ''">#{isSettled},</if>
|
||||
<if test="isPublished != null and isPublished != ''">#{isPublished},</if>
|
||||
<if test="sponsorOrgId != null">#{sponsorOrgId},</if>
|
||||
<if test="leadUserId != null">#{leadUserId},</if>
|
||||
<if test="isBidProject != null and isBidProject != ''">#{isBidProject},</if>
|
||||
@@ -380,14 +456,12 @@
|
||||
<if test="doneSessions != null">done_sessions = #{doneSessions},</if>
|
||||
<if test="todoSessions != null">todo_sessions = #{todoSessions},</if>
|
||||
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
|
||||
<if test="availableAmount != null">available_amount = #{availableAmount},</if>
|
||||
<if test="paidLaborAmount != null">paid_labor_amount = #{paidLaborAmount},</if>
|
||||
<if test="paidMeetingAmount != null">paid_meeting_amount = #{paidMeetingAmount},</if>
|
||||
<if test="managerScore != null">manager_score = #{managerScore},</if>
|
||||
<if test="sponsorScore != null">sponsor_score = #{sponsorScore},</if>
|
||||
<if test="projectForm != null and projectForm != ''">project_form = #{projectForm},</if>
|
||||
<if test="isFinished != null and isFinished != ''">is_finished = #{isFinished},</if>
|
||||
<if test="isSettled != null and isSettled != ''">is_settled = #{isSettled},</if>
|
||||
<if test="isPublished != null and isPublished != ''">is_published = #{isPublished},</if>
|
||||
<if test="sponsorOrgId != null">sponsor_org_id = #{sponsorOrgId},</if>
|
||||
<if test="leadUserId != null">lead_user_id = #{leadUserId},</if>
|
||||
<if test="isBidProject != null and isBidProject != ''">is_bid_project = #{isBidProject},</if>
|
||||
@@ -399,13 +473,14 @@
|
||||
</trim>
|
||||
where project_id = #{projectId}
|
||||
</update>
|
||||
<!-- 删除公告: 将 4 个公示 URL 字段全部置 NULL (未发布态由 URL 是否为空判定, 表里无独立 is_published 列) -->
|
||||
<!-- 删除公告: 将 4 个公示 URL 字段置 NULL 并 is_published='0' (取消发布) -->
|
||||
<update id="clearAnnouncement" parameterType="Long">
|
||||
update biz_project
|
||||
set invitation_url = null,
|
||||
support_letter_url = null,
|
||||
publish_url = null,
|
||||
schedule_url = null
|
||||
schedule_url = null,
|
||||
is_published = '0'
|
||||
where project_id = #{projectId}
|
||||
</update>
|
||||
<!-- 开通到期回收: 每天 00:05 由 OpenStatusScheduler 调用, 到期(open_deadline <= 今天)的 Y 置回 N -->
|
||||
@@ -461,28 +536,4 @@
|
||||
and b.staff_user_id = #{userId}
|
||||
) t
|
||||
</select>
|
||||
<!-- 会议结算后重算项目金额: 全量 SUM 已结算会议 (is_settled=1) 的 labor_fee/meeting_fee,
|
||||
幂等回写 paid_labor_amount / paid_meeting_amount, 并重算 available_amount = 总金额 - 管理费 - 已支付劳务 - 已支付会务.
|
||||
单条 UPDATE 原子执行, 多会议并发结算同一项目时无丢失更新 (每次都是全量重算). -->
|
||||
<update id="recomputeSettledAmounts" parameterType="Long">
|
||||
update biz_project p
|
||||
set p.paid_labor_amount = (
|
||||
select ifnull(sum(m.labor_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0
|
||||
),
|
||||
p.paid_meeting_amount = (
|
||||
select ifnull(sum(m.meeting_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0
|
||||
),
|
||||
p.available_amount = p.total_amount - ifnull(p.manage_fee, 0)
|
||||
- (select ifnull(sum(m.labor_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0)
|
||||
- (select ifnull(sum(m.meeting_fee), 0)
|
||||
from biz_meeting m
|
||||
where m.project_id = p.project_id and m.is_settled = 1 and m.is_deleted = 0)
|
||||
where p.project_id = #{projectId}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user