| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.ruoyi.constant.MenuAuthority.DOCTOR_LIST; |
| | | @Slf4j |
| | | @Service |
| | | public class LiveStreamingServiceImpl extends ServiceImpl<LiveStreamingMapper, LiveStreaming> implements LiveStreamingService { |
| | | |
| | | @Resource |
| | | ZInfoUserService zInfoUserService; |
| | | |
| | | @Resource |
| | | ZAuthorityService zAuthorityService; |
| | | |
| | | @Resource |
| | | private EsService esSer; |
| | |
| | | private LambdaQueryWrapper<LiveStreaming> buildCondition(LiveStreaming liveStreaming) { |
| | | LambdaQueryWrapper<LiveStreaming> lqw = new LambdaQueryWrapper<>(); |
| | | // lqw.in(LiveStreaming::getFamilyId,familyIdList); |
| | | lqw.orderByDesc(LiveStreaming::getCreateTime); |
| | | lqw.orderByDesc(LiveStreaming::getId); |
| | | lqw.like(StringUtils.isNotEmpty(liveStreaming.getTitle()), LiveStreaming::getTitle, liveStreaming.getTitle()) |
| | | .like(StringUtils.isNotEmpty(liveStreaming.getApplyPerson()),LiveStreaming::getApplyPerson,liveStreaming.getApplyPerson()) |
| | | .like(StringUtils.isNotEmpty(liveStreaming.getContactPerson()),LiveStreaming::getContactPerson,liveStreaming.getContactPerson()); |
| | | .like(StringUtils.isNotEmpty(liveStreaming.getContactPerson()),LiveStreaming::getContactPerson,liveStreaming.getContactPerson()) |
| | | .like(StringUtils.isNotEmpty(liveStreaming.getRoomId()),LiveStreaming::getRoomId,liveStreaming.getRoomId()); |
| | | lqw.between(liveStreaming.getHappenStartTime() != null && liveStreaming.getHappenEndTime() != null,LiveStreaming::getCreateTime,liveStreaming.getHappenStartTime(),liveStreaming.getHappenEndTime()); |
| | | |
| | | return lqw; |
| | |
| | | lqw.eq(!StringUtils.isEmpty(liveStreaming.getContactPhone()), LiveStreaming::getContactPhone, liveStreaming.getContactPhone()); |
| | | lqw.eq(!StringUtils.isEmpty(liveStreaming.getApplyPerson()), LiveStreaming::getApplyPerson, liveStreaming.getApplyPerson()); |
| | | lqw.eq(!StringUtils.isEmpty(liveStreaming.getContactPerson()), LiveStreaming::getContactPerson, liveStreaming.getContactPerson()); |
| | | lqw.eq(!StringUtils.isEmpty(liveStreaming.getRoomId()), LiveStreaming::getRoomId, liveStreaming.getRoomId()); |
| | | return lqw; |
| | | } |
| | | |
| | |
| | | // List<LiveStreaming> dtoResult = markOwnData(familyId, beanRecords); |
| | | |
| | | HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords); |
| | | |
| | | |
| | | |
| | | return AjaxResult.success(data); |
| | | |
| | | } |
| | |
| | | return list; |
| | | } |
| | | |
| | | private Date getEndTime1(LiveStreaming liveStreaming) throws ParseException{ |
| | | System.out.println(liveStreaming.getStartTime()); |
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Calendar nowTime = Calendar.getInstance(); |
| | | nowTime.setTime(liveStreaming.getStartTime()); |
| | | nowTime.add(Calendar.MINUTE, liveStreaming.getDuration()); |
| | | String currentTime = df.format(nowTime.getTime()); |
| | | System.out.println("30分钟后的时间" + currentTime); |
| | | return df.parse(currentTime); |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult addData(LiveStreaming liveStreaming) { |
| | | public AjaxResult addData(LiveStreaming liveStreaming) throws ParseException { |
| | | LambdaQueryWrapper<LiveStreaming> lqw = uniqueCondition(liveStreaming); |
| | | List<LiveStreaming> list = list(lqw); |
| | | |
| | | if(list.size()>0){ |
| | | throw new RuntimeException("请勿新增重复数据"); |
| | | } |
| | | if (liveStreaming.getMaxPerson() > 120){ |
| | | throw new RuntimeException("可容纳人数暂时最多为120人"); |
| | | } |
| | | |
| | | liveStreaming.setEndTime(getEndTime1(liveStreaming)); |
| | | |
| | | if (save(liveStreaming)) { |
| | | EsModel esModel = new EsModel(); |
| | |
| | | esModel.setCtTableName("直播"); |
| | | esModel.setBy1(liveStreaming.getTitle()); |
| | | esModel.setBy2(liveStreaming.getApplyPerson()); |
| | | esModel.setBy3(liveStreaming.getRoomId()); |
| | | //取当前的时分-30 |
| | | |
| | | |
| | | |
| | | System.out.println(liveStreaming.getEndTime()); |
| | | // esModel.setBy4(liveStreaming.getEndTime()); |
| | | //这里存储查询详情的路径 |
| | | esModel.setBy5("/zLIveStreaming"); |
| | | esModel.setBy5("/zLiveStreaming"); |
| | | // esModel.setFid(familyId); |
| | | esSer.insertTable(esModel); |
| | | // System.out.println(esModel); |