| | |
| | | public Result<List<Car>> getInfo(String beginTime,String endTime) { |
| | | java.text.DecimalFormat df =new java.text.DecimalFormat("#.##"); |
| | | |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<>(); |
| | | wrapper.ge(beginTime!=null && beginTime!="","a.add_date",beginTime); |
| | | wrapper.le(endTime!=null && endTime!="","a.add_date",endTime); |
| | | wrapper.groupBy("car_no"); |
| | | List<Car> list2 = iCarService.getCarInfo2(wrapper); |
| | | List<Car> list = iCarService.getCarInfo(); |
| | | for (Car car:list2){ |
| | | for (Car car1:list){ |
| | | if (car.getId().equals(car1.getId())){ |
| | | car1.setAmount(Double.parseDouble(df.format(car.getAmount()))); |
| | | car1.setMileage(Double.parseDouble(df.format(car.getMileage()))); |
| | | car1.setMoney(Double.parseDouble(df.format(car.getMoney()))); |
| | | car1.setAllAmount(Double.parseDouble(df.format(car1.getAllAmount()))); |
| | | car1.setAllMileage(Double.parseDouble(df.format(car1.getAllMileage()))); |
| | | car1.setAllMoney(Double.parseDouble(df.format(car1.getAllMoney()))); |
| | | continue; |
| | | } |
| | | } |
| | | QueryWrapper<AddOil> wrapper = new QueryWrapper<>(); |
| | | wrapper.ge(beginTime!=null && beginTime!="","add_date",beginTime); |
| | | wrapper.le(endTime!=null && endTime!="","add_date",endTime); |
| | | // wrapper.groupBy("car_id"); |
| | | List<AddOil> addOilList = iAddOilService.list(wrapper); |
| | | List<Car> list = new ArrayList<>(); |
| | | Map<String, List<AddOil>> collect = addOilList.stream().collect(Collectors.groupingBy(AddOil::getCarId)); |
| | | for (Map.Entry<String, List<AddOil>> stringListEntry : collect.entrySet()) { |
| | | String key = stringListEntry.getKey(); |
| | | Car car = iCarService.getById(key); |
| | | Car carInfoByCarId = iCarService.getCarInfoByCarId(key); |
| | | car.setAmount(Double.parseDouble(df.format(carInfoByCarId.getAmount()))); |
| | | car.setMileage(Double.parseDouble(df.format(carInfoByCarId.getMileage()))); |
| | | car.setMoney(Double.parseDouble(df.format(carInfoByCarId.getMoney()))); |
| | | car.setAllAmount(Double.parseDouble(df.format(carInfoByCarId.getAllAmount()))); |
| | | car.setAllMileage(Double.parseDouble(df.format(carInfoByCarId.getAllMileage()))); |
| | | car.setAllMoney(Double.parseDouble(df.format(carInfoByCarId.getAllMoney()))); |
| | | list.add(car); |
| | | } |
| | | // List<Car> list2 = iCarService.getCarInfo2(wrapper); |
| | | // List<Car> list = iCarService.getCarInfo(); |
| | | // for (Car car:list2){ |
| | | // for (Car car1:list){ |
| | | // if (car.getId().equals(car1.getId())){ |
| | | // car1.setAmount(Double.parseDouble(df.format(car.getAmount()))); |
| | | // car1.setMileage(Double.parseDouble(df.format(car.getMileage()))); |
| | | // car1.setMoney(Double.parseDouble(df.format(car.getMoney()))); |
| | | // car1.setAllAmount(Double.parseDouble(df.format(car1.getAllAmount()))); |
| | | // car1.setAllMileage(Double.parseDouble(df.format(car1.getAllMileage()))); |
| | | // car1.setAllMoney(Double.parseDouble(df.format(car1.getAllMoney()))); |
| | | // continue; |
| | | // } |
| | | // } |
| | | // } |
| | | return new ResultUtil<List<Car>>().setData(list); |
| | | } |
| | | |
| | |
| | | private String fiveBatch; |
| | | @ExcelIgnore |
| | | private String sendMonth; |
| | | @ExcelIgnore |
| | | private Integer proportionInt; |
| | | } |
| | |
| | | "from t_car") |
| | | Month getCarCount(@Param("year")Integer year); |
| | | |
| | | } |
| | | @Select("SELECT\n" + |
| | | "\t( MAX( amount ) - MIN( amount ) ) AS amount,\n" + |
| | | "\tSUM( money ) AS money,\n" + |
| | | "\t( MAX( mileage ) - MIN( mileage ) ) AS mileage, \n" + |
| | | "\tSUM(amount) AS allAmount,SUM(money) AS allMoney,(MAX(mileage)) AS allMileage \n"+ |
| | | "FROM\n" + |
| | | "\t t_add_oil a\n" + |
| | | "\t WHERE a.car_id = #{carId}") |
| | | Car getCarInfoByCarId(@Param("carId")String carId); |
| | | } |
| | |
| | | List<Car> getCarInfo2(QueryWrapper<Car> wrapper); |
| | | |
| | | Month getCarCount(Integer year); |
| | | } |
| | | |
| | | Car getCarInfoByCarId(String carId); |
| | | } |
| | |
| | | return carMapper.getAll2(initMpPage); |
| | | } |
| | | |
| | | @Override |
| | | public List<Car> getCarInfo(){ |
| | | return carMapper.getCarInfo(); |
| | | } |
| | | |
| | | @Override |
| | | public List<Car> getCarInfo2(QueryWrapper<Car> wrapper){ |
| | | return carMapper.getCarInfo2(wrapper); |
| | | } |
| | |
| | | public Month getCarCount(Integer year) { |
| | | return carMapper.getCarCount(year); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Car getCarInfoByCarId(String carId) { |
| | | return carMapper.getCarInfoByCarId(carId); |
| | | } |
| | | } |
| | |
| | | import cn.exrick.xboot.your.entity.SignCount; |
| | | import cn.exrick.xboot.your.service.ISignCountService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import jodd.util.StringUtil; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 状态统计表接口实现 |
| | |
| | | page.setSize(-1); |
| | | } |
| | | if(StringUtil.isNotBlank(orderStatusCount.getStatisticalType())){ |
| | | IPage<OrderStatusCount> orderStatusCountIPage = this.signCountMapper.signCounts(orderStatusCount, page); |
| | | List<OrderStatusCount> records = orderStatusCountIPage.getRecords(); |
| | | Map<String, List<OrderStatusCount>> collect = records.stream().collect(Collectors.groupingBy(OrderStatusCount::getCarName)); |
| | | for (Map.Entry<String, List<OrderStatusCount>> stringListEntry : collect.entrySet()) { |
| | | for (Map.Entry<String, List<OrderStatusCount>> listEntry : stringListEntry.getValue().stream().collect(Collectors.groupingBy(OrderStatusCount::getBatch)).entrySet()) { |
| | | for (Map.Entry<String, List<OrderStatusCount>> listEntry1 : listEntry.getValue().stream().collect(Collectors.groupingBy(OrderStatusCount::getSendDate)).entrySet()) { |
| | | if(listEntry1.getValue().size() > 0){ |
| | | List<OrderStatusCount> value = listEntry1.getValue(); |
| | | OrderStatusCount orderStatusCount1 = value.get(0); |
| | | Double prodouble = value.stream().collect(Collectors.averagingInt(OrderStatusCount::getProportionInt)); |
| | | prodouble = (double)Math.round(prodouble*100)/100; |
| | | orderStatusCount1.setProportion(prodouble + "%"); |
| | | value.clear(); |
| | | value.add(orderStatusCount1); |
| | | listEntry1.setValue(value); |
| | | } |
| | | } |
| | | |
| | | return this.signCountMapper.signCounts(orderStatusCount,page); |
| | | } |
| | | |
| | | } |
| | | List<OrderStatusCount> collect1 = records.stream().filter(f -> f.getProportion() != null).collect(Collectors.toList()); |
| | | orderStatusCountIPage.setRecords(collect1); |
| | | return orderStatusCountIPage; |
| | | } |
| | | return this.signCountMapper.signCount(orderStatusCount,page); |
| | | } |
| | | } |
| | | } |
| | |
| | | b.car_no, |
| | | c.NAME, |
| | | d.NAME, |
| | | a.send_date |
| | | a.send_date, |
| | | e.nickname, |
| | | a.id |
| | | ORDER BY |
| | | c.NAME ASC, |
| | | a.send_date asc |
| | | </select> |
| | | </mapper> |
| | | </mapper> |
| | |
| | | sum(abnormal_sign) AS abnormalSign, |
| | | sum(not_sign_count) AS notSignCount, |
| | | sum(sign_count )AS signCount, |
| | | CONCAT_WS( '',ROUND(AVG(proportion),0), '%') as proportion, |
| | | ROUND(AVG(proportion),0) as proportionInt, |
| | | </if> |
| | | <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '4'.toString()"> |
| | | YEAR(DATE_FORMAT(DATE_SUB(send_date,INTERVAL 1 DAY),'%Y-%m-%d')) sendDate, |
| | |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '1'.toString()"> |
| | | DATE(send_date), |
| | | </if> |
| | | <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '2'.toString()"> |
| | | WEEK(send_date,1), |
| | | </if> |
| | | <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '3'.toString()"> |
| | | MONTH(send_date), |
| | | </if> |
| | | <if test="bo.StatisticalType!=null and bo.StatisticalType !='' and bo.StatisticalType == '4'.toString()"> |
| | | YEAR(send_date), |
| | | </if> |
| | | send_date, |
| | | car_name, |
| | | line, |
| | | batch |
| | | batch, |
| | | amount, |
| | | abnormal_sign, |
| | | not_sign_count, |
| | | sign_count, |
| | | proportion, |
| | | user_name |
| | | ORDER BY |
| | | line ASC, |
| | | send_date asc |
| | |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | DATE(send_date), |
| | | send_date, |
| | | car_name, |
| | | line, |
| | | batch |
| | | batch, |
| | | amount, |
| | | abnormal_sign, |
| | | not_sign_count, |
| | | sign_count, |
| | | proportion, |
| | | user_name |
| | | ORDER BY |
| | | line ASC, |
| | | send_date asc |
| | | </select> |
| | | </mapper> |
| | | </mapper> |