|
@@ -6,8 +6,11 @@ import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.project.common.enums.EmployeeTypeEnum;
|
|
|
import com.project.common.utils.StringUtils;
|
|
|
import com.project.common.utils.http.HttpUtils;
|
|
|
+import com.project.zcustom.domain.addional.LargeAssetDirs;
|
|
|
+import com.project.zcustom.domain.addional.LargeLogistics;
|
|
|
import com.project.zcustom.domain.plat.PlatApiRecord;
|
|
|
import com.project.zcustom.domain.addional.LargeBuilding;
|
|
|
+import com.project.zcustom.mapper.logistics.PlatLogisticsMapper;
|
|
|
import com.project.zcustom.mapper.unit.PlatBuildingMapper;
|
|
|
import com.project.zcustom.service.access.IPlatAccessService;
|
|
|
import com.project.zcustom.service.basics.IPlatBasicsService;
|
|
@@ -21,7 +24,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
@@ -37,6 +43,9 @@ public class DataTools {
|
|
|
@Autowired
|
|
|
private PlatBuildingMapper platBuildingMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PlatLogisticsMapper platLogisticsMapper;
|
|
|
+
|
|
|
@Resource
|
|
|
IPlatEmployeeTypeService platEmployeeTypeService;
|
|
|
@Resource
|
|
@@ -107,7 +116,223 @@ public class DataTools {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void getLogisticsData(){
|
|
|
+ String json = "{\n" +
|
|
|
+ " \"code\": \"200\",\n" +
|
|
|
+ " \"msg\": \"操作成功\",\n" +
|
|
|
+ " \"data\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"orgId\": \"10001\",\n" +
|
|
|
+ " \"orgName\": \"三亚电力公司\",\n" +
|
|
|
+ " \"parentOrgId\": \"12001\",\n" +
|
|
|
+ " \"parentOrgName\": \"\",\n" +
|
|
|
+ " \"codedNum\": 10,\n" +
|
|
|
+ " \"labelNum\": 10,\n" +
|
|
|
+ " \"assetNum\": 20,\n" +
|
|
|
+ " \"officeAssetNum\": 110,\n" +
|
|
|
+ " \"stockOfficeAssetNum\": 22,\n" +
|
|
|
+ " \"newOfficeAssetNum\": 34,\n" +
|
|
|
+ " \"scrapOfficeAssetNum\": 56,\n" +
|
|
|
+ " \"buildingAssetNum\": 77,\n" +
|
|
|
+ " \"stockBuildingAssetNum\": 35,\n" +
|
|
|
+ " \"newBuildingAssetNum\": 3,\n" +
|
|
|
+ " \"scrapBuildingAssetNum\": 6,\n" +
|
|
|
+ " \"serviceAssetNum\": 88,\n" +
|
|
|
+ " \"stockServiceAssetNum\": 34,\n" +
|
|
|
+ " \"newServiceAssetNum\": 99,\n" +
|
|
|
+ " \"scrapServiceAssetNum\": 1,\n" +
|
|
|
+ " \"officeAssetDistrs\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"电梯电气\",\n" +
|
|
|
+ " \"assetNum\": 12\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"供热采暖\",\n" +
|
|
|
+ " \"assetNum\": 42\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"消防\",\n" +
|
|
|
+ " \"assetNum\": 20\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"buildingAssetDistrs\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"电梯电气\",\n" +
|
|
|
+ " \"assetNum\": 12\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"供热采暖\",\n" +
|
|
|
+ " \"assetNum\": 42\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"消防\",\n" +
|
|
|
+ " \"assetNum\": 20\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"serviceAssetDistrs\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"电梯电气\",\n" +
|
|
|
+ " \"assetNum\": 12\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"供热采暖\",\n" +
|
|
|
+ " \"assetNum\": 42\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"消防\",\n" +
|
|
|
+ " \"assetNum\": 20\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"sceneRate\": 85.55,\n" +
|
|
|
+ " \"inspectionSchemeNum\": 12,\n" +
|
|
|
+ " \"importantDeviceTypeInspectionExecuteRate\": 66.33,\n" +
|
|
|
+ " \"inspectionAnomalyRecordNum\": 13,\n" +
|
|
|
+ " \"repairRecordNum\": 44,\n" +
|
|
|
+ " \"maintenanceRecordNum\": 56\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"orgId\": \"10444\",\n" +
|
|
|
+ " \"orgName\": \"济南电力公司\",\n" +
|
|
|
+ " \"parentOrgId\": \"13401\",\n" +
|
|
|
+ " \"parentOrgName\": \"\",\n" +
|
|
|
+ " \"codedNum\": 110,\n" +
|
|
|
+ " \"labelNum\": 120,\n" +
|
|
|
+ " \"assetNum\": 70,\n" +
|
|
|
+ " \"officeAssetNum\": 69,\n" +
|
|
|
+ " \"stockOfficeAssetNum\": 53,\n" +
|
|
|
+ " \"newOfficeAssetNum\": 9,\n" +
|
|
|
+ " \"scrapOfficeAssetNum\": 17,\n" +
|
|
|
+ " \"buildingAssetNum\": 36,\n" +
|
|
|
+ " \"stockBuildingAssetNum\": 8,\n" +
|
|
|
+ " \"newBuildingAssetNum\": 95,\n" +
|
|
|
+ " \"scrapBuildingAssetNum\": 71,\n" +
|
|
|
+ " \"serviceAssetNum\": 103,\n" +
|
|
|
+ " \"stockServiceAssetNum\": 0,\n" +
|
|
|
+ " \"newServiceAssetNum\": 2,\n" +
|
|
|
+ " \"scrapServiceAssetNum\": 1,\n" +
|
|
|
+ " \"officeAssetDistrs\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"消防\",\n" +
|
|
|
+ " \"assetNum\": 12\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"排水\",\n" +
|
|
|
+ " \"assetNum\": 42\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"楼宇通风\",\n" +
|
|
|
+ " \"assetNum\": 20\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"buildingAssetDistrs\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"电梯电气\",\n" +
|
|
|
+ " \"assetNum\": 12\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"楼宇通风\",\n" +
|
|
|
+ " \"assetNum\": 42\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"消防\",\n" +
|
|
|
+ " \"assetNum\": 20\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"serviceAssetDistrs\": [\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"排水\",\n" +
|
|
|
+ " \"assetNum\": 12\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"供热采暖\",\n" +
|
|
|
+ " \"assetNum\": 42\n" +
|
|
|
+ " },\n" +
|
|
|
+ " {\n" +
|
|
|
+ " \"categoryName\": \"楼宇通风\",\n" +
|
|
|
+ " \"assetNum\": 20\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ],\n" +
|
|
|
+ " \"sceneRate\": 88.99,\n" +
|
|
|
+ " \"inspectionSchemeNum\": 21,\n" +
|
|
|
+ " \"importantDeviceTypeInspectionExecuteRate\": 56.65,\n" +
|
|
|
+ " \"inspectionAnomalyRecordNum\": 19,\n" +
|
|
|
+ " \"repairRecordNum\": 23,\n" +
|
|
|
+ " \"maintenanceRecordNum\": 200\n" +
|
|
|
+ " }\n" +
|
|
|
+ " ]\n" +
|
|
|
+ "}";
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(json);
|
|
|
+ JSONArray dataArray = jsonObject.getJSONArray("data");
|
|
|
+ List<LargeLogistics> list = new ArrayList<>();
|
|
|
+ List<LargeAssetDirs> officeAssetList = new ArrayList<>();
|
|
|
+ List<LargeAssetDirs> buildingAssetList = new ArrayList<>();
|
|
|
+ List<LargeAssetDirs> serviceAssetList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+ JSONObject dataItem = dataArray.getJSONObject(i);
|
|
|
+ LargeLogistics largeLogistics = new LargeLogistics(
|
|
|
+ dataItem.getString("orgId"),
|
|
|
+ dataItem.getString("parentOrgId"),
|
|
|
+ Long.valueOf(dataItem.getString("codedNum")),
|
|
|
+ Long.valueOf(dataItem.getString("labelNum")),
|
|
|
+ Long.valueOf(dataItem.getString("assetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("officeAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("stockOfficeAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("newOfficeAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("scrapOfficeAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("buildingAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("stockBuildingAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("newBuildingAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("scrapBuildingAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("serviceAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("stockServiceAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("newServiceAssetNum")),
|
|
|
+ Long.valueOf(dataItem.getString("scrapServiceAssetNum")),
|
|
|
+ new BigDecimal(dataItem.getString("sceneRate")),
|
|
|
+ Long.valueOf(dataItem.getString("inspectionSchemeNum")),
|
|
|
+ new BigDecimal(dataItem.getString("importantDeviceTypeInspectionExecuteRate")),
|
|
|
+ Long.valueOf(dataItem.getString("inspectionAnomalyRecordNum")),
|
|
|
+ Long.valueOf(dataItem.getString("repairRecordNum")),
|
|
|
+ Long.valueOf(dataItem.getString("maintenanceRecordNum"))
|
|
|
+ );
|
|
|
+ JSONArray officeAssetArray = dataItem.getJSONArray("officeAssetDistrs");
|
|
|
+ for (int j = 0; j < dataArray.size(); j++) {
|
|
|
+ LargeAssetDirs largeAssetDirs = new LargeAssetDirs();
|
|
|
+ JSONObject assetItem = officeAssetArray.getJSONObject(j);
|
|
|
+ largeAssetDirs.setAppCode(largeLogistics.getAppCode());
|
|
|
+ largeAssetDirs.setCategoryName(assetItem.getString("categoryName"));
|
|
|
+ largeAssetDirs.setAssetNum(Long.valueOf(assetItem.getString("assetNum")));
|
|
|
+ officeAssetList.add(largeAssetDirs);
|
|
|
+ }
|
|
|
+ JSONArray buildingAssetArray = dataItem.getJSONArray("buildingAssetDistrs");
|
|
|
+ for (int j = 0; j < dataArray.size(); j++) {
|
|
|
+ LargeAssetDirs largeAssetDirs = new LargeAssetDirs();
|
|
|
+ JSONObject assetItem = buildingAssetArray.getJSONObject(j);
|
|
|
+ largeAssetDirs.setAppCode(largeLogistics.getAppCode());
|
|
|
+ largeAssetDirs.setCategoryName(assetItem.getString("categoryName"));
|
|
|
+ largeAssetDirs.setAssetNum(Long.valueOf(assetItem.getString("assetNum")));
|
|
|
+ buildingAssetList.add(largeAssetDirs);
|
|
|
+ }
|
|
|
+ JSONArray serviceAssetArray = dataItem.getJSONArray("serviceAssetDistrs");
|
|
|
+ for (int j = 0; j < dataArray.size(); j++) {
|
|
|
+ LargeAssetDirs largeAssetDirs = new LargeAssetDirs();
|
|
|
+ JSONObject assetItem = serviceAssetArray.getJSONObject(j);
|
|
|
+ largeAssetDirs.setAppCode(largeLogistics.getAppCode());
|
|
|
+ largeAssetDirs.setCategoryName(assetItem.getString("categoryName"));
|
|
|
+ largeAssetDirs.setAssetNum(Long.valueOf(assetItem.getString("assetNum")));
|
|
|
+ serviceAssetList.add(largeAssetDirs);
|
|
|
+ }
|
|
|
|
|
|
+ list.add(largeLogistics);
|
|
|
+ }
|
|
|
+ platLogisticsMapper.deleteLogistics();
|
|
|
+ platLogisticsMapper.insertLargePlatLogistics(list);
|
|
|
+ platLogisticsMapper.deleteOfficeAssetDirs();
|
|
|
+ platLogisticsMapper.insertOfficeAssetDirs(officeAssetList);
|
|
|
+ platLogisticsMapper.deleteBuildingAssetDirs();
|
|
|
+ platLogisticsMapper.insertBuildingAssetDirs(buildingAssetList);
|
|
|
+ platLogisticsMapper.deleteServiceAssetDirs();
|
|
|
+ platLogisticsMapper.insertServiceAssetDirs(serviceAssetList);
|
|
|
+ }
|
|
|
|
|
|
public void getBuildingDataFirstHalf(){
|
|
|
LargeBuilding largeBuilding = new LargeBuilding();
|