修改机构折扣,增加数据大屏枪使用率和工单
This commit is contained in:
parent
b0cfc2104c
commit
22ec3d921e
@ -3,6 +3,7 @@ package com.xhpc.common.api;
|
|||||||
import com.xhpc.common.api.factory.UserTypeFallbackFactory;
|
import com.xhpc.common.api.factory.UserTypeFallbackFactory;
|
||||||
import com.xhpc.common.core.constant.ServiceNameConstants;
|
import com.xhpc.common.core.constant.ServiceNameConstants;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@ -47,7 +48,7 @@ public interface UserTypeService {
|
|||||||
* 获取该机构的折扣比例
|
* 获取该机构的折扣比例
|
||||||
*/
|
*/
|
||||||
@GetMapping("/common/getMechanismDiscount")
|
@GetMapping("/common/getMechanismDiscount")
|
||||||
R getMechanismDiscount(@RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId);
|
R getMechanismDiscount(@RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId, @Param("chargingStationId")Long chargingStationId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.xhpc.common.api.factory;
|
|||||||
|
|
||||||
import com.xhpc.common.api.UserTypeService;
|
import com.xhpc.common.api.UserTypeService;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||||
@ -32,7 +33,7 @@ public class UserTypeFallbackFactory implements FallbackFactory<UserTypeService>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R getMechanismDiscount(Long userId, Integer userType, String tenantId) {
|
public R getMechanismDiscount(Long userId, Integer userType, String tenantId, @Param("chargingStationId")Long chargingStationId) {
|
||||||
return R.fail("机构信息获取失败:" + cause.getMessage());
|
return R.fail("机构信息获取失败:" + cause.getMessage());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -29,15 +29,19 @@ public class XhpcDataBigScreenController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
XhpcDataBigScreenService xhpcDataBigScreenService;
|
XhpcDataBigScreenService xhpcDataBigScreenService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单趋势
|
||||||
|
* @param coreParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@GetMapping("/orders-trend")
|
@GetMapping("/orders-trend")
|
||||||
public R<OrderTrend> queryOrdersTrend(CoreParam coreParam) {
|
public R<OrderTrend> queryOrdersTrend(CoreParam coreParam) {
|
||||||
|
|
||||||
return xhpcDataBigScreenService.queryOrderTrend(coreParam);
|
return xhpcDataBigScreenService.queryOrderTrend(coreParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* query realtime orders by coreParam
|
* query realtime orders by coreParam
|
||||||
*
|
* 实时订单
|
||||||
* @author WH
|
* @author WH
|
||||||
* @date 2022/3/16 10:56
|
* @date 2022/3/16 10:56
|
||||||
* @since version-1.0
|
* @since version-1.0
|
||||||
@ -50,7 +54,7 @@ public class XhpcDataBigScreenController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return order ratio
|
* Return order ratio
|
||||||
*
|
* 订单来源比例
|
||||||
* @author WH
|
* @author WH
|
||||||
* @date 2022/3/9 15:49
|
* @date 2022/3/9 15:49
|
||||||
* @since version-1.0
|
* @since version-1.0
|
||||||
@ -61,9 +65,20 @@ public class XhpcDataBigScreenController extends BaseController {
|
|||||||
return xhpcDataBigScreenService.queryOrderRatio(coreParam);
|
return xhpcDataBigScreenService.queryOrderRatio(coreParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枪使用率
|
||||||
|
*/
|
||||||
|
@GetMapping("/terminal-gun")
|
||||||
|
public R queryTerminalGun(CoreParam coreParam) {
|
||||||
|
|
||||||
|
return xhpcDataBigScreenService.queryTerminalGun(coreParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return total electric quantity
|
* Return total electric quantity
|
||||||
*
|
* 总电量
|
||||||
* @author WH
|
* @author WH
|
||||||
* @date 2022/3/9 15:49
|
* @date 2022/3/9 15:49
|
||||||
* @since version-1.0
|
* @since version-1.0
|
||||||
@ -76,7 +91,7 @@ public class XhpcDataBigScreenController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return user activation
|
* Return user activation
|
||||||
*
|
* 用户活跃度
|
||||||
* @author WH
|
* @author WH
|
||||||
* @date 2022/3/9 13:53
|
* @date 2022/3/9 13:53
|
||||||
* @since version-1.0
|
* @since version-1.0
|
||||||
@ -89,7 +104,7 @@ public class XhpcDataBigScreenController extends BaseController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a count of user total
|
* Return a count of user total
|
||||||
*
|
* 用户总数
|
||||||
* @author WH
|
* @author WH
|
||||||
* @date 2022/3/9 10:43
|
* @date 2022/3/9 10:43
|
||||||
* @since version-1.0
|
* @since version-1.0
|
||||||
@ -103,7 +118,7 @@ public class XhpcDataBigScreenController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* Core interface
|
* Core interface
|
||||||
* Return special info of charging station
|
* Return special info of charging station
|
||||||
*
|
* 用于地球返回位置信息 电站信息
|
||||||
* @author WH
|
* @author WH
|
||||||
* @date 2022/3/9 10:42
|
* @date 2022/3/9 10:42
|
||||||
* @since version-1.0
|
* @since version-1.0
|
||||||
@ -114,4 +129,13 @@ public class XhpcDataBigScreenController extends BaseController {
|
|||||||
return xhpcDataBigScreenService.returnCoreLocation(coreParam);
|
return xhpcDataBigScreenService.returnCoreLocation(coreParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工单
|
||||||
|
*/
|
||||||
|
@GetMapping("/work-order")
|
||||||
|
public R queryWorkOrder(CoreParam coreParam) {
|
||||||
|
|
||||||
|
return xhpcDataBigScreenService.queryWorkOrder(coreParam);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,4 +43,15 @@ public interface XhpcChargingStationMapper {
|
|||||||
*/
|
*/
|
||||||
List<Long> selectChargingStationIds(@Param("tenantIdList") List<String> tenantIdList);
|
List<Long> selectChargingStationIds(@Param("tenantIdList") List<String> tenantIdList);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询枪的使用率
|
||||||
|
*/
|
||||||
|
List<String> getTerminal(@Param("chargingStationIds")List<Long> chargingStationIds,@Param("tenantIds")List<String> tenantIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询枪的使用率
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> getWorkOrderTerminal(@Param("chargingStationIds")List<Long> chargingStationIds,@Param("tenantIds")List<String> tenantIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -5,6 +5,7 @@ import com.xhpc.databigscreen.domain.CoreParam;
|
|||||||
import com.xhpc.databigscreen.domain.OrderRatio;
|
import com.xhpc.databigscreen.domain.OrderRatio;
|
||||||
import com.xhpc.databigscreen.domain.OrderTrend;
|
import com.xhpc.databigscreen.domain.OrderTrend;
|
||||||
import com.xhpc.databigscreen.domain.RealtimeOrders;
|
import com.xhpc.databigscreen.domain.RealtimeOrders;
|
||||||
|
import org.graalvm.compiler.hotspot.replacements.ObjectCloneNode;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -61,6 +62,12 @@ public interface XhpcDataBigScreenService {
|
|||||||
*/
|
*/
|
||||||
R<OrderRatio> queryOrderRatio(CoreParam coreParam);
|
R<OrderRatio> queryOrderRatio(CoreParam coreParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枪使用率
|
||||||
|
* @param coreParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
R queryTerminalGun(CoreParam coreParam);
|
||||||
/**
|
/**
|
||||||
* query realtime by coreParam
|
* query realtime by coreParam
|
||||||
*
|
*
|
||||||
@ -71,4 +78,5 @@ public interface XhpcDataBigScreenService {
|
|||||||
|
|
||||||
R<OrderTrend> queryOrderTrend(CoreParam coreParam);
|
R<OrderTrend> queryOrderTrend(CoreParam coreParam);
|
||||||
|
|
||||||
|
R queryWorkOrder(CoreParam coreParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.xhpc.databigscreen.service.impl;
|
|||||||
|
|
||||||
import com.xhpc.common.constant.ConstantClass;
|
import com.xhpc.common.constant.ConstantClass;
|
||||||
import com.xhpc.common.core.domain.R;
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import com.xhpc.common.redis.service.RedisService;
|
||||||
import com.xhpc.common.util.MyDateUtil;
|
import com.xhpc.common.util.MyDateUtil;
|
||||||
import com.xhpc.common.util.UserTypeUtil;
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.databigscreen.domain.CoreParam;
|
import com.xhpc.databigscreen.domain.CoreParam;
|
||||||
@ -13,13 +14,11 @@ import com.xhpc.databigscreen.mapper.XhpcChargingStationMapper;
|
|||||||
import com.xhpc.databigscreen.mapper.XhpcHistoryOrderMapper;
|
import com.xhpc.databigscreen.mapper.XhpcHistoryOrderMapper;
|
||||||
import com.xhpc.databigscreen.mapper.XhpcRateTimeMapper;
|
import com.xhpc.databigscreen.mapper.XhpcRateTimeMapper;
|
||||||
import com.xhpc.databigscreen.service.XhpcDataBigScreenService;
|
import com.xhpc.databigscreen.service.XhpcDataBigScreenService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,6 +37,8 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
|
|||||||
XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
|
XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
|
||||||
@Resource
|
@Resource
|
||||||
XhpcRateTimeMapper xhpcRateTimeMapper;
|
XhpcRateTimeMapper xhpcRateTimeMapper;
|
||||||
|
@Resource
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<List<Map<String, Object>>> returnCoreLocation(CoreParam coreParam) {
|
public R<List<Map<String, Object>>> returnCoreLocation(CoreParam coreParam) {
|
||||||
@ -402,6 +403,108 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 枪使用率
|
||||||
|
*
|
||||||
|
* @param coreParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R queryTerminalGun(CoreParam coreParam) {
|
||||||
|
String tenantIdsStr = null;
|
||||||
|
List<Map<String, Object>> xhpcChargingStationList = null;
|
||||||
|
List<String> tenantIdList = null;
|
||||||
|
String[] tenantIdArray = null;
|
||||||
|
Map<String, Object> map =new HashMap<>();
|
||||||
|
ArrayList<Long> chargingStationIdList = new ArrayList<>();
|
||||||
|
//judge care param function
|
||||||
|
switch (coreParam.getParamType()) {
|
||||||
|
case 0://全国
|
||||||
|
tenantIdsStr = coreParam.getTenantIds();
|
||||||
|
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
|
||||||
|
tenantIdArray = tenantIdsStr.split(",");
|
||||||
|
tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return getMapR(chargingStationIdList,tenantIdList, map);
|
||||||
|
//query charging station infos of whole area
|
||||||
|
case 1://省市区
|
||||||
|
Integer areaCode = coreParam.getAreaCode();
|
||||||
|
tenantIdsStr = coreParam.getTenantIds();
|
||||||
|
|
||||||
|
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
|
||||||
|
tenantIdArray = tenantIdsStr.split(",");
|
||||||
|
tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList());
|
||||||
|
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdList, areaCode);
|
||||||
|
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
|
||||||
|
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdList, areaCode);
|
||||||
|
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
|
||||||
|
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getMapR(chargingStationIdList,tenantIdList, map);
|
||||||
|
case 2://场站
|
||||||
|
//query location info of special charging station of special tenant
|
||||||
|
tenantIdsStr = coreParam.getTenantIds();
|
||||||
|
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
|
||||||
|
tenantIdArray = tenantIdsStr.split(",");
|
||||||
|
tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList());
|
||||||
|
String chargingStationIdStr = coreParam.getChargingStationIds();
|
||||||
|
long chargingStationId = Long.parseLong(chargingStationIdStr);
|
||||||
|
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdList, chargingStationId);
|
||||||
|
for (Map<String, Object> chargingStation : xhpcChargingStationList) {
|
||||||
|
chargingStationIdList.add((Long) chargingStation.get(ConstantClass.CHARGING_STATION_ID));
|
||||||
|
}
|
||||||
|
return getMapR(chargingStationIdList,tenantIdList, map);
|
||||||
|
} else {
|
||||||
|
return R.fail("传入的参数有误");
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
R.fail("param type is invalid");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
private R<Map<String, Object>> getMapR(List<Long> chargingStationIdList,List<String> tenantIdList, Map<String, Object> map) {
|
||||||
|
List<String> terminal = xhpcChargingStationMapper.getTerminal(chargingStationIdList, tenantIdList);
|
||||||
|
|
||||||
|
int offLine =0;//离线
|
||||||
|
int fault =0;//故障
|
||||||
|
int freeTime =0;//空闲
|
||||||
|
int charge =0;//充电
|
||||||
|
int unknown =0;//未知
|
||||||
|
if(terminal !=null && terminal.size()>0){
|
||||||
|
for (String st:terminal) {
|
||||||
|
Map<String, Object> cacheMap = redisService.getCacheMap("gun:" + st);
|
||||||
|
if(!cacheMap.isEmpty()){
|
||||||
|
if (cacheMap.containsKey("status") &&
|
||||||
|
"离线".equals(cacheMap.get("status").toString())){
|
||||||
|
offLine++;
|
||||||
|
}else if(cacheMap.containsKey("status") &&
|
||||||
|
"故障".equals(cacheMap.get("status").toString())){
|
||||||
|
fault++;
|
||||||
|
}else if(cacheMap.containsKey("status") &&
|
||||||
|
"空闲".equals(cacheMap.get("status").toString())){
|
||||||
|
freeTime++;
|
||||||
|
}else{
|
||||||
|
charge++;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
unknown++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put("offLine",offLine);
|
||||||
|
map.put("fault",fault);
|
||||||
|
map.put("freeTime",freeTime);
|
||||||
|
map.put("charge",charge);
|
||||||
|
map.put("unknown",unknown);
|
||||||
|
return R.ok(map);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<RealtimeOrders> queryRealtimeOrders(CoreParam coreParam) {
|
public R<RealtimeOrders> queryRealtimeOrders(CoreParam coreParam) {
|
||||||
|
|
||||||
@ -482,11 +585,8 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
|
|||||||
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
|
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
|
||||||
tenantIdArray = tenantIdsStr.split(",");
|
tenantIdArray = tenantIdsStr.split(",");
|
||||||
tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList());
|
tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList());
|
||||||
return getOrderTrend(tenantIdList, null);
|
|
||||||
} else {
|
|
||||||
return getOrderTrend(tenantIdList, null);
|
|
||||||
}
|
}
|
||||||
//query charging station infos of whole area
|
return getOrderTrend(tenantIdList, null);
|
||||||
case 1:
|
case 1:
|
||||||
Integer areaCode = coreParam.getAreaCode();
|
Integer areaCode = coreParam.getAreaCode();
|
||||||
tenantIdsStr = coreParam.getTenantIds();
|
tenantIdsStr = coreParam.getTenantIds();
|
||||||
@ -529,6 +629,64 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R queryWorkOrder(CoreParam coreParam) {
|
||||||
|
String tenantIdsStr = null;
|
||||||
|
List<Map<String, Object>> xhpcChargingStationList = null;
|
||||||
|
List<String> tenantIdList = null;
|
||||||
|
String[] tenantIdArray = null;
|
||||||
|
//judge care param function
|
||||||
|
switch (coreParam.getParamType()) {
|
||||||
|
case 0:
|
||||||
|
tenantIdsStr = coreParam.getTenantIds();
|
||||||
|
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
|
||||||
|
tenantIdArray = tenantIdsStr.split(",");
|
||||||
|
tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return R.ok(xhpcChargingStationMapper.getWorkOrderTerminal(null,tenantIdList));
|
||||||
|
//query charging station infos of whole area
|
||||||
|
case 1:
|
||||||
|
Integer areaCode = coreParam.getAreaCode();
|
||||||
|
tenantIdsStr = coreParam.getTenantIds();
|
||||||
|
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
|
||||||
|
tenantIdArray = tenantIdsStr.split(",");
|
||||||
|
tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList());
|
||||||
|
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdList, areaCode);
|
||||||
|
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,tenantIdList));
|
||||||
|
} else {
|
||||||
|
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdList, areaCode);
|
||||||
|
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,tenantIdList));
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
//query location info of special charging station of special tenant
|
||||||
|
tenantIdsStr = coreParam.getTenantIds();
|
||||||
|
if (!"".equals(tenantIdsStr) && tenantIdsStr != null) {
|
||||||
|
tenantIdArray = tenantIdsStr.split(",");
|
||||||
|
tenantIdList = Arrays.stream(tenantIdArray).collect(Collectors.toList());
|
||||||
|
String chargingStationIdStr = coreParam.getChargingStationIds();
|
||||||
|
long chargingStationId = Long.parseLong(chargingStationIdStr);
|
||||||
|
xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdList, 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,tenantIdList));
|
||||||
|
} else {
|
||||||
|
return R.fail("传入的参数有误");
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return R.fail("param type is invalid");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private R<OrderTrend> getOrderTrend(List<String> tenantIdList, ArrayList<Long> chargingStationIdList) {
|
private R<OrderTrend> getOrderTrend(List<String> tenantIdList, ArrayList<Long> chargingStationIdList) {
|
||||||
|
|
||||||
List<Map<String, Object>> orderTrendList = xhpcHistoryOrderMapper.selectOrderTrendByTenantIdsAndChargingStationIds(tenantIdList, chargingStationIdList);
|
List<Map<String, Object>> orderTrendList = xhpcHistoryOrderMapper.selectOrderTrendByTenantIdsAndChargingStationIds(tenantIdList, chargingStationIdList);
|
||||||
|
|||||||
@ -470,4 +470,43 @@
|
|||||||
tenant_id = #{tenantId,jdbcType=VARCHAR}
|
tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||||
where charging_station_id = #{chargingStationId,jdbcType=BIGINT}
|
where charging_station_id = #{chargingStationId,jdbcType=BIGINT}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="getTerminal" resultType="string">
|
||||||
|
select serial_number as serialNumber
|
||||||
|
from xhpc_terminal
|
||||||
|
where del_flag = 0
|
||||||
|
<if test="tenantIds !=null and tenantIds.size()>0">
|
||||||
|
and tenant_id in
|
||||||
|
<foreach collection="tenantIds" open="(" item="tenantId" separator="," close=")" >
|
||||||
|
#{tenantId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="chargingStationIds !=null and chargingStationIds.size()>0">
|
||||||
|
and charging_station_id in
|
||||||
|
<foreach collection="chargingStationIds" open="(" item="chargingStationId" separator="," close=")" >
|
||||||
|
#{tenantId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getWorkOrderTerminal" resultType="map">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from xhpc_work_order
|
||||||
|
where status=1
|
||||||
|
<if test="tenantIds !=null and tenantIds.size()>0">
|
||||||
|
and tenant_id in
|
||||||
|
<foreach collection="tenantIds" open="(" item="tenantId" separator="," close=")" >
|
||||||
|
#{tenantId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
<if test="chargingStationIds !=null and chargingStationIds.size()>0">
|
||||||
|
and serial_number in (select serial_number from xhpc_terminal where charging_station_id in
|
||||||
|
<foreach collection="tenantIds" open="(" item="tenantId" separator="," close=")" >
|
||||||
|
#{tenantId}
|
||||||
|
</foreach>
|
||||||
|
)charging_station_id in
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -445,46 +445,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
}
|
}
|
||||||
//
|
//
|
||||||
if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) {
|
if ( !UserTypeUtil.INTERNET_TYPE.equals(source)) {
|
||||||
//用户第几次充电
|
|
||||||
// int count = xhpcChargeOrderService.getCount(userId,null,source,xhpcChargeOrder.getTenantId());
|
|
||||||
// if (count == 0) {
|
|
||||||
// //活动折扣
|
|
||||||
// Map<String, Object> promotion = xhpcChargeOrderService.getPromotion();
|
|
||||||
// if (promotion != null && promotion.get("state") != null && promotion.get("discount") != null) {
|
|
||||||
// //state 1.总金额 2.电费 3.服务费 discount 折扣率
|
|
||||||
// String state = promotion.get("state").toString();
|
|
||||||
// BigDecimal discount =new BigDecimal(promotion.get("discount").toString()).divide(new BigDecimal(100));
|
|
||||||
//
|
|
||||||
// if(discount.compareTo(new BigDecimal(0))==1){
|
|
||||||
// if("1".equals(state) || "2".equals(state) || "3".equals(state)){
|
|
||||||
// //折扣的钱
|
|
||||||
// promotionDiscount=money.multiply(discount).setScale(2,BigDecimal.ROUND_HALF_UP);
|
|
||||||
// //剩余的总金额
|
|
||||||
// actPrice = money.subtract(promotionDiscount);
|
|
||||||
//
|
|
||||||
// BigDecimal decimal1 = surplusPowerPrice.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
// BigDecimal decimal2 = surplusServicePrice.multiply(discount).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
||||||
// if("1".equals(state)){
|
|
||||||
// //总金额
|
|
||||||
// actPrice =actPrice.subtract(decimal1.add(decimal2));
|
|
||||||
// //折扣的钱
|
|
||||||
// promotionDiscount = decimal1.add(decimal2);
|
|
||||||
// surplusPowerPrice = surplusPowerPrice.subtract(decimal1);
|
|
||||||
// surplusServicePrice= surplusServicePrice.subtract(decimal2);
|
|
||||||
// }else if("2".equals(state)){
|
|
||||||
// //电费
|
|
||||||
// surplusPowerPrice=surplusPowerPrice.subtract(decimal1);
|
|
||||||
// }else{
|
|
||||||
// //服务费
|
|
||||||
// surplusServicePrice =surplusServicePrice.subtract(decimal2);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
if(UserTypeUtil.COMMUNIT_TYPE.equals(source) || UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
if(UserTypeUtil.COMMUNIT_TYPE.equals(source) || UserTypeUtil.CUSTOMERS_TYPE.equals(source)){
|
||||||
//折扣(机构用户),没有活动时计算
|
//折扣(机构用户),没有活动时计算
|
||||||
R mechanismDiscount = userTypeService.getMechanismDiscount(userId, source, xhpcChargeOrder.getTenantId());
|
R mechanismDiscount = userTypeService.getMechanismDiscount(userId, source, xhpcChargeOrder.getTenantId(),xhpcChargeOrder.getChargingStationId());
|
||||||
if(mechanismDiscount !=null && mechanismDiscount.getData() !=null) {
|
if(mechanismDiscount !=null && mechanismDiscount.getData() !=null) {
|
||||||
Map<String, Object> userDiscount = (Map<String, Object>) mechanismDiscount.getData();
|
Map<String, Object> userDiscount = (Map<String, Object>) mechanismDiscount.getData();
|
||||||
if (userDiscount != null && userDiscount.get("commissionType") != null && userDiscount.get("servicePreferential") != null) {
|
if (userDiscount != null && userDiscount.get("commissionType") != null && userDiscount.get("servicePreferential") != null) {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import com.xhpc.common.core.web.controller.BaseController;
|
|||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.util.UserTypeUtil;
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.user.service.IXhpcCommonService;
|
import com.xhpc.user.service.IXhpcCommonService;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -76,9 +77,9 @@ public class XhpcCommonController extends BaseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/getMechanismDiscount")
|
@GetMapping(value = "/getMechanismDiscount")
|
||||||
public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId) {
|
public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId, Long chargingStationId) {
|
||||||
|
|
||||||
return xhpcCommonService.getMechanismDiscount(userId,userType,tenantId);
|
return xhpcCommonService.getMechanismDiscount(userId,userType,tenantId,chargingStationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -108,5 +108,5 @@ public interface XhpcCommunityMapper {
|
|||||||
/**
|
/**
|
||||||
* 根据用户id获取社区组
|
* 根据用户id获取社区组
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getCommunityPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId);
|
Map<String, Object> getCommunityPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId,@Param("chargingStationId")Long chargingStationId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,5 +106,5 @@ public interface XhpcCustomersMapper {
|
|||||||
/**
|
/**
|
||||||
* 根据用户id获取大客户组
|
* 根据用户id获取大客户组
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getCustomersPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId);
|
Map<String, Object> getCustomersPersonnelUserId(@Param("userId")Long userId,@Param("tenantId")String tenantId,@Param("chargingStationId") Long chargingStationId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,9 @@ public interface IXhpcCommonService {
|
|||||||
* @param userId 充值用户
|
* @param userId 充值用户
|
||||||
* @param userType 用户类型
|
* @param userType 用户类型
|
||||||
* @param tenantId 租户id
|
* @param tenantId 租户id
|
||||||
|
* @param chargingStationId 场站id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId);
|
AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId, Long chargingStationId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -107,5 +107,5 @@ public interface IXhpcCommunityService {
|
|||||||
/**
|
/**
|
||||||
* 根据用户id获取社区组
|
* 根据用户id获取社区组
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getCommunityPersonnelUserId(Long userId,String tenantId);
|
Map<String, Object> getCommunityPersonnelUserId(Long userId,String tenantId,Long chargingStationId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -100,5 +100,5 @@ public interface IXhpcCustomersService {
|
|||||||
/**
|
/**
|
||||||
* 根据用户id获取大客户组
|
* 根据用户id获取大客户组
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getCustomersPersonnelUserId(Long userId,String tenantId);
|
Map<String, Object> getCustomersPersonnelUserId(Long userId,String tenantId, Long chargingStationId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,11 +89,11 @@ public class XhpcCommonServiceImpl implements IXhpcCommonService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId) {
|
public AjaxResult getMechanismDiscount(Long userId, Integer userType, String tenantId, Long chargingStationId) {
|
||||||
if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
|
if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
|
||||||
return AjaxResult.success(xhpcCommunityService.getCommunityPersonnelUserId(userId, tenantId));
|
return AjaxResult.success(xhpcCommunityService.getCommunityPersonnelUserId(userId, tenantId,chargingStationId));
|
||||||
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){
|
}else if(UserTypeUtil.CUSTOMERS_TYPE.equals(userType)){
|
||||||
return AjaxResult.success(xhpcCustomersService.getCustomersPersonnelUserId(userId, tenantId));
|
return AjaxResult.success(xhpcCustomersService.getCustomersPersonnelUserId(userId, tenantId,chargingStationId));
|
||||||
}else{
|
}else{
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -314,8 +314,8 @@ public class XhpcCommunityServiceImpl extends BaseService implements IXhpcCommun
|
|||||||
* @param tenantId
|
* @param tenantId
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getCommunityPersonnelUserId(Long userId, String tenantId) {
|
public Map<String, Object> getCommunityPersonnelUserId(Long userId, String tenantId,Long chargingStationId) {
|
||||||
return xhpcCommunityMapper.getCommunityPersonnelUserId(userId, tenantId);
|
return xhpcCommunityMapper.getCommunityPersonnelUserId(userId, tenantId,chargingStationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R judgeXhpcCommunity(XhpcCommunity xhpcCommunity){
|
public R judgeXhpcCommunity(XhpcCommunity xhpcCommunity){
|
||||||
|
|||||||
@ -296,8 +296,8 @@ public class XhpcCustomersServiceImpl extends BaseService implements IXhpcCustom
|
|||||||
* @param tenantId
|
* @param tenantId
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getCustomersPersonnelUserId(Long userId, String tenantId) {
|
public Map<String, Object> getCustomersPersonnelUserId(Long userId, String tenantId, Long chargingStationId) {
|
||||||
return xhpcCustomersMapper.getCustomersPersonnelUserId(userId, tenantId);
|
return xhpcCustomersMapper.getCustomersPersonnelUserId(userId, tenantId,chargingStationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public R judgeXhpcCustomers(XhpcCustomers xhpcCustomers){
|
public R judgeXhpcCustomers(XhpcCustomers xhpcCustomers){
|
||||||
|
|||||||
@ -457,9 +457,11 @@
|
|||||||
|
|
||||||
<select id="getCommunityPersonnelUserId" resultType="map">
|
<select id="getCommunityPersonnelUserId" resultType="map">
|
||||||
select
|
select
|
||||||
commission_type commissionType,
|
co.commission_type commissionType,
|
||||||
service_preferential servicePreferential
|
co.service_preferential servicePreferential
|
||||||
from xhpc_community
|
from xhpc_community co
|
||||||
where community_id = (select community_id from xhpc_community_personnel where community_personnel_id=#{userId} and tenant_id=#{tenantId} and del_flag =0)
|
join xhpc_mechanism me on me.mechanism_id = co.community_id and me.source = 0 and me.del_flag =0
|
||||||
|
where co.community_id = (select community_id from xhpc_community_personnel where community_personnel_id=#{userId} and tenant_id=#{tenantId} and del_flag =0)
|
||||||
|
and me.charging_station_id=#{chargingStationId}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -454,9 +454,11 @@
|
|||||||
|
|
||||||
<select id="getCustomersPersonnelUserId" resultType="map">
|
<select id="getCustomersPersonnelUserId" resultType="map">
|
||||||
select
|
select
|
||||||
commission_type commissionType,
|
co.commission_type commissionType,
|
||||||
service_preferential servicePreferential
|
co.service_preferential servicePreferential
|
||||||
from xhpc_customers
|
from xhpc_customers co
|
||||||
where customers_id = (select customers_id from xhpc_customers_personnel where customers_personnel_id=#{userId} and tenant_id=#{tenantId} and del_flag =0)
|
join xhpc_mechanism me on me.mechanism_id = co.customers_id and me.source = 1 and me.del_flag =0
|
||||||
|
where co.customers_id = (select customers_id from xhpc_customers_personnel where customers_personnel_id=#{userId} and tenant_id=#{tenantId} and del_flag =0)
|
||||||
|
and me.charging_station_id=#{chargingStationId}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user