|
|
@ -12,20 +12,25 @@ import com.hnac.hzims.operational.defect.vo.OperDefectStatisticsExportVO; |
|
|
|
import com.hnac.hzims.operational.defect.vo.OperDefectStatisticsVO; |
|
|
|
import com.hnac.hzims.operational.defect.vo.OperDefectStatisticsVO; |
|
|
|
import com.hnac.hzims.operational.defect.vo.StatistictCount; |
|
|
|
import com.hnac.hzims.operational.defect.vo.StatistictCount; |
|
|
|
import com.hnac.hzims.operational.defect.vo.StatistictCountVo; |
|
|
|
import com.hnac.hzims.operational.defect.vo.StatistictCountVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.workTicket.feign.ITicketInfoClient; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
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.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 服务实现类 |
|
|
|
* 服务实现类 |
|
|
@ -40,6 +45,8 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS |
|
|
|
private ISysClient sysClient; |
|
|
|
private ISysClient sysClient; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IUserClient userClient; |
|
|
|
private IUserClient userClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private ITicketInfoClient iTicketInfoClient; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取设备缺陷统计数据 |
|
|
|
* 获取设备缺陷统计数据 |
|
|
@ -153,52 +160,64 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<OperDefectStatisticsExportVO> getDefectStatisticsExportVO(List<OperDefectStatisticsEntity> list) { |
|
|
|
public List<OperDefectStatisticsExportVO> getDefectStatisticsExportVO(List<OperDefectStatisticsEntity> list) { |
|
|
|
List<OperDefectStatisticsExportVO> res=new ArrayList<>(); |
|
|
|
if (list != null && list.size() > 0) { |
|
|
|
if(list!=null && list.size()>0){ |
|
|
|
List<OperDefectStatisticsExportVO> defectLevel = list.parallelStream().map(entity -> { |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
OperDefectStatisticsExportVO operDefectStatisticsExportVO = new OperDefectStatisticsExportVO(); |
|
|
|
OperDefectStatisticsExportVO operDefectStatisticsExportVO = new OperDefectStatisticsExportVO(); |
|
|
|
Long createDept = entity.getCreateDept(); |
|
|
|
operDefectStatisticsExportVO.setNumber(i+1); |
|
|
|
R<String> deptName = sysClient.getDeptName(createDept); |
|
|
|
OperDefectStatisticsEntity entity = list.get(i); |
|
|
|
if (deptName.isSuccess() && ObjectUtils.isNotEmpty(deptName.getData())) { |
|
|
|
Long createDept = entity.getCreateDept(); |
|
|
|
operDefectStatisticsExportVO.setDeptName(deptName.getData()); |
|
|
|
R<Dept> dept = sysClient.getDept(createDept); |
|
|
|
} |
|
|
|
if (dept.isSuccess()&& ObjectUtils.isNotEmpty(dept.getData())){ |
|
|
|
operDefectStatisticsExportVO.setDefectCode(entity.getDefectCode()); |
|
|
|
operDefectStatisticsExportVO.setDeptName(dept.getData().getDeptName()); |
|
|
|
if (ObjectUtils.isNotEmpty(entity.getFinder())) { |
|
|
|
} |
|
|
|
User user = UserCache.getUser(entity.getFinder()); |
|
|
|
operDefectStatisticsExportVO.setDefectCode(entity.getDefectCode()); |
|
|
|
if (ObjectUtils.isNotEmpty(user)) { |
|
|
|
if (ObjectUtils.isNotEmpty(entity.getFinder())) { |
|
|
|
operDefectStatisticsExportVO.setFinderName(user.getName()); |
|
|
|
R<User> finderUser = userClient.userInfoById(entity.getFinder()); |
|
|
|
} |
|
|
|
if (finderUser.isSuccess() && ObjectUtils.isNotEmpty(finderUser.getData())) { |
|
|
|
// R<User> finderUser = userClient.userInfoById(entity.getFinder());
|
|
|
|
operDefectStatisticsExportVO.setFinderName(finderUser.getData().getName()); |
|
|
|
// if (finderUser.isSuccess() && ObjectUtils.isNotEmpty(finderUser.getData())) {
|
|
|
|
} |
|
|
|
// operDefectStatisticsExportVO.setFinderName(finderUser.getData().getName());
|
|
|
|
} |
|
|
|
// }
|
|
|
|
if (StringUtils.isNotBlank(entity.getPlanHandler())) { |
|
|
|
} |
|
|
|
R<User> planHandlerUser = userClient.userInfoById(Long.valueOf(entity.getPlanHandler())); |
|
|
|
if (StringUtils.isNotBlank(entity.getPlanHandler())) { |
|
|
|
if (planHandlerUser.isSuccess() && ObjectUtils.isNotEmpty(planHandlerUser.getData())) { |
|
|
|
User user = UserCache.getUser(Long.valueOf(entity.getPlanHandler())); |
|
|
|
operDefectStatisticsExportVO.setPlanHandler(planHandlerUser.getData().getName()); |
|
|
|
if (ObjectUtils.isNotEmpty(user)) { |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setPlanHandler(user.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// R<User> planHandlerUser = userClient.userInfoById(Long.valueOf(entity.getPlanHandler()));
|
|
|
|
|
|
|
|
// if (planHandlerUser.isSuccess() && ObjectUtils.isNotEmpty(planHandlerUser.getData())) {
|
|
|
|
|
|
|
|
// operDefectStatisticsExportVO.setPlanHandler(planHandlerUser.getData().getName());
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(entity.getFindTime())) { |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setFindTime(entity.getFindTime()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getFaultName())) { |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setFaultName(entity.getFaultName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getDefectLevel())) { |
|
|
|
|
|
|
|
String level = DictCache.getValue("defectLevel", entity.getDefectLevel()); |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setDefectLevel(level); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(entity.getActStartTime())) { |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setActStartTime(entity.getActStartTime()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getDisposeDesc())) { |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setDisposeDesc(entity.getDisposeDesc()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getTicketId())) { |
|
|
|
|
|
|
|
R<List<WorkTicketInfoEntity>> workTicketInfoById = iTicketInfoClient.getWorkTicketInfoById(Arrays.asList(Long.valueOf(entity.getTicketId()))); |
|
|
|
|
|
|
|
if (workTicketInfoById.isSuccess()&&CollectionUtil.isNotEmpty(workTicketInfoById.getData())) { |
|
|
|
|
|
|
|
//获取工作票的编码Id
|
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setTicketId(workTicketInfoById.getData().get(0).getCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return operDefectStatisticsExportVO; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
).collect(Collectors.toList()); |
|
|
|
if (ObjectUtils.isNotEmpty(entity.getFindTime())) { |
|
|
|
return defectLevel; |
|
|
|
operDefectStatisticsExportVO.setFindTime(entity.getFindTime()); |
|
|
|
} else { |
|
|
|
} |
|
|
|
return new ArrayList<>(); |
|
|
|
if (StringUtils.isNotBlank(entity.getDescripiton())) { |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setDescripiton(entity.getDescripiton()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getDefectLevel())) { |
|
|
|
|
|
|
|
String level = DictCache.getValue("defectLevel",entity.getDefectLevel()); |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setDefectLevel(level); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(entity.getActStartTime())) { |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setActStartTime(entity.getActStartTime()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getDisposeDesc())) { |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setDisposeDesc(entity.getDisposeDesc()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getTicketId())) { |
|
|
|
|
|
|
|
operDefectStatisticsExportVO.setTicketId(entity.getTicketId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
res.add(operDefectStatisticsExportVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return res; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|