充值配置修改完成

This commit is contained in:
yuyang 2022-01-10 13:52:59 +08:00
parent e675e8e795
commit a402fea185
13 changed files with 77 additions and 22 deletions

View File

@ -38,6 +38,6 @@ public interface UserTypeService {
* @return * @return
*/ */
@GetMapping("/common/insertUserBalance") @GetMapping("/common/insertUserBalance")
R insertUserBalance(@RequestParam(value = "money")BigDecimal money, @RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId, @RequestParam(value = "type")Integer type, @RequestParam(value = "status")Integer status, @RequestParam(value = "remark")String remark); R insertUserBalance(@RequestParam(value = "money")BigDecimal money, @RequestParam(value = "userId")Long userId, @RequestParam(value = "userType")Integer userType, @RequestParam(value = "tenantId")String tenantId, @RequestParam(value = "type")Integer type, @RequestParam(value = "status")Integer status, @RequestParam(value = "remark")String remark,@RequestParam(value = "moneyOrderId")Long moneyOrderId);
} }

View File

@ -27,7 +27,7 @@ public class UserTypeFallbackFactory implements FallbackFactory<UserTypeService>
} }
@Override @Override
public R insertUserBalance(BigDecimal money,Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark) { public R insertUserBalance(BigDecimal money,Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark,Long moneyOrderId) {
return R.fail("添加用户金额信息失败:" + cause.getMessage()); return R.fail("添加用户金额信息失败:" + cause.getMessage());
} }
}; };

View File

@ -287,8 +287,25 @@ public class AlipayPaymentController {
//充电中 //充电中
postRefreshBalance(money, serialMumber); postRefreshBalance(money, serialMumber);
} }
//增加用户余额 if(UserTypeUtil.USER_TYPE.equals(xhpcRechargeOrder.getSource())){
userTypeService.insertUserBalance(money,userId,source,tenantId,UserTypeUtil.RECHARGE_ZHB,UserTypeUtil.INSERT_BALANCE,null); //增加用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
xhpcAppUser.setBalance(money);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
xhpcUserAccountStatement.setCreateTime(new Date());
xhpcUserAccountStatement.setRemark("支付宝充值订单!");
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
}else{
//增加用户余额
userTypeService.insertUserBalance(money,userId,source,tenantId,UserTypeUtil.RECHARGE_ZHB,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
}
} }
} }

View File

@ -390,8 +390,25 @@ public class WxPaymentController {
//充电中 //充电中
postRefreshBalance(money, serialMumber); postRefreshBalance(money, serialMumber);
} }
//增加用户余额 if(UserTypeUtil.USER_TYPE.equals(xhpcRechargeOrder.getSource())){
userTypeService.insertUserBalance(money,userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null); //增加用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(xhpcRechargeOrder.getUserId());
xhpcAppUser.setBalance(money);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
XhpcUserAccountStatement xhpcUserAccountStatement = new XhpcUserAccountStatement();
xhpcUserAccountStatement.setType(StatusConstants.FLOWING_WATER_RECHARGE_TYPE);
xhpcUserAccountStatement.setRechargeOrderId(xhpcRechargeOrder.getRechargeOrderId());
xhpcUserAccountStatement.setUserId(xhpcRechargeOrder.getUserId());
xhpcUserAccountStatement.setAmount(xhpcRechargeOrder.getAmount());
xhpcUserAccountStatement.setRemainingSum(xhpcAppUser.getBalance());
xhpcUserAccountStatement.setCreateTime(new Date());
xhpcUserAccountStatement.setRemark("微信充值订单!");
xhpcUserAccountStatementMapper.insert(xhpcUserAccountStatement);
}else{
//增加用户余额
userTypeService.insertUserBalance(money,userId,source,tenantId, UserTypeUtil.RECHARGE_WX,UserTypeUtil.INSERT_BALANCE,null,xhpcRechargeOrder.getRechargeOrderId());
}
} }
} }

View File

