|
|
@@ -1,6 +1,5 @@
|
|
1
|
1
|
package com.ruoyi.web.modules.industryservice.service;
|
|
2
|
2
|
|
|
3
|
|
-import java.util.Collections;
|
|
4
|
3
|
import java.util.Date;
|
|
5
|
4
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
6
|
5
|
import org.springframework.stereotype.Service;
|
|
|
@@ -11,18 +10,14 @@ import com.ruoyi.common.exception.ServiceException;
|
|
11
|
10
|
import com.ruoyi.common.utils.StringUtils;
|
|
12
|
11
|
import com.ruoyi.web.modules.industryservice.domain.BizPasture;
|
|
13
|
12
|
import com.ruoyi.web.modules.industryservice.domain.BizYakAsset;
|
|
14
|
|
-import com.ruoyi.web.modules.industryservice.domain.BizYakBatchRel;
|
|
15
|
13
|
import com.ruoyi.web.modules.industryservice.domain.BizYakFeedingRecord;
|
|
16
|
|
-import com.ruoyi.web.modules.industryservice.domain.BizYakPenRel;
|
|
17
|
14
|
import com.ruoyi.web.modules.industryservice.domain.BizYakGrowthRecord;
|
|
18
|
15
|
import com.ruoyi.web.modules.industryservice.domain.BizYakPhysioSeries;
|
|
19
|
16
|
import com.ruoyi.web.modules.industryservice.domain.BizYakReproductionRecord;
|
|
20
|
17
|
import com.ruoyi.web.modules.industryservice.domain.dto.YakAssetBundleDto;
|
|
21
|
18
|
import com.ruoyi.web.modules.industryservice.mapper.BizPastureMapper;
|
|
22
|
19
|
import com.ruoyi.web.modules.industryservice.mapper.BizYakAssetMapper;
|
|
23
|
|
-import com.ruoyi.web.modules.industryservice.mapper.BizYakBatchRelMapper;
|
|
24
|
20
|
import com.ruoyi.web.modules.industryservice.mapper.BizYakFeedingRecordMapper;
|
|
25
|
|
-import com.ruoyi.web.modules.industryservice.mapper.BizYakPenRelMapper;
|
|
26
|
21
|
import com.ruoyi.web.modules.industryservice.support.YakAssetStatusMapper;
|
|
27
|
22
|
import com.ruoyi.web.modules.industryservice.mapper.BizYakGrowthRecordMapper;
|
|
28
|
23
|
import com.ruoyi.web.modules.industryservice.mapper.BizYakPhysioSeriesMapper;
|
|
|
@@ -51,12 +46,6 @@ public class YakAssetBundleSyncTxService
|
|
51
|
46
|
@Autowired
|
|
52
|
47
|
private BizYakFeedingRecordMapper feedingRecordMapper;
|
|
53
|
48
|
|
|
54
|
|
- @Autowired
|
|
55
|
|
- private BizYakPenRelMapper penRelMapper;
|
|
56
|
|
-
|
|
57
|
|
- @Autowired
|
|
58
|
|
- private BizYakBatchRelMapper batchRelMapper;
|
|
59
|
|
-
|
|
60
|
49
|
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
|
|
61
|
50
|
public boolean persistBundle(YakAssetBundleDto bundle, Date syncTime)
|
|
62
|
51
|
{
|
|
|
@@ -166,14 +155,6 @@ public class YakAssetBundleSyncTxService
|
|
166
|
155
|
{
|
|
167
|
156
|
feedingRecordMapper.deleteByYakAssetId(yakAssetId);
|
|
168
|
157
|
}
|
|
169
|
|
- if (bundle.getPenRecords() != null || StringUtils.isNotEmpty(bundle.getAsset().getPenLocation()))
|
|
170
|
|
- {
|
|
171
|
|
- penRelMapper.deleteByYakAssetId(yakAssetId);
|
|
172
|
|
- }
|
|
173
|
|
- if (bundle.getBatchRecords() != null || StringUtils.isNotEmpty(bundle.getAsset().getBatchNo()))
|
|
174
|
|
- {
|
|
175
|
|
- batchRelMapper.deleteByYakAssetId(yakAssetId);
|
|
176
|
|
- }
|
|
177
|
158
|
|
|
178
|
159
|
if (!CollectionUtils.isEmpty(bundle.getPhysioSeries()))
|
|
179
|
160
|
{
|
|
|
@@ -215,35 +196,5 @@ public class YakAssetBundleSyncTxService
|
|
215
|
196
|
}
|
|
216
|
197
|
feedingRecordMapper.batchInsert(bundle.getFeedingRecords());
|
|
217
|
198
|
}
|
|
218
|
|
- if (!CollectionUtils.isEmpty(bundle.getPenRecords()))
|
|
219
|
|
- {
|
|
220
|
|
- for (BizYakPenRel row : bundle.getPenRecords())
|
|
221
|
|
- {
|
|
222
|
|
- row.setYakAssetId(yakAssetId);
|
|
223
|
|
- }
|
|
224
|
|
- penRelMapper.batchInsert(bundle.getPenRecords());
|
|
225
|
|
- }
|
|
226
|
|
- else if (StringUtils.isNotEmpty(bundle.getAsset().getPenLocation()))
|
|
227
|
|
- {
|
|
228
|
|
- BizYakPenRel pen = new BizYakPenRel();
|
|
229
|
|
- pen.setYakAssetId(yakAssetId);
|
|
230
|
|
- pen.setPenName(bundle.getAsset().getPenLocation().trim());
|
|
231
|
|
- penRelMapper.batchInsert(Collections.singletonList(pen));
|
|
232
|
|
- }
|
|
233
|
|
- if (!CollectionUtils.isEmpty(bundle.getBatchRecords()))
|
|
234
|
|
- {
|
|
235
|
|
- for (BizYakBatchRel row : bundle.getBatchRecords())
|
|
236
|
|
- {
|
|
237
|
|
- row.setYakAssetId(yakAssetId);
|
|
238
|
|
- }
|
|
239
|
|
- batchRelMapper.batchInsert(bundle.getBatchRecords());
|
|
240
|
|
- }
|
|
241
|
|
- else if (StringUtils.isNotEmpty(bundle.getAsset().getBatchNo()))
|
|
242
|
|
- {
|
|
243
|
|
- BizYakBatchRel batch = new BizYakBatchRel();
|
|
244
|
|
- batch.setYakAssetId(yakAssetId);
|
|
245
|
|
- batch.setBatchNo(bundle.getAsset().getBatchNo().trim());
|
|
246
|
|
- batchRelMapper.batchInsert(Collections.singletonList(batch));
|
|
247
|
|
- }
|
|
248
|
199
|
}
|
|
249
|
200
|
}
|