增加统计订单入库查询机制,优化结算
This commit is contained in:
parent
372b44cb66
commit
2e1620e51f
@ -77,7 +77,7 @@
|
|||||||
and o.tenant_id = #{params.tenantId}
|
and o.tenant_id = #{params.tenantId}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY o.work_order_id
|
GROUP BY o.work_order_id
|
||||||
ORDER BY o.status ASC
|
ORDER BY o.status ASC,o.create_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -444,9 +444,6 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
}
|
}
|
||||||
if(count==0){
|
if(count==0){
|
||||||
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
||||||
Date startTime = xhpc.getStartTime();
|
|
||||||
Date endTime = xhpc.getEndTime();
|
|
||||||
Long rateModelId = xhpc.getRateModelId();
|
|
||||||
Long operatorId =xhpc.getOperatorId();
|
Long operatorId =xhpc.getOperatorId();
|
||||||
Long chargingStationId = xhpc.getChargingStationId();
|
Long chargingStationId = xhpc.getChargingStationId();
|
||||||
Long terminalId = xhpc.getTerminalId();
|
Long terminalId = xhpc.getTerminalId();
|
||||||
@ -462,10 +459,10 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
// if(v.compareTo(new BigDecimal(0)) !=1){
|
// if(v.compareTo(new BigDecimal(0)) !=1){
|
||||||
// continue;
|
// continue;
|
||||||
// }
|
// }
|
||||||
int endHour = DateUtil.hour(endTime, true);
|
|
||||||
//没有跨时段
|
//没有跨时段
|
||||||
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
|
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
|
||||||
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));
|
||||||
@ -497,9 +494,15 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
}
|
}
|
||||||
//时间没有跨天
|
//时间没有跨天
|
||||||
xhpcSt.setInternetDegreeCommission(xhpc.getInternetDegreeCommission());
|
xhpcSt.setInternetDegreeCommission(xhpc.getInternetDegreeCommission());
|
||||||
xhpcSt.setStartTimeEvcs(DateUtil.format(startTime, "yyyy-MM-dd HH:mm:ss"));
|
if(xhpc.getStartTime() !=null){
|
||||||
xhpcSt.setEndTimeEvcs(DateUtil.format(endTime, "yyyy-MM-dd HH:mm:ss"));
|
xhpcSt.setStartTimeEvcs(DateUtil.format(xhpc.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
}
|
||||||
|
if(xhpc.getEndTime() !=null){
|
||||||
|
int endHour = DateUtil.hour(xhpc.getEndTime(), true);
|
||||||
|
xhpcSt.setStatus(endHour+1);
|
||||||
|
xhpcSt.setEndTimeEvcs(DateUtil.format(xhpc.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||||
|
}
|
||||||
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
||||||
//修改历史订单表状态
|
//修改历史订单表状态
|
||||||
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1);
|
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1);
|
||||||
@ -940,6 +943,131 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//检查统计没有入库的订单
|
||||||
|
@Scheduled(cron = "0 1 * * * ?")
|
||||||
|
@GetMapping("/getInvo")
|
||||||
|
public void getNoStatisticsOrderTime(){
|
||||||
|
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getNoStatisticsOrderTime(500);
|
||||||
|
if(list !=null && list.size()>0){
|
||||||
|
for (XhpcChargeHistoryOrder xhpc:list) {
|
||||||
|
try{
|
||||||
|
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||||
|
int count = xhpcStatisticsService.getStatisticsTimeHistoryOrderId(historyOrderId);
|
||||||
|
if(count>0){
|
||||||
|
XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(historyOrderId,null);
|
||||||
|
if(historyOrder.getState()==0){
|
||||||
|
xhpcHistoryOrderService.updateXhpcHistoryOrder(historyOrderId,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count==0){
|
||||||
|
//开始时间、结束时间、模型id、状态、用户id、运营商、订单id、场站id、终端id、历史订单id、时间
|
||||||
|
Long operatorId =xhpc.getOperatorId();
|
||||||
|
Long chargingStationId = xhpc.getChargingStationId();
|
||||||
|
Long terminalId = xhpc.getTerminalId();
|
||||||
|
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
|
||||||
|
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.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.setActivityPowerPriceTotal(xhpc.getActivityPowerPriceTotal());
|
||||||
|
xhpcSt.setActivityServicePriceTotal(xhpc.getActivityServicePriceTotal());
|
||||||
|
xhpcSt.setActivityTotalPrice(xhpc.getActivityTotalPrice());
|
||||||
|
//xhpcSt.setCreateTime(data);
|
||||||
|
xhpcSt.setTerminalId(terminalId);
|
||||||
|
xhpcSt.setHistoryOrderId(historyOrderId);
|
||||||
|
if(xhpc.getSource()!=null && xhpc.getSource()==1){
|
||||||
|
xhpcSt.setInternetUserId(xhpc.getUserId());
|
||||||
|
}
|
||||||
|
//时间没有跨天
|
||||||
|
xhpcSt.setInternetDegreeCommission(xhpc.getInternetDegreeCommission());
|
||||||
|
if(xhpc.getStartTime() !=null){
|
||||||
|
xhpcSt.setStartTimeEvcs(DateUtil.format(xhpc.getStartTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
if(xhpc.getEndTime() !=null){
|
||||||
|
int endHour = DateUtil.hour(xhpc.getEndTime(), true);
|
||||||
|
xhpcSt.setStatus(endHour+1);
|
||||||
|
xhpcSt.setEndTimeEvcs(DateUtil.format(xhpc.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
|
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||||
|
}
|
||||||
|
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务异常>>>>>>>>>>>>>>>>>>>>>"+xhpc.getHistoryOrderId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<XhpcChargeHistoryOrder> listOrder = xhpcHistoryOrderService.getNoStatisticsOrder(500);
|
||||||
|
if(listOrder !=null && listOrder.size()>0){
|
||||||
|
for (XhpcChargeHistoryOrder xhpc:listOrder) {
|
||||||
|
Long historyOrderId = xhpc.getHistoryOrderId();
|
||||||
|
for (int i = 1; i <4 ; i++) {
|
||||||
|
//查询统计表是否有已添加的数据
|
||||||
|
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()!=null && 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.setActivityPowerPriceTotal(xhpc.getActivityPowerPriceTotal());
|
||||||
|
xhpcSt.setActivityServicePriceTotal(xhpc.getActivityServicePriceTotal());
|
||||||
|
xhpcSt.setActivityTotalPrice(xhpc.getActivityTotalPrice());
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void add(int number,int type){
|
public void add(int number,int type){
|
||||||
//获取500条待统计历史订单
|
//获取500条待统计历史订单
|
||||||
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(number,type);
|
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(number,type);
|
||||||
|
|||||||
@ -102,6 +102,16 @@ public interface XhpcHistoryOrderMapper {
|
|||||||
*/
|
*/
|
||||||
List<XhpcChargeHistoryOrder> getStatistisList(@Param("number")int number,@Param("state")int state);
|
List<XhpcChargeHistoryOrder> getStatistisList(@Param("number")int number,@Param("state")int state);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取为统计的历史订单
|
||||||
|
* @param number
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(@Param("number")int number);
|
||||||
|
|
||||||
|
List<XhpcChargeHistoryOrder> getNoStatisticsOrder(@Param("number")int number);
|
||||||
|
|
||||||
XhpcHistoryOrder getHistoryOrderById(@Param("historyOrderId")Long historyOrderId,@Param("serialNumber")String serialNumber);
|
XhpcHistoryOrder getHistoryOrderById(@Param("historyOrderId")Long historyOrderId,@Param("serialNumber")String serialNumber);
|
||||||
/**
|
/**
|
||||||
* 更新历史订单
|
* 更新历史订单
|
||||||
|
|||||||
@ -93,6 +93,20 @@ public interface IXhpcHistoryOrderService {
|
|||||||
List<XhpcChargeHistoryOrder> getStatistisList(int number,int state);
|
List<XhpcChargeHistoryOrder> getStatistisList(int number,int state);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取为统计的历史订单
|
||||||
|
* @param number
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(int number);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取为统计的历史订单
|
||||||
|
* @param number
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<XhpcChargeHistoryOrder> getNoStatisticsOrder(int number);
|
||||||
/**
|
/**
|
||||||
* 更新历史订单
|
* 更新历史订单
|
||||||
*
|
*
|
||||||
|
|||||||
@ -457,6 +457,27 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
|||||||
return xhpcHistoryOrderMapper.getStatistisList(number, state);
|
return xhpcHistoryOrderMapper.getStatistisList(number, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取为统计的历史订单
|
||||||
|
*
|
||||||
|
* @param number
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<XhpcChargeHistoryOrder> getNoStatisticsOrderTime(int number) {
|
||||||
|
return xhpcHistoryOrderMapper.getNoStatisticsOrderTime(number);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取为统计的历史订单
|
||||||
|
*
|
||||||
|
* @param number
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<XhpcChargeHistoryOrder> getNoStatisticsOrder(int number) {
|
||||||
|
return xhpcHistoryOrderMapper.getNoStatisticsOrder(number);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateXhpcHistoryOrder(Long historyOrderId, Integer state) {
|
public void updateXhpcHistoryOrder(Long historyOrderId, Integer state) {
|
||||||
|
|
||||||
|
|||||||
@ -535,6 +535,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
String internetSerialNumber = xhpcChargeOrder.getInternetSerialNumber();
|
String internetSerialNumber = xhpcChargeOrder.getInternetSerialNumber();
|
||||||
Long chargingStationId = xhpcChargeOrder.getChargingStationId();
|
Long chargingStationId = xhpcChargeOrder.getChargingStationId();
|
||||||
String tenantId = xhpcChargeOrder.getTenantId();
|
String tenantId = xhpcChargeOrder.getTenantId();
|
||||||
|
int computeType =0;
|
||||||
//判断是否有活动
|
//判断是否有活动
|
||||||
logger.info("<<<<<<<<<<<<<<<判断是否有活动>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
logger.info("<<<<<<<<<<<<<<<判断是否有活动>>>>>>>>>>>>>>>>>"+xhpcChargeOrder.getSerialNumber());
|
||||||
boolean judge =false;
|
boolean judge =false;
|
||||||
@ -554,7 +555,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
params1.put("S",servicePrice.doubleValue());
|
params1.put("S",servicePrice.doubleValue());
|
||||||
params1.put("E",totalPower);
|
params1.put("E",totalPower);
|
||||||
String computeFormula = judgeActivity.get("computeFormula").toString();
|
String computeFormula = judgeActivity.get("computeFormula").toString();
|
||||||
int computeType = (int)judgeActivity.get("computeType");
|
computeType = (int)judgeActivity.get("computeType");
|
||||||
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
//活动总服务费
|
//活动总服务费
|
||||||
activityServicePriceTotal = servicePrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
activityServicePriceTotal = servicePrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
@ -597,7 +598,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
params1.put("S",activityServicePriceTotal.doubleValue());
|
params1.put("S",activityServicePriceTotal.doubleValue());
|
||||||
params1.put("E",totalPower);
|
params1.put("E",totalPower);
|
||||||
|
|
||||||
int computeType = (int)judgeActivity.get("computeType");
|
computeType = (int)judgeActivity.get("computeType");
|
||||||
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
if(computeType==1){
|
if(computeType==1){
|
||||||
BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
@ -655,7 +656,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
for (int j = 0; j < activityFormulaTime1.size(); j++) {
|
for (int j = 0; j < activityFormulaTime1.size(); j++) {
|
||||||
XhpcActivityFormulaDomainDto activityFormula = activityFormulaTime1.get(j);
|
XhpcActivityFormulaDomainDto activityFormula = activityFormulaTime1.get(j);
|
||||||
//计费类型
|
//计费类型
|
||||||
int computeType = activityInternet1.getComputeType();
|
computeType = activityInternet1.getComputeType();
|
||||||
BigDecimal activityServicePriceFormula = activityFormula.getServicePrice();
|
BigDecimal activityServicePriceFormula = activityFormula.getServicePrice();
|
||||||
BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
|
BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
|
||||||
//计算公式
|
//计算公式
|
||||||
@ -703,7 +704,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
if(activityFormulaTime2.size()>0){
|
if(activityFormulaTime2.size()>0){
|
||||||
for (int j = 0; j < activityFormulaTime2.size(); j++) {
|
for (int j = 0; j < activityFormulaTime2.size(); j++) {
|
||||||
//计费类型
|
//计费类型
|
||||||
int computeType = activityInternet1.getComputeType();
|
computeType = activityInternet1.getComputeType();
|
||||||
XhpcActivityFormulaDomainDto activityFormula = activityFormulaTime2.get(j);
|
XhpcActivityFormulaDomainDto activityFormula = activityFormulaTime2.get(j);
|
||||||
BigDecimal activityServicePriceFormula = activityFormula.getServicePrice();
|
BigDecimal activityServicePriceFormula = activityFormula.getServicePrice();
|
||||||
BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
|
BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
|
||||||
@ -1072,6 +1073,20 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
|||||||
xhpcHistoryOrder.setReconciliationStatus(0);
|
xhpcHistoryOrder.setReconciliationStatus(0);
|
||||||
xhpcHistoryOrder.setSortingStatus(0);
|
xhpcHistoryOrder.setSortingStatus(0);
|
||||||
if(judge){
|
if(judge){
|
||||||
|
if(UserTypeUtil.INTERNET_TYPE.equals(source)){
|
||||||
|
//computeType
|
||||||
|
BigDecimal totalMoney = actPrice.add(promotionDiscount).add(internetCommission).add(internetSvcCommission).add(internetDegreeCommission).add(platformCommission).add(platformSvcCommission).add(operationCommission).add(operationSvcCommission).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||||
|
if(money.compareTo(totalMoney)==1){
|
||||||
|
BigDecimal remainMoney = money.subtract(totalMoney);
|
||||||
|
if(computeType==1){
|
||||||
|
internetCommission = internetCommission.add(remainMoney);
|
||||||
|
}else if(computeType==2){
|
||||||
|
internetSvcCommission = internetSvcCommission.add(remainMoney);
|
||||||
|
}else{
|
||||||
|
internetDegreeCommission = internetDegreeCommission.add(remainMoney);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
xhpcHistoryOrder.setActivityTotalPrice(activityTotalPriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
|
xhpcHistoryOrder.setActivityTotalPrice(activityTotalPriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
xhpcHistoryOrder.setActivityPowerPriceTotal(activityPowerPriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
|
xhpcHistoryOrder.setActivityPowerPriceTotal(activityPowerPriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
xhpcHistoryOrder.setActivityServicePriceTotal(activityServicePriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
|
xhpcHistoryOrder.setActivityServicePriceTotal(activityServicePriceTotal.setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||||
|
|||||||
@ -950,10 +950,97 @@
|
|||||||
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
||||||
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
|
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
|
||||||
left join xhpc_terminal as te on te.terminal_id = ho.terminal_id
|
left join xhpc_terminal as te on te.terminal_id = ho.terminal_id
|
||||||
where ho.state = #{state} and ho.total_price is not null
|
where ho.state = #{state} and ho.total_price is not null
|
||||||
limit 0,#{number}
|
limit 0,#{number}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getNoStatisticsOrderTime" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
|
||||||
|
select
|
||||||
|
ho.history_order_id as historyOrderId,
|
||||||
|
ho.power_price_total as powerPriceTotal,
|
||||||
|
ho.service_price_total as servicePriceTotal,
|
||||||
|
ho.promotion_discount as promotionDiscount,
|
||||||
|
ho.total_price as totalPrice,
|
||||||
|
ho.act_price as actPrice,
|
||||||
|
ho.act_power_price as actPowerPrice,
|
||||||
|
ho.act_service_price as actServicePrice,
|
||||||
|
ho.internet_commission as internetCommission,
|
||||||
|
ho.internet_svc_commission as internetSvcCommission,
|
||||||
|
ho.internet_degree_commission as internetDegreeCommission,
|
||||||
|
ho.platform_commission as platformCommission,
|
||||||
|
ho.platform_svc_commisssion as platformSvcCommisssion,
|
||||||
|
ho.operation_commission as operationCommission,
|
||||||
|
ho.operation_svc_commission as operationSvcCommission,
|
||||||
|
co.source as source,
|
||||||
|
co.charge_order_id as chargeOrderId,
|
||||||
|
co.charging_station_id as chargingStationId,
|
||||||
|
co.terminal_id as terminalId,
|
||||||
|
ho.start_time as startTime,
|
||||||
|
ho.end_time as endTime,
|
||||||
|
co.charging_time_number as chargingTimeNumber,
|
||||||
|
co.charging_degree as chargingDegree,
|
||||||
|
co.rate_model_id as rateModelId,
|
||||||
|
cs.operator_id as operatorId,
|
||||||
|
te.charging_pile_id as chargingPileId,
|
||||||
|
co.user_id as userId,
|
||||||
|
co.user_id as internetUserId,
|
||||||
|
ho.charging_mode as chargingMode,
|
||||||
|
ho.activity_power_price_total as activityPowerPriceTotal,
|
||||||
|
ho.activity_service_price_total as activityServicePriceTotal,
|
||||||
|
ho.activity_total_price as activityTotalPrice,
|
||||||
|
ho.create_time as createTime
|
||||||
|
from xhpc_history_order ho
|
||||||
|
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
||||||
|
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
|
||||||
|
left join xhpc_terminal as te on te.terminal_id = ho.terminal_id
|
||||||
|
where ho.history_order_id not in (select history_order_id from xhpc_statistics_time_interval )
|
||||||
|
and ho.total_price is not null and now() >DATE_ADD(ho.end_time,interval 6 hour)
|
||||||
|
limit 0,#{number}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getNoStatisticsOrder" resultType="com.xhpc.order.dto.XhpcChargeHistoryOrder">
|
||||||
|
select
|
||||||
|
ho.history_order_id as historyOrderId,
|
||||||
|
ho.power_price_total as powerPriceTotal,
|
||||||
|
ho.service_price_total as servicePriceTotal,
|
||||||
|
ho.promotion_discount as promotionDiscount,
|
||||||
|
ho.total_price as totalPrice,
|
||||||
|
ho.act_price as actPrice,
|
||||||
|
ho.act_power_price as actPowerPrice,
|
||||||
|
ho.act_service_price as actServicePrice,
|
||||||
|
ho.internet_commission as internetCommission,
|
||||||
|
ho.internet_svc_commission as internetSvcCommission,
|
||||||
|
ho.internet_degree_commission as internetDegreeCommission,
|
||||||
|
ho.platform_commission as platformCommission,
|
||||||
|
ho.platform_svc_commisssion as platformSvcCommisssion,
|
||||||
|
ho.operation_commission as operationCommission,
|
||||||
|
ho.operation_svc_commission as operationSvcCommission,
|
||||||
|
co.source as source,
|
||||||
|
co.charge_order_id as chargeOrderId,
|
||||||
|
co.charging_station_id as chargingStationId,
|
||||||
|
co.terminal_id as terminalId,
|
||||||
|
ho.start_time as startTime,
|
||||||
|
ho.end_time as endTime,
|
||||||
|
co.charging_time_number as chargingTimeNumber,
|
||||||
|
co.charging_degree as chargingDegree,
|
||||||
|
co.rate_model_id as rateModelId,
|
||||||
|
cs.operator_id as operatorId,
|
||||||
|
te.charging_pile_id as chargingPileId,
|
||||||
|
co.user_id as userId,
|
||||||
|
co.user_id as internetUserId,
|
||||||
|
ho.charging_mode as chargingMode,
|
||||||
|
ho.activity_power_price_total as activityPowerPriceTotal,
|
||||||
|
ho.activity_service_price_total as activityServicePriceTotal,
|
||||||
|
ho.activity_total_price as activityTotalPrice,
|
||||||
|
ho.create_time as createTime
|
||||||
|
from xhpc_history_order ho
|
||||||
|
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
||||||
|
left join xhpc_charging_station cs on cs.charging_station_id = co.charging_station_id
|
||||||
|
left join xhpc_terminal as te on te.terminal_id = ho.terminal_id
|
||||||
|
where ho.history_order_id not in (select history_order_id from xhpc_statistics_station and type =2 )
|
||||||
|
and ho.total_price is not null and now() >DATE_ADD(ho.end_time,interval 6 hour)
|
||||||
|
limit 0,#{number}
|
||||||
|
</select>
|
||||||
|
|
||||||
<update id="updateXhpcHistoryOrder">
|
<update id="updateXhpcHistoryOrder">
|
||||||
update xhpc_history_order set state = #{state} where history_order_id=#{historyOrderId}
|
update xhpc_history_order set state = #{state} where history_order_id=#{historyOrderId}
|
||||||
|
|||||||
@ -120,6 +120,7 @@
|
|||||||
<if test="operatorId !=null">
|
<if test="operatorId !=null">
|
||||||
and operator_id =#{operatorId}
|
and operator_id =#{operatorId}
|
||||||
</if>
|
</if>
|
||||||
|
and operator_id is not null
|
||||||
group by status
|
group by status
|
||||||
order by status
|
order by status
|
||||||
</select>
|
</select>
|
||||||
@ -183,6 +184,7 @@
|
|||||||
<if test="operatorId !=null">
|
<if test="operatorId !=null">
|
||||||
and operator_id =#{operatorId}
|
and operator_id =#{operatorId}
|
||||||
</if>
|
</if>
|
||||||
|
and operator_id is not null
|
||||||
group by DATE_FORMAT(create_time,'%Y-%m-%d')
|
group by DATE_FORMAT(create_time,'%Y-%m-%d')
|
||||||
order by DATE_FORMAT(create_time,'%Y-%m-%d') desc
|
order by DATE_FORMAT(create_time,'%Y-%m-%d') desc
|
||||||
</select>
|
</select>
|
||||||
@ -257,6 +259,7 @@
|
|||||||
<if test="tenantId !=null and tenantId !=''">
|
<if test="tenantId !=null and tenantId !=''">
|
||||||
and ss.tenant_id = #{tenantId}
|
and ss.tenant_id = #{tenantId}
|
||||||
</if>
|
</if>
|
||||||
|
and ss.operator_id is not null
|
||||||
group by ss.charging_station_id
|
group by ss.charging_station_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -319,8 +322,9 @@
|
|||||||
and ss.tenant_id = #{tenantId}
|
and ss.tenant_id = #{tenantId}
|
||||||
</if>
|
</if>
|
||||||
<if test="operatorId !=null">
|
<if test="operatorId !=null">
|
||||||
and operator_id =#{operatorId}
|
and ss.operator_id =#{operatorId}
|
||||||
</if>
|
</if>
|
||||||
|
and ss.operator_id is not null
|
||||||
group by ss.operator_id
|
group by ss.operator_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -370,8 +374,9 @@
|
|||||||
and ss.tenant_id = #{tenantId}
|
and ss.tenant_id = #{tenantId}
|
||||||
</if>
|
</if>
|
||||||
<if test="operatorId !=null">
|
<if test="operatorId !=null">
|
||||||
and operator_id =#{operatorId}
|
and ss.operator_id =#{operatorId}
|
||||||
</if>
|
</if>
|
||||||
|
and ss.operator_id is not null
|
||||||
group by ss.internet_user_id
|
group by ss.internet_user_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -427,8 +432,9 @@
|
|||||||
and ss.tenant_id = #{tenantId}
|
and ss.tenant_id = #{tenantId}
|
||||||
</if>
|
</if>
|
||||||
<if test="operatorId !=null">
|
<if test="operatorId !=null">
|
||||||
and operator_id =#{operatorId}
|
and ss.operator_id =#{operatorId}
|
||||||
</if>
|
</if>
|
||||||
|
and ss.operator_id is not null
|
||||||
group by ss.terminal_id
|
group by ss.terminal_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -623,6 +629,7 @@
|
|||||||
<if test="tenantId !=null and tenantId !=''">
|
<if test="tenantId !=null and tenantId !=''">
|
||||||
and tenant_id = #{tenantId}
|
and tenant_id = #{tenantId}
|
||||||
</if>
|
</if>
|
||||||
|
and operator_id is not null
|
||||||
group by source
|
group by source
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -1118,6 +1125,7 @@
|
|||||||
<if test="number==2">
|
<if test="number==2">
|
||||||
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{sysUserId})
|
and ss.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{sysUserId})
|
||||||
</if>
|
</if>
|
||||||
|
and ss.operator_id is not null
|
||||||
and ss.charging_mode is not null
|
and ss.charging_mode is not null
|
||||||
group by ss.charging_mode
|
group by ss.charging_mode
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user