新增运营商清分统计;更新调试接口

This commit is contained in:
panshuling321 2022-05-05 17:30:10 +08:00
parent 7bf2c90aca
commit 1bd5cd18d0
10 changed files with 91 additions and 14 deletions

View File

@ -38,11 +38,19 @@ public class XhpcClearingCheckoutController extends BaseController {
String status, String status,
String operatorId, String operatorId,
String startTime, String startTime,
String endTime) { String endTime,
String tenantId) {
LoginUser loginUser = logUserUtils.getLogUser(request); LoginUser loginUser = logUserUtils.getLogUser(request);
startPage(); startPage();
if(StringUtils.isEmpty(tenantId)){
tenantId = loginUser.getTenantId();
}
if("-1".equals(tenantId)){
tenantId = "";
}
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId()); params.put("tenantId", tenantId);
params.put("status", status); params.put("status", status);
params.put("operatorId", operatorId); params.put("operatorId", operatorId);
params.put("startTime", startTime); params.put("startTime", startTime);
@ -51,6 +59,18 @@ public class XhpcClearingCheckoutController extends BaseController {
} }
@GetMapping("/getCheckoutPage")
public TableDataInfo getCheckoutPage(String operatorId,
String tenantId) {
startPage();
Map<String, Object> params = new HashMap<>();
params.put("tenantId", tenantId);
params.put("operatorId", operatorId);
return getDataTable(checkoutService.getCheckoutPage(params));
}
@GetMapping("/detail") @GetMapping("/detail")
public R getDetail(@RequestParam("checkoutId") Long checkoutId) { public R getDetail(@RequestParam("checkoutId") Long checkoutId) {
return R.ok(checkoutService.getDomainByPk(checkoutId)); return R.ok(checkoutService.getDomainByPk(checkoutId));

View File

@ -99,12 +99,11 @@ public class XhpcClearingHistoryOrderController extends BaseController {
LoginUser loginUser = logUserUtils.getLogUser(request); LoginUser loginUser = logUserUtils.getLogUser(request);
startPage(); startPage();
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
if(StringUtils.isEmpty(operatorId)){ if(StringUtils.isEmpty(operatorId)){
operatorId = loginUser.getSysUser().getOperatorId() + ""; operatorId = loginUser.getSysUser().getOperatorId() + "";
} }
params.put("operatorId", operatorId); params.put("operatorId", operatorId);
if(params.get("operatorId") == null || StringUtils.isEmpty(params.get("operatorId").toString()) || "null".equals(params.get("operatorId").toString())){ if(params.get("operatorId") == null || StringUtils.isEmpty(params.get("operatorId").toString()) || "null".equals(params.get("operatorId").toString())){
throw new CustomException("运营商ID错误,请登陆运营商账户再试"); throw new CustomException("运营商ID错误,请登陆运营商账户再试");
} }
@ -117,12 +116,12 @@ public class XhpcClearingHistoryOrderController extends BaseController {
LoginUser loginUser = logUserUtils.getLogUser(request); LoginUser loginUser = logUserUtils.getLogUser(request);
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("tenantId", loginUser.getTenantId());
if(StringUtils.isEmpty(operatorId)){ if(StringUtils.isEmpty(operatorId)){
operatorId = loginUser.getSysUser().getOperatorId() + ""; operatorId = loginUser.getSysUser().getOperatorId() + "";
} }
params.put("operatorId", operatorId);
params.put("operatorId", operatorId);
if(params.get("operatorId") == null || StringUtils.isEmpty(params.get("operatorId").toString()) || "null".equals(params.get("operatorId").toString())){ if(params.get("operatorId") == null || StringUtils.isEmpty(params.get("operatorId").toString()) || "null".equals(params.get("operatorId").toString())){
throw new CustomException("运营商ID错误,请登陆运营商账户再试"); throw new CustomException("运营商ID错误,请登陆运营商账户再试");
} }

View File

@ -97,5 +97,7 @@ public class XhpcClearingCheckoutDomain implements Serializable {
private String clearingOrderIds; private String clearingOrderIds;
private String tenantName;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -19,13 +19,17 @@ public interface XhpcClearingCheckoutMapper {
List<XhpcClearingCheckoutDomain> selectByParams(@Param("params") Map<String, Object> params); List<XhpcClearingCheckoutDomain> selectByParams(@Param("params") Map<String, Object> params);
List<Map<String, Object>> selectCheckoutMapByParams(@Param("params") Map<String, Object> params);
int deleteLogicByPrimaryKey(Long clearingCheckoutId); int deleteLogicByPrimaryKey(Long clearingCheckoutId);
boolean checkByPrimaryKey(XhpcClearingCheckoutDomain domain); boolean checkByPrimaryKey(XhpcClearingCheckoutDomain domain);
boolean updateStatusByPrimaryKey(XhpcClearingCheckoutDomain domain); boolean updateStatusByPrimaryKey(XhpcClearingCheckoutDomain domain);
BigDecimal selectAmountByStatus(@Param("tenantId")String tenantId, @Param("operatorId")String operatorId, @Param("status")Integer status); BigDecimal selectAmountByStatus(@Param("operatorId")String operatorId, @Param("status")Integer status);
List<CheckoutBankVo> selectOrderMapByCheckoutIds(@Param("checkoutIds")String checkoutIds); List<CheckoutBankVo> selectOrderMapByCheckoutIds(@Param("checkoutIds")String checkoutIds);

View File

@ -12,6 +12,8 @@ public interface XhpcClearingCheckoutService {
List<XhpcClearingCheckoutDomain> getPage(Map<String, Object> params); List<XhpcClearingCheckoutDomain> getPage(Map<String, Object> params);
List<Map<String, Object>> getCheckoutPage(Map<String, Object> params);
XhpcClearingCheckoutDomain getDomainByPk(Long checkoutId); XhpcClearingCheckoutDomain getDomainByPk(Long checkoutId);
Map<String, Object> getTmpCheckoutData(Long operatorId); Map<String, Object> getTmpCheckoutData(Long operatorId);

View File

@ -73,6 +73,11 @@ public class XhpcClearingCheckoutServiceImpl extends BaseService implements Xhpc
return checkoutMapper.selectByParams(params); return checkoutMapper.selectByParams(params);
} }
@Override
public List<Map<String, Object>> getCheckoutPage(Map<String, Object> params){
return checkoutMapper.selectCheckoutMapByParams(params);
}
@Override @Override
public Map<String, Object> getTmpCheckoutData(Long operatorId) { public Map<String, Object> getTmpCheckoutData(Long operatorId) {
XhpcClearingBankDomain bankDomain = bankMapper.selectOneByOperatorId(operatorId.toString()); XhpcClearingBankDomain bankDomain = bankMapper.selectOneByOperatorId(operatorId.toString());

View File

@ -138,7 +138,6 @@ public class XhpcClearingHistoryOrderServiceImpl implements XhpcClearingHistoryO
public Map<String, Object> getOperatorData(Map<String, Object> params) { public Map<String, Object> getOperatorData(Map<String, Object> params) {
String operatorId = params.get("operatorId").toString(); String operatorId = params.get("operatorId").toString();
String tenantId = params.get("tenantId").toString();
Map<String, Object> bankDomain = bankMapper.selectOneMapByOperatorId(operatorId); Map<String, Object> bankDomain = bankMapper.selectOneMapByOperatorId(operatorId);
// 待清分金额 // 待清分金额
@ -148,10 +147,10 @@ public class XhpcClearingHistoryOrderServiceImpl implements XhpcClearingHistoryO
BigDecimal checkedAmount = historyOrderMapper.selectCheckedAmount(operatorId); BigDecimal checkedAmount = historyOrderMapper.selectCheckedAmount(operatorId);
// 已提现金额 // 已提现金额
BigDecimal cashedAmount = checkoutMapper.selectAmountByStatus(tenantId, operatorId, 6); BigDecimal cashedAmount = checkoutMapper.selectAmountByStatus(operatorId, 6);
// 提现中金额 // 提现中金额
BigDecimal cashingAmount = checkoutMapper.selectAmountByStatus(tenantId, operatorId, 1); BigDecimal cashingAmount = checkoutMapper.selectAmountByStatus(operatorId, 1);
// 可提现金额 // 可提现金额
Map<String, Object> cashMap = historyOrderMapper.selectCashAmount(operatorId); Map<String, Object> cashMap = historyOrderMapper.selectCashAmount(operatorId);

View File

@ -37,9 +37,12 @@
<select id="selectByParams" resultType="com.xhpc.activity.domain.XhpcClearingCheckoutDomain"> <select id="selectByParams" resultType="com.xhpc.activity.domain.XhpcClearingCheckoutDomain">
select select
<include refid="Base_Column_List" />, xo.name as 'operator_name' <include refid="Base_Column_List" />,
xo.name as 'operator_name',
xt.tenant_name
from xhpc_clearing_checkout cc from xhpc_clearing_checkout cc
left join xhpc_operator xo on xo.operator_id = cc.operator_id left join xhpc_operator xo on xo.operator_id = cc.operator_id
left join xhpc_tenant xt on xo.tenant_id=xt.tenant_id
where cc.del_flag =0 where cc.del_flag =0
<if test="params.status!=null and params.status!=''"> <if test="params.status!=null and params.status!=''">
and cc.status=#{params.status} and cc.status=#{params.status}
@ -59,8 +62,51 @@
</select> </select>
<select id="selectCheckoutMapByParams" resultType="map">
select
xt.tenant_id as 'tenantId',
xt.tenant_name as 'tenantName',
xo.operator_id as 'operatorId',
xo.name as 'operatorName',
IFNULL(ho.unClearingAmount,0) as 'unClearingAmount',
IFNULL(cho.cashAmount,0) as 'cashAmount',
IFNULL(cc1.applyAmount,0) as 'applyAmount',
IFNULL(cc2.cashedAmount,0) as 'cashedAmount'
from xhpc_operator xo
left join (SELECT operator_id, sum(apply_amount) as 'applyAmount' from xhpc_clearing_checkout WHERE `status`=1 and del_flag=0 GROUP BY operator_id) cc1 on xo.operator_id = cc1.operator_id
left join (SELECT operator_id, sum(apply_amount) as 'cashedAmount' from xhpc_clearing_checkout WHERE `status`=6 and del_flag=0 GROUP BY operator_id) cc2 on xo.operator_id = cc2.operator_id
left join xhpc_tenant xt on xo.tenant_id=xt.tenant_id
LEFT JOIN (
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
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
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',
ho.operator_id as 'operatorId'
from xhpc_clearing_history_order as ho
where ho.check_status=2 and ho.del_flag=0 and ho.clearing_checkout_id is null GROUP BY ho.operator_id
) cho on cho.operatorId= xo.operator_id
where xo.del_flag = 0
<if test="params.tenantId!=null and params.tenantId!=''">
and xo.tenant_id=#{params.tenantId}
</if>
<if test="params.operatorId!=null and params.operatorId!='' ">
and xo.operator_id=#{params.operatorId}
</if>
</select>
<select id="selectAmountByStatus" resultType="java.math.BigDecimal"> <select id="selectAmountByStatus" resultType="java.math.BigDecimal">
select ifnull(sum(apply_amount), 0) from xhpc_clearing_checkout where del_flag =0 and tenant_id=#{tenantId} and operator_id=#{operatorId} and status=#{status} select ifnull(sum(apply_amount), 0) from xhpc_clearing_checkout where del_flag =0 and operator_id=#{operatorId} and status=#{status}
</select> </select>

View File

@ -88,7 +88,7 @@
<select id="selectUnclearingAmount" resultType="java.math.BigDecimal"> <select id="selectUnclearingAmount" resultType="java.math.BigDecimal">
select select
ifnull(sum(ho.total_price), 0) ifnull(sum(ho.act_power_price + ho.act_service_price), 0)
from xhpc_history_order as ho from xhpc_history_order as ho
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id 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 left join xhpc_operator as op on op.operator_id = ct.operator_id

View File

@ -53,7 +53,7 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from xhpc_operator from xhpc_operator
where id = #{id} where operator_id = #{id}
</select> </select>
</mapper> </mapper>