package org.jeecg.modules.mdcJc.service.impl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import org.jeecg.modules.mdc.util.DateUtils;
|
import org.jeecg.modules.mdcJc.entity.MdcProductMonthlyschedule;
|
import org.jeecg.modules.mdcJc.entity.ProductMonthlyschedule;
|
import org.jeecg.modules.mdcJc.mapper.MdcProductMonthScheduleMapper;
|
import org.jeecg.modules.mdcJc.service.IClassMonthlyscheduleService;
|
import org.jeecg.modules.mdcJc.service.IMdcProductMonthScheduleService;
|
import org.jeecg.modules.utils.BeanMapper;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* @author clown
|
* * @date 2024/7/17
|
*/
|
@Service
|
public class MdcProductMonthScheduleServiceImp extends ServiceImpl<MdcProductMonthScheduleMapper,MdcProductMonthlyschedule> implements IMdcProductMonthScheduleService {
|
|
@Autowired
|
private IClassMonthlyscheduleService classMonthlyscheduleService;
|
|
@Override
|
public boolean scheduleProductMonthList() {
|
String date = DateUtils.format(DateUtils.getNow(),DateUtils.STR_YEAR_MONTH);
|
List<ProductMonthlyschedule> list = classMonthlyscheduleService.findListProductMonth(date);
|
if (list == null || list.isEmpty()) {
|
return true;
|
}
|
List<String> mdcListIds = super.baseMapper.selectDateList(date);
|
if (mdcListIds != null && !mdcListIds.isEmpty()) {
|
this.removeBatchByIds(mdcListIds);
|
}
|
List<MdcProductMonthlyschedule> mesC = new ArrayList<>();
|
for (ProductMonthlyschedule c : list) {
|
MdcProductMonthlyschedule mdc = new MdcProductMonthlyschedule();
|
BeanMapper.copy(c,mdc);
|
mesC.add(mdc);
|
}
|
boolean b = this.saveBatch(mesC);
|
return b;
|
}
|
}
|