记得上下班打卡 | git大法好,push需谨慎

Commit 70fa914e authored by wangyifan's avatar wangyifan

admin数据看板-演出列表数据

parent 92bb4c12
package com.liquidnet.client.admin.zhengzai.kylin.dto;
import lombok.Data;
@Data
public class OpenDataBaseResponse<T> {
private Integer code;
private String msg;
private T data;
public boolean isSucc(){
return this.code != null && this.code == 0;
}
}
package com.liquidnet.client.admin.zhengzai.kylin.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
public class OpenDataSalesResponse extends OpenDataBaseResponse<List<PerformanceSalesDto>>{
}
package com.liquidnet.client.admin.zhengzai.kylin.dto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Data
public class OpenDataTicketSalesResponse extends OpenDataBaseResponse<PerformanceTicketSalesDto>{
}
package com.liquidnet.client.admin.zhengzai.kylin.dto;
import lombok.Data;
@Data
public class PerformanceSalesDto {
/**
* 演出ID
*/
private String performanceId;
/**
* 总库存
*/
private Integer totalGeneral;
/**
* 观众购票数
*/
private Integer audienceTicketTotal;
/**
* 剩余库存
*/
private Integer surplusGeneral;
/**
* 总销售额
*/
private String salesAmountTotal;
}
package com.liquidnet.client.admin.zhengzai.kylin.dto;
import lombok.Data;
import java.util.List;
@Data
public class PerformanceTicketSalesDto {
/**
* 总销售票款(元)
*/
private String fullSalesAmountTotal;
/**
* 观众购票数
*/
private Integer fullAudienceTicketTotal;
/**
* 总库存
*/
private Integer fullTotalGeneral;
/**
* 退票数量(张)
*/
private Integer fullRefundTicketTotal;
/**
* 票种销售数据
*/
private List<TicketSales> fullTicketDataList;
@Data
public static class TicketSales {
// 票ID
private String ticketId;
// 场次ID
private String timeId;
// 场次名称
private String timeTitle;
// 票种名称
private String ticketTitle;
// 票种金额
private String ticketPrice;
// 销售总金额
private String salesAmountTotal;
// 退票手续费总收益
private String refundFeeRevenueTotal;
// 观众购票总数[销售总票量-兑换码票总数]
private String audienceTicketTotal;
// 观众购票销售总金额[票种金额* 观众购票总数]
private String audienceSalesAmountTotal;
// 全额退票总数
private String fullRefundTicketTotal;
// 手续费退票总数
private String handlingFeeRefundTicketTotal;
// 退票总数量
private String refundTicketTotal;
// 票种类型 1:单日票 2:通票
private String ticketType;
// 库存数量
private String totalGeneral;
// 登登登VIP购买数量
private String vipBuyTotal;
// 正在支付数量
private String payingTotal;
}
}
package com.liquidnet.client.admin.zhengzai.kylin.service;
import com.liquidnet.client.admin.zhengzai.kylin.dto.PerformanceSalesDto;
import com.liquidnet.client.admin.zhengzai.kylin.dto.PerformanceTicketSalesDto;
import java.util.List;
/**
* 数据查询服务
*/
public interface IOpenDataService {
/**
* 获取演出销售数据
* @param performanceIdList
* @return
*/
List<PerformanceSalesDto> getPerformanceSalesInfo(List<String> performanceIdList);
/**
* 获取演出票销售数据
* @param performanceId
* @return
*/
PerformanceTicketSalesDto getPerformanceTicketSalesInfo(String performanceId);
}
......@@ -7,14 +7,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.liquidnet.client.admin.common.utils.StringUtils;
import com.liquidnet.client.admin.zhengzai.kylin.dto.PerformanceSalesDto;
import com.liquidnet.client.admin.zhengzai.kylin.service.IOpenDataService;
import com.liquidnet.client.admin.zhengzai.kylin.service.InnerService;
import com.liquidnet.client.admin.zhengzai.kylin.utils.DataUtils;
import com.liquidnet.client.admin.zhengzai.kylin.utils.PerformanceVoUtils;
import com.liquidnet.client.admin.zhengzai.slime.service.ISlimeAuthorizationRecordsAdminService;
import com.liquidnet.client.admin.zhengzai.smile.utils.SmileRedisUtils;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.goblin.dto.vo.SmileAgentVo;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
......@@ -104,6 +104,10 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
@Autowired
KylinPerformancesMapper kylinPerformancesMapper;
@Autowired
private IOpenDataService openDataService;
@Override
public void test() {
// //同步演出
......@@ -294,7 +298,30 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
try {
Map<String, Object> map = BeanUtil.convertBeanToMap(performanceAdminListParam);
List<PerformanceAdminListDao> voList = performancesMapper.misPerformanceList(map);
List<String> performanceIdList = voList.stream().map(PerformanceAdminListDao::getPerformancesId)
.collect(Collectors.toList());
Map<String, PerformanceSalesDto> salesDtoMap = new HashMap<>();
if (!performanceIdList.isEmpty()) {
// 获取演出销售数据
List<PerformanceSalesDto> performanceSalesInfoList = openDataService.getPerformanceSalesInfo(performanceIdList);
if (!performanceSalesInfoList.isEmpty()) {
salesDtoMap = performanceSalesInfoList.stream()
.collect(Collectors.toMap(
PerformanceSalesDto::getPerformanceId,
performanceSalesDto -> performanceSalesDto
));
}
}
for (PerformanceAdminListDao item : voList) {
// 修改售卖数据
PerformanceSalesDto performanceSalesDto = salesDtoMap.get(item.getPerformancesId());
if (performanceSalesDto != null) {
item.setTotalGeneral(performanceSalesDto.getTotalGeneral());
item.setTotalSalePrice(new BigDecimal(performanceSalesDto.getSalesAmountTotal()));
item.setSaleGeneral(performanceSalesDto.getAudienceTicketTotal());
item.setSurplusGeneral(performanceSalesDto.getSurplusGeneral());
}
if (item.getTimeSell() == null || item.getTimeStop() == null) {
continue;
}
......
package com.liquidnet.client.admin.zhengzai.kylin.service.impl;
import com.liquidnet.client.admin.zhengzai.kylin.dto.OpenDataSalesResponse;
import com.liquidnet.client.admin.zhengzai.kylin.dto.OpenDataTicketSalesResponse;
import com.liquidnet.client.admin.zhengzai.kylin.dto.PerformanceSalesDto;
import com.liquidnet.client.admin.zhengzai.kylin.dto.PerformanceTicketSalesDto;
import com.liquidnet.client.admin.zhengzai.kylin.service.IOpenDataService;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@Slf4j
@Service
public class OpenDataServiceImpl implements IOpenDataService {
@Value("${liquidnet.openData.host}")
private String openDataHost;
@Value("${liquidnet.openData.auth}")
private String openDataAuth;
@Override
public List<PerformanceSalesDto> getPerformanceSalesInfo(List<String> performanceIdList) {
HashMap<String, List<String>> map = new HashMap<>();
map.put("performanceIds", performanceIdList);
HttpHeaders headers = new HttpHeaders();
headers.set(HttpHeaders.AUTHORIZATION, openDataAuth);
try {
String postJson = HttpUtil.postJson(openDataHost + "/api/performance/sales", JsonUtils.toJson(map), headers);
log.info("response: {}", postJson);
if (StringUtil.isBlank(postJson)) {
return Collections.emptyList();
}
OpenDataSalesResponse openDataSalesResponse = JsonUtils.fromJson(postJson, OpenDataSalesResponse.class);
if (!openDataSalesResponse.isSucc()) {
return Collections.emptyList();
}
return openDataSalesResponse.getData();
} catch (Exception e) {
log.error("error", e);
}
return Collections.emptyList();
}
@Override
public PerformanceTicketSalesDto getPerformanceTicketSalesInfo(String performanceId) {
HttpHeaders headers = new HttpHeaders();
headers.set(HttpHeaders.AUTHORIZATION, openDataAuth);
try {
String responseStr = HttpUtil.getByUri(openDataHost + "/api/performance/ticket/sales?performanceId=" + performanceId, headers);
log.info("response: {}", responseStr);
if (StringUtil.isBlank(responseStr)) {
return null;
}
OpenDataTicketSalesResponse openDataSalesResponse = JsonUtils.fromJson(responseStr, OpenDataTicketSalesResponse.class);
if (!openDataSalesResponse.isSucc()) {
return null;
}
return openDataSalesResponse.getData();
} catch (Exception e) {
log.error("error", e);
}
return null;
}
}
......@@ -22,5 +22,8 @@ liquidnet:
mongodb:
sslEnabled: false
database: dev_ln_scene
openData:
host: http://localhost:8091
auth: t-gI1wT4kM4qF2bB4mJ4zQ1gM6cU6dC9uB
# end-dev-这里是配置信息基本值
\ No newline at end of file
......@@ -22,5 +22,8 @@ liquidnet:
mongodb:
sslEnabled: false
database: test_ln_scene
openData:
host: https://testopen.zhengzai.tv
auth: t-gI1wT4kM4qF2bB4mJ4zQ1gM6cU6dC9uB
# end-test-这里是配置信息基本值
\ No newline at end of file
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