Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zhny
Project
Project
Details
Activity
Releases
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
王夏晖
zhny
Commits
30d2059f
Commit
30d2059f
authored
Sep 30, 2018
by
jichao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改bug,增加固定参数功能
parent
7bb2ae3c
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
406 additions
and
68 deletions
+406
-68
MaintenanceController.java
.../device/maintenance/controller/MaintenanceController.java
+2
-2
MaintenanceRepository.java
...usiness/device/maintenance/dao/MaintenanceRepository.java
+2
-2
MaintenanceService.java
...siness/device/maintenance/service/MaintenanceService.java
+1
-1
MaintenanceServiceImpl.java
...vice/maintenance/service/impl/MaintenanceServiceImpl.java
+2
-2
ReportServiceImpl.java
...usiness/device/report/service/impl/ReportServiceImpl.java
+61
-53
BusFixedParamController.java
...t/business/manage/controller/BusFixedParamController.java
+65
-0
BusFixedParamRepository.java
.../rcisoft/business/manage/dao/BusFixedParamRepository.java
+39
-0
BusFixedParam.java
...ava/org/rcisoft/business/manage/entity/BusFixedParam.java
+38
-0
BusFixedParamService.java
...rcisoft/business/manage/service/BusFixedParamService.java
+51
-0
BusFixedParamServiceImpl.java
...usiness/manage/service/impl/BusFixedParamServiceImpl.java
+80
-0
BusFixedParamVo.java
.../java/org/rcisoft/business/manage/vo/BusFixedParamVo.java
+22
-0
SystemController.java
.../rcisoft/business/system/controller/SystemController.java
+2
-2
DeviceParamRepository.java
...rg/rcisoft/business/system/dao/DeviceParamRepository.java
+8
-3
SystemService.java
...va/org/rcisoft/business/system/service/SystemService.java
+1
-1
SystemServiceImpl.java
...isoft/business/system/service/impl/SystemServiceImpl.java
+17
-2
BusFixedParamMapper.xml
...esources/mapper/sys/manage.mapper/BusFixedParamMapper.xml
+15
-0
No files found.
src/main/java/org/rcisoft/business/device/maintenance/controller/MaintenanceController.java
View file @
30d2059f
...
@@ -68,11 +68,11 @@ public class MaintenanceController {
...
@@ -68,11 +68,11 @@ public class MaintenanceController {
@ApiOperation
(
value
=
"查询所有的设备种类"
,
notes
=
"查询所有的设备种类"
)
@ApiOperation
(
value
=
"查询所有的设备种类"
,
notes
=
"查询所有的设备种类"
)
@GetMapping
(
value
=
"/listDeviceCategory"
)
@GetMapping
(
value
=
"/listDeviceCategory"
)
public
Result
listDeviceCategory
()
{
public
Result
listDeviceCategory
(
@RequestParam
String
proId
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
maintenanceService
.
listDeviceCategory
());
maintenanceService
.
listDeviceCategory
(
proId
));
}
}
@ApiOperation
(
value
=
"根据设备种类id查询该种类的设备"
,
notes
=
"根据设备种类id查询该种类的设备"
)
@ApiOperation
(
value
=
"根据设备种类id查询该种类的设备"
,
notes
=
"根据设备种类id查询该种类的设备"
)
...
...
src/main/java/org/rcisoft/business/device/maintenance/dao/MaintenanceRepository.java
View file @
30d2059f
...
@@ -27,8 +27,8 @@ public interface MaintenanceRepository extends BaseMapper<BusDevService> {
...
@@ -27,8 +27,8 @@ public interface MaintenanceRepository extends BaseMapper<BusDevService> {
*
*
* @return the list
* @return the list
*/
*/
@Select
(
"SELECT * FROM
`bus_device_tp`
"
)
@Select
(
"SELECT * FROM
bus_device_tp where PRO_ID=#{proId}
"
)
List
<
Map
<
String
,
Object
>>
listDeviceCategory
();
List
<
Map
<
String
,
Object
>>
listDeviceCategory
(
@Param
(
"proId"
)
String
proId
);
/**
/**
* List device by tp id list.
* List device by tp id list.
...
...
src/main/java/org/rcisoft/business/device/maintenance/service/MaintenanceService.java
View file @
30d2059f
...
@@ -46,7 +46,7 @@ public interface MaintenanceService {
...
@@ -46,7 +46,7 @@ public interface MaintenanceService {
*
*
* @return the list
* @return the list
*/
*/
List
<
Map
<
String
,
Object
>>
listDeviceCategory
();
List
<
Map
<
String
,
Object
>>
listDeviceCategory
(
String
proId
);
/**
/**
* List device by tp id list.
* List device by tp id list.
...
...
src/main/java/org/rcisoft/business/device/maintenance/service/impl/MaintenanceServiceImpl.java
View file @
30d2059f
...
@@ -73,8 +73,8 @@ public class MaintenanceServiceImpl implements MaintenanceService {
...
@@ -73,8 +73,8 @@ public class MaintenanceServiceImpl implements MaintenanceService {
* @return busDeviceTps
* @return busDeviceTps
*/
*/
@Override
@Override
public
List
<
Map
<
String
,
Object
>>
listDeviceCategory
()
{
public
List
<
Map
<
String
,
Object
>>
listDeviceCategory
(
String
proId
)
{
List
<
Map
<
String
,
Object
>>
busDeviceTps
=
maintenanceRepository
.
listDeviceCategory
();
List
<
Map
<
String
,
Object
>>
busDeviceTps
=
maintenanceRepository
.
listDeviceCategory
(
proId
);
return
busDeviceTps
;
return
busDeviceTps
;
}
}
...
...
src/main/java/org/rcisoft/business/device/report/service/impl/ReportServiceImpl.java
View file @
30d2059f
...
@@ -129,59 +129,67 @@ public class ReportServiceImpl implements ReportService {
...
@@ -129,59 +129,67 @@ public class ReportServiceImpl implements ReportService {
//---------------定义excel-----------------------
//---------------定义excel-----------------------
HSSFWorkbook
workbook
=
new
HSSFWorkbook
();
HSSFWorkbook
workbook
=
new
HSSFWorkbook
();
//---------------定义excel-----------------------
//---------------定义excel-----------------------
//循环设备结果集,每个设备创建一个sheet页
if
(
reportVoList
.
size
()
>
0
)
{
reportVoList
.
forEach
(
reportVo
->
{
//循环设备结果集,每个设备创建一个sheet页
//定义sheet
reportVoList
.
forEach
(
reportVo
->
{
HSSFSheet
sheet
=
workbook
.
createSheet
(
reportVo
.
getDevNm
());
//定义sheet
//创建表头
HSSFSheet
sheet
=
workbook
.
createSheet
(
reportVo
.
getDevNm
());
HSSFRow
head
=
sheet
.
createRow
(
0
);
//创建表头
List
<
DeviceVo
>
deviceList
=
reportVo
.
getDeviceList
();
HSSFRow
head
=
sheet
.
createRow
(
0
);
//第一列填时间
List
<
DeviceVo
>
deviceList
=
reportVo
.
getDeviceList
();
head
.
createCell
(
0
,
CellType
.
STRING
).
setCellValue
(
"时间"
);
//第一列填时间
int
size
=
deviceList
.
size
();
head
.
createCell
(
0
,
CellType
.
STRING
).
setCellValue
(
"时间"
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
int
size
=
deviceList
.
size
();
HSSFCell
cell
=
head
.
createCell
(
i
+
1
,
CellType
.
STRING
);
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
//表头填入参数名称
HSSFCell
cell
=
head
.
createCell
(
i
+
1
,
CellType
.
STRING
);
cell
.
setCellValue
(
deviceList
.
get
(
i
).
getParamNm
());
//表头填入参数名称
}
cell
.
setCellValue
(
deviceList
.
get
(
i
).
getParamNm
());
//加入两列,用电量,用气量
}
head
.
createCell
(
size
+
1
,
CellType
.
STRING
).
setCellValue
(
"用电量"
);
//加入两列,用电量,用气量
head
.
createCell
(
size
+
2
,
CellType
.
STRING
).
setCellValue
(
"用气量"
);
head
.
createCell
(
size
+
1
,
CellType
.
STRING
).
setCellValue
(
"用电量"
);
//定义一个增量
head
.
createCell
(
size
+
2
,
CellType
.
STRING
).
setCellValue
(
"用气量"
);
int
x
=
1
;
//定义一个增量
//循环数据
int
x
=
1
;
for
(
int
i
=
0
;
i
<
originalList
.
size
();
i
++)
{
//循环数据
Original
original
=
originalList
.
get
(
i
);
for
(
int
i
=
0
;
i
<
originalList
.
size
();
i
++)
{
String
devNum
=
original
.
getDevNum
();
Original
original
=
originalList
.
get
(
i
);
//判断devNum是否等于当前设备的devNum
String
devNum
=
original
.
getDevNum
();
if
(
StringUtils
.
equals
(
devNum
,
reportVo
.
getDevNum
()))
{
//判断devNum是否等于当前设备的devNum
//第一列放入时间
if
(
StringUtils
.
equals
(
devNum
,
reportVo
.
getDevNum
()))
{
HSSFRow
row
=
sheet
.
createRow
(
x
++);
//第一列放入时间
row
.
createCell
(
0
,
CellType
.
STRING
).
setCellValue
(
original
.
getTm
());
HSSFRow
row
=
sheet
.
createRow
(
x
++);
//设备的参数对象
row
.
createCell
(
0
,
CellType
.
STRING
).
setCellValue
(
original
.
getTm
());
JSONObject
originalJson
=
JSONObject
.
parseObject
(
original
.
getOriginalStr
());
//设备的参数对象
//传感器参数对象
JSONObject
originalJson
=
JSONObject
.
parseObject
(
original
.
getOriginalStr
());
JSONObject
sensorJson
=
JSONObject
.
parseObject
(
original
.
getSensorJson
());
//传感器参数对象
//循环设备
JSONObject
sensorJson
=
JSONObject
.
parseObject
(
original
.
getSensorJson
());
for
(
int
j
=
0
;
j
<
size
;
j
++)
{
//循环设备
DeviceVo
deviceVo
=
deviceList
.
get
(
j
);
for
(
int
j
=
0
;
j
<
size
;
j
++)
{
String
param
=
deviceVo
.
getParam
();
//参数code
DeviceVo
deviceVo
=
deviceList
.
get
(
j
);
String
psource
=
deviceVo
.
getPsource
();
//参数来源,1:设备 2:传感器
String
param
=
deviceVo
.
getParam
();
//参数code
//需要保存的结果
String
psource
=
deviceVo
.
getPsource
();
//参数来源,1:设备 2:传感器
String
res
=
""
;
//需要保存的结果
if
(
psource
.
equals
(
"1"
))
res
=
originalJson
.
get
(
param
)
==
null
?
""
:
originalJson
.
get
(
param
).
toString
();
String
res
=
""
;
else
if
(
psource
.
equals
(
"2"
))
res
=
sensorJson
.
get
(
param
)
==
null
?
""
:
sensorJson
.
get
(
param
).
toString
();
if
(
psource
.
equals
(
"1"
))
res
=
originalJson
.
get
(
param
)
==
null
?
""
:
originalJson
.
get
(
param
).
toString
();
//依次放入行中
else
if
(
psource
.
equals
(
"2"
))
res
=
sensorJson
.
get
(
param
)
==
null
?
""
:
sensorJson
.
get
(
param
).
toString
();
row
.
createCell
(
j
+
1
,
CellType
.
STRING
).
setCellValue
(
res
);
//依次放入行中
}
row
.
createCell
(
j
+
1
,
CellType
.
STRING
).
setCellValue
(
res
);
//放入表具数据
}
row
.
createCell
(
size
+
1
,
CellType
.
STRING
).
setCellValue
(
original
.
getElec
());
//放入表具数据
row
.
createCell
(
size
+
2
,
CellType
.
STRING
).
setCellValue
(
original
.
getGas
());
row
.
createCell
(
size
+
1
,
CellType
.
STRING
).
setCellValue
(
original
.
getElec
());
//用完删除当前行的数据
row
.
createCell
(
size
+
2
,
CellType
.
STRING
).
setCellValue
(
original
.
getGas
());
//用完删除当前行的数据
// originalList.remove(i--);
// originalList.remove(i--);
}
}
}
}
});
});
}
else
{
// 没有数据时,避免报错,添加提示
HSSFSheet
sheet
=
workbook
.
createSheet
(
"sheet1"
);
HSSFRow
head
=
sheet
.
createRow
(
0
);
head
.
createCell
(
0
,
CellType
.
STRING
).
setCellValue
(
"没有数据"
);
}
try
{
try
{
workbook
.
write
(
file
);
workbook
.
write
(
file
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -217,8 +225,8 @@ public class ReportServiceImpl implements ReportService {
...
@@ -217,8 +225,8 @@ public class ReportServiceImpl implements ReportService {
if
(!
StringUtils
.
equals
(
_devNum
,
devNum
)){
if
(!
StringUtils
.
equals
(
_devNum
,
devNum
)){
_devNum
=
devNum
;
_devNum
=
devNum
;
ReportVo
reportVo
=
new
ReportVo
();
ReportVo
reportVo
=
new
ReportVo
();
reportVo
.
setDevNm
(
devNum
);
reportVo
.
setDevNm
(
report
.
getDevNm
()
);
reportVo
.
setDevNum
(
report
.
getDevNum
()
);
reportVo
.
setDevNum
(
devNum
);
//加入新的集合中
//加入新的集合中
reportVoList
.
add
(
reportVo
);
reportVoList
.
add
(
reportVo
);
num
++;
num
++;
...
...
src/main/java/org/rcisoft/business/manage/controller/BusFixedParamController.java
0 → 100644
View file @
30d2059f
package
org
.
rcisoft
.
business
.
manage
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.business.manage.entity.BusFixedParam
;
import
org.rcisoft.business.manage.service.BusFixedParamService
;
import
org.rcisoft.business.manage.vo.BusFixedParamVo
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* Created by JiChao on 2018/9/26.
*/
@Api
(
tags
=
"固定参数"
)
@RestController
@RequestMapping
(
"fixed"
)
public
class
BusFixedParamController
{
@Autowired
private
BusFixedParamService
busFixedParamServiceImpl
;
@ApiOperation
(
value
=
"添加"
,
notes
=
"添加"
)
@PostMapping
(
value
=
"/save"
)
public
Result
save
(
@RequestBody
BusFixedParamVo
busFixedParamVo
)
{
Integer
result
=
busFixedParamServiceImpl
.
save
(
busFixedParamVo
);
return
Result
.
builder
(
new
PersistModel
(
result
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
result
);
}
@ApiOperation
(
value
=
"修改"
,
notes
=
"修改"
)
@PostMapping
(
value
=
"/update"
)
public
Result
update
(
@RequestBody
BusFixedParamVo
busFixedParamVo
)
{
Integer
result
=
busFixedParamServiceImpl
.
update
(
busFixedParamVo
);
return
Result
.
builder
(
new
PersistModel
(
result
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
result
);
}
@ApiOperation
(
value
=
"删除"
,
notes
=
"删除"
)
@PostMapping
(
value
=
"/delete"
)
public
Result
delete
(
@RequestParam
String
devTpId
,
@RequestParam
String
proId
)
{
Integer
result
=
busFixedParamServiceImpl
.
delete
(
devTpId
,
proId
);
return
Result
.
builder
(
new
PersistModel
(
result
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
result
);
}
@ApiOperation
(
value
=
"查询"
,
notes
=
"查询"
)
@PostMapping
(
value
=
"/selectBusFixedParamList"
)
public
Result
selectBusFixedParamList
(
@RequestParam
String
proId
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busFixedParamServiceImpl
.
selectBusFixedParamList
(
proId
));
}
}
src/main/java/org/rcisoft/business/manage/dao/BusFixedParamRepository.java
0 → 100644
View file @
30d2059f
package
org
.
rcisoft
.
business
.
manage
.
dao
;
import
org.apache.ibatis.annotations.*
;
import
org.rcisoft.business.manage.entity.BusFixedParam
;
import
org.springframework.stereotype.Repository
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
/**
* Created with on 2018-5-2 16:09:29.
*/
@Repository
public
interface
BusFixedParamRepository
extends
Mapper
<
BusFixedParam
>
{
/**
* 批量插入
* @param list
* @return
*/
@Insert
(
"<script><foreach collection=\"list\" item=\"item\" separator=\";\">"
+
"insert into bus_fixed_param(ID, DEV_TP_ID, PARAM_CODE, PARAM_NM, PARAM_UNIT, PARAM_VALUE, PRO_ID) "
+
"values(#{item.id}, #{item.devTpId}, #{item.paramCode}, #{item.paramNm}, #{item.paramUnit}, #{item.paramValue}, #{item.proId})"
+
"</foreach></script>"
)
@ResultType
(
Integer
.
class
)
Integer
save
(
List
<
BusFixedParam
>
list
);
/**
* 根据设备编号查询
* @param devNum
* @param proId
* @return
*/
@Select
(
"<script>select f.* from bus_device d, bus_fixed_param f where d.DEV_TP_ID=f.DEV_TP_ID and d.DEV_NUM=#{devNum} and f.PRO_ID=#{proId}</script>"
)
@ResultMap
(
"BaseResultMap"
)
List
<
BusFixedParam
>
queryBusFixedParamList
(
@Param
(
"devNum"
)
String
devNum
,
@Param
(
"proId"
)
String
proId
);
}
src/main/java/org/rcisoft/business/manage/entity/BusFixedParam.java
0 → 100644
View file @
30d2059f
package
org
.
rcisoft
.
business
.
manage
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.math.BigDecimal
;
/**
* Created by JiChao on 2018/9/25.
* 固定参数
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_fixed_param"
)
public
class
BusFixedParam
{
@Id
private
String
id
;
private
String
devTpId
;
private
String
paramCode
;
private
String
paramNm
;
private
String
paramUnit
;
private
BigDecimal
paramValue
;
private
String
proId
;
}
src/main/java/org/rcisoft/business/manage/service/BusFixedParamService.java
0 → 100644
View file @
30d2059f
package
org
.
rcisoft
.
business
.
manage
.
service
;
import
org.rcisoft.business.manage.entity.BusFixedParam
;
import
org.rcisoft.business.manage.vo.BusFixedParamVo
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by JiChao on 2018/9/25.
*/
public
interface
BusFixedParamService
{
/**
* 新增
* @param busFixedParamVo
* @return
*/
Integer
save
(
BusFixedParamVo
busFixedParamVo
);
/**
* 更新:先删除再更新
* @param busFixedParamVo
* @return
*/
Integer
update
(
BusFixedParamVo
busFixedParamVo
);
/**
* 删除
* @param devTpId
* @param proId
* @return
*/
Integer
delete
(
String
devTpId
,
String
proId
);
/**
* 编辑页查询
* @param proId
* @return
*/
List
<
Map
<
String
,
Object
>>
selectBusFixedParamList
(
String
proId
);
/**
* 设备页查询
* @param devNum
* @param proId
* @return
*/
List
<
BusFixedParam
>
queryBusFixedParamList
(
String
devNum
,
String
proId
);
}
src/main/java/org/rcisoft/business/manage/service/impl/BusFixedParamServiceImpl.java
0 → 100644
View file @
30d2059f
package
org
.
rcisoft
.
business
.
manage
.
service
.
impl
;
import
org.rcisoft.business.manage.dao.BusDeviceTpRepository
;
import
org.rcisoft.business.manage.dao.BusFixedParamRepository
;
import
org.rcisoft.business.manage.entity.BusDevicetpParam
;
import
org.rcisoft.business.manage.entity.BusFixedParam
;
import
org.rcisoft.business.manage.service.BusFixedParamService
;
import
org.rcisoft.business.manage.vo.BusFixedParamVo
;
import
org.rcisoft.core.util.IdGen
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by JiChao on 2018/9/25.
*/
@Service
public
class
BusFixedParamServiceImpl
implements
BusFixedParamService
{
@Autowired
private
BusFixedParamRepository
busFixedParamRepository
;
@Autowired
private
BusDeviceTpRepository
busDeviceTpRepository
;
@Transactional
@Override
public
Integer
save
(
BusFixedParamVo
busFixedParamVo
)
{
List
<
BusFixedParam
>
list
=
busFixedParamVo
.
getList
();
String
devTpId
=
busFixedParamVo
.
getDevTpId
();
String
proId
=
busFixedParamVo
.
getProId
();
list
.
forEach
(
busFixedParam
->
{
busFixedParam
.
setId
(
IdGen
.
uuid
());
busFixedParam
.
setDevTpId
(
devTpId
);
busFixedParam
.
setProId
(
proId
);
});
return
busFixedParamRepository
.
save
(
list
);
}
@Transactional
@Override
public
Integer
update
(
BusFixedParamVo
busFixedParamVo
)
{
String
devTpId
=
busFixedParamVo
.
getDevTpId
();
String
proId
=
busFixedParamVo
.
getProId
();
Integer
delete
=
this
.
delete
(
devTpId
,
proId
);
Integer
save
=
this
.
save
(
busFixedParamVo
);
return
save
;
}
@Transactional
@Override
public
Integer
delete
(
String
devTpId
,
String
proId
)
{
Example
example
=
new
Example
(
BusFixedParam
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"devTpId"
,
devTpId
)
.
andEqualTo
(
"proId"
,
proId
);
return
busFixedParamRepository
.
deleteByExample
(
example
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
selectBusFixedParamList
(
String
proId
)
{
List
<
Map
<
String
,
Object
>>
list
=
busDeviceTpRepository
.
queryBusDeviceTps
(
proId
);
for
(
Map
<
String
,
Object
>
tmap
:
list
){
Example
example
=
new
Example
(
BusFixedParam
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"devTpId"
,
tmap
.
get
(
"DEV_TP_ID"
))
.
andEqualTo
(
"proId"
,
proId
);
tmap
.
put
(
"paramList"
,
busFixedParamRepository
.
selectByExample
(
example
));
}
return
list
;
}
@Override
public
List
<
BusFixedParam
>
queryBusFixedParamList
(
String
devNum
,
String
proId
)
{
return
busFixedParamRepository
.
queryBusFixedParamList
(
devNum
,
proId
);
}
}
src/main/java/org/rcisoft/business/manage/vo/BusFixedParamVo.java
0 → 100644
View file @
30d2059f
package
org
.
rcisoft
.
business
.
manage
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.rcisoft.business.manage.entity.BusFixedParam
;
import
java.util.List
;
/**
* Created by JiChao on 2018/9/26.
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
BusFixedParamVo
{
private
List
<
BusFixedParam
>
list
;
private
String
devTpId
;
private
String
proId
;
}
src/main/java/org/rcisoft/business/system/controller/SystemController.java
View file @
30d2059f
...
@@ -87,8 +87,8 @@ public class SystemController {
...
@@ -87,8 +87,8 @@ public class SystemController {
@ApiImplicitParam
(
name
=
"proId"
,
value
=
"项目主键"
,
required
=
true
,
dataType
=
"字符串"
)
@ApiImplicitParam
(
name
=
"proId"
,
value
=
"项目主键"
,
required
=
true
,
dataType
=
"字符串"
)
})
})
@RequestMapping
(
"/selectSensorCode"
)
@RequestMapping
(
"/selectSensorCode"
)
public
Result
selectSensorCode
(
@RequestParam
String
proId
)
{
public
Result
selectSensorCode
(
@RequestParam
String
proId
,
@RequestParam
String
devNum
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
systemServiceImpl
.
selectSensorCode
(
proId
));
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
systemServiceImpl
.
selectSensorCode
(
proId
,
devNum
));
}
}
@ApiOperation
(
value
=
"查询项目下所有设备的信息"
,
notes
=
"通过电流参数判断设备是否开启"
)
@ApiOperation
(
value
=
"查询项目下所有设备的信息"
,
notes
=
"通过电流参数判断设备是否开启"
)
...
...
src/main/java/org/rcisoft/business/system/dao/DeviceParamRepository.java
View file @
30d2059f
...
@@ -22,9 +22,10 @@ public interface DeviceParamRepository {
...
@@ -22,9 +22,10 @@ public interface DeviceParamRepository {
* @param devNum
* @param devNum
* @return
* @return
*/
*/
@Select
(
"<script>select d.PARAM,p.PARAM_NM,p.P_SOURCE,p.P_MIN,p.P_MAX,p.SYMBOL,p.FLAG,p.PARAM_UNIT,d.PARAM_CODE "
+
@Select
(
"<script>select p.PARAM,t.PARAM_NM,t.P_SOURCE,t.P_MIN,t.P_MAX,t.SYMBOL,t.FLAG,t.PARAM_UNIT,t.PARAM_CODE "
+
"from bus_device_param d,bus_devicetp_param p "
+
"from bus_device d left join bus_devicetp_param t on d.DEV_TP_ID=t.DEV_TP_ID "
+
"where d.PARAM_CODE=p.PARAM_CODE and d.DEV_NUM=#{devNum} and p.PRO_ID=#{proId} order by p.PARAM_NM</script>"
)
"left join bus_device_param p on t.PARAM_CODE=p.PARAM_CODE and p.DEV_NUM=#{devNum} "
+
"where d.DEV_NUM=#{devNum} and d.PRO_ID=#{proId} order by t.PARAM_NM</script>"
)
@ResultMap
(
"BaseResultMap"
)
@ResultMap
(
"BaseResultMap"
)
List
<
DeviceParam
>
selectDeviceParamList
(
@Param
(
"devNum"
)
String
devNum
,
@Param
(
"proId"
)
String
proId
);
List
<
DeviceParam
>
selectDeviceParamList
(
@Param
(
"devNum"
)
String
devNum
,
@Param
(
"proId"
)
String
proId
);
...
@@ -32,6 +33,10 @@ public interface DeviceParamRepository {
...
@@ -32,6 +33,10 @@ public interface DeviceParamRepository {
@ResultType
(
String
.
class
)
@ResultType
(
String
.
class
)
String
selectSensorCode
(
@Param
(
"proId"
)
String
proId
);
String
selectSensorCode
(
@Param
(
"proId"
)
String
proId
);
@Select
(
"<script>select MET_NUM power from bus_device_meter where PRO_ID=#{proId} and DEV_NUM=#{devNum}</script>"
)
@ResultType
(
String
.
class
)
String
selectMetNum
(
@Param
(
"proId"
)
String
proId
,
@Param
(
"devNum"
)
String
devNum
);
@Select
(
"<script>SELECT d.DEV_NM devNm,r.DEV_NUM devNum,r.OTHER_PARAM param,d.PRO_ID proId "
+
@Select
(
"<script>SELECT d.DEV_NM devNm,r.DEV_NUM devNum,r.OTHER_PARAM param,d.PRO_ID proId "
+
"FROM bus_device d "
+
"FROM bus_device d "
+
"left join bus_device_meter m on m.DEV_NUM = d.DEV_NUM "
+
"left join bus_device_meter m on m.DEV_NUM = d.DEV_NUM "
+
...
...
src/main/java/org/rcisoft/business/system/service/SystemService.java
View file @
30d2059f
...
@@ -54,7 +54,7 @@ public interface SystemService {
...
@@ -54,7 +54,7 @@ public interface SystemService {
* @param proId
* @param proId
* @return
* @return
*/
*/
String
selectSensorCode
(
String
proId
);
Map
<
String
,
String
>
selectSensorCode
(
String
proId
,
String
devNum
);
/**
/**
* 查询缓存中的数据,10秒钟查询1次
* 查询缓存中的数据,10秒钟查询1次
...
...
src/main/java/org/rcisoft/business/system/service/impl/SystemServiceImpl.java
View file @
30d2059f
...
@@ -14,6 +14,8 @@ import org.rcisoft.business.mainte.adaptive.entity.TotalSensor;
...
@@ -14,6 +14,8 @@ import org.rcisoft.business.mainte.adaptive.entity.TotalSensor;
import
org.rcisoft.business.mainte.adaptive.proenum.ProEnum
;
import
org.rcisoft.business.mainte.adaptive.proenum.ProEnum
;
import
org.rcisoft.business.mainte.adaptive.service.AdaptiveService
;
import
org.rcisoft.business.mainte.adaptive.service.AdaptiveService
;
import
org.rcisoft.business.mainte.adaptive.vo.Params
;
import
org.rcisoft.business.mainte.adaptive.vo.Params
;
import
org.rcisoft.business.manage.entity.BusFixedParam
;
import
org.rcisoft.business.manage.service.BusFixedParamService
;
import
org.rcisoft.business.overview.dao.BusProjectRepository
;
import
org.rcisoft.business.overview.dao.BusProjectRepository
;
import
org.rcisoft.business.overview.dao.EnergyCountMRepository
;
import
org.rcisoft.business.overview.dao.EnergyCountMRepository
;
import
org.rcisoft.business.overview.entity.BusProject
;
import
org.rcisoft.business.overview.entity.BusProject
;
...
@@ -54,6 +56,8 @@ public class SystemServiceImpl implements SystemService {
...
@@ -54,6 +56,8 @@ public class SystemServiceImpl implements SystemService {
private
DeviceParamRepository
deviceParamRepository
;
private
DeviceParamRepository
deviceParamRepository
;
@Autowired
@Autowired
private
RcRedisService
redisServiceImpl
;
private
RcRedisService
redisServiceImpl
;
@Autowired
private
BusFixedParamService
busFixedParamServiceImpl
;
private
String
getCode
(
String
proId
)
{
private
String
getCode
(
String
proId
)
{
BusProject
b
=
new
BusProject
();
BusProject
b
=
new
BusProject
();
...
@@ -161,20 +165,31 @@ public class SystemServiceImpl implements SystemService {
...
@@ -161,20 +165,31 @@ public class SystemServiceImpl implements SystemService {
devParam
=
deviceMap
.
get
(
"devParam"
);
devParam
=
deviceMap
.
get
(
"devParam"
);
proId
=
deviceMap
.
get
(
"proId"
);
proId
=
deviceMap
.
get
(
"proId"
);
}
}
List
<
BusFixedParam
>
fixedList
=
busFixedParamServiceImpl
.
queryBusFixedParamList
(
devNum
,
proId
);
List
<
DeviceParam
>
list
=
deviceParamRepository
.
selectDeviceParamList
(
devNum
,
proId
);
List
<
DeviceParam
>
list
=
deviceParamRepository
.
selectDeviceParamList
(
devNum
,
proId
);
// 如果不为空,需要将devCode截取一下
// 如果不为空,需要将devCode截取一下
if
(
StringUtils
.
isNotEmpty
(
devCode
)
&&
StringUtils
.
isNotEmpty
(
devParam
)
&&
StringUtils
.
isNotEmpty
(
proId
))
if
(
StringUtils
.
isNotEmpty
(
devCode
)
&&
StringUtils
.
isNotEmpty
(
devParam
)
&&
StringUtils
.
isNotEmpty
(
proId
))
devCode
=
devCode
.
split
(
proId
+
"_"
)[
1
];
devCode
=
devCode
.
split
(
proId
+
"_"
)[
1
];
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"data"
,
list
);
result
.
put
(
"data"
,
list
);
result
.
put
(
"fixData"
,
fixedList
);
result
.
put
(
"devCode"
,
devCode
);
result
.
put
(
"devCode"
,
devCode
);
result
.
put
(
"devParam"
,
devParam
);
result
.
put
(
"devParam"
,
devParam
);
return
result
;
return
result
;
}
}
@Override
@Override
public
String
selectSensorCode
(
String
proId
)
{
public
Map
<
String
,
String
>
selectSensorCode
(
String
proId
,
String
devNum
)
{
return
deviceParamRepository
.
selectSensorCode
(
proId
);
String
sensor
=
deviceParamRepository
.
selectSensorCode
(
proId
);
String
power
=
deviceParamRepository
.
selectMetNum
(
proId
,
devNum
);
if
(
StringUtils
.
isNotEmpty
(
power
))
{
power
=
power
.
split
(
proId
+
"_"
)[
1
];
}
// 返回值
Map
<
String
,
String
>
resultMap
=
new
HashMap
<>();
resultMap
.
put
(
"sensor"
,
sensor
);
resultMap
.
put
(
"power"
,
power
);
return
resultMap
;
}
}
@Override
@Override
...
...
src/main/resources/mapper/sys/manage.mapper/BusFixedParamMapper.xml
0 → 100644
View file @
30d2059f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"org.rcisoft.business.manage.dao.BusFixedParamRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.manage.entity.BusFixedParam"
>
<id
column=
"ID"
jdbcType=
"VARCHAR"
property=
"id"
/>
<result
column=
"DEV_TP_ID"
jdbcType=
"VARCHAR"
property=
"devTpId"
/>
<result
column=
"PARAM_CODE"
jdbcType=
"VARCHAR"
property=
"paramCode"
/>
<result
column=
"PARAM_NM"
jdbcType=
"VARCHAR"
property=
"paramNm"
/>
<result
column=
"PARAM_UNIT"
jdbcType=
"VARCHAR"
property=
"paramUnit"
/>
<result
column=
"PARAM_VALUE"
jdbcType=
"VARCHAR"
property=
"paramValue"
/>
<result
column=
"PRO_ID"
jdbcType=
"VARCHAR"
property=
"proId"
/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
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