|  |  |  | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.core.utils.Utils; | 
|---|
|  |  |  | import com.doumee.dao.business.PlatformWarnEventMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.join.PlatformWarnEventJoinMapper; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Platform; | 
|---|
|  |  |  | import com.doumee.dao.business.model.PlatformWarnEvent; | 
|---|
|  |  |  | import com.doumee.dao.openapi.response.PlatformWarnEventListResponse; | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.SavePlatformWarnEventDTO; | 
|---|
|  |  |  | import com.doumee.service.business.PlatformWarnEventService; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.github.yulichang.wrapper.MPJLambdaWrapper; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.CollectionUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformWarnEventMapper platformWarnEventMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformWarnEventJoinMapper platformWarnEventJoinMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer create(PlatformWarnEvent platformWarnEvent) { | 
|---|
|  |  |  | 
|---|
|  |  |  | public List<PlatformWarnEvent> findList(PlatformWarnEvent platformWarnEvent) { | 
|---|
|  |  |  | QueryWrapper<PlatformWarnEvent> wrapper = new QueryWrapper<>(platformWarnEvent); | 
|---|
|  |  |  | return platformWarnEventMapper.selectList(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public List<PlatformWarnEventListResponse> findListToHk() { | 
|---|
|  |  |  | List<PlatformWarnEvent>  platformWarnEvents = platformWarnEventJoinMapper.selectJoinList(PlatformWarnEvent.class, | 
|---|
|  |  |  | new MPJLambdaWrapper<PlatformWarnEvent>() | 
|---|
|  |  |  | .selectAll(PlatformWarnEvent.class) | 
|---|
|  |  |  | .selectAs(Platform::getName,PlatformWarnEvent::getPlatformName) | 
|---|
|  |  |  | .selectAs(Platform::getHkId,PlatformWarnEvent::getPlatfromHkId) | 
|---|
|  |  |  | .leftJoin(Platform.class,Platform::getId,PlatformWarnEvent::getPlatformId) | 
|---|
|  |  |  | .last(" limit 20 ") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | List<PlatformWarnEventListResponse> list = new ArrayList<PlatformWarnEventListResponse>(); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(platformWarnEvents)){ | 
|---|
|  |  |  | for (PlatformWarnEvent event:platformWarnEvents) { | 
|---|
|  |  |  | PlatformWarnEventListResponse platformWarnEventListResponse = new PlatformWarnEventListResponse(); | 
|---|
|  |  |  | platformWarnEventListResponse.setPlatformName(event.getPlatformName()); | 
|---|
|  |  |  | platformWarnEventListResponse.setCreateDate(event.getCreateDate()); | 
|---|
|  |  |  | platformWarnEventListResponse.setContent(event.getEventContent()); | 
|---|
|  |  |  | platformWarnEventListResponse.setTitle(event.getTitle()); | 
|---|
|  |  |  | platformWarnEventListResponse.setPlatfromHkId(event.getPlatfromHkId()); | 
|---|
|  |  |  | platformWarnEventListResponse.setCarCode(event.getCarCode()); | 
|---|
|  |  |  | list.add(platformWarnEventListResponse); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | platformWarnEvent.setCreateDate(new Date()); | 
|---|
|  |  |  | platformWarnEvent.setIsdeleted(Constants.ZERO); | 
|---|
|  |  |  | platformWarnEvent.setPlatformId(savePlatformWarnEventDTO.getPlatformId()); | 
|---|
|  |  |  | platformWarnEvent.setCarCode(savePlatformWarnEventDTO.getCarCode()); | 
|---|
|  |  |  | Constants.PlatformWarnEvent cPl = Constants.PlatformWarnEvent.STOP_TIMEOUT; | 
|---|
|  |  |  | if(Constants.equalsInteger(savePlatformWarnEventDTO.getEventType(),Constants.ZERO)){ | 
|---|
|  |  |  | if(Objects.isNull(savePlatformWarnEventDTO.getPlatformJobId())){ | 
|---|