Commit 4c528941 authored by tianyiming's avatar tianyiming

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 65bc5f8a 4c147ab4
...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.DispatchTask; ...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.DispatchTask;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 派遣任务 Mapper 接口 * 派遣任务 Mapper 接口
...@@ -24,4 +25,6 @@ public interface DispatchTaskMapper extends BaseMapper<DispatchTask> { ...@@ -24,4 +25,6 @@ public interface DispatchTaskMapper extends BaseMapper<DispatchTask> {
List<WechatMyTaskListDto> getTaskListByPhonePager(@Param("phone") String phone, @Param("typeCode") String typeCode, @Param("current") Long current); List<WechatMyTaskListDto> getTaskListByPhonePager(@Param("phone") String phone, @Param("typeCode") String typeCode, @Param("current") Long current);
List<MainPersonDto> todayTaskPerson(); List<MainPersonDto> todayTaskPerson();
List<Map<String, Object>> rankUnitByRescueTime(@Param("regionCode") String regionCode);
} }
...@@ -106,5 +106,26 @@ ...@@ -106,5 +106,26 @@
where to_days(t.dispatch_time) = TO_DAYS(now()) where to_days(t.dispatch_time) = TO_DAYS(now())
</select> </select>
<select id="rankUnitByRescueTime" resultType="java.util.Map">
SELECT
tac.city,
tdt.sequence_nbr as sequenceNbr,
tdt.response_org_name as maintUnit,
AVG (TIMESTAMPDIFF (SECOND, tdt.arrive_time, tdt.save_time)) AS avgTime
FROM
tz_dispatch_task tdt
LEFT JOIN tz_alert_called tac ON tdt.alert_id = tac.sequence_nbr
LEFT JOIN tz_base_enterprise_info tbei ON tdt.response_org_id = tbei.sequence_nbr
WHERE
tac.alarm_type_code = '960'
AND tdt.org_type_code = 'repairUnit'
AND tac.biz_org_code LIKE concat(#{regionCode}, '%')
AND tdt.arrive_time IS NOT NULL
AND tdt.save_time IS NOT NULL
GROUP BY
tdt.response_org_id
ORDER BY
timeAvg
</select>
</mapper> </mapper>
...@@ -122,7 +122,7 @@ public class DPStatisticsController { ...@@ -122,7 +122,7 @@ public class DPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-应急-维保单位平均救援时间排名", notes = "大屏-应急-维保单位平均救援时间排名") @ApiOperation(httpMethod = "POST", value = "大屏-应急-维保单位平均救援时间排名", notes = "大屏-应急-维保单位平均救援时间排名")
@PostMapping(value = "/yj/rankUnitByRescueTime") @PostMapping(value = "/yj/rankUnitByRescueTime")
public ResponseModel<List<AlertMaintenanceUnitStatisticsDto>> rankUnitByRescueTime(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception { public ResponseModel<List<Map<String, Object>>> rankUnitByRescueTime(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception {
List<FieldError> fieldErrors = result.getFieldErrors(); List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) { if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage()); throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
......
...@@ -32,6 +32,7 @@ import java.time.format.DateTimeFormatter; ...@@ -32,6 +32,7 @@ import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -57,6 +58,8 @@ public class DPStatisticsServiceImpl { ...@@ -57,6 +58,8 @@ public class DPStatisticsServiceImpl {
private AlertStatisticsMapper alertStatisticsMapper; private AlertStatisticsMapper alertStatisticsMapper;
private DispatchTaskMapper dispatchTaskMapper;
@Autowired @Autowired
AlertCalledServiceImpl alertCalledService; AlertCalledServiceImpl alertCalledService;
...@@ -64,7 +67,7 @@ public class DPStatisticsServiceImpl { ...@@ -64,7 +67,7 @@ public class DPStatisticsServiceImpl {
private static Map<String, List<RegionModel>> regionChildRegionMap = new ConcurrentHashMap<>(); private static Map<String, List<RegionModel>> regionChildRegionMap = new ConcurrentHashMap<>();
public DPStatisticsServiceImpl(YjBaseMapper yjBaseMapper, AlertCalledMapper alertCalledMapper, ElevatorMapper elevatorMapper, AlertRescueStatisticsMapper alertRescueStatisticsMapper, AlertUseUnitStatisticsMapper alertUseUnitStatisticsMapper, AlertMaintenanceUnitStatisticsMapper alertMaintenanceUnitStatisticsMapper, AlertStatisticsMapper alertStatisticsMapper) { public DPStatisticsServiceImpl(YjBaseMapper yjBaseMapper, AlertCalledMapper alertCalledMapper, ElevatorMapper elevatorMapper, AlertRescueStatisticsMapper alertRescueStatisticsMapper, AlertUseUnitStatisticsMapper alertUseUnitStatisticsMapper, AlertMaintenanceUnitStatisticsMapper alertMaintenanceUnitStatisticsMapper, AlertStatisticsMapper alertStatisticsMapper, DispatchTaskMapper dispatchTaskMapper) {
this.yjBaseMapper = yjBaseMapper; this.yjBaseMapper = yjBaseMapper;
this.alertCalledMapper = alertCalledMapper; this.alertCalledMapper = alertCalledMapper;
this.elevatorMapper = elevatorMapper; this.elevatorMapper = elevatorMapper;
...@@ -72,6 +75,7 @@ public class DPStatisticsServiceImpl { ...@@ -72,6 +75,7 @@ public class DPStatisticsServiceImpl {
this.alertUseUnitStatisticsMapper = alertUseUnitStatisticsMapper; this.alertUseUnitStatisticsMapper = alertUseUnitStatisticsMapper;
this.alertMaintenanceUnitStatisticsMapper = alertMaintenanceUnitStatisticsMapper; this.alertMaintenanceUnitStatisticsMapper = alertMaintenanceUnitStatisticsMapper;
this.alertStatisticsMapper = alertStatisticsMapper; this.alertStatisticsMapper = alertStatisticsMapper;
this.dispatchTaskMapper = dispatchTaskMapper;
} }
public JSONObject eventStatByDay(DPFilterParamDto dpFilterParamDto) throws Exception { public JSONObject eventStatByDay(DPFilterParamDto dpFilterParamDto) throws Exception {
...@@ -199,16 +203,30 @@ public class DPStatisticsServiceImpl { ...@@ -199,16 +203,30 @@ public class DPStatisticsServiceImpl {
return Bean.toModels(alertUseUnitStatistics, AlertUseUnitStatisticsDto.class); return Bean.toModels(alertUseUnitStatistics, AlertUseUnitStatisticsDto.class);
} }
public List<AlertMaintenanceUnitStatisticsDto> rankUnitByRescueTime(DPFilterParamDto dpFilterParamDto) throws Exception { public List<Map<String, Object>> rankUnitByRescueTime(DPFilterParamDto dpFilterParamDto) throws Exception {
String date = DateUtil.formatDate(new Date(), "yyyy-MM");
String orgCode = this.getAndSetOrgCode(dpFilterParamDto); String orgCode = this.getAndSetOrgCode(dpFilterParamDto);
List<Map<String, Object>> maps = dispatchTaskMapper.rankUnitByRescueTime(orgCode);
LambdaQueryWrapper<AlertMaintenanceUnitStatistics> lambda = new QueryWrapper<AlertMaintenanceUnitStatistics>().lambda(); maps.stream().forEach(x -> {
lambda.likeLeft(AlertMaintenanceUnitStatistics::getSupervisoryUnitOrgCode, orgCode); String avgTime = "";
lambda.eq(AlertMaintenanceUnitStatistics :: getStatisticsDate, date); Long seconds = Long.valueOf(x.get("avgTime").toString());
List<AlertMaintenanceUnitStatistics> alertMaintenanceUnitStatistics = alertMaintenanceUnitStatisticsMapper.selectList(lambda); long days = TimeUnit.SECONDS.toDays(seconds);
List<AlertMaintenanceUnitStatisticsDto> models = Bean.toModels(alertMaintenanceUnitStatistics, AlertMaintenanceUnitStatisticsDto.class); long hours = TimeUnit.SECONDS.toHours(seconds) - TimeUnit.DAYS.toHours(days);
return models; long minutes = TimeUnit.SECONDS.toMinutes(seconds) - TimeUnit.HOURS.toMinutes(hours);
if (!ValidationUtil.isEmpty(days) && days > 0){
avgTime = avgTime + days + "天";
}
if (!ValidationUtil.isEmpty(hours) && hours > 0){
avgTime = avgTime + hours + "小时";
}
if (!ValidationUtil.isEmpty(minutes) && minutes > 0){
avgTime = avgTime + minutes + "分钟";
}
if (seconds < 60){
avgTime = avgTime + seconds + "秒";
}
x.put("avgTime", avgTime);
});
return maps;
} }
public JSONObject regionEventRank(DPFilterParamDto dpFilterParamDto) throws Exception { public JSONObject regionEventRank(DPFilterParamDto dpFilterParamDto) throws Exception {
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
select change_data select change_data
from tzs_jg_registration_history his, from tzs_jg_registration_history his,
tzs_jg_change_registration_transfer crt tzs_jg_change_registration_transfer crt
where crt.sequence_nbr = his.current_document_id where crt.apply_no = his.current_document_id
and crt.audit_status in ('三级待受理', '二级待受理', '一级待受理') and crt.audit_status in ('三级待受理', '二级待受理', '一级待受理')
and his.registration_class = '移装变更登记' and his.registration_class = '移装变更登记'
</select> </select>
......
...@@ -776,7 +776,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang ...@@ -776,7 +776,6 @@ public class JgChangeRegistrationTransferServiceImpl extends BaseService<JgChang
//流程执行完成后,更新设备使用信息 //流程执行完成后,更新设备使用信息
JgRegistrationHistory historyData = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>() JgRegistrationHistory historyData = jgRegistrationHistoryMapper.selectOne(new LambdaQueryWrapper<JgRegistrationHistory>()
.eq(JgRegistrationHistory::getCurrentDocumentId, jgChangeRegistrationTransfer.getApplyNo())); .eq(JgRegistrationHistory::getCurrentDocumentId, jgChangeRegistrationTransfer.getApplyNo()));
this.updateByFlowEnd(jgChangeRegistrationTransfer.getSequenceNbr().toString(), historyData); this.updateByFlowEnd(jgChangeRegistrationTransfer.getSequenceNbr().toString(), historyData);
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode()); map.put("taskStatus", FlowStatusEnum.TO_BE_FINISHED.getCode());
......
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