e>
1
package com.ai.bss.mock.repository;
2
3
import com.ai.bss.mock.model.MockScenarioData;
4
import org.springframework.data.jpa.repository.JpaRepository;
5
import org.springframework.data.jpa.repository.Modifying;
6
import org.springframework.data.jpa.repository.Query;
7
import org.springframework.data.repository.query.Param;
8
import org.springframework.stereotype.Repository;
9
10
import java.io.Serializable;
11
import java.util.List;
12
13
@Repository
14
public interface MockScenarioDataRepository extends JpaRepository<MockScenarioData, Serializable> {
15
16
    List<MockScenarioData> findByScenarioIdOrderByOrderNo(Long scenarioId);
17
18
    @Modifying
19
    @Query(value = "select DISTINCT order_no from mock_scenario_data where scenario_id = :scenarioId order by order_no\n", nativeQuery = true)
20
    List<Long> findByOrderNoByScenarioId(@Param("scenarioId") Long scenarioId);
21
22
}

+ 111 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/service/impl/MockManageServiceImpl.java

1
package com.ai.bss.mock.service.impl;
2
3
import java.sql.Timestamp;
4
import java.util.ArrayList;
5
import java.util.HashMap;
6
import java.util.List;
7
import java.util.Map;
8
9
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.stereotype.Service;
11
import org.springframework.util.CollectionUtils;
12
13
import com.ai.bss.mock.model.LocationBean;
14
import com.ai.bss.mock.model.MockScenarioData;
15
import com.ai.bss.mock.repository.MockScenarioDataRepository;
16
import com.ai.bss.mock.service.interfaces.MockManageService;
17
import com.ai.bss.mock.service.interfaces.MockProcess;
18
19
import lombok.extern.slf4j.Slf4j;
20
21
@Slf4j
22
@Service
23
public class MockManageServiceImpl implements MockManageService {
24
25
	protected static Map MACK_STATUS = new HashMap();
26
	
27
    @Autowired
28
    private MockScenarioDataRepository mockScenarioDataRepository;
29
    @Autowired
30
    private MockProcess mockProcess;
31
32
//    @Value("${kafka.producer.servers:Empty}")
33
    private static String kafkaServers = "47.105.160.21:9090";
34
35
    @Override
36
    public Map findMockStatusByScenarioId()  {
37
        List<Long> result = new ArrayList(MACK_STATUS.keySet());
38
        Map  tempmap = new HashMap();
39
        for(Long sid:result){
40
            tempmap.put(sid,"场景 "+sid+" 执行中...");
41
        }
42
        return tempmap;
43
    }
44
    @Override
45
    public String  startMackData(Long sId,  Long frequency,String topic0,String topic1)  {
46
        //        验证场景是否正在执行
47
        if(MACK_STATUS.get(sId)!=null){
48
            return "场景" + sId + " 正在执行,请耐心等待...";
49
        }
50
        //根据场景ID从数据库中查询模拟数据
51
        List<MockScenarioData>  mockScenarioDataList = mockScenarioDataRepository.findByScenarioIdOrderByOrderNo(sId);
52
53
        List<Long> orderNoList = mockScenarioDataRepository.findByOrderNoByScenarioId(sId);
54
        if(CollectionUtils.isEmpty(mockScenarioDataList) || CollectionUtils.isEmpty(orderNoList)){
55
            return "场景" + sId + " 没有配置模拟 ,请在数据库中添加数据再执行...";
56
        }
57
        
58
        //记录场景执行状态
59
        MACK_STATUS.put(sId,frequency);
60
        //异步执行模拟场景 通过IOT-DMP连接服务模拟
61
//        mockProcess.processMock(sId,mockScenarioDataList,frequency);
62
63
        Map<Long, List<LocationBean>> dataMap=getMapListData(mockScenarioDataList);
64
        
65
        //异步执行模拟场景  直接模拟最终数据发送到kafka
66
        mockProcess.processMockKafka(sId,dataMap,orderNoList,frequency,topic0, topic1);
67
68
        return "场景" + sId + " 开始执行...";
69
    }
70
71
72
    @Override
73
    public String  stopMackData(Long sId){
74
        MACK_STATUS.remove(sId);
75
        return "场景" + sId + " 终止执行...";
76
    }
77
78
    /**
79
          * 按orderNo分组
80
     * @param mockScenarioDataList
81
     * @return
82
     */
83
    private Map<Long, List<LocationBean>> getMapListData(List<MockScenarioData> mockScenarioDataList) {
84
    	Map<Long, List<LocationBean>> map=new HashMap<Long, List<LocationBean>>();
85
    	
86
    	for (MockScenarioData mockScenarioData : mockScenarioDataList) {
87
    		LocationBean locationBean=new LocationBean();
88
        	locationBean.setFloor(1);
89
        	locationBean.setMac(mockScenarioData.getDeviceId());
90
        	locationBean.setxAxis(Double.valueOf(mockScenarioData.getLongitude()));
91
        	locationBean.setyAxis(Double.valueOf(mockScenarioData.getLatitude()));
92
        	locationBean.setzAxis(0d);
93
        	locationBean.setTimeStamp(new Timestamp(System.currentTimeMillis()));
94
    		
95
        	
96
    		long orderNo=mockScenarioData.getOrderNo();
97
    		
98
    		List<LocationBean> list=map.get(orderNo);
99
    		if (list==null) {
100
    			list=new ArrayList<LocationBean>();
101
    			list.add(locationBean);
102
    			map.put(orderNo, list);
103
			}else {
104
				list.add(locationBean);
105
			}
106
		}
107
    	
108
    	return map;
109
    }
110
    
111
}

+ 136 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/service/impl/MockProcessImpl.java

1
package com.ai.bss.mock.service.impl;
2
3
import java.sql.Timestamp;
4
import java.util.ArrayList;
5
import java.util.Date;
6
import java.util.HashMap;
7
import java.util.List;
8
import java.util.Map;
9
import java.util.concurrent.ExecutorService;
10
import java.util.concurrent.Executors;
11
import java.util.concurrent.TimeUnit;
12
13
import org.slf4j.Logger;
14
import org.slf4j.LoggerFactory;
15
import org.springframework.beans.factory.annotation.Value;
16
import org.springframework.kafka.core.KafkaTemplate;
17
import org.springframework.scheduling.annotation.Async;
18
import org.springframework.stereotype.Service;
19
import org.springframework.util.StringUtils;
20
21
import com.ai.bss.mock.model.Data;
22
import com.ai.bss.mock.model.DataPoint;
23
import com.ai.bss.mock.model.EBCData;
24
import com.ai.bss.mock.model.LocationBean;
25
import com.ai.bss.mock.model.MockScenarioData;
26
import com.ai.bss.mock.service.interfaces.MockProcess;
27
import com.ai.bss.mock.utils.KafkaProducerConfig;
28
import com.ai.bss.mock.utils.tcp.IpuTcpLongConnectClient;
29
import com.ailk.common.data.impl.DataMap;
30
import com.alibaba.fastjson.JSON;
31
import com.alibaba.fastjson.JSONObject;
32
33
import lombok.extern.slf4j.Slf4j;
34
35
36
@Slf4j
37
@Service
38
public class MockProcessImpl implements MockProcess {
39
	private static final Logger logger = LoggerFactory.getLogger(MockProcessImpl.class);
40
41
//    EBC设备tcp连接服务地址
42
    private static final String HOST = "47.105.130.83";
43
    private static final int PORT = 8042;
44
45
    private static String kafkaServers = "47.105.160.21:9091";
46
47
    @Value("${kafka.producer.servers}")
48
    private static String servers;
49
    
50
    @Value("${kafka.producer.topic}")
51
    private String topic;
52
53
    @Async
54
    @Override
55
    public void processMock(Long sId,List<MockScenarioData> mockScenarioDataList, Long frequency){
56
        try {
57
            IpuTcpLongConnectClient.getInstance(HOST, PORT).sendMockData(sId,mockScenarioDataList, frequency);
58
59
            MockManageServiceImpl.MACK_STATUS.remove(sId);
60
        }catch (Exception e){
61
        	logger.error("processMock is error:"+e.getMessage());
62
            //e.printStackTrace();
63
        }
64
    }
65
66
    //线程池
67
    private ExecutorService cachedThreadPool = Executors.newCachedThreadPool();
68
    
69
    @Async
70
    @Override
71
    public void processMockKafka(Long sId,Map<Long, List<LocationBean>> dataMap,List<Long> orderNoList, Long frequency,String topic0,String topic1){
72
    	String clientId="XBG_AC67B2C23CFC";
73
		String userName="abc";
74
		topic="uploadInfoTest";
75
		
76
    	try {
77
            for (Long orderNo : orderNoList) {
78
            	List<LocationBean> dataList=dataMap.get(orderNo);
79
            	
80
            	for (LocationBean locationBean : dataList) {
81
            		cachedThreadPool.execute(new Runnable() {
82
            			@Override
83
            			public void run() {
84
            				String msg=JSON.toJSONString(locationBean);
85
                   		 
86
                    		System.out.println("推送消息:"+msg);
87
                    		 
88
                        	sendKafkaDataPoint(clientId, userName, topic, msg);
89
            			}
90
            		});
91
				}
92
93
                TimeUnit.MILLISECONDS.sleep(frequency * 1000);
94
            }
95
96
97
            MockManageServiceImpl.MACK_STATUS.remove(sId);
98
        }catch (Exception e){
99
        	logger.error("processMockKafka is error:"+e.getMessage());
100
        }
101
    }
102
103
    private Map<String, KafkaTemplate> kafkaTemplateMap = new HashMap<>();
104
105
    private void sendKafkaDataPoint(String deviceId, String userName, String topic, String msg) {
106
		KafkaTemplate kafkaTemplate = kafkaTemplateMap.get(kafkaServers);
107
		if (kafkaTemplate == null) {
108
			// new 实例
109
			KafkaProducerConfig kafkaProducerConfig = new KafkaProducerConfig(kafkaServers);
110
			kafkaTemplate = kafkaProducerConfig.kafkaTemplate();
111
			kafkaTemplateMap.put(kafkaServers, kafkaTemplate);
112
		}
113
		
114
		if (kafkaTemplate == null) {
115
			log.error("kafkaTemplate is null");
116
			return;
117
		}
118
		
119
		DataMap dataMap = new DataMap();
120
		dataMap.put("resourceId", deviceId);
121
		dataMap.put("productKey", userName);
122
		dataMap.put("detailInfo", msg);
123
		dataMap.put("eventTime", System.currentTimeMillis());
124
		try {
125
			String msgStr=JSON.toJSONString(dataMap);
126
			log.info("发送kafka消息:topic=" + topic + ", msg=" + msgStr );
127
			kafkaTemplate.send(topic, deviceId, msgStr);
128
			
129
			kafkaTemplate.flush();
130
			log.info("发送kafka消息成功");
131
		} catch (Exception e) {
132
			log.error(topic + " send error");
133
		}
134
	}
135
    
136
}

