Commit ea000999 authored by caotao's avatar caotao

1.解决按月导出接口表头为空的问题。

2.导出的数据按照里程从高往低排序。
parent 528a8f3e
package com.yeejoin.equipmanage.controller;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -73,22 +74,14 @@ public class CarController extends AbstractBaseController {
@Lazy
ICarService iCarService;
@Autowired
private EquipmentMapper equipmentMapper;
@Autowired
ISystemDicService iSystemDicService;
@Autowired
private EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
ICarInfoService iCarInfoService;
@Autowired
ICarPropertyService iCarPropertyService;
@Autowired
CarInfoMapper carInfoMapper;
@Autowired
private ManufacturerInfoMapper manufacturerInfoMapper;
@Autowired
private CarPropertyMapper carPropertyMapper;
@Autowired
IEquipmentOnCarService iEquipmentOnCarService;
@Autowired
ExtinguishantOnCarMapper extinguishantOnCarMapper;
......@@ -97,35 +90,42 @@ public class CarController extends AbstractBaseController {
@Autowired
CarMapper carMapper;
@Autowired
private EquipmentIndexMapper equipmentIndexMapper;
@Autowired
EquipmentDetailMapper equipmentDetailMapper;
@Autowired
EquipmentQrcodeMapper equipmentQrcodeMapper;
@Resource(name = "productionQRCodeFactoryMap")
private Map<String, ProductionQRCode> messageHandMap;
@Autowired
ICarLonAndLatDataService iCarLonAndLatDataService;
@Lazy
@Autowired
IEquipmentService iEquipmentService;
@Autowired
IEquipmentDetailService iEquipmentDetailService;
@Autowired
IEquipmentQrcodeService iEquipmentQrcodeService;
@Autowired
IEquipmentIndexService iEquipmentIndexService;
@Autowired
ISourceStatistics iSourceStatistics;
@Autowired
JcsFeign jcsFeign;
@Autowired
FireFightingSystemServiceImpl fireFightingSystemServiceImpl;
@Autowired
private EquipmentMapper equipmentMapper;
@Autowired
private EquipmentCategoryMapper equipmentCategoryMapper;
@Autowired
private ManufacturerInfoMapper manufacturerInfoMapper;
@Autowired
private CarPropertyMapper carPropertyMapper;
@Autowired
private EquipmentIndexMapper equipmentIndexMapper;
@Resource(name = "productionQRCodeFactoryMap")
private Map<String, ProductionQRCode> messageHandMap;
@Autowired
private ISyncDataService syncDataService;
@Value("${redis_equip_type_count}")
private String equipTypeAndCount;
@Value("${redis_car_type_count}")
private String carTypeAndCount;
@Autowired
......@@ -136,26 +136,14 @@ public class CarController extends AbstractBaseController {
private String appKeyApp;
@Value("${iot.vehicle.track}")
private String iotServerName;
@Value("${systemctl.sync.switch}")
private Boolean syncSwitch;
@Value("${auth-key-fire-car}")
private String carAuthKey;
@Value("${auth-key-fire-iot-equip:fire_iot-equip_info}")
private String iotAuthKey;
@Autowired
ISourceStatistics iSourceStatistics;
@Autowired
private RedisUtils redisUtils;
@Autowired
JcsFeign jcsFeign;
@Autowired
FireFightingSystemServiceImpl fireFightingSystemServiceImpl;
@Value("${iot.code.prefix.have.used:20210003,20210004,20210005}")
private String haveUsedIotPrefix;
......@@ -198,12 +186,12 @@ public class CarController extends AbstractBaseController {
}
// 验证车辆code唯一性
String iotCode = car.getIotCode();
if(StringUtils.isNotEmpty(iotCode) && StringUtils.isNotEmpty(iotCode.trim())){
Car ar= carMapper.getCarsByIotCode(car.getIotCode());
if(ar!=null){
if (StringUtils.isNotEmpty(iotCode) && StringUtils.isNotEmpty(iotCode.trim())) {
Car ar = carMapper.getCarsByIotCode(car.getIotCode());
if (ar != null) {
throw new BadRequest("物联编码重复");
}
if(StringUtils.isNotEmpty(haveUsedIotPrefix) && Arrays.stream(haveUsedIotPrefix.split(",")).anyMatch(iotCode::startsWith)){
if (StringUtils.isNotEmpty(haveUsedIotPrefix) && Arrays.stream(haveUsedIotPrefix.split(",")).anyMatch(iotCode::startsWith)) {
throw new BadRequest("物联编码航班已占用");
}
}
......@@ -270,7 +258,6 @@ public class CarController extends AbstractBaseController {
// }
@Async("equipAsyncExecutor")
public void refreshAllCount() {
// 清空单位装备分类树缓存
......@@ -349,21 +336,20 @@ public class CarController extends AbstractBaseController {
// saveFile(carInstance);视频图片文件后期统一处理
String iotCode = car.getIotCode();
if(StringUtil.isNotEmpty(iotCode) && StringUtils.isNotEmpty(iotCode.trim())){
Car ar= carMapper.getCarsByIotCodeExcludeCarId(car.getIotCode(),car.getId());
if(ar != null){
if (StringUtil.isNotEmpty(iotCode) && StringUtils.isNotEmpty(iotCode.trim())) {
Car ar = carMapper.getCarsByIotCodeExcludeCarId(car.getIotCode(), car.getId());
if (ar != null) {
throw new BadRequest("物联编码重复");
}
if(StringUtils.isNotEmpty(haveUsedIotPrefix) && Arrays.stream(haveUsedIotPrefix.split(",")).anyMatch(iotCode::startsWith)){
if (StringUtils.isNotEmpty(haveUsedIotPrefix) && Arrays.stream(haveUsedIotPrefix.split(",")).anyMatch(iotCode::startsWith)) {
throw new BadRequest("物联编码航班已占用");
}
}
//用来解绑车辆
if (!ObjectUtils.isEmpty(car.getTeamId())){
jcsFeign.getUserCar(car.getId(),car.getTeamId());
if (!ObjectUtils.isEmpty(car.getTeamId())) {
jcsFeign.getUserCar(car.getId(), car.getTeamId());
}
Equipment equipment = iEquipmentService.getById(car.getEquipmentId());
......@@ -421,7 +407,7 @@ public class CarController extends AbstractBaseController {
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public Car selectById(HttpServletRequest request, @PathVariable Long id) {
return iCarService.selectOneById(id);
......@@ -429,6 +415,7 @@ public class CarController extends AbstractBaseController {
/**
* 电建项目-车辆信息详情(表单组件格式导致白屏修复)
*
* @param request
* @param id
* @return
......@@ -1176,8 +1163,8 @@ public class CarController extends AbstractBaseController {
Map<Long, List<CarIndexVo>> map = null;
// String orgCode = getOrgCode();
ReginParams ReginParams=getSelectedOrgInfo();
String orgCode= ReginParams.getPersonIdentity().getBizOrgCode();
ReginParams ReginParams = getSelectedOrgInfo();
String orgCode = ReginParams.getPersonIdentity().getBizOrgCode();
List<CarIndexVo> carVoList = iCarService.getCarsIotInfo(orgCode);
if (!carVoList.isEmpty()) {
......@@ -1331,7 +1318,7 @@ public class CarController extends AbstractBaseController {
public ResponseModel getTeamCarList(@RequestParam(required = false) Long id,
@RequestParam(required = false) String sequenceNbr,
@RequestParam(required = false) Double longitude, @RequestParam(required = false) Double latitude) {
return CommonResponseUtil.success(iCarService.getTeamCarList(sequenceNbr,id, longitude, latitude));
return CommonResponseUtil.success(iCarService.getTeamCarList(sequenceNbr, id, longitude, latitude));
}
/**
......@@ -1396,7 +1383,7 @@ public class CarController extends AbstractBaseController {
return ResponseHelper.buildResponse(iCarService.getQRCode(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/location", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取二维码图片", notes = "获取二维码图片")
public ResponseModel<Object> location() throws Exception {
......@@ -1404,71 +1391,82 @@ public class CarController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCountOfCar", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取车辆总数", notes = "车辆统计-获取车辆总数")
public Map<String, Integer> getCountOfCar() {
return iCarService.getCountOfCar();
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCountOfCarBelongCompany", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取车辆归属单位总数", notes = "车辆统计-获取车辆归属单位总数")
public ResponseModel<Integer> getCountOfCarBelongCompany() {
return CommonResponseUtil.success(iCarService.getCountOfCarBelongCompany());
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarCategoryInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取车辆分类用途信息", notes = "车辆统计-获取车辆分类用途信息")
public List<ChartIntegerDto> getCarCategoryInfo() {
return iCarService.getCarCategoryInfo();
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarEquipStateInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取设备状态信息", notes = "车辆统计-获取设备状态信息")
public Page<CarEquipStateInfoDto> getCarEquipStateInfo() {
return iCarService.getCarEquipStateInfo();
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarEquipAlarmInfoDto", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取设备告警信息", notes = "车辆统计-获取设备告警信息")
public Page<CarEquipAlarmInfoDto> getCarEquipAlarmInfoDto() {
return iCarService.getCarEquipAlarmInfoDto();
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarBelongAreaInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取车辆归属信息接口", notes = "车辆统计-获取车辆归属信息接口")
public List<ChartIntegerDto> getCarBelongAreaInfo() {
return iCarService.getCarBelongAreaInfo();
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarAreaInfo", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-获取片区车辆归属信息接口", notes = "车辆统计-获取片区车辆归属信息接口")
public Page<CarAreaInfoDto> getCarAreaInfo(@RequestParam String areaName) {
return iCarService.getCarAreaInfo(areaName);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarMileageInfoByMoth", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-按照月份统计车辆里程", notes = "车辆统计-按照月份统计车辆里程")
public BasicTableDataDto getCarMileageInfoByMoth(@RequestParam(required = false) String date,@RequestParam Integer current,@RequestParam Integer size) {
return iCarService.getCarMileageInfoByMoth(date,current,size);
public BasicTableDataDto getCarMileageInfoByMoth(@RequestParam(required = false) String date, @RequestParam Integer current, @RequestParam Integer size) {
return iCarService.getCarMileageInfoByMoth(date, current, size);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/exportCarMileageInfoByMoth", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-按照月份统计导出车辆里程", notes = "车辆统计-按照月份统计导出车辆里程")
public void exportCarMileageInfoByMoth(@RequestParam(required = false) String date, HttpServletResponse response) {
List<CarExportDto> list = this.iCarService.exportCarMileageInfoByMoth(date);
String name = "车辆里程月度统计表-"+date;
FileHelper.exportExcel(list,name,name,CarExportDto.class,UUID.randomUUID().toString()+".xls",response);
if (org.springframework.util.StringUtils.isEmpty(date)) {
date = DateUtil.format(new Date(), "yyyy-MM");
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
String name = "车辆里程月度统计表-" + date;
FileHelper.exportExcel(list, name, name, CarExportDto.class, UUID.randomUUID().toString() + ".xls", response);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarMileageInfoByMothOFDay", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-按照月份统计每天的车辆里程", notes = "车辆统计-按照月份统计每天的车辆里程")
public ZZChartsDto getCarMileageInfoByMothOFDay(@RequestParam String iotCode) {
return iCarService.getCarMileageInfoByMothOFDay(iotCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getCarExcepitonTrack", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "车辆统计-按照日期范围获取异常车辆", notes = "车辆统计-按照日期范围获取异常车辆")
public Page<CarExceptionDto> getCarExcepitonTrack(@RequestParam Integer type) {
......
......@@ -1941,6 +1941,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
carExportDtos.add(carExportDto);
}
}
Collections.sort(carExportDtos,(e1,e2)->Double.valueOf(e2.getTotalTravel()).compareTo(Double.valueOf(e1.getTotalTravel())));
return carExportDtos;
}
......
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