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
bfb9f430
Commit
bfb9f430
authored
Apr 18, 2018
by
gaoliwei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
ssh://103.249.252.28:10022/wangxiahui/zhny
into develop
parents
04491f4a
970cc8a4
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
274 additions
and
4 deletions
+274
-4
BusDeviceFaultController.java
...ess/mainte/fault/controller/BusDeviceFaultController.java
+46
-0
BusDeviceFaultRepository.java
...t/business/mainte/fault/dao/BusDeviceFaultRepository.java
+39
-0
BusDeviceFault.java
.../rcisoft/business/mainte/fault/entity/BusDeviceFault.java
+39
-0
BusDeviceFaultService.java
.../business/mainte/fault/service/BusDeviceFaultService.java
+31
-0
BusDeviceFaultServiceImpl.java
.../mainte/fault/service/impl/BusDeviceFaultServiceImpl.java
+60
-0
BusDeviceFaultVo.java
...rg/rcisoft/business/mainte/fault/vo/BusDeviceFaultVo.java
+28
-0
EnergyCountMRepository.java
...rcisoft/business/overview/dao/EnergyCountMRepository.java
+2
-2
EnergyCountM.java
...va/org/rcisoft/business/overview/entity/EnergyCountM.java
+1
-1
BusDeviceFaultMapper.xml
...s/mapper/sys/mainte/fault.mapper/BusDeviceFaultMapper.xml
+27
-0
EnergyCountMMapper.xml
...sources/mapper/sys/overview.mapper/EnergyCountMMapper.xml
+1
-1
No files found.
src/main/java/org/rcisoft/business/mainte/fault/controller/BusDeviceFaultController.java
0 → 100644
View file @
bfb9f430
package
org
.
rcisoft
.
business
.
mainte
.
fault
.
controller
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.business.mainte.fault.entity.BusDeviceFault
;
import
org.rcisoft.business.mainte.fault.service.BusDeviceFaultService
;
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
org.rcisoft.core.controller.PaginationController
;
/**
* Created by on 2018-4-17 11:19:46.
*/
@RestController
@RequestMapping
(
"busdevicefault"
)
public
class
BusDeviceFaultController
extends
PaginationController
<
BusDeviceFault
>
{
@Autowired
private
BusDeviceFaultService
busDeviceFaultServiceImpl
;
@ApiOperation
(
value
=
"故障次数"
,
notes
=
"返回日期、次数的json数组"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"proId"
,
value
=
"项目类型主键"
,
required
=
true
,
dataType
=
"字符串"
),
@ApiImplicitParam
(
name
=
"year"
,
value
=
"年份,如:2018"
,
required
=
true
,
dataType
=
"字符串或数字"
),
@ApiImplicitParam
(
name
=
"month"
,
value
=
"月份,如:6"
,
required
=
true
,
dataType
=
"字符串或数字"
)
})
@RequestMapping
(
"/statFault"
)
public
Result
statFault
(
@RequestParam
String
proId
,
@RequestParam
String
year
,
@RequestParam
String
month
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busDeviceFaultServiceImpl
.
statFault
(
proId
,
year
,
month
));
}
@ApiOperation
(
value
=
"故障统计列表"
,
notes
=
"返回 时间、系统名称、设备名称、参数名称、故障内容"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"proId"
,
value
=
"项目类型主键"
,
required
=
true
,
dataType
=
"字符串"
),
@ApiImplicitParam
(
name
=
"year"
,
value
=
"年份,如:2018"
,
required
=
true
,
dataType
=
"字符串或数字"
),
@ApiImplicitParam
(
name
=
"month"
,
value
=
"月份,如:6"
,
required
=
true
,
dataType
=
"字符串或数字"
)
})
@RequestMapping
(
"/queryFaultList"
)
public
Result
queryFaultList
(
@RequestParam
String
proId
,
@RequestParam
String
year
,
@RequestParam
String
month
)
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busDeviceFaultServiceImpl
.
queryFaultList
(
proId
,
year
,
month
));
}
}
src/main/java/org/rcisoft/business/mainte/fault/dao/BusDeviceFaultRepository.java
0 → 100644
View file @
bfb9f430
package
org
.
rcisoft
.
business
.
mainte
.
fault
.
dao
;
import
org.apache.ibatis.annotations.ResultMap
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.mainte.fault.entity.BusDeviceFault
;
import
org.rcisoft.business.mainte.fault.vo.BusDeviceFaultVo
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* Created with on 2018-4-17 11:19:46.
*/
@Repository
public
interface
BusDeviceFaultRepository
extends
BaseMapper
<
BusDeviceFault
>
{
/**
* 故障次数
* @param busDeviceFaultVo
* @return 日期,次数的list
*/
@Select
(
"<script>select date_format(b.TM,'%e') `day`,count(*) NUM from bus_device_fault b where b.PRO_ID=#{proId} and date_format(b.TM,'%Y-%c')=#{date} group by date_format(b.TM,'%e')</script>"
)
@ResultMap
(
value
=
"vo"
)
List
<
BusDeviceFaultVo
>
statFault
(
BusDeviceFaultVo
busDeviceFaultVo
);
/**
* 故障统计列表
* @param busDeviceFaultVo
* @return
*/
@Select
(
"<script>select date_format(f.TM,'%Y-%m-%d') `DATE`,f.CONTENT,d.DEV_NM,s.SYS_NM,p.PARAM_NM "
+
"from bus_device_fault f,bus_device d,bus_param p,bus_system s "
+
"where f.DEV_NUM=d.DEV_NUM and d.SYS_ID=s.SYS_ID and f.P_CODE=p.PARAM "
+
"and f.PRO_ID=#{proId} and date_format(f.TM,'%Y-%c')=#{date}</script>"
)
@ResultMap
(
value
=
"faultList"
)
List
<
BusDeviceFaultVo
>
queryFaultList
(
BusDeviceFaultVo
busDeviceFaultVo
);
}
src/main/java/org/rcisoft/business/mainte/fault/entity/BusDeviceFault.java
0 → 100644
View file @
bfb9f430
package
org
.
rcisoft
.
business
.
mainte
.
fault
.
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-17 11:19:46.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_device_fault"
)
public
class
BusDeviceFault
implements
Serializable
{
@Id
private
Integer
id
;
private
String
devNum
;
private
Date
tm
;
private
String
pCode
;
private
String
content
;
private
String
proId
;
}
src/main/java/org/rcisoft/business/mainte/fault/service/BusDeviceFaultService.java
0 → 100644
View file @
bfb9f430
package
org
.
rcisoft
.
business
.
mainte
.
fault
.
service
;
import
org.rcisoft.business.mainte.fault.vo.BusDeviceFaultVo
;
import
java.util.List
;
/**
* Created by on 2018-4-17 11:19:46.
*/
public
interface
BusDeviceFaultService
{
/**
* 故障次数
* @param proId
* @param year
* @param month
* @return
*/
List
<
Integer
>
statFault
(
String
proId
,
String
year
,
String
month
);
/**
* 故障统计列表
* @param proId
* @param year
* @param month
* @return
*/
List
<
BusDeviceFaultVo
>
queryFaultList
(
String
proId
,
String
year
,
String
month
);
}
src/main/java/org/rcisoft/business/mainte/fault/service/impl/BusDeviceFaultServiceImpl.java
0 → 100644
View file @
bfb9f430
package
org
.
rcisoft
.
business
.
mainte
.
fault
.
service
.
impl
;
import
org.rcisoft.business.mainte.fault.dao.BusDeviceFaultRepository
;
import
org.rcisoft.business.mainte.fault.service.BusDeviceFaultService
;
import
org.rcisoft.business.mainte.fault.vo.BusDeviceFaultVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* Created by on 2018-4-17 11:19:46.
*/
@Service
public
class
BusDeviceFaultServiceImpl
implements
BusDeviceFaultService
{
@Autowired
private
BusDeviceFaultRepository
busDeviceFaultRepository
;
@Override
public
List
<
Integer
>
statFault
(
String
proId
,
String
year
,
String
month
)
{
List
<
Integer
>
resultList
=
new
ArrayList
<
Integer
>();
BusDeviceFaultVo
b
=
new
BusDeviceFaultVo
();
b
.
setProId
(
proId
);
b
.
setDate
(
year
+
"-"
+
month
);
List
<
BusDeviceFaultVo
>
list
=
busDeviceFaultRepository
.
statFault
(
b
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
int
size
=
list
.
size
();
int
j
=
1
;
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
BusDeviceFaultVo
bb
=
list
.
get
(
i
);
int
day
=
bb
.
getDay
();
while
(
day
>
j
++){
resultList
.
add
(
0
);
}
resultList
.
add
(
bb
.
getNum
());
if
(
i
==
size
-
1
){
while
(
day
++
<
31
){
resultList
.
add
(
0
);
}
}
}
}
else
{
for
(
int
i
=
0
;
i
<
31
;
i
++)
{
resultList
.
add
(
0
);
}
}
return
resultList
;
}
@Override
public
List
<
BusDeviceFaultVo
>
queryFaultList
(
String
proId
,
String
year
,
String
month
)
{
BusDeviceFaultVo
busDeviceFaultVo
=
new
BusDeviceFaultVo
();
busDeviceFaultVo
.
setProId
(
proId
);
busDeviceFaultVo
.
setDate
(
year
+
"-"
+
month
);
return
busDeviceFaultRepository
.
queryFaultList
(
busDeviceFaultVo
);
}
}
src/main/java/org/rcisoft/business/mainte/fault/vo/BusDeviceFaultVo.java
0 → 100644
View file @
bfb9f430
package
org
.
rcisoft
.
business
.
mainte
.
fault
.
vo
;
import
lombok.Data
;
import
org.rcisoft.business.mainte.fault.entity.BusDeviceFault
;
/**
* Created by JiChao on 2018/4/17.
*/
@Data
public
class
BusDeviceFaultVo
extends
BusDeviceFault
{
private
Integer
day
;
private
Integer
num
;
//日期
private
String
date
;
//系统名称
private
String
sysNm
;
//设备名称
private
String
devNm
;
//参数名称
private
String
paramNm
;
}
src/main/java/org/rcisoft/business/overview/dao/EnergyCountMRepository.java
View file @
bfb9f430
...
...
@@ -52,12 +52,12 @@ public interface EnergyCountMRepository extends BaseMapper<EnergyCountM> {
* @param energyCountMVo
* @return
*/
@Select
(
"<script>select e.DEV_
ID
,"
+
@Select
(
"<script>select e.DEV_
NUM
,"
+
"<if test=\"type == 1\">sum(e.WATER)</if>"
+
"<if test=\"type == 2\">sum(e.ELEC)</if>"
+
"<if test=\"type == 3\">sum(e.GAS)</if>"
+
" as ENERGY from ENERGY_COUNT_M e"
+
" where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day} group by e.DEV_
ID
</script>"
)
" where e.PRO_ID=#{proId} and e.`YEAR`=#{year} and e.MON=#{mon} and e.`DAY`=#{day} group by e.DEV_
NUM
</script>"
)
@ResultMap
(
"resultMapVo"
)
List
<
EnergyCountMVo
>
countEnergySplit
(
EnergyCountMVo
energyCountMVo
);
...
...
src/main/java/org/rcisoft/business/overview/entity/EnergyCountM.java
View file @
bfb9f430
...
...
@@ -31,7 +31,7 @@ public class EnergyCountM implements Serializable {
@Id
private
Integer
id
;
private
String
dev
Id
;
private
String
dev
Num
;
private
String
proId
;
...
...
src/main/resources/mapper/sys/mainte/fault.mapper/BusDeviceFaultMapper.xml
0 → 100644
View file @
bfb9f430
<?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.fault.dao.BusDeviceFaultRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.mainte.fault.entity.BusDeviceFault"
>
<id
column=
"ID"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"DEV_NUM"
jdbcType=
"VARCHAR"
property=
"devNum"
/>
<result
column=
"TM"
jdbcType=
"TIMESTAMP"
property=
"tm"
/>
<result
column=
"P_CODE"
jdbcType=
"VARCHAR"
property=
"pCode"
/>
<result
column=
"CONTENT"
jdbcType=
"VARCHAR"
property=
"content"
/>
<result
column=
"PRO_ID"
jdbcType=
"VARCHAR"
property=
"proId"
/>
</resultMap>
<resultMap
id=
"vo"
type=
"org.rcisoft.business.mainte.fault.vo.BusDeviceFaultVo"
>
<result
column=
"DAY"
jdbcType=
"INTEGER"
property=
"day"
/>
<result
column=
"NUM"
jdbcType=
"INTEGER"
property=
"num"
/>
</resultMap>
<resultMap
id=
"faultList"
type=
"org.rcisoft.business.mainte.fault.vo.BusDeviceFaultVo"
>
<result
column=
"DATE"
jdbcType=
"VARCHAR"
property=
"date"
/>
<result
column=
"SYS_NM"
jdbcType=
"VARCHAR"
property=
"sysNm"
/>
<result
column=
"DEV_NM"
jdbcType=
"VARCHAR"
property=
"devNm"
/>
<result
column=
"PARAM_NM"
jdbcType=
"VARCHAR"
property=
"paramNm"
/>
<result
column=
"CONTENT"
jdbcType=
"VARCHAR"
property=
"content"
/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
src/main/resources/mapper/sys/overview.mapper/EnergyCountMMapper.xml
View file @
bfb9f430
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"org.rcisoft.business.overview.dao.EnergyCountMRepository"
>
<resultMap
id=
"BaseResultMap"
type=
"org.rcisoft.business.overview.entity.EnergyCountM"
>
<id
column=
"ID"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"DEV_
ID"
jdbcType=
"VARCHAR"
property=
"devId
"
/>
<result
column=
"DEV_
NUM"
jdbcType=
"VARCHAR"
property=
"devNum
"
/>
<result
column=
"PRO_ID"
jdbcType=
"VARCHAR"
property=
"proId"
/>
<result
column=
"WATER"
jdbcType=
"FLOAT"
property=
"water"
/>
<result
column=
"ELEC"
jdbcType=
"FLOAT"
property=
"elec"
/>
...
...
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