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/analysis/service/impl/CoalAnalysisFullServiceImpl.java |  115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 115 insertions(+), 0 deletions(-)

diff --git a/iailab-xmc-pms-biz/src/main/java/com/iailab/module/pms/coalquality/modules/analysis/service/impl/CoalAnalysisFullServiceImpl.java b/iailab-xmc-pms-biz/src/main/java/com/iailab/module/pms/coalquality/modules/analysis/service/impl/CoalAnalysisFullServiceImpl.java
new file mode 100644
index 0000000..793a1d8
--- /dev/null
+++ b/iailab-xmc-pms-biz/src/main/java/com/iailab/module/pms/coalquality/modules/analysis/service/impl/CoalAnalysisFullServiceImpl.java
@@ -0,0 +1,115 @@
+package com.iailab.module.pms.coalquality.modules.analysis.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.module.pms.coalquality.modules.analysis.dao.CoalAnalysisFullDao;
+import com.iailab.module.pms.coalquality.modules.analysis.dto.CoalAnalysisFullDTO;
+import com.iailab.module.pms.coalquality.modules.analysis.dto.CoalAnalysisFullDetDTO;
+import com.iailab.module.pms.coalquality.modules.analysis.entity.CoalAnalysisFullEntity;
+import com.iailab.module.pms.coalquality.modules.analysis.service.CoalAnalysisFullDetService;
+import com.iailab.module.pms.coalquality.modules.analysis.service.CoalAnalysisFullService;
+import com.iailab.module.pms.coalquality.modules.analysis.vo.FullPageReqVO;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.text.DecimalFormat;
+import java.util.*;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2023年01月12日 17:09:00
+ */
+@Service
+public class CoalAnalysisFullServiceImpl extends BaseServiceImpl<CoalAnalysisFullDao, CoalAnalysisFullEntity>
+        implements CoalAnalysisFullService {
+
+    @Autowired
+    private CoalAnalysisFullDetService coalAnalysisFullDetService;
+
+    private String BUSINESS_CODE = "CoalAnalysisFull";
+
+    private DecimalFormat df = new DecimalFormat("00");
+
+    @Override
+    public PageResult<CoalAnalysisFullDTO> page(FullPageReqVO fullPageReqVO) {
+        PageResult<CoalAnalysisFullEntity> page = baseDao.selectPage(fullPageReqVO);
+
+        return BeanUtils.toBean(page, CoalAnalysisFullDTO.class);
+    }
+
+
+    @Override
+    public CoalAnalysisFullDTO get(String id) {
+        CoalAnalysisFullEntity entity = baseDao.selectById(id);
+        CoalAnalysisFullDTO dto = ConvertUtils.sourceToTarget(entity, CoalAnalysisFullDTO.class);
+        dto.setDetList(getDetList(dto.getId()));
+        return dto;
+    }
+
+    private List<CoalAnalysisFullDetDTO> getDetList(String fullId) {
+        Map<String, Object> parmas = new HashMap<>(1);
+        parmas.put("fullId", fullId);
+        return coalAnalysisFullDetService.queryList(parmas);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void save(CoalAnalysisFullDTO dto) {
+        dto.setCode(dto.getNy().replace("-", ""));
+        CoalAnalysisFullEntity entity = ConvertUtils.sourceToTarget(dto, CoalAnalysisFullEntity.class);
+        entity.setId(UUID.randomUUID().toString());
+        entity.setCreateDate(new Date());
+        insert(entity);
+
+        List<CoalAnalysisFullDetDTO> detList = dto.getDetList();
+//        if (!CollectionUtils.isEmpty(detList)) {
+//            for (int i = 0; i < detList.size(); i++) {
+//                detList.get(i).setCode(entity.getCode() + df.format(i + 1));
+//                detList.get(i).setFullId(entity.getId());
+//            }
+//            coalAnalysisFullDetService.saveList(detList);
+//        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void update(CoalAnalysisFullDTO dto) {
+        CoalAnalysisFullEntity entity = ConvertUtils.sourceToTarget(dto, CoalAnalysisFullEntity.class);
+        entity.setUpdateDate(new Date());
+        updateById(entity);
+
+        List<CoalAnalysisFullDetDTO> detList = dto.getDetList();
+//        if (!CollectionUtils.isEmpty(detList)) {
+//            detList.forEach(item -> {
+//                item.setFullId(entity.getId());
+//            });
+//            coalAnalysisFullDetService.updateList(detList);
+//        }
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delete(String[] ids) {
+        baseDao.deleteByIds(Arrays.asList(ids));
+//        Arrays.asList(ids).forEach(item -> {
+//            coalAnalysisFullDetService.deleteByFullId(item);
+//        });
+    }
+
+    @Override
+    public Long cheack(CoalAnalysisFullDTO dto) {
+        String id = dto.getId();
+        String code = dto.getCode();
+
+        QueryWrapper<CoalAnalysisFullEntity> queryWrapper = new QueryWrapper<>();
+        queryWrapper.ne(StringUtils.isNotBlank(id), "id", id);
+        queryWrapper.and(wrapper -> wrapper.eq("code", code));
+        return baseDao.selectCount(queryWrapper);
+    }
+}

--
Gitblit v1.9.3