小程序首页、站点详情、时间段增加优惠金额显示
This commit is contained in:
parent
4ab77c7fa9
commit
fe05c3c6da
@ -0,0 +1,122 @@
|
|||||||
|
package com.xhpc.charging.station.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2022/4/19 13:57
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class XhpcActivityDiscountDto implements Serializable {
|
||||||
|
/**
|
||||||
|
* 活动ID
|
||||||
|
*/
|
||||||
|
private Integer activityId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动名称
|
||||||
|
*/
|
||||||
|
private String activityName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板ID
|
||||||
|
*/
|
||||||
|
private Integer templateId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C端用户列表(以逗号分隔,-1表示全部用户)
|
||||||
|
*/
|
||||||
|
private String appUserList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社区用户列表(以逗号分隔,-1表示全部用户)
|
||||||
|
*/
|
||||||
|
private String comUserList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B端用户列表(以逗号分隔,-1表示全部用户)
|
||||||
|
*/
|
||||||
|
private String cusUserList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场站列表
|
||||||
|
*/
|
||||||
|
private String stationList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始时间
|
||||||
|
*/
|
||||||
|
private Date startTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束时间
|
||||||
|
*/
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0-编辑,1-提交待审核,2-审核失败,3-审核通过,4-立即失效)
|
||||||
|
*/
|
||||||
|
private Short status = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标识(0-正常,2-删除)
|
||||||
|
*/
|
||||||
|
private Short delFlag = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核人
|
||||||
|
*/
|
||||||
|
private String checkBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核时间
|
||||||
|
*/
|
||||||
|
private Date checkTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠类型(1-总金额,2-服务费,3-电量)
|
||||||
|
*/
|
||||||
|
private Integer discountType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠比率
|
||||||
|
*/
|
||||||
|
private BigDecimal discountRate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
package com.xhpc.charging.station.mapper;
|
package com.xhpc.charging.station.mapper;
|
||||||
|
|
||||||
import com.xhpc.common.api.dto.ChargingPileDto;
|
import com.xhpc.charging.station.dto.XhpcActivityDiscountDto;
|
||||||
import com.xhpc.common.domain.XhpcChargingStation;
|
import com.xhpc.common.domain.XhpcChargingStation;
|
||||||
import com.xhpc.common.domain.XhpcRate;
|
import com.xhpc.common.domain.XhpcRate;
|
||||||
import com.xhpc.common.domain.XhpcRateModel;
|
import com.xhpc.common.domain.XhpcRateModel;
|
||||||
@ -268,4 +268,12 @@ public interface XhpcChargingStationMapper {
|
|||||||
*/
|
*/
|
||||||
void insertXhpcUserPrivilege(@Param("userId") Long userId,@Param("chargingStationId") Long chargingStationId);
|
void insertXhpcUserPrivilege(@Param("userId") Long userId,@Param("chargingStationId") Long chargingStationId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询开始时间是否在活动中
|
||||||
|
*/
|
||||||
|
List<XhpcActivityDiscountDto> getActivityDiscountTime(@Param("internetUserId")Long internetUserId, @Param("startTime")String startTime, @Param("userType")Integer userType, @Param("chargingStationId")Long chargingStationId, @Param("tenantId")String tenantId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.xhpc.charging.station.service;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.xhpc.charging.station.dto.XhpcActivityDiscountDto;
|
||||||
import com.xhpc.charging.station.mapper.XhpcChargingStationMapper;
|
import com.xhpc.charging.station.mapper.XhpcChargingStationMapper;
|
||||||
import com.xhpc.charging.station.mapper.XhpcChargingStationPushStatusMapper;
|
import com.xhpc.charging.station.mapper.XhpcChargingStationPushStatusMapper;
|
||||||
import com.xhpc.common.api.PowerPileService;
|
import com.xhpc.common.api.PowerPileService;
|
||||||
@ -761,6 +762,10 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
if(null==longitude||"".equals(longitude)||null==latitude||"".equals(latitude)){
|
if(null==longitude||"".equals(longitude)||null==latitude||"".equals(latitude)){
|
||||||
longitude="104.065861"; latitude="30.657401";
|
longitude="104.065861"; latitude="30.657401";
|
||||||
}
|
}
|
||||||
|
//检查是否有用户登录
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<String> stringList = new ArrayList<>();
|
List<String> stringList = new ArrayList<>();
|
||||||
if (serviceFacilities != null && serviceFacilities != "") {
|
if (serviceFacilities != null && serviceFacilities != "") {
|
||||||
@ -772,6 +777,32 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
if (list != null && list.size() > 0) {
|
if (list != null && list.size() > 0) {
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
Map<String, Object> map = list.get(i);
|
Map<String, Object> map = list.get(i);
|
||||||
|
|
||||||
|
BigDecimal serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||||
|
BigDecimal powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||||
|
|
||||||
|
if(loginUser !=null){
|
||||||
|
//判断是否享受活动
|
||||||
|
Map<String, Object> objectMap = activityDiscountTime(loginUser.getUserid(), new Date(), loginUser.getUserType(), Long.valueOf(map.get("chargingStationId").toString()), loginUser.getTenantId());
|
||||||
|
if("1".equals(objectMap.get("state").toString())){
|
||||||
|
if("1".equals(objectMap.get("totalDiscountType").toString())||"3".equals(objectMap.get("totalDiscountType").toString())){
|
||||||
|
BigDecimal discountRate = new BigDecimal(objectMap.get("totalDiscountRate").toString()).divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
serviceFee = serviceFee.subtract(serviceFee.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||||
|
powerFee = powerFee.subtract(powerFee.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||||
|
map.put("activityServiceFee", serviceFee);
|
||||||
|
map.put("activityPowerFee", powerFee);
|
||||||
|
map.put("activityMoney", serviceFee.add(powerFee));
|
||||||
|
}else{
|
||||||
|
BigDecimal discountRate = new BigDecimal(objectMap.get("totalDiscountRate").toString()).divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
serviceFee = serviceFee.subtract(serviceFee.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||||
|
map.put("activityServiceFee", serviceFee);
|
||||||
|
map.put("activityPowerFee", powerFee);
|
||||||
|
map.put("activityMoney", serviceFee.add(powerFee));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logger.info("==========loginUser========是空");
|
||||||
|
}
|
||||||
//桩(空闲和使用从redis获取)
|
//桩(空闲和使用从redis获取)
|
||||||
Map<String, Object> map1 =new HashMap<>();
|
Map<String, Object> map1 =new HashMap<>();
|
||||||
map1 = getTerminalStatusSum(map1, Long.valueOf(map.get("chargingStationId").toString()), 0);
|
map1 = getTerminalStatusSum(map1, Long.valueOf(map.get("chargingStationId").toString()), 0);
|
||||||
@ -793,8 +824,7 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
}
|
}
|
||||||
//获取基本信息
|
//获取基本信息
|
||||||
Map<String, Object> map = xhpcChargingStationMapper.getWXXhpcChargingStationMessage(chargingStationId, longitude, latitude);
|
Map<String, Object> map = xhpcChargingStationMapper.getWXXhpcChargingStationMessage(chargingStationId, longitude, latitude);
|
||||||
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
//桩(空闲和使用从redis获取)
|
|
||||||
|
|
||||||
Map<String, Object> map1 =new HashMap<>();
|
Map<String, Object> map1 =new HashMap<>();
|
||||||
map1 = getTerminalStatusSum(map1, chargingStationId, 0);
|
map1 = getTerminalStatusSum(map1, chargingStationId, 0);
|
||||||
@ -803,7 +833,6 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
}else{
|
}else{
|
||||||
map.put("free", 0);
|
map.put("free", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//图片信息
|
//图片信息
|
||||||
if (map !=null &&map.get("imgId") != null && map.get("imgId").toString() != "") {
|
if (map !=null &&map.get("imgId") != null && map.get("imgId").toString() != "") {
|
||||||
String[] split = map.get("imgId").toString().split(",");
|
String[] split = map.get("imgId").toString().split(",");
|
||||||
@ -821,14 +850,34 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
map.put("imgIdList", new ArrayList<>());
|
map.put("imgIdList", new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//获取该时段电费
|
//获取该时段电费
|
||||||
//HH:mm:ss
|
//HH:mm:ss
|
||||||
String tiem = DateUtil.formatTime(new Date());
|
String tiem = DateUtil.formatTime(new Date());
|
||||||
Map<String, Object> xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId);
|
Map<String, Object> xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId);
|
||||||
if (xhpcRateTime != null) {
|
if (xhpcRateTime != null) {
|
||||||
|
//桩(空闲和使用从redis获取)
|
||||||
|
BigDecimal serviceFee =new BigDecimal(xhpcRateTime.get("serviceFee").toString());
|
||||||
|
BigDecimal powerFee =new BigDecimal(xhpcRateTime.get("powerFee").toString());
|
||||||
|
if(loginUser !=null){
|
||||||
|
//判断是否享受活动
|
||||||
|
Map<String, Object> objectMap = activityDiscountTime(loginUser.getUserid(), new Date(), loginUser.getUserType(), Long.valueOf(map.get("chargingStationId").toString()), loginUser.getTenantId());
|
||||||
|
if("1".equals(objectMap.get("state").toString())){
|
||||||
|
if("1".equals(objectMap.get("totalDiscountType").toString())||"3".equals(objectMap.get("totalDiscountType").toString())){
|
||||||
|
BigDecimal discountRate = new BigDecimal(objectMap.get("totalDiscountRate").toString()).divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
serviceFee = serviceFee.subtract(serviceFee.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||||
|
powerFee = powerFee.subtract(powerFee.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||||
|
map.put("activityServiceFee", serviceFee);
|
||||||
|
map.put("activityPowerFee", powerFee);
|
||||||
|
map.put("activityMoney", serviceFee.add(powerFee));
|
||||||
|
}else{
|
||||||
|
BigDecimal discountRate = new BigDecimal(objectMap.get("totalDiscountRate").toString()).divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
serviceFee = serviceFee.subtract(serviceFee.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||||
|
map.put("activityServiceFee", serviceFee);
|
||||||
|
map.put("activityPowerFee", powerFee);
|
||||||
|
map.put("activityMoney", serviceFee.add(powerFee));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
map.putAll(xhpcRateTime);
|
map.putAll(xhpcRateTime);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
@ -836,8 +885,34 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getWXXhpcRateTimeMassage(Long chargingStationId) {
|
public List<Map<String, Object>> getWXXhpcRateTimeMassage(Long chargingStationId) {
|
||||||
|
List<Map<String, Object>> list = xhpcChargingStationMapper.getWXXhpcRateTimeMassage(chargingStationId);
|
||||||
return xhpcChargingStationMapper.getWXXhpcRateTimeMassage(chargingStationId);
|
LoginUser loginUser = tokenService.getLoginUser();
|
||||||
|
for (int i = 0; i <list.size() ; i++) {
|
||||||
|
Map<String, Object> map = list.get(i);
|
||||||
|
BigDecimal serviceFee =new BigDecimal(map.get("serviceFee").toString());
|
||||||
|
BigDecimal powerFee =new BigDecimal(map.get("powerFee").toString());
|
||||||
|
if(loginUser !=null){
|
||||||
|
//判断是否享受活动
|
||||||
|
Map<String, Object> objectMap = activityDiscountTime(loginUser.getUserid(), new Date(), loginUser.getUserType(), chargingStationId, loginUser.getTenantId());
|
||||||
|
if("1".equals(objectMap.get("state").toString())){
|
||||||
|
if("1".equals(objectMap.get("totalDiscountType").toString())||"3".equals(objectMap.get("totalDiscountType").toString())){
|
||||||
|
BigDecimal discountRate = new BigDecimal(objectMap.get("totalDiscountRate").toString()).divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
serviceFee = serviceFee.subtract(serviceFee.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||||
|
powerFee = powerFee.subtract(powerFee.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||||
|
map.put("activityServiceFee", serviceFee);
|
||||||
|
map.put("activityPowerFee", powerFee);
|
||||||
|
map.put("activityMoney", serviceFee.add(powerFee));
|
||||||
|
}else{
|
||||||
|
BigDecimal discountRate = new BigDecimal(objectMap.get("totalDiscountRate").toString()).divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
serviceFee = serviceFee.subtract(serviceFee.multiply(discountRate).setScale(2,BigDecimal.ROUND_HALF_UP));
|
||||||
|
map.put("activityServiceFee", serviceFee);
|
||||||
|
map.put("activityPowerFee", powerFee);
|
||||||
|
map.put("activityMoney", serviceFee.add(powerFee));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1324,4 +1399,74 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
|||||||
return xhpcChargingStation != null;
|
return xhpcChargingStation != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//判断是否有活动
|
||||||
|
public Map<String,Object> activityDiscountTime(Long userId,Date startTime,Integer source,Long chargingStationId,String tenantId){
|
||||||
|
Map<String,Object> map =new HashMap<>();
|
||||||
|
List<XhpcActivityDiscountDto> activityDiscountTime = xhpcChargingStationMapper.getActivityDiscountTime(userId, DateUtil.formatDateTime(startTime), source, chargingStationId, tenantId);
|
||||||
|
if(activityDiscountTime !=null && activityDiscountTime.size()>0){
|
||||||
|
|
||||||
|
//折扣电费、服务费
|
||||||
|
BigDecimal totalDiscountRate =new BigDecimal(0);
|
||||||
|
int totalDiscountType = 0;
|
||||||
|
for (int i = 0; i < activityDiscountTime.size(); i++) {
|
||||||
|
XhpcActivityDiscountDto activity = activityDiscountTime.get(i);
|
||||||
|
BigDecimal discountRate = activity.getDiscountRate();
|
||||||
|
Integer discountType = activity.getDiscountType();
|
||||||
|
if(discountType.equals(1)){
|
||||||
|
if(totalDiscountType==0){
|
||||||
|
totalDiscountRate =discountRate;
|
||||||
|
totalDiscountType = 1;
|
||||||
|
}else if(totalDiscountType==1 || totalDiscountType==3){
|
||||||
|
if(totalDiscountRate.compareTo(discountRate)<0){
|
||||||
|
totalDiscountRate =discountRate;
|
||||||
|
totalDiscountType=1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(totalDiscountRate.compareTo(discountRate.multiply(new BigDecimal(2)))<0){
|
||||||
|
totalDiscountRate =discountRate;
|
||||||
|
totalDiscountType = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(discountType.equals(2)){
|
||||||
|
if(totalDiscountType==0){
|
||||||
|
totalDiscountRate =discountRate;
|
||||||
|
totalDiscountType = 2;
|
||||||
|
}else if(totalDiscountType==1 || totalDiscountType==3){
|
||||||
|
if(totalDiscountRate.multiply(new BigDecimal(2)).compareTo(discountRate)<0){
|
||||||
|
totalDiscountRate =discountRate;
|
||||||
|
totalDiscountType = 2;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if(totalDiscountRate.compareTo(discountRate)<0){
|
||||||
|
totalDiscountRate =discountRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//电量抽成
|
||||||
|
if(totalDiscountType==0){
|
||||||
|
totalDiscountRate =discountRate;
|
||||||
|
totalDiscountType = 3;
|
||||||
|
}else if(totalDiscountType==1 || totalDiscountType==3){
|
||||||
|
if(totalDiscountRate.compareTo(discountRate)<0){
|
||||||
|
totalDiscountRate =discountRate;
|
||||||
|
totalDiscountType = 3;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(totalDiscountRate.multiply(new BigDecimal(2)).compareTo(discountRate)<0){
|
||||||
|
totalDiscountRate =discountRate;
|
||||||
|
totalDiscountType = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put("state","1");
|
||||||
|
map.put("totalDiscountRate",totalDiscountRate);
|
||||||
|
map.put("totalDiscountType",totalDiscountType+"");
|
||||||
|
}else{
|
||||||
|
map.put("state","0");
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -299,6 +299,30 @@
|
|||||||
charging_station_id=cs.charging_station_id) as common,
|
charging_station_id=cs.charging_station_id) as common,
|
||||||
(select GROUP_CONCAT(serial_number) from xhpc_terminal where status=0 and del_flag =0 and
|
(select GROUP_CONCAT(serial_number) from xhpc_terminal where status=0 and del_flag =0 and
|
||||||
charging_station_id=cs.charging_station_id) as serialNumbers,
|
charging_station_id=cs.charging_station_id) as serialNumbers,
|
||||||
|
(select (ra.service_fee) as serviceFee
|
||||||
|
from xhpc_rate as ra
|
||||||
|
where ra.status = 0
|
||||||
|
and ra.del_flag = 0
|
||||||
|
and ra.rate_id = (
|
||||||
|
select rate_id from xhpc_rate_time
|
||||||
|
where charging_station_id = cs.charging_station_id
|
||||||
|
and cs.rate_model_id = rate_model_id
|
||||||
|
and start_time <= #{date}
|
||||||
|
and replace(end_time, '00:00:00', '24:00:00') >= #{date}
|
||||||
|
and status = 0
|
||||||
|
and del_flag = 0)) serviceFee,
|
||||||
|
(select (ra.power_fee) as powerFee
|
||||||
|
from xhpc_rate as ra
|
||||||
|
where ra.status = 0
|
||||||
|
and ra.del_flag = 0
|
||||||
|
and ra.rate_id = (
|
||||||
|
select rate_id from xhpc_rate_time
|
||||||
|
where charging_station_id = cs.charging_station_id
|
||||||
|
and cs.rate_model_id = rate_model_id
|
||||||
|
and start_time <= #{date}
|
||||||
|
and replace(end_time, '00:00:00', '24:00:00') >= #{date}
|
||||||
|
and status = 0
|
||||||
|
and del_flag = 0)) powerFee,
|
||||||
(select (ra.power_fee+ra.service_fee) as serviceFee
|
(select (ra.power_fee+ra.service_fee) as serviceFee
|
||||||
from xhpc_rate as ra
|
from xhpc_rate as ra
|
||||||
where ra.status = 0
|
where ra.status = 0
|
||||||
@ -937,4 +961,43 @@
|
|||||||
</if>
|
</if>
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="getActivityDiscountTime" resultType="com.xhpc.charging.station.dto.XhpcActivityDiscountDto">
|
||||||
|
select
|
||||||
|
xad.activity_id as activityId,
|
||||||
|
xad.activity_name as activityName,
|
||||||
|
xad.template_id as templateId,
|
||||||
|
xad.app_user_list as appUserList,
|
||||||
|
xad.com_user_list as comUserList,
|
||||||
|
xad.cus_user_list as cusUserList,
|
||||||
|
xad.station_list as stationList,
|
||||||
|
xad.tenant_id as tenantId,
|
||||||
|
xad.start_time as startTime,
|
||||||
|
xad.end_time as endTime,
|
||||||
|
xad.status as status,
|
||||||
|
xad.del_flag as delFlag,
|
||||||
|
xad.create_by as createBy,
|
||||||
|
xad.create_time as createTime,
|
||||||
|
xad.update_by as updateBy,
|
||||||
|
xad.update_time as updateTime,
|
||||||
|
xad.check_by as checkBy,
|
||||||
|
xad.check_time as checkTime,
|
||||||
|
xat.discount_type discountType,
|
||||||
|
xat.discount_rate discountRate
|
||||||
|
from xhpc_activity_discount as xad
|
||||||
|
join xhpc_activity_template as xat on xat.activity_template_id = xad.template_id and xat.del_flag =0 and xat.status=1
|
||||||
|
where xad.tenant_id=#{tenantId} and xad.status=3 and xad.del_flag =0
|
||||||
|
and find_in_set(#{chargingStationId}, xad.station_list)
|
||||||
|
<if test="userType ==0">
|
||||||
|
and (find_in_set(#{internetUserId}, xad.app_user_list) or xad.app_user_list='-1')
|
||||||
|
</if>
|
||||||
|
<if test="userType ==2">
|
||||||
|
and (find_in_set(#{internetUserId}, xad.com_user_list) or xad.com_user_list='-1')
|
||||||
|
</if>
|
||||||
|
<if test="userType ==3">
|
||||||
|
and (find_in_set(#{internetUserId}, xad.cus_user_list) or xad.cus_user_list='-1')
|
||||||
|
</if>
|
||||||
|
and xad.start_time <=#{startTime} and xad.end_time > #{startTime}
|
||||||
|
order by xad.start_time asc
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user