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
57650feb
Commit
57650feb
authored
Aug 16, 2021
by
KeYong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新接口
parent
e3cad20a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
221 additions
and
1 deletion
+221
-1
OrderByEnum.java
...om/yeejoin/amos/maintenance/common/enums/OrderByEnum.java
+3
-1
CheckController.java
...amos/maintenance/business/controller/CheckController.java
+43
-0
CheckMapper.java
...oin/amos/maintenance/business/dao/mapper/CheckMapper.java
+6
-0
CheckServiceImpl.java
...s/maintenance/business/service/impl/CheckServiceImpl.java
+30
-0
ICheckService.java
...mos/maintenance/business/service/intfc/ICheckService.java
+7
-0
dbTemplate_check.xml
...tenance/src/main/resources/db/mapper/dbTemplate_check.xml
+132
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-maintenance-api/src/main/java/com/yeejoin/amos/maintenance/common/enums/OrderByEnum.java
View file @
57650feb
...
...
@@ -17,7 +17,9 @@ public enum OrderByEnum {
PLAN_TASK_NUM_ASC
(
"计划维保设施数正序"
,
"3"
,
"taskPlanNum asc"
),
PLAN_TASK_NUM_DESC
(
"计划维保设施数倒序"
,
"4"
,
"taskPlanNum desc"
),
FINISH_NUM_DESC
(
"完成数倒序"
,
"5"
,
"finishNum desc"
),
FINISH_NUM_ASC
(
"完成数正序"
,
"6"
,
"finishNum asc"
);
FINISH_NUM_ASC
(
"完成数正序"
,
"6"
,
"finishNum asc"
),
DATE_DESC
(
"维保记录时间倒序"
,
"1"
,
"checkDate desc"
),
DATE_ASC
(
"维保记录时间正序"
,
"2"
,
"checkDate asc"
);
/**
* 名字
...
...
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 @
57650feb
...
...
@@ -19,6 +19,7 @@ import javax.xml.transform.TransformerFactory;
import
javax.xml.transform.stream.StreamResult
;
import
javax.xml.transform.stream.StreamSource
;
import
com.yeejoin.amos.maintenance.common.enums.OrderByEnum
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.BooleanUtils
;
import
org.slf4j.Logger
;
...
...
@@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
...
...
@@ -602,4 +604,45 @@ public class CheckController extends AbstractBaseController {
@ApiParam
(
value
=
"源ids,逗号分隔"
,
required
=
true
)
@PathVariable
String
...
relationId
)
{
return
CommonResponseUtil
.
success
(
checkService
.
obtainLastCheckRecord
(
relationId
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"维保记录分页查询"
,
notes
=
"维保记录分页查询"
)
@GetMapping
(
value
=
"/page"
)
public
CommonResponse
getCheckRecord
(
@ApiParam
(
value
=
"查询范围"
)
@RequestParam
(
value
=
"userId"
,
required
=
false
)
String
userId
,
@ApiParam
(
value
=
"时间范围"
)
@RequestParam
(
value
=
"timeType"
,
required
=
false
)
String
timeType
,
@ApiParam
(
value
=
"维保结果"
)
@RequestParam
(
value
=
"result"
,
required
=
false
)
String
result
,
@ApiParam
(
value
=
"排序规则"
)
@RequestParam
(
value
=
"orderRule"
,
required
=
false
)
String
orderRule
,
@ApiParam
(
value
=
"开始时间"
)
@RequestParam
(
value
=
"beginTime"
,
required
=
false
)
String
beginTime
,
@ApiParam
(
value
=
"结束时间"
)
@RequestParam
(
value
=
"endTime"
,
required
=
false
)
String
endTime
,
@ApiParam
(
value
=
"维保人员"
)
@RequestParam
(
value
=
"personId"
,
required
=
false
)
String
person
,
@ApiParam
(
value
=
"业主单位"
)
@RequestParam
(
value
=
"teamId"
,
required
=
false
)
String
team
,
@ApiParam
(
value
=
"当前页"
)
@RequestParam
(
value
=
"pageNumber"
)
int
pageNumber
,
@ApiParam
(
value
=
"页大小"
)
@RequestParam
(
value
=
"pageSize"
)
int
pageSize
)
throws
Exception
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
loginOrgCode
=
getOrgCode
(
reginParams
);
Map
<
String
,
Object
>
authMap
=
Bean
.
BeantoMap
(
reginParams
.
getPersonIdentity
());
params
.
putAll
(
authMap
);
params
.
put
(
"userId"
,
userId
);
params
.
put
(
"timeType"
,
timeType
);
params
.
put
(
"result"
,
result
);
params
.
put
(
"orderRule"
,
OrderByEnum
.
getEumByCode
(
orderRule
).
getOderBy
());
params
.
put
(
"beginTime"
,
beginTime
);
params
.
put
(
"endTime"
,
endTime
);
params
.
put
(
"person"
,
person
);
params
.
put
(
"team"
,
team
);
params
.
put
(
"orgCode"
,
loginOrgCode
);
CommonPageable
pageable
=
new
CommonPageable
(
pageNumber
,
pageSize
);
return
CommonResponseUtil
.
success
(
checkService
.
getCheckPage
(
params
,
pageable
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"维保记录详情"
,
notes
=
"维保记录详情"
)
@GetMapping
(
value
=
"/detail/{id}"
)
public
CommonResponse
getCheckDetail
(
@ApiParam
(
value
=
"记录Id"
)
@PathVariable
(
value
=
"id"
)
String
id
)
throws
Exception
{
return
CommonResponseUtil
.
success
(
checkService
.
getCheckDetail
(
id
));
}
}
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 @
57650feb
...
...
@@ -277,4 +277,10 @@ public interface CheckMapper extends BaseMapper {
//Map<String, String> queryUserInfoByIds(@Param(value = "userIds") String userIds);
long
getCheckCount
(
HashMap
<
String
,
Object
>
params
);
List
<
HashMap
<
String
,
Object
>>
getChecks
(
HashMap
<
String
,
Object
>
params
);
Map
<
String
,
Object
>
getCheckDetail
(
@Param
(
value
=
"id"
)
String
id
);
}
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 @
57650feb
...
...
@@ -16,6 +16,8 @@ import java.util.stream.Collectors;
import
javax.annotation.Resource
;
import
javax.transaction.Transactional
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.maintenance.core.common.request.CommonPageable
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.cxf.common.util.CollectionUtils
;
import
org.assertj.core.util.Sets
;
...
...
@@ -1152,6 +1154,34 @@ public class CheckServiceImpl implements ICheckService {
}
@Override
public
Page
<
HashMap
<
String
,
Object
>>
getCheckPage
(
HashMap
<
String
,
Object
>
params
,
CommonPageable
page
)
{
List
<
HashMap
<
String
,
Object
>>
content
=
Lists
.
newArrayList
();
long
total
=
checkMapper
.
getCheckCount
(
params
);
if
(
total
==
0
)
{
return
new
PageImpl
<>(
content
,
page
,
total
);
}
content
=
checkMapper
.
getChecks
(
params
);
if
(
0
<
content
.
size
())
{
for
(
HashMap
<
String
,
Object
>
map
:
content
)
{
if
(
map
.
containsKey
(
"isOk"
))
{
map
.
put
(
"status"
,
CheckStatusEnum
.
getEnum
(
String
.
valueOf
(
map
.
get
(
"isOk"
))));
}
if
(
map
.
containsKey
(
"address"
))
{
map
.
put
(
"address"
,
content
.
stream
().
filter
(
x
->
map
.
get
(
"checkId"
).
equals
(
x
.
get
(
"checkId"
))
&&
x
.
containsKey
(
"buildingName"
)
).
findFirst
().
get
().
get
(
"buildingName"
)
+
String
.
valueOf
(
map
.
get
(
"address"
)));
}
}
}
return
new
PageImpl
<>(
content
,
page
,
total
);
}
@Override
public
Map
<
String
,
Object
>
getCheckDetail
(
String
id
)
{
return
checkMapper
.
getCheckDetail
(
id
);
}
@Override
public
List
<
HashMap
<
String
,
Object
>>
getEquipInputByCheckId
(
CheckDetailInputPageParam
param
)
{
// 如果不传巡检ID,则获取最新一条巡检点对应的巡检记录ID
if
(
param
.
getCheckID
()
==
-
1
)
{
...
...
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 @
57650feb
...
...
@@ -4,6 +4,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.maintenance.core.common.request.CommonPageable
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.data.domain.Page
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -32,6 +34,7 @@ import com.yeejoin.amos.maintenance.core.common.response.GraphInitDataResponse;
import
com.yeejoin.amos.maintenance.core.common.response.QueryCriteriaRespone
;
import
com.yeejoin.amos.maintenance.dao.entity.CheckShot
;
import
com.yeejoin.amos.maintenance.exception.YeeException
;
import
org.springframework.web.bind.annotation.RequestParam
;
public
interface
ICheckService
{
/**
...
...
@@ -271,4 +274,8 @@ public interface ICheckService {
* @return CheckRecordDto
*/
Map
<
String
,
CheckRecordDto
>
obtainLastCheckRecord
(
String
[]
relationId
);
Page
<
HashMap
<
String
,
Object
>>
getCheckPage
(
HashMap
<
String
,
Object
>
map
,
CommonPageable
pageable
);
Map
<
String
,
Object
>
getCheckDetail
(
String
id
);
}
amos-boot-system-maintenance/src/main/resources/db/mapper/dbTemplate_check.xml
View file @
57650feb
...
...
@@ -1894,4 +1894,135 @@
d.date
</select>
<select
id=
"getChecks"
resultType=
"Map"
>
SELECT * FROM (
SELECT
pc.id checkId,
pc.user_id userId,
pc.is_ok isOk,
pc.check_time checkDate,
pc.check_time maintenanceDate,
pp.id pointId,
pp.equipment_id equipmentId,
pp.equipment_name equipmentName,
pp.belong_system_id systemId,
pp.belong_system_name systemName,
pp.address address,
pp.building_name buildingName
FROM p_check pc
LEFT JOIN p_point pp ON pp.id = pc.point_id
) a
<include
refid=
"mobile-check-record-where"
/>
limit #{offset},#{pageSize}
</select>
<sql
id=
"mobile-check-record-where"
>
<where>
<if
test=
"userId != null and userId > 0 "
>
and find_in_set(#{userId},a.userId)>0
</if>
<if
test=
"timeType != null and timeType != '' and timeType == '1' "
>
<include
refid=
"mobile-check-time-today"
></include>
</if>
<if
test=
"timeType != null and timeType != '' and timeType == '2' "
>
<include
refid=
"mobile-check-time-tomorrow"
></include>
</if>
<if
test=
"timeType != null and timeType != '' and timeType == '3' "
>
<include
refid=
"mobile-check-time-week"
></include>
</if>
<if
test=
"timeType != null and timeType != '' and timeType == '4' "
>
<include
refid=
"mobile-check-time-last-week"
></include>
</if>
<if
test=
"timeType != null and timeType != '' and timeType == '5' "
>
<include
refid=
"mobile-check-time-month"
></include>
</if>
<if
test=
"timeType != null and timeType != '' and timeType == '5' "
>
<include
refid=
"mobile-check-time-last-month"
></include>
</if>
<if
test=
"finishStatus != null"
>
and a.finishStatus = #{finishStatus}
</if>
<if
test=
"beginTime != null and beginTime != '' and endTime != null and endTime != '' "
>
AND (
(
a.beginTime
<![CDATA[>=]]>
#{beginTime}
AND a.endTime
<![CDATA[<=]]>
#{endTime}
)
OR (
a.beginTime
<![CDATA[<=]]>
#{endTime}
AND a.endTime
<![CDATA[>=]]>
#{endTime}
)
OR (
a.beginTime
<![CDATA[<=]]>
#{beginTime}
AND a.endTime
<![CDATA[>]]>
#{beginTime}
)
OR (
a.beginTime
<![CDATA[<=]]>
#{beginTime}
AND a.endTime
<![CDATA[>=]]>
#{endTime}
)
)
</if>
<choose>
<when
test=
"identityType==1"
>
And (a.orgCode LIKE CONCAT( #{orgCode}, '-%' ) or a.orgCode= #{orgCode} )
<if
test=
"companyId != null"
>
and a.owner_id = #{teamId}
</if>
</when>
<when
test=
"identityType==2"
>
And a.owner_id = #{teamId}
</when>
</choose>
</where>
<if
test=
"orderRule != null and orderRule != ''"
>
order by ${orderRule}
</if>
</sql>
<sql
id=
"mobile-check-time-today"
>
and to_days(a.checkDate)= to_days(now())
</sql>
<sql
id=
"mobile-check-time-tomorrow"
>
and to_days(now())-to_days(a.checkDate)
<![CDATA[<=]]>
1
</sql>
<sql
id=
"mobile-check-time-week"
>
and YEARWEEK(date_format(a.checkDate, '%Y-%m-%d')) = YEARWEEK(now())
</sql>
<sql
id=
"mobile-check-time-last-week"
>
and YEARWEEK(date_format(a.checkDate, '%Y-%m-%d')) = YEARWEEK(now())-1
</sql>
<sql
id=
"mobile-check-time-month"
>
and date_format(a.checkDate,'%Y-%m')=date_format(now(),'%Y-%m')
</sql>
<sql
id=
"mobile-check-time-last-month"
>
and date_format(a.checkDate,'%Y-%m')=date_format(DATE_SUB(curdate(), INTERVAL 1 MONTH),'%Y-%m')
</sql>
<select
id=
"getCheckCount"
resultType=
"long"
>
SELECT COUNT(1) checkCount
FROM (
SELECT
pc.id checkId,
pc.is_ok isOk,
pc.create_date maintenanceDate,
pp.id pointId,
pp.equipment_id equipmentId,
pp.equipment_name equipmentName,
pp.belong_system_id systemId,
pp.belong_system_name systemName,
pp.address address,
pp.building_name buildingName
FROM p_check pc
LEFT JOIN p_point pp ON pp.id = pc.point_id
) a
<include
refid=
"mobile-check-record-where"
/>
</select>
<select
id=
"getCheckDetail"
resultType=
"Map"
>
SELECT
pc.id checkId,
pc.is_ok isOk,
pc.create_date maintenanceDate,
pp.id pointId,
pp.equipment_id equipmentId,
pp.equipment_name equipmentName,
pp.belong_system_id systemId,
pp.belong_system_name systemName,
CONCAT(pp.address, pp.building_name) address
FROM p_check pc
LEFT JOIN p_point pp ON pp.id = pc.point_id
WHERE
pc.id = #{id}
</select>
</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