| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | |
| | | ViewInOutBean bean = new ViewInOutBean(); |
| | | bean.setPageSize(limit); |
| | | bean.setPageNumber(curr); |
| | | List<ViewInOutBean> list = reportQueryMapper.queryViewInOutList(bean); |
| | | int count = reportQueryMapper.getViewInOutCount(bean); |
| | | if (!Cools.isEmpty(param.get("modi_time"))) { |
| | | String[] dates = param.get("modi_time").toString().split(RANGE_TIME_LINK); |
| | | bean.setBegin_date(dates[0]); |
| | | bean.setEnd_date(dates[1]); |
| | | } |
| | | int count = 0; |
| | | List<ViewInOutBean> list = new ArrayList<>(); |
| | | if (param.get("type") == null || param.get("type").equals(1)) { |
| | | list = reportQueryMapper.queryViewInOutListDay(bean); |
| | | count = reportQueryMapper.getViewInOutCountDay(bean); |
| | | }else if ( param.get("type").equals("2")) { |
| | | list = reportQueryMapper.queryViewInOutListMonth(bean); |
| | | count = reportQueryMapper.getViewInOutCountMonth(bean); |
| | | } else if (param.get("type").equals("3")) { |
| | | list = reportQueryMapper.queryViewInOutListYear(bean); |
| | | count = reportQueryMapper.getViewInOutCountYear(bean); |
| | | }else { |
| | | list = reportQueryMapper.queryViewInOutList(bean); |
| | | count = reportQueryMapper.getViewInOutCount(bean); |
| | | } |
| | | // List<ViewInOutBean> list = reportQueryMapper.queryViewInOutList(bean); |
| | | Page<ViewInOutBean> page = new Page<>(); |
| | | page.setRecords(list); |
| | | page.setTotal(count); |
| | |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |