zhangzeli
2022-01-05 435b1cfe40ee2822381274d3a0a4f9066157b02b
回复
18个文件已修改
180 ■■■■ 已修改文件
xboot-core/src/main/java/cn/exrick/xboot/core/dao/UserDao.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-core/src/main/java/cn/exrick/xboot/core/service/UserService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-core/src/main/java/cn/exrick/xboot/core/serviceimpl/UserServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CustomerMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/EventLogMapper.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICarService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICustomerService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IEventLogService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICarServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICustomerServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IEventLogServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/CarVo.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xboot-core/src/main/java/cn/exrick/xboot/core/dao/UserDao.java
@@ -67,4 +67,6 @@
    @Query("select count(id) from User u where u.type2=?1")
    int countByType(int type);
    List<User> findByType2(int type);
}
xboot-core/src/main/java/cn/exrick/xboot/core/service/UserService.java
@@ -78,4 +78,6 @@
    void updateDepartmentTitle(String departmentId, String departmentTitle);
    int countByType(int type);
    List<User> findByType2(int type);
}
xboot-core/src/main/java/cn/exrick/xboot/core/serviceimpl/UserServiceImpl.java
@@ -201,4 +201,11 @@
    public int countByType(int type) {
        return userDao.countByType(type);
    }
    @Override
    public List<User> findByType2(int type) {
        return userDao.findByType2(type);
    }
}
xboot-modules/xboot-base/src/main/java/cn/exrick/xboot/base/controller/manage/UserController.java
@@ -528,4 +528,17 @@
            throw new XbootException("该手机号已被注册");
        }
    }
    @RequestMapping(value = "/findByType2", method = RequestMethod.GET)
    @ApiOperation(value = "获取全部用户数据")
    public Result<List<User>> findByType2(int type) {
        List<User> list = userService.findByType2(type);
        // 清除持久上下文环境 避免后面语句导致持久化
        entityManager.clear();
        for (User u : list) {
            u.setPassword(null);
        }
        return new ResultUtil<List<User>>().setData(list);
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/CarController.java
@@ -4,13 +4,11 @@
import cn.exrick.xboot.core.common.utils.ResultUtil;
import cn.exrick.xboot.core.common.vo.PageVo;
import cn.exrick.xboot.core.common.vo.Result;
import cn.exrick.xboot.your.entity.AddOil;
import cn.exrick.xboot.your.entity.Car;
import cn.exrick.xboot.your.entity.DrivingRecord;
import cn.exrick.xboot.your.entity.Suggest;
import cn.exrick.xboot.your.entity.*;
import cn.exrick.xboot.your.service.IAddOilService;
import cn.exrick.xboot.your.service.ICarService;
import cn.exrick.xboot.your.service.IDrivingRecordService;
import cn.exrick.xboot.your.service.IOrderTaskService;
import cn.exrick.xboot.your.vo.CarVo;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
@@ -46,6 +44,9 @@
    private IAddOilService iAddOilService;
    @Autowired
    private IDrivingRecordService iDrivingRecordService;
    @Autowired
    private IOrderTaskService iOrderTaskService;
    @RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
    @ApiOperation(value = "通过id获取")
@@ -65,10 +66,11 @@
    @RequestMapping(value = "/getAll", method = RequestMethod.GET)
    @ApiOperation(value = "获取全部数据")
    public Result<List<CarVo>> getAll(String beginTime,String endTime) {
    public Result<List<CarVo>> getAll(String beginTime,String endTime,PageVo page) {
        List<CarVo> carVos = new ArrayList<>();
        List<Car> list = iCarService.getAll2();
        for (Car car:list){
        IPage<Car> list = iCarService.getAll2(PageUtil.initMpPage(page));
        for (Car car:list.getRecords()){
            CarVo carVo = new CarVo();
            //加油信息
            QueryWrapper<AddOil> queryWrapper = new QueryWrapper<>();
@@ -85,9 +87,20 @@
            wrapper.le(endTime!=null && endTime!="","in_time",endTime);
            queryWrapper.le(endTime!=null && endTime!="","add_date",beginTime);
            QueryWrapper<OrderTask> wrapper1 = new QueryWrapper<>();
            wrapper1.eq("car_id",car.getId());
            wrapper1.ge(beginTime!=null && beginTime!="","send_date",beginTime);
            wrapper1.le(endTime!=null && endTime!="","send_date",endTime);
            OrderTask orderTask = iOrderTaskService.getOne(wrapper1);
            DrivingRecord drivingRecord = iDrivingRecordService.getOne(wrapper);
            AddOil addOil = iAddOilService.getOne(queryWrapper);
            if (addOil!=null){
                carVo.setMoney(addOil.getMoney());
@@ -101,6 +114,7 @@
            carVo.setCar(car);
            carVos.add(carVo);
            carVo.setTotal(list.getTotal());
        }
        return new ResultUtil<List<CarVo>>().setData(carVos);
    }
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CarMapper.java
@@ -1,6 +1,5 @@
package cn.exrick.xboot.your.mapper;
import cn.exrick.xboot.your.entity.Area;
import cn.exrick.xboot.your.vo.CarVo;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
@@ -27,7 +26,7 @@
    IPage<Car> page2(Page initMpPage, @Param(Constants.WRAPPER) QueryWrapper<Car> wrapper);
    @Select("SELECT c.*,u.nickname,a.`name` AS area_name FROM t_car c LEFT JOIN t_user AS u ON c.user_id=u.id LEFT JOIN t_area AS a ON a.user_id=u.id")
    List<Car> getAll2();
    IPage<Car> getAll2(Page initMpPage);
    @Select("SELECT\n" +
            "\tc.*,(SUM(amount)) AS allAmount,SUM(money) AS allMoney,(MAX(mileage)) AS allMileage\n" +
@@ -43,4 +42,20 @@
            "LEFT JOIN t_add_oil a ON c.id = a.car_id ${ew.customSqlSegment}")
    List<Car> getCarInfo2(@Param(Constants.WRAPPER) QueryWrapper<Car> wrapper);
    @Select("select \n" +
            "sum(case when month(create_time) < 2 && year(create_time) <= #{year} then 1 else 0 end) as january,\n" +
            "sum(case when month(create_time) < 3 && year(create_time) <= #{year} then 1 else 0 end) as february,\n" +
            "sum(case when month(create_time) < 4 && year(create_time) <= #{year} then 1 else 0 end) as march,\n" +
            "sum(case when month(create_time) < 5 && year(create_time) <= #{year} then 1 else 0 end) as april,\n" +
            "sum(case when month(create_time) < 6 && year(create_time) <= #{year} then 1 else 0 end) as may,\n" +
            "sum(case when month(create_time) < 7 && year(create_time) <= #{year} then 1 else 0 end) as june,\n" +
            "sum(case when month(create_time) < 8 && year(create_time) <= #{year} then 1 else 0 end) as july,\n" +
            "sum(case when month(create_time) < 9 && year(create_time) <= #{year} then 1 else 0 end) as august,\n" +
            "sum(case when month(create_time) < 10 && year(create_time) <= #{year} then 1 else 0 end) as september,\n" +
            "sum(case when month(create_time) < 11 && year(create_time) <= #{year} then 1 else 0 end) as october,\n" +
            "sum(case when month(create_time) < 12 && year(create_time) <= #{year} then 1 else 0 end) as november,\n" +
            "sum(case when month(create_time) < 13 && year(create_time) <= #{year} then 1 else 0 end) as december\n" +
            "from t_car")
    Month getCarCount(@Param("year")Integer year);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/CustomerMapper.java
@@ -1,10 +1,10 @@
package cn.exrick.xboot.your.mapper;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.exrick.xboot.your.entity.Customer;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
 * 商户表数据处理层
@@ -14,4 +14,20 @@
    @Select("select count(id) from t_customer")
    int count();
    @Select("select \n" +
            "sum(case when month(create_time) < 2 && year(create_time) <= #{year} then 1 else 0 end) as january,\n" +
            "sum(case when month(create_time) < 3 && year(create_time) <= #{year} then 1 else 0 end) as february,\n" +
            "sum(case when month(create_time) < 4 && year(create_time) <= #{year} then 1 else 0 end) as march,\n" +
            "sum(case when month(create_time) < 5 && year(create_time) <= #{year} then 1 else 0 end) as april,\n" +
            "sum(case when month(create_time) < 6 && year(create_time) <= #{year} then 1 else 0 end) as may,\n" +
            "sum(case when month(create_time) < 7 && year(create_time) <= #{year} then 1 else 0 end) as june,\n" +
            "sum(case when month(create_time) < 8 && year(create_time) <= #{year} then 1 else 0 end) as july,\n" +
            "sum(case when month(create_time) < 9 && year(create_time) <= #{year} then 1 else 0 end) as august,\n" +
            "sum(case when month(create_time) < 10 && year(create_time) <= #{year} then 1 else 0 end) as september,\n" +
            "sum(case when month(create_time) < 11 && year(create_time) <= #{year} then 1 else 0 end) as october,\n" +
            "sum(case when month(create_time) < 12 && year(create_time) <= #{year} then 1 else 0 end) as november,\n" +
            "sum(case when month(create_time) < 13 && year(create_time) <= #{year} then 1 else 0 end) as december\n" +
            "from t_customer")
    Month getCustomerCount(@Param("year")Integer year);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/EventLogMapper.java
@@ -1,7 +1,10 @@
package cn.exrick.xboot.your.mapper;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.exrick.xboot.your.entity.EventLog;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@@ -11,4 +14,20 @@
 */
public interface EventLogMapper extends BaseMapper<EventLog> {
    @Select("select \n" +
            "sum(case month(create_time) when '1' then 1 else 0 end) as january,\n" +
            "sum(case month(create_time) when '2' then 1 else 0 end) as february,\n" +
            "sum(case month(create_time) when '3' then 1 else 0 end) as march,\n" +
            "sum(case month(create_time) when '4' then 1 else 0 end) as april,\n" +
            "sum(case month(create_time) when '5' then 1 else 0 end) as may,\n" +
            "sum(case month(create_time) when '6' then 1 else 0 end) as june,\n" +
            "sum(case month(create_time) when '7' then 1 else 0 end) as july,\n" +
            "sum(case month(create_time) when '8' then 1 else 0 end) as august,\n" +
            "sum(case month(create_time) when '9' then 1 else 0 end) as september,\n" +
            "sum(case month(create_time) when '10' then 1 else 0 end) as october,\n" +
            "sum(case month(create_time) when '11' then 1 else 0 end) as november,\n" +
            "sum(case month(create_time) when '12' then 1 else 0 end) as december\n" +
            "from t_event_log e\n" +
            "where year(create_time)=#{year} and type=#{type}")
    Month getEventNum(@Param("year")int year,@Param("type")int type);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/mapper/OrderTaskMapper.java
@@ -1,6 +1,7 @@
package cn.exrick.xboot.your.mapper;
import cn.exrick.xboot.your.entity.AddOil;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.exrick.xboot.your.entity.OrderTask;
@@ -45,4 +46,21 @@
    @Select("select sum(time) as time2,send_date from t_order_task where date_sub(curdate(), interval 1 month) <= date(send_date) and area_section_id=#{arg0} GROUP BY send_date")
    @Results({@Result(column="time2", property="time", jdbcType = JdbcType.INTEGER)})
    List<OrderTask> sumTime(String id);
    @Select("select \n" +
            "sum(case month(t.send_date) when '1' then d.num else 0 end) as january,\n" +
            "sum(case month(t.send_date) when '2' then d.num else 0 end) as february,\n" +
            "sum(case month(t.send_date) when '3' then d.num else 0 end) as march,\n" +
            "sum(case month(t.send_date) when '4' then d.num else 0 end) as april,\n" +
            "sum(case month(t.send_date) when '5' then d.num else 0 end) as may,\n" +
            "sum(case month(t.send_date) when '6' then d.num else 0 end) as june,\n" +
            "sum(case month(t.send_date) when '7' then d.num else 0 end) as july,\n" +
            "sum(case month(t.send_date) when '8' then d.num else 0 end) as august,\n" +
            "sum(case month(t.send_date) when '9' then d.num else 0 end) as september,\n" +
            "sum(case month(t.send_date) when '10' then d.num else 0 end) as october,\n" +
            "sum(case month(t.send_date) when '11' then d.num else 0 end) as november,\n" +
            "sum(case month(t.send_date) when '12' then d.num else 0 end) as december\n" +
            "from t_order_task t LEFT JOIN t_order_detail d ON t.id=d.order_id\n" +
            "where year(t.send_date)=#{year}")
    Month getSendNum(@Param("year")int year);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICarService.java
@@ -1,6 +1,6 @@
package cn.exrick.xboot.your.service;
import cn.exrick.xboot.your.vo.CarVo;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -17,9 +17,11 @@
    IPage<Car> page2(Page initMpPage, QueryWrapper<Car> wrapper);
    List<Car> getAll2();
    IPage<Car> getAll2(Page initMpPage);
    List<Car> getCarInfo();
    List<Car> getCarInfo2(QueryWrapper<Car> wrapper);
    Month getCarCount(Integer year);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/ICustomerService.java
@@ -1,9 +1,8 @@
package cn.exrick.xboot.your.service;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.exrick.xboot.your.entity.Customer;
import java.util.List;
/**
 * 商户表接口
@@ -12,4 +11,6 @@
public interface ICustomerService extends IService<Customer> {
    int countOpenId();
    Month getCustomerCount(Integer year);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IEventLogService.java
@@ -1,5 +1,6 @@
package cn.exrick.xboot.your.service;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.exrick.xboot.your.entity.EventLog;
@@ -11,4 +12,5 @@
 */
public interface IEventLogService extends IService<EventLog> {
    Month getEventNum(int year,int type);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/service/IOrderTaskService.java
@@ -1,5 +1,6 @@
package cn.exrick.xboot.your.service;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.exrick.xboot.your.entity.OrderTask;
@@ -24,5 +25,7 @@
    List<OrderTask> list3(String date);
    Month getSendNum(int year);
    List<OrderTask> sumTime(String id);
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICarServiceImpl.java
@@ -1,9 +1,9 @@
package cn.exrick.xboot.your.serviceimpl;
import cn.exrick.xboot.your.vo.Month;
import cn.exrick.xboot.your.mapper.CarMapper;
import cn.exrick.xboot.your.entity.Car;
import cn.exrick.xboot.your.service.ICarService;
import cn.exrick.xboot.your.vo.CarVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -13,7 +13,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
@@ -34,8 +33,8 @@
    }
    @Override
    public List<Car> getAll2() {
        return carMapper.getAll2();
    public IPage<Car> getAll2(Page initMpPage) {
        return carMapper.getAll2(initMpPage);
    }
    public List<Car> getCarInfo(){
@@ -45,4 +44,9 @@
    public List<Car> getCarInfo2(QueryWrapper<Car> wrapper){
        return carMapper.getCarInfo2(wrapper);
    }
    @Override
    public Month getCarCount(Integer year) {
        return carMapper.getCarCount(year);
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/ICustomerServiceImpl.java
@@ -1,5 +1,6 @@
package cn.exrick.xboot.your.serviceimpl;
import cn.exrick.xboot.your.vo.Month;
import cn.exrick.xboot.your.mapper.CustomerMapper;
import cn.exrick.xboot.your.entity.Customer;
import cn.exrick.xboot.your.service.ICustomerService;
@@ -9,9 +10,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
 * 商户表接口实现
@@ -37,4 +35,9 @@
            return (i*100)/i2;
        }
    }
    @Override
    public Month getCustomerCount(Integer year) {
        return customerMapper.getCustomerCount(year);
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IEventLogServiceImpl.java
@@ -3,6 +3,7 @@
import cn.exrick.xboot.your.mapper.EventLogMapper;
import cn.exrick.xboot.your.entity.EventLog;
import cn.exrick.xboot.your.service.IEventLogService;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,4 +24,9 @@
    @Autowired
    private EventLogMapper eventLogMapper;
    @Override
    public Month getEventNum(int year, int type) {
        return eventLogMapper.getEventNum(year,type);
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/serviceimpl/IOrderTaskServiceImpl.java
@@ -3,6 +3,7 @@
import cn.exrick.xboot.your.mapper.OrderTaskMapper;
import cn.exrick.xboot.your.entity.OrderTask;
import cn.exrick.xboot.your.service.IOrderTaskService;
import cn.exrick.xboot.your.vo.Month;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
@@ -63,4 +64,8 @@
    public List<OrderTask> sumTime(String id) {
        return orderTaskMapper.sumTime(id);
    }
    @Override
    public Month getSendNum(int year){
        return orderTaskMapper.getSendNum(year);
    }
}
xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/vo/CarVo.java
@@ -16,4 +16,6 @@
    private double oilWear;
    private long total;
}