增加查询条件

This commit is contained in:
lujiang 2024-08-29 23:01:48 +08:00
parent a73e5c6e54
commit a6098c8b53
7 changed files with 129 additions and 6 deletions

View File

@ -114,6 +114,9 @@ public class RepairController extends BaseController {
* room门牌号模糊查询 * room门牌号模糊查询
* explain描述模糊查询 * explain描述模糊查询
* failureTypeId故障类型id精确查询 * failureTypeId故障类型id精确查询
* remark: yes 5110工单 no 普通工单
* evalService: 1 好评 2 中评 3 差评其他值无效
* timeout: 9 查询超时工单其他值无效
* beginTime : 工单创建日期范围开始时间;格式示例 2024-08-22成对出现 * beginTime : 工单创建日期范围开始时间;格式示例 2024-08-22成对出现
* endTime : 工单创建日期范围结束时间;格式示例 2024-08-25成对出现 * endTime : 工单创建日期范围结束时间;格式示例 2024-08-25成对出现
* *

View File

@ -38,10 +38,25 @@ public class RepairStatsController extends BaseController {
/** /**
* 人员绩效维修人员 * 人员绩效维修人员
* 支持查询参数
* username 姓名
* mobile 手机号
* typeid 设备类型id
* startDate 工单创建日期范围开始时间;格式示例 2024-08-22成对出现
* endDate 工单创建日期范围结束时间;格式示例 2024-08-25成对出现
*
*/ */
@RequiresPermissions(value = {"repair:manage:operator"}) @RequiresPermissions(value = {"repair:manage:operator"})
@RequestMapping("workerList") @RequestMapping("workerList")
public R workerList(RepairWorkerStatsVo repairWorkerStatsVo) { public R workerList(RepairWorkerStatsVo repairWorkerStatsVo) {
try {
if (StringUtils.isNotBlank(repairWorkerStatsVo.getStartDate()) && StringUtils.isNotBlank(repairWorkerStatsVo.getEndDate())) {
repairWorkerStatsVo.setStart(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, repairWorkerStatsVo.getStartDate() + " 00:00:00"));
repairWorkerStatsVo.setEnd(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, repairWorkerStatsVo.getEndDate() + " 23:59:59"));
}
} catch (Exception e) {
return R.error("参数错误");
}
startPage(); startPage();
return result(repairWorkerStatsService.selectRepairWorkerStatsList(repairWorkerStatsVo)); return result(repairWorkerStatsService.selectRepairWorkerStatsList(repairWorkerStatsVo));
} }
@ -64,10 +79,27 @@ public class RepairStatsController extends BaseController {
/** /**
* 人员绩效楼层管理员 * 人员绩效楼层管理员
*
* 支持查询参数
* username 姓名
* mobile 手机号
* adr 地址名称地点楼层等
* startDate 工单创建日期范围开始时间;格式示例 2024-08-22成对出现
* endDate 工单创建日期范围结束时间;格式示例 2024-08-25成对出现
*/ */
@RequiresPermissions(value = {"repair:manage:operator"}) @RequiresPermissions(value = {"repair:manage:operator"})
@RequestMapping("floorList") @RequestMapping("floorList")
public R floorList(RepairFloorStatsVo repairFloorStatsVo) { public R floorList(RepairFloorStatsVo repairFloorStatsVo) {
try {
if (StringUtils.isNotBlank(repairFloorStatsVo.getStartDate()) && StringUtils.isNotBlank(repairFloorStatsVo.getEndDate())) {
Date start = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, repairFloorStatsVo.getStartDate() + " 00:00:00");
repairFloorStatsVo.setStart(start);
Date end = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, repairFloorStatsVo.getEndDate() + " 23:59:59");
repairFloorStatsVo.setEnd(end);
}
} catch (Exception e) {
return R.error("参数错误");
}
startPage(); startPage();
return result(repairWorkerStatsService.selectRepairFloorStatsVoList(repairFloorStatsVo)); return result(repairWorkerStatsService.selectRepairFloorStatsVoList(repairFloorStatsVo));
} }

View File

@ -1,8 +1,10 @@
package com.ics.admin.vo; package com.ics.admin.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 对应视图floor_stats * 对应视图floor_stats
@ -73,4 +75,16 @@ public class RepairFloorStatsVo implements Serializable {
* 差评 * 差评
*/ */
private String l; private String l;
@JsonIgnore
private String startDate;
@JsonIgnore
private Date start;
@JsonIgnore
private String endDate;
@JsonIgnore
private Date end;
} }

View File

@ -1,8 +1,10 @@
package com.ics.admin.vo; package com.ics.admin.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* 对应视图worker_stats * 对应视图worker_stats
@ -54,4 +56,16 @@ public class RepairWorkerStatsVo implements Serializable {
/** 差评 */ /** 差评 */
private String l; private String l;
@JsonIgnore
private String startDate;
@JsonIgnore
private Date start;
@JsonIgnore
private String endDate;
@JsonIgnore
private Date end;
} }

