Lius
2023-11-21 80e505b03b3be711aa49662ba2ce35b4fcf516e4
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcPlanCloseServiceImpl.java
@@ -1,11 +1,16 @@
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.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.Collections;
import java.util.List;
/**
@@ -17,4 +22,27 @@
@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, Collections.singletonList(planCloseType)));
        if (mdcPlanCloses != null && !mdcPlanCloses.isEmpty()) {
            for (MdcPlanClose mdcPlanClose : mdcPlanCloses) {
                switch (mdcPlanClose.getPlanCloseTimeType()) {
                    case "天":
                        result = result.add(actualWorkDayCount.multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())));
                        break;
                    case "周":
                        result = result.add(new BigDecimal("4").multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())));
                        break;
                    case "月":
                        result = result.add(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()));
                        break;
                    default:
                        break;
                }
            }
        }
        return result;
    }
}