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
b731f3db
Commit
b731f3db
authored
Jun 01, 2018
by
王夏晖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
计划编制功能完善,新增更新功能
parent
a95c4f3d
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
307 additions
and
1 deletion
+307
-1
BusDeviceServiceImpl.java
...ness/device/assets/service/impl/BusDeviceServiceImpl.java
+1
-1
InspectionController.java
...ss/device/inspection/controller/InspectionController.java
+8
-0
InspectionService.java
...business/device/inspection/service/InspectionService.java
+3
-0
InspectionServiceImpl.java
...device/inspection/service/impl/InspectionServiceImpl.java
+24
-0
BusEnergyPlanController.java
...mainte/energyplan/controller/BusEnergyPlanController.java
+24
-0
BusEnergyplanTRepository.java
...iness/mainte/energyplan/dao/BusEnergyplanTRepository.java
+26
-0
BusEnergyplanT.java
...oft/business/mainte/energyplan/entity/BusEnergyplanT.java
+45
-0
BusEnergyPlanService.java
...iness/mainte/energyplan/service/BusEnergyPlanService.java
+8
-0
BusEnergyplanTService.java
...ness/mainte/energyplan/service/BusEnergyplanTService.java
+31
-0
BusEnergyPlanServiceImpl.java
...nte/energyplan/service/impl/BusEnergyPlanServiceImpl.java
+40
-0
BusEnergyplanTServiceImpl.java
...te/energyplan/service/impl/BusEnergyplanTServiceImpl.java
+65
-0
EnergyPlanList.java
...rcisoft/business/mainte/energyplan/vo/EnergyPlanList.java
+32
-0
No files found.
src/main/java/org/rcisoft/business/device/assets/service/impl/BusDeviceServiceImpl.java
View file @
b731f3db
...
...
@@ -283,7 +283,7 @@ public class BusDeviceServiceImpl implements BusDeviceService {
criteria
.
andEqualTo
(
"devNum"
,
devNum
);
BusDevice
busDevice
=
new
BusDevice
();
busDevice
.
setDevNum
(
devNum
);
busDevice
.
setQrcodeUrl
(
"/"
+
devNum
+
".JPG"
);
busDevice
.
setQrcodeUrl
(
devNum
+
".JPG"
);
line
=
busDeviceRepository
.
updateByExampleSelective
(
busDevice
,
example
);
}
return
new
PersistModel
(
line
,
message
);
...
...
src/main/java/org/rcisoft/business/device/inspection/controller/InspectionController.java
View file @
b731f3db
...
...
@@ -109,4 +109,12 @@ public class InspectionController {
}
}
@ApiOperation
(
value
=
"下载二维码"
,
notes
=
"下载二维码"
)
@RequestMapping
(
"/download"
)
public
void
download
(
HttpServletResponse
response
,
@RequestParam
String
filename
)
{
inspectionService
.
download
(
response
,
filename
);
}
}
src/main/java/org/rcisoft/business/device/inspection/service/InspectionService.java
View file @
b731f3db
package
org
.
rcisoft
.
business
.
device
.
inspection
.
service
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -22,6 +23,8 @@ public interface InspectionService {
*/
List
<
Map
<
String
,
Object
>>
listAllInspectionInfomatinByProIdAndDevNum
(
String
proId
,
String
devNum
,
String
mon
);
void
download
(
HttpServletResponse
response
,
String
filename
);
...
...
src/main/java/org/rcisoft/business/device/inspection/service/impl/InspectionServiceImpl.java
View file @
b731f3db
...
...
@@ -2,14 +2,22 @@ package org.rcisoft.business.device.inspection.service.impl;
import
freemarker.template.SimpleDate
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.rcisoft.business.device.inspection.dao.InspectionRepository
;
import
org.rcisoft.business.device.inspection.service.InspectionService
;
import
org.rcisoft.business.evaluate.analysis.entity.BusReport
;
import
org.rcisoft.common.constants.DeviceInspectFlagConstant
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -25,6 +33,8 @@ public class InspectionServiceImpl implements InspectionService {
@Autowired
private
InspectionRepository
inspectionRepository
;
@Value
(
"${filepath.qrcode}"
)
private
String
filepath
;
@Override
public
List
<
Map
<
String
,
Object
>>
listTheLastInspectionInfomatinByProIdAndFlag
(
String
proId
)
{
...
...
@@ -40,4 +50,18 @@ public class InspectionServiceImpl implements InspectionService {
}
return
inspectionRepository
.
listAllInspectionInfomatinByProIdAndDevNum
(
proId
,
devNum
,
mon
);
}
@Override
public
void
download
(
HttpServletResponse
response
,
String
filename
)
{
String
path
=
filepath
+
filename
;
try
(
OutputStream
outputStream
=
response
.
getOutputStream
())
{
//获取文件字节
byte
[]
bytes
=
FileUtils
.
readFileToByteArray
(
new
File
(
path
));
//设置下载头
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
filename
,
"iso-8859-1"
));
outputStream
.
write
(
bytes
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
src/main/java/org/rcisoft/business/mainte/energyplan/controller/BusEnergyPlanController.java
View file @
b731f3db
...
...
@@ -6,7 +6,9 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyPlan
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyplanT
;
import
org.rcisoft.business.mainte.energyplan.service.BusEnergyPlanService
;
import
org.rcisoft.business.mainte.energyplan.service.BusEnergyplanTService
;
import
org.rcisoft.business.mainte.energyplan.vo.EnergyPlanList
;
import
org.rcisoft.business.mainte.energyplan.vo.EnergyPlanVo
;
import
org.rcisoft.core.constant.MessageConstant
;
...
...
@@ -33,6 +35,8 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan>
@Autowired
private
BusEnergyPlanService
busEnergyPlanServiceImpl
;
@Autowired
private
BusEnergyplanTService
busEnergyplanTService
;
@ApiOperation
(
value
=
"添加能耗计划"
,
notes
=
"添加能耗计划"
)
...
...
@@ -48,6 +52,16 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan>
null
);
}
@ApiOperation
(
value
=
"新增或修改能耗计划"
,
notes
=
"新增或修改能耗计划"
)
@PostMapping
(
value
=
"/saveOrUpdate"
)
public
Result
saveOrUpdate
(
@RequestBody
EnergyPlanList
energyPlanlist
)
throws
Exception
{
PersistModel
pm
=
busEnergyPlanServiceImpl
.
saveOrUpdate
(
energyPlanlist
);
return
Result
.
builder
(
pm
,
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
null
);
}
@ApiOperation
(
value
=
"删除设备某一天的能耗计划"
,
notes
=
"删除设备某一天的能耗计划"
)
@DeleteMapping
(
"/delete"
)
public
Result
delete
(
@RequestParam
String
devNum
,
@RequestParam
String
day
)
{
...
...
@@ -74,6 +88,16 @@ public class BusEnergyPlanController extends PaginationController<BusEnergyPlan>
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busEnergyPlanServiceImpl
.
queryEnergyPlanList
(
pro_id
,
day
));
}
@ApiOperation
(
value
=
"查询单个设备的能耗计划概览"
,
notes
=
"查询单个设备的能耗计划概览"
)
@GetMapping
(
value
=
"/queryEnergyPlanByDev"
)
public
Result
queryEnergyPlanByDev
(
@RequestParam
String
devNum
,
@RequestParam
String
day
)
throws
Exception
{
return
Result
.
builder
(
new
PersistModel
(
1
),
MessageConstant
.
MESSAGE_ALERT_SUCCESS
,
MessageConstant
.
MESSAGE_ALERT_ERROR
,
busEnergyplanTService
.
queryBusEnergyplanTs
(
devNum
,
day
));
}
@ApiOperation
(
value
=
"查询设备类型"
,
notes
=
"查询设备类型"
)
@GetMapping
(
value
=
"/queryDeviceTp"
)
public
Result
queryDeviceTp
(){
...
...
src/main/java/org/rcisoft/business/mainte/energyplan/dao/BusEnergyplanTRepository.java
0 → 100644
View file @
b731f3db
package
org
.
rcisoft
.
business
.
mainte
.
energyplan
.
dao
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyplanT
;
import
org.rcisoft.core.base.BaseMapper
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created with on 2018-6-1 9:57:38.
*/
@Repository
public
interface
BusEnergyplanTRepository
extends
BaseMapper
<
BusEnergyplanT
>
{
/**
* 分页查询 busEnergyplanT
*
*/
@Select
(
"<script>select * from bus_energyplan_t where dev_num = #{devNum} "
+
" and day = #{day} </script>"
)
List
<
Map
<
String
,
Object
>>
queryBusEnergyplanTs
(
@Param
(
"devNum"
)
String
devNum
,
@Param
(
"day"
)
String
day
);
}
src/main/java/org/rcisoft/business/mainte/energyplan/entity/BusEnergyplanT.java
0 → 100644
View file @
b731f3db
package
org
.
rcisoft
.
business
.
mainte
.
energyplan
.
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-6-1 9:57:38.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"bus_energyplan_t"
)
public
class
BusEnergyplanT
{
private
String
id
;
private
String
devNum
;
private
String
day
;
private
String
devTpId
;
private
String
startTm
;
private
String
endTm
;
private
String
valOne
;
private
String
valTwo
;
private
String
valThree
;
private
String
compareVal
;
}
src/main/java/org/rcisoft/business/mainte/energyplan/service/BusEnergyPlanService.java
View file @
b731f3db
...
...
@@ -2,6 +2,7 @@ package org.rcisoft.business.mainte.energyplan.service;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyPlan
;
import
org.rcisoft.business.mainte.energyplan.vo.EnergyPlanList
;
import
org.rcisoft.business.mainte.energyplan.vo.EnergyPlanVo
;
import
org.rcisoft.core.model.PersistModel
;
import
org.rcisoft.core.aop.PageUtil
;
...
...
@@ -22,6 +23,13 @@ public interface BusEnergyPlanService {
*/
PersistModel
save
(
EnergyPlanVo
energyPlan
)
throws
Exception
;
/**
* 新增或修改能耗计划
* @return
* @throws Exception
*/
PersistModel
saveOrUpdate
(
EnergyPlanList
energyPlanlist
)
throws
Exception
;
/**
* 删除能耗计划
* @return
...
...
src/main/java/org/rcisoft/business/mainte/energyplan/service/BusEnergyplanTService.java
0 → 100644
View file @
b731f3db
package
org
.
rcisoft
.
business
.
mainte
.
energyplan
.
service
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyplanT
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by on 2018-6-1 9:57:38.
*/
public
interface
BusEnergyplanTService
{
/**
* 保存
* @return
*/
Boolean
save
(
List
<
BusEnergyplanT
>
busEnergyplanTList
);
/**
* 删除指定设备指定某一天的能耗计划
* @return
*/
Boolean
remove
(
String
devNum
,
String
day
);
List
<
Map
<
String
,
Object
>>
queryBusEnergyplanTs
(
String
devNum
,
String
day
);
}
src/main/java/org/rcisoft/business/mainte/energyplan/service/impl/BusEnergyPlanServiceImpl.java
View file @
b731f3db
...
...
@@ -4,7 +4,10 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
org.rcisoft.business.mainte.energyplan.dao.BusEnergyPlanRepository
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyPlan
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyplanT
;
import
org.rcisoft.business.mainte.energyplan.service.BusEnergyPlanService
;
import
org.rcisoft.business.mainte.energyplan.service.BusEnergyplanTService
;
import
org.rcisoft.business.mainte.energyplan.vo.EnergyPlanList
;
import
org.rcisoft.business.mainte.energyplan.vo.EnergyPlanVo
;
import
org.rcisoft.business.mainte.paramlibrary.dao.ParamLibraryRepository
;
import
org.rcisoft.core.util.UploadUtil
;
...
...
@@ -27,6 +30,7 @@ import java.text.SimpleDateFormat;
import
java.util.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
tk.mybatis.mapper.entity.Example
;
/**
...
...
@@ -41,6 +45,8 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService {
private
BusEnergyPlanRepository
busEnergyPlanRepository
;
@Autowired
private
ParamLibraryRepository
paramLibraryRepository
;
@Autowired
private
BusEnergyplanTService
busEnergyplanTService
;
@Value
(
"${serverimgurl}"
)
private
String
serverImgUrl
;
...
...
@@ -118,6 +124,40 @@ public class BusEnergyPlanServiceImpl implements BusEnergyPlanService {
return
new
PersistModel
(
1
);
}
@Transactional
@Override
public
PersistModel
saveOrUpdate
(
EnergyPlanList
energyPlanlist
)
throws
Exception
{
List
<
BusEnergyplanT
>
busEnergyplanTList
=
energyPlanlist
.
getBusEnergyplanTList
();
int
line
=
1
;
String
message
=
""
;
String
devNum
=
energyPlanlist
.
getDevNum
();
String
day
=
energyPlanlist
.
getDay
();
//先清除掉该设备该天的能耗计划后重新新增
PersistModel
pm
=
remove
(
devNum
,
day
);
Boolean
flag
=
true
;
if
(
pm
.
isSuccessBySinglePersist
()){
flag
=
busEnergyplanTService
.
remove
(
energyPlanlist
.
getDevNum
(),
energyPlanlist
.
getDay
());
}
if
(
flag
){
List
<
EnergyPlanVo
>
epList
=
energyPlanlist
.
getEnergyPlanVoList
();
for
(
EnergyPlanVo
energyPlanVo
:
epList
){
try
{
PersistModel
p
=
save
(
energyPlanVo
);
if
(
p
.
isSuccessBySinglePersist
()){
busEnergyplanTService
.
save
(
busEnergyplanTList
);
}
}
catch
(
Exception
e
){
line
=
0
;
message
=
"系统错误,操作失败"
;
}
}
}
else
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
message
=
"系统错误,操作失败"
;
}
return
new
PersistModel
(
line
,
message
);
}
/**
* 逻辑删除
* @return
...
...
src/main/java/org/rcisoft/business/mainte/energyplan/service/impl/BusEnergyplanTServiceImpl.java
0 → 100644
View file @
b731f3db
package
org
.
rcisoft
.
business
.
mainte
.
energyplan
.
service
.
impl
;
import
lombok.extern.slf4j.Slf4j
;
import
org.rcisoft.business.mainte.energyplan.dao.BusEnergyplanTRepository
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyplanT
;
import
org.rcisoft.business.mainte.energyplan.service.BusEnergyplanTService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
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-6-1 9:57:38.
*/
@Service
@Transactional
(
readOnly
=
true
,
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Slf4j
public
class
BusEnergyplanTServiceImpl
implements
BusEnergyplanTService
{
@Autowired
private
BusEnergyplanTRepository
busEnergyplanTRepository
;
@Transactional
@Override
public
Boolean
save
(
List
<
BusEnergyplanT
>
busEnergyplanTList
)
{
try
{
for
(
BusEnergyplanT
busEnergyplanT
:
busEnergyplanTList
){
busEnergyplanT
.
setId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
));
busEnergyplanTRepository
.
insertSelective
(
busEnergyplanT
);
}
}
catch
(
Exception
e
){
return
false
;
}
return
true
;
}
@Override
public
Boolean
remove
(
String
devNum
,
String
day
)
{
if
(
devNum
==
null
||
devNum
.
equals
(
""
))
return
false
;
if
(
day
==
null
||
day
.
equals
(
""
))
return
false
;
Boolean
flag
=
false
;
Example
example
=
new
Example
(
BusEnergyplanT
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
BusEnergyplanT
bt
=
new
BusEnergyplanT
();
bt
.
setDevNum
(
devNum
);
bt
.
setDay
(
day
);
criteria
.
andEqualTo
(
bt
);
int
line
=
busEnergyplanTRepository
.
delete
(
bt
);
if
(
line
>=
0
){
flag
=
true
;}
return
flag
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryBusEnergyplanTs
(
String
devNum
,
String
day
)
{
return
busEnergyplanTRepository
.
queryBusEnergyplanTs
(
devNum
,
day
);
}
}
src/main/java/org/rcisoft/business/mainte/energyplan/vo/EnergyPlanList.java
View file @
b731f3db
package
org
.
rcisoft
.
business
.
mainte
.
energyplan
.
vo
;
import
org.rcisoft.business.mainte.energyplan.entity.BusEnergyplanT
;
import
java.util.List
;
public
class
EnergyPlanList
{
private
List
<
EnergyPlanVo
>
energyPlanVoList
;
private
String
devNum
;
private
String
day
;
private
List
<
BusEnergyplanT
>
busEnergyplanTList
;
public
List
<
EnergyPlanVo
>
getEnergyPlanVoList
()
{
return
energyPlanVoList
;
}
...
...
@@ -12,4 +20,28 @@ public class EnergyPlanList {
public
void
setEnergyPlanVoList
(
List
<
EnergyPlanVo
>
energyPlanVoList
)
{
this
.
energyPlanVoList
=
energyPlanVoList
;
}
public
String
getDevNum
()
{
return
devNum
;
}
public
void
setDevNum
(
String
devNum
)
{
this
.
devNum
=
devNum
;
}
public
String
getDay
()
{
return
day
;
}
public
void
setDay
(
String
day
)
{
this
.
day
=
day
;
}
public
List
<
BusEnergyplanT
>
getBusEnergyplanTList
()
{
return
busEnergyplanTList
;
}
public
void
setBusEnergyplanTList
(
List
<
BusEnergyplanT
>
busEnergyplanTList
)
{
this
.
busEnergyplanTList
=
busEnergyplanTList
;
}
}
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