kongdeqiang
2023-02-10 421e01bc2af7515bb67df5f7f81652710b403067
增加功能
8个文件已修改
148 ■■■■ 已修改文件
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderStatusCount.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICarService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICarServiceImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ISignCountServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/resources/mapper/OrderTaskMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/resources/mapper/SignCountMapper.xml 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java
@@ -129,25 +129,40 @@
    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);
    }
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/entity/OrderStatusCount.java
@@ -80,4 +80,6 @@
    private String fiveBatch;
    @ExcelIgnore
    private String sendMonth;
    @ExcelIgnore
    private Integer proportionInt;
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java
@@ -58,4 +58,13 @@
            "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);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICarService.java
@@ -24,4 +24,6 @@
    List<Car> getCarInfo2(QueryWrapper<Car> wrapper);
    Month getCarCount(Integer year);
}
    Car getCarInfoByCarId(String carId);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICarServiceImpl.java
@@ -37,10 +37,12 @@
        return carMapper.getAll2(initMpPage);
    }
    @Override
    public List<Car> getCarInfo(){
        return carMapper.getCarInfo();
    }
    @Override
    public List<Car> getCarInfo2(QueryWrapper<Car> wrapper){
        return carMapper.getCarInfo2(wrapper);
    }
@@ -49,4 +51,9 @@
    public Month getCarCount(Integer year) {
        return carMapper.getCarCount(year);
    }
}
    @Override
    public Car getCarInfoByCarId(String carId) {
        return carMapper.getCarInfoByCarId(carId);
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ISignCountServiceImpl.java
@@ -6,6 +6,7 @@
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;
@@ -13,10 +14,11 @@
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;
/**
 * 状态统计表接口实现
@@ -41,9 +43,31 @@
            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);
    }
}
}
xboot-modules/xboot-your/src/main/resources/mapper/OrderTaskMapper.xml
@@ -71,9 +71,11 @@
        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>
xboot-modules/xboot-your/src/main/resources/mapper/SignCountMapper.xml
@@ -21,7 +21,7 @@
            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,
@@ -62,21 +62,16 @@
        </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
@@ -128,12 +123,18 @@
            </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>