选煤厂生产管理平台后台代码
Jay
6 天以前 8d3ff63ab144ad6b48015b01196bc901944a48f9
提交 | 用户 | 时间
7e21bc 1 package com.iailab.module.pms.coalquality.modules.detection.service.impl;
J 2
3
4 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 import com.iailab.framework.common.pojo.PageResult;
6 import com.iailab.framework.common.service.impl.BaseServiceImpl;
7 import com.iailab.framework.common.util.object.BeanUtils;
8 import com.iailab.framework.common.util.object.ConvertUtils;
8d3ff6 9 import com.iailab.module.pms.coalquality.common.utils.SerialNumUtils;
7e21bc 10 import com.iailab.module.pms.coalquality.modules.detection.dao.QualityTailingDao;
J 11 import com.iailab.module.pms.coalquality.modules.detection.dto.QualityTailingDTO;
12 import com.iailab.module.pms.coalquality.modules.detection.entity.QualityTailingEntity;
13 import com.iailab.module.pms.coalquality.modules.detection.service.QualityTailingService;
14 import com.iailab.module.pms.coalquality.modules.detection.vo.TailingPageReqVO;
15 import lombok.extern.slf4j.Slf4j;
16 import org.apache.commons.lang3.StringUtils;
17 import org.springframework.stereotype.Service;
18 import org.springframework.transaction.annotation.Transactional;
19
20 import java.util.Arrays;
21 import java.util.Date;
22
23 /**
24  * 尾矿检测
25  *
26  * @author PanZhibao
27  * @Description
28  * @createTime 2023年02月07日 17:27:00
29  */
30 @Slf4j
31 @Service
32 public class QualityTailingServiceImpl extends BaseServiceImpl<QualityTailingDao, QualityTailingEntity>
33         implements QualityTailingService {
34
35     private String BUSINESS_CODE = "QualityTailing";
36
37     @Override
38     public PageResult<QualityTailingDTO> page(TailingPageReqVO reqVO) {
39         PageResult<QualityTailingEntity> page = baseDao.selectPage(reqVO);
40
41         return BeanUtils.toBean(page, QualityTailingDTO.class);
42     }
43
44     @Override
45     public QualityTailingDTO get(String id) {
46         QualityTailingEntity entity = baseDao.selectById(id);
47
48         return ConvertUtils.sourceToTarget(entity, QualityTailingDTO.class);
49     }
50
51     @Override
52     public void save(QualityTailingDTO dto) {
53
54         dto.setCode(SerialNumUtils.getSerialNum("", dto.getRq(), dto.getBc()));
55         QualityTailingEntity entity = ConvertUtils.sourceToTarget(dto, QualityTailingEntity.class);
56         entity.setCreateDate(new Date());
57 //        entity.setCreator(SecurityUser.getUserId().toString());
58         insert(entity);
59     }
60
61     @Override
62     public void update(QualityTailingDTO dto) {
63         QualityTailingEntity entity = ConvertUtils.sourceToTarget(dto, QualityTailingEntity.class);
64         entity.setUpdateDate(new Date());
65 //        entity.setUpdater(SecurityUser.getUserId().toString());
66         updateById(entity);
67     }
68
69     @Override
70     @Transactional(rollbackFor = Exception.class)
71     public void delete(String[] ids) {
72         baseDao.deleteBatchIds(Arrays.asList(ids));
73     }
74
75     @Override
76     public Long cheack(QualityTailingDTO dto) {
77         String id = dto.getId();
78         String code = dto.getCode();
79
80         QueryWrapper<QualityTailingEntity> queryWrapper = new QueryWrapper<>();
81         queryWrapper.ne(StringUtils.isNotBlank(id), "id", id);
82         queryWrapper.and(wrapper -> wrapper.eq("code", code));
83         return baseDao.selectCount(queryWrapper);
84     }
85
86
87 }