| | |
| | | import com.sandu.ximon.admin.utils.JsonUtil; |
| | | import com.sandu.ximon.admin.utils.LightemitUtils; |
| | | import com.sandu.ximon.admin.utils.LogUtils; |
| | | import com.sandu.ximon.dao.domain.LedSFile; |
| | | import com.sandu.ximon.dao.domain.PoleLightemitEntity; |
| | | import com.sandu.ximon.dao.domain.PoleXixunPlayerEntity; |
| | | import com.sandu.ximon.dao.mapper.PoleXixunPlayerEntityMapper; |
| | |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 熙讯节目 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class XiXunPlayerService extends BaseServiceImpl<PoleXixunPlayerEntityMapper, PoleXixunPlayerEntity> { |
| | |
| | | private final LightemitUtils lightemitUtils; |
| | | private final RealtimeServerBean realtimeServerBean; |
| | | private final PoleLightemitService poleLightemitService; |
| | | private final ClientService clientService; |
| | | private final LedSFileService xiXunFileService; |
| | | |
| | | |
| | | public boolean insert(ProgramPro programPro) { |
| | | // SimpleDateFormat sdf=new SimpleDateFormat("yy-MM-dd HH:mm:ss"); |
| | | // Date date = new Date(); |
| | | // Program program = new Program(); |
| | | // try { |
| | | // program = JsonUtil.convertJsonStringToObject(json,Program.class); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | String json = JsonUtil.jsonObj2Sting(programPro); |
| | | PoleXixunPlayerEntity poleXixunPlayer = new PoleXixunPlayerEntity(); |
| | | poleXixunPlayer.setProgramCode(programPro.get_id()); |
| | |
| | | poleXixunPlayer.setHeight(programPro.getHeight()); |
| | | poleXixunPlayer.setWidth(programPro.getWidth()); |
| | | poleXixunPlayer.setTotalSize((float) programPro.getTotalSize() / 1000000 + "MB"); |
| | | // poleXixunPlayer.setTotalSize( Long.parseLong(programPro.getTotalSize()) / 1000000 + "MB"); |
| | | // programPro.setProgramId(poleXixunPlayer.getProgramId()); |
| | | // System.out.println(poleXixunPlayer.getProgramId()); |
| | | poleXixunPlayer.setRequestBody(json); |
| | | poleXixunPlayer.setScreenShot(programPro.getScreenShot()); |
| | | // poleXixunPlayer.setCreatTime(sdf.format(date)); |
| | | poleXixunPlayer.setCreateUserId(SecurityUtils.getClientId()); |
| | | poleXixunPlayer.setCreateUserId(SecurityUtils.getUserId()); |
| | | if(!clientService.findClientId()){ |
| | | poleXixunPlayer.setClientId(clientService.getClientId()); |
| | | } |
| | | |
| | | |
| | | return this.save(poleXixunPlayer); |
| | | } |
| | |
| | | |
| | | public Object getByPid(Long pid) { |
| | | PoleXixunPlayerEntity byId = getById(pid); |
| | | List<Long> fileIds=new ArrayList<>(); |
| | | List<LedSFile> file=new ArrayList<>(); |
| | | if (byId == null) { |
| | | throw new BusinessException("未找到该节目"); |
| | | } |
| | |
| | | try { |
| | | programPro = JsonUtil.convertJsonStringToObject(json, ProgramPro.class); |
| | | programPro.setProgramId(pid); |
| | | programPro.setScreenShot(byId.getScreenShot()); |
| | | programPro.getLayers().forEach( |
| | | layerPro -> { |
| | | layerPro.getSources().forEach( |
| | | sourcePro -> { |
| | | long fileId = Long.parseLong(sourcePro.getId()); |
| | | file.add(xiXunFileService.getById(fileId)); |
| | | } |
| | | ); |
| | | } |
| | | ); |
| | | programPro.setFileList(file); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return programPro; |
| | | } |
| | | |
| | | /** |
| | | * 推送节目 |
| | | * @param programId |
| | | * @param lightemitIds |
| | | */ |
| | | public void videoXixunPlayer(long programId, List<Long> lightemitIds) { |
| | | |
| | | ProgramPro pro = new ProgramPro(); |