Преглед изворни кода

修改到docker外运行环境

tags/v1.0.0^2
林万龙 пре 3 година
родитељ
комит
1332fa7156
6 измењених фајлова са 33 додато и 27 уклоњено
  1. +1
    -1
      src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java
  2. +15
    -15
      src/main/java/com/telpo/dipperposition/mapper/IPProvinceMapper.java
  3. +2
    -2
      src/main/java/com/telpo/dipperposition/service/IPProvinceService.java
  4. +3
    -3
      src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java
  5. +6
    -0
      src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java
  6. +6
    -6
      src/main/java/com/telpo/dipperposition/service/impl/IPProvinceServiceImpl.java

+ 1
- 1
src/main/java/com/telpo/dipperposition/handler/NettyServerHandler.java Прегледај датотеку

@@ -123,7 +123,7 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
// if (Integer.parseInt(posAsycServerPort) == channel.localAddress().getPort()) {

//if (AST_POS_CMD.equals(recvmg)) {
if (AST_TIME_CMD.equals(msg)) {
if (AST_POS_CMD.equals(msg)) {
// channelAns = dipperAstPosAsyncTaskService.pushAstPos(ipAddress,
// positionConfig.getCenterProvinceFilePath(),
// positionConfig.getCenterProvince(),


+ 15
- 15
src/main/java/com/telpo/dipperposition/mapper/IPProvinceMapper.java Прегледај датотеку

@@ -21,16 +21,19 @@ public class IPProvinceMapper extends BaseMongoDbDao<IPProvinceEntity> {
return IPProvinceEntity.class;
}

@Override
@MongoSwitch("common")
public void save(IPProvinceEntity entity, String collectionName) {
super.save(entity, collectionName);
public void saveIp(IPProvinceEntity entity) {
this.save(entity);
}

@MongoSwitch("common")
public void saveIp(IPProvinceEntity entity, String collectionName) {
this.save(entity, collectionName);
}

@Override
@MongoSwitch("common")
public void updateFirst(IPProvinceEntity srcObj, IPProvinceEntity targetObj) {
super.updateFirst(srcObj, targetObj);
public void updateIpFirst(IPProvinceEntity srcObj, IPProvinceEntity targetObj) {
this.updateFirst(srcObj, targetObj);
}

@Override
@@ -38,21 +41,18 @@ public class IPProvinceMapper extends BaseMongoDbDao<IPProvinceEntity> {
return super.getPage(object, start, size);
}

@Override
@MongoSwitch("common")
public List<IPProvinceEntity> queryList(IPProvinceEntity object) {
return super.queryList(object);
public List<IPProvinceEntity> queryIpList(IPProvinceEntity object) {
return this.queryList(object);
}

@Override
@MongoSwitch("common")
public List<IPProvinceEntity> queryList(IPProvinceEntity object, String collectionName) {
return super.queryList(object, collectionName);
public List<IPProvinceEntity> queryIpList(IPProvinceEntity object, String collectionName) {
return this.queryList(object, collectionName);
}

@Override
@MongoSwitch("common")
public void deleteById(String id) {
super.deleteById(id);
public void deleteIpById(String id) {
this.deleteById(id);
}
}

+ 2
- 2
src/main/java/com/telpo/dipperposition/service/IPProvinceService.java Прегледај датотеку

@@ -17,7 +17,7 @@ public interface IPProvinceService {
* @param entity
* @return
*/
boolean saveIPProvince(IPProvinceEntity entity);
boolean saveIpProvince(IPProvinceEntity entity);

/**
* 更新IP省份
@@ -41,5 +41,5 @@ public interface IPProvinceService {
* @param ipAddress
* 获取IP省份
*/
IPProvinceEntity getIPProvince(String ipAddress);
IPProvinceEntity getIpProvince(String ipAddress);
}

+ 3
- 3
src/main/java/com/telpo/dipperposition/service/impl/DipperAstPosAsyncTaskServiceImpl.java Прегледај датотеку

@@ -98,7 +98,7 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS
if(iPProvinceService == null) {
iPProvinceService = new IPProvinceServiceImpl();
}
IPProvinceEntity ipProvinceEntity = iPProvinceService.getIPProvince(ipAddress);
IPProvinceEntity ipProvinceEntity = iPProvinceService.getIpProvince(ipAddress);
if (ipProvinceEntity == null) {
// 匹配不到,再请求高德IP定位服务。
JSONObject userObj = new JSONObject();
@@ -131,12 +131,12 @@ public class DipperAstPosAsyncTaskServiceImpl implements IDipperAstPosAsyncTaskS
if(iPProvinceService == null) {
iPProvinceService = new IPProvinceServiceImpl();
}
IPProvinceEntity ipProvinceEntity = iPProvinceService.getIPProvince(ipAddress);
IPProvinceEntity ipProvinceEntity = iPProvinceService.getIpProvince(ipAddress);
if (ipProvinceEntity == null) {
//DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
ipProvinceEntity.setIp(ipAddress);
ipProvinceEntity.setProvince(province);
iPProvinceService.saveIPProvince(ipProvinceEntity);
iPProvinceService.saveIpProvince(ipProvinceEntity);
// } else {
//
// ipProvinceEntity.setProvince(province);


+ 6
- 0
src/main/java/com/telpo/dipperposition/service/impl/DipperDataAsyncTaskServiceImpl.java Прегледај датотеку

@@ -39,6 +39,9 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi
log.error("获取星历数据错误,取不到星历数据。");
} else {
// 保存到DB或者缓存
if (redisUtil == null) {
redisUtil = new RedisUtil();
}
redisUtil.set(DIPPER_DATA_KEY,dipperData);
}
}
@@ -63,6 +66,9 @@ public class DipperDataAsyncTaskServiceImpl implements IDipperDataAsyncTaskServi
@Override
@Async("asyncServiceExecutor")
public String getAstEPH(){
if (redisUtil == null) {
redisUtil = new RedisUtil();
}
return (String)redisUtil.get(DIPPER_DATA_KEY);
}
}

+ 6
- 6
src/main/java/com/telpo/dipperposition/service/impl/IPProvinceServiceImpl.java Прегледај датотеку

@@ -25,11 +25,11 @@ public class IPProvinceServiceImpl implements IPProvinceService {
private IPProvinceMapper iPProvinceMapper;

@Override
public boolean saveIPProvince(IPProvinceEntity entity) {
public boolean saveIpProvince(IPProvinceEntity entity) {
if (iPProvinceMapper == null) {
iPProvinceMapper = new IPProvinceMapper();
}
iPProvinceMapper.save(entity);
iPProvinceMapper.saveIp(entity);
return true;
}

@@ -39,7 +39,7 @@ public class IPProvinceServiceImpl implements IPProvinceService {
if (iPProvinceMapper == null) {
iPProvinceMapper = new IPProvinceMapper();
}
iPProvinceMapper.updateFirst(query, update);
iPProvinceMapper.updateIpFirst(query, update);
return true;
}

@@ -48,19 +48,19 @@ public class IPProvinceServiceImpl implements IPProvinceService {
if (iPProvinceMapper == null) {
iPProvinceMapper = new IPProvinceMapper();
}
iPProvinceMapper.deleteById(id);
iPProvinceMapper.deleteIpById(id);
return false;
}

@Override
public IPProvinceEntity getIPProvince(String ipAddress) {
public IPProvinceEntity getIpProvince(String ipAddress) {
try {
IPProvinceEntity query = new IPProvinceEntity();
query.setIp(ipAddress);
if (iPProvinceMapper == null) {
iPProvinceMapper = new IPProvinceMapper();
}
List<IPProvinceEntity> pushRecords = iPProvinceMapper.queryList(query);
List<IPProvinceEntity> pushRecords = iPProvinceMapper.queryIpList(query);
if (ObjectUtils.isNotEmpty(pushRecords)) {
return pushRecords.get(0);
} else {


Loading…
Откажи
Сачувај