a.id as "id",
a.orderno as "orderno",
a.policyno as "policyno",
a.dept_id as "deptId",
a.riskcode as "riskcode",
a.pay_date as "payDate",
a.signdate as "signdate",
a.company_id as "companyId",
a.agreement_id as "agreementId",
a.licenseno as "licenseno",
a.taxamount as "taxamount",
a.no_tax_premium as "noTaxPremium",
a.commission_feerate as "commissionFeerate",
a.other_feerate as "otherFeerate",
a.commission_feevalue as "commissionFeevalue",
a.other_feevalue as "otherFeevalue",
a.all_fee_value as "allFeeValue",
a.final_fee_value as "finalFeeValue",
a.doing_fee_value as "doingFeeValue",
a.voucher_number as "voucherNumber",
a.contract_id as "contractId",
a.contract_file_id as "contractFileId",
a.handling_fees_status as "handlingFeesStatus",
a.no_policyno as "noPolicyno",
a.sy_policyno as "syPolicyno",
a.documentary_fees_status as "documentaryFeesStatus",
a.is_not_car as "isNotCar",
a.is_not_documentary as "isNotDocumentary",
a.invoic_amount as "invoicAmount",
a.invoic_id as "invoicId",
a.tax_premium as "taxPremium",
a.jq_supervise_costs_premiums as "jqSuperviseCostsPremiums",
a.jq_supervise_costs_proportion as "jqSuperviseCostsProportion",
a.sy_supervise_costs_premiums as "sySuperviseCostsPremiums",
a.sy_supervise_costs_proportion as "sySuperviseCostsProportion",
a.no_supervise_costs_premiums as "noSuperviseCostsPremiums",
a.no_supervise_costs_proportion as "noSuperviseCostsProportion",
a.partner_companies_id as "partnerCompaniesId",
a.jq_premium as "jqPremium",
a.sy_premium as "syPremium",
a.no_premium as "noPremium",
a.jq_no_tax_premium as "jqNoTaxPremium",
a.sy_no_tax_premium as "syNoTaxPremium",
a.no_no_tax_premium as "noNoTaxPremium",
a.jq_receivable_proportion as "jqReceivableProportion",
a.sy_receivable_proportion as "syReceivableProportion",
a.no_receivable_proportion as "noReceivableProportion",
a.jq_other_costs_proportion as "jqOtherCostsProportion",
a.sy_other_costs_proportion as "syOtherCostsProportion",
a.no_other_costs_proportion as "noOtherCostsProportion",
a.settlement_time as "settlementTime",
a.update_time as "updateTime",
a.settlement_user_id as "settlementUserId",
a.update_user_id as "updateUserId",
a.jq_other_costs_premium as "jqOtherCostsPremium",
a.sy_other_costs_premium as "syOtherCostsPremium",
a.no_other_costs_premium as "noOtherCostsPremium",
a.partner_companies_name as "partnerCompaniesName",
a.company_name as "companyName",
a.receivable_amount as "receivableAmount",
a.invoic_time as "invoicTime",
a.insured_name as "insuredName",
a.remarks as "remarks",
a.jq_start_date as "jqStartDate",
a.jq_end_date as "jqEndDate",
a.sy_start_date as "syStartDate",
a.sy_end_date as "syEndDate",
a.settle_other_status as "settleOtherStatus",
a.user_id as "userId",
a.invoicing_method as "invoicingMethod",
a.settlement_image_id as "settlementImageId",
a.task_id as "taskId",
a.create_time as "createTime"
select
pa.agreement_name as "agreementName",
pa.agreement_type as "agreementType",
pa.docking_person as "dockingPerson",
upf.url as "imageUrl",
su.name as "userName",
b.name as "deptName",
from ins_ply_income a
LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
LEFT JOIN sys_user su on su.id=a.user_id
LEFT JOIN ins_upload_files upf on a.settlement_image_id=upf.id
LEFT JOIN esm_ins_company eic on eic.id=a.partner_companies_id
LEFT JOIN sys_dept b on pa.dept_id=b.id
and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
and pa.agreement_type =#{agreementType}
and a.signdate between #{signDateStart} and #{signDateEnd}
and a.handling_fees_status =#{handlingFeesStatus}
AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
and eic.parent_id LIKE CONCAT(#{provincePartnerCompaniesId}, '%')
and pa.docking_person =#{dockingPerson}
and pa.dept_id LIKE CONCAT(#{provinceId}, '%')
and pa.dept_id LIKE CONCAT(#{cityId}, '%')
and pa.dept_id LIKE CONCAT(#{countyId}, '%')
and a.task_id = #{taskId}
and a.orderno =#{orderno}
and a.company_id =#{companyName}
and a.policyno =#{policyno}
and a.documentary_fees_status =#{documentaryFeesStatus}
and a.is_not_car =#{isNotCar}
and pa.dept_id =#{deptId}
and a.id in
#{item}
and a.id in
#{item}
and a.id in
#{item}
and a.partner_companies_id in
#{item}
and a.is_not_documentary =#{isOther}
and a.licenseno =#{licenseno}
and a.sy_policyno =#{syPolicyno}
and a.no_policyno =#{noPolicyno}
AND a.signdate =#{signdate}
AND a.partner_companies_id =#{partnerCompaniesId}
AND a.partner_companies_name =#{partnerCompaniesName}
AND a.create_time =#{createTime}
AND a.settlement_time =#{settlementTime}
and a.userId =#{userId}
and a.company_id =#{companyId}
and a.riskcode =#{riskcode}
AND YEAR(a.signdate) =#{year}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
AND a.insured_name =#{insuredName}
AND DATE(a.jq_start_date) BETWEEN #{jqStartDate} AND #{jqEndDate}
AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
ORDER BY a.create_time desc
select
pa.agreement_name as "agreementName",
pa.agreement_type as "agreementType",
su.name as "userName",
from ins_ply_income a
LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
LEFT JOIN sys_user su on su.id=a.user_id
a.id=#{id}
select
count(MONTH(a.signdate)) as "totalorders",
MONTH(a.signdate) as "monthSigdate",
sum(a.other_feevalue) as "allLOtherFeevalue",
GROUP_CONCAT(a.id) as "ids"
from ins_ply_income a
LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
a.is_not_car =#{isNotCar}
and a.is_not_documentary =#{isOther}
and pa.agreement_type =#{agreementType}
and a.documentary_fees_status =#{documentaryFeesStatus}
and a.company_id =#{companyId}
and YEAR(a.signdate) =#{year}
group by MONTH(a.signdate)
update ins_ply_income
contract_id = #{contractId},
voucher_number = #{voucherNumber},
contract_file_id = #{contractFileId},
handling_fees_status = #{handlingFeesStatus}
documentary_fees_status = #{documentaryFeesStatus}
where orderno =#{orderno}
SELECT
a.companyId as "companyId",
a.totalorders as "totalorders",
a.ids as "ids",
a.allLOtherFeevalue as "allLOtherFeevalue"
FROM
(
SELECT
a.company_id AS "companyId",
count(a.orderno) as "totalorders",
sum( a.other_feevalue ) AS "allLOtherFeevalue",
GROUP_CONCAT(a.id) as "ids"
FROM
ins_ply_income a
LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
WHERE
pa.agreement_type = '2'
and a.is_not_car =#{isNotCar}
AND a.documentary_fees_status = #{documentaryFeesStatus}
and a.is_not_documentary =#{isOther}
and a.company_id =#{companyId}
and YEAR(a.signdate) =#{year}
and month(a.signdate) =#{month}
GROUP BY
a.company_id
) a
LEFT JOIN ptl_agreement pa ON a.companyId = pa.association_companies_id
select
from ins_ply_income a
1=1
AND a.licenseno=#{licenseno}
AND a.policyno=#{policyno}
AND a.sy_policyno=#{syPolicyno}
AND a.no_policyno=#{noPolicyno}
and a.is_not_documentary =#{isOther}
select
from ins_ply_income a
1=1
AND a.licenseno=#{licenseno}
AND a.policyno=#{policyno}
AND a.sy_policyno=#{syPolicyno}
AND a.no_policyno=#{noPolicyno}
and a.is_not_documentary =#{isOther}
and a.is_not_car =#{isNotCar}
and a.handling_fees_status =#{handlingFeesStatus}
and a.jq_supervise_costs_premiums =#{jqSuperviseCostsPremiums}
and a.jq_supervise_costs_proportion =#{jqSuperviseCostsProportion}
and a.jq_other_costs_proportion =#{jqOtherCostsProportion}
and a.sy_other_costs_proportion =#{syOtherCostsProportion}
and a.sy_supervise_costs_premiums =#{sySuperviseCostsPremiums}
and a.no_other_costs_proportion =#{noOtherCostsProportion}
and a.sy_supervise_costs_proportion =#{sySuperviseCostsProportion}
and a.no_supervise_costs_premiums =#{noSuperviseCostsPremiums}
and a.no_supervise_costs_proportion =#{noSuperviseCostsProportion}
and a.jq_premium =#{jqPremium}
and a.sy_premium =#{jqPremium}
and a.no_premium =#{noPremium}
limit 1
select
COALESCE( sum(a.commission_feevalue),0) as "commissionFeevalue",
COALESCE(sum(a.other_feevalue),0) as "otherFeevalue",
COALESCE(SUM(COALESCE(a.commission_feevalue, 0) + COALESCE(a.other_feevalue, 0)), 0) AS "totalFeevalue"
from ins_ply_income a
LEFT JOIN ptl_agreement pa on pa.id= a.agreement_id
1=1
and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
and pa.agreement_type =#{agreementType}
and a.signdate between #{signDateStart} and #{signDateEnd}
and a.handling_fees_status =#{handlingFeesStatus}
and a.orderno =#{orderno}
and a.policyno =#{policyno}
and a.documentary_fees_status =#{documentaryFeesStatus}
and a.id in
#{item}
and a.is_not_car =#{isNotCar}
and a.is_not_documentary =#{isOther}
and a.licenseno in
#{item}
and a.policyno =#{policyno}
and a.sy_policyno =#{syPolicyno}
and a.no_policyno =#{noPolicyno}
and a.signdate =#{signdate}
and a.partner_companies_id =#{partnerCompaniesId}
a.create_time =#{createTime}
a.settlement_time =#{settlementTime}
and a.userId =#{userId}
and a.company_id =#{companyId}
and a.riskcode =#{riskcode}
AND YEAR(a.signdate) =#{year}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
SELECT
SUM(a.commission_feevalue) AS commissionFeevalue,
SUM(CASE WHEN a.handling_fees_status = '2' THEN a.commission_feevalue ELSE 0 END) AS "invoicCommissionFeevalue",
SUM( CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END ) AS "noInvoicCommissionFeevalue",
SUM(CASE WHEN a.handling_fees_status = '1' THEN a.commission_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
SUM( CASE WHEN ( a.handling_fees_status = '2' or a.handling_fees_status = '1' ) THEN a.commission_feevalue ELSE 0 END ) AS "allInvoicCommissionFeevalue",
SUM( CASE WHEN ( a.handling_fees_status = '2' or a.handling_fees_status = '0' ) THEN a.commission_feevalue ELSE 0 END ) AS "unSettledAmount"
FROM
ins_ply_income a
LEFT JOIN
ptl_agreement pa ON pa.id = a.agreement_id
1=1
and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
and pa.agreement_type =#{agreementType}
and a.orderno =#{orderno}
and a.company_id =#{companyName}
and a.signdate between #{signDateStart} and #{signDateEnd}
and a.policyno =#{policyno}
and a.handling_fees_status =#{handlingFeesStatus}
and a.documentary_fees_status =#{documentaryFeesStatus}
and a.is_not_car =#{isNotCar}
AND DATE(a.jq_start_date) BETWEEN #{jqStartDate} AND #{jqEndDate}
AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
and a.is_not_documentary =#{isOther}
and a.licenseno =#{licenseno}
and pa.dept_id =#{deptId}
and a.id in
#{item}
and a.id in
#{item}
and a.sy_policyno =#{syPolicyno}
and a.no_policyno =#{noPolicyno}
AND a.signdate =#{signdate}
AND a.partner_companies_id =#{partnerCompaniesId}
AND a.create_time =#{createTime}
AND a.settlement_time =#{settlementTime}
AND a.partner_companies_name =#{partnerCompaniesName}
and a.userId =#{userId}
and a.company_id =#{companyId}
and a.riskcode =#{riskcode}
AND YEAR(a.signdate) =#{year}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
AND a.insured_name =#{insuredName}
and a.partner_companies_id in
#{item}
SELECT
SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 )) AS commissionFeevalue,
SUM( CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "noInvoicCommissionFeevalue",
SUM(CASE WHEN a.handling_fees_status = '1' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END) AS "readyCommissionFeevalue"
FROM
ins_ply_income a
LEFT JOIN
ptl_agreement pa ON pa.id = a.agreement_id
1=1
and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
and pa.agreement_type =#{agreementType}
and a.orderno =#{orderno}
and a.company_id =#{companyName}
and a.signdate between #{signDateStart} and #{signDateEnd}
and a.policyno =#{policyno}
and a.handling_fees_status =#{handlingFeesStatus}
and a.documentary_fees_status =#{documentaryFeesStatus}
and a.is_not_car =#{isNotCar}
AND DATE(a.jq_start_date) BETWEEN #{jqStartDate} AND #{jqEndDate}
AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
and a.is_not_documentary =#{isOther}
and a.licenseno =#{licenseno}
and pa.dept_id =#{deptId}
and a.id in
#{item}
and a.id in
#{item}
and a.sy_policyno =#{syPolicyno}
and a.no_policyno =#{noPolicyno}
AND a.signdate =#{signdate}
AND a.partner_companies_id =#{partnerCompaniesId}
AND a.create_time =#{createTime}
AND a.settlement_time =#{settlementTime}
AND a.partner_companies_name =#{partnerCompaniesName}
and a.userId =#{userId}
and a.company_id =#{companyId}
and a.riskcode =#{riskcode}
AND YEAR(a.signdate) =#{year}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
AND a.insured_name =#{insuredName}
and a.partner_companies_id in
#{item}
select
MAX(a.partner_companies_id) as "partnerCompaniesId",
MAX( ec.name ) AS "companyName",
sum( a.commission_feevalue ) AS "commissionFeevalue",
sum( a.other_feevalue ) AS "otherFeevalue",
SUM( a.commission_feevalue + a.other_feevalue ) AS "totalFeevalue",
GROUP_CONCAT(a.id) as "ids",
MAX( a.partner_companies_name) as "partnerCompaniesName",
MAX(pa.docking_person) as "dockingPerson",
a.agreement_id AS "agreementId"
from ins_ply_income a
LEFT JOIN esm_ins_company ec on ec.id= a.company_id
LEFT JOIN ptl_agreement pa on pa.id= a.agreement_id
1=1
AND pa.agreement_type =#{agreementType}
AND a.documentary_fees_status = #{documentaryFeesStatus}
AND a.handling_fees_status = #{handlingFeesStatus}
AND YEAR(a.signdate) =#{year}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
GROUP BY a.agreement_id
select
sum(a.commission_feevalue) as "commissionFeevalue",
sum(a.invoic_amount) as "invoicAmount"
from ins_ply_income a
LEFT JOIN ptl_agreement pa on pa.id= a.agreement_id
1=1
and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
and pa.agreement_type =#{agreementType}
and a.handling_fees_status =#{handlingFeesStatus}
and a.orderno =#{orderno}
and a.policyno =#{policyno}
and a.documentary_fees_status =#{documentaryFeesStatus}
and a.is_not_car =#{isNotCar}
and a.is_not_documentary =#{isOther}
and a.licenseno =#{licenseno}
and a.sy_policyno =#{syPolicyno}
and a.no_policyno =#{noPolicyno}
and a.signdate =#{signdate}
and a.partner_companies_id =#{partnerCompaniesId}
and a.create_time =#{createTime}
and a.settlement_time =#{settlementTime}
and a.userId =#{userId}
and a.company_id =#{companyId}
and a.riskcode =#{riskcode}
AND YEAR(a.signdate) =#{year}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
SELECT
a.partner_companies_id AS "partnerCompaniesId",
MAX( a.company_name ) AS "companyName",
MAX( a.company_id ) AS "companyId",
MAX( a.partner_companies_name ) AS "partnerCompaniesName"
FROM
ins_ply_income a
LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
LEFT JOIN esm_ins_company eic on eic.id=a.partner_companies_id
1=1
AND pa.agreement_type =#{agreementType}
AND YEAR(a.signdate) =#{year}
and a.is_not_documentary =#{isOther}
and a.is_not_car =#{isNotCar}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
AND a.partner_companies_name =#{partnerCompaniesName}
AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
and eic.parent_id LIKE CONCAT(#{provincePartnerCompaniesId}, '%')
and a.company_id =#{companyName}
GROUP BY a.partner_companies_id
select
a.partner_companies_id AS "partnerCompaniesId",
a.id as "id"
from ins_ply_income a
LEFT JOIN ptl_agreement pa on pa.id= a.agreement_id
1=1
and a.handling_fees_status ='2'
AND pa.agreement_type =#{agreementType}
AND YEAR(a.signdate) =#{year}
and a.is_not_documentary =#{isOther}
and a.is_not_car =#{isNotCar}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
SELECT
a.partner_companies_id AS "partnerCompaniesId",
MAX( a.company_name ) AS "companyName",
MAX( a.company_id ) AS "companyId",
MAX( a.partner_companies_name ) AS "partnerCompaniesName",
IFNULL(max(f.settleMentAmount) , 0.00) +IFNULL ( max(d.settleMentAmount),0.00)-IFNULL(max(f.settleMentAmount) , 0.00) AS "allInvoicCommissionFeevalue",
IFNULL(max(f.settleMentAmount) , 0.00) + IFNULL(max(d.settleMentAmount) , 0.00) as "readyCommissionFeevalue",
IFNULL(max(d.settleMentAmount) , 0.00) as "invoicCommissionFeevalue",
sum(COALESCE( a.other_feevalue,0.00) )-IFNULL ( max(d.settleMentAmount),0.00) as "noInvoicCommissionFeevalue",
sum(COALESCE( a.other_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00) AS "unSettledAmount",
IFNULL(max(f.taxesFees) , 0.00) as "taxesFees",
IFNULL(max(f.expendAmount),0) as "expendAmount",
sum( a.other_feevalue ) AS "otherFeevalue"
FROM
ins_ply_income a
LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
LEFT JOIN esm_ins_company eic on eic.id=a.partner_companies_id
LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
WHERE ( a.settlement_status = '1' or a.settlement_status = '2')
and a.handling_fees_status ='1'
and a.is_not_car =#{isNotCar}
GROUP BY partner_companies_id
) c ON c.partnerCompaniesId = a.partner_companies_id
LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
WHERE a.settlement_status = '1'
and a.handling_fees_status ='1'
and a.is_not_car =#{isNotCar}
GROUP BY partner_companies_id
) d ON d.partnerCompaniesId = a.partner_companies_id
LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId",sum(
settlement_amount ) AS "settleMentAmount",
sum(a.settlement_amount * (1 -a.tax_points/100) ) as 'expendAmount',
sum(a.settlement_amount * (a.tax_points/100) ) as 'taxesFees',
SUM(a.tax_points) as "taxPoints"
FROM settlement_documentary_fees a
WHERE a.settlement_status = '2'
and a.handling_fees_status ='1'
and a.is_not_car =#{isNotCar}
GROUP BY partner_companies_id
) f ON f.partnerCompaniesId = a.partner_companies_id
1=1
and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
and pa.agreement_type =#{agreementType}
and a.signdate between #{signDateStart} and #{signDateEnd}
and a.handling_fees_status =#{handlingFeesStatus}
and pa.docking_person =#{dockingPerson}
and a.orderno =#{orderno}
and a.company_id =#{companyName}
and a.policyno =#{policyno}
and a.documentary_fees_status =#{documentaryFeesStatus}
and a.is_not_car =#{isNotCar}
and a.is_not_documentary =#{isOther}
AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
and eic.parent_id LIKE CONCAT(#{provincePartnerCompaniesId}, '%')
and a.licenseno =#{licenseno}
and a.sy_policyno =#{syPolicyno}
and a.no_policyno =#{noPolicyno}
AND a.signdate =#{signdate}
AND a.partner_companies_id =#{partnerCompaniesId}
AND a.partner_companies_name =#{partnerCompaniesName}
AND a.create_time =#{createTime}
AND a.settlement_time =#{settlementTime}
and a.userId =#{userId}
and a.company_id =#{companyId}
and a.riskcode =#{riskcode}
AND YEAR(a.signdate) =#{year}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
AND a.insured_name =#{insuredName}
GROUP BY
a.partner_companies_id
SELECT
a.id as "id",
a.partner_companies_id AS "partnerCompaniesId"
FROM
ins_ply_income a
LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
1=1
AND pa.agreement_type =#{agreementType}
AND YEAR(a.signdate) =#{year}
and a.is_not_documentary =#{isOther}
and a.is_not_car =#{isNotCar}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
AND a.documentary_fees_status = #{documentaryFeesStatus}
select
pa.agreement_name as "agreementName",
su.name as "userName",
from ins_ply_income a
LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
LEFT JOIN sys_user su on su.id=a.user_id
a.id=#{id}
select
sum(a.commission_feevalue) as "invoicCommissionFeevalue",
MAX(invoic_id) as "invoicId",
MAX(invoic_time) as "invoicTime",
GROUP_CONCAT(a.id) as "ids"
from ins_ply_income a
LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
LEFT JOIN sys_user su on su.id=a.user_id
1=1
AND a.invoic_id is not null
a.id IN
#{item}
AND pa.agreement_type =#{agreementType}
AND YEAR(a.signdate) =#{year}
and a.is_not_documentary =#{isOther}
and a.is_not_car =#{isNotCar}
and a.handling_fees_status =#{handlingFeesStatus}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
AND a.partner_companies_id =#{partnerCompaniesId}
group by a.invoic_id
update ins_ply_income
set handling_fees_status ='1',
settlement_time =NOW()
1=1
and id in
#{item}
SELECT
i.YEAR as "year",
i.monthNumber as "monthNumber",
i.allTotalOtherFeevalue as "allTotalOtherFeevalue",
IFNULL(s.invoicCommissionFeevalue,0) AS invoicCommissionFeevalue,
CONCAT(i.YEAR, '-', LPAD(i.monthNumber, 2, '0')) AS "monthYear",
IFNULL(i.allTotalOtherFeevalue ,0) - IFNULL(s.invoicCommissionFeevalue,0) AS noInvoicCommissionFeevalue
FROM (
SELECT
YEAR(a.signdate) AS YEAR,
MONTH(a.signdate) AS monthNumber,
SUM(IFNULL(a.other_feevalue, 0)) AS allTotalOtherFeevalue
FROM ins_ply_income a
LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
YEAR(a.signdate) BETWEEN YEAR(CURDATE()) AND YEAR(CURDATE()) + 1
and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
and pa.agreement_type =#{agreementType}
and a.signdate between #{signDateStart} and #{signDateEnd}
and DATE_FORMAT( a.signdate, '%Y') between #{yeartsStart} and #{yeartsEnd}
and a.handling_fees_status =#{handlingFeesStatus}
and pa.docking_person =#{dockingPerson}
and a.dept_id LIKE CONCAT(#{cityId}, '%')
and a.dept_id LIKE CONCAT(#{countyId}, '%')
and a.orderno =#{orderno}
and a.company_id =#{companyName}
and a.policyno =#{policyno}
and a.documentary_fees_status =#{documentaryFeesStatus}
and a.is_not_car =#{isNotCar}
and pa.dept_id =#{deptId}
and a.id in
#{item}
and a.id in
#{item}
and a.partner_companies_id in
#{item}
and a.is_not_documentary =#{isOther}
and a.licenseno =#{licenseno}
and a.sy_policyno =#{syPolicyno}
and a.no_policyno =#{noPolicyno}
AND a.signdate =#{signdate}
AND a.partner_companies_id =#{partnerCompaniesId}
AND a.partner_companies_name =#{partnerCompaniesName}
AND a.create_time =#{createTime}
AND a.settlement_time =#{settlementTime}
and a.userId =#{userId}
and a.company_id =#{companyId}
and a.riskcode =#{riskcode}
AND YEAR(a.signdate) =#{year}
AND month(a.signdate) =#{month}
AND day(a.signdate) =#{day}
AND a.insured_name =#{insuredName}
AND DATE(a.jq_start_date) BETWEEN #{jqStartDate} AND #{jqEndDate}
AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
GROUP BY YEAR(a.signdate), MONTH(a.signdate)
) i
LEFT JOIN (
SELECT
YEAR(a.signing_time) AS YEAR,
MONTH(a.signing_time) AS monthNumber,
SUM(CASE WHEN a.settlement_status = '1' THEN IFNULL(a.settlement_amount, 0) ELSE 0 END) AS invoicCommissionFeevalue
FROM settlement_documentary_fees a
YEAR(a.signing_time) BETWEEN YEAR(CURDATE()) AND YEAR(CURDATE()) + 1
and a.is_not_car =#{isNotCar}
and a.partner_companies_id in
#{item}
AND a.partner_companies_id =#{partnerCompaniesId}
and a.company_id =#{companyName}
and a.handling_fees_status =#{handlingFeesStatus}
and DATE_FORMAT( a.signing_time, '%Y') between #{yeartsStart} and #{yeartsEnd}
GROUP BY YEAR(a.signing_time), MONTH(a.signing_time)
) s ON i.YEAR = s.YEAR AND i.monthNumber = s.monthNumber
ORDER BY i.YEAR, i.monthNumber;