Commit 35f422f2 authored by alex yao's avatar alex yao

feat:首页应用积分数

parent 6fe27791
package cn.com.poc.expose.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
public class SearchAgentApplicationDto implements Serializable {
......@@ -36,6 +37,11 @@ public class SearchAgentApplicationDto implements Serializable {
*/
private String creator;
/**
* 积分数
*/
private BigDecimal points;
public String getAgentId() {
return agentId;
}
......@@ -83,4 +89,12 @@ public class SearchAgentApplicationDto implements Serializable {
public void setCreator(String creator) {
this.creator = creator;
}
public BigDecimal getPoints() {
return points;
}
public void setPoints(BigDecimal points) {
this.points = points;
}
}
......@@ -16,6 +16,9 @@ import cn.com.poc.common.utils.Assert;
import cn.com.poc.common.utils.BlContext;
import cn.com.poc.common.utils.StringUtils;
import cn.com.poc.common.utils.UUIDTool;
import cn.com.poc.equity.aggregate.PointDeductionRulesService;
import cn.com.poc.equity.entity.BizPointDeductionRulesEntity;
import cn.com.poc.equity.service.BizPointDeductionRulesService;
import cn.com.poc.expose.aggregate.AgentApplicationService;
import cn.com.poc.expose.dto.*;
import cn.com.poc.expose.rest.AgentApplicationRest;
......@@ -34,6 +37,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
......@@ -58,6 +63,9 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
@Resource
private AgentApplicationProducerService agentApplicationProducerService;
@Resource
private PointDeductionRulesService pointDeductionRulesService;
@Override
public List<String> getRecommendQuestions(HttpServletRequest httpServletRequest) throws Exception {
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
......@@ -144,8 +152,11 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
publishEntity.setMemberId(0);
publishEntity.setIsDeleted(CommonConstant.IsDeleted.N);
List<BizAgentApplicationPublishEntity> entities = bizAgentApplicationPublishService.findByExample(publishEntity, pagingInfo);
BizPointDeductionRulesEntity bizPointDeductionRulesEntity = new BizPointDeductionRulesEntity();
bizPointDeductionRulesEntity.setIsDeleted(CommonConstant.IsDeleted.N);
if (CollectionUtils.isNotEmpty(entities)) {
result = entities.stream().map(value -> {
Long pointDeductionNum = pointDeductionRulesService.calculatePointDeductionNum(value.getLargeModel(), value.getCommunicationTurn(), null);
SearchAgentApplicationDto searchAgentApplicationDto = new SearchAgentApplicationDto();
searchAgentApplicationDto.setAgentId(value.getAgentId());
searchAgentApplicationDto.setAgentTitle(value.getAgentTitle());
......@@ -153,6 +164,7 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
searchAgentApplicationDto.setAgentAvatar(value.getAgentAvatar());
searchAgentApplicationDto.setPublishedTime(value.getModifiedTime());
searchAgentApplicationDto.setCreator("官方");
searchAgentApplicationDto.setPoints(new BigDecimal(pointDeductionNum).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP));
return searchAgentApplicationDto;
}).collect(Collectors.toList());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment