Commit 89c72c4b by 王欣伟

Merge branch 'v1.6.0' of http://192.168.3.233:8090/eshiled-new/ne-shield-trialdr…

…ive-admin into v1.6.0
2 parents 5ba67e2b 180c83d7
...@@ -48,9 +48,10 @@ public enum ResultEnum { ...@@ -48,9 +48,10 @@ public enum ResultEnum {
DEVICE_NOT_EXIST(12110006, "%s 设备未入库,请先入库!"), DEVICE_NOT_EXIST(12110006, "%s 设备未入库,请先入库!"),
/** /**
* 试驾围栏管理相关业务异常错误码,错误信息 1213开头 * 围栏管理相关业务异常错误码,错误信息 1213开头
*/ */
ELECTRIC_FENCE_EXISTED(121330001, "线路名称已存在"), TRIAL_ROUTE_EXISTED(121330001, "线路名称已存在"),
ELECTRIC_FENCE_EXISTED(121330002, "围栏名称已存在"),
/** /**
* 特约店围栏管理相关业务异常错误码,错误信息 1214开头 * 特约店围栏管理相关业务异常错误码,错误信息 1214开头
......
...@@ -56,7 +56,7 @@ public class ElectricFenceController extends AbstractController { ...@@ -56,7 +56,7 @@ public class ElectricFenceController extends AbstractController {
@GetMapping(value = "/export") @GetMapping(value = "/export")
public R export(ElectricFenceSearch search) throws Exception { public R export(ElectricFenceSearch search) throws Exception {
List<ElectricFenceExport> list = electricFenceService.export(search); List<ElectricFenceExport> list = electricFenceService.export(search);
String url = super.uploadExcel(list, "围栏_" + DateUtils.formatSerial(new Date()), ElectricFenceExport.class); String url = super.uploadExcel(list, "电子围栏列表_" + DateUtils.formatSerial(new Date()), ElectricFenceExport.class);
return R.ok().data(url); return R.ok().data(url);
} }
......
...@@ -138,6 +138,7 @@ public class JourneyController { ...@@ -138,6 +138,7 @@ public class JourneyController {
@ApiOperation(value = "导出日里程报表") @ApiOperation(value = "导出日里程报表")
public R<String> journeyDailyExport(JourneyDailySearch journeyDailySearch) { public R<String> journeyDailyExport(JourneyDailySearch journeyDailySearch) {
log.info("journeyDailyExport===start"); log.info("journeyDailyExport===start");
long t1 = System.currentTimeMillis();
String fileName = "通用日里程统计(按日)表" + DateUtil.formatSerial(new Date()); String fileName = "通用日里程统计(按日)表" + DateUtil.formatSerial(new Date());
List<List<String>> headList = new ArrayList<>(); List<List<String>> headList = new ArrayList<>();
...@@ -147,10 +148,15 @@ public class JourneyController { ...@@ -147,10 +148,15 @@ public class JourneyController {
headList.addAll(dateList); headList.addAll(dateList);
// 封装数据 // 封装数据
List<List<String>> dailyStatisticList = journeyService.exportDailyStatistics(journeyDailySearch, dateList); List<List<String>> dailyStatisticList = journeyService.exportDailyStatistics(journeyDailySearch, dateList);
long t2 = System.currentTimeMillis();
log.info("查询数据耗时{}", t2 - t1);
// 将文件写入内存流 然后上传到文件服务器 返回文件服务器的地址给前端 前端执行下载 // 将文件写入内存流 然后上传到文件服务器 返回文件服务器的地址给前端 前端执行下载
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
EasyExcelUtils.writeExcel(outputStream, dailyStatisticList, fileName, headList); EasyExcelUtils.writeExcel(outputStream, dailyStatisticList, fileName, headList);
FileUploadServerData uploadServerData = FileUploadUtil.uploadToFileSystem(fileName, outputStream.toByteArray(), FileConstants.EXCEL_TYPE_XLSX); FileUploadServerData uploadServerData = FileUploadUtil.uploadToFileSystem(fileName, outputStream.toByteArray(), FileConstants.EXCEL_TYPE_XLSX);
long t3 = System.currentTimeMillis();
log.info("总耗时耗时{}", t3 - t1);
return R.ok().data(uploadServerData.getSecureUrl()); return R.ok().data(uploadServerData.getSecureUrl());
} }
......
...@@ -74,7 +74,7 @@ public class RouteFenceController { ...@@ -74,7 +74,7 @@ public class RouteFenceController {
@SysLog(module = MODULE, value = "编辑围栏", action = OperateType.EDIT) @SysLog(module = MODULE, value = "编辑围栏", action = OperateType.EDIT)
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
@ApiOperation(value = "编辑围栏") @ApiOperation(value = "编辑围栏")
public R edit(@RequestBody @Validated(UpdateGroup.class) ElectricFenceBO fenceBO) throws Exception { public R edit(@RequestBody @Validated(UpdateGroup.class) ElectricFenceBO fenceBO) {
fenceBO.setBizFenceType(BizFenceTypeEnum.TRIAL_DRIVE_ROUTE.getCode()); fenceBO.setBizFenceType(BizFenceTypeEnum.TRIAL_DRIVE_ROUTE.getCode());
trialRouteService.editFenceHandler(fenceBO); trialRouteService.editFenceHandler(fenceBO);
return R.ok(); return R.ok();
......
...@@ -34,7 +34,7 @@ public interface ElectricFenceMapper extends CommonBaseMapper<ElectricFence> { ...@@ -34,7 +34,7 @@ public interface ElectricFenceMapper extends CommonBaseMapper<ElectricFence> {
List<ElectricFence> selectByIds(@Param("ids") Collection<Long> ids); List<ElectricFence> selectByIds(@Param("ids") Collection<Long> ids);
List<ElectricFence> selectByUserIds(@Param("userIds") Collection<Long> userIds, Integer bizFenceType); List<ElectricFence> selectByUserIds(@Param("userIds") Collection<Long> userIds, @Param("bizFenceTypes") List<Integer> bizFenceTypes);
List<ElectricFence> selectAllNotDel(); List<ElectricFence> selectAllNotDel();
......
...@@ -16,6 +16,9 @@ public class ElectricFenceExport { ...@@ -16,6 +16,9 @@ public class ElectricFenceExport {
@ExcelProperty(value = "围栏名称", index = 0) @ExcelProperty(value = "围栏名称", index = 0)
private String fenceName; private String fenceName;
@ExcelIgnore
private Integer shapeType;
@ExcelProperty(value = "监控类型", index = 1) @ExcelProperty(value = "监控类型", index = 1)
private String triggerType; private String triggerType;
......
...@@ -120,14 +120,22 @@ public class ElectricFenceService { ...@@ -120,14 +120,22 @@ public class ElectricFenceService {
*/ */
public void checkElectricFence(ElectricFenceBO fenceBO, boolean updateFlag) { public void checkElectricFence(ElectricFenceBO fenceBO, boolean updateFlag) {
if (updateFlag) { if (updateFlag) {
ElectricFence existedFence = electricFenceMapper.selectByFenceNameAndBizType(fenceBO.getFenceName(), BizFenceTypeEnum.ALARM_FENCE.getCode()); ElectricFence existedFence = electricFenceMapper.selectByFenceNameAndBizType(fenceBO.getFenceName(), fenceBO.getBizFenceType());
if (existedFence != null && !fenceBO.getId().equals(existedFence.getId())) { if (existedFence != null && !fenceBO.getId().equals(existedFence.getId())) {
if (BizFenceTypeEnum.ALARM_FENCE.getCode().equals(fenceBO.getBizFenceType())) {
throw new AdminException(ResultEnum.ELECTRIC_FENCE_EXISTED); throw new AdminException(ResultEnum.ELECTRIC_FENCE_EXISTED);
} else {
throw new AdminException(ResultEnum.TRIAL_ROUTE_EXISTED);
}
} }
} else { } else {
ElectricFence existedFence = electricFenceMapper.selectByFenceNameAndBizType(fenceBO.getFenceName(), BizFenceTypeEnum.ALARM_FENCE.getCode()); ElectricFence existedFence = electricFenceMapper.selectByFenceNameAndBizType(fenceBO.getFenceName(), fenceBO.getBizFenceType());
if (existedFence != null) { if (existedFence != null) {
if (BizFenceTypeEnum.ALARM_FENCE.getCode().equals(fenceBO.getBizFenceType())) {
throw new AdminException(ResultEnum.ELECTRIC_FENCE_EXISTED); throw new AdminException(ResultEnum.ELECTRIC_FENCE_EXISTED);
} else {
throw new AdminException(ResultEnum.TRIAL_ROUTE_EXISTED);
}
} }
} }
} }
...@@ -144,11 +152,21 @@ public class ElectricFenceService { ...@@ -144,11 +152,21 @@ public class ElectricFenceService {
BeanUtils.copyProperties(fenceBO, fence); BeanUtils.copyProperties(fenceBO, fence);
//设置定位信息类型为gps类型 默认都是创建gps类型围栏 //设置定位信息类型为gps类型 默认都是创建gps类型围栏
fence.setLocationType(1); fence.setLocationType(1);
fence.setTriggerType(fenceBO.getTriggerType() == null ? 3 : fenceBO.getTriggerType());
// fence.setRecord("操作时间:" + DateUtils.formatNormal(new Date())
// + " 操作人:" + ShieldContextHolder.getAccount() + "(" + ShieldContextHolder.getUserId() + ")"
// + "<br/>");
//围栏形状
if (fenceBO.getShapeType() == ConstantsElectricFence.SHAPE_TYPE_CIRCLE) {
String address = remoteGpsBsService.getAddressByLngAndLat(fenceBO.getLnglat().split(",")[0], fenceBO.getLnglat().split(",")[1]);
fence.setAnalysisAddress(address);
} else if (fenceBO.getShapeType() == ConstantsElectricFence.SHAPE_TYPE_POLYGON) {
//do nothing
} else if (fenceBO.getShapeType() == ConstantsElectricFence.SHAPE_TYPE_ADMINISTRATIVE) {
fence.setAnalysisAddress(fenceBO.getAreaText());
}
fence.setTriggerType(fenceBO.getTriggerType() == null ? 3 : fenceBO.getTriggerType());
fence.setRecord("操作时间:" + DateUtils.formatNormal(new Date())
+ " 操作人:" + ShieldContextHolder.getUsername() + "(" + ShieldContextHolder.getAccount() + ")"
+ "<br/>");
fence.setCreatedBy(ShieldContextHolder.getUserId()); fence.setCreatedBy(ShieldContextHolder.getUserId());
if (fenceBO.getShopId() != null && fenceBO.getShopId() != 0) {//试驾或门店围栏的特约店账号id if (fenceBO.getShopId() != null && fenceBO.getShopId() != 0) {//试驾或门店围栏的特约店账号id
fence.setCreatedBy(fenceBO.getShopId()); fence.setCreatedBy(fenceBO.getShopId());
...@@ -184,16 +202,20 @@ public class ElectricFenceService { ...@@ -184,16 +202,20 @@ public class ElectricFenceService {
//围栏形状类型 1.圆形(默认) 2.矩形 3.多边形 4.行政区域 //围栏形状类型 1.圆形(默认) 2.矩形 3.多边形 4.行政区域
fence.setShapeType(fenceBO.getShapeType()); fence.setShapeType(fenceBO.getShapeType());
fence.setRadius(null); fence.setRadius(null);
fence.setAnalysisAddress(null);
fence.setAreaCode(null); fence.setAreaCode(null);
fence.setAreaText(null); fence.setAreaText(null);
if (fenceBO.getShapeType() == ConstantsElectricFence.SHAPE_TYPE_CIRCLE) { if (fenceBO.getShapeType() == ConstantsElectricFence.SHAPE_TYPE_CIRCLE) {
fence.setRadius(fenceBO.getRadius()); fence.setRadius(fenceBO.getRadius());
String address = remoteGpsBsService.getAddressByLngAndLat(fenceBO.getLnglat().split(",")[0], fenceBO.getLnglat().split(",")[1]);
fence.setAnalysisAddress(address);
} else if (fenceBO.getShapeType() == ConstantsElectricFence.SHAPE_TYPE_POLYGON) { } else if (fenceBO.getShapeType() == ConstantsElectricFence.SHAPE_TYPE_POLYGON) {
//do nothing //do nothing
} else if (fenceBO.getShapeType() == ConstantsElectricFence.SHAPE_TYPE_ADMINISTRATIVE) { } else if (fenceBO.getShapeType() == ConstantsElectricFence.SHAPE_TYPE_ADMINISTRATIVE) {
fence.setAreaCode(fenceBO.getAreaCode()); fence.setAreaCode(fenceBO.getAreaCode());
fence.setAreaText(fence.getAreaText()); fence.setAreaText(fenceBO.getAreaText());
fence.setAnalysisAddress(fenceBO.getAreaText());
} }
} }
//业务围栏类型 12试驾围栏,13特约店围栏,14警情围栏(12,13,14直接和大数据那边类型对应) //业务围栏类型 12试驾围栏,13特约店围栏,14警情围栏(12,13,14直接和大数据那边类型对应)
...@@ -499,7 +521,10 @@ public class ElectricFenceService { ...@@ -499,7 +521,10 @@ public class ElectricFenceService {
if (CollectionUtils.isEmpty(userIds)) { if (CollectionUtils.isEmpty(userIds)) {
return; return;
} }
List<ElectricFence> fenceList = electricFenceMapper.selectByUserIds(userIds, null);
//只同步特约店围栏和试驾线路围栏
List<ElectricFence> fenceList = electricFenceMapper.selectByUserIds(userIds,
Lists.newArrayList(BizFenceTypeEnum.TRIAL_DRIVE_SHOP.getCode(), BizFenceTypeEnum.TRIAL_DRIVE_ROUTE.getCode()));
fenceList.forEach(this::syncFenceSns); fenceList.forEach(this::syncFenceSns);
} }
...@@ -590,7 +615,8 @@ public class ElectricFenceService { ...@@ -590,7 +615,8 @@ public class ElectricFenceService {
public List<SimpleFenceDTO> getBySn(Long fenceId, String sn) { public List<SimpleFenceDTO> getBySn(Long fenceId, String sn) {
ElectricFence routeFence = electricFenceMapper.selectById(fenceId); ElectricFence routeFence = electricFenceMapper.selectById(fenceId);
List<ElectricFence> shopFenceList = electricFenceMapper.selectByUserIds(Lists.newArrayList(routeFence.getCreatedBy()), BizFenceTypeEnum.TRIAL_DRIVE_SHOP.getCode()); List<ElectricFence> shopFenceList = electricFenceMapper.selectByUserIds(Lists.newArrayList(routeFence.getCreatedBy()),
Lists.newArrayList(BizFenceTypeEnum.TRIAL_DRIVE_SHOP.getCode(), BizFenceTypeEnum.TRIAL_DRIVE_ROUTE.getCode()));
List<SimpleFenceDTO> list = Lists.newArrayList(); List<SimpleFenceDTO> list = Lists.newArrayList();
......
...@@ -137,6 +137,7 @@ public class JourneyService { ...@@ -137,6 +137,7 @@ public class JourneyService {
return journeyDetailExportList.stream() return journeyDetailExportList.stream()
.filter(e -> StringUtils.isNotEmpty(e.getJourneyStartTime()) && StringUtils.isNotEmpty(e.getJourneyEndTime())) .filter(e -> StringUtils.isNotEmpty(e.getJourneyStartTime()) && StringUtils.isNotEmpty(e.getJourneyEndTime()))
.peek(e -> e.setDurationStr(DateUtil.getDistanceTimeIgnoreZero(e.getJourneyStartTime(), e.getJourneyEndTime()))) .peek(e -> e.setDurationStr(DateUtil.getDistanceTimeIgnoreZero(e.getJourneyStartTime(), e.getJourneyEndTime())))
.peek(e -> Optional.ofNullable(e.getDistance()).map(distance -> distance / 1000.0).ifPresent(e::setDistance))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
...@@ -175,6 +176,7 @@ public class JourneyService { ...@@ -175,6 +176,7 @@ public class JourneyService {
} }
public List<List<String>> exportDailyStatistics(JourneyDailySearch search, List<List<String>> dateList) { public List<List<String>> exportDailyStatistics(JourneyDailySearch search, List<List<String>> dateList) {
long t1 = System.currentTimeMillis();
List<String> collectDateList = dateList.stream().map(stringList -> stringList.get(0)).collect(Collectors.toList()); List<String> collectDateList = dateList.stream().map(stringList -> stringList.get(0)).collect(Collectors.toList());
List<List<String>> allDataList = Lists.newArrayList(); List<List<String>> allDataList = Lists.newArrayList();
//获取所有有效试驾设备和车架号的集合 //获取所有有效试驾设备和车架号的集合
...@@ -183,26 +185,32 @@ public class JourneyService { ...@@ -183,26 +185,32 @@ public class JourneyService {
userApiService.setCheckedOrgUsers(search); userApiService.setCheckedOrgUsers(search);
} }
List<JourneyDailyExport> journeyDailyExportList = vehicleMapper.findJourneyDailyList(search); List<JourneyDailyExport> journeyDailyExportList = vehicleMapper.findJourneyDailyList(search);
// 查询并封装设备对应的里程日期和里程数 long t2 = System.currentTimeMillis();
List<String> snList = journeyDailyExportList.stream().map(JourneyDailyExport::getSn).collect(Collectors.toList()); log.info("查询设备信息耗时{}", t2 - t1);
Map<String, Map<String, DeviceJourneyDailyDTO>> dailyJourneyRecordsMap = getDailyJourneyRecords(snList, search.getJourneyStartTime(), search.getJourneyEndTime(), collectDateList);
for (JourneyDailyExport journeyDailyExport : journeyDailyExportList) { Map<String, List<JourneyDailyExport>> map = journeyDailyExportList.stream()
.collect(Collectors.groupingBy(JourneyDailyExport::getSn));
for (Map.Entry<String, List<JourneyDailyExport>> journeyEntry : map.entrySet()) {
List<String> oneData = Lists.newArrayList(); List<String> oneData = Lists.newArrayList();
oneData.add(journeyDailyExport.getSn()); List<JourneyDailyExport> list = journeyEntry.getValue();
oneData.add(journeyDailyExport.getVin()); Map<String, Double> dateDataMap = list.stream()
Map<String, DeviceJourneyDailyDTO> journeyDailyMap = dailyJourneyRecordsMap.get(journeyDailyExport.getSn()); .collect(Collectors.toMap(JourneyDailyExport::getJourneyTime, JourneyDailyExport::getJourneyMileage, (o1, o2) -> o2));
String sn = journeyEntry.getKey();
oneData.add(sn);
oneData.add(list.get(0).getVin());
// 按照日期顺序封装每天的数据 // 按照日期顺序封装每天的数据
for (String dateTime : collectDateList) { for (String dateTime : collectDateList) {
if (journeyDailyMap == null || journeyDailyMap.isEmpty() || Objects.isNull(journeyDailyMap.get(dateTime))) {
if (Objects.isNull(dateDataMap.get(dateTime))) {
oneData.add("0.0公里"); oneData.add("0.0公里");
continue; continue;
} }
DeviceJourneyDailyDTO journeyDailyData = journeyDailyMap.get(dateTime); oneData.add(dateDataMap.get(dateTime) / 1000 + "公里");
oneData.add(journeyDailyData.getJourney() + "公里");
} }
allDataList.add(oneData); allDataList.add(oneData);
} }
long t3 = System.currentTimeMillis();
log.info("组装数据耗时{}", t3 - t2);
return allDataList; return allDataList;
} }
...@@ -211,11 +219,16 @@ public class JourneyService { ...@@ -211,11 +219,16 @@ public class JourneyService {
* 组装每天的里程统计数据 * 组装每天的里程统计数据
*/ */
public Map<String, Map<String, DeviceJourneyDailyDTO>> getDailyJourneyRecords(List<String> snList, String journeyStartTime, String journeyEndTime,List<String> collectDateList) { public Map<String, Map<String, DeviceJourneyDailyDTO>> getDailyJourneyRecords(List<String> snList, String journeyStartTime, String journeyEndTime,List<String> collectDateList) {
long t1 = System.currentTimeMillis();
Map<String, Map<String, DeviceJourneyDailyDTO>> result = Maps.newHashMap(); Map<String, Map<String, DeviceJourneyDailyDTO>> result = Maps.newHashMap();
if(CollectionUtils.isEmpty(snList) || CollectionUtils.isEmpty(collectDateList)) { if(CollectionUtils.isEmpty(snList) || CollectionUtils.isEmpty(collectDateList)) {
return result; return result;
} }
List<DeviceJourney> deviceJourneyList = deviceJourneyMapper.listJourneyBySn(snList, journeyStartTime, journeyEndTime); List<DeviceJourney> deviceJourneyList = deviceJourneyMapper.listJourneyBySn(snList, journeyStartTime, journeyEndTime);
log.info("里程数据数量{}", deviceJourneyList.size());
long t2 = System.currentTimeMillis();
log.info("查询里程信息耗时{}", t2 - t1);
if(CollectionUtils.isEmpty(deviceJourneyList)) { if(CollectionUtils.isEmpty(deviceJourneyList)) {
return result; return result;
} }
...@@ -247,6 +260,8 @@ public class JourneyService { ...@@ -247,6 +260,8 @@ public class JourneyService {
} }
result.put(sn, dayMap); result.put(sn, dayMap);
} }
long t3 = System.currentTimeMillis();
log.info("组装里程信息耗时{}", t3 - t2);
return result; return result;
} }
......
...@@ -101,7 +101,7 @@ public class TrialRouteService { ...@@ -101,7 +101,7 @@ public class TrialRouteService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addFenceHandler(ElectricFenceBO fenceBO) { public void addFenceHandler(ElectricFenceBO fenceBO) {
checkElectricFence(fenceBO, false); electricFenceService.checkElectricFence(fenceBO, false);
// 2021/5/24 围栏审核 特约店用户修改才提交 // 2021/5/24 围栏审核 特约店用户修改才提交
List<Long> shopOrgIds = trialDriveShopService.getShopOrgIds(); List<Long> shopOrgIds = trialDriveShopService.getShopOrgIds();
...@@ -130,7 +130,7 @@ public class TrialRouteService { ...@@ -130,7 +130,7 @@ public class TrialRouteService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void editFenceHandler(ElectricFenceBO fenceBO) { public void editFenceHandler(ElectricFenceBO fenceBO) {
checkElectricFence(fenceBO, true); electricFenceService.checkElectricFence(fenceBO, true);
// 2021/5/24 围栏审核 特约店用户修改才提交 // 2021/5/24 围栏审核 特约店用户修改才提交
List<Long> shopOrgIds = trialDriveShopService.getShopOrgIds(); List<Long> shopOrgIds = trialDriveShopService.getShopOrgIds();
...@@ -152,26 +152,6 @@ public class TrialRouteService { ...@@ -152,26 +152,6 @@ public class TrialRouteService {
} }
/** /**
* 校验存在性
*
* @param fenceBO
* @param updateFlag
*/
public void checkElectricFence(ElectricFenceBO fenceBO, boolean updateFlag) {
if (updateFlag) {
ElectricFence existedFence = electricFenceMapper.selectByFenceNameAndBizType(fenceBO.getFenceName(), BizFenceTypeEnum.TRIAL_DRIVE_ROUTE.getCode());
if (existedFence != null && !fenceBO.getId().equals(existedFence.getId())) {
throw new AdminException(ResultEnum.ELECTRIC_FENCE_EXISTED);
}
} else {
ElectricFence existedFence = electricFenceMapper.selectByFenceNameAndBizType(fenceBO.getFenceName(), BizFenceTypeEnum.TRIAL_DRIVE_ROUTE.getCode());
if (existedFence != null) {
throw new AdminException(ResultEnum.ELECTRIC_FENCE_EXISTED);
}
}
}
/**
* 审批回调处理 * 审批回调处理
* *
* @param approvalData * @param approvalData
......
...@@ -1279,7 +1279,9 @@ public class VehicleService extends AbstractCommonService { ...@@ -1279,7 +1279,9 @@ public class VehicleService extends AbstractCommonService {
setVehicleType(vehicle); setVehicleType(vehicle);
String userId = vehicleInfoVo.getOrganizationId().replaceAll("u", ""); String userId = vehicleInfoVo.getOrganizationId().replaceAll("u", "");
vehicle.setCreatedBy(Long.parseLong(userId)); Long orgUserId = Long.parseLong(userId);
vehicle.setCreatedBy(orgUserId);
vehicle.setUpdatedDate(new Date()); vehicle.setUpdatedDate(new Date());
// 设置操作用户为修改人 // 设置操作用户为修改人
vehicle.setUpdatedBy(ShieldContextHolder.getUserId()); vehicle.setUpdatedBy(ShieldContextHolder.getUserId());
...@@ -1322,7 +1324,6 @@ public class VehicleService extends AbstractCommonService { ...@@ -1322,7 +1324,6 @@ public class VehicleService extends AbstractCommonService {
// 如果所属组织发生改变 同步修改同步围栏数据到大数据 // 如果所属组织发生改变 同步修改同步围栏数据到大数据
Boolean sourceFence = false; Boolean sourceFence = false;
Boolean targerFence = false; Boolean targerFence = false;
Long orgUserId = Long.parseLong(userId);
if (dbVehicle.getCreatedBy() == null || !Objects.equals(dbVehicle.getCreatedBy(), orgUserId)) { if (dbVehicle.getCreatedBy() == null || !Objects.equals(dbVehicle.getCreatedBy(), orgUserId)) {
if (dbVehicle.getCreatedBy() != null) { if (dbVehicle.getCreatedBy() != null) {
sourceFence = true; sourceFence = true;
......
...@@ -43,12 +43,13 @@ ...@@ -43,12 +43,13 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from t_device_journey from t_device_journey
<where> <where>
and vd_id is not null
and sn in and sn in
<foreach collection="snList" item="sn" index="index" open="(" close=")" separator=","> <foreach collection="snList" item="sn" index="index" open="(" close=")" separator=",">
#{sn} #{sn}
</foreach> </foreach>
and begin_time <![CDATA[ >= ]]> #{journeyStartTime} and begin_time <![CDATA[ >= ]]> #{journeyStartTime}
and end_time <![CDATA[ <= ]]> #{journeyEndTime} and begin_time <![CDATA[ <= ]]> #{journeyEndTime}
</where> </where>
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
...@@ -104,8 +104,10 @@ ...@@ -104,8 +104,10 @@
<select id="export" resultType="cn.com.glsx.admin.modules.model.export.ElectricFenceExport"> <select id="export" resultType="cn.com.glsx.admin.modules.model.export.ElectricFenceExport">
select tef.id, select tef.id,
tef.fence_name fenceName, tef.fence_name fenceName,
tef.shape_type shapeType,
tef.trigger_type triggerType, tef.trigger_type triggerType,
concat(date_format(tef.start_time,'%Y-%m-%d'),'----',date_format(tef.end_time,'%Y-%m-%d')) monitorTime, concat(date_format(tef.start_time,'%Y-%m-%d'),'----',date_format(tef.end_time,'%Y-%m-%d')) monitorTime,
tef.analysis_address monitorArea,
count(tefs.sn) linkDeviceCnt, count(tefs.sn) linkDeviceCnt,
(select count(DISTINCT sn) from t_alarm_electric_fence f1 where f1.fence_id = tef.id) as alarmDeviceCnt, (select count(DISTINCT sn) from t_alarm_electric_fence f1 where f1.fence_id = tef.id) as alarmDeviceCnt,
(select count(sn) from t_alarm_electric_fence f1 where f1.fence_id = tef.id) as alarmCnt, (select count(sn) from t_alarm_electric_fence f1 where f1.fence_id = tef.id) as alarmCnt,
...@@ -180,9 +182,10 @@ ...@@ -180,9 +182,10 @@
<foreach collection="userIds" separator="," open="(" close=")" item="item"> <foreach collection="userIds" separator="," open="(" close=")" item="item">
#{item} #{item}
</foreach> </foreach>
<if test="bizFenceType != null"> and biz_fence_type in
and biz_fence_type = #{bizFenceType} <foreach collection="bizFenceTypes" separator="," open="(" close=")" item="item">
</if> #{item}
</foreach>
</select> </select>
<select id="selectByFenceNameAndBizType" resultMap="BaseResultMap"> <select id="selectByFenceNameAndBizType" resultMap="BaseResultMap">
......
...@@ -1103,13 +1103,15 @@ ...@@ -1103,13 +1103,15 @@
</select> </select>
<select id="findJourneyDailyList" resultType="cn.com.glsx.admin.modules.model.export.JourneyDailyExport"> <select id="findJourneyDailyList" resultType="cn.com.glsx.admin.modules.model.export.JourneyDailyExport">
select select tvd.sn as sn,
tvd.sn as sn, tv.vin as vin,
tv.vin as vin ifnull(sum(tdj.mileage), 0) as journeyMileage,
date_format(tdj.begin_time, '%Y-%m-%d') as journeyTime
from t_vehicle tv from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_device td on td.sn = tvd.sn left join t_device td on td.sn = tvd.sn
left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0 left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
left join t_device_journey tdj on tvd.id = tdj.vd_id and tdj.begin_time <![CDATA[ >= ]]> #{journeyStartTime} and tdj.begin_time <![CDATA[ <= ]]> #{journeyEndTime}
where tv.del_flag = 0 where tv.del_flag = 0
and tvd.bind_status = 1 and tvd.bind_status = 1
and tvd.del_flag = 0 and tvd.del_flag = 0
...@@ -1125,7 +1127,7 @@ ...@@ -1125,7 +1127,7 @@
or tvd.sn like '%${keywords}%' or tvd.sn like '%${keywords}%'
) )
</if> </if>
order by tvd.id desc group by tvd.sn, date_format(tdj.begin_time, '%Y-%m-%d');
</select> </select>
<select id="getOffLineAlarmCount" resultType="cn.com.glsx.admin.modules.model.stat.StatCountModel"> <select id="getOffLineAlarmCount" resultType="cn.com.glsx.admin.modules.model.stat.StatCountModel">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!