|
|
|
@ -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.StatistictCount; |
|
|
|
|
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.support.Condition; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
|
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.feign.IUserClient; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 服务实现类 |
|
|
|
@ -40,6 +45,8 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
|
|
|
|
|
private ISysClient sysClient; |
|
|
|
|
@Autowired |
|
|
|
|
private IUserClient userClient; |
|
|
|
|
@Autowired |
|
|
|
|
private ITicketInfoClient iTicketInfoClient; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取设备缺陷统计数据 |
|
|
|
@ -153,52 +160,64 @@ public class OperDefectStatisticsServiceImpl extends BaseServiceImpl<OperDefectS
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public List<OperDefectStatisticsExportVO> getDefectStatisticsExportVO(List<OperDefectStatisticsEntity> list) { |
|
|
|
|
List<OperDefectStatisticsExportVO> res=new ArrayList<>(); |
|
|
|
|
if(list!=null && list.size()>0){ |
|
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
|
OperDefectStatisticsExportVO operDefectStatisticsExportVO = new OperDefectStatisticsExportVO(); |
|
|
|
|
operDefectStatisticsExportVO.setNumber(i+1); |
|
|
|
|
OperDefectStatisticsEntity entity = list.get(i); |
|
|
|
|
Long createDept = entity.getCreateDept(); |
|
|
|
|
R<Dept> dept = sysClient.getDept(createDept); |
|
|
|
|
if (dept.isSuccess()&& ObjectUtils.isNotEmpty(dept.getData())){ |
|
|
|
|
operDefectStatisticsExportVO.setDeptName(dept.getData().getDeptName()); |
|
|
|
|
} |
|
|
|
|
operDefectStatisticsExportVO.setDefectCode(entity.getDefectCode()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(entity.getFinder())) { |
|
|
|
|
R<User> finderUser = userClient.userInfoById(entity.getFinder()); |
|
|
|
|
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 (planHandlerUser.isSuccess() && ObjectUtils.isNotEmpty(planHandlerUser.getData())) { |
|
|
|
|
operDefectStatisticsExportVO.setPlanHandler(planHandlerUser.getData().getName()); |
|
|
|
|
if (list != null && list.size() > 0) { |
|
|
|
|
List<OperDefectStatisticsExportVO> defectLevel = list.parallelStream().map(entity -> { |
|
|
|
|
OperDefectStatisticsExportVO operDefectStatisticsExportVO = new OperDefectStatisticsExportVO(); |
|
|
|
|
Long createDept = entity.getCreateDept(); |
|
|
|
|
R<String> deptName = sysClient.getDeptName(createDept); |
|
|
|
|
if (deptName.isSuccess() && ObjectUtils.isNotEmpty(deptName.getData())) { |
|
|
|
|
operDefectStatisticsExportVO.setDeptName(deptName.getData()); |
|
|
|
|
} |
|
|
|
|
operDefectStatisticsExportVO.setDefectCode(entity.getDefectCode()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(entity.getFinder())) { |
|
|
|
|
User user = UserCache.getUser(entity.getFinder()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(user)) { |
|
|
|
|
operDefectStatisticsExportVO.setFinderName(user.getName()); |
|
|
|
|
} |
|
|
|
|
// R<User> finderUser = userClient.userInfoById(entity.getFinder());
|
|
|
|
|
// if (finderUser.isSuccess() && ObjectUtils.isNotEmpty(finderUser.getData())) {
|
|
|
|
|
// operDefectStatisticsExportVO.setFinderName(finderUser.getData().getName());
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(entity.getPlanHandler())) { |
|
|
|
|
User user = UserCache.getUser(Long.valueOf(entity.getPlanHandler())); |
|
|
|
|
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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (ObjectUtils.isNotEmpty(entity.getFindTime())) { |
|
|
|
|
operDefectStatisticsExportVO.setFindTime(entity.getFindTime()); |
|
|
|
|
} |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
).collect(Collectors.toList()); |
|
|
|
|
return defectLevel; |
|
|
|
|
} else { |
|
|
|
|
return new ArrayList<>(); |
|
|
|
|
} |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|