Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
459e37d0
Commit
459e37d0
authored
Mar 01, 2022
by
tangwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://39.98.45.134:8090/moa/amos-boot-biz
into developer
parents
9d95516c
3ab529cd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
54 deletions
+91
-54
KeySiteController.java
.../boot/module/common/biz/controller/KeySiteController.java
+91
-54
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/KeySiteController.java
View file @
459e37d0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
controller
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -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.ResponseModel
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
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.interceptors.PermissionInterceptorContext
;
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;
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.SourceFileServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -84,22 +88,58 @@ public class KeySiteController extends BaseController {
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增重点部位"
,
notes
=
"新增重点部位"
)
public
ResponseModel
<
KeySiteDto
>
save
(
@RequestBody
KeySiteDto
model
)
{
JSONObject
json
=
getBulid
(
model
.
getBuildingId
());
if
(
json
!=
null
&&
StringUtils
.
isNotBlank
(
json
.
getString
(
"latitude"
))
&&
StringUtils
.
isNotBlank
(
json
.
getString
(
"longitude"
)))
{
model
.
setLatitude
(
Double
.
parseDouble
(
json
.
getString
(
"latitude"
)));
model
.
setLongitude
(
Double
.
parseDouble
(
json
.
getString
(
"longitude"
)));
}
//
JSONObject json = getBulid(model.getBuildingId());
//
if (json != null && StringUtils.isNotBlank(json.getString("latitude"))
//
&& StringUtils.isNotBlank(json.getString("longitude"))) {
//
model.setLatitude(Double.parseDouble(json.getString("latitude")));
//
model.setLongitude(Double.parseDouble(json.getString("longitude")));
//
}
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
>();
ids
.
add
(
model
.
getBuildingId
().
toString
());
Map
<
String
,
String
>
map3
=
keySiteService
.
getNodeAllParentIds
(
ids
);
Map
<
String
,
String
>
map3
=
keySiteService
.
getNodeAllParentIds
(
ids
);
model
.
setParentBuildingId
(
map3
.
get
(
model
.
getBuildingId
().
toString
()));
KeySiteDto
entity
=
keySiteService
.
save
(
model
);
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
)
{
ResponseModel
<
Object
>
equipObj
=
equipFeignClient
.
getOne
(
id
);
JSONObject
equipjSONObject
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
equipObj
.
getResult
()));
...
...
@@ -125,10 +165,20 @@ public class KeySiteController extends BaseController {
@PutMapping
(
value
=
"update/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"根据sequenceNbr更新重点部位"
,
notes
=
"根据sequenceNbr更新重点部位"
)
public
ResponseModel
<
Boolean
>
updateBySequenceNbrKeySite
(
@RequestBody
KeySiteDto
model
)
{
JSONObject
json
=
getBulid
(
model
.
getBuildingId
());
if
(
json
!=
null
)
{
model
.
setLatitude
(
Double
.
parseDouble
(
json
.
getString
(
"latitude"
)));
model
.
setLongitude
(
Double
.
parseDouble
(
json
.
getString
(
"longitude"
)));
// JSONObject json = getBulid(model.getBuildingId());
// if (json != null) {
// model.setLatitude(Double.parseDouble(json.getString("latitude")));
// 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
()));
}
...
...
@@ -186,8 +236,8 @@ public class KeySiteController extends BaseController {
*
* @param current 当前页
* @param current 每页大小
* @return
//
*/
* @return
//
*/
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @GetMapping(value = "/page")
// @ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询")
...
...
@@ -254,40 +304,33 @@ public class KeySiteController extends BaseController {
return
ResponseHelper
.
buildResponse
(
menus
);
}
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"重点部位分页查询"
,
notes
=
"重点部位分页查询"
)
public
ResponseModel
<
IPage
<
KeySiteDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
required
=
false
)
String
name
,
@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
)
{
Page
<
KeySiteDto
>
page
=
new
Page
<
KeySiteDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/page"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"重点部位分页查询"
,
notes
=
"重点部位分页查询"
)
public
ResponseModel
<
IPage
<
KeySiteDto
>>
queryForPage
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
required
=
false
)
String
name
,
@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
)
{
Page
<
KeySiteDto
>
page
=
new
Page
<
KeySiteDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
keySiteServiceImpl
.
getPageList
(
page
,
name
,
buildingId
,
fireEnduranceRate
,
useNature
,
fireFacilitiesInfo
,
bizOrgCode
));
}
return
ResponseHelper
.
buildResponse
(
keySiteServiceImpl
.
getPageList
(
page
,
name
,
buildingId
,
fireEnduranceRate
,
useNature
,
fireFacilitiesInfo
,
bizOrgCode
));
}
/**
* 列表分页查询
重点部位权限控制,前端页面为studio配置无法控制传参,改为后端控制
* 列表分页查询 重点部位权限控制,前端页面为studio配置无法控制传参,改为后端控制
*
* @param current 当前页
* @param current 每页大小
...
...
@@ -297,20 +340,15 @@ public class KeySiteController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/pageNew"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"重点部位分页查询"
,
notes
=
"重点部位分页查询"
)
public
ResponseModel
<
IPage
<
KeySiteDto
>>
queryForPageNew
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
Long
buildingId
,
@RequestParam
(
required
=
false
)
String
fireEnduranceRate
,
@RequestParam
(
required
=
false
)
String
useNature
,
@RequestParam
(
required
=
false
)
String
fireFacilitiesInfo
,
public
ResponseModel
<
IPage
<
KeySiteDto
>>
queryForPageNew
(
@RequestParam
(
value
=
"current"
)
int
current
,
@RequestParam
(
value
=
"size"
)
int
size
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
Long
buildingId
,
@RequestParam
(
required
=
false
)
String
fireEnduranceRate
,
@RequestParam
(
required
=
false
)
String
useNature
,
@RequestParam
(
required
=
false
)
String
fireFacilitiesInfo
,
@RequestParam
String
bizOrgCode
)
{
Page
<
KeySiteDto
>
page
=
new
Page
<
KeySiteDto
>();
page
.
setCurrent
(
current
);
page
.
setSize
(
size
);
return
ResponseHelper
.
buildResponse
(
keySiteServiceImpl
.
getPageList
(
page
,
name
,
buildingId
,
fireEnduranceRate
,
useNature
,
fireFacilitiesInfo
,
bizOrgCode
));
}
...
...
@@ -319,8 +357,7 @@ public class KeySiteController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/keySiteCountAndBuildingTree"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据登录人角色获取当前单位下的所在建筑的重点部位统计值"
,
notes
=
"根据登录人角色获取当前单位下的所在建筑的重点部位统计值"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
keySiteCountAndBuildingTree
(
@RequestParam
String
bizOrgCode
)
{
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
keySiteCountAndBuildingTree
(
@RequestParam
String
bizOrgCode
)
{
return
ResponseHelper
.
buildResponse
(
keySiteService
.
keySiteCountAndBuildingTree
(
bizOrgCode
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment