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;
|
}
|
}
|