|
@@ -2,23 +2,32 @@ package platform.modules.carrier.service;
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import platform.common.Constant;
|
|
import platform.common.Constant;
|
|
|
import platform.common.base.service.DictionaryItemService;
|
|
import platform.common.base.service.DictionaryItemService;
|
|
|
|
|
+import platform.common.util.CommonUtils;
|
|
|
|
|
+import platform.common.util.DateUtil;
|
|
|
|
|
+import platform.common.util.ExportExcel;
|
|
|
import platform.common.util.ShiroUtils;
|
|
import platform.common.util.ShiroUtils;
|
|
|
import platform.modules.build.service.FloorService;
|
|
import platform.modules.build.service.FloorService;
|
|
|
import platform.modules.carrier.dto.CarrierLibraryResult;
|
|
import platform.modules.carrier.dto.CarrierLibraryResult;
|
|
|
|
|
+import platform.modules.carrier.dto.CarrierStatisitcDto;
|
|
|
import platform.modules.carrier.dto.SearchCondition;
|
|
import platform.modules.carrier.dto.SearchCondition;
|
|
|
import platform.modules.carrier.entity.*;
|
|
import platform.modules.carrier.entity.*;
|
|
|
import platform.modules.government.entity.User;
|
|
import platform.modules.government.entity.User;
|
|
|
import platform.modules.government.service.StreetService;
|
|
import platform.modules.government.service.StreetService;
|
|
|
|
|
+import platform.modules.sys.entity.ActivityDetail;
|
|
|
|
|
+import platform.modules.sys.entity.ActivityRegistration;
|
|
|
|
|
+import platform.modules.sys.report.ActivityRegistrationExports;
|
|
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
+import java.net.URLEncoder;
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author kevin
|
|
* @author kevin
|
|
@@ -67,7 +76,7 @@ public class CarrierStatisticService {
|
|
|
for (CarrierLibraryResult result : libraryResults) {
|
|
for (CarrierLibraryResult result : libraryResults) {
|
|
|
Double sumRentArea = streetService.getStreetRentAreaStatistic(result.getId());
|
|
Double sumRentArea = streetService.getStreetRentAreaStatistic(result.getId());
|
|
|
result.setSumRentArea(sumRentArea);
|
|
result.setSumRentArea(sumRentArea);
|
|
|
- //楼栋建筑面积为空,按楼层建筑面积和算,楼层建筑面积为空按,楼层已租、代租只和算
|
|
|
|
|
|
|
+ //楼栋建筑面积为空,按楼层建筑面积和算,楼层建筑面积为空按,楼层已租、代租之和算
|
|
|
Double sumBuildArea = getSumStreetBuildingArea(result.getId());
|
|
Double sumBuildArea = getSumStreetBuildingArea(result.getId());
|
|
|
result.setSumBuildArea(sumBuildArea);
|
|
result.setSumBuildArea(sumBuildArea);
|
|
|
}
|
|
}
|
|
@@ -159,10 +168,10 @@ public class CarrierStatisticService {
|
|
|
*/
|
|
*/
|
|
|
private void userTypeConditon(SearchCondition condition) {
|
|
private void userTypeConditon(SearchCondition condition) {
|
|
|
User user = ShiroUtils.getUserEntity();
|
|
User user = ShiroUtils.getUserEntity();
|
|
|
- if (user.getUser_type() != null && user.getUser_type().equals(Constant.UserType.STREET)){
|
|
|
|
|
|
|
+ if (user.getUser_type() != null && user.getUser_type().equals(Constant.UserType.STREET)) {
|
|
|
condition.setStreetId(user.getStreet_id());
|
|
condition.setStreetId(user.getStreet_id());
|
|
|
}
|
|
}
|
|
|
- if (user.getUser_type() != null && user.getUser_type().equals(Constant.UserType.BUILD)){
|
|
|
|
|
|
|
+ if (user.getUser_type() != null && user.getUser_type().equals(Constant.UserType.BUILD)) {
|
|
|
condition.setParkId(user.getBuild_id());
|
|
condition.setParkId(user.getBuild_id());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -235,17 +244,16 @@ public class CarrierStatisticService {
|
|
|
for (Building building : buildingList) {
|
|
for (Building building : buildingList) {
|
|
|
building.setBuild_use_desc(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.BUILDING_USES, building.getBuild_use() + ""));
|
|
building.setBuild_use_desc(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.BUILDING_USES, building.getBuild_use() + ""));
|
|
|
building.setCarrier_attriute_desc(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.FACTORY_TYPE, building.getCarrier_attriute() + ""));
|
|
building.setCarrier_attriute_desc(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.FACTORY_TYPE, building.getCarrier_attriute() + ""));
|
|
|
- if (building.getArea() != null){
|
|
|
|
|
|
|
+ if (building.getArea() != null) {
|
|
|
building.setSumBuildArea(building.getArea());
|
|
building.setSumBuildArea(building.getArea());
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
//楼栋没有建筑面积获取楼层建筑面积
|
|
//楼栋没有建筑面积获取楼层建筑面积
|
|
|
// double totalFloorArea = floorService.getSumFloorArea(building.getId());
|
|
// double totalFloorArea = floorService.getSumFloorArea(building.getId());
|
|
|
// building.setSumBuildArea(totalFloorArea);
|
|
// building.setSumBuildArea(totalFloorArea);
|
|
|
building.setSumBuildArea(buildingService.findBuildingTotalArea(building.getId()));
|
|
building.setSumBuildArea(buildingService.findBuildingTotalArea(building.getId()));
|
|
|
}
|
|
}
|
|
|
CarrierLibraryResult areaStatistic = buildingService.getBuildAreaStatistic(building.getId());
|
|
CarrierLibraryResult areaStatistic = buildingService.getBuildAreaStatistic(building.getId());
|
|
|
- if (areaStatistic != null){
|
|
|
|
|
|
|
+ if (areaStatistic != null) {
|
|
|
building.setSumRestArea(areaStatistic.getSumRestArea());
|
|
building.setSumRestArea(areaStatistic.getSumRestArea());
|
|
|
}
|
|
}
|
|
|
// Double sumRentArea = parkService.getParkRentAreaStatistic(building.getPark_id());
|
|
// Double sumRentArea = parkService.getParkRentAreaStatistic(building.getPark_id());
|
|
@@ -271,15 +279,14 @@ public class CarrierStatisticService {
|
|
|
for (Building building : buildingList) {
|
|
for (Building building : buildingList) {
|
|
|
building.setBuild_use_desc(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.BUILDING_USES, building.getBuild_use() + ""));
|
|
building.setBuild_use_desc(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.BUILDING_USES, building.getBuild_use() + ""));
|
|
|
building.setCarrier_attriute_desc(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.FACTORY_TYPE, building.getCarrier_attriute() + ""));
|
|
building.setCarrier_attriute_desc(dictionaryItemService.findNameByTypeAndValue(Constant.DictionaryType.FACTORY_TYPE, building.getCarrier_attriute() + ""));
|
|
|
- if (building.getArea() != null){
|
|
|
|
|
|
|
+ if (building.getArea() != null) {
|
|
|
building.setSumBuildArea(building.getArea());
|
|
building.setSumBuildArea(building.getArea());
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
|
|
+ } else {
|
|
|
//楼栋没有建筑面积获取楼层建筑面积
|
|
//楼栋没有建筑面积获取楼层建筑面积
|
|
|
building.setSumBuildArea(buildingService.findBuildingTotalArea(building.getId()));
|
|
building.setSumBuildArea(buildingService.findBuildingTotalArea(building.getId()));
|
|
|
}
|
|
}
|
|
|
CarrierLibraryResult areaStatistic = buildingService.getBuildAreaStatistic(building.getId());
|
|
CarrierLibraryResult areaStatistic = buildingService.getBuildAreaStatistic(building.getId());
|
|
|
- if (areaStatistic != null){
|
|
|
|
|
|
|
+ if (areaStatistic != null) {
|
|
|
building.setSumRestArea(areaStatistic.getSumRestArea());
|
|
building.setSumRestArea(areaStatistic.getSumRestArea());
|
|
|
totalRestArea += areaStatistic.getSumRestArea();
|
|
totalRestArea += areaStatistic.getSumRestArea();
|
|
|
}
|
|
}
|
|
@@ -311,7 +318,7 @@ public class CarrierStatisticService {
|
|
|
|
|
|
|
|
totalRestArea += result.getSumRestArea();
|
|
totalRestArea += result.getSumRestArea();
|
|
|
Double sumRentArea = streetService.getStreetRentAreaStatistic(result.getId());
|
|
Double sumRentArea = streetService.getStreetRentAreaStatistic(result.getId());
|
|
|
- if (sumRentArea != null){
|
|
|
|
|
|
|
+ if (sumRentArea != null) {
|
|
|
totalRentArea += sumRentArea;
|
|
totalRentArea += sumRentArea;
|
|
|
}
|
|
}
|
|
|
totalParks = totalParks + result.getParkNum();
|
|
totalParks = totalParks + result.getParkNum();
|
|
@@ -335,15 +342,15 @@ public class CarrierStatisticService {
|
|
|
public Map<String, Double> findTotalParkStatistic(Integer id) {
|
|
public Map<String, Double> findTotalParkStatistic(Integer id) {
|
|
|
Double totalBuildArea = 0d;
|
|
Double totalBuildArea = 0d;
|
|
|
Double totalRestArea = 0d;
|
|
Double totalRestArea = 0d;
|
|
|
- Double totalRentArea =0d;
|
|
|
|
|
- Integer totalBuildingNum =0;
|
|
|
|
|
|
|
+ Double totalRentArea = 0d;
|
|
|
|
|
+ Integer totalBuildingNum = 0;
|
|
|
List<CarrierLibraryResult> libraryResults = parkService.getParkStatistic(id);
|
|
List<CarrierLibraryResult> libraryResults = parkService.getParkStatistic(id);
|
|
|
for (CarrierLibraryResult result : libraryResults) {
|
|
for (CarrierLibraryResult result : libraryResults) {
|
|
|
Double sumBuildArea = getSumParkBuildingArea(result.getId());
|
|
Double sumBuildArea = getSumParkBuildingArea(result.getId());
|
|
|
totalBuildArea += sumBuildArea;
|
|
totalBuildArea += sumBuildArea;
|
|
|
totalRestArea += result.getSumRestArea();
|
|
totalRestArea += result.getSumRestArea();
|
|
|
Double sumRentArea = parkService.getParkRentAreaStatistic(result.getId());
|
|
Double sumRentArea = parkService.getParkRentAreaStatistic(result.getId());
|
|
|
- if (sumRentArea != null){
|
|
|
|
|
|
|
+ if (sumRentArea != null) {
|
|
|
totalRentArea += sumRentArea;
|
|
totalRentArea += sumRentArea;
|
|
|
}
|
|
}
|
|
|
totalBuildingNum += result.getBuildingNum();
|
|
totalBuildingNum += result.getBuildingNum();
|
|
@@ -406,7 +413,25 @@ public class CarrierStatisticService {
|
|
|
* @param data
|
|
* @param data
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public Double toScale2(Double data){
|
|
|
|
|
|
|
+ public Double toScale2(Double data) {
|
|
|
return new BigDecimal(data).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
return new BigDecimal(data).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @Author: huZhiHao
|
|
|
|
|
+ * @Description: 导出表格
|
|
|
|
|
+ * @Date: 2020/7/14
|
|
|
|
|
+ * @Params: [response]
|
|
|
|
|
+ * @Return: void
|
|
|
|
|
+ **/
|
|
|
|
|
+ public void exportCarrierExcel(HttpServletResponse response) throws Exception {
|
|
|
|
|
+
|
|
|
|
|
+ String timeStr = DateUtil.getCurrentDateString("yyyy-MM-dd");
|
|
|
|
|
+
|
|
|
|
|
+ String fileName = "载体数据" + timeStr + ".xlsx";
|
|
|
|
|
+
|
|
|
|
|
+ List<CarrierStatisitcDto> carrierStatisitcDtoList = contractFloorService.exportCarrier();
|
|
|
|
|
+
|
|
|
|
|
+ new ExportExcel("载体数据 " + timeStr, CarrierStatisitcDto.class).setDataList(carrierStatisitcDtoList).write(response, fileName).dispose();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|