修改Controller
This commit is contained in:
parent
2f3a995359
commit
fd01a3a3d6
@ -53,7 +53,8 @@ public class DataDictController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectDataDict")
|
@GetMapping("/selectDataDict")
|
||||||
public String selectDataDict(@RequestParam("inspectionItemName") String inspectionItemName, @RequestParam("inspectionItemCode") String inspectionItemCode) {
|
public String selectDataDict(@RequestParam("inspectionItemName") String inspectionItemName,
|
||||||
|
@RequestParam("inspectionItemCode") String inspectionItemCode) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<DataDict> dataDict = dataDictQuery.selectDataDict(inspectionItemName, inspectionItemCode);
|
List<DataDict> dataDict = dataDictQuery.selectDataDict(inspectionItemName, inspectionItemCode);
|
||||||
if (dataDict == null || dataDict.size() == 0) {
|
if (dataDict == null || dataDict.size() == 0) {
|
||||||
|
@ -45,11 +45,12 @@ public class DataSourceController {
|
|||||||
/**
|
/**
|
||||||
* 查询某一产品的测量信息
|
* 查询某一产品的测量信息
|
||||||
*
|
*
|
||||||
* @param lotNo 批次号
|
* @param lotNo 批次号
|
||||||
* @param machineNo 机器号
|
* @param machineNo 机器号
|
||||||
* @param materialNo 物料号
|
* @param materialNo 物料号
|
||||||
* @param modelNo 模具号
|
* @param modelNo 模具号
|
||||||
* @param partNo 零件号
|
* @param machineTypeNo 机种号
|
||||||
|
* @param craftItemName 工艺项目名称
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectDataSource")
|
@GetMapping("/selectDataSource")
|
||||||
@ -57,9 +58,10 @@ public class DataSourceController {
|
|||||||
@RequestParam(required = false, value = "machineNo") String machineNo,
|
@RequestParam(required = false, value = "machineNo") String machineNo,
|
||||||
@RequestParam(required = false, value = "materialNo") String materialNo,
|
@RequestParam(required = false, value = "materialNo") String materialNo,
|
||||||
@RequestParam(required = false, value = "modelNo") String modelNo,
|
@RequestParam(required = false, value = "modelNo") String modelNo,
|
||||||
@RequestParam(required = false, value = "partNo") String partNo) {
|
@RequestParam(required = false, value = "machineTypeNo") String machineTypeNo,
|
||||||
|
@RequestParam(required = false, value = "craftItemName") String craftItemName) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<DataSource> dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, partNo);
|
List<DataSource> dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
|
||||||
if (dataSources == null || dataSources.size() == 0) {
|
if (dataSources == null || dataSources.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale);
|
||||||
}
|
}
|
||||||
|
@ -58,9 +58,15 @@ public class FileController {
|
|||||||
@PostMapping("/updateFileUploadPath")
|
@PostMapping("/updateFileUploadPath")
|
||||||
@Transactional(rollbackOn = Exception.class)
|
@Transactional(rollbackOn = Exception.class)
|
||||||
public String updateFileUploadPath(@RequestBody FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
|
public String updateFileUploadPath(@RequestBody FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
|
||||||
|
String lotNo = fileUpdateQo.getLotNo();
|
||||||
|
String machineNo = fileUpdateQo.getMachineNo();
|
||||||
|
String materialNo = fileUpdateQo.getMaterialNo();
|
||||||
|
String modelNo = fileUpdateQo.getModelNo();
|
||||||
|
String machineTypeNo = fileUpdateQo.getMachineTypeNo();
|
||||||
|
String craftItemName = fileUpdateQo.getCraftItemName();
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String file = ExcelUploadUtil.memoryFile(fileExcel,1);
|
String file = ExcelUploadUtil.memoryFile(fileExcel, 1);
|
||||||
fileDao.updateFileUploadPath(fileUpdateQo.getLotNo(), fileUpdateQo.getMachineNo(), fileUpdateQo.getMaterialNo(), fileUpdateQo.getModelNo(), fileUpdateQo.getPartNo(), file);
|
fileDao.updateFileUploadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, file);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,13 +44,14 @@ public class PictureController {
|
|||||||
* 查询图片
|
* 查询图片
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectPicture")
|
@GetMapping("/selectPicture")
|
||||||
public String selectPicture(@RequestParam("lotNo") String lotNo,
|
public String selectPicture(@RequestParam(required = false, value = "lotNo") String lotNo,
|
||||||
@RequestParam("machineNo") String machineNo,
|
@RequestParam(required = false, value = "machineNo") String machineNo,
|
||||||
@RequestParam("materialNo") String materialNo,
|
@RequestParam(required = false, value = "materialNo") String materialNo,
|
||||||
@RequestParam("modelNo") String modelNo,
|
@RequestParam(required = false, value = "modelNo") String modelNo,
|
||||||
@RequestParam("partNo") String partNo) {
|
@RequestParam(required = false, value = "machineTypeNo") String machineTypeNo,
|
||||||
|
@RequestParam(required = false, value = "craftItemName") String craftItemName) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<PictureEntity> pictureEntities = pictureQuery.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo);
|
List<PictureEntity> pictureEntities = pictureQuery.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo,craftItemName);
|
||||||
if (pictureEntities.isEmpty()) {
|
if (pictureEntities.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale);
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,11 @@ public class SpecController {
|
|||||||
* 查询规格信息
|
* 查询规格信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("/selectSpec")
|
@GetMapping("/selectSpec")
|
||||||
public String selectSpec(@RequestParam(required = false, value = "partNo") String partNo,
|
public String selectSpec(@RequestParam(required = false, value = "machineTypeNo") String machineTypeNo,
|
||||||
@RequestParam(required = false, value = "inspectionItemCode") String inspectionItemCode) {
|
@RequestParam(required = false, value = "inspectionItemCode") String inspectionItemCode,
|
||||||
|
@RequestParam(required = false, value = "craftItemName") String craftItemName) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<SpecEntity> specEntities = specQuery.selectSpec(partNo, inspectionItemCode);
|
List<SpecEntity> specEntities = specQuery.selectSpec(machineTypeNo, inspectionItemCode, craftItemName);
|
||||||
if (specEntities.isEmpty()) {
|
if (specEntities.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale);
|
||||||
}
|
}
|
||||||
|
@ -19,15 +19,16 @@ public interface FileDao extends JpaRepository<FileEntity, Long>, JpaSpecificati
|
|||||||
/**
|
/**
|
||||||
* 查询文件信息
|
* 查询文件信息
|
||||||
*
|
*
|
||||||
* @param lotNo 批次号
|
* @param lotNo 批次号
|
||||||
* @param machineNo 机器号
|
* @param machineNo 机器号
|
||||||
* @param materialNo 物料号
|
* @param materialNo 物料号
|
||||||
* @param modelNo 模具号
|
* @param modelNo 模具号
|
||||||
* @param partNo 零件号
|
* @param machineTypeNo 机种号
|
||||||
|
* @param craftItemName 工艺项目名称
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT * FROM qc_inspection_file WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true)
|
@Query(value = "SELECT * FROM qc_inspection_file WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND machine_type_no = ? AND craft_item_name = ? ", nativeQuery = true)
|
||||||
Optional<FileEntity> selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String partNo);
|
Optional<FileEntity> selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改模板上传信息
|
* 修改模板上传信息
|
||||||
@ -36,12 +37,13 @@ public interface FileDao extends JpaRepository<FileEntity, Long>, JpaSpecificati
|
|||||||
* @param machineNo 机器号
|
* @param machineNo 机器号
|
||||||
* @param materialNo 物料号
|
* @param materialNo 物料号
|
||||||
* @param modelNo 模具号
|
* @param modelNo 模具号
|
||||||
* @param partNo 零件号
|
* @param machineTypeNo 机种号
|
||||||
|
* @param craftItemName 工艺项目名称
|
||||||
* @param fileUploadPath 模板路径
|
* @param fileUploadPath 模板路径
|
||||||
*/
|
*/
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
@Query(value = "UPDATE qc_inspection_file SET file_upload_path = ?6 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND part_no = ?5 ", nativeQuery = true)
|
@Query(value = "UPDATE qc_inspection_file SET file_upload_path = ?7 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND machine_type_no = ?5 AND craft_item_name = ?6 ", nativeQuery = true)
|
||||||
void updateFileUploadPath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String fileUploadPath);
|
void updateFileUploadPath(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName, String fileUploadPath);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改文件下载信息
|
* 修改文件下载信息
|
||||||
@ -50,12 +52,13 @@ public interface FileDao extends JpaRepository<FileEntity, Long>, JpaSpecificati
|
|||||||
* @param machineNo 机器号
|
* @param machineNo 机器号
|
||||||
* @param materialNo 物料号
|
* @param materialNo 物料号
|
||||||
* @param modelNo 模具号
|
* @param modelNo 模具号
|
||||||
* @param partNo 零件号
|
* @param machineTypeNo 机种号
|
||||||
|
* @param craftItemName 工艺项目名称
|
||||||
* @param fileDownloadPath 文件下载路径
|
* @param fileDownloadPath 文件下载路径
|
||||||
*/
|
*/
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
@Query(value = "UPDATE qc_inspection_file SET file_download_path = ?6 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND part_no = ?5 ", nativeQuery = true)
|
@Query(value = "UPDATE qc_inspection_file SET file_download_path = ?7 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND machine_type_no = ?5 AND craft_item_name = ?6 ", nativeQuery = true)
|
||||||
void updateFileDownloadPath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String fileDownloadPath);
|
void updateFileDownloadPath(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName, String fileDownloadPath);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package com.xkrs.dao;
|
|||||||
import com.xkrs.model.entity.PictureEntity;
|
import com.xkrs.model.entity.PictureEntity;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -19,27 +18,15 @@ public interface PictureDao extends JpaRepository<PictureEntity, Long>, JpaSpeci
|
|||||||
/**
|
/**
|
||||||
* 查询图片信息
|
* 查询图片信息
|
||||||
*
|
*
|
||||||
* @param lotNo 批次号
|
* @param lotNo 批次号
|
||||||
* @param machineNo 机器号
|
* @param machineNo 机器号
|
||||||
* @param materialNo 物料号
|
* @param materialNo 物料号
|
||||||
* @param modelNo 模具号
|
* @param modelNo 模具号
|
||||||
* @param partNo 零件号
|
* @param machineTypeNo 机种号
|
||||||
|
* @param craftItemName 工艺项目名称
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT * FROM qc_inspection_picture WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true)
|
@Query(value = "SELECT * FROM qc_inspection_picture WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND machine_type_no = ? AND craft_item_name = ? ", nativeQuery = true)
|
||||||
Optional<PictureEntity> selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String partNo);
|
Optional<PictureEntity> selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName);
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改图片路径信息
|
|
||||||
*
|
|
||||||
* @param lotNo 批次号
|
|
||||||
* @param machineNo 机器号
|
|
||||||
* @param materialNo 物料号
|
|
||||||
* @param modelNo 模具号
|
|
||||||
* @param partNo 零件号
|
|
||||||
* @param picturePath 图片路径
|
|
||||||
*/
|
|
||||||
@Modifying(clearAutomatically = true)
|
|
||||||
@Query(value = "UPDATE qc_inspection_picture SET picture_path = ?6 where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5", nativeQuery = true)
|
|
||||||
void updatePicturePath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String picturePath);
|
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,13 @@ public class FileEntity {
|
|||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
@Column(length = 85, columnDefinition = "varchar(85)")
|
||||||
private String machineTypeNo;
|
private String machineTypeNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工艺项目名称
|
||||||
|
*/
|
||||||
|
@Column(length = 85, columnDefinition = "varchar(85)")
|
||||||
|
private String craftItemName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传模板的路径
|
* 上传模板的路径
|
||||||
*/
|
*/
|
||||||
@ -110,6 +117,14 @@ public class FileEntity {
|
|||||||
this.machineTypeNo = machineTypeNo;
|
this.machineTypeNo = machineTypeNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCraftItemName() {
|
||||||
|
return craftItemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCraftItemName(String craftItemName) {
|
||||||
|
this.craftItemName = craftItemName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFileUploadPath() {
|
public String getFileUploadPath() {
|
||||||
return fileUploadPath;
|
return fileUploadPath;
|
||||||
}
|
}
|
||||||
@ -135,6 +150,7 @@ public class FileEntity {
|
|||||||
", materialNo='" + materialNo + '\'' +
|
", materialNo='" + materialNo + '\'' +
|
||||||
", modelNo='" + modelNo + '\'' +
|
", modelNo='" + modelNo + '\'' +
|
||||||
", machineTypeNo='" + machineTypeNo + '\'' +
|
", machineTypeNo='" + machineTypeNo + '\'' +
|
||||||
|
", craftItemName='" + craftItemName + '\'' +
|
||||||
", fileUploadPath='" + fileUploadPath + '\'' +
|
", fileUploadPath='" + fileUploadPath + '\'' +
|
||||||
", fileDownloadPath='" + fileDownloadPath + '\'' +
|
", fileDownloadPath='" + fileDownloadPath + '\'' +
|
||||||
'}';
|
'}';
|
||||||
|
@ -40,6 +40,12 @@ public class FileQo {
|
|||||||
@NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileQoInsert.class})
|
@NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileQoInsert.class})
|
||||||
private String machineTypeNo;
|
private String machineTypeNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工艺项目名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "{FileEntity.craftItemName.blank}", groups = {FileQoInsert.class})
|
||||||
|
private String craftItemName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传模板的路径
|
* 上传模板的路径
|
||||||
*/
|
*/
|
||||||
@ -89,6 +95,14 @@ public class FileQo {
|
|||||||
this.machineTypeNo = machineTypeNo;
|
this.machineTypeNo = machineTypeNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCraftItemName() {
|
||||||
|
return craftItemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCraftItemName(String craftItemName) {
|
||||||
|
this.craftItemName = craftItemName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFileUploadPath() {
|
public String getFileUploadPath() {
|
||||||
return fileUploadPath;
|
return fileUploadPath;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.xkrs.model.qo;
|
package com.xkrs.model.qo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xkrs.model.validation.FileQoInsert;
|
||||||
import com.xkrs.model.validation.FileUpdateQoUpdate;
|
import com.xkrs.model.validation.FileUpdateQoUpdate;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
@ -41,6 +42,12 @@ public class FileUpdateQo {
|
|||||||
@NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileUpdateQoUpdate.class})
|
@NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileUpdateQoUpdate.class})
|
||||||
private String machineTypeNo;
|
private String machineTypeNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工艺项目名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "{FileEntity.craftItemName.blank}", groups = {FileQoInsert.class})
|
||||||
|
private String craftItemName;
|
||||||
|
|
||||||
public FileUpdateQo() {
|
public FileUpdateQo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,4 +90,12 @@ public class FileUpdateQo {
|
|||||||
public void setMachineTypeNo(String machineTypeNo) {
|
public void setMachineTypeNo(String machineTypeNo) {
|
||||||
this.machineTypeNo = machineTypeNo;
|
this.machineTypeNo = machineTypeNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCraftItemName() {
|
||||||
|
return craftItemName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCraftItemName(String craftItemName) {
|
||||||
|
this.craftItemName = craftItemName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,8 @@ public class DataSourceServiceImpl implements DataSourceService {
|
|||||||
dataSource.setMachineNo(dataSourceQo.getMachineNo());
|
dataSource.setMachineNo(dataSourceQo.getMachineNo());
|
||||||
dataSource.setMaterialNo(dataSourceQo.getMaterialNo());
|
dataSource.setMaterialNo(dataSourceQo.getMaterialNo());
|
||||||
dataSource.setModelNo(dataSourceQo.getModelNo());
|
dataSource.setModelNo(dataSourceQo.getModelNo());
|
||||||
dataSource.setPartNo(dataSourceQo.getPartNo());
|
dataSource.setMachineTypeNo(dataSourceQo.getMachineTypeNo());
|
||||||
|
dataSource.setCraftItemName(dataSourceQo.getCraftItemName());
|
||||||
dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode());
|
dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode());
|
||||||
dataSource.setInspectValue(dataSourceQo.getInspectValue());
|
dataSource.setInspectValue(dataSourceQo.getInspectValue());
|
||||||
dataSourceDao.save(dataSource);
|
dataSourceDao.save(dataSource);
|
||||||
|
@ -42,8 +42,14 @@ public class FileServiceImpl implements FileService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String insertFileExcel(FileQo fileQo, MultipartFile fileExcel) throws IOException {
|
public String insertFileExcel(FileQo fileQo, MultipartFile fileExcel) throws IOException {
|
||||||
|
String lotNo = fileQo.getLotNo();
|
||||||
|
String machineNo = fileQo.getMachineNo();
|
||||||
|
String materialNo = fileQo.getMaterialNo();
|
||||||
|
String modelNo = fileQo.getModelNo();
|
||||||
|
String machineTypeNo = fileQo.getMachineTypeNo();
|
||||||
|
String craftItemName = fileQo.getCraftItemName();
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
Optional<FileEntity> fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo());
|
Optional<FileEntity> fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
|
||||||
if (fileEntity.isPresent()) {
|
if (fileEntity.isPresent()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该产品的模板!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该产品的模板!", locale);
|
||||||
}
|
}
|
||||||
@ -56,7 +62,7 @@ public class FileServiceImpl implements FileService {
|
|||||||
fileEntity1.setMachineNo(fileQo.getMachineNo());
|
fileEntity1.setMachineNo(fileQo.getMachineNo());
|
||||||
fileEntity1.setMaterialNo(fileQo.getMaterialNo());
|
fileEntity1.setMaterialNo(fileQo.getMaterialNo());
|
||||||
fileEntity1.setModelNo(fileQo.getModelNo());
|
fileEntity1.setModelNo(fileQo.getModelNo());
|
||||||
fileEntity1.setPartNo(fileQo.getPartNo());
|
fileEntity1.setMachineTypeNo(fileQo.getMachineTypeNo());
|
||||||
fileEntity1.setFileUploadPath(file);
|
fileEntity1.setFileUploadPath(file);
|
||||||
fileDao.save(fileEntity1);
|
fileDao.save(fileEntity1);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
||||||
@ -71,13 +77,19 @@ public class FileServiceImpl implements FileService {
|
|||||||
@Transactional(rollbackOn = Exception.class)
|
@Transactional(rollbackOn = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException {
|
public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException {
|
||||||
|
String lotNo = fileQo.getLotNo();
|
||||||
|
String machineNo = fileQo.getMachineNo();
|
||||||
|
String materialNo = fileQo.getMaterialNo();
|
||||||
|
String modelNo = fileQo.getModelNo();
|
||||||
|
String machineTypeNo = fileQo.getMachineTypeNo();
|
||||||
|
String craftItemName = fileQo.getCraftItemName();
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
Optional<FileEntity> fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo());
|
Optional<FileEntity> fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
|
||||||
if (fileEntity.isEmpty()) {
|
if (fileEntity.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
|
||||||
}
|
}
|
||||||
String fileUploadPath = fileEntity.get().getFileUploadPath();
|
String fileUploadPath = fileEntity.get().getFileUploadPath();
|
||||||
List<DataSource> dataSources = dataSourceQuery.selectDataSource(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo());
|
List<DataSource> dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
|
||||||
if (dataSources == null || dataSources.size() == 0) {
|
if (dataSources == null || dataSources.size() == 0) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
|
||||||
}
|
}
|
||||||
@ -86,7 +98,7 @@ public class FileServiceImpl implements FileService {
|
|||||||
map.put(dataSource.getInspectionItemCode(), dataSource.getInspectValue());
|
map.put(dataSource.getInspectionItemCode(), dataSource.getInspectValue());
|
||||||
}
|
}
|
||||||
String fill = ExportExcel.exportToProveExcel(map, fileUploadPath);
|
String fill = ExportExcel.exportToProveExcel(map, fileUploadPath);
|
||||||
fileDao.updateFileDownloadPath(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo(), fill);
|
fileDao.updateFileDownloadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, fill);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,9 @@ public class PictureServiceImpl implements PictureService {
|
|||||||
String machineNo = pictureQo.getMachineNo();
|
String machineNo = pictureQo.getMachineNo();
|
||||||
String materialNo = pictureQo.getMaterialNo();
|
String materialNo = pictureQo.getMaterialNo();
|
||||||
String modelNo = pictureQo.getModelNo();
|
String modelNo = pictureQo.getModelNo();
|
||||||
String partNo = pictureQo.getPartNo();
|
String machineTypeNo = pictureQo.getMachineTypeNo();
|
||||||
Optional<PictureEntity> pictureEntity2 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo);
|
String craftItemName = pictureQo.getCraftItemName();
|
||||||
|
Optional<PictureEntity> pictureEntity2 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
|
||||||
if (pictureEntity2.isPresent()) {
|
if (pictureEntity2.isPresent()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale);
|
||||||
}
|
}
|
||||||
@ -41,7 +42,8 @@ public class PictureServiceImpl implements PictureService {
|
|||||||
pictureEntity1.setMachineNo(machineNo);
|
pictureEntity1.setMachineNo(machineNo);
|
||||||
pictureEntity1.setMaterialNo(materialNo);
|
pictureEntity1.setMaterialNo(materialNo);
|
||||||
pictureEntity1.setModelNo(modelNo);
|
pictureEntity1.setModelNo(modelNo);
|
||||||
pictureEntity1.setPartNo(partNo);
|
pictureEntity1.setMachineTypeNo(machineTypeNo);
|
||||||
|
pictureEntity1.setCraftItemName(craftItemName);
|
||||||
pictureEntity1.setPicturePath(file);
|
pictureEntity1.setPicturePath(file);
|
||||||
pictureDao.save(pictureEntity1);
|
pictureDao.save(pictureEntity1);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
||||||
|
@ -27,13 +27,14 @@ public class SpecServiceImpl implements SpecService {
|
|||||||
@Override
|
@Override
|
||||||
public String insertSpec(SpecQo specQo) {
|
public String insertSpec(SpecQo specQo) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
List<SpecEntity> specEntities = specQuery.selectSpec(specQo.getPartNo(), specQo.getInspectionItemCode());
|
List<SpecEntity> specEntities = specQuery.selectSpec(specQo.getMachineTypeNo(), specQo.getInspectionItemCode(),specQo.getCraftItemName());
|
||||||
if (!specEntities.isEmpty()) {
|
if (!specEntities.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale);
|
||||||
}
|
}
|
||||||
SpecEntity specEntity1 = new SpecEntity();
|
SpecEntity specEntity1 = new SpecEntity();
|
||||||
specEntity1.setPartNo(specQo.getPartNo());
|
specEntity1.setMachineTypeNo(specQo.getMachineTypeNo());
|
||||||
specEntity1.setInspectionItemCode(specQo.getInspectionItemCode());
|
specEntity1.setInspectionItemCode(specQo.getInspectionItemCode());
|
||||||
|
specEntity1.setCraftItemName(specQo.getCraftItemName());
|
||||||
specEntity1.setMax(specQo.getMax());
|
specEntity1.setMax(specQo.getMax());
|
||||||
specEntity1.setMean(specQo.getMean());
|
specEntity1.setMean(specQo.getMean());
|
||||||
specEntity1.setMin(specQo.getMin());
|
specEntity1.setMin(specQo.getMin());
|
||||||
|
@ -6,10 +6,7 @@ import org.springframework.data.jpa.domain.Specification;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
|
||||||
import javax.persistence.criteria.Predicate;
|
import javax.persistence.criteria.Predicate;
|
||||||
import javax.persistence.criteria.Root;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class DataSourceQuery {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<DataSource> selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String partNo) {
|
public List<DataSource> selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName) {
|
||||||
Specification<DataSource> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
Specification<DataSource> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (!TextUtils.isEmpty(lotNo)) {
|
if (!TextUtils.isEmpty(lotNo)) {
|
||||||
@ -41,8 +41,11 @@ public class DataSourceQuery {
|
|||||||
if (!TextUtils.isEmpty(modelNo)) {
|
if (!TextUtils.isEmpty(modelNo)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo));
|
list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo));
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(partNo)) {
|
if (!TextUtils.isEmpty(machineTypeNo)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("partNo").as(String.class), partNo));
|
list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo));
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(craftItemName)) {
|
||||||
|
list.add(criteriaBuilder.equal(root.get("craftItemName").as(String.class), craftItemName));
|
||||||
}
|
}
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
|
@ -44,13 +44,13 @@ public class ExcelUploadUtil {
|
|||||||
String newName = UUID.randomUUID().toString() + suffix;
|
String newName = UUID.randomUUID().toString() + suffix;
|
||||||
|
|
||||||
//将图片保存到本地/usr/etc/images/Folder
|
//将图片保存到本地/usr/etc/images/Folder
|
||||||
// File file = new File("/Users/liuchengqian/Desktop/DaJiang/");
|
File file = new File("/Users/liuchengqian/Desktop/DaJiang/" + subDir);
|
||||||
File file = new File("/home/sxy/server/industrial_measurement" + subDir);
|
// File file = new File("/home/sxy/server/industrial_measurement" + subDir);
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
file.mkdirs();
|
file.mkdirs();
|
||||||
}
|
}
|
||||||
// String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName;
|
String path = "/Users/liuchengqian/Desktop/DaJiang/" + subDir + newName;
|
||||||
String path = "/home/sxy/server/industrial_measurement" + subDir + newName;
|
// String path = "/home/sxy/server/industrial_measurement" + subDir + newName;
|
||||||
String uploadsImage = uploadPath + newName;
|
String uploadsImage = uploadPath + newName;
|
||||||
//实现上传
|
//实现上传
|
||||||
fileInput.transferTo(new File(path));
|
fileInput.transferTo(new File(path));
|
||||||
|
@ -26,7 +26,7 @@ public class PictureQuery {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<PictureEntity> selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String partNo) {
|
public List<PictureEntity> selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName) {
|
||||||
Specification<PictureEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
Specification<PictureEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (!TextUtils.isEmpty(lotNo)) {
|
if (!TextUtils.isEmpty(lotNo)) {
|
||||||
@ -41,8 +41,11 @@ public class PictureQuery {
|
|||||||
if (!TextUtils.isEmpty(modelNo)) {
|
if (!TextUtils.isEmpty(modelNo)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo));
|
list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo));
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(partNo)) {
|
if (!TextUtils.isEmpty(machineTypeNo)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("partNo").as(String.class), partNo));
|
list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo));
|
||||||
|
}
|
||||||
|
if (!TextUtils.isEmpty(craftItemName)) {
|
||||||
|
list.add(criteriaBuilder.equal(root.get("craftItemName").as(String.class), craftItemName));
|
||||||
}
|
}
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
|
@ -26,15 +26,18 @@ public class SpecQuery {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<SpecEntity> selectSpec(String partNo, String inspectionItemCode) {
|
public List<SpecEntity> selectSpec(String machineTypeNo, String inspectionItemCode, String craftItemName) {
|
||||||
Specification<SpecEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
Specification<SpecEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
|
||||||
List<Predicate> list = new ArrayList<>();
|
List<Predicate> list = new ArrayList<>();
|
||||||
if (!TextUtils.isEmpty(partNo)) {
|
if (!TextUtils.isEmpty(machineTypeNo)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("partNo").as(String.class), partNo));
|
list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo));
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(inspectionItemCode)) {
|
if (!TextUtils.isEmpty(inspectionItemCode)) {
|
||||||
list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode));
|
list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode));
|
||||||
}
|
}
|
||||||
|
if (!TextUtils.isEmpty(craftItemName)) {
|
||||||
|
list.add(criteriaBuilder.equal(root.get("craftItemName").as(String.class), craftItemName));
|
||||||
|
}
|
||||||
Predicate[] predicates = new Predicate[list.size()];
|
Predicate[] predicates = new Predicate[list.size()];
|
||||||
return criteriaBuilder.and(list.toArray(predicates));
|
return criteriaBuilder.and(list.toArray(predicates));
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user