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 { ...@@ -41,7 +41,7 @@ public class OpereportController extends AbstractController {
@GetMapping(value = "/vehicle/export") @GetMapping(value = "/vehicle/export")
public R vehicleExport(ReportVehicleSearch search) { public R vehicleExport(ReportVehicleSearch search) {
List<ReportVehicleExport> list = opereportService.vehicleExport(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); return R.ok().data(url);
} }
...@@ -56,7 +56,7 @@ public class OpereportController extends AbstractController { ...@@ -56,7 +56,7 @@ public class OpereportController extends AbstractController {
@GetMapping(value = "/device/export") @GetMapping(value = "/device/export")
public R deviceExport(ReportDeviceSearch search) { public R deviceExport(ReportDeviceSearch search) {
List<ReportDeviceExport> list = opereportService.deviceExport(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); return R.ok().data(url);
} }
......
...@@ -93,18 +93,18 @@ public interface VehicleDeviceMapper extends CommonBaseMapper<VehicleDevice> { ...@@ -93,18 +93,18 @@ public interface VehicleDeviceMapper extends CommonBaseMapper<VehicleDevice> {
/** /**
* 根据权限获取该账户下 离线设备 * 根据权限获取该账户下 离线设备
* *
* @param offlineTime 离线时间 * @param search
* @param offlineSnStr 不计算离线的设备集合
* @return * @return
*/ */
@DataPerm(permTable = "tv", showSql = true) @DataPerm(permTable = "tv", showSql = true)
@DataPermShare(linkTable = "t_vehicle", 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 设备号 * @param sn 设备号
* @return 车辆,设备,工单 公共信息 * @return 车辆,设备,工单 公共信息
*/ */
......
package cn.com.glsx.admin.modules.model.stat; package cn.com.glsx.admin.modules.model.stat;
import cn.com.glsx.admin.modules.model.param.BasicSearch;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
public class StatSearch { public class StatSearch extends BasicSearch {
private String statPattern; private String statPattern;
private String statScope; private String statScope;
...@@ -13,4 +14,7 @@ public class StatSearch { ...@@ -13,4 +14,7 @@ public class StatSearch {
private String statEndScope; private String statEndScope;
private String appendSql; private String appendSql;
private Long offlineTime;
private String offlineSnStr;
} }
...@@ -77,7 +77,9 @@ public class HomeService extends AbstractCommonService { ...@@ -77,7 +77,9 @@ public class HomeService extends AbstractCommonService {
// Integer activeNumForToday = activeStatList.stream().map(StatCountModel::getCnt1).filter(Objects::nonNull).reduce(0, Integer::sum); // 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()); 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()); Set<Long> allBindVehicles = activeDeviceList.stream().map(StatActivatedVehicleDevice::getVehicleId).collect(Collectors.toSet());
...@@ -104,10 +106,12 @@ public class HomeService extends AbstractCommonService { ...@@ -104,10 +106,12 @@ public class HomeService extends AbstractCommonService {
} }
} }
//设备离线计算时间 StatSearch offlineSearch = new StatSearch().setStatPattern("%Y-%m-%d");
long offlineTime = Constants.OFFLINE_TIME_OTHER; 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()); Set<Long> allOfflineDevices = offlineDeviceList.stream().map(StatActivatedVehicleDevice::getId).collect(Collectors.toSet());
......
...@@ -115,7 +115,9 @@ ...@@ -115,7 +115,9 @@
<if test="search.appendSql != null and search.appendSql !=''"> <if test="search.appendSql != null and search.appendSql !=''">
${search.appendSql} ${search.appendSql}
</if> </if>
${settleCondition} <if test="search.settleCondition != null and search.settleCondition !=''">
${search.settleCondition}
</if>
</select> </select>
<select id="getActiveNumberWithAuth" resultType="cn.com.glsx.admin.modules.model.stat.StatCountModel"> <select id="getActiveNumberWithAuth" resultType="cn.com.glsx.admin.modules.model.stat.StatCountModel">
...@@ -135,15 +137,17 @@ ...@@ -135,15 +137,17 @@
left join t_device td on td.sn = tvd.sn left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = td.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 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 tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime}) 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; #{offlineTime} and tdl.last_bs_time is null) or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{search.offlineTime} and tdl.last_bs_time is null)
) )
<if test="offlineSnStr != null and offlineSnStr != ''"> <if test="search.offlineSnStr != null and search.offlineSnStr != ''">
and tvd.sn not in (${offlineSnStr}) and tvd.sn not in (${search.offlineSnStr})
</if>
<if test="search.settleCondition != null and search.settleCondition != ''">
${search.settleCondition}
</if> </if>
${settleCondition}
</select> </select>
<select id="getVehicleDeviceByVehicleAndSn" resultMap="BaseResultMap"> <select id="getVehicleDeviceByVehicleAndSn" resultMap="BaseResultMap">
...@@ -176,6 +180,7 @@ ...@@ -176,6 +180,7 @@
<select id="searchReportDevice" resultType="cn.com.glsx.admin.modules.model.ReportDeviceDTO"> <select id="searchReportDevice" resultType="cn.com.glsx.admin.modules.model.ReportDeviceDTO">
select tvd.id, select tvd.id,
tv.id vehicleId, tv.id vehicleId,
td.id deviceId,
tv.workorder_id workOrderId, tv.workorder_id workOrderId,
tw.partner_order_no bizOrderNo, tw.partner_order_no bizOrderNo,
tvd.sn sns, tvd.sn sns,
...@@ -202,7 +207,8 @@ ...@@ -202,7 +207,8 @@
and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate} and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
</if> </if>
<if test="gpsBeginDate != null and gpsBeginDate != '' and gpsEndDate != null and gpsEndDate != ''"> <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>
<if test="term != null and term !=''"> <if test="term != null and term !=''">
and( and(
...@@ -212,12 +218,13 @@ ...@@ -212,12 +218,13 @@
or tw.partner_order_no like '%${term}%' or tw.partner_order_no like '%${term}%'
) )
</if> </if>
order by tv.created_date desc, vehicleId, tvd.id order by tv.created_date desc, deviceId desc
</select> </select>
<select id="exportReportDevice" resultType="cn.com.glsx.admin.modules.model.export.ReportDeviceExport"> <select id="exportReportDevice" resultType="cn.com.glsx.admin.modules.model.export.ReportDeviceExport">
select tvd.id, select tvd.id,
tv.id vehicleId, tv.id vehicleId,
td.id deviceId,
tv.workorder_id workOrderId, tv.workorder_id workOrderId,
tw.partner_order_no bizOrderNo, tw.partner_order_no bizOrderNo,
tvd.sn sns, tvd.sn sns,
...@@ -244,7 +251,8 @@ ...@@ -244,7 +251,8 @@
and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate} and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
</if> </if>
<if test="gpsBeginDate != null and gpsBeginDate != '' and gpsEndDate != null and gpsEndDate != ''"> <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>
<if test="term != null and term !=''"> <if test="term != null and term !=''">
and( and(
...@@ -254,7 +262,7 @@ ...@@ -254,7 +262,7 @@
or tw.partner_order_no like '%${term}%' or tw.partner_order_no like '%${term}%'
) )
</if> </if>
order by tv.created_date desc, vehicleId, tvd.id order by tv.created_date desc, deviceId desc
</select> </select>
</mapper> </mapper>
\ No newline at end of file \ 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!