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

Commit 498725f8 authored by jiangxiulong's avatar jiangxiulong

cityName 获取 adCode

parent 55500c8e
......@@ -206,7 +206,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
......@@ -294,24 +294,19 @@ 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("市")) {
adCode = CityJsonUtils.get(cityName.concat("市"));
}
}
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));
}
query.addCriteria(Criteria.where("cityId").is(adCode));
// 排序
Sort sortName = Sort.by(Sort.Direction.ASC, "timeStart");
query.with(sortName);
......@@ -739,6 +734,7 @@ public class DataUtils {
return orderRefundPoundageArrayList;
}
}
// 获取手续费ALL说明
public OrderRefundPoundageAll getRefundPoundageAll(Integer isRefundPoundage) {
ArrayList<OrderRefundPoundage> refundPoundage = getRefundPoundage(isRefundPoundage);
......@@ -775,12 +771,12 @@ public class DataUtils {
// if (getTicketType.equals("express")) { // 快递票
// return null;
// } else { // 电子票
Object obj = redisUtil.get(KylinRedisConst.ORDER_REFUND_ADDRESS);
if (obj == null) {
return null;
} else {
return (OrderRefundAddress) obj;
}
Object obj = redisUtil.get(KylinRedisConst.ORDER_REFUND_ADDRESS);
if (obj == null) {
return null;
} else {
return (OrderRefundAddress) obj;
}
// }
}
......@@ -799,12 +795,12 @@ public class DataUtils {
// List<KylinIpAreaVo> data = mongoTemplate.find(Query.query(Criteria.where("ipBeginLong").lte(IPUtil.ipToLong(ipAddress))
// .and("ipEndLong").gte(IPUtil.ipToLong(ipAddress))), KylinIpAreaVo.class, KylinIpAreaVo.class.getSimpleName());
// if(data==null || data.size()==0){
KylinIpAreaVo data0 = KylinIpAreaVo.getNew();
data0.setArea("未知");
data0.setCity("未知");
data0.setCounty("未知");
data0.setProvince("未知");
return data0;
KylinIpAreaVo data0 = KylinIpAreaVo.getNew();
data0.setArea("未知");
data0.setCity("未知");
data0.setCounty("未知");
data0.setProvince("未知");
return data0;
// }else{
// return data.get(0);
// }
......@@ -812,6 +808,7 @@ public class DataUtils {
/**
* 获取已经退了的快递费
*
* @return
*/
public BigDecimal getCanRefundPriceExpress(List<KylinOrderRefundsVo> kylinOrderRefundsVoBaseList) {
......
......@@ -238,7 +238,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);
......
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