Commit 2432116a authored by hezhuozhi's avatar hezhuozhi

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

parents a1bcf0f5 9aa4e564
......@@ -85,6 +85,7 @@
hygf_design_information
LEFT JOIN
hygf_peasant_household ON hygf_design_information.peasant_household_id = hygf_peasant_household.sequence_nbr
<where>
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
......@@ -100,6 +101,8 @@
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
</select>
<select id="preparationMoneyTotal" resultType="map">
......@@ -145,6 +148,7 @@
hygf_power_station_engineering_info ei on ei.work_order_power_station_id =hygf_work_order_power_station.sequence_nbr
LEFT JOIN
hygf_peasant_household ON hygf_work_order_power_station.peasant_household_id = hygf_peasant_household.sequence_nbr
<where>
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
......@@ -160,6 +164,7 @@
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
power_station_construction_status,work_order_power_station_node
</select>
......@@ -183,6 +188,7 @@
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_peasant_household ON hygf_basic_grid_record.peasant_household_id = hygf_peasant_household.sequence_nbr
<where>
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
......@@ -198,6 +204,7 @@
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
grid_status
</select>
......@@ -227,6 +234,7 @@
hygf_power_station_engineering_info ei ON ei.work_order_power_station_id = ps.sequence_nbr
LEFT JOIN
hygf_peasant_household ON hygf_acceptance_check.peasant_household_id = hygf_peasant_household.sequence_nbr
<where>
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
......@@ -242,6 +250,7 @@
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
acceptance_check_status
</select>
......@@ -257,6 +266,7 @@
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_peasant_household ON hygf_financing_info.peasant_household_id = hygf_peasant_household.sequence_nbr
<where>
<if test="developerCode != null and developerCode != ''">
AND hygf_peasant_household.developer_code = #{developerCode}
</if>
......@@ -272,6 +282,7 @@
<if test="district != null and district != ''">
AND hygf_peasant_household.project_address LIKE CONCAT ('%',#{district},'%')
</if>
</where>
GROUP BY
status
......
......@@ -11,10 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service
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){
long total= 0;
double realScale = 0.00;
long sureyNum = 0;
long workNum = 0;
long preparationNum = 0;
......@@ -68,11 +64,23 @@ public class StatisticsHomepageServiceImpl {
long stationNum =0;
double stationRealScale = 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<>();
switch(type){
case "surey" :
resultMap.put("sureyComplete",0);
if (Objects.isNull(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,surveKeys);
}else {
Map<String, Object> surey = maps.get(0);
surveKeys.removeAll(surey.keySet());
for (String e : surey.keySet()) {
if (!e.equals("completeTotal")){
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",surey.get(e)).build());
......@@ -83,73 +91,112 @@ public class StatisticsHomepageServiceImpl {
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("stationNum",sureyNum+stationNum);
resultMap.put("surey",list);
resultMap.put("sureyComplete",surey.get("completeTotal"));
break;
case "desion":
if (Objects.isNull(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,desionKeys);
}else {
Map<String, Object> desion = maps.get(0);
desion.keySet().forEach(e->{
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 = this.nullDataBuildResult(list,desionKeys);
if (resultMap.containsKey("sureyComplete")){
list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",resultMap.get("sureyComplete")).build());
resultMap.remove("sureyComplete");
}else {
list.add( MapBuilder.<String, Object>create().put("statusText","审核完成").put("total",0).build());
}
}
resultMap.put("desion",list);
break;
case "contract":
if (Objects.isNull(maps) || Objects.isNull(maps.get(0)) ){
list = this.nullDataBuildResult(list,contractKeys);
}else {
Map<String, Object> contract = maps.get(0);
contract.keySet().forEach(e->{
list.add( MapBuilder.<String, Object>create().put("statusText",e).put("total",contract.get(e)).build());
});
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);
break;
case "preparationMoney":
if (Objects.isNull(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,preparationMoneyKeys);
}else {
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());
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);
li.put("preparationNum",preparationNum);
break;
case "workOrder":
if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,workOrder);
resultMap.put("workOrder",list);
}else {
Iterator<Map<String, Object>> iterator = maps.iterator();
while (iterator.hasNext()) {
Map<String, Object> map = iterator.next();
workNum += (long) map.get("total");
stationRealScale += (double)map.get("realScale");
stationRealScale += (double) map.get("realScale");
if ("审核中".equals(map.get("statusText"))) {
total += (long) map.get("total");
realScale += (double) map.get("realScale");
iterator.remove();
}
}
li.put("workNum",workNum);
li.put("stationRealScale",stationRealScale);
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("stationRealScale",stationRealScale);
break;
case "grid":
if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,gridKeys);
resultMap.put("grid",list);
}else {
Iterator<Map<String, Object>> iterator1 = maps.iterator();
while (iterator1.hasNext()) {
Map<String, Object> map = iterator1.next();
gridNum += (long) map.get("total");
if ("审核中".equals(map.get("statusText"))) {
total +=(long) map.get("total");
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());
maps.add(MapBuilder.<String, Object>create().put("statusText", "审核中").put("total", total).put("realScale", realScale).build());
differenceValue(maps,gridKeys);
resultMap.put("grid",maps);
}
li.put("gridNum",gridNum);
break;
case "acceptance":
if (CollectionUtil.isEmpty(maps)|| Objects.isNull(maps.get(0))){
list = this.nullDataBuildResult(list,acceptanceKeys);
resultMap.put("acceptance",list);
}else {
Iterator<Map<String, Object>> iterator2 = maps.iterator();
while (iterator2.hasNext()) {
Map<String, Object> map = iterator2.next();
......@@ -161,7 +208,9 @@ public class StatisticsHomepageServiceImpl {
}
}
maps.add(MapBuilder.<String, Object>create().put("statusText","审核中").put("total",total).put("realScale",realScale).build());
differenceValue(maps,acceptanceKeys);
resultMap.put("acceptance",maps);
}
li.put("acceptanceNum",acceptanceNum);
break;
case "financing":
......@@ -182,5 +231,28 @@ public class StatisticsHomepageServiceImpl {
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