substring_index ( hph.project_address_name, '/', 1 ) AS province,
substring_index ( hph.project_address_name, '/', 1 ) AS province,
DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d %H:%i:%S') AS gridConnectionTime,
DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d %H:%i:%S') AS gridConnectionTime,
CASE WHEN hbga.acceptance_check_status = '15' THEN '待提交验收'
CASE WHEN hbga.acceptance_check_status = '15' THEN '待提交验收'
...
@@ -41,12 +42,23 @@
...
@@ -41,12 +42,23 @@
LEFT JOIN hygf_peasant_household hph ON hph.sequence_nbr = hbga.peasant_household_id
LEFT JOIN hygf_peasant_household hph ON hph.sequence_nbr = hbga.peasant_household_id
LEFT JOIN hygf_on_grid_and_acceptance hogaa ON hogaa.work_order_power_station_id = hbga.work_order_power_station_id
LEFT JOIN hygf_on_grid_and_acceptance hogaa ON hogaa.work_order_power_station_id = hbga.work_order_power_station_id
LEFT JOIN hygf_work_order ON hygf_work_order.sequence_nbr = hbga.work_order_id
LEFT JOIN hygf_work_order ON hygf_work_order.sequence_nbr = hbga.work_order_id
left join
(select work_order_power_station_id, MIN( operation_time ) as firstSubmitDate from hygf_construction_acceptance_records where operation_content = '提交验收审核' GROUP BY work_order_power_station_id)
newHcar on newHcar.work_order_power_station_id = hbga.work_order_power_station_id
<where>
<where>
hbga.is_delete = 0
hbga.is_delete = 0
<iftest="map.amosDealerId!=null and map.amosDealerId!=''">
<iftest="map.amosDealerId!=null and map.amosDealerId!=''">
and hygf_work_order.amos_dealer_id = #{map.amosDealerId}
and hygf_work_order.amos_dealer_id = #{map.amosDealerId}
</if>
</if>
<iftest="map.startTime!=null and map.startTime!=''">
and newHcar.firstSubmitDate >= #{map.startTime}
</if>
<iftest="map.endTime!=null and map.endTime!=''">
and newHcar.firstSubmitDate <= #{map.endTime}
</if>
<iftest="map.developerName!=null and map.developerName!=''">
<iftest="map.developerName!=null and map.developerName!=''">
and hph.developer_name like concat('%',#{map.developerName},'%')
and hph.developer_name like concat('%',#{map.developerName},'%')
substring_index ( hph.project_address_name, '/', 1 ) AS province,
substring_index ( hph.project_address_name, '/', 1 ) AS province,
DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d %H:%i:%S') AS gridConnectionTime,
DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d %H:%i:%S') AS gridConnectionTime,
CASE WHEN hbga.grid_status = '1' THEN '待登记'
CASE WHEN hbga.grid_status = '1' THEN '待登记'
...
@@ -49,12 +50,21 @@
...
@@ -49,12 +50,21 @@
LEFT JOIN hygf_peasant_household hph ON hph.sequence_nbr = hbga.peasant_household_id
LEFT JOIN hygf_peasant_household hph ON hph.sequence_nbr = hbga.peasant_household_id
LEFT JOIN hygf_on_grid_and_acceptance hogaa ON hogaa.work_order_power_station_id = hbga.work_order_power_station_id
LEFT JOIN hygf_on_grid_and_acceptance hogaa ON hogaa.work_order_power_station_id = hbga.work_order_power_station_id
LEFT JOIN hygf_work_order ON hygf_work_order.sequence_nbr = hbga.work_order_id
LEFT JOIN hygf_work_order ON hygf_work_order.sequence_nbr = hbga.work_order_id
left join
(select work_order_power_station_id, MIN( operation_time ) as firstSubmitDate from hygf_construction_gird_records hcgr where operation_content = '提交并网资料' GROUP BY work_order_power_station_id)
newHcgr on newHcgr.work_order_power_station_id = hbga.work_order_power_station_id
<where>
<where>
hbga.is_delete = 0
hbga.is_delete = 0
<iftest="map.amosDealerId!=null and map.amosDealerId!=''">
<iftest="map.amosDealerId!=null and map.amosDealerId!=''">
and hygf_work_order.amos_dealer_id = #{map.amosDealerId}
and hygf_work_order.amos_dealer_id = #{map.amosDealerId}
</if>
</if>
<iftest="map.startTime!=null and map.startTime!=''">
and newHcgr.firstSubmitDate >= #{map.startTime}
</if>
<iftest="map.endTime!=null and map.endTime!=''">
and newHcgr.firstSubmitDate <= #{map.endTime}
</if>
<iftest="map.regionCompanyId!=null and map.regionCompanyId!=''">
<iftest="map.regionCompanyId!=null and map.regionCompanyId!=''">
and hygf_work_order.region_company_id =#{map.regionCompanyId}
and hygf_work_order.region_company_id =#{map.regionCompanyId}
IFNULL(SUM(CASE WHEN ps.process_status = '不通过' THEN 1 ELSE 0 END),0)AS '未通过',
IFNULL(SUM(CASE WHEN ps.process_status = '不通过' THEN 1 ELSE 0 END),0)AS '未通过',
IFNULL(SUM(CASE WHEN ps.process_status = '进行中' AND ps.business_status = '通过' AND next_node_name = '设计上传典型图库' THEN 1 ELSE 0 END),0) AS '已完成(法务审核)',
IFNULL(SUM(CASE WHEN ps.process_status = '进行中' AND ps.business_status = '通过' AND next_node_name = '设计上传典型图库' THEN 1 ELSE 0 END),0) AS '已完成(法务审核)',
IFNULL(SUM(CASE WHEN ps.process_status = '完成' THEN 1 ELSE 0 END),0) AS completeTotal,
IFNULL(SUM(CASE WHEN ps.process_status = '完成' THEN 1 ELSE 0 END),0) AS completeTotal,
ROUND(COALESCE(SUM( CASE WHEN ps.process_status = '完成' THEN ei.real_scale ELSE 0 END ), 0), 2) AS completeTotalrl,
IFNULL(SUM(CASE WHEN ps.process_status = '进行中' AND (ps.business_status IS NULL OR ps.design_status IS NULL OR ps.technology_status IS NULL or ps.business_status = '' OR ps.design_status = '' OR ps.technology_status = '') THEN 1 ELSE 0 END),0) AS '进行中(审核)'
IFNULL(SUM(CASE WHEN ps.process_status = '进行中' AND (ps.business_status IS NULL OR ps.design_status IS NULL OR ps.technology_status IS NULL or ps.business_status = '' OR ps.design_status = '' OR ps.technology_status = '') THEN 1 ELSE 0 END),0) AS '进行中(审核)'
FROM
FROM hygf_power_station ps
hygf_power_station ps
LEFT JOIN hygf_peasant_household ph ON ps.peasant_household_id = ph.sequence_nbr
LEFT JOIN
LEFT JOIN hygf_work_order_power_station wps ON wps.peasant_household_id = ph.sequence_nbr
hygf_peasant_household ph ON ps.peasant_household_id = ph.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = wps.sequence_nbr
WHERE
WHERE
ps.is_delete = 0
ps.is_delete = 0
<iftest="developerCode != null and developerCode != ''">
<iftest="developerCode != null and developerCode != ''">
...
@@ -56,11 +57,14 @@
...
@@ -56,11 +57,14 @@
SELECT
SELECT
SUM(CASE WHEN status = '未签署' THEN 1 ELSE 0 END) AS '未签署',
SUM(CASE WHEN status = '未签署' THEN 1 ELSE 0 END) AS '未签署',
SUM(CASE WHEN status = '双方已签署' THEN 1 ELSE 0 END) AS '双方已签署',
SUM(CASE WHEN status = '双方已签署' THEN 1 ELSE 0 END) AS '双方已签署',
ROUND(COALESCE( SUM(CASE WHEN status = '双方已签署' THEN ei.real_scale ELSE 0 END) , 0), 2) AS sfyqsrl,
SUM(CASE WHEN status = '农户已签署' THEN 1 ELSE 0 END) AS '农户已签署',
SUM(CASE WHEN status = '农户已签署' THEN 1 ELSE 0 END) AS '农户已签署',
SUM(CASE WHEN status = '已作废' THEN 1 ELSE 0 END) AS '已作废'
SUM(CASE WHEN status = '已作废' THEN 1 ELSE 0 END) AS '已作废'
FROM
FROM
( SELECT hhc.*, ROW_NUMBER() OVER ( PARTITION BY peasant_household_id ORDER BY sequence_nbr DESC ) AS rn FROM hygf_household_contract hhc ) subq
( SELECT hhc.*, ROW_NUMBER() OVER ( PARTITION BY peasant_household_id ORDER BY sequence_nbr DESC ) AS rn FROM hygf_household_contract hhc ) subq
LEFT JOIN hygf_peasant_household ph ON ph.SEQUENCE_NBR = subq.peasant_household_id
LEFT JOIN hygf_peasant_household ph ON ph.SEQUENCE_NBR = subq.peasant_household_id
LEFT JOIN hygf_work_order_power_station wps ON wps.peasant_household_id = ph.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = wps.sequence_nbr
WHERE
WHERE
subq.rn = 1
subq.rn = 1
<iftest="developerCode != null and developerCode != ''">
<iftest="developerCode != null and developerCode != ''">
...
@@ -113,9 +117,12 @@
...
@@ -113,9 +117,12 @@
SELECT
SELECT
SUM( CASE WHEN preparation_money_state = '待发货' or preparation_money_state = '暂存发货'or preparation_money_state = '待补货' THEN 1 ELSE 0 END ) AS '待发货',
SUM( CASE WHEN preparation_money_state = '待发货' or preparation_money_state = '暂存发货'or preparation_money_state = '待补货' THEN 1 ELSE 0 END ) AS '待发货',
SUM( CASE WHEN preparation_money_state = '备货完成' or preparation_money_state = '已收货' THEN 1 ELSE 0 END ) AS '已收货',
SUM( CASE WHEN preparation_money_state = '备货完成' or preparation_money_state = '已收货' THEN 1 ELSE 0 END ) AS '已收货',
ROUND(COALESCE(SUM( CASE WHEN preparation_money_state = '备货完成' or preparation_money_state = '已收货' THEN ei.real_scale ELSE 0 END ), 0), 2) AS yshrl,
SUM( CASE WHEN preparation_money_state = '待收货' THEN 1 ELSE 0 END ) AS '已发货'
SUM( CASE WHEN preparation_money_state = '待收货' THEN 1 ELSE 0 END ) AS '已发货'
FROM
FROM
hygf_peasant_household
hygf_peasant_household
LEFT JOIN hygf_work_order_power_station ps ON ps.peasant_household_id = hygf_peasant_household.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr
WHERE
WHERE
preparation_money_state IS NOT NULL
preparation_money_state IS NOT NULL
<iftest="developerCode != null and developerCode != ''">
<iftest="developerCode != null and developerCode != ''">
(select hygf_rectification_order.rectification_history from hygf_rectification_order
(select hygf_rectification_order.rectification_history from hygf_rectification_order
where hygf_rectification_order.peasant_househole_id = hygf_work_order_power_station.peasant_household_id
where hygf_rectification_order.peasant_househole_id = hygf_work_order_power_station.peasant_household_id
and hygf_rectification_order.rectification_status = '待整改' and hygf_rectification_order.rectification_source = hygf_work_order_power_station.work_order_power_station_node and hygf_rectification_order.rectification_source in ('area','engineering','design') ) as auditIdea,
and hygf_rectification_order.rectification_status = '待整改' and hygf_rectification_order.rectification_source = hygf_work_order_power_station.work_order_power_station_node and hygf_rectification_order.rectification_source in ('area','engineering','design') ) as auditIdea,
...
@@ -101,10 +102,19 @@
...
@@ -101,10 +102,19 @@
on hygf_work_order.sequence_nbr=hygf_work_order_power_station.work_order_id
on hygf_work_order.sequence_nbr=hygf_work_order_power_station.work_order_id
LEFT JOIN hygf_peasant_household on hygf_peasant_household.sequence_nbr=hygf_work_order_power_station.peasant_household_id
LEFT JOIN hygf_peasant_household on hygf_peasant_household.sequence_nbr=hygf_work_order_power_station.peasant_household_id
LEFT JOIN hygf_power_station_engineering_info on hygf_power_station_engineering_info.work_order_power_station_id=hygf_work_order_power_station.sequence_nbr
LEFT JOIN hygf_power_station_engineering_info on hygf_power_station_engineering_info.work_order_power_station_id=hygf_work_order_power_station.sequence_nbr
LEFT JOIN (
SELECT work_order_power_station_id, MIN( operation_time ) as firstConstructionDate FROM hygf_construction_records WHERE operation_content = '编辑施工资料' GROUP BY work_order_power_station_id
) newHcr ON newHcr.work_order_power_station_id = hygf_work_order_power_station.sequence_nbr
<where>
<where>
<iftest="dto.workOrderId!=null and dto.workOrderId!=''">
<iftest="dto.workOrderId!=null and dto.workOrderId!=''">
and hygf_work_order.sequence_nbr = #{dto.workOrderId}
and hygf_work_order.sequence_nbr = #{dto.workOrderId}
</if>
</if>
<iftest="dto.startTime!=null and dto.startTime!=''">
and newHcr.firstConstructionDate >= #{dto.startTime}
</if>
<iftest="dto.endTime!=null and dto.endTime!=''">
and newHcr.firstConstructionDate <= #{dto.endTime}
</if>
<iftest=' dto.type!=null and dto.type == "1"'>
<iftest=' dto.type!=null and dto.type == "1"'>
and hygf_work_order_power_station.power_station_construction_status in ('待登记','未通过','已完工','待审核')
and hygf_work_order_power_station.power_station_construction_status in ('待登记','未通过','已完工','待审核')
</if>
</if>
...
@@ -128,6 +138,12 @@
...
@@ -128,6 +138,12 @@
<iftest="dto.peasantHouseholdNo!=null and dto.peasantHouseholdNo!=''">
<iftest="dto.peasantHouseholdNo!=null and dto.peasantHouseholdNo!=''">
and hygf_peasant_household.peasant_household_no like concat(concat('%',#{dto.peasantHouseholdNo}),'%')
and hygf_peasant_household.peasant_household_no like concat(concat('%',#{dto.peasantHouseholdNo}),'%')
</if>
</if>
<iftest="dto.developerName!=null and dto.developerName!=''">
and hygf_peasant_household.developer_name like concat(concat('%',#{dto.developerName}),'%')
</if>
<iftest="dto.regionalCompaniesName!=null and dto.regionalCompaniesName!=''">
and hygf_peasant_household.regional_companies_name like concat(concat('%',#{dto.regionalCompaniesName}),'%')
</if>
<iftest="dto.constructionRegionManager!=null and dto.constructionRegionManager!=''">
<iftest="dto.constructionRegionManager!=null and dto.constructionRegionManager!=''">
and hygf_work_order.construction_region_manager like concat(concat('%',#{dto.constructionRegionManager}),'%')
and hygf_work_order.construction_region_manager like concat(concat('%',#{dto.constructionRegionManager}),'%')