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

Commit ef936c31 authored by 胡佳晨's avatar 胡佳晨

修改 第三方演出列表

parent 0aba6d42
......@@ -88,10 +88,10 @@ public class KylinPerformancesAdminServiceImpl extends ServiceImpl<KylinPerforma
@Override
public void test() {
// //同步演出
// String performancesId = "324470932321198083852669";
// KylinPerformances data = performancesMapper.selectOne(new QueryWrapper<KylinPerformances>().in("performances_id", performancesId));
// KylinPerformanceRelations relationData = performanceRelationsMapper.selectOne(new QueryWrapper<KylinPerformanceRelations>().in("performance_id", performancesId));
// merchantAuthorizationRecordsAdminService.authorizationInit(performancesId, "484418569471385607065926", "528301618682265605017366", "528268445384048648038465");
String performancesId = "324470932321198083852669";
KylinPerformances data = performancesMapper.selectOne(new QueryWrapper<KylinPerformances>().in("performances_id", performancesId));
KylinPerformanceRelations relationData = performanceRelationsMapper.selectOne(new QueryWrapper<KylinPerformanceRelations>().in("performance_id", performancesId));
merchantAuthorizationRecordsAdminService.authorizationInit(performancesId, "484418569471385607065926", "528301618682265605017366", "528268445384048648038465");
// innerService.reportP(dataUtils.getPerformanceVo(performancesId),null,data.getSponsorId());
// //同步订单
// String orderId = "324561214127595525805856";
......
......@@ -755,13 +755,21 @@ public final class RedisUtil {
public static void main(String[] args) {
String[] keys = {
"kylin:performances_inventory:ticket:id:523896782185635848726990:surplusGeneral",
"kylin:performances_inventory:ticket:id:524000822137774085466119:surplusGeneral",
"kylin:performances_inventory:ticket:id:524002587560632325278111:surplusGeneral",
"kylin:performances_inventory:ticket:id:523899402439352329963230:surplusGeneral",
"kylin:performances_inventory:ticket:id:523902717293568002992006:surplusGeneral",
"kylin:performances_inventory:ticket:id:523900958747729925162437:surplusGeneral",
"kylin:performances_inventory:ticket:id:523904302866309125382325:surplusGeneral",
"kylin:performances_inventory:ticket:id:530885109799526402280996:surplusGeneral",
"kylin:performances_inventory:ticket:id:531325069586063361077629:surplusGeneral",
"kylin:performances_inventory:ticket:id:531353503781150727329219:surplusGeneral",
"kylin:performances_inventory:ticket:id:531349041081999366666149:surplusGeneral",
"kylin:performances_inventory:ticket:id:531364168218501127058552:surplusGeneral",
"kylin:performances_inventory:ticket:id:531343372617850889210970:surplusGeneral",
"kylin:performances_inventory:ticket:id:531361117112360960735313:surplusGeneral",
"kylin:performances_inventory:ticket:id:531328816065863686149183:surplusGeneral",
"kylin:performances_inventory:ticket:id:531355494691430403704035:surplusGeneral",
"kylin:performances_inventory:ticket:id:531330738650931204381245:surplusGeneral",
"kylin:performances_inventory:ticket:id:531357532210667520852379:surplusGeneral",
"adam:info:certification_junk:1654123200303070024"
};
for (String key : keys) {
long value = key.hashCode();
......
......@@ -3,9 +3,11 @@ package com.liquidnet.service.kylin.dao;
import lombok.Data;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@Data
public class PerformancePartnerListDao {
public class PerformancePartnerListDao implements Cloneable {
//演出数据
private String performancesId;
......@@ -26,6 +28,16 @@ public class PerformancePartnerListDao {
private String timeStop;
private Integer payCountdownMinute;
private Integer auditStatus;
private List<String> permissionId;
private String rejectTxt;
private String createdAt;
private static final PerformancePartnerListDao obj = new PerformancePartnerListDao();
public static PerformancePartnerListDao getNew() {
try {
return (PerformancePartnerListDao) obj.clone();
} catch (CloneNotSupportedException e) {
return new PerformancePartnerListDao();
}
}
}
package com.liquidnet.service.merchant.util;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.kylin.dao.PerformancePartnerListDao;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerListParam;
import com.liquidnet.service.kylin.dto.param.PerformancePartnerVo;
import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketTimesVo;
import com.liquidnet.service.kylin.dto.vo.middle.KylinTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketPartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketTimesPartnerVo;
import com.liquidnet.service.merchant.constant.MerchantAuthorizationConst;
import com.liquidnet.service.merchant.dto.vo.MerchantAuthorizationPerformanceVo;
import com.liquidnet.service.merchant.dto.vo.MerchantAuthorizationPermissionsVo;
import com.mongodb.BasicDBObject;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.ReturnDocument;
......@@ -25,9 +31,11 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
@Component
public class MongoMerchantUtils {
......@@ -39,7 +47,7 @@ public class MongoMerchantUtils {
private RedisMerchantUtils redisMerchantUtils;
public PerformancePartnerVo getPerformancePartnerVo(String performanceId,String merchantId) {
public PerformancePartnerVo getPerformancePartnerVo(String performanceId, String merchantId) {
return mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performanceId).and("merchantId").is(merchantId)), PerformancePartnerVo.class, PerformancePartnerVo.class.getSimpleName());
}
......@@ -150,7 +158,7 @@ public class MongoMerchantUtils {
mongoTemplate.remove(Query.query(Criteria.where("ticketsId").is(ticketsId)), KylinTicketPartnerVo.class, KylinTicketPartnerVo.class.getSimpleName());
}
public boolean isExistsSubmitPerformancePartner(String performanceId,String merchantId) {
public boolean isExistsSubmitPerformancePartner(String performanceId, String merchantId) {
return mongoTemplate.exists(Query.query(Criteria.where("performancesId").is(performanceId).and("merchantId").is(merchantId).and("auditStatus").is(0)),
PerformancePartnerVo.class,
PerformancePartnerVo.class.getSimpleName());
......@@ -182,7 +190,7 @@ public class MongoMerchantUtils {
return mongoTemplate.remove(Query.query(Criteria.where("performancesId").is(performanceId)), KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
}
public KylinPerformanceVo getPerformanceVo(String performanceId,String merchantId) {
public KylinPerformanceVo getPerformanceVo(String performanceId, String merchantId) {
return mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performanceId).and("merchantId").is(merchantId)), KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
}
......@@ -211,38 +219,125 @@ public class MongoMerchantUtils {
if (performancePartnerListParam.getOrderSc().equals("asc")) {
orderBy = Sort.Direction.ASC;
}
//根据权限查询演出id
List<MerchantAuthorizationPerformanceVo> permissionVoList = mongoTemplate.find(Query.query(Criteria.where("uid").is(performancePartnerListParam.getMerchantId())
.and("deleteAt").is(null)
.and("permissionIds").in(
MerchantAuthorizationConst.PerformancePermission.READ.getId(),
MerchantAuthorizationConst.PerformancePermission.SALES.getId(),
MerchantAuthorizationConst.PerformancePermission.LINE.getId())
),
MerchantAuthorizationPerformanceVo.class, MerchantAuthorizationPerformanceVo.class.getSimpleName());
List<String> performanceIdList = permissionVoList.stream().map(MerchantAuthorizationPerformanceVo::getPerformanceId).collect(Collectors.toList());
// List<String> performanceIdList = new ArrayList<>();
// performanceIdList.add("393126530855854085960596");
// performanceIdList.add("324470932321198083852669");
// performanceIdList.add("324517967623741449058314");
//查询演出
Criteria criteria = Criteria.where("performancesId").in(performanceIdList);
// if (performancePartnerListParam.getTitle() != null && !performancePartnerListParam.getTitle().isEmpty()) {
// criteria = criteria.where("title").regex(".*" + performancePartnerListParam.getTitle() + ".*");
// }
// if (performancePartnerListParam.getSize() != null && !performancePartnerListParam.getTitle().isEmpty()) {
// criteria = criteria.where("title").regex(".*" + performancePartnerListParam.getTitle() + ".*");
// }
// if (performancePartnerListParam.getTimeStart() != null && !performancePartnerListParam.getTitle().isEmpty()) {
// criteria = criteria.where("title").regex(".*" + performancePartnerListParam.getTitle() + ".*");
// }
// if (performancePartnerListParam.getOrderType() != null && !performancePartnerListParam.getTitle().isEmpty()) {
// criteria = criteria.where("title").regex(".*" + performancePartnerListParam.getTitle() + ".*");
// }
// if (performancePartnerListParam.getStopSellDay() != -2 && !performancePartnerListParam.getTitle().isEmpty()) {
// criteria = criteria.where("title").regex(".*" + performancePartnerListParam.getTitle() + ".*");
// }
List<KylinPerformanceVo> performanceVos = mongoTemplate.find(
Query.query(criteria)
.with(Sort.by(orderBy, performancePartnerListParam.getOrderItem()))
.skip(((performancePartnerListParam.getPage() - 1) * performancePartnerListParam.getSize()))
.limit(performancePartnerListParam.getSize()),
KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
//查询销量
Aggregation aggregation = Aggregation.newAggregation(
Aggregation.project("performancesId", "title", "timeStart", "timeEnd", "timeSell", "timeStop", "totalGeneral", "saleGeneral", "totalSalePrice",
"surplusGeneral", "status", "type", "auditStatus", "rejectTxt", "createdAt","payCountdownMinute",
"ticketTimeList", "ticketList","appStatus",
"performanceId", "couponType", "transferStatus", "number", "refundNumber", "priceActual", "priceRefund"),
Aggregation.lookup(KylinOrderTicketVo.class.getSimpleName(),"performanceId","performancesId","o"),
Aggregation.match(Criteria.where("o.status").in(0, 1, 3, 6).and("o.couponType").is("no").and("o.transferStatus").in(0, 1, 2, 5)),
Aggregation.unwind("ticketTimeList"),
Aggregation.unwind("ticketTimeList.ticketList"),
Aggregation.group("performancesId").first("performancesId").as("performancesId")
.first("title").as("title")
.first("timeStart").as("timeStart")
.first("timeEnd").as("timeEnd")
.first("type").as("type")
.first("rejectTxt").as("rejectTxt")
.first("createdAt").as("createdAt")
.first("appStatus").as("status")
.first("auditStatus").as("auditStatus")
.first("payCountdownMinute").as("payCountdownMinute")
.min("ticketTimeList.ticketList.timeStart").as("timeSell")
.sum("totalGeneral").as("totalGeneral")
.sum("o.number").as("number")
.sum("o.refundNumber").as("refundNumber")
.sum("o.priceActual").as("priceActual")
.sum("o.priceRefund").as("priceRefund")
.max("ticketTimeList.ticketList.timeEnd").as("timeStop"),
Aggregation.skip((performancePartnerListParam.getPage() - 1) * performancePartnerListParam.getSize()),
Aggregation.limit(performancePartnerListParam.getSize()),
Aggregation.sort(orderBy,performancePartnerListParam.getOrderItem())
Aggregation.match(Criteria.where("status").in(0, 1, 3, 6).and("couponType").is("no").and("transferStatus").in(0, 1, 2, 5).and("performanceId").in(performanceIdList)),
Aggregation.group("performanceId")
.first("performanceId").as("performancesId")
.sum("number").as("number")
.sum("refundNumber").as("refundNumber")
.sum("priceActual").as("priceActual")
.sum("priceRefund").as("priceRefund")
);
AggregationResults<PerformancePartnerListDao> outputType = mongoTemplate.aggregate(aggregation, KylinPerformanceVo.class.getSimpleName(), PerformancePartnerListDao.class);
List<PerformancePartnerListDao> list = outputType.getMappedResults();
AggregationResults<PerformancePartnerListDao> outputType = mongoTemplate.aggregate(aggregation, KylinOrderTicketVo.class.getSimpleName(), PerformancePartnerListDao.class);
List<PerformancePartnerListDao> dataList = new ArrayList(outputType.getMappedResults());
List<PerformancePartnerListDao> list = new ArrayList();
for (KylinPerformanceVo item : performanceVos) {
boolean findData = false;
PerformancePartnerListDao dao = PerformancePartnerListDao.getNew();
dao.setPerformancesId(item.getPerformancesId());
dao.setTitle(item.getTitle());
dao.setTimeStart(item.getTimeStart());
dao.setTimeEnd(item.getTimeEnd());
dao.setStatus(item.getAppStatus());
dao.setType(item.getType());
dao.setPayCountdownMinute(item.getPayCountdownMinute());
dao.setAuditStatus(item.getAuditStatus());
dao.setRejectTxt(item.getRejectTxt());
dao.setCreatedAt(item.getCreatedAt());
int totalGeneral = 0;
String timeSell = null;
String timeStop = null;
for (KylinTicketTimesVo timeItem : item.getTicketTimeList()) {
for (KylinTicketVo ticketItem : timeItem.getTicketList()) {
if (timeSell == null) {
timeSell = ticketItem.getTimeStart();
} else if (DateUtil.compareStrDay(timeSell, ticketItem.getTimeStart()) > 0) {
timeSell = ticketItem.getTimeStart();
}
if (timeStop == null) {
timeStop = ticketItem.getTimeEnd();
} else if (DateUtil.compareStrDay(timeStop, ticketItem.getTimeEnd()) < 0) {
timeStop = ticketItem.getTimeEnd();
}
totalGeneral += ticketItem.getTotalGeneral();
}
}
dao.setTotalGeneral(totalGeneral);
dao.setTimeSell(timeSell);
dao.setTimeStop(timeStop);
for (MerchantAuthorizationPerformanceVo permission : permissionVoList) {
if (permission.getPerformanceId().equals(item.getPerformancesId())) {
dao.setPermissionId(permission.getPermissionIds());
permissionVoList.remove(permission);
break;
}
}
for (int i = 0; i < dataList.size(); i++) {
PerformancePartnerListDao data = dataList.get(i);
if (data.getPerformancesId().equals(item.getPerformancesId())) {
findData = true;
dao.setNumber(data.getNumber());
dao.setRefundNumber(data.getRefundNumber());
dao.setPriceActual(data.getPriceActual());
dao.setPriceRefund(data.getPriceRefund());
dataList.remove(i);
break;
}
}
if (!findData) {
dao.setNumber(0);
dao.setRefundNumber(0);
dao.setPriceActual(BigDecimal.ZERO);
dao.setPriceRefund(BigDecimal.ZERO);
}
list.add(dao);
}
return list;
}
}
......@@ -56,8 +56,12 @@
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.liquidnet</groupId>
<artifactId>liquidnet-service-merchant-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
......
......@@ -14,6 +14,8 @@ import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderListVo;
import com.liquidnet.service.kylin.entity.KylinBuyNotice;
import com.liquidnet.service.kylin.entity.KylinOrderCoupons;
import com.liquidnet.service.kylin.mapper.KylinBuyNoticeMapper;
import com.liquidnet.service.merchant.constant.MerchantRedisConst;
import com.liquidnet.service.merchant.dto.vo.MerchantFieldsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
......@@ -54,6 +56,17 @@ public class DataUtils {
return JsonUtils.toJson(data);
}
//获取场地redis
public MerchantFieldsVo getFieldVo(String fieldId) {
String key = MerchantRedisConst.INFO_FIELD.concat(fieldId);
MerchantFieldsVo vo = (MerchantFieldsVo) redisUtil.get(key);
if (null == vo) {
vo = mongoTemplate.findOne(Query.query(Criteria.where("fieldId").is(fieldId)), MerchantFieldsVo.class, MerchantFieldsVo.class.getSimpleName());
redisUtil.set(key, vo);
}
return vo;
}
/**
* 初始化普通库存
*
......
......@@ -11,6 +11,7 @@ import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderListVo;
import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.mapper.*;
import com.liquidnet.service.merchant.dto.vo.MerchantFieldsVo;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -39,8 +40,6 @@ public class MongoVoUtils {
@Autowired
private KylinTicketRelationsMapper ticketRelationsMapper;
@Autowired
private RedisUtil redisUtil;
@Autowired
private DataUtils dataUtils;
public KylinPerformanceVo combinePerformanceVoData(String performancesId) {
......@@ -53,12 +52,13 @@ public class MongoVoUtils {
KylinPerformanceRelations p3 = performanceRelationsMapper.selectOne(new UpdateWrapper<KylinPerformanceRelations>().eq("performance_id", performancesId));
//场地相关数据
KylinFields fields = new KylinFields();
String cityName = (String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name");
fields.setCityId(Integer.parseInt((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_id")));
fields.setLatitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "latitude"));
fields.setLongitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "longitude"));
fields.setCityName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name"));
fields.setName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "name"));
MerchantFieldsVo fieldsVo = dataUtils.getFieldVo(p3.getFieldId());
fields.setCityId(Integer.parseInt(fieldsVo.getCityId()));
fields.setLatitude(fieldsVo.getLatitude());
fields.setLongitude(fieldsVo.getLongitude());
fields.setCityName(fieldsVo.getCityName());
fields.setName(fieldsVo.getName());
//相关状态时间初始变量
LocalDateTime stopSellTime = null;
......@@ -156,7 +156,7 @@ public class MongoVoUtils {
voData.setPerformance(p1);
voData.setPerformanceStatus(p2);
voData.setPerformanceRelations(p3);
voData.setFieldsData(fields, cityName);
voData.setFieldsData(fields, fieldsVo.getCityName());
if (stopSellTime == null) {
stopSellTime = DateUtil.Formatter.yyyyMMddHHmmss.parse("2030-12-01 12:00:00");
}
......
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