增加桩停用提示语,流量方活动电费使用场站电费,修改桩停用,枪也停用

This commit is contained in:
yuyang 2022-08-02 18:18:58 +08:00
parent c7ac30363b
commit ca24f14eaa
9 changed files with 153 additions and 85 deletions

View File

@ -100,7 +100,6 @@ public class XhpcChargingPileController extends BaseController {
@Log(title = "桩-停用", businessType = BusinessType.UPDATE)
@PostMapping(value = "/updateStatus")
public AjaxResult updateStatus(@RequestBody XhpcChargingPile xhpcChargingPile) {
return xhpcChargingPileService.updateStatus(xhpcChargingPile.getChargingPileId(), xhpcChargingPile.getStatus());
}

View File

@ -120,4 +120,11 @@ public interface XhpcChargingPileMapper {
*/
List<XhpcChargingPile> selectXhpcChargingPilesBy(@Param("chargingStationId") Long chargingStationId, @Param("chargingPileId") Long chargingPileId, @Param("tenantId") String tenantId);
/**
* 修改桩的终端
*
* @param chargingPileId
* @return
*/
int xhpcTerminalSataus(@Param("chargingPileId") Long chargingPileId,@Param("status") Integer status);
}

View File

@ -315,10 +315,15 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
@Override
@Transactional
public AjaxResult updateStatus(Long chargingPileId, Integer status) {
XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId);
xhpc.setStatus(status);
xhpcChargingPileMapper.updaeXhpcChargingPile(xhpc);
return AjaxResult.success();
if(status ==0 || status ==1){
XhpcChargingPile xhpc = xhpcChargingPileMapper.selectXhpcChargingPileById(chargingPileId);
xhpc.setStatus(status);
xhpcChargingPileMapper.updaeXhpcChargingPile(xhpc);
//修改枪状态 0正常 1停用
xhpcChargingPileMapper.xhpcTerminalSataus(chargingPileId,status);
return AjaxResult.success();
}
return AjaxResult.error("修改状态不对请重新编辑");
}
@Override

View File

@ -517,4 +517,10 @@
</if>
</where>
</select>
<update id="xhpcTerminalSataus">
update xhpc_terminal
set status = #{status}
where charging_pile_id = #{chargingPileId}
</update>
</mapper>

View File

@ -41,4 +41,15 @@ public class XhpcServiceDataUpdateController {
String tenantId = loginUser.getTenantId();
return xhpcServiceDataUpdateService.update(SOC, version, phone, aliyunMessageCount,tenantId);
}
/**
* 桩停止充电提示语
* @param prompt
* @return
*/
@GetMapping("/pilePromptUpdate")
public AjaxResult pilePromptUpdate(String prompt){
return xhpcServiceDataUpdateService.pilePromptUpdate(prompt);
}
}

View File

@ -32,4 +32,5 @@ public interface IXhpcServiceDataUpdateService {
AjaxResult update(String SOC, String version, String phone, String aliyunMessageCount,String tenantId);
AjaxResult pilePromptUpdate(String prompt);
}

View File

@ -66,4 +66,17 @@ public class XhpcServiceDataUpdateServiceImpl implements IXhpcServiceDataUpdateS
return AjaxResult.success();
}
@Override
public AjaxResult pilePromptUpdate(String prompt) {
LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId();
if("".equals(prompt) || prompt ==null){
String pilePrompts = redisService.getCacheObject("pilePrompt:"+tenantId);
return AjaxResult.success(pilePrompts);
}else{
redisService.setCacheObject("pilePrompt:"+tenantId, prompt);
return AjaxResult.success();
}
}
}

View File

