D1D0数据同步,提现审核相关

This commit is contained in:
liuyingfang
2023-07-06 17:01:21 +08:00
parent f0174ef087
commit a473fd6457
10 changed files with 271 additions and 37 deletions

View File

@@ -125,5 +125,8 @@ public interface CashService extends IService<Cash> {
default BigDecimal getSumCheckingCashAmtTotal(@Param("userId") String userId) {
return ((CashMapper) getBaseMapper()).selectCashAmtTotal(userId, Cash.STATUS_CHECKING);
}
List<Cash> subordinate(String userId,String status,Integer size, Integer page);
Boolean modifyOutFlow(Integer id,String userId,String status, String remark) throws Exception;
}

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.DesensitizedUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import cn.pluss.platform.ali.AlipayService;
import cn.pluss.platform.cash.CashService;
@@ -34,6 +35,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@@ -46,6 +48,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service("cashService")
@@ -89,6 +92,8 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
@Resource
private MerchantProfitMapper mpMapper;
@Resource
private CashMapper cashMapper;
private void checkStatus(Integer userId) {
RiskBlacklist condition = new RiskBlacklist();
@@ -371,7 +376,7 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
cashStatus.setUserId(promotion.getUserId().toString());
cashStatus.setUserType(promotion.getTypeCode());
cashStatus.setStatus("0");
cashStatus.setLoginName(promotion.getLoginName());
cashStatus.setLoginName(promotion.getLoginName() == null?"null":promotion.getLoginName());
list.add(cashStatus);
promotion.setCashStatusVOList(list);
return list;
@@ -612,5 +617,124 @@ public class CashServiceImpl extends ServiceImpl<CashMapper, Cash> implements Ca
public Map<String, Object> getCashCountData(Map<String, Object> params) {
return baseMapper.getCashCountData(params);
}
@Override
public List<Cash> subordinate(String userId,String status, Integer size, Integer page) {
page = page-1;
return cashMapper.subordinate(Long.valueOf(userId),size,page, status);
}
@Override
public Boolean modifyOutFlow(Integer id, String userId, String status, String remark) throws Exception {
Boolean flag=false;
if(ObjectUtil.isEmpty(id)||ObjectUtil.isEmpty(userId)||ObjectUtil.isEmpty(status)){
log.error("参数错误");
MsgException.checkNull(null,"参数错误");
}
Cash cash = getById(id);
if(ObjectUtil.isEmpty(cash)){
log.error("对应的提现信息不存在:{}",id);
MsgException.checkNull(null,"对应的提现信息不存在");
}
if(cash.getStatus()==1 || cash.getStatus()==2){
log.error("订单已处理完成: id :{}, status:{}",id,cash.getStatus());
MsgException.checkNull(null,"订单已处理完成");
}
UserPromotion promotion= userPromotionMapper.selectByUserId(userId);
if(ObjectUtil.isEmpty(promotion)){
log.error("审核员信息不存在");
MsgException.checkNull(null,"审核员信息不存在");
}
Map<String,CashStatusVO> map=new HashMap<>();
List<CashStatusVO> cashStatusList= JSONUtil.toList(new JSONArray(cash.getCashStatus()),CashStatusVO.class);
if(ObjectUtil.isEmpty(cashStatusList)||cashStatusList.size()<=0){
log.error("审核信息为空");
MsgException.checkNull(null,"审核信息为空");
}
for (CashStatusVO cashStatus : cashStatusList) {
map.put(cashStatus.getUserType(),cashStatus);
}
CashStatusVO cashStatus=null;
CashStatusVO upStatus=null;
switch (promotion.getTypeCode()){
case "AG":
cashStatus=map.get("AG");
upStatus=map.get("SO");
break;
case "SO":
cashStatus=map.get("AG");
upStatus=map.get("FO");
break;
case "FO":
cashStatus=map.get("SO");
upStatus=map.get("MG");
break;
case "MG":
cashStatus=map.get("FO");
upStatus=map.get("MG");
break;
}
// if(!userId.equals(cashStatus.getUserId().toString())){
// log.error("操作权限不足");
// return new RespBody("000025");
// }
if("0".equals(cashStatus.getStatus())){
log.error("请等待下级审核完成");
MsgException.checkNull(null,"请等待下级审核完成");
}
if("2".equals(cashStatus.getStatus())){
log.error("提现已被拒绝");
MsgException.checkNull(null,"提现已被拒绝");
}
if(!upStatus.getStatus().equals("0")){
log.error("已被上级审核");
MsgException.checkNull(null,"已被上级审核");
}
switch (status){
case "1":
cashStatusList.stream().filter(it->{
if(it.getUserId().toString().equals(userId))
it.setStatus("1");
return true;
}).collect(Collectors.toList());
if(promotion.getTypeCode().equals("MG")){
cash.setStatus(1);
}
cash.setCashStatus(JSONUtil.toJsonStr(cashStatusList));
break;
case "2":
cashStatusList.stream().filter(it->{
if(it.getUserId().toString().equals(userId))
it.setStatus("2");
return true;
}).collect(Collectors.toList());
cash.setStatus(2);
cash.setRemark(remark);
cash.setCashStatus(JSONUtil.toJsonStr(cashStatusList));
break;
default:
log.error("错误的操作类型");
MsgException.checkNull(null,"错误的操作类型");
}
updateById(cash);
flag=true;
return flag;
}
}

