This commit is contained in:
liuchengqian 2022-03-11 17:30:56 +08:00
parent ae243ec0a2
commit 1ddf362e05
48 changed files with 37 additions and 2207 deletions

View File

@ -1,95 +0,0 @@
package com.xkrs.controller;
import com.xkrs.dao.DataDictDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.DataDict;
import com.xkrs.model.qo.DataDictQo;
import com.xkrs.model.qo.DataDictUpdateQo;
import com.xkrs.service.DataDictService;
import com.xkrs.util.DataDictQuery;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:54
*/
@RestController
public class DataDictController {
@Resource
private DataDictService dataDictService;
@Resource
private DataDictDao dataDictDao;
@Resource
private DataDictQuery dataDictQuery;
/**
* 添加字典变量数据
*
* @param dataDictQo
* @return
*/
@PostMapping("/insertDataDict")
public String insertDataDict(@RequestBody DataDictQo dataDictQo) {
return dataDictService.insertDataDict(dataDictQo);
}
/**
* 动态多条件查询字典信息
*
* @param inspectionItemName
* @param inspectionItemCode
* @return
*/
@GetMapping("/selectDataDict")
public String selectDataDict(@RequestParam("inspectionItemName") String inspectionItemName,
@RequestParam("inspectionItemCode") String inspectionItemCode) {
Locale locale = LocaleContextHolder.getLocale();
List<DataDict> dataDict = dataDictQuery.selectDataDict(inspectionItemName, inspectionItemCode);
if (dataDict == null || dataDict.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataDict, locale);
}
/**
* 根据id查询字典信息用于数据回显方便进行修改操作
*
* @param id
* @return
*/
@GetMapping("/selectDataDictById")
public String selectDataDictById(@RequestParam("id") Integer id) {
Locale locale = LocaleContextHolder.getLocale();
Optional<DataDict> byId = dataDictDao.findById(id);
if (byId.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byId.get(), locale);
}
/**
* 根据id修改字典信息
*
* @param dataDictUpdateQo
* @return
*/
@PostMapping("/updateDict")
@Transactional(rollbackOn = Exception.class)
public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo) {
Locale locale = LocaleContextHolder.getLocale();
dataDictDao.updateDict(dataDictUpdateQo.getId(), dataDictUpdateQo.getInspectionItemName());
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
}
}

View File

@ -1,118 +0,0 @@
package com.xkrs.controller;
import com.xkrs.dao.DataSourceDao;
import com.xkrs.dao.PictureDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.DataSource;
import com.xkrs.model.qo.DataSourceQo;
import com.xkrs.service.DataSourceService;
import com.xkrs.util.DataSourceQuery;
import org.apache.http.util.TextUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 17:05
*/
@RestController
public class DataSourceController {
@Resource
private DataSourceService dataSourceService;
@Resource
private DataSourceQuery dataSourceQuery;
@Resource
private DataSourceDao dataSourceDao;
@Resource
private PictureDao pictureDao;
/**
* 添加测量数据
*
* @param dataSourceQo
* @return
*/
@PostMapping("/insertDataSource")
public String insertDataSource(@RequestBody DataSourceQo dataSourceQo) {
return dataSourceService.insertDataSource(dataSourceQo);
}
/**
* 查询某一产品的测量信息
*
* @param lotNo 批次号
* @param machineNo 机器号
* @param materialNo 物料号
* @param modelNo 模具号
* @param machineTypeNo 机种号
* @param craftItemName 工艺项目名称
* @return
*/
@GetMapping("/selectDataSource")
public String selectDataSource(@RequestParam(required = false, value = "lotNo") String lotNo, @RequestParam(required = false, value = "machineNo") String machineNo, @RequestParam(required = false, value = "materialNo") String materialNo, @RequestParam(required = false, value = "modelNo") String modelNo, @RequestParam(required = false, value = "machineTypeNo") String machineTypeNo, @RequestParam(required = false, value = "craftItemName") String craftItemName) {
Locale locale = LocaleContextHolder.getLocale();
List<Map<String, String>> groupList = dataSourceDao.selectAllDataSourceGroup();
if (groupList == null || groupList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale);
}
List<List<DataSource>> dataSourceListList = new ArrayList<>();
for (Map<String, String> group : groupList) {
String groupNameLotNo = group.get("lotNo");
String groupNameMachineNo = group.get("machineNo");
String groupNameMaterialNo = group.get("materialNo");
String groupNameModelNo = group.get("modelNo");
String groupNameMachineTypeNo = group.get("machineTypeNo");
String groupNameCraftItemName = group.get("craftItemName");
if (!TextUtils.isEmpty(lotNo) && !lotNo.equals(groupNameLotNo)) {
continue;
}
if (!TextUtils.isEmpty(machineNo) && !machineNo.equals(groupNameMachineNo)) {
continue;
}
if (!TextUtils.isEmpty(materialNo) && !materialNo.equals(groupNameMaterialNo)) {
continue;
}
if (!TextUtils.isEmpty(modelNo) && !modelNo.equals(groupNameModelNo)) {
continue;
}
if (!TextUtils.isEmpty(machineTypeNo) && !machineTypeNo.equals(groupNameMachineTypeNo)) {
continue;
}
if (!TextUtils.isEmpty(craftItemName) && !craftItemName.equals(groupNameCraftItemName)) {
continue;
}
List<DataSource> dataSourceList = dataSourceDao.selectDataSource(groupNameLotNo, groupNameMachineNo, groupNameMaterialNo, groupNameModelNo, groupNameMachineTypeNo, groupNameCraftItemName);
if (dataSourceList != null && dataSourceList.size() > 0) {
dataSourceListList.add(dataSourceList);
}
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataSourceListList, locale);
}
/**
* 查询全部的测量信息
*
* @return
*/
@GetMapping("/selectAllSource")
public String selectAllSource() {
Locale locale = LocaleContextHolder.getLocale();
List<DataSource> dataSources = dataSourceDao.findAll();
if (dataSources.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataSources, locale);
}
}

