更新数据表Qo

This commit is contained in:
liuchengqian 2022-02-28 21:32:34 +08:00
parent 7e3f433e16
commit 9d463735c6
8 changed files with 170 additions and 136 deletions

View File

@ -81,7 +81,7 @@ public class DataDictController {
@Transactional(rollbackOn = Exception.class)
public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo){
Locale locale = LocaleContextHolder.getLocale();
dataDictDao.updateDict(dataDictUpdateQo.getId(),dataDictUpdateQo.getDictChineseName());
dataDictDao.updateDict(dataDictUpdateQo.getId(),dataDictUpdateQo.getInspectionItemName());
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale);
}
}

View File

@ -14,7 +14,7 @@ public class DataDictUpdateQo {
private Integer id;
/**
* 中文名称
* 质检项名称
*/
@NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictUpdateQoUpdate.class})
private String inspectionItemName;

View File

@ -1,9 +1,7 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.DataDictQoInsert;
import com.xkrs.model.validation.DataSourceQoInsert;
import javax.persistence.Column;
import javax.validation.constraints.NotBlank;
/**
@ -11,100 +9,105 @@ import javax.validation.constraints.NotBlank;
* @Date: 2022/1/19 16:37
*/
public class DataSourceQo {
/**
* 机种号
*/
@NotBlank(message = "{DataSource.dataModelNumber.blank}",groups={DataSourceQoInsert.class})
private String dataModelNumber;
/**
* 批次号
*/
@NotBlank(message = "{DataSource.dataBatchNumber.blank}",groups={DataSourceQoInsert.class})
private String dataBatchNumber;
@NotBlank(message = "{DataSource.lotNo.blank}", groups = {DataSourceQoInsert.class})
private String lotNo;
/**
* 机器号
*/
@NotBlank(message = "{DataSource.dataMachineCode.blank}",groups={DataSourceQoInsert.class})
private String dataMachineCode;
@NotBlank(message = "{DataSource.machineNo.blank}", groups = {DataSourceQoInsert.class})
private String machineNo;
/**
* 模具
* 物料号
*/
@NotBlank(message = "{DataSource.productNumber.blank}",groups={DataSourceQoInsert.class})
private String productNumber;
@NotBlank(message = "{DataSource.materialNo.blank}", groups = {DataSourceQoInsert.class})
private String materialNo;
/**
* 材料
* 模具号
*/
private String material;
@NotBlank(message = "{DataSource.modelNo.blank}", groups = {DataSourceQoInsert.class})
private String modelNo;
/**
* 变量值
* 零件号
*/
@NotBlank(message = "{DataSource.dataName.blank}",groups={DataSourceQoInsert.class})
private String dataName;
@NotBlank(message = "{DataSource.partNo.blank}", groups = {DataSourceQoInsert.class})
private String partNo;
/**
* 监测的数值
* 检验项代码
*/
@NotBlank(message = "{DataSource.numericalValue.blank}",groups={DataSourceQoInsert.class})
private String numericalValue;
@NotBlank(message = "{DataSource.inspectionItemCode.blank}", groups = {DataSourceQoInsert.class})
private String inspectionItemCode;
public String getDataModelNumber() {
return dataModelNumber;
/**
* 检验数值
*/
@NotBlank(message = "{DataSource.inspectValue.blank}", groups = {DataSourceQoInsert.class})
private String inspectValue;
public DataSourceQo() {
}
public void setDataModelNumber(String dataModelNumber) {
this.dataModelNumber = dataModelNumber;
public String getLotNo() {
return lotNo;
}
public String getDataBatchNumber() {
return dataBatchNumber;
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public void setDataBatchNumber(String dataBatchNumber) {
this.dataBatchNumber = dataBatchNumber;
public String getMachineNo() {
return machineNo;
}
public String getDataMachineCode() {
return dataMachineCode;
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public void setDataMachineCode(String dataMachineCode) {
this.dataMachineCode = dataMachineCode;
public String getMaterialNo() {
return materialNo;
}
public String getProductNumber() {
return productNumber;
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getMaterial() {
return material;
public String getModelNo() {
return modelNo;
}
public void setMaterial(String material) {
this.material = material;
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public void setProductNumber(String productNumber) {
this.productNumber = productNumber;
public String getPartNo() {
return partNo;
}
public String getDataName() {
return dataName;
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public void setDataName(String dataName) {
this.dataName = dataName;
public String getInspectionItemCode() {
return inspectionItemCode;
}
public String getNumericalValue() {
return numericalValue;
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public void setNumericalValue(String numericalValue) {
this.numericalValue = numericalValue;
public String getInspectValue() {
return inspectValue;
}
public void setInspectValue(String inspectValue) {
this.inspectValue = inspectValue;
}
}

View File

@ -1,6 +1,7 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.FileQoInsert;
import javax.validation.constraints.NotBlank;
/**
@ -9,29 +10,35 @@ import javax.validation.constraints.NotBlank;
*/
public class FileQo {
/**
* 机种号
*/
@NotBlank(message = "{FileEntity.fileModelNumber.blank}",groups={FileQoInsert.class})
private String fileModelNumber;
/**
* 批次号
*/
@NotBlank(message = "{FileEntity.fileBatchNumber.blank}",groups={FileQoInsert.class})
private String fileBatchNumber;
@NotBlank(message = "{FileEntity.lotNo.blank}", groups = {FileQoInsert.class})
private String lotNo;
/**
* 机器号
*/
@NotBlank(message = "{FileEntity.fileMachineCode.blank}",groups={FileQoInsert.class})
private String fileMachineCode;
@NotBlank(message = "{FileEntity.machineNo.blank}", groups = {FileQoInsert.class})
private String machineNo;
/**
* 产品编
* 物料
*/
@NotBlank(message = "{FileEntity.fileProductNumber.blank}",groups={FileQoInsert.class})
private String fileProductNumber;
@NotBlank(message = "{FileEntity.materialNo.blank}", groups = {FileQoInsert.class})
private String materialNo;
/**
* 模具号
*/
@NotBlank(message = "{FileEntity.modelNo.blank}", groups = {FileQoInsert.class})
private String modelNo;
/**
* 零件号
*/
@NotBlank(message = "{FileEntity.partNo.blank}", groups = {FileQoInsert.class})
private String partNo;
/**
* 上传模板的路径
@ -39,36 +46,47 @@ public class FileQo {
@NotBlank(message = "{FileEntity.fileUploadPath.blank}", groups = {FileQoInsert.class})
private String fileUploadPath;
public String getFileModelNumber() {
return fileModelNumber;
public FileQo() {
}
public void setFileModelNumber(String fileModelNumber) {
this.fileModelNumber = fileModelNumber;
public String getLotNo() {
return lotNo;
}
public String getFileBatchNumber() {
return fileBatchNumber;
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public void setFileBatchNumber(String fileBatchNumber) {
this.fileBatchNumber = fileBatchNumber;
public String getMachineNo() {
return machineNo;
}
public String getFileMachineCode() {
return fileMachineCode;
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public void setFileMachineCode(String fileMachineCode) {
this.fileMachineCode = fileMachineCode;
public String getMaterialNo() {
return materialNo;
}
public String getFileProductNumber() {
return fileProductNumber;
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public void setFileProductNumber(String fileProductNumber) {
this.fileProductNumber = fileProductNumber;
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getFileUploadPath() {

View File

@ -11,59 +11,76 @@ import javax.validation.constraints.NotBlank;
*/
public class FileUpdateQo {
/**
* 机种号
*/
@NotBlank(message = "{FileEntity.fileModelNumber.blank}",groups={FileUpdateQoUpdate.class})
private String fileModelNumber;
/**
* 批次号
*/
@NotBlank(message = "{FileEntity.fileBatchNumber.blank}",groups={FileUpdateQoUpdate.class})
private String fileBatchNumber;
@NotBlank(message = "{FileEntity.lotNo.blank}", groups = {FileUpdateQoUpdate.class})
private String lotNo;
/**
* 机器号
*/
@NotBlank(message = "{FileEntity.fileMachineCode.blank}",groups={FileUpdateQoUpdate.class})
private String fileMachineCode;
@NotBlank(message = "{FileEntity.machineNo.blank}", groups = {FileUpdateQoUpdate.class})
private String machineNo;
/**
* 产品编
* 物料
*/
@NotBlank(message = "{FileEntity.fileProductNumber.blank}",groups={FileUpdateQoUpdate.class})
private String fileProductNumber;
@NotBlank(message = "{FileEntity.materialNo.blank}", groups = {FileUpdateQoUpdate.class})
private String materialNo;
public String getFileModelNumber() {
return fileModelNumber;
/**
* 模具号
*/
@NotBlank(message = "{FileEntity.modelNo.blank}", groups = {FileUpdateQoUpdate.class})
private String modelNo;
/**
* 零件号
*/
@NotBlank(message = "{FileEntity.partNo.blank}", groups = {FileUpdateQoUpdate.class})
private String partNo;
public FileUpdateQo() {
}
public void setFileModelNumber(String fileModelNumber) {
this.fileModelNumber = fileModelNumber;
public String getLotNo() {
return lotNo;
}
public String getFileBatchNumber() {
return fileBatchNumber;
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public void setFileBatchNumber(String fileBatchNumber) {
this.fileBatchNumber = fileBatchNumber;
public String getMachineNo() {
return machineNo;
}
public String getFileMachineCode() {
return fileMachineCode;
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public void setFileMachineCode(String fileMachineCode) {
this.fileMachineCode = fileMachineCode;
public String getMaterialNo() {
return materialNo;
}
public String getFileProductNumber() {
return fileProductNumber;
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public void setFileProductNumber(String fileProductNumber) {
this.fileProductNumber = fileProductNumber;
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
}

View File

@ -25,6 +25,7 @@ public class DataDictServiceImpl implements DataDictService {
/**
* 添加字典数据
*
* @param dataDictQo
* @return
*/
@ -37,13 +38,13 @@ public class DataDictServiceImpl implements DataDictService {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale);
}*/
//DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName());
DataDict englishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName());
DataDict englishName = dataDictDao.findByDictEnglishName(dataDictQo.getInspectionItemCode());
if (englishName != null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale);
}
DataDict dataDict = new DataDict();
dataDict.setDictChineseName(dataDictQo.getDictChineseName());
dataDict.setDictEnglishName(dataDictQo.getDictEnglishName());
dataDict.setInspectionItemName(dataDictQo.getInspectionItemName());
dataDict.setInspectionItemCode(dataDictQo.getInspectionItemCode());
dataDictDao.save(dataDict);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}

View File

@ -36,23 +36,18 @@ public class DataSourceServiceImpl implements DataSourceService {
@Override
public String insertDataSource(DataSourceQo dataSourceQo) {
Locale locale = LocaleContextHolder.getLocale();
DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataSourceQo.getDataName());
DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataSourceQo.getInspectionItemCode());
if(byDictEnglishName == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"不存在该字典类型!",locale);
}
/*DataSource byDataName = dataSourceDao.findByDataName(dataSourceQo.getDataName());
if(byDataName != null){
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该字典类型数据已添加,请勿重复添加!",locale);
}*/
DataSource dataSource = new DataSource();
dataSource.setDataModelNumber(dataSourceQo.getDataModelNumber());
dataSource.setDataBatchNumber(dataSourceQo.getDataBatchNumber());
dataSource.setDataMachineCode(dataSourceQo.getDataMachineCode());
dataSource.setProductNumber(dataSourceQo.getProductNumber());
dataSource.setMaterial(dataSourceQo.getMaterial());
dataSource.setDataName(dataSourceQo.getDataName());
dataSource.setNumericalValue(dataSourceQo.getNumericalValue());
dataSource.setLotNo(dataSourceQo.getLotNo());
dataSource.setMachineNo(dataSourceQo.getMachineNo());
dataSource.setMaterialNo(dataSourceQo.getMaterialNo());
dataSource.setModelNo(dataSourceQo.getModelNo());
dataSource.setPartNo(dataSourceQo.getPartNo());
dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode());
dataSource.setInspectValue(dataSourceQo.getInspectValue());
dataSourceDao.save(dataSource);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale);
}

View File

@ -58,12 +58,12 @@ public class FileServiceImpl implements FileService {
}
String file = ExcelUploadUtil.memoryFile(fileExcel);
FileEntity fileEntity1 = new FileEntity();
fileEntity1.setFileModelNumber(fileQo.getFileModelNumber());
fileEntity1.setFileBatchNumber(fileQo.getFileBatchNumber());
fileEntity1.setFileMachineCode(fileQo.getFileMachineCode());
fileEntity1.setFileProductNumber(fileQo.getFileProductNumber());
fileEntity1.setLotNo(fileQo.getLotNo());
fileEntity1.setMachineNo(fileQo.getMachineNo());
fileEntity1.setMaterialNo(fileQo.getMaterialNo());
fileEntity1.setModelNo(fileQo.getModelNo());
fileEntity1.setPartNo(fileQo.getPartNo());
fileEntity1.setFileUploadPath(file);
fileDao.save(fileEntity1);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale);
}
@ -86,7 +86,7 @@ public class FileServiceImpl implements FileService {
if(maps == null || maps.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的信息!",locale);
}
Map<String,String> map = new HashMap<String,String>();
Map<String,String> map = new HashMap<>();
for(Map<String,String> stringMap : maps){
map.put(stringMap.get("dataname"),stringMap.get("numericalvalue"));
}