industrial_measurement/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java

50 lines
1.7 KiB
Java
Raw Normal View History

2022-02-12 08:48:57 +08:00
package com.xkrs.service.impl;
2022-02-28 13:55:17 +08:00
import com.xkrs.dao.QcInspectionDataSourceDao;
import com.xkrs.dao.QcInspectionItemDictDao;
2022-02-12 08:48:57 +08:00
import com.xkrs.encapsulation.PromptMessageEnum;
2022-02-28 13:55:17 +08:00
import com.xkrs.model.entity.QcInspectionDataSource;
import com.xkrs.model.entity.QcInspectionItemDict;
import com.xkrs.model.qo.QcInspectionDataSourceQo;
2022-02-12 08:48:57 +08:00
import com.xkrs.service.DataSourceService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Locale;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:43
*/
@Service
public class DataSourceServiceImpl implements DataSourceService {
@Resource
2022-02-28 13:55:17 +08:00
private QcInspectionDataSourceDao inspectionDataSourceDao;
2022-02-12 08:48:57 +08:00
@Resource
2022-02-28 13:55:17 +08:00
private QcInspectionItemDictDao inspectionItemDictDao;
2022-02-12 08:48:57 +08:00
/**
* 添加测量数据
2022-02-28 13:55:17 +08:00
*
* @param inspectionDataSourceQo
2022-02-12 08:48:57 +08:00
* @return
*/
@Override
2022-02-28 13:55:17 +08:00
public String insertDataSource(QcInspectionDataSourceQo inspectionDataSourceQo) {
2022-02-12 08:48:57 +08:00
Locale locale = LocaleContextHolder.getLocale();
2022-02-28 13:55:17 +08:00
QcInspectionItemDict byDictEnglishName = inspectionItemDictDao.findByInspectionItemCode(inspectionDataSourceQo.getInspectionItemCode());
if (byDictEnglishName == null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该字典类型!", locale);
2022-02-12 08:48:57 +08:00
}
2022-02-28 13:55:17 +08:00
QcInspectionDataSource qcInspectionDataSource = new QcInspectionDataSource();
//TODO 补充字段
inspectionDataSourceDao.save(qcInspectionDataSource);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
2022-02-12 08:48:57 +08:00
}
}