@ -28,7 +28,7 @@ public class XhpcCommonController extends BaseController {
* @param phone * @param phone
* @param userId * @param userId
* @param userType * @param userType
* @param SerialNumber 桩号 * @param serialNumber 桩号
* @return * @return
*/ */
@GetMapping(value = "/getUser") @GetMapping(value = "/getUser")
@ -63,9 +63,9 @@ public class XhpcCommonController extends BaseController {
* @return * @return
*/ */
@GetMapping(value = "/insertUserBalance") @GetMapping(value = "/insertUserBalance")
public AjaxResult insertUserBalance(BigDecimal money, Long userId, Integer userType, String tenantId, Integer type, Integer status,String remark) { public AjaxResult insertUserBalance(BigDecimal money, Long userId, Integer userType, String tenantId, Integer type, Integer status,String remark,Long moneyOrderId) {
return xhpcCommonService.insertUserBalance(money,userId,userType,tenantId,type,status,remark); return xhpcCommonService.insertUserBalance(money,userId,userType,tenantId,type,status,remark,moneyOrderId);
} }
} }

View File

@ -74,4 +74,9 @@ public class XhpcCommunityPersonnel extends BaseEntity {
* 充值渠道1微信 2支付宝 3平台) * 充值渠道1微信 2支付宝 3平台)
*/ */
private Integer rechargeType; private Integer rechargeType;
/**
* 充值订单id退款订单id
*/
private Long moneyOrderId;
} }

View File

@ -73,4 +73,8 @@ public class XhpcCustomersPersonnel extends BaseEntity {
* 充值渠道1微信 2支付宝 3平台) * 充值渠道1微信 2支付宝 3平台)
*/ */
private Integer rechargeType; private Integer rechargeType;
/**
* 充值订单id退款订单id
*/
private Long moneyOrderId;
} }

View File

@ -106,7 +106,7 @@ public interface IXhpcAppUserUserService {
public R<?> updateIsRefund(Long userId, Integer userType,Integer isRefund); public R<?> updateIsRefund(Long userId, Integer userType,Integer isRefund);
/** /**
* 设置小程序用户自动退款功能 * 设置小程序用户电池保护
* @return * @return
*/ */
public R<?> batteryProtect(HttpServletRequest request, Integer soc,Integer socProtect,Integer userType); public R<?> batteryProtect(HttpServletRequest request, Integer soc,Integer socProtect,Integer userType);

View File

@ -27,5 +27,5 @@ public interface IXhpcCommonService {
* @param remark 备注 * @param remark 备注
* @return * @return
*/ */
AjaxResult insertUserBalance(BigDecimal money, Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark); AjaxResult insertUserBalance(BigDecimal money, Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark,Long moneyOrderId);
} }

View File

