更新清分模块待清分金额的计算,待清分订单审核的判断

This commit is contained in:
panshuling321 2022-06-21 14:47:39 +08:00
parent 8f280f701f
commit 0ed2f618be
5 changed files with 45 additions and 36 deletions

View File

@ -83,7 +83,7 @@ public class XhpcClearingCheckoutController extends BaseController {
LoginUser loginUser = logUserUtils.getLogUser(request);
Long operatorId = loginUser.getSysUser().getOperatorId();
if(operatorId == null || operatorId < 0){
if(operatorId == null){
throw new CustomException("运营商ID错误,请登陆运营商账户再试");
}
@ -103,7 +103,9 @@ public class XhpcClearingCheckoutController extends BaseController {
if (domain.getOperatorId() == null || domain.getOperatorId() == 0){
domain.setOperatorId(loginUser.getSysUser().getOperatorId());
}
if(domain.getOperatorId() == null){
throw new CustomException("运营商ID错误,请登陆运营商账户再试");
}
return R.ok(checkoutService.insertDomain(domain));
}

View File

@ -5,7 +5,11 @@ import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.xhpc.activity.domain.XhpcClearingHistoryOrderDomain;
import com.xhpc.activity.domain.XhpcOperatorDomain;
import com.xhpc.activity.mapper.*;
import com.xhpc.activity.mapper.XhpcClearingBankMapper;
import com.xhpc.activity.mapper.XhpcClearingCheckoutMapper;
import com.xhpc.activity.mapper.XhpcClearingHistoryOrderMapper;
import com.xhpc.activity.mapper.XhpcHistoryOrderMapper;
import com.xhpc.activity.mapper.XhpcOperatorMapper;
import com.xhpc.activity.service.XhpcClearingHistoryOrderService;
import com.xhpc.activity.vo.ClearingOrderVo;
import com.xhpc.common.core.exception.CustomException;
@ -23,7 +27,9 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -55,23 +61,23 @@ public class XhpcClearingHistoryOrderServiceImpl extends BaseService implements
LoginUser loginUser = tokenService.getLoginUser();
SysUser sysUser = loginUser.getSysUser();
Long sysUserId = sysUser.getUserId();
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
if (!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())) {
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())) {
Long logOperatorId = sysUser.getOperatorId();
//运营商看自己的场站
params.put("type", 1);
params.put("logOperatorId",logOperatorId);
params.put("logOperatorId", logOperatorId);
return historyOrderMapper.getListPage(params);
}else{
} else {
//查询赋值的场站
params.put("type", 1);
params.put("logOperatorId",sysUserId);
params.put("logOperatorId", sysUserId);
return historyOrderMapper.getListPage(params);
}
}else{
} else {
params.put("type", 0);
params.put("logOperatorId",sysUserId);
params.put("logOperatorId", sysUserId);
return historyOrderMapper.getListPage(params);
}
}
@ -83,26 +89,24 @@ public class XhpcClearingHistoryOrderServiceImpl extends BaseService implements
throw new CustomException("缺少订单ID");
}
String orderIds = "";
Map<String, Object> params = new HashMap<>();
params.put("startTime", orderVo.getStartTime());
params.put("endTime", orderVo.getEndTime());
params.put("orderNo", orderVo.getOrderNo());
params.put("userType", orderVo.getUserType());
params.put("internetName", orderVo.getInternetName());
params.put("operatorId", orderVo.getOperatorId());
params.put("stationId", orderVo.getStationId());
params.put("tenantId", orderVo.getTenantId());
params.put("orderIds", orderVo.getOrderIds());
if (orderVo.getOrderIds().equals("-1")) {
Map<String, Object> params = new HashMap<>();
params.put("startTime", orderVo.getStartTime());
params.put("endTime", orderVo.getEndTime());
params.put("orderNo", orderVo.getOrderNo());
params.put("userType", orderVo.getUserType());
params.put("internetName", orderVo.getInternetName());
params.put("operatorId", orderVo.getOperatorId());
params.put("stationId", orderVo.getStationId());
List<XhpcClearingHistoryOrderDomain> orderDomainList = historyOrderMapper.getListPage(params);
String orderIds = orderDomainList.stream().map(n -> n.getClearingOrderId().toString()).collect(Collectors.joining(","));
List<XhpcClearingHistoryOrderDomain> orderDomainList = historyOrderMapper.getListPage(params);
orderIds = orderDomainList.stream().map(n -> n.getClearingOrderId().toString()).collect(Collectors.joining(","));
} else {
orderIds = orderVo.getOrderIds();
if (StringUtils.isNotEmpty(orderIds)){
historyOrderMapper.updateStatusBatchByOrderIds(orderIds, orderVo.getStatus(), orderVo.getCheckBy());
}
return historyOrderMapper.updateStatusBatchByOrderIds(orderIds, orderVo.getStatus(), orderVo.getCheckBy()) > 0;
return true;
}
@ -189,7 +193,7 @@ public class XhpcClearingHistoryOrderServiceImpl extends BaseService implements
bankDomain = new HashMap<>();
XhpcOperatorDomain operatorDomain = operatorMapper.selectByPrimaryKey(Long.parseLong(operatorId));
if(operatorDomain != null){
if (operatorDomain != null) {
bankDomain.put("operatorName", operatorDomain.getName());
}
}

View File

@ -9,7 +9,7 @@ public class ClearingOrderVo {
private String orderIds;
private Integer status;
private String checkBy;
private String startTime;
@ -19,5 +19,6 @@ public class ClearingOrderVo {
private String internetName;
private String operatorId;
private String stationId;
private String tenantId;
}

View File

@ -92,13 +92,12 @@
select
ifnull(sum(ho.act_power_price + ho.act_service_price), 0) as 'unClearingAmount',
ct.operator_id as 'operatorId'
from xhpc_history_order as ho
from xhpc_clearing_history_order as ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
left join xhpc_operator as op on op.operator_id = ct.operator_id
where ho.state <![CDATA[ <> ]]> 3 and ho.del_flag=0
where ho.check_status not in (1,2) and ho.del_flag=0
GROUP BY ct.operator_id
) ho on ho.operatorId = xo.operator_id
LEFT JOIN (
select
ifnull(sum(ho.act_power_price + ho.act_service_price), 0) as 'cashAmount',

View File

@ -284,13 +284,13 @@
and find_in_set(ho.clearing_order_id, #{params.orderIds})
</if>
<if test="params.operatorId !=null">
<if test="params.operatorId !=null and params.operatorId !=''">
and ho.operator_id =#{params.operatorId}
</if>
<if test="params.chargingStationId !=null">
<if test="params.chargingStationId !=null and params.chargingStationId !=''">
and ho.charging_station_id =#{params.chargingStationId}
</if>
<if test="params.chargingPileId !=null">
<if test="params.chargingPileId !=null and params.chargingPileId !=''">
and ho.terminal_id in (select terminal_id from xhpc_terminal where charging_pile_id=#{params.chargingPileId} and del_flag =0)
</if>
<if test="params.type==1">
@ -299,6 +299,9 @@
<if test="params.type==2">
and ho.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{params.logOperatorId})
</if>
<if test="params.orderIds != null and params.orderIds!='' and params.orderIds !='-1'">
and find_in_set(ho.clearing_order_id, #{params.orderIds})
</if>
</select>