+ 27 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/service/interfaces/MockManageService.java

1
package com.ai.bss.mock.service.interfaces;
2
3
import java.util.Map;
4
5
public interface MockManageService {
6
7
    /**
8
     * 查询当前正在 的场景
9
     * @return
10
     */
11
    Map findMockStatusByScenarioId();
12
13
    /**
14
     * 开始执行模拟数据
15
     * @param sId
16
     * @param f
17
     * @return
18
     */
19
    String  startMackData(Long sId,  Long f,String topic0,String topic1) ;
20
21
    /**
22
     * 停止执行模拟数据
23
     * @param sId
24
     * @return
25
     */
26
    String  stopMackData(Long sId);
27
}

+ 14 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/service/interfaces/MockProcess.java

1
package com.ai.bss.mock.service.interfaces;
2
3
import com.ai.bss.mock.model.LocationBean;
4
import com.ai.bss.mock.model.MockScenarioData;
5
6
import java.util.List;
7
import java.util.Map;
8
9
public interface MockProcess {
10
    void processMock(Long sId,List<MockScenarioData> mockScenarioDataList, Long frequency);
11
12
13
    void processMockKafka(Long sId,Map<Long, List<LocationBean>> dataMap,List<Long> orderNoList, Long frequency,String topic0,String topic1);
14
}

+ 48 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/HexStringUtil.java

1
package com.ai.bss.mock.utils;
2
3
/**
4
 * 16进制转换工具类
5
 * */
6
public class HexStringUtil {
7
8
	/**
9
	 * 将16进制字符串转换为byte[]
10
	 */
11
	public static byte[] decodeHextoByte(String str) {
12
		if (str == null || str.trim().equals("")) {
13
			return new byte[0];
14
		}
15
		byte[] bytes = new byte[str.length() / 2];
16
		for (int i = 0; i < str.length() / 2; i++) {
17
			String subStr = str.substring(i * 2, i * 2 + 2);
18
			bytes[i] = (byte) Integer.parseInt(subStr, 16);
19
		}
20
		return bytes;
21
	}
22
23
	/**
24
	 * 将byte转换为16进制字符串
25
	 * @param b
26
	 * @return
27
	 */
28
	public static String decodeBytetoHexString(byte b) {
29
		return Integer.toHexString(b & 0xff);
30
	}
31
32
	/**
33
	 * 将byte数组转换为16进制字符串
34
	 * @param bs
35
	 * @return
36
	 */
37
	public static String decodeByteArraytoHexString(byte[] bs) {
38
		StringBuilder builder = new StringBuilder();
39
		for (int i = 0; i < bs.length; i++) {
40
			if (bs[i]<0x10 && bs[i]>=0) {
41
				builder.append("0");
42
			}
43
			builder.append(decodeBytetoHexString(bs[i]));
44
		}
45
		return builder.toString();
46
	}
47
48
}

+ 113 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/KafkaProducerConfig.java

1
package com.ai.bss.mock.utils;
2
3
import com.alibaba.fastjson.JSONObject;
4
import lombok.NoArgsConstructor;
5
import lombok.extern.slf4j.Slf4j;
6
import org.apache.kafka.clients.producer.ProducerConfig;
7
import org.apache.kafka.common.serialization.StringSerializer;
8
import org.springframework.beans.factory.annotation.Value;
9
import org.springframework.context.annotation.Bean;
10
import org.springframework.context.annotation.Configuration;
11
import org.springframework.kafka.annotation.EnableKafka;
12
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
13
import org.springframework.kafka.core.KafkaTemplate;
14
import org.springframework.kafka.core.ProducerFactory;
15
import org.springframework.stereotype.Component;
16
17
import java.util.HashMap;
18
import java.util.Map;
19
20
@Slf4j
21
@Configuration
22
@EnableKafka
23
@NoArgsConstructor
24
@Component
25
public class KafkaProducerConfig {
26
27
    @Value("${kafka.producer.servers:Empty}")
28
//    private static String servers = "47.105.160.21:9090";
29
    private static String servers = "10.19.90.34:9090";
30
    @Value("${kafka.producer.retries:0}")
31
    private  int retries;
32
    @Value("${kafka.producer.batch.size:4096}")
33
    private  int batchSize;
34
    @Value("${kafka.producer.linger:1}")
35
    private  int linger;
36
    @Value("${kafka.producer.buffer.memory:40960}")
37
    private  int bufferMemory;
38
39
    private  int maxBlockTime = 60000;
40
41
    public KafkaProducerConfig(String inputServers){
42
        servers = inputServers;
43
        this.retries = 0;
44
        this.batchSize = 16384;
45
        this.linger = 1;
46
        this.bufferMemory = 33554432;
47
        this.maxBlockTime = 6000;
48
49
    }
50
51
    public Map<String, Object> producerConfigs() {
52
        Map<String, Object> props = new HashMap<>();
53
        props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, servers);
54
        props.put(ProducerConfig.RETRIES_CONFIG, retries);
55
        props.put(ProducerConfig.BATCH_SIZE_CONFIG, batchSize);
56
        props.put(ProducerConfig.LINGER_MS_CONFIG, linger);
57
        props.put(ProducerConfig.BUFFER_MEMORY_CONFIG, bufferMemory);
58
        props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
59
        props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
60
        props.put(ProducerConfig.MAX_BLOCK_MS_CONFIG,maxBlockTime);
61
        return props;
62
    }
63
64
    public ProducerFactory<String, String> producerFactory() {
65
        return new DefaultKafkaProducerFactory<>(producerConfigs());
66
    }
67
68
    @Bean
69
    public KafkaTemplate<String, String> kafkaTemplate() {
70
        return new KafkaTemplate<String, String>(producerFactory());
71
    }
72
//
73
74
75
    private static Map<String, KafkaTemplate>  kafkaTemplateMap = new HashMap<>();
76
    static KafkaTemplate  kafkaTemplate = null;
77
    /**
78
     * 推送消息到订阅的KAFKA服务器地址以及topic
79
     * @param kafkaTopic  订阅的kafka topic
80
     * @param content  消息内容
81
     * @return
82
     */
83
    public static Boolean sendForKafka(String kafkaTopic,String content) {
84
//        KafkaProducerConfig kafkaProducerConfig = new KafkaProducerConfig(servers);
85
//        KafkaTemplate kafkaTemplate =  kafkaProducerConfig.kafkaTemplate();
86
87
88
        kafkaTemplate = kafkaTemplateMap.get(servers);
89
        if(kafkaTemplate == null){
90
            //new 实例
91
//            KafkaProducerConfig kafkaProducerConfig = new KafkaProducerConfig(servers);
92
            KafkaProducerConfig kafkaProducerConfig = new KafkaProducerConfig();
93
            kafkaTemplate = kafkaProducerConfig.kafkaTemplate();
94
            kafkaTemplateMap.put(servers,kafkaTemplate);
95
        }
96
97
98
        try {
99
            System.out.println("send msg to Kafka:" + servers + "服务器地址以及topic:" + kafkaTopic + " 内容:" + content );
100
            Object result = kafkaTemplate.send(kafkaTopic,content ).get();
101
            log.debug("It's successful send msg to Kafka:" + servers + "服务器地址以及topic:" + kafkaTopic + " 内容:" + content + " 结果" + result);
102
103
            kafkaTemplate.flush();
104
        } catch (InterruptedException e) {
105
            log.error(e.getMessage());
106
            return false;
107
        } catch (Exception e) {
108
            log.error(e.getMessage());
109
            return false;
110
        }
111
        return true;
112
    }
113
}

+ 19 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/MessageUtil.java

1
package com.ai.bss.mock.utils;
2
3
4
public class MessageUtil {
5
    private MessageUtil() {
6
    }
7
8
    public static String getMessageKeyWord(String strContent) {
9
        return null;//  CommonConfig.hasBase64Flag() ? JSON.parseObject(new String(Base64.getDecoder().decode(strContent), StandardCharsets.UTF_8)).getString(CommonConfig.getMessageKeyWord()) : JSON.parseObject(strContent).getString(CommonConfig.getMessageKeyWord());
10
    }
11
12
    public static String getDecodeContent(String strContentEncode) {
13
        return null;//  CommonConfig.hasBase64Flag() ? new String(Base64.getDecoder().decode(strContentEncode), StandardCharsets.UTF_8) : strContentEncode;
14
    }
15
16
    public static String getEncodeContent(String strContent) {
17
        return null;// CommonConfig.hasBase64Flag() ? new String(Base64.getEncoder().encode(strContent.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8) : strContent;
18
    }
19
}

+ 19 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/SecurityConfigSEVEN.java

1
package com.ai.bss.mock.utils;
2
3
import org.springframework.context.annotation.Configuration;
4
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
5
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
6
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
7
8
@Configuration
9
@EnableWebSecurity
10
public class SecurityConfigSEVEN extends WebSecurityConfigurerAdapter {
11
12
    @Override
13
    protected void configure(HttpSecurity http) throws Exception {
14
        //super.configure(http);
15
        //配置不需要登陆验证
16
        http.authorizeRequests().anyRequest().permitAll().and().logout().permitAll();
17
    }
18
}
19

+ 31 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/makedata/MakeBluetoothData.java

1
package com.ai.bss.mock.utils.makedata;
2
3
import java.sql.Timestamp;
4
5
import com.ai.bss.mock.model.LocationBean;
6
import com.alibaba.fastjson.JSON;
7
8
public class MakeBluetoothData {
9
10
	/**
11
	 * 经纬度坐标单位为米
12
	 * @param xAxis
13
	 * @param yAxis
14
	 */
15
	public static String sendBluetoothKafka(double xAxis,double yAxis) {
16
		String clientId="XBG_AC67B2C23CFC";
17
		 String userName="abc";
18
		
19
		 String mac="d3e656a4573d";
20
		 
21
		 Integer floor=1;
22
		 Timestamp timeStamp=new Timestamp(System.currentTimeMillis());
23
		 LocationBean location=new LocationBean(mac, floor, xAxis, yAxis, timeStamp);
24
		 
25
		 String msg=JSON.toJSONString(location);
26
		 
27
		 System.out.println(msg);
28
		 
29
		 return msg;
30
	}
31
}

+ 56 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/tcp/IpuTcpLongConnectClient.java

1
package com.ai.bss.mock.utils.tcp;
2
3
import java.util.List;
4
5
import org.slf4j.Logger;
6
import org.slf4j.LoggerFactory;
7
8
import com.ai.bss.mock.model.MockScenarioData;
9
import com.ai.bss.mock.utils.tcp.message.MessageGenerationManager;
10
11
/**
12
 * Ipu Tcp长连接测试
13
 *
14
 * @author lilb3@asiainfo.com
15
 * @since 2020-06-23
16
 **/
17
@SuppressWarnings("unused")
18
public class IpuTcpLongConnectClient {
19
	private static final Logger logger = LoggerFactory.getLogger(IpuTcpLongConnectClient.class);
20
21
	
22
    private static IpuTcpLongConnectClient ipuClient;
23
    private TcpLongConnectClient nettyClient;
24
25
    private IpuTcpLongConnectClient() {
26
27
    }
28
29
    public static IpuTcpLongConnectClient getInstance(String host, int serverPort) {
30
        if (ipuClient == null) {
31
            ipuClient = new IpuTcpLongConnectClient();
32
            ipuClient.nettyClient = new TcpLongConnectClient(host, serverPort, MessageGenerationManager.getMessage());
33
        }
34
        return ipuClient;
35
    }
36
37
    /**
38
     * Tcp长连接方式发送消息
39
     * @throws Exception 
40
     */
41
    public void test() throws Exception {
42
        //nettyClient.test();
43
    	logger.info("test");
44
    }
45
    
46
47
    /**
48
     * Tcp长连接方式发送消息
49
     * @throws Exception
50
     */
51
    public void sendMockData(Long sId,List<MockScenarioData> mockScenarioDataList,Long frequency) throws Exception {
52
        //nettyClient.sendMockData(sId,mockScenarioDataList,frequency);
53
    	logger.info("sendMockData");
54
    }
55
    
56
}

+ 42 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/tcp/TcpLongConnectClient.java

1
package com.ai.bss.mock.utils.tcp;
2
3
import io.netty.bootstrap.Bootstrap;
4
import io.netty.channel.Channel;
5
import io.netty.channel.ChannelFuture;
6
import lombok.extern.slf4j.Slf4j;
7
8
/**
9
 * Tcp长连接客户端
10
 *
11
 * @author lilb3@asiainfo.com
12
 * @since 2019-10-16
13
 **/
14
@Slf4j
15
class TcpLongConnectClient {
16
	// private static final int PERIOD = 1;
17
	static final long PER_SLEEP_TIME = 2000L;
18
	// private static final int SEND_TIMES = 6;
19
	private final String host;
20
	private final int port;
21
	private final String message;
22
	private Channel channel;
23
	private ChannelFuture channelFuture;
24
	private Bootstrap bootstrap;
25
26
	TcpLongConnectClient(String host, int port, String message) {
27
		this.host = host;
28
		this.port = port;
29
		this.message = message;
30
	}
31
32
	/**
33
	 * 抽取出该方法 (断线重连时使用)
34
	 *
35
	 * @throws InterruptedException 异常
36
	 */
37
	void doConnect() throws InterruptedException {
38
		channelFuture = bootstrap.connect(host, port).sync();
39
		channel = channelFuture.channel();
40
	}
41
42
}

+ 73 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/tcp/TcpLongConnectClientHandler.java

1
package com.ai.bss.mock.utils.tcp;
2
3
import java.nio.charset.StandardCharsets;
4
5
import io.netty.buffer.ByteBuf;
6
import io.netty.channel.ChannelHandlerContext;
7
import io.netty.channel.ChannelInboundHandlerAdapter;
8
import io.netty.handler.timeout.IdleStateEvent;
9
import lombok.extern.slf4j.Slf4j;
10
11
/**
12
 * Tcp长连接客户端处理类
13
 *
14
 * @author lilb3@asiainfo.com
15
 * @since 2020-04-09
16
 **/
17
@Slf4j
18
class TcpLongConnectClientHandler extends ChannelInboundHandlerAdapter {
19
    private static final long SLEEP_TIME = 10 * 1000L;
20
    private final TcpLongConnectClient tcpLongConnectClient;
21
22
    TcpLongConnectClientHandler(TcpLongConnectClient tcpLongConnectClient) {
23
        this.tcpLongConnectClient = tcpLongConnectClient;
24
    }
25
26
    @Override
27
    public void channelActive(ChannelHandlerContext ctx) {
28
        log.info("TCP长连接客户端接入成功");
29
    }
30
31
    @Override
32
    public void channelInactive(ChannelHandlerContext ctx) {
33
    	log.info("连接断开");
34
    	//System.out.println("连接断开");
35
		/*LOGGER.debug("连接断开,10s之后尝试重新连接服务器。");
36
		try {
37
		    TimeUnit.MILLISECONDS.sleep(SLEEP_TIME);
38
		} catch (InterruptedException e) {
39
		    LOGGER.error(e.getMessage(), e);
40
		    Thread.currentThread().interrupt();
41
		}
42
		try {
43
		    tcpLongConnectClient.doConnect();
44
		} catch (InterruptedException e) {
45
		    LOGGER.error(e.getMessage(), e);
46
		    Thread.currentThread().interrupt();
47
		}*/
48
    }
49
50
    @Override
51
    public void channelRead(ChannelHandlerContext ctx, Object msg) {
52
        ByteBuf byteBuf = (ByteBuf) msg;
53
        byte[] content = new byte[byteBuf.readableBytes()];
54
        byteBuf.readBytes(content);
55
        String strContentEncode = new String(content, StandardCharsets.UTF_8);
56
//            String strContentDecode = MessageUtil.getDecodeContent(strContentEncode);
57
        log.debug(String.format("长连接TCP客户端收到的信息: %s", strContentEncode));
58
    }
59
60
    @Override
61
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
62
        log.error("客户端捕获到异常。", cause);
63
    }
64
65
    @Override
66
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
67
        if (evt instanceof IdleStateEvent) {
68
            //如果规定时内没有读写时间,则触发一个消息
69
            //ctx.writeAndFlush((CommonConfig.getTcpHeartBeat() + TCP_DELIMITER).getBytes(StandardCharsets.UTF_8));
70
        	
71
        }
72
    }
73
}

+ 27 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/tcp/message/DefaultMessageGeneration.java

1
package com.ai.bss.mock.utils.tcp.message;
2
3
import com.ai.bss.mock.utils.MessageUtil;
4
import com.alibaba.fastjson.JSONObject;
5
6
/**
7
 * 消息测试
8
 *
9
 * @author lilb3@asiainfo.com
10
 * @since 2020-03-30
11
 **/
12
public class DefaultMessageGeneration implements IMessageGeneration {
13
    private static final String IMEI = "imeiTest";
14
15
    private static String getMessage0(String topic) {
16
        JSONObject jsonObject = new JSONObject();
17
        jsonObject.put("topic", topic);
18
        jsonObject.put("imei", IMEI);
19
        jsonObject.put("sendTime", System.currentTimeMillis() + "");
20
        return jsonObject.toString();
21
    }
22
23
    @Override
24
    public String getMessage(String topic) {
25
        return MessageUtil.getEncodeContent(getMessage0(topic));
26
    }
27
}

+ 19 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/tcp/message/IMessageGeneration.java

1
package com.ai.bss.mock.utils.tcp.message;
2
3
/**
4
 * 消息发送接口
5
 *
6
 * @author lilb3@asiainfo.com
7
 * @since 2020-06-22
8
 **/
9
@SuppressWarnings("unused")
10
public interface IMessageGeneration {
11
12
    /**
13
     * 获取测试消息
14
     *
15
     * @param topic 消息主题
16
     * @return 测试消息
17
     */
18
    String getMessage(String topic);
19
}

+ 73 - 0
indoor-mock-service/src/main/java/com/ai/bss/mock/utils/tcp/message/MessageGenerationManager.java

1
package com.ai.bss.mock.utils.tcp.message;
2
3
import com.ai.bss.mock.constants.MockConstant;
4
import com.ai.ipu.basic.instance.InstanceManager;
5
6
import java.util.HashMap;
7
import java.util.Map;
8
9
10
/**
11
 * 增加message默认处理类,分离消息消费逻辑
12
 *
13
 * @author lilb3@asiainfo.com
14
 * @since 2020-06-22
15
 **/
16
@SuppressWarnings("unused")
17
public class MessageGenerationManager {
18
    private static final String SPLIT_DASH = MockConstant.SPLIT_DASH;
19
    private static final Map<String, IMessageGeneration> INSTANCES = new HashMap<>();
20
    private static IMessageGeneration defaultMessageGeneration;
21
22
    private MessageGenerationManager() {
23
        throw new RuntimeException("MessageGenerationManager无法被实例化");
24
    }
25
26
    @SuppressWarnings("unchecked")
27
    private static IMessageGeneration createMessageGeneration(String className) throws Exception {
28
        IMessageGeneration messageGeneration = INSTANCES.get(className);
29
        if (messageGeneration == null) {
30
            synchronized (INSTANCES) {
31
                if (INSTANCES.get(className) == null) {
32
                    Class<?> clazz = Class.forName(className);
33
                    messageGeneration = InstanceManager.createBean((Class<IMessageGeneration>) clazz);
34
                    INSTANCES.put(className, messageGeneration);
35
                }
36
            }
37
        }
38
        return INSTANCES.get(className);
39
    }
40
41
//    public static <Type> Type createBean(Class<Type> clazz) throws Exception {
42
//        return createBean(clazz, true);
43
//    }
44
45
    private static IMessageGeneration getDefaultMessageGeneration() {
46
        if (defaultMessageGeneration == null) {
47
            defaultMessageGeneration = new DefaultMessageGeneration();
48
        }
49
        return defaultMessageGeneration;
50
    }
51
52
    public static void setDefaultMessageGeneration(IMessageGeneration defaultMessageGeneration) {
53
        MessageGenerationManager.defaultMessageGeneration = defaultMessageGeneration;
54
    }
55
56
    public static String getMessage() {
57
    	//String topic = CommonConfig.getTopics()[new Random().nextInt(CommonConfig.getTopics().length)];
58
        String topic = "networkPacket";
59
        return getMessage(topic);
60
    }
61
62
    public static String getMessage(String topic) {
63
        try {
64
            IMessageGeneration messageGeneration = MessageGenerationManager.getDefaultMessageGeneration();;
65
            if (messageGeneration != null) {
66
                return messageGeneration.getMessage(topic);
67
            }
68
        } catch (Exception e) {
69
//            LOGGER.error("Test Message生成异常", e);
70
        }
71
        return "";
72
    }
73
}

+ 59 - 0
indoor-mock-service/src/main/resources/application.properties

1
spring.application.name=WorkTaskSpec
2
server.port=8086
3
4
# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
5
#spring.datasource.url=jdbc:mysql://localhost:3306/cmp
6
#spring.datasource.url=jdbc:mysql://10.19.14.28:3306/work_order?useUnicode=true&ampcharacterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
7
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
8
#spring.datasource.username=aibp
9
#spring.datasource.password=Aibp@123
10
#spring.datasource.url=jdbc:mysql://10.11.20.120:3306/common_frm?useUnicode=true&ampcharacterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
11
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
12
#spring.datasource.username=comon_frm
13
#spring.datasource.password=1qaz@WSX
14
#spring.datasource.url=jdbc:mysql://47.105.160.21:3309/dmp?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
15
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
16
#spring.datasource.username=cmp
17
#spring.datasource.password=cmp@123
18
spring.datasource.url=jdbc:mysql://10.19.90.34:3307/energy?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
19
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
20
spring.datasource.username=ebc
21
spring.datasource.password=ebc@123
22
23
# JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
24
#spring.jpa.database=default
25
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
26
spring.jpa.hibernate.ddl-auto=update
27
spring.jpa.show-sql=true
28
spring.jpa.properties.hibernate.format_sql=true
29
spring.jpa.properties.hibernate.generate_statistics=false
30
spring.main.allow-bean-definition-overriding=true
31
32
# CACHE
33
#spring.cache.type=ehcache
34
#spring.cache.ehcache.config=ehcache.xml
35
36
# LOGGING
37
logging.level.com.ai=info
38
logging.level.org.springframework.data=info
39
40
41
42
43
#============== kafka ===================
44
kafka.consumer.zookeeper.connect=47.105.160.21:2100
45
kafka.consumer.servers=47.105.160.21:9090
46
kafka.consumer.enable.auto.commit=true
47
kafka.consumer.session.timeout=6000
48
kafka.consumer.auto.commit.interval=100
49
kafka.consumer.auto.offset.reset=latest
50
kafka.consumer.topic=productMessage
51
kafka.consumer.group.id=productMessage
52
kafka.consumer.concurrency=10
53
54
kafka.producer.servers=47.105.160.21:9091
55
kafka.producer.retries=0
56
kafka.producer.batch.size=4096
57
kafka.producer.linger=1
58
kafka.producer.buffer.memory=40960
59
kafka.producer.topic=uploadInfoTest

