|  |  | 
 |  |  | 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.queryViewInOutListDay(bean); | 
 |  |  |          count = reportQueryMapper.getViewInOutCountDay(bean); | 
 |  |  |       } | 
 |  |  | //      List<ViewInOutBean> list = reportQueryMapper.queryViewInOutList(bean); | 
 |  |  |       Page<ViewInOutBean> page = new Page<>(); | 
 |  |  |       page.setRecords(list); | 
 |  |  |       page.setTotal(count); | 
 |  |  | 
 |  |  |    public R viewWorkCountInList(@RequestParam(defaultValue = "1")Integer curr, | 
 |  |  |                          @RequestParam(defaultValue = "10")Integer limit, | 
 |  |  |                          @RequestParam Map<String, Object> param){ | 
 |  |  |       List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountIn(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize"))); | 
 |  |  |       Integer total = reportQueryMapper.selectWorkCountInTotal(); | 
 |  |  |       String startTime = "1970.1.2"; | 
 |  |  |       String endTime = "2099.1.2"; | 
 |  |  |       if (!Cools.isEmpty(param.get("query_date"))) { | 
 |  |  |          String  queryDate = (String) param.get("query_date"); | 
 |  |  |          String[] split = queryDate.split(" - "); | 
 |  |  |          startTime= split[0].split(" ")[0].replace("-","."); | 
 |  |  |          endTime = split[1].split(" ")[0].replace("-","."); | 
 |  |  |       } | 
 |  |  |       List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountIn(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime,endTime); | 
 |  |  |       Integer total = reportQueryMapper.selectWorkCountInTotal((String) param.get("matnr"), startTime,endTime); | 
 |  |  |       Page<ViewWorkCountInView> page = new Page<>(); | 
 |  |  |       page.setRecords(allCountIn); | 
 |  |  |       page.setTotal(total); | 
 |  |  |       return R.ok(page); | 
 |  |  |       Integer sum = reportQueryMapper.selectWorkCountInSum((String) param.get("matnr"), startTime,endTime); | 
 |  |  |       HashMap<String, Object> result = new HashMap<>(); | 
 |  |  |       result.put("page",page); | 
 |  |  |       result.put("sum",sum); | 
 |  |  |       return R.ok(result); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    /** | 
 |  |  | 
 |  |  |    public R viewWorkCountOutList(@RequestParam(defaultValue = "1")Integer curr, | 
 |  |  |                           @RequestParam(defaultValue = "10")Integer limit, | 
 |  |  |                           @RequestParam Map<String, Object> param){ | 
 |  |  |       List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountOut(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize"))); | 
 |  |  |       Integer total = reportQueryMapper.selectWorkCountOutTotal(); | 
 |  |  |       String startTime = "1970.1.2"; | 
 |  |  |       String endTime = "2099.1.2"; | 
 |  |  |       if (!Cools.isEmpty(param.get("query_date"))) { | 
 |  |  |          String  queryDate = (String) param.get("query_date"); | 
 |  |  |          String[] split = queryDate.split(" - "); | 
 |  |  |          startTime= split[0].split(" ")[0].replace("-","."); | 
 |  |  |          endTime = split[1].split(" ")[0].replace("-","."); | 
 |  |  |       } | 
 |  |  |       List<ViewWorkCountInView> allCountIn = reportQueryMapper.selectWorkCountOut(Integer.valueOf((String) param.get("pageNumber")), Integer.valueOf((String) param.get("pageSize")), (String) param.get("matnr"), startTime,endTime); | 
 |  |  |       Integer total = reportQueryMapper.selectWorkCountOutTotal((String) param.get("matnr"), startTime,endTime); | 
 |  |  |       Page<ViewWorkCountInView> page = new Page<>(); | 
 |  |  |       page.setRecords(allCountIn); | 
 |  |  |       page.setTotal(total); | 
 |  |  |       return R.ok(page); | 
 |  |  |       Integer sum = reportQueryMapper.selectWorkCountOutSum((String) param.get("matnr"), startTime,endTime); | 
 |  |  |       HashMap<String, Object> result = new HashMap<>(); | 
 |  |  |       result.put("page",page); | 
 |  |  |       result.put("sum",sum); | 
 |  |  |       return R.ok(result); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    //excel导出 | 
 |  |  | 
 |  |  |       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); | 
 |  |  |          } | 
 |  |  |       } | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | } |