小时统计增加判断
This commit is contained in:
parent
18e4f0a99d
commit
d9df9cb82c
@ -434,64 +434,67 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
if(list !=null && list.size()>0){
|
if(list !=null && list.size()>0){
|
||||||
for (XhpcChargeHistoryOrder xhpc:list) {
|
for (XhpcChargeHistoryOrder xhpc:list) {
|
||||||
try{
|
try{
|
||||||
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
|
||||||
Date startTime = xhpc.getStartTime();
|
|
||||||
Date endTime = xhpc.getEndTime();
|
|
||||||
Long rateModelId = xhpc.getRateModelId();
|
|
||||||
Long operatorId =xhpc.getOperatorId();
|
|
||||||
Long chargingStationId = xhpc.getChargingStationId();
|
|
||||||
Long terminalId = xhpc.getTerminalId();
|
|
||||||
Long historyOrderId = xhpc.getHistoryOrderId();
|
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||||
//Date data = Calendar.getInstance().getTime();
|
int count = xhpcStatisticsService.getStatisticsTimeHistoryOrderId(historyOrderId);
|
||||||
|
if(count==0){
|
||||||
|
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
||||||
|
Date startTime = xhpc.getStartTime();
|
||||||
|
Date endTime = xhpc.getEndTime();
|
||||||
|
Long rateModelId = xhpc.getRateModelId();
|
||||||
|
Long operatorId =xhpc.getOperatorId();
|
||||||
|
Long chargingStationId = xhpc.getChargingStationId();
|
||||||
|
Long terminalId = xhpc.getTerminalId();
|
||||||
|
//Date data = Calendar.getInstance().getTime();
|
||||||
// if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){
|
// if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
// if(xhpc.getChargingDegree().compareTo(new BigDecimal(0)) !=1){
|
// if(xhpc.getChargingDegree().compareTo(new BigDecimal(0)) !=1){
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
//每分钟多少度电
|
//每分钟多少度电
|
||||||
//BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_HALF_UP);
|
//BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_HALF_UP);
|
||||||
// if(v.compareTo(new BigDecimal(0)) !=1){
|
// if(v.compareTo(new BigDecimal(0)) !=1){
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
int endHour = DateUtil.hour(endTime, true);
|
int endHour = DateUtil.hour(endTime, true);
|
||||||
//没有跨时段
|
//没有跨时段
|
||||||
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
|
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
|
||||||
xhpcSt.setStatus(endHour+1);
|
xhpcSt.setStatus(endHour+1);
|
||||||
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
||||||
if(xhpc.getChargingTimeNumber() !=null){
|
if(xhpc.getChargingTimeNumber() !=null){
|
||||||
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 2, BigDecimal.ROUND_HALF_UP));
|
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
}
|
||||||
|
xhpcSt.setChargingNumber(1);
|
||||||
|
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
||||||
|
xhpcSt.setServicePrice(xhpc.getServicePriceTotal());
|
||||||
|
xhpcSt.setTotalPrice(xhpc.getTotalPrice());
|
||||||
|
xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount());
|
||||||
|
xhpcSt.setActPrice(xhpc.getActPrice());
|
||||||
|
xhpcSt.setActPowerPrice(xhpc.getActPowerPrice());
|
||||||
|
xhpcSt.setActServicePrice(xhpc.getActServicePrice());
|
||||||
|
xhpcSt.setInternetCommission(xhpc.getInternetCommission());
|
||||||
|
xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission());
|
||||||
|
xhpcSt.setPlatformCommission(xhpc.getPlatformCommission());
|
||||||
|
xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion());
|
||||||
|
xhpcSt.setOperationCommission(xhpc.getOperationCommission());
|
||||||
|
xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission());
|
||||||
|
xhpcSt.setOperatorId(operatorId);
|
||||||
|
xhpcSt.setChargingStationId(chargingStationId);
|
||||||
|
//xhpcSt.setCreateTime(data);
|
||||||
|
xhpcSt.setTerminalId(terminalId);
|
||||||
|
xhpcSt.setHistoryOrderId(historyOrderId);
|
||||||
|
if(xhpc.getSource()==1){
|
||||||
|
xhpcSt.setInternetUserId(xhpc.getUserId());
|
||||||
|
}
|
||||||
|
//时间没有跨天
|
||||||
|
xhpcSt.setInternetDegreeCommission(xhpc.getInternetDegreeCommission());
|
||||||
|
xhpcSt.setStartTimeEvcs(DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
xhpcSt.setEndTimeEvcs(DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||||
|
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
||||||
|
//修改历史订单表状态
|
||||||
|
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1);
|
||||||
}
|
}
|
||||||
xhpcSt.setChargingNumber(1);
|
|
||||||
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
|
||||||
xhpcSt.setServicePrice(xhpc.getServicePriceTotal());
|
|
||||||
xhpcSt.setTotalPrice(xhpc.getTotalPrice());
|
|
||||||
xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount());
|
|
||||||
xhpcSt.setActPrice(xhpc.getActPrice());
|
|
||||||
xhpcSt.setActPowerPrice(xhpc.getActPowerPrice());
|
|
||||||
xhpcSt.setActServicePrice(xhpc.getActServicePrice());
|
|
||||||
xhpcSt.setInternetCommission(xhpc.getInternetCommission());
|
|
||||||
xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission());
|
|
||||||
xhpcSt.setPlatformCommission(xhpc.getPlatformCommission());
|
|
||||||
xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion());
|
|
||||||
xhpcSt.setOperationCommission(xhpc.getOperationCommission());
|
|
||||||
xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission());
|
|
||||||
xhpcSt.setOperatorId(operatorId);
|
|
||||||
xhpcSt.setChargingStationId(chargingStationId);
|
|
||||||
//xhpcSt.setCreateTime(data);
|
|
||||||
xhpcSt.setTerminalId(terminalId);
|
|
||||||
xhpcSt.setHistoryOrderId(historyOrderId);
|
|
||||||
if(xhpc.getSource()==1){
|
|
||||||
xhpcSt.setInternetUserId(xhpc.getUserId());
|
|
||||||
}
|
|
||||||
//时间没有跨天
|
|
||||||
xhpcSt.setInternetDegreeCommission(xhpc.getInternetDegreeCommission());
|
|
||||||
xhpcSt.setStartTimeEvcs(DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"));
|
|
||||||
xhpcSt.setEndTimeEvcs(DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"));
|
|
||||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
|
||||||
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
|
||||||
//修改历史订单表状态
|
|
||||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1);
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务异常>>>>>>>>>>>>>>>>>>>>>"+xhpc.getHistoryOrderId());
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务异常>>>>>>>>>>>>>>>>>>>>>"+xhpc.getHistoryOrderId());
|
||||||
}
|
}
|
||||||
@ -933,44 +936,50 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
//场站、运营商、流量方
|
//场站、运营商、流量方
|
||||||
if(list !=null && list.size()>0){
|
if(list !=null && list.size()>0){
|
||||||
for (XhpcChargeHistoryOrder xhpc:list) {
|
for (XhpcChargeHistoryOrder xhpc:list) {
|
||||||
XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation();
|
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||||
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
|
||||||
if(xhpc.getChargingTimeNumber() !=null){
|
|
||||||
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 2, BigDecimal.ROUND_HALF_UP));
|
|
||||||
}
|
|
||||||
xhpcSt.setChargingNumber(1);
|
|
||||||
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
|
||||||
xhpcSt.setServicePrice(xhpc.getServicePriceTotal());
|
|
||||||
xhpcSt.setTotalPrice(xhpc.getTotalPrice());
|
|
||||||
xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount());
|
|
||||||
xhpcSt.setActPrice(xhpc.getActPrice());
|
|
||||||
xhpcSt.setInternetCommission(xhpc.getInternetCommission());
|
|
||||||
xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission());
|
|
||||||
xhpcSt.setPlatformCommission(xhpc.getPlatformCommission());
|
|
||||||
xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion());
|
|
||||||
xhpcSt.setOperationCommission(xhpc.getOperationCommission());
|
|
||||||
xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission());
|
|
||||||
xhpcSt.setActPowerPrice(xhpc.getActPowerPrice());
|
|
||||||
xhpcSt.setActServicePrice(xhpc.getActServicePrice());
|
|
||||||
if(xhpc.getSource()==1){
|
|
||||||
xhpcSt.setInternetUserId(xhpc.getUserId());
|
|
||||||
}
|
|
||||||
xhpcSt.setOperatorId(xhpc.getOperatorId());
|
|
||||||
xhpcSt.setChargingStationId(xhpc.getChargingStationId());
|
|
||||||
xhpcSt.setCreateTime(Calendar.getInstance().getTime());
|
|
||||||
xhpcSt.setTerminalId(xhpc.getTerminalId());
|
|
||||||
xhpcSt.setChargingMode(xhpc.getChargingMode());
|
|
||||||
xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId());
|
|
||||||
xhpcSt.setChargingPileId(xhpc.getChargingPileId());
|
|
||||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
|
||||||
xhpcSt.setSource(xhpc.getSource());
|
|
||||||
xhpcSt.setInternetDegreeCommission(xhpc.getInternetDegreeCommission());
|
|
||||||
for (int i = type; i <4 ; i++) {
|
for (int i = type; i <4 ; i++) {
|
||||||
xhpcSt.setType(i);
|
//查询统计表是否有已添加的数据
|
||||||
xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
int count = xhpcStatisticsService.getStatisticsStationHistoryOrderId(historyOrderId, i);
|
||||||
|
if(count==0){
|
||||||
|
XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation();
|
||||||
|
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
|
||||||
|
if(xhpc.getChargingTimeNumber() !=null){
|
||||||
|
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
}
|
||||||
|
xhpcSt.setChargingNumber(1);
|
||||||
|
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
|
||||||
|
xhpcSt.setServicePrice(xhpc.getServicePriceTotal());
|
||||||
|
xhpcSt.setTotalPrice(xhpc.getTotalPrice());
|
||||||
|
xhpcSt.setPromotionDiscount(xhpc.getPromotionDiscount());
|
||||||
|
xhpcSt.setActPrice(xhpc.getActPrice());
|
||||||
|
xhpcSt.setInternetCommission(xhpc.getInternetCommission());
|
||||||
|
xhpcSt.setInternetSvcCommission(xhpc.getInternetSvcCommission());
|
||||||
|
xhpcSt.setPlatformCommission(xhpc.getPlatformCommission());
|
||||||
|
xhpcSt.setPlatformSvcCommisssion(xhpc.getPlatformSvcCommisssion());
|
||||||
|
xhpcSt.setOperationCommission(xhpc.getOperationCommission());
|
||||||
|
xhpcSt.setOperationSvcCommission(xhpc.getOperationSvcCommission());
|
||||||
|
xhpcSt.setActPowerPrice(xhpc.getActPowerPrice());
|
||||||
|
xhpcSt.setActServicePrice(xhpc.getActServicePrice());
|
||||||
|
if(xhpc.getSource()==1){
|
||||||
|
xhpcSt.setInternetUserId(xhpc.getUserId());
|
||||||
|
}
|
||||||
|
xhpcSt.setOperatorId(xhpc.getOperatorId());
|
||||||
|
xhpcSt.setChargingStationId(xhpc.getChargingStationId());
|
||||||
|
xhpcSt.setCreateTime(Calendar.getInstance().getTime());
|
||||||
|
xhpcSt.setTerminalId(xhpc.getTerminalId());
|
||||||
|
xhpcSt.setChargingMode(xhpc.getChargingMode());
|
||||||
|
|
||||||
|
xhpcSt.setHistoryOrderId(historyOrderId);
|
||||||
|
xhpcSt.setChargingPileId(xhpc.getChargingPileId());
|
||||||
|
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||||
|
xhpcSt.setSource(xhpc.getSource());
|
||||||
|
xhpcSt.setInternetDegreeCommission(xhpc.getInternetDegreeCommission());
|
||||||
|
xhpcSt.setType(i);
|
||||||
|
xhpcStatisticsService.addStatisticsStation(xhpcSt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//修改历史订单表状态
|
//修改历史订单表状态
|
||||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),type+1);
|
xhpcHistoryOrderService.updateXhpcHistoryOrder(historyOrderId,type+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,13 +155,19 @@ public interface XhpcStatisticsServiceMapper {
|
|||||||
*/
|
*/
|
||||||
void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation);
|
void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询是否重复录入数据
|
||||||
|
* @param historyOrderId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getStatisticsTimeHistoryOrderId(@Param("historyOrderId")Long historyOrderId);
|
||||||
/**
|
/**
|
||||||
* 获取流量方列表
|
* 获取流量方列表
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String,String>> getInternetList(@Param("userId")Long userId,@Param("tenantId")String tenantId);
|
List<Map<String,String>> getInternetList(@Param("userId")Long userId,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
|
int getStatisticsStationHistoryOrderId(@Param("historyOrderId")Long historyOrderId,@Param("type")Integer type);
|
||||||
/**
|
/**
|
||||||
* 订单来源列表
|
* 订单来源列表
|
||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
|
|||||||
@ -175,7 +175,12 @@ public interface IXhpcStatisticsService {
|
|||||||
*/
|
*/
|
||||||
void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval);
|
void addStatisticsTime(XhpcStatisticsTimeInterval xhpcStatisticsTimeInterval);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询是否重复录入数据
|
||||||
|
* @param historyOrderId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getStatisticsTimeHistoryOrderId(Long historyOrderId);
|
||||||
/**
|
/**
|
||||||
* 添加订单统计
|
* 添加订单统计
|
||||||
*
|
*
|
||||||
@ -183,6 +188,13 @@ public interface IXhpcStatisticsService {
|
|||||||
*/
|
*/
|
||||||
void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation);
|
void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询是否重复录入数据
|
||||||
|
* @param historyOrderId
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int getStatisticsStationHistoryOrderId(Long historyOrderId,Integer type);
|
||||||
|
|
||||||
// -------------------- 导出功能 ------------------
|
// -------------------- 导出功能 ------------------
|
||||||
|
|
||||||
|
|||||||
@ -469,11 +469,21 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
|||||||
xhpcStatisticsServiceMapper.addStatisticsTime(xhpcStatisticsTimeInterval);
|
xhpcStatisticsServiceMapper.addStatisticsTime(xhpcStatisticsTimeInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatisticsTimeHistoryOrderId(Long historyOrderId) {
|
||||||
|
return xhpcStatisticsServiceMapper.getStatisticsTimeHistoryOrderId(historyOrderId);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation) {
|
public void addStatisticsStation(XhpcStatisticsStation xhpcStatisticsStation) {
|
||||||
xhpcStatisticsServiceMapper.addStatisticsStation(xhpcStatisticsStation);
|
xhpcStatisticsServiceMapper.addStatisticsStation(xhpcStatisticsStation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatisticsStationHistoryOrderId(Long historyOrderId, Integer type) {
|
||||||
|
return xhpcStatisticsServiceMapper.getStatisticsStationHistoryOrderId(historyOrderId, type);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean getJudge(Long internetUserId, Long operatorId, Integer type) {
|
private boolean getJudge(Long internetUserId, Long operatorId, Integer type) {
|
||||||
|
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
|
|||||||
@ -917,4 +917,11 @@
|
|||||||
</if>
|
</if>
|
||||||
group by ss.charging_mode
|
group by ss.charging_mode
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getStatisticsTimeHistoryOrderId" resultType="int">
|
||||||
|
select count(statistics_time_interval_id) from xhpc_statistics_time_interval where history_order_id=#{historyOrderId}
|
||||||
|
</select>
|
||||||
|
<select id="getStatisticsStationHistoryOrderId" resultType="int">
|
||||||
|
select count(statistics_station_id) from xhpc_statistics_station where history_order_id=#{historyOrderId} and type=#{type}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user