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

Commit ab382d9f authored by 张国柄's avatar 张国柄

Merge remote-tracking branch 'origin/pre' into pre

parents 0a7a2955 e51facc0
......@@ -4,7 +4,6 @@ public class KylinRedisConst {
public static final String FIELDS = "kylin:fields:id";
public static final String PERFORMANCES = "kylin:performances:id:";
public static final String PERFORMANCES_TRUE_NAME = "kylin:performances_true_name:id:";
public static final String PERFORMANCES_LIST_CITYNAME = "kylin:performances:cityName:";
public static final String PERFORMANCES_LIST_CITY = "kylin:performances:city:";
public static final String PERFORMANCES_LIST_SYSTEM_RECOMMEND = "kylin:performances:systemRecommend";
public static final String PERFORMANCES_LIST_NOTICE = "kylin:performances:notice";
......
......@@ -221,7 +221,6 @@ public class DataUtils {
//删除redis
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES + performanceIds);
// 大龙相关 演出列表
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES_LIST_CITYNAME + vo.getCityName());
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES_LIST_CITY.concat(String.valueOf(vo.getCityId())));
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES_ROADLIST + vo.getRoadShowId());
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES_LIST_SYSTEM_RECOMMEND);
......
package com.liquidnet.service.kylin.controller;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
......@@ -15,11 +14,9 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.juli.logging.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......
package com.liquidnet.service.kylin.utils;
import com.fasterxml.jackson.databind.JsonNode;
import com.liquidnet.commons.lang.util.JsonUtils;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 读取城市
* </p>
*
* @author jiangxiulong
* @since 2022-01-06
*/
public class CityJsonUtils {
private static final Map<String, Integer> cityMap;
static {
cityMap = reload();
}
public static Map<String, Integer> reload() {
Map<String, Integer> cityMap = new HashMap<>();
String jsonStr = "";
Reader reader = null;
try {
reader = new InputStreamReader(CityJsonUtils.class.getClassLoader().getResourceAsStream("city_2021.json"));
int ch = 0;
StringBuffer sb = new StringBuffer();
while ((ch = reader.read()) != -1) {
sb.append((char) ch);
}
jsonStr = sb.toString();
} catch (IOException e) {
} finally {
if (null != reader) {
try {
reader.close();
} catch (IOException e) {
}
}
}
JsonNode jsonNode = JsonUtils.fromJson(jsonStr, JsonNode.class);
String name = "name", adcode = "adcode";
for (JsonNode node : jsonNode) {
cityMap.put(node.get(name).asText(), node.get(adcode).asInt());
}
return cityMap;
}
public static Integer get(String cityName) {
return cityMap.get(cityName);
}
public static void main(String[] args) {
Integer integer = CityJsonUtils.get("新竹市");
System.out.println(integer);
}
}
\ No newline at end of file
......@@ -295,24 +295,20 @@ public class DataUtils {
* @param cityName
*/
public List<KylinPerformanceVo> getPerformancesListOfcityNameOradCode(String cityName, Integer adCode) {
String redisKey = "";
if (cityName.isEmpty()) {
redisKey = KylinRedisConst.PERFORMANCES_LIST_CITY.concat(String.valueOf(adCode));
} else {
redisKey = KylinRedisConst.PERFORMANCES_LIST_CITYNAME.concat(cityName);
if (!cityName.isEmpty()) {
if (!cityName.endsWith("州") && !cityName.endsWith("县") && !cityName.endsWith("区") && !cityName.endsWith("市")) {
cityName = cityName.concat("市");
}
adCode = CityJsonUtils.get(cityName);
}
String redisKey = KylinRedisConst.PERFORMANCES_LIST_CITY.concat(String.valueOf(adCode));
Object object = redisUtil.get(redisKey);
if (object == null) {
// 固定查询条件
Query query = getCommonWhere();
// 其他条件
if (cityName.isEmpty()) {
query.addCriteria(Criteria.where("cityId").is(adCode));
} else {
Pattern cityNameCompile = Pattern.compile("^.*" + cityName + ".*$", Pattern.CASE_INSENSITIVE);
query.addCriteria(Criteria.where("cityName").regex(cityNameCompile));
}
// 排序
Sort sortName = Sort.by(Sort.Direction.ASC, "timeStart");
query.with(sortName);
......@@ -740,6 +736,7 @@ public class DataUtils {
return orderRefundPoundageArrayList;
}
}
// 获取手续费ALL说明
public OrderRefundPoundageAll getRefundPoundageAll(Integer isRefundPoundage) {
ArrayList<OrderRefundPoundage> refundPoundage = getRefundPoundage(isRefundPoundage);
......@@ -829,6 +826,7 @@ public class DataUtils {
/**
* 获取已经退了的快递费
*
* @return
*/
public BigDecimal getCanRefundPriceExpress(List<KylinOrderRefundsVo> kylinOrderRefundsVoBaseList) {
......
......@@ -68,14 +68,14 @@ public class DataImpl {
DMTAuthorizationRecordsService dmtAuthorizationRecordsService;
private static final String SQL_URL = "jdbc:mysql://39.107.71.112:3308/test_ln_scene";
private static final String SQL_USER = "testmall";
private static final String SQL_PWD = "zhengzai!mYT";
private static final String PHP_DB = "testmall";
// private static final String SQL_URL = "jdbc:mysql://zhengzairead.rwlb.rds.aliyuncs.com:3306/prod_ln_scene";
// private static final String SQL_USER = "readonly";
// private static final String SQL_PWD = "ZWDsf8Fy";
// private static final String PHP_DB = "mall";
// private static final String SQL_URL = "jdbc:mysql://39.107.71.112:3308/test_ln_scene";
// private static final String SQL_USER = "testmall";
// private static final String SQL_PWD = "zhengzai!mYT";
// private static final String PHP_DB = "testmall";
private static final String SQL_URL = "jdbc:mysql://zhengzairead.rwlb.rds.aliyuncs.com:3306/prod_ln_scene";
private static final String SQL_USER = "readonly";
private static final String SQL_PWD = "ZWDsf8Fy";
private static final String PHP_DB = "mall";
//迁移场地和场地认领关系
public void fieldData() {
try {
......
......@@ -252,7 +252,6 @@ public class DataUtils {
//删除redis
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES + performanceIds);
// 大龙相关 演出列表
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES_LIST_CITYNAME + vo.getCityName());
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES_LIST_CITY.concat(String.valueOf(vo.getCityId())));
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES_ROADLIST + vo.getRoadShowId());
redisDataSourceUtil.getRedisKylinUtil().del(KylinRedisConst.PERFORMANCES_LIST_SYSTEM_RECOMMEND);
......
......@@ -21,7 +21,6 @@ db.SlimeFieldAppliesVo.createIndex({uid:"hashed"});
db.SlimeFieldCheckersVo.createIndex({fieldCheckerId:"hashed"});
db.SlimeFieldCheckersVo.createIndex({fieldId:"hashed"});
db.SlimeFieldCheckersVo.createIndex({uid:"hashed"});
db.SlimeSponsorsVo.createIndex({sponsorId:"hashed"});
db.SlimeSponsorsVo.createIndex({isOnline:"hashed"});
db.SlimeSponsorsVo.createIndex({uid:"hashed"});
......@@ -29,13 +28,27 @@ db.SlimeSponsorsVo.createIndex({companyId:"hashed"});
db.SlimeSponsorAppliesVo.createIndex({sponsorApplyId:"hashed"});
db.SlimeSponsorAppliesVo.createIndex({sponsorId:"hashed"});
db.SlimeSponsorAppliesVo.createIndex({uid:"hashed"});
db.SlimeAuthorizationRecordsVo.createIndex({authorizationRecordId:"hashed"});
db.SlimeAuthorizationRecordsVo.createIndex({performanceId:"hashed"});
db.SlimeAuthorizationRecordsVo.createIndex({uidRole:"hashed"});
db.SlimeAuthorizationRecordsVo.createIndex({uid:"hashed"});
db.SlimeAuthorizationRecordsVo.createIndex({cuidRole:"hashed"});
db.SlimeAuthorizationRecordsVo.createIndex({cuid:"hashed"});
db.SlimeAuthorizationPerformanceVo.createIndex({performanceId:"hashed"});
db.SlimeAuthorizationPerformanceVo.createIndex({uid:"hashed"});
db.KylinPerformanceVo.createIndex({merchantId:"hashed"});
db.KylinOrderTicketVo.createIndex({status:"hashed"});
db.KylinOrderTicketVo.createIndex({transferStatus:"hashed"});
#创建分片
sh.enableSharding("prod_ln_scene");
sh.shardCollection("prod_ln_scene.SlimeFieldsVo",{"fieldId":"hashed"});
sh.shardCollection("prod_ln_scene.SlimeFieldAppliesVo",{"fieldApplyId":"hashed"});
sh.shardCollection("prod_ln_scene.SlimeFieldCheckersVo",{"fieldCheckId":"hashed"});
sh.shardCollection("prod_ln_scene.SlimeSponsorsVo",{"sponsorId":"hashed"});
sh.shardCollection("prod_ln_scene.SlimeSponsorAppliesVo",{"sponsorApplyId":"hashed"});
sh.shardCollection("prod_ln_scene.SlimeAuthorizationRecordsVo",{"authorizationRecordId":"hashed"});
sh.shardCollection("prod_ln_scene.SlimeAuthorizationPerformanceVo",{"performanceId":"hashed"});
......@@ -19,6 +19,7 @@ import com.liquidnet.service.slime.service.SlimeRdmService;
import com.mongodb.BasicDBObject;
import com.mongodb.client.model.FindOneAndUpdateOptions;
import com.mongodb.client.model.ReturnDocument;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
......@@ -37,6 +38,7 @@ import java.util.List;
import java.util.stream.Collectors;
@Component
@Slf4j
public class MongoSlimeUtils {
@Autowired
private MongoTemplate mongoTemplate;
......@@ -47,6 +49,14 @@ public class MongoSlimeUtils {
@Autowired
private SlimeRdmService slimeRdmService;
private List<String> initPerList = new ArrayList<String>() {{
add(SlimeAuthorizationConst.PerformancePermission.READ.getId());
add(SlimeAuthorizationConst.PerformancePermission.EDIT.getId());
add(SlimeAuthorizationConst.PerformancePermission.LINE.getId());
add(SlimeAuthorizationConst.PerformancePermission.SALES.getId());
add(SlimeAuthorizationConst.PerformancePermission.CHECK.getId());
add(SlimeAuthorizationConst.PerformancePermission.GRANT.getId());
}};
public PerformancePartnerVo getPerformancePartnerVo(String performanceId) {
return mongoTemplate.findOne(Query.query(Criteria.where("performancesId").is(performanceId)), PerformancePartnerVo.class, PerformancePartnerVo.class.getSimpleName());
......@@ -256,14 +266,14 @@ public class MongoSlimeUtils {
return docTicket;
}
public HashMap<String,Object> getPerformanceList(PerformancePartnerListParam performancePartnerListParam) {
public HashMap<String, Object> getPerformanceList(PerformancePartnerListParam performancePartnerListParam) {
performancePartnerListParam.setOrderType(performancePartnerListParam.getOrderType());
//分页排序
Sort.Direction orderBy = Sort.Direction.DESC;
if (performancePartnerListParam.getOrderSc().equals("asc")) {
orderBy = Sort.Direction.ASC;
}
long currentTime = System.currentTimeMillis();
List<String> performanceIdList = null;
List<SlimeAuthorizationPerformanceVo> permissionVoList = ObjectUtil.getPermissionVoList();
if (!redisSlimeUtils.superAccount(performancePartnerListParam.getMerchantId())) {
......@@ -280,6 +290,8 @@ public class MongoSlimeUtils {
SlimeAuthorizationPerformanceVo.class, SlimeAuthorizationPerformanceVo.class.getSimpleName());
performanceIdList = permissionVoList.stream().map(SlimeAuthorizationPerformanceVo::getPerformanceId).collect(Collectors.toList());
}
log.debug("TIME 1= " + (System.currentTimeMillis() - currentTime));
currentTime = System.currentTimeMillis();
//查询演出
Criteria criteriaPerformanceId = performanceIdList == null ? Criteria.where("performancesId").ne(null) : Criteria.where("performancesId").in(performanceIdList);
Criteria criteria = Criteria.where("performancesId").ne(null);
......@@ -304,12 +316,16 @@ public class MongoSlimeUtils {
.skip(((performancePartnerListParam.getPage() - 1) * performancePartnerListParam.getSize()))
.limit(performancePartnerListParam.getSize()),
KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
log.debug("TIME 2= " + (System.currentTimeMillis() - currentTime));
currentTime = System.currentTimeMillis();
long total = mongoTemplate.count(
Query.query(new Criteria().andOperator(criteria).orOperator(criteriaPerformanceId, Criteria.where("merchantId").is(performancePartnerListParam.getMerchantId())))
.with(Sort.by(orderBy, performancePartnerListParam.getOrderItem())),
KylinPerformanceVo.class, KylinPerformanceVo.class.getSimpleName());
log.debug("TIME 3= " + (System.currentTimeMillis() - currentTime));
currentTime = System.currentTimeMillis();
//查询销量
performanceIdList = performanceVos.stream().map(KylinPerformanceVo::getPerformancesId).collect(Collectors.toList());
Aggregation aggregation = Aggregation.newAggregation(
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")
......@@ -321,8 +337,12 @@ public class MongoSlimeUtils {
);
AggregationResults<PerformancePartnerListDao> outputType = mongoTemplate.aggregate(aggregation, KylinOrderTicketVo.class.getSimpleName(), PerformancePartnerListDao.class);
log.debug("TIME 4= " + (System.currentTimeMillis() - currentTime));
currentTime = System.currentTimeMillis();
List<PerformancePartnerListDao> dataList = new ArrayList(outputType.getMappedResults());
List<PerformancePartnerListDao> list = ObjectUtil.getPerformancePartnerListDaoArrayList();
boolean isSuperAccount = redisSlimeUtils.superAccount(performancePartnerListParam.getMerchantId());
for (KylinPerformanceVo item : performanceVos) {
boolean findData = false;
PerformancePartnerListDao dao = PerformancePartnerListDao.getNew();
......@@ -359,27 +379,13 @@ public class MongoSlimeUtils {
dao.setTimeSell(timeSell);
dao.setTimeStop(timeStop);
if (item.getMerchantId().equals(performancePartnerListParam.getMerchantId()) || redisSlimeUtils.superAccount(performancePartnerListParam.getMerchantId())) {
dao.setPermissionId(new ArrayList<String>() {{
add(SlimeAuthorizationConst.PerformancePermission.READ.getId());
add(SlimeAuthorizationConst.PerformancePermission.EDIT.getId());
add(SlimeAuthorizationConst.PerformancePermission.LINE.getId());
add(SlimeAuthorizationConst.PerformancePermission.SALES.getId());
add(SlimeAuthorizationConst.PerformancePermission.CHECK.getId());
add(SlimeAuthorizationConst.PerformancePermission.GRANT.getId());
}});
if (item.getMerchantId().equals(performancePartnerListParam.getMerchantId()) || isSuperAccount) {
dao.setPermissionId(initPerList);
}
for (SlimeAuthorizationPerformanceVo permission : permissionVoList) {
if (item.getMerchantId().equals(performancePartnerListParam.getMerchantId()) || redisSlimeUtils.superAccount(performancePartnerListParam.getMerchantId())) {
dao.setPermissionId(new ArrayList<String>() {{
add(SlimeAuthorizationConst.PerformancePermission.READ.getId());
add(SlimeAuthorizationConst.PerformancePermission.EDIT.getId());
add(SlimeAuthorizationConst.PerformancePermission.LINE.getId());
add(SlimeAuthorizationConst.PerformancePermission.SALES.getId());
add(SlimeAuthorizationConst.PerformancePermission.CHECK.getId());
add(SlimeAuthorizationConst.PerformancePermission.GRANT.getId());
}});
if (item.getMerchantId().equals(performancePartnerListParam.getMerchantId()) || isSuperAccount) {
dao.setPermissionId(initPerList);
break;
}
if (permission.getPerformanceId().equals(item.getPerformancesId())) {
......@@ -410,9 +416,10 @@ public class MongoSlimeUtils {
}
list.add(dao);
}
HashMap<String ,Object> map = CollectionUtil.mapStringObject();
map.put("data",list);
map.put("total",total);
log.debug("TIME 5= " + (System.currentTimeMillis() - currentTime));
HashMap<String, Object> map = CollectionUtil.mapStringObject();
map.put("data", list);
map.put("total", total);
return map;
}
......
......@@ -235,7 +235,6 @@ public class RedisSlimeUtils {
//删除redis
redisUtil.del(KylinRedisConst.PERFORMANCES + performanceIds);
// 大龙相关 演出列表
redisUtil.del(KylinRedisConst.PERFORMANCES_LIST_CITYNAME + vo.getCityName());
redisUtil.del(KylinRedisConst.PERFORMANCES_LIST_CITY.concat(String.valueOf(vo.getCityId())));
redisUtil.del(KylinRedisConst.PERFORMANCES_ROADLIST + vo.getRoadShowId());
redisUtil.del(KylinRedisConst.PERFORMANCES_LIST_SYSTEM_RECOMMEND);
......
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