View File

@@ -103,7 +103,12 @@ public class BankCardServiceImpl extends ServiceImpl<BankCardMapper, BankCard> i
d0Data.put("type", Account.CHANNEL_TYPE_D0);
d0Data.put("data", BankCard.desensitized(d0.getBankCard()));
if (MerchantChannelStatus.AUDIT_STATUS_DATA_EDIT.equals(mcs.getStatus())) {
BankCard edit = d0.getBak().toJavaObject(BankCard.class);
BankCard edit = null;
if (d0.getBak() != null) {
edit = d0.getBak().toJavaObject(BankCard.class);
}else {
edit = null;
}
d0Data.put("editData", BankCard.desensitized(edit));
}

View File

@@ -409,22 +409,24 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
// }
// 如果不存在D0的结算信息则直接将D1的结算信息带过来
// LambdaQueryWrapper<Account> qWrapperAccountD1 = Wrappers.lambdaQuery();
// qWrapperAccountD1.eq(Account::getUserId, accountDTO.getUserId()).eq(Account::getChannelType, Account.CHANNEL_TYPE_D0);
// int count = baseMapper.selectCount(qWrapperAccountD1);
// if (count == 0) {
// account.setChannelType(Account.CHANNEL_TYPE_D0);
// save(account);
// }
// //TODO
// // 如果不存在D1的结算信息则直接将D0的结算信息带过来
// LambdaQueryWrapper<Account> qWrapperAccountD0 = Wrappers.lambdaQuery();
// qWrapperAccountD0.eq(Account::getUserId, accountDTO.getUserId()).eq(Account::getChannelType, Account.CHANNEL_TYPE_D1);
// int countD0 = baseMapper.selectCount(qWrapperAccountD0);
// if (countD0 == 0) {
// account.setChannelType(Account.CHANNEL_TYPE_D1);
// save(account);
// }
LambdaQueryWrapper<Account> qWrapperAccountD1New = Wrappers.lambdaQuery();
qWrapperAccountD1New.eq(Account::getUserId, accountDTO.getUserId()).eq(Account::getChannelType, Account.CHANNEL_TYPE_D0);
int countNew = baseMapper.selectCount(qWrapperAccountD1New);
if (countNew == 0) {
account.setChannelType(Account.CHANNEL_TYPE_D0);
account.setValid(0);
save(account);
}
//TODO
// 如果不存在D1的结算信息则直接将D0的结算信息带过来
LambdaQueryWrapper<Account> qWrapperAccountD0 = Wrappers.lambdaQuery();
qWrapperAccountD0.eq(Account::getUserId, accountDTO.getUserId()).eq(Account::getChannelType, Account.CHANNEL_TYPE_D1);
int countD0 = baseMapper.selectCount(qWrapperAccountD0);
if (countD0 == 0) {
account.setChannelType(Account.CHANNEL_TYPE_D1);
account.setValid(0);
save(account);
}
}
@Override

View File

@@ -113,10 +113,7 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
}
MsgException.checkNull(userApp, "用户信息为空,分润创建失败");
log.info("【分润V2.0】当前交易用户ID:{},交易单号:{},交易用户角色:{},用户等级:{}", userApp.getUserId(), order.getOrderNumber(), userApp.getRoleCode(), userApp.getLevelCode());
if (StringUtil.isEmpty(userApp.getRoleCode()) || StringUtil.isEmpty(userApp.getLevelCode())) {
log.info("【分润V2.0】订单号为:{}当前交易角色为空 创建分润结束", order.getOrderNumber());
return;
}
order.setUserId(userApp.getUserId().intValue());
calcUserProfitV2(userApp, order, type);
}
@@ -182,10 +179,18 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
}
UserApp nowUserApp = userAppMapper.selectByUserId(userId);
if(ObjectUtil.isEmpty(nowUserApp)){
log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size());
return;
}
QueryWrapper<UserApp> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("parentId",userPromotion.getParentUserId());
queryWrapper.eq("userId",userPromotion.getParentUserId());
UserApp pUserApp=userAppMapper.selectOne(queryWrapper);
if(ObjectUtil.isEmpty(pUserApp)){
log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size());
return;
}
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(10000)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN);
MerchantProfit profit = new MerchantProfit(nowUserApp, pUserApp, order, profitAmt, profitRate, "1", "1");