@ -159,6 +159,10 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
//终端信息
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(terminalSerialNumber,tenantId);
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
String pilePrompt = redisService.getCacheObject("pilePrompt:"+tenantId);
if(!"".equals(pilePrompt) && pilePrompt !=null){
return AjaxResult.error(1104, pilePrompt);
}
return AjaxResult.error(1104, "因限电该桩已停用,请选择其他桩进行充电");
}
//查看充电用户金额是否大于5元
@ -336,6 +340,10 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
//终端信息
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(serialNumber,tenantId);
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
String pilePrompt = redisService.getCacheObject("pilePrompt:"+tenantId);
if(!"".equals(pilePrompt) && pilePrompt !=null){
return AjaxResult.error(1104, pilePrompt);
}
return AjaxResult.error(1104, "因限电该桩已停用,请选择其他桩进行充电");
}
@ -349,6 +357,10 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
//获取充电订单号
XhpcChargeOrder order = xhpcChargeOrderMapper.getChargingOrderId(chargingOrderId);
if(order ==null){
String pilePrompt = redisService.getCacheObject("pilePrompt:"+tenantId);
if(!"".equals(pilePrompt) && pilePrompt !=null){
return AjaxResult.error(1104, pilePrompt);
}
return AjaxResult.error(1104, "因限电该桩已停用,请选择其他桩进行充电");
}else{
if(order.getSource()==1){
@ -487,11 +499,18 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
startChargingData.setTel(driverId);
startChargingData.setPileNo(connectorId.substring(0, connectorId.length() - 3));
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<第三方启动>>>>>>connectorId>>>>>>>>>>>"+connectorId);
logger.info("<<<<<<<<<<<<<<<<<<<<<<<<第三方启动>>>>>>>connectorId>>>>>>>>>>"+connectorId);
//终端信息
XhpcTerminal xhpcTerminal = xhpcChargeOrderMapper.getXhpcTerminalSerialNumber(connectorId,null);
if (xhpcTerminal == null || xhpcTerminal.getTerminalId() == null || xhpcTerminal.getChargingPileId() == null || xhpcTerminal.getPileSerialNumber() == null) {
r.setCode(1);
r.setMsg("因限电该桩已停用,请选择其他桩进行充电");
String pilePrompt = redisService.getCacheObject("pilePrompt:000000");
if(!"".equals(pilePrompt) && pilePrompt !=null){
r.setMsg(pilePrompt);
}else{
r.setMsg("因限电该桩已停用,请选择其他桩进行充电");
}
return r;
}
//终端状态是否空闲

View File

@ -552,88 +552,88 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
xhpcHistoryOrder.setInternetSerialNumber(xhpcChargeOrder.getInternetSerialNumber());
Double totalPower = xhpcHistoryOrder.getTotalPower();
Map<String, Object> judgeActivity= getRateOrActivityFormul(xhpcChargeOrder.getSerialNumber(), internetUserId, startTime, endTime, chargingStationId, tenantId, xhpcChargeOrder.getRateModelId());
Map<String, Double> params1 =new HashMap<>();
if("1".equals(judgeActivity.get("status").toString())){
judge =true;
logger.info("<<<<<<<<<<<<<<<价格、时间、公式都相同>>>>>>>>>>>>>>>>>");
params1.put("T",money.doubleValue());
params1.put("P",powerPrice.doubleValue());
params1.put("S",servicePrice.doubleValue());
params1.put("E",totalPower);
String computeFormula = judgeActivity.get("computeFormula").toString();
computeType = (int)judgeActivity.get("computeType");
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总服务费
activityServicePriceTotal = servicePrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总电费
activityPowerPriceTotal = powerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总金额
activityTotalPriceTotal = money;
if(computeType==1){
BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
internetCommission = internetCommission.add(eval);
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal.subtract(decimal1));
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(decimal1));
}else if(computeType==2){
internetSvcCommission = internetSvcCommission.add(eval);
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
}else{
//电量抽成
internetDegreeCommission = internetDegreeCommission.add(eval);
//减服务费
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
}
promotionDiscount = money.subtract(activityTotalPriceTotal);
xhpcHistoryOrder.setActivityId(judgeActivity.get("activityId").toString());
}else if("2".equals(judgeActivity.get("status").toString())){
judge =true;
logger.info("<<<<<<<<<<<<<<<价格、时间都相同>>>>>>>>>>>>>>>>>");
String computeFormula = judgeActivity.get("computeFormula").toString();
BigDecimal powerPrice1 = new BigDecimal(judgeActivity.get("powerPrice").toString());
BigDecimal servicePrice1 = new BigDecimal(judgeActivity.get("servicePrice").toString());
//活动总服务费
activityServicePriceTotal = servicePrice1.multiply(new BigDecimal(totalPower)).setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总电费
activityPowerPriceTotal = powerPrice1.multiply(new BigDecimal(totalPower)).setScale(2, BigDecimal.ROUND_HALF_UP);
//活动总金额
activityTotalPriceTotal = activityServicePriceTotal.add(activityPowerPriceTotal);
params1.put("T",activityTotalPriceTotal.doubleValue());
params1.put("P",activityPowerPriceTotal.doubleValue());
params1.put("S",activityServicePriceTotal.doubleValue());
params1.put("E",totalPower);
computeType = (int)judgeActivity.get("computeType");
BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
if(computeType==1){
BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
internetCommission = internetCommission.add(eval);
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal.subtract(decimal1));
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(decimal1));
}else if(computeType==2){
internetSvcCommission = internetSvcCommission.add(eval);
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
}else{
//电量抽成
internetDegreeCommission = internetDegreeCommission.add(eval);
//减服务费
activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
}
promotionDiscount = money.subtract(activityTotalPriceTotal);
xhpcHistoryOrder.setActivityId(judgeActivity.get("activityId").toString());
}else{
// Map<String, Object> judgeActivity= getRateOrActivityFormul(xhpcChargeOrder.getSerialNumber(), internetUserId, startTime, endTime, chargingStationId, tenantId, xhpcChargeOrder.getRateModelId());
//
// Map<String, Double> params1 =new HashMap<>();
// if("1".equals(judgeActivity.get("status").toString())){
// judge =true;
// logger.info("<<<<<<<<<<<<<<<价格、时间、公式都相同>>>>>>>>>>>>>>>>>");
// params1.put("T",money.doubleValue());
// params1.put("P",powerPrice.doubleValue());
// params1.put("S",servicePrice.doubleValue());
// params1.put("E",totalPower);
// String computeFormula = judgeActivity.get("computeFormula").toString();
// computeType = (int)judgeActivity.get("computeType");
// BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
// //活动总服务费
// activityServicePriceTotal = servicePrice.setScale(2, BigDecimal.ROUND_HALF_UP);
// //活动总电费
// activityPowerPriceTotal = powerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
// //活动总金额
// activityTotalPriceTotal = money;
// if(computeType==1){
// BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
// internetCommission = internetCommission.add(eval);
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal.subtract(decimal1));
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(decimal1));
// }else if(computeType==2){
// internetSvcCommission = internetSvcCommission.add(eval);
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
// }else{
// //电量抽成
// internetDegreeCommission = internetDegreeCommission.add(eval);
// //减服务费
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
// }
// promotionDiscount = money.subtract(activityTotalPriceTotal);
// xhpcHistoryOrder.setActivityId(judgeActivity.get("activityId").toString());
// }else if("2".equals(judgeActivity.get("status").toString())){
// judge =true;
// logger.info("<<<<<<<<<<<<<<<价格、时间都相同>>>>>>>>>>>>>>>>>");
// String computeFormula = judgeActivity.get("computeFormula").toString();
// BigDecimal powerPrice1 = new BigDecimal(judgeActivity.get("powerPrice").toString());
// BigDecimal servicePrice1 = new BigDecimal(judgeActivity.get("servicePrice").toString());
// //活动总服务费
// activityServicePriceTotal = servicePrice1.multiply(new BigDecimal(totalPower)).setScale(2, BigDecimal.ROUND_HALF_UP);
// //活动总电费
// activityPowerPriceTotal = powerPrice1.multiply(new BigDecimal(totalPower)).setScale(2, BigDecimal.ROUND_HALF_UP);
// //活动总金额
// activityTotalPriceTotal = activityServicePriceTotal.add(activityPowerPriceTotal);
// params1.put("T",activityTotalPriceTotal.doubleValue());
// params1.put("P",activityPowerPriceTotal.doubleValue());
// params1.put("S",activityServicePriceTotal.doubleValue());
// params1.put("E",totalPower);
//
// computeType = (int)judgeActivity.get("computeType");
// BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
// if(computeType==1){
// BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
// internetCommission = internetCommission.add(eval);
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal.subtract(decimal1));
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(decimal1));
// }else if(computeType==2){
// internetSvcCommission = internetSvcCommission.add(eval);
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
// }else{
// //电量抽成
// internetDegreeCommission = internetDegreeCommission.add(eval);
// //减服务费
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
// }
// promotionDiscount = money.subtract(activityTotalPriceTotal);
// xhpcHistoryOrder.setActivityId(judgeActivity.get("activityId").toString());
// }else{
boolean activityInternet =false;
//yyyy-mm-dd(当前时间)
String parse2 = DateUtil.formatDate(startTime);
long time1 = startTime.getTime();
long time2 = endTime.getTime();
if( time1 != time2 && time2>time1){
if(time2>time1){
List<XhpcActivityInternetDomainDto> activityStationTime = xhpcRealTimeOrderMapper.getActivityStationTime(internetUserId, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime), chargingStationId, tenantId);
//1时间没有跨天
DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
@ -650,15 +650,20 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
Map<String, Double> params =new HashMap<>();
List<XhpcActivityFormulaDomainDto> activityFormulaTime1 =new ArrayList<>();
List<XhpcActivityFormulaDomainDto> activityFormulaTime2 =new ArrayList<>();
List<Map<String,Object>> reatTimeList1 =new ArrayList<>();
List<Map<String,Object>> reatTimeList2 =new ArrayList<>();
XhpcActivityInternetDomainDto activityInternet1 =new XhpcActivityInternetDomainDto();
if(betweenDay>0){
activityInternet1 = activityStationTime.get(0);
activityFormulaTime1 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet1.getActivityId(), start, "24:00:00");
activityFormulaTime2 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet1.getActivityId(), "00:00:00", end);
reatTimeList1 = xhpcHistoryOrderService.getReatTimeList(start,"23:59:59",xhpcChargeOrder.getRateModelId());
reatTimeList2 = xhpcHistoryOrderService.getReatTimeList("00:00:00", end,xhpcChargeOrder.getRateModelId());
activityId =activityInternet1.getActivityId()+"";
}else{
activityInternet1 = activityStationTime.get(0);
activityFormulaTime1 = xhpcRealTimeOrderMapper.getActivityFormulaTime(activityInternet1.getActivityId(), start, end);
reatTimeList1 = xhpcHistoryOrderService.getReatTimeList(start,end,xhpcChargeOrder.getRateModelId());
activityId =activityInternet1.getActivityId()+"";
}
for (int j = 0; j < activityFormulaTime1.size(); j++) {
@ -666,7 +671,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
//计费类型
computeType = activityInternet1.getComputeType();
BigDecimal activityServicePriceFormula = activityFormula.getServicePrice();
BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
//BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
BigDecimal activityPowerPriceFormula = new BigDecimal(reatTimeList1.get(j).get("powerFee").toString());
//计算公式
String computeFormula = activityFormula.getComputeFormula();
BigDecimal degree =new BigDecimal(0);
@ -715,7 +721,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
computeType = activityInternet1.getComputeType();
XhpcActivityFormulaDomainDto activityFormula = activityFormulaTime2.get(j);
BigDecimal activityServicePriceFormula = activityFormula.getServicePrice();
BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
//BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
BigDecimal activityPowerPriceFormula = new BigDecimal(reatTimeList2.get(j).get("powerFee").toString());
//计算公式
String computeFormula = activityFormula.getComputeFormula();
BigDecimal degree =new BigDecimal(0);
@ -813,7 +820,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
}
}
}
// }
}
//
if ( !UserTypeUtil.INTERNET_TYPE.equals(source) && xhpcChargeOrder.getStartTime()!=null && xhpcChargeOrder.getEndTime()!=null && money.compareTo(new BigDecimal(0))>=1) {