whyclxw
2020-08-24 02be4b868dd46e9ba5c3bbcc71e737db74a71759
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.watersystem.monitor;
 
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import com.base.Com;
import com.sql.MysqlConnPool;
 
public class Watersystem_ServerSocket_Thread implements Runnable{
    public List<Water_inf> winfs;
    public MysqlConnPool conn_pool;
    public Map<Integer, Watersystem_SocketClient_Thread> winfthreads;
    
    public Watersystem_ServerSocket_Thread(MysqlConnPool conn_pool,List<Water_inf> winfs) {
        this.winfs = winfs;
        this.conn_pool = conn_pool;
        this.winfthreads = new HashMap<Integer,Watersystem_SocketClient_Thread>();
    }
 
    @Override
    public void run() {
        // TODO Auto-generated method stub
        System.out.println(" Watersystem_ServerSocket_Thread Start at " +Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms));
        for(int i = 0;i<winfs.size();i++) {
            //²åÈë»ò¸üÐÂË®ÀäϵͳʵʱÐÅÏ¢±í
            Water_Task_SQL.replace_water_rt(conn_pool, new Water_rt(winfs.get(i).getWater_id()));
            //²åÈë»ò¸üÐÂË®Àäϵͳ·Ö֧ʵʱÐÅÏ¢±í
            Water_Task_SQL.replace_water_brach(conn_pool, new Water_brach(winfs.get(i).getWater_id()));
            //²åÈë»ò¸üÐÂË®Àäϵͳʵʱ״̬±í
            Water_Task_SQL.replace_water_state(conn_pool, new Water_state(winfs.get(i).getWater_id()));
            
            Watersystem_SocketClient_Thread thread = new Watersystem_SocketClient_Thread(winfs.get(i),conn_pool);
            winfthreads.put(winfs.get(i).water_id, thread);
            new Thread(thread).start();
        }
    }
    
}