View File

@ -1,61 +0,0 @@
package com.xkrs.controller;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.PictureEntity;
import com.xkrs.model.qo.DeletePictureQo;
import com.xkrs.model.qo.PictureQo;
import com.xkrs.service.PictureService;
import com.xkrs.util.PictureQuery;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 16:01
*/
@RestController
public class PictureController {
@Resource
private PictureService pictureService;
@Resource
private PictureQuery pictureQuery;
/**
* 上传图片
*/
@PostMapping("/insertPicture")
public String insertPicture(PictureQo pictureQo, @RequestParam("filePicture") MultipartFile filePicture) throws IOException {
return pictureService.insertPicture(pictureQo, filePicture);
}
// /**
// * 删除图片
// */
// @PostMapping("/deletePicture")
// public String deletePicture(@RequestBody DeletePictureQo deletePictureQo) {
// return pictureService.deletePicture(deletePictureQo.getPicturePath());
// }
// /**
// * 查询图片
// */
// @GetMapping("/selectPicture")
// public String selectPicture(@RequestParam(required = false, value = "lotNo") String lotNo, @RequestParam(required = false, value = "machineNo") String machineNo, @RequestParam(required = false, value = "materialNo") String materialNo, @RequestParam(required = false, value = "modelNo") String modelNo, @RequestParam(required = false, value = "machineTypeNo") String machineTypeNo, @RequestParam(required = false, value = "craftItemName") String craftItemName) {
// Locale locale = LocaleContextHolder.getLocale();
// List<PictureEntity> pictureEntities = pictureQuery.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
// if (pictureEntities.isEmpty()) {
// return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该图片!", locale);
// }
// return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntities, locale);
// }
}

View File

@ -1,4 +1,4 @@
package com.xkrs.newpro.controller;
package com.xkrs.controller;
import com.xkrs.newpro.model.qo.QcItemQoDelete;
import com.xkrs.newpro.model.qo.QcItemQoInsert;

View File

@ -1,4 +1,4 @@
package com.xkrs.newpro.controller;
package com.xkrs.controller;
import com.xkrs.newpro.model.qo.QcSourceQoDelete;
import com.xkrs.newpro.model.qo.QcSourceQoInsert;

View File

@ -1,4 +1,4 @@
package com.xkrs.newpro.controller;
package com.xkrs.controller;
import com.xkrs.newpro.model.qo.QcSpecQoDelete;
import com.xkrs.newpro.model.qo.QcSpecQoInsert;

View File

@ -1,55 +0,0 @@
package com.xkrs.controller;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.SpecEntity;
import com.xkrs.model.qo.SpecQo;
import com.xkrs.service.SpecService;
import com.xkrs.util.SpecQuery;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Locale;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 16:01
*/
@RestController
public class SpecController {
@Resource
private SpecService specService;
@Resource
private SpecQuery specQuery;
/**
* 添加规格数据
*
* @param specQo
*/
@PostMapping("/insertSpec")
public String insertSpec(@RequestBody SpecQo specQo) {
return specService.insertSpec(specQo);
}
/**
* 查询规格信息
*/
@GetMapping("/selectSpec")
public String selectSpec(@RequestParam(required = false, value = "machineTypeNo") String machineTypeNo,
@RequestParam(required = false, value = "inspectionItemCode") String inspectionItemCode,
@RequestParam(required = false, value = "craftItemName") String craftItemName) {
Locale locale = LocaleContextHolder.getLocale();
List<SpecEntity> specEntities = specQuery.selectSpec(machineTypeNo, inspectionItemCode, craftItemName);
if (specEntities.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该规格信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntities, locale);
}
}

View File

@ -1,42 +0,0 @@
package com.xkrs.dao;
import com.xkrs.model.entity.DataDict;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:03
*/
@Component
public interface DataDictDao extends JpaRepository<DataDict,Long>, JpaSpecificationExecutor<DataDict> {
/**
* 通过质检项代码查询字典表的数据
* @param inspectionItemCode
* @return
*/
Optional<DataDict> findByInspectionItemCode(String inspectionItemCode);
/**
* 根据id查询字典信息
* @param id
* @return
*/
Optional<DataDict> findById(Integer id);
/**
* 根据id修改字典的信息
* @param id
* @param inspectionItemName
*/
@Modifying(clearAutomatically=true)
@Query(value = "UPDATE qc_inspection_item_dict SET inspection_item_name = ?2 where id = ?1",nativeQuery = true)
void updateDict(Integer id, String inspectionItemName);
}

View File

@ -1,25 +0,0 @@
package com.xkrs.dao;
import com.xkrs.model.entity.DataSource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
public interface DataSourceDao extends JpaRepository<DataSource, Long>, JpaSpecificationExecutor<DataSource> {
@Query(value = "SELECT lot_no AS lotNo, machine_no AS machineNo, material_no AS materialNo, model_no AS modelNo, machine_type_no AS machineTypeNo, craft_item_name AS craftItemName FROM qc_inspection_data_source GROUP BY lot_no, machine_no, material_no, model_no, machine_type_no, craft_item_name", nativeQuery = true)
List<Map<String, String>> selectAllDataSourceGroup();
@Query(value = "SELECT * FROM qc_inspection_data_source WHERE (lot_no IS NULL OR lot_no = ?1) AND (machine_no IS NULL OR machine_no = ?2) AND (material_no IS NULL OR material_no = ?3) AND (model_no IS NULL OR model_no = ?4) AND (machine_type_no IS NULL OR machine_type_no = ?5) AND (craft_item_name IS NULL OR craft_item_name = ?6)", nativeQuery = true)
List<DataSource> selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName);
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE qc_inspection_data_source SET picture_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 updatePicturePath(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName, String filePath);
}

