yb
昨天 dadf90a142175590766a8bfdbc2a5486d707fa43
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
package org.jeecg.modules.mdc.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.mdc.dto.MdcEquProDto;
import org.jeecg.modules.mdc.dto.MdcEquipmentMagnificationDto;
import org.jeecg.modules.mdc.entity.Equipment;
import org.jeecg.modules.mdc.entity.MdcDriveTypeParamConfig;
import org.jeecg.modules.mdc.entity.MdcEquipmentMagnification;
import org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection;
import org.jeecg.modules.mdc.mapper.MdcEquipmentMagnificationMapper;
import org.jeecg.modules.mdc.service.*;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.vo.MdcEquipmentMagnificationVo;
import org.jeecg.modules.mdc.vo.MdcMagnificationEquipmentVo;
import org.jeecg.modules.mdc.vo.MdcMagnificationVo;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.jeecg.modules.system.service.ISysDepartService;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
 
@Service
public class MdcEquipmentMagnificationServiceImpl extends ServiceImpl<MdcEquipmentMagnificationMapper, MdcEquipmentMagnification> implements IMdcEquipmentMagnificationService {
 
    @Resource
    private IEquipmentService equipmentService;
    @Resource
    private IMdcDriveTypeParamConfigService mdcDriveTypeParamConfigService;
    @Resource
    private IMdcEquipmentRunningSectionService mdcEquipmentRunningSectionService;
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Resource
    private ISysDepartService sysDepartService;
    @Resource
    private IMdcProductionService mdcProductionService;
 
 
    private static String spindlebeilv = "主轴倍率";
    private static String feedbeilv = "进给倍率";
    @Override
    public void savesEquipmentMagnifications(String dateTime) {
        List<MdcEquipmentMagnification> magnifications = new ArrayList<>();
        //主轴倍率
        //进给倍率
       /* Equipment e = equipmentService.getById("12345678");
        List<Equipment> equipmentList = new ArrayList<>();
        equipmentList.add(e);*/
        if (org.apache.commons.lang.StringUtils.isNotBlank(dateTime)) {
            try {
                Date initDate = DateUtils.toDate(dateTime, "yyyyMMdd");
                String date = DateUtils.format(initDate,DateUtils.STR_DATE);
                if (initDate != null) {
                    this.remove(new LambdaQueryWrapper<MdcEquipmentMagnification>().eq(MdcEquipmentMagnification::getTheDate, date));
                }
            } catch (Exception ee) {
                log.error("参数格式不对", ee);
            }
        }
        List<Equipment> equipmentList = equipmentService.list();
        Map<String,List<MdcDriveTypeParamConfig>> map = new HashMap<>();
        Date now =  DateUtils.plusTime(DateUtils.getNow(), -1);
        for (Equipment equipment : equipmentList) {
            Date start = null;
            //查询最后一条记录
            MdcEquipmentMagnification mdcMagnification = super.baseMapper.getMaxStaticsData(equipment.getEquipmentid());
            if (mdcMagnification == null) {
                start = DateUtils.plusTime(DateUtils.getNow(), -20);
            } else {
                start = DateUtils.toDate(mdcMagnification.getTheDate(),DateUtils.STR_DATE );
                if (now.toString().equals(start.toString())) {
                    continue;
                }
            }
            List<String> dates = DateUtils.getDatesStringList(start,now);
            List<MdcDriveTypeParamConfig> list = new ArrayList<>();
            if (!map.containsKey(equipment.getDrivetype())) {
                MdcDriveTypeParamConfig config1 = mdcDriveTypeParamConfigService.getEnglishName(spindlebeilv,equipment.getDrivetype());
                MdcDriveTypeParamConfig config2 = mdcDriveTypeParamConfigService.getEnglishName(feedbeilv,equipment.getDrivetype());
                if (config1 != null) {
                    list.add(config1);
                }
                if (config2 != null ) {
                    list.add(config2);
                }
                if (list == null || list.size() == 0) {
                    for (String date : dates) {
                        MdcEquipmentMagnification info = new MdcEquipmentMagnification();
                        info.setEquipmentId(equipment.getEquipmentid());
                        info.setTheDate(date);
                        info.setSpindlebeilv(new BigDecimal(0));
                        info.setFeedbeilv(new BigDecimal(0));
                        magnifications.add(info);
                    }
                    continue;
                } else {
                    map.put(equipment.getDrivetype(), list);
                }
 
            } else {
                list = map.get(equipment.getDrivetype());
            }
            //循环时间
            //查询字段 MAP 保存
            for (String date : dates) {
                MdcEquipmentMagnification magnification = selectMagnification(equipment.getEquipmentid(),date,equipment.getDrivetype(), list);
                magnifications.add(magnification);
            }
        }
        if (!magnifications.isEmpty() && magnifications.size() > 0) {
            saveBatch(magnifications);
        }
        //数据保存
        return;
    }
 
    @Override
    public IPage<MdcEquipmentMagnification> pageList(String userId, MdcEquipmentMagnificationVo magnificationVo, Integer pageNo, Integer pageSize, HttpServletRequest req) {
        IPage<MdcEquipmentMagnification> pageData = new Page<>(pageNo, pageSize);
        List<String> equipmentIds = new ArrayList<>();
        if (StringUtils.isNotEmpty(magnificationVo.getParentId()) && StringUtils.isEmpty(magnificationVo.getEquipmentId())) {
            if ("2".equals(magnificationVo.getTypeTree())) {
                // 部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, magnificationVo.getParentId());
            } else {
                // 产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, magnificationVo.getParentId());
            }
        } else if (StringUtils.isNotEmpty(magnificationVo.getEquipmentId())) {
            // 单台设备信息
            magnificationVo.setEquipmentIdList(Collections.singletonList(magnificationVo.getEquipmentId()));
        } else {
            // 查询用户拥有的所有设备信息
            if ("2".equals(magnificationVo.getTypeTree())) {
                //部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null);
            } else {
                //产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null);
            }
        }
        if (magnificationVo.getEquipmentIdList() == null || magnificationVo.getEquipmentIdList().isEmpty()) {
            magnificationVo.setEquipmentIdList(equipmentIds);
        }
        if (magnificationVo.getEquipmentIdList() == null || magnificationVo.getEquipmentIdList().isEmpty()) {
            return null;
        }
        return this.baseMapper.pageList(pageData, magnificationVo);
    }
 
    @Override
    public ModelAndView exportXls(String userId, MdcEquipmentMagnificationVo magnificationVo) {
        List<String> equipmentIds = new ArrayList<>();
        if (StringUtils.isNotEmpty(magnificationVo.getParentId()) && StringUtils.isEmpty(magnificationVo.getEquipmentId())) {
            if ("2".equals(magnificationVo.getTypeTree())) {
                // 部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, magnificationVo.getParentId());
            } else {
                // 产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, magnificationVo.getParentId());
            }
        } else if (StringUtils.isNotEmpty(magnificationVo.getEquipmentId())) {
            // 单台设备信息
            magnificationVo.setEquipmentIdList(Collections.singletonList(magnificationVo.getEquipmentId()));
        } else {
            // 查询用户拥有的所有设备信息
            if ("2".equals(magnificationVo.getTypeTree())) {
                //部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null);
            } else {
                //产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null);
            }
        }
        if (magnificationVo.getEquipmentIdList() == null || magnificationVo.getEquipmentIdList().isEmpty()) {
            magnificationVo.setEquipmentIdList(equipmentIds);
        }
        if (magnificationVo.getEquipmentIdList() == null || magnificationVo.getEquipmentIdList().isEmpty()) {
            return null;
        }
        List<MdcEquipmentMagnificationDto> magnificationDtos = super.baseMapper.list(magnificationVo);
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        // 导出文件名称
        mv.addObject(NormalExcelConstants.FILE_NAME, "倍率报表");
        mv.addObject(NormalExcelConstants.CLASS, MdcEquipmentMagnificationDto.class);
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("倍率报表", "导出人:" + user.getRealname(), "倍率报表"));
        mv.addObject(NormalExcelConstants.DATA_LIST, magnificationDtos);
        return mv;
    }
 
    @Override
    public MdcMagnificationVo beilvsList(MdcEquipmentMagnificationVo vo, String userId) {
        List<MdcMagnificationEquipmentVo> mdcMagnificationVos = new ArrayList<>();
        MdcMagnificationVo result = new MdcMagnificationVo();
        List<String> equipmentIds = new ArrayList<>();
        if (StringUtils.isNotEmpty(vo.getParentId()) && StringUtils.isEmpty(vo.getEquipmentId())) {
            if ("2".equals(vo.getTypeTree())) {
                // 部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, vo.getParentId());
            } else {
                // 产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, vo.getParentId());
            }
        } else if (StringUtils.isNotEmpty(vo.getEquipmentId())) {
            // 单台设备信息
            vo.setEquipmentIdList(Collections.singletonList(vo.getEquipmentId()));
        } else {
            // 查询用户拥有的所有设备信息
            if ("2".equals(vo.getTypeTree())) {
                //部门层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null);
            } else {
                //产线层级
                equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null);
            }
        }
        if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) {
            vo.setEquipmentIdList(equipmentIds);
        }
 
        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
        List<String> dates = DateUtils.getDatesStringList(DateUtils.getShortDate(vo.getStartTime()), DateUtils.getShortDate(vo.getEndTime()));
        result.setDates(dates);
 
        if (vo.getEquipmentIdList() == null || vo.getEquipmentIdList().isEmpty()) {
            result.setMdcMagnificationVos(mdcMagnificationVos);
        } else {
            List<String> equipmentIdList = mdcEquipmentService.listEquipmentMagnificationId(vo);
            if (equipmentIdList != null && !equipmentIdList.isEmpty()) {
                vo.setEquipmentIdList(equipmentIdList);
            } else {
                result.setMdcMagnificationVos(mdcMagnificationVos);
                return result;
            }
            // 查询利用率数据
            List<MdcEquipmentMagnificationDto> magnificationDtos = super.baseMapper.list(vo);
            // 封装结果
            if ("2".equals(vo.getTypeTree())) {
            } else {
                // 产线层级
                List<MdcEquProDto> equipmentList = mdcEquipmentService.findEquProList(vo.getEquipmentIdList());
                // 查询所有产线信息
                List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().ne(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_1.toString()).orderByAsc(MdcProduction::getProductionOrder));
                for (MdcEquProDto mdcEquProDto : equipmentList) {
                    MdcMagnificationEquipmentVo mdcMgVo = new MdcMagnificationEquipmentVo();
                    mdcMgVo.setEquipmentId(mdcEquProDto.getEquipmentId());
                    mdcMgVo.setEquipmentName(mdcEquProDto.getEquipmentName());
                    mdcMgVo.setEquipmentType(mdcEquProDto.getEquipmentType());
                    switch (mdcEquProDto.getOrgType()) {
                        case "1":
                            mdcMgVo.setLevel1(mdcEquProDto.getProductionName());
                            break;
                        case "2":
                            mdcMgVo.setLevel2(mdcEquProDto.getProductionName());
                            break;
                        case "3":
                            mdcMgVo.setLevel3(mdcEquProDto.getProductionName());
                            break;
                        default:
                    }
                    MdcProduction mdcProduction = productionList.stream().filter(production -> production.getId().equals(mdcEquProDto.getParentId())).findAny().orElse(null);
                    if (mdcProduction != null) {
                        switch (mdcProduction.getOrgType()) {
                            case "1":
                                mdcMgVo.setLevel1(mdcProduction.getProductionName());
                                break;
                            case "2":
                                mdcMgVo.setLevel2(mdcProduction.getProductionName());
                                break;
                            case "3":
                                mdcMgVo.setLevel3(mdcProduction.getProductionName());
                                break;
                            default:
                        }
                        if (StringUtils.isNotEmpty(mdcProduction.getParentId())) {
                            productionList.stream().filter(production -> production.getId().equals(mdcProduction.getParentId())).findAny().ifPresent(production1 -> {
                                switch (production1.getOrgType()) {
                                    case "1":
                                        mdcMgVo.setLevel1(production1.getProductionName());
                                        break;
                                    case "2":
                                        mdcMgVo.setLevel2(production1.getProductionName());
                                        break;
                                    case "3":
                                        mdcMgVo.setLevel3(production1.getProductionName());
                                        break;
                                    default:
                                }
                            });
                        }
                    }
                    List<MdcEquipmentMagnificationDto> list = new ArrayList<>();
                    MdcEquipmentMagnificationDto mdcMagnificationDto = new MdcEquipmentMagnificationDto();
                    mdcMagnificationDto.setTheDate("平均值");
                    for (String date : dates) {
                        list.add(this.setDataList(magnificationDtos, date, mdcEquProDto.getEquipmentId(),mdcMagnificationDto));
                    }
                    mdcMagnificationDto.setFeedbeilv(mdcMagnificationDto.getFeedbeilv().divide(new BigDecimal(dates.size()),2, RoundingMode.HALF_UP));
                    mdcMagnificationDto.setSpindlebeilv(mdcMagnificationDto.getSpindlebeilv().divide(new BigDecimal(dates.size()),2, RoundingMode.HALF_UP));
                    list.add(mdcMagnificationDto);
                    mdcMgVo.setMdcBeilvVoList(list);
                    mdcMagnificationVos.add(mdcMgVo);
                }
            }
            result.setMdcMagnificationVos(mdcMagnificationVos);
        }
        // 添加合计值和平均值
 
        result.getDates().add("平均值");
        MdcMagnificationEquipmentVo avg = new MdcMagnificationEquipmentVo();
        avg.setLevel1("平均值");
        avg.setLevel2("平均值");
        avg.setLevel3("平均值");
        avg.setEquipmentId("平均值");
        avg.setEquipmentName("平均值");
        avg.setEquipmentType("平均值");
        //计算平均值
        avg.setMdcBeilvVoList(calculateOpenAverage(result.getMdcMagnificationVos()));
        result.getMdcMagnificationVos().add(avg);
        return result;
    }
 
    /**
     * 计算平均值
     *
     * @param mdcMagnificationVos
     * @return
     */
    private List<MdcEquipmentMagnificationDto> calculateOpenAverage(List<MdcMagnificationEquipmentVo> mdcMagnificationVos) {
        List<MdcEquipmentMagnificationDto> result = new ArrayList<>();
        List<MdcEquipmentMagnificationDto> dataList = new ArrayList<>();
        for (MdcMagnificationEquipmentVo mdcMagnificationEquipmentVo : mdcMagnificationVos) {
            dataList.addAll(mdcMagnificationEquipmentVo.getMdcBeilvVoList());
        }
        dataList.parallelStream().collect(Collectors.groupingBy(MdcEquipmentMagnificationDto::getTheDate, Collectors.toList()))
                .forEach((theDate, mert) -> {
                    mert.stream().reduce((a, b) -> new MdcEquipmentMagnificationDto(
                            a.getTheDate(),
                            a.getFeedbeilv().add(b.getFeedbeilv()),
                            a.getSpindlebeilv().add(b.getSpindlebeilv()))).ifPresent(result::add);
                });
        for (MdcEquipmentMagnificationDto mdcEquipmentMagnificationDto : result) {
            mdcEquipmentMagnificationDto.setSpindlebeilv(mdcEquipmentMagnificationDto.getSpindlebeilv().divide(new BigDecimal(mdcMagnificationVos.size()), 2, RoundingMode.HALF_UP));
            mdcEquipmentMagnificationDto.setFeedbeilv(mdcEquipmentMagnificationDto.getFeedbeilv().divide(new BigDecimal(mdcMagnificationVos.size()), 2, RoundingMode.HALF_UP));
        }
        result.sort(Comparator.comparing(MdcEquipmentMagnificationDto::getTheDate));
        return result;
    }
 
    private MdcEquipmentMagnificationDto setDataList(List<MdcEquipmentMagnificationDto> list,String date,String equipmentId,MdcEquipmentMagnificationDto mdcMagnificationDto) {
        MdcEquipmentMagnificationDto result = new MdcEquipmentMagnificationDto();
        if (list != null && list.size() > 0) {
            for (MdcEquipmentMagnificationDto mdcEquipmentMagnificationDto : list) {
                if (date.equals(mdcEquipmentMagnificationDto.getTheDate()) && mdcEquipmentMagnificationDto.getEquipmentId().equals(equipmentId)) {
                    result.setEquipmentId(equipmentId);
                    result.setSpindlebeilv(mdcEquipmentMagnificationDto.getSpindlebeilv());
                    result.setFeedbeilv(mdcEquipmentMagnificationDto.getFeedbeilv());
                    result.setTheDate(date);
                }
            }
        } else {
            result.setTheDate(date);
            result.setFeedbeilv(new BigDecimal(0));
            result.setEquipmentId(equipmentId);
            result.setSpindlebeilv(new BigDecimal(0));
            return result;
        }
        mdcMagnificationDto.setFeedbeilv(mdcMagnificationDto.getFeedbeilv().add(result.getFeedbeilv()));
        mdcMagnificationDto.setSpindlebeilv(mdcMagnificationDto.getSpindlebeilv().add(result.getSpindlebeilv()));
        return result;
    }
 
 
    private MdcEquipmentMagnification selectMagnification(String equipmentId,String date,String drivetype,List<MdcDriveTypeParamConfig> list) {
        Date startTime = DateUtils.plusTime(DateUtils.getShortDate(date), 0);
        Date endTime = DateUtils.plusTime(DateUtils.getShortDate(date), 1);
        List<MdcEquipmentRunningSection> sectionList = mdcEquipmentRunningSectionService.selectRunningData(equipmentId,startTime,endTime);
        if (sectionList.isEmpty() || sectionList.size() < 1) {
            MdcEquipmentMagnification info = new MdcEquipmentMagnification();
            info.setEquipmentId(equipmentId);
            info.setTheDate(date);
            info.setSpindlebeilv(new BigDecimal(0));
            info.setFeedbeilv(new BigDecimal(0));
            return info;
        } else {
 
            //需要时间截取
            if (sectionList.get(0).getStartTime().before(startTime)) {
                sectionList.get(0).setStartTime(startTime);
            }
            if (sectionList.size() > 1) {
                if (sectionList.get(sectionList.size() - 1).getEndTime().after(endTime)) {
                    sectionList.get(sectionList.size() - 1).setEndTime(endTime);
                }
            } else {
                if (sectionList.get(0).getEndTime().after(endTime)) {
                    sectionList.get(0).setEndTime(endTime);
                }
            }
            MdcEquipmentMagnification info = new MdcEquipmentMagnification();
            for (MdcDriveTypeParamConfig config : list) {
                info.setTheDate(date);
                info.setEquipmentId(equipmentId);
                BigDecimal bigDecimal = new BigDecimal(0);
                int numberSizeList = 0;
                for (MdcEquipmentRunningSection section : sectionList) {
                    List<Object> objects = super.baseMapper.getEquipmentSequenceNumber(drivetype+ "_" + equipmentId,section.getStartTime(),
                            section.getEndTime(),config.getEnglishName());
                    BigDecimal s = objNumberList(objects);
                    bigDecimal = bigDecimal.add(s);
                    numberSizeList += objects.size();
                }
                if (config.getChineseName().equals(spindlebeilv)) {
                    info.setSpindlebeilvValue(bigDecimal);
                    info.setSpindlebeilvNumber(numberSizeList);
                    if (bigDecimal.compareTo(BigDecimal.ZERO) >0  && new BigDecimal(numberSizeList).compareTo(BigDecimal.ZERO) > 0) {
                        info.setSpindlebeilv(bigDecimal.divide(new BigDecimal(numberSizeList),2, RoundingMode.HALF_UP));
                    }
                }
                if (config.getChineseName().equals(feedbeilv)) {
                    info.setFeedbeilvValue(bigDecimal);
                    info.setFeedbeilvNumber(numberSizeList);
                    if (bigDecimal.compareTo(BigDecimal.ZERO) >0  && new BigDecimal(numberSizeList).compareTo(BigDecimal.ZERO) > 0) {
                        info.setFeedbeilv(bigDecimal.divide(new BigDecimal(numberSizeList),2, RoundingMode.HALF_UP));
                    }
                }
            }
            return info;
        }
    }
 
    private BigDecimal objNumberList(List<Object> objects) {
        if (objects == null || objects.size() == 0) {
            return new BigDecimal(0);
        } else {
            BigDecimal bigDecimal = new BigDecimal(0);
            for (Object object : objects) {
                if (object != null && object.toString().length() > 0) {
                    bigDecimal = bigDecimal.add(new BigDecimal(object.toString()));
                }
            }
            return bigDecimal;
        }
    }
}