Commit 1f3af219 authored by lisong's avatar lisong

坐席处理事件统计接口修改

parent bfc0baad
......@@ -109,8 +109,8 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
List<AlertPaperInfoDto> getEquipmentHistory(@Param("regionCodes") List<String> regionCodes, @Param("equipmentClassCode") String equipmentClassCode, @Param("current") Integer current, @Param("pageNum") Integer pageNum, @Param("equipmentCode") String equipmentCode);
@Select("select count(1) from tz_alert_called where rec_user_name =#{userName} and rec_date >= #{startTime} and rec_date <= #{endTime}")
Integer getCountNum(String userName, Date startTime, Date endTime);
@Select("select count(1) from tz_alert_called where rec_user_name =#{userName} and rec_date >= #{startTime} and rec_date <= #{endTime} and skill_group = #{groupCode} ")
Integer getCountNum(String userName, Date startTime, Date endTime, String groupCode);
Map<String, Long> getMyBacklog(String groupCode);
}
......@@ -481,7 +481,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
}
citInfoDto.setStatus(status);
}
citInfoDto.setCountNum(countNum(citInfo.getCtiUserName()));
citInfoDto.setCountNum(countNum(citInfo.getCtiUserName(), citInfo.getCtiUserId()));
citInfoDtoList.add(citInfoDto);
}
// List<AgencyUserModel> userList = userListResult.getResult();
......@@ -931,7 +931,9 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
// 今日值班人员接警数量统计
public Integer countNum(String userName){
public Integer countNum(String userName, String userId){
//获取当前登录人所在的技能组code
String groupCode = ctiService.getSkillGroup(userId);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String format = simpleDateFormat.format(new Date());
StrBuilder strBuilderStart = new StrBuilder();
......@@ -948,6 +950,6 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
e.printStackTrace();
logger.error("日期转化失敗:" + e.getMessage());
}
return alertCalledMapper.getCountNum(userName,startTime,endTime);
return alertCalledMapper.getCountNum(userName, startTime, endTime, groupCode);
}
}
\ No newline at end of file
......@@ -80,6 +80,7 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
AlertStatistics statistics = new AlertStatistics();
String startDate = null;
String endDate = null;
if (!ObjectUtils.isEmpty(alertStatistics)){
for (AlertStatistics item : alertStatistics) {
if (ObjectUtils.isEmpty(startDate)) {
startDate = item.getStartDate();
......@@ -99,7 +100,17 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
statistics.setAvgDaysEmergencyEvents(ObjectUtils.isEmpty(statistics.getEmergencyEvents()) ? String.valueOf(item.getEmergencyEvents()) : String.valueOf(item.getEmergencyEvents() + statistics.getEmergencyEvents()));
statistics.setAvgDaysTrappedPeople(ObjectUtils.isEmpty(statistics.getTrappedPeople()) ? String.valueOf(item.getTrappedPeople()) : String.valueOf(item.getTrappedPeople() + statistics.getTrappedPeople()));
statistics.setAvgDaysBreakdownRescue(ObjectUtils.isEmpty(statistics.getBreakdownRescue()) ? String.valueOf(item.getBreakdownRescue()) : String.valueOf(item.getBreakdownRescue() + statistics.getBreakdownRescue()));
}
}else {
statistics.setElevatorNum(0);
statistics.setEmergencyEvents(0);
statistics.setTrappedPeople(0);
statistics.setBreakdownRescue(0);
statistics.setRescuePersonnel(0);
statistics.setComplaint(0);
statistics.setAvgDaysEmergencyEvents("0");
statistics.setAvgDaysTrappedPeople("0");
statistics.setAvgDaysBreakdownRescue("0");
}
statistics.setSupervisoryUnitName("合计");
statistics.setSequenceNbr(0L);
......@@ -108,7 +119,6 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
if (ObjectUtils.isEmpty(statistics.getEmergencyEvents()) || ObjectUtils.isEmpty(statistics.getElevatorNum()) || statistics.getEmergencyEvents() == 0 || statistics.getElevatorNum() == 0) {
statistics.setFailureRate("0%");
} else {
BigDecimal bigDecimal = new BigDecimal(statistics.getEmergencyEvents().toString());
BigDecimal bigDecimal1 = new BigDecimal(statistics.getElevatorNum().toString());
......@@ -119,25 +129,34 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
AlertStatistics avg = new AlertStatistics();
avg.setSupervisoryUnitName("平均每天");
avg.setSequenceNbr(1L);
long days = DateUtil.betweenDay(simpleDateFormat.parse(startDate), simpleDateFormat.parse(endDate), true);
long days = 0L;
if (!ObjectUtils.isEmpty(startDate) && !ObjectUtils.isEmpty(endDate)) {
days = DateUtil.betweenDay(simpleDateFormat.parse(startDate), simpleDateFormat.parse(endDate), true);
}
int avgNum = Integer.parseInt(String.valueOf(days));
if (!ObjectUtils.isEmpty(statistics.getEmergencyEvents()) && statistics.getEmergencyEvents() != 0 && avgNum != 0) {
BigDecimal bigDecimal = new BigDecimal(statistics.getEmergencyEvents().toString());
BigDecimal bigDecimal1 = new BigDecimal(avgNum);
BigDecimal divide = bigDecimal.divide(bigDecimal1, 6, BigDecimal.ROUND_HALF_UP);
avg.setAvgDaysEmergencyEvents(decimalFormatAvg.format(divide));
}else {
avg.setAvgDaysEmergencyEvents("0");
}
if (!ObjectUtils.isEmpty(statistics.getTrappedPeople()) && statistics.getTrappedPeople() != 0 && avgNum != 0) {
BigDecimal bigDecimal = new BigDecimal(statistics.getTrappedPeople().toString());
BigDecimal bigDecimal1 = new BigDecimal(avgNum);
BigDecimal divide = bigDecimal.divide(bigDecimal1, 6, BigDecimal.ROUND_HALF_UP);
avg.setAvgDaysTrappedPeople(decimalFormatAvg.format(divide));
}else {
avg.setAvgDaysTrappedPeople("0");
}
if (!ObjectUtils.isEmpty(statistics.getBreakdownRescue()) && statistics.getBreakdownRescue() != 0 && avgNum != 0) {
BigDecimal bigDecimal = new BigDecimal(statistics.getBreakdownRescue().toString());
BigDecimal bigDecimal1 = new BigDecimal(avgNum);
BigDecimal divide = bigDecimal.divide(bigDecimal1, 6, BigDecimal.ROUND_HALF_UP);
avg.setAvgDaysBreakdownRescue(decimalFormatAvg.format(divide));
}else {
avg.setAvgDaysBreakdownRescue("0");
}
alertStatistics.add(avg);
return alertStatistics;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment