mirror of
https://gitee.com/elegant_wings/dbd-meeting.git
synced 2025-06-21 18:19:36 +08:00
统计功能补充
This commit is contained in:
parent
98c57ab65b
commit
c4d5fb7107
@ -89,4 +89,42 @@ public class RepairStatsController extends BaseController {
|
|||||||
return R.ok().put("currentMonth", repairWorkerStatsService.repairStats(true))
|
return R.ok().put("currentMonth", repairWorkerStatsService.repairStats(true))
|
||||||
.put("currentYear", repairWorkerStatsService.repairStats(false));
|
.put("currentYear", repairWorkerStatsService.repairStats(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第四行 左侧 楼层负责人情况统计
|
||||||
|
*/
|
||||||
|
@RequiresPermissions(value = {"repair:manage:operator"})
|
||||||
|
@RequestMapping("floorStats")
|
||||||
|
public R floorStats(String date) {
|
||||||
|
return R.ok().put("data", repairWorkerStatsService.floorStats(date));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第四行 右上 设备故障统计
|
||||||
|
*/
|
||||||
|
@RequiresPermissions(value = {"repair:manage:operator"})
|
||||||
|
@RequestMapping("deviceStats")
|
||||||
|
public R deviceStats(String date) {
|
||||||
|
return R.ok().put("data", repairWorkerStatsService.deviceStats(date));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第四行 右下 故障类型统计
|
||||||
|
*/
|
||||||
|
@RequiresPermissions(value = {"repair:manage:operator"})
|
||||||
|
@RequestMapping("failureStats")
|
||||||
|
public R failureStats(String date) {
|
||||||
|
return R.ok().put("data", repairWorkerStatsService.failureStats(date));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第五行 设备、品牌、评价 统计
|
||||||
|
*/
|
||||||
|
@RequiresPermissions(value = {"repair:manage:operator"})
|
||||||
|
@RequestMapping("deviceTypeStats")
|
||||||
|
public R deviceTypeStats(String date) {
|
||||||
|
startPage();
|
||||||
|
return result(repairWorkerStatsService.deviceTypeStats(date));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.ics.admin.mapper;
|
package com.ics.admin.mapper;
|
||||||
|
|
||||||
import com.ics.admin.vo.RepairAdminStatsVo;
|
import com.ics.admin.vo.RepairAdminStatsVo;
|
||||||
|
import com.ics.admin.vo.RepairDivceTypeStatsVo;
|
||||||
import com.ics.admin.vo.RepairFloorStatsVo;
|
import com.ics.admin.vo.RepairFloorStatsVo;
|
||||||
import com.ics.admin.vo.RepairStatsVo;
|
import com.ics.admin.vo.RepairStatsVo;
|
||||||
import com.ics.admin.vo.RepairWorkerStatsVo;
|
import com.ics.admin.vo.RepairWorkerStatsVo;
|
||||||
@ -46,4 +47,23 @@ public interface RepairStatsMapper {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<RepairStatsVo> repairStats(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
List<RepairStatsVo> repairStats(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第四行 左侧 楼层负责人情况统计
|
||||||
|
*/
|
||||||
|
List<RepairFloorStatsVo> floorStats(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第四行 右上 设备故障统计
|
||||||
|
*/
|
||||||
|
List<RepairFloorStatsVo> deviceStats(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第四行 右下 故障类型统计
|
||||||
|
*/
|
||||||
|
List<RepairFloorStatsVo> failureStats(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
/**
|
||||||
|
* 第五行 设备、品牌、评价 统计
|
||||||
|
*/
|
||||||
|
List<RepairDivceTypeStatsVo> deviceTypeStats(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,18 @@ package com.ics.admin.service;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ics.admin.vo.RepairAdminStatsVo;
|
import com.ics.admin.vo.RepairAdminStatsVo;
|
||||||
|
import com.ics.admin.vo.RepairDivceTypeStatsVo;
|
||||||
import com.ics.admin.vo.RepairFloorStatsVo;
|
import com.ics.admin.vo.RepairFloorStatsVo;
|
||||||
import com.ics.admin.vo.RepairStatsVo;
|
import com.ics.admin.vo.RepairStatsVo;
|
||||||
import com.ics.admin.vo.RepairWorkerStatsVo;
|
import com.ics.admin.vo.RepairWorkerStatsVo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 维修人员统计接口
|
* 维修人员统计接口
|
||||||
*
|
*
|
||||||
* @author ics
|
* @author ics
|
||||||
* @date 2024-08-15
|
* @date 2024-08-15
|
||||||
@ -36,10 +39,32 @@ public interface IRepairStatsService {
|
|||||||
* 第一行 管理员 工单与 通知统计
|
* 第一行 管理员 工单与 通知统计
|
||||||
*/
|
*/
|
||||||
RepairAdminStatsVo repairAdminStats();
|
RepairAdminStatsVo repairAdminStats();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 第二、三行 工单统计、工单完成情况、评价情况
|
* 第二、三行 工单统计、工单完成情况、评价情况
|
||||||
|
*
|
||||||
* @param isMonth true 本月,false 本年
|
* @param isMonth true 本月,false 本年
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<String, Object> repairStats(boolean isMonth);
|
Map<String, Object> repairStats(boolean isMonth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第四行 左侧 楼层负责人情况统计
|
||||||
|
*/
|
||||||
|
Map<String, Object> floorStats(String date);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第四行 右上 设备故障统计
|
||||||
|
*/
|
||||||
|
Map<String, Object> deviceStats(String date);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第四行 右下 故障类型统计
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> failureStats(String date);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第五行 设备、品牌、评价 统计
|
||||||
|
*/
|
||||||
|
List<RepairDivceTypeStatsVo> deviceTypeStats(String date);
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,16 @@ package com.ics.admin.service.impl;
|
|||||||
import com.ics.admin.mapper.RepairStatsMapper;
|
import com.ics.admin.mapper.RepairStatsMapper;
|
||||||
import com.ics.admin.service.IRepairStatsService;
|
import com.ics.admin.service.IRepairStatsService;
|
||||||
import com.ics.admin.vo.RepairAdminStatsVo;
|
import com.ics.admin.vo.RepairAdminStatsVo;
|
||||||
|
import com.ics.admin.vo.RepairDivceTypeStatsVo;
|
||||||
import com.ics.admin.vo.RepairFloorStatsVo;
|
import com.ics.admin.vo.RepairFloorStatsVo;
|
||||||
import com.ics.admin.vo.RepairStatsVo;
|
import com.ics.admin.vo.RepairStatsVo;
|
||||||
import com.ics.admin.vo.RepairWorkerStatsVo;
|
import com.ics.admin.vo.RepairWorkerStatsVo;
|
||||||
import com.ics.common.utils.DateUtils;
|
import com.ics.common.utils.DateUtils;
|
||||||
|
import com.ics.common.utils.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -86,6 +89,106 @@ public class RepairStatsServiceImpl implements IRepairStatsService {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> floorStats(String date) {
|
||||||
|
Date[] dates = getStartEndTime(date);
|
||||||
|
if (dates == null) return null;
|
||||||
|
List<RepairFloorStatsVo> list = repairStatsMapper.floorStats(dates[0], dates[1]);
|
||||||
|
List<String> y = new ArrayList<>();
|
||||||
|
List<Long> zs = new ArrayList<>();
|
||||||
|
List<Long> wc = new ArrayList<>();
|
||||||
|
for (RepairFloorStatsVo repairFloorStatsVo : list) {
|
||||||
|
y.add(repairFloorStatsVo.getName());
|
||||||
|
zs.add(repairFloorStatsVo.getZs());
|
||||||
|
wc.add(repairFloorStatsVo.getClosed());
|
||||||
|
}
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("y", y);
|
||||||
|
map.put("total", zs);
|
||||||
|
map.put("finish", wc);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> deviceStats(String date) {
|
||||||
|
Date[] dates = getStartEndTime(date);
|
||||||
|
if (dates == null) return null;
|
||||||
|
List<RepairFloorStatsVo> list = repairStatsMapper.deviceStats(dates[0], dates[1]);
|
||||||
|
List<String> x = new ArrayList<>();
|
||||||
|
List<Long> zs = new ArrayList<>();
|
||||||
|
List<Long> wc = new ArrayList<>();
|
||||||
|
for (RepairFloorStatsVo repairFloorStatsVo : list) {
|
||||||
|
x.add(repairFloorStatsVo.getName());
|
||||||
|
zs.add(repairFloorStatsVo.getZs());
|
||||||
|
wc.add(repairFloorStatsVo.getClosed());
|
||||||
|
}
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("x", x);
|
||||||
|
map.put("total", zs);
|
||||||
|
map.put("finish", wc);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> failureStats(String date) {
|
||||||
|
Date[] dates = getStartEndTime(date);
|
||||||
|
if (dates == null) return null;
|
||||||
|
List<RepairFloorStatsVo> list = repairStatsMapper.failureStats(dates[0], dates[1]);
|
||||||
|
List<Map<String, Object>> data = new ArrayList<>();
|
||||||
|
for (RepairFloorStatsVo repairFloorStatsVo : list) {
|
||||||
|
data.add(getMap(repairFloorStatsVo.getName(), repairFloorStatsVo.getZs()));
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RepairDivceTypeStatsVo> deviceTypeStats(String date) {
|
||||||
|
Date[] dates = getStartEndTime(date);
|
||||||
|
if (dates == null) return null;
|
||||||
|
List<RepairDivceTypeStatsVo> list = repairStatsMapper.deviceTypeStats(dates[0], dates[1]);
|
||||||
|
for (RepairDivceTypeStatsVo rdtStatsVo : list) {
|
||||||
|
rdtStatsVo.setWcl(compute(rdtStatsVo.getClosed(), rdtStatsVo.getZs()));
|
||||||
|
rdtStatsVo.setHl(compute(rdtStatsVo.getH(), rdtStatsVo.getPj()));
|
||||||
|
rdtStatsVo.setMl(compute(rdtStatsVo.getM(), rdtStatsVo.getPj()));
|
||||||
|
rdtStatsVo.setLl(compute(rdtStatsVo.getL(), rdtStatsVo.getPj()));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算百分比
|
||||||
|
*/
|
||||||
|
private String compute(long fz, long fm) {
|
||||||
|
if (fm > 0) {
|
||||||
|
DecimalFormat df = new DecimalFormat("#.##");
|
||||||
|
return df.format((double) fz / fm * 100) + "%";
|
||||||
|
}
|
||||||
|
return "0%";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析开始时间和结束时间
|
||||||
|
*/
|
||||||
|
private Date[] getStartEndTime(String date) {
|
||||||
|
if (StringUtils.isBlank(date)) return null;
|
||||||
|
Date startTime, endTime;
|
||||||
|
try {
|
||||||
|
if (date.indexOf("-") > 1) {//年月
|
||||||
|
String[] ym = date.split("-");
|
||||||
|
Calendar calendar = getCalendar(Integer.valueOf(ym[0]), Integer.valueOf(ym[1]));
|
||||||
|
startTime = getDate(calendar, 2, true);
|
||||||
|
endTime = getDate(calendar, 2, false);
|
||||||
|
} else {//年
|
||||||
|
Calendar calendar = getCalendar(Integer.valueOf(date), 0);
|
||||||
|
startTime = getDate(calendar, 3, true);
|
||||||
|
endTime = getDate(calendar, 3, false);
|
||||||
|
}
|
||||||
|
return new Date[]{startTime, endTime};
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Map<String, Object> getMap(String name, Object value) {
|
private Map<String, Object> getMap(String name, Object value) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("name", name);
|
map.put("name", name);
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
package com.ics.admin.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型、设备、品牌统计
|
||||||
|
* created at 2024-8-15 21:18
|
||||||
|
*
|
||||||
|
* @author lujiang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RepairDivceTypeStatsVo implements Serializable {
|
||||||
|
private static final long serialVersionUID = -202408171342L;
|
||||||
|
/**
|
||||||
|
* 类型id
|
||||||
|
*/
|
||||||
|
private Long typeid;
|
||||||
|
/**
|
||||||
|
* 类型名
|
||||||
|
*/
|
||||||
|
private String typename;
|
||||||
|
/**
|
||||||
|
* 设备名
|
||||||
|
*/
|
||||||
|
private String devicename;
|
||||||
|
/**
|
||||||
|
* 品牌
|
||||||
|
*/
|
||||||
|
private String brand;
|
||||||
|
/**
|
||||||
|
* 工单总数
|
||||||
|
*/
|
||||||
|
private Long zs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已完成
|
||||||
|
*/
|
||||||
|
private Long closed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 完成率
|
||||||
|
*/
|
||||||
|
private String wcl;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
/** 评价总数 */
|
||||||
|
private Long pj;
|
||||||
|
@JsonIgnore
|
||||||
|
/** 好评 */
|
||||||
|
private Long h;
|
||||||
|
@JsonIgnore
|
||||||
|
/** 中评 */
|
||||||
|
private Long m;
|
||||||
|
@JsonIgnore
|
||||||
|
/** 差评 */
|
||||||
|
private Long l;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 好评率
|
||||||
|
*/
|
||||||
|
private String hl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中评率
|
||||||
|
*/
|
||||||
|
private String ml;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 差评率
|
||||||
|
*/
|
||||||
|
private String ll;
|
||||||
|
|
||||||
|
}
|
@ -62,5 +62,63 @@
|
|||||||
]]>
|
]]>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 第四行 左侧 楼层负责人情况统计 -->
|
||||||
|
<select id="floorStats" resultType="com.ics.admin.vo.RepairFloorStatsVo">
|
||||||
|
<![CDATA[
|
||||||
|
SELECT USER.id, USER.NAME, count( rep.id ) AS zs,
|
||||||
|
SUM( CASE WHEN rep.STATUS >= 9 THEN 1 ELSE 0 END ) AS closed
|
||||||
|
FROM
|
||||||
|
ics_customer_staff USER,ics_repair_address_floor floor,ics_repair rep
|
||||||
|
WHERE
|
||||||
|
USER.delete_flag = 0 AND floor.delete_flag = 0 AND rep.delete_flag = 0
|
||||||
|
AND USER.id = floor.admin_id AND floor.id = rep.floor_id
|
||||||
|
and rep.create_time between #{startTime} and #{endTime}
|
||||||
|
GROUP BY USER.id,USER.NAME
|
||||||
|
order by zs desc
|
||||||
|
]]>
|
||||||
|
</select>
|
||||||
|
<!-- 第四行 右上 设备故障统计 -->
|
||||||
|
<select id="deviceStats" resultType="com.ics.admin.vo.RepairFloorStatsVo">
|
||||||
|
<![CDATA[
|
||||||
|
SELECT device.id, device.name, count(rep.id) AS zs, SUM(CASE WHEN rep.STATUS >= 9 THEN 1 ELSE 0 END) AS closed
|
||||||
|
FROM ics_repair_device device, ics_repair rep
|
||||||
|
WHERE
|
||||||
|
device.delete_flag = 0 AND rep.delete_flag = 0 AND device.id = rep.device_id
|
||||||
|
and rep.create_time between #{startTime} and #{endTime}
|
||||||
|
GROUP BY device.id, device.NAME
|
||||||
|
order by zs desc
|
||||||
|
]]>
|
||||||
|
</select>
|
||||||
|
<!-- 第四行 右下 故障类型统计 -->
|
||||||
|
<select id="failureStats" resultType="com.ics.admin.vo.RepairFloorStatsVo">
|
||||||
|
<![CDATA[
|
||||||
|
SELECT
|
||||||
|
failure.id,failure.name,count( rep.id ) AS zs
|
||||||
|
FROM
|
||||||
|
ics_repair_failure_type failure,ics_repair rep
|
||||||
|
WHERE
|
||||||
|
rep.delete_flag = 0 AND failure.delete_flag = 0 and (rep.status=9 or rep.status=13)
|
||||||
|
AND failure.id = rep.failure_type_id and rep.create_time between #{startTime} and #{endTime}
|
||||||
|
GROUP BY failure.id,failure.NAME order by zs desc
|
||||||
|
]]>
|
||||||
|
</select>
|
||||||
|
<!-- 第五行 设备、品牌、评价 统计 -->
|
||||||
|
<select id="deviceTypeStats" resultType="com.ics.admin.vo.RepairDivceTypeStatsVo">
|
||||||
|
<![CDATA[
|
||||||
|
SELECT dt.id typeid, dt.name typename, device.name devicename, device.brand,
|
||||||
|
count(rep.id) AS zs,
|
||||||
|
sum(CASE WHEN rep.STATUS >= 9 THEN 1 ELSE 0 END) AS closed,
|
||||||
|
sum(case when eval_service is not null then 1 else 0 end) as pj,
|
||||||
|
sum(case when eval_service is not null and eval_service >=4 then 1 else 0 end) as h,
|
||||||
|
sum(case when eval_service is not null and eval_service =3 then 1 else 0 end) as m,
|
||||||
|
sum(case when eval_service is not null and eval_service <=2 then 1 else 0 end) as l
|
||||||
|
FROM ics_repair_device_type dt, ics_repair_device device, ics_repair rep
|
||||||
|
WHERE
|
||||||
|
dt.delete_flag=0 and device.delete_flag = 0 AND rep.delete_flag = 0
|
||||||
|
and dt.id=device.type_id AND device.id = rep.device_id
|
||||||
|
and rep.create_time between #{startTime} and #{endTime}
|
||||||
|
GROUP BY dt.id, dt.name, device.name
|
||||||
|
order by zs desc
|
||||||
|
]]>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -72,8 +72,9 @@ dfs:
|
|||||||
#path: /Users/lihongyuan/IdeaProjects/saas-ics/ics/
|
#path: /Users/lihongyuan/IdeaProjects/saas-ics/ics/
|
||||||
# domain: http://222.184.49.22:9227
|
# domain: http://222.184.49.22:9227
|
||||||
# path: D:/ruoyi/uploadPath
|
# path: D:/ruoyi/uploadPath
|
||||||
domain: http://192.168.0.11:9227
|
domain: http://127.0.0.1:9227
|
||||||
path: F:/ruoyi/uploadPath
|
path: E:/ruoyi/uploadPath
|
||||||
|
|
||||||
|
|
||||||
# 公众号配置(必填)
|
# 公众号配置(必填)
|
||||||
wx:
|
wx:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user