|
|
@ -6,6 +6,7 @@ import com.bnyer.common.core.utils.StringUtils; |
|
|
import com.bnyer.common.redis.service.RedisService; |
|
|
import com.bnyer.common.redis.service.RedisService; |
|
|
import com.bnyer.img.domain.CreatorProfit; |
|
|
import com.bnyer.img.domain.CreatorProfit; |
|
|
import com.bnyer.img.domain.InviteLog; |
|
|
import com.bnyer.img.domain.InviteLog; |
|
|
|
|
|
import com.bnyer.img.dto.BatchUpdateInviteDto; |
|
|
import com.bnyer.img.dto.CreatorProfitPageDto; |
|
|
import com.bnyer.img.dto.CreatorProfitPageDto; |
|
|
import com.bnyer.img.dto.ProfitInOrEndDto; |
|
|
import com.bnyer.img.dto.ProfitInOrEndDto; |
|
|
import com.bnyer.img.mapper.CreatorProfitMapper; |
|
|
import com.bnyer.img.mapper.CreatorProfitMapper; |
|
|
@ -45,9 +46,9 @@ public class CreatorProfitServiceImpl implements CreatorProfitService { |
|
|
public boolean checkCreatorProfitExist(Long creatorId, Long imgId,String appType,String platform,String type, String date) { |
|
|
public boolean checkCreatorProfitExist(Long creatorId, Long imgId,String appType,String platform,String type, String date) { |
|
|
CreatorProfit creatorProfit = creatorProfitMapper.checkCreatorProfitExist(creatorId, imgId, appType, platform,type, date); |
|
|
CreatorProfit creatorProfit = creatorProfitMapper.checkCreatorProfitExist(creatorId, imgId, appType, platform,type, date); |
|
|
if(creatorProfit != null){ |
|
|
if(creatorProfit != null){ |
|
|
return false; |
|
|
|
|
|
}else{ |
|
|
|
|
|
return true; |
|
|
return true; |
|
|
|
|
|
}else{ |
|
|
|
|
|
return false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -77,17 +78,9 @@ public class CreatorProfitServiceImpl implements CreatorProfitService { |
|
|
return insert; |
|
|
return insert; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void batchUpdateDownload(List<CreatorProfit> list){ |
|
|
|
|
|
creatorProfitMapper.batchUpdateDownload(list); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void batchInsertInviteProfit(List<CreatorProfit> list){ |
|
|
|
|
|
creatorProfitMapper.batchInsertInviteProfit(list); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public int insertInvitedProfit(CreatorProfit creatorProfit) { |
|
|
public void insertInvitedProfit(CreatorProfit creatorProfit) { |
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
long times = System.currentTimeMillis(); |
|
|
long times = System.currentTimeMillis(); |
|
|
String date = format.format(times); |
|
|
String date = format.format(times); |
|
|
@ -96,31 +89,42 @@ public class CreatorProfitServiceImpl implements CreatorProfitService { |
|
|
wrapper.eq(InviteLog::getInvitedCreatorId, creatorProfit.getCreatorId()); |
|
|
wrapper.eq(InviteLog::getInvitedCreatorId, creatorProfit.getCreatorId()); |
|
|
List<InviteLog> inviteLogs = inviteLogMapper.selectList(wrapper); |
|
|
List<InviteLog> inviteLogs = inviteLogMapper.selectList(wrapper); |
|
|
if(inviteLogs.size() > 0){ |
|
|
if(inviteLogs.size() > 0){ |
|
|
List<Long> updateList = new ArrayList<>(); |
|
|
List<BatchUpdateInviteDto> updateList = new ArrayList<>(); |
|
|
List<Long> insertList = new ArrayList<>(); |
|
|
List<CreatorProfit> insertList = new ArrayList<>(); |
|
|
for (InviteLog inviteLog : inviteLogs) { |
|
|
for (InviteLog inviteLog : inviteLogs) { |
|
|
//检查收益表是否存在邀请记录,存在则记录更新邀请者Id
|
|
|
//检查收益表是否存在邀请记录,存在则记录更新邀请者Id
|
|
|
boolean b = this.checkCreatorProfitExist(inviteLog.getCreatorId(),creatorProfit.getImgId(),creatorProfit.getAppType(),creatorProfit.getPlatform(),"1",date); |
|
|
boolean b = this.checkCreatorProfitExist(inviteLog.getCreatorId(),creatorProfit.getImgId(),creatorProfit.getAppType(),creatorProfit.getPlatform(),"1",date); |
|
|
if(b){ |
|
|
if(b){ |
|
|
updateList.add(inviteLog.getCreatorId()); |
|
|
BatchUpdateInviteDto dto = new BatchUpdateInviteDto(); |
|
|
} |
|
|
dto.setCreatorId(inviteLog.getCreatorId()); |
|
|
|
|
|
dto.setAppType(creatorProfit.getAppType()); |
|
|
|
|
|
dto.setImgId(creatorProfit.getImgId()); |
|
|
|
|
|
dto.setPlatform(creatorProfit.getPlatform()); |
|
|
|
|
|
dto.setDate(date); |
|
|
|
|
|
dto.setType("1"); |
|
|
|
|
|
updateList.add(dto); |
|
|
|
|
|
}else{ |
|
|
//不存在则新增邀请者id
|
|
|
//不存在则新增邀请者id
|
|
|
insertList.add(inviteLog.getCreatorId()); |
|
|
creatorProfit.setCreatorId(inviteLog.getCreatorId()); |
|
|
// creatorProfit.setCreatorId(inviteLog.getCreatorId());
|
|
|
creatorProfit.setCreateTime(new Date()); |
|
|
// creatorProfit.setCreateTime(new Date());
|
|
|
creatorProfit.setUpdateTime(new Date()); |
|
|
// creatorProfit.setUpdateTime(new Date());
|
|
|
creatorProfit.setType("1"); |
|
|
// creatorProfit.setType("1");
|
|
|
creatorProfit.setStatus("0"); |
|
|
// creatorProfit.setStatus("0");
|
|
|
creatorProfit.setIsShow("1"); |
|
|
// creatorProfit.setIsShow("1");
|
|
|
creatorProfit.setSort(0); |
|
|
// creatorProfit.setSort(0);
|
|
|
creatorProfit.setDownloadNum(1); |
|
|
// creatorProfit.setDownloadNum(1);
|
|
|
insertList.add(creatorProfit); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if(updateList.size() > 0){ |
|
|
//批量更新邀请记录
|
|
|
//批量更新邀请记录
|
|
|
|
|
|
creatorProfitMapper.batchUpdateDownload(updateList); |
|
|
|
|
|
} |
|
|
|
|
|
if(insertList.size() > 0){ |
|
|
//批量新增邀请记录
|
|
|
//批量新增邀请记录
|
|
|
|
|
|
creatorProfitMapper.batchInsertInviteProfit(insertList); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|