占位费管理

This commit is contained in:
2265829957@qq.com 2025-05-13 09:35:48 +08:00
parent 9bbb9e5e3f
commit b20365948e
25 changed files with 1403 additions and 265 deletions

View File

@ -82,11 +82,12 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
// horder.setXhpcStatisticsTimeIntervalList(statisticsTimeIntervals); //似乎并不需要
ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(horder);
final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretToken);
logger.info("==============推送开始======================="+horder.getSerialNumber());
if (pushResp != null) {
horder.setConfirmResult(pushResp.getConfirmResult());
logger.debug("3rd part order {} push result: {}", horder.getSerialNumber(),
pushResp.getConfirmResult());
//logger.info("==============推送返回值================="+pushResp.toString());
logger.info("==============推送返回值================="+pushResp.getConfirmResult()+"=========="+horder.getSerialNumber());
xhpcHistoryOrderRepository.save(horder);
REDIS.setCacheMapValue("pushOrder:".concat(horder.getSerialNumber()), "horderpushed", true);
} else {

View File

@ -88,9 +88,10 @@ public class XhpcChargingStationApiController extends BaseController {
}
@GetMapping(value = "/getPlaceholderTimeMassage")
public AjaxResult getPlaceholderTimeMassage(@RequestParam Long chargingStationId) {
return AjaxResult.success(xhpcChargingStationService.getPlaceholderTimeMassage(chargingStationId));
}
}

View File

@ -162,7 +162,9 @@ public interface XhpcChargingStationMapper {
*/
List<Map<String, Object>> getWXXhpcRateTimeMassage(@Param("chargingStationId") Long chargingStationId);
List<Map<String, Object>> getPlaceholderTimeMassage(@Param("chargingStationId") Long chargingStationId);
Map<String, Object> getPlaceholderTime(@Param("date") String date, @Param("datchargingStationId") Long datchargingStationId);
/**
* 电站详情---终端列表
*

View File

@ -34,4 +34,6 @@ public interface XhpcRateTimeMapper {
Map<String, Object> getXhpcRateTimeType(@Param("datchargingStationId") Long datchargingStationId);
}

View File

@ -129,4 +129,6 @@ public interface XhpcTerminalMapper {
*/
List<XhpcTerminal> selectXhpcTerminalIdByPileIds(ArrayList<Long> pileIds);
Map<String, Object> getPlaceholderTime(@Param("date") String date, @Param("datchargingStationId") Long datchargingStationId);
}

View File

@ -173,6 +173,7 @@ public interface IXhpcChargingStationService {
*/
List<Map<String, Object>> getWXXhpcTerminalMassage(Long chargingStationId);
List<Map<String, Object>> getPlaceholderTimeMassage(Long chargingStationId);
/**
* 编辑电站基本信息
*

View File

@ -21,4 +21,7 @@ public interface IXhpcRateTimeService {
*/
public Map<String, Object> getXhpcRateTime(String date, Long datchargingStationIde);
}

View File

@ -904,55 +904,59 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
} else {
map.put("imgIdList", new ArrayList<>());
}
//获取该时段电费
//HH:mm:ss
String tiem = DateUtil.formatTime(new Date());
Map<String, Object> xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId);
if (xhpcRateTime != null) {
//空闲和使用从redis获取
BigDecimal serviceFee =new BigDecimal(xhpcRateTime.get("serviceFee").toString());
BigDecimal powerFee =new BigDecimal(xhpcRateTime.get("powerFee").toString());
if(loginUser !=null){
System.out.println("==111======用户登录======");
//判断是否享受活动
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 if ("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).divide(new BigDecimal(2),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));
}
if(objectMap.get("appletActivityName") !=null && !"".equals(objectMap.get("appletActivityName").toString())){
map.put("appletActivityName", objectMap.get("appletActivityName").toString());
}else{
map.put("appletActivityName", "");
}
map.put("activityState", 1);
String tiem = DateUtil.formatTime(new Date());
Map<String, Object> xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId);
if (xhpcRateTime != null) {
//空闲和使用从redis获取
BigDecimal serviceFee =new BigDecimal(xhpcRateTime.get("serviceFee").toString());
BigDecimal powerFee =new BigDecimal(xhpcRateTime.get("powerFee").toString());
if(loginUser !=null){
System.out.println("==111======用户登录======");
//判断是否享受活动
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 if ("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).divide(new BigDecimal(2),2,BigDecimal.ROUND_HALF_UP));
map.put("activityServiceFee", serviceFee);
map.put("activityPowerFee", powerFee);
map.put("activityMoney", serviceFee.add(powerFee));
}else{
System.out.println("==222======用户登录======");
map.put("activityState", 0);
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));
}
if(objectMap.get("appletActivityName") !=null && !"".equals(objectMap.get("appletActivityName").toString())){
map.put("appletActivityName", objectMap.get("appletActivityName").toString());
}else{
map.put("appletActivityName", "");
}
map.put("activityState", 1);
}else{
System.out.println("===333=====用户登录======");
System.out.println("==222======用户登录======");
map.put("activityState", 0);
}
map.putAll(xhpcRateTime);
}else{
System.out.println("===333=====用户登录======");
map.put("activityState", 0);
}
map.putAll(xhpcRateTime);
}
//获取该时段占位费电费
Map<String, Object> placeholderTime = xhpcChargingStationMapper.getPlaceholderTime(tiem, chargingStationId);
if(placeholderTime !=null){
map.putAll(placeholderTime);
}
}catch (Exception e){
e.printStackTrace();
}
@ -1007,6 +1011,12 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
return list;
}
@Override
public List<Map<String, Object>> getPlaceholderTimeMassage(Long chargingStationId) {
List<Map<String, Object>> list = xhpcChargingStationMapper.getPlaceholderTimeMassage(chargingStationId);
return list;
}
@Override
public List<Map<String, Object>> getWXXhpcTerminalMassage(Long chargingStationId) {

View File

@ -134,10 +134,16 @@ public class XhpcTerminalServiceImpl extends BaseService implements IXhpcTermina
if (map == null || map.get("chargingStationId") == null) {
return AjaxResult.error(1007, "无效的终端编码");
}
String tiem = DateUtil.formatTime(new Date());
//获取桩的状态
Long chargingStationId = Long.parseLong(map.get("chargingStationId").toString());
//HH:mm:ss
String tiem = DateUtil.formatTime(new Date());
//获取该时段占位费电费
Map<String, Object> placeholderTime = xhpcTerminalMapper.getPlaceholderTime(tiem, chargingStationId);
if(placeholderTime !=null){
map.putAll(placeholderTime);
}
Map<String, Object> xhpcRateTime = xhpcRateTimeService.getXhpcRateTime(tiem, chargingStationId);
LoginUser loginUser = tokenService.getLoginUser();

View File

@ -512,6 +512,7 @@
cs.name as name,
cs.longitude as longitude,
cs.latitude as latitude,
xp.content as content,
cs.parking_instructions as parkingInstructions,
cs.detailed_address as detailedAddress,
cs.service_facilities as serviceFacilities,
@ -528,7 +529,7 @@
from xhpc_charging_station as cs
left JOIN xhpc_rate_time as xrt on xrt.charging_station_id =cs.charging_station_id and cs.rate_model_id = xrt.rate_model_id and xrt.start_time &lt;= #{date} and replace(xrt.end_time, '00:00:00', '24:00:00') &gt;= #{date} and xrt.status = 0 and xrt.del_flag = 0
LEFT JOIN xhpc_rate as ra on ra.rate_id =xrt.rate_id
LEFT JOIN xhpc_placeholder as xp on xp.charging_station_id =cs.charging_station_id and xp.status =1 and xp.del_flag =0
where cs.del_flag =0 and cs.status =0
and FIND_IN_SET(#{clientVisible},cs.client_visible)>0
<if test="name !=null and name !=''">
@ -562,8 +563,11 @@
</select>
<select id="getWXXhpcChargingStationMessage" resultType="java.util.Map">
select charging_station_id as chargingStationId,
longitude,latitude,
select cs.charging_station_id as chargingStationId,
cs.longitude,latitude,
xp.content as content,
xp.free_time AS freeTime,
xp.max_fee AS maxFee,
(select type
from xhpc_charging_pile
where charging_station_id = charging_station_id
@ -571,22 +575,22 @@
and status = 0 limit 1) as type,
(select count(terminal_id) from xhpc_terminal where status=0 and del_flag =0 and charging_station_id=#{chargingStationId}) as common,
(select GROUP_CONCAT(dict_value) from xhpc_dict_biz where FIND_IN_SET(dict_key,service_facilities ) and code= 'service_facilities' and parent_id > 0 and del_flag = 0) as serviceFacilitiesName,
name as name,
reminder_instructions as reminderInstructions,
detailed_address as detailedAddress,
parking_instructions as parkingInstructions,
business_instructions as businessInstructions,
service_facilities as serviceFacilities,
img_id as imgId,
remark as remark,
ifnull(barrier_gate_id,0) as barrierGateType,
ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180) * SIN((latitude * 3.141593) / 180) + COS((#{latitude} * 3.141593) / 180) * COS((latitude * 3.141593) / 180) * COS((#{longitude} * 3.141593) / 180 - (longitude * 3.141593) / 180)) * 6370.9968,
cs.name as name,
cs.reminder_instructions as reminderInstructions,
cs.detailed_address as detailedAddress,
cs.parking_instructions as parkingInstructions,
cs.business_instructions as businessInstructions,
cs.service_facilities as serviceFacilities,
cs.img_id as imgId,
cs.remark as remark,
ifnull(cs.barrier_gate_id,0) as barrierGateType,
ROUND(ACOS(SIN((#{latitude} * 3.141593) / 180) * SIN(( cs.latitude * 3.141593) / 180) + COS((#{latitude} * 3.141593) / 180) * COS(( cs.latitude * 3.141593) / 180) * COS((#{longitude} * 3.141593) / 180 - ( cs.longitude * 3.141593) / 180)) * 6370.9968,
2) AS distance
from xhpc_charging_station
where charging_station_id = #{chargingStationId}
and del_flag = 0
and status = 0
from xhpc_charging_station cs
LEFT JOIN xhpc_placeholder as xp on xp.charging_station_id =cs.charging_station_id and xp.status =1 and xp.del_flag =0
where cs.charging_station_id = #{chargingStationId}
and cs.del_flag = 0
and cs.status = 0
</select>
<select id="getImageList" resultType="java.util.Map">
@ -615,6 +619,27 @@
order by xrt.sort asc
</select>
<select id="getPlaceholderTimeMassage" resultType="map">
select
start_time as startTime,
replace(end_time, '00:00:00', '24:00:00') as endTime,
price as price
from xhpc_placeholder_time
where charging_station_id=#{chargingStationId} and del_flag =0
</select>
<select id="getPlaceholderTime" resultType="map">
select
price as placeholderPrice,
start_time as placeholderStartTime,
end_time as placeholderEndTime
from xhpc_placeholder_time
where charging_station_id = #{datchargingStationId}
and start_time &lt;= #{date}
and replace(end_time, '00:00:00', '24:00:00') &gt;= #{date}
and del_flag = 0
limit 1
</select>
<select id="getWXXhpcTerminalMassage" resultType="java.util.Map">
select te.name as name,

View File

@ -129,6 +129,9 @@
<if test="null != price ">
price,
</if>
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != delFlag ">
del_flag,
</if>
@ -164,6 +167,9 @@
<if test="null != price ">
#{price},
</if>
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != delFlag ">
#{delFlag},
</if>

View File

@ -365,10 +365,14 @@
cp.auxiliary_power_supply as auxiliaryPowerSupply,
ct.parking_instructions as parkingInstructions,
ct.create_time as createTime,
xp.content as content,
xp.max_fee as maxFee,
xp.free_time as freeTime,
ter.charging_station_id as chargingStationId
from xhpc_terminal as ter
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
left join xhpc_charging_station as ct on ct.charging_station_id = ter.charging_station_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
left join xhpc_charging_station as ct on ct.charging_station_id = ter.charging_station_id
LEFT JOIN xhpc_placeholder as xp on xp.charging_station_id =ct.charging_station_id and xp.status =1 and xp.del_flag =0
where ter.serial_number = #{pNum}
and ter.del_flag = 0
order by ter.number desc
@ -427,4 +431,18 @@
#{pileId}
</foreach>
</select>
<select id="getPlaceholderTime" resultType="map">
select
price as placeholderPrice,
start_time as placeholderStartTime,
end_time as placeholderEndTime
from xhpc_placeholder_time
where charging_station_id = #{datchargingStationId}
and start_time &lt;= #{date}
and replace(end_time, '00:00:00', '24:00:00') &gt;= #{date}
and del_flag = 0
limit 1
</select>
</mapper>

View File

@ -1,6 +1,5 @@
package com.xhpc.common.domain;
import com.xhpc.common.core.annotation.Excel;
import com.xhpc.common.core.web.domain.BaseEntity;
import lombok.Data;

View File

@ -43,7 +43,10 @@ public class XhpcPlaceholderOrder extends BaseEntity {
private BigDecimal totalMoney;
private BigDecimal price;
private String tenantId;
private String delFlag;
private String chargingMode;
private String driverId;
private String plateNum;
public XhpcPlaceholderOrder() {
}

View File

@ -60,12 +60,7 @@ public class XhpcPileRegularInspectController extends BaseController {
//定期抄发管理员定时任务
//占位费定时任务
@Scheduled(cron = "0/10 * * * * ? ")
public void getxhpcPlaceholderOrderTime()
{
xhpcPileRegularInspectService.getTimingPriceTime();
}

View File

@ -0,0 +1,95 @@
package com.xhpc.order.controller;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.order.service.IXhpcPlaceholderOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.Scope;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* 占位费订单
*
* @author yuyang
* @Date 2025-05-06 10:06
*/
@EnableScheduling
@RestController
@RequestMapping("/placeholderOrder")
@Api(value = "占位费订单", tags = "占位费订单")
public class XhpcPlaceholderOrderController extends BaseController {
@Resource
IXhpcPlaceholderOrderService xhpcPlaceholderOrderService;
@GetMapping("/getListPage")
public TableDataInfo getListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, @RequestParam("status")Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, @RequestParam("userId") Long userId, Integer type,
String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult)
{
List<Map<String, Object>> listPage = xhpcPlaceholderOrderService.getListPage(tenantId,chargingStationId,chargingPileId,terminalId,phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult);
return getDataTable(listPage);
}
/**
* 历史订单导出
* @param response 返回数据流
* @throws IOException 文件创建异常
*/
@PostMapping("/export")
public void getExport(HttpServletResponse response,
String tenantId,
Long chargingStationId,
Long chargingPileId,
Long terminalId,
String phone,
String transactionNumber,
@RequestParam("status")Integer status,
String chargingStationName,
Long operatorId,
Integer source,
String beginStartTime,
String beginEndTime,
@RequestParam("userId") Long userId,
Integer type,
String affiliationOrganization,
String evcsOrderNo,
String plateNum,
Integer internetId,
String internetSerialNumber,
String terminalName,
String vinCode,
String overStartTime,
String overEndTime,
Long personnelId,
Integer confirmResult) throws IOException {
xhpcPlaceholderOrderService.export(response,tenantId,chargingStationId,chargingPileId,terminalId, phone, transactionNumber, status, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type,affiliationOrganization,evcsOrderNo,plateNum,internetId,internetSerialNumber,terminalName,vinCode,overStartTime,overEndTime,personnelId,confirmResult);
}
@GetMapping("/getById")
public R getById(@RequestParam("placeholderOrderId")Long placeholderOrderId){
return xhpcPlaceholderOrderService.getById(placeholderOrderId);
}
//定时任务查询状态
@Scheduled(cron = "0/30 * * * * ? ")
public void getxhpcPlaceholderOrderTime() {
xhpcPlaceholderOrderService.getTimingPriceTime();
}
}

View File

@ -0,0 +1,26 @@
package com.xhpc.order.dto;
import com.xhpc.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author yuyang
* @Date 2025-05-09 12:00
*/
@Data
public class XhpcPlaceholderTimeOrderDto extends BaseEntity {
private Long placeholderTimeOrderId;
private Long placeholderOrderId;
private Date startTime;
private Date endTime;
private BigDecimal price;
private String delFlag;
private String tenantId;
private BigDecimal totalMoney;
private Integer totalTimeSpan;
}

View File

@ -0,0 +1,35 @@
package com.xhpc.order.mapper;
import com.xhpc.common.domain.XhpcPlaceholderTime;
import com.xhpc.order.domain.XhpcPlaceholderOrder;
import com.xhpc.order.dto.XhpcPlaceholderTimeOrderDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author yuyang
* @Date 2025-05-06 11:16
*/
public interface XhpcPlaceholderOrderMapper {
int insertXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder );
XhpcPlaceholderOrder getXhpcPlaceholderOrderSerialNumber(@Param("serialNumber") String serialNumber);
List<XhpcPlaceholderTime> getXhpcPlaceholderTime(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("placeholderId")Long placeholderId);
int updateXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder );
List<Map<String,Object>> getListPage(@Param("chargingStationId")Long chargingStationId, @Param("chargingPileId")Long chargingPileId, @Param("terminalId")Long terminalId, @Param("phone")String phone, @Param("transactionNumber")String transactionNumber, @Param("status")Integer status, @Param("chargingStationName")String chargingStationName, @Param("operatorId")Long operatorId, @Param("source")Integer source, @Param("beginStartTime")String beginStartTime, @Param("beginEndTime")String beginEndTime, @Param("userId")Long userId, @Param("type")Integer type, @Param("number")Integer number, @Param("affiliationOrganization")String affiliationOrganization, @Param("evcsOrderNo")String evcsOrderNo, @Param("plateNum")String plateNum, @Param("internetId")Integer internetId, @Param("internetSerialNumber")String internetSerialNumber, @Param("terminalName")String terminalName, @Param("vinCode")String vinCode, @Param("overStartTime")String overStartTime, @Param("overEndTime")String overEndTime, @Param("personnelId")Long personnelId, @Param("confirmResult")Integer confirmResult, @Param("tenantId")String tenantId, @Param("isNotNull")Integer isNotNull);
Map<String,Object> getById(@Param("placeholderOrderId")Long placeholderOrderId);
int insertXhpcPlaceholderTimeOrder(XhpcPlaceholderTimeOrderDto xhpcPlaceholderTimeOrderDto);
int deleteByPlaceholderOrderIdInt(@Param("placeholderOrderId")Long placeholderOrderId);
List<Map<String,Object>> getXhpcPlaceholderTimeOrder(@Param("placeholderOrderId")Long placeholderOrderId);
}

View File

@ -217,5 +217,4 @@ public interface XhpcRealTimeOrderMapper {
//查询该场站是否有占位费设置
Map<String, Object> getXhpcPlaceholder(@Param("chargingStationId")Long chargingStationId);
int insertXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder );
}

View File

@ -0,0 +1,26 @@
package com.xhpc.order.service;
import com.xhpc.common.core.domain.R;
import com.xhpc.order.domain.XhpcPlaceholderOrder;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* @author yuyang
* @Date 2025-05-06 10:07
*/
public interface IXhpcPlaceholderOrderService {
int insertXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder );
void getTimingPriceTime();
List<Map<String,Object>> getListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult);
void export(HttpServletResponse response, String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult) throws IOException;
R getById(Long placeholderOrderId);
}

View File

@ -0,0 +1,419 @@
package com.xhpc.order.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.poi.excel.BigExcelWriter;
import cn.hutool.poi.excel.ExcelUtil;
import com.xhpc.common.api.UserTypeService;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcPlaceholderTime;
import com.xhpc.common.enums.StopReasonEnum;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.order.domain.XhpcChargeOrder;
import com.xhpc.order.domain.XhpcPlaceholderOrder;
import com.xhpc.order.dto.XhpcPlaceholderTimeOrderDto;
import com.xhpc.order.mapper.XhpcPlaceholderOrderMapper;
import com.xhpc.order.service.IXhpcPlaceholderOrderService;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.*;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
/**
* @author yuyang
* @Date 2025-05-06 10:07
*/
@Service
public class XhpcPlaceholderOrderServiceImpl implements IXhpcPlaceholderOrderService {
@Resource
XhpcPlaceholderOrderMapper xhpcPlaceholderOrderMapper;
@Autowired
private TokenService tokenService;
@Autowired
private UserTypeService userTypeService;
@Override
public int insertXhpcPlaceholderOrder(XhpcPlaceholderOrder placeholderOrder) {
return xhpcPlaceholderOrderMapper.insertXhpcPlaceholderOrder(placeholderOrder);
}
@Override
public void getTimingPriceTime() {
String gunkey = "placeholderOrder:*";
Collection<String> orderKeys = REDIS.keys(gunkey);
for (String okey : orderKeys) {
Map<String, Object> cacheGun = REDIS.getCacheMap(okey);
if (cacheGun != null) {
try {
if ("1".equals(cacheGun.get("status").toString())) {
//占位费订单结束且删除缓存
String serialNumber = cacheGun.get("serialNumber").toString();
//查询订单
XhpcPlaceholderOrder xhpcPlaceholderOrder = xhpcPlaceholderOrderMapper.getXhpcPlaceholderOrderSerialNumber(serialNumber);
if (xhpcPlaceholderOrder.getConfirmResult() == -2 || xhpcPlaceholderOrder.getConfirmResult() == -1) {
//删除占位费时间段收费表
xhpcPlaceholderOrderMapper.deleteByPlaceholderOrderIdInt(xhpcPlaceholderOrder.getPlaceholderOrderId());
//结算订单,查询该时间段价格
DateTime endTime = DateUtil.parse(cacheGun.get("endTime").toString());
DateTime startTime = DateUtil.parse(cacheGun.get("startTime").toString());
String start = DateUtil.formatTime(startTime);
String end = DateUtil.formatTime(endTime);
long betweenDay = DateUtil.between(endTime, startTime, DateUnit.DAY);
long between = DateUtil.between(endTime, startTime, DateUnit.MINUTE);
xhpcPlaceholderOrder.setEndTime(endTime);
xhpcPlaceholderOrder.setTotalTimeSpan((int) between);
BigDecimal totalMoney = new BigDecimal("0.0");
int freeTime = (int) xhpcPlaceholderOrder.getFreeTime();
if (freeTime - between > 0) {
between = 0L;
} else {
between = between - freeTime;
if (betweenDay > 0) {
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, "23:59:59", xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse(start, pattern).getTime();
Long endOne = DateUtil.parse("23:59:59", pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse(start, pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse("23:59:59", pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
List<XhpcPlaceholderTime> xhpcPlaceholderTimeTwo = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime("00:00:00", end, xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeTwo.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse("00:00:00", pattern).getTime();
Long endOne = DateUtil.parse(end, pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse("00:00:00", pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse(end, pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
} else {
List<XhpcPlaceholderTime> xhpcPlaceholderTimeOne = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTime(start, end, xhpcPlaceholderOrder.getPlaceholderId());
for (int i = 0; i < xhpcPlaceholderTimeOne.size(); i++) {
XhpcPlaceholderTime xhpcPlaceholderTime = xhpcPlaceholderTimeOne.get(i);
BigDecimal price = xhpcPlaceholderTime.getPrice();
String pattern = "HH:mm:ss";
Long startOne = DateUtil.parse(start, pattern).getTime();
Long endOne = DateUtil.parse(end, pattern).getTime();
String format1 = DateUtil.format(xhpcPlaceholderTime.getStartTime(), pattern);
String format2 = DateUtil.format(xhpcPlaceholderTime.getEndTime(), pattern);
Long time1 = DateUtil.parse(format1, pattern).getTime();
Long time2 = DateUtil.parse(format2, pattern).getTime();
XhpcPlaceholderTimeOrderDto placeholderTimeOrderDto = new XhpcPlaceholderTimeOrderDto();
if (startOne < time1) {
startOne = time1;
placeholderTimeOrderDto.setStartTime(xhpcPlaceholderTime.getStartTime());
}else{
placeholderTimeOrderDto.setStartTime(DateUtil.parse(start, pattern));
}
if (endOne > time2) {
endOne = time2;
placeholderTimeOrderDto.setEndTime(xhpcPlaceholderTime.getEndTime());
}else{
placeholderTimeOrderDto.setEndTime(DateUtil.parse(end, pattern));
}
long betweOne = (endOne - startOne) / 60000;
int i1 = (int) (betweOne);
if (freeTime - i1 > 0) {
freeTime = freeTime - i1;
;
i1 = 0;
} else {
i1 = i1 - freeTime;
freeTime = 0;
}
BigDecimal multiply = new BigDecimal(i1).multiply(price);
totalMoney = totalMoney.add(multiply);
placeholderTimeOrderDto.setPlaceholderOrderId(xhpcPlaceholderOrder.getPlaceholderOrderId());
placeholderTimeOrderDto.setPrice(price);
placeholderTimeOrderDto.setTotalMoney(multiply);
placeholderTimeOrderDto.setTotalTimeSpan(i1);
xhpcPlaceholderOrderMapper.insertXhpcPlaceholderTimeOrder(placeholderTimeOrderDto);
}
}
}
xhpcPlaceholderOrder.setTotalMoney(totalMoney);
if (new BigDecimal(0).compareTo(new BigDecimal(between)) == 1) {
xhpcPlaceholderOrder.setOvertimePrice(totalMoney.divide(new BigDecimal(between), 2, BigDecimal.ROUND_HALF_UP));
} else {
xhpcPlaceholderOrder.setOvertimePrice(new BigDecimal("0.0"));
}
String orderKey = "notificationPlaceholderOrderInfo:" + xhpcPlaceholderOrder.getSerialNumber();
Map<String, Object> cacheOrder = new HashMap<>();
cacheOrder.put("OvertimeBillCode", xhpcPlaceholderOrder.getPlaceholderOrderNumber());
cacheOrder.put("StartChargeSeq", xhpcPlaceholderOrder.getInternetSerialNumber());
cacheOrder.put("OvertimeBillStatus", 3);
cacheOrder.put("ConnectorId", xhpcPlaceholderOrder.getTerminalNumber());
cacheOrder.put("BillEquipment", 1);
cacheOrder.put("StartTime", cacheGun.get("startTime").toString());
cacheOrder.put("EndTime", cacheGun.get("endTime").toString());
cacheOrder.put("TotalTimeSpan", xhpcPlaceholderOrder.getTotalTimeSpan());
cacheOrder.put("OvertimePrice", xhpcPlaceholderOrder.getOvertimePrice());
cacheOrder.put("TotalMoney", xhpcPlaceholderOrder.getTotalMoney());
Map<String, Object> overtimeDetails = new HashMap<>();
overtimeDetails.put("DetailStartTime", cacheGun.get("startTime").toString());
overtimeDetails.put("DetailEndTime", cacheGun.get("endTime").toString());
overtimeDetails.put("DetailMoney", xhpcPlaceholderOrder.getTotalMoney());
overtimeDetails.put("OvertimePrice", xhpcPlaceholderOrder.getOvertimePrice());
cacheOrder.put("OvertimeDetails", overtimeDetails);
REDIS.setCacheMap(orderKey, cacheOrder);
xhpcPlaceholderOrderMapper.updateXhpcPlaceholderOrder(xhpcPlaceholderOrder);
REDIS.deleteObject(okey);
} else if (xhpcPlaceholderOrder.getConfirmResult() == 0) {
REDIS.deleteObject(okey);
} else if (xhpcPlaceholderOrder.getConfirmResult() == 1) {
REDIS.deleteObject(okey);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
@Override
public List<Map<String, Object>> getListPage(String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult) {
Integer number = 0;
//电话和用户类型都不为null number =3
//电话不为null用户类型为null number =1
//电话为null用户类型不为null number=2
//电话为null用户类型为null number=0
if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) {
number = 3;
} else if (!"".equals(phone) && phone != null && source == null) {
number = 1;
} else if (phone == null && source != null) {
number = 2;
}
//获取登陆用户
Long logUserId = SecurityUtils.getUserId();
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
//桩的统计该时段金额
List<Map<String, Object>> list = new ArrayList<>();
if (!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())) {
if (UserTypeUtil.SYS_SUPER_TYPE_ONE.equals(loginUser.getSuperType())) {
tenantId = loginUser.getTenantId();
Long logOperatorId = sysUser.getOperatorId();
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())) {
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
} else {
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
} else {
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
return list;
}
@Override
public void export(HttpServletResponse response, String tenantId, Long chargingStationId, Long chargingPileId, Long terminalId, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String beginStartTime, String beginEndTime, Long userId, Integer type, String affiliationOrganization, String evcsOrderNo, String plateNum, Integer internetId, String internetSerialNumber, String terminalName, String vinCode, String overStartTime, String overEndTime, Long personnelId, Integer confirmResult) throws IOException {
Integer number = 0;
//电话和用户类型都不为null number =3
//电话不为null用户类型为null number =1
//电话为null用户类型不为null number=2
//电话为null用户类型为null number=0
if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) {
number = 3;
} else if (!"".equals(phone) && phone != null && source == null) {
number = 1;
} else if (phone == null && source != null) {
number = 2;
}
//获取登陆用户
Long logUserId = SecurityUtils.getUserId();
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
//桩的统计该时段金额
List<Map<String, Object>> list = new ArrayList<>();
if (!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())) {
if (UserTypeUtil.SYS_SUPER_TYPE_ONE.equals(loginUser.getSuperType())) {
tenantId = loginUser.getTenantId();
Long logOperatorId = sysUser.getOperatorId();
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())) {
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 1, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logOperatorId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
} else {
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 2, chargingStationName, operatorId, source, beginStartTime, beginEndTime, logUserId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
} else {
list = xhpcPlaceholderOrderMapper.getListPage(chargingStationId, chargingPileId, terminalId, phone, transactionNumber, 0, chargingStationName, operatorId, source, beginStartTime, beginEndTime, userId, type, number, affiliationOrganization, evcsOrderNo, plateNum, internetId, internetSerialNumber, terminalName, vinCode, overStartTime, overEndTime, personnelId, confirmResult, tenantId, 0);
}
// 通过工具类创建writer默认创建xls格式
BigExcelWriter writer = ExcelUtil.getBigWriter("placeholderOrder_" + System.currentTimeMillis() + ".xlsx");
writer.addHeaderAlias("placeholderOrderId", "占位费订单ID");
writer.addHeaderAlias("serialNumber", "充电订单号");
writer.addHeaderAlias("internetSerialNumber", "流量方订单号");
writer.addHeaderAlias("placeholderOrderNumber", "占位费订单号");
writer.addHeaderAlias("chargingStationName", "电站名称");
writer.addHeaderAlias("pileSerialNumber", "桩编号");
writer.addHeaderAlias("terminalName", "终端名称");
// writer.addHeaderAlias("operatorId", "运营商ID");
writer.addHeaderAlias("operatorName", "运营商名称");
writer.addHeaderAlias("freeTime", "免费时长(分钟)");
writer.addHeaderAlias("maxFee", "最大占位费(元)");
writer.addHeaderAlias("totalTimeSpan", "占位总时长(分钟)");
writer.addHeaderAlias("totalMoney", "占位总费用(元)");
writer.addHeaderAlias("startTime", "开始占位时间");
writer.addHeaderAlias("endTime", "结束占位时间");
writer.addHeaderAlias("chargingModeName", "订单来源");
writer.addHeaderAlias("sourceName", "用户类型");
writer.addHeaderAlias("confirmResultName", "推送状态");
// writer.addHeaderAlias("plateNum", "电站名称");
// writer.addHeaderAlias("disputeOrderStatus", "桩编号");
// 默认的未添加alias的属性也会写出如果想只写出加了别名的字段可以调用此方法排除之
writer.setOnlyAlias(true);
// 一次性写出内容使用默认样式强制输出标题
writer.write(list, true);
//out为OutputStream需要写出到的目标流
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
// //response为HttpServletResponse对象
// response.setContentType("application/vnd.ms-excel;charset=utf-8");
// //test.xls是弹出下载对话框的文件名不能为中文中文请自行编码
// response.setHeader("Content-Disposition", "attachment;filename=历史订单列表.xls");
ServletOutputStream out = response.getOutputStream();
writer.flush(out, true);
// 关闭writer释放内存
writer.close();
//此处记得关闭输出Servlet流
IoUtil.close(out);
}
@Override
public R getById(Long placeholderOrderId) {
try {
Map<String, Object> byId = xhpcPlaceholderOrderMapper.getById(placeholderOrderId);
if (byId != null) {
List<Map<String, Object>> xhpcPlaceholderTimeOrder = xhpcPlaceholderOrderMapper.getXhpcPlaceholderTimeOrder(placeholderOrderId);
byId.put("xhpcPlaceholderTimeOrder",xhpcPlaceholderTimeOrder);
}
return R.ok(byId);
} catch (Exception e) {
e.printStackTrace();
return R.fail(e.getMessage());
}
}
}

View File

@ -28,6 +28,7 @@ import com.xhpc.order.dto.*;
import com.xhpc.order.mapper.XhpcRealTimeOrderMapper;
import com.xhpc.order.service.IXhpcChargeOrderService;
import com.xhpc.order.service.IXhpcHistoryOrderService;
import com.xhpc.order.service.IXhpcPlaceholderOrderService;
import com.xhpc.order.service.IXhpcRealTimeOrderService;
import com.xhpc.system.api.domain.SysUser;
import com.xhpc.system.api.model.LoginUser;
@ -82,6 +83,9 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
@Autowired
private ActivityInternetService activityInternetService;
@Autowired
private IXhpcPlaceholderOrderService placeholderOrderService;
@Autowired
private EvcsService evcsService;
@ -1604,6 +1608,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
if(xhpcPlaceholderMap !=null){
//占位订单生成
XhpcPlaceholderOrder placeholderOrder = new XhpcPlaceholderOrder();
placeholderOrder.setChargingMode(xhpcHistoryOrder.getChargingMode());
placeholderOrder.setDriverId(xhpcChargeOrder.getDriverId());
placeholderOrder.setHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
placeholderOrder.setChargingStationId(xhpcHistoryOrder.getChargingStationId());
placeholderOrder.setChargeOrderId(xhpcHistoryOrder.getChargeOrderId());
@ -1611,7 +1617,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
placeholderOrder.setUserId(xhpcHistoryOrder.getUserId());
placeholderOrder.setSerialNumber(xhpcHistoryOrder.getSerialNumber());
placeholderOrder.setInternetSerialNumber(xhpcHistoryOrder.getInternetSerialNumber());
placeholderOrder.setConfirmResult(-1);
placeholderOrder.setConfirmResult(-2);
placeholderOrder.setSource(xhpcHistoryOrder.getSource());
placeholderOrder.setPlaceholderId(Long.valueOf(xhpcPlaceholderMap.get("placeholderId").toString()));
placeholderOrder.setFreeTime(Integer.valueOf(xhpcPlaceholderMap.get("freeTime").toString()));
@ -1627,7 +1633,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
placeholderOrder.setStartTime(xhpcHistoryOrder.getEndTime());
placeholderOrder.setCreateTime(new Date());
placeholderOrder.setTenantId(xhpcHistoryOrder.getTenantId());
xhpcRealTimeOrderMapper.insertXhpcPlaceholderOrder(placeholderOrder);
placeholderOrderService.insertXhpcPlaceholderOrder(placeholderOrder);
logger.info("<<<<<<<<<<<<<<getPlaceholderOrderId>>>>>>>>>>>>>>>>"+placeholderOrder.getPlaceholderOrderId());
String gunkey = "placeholderOrder:"+substring+":"+xhpcHistoryOrder.getSerialNumber();
Map<String, Object> cacheGun =new HashMap<>();
@ -1636,6 +1642,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
cacheGun.put("status",0);
cacheGun.put("serialNumber",xhpcHistoryOrder.getSerialNumber());
cacheGun.put("internetSerialNumber",xhpcHistoryOrder.getInternetSerialNumber());
cacheGun.put("startTime",DateUtil.format(xhpcHistoryOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
REDIS.setCacheMap(gunkey, cacheGun);
}
}catch (Exception e){

View File

@ -0,0 +1,637 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.order.mapper.XhpcPlaceholderOrderMapper">
<resultMap type="com.xhpc.order.domain.XhpcPlaceholderOrder" id="xhpcPlaceholderOrderMap">
<result column="placeholder_order_id" property="placeholderOrderId"/>
<result column="history_order_id" property="historyOrderId"/>
<result column="charging_station_id" property="chargingStationId"/>
<result column="charge_order_id" property="chargeOrderId"/>
<result column="terminal_id" property="terminalId"/>
<result column="user_id" property="userId"/>
<result column="serial_number" property="serialNumber"/>
<result column="internet_serial_number" property="internetSerialNumber"/>
<result column="confirm_Result" property="confirmResult"/>
<result column="source" property="source"/>
<result column="placeholder_id" property="placeholderId"/>
<result column="free_time" property="freeTime"/>
<result column="max_fee" property="maxFee"/>
<result column="operator_id" property="operatorId"/>
<result column="placeholder_order_number" property="placeholderOrderNumber"/>
<result column="status" property="status"/>
<result column="terminal_number" property="terminalNumber"/>
<result column="bill_equipment" property="billEquipment"/>
<result column="start_time" property="startTime"/>
<result column="end_time" property="endTime"/>
<result column="total_time_span" property="totalTimeSpan"/>
<result column="overtime_price" property="overtimePrice"/>
<result column="total_money" property="totalMoney"/>
<result column="price" property="price"/>
<result column="tenant_id" property="tenantId"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="create_by" property="createBy"/>
<result column="update_time" property="updateTime"/>
<result column="update_by" property="updateBy"/>
<result column="remark" property="remark"/>
<result column="del_flag" property="delFlag"/>
<result column="charging_mode" property="chargingMode"/>
<result column="driver_id" property="driverId"/>
<result column="plate_num" property="plateNum"/>
</resultMap>
<insert id="insertXhpcPlaceholderOrder" parameterType="com.xhpc.order.domain.XhpcPlaceholderOrder"
useGeneratedKeys="true" keyProperty="placeholderOrderId">
insert into xhpc_placeholder_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != historyOrderId">
history_order_id,
</if>
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != chargeOrderId ">
charge_order_id,
</if>
<if test="null != userId">
user_id,
</if>
<if test="null != terminalId">
terminal_id,
</if>
<if test="null != serialNumber and '' != serialNumber">
serial_number,
</if>
<if test="null != internetSerialNumber and '' != internetSerialNumber">
internet_serial_number,
</if>
<if test="null != confirmResult and '' != confirmResult">
confirm_Result,
</if>
<if test="null != source ">
source,
</if>
<if test="null != placeholderId">
placeholder_id,
</if>
<if test="null != freeTime">
free_time,
</if>
<if test="null != maxFee ">
max_fee,
</if>
<if test="null != operatorId and '' != operatorId">
operator_id,
</if>
<if test="null != placeholderOrderNumber and '' != placeholderOrderNumber">
placeholder_order_number,
</if>
<if test="null != status ">
status,
</if>
<if test="null != terminalNumber and '' != terminalNumber">
terminal_number,
</if>
<if test="null != billEquipment ">
bill_equipment,
</if>
<if test="null != startTime ">
start_time,
</if>
<if test="null != endTime ">
end_time,
</if>
<if test="null != totalTimeSpan ">
total_time_span,
</if>
<if test="null != overtimePrice ">
overtime_price,
</if>
<if test="null != totalMoney ">
total_money,
</if>
<if test="null != price ">
price,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != tenantId ">
tenant_id,
</if>
<if test="null != chargingMode and '' != chargingMode">
charging_mode,
</if>
<if test="null != driverId and '' != driverId">
driver_id,
</if>
<if test="null != plateNum and '' != plateNum">
plate_num,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != historyOrderId">
#{historyOrderId},
</if>
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != chargeOrderId ">
#{chargeOrderId},
</if>
<if test="null != userId">
#{userId},
</if>
<if test="null != terminalId">
#{terminalId},
</if>
<if test="null != serialNumber and '' != serialNumber">
#{serialNumber},
</if>
<if test="null != internetSerialNumber and '' != internetSerialNumber">
#{internetSerialNumber},
</if>
<if test="null != confirmResult and '' != confirmResult">
#{confirmResult},
</if>
<if test="null != source ">
#{source},
</if>
<if test="null != placeholderId">
#{placeholderId},
</if>
<if test="null != freeTime">
#{freeTime},
</if>
<if test="null != maxFee ">
#{maxFee},
</if>
<if test="null != operatorId and '' != operatorId">
#{operatorId},
</if>
<if test="null != placeholderOrderNumber and '' != placeholderOrderNumber">
#{placeholderOrderNumber},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != terminalNumber and '' != terminalNumber">
#{terminalNumber},
</if>
<if test="null != billEquipment ">
#{billEquipment},
</if>
<if test="null != startTime ">
#{startTime},
</if>
<if test="null != endTime ">
#{endTime},
</if>
<if test="null != totalTimeSpan ">
#{totalTimeSpan},
</if>
<if test="null != overtimePrice ">
#{overtimePrice},
</if>
<if test="null != totalMoney ">
#{totalMoney},
</if>
<if test="null != price ">
#{price},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != tenantId ">
#{tenantId},
</if>
<if test="null != chargingMode and '' != chargingMode">
#{chargingMode},
</if>
<if test="null != driverId and '' != driverId">
#{driverId},
</if>
<if test="null != plateNum and '' != plateNum">
#{plateNum},
</if>
</trim>
</insert>
<select id="getXhpcPlaceholderOrderSerialNumber" resultMap="xhpcPlaceholderOrderMap">
select * from xhpc_placeholder_order where serial_number =#{serialNumber} and del_flag =0
</select>
<select id="getXhpcPlaceholderTime" resultType="com.xhpc.common.domain.XhpcPlaceholderTime">
select
start_time as startTime,
end_time as endTime,
price as price
from xhpc_placeholder_time
where placeholder_time_id in (
SELECT placeholder_time_id FROM xhpc_placeholder_time WHERE placeholder_id = #{placeholderId} and del_flag =0 AND #{startTime} &gt;= start_time AND #{endTime} &lt;= replace(end_time, '00:00:00', '23:59:59')
)
or placeholder_time_id in (
SELECT placeholder_time_id FROM xhpc_placeholder_time WHERE placeholder_id = #{placeholderId} and del_flag =0 AND #{startTime} &gt;= start_time AND #{startTime} &lt;= replace(end_time, '00:00:00', '23:59:59') AND #{endTime} &gt;= replace(end_time, '00:00:00', '23:59:59')
)
or placeholder_time_id in (
SELECT placeholder_time_id FROM xhpc_placeholder_time WHERE placeholder_id = #{placeholderId} and del_flag =0 AND #{startTime} &lt;= start_time AND #{startTime} &lt;= replace(end_time, '00:00:00', '23:59:59') AND #{endTime} &gt;= start_time AND #{endTime} &lt;= replace(end_time, '00:00:00', '23:59:59')
)
or placeholder_time_id in (
SELECT placeholder_time_id FROM xhpc_placeholder_time WHERE placeholder_id = #{placeholderId} and del_flag =0 AND #{startTime} &lt;= start_time AND #{startTime} &lt;= replace(end_time, '00:00:00', '23:59:59') AND #{endTime} &gt;= start_time AND #{endTime} &gt;= replace(end_time, '00:00:00', '23:59:59')
)
order by placeholder_time_id
</select>
<update id="updateXhpcPlaceholderOrder">
UPDATE xhpc_placeholder_order
<set>
<if test="startTime != null">
start_time = #{startTime},
</if>
<if test="endTime != null">
end_time = #{endTime},
</if>
<if test="totalTimeSpan != null">
total_time_span = #{totalTimeSpan},
</if>
<if test="overtimePrice != null">
overtime_price = #{overtimePrice},
</if>
<if test="totalMoney != null">
total_money = #{totalMoney},
</if>
</set>
where placeholder_order_id = #{placeholderOrderId}
</update>
<select id="getListPage" resultType="map">
select
ho.placeholder_order_id as placeholderOrderId,
ho.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.power as power,
cp.type as type,
ho.internet_serial_number as internetSerialNumber,
ho.start_time as startTime,
ho.end_time as endTime,
ho.source as source,
case when ho.source=0 then "C端用户"
when ho.source=1 then "流量方用户"
when ho.source=2 then "社区用户"
else "B端客户!"
end sourceName,
case when ho.confirm_Result=-2 then "未推送"
when ho.confirm_Result=-1 then "已推送占位中订单"
when ho.confirm_Result=0 then "推送已完成"
else "争议订单!"
end confirmResultName,
ho.free_time as freeTime,
ho.max_fee as maxFee,
ho.total_time_span as totalTimeSpan,
ho.placeholder_order_number as placeholderOrderNumber,
case when ho.status=1 then "占位中"
when ho.status=2 then "等待"
when ho.status=3 then "已完成"
when ho.status=4 then "取消"
when ho.status=9 then "已结束"
else "已支付"
end statusName,
case when ho.bill_equipment=1 then "充电桩"
when ho.bill_equipment=2 then "地锁"
when ho.bill_equipment=3 then "车位监控"
else "道闸"
end billEquipmentName,
ho.total_time_span as totalTimeSpan,
ho.total_money as totalMoney,
ho.price as price,
inu.name as internetName,
apu.phone as appUserPhone,
cop.account as communityAccount,
cup.account as customersAccount,
ho.driver_id as internetUserPhone,
ho.plate_num as plateNum,
case when ho.charging_mode="1" then "快电"
when ho.charging_mode="2" then "恒大"
when ho.charging_mode="3" then "新电途"
when ho.charging_mode="4" then "小桔"
when ho.charging_mode="微信" then "微信"
when ho.charging_mode="支付宝" then "支付宝"
when ho.charging_mode="App" then "App"
when ho.charging_mode="刷卡" then "刷卡"
else "vin码"
end chargingModeName
from xhpc_placeholder_order as ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null and ho.source=1
left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null and ho.source=0
left join xhpc_community_personnel as cop on cop.community_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=2
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=3
where ho.del_flag=0
<if test="chargingStationId !=null">
and ho.charging_station_id=#{chargingStationId}
</if>
<if test="chargingPileId !=null">
and ho.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{chargingPileId} and del_flag=0)
</if>
<if test="terminalId !=null">
and ho.terminal_id=#{terminalId}
</if>
<if test="confirmResult !=null">
and ho.confirm_Result =#{confirmResult}
</if>
<if test="source !=null">
and ho.source=#{source}
</if>
<if test="internetId !=null">
and inu.internet_user_id=#{internetId}
</if>
<if test="internetSerialNumber !=null and internetSerialNumber !=''">
and ho.internet_serial_number like concat('%', #{internetSerialNumber}, '%')
</if>
<if test="terminalName !=null and terminalName !=''">
and ter.name like concat(#{terminalName}, '%')
</if>
<if test="beginStartTime !=null and beginStartTime !=''">
and ho.start_time &gt;= #{beginStartTime}
</if>
<if test="beginEndTime !=null and beginEndTime !=''">
and ho.start_time &lt;= #{beginEndTime}
</if>
<if test="overStartTime !=null and overStartTime !=''">
and ho.end_time &gt;= #{overStartTime}
</if>
<if test="overEndTime !=null and overEndTime !=''">
and ho.end_time &lt;= #{overEndTime}
</if>
<if test="transactionNumber !=null and transactionNumber !=''">
and ho.serial_number like concat('%', #{transactionNumber}, '%')
</if>
<if test="operatorId !=null">
and ho.operator_id =#{operatorId}
</if>
<if test="number==2">
<if test="source ==0">
and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0)
</if>
<if test="source ==1">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1)
</if>
<if test="source ==2">
and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2)
</if>
<if test="source ==3">
and ho.history_order_id in (select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3)
</if>
</if>
<if test="number==3">
<if test="source ==0">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_app_user as xau on xau.app_user_id = hio.user_id where hio.source=0 and xau.phone LIKE concat('%',#{phone}, '%'))
</if>
<if test="source ==1">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_internet_user as xiu on xiu.internet_user_id = hio.user_id where hio.source=1 and xiu.phone LIKE concat('%',#{phone}, '%'))
</if>
<if test="source ==2">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_community_personnel as xcp on xcp.community_personnel_id = hio.user_id where hio.source=2 and xcp.account LIKE concat('%',#{phone}, '%'))
</if>
<if test="source ==3">
and ho.history_order_id in(select hio.history_order_id as history_order_id from xhpc_history_order as hio INNER JOIN xhpc_customers_personnel as xcup on xcup.customers_personnel_id = hio.user_id where hio.source=3 and xcup.account LIKE concat('%',#{phone}, '%'))
</if>
</if>
<if test="status==1">
and co.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
</if>
<if test="status==2">
and co.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
</if>
<if test="personnelId !=null">
and ho.user_id=#{personnelId}
</if>
<if test="tenantId !=null and '' !=tenantId">
and ho.tenant_id=#{tenantId}
</if>
<if test="isNotNull==1">
and ho.total_price &gt;=0
</if>
order by ho.create_time desc
</select>
<select id="getById" resultType="map">
select
ho.placeholder_order_id as placeholderOrderId,
ho.serial_number as serialNumber,
ct.name as chargingStationName,
ter.pile_serial_number as pileSerialNumber,
ter.name as terminalName,
op.operator_id as operatorId,
op.name as operatorName,
cp.power as power,
cp.type as type,
ho.internet_serial_number as internetSerialNumber,
ho.start_time as startTime,
ho.end_time as endTime,
ho.source as source,
ho.plate_num as plateNum,
case when ho.source=0 then "C端用户"
when ho.source=1 then "流量方用户"
when ho.source=2 then "社区用户"
else "B端客户!"
end sourceName,
case when ho.confirm_Result=-2 then "未推送"
when ho.confirm_Result=-1 then "已推送占位中订单"
when ho.confirm_Result=0 then "推送已完成"
else "争议订单!"
end confirmResultName,
ho.free_time as freeTime,
ho.max_fee as maxFee,
ho.total_time_span as totalTimeSpan,
ho.placeholder_order_number as placeholderOrderNumber,
case when ho.status=1 then "占位中"
when ho.status=2 then "等待"
when ho.status=3 then "已完成"
when ho.status=4 then "取消"
when ho.status=9 then "已结束"
else "已支付"
end statusName,
case when ho.bill_equipment=1 then "充电桩"
when ho.bill_equipment=2 then "地锁"
when ho.bill_equipment=3 then "车位监控"
else "道闸"
end billEquipmentName,
ho.total_money as totalMoney,
ho.price as price,
inu.name as internetName,
apu.phone as appUserPhone,
cop.account as communityAccount,
cup.account as customersAccount,
ho.driver_id as internetUserPhone,
case when ho.charging_mode="1" then "快电"
when ho.charging_mode="2" then "恒大"
when ho.charging_mode="3" then "新电途"
when ho.charging_mode="4" then "小桔"
when ho.charging_mode="微信" then "微信"
when ho.charging_mode="支付宝" then "支付宝"
when ho.charging_mode="App" then "App"
when ho.charging_mode="刷卡" then "刷卡"
else "vin码"
end chargingModeName
from xhpc_placeholder_order ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
left join xhpc_charging_pile as cp on cp.charging_pile_id = ter.charging_pile_id
left join xhpc_internet_user as inu on inu.internet_user_id = ho.user_id and ho.internet_serial_number is not null and ho.source=1
left join xhpc_app_user as apu on apu.app_user_id = ho.user_id and ho.internet_serial_number is null and ho.source=0
left join xhpc_community_personnel as cop on cop.community_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=2
left join xhpc_customers_personnel as cup on cup.customers_personnel_id = ho.user_id and ho.internet_serial_number is null and ho.source=3
where ho.placeholder_order_id=#{placeholderOrderId}
</select>
<delete id="deleteByPlaceholderOrderIdInt">
delete from xhpc_placeholder_time_order where placeholder_order_id =#{placeholderOrderId}
</delete>
<select id="getXhpcPlaceholderTimeOrder" resultType="map">
select
concat(start_time,"-",end_time) as time,
price as price,
total_money as totalMoney,
total_time_span as totalTimeSpan
from xhpc_placeholder_time_order
where placeholder_order_id =#{placeholderOrderId}
order by create_time
</select>
<insert id="insertXhpcPlaceholderTimeOrder" parameterType="com.xhpc.order.dto.XhpcPlaceholderTimeOrderDto"
useGeneratedKeys="true" keyProperty="placeholderTimeOrderId">
insert into xhpc_placeholder_time_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != placeholderTimeOrderId">
placeholder_time_order_id,
</if>
<if test="null != placeholderOrderId ">
placeholder_order_id,
</if>
<if test="null != startTime ">
start_time,
</if>
<if test="null != endTime ">
end_time,
</if>
<if test="null != totalTimeSpan ">
total_time_span,
</if>
<if test="null != totalMoney ">
total_money,
</if>
<if test="null != price ">
price,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != tenantId ">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != placeholderTimeOrderId">
#{placeholderTimeOrderId},
</if>
<if test="null != placeholderOrderId ">
#{placeholderOrderId},
</if>
<if test="null != startTime ">
#{startTime},
</if>
<if test="null != endTime ">
#{endTime},
</if>
<if test="null != totalTimeSpan ">
#{totalTimeSpan},
</if>
<if test="null != totalMoney ">
#{totalMoney},
</if>
<if test="null != price ">
#{price},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != tenantId ">
#{tenantId},
</if>
<if test="null != chargingMode and '' != chargingMode">
#{chargingMode},
</if>
<if test="null != driverId and '' != driverId">
#{driverId},
</if>
</trim>
</insert>
</mapper>

View File

@ -1315,189 +1315,8 @@
max_fee as maxFee,
free_time as freeTime,
placeholder_id as placeholderId
from xhpc_placeholder where del_flag =0 and status =1 and NOW() &gt;= start_time AND NOW() &lt;= end_time
from xhpc_placeholder where del_flag =0 and status =1 and NOW() &gt;= start_time AND NOW() &lt;= end_time and charging_station_id =#{chargingStationId}
</select>
<insert id="insertXhpcPlaceholderOrder" parameterType="com.xhpc.order.domain.XhpcPlaceholderOrder"
useGeneratedKeys="true" keyProperty="placeholderOrderId">
insert into xhpc_placeholder_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != historyOrderId">
history_order_id,
</if>
<if test="null != chargingStationId ">
charging_station_id,
</if>
<if test="null != chargeOrderId ">
charge_order_id,
</if>
<if test="null != userId">
user_id,
</if>
<if test="null != terminalId">
terminal_id,
</if>
<if test="null != serialNumber and '' != serialNumber">
serial_number,
</if>
<if test="null != internetSerialNumber and '' != internetSerialNumber">
internet_serial_number,
</if>
<if test="null != confirmResult and '' != confirmResult">
confirm_Result,
</if>
<if test="null != source ">
source,
</if>
<if test="null != placeholderId">
placeholder_id,
</if>
<if test="null != freeTime">
free_time,
</if>
<if test="null != maxFee ">
max_fee,
</if>
<if test="null != operatorId and '' != operatorId">
operator_id,
</if>
<if test="null != placeholderOrderNumber and '' != placeholderOrderNumber">
placeholder_order_number,
</if>
<if test="null != status ">
status,
</if>
<if test="null != terminalNumber and '' != terminalNumber">
terminal_number,
</if>
<if test="null != billEquipment ">
bill_equipment,
</if>
<if test="null != startTime ">
start_time,
</if>
<if test="null != endTime ">
end_time,
</if>
<if test="null != totalTimeSpan ">
total_time_span,
</if>
<if test="null != overtimePrice ">
overtime_price,
</if>
<if test="null != totalMoney ">
total_money,
</if>
<if test="null != price ">
price,
</if>
<if test="null != createTime ">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime ">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark,
</if>
<if test="null != tenantId ">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != historyOrderId">
#{historyOrderId},
</if>
<if test="null != chargingStationId ">
#{chargingStationId},
</if>
<if test="null != chargeOrderId ">
#{chargeOrderId},
</if>
<if test="null != userId">
#{userId},
</if>
<if test="null != terminalId">
#{terminalId},
</if>
<if test="null != serialNumber and '' != serialNumber">
#{serialNumber},
</if>
<if test="null != internetSerialNumber and '' != internetSerialNumber">
#{internetSerialNumber},
</if>
<if test="null != confirmResult and '' != confirmResult">
#{confirmResult},
</if>
<if test="null != source ">
#{source},
</if>
<if test="null != placeholderId">
#{placeholderId},
</if>
<if test="null != freeTime">
#{freeTime},
</if>
<if test="null != maxFee ">
#{maxFee},
</if>
<if test="null != operatorId and '' != operatorId">
#{operatorId},
</if>
<if test="null != placeholderOrderNumber and '' != placeholderOrderNumber">
#{placeholderOrderNumber},
</if>
<if test="null != status ">
#{status},
</if>
<if test="null != terminalNumber and '' != terminalNumber">
#{terminalNumber},
</if>
<if test="null != billEquipment ">
#{billEquipment},
</if>
<if test="null != startTime ">
#{startTime},
</if>
<if test="null != endTime ">
#{endTime},
</if>
<if test="null != totalTimeSpan ">
#{totalTimeSpan},
</if>
<if test="null != overtimePrice ">
#{overtimePrice},
</if>
<if test="null != totalMoney ">
#{totalMoney},
</if>
<if test="null != price ">
#{price},
</if>
<if test="null != createTime ">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime ">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark},
</if>
<if test="null != tenantId ">
#{tenantId},
</if>
</trim>
</insert>
</mapper>

View File

@ -304,10 +304,11 @@ public class RealtimeDataLogic implements ServiceLogic {
Collection<String> orderKeys = REDIS.keys(gunkey);
for (String okey : orderKeys) {
Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
if(cacheGun !=null){
Map<String, Object> cacheGun = REDIS.getCacheMap(okey);
if(cacheGun !=null && "0".equals(cacheGun.get("status").toString())){
cacheGun.put("status",1);
REDIS.setCacheMap(gunkey, cacheGun);
cacheGun.put("endTime",DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
REDIS.setCacheMap(okey, cacheGun);
}
}
}