Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
e9c364ff
Commit
e9c364ff
authored
Aug 17, 2021
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.维保日历
parent
2c193bb5
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
75 additions
and
113 deletions
+75
-113
CalendarStatusCountRespone.java
...ance/core/common/response/CalendarStatusCountRespone.java
+1
-1
CheckController.java
...amos/maintenance/business/controller/CheckController.java
+9
-19
CheckMapper.java
...oin/amos/maintenance/business/dao/mapper/CheckMapper.java
+2
-2
CheckServiceImpl.java
...s/maintenance/business/service/impl/CheckServiceImpl.java
+9
-19
PointServiceImpl.java
...s/maintenance/business/service/impl/PointServiceImpl.java
+33
-26
ICheckService.java
...mos/maintenance/business/service/intfc/ICheckService.java
+1
-1
IPointService.java
...mos/maintenance/business/service/intfc/IPointService.java
+1
-1
MaintenanceResourceData.java
...amos/maintenance/business/vo/MaintenanceResourceData.java
+4
-34
dbTemplate_check.xml
...tenance/src/main/resources/db/mapper/dbTemplate_check.xml
+15
-10
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-maintenance-api/src/main/java/com/yeejoin/amos/maintenance/core/common/response/CalendarStatusCountRespone.java
View file @
e9c364ff
...
...
@@ -6,7 +6,7 @@ public class CalendarStatusCountRespone {
/**
* 个数
*/
private
d
ouble
count
;
private
D
ouble
count
;
/**
* 状态
*/
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/controller/CheckController.java
View file @
e9c364ff
...
...
@@ -299,24 +299,19 @@ public class CheckController extends AbstractBaseController {
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"获取巡检日历数据
<font color='blue'>手机app</font>"
,
notes
=
"获取巡检日历数据<font color='blue'>手机app</font>
"
)
@
PostMapping
(
value
=
"
/checkCalendar"
,
produces
=
"application/json;charset=UTF-8"
)
@ApiOperation
(
value
=
"获取巡检日历数据
-mobile"
,
notes
=
"获取巡检日历数据-mobile
"
)
@
GetMapping
(
value
=
"/{date}
/checkCalendar"
,
produces
=
"application/json;charset=UTF-8"
)
public
CommonResponse
checkCalendar
(
@ApiParam
(
value
=
"
查询条件"
,
required
=
false
)
@RequestBody
(
required
=
false
)
List
<
CommonRequest
>
queryRequests
)
{
try
{
@ApiParam
(
value
=
"
date,格式YYYY-MM-DD"
,
required
=
true
)
@PathVariable
String
date
)
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
loginOrgCode
=
getOrgCode
(
reginParams
);
String
roleTypeName
=
getRoleTypeName
(
reginParams
);
List
<
DaoCriteria
>
daoCriterias
=
buildDaoCriterias
(
queryRequests
,
true
,
loginOrgCode
,
roleTypeName
);
Map
<
String
,
Object
>
map
=
checkService
.
checkCalendar
(
CheckParamUtil
.
checkCalendar
(
daoCriterias
)
);
Map
<
String
,
Object
>
authMap
=
Bean
.
BeantoMap
(
reginParams
.
getPersonIdentity
()
);
params
.
putAll
(
authMap
);
params
.
put
(
"checkTime"
,
date
);
params
.
put
(
"orgCode"
,
loginOrgCode
);
Map
<
String
,
Object
>
map
=
checkService
.
checkCalendar
(
params
);
return
CommonResponseUtil
.
success
(
map
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
...
...
@@ -347,13 +342,8 @@ public class CheckController extends AbstractBaseController {
@ApiOperation
(
value
=
"获取巡检记录详情信息<font color='blue'>手机app</font>"
,
notes
=
"获取巡检记录详情信息<font color='blue'>手机app</font>"
)
@RequestMapping
(
value
=
"/queryCheckDetail"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
queryRecordById
(
@RequestParam
(
required
=
true
)
int
checkId
)
{
try
{
Map
<
String
,
Object
>
map
=
checkService
.
queryRecordById
(
checkId
);
return
CommonResponseUtil
.
success
(
map
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
}
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/dao/mapper/CheckMapper.java
View file @
e9c364ff
...
...
@@ -45,14 +45,14 @@ public interface CheckMapper extends BaseMapper {
* @param param
* @return
*/
Map
<
String
,
Object
>
pieChartData
(
CheckRecordParam
param
);
Map
<
String
,
Object
>
pieChartData
(
Map
<
String
,
Object
>
param
);
/**
* 巡检日历日历数据
* @param param
* @return
*/
List
<
Map
<
String
,
Object
>>
calendarData
(
CheckRecordParam
param
);
List
<
Map
<
String
,
Object
>>
calendarData
(
Map
<
String
,
Object
>
param
);
List
<
Map
<
String
,
Object
>>
queryRecordByPointId
(
HashMap
<
String
,
Object
>
req
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/impl/CheckServiceImpl.java
View file @
e9c364ff
...
...
@@ -624,26 +624,16 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public
Map
<
String
,
Object
>
checkCalendar
(
CheckRecordParam
recordP
aram
)
{
Map
<
String
,
Object
>
charData
=
checkMapper
.
pieChartData
(
recordP
aram
);
List
<
Map
<
String
,
Object
>>
calendarData
=
checkMapper
.
calendarData
(
recordP
aram
);
public
Map
<
String
,
Object
>
checkCalendar
(
Map
<
String
,
Object
>
p
aram
)
{
Map
<
String
,
Object
>
charData
=
checkMapper
.
pieChartData
(
p
aram
);
List
<
Map
<
String
,
Object
>>
calendarData
=
checkMapper
.
calendarData
(
p
aram
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
List
<
CalendarStatusCountRespone
>>
calendarMap
=
new
HashMap
<>();
if
(!
calendarData
.
isEmpty
())
{
calendarData
.
forEach
(
action
->
{
List
<
CalendarStatusCountRespone
>
statusCountList
=
new
ArrayList
<>();
CalendarStatusCountRespone
statusCount
=
new
CalendarStatusCountRespone
();
statusCount
.
setCount
(
Double
.
valueOf
(
action
.
get
(
"count"
).
toString
()));
statusCount
.
setStatus
(
action
.
get
(
"status"
).
toString
());
if
(
calendarMap
.
containsKey
(
action
.
get
(
"time"
)))
{
statusCountList
=
calendarMap
.
get
(
action
.
get
(
"time"
));
statusCountList
.
add
(
statusCount
);
}
else
{
statusCountList
.
add
(
statusCount
);
calendarMap
.
put
(
action
.
get
(
"time"
).
toString
(),
statusCountList
);
}
});
}
Map
<
String
,
List
<
CalendarStatusCountRespone
>>
calendarMap
=
calendarData
.
stream
().
collect
(
Collectors
.
groupingBy
(
map
->
map
.
get
(
"time"
).
toString
(),
Collectors
.
mapping
(
c
->{
CalendarStatusCountRespone
countRespone
=
new
CalendarStatusCountRespone
();
countRespone
.
setCount
(
Long
.
parseLong
(
c
.
get
(
"count"
).
toString
()));
countRespone
.
setStatus
(
c
.
get
(
"status"
).
toString
());
return
countRespone
;
},
Collectors
.
toList
())));
result
.
put
(
"charData"
,
charData
);
result
.
put
(
"calendarData"
,
calendarMap
);
return
result
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/impl/PointServiceImpl.java
View file @
e9c364ff
...
...
@@ -3,6 +3,7 @@ package com.yeejoin.amos.maintenance.business.service.impl;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.baomidou.mybatisplus.extension.api.R
;
import
com.google.common.base.Joiner
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
...
...
@@ -35,6 +36,7 @@ import org.springframework.data.domain.*;
import
org.springframework.data.domain.Sort.Direction
;
import
org.springframework.data.domain.Sort.Order
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -228,26 +230,19 @@ public class PointServiceImpl implements IPointService {
if
(!
pointInputItems
.
isEmpty
())
{
iPointInputItemDao
.
saveAll
(
pointInputItems
);
}
//TODO 2.分类暂时不需要 维保
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
Long
>
delPointById
(
Long
[]
ids
)
{
List
<
Long
>
idList
=
new
ArrayList
<
Long
>();
for
(
long
pointId
:
ids
)
{
idList
.
add
(
pointId
);
}
iPointClassifyDao
.
deleteByPointId
(
idList
);
// 物理删除点的分类
idList
.
addAll
(
Arrays
.
asList
(
ids
));
List
<
PointInputItem
>
pointInputItem
=
iPointInputItemDao
.
findAllById
(
idList
);
List
<
Long
>
pointInputItemIds
=
Lists
.
transform
(
pointInputItem
,
PointInputItem:
:
getId
);
if
(
pointInputItemIds
.
size
()
>
0
)
iPointInputItemDao
.
deleteFmeaRelationByPointInputItemIds
(
pointInputItemIds
);
//物理删除fmea关联巡检点项
iPointInputItemDao
.
deleteByPointId
(
idList
);
// 物理删除p_point_inputitem表对应行
iPointPhotoDao
.
deleteByPointId
(
idList
);
// 物理删除点的图片信息
// iRoutePointDao.delRoutePointByPointId(idList); //
// 物理删除p_route_point中相关行
// 物理删除p_point_inputitem表对应行
iPointInputItemDao
.
deleteByPointId
(
idList
);
// 物理删除p_route_point、p_route_point_item中相关行
List
<
BigInteger
>
routePointIdList
=
iRoutePointDao
.
queryRoutePointByPointId
(
idList
);
for
(
BigInteger
routePointId
:
routePointIdList
)
{
iRoutePointItemDao
.
delRoutePointItem
(
routePointId
.
longValue
());
...
...
@@ -270,18 +265,19 @@ public class PointServiceImpl implements IPointService {
}
}
}
iPlanTaskDetailDao
.
deletePlanTaskDetailByPointId
(
idList
);
// 删除p_plan_task_detail相关行
// 删除p_plan_task_detail相关行
iPlanTaskDetailDao
.
deletePlanTaskDetailByPointId
(
idList
);
// 删除p_point相关行
iPointDao
.
delPointById
(
idList
);
return
idList
;
}
@Override
@Transactional
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Point
updatePoint
(
PointParam
pointParam
)
{
//1.更新点
long
pointId
=
pointParam
.
getPoint
().
getId
();
Point
newPoint
=
iPointDao
.
findById
(
pointId
).
get
(
);
Point
newPoint
=
iPointDao
.
findById
(
pointId
).
orElseThrow
(()->
new
RuntimeException
(
"找不到原始数据"
)
);
Bean
.
copyExistPropertis
(
pointParam
.
getPoint
(),
newPoint
);
newPoint
.
setLastUpdateTime
(
new
Date
());
iPointDao
.
save
(
newPoint
);
...
...
@@ -381,6 +377,7 @@ public class PointServiceImpl implements IPointService {
}
return
returnList
;
}
@Override
public
List
<
PointInputItemVo
>
queryPointInputItem
(
Long
pointId
)
{
return
pointMapper
.
getPointInputItemById1
(
pointId
,
null
);
...
...
@@ -1089,11 +1086,27 @@ public class PointServiceImpl implements IPointService {
return
equipFeign
.
getRegionTress
();
}
@Override
@Async
public
void
syncSavePoint
(
List
<
MaintenanceResourceData
>
list
,
String
orgCode
,
String
userId
)
{
List
<
Point
>
points
=
new
ArrayList
<>();
List
<
PointInputItem
>
inputItems
=
new
ArrayList
<>();
List
<
Long
>
ids
=
new
ArrayList
<
Long
>();
List
<
Long
>
ids
=
new
ArrayList
<>();
//1.删除已有数据
for
(
MaintenanceResourceData
x
:
list
)
{
String
pointNo
=
x
.
getFireFacilityCode
();
String
originalId
=
String
.
valueOf
(
x
.
getFireFacilityId
());
Long
id
=
iPointDao
.
findPointByEquipmentIdAndFireFacilityId
(
pointNo
,
originalId
);
if
(
null
!=
id
)
{
ids
.
add
(
id
);
}
}
if
(!
ids
.
isEmpty
())
{
Long
[]
idsArray
=
ids
.
toArray
(
new
Long
[
0
]);
delPointById
(
idsArray
);
}
//2.创建
for
(
MaintenanceResourceData
x
:
list
)
{
Point
point
=
new
Point
();
String
pointNo
=
StringUtil
.
isNotEmpty
(
x
.
getFireFacilityCode
())
?
x
.
getFireFacilityCode
()
:
String
.
valueOf
(
sequence
.
nextId
());
...
...
@@ -1107,16 +1120,13 @@ public class PointServiceImpl implements IPointService {
point
.
setBelongSystemName
(
x
.
getFireFightSysName
());
point
.
setOwnerId
(
String
.
valueOf
(
x
.
getOwnerUnitId
()));
point
.
setOwnerName
(
x
.
getOwnerUnitName
());
point
.
setAddress
(
x
.
getLocation
());
point
.
setBuildingId
(
x
.
getBuildingId
()
!=
null
?
x
.
getBuildingId
().
toString
()
:
""
);
point
.
setBuildingName
(
x
.
getBuildingName
());
point
.
setAddress
(
x
.
getArea
());
point
.
setLevel
(
""
);
point
.
setCreatorId
(
userId
);
point
.
setOrgCode
(
orgCode
);
points
.
add
(
point
);
Long
id
=
iPointDao
.
findPointByEquipmentIdAndFireFacilityId
(
pointNo
,
originalId
);
if
(
null
!=
id
)
{
ids
.
add
(
id
);
iPointDao
.
delPointBIds
(
id
);
}
iPointDao
.
save
(
point
);
List
<
InputItem
>
inputItemVos
=
inputItemMapper
.
getInputItemByEquipmentName
(
x
.
getClassifyName
(),
orgCode
);
if
(
0
<
inputItemVos
.
size
())
{
...
...
@@ -1129,9 +1139,6 @@ public class PointServiceImpl implements IPointService {
});
}
}
if
(
0
<
ids
.
size
())
{
iPointInputItemDao
.
deleteByPointId
(
ids
);
}
iPointInputItemDao
.
saveAll
(
inputItems
);
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/intfc/ICheckService.java
View file @
e9c364ff
...
...
@@ -66,7 +66,7 @@ public interface ICheckService {
* @param requestParam
* @return
*/
Map
<
String
,
Object
>
checkCalendar
(
CheckRecordParam
requestParam
);
Map
<
String
,
Object
>
checkCalendar
(
Map
<
String
,
Object
>
requestParam
);
/**
* 根据点ID查询点巡检记录 手机APP
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/intfc/IPointService.java
View file @
e9c364ff
...
...
@@ -297,7 +297,7 @@ public interface IPointService {
List
queryItemList4RoutePoint
(
Long
pointId
,
Long
equipId
);
LinkedHashMap
<
String
,
Object
>
getRegionTress
();
LinkedHashMap
<
String
,
Object
>
getRegionTress
();
void
syncSavePoint
(
List
<
MaintenanceResourceData
>
list
,
String
orgCode
,
String
userId
);
/**
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/vo/MaintenanceResourceData.java
View file @
e9c364ff
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
vo
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
...
...
@@ -53,7 +52,6 @@ public class MaintenanceResourceData {
/**
* 业主单位名称
*/
@Excel
(
name
=
"所属单位"
,
width
=
30
,
orderNum
=
"7"
)
private
String
ownerUnitName
;
/**
...
...
@@ -69,7 +67,6 @@ public class MaintenanceResourceData {
/**
* 消防系统名称
*/
@Excel
(
name
=
"所属消防系统"
,
width
=
30
,
orderNum
=
"4"
)
private
String
fireFightSysName
;
/**
...
...
@@ -85,7 +82,6 @@ public class MaintenanceResourceData {
/**
* 分类名称
*/
@Excel
(
name
=
"设施类型"
,
width
=
30
,
orderNum
=
"3"
)
private
String
classifyName
;
/**
...
...
@@ -101,13 +97,11 @@ public class MaintenanceResourceData {
/**
* 消防设施编码
*/
@Excel
(
name
=
"设施编码"
,
width
=
30
,
orderNum
=
"6"
)
private
String
fireFacilityCode
;
/**
* 消防设施名称
*/
@Excel
(
name
=
"设施名称"
,
width
=
30
,
orderNum
=
"1"
)
private
String
fireFacilityName
;
/**
...
...
@@ -116,29 +110,10 @@ public class MaintenanceResourceData {
private
String
fireFacilityType
;
/**
* 维保到期时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"到期维保时间"
,
exportFormat
=
"yyyy-MM-dd HH:mm:ss"
,
importFormat
=
"yyyy-MM-dd HH:mm:ss"
,
width
=
30
,
orderNum
=
"5"
)
private
Date
maintenanceExpirationTime
;
/**
* 位置
*/
@Excel
(
name
=
"安装或设置位置"
,
width
=
50
,
orderNum
=
"2"
)
private
String
location
;
/**
* 建筑层级IDS
*/
private
String
buildTierIds
;
/**
* 新增和更新执行
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Excel
(
name
=
"添加时间"
,
exportFormat
=
"yyyy-MM-dd HH:mm:ss"
,
importFormat
=
"yyyy-MM-dd HH:mm:ss"
,
width
=
30
,
orderNum
=
"8"
)
private
Date
createDate
;
/**
* 建筑ID
...
...
@@ -150,17 +125,12 @@ public class MaintenanceResourceData {
*/
private
String
buildingName
;
/**
* 是否已关联
*/
private
List
<
Long
>
buildingIds
;
/**
*
是否已关联
*
详情位置
*/
private
Boolean
isRelation
;
private
String
area
;
// public void setRelation(Boolean relation) {
// isRelation = relation == null ? null : false;
// }
}
amos-boot-system-maintenance/src/main/resources/db/mapper/dbTemplate_check.xml
View file @
e9c364ff
...
...
@@ -286,13 +286,22 @@
COUNT(id) count
FROM
p_check
WHERE
DATE_FORMAT(check_time, '%Y-%m') = #{checkTime}
<if
test=
"userId!=null and userId!=0"
>
AND FIND_IN_SET(#{userId}, user_id)>0
</if>
<if
test=
"routeId!=null and routeId!=0"
>
AND route_id = #{routeId}
</if>
<if
test=
"orgCode!=null"
>
AND org_code LIKE #{orgCode}
</if>
<include
refid=
"calendar-where"
/>
</select>
<sql
id=
"calendar-where"
>
<where>
DATE_FORMAT(check_time, '%Y-%m') = #{checkTime}
<choose>
<when
test=
"identityType==1"
>
And (org_code LIKE CONCAT( #{orgCode}, '-%' ) or org_code= #{orgCode} )
</when>
<when
test=
"identityType==2"
>
And owner_id = #{companyId}
</when>
</choose>
</where>
</sql>
<select
id=
"calendarData"
resultType=
"Map"
>
SELECT
sum(is_ok) AS count,
...
...
@@ -300,11 +309,7 @@
is_ok status
FROM
p_check
WHERE
DATE_FORMAT(check_time, '%Y-%m') = #{checkTime}
<if
test=
"userId!=null and userId!=0"
>
AND FIND_IN_SET(#{userId}, user_id)>0
</if>
<if
test=
"routeId!=null and routeId!=0"
>
AND route_id = #{routeId}
</if>
<if
test=
"orgCode!=null"
>
AND org_code LIKE #{orgCode}
</if>
<include
refid=
"calendar-where"
/>
GROUP BY is_ok,time
ORDER BY time
</select>
...
...
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