|
|
|
@ -1,26 +1,39 @@
|
|
|
|
|
package com.hnac.hzims.scheduled.service.operation.impl; |
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
|
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyInfoVo; |
|
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyTaskVo; |
|
|
|
|
import com.hnac.hzims.operational.duty.vo.NextDutyInfoVo; |
|
|
|
|
import com.hnac.hzims.operational.fill.entity.*; |
|
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
|
import com.hnac.hzims.operational.main.vo.*; |
|
|
|
|
import com.hnac.hzims.operational.report.vo.DutyDefectVO; |
|
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
|
import com.hnac.hzims.scheduled.service.equipment.PlanService; |
|
|
|
|
import com.hnac.hzims.scheduled.service.inspect.TaskService; |
|
|
|
|
import com.hnac.hzims.scheduled.service.operation.*; |
|
|
|
|
import com.hnac.hzims.scheduled.service.ticket.TicketService; |
|
|
|
|
import com.hnac.hzims.scheduled.service.ticket.WorkTicketService; |
|
|
|
|
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; |
|
|
|
|
import com.hnac.hzims.ticket.workTicket.vo.TicketMonthVO; |
|
|
|
|
import com.hnac.hzims.ticket.workTicket.vo.WorkTicketStatisticVO; |
|
|
|
|
import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient; |
|
|
|
|
import com.hnac.hzinfo.inspect.task.vo.DutyInspectTaskVO; |
|
|
|
|
import com.xxl.job.core.log.XxlJobLogger; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
|
import org.apache.poi.ss.formula.functions.T; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
@ -36,11 +49,12 @@ import java.math.BigDecimal;
|
|
|
|
|
import java.net.HttpURLConnection; |
|
|
|
|
import java.net.URL; |
|
|
|
|
import java.nio.charset.StandardCharsets; |
|
|
|
|
import java.sql.Time; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
|
import java.time.LocalTime; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.concurrent.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@ -52,6 +66,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
@Slf4j |
|
|
|
|
public class ShowServiceImpl implements ShowService { |
|
|
|
|
|
|
|
|
|
private final TaskService taskService; |
|
|
|
|
private final OverService overService; |
|
|
|
|
private final PlanService planService; |
|
|
|
|
private final PowerService powerService; |
|
|
|
@ -60,12 +75,16 @@ public class ShowServiceImpl implements ShowService {
|
|
|
|
|
private final AccessService accessService; |
|
|
|
|
private final TicketService ticketService; |
|
|
|
|
private final DefectService defectService; |
|
|
|
|
private final DutyService dutyService; |
|
|
|
|
private final StationService stationService; |
|
|
|
|
private final OverDetailsService detailsService; |
|
|
|
|
private final WorkTicketService workTicketService; |
|
|
|
|
private final PhenomenonService phenomenonService; |
|
|
|
|
private final AnalyseDataService analyseDataService; |
|
|
|
|
private final MaintenanceService maintenanceService; |
|
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
|
private final ISysClient sysClient; |
|
|
|
|
|
|
|
|
|
private final IAnalyseInstanceClient deviceInstanceClient; |
|
|
|
|
|
|
|
|
|
private final static String charge = "hzims:operation:key:charge"; |
|
|
|
|
private final static String home_target_cache_final = "load:operation:home:target:key"; |
|
|
|
@ -77,6 +96,12 @@ public class ShowServiceImpl implements ShowService {
|
|
|
|
|
@Value("${hzims.operation.homePage.charge.url}") |
|
|
|
|
public String charge_url; |
|
|
|
|
|
|
|
|
|
@Value("${hzims.equipment.emInfo.emInfoList}") |
|
|
|
|
public String device_cache_cofig_final; |
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.region.areaDutyInfoKey}") |
|
|
|
|
private String area_duty_cofig_final; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 集团总指标-首页数据 |
|
|
|
|
*/ |
|
|
|
@ -112,6 +137,64 @@ public class ShowServiceImpl implements ShowService {
|
|
|
|
|
redisTemplate.opsForValue().set(home_target_cache_final,targets.stream().filter(( target -> ObjectUtil.isNotEmpty(target.getType()))).collect(Collectors.toList())); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 智能生产-值班数据 |
|
|
|
|
* @param param |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void loadRegionalDuty(String param) { |
|
|
|
|
R<List<Dept>> R = sysClient.getDeptList(); |
|
|
|
|
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Map<Dept,List<StationEntity>> map = this.area(R.getData(),null, Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
if (MapUtils.isEmpty(map)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 查询所有区域值班/接班数据
|
|
|
|
|
List<DutyInfoVo> dutyInfoVoList = dutyService.dutyData(map.keySet().stream().map(Dept::getId).collect(Collectors.toList())); |
|
|
|
|
if(CollectionUtil.isEmpty(dutyInfoVoList)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 所有设备
|
|
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_cofig_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {}); |
|
|
|
|
List<AreaDutyVo> areaDutyVoList = new ArrayList<>(); |
|
|
|
|
map.forEach((key,value) -> { |
|
|
|
|
List<Long> singlet = Collections.singletonList(key.getId()); |
|
|
|
|
AreaDutyVo areaDutyVo = new AreaDutyVo(); |
|
|
|
|
areaDutyVo.setDepartId(key.getId()); |
|
|
|
|
areaDutyVo.setDepartName(key.getDeptName()); |
|
|
|
|
areaDutyVo.setSort(key.getSort()); |
|
|
|
|
// 值班情况
|
|
|
|
|
this.dutySituation(dutyInfoVoList, key, areaDutyVo); |
|
|
|
|
// 厂站运行情况
|
|
|
|
|
this.factoryStationRun(devices, value, areaDutyVo); |
|
|
|
|
// 当月任务执行情况
|
|
|
|
|
this.executeTaskMonth(singlet, areaDutyVo); |
|
|
|
|
// 获取区域当班时间
|
|
|
|
|
List<DutyInfoVo> dutyList = dutyInfoVoList.stream().filter(o -> key.getId().equals(o.getCreateDept())).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isEmpty(dutyList)) { |
|
|
|
|
areaDutyVoList.add(areaDutyVo); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Date startDate = this.dutyStartTime(dutyList.get(0).getDateTime(),dutyList.get(0).getStartTime()); |
|
|
|
|
Date endDate = this.dutyEndTime(dutyList.get(0).getDateTime(),dutyList.get(0).getStartTime(),dutyList.get(0).getEndTime()); |
|
|
|
|
areaDutyVo.setStartTimeDuty(DateUtil.format(startDate,DateUtil.PATTERN_DATETIME)); |
|
|
|
|
areaDutyVo.setEndTimeDuty(DateUtil.format(endDate,DateUtil.PATTERN_DATETIME)); |
|
|
|
|
// 上一班组发电量
|
|
|
|
|
this.upDutyPower(dutyList,devices,key.getId(),value,areaDutyVo); |
|
|
|
|
// 班组实时发电量
|
|
|
|
|
this.dutyPower(startDate,endDate,devices,value,areaDutyVo,false); |
|
|
|
|
// 当班双票
|
|
|
|
|
this.dutyDoubleTicket(startDate,endDate,singlet,areaDutyVo); |
|
|
|
|
// 当班运行数据
|
|
|
|
|
this.dutyRunCondition(startDate,endDate,singlet,areaDutyVo); |
|
|
|
|
areaDutyVoList.add(areaDutyVo); |
|
|
|
|
}); |
|
|
|
|
redisTemplate.opsForValue().set(area_duty_cofig_final, areaDutyVoList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 水电站指标 |
|
|
|
|
* @return |
|
|
|
@ -477,4 +560,626 @@ public class ShowServiceImpl implements ShowService {
|
|
|
|
|
} |
|
|
|
|
return stringBuilder.toString(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取权限区域 |
|
|
|
|
* @param list : 机构列表 |
|
|
|
|
* @param deptId : 起始过滤权限机构 |
|
|
|
|
* @param typeList : 查询站点类型-水电、水利、光伏.... |
|
|
|
|
* @param serveType : 站点服务类型 |
|
|
|
|
* @return Map<Dept, List<StationEntity>> |
|
|
|
|
*/ |
|
|
|
|
private Map<Dept, List<StationEntity>> area(List<Dept> list,Long deptId, List<Integer> typeList, Integer serveType) { |
|
|
|
|
// 未传入机构列表,使用用户权限机构过滤
|
|
|
|
|
if(CollectionUtil.isEmpty(list)){ |
|
|
|
|
R<List<Dept>> R = sysClient.getDeptByCurrentUser(); |
|
|
|
|
if(!R.isSuccess() || CollectionUtil.isEmpty(R.getData())){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
list = R.getData(); |
|
|
|
|
} |
|
|
|
|
// 根据参数查询有效站点
|
|
|
|
|
List<StationEntity> stationList = this.stationByParams(list,deptId,typeList,serveType); |
|
|
|
|
if(CollectionUtil.isEmpty(stationList)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 有效站点归属机构Id集合
|
|
|
|
|
List<Long> refDeptList = stationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(refDeptList)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 有效站点归属机构集合
|
|
|
|
|
List<Dept> vaildDeptList = list.stream().filter(o->refDeptList.contains(o.getId())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(vaildDeptList)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 根据有效站点归属机构向上区域Id
|
|
|
|
|
List<Long> areaIdList = vaildDeptList.stream().map(Dept::getParentId).distinct().collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(areaIdList)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 根据区域Id查询区域机构
|
|
|
|
|
List<Dept> areaList = list.stream().filter(o->o.getDeptCategory().equals(HomePageConstant.AREA) && areaIdList.contains(o.getId())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(areaList)){ |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 返回结构
|
|
|
|
|
Map<Dept, List<StationEntity>> result = new HashMap<>(); |
|
|
|
|
for(Dept area : areaList){ |
|
|
|
|
List<Long> childDeptIdList = list.stream().filter(o->o.getParentId().equals(area.getId())).map(Dept::getId).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(childDeptIdList)){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
List<StationEntity> resultList = stationList.stream().filter(o->childDeptIdList.contains(o.getRefDept())).collect(Collectors.toList()); |
|
|
|
|
result.put(area,resultList); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取站点集合 |
|
|
|
|
* @param authList |
|
|
|
|
* @param deptId |
|
|
|
|
* @param types |
|
|
|
|
* @param servrType |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<StationEntity> stationByParams(List<Dept> authList, Long deptId, List<Integer> types, Integer servrType) { |
|
|
|
|
Dept dept; |
|
|
|
|
if (null == deptId) { |
|
|
|
|
// 最小类型机构
|
|
|
|
|
Optional<Dept> min = authList.stream().min(Comparator.comparing(Dept::getDeptCategory)); |
|
|
|
|
dept = min.orElse(null); |
|
|
|
|
if (ObjectUtil.isEmpty(dept)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 检查是否存在传入机构
|
|
|
|
|
List<Dept> list = authList.stream().filter(o -> deptId.equals(o.getId())).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isEmpty(list)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
// 传入机构为站点
|
|
|
|
|
dept = list.get(0); |
|
|
|
|
} |
|
|
|
|
List<Long> depts; |
|
|
|
|
if (dept.getDeptCategory().equals(4)) { |
|
|
|
|
depts = Collections.singletonList(dept.getId()); |
|
|
|
|
// 传入机构为区域、省子公司、集团
|
|
|
|
|
} else { |
|
|
|
|
// 递归权限机构获取站点级机构
|
|
|
|
|
depts = this.stationDept(authList, dept.getId(), new ArrayList<>()); |
|
|
|
|
} |
|
|
|
|
// 获取水利站点(过滤其他站点类型)
|
|
|
|
|
return stationService.list(new LambdaQueryWrapper<StationEntity>() {{ |
|
|
|
|
eq(StationEntity::getIsDeleted, 0); |
|
|
|
|
if (ObjectUtil.isNotEmpty(servrType)) { |
|
|
|
|
eq(StationEntity::getServeType, servrType); |
|
|
|
|
} |
|
|
|
|
if (CollectionUtil.isNotEmpty(types)) { |
|
|
|
|
in(StationEntity::getType, types); |
|
|
|
|
} |
|
|
|
|
if (CollectionUtil.isNotEmpty(depts)) { |
|
|
|
|
in(StationEntity::getRefDept, depts); |
|
|
|
|
} |
|
|
|
|
}}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 递归权限机构获取站点级机构 |
|
|
|
|
* |
|
|
|
|
* @param departList |
|
|
|
|
* @param deptId |
|
|
|
|
* @param list |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<Long> stationDept(List<Dept> departList, Long deptId, List<Long> list) { |
|
|
|
|
if (null == deptId || CollectionUtil.isEmpty(departList)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
departList.forEach(dept -> { |
|
|
|
|
if (dept.getParentId().equals(deptId)) { |
|
|
|
|
if (dept.getDeptCategory().equals(4)) { |
|
|
|
|
list.add(dept.getId()); |
|
|
|
|
} |
|
|
|
|
stationDept(departList, dept.getId(), list); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取开始时间 |
|
|
|
|
* @param date |
|
|
|
|
* @param time |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private Date dutyStartTime(Date date, Time time){ |
|
|
|
|
Calendar dateCal = Calendar.getInstance(); |
|
|
|
|
dateCal.setTime(date); |
|
|
|
|
Calendar timeCal = Calendar.getInstance(); |
|
|
|
|
timeCal.setTime(time); |
|
|
|
|
dateCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY)); |
|
|
|
|
dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE)); |
|
|
|
|
dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND)); |
|
|
|
|
return dateCal.getTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取结束时间 |
|
|
|
|
* @param date |
|
|
|
|
* @param time |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private Date dutyEndTime(Date date, Time time,Time endTime){ |
|
|
|
|
Calendar dateCal = Calendar.getInstance(); |
|
|
|
|
dateCal.setTime(date); |
|
|
|
|
Calendar timeCal = Calendar.getInstance(); |
|
|
|
|
timeCal.setTime(time); |
|
|
|
|
Calendar endCal = Calendar.getInstance(); |
|
|
|
|
endCal.setTime(endTime); |
|
|
|
|
// 结束时间 < 开始时间
|
|
|
|
|
if(timeCal.after(endCal)){ |
|
|
|
|
dateCal.set(Calendar.DAY_OF_MONTH, dateCal.get(Calendar.DAY_OF_MONTH) + 1 ); |
|
|
|
|
} |
|
|
|
|
dateCal.set(Calendar.HOUR_OF_DAY, endCal.get(Calendar.HOUR_OF_DAY)); |
|
|
|
|
dateCal.set(Calendar.MINUTE, endCal.get(Calendar.MINUTE)); |
|
|
|
|
dateCal.set(Calendar.SECOND, endCal.get(Calendar.SECOND)); |
|
|
|
|
return dateCal.getTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 值班情况 |
|
|
|
|
* |
|
|
|
|
* @param dutyInfoVoList |
|
|
|
|
* @param dept |
|
|
|
|
* @param areaDutyVo |
|
|
|
|
*/ |
|
|
|
|
private void dutySituation(List<DutyInfoVo> dutyInfoVoList, Dept dept, AreaDutyVo areaDutyVo) { |
|
|
|
|
if (CollectionUtil.isEmpty(dutyInfoVoList) || ObjectUtil.isEmpty(dept)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Long deptId = dept.getId(); |
|
|
|
|
List<DutyInfoVo> filterList = dutyInfoVoList.stream().filter(o -> o.getCreateDept().equals(deptId)).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isEmpty(filterList)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
DutyInfoVo dutyInfoVo = filterList.get(0); |
|
|
|
|
areaDutyVo.setGeneratingCapacity(dutyInfoVo.getGeneratingCapacity()); |
|
|
|
|
areaDutyVo.setOnlineCapacity(dutyInfoVo.getOnlineCapacity()); |
|
|
|
|
areaDutyVo.setClassName(dutyInfoVo.getClassName()); |
|
|
|
|
areaDutyVo.setGroupName(dutyInfoVo.getGroupName()); |
|
|
|
|
areaDutyVo.setManagerName(dutyInfoVo.getManagerName()); |
|
|
|
|
areaDutyVo.setManagerPhone(dutyInfoVo.getManagerPhone()); |
|
|
|
|
areaDutyVo.setNextDutyInfoVo(dutyInfoVo.getNextDutyInfoVo()); |
|
|
|
|
// 当班任务
|
|
|
|
|
|
|
|
|
|
String taskCount = this.taskCount(dutyInfoVo.getDateTime(),dutyInfoVo.getStartTime(),dutyInfoVo.getEndTime(),dutyInfoVo.getCreateDept()); |
|
|
|
|
String[] task = taskCount.split("\\|"); |
|
|
|
|
areaDutyVo.setTaskCount(Integer.valueOf(task[0])); |
|
|
|
|
areaDutyVo.setFinishTaskCount(Integer.valueOf(task[1])); |
|
|
|
|
NextDutyInfoVo upDutyInfoVo = dutyInfoVo.getUpDutyInfoVo(); |
|
|
|
|
if(ObjectUtil.isEmpty(upDutyInfoVo)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 上一班组当班任务
|
|
|
|
|
String upTaskCount = this.taskCount(upDutyInfoVo.getDateTime(),upDutyInfoVo.getStartTime(),upDutyInfoVo.getEndTime(),dutyInfoVo.getCreateDept()); |
|
|
|
|
String[] upTask = upTaskCount.split("\\|"); |
|
|
|
|
upDutyInfoVo.setTaskCount(Integer.valueOf(upTask[0])); |
|
|
|
|
upDutyInfoVo.setFinishTaskCount(Integer.valueOf(upTask[1])); |
|
|
|
|
areaDutyVo.setUpDutyInfoVo(upDutyInfoVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取当班任务 |
|
|
|
|
* @param dateTime |
|
|
|
|
* @param startTime |
|
|
|
|
* @param endTime |
|
|
|
|
* @param createDept |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private String taskCount(Date dateTime, Time startTime, Time endTime, Long createDept) { |
|
|
|
|
DutyTaskVo task = new DutyTaskVo(); |
|
|
|
|
//通过线程池异步获取月报各模块内容 主要分为五块内容
|
|
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("duty-task-count-pool-%d").build(); |
|
|
|
|
ExecutorService exe = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
|
//监控线程执行完后返回结果
|
|
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(4); |
|
|
|
|
List<Long> list = Collections.singletonList(createDept); |
|
|
|
|
String start = DateUtil.format(this.dutyStartTime(dateTime,startTime),DateUtil.PATTERN_DATETIME); |
|
|
|
|
String end = DateUtil.format(this.dutyEndTime(dateTime,startTime,endTime),DateUtil.PATTERN_DATETIME); |
|
|
|
|
// 日常维护
|
|
|
|
|
exe.execute(()->{ |
|
|
|
|
MaintainVo maintainVo = maintenanceService.maintain(start,end,list); |
|
|
|
|
int maintainSum = maintainVo.getMaintain(); |
|
|
|
|
int maintainFinish = maintainVo.getMaintainFinish(); |
|
|
|
|
task.setMaintainSum(maintainSum); |
|
|
|
|
task.setMaintainFinish(maintainFinish); |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 消缺
|
|
|
|
|
exe.execute(()->{ |
|
|
|
|
ShortagesVo shortagesVo = phenomenonService.defectMonth(start,end,list); |
|
|
|
|
int shortagesSum = shortagesVo.getShortagesSum(); |
|
|
|
|
int shortages = shortagesVo.getShortages(); |
|
|
|
|
task.setShortagesSum(shortagesSum); |
|
|
|
|
task.setShortages(shortages); |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
}); |
|
|
|
|
// 检修
|
|
|
|
|
exe.execute(()->{ |
|
|
|
|
OverhaulVo overhaulVo = accessService.overhaul(start,end,list); |
|
|
|
|
int overhaul = overhaulVo.getOverhaul(); |
|
|
|
|
int overhaulFinish = overhaulVo.getOverhaulFinish(); |
|
|
|
|
task.setOverhaul(overhaul); |
|
|
|
|
task.setOverhaulFinish(overhaulFinish); |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
}); |
|
|
|
|
// 巡检
|
|
|
|
|
exe.execute(()->{ |
|
|
|
|
// 巡检任务
|
|
|
|
|
DutyInspectTaskVO inspectTask = taskService.task(start,end,list); |
|
|
|
|
if(ObjectUtil.isEmpty(inspectTask)){ |
|
|
|
|
task.setInspect(0); |
|
|
|
|
task.setInspectFinish(0); |
|
|
|
|
}else{ |
|
|
|
|
int inspect = inspectTask.getInspectTaskSum(); |
|
|
|
|
int inspectFinish = inspectTask.getInspectTaskFinish(); |
|
|
|
|
task.setInspect(inspect); |
|
|
|
|
task.setInspectFinish(inspectFinish); |
|
|
|
|
} |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
}); |
|
|
|
|
// 等待所有线程执行完成
|
|
|
|
|
try { |
|
|
|
|
countDownLatch.await(); |
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
|
} |
|
|
|
|
exe.shutdown(); |
|
|
|
|
return (task.getMaintainSum() + task.getShortagesSum() + task.getOverhaul() + task.getInspect()) + "|" + |
|
|
|
|
(task.getMaintainFinish() + task.getShortages() + task.getOverhaulFinish() + task.getInspectFinish()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 厂站运行情况 |
|
|
|
|
* |
|
|
|
|
* @param list |
|
|
|
|
* @param areaDutyVo |
|
|
|
|
*/ |
|
|
|
|
private void factoryStationRun(List<EminfoAndEmParamVo> deviceList,List<StationEntity> list, AreaDutyVo areaDutyVo) { |
|
|
|
|
areaDutyVo.setStationSum(0); |
|
|
|
|
areaDutyVo.setStationRun(0); |
|
|
|
|
if (CollectionUtil.isEmpty(list) || CollectionUtil.isEmpty(deviceList)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
areaDutyVo.setStationSum(list.size()); |
|
|
|
|
List<Long> deptList = list.stream().map(StationEntity::getRefDept).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(deptList)){ |
|
|
|
|
log.info("run_station_dept_list_null : {}",areaDutyVo.getDepartName()); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 过滤未绑定设备
|
|
|
|
|
List<String> codes = deviceList.stream().filter(o->deptList.contains(o.getCreateDept())).map(EminfoAndEmParamVo::getEmCode).collect(Collectors.toList()); |
|
|
|
|
R<List<String>> R = deviceInstanceClient.getListAnalyseCode(codes); |
|
|
|
|
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { |
|
|
|
|
log.info("run_station_valid_device_null : {}",areaDutyVo.getDepartName()); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 根据机构分组
|
|
|
|
|
Map<Long, List<EminfoAndEmParamVo>> map = deviceList.stream().filter(o->R.getData().contains(o.getEmCode())).collect(Collectors.groupingBy(EminfoAndEmParamVo::getCreateDept)); |
|
|
|
|
if(CollectionUtil.isEmpty(map)){ |
|
|
|
|
log.info("run_station_group_by_valid_null : {}",areaDutyVo.getDepartName()); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
int runCount = 0; |
|
|
|
|
// 遍历分组设备
|
|
|
|
|
for(Map.Entry<Long, List<EminfoAndEmParamVo>> entry : map.entrySet()){ |
|
|
|
|
// 运行设备code集合
|
|
|
|
|
List<String> runCodes = entry.getValue().stream().filter(o -> (Func.isEmpty(o.getRunStatus()) || "1".equals(o.getRunStatus()))).map(EminfoAndEmParamVo::getEmCode).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(runCodes)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
runCount++; |
|
|
|
|
} |
|
|
|
|
areaDutyVo.setStationRun(runCount); |
|
|
|
|
areaDutyVo.setStationSum(list.size()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 当月任务执行情况 |
|
|
|
|
* |
|
|
|
|
* @param list |
|
|
|
|
* @param areaDutyVo |
|
|
|
|
*/ |
|
|
|
|
private void executeTaskMonth(List<Long> list, AreaDutyVo areaDutyVo) { |
|
|
|
|
if (CollectionUtil.isEmpty(list)) { |
|
|
|
|
areaDutyVo.setMaintainSumMoth(0); |
|
|
|
|
areaDutyVo.setMaintainFinishSumMoth(0); |
|
|
|
|
areaDutyVo.setMaintainRateMoth("0"); |
|
|
|
|
areaDutyVo.setShortagesSumMoth(0); |
|
|
|
|
areaDutyVo.setShortagesMoth(0); |
|
|
|
|
areaDutyVo.setShortagesRateMoth("0"); |
|
|
|
|
areaDutyVo.setOverhaulSumMoth(0); |
|
|
|
|
areaDutyVo.setOverhaulFinishSumMoth(0); |
|
|
|
|
areaDutyVo.setOverhaulRateMoth("0"); |
|
|
|
|
areaDutyVo.setOperateSumMoth(0); |
|
|
|
|
areaDutyVo.setOperateQualifySumMoth(0); |
|
|
|
|
areaDutyVo.setOperateRateMoth("0"); |
|
|
|
|
areaDutyVo.setWorkSumMoth(0); |
|
|
|
|
areaDutyVo.setWorkQualifySumMoth(0); |
|
|
|
|
areaDutyVo.setWorkRateMoth("0"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
LocalDate firstDay = LocalDate.now().withDayOfMonth(1); |
|
|
|
|
String start = DateUtil.format(new Date(),"yyyy-MM") + "-01 00:00:00"; |
|
|
|
|
String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
//通过线程池异步获取月报各模块内容 主要分为五块内容
|
|
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("month-task-pool-%d").build(); |
|
|
|
|
ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(4, namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
|
//监控线程执行完后返回结果
|
|
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(4); |
|
|
|
|
// 日常维护
|
|
|
|
|
exe.execute(()->{ |
|
|
|
|
MaintainVo maintainVo = maintenanceService.maintain(start,end,list); |
|
|
|
|
int maintainSum = maintainVo.getMaintain(); |
|
|
|
|
int maintainFinish = maintainVo.getMaintainFinish(); |
|
|
|
|
areaDutyVo.setMaintainSumMoth(maintainSum); |
|
|
|
|
areaDutyVo.setMaintainFinishSumMoth(maintainFinish); |
|
|
|
|
if (maintainFinish == 0) { |
|
|
|
|
areaDutyVo.setMaintainRateMoth("0"); |
|
|
|
|
} else { |
|
|
|
|
double maintainRate = BigDecimal.valueOf(maintainFinish / (double)maintainSum * 100L).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
areaDutyVo.setMaintainRateMoth(String.valueOf(maintainRate)); |
|
|
|
|
} |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 消缺
|
|
|
|
|
exe.execute(()->{ |
|
|
|
|
ShortagesVo shortagesVo = phenomenonService.defectMonth(start,end,list); |
|
|
|
|
int shortagesSum = shortagesVo.getShortagesSum(); |
|
|
|
|
int shortages = shortagesVo.getShortages(); |
|
|
|
|
areaDutyVo.setShortagesSumMoth(shortagesSum); |
|
|
|
|
areaDutyVo.setShortagesMoth(shortages); |
|
|
|
|
if (Math.abs(shortagesSum) <= 0) { |
|
|
|
|
areaDutyVo.setShortagesRateMoth("0"); |
|
|
|
|
} else { |
|
|
|
|
double shortagesRate = BigDecimal.valueOf(shortages / (double)shortagesSum * 100L).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
areaDutyVo.setShortagesRateMoth(String.valueOf(shortagesRate)); |
|
|
|
|
} |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
}); |
|
|
|
|
// 检修
|
|
|
|
|
exe.execute(()->{ |
|
|
|
|
OverhaulVo overhaulVo = accessService.overhaul(start,end,list); |
|
|
|
|
int overhaul = overhaulVo.getOverhaul(); |
|
|
|
|
int overhaulFinish = overhaulVo.getOverhaulFinish(); |
|
|
|
|
areaDutyVo.setOverhaulSumMoth(overhaul); |
|
|
|
|
areaDutyVo.setOverhaulFinishSumMoth(overhaulFinish); |
|
|
|
|
if (overhaulFinish == 0) { |
|
|
|
|
areaDutyVo.setOverhaulRateMoth("0"); |
|
|
|
|
} else { |
|
|
|
|
double overhaulRate = BigDecimal.valueOf(overhaulFinish / (double)overhaul * 100L).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
areaDutyVo.setOverhaulRateMoth(String.valueOf(overhaulRate)); |
|
|
|
|
} |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
}); |
|
|
|
|
// 操作票&工作票
|
|
|
|
|
exe.execute(()->{ |
|
|
|
|
TicketMonthVO ticket = ticketService.operateWork(start,end,list); |
|
|
|
|
if (ObjectUtil.isEmpty(ticket)) { |
|
|
|
|
areaDutyVo.setOperateSumMoth(0); |
|
|
|
|
areaDutyVo.setOperateQualifySumMoth(0); |
|
|
|
|
areaDutyVo.setOperateRateMoth("0"); |
|
|
|
|
areaDutyVo.setWorkSumMoth(0); |
|
|
|
|
areaDutyVo.setWorkQualifySumMoth(0); |
|
|
|
|
areaDutyVo.setWorkRateMoth("0"); |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
int operate = ticket.getOperate(); |
|
|
|
|
int operateQualify = ticket.getOperateQualify(); |
|
|
|
|
areaDutyVo.setOperateSumMoth(operate); |
|
|
|
|
areaDutyVo.setOperateQualifySumMoth(operateQualify); |
|
|
|
|
if (operateQualify == 0) { |
|
|
|
|
areaDutyVo.setOperateRateMoth("0"); |
|
|
|
|
} else { |
|
|
|
|
double operateRate = BigDecimal.valueOf(operateQualify / (double)operate * 100L).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
areaDutyVo.setOperateRateMoth(String.valueOf(operateRate)); |
|
|
|
|
} |
|
|
|
|
// 工作票
|
|
|
|
|
int work = ticket.getWork(); |
|
|
|
|
int workQualify = ticket.getWorkQualify(); |
|
|
|
|
areaDutyVo.setWorkSumMoth(work); |
|
|
|
|
areaDutyVo.setWorkQualifySumMoth(workQualify); |
|
|
|
|
if (workQualify == 0) { |
|
|
|
|
areaDutyVo.setWorkRateMoth("0"); |
|
|
|
|
} else { |
|
|
|
|
double workRate = BigDecimal.valueOf(workQualify / (double)work * 100L).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
areaDutyVo.setWorkRateMoth(String.valueOf(workRate)); |
|
|
|
|
} |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 等待所有线程执行完成
|
|
|
|
|
try { |
|
|
|
|
countDownLatch.await(); |
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
|
} |
|
|
|
|
exe.shutdown(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 上一班组发电量 |
|
|
|
|
* @param dutyList |
|
|
|
|
* @param deviceList |
|
|
|
|
* @param value |
|
|
|
|
* @param areaDutyVo |
|
|
|
|
*/ |
|
|
|
|
private void upDutyPower(List<DutyInfoVo> dutyList, List<EminfoAndEmParamVo> deviceList,Long deptId, List<StationEntity> value, AreaDutyVo areaDutyVo) { |
|
|
|
|
List<DutyInfoVo> list = dutyList.stream().filter(o -> deptId.equals(o.getCreateDept())).collect(Collectors.toList()); |
|
|
|
|
if (CollectionUtil.isEmpty(list)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
NextDutyInfoVo upDutyInfoVo = dutyList.get(0).getUpDutyInfoVo(); |
|
|
|
|
if(ObjectUtil.isEmpty(upDutyInfoVo)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 上一班组开始时间、结束时间
|
|
|
|
|
Date startDate = this.dutyStartTime(upDutyInfoVo.getDateTime(),upDutyInfoVo.getStartTime()); |
|
|
|
|
Date endDate = this.dutyEndTime(upDutyInfoVo.getDateTime(),upDutyInfoVo.getStartTime(),upDutyInfoVo.getEndTime()); |
|
|
|
|
// 获取时间断内发电量
|
|
|
|
|
this.dutyPower(startDate,endDate,deviceList,value,areaDutyVo,true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 班组实时发电量 |
|
|
|
|
* @param startDate |
|
|
|
|
* @param endDate |
|
|
|
|
* @param deviceList |
|
|
|
|
* @param list |
|
|
|
|
* @param areaDutyVo |
|
|
|
|
*/ |
|
|
|
|
private void dutyPower(Date startDate, Date endDate, List<EminfoAndEmParamVo> deviceList,List<StationEntity> list,AreaDutyVo areaDutyVo,boolean flag) { |
|
|
|
|
areaDutyVo.setGeneratingCapacity(0); |
|
|
|
|
List<Long> deptList = list.stream().map(StationEntity::getRefDept).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(deptList)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 区域站点下设备
|
|
|
|
|
List<EminfoAndEmParamVo> devices = deviceList.stream().filter(o->deptList.contains(o.getCreateDept())).collect(Collectors.toList()); |
|
|
|
|
if(CollectionUtil.isEmpty(devices)){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 获取当班时间内发电量
|
|
|
|
|
float generatingCapacity = this.generateByDuty(devices,startDate,endDate); |
|
|
|
|
// 是否为查询上一班组发电量
|
|
|
|
|
if(flag){ |
|
|
|
|
NextDutyInfoVo upDutyInfoVo = areaDutyVo.getUpDutyInfoVo(); |
|
|
|
|
upDutyInfoVo.setGeneratingCapacity(generatingCapacity); |
|
|
|
|
areaDutyVo.setUpDutyInfoVo(upDutyInfoVo); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
areaDutyVo.setGeneratingCapacity(generatingCapacity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*** |
|
|
|
|
* 根据当班时间查询发电量 |
|
|
|
|
* @param devices |
|
|
|
|
* @param start |
|
|
|
|
* @param end |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private float generateByDuty(List<EminfoAndEmParamVo> devices, Date start, Date end) { |
|
|
|
|
float generate = 0f; |
|
|
|
|
if(CollectionUtil.isEmpty(devices)){ |
|
|
|
|
return generate; |
|
|
|
|
} |
|
|
|
|
for(EminfoAndEmParamVo device : devices ){ |
|
|
|
|
generate += analyseDataService.periodTargetFloat(DateUtil.format(start,DateUtil.PATTERN_DATETIME),DateUtil.format(end,DateUtil.PATTERN_DATETIME),5,3,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER); |
|
|
|
|
} |
|
|
|
|
return generate; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 当班双票 |
|
|
|
|
* @param startDate |
|
|
|
|
* @param endDate |
|
|
|
|
* @param list |
|
|
|
|
* @param areaDutyVo |
|
|
|
|
*/ |
|
|
|
|
private void dutyDoubleTicket(Date startDate,Date endDate, List<Long> list,AreaDutyVo areaDutyVo) { |
|
|
|
|
String start = DateUtil.format(startDate,"yyyy-MM") + "-01 00:00:00"; |
|
|
|
|
String end = DateUtil.format(endDate,DateUtil.PATTERN_DATETIME); |
|
|
|
|
if (CollectionUtil.isEmpty(list)) { |
|
|
|
|
areaDutyVo.setWorkTicketCount(0); |
|
|
|
|
areaDutyVo.setHandoverTicketCount(0); |
|
|
|
|
areaDutyVo.setVoidTicketCount(0); |
|
|
|
|
areaDutyVo.setDeferredTicketCount(0); |
|
|
|
|
areaDutyVo.setCloseTicketCount(0); |
|
|
|
|
areaDutyVo.setOperationTicketCount(0); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
WorkTicketStatisticVO work = workTicketService.work(start,end,list); |
|
|
|
|
if (ObjectUtil.isEmpty(work)) { |
|
|
|
|
areaDutyVo.setWorkTicketCount(0); |
|
|
|
|
areaDutyVo.setHandoverTicketCount(0); |
|
|
|
|
areaDutyVo.setVoidTicketCount(0); |
|
|
|
|
areaDutyVo.setDeferredTicketCount(0); |
|
|
|
|
areaDutyVo.setCloseTicketCount(0); |
|
|
|
|
}else{ |
|
|
|
|
areaDutyVo.setWorkTicketCount(work.getTotal()); |
|
|
|
|
areaDutyVo.setHandoverTicketCount(work.getTransfer()); |
|
|
|
|
areaDutyVo.setVoidTicketCount(work.getInvalid()); |
|
|
|
|
areaDutyVo.setDeferredTicketCount(work.getDelay()); |
|
|
|
|
areaDutyVo.setCloseTicketCount(work.getComplete()); |
|
|
|
|
} |
|
|
|
|
// 查询操作票
|
|
|
|
|
Integer operater = ticketService.operate(start,end,list); |
|
|
|
|
areaDutyVo.setOperationTicketCount(operater); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 当班运行数据 |
|
|
|
|
* @param start |
|
|
|
|
* @param end |
|
|
|
|
* @param childList |
|
|
|
|
* @param areaDutyVo |
|
|
|
|
*/ |
|
|
|
|
private void dutyRunCondition(Date startTime, Date endTime, List<Long> areas,AreaDutyVo areaDutyVo) { |
|
|
|
|
String start = DateUtil.format(startTime,DateUtil.PATTERN_DATETIME); |
|
|
|
|
String end = DateUtil.format(endTime,DateUtil.PATTERN_DATETIME); |
|
|
|
|
// 巡检任务
|
|
|
|
|
DutyInspectTaskVO task = taskService.task(start,end,areas); |
|
|
|
|
areaDutyVo.setInspectionSum(0); |
|
|
|
|
areaDutyVo.setInspectionFinish(0); |
|
|
|
|
if(ObjectUtil.isNotEmpty(task)){ |
|
|
|
|
areaDutyVo.setInspectionSum(task.getInspectTaskSum()); |
|
|
|
|
areaDutyVo.setInspectionFinish(task.getInspectTaskFinish()); |
|
|
|
|
if(Math.abs(task.getInspectTaskSum()) <= 0){ |
|
|
|
|
areaDutyVo.setInspectionFinishRate(0.0); |
|
|
|
|
}else{ |
|
|
|
|
double inspectionFinishRate = BigDecimal.valueOf(task.getInspectTaskFinish() / (double)task.getInspectTaskSum() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
areaDutyVo.setInspectionFinishRate(inspectionFinishRate); |
|
|
|
|
} |
|
|
|
|
areaDutyVo.setInspectTaskIds(task.getInspectTaskIds()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 消缺
|
|
|
|
|
DutyDefectVO defect = phenomenonService.defect(start,end,areas); |
|
|
|
|
areaDutyVo.setShortagesSum(0); |
|
|
|
|
areaDutyVo.setShortages(0); |
|
|
|
|
if(ObjectUtil.isNotEmpty(defect)){ |
|
|
|
|
areaDutyVo.setShortagesSum(defect.getDefectSum()); |
|
|
|
|
areaDutyVo.setShortages(defect.getDefect()); |
|
|
|
|
areaDutyVo.setPhenomenonIds(defect.getTotalIds()); |
|
|
|
|
if(Math.abs(defect.getDefectSum()) <= 0){ |
|
|
|
|
areaDutyVo.setShortagesRate(0.0); |
|
|
|
|
}else{ |
|
|
|
|
double shortagesRate = BigDecimal.valueOf(defect.getDefect() / (double)defect.getDefectSum() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
areaDutyVo.setShortagesRate(shortagesRate); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 定期工作
|
|
|
|
|
RegularWorkVO regular = maintenanceService.regularWork(startTime,endTime,areas); |
|
|
|
|
areaDutyVo.setWorkRegularlySum(0); |
|
|
|
|
areaDutyVo.setWorkRegularly(0); |
|
|
|
|
if(ObjectUtil.isNotEmpty(regular)){ |
|
|
|
|
areaDutyVo.setWorkRegularlySum(regular.getRegularWorkSum()); |
|
|
|
|
areaDutyVo.setWorkRegularly(regular.getRegularWork()); |
|
|
|
|
areaDutyVo.setMainTaskIds(regular.getMainTaskIds()); |
|
|
|
|
if(Math.abs(areaDutyVo.getWorkRegularlySum()) <= 0){ |
|
|
|
|
areaDutyVo.setWorkRegularlyRate(0.0); |
|
|
|
|
}else{ |
|
|
|
|
double workRegularlyRate = BigDecimal.valueOf(areaDutyVo.getWorkRegularly() / (double)areaDutyVo.getWorkRegularlySum() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|
areaDutyVo.setWorkRegularlyRate(workRegularlyRate); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |