优化数据大屏接口

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

View File

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

View File

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