Commit 88754a48 authored by alex yao's avatar alex yao

fix:【【POE】-【应用-发布】-API调用发布导出文件的表头字段需要修改】

--bug==1009801
parent 613a6ab9
......@@ -4,14 +4,12 @@ import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import java.util.Date;
/**
* @author alex.yao
* @date 2024/12/20
*/
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.LEFT)
public class ApiChannelReportEntity {
public class ApiChannelReportENEntity {
@ExcelProperty(value = "date", index = 0)
private String dateTime;
......
package cn.com.poc.formreport.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
/**
* @author alex.yao
* @date 2024/12/20
*/
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.LEFT)
public class ApiChannelReportZHCNEntity {
@ExcelProperty(value = "调用时间", index = 0)
private String dateTime;
@ExcelProperty(value = "消耗积分", index = 1)
private Double count;
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
public Double getCount() {
return count;
}
public void setCount(Double count) {
this.count = count;
}
}
package cn.com.poc.formreport.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
/**
* @author alex.yao
* @date 2024/12/20
*/
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.LEFT)
public class ApiChannelReportZHTWEntity {
@ExcelProperty(value = "調用時間", index = 0)
private String dateTime;
@ExcelProperty(value = "消耗積分", index = 1)
private Double count;
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
public Double getCount() {
return count;
}
public void setCount(Double count) {
this.count = count;
}
}
package cn.com.poc.formreport.strategy;
import cn.com.poc.common.utils.BlContext;
import cn.com.poc.data_analyze.entity.AgentDataAnalyzeApiChannelEntity;
import cn.com.poc.expose.aggregate.AgentDataAnalyzeService;
import cn.com.poc.formreport.FormReportRequest;
import cn.com.poc.formreport.entity.ApiChannelReportEntity;
import cn.com.poc.formreport.entity.ApiChannelReportENEntity;
import cn.com.poc.formreport.entity.ApiChannelReportZHCNEntity;
import cn.com.poc.formreport.entity.ApiChannelReportZHTWEntity;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
......@@ -12,6 +15,8 @@ import java.math.RoundingMode;
import java.util.List;
import java.util.stream.Collectors;
import static cn.com.poc.common.constant.XLangConstant.*;
/**
* Agent应用 API渠道-积分使用数据
*
......@@ -27,18 +32,52 @@ public class AgentDataAnalyzeApiChannelFormReportStrategy extends AbstractFormRe
@Override
public List<Object> getFormReportData(FormReportRequest reportRequest) throws Exception {
String lang = BlContext.getCurrentLocaleLanguageToLowerCase();
List<AgentDataAnalyzeApiChannelEntity> analyzeApiChannelEntities = agentDataAnalyzeService.getAgentApiChannelPointCount(reportRequest.getAgentId(), reportRequest.getTimeRange());
switch (lang) {
case ZH_CN:
return analyzeApiChannelEntities.stream().map(value -> {
ApiChannelReportZHCNEntity apiChannelReportEntity = new ApiChannelReportZHCNEntity();
apiChannelReportEntity.setDateTime(value.getDateTime());
apiChannelReportEntity.setCount(BigDecimal.valueOf(value.getCount()).setScale(2, RoundingMode.HALF_UP).doubleValue());
return apiChannelReportEntity;
}).collect(Collectors.toList());
case EN:
return analyzeApiChannelEntities.stream().map(value -> {
ApiChannelReportENEntity apiChannelReportEntity = new ApiChannelReportENEntity();
apiChannelReportEntity.setDateTime(value.getDateTime());
apiChannelReportEntity.setCount(BigDecimal.valueOf(value.getCount()).setScale(2, RoundingMode.HALF_UP).doubleValue());
return apiChannelReportEntity;
}).collect(Collectors.toList());
case ZH_TW:
return analyzeApiChannelEntities.stream().map(value -> {
ApiChannelReportZHTWEntity apiChannelReportEntity = new ApiChannelReportZHTWEntity();
apiChannelReportEntity.setDateTime(value.getDateTime());
apiChannelReportEntity.setCount(BigDecimal.valueOf(value.getCount()).setScale(2, RoundingMode.HALF_UP).doubleValue());
return apiChannelReportEntity;
}).collect(Collectors.toList());
}
return analyzeApiChannelEntities.stream().map(value -> {
ApiChannelReportEntity apiChannelReportEntity = new ApiChannelReportEntity();
ApiChannelReportENEntity apiChannelReportEntity = new ApiChannelReportENEntity();
apiChannelReportEntity.setDateTime(value.getDateTime());
apiChannelReportEntity.setCount(BigDecimal.valueOf(value.getCount()).setScale(2, RoundingMode.HALF_UP).doubleValue());
return apiChannelReportEntity;
}).collect(Collectors.toList());
}
@Override
public Class getExcelEntityClass() {
return ApiChannelReportEntity.class;
String lang = BlContext.getCurrentLocaleLanguageToLowerCase();
switch (lang) {
case ZH_CN:
return ApiChannelReportZHCNEntity.class;
case EN:
return ApiChannelReportENEntity.class;
case ZH_TW:
return ApiChannelReportZHTWEntity.class;
}
return ApiChannelReportENEntity.class;
}
@Override
......
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