View File

@ -1,33 +0,0 @@
package com.xkrs.dao;
import com.xkrs.model.entity.PictureEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:41
*/
@Component
public interface PictureDao extends JpaRepository<PictureEntity, Long>, JpaSpecificationExecutor<PictureEntity> {
/**
* 查询图片信息
*
* @param lotNo 批次号
* @param machineNo 机器号
* @param materialNo 物料号
* @param modelNo 模具号
* @param machineTypeNo 机种号
* @param craftItemName 工艺项目名称
* @return
*/
@Query(value = "SELECT * FROM qc_inspection_picture WHERE (lot_no IS NULL OR lot_no = ?1) AND (machine_no IS NULL OR machine_no = ?2) AND (material_no IS NULL OR material_no = ?3) AND (model_no IS NULL OR model_no = ?4) AND (machine_type_no IS NULL OR machine_type_no = ?5) AND (craft_item_name IS NULL OR craft_item_name = ?6)", nativeQuery = true)
List<PictureEntity> selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName);
}

View File

@ -1,4 +1,4 @@
package com.xkrs.newpro.dao;
package com.xkrs.dao;
import com.xkrs.newpro.model.entity.QcItemEntity;
import org.springframework.data.jpa.repository.JpaRepository;

View File

@ -1,4 +1,4 @@
package com.xkrs.newpro.dao;
package com.xkrs.dao;
import com.xkrs.newpro.model.entity.QcSourceEntity;
import org.springframework.data.jpa.repository.JpaRepository;

View File

@ -1,4 +1,4 @@
package com.xkrs.newpro.dao;
package com.xkrs.dao;
import com.xkrs.newpro.model.entity.QcSpecEntity;
import org.springframework.data.jpa.repository.JpaRepository;

View File

@ -1,18 +0,0 @@
package com.xkrs.dao;
import com.xkrs.model.entity.SpecEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Optional;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:41
*/
@Component
public interface SpecDao extends JpaRepository<SpecEntity, Long>, JpaSpecificationExecutor<SpecEntity> {
}

View File