View File

@ -250,6 +250,12 @@
<if test="room != null and room != ''"> AND rep.room LIKE CONCAT('%', #{room}, '%')</if> <if test="room != null and room != ''"> AND rep.room LIKE CONCAT('%', #{room}, '%')</if>
<if test="explain != null and explain != ''"> AND rep.`explain` LIKE CONCAT('%', #{explain}, '%')</if> <if test="explain != null and explain != ''"> AND rep.`explain` LIKE CONCAT('%', #{explain}, '%')</if>
<if test="failureTypeId != null"> AND rep.failure_type_id = #{failureTypeId}</if> <if test="failureTypeId != null"> AND rep.failure_type_id = #{failureTypeId}</if>
<if test="remark != null and remark=='yes'"> AND rep.remark = '5110'</if>
<if test="remark != null and remark=='no'"> AND rep.remark is null</if>
<if test="evalService != null and evalService==1"> AND rep.eval_service &gt;= 4</if>
<if test="evalService != null and evalService==2"> AND rep.eval_service = 3</if>
<if test="evalService != null and evalService==3"> AND rep.eval_service &lt;= 2</if>
<if test="timeout != null and timeout==9"> and predate &lt; now() and status &lt; 9</if>
order by create_time desc order by create_time desc
</select> </select>

View File

@ -3,13 +3,41 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ics.admin.mapper.RepairStatsMapper"> <mapper namespace="com.ics.admin.mapper.RepairStatsMapper">
<!-- 人员绩效 维修工 -->
<select id="selectRepairWorkerStatsList" parameterType="com.ics.admin.vo.RepairWorkerStatsVo" resultType="com.ics.admin.vo.RepairWorkerStatsVo"> <select id="selectRepairWorkerStatsList" parameterType="com.ics.admin.vo.RepairWorkerStatsVo" resultType="com.ics.admin.vo.RepairWorkerStatsVo">
SELECT id, username, mobile, typeid, typename, zs, process, closed, Unresolved, pj, SELECT id, username, mobile, typeid, typename, zs, process, closed, Unresolved, pj,
case when pj>0 then CONCAT(h,'',ROUND(h/pj*100,1),'%') else '00%' end as h, case when pj>0 then CONCAT(h,'',ROUND(h/pj*100,1),'%') else '00%' end as h,
case when pj>0 then CONCAT(m,'',ROUND(m/pj*100,1),'%') else '00%' end as m, case when pj>0 then CONCAT(m,'',ROUND(m/pj*100,1),'%') else '00%' end as m,
case when pj>0 then CONCAT(l,'',ROUND(l/pj*100,1),'%') else '00%' end as l case when pj>0 then CONCAT(l,'',ROUND(l/pj*100,1),'%') else '00%' end as l
FROM worker_stats FROM
<![CDATA[
(
select
user.id,user.username username,user.mobile,dt.id typeid,dt.name typename,
count(rep.id) as zs,
SUM(case when rep.status=5 or rep.status=7 then 1 else 0 end) as process,
SUM(case when rep.status=9 or rep.status=13 then 1 else 0 end) as closed,
SUM(case when rep.resolve=0 then 1 else 0 end) as Unresolved,
count(rep.eval_service) pj,
SUM(case when rep.eval_service>=4 then 1 else 0 end) as h,
SUM(case when rep.eval_service=3 then 1 else 0 end) as m,
SUM(case when rep.eval_service<=2 then 1 else 0 end) as l
from
ics_customer_staff user, ics_repair rep, ics_repair_device_type dt
where
user.delete_flag=0 and rep.delete_flag=0 and dt.delete_flag=0
and user.id=rep.repair_user_id and rep.type_id=dt.id
]]>
<if test="start != null and end != null">
and rep.create_time between #{start} and #{end}
</if>
<![CDATA[
and (rep.status=5 or rep.status=7 or rep.status=9 or rep.status=13)
GROUP BY
user.id,user.name,user.mobile,dt.id,dt.name
) tb
]]>
<where> <where>
<if test="username != null and username != ''">AND username LIKE CONCAT('%', #{username}, '%')</if> <if test="username != null and username != ''">AND username LIKE CONCAT('%', #{username}, '%')</if>
<if test="mobile != null and mobile != ''">AND mobile LIKE CONCAT('%', #{mobile}, '%')</if> <if test="mobile != null and mobile != ''">AND mobile LIKE CONCAT('%', #{mobile}, '%')</if>
@ -17,12 +45,38 @@
</where> </where>
</select> </select>
<!-- 人员绩效 楼层管理员 -->
<select id="selectRepairFloorStatsVoList" parameterType="com.ics.admin.vo.RepairFloorStatsVo" resultType="com.ics.admin.vo.RepairFloorStatsVo"> <select id="selectRepairFloorStatsVoList" parameterType="com.ics.admin.vo.RepairFloorStatsVo" resultType="com.ics.admin.vo.RepairFloorStatsVo">
SELECT id, name, mobile, adr, zs, process, closed, Unresolved, pj, SELECT id, name, mobile, adr, zs, process, closed, Unresolved, pj,
case when pj>0 then CONCAT(h,'',ROUND(h/pj*100,1),'%') else '00%' end as h, case when pj>0 then CONCAT(h,'',ROUND(h/pj*100,1),'%') else '00%' end as h,
case when pj>0 then CONCAT(m,'',ROUND(m/pj*100,1),'%') else '00%' end as m, case when pj>0 then CONCAT(m,'',ROUND(m/pj*100,1),'%') else '00%' end as m,
case when pj>0 then CONCAT(l,'',ROUND(l/pj*100,1),'%') else '00%' end as l case when pj>0 then CONCAT(l,'',ROUND(l/pj*100,1),'%') else '00%' end as l
FROM floor_stats FROM
<![CDATA[
(
select user.id,user.username name,user.mobile,group_concat(DISTINCT CONCAT(ad.name,'/',floor.name)) adr,
count(rep.id) as zs,
SUM(case when rep.status<9 then 1 else 0 end) as process,
SUM(case when rep.status>=9 then 1 else 0 end) as closed,
SUM(case when rep.resolve=0 then 1 else 0 end) as Unresolved,
count(rep.eval_service) pj,
SUM(case when rep.eval_service>=4 then 1 else 0 end) as h,
SUM(case when rep.eval_service=3 then 1 else 0 end) as m,
SUM(case when rep.eval_service<=2 then 1 else 0 end) as l
from
ics_customer_staff user, ics_repair_address ad, ics_repair_address_floor floor, ics_repair rep
where
user.delete_flag=0 and floor.delete_flag=0 and rep.delete_flag=0 and ad.delete_flag=0
and user.id=floor.admin_id and floor.address_id=ad.id and floor.id=rep.floor_id
]]>
<if test="start != null and end != null">
and rep.create_time between #{start} and #{end}
</if>
<![CDATA[
GROUP BY
user.id,user.name,user.mobile
) tb
]]>
<where> <where>
<if test="name != null and name != ''">AND name LIKE CONCAT('%', #{name}, '%')</if> <if test="name != null and name != ''">AND name LIKE CONCAT('%', #{name}, '%')</if>
<if test="mobile != null and mobile != ''">AND mobile LIKE CONCAT('%', #{mobile}, '%')</if> <if test="mobile != null and mobile != ''">AND mobile LIKE CONCAT('%', #{mobile}, '%')</if>
@ -39,7 +93,7 @@
case when pj>0 then CONCAT(l,'',ROUND(l/pj*100,1),'%') else '00%' end as l case when pj>0 then CONCAT(l,'',ROUND(l/pj*100,1),'%') else '00%' end as l
FROM FROM
( (
select user.id,user.name,user.mobile, select user.id,user.username name,user.mobile,
count(rep.id) as zs, count(rep.id) as zs,
SUM(case when rep.status<9 then 1 else 0 end) as process, SUM(case when rep.status<9 then 1 else 0 end) as process,
SUM(case when rep.status>=9 then 1 else 0 end) as closed, SUM(case when rep.status>=9 then 1 else 0 end) as closed,

View File

@ -1,6 +1,6 @@
CREATE VIEW worker_stats AS CREATE VIEW worker_stats AS
select select
user.id,user.name username,user.mobile,dt.id typeid,dt.name typename, user.id,user.username username,user.mobile,dt.id typeid,dt.name typename,
count(rep.id) as zs, count(rep.id) as zs,
SUM(case when rep.status=5 or rep.status=7 then 1 else 0 end) as process, SUM(case when rep.status=5 or rep.status=7 then 1 else 0 end) as process,
SUM(case when rep.status=9 or rep.status=13 then 1 else 0 end) as closed, SUM(case when rep.status=9 or rep.status=13 then 1 else 0 end) as closed,
@ -20,7 +20,7 @@ GROUP BY
CREATE VIEW floor_stats AS CREATE VIEW floor_stats AS
select user.id,user.name,user.mobile,group_concat(DISTINCT CONCAT(ad.name,'/',floor.name)) adr, select user.id,user.username name,user.mobile,group_concat(DISTINCT CONCAT(ad.name,'/',floor.name)) adr,
count(rep.id) as zs, count(rep.id) as zs,
SUM(case when rep.status<9 then 1 else 0 end) as process, SUM(case when rep.status<9 then 1 else 0 end) as process,
SUM(case when rep.status>=9 then 1 else 0 end) as closed, SUM(case when rep.status>=9 then 1 else 0 end) as closed,