Commit 6b67dc15 authored by jiaorz's avatar jiaorz

Merge branch 'master-vehicle-bg'

parents fa28e058 1c46624e
package com.xxfc.platform.vehicle.pojo;
import lombok.Data;
@Data
public class BranchCompanyVehicleCount {
private String parkBranchCompanyName;
private Integer count;
}
package com.xxfc.platform.vehicle.biz; package com.xxfc.platform.vehicle.biz;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.xxfc.platform.vehicle.entity.Constant; import com.xxfc.platform.vehicle.entity.Constant;
...@@ -15,7 +14,6 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -15,7 +14,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -138,8 +136,8 @@ public class ImportVehicleDataBiz extends BaseBiz<VehicleMapper, Vehicle> { ...@@ -138,8 +136,8 @@ public class ImportVehicleDataBiz extends BaseBiz<VehicleMapper, Vehicle> {
} }
} }
System.out.println("stringBuffer:"+stringBuffer); log.info("stringBuffer:"+stringBuffer);
System.out.println("stringBuffer2:"+stringBuffer2); log.info("stringBuffer2:"+stringBuffer2);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
......
...@@ -1514,4 +1514,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1514,4 +1514,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return vehicles.stream().map(Vehicle::getId).collect(Collectors.toList()); return vehicles.stream().map(Vehicle::getId).collect(Collectors.toList());
} }
public List<BranchCompanyVehicleCount> getAllVehicleInfo() {
return mapper.getAllVehicleInfo();
}
} }
...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.xxfc.platform.vehicle.entity.Vehicle; import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.mapper.VehicleMapper; import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount;
import com.xxfc.platform.vehicle.pojo.ResultVehicleVo; import com.xxfc.platform.vehicle.pojo.ResultVehicleVo;
import com.xxfc.platform.vehicle.pojo.VehicleExcelVo; import com.xxfc.platform.vehicle.pojo.VehicleExcelVo;
import com.xxfc.platform.vehicle.pojo.VehiclePageQueryVo; import com.xxfc.platform.vehicle.pojo.VehiclePageQueryVo;
...@@ -92,4 +93,9 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl ...@@ -92,4 +93,9 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
return arrayList; return arrayList;
} }
public List<BranchCompanyVehicleCount> getAllVehicleInfo() {
return vehicleBiz.getAllVehicleInfo();
}
} }
...@@ -53,4 +53,6 @@ public interface VehicleMapper extends Mapper<Vehicle> { ...@@ -53,4 +53,6 @@ public interface VehicleMapper extends Mapper<Vehicle> {
@Select("select `id` from `vehicle` where `is_del`=0") @Select("select `id` from `vehicle` where `is_del`=0")
List<String> findExistVehicleIds(); List<String> findExistVehicleIds();
List<BranchCompanyVehicleCount> getAllVehicleInfo();
} }
\ No newline at end of file
...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException; ...@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.vehicle.biz.VehicleBiz; import com.xxfc.platform.vehicle.biz.VehicleBiz;
import com.xxfc.platform.vehicle.biz.VehicleInformationDownloadBiz; import com.xxfc.platform.vehicle.biz.VehicleInformationDownloadBiz;
import com.xxfc.platform.vehicle.common.BaseController; import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount;
import com.xxfc.platform.vehicle.pojo.VehicleExcelVo; import com.xxfc.platform.vehicle.pojo.VehicleExcelVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -41,10 +42,10 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle ...@@ -41,10 +42,10 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
HttpServletResponse response; HttpServletResponse response;
@GetMapping("/excel") @GetMapping("/excel")
public void downloadExcel(@RequestParam(value = "vehiclePageQueryVoJson",required = false) String vehiclePageQueryVoJson) throws Exception { public void downloadExcel(@RequestParam(value = "vehiclePageQueryVoJson", required = false) String vehiclePageQueryVoJson) throws Exception {
UserDTO userDTO = userFeign.userinfoByToken(userAuthConfig.getToken(request)).getData(); UserDTO userDTO = userFeign.userinfoByToken(userAuthConfig.getToken(request)).getData();
if (userDTO==null) { if (userDTO == null) {
throw new BaseException("token已失效"); throw new BaseException("token已失效");
} }
List<VehicleExcelVo> rows = baseBiz.getList(vehiclePageQueryVoJson, userDTO); List<VehicleExcelVo> rows = baseBiz.getList(vehiclePageQueryVoJson, userDTO);
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
...@@ -67,4 +68,25 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle ...@@ -67,4 +68,25 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
//此处记得关闭输出Servlet流 //此处记得关闭输出Servlet流
IoUtil.close(out); IoUtil.close(out);
} }
@GetMapping("/app/unauth/export")
public void exportVehicleInfo() throws Exception {
List<BranchCompanyVehicleCount> rows = baseBiz.getAllVehicleInfo();
ExcelWriter writer = ExcelUtil.getWriter(true);
writer.addHeaderAlias("parkBranchCompanyName", "停靠分公司");
writer.addHeaderAlias("count", "车辆数量");
// 一次性写出内容,使用默认样式,强制输出标题
writer.write(rows, true);
//response为HttpServletResponse对象
response.setContentType("application/vnd.ms-excel;charset=utf-8");
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
response.setHeader("Content-Disposition", "attachment;filename=vehicleInfo.xlsx");
//out为OutputStream,需要写出到的目标流
ServletOutputStream out = response.getOutputStream();
writer.flush(out, true);
// 关闭writer,释放内存
writer.close();
//此处记得关闭输出Servlet流
IoUtil.close(out);
}
} }
...@@ -590,7 +590,20 @@ ...@@ -590,7 +590,20 @@
) r ORDER BY r.parkBranchCompanyName ) r ORDER BY r.parkBranchCompanyName
</select> </select>
<!--导出分公司停靠所有车辆-->
<select id="getAllVehicleInfo" resultType="com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount">
SELECT
b1. NAME AS parkBranchCompanyName,
count(v1.id) as count
FROM
branch_company b1
LEFT JOIN vehicle v1 ON v1.park_branch_company_id = b1.id
WHERE
b1.is_del = 0
AND v1.is_del = 0
GROUP BY b1.`name`
order by b1.`name`
</select>
<select id="lockByCode" resultType="com.xxfc.platform.vehicle.entity.Vehicle" <select id="lockByCode" resultType="com.xxfc.platform.vehicle.entity.Vehicle"
parameterType="com.xxfc.platform.vehicle.pojo.AddOrUpdateVehicleVo"> parameterType="com.xxfc.platform.vehicle.pojo.AddOrUpdateVehicleVo">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment