| | |
| | | package com.qianwen.smartman.modules.tpm.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | import com.qianwen.smartman.common.constant.NotifyConstant; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.support.Condition; |
| | | import com.qianwen.core.mp.support.Query; |
| | | import com.qianwen.core.secure.utils.AuthUtil; |
| | | import com.qianwen.core.tool.utils.CollectionUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.constant.NotifyConstant; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.modules.cps.service.IMachineService; |
| | | import com.qianwen.smartman.modules.cps.service.IWorkstationService; |
| | | import com.qianwen.smartman.modules.cps.vo.WorkstationVO; |
| | |
| | | import com.qianwen.smartman.modules.tpm.vo.RepairApplyVO; |
| | | import com.qianwen.smartman.modules.tpm.vo.RepairFileVO; |
| | | import com.qianwen.smartman.modules.tpm.vo.excel.RepairApplyExcelVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/tpm/service/impl/RepairApplyServiceImpl.class */ |
| | | public class RepairApplyServiceImpl extends ServiceImpl<RepairApplyMapper, RepairApply> implements IRepairApplyService { |
| | | private static final Logger log = LoggerFactory.getLogger(RepairApplyServiceImpl.class); |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private IWorkstationService workstationService; |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public RepairApply createRepairApply(RepairApplyAddVO repairApplyAddVO) { |
| | | RepairApply repairApply = RepairApplyConvert.INSTANCE.convert(repairApplyAddVO); |
| | |
| | | return repairApply != null; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public RepairApplyDetailVO detailApply(Long id) { |
| | | |
| | | RepairApply repairApply = this.baseMapper.selectOne(Wrappers.<RepairApply>query().lambda().eq(RepairApply::getId, id)); |
| | |
| | | return vo; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public IPage<RepairApplyVO> getPageApply(RepairApplyLookVO repairApplyLookVO, Query query) { |
| | | IPage<RepairApply> pages = page(Condition.getPage(query), Wrappers.<RepairApply>lambdaQuery() |
| | | .eq(Func.isNotEmpty(AuthUtil.getTenantId()), RepairApply::getTenantId, AuthUtil.getTenantId()) |
| | |
| | | return RepairApplyConvert.INSTANCE.convert(pages); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public List<RepairApplyVO> queryApply(RepairApplyLookVO repairApplyLookVO) { |
| | | List<RepairApply> pages = list(Wrappers.<RepairApply>lambdaQuery() |
| | | .eq(Func.isNotEmpty(AuthUtil.getTenantId()), RepairApply::getTenantId, AuthUtil.getTenantId()) |
| | |
| | | return RepairApplyConvert.INSTANCE.convert(pages); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean deleteRepairApply(List<Long> ids) { |
| | | if (Func.isEmpty(ids) || ids.size() < 1) { |
| | |
| | | return Func.isEmpty(list); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public boolean checkRepairApplyStatus(Long id) { |
| | | RepairApply repairApply = this.baseMapper.selectOne(Wrappers.<RepairApply>query().lambda().eq(RepairApply::getId, id).eq(RepairApply::getApplyStatus, Integer.valueOf(RepairApplyStatusEnum.Y1.getType()))); |
| | | /* |
| | |
| | | return Func.isNotEmpty(repairApply); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean implementApply(Long id) { |
| | | if (!checkRepairApplyStatus(id)) { |
| | |
| | | return updateById(repairApply); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public RepairApply updateRepairApply(RepairApplyUpdateVO repairApplyUpdateVO) { |
| | | RepairApply re = (RepairApply) getById(repairApplyUpdateVO.getId()); |
| | |
| | | return re; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public RepairFileVO getFileAndDes(Long id) { |
| | | RepairApply repairApply = (RepairApply) getById(id); |
| | | if (Func.isNull(repairApply)) { |
| | |
| | | return repairFileVo; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public List<ApplyCodeVO> queryApplyCode() { |
| | | List<RepairApply> list = list(Wrappers.<RepairApply>query().lambda().eq(RepairApply::getApplyStatus, Integer.valueOf(RepairApplyStatusEnum.Y2.getType()))); |
| | | /* |
| | |
| | | return applyCodeVo; |
| | | }).collect(Collectors.toList()); |
| | | } |
| | | return new ArrayList(); |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public List<RepairApply> getRepairApplyByMalId(Long malId) { |
| | | List<RepairApply> repairApplyList = list(Wrappers.<RepairApply>query().lambda() |
| | | .eq(RepairApply::getMalfunctionId, malId) |
| | |
| | | return repairApplyList; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public boolean updateApplyMalFunction(Long malId, String malName, String malCode, Integer action) { |
| | | List<RepairApply> repairApplyByMalList = getRepairApplyByMalId(malId); |
| | | if (Func.isNotEmpty(repairApplyByMalList)) { |
| | |
| | | return false; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public boolean updateApplyByRecord(Long applyId, Long malId, String malName, String malCode) { |
| | | RepairApply repairApply = (RepairApply) getById(applyId); |
| | | if (Func.isNull(repairApply)) { |
| | |
| | | return updateById(repairApply); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public List<RepairApplyExcelVO> exportRepairApply(RepairApplyExportVO repairApplyExportVO) { |
| | | List<RepairApplyExcelVO> repairApplyExcelVoList = this.baseMapper.exportApplyVo(repairApplyExportVO, AuthUtil.getTenantId()); |
| | | if (Func.isNotEmpty(repairApplyExcelVoList)) { |
| | |
| | | }); |
| | | return repairApplyExcelVoList; |
| | | } |
| | | return new ArrayList(); |
| | | return new ArrayList<>(); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public IPage<RepairApplyVO> applyWaringPage(RepairApplySearchVO repairApplySearchVO, Query query) { |
| | | IPage<RepairApplyVO> page = Condition.getPage(query); |
| | | List<RepairApplyVO> vos = this.baseMapper.pageRepairApplyToday(query, page, repairApplySearchVO); |
| | | return page.setRecords(vos); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public Long countApplyNum() { |
| | | Long count = Long.valueOf(count(Wrappers.<RepairApply>lambdaQuery() |
| | | .eq(RepairApply::getApplyStatus, Integer.valueOf(RepairApplyStatusEnum.Y2.getType())) |
| | |
| | | return (Long) Optional.of(count).orElse(0L); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public RepairApplyDetailVO detail(Long id) { |
| | | RepairApplyDetailVO repairApplyDetailVO = detailApply(id); |
| | | RepairRecord bean = this.repairRecordService.getOne(Wrappers.<RepairRecord>query().lambda().eq(RepairRecord::getRepairApplyId, id)); |
| | |
| | | businessSend.saveState(repairApply, notifyBusinessSend); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.tpm.service.IRepairApplyService |
| | | @Override |
| | | public IPage<RepairApplyVO> getPageApplyForHmi(Long workstationId, Query query) { |
| | | WorkstationVO workstationVO = this.workstationService.getDetail(workstationId); |
| | | return this.baseMapper.getPageApplyForHmi(workstationVO.getMachineId(), Condition.getPage(query)); |