+ 34 - 0
indoor-mock-service/src/test/resources/application.properties

1
spring.application.name=WorkTaskSpec
2
server.port=8086
3
4
# DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
5
#spring.datasource.url=jdbc:mysql://localhost:3306/cmp
6
#spring.datasource.url=jdbc:mysql://10.19.14.28:3306/work_order?useUnicode=true&ampcharacterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
7
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
8
#spring.datasource.username=aibp
9
#spring.datasource.password=Aibp@123
10
#spring.datasource.url=jdbc:mysql://10.11.20.120:3306/common_frm?useUnicode=true&ampcharacterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
11
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
12
#spring.datasource.username=comon_frm
13
#spring.datasource.password=1qaz@WSX
14
spring.datasource.url=jdbc:mysql://10.19.90.34:3307/energy?useUnicode=true&ampcharacterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
15
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
16
spring.datasource.username=ebc
17
spring.datasource.password=ebc@123
18
19
# JPA (JpaBaseConfiguration, HibernateJpaAutoConfiguration)
20
#spring.jpa.database=default
21
spring.jpa.database-platform=org.hibernate.dialect.MySQL5Dialect
22
spring.jpa.hibernate.ddl-auto=update
23
spring.jpa.show-sql=true
24
spring.jpa.properties.hibernate.format_sql=true
25
spring.jpa.properties.hibernate.generate_statistics=false
26
spring.main.allow-bean-definition-overriding=true
27
28
# CACHE
29
#spring.cache.type=ehcache
30
#spring.cache.ehcache.config=ehcache.xml
31
32
# LOGGING
33
logging.level.com.ai=info
34
logging.level.org.springframework.data=info

+ 7 - 13
indoor-service/src/main/java/com/ai/bss/location/util/DateUtil.java

161
	 * @throws Exception 
161
	 * @throws Exception 
162
	 */
162
	 */
163
	public static int compareDate(String dateStr0, String dateStr1) throws Exception {
163
	public static int compareDate(String dateStr0, String dateStr1) throws Exception {
164
		if (dateStr0 == null || "".equals(dateStr0)) {
165
			if (dateStr1 == null || "".equals(dateStr1)) {
166
				return 0;
167
			} else {
168
				return -1;
169
			}
170
		}
164
		Date date0 = convertDate(dateStr0);
165
		Date date1 = convertDate(dateStr1);
166
167
		if (date0 == null)
168
			return (date1 == null) ? 0 : -1;
171
169
172
		if (dateStr1 == null || "".equals(dateStr1)) {
170
		if (date1 == null)
173
			return 1;
171
			return 1;
174
		}
175
172
176
		Date date1 = convertDate(dateStr0);
177
		Date date2 = convertDate(dateStr1);
178
		int result = date1.compareTo(date2);
179
		return result;
173
		return date0.compareTo(date1);
180
	}
174
	}