@ -1,68 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 9:26
*/
@Entity
@Table(name = "qc_inspection_item_dict")
public class DataDict {
/**
* 索引
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_item_dict_seq_gen")
@SequenceGenerator(name = "qc_inspection_item_dict_seq_gen", sequenceName = "qc_inspection_item_dict_id_seq", allocationSize = 1)
private Integer id;
/**
* 质检项代码
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionItemCode;
/**
* 质检项名称
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionItemName;
public DataDict() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getInspectionItemName() {
return inspectionItemName;
}
public void setInspectionItemName(String inspectionItemName) {
this.inspectionItemName = inspectionItemName;
}
@Override
public String toString() {
return "DataDict{" +
"id=" + id +
", inspectionItemCode='" + inspectionItemCode + '\'' +
", inspectionItemName='" + inspectionItemName + '\'' +
'}';
}
}

View File

@ -1,173 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 14:08
*/
@Entity
@Table(name = "qc_inspection_data_source")
public class DataSource {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_data_source_seq_gen")
@SequenceGenerator(name = "qc_inspection_data_source_seq_gen", sequenceName = "qc_inspection_data_source_id_seq", allocationSize = 1)
private Integer id;
/**
* 批次号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String lotNo;
/**
* 机器号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String machineNo;
/**
* 物料号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String materialNo;
/**
* 模具号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String modelNo;
/**
* 机种号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String machineTypeNo;
/**
* 检验项代码
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionItemCode;
/**
* 工艺项目名称
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String craftItemName;
/**
* 检验数值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectValue;
/**
* 图片
*/
@Column(length = 10240, columnDefinition = "varchar(10240)")
private String picturePath;
public DataSource() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getMachineTypeNo() {
return machineTypeNo;
}
public void setMachineTypeNo(String machineTypeNo) {
this.machineTypeNo = machineTypeNo;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getCraftItemName() {
return craftItemName;
}
public void setCraftItemName(String craftItemName) {
this.craftItemName = craftItemName;
}
public String getInspectValue() {
return inspectValue;
}
public void setInspectValue(String inspectValue) {
this.inspectValue = inspectValue;
}
public String getPicturePath() {
return picturePath;
}
public void setPicturePath(String picturePath) {
this.picturePath = picturePath;
}
@Override
public String toString() {
return "DataSource{" +
"id=" + id +
", lotNo='" + lotNo + '\'' +
", machineNo='" + machineNo + '\'' +
", materialNo='" + materialNo + '\'' +
", modelNo='" + modelNo + '\'' +
", machineTypeNo='" + machineTypeNo + '\'' +
", inspectionItemCode='" + inspectionItemCode + '\'' +
", craftItemName='" + craftItemName + '\'' +
", inspectValue='" + inspectValue + '\'' +
", picturePath='" + picturePath + '\'' +
'}';
}
}

View File

@ -1,138 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
@Entity
@Table(name = "qc_inspection_picture")
public class PictureEntity {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_picture_seq_gen")
@SequenceGenerator(name = "qc_inspection_picture_seq_gen", sequenceName = "qc_inspection_picture_id_seq", allocationSize = 1)
private Integer id;
/**
* 批次号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String lotNo;
/**
* 机器号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String machineNo;
/**
* 物料号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String materialNo;
/**
* 模具号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String modelNo;
/**
* 机种号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String machineTypeNo;
/**
* 工艺项目名称
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String craftItemName;
/**
* 图片路径
*/
@Column(length = 2048, columnDefinition = "varchar(2048)")
private String picturePath;
public PictureEntity() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getMachineTypeNo() {
return machineTypeNo;
}
public void setMachineTypeNo(String machineTypeNo) {
this.machineTypeNo = machineTypeNo;
}
public String getCraftItemName() {
return craftItemName;
}
public void setCraftItemName(String craftItemName) {
this.craftItemName = craftItemName;
}
public String getPicturePath() {
return picturePath;
}
public void setPicturePath(String picturePath) {
this.picturePath = picturePath;
}
@Override
public String toString() {
return "PictureEntity{" +
"id=" + id +
", lotNo='" + lotNo + '\'' +
", machineNo='" + machineNo + '\'' +
", materialNo='" + materialNo + '\'' +
", modelNo='" + modelNo + '\'' +
", machineTypeNo='" + machineTypeNo + '\'' +
", craftItemName='" + craftItemName + '\'' +
", picturePath='" + picturePath + '\'' +
'}';
}
}

View File

@ -1,183 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
@Entity
@Table(name = "qc_inspection_spec")
public class SpecEntity {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_spec_seq_gen")
@SequenceGenerator(name = "qc_inspection_spec_seq_gen", sequenceName = "qc_inspection_spec_id_seq", allocationSize = 1)
private Integer id;
/**
* 机种号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String machineTypeNo;
/**
* 检验项代码
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionItemCode;
/**
* 工艺项目名称
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String craftItemName;
/**
* 最大值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String max;
/**
* 平均值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String mean;
/**
* 最小值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String min;
/**
* 单位
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String unit;
/**
* 检验方法
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionMethod;
/**
* 检验标准
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionStandard;
/**
* 备注
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String remark;
public SpecEntity() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getMachineTypeNo() {
return machineTypeNo;
}
public void setMachineTypeNo(String machineTypeNo) {
this.machineTypeNo = machineTypeNo;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getCraftItemName() {
return craftItemName;
}
public void setCraftItemName(String craftItemName) {
this.craftItemName = craftItemName;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public String getMean() {
return mean;
}
public void setMean(String mean) {
this.mean = mean;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getInspectionMethod() {
return inspectionMethod;
}
public void setInspectionMethod(String inspectionMethod) {
this.inspectionMethod = inspectionMethod;
}
public String getInspectionStandard() {
return inspectionStandard;
}
public void setInspectionStandard(String inspectionStandard) {
this.inspectionStandard = inspectionStandard;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return "SpecEntity{" +
"id=" + id +
", machineTypeNo='" + machineTypeNo + '\'' +
", inspectionItemCode='" + inspectionItemCode + '\'' +
", craftItemName='" + craftItemName + '\'' +
", max='" + max + '\'' +
", mean='" + mean + '\'' +
", min='" + min + '\'' +
", unit='" + unit + '\'' +
", inspectionMethod='" + inspectionMethod + '\'' +
", inspectionStandard='" + inspectionStandard + '\'' +
", remark='" + remark + '\'' +
'}';
}
}

View File

@ -1,43 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.DataDictQoInsert;
import javax.validation.constraints.NotBlank;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:14
*/
public class DataDictQo {
/**
* 质检项代码
*/
@NotBlank(message = "{DataDict.inspectionItemCode.blank}", groups = {DataDictQoInsert.class})
private String inspectionItemCode;
/**
* 质检项名称
*/
@NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictQoInsert.class})
private String inspectionItemName;
public DataDictQo() {
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getInspectionItemName() {
return inspectionItemName;
}
public void setInspectionItemName(String inspectionItemName) {
this.inspectionItemName = inspectionItemName;
}
}

View File

@ -1,40 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.DataDictUpdateQoUpdate;
import javax.validation.constraints.NotBlank;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 11:23
*/
public class DataDictUpdateQo {
@NotBlank(message = "{DataDict.id.blank}", groups = {DataDictUpdateQoUpdate.class})
private Integer id;
/**
* 质检项名称
*/
@NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictUpdateQoUpdate.class})
private String inspectionItemName;
public DataDictUpdateQo() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getInspectionItemName() {
return inspectionItemName;
}
public void setInspectionItemName(String inspectionItemName) {
this.inspectionItemName = inspectionItemName;
}
}

View File

