rk
2026-06-09 c467370d8741bc05ca7c22d4253c58ac0a979ef5
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/InoutRecordServiceImpl.java
@@ -7,13 +7,16 @@
import com.doumee.core.utils.DateUtil;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.CategoryMapper;
import com.doumee.dao.business.InoutDayCountMapper;
import com.doumee.dao.business.InoutRecordMapper;
import com.doumee.dao.business.dto.InParkDataDTO;
import com.doumee.dao.business.model.Category;
import com.doumee.dao.business.model.InoutDayCount;
import com.doumee.dao.business.model.InoutRecord;
import com.doumee.dao.business.model.Member;
import com.doumee.dao.business.vo.GeneralDataVO;
import com.doumee.dao.business.vo.InParkUserDataVO;
import com.doumee.dao.business.vo.TelecomInParkDataVO;
import com.doumee.service.business.InoutRecordService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -55,6 +58,9 @@
    @Autowired
    private CategoryMapper categoryMapper;
    @Autowired
    private InoutDayCountMapper inoutDayCountMapper;
    @Override
    public Integer create(InoutRecord inoutRecord) {
@@ -155,7 +161,7 @@
    //人员分类  单独处理人员数据  0劳务访客 1普通访客 2内部员工 3车辆信息 4相关方人员 5货运司机
    private static String[] userTypeList = new String[]{"","普通访客","内部人员","","相关方人员","货运司机"};
    private static String[] userTypeList = new String[]{"","普通访客","内部人员","","相关方人员"};
    /**
@@ -172,8 +178,11 @@
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        //查询本周的开始日期和结束日期
        Long weekStart = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).atStartOfDay(ZoneOffset.UTC).toInstant().toEpochMilli();
        //查询本周的开始日期
        LocalDate today = LocalDate.now();
        // 计算周一和周五的日期
        LocalDate monday = today.with(DayOfWeek.MONDAY);
        Long weekStart = DateUtil.fromStringToDate("yyyy-MM-dd HH:mm:ss",monday.toString() + " 00:00:00").getTime();//LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).atStartOfDay(ZoneOffset.UTC).toInstant().toEpochMilli();
        InParkUserDataVO inParkUserDataVO = new InParkUserDataVO();
        List<InoutRecord> yearList = inoutRecordMapper.selectJoinList(InoutRecord.class,new MPJLambdaWrapper<InoutRecord>()
                .selectAll(InoutRecord.class)
@@ -310,7 +319,7 @@
                for (String categoryName:setList) {
                    GeneralDataVO generalDataVO = new GeneralDataVO();
                    generalDataVO.setName(categoryName);
                    generalDataVO.setTotal(yearList.stream().filter(j->StringUtils.isNotBlank(j.getCategoryParentName())&&j.getCategoryName().equals(categoryName)).collect(Collectors.toList()).size());
                    generalDataVO.setTotal(yearList.stream().filter(j->StringUtils.isNotBlank(j.getCategoryParentName())&&j.getCategoryParentName().equals(categoryName)).collect(Collectors.toList()).size());
                    generalDataVO.setRata(new BigDecimal(generalDataVO.getTotal().toString()).divide(new BigDecimal(yearList.size()+""),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100")));
                    rataList.add(generalDataVO);
                }
@@ -352,7 +361,6 @@
            }else if(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),7)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ZERO)){
                mpjLambdaWrapper.select("car_code,category_name,DATE_FORMAT(CREATE_DATE, '%Y-%m-%d') as createDateStr ");
            }else if(Constants.equalsInteger(inParkDataDTO.getDateStr().length(),4)&&Constants.equalsInteger(inParkDataDTO.getType(),Constants.ONE)){
                mpjLambdaWrapper.select("member_phone,MEMBER_TYPE,DATE_FORMAT(CREATE_DATE, '%Y-%m') as createDateStr");
            }else{
                mpjLambdaWrapper.select("member_phone,MEMBER_TYPE,DATE_FORMAT(CREATE_DATE, '%Y-%m-%d') as createDateStr ");
@@ -395,7 +403,7 @@
                maxMonth =  DateUtil.getNowMonthNum();
            }
            for (int i = maxMonth; i >0 ; i--) {
                dateList.add(DateUtil.getNowYearNum()+"-"+ StringUtils.leftPad(i+"",2,"0"));
                dateList.add(inParkDataDTO.getDateStr()+"-"+ StringUtils.leftPad(i+"",2,"0"));
            }
        }else {
            //日期
@@ -545,4 +553,52 @@
            throw new BusinessException(ResponseStatus.EXPORT_EXCEL_ERROR, e);
        }
    }
    @Override
    public TelecomInParkDataVO getInParkDataForTelecom(){
        TelecomInParkDataVO telecomInParkDataVO = new TelecomInParkDataVO();
        telecomInParkDataVO.setInCarNum(Constants.ZERO);
        telecomInParkDataVO.setInUserNum(Constants.ZERO);
        InoutDayCount inoutDayCount = inoutDayCountMapper.selectOne(new QueryWrapper<InoutDayCount>()
                .lambda()
                .apply(" DATE(TIME_INFO) = CURDATE()  ")
                .last(" limit 1 ")
        );
        if(Objects.nonNull(inoutDayCount)){
            telecomInParkDataVO.setInUserNum(inoutDayCount.getInMemberNum());
            telecomInParkDataVO.setInCarNum(inoutDayCount.getInCarNum());
        }
       /* List<InoutRecord> listCar = inoutRecordMapper.selectList(new MPJLambdaWrapper<InoutRecord>()
                        .eq(InoutRecord::getIsdeleted,Constants.ZERO)
                        .eq(InoutRecord::getInOrOut,Constants.ZERO)
                        .isNotNull(InoutRecord::getCarCode)
                        .apply(" ( DATE_FORMAT(CREATE_DATE, '%Y%m%d')  = DATE_FORMAT(now(), '%Y%m%d') ) "));
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(listCar)){
            telecomInParkDataVO.setInCarNum(
                    new HashSet<>(listCar.stream().map(i->i.getCarCode()).collect(Collectors.toList())).size()
            );
        }
        List<InoutRecord> listUser = inoutRecordMapper.selectList(new MPJLambdaWrapper<InoutRecord>()
                        .eq(InoutRecord::getIsdeleted,Constants.ZERO)
                        .eq(InoutRecord::getInOrOut,Constants.ZERO)
                        .isNotNull(InoutRecord::getMemberPhone)
                        .apply(" ( DATE_FORMAT(CREATE_DATE, '%Y%m%d') = DATE_FORMAT(now(), '%Y%m%d') ) "));
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(listUser)){
            telecomInParkDataVO.setInUserNum(
                    new HashSet<>(listUser.stream().map(i->i.getMemberPhone()).collect(Collectors.toList())).size()
            );
        }*/
        return telecomInParkDataVO;
    }
}