1
zj
2026-01-14 af7f754c7eeb82a7ec7570d1396ff91848d83ca7
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.nq.config;
 
import com.nq.dao.RealTimeMapper;
import com.nq.pojo.RealTime;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
 
public class StockTask implements Runnable {
    @Resource
    RealTimeMapper realTimeMapper;
 
    private Object[] split;
 
    private String stockGid;
 
    /*均价*/
    private Double averagePrice;
 
    private StockPoll stockPoll;
 
    public void run() {
        RealTime realTime = new RealTime();
        realTime.setPrice(Double.parseDouble(this.split[1].toString()));
        realTime.setRates(Double.parseDouble(this.split[3].toString()));
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        String time = sdf.format(new Date());
        realTime.setTime(time);
        realTime.setVolumes(Integer.parseInt(this.split[4].toString()));
        String s = this.split[5].toString();
        int index = s.indexOf("\"");
        String substring = s.substring(0, index);
        int amounts = Integer.parseInt(substring);
        realTime.setAmounts(amounts);
        realTime.setStockCode(this.stockGid);
        realTime.setAveragePrice(this.averagePrice);
        List<RealTime> realTimes = new ArrayList<>();
        realTimes.add(realTime);
        this.realTimeMapper.insertRealTime(realTimes);
    }
 
    public void splits(Object[] split) {
        this.split = split;
    }
 
    public void stockGid(String stockGid) {
        this.stockGid = stockGid;
    }
 
    public void averagePrice(Double averagePrice) {
        this.averagePrice = averagePrice;
    }
 
    public void StockPoll(StockPoll stockPoll) {
        this.stockPoll = stockPoll;
    }
 
    public void RealTimeMapper(RealTimeMapper realTimeMapper) {
        this.realTimeMapper = realTimeMapper;
    }
}