781 lines
32 KiB
Plaintext
781 lines
32 KiB
Plaintext
|
|
package com.sercurityControl.proteam.dutyTask.service;
|
||
|
|
|
||
|
|
import com.alibaba.fastjson2.JSONArray;
|
||
|
|
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||
|
|
import com.github.pagehelper.PageInfo;
|
||
|
|
import com.google.common.collect.Maps;
|
||
|
|
import com.securityControl.common.core.utils.StringUtils;
|
||
|
|
import com.securityControl.common.core.utils.aes.DateTimeHelper;
|
||
|
|
import com.securityControl.common.core.utils.aes.ListHelper;
|
||
|
|
import com.securityControl.common.core.utils.aes.StringHelper;
|
||
|
|
import com.securityControl.common.core.web.domain.AjaxResult;
|
||
|
|
import com.sercurityControl.proteam.callInterface.domain.TeamInfo;
|
||
|
|
import com.sercurityControl.proteam.domain.BallGpsEntity;
|
||
|
|
import com.sercurityControl.proteam.domain.vo.PBallGpsEntity;
|
||
|
|
import com.sercurityControl.proteam.domain.vo.PGpsDtoEntity;
|
||
|
|
import com.sercurityControl.proteam.domain.vo.WorkDetailsVo;
|
||
|
|
import com.sercurityControl.proteam.dutyTask.domain.*;
|
||
|
|
import com.sercurityControl.proteam.dutyTask.mapper.RiskWarnMapper;
|
||
|
|
import com.sercurityControl.proteam.dutyTask.mapper.TodayTaskMapper;
|
||
|
|
import com.sercurityControl.proteam.newScreen.domain.GBExcellRateEntity;
|
||
|
|
import com.sercurityControl.proteam.util.*;
|
||
|
|
import com.sgcc.ebuild2.component.crypto.util.CryptoUtil;
|
||
|
|
import org.slf4j.Logger;
|
||
|
|
import org.slf4j.LoggerFactory;
|
||
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
import org.springframework.transaction.annotation.Transactional;
|
||
|
|
|
||
|
|
import javax.annotation.Resource;
|
||
|
|
import java.math.BigDecimal;
|
||
|
|
import java.text.DecimalFormat;
|
||
|
|
import java.text.ParseException;
|
||
|
|
import java.text.SimpleDateFormat;
|
||
|
|
import java.util.*;
|
||
|
|
import java.util.concurrent.Callable;
|
||
|
|
import java.util.concurrent.ExecutionException;
|
||
|
|
import java.util.concurrent.Future;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 值班任务-今日任务业务层实现类
|
||
|
|
*/
|
||
|
|
@Service(value = "TodayTaskService")
|
||
|
|
public class TodayTaskServiceImpl implements TodayTaskService {
|
||
|
|
|
||
|
|
Logger log = LoggerFactory.getLogger(TodayTaskServiceImpl.class);
|
||
|
|
|
||
|
|
@Resource(name = "TodayTaskMapper")
|
||
|
|
private TodayTaskMapper mapper;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
@Resource(name = "testTaskExecutor")
|
||
|
|
private ThreadPoolTaskExecutor testTaskExecutor;
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
private VideoConfigUtil configUtil;
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public PageInfo<TodayTaskVo> getJJTaskList(TodayTaskDto todayTaskDto) throws ExecutionException, InterruptedException {
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getBuildCode())) {
|
||
|
|
String[] buildCodeArr = todayTaskDto.getBuildCode().split(",");
|
||
|
|
List<String> buildCodeList = Arrays.asList(buildCodeArr);
|
||
|
|
todayTaskDto.setBuildCodeList(buildCodeList);
|
||
|
|
}
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getRiskLevel())) {
|
||
|
|
String[] riskLevelArr = todayTaskDto.getRiskLevel().split(",");
|
||
|
|
List<String> riskLevelList = Arrays.asList(riskLevelArr);
|
||
|
|
todayTaskDto.setRiskLevelList(riskLevelList);
|
||
|
|
}
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getProStatus())) {
|
||
|
|
String[] proStatusArr = todayTaskDto.getProStatus().split(",");
|
||
|
|
List<String> proStatusList = Arrays.asList(proStatusArr);
|
||
|
|
todayTaskDto.setProStatusList(proStatusList);
|
||
|
|
}
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getBidName())) {
|
||
|
|
String[] bidNameArr = todayTaskDto.getBidName().split(",");
|
||
|
|
List<String> bidNameList = Arrays.asList(bidNameArr);
|
||
|
|
todayTaskDto.setBidNameList(bidNameList);
|
||
|
|
}
|
||
|
|
List<Future> futureList = new ArrayList<>();
|
||
|
|
List<TodayTaskVo> newList = new ArrayList<>();
|
||
|
|
//列表
|
||
|
|
List<TodayTaskVo> list = mapper.getJJTaskList(todayTaskDto);
|
||
|
|
PageInfo<TodayTaskVo> pageInfo = new PageInfo<>(list);
|
||
|
|
for (TodayTaskVo todayTaskVo : list) {
|
||
|
|
Future<TodayTaskVo> future = testTaskExecutor.submit(new Callable<TodayTaskVo>() {
|
||
|
|
@Override
|
||
|
|
public TodayTaskVo call() throws Exception {
|
||
|
|
// 根据站班会id获取违章记录数、工程累计违章数
|
||
|
|
todayTaskVo.setVoiNum(mapper.getVoiNum(todayTaskVo.getId()));
|
||
|
|
todayTaskVo.setProVoiNum(mapper.getProVoiNum(todayTaskVo.getBidNo()));
|
||
|
|
// 根据站班会id,开工日期获取开工时长
|
||
|
|
Double workHours=DateTimeHelper.getTimeHours(DateTimeHelper.getNowTime(),todayTaskVo.getStartTime());
|
||
|
|
todayTaskVo.setKgTime(workHours.toString());
|
||
|
|
// ff|
|
||
|
|
List<Map<String, String>> timeList = mapper.getTime(todayTaskVo.getPuid(), todayTaskVo.getWorkDay());
|
||
|
|
Double ballTime = getBallTime(timeList);
|
||
|
|
todayTaskVo.setKjTime(ballTime.toString());
|
||
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(workHours);
|
||
|
|
BigDecimal bigDecimal2 = BigDecimal.valueOf(ballTime);
|
||
|
|
if (bigDecimal.subtract(bigDecimal2).doubleValue() > 0.5) {
|
||
|
|
todayTaskVo.setIsHg("2"); // 不合格
|
||
|
|
}else{
|
||
|
|
todayTaskVo.setIsHg("1"); // 合格
|
||
|
|
}
|
||
|
|
// 根据站班会id 获取到岗履职
|
||
|
|
Map<String, Object> map = mapper.getOnDuty(todayTaskVo.getId());
|
||
|
|
todayTaskVo.setYzDuty(String.valueOf(map.get("yz")));
|
||
|
|
todayTaskVo.setJlDuty(String.valueOf(map.get("jl")));
|
||
|
|
todayTaskVo.setSgDuty(String.valueOf(map.get("sg")));
|
||
|
|
todayTaskVo.setDutyTotalNum(Integer.parseInt(String.valueOf(map.get("yz"))) + Integer.parseInt(String.valueOf(map.get("jl"))) + Integer.parseInt(String.valueOf(map.get("sg"))));
|
||
|
|
// 获取作业票主要风险
|
||
|
|
List<DataInfo> mainRiskList= mapper.getDataInfo(todayTaskVo.getTicketId(),"","40","03");
|
||
|
|
if(CollectionUtils.isNotEmpty(mainRiskList)){
|
||
|
|
todayTaskVo.setMainRisk(mainRiskList.get(0).getReplenishContent());
|
||
|
|
}
|
||
|
|
return todayTaskVo;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
futureList.add(future);
|
||
|
|
}
|
||
|
|
for (Future<TodayTaskVo> future : futureList) {
|
||
|
|
TodayTaskVo todayTaskVo = future.get();
|
||
|
|
newList.add(todayTaskVo);
|
||
|
|
}
|
||
|
|
pageInfo.setList(newList);
|
||
|
|
return pageInfo;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public PageInfo<TodayTaskVo> getTodayTaskList(TodayTaskDto todayTaskDto) throws Exception {
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getBuildCode())) {
|
||
|
|
String[] buildCodeArr = todayTaskDto.getBuildCode().split(",");
|
||
|
|
List<String> buildCodeList = Arrays.asList(buildCodeArr);
|
||
|
|
todayTaskDto.setBuildCodeList(buildCodeList);
|
||
|
|
}
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getRiskLevel())) {
|
||
|
|
String[] riskLevelArr = todayTaskDto.getRiskLevel().split(",");
|
||
|
|
List<String> riskLevelList = Arrays.asList(riskLevelArr);
|
||
|
|
todayTaskDto.setRiskLevelList(riskLevelList);
|
||
|
|
}
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getProStatus())) {
|
||
|
|
String[] proStatusArr = todayTaskDto.getProStatus().split(",");
|
||
|
|
List<String> proStatusList = Arrays.asList(proStatusArr);
|
||
|
|
todayTaskDto.setProStatusList(proStatusList);
|
||
|
|
}
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getBidName())) {
|
||
|
|
String[] bidNameArr = todayTaskDto.getBidName().split(",");
|
||
|
|
List<String> bidNameList = Arrays.asList(bidNameArr);
|
||
|
|
todayTaskDto.setBidNameList(bidNameList);
|
||
|
|
}
|
||
|
|
// 多线程执行操作,存放的数据集合
|
||
|
|
List<Future> futureList = new ArrayList<>();
|
||
|
|
List<TodayTaskVo> newList = new ArrayList<>();
|
||
|
|
if (!compareTime()) {
|
||
|
|
todayTaskDto.setIsSortByTime("1");
|
||
|
|
}
|
||
|
|
//导出
|
||
|
|
List<TodayTaskVo> list = mapper.getJJTaskList(todayTaskDto);
|
||
|
|
PageInfo<TodayTaskVo> pageInfo = new PageInfo<>(list);
|
||
|
|
for (TodayTaskVo todayTaskVo : list) {
|
||
|
|
Future<TodayTaskVo> future = testTaskExecutor.submit(new Callable<TodayTaskVo>() {
|
||
|
|
@Override
|
||
|
|
public TodayTaskVo call() throws Exception {
|
||
|
|
// 根据站班会id获取违章记录数、工程累计违章数
|
||
|
|
todayTaskVo.setVoiNum(mapper.getVoiNum(todayTaskVo.getId()));
|
||
|
|
todayTaskVo.setProVoiNum(mapper.getProVoiNum(todayTaskVo.getBidNo()));
|
||
|
|
// 根据站班会id,开工日期获取开工时长
|
||
|
|
Double workHours=DateTimeHelper.getTimeHours(DateTimeHelper.getNowTime(),todayTaskVo.getStartTime());
|
||
|
|
todayTaskVo.setKgTime(workHours.toString());
|
||
|
|
// 根据puid获取球机在线时长
|
||
|
|
List<Map<String, String>> timeList = mapper.getTime(todayTaskVo.getPuid(), todayTaskVo.getWorkDay());
|
||
|
|
Double ballTime = getBallTime(timeList);
|
||
|
|
todayTaskVo.setKjTime(ballTime.toString());
|
||
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(workHours);
|
||
|
|
BigDecimal bigDecimal2 = BigDecimal.valueOf(ballTime);
|
||
|
|
if (bigDecimal.subtract(bigDecimal2).doubleValue() > 0.5) {
|
||
|
|
todayTaskVo.setIsHg("2"); // 不合格
|
||
|
|
}else{
|
||
|
|
todayTaskVo.setIsHg("1"); // 合格
|
||
|
|
}
|
||
|
|
// 根据站班会id 获取到岗履职
|
||
|
|
Map<String, Object> map = mapper.getOnDuty(todayTaskVo.getId());
|
||
|
|
todayTaskVo.setYzDuty(String.valueOf(map.get("yz")));
|
||
|
|
todayTaskVo.setJlDuty(String.valueOf(map.get("jl")));
|
||
|
|
todayTaskVo.setSgDuty(String.valueOf(map.get("sg")));
|
||
|
|
todayTaskVo.setDutyTotalNum(Integer.parseInt(String.valueOf(map.get("yz"))) + Integer.parseInt(String.valueOf(map.get("jl"))) + Integer.parseInt(String.valueOf(map.get("sg"))));
|
||
|
|
// 获取作业票主要风险
|
||
|
|
List<DataInfo> mainRiskList= mapper.getDataInfo(todayTaskVo.getTicketId(),"","40","03");
|
||
|
|
if(CollectionUtils.isNotEmpty(mainRiskList)){
|
||
|
|
todayTaskVo.setMainRisk(mainRiskList.get(0).getReplenishContent());
|
||
|
|
}
|
||
|
|
return todayTaskVo;
|
||
|
|
}
|
||
|
|
});
|
||
|
|
futureList.add(future);
|
||
|
|
}
|
||
|
|
for (Future<TodayTaskVo> future : futureList) {
|
||
|
|
TodayTaskVo todayTaskVo = future.get();
|
||
|
|
newList.add(todayTaskVo);
|
||
|
|
}
|
||
|
|
pageInfo.setList(newList);
|
||
|
|
return pageInfo;
|
||
|
|
}
|
||
|
|
|
||
|
|
public static Double getBallTime(List<Map<String, String>> list) throws ParseException {
|
||
|
|
BigDecimal ballTime = new BigDecimal(new Double(0).toString());
|
||
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
||
|
|
for (Map<String, String> map : list) {
|
||
|
|
String upTime = map.get("upTime");
|
||
|
|
String downTime = map.get("downTime");
|
||
|
|
if (StringUtils.isNotBlank(downTime)) {
|
||
|
|
Double timeHours = DateTimeHelper.getTimeHours(downTime, upTime);
|
||
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(timeHours);
|
||
|
|
ballTime = ballTime.add(bigDecimal);
|
||
|
|
} else {
|
||
|
|
Double timeHours = DateTimeHelper.getTimeHours(DateTimeHelper.getNowTime(), upTime);
|
||
|
|
BigDecimal bigDecimal = BigDecimal.valueOf(timeHours);
|
||
|
|
ballTime = ballTime.add(bigDecimal);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return ballTime.doubleValue();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return boolean
|
||
|
|
* @author cw chen
|
||
|
|
* @description 判断当前时间,是否是下午四点之后
|
||
|
|
* @Param
|
||
|
|
* @date 2023-04-13 10:02
|
||
|
|
*/
|
||
|
|
public static boolean compareTime() throws Exception {
|
||
|
|
SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||
|
|
String nowDate = DateTimeHelper.getNowDate() + " 16:00:00";
|
||
|
|
String nowTime = DateTimeHelper.getNowTime();
|
||
|
|
long time = simpleFormat.parse(nowDate).getTime();
|
||
|
|
long time2 = simpleFormat.parse(nowTime).getTime();
|
||
|
|
return time > time2;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 球技上下行時長表
|
||
|
|
*
|
||
|
|
* @param deviceUpDownVo
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public Map<String, Object> getBallTimeList(DeviceUpDownVo deviceUpDownVo) {
|
||
|
|
Map<String, Object> map = Maps.newHashMap();
|
||
|
|
try {
|
||
|
|
if (StringHelper.isEmpty(deviceUpDownVo.getCreateDay())) {//默认时间
|
||
|
|
deviceUpDownVo.setCreateDay(DateTimeHelper.getNowDay());
|
||
|
|
}
|
||
|
|
List<DeviceUpDownVo> list = mapper.getBallTimeList(deviceUpDownVo);
|
||
|
|
for (DeviceUpDownVo vo : list) {
|
||
|
|
if (StringHelper.isEmpty(vo.getDownTime())) {
|
||
|
|
Double hours = DateTimeHelper.getTimeHours(DateTimeHelper.getNowTime(), vo.getUpTime());
|
||
|
|
vo.setHours(hours.toString());
|
||
|
|
} else {
|
||
|
|
Double hours = DateTimeHelper.getTimeHours(vo.getDownTime(), vo.getUpTime());
|
||
|
|
vo.setHours(hours.toString());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
map.put("code", 200);
|
||
|
|
map.put("msg", "查询成功");
|
||
|
|
map.put("count", list.size());
|
||
|
|
map.put("data", list);
|
||
|
|
|
||
|
|
} catch (Exception e) {
|
||
|
|
map.put("code", 500);
|
||
|
|
map.put("msg", "查询异常");
|
||
|
|
map.put("count", 0);
|
||
|
|
map.put("data", new ArrayList<DeviceUpDownVo>());
|
||
|
|
}
|
||
|
|
|
||
|
|
return map;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询站班会基础数据信息
|
||
|
|
*
|
||
|
|
* @param classMettingVo
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public ClassMettingVo getClassMettingDetails(ClassMettingVo classMettingVo) {
|
||
|
|
try {
|
||
|
|
// ClassMettingVo vo = mapper.getClassMettingDetails(classMettingVo);
|
||
|
|
List<ClassMettingVo> list = mapper.getJjClassMettingDetails(classMettingVo);
|
||
|
|
if(ListHelper.isNotEmpty(list)){
|
||
|
|
ClassMettingVo vo=list.get(0);
|
||
|
|
//查询施工内容 及作业工序信息
|
||
|
|
WorkDetailsVo wo=getWorkDetails(vo.getRiskProductId());
|
||
|
|
//内容
|
||
|
|
vo.setWorkContent(wo.getContent());
|
||
|
|
//工序
|
||
|
|
vo.setWorkGx(wo.getWorkGx());
|
||
|
|
vo.setWorkType(wo.getWorkType());
|
||
|
|
vo.setWorkPosition(wo.getWorkSite());
|
||
|
|
|
||
|
|
List<DataInfo> infoList=mapper.getDataInfo(vo.getClassId(),"","60","");
|
||
|
|
if(ListHelper.isNotEmpty(infoList)){
|
||
|
|
//备注
|
||
|
|
List<DataInfo> infoList2=mapper.getDataInfo(infoList.get(0).getId(),"","70","01");
|
||
|
|
vo.setRemarks(getInfoData(infoList2));
|
||
|
|
//现场风险复测变化情况及补充措施
|
||
|
|
List<DataInfo> infoList3=mapper.getDataInfo(infoList.get(0).getId(),"","70","02");
|
||
|
|
vo.setChanges(getInfoData(infoList3));
|
||
|
|
//风险异常原因
|
||
|
|
List<DataInfo> infoList4=mapper.getDataInfo(infoList.get(0).getId(),"","70","03");
|
||
|
|
vo.setErrReason(getInfoData(infoList4));
|
||
|
|
//补充安全控制措施
|
||
|
|
List<DataInfo> infoList5=mapper.getDataInfo(infoList.get(0).getId(),"","70","04");
|
||
|
|
vo.setControll(getInfoData(infoList5));
|
||
|
|
}
|
||
|
|
// 获取班组评价标签
|
||
|
|
List<String> teamLabels = mapper.getTeamLabels(vo.getTeamId());
|
||
|
|
List<String> teamLabelsNum = getTeamLabelsNum(teamLabels);
|
||
|
|
vo.setTeamLabels(teamLabelsNum);
|
||
|
|
// getLatLon(vo);//经纬度实时
|
||
|
|
return vo;
|
||
|
|
}
|
||
|
|
return new ClassMettingVo();
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error(e.toString(), e);
|
||
|
|
return new ClassMettingVo();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private WorkDetailsVo getWorkDetails(String riskProductId){
|
||
|
|
WorkDetailsVo workDetailsVo=new WorkDetailsVo();
|
||
|
|
try{
|
||
|
|
if (StringHelper.isEmpty(riskProductId)) {
|
||
|
|
return workDetailsVo;
|
||
|
|
}
|
||
|
|
List<String> riskId=Arrays.asList(riskProductId.split(","));
|
||
|
|
List<WorkDetailsVo> details=mapper.getWorkDetails(riskId);
|
||
|
|
StringBuffer workSite=new StringBuffer();
|
||
|
|
StringBuffer content=new StringBuffer();
|
||
|
|
StringBuffer workGx=new StringBuffer();
|
||
|
|
StringBuffer workType=new StringBuffer();
|
||
|
|
if(ListHelper.isNotEmpty(details)){
|
||
|
|
details.forEach(vo->{
|
||
|
|
if(StringHelper.isNotEmpty(vo.getWorkSite())){
|
||
|
|
if(StringHelper.isNotEmpty(workSite.toString())){
|
||
|
|
workSite.append(",");
|
||
|
|
}
|
||
|
|
workSite.append(vo.getWorkSite());
|
||
|
|
}
|
||
|
|
if(StringHelper.isNotEmpty(vo.getContent())){
|
||
|
|
if(StringHelper.isNotEmpty(content.toString())){
|
||
|
|
content.append(",");
|
||
|
|
}
|
||
|
|
content.append(vo.getContent());
|
||
|
|
}
|
||
|
|
if(StringHelper.isNotEmpty(vo.getWorkGx())){
|
||
|
|
if(StringHelper.isNotEmpty(workGx.toString())){
|
||
|
|
workGx.append(",");
|
||
|
|
}
|
||
|
|
workGx.append(vo.getWorkGx());
|
||
|
|
}
|
||
|
|
if(StringHelper.isNotEmpty(vo.getWorkType())){
|
||
|
|
if(StringHelper.isNotEmpty(workType.toString())){
|
||
|
|
workType.append(",");
|
||
|
|
}
|
||
|
|
workType.append(vo.getWorkType());
|
||
|
|
}
|
||
|
|
});
|
||
|
|
workDetailsVo.setWorkType(workType.toString());
|
||
|
|
workDetailsVo.setWorkSite(workSite.toString());
|
||
|
|
workDetailsVo.setContent(content.toString());
|
||
|
|
workDetailsVo.setWorkGx(workGx.toString());
|
||
|
|
}
|
||
|
|
}catch (Exception e){
|
||
|
|
log.error(e.toString(),e);
|
||
|
|
}
|
||
|
|
return workDetailsVo;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 信息
|
||
|
|
* @param list
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public String getInfoData(List<DataInfo> list){
|
||
|
|
try{
|
||
|
|
if(ListHelper.isNotEmpty(list)) {
|
||
|
|
return list.get(0).getReplenishContent();
|
||
|
|
}
|
||
|
|
}catch (Exception e){
|
||
|
|
log.error(e.toString(), e);
|
||
|
|
}
|
||
|
|
return "";
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<String> getTeamLabelsNum(List<String> teamLabels){
|
||
|
|
Map<String, Integer> countMap = new HashMap<>(16); // 定义HashMap对象
|
||
|
|
List<String> list = new ArrayList<>();
|
||
|
|
List<String> returnList = new ArrayList<>();
|
||
|
|
if(CollectionUtils.isNotEmpty(teamLabels)){
|
||
|
|
teamLabels.forEach(item->{
|
||
|
|
if(StringUtils.isNotEmpty(item)){
|
||
|
|
String[] labelArr = item.split(",");
|
||
|
|
for (String labelName : labelArr) {
|
||
|
|
list.add(labelName);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
for (String str : list) {
|
||
|
|
if (!countMap.containsKey(str)) {
|
||
|
|
countMap.put(str, 1);
|
||
|
|
} else {
|
||
|
|
int currentValue = countMap.get(str);
|
||
|
|
countMap.replace(str, currentValue + 1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
for (Map.Entry<String, Integer> entry : countMap.entrySet()) {
|
||
|
|
System.out.println(entry.getKey() + ": " + entry.getValue());
|
||
|
|
returnList.add(entry.getKey() + "@" + entry.getValue());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return returnList;
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 实时获取
|
||
|
|
* @param vo
|
||
|
|
*/
|
||
|
|
private void getLatLon(ClassMettingVo vo) {
|
||
|
|
try{
|
||
|
|
String puid=vo.getPuId();
|
||
|
|
String url= configUtil.getUrl();
|
||
|
|
Map<String, Object> maps= configUtil.getMaps();
|
||
|
|
String token = QxVideotape.login(maps,url);
|
||
|
|
String status = QxVideotape.getBallStatus(puid, token,maps,url);
|
||
|
|
System.err.println(status);
|
||
|
|
if("1".equals(status)){
|
||
|
|
PBallGpsEntity entity=QxVideotape.getBallGps(puid,token,maps,url);
|
||
|
|
if (entity!=null){
|
||
|
|
if(ListHelper.isNotEmpty(entity.getRes())){
|
||
|
|
PGpsDtoEntity gps =entity.getRes().get(0).getGps();
|
||
|
|
if(gps!=null){
|
||
|
|
// GPSTransToAMapUtil.AMap aMap = GPSTransToAMapUtil.transform(lon, lat);
|
||
|
|
vo.setLat(gps.getLatitude());
|
||
|
|
vo.setLon(gps.getLongitude());
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
//转换
|
||
|
|
vo.setJwd(vo.getLon()+","+vo.getLat());
|
||
|
|
double lon=Double.parseDouble(vo.getLon());
|
||
|
|
double lat=Double.parseDouble(vo.getLat());
|
||
|
|
GPSTransToAMapUtil.AMap aMap = GPSTransToAMapUtil.transform(lon, lat);
|
||
|
|
vo.setLat(aMap.getLatitude()+"");
|
||
|
|
vo.setLon(aMap.getLongitude()+"");
|
||
|
|
|
||
|
|
}catch (Exception e){
|
||
|
|
log.error(e.toString(),e);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
private void getTicketFile(ClassMettingVo vo) {
|
||
|
|
try {
|
||
|
|
String bast64 = InterfaceUtil.getTicketImageData(vo.getTicketId());
|
||
|
|
if (StringHelper.isNotEmpty(bast64)) {
|
||
|
|
vo.setFilePath(bast64);
|
||
|
|
}
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error(e.toString(), e);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param imagesVo
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public List<ClassMettingImageVo> getZbhImage(ClassMettingImageVo imagesVo) {
|
||
|
|
try {
|
||
|
|
List<ClassMettingImageVo> list = new ArrayList<>();
|
||
|
|
for (ClassMettingImageVo vo : list) {
|
||
|
|
String bast64 = InterfaceUtil.getZbhImageData(vo.getId());//获取图片id
|
||
|
|
if (StringHelper.isNotEmpty(bast64)) {
|
||
|
|
if ("2".equals(vo.getImageType())) {//安全交底 1
|
||
|
|
vo.setImageType("1");
|
||
|
|
} else if ("7".equals(vo.getImageType())) {//现场勘查 2
|
||
|
|
vo.setImageType("2");
|
||
|
|
} else if ("14".equals(vo.getImageType())) {//地脚螺旋 3
|
||
|
|
vo.setImageType("3");
|
||
|
|
} else if ("17".equals(vo.getImageType())) {//跨越架 4
|
||
|
|
vo.setImageType("4");
|
||
|
|
} else if ("16".equals(vo.getImageType())) {//地锚 5
|
||
|
|
vo.setImageType("5");
|
||
|
|
} else if ("13".equals(vo.getImageType())) { //6 有限空间
|
||
|
|
vo.setImageType("6");
|
||
|
|
} else if ("20".equals(vo.getImageType())) {//人员上塔 7
|
||
|
|
vo.setImageType("7");
|
||
|
|
}else if("21".equals(vo.getImageType())){//吊车 8
|
||
|
|
vo.setImageType("8");
|
||
|
|
}else if("22".equals(vo.getImageType())){//绝缘子短接 9
|
||
|
|
vo.setImageType("9");
|
||
|
|
}else {//现场勘查
|
||
|
|
vo.setImageType("10");
|
||
|
|
}
|
||
|
|
vo.setImagePath(bast64);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return list;
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error(e.toString(), e);
|
||
|
|
return new ArrayList<ClassMettingImageVo>();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 施工方案的获取
|
||
|
|
*
|
||
|
|
* @param sgFaVo
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public JSONArray getSgFa(SgFaVo sgFaVo) {
|
||
|
|
try {
|
||
|
|
JSONArray list = InterfaceUtil.getSgFa(sgFaVo.getBidNo());//获取图片id
|
||
|
|
return list;
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error(e.toString(), e);
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取站班会人员数据
|
||
|
|
*
|
||
|
|
* @param peopleVo
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public Map<String, Object> getZbhPeople(ClassMettingPeopleVo peopleVo) {
|
||
|
|
Map<String, Object> map = Maps.newHashMap();
|
||
|
|
try {
|
||
|
|
//施工人员包含临时人员
|
||
|
|
List<ClassMettingPeopleVo> sgPeople = mapper.getZbhPeople(peopleVo);
|
||
|
|
map.put("code", "200");
|
||
|
|
map.put("msg", "请求成功");
|
||
|
|
map.put("sgPeople", sgPeople);
|
||
|
|
// map.put("lsPeople", lsPeople);
|
||
|
|
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error(e.toString(),e);
|
||
|
|
map.put("code", "201");
|
||
|
|
map.put("msg", "参数解析异常");
|
||
|
|
map.put("sgPeople", new ArrayList<ClassMettingPeopleVo>());
|
||
|
|
map.put("lsPeople", new ArrayList<ClassMettingPeopleVo>());
|
||
|
|
|
||
|
|
}
|
||
|
|
return map;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取站班会风险到岗人员数据
|
||
|
|
*
|
||
|
|
* @param peopleVo
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public Map<String, Object> getClassMettingSign(ClassMettingPeopleVo peopleVo) {
|
||
|
|
Map<String, Object> map = Maps.newHashMap();
|
||
|
|
try {
|
||
|
|
List<ClassMettingPeopleVo> list = mapper.getClassMettingSign(peopleVo);
|
||
|
|
map.put("code", 200);
|
||
|
|
map.put("msg", "查询成功");
|
||
|
|
map.put("count", list.size());
|
||
|
|
map.put("data", list);
|
||
|
|
} catch (Exception e) {
|
||
|
|
map.put("code", 500);
|
||
|
|
map.put("msg", "查询异常");
|
||
|
|
map.put("count", 0);
|
||
|
|
map.put("data", new ArrayList<DeviceUpDownVo>());
|
||
|
|
}
|
||
|
|
|
||
|
|
return map;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
@Transactional(rollbackFor = Exception.class)
|
||
|
|
public void addClassMeetingReqAndImg(ExceptionReportEntity entity, List<ExceptionReportImageEntity> list) {
|
||
|
|
mapper.addClassMeetingReq(entity);
|
||
|
|
list.forEach(item -> {
|
||
|
|
item.setReqId(entity.getId());
|
||
|
|
});
|
||
|
|
mapper.addClassMeetingReqImg(list);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
@Transactional(rollbackFor = Exception.class)
|
||
|
|
public void addNoticeVioAndImg(NoticeVioEntity entity, List<NoticeVioImgEntity> list) {
|
||
|
|
List<NoticePeoEntity> noticePeoList = new ArrayList<>();
|
||
|
|
// 获取违章通知记录上一个编号
|
||
|
|
String lastSerNo = mapper.getLastSerNo();
|
||
|
|
if (lastSerNo == null) {
|
||
|
|
lastSerNo = "1";
|
||
|
|
} else {
|
||
|
|
lastSerNo = (Integer.parseInt(lastSerNo) + 1) + "";
|
||
|
|
}
|
||
|
|
entity.setSerNo(lastSerNo);
|
||
|
|
// String teamLeaderNumber = mapper.getTeamLeadreIdNumber(entity.getClassId());
|
||
|
|
List<TeamInfo> teamInfo=mapper.getTeamInfo(entity.getClassId());
|
||
|
|
if(ListHelper.isNotEmpty(teamInfo)){
|
||
|
|
TeamInfo vo=teamInfo.get(0);
|
||
|
|
if(StringHelper.isNotEmpty(vo.getIdNumber())){
|
||
|
|
entity.setTeamLeaderNumber(vo.getIdNumber());
|
||
|
|
}
|
||
|
|
entity.setTeamId(vo.getTeamId());
|
||
|
|
}
|
||
|
|
mapper.addNoticeVio(entity);
|
||
|
|
list.forEach(item -> {
|
||
|
|
item.setNotiId(entity.getId());
|
||
|
|
});
|
||
|
|
mapper.addNoticeVioImg(list);
|
||
|
|
if(StringHelper.isNotEmpty(entity.getVioUsers())){
|
||
|
|
String[] vioUsersArr = entity.getVioUsers().split(",");
|
||
|
|
String[] idNumberArr = entity.getIdNumber().split(",");
|
||
|
|
String[] scoreArr = entity.getScore().split(",");
|
||
|
|
for (int i = 0; i < vioUsersArr.length; i++) {
|
||
|
|
NoticePeoEntity noticePeoEntity = new NoticePeoEntity();
|
||
|
|
noticePeoEntity.setName(vioUsersArr[i]);
|
||
|
|
noticePeoEntity.setIdNumber(idNumberArr[i]);
|
||
|
|
noticePeoEntity.setScore(scoreArr[i]);
|
||
|
|
noticePeoEntity.setClassId(entity.getClassId());
|
||
|
|
noticePeoEntity.setNotiId(entity.getId());
|
||
|
|
noticePeoList.add(noticePeoEntity);
|
||
|
|
}
|
||
|
|
mapper.insertTeamBlack(noticePeoList);
|
||
|
|
mapper.addNoticePeo(noticePeoList);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public List<ExceptionReportEntity> getExceptionReportList(String classId) {
|
||
|
|
return mapper.getExceptionReportList(classId);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public List<ClassMettingPeopleVo> getPersonList(ClassMettingPeopleVo vo) {
|
||
|
|
return mapper.getPersonList(vo);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public List<NoticeVoiInfoVo> getVioInfoList(NoticeVoiInfoVo vo) {
|
||
|
|
return mapper.getVioInfoList(vo);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
@Transactional(rollbackFor = Exception.class)
|
||
|
|
public void updateImportTeam(String importTeam, String idNumber) {
|
||
|
|
mapper.updateImportTeam(importTeam, idNumber);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public List<Map<String, Object>> getOrgNumAndRate(TodayTaskDto todayTaskDto) {
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getRiskLevel())) {
|
||
|
|
String[] riskLevelArr = todayTaskDto.getRiskLevel().split(",");
|
||
|
|
List<String> riskLevelList = Arrays.asList(riskLevelArr);
|
||
|
|
todayTaskDto.setRiskLevelList(riskLevelList);
|
||
|
|
}
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getProStatus())) {
|
||
|
|
String[] proStatusArr = todayTaskDto.getProStatus().split(",");
|
||
|
|
List<String> proStatusList = Arrays.asList(proStatusArr);
|
||
|
|
todayTaskDto.setProStatusList(proStatusList);
|
||
|
|
}
|
||
|
|
if (StringUtils.isNotBlank(todayTaskDto.getBidName())) {
|
||
|
|
String[] bidNameArr = todayTaskDto.getBidName().split(",");
|
||
|
|
List<String> bidNameList = Arrays.asList(bidNameArr);
|
||
|
|
todayTaskDto.setBidNameList(bidNameList);
|
||
|
|
}
|
||
|
|
List<Map<String, Object>> list = mapper.getOrgNumAndRate(todayTaskDto);
|
||
|
|
int totalNum = 0;
|
||
|
|
for (Map<String, Object> map : list) {
|
||
|
|
totalNum += Integer.parseInt(String.valueOf(map.get("num")));
|
||
|
|
}
|
||
|
|
DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
||
|
|
for (Map<String, Object> map : list) {
|
||
|
|
if (totalNum == 0 || Integer.parseInt(String.valueOf(map.get("num"))) == 0) {
|
||
|
|
map.put("rate", "0.00%");
|
||
|
|
} else {
|
||
|
|
map.put("rate", decimalFormat.format(Integer.parseInt(String.valueOf(map.get("num"))) * 1.0 / totalNum * 1.0));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return list;
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public String getZbhWarnInfo(ClassMettingWarnVo warnVo) {
|
||
|
|
return mapper.getZbhWarnInfo(warnVo);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
@Transactional(rollbackFor = Exception.class)
|
||
|
|
public void updateWarnInfoByClassId(ClassMettingWarnVo vo) {
|
||
|
|
mapper.updateWarnInfoByClassId(vo);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public ClassMettingWarnVo getWarnInfo(ClassMettingWarnVo vo) {
|
||
|
|
return mapper.getWarnInfo(vo);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
@Transactional(rollbackFor = Exception.class)
|
||
|
|
public void addWarnInfo(ClassMettingWarnVo vo) {
|
||
|
|
mapper.addWarnInfo(vo);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 告警确认
|
||
|
|
* @param classId
|
||
|
|
* @param num
|
||
|
|
* @param confirm
|
||
|
|
*/
|
||
|
|
@Override
|
||
|
|
public void updeWarnConfirm(String classId, Integer num, String confirm) {
|
||
|
|
try{
|
||
|
|
String warn=mapper.getWanTypeByClassId(classId);
|
||
|
|
if (StringHelper.isNotEmpty(warn)){
|
||
|
|
String[] strs=warn.split(",");
|
||
|
|
if("true".equals(confirm)){
|
||
|
|
strs[num-1]=strs[num-1].split("@")[0];
|
||
|
|
strs[num-1]= strs[num-1]+"@"+1;
|
||
|
|
}else{
|
||
|
|
strs[num-1]=strs[num-1].split("@")[0];
|
||
|
|
}
|
||
|
|
String warnType = StringUtils.join(strs, ",");
|
||
|
|
System.err.println(warnType);
|
||
|
|
mapper.updateWarnInfoByClassIdConfirm(warnType,classId);
|
||
|
|
}
|
||
|
|
|
||
|
|
}catch (Exception e){
|
||
|
|
log.error(e.toString(),e);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public AjaxResult getTicketBase64(ClassMettingVo vo) {
|
||
|
|
Map<String, Object> map = new HashMap<>(16);
|
||
|
|
String base64 = null;
|
||
|
|
try {
|
||
|
|
base64 = InterfaceUtil.getTicketImageData(vo.getTicketId());
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error("作业票文件base64地址",e);
|
||
|
|
}
|
||
|
|
map.put("base64Url",base64);
|
||
|
|
return AjaxResult.success(map);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public AjaxResult getTeamLabels(ClassMettingVo vo) {
|
||
|
|
ClassMettingVo classMettingVo = new ClassMettingVo();
|
||
|
|
try {
|
||
|
|
List<String> teamLabels = mapper.getTeamLabels(vo.getTeamId());
|
||
|
|
List<String> teamLabelsNum = getTeamLabelsNum(teamLabels);
|
||
|
|
classMettingVo.setTeamLabels(teamLabelsNum);
|
||
|
|
} catch (Exception e) {
|
||
|
|
log.error("班组标签");
|
||
|
|
}
|
||
|
|
return AjaxResult.success(classMettingVo);
|
||
|
|
}
|
||
|
|
}
|