小程序用户登录及注册,统计修改,桩列表详情修改

This commit is contained in:
yuyang 2021-11-18 11:21:04 +08:00
parent a1268eec83
commit 6eaebea373
12 changed files with 243 additions and 98 deletions

View File

@ -196,7 +196,7 @@ public interface IXhpcChargingStationService {
* @param serialNumber
* @return
*/
Integer getTerminalStatus(String serialNumber);
int getTerminalStatus(String serialNumber);
/**
* 通过id查找对应的场站

View File

@ -180,7 +180,7 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService {
if(list !=null && list.size()>0){
for (int i = 0; i < list.size(); i++) {
Map<String, Object> listMap =list.get(i);
Integer pileSerialNumber = xhpcChargingStationService.getTerminalStatus(listMap.get("serialNumber").toString());
int pileSerialNumber = xhpcChargingStationService.getTerminalStatus(listMap.get("serialNumber").toString());
listMap.put("workStatus",pileSerialNumber);
}
}

View File

@ -369,21 +369,28 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
XhpcRateDto xhpcRateDto = xhpcRateList.get(k);
XhpcRate xhpcRate = new XhpcRate();
xhpcRate.setChargingStationId(chargingStationId);
if ("00".equals(xhpcRateDto.getId())) {
xhpcRate.setName("尖费率");
} else if ("01".equals(xhpcRateDto.getId())) {
xhpcRate.setName("峰费率");
} else if ("02".equals(xhpcRateDto.getId())) {
xhpcRate.setName("平费率");
} else {
xhpcRate.setName("谷费率");
if ("00".equals(xhpcRateDto.getId()) || "01".equals(xhpcRateDto.getId()) || "02".equals(xhpcRateDto.getId()) || "03".equals(xhpcRateDto.getId())) {
if ("00".equals(xhpcRateDto.getId())) {
xhpcRate.setName("尖费率");
} else if ("01".equals(xhpcRateDto.getId())) {
xhpcRate.setName("峰费率");
} else if ("02".equals(xhpcRateDto.getId())) {
xhpcRate.setName("平费率");
} else {
xhpcRate.setName("谷费率");
}
xhpcRate.setPowerFee(xhpcRateDto.getPowerFee());
xhpcRate.setServiceFee(xhpcRateDto.getServiceFee());
xhpcRate.setRateModelId(rateModelId);
xhpcRate.setRateValue(xhpcRateDto.getId());
xhpcChargingStationMapper.addXhpcRate(xhpcRate);
map.put(xhpcRateDto.getId(), xhpcRate.getRateId());
}else{
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error("添加费率错误,请稍后在试");
}
xhpcRate.setPowerFee(xhpcRateDto.getPowerFee());
xhpcRate.setServiceFee(xhpcRateDto.getServiceFee());
xhpcRate.setRateModelId(rateModelId);
xhpcRate.setRateValue(xhpcRateDto.getId());
xhpcChargingStationMapper.addXhpcRate(xhpcRate);
map.put(xhpcRateDto.getId(), xhpcRate.getRateId());
}
//添加费率时段
@ -826,7 +833,6 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
}
}
}
//添加费率计费模型
XhpcRateModel xhpcRateModel = new XhpcRateModel();
BeanUtils.copyProperties(xhpcChargingStationDto, xhpcRateModel);
@ -853,15 +859,20 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
for (int k = 0; k < xhpcRateList.size(); k++) {
//存费率信息并存储Map,费率时段使用找到费率id
XhpcRateDto xhpcRateDto = xhpcRateList.get(k);
XhpcRate xhpcRate = new XhpcRate();
xhpcRate.setChargingStationId(chargingStationId);
xhpcRate.setName(xhpcRateDto.getName());
xhpcRate.setPowerFee(xhpcRateDto.getPowerFee());
xhpcRate.setServiceFee(xhpcRateDto.getServiceFee());
xhpcRate.setRateModelId(rateModelId);
xhpcRate.setRateValue(xhpcRateDto.getId());
xhpcChargingStationMapper.addXhpcRate(xhpcRate);
map.put(xhpcRateDto.getId(), xhpcRate.getRateId());
if ("00".equals(xhpcRateDto.getId()) || "01".equals(xhpcRateDto.getId()) || "02".equals(xhpcRateDto.getId()) || "03".equals(xhpcRateDto.getId())) {
XhpcRate xhpcRate = new XhpcRate();
xhpcRate.setChargingStationId(chargingStationId);
xhpcRate.setName(xhpcRateDto.getName());
xhpcRate.setPowerFee(xhpcRateDto.getPowerFee());
xhpcRate.setServiceFee(xhpcRateDto.getServiceFee());
xhpcRate.setRateModelId(rateModelId);
xhpcRate.setRateValue(xhpcRateDto.getId());
xhpcChargingStationMapper.addXhpcRate(xhpcRate);
map.put(xhpcRateDto.getId(), xhpcRate.getRateId());
}else{
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error("添加费率错误,请稍后在试");
}
}
//添加费率时段
@ -1126,30 +1137,32 @@ public class XhpcChargingStationServiceImpl implements IXhpcChargingStationServi
}
@Override
public Integer getTerminalStatus(String serialNumber) {
Integer status =5;
public int getTerminalStatus(String serialNumber) {
//0离线 1故障 2空闲 3充电 4 已插枪 5未知
// Integer status =5;
//终端状态用 redis数据
if(!"".equals(serialNumber) && serialNumber!=null){
Map<String, Object> cacheMap =redisService.getCacheMap("gun:"+serialNumber);
if(cacheMap !=null && cacheMap.get("status") !=null){
if ("离线".equals(cacheMap.get("status").toString())){
status =0;
return 0;
}else if("故障".equals(cacheMap.get("status").toString())){
status =1;
return 1;
}else if("空闲".equals(cacheMap.get("status").toString())){
if("".equals(cacheMap.get("vehicleGunStatus").toString())){
status =4;
return 4;
}else{
status =2;
return 2;
}
}else{
//充电桩
status = 3;
return 3;
}
}
return 5;
}else{
return 5;
}
return status;
}
@Override

View File

@ -47,7 +47,7 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService {
for (int i = 0; i <list.size() ; i++) {
Map<String, Object> map = list.get(i);
//状态
Integer pileSerialNumber = xhpcChargingStationService.getTerminalStatus(map.get("serialNumber").toString());
int pileSerialNumber = xhpcChargingStationService.getTerminalStatus(map.get("serialNumber").toString());
map.put("workStatus",pileSerialNumber);
}
}
@ -99,7 +99,7 @@ public class XhpcTerminalServiceImpl implements IXhpcTerminalService {
if(map.get("chargingDegreeSum")==null || map.get("chargingDegreeSum").toString()==null || "".equals(map.get("chargingDegreeSum").toString())){
map.put("chargingDegreeSum",0);
}
Integer status = xhpcChargingStationService.getTerminalStatus(map.get("serialNumber").toString());
int status = xhpcChargingStationService.getTerminalStatus(map.get("serialNumber").toString());
map.put("workStatus",status);

View File

@ -82,7 +82,7 @@
ct.name as chargingStationName,
te.pile_serial_number as pileSerialNumber,
cp.power as power,
cp.serial_number as serialNumber,
te.serial_number as serialNumber,
cp.brand_model as brandModel,
cp.type as pileType,
te.status as status,

View File

@ -364,9 +364,10 @@ public class XhpcPileOrderController extends BaseController {
R.ok();
}
}else{
// Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+orderNo);
// xhpcHistoryOrder.setInternetSerialNumber(pushOrder.get("internetSerialNumber").toString());
// xhpcChargeOrder.setOperatorId3rdptyEvcs((String) pushOrder.get("operatorId3rdpty"));
Map<String, Object> pushOrder = redisService.getCacheMap("pushOrder:"+orderNo);
xhpcHistoryOrder.setInternetSerialNumber(pushOrder.get("internetSerialNumber").toString());
xhpcHistoryOrder.setOperatorId3rdptyEvcs((String) pushOrder.get("operatorId3rdpty"));
xhpcChargeOrder.setOperatorId3rdptyEvcs((String) pushOrder.get("operatorId3rdpty"));
}
//结算

View File

@ -88,7 +88,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 终端统计
*/
@GetMapping("/test3")
//@Scheduled(cron = "0 0/8 * * * ?")
@Scheduled(cron = "0 0/8 * * * ?")
public void test3(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>终端统计定时任务>>>>>>>>>>>>>>>>>>>>>");
@ -99,7 +99,7 @@ public class XhpcHistoryOrderController extends BaseController {
* 场站统计
*/
@GetMapping("/test2")
//@Scheduled(cron = "0 0/7 * * * ?")
@Scheduled(cron = "0 0/7 * * * ?")
public void test2(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>场站统计定时任务>>>>>>>>>>>>>>>>>>>>>");
@ -111,8 +111,16 @@ public class XhpcHistoryOrderController extends BaseController {
* 日期统计
*/
@GetMapping("/test1")
//@Scheduled(cron = "0 0/6 * * * ?")
@Scheduled(cron = "0 0/6 * * * ?")
public void test1(){
add(1000,1);
}
/**
* 日期统计(已废弃)
*/
@GetMapping("/test7")
//@Scheduled(cron = "0 0/6 * * * ?")
public void test7(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>日期统计定时任务>>>>>>>>>>>>>>>>>>>>>");
@ -173,7 +181,7 @@ public class XhpcHistoryOrderController extends BaseController {
xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId());
xhpcSt.setChargingPileId(xhpc.getChargingPileId());
xhpcSt.setType(type);
xhpcSt.setCreateTime(xhpc.getCreateTime());
xhpcSt.setCreateTime(xhpc.getEndTime());
xhpcStatisticsService.addStatisticsStation(xhpcSt);
//修改历史订单表状态
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),type + 1);
@ -376,11 +384,7 @@ public class XhpcHistoryOrderController extends BaseController {
xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId());
xhpcSt.setChargingPileId(xhpc.getChargingPileId());
xhpcSt.setType(type);
if(number==1){
xhpcSt.setCreateTime(xhpc.getCreateTime());
}else{
xhpcSt.setCreateTime(DateUtil.offset(xhpc.getCreateTime(), DateField.DAY_OF_MONTH, 1));
}
xhpcSt.setCreateTime(xhpc.getEndTime());
xhpcStatisticsService.addStatisticsStation(xhpcSt);
//修改历史订单表状态
@ -403,8 +407,91 @@ public class XhpcHistoryOrderController extends BaseController {
* 小时统计
*/
@GetMapping("/test")
//@Scheduled(cron = "0 0/5 * * * ?")
@Scheduled(cron = "0 0/5 * * * ?")
public void test(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
try{
//小时统计
List<XhpcChargeHistoryOrder> list = xhpcHistoryOrderService.getStatistisList(500,0);
if(list !=null && list.size()>0){
for (XhpcChargeHistoryOrder xhpc:list) {
//开始时间结束时间模型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();
Date data = Calendar.getInstance().getTime();
if(xhpc.getTotalPrice().compareTo(new BigDecimal(0)) !=1){
continue;
}
if(xhpc.getChargingDegree().compareTo(new BigDecimal(0)) !=1){
continue;
}
//每分钟多少度电
BigDecimal v = new BigDecimal((endTime.getTime() - startTime.getTime())).divide(new BigDecimal(60000),2,BigDecimal.ROUND_DOWN);
if(v.compareTo(new BigDecimal(0)) !=1){
continue;
}
int endHour = DateUtil.hour(endTime, true);
//没有跨时段
XhpcStatisticsTimeInterval xhpcSt = new XhpcStatisticsTimeInterval();
xhpcSt.setStatus(endHour+1);
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600),2, BigDecimal.ROUND_DOWN));
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());
}
List<Map<String, Object>> reatTimeList = xhpcHistoryOrderService.getReatTimeList(DateUtil.formatTime(startTime), DateUtil.formatTime(endTime), rateModelId);
Map<String, Object> map = reatTimeList.get(0);
xhpcSt.setElecPriceEvcs(new BigDecimal(map.get("powerFee").toString()));
xhpcSt.setServicePriceEvcs(new BigDecimal(map.get("serviceFee").toString()));
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){
}
}
/**
* 小时统计(精确统计)
*/
@GetMapping("/test8")
//@Scheduled(cron = "0 0/5 * * * ?")
public void test8(){
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
logger.info(">>>>>>>>>>>>>>>>>>>>>>>小时统计定时任务>>>>>>>>>>>>>>>>>>>>>");
@ -478,7 +565,7 @@ public class XhpcHistoryOrderController extends BaseController {
xhpcSt.setServicePriceEvcs(new BigDecimal(map.get("serviceFee").toString()));
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.getCreateTime());
xhpcSt.setCreateTime(xhpc.getEndTime());
xhpcStatisticsService.addStatisticsTime(xhpcSt);
//修改历史订单表状态
xhpcHistoryOrderService.updateXhpcHistoryOrder(xhpc.getHistoryOrderId(),1);
@ -730,11 +817,7 @@ public class XhpcHistoryOrderController extends BaseController {
xhpcSt.setOperatorId(xhpc.getOperatorId());
xhpcSt.setChargingStationId(xhpc.getChargingStationId());
xhpcSt.setDelFlag(0);
if(type!=3){
xhpcSt.setCreateTime(xhpc.getCreateTime());
}else{
xhpcSt.setCreateTime(DateUtil.offset(xhpc.getCreateTime(), DateField.DAY_OF_MONTH, 1));
}
xhpcSt.setCreateTime(xhpc.getEndTime());
xhpcSt.setTerminalId(xhpc.getTerminalId());
xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId());
xhpcSt.setStartTimeEvcs(yyyyMMdd+" "+srt);
@ -803,8 +886,7 @@ public class XhpcHistoryOrderController extends BaseController {
for (XhpcChargeHistoryOrder xhpc:list) {
XhpcStatisticsStation xhpcSt =new XhpcStatisticsStation();
xhpcSt.setChargingDegree(xhpc.getChargingDegree());
BigDecimal decimal = new BigDecimal(xhpc.getChargingTimeNumber() / 3600).setScale(2, BigDecimal.ROUND_DOWN);
xhpcSt.setChargingTime(decimal);
xhpcSt.setChargingTime(new BigDecimal(xhpc.getChargingTimeNumber()).divide(new BigDecimal(3600), 2, BigDecimal.ROUND_DOWN));
xhpcSt.setChargingNumber(1);
xhpcSt.setPowerPrice(xhpc.getPowerPriceTotal());
xhpcSt.setServicePrice(xhpc.getServicePriceTotal());
@ -829,7 +911,7 @@ public class XhpcHistoryOrderController extends BaseController {
xhpcSt.setHistoryOrderId(xhpc.getHistoryOrderId());
xhpcSt.setChargingPileId(xhpc.getChargingPileId());
xhpcSt.setType(type);
xhpcSt.setCreateTime(xhpc.getCreateTime());
xhpcSt.setCreateTime(xhpc.getEndTime());
xhpcStatisticsService.addStatisticsStation(xhpcSt);
//修改历史订单表状态
@ -848,5 +930,19 @@ public class XhpcHistoryOrderController extends BaseController {
System.out.println(date1.getTime()-date.getTime());
DateTime startTime = DateUtil.parse("2021-10-19 17:35:19");
DateTime endTime = DateUtil.parse("2021-10-19 17:36:02");
//充电时长
Long tiem = (endTime.getTime() - startTime.getTime())/1000;
System.out.println(">>>>"+tiem);
BigDecimal decimal = new BigDecimal(72);
BigDecimal decimal1 = new BigDecimal(3600);
System.out.println(decimal.divide(decimal1,2,BigDecimal.ROUND_DOWN));
}
}

View File

@ -204,6 +204,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<充电返回>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getCode() + ">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getMsg() + ">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getData() + ">>>>>>>>>>>>>>>>>");
if (r1.getCode() != 200) {
return AjaxResult.error(r1.getMsg());
}
@ -460,9 +461,11 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<Soc>>>>>>>>>>>>>>>>>:" + startChargingData.getSoc());
R r1 = powerPileService.startCharging(startChargingData);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<充电返回>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<第三方充电返回>>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getCode() + ">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getMsg() + ">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<" + r1.getData() + ">>>>>>>>>>>>>>>>>");
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<第三方充电返回>>>>>>>>>>>>>>>>>");
if (r1.getCode() != 200) {
r.setCode(500);
r.setMsg(r1.getMsg());
@ -470,7 +473,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService {
}
String startTime = DateUtil.format(date, "yyyy-MM-dd HH: mm: ss");
Map<String, Object> extraData1 = xhpcChargeOrderMapper.selectDate3rdNeedBy(connectorId).get(0);
Long rateModelId = (Long) extraData1.get("rateModelId");
Long rateModelId = Long.valueOf(r1.getData().toString());
Long terminalId = (Long) extraData1.get("terminalId");
Double power = (Double) extraData1.get("power");
Long chargingStationId = (Long) extraData1.get("chargingStationId");

View File

@ -244,14 +244,16 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
//0总金额提成 1服务费提成
if(new BigDecimal(0).compareTo(commissionRate)==-1){
if("0".equals(operatorIdEvcs.get("commissionType").toString())){
internetCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN);
actPrice = actPrice.multiply(internetCommission);
surplusPowerPrice = surplusPowerPrice.subtract(internetCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN));
surplusServicePrice =surplusServicePrice.subtract(internetCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN));
//流量方的钱
internetCommission=actPrice.multiply(commissionRate).setScale(2,BigDecimal.ROUND_DOWN);
actPrice = actPrice.subtract(internetCommission);
surplusPowerPrice = surplusPowerPrice.multiply(commissionRate).setScale(2,BigDecimal.ROUND_DOWN);
surplusServicePrice =surplusServicePrice.multiply(commissionRate).setScale(2,BigDecimal.ROUND_DOWN);
}else{
internetSvcCommission = actPrice.divide(commissionRate).setScale(2,BigDecimal.ROUND_DOWN);
actPrice = actPrice.multiply(internetSvcCommission);
surplusServicePrice =surplusServicePrice.subtract(internetCommission.divide(new BigDecimal(2),2,BigDecimal.ROUND_DOWN));
internetSvcCommission = actPrice.multiply(commissionRate).setScale(2,BigDecimal.ROUND_DOWN);
actPrice = actPrice.subtract(internetSvcCommission);
surplusServicePrice =surplusServicePrice.multiply(commissionRate).setScale(2,BigDecimal.ROUND_DOWN);
}
}
}
@ -284,22 +286,22 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
if(fan){
promotionDiscount=money.multiply(discount).setScale(2,BigDecimal.ROUND_DOWN);
actPrice = money.subtract(promotionDiscount);
surplusPowerPrice = surplusPowerPrice.subtract(promotionDiscount.divide(new BigDecimal(2),BigDecimal.ROUND_DOWN));
surplusServicePrice= surplusServicePrice.subtract(promotionDiscount.divide(new BigDecimal(2),BigDecimal.ROUND_DOWN));
surplusPowerPrice = surplusPowerPrice.multiply(discount).setScale(2,BigDecimal.ROUND_DOWN);
surplusServicePrice= surplusServicePrice.multiply(discount).setScale(2,BigDecimal.ROUND_DOWN);
}
}else if("2".equals(state)){
if(fan){
//电费
promotionDiscount =powerPrice.multiply(balance).setScale(2,BigDecimal.ROUND_DOWN);
actPrice = money.subtract(promotionDiscount);
surplusPowerPrice=surplusPowerPrice.subtract(promotionDiscount);
surplusPowerPrice=surplusPowerPrice.multiply(balance).setScale(2,BigDecimal.ROUND_DOWN);
}
}else if("3".equals(state)){
if(fan){
//服务费
promotionDiscount = servicePrice.multiply(balance).setScale(2,BigDecimal.ROUND_DOWN);
actPrice = money.subtract(promotionDiscount);
surplusServicePrice =surplusServicePrice.subtract(promotionDiscount);
surplusServicePrice =surplusServicePrice.multiply(balance).setScale(2,BigDecimal.ROUND_DOWN);
}
}
}
@ -330,10 +332,11 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_DOWN);
platformCommission = multiply1.add(multiply2);
//剩下的钱
surplusPowerPrice = surplusPowerPrice.subtract(multiply1);
surplusServicePrice = surplusServicePrice.subtract(multiply2);
surplusPowerPrice = surplusPowerPrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_DOWN);
surplusServicePrice = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_DOWN);
BigDecimal multiply3 = surplusPowerPrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_DOWN);
BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_DOWN);
operationCommission = multiply1.add(multiply2);
//剩下的钱
surplusPowerPrice = surplusPowerPrice.subtract(multiply3);
@ -343,7 +346,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
BigDecimal multiply2 = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_DOWN);
platformSvcCommission=multiply2;
//剩下的钱
surplusServicePrice = surplusServicePrice.subtract(multiply2);
surplusServicePrice = surplusServicePrice.multiply(platformCommissionRate).setScale(2,BigDecimal.ROUND_DOWN);
BigDecimal multiply4 = surplusServicePrice.multiply(maintenanceCommissionRate).setScale(2,BigDecimal.ROUND_DOWN);
operationCommission = multiply4;

