选煤厂生产管理平台后台代码
Jay
2024-12-10 7e21bc617f3444c5a3b26ed88ea9ea7765e44d34
提交 | 用户 | 时间
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;
9 import com.iailab.iems.common.utils.SerialNumUtils;
10 import com.iailab.module.pms.coalquality.modules.detection.dao.QualityTailingDao;
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.beans.factory.annotation.Autowired;
18 import org.springframework.stereotype.Service;
19 import org.springframework.transaction.annotation.Transactional;
20
21 import java.util.Arrays;
22 import java.util.Date;
23 import java.util.Map;
24
25 /**
26  * 尾矿检测
27  *
28  * @author PanZhibao
29  * @Description
30  * @createTime 2023年02月07日 17:27:00
31  */
32 @Slf4j
33 @Service
34 public class QualityTailingServiceImpl extends BaseServiceImpl<QualityTailingDao, QualityTailingEntity>
35         implements QualityTailingService {
36
37     @Autowired
38     private SerialNumUtils serialNumUtils;
39
40     private String BUSINESS_CODE = "QualityTailing";
41
42     @Override
43     public PageResult<QualityTailingDTO> page(TailingPageReqVO reqVO) {
44         PageResult<QualityTailingEntity> page = baseDao.selectPage(reqVO);
45
46         return BeanUtils.toBean(page, QualityTailingDTO.class);
47     }
48
49     private QueryWrapper<QualityTailingEntity> getWrapper(Map<String, Object> params){
50         String rq = (String)params.get("rq");
51
52         QueryWrapper<QualityTailingEntity> wrapper = new QueryWrapper<>();
53         wrapper.eq(StringUtils.isNotBlank(rq), "rq", rq);
54         return wrapper;
55     }
56
57     @Override
58     public QualityTailingDTO get(String id) {
59         QualityTailingEntity entity = baseDao.selectById(id);
60
61         return ConvertUtils.sourceToTarget(entity, QualityTailingDTO.class);
62     }
63
64     @Override
65     public void save(QualityTailingDTO dto) {
66
67         dto.setCode(SerialNumUtils.getSerialNum("", dto.getRq(), dto.getBc()));
68         QualityTailingEntity entity = ConvertUtils.sourceToTarget(dto, QualityTailingEntity.class);
69         entity.setCreateDate(new Date());
70 //        entity.setCreator(SecurityUser.getUserId().toString());
71         insert(entity);
72     }
73
74     @Override
75     public void update(QualityTailingDTO dto) {
76         QualityTailingEntity entity = ConvertUtils.sourceToTarget(dto, QualityTailingEntity.class);
77         entity.setUpdateDate(new Date());
78 //        entity.setUpdater(SecurityUser.getUserId().toString());
79         updateById(entity);
80     }
81
82     @Override
83     @Transactional(rollbackFor = Exception.class)
84     public void delete(String[] ids) {
85         baseDao.deleteBatchIds(Arrays.asList(ids));
86     }
87
88     @Override
89     public Long cheack(QualityTailingDTO dto) {
90         String id = dto.getId();
91         String code = dto.getCode();
92
93         QueryWrapper<QualityTailingEntity> queryWrapper = new QueryWrapper<>();
94         queryWrapper.ne(StringUtils.isNotBlank(id), "id", id);
95         queryWrapper.and(wrapper -> wrapper.eq("code", code));
96         return baseDao.selectCount(queryWrapper);
97     }
98
99
100 }