@ -44,13 +44,9 @@ public class XhpcCommonServiceImpl implements IXhpcCommonService {
} }
@Override @Override
public AjaxResult insertUserBalance(BigDecimal money, Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark) { public AjaxResult insertUserBalance(BigDecimal money, Long userId, Integer userType, String tenantId, Integer type,Integer status,String remark,Long moneyOrderId) {
if(UserTypeUtil.USER_TYPE.equals(userType)){ if(UserTypeUtil.USER_TYPE.equals(userType)){
Map<String, Object> appUser = xhpcCommonMapper.getAppUser(null, userId, tenantId); //C端用户暂不考虑
//增加用户余额
if(appUser!=null){
}
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){ }else if(UserTypeUtil.COMMUNIT_TYPE.equals(userType)){
Map<String, Object> communityUser = xhpcCommonMapper.getCommunityUser(null, userId, null, tenantId); Map<String, Object> communityUser = xhpcCommonMapper.getCommunityUser(null, userId, null, tenantId);
@ -62,6 +58,7 @@ public class XhpcCommonServiceImpl implements IXhpcCommonService {
xhpcCommunityPersonnel.setRemark(remark); xhpcCommunityPersonnel.setRemark(remark);
xhpcCommunityPersonnel.setRechargeType(type); xhpcCommunityPersonnel.setRechargeType(type);
xhpcCommunityPersonnel.setTenantId(tenantId); xhpcCommunityPersonnel.setTenantId(tenantId);
xhpcCommunityPersonnel.setMoneyOrderId(moneyOrderId);
return xhpcCommunityService.addRecharge(xhpcCommunityPersonnel); return xhpcCommunityService.addRecharge(xhpcCommunityPersonnel);
} }
} }
@ -75,6 +72,7 @@ public class XhpcCommonServiceImpl implements IXhpcCommonService {
xhpcCustomersPersonnel.setRemark(remark); xhpcCustomersPersonnel.setRemark(remark);
xhpcCustomersPersonnel.setRechargeType(type); xhpcCustomersPersonnel.setRechargeType(type);
xhpcCustomersPersonnel.setTenantId(tenantId); xhpcCustomersPersonnel.setTenantId(tenantId);
xhpcCustomersPersonnel.setMoneyOrderId(moneyOrderId);
return xhpcCustomersService.addRecharge(xhpcCustomersPersonnel); return xhpcCustomersService.addRecharge(xhpcCustomersPersonnel);
} }
} }

View File

