燕山石化项目数据提取服务
xing
2023-02-24 08c8552eb977f27304a4785e5a671905463d83c1
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
package com.terra.bigdata.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.terra.bigdata.domain.Yssh2dreli;
import com.terra.bigdata.domain.Yssh3dreli;
import com.terra.bigdata.mapper.Yssh3dreliMapper;
import com.terra.bigdata.service.Yssh3dreliService;
import lombok.Synchronized;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
 
 
/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author hyy
 * @since 2022-12-22
 */
@Service
public class Yssh3dreliServiceImpl extends ServiceImpl<Yssh3dreliMapper, Yssh3dreli> implements Yssh3dreliService {
 
    @Autowired
    private Yssh3dreliMapper yssh3dreliMapper;
 
    /**
     * 创建3维热力表接口
     */
    /*@Transactional(rollbackFor = Exception.class)
    @Synchronized
    @Override
    public int create3dreliTable() {
        String tablePrefix = "yssh_3dreli_";
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        Calendar calendar = Calendar.getInstance();
        //明天
        calendar.add(Calendar.DATE, +1);
        Date start = calendar.getTime();
        String tomorrow = dateFormat.format(start);
        String tableName = tablePrefix + tomorrow;
        System.out.println("tableName = " + tableName);
 
 
        return yssh3dreliMapper.create3dreliTable(tableName);
    }
*/
 
    /**
     * 创建3维热力表接口
     */
    @Transactional(rollbackFor = Exception.class)
    @Synchronized
    @Override
    public int create3dreliTable() {
        String tablePrefix = "yssh_3dreli_";
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        Calendar calendar = Calendar.getInstance();
        //明天
        calendar.add(Calendar.DATE, +1);
        Date start = calendar.getTime();
        String tomorrow = dateFormat.format(start);
        String tableName = tablePrefix + tomorrow;
        System.out.println("tableName = " + tableName);
 
        //把新增的表增加到字典表中
        /*DictRecord dictRecord =new DictRecord();
        dictRecord.setTableName(tableName);
        dictRecord.setResOne("3");
        dictRecord.setResTwo(tomorrow);
        dictRecordMapper.insertDictRecord(dictRecord);*/
        return yssh3dreliMapper.create3dreliTable(tableName);
    }
 
 
    /**
     * 创建2维热力表接口
     */
    @Transactional(rollbackFor = Exception.class)
    @Synchronized
    @Override
    public int create2dreliTable() {
        String tablePrefix = "yssh_2dreli_";
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        Calendar calendar = Calendar.getInstance();
        //明天
        calendar.add(Calendar.DATE, +1);
        Date start = calendar.getTime();
        String tomorrow = dateFormat.format(start);
        String tableName = tablePrefix + tomorrow;
        System.out.println("tableName = " + tableName);
        return yssh3dreliMapper.create2dreliTable(tableName);
    }
 
 
    /**
     * 新增3维热力记录
     *
     * @param yssh3dreli 3维热力记录
     * @return 结果
     */
    @Override
    public int insert3dreliData(Yssh3dreli yssh3dreli) {
        String tablePrefix = "yssh_3dreli_";
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        String localDday = dateFormat.format(date);
        System.out.println("localDday = " + localDday);
        String tableName = tablePrefix + localDday;
        return yssh3dreliMapper.insert3dreliData(tableName, yssh3dreli);
    }
 
 
    /**
     * 批量新增3维热力记录
     *
     * @param yssh3dreli 3维热力记录
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    @Synchronized
    @Override
    public int batchInsert3dreliData(List<Yssh3dreli> yssh3dreli) {
        /*Yssh3dreli yssh3dreli1 =new Yssh3dreli();
        for (Yssh3dreli yssh3dre2: yssh3dreli) {
            System.out.println("yssh3dre2 = " + yssh3dre2.getName());
            yssh3dreli1.setName(yssh3dre2.getName());
            yssh3dreli1.setLat(yssh3dre2.getLat());
            yssh3dreli1.setLon(yssh3dre2.getLon());
            yssh3dreli1.setHeight0(yssh3dre2.getHeight0());
            yssh3dreli1.setHeight10(yssh3dre2.getHeight10());
            yssh3dreli1.setHeight20(yssh3dre2.getHeight20());
            yssh3dreli1.setHeight30(yssh3dre2.getHeight30());
            yssh3dreli1.setHeight40(yssh3dre2.getHeight40());
            yssh3dreli1.setHeight50(yssh3dre2.getHeight50());
            yssh3dreli1.setHeight60(yssh3dre2.getHeight60());
            yssh3dreli1.setHeight70(yssh3dre2.getHeight70());
            yssh3dreli1.setHeight80(yssh3dre2.getHeight80());
            yssh3dreli1.setHeight90(yssh3dre2.getHeight90());
            yssh3dreli1.setTime(yssh3dre2.getTime());
        }*/
        String tablePrefix = "yssh_3dreli_";
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        String localDday = dateFormat.format(date);
        String tableName = tablePrefix + localDday;
        return yssh3dreliMapper.batchInsert3dreliData(tableName, yssh3dreli);
    }
 
    /**
     * 批量新增2维热力记录
     *
     * @param yssh2drelis 2维热力记录
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    @Synchronized
    @Override
    public int batchInsert2dreliData(List<Yssh2dreli> yssh2drelis) {
        String tablePrefix = "yssh_2dreli_";
        Date date = new Date();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
        String localDday = dateFormat.format(date);
        String tableName = tablePrefix + localDday;
        return yssh3dreliMapper.batchInsert2dreliData(tableName, yssh2drelis);
    }
 
 
    /**
     * 删除3维热力表接口
     */
    @Transactional(rollbackFor = Exception.class)
    @Synchronized
    @Override
    public int drop3dreliTable() {
        String tablePrefix = "yssh_3dreli_";
        //定义日期格式
        SimpleDateFormat format2 = new SimpleDateFormat("yyyyMMdd");
        Calendar calendar = Calendar.getInstance();
        //前一年
        calendar.add(Calendar.YEAR, -1);
        Date start = calendar.getTime();
        String yearBefore = format2.format(start);
        String tableName = tablePrefix + yearBefore;
        return yssh3dreliMapper.drop3dreliTable(tableName);
    }
 
}