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
be7d8aae
Commit
be7d8aae
authored
Jul 30, 2024
by
李秀明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
巡检接口
parent
e417adb1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
222 additions
and
2 deletions
+222
-2
ControlScreenController.java
...s/patrol/business/controller/ControlScreenController.java
+34
-0
PlanTaskMapper.java
...ejoin/amos/patrol/business/dao/mapper/PlanTaskMapper.java
+24
-0
JcsFeignClient.java
...om/yeejoin/amos/patrol/business/feign/JcsFeignClient.java
+2
-2
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+27
-0
IPlanTaskService.java
.../amos/patrol/business/service/intfc/IPlanTaskService.java
+4
-0
dbTemplate_plan_task.xml
...rol/src/main/resources/db/mapper/dbTemplate_plan_task.xml
+131
-0
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/controller/ControlScreenController.java
View file @
be7d8aae
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
controller
;
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
controller
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.component.feign.model.Page
;
import
com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService
;
import
com.yeejoin.amos.patrol.business.service.intfc.IPlanTaskService
;
import
com.yeejoin.amos.patrol.business.util.CommonResponse
;
import
com.yeejoin.amos.patrol.business.util.CommonResponse
;
import
com.yeejoin.amos.patrol.business.util.CommonResponseUtil
;
import
com.yeejoin.amos.patrol.business.util.CommonResponseUtil
;
...
@@ -71,4 +72,37 @@ public class ControlScreenController extends AbstractBaseController {
...
@@ -71,4 +72,37 @@ public class ControlScreenController extends AbstractBaseController {
}
}
return
CommonResponseUtil
.
success
(
iPlanTaskService
.
getStationStatics
(
bizOrgCode
));
return
CommonResponseUtil
.
success
(
iPlanTaskService
.
getStationStatics
(
bizOrgCode
));
}
}
@GetMapping
(
"/patrol-activity/stats"
)
@ApiOperation
(
value
=
"消防巡检统计"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
CommonResponse
getPatrolActivityStats
(
@RequestParam
(
value
=
"date"
,
required
=
false
)
String
date
,
@RequestParam
(
value
=
"bizOrgCode"
,
required
=
false
)
String
bizOrgCode
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
bizOrgCode
=
reginParams
.
getPersonIdentity
().
getCompanyBizOrgCode
();
}
return
CommonResponseUtil
.
success
(
iPlanTaskService
.
getPatrolActivityStats
(
bizOrgCode
,
date
));
}
@GetMapping
(
"/patrol-record/page"
)
@ApiOperation
(
value
=
"消防巡检列表"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
CommonResponse
getPatrolRecordPage
(
@RequestParam
(
"pageNumber"
)
Integer
pageNumber
,
@RequestParam
(
"pageSize"
)
Integer
pageSize
,
@RequestParam
(
value
=
"date"
,
required
=
false
)
String
date
,
@RequestParam
(
value
=
"bizOrgCode"
,
required
=
false
)
String
bizOrgCode
,
@RequestParam
(
value
=
"patrolStatus"
,
required
=
false
)
String
patrolStatus
,
@RequestParam
(
value
=
"missStatus"
,
required
=
false
)
String
missStatus
,
@RequestParam
(
value
=
"sorter"
,
required
=
false
)
String
sorter
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
bizOrgCode
=
reginParams
.
getPersonIdentity
().
getCompanyBizOrgCode
();
}
return
CommonResponseUtil
.
success
(
iPlanTaskService
.
getPatrolRecordPage
(
pageNumber
,
pageSize
,
bizOrgCode
,
patrolStatus
,
missStatus
,
date
,
sorter
));
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/mapper/PlanTaskMapper.java
View file @
be7d8aae
...
@@ -341,4 +341,28 @@ public interface PlanTaskMapper extends BaseMapper {
...
@@ -341,4 +341,28 @@ public interface PlanTaskMapper extends BaseMapper {
Map
<
String
,
Object
>
queryPatrolEquipInfo
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"startDate"
)
Date
startDate
,
@Param
(
value
=
"endDate"
)
Date
endDate
);
Map
<
String
,
Object
>
queryPatrolEquipInfo
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"startDate"
)
Date
startDate
,
@Param
(
value
=
"endDate"
)
Date
endDate
);
List
<
Map
<
String
,
Object
>>
queryPatrolInfo
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"startDate"
)
Date
startDate
,
@Param
(
value
=
"endDate"
)
Date
endDate
);
List
<
Map
<
String
,
Object
>>
queryPatrolInfo
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"startDate"
)
Date
startDate
,
@Param
(
value
=
"endDate"
)
Date
endDate
);
List
<
HashMap
<
String
,
Object
>>
selectPatrolRecordPage
(
@Param
(
value
=
"offset"
)
long
offset
,
@Param
(
value
=
"pageSize"
)
long
pageSize
,
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"patrolStatus"
)
String
patrolStatus
,
@Param
(
value
=
"missStatus"
)
String
missStatus
,
@Param
(
value
=
"date"
)
String
date
,
@Param
(
value
=
"sortField"
)
String
sortField
,
@Param
(
value
=
"sortOrder"
)
String
sortOrder
);
Long
selectPatrolRecordTotal
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"patrolStatus"
)
String
patrolStatus
,
@Param
(
value
=
"missStatus"
)
String
missStatus
,
@Param
(
value
=
"date"
)
String
date
,
@Param
(
value
=
"sortField"
)
String
sortField
,
@Param
(
value
=
"sortOrder"
)
String
sortOrder
);
Map
<
String
,
Number
>
selectPatrolActivityStats
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"date"
)
String
date
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/feign/JcsFeignClient.java
View file @
be7d8aae
...
@@ -60,7 +60,7 @@ public interface JcsFeignClient {
...
@@ -60,7 +60,7 @@ public interface JcsFeignClient {
FeignClientResult
<
List
<
Map
<
String
,
Object
>>>
selectByIdList
(
@RequestBody
List
<
String
>
id
);
FeignClientResult
<
List
<
Map
<
String
,
Object
>>>
selectByIdList
(
@RequestBody
List
<
String
>
id
);
@GetMapping
(
value
=
"/org-usr/getCompanyInfo"
)
@GetMapping
(
value
=
"/org-usr/getCompanyInfo"
)
ResponseModel
<
Object
>
getCompanyInfo
(
@RequestParam
(
value
=
"companyId"
)
String
companyId
);
ResponseModel
<
Object
>
getCompanyInfo
(
@RequestParam
(
value
=
"companyId"
)
String
companyId
);
@PostMapping
(
value
=
"/org-usr/selectByIdDeptList"
)
@PostMapping
(
value
=
"/org-usr/selectByIdDeptList"
)
...
@@ -73,6 +73,6 @@ public interface JcsFeignClient {
...
@@ -73,6 +73,6 @@ public interface JcsFeignClient {
FeignClientResult
<
List
<
Map
<
String
,
Object
>>>
getDetByCompanyId
();
FeignClientResult
<
List
<
Map
<
String
,
Object
>>>
getDetByCompanyId
();
@GetMapping
(
value
=
"/org-person/listCompany/{bizOrgCode}"
)
@GetMapping
(
value
=
"/org-person/listCompany/{bizOrgCode}"
)
Object
listCompany
(
@PathVariable
(
value
=
"bizOrgCode"
)
String
bizOrgCode
)
;
Object
listCompany
(
@PathVariable
(
value
=
"bizOrgCode"
)
String
bizOrgCode
)
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PlanTaskServiceImpl.java
View file @
be7d8aae
...
@@ -2149,6 +2149,33 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -2149,6 +2149,33 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return
resultMap
;
return
resultMap
;
}
}
/**
*
* @param bizOrgCode
* @param date
* @return
*/
@Override
public
Map
<
String
,
Number
>
getPatrolActivityStats
(
String
bizOrgCode
,
String
date
)
{
return
planTaskMapper
.
selectPatrolActivityStats
(
bizOrgCode
,
date
);
}
@Override
public
Page
<
HashMap
<
String
,
Object
>>
getPatrolRecordPage
(
Integer
pageNumber
,
Integer
pageSize
,
String
bizOrgCode
,
String
patrolStatus
,
String
missStatus
,
String
date
,
String
sorter
)
{
long
offset
=
pageNumber
-
1
;
if
(
StringUtils
.
isEmpty
(
date
))
{
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
).
format
(
new
Date
());
}
String
sortField
=
""
,
sortOrder
=
""
;
if
(
org
.
springframework
.
util
.
StringUtils
.
hasText
(
sorter
))
{
sortField
=
sorter
.
split
(
"@"
)[
0
];
sortOrder
=
sorter
.
split
(
"@"
)[
1
];
}
List
<
HashMap
<
String
,
Object
>>
maps
=
planTaskMapper
.
selectPatrolRecordPage
(
offset
,
pageSize
,
bizOrgCode
,
patrolStatus
,
missStatus
,
date
,
sortField
,
sortOrder
);
Long
total
=
planTaskMapper
.
selectPatrolRecordTotal
(
bizOrgCode
,
patrolStatus
,
missStatus
,
date
,
sortField
,
sortOrder
);
return
new
PageImpl
<>(
maps
,
new
CommonPageable
(),
total
);
}
@Override
@Override
public
List
<
Map
<
String
,
Object
>>
queryPatrolInfo
(
String
bizOrgCode
,
Date
startDate
,
Date
endDate
)
{
public
List
<
Map
<
String
,
Object
>>
queryPatrolInfo
(
String
bizOrgCode
,
Date
startDate
,
Date
endDate
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/intfc/IPlanTaskService.java
View file @
be7d8aae
...
@@ -206,4 +206,8 @@ public interface IPlanTaskService {
...
@@ -206,4 +206,8 @@ public interface IPlanTaskService {
Map
<
String
,
Number
>
getCenterStatics
(
String
bizOrgCode
);
Map
<
String
,
Number
>
getCenterStatics
(
String
bizOrgCode
);
Map
<
String
,
Number
>
getStationStatics
(
String
bizOrgCode
);
Map
<
String
,
Number
>
getStationStatics
(
String
bizOrgCode
);
Map
<
String
,
Number
>
getPatrolActivityStats
(
String
bizOrgCode
,
String
date
);
Page
<
HashMap
<
String
,
Object
>>
getPatrolRecordPage
(
Integer
pageNumber
,
Integer
pageSize
,
String
bizOrgCode
,
String
patrolStatus
,
String
missStatus
,
String
date
,
String
sorter
);
}
}
amos-boot-system-patrol/src/main/resources/db/mapper/dbTemplate_plan_task.xml
View file @
be7d8aae
...
@@ -1774,4 +1774,134 @@
...
@@ -1774,4 +1774,134 @@
ORDER BY
ORDER BY
s1.date
s1.date
</select>
</select>
<select
id=
"selectPatrolRecordPage"
resultType=
"Map"
>
SELECT
*
FROM (
SELECT
LEFT(t.org_code, 18) AS bizOrgCode,
u.biz_org_name bizOrgName,
DATE_FORMAT( t.check_date, '%Y-%m-%d' ) AS time,
IF(SUM(IF(t.finish_status = 2 , 1, 0)) > 0, '已开展', '未开展') AS patrolStatus,
IFNULL(SUM( t.point_num ), 0) AS allCount,
IFNULL(SUM(IF(t.finish_status = 3, t.point_num, 0)), 0) AS missPointCount,
IFNULL(SUM(IF(t.finish_status = 2, t.point_num, 0)), 0) AS finishCount,
-- 漏查率 missPointCount / allCount
CONCAT(ROUND(IFNULL(SUM(IF(t.finish_status = 3, t.point_num, 0)), 0) / IFNULL(SUM( t.point_num ), 0), 2), '%') AS missPointRate,
-- 执行进度 finishCount / allCount
CONCAT(ROUND(IFNULL(SUM(IF(t.finish_status = 2, t.point_num, 0)), 0) / IFNULL(SUM( t.point_num ), 0), 2), '%') AS finishRate,
-- 总耗时
SUM(TIMESTAMPDIFF(MINUTE, t.begin_time, d.executor_date)) AS totalTime
FROM p_plan_task t
LEFT JOIN p_plan_task_detail d on t.id = d.task_no
LEFT JOIN cb_org_usr u on u.biz_org_code = left(t.org_code, 18)
WHERE
DATE_FORMAT( t.check_date, '%Y-%m-%d' ) = #{date}
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND u.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
GROUP BY
LEFT(t.org_code, 18)
) t
<where>
<if
test=
"patrolStatus == 'done'"
>
AND patrolStatus = '已开展'
</if>
<if
test=
"patrolStatus == 'undone'"
>
AND patrolStatus = '未开展'
</if>
<if
test=
"missStatus == 'true'"
>
AND missPointCount > 0
</if>
<if
test=
"missStatus == 'false'"
>
AND missPointCount = 0
</if>
</where>
ORDER BY
<if
test=
"sortField != null and sortField != ''"
>
<choose>
<when
test=
"sortOrder == 'ascend'"
>
${sortField} ASC
</when>
<otherwise>
${sortField} DESC
</otherwise>
</choose>
</if>
<if
test=
"sortField == null or sortField == ''"
>
time DESC
</if>
LIMIT #{offset}, #{pageSize}
</select>
<select
id=
"selectPatrolRecordTotal"
resultType=
"long"
>
SELECT
COUNT(t.bizOrgCode)
FROM (
SELECT
LEFT(t.org_code, 18) AS bizOrgCode,
u.biz_org_name bizOrgName,
DATE_FORMAT( t.check_date, '%Y-%m-%d' ) AS time,
IF(SUM(IF(t.finish_status = 2 , 1, 0)) > 0, '已开展', '未开展') AS patrolStatus,
IFNULL(SUM( t.point_num ), 0) AS allCount,
IFNULL(SUM(IF(t.finish_status = 3, t.point_num, 0)), 0) AS missPointCount,
IFNULL(SUM(IF(t.finish_status = 2, t.point_num, 0)), 0) AS finishCount,
-- 漏查率 missPointCount / allCount
CONCAT(ROUND(IFNULL(SUM(IF(t.finish_status = 3, t.point_num, 0)), 0) / IFNULL(SUM( t.point_num ), 0), 2), '%') AS missPointRate,
-- 执行进度 finishCount / allCount
CONCAT(ROUND(IFNULL(SUM(IF(t.finish_status = 2, t.point_num, 0)), 0) / IFNULL(SUM( t.point_num ), 0), 2), '%') AS finishRate,
-- 总耗时
SUM(TIMESTAMPDIFF(MINUTE, t.begin_time, d.executor_date)) AS totalTime
FROM p_plan_task t
LEFT JOIN p_plan_task_detail d on t.id = d.task_no
LEFT JOIN cb_org_usr u on u.biz_org_code = left(t.org_code, 18)
WHERE
DATE_FORMAT( t.check_date, '%Y-%m-%d' ) = #{date}
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND u.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
GROUP BY
LEFT(t.org_code, 18)
) t
<where>
<if
test=
"patrolStatus == 'done'"
>
AND patrolStatus = '已开展'
</if>
<if
test=
"patrolStatus == 'undone'"
>
AND patrolStatus = '未开展'
</if>
<if
test=
"missStatus == 'true'"
>
AND missPointCount > 0
</if>
<if
test=
"missStatus == 'false'"
>
AND missPointCount = 0
</if>
</where>
</select>
<select
id=
"selectPatrolActivityStats"
resultType=
"Map"
>
SELECT
IFNULL(SUM(IF(patrolStatus = '已开展', 1, 0)), 0) AS done,
IFNULL(SUM(IF(patrolStatus = '未开展', 1, 0)), 0) AS undone,
IFNULL(SUM(IF(missStatus = '无漏检', 1, 0)), 0) AS noMiss,
IFNULL(SUM(IF(missStatus = '有漏检', 1, 0)), 0) AS miss
FROM (
SELECT
IF(SUM(IF(t.finish_status = 2 , 1, 0)) > 0, '已开展', '未开展') AS patrolStatus,
IF(SUM(IF(t.finish_status = 3, t.point_num, 0)) > 0, '有漏检', '无漏检') AS missStatus
FROM
p_plan_task t
<where>
<if
test=
"date != null and date != ''"
>
AND DATE_FORMAT( t.check_date, '%Y-%m-%d' ) = #{date}
</if>
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND t.org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
LEFT(t.org_code, 18)
) t
</select>
</mapper>
</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