@ -202,8 +202,14 @@ public class XhpcCommunityServiceImpl implements IXhpcCommunityService {
xhpcCommunityPersonnel1.setSurplusMoney(remainingSum); xhpcCommunityPersonnel1.setSurplusMoney(remainingSum);
xhpcCommunityPersonnel1.setRechargeMoney(rechargeMoney1.add(rechargeMoney)); xhpcCommunityPersonnel1.setRechargeMoney(rechargeMoney1.add(rechargeMoney));
xhpcCommunityMapper.updateCommunityPersonnel(xhpcCommunityPersonnel1); xhpcCommunityMapper.updateCommunityPersonnel(xhpcCommunityPersonnel1);
//增加充值记录
Long rechargeOrderId = mechanismService.addRechargeOrder(communityPersonnelId, UserTypeUtil.COMMUNIT_TYPE, rechargeMoney, remainingSum, xhpcCommunityPersonnel1.getRechargeType()); Long rechargeOrderId=null;
if(UserTypeUtil.RECHARGE_PT.equals(xhpcCommunityPersonnel.getRechargeType())){
//增加充值记录
rechargeOrderId = mechanismService.addRechargeOrder(communityPersonnelId, UserTypeUtil.COMMUNIT_TYPE, rechargeMoney, remainingSum, xhpcCommunityPersonnel1.getRechargeType());
}else{
rechargeOrderId=xhpcCommunityPersonnel.getMoneyOrderId();
}
//增加用户流水 //增加用户流水
mechanismService.insertUserAccount(communityPersonnelId,rechargeMoney,remainingSum,null,rechargeOrderId,null,UserTypeUtil.INSERT_BALANCE,xhpcCommunityPersonnel1.getTenantId(),UserTypeUtil.COMMUNIT_TYPE); mechanismService.insertUserAccount(communityPersonnelId,rechargeMoney,remainingSum,null,rechargeOrderId,null,UserTypeUtil.INSERT_BALANCE,xhpcCommunityPersonnel1.getTenantId(),UserTypeUtil.COMMUNIT_TYPE);
return AjaxResult.success(); return AjaxResult.success();

View File

@ -123,7 +123,7 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
xhpcCustomersMapper.updateCustomers(xhpcCustomers); xhpcCustomersMapper.updateCustomers(xhpcCustomers);
mechanismService.updateMechanism(xhpcCustomers.getCustomersId(),1); mechanismService.updateMechanism(xhpcCustomers.getCustomersId(),1);
if(!"".equals(chargingStationIds) && chargingStationIds !=null){ if(!"".equals(chargingStationIds) && chargingStationIds !=null){
mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCustomers.getCustomersId(),0); mechanismService.addMechanism(Arrays.asList(chargingStationIds.split(",")),xhpcCustomers.getCustomersId(),1);
} }
return AjaxResult.success(); return AjaxResult.success();
} }
@ -212,8 +212,13 @@ public class XhpcCustomersServiceImpl implements IXhpcCustomersService {
xhpcCustomersPersonnel1.setSurplusMoney(remainingSum); xhpcCustomersPersonnel1.setSurplusMoney(remainingSum);
xhpcCustomersPersonnel1.setRechargeMoney(rechargeMoney1.add(rechargeMoney)); xhpcCustomersPersonnel1.setRechargeMoney(rechargeMoney1.add(rechargeMoney));
xhpcCustomersMapper.updateCustomersPersonnel(xhpcCustomersPersonnel1); xhpcCustomersMapper.updateCustomersPersonnel(xhpcCustomersPersonnel1);
//增加充值记录 Long rechargeOrderId=null;
Long rechargeOrderId =mechanismService.addRechargeOrder(customersPersonnelId, UserTypeUtil.CUSTOMERS_TYPE,rechargeMoney,remainingSum,xhpcCustomersPersonnel1.getRechargeType()); if(UserTypeUtil.RECHARGE_PT.equals(xhpcCustomersPersonnel.getRechargeType())){
//增加充值记录
rechargeOrderId =mechanismService.addRechargeOrder(customersPersonnelId, UserTypeUtil.CUSTOMERS_TYPE,rechargeMoney,remainingSum,xhpcCustomersPersonnel1.getRechargeType());
}else{
rechargeOrderId= xhpcCustomersPersonnel.getMoneyOrderId();
}
//增加用户流水 //增加用户流水
mechanismService.insertUserAccount(customersPersonnelId,rechargeMoney,remainingSum,null,rechargeOrderId,null,UserTypeUtil.INSERT_BALANCE,xhpcCustomersPersonnel1.getTenantId(),UserTypeUtil.CUSTOMERS_TYPE); mechanismService.insertUserAccount(customersPersonnelId,rechargeMoney,remainingSum,null,rechargeOrderId,null,UserTypeUtil.INSERT_BALANCE,xhpcCustomersPersonnel1.getTenantId(),UserTypeUtil.CUSTOMERS_TYPE);
return AjaxResult.success(); return AjaxResult.success();

View File

@ -22,6 +22,7 @@
alipay_login as alipayLogin, alipay_login as alipayLogin,
del_flag delFlag, del_flag delFlag,
concat(0) as userType, concat(0) as userType,
concat("C") as userTypeName,
tenant_id tenantId, tenant_id tenantId,
create_time as createTime create_time as createTime
from xhpc_app_user from xhpc_app_user
@ -55,6 +56,7 @@
tenant_id tenantId, tenant_id tenantId,
del_flag delFlag, del_flag delFlag,
concat(2) as userType, concat(2) as userType,
concat("ST") as userTypeName,
<if test="serialNumber !=null and serialNumber !=''"> <if test="serialNumber !=null and serialNumber !=''">
(select count(charging_station_id) from xhpc_mechanism where community_id=mechanism_id and source=0 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number, (select count(charging_station_id) from xhpc_mechanism where community_id=mechanism_id and source=0 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,
</if> </if>
@ -90,6 +92,7 @@
del_flag delFlag, del_flag delFlag,
tenant_id tenantId, tenant_id tenantId,
concat(3) as userType, concat(3) as userType,
concat("BE") as userTypeName,
<if test="serialNumber !=null and serialNumber !=''"> <if test="serialNumber !=null and serialNumber !=''">
(select count(charging_station_id) from xhpc_mechanism where customers_id=mechanism_id and source=1 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number, (select count(charging_station_id) from xhpc_mechanism where customers_id=mechanism_id and source=1 and charging_station_id in (select charging_station_id from xhpc_terminal where 1=1 and del_flag=0 and serial_number=#{serialNumber})) as number,
</if> </if>