Commit d9de8a57 by 向延琳

Merge branch 'develop' of http://192.168.3.233:8090/eshiled-new/ne-shield-triald…

…rive-admin into develop
2 parents d8da4587 ed0add48
......@@ -41,7 +41,7 @@ public class OpereportController extends AbstractController {
@GetMapping(value = "/vehicle/export")
public R vehicleExport(ReportVehicleSearch search) {
List<ReportVehicleExport> list = opereportService.vehicleExport(search);
String url = super.uploadExcel(list, "车辆列表_" + DateUtils.formatSerial(new Date()), ReportVehicleExport.class);
String url = super.uploadExcel(list, "运营统计报表(车辆维度)_" + DateUtils.formatSerial(new Date()), ReportVehicleExport.class);
return R.ok().data(url);
}
......@@ -56,7 +56,7 @@ public class OpereportController extends AbstractController {
@GetMapping(value = "/device/export")
public R deviceExport(ReportDeviceSearch search) {
List<ReportDeviceExport> list = opereportService.deviceExport(search);
String url = super.uploadExcel(list, "设备列表_" + DateUtils.formatSerial(new Date()), ReportDeviceExport.class);
String url = super.uploadExcel(list, "运营统计报表(设备维度)_" + DateUtils.formatSerial(new Date()), ReportDeviceExport.class);
return R.ok().data(url);
}
......
......@@ -93,18 +93,18 @@ public interface VehicleDeviceMapper extends CommonBaseMapper<VehicleDevice> {
/**
* 根据权限获取该账户下 离线设备
*
* @param offlineTime 离线时间
* @param offlineSnStr 不计算离线的设备集合
* @param search
* @return
*/
@DataPerm(permTable = "tv", showSql = true)
@DataPermShare(linkTable = "t_vehicle", showSql = true)
List<StatActivatedVehicleDevice> getOfflineDeviceWithAuth(@Param("offlineTime") long offlineTime, @Param("offlineSnStr") String offlineSnStr);
List<StatActivatedVehicleDevice> getOfflineDeviceWithAuth(@Param("search") StatSearch search);
VehicleDevice getVehicleDeviceByVehicleAndSn(@Param("vehicleId") Long vehicleId, @Param("sn") String sn, @Param("bindStatus") Integer bindStatus);
VehicleDevice getVehicleDeviceByVehicleAndSn(@Param("vehicleId") Long vehicleId, @Param("sn") String sn, @Param("bindStatus") Integer bindStatus);
/**
* 车辆,设备,工单 公共信息
*
* @param sn 设备号
* @return 车辆,设备,工单 公共信息
*/
......
package cn.com.glsx.admin.modules.model.stat;
import cn.com.glsx.admin.modules.model.param.BasicSearch;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class StatSearch {
public class StatSearch extends BasicSearch {
private String statPattern;
private String statScope;
......@@ -13,4 +14,7 @@ public class StatSearch {
private String statEndScope;
private String appendSql;
private Long offlineTime;
private String offlineSnStr;
}
......@@ -77,7 +77,9 @@ public class HomeService extends AbstractCommonService {
// Integer activeNumForToday = activeStatList.stream().map(StatCountModel::getCnt1).filter(Objects::nonNull).reduce(0, Integer::sum);
//方案二
List<StatActivatedVehicleDevice> activeDeviceList = vehicleDeviceMapper.getActiveDeviceWithAuth(new StatSearch().setStatPattern("%Y-%m-%d"));
StatSearch activeSearch = new StatSearch().setStatPattern("%Y-%m-%d");
injectSettled(activeSearch);
List<StatActivatedVehicleDevice> activeDeviceList = vehicleDeviceMapper.getActiveDeviceWithAuth(activeSearch);
List<StatActivatedVehicleDevice> activeTodayList = activeDeviceList.stream().filter(device -> today.equals(device.getActiveTime())).collect(Collectors.toList());
Set<Long> allBindVehicles = activeDeviceList.stream().map(StatActivatedVehicleDevice::getVehicleId).collect(Collectors.toSet());
......@@ -104,10 +106,12 @@ public class HomeService extends AbstractCommonService {
}
}
//设备离线计算时间
long offlineTime = Constants.OFFLINE_TIME_OTHER;
StatSearch offlineSearch = new StatSearch().setStatPattern("%Y-%m-%d");
injectSettled(offlineSearch);
offlineSearch.setOfflineTime(Constants.OFFLINE_TIME_OTHER);
offlineSearch.setOfflineSnStr(offlineSnWhitelist);
//离线设备
List<StatActivatedVehicleDevice> offlineDeviceList = vehicleDeviceMapper.getOfflineDeviceWithAuth(offlineTime, offlineSnWhitelist);
List<StatActivatedVehicleDevice> offlineDeviceList = vehicleDeviceMapper.getOfflineDeviceWithAuth(offlineSearch);
//设备离线数
Set<Long> allOfflineDevices = offlineDeviceList.stream().map(StatActivatedVehicleDevice::getId).collect(Collectors.toSet());
......
......@@ -115,7 +115,9 @@
<if test="search.appendSql != null and search.appendSql !=''">
${search.appendSql}
</if>
${settleCondition}
<if test="search.settleCondition != null and search.settleCondition !=''">
${search.settleCondition}
</if>
</select>
<select id="getActiveNumberWithAuth" resultType="cn.com.glsx.admin.modules.model.stat.StatCountModel">
......@@ -135,15 +137,17 @@
left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = td.sn
WHERE tvd.del_flag = 0 and tv.del_flag = 0 and tvd.bind_status = 1
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime})
and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{search.offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{search.offlineTime})
or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime})
or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{search.offlineTime})
or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{search.offlineTime} and tdl.last_bs_time is null)
)
<if test="offlineSnStr != null and offlineSnStr != ''">
and tvd.sn not in (${offlineSnStr})
<if test="search.offlineSnStr != null and search.offlineSnStr != ''">
and tvd.sn not in (${search.offlineSnStr})
</if>
<if test="search.settleCondition != null and search.settleCondition != ''">
${search.settleCondition}
</if>
${settleCondition}
</select>
<select id="getVehicleDeviceByVehicleAndSn" resultMap="BaseResultMap">
......@@ -176,6 +180,7 @@
<select id="searchReportDevice" resultType="cn.com.glsx.admin.modules.model.ReportDeviceDTO">
select tvd.id,
tv.id vehicleId,
td.id deviceId,
tv.workorder_id workOrderId,
tw.partner_order_no bizOrderNo,
tvd.sn sns,
......@@ -202,7 +207,8 @@
and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
</if>
<if test="gpsBeginDate != null and gpsBeginDate != '' and gpsEndDate != null and gpsEndDate != ''">
and (DATE_FORMAT(tdl.last_gps_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate} or DATE_FORMAT(tdl.last_bs_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate})
and (DATE_FORMAT(tdl.last_gps_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate} or DATE_FORMAT(tdl.last_bs_time,'%Y-%m-%d') between #{gpsBeginDate} and
#{gpsEndDate})
</if>
<if test="term != null and term !=''">
and(
......@@ -212,12 +218,13 @@
or tw.partner_order_no like '%${term}%'
)
</if>
order by tv.created_date desc, vehicleId, tvd.id
order by tv.created_date desc, deviceId desc
</select>
<select id="exportReportDevice" resultType="cn.com.glsx.admin.modules.model.export.ReportDeviceExport">
select tvd.id,
tv.id vehicleId,
td.id deviceId,
tv.workorder_id workOrderId,
tw.partner_order_no bizOrderNo,
tvd.sn sns,
......@@ -244,7 +251,8 @@
and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
</if>
<if test="gpsBeginDate != null and gpsBeginDate != '' and gpsEndDate != null and gpsEndDate != ''">
and (DATE_FORMAT(tdl.last_gps_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate} or DATE_FORMAT(tdl.last_bs_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate})
and (DATE_FORMAT(tdl.last_gps_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate} or DATE_FORMAT(tdl.last_bs_time,'%Y-%m-%d') between #{gpsBeginDate} and
#{gpsEndDate})
</if>
<if test="term != null and term !=''">
and(
......@@ -254,7 +262,7 @@
or tw.partner_order_no like '%${term}%'
)
</if>
order by tv.created_date desc, vehicleId, tvd.id
order by tv.created_date desc, deviceId desc
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!