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
efd7675b
Commit
efd7675b
authored
May 04, 2018
by
王夏晖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目、建筑类型、设备类型、设备和类型模板的后台管理功能
parent
4e7a2d27
Changes
37
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
1114 additions
and
272 deletions
+1114
-272
ZhnyLineRunner.java
src/main/java/org/rcisoft/ZhnyLineRunner.java
+1
-1
BuildTpController.java
...cisoft/business/buildtp/controller/BuildTpController.java
+21
-38
BuildTpRepository.java
...a/org/rcisoft/business/buildtp/dao/BuildTpRepository.java
+4
-2
BuildTp.java
...ain/java/org/rcisoft/business/buildtp/entity/BuildTp.java
+2
-18
BuildTpService.java
.../org/rcisoft/business/buildtp/service/BuildTpService.java
+7
-15
BuildTpServiceImpl.java
...oft/business/buildtp/service/impl/BuildTpServiceImpl.java
+27
-28
BusDeviceTp.java
...isoft/business/device/maintenance/entity/BusDeviceTp.java
+0
-44
BusProject.java
.../rcisoft/business/evaluate/project/entity/BusProject.java
+0
-115
ParamLibraryController.java
...ainte/paramlibrary/controller/ParamLibraryController.java
+14
-4
ParamLibraryRepository.java
...iness/mainte/paramlibrary/dao/ParamLibraryRepository.java
+3
-1
BusParamLibrary.java
.../business/mainte/paramlibrary/entity/BusParamLibrary.java
+44
-0
ParamLibraryService.java
...ness/mainte/paramlibrary/service/ParamLibraryService.java
+5
-0
ParamLibraryServiceImpl.java
...te/paramlibrary/service/impl/ParamLibraryServiceImpl.java
+20
-0
BusParamLibraryList.java
.../business/mainte/paramlibrary/vo/BusParamLibraryList.java
+17
-0
BusDeviceTpController.java
...oft/business/manage/controller/BusDeviceTpController.java
+65
-0
BusDevicetpParamController.java
...usiness/manage/controller/BusDevicetpParamController.java
+92
-0
BusProjectController.java
...soft/business/manage/controller/BusProjectController.java
+79
-0
BusDeviceTpRepository.java
...rg/rcisoft/business/manage/dao/BusDeviceTpRepository.java
+35
-0
BusDevicetpParamRepository.java
...isoft/business/manage/dao/BusDevicetpParamRepository.java
+17
-0
ProjectRepository.java
...va/org/rcisoft/business/manage/dao/ProjectRepository.java
+37
-0
BusDeviceTp.java
.../java/org/rcisoft/business/manage/entity/BusDeviceTp.java
+29
-0
BusDevicetpParam.java
.../org/rcisoft/business/manage/entity/BusDevicetpParam.java
+47
-0
BusProject.java
...n/java/org/rcisoft/business/manage/entity/BusProject.java
+61
-0
BusDeviceTpService.java
...g/rcisoft/business/manage/service/BusDeviceTpService.java
+44
-0
BusDevicetpParamService.java
...soft/business/manage/service/BusDevicetpParamService.java
+28
-0
BusProjectService.java
...rg/rcisoft/business/manage/service/BusProjectService.java
+54
-0
BusDeviceTpServiceImpl.java
.../business/manage/service/impl/BusDeviceTpServiceImpl.java
+83
-0
BusDevicetpParamServiceImpl.java
...ness/manage/service/impl/BusDevicetpParamServiceImpl.java
+80
-0
BusProjectServiceImpl.java
...t/business/manage/service/impl/BusProjectServiceImpl.java
+99
-0
BusDevicetpParamList.java
.../org/rcisoft/business/manage/vo/BusDevicetpParamList.java
+17
-0
TotalOriginal.java
.../rcisoft/business/totaloriginal/entity/TotalOriginal.java
+2
-0
MqttClient.java
src/main/java/org/rcisoft/mqttclient/MqttClient.java
+5
-4
Test.java
src/main/java/org/rcisoft/mqttclient/Test.java
+3
-2
BusParamLibraryMapper.xml
.../sys/mainte.paramlibrary.mapper/BusParamLibraryMapper.xml
+19
-0
BusDeviceTpMapper.xml
...rces/mapper/sys/mainte/fault.mapper/BusDeviceTpMapper.xml
+10
-0
BusDevicetpParamMapper.xml
...mapper/sys/mainte/fault.mapper/BusDevicetpParamMapper.xml
+18
-0
BusProjectMapper.xml
...n/resources/mapper/sys/manage.mapper/BusProjectMapper.xml
+25
-0
No files found.
src/main/java/org/rcisoft/ZhnyLineRunner.java
View file @
efd7675b
...
...
@@ -19,6 +19,6 @@ public class ZhnyLineRunner implements CommandLineRunner {
/*ClientMQTT mqclient = new ClientMQTT();
mqclient.start();*/
MqttClient
client
=
new
MqttClient
(
rcRedisService
,
totalOriginalServiceImpl
);
client
.
start
();
//
client.start();
}
}
src/main/java/org/rcisoft/business/buildtp/controller/BuildTpController.java
View file @
efd7675b
...
...
@@ -19,6 +19,7 @@ import org.springframework.validation.BindingResult;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.List
;
/**
*
...
...
@@ -33,11 +34,9 @@ public class BuildTpController extends PaginationController<BuildTp> {
private
BuildTpService
buildTpServiceImpl
;
@ApiOperation
(
value
=
"添加"
,
notes
=
"添加"
)
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@ApiOperation
(
value
=
"添加建筑类型"
,
notes
=
"添加建筑类型"
)
@PostMapping
(
value
=
"/add"
)
public
Result
add
(
@Valid
BuildTp
buildTp
,
BindingResult
bindingResult
)
{
buildTp
.
setToken
(
getToken
());
public
Result
add
(
@Valid
BuildTp
buildTp
)
{
PersistModel
data
=
buildTpServiceImpl
.
save
(
buildTp
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
...
...
@@ -45,45 +44,29 @@ public class BuildTpController extends PaginationController<BuildTp> {
buildTp
);
}
@ApiOperation
(
value
=
"逻辑删除"
,
notes
=
"逻辑删除"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"id"
,
required
=
false
,
dataType
=
"varchar"
)})
@DeleteMapping
(
"/delete/{id:\\w+}"
)
public
Result
delete
(
@PathVariable
String
id
)
{
BuildTp
buildTp
=
new
BuildTp
();
buildTp
.
setBusinessId
(
id
);
buildTp
.
setToken
(
getToken
());
PersistModel
data
=
buildTpServiceImpl
.
remove
(
buildTp
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
id
);
}
@ApiOperation
(
value
=
"修改"
,
notes
=
"修改"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessId"
,
value
=
"businessId"
,
required
=
false
,
dataType
=
"varchar"
)})
@PutMapping
(
"/update/{id:\\w+}"
)
public
Result
update
(
@Valid
BuildTp
buildTp
,
BindingResult
bindingResult
)
{
buildTp
.
setToken
(
getToken
());
@ApiOperation
(
value
=
"修改建筑类型"
,
notes
=
"修改建筑类型"
)
@PutMapping
(
"/update"
)
public
Result
update
(
@Valid
BuildTp
buildTp
)
{
PersistModel
data
=
buildTpServiceImpl
.
merge
(
buildTp
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
buildTp
);
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
buildTp
);
}
@ApiOperation
(
value
=
"查看单 "
,
notes
=
"查看单 "
)
@GetMapping
(
"/detail/{id:\\w+}"
)
public
Result
detail
(
@PathVariable
String
id
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
buildTpServiceImpl
.
findById
(
id
));
@ApiOperation
(
value
=
"删除建筑类型"
,
notes
=
"删除建筑类型"
)
@PutMapping
(
"/delete"
)
public
Result
delete
(
@Valid
BuildTp
buildTp
)
{
PersistModel
data
=
buildTpServiceImpl
.
delete
(
buildTp
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
buildTp
);
}
@ApiOperation
(
value
=
"查看 集合"
,
notes
=
"查看 集合"
)
@GetMapping
(
value
=
"/queryBuildTpByPagination"
)
public
GridModel
listByPagination
(
BuildTp
buildTp
)
{
buildTpServiceImpl
.
findAllByPagination
(
getPaginationUtility
(),
buildTp
);
return
getGridModelResponse
();
@ApiOperation
(
value
=
"建筑类型列表"
,
notes
=
"建筑类型列表"
)
@GetMapping
(
value
=
"/queryBuildTpList"
)
public
List
<
BuildTp
>
queryBuildTpList
()
{
return
buildTpServiceImpl
.
queryBuildTpList
();
}
}
src/main/java/org/rcisoft/business/buildtp/dao/BuildTpRepository.java
View file @
efd7675b
...
...
@@ -9,6 +9,7 @@ import org.springframework.stereotype.Repository;
import
java.util.List
;
import
java.util.Map
;
/**
* Created with on 2018-4-3 10:11:34.
...
...
@@ -20,9 +21,10 @@ public interface BuildTpRepository extends BaseMapper<BuildTp> {
* 分页查询 buildTp
*
*/
@Select
(
"<script>select * from build_tp where 1=1 "
@Select
(
"<script>select * from bu
s_bu
ild_tp where 1=1 "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BuildTp
>
queryBuildTps
(
BuildTp
buildTp
);
List
<
BuildTp
>
queryBuildTps
();
}
src/main/java/org/rcisoft/business/buildtp/entity/BuildTp.java
View file @
efd7675b
...
...
@@ -16,8 +16,8 @@ import javax.persistence.Table;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"build_tp"
)
public
class
BuildTp
extends
IdNotDataEntity
<
BuildTp
>
{
@Table
(
name
=
"bu
s_bu
ild_tp"
)
public
class
BuildTp
{
...
...
@@ -25,21 +25,5 @@ public class BuildTp extends IdNotDataEntity<BuildTp> {
private
String
bldTpNm
;
public
String
getBldTpId
()
{
return
bldTpId
;
}
public
void
setBldTpId
(
String
bldTpId
)
{
this
.
bldTpId
=
bldTpId
;
}
public
String
getBldTpNm
()
{
return
bldTpNm
;
}
public
void
setBldTpNm
(
String
bldTpNm
)
{
this
.
bldTpNm
=
bldTpNm
;
}
}
src/main/java/org/rcisoft/business/buildtp/service/BuildTpService.java
View file @
efd7675b
...
...
@@ -19,11 +19,11 @@ public interface BuildTpService {
PersistModel
save
(
BuildTp
buildTp
);
/**
* 逻辑删除
* @param buildTp
* @return
*/
PersistModel
remov
e
(
BuildTp
buildTp
);
* 删除
* @param buildTp
* @return
*/
PersistModel
delet
e
(
BuildTp
buildTp
);
/**
* 修改
...
...
@@ -32,20 +32,12 @@ public interface BuildTpService {
*/
PersistModel
merge
(
BuildTp
buildTp
);
/**
* 根据id查询
* @param id
* @return
*/
BuildTp
findById
(
String
id
);
/**
* 分页查询
* @param buildTp
* 分页查询
* @return
*/
List
<
BuildTp
>
findAllByPagination
(
PageUtil
<
BuildTp
>
paginationUtility
,
BuildTp
buildTp
);
List
<
BuildTp
>
queryBuildTpList
();
...
...
src/main/java/org/rcisoft/business/buildtp/service/impl/BuildTpServiceImpl.java
View file @
efd7675b
...
...
@@ -3,6 +3,8 @@ package org.rcisoft.business.buildtp.service.impl;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.manage.dao.ProjectRepository
;
import
org.rcisoft.business.manage.entity.BusProject
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.util.UserUtil
;
...
...
@@ -14,8 +16,12 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
/**
* Created by on 2018-4-3 10:11:34.
...
...
@@ -27,6 +33,8 @@ public class BuildTpServiceImpl implements BuildTpService {
@Autowired
private
BuildTpRepository
buildTpRepository
;
@Autowired
private
ProjectRepository
projectRepository
;
/**
...
...
@@ -37,27 +45,28 @@ public class BuildTpServiceImpl implements BuildTpService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
save
(
BuildTp
buildTp
){
buildTp
.
setBldTpId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
//增加操作
int
line
=
buildTpRepository
.
insertSelective
(
buildTp
);
log
.
info
(
UserUtil
.
getUserInfoProp
(
buildTp
.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"新增了ID为"
+
buildTp
.
getBusinessId
()+
"的信息"
);
return
new
PersistModel
(
line
);
}
/**
* 逻辑删除
* @param buildTp
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
* 删除建筑类型
* @param buildTp
* @return
*/
@Override
public
PersistModel
remove
(
BuildTp
buildTp
){
int
line
=
buildTpRepository
.
logicalDelete
(
buildTp
);
log
.
info
(
UserUtil
.
getUserInfoProp
(
buildTp
.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"逻辑删除了ID为"
+
buildTp
.
getBusinessId
()+
"的信息"
);
public
PersistModel
delete
(
BuildTp
buildTp
)
{
int
line
=
0
;
Example
example
=
new
Example
(
BuildTp
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"bldTpId"
,
buildTp
.
getBldTpId
());
line
=
buildTpRepository
.
deleteByExample
(
example
);
return
new
PersistModel
(
line
);
}
/**
* 修改 buildTp
* @param buildTp
...
...
@@ -66,31 +75,21 @@ public class BuildTpServiceImpl implements BuildTpService {
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
merge
(
BuildTp
buildTp
){
int
line
=
buildTpRepository
.
updateByPrimaryKeySelective
(
buildTp
);
log
.
info
(
UserUtil
.
getUserInfoProp
(
buildTp
.
getToken
(),
UserUtil
.
USER_USERNAME
)+
"修改了ID为"
+
buildTp
.
getBusinessId
()+
"的信息"
);
Example
example
=
new
Example
(
BuildTp
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"bldTpId"
,
buildTp
.
getBldTpId
());
int
line
=
buildTpRepository
.
updateByExampleSelective
(
buildTp
,
example
);
return
new
PersistModel
(
line
);
}
/**
* 根据id查询 buildTp
* @param id
* @return
*/
@Override
public
BuildTp
findById
(
String
id
){
return
buildTpRepository
.
selectByPrimaryKey
(
id
);
}
/**
* 分页查询 buildTp
* @param buildTp
* 设备类型列表,不需要分页
* @return
*/
@Override
public
List
<
BuildTp
>
findAllByPagination
(
PageUtil
<
BuildTp
>
paginationUtility
,
BuildTp
buildTp
){
return
buildTpRepository
.
queryBuildTps
(
buildTp
);
public
List
<
BuildTp
>
queryBuildTpList
(){
return
buildTpRepository
.
queryBuildTps
();
}
}
src/main/java/org/rcisoft/business/device/maintenance/entity/BusDeviceTp.java
deleted
100644 → 0
View file @
4e7a2d27
package
org
.
rcisoft
.
business
.
device
.
maintenance
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
/**
* @author WangXinYu
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_device_tp"
)
public
class
BusDeviceTp
implements
Serializable
{
@Id
private
String
devTpId
;
private
String
devTpNm
;
public
String
getDevTpId
()
{
return
devTpId
;
}
public
void
setDevTpId
(
String
devTpId
)
{
this
.
devTpId
=
devTpId
;
}
public
String
getDevTpNm
()
{
return
devTpNm
;
}
public
void
setDevTpNm
(
String
devTpNm
)
{
this
.
devTpNm
=
devTpNm
;
}
}
src/main/java/org/rcisoft/business/evaluate/project/entity/BusProject.java
deleted
100644 → 0
View file @
4e7a2d27
package
org
.
rcisoft
.
business
.
evaluate
.
project
.
entity
;
import
lombok.*
;
import
org.rcisoft.core.entity.IdNotDataEntity
;
import
javax.persistence.*
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created with on 2018-4-18 15:23:12.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_project"
)
public
class
BusProject
extends
IdNotDataEntity
<
BusProject
>
{
private
String
proId
;
private
String
proNm
;
private
String
bldTpId
;
private
Float
bldArea
;
private
String
bldLocal
;
private
String
bldCoordinate
;
private
String
ownId
;
private
String
teamId
;
private
Float
energyPotential
;
public
String
getProId
()
{
return
proId
;
}
public
void
setProId
(
String
proId
)
{
this
.
proId
=
proId
;
}
public
String
getProNm
()
{
return
proNm
;
}
public
void
setProNm
(
String
proNm
)
{
this
.
proNm
=
proNm
;
}
public
String
getBldTpId
()
{
return
bldTpId
;
}
public
void
setBldTpId
(
String
bldTpId
)
{
this
.
bldTpId
=
bldTpId
;
}
public
Float
getBldArea
()
{
return
bldArea
;
}
public
void
setBldArea
(
Float
bldArea
)
{
this
.
bldArea
=
bldArea
;
}
public
String
getBldLocal
()
{
return
bldLocal
;
}
public
void
setBldLocal
(
String
bldLocal
)
{
this
.
bldLocal
=
bldLocal
;
}
public
String
getBldCoordinate
()
{
return
bldCoordinate
;
}
public
void
setBldCoordinate
(
String
bldCoordinate
)
{
this
.
bldCoordinate
=
bldCoordinate
;
}
public
String
getOwnId
()
{
return
ownId
;
}
public
void
setOwnId
(
String
ownId
)
{
this
.
ownId
=
ownId
;
}
public
String
getTeamId
()
{
return
teamId
;
}
public
void
setTeamId
(
String
teamId
)
{
this
.
teamId
=
teamId
;
}
public
Float
getEnergyPotential
()
{
return
energyPotential
;
}
public
void
setEnergyPotential
(
Float
energyPotential
)
{
this
.
energyPotential
=
energyPotential
;
}
}
src/main/java/org/rcisoft/business/mainte/paramlibrary/controller/ParamLibraryController.java
View file @
efd7675b
...
...
@@ -2,15 +2,14 @@ package org.rcisoft.business.mainte.paramlibrary.controller;
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.business.mainte.paramlibrary.service.ParamLibraryService
;
import
org.rcisoft.business.mainte.paramlibrary.vo.BusParamLibraryList
;
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.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -78,4 +77,15 @@ public class ParamLibraryController {
MessageConstant
.
MESSAGE_ALERT_ERROR
,
paramLibraryService
.
queryParamLibrary
(
map
));
}
@ApiOperation
(
value
=
"添加"
,
notes
=
"添加"
)
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping
(
value
=
"/add"
)
public
Result
add
(
@Valid
BusParamLibraryList
busParamLibraryList
)
{
PersistModel
data
=
paramLibraryService
.
save
(
busParamLibraryList
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busParamLibraryList
);
}
}
src/main/java/org/rcisoft/business/mainte/paramlibrary/dao/ParamLibraryRepository.java
View file @
efd7675b
package
org
.
rcisoft
.
business
.
mainte
.
paramlibrary
.
dao
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.mainte.paramlibrary.entity.BusParamLibrary
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
@Repository
public
interface
ParamLibraryRepository
{
public
interface
ParamLibraryRepository
extends
BaseMapper
<
BusParamLibrary
>
{
/**
* 根据设备编号获取参数库记录参数
* @return
...
...
src/main/java/org/rcisoft/business/mainte/paramlibrary/entity/BusParamLibrary.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
mainte
.
paramlibrary
.
entity
;
import
lombok.*
;
import
javax.persistence.*
;
import
java.math.BigDecimal
;
/**
* Created with on 2018-5-2 16:09:30.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_param_library"
)
public
class
BusParamLibrary
{
@Id
private
Integer
id
;
private
String
devNum
;
private
String
p1
;
private
BigDecimal
p1V
;
private
String
p2
;
private
BigDecimal
p2V
;
private
String
p3
;
private
BigDecimal
p3V
;
private
BigDecimal
power
;
private
BigDecimal
gasSpeed
;
private
String
year
;
}
src/main/java/org/rcisoft/business/mainte/paramlibrary/service/ParamLibraryService.java
View file @
efd7675b
package
org
.
rcisoft
.
business
.
mainte
.
paramlibrary
.
service
;
import
org.rcisoft.business.mainte.paramlibrary.entity.BusParamLibrary
;
import
org.rcisoft.business.mainte.paramlibrary.vo.BusParamLibraryList
;
import
org.rcisoft.core.model.PersistModel
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -14,4 +18,5 @@ public interface ParamLibraryService {
List
<
Map
<
String
,
Object
>>
queryParamLibrary
(
Map
<
String
,
Object
>
map
);
PersistModel
save
(
BusParamLibraryList
busPramLibraryList
);
}
src/main/java/org/rcisoft/business/mainte/paramlibrary/service/impl/ParamLibraryServiceImpl.java
View file @
efd7675b
...
...
@@ -2,7 +2,10 @@ package org.rcisoft.business.mainte.paramlibrary.service.impl;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.mainte.paramlibrary.dao.ParamLibraryRepository
;
import
org.rcisoft.business.mainte.paramlibrary.entity.BusParamLibrary
;
import
org.rcisoft.business.mainte.paramlibrary.service.ParamLibraryService
;
import
org.rcisoft.business.mainte.paramlibrary.vo.BusParamLibraryList
;
import
org.rcisoft.core.model.PersistModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
...
...
@@ -10,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -50,4 +54,20 @@ public class ParamLibraryServiceImpl implements ParamLibraryService {
public
List
<
Map
<
String
,
Object
>>
queryParamLibrary
(
Map
<
String
,
Object
>
map
)
{
return
paramLibraryRepository
.
queryParamLibrary
(
map
);
}
@Override
public
PersistModel
save
(
BusParamLibraryList
busPramLibraryList
)
{
for
(
BusParamLibrary
bp
:
busPramLibraryList
.
getBusParamLibraryList
()){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"dev_num"
,
bp
.
getDevNum
());
map
.
put
(
"p1_v"
,
bp
.
getP1V
());
map
.
put
(
"p2_v"
,
bp
.
getP2V
());
map
.
put
(
"p3_v"
,
bp
.
getP3V
());
map
.
put
(
"year"
,
bp
.
getYear
());
if
(
paramLibraryRepository
.
queryParamLibrary
(
map
)==
null
||
paramLibraryRepository
.
queryParamLibrary
(
map
).
size
()<
1
)
{
paramLibraryRepository
.
insertSelective
(
bp
);
}
}
return
new
PersistModel
(
1
);
}
}
src/main/java/org/rcisoft/business/mainte/paramlibrary/vo/BusParamLibraryList.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
mainte
.
paramlibrary
.
vo
;
import
org.rcisoft.business.mainte.paramlibrary.entity.BusParamLibrary
;
import
java.util.List
;
public
class
BusParamLibraryList
{
private
List
<
BusParamLibrary
>
busParamLibraryList
;
public
List
<
BusParamLibrary
>
getBusParamLibraryList
()
{
return
busParamLibraryList
;
}
public
void
setBusParamLibraryList
(
List
<
BusParamLibrary
>
busParamLibraryList
)
{
this
.
busParamLibraryList
=
busParamLibraryList
;
}
}
src/main/java/org/rcisoft/business/manage/controller/BusDeviceTpController.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
controller
;
/*固定导入*/
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.business.manage.entity.BusDeviceTp
;
import
org.rcisoft.business.manage.service.BusDeviceTpService
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.controller.PaginationController
;
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
javax.validation.Valid
;
import
java.util.List
;
/**
* Created by on 2018-5-2 16:09:29.
*/
@RestController
@RequestMapping
(
"manage/busdevicetp"
)
public
class
BusDeviceTpController
extends
PaginationController
<
BusDeviceTp
>
{
@Autowired
private
BusDeviceTpService
busDeviceTpServiceImpl
;
@ApiOperation
(
value
=
"添加设备类型"
,
notes
=
"添加设备类型"
)
@PostMapping
(
value
=
"/add"
)
public
Result
add
(
@Valid
BusDeviceTp
busDeviceTp
)
{
PersistModel
data
=
busDeviceTpServiceImpl
.
save
(
busDeviceTp
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busDeviceTp
);
}
@ApiOperation
(
value
=
"修改设备类型"
,
notes
=
"修改设备类型"
)
@PutMapping
(
"/update"
)
public
Result
update
(
@Valid
BusDeviceTp
busDeviceTp
)
{
PersistModel
data
=
busDeviceTpServiceImpl
.
merge
(
busDeviceTp
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busDeviceTp
);
}
@ApiOperation
(
value
=
"删除设备类型"
,
notes
=
"删除设备类型"
)
@PutMapping
(
"/delete"
)
public
Result
delete
(
@Valid
BusDeviceTp
busDeviceTp
)
{
PersistModel
data
=
busDeviceTpServiceImpl
.
delete
(
busDeviceTp
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busDeviceTp
);
}
@ApiOperation
(
value
=
"设备类型列表"
,
notes
=
"设备类型列表"
)
@GetMapping
(
value
=
"/queryBusDeviceTpList"
)
public
List
<
BusDeviceTp
>
queryBusDeviceTpList
(
BusDeviceTp
busDeviceTp
)
{
return
busDeviceTpServiceImpl
.
queryBusDeviceTpList
();
}
}
src/main/java/org/rcisoft/business/manage/controller/BusDevicetpParamController.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
controller
;
/*固定导入*/
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.business.manage.entity.BusDevicetpParam
;
import
org.rcisoft.business.manage.service.BusDevicetpParamService
;
import
org.rcisoft.business.manage.vo.BusDevicetpParamList
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.controller.PaginationController
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.result.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
java.util.List
;
/**
* Created by on 2018-5-2 16:09:29.
*/
@RestController
@RequestMapping
(
"manage/busdevicetpparam"
)
public
class
BusDevicetpParamController
extends
PaginationController
<
BusDevicetpParam
>
{
@Autowired
private
BusDevicetpParamService
busDevicetpParamServiceImpl
;
/**
* 批量出入设备类型模板
* @param busDevicetpParamList
* @return
*/
@ApiOperation
(
value
=
"添加设备类型模板"
,
notes
=
"添加设备类型模板"
)
@PostMapping
(
value
=
"/add"
)
public
Result
add
(
@Valid
BusDevicetpParamList
busDevicetpParamList
)
{
PersistModel
data
=
busDevicetpParamServiceImpl
.
save
(
busDevicetpParamList
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busDevicetpParamList
);
}
/**
* 先清空模板,后重新批量新增
* @param busDevicetpParamList
* @return
*/
@ApiOperation
(
value
=
"修改设备类型模板"
,
notes
=
"修改设备类型模板"
)
@PostMapping
(
value
=
"/update"
)
public
Result
update
(
@Valid
BusDevicetpParamList
busDevicetpParamList
)
{
PersistModel
data
=
busDevicetpParamServiceImpl
.
update
(
busDevicetpParamList
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busDevicetpParamList
);
}
/**
* 删除模板
* @return
*/
@ApiOperation
(
value
=
"删除设备类型模板"
,
notes
=
"删除设备类型模板"
)
@PostMapping
(
value
=
"/delete"
)
public
Result
delete
(
@RequestParam
String
devTpId
,
@RequestParam
String
proId
)
{
BusDevicetpParam
bp
=
new
BusDevicetpParam
();
bp
.
setDevTpId
(
devTpId
);
bp
.
setProId
(
proId
);
PersistModel
data
=
busDevicetpParamServiceImpl
.
delete
(
bp
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
null
);
}
/**
* 查询设备类型模板
* @return
*/
@ApiOperation
(
value
=
"查询设备类型模板"
,
notes
=
"查询设备类型模板"
)
@PostMapping
(
value
=
"/query"
)
public
List
<
BusDevicetpParam
>
query
(
@RequestParam
String
devTpId
,
@RequestParam
String
proId
)
{
BusDevicetpParam
bp
=
new
BusDevicetpParam
();
bp
.
setDevTpId
(
devTpId
);
bp
.
setProId
(
proId
);
return
busDevicetpParamServiceImpl
.
queryBusDevicetpParam
(
bp
);
}
}
src/main/java/org/rcisoft/business/manage/controller/BusProjectController.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
controller
;
/*固定导入*/
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.business.manage.entity.BusProject
;
import
org.rcisoft.business.manage.service.BusProjectService
;
import
org.rcisoft.core.constant.MessageConstant
;
import
org.rcisoft.core.controller.PaginationController
;
import
org.rcisoft.core.model.GridModel
;
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
javax.validation.Valid
;
/**
* Created by on 2018-5-2 16:09:30.
*/
@RestController
@RequestMapping
(
"manage/busproject"
)
public
class
BusProjectController
extends
PaginationController
<
BusProject
>
{
@Autowired
private
BusProjectService
busProjectServiceImpl
;
@ApiOperation
(
value
=
"添加"
,
notes
=
"添加"
)
@PostMapping
(
value
=
"/add"
)
public
Result
add
(
@Valid
BusProject
busProject
)
{
PersistModel
data
=
busProjectServiceImpl
.
save
(
busProject
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busProject
);
}
@ApiOperation
(
value
=
"修改"
,
notes
=
"修改"
)
@PutMapping
(
"/update"
)
public
Result
update
(
@Valid
BusProject
busProject
)
{
PersistModel
data
=
busProjectServiceImpl
.
merge
(
busProject
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busProject
);
}
@ApiOperation
(
value
=
"删除项目"
,
notes
=
"删除项目"
)
@PutMapping
(
"/delete"
)
public
Result
delete
(
@RequestParam
String
proId
)
{
BusProject
busProject
=
new
BusProject
();
busProject
.
setProId
(
proId
)
;
PersistModel
data
=
busProjectServiceImpl
.
delete
(
busProject
);
return
Result
.
builder
(
data
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busProject
);
}
@ApiOperation
(
value
=
"查看单 "
,
notes
=
"查看单 "
)
@GetMapping
(
"/detail/{id:\\w+}"
)
public
Result
detail
(
@PathVariable
String
id
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busProjectServiceImpl
.
findById
(
id
));
}
@ApiOperation
(
value
=
"查看 集合"
,
notes
=
"查看 集合"
)
@GetMapping
(
value
=
"/queryBusProjectByPagination"
)
public
GridModel
listByPagination
(
BusProject
busProject
)
{
busProjectServiceImpl
.
findAllByPagination
(
getPaginationUtility
(),
busProject
);
return
getGridModelResponse
();
}
}
src/main/java/org/rcisoft/business/manage/dao/BusDeviceTpRepository.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
dao
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.manage.entity.BusDeviceTp
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created with on 2018-5-2 16:09:29.
*/
@Repository
public
interface
BusDeviceTpRepository
extends
BaseMapper
<
BusDeviceTp
>
{
/**
* 设备类型列表
*
*/
@Select
(
"<script>select * from bus_device_tp where 1=1 "
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BusDeviceTp
>
queryBusDeviceTps
();
/**
* 查看该设备类型是否配置模板
* @return
*/
@Select
(
"<script>select * from bus_devicetp_param where DEV_TP_ID = #{dev_tp_id}"
+
"</script>"
)
List
<
Map
<
String
,
Object
>>
queryBuildTpParam
(
Map
<
String
,
Object
>
map
);
}
src/main/java/org/rcisoft/business/manage/dao/BusDevicetpParamRepository.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
dao
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.manage.entity.BusDevicetpParam
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* Created with on 2018-5-2 16:09:29.
*/
@Repository
public
interface
BusDevicetpParamRepository
extends
BaseMapper
<
BusDevicetpParam
>
{
}
src/main/java/org/rcisoft/business/manage/dao/ProjectRepository.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
dao
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.manage.entity.BusProject
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created with on 2018-5-2 16:09:30.
*/
@Repository
public
interface
ProjectRepository
extends
BaseMapper
<
BusProject
>
{
/**
* 分页查询 busProject
*
*/
@Select
(
"<script>select * from bus_project where 1=1"
+
"<if test =' proId != null '> and pro_id = #{proId}</if>"
+
"</script>"
)
@ResultMap
(
value
=
"BaseResultMap"
)
List
<
BusProject
>
queryBusProjects
(
BusProject
busProject
);
/**
* 查看项目下是否有设备
* @param map
* @return
*/
@Select
(
"<script>select * from bus_device where pro_id = #{pro_id}"
+
"</script>"
)
List
<
Map
<
String
,
Object
>>
queryDeivceByProject
(
Map
<
String
,
Object
>
map
);
}
src/main/java/org/rcisoft/business/manage/entity/BusDeviceTp.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
entity
;
import
lombok.*
;
import
org.rcisoft.core.entity.IdNotDataEntity
;
import
javax.persistence.*
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created with on 2018-5-2 16:09:29.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_device_tp"
)
public
class
BusDeviceTp
{
private
String
devTpId
;
private
String
devTpNm
;
}
src/main/java/org/rcisoft/business/manage/entity/BusDevicetpParam.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
entity
;
import
lombok.*
;
import
org.rcisoft.core.entity.IdNotDataEntity
;
import
javax.persistence.*
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created with on 2018-5-2 16:09:29.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_devicetp_param"
)
public
class
BusDevicetpParam
{
private
String
devTpId
;
private
String
paramCode
;
private
String
pSource
;
private
BigDecimal
pMin
;
private
BigDecimal
pMax
;
private
String
symbol
;
private
String
faultContent
;
private
String
flag
;
private
String
proId
;
private
String
paramNm
;
}
src/main/java/org/rcisoft/business/manage/entity/BusProject.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
entity
;
import
lombok.*
;
import
org.rcisoft.core.entity.IdNotDataEntity
;
import
javax.persistence.*
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created with on 2018-5-2 16:09:30.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_project"
)
public
class
BusProject
{
private
String
proId
;
private
String
proNm
;
private
String
bldTpId
;
private
BigDecimal
bldArea
;
private
String
bldLocal
;
private
String
bldCoordinate
;
private
String
ownId
;
private
String
teamId
;
private
String
jwnum
;
private
String
province
;
private
String
city
;
private
String
code
;
private
Date
createTime
;
private
String
bldZoneId
;
private
Date
bldYear
;
private
Date
deviceYear
;
private
BigDecimal
energyPotential
;
}
src/main/java/org/rcisoft/business/manage/service/BusDeviceTpService.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
service
;
import
org.rcisoft.business.manage.entity.BusDeviceTp
;
import
org.rcisoft.core.model.PersistModel
;
import
java.util.List
;
/**
* Created by on 2018-5-2 16:09:29.
*/
public
interface
BusDeviceTpService
{
/**
* 保存
* @param busDeviceTp
* @return
*/
PersistModel
save
(
BusDeviceTp
busDeviceTp
);
/**
* 删除
* @param busDeviceTp
* @return
*/
PersistModel
delete
(
BusDeviceTp
busDeviceTp
);
/**
* 修改
* @param busDeviceTp
* @return
*/
PersistModel
merge
(
BusDeviceTp
busDeviceTp
);
/**
* 列表
* @return
*/
List
<
BusDeviceTp
>
queryBusDeviceTpList
();
}
src/main/java/org/rcisoft/business/manage/service/BusDevicetpParamService.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
service
;
import
org.rcisoft.business.manage.entity.BusDevicetpParam
;
import
org.rcisoft.business.manage.vo.BusDevicetpParamList
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
java.util.List
;
/**
* Created by on 2018-5-2 16:09:29.
*/
public
interface
BusDevicetpParamService
{
/**
* 保存
* @return
*/
PersistModel
save
(
BusDevicetpParamList
busDevicetpParamList
);
PersistModel
update
(
BusDevicetpParamList
busDevicetpParamList
);
PersistModel
delete
(
BusDevicetpParam
busDevicetpParam
);
List
<
BusDevicetpParam
>
queryBusDevicetpParam
(
BusDevicetpParam
bp
);
}
src/main/java/org/rcisoft/business/manage/service/BusProjectService.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
service
;
import
org.rcisoft.business.manage.entity.BusProject
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
java.util.List
;
/**
* Created by on 2018-5-2 16:09:30.
*/
public
interface
BusProjectService
{
/**
* 保存
* @param busProject
* @return
*/
PersistModel
save
(
BusProject
busProject
);
/**
* 修改
* @param busProject
* @return
*/
PersistModel
merge
(
BusProject
busProject
);
/**
* 删除
* @param busProject
* @return
*/
PersistModel
delete
(
BusProject
busProject
);
/**
* 根据id查询
* @param id
* @return
*/
List
<
BusProject
>
findById
(
String
id
);
/**
* 分页查询
* @param busProject
* @return
*/
List
<
BusProject
>
findAllByPagination
(
PageUtil
<
BusProject
>
paginationUtility
,
BusProject
busProject
);
}
src/main/java/org/rcisoft/business/manage/service/impl/BusDeviceTpServiceImpl.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
service
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.manage.dao.BusDeviceTpRepository
;
import
org.rcisoft.business.manage.entity.BusDeviceTp
;
import
org.rcisoft.business.manage.entity.BusProject
;
import
org.rcisoft.business.manage.service.BusDeviceTpService
;
import
org.rcisoft.core.model.PersistModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
/**
* Created by on 2018-5-2 16:09:29.
*/
@Service
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Slf4j
public
class
BusDeviceTpServiceImpl
implements
BusDeviceTpService
{
@Autowired
private
BusDeviceTpRepository
busDeviceTpRepository
;
/**
* 保存 busDeviceTp
* @param busDeviceTp
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
save
(
BusDeviceTp
busDeviceTp
){
//增加操作
busDeviceTp
.
setDevTpId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
int
line
=
busDeviceTpRepository
.
insertSelective
(
busDeviceTp
);
return
new
PersistModel
(
line
);
}
@Override
public
PersistModel
delete
(
BusDeviceTp
busDeviceTp
)
{
int
line
=
0
;
Example
example
=
new
Example
(
BusDeviceTp
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"devTpId"
,
busDeviceTp
.
getDevTpId
());
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"dev_tp_id"
,
busDeviceTp
.
getDevTpId
());
if
(
busDeviceTpRepository
.
queryBuildTpParam
(
map
)==
null
||
busDeviceTpRepository
.
queryBuildTpParam
(
map
).
size
()<
1
){
line
=
busDeviceTpRepository
.
deleteByExample
(
example
);
}
return
new
PersistModel
(
line
);
}
/**
* 修改 busDeviceTp
* @param busDeviceTp
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
merge
(
BusDeviceTp
busDeviceTp
){
Example
example
=
new
Example
(
BusDeviceTp
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"devTpId"
,
busDeviceTp
.
getDevTpId
());
int
line
=
busDeviceTpRepository
.
updateByExampleSelective
(
busDeviceTp
,
example
);
return
new
PersistModel
(
line
);
}
@Override
public
List
<
BusDeviceTp
>
queryBusDeviceTpList
()
{
return
busDeviceTpRepository
.
queryBusDeviceTps
();
}
}
src/main/java/org/rcisoft/business/manage/service/impl/BusDevicetpParamServiceImpl.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
service
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.manage.dao.BusDevicetpParamRepository
;
import
org.rcisoft.business.manage.entity.BusDeviceTp
;
import
org.rcisoft.business.manage.entity.BusDevicetpParam
;
import
org.rcisoft.business.manage.service.BusDevicetpParamService
;
import
org.rcisoft.business.manage.vo.BusDevicetpParamList
;
import
org.rcisoft.core.model.PersistModel
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by on 2018-5-2 16:09:29.
*/
@Service
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Slf4j
public
class
BusDevicetpParamServiceImpl
implements
BusDevicetpParamService
{
@Autowired
private
BusDevicetpParamRepository
busDevicetpParamRepository
;
/**
* 批量插入设备类型模板
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
save
(
BusDevicetpParamList
busDevicetpParamList
){
int
line
=
0
;
List
<
BusDevicetpParam
>
list
=
busDevicetpParamList
.
getBusDevicetpParamList
();
for
(
BusDevicetpParam
bp
:
list
){
line
=
busDevicetpParamRepository
.
insertSelective
(
bp
);
}
return
new
PersistModel
(
line
);
}
@Override
public
PersistModel
update
(
BusDevicetpParamList
busDevicetpParamList
)
{
PersistModel
data
=
delete
(
busDevicetpParamList
.
getBusDevicetpParamList
().
get
(
0
));
if
(
data
.
isSuccessBySinglePersist
()){
save
(
busDevicetpParamList
);
}
return
new
PersistModel
(
1
);
}
@Override
public
PersistModel
delete
(
BusDevicetpParam
busDevicetpParam
)
{
Example
example
=
new
Example
(
BusDevicetpParam
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"devTpId"
,
busDevicetpParam
.
getDevTpId
());
map
.
put
(
"proId"
,
busDevicetpParam
.
getProId
());
criteria
.
andEqualTo
(
map
);
int
line
=
busDevicetpParamRepository
.
deleteByExample
(
example
);
return
new
PersistModel
(
line
);
}
@Override
public
List
<
BusDevicetpParam
>
queryBusDevicetpParam
(
BusDevicetpParam
bp
)
{
Example
example
=
new
Example
(
BusDevicetpParam
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"devTpId"
,
bp
.
getDevTpId
());
map
.
put
(
"proId"
,
bp
.
getProId
());
criteria
.
andEqualTo
(
map
);
return
busDevicetpParamRepository
.
selectByExample
(
example
);
}
}
src/main/java/org/rcisoft/business/manage/service/impl/BusProjectServiceImpl.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
service
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.manage.entity.BusProject
;
import
org.rcisoft.business.manage.service.BusProjectService
;
import
org.rcisoft.core.aop.PageUtil
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.business.manage.dao.ProjectRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by on 2018-5-2 16:09:30.
*/
@Service
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Slf4j
public
class
BusProjectServiceImpl
implements
BusProjectService
{
@Autowired
private
ProjectRepository
projectRepository
;
/**
* 保存 busProject
* @param busProject
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
save
(
BusProject
busProject
){
busProject
.
setProId
(
busProject
.
getJwnum
());
int
line
=
projectRepository
.
insertSelective
(
busProject
);
return
new
PersistModel
(
line
);
}
/**
* 修改 busProject
* @param busProject
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
PersistModel
merge
(
BusProject
busProject
){
Example
example
=
new
Example
(
BusProject
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"proId"
,
busProject
.
getProId
());
int
line
=
projectRepository
.
updateByExampleSelective
(
busProject
,
example
);
return
new
PersistModel
(
line
);
}
@Override
public
PersistModel
delete
(
BusProject
busProject
)
{
int
line
=
0
;
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"pro_id"
,
busProject
.
getProId
());
//项目下没有关联的设备,可以删除
if
(
projectRepository
.
queryDeivceByProject
(
map
)==
null
||
projectRepository
.
queryDeivceByProject
(
map
).
size
()<
1
){
Example
example
=
new
Example
(
BusProject
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"proId"
,
busProject
.
getProId
());
line
=
projectRepository
.
deleteByExample
(
example
);
}
else
{
log
.
info
(
"项目下有关联设备,无法删除"
);
}
return
new
PersistModel
(
line
);
}
/**
* 根据id查询 busProject
* @param id
* @return
*/
public
List
<
BusProject
>
findById
(
String
id
){
BusProject
bus
=
new
BusProject
();
bus
.
setProId
(
id
);
return
projectRepository
.
queryBusProjects
(
bus
);
}
/**
* 分页查询 busProject
* @param busProject
* @return
*/
public
List
<
BusProject
>
findAllByPagination
(
PageUtil
<
BusProject
>
paginationUtility
,
BusProject
busProject
){
return
projectRepository
.
queryBusProjects
(
busProject
);
}
}
src/main/java/org/rcisoft/business/manage/vo/BusDevicetpParamList.java
0 → 100644
View file @
efd7675b
package
org
.
rcisoft
.
business
.
manage
.
vo
;
import
org.rcisoft.business.manage.entity.BusDevicetpParam
;
import
java.util.List
;
public
class
BusDevicetpParamList
{
private
List
<
BusDevicetpParam
>
busDevicetpParamList
;
public
List
<
BusDevicetpParam
>
getBusDevicetpParamList
()
{
return
busDevicetpParamList
;
}
public
void
setBusDevicetpParamList
(
List
<
BusDevicetpParam
>
busDevicetpParamList
)
{
this
.
busDevicetpParamList
=
busDevicetpParamList
;
}
}
src/main/java/org/rcisoft/business/totaloriginal/entity/TotalOriginal.java
View file @
efd7675b
...
...
@@ -109,5 +109,7 @@ public class TotalOriginal{
private
Float
p19V
;
private
Float
p20V
;
private
String
originalStr
;
}
src/main/java/org/rcisoft/mqttclient/MqttClient.java
View file @
efd7675b
...
...
@@ -41,8 +41,8 @@ public class MqttClient {
map
.
put
(
"pro_id"
,
jwnum
);
referMap
=
totalService
.
queryBusParamRefer
(
map
);
devStr
=
totalService
.
queryDevByPro
(
jwnum
);
//
String time = jb.getString("TIME");//时间
String
time
=
DateUtil
.
getSimepleDate
(
"yyyyMMddHHmmss"
,
new
Date
());
String
time
=
jb
.
getString
(
"TIME"
);
//时间
//
String time = DateUtil.getSimepleDate("yyyyMMddHHmmss",new Date());
if
(
DateUtil
.
getParseDate
(
"yyyyMMddhhmmss"
,
time
)!=
null
){
//时间格式正常
String
minute
=
time
.
substring
(
10
,
12
);
String
sec
=
time
.
substring
(
12
,
14
);
...
...
@@ -55,7 +55,7 @@ public class MqttClient {
//rcRedisService.set("new","new"+new Date() + content);
}
System
.
out
.
println
(
"++++++++++++++++++++++++++++++++++"
+
minute
+
"-----"
+
sec
);
if
(
Integer
.
parseInt
(
minute
)%
2
==
0
&&
sec
.
equalsIgnoreCase
(
"00"
)){
//10分钟级的数据,进行存储
if
(
Integer
.
parseInt
(
minute
)%
10
==
0
&&
sec
.
equalsIgnoreCase
(
"00"
)){
//10分钟级的数据,进行存储
List
<
String
>
list
=
new
ArrayList
<
String
>();
JSONObject
jbody
=
jb
.
getJSONObject
(
"body"
);
//数据体
List
<
TotalOriginal
>
originalList
=
new
ArrayList
<>();
...
...
@@ -71,6 +71,7 @@ public class MqttClient {
original
.
setProId
(
jwnum
);
original
.
setTm
(
DateUtil
.
getParseDate
(
"yyyyMMddHHmmss"
,
time
));
original
.
setDevNum
(
dev_num
);
original
.
setOriginalStr
(
body
.
toJSONString
());
/**
* 摘选水电气能耗,对于设备来说,都为null
*/
...
...
@@ -160,7 +161,7 @@ public class MqttClient {
MQTT
mqtt
=
new
MQTT
();
//MQTT设置说明
mqtt
.
setHost
(
"tcp://1
06.2.3.135
:1883"
);
mqtt
.
setHost
(
"tcp://1
20.52.179.76
:1883"
);
mqtt
.
setClientId
(
"876543210"
);
//用于设置客户端会话的ID。在setCleanSession(false);被调用时,MQTT服务器利用该ID获得相应的会话。此ID应少于23个字符,默认根据本机地址、端口和时间自动生成
mqtt
.
setCleanSession
(
false
);
//若设为false,MQTT服务器将持久化客户端会话的主体订阅和ACK位置,默认为true
mqtt
.
setKeepAlive
((
short
)
60
);
//定义客户端传来消息的最大时间间隔秒数,服务器可以据此判断与客户端的连接是否已经断开,从而避免TCP/IP超时的长时间等待
...
...
src/main/java/org/rcisoft/mqttclient/Test.java
View file @
efd7675b
...
...
@@ -12,11 +12,12 @@ import java.util.*;
public
class
Test
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
SimpleDateFormat
simple
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
/*
SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(simple.format(new Date()).substring(0,4));
System.out.println(ZhnyUtil.isNumeric("3.6"));
String param = "sensor_01";
System
.
out
.
println
(
param
.
substring
(
param
.
indexOf
(
"_"
),
param
.
length
()));
System.out.println(param.substring(param.indexOf("_"),param.length()));*/
System
.
out
.
println
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
}
}
...
...
src/main/resources/mapper/sys/mainte.paramlibrary.mapper/BusParamLibraryMapper.xml
0 → 100644
View file @
efd7675b
<?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.mainte.paramlibrary.dao.ParamLibraryRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.mainte.paramlibrary.entity.BusParamLibrary"
>
<id
column=
"ID"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"DEV_NUM"
jdbcType=
"VARCHAR"
property=
"devNum"
/>
<result
column=
"P1"
jdbcType=
"VARCHAR"
property=
"p1"
/>
<result
column=
"P1_V"
jdbcType=
"DECIMAL"
property=
"p1V"
/>
<result
column=
"P2"
jdbcType=
"VARCHAR"
property=
"p2"
/>
<result
column=
"P2_V"
jdbcType=
"DECIMAL"
property=
"p2V"
/>
<result
column=
"P3"
jdbcType=
"VARCHAR"
property=
"p3"
/>
<result
column=
"P3_V"
jdbcType=
"DECIMAL"
property=
"p3V"
/>
<result
column=
"POWER"
jdbcType=
"DECIMAL"
property=
"power"
/>
<result
column=
"GAS_SPEED"
jdbcType=
"DECIMAL"
property=
"gasSpeed"
/>
<result
column=
"YEAR"
jdbcType=
"VARCHAR"
property=
"year"
/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
src/main/resources/mapper/sys/mainte/fault.mapper/BusDeviceTpMapper.xml
0 → 100644
View file @
efd7675b
<?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.BusDeviceTpRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.manage.entity.BusDeviceTp"
>
<id
column=
"DEV_TP_ID"
jdbcType=
"VARCHAR"
property=
"devTpId"
/>
<result
column=
"DEV_TP_NM"
jdbcType=
"VARCHAR"
property=
"devTpNm"
/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
src/main/resources/mapper/sys/mainte/fault.mapper/BusDevicetpParamMapper.xml
0 → 100644
View file @
efd7675b
<?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.BusDevicetpParamRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.manage.entity.BusDevicetpParam"
>
<id
column=
"DEV_TP_ID"
jdbcType=
"VARCHAR"
property=
"devTpId"
/>
<id
column=
"PARAM_CODE"
jdbcType=
"VARCHAR"
property=
"paramCode"
/>
<result
column=
"P_SOURCE"
jdbcType=
"CHAR"
property=
"pSource"
/>
<result
column=
"P_MIN"
jdbcType=
"DECIMAL"
property=
"pMin"
/>
<result
column=
"P_MAX"
jdbcType=
"DECIMAL"
property=
"pMax"
/>
<result
column=
"SYMBOL"
jdbcType=
"VARCHAR"
property=
"symbol"
/>
<result
column=
"FAULT_CONTENT"
jdbcType=
"VARCHAR"
property=
"faultContent"
/>
<result
column=
"FLAG"
jdbcType=
"CHAR"
property=
"flag"
/>
<result
column=
"PRO_ID"
jdbcType=
"VARCHAR"
property=
"proId"
/>
<result
column=
"PARAM_NM"
jdbcType=
"VARCHAR"
property=
"paramNm"
/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
src/main/resources/mapper/sys/manage.mapper/BusProjectMapper.xml
0 → 100644
View file @
efd7675b
<?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.ProjectRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.manage.entity.BusProject"
>
<id
column=
"PRO_ID"
jdbcType=
"VARCHAR"
property=
"proId"
/>
<result
column=
"PRO_NM"
jdbcType=
"VARCHAR"
property=
"proNm"
/>
<result
column=
"BLD_TP_ID"
jdbcType=
"VARCHAR"
property=
"bldTpId"
/>
<result
column=
"BLD_AREA"
jdbcType=
"DECIMAL"
property=
"bldArea"
/>
<result
column=
"BLD_LOCAL"
jdbcType=
"VARCHAR"
property=
"bldLocal"
/>
<result
column=
"BLD_COORDINATE"
jdbcType=
"VARCHAR"
property=
"bldCoordinate"
/>
<result
column=
"OWN_ID"
jdbcType=
"VARCHAR"
property=
"ownId"
/>
<result
column=
"TEAM_ID"
jdbcType=
"VARCHAR"
property=
"teamId"
/>
<result
column=
"JWNUM"
jdbcType=
"VARCHAR"
property=
"jwnum"
/>
<result
column=
"PROVINCE"
jdbcType=
"VARCHAR"
property=
"province"
/>
<result
column=
"CITY"
jdbcType=
"VARCHAR"
property=
"city"
/>
<result
column=
"CODE"
jdbcType=
"VARCHAR"
property=
"code"
/>
<result
column=
"CREATE_TIME"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"BLD_ZONE_ID"
jdbcType=
"VARCHAR"
property=
"bldZoneId"
/>
<result
column=
"BLD_YEAR"
jdbcType=
"TIMESTAMP"
property=
"bldYear"
/>
<result
column=
"DEVICE_YEAR"
jdbcType=
"TIMESTAMP"
property=
"deviceYear"
/>
<result
column=
"ENERGY_POTENTIAL"
jdbcType=
"DECIMAL"
property=
"energyPotential"
/>
</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