结算订单优化

This commit is contained in:
yuyang 2022-05-06 11:38:58 +08:00
parent be8fe4d768
commit fb2ab3b72e
8 changed files with 30 additions and 16 deletions

View File

@ -429,7 +429,7 @@ public class XhpcHistoryOrderController extends BaseController {
Long historyOrderId = xhpc.getHistoryOrderId(); Long historyOrderId = xhpc.getHistoryOrderId();
int count = xhpcStatisticsService.getStatisticsTimeHistoryOrderId(historyOrderId); int count = xhpcStatisticsService.getStatisticsTimeHistoryOrderId(historyOrderId);
if(count>0){ if(count>0){
XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(historyOrderId); XhpcHistoryOrder historyOrder = xhpcHistoryOrderService.getHistoryOrderById(historyOrderId,null);
if(historyOrder.getState()==0){ if(historyOrder.getState()==0){
xhpcHistoryOrderService.updateXhpcHistoryOrder(historyOrderId,1); xhpcHistoryOrderService.updateXhpcHistoryOrder(historyOrderId,1);
} }

View File

@ -102,7 +102,7 @@ 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);
XhpcHistoryOrder getHistoryOrderById(@Param("historyOrderId")Long historyOrderId); XhpcHistoryOrder getHistoryOrderById(@Param("historyOrderId")Long historyOrderId,@Param("serialNumber")String serialNumber);
/** /**
* 更新历史订单 * 更新历史订单
* *

View File

@ -74,7 +74,7 @@ public interface IXhpcHistoryOrderService {
AjaxResult getById(Long historyOrderId); AjaxResult getById(Long historyOrderId);
XhpcHistoryOrder getHistoryOrderById(Long historyOrderId); XhpcHistoryOrder getHistoryOrderById(Long historyOrderId,String serialNumber);
/** /**
* 获取费率时段 * 获取费率时段

View File

@ -381,8 +381,8 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
} }
@Override @Override
public XhpcHistoryOrder getHistoryOrderById(Long historyOrderId) { public XhpcHistoryOrder getHistoryOrderById(Long historyOrderId,String serialNumber) {
return xhpcHistoryOrderMapper.getHistoryOrderById(historyOrderId); return xhpcHistoryOrderMapper.getHistoryOrderById(historyOrderId,serialNumber);
} }
@Override @Override

View File

@ -330,7 +330,14 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
@Override @Override
@Transactional @Transactional
public AjaxResult getExamine(Long chargingOrderId, BigDecimal powerPrice, BigDecimal servicePrice) { public AjaxResult getExamine(Long chargingOrderId, BigDecimal powerPrice, BigDecimal servicePrice) {
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getChargingOrderId(chargingOrderId);
//查询是否已存在结算信息
XhpcHistoryOrder historyOrderById = xhpcHistoryOrderService.getHistoryOrderById(null, xhpcChargeOrder.getSerialNumber());
if(historyOrderById !=null){
xhpcChargeOrder.setStatus(3);
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
return AjaxResult.success();
}
//总金额 //总金额
BigDecimal money = powerPrice.add(servicePrice); BigDecimal money = powerPrice.add(servicePrice);
//总服务费 servicePrice //总服务费 servicePrice
@ -340,7 +347,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
//剩余的服务费 //剩余的服务费
BigDecimal surplusServicePrice = servicePrice; BigDecimal surplusServicePrice = servicePrice;
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getChargingOrderId(chargingOrderId);
if(xhpcChargeOrder.getStatus()==1 || xhpcChargeOrder.getStatus()==3){ if(xhpcChargeOrder.getStatus()==1 || xhpcChargeOrder.getStatus()==3){
return AjaxResult.error("订单已结算,请联系技术人员解决"); return AjaxResult.error("订单已结算,请联系技术人员解决");
} }
@ -552,7 +559,7 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
for (int j = 0; j < activityFormulaTime2.size(); j++) { for (int j = 0; j < activityFormulaTime2.size(); j++) {
//计费类型 //计费类型
int computeType = activityInternet1.getComputeType(); int computeType = activityInternet1.getComputeType();
XhpcActivityFormulaDomainDto activityFormula = activityFormulaTime1.get(j); XhpcActivityFormulaDomainDto activityFormula = activityFormulaTime2.get(j);
BigDecimal activityServicePriceFormula = activityFormula.getServicePrice(); BigDecimal activityServicePriceFormula = activityFormula.getServicePrice();
BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice(); BigDecimal activityPowerPriceFormula = activityFormula.getPowerPrice();
//计算公式 //计算公式

View File

@ -1116,6 +1116,13 @@
</update> </update>
<select id="getHistoryOrderById" resultType="com.xhpc.order.domain.XhpcHistoryOrder"> <select id="getHistoryOrderById" resultType="com.xhpc.order.domain.XhpcHistoryOrder">
select * from xhpc_history_order where history_order_id=#{historyOrderId} select * from xhpc_history_order
where 1=1
<if test="historyOrderId!=null">
and history_order_id=#{historyOrderId}
</if>
<if test="serialNumber !=null and serialNumber !=''">
and serial_number=#{serialNumber}
</if>
</select> </select>
</mapper> </mapper>

View File

@ -440,14 +440,14 @@
select select
xt.tenant_id as tenantId, xt.tenant_id as tenantId,
xt.tenant_name as tenantName xt.tenant_name as tenantName
from xhpc_charging_station as xcs from xhpc_operator as xo
join xhpc_tenant as xt on xt.tenant_id = xcs.tenant_id join xhpc_tenant as xt on xt.tenant_id = xo.tenant_id
where 1=1 where 1=1
<if test="type==1"> <if test="type==1">
and operator_id=#{userId} and xo.operator_id=#{userId}
</if> </if>
<if test="type==2"> <if test="type==2">
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}) and xo.operator_id in (select operator_id from xhpc_charging_station where charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId}))
</if> </if>
group by xt.tenant_id group by xt.tenant_id
</select> </select>

View File

@ -450,19 +450,18 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
@Override @Override
public AjaxResult appInfo(HttpServletRequest request) { public AjaxResult appInfo(HttpServletRequest request) {
try{ try{
LoginUser loginUser = logUserUtils.getLogUser(request); LoginUser loginUser = tokenService.getLoginUser();
String tenantId = loginUser.getTenantId(); String tenantId = loginUser.getTenantId();
Object version = redisService.getCacheObject("global:"+tenantId+":version"); Object version = redisService.getCacheObject("global:"+tenantId+":version");
Object servicePhone = redisService.getCacheObject("global:"+tenantId+":phone"); Object servicePhone = redisService.getCacheObject("global:"+tenantId+":phone");
//根据不同的用户类型查询不同的信息 //根据不同的用户类型查询不同的信息
Long userid = loginUser.getUserid(); Long userid = loginUser.getUserid();
Integer userType = loginUser.getUserType(); Integer userType = loginUser.getUserType();
R user = xhpcCommonController.getMechanism(null, loginUser.getUserid(), loginUser.getUserType(), null, tenantId); R user = xhpcCommonController.getMechanism(null, loginUser.getUserid(), loginUser.getUserType(), null, tenantId);
if(user !=null && user.getData() !=null){ if(user !=null && user.getData() !=null){
Map<String, Object> map = (Map<String, Object>)user.getData(); Map<String, Object> map = (Map<String, Object>)user.getData();
//发票留言板版本客服电话 //发票留言板版本客服电话
Integer invoice =null; Long invoice =null;
String globalInvoice="global:invoice:"+ tenantId +":"; String globalInvoice="global:invoice:"+ tenantId +":";
if(UserTypeUtil.USER_TYPE.equals(userType)){ if(UserTypeUtil.USER_TYPE.equals(userType)){
invoice = redisService.getCacheObject(globalInvoice + UserTypeUtil.USER + userid); invoice = redisService.getCacheObject(globalInvoice + UserTypeUtil.USER + userid);
@ -504,6 +503,7 @@ public class XhpcAppUserServiceImpl extends BaseService implements IXhpcAppUserU
return AjaxResult.error("请重新登录",HttpStatus.USER_LOGIN); return AjaxResult.error("请重新登录",HttpStatus.USER_LOGIN);
} }
}catch (Exception e){ }catch (Exception e){
e.printStackTrace();
return AjaxResult.error("请重新登录",HttpStatus.USER_LOGIN); return AjaxResult.error("请重新登录",HttpStatus.USER_LOGIN);
} }
} }