| | |
| | | private HzWarningMapper warningMapper; |
| | | |
| | | @Override |
| | | public List<HzEntryRecordVO> entryStatic() { |
| | | public List<HzEntryRecordVO> entryStatic(Long companyId) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | Date currentDate=new Date(); |
| | | DateTime endTime = DateUtil.endOfDay(currentDate); |
| | |
| | | dayEntryRecordList.add(entryRecordVO); |
| | | startTime=DateUtil.offsetDay(startTime,1); |
| | | } |
| | | List<HzEntryRecordVO> entryRecordVOList= entryRecordMapper.entryCountStatic(startDate, endDate,currentUser.getCompanyId()); |
| | | //todo |
| | | List<HzEntryRecordVO> entryRecordVOList= entryRecordMapper.entryCountStatic(startDate, endDate,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode()) ? companyId:currentUser.getCompanyId()); |
| | | if(!entryRecordVOList.isEmpty()) { |
| | | Map<String, HzEntryRecordVO> resMap = entryRecordVOList.stream().collect(Collectors.toMap(item -> item.getMonth()+"_"+item.getDay(), item -> item)); |
| | | for (HzEntryRecordVO er : dayEntryRecordList) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<HzEntryRecordVO> useEverydayStatic() { |
| | | public List<HzEntryRecordVO> useEverydayStatic(Long companyId) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(currentUser); |
| | | Date currentDate=new Date(); |
| | |
| | | dayEntryRecordList.add(entryRecordVO); |
| | | startTime=DateUtil.offsetDay(startTime,1); |
| | | } |
| | | //设置分表id |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | List<HzEntryRecordVO> entryRecordVOList= hazmatMapper.useCountEverydayStatic(startDate, endDate,currentUser.getCompanyId()); |
| | | if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){ |
| | | IdTableNameHandler.setCurrentId(companyId); |
| | | }else { |
| | | //设置分表id |
| | | //todo |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | } |
| | | List<HzEntryRecordVO> entryRecordVOList= hazmatMapper.useCountEverydayStatic(startDate, endDate,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode()) ? companyId:currentUser.getCompanyId()); |
| | | IdTableNameHandler.removeCurrentId(); |
| | | if(!entryRecordVOList.isEmpty()) { |
| | | Map<String, HzEntryRecordVO> resMap = entryRecordVOList.stream().collect(Collectors.toMap(item -> item.getDay(), item -> item)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<HzHazmatUseVO> maxUseStatic() { |
| | | public List<HzHazmatUseVO> maxUseStatic(Long companyId) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(currentUser); |
| | | |
| | |
| | | DateTime startTime = DateUtil.beginOfDay(DateUtil.offsetDay(currentDate, -6)); |
| | | String startDate= DateUtil.format(startTime, DatePattern.NORM_DATETIME_FORMAT); |
| | | String endDate=DateUtil.format(endTime,DatePattern.NORM_DATETIME_FORMAT); |
| | | //设置分表id |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | List<HzHazmatUseVO> hazmatUseVOList= hazmatMapper.maxUseCountStatic(startDate, endDate,currentUser.getCompanyId()); |
| | | if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){ |
| | | IdTableNameHandler.setCurrentId(companyId); |
| | | }else { |
| | | //设置分表id |
| | | //todo |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | } |
| | | List<HzHazmatUseVO> hazmatUseVOList= hazmatMapper.maxUseCountStatic(startDate, endDate,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode()) ? companyId:currentUser.getCompanyId()); |
| | | IdTableNameHandler.removeCurrentId(); |
| | | if(!hazmatUseVOList.isEmpty()) { |
| | | List<Long> basicIds = hazmatUseVOList.stream().map(HzHazmatUseVO::getBasicId).collect(Collectors.toList()); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public HzHomeDataVO homeDataStatistic() { |
| | | public HzHomeDataVO homeDataStatistic(Long companyid) { |
| | | SysUser currentUser=SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(currentUser); |
| | | Long companyId=currentUser.getCompanyId(); |
| | | Long companyId= null; |
| | | if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){ |
| | | companyId = companyid; |
| | | }else { |
| | | companyId = currentUser.getCompanyId(); |
| | | } |
| | | Integer warehouseCount= Math.toIntExact(warehouseMapper.selectCount(Wrappers.<HzWarehouse>lambdaQuery() |
| | | .eq(true, HzWarehouse::getDelFlag, 0) |
| | | .eq(companyId!=null,HzWarehouse::getCompanyId,companyId))); |
| | |
| | | stateList.add(HazmatStatusEnum.USED.getCode()); |
| | | stateList.add(HazmatStatusEnum.DISCARD.getCode()); |
| | | //设置分表id |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | //todo |
| | | IdTableNameHandler.setCurrentId(companyId); |
| | | Integer hazmatCount= Math.toIntExact(hazmatMapper.selectCount(Wrappers.<HzHazmat>lambdaQuery() |
| | | .notIn(true, HzHazmat::getState, stateList) |
| | | .eq(companyId!=null,HzHazmat::getCompanyId,companyId))); |
| | |
| | | |
| | | |
| | | @Override |
| | | public CommonPage useStatic(String startTime, String endTime) { |
| | | public CommonPage useStatic(String startTime, String endTime,Long companyId) { |
| | | SysUser currentUser= SecurityUtils.getLoginUser().getUser(); |
| | | checkUserAllowed(currentUser); |
| | | |
| | |
| | | throw new ApiException("只能查询90天以内数据"); |
| | | } |
| | | } |
| | | //设置分表id |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | if (currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())){ |
| | | IdTableNameHandler.setCurrentId(companyId); |
| | | |
| | | }else { |
| | | //设置分表id |
| | | //todo |
| | | IdTableNameHandler.setCurrentId(currentUser.getCompanyId()); |
| | | } |
| | | PageUtils.startPage(); |
| | | List<HzHazmatUseVO> hazmatUseVOList= hazmatMapper.useCountStatic(startDate, endDate,currentUser.getCompanyId()); |
| | | List<HzHazmatUseVO> hazmatUseVOList= hazmatMapper.useCountStatic(startDate, endDate,currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode()) ? companyId:currentUser.getCompanyId()); |
| | | IdTableNameHandler.removeCurrentId(); |
| | | if(!hazmatUseVOList.isEmpty()) { |
| | | List<Long> basicIds = hazmatUseVOList.stream().map(HzHazmatUseVO::getBasicId).collect(Collectors.toList()); |