| | |
| | | @Override |
| | | public WorkorderIndexNumVO getIndexData(Workorder workorder) { |
| | | WorkorderIndexNumVO model = new WorkorderIndexNumVO(); |
| | | Date startdate = getStartDateByType(workorder.getTimeType()); |
| | | //查询今年所有的数据 |
| | | List<Workorder> list = workorderMapper.selectJoinList(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("type,count(id) as num") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .ge(startdate!=null,Workorder::getCreateDate,startdate) |
| | | // .lt(endDate!=null,Workorder::getCreateDate,endDate) |
| | | .groupBy(Workorder::getType )); |
| | | if(list !=null){ |
| | | for(Workorder w : list){ |
| | |
| | | } |
| | | } |
| | | } |
| | | List<Workorder> todays = workorderMapper.selectJoinList(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("type,count(id) as num") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .apply("to_days(create_date)=to_days(now())") |
| | | .groupBy(Workorder::getType )); |
| | | if(todays !=null){ |
| | | for(Workorder w : todays){ |
| | | if(Constants.equalsInteger(w.getType(),Constants.ZERO)){ |
| | | //SHE |
| | | model.setTodaySheNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.ONE)){ |
| | | //DCA提交数 |
| | | model.setTodayDcaNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.TWO)){ |
| | | //DCA子工单 |
| | | model.setTodayDcaChildNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.THREE)){ |
| | | //跌绊滑 |
| | | model.setTodayDbhNum(Constants.formatLongNum(w.getNum())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<Workorder> yeslist = workorderMapper.selectJoinList(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("type,count(id) as num") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .in(Workorder::getStatus,Constants.THREE,Constants.FOUR,Constants.FIVE) |
| | | .in(Workorder::getType,Constants.THREE,Constants.TWO) |
| | | .ge(startdate!=null,Workorder::getCreateDate,startdate) |
| | | .groupBy(Workorder::getType )); |
| | | if(yeslist !=null){ |
| | | for(Workorder w : yeslist){ |
| | |
| | | } |
| | | } |
| | | } |
| | | Workorder dcaList = workorderMapper.selectJoinOne(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("sum(dca_yes_num) as dcaYesNum,sum(dca_no_num) as dcaNoNum") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .eq(Workorder::getType,Constants.ONE) ); |
| | | if(dcaList !=null){ |
| | | //DCA符合项和不符合项统计 |
| | | model.setDcaYesNum((long)Constants.formatIntegerNum(dcaList.getDcaYesNum())); |
| | | model.setDcaNoNum((long)Constants.formatIntegerNum(dcaList.getDcaNoNum())); |
| | | if(workorder.getTimeType() == null){ |
| | | List<Workorder> todays = workorderMapper.selectJoinList(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("type,count(id) as num") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .apply("to_days(create_date)=to_days(now())") |
| | | .groupBy(Workorder::getType )); |
| | | if(todays !=null){ |
| | | for(Workorder w : todays){ |
| | | if(Constants.equalsInteger(w.getType(),Constants.ZERO)){ |
| | | //SHE |
| | | model.setTodaySheNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.ONE)){ |
| | | //DCA提交数 |
| | | model.setTodayDcaNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.TWO)){ |
| | | //DCA子工单 |
| | | model.setTodayDcaChildNum(Constants.formatLongNum(w.getNum())); |
| | | }else if(Constants.equalsInteger(w.getType(),Constants.THREE)){ |
| | | //跌绊滑 |
| | | model.setTodayDbhNum(Constants.formatLongNum(w.getNum())); |
| | | } |
| | | } |
| | | } |
| | | Workorder dcaList = workorderMapper.selectJoinOne(Workorder.class,new MPJLambdaWrapper<Workorder>() |
| | | .select("sum(dca_yes_num) as dcaYesNum,sum(dca_no_num) as dcaNoNum") |
| | | .eq(Workorder::getIsdeleted,Constants.ZERO) |
| | | .eq(Workorder::getType,Constants.ONE) ); |
| | | if(dcaList !=null){ |
| | | //DCA符合项和不符合项统计 |
| | | model.setDcaYesNum((long)Constants.formatIntegerNum(dcaList.getDcaYesNum())); |
| | | model.setDcaNoNum((long)Constants.formatIntegerNum(dcaList.getDcaNoNum())); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | return model; |
| | | } |
| | | |
| | | private Date getStartDateByType(Integer timeType) { |
| | | Date date = null; |
| | | if(timeType == null){ |
| | | return null; |
| | | } else if (timeType == 0) { |
| | | //本周 |
| | | date = DateUtil.getBeginDayOfWeek(0); |
| | | }else if (timeType == 1) { |
| | | //本月 |
| | | date = DateUtil.getBeginDayOfMonth(0); |
| | | }else if (timeType == 2) { |
| | | //本季度 |
| | | date = DateUtil.getBeginDayOfSeason(0); |
| | | }else if (timeType == 3) { |
| | | //本年 |
| | | date = DateUtil.getBeginDayOfYear(0); |
| | | } |
| | | |
| | | return date; |
| | | } |
| | | |
| | | } |