Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
1bc40a6f
Commit
1bc40a6f
authored
Jun 16, 2020
by
单奇雲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
a72a725a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
114 additions
and
1 deletion
+114
-1
FireSourceController.java
...in/amos/fas/business/controller/FireSourceController.java
+8
-1
FireStationController.java
...n/amos/fas/business/controller/FireStationController.java
+7
-0
WeatherController.java
...ejoin/amos/fas/business/controller/WeatherController.java
+78
-0
IFireEquipmentDao.java
...n/amos/fas/business/dao/repository/IFireEquipmentDao.java
+2
-0
IFireStationDao.java
...oin/amos/fas/business/dao/repository/IFireStationDao.java
+2
-0
FireEquipServiceImpl.java
.../amos/fas/business/service/impl/FireEquipServiceImpl.java
+7
-0
FireStationServiceImpl.java
...mos/fas/business/service/impl/FireStationServiceImpl.java
+6
-0
IFireEquipService.java
...in/amos/fas/business/service/intfc/IFireEquipService.java
+2
-0
IFireStationService.java
.../amos/fas/business/service/intfc/IFireStationService.java
+2
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/FireSourceController.java
View file @
1bc40a6f
...
@@ -39,6 +39,13 @@ public class FireSourceController extends BaseController {
...
@@ -39,6 +39,13 @@ public class FireSourceController extends BaseController {
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"添加消防装备"
,
notes
=
"添加消防装备"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"添加消防装备"
,
notes
=
"添加消防装备"
)
@RequestMapping
(
value
=
""
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
""
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
POST
)
public
CommonResponse
create
(
@RequestBody
FireEquipment
fireEquipment
)
throws
Exception
{
public
CommonResponse
create
(
@RequestBody
FireEquipment
fireEquipment
)
throws
Exception
{
if
(
fireEquipment
.
getId
()
==
0
l
)
{
//新增
Boolean
existByCode
=
iFireEquipService
.
isExistByCode
(
fireEquipment
.
getCode
());
if
(
existByCode
){
return
CommonResponseUtil
.
failure
(
"设备编号重复,请重试!"
);
}
}
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
compCode
=
getOrgCode
(
reginParams
);
String
compCode
=
getOrgCode
(
reginParams
);
fireEquipment
.
setCreateBy
(
getUserId
());
fireEquipment
.
setCreateBy
(
getUserId
());
...
@@ -62,7 +69,7 @@ public class FireSourceController extends BaseController {
...
@@ -62,7 +69,7 @@ public class FireSourceController extends BaseController {
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询单个消防装备"
,
notes
=
"查询单个消防装备"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"查询单个消防装备"
,
notes
=
"查询单个消防装备"
)
@RequestMapping
(
value
=
"/{id}"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
query
(
@PathVariable
Long
id
)
{
public
CommonResponse
query
(
@PathVariable
Long
id
)
{
FireEquipment
queryOne
=
iFireEquipService
.
queryOne
(
id
);
return
CommonResponseUtil
.
success
(
iFireEquipService
.
queryOne
(
id
));
return
CommonResponseUtil
.
success
(
iFireEquipService
.
queryOne
(
id
));
}
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/FireStationController.java
View file @
1bc40a6f
...
@@ -139,6 +139,13 @@ public class FireStationController extends BaseController {
...
@@ -139,6 +139,13 @@ public class FireStationController extends BaseController {
// || StringUtils.isEmpty(fireStation.getPosition3d())
// || StringUtils.isEmpty(fireStation.getPosition3d())
||
StringUtils
.
isEmpty
(
fireStation
.
getCode
()))
||
StringUtils
.
isEmpty
(
fireStation
.
getCode
()))
throw
new
Exception
(
"数据校验失败."
);
throw
new
Exception
(
"数据校验失败."
);
long
id
=
fireStation
.
getId
();
if
(
id
==
0
l
)
{
//新增
Boolean
existByCode
=
iFireStationService
.
isExistByCode
(
fireStation
.
getCode
());
if
(
existByCode
)
{
throw
new
Exception
(
"改编号已存在,请重试!"
);
}
}
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
compCode
=
getOrgCode
(
reginParams
);
String
compCode
=
getOrgCode
(
reginParams
);
fireStation
.
setCreateBy
(
getUserId
());
fireStation
.
setCreateBy
(
getUserId
());
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/WeatherController.java
0 → 100644
View file @
1bc40a6f
package
com
.
yeejoin
.
amos
.
fas
.
business
.
controller
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSONObject
;
import
com.itextpdf.text.pdf.PdfStructTreeController.returnType
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@RestController
@RequestMapping
(
"/api/weather"
)
@Api
(
tags
=
"天气api"
)
public
class
WeatherController
extends
BaseController
{
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"天气查询"
,
notes
=
"天气查询"
)
@GetMapping
(
"/{address}"
)
public
CommonResponse
getWeather
(
@PathVariable
(
"address"
)
String
address
)
{
String
result
=
""
;
BufferedReader
in
=
null
;
try
{
String
urlNameString
=
"http://t.weather.sojson.com/api/weather/city/"
+
address
;
URL
realUrl
=
new
URL
(
urlNameString
);
// 打开和URL之间的连接
URLConnection
connection
=
realUrl
.
openConnection
();
// 设置通用的请求属性
connection
.
setRequestProperty
(
"accept"
,
"*/*"
);
connection
.
setRequestProperty
(
"connection"
,
"Keep-Alive"
);
connection
.
setRequestProperty
(
"user-agent"
,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"
);
// 建立实际的连接
connection
.
connect
();
// 获取所有响应头字段
Map
<
String
,
List
<
String
>>
map
=
connection
.
getHeaderFields
();
// 定义 BufferedReader输入流来读取URL的响应
in
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
+=
line
;
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"发送GET请求出现异常!"
+
e
);
return
CommonResponseUtil
.
failure
(
e
.
getCause
().
toString
());
}
// 使用finally块来关闭输入流
finally
{
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
}
}
return
CommonResponseUtil
.
success
(
JSONObject
.
parse
(
result
));
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IFireEquipmentDao.java
View file @
1bc40a6f
...
@@ -18,4 +18,6 @@ public interface IFireEquipmentDao extends BaseDao<FireEquipment, Long> {
...
@@ -18,4 +18,6 @@ public interface IFireEquipmentDao extends BaseDao<FireEquipment, Long> {
@Query
(
value
=
"SELECT count(1) FROM `f_fire_station_equipment` WHERE fire_equipment_id in ?1"
,
nativeQuery
=
true
)
@Query
(
value
=
"SELECT count(1) FROM `f_fire_station_equipment` WHERE fire_equipment_id in ?1"
,
nativeQuery
=
true
)
int
countAssociatedEquipStationByIds
(
String
[]
ids
);
int
countAssociatedEquipStationByIds
(
String
[]
ids
);
Optional
<
FireEquipment
>
findByCode
(
String
code
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/IFireStationDao.java
View file @
1bc40a6f
...
@@ -10,4 +10,6 @@ import com.yeejoin.amos.fas.dao.entity.FireStation;
...
@@ -10,4 +10,6 @@ import com.yeejoin.amos.fas.dao.entity.FireStation;
public
interface
IFireStationDao
extends
BaseDao
<
FireStation
,
Long
>
{
public
interface
IFireStationDao
extends
BaseDao
<
FireStation
,
Long
>
{
Optional
<
FireStation
>
findById
(
Long
id
);
Optional
<
FireStation
>
findById
(
Long
id
);
Optional
<
FireStation
>
findByCode
(
String
code
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/FireEquipServiceImpl.java
View file @
1bc40a6f
...
@@ -193,4 +193,11 @@ public class FireEquipServiceImpl implements IFireEquipService {
...
@@ -193,4 +193,11 @@ public class FireEquipServiceImpl implements IFireEquipService {
public
int
countAssociatedEquipStationByIds
(
String
[]
ids
)
{
public
int
countAssociatedEquipStationByIds
(
String
[]
ids
)
{
return
iFireEquipmentDao
.
countAssociatedEquipStationByIds
(
ids
);
return
iFireEquipmentDao
.
countAssociatedEquipStationByIds
(
ids
);
}
}
@Override
public
Boolean
isExistByCode
(
String
code
)
{
Optional
<
FireEquipment
>
optional
=
iFireEquipmentDao
.
findByCode
(
code
);
return
optional
.
isPresent
();
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/FireStationServiceImpl.java
View file @
1bc40a6f
...
@@ -203,4 +203,10 @@ public class FireStationServiceImpl implements IFireStationService {
...
@@ -203,4 +203,10 @@ public class FireStationServiceImpl implements IFireStationService {
return
result
;
return
result
;
}
}
@Override
public
Boolean
isExistByCode
(
String
code
)
{
Optional
<
FireStation
>
optional
=
iFireStationDao
.
findByCode
(
code
);
return
optional
.
isPresent
();
}
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IFireEquipService.java
View file @
1bc40a6f
...
@@ -46,4 +46,6 @@ public interface IFireEquipService {
...
@@ -46,4 +46,6 @@ public interface IFireEquipService {
* @return
* @return
*/
*/
int
countAssociatedEquipStationByIds
(
String
[]
ids
);
int
countAssociatedEquipStationByIds
(
String
[]
ids
);
Boolean
isExistByCode
(
String
code
);
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IFireStationService.java
View file @
1bc40a6f
...
@@ -72,4 +72,6 @@ public interface IFireStationService {
...
@@ -72,4 +72,6 @@ public interface IFireStationService {
*/
*/
Map
queryForEuqimentListById
(
Long
id
);
Map
queryForEuqimentListById
(
Long
id
);
Boolean
isExistByCode
(
String
code
);
}
}
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