优化数据大屏接口,优化订单结算
This commit is contained in:
parent
f2cbe98fb4
commit
fbbbf3fd2b
@ -19,19 +19,19 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 172.31.183.135:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 172.31.183.135:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
logging:
|
#logging:
|
||||||
level:
|
# level:
|
||||||
root: info
|
# root: info
|
||||||
com.xhpc.activity.mapper: debug
|
# com.xhpc.activity.mapper: debug
|
||||||
|
|
||||||
|
|
||||||
wx:
|
wx:
|
||||||
|
|||||||
@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author WH
|
* @author WH
|
||||||
@ -709,12 +708,7 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
|
|||||||
realtimeOrders.setTotalItems((long) realtimeOrderList.size());
|
realtimeOrders.setTotalItems((long) realtimeOrderList.size());
|
||||||
for (Map<String, Object> realtimeOrderMap : realtimeOrderList) {
|
for (Map<String, Object> realtimeOrderMap : realtimeOrderList) {
|
||||||
RealtimeOrders.RealtimeOrder realtimeOrder = new RealtimeOrders.RealtimeOrder();
|
RealtimeOrders.RealtimeOrder realtimeOrder = new RealtimeOrders.RealtimeOrder();
|
||||||
Integer userType = (Integer) realtimeOrderMap.get("source");
|
|
||||||
if (userType == 1) {
|
|
||||||
realtimeOrder.setUserType((String) realtimeOrderMap.get("chargingMode"));
|
realtimeOrder.setUserType((String) realtimeOrderMap.get("chargingMode"));
|
||||||
} else {
|
|
||||||
realtimeOrder.setUserType((String) realtimeOrderMap.get("sourceMap"));
|
|
||||||
}
|
|
||||||
realtimeOrder.setStartChargingTime((String) realtimeOrderMap.get("startTime"));
|
realtimeOrder.setStartChargingTime((String) realtimeOrderMap.get("startTime"));
|
||||||
realtimeOrder.setChargingTime((String) realtimeOrderMap.get("chargingTime"));
|
realtimeOrder.setChargingTime((String) realtimeOrderMap.get("chargingTime"));
|
||||||
realtimeOrder.setChargedElectric((Double) realtimeOrderMap.get("chargingDegree"));
|
realtimeOrder.setChargedElectric((Double) realtimeOrderMap.get("chargingDegree"));
|
||||||
|
|||||||
@ -80,10 +80,18 @@
|
|||||||
<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>
|
||||||
<if test="areaCode != null and areaCode != '' ">
|
<if test="areaCode== null">
|
||||||
<if test="number ==0">
|
<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 where pcode in(select code from xhpc_area where pcode =xa.code))
|
||||||
</if>
|
</if>
|
||||||
|
<if test="number ==2">
|
||||||
|
AND area_code in (select code from xhpc_area where pcode =xa.code)
|
||||||
|
</if>
|
||||||
|
<if test="number ==3">
|
||||||
|
AND area_code =xa.code
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
<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 where pcode in(select code from xhpc_area where pcode =xa.code))
|
||||||
</if>
|
</if>
|
||||||
@ -97,13 +105,8 @@
|
|||||||
FROM
|
FROM
|
||||||
xhpc_area as xa
|
xhpc_area as xa
|
||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
<if test="areaCode != null and areaCode != '' ">
|
<if test="areaCode != null">
|
||||||
and xa.level =#{number}
|
and xa.level =#{number}
|
||||||
<if test="number==0">
|
|
||||||
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
|
|
||||||
</if>
|
|
||||||
<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
|
||||||
@ -113,14 +116,18 @@
|
|||||||
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 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})
|
||||||
|
)
|
||||||
</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})
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
<if test="areaCode==null or areaCode == '' ">
|
<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
|
||||||
|
|||||||
@ -129,7 +129,7 @@
|
|||||||
FROM
|
FROM
|
||||||
xhpc_history_order
|
xhpc_history_order
|
||||||
WHERE
|
WHERE
|
||||||
del_flag = 0
|
del_flag = 0 and charging_mode is not null
|
||||||
<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[<=]]> 15
|
t.help_topic_id <![CDATA[<=]]> 31
|
||||||
) 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 - 15 DAY )
|
AND end_time <![CDATA[>=]]> DATE_ADD( now(), INTERVAL - 31 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
|
||||||
|
|||||||
@ -35,59 +35,46 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="selectByTenantIdsAndCharingStationIds" resultType="Map">
|
<select id="selectByTenantIdsAndCharingStationIds" resultType="Map">
|
||||||
select
|
select
|
||||||
r.charging_order_id chargingOrderId,
|
ROUND(ro.charging_degree,2) as chargingDegree,
|
||||||
ROUND(r.charging_degree,2) as chargingDegree,
|
DATE_FORMAT(co.start_time,"%H:%i") as startTime,
|
||||||
r.amount_charged amountCharged,
|
ro.amount_charged amountCharged,
|
||||||
r.electric_current electricCurrent,
|
ro.electric_current electricCurrent,
|
||||||
r.voltage,
|
ro.real_time_order_id as realTimeOrderId,
|
||||||
r.soc,
|
ro.voltage as voltage,
|
||||||
r.source,
|
ro.soc as soc,
|
||||||
DATE_FORMAT(o.start_time,"%H:%m") as startTime,
|
ro.charging_time chargingTime,
|
||||||
CASE r.source
|
CASE
|
||||||
WHEN 0 THEN
|
WHEN co.charging_mode = "新电途" THEN
|
||||||
|
"新电途用户"
|
||||||
|
WHEN co.charging_mode = "快电" THEN
|
||||||
|
"快电用户"
|
||||||
|
WHEN co.charging_mode = "恒大" THEN
|
||||||
|
"恒大用户"
|
||||||
|
WHEN co.charging_mode = "小桔" THEN
|
||||||
|
"小桔用户"
|
||||||
|
ELSE
|
||||||
"C端用户"
|
"C端用户"
|
||||||
WHEN 2 THEN
|
END chargingMode
|
||||||
"社区用户"
|
from xhpc_charge_order co
|
||||||
WHEN 3 THEN
|
left join xhpc_internet_user as inu on inu.internet_user_id = co.user_id and co.source =1
|
||||||
"B端用户"
|
left join xhpc_app_user as apu on apu.app_user_id = co.user_id and co.source =0
|
||||||
END sourceMap,
|
left join xhpc_community_personnel as cop on cop.community_personnel_id = co.user_id and co.source =2
|
||||||
r.charging_time chargingTime,
|
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = co.user_id and co.source =3
|
||||||
CONCAT(o.charging_mode,"用户") as chargingMode
|
LEFT JOIN (
|
||||||
from
|
SELECT charging_order_id,real_time_order_id,soc,charging_degree,charging_time,amount_charged,electric_current,voltage FROM xhpc_real_time_order
|
||||||
(SELECT
|
WHERE real_time_order_id IN ( SELECT max( real_time_order_id ) FROM xhpc_real_time_order GROUP BY charging_order_id )
|
||||||
charging_order_id,
|
) ro ON ro.charging_order_id = co.charge_order_id
|
||||||
charging_degree,
|
where co.status=0 and co.del_flag=0
|
||||||
amount_charged,
|
|
||||||
electric_current,
|
|
||||||
voltage,
|
|
||||||
soc,
|
|
||||||
source,
|
|
||||||
tenant_id,
|
|
||||||
charging_time
|
|
||||||
FROM
|
|
||||||
xhpc_real_time_order
|
|
||||||
WHERE
|
|
||||||
real_time_order_id IN
|
|
||||||
(SELECT
|
|
||||||
max(real_time_order_id)
|
|
||||||
FROM
|
|
||||||
xhpc_real_time_order
|
|
||||||
WHERE
|
|
||||||
charging_order_id IN
|
|
||||||
(SELECT charge_order_id FROM xhpc_charge_order WHERE STATUS = 0 and 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(co.tenant_id, #{tenantIdsStr})
|
||||||
</if>
|
</if>
|
||||||
<if test="xhpcChargingStationList!=null and xhpcChargingStationList.size()!=0">
|
<if test="xhpcChargingStationList!=null and xhpcChargingStationList.size()!=0">
|
||||||
and charging_station_id in
|
and co.charging_station_id in
|
||||||
<foreach collection="xhpcChargingStationList" open="(" close=")" separator="," item="chargingStationId">
|
<foreach collection="xhpcChargingStationList" open="(" close=")" separator="," item="chargingStationId">
|
||||||
#{chargingStationId}
|
#{chargingStationId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
)
|
order by co.create_time desc
|
||||||
GROUP BY charging_order_id))
|
|
||||||
AS r LEFT JOIN xhpc_charge_order as o on r.charging_order_id = o.charge_order_id
|
|
||||||
ORDER BY o.start_time ASC
|
|
||||||
</select>
|
</select>
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
delete
|
delete
|
||||||
|
|||||||
@ -902,26 +902,6 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@GetMapping("/test44")
|
|
||||||
public void test44(){
|
|
||||||
//获取异常的订单 24小时之外的异常订单
|
|
||||||
List<Map<String,Object>> xhpcChargeOrderList= chargeOrderService.getXhpcChargeOrderStatus(2);
|
|
||||||
|
|
||||||
if(xhpcChargeOrderList !=null && xhpcChargeOrderList.size()>0){
|
|
||||||
for (int i = 0; i <xhpcChargeOrderList.size() ; i++) {
|
|
||||||
Map<String,Object> map = xhpcChargeOrderList.get(i);
|
|
||||||
if(map !=null){
|
|
||||||
Long chargeOrderId = Long.valueOf(map.get("chargeOrderId").toString());
|
|
||||||
if(map.get("realTimeOrderId")!=null){
|
|
||||||
Long realTimeOrderId = Long.valueOf(map.get("realTimeOrderId").toString());
|
|
||||||
xhpcHistoryOrderService.addXhpcChargeOrder(realTimeOrderId,chargeOrderId);
|
|
||||||
}else{
|
|
||||||
xhpcHistoryOrderService.addXhpcChargeOrder(null,chargeOrderId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标记异常大于创建4小时,标记为异常
|
* 标记异常大于创建4小时,标记为异常
|
||||||
|
|||||||
@ -0,0 +1,35 @@
|
|||||||
|
package com.xhpc.order.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2022/5/13 14:31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RateTime implements Serializable {
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务费
|
||||||
|
*/
|
||||||
|
private BigDecimal servicePrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务费
|
||||||
|
*/
|
||||||
|
private BigDecimal powerPrice;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ import com.xhpc.order.domain.XhpcChargeOrderCurrent;
|
|||||||
import com.xhpc.order.domain.XhpcChargeOrderSoc;
|
import com.xhpc.order.domain.XhpcChargeOrderSoc;
|
||||||
import com.xhpc.order.domain.XhpcChargeOrderVoltage;
|
import com.xhpc.order.domain.XhpcChargeOrderVoltage;
|
||||||
import com.xhpc.order.domain.XhpcRealTimeOrder;
|
import com.xhpc.order.domain.XhpcRealTimeOrder;
|
||||||
|
import com.xhpc.order.dto.RateTime;
|
||||||
import com.xhpc.order.dto.XhpcActivityDiscountDto;
|
import com.xhpc.order.dto.XhpcActivityDiscountDto;
|
||||||
import com.xhpc.order.dto.XhpcActivityFormulaDomainDto;
|
import com.xhpc.order.dto.XhpcActivityFormulaDomainDto;
|
||||||
import com.xhpc.order.dto.XhpcActivityInternetDomainDto;
|
import com.xhpc.order.dto.XhpcActivityInternetDomainDto;
|
||||||
@ -163,9 +164,15 @@ public interface XhpcRealTimeOrderMapper {
|
|||||||
List<XhpcActivityDiscountDto> getActivityDiscountTime(@Param("internetUserId")Long internetUserId, @Param("startTime")String startTime, @Param("userType")Integer userType, @Param("chargingStationId")Long chargingStationId, @Param("tenantId")String tenantId);
|
List<XhpcActivityDiscountDto> getActivityDiscountTime(@Param("internetUserId")Long internetUserId, @Param("startTime")String startTime, @Param("userType")Integer userType, @Param("chargingStationId")Long chargingStationId, @Param("tenantId")String tenantId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询该时段的计费公式
|
||||||
|
*/
|
||||||
|
List<XhpcActivityFormulaDomainDto> getActivityFormulaById(@Param("activityId") Integer activityId);
|
||||||
|
|
||||||
|
|
||||||
|
//获取场站的费率时段
|
||||||
|
List<RateTime> getRateTimeList(@Param("chargingStationId")Long chargingStationId, @Param("rateModelId")Long rateModelId,@Param("rateValue") String rateValue);
|
||||||
|
|
||||||
|
XhpcActivityFormulaDomainDto getActivityFormulaTimeById(@Param("activityId") Integer activityId,@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -465,8 +465,8 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
map1.put("chargingDegree", chargeOrder.getChargingDegree());
|
map1.put("chargingDegree", chargeOrder.getChargingDegree());
|
||||||
map1.put("actPrice", totalPrice);
|
map1.put("actPrice", totalPrice);
|
||||||
list.add(map1);
|
list.add(map1);
|
||||||
map.put("powerPriceTotal", 0);
|
// map.put("powerPriceTotal", 0);
|
||||||
map.put("servicePriceTotal", 0);
|
// map.put("servicePriceTotal", 0);
|
||||||
map.put("list", list);//数据列表
|
map.put("list", list);//数据列表
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@ -483,8 +483,8 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
map1.put("actPrice", totalPrice);
|
map1.put("actPrice", totalPrice);
|
||||||
list.add(map1);
|
list.add(map1);
|
||||||
map.put("list", list);//数据列表
|
map.put("list", list);//数据列表
|
||||||
map.put("powerPriceTotal", 0);
|
// map.put("powerPriceTotal", 0);
|
||||||
map.put("servicePriceTotal", 0);
|
// map.put("servicePriceTotal", 0);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
//每分钟多少度
|
//每分钟多少度
|
||||||
@ -537,8 +537,8 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
map.put("powerPriceTotal", powerPriceTotal);
|
// map.put("powerPriceTotal", powerPriceTotal);
|
||||||
map.put("servicePriceTotal", servicePriceTotal);
|
// map.put("servicePriceTotal", servicePriceTotal);
|
||||||
map.put("list", list);//数据列表
|
map.put("list", list);//数据列表
|
||||||
//map.put("chargingTimeTotal",chargeOrder.getChargingTime());//总时长
|
//map.put("chargingTimeTotal",chargeOrder.getChargingTime());//总时长
|
||||||
//map.put("powerPriceTotal",powerPriceTotal);//总电费单价(元/度)
|
//map.put("powerPriceTotal",powerPriceTotal);//总电费单价(元/度)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import com.xhpc.common.security.service.TokenService;
|
|||||||
import com.xhpc.common.util.EvcsUtil;
|
import com.xhpc.common.util.EvcsUtil;
|
||||||
import com.xhpc.common.util.UserTypeUtil;
|
import com.xhpc.common.util.UserTypeUtil;
|
||||||
import com.xhpc.order.domain.*;
|
import com.xhpc.order.domain.*;
|
||||||
|
import com.xhpc.order.dto.RateTime;
|
||||||
import com.xhpc.order.dto.XhpcActivityDiscountDto;
|
import com.xhpc.order.dto.XhpcActivityDiscountDto;
|
||||||
import com.xhpc.order.dto.XhpcActivityFormulaDomainDto;
|
import com.xhpc.order.dto.XhpcActivityFormulaDomainDto;
|
||||||
import com.xhpc.order.dto.XhpcActivityInternetDomainDto;
|
import com.xhpc.order.dto.XhpcActivityInternetDomainDto;
|
||||||
@ -355,6 +356,20 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
Integer source = xhpcChargeOrder.getSource();
|
Integer source = xhpcChargeOrder.getSource();
|
||||||
String tenantId = xhpcChargeOrder.getTenantId();
|
String tenantId = xhpcChargeOrder.getTenantId();
|
||||||
Map<String, Object> userMessage =new HashMap<>();
|
Map<String, Object> userMessage =new HashMap<>();
|
||||||
|
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
|
||||||
|
|
||||||
|
if(xhpcChargeOrder.getStartTime() ==null || xhpcChargeOrder.getEndTime()==null){
|
||||||
|
//获取实时数据
|
||||||
|
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+xhpcChargeOrder.getSerialNumber());
|
||||||
|
if(cacheMap !=null && cacheMap.get("realtimeDataList") !=null){
|
||||||
|
List<CacheRealtimeData> list = (List<CacheRealtimeData>) cacheMap.get("realtimeDataList");
|
||||||
|
if(list !=null && list.size()>0){
|
||||||
|
xhpcChargeOrder.setEndTime(DateUtil.parse(list.get(list.size()-1).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||||
|
xhpcChargeOrder.setStartTime(DateUtil.parse(list.get(0).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
if(!UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||||
R user = userTypeService.getUser(null, userId, source, null, tenantId);
|
R user = userTypeService.getUser(null, userId, source, null, tenantId);
|
||||||
boolean judge = false;
|
boolean judge = false;
|
||||||
@ -374,9 +389,15 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||||
return AjaxResult.error("用户id:" + userId + "为空");
|
return AjaxResult.error("用户id:" + userId + "为空");
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
xhpcHistoryOrder.setInternetSerialNumber(xhpcChargeOrder.getInternetSerialNumber());
|
||||||
|
Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+xhpcChargeOrder.getSerialNumber());
|
||||||
|
if(pushOrder.get("operatorId3rdpty") !=null){
|
||||||
|
xhpcHistoryOrder.setOperatorId3rdptyEvcs((String) pushOrder.get("operatorId3rdpty"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//生成一条历史订单
|
//生成一条历史订单
|
||||||
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
|
|
||||||
xhpcHistoryOrder.setStartTime(xhpcChargeOrder.getStartTime());
|
xhpcHistoryOrder.setStartTime(xhpcChargeOrder.getStartTime());
|
||||||
if(xhpcChargeOrder.getEndTime()==null ){
|
if(xhpcChargeOrder.getEndTime()==null ){
|
||||||
xhpcHistoryOrder.setEndTime(xhpcChargeOrder.getStartTime());
|
xhpcHistoryOrder.setEndTime(xhpcChargeOrder.getStartTime());
|
||||||
@ -461,6 +482,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
Date endTime = xhpcChargeOrder.getEndTime();
|
Date endTime = xhpcChargeOrder.getEndTime();
|
||||||
Integer source = xhpcChargeOrder.getSource();
|
Integer source = xhpcChargeOrder.getSource();
|
||||||
String internetSerialNumber = xhpcChargeOrder.getInternetSerialNumber();
|
String internetSerialNumber = xhpcChargeOrder.getInternetSerialNumber();
|
||||||
|
Long chargingStationId = xhpcChargeOrder.getChargingStationId();
|
||||||
|
String tenantId = xhpcChargeOrder.getTenantId();
|
||||||
//判断是否有活动
|
//判断是否有活动
|
||||||
logger.info("<<<<<<<<<<<<<<<判断是否有活动>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
logger.info("<<<<<<<<<<<<<<<判断是否有活动>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
||||||
boolean judge =false;
|
boolean judge =false;
|
||||||
@ -468,18 +491,91 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
xhpcHistoryOrder.setChargingMode(xhpcChargeOrder.getUserId()+"");
|
xhpcHistoryOrder.setChargingMode(xhpcChargeOrder.getUserId()+"");
|
||||||
xhpcHistoryOrder.setInternetSerialNumber(xhpcChargeOrder.getInternetSerialNumber());
|
xhpcHistoryOrder.setInternetSerialNumber(xhpcChargeOrder.getInternetSerialNumber());
|
||||||
Double totalPower = xhpcHistoryOrder.getTotalPower();
|
Double totalPower = xhpcHistoryOrder.getTotalPower();
|
||||||
|
|
||||||
|
Map<String, Object> judgeActivity= getRateOrActivityFormul(xhpcChargeOrder.getSerialNumber(), internetUserId, startTime, endTime, chargingStationId, tenantId, xhpcChargeOrder.getRateModelId());
|
||||||
|
|
||||||
|
Map<String, Double> params1 =new HashMap<>();
|
||||||
|
if("1".equals(judgeActivity.get("status").toString())){
|
||||||
|
params1.put("T",money.doubleValue());
|
||||||
|
params1.put("P",powerPrice.doubleValue());
|
||||||
|
params1.put("S",servicePrice.doubleValue());
|
||||||
|
params1.put("E",totalPower);
|
||||||
|
String computeFormula = judgeActivity.get("computeFormula").toString();
|
||||||
|
int computeType = (int)judgeActivity.get("computeType");
|
||||||
|
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
//活动总服务费
|
||||||
|
activityServicePriceTotal = servicePrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
//活动总电费
|
||||||
|
activityPowerPriceTotal = powerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
//活动总金额
|
||||||
|
activityTotalPriceTotal = money;
|
||||||
|
if(computeType==1){
|
||||||
|
BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
internetCommission = internetCommission.add(eval);
|
||||||
|
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal.subtract(decimal1));
|
||||||
|
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(decimal1));
|
||||||
|
}else if(computeType==2){
|
||||||
|
internetSvcCommission = internetSvcCommission.add(eval);
|
||||||
|
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
|
||||||
|
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
|
||||||
|
}else{
|
||||||
|
//电量抽成
|
||||||
|
internetDegreeCommission = internetDegreeCommission.add(eval);
|
||||||
|
//减服务费
|
||||||
|
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
|
||||||
|
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
|
||||||
|
}
|
||||||
|
promotionDiscount = money.subtract(activityTotalPriceTotal);
|
||||||
|
xhpcHistoryOrder.setActivityId(judgeActivity.get("activityId").toString());
|
||||||
|
}else if("2".equals(judgeActivity.get("status").toString())){
|
||||||
|
|
||||||
|
String computeFormula = judgeActivity.get("computeFormula").toString();
|
||||||
|
BigDecimal powerPrice1 = new BigDecimal(judgeActivity.get("powerPrice").toString());
|
||||||
|
BigDecimal servicePrice1 = new BigDecimal(judgeActivity.get("servicePrice").toString());
|
||||||
|
//活动总服务费
|
||||||
|
activityServicePriceTotal = servicePrice1.multiply(new BigDecimal(totalPower)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
//活动总电费
|
||||||
|
activityPowerPriceTotal = powerPrice1.multiply(new BigDecimal(totalPower)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
//活动总金额
|
||||||
|
activityTotalPriceTotal = activityServicePriceTotal.add(activityPowerPriceTotal);
|
||||||
|
params1.put("T",activityTotalPriceTotal.doubleValue());
|
||||||
|
params1.put("P",activityPowerPriceTotal.doubleValue());
|
||||||
|
params1.put("S",activityServicePriceTotal.doubleValue());
|
||||||
|
params1.put("E",totalPower);
|
||||||
|
|
||||||
|
int computeType = (int)judgeActivity.get("computeType");
|
||||||
|
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
if(computeType==1){
|
||||||
|
BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
internetCommission = internetCommission.add(eval);
|
||||||
|
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal.subtract(decimal1));
|
||||||
|
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(decimal1));
|
||||||
|
}else if(computeType==2){
|
||||||
|
internetSvcCommission = internetSvcCommission.add(eval);
|
||||||
|
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
|
||||||
|
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
|
||||||
|
}else{
|
||||||
|
//电量抽成
|
||||||
|
internetDegreeCommission = internetDegreeCommission.add(eval);
|
||||||
|
//减服务费
|
||||||
|
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
|
||||||
|
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
|
||||||
|
}
|
||||||
|
promotionDiscount = money.subtract(activityTotalPriceTotal);
|
||||||
|
xhpcHistoryOrder.setActivityId(judgeActivity.get("activityId").toString());
|
||||||
|
}else{
|
||||||
|
boolean activityInternet =false;
|
||||||
//yyyy-mm-dd(当前时间)
|
//yyyy-mm-dd(当前时间)
|
||||||
String parse2 = DateUtil.formatDate(startTime);
|
String parse2 = DateUtil.formatDate(startTime);
|
||||||
long time1 = startTime.getTime();
|
long time1 = startTime.getTime();
|
||||||
long time2 = endTime.getTime();
|
long time2 = endTime.getTime();
|
||||||
|
|
||||||
if( time1 != time2 && time2>time1){
|
if( time1 != time2 && time2>time1){
|
||||||
List<XhpcActivityInternetDomainDto> activityStationTime = xhpcRealTimeOrderMapper.getActivityStationTime(internetUserId, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime), xhpcChargeOrder.getChargingStationId(), xhpcChargeOrder.getTenantId());
|
List<XhpcActivityInternetDomainDto> activityStationTime = xhpcRealTimeOrderMapper.getActivityStationTime(internetUserId, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime), chargingStationId, tenantId);
|
||||||
//1时间没有跨天
|
//1时间没有跨天
|
||||||
DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||||
DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||||
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
|
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
|
||||||
|
|
||||||
if(activityStationTime !=null && activityStationTime.size()==1){
|
if(activityStationTime !=null && activityStationTime.size()==1){
|
||||||
logger.info("<<<<<<<<<<<<<<<有流量方活动>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
logger.info("<<<<<<<<<<<<<<<有流量方活动>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
||||||
judge =true;
|
judge =true;
|
||||||
@ -492,7 +588,6 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
List<XhpcActivityFormulaDomainDto> activityFormulaTime1 =new ArrayList<>();
|
List<XhpcActivityFormulaDomainDto> activityFormulaTime1 =new ArrayList<>();
|
||||||
List<XhpcActivityFormulaDomainDto> activityFormulaTime2 =new ArrayList<>();
|
List<XhpcActivityFormulaDomainDto> activityFormulaTime2 =new ArrayList<>();
|
||||||
XhpcActivityInternetDomainDto activityInternet1 =new XhpcActivityInternetDomainDto();
|
XhpcActivityInternetDomainDto activityInternet1 =new XhpcActivityInternetDomainDto();
|
||||||
Long rateModelId = xhpcChargeOrder.getRateModelId();
|
|
||||||
if(betweenDay>0){
|
if(betweenDay>0){
|
||||||
activityInternet1 = activityStationTime.get(0);
|
activityInternet1 = activityStationTime.get(0);
|
||||||
activityFormulaTime1 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet1.getActivityId(), start, "24:00:00");
|
activityFormulaTime1 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet1.getActivityId(), start, "24:00:00");
|
||||||
@ -604,15 +699,58 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
promotionDiscount = money.subtract(activityTotalPriceTotal);
|
promotionDiscount = money.subtract(activityTotalPriceTotal);
|
||||||
xhpcHistoryOrder.setActivityId(activityId);
|
xhpcHistoryOrder.setActivityId(activityId);
|
||||||
}else{
|
}else{
|
||||||
|
//按照以前流量方折扣计算
|
||||||
if(activityStationTime.size()>1){
|
if(activityStationTime.size()>1){
|
||||||
xhpcHistoryOrder.setActivityId("同一时间活动有2个");
|
xhpcHistoryOrder.setActivityId("同一时间活动有2个");
|
||||||
}else{
|
}else{
|
||||||
xhpcHistoryOrder.setActivityId("无活动");
|
xhpcHistoryOrder.setActivityId("无活动");
|
||||||
}
|
}
|
||||||
|
activityInternet =true;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
activityInternet =true;
|
||||||
xhpcHistoryOrder.setActivityId("充电开始结束时间相等不做活动");
|
xhpcHistoryOrder.setActivityId("充电开始结束时间相等不做活动");
|
||||||
}
|
}
|
||||||
|
if(activityInternet){
|
||||||
|
logger.info("无活动,流量方按照以前抽成");
|
||||||
|
String substring = internetSerialNumber.substring(0, 9);
|
||||||
|
xhpcHistoryOrder.setInternetSerialNumber(xhpcChargeOrder.getInternetSerialNumber());
|
||||||
|
Map<String, Object> operatorIdEvcs = xhpcRealTimeOrderMapper.getOperatorIdEvcs(substring);
|
||||||
|
if(operatorIdEvcs !=null){
|
||||||
|
if(operatorIdEvcs.get("operatorIdEvcs")!=null && operatorIdEvcs.get("commissionType")!=null && operatorIdEvcs.get("commissionRate")!=null){
|
||||||
|
BigDecimal commissionRate = new BigDecimal(operatorIdEvcs.get("commissionRate").toString()).divide(new BigDecimal(100));
|
||||||
|
String commissionType = operatorIdEvcs.get("commissionType").toString();
|
||||||
|
if(operatorIdEvcs.get("internetUserId") !=null){
|
||||||
|
xhpcHistoryOrder.setChargingMode(operatorIdEvcs.get("internetUserId").toString());
|
||||||
|
}
|
||||||
|
//0总金额提成 1服务费提成
|
||||||
|
if(new BigDecimal(0).compareTo(commissionRate)==-1){
|
||||||
|
if("0".equals(commissionType) || "1".equals(commissionType)|| "2".equals(commissionType)){
|
||||||
|
//流量方的钱
|
||||||
|
if("0".equals(commissionType)){
|
||||||
|
BigDecimal decimal1 = surplusPowerPrice.multiply(commissionRate).setScale(2, BigDecimal.ROUND_DOWN);
|
||||||
|
BigDecimal decimal2 = surplusServicePrice.multiply(commissionRate).setScale(2, BigDecimal.ROUND_DOWN);
|
||||||
|
internetCommission = decimal1.add(decimal2);
|
||||||
|
surplusPowerPrice =surplusPowerPrice.subtract(decimal1);
|
||||||
|
surplusServicePrice =surplusServicePrice.subtract(decimal2);
|
||||||
|
}else if("1".equals(commissionType)){
|
||||||
|
BigDecimal decimal2 = surplusServicePrice.multiply(commissionRate).setScale(2, BigDecimal.ROUND_DOWN);
|
||||||
|
internetSvcCommission = decimal2;
|
||||||
|
surplusServicePrice = surplusServicePrice.subtract(decimal2);
|
||||||
|
}else{
|
||||||
|
//电量抽成
|
||||||
|
BigDecimal chargingDegree = xhpcChargeOrder.getChargingDegree();
|
||||||
|
internetDegreeCommission = chargingDegree.multiply(new BigDecimal(operatorIdEvcs.get("commissionRate").toString())).setScale(2, BigDecimal.ROUND_DOWN);
|
||||||
|
//减服务费
|
||||||
|
surplusServicePrice = surplusServicePrice.subtract(internetDegreeCommission);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if ( !UserTypeUtil.INTERNET_TYPE.equals(source) && xhpcChargeOrder.getStartTime()!=null && xhpcChargeOrder.getEndTime()!=null) {
|
if ( !UserTypeUtil.INTERNET_TYPE.equals(source) && xhpcChargeOrder.getStartTime()!=null && xhpcChargeOrder.getEndTime()!=null) {
|
||||||
@ -1453,11 +1591,122 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
|
|
||||||
|
|
||||||
//判斷活动时间、电费、服务费、公式是否和场站一致
|
//判斷活动时间、电费、服务费、公式是否和场站一致
|
||||||
private boolean getRateOrActivityFormul(){
|
private Map<String,Object> getRateOrActivityFormul(String serialNumber,Long internetUserId,Date startTime,Date endTime,Long chargingStationId,String tenantId,Long rateModelId){
|
||||||
|
Map<String,Object> map =new HashMap<>();
|
||||||
|
List<XhpcActivityInternetDomainDto> activityStationTime = xhpcRealTimeOrderMapper.getActivityStationTime(internetUserId, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime), chargingStationId, tenantId);
|
||||||
|
if(activityStationTime !=null && activityStationTime.size()==1) {
|
||||||
|
//活动的时间、电费、服务费、公式
|
||||||
|
Integer activityId = activityStationTime.get(0).getActivityId();
|
||||||
|
int computeType = activityStationTime.get(0).getComputeType();
|
||||||
|
List<XhpcActivityFormulaDomainDto> activityFormulaList = xhpcRealTimeOrderMapper.getActivityFormulaById(activityId);
|
||||||
|
//场站的电费和服务费
|
||||||
|
List<RateTime> rateTimeList = xhpcRealTimeOrderMapper.getRateTimeList(chargingStationId, rateModelId, null);
|
||||||
|
String computeFormula = "";
|
||||||
|
if (activityFormulaList != null && rateTimeList != null && activityFormulaList.size() > 0 && activityFormulaList.size() == rateTimeList.size()) {
|
||||||
|
for (int i = 0; i < activityFormulaList.size(); i++) {
|
||||||
|
XhpcActivityFormulaDomainDto activit = activityFormulaList.get(i);
|
||||||
|
RateTime rateTime = rateTimeList.get(i);
|
||||||
|
if (activit.getStartTime().equals(rateTime.getStartTime()) && activit.getEndTime().equals(rateTime.getEndTime()) &&
|
||||||
|
activit.getServicePrice().compareTo(rateTime.getServicePrice()) == 0 && activit.getPowerPrice().compareTo(rateTime.getPowerPrice()) == 0) {
|
||||||
|
if (i == 0) {
|
||||||
|
computeFormula = activit.getComputeFormula();
|
||||||
|
} else if (i != activityFormulaList.size() - 1) {
|
||||||
|
if (!computeFormula.equals(activit.getComputeFormula())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!computeFormula.equals(activit.getComputeFormula())) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
map.put("status","1");
|
||||||
|
map.put("computeFormula",computeFormula);
|
||||||
|
map.put("activityId",activityId);
|
||||||
|
map.put("computeType",computeType);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//查看结算报文是否夸时段
|
||||||
|
Map<String, Object> cacheMap = redisService.getCacheMap("order:" + serialNumber);
|
||||||
|
if (cacheMap != null) {
|
||||||
|
CacheOrderData cacheOrderData = (CacheOrderData) cacheMap.get("orderData");
|
||||||
|
if (cacheOrderData != null) {
|
||||||
|
int number = 0;
|
||||||
|
if (!"0".equals(cacheOrderData.getT1PowerQuantity().toString())) {
|
||||||
|
number++;
|
||||||
|
rateTimeList = xhpcRealTimeOrderMapper.getRateTimeList(chargingStationId, rateModelId, "00");
|
||||||
|
}
|
||||||
|
if (!"0".equals(cacheOrderData.getT2PowerQuantity().toString())) {
|
||||||
|
number++;
|
||||||
|
rateTimeList = xhpcRealTimeOrderMapper.getRateTimeList(chargingStationId, rateModelId, "01");
|
||||||
|
}
|
||||||
|
if (!"0".equals(cacheOrderData.getT3PowerQuantity().toString())) {
|
||||||
|
number++;
|
||||||
|
rateTimeList = xhpcRealTimeOrderMapper.getRateTimeList(chargingStationId, rateModelId, "02");
|
||||||
|
}
|
||||||
|
if (!"0".equals(cacheOrderData.getT4PowerQuantity().toString())) {
|
||||||
|
number++;
|
||||||
|
rateTimeList = xhpcRealTimeOrderMapper.getRateTimeList(chargingStationId, rateModelId, "03");
|
||||||
|
}
|
||||||
|
BigDecimal powerPrice = new BigDecimal(0);
|
||||||
|
BigDecimal servicePrice = new BigDecimal(0);
|
||||||
|
if (number == 1) {
|
||||||
|
for (int i = 0; i < rateTimeList.size(); i++) {
|
||||||
|
RateTime rateTime = rateTimeList.get(i);
|
||||||
|
XhpcActivityFormulaDomainDto activity = xhpcRealTimeOrderMapper.getActivityFormulaTimeById(activityStationTime.get(0).getActivityId(), rateTime.getStartTime(), rateTime.getEndTime());
|
||||||
|
if (i == 0) {
|
||||||
|
computeFormula = activity.getComputeFormula();
|
||||||
|
powerPrice = activity.getPowerPrice();
|
||||||
|
servicePrice = activity.getServicePrice();
|
||||||
|
if(rateTimeList.size()==1){
|
||||||
|
map.put("status","2");
|
||||||
|
map.put("computeFormula",computeFormula);
|
||||||
|
map.put("powerPrice",powerPrice);
|
||||||
|
map.put("servicePrice",servicePrice);
|
||||||
|
map.put("activityId",activityId);
|
||||||
|
map.put("computeType",computeType);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
} else if (i != rateTimeList.size() - 1) {
|
||||||
|
if (computeFormula.equals(activity.getComputeFormula())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (powerPrice.compareTo(activity.getPowerPrice()) != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (servicePrice.compareTo(activity.getServicePrice()) != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (computeFormula.equals(activity.getComputeFormula())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (powerPrice.compareTo(activity.getPowerPrice()) != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (servicePrice.compareTo(activity.getServicePrice()) != 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
map.put("status","2");
|
||||||
|
map.put("computeFormula",computeFormula);
|
||||||
|
map.put("powerPrice",powerPrice);
|
||||||
|
map.put("servicePrice",servicePrice);
|
||||||
|
map.put("activityId",activityId);
|
||||||
|
map.put("computeType",computeType);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
map.put("status","0");
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -827,4 +827,46 @@
|
|||||||
order by xad.start_time asc
|
order by xad.start_time asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getActivityFormulaById" resultType="com.xhpc.order.dto.XhpcActivityFormulaDomainDto">
|
||||||
|
select
|
||||||
|
activity_formula_id as activityFormulaId,
|
||||||
|
activity_id as activityId,
|
||||||
|
start_time as startTime,
|
||||||
|
end_time as endTime,
|
||||||
|
service_price as servicePrice,
|
||||||
|
power_price as powerPrice,
|
||||||
|
compute_formula as computeFormula
|
||||||
|
from xhpc_activity_formula
|
||||||
|
where activity_id = #{activityId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRateTimeList" resultType="com.xhpc.order.dto.RateTime">
|
||||||
|
select
|
||||||
|
start_time as startTime,
|
||||||
|
replace(end_time, '00:00:00', '24:00:00') as endTime,
|
||||||
|
power_fee as powerPrice,
|
||||||
|
service_fee as servicePrice
|
||||||
|
from xhpc_rate_time as xrt
|
||||||
|
left join xhpc_rate as xr on xrt.rate_id = xr.rate_id
|
||||||
|
where xrt.charging_station_id=#{chargingStationId} and xrt.rate_model_id=#{rateModelId} and xrt.del_flag=0
|
||||||
|
<if test="rateValue !=null and rateValue !=''">
|
||||||
|
and xrt.rate_value =#{rateValue}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getActivityFormulaTimeById" resultType="com.xhpc.order.dto.XhpcActivityFormulaDomainDto">
|
||||||
|
select
|
||||||
|
activity_formula_id as activityFormulaId,
|
||||||
|
activity_id as activityId,
|
||||||
|
start_time as startTime,
|
||||||
|
end_time as endTime,
|
||||||
|
service_price as servicePrice,
|
||||||
|
power_price as powerPrice,
|
||||||
|
compute_formula as computeFormula
|
||||||
|
from xhpc_activity_formula
|
||||||
|
where activity_id = #{activityId}
|
||||||
|
and start_time >= #{startTime} AND end_time <= #{endTime}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user