新增上个月代理团队目标接口
This commit is contained in:
parent
a5e82b36b9
commit
57da1d71ba
@ -109,6 +109,14 @@ public class TeamBdRestController extends BaseController {
|
|||||||
return teamBdService.getBdAgentCount(cmd);
|
return teamBdService.getBdAgentCount(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BD名下代理情况统计(上个月)
|
||||||
|
*/
|
||||||
|
@GetMapping("/agent-count-last")
|
||||||
|
public BdAgentCountCO agentCountLastMonth(AppExtCommand cmd) {
|
||||||
|
return teamBdService.getBdAgentLastCount(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否为BD.
|
* 是否为BD.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -45,4 +45,23 @@ public class BdAgentCountQryExe {
|
|||||||
.setThisMonthTotalTarget(target)
|
.setThisMonthTotalTarget(target)
|
||||||
.setThisMonthTotalTargetFormat(NumUtils.formatLong(target));
|
.setThisMonthTotalTargetFormat(NumUtils.formatLong(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BdAgentCountCO executeLastMonth(AppExtCommand cmd) {
|
||||||
|
List<Long> teamIds = Optional.ofNullable(businessDevelopmentTeamService.query()
|
||||||
|
.select(BusinessDevelopmentTeam::getTeamId)
|
||||||
|
.eq(BusinessDevelopmentTeam::getUserId, cmd.requireReqSysOriginEnum())
|
||||||
|
.last(PageConstant.MAX_LIMIT)
|
||||||
|
.list())
|
||||||
|
.map(teams -> teams.stream().map(BusinessDevelopmentTeam::getTeamId)
|
||||||
|
.collect(Collectors.toList()))
|
||||||
|
.orElseGet(CollectionUtils::newArrayList);
|
||||||
|
|
||||||
|
Long target = teamMemberTargetService.countLastMonthTeamMemberTarget(teamIds);
|
||||||
|
return new BdAgentCountCO()
|
||||||
|
.setAgentQuantity(
|
||||||
|
businessDevelopmentTeamService.countTeamByBdUserId(cmd.requiredReqUserId()))
|
||||||
|
.setThisMonthTotalTarget(target)
|
||||||
|
.setThisMonthTotalTargetFormat(NumUtils.formatLong(target));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -77,6 +77,11 @@ public class TeamBdServiceImpl implements TeamBdService {
|
|||||||
return bdAgentCountQryExe.execute(cmd);
|
return bdAgentCountQryExe.execute(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BdAgentCountCO getBdAgentLastCount(AppExtCommand cmd) {
|
||||||
|
return bdAgentCountQryExe.executeLastMonth(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BdInviteMessageCO> listBdInviteMessage(BdInviteQryCmd cmd) {
|
public List<BdInviteMessageCO> listBdInviteMessage(BdInviteQryCmd cmd) {
|
||||||
return bdInviteMessageQryExe.execute(cmd);
|
return bdInviteMessageQryExe.execute(cmd);
|
||||||
|
|||||||
@ -50,6 +50,11 @@ public interface TeamBdService {
|
|||||||
*/
|
*/
|
||||||
BdAgentCountCO getBdAgentCount(AppExtCommand cmd);
|
BdAgentCountCO getBdAgentCount(AppExtCommand cmd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代理情况统计(上个月)
|
||||||
|
*/
|
||||||
|
BdAgentCountCO getBdAgentLastCount(AppExtCommand cmd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 被邀请消息列表-邀请信息.
|
* 被邀请消息列表-邀请信息.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -173,6 +173,12 @@ public interface TeamMemberTargetService {
|
|||||||
*/
|
*/
|
||||||
Long countThisMonthTeamMemberTarget(List<Long> teamIds);
|
Long countThisMonthTeamMemberTarget(List<Long> teamIds);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计上个月团队总目标.
|
||||||
|
*/
|
||||||
|
Long countLastMonthTeamMemberTarget(List<Long> teamIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据团队id修改本月成员目标状态.
|
* 根据团队id修改本月成员目标状态.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -16,7 +16,11 @@ import com.red.circle.other.inner.enums.team.TeamMemberTargetStatus;
|
|||||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||||
import com.red.circle.tool.core.date.TimestampUtils;
|
import com.red.circle.tool.core.date.TimestampUtils;
|
||||||
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
|
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
|
||||||
|
import com.red.circle.tool.core.date.ZonedId;
|
||||||
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.temporal.TemporalAdjusters;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -490,6 +494,45 @@ public class TeamMemberTargetServiceImpl implements TeamMemberTargetService {
|
|||||||
return basicDBObjectList.get(0).getLong("quantity");
|
return basicDBObjectList.get(0).getLong("quantity");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countLastMonthTeamMemberTarget(List<Long> teamIds) {
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(teamIds)) {
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
Aggregation aggregation = Aggregation.newAggregation(
|
||||||
|
Aggregation.match(Criteria.where("teamId").in(teamIds)
|
||||||
|
.and("history").is(Boolean.FALSE)
|
||||||
|
.and("createTime").gte(
|
||||||
|
ZonedDateTime.now(ZonedId.ASIA_RIYADH.getZonedId())
|
||||||
|
.minusMonths(1)
|
||||||
|
.with(TemporalAdjusters.firstDayOfMonth())
|
||||||
|
.withHour(0)
|
||||||
|
.withMinute(0)
|
||||||
|
.withSecond(0)
|
||||||
|
.withNano(0)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Aggregation.unwind("dailyTargets"),
|
||||||
|
Aggregation.group("sysOrigin")
|
||||||
|
.sum("dailyTargets.acceptGiftValue").as("quantity")
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
|
AggregationResults<BasicDBObject> aggregationResults = mongoTemplate.aggregate(
|
||||||
|
aggregation,
|
||||||
|
TeamMemberTarget.class,
|
||||||
|
BasicDBObject.class);
|
||||||
|
|
||||||
|
List<BasicDBObject> basicDBObjectList = aggregationResults.getMappedResults();
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(basicDBObjectList)) {
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
return basicDBObjectList.get(0).getLong("quantity");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateStatusByTeamIds(Set<Long> teamIds, TeamMemberTargetStatus status) {
|
public void updateStatusByTeamIds(Set<Long> teamIds, TeamMemberTargetStatus status) {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user