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
999f2f1f
Commit
999f2f1f
authored
Jul 31, 2024
by
KeYong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_dl_bugfix_0723' into develop_dl_bugfix_0723
parents
2b05ad64
be7d8aae
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
426 additions
and
2 deletions
+426
-2
ControlScreenController.java
...s/patrol/business/controller/ControlScreenController.java
+55
-0
PlanTaskMapper.java
...ejoin/amos/patrol/business/dao/mapper/PlanTaskMapper.java
+26
-0
JcsFeignClient.java
...om/yeejoin/amos/patrol/business/feign/JcsFeignClient.java
+2
-2
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+64
-0
IPlanTaskService.java
.../amos/patrol/business/service/intfc/IPlanTaskService.java
+7
-0
dbTemplate_plan_task.xml
...rol/src/main/resources/db/mapper/dbTemplate_plan_task.xml
+272
-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 @
999f2f1f
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
;
...
@@ -50,4 +51,58 @@ public class ControlScreenController extends AbstractBaseController {
...
@@ -50,4 +51,58 @@ public class ControlScreenController extends AbstractBaseController {
return
CommonResponseUtil
.
success
(
iPlanTaskService
.
getStatics
(
companyCode
,
bizOrgCode
));
return
CommonResponseUtil
.
success
(
iPlanTaskService
.
getStatics
(
companyCode
,
bizOrgCode
));
}
}
@GetMapping
(
"/center/statics"
)
@ApiOperation
(
value
=
"消防巡检统计"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
CommonResponse
getCenterStatics
(
@RequestParam
(
required
=
false
)
String
bizOrgCode
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
bizOrgCode
=
reginParams
.
getPersonIdentity
().
getCompanyBizOrgCode
();
}
return
CommonResponseUtil
.
success
(
iPlanTaskService
.
getCenterStatics
(
bizOrgCode
));
}
@GetMapping
(
"/station/statics"
)
@ApiOperation
(
value
=
"消防巡检统计"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
public
CommonResponse
getStationStatics
(
@RequestParam
(
required
=
false
)
String
bizOrgCode
)
{
if
(
StringUtils
.
isEmpty
(
bizOrgCode
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
bizOrgCode
=
reginParams
.
getPersonIdentity
().
getCompanyBizOrgCode
();
}
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 @
999f2f1f
...
@@ -333,10 +333,36 @@ public interface PlanTaskMapper extends BaseMapper {
...
@@ -333,10 +333,36 @@ public interface PlanTaskMapper extends BaseMapper {
String
queryByCompanyCode
(
@Param
(
"companyCode"
)
String
companyCode
);
String
queryByCompanyCode
(
@Param
(
"companyCode"
)
String
companyCode
);
List
<
Map
<
String
,
Object
>>
getStatics
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
getStatics
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
getCenterStatics
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
List
<
Map
<
String
,
Object
>>
getStationStatics
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
Map
<
String
,
Object
>
queryPatrolInfoList
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"startDate"
)
Date
startDate
,
@Param
(
value
=
"endDate"
)
Date
endDate
);
Map
<
String
,
Object
>
queryPatrolInfoList
(
@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
);
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 @
999f2f1f
...
@@ -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 @
999f2f1f
...
@@ -77,6 +77,8 @@ import java.io.File;
...
@@ -77,6 +77,8 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -2123,11 +2125,73 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -2123,11 +2125,73 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
@Override
@Override
public
Map
<
String
,
Number
>
getCenterStatics
(
String
bizOrgCode
)
{
List
<
Map
<
String
,
Object
>>
statics
=
planTaskMapper
.
getCenterStatics
(
bizOrgCode
);
Map
<
String
,
Number
>
resultMap
=
new
HashMap
<>();
for
(
Map
<
String
,
Object
>
item
:
statics
)
{
resultMap
.
put
((
String
)
item
.
get
(
"code"
),
Long
.
valueOf
(
item
.
getOrDefault
(
"value"
,
"0"
).
toString
()));
}
// 今日漏查率 = 今日漏查点位(JRLCDW) / 今日应巡查点(JRYXCD)
resultMap
.
put
(
"JRLCL"
,
getPercent
(
resultMap
.
get
(
"JRLCDW"
).
floatValue
(),
resultMap
.
get
(
"JRYXCD"
).
floatValue
()));
// 今日巡查点位合格占比 = 合格(HG) / 今日应巡查点(JRYXCD)
resultMap
.
put
(
"JRHGZB"
,
getPercent
(
resultMap
.
get
(
"HG"
).
floatValue
(),
resultMap
.
get
(
"JRYXCD"
).
floatValue
()));
return
resultMap
;
}
@Override
public
Map
<
String
,
Number
>
getStationStatics
(
String
bizOrgCode
)
{
List
<
Map
<
String
,
Object
>>
statics
=
planTaskMapper
.
getStationStatics
(
bizOrgCode
);
Map
<
String
,
Number
>
resultMap
=
new
HashMap
<>();
for
(
Map
<
String
,
Object
>
item
:
statics
)
{
resultMap
.
put
((
String
)
item
.
get
(
"code"
),
Long
.
valueOf
(
item
.
getOrDefault
(
"value"
,
"0"
).
toString
()));
}
// 执行进度
resultMap
.
put
(
"ZXJD"
,
getPercent
(
resultMap
.
get
(
"JRLJXCDW"
).
floatValue
(),
resultMap
.
get
(
"JRYXCD"
).
floatValue
()));
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
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
<>();
return
planTaskMapper
.
queryPatrolInfo
(
bizOrgCode
,
startDate
,
endDate
);
return
planTaskMapper
.
queryPatrolInfo
(
bizOrgCode
,
startDate
,
endDate
);
}
}
private
float
getPercent
(
double
num1
,
double
num2
)
{
if
(
num2
==
0
)
{
return
0
;
}
double
result
=
(
num1
/
num2
)
*
100
;
BigDecimal
decimal
=
new
BigDecimal
(
result
).
setScale
(
2
,
RoundingMode
.
HALF_UP
);
return
decimal
.
floatValue
();
}
public
static
byte
[]
file2byte
(
File
file
)
{
public
static
byte
[]
file2byte
(
File
file
)
{
try
(
try
(
FileInputStream
in
=
new
FileInputStream
(
file
);
FileInputStream
in
=
new
FileInputStream
(
file
);
...
...
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 @
999f2f1f
...
@@ -203,4 +203,11 @@ public interface IPlanTaskService {
...
@@ -203,4 +203,11 @@ public interface IPlanTaskService {
List
<
Map
<
String
,
Object
>>
queryPatrolInfo
(
String
bizOrgCode
,
Date
startDate
,
Date
endDate
);
List
<
Map
<
String
,
Object
>>
queryPatrolInfo
(
String
bizOrgCode
,
Date
startDate
,
Date
endDate
);
Map
<
String
,
Number
>
getCenterStatics
(
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 @
999f2f1f
...
@@ -1442,6 +1442,147 @@
...
@@ -1442,6 +1442,147 @@
'xfxclcl' AS code
'xfxclcl' AS code
</select>
</select>
<select
id=
"getCenterStatics"
resultType=
"java.util.Map"
>
SELECT
ifnull( sum( p_plan_task.point_num ), 0 ) AS value,
'今日应巡查点' AS name,
'JRYXCD' AS code
FROM
p_plan_task
<where>
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
UNION ALL
SELECT
ifnull( sum( p_plan_task.finish_num ), 0 ) AS value,
'今日累计巡查点位' AS name,
'JRLJXCDW' AS code
FROM
p_plan_task
<where>
finish_status = 2
AND DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
UNION ALL
SELECT
count(1) AS value,
'合格' AS name,
'HG' AS code
FROM
p_plan_task ppk
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
<where>
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE () AND pptd.STATUS = 1
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
UNION ALL
SELECT
count(1) AS value,
'不合格' AS name,
'BHG' AS code
FROM
p_plan_task ppk
LEFT JOIN p_plan_task_detail pptd ON pptd.task_no = ppk.id
<where>
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE () AND pptd.STATUS = 2
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
UNION ALL
SELECT
ifnull( sum( p_plan_task.point_num ), 0 ) AS value,
'今日漏查点位' AS name,
'JRLCDW' AS code
FROM
p_plan_task
<where>
finish_status = 3
AND DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
UNION ALL
SELECT
ifnull( count( DISTINCT LEFT(p_plan_task.point_num, 18) ), 0 ) AS value,
'今日已巡查站' AS name,
'JRYXCZ' AS code
FROM
p_plan_task
<where>
finish_status = 2
AND DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
</select>
<select
id=
"getStationStatics"
resultType=
"java.util.Map"
>
SELECT
ifnull( sum( p_plan_task.point_num ), 0 ) AS value,
'今日应巡查点' AS name,
'JRYXCD' AS code
FROM
p_plan_task
<where>
DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
UNION ALL
SELECT
ifnull( sum( p_plan_task.finish_num ), 0 ) AS value,
'今日累计巡查点位' AS name,
'JRLJXCDW' AS code
FROM
p_plan_task
<where>
finish_status = 2
AND DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
UNION ALL
SELECT
ifnull( sum( p_plan_task.point_num ), 0 ) AS value,
'今日漏查点位' AS name,
'JRLCDW' AS code
FROM
p_plan_task
<where>
finish_status = 3
AND DATE_FORMAT( check_date, '%Y-%m-%d' ) = CURRENT_DATE ()
<if
test=
"bizOrgCode != null and bizOrgCode != ''"
>
AND org_code LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
</select>
<select
id=
"queryByCompanyCode"
resultType=
"java.lang.String"
>
<select
id=
"queryByCompanyCode"
resultType=
"java.lang.String"
>
SELECT biz_org_code
SELECT biz_org_code
FROM cb_org_usr
FROM cb_org_usr
...
@@ -1633,4 +1774,134 @@
...
@@ -1633,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