优化数据大屏接口

This commit is contained in:
yuyang 2022-05-18 10:50:21 +08:00
parent fc9cfe0a5a
commit de256ebf77
3 changed files with 222 additions and 207 deletions

View File

@ -118,161 +118,175 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
String tenantIdsStr = null;
List<Map<String, Object>> xhpcChargingStationList = null;
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
List<Long> chargingStationIdList = xhpcChargingStationMapper.selectChargingStationIds(tenantIdsStr);
//0 C端用户 1 流量方用户 2社区用户 3B端用户
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
return R.ok(appUserCount + communityUserCount + customerUserCount);
//judge care param function
switch (coreParam.getParamType()) {
case 0:
tenantIdsStr = coreParam.getTenantIds();
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
//get user count of c client
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
List<Long> chargingStationIdList = xhpcChargingStationMapper.selectChargingStationIds(tenantIdsStr);
//0 C端用户 1 流量方用户 2社区用户 3B端用户
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
return R.ok(appUserCount + communityUserCount + customerUserCount);
} else {
//get user count of c client
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
List<Long> chargingStationIdList = xhpcChargingStationMapper.selectChargingStationIds(tenantIdsStr);
//0 C端用户 1 流量方用户 2社区用户 3B端用户
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
return R.ok(appUserCount + communityUserCount + customerUserCount);
}
//query charging station infos of whole area
case 1:
Integer areaCode = coreParam.getAreaCode();
tenantIdsStr = coreParam.getTenantIds();
int number =0;
if(areaCode !=null){
number = xhpcChargingStationMapper.getXhpcAreaLevel(areaCode);
}
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
ArrayList<Long> chargingStationIdList = new ArrayList<>();
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
}
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
return R.ok(appUserCount + communityUserCount + customerUserCount);
} else {
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
ArrayList<Long> chargingStationIdList = new ArrayList<>();
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
}
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
return R.ok(appUserCount + communityUserCount + customerUserCount);
}
case 2:
//query location info of special charging station of special tenant
tenantIdsStr = coreParam.getTenantIds();
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
String chargingStationIdStr = coreParam.getChargingStationIds();
long chargingStationId = Long.parseLong(chargingStationIdStr);
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdsStr, chargingStationId);
ArrayList<Long> chargingStationIdList = new ArrayList<>();
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
}
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
return R.ok(appUserCount + communityUserCount + customerUserCount);
} else {
return R.fail("传入的参数有误");
}
default:
R.fail("param type is invalid");
break;
}
return null;
// switch (coreParam.getParamType()) {
// case 0:
// tenantIdsStr = coreParam.getTenantIds();
// if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
// //get user count of c client
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
// List<Long> chargingStationIdList = xhpcChargingStationMapper.selectChargingStationIds(tenantIdsStr);
// //0 C端用户 1 流量方用户 2社区用户 3B端用户
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// } else {
// //get user count of c client
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
// List<Long> chargingStationIdList = xhpcChargingStationMapper.selectChargingStationIds(tenantIdsStr);
// //0 C端用户 1 流量方用户 2社区用户 3B端用户
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// }
// //query charging station infos of whole area
// case 1:
// Integer areaCode = coreParam.getAreaCode();
// tenantIdsStr = coreParam.getTenantIds();
// int number =0;
// if(areaCode !=null){
// number = xhpcChargingStationMapper.getXhpcAreaLevel(areaCode);
// }
// if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
// xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
// ArrayList<Long> chargingStationIdList = new ArrayList<>();
// for (Map<String, Object> chargingStation : xhpcChargingStationList) {
// chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
// }
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// } else {
// xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
// ArrayList<Long> chargingStationIdList = new ArrayList<>();
// for (Map<String, Object> chargingStation : xhpcChargingStationList) {
// chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
// }
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// }
// case 2:
// //query location info of special charging station of special tenant
// tenantIdsStr = coreParam.getTenantIds();
// if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
// String chargingStationIdStr = coreParam.getChargingStationIds();
// long chargingStationId = Long.parseLong(chargingStationIdStr);
// xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdsStr, chargingStationId);
// ArrayList<Long> chargingStationIdList = new ArrayList<>();
// for (Map<String, Object> chargingStation : xhpcChargingStationList) {
// chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
// }
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// } else {
// return R.fail("传入的参数有误");
// }
// default:
// R.fail("param type is invalid");
// break;
// }
// return null;
}
@Override
public R<Object> queryUserActivation(CoreParam coreParam) {
String tenantIdsStr = null;
List<Map<String, Object>> xhpcChargingStationList = null;
String currentTime = MyDateUtil.getCurrentDateStrInYyyyMmDdHhMmSsFormat();
//tenantIdsStr = coreParam.getTenantIds();
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, currentTime);
List<Long> chargingStationIdList = new ArrayList<>();
//0 C端用户 1 流量方用户 2社区用户 3B端用户
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, currentTime);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, currentTime);
return R.ok(appUserCount + communityUserCount + customerUserCount);
//judge care param function
switch (coreParam.getParamType()) {
case 0:
tenantIdsStr = coreParam.getTenantIds();
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
//get user count of c client
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, currentTime);
List<Long> chargingStationIdList = xhpcChargingStationMapper.selectChargingStationIds(tenantIdsStr);
//0 C端用户 1 流量方用户 2社区用户 3B端用户
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, currentTime);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, currentTime);
return R.ok(appUserCount + communityUserCount + customerUserCount);
} else {
//get user count of c client
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, currentTime);
List<Long> chargingStationIdList = xhpcChargingStationMapper.selectChargingStationIds(tenantIdsStr);
//0 C端用户 1 流量方用户 2社区用户 3B端用户
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, currentTime);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, currentTime);
return R.ok(appUserCount + communityUserCount + customerUserCount);
}
//query charging station infos of whole area
case 1:
Integer areaCode = coreParam.getAreaCode();
tenantIdsStr = coreParam.getTenantIds();
int number =0;
if(areaCode !=null){
number = xhpcChargingStationMapper.getXhpcAreaLevel(areaCode);
}
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
ArrayList<Long> chargingStationIdList = new ArrayList<>();
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
}
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
return R.ok(appUserCount + communityUserCount + customerUserCount);
} else {
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
ArrayList<Long> chargingStationIdList = new ArrayList<>();
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
}
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
return R.ok(appUserCount + communityUserCount + customerUserCount);
}
case 2:
//query location info of special charging station of special tenant
tenantIdsStr = coreParam.getTenantIds();
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
String chargingStationIdStr = coreParam.getChargingStationIds();
long chargingStationId = Long.parseLong(chargingStationIdStr);
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdsStr, chargingStationId);
ArrayList<Long> chargingStationIdList = new ArrayList<>();
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
}
Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
return R.ok(appUserCount + communityUserCount + customerUserCount);
} else {
return R.fail("传入的参数有误");
}
default:
R.fail("param type is invalid");
break;
}
return null;
// switch (coreParam.getParamType()) {
// case 0:
// tenantIdsStr = coreParam.getTenantIds();
// if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
// //get user count of c client
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, currentTime);
// List<Long> chargingStationIdList = xhpcChargingStationMapper.selectChargingStationIds(tenantIdsStr);
// //0 C端用户 1 流量方用户 2社区用户 3B端用户
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, currentTime);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, currentTime);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// } else {
// //get user count of c client
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, currentTime);
// List<Long> chargingStationIdList = xhpcChargingStationMapper.selectChargingStationIds(tenantIdsStr);
// //0 C端用户 1 流量方用户 2社区用户 3B端用户
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, currentTime);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, currentTime);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// }
// //query charging station infos of whole area
// case 1:
// Integer areaCode = coreParam.getAreaCode();
// tenantIdsStr = coreParam.getTenantIds();
// int number =0;
// if(areaCode !=null){
// number = xhpcChargingStationMapper.getXhpcAreaLevel(areaCode);
// }
// if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
// xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
// ArrayList<Long> chargingStationIdList = new ArrayList<>();
// for (Map<String, Object> chargingStation : xhpcChargingStationList) {
// chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
// }
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// } else {
// xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
// ArrayList<Long> chargingStationIdList = new ArrayList<>();
// for (Map<String, Object> chargingStation : xhpcChargingStationList) {
// chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
// }
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// }
// case 2:
// //query location info of special charging station of special tenant
// tenantIdsStr = coreParam.getTenantIds();
// if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
// String chargingStationIdStr = coreParam.getChargingStationIds();
// long chargingStationId = Long.parseLong(chargingStationIdStr);
// xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdsStr, chargingStationId);
// ArrayList<Long> chargingStationIdList = new ArrayList<>();
// for (Map<String, Object> chargingStation : xhpcChargingStationList) {
// chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
// }
// Long appUserCount = xhpcAppUserMapper.selectTotalCountByTenantIdAndCurrentTime(tenantIdsStr, null);
// Long communityUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.COMMUNIT_TYPE, null);
// Long customerUserCount = xhpcHistoryOrderMapper.selectUserTotalCountByTenantIdsAndChargingStationIdsAndUserTypeAndCurrentTime(tenantIdsStr, chargingStationIdList, UserTypeUtil.CUSTOMERS_TYPE, null);
// return R.ok(appUserCount + communityUserCount + customerUserCount);
// } else {
// return R.fail("传入的参数有误");
// }
// default:
// R.fail("param type is invalid");
// break;
// }
// return null;
}
@Override
@ -622,52 +636,53 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
public R queryWorkOrder(CoreParam coreParam) {
String tenantIdsStr = null;
List<Map<String, Object>> xhpcChargingStationList = null;
return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(null,null));
//judge care param function
switch (coreParam.getParamType()) {
case 0:
tenantIdsStr = coreParam.getTenantIds();
return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(null,tenantIdsStr));
//query charging station infos of whole area
case 1:
Integer areaCode = coreParam.getAreaCode();
tenantIdsStr = coreParam.getTenantIds();
int number =0;
if(areaCode !=null){
number = xhpcChargingStationMapper.getXhpcAreaLevel(areaCode);
}
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
ArrayList<Long> chargingStationIdList = new ArrayList<>();
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
}
return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(chargingStationIdList,tenantIdsStr));
} else {
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
ArrayList<Long> chargingStationIdList = new ArrayList<>();
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
}
return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(chargingStationIdList,tenantIdsStr));
}
case 2:
//query location info of special charging station of special tenant
tenantIdsStr = coreParam.getTenantIds();
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
String chargingStationIdStr = coreParam.getChargingStationIds();
long chargingStationId = Long.parseLong(chargingStationIdStr);
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdsStr, chargingStationId);
ArrayList<Long> chargingStationIdList = new ArrayList<>();
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
}
return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(chargingStationIdList,tenantIdsStr));
} else {
return R.fail("传入的参数有误");
}
default:
return R.fail("param type is invalid");
}
// switch (coreParam.getParamType()) {
// case 0:
// tenantIdsStr = coreParam.getTenantIds();
// return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(null,tenantIdsStr));
// //query charging station infos of whole area
// case 1:
// Integer areaCode = coreParam.getAreaCode();
// tenantIdsStr = coreParam.getTenantIds();
// int number =0;
// if(areaCode !=null){
// number = xhpcChargingStationMapper.getXhpcAreaLevel(areaCode);
// }
// if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
// xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
// ArrayList<Long> chargingStationIdList = new ArrayList<>();
// for (Map<String, Object> chargingStation : xhpcChargingStationList) {
// chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
// }
// return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(chargingStationIdList,tenantIdsStr));
// } else {
// xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdsStr, areaCode,number);
// ArrayList<Long> chargingStationIdList = new ArrayList<>();
// for (Map<String, Object> chargingStation : xhpcChargingStationList) {
// chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
// }
// return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(chargingStationIdList,tenantIdsStr));
// }
// case 2:
// //query location info of special charging station of special tenant
// tenantIdsStr = coreParam.getTenantIds();
// if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
// String chargingStationIdStr = coreParam.getChargingStationIds();
// long chargingStationId = Long.parseLong(chargingStationIdStr);
// xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdsStr, chargingStationId);
// ArrayList<Long> chargingStationIdList = new ArrayList<>();
// for (Map<String, Object> chargingStation : xhpcChargingStationList) {
// chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
// }
// return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(chargingStationIdList,tenantIdsStr));
// } else {
// return R.fail("传入的参数有误");
// }
// default:
// return R.fail("param type is invalid");
// }
}
private R<OrderTrend> getOrderTrend(String tenantIdsStr, ArrayList<Long> chargingStationIdList) {

View File

@ -82,10 +82,10 @@
</if>
<if test="areaCode== null">
<if test="number ==1">
AND area_code in (select code from xhpc_area where pcode in(select code from xhpc_area where pcode =xa.code))
AND area_code in (select code from xhpc_area_pc where pcode in(select code from xhpc_area_pc where pcode =xa.code))
</if>
<if test="number ==2">
AND area_code in (select code from xhpc_area where pcode =xa.code)
AND area_code in (select code from xhpc_area_pc where pcode =xa.code)
</if>
<if test="number ==3">
AND area_code =xa.code
@ -93,45 +93,45 @@
</if>
<if test="areaCode != null">
<if test="number ==1">
AND area_code in (select code from xhpc_area where pcode in(select code from xhpc_area where pcode =xa.code))
AND area_code in (select code from xhpc_area_pc where pcode in(select code from xhpc_area_pc where pcode =xa.code))
</if>
<if test="number ==2">
AND area_code in (select code from xhpc_area where pcode =xa.code)
AND area_code in (select code from xhpc_area_pc where pcode =xa.code)
</if>
<if test="number ==3">
AND area_code =xa.code
</if>
</if>) value
FROM
xhpc_area as xa
xhpc_area_pc as xa
WHERE 1=1
<if test="areaCode != null">
and xa.level =#{number}
<if test="number ==1">
and (SELECT count(charging_station_id) FROM xhpc_charging_station
WHERE del_flag = 0
AND area_code in (select code from xhpc_area where pcode in(select code from xhpc_area where pcode =xa.code)))>0
AND area_code in (select code from xhpc_area_pc where pcode in(select code from xhpc_area_pc where pcode =xa.code)))>0
</if>
<if test="number ==2">
and (SELECT count(charging_station_id) FROM xhpc_charging_station
WHERE del_flag = 0
AND area_code in (select code from xhpc_area where pcode =xa.code))>0
AND (xa.code in (select code from xhpc_area where pcode in(select code from xhpc_area where pcode =#{areaCode}))
or xa.code in (select code from xhpc_area where pcode =#{areaCode})
AND area_code in (select code from xhpc_area_pc where pcode =xa.code))>0
AND (xa.code in (select code from xhpc_area_pc where pcode in(select code from xhpc_area_pc where pcode =#{areaCode}))
or xa.code in (select code from xhpc_area_pc where pcode =#{areaCode})
)
</if>
<if test="number ==3">
and (SELECT count(charging_station_id) FROM xhpc_charging_station
WHERE del_flag = 0
AND area_code =xa.code )>0
and xa.code in (select code from xhpc_area where pcode =#{areaCode})
and xa.code in (select code from xhpc_area_pc where pcode =#{areaCode})
</if>
</if>
<if test="areaCode==null">
and xa.level =1
and (SELECT count(charging_station_id) FROM xhpc_charging_station
WHERE del_flag = 0
AND area_code in (select code from xhpc_area where pcode in(select code from xhpc_area where pcode =xa.code)))>0
AND area_code in (select code from xhpc_area_pc where pcode in(select code from xhpc_area_pc where pcode =xa.code)))>0
</if>
</select>
@ -152,10 +152,10 @@
</if>
<if test="areaCode != null and areaCode != '' ">
<if test="number !=0 and number ==1">
AND area_code in (select code from xhpc_area where pcode in(select code from xhpc_area where pcode =#{areaCode}))
AND area_code in (select code from xhpc_area_pc where pcode in(select code from xhpc_area_pc where pcode =#{areaCode}))
</if>
<if test="number !=0 and number ==2">
AND area_code in (select code from xhpc_area where pcode =#{areaCode})
AND area_code in (select code from xhpc_area_pc where pcode =#{areaCode})
</if>
<if test="number !=0 and number ==3">
AND area_code =#{areaCode}
@ -164,7 +164,7 @@
</select>
<select id="getXhpcAreaLevel" resultType="int">
select level from xhpc_area where code =#{areaCode}
select level from xhpc_area_pc where code =#{areaCode}
</select>

View File

@ -129,7 +129,7 @@
FROM
xhpc_history_order
WHERE
del_flag = 0 and charging_mode is not null
del_flag = 0
<if test="tenantIdsStr!=null and tenantIdsStr!='' ">
and find_in_set(tenant_id, #{tenantIdsStr})
</if>
@ -174,7 +174,7 @@
FROM
mysql.help_topic t
WHERE
t.help_topic_id <![CDATA[<=]]> 31
t.help_topic_id <![CDATA[<=]]> 15
) a
LEFT JOIN (
SELECT
@ -193,7 +193,7 @@
#{chargingStationId}
</foreach>
</if>
AND end_time <![CDATA[>=]]> DATE_ADD( now(), INTERVAL - 31 DAY )
AND end_time <![CDATA[>=]]> DATE_ADD( now(), INTERVAL - 15 DAY )
GROUP BY
DATE_FORMAT( end_time, "%Y-%m-%d" )) b ON a.`current_time` = b.end_time
ORDER BY