@ -1,128 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.DataSourceQoInsert;
import javax.validation.constraints.NotBlank;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:37
*/
public class DataSourceQo {
/**
* 批次号
*/
@NotBlank(message = "{DataSource.lotNo.blank}", groups = {DataSourceQoInsert.class})
private String lotNo;
/**
* 机器号
*/
@NotBlank(message = "{DataSource.machineNo.blank}", groups = {DataSourceQoInsert.class})
private String machineNo;
/**
* 物料号
*/
@NotBlank(message = "{DataSource.materialNo.blank}", groups = {DataSourceQoInsert.class})
private String materialNo;
/**
* 模具号
*/
@NotBlank(message = "{DataSource.modelNo.blank}", groups = {DataSourceQoInsert.class})
private String modelNo;
/**
* 机种号
*/
@NotBlank(message = "{DataSource.machineTypeNo.blank}", groups = {DataSourceQoInsert.class})
private String machineTypeNo;
/**
* 检验项代码
*/
@NotBlank(message = "{DataSource.inspectionItemCode.blank}", groups = {DataSourceQoInsert.class})
private String inspectionItemCode;
/**
* 工艺项目名称
*/
@NotBlank(message = "{DataSource.craftItemName.blank}", groups = {DataSourceQoInsert.class})
private String craftItemName;
/**
* 检验数值
*/
@NotBlank(message = "{DataSource.inspectValue.blank}", groups = {DataSourceQoInsert.class})
private String inspectValue;
public DataSourceQo() {
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getMachineTypeNo() {
return machineTypeNo;
}
public void setMachineTypeNo(String machineTypeNo) {
this.machineTypeNo = machineTypeNo;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getCraftItemName() {
return craftItemName;
}
public void setCraftItemName(String craftItemName) {
this.craftItemName = craftItemName;
}
public String getInspectValue() {
return inspectValue;
}
public void setInspectValue(String inspectValue) {
this.inspectValue = inspectValue;
}
}

View File

@ -1,30 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.DeletePictureQoDelete;
import javax.validation.constraints.NotBlank;
public class DeletePictureQo {
/**
* 图片路径
*/
@NotBlank(message = "{PictureEntity.picturePath.blank}", groups = {DeletePictureQoDelete.class})
private String picturePath;
public DeletePictureQo() {
}
public String getPicturePath() {
return picturePath;
}
public void setPicturePath(String picturePath) {
this.picturePath = picturePath;
}
@Override
public String toString() {
return "DeletePictureQo{" + "picturePath='" + picturePath + '\'' + '}';
}
}

View File

@ -1,95 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.PictureQoInsert;
import javax.validation.constraints.NotBlank;
public class PictureQo {
/**
* 批次号
*/
@NotBlank(message = "{PictureEntity.lotNo.blank}", groups = {PictureQoInsert.class})
private String lotNo;
/**
* 机器号
*/
@NotBlank(message = "{PictureEntity.machineNo.blank}", groups = {PictureQoInsert.class})
private String machineNo;
/**
* 物料号
*/
@NotBlank(message = "{PictureEntity.materialNo.blank}", groups = {PictureQoInsert.class})
private String materialNo;
/**
* 模具号
*/
@NotBlank(message = "{PictureEntity.modelNo.blank}", groups = {PictureQoInsert.class})
private String modelNo;
/**
* 机种号
*/
@NotBlank(message = "{PictureEntity.machineTypeNo.blank}", groups = {PictureQoInsert.class})
private String machineTypeNo;
/**
* 工艺项目名称
*/
@NotBlank(message = "{PictureEntity.craftItemName.blank}", groups = {PictureQoInsert.class})
private String craftItemName;
public PictureQo() {
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getMachineTypeNo() {
return machineTypeNo;
}
public void setMachineTypeNo(String machineTypeNo) {
this.machineTypeNo = machineTypeNo;
}
public String getCraftItemName() {
return craftItemName;
}
public void setCraftItemName(String craftItemName) {
this.craftItemName = craftItemName;
}
}

View File

@ -1,150 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.SpecQoInsert;
import javax.validation.constraints.NotBlank;
public class SpecQo {
/**
* 机种号
*/
@NotBlank(message = "{SpecEntity.machineTypeNo.blank}", groups = {SpecQoInsert.class})
private String machineTypeNo;
/**
* 检验项代码
*/
@NotBlank(message = "{SpecEntity.inspectionItemCode.blank}", groups = {SpecQoInsert.class})
private String inspectionItemCode;
/**
* 工艺项目名称
*/
@NotBlank(message = "{SpecEntity.craftItemName.blank}", groups = {SpecQoInsert.class})
private String craftItemName;
/**
* 最大值
*/
@NotBlank(message = "{SpecEntity.max.blank}", groups = {SpecQoInsert.class})
private String max;
/**
* 平均值
*/
@NotBlank(message = "{SpecEntity.mean.blank}", groups = {SpecQoInsert.class})
private String mean;
/**
* 最小值
*/
@NotBlank(message = "{SpecEntity.min.blank}", groups = {SpecQoInsert.class})
private String min;
/**
* 单位
*/
@NotBlank(message = "{SpecEntity.unit.blank}", groups = {SpecQoInsert.class})
private String unit;
/**
* 检验方法
*/
@NotBlank(message = "{SpecEntity.inspectionMethod.blank}", groups = {SpecQoInsert.class})
private String inspectionMethod;
/**
* 检验标准
*/
@NotBlank(message = "{SpecEntity.inspectionStandard.blank}", groups = {SpecQoInsert.class})
private String inspectionStandard;
/**
* 备注
*/
private String remark;
public SpecQo() {
}
public String getMachineTypeNo() {
return machineTypeNo;
}
public void setMachineTypeNo(String machineTypeNo) {
this.machineTypeNo = machineTypeNo;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getCraftItemName() {
return craftItemName;
}
public void setCraftItemName(String craftItemName) {
this.craftItemName = craftItemName;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public String getMean() {
return mean;
}
public void setMean(String mean) {
this.mean = mean;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getInspectionMethod() {
return inspectionMethod;
}
public void setInspectionMethod(String inspectionMethod) {
this.inspectionMethod = inspectionMethod;
}
public String getInspectionStandard() {
return inspectionStandard;
}
public void setInspectionStandard(String inspectionStandard) {
this.inspectionStandard = inspectionStandard;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:22
*/
public interface DataDictQoInsert {
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 11:23
*/
public interface DataDictUpdateQoUpdate {
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:39
*/
public interface DataSourceQoInsert {
}

View File

@ -1,4 +0,0 @@
package com.xkrs.model.validation;
public interface DeletePictureQoDelete {
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 16:21
*/
public interface FileUpdateQoUpdate {
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 15:26
*/
public interface PictureQoInsert {
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:22
*/
public interface SpecQoInsert {
}

View File

@ -1,106 +0,0 @@
package com.xkrs.model.vo;
import java.util.List;
public class DataSourceVo {
private String lotNo;
private String machineNo;
private String materialNo;
private String modelNo;
private String machineTypeNo;
private String inspectionItemCode;
private String craftItemName;
private String inspectValue;
private List<String> picturePath;
public DataSourceVo() {
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getMachineTypeNo() {
return machineTypeNo;
}
public void setMachineTypeNo(String machineTypeNo) {
this.machineTypeNo = machineTypeNo;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getCraftItemName() {
return craftItemName;
}
public void setCraftItemName(String craftItemName) {
this.craftItemName = craftItemName;
}
public String getInspectValue() {
return inspectValue;
}
public void setInspectValue(String inspectValue) {
this.inspectValue = inspectValue;
}
public List<String> getPicturePath() {
return picturePath;
}
public void setPicturePath(List<String> picturePath) {
this.picturePath = picturePath;
}
@Override
public String toString() {
return "DataSourceVo{" +
"lotNo='" + lotNo + '\'' +
", machineNo='" + machineNo + '\'' +
", materialNo='" + materialNo + '\'' +
", modelNo='" + modelNo + '\'' +
", machineTypeNo='" + machineTypeNo + '\'' +
", inspectionItemCode='" + inspectionItemCode + '\'' +
", craftItemName='" + craftItemName + '\'' +
", inspectValue='" + inspectValue + '\'' +
", picturePath=" + picturePath +
'}';
}
}

View File

@ -1,7 +1,7 @@
package com.xkrs.newpro.service.impl;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.newpro.dao.QcItemDao;
import com.xkrs.dao.QcItemDao;
import com.xkrs.newpro.model.entity.QcItemEntity;
import com.xkrs.newpro.model.qo.QcItemQoDelete;
import com.xkrs.newpro.model.qo.QcItemQoInsert;

View File

@ -1,8 +1,8 @@
package com.xkrs.newpro.service.impl;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.newpro.dao.QcItemDao;
import com.xkrs.newpro.dao.QcSourceDao;
import com.xkrs.dao.QcItemDao;
import com.xkrs.dao.QcSourceDao;
import com.xkrs.newpro.model.entity.QcItemEntity;
import com.xkrs.newpro.model.entity.QcSourceEntity;
import com.xkrs.newpro.model.qo.QcSourceQoDelete;

View File

@ -1,8 +1,8 @@
package com.xkrs.newpro.service.impl;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.newpro.dao.QcItemDao;
import com.xkrs.newpro.dao.QcSpecDao;
import com.xkrs.dao.QcItemDao;
import com.xkrs.dao.QcSpecDao;
import com.xkrs.newpro.model.entity.QcItemEntity;
import com.xkrs.newpro.model.entity.QcSpecEntity;
import com.xkrs.newpro.model.qo.QcSpecQoDelete;

View File

@ -1,18 +0,0 @@
package com.xkrs.service;
import com.xkrs.model.entity.DataDict;
import com.xkrs.model.qo.DataDictQo;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:10
*/
public interface DataDictService {
/**
* 添加字典数据
* @param dataDictQo
* @return
*/
String insertDataDict(DataDictQo dataDictQo);
}

View File

@ -1,17 +0,0 @@
package com.xkrs.service;
import com.xkrs.model.qo.DataSourceQo;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:42
*/
public interface DataSourceService {
/**
* 添加测量数据
* @param dataSourceQo
* @return
*/
String insertDataSource(DataSourceQo dataSourceQo);
}

View File

@ -1,24 +0,0 @@
package com.xkrs.service;
import com.xkrs.model.qo.PictureQo;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 15:24
*/
public interface PictureService {
/**
* 添加图片
*/
String insertPicture(PictureQo pictureQo, MultipartFile pictureFile) throws IOException;
/**
* 删除图片
*/
String deletePicture(String picturePath);
}

View File

@ -1,19 +0,0 @@
package com.xkrs.service;
import com.xkrs.model.qo.SpecQo;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 15:24
*/
public interface SpecService {
/**
* 添加规格数据
*
* @param specQo
* @return
*/
String insertSpec(SpecQo specQo);
}

View File

@ -1,46 +0,0 @@
package com.xkrs.service.impl;
import com.xkrs.dao.DataDictDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.DataDict;
import com.xkrs.model.qo.DataDictQo;
import com.xkrs.service.DataDictService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Locale;
import java.util.Optional;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:28
*/
@Service
public class DataDictServiceImpl implements DataDictService {
@Resource
private DataDictDao dataDictDao;
/**
* 添加字典数据
*
* @param dataDictQo
* @return
*/
@Override
public String insertDataDict(DataDictQo dataDictQo) {
Locale locale = LocaleContextHolder.getLocale();
Optional<DataDict> byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataDictQo.getInspectionItemCode());
if (byInspectionItemCode.isPresent()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale);
}
DataDict dataDict = new DataDict();
dataDict.setInspectionItemName(dataDictQo.getInspectionItemName());
dataDict.setInspectionItemCode(dataDictQo.getInspectionItemCode());
dataDictDao.save(dataDict);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
}

View File

@ -1,71 +0,0 @@
package com.xkrs.service.impl;
import com.xkrs.dao.DataDictDao;
import com.xkrs.dao.DataSourceDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.DataDict;
import com.xkrs.model.entity.DataSource;
import com.xkrs.model.qo.DataSourceQo;
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 java.util.Optional;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:43
*/
@Service
public class DataSourceServiceImpl implements DataSourceService {
@Resource
private DataSourceDao dataSourceDao;
@Resource
private DataDictDao dataDictDao;
/**
* 添加测量数据
*
* @param dataSourceQo
* @return
*/
@Override
public String insertDataSource(DataSourceQo dataSourceQo) {
Locale locale = LocaleContextHolder.getLocale();
Optional<DataDict> byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode());
if (byInspectionItemCode.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该字典类型!", locale);
}
DataSource dataSource = new DataSource();
initDataSource(dataSource);
dataSource.setLotNo(dataSourceQo.getLotNo());
dataSource.setMachineNo(dataSourceQo.getMachineNo());
dataSource.setMaterialNo(dataSourceQo.getMaterialNo());
dataSource.setModelNo(dataSourceQo.getModelNo());
dataSource.setMachineTypeNo(dataSourceQo.getMachineTypeNo());
dataSource.setCraftItemName(dataSourceQo.getCraftItemName());
dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode());
dataSource.setInspectValue(dataSourceQo.getInspectValue());
dataSourceDao.save(dataSource);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
private void initDataSource(DataSource dataSource) {
dataSource.setLotNo("");
dataSource.setMachineNo("");
dataSource.setMaterialNo("");
dataSource.setModelNo("");
dataSource.setMachineTypeNo("");
dataSource.setInspectionItemCode("");
dataSource.setCraftItemName("");
dataSource.setInspectValue("");
dataSource.setPicturePath("");
}
}

View File

@ -2,11 +2,9 @@ package com.xkrs.service.impl;
import com.xkrs.dao.FileDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.DataSource;
import com.xkrs.model.entity.FileEntity;
import com.xkrs.model.qo.FileQo;
import com.xkrs.service.FileService;
import com.xkrs.util.DataSourceQuery;
import com.xkrs.util.ExcelUploadUtil;
import com.xkrs.util.ExportExcel;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@ -31,8 +29,8 @@ public class FileServiceImpl implements FileService {
@Resource
private FileDao fileDao;
@Resource
private DataSourceQuery dataSourceQuery;
// @Resource
// private DataSourceQuery dataSourceQuery;
/**
* 添加模板信息
@ -77,28 +75,29 @@ public class FileServiceImpl implements FileService {
@Transactional(rollbackOn = Exception.class)
@Override
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();
Optional<FileEntity> fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
if (fileEntity.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
}
String fileUploadPath = fileEntity.get().getFileUploadPath();
List<DataSource> dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
if (dataSources == null || dataSources.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
}
Map<String, String> map = new HashMap<>();
for (DataSource dataSource : dataSources) {
map.put(dataSource.getInspectionItemCode(), dataSource.getInspectValue());
}
String fill = ExportExcel.exportToProveExcel(map, fileUploadPath);
fileDao.updateFileDownloadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, fill);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale);
return null;
// 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();
// Optional<FileEntity> fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
// if (fileEntity.isEmpty()) {
// return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
// }
// String fileUploadPath = fileEntity.get().getFileUploadPath();
// List<DataSource> dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
// if (dataSources == null || dataSources.size() == 0) {
// return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
// }
// Map<String, String> map = new HashMap<>();
// for (DataSource dataSource : dataSources) {
// map.put(dataSource.getInspectionItemCode(), dataSource.getInspectValue());
// }
// String fill = ExportExcel.exportToProveExcel(map, fileUploadPath);
// fileDao.updateFileDownloadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, fill);
// return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale);
}
}

View File

@ -1,74 +0,0 @@
package com.xkrs.service.impl;
import com.xkrs.dao.DataSourceDao;
import com.xkrs.dao.PictureDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.DataSource;
import com.xkrs.model.qo.PictureQo;
import com.xkrs.service.PictureService;
import com.xkrs.util.DataSourceQuery;
import com.xkrs.util.ExcelUploadUtil;
import org.apache.http.util.TextUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.io.IOException;
import java.util.List;
import java.util.Locale;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@Service
public class PictureServiceImpl implements PictureService {
@Resource
private PictureDao pictureDao;
@Resource
private DataSourceDao dataSourceDao;
@Resource
private DataSourceQuery dataSourceQuery;
@Override
@Transactional(rollbackOn = Exception.class)
public String insertPicture(PictureQo pictureQo, MultipartFile pictureFile) throws IOException {
Locale locale = LocaleContextHolder.getLocale();
String filePath = ExcelUploadUtil.memoryFile(pictureFile, 2);
List<DataSource> dataSourceList = dataSourceQuery.selectDataSource(pictureQo.getLotNo(), pictureQo.getMachineNo(), pictureQo.getMaterialNo(), pictureQo.getModelNo(), pictureQo.getMachineTypeNo(), pictureQo.getCraftItemName());
if (dataSourceList == null || dataSourceList.isEmpty()) {
DataSource dataSource = new DataSource();
dataSource.setLotNo(pictureQo.getLotNo());
dataSource.setMachineNo(pictureQo.getMachineNo());
dataSource.setMaterialNo(pictureQo.getMaterialNo());
dataSource.setModelNo(pictureQo.getModelNo());
dataSource.setMachineTypeNo(pictureQo.getMachineTypeNo());
dataSource.setInspectionItemCode("");
dataSource.setCraftItemName(pictureQo.getCraftItemName());
dataSource.setInspectValue("");
dataSource.setPicturePath(filePath);
dataSourceDao.save(dataSource);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
for (DataSource dataSource : dataSourceList) {
String newFilePath;
if (TextUtils.isEmpty(dataSource.getPicturePath())) {
newFilePath = filePath;
} else {
newFilePath = dataSource.getPicturePath() + "," + filePath;
}
dataSourceDao.updatePicturePath(dataSource.getLotNo(), dataSource.getMachineNo(), dataSource.getMaterialNo(), dataSource.getModelNo(), dataSource.getMachineTypeNo(), dataSource.getCraftItemName(), newFilePath);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
@Override
public String deletePicture(String picturePath) {
Locale locale = LocaleContextHolder.getLocale();
String deleteResult = ExcelUploadUtil.delFile(picturePath, 2);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, deleteResult, locale);
}
}

View File

@ -1,48 +0,0 @@
package com.xkrs.service.impl;
import com.xkrs.dao.SpecDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.SpecEntity;
import com.xkrs.model.qo.SpecQo;
import com.xkrs.service.SpecService;
import com.xkrs.util.SpecQuery;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Locale;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@Service
public class SpecServiceImpl implements SpecService {
@Resource
private SpecQuery specQuery;
@Resource
private SpecDao specDao;
@Override
public String insertSpec(SpecQo specQo) {
Locale locale = LocaleContextHolder.getLocale();
List<SpecEntity> specEntities = specQuery.selectSpec(specQo.getMachineTypeNo(), specQo.getInspectionItemCode(),specQo.getCraftItemName());
if (!specEntities.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale);
}
SpecEntity specEntity1 = new SpecEntity();
specEntity1.setMachineTypeNo(specQo.getMachineTypeNo());
specEntity1.setInspectionItemCode(specQo.getInspectionItemCode());
specEntity1.setCraftItemName(specQo.getCraftItemName());
specEntity1.setMax(specQo.getMax());
specEntity1.setMean(specQo.getMean());
specEntity1.setMin(specQo.getMin());
specEntity1.setUnit(specQo.getUnit());
specEntity1.setInspectionMethod(specQo.getInspectionMethod());
specEntity1.setInspectionStandard(specQo.getInspectionStandard());
specEntity1.setRemark(specQo.getRemark());
specDao.save(specEntity1);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
}

View File

@ -1,42 +0,0 @@
package com.xkrs.util;
import com.xkrs.dao.DataDictDao;
import com.xkrs.model.entity.DataDict;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.persistence.criteria.Predicate;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 13:56
*/
@Component
public class DataDictQuery {
@Resource
private DataDictDao dataDictDao;
/**
* 动态多条件查询字典信息
*
* @return
*/
public List<DataDict> selectDataDict(String inspectionItemName, String inspectionItemCode) {
Specification<DataDict> specification = (root, criteriaQuery, criteriaBuilder) -> {
List<Predicate> list = new ArrayList<>();
if (inspectionItemName != null && !"".equals(inspectionItemName)) {
list.add(criteriaBuilder.equal(root.get("inspectionItemName").as(String.class), inspectionItemName));
}
if (inspectionItemCode != null && !"".equals(inspectionItemCode)) {
list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode));
}
Predicate[] predicates = new Predicate[list.size()];
return criteriaBuilder.and(list.toArray(predicates));
};
return dataDictDao.findAll(specification);
}
}

View File

@ -1,56 +0,0 @@
package com.xkrs.util;
import com.xkrs.dao.DataSourceDao;
import com.xkrs.model.entity.DataSource;
import org.apache.http.util.TextUtils;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.persistence.criteria.Predicate;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 13:56
*/
@Component
public class DataSourceQuery {
@Resource
private DataSourceDao dataSourceDao;
/**
* 动态多条件查询采集数据信息
*
* @return
*/
public List<DataSource> selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName) {
Specification<DataSource> specification = (root, criteriaQuery, criteriaBuilder) -> {
List<Predicate> list = new ArrayList<>();
if (!TextUtils.isEmpty(lotNo)) {
list.add(criteriaBuilder.equal(root.get("lotNo").as(String.class), lotNo));
}
if (!TextUtils.isEmpty(machineNo)) {
list.add(criteriaBuilder.equal(root.get("machineNo").as(String.class), machineNo));
}
if (!TextUtils.isEmpty(materialNo)) {
list.add(criteriaBuilder.equal(root.get("materialNo").as(String.class), materialNo));
}
if (!TextUtils.isEmpty(modelNo)) {
list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo));
}
if (!TextUtils.isEmpty(machineTypeNo)) {
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()];
return criteriaBuilder.and(list.toArray(predicates));
};
return dataSourceDao.findAll(specification, Sort.by(Sort.Direction.DESC, "id"));
}
}

View File

@ -1,55 +0,0 @@
package com.xkrs.util;
import com.xkrs.dao.PictureDao;
import com.xkrs.model.entity.PictureEntity;
import org.apache.http.util.TextUtils;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.persistence.criteria.Predicate;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 13:56
*/
@Component
public class PictureQuery {
@Resource
private PictureDao pictureDao;
/**
* 动态多条件查询图片信息
*
* @return
*/
public List<PictureEntity> selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName) {
Specification<PictureEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
List<Predicate> list = new ArrayList<>();
if (!TextUtils.isEmpty(lotNo)) {
list.add(criteriaBuilder.equal(root.get("lotNo").as(String.class), lotNo));
}
if (!TextUtils.isEmpty(machineNo)) {
list.add(criteriaBuilder.equal(root.get("machineNo").as(String.class), machineNo));
}
if (!TextUtils.isEmpty(materialNo)) {
list.add(criteriaBuilder.equal(root.get("materialNo").as(String.class), materialNo));
}
if (!TextUtils.isEmpty(modelNo)) {
list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo));
}
if (!TextUtils.isEmpty(machineTypeNo)) {
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()];
return criteriaBuilder.and(list.toArray(predicates));
};
return pictureDao.findAll(specification);
}
}

View File

@ -1,46 +0,0 @@
package com.xkrs.util;
import com.xkrs.dao.SpecDao;
import com.xkrs.model.entity.SpecEntity;
import org.apache.http.util.TextUtils;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.persistence.criteria.Predicate;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 13:56
*/
@Component
public class SpecQuery {
@Resource
private SpecDao specDao;
/**
* 动态多条件查询规格信息
*
* @return
*/
public List<SpecEntity> selectSpec(String machineTypeNo, String inspectionItemCode, String craftItemName) {
Specification<SpecEntity> specification = (root, criteriaQuery, criteriaBuilder) -> {
List<Predicate> list = new ArrayList<>();
if (!TextUtils.isEmpty(machineTypeNo)) {
list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo));
}
if (!TextUtils.isEmpty(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()];
return criteriaBuilder.and(list.toArray(predicates));
};
return specDao.findAll(specification);
}
}