|
@@ -147,6 +147,32 @@
|
|
|
<include refid="majorOverdueSql" />
|
|
|
</select>
|
|
|
|
|
|
+ <resultMap id="settleeMajorProductionVOMap" type="com.dayou.vo.SettleMajorProductionVO">
|
|
|
+ <id property="id" column="id" />
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="claimAmount" column="claim_amount" />
|
|
|
+ <result property="orderId" column="order_id" />
|
|
|
+ <result property="reportNo" column="report_no" />
|
|
|
+ <result property="claimDate" column="claimDate" />
|
|
|
+ <result property="saveFileDate" column="save_file_date" />
|
|
|
+ <result property="settleDate" column="settleDate" />
|
|
|
+ <result property="deliveryDate" column="deliveryDate" />
|
|
|
+ <result property="name" column="name" />
|
|
|
+ <result property="bailor" column="bailor" />
|
|
|
+ <result property="evaluateAmount" column="evaluate_amount" />
|
|
|
+ <result property="principal" column="principal" />
|
|
|
+ <result property="clientManager" column="clientManager" />
|
|
|
+ <result property="clientName" column="clientName" />
|
|
|
+ <result property="clientSubName" column="clientSubName" />
|
|
|
+ <result property="evaluateDepartmentName" column="evaluateDepartmentName" />
|
|
|
+ <result property="marketDepartmentName" column="marketDepartmentName" />
|
|
|
+ <collection property="invoices" ofType="com.dayou.vo.SettleProInvoiceVo">
|
|
|
+ <result property="invoiceDate" column="invoiceDate" />
|
|
|
+ <result property="invoiceUser" column="invoiceUser" />
|
|
|
+ <result property="invoiceNo" column="invoiceNo" />
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<sql id="majorEvaluatorSettleSql">
|
|
|
SELECT
|
|
|
mp.id,
|
|
@@ -157,17 +183,17 @@
|
|
|
mp.save_file_date,
|
|
|
IF
|
|
|
( fc.claim_datetime > mp.save_file_date, fc.claim_datetime, mp.save_file_date ) AS settleDate,
|
|
|
- mp.NAME,
|
|
|
+ mp.name,
|
|
|
m.bailor,
|
|
|
mp.evaluate_amount,
|
|
|
- u.NAME AS principal,
|
|
|
- u1.NAME AS clientManager,
|
|
|
- cc.NAME AS clientName,
|
|
|
- cc1.NAME AS clientSubName,
|
|
|
- d.NAME AS evaluateDepartmentName,
|
|
|
+ u.name AS principal,
|
|
|
+ u1.name AS clientManager,
|
|
|
+ cc.name AS clientName,
|
|
|
+ cc1.name AS clientSubName,
|
|
|
+ d.name AS evaluateDepartmentName,
|
|
|
(
|
|
|
SELECT
|
|
|
- GROUP_CONCAT( NAME )
|
|
|
+ GROUP_CONCAT( name )
|
|
|
FROM
|
|
|
department
|
|
|
WHERE
|
|
@@ -177,7 +203,10 @@
|
|
|
FROM
|
|
|
post
|
|
|
WHERE
|
|
|
- id IN ( SELECT post_id FROM user_post WHERE user_id = m.client_manager_id ))) AS marketDepartmentName
|
|
|
+ id IN ( SELECT post_id FROM user_post WHERE user_id = m.client_manager_id ))) AS marketDepartmentName,
|
|
|
+ invoice.name AS invoiceUser,
|
|
|
+ invoice.real_make_date AS invoiceDate,
|
|
|
+ invoice.tax_no AS invoiceNo
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -204,6 +233,13 @@
|
|
|
LEFT JOIN customer_company cc ON cc.id = m.clientele_id
|
|
|
LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_sub_id
|
|
|
LEFT JOIN department d ON d.id = m.department_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT real_make_date, name, tax_no, order_fund_id, production_fund_id
|
|
|
+ FROM finance_invoice, user
|
|
|
+ WHERE maker_id = user.id
|
|
|
+ AND finance_invoice.deleted = 0
|
|
|
+ AND state = '已开票'
|
|
|
+ ) AS invoice ON IF(invoice.production_fund_id IS NOT NULL ,invoice.order_fund_id = pf.order_fund_id AND invoice.production_fund_id = pf.id,invoice.order_fund_id = pf.order_fund_id)
|
|
|
<where>
|
|
|
<if test="settleVO!=null and settleVO.orderId!=null and settleVO.orderId!='' ">
|
|
|
and m.order_id = #{settleVO.orderId}
|
|
@@ -220,11 +256,11 @@
|
|
|
</where>
|
|
|
order by settleDate DESC
|
|
|
</sql>
|
|
|
- <select id="majorEvaluatorSettleProd" parameterType="com.dayou.vo.SettleMajorProductionVO" resultType="com.dayou.vo.SettleMajorProductionVO">
|
|
|
+ <select id="majorEvaluatorSettleProd" parameterType="com.dayou.vo.SettleMajorProductionVO" resultMap="settleeMajorProductionVOMap">
|
|
|
<include refid="majorEvaluatorSettleSql" />
|
|
|
</select>
|
|
|
|
|
|
- <select id="majorEvaluatorSettleExport" parameterType="com.dayou.vo.SettleMajorProductionVO" resultType="com.dayou.vo.SettleMajorProductionVO">
|
|
|
+ <select id="majorEvaluatorSettleExport" parameterType="com.dayou.vo.SettleMajorProductionVO" resultMap="settleeMajorProductionVOMap">
|
|
|
<include refid="majorEvaluatorSettleSql" />
|
|
|
</select>
|
|
|
|
|
@@ -258,7 +294,10 @@
|
|
|
FROM
|
|
|
post
|
|
|
WHERE
|
|
|
- id IN ( SELECT post_id FROM user_post WHERE user_id = m.client_manager_id ))) AS marketDepartmentName
|
|
|
+ id IN ( SELECT post_id FROM user_post WHERE user_id = m.client_manager_id ))) AS marketDepartmentName,
|
|
|
+ invoice.name AS invoiceUser,
|
|
|
+ invoice.real_make_date AS invoiceDate,
|
|
|
+ invoice.tax_no AS invoiceNo
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -285,6 +324,13 @@
|
|
|
LEFT JOIN customer_company cc ON cc.id = m.clientele_id
|
|
|
LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_sub_id
|
|
|
LEFT JOIN department d ON d.id = m.department_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT real_make_date, name, tax_no, order_fund_id, production_fund_id
|
|
|
+ FROM finance_invoice, user
|
|
|
+ WHERE maker_id = user.id
|
|
|
+ AND finance_invoice.deleted = 0
|
|
|
+ AND state = '已开票'
|
|
|
+ ) AS invoice ON IF(invoice.production_fund_id IS NOT NULL ,invoice.order_fund_id = pf.order_fund_id AND invoice.production_fund_id = pf.id,invoice.order_fund_id = pf.order_fund_id)
|
|
|
<where>
|
|
|
<if test="settleVO!=null and settleVO.orderId!=null and settleVO.orderId!='' ">
|
|
|
and m.order_id = #{settleVO.orderId}
|
|
@@ -301,11 +347,11 @@
|
|
|
</where>
|
|
|
order by settleDate DESC
|
|
|
</sql>
|
|
|
- <select id="majorMarketerSettleProd" parameterType="com.dayou.vo.SettleMajorProductionVO" resultType="com.dayou.vo.SettleMajorProductionVO">
|
|
|
+ <select id="majorMarketerSettleProd" parameterType="com.dayou.vo.SettleMajorProductionVO" resultMap="settleeMajorProductionVOMap">
|
|
|
<include refid="majorMarketerSettleSql" />
|
|
|
</select>
|
|
|
|
|
|
- <select id="majorMarketSettleExport" parameterType="com.dayou.vo.SettleMajorProductionVO" resultType="com.dayou.vo.SettleMajorProductionVO">
|
|
|
+ <select id="majorMarketSettleExport" parameterType="com.dayou.vo.SettleMajorProductionVO" resultMap="settleeMajorProductionVOMap">
|
|
|
<include refid="majorMarketerSettleSql" />
|
|
|
</select>
|
|
|
|
|
@@ -1312,6 +1358,32 @@
|
|
|
<include refid="assetsOverdueSql" />
|
|
|
</select>
|
|
|
|
|
|
+ <resultMap id="settleAssetsProductionVOMap" type="com.dayou.vo.SettleAssetsProductionVO">
|
|
|
+ <id property="id" column="id" />
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="claimAmount" column="claim_amount" />
|
|
|
+ <result property="orderId" column="order_id" />
|
|
|
+ <result property="productionNo" column="production_no" />
|
|
|
+ <result property="claimDate" column="claimDate" />
|
|
|
+ <result property="saveFileDate" column="save_file_date" />
|
|
|
+ <result property="settleDate" column="settleDate" />
|
|
|
+ <result property="deliveryDate" column="deliveryDate" />
|
|
|
+ <result property="projectName" column="projectName" />
|
|
|
+ <result property="bailor" column="bailor" />
|
|
|
+ <result property="evaluateAmount" column="evaluate_amount" />
|
|
|
+ <result property="principal" column="principal" />
|
|
|
+ <result property="clientManager" column="clientManager" />
|
|
|
+ <result property="clientName" column="clientName" />
|
|
|
+ <result property="clientSubName" column="clientSubName" />
|
|
|
+ <result property="evaluateDepartmentName" column="evaluateDepartmentName" />
|
|
|
+ <result property="marketDepartmentName" column="marketDepartmentName" />
|
|
|
+ <collection property="invoices" ofType="com.dayou.vo.SettleProInvoiceVo">
|
|
|
+ <result property="invoiceDate" column="invoiceDate" />
|
|
|
+ <result property="invoiceUser" column="invoiceUser" />
|
|
|
+ <result property="invoiceNo" column="invoiceNo" />
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
<!--资产市场人员结算项目Sql-->
|
|
|
<sql id="assetsMarketerSettleSql">
|
|
|
SELECT
|
|
@@ -1320,7 +1392,7 @@
|
|
|
a.order_id,
|
|
|
ap.production_no,
|
|
|
fc.claim_datetime as claimDate,
|
|
|
- ap.delivery_date,
|
|
|
+ ap.delivery_date AS deliveryDate,
|
|
|
ap.save_file_date,
|
|
|
IF
|
|
|
( fc.claim_datetime > ap.delivery_date, fc.claim_datetime, ap.delivery_date ) AS settleDate,
|
|
@@ -1344,7 +1416,10 @@
|
|
|
FROM
|
|
|
post
|
|
|
WHERE
|
|
|
- id IN ( SELECT post_id FROM user_post WHERE user_id = a.client_manager_id ))) AS marketDepartmentName
|
|
|
+ id IN ( SELECT post_id FROM user_post WHERE user_id = a.client_manager_id ))) AS marketDepartmentName,
|
|
|
+ invoice.name AS invoiceUser,
|
|
|
+ invoice.real_make_date AS invoiceDate,
|
|
|
+ invoice.tax_no AS invoiceNo
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
@@ -1376,6 +1451,13 @@
|
|
|
LEFT JOIN customer_company cc ON cc.id = a.clientele_id
|
|
|
LEFT JOIN customer_company cc1 ON cc1.id = a.clientele_sub_id
|
|
|
LEFT JOIN department d ON d.id = a.department_id
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT real_make_date, name, tax_no, order_fund_id, production_fund_id
|
|
|
+ FROM finance_invoice, user
|
|
|
+ WHERE maker_id = user.id
|
|
|
+ AND finance_invoice.deleted = 0
|
|
|
+ AND state = '已开票'
|
|
|
+ ) AS invoice ON IF(invoice.production_fund_id IS NOT NULL ,invoice.order_fund_id = pf.order_fund_id AND invoice.production_fund_id = pf.id,invoice.order_fund_id = pf.order_fund_id)
|
|
|
<where>
|
|
|
<if test="settleVO!=null and settleVO.orderId!=null and settleVO.orderId!='' ">
|
|
|
and a.order_id = #{settleVO.orderId}
|
|
@@ -1394,40 +1476,15 @@
|
|
|
</sql>
|
|
|
|
|
|
<!--资产结算项目查询-->
|
|
|
- <select id="assetsMarketSettleProd" resultType="com.dayou.vo.SettleAssetsProductionVO">
|
|
|
+ <select id="assetsMarketSettleProd" resultMap="settleAssetsProductionVOMap">
|
|
|
<include refid="assetsMarketerSettleSql" />
|
|
|
</select>
|
|
|
|
|
|
<!--资产结算项目导出-->
|
|
|
- <select id="assetsMarketSettleExport" resultType="com.dayou.vo.SettleAssetsProductionVO">
|
|
|
+ <select id="assetsMarketSettleExport" resultMap="settleAssetsProductionVOMap">
|
|
|
<include refid="assetsMarketerSettleSql" />
|
|
|
</select>
|
|
|
|
|
|
- <resultMap id="settleAssetsProductionVOMap" type="com.dayou.vo.SettleAssetsProductionVO">
|
|
|
- <id property="id" column="id" />
|
|
|
- <result property="id" column="id" />
|
|
|
- <result property="claimAmount" column="claim_amount" />
|
|
|
- <result property="orderId" column="order_id" />
|
|
|
- <result property="productionNo" column="production_no" />
|
|
|
- <result property="claimDate" column="claimDate" />
|
|
|
- <result property="saveFileDate" column="save_file_date" />
|
|
|
- <result property="settleDate" column="settleDate" />
|
|
|
- <result property="projectName" column="projectName" />
|
|
|
- <result property="bailor" column="bailor" />
|
|
|
- <result property="evaluateAmount" column="evaluate_amount" />
|
|
|
- <result property="principal" column="principal" />
|
|
|
- <result property="clientManager" column="clientManager" />
|
|
|
- <result property="clientName" column="clientName" />
|
|
|
- <result property="clientSubName" column="clientSubName" />
|
|
|
- <result property="evaluateDepartmentName" column="evaluateDepartmentName" />
|
|
|
- <result property="marketDepartmentName" column="marketDepartmentName" />
|
|
|
- <collection property="invoices" ofType="com.dayou.vo.SettleProInvoiceVo">
|
|
|
- <result property="invoiceDate" column="invoiceDate" />
|
|
|
- <result property="invoiceUser" column="invoiceUser" />
|
|
|
- <result property="invoiceNo" column="invoiceNo" />
|
|
|
- </collection>
|
|
|
- </resultMap>
|
|
|
-
|
|
|
<!--资产评估人员结算项目Sql-->
|
|
|
<sql id="assetsEvaluatorSettleSql">
|
|
|
SELECT
|
|
@@ -1489,13 +1546,12 @@
|
|
|
LEFT JOIN customer_company cc1 ON cc1.id = a.clientele_sub_id
|
|
|
LEFT JOIN department d ON d.id = a.department_id
|
|
|
LEFT JOIN (
|
|
|
- SELECT real_make_date,name,tax_no,finance_invoice.order_fund_id,production_no
|
|
|
- FROM finance_invoice,user,production_fund
|
|
|
- WHERE maker_id = user.id
|
|
|
- AND finance_invoice.order_fund_id = production_fund.order_fund_id
|
|
|
- AND finance_invoice.deleted = 0
|
|
|
- AND state = '已开票'
|
|
|
- ) AS invoice ON invoice.order_fund_id = pf.order_fund_id AND invoice.production_no = pf.production_no
|
|
|
+ SELECT real_make_date, name, tax_no, order_fund_id, production_fund_id
|
|
|
+ FROM finance_invoice, user
|
|
|
+ WHERE maker_id = user.id
|
|
|
+ AND finance_invoice.deleted = 0
|
|
|
+ AND state = '已开票'
|
|
|
+ ) AS invoice ON IF(invoice.production_fund_id IS NOT NULL ,invoice.order_fund_id = pf.order_fund_id AND invoice.production_fund_id = pf.id,invoice.order_fund_id = pf.order_fund_id)
|
|
|
<where>
|
|
|
<if test="settleVO!=null and settleVO.orderId!=null and settleVO.orderId!='' ">
|
|
|
and a.order_id = #{settleVO.orderId}
|