Commit 459e37d0 authored by tangwei's avatar tangwei

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 9d95516c 3ab529cd
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -24,11 +25,13 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -24,11 +25,13 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext; import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify; import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
...@@ -43,6 +46,7 @@ import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService; ...@@ -43,6 +46,7 @@ import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService; import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -84,14 +88,23 @@ public class KeySiteController extends BaseController { ...@@ -84,14 +88,23 @@ public class KeySiteController extends BaseController {
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增重点部位", notes = "新增重点部位") @ApiOperation(httpMethod = "POST", value = "新增重点部位", notes = "新增重点部位")
public ResponseModel<KeySiteDto> save(@RequestBody KeySiteDto model) { public ResponseModel<KeySiteDto> save(@RequestBody KeySiteDto model) {
JSONObject json = getBulid(model.getBuildingId()); // JSONObject json = getBulid(model.getBuildingId());
if (json != null && StringUtils.isNotBlank(json.getString("latitude")) // if (json != null && StringUtils.isNotBlank(json.getString("latitude"))
&& StringUtils.isNotBlank(json.getString("longitude"))) { // && StringUtils.isNotBlank(json.getString("longitude"))) {
model.setLatitude(Double.parseDouble(json.getString("latitude"))); // model.setLatitude(Double.parseDouble(json.getString("latitude")));
model.setLongitude(Double.parseDouble(json.getString("longitude"))); // model.setLongitude(Double.parseDouble(json.getString("longitude")));
} // }
model.setIsDelete(false); model.setIsDelete(false);
if (model.getAddressDesc() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddressDesc());
model.setAddressDesc(address.getString(BizConstant.ADDRESS));
if (!"0".equals(address.getString(BizConstant.LONGITUDE))) {
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
}
if (!"0".equals(address.getString(BizConstant.LATITUDE))) {
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
}
List<String> ids = new ArrayList<String>(); List<String> ids = new ArrayList<String>();
ids.add(model.getBuildingId().toString()); ids.add(model.getBuildingId().toString());
Map<String, String> map3 = keySiteService.getNodeAllParentIds(ids); Map<String, String> map3 = keySiteService.getNodeAllParentIds(ids);
...@@ -100,6 +113,33 @@ public class KeySiteController extends BaseController { ...@@ -100,6 +113,33 @@ public class KeySiteController extends BaseController {
return ResponseHelper.buildResponse(entity); return ResponseHelper.buildResponse(entity);
} }
public static JSONObject getLongLatFromAddress(String address) {
JSONObject result = new JSONObject();
result.put(BizConstant.ADDRESS, "");
result.put(BizConstant.LONGITUDE, "0");
result.put(BizConstant.LATITUDE, "0");
if (StringUtils.isNotEmpty(address)) {
String[] addressData = address.split("@address@");
if (addressData.length > 1) {
result.put(BizConstant.ADDRESS, addressData[0]);
JSONObject langLatObj = JSON.parseObject(addressData[1]);
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LONGITUDE))) {
result.put(BizConstant.LONGITUDE, langLatObj.getString(BizConstant.LONGITUDE));
} else {
result.put(BizConstant.LONGITUDE, "0");
}
if (StringUtils.isNotEmpty(langLatObj.getString(BizConstant.LATITUDE))) {
result.put(BizConstant.LATITUDE, langLatObj.getString(BizConstant.LATITUDE));
} else {
result.put(BizConstant.LATITUDE, "0");
}
} else {
result.put(BizConstant.ADDRESS, addressData[0]);
}
}
return result;
}
public JSONObject getBulid(Long id) { public JSONObject getBulid(Long id) {
ResponseModel<Object> equipObj = equipFeignClient.getOne(id); ResponseModel<Object> equipObj = equipFeignClient.getOne(id);
JSONObject equipjSONObject = JSONObject.parseObject(JSONObject.toJSONString(equipObj.getResult())); JSONObject equipjSONObject = JSONObject.parseObject(JSONObject.toJSONString(equipObj.getResult()));
...@@ -125,10 +165,20 @@ public class KeySiteController extends BaseController { ...@@ -125,10 +165,20 @@ public class KeySiteController extends BaseController {
@PutMapping(value = "update/{sequenceNbr}") @PutMapping(value = "update/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新重点部位", notes = "根据sequenceNbr更新重点部位") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新重点部位", notes = "根据sequenceNbr更新重点部位")
public ResponseModel<Boolean> updateBySequenceNbrKeySite(@RequestBody KeySiteDto model) { public ResponseModel<Boolean> updateBySequenceNbrKeySite(@RequestBody KeySiteDto model) {
JSONObject json = getBulid(model.getBuildingId()); // JSONObject json = getBulid(model.getBuildingId());
if (json != null) { // if (json != null) {
model.setLatitude(Double.parseDouble(json.getString("latitude"))); // model.setLatitude(Double.parseDouble(json.getString("latitude")));
model.setLongitude(Double.parseDouble(json.getString("longitude"))); // model.setLongitude(Double.parseDouble(json.getString("longitude")));
// }
if (model.getAddressDesc() != null) {
JSONObject address = WaterResourceServiceImpl.getLongLatFromAddress(model.getAddressDesc());
model.setAddressDesc(address.getString(BizConstant.ADDRESS));
if (!"0".equals(address.getString(BizConstant.LONGITUDE))) {
model.setLongitude(Double.valueOf(address.getString(BizConstant.LONGITUDE)));
}
if (!"0".equals(address.getString(BizConstant.LATITUDE))) {
model.setLatitude(Double.valueOf(address.getString(BizConstant.LATITUDE)));
}
} }
return ResponseHelper.buildResponse(keySiteService.update(model, getUserInfo())); return ResponseHelper.buildResponse(keySiteService.update(model, getUserInfo()));
} }
...@@ -186,8 +236,8 @@ public class KeySiteController extends BaseController { ...@@ -186,8 +236,8 @@ public class KeySiteController extends BaseController {
* *
* @param current 当前页 * @param current 当前页
* @param current 每页大小 * @param current 每页大小
* @return * @return //
// */ */
// @TycloudOperation(ApiLevel = UserType.AGENCY) // @TycloudOperation(ApiLevel = UserType.AGENCY)
// @GetMapping(value = "/page") // @GetMapping(value = "/page")
// @ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询") // @ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询")
...@@ -255,8 +305,6 @@ public class KeySiteController extends BaseController { ...@@ -255,8 +305,6 @@ public class KeySiteController extends BaseController {
} }
} }
/** /**
* 列表分页查询 * 列表分页查询
* *
...@@ -268,20 +316,15 @@ public class KeySiteController extends BaseController { ...@@ -268,20 +316,15 @@ public class KeySiteController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询") @ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询")
public ResponseModel<IPage<KeySiteDto>> queryForPage( public ResponseModel<IPage<KeySiteDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, @RequestParam(required = false) String name,
@RequestParam(value = "size") int size, @RequestParam(required = false) Long buildingId, @RequestParam(required = false) String fireEnduranceRate,
@RequestParam(required = false) String name, @RequestParam(required = false) String useNature, @RequestParam(required = false) String fireFacilitiesInfo,
@RequestParam(required = false) Long buildingId,
@RequestParam(required = false) String fireEnduranceRate,
@RequestParam(required = false) String useNature,
@RequestParam(required = false) String fireFacilitiesInfo,
@RequestParam(required = false) String bizOrgCode) { @RequestParam(required = false) String bizOrgCode) {
Page<KeySiteDto> page = new Page<KeySiteDto>(); Page<KeySiteDto> page = new Page<KeySiteDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
return ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page, name, buildingId, fireEnduranceRate, return ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page, name, buildingId, fireEnduranceRate,
useNature, fireFacilitiesInfo, bizOrgCode)); useNature, fireFacilitiesInfo, bizOrgCode));
} }
...@@ -297,20 +340,15 @@ public class KeySiteController extends BaseController { ...@@ -297,20 +340,15 @@ public class KeySiteController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/pageNew") @GetMapping(value = "/pageNew")
@ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询") @ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询")
public ResponseModel<IPage<KeySiteDto>> queryForPageNew( public ResponseModel<IPage<KeySiteDto>> queryForPageNew(@RequestParam(value = "current") int current,
@RequestParam(value = "current") int current, @RequestParam(value = "size") int size, @RequestParam(required = false) String name,
@RequestParam(value = "size") int size, @RequestParam(required = false) Long buildingId, @RequestParam(required = false) String fireEnduranceRate,
@RequestParam(required = false) String name, @RequestParam(required = false) String useNature, @RequestParam(required = false) String fireFacilitiesInfo,
@RequestParam(required = false) Long buildingId,
@RequestParam(required = false) String fireEnduranceRate,
@RequestParam(required = false) String useNature,
@RequestParam(required = false) String fireFacilitiesInfo,
@RequestParam String bizOrgCode) { @RequestParam String bizOrgCode) {
Page<KeySiteDto> page = new Page<KeySiteDto>(); Page<KeySiteDto> page = new Page<KeySiteDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
return ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page, name, buildingId, fireEnduranceRate, return ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page, name, buildingId, fireEnduranceRate,
useNature, fireFacilitiesInfo, bizOrgCode)); useNature, fireFacilitiesInfo, bizOrgCode));
} }
...@@ -319,8 +357,7 @@ public class KeySiteController extends BaseController { ...@@ -319,8 +357,7 @@ public class KeySiteController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/keySiteCountAndBuildingTree", method = RequestMethod.GET) @RequestMapping(value = "/keySiteCountAndBuildingTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登录人角色获取当前单位下的所在建筑的重点部位统计值", notes = "根据登录人角色获取当前单位下的所在建筑的重点部位统计值") @ApiOperation(httpMethod = "GET", value = "根据登录人角色获取当前单位下的所在建筑的重点部位统计值", notes = "根据登录人角色获取当前单位下的所在建筑的重点部位统计值")
public ResponseModel<List<Map<String, Object>>> keySiteCountAndBuildingTree( public ResponseModel<List<Map<String, Object>>> keySiteCountAndBuildingTree(@RequestParam String bizOrgCode) {
@RequestParam String bizOrgCode) {
return ResponseHelper.buildResponse(keySiteService.keySiteCountAndBuildingTree(bizOrgCode)); return ResponseHelper.buildResponse(keySiteService.keySiteCountAndBuildingTree(bizOrgCode));
} }
} }
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