View File

@ -586,11 +586,11 @@
select xt.charging_station_id as chargingStationId,
xt.terminal_id as terminalId,
xt.rate_model_id as rateModelId,
cs.rate_model_id as rateModelId,
power
from xhpc_terminal as xt
left join xhpc_charging_pile as xcp
on xcp.serial_number = substring(#{serialNumber}, 1, 14)
left join xhpc_charging_pile as xcp on xcp.serial_number = substring(#{serialNumber}, 1, 14)
left join xhpc_charging_station as cs on xt.charging_station_id = cs.charging_station_id
where xt.serial_number = #{serialNumber}
</select>

View File

@ -88,9 +88,11 @@
#{chargingStationId}
</foreach>
</if>
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
and #{startTime} &lt;=create_time
and create_time &lt;=#{endTime}
<if test="startTime !=null and startTime !=''">
and create_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
and create_time &lt;= #{endTime}
</if>
<if test="type==2">
and operator_id=#{operatorId}
@ -135,9 +137,11 @@
#{chargingStationId}
</foreach>
</if>
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
and #{startTime} &lt;=create_time
and create_time &lt;=#{endTime}
<if test="startTime !=null and startTime !=''">
and create_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
and create_time &lt;= #{endTime}
</if>
<if test="type==2">
and operator_id=#{operatorId}
@ -179,9 +183,11 @@
left join xhpc_charging_station as cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_operator as op on op.operator_id = ss.operator_id
where ss.del_flag=0 and ss.type=2
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
and #{startTime} &lt;=ss.create_time
and ss.create_time &lt;=#{endTime}
<if test="startTime !=null and startTime !=''">
and ss.create_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
and ss.create_time &lt;= #{endTime}
</if>
<if test="type==2">
and ss.operator_id=#{operatorId}
@ -232,9 +238,11 @@
from xhpc_statistics_station as ss
left join xhpc_operator as op on op.operator_id = ss.operator_id
where ss.del_flag=0 and ss.type=2
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
and #{startTime} &lt;=ss.create_time
and ss.create_time &lt;=#{endTime}
<if test="startTime !=null and startTime !=''">
and ss.create_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
and ss.create_time &lt;= #{endTime}
</if>
<if test="operatorUserId !=null and operatorUserId.size()>0">
and ss.operator_id in
@ -281,9 +289,11 @@
from xhpc_statistics_station as ss
left join xhpc_internet_user as iu on iu.internet_user_id = ss.internet_user_id
where ss.del_flag=0 and ss.type=2 and ss.internet_user_id !=null
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
and #{startTime} &lt;=ss.create_time
and ss.create_time &lt;=#{endTime}
<if test="startTime !=null and startTime !=''">
and ss.create_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
and ss.create_time &lt;= #{endTime}
</if>
<if test="internetIds !=null and internetIds.size()>0">
and ss.internet_user_id in
@ -322,9 +332,11 @@
left join xhpc_charging_station as cs on cs.charging_station_id = ss.charging_station_id
left join xhpc_terminal as te on te.terminal_id = ss.terminal_id
where ss.del_flag=0 and ss.type=3
<if test="startTime !=null and startTime !='' and endTime !=null and endTime !=''">
and #{startTime} &lt;=ss.create_time
and ss.create_time &lt;=#{endTime}
<if test="startTime !=null and startTime !=''">
and ss.create_time &gt;= #{startTime}
</if>
<if test="endTime !=null and endTime !=''">
and ss.create_time &lt;= #{endTime}
</if>
<if test="type==2">
and ss.operator_id=#{operatorId}

View File

@ -206,7 +206,24 @@ public class XhpcAppUserServiceImpl implements IXhpcAppUserUserService {
// 查询用户信息
XhpcAppUser user = xhpcAppUserMapper.getAppUserByPhone(username);
if (StringUtils.isNull(user)) {
return R.fail(HttpStatus.DATA_ERROR, "登录用户:" + username + " 不存在");
//注册
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setPhone(username);
String password = username.substring(username.length() - 6);
xhpcAppUser.setPassword(SecurityUtils.encryptPassword(password));
xhpcAppUser.setCreateTime(new Date());
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
xhpcAppUser.setWeixinOpenId(openid);
xhpcAppUser.setWeixinLogin(1);
} else {
xhpcAppUser.setAlipayOpenId(openid);
xhpcAppUser.setAlipayLogin(1);
}
xhpcAppUserMapper.insert(xhpcAppUser);
user = xhpcAppUserMapper.getAppUserByPhone(username);
// 获取登录token
//return R.ok(tokenService.createToken(userInfo));
//return R.fail(HttpStatus.DATA_ERROR, "登录用户:" + username + " 不存在");
}
LoginUser userInfo = new LoginUser();
SysUser sysUser = new SysUser();