Commit 2432116a authored by hezhuozhi's avatar hezhuozhi

Merge remote-tracking branch 'origin/developer_bw' into developer_bw

parents a1bcf0f5 9aa4e564
...@@ -85,21 +85,24 @@ ...@@ -85,21 +85,24 @@
hygf_design_information hygf_design_information
LEFT JOIN LEFT JOIN
hygf_peasant_household ON hygf_design_information.peasant_household_id = hygf_peasant_household.sequence_nbr hygf_peasant_household ON hygf_design_information.peasant_household_id = hygf_peasant_household.sequence_nbr
<if test="developerCode != null and developerCode != ''"> <where>
AND hygf_peasant_household.developer_code = #{developerCode} <if test="developerCode != null and developerCode != ''">
</if> AND hygf_peasant_household.developer_code = #{developerCode}
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''"> </if>
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode} <if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
</if> AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
<if test="province != null and province != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%') <if test="province != null and province != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
<if test="city != null and city != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%') <if test="city != null and city != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
<if test="district != null and district != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%') <if test="district != null and district != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
</select> </select>
<select id="preparationMoneyTotal" resultType="map"> <select id="preparationMoneyTotal" resultType="map">
...@@ -145,21 +148,23 @@ ...@@ -145,21 +148,23 @@
hygf_power_station_engineering_info ei on ei.work_order_power_station_id =hygf_work_order_power_station.sequence_nbr hygf_power_station_engineering_info ei on ei.work_order_power_station_id =hygf_work_order_power_station.sequence_nbr
LEFT JOIN LEFT JOIN
hygf_peasant_household ON hygf_work_order_power_station.peasant_household_id = hygf_peasant_household.sequence_nbr hygf_peasant_household ON hygf_work_order_power_station.peasant_household_id = hygf_peasant_household.sequence_nbr
<if test="developerCode != null and developerCode != ''"> <where>
AND hygf_peasant_household.developer_code = #{developerCode} <if test="developerCode != null and developerCode != ''">
</if> AND hygf_peasant_household.developer_code = #{developerCode}
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''"> </if>
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode} <if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
</if> AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
<if test="province != null and province != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%') <if test="province != null and province != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
<if test="city != null and city != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%') <if test="city != null and city != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
<if test="district != null and district != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%') <if test="district != null and district != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY GROUP BY
power_station_construction_status,work_order_power_station_node power_station_construction_status,work_order_power_station_node
</select> </select>
...@@ -183,21 +188,23 @@ ...@@ -183,21 +188,23 @@
LEFT JOIN hygf_work_order_power_station ps ON ps.sequence_nbr = hygf_basic_grid_record.work_order_power_station_id LEFT JOIN hygf_work_order_power_station ps ON ps.sequence_nbr = hygf_basic_grid_record.work_order_power_station_id
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr
LEFT JOIN hygf_peasant_household ON hygf_basic_grid_record.peasant_household_id = hygf_peasant_household.sequence_nbr LEFT JOIN hygf_peasant_household ON hygf_basic_grid_record.peasant_household_id = hygf_peasant_household.sequence_nbr
<if test="developerCode != null and developerCode != ''"> <where>
AND hygf_peasant_household.developer_code = #{developerCode} <if test="developerCode != null and developerCode != ''">
</if> AND hygf_peasant_household.developer_code = #{developerCode}
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''"> </if>
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode} <if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
</if> AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
<if test="province != null and province != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%') <if test="province != null and province != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
<if test="city != null and city != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%') <if test="city != null and city != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
<if test="district != null and district != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%') <if test="district != null and district != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY GROUP BY
grid_status grid_status
</select> </select>
...@@ -227,21 +234,23 @@ ...@@ -227,21 +234,23 @@
hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr
LEFT JOIN LEFT JOIN
hygf_peasant_household ON hygf_acceptance_check.peasant_household_id = hygf_peasant_household.sequence_nbr hygf_peasant_household ON hygf_acceptance_check.peasant_household_id = hygf_peasant_household.sequence_nbr
<if test="developerCode != null and developerCode != ''"> <where>
AND hygf_peasant_household.developer_code = #{developerCode} <if test="developerCode != null and developerCode != ''">
</if> AND hygf_peasant_household.developer_code = #{developerCode}
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''"> </if>
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode} <if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
</if> AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
<if test="province != null and province != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%') <if test="province != null and province != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
<if test="city != null and city != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%') <if test="city != null and city != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
<if test="district != null and district != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%') <if test="district != null and district != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY GROUP BY
acceptance_check_status acceptance_check_status
</select> </select>
...@@ -257,21 +266,23 @@ ...@@ -257,21 +266,23 @@
LEFT JOIN hygf_work_order_power_station ps ON ps.peasant_household_id = hygf_financing_info.peasant_household_id LEFT JOIN hygf_work_order_power_station ps ON ps.peasant_household_id = hygf_financing_info.peasant_household_id
LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr LEFT JOIN hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr
LEFT JOIN hygf_peasant_household ON hygf_financing_info.peasant_household_id = hygf_peasant_household.sequence_nbr LEFT JOIN hygf_peasant_household ON hygf_financing_info.peasant_household_id = hygf_peasant_household.sequence_nbr
<if test="developerCode != null and developerCode != ''"> <where>
AND hygf_peasant_household.developer_code = #{developerCode} <if test="developerCode != null and developerCode != ''">
</if> AND hygf_peasant_household.developer_code = #{developerCode}
<if test="regionalCompaniesCode != null and regionalCompaniesCode != ''"> </if>
AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode} <if test="regionalCompaniesCode != null and regionalCompaniesCode != ''">
</if> AND hygf_peasant_household.regional_companies_code = #{regionalCompaniesCode}
<if test="province != null and province != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%') <if test="province != null and province != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{province},'%')
<if test="city != null and city != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%') <if test="city != null and city != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{city},'%')
<if test="district != null and district != ''"> </if>
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%') <if test="district != null and district != ''">
</if> AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY GROUP BY
status status
......
...@@ -11,10 +11,7 @@ import org.springframework.stereotype.Service; ...@@ -11,10 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@Service @Service
public class StatisticsHomepageServiceImpl { public class StatisticsHomepageServiceImpl {
...@@ -58,7 +55,6 @@ public class StatisticsHomepageServiceImpl { ...@@ -58,7 +55,6 @@ public class StatisticsHomepageServiceImpl {
Map<String,Object> resuleMapBuild(Map<String, Object> li, Map<String, Object> resultMap,List<Map<String, Object>> maps,String type){ Map<String,Object> resuleMapBuild(Map<String, Object> li, Map<String, Object> resultMap,List<Map<String, Object>> maps,String type){
long total= 0; long total= 0;
double realScale = 0.00; double realScale = 0.00;
long sureyNum = 0; long sureyNum = 0;
long workNum = 0; long workNum = 0;
long preparationNum = 0; long preparationNum = 0;
...@@ -68,100 +64,153 @@ public class StatisticsHomepageServiceImpl { ...@@ -68,100 +64,153 @@ public class StatisticsHomepageServiceImpl {
long stationNum =0; long stationNum =0;
double stationRealScale = 0.00; double stationRealScale = 0.00;
double disbursementMoney = 0.00; double disbursementMoney = 0.00;
List<String> surveKeys = new ArrayList<>(Arrays.asList("未通过","未勘察","已完成(法务审核)","进行中(审核)"));
List<String> contractKeys = new ArrayList<>(Arrays.asList("双方已签署","农户已签署","未发起"));
List<String> workOrder = new ArrayList<>(Arrays.asList("派工发料","未通过","施工资料已上传","完工登记","完工自审","审核中","已完成"));
List<String> preparationMoneyKeys = new ArrayList<>(Arrays.asList("待发货","已收货","已发货"));
List<String> desionKeys = new ArrayList<>(Arrays.asList("施工图已上传","典设图已上传"));
List<String> gridKeys = new ArrayList<>(Arrays.asList("待登记","审核中","已完成","未通过","整改待审核" ,"待整改"));
List<String> acceptanceKeys = new ArrayList<>(Arrays.asList("待提交","已完成","审核中","整改待审核","待整改","未通过"));
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
switch(type){ switch(type){
case "surey" : case "surey" :
Map<String, Object> surey = maps.get(0); resultMap.put("sureyComplete",0);
for (String e : surey.keySet()) {
if (!e.equals("completeTotal")){ if (Objects.isNull(maps)|| Objects.isNull(maps.get(0))){
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",surey.get(e)).build()); list = this.nullDataBuildResult(list,surveKeys);
} }else {
if (!e.equals("未勘察")){ Map<String, Object> surey = maps.get(0);
sureyNum += (long)surey.get(e); surveKeys.removeAll(surey.keySet());
} else { for (String e : surey.keySet()) {
stationNum += (long)surey.get(e); if (!e.equals("completeTotal")){
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",surey.get(e)).build());
}
if (!e.equals("未勘察")){
sureyNum += (long)surey.get(e);
} else {
stationNum += (long)surey.get(e);
}
} }
list = this.nullDataBuildResult(list,surveKeys);
resultMap.put("sureyComplete",surey.containsKey("completeTotal")?surey.get("completeTotal"):0);
} }
li.put("surveNum",sureyNum); li.put("surveNum",sureyNum);
li.put("stationNum",sureyNum+stationNum); li.put("stationNum",sureyNum+stationNum);
resultMap.put("surey",list); resultMap.put("surey",list);
resultMap.put("sureyComplete",surey.get("completeTotal"));
break; break;
case "desion": case "desion":
Map<String, Object> desion = maps.get(0); if (Objects.isNull(maps)|| Objects.isNull(maps.get(0))){
desion.keySet().forEach(e->{ list = this.nullDataBuildResult(list,desionKeys);
}else {
Map<String, Object> desion = maps.get(0);
desionKeys.remove(desion.keySet());
for (String e : desion.keySet()) {
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",desion.get(e)).build()); list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",desion.get(e)).build());
});
if (resultMap.containsKey("sureyComplete")){ }
list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",resultMap.get("sureyComplete")).build()); list = this.nullDataBuildResult(list,desionKeys);
resultMap.remove("sureyComplete"); if (resultMap.containsKey("sureyComplete")){
}else { list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",resultMap.get("sureyComplete")).build());
list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",0).build()); resultMap.remove("sureyComplete");
} }else {
list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",0).build());
}
}
resultMap.put("desion",list); resultMap.put("desion",list);
break; break;
case "contract": case "contract":
Map<String, Object> contract = maps.get(0); if (Objects.isNull(maps) || Objects.isNull(maps.get(0)) ){
contract.keySet().forEach(e->{ list = this.nullDataBuildResult(list,contractKeys);
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",contract.get(e)).build()); }else {
}); Map<String, Object> contract = maps.get(0);
for (String e : contract.keySet()) {
list.add(MapBuilder.<String, Object>create().put("statusText", e).put("total", contract.get(e)).build());
}
list = this.nullDataBuildResult(list,contractKeys);
}
resultMap.put("contract",list); resultMap.put("contract",list);
break; break;
case "preparationMoney": case "preparationMoney":
Map<String, Object> preparationMoney = maps.get(0); if (Objects.isNull(maps)|| Objects.isNull(maps.get(0))){
for (String e : preparationMoney.keySet()) { list = this.nullDataBuildResult(list,preparationMoneyKeys);
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",preparationMoney.get(e)).build()); }else {
preparationNum += (long) preparationMoney.get(e); Map<String, Object> preparationMoney = maps.get(0);
for (String e : preparationMoney.keySet()) {
list.add(MapBuilder.<String, Object>create().put("statusText", e).put("total", preparationMoney.get(e)).build());
preparationNum += (long) preparationMoney.get(e);
}
list = this.nullDataBuildResult(list,preparationMoneyKeys);
} }
resultMap.put("preparationMoney",list); resultMap.put("preparationMoney",list);
li.put("preparationNum",preparationNum); li.put("preparationNum",preparationNum);
break; break;
case "workOrder": case "workOrder":
Iterator<Map<String, Object>> iterator = maps.iterator(); if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
while (iterator.hasNext()) { list = this.nullDataBuildResult(list,workOrder);
Map<String, Object> map = iterator.next(); resultMap.put("workOrder",list);
workNum += (long) map.get("total"); }else {
stationRealScale += (double)map.get("realScale"); Iterator<Map<String, Object>> iterator = maps.iterator();
if ("审核中".equals(map.get("statusText"))) { while (iterator.hasNext()) {
total += (long) map.get("total"); Map<String, Object> map = iterator.next();
realScale += (double) map.get("realScale"); workNum += (long) map.get("total");
iterator.remove(); stationRealScale += (double) map.get("realScale");
if ("审核中".equals(map.get("statusText"))) {
total += (long) map.get("total");
realScale += (double) map.get("realScale");
iterator.remove();
}
} }
maps.add(MapBuilder.<String, Object>create().put("statusText","审核中").put("total",total).put("realScale",realScale).build());
differenceValue(maps,workOrder);
resultMap.put("workOrder",maps);
} }
li.put("workNum",workNum); li.put("workNum",workNum);
li.put("stationRealScale",stationRealScale); li.put("stationRealScale",stationRealScale);
maps.add(MapBuilder.<String, Object>create().put("statusText","审核中").put("total",total).put("realScale",realScale).build());
resultMap.put("workOrder",maps);
break; break;
case "grid": case "grid":
Iterator<Map<String, Object>> iterator1 = maps.iterator(); if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
while (iterator1.hasNext()) { list = this.nullDataBuildResult(list,gridKeys);
Map<String, Object> map = iterator1.next(); resultMap.put("grid",list);
gridNum += (long) map.get("total"); }else {
if ("审核中".equals(map.get("statusText"))) { Iterator<Map<String, Object>> iterator1 = maps.iterator();
total +=(long) map.get("total"); while (iterator1.hasNext()) {
realScale += (double) map.get("realScale"); Map<String, Object> map = iterator1.next();
iterator1.remove(); gridNum += (long) map.get("total");
if ("审核中".equals(map.get("statusText"))) {
total += (long) map.get("total");
realScale += (double) map.get("realScale");
iterator1.remove();
}
} }
maps.add(MapBuilder.<String, Object>create().put("statusText", "审核中").put("total", total).put("realScale", realScale).build());
differenceValue(maps,gridKeys);
resultMap.put("grid",maps);
} }
maps.add(MapBuilder.<String, Object>create().put("statusText","审核中").put("total",total).put("realScale",realScale).build());
resultMap.put("grid",maps);
li.put("gridNum",gridNum); li.put("gridNum",gridNum);
break; break;
case "acceptance": case "acceptance":
Iterator<Map<String, Object>> iterator2 = maps.iterator(); if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
while (iterator2.hasNext()) { list = this.nullDataBuildResult(list,acceptanceKeys);
Map<String, Object> map = iterator2.next(); resultMap.put("acceptance",list);
acceptanceNum += (long) map.get("total"); }else {
if ("审核中".equals(map.get("statusText"))) { Iterator<Map<String, Object>> iterator2 = maps.iterator();
total += (long) map.get("total"); while (iterator2.hasNext()) {
realScale += (double) map.get("realScale"); Map<String, Object> map = iterator2.next();
iterator2.remove(); acceptanceNum += (long) map.get("total");
if ("审核中".equals(map.get("statusText"))) {
total += (long) map.get("total");
realScale += (double) map.get("realScale");
iterator2.remove();
}
} }
maps.add(MapBuilder.<String, Object>create().put("statusText","审核中").put("total",total).put("realScale",realScale).build());
differenceValue(maps,acceptanceKeys);
resultMap.put("acceptance",maps);
} }
maps.add(MapBuilder.<String, Object>create().put("statusText","审核中").put("total",total).put("realScale",realScale).build());
resultMap.put("acceptance",maps);
li.put("acceptanceNum",acceptanceNum); li.put("acceptanceNum",acceptanceNum);
break; break;
case "financing": case "financing":
...@@ -182,5 +231,28 @@ public class StatisticsHomepageServiceImpl { ...@@ -182,5 +231,28 @@ public class StatisticsHomepageServiceImpl {
return resultMap; return resultMap;
} }
List<Map<String, Object>> nullDataBuildResult(List<Map<String, Object>> list,List<String> Keys){
if (Keys.size()< 1){
return list ;
}
for (String key : Keys) {
if (key.equals("workOrder") ||key.equals("grid")||key.equals("acceptance")||key.equals("financing")||key.equals("inverter")){
list.add( MapBuilder.<String, Object>create().put("statusText",key).put("total",0).put("realScale",0).build());
}else {
list.add( MapBuilder.<String, Object>create().put("statusText",key).put("total",0).build());
}
}
return list;
}
List<Map<String, Object>> differenceValue (List<Map<String, Object>> list,List<String> Keys) {
List<String> objects = new ArrayList<>();
list.forEach(e->{
objects.add(e.get("statusText").toString());
});
Keys.removeAll(objects);
this.nullDataBuildResult(list,Keys);
return list;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment