hyingbo
6 天以前 cc0e9036de6e922e8fe254fef01d8de9996024b7
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
package org.jeecg.modules.mdc.service.impl;
 
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.mdc.constant.MdcConstant;
import org.jeecg.modules.mdc.entity.MdcPlanClose;
import org.jeecg.modules.mdc.mapper.MdcPlanCloseMapper;
import org.jeecg.modules.mdc.service.IMdcPlanCloseService;
import org.springframework.stereotype.Service;
 
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
 
 
/**
 * @Description: mdc计划停机维护表
 * @Author: Lius
 * @Date: 2023-07-13
 * @Version: V1.0
 */
@Service
public class MdcPlanCloseServiceImpl extends ServiceImpl<MdcPlanCloseMapper, MdcPlanClose> implements IMdcPlanCloseService {
 
    @Override
    public BigDecimal findPlanTimeDuration(BigDecimal actualWorkDayCount, String planCloseType) {
        BigDecimal result = new BigDecimal("0");
        List<MdcPlanClose> mdcPlanCloses = this.baseMapper.selectList(new LambdaQueryWrapper<MdcPlanClose>().in(MdcPlanClose::getPlanCloseType, Arrays.asList(planCloseType.split(","))));
        if (mdcPlanCloses != null && !mdcPlanCloses.isEmpty()) {
            for (MdcPlanClose mdcPlanClose : mdcPlanCloses) {
                switch (mdcPlanClose.getPlanCloseTimeType()) {
                    case MdcConstant.DAY:
                        result = result.add(actualWorkDayCount.multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())));
                        break;
                    case MdcConstant.WEEK:
                        result = result.add(new BigDecimal("4").multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())));
                        break;
                    case MdcConstant.MONTH:
                        result = result.add(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()));
                        break;
                    default:
                        break;
                }
            }
        }
        return result;
    }
}