From 3f07ab2e03e501ae55d1d1b0d031daf50c8e13e5 Mon Sep 17 00:00:00 2001 From: dongyukun <1208714201@qq.com> Date: 星期二, 10 十二月 2024 17:27:44 +0800 Subject: [PATCH] common依赖排除父类 --- iailab-xmc-pms-biz/src/main/java/com/iailab/module/pms/coalquality/modules/detection/service/impl/QualityQuickServiceImpl.java | 99 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 99 insertions(+), 0 deletions(-) diff --git a/iailab-xmc-pms-biz/src/main/java/com/iailab/module/pms/coalquality/modules/detection/service/impl/QualityQuickServiceImpl.java b/iailab-xmc-pms-biz/src/main/java/com/iailab/module/pms/coalquality/modules/detection/service/impl/QualityQuickServiceImpl.java new file mode 100644 index 0000000..e60f908 --- /dev/null +++ b/iailab-xmc-pms-biz/src/main/java/com/iailab/module/pms/coalquality/modules/detection/service/impl/QualityQuickServiceImpl.java @@ -0,0 +1,99 @@ +package com.iailab.module.pms.coalquality.modules.detection.service.impl; + + +import com.iailab.framework.common.pojo.PageResult; +import com.iailab.framework.common.service.impl.BaseServiceImpl; +import com.iailab.framework.common.util.object.BeanUtils; +import com.iailab.framework.common.util.object.ConvertUtils; +import com.iailab.iems.common.utils.SerialNumUtils; +import com.iailab.module.pms.coalquality.modules.detection.dao.QualityQuickDao; +import com.iailab.module.pms.coalquality.modules.detection.dto.QualityQuickDTO; +import com.iailab.module.pms.coalquality.modules.detection.dto.QualityQuickItemDTO; +import com.iailab.module.pms.coalquality.modules.detection.entity.QualityQuickEntity; +import com.iailab.module.pms.coalquality.modules.detection.service.QualityQuickItemService; +import com.iailab.module.pms.coalquality.modules.detection.service.QualityQuickService; +import com.iailab.module.pms.coalquality.modules.detection.vo.QuickPageReqVO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author DongYukun + * @Description + * @createTime 2023年12月27日 9:53:00 + */ +@Slf4j +@Service +public class QualityQuickServiceImpl extends BaseServiceImpl<QualityQuickDao, QualityQuickEntity> + implements QualityQuickService { + + @Autowired + private SerialNumUtils serialNumUtils; + + private String BUSINESS_CODE = "QualityQuick"; + + @Autowired + private QualityQuickItemService qualityQuickItemService; + + @Override + public PageResult<QualityQuickDTO> page(QuickPageReqVO reqVO) { + PageResult<QualityQuickEntity> page = baseDao.selectPage(reqVO); + + return BeanUtils.toBean(page, QualityQuickDTO.class); + } + + @Override + public QualityQuickDTO get(String id) { + QualityQuickEntity entity = baseDao.selectById(id); + QualityQuickDTO dto = ConvertUtils.sourceToTarget(entity, QualityQuickDTO.class); + Map<String, Object> parmas = new HashMap<>(1); + parmas.put("lsh", dto.getLsh()); + List<QualityQuickItemDTO> itemList = qualityQuickItemService.queryList(parmas); + dto.setItemList(itemList); + return dto; + } + + @Override + public void save(QualityQuickDTO dto) { + dto.setLsh(serialNumUtils.getByBusinessDate(BUSINESS_CODE, dto.getDatetime(), 4)); + QualityQuickEntity entity = ConvertUtils.sourceToTarget(dto, QualityQuickEntity.class); + insert(entity); + dto.getItemList().stream().forEach( + item->{ + item.setLsh(dto.getLsh()); + qualityQuickItemService.save(item); + } + ); + } + + @Override + public void update(QualityQuickDTO dto) { + QualityQuickEntity entity = ConvertUtils.sourceToTarget(dto, QualityQuickEntity.class); + updateById(entity); + qualityQuickItemService.deleteByLsh(dto.getLsh()); + + dto.getItemList().forEach( + item->{ + item.setLsh(dto.getLsh()); + qualityQuickItemService.save(item); + } + ); + + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + QualityQuickEntity dto = baseDao.selectById(ids[0]); + baseDao.deleteByIds(Arrays.asList(ids)); + qualityQuickItemService.deleteByLsh(dto.getLsh()); + } + + +} -- Gitblit v1.9.3