181
175
182
	/**
176
	/**

增加北京项目静态页面 · dff0613469 - Nuosi Git Service
Explorar el Código

增加北京项目静态页面

guohh %!s(int64=3) %!d(string=hace) años
padre
commit
dff0613469

+ 94 - 0
2019/bj-zqzt/2022-house-info.html

@ -0,0 +1,94 @@
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
  <title>房信息</title>
5
  <meta charset="utf-8">
6
  <!-- 宽度自动适配 -->
7
  <meta name="viewport"
8
        content="width=device-width, initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0, user-scalable=no" />
9
  <!-- 不识别页面上的数字为可拨打号码 -->
10
  <meta content="telephone=no" name="format-detection" />
11
  <link rel="stylesheet" type="text/css" href="ipu/ui/css/ipuUI.css">
12
  <link rel="stylesheet" type="text/css" href="biz/css/base.css">
13
  <link rel="stylesheet" type="text/css" href="biz/css/iconfont/iconfont.css">
14
15
  <script src="ipu/lib/requirejs/require.min.js"></script>
16
  <script src="biz/js/require-config.js"></script>
17
</head>
18
<body class="pages-house-info">
19
<div class="ipu-pages">
20
  <div class="ipu-page">
21
    <div class="ipu-flex-row ipu-flex-vertical">
22
      <div class="ipu-flex-col">
23
        <div class="ipu-toolbar">
24
          <a class="ipu-fn-left link-back ipu-flex ipu-flex-align-center"
25
             href="javascript:history.back(-1);" id="back">
26
            <div class="left-back"></div>
27
          </a>
28
          <h1 class="ipu-toolbar-title">房信息</h1>
29
        </div>
30
      </div>
31
32
      <div class="ipu-flex-col ipu-flex-col-auto">
33
        <div class="ipu-flex-content">
34
          <div class="common-page-content">
35
            <div class="ipu-fn-bd-b ipu-flex house-info-head">
36
              <div class="ipu-flex-grow-0 house-info-head-label">
37
                房信息
38
              </div>
39
              <div class="ipu-flex-grow-1 house-info-head-text">
40
                数据截止时间:2020-03-23
41
              </div>
42
            </div>
43
            <div class="house-info-body">
44
              <div class="house-info-list">
45
                <div class="ipu-fn-bd-b ipu-flex house-info-item">
46
                  <div class="ipu-flex-grow-0 house-info-item-label">
47
                    房号
48
                  </div>
49
                  <div class="ipu-flex-grow-1 house-info-item-text">
50
                    PNT3900
51
                  </div>
52
                </div>
53
                <div class="ipu-fn-bd-b ipu-flex house-info-item">
54
                  <div class="ipu-flex-grow-0 house-info-item-label">
55
                    位置
56
                  </div>
57
                  <div class="ipu-flex-grow-1 house-info-item-text">
58
                    三单元7层D12
59
                  </div>
60
                </div>
61
                <div class="ipu-fn-bd-b ipu-flex house-info-item">
62
                  <div class="ipu-flex-grow-0 house-info-item-label">
63
                    可营销
64
                  </div>
65
                  <div class="ipu-flex-grow-1 house-info-item-text">
66
                    集客可营销
67
                  </div>
68
                </div>
69
                <div class="ipu-fn-bd-b ipu-flex house-info-item">
70
                  <div class="ipu-flex-grow-0 house-info-item-label">
71
                    客营销时间
72
                  </div>
73
                  <div class="ipu-flex-grow-1 house-info-item-text">
74
                    2020-01-13至2021-01-13
75
                  </div>
76
                </div>
77
                <div class="ipu-flex house-info-item">
78
                  <div class="ipu-flex-grow-0 house-info-item-label">
79
                    覆盖场景
80
                  </div>
81
                  <div class="ipu-flex-grow-1 house-info-item-text">
82
                    企业宽带场景
83
                  </div>
84
                </div>
85
              </div>
86
            </div>
87
          </div>
88
        </div>
89
      </div>
90
91
    </div>
92
  </div>
93
</body>
94
</html>

+ 175 - 0
2019/bj-zqzt/2022-pon-house-search.html

@ -0,0 +1,175 @@
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
  <title>查询PON资源地址</title>
5
  <meta charset="utf-8">
6
  <!-- 宽度自动适配 -->
7
  <meta name="viewport"
8
        content="width=device-width, initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0, user-scalable=no" />
9
  <!-- 不识别页面上的数字为可拨打号码 -->
10
  <meta content="telephone=no" name="format-detection" />
11
  <link rel="stylesheet" type="text/css" href="ipu/ui/css/ipuUI.css">
12
  <link rel="stylesheet" type="text/css" href="biz/css/base.css">
13
  <link rel="stylesheet" type="text/css" href="biz/css/iconfont/iconfont.css">
14
15
  <script src="ipu/lib/requirejs/require.min.js"></script>
16
  <script src="biz/js/require-config.js"></script>
17
  <script src="biz/js/pon-house-search.js"></script>
18
</head>
19
<body class="pages-pon-resource-search">
20
<div class="ipu-pages">
21
  <div class="ipu-page">
22
    <div class="ipu-flex-row ipu-flex-vertical">
23
      <div class="ipu-flex-col">
24
        <div class="ipu-toolbar">
25
          <a class="ipu-fn-left link-back ipu-flex ipu-flex-align-center"
26
             href="javascript:history.back(-1);" id="back">
27
            <div class="left-back"></div>
28
          </a>
29
          <h1 class="ipu-toolbar-title">查询PON资源地址</h1>
30
        </div>
31
      </div>
32
33
      <!--  楼层搜索 -->
34
      <div
35
        class="ipu-flex-col ipu-flex-col-auto ipu-flex-row ipu-flex-vertical pon-house-block">
36
        <div class="ipu-flex-col">
37
          <div class="pon-search-head">
38
            <div class="pon-address-slt ipu-fn-bd-b">
39
              <div class="pon-address-slt-title">
40
                万鹏文化办公用品商城
41
              </div>
42
              <div class="pon-address-slt-desc">
43
                中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
44
              </div>
45
            </div>
46
            <div class="ipu-flex ipu-flex-middle ">
47
              <div class="ipu-flex-grow-0 pon-search-flag"></div>
48
              <div class="ipu-flex-grow-1">
49
                <input type="text" class="pon-search-input" placeholder="请输入单元-楼层-门牌号">
50
              </div>
51
              <div class="ipu-flex-grow-0 pon-search-btn">搜索</div>
52
            </div>
53
          </div>
54
        </div>
55
56
        <div class="ipu-flex-col ipu-flex-col-auto ">
57
          <div class="ipu-flex-content common-page-content" id="refresh">
58
            <div class="ipu-refresh-wrapper">
59
              <div class="">
60
                <div class="ipu-list ipu-list-media pon-list-block">
61
                  <ul>
62
                    <li class="">
63
                      <a class="ipu-list-item ipu-list-item-link">
64
                        <div class="ipu-flex-grow-0">
65
                          <div class="pon-address-flag"></div>
66
                        </div>
67
                        <div class="ipu-list-item-inner">
68
                          <div class="ipu-list-item-title-row">
69
                            <div class="ipu-list-item-title pon-resource-address">
70
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
71
                            </div>
72
                          </div>
73
                          <div class="ipu-flex-middle ipu-list-item-subtitle pon-address-scene">
74
                            <div class="">企业宽带场景</div>
75
                            <div class="split"></div>
76
                            <div class="red">集客可营销</div>
77
                          </div>
78
                        </div>
79
                      </a>
80
                    </li>
81
82
                    <li class="">
83
                      <a class="ipu-list-item ipu-list-item-link">
84
                        <div class="ipu-flex-grow-0">
85
                          <div class="pon-address-flag"></div>
86
                        </div>
87
                        <div class="ipu-list-item-inner">
88
                          <div class="ipu-list-item-title-row">
89
                            <div class="ipu-list-item-title pon-resource-address">
90
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
91
                            </div>
92
                          </div>
93
                          <div class="ipu-flex-middle ipu-list-item-subtitle pon-address-scene">
94
                            <div class="">企业宽带场景</div>
95
                            <div class="split"></div>
96
                            <div class="green">移动固话可营销</div>
97
                          </div>
98
                        </div>
99
                      </a>
100
                    </li>
101
102
                    <li class="">
103
                      <a class="ipu-list-item ipu-list-item-link">
104
                        <div class="ipu-flex-grow-0">
105
                          <div class="pon-address-flag"></div>
106
                        </div>
107
                        <div class="ipu-list-item-inner">
108
                          <div class="ipu-list-item-title-row">
109
                            <div class="ipu-list-item-title pon-resource-address">
110
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
111
                            </div>
112
                          </div>
113
                          <div class="ipu-flex-middle ipu-list-item-subtitle pon-address-scene">
114
                            <div class="">企业宽带场景</div>
115
                            <div class="split"></div>
116
                            <div class="yellow">移动宽带可营销</div>
117
                          </div>
118
                        </div>
119
                      </a>
120
                    </li>
121
122
                    <li class="">
123
                      <a class="ipu-list-item ipu-list-item-link">
124
                        <div class="ipu-flex-grow-0">
125
                          <div class="pon-address-flag"></div>
126
                        </div>
127
                        <div class="ipu-list-item-inner">
128
                          <div class="ipu-list-item-title-row">
129
                            <div class="ipu-list-item-title pon-resource-address">
130
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
131
                            </div>
132
                          </div>
133
                          <div class="ipu-flex-middle ipu-list-item-subtitle pon-address-scene">
134
                            <div class="">企业宽带场景</div>
135
                            <div class="split"></div>
136
                            <div class="purple">移动宽带固话可营销</div>
137
                          </div>
138
                        </div>
139
                      </a>
140
                    </li>
141
142
                    <li class="">
143
                      <a class="ipu-list-item ipu-list-item-link">
144
                        <div class="ipu-flex-grow-0">
145
                          <div class="pon-address-flag"></div>
146
                        </div>
147
                        <div class="ipu-list-item-inner">
148
                          <div class="ipu-list-item-title-row">
149
                            <div class="ipu-list-item-title pon-resource-address">
150
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
151
                            </div>
152
                          </div>
153
                          <div class="ipu-flex-middle ipu-list-item-subtitle pon-address-scene">
154
                            <div class="">企业宽带场景</div>
155
                            <div class="split"></div>
156
                            <div class="">不可营销</div>
157
                          </div>
158
                        </div>
159
                      </a>
160
                    </li>
161
162
                  </ul>
163
                </div>
164
              </div>
165
            </div>
166
          </div>
167
        </div>
168
      </div>
169
170
171
    </div>
172
  </div>
173
</div>
174
</body>
175
</html>

+ 208 - 0
2019/bj-zqzt/2022-pon-resource-search.html

@ -0,0 +1,208 @@
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
  <title>查询PON资源地址</title>
5
  <meta charset="utf-8">
6
  <!-- 宽度自动适配 -->
7
  <meta name="viewport"
8
        content="width=device-width, initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0, user-scalable=no" />
9
  <!-- 不识别页面上的数字为可拨打号码 -->
10
  <meta content="telephone=no" name="format-detection" />
11
  <link rel="stylesheet" type="text/css" href="ipu/ui/css/ipuUI.css">
12
  <link rel="stylesheet" type="text/css" href="biz/css/base.css">
13
  <link rel="stylesheet" type="text/css" href="biz/css/iconfont/iconfont.css">
14
15
  <script src="ipu/lib/requirejs/require.min.js"></script>
16
  <script src="biz/js/require-config.js"></script>
17
  <script src="biz/js/pon-resource-search.js"></script>
18
</head>
19
<body class="pages-pon-resource-search">
20
<div class="ipu-pages">
21
  <div class="ipu-page">
22
    <div class="ipu-flex-row ipu-flex-vertical">
23
      <div class="ipu-flex-col">
24
        <div class="ipu-toolbar">
25
          <a class="ipu-fn-left link-back ipu-flex ipu-flex-align-center"
26
             href="javascript:history.back(-1);" id="back">
27
            <div class="left-back"></div>
28
          </a>
29
          <h1 class="ipu-toolbar-title">查询PON资源地址</h1>
30
        </div>
31
      </div>
32
33
34
      <!--  小区搜索 -->
35
      <div
36
        class="ipu-flex-col ipu-flex-col-auto ipu-flex-row ipu-flex-vertical pon-block">
37
38
        <div class="ipu-flex-col">
39
          <div class="pon-search-head">
40
            <div class="ipu-flex ipu-flex-middle ">
41
              <div class="ipu-flex-grow-0 pon-search-flag"></div>
42
              <div class="ipu-flex-grow-1">
43
                <input type="text" class="pon-search-input" placeholder="点击这里,输入小区名称">
44
              </div>
45
              <div class="ipu-flex-grow-0 pon-search-btn">搜索</div>
46
            </div>
47
          </div>
48
        </div>
49
50
        <div class="ipu-flex-col ipu-flex-col-auto ">
51
          <div class="ipu-flex-content common-page-content" id="refresh">
52
            <div class="ipu-refresh-wrapper">
53
              <div class=>
54
                <div class="ipu-list ipu-list-media pon-list-block">
55
                  <ul>
56
                    <li class="">
57
                      <a class="ipu-list-item ipu-list-item-link">
58
                        <div class="ipu-flex-grow-0">
59
                          <div class="pon-address-flag"></div>
60
                        </div>
61
                        <div class="ipu-list-item-inner">
62
                          <div class="ipu-list-item-title-row">
63
                            <div class="ipu-list-item-title pon-resource-address">
64
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
65
                            </div>
66
                          </div>
67
                          <div class="ipu-list-item-subtitle pon-resource-id">
68
                            资源唯一ID:3615888a
69
                          </div>
70
                        </div>
71
                      </a>
72
                    </li>
73
                    <li class="">
74
                      <a class="ipu-list-item ipu-list-item-link">
75
                        <div class="ipu-flex-grow-0">
76
                          <div class="pon-address-flag"></div>
77
                        </div>
78
                        <div class="ipu-list-item-inner">
79
                          <div class="ipu-list-item-title-row">
80
                            <div class="ipu-list-item-title pon-resource-address">
81
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
82
                            </div>
83
                          </div>
84
                          <div class="ipu-list-item-subtitle pon-resource-id">
85
                            资源唯一ID:3615888a
86
                          </div>
87
                        </div>
88
                      </a>
89
                    </li>
90
                    <li class="">
91
                      <a class="ipu-list-item ipu-list-item-link">
92
                        <div class="ipu-flex-grow-0">
93
                          <div class="pon-address-flag"></div>
94
                        </div>
95
                        <div class="ipu-list-item-inner">
96
                          <div class="ipu-list-item-title-row">
97
                            <div class="ipu-list-item-title pon-resource-address">
98
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
99
                            </div>
100
                          </div>
101
                          <div class="ipu-list-item-subtitle pon-resource-id">
102
                            资源唯一ID:3615888a
103
                          </div>
104
                        </div>
105
                      </a>
106
                    </li>
107
                    <li class="">
108
                      <a class="ipu-list-item ipu-list-item-link">
109
                        <div class="ipu-flex-grow-0">
110
                          <div class="pon-address-flag"></div>
111
                        </div>
112
                        <div class="ipu-list-item-inner">
113
                          <div class="ipu-list-item-title-row">
114
                            <div class="ipu-list-item-title pon-resource-address">
115
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
116
                            </div>
117
                          </div>
118
                          <div class="ipu-list-item-subtitle pon-resource-id">
119
                            资源唯一ID:3615888a
120
                          </div>
121
                        </div>
122
                      </a>
123
                    </li>
124
                    <li class="">
125
                      <a class="ipu-list-item ipu-list-item-link">
126
                        <div class="ipu-flex-grow-0">
127
                          <div class="pon-address-flag"></div>
128
                        </div>
129
                        <div class="ipu-list-item-inner">
130
                          <div class="ipu-list-item-title-row">
131
                            <div class="ipu-list-item-title pon-resource-address">
132
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
133
                            </div>
134
                          </div>
135
                          <div class="ipu-list-item-subtitle pon-resource-id">
136
                            资源唯一ID:3615888a
137
                          </div>
138
                        </div>
139
                      </a>
140
                    </li>
141
                    <li class="">
142
                      <a class="ipu-list-item ipu-list-item-link">
143
                        <div class="ipu-flex-grow-0">
144
                          <div class="pon-address-flag"></div>
145
                        </div>
146
                        <div class="ipu-list-item-inner">
147
                          <div class="ipu-list-item-title-row">
148
                            <div class="ipu-list-item-title pon-resource-address">
149
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
150
                            </div>
151
                          </div>
152
                          <div class="ipu-list-item-subtitle pon-resource-id">
153
                            资源唯一ID:3615888a
154
                          </div>
155
                        </div>
156
                      </a>
157
                    </li>
158
                    <li class="">
159
                      <a class="ipu-list-item ipu-list-item-link">
160
                        <div class="ipu-flex-grow-0">
161
                          <div class="pon-address-flag"></div>
162
                        </div>
163
                        <div class="ipu-list-item-inner">
164
                          <div class="ipu-list-item-title-row">
165
                            <div class="ipu-list-item-title pon-resource-address">
166
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
167
                            </div>
168
                          </div>
169
                          <div class="ipu-list-item-subtitle pon-resource-id">
170
                            资源唯一ID:3615888a
171
                          </div>
172
                        </div>
173
                      </a>
174
                    </li>
175
176
                    <li class="">
177
                      <a class="ipu-list-item ipu-list-item-link">
178
                        <div class="ipu-flex-grow-0">
179
                          <div class="pon-address-flag"></div>
180
                        </div>
181
                        <div class="ipu-list-item-inner">
182
                          <div class="ipu-list-item-title-row">
183
                            <div class="ipu-list-item-title pon-resource-address">
184
                              中国背景北京东城区-用外接到-沙子口路-万鹏文化办公用品商城
185
                            </div>
186
                          </div>
187
                          <div class="ipu-list-item-subtitle pon-resource-id">
188
                            资源唯一ID:3615888a
189
                          </div>
190
                        </div>
191
                      </a>
192
                    </li>
193
194
                  </ul>
195
                </div>
196
                <div class="no-result-message">未查询到数据</div>
197
              </div>
198
199
            </div>
200
          </div>
201
        </div>
202
      </div>
203
204
    </div>
205
  </div>
206
</div>
207
</body>
208
</html>

+ 193 - 0
2019/bj-zqzt/biz/css/base-ghh.css

@ -1862,3 +1862,196 @@ div.result-no-record .scan-result-name {
1862 1862
  width: .03rem;
1863 1863
  background-color: #3F93F8;
1864 1864
}
1865
1866
/* 2022 add */
1867
.pages-pon-resource-search .common-page-content {
1868
  margin: 0 .08rem .1rem .08rem;
1869
  border-radius: 8px;
1870
  min-height: calc(100% - .2rem);
1871
  background-color: #fff;
1872
}
1873
1874
.pon-list-block > ul:before,
1875
.pon-list-block > ul:after {
1876
  content: none;
1877
}
1878
1879
.pon-list-block > ul > li:not(:last-child) .ipu-list-item-inner:after {
1880
  right: .3rem;
1881
}
1882
1883
.pon-list-block > ul .ipu-list-item {
1884
  padding-left: .105rem;
1885
}
1886
.pon-list-block .ipu-list-item-link:after{
1887
  right: .12rem;
1888
}
1889
.pon-search-head {
1890
  background-color: #fff;
1891
  margin: 0.0975rem .0775rem;
1892
  padding: .135rem .14rem .13rem .11rem;
1893
  border-radius: 0.04rem;
1894
}
1895
1896
.pon-search-head .common-search-input {
1897
  background-color: transparent;
1898
}
1899
1900
.pon-search-btn {
1901
  padding-right: .05rem;
1902
  font-size: .14rem;
1903
  color: #3F94F8;
1904
  font-weight: 400;
1905
}
1906
1907
.pon-resource-address {
1908
  font-size: .13rem;
1909
  color: #1A1A1A;
1910
  line-height: .165rem;
1911
  font-weight: 500;
1912
}
1913
1914
.pon-resource-id {
1915
  margin-top: .075rem;
1916
  font-size: .11rem;
1917
  color: #8E9399;
1918
  font-weight: 400;
1919
  padding-bottom: .05rem;
1920
  line-height: 1;
1921
}
1922
1923
.pon-address-flag {
1924
  background-color: #000;
1925
  width: .1rem;
1926
  height: .1rem;
1927
  margin-top: .16rem;
1928
  margin-right: .1rem;
1929
  background: url('../img/building-address.png') center center no-repeat;
1930
  background-size: 100% auto;
1931
}
1932
1933
.pages-house-info .common-page-content {
1934
  margin: .0975rem .0775rem;
1935
  background-color: #fff;
1936
  border-radius: .04rem;
1937
  padding-left: .13rem;
1938
  padding-right: .095rem;
1939
}
1940
1941
.house-info-list {
1942
  margin: .12rem 0 0;
1943
}
1944
1945
.house-info-item {
1946
  font-size: .13rem;
1947
  color: #8E9399;
1948
  line-height: .17rem;
1949
  padding: .1rem 0;
1950
}
1951
1952
.pages-house-info .ipu-fn-bd-b:after {
1953
  background: #dedede;
1954
}
1955
1956
.house-info-item.ipu-fn-bd-b:after {
1957
  opacity: 0.2;
1958
}
1959
1960
.house-info-item-text {
1961
  color: #2B2F33;
1962
  text-align: right;
1963
}
1964
1965
.house-info-head {
1966
  padding: .1875rem 0 .155rem;
1967
}
1968
1969
.house-info-head-label {
1970
  font-size: .16rem;
1971
  color: #2B2F33;
1972
  letter-spacing: 1px;
1973
  font-weight: 700;
1974
}
1975
1976
.house-info-head-text {
1977
  text-align: right;
1978
}
1979
1980
.pon-list-block .ipu-list-item-inner {
1981
  padding-top: .13rem;
1982
  padding-right: .4rem;
1983
}
1984
1985
.pon-address-scene {
1986
  margin-top: .08rem;
1987
  font-size: .11rem;
1988
  color: #9B9B9B;
1989
}
1990
1991
.pon-address-scene .split {
1992
  border-left: 1px solid #D8D8D8;
1993
  height: .085rem;
1994
  margin: 0 .0425rem;
1995
}
1996
1997
.pon-address-scene .red {
1998
  color: #F6414A;
1999
}
2000
2001
.pon-address-scene .green {
2002
  color: #129578;
2003
}
2004
2005
.pon-address-scene .yellow {
2006
  color: #FF6503;
2007
}
2008
2009
.pon-address-scene .purple {
2010
  color: #BD10E0;
2011
}
2012
2013
.pon-address-slt-title {
2014
  font-size: .18rem;
2015
  color: #2B2F33;
2016
  font-weight: 600;
2017
}
2018
2019
.pon-address-slt-desc {
2020
  font-size: .12rem;
2021
  color: #7D7E80;
2022
  line-height: .165rem;
2023
}
2024
2025
.pon-search-flag {
2026
  width: .2rem;
2027
  height: .2rem;
2028
  background: url(../img/input-search.png) center no-repeat;
2029
  background-size: 100% auto;
2030
  margin-right: .1rem;
2031
}
2032
2033
.pon-search-input{
2034
  display: block;
2035
  width: 100%;
2036
  line-height:.2rem;
2037
  font-size: .14rem;
2038
  font-weight: 500;
2039
  border-width:0;
2040
  color:rgba(43,47,51,1);
2041
  border-radius: .08rem;
2042
}
2043
.pon-search-input::-webkit-input-placeholder {
2044
  color:  #C1C7D1;
2045
  font-size: .14rem;
2046
  font-weight:500;
2047
}
2048
2049
.pon-address-slt{
2050
  padding-bottom: .08rem;
2051
  margin-bottom: .17rem;
2052
}
2053
.pages-pon-resource-search .no-result-message{
2054
  padding: .1rem;
2055
  display: none;
2056
  text-align: center;
2057
}

