提现列表,创客相关
This commit is contained in:
@@ -46,13 +46,13 @@ public class CashController {
|
||||
@ApiImplicitParam(name = "type", value = "提现类型 0粉丝分润 1推广分润 99其他 ", paramType = "type", dataType = "Integer", required = true),
|
||||
@ApiImplicitParam(name = "status", value = "提现状态 0 申请提现 1 提现成功 2 提现失败", paramType = "status", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "merchantCode", value = "商家Code", paramType = "merchantCode", dataType = "String", required = true), })
|
||||
public Result<PageInfo<Cash>> list(@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size, Integer type, Integer status, String merchantCode,
|
||||
public Result<PageInfo<Cash>> list(@RequestParam(defaultValue = "1") Integer offset,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize, Integer type, Integer status, String merchantCode,
|
||||
String userId) {
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("pageSize", size);
|
||||
map.put("offset", (page - 1) * size);
|
||||
map.put("pageSize", pageSize);
|
||||
map.put("offset", (offset - 1) * pageSize);
|
||||
map.put("status",status);
|
||||
if (StringUtil.isEmpty(userId)) {
|
||||
return ResultGenerator.genFailResult("无用户id");
|
||||
@@ -63,8 +63,8 @@ public class CashController {
|
||||
List<Cash> cashList = cashService.queryCashPage(map);
|
||||
Integer count = cashService.queryCashPageCount(map);
|
||||
// 返回参数
|
||||
PageInfo<Cash> pageInfo = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, size),
|
||||
page.longValue(), size.longValue(), cashList);
|
||||
PageInfo<Cash> pageInfo = new PageInfo<>(count.longValue(), (long) StringUtil.getPageCount(count, pageSize),
|
||||
offset.longValue(), pageSize.longValue(), cashList);
|
||||
return ResultGenerator.genSuccessResult(pageInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,12 +42,10 @@ public class MainPageController {
|
||||
public Result<?> getSpreadData() {
|
||||
UserApp userApp = userAppService.queryUserAppByToken();
|
||||
Map<String, Object> resultMap;
|
||||
|
||||
resultMap = promoterMainPageService.getSpreadData(userApp.getUserId() + "");
|
||||
|
||||
return ResultGenerator.genSuccessResult(resultMap);
|
||||
}
|
||||
|
||||
@GetMapping("/userApp/modifyFee")
|
||||
public Result<Object> modifyFee(@RequestParam("id") Integer id, @RequestParam("fee") BigDecimal fee){
|
||||
UserApp result = userAppService.queryUserBaseInfoByToken();
|
||||
@@ -74,4 +72,23 @@ public class MainPageController {
|
||||
return ResultGenerator.genSuccessResult(merchantProfitVOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创客团队管理
|
||||
* @param name
|
||||
* @param current
|
||||
* @param size
|
||||
* @param typeCode
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/userApp/teamQuotaControl")
|
||||
public Result<Object> teamQuotaControl(String name,
|
||||
@RequestParam(defaultValue = "1") Integer current,
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@RequestParam("typeCode") String typeCode){
|
||||
UserApp result = userAppService.queryUserBaseInfoByToken();
|
||||
Map<String, Object> merchantProfitVOS = merchantProfitService.teamQuotaList(typeCode, result.getUserId(),
|
||||
current,size,name);
|
||||
return ResultGenerator.genSuccessResult(merchantProfitVOS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface MerchantProfitMapper extends BaseMapper<MerchantProfit> {
|
||||
List<MerchantProfit> queryMerchantProfitPage(Map map);
|
||||
|
||||
Integer queryMerchantProfitPageCount(Map map);
|
||||
Integer queryMerchantProfitPageCountV2(@Param("userId") String userId);
|
||||
Integer queryMerchantProfitPageCountV2(@Param("userId") String userId, @Param("startTime") Date startTime,@Param("endTime") Date endTime);
|
||||
|
||||
void saveMerchantProfitBatch(List<MerchantProfit> merchantProfitList);
|
||||
|
||||
@@ -135,6 +135,15 @@ public interface MerchantProfitMapper extends BaseMapper<MerchantProfit> {
|
||||
"\tparent_user_id = #{userId}\n" +
|
||||
"\tAND type_code = #{typeCode}")
|
||||
Integer getCountChild( @Param("userId") Long userId,@Param("typeCode") String typeCod);
|
||||
@Select("SELECT\n" +
|
||||
"\tcount(*) \n" +
|
||||
"FROM\n" +
|
||||
"\ttb_pluss_user_promotion \n" +
|
||||
"WHERE\n" +
|
||||
"\tparent_user_id = #{userId}\n" +
|
||||
"\tAND type_code = #{typeCode}"+
|
||||
"\tAND is_extend = '0'")
|
||||
Integer getCountQuotaChild( @Param("userId") Long userId,@Param("typeCode") String typeCod);
|
||||
Integer getCountChildV2( @Param("userId") Long userId);
|
||||
|
||||
List<MerChannelStatusVO> getChannelStatus(@Param("merchantCode") String merchantCode);
|
||||
|
||||
@@ -17,7 +17,7 @@ public interface UserMakerFlowMapper extends BaseMapper<UserMakerFlow> {
|
||||
"\tmf.id,\n" +
|
||||
"\tmf.biz_code AS bizCode,\n" +
|
||||
"\tmf.biz_name AS bizName,\n" +
|
||||
"\tbi.alias AS userName,\n" +
|
||||
"\tmo.merchantName AS userName,\n" +
|
||||
"\tmf.amount AS lowerAmount,\n" +
|
||||
"\tmf.create_time AS createTime,\n" +
|
||||
"\tmo.consumeFee AS amount \n" +
|
||||
|
||||
@@ -922,6 +922,7 @@
|
||||
WHERE
|
||||
up.parent_user_id = #{userId}
|
||||
AND up.type_code = #{typeCode}
|
||||
AND up.is_extend ='0'
|
||||
<if test="userName != null and userName != ''">
|
||||
AND ua.userName = #{userName}
|
||||
</if>
|
||||
@@ -1074,6 +1075,7 @@
|
||||
user_id
|
||||
)
|
||||
AND v.userId != #{userId}
|
||||
AND v.transDt BETWEEN #{startTime} AND #{endTime}
|
||||
ORDER BY
|
||||
v.id DESC
|
||||
</select>
|
||||
|
||||
@@ -18,5 +18,6 @@ public interface UserMakerQuotaService extends IService<UserMakerQuota> {
|
||||
|
||||
void quotaInfo(MerchantOrder order);
|
||||
|
||||
|
||||
List<UserMakerQuotaVO> quotaList(Integer page, Integer size,Integer type);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import cn.pluss.platform.util.N;
|
||||
import cn.pluss.platform.vo.UserMakerQuotaVO;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -28,6 +29,7 @@ import java.util.*;
|
||||
* @author lyf
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper, UserMakerQuota> implements UserMakerQuotaService {
|
||||
@Resource
|
||||
private UserMakerQuotaMapper userMakerQuotaMapper;
|
||||
@@ -59,32 +61,8 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void quotaInfo(MerchantOrder order) {
|
||||
BigDecimal consumeFee = new BigDecimal(String.valueOf(order.getConsumeFee()));
|
||||
//商户码转userId
|
||||
if (consumeFee.compareTo(new BigDecimal("0.01"))>0) {
|
||||
MerchantBaseInfo merchantBaseInfoByMerchantCode = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(order.getMerchantCode());
|
||||
if(merchantBaseInfoByMerchantCode == null)
|
||||
return;
|
||||
//找到上级增加额度
|
||||
UserPromotion userInfo = userPromotionMapper.selectByPrimaryKey(Long.valueOf(merchantBaseInfoByMerchantCode.getUserId()));
|
||||
if (userInfo != null) {
|
||||
UserPromotion userParent = userPromotionMapper.selectByUserIdMC(Long.valueOf(userInfo.getParentUserId()));
|
||||
if (userParent != null && "1".equals(userParent.getIsExtend())){
|
||||
BigDecimal profit = consumeFee.multiply(new BigDecimal("0.5")).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
String s = String.valueOf(userParent.getUserId());
|
||||
Integer integer = Integer.valueOf(s);
|
||||
this.modMakerFunds(integer,"SD","免费额度",profit,"",order.getOrderNumber());
|
||||
|
||||
}
|
||||
}
|
||||
//给自己计算
|
||||
assert userInfo != null;
|
||||
if ("1".equals(userInfo.getIsExtend())){
|
||||
profit(userInfo,consumeFee,order);
|
||||
}
|
||||
}
|
||||
this.makerQuota(order);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,29 +84,74 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
}
|
||||
|
||||
//增加额度
|
||||
private void makerQuota(MerchantOrder order){
|
||||
BigDecimal consumeFee = new BigDecimal(String.valueOf(order.getConsumeFee()));
|
||||
//商户码转userId
|
||||
if (consumeFee.compareTo(new BigDecimal("0.01"))>0) {
|
||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
|
||||
public void makerQuota(MerchantOrder order){
|
||||
|
||||
|
||||
//查询自己是否为创客
|
||||
MerchantBaseInfo merchantBaseInfoByMerchantCode = merchantBaseInfoService.getMerchantBaseInfoByMerchantCode(order.getMerchantCode());
|
||||
if(ObjectUtil.isEmpty(merchantBaseInfoByMerchantCode)){
|
||||
log.error("商户信息异常:{}",order.getOrderNumber());
|
||||
return;
|
||||
}
|
||||
|
||||
if(!"1".equals(merchantBaseInfoByMerchantCode.getMerchantType())){
|
||||
log.error("商户并非小微商户:{},{}",merchantBaseInfoByMerchantCode.getMerchantCode(),merchantBaseInfoByMerchantCode.getMerchantType());
|
||||
return;
|
||||
}
|
||||
|
||||
UserPromotion userInfo = userPromotionMapper.selectByPrimaryKey(Long.valueOf(merchantBaseInfoByMerchantCode.getUserId()));
|
||||
if (userInfo != null && "1".equals(userInfo.getIsExtend())){
|
||||
BigDecimal profit = consumeFee.multiply(new BigDecimal("0.0038")).setScale(2, RoundingMode.DOWN);
|
||||
String s = String.valueOf(userInfo.getUserId());
|
||||
if(ObjectUtil.isEmpty(userInfo)){
|
||||
log.error("用户所属关系不存在");
|
||||
return;
|
||||
}
|
||||
if("1".equals(userInfo.getIsExtend())){
|
||||
UserMakerQuota userMakerQuota = userMakerQuotaMapper.selectByUserId(userInfo.getUserId().intValue());
|
||||
if(ObjectUtil.isEmpty(userMakerQuota)){
|
||||
log.error("当前额度为0,{},{},{}",order.getOrderNumber(),order.getConsumeFee(),userInfo.getUserId());
|
||||
return;
|
||||
}
|
||||
BigDecimal havingBalance=userMakerQuota.getAmount().subtract(new BigDecimal(order.getConsumeFee())).setScale(2,BigDecimal.ROUND_DOWN);
|
||||
if(havingBalance.compareTo(BigDecimal.ZERO)>=0){
|
||||
BigDecimal profit=new BigDecimal(order.getConsumeFee()).multiply(new BigDecimal("0.0038")).setScale(2, BigDecimal.ROUND_DOWN);
|
||||
BigDecimal bigDecimal = new BigDecimal(order.getConsumeFee().toString());
|
||||
//提现金额
|
||||
userAccountService.modFunds(userInfo.getUserId().intValue(), "LD", "增加收益", profit, "");
|
||||
//额度改变
|
||||
modMakerFunds(userInfo.getUserId().intValue(), "LD", "收款消耗", bigDecimal, "",order.getOrderNumber());
|
||||
return;
|
||||
}
|
||||
|
||||
if(havingBalance.compareTo(BigDecimal.ZERO)<0){
|
||||
BigDecimal profit=userMakerQuota.getAmount().multiply(new BigDecimal("0.0038")).setScale(2, BigDecimal.ROUND_DOWN);
|
||||
|
||||
//提现金额
|
||||
userAccountService.modFunds(userInfo.getUserId().intValue(), "LD", "增加收益", profit.abs().negate(), "");
|
||||
modMakerFunds(userInfo.getUserId().intValue(), "LD", "收款消耗", userMakerQuota.getAmount().abs().negate(), "",order.getOrderNumber());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else {
|
||||
UserPromotion userParent = userPromotionMapper.selectByUserIdMC(Long.valueOf(userInfo.getParentUserId()));
|
||||
if (userParent == null){
|
||||
log.error("不存在的用户关系:{}",userInfo.getParentUserId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!"1".equals(userParent.getIsExtend())){
|
||||
log.error("商户用户类型异常:{},{}",userParent.getUserId(),userParent.getIsExtend());
|
||||
return;
|
||||
}
|
||||
BigDecimal profit = new BigDecimal(order.getConsumeFee()).multiply(new BigDecimal("0.5")).setScale(2, BigDecimal.ROUND_DOWN);
|
||||
String s = String.valueOf(userParent.getUserId());
|
||||
Integer integer = Integer.valueOf(s);
|
||||
this.modMakerFunds(integer, "SD", "免费额度", profit, "", order.getOrderNumber());
|
||||
return;
|
||||
|
||||
}
|
||||
if (userInfo != null) {
|
||||
UserPromotion userParent = userPromotionMapper.selectByUserIdMC(Long.valueOf(userInfo.getParentUserId()));
|
||||
if (userParent != null) {
|
||||
UserMakerQuota userMakerQuota = new UserMakerQuota();
|
||||
userMakerQuota.setUserId(userParent.getUserId());
|
||||
userMakerQuota.setAmount(consumeFee.divide(new BigDecimal("2"),2,BigDecimal.ROUND_DOWN));
|
||||
userMakerQuota.setCreateTime(new Date());
|
||||
userMakerQuotaMapper.insert(userMakerQuota);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//增加提现金额
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -181,10 +204,6 @@ public class UserMakerQuotaServiceImpl extends ServiceImpl<UserMakerQuotaMapper,
|
||||
if(N.gt(difference,BigDecimal.ZERO)){
|
||||
difference=difference.abs();
|
||||
}
|
||||
if ("LD".equals(bizCode)){
|
||||
difference = difference.negate();
|
||||
}
|
||||
|
||||
userMakerQuotaMapper.updateMakerFreeze(userId,difference);
|
||||
|
||||
UserMakerFlow flow=new UserMakerFlow();
|
||||
|
||||
@@ -97,7 +97,7 @@ public class PromoterMainPageServiceImpl implements MainPageService {
|
||||
//今日收款笔数
|
||||
queryMap.put("recordDate", DateUtils.getDayBegin());
|
||||
queryMap.put("retype", "1");
|
||||
totalOrderCount = merchantProfitMapper.queryMerchantProfitPageCountV2(userId);
|
||||
totalOrderCount = merchantProfitMapper.queryMerchantProfitPageCountV2(userId,DateUtils.getDayBegin(),DateUtils.getDayEnd());
|
||||
todayProfit = merchantProfitService.queryMerchantProfitSumPrice(queryMap);
|
||||
|
||||
//今日收益
|
||||
|
||||
@@ -93,6 +93,7 @@ public interface MerchantProfitService extends IService<MerchantProfit> {
|
||||
void sendProfitMessage(UserApp userApp, BigDecimal profitMoney, String orderNumber);
|
||||
|
||||
Map<String, Object> teamList(String typeCode, Long userId, Integer page,Integer size,String name);
|
||||
Map<String, Object> teamQuotaList(String typeCode, Long userId, Integer page,Integer size,String name);
|
||||
|
||||
Map<String, Object> merchantListData(Long userId);
|
||||
}
|
||||
|
||||
@@ -135,21 +135,22 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||
}
|
||||
|
||||
// PageInfo<MerchantProfitVO> teamList= merchantProfitMapper.getTeamList(typeCode, userId, page,size,name);
|
||||
|
||||
Integer countChild = merchantProfitMapper.getCountChild(userId, typeCode);
|
||||
UserPromotion userPromotion = userPromotionMapper.selectByPrimaryKey(userId);
|
||||
if (Objects.equals(userPromotion.getIsExtend(), "1")){
|
||||
List<MerchantProfitVO> teamList = merchantProfitMapper.getTeamList(typeCode, userId, name, pagerSize, offset);
|
||||
for (MerchantProfitVO values : teamList) {
|
||||
values.setCurrentMonth(mapperOrderMapper.getPlatformAmtYestday(values.getMerchantCode(),
|
||||
DateUtils.getBeginDayOfMonth(), DateUtils.getEndDayOfMonth()));
|
||||
values.setConsumeFee(mapperOrderMapper.getAmountData(values.getMerchantCode()));
|
||||
}
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("total", countChild);
|
||||
hashMap.put("teamList", teamList);
|
||||
return hashMap;
|
||||
}
|
||||
// UserPromotion userPromotion = userPromotionMapper.selectByPrimaryKey(userId);
|
||||
// if (Objects.equals(userPromotion.getIsExtend(), "1")){
|
||||
// List<MerchantProfitVO> teamList = merchantProfitMapper.getTeamList(typeCode, userId, name, pagerSize, offset);
|
||||
//
|
||||
// teamList.stream().parallel().forEach(values->{
|
||||
// values.setCurrentMonth(mapperOrderMapper.getPlatformAmtYestday(values.getMerchantCode(),
|
||||
// DateUtils.getBeginDayOfMonth(), DateUtils.getEndDayOfMonth()));
|
||||
// values.setConsumeFee(mapperOrderMapper.getAmountData(values.getMerchantCode()));
|
||||
// });
|
||||
//
|
||||
// HashMap<String, Object> hashMap = new HashMap<>();
|
||||
// hashMap.put("total", countChild);
|
||||
// hashMap.put("teamList", teamList);
|
||||
// return hashMap;
|
||||
// }
|
||||
//商户列表
|
||||
if ("MC".equals(typeCode)) {
|
||||
List<MerchantProfitVO> teamList = merchantProfitMapper.getMerchantTeamList(typeCode, userId, name, pagerSize, offset);
|
||||
@@ -249,6 +250,29 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> teamQuotaList(String typeCode, Long userId, Integer page, Integer size, String name) {
|
||||
Integer pagerSize = size;
|
||||
Integer offset = (page - 1) * size;
|
||||
Integer countChild = merchantProfitMapper.getCountQuotaChild(userId, typeCode);
|
||||
UserPromotion userPromotion = userPromotionMapper.selectByPrimaryKey(userId);
|
||||
if (Objects.equals(userPromotion.getIsExtend(), "1")){
|
||||
List<MerchantProfitVO> teamList = merchantProfitMapper.getTeamList(typeCode, userId, name, pagerSize, offset);
|
||||
|
||||
teamList.stream().parallel().forEach(values->{
|
||||
values.setCurrentMonth(mapperOrderMapper.getPlatformAmtYestday(values.getMerchantCode(),
|
||||
DateUtils.getBeginDayOfMonth(), DateUtils.getEndDayOfMonth()));
|
||||
values.setConsumeFee(mapperOrderMapper.getAmountData(values.getMerchantCode()));
|
||||
});
|
||||
|
||||
HashMap<String, Object> hashMap = new HashMap<>();
|
||||
hashMap.put("total", countChild);
|
||||
hashMap.put("teamList", teamList);
|
||||
return hashMap;
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> merchantListData(Long userId) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user