| | |
| | | package com.ruoyi.service.impl;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
| | | import com.ruoyi.common.core.domain.AjaxResult;
|
| | | import com.ruoyi.common.core.domain.entity.EsModel;
|
| | | import com.ruoyi.common.utils.MapUtils;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.domain.*;
|
| | | import com.ruoyi.mapper.MeetingStatisticMapper;
|
| | |
| | | import javax.annotation.Resource;
|
| | | import java.io.IOException;
|
| | | import java.time.LocalDateTime;
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | | import java.util.*;
|
| | |
|
| | |
|
| | | @Slf4j
|
| | |
| | | lqw.eq(!StringUtils.isEmpty(meetingStatistic.getConferenceRoom()), MeetingStatistic::getConferenceRoom, meetingStatistic.getConferenceRoom());
|
| | | lqw.eq(!StringUtils.isEmpty(meetingStatistic.getTitle()), MeetingStatistic::getTitle, meetingStatistic.getTitle());
|
| | | // lqw.eq(meetingStatistic.getFamilyId()!=null,MeetingStatistic::getFamilyId,meeting.getFamilyId());
|
| | | lqw.eq(!StringUtils.isEmpty(meetingStatistic.getApplyPerson()), MeetingStatistic::getApplyPerson, meetingStatistic.getApplyPerson());
|
| | | lqw.eq(!StringUtils.isEmpty(String.valueOf(meetingStatistic.getApplyPerson())), MeetingStatistic::getApplyPerson, meetingStatistic.getApplyPerson());
|
| | | lqw.eq(!StringUtils.isEmpty(String.valueOf(meetingStatistic.getRatifyPerson())), MeetingStatistic::getRatifyPerson, meetingStatistic.getRatifyPerson());
|
| | | lqw.eq(!StringUtils.isEmpty(String.valueOf(meetingStatistic.getStatus())), MeetingStatistic::getStatus, meetingStatistic.getStatus());
|
| | | lqw.eq(!StringUtils.isEmpty(String.valueOf(meetingStatistic.getFamilyId())), MeetingStatistic::getFamilyId, meetingStatistic.getFamilyId());
|
| | | return lqw;
|
| | | }
|
| | | public static String getDatePoor(Date endDate, Date nowDate, MeetingStatistic meetingStatistic) {
|
| | |
|
| | | long nd = 1000 * 24 * 60 * 60;
|
| | | long nh = 1000 * 60 * 60;
|
| | | long nm = 1000 * 60;
|
| | | long ns = 1000;
|
| | | // 获得两个时间的毫秒时间差异
|
| | | long diff = endDate.getTime() - nowDate.getTime();
|
| | | // 计算差多少天
|
| | | // long day = diff / nd;
|
| | | // 计算差多少小时
|
| | | long hour = diff % nd / nh;
|
| | | // 计算差多少分钟
|
| | | long min = diff % nd % nh / nm;
|
| | | // 计算差多少秒//输出结果
|
| | | long sec = diff % nd % nh % nm / ns;
|
| | | System.out.println(hour + "小时" + min + "分钟"+ sec + "秒");
|
| | | meetingStatistic.setUseTime(hour + "小时" + min + "分钟" + sec + "秒");
|
| | | return meetingStatistic.getUseTime();
|
| | | }
|
| | | private LambdaQueryWrapper<MeetingStatistic> buildCondition(MeetingStatistic meetingStatistic) {
|
| | | LambdaQueryWrapper<MeetingStatistic> lqw = new LambdaQueryWrapper<>();
|
| | | lqw.select(MeetingStatistic::getFamilyId,MeetingStatistic::getCreateTime);
|
| | | return lqw;
|
| | | }
|
| | | @Override
|
| | | public AjaxResult selectDataList(MeetingStatistic meetingStatistic, Integer pageNum, Integer pageSize) {
|
| | | //要查自己家庭的
|
| | | ZInfoUser myself = zInfoUserService.getMyself();
|
| | | if(myself==null)
|
| | | {
|
| | | // System.out.println("ssssss");
|
| | | return AjaxResult.success("您没加入到对应的家庭,请联系管理员");
|
| | | }
|
| | | Long familyId = myself.getFamilyId();
|
| | | // //也要查别人授权的
|
| | | // List<ZAuthority> authority = zAuthorityService.getAuthority();
|
| | | // List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(DOCTOR_LIST)).map(ZAuthority::getFid).collect(Collectors.toList());
|
| | | // //加上自己家庭的id
|
| | | // idList.add(familyId);
|
| | | // String familyIds = listFamilyIds();
|
| | | // String secondFamilyAuthority = listSecondFamilyIds();
|
| | | LambdaQueryWrapper<MeetingStatistic> lqw = new LambdaQueryWrapper<>();
|
| | | // LambdaQueryWrapper<MeetingStatistic> lqw = buildCondition(meetingStatistic);
|
| | |
|
| | |
|
| | | Page<MeetingStatistic> meetingStatisticPage = new Page<>(pageNum, pageSize);
|
| | | Page<MeetingStatistic> pageResult = page(meetingStatisticPage, lqw);
|
| | |
|
| | | List<MeetingStatistic> beanRecords = pageResult.getRecords();//得到查询出来的数据
|
| | | HashMap<String, Object> data = MapUtils.getResult(pageResult, beanRecords);
|
| | | return AjaxResult.success(data);
|
| | | }
|
| | | @Override
|
| | | public AjaxResult DataList(MeetingStatistic meetingStatistic) {
|
| | | LambdaQueryWrapper<MeetingStatistic> lambdaQueryWrapper = buildCondition(meetingStatistic);
|
| | | List<MeetingStatistic> beanRecords = list(lambdaQueryWrapper);
|
| | | log.info("从数据库中查到的为:{}", beanRecords);
|
| | | return AjaxResult.success(beanRecords);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public AjaxResult updateData(MeetingStatistic meetingStatistic) {
|
| | |
| | | // System.out.println(meeting);
|
| | | // System.out.println("=============="+meetingStatistic.getConnPhone());
|
| | |
|
| | | // if(meetingStatistic.getUseTime()!=null){
|
| | | // newModel.setBy2(meetingStatistic.getUseTime());
|
| | | // }else {
|
| | | // newModel.setBy2(dataById.getUseTime());
|
| | | // if (meetingStatistic.getUseTime()==null){
|
| | | // if(meetingStatistic.getHappenEndTime()!=null && meetingStatistic.getHappenStartTime() !=null){
|
| | | // getDatePoor(meetingStatistic.getHappenEndTime(),meetingStatistic.getHappenStartTime(),meetingStatistic);
|
| | | // System.out.println("===============使用时间====================="+meetingStatistic.getUseTime());
|
| | | // newModel.setBy2(meetingStatistic.getUseTime());
|
| | | // }else {
|
| | | // newModel.setBy2(dataById.getUseTime());
|
| | | // }
|
| | | // }
|
| | | if (meetingStatistic.getUseTime()==null){
|
| | | if(meetingStatistic.getHappenEndTime()!=null && meetingStatistic.getHappenStartTime() !=null){
|
| | | getDatePoor(meetingStatistic.getHappenEndTime(),meetingStatistic.getHappenStartTime(),meetingStatistic);
|
| | | System.out.println("===============使用时间1====================="+meetingStatistic.getUseTime());
|
| | | newModel.setBy1(meetingStatistic.getUseTime());
|
| | | }
|
| | | else {
|
| | | newModel.setBy1(dataById.getUseTime());
|
| | | }
|
| | | }else {
|
| | | newModel.setBy1(dataById.getUseTime());
|
| | | }
|
| | | // if(meetingStatistic.getConferenceRoom()!=null){
|
| | | // newModel.setBy3(meetingStatistic.getConferenceRoom());
|
| | | // }else {
|
| | | // newModel.setBy3(dataById.getConferenceRoom());
|
| | | // }
|
| | | if(meetingStatistic.getTitle()!=null){
|
| | | newModel.setBy4(meetingStatistic.getTitle());
|
| | | // System.out.println("===============使用时间2====================="+dataById);
|
| | | // System.out.println("===============使用时间2====================="+meetingStatistic);
|
| | | newModel.setBy2(meetingStatistic.getTitle());
|
| | | }else {
|
| | | newModel.setBy4(dataById.getTitle());
|
| | | // System.out.println("===============使用时间2====================="+dataById);
|
| | | // System.out.println("===============使用时间2====================="+meetingStatistic);
|
| | | newModel.setBy2(dataById.getTitle());
|
| | | }
|
| | | if(meetingStatistic.getApplyPerson()!=null){
|
| | | newModel.setBy5(meetingStatistic.getApplyPerson());
|
| | | }else {
|
| | | newModel.setBy5(dataById.getApplyPerson());
|
| | | }
|
| | | // if(meetingStatistic.getApplyPerson()!=null){
|
| | | // newModel.setBy5(meetingStatistic.getApplyPerson());
|
| | | // }else {
|
| | | // newModel.setBy5(dataById.getApplyPerson());
|
| | | // }
|
| | | // if(meetingStatistic.getRatifyPerson() == 0){
|
| | | // newModel.setBy10(meetingStatistic.getRatifyPerson());
|
| | | // }else {
|
| | |
| | | // }else {
|
| | | // newModel.setBy11(dataById.getStatus());
|
| | | // }
|
| | | System.out.println("===============使用时间2====================="+dataById);
|
| | | System.out.println("===============使用时间2====================="+meetingStatistic);
|
| | | UpdateRequest updateRequest = new UpdateRequest("allsearchdata", esResult.getId());
|
| | | updateRequest.doc(
|
| | | "by1",newModel.getBy4(),
|
| | | "by2",newModel.getBy5()
|
| | | "by1",newModel.getBy1(),
|
| | | "by2",newModel.getBy2()
|
| | |
|
| | | );
|
| | |
|
| | | try {
|
| | |
| | | return AjaxResult.error();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public AjaxResult countData(Long[] familyId ,String applyPerson) {
|
| | | return null;
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | esModel.setId(uuid);
|
| | | esModel.setCtId(inte);
|
| | | esModel.setCtTableName("会议统计");
|
| | | esModel.setBy1(meetingStatistic.getTitle());
|
| | | esModel.setBy5(meetingStatistic.getApplyPerson());
|
| | | getDatePoor(meetingStatistic.getHappenEndTime(),meetingStatistic.getHappenStartTime(),meetingStatistic);
|
| | | System.out.println("===============使用时间2====================="+meetingStatistic.getUseTime());
|
| | | esModel.setBy1(meetingStatistic.getUseTime());
|
| | | esModel.setBy2(meetingStatistic.getTitle());
|
| | | // esModel.setBy5(meetingStatistic.getApplyPerson());
|
| | | //这里存储查询详情的路径
|
| | | esModel.setBy5("/zMeetingStatistic");
|
| | | esModel.setFid(familyId);
|