+ 0 - 1
2019/bj-zqzt/biz/css/base.css

@ -6,7 +6,6 @@
6 6
@import "base-hbt.css";
7 7
@import "base-zq.css";
8 8
@import "base-fzy.css";
9
@import "base-cjc.css";
10 9
11 10
/* 首页 */
12 11
.navbar-item-icon {

+ 67 - 0
2019/bj-zqzt/biz/js/pon-house-search.js

@ -0,0 +1,67 @@
1
require(['jquery', 'ipuUI'], function ($, ipuUI) {
2
  $(function () {
3
    var search = showResList();
4
5
    //点击搜索
6
    $('.pon-search-btn').click(function () {
7
      search()
8
    })
9
10
    // 初始化下拉刷新组件
11
    function showResList() {
12
      var totalPage = 3; // 总页数
13
      var currentPage = 1; // 当前显示第几页,因为默认有一些数据了,所以为1
14
      var listObj = $("#refresh ul");
15
      var contentHtml = $("li:lt(5)", listObj).clone(); // 测试用,复制5条数据
16
17
      // 移除初始的数据,并初始currentPage=0;
18
      listObj.empty();
19
      currentPage = 0;
20
      var countNo = 0; // 重要计数器,以此来判断不需要
21
22
      // 初始化下拉刷新
23
      var myRefresh = ipuUI.refresh("#refresh", {
24
        bottomLoadFun: function () { // 加载更多
25
          console.log('加载更多'); // 手势上拉,内容下滚动动
26
          addData();
27
        }
28
      });
29
30
      // 查询数据
31
      function addData(refresh) { // 0搜索,1刷新,2加载更多
32
        $("#refresh .no-result-msg").hide();
33
        currentPage++;
34
        var localCountNo = ++countNo; // 执行查询前,保留当前计数器,当查询返回时进行检查是否最新查询,不是则抛弃查询结果
35
36
        setTimeout(function () { // 模拟延时加载
37
          if (localCountNo == countNo) { // 检查是否最新查询返回数据,不是则抛弃查询结果
38
            // 此处先更新togalPage等信息
39
40
            myRefresh.enableBottom(currentPage < totalPage); // enable应该总是先于endBottom/TopLoading方法执行
41
42
            if (totalPage == 0) {
43
              $("#refresh .no-result-message").show();
44
            } else {
45
              contentHtml.clone().appendTo(listObj);
46
              myRefresh.endBottomLoading(); //最后调用
47
            }
48
          }
49
        }, 1000);
50
      }
51
52
      // 搜索
53
      return function searchData() { // 刷新数据
54
        myRefresh.enableBottom(false);
55
        if (myRefresh.bottomLoading) {
56
          myRefresh.endBottomLoading();
57
        }
58
59
        currentPage = 0;
60
        listObj.empty();
61
        myRefresh.enableBottom(true);
62
        myRefresh.refresh();
63
      }
64
    }
65
66
  })
67
});

+ 67 - 0
2019/bj-zqzt/biz/js/pon-resource-search.js

@ -0,0 +1,67 @@
1
require(['jquery', 'ipuUI'], function ($, ipuUI) {
2
  $(function () {
3
    var search = showResList();
4
5
    //点击搜索
6
    $('.pon-search-btn').click(function () {
7
      search()
8
    })
9
10
    // 初始化下拉刷新组件
11
    function showResList() {
12
      var totalPage = 3; // 总页数
13
      var currentPage = 1; // 当前显示第几页,因为默认有一些数据了,所以为1
14
      var listObj = $("#refresh ul");
15
      var contentHtml = $("li:lt(5)", listObj).clone(); // 测试用,复制5条数据
16
17
      // 移除初始的数据,并初始currentPage=0;
18
      listObj.empty();
19
      currentPage = 0;
20
      var countNo = 0; // 重要计数器,以此来判断不需要
21
22
      // 初始化下拉刷新
23
      var myRefresh = ipuUI.refresh("#refresh", {
24
        bottomLoadFun: function () { // 加载更多
25
          console.log('加载更多'); // 手势上拉,内容下滚动动
26
          addData();
27
        }
28
      });
29
30
      // 查询数据
31
      function addData(refresh) { // 0搜索,1刷新,2加载更多
32
        $("#refresh .no-result-msg").hide();
33
        currentPage++;
34
        var localCountNo = ++countNo; // 执行查询前,保留当前计数器,当查询返回时进行检查是否最新查询,不是则抛弃查询结果
35
36
        setTimeout(function () { // 模拟延时加载
37
          if (localCountNo == countNo) { // 检查是否最新查询返回数据,不是则抛弃查询结果
38
            // 此处先更新togalPage等信息
39
40
            myRefresh.enableBottom(currentPage < totalPage); // enable应该总是先于endBottom/TopLoading方法执行
41
42
            if (totalPage == 0) {
43
              $("#refresh .no-result-message").show();
44
            } else {
45
              contentHtml.clone().appendTo(listObj);
46
              myRefresh.endBottomLoading(); //最后调用
47
            }
48
          }
49
        }, 1000);
50
      }
51
52
      // 搜索
53
      return function searchData() { // 刷新数据
54
        myRefresh.enableBottom(false);
55
        if (myRefresh.bottomLoading) {
56
          myRefresh.endBottomLoading();
57
        }
58
59
        currentPage = 0;
60
        listObj.empty();
61
        myRefresh.enableBottom(true);
62
        myRefresh.refresh();
63
      }
64
    }
65
66
  })
67
});