Compare commits
No commits in common. "master" and "dev" have entirely different histories.
@ -1,50 +0,0 @@
|
|||||||
package com.xkrs.controller;
|
|
||||||
|
|
||||||
import com.xkrs.model.qo.CraftItemQoDelete;
|
|
||||||
import com.xkrs.model.qo.CraftItemQoInsert;
|
|
||||||
import com.xkrs.model.qo.CraftItemQoUpdate;
|
|
||||||
import com.xkrs.service.CraftItemService;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
public class CraftItemController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CraftItemService craftItemService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加工艺项目
|
|
||||||
*/
|
|
||||||
@PostMapping("/insertCraftItem")
|
|
||||||
public String insertCraftItem(@RequestBody CraftItemQoInsert insertQo) {
|
|
||||||
return craftItemService.insertCraftItem(insertQo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除工艺项目
|
|
||||||
*/
|
|
||||||
@PostMapping("/deleteCraftItem")
|
|
||||||
public String deleteCraftItem(@RequestBody CraftItemQoDelete deleteQo) {
|
|
||||||
return craftItemService.deleteCraftItem(deleteQo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新工艺项目名称
|
|
||||||
*/
|
|
||||||
@PostMapping("/updateCraftItem")
|
|
||||||
public String updateCraftItem(@RequestBody CraftItemQoUpdate updateQo) {
|
|
||||||
return craftItemService.updateCraftItem(updateQo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询工艺项目
|
|
||||||
*/
|
|
||||||
@GetMapping("/queryCraftItem")
|
|
||||||
public String queryCraftItem(@RequestParam(required = false, value = "no") String no, @RequestParam(required = false, value = "name") String name) {
|
|
||||||
return craftItemService.queryCraftItem(no, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,24 @@
|
|||||||
package com.xkrs.controller;
|
package com.xkrs.controller;
|
||||||
|
|
||||||
|
import com.xkrs.dao.FileDao;
|
||||||
|
import com.xkrs.encapsulation.PromptMessageEnum;
|
||||||
|
import com.xkrs.model.qo.FileQo;
|
||||||
|
import com.xkrs.service.FileService;
|
||||||
|
import com.xkrs.util.ExcelUploadUtil;
|
||||||
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: XinYi Song
|
* @Author: XinYi Song
|
||||||
@ -9,56 +27,56 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
@RestController
|
@RestController
|
||||||
public class FileController {
|
public class FileController {
|
||||||
|
|
||||||
// @Resource
|
@Resource
|
||||||
// private FileService fileService;
|
private FileService fileService;
|
||||||
//
|
|
||||||
// @Resource
|
@Resource
|
||||||
// private FileDao fileDao;
|
private FileDao fileDao;
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 上传模板信息
|
* 上传模板信息
|
||||||
// *
|
*
|
||||||
// * @param fileQo
|
* @param fileQo
|
||||||
// * @param fileExcel
|
* @param fileExcel
|
||||||
// * @return
|
* @return
|
||||||
// * @throws IOException
|
* @throws IOException
|
||||||
// */
|
*/
|
||||||
// @PostMapping("/insertFileExcel")
|
@PostMapping("/insertFileExcel")
|
||||||
// public String insertFileExcel(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
|
public String insertFileExcel(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
|
||||||
// return fileService.insertFileExcel(fileQo, fileExcel);
|
return fileService.insertFileExcel(fileQo, fileExcel);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 修改上传的模板信息
|
* 修改上传的模板信息
|
||||||
// *
|
*
|
||||||
// * @param fileQo
|
* @param fileQo
|
||||||
// * @param fileExcel
|
* @param fileExcel
|
||||||
// * @return
|
* @return
|
||||||
// * @throws IOException
|
* @throws IOException
|
||||||
// */
|
*/
|
||||||
// @PostMapping("/updateFileUploadPath")
|
@PostMapping("/updateFileUploadPath")
|
||||||
// @Transactional(rollbackOn = Exception.class)
|
@Transactional(rollbackOn = Exception.class)
|
||||||
// public String updateFileUploadPath(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
|
public String updateFileUploadPath(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
|
||||||
// String lotNo = fileQo.getLotNo();
|
String lotNo = fileQo.getLotNo();
|
||||||
// String machineNo = fileQo.getMachineNo();
|
String machineNo = fileQo.getMachineNo();
|
||||||
// String materialNo = fileQo.getMaterialNo();
|
String materialNo = fileQo.getMaterialNo();
|
||||||
// String modelNo = fileQo.getModelNo();
|
String modelNo = fileQo.getModelNo();
|
||||||
// String machineTypeNo = fileQo.getMachineTypeNo();
|
String machineTypeNo = fileQo.getMachineTypeNo();
|
||||||
// String craftItemName = fileQo.getCraftItemName();
|
String craftItemName = fileQo.getCraftItemName();
|
||||||
// Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// String file = ExcelUploadUtil.memoryFile(fileExcel, 1);
|
String file = ExcelUploadUtil.memoryFile(fileExcel, 1);
|
||||||
// fileDao.updateFileUploadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, file);
|
fileDao.updateFileUploadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, file);
|
||||||
// return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /**
|
/**
|
||||||
// * 导出excel
|
* 导出excel
|
||||||
// *
|
*
|
||||||
// * @param fileQo
|
* @param fileQo
|
||||||
// * @return
|
* @return
|
||||||
// */
|
*/
|
||||||
// @PostMapping("/exportExcel")
|
@PostMapping("/exportExcel")
|
||||||
// public String exportExcel(@RequestBody FileQo fileQo) throws IOException, InvalidFormatException {
|
public String exportExcel(@RequestBody FileQo fileQo) throws IOException, InvalidFormatException {
|
||||||
// return fileService.exportExcel(fileQo);
|
return fileService.exportExcel(fileQo);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.xkrs.controller;
|
package com.xkrs.controller;
|
||||||
|
|
||||||
import com.xkrs.model.qo.ExportSourceExcelQo;
|
|
||||||
import com.xkrs.model.qo.QcSourceQoDelete;
|
import com.xkrs.model.qo.QcSourceQoDelete;
|
||||||
import com.xkrs.model.qo.QcSourceQoInsert;
|
import com.xkrs.model.qo.QcSourceQoInsert;
|
||||||
import com.xkrs.service.QcSourceService;
|
import com.xkrs.service.QcSourceService;
|
||||||
@ -16,18 +15,10 @@ public class QcSourceController {
|
|||||||
private QcSourceService qcSourceService;
|
private QcSourceService qcSourceService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加检验数据(用于在Json中接收字符串数据)
|
* 添加检验数据
|
||||||
*/
|
*/
|
||||||
@PostMapping("/insertQcSource")
|
@PostMapping("/insertQcSource")
|
||||||
public String insertQcSource(@RequestBody QcSourceQoInsert insertQo, @RequestParam(required = false, value = "picture") MultipartFile picture) {
|
public String insertQcSource(QcSourceQoInsert insertQo, @RequestParam(required = false, value = "picture") MultipartFile picture) {
|
||||||
return qcSourceService.insertQcSource(insertQo, picture);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加检验数据(用于在form-data中接收图片文件)
|
|
||||||
*/
|
|
||||||
@PostMapping("/insertQcSourceOnlyPicture")
|
|
||||||
public String insertQcSourceOnlyPicture(QcSourceQoInsert insertQo, @RequestParam(value = "picture") MultipartFile picture) {
|
|
||||||
return qcSourceService.insertQcSource(insertQo, picture);
|
return qcSourceService.insertQcSource(insertQo, picture);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,24 +34,8 @@ public class QcSourceController {
|
|||||||
* 查询检验数据
|
* 查询检验数据
|
||||||
*/
|
*/
|
||||||
@GetMapping("/queryQcSource")
|
@GetMapping("/queryQcSource")
|
||||||
public String queryQcSource(@RequestParam(required = false, value = "batchNo") String batchNo, @RequestParam(required = false, value = "machineNo") String machineNo, @RequestParam(required = false, value = "materialNo") String materialNo, @RequestParam(required = false, value = "mouldNo") String mouldNo, @RequestParam(required = false, value = "varietyNo") String varietyNo, @RequestParam(required = false, value = "craftItemNo") String craftItemNo) {
|
public String queryQcSource(@RequestParam(required = false, value = "batchNo") String batchNo, @RequestParam(required = false, value = "machineNo") String machineNo, @RequestParam(required = false, value = "materialNo") String materialNo, @RequestParam(required = false, value = "mouldNo") String mouldNo, @RequestParam(required = false, value = "varietyNo") String varietyNo) {
|
||||||
return qcSourceService.queryQcSource(batchNo, machineNo, materialNo, mouldNo, varietyNo, craftItemNo);
|
return qcSourceService.queryQcSource(batchNo, machineNo, materialNo, mouldNo, varietyNo);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出Excel表格
|
|
||||||
*/
|
|
||||||
@PostMapping("/exportExcel")
|
|
||||||
public String exportExcel(@RequestBody ExportSourceExcelQo exportSourceExcelQo) throws Exception {
|
|
||||||
return qcSourceService.exportExcel(exportSourceExcelQo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 格式化创建时间历史数据
|
|
||||||
*/
|
|
||||||
@GetMapping("/formatCreateTime")
|
|
||||||
public String formatCreateTime() {
|
|
||||||
return qcSourceService.formatCreateTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package com.xkrs.controller;
|
package com.xkrs.controller;
|
||||||
|
|
||||||
import com.xkrs.model.qo.ExportSpecExcelQo;
|
|
||||||
import com.xkrs.model.qo.QcSpecQoDelete;
|
import com.xkrs.model.qo.QcSpecQoDelete;
|
||||||
import com.xkrs.model.qo.QcSpecQoInsert;
|
import com.xkrs.model.qo.QcSpecQoInsert;
|
||||||
import com.xkrs.model.qo.QcSpecQoUpdate;
|
import com.xkrs.model.qo.QcSpecQoUpdate;
|
||||||
import com.xkrs.service.QcSpecService;
|
import com.xkrs.service.QcSpecService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@ -44,32 +42,8 @@ public class QcSpecController {
|
|||||||
* 查询检验规格
|
* 查询检验规格
|
||||||
*/
|
*/
|
||||||
@GetMapping("/queryQcSpec")
|
@GetMapping("/queryQcSpec")
|
||||||
public String queryQcSpec(@RequestParam(required = false, value = "varietyNo") String varietyNo, @RequestParam(required = false, value = "craftItemNo") String craftItemNo, @RequestParam(required = false, value = "qcItemNo") String qcItemNo) {
|
public String queryQcSpec(@RequestParam(required = false, value = "varietyNo") String varietyNo, @RequestParam(required = false, value = "qcItemNo") String qcItemNo) {
|
||||||
return qcSpecService.queryQcSpec(varietyNo, craftItemNo, qcItemNo);
|
return qcSpecService.queryQcSpec(varietyNo, qcItemNo);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导入检验规格
|
|
||||||
*/
|
|
||||||
@PostMapping("/importSpecExcel")
|
|
||||||
public String importSpecExcel(@RequestParam(value = "specExcel") MultipartFile specExcel) {
|
|
||||||
return qcSpecService.importSpecExcel(specExcel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出检验规格
|
|
||||||
*/
|
|
||||||
@PostMapping("/exportSpecExcel")
|
|
||||||
public String exportSpecExcel(@RequestBody ExportSpecExcelQo exportSpecExcelQo) throws Exception {
|
|
||||||
return qcSpecService.exportSpecExcel(exportSpecExcelQo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出空白检验规格
|
|
||||||
*/
|
|
||||||
@PostMapping("/exportEmptySpecExcel")
|
|
||||||
public String exportEmptySpecExcel(@RequestBody ExportSpecExcelQo exportSpecExcelQo) throws Exception {
|
|
||||||
return qcSpecService.exportEmptySpecExcel(exportSpecExcelQo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package com.xkrs.dao;
|
|
||||||
|
|
||||||
import com.xkrs.model.entity.CraftItemEntity;
|
|
||||||
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 javax.transaction.Transactional;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工艺项目Dao
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public interface CraftItemDao extends JpaRepository<CraftItemEntity, Integer>, JpaSpecificationExecutor<CraftItemEntity> {
|
|
||||||
|
|
||||||
Optional<CraftItemEntity> findByCraftItemNo(String craftItemNo);
|
|
||||||
|
|
||||||
Optional<CraftItemEntity> findByCraftItemName(String craftItemName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新工艺项目名称
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackOn = Exception.class)
|
|
||||||
@Modifying(clearAutomatically = true)
|
|
||||||
@Query(value = "UPDATE craft_item SET update_time = ?2, craft_item_name = ?3 WHERE id = ?1", nativeQuery = true)
|
|
||||||
void updateNameById(Integer id, String updateTime, String name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询工艺项目
|
|
||||||
*/
|
|
||||||
@Query(value = "SELECT id AS id, craft_item_no AS no, craft_item_name AS name FROM craft_item WHERE craft_item_no LIKE %?1% AND craft_item_name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
|
|
||||||
List<Map<String, Object>> queryCraftItem(String no, String name);
|
|
||||||
}
|
|
@ -17,20 +17,18 @@ import java.util.Optional;
|
|||||||
@Component
|
@Component
|
||||||
public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpecificationExecutor<QcItemEntity> {
|
public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpecificationExecutor<QcItemEntity> {
|
||||||
|
|
||||||
Optional<QcItemEntity> findByQcItemNo(String qcItemNo);
|
Optional<QcItemEntity> findByNo(String no);
|
||||||
|
|
||||||
Optional<QcItemEntity> findByQcItemName(String qcItemName);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新检验项目名称
|
* 更新检验项目名称
|
||||||
*/
|
*/
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
@Query(value = "UPDATE qc_item SET update_time = ?2, qc_item_name = ?3 WHERE id = ?1", nativeQuery = true)
|
@Query(value = "UPDATE qc_item SET update_time = ?2, name = ?3 WHERE id = ?1", nativeQuery = true)
|
||||||
void updateNameById(Integer id, String updateTime, String name);
|
void updateNameById(Integer id, String updateTime, String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询检验项目
|
* 查询检验项目
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT id AS id, qc_item_no AS no, qc_item_name AS name, qc_item_type AS type FROM qc_item WHERE qc_item_no LIKE %?1% AND qc_item_name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
|
@Query(value = "SELECT id, no, name, type FROM qc_item WHERE no LIKE %?1% AND name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
|
||||||
List<Map<String, Object>> queryQcItem(String no, String name);
|
List<Map<String, Object>> queryQcItem(String no, String name);
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,11 @@ package com.xkrs.dao;
|
|||||||
import com.xkrs.model.entity.QcSourceEntity;
|
import com.xkrs.model.entity.QcSourceEntity;
|
||||||
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;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检验数据Dao
|
* 检验数据Dao
|
||||||
@ -16,11 +15,7 @@ import java.util.List;
|
|||||||
@Component
|
@Component
|
||||||
public interface QcSourceDao extends JpaRepository<QcSourceEntity, Integer>, JpaSpecificationExecutor<QcSourceEntity> {
|
public interface QcSourceDao extends JpaRepository<QcSourceEntity, Integer>, JpaSpecificationExecutor<QcSourceEntity> {
|
||||||
|
|
||||||
@Query(value = "SELECT * FROM qc_source WHERE batch_no LIKE %?1% AND machine_no LIKE %?2% AND material_no LIKE %?3% AND mould_no LIKE %?4% AND variety_no LIKE %?5% AND craft_item_no LIKE %?6% ORDER BY create_time DESC", nativeQuery = true)
|
@Query(value = "SELECT id, batch_no AS batchNo, machine_no AS machineNo, material_no AS materialNo, mould_no AS mouldNo, variety_no AS varietyNo, qc_item_no AS qcItemNo, qc_value AS qcValue FROM qc_source WHERE batch_no LIKE %?1% AND machine_no LIKE %?2% AND material_no LIKE %?3% AND mould_no LIKE %?4% AND variety_no LIKE %?5% ORDER BY create_time DESC", nativeQuery = true)
|
||||||
List<QcSourceEntity> queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo, String craftItemNo);
|
List<Map<String, Object>> queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo);
|
||||||
|
|
||||||
@Transactional(rollbackOn = Exception.class)
|
|
||||||
@Modifying(clearAutomatically = true)
|
|
||||||
@Query(value = "UPDATE qc_source SET create_time_format = ?2 WHERE id = ?1", nativeQuery = true)
|
|
||||||
void formatCreateTime(Integer id, String formatCreateTime);
|
|
||||||
}
|
}
|
@ -7,7 +7,6 @@ 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;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -15,34 +14,18 @@ import java.util.Optional;
|
|||||||
@Component
|
@Component
|
||||||
public interface QcSpecDao extends JpaRepository<QcSpecEntity, Integer>, JpaSpecificationExecutor<QcSpecEntity> {
|
public interface QcSpecDao extends JpaRepository<QcSpecEntity, Integer>, JpaSpecificationExecutor<QcSpecEntity> {
|
||||||
|
|
||||||
@Query(value = "SELECT * FROM qc_spec WHERE variety_no = ?1 AND craft_item_no = ?2 AND qc_item_no = ?3 ORDER BY create_time ASC", nativeQuery = true)
|
Optional<QcSpecEntity> findByVarietyNoAndQcItemNo(String varietyNo, String qcItemNo);
|
||||||
Optional<QcSpecEntity> findExistsQcSpec(String varietyNo, String craftItemNo, String qcItemNo);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新检验规格(Integer id)
|
* 更新检验规格
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackOn = Exception.class)
|
|
||||||
@Modifying(clearAutomatically = true)
|
@Modifying(clearAutomatically = true)
|
||||||
@Query(value = "UPDATE qc_spec SET update_time = ?2, max = ?3, mean = ?4, min = ?5, unit = ?6, method = ?7, standard = ?8, remark = ?9 WHERE id = ?1", nativeQuery = true)
|
@Query(value = "UPDATE qc_spec SET update_time = ?2, max = ?3, mean = ?4, min = ?5, unit = ?6, method = ?7, standard = ?8, remark = ?9 WHERE id = ?1", nativeQuery = true)
|
||||||
void updateQcSpecById(Integer id, String updateTime, String max, String mean, String min, String unit, String method, String standard, String remark);
|
void updateQcSpecById(Integer id, String updateTime, String max, String mean, String min, String unit, String method, String standard, String remark);
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新检验规格(String varietyNo, String craftItemNo, String qcItemNo)
|
|
||||||
*/
|
|
||||||
@Transactional(rollbackOn = Exception.class)
|
|
||||||
@Modifying(clearAutomatically = true)
|
|
||||||
@Query(value = "UPDATE qc_spec SET update_time = ?4, max = ?5, mean = ?6, min = ?7, unit = ?8, method = ?9, standard = ?10, remark = ?11 WHERE variety_no = ?1 AND craft_item_no = ?2 AND qc_item_no = ?3", nativeQuery = true)
|
|
||||||
void updateQcSpecByVCQ(String varietyNo, String craftItemNo, String qcItemNo, String updateTime, String max, String mean, String min, String unit, String method, String standard, String remark);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询检验规格
|
* 查询检验规格
|
||||||
*/
|
*/
|
||||||
@Query(value = "SELECT id, variety_no AS varietyNo, craft_item_no AS craftItemNo, qc_item_no AS qcItemNo, max, mean, min, unit, method, standard, remark FROM qc_spec WHERE variety_no LIKE %?1% AND qc_item_no LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
|
@Query(value = "SELECT id, variety_no AS varietyNo, qc_item_no AS qcItemNo, max, mean, min, unit, method, standard, remark FROM qc_spec WHERE variety_no LIKE %?1% AND qc_item_no LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
|
||||||
List<Map<String, Object>> queryQcSpec(String varietyNo, String qcItemNo);
|
List<Map<String, Object>> queryQcSpec(String varietyNo, String qcItemNo);
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询检验规格
|
|
||||||
*/
|
|
||||||
@Query(value = "SELECT id, variety_no AS varietyNo, craft_item_no AS craftItemNo, qc_item_no AS qcItemNo, max, mean, min, unit, method, standard, remark FROM qc_spec WHERE variety_no LIKE %?1% AND craft_item_no = ?2 AND qc_item_no LIKE %?3% ORDER BY create_time ASC", nativeQuery = true)
|
|
||||||
List<Map<String, Object>> queryQcSpec(String varietyNo, String craftItemNo, String qcItemNo);
|
|
||||||
}
|
}
|
@ -1,51 +0,0 @@
|
|||||||
package com.xkrs.model.bean;
|
|
||||||
|
|
||||||
public class ReadSpecHeadBean {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否成功
|
|
||||||
*/
|
|
||||||
private boolean success;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 错误消息
|
|
||||||
*/
|
|
||||||
private String errorMessage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表头的有效列数
|
|
||||||
*/
|
|
||||||
private long headCount;
|
|
||||||
|
|
||||||
public ReadSpecHeadBean() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSuccess() {
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccess(boolean success) {
|
|
||||||
this.success = success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getErrorMessage() {
|
|
||||||
return errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setErrorMessage(String errorMessage) {
|
|
||||||
this.errorMessage = errorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getHeadCount() {
|
|
||||||
return headCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeadCount(long headCount) {
|
|
||||||
this.headCount = headCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ReadSpecHeadBean{" + "success=" + success + ", errorMessage='" + errorMessage + '\'' + ", headCount=" + headCount + '}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
package com.xkrs.model.bean;
|
|
||||||
|
|
||||||
public class XSSFCellDataBean {
|
|
||||||
|
|
||||||
public static final int VALUE_TYPE_STRING = 1;
|
|
||||||
public static final int VALUE_TYPE_DOUBLE = 2;
|
|
||||||
|
|
||||||
private int valueType;
|
|
||||||
private String stringValue;
|
|
||||||
private double doubleValue;
|
|
||||||
|
|
||||||
public XSSFCellDataBean(String source) {
|
|
||||||
double tempDoubleValue = -100_000D;
|
|
||||||
try {
|
|
||||||
tempDoubleValue = Double.parseDouble(source);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
if (tempDoubleValue < -99_000D) {
|
|
||||||
valueType = VALUE_TYPE_STRING;
|
|
||||||
stringValue = source;
|
|
||||||
} else {
|
|
||||||
valueType = VALUE_TYPE_DOUBLE;
|
|
||||||
doubleValue = tempDoubleValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getValueType() {
|
|
||||||
return valueType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public XSSFCellDataBean setValueType(int valueType) {
|
|
||||||
this.valueType = valueType;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStringValue() {
|
|
||||||
return stringValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public XSSFCellDataBean setStringValue(String stringValue) {
|
|
||||||
this.stringValue = stringValue;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getDoubleValue() {
|
|
||||||
return doubleValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public XSSFCellDataBean setDoubleValue(double doubleValue) {
|
|
||||||
this.doubleValue = doubleValue;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "XSSFCellDataBean{" + "valueType=" + valueType + ", stringValue='" + stringValue + '\'' + ", doubleValue=" + doubleValue + '}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,91 +0,0 @@
|
|||||||
package com.xkrs.model.entity;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工艺项目
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "craft_item")
|
|
||||||
public class CraftItemEntity {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "craft_item_seq_gen")
|
|
||||||
@SequenceGenerator(name = "craft_item_seq_gen", sequenceName = "craft_item_id_seq", allocationSize = 1)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
|
||||||
private String createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
|
||||||
private String updateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编号
|
|
||||||
*/
|
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
|
||||||
private String craftItemNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
|
||||||
private String craftItemName;
|
|
||||||
|
|
||||||
public CraftItemEntity() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(String createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUpdateTime() {
|
|
||||||
return updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdateTime(String updateTime) {
|
|
||||||
this.updateTime = updateTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCraftItemNo() {
|
|
||||||
return craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftItemNo(String craftItemNo) {
|
|
||||||
this.craftItemNo = craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCraftItemName() {
|
|
||||||
return craftItemName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftItemName(String craftItemName) {
|
|
||||||
this.craftItemName = craftItemName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CraftItemEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", craftItemNo='" + craftItemNo + '\'' + ", craftItemName='" + craftItemName + '\'' + '}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -33,13 +33,13 @@ public class QcItemEntity {
|
|||||||
* 编号
|
* 编号
|
||||||
*/
|
*/
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
@Column(length = 85, columnDefinition = "varchar(85)")
|
||||||
private String qcItemNo;
|
private String no;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
@Column(length = 85, columnDefinition = "varchar(85)")
|
||||||
private String qcItemName;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型
|
* 类型
|
||||||
@ -47,7 +47,7 @@ public class QcItemEntity {
|
|||||||
* "1":图片格式
|
* "1":图片格式
|
||||||
*/
|
*/
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
@Column(length = 85, columnDefinition = "varchar(85)")
|
||||||
private String qcItemType;
|
private String type;
|
||||||
|
|
||||||
public QcItemEntity() {
|
public QcItemEntity() {
|
||||||
}
|
}
|
||||||
@ -76,32 +76,32 @@ public class QcItemEntity {
|
|||||||
this.updateTime = updateTime;
|
this.updateTime = updateTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQcItemNo() {
|
public String getNo() {
|
||||||
return qcItemNo;
|
return no;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQcItemNo(String qcItemNo) {
|
public void setNo(String no) {
|
||||||
this.qcItemNo = qcItemNo;
|
this.no = no;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQcItemName() {
|
public String getName() {
|
||||||
return qcItemName;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQcItemName(String qcItemName) {
|
public void setName(String name) {
|
||||||
this.qcItemName = qcItemName;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQcItemType() {
|
public String getType() {
|
||||||
return qcItemType;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQcItemType(String qcItemType) {
|
public void setType(String type) {
|
||||||
this.qcItemType = qcItemType;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "QcItemEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcItemName='" + qcItemName + '\'' + ", qcItemType='" + qcItemType + '\'' + '}';
|
return "QcItemEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", no='" + no + '\'' + ", name='" + name + '\'' + ", type='" + type + '\'' + '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,6 @@ public class QcSourceEntity {
|
|||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
@Column(length = 85, columnDefinition = "varchar(85)")
|
||||||
private String createTime;
|
private String createTime;
|
||||||
|
|
||||||
/**
|
|
||||||
* 格式化创建时间
|
|
||||||
*/
|
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
|
||||||
private String createTimeFormat;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批次号
|
* 批次号
|
||||||
*/
|
*/
|
||||||
@ -59,12 +53,6 @@ public class QcSourceEntity {
|
|||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
@Column(length = 85, columnDefinition = "varchar(85)")
|
||||||
private String varietyNo;
|
private String varietyNo;
|
||||||
|
|
||||||
/**
|
|
||||||
* 工艺项目编号
|
|
||||||
*/
|
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
|
||||||
private String craftItemNo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检验项目编号
|
* 检验项目编号
|
||||||
*/
|
*/
|
||||||
@ -96,14 +84,6 @@ public class QcSourceEntity {
|
|||||||
this.createTime = createTime;
|
this.createTime = createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreateTimeFormat() {
|
|
||||||
return createTimeFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTimeFormat(String createTimeFormat) {
|
|
||||||
this.createTimeFormat = createTimeFormat;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBatchNo() {
|
public String getBatchNo() {
|
||||||
return batchNo;
|
return batchNo;
|
||||||
}
|
}
|
||||||
@ -144,14 +124,6 @@ public class QcSourceEntity {
|
|||||||
this.varietyNo = varietyNo;
|
this.varietyNo = varietyNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCraftItemNo() {
|
|
||||||
return craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftItemNo(String craftItemNo) {
|
|
||||||
this.craftItemNo = craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQcItemNo() {
|
public String getQcItemNo() {
|
||||||
return qcItemNo;
|
return qcItemNo;
|
||||||
}
|
}
|
||||||
@ -170,18 +142,6 @@ public class QcSourceEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "QcSourceEntity{" +
|
return "QcSourceEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcValue='" + qcValue + '\'' + '}';
|
||||||
"id=" + id +
|
|
||||||
", createTime='" + createTime + '\'' +
|
|
||||||
", createTimeFormat='" + createTimeFormat + '\'' +
|
|
||||||
", batchNo='" + batchNo + '\'' +
|
|
||||||
", machineNo='" + machineNo + '\'' +
|
|
||||||
", materialNo='" + materialNo + '\'' +
|
|
||||||
", mouldNo='" + mouldNo + '\'' +
|
|
||||||
", varietyNo='" + varietyNo + '\'' +
|
|
||||||
", craftItemNo='" + craftItemNo + '\'' +
|
|
||||||
", qcItemNo='" + qcItemNo + '\'' +
|
|
||||||
", qcValue='" + qcValue + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,12 +35,6 @@ public class QcSpecEntity {
|
|||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
@Column(length = 85, columnDefinition = "varchar(85)")
|
||||||
private String varietyNo;
|
private String varietyNo;
|
||||||
|
|
||||||
/**
|
|
||||||
* 工艺项目编号
|
|
||||||
*/
|
|
||||||
@Column(length = 85, columnDefinition = "varchar(85)")
|
|
||||||
private String craftItemNo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检验项目编号
|
* 检验项目编号
|
||||||
*/
|
*/
|
||||||
@ -124,14 +118,6 @@ public class QcSpecEntity {
|
|||||||
this.varietyNo = varietyNo;
|
this.varietyNo = varietyNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCraftItemNo() {
|
|
||||||
return craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftItemNo(String craftItemNo) {
|
|
||||||
this.craftItemNo = craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQcItemNo() {
|
public String getQcItemNo() {
|
||||||
return qcItemNo;
|
return qcItemNo;
|
||||||
}
|
}
|
||||||
@ -198,6 +184,6 @@ public class QcSpecEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "QcSpecEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", varietyNo='" + varietyNo + '\'' + ", craftItemNo='" + craftItemNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}';
|
return "QcSpecEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
package com.xkrs.model.qo;
|
|
||||||
|
|
||||||
import com.xkrs.model.va.CraftItemQoDeleteVa;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除工艺项目接收类
|
|
||||||
*/
|
|
||||||
public class CraftItemQoDelete {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "{CraftItemEntity.id.blank}", groups = {CraftItemQoDeleteVa.class})
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
public CraftItemQoDelete() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CraftItemQoDelete{" + "id=" + id + '}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.xkrs.model.qo;
|
|
||||||
|
|
||||||
import com.xkrs.model.va.CraftItemQoInsertVa;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增工艺项目接收类
|
|
||||||
*/
|
|
||||||
public class CraftItemQoInsert {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 编号
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "{CraftItemEntity.no.blank}", groups = {CraftItemQoInsertVa.class})
|
|
||||||
private String no;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "{CraftItemEntity.name.blank}", groups = {CraftItemQoInsertVa.class})
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public CraftItemQoInsert() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNo() {
|
|
||||||
return no;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNo(String no) {
|
|
||||||
this.no = no;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CraftItemQoInsert{" + "no='" + no + '\'' + ", name='" + name + '\'' + '}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
package com.xkrs.model.qo;
|
|
||||||
|
|
||||||
import com.xkrs.model.va.CraftItemQoUpdateVa;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
public class CraftItemQoUpdate {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "{CraftItemEntity.id.blank}", groups = {CraftItemQoUpdateVa.class})
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 名称
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "{CraftItemEntity.name.blank}", groups = {CraftItemQoUpdateVa.class})
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
public CraftItemQoUpdate() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "CraftItemQoUpdate{" + "id=" + id + ", name='" + name + '\'' + '}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,108 +0,0 @@
|
|||||||
package com.xkrs.model.qo;
|
|
||||||
|
|
||||||
import com.xkrs.model.va.ExportSourceExcelQoVa;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
public class ExportSourceExcelQo {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IP端口
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "{QcSourceEntity.host.blank}", groups = {ExportSourceExcelQoVa.class})
|
|
||||||
private String host;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批次号
|
|
||||||
*/
|
|
||||||
private String batchNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机器号
|
|
||||||
*/
|
|
||||||
private String machineNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料号
|
|
||||||
*/
|
|
||||||
private String materialNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模具号
|
|
||||||
*/
|
|
||||||
private String mouldNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 机种号
|
|
||||||
*/
|
|
||||||
private String varietyNo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 工艺项目编号
|
|
||||||
*/
|
|
||||||
private String craftItemNo;
|
|
||||||
|
|
||||||
public ExportSourceExcelQo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHost() {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHost(String host) {
|
|
||||||
this.host = host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBatchNo() {
|
|
||||||
return batchNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBatchNo(String batchNo) {
|
|
||||||
this.batchNo = batchNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 getMouldNo() {
|
|
||||||
return mouldNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMouldNo(String mouldNo) {
|
|
||||||
this.mouldNo = mouldNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVarietyNo() {
|
|
||||||
return varietyNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVarietyNo(String varietyNo) {
|
|
||||||
this.varietyNo = varietyNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCraftItemNo() {
|
|
||||||
return craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftItemNo(String craftItemNo) {
|
|
||||||
this.craftItemNo = craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ExportExcelQo{" + "host='" + host + '\'' + ", batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", craftItemNo='" + craftItemNo + '\'' + '}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.xkrs.model.qo;
|
|
||||||
|
|
||||||
import com.xkrs.model.va.ExportSpecExcelQoVa;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
public class ExportSpecExcelQo {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IP端口
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "{QcSpecEntity.host.blank}", groups = {ExportSpecExcelQoVa.class})
|
|
||||||
private String host;
|
|
||||||
|
|
||||||
public ExportSpecExcelQo() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHost() {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHost(String host) {
|
|
||||||
this.host = host;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ExportSpecExcelQo{" + "host='" + host + '\'' + '}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -39,12 +39,6 @@ public class QcSourceQoInsert {
|
|||||||
@NotBlank(message = "{QcSourceEntity.varietyNo.blank}", groups = {QcSourceQoInsertVa.class})
|
@NotBlank(message = "{QcSourceEntity.varietyNo.blank}", groups = {QcSourceQoInsertVa.class})
|
||||||
private String varietyNo;
|
private String varietyNo;
|
||||||
|
|
||||||
/**
|
|
||||||
* 工艺项目编号
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "{QcSourceEntity.craftItemNo.blank}", groups = {QcSourceQoInsertVa.class})
|
|
||||||
private String craftItemNo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检验项目编号
|
* 检验项目编号
|
||||||
*/
|
*/
|
||||||
@ -99,14 +93,6 @@ public class QcSourceQoInsert {
|
|||||||
this.varietyNo = varietyNo;
|
this.varietyNo = varietyNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCraftItemNo() {
|
|
||||||
return craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftItemNo(String craftItemNo) {
|
|
||||||
this.craftItemNo = craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQcItemNo() {
|
public String getQcItemNo() {
|
||||||
return qcItemNo;
|
return qcItemNo;
|
||||||
}
|
}
|
||||||
@ -125,6 +111,6 @@ public class QcSourceQoInsert {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "QcSourceQoInsert{" + "batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", craftItemNo='" + craftItemNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcValue='" + qcValue + '\'' + '}';
|
return "QcSourceQoInsert{" + "batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcValue='" + qcValue + '\'' + '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,6 @@ public class QcSpecQoInsert {
|
|||||||
@NotBlank(message = "{QcSpecEntity.varietyNo.blank}", groups = {QcSpecQoInsertVa.class})
|
@NotBlank(message = "{QcSpecEntity.varietyNo.blank}", groups = {QcSpecQoInsertVa.class})
|
||||||
private String varietyNo;
|
private String varietyNo;
|
||||||
|
|
||||||
/**
|
|
||||||
* 工艺项目编号
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "{QcSpecEntity.craftItemNo.blank}", groups = {QcSpecQoInsertVa.class})
|
|
||||||
private String craftItemNo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检验项目编号
|
* 检验项目编号
|
||||||
*/
|
*/
|
||||||
@ -73,14 +67,6 @@ public class QcSpecQoInsert {
|
|||||||
this.varietyNo = varietyNo;
|
this.varietyNo = varietyNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCraftItemNo() {
|
|
||||||
return craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCraftItemNo(String craftItemNo) {
|
|
||||||
this.craftItemNo = craftItemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getQcItemNo() {
|
public String getQcItemNo() {
|
||||||
return qcItemNo;
|
return qcItemNo;
|
||||||
}
|
}
|
||||||
@ -147,6 +133,6 @@ public class QcSpecQoInsert {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "QcSpecQoInsert{" + "varietyNo='" + varietyNo + '\'' + ", craftItemNo='" + craftItemNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}';
|
return "QcSpecQoInsert{" + "varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
package com.xkrs.model.va;
|
|
||||||
|
|
||||||
public interface CraftItemQoDeleteVa {
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
package com.xkrs.model.va;
|
|
||||||
|
|
||||||
public interface CraftItemQoInsertVa {
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
package com.xkrs.model.va;
|
|
||||||
|
|
||||||
public interface CraftItemQoUpdateVa {
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
package com.xkrs.model.va;
|
|
||||||
|
|
||||||
public interface ExportSourceExcelQoVa {
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
package com.xkrs.model.va;
|
|
||||||
|
|
||||||
public interface ExportSpecExcelQoVa {
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package com.xkrs.service;
|
|
||||||
|
|
||||||
import com.xkrs.model.qo.CraftItemQoDelete;
|
|
||||||
import com.xkrs.model.qo.CraftItemQoInsert;
|
|
||||||
import com.xkrs.model.qo.CraftItemQoUpdate;
|
|
||||||
|
|
||||||
public interface CraftItemService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加工艺项目
|
|
||||||
*/
|
|
||||||
String insertCraftItem(CraftItemQoInsert insertQo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除工艺项目
|
|
||||||
*/
|
|
||||||
String deleteCraftItem(CraftItemQoDelete deleteQo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新工艺项目名称
|
|
||||||
*/
|
|
||||||
String updateCraftItem(CraftItemQoUpdate updateQo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询工艺项目
|
|
||||||
*/
|
|
||||||
String queryCraftItem(String no, String name);
|
|
||||||
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
package com.xkrs.service;
|
package com.xkrs.service;
|
||||||
|
|
||||||
import com.xkrs.model.qo.ExportSourceExcelQo;
|
|
||||||
import com.xkrs.model.qo.QcSourceQoDelete;
|
import com.xkrs.model.qo.QcSourceQoDelete;
|
||||||
import com.xkrs.model.qo.QcSourceQoInsert;
|
import com.xkrs.model.qo.QcSourceQoInsert;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@ -20,15 +19,6 @@ public interface QcSourceService {
|
|||||||
/**
|
/**
|
||||||
* 查询检验数据
|
* 查询检验数据
|
||||||
*/
|
*/
|
||||||
String queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo, String craftItemNo);
|
String queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo);
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出Excel表格
|
|
||||||
*/
|
|
||||||
String exportExcel(ExportSourceExcelQo exportSourceExcelQo) throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 格式化创建时间历史数据
|
|
||||||
*/
|
|
||||||
String formatCreateTime();
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
package com.xkrs.service;
|
package com.xkrs.service;
|
||||||
|
|
||||||
import com.xkrs.model.qo.ExportSpecExcelQo;
|
|
||||||
import com.xkrs.model.qo.QcSpecQoDelete;
|
import com.xkrs.model.qo.QcSpecQoDelete;
|
||||||
import com.xkrs.model.qo.QcSpecQoInsert;
|
import com.xkrs.model.qo.QcSpecQoInsert;
|
||||||
import com.xkrs.model.qo.QcSpecQoUpdate;
|
import com.xkrs.model.qo.QcSpecQoUpdate;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
public interface QcSpecService {
|
public interface QcSpecService {
|
||||||
|
|
||||||
@ -26,22 +24,6 @@ public interface QcSpecService {
|
|||||||
/**
|
/**
|
||||||
* 查询检验规格
|
* 查询检验规格
|
||||||
*/
|
*/
|
||||||
String queryQcSpec(String varietyNo, String craftItemNo, String qcItemNo);
|
String queryQcSpec(String varietyNo, String qcItemNo);
|
||||||
|
|
||||||
/**
|
|
||||||
* 导入检验规格
|
|
||||||
*/
|
|
||||||
String importSpecExcel(MultipartFile specExcel);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出检验规格
|
|
||||||
*/
|
|
||||||
String exportSpecExcel(ExportSpecExcelQo exportSpecExcelQo) throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出空白检验规格
|
|
||||||
*/
|
|
||||||
String exportEmptySpecExcel(ExportSpecExcelQo exportSpecExcelQo) throws Exception;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
package com.xkrs.service.impl;
|
|
||||||
|
|
||||||
import com.xkrs.dao.CraftItemDao;
|
|
||||||
import com.xkrs.encapsulation.PromptMessageEnum;
|
|
||||||
import com.xkrs.model.entity.CraftItemEntity;
|
|
||||||
import com.xkrs.model.qo.CraftItemQoDelete;
|
|
||||||
import com.xkrs.model.qo.CraftItemQoInsert;
|
|
||||||
import com.xkrs.model.qo.CraftItemQoUpdate;
|
|
||||||
import com.xkrs.service.CraftItemService;
|
|
||||||
import com.xkrs.util.LocalDateUtils;
|
|
||||||
import com.xkrs.util.LocalStringUtils;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class CraftItemServiceImpl implements CraftItemService {
|
|
||||||
|
|
||||||
private Locale locale = LocaleContextHolder.getLocale();
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CraftItemDao craftItemDao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加工艺项目
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String insertCraftItem(CraftItemQoInsert insertQo) {
|
|
||||||
String no = insertQo.getNo();
|
|
||||||
String name = insertQo.getName();
|
|
||||||
Optional<CraftItemEntity> entityByNo = craftItemDao.findByCraftItemNo(no);
|
|
||||||
if (entityByNo.isPresent()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该工艺项目已存在,请勿重复添加!", locale);
|
|
||||||
}
|
|
||||||
CraftItemEntity entity = new CraftItemEntity();
|
|
||||||
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
|
|
||||||
entity.setUpdateTime("");
|
|
||||||
entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(no));
|
|
||||||
entity.setCraftItemName(LocalStringUtils.formatEmptyValue(name));
|
|
||||||
craftItemDao.save(entity);
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除工艺项目
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String deleteCraftItem(CraftItemQoDelete deleteQo) {
|
|
||||||
Integer id = deleteQo.getId();
|
|
||||||
Optional<CraftItemEntity> entityById = craftItemDao.findById(id);
|
|
||||||
if (entityById.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该工艺项目,请先添加工艺项目!", locale);
|
|
||||||
}
|
|
||||||
craftItemDao.deleteById(id);
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "删除成功!", locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新工艺项目名称
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String updateCraftItem(CraftItemQoUpdate updateQo) {
|
|
||||||
Integer id = updateQo.getId();
|
|
||||||
String name = updateQo.getName();
|
|
||||||
Optional<CraftItemEntity> entityById = craftItemDao.findById(id);
|
|
||||||
if (entityById.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该工艺项目,请先添加工艺项目!", locale);
|
|
||||||
}
|
|
||||||
craftItemDao.updateNameById(id, LocalDateUtils.getCurrentSecond(), LocalStringUtils.formatEmptyValue(name));
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "更新成功!", locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询工艺项目
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String queryCraftItem(String no, String name) {
|
|
||||||
List<Map<String, Object>> resultList = craftItemDao.queryCraftItem(LocalStringUtils.formatEmptyValue(no), LocalStringUtils.formatEmptyValue(name));
|
|
||||||
if (resultList == null || resultList.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该工艺项目的信息!", locale);
|
|
||||||
}
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, resultList, locale);
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,8 +3,11 @@ package com.xkrs.service.impl;
|
|||||||
import com.xkrs.dao.FileDao;
|
import com.xkrs.dao.FileDao;
|
||||||
import com.xkrs.dao.QcSourceDao;
|
import com.xkrs.dao.QcSourceDao;
|
||||||
import com.xkrs.encapsulation.PromptMessageEnum;
|
import com.xkrs.encapsulation.PromptMessageEnum;
|
||||||
|
import com.xkrs.model.entity.FileEntity;
|
||||||
import com.xkrs.model.qo.FileQo;
|
import com.xkrs.model.qo.FileQo;
|
||||||
import com.xkrs.service.FileService;
|
import com.xkrs.service.FileService;
|
||||||
|
import com.xkrs.util.ExcelUploadUtil;
|
||||||
|
import com.xkrs.util.ExportExcel;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -13,7 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Locale;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
@ -38,29 +41,29 @@ 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 lotNo = fileQo.getLotNo();
|
||||||
// String machineNo = fileQo.getMachineNo();
|
String machineNo = fileQo.getMachineNo();
|
||||||
// String materialNo = fileQo.getMaterialNo();
|
String materialNo = fileQo.getMaterialNo();
|
||||||
// String modelNo = fileQo.getModelNo();
|
String modelNo = fileQo.getModelNo();
|
||||||
// String machineTypeNo = fileQo.getMachineTypeNo();
|
String machineTypeNo = fileQo.getMachineTypeNo();
|
||||||
// String craftItemName = fileQo.getCraftItemName();
|
String craftItemName = fileQo.getCraftItemName();
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// Optional<FileEntity> fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
|
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);
|
||||||
// }
|
}
|
||||||
// if (fileExcel == null) {
|
if (fileExcel == null) {
|
||||||
// return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "模板不能为空!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "模板不能为空!", locale);
|
||||||
// }
|
}
|
||||||
// String file = ExcelUploadUtil.memoryFile(fileExcel, 1);
|
String file = ExcelUploadUtil.memoryFile(fileExcel, 1);
|
||||||
// FileEntity fileEntity1 = new FileEntity();
|
FileEntity fileEntity1 = new FileEntity();
|
||||||
// fileEntity1.setLotNo(fileQo.getLotNo());
|
fileEntity1.setLotNo(fileQo.getLotNo());
|
||||||
// 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.setMachineTypeNo(fileQo.getMachineTypeNo());
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,28 +76,28 @@ 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 lotNo = fileQo.getLotNo();
|
||||||
// String machineNo = fileQo.getMachineNo();
|
String machineNo = fileQo.getMachineNo();
|
||||||
// String materialNo = fileQo.getMaterialNo();
|
String materialNo = fileQo.getMaterialNo();
|
||||||
// String modelNo = fileQo.getModelNo();
|
String modelNo = fileQo.getModelNo();
|
||||||
// String machineTypeNo = fileQo.getMachineTypeNo();
|
String machineTypeNo = fileQo.getMachineTypeNo();
|
||||||
// String craftItemName = fileQo.getCraftItemName();
|
String craftItemName = fileQo.getCraftItemName();
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
// Optional<FileEntity> fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName);
|
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<Map<String, Object>> resultList = qcSourceDao.queryQcSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, "");
|
List<Map<String, Object>> resultList = qcSourceDao.queryQcSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo);
|
||||||
// if (resultList == null || resultList.size() == 0) {
|
if (resultList == null || resultList.size() == 0) {
|
||||||
// return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
|
||||||
// }
|
}
|
||||||
// Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
// for (Map<String, Object> result : resultList) {
|
for (Map<String, Object> result : resultList) {
|
||||||
// map.put((String) result.get("qcItemNo"), (String) result.get("qcValue"));
|
map.put((String) result.get("qcItemNo"), (String) result.get("qcValue"));
|
||||||
// }
|
}
|
||||||
// String fill = ExportExcel.exportToProveExcel(map, fileUploadPath);
|
String fill = ExportExcel.exportToProveExcel(map, fileUploadPath);
|
||||||
// fileDao.updateFileDownloadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, fill);
|
fileDao.updateFileDownloadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, fill);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "导出成功", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,16 +37,16 @@ public class QcItemServiceImpl implements QcItemService {
|
|||||||
String no = insertQo.getNo();
|
String no = insertQo.getNo();
|
||||||
String name = insertQo.getName();
|
String name = insertQo.getName();
|
||||||
String type = insertQo.getType();
|
String type = insertQo.getType();
|
||||||
Optional<QcItemEntity> entityByNo = qcItemDao.findByQcItemNo(no);
|
Optional<QcItemEntity> entityByNo = qcItemDao.findByNo(no);
|
||||||
if (entityByNo.isPresent()) {
|
if (entityByNo.isPresent()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该检验项目已存在,请勿重复添加!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该检验项目已存在,请勿重复添加!", locale);
|
||||||
}
|
}
|
||||||
QcItemEntity entity = new QcItemEntity();
|
QcItemEntity entity = new QcItemEntity();
|
||||||
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
|
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
|
||||||
entity.setUpdateTime("");
|
entity.setUpdateTime("");
|
||||||
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(no));
|
entity.setNo(LocalStringUtils.formatEmptyValue(no));
|
||||||
entity.setQcItemName(LocalStringUtils.formatEmptyValue(name));
|
entity.setName(LocalStringUtils.formatEmptyValue(name));
|
||||||
entity.setQcItemType(LocalStringUtils.formatEmptyValue(type));
|
entity.setType(LocalStringUtils.formatEmptyValue(type));
|
||||||
qcItemDao.save(entity);
|
qcItemDao.save(entity);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,27 @@
|
|||||||
package com.xkrs.service.impl;
|
package com.xkrs.service.impl;
|
||||||
|
|
||||||
import com.xkrs.dao.CraftItemDao;
|
|
||||||
import com.xkrs.dao.QcItemDao;
|
import com.xkrs.dao.QcItemDao;
|
||||||
import com.xkrs.dao.QcSourceDao;
|
import com.xkrs.dao.QcSourceDao;
|
||||||
import com.xkrs.dao.QcSpecDao;
|
import com.xkrs.dao.QcSpecDao;
|
||||||
import com.xkrs.encapsulation.PromptMessageEnum;
|
import com.xkrs.encapsulation.PromptMessageEnum;
|
||||||
import com.xkrs.model.bean.XSSFCellDataBean;
|
|
||||||
import com.xkrs.model.entity.CraftItemEntity;
|
|
||||||
import com.xkrs.model.entity.QcItemEntity;
|
import com.xkrs.model.entity.QcItemEntity;
|
||||||
import com.xkrs.model.entity.QcSourceEntity;
|
import com.xkrs.model.entity.QcSourceEntity;
|
||||||
import com.xkrs.model.entity.QcSpecEntity;
|
import com.xkrs.model.entity.QcSpecEntity;
|
||||||
import com.xkrs.model.qo.ExportSourceExcelQo;
|
|
||||||
import com.xkrs.model.qo.QcSourceQoDelete;
|
import com.xkrs.model.qo.QcSourceQoDelete;
|
||||||
import com.xkrs.model.qo.QcSourceQoInsert;
|
import com.xkrs.model.qo.QcSourceQoInsert;
|
||||||
import com.xkrs.service.QcSourceService;
|
import com.xkrs.service.QcSourceService;
|
||||||
import com.xkrs.util.*;
|
import com.xkrs.util.Constant;
|
||||||
|
import com.xkrs.util.ExcelUploadUtil;
|
||||||
|
import com.xkrs.util.LocalDateUtils;
|
||||||
|
import com.xkrs.util.LocalStringUtils;
|
||||||
import org.apache.http.util.TextUtils;
|
import org.apache.http.util.TextUtils;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
|
||||||
import org.apache.poi.hssf.util.HSSFColor;
|
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
|
||||||
import org.apache.poi.xssf.usermodel.*;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import java.awt.*;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
@ -41,9 +31,6 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
|
|
||||||
private Locale locale = LocaleContextHolder.getLocale();
|
private Locale locale = LocaleContextHolder.getLocale();
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CraftItemDao craftItemDao;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private QcItemDao qcItemDao;
|
private QcItemDao qcItemDao;
|
||||||
|
|
||||||
@ -53,13 +40,6 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
@Resource
|
@Resource
|
||||||
private QcSpecDao qcSpecDao;
|
private QcSpecDao qcSpecDao;
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出excel样式一(表头顺序)
|
|
||||||
* 批次号 机器号 物料号 模具号 机种号
|
|
||||||
*/
|
|
||||||
List<String> EXCEL_HEAD_STYLE_ONE_NO = Arrays.asList("batchNo", "machineNo", "materialNo", "mouldNo", "varietyNo", "craftItemNo", "createTime", "index");
|
|
||||||
List<String> EXCEL_HEAD_STYLE_ONE_NAME = Arrays.asList("批次", "机器", "物料", "模具", "机种", "工艺项目", "上传时间", "过程抽检批次");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加检验数据
|
* 添加检验数据
|
||||||
*/
|
*/
|
||||||
@ -70,39 +50,26 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
String materialNo = insertQo.getMaterialNo();
|
String materialNo = insertQo.getMaterialNo();
|
||||||
String mouldNo = insertQo.getMouldNo();
|
String mouldNo = insertQo.getMouldNo();
|
||||||
String varietyNo = insertQo.getVarietyNo();
|
String varietyNo = insertQo.getVarietyNo();
|
||||||
String craftItemNo = insertQo.getCraftItemNo();
|
|
||||||
String qcItemNo = insertQo.getQcItemNo();
|
String qcItemNo = insertQo.getQcItemNo();
|
||||||
String qcValue = insertQo.getQcValue();
|
String qcValue = insertQo.getQcValue();
|
||||||
Optional<CraftItemEntity> craftItemByNo = craftItemDao.findByCraftItemNo(craftItemNo);
|
Optional<QcItemEntity> qcItemEntityByNo = qcItemDao.findByNo(qcItemNo);
|
||||||
if (craftItemByNo.isEmpty()) {
|
if (qcItemEntityByNo.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该工艺项目,请先添加工艺项目!", locale);
|
|
||||||
}
|
|
||||||
Optional<QcItemEntity> qcItemByNo = qcItemDao.findByQcItemNo(qcItemNo);
|
|
||||||
if (qcItemByNo.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale);
|
||||||
}
|
}
|
||||||
if (Constant.QC_ITEM_TYPE_STRING.equals(qcItemByNo.get().getQcItemType())) {
|
if (Constant.QC_ITEM_TYPE_STRING.equals(qcItemEntityByNo.get().getType())) {
|
||||||
System.out.println("添加检验数据(文本类型)" + insertQo.toString());
|
|
||||||
QcSourceEntity entity = new QcSourceEntity();
|
QcSourceEntity entity = new QcSourceEntity();
|
||||||
String currentSecond = LocalDateUtils.getCurrentSecond();
|
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
|
||||||
entity.setCreateTime(currentSecond);
|
|
||||||
entity.setCreateTimeFormat(LocalDateUtils.formatCurrentSecond(currentSecond));
|
|
||||||
entity.setBatchNo(LocalStringUtils.formatEmptyValue(batchNo));
|
entity.setBatchNo(LocalStringUtils.formatEmptyValue(batchNo));
|
||||||
entity.setMachineNo(LocalStringUtils.formatEmptyValue(machineNo));
|
entity.setMachineNo(LocalStringUtils.formatEmptyValue(machineNo));
|
||||||
entity.setMaterialNo(LocalStringUtils.formatEmptyValue(materialNo));
|
entity.setMaterialNo(LocalStringUtils.formatEmptyValue(materialNo));
|
||||||
entity.setMouldNo(LocalStringUtils.formatEmptyValue(mouldNo));
|
entity.setMouldNo(LocalStringUtils.formatEmptyValue(mouldNo));
|
||||||
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
|
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
|
||||||
entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(craftItemNo));
|
|
||||||
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
|
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
|
||||||
if (TextUtils.isEmpty(qcValue)) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "添加失败,测量值(qcValue)字段不能为空!", locale);
|
|
||||||
}
|
|
||||||
entity.setQcValue(LocalStringUtils.formatEmptyValue(qcValue));
|
entity.setQcValue(LocalStringUtils.formatEmptyValue(qcValue));
|
||||||
qcSourceDao.save(entity);
|
qcSourceDao.save(entity);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
||||||
}
|
}
|
||||||
if (Constant.QC_ITEM_TYPE_PICTURE.equals(qcItemByNo.get().getQcItemType())) {
|
if (Constant.QC_ITEM_TYPE_PICTURE.equals(qcItemEntityByNo.get().getType())) {
|
||||||
System.out.println("添加检验数据(图片类型)" + insertQo.toString());
|
|
||||||
if (picture == null) {
|
if (picture == null) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "上传图片不能为空!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "上传图片不能为空!", locale);
|
||||||
}
|
}
|
||||||
@ -114,21 +81,17 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "上传图片失败!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "上传图片失败!", locale);
|
||||||
}
|
}
|
||||||
QcSourceEntity entity = new QcSourceEntity();
|
QcSourceEntity entity = new QcSourceEntity();
|
||||||
String currentSecond = LocalDateUtils.getCurrentSecond();
|
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
|
||||||
entity.setCreateTime(currentSecond);
|
|
||||||
entity.setCreateTimeFormat(LocalDateUtils.formatCurrentSecond(currentSecond));
|
|
||||||
entity.setBatchNo(LocalStringUtils.formatEmptyValue(batchNo));
|
entity.setBatchNo(LocalStringUtils.formatEmptyValue(batchNo));
|
||||||
entity.setMachineNo(LocalStringUtils.formatEmptyValue(machineNo));
|
entity.setMachineNo(LocalStringUtils.formatEmptyValue(machineNo));
|
||||||
entity.setMaterialNo(LocalStringUtils.formatEmptyValue(materialNo));
|
entity.setMaterialNo(LocalStringUtils.formatEmptyValue(materialNo));
|
||||||
entity.setMouldNo(LocalStringUtils.formatEmptyValue(mouldNo));
|
entity.setMouldNo(LocalStringUtils.formatEmptyValue(mouldNo));
|
||||||
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
|
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
|
||||||
entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(craftItemNo));
|
|
||||||
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
|
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
|
||||||
entity.setQcValue(LocalStringUtils.formatEmptyValue(picturePath));
|
entity.setQcValue(LocalStringUtils.formatEmptyValue(picturePath));
|
||||||
qcSourceDao.save(entity);
|
qcSourceDao.save(entity);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
|
||||||
}
|
}
|
||||||
System.out.println("添加检验数据(未知类型)" + insertQo.toString());
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "添加失败!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "添加失败!", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,28 +114,13 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
* 查询检验数据
|
* 查询检验数据
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo, String craftItemNo) {
|
public String queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo) {
|
||||||
long startTimeMillis = System.currentTimeMillis();
|
|
||||||
List<CraftItemEntity> craftItemList = craftItemDao.findAll();
|
|
||||||
if (craftItemList.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "未添加工艺项目,请先添加工艺项目!", locale);
|
|
||||||
}
|
|
||||||
List<QcItemEntity> qcItemList = qcItemDao.findAll();
|
List<QcItemEntity> qcItemList = qcItemDao.findAll();
|
||||||
if (qcItemList.isEmpty()) {
|
if (qcItemList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "未添加检验项目,请先添加检验项目!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "未添加检验项目,请先添加检验项目!", locale);
|
||||||
}
|
}
|
||||||
String finalBatchNo = LocalStringUtils.formatEmptyValue(batchNo).trim();
|
List<Map<String, Object>> sourceList = qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo));
|
||||||
String finalMachineNo = LocalStringUtils.formatEmptyValue(machineNo).trim();
|
List<Map<String, Object>> resultList = generateResultList(sourceList);
|
||||||
String finalMaterialNo = LocalStringUtils.formatEmptyValue(materialNo).trim();
|
|
||||||
String finalMouldNo = LocalStringUtils.formatEmptyValue(mouldNo).trim();
|
|
||||||
String finalVarietyNo = LocalStringUtils.formatEmptyValue(varietyNo).trim();
|
|
||||||
String finalCraftItemNo = LocalStringUtils.formatEmptyValue(craftItemNo).trim();
|
|
||||||
//检验数据结果集
|
|
||||||
List<QcSourceEntity> sourceList = qcSourceDao.queryQcSource(finalBatchNo, finalMachineNo, finalMaterialNo, finalMouldNo, finalVarietyNo, finalCraftItemNo);
|
|
||||||
//检验规格
|
|
||||||
List<QcSpecEntity> qcSpecList = qcSpecDao.findAll();
|
|
||||||
List<Map<String, Object>> resultList = generateResultList(sourceList, qcSpecList);
|
|
||||||
System.out.println("查询检验数据耗时:" + formatDuring(System.currentTimeMillis() - startTimeMillis));
|
|
||||||
if (resultList.isEmpty()) {
|
if (resultList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验数据的信息!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验数据的信息!", locale);
|
||||||
}
|
}
|
||||||
@ -181,148 +129,61 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成返回结果
|
* 生成返回结果
|
||||||
*
|
|
||||||
* @param sourceList 检验数据结果集
|
|
||||||
* @param qcSpecList 检验规格结果集
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
private List<Map<String, Object>> generateResultList(List<QcSourceEntity> sourceList, List<QcSpecEntity> qcSpecList) {
|
private List<Map<String, Object>> generateResultList(List<Map<String, Object>> sourceList) {
|
||||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||||
if (sourceList == null || sourceList.isEmpty()) {
|
if (sourceList == null || sourceList.isEmpty()) {
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
long startTimeMillis = System.currentTimeMillis();
|
for (Map<String, Object> source : sourceList) {
|
||||||
//这个for循环完成后:一维结果集被格式化为二维结果集,每一行的上传时间是本行所有数据的最早时间
|
String batchNo = (String) source.getOrDefault("batchNo", "");
|
||||||
for (QcSourceEntity sourceEntity : sourceList) {
|
String machineNo = (String) source.getOrDefault("machineNo", "");
|
||||||
String batchNo = LocalStringUtils.formatEmptyValue(sourceEntity.getBatchNo());
|
String materialNo = (String) source.getOrDefault("materialNo", "");
|
||||||
String machineNo = LocalStringUtils.formatEmptyValue(sourceEntity.getMachineNo());
|
String mouldNo = (String) source.getOrDefault("mouldNo", "");
|
||||||
String materialNo = LocalStringUtils.formatEmptyValue(sourceEntity.getMaterialNo());
|
String varietyNo = (String) source.getOrDefault("varietyNo", "");
|
||||||
String mouldNo = LocalStringUtils.formatEmptyValue(sourceEntity.getMouldNo());
|
String qcItemNo = (String) source.getOrDefault("qcItemNo", "");
|
||||||
String varietyNo = LocalStringUtils.formatEmptyValue(sourceEntity.getVarietyNo());
|
String qcValue = (String) source.getOrDefault("qcValue", "");
|
||||||
String craftItemNo = LocalStringUtils.formatEmptyValue(sourceEntity.getCraftItemNo());
|
if (TextUtils.isEmpty(qcItemNo) || TextUtils.isEmpty(qcValue)) {
|
||||||
String createTime = LocalStringUtils.formatEmptyValue(sourceEntity.getCreateTime());
|
continue;
|
||||||
String qcItemNo = LocalStringUtils.formatEmptyValue(sourceEntity.getQcItemNo());
|
}
|
||||||
String qcValue = LocalStringUtils.formatEmptyValue(sourceEntity.getQcValue());
|
String formatValue = getFormatValue(varietyNo, qcItemNo, qcValue);
|
||||||
String formatValue = getFormatValue(qcSpecList, varietyNo, craftItemNo, qcItemNo, qcValue);
|
Map<String, Object> emptyRoom = findEmptyRoom(resultList, batchNo, qcItemNo);
|
||||||
Map<String, Object> emptyRoom = findEmptyRoom(resultList, qcItemNo, batchNo, machineNo, materialNo, mouldNo, varietyNo, craftItemNo);
|
|
||||||
if (emptyRoom == null) {
|
if (emptyRoom == null) {
|
||||||
Map<String, Object> newRoom = new HashMap<>();
|
Map<String, Object> newRoom = new HashMap<>();
|
||||||
newRoom.put(EXCEL_HEAD_STYLE_ONE_NO.get(0), batchNo);
|
newRoom.put("batchNo", batchNo);
|
||||||
newRoom.put(EXCEL_HEAD_STYLE_ONE_NO.get(1), machineNo);
|
newRoom.put("machineNo", machineNo);
|
||||||
newRoom.put(EXCEL_HEAD_STYLE_ONE_NO.get(2), materialNo);
|
newRoom.put("materialNo", materialNo);
|
||||||
newRoom.put(EXCEL_HEAD_STYLE_ONE_NO.get(3), mouldNo);
|
newRoom.put("mouldNo", mouldNo);
|
||||||
newRoom.put(EXCEL_HEAD_STYLE_ONE_NO.get(4), varietyNo);
|
newRoom.put("varietyNo", varietyNo);
|
||||||
newRoom.put(EXCEL_HEAD_STYLE_ONE_NO.get(5), craftItemNo);
|
|
||||||
newRoom.put(EXCEL_HEAD_STYLE_ONE_NO.get(6), createTime);//新行的上传时间使用第一个数据的上传时间
|
|
||||||
newRoom.put(qcItemNo, formatValue);
|
newRoom.put(qcItemNo, formatValue);
|
||||||
resultList.add(newRoom);
|
resultList.add(newRoom);
|
||||||
} else {
|
} else {
|
||||||
emptyRoom.put(qcItemNo, formatValue);
|
emptyRoom.put(qcItemNo, formatValue);
|
||||||
long oldTime = Long.parseLong((String) emptyRoom.get(EXCEL_HEAD_STYLE_ONE_NO.get(6)));
|
|
||||||
if (Long.parseLong(createTime) < oldTime) {//已存在行的上传时间用更早的时间替换更晚的时间
|
|
||||||
emptyRoom.put(EXCEL_HEAD_STYLE_ONE_NO.get(6), createTime);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//这个for循环完成后:二维结果集每一行的上传时间是本分组所有数据的最早时间
|
|
||||||
for (Map<String, Object> result : resultList) {
|
|
||||||
String createTime = (String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(6));
|
|
||||||
List<Long> createTimeTagList = getCreateTimeTagList(resultList, result);
|
|
||||||
int createTimeTagIndex = getCreateTimeTagIndex(createTimeTagList, Long.parseLong(createTime));
|
|
||||||
result.put(EXCEL_HEAD_STYLE_ONE_NO.get(6), String.valueOf(createTimeTagList.get(createTimeTagIndex)));
|
|
||||||
result.put(EXCEL_HEAD_STYLE_ONE_NO.get(7), "第" + (createTimeTagIndex + 1) + "批");
|
|
||||||
}
|
|
||||||
System.out.println("generateResultList耗时:" + formatDuring(System.currentTimeMillis() - startTimeMillis));
|
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取上传时间节点索引
|
|
||||||
*
|
|
||||||
* @param createTimeTagList 上传时间节点集合
|
|
||||||
* @param createTimeLong 当前行上传时间(其实也是当前行所有数据的最早上传时间)
|
|
||||||
* @return 上传时间节点索引
|
|
||||||
*/
|
|
||||||
private int getCreateTimeTagIndex(List<Long> createTimeTagList, long createTimeLong) {
|
|
||||||
for (int i = 0; i < createTimeTagList.size(); i++) {
|
|
||||||
long dur = createTimeLong - createTimeTagList.get(i);
|
|
||||||
if (dur >= 0 && dur <= Constant.QC_TIME_INTERVAL) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new RuntimeException("获取上传时间节点索引时发生异常");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取上传时间节点集合
|
|
||||||
*
|
|
||||||
* @param resultList 二维结果集
|
|
||||||
* @param currentResult 当前行
|
|
||||||
* @return 当前行所在分组的时间节点集合
|
|
||||||
*/
|
|
||||||
private List<Long> getCreateTimeTagList(List<Map<String, Object>> resultList, Map<String, Object> currentResult) {
|
|
||||||
String currentBatchNo = (String) currentResult.get(EXCEL_HEAD_STYLE_ONE_NO.get(0));
|
|
||||||
String currentMachineNo = (String) currentResult.get(EXCEL_HEAD_STYLE_ONE_NO.get(1));
|
|
||||||
String currentMaterialNo = (String) currentResult.get(EXCEL_HEAD_STYLE_ONE_NO.get(2));
|
|
||||||
String currentMouldNo = (String) currentResult.get(EXCEL_HEAD_STYLE_ONE_NO.get(3));
|
|
||||||
String currentVarietyNo = (String) currentResult.get(EXCEL_HEAD_STYLE_ONE_NO.get(4));
|
|
||||||
String currentCraftItemNo = (String) currentResult.get(EXCEL_HEAD_STYLE_ONE_NO.get(5));
|
|
||||||
List<Long> createTimeList = new ArrayList<>();
|
|
||||||
//这个for循环的作用是在二维结果集中过滤出和当前行数据属于同一分组的所有行上传时间集合
|
|
||||||
for (Map<String, Object> result : resultList) {
|
|
||||||
String batchNo = (String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(0));
|
|
||||||
String machineNo = (String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(1));
|
|
||||||
String materialNo = (String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(2));
|
|
||||||
String mouldNo = (String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(3));
|
|
||||||
String varietyNo = (String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(4));
|
|
||||||
String craftItemNo = (String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(5));
|
|
||||||
String createTime = (String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(6));
|
|
||||||
if (batchNo.equals(currentBatchNo) && machineNo.equals(currentMachineNo) && materialNo.equals(currentMaterialNo) && mouldNo.equals(currentMouldNo) && varietyNo.equals(currentVarietyNo) && craftItemNo.equals(currentCraftItemNo)) {
|
|
||||||
createTimeList.add(Long.parseLong(createTime));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//对上传时间集合进行排序
|
|
||||||
createTimeList.sort(Long::compareTo);
|
|
||||||
//根据上传时间集合和时间间隔生成上传时间节点集合
|
|
||||||
List<Long> createTimeTagList = new ArrayList<>();//时间节点列表
|
|
||||||
for (int i = 0; i < createTimeList.size(); i++) {
|
|
||||||
Long createTime = createTimeList.get(i);
|
|
||||||
if (createTimeTagList.isEmpty()) {
|
|
||||||
createTimeTagList.add(createTime);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Long newCreateTimeTag = createTimeTagList.get(createTimeTagList.size() - 1);//最新的时间节点
|
|
||||||
if (createTime >= newCreateTimeTag + Constant.QC_TIME_INTERVAL) {
|
|
||||||
createTimeTagList.add(createTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return createTimeTagList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取添加了 ##H 或 ##L 后缀的测量值(如果可能的话)
|
* 获取添加了 ##H 或 ##L 后缀的测量值(如果可能的话)
|
||||||
*/
|
*/
|
||||||
private String getFormatValue(List<QcSpecEntity> qcSpecList, String varietyNo, String craftItemNo, String qcItemNo, String qcValue) {
|
private String getFormatValue(String varietyNo, String qcItemNo, String qcValue) {
|
||||||
if (qcSpecList == null || qcSpecList.isEmpty()) {
|
Optional<QcSpecEntity> entityByVarietyNoAndQcItemNo = qcSpecDao.findByVarietyNoAndQcItemNo(varietyNo, qcItemNo);
|
||||||
|
if (entityByVarietyNoAndQcItemNo.isEmpty()) {
|
||||||
return qcValue;
|
return qcValue;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < qcSpecList.size(); i++) {
|
QcSpecEntity qcSpec = entityByVarietyNoAndQcItemNo.get();
|
||||||
QcSpecEntity qcSpec = qcSpecList.get(i);
|
|
||||||
if (varietyNo.equals(qcSpec.getVarietyNo()) && craftItemNo.equals(qcSpec.getCraftItemNo()) && qcItemNo.equals(qcSpec.getQcItemNo())) {
|
|
||||||
double valueMax = stringToDouble(qcSpec.getMax());
|
double valueMax = stringToDouble(qcSpec.getMax());
|
||||||
double valueMin = stringToDouble(qcSpec.getMin());
|
double valueMin = stringToDouble(qcSpec.getMin());
|
||||||
double value = stringToDouble(qcValue);
|
double value = stringToDouble(qcValue);
|
||||||
if (valueMax > -99_000D && value > -99_000D && value >= valueMax) {
|
if (valueMax >= 0 && value >= 0 && value >= valueMax) {
|
||||||
return qcValue + "##H";
|
return qcValue + "##H";
|
||||||
}
|
}
|
||||||
if (valueMin > -99_000D && value > -99_000D && value <= valueMin) {
|
if (valueMin >= 0 && value >= 0 && value <= valueMin) {
|
||||||
return qcValue + "##L";
|
return qcValue + "##L";
|
||||||
}
|
}
|
||||||
return qcValue;
|
return qcValue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return qcValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化字符串为Double
|
* 格式化字符串为Double
|
||||||
@ -331,21 +192,20 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
try {
|
try {
|
||||||
return Double.parseDouble(stringValue);
|
return Double.parseDouble(stringValue);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
// return -100_000D;
|
return -1D;
|
||||||
}
|
}
|
||||||
return -100_000D;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 尝试找到一个qcItemNo有空位置的Map
|
* 尝试找到一个qcItemNo有空位置的Map
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> findEmptyRoom(List<Map<String, Object>> mapList, String qcItemNo, String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo, String craftItemNo) {
|
private Map<String, Object> findEmptyRoom(List<Map<String, Object>> mapList, String batchNo, String qcItemNo) {
|
||||||
if (mapList == null || mapList.isEmpty() || TextUtils.isEmpty(qcItemNo)) {
|
if (mapList == null || mapList.isEmpty() || TextUtils.isEmpty(batchNo) || TextUtils.isEmpty(qcItemNo)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (Map<String, Object> room : mapList) {
|
for (Map<String, Object> room : mapList) {
|
||||||
if (room.get(EXCEL_HEAD_STYLE_ONE_NO.get(0)).equals(batchNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(1)).equals(machineNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(2)).equals(materialNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(3)).equals(mouldNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(4)).equals(varietyNo) && room.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)).equals(craftItemNo)) {
|
if (room.getOrDefault("batchNo", "").equals(batchNo)) {
|
||||||
if (!room.containsKey(qcItemNo)) {
|
if (!room.containsKey(qcItemNo)) {
|
||||||
return room;
|
return room;
|
||||||
}
|
}
|
||||||
@ -354,257 +214,4 @@ public class QcSourceServiceImpl implements QcSourceService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出Excel表格
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String exportExcel(ExportSourceExcelQo exportSourceExcelQo) throws Exception {
|
|
||||||
String host = LocalStringUtils.formatEmptyValue(exportSourceExcelQo.getHost()).trim();
|
|
||||||
String finalBatchNo = LocalStringUtils.formatEmptyValue(exportSourceExcelQo.getBatchNo()).trim();
|
|
||||||
String finalMachineNo = LocalStringUtils.formatEmptyValue(exportSourceExcelQo.getMachineNo()).trim();
|
|
||||||
String finalMaterialNo = LocalStringUtils.formatEmptyValue(exportSourceExcelQo.getMaterialNo()).trim();
|
|
||||||
String finalMouldNo = LocalStringUtils.formatEmptyValue(exportSourceExcelQo.getMouldNo()).trim();
|
|
||||||
String finalVarietyNo = LocalStringUtils.formatEmptyValue(exportSourceExcelQo.getVarietyNo()).trim();
|
|
||||||
String finalCraftItemNo = LocalStringUtils.formatEmptyValue(exportSourceExcelQo.getCraftItemNo()).trim();
|
|
||||||
List<CraftItemEntity> craftItemList = craftItemDao.findAll();
|
|
||||||
if (craftItemList.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "未添加工艺项目,请先添加工艺项目!", locale);
|
|
||||||
}
|
|
||||||
List<QcItemEntity> qcItemList = qcItemDao.findAll();
|
|
||||||
if (qcItemList.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "未添加检验项目,请先添加检验项目!", locale);
|
|
||||||
}
|
|
||||||
List<QcSourceEntity> sourceList = qcSourceDao.queryQcSource(finalBatchNo, finalMachineNo, finalMaterialNo, finalMouldNo, finalVarietyNo, finalCraftItemNo);
|
|
||||||
List<QcSpecEntity> qcSpecList = qcSpecDao.findAll();
|
|
||||||
List<Map<String, Object>> resultList = generateResultList(sourceList, qcSpecList);
|
|
||||||
String finalHost = host.endsWith("/") ? host : host + "/";
|
|
||||||
List<List<String>> formattedResultList = formatResultList(finalHost, resultList, qcItemList);
|
|
||||||
if (formattedResultList.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验数据的信息!", locale);
|
|
||||||
}
|
|
||||||
String excelPath = doExportExcel(formattedResultList);
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, finalHost + excelPath, locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 格式化结果集数据
|
|
||||||
*/
|
|
||||||
private List<List<String>> formatResultList(String host, List<Map<String, Object>> resultList, List<QcItemEntity> qcItemList) {
|
|
||||||
List<List<String>> formatResultList = new ArrayList<>();
|
|
||||||
if (resultList == null || resultList.isEmpty()) {
|
|
||||||
return formatResultList;
|
|
||||||
}
|
|
||||||
boolean needProcessBatch = needProcessBatch(resultList);
|
|
||||||
List<String> headList = new ArrayList<>();
|
|
||||||
for (int i = 0; i < EXCEL_HEAD_STYLE_ONE_NAME.size(); i++) {
|
|
||||||
if (i == 7) {
|
|
||||||
if (needProcessBatch) {
|
|
||||||
headList.add(EXCEL_HEAD_STYLE_ONE_NAME.get(i));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
headList.add(EXCEL_HEAD_STYLE_ONE_NAME.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (QcItemEntity qcItemEntity : qcItemList) {
|
|
||||||
headList.add(qcItemEntity.getQcItemName());
|
|
||||||
}
|
|
||||||
formatResultList.add(headList);
|
|
||||||
for (Map<String, Object> result : resultList) {
|
|
||||||
List<String> dataList = new ArrayList<>();
|
|
||||||
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(0)));
|
|
||||||
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(1)));
|
|
||||||
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(2)));
|
|
||||||
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(3)));
|
|
||||||
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(4)));
|
|
||||||
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)));
|
|
||||||
dataList.add(LocalDateUtils.exportFormatCurrentSecond((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(6))));
|
|
||||||
if (needProcessBatch) {
|
|
||||||
if (isProcessBatch(result)) {
|
|
||||||
dataList.add((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(7)));
|
|
||||||
} else {
|
|
||||||
dataList.add("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (QcItemEntity entity : qcItemList) {
|
|
||||||
String value = (String) result.getOrDefault(entity.getQcItemNo(), "");
|
|
||||||
if (Constant.QC_ITEM_TYPE_STRING.equals(entity.getQcItemType())) {
|
|
||||||
dataList.add(value);
|
|
||||||
} else if (Constant.QC_ITEM_TYPE_PICTURE.equals(entity.getQcItemType())) {
|
|
||||||
if (value.startsWith("picture")) {
|
|
||||||
dataList.add(host + value);
|
|
||||||
} else {
|
|
||||||
dataList.add(value);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
dataList.add(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
formatResultList.add(dataList);
|
|
||||||
}
|
|
||||||
return formatResultList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 这个表格是否需要过程抽检批次这个表头
|
|
||||||
* 只要存在一条项目工艺编号为U001的数据,就需要这个表头
|
|
||||||
*/
|
|
||||||
private boolean needProcessBatch(List<Map<String, Object>> resultList) {
|
|
||||||
for (Map<String, Object> result : resultList) {
|
|
||||||
if ("U001".equals((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 表格中的本行记录是否是成型过程工检数据
|
|
||||||
* 如果项目工艺编号为U001,那就是
|
|
||||||
*/
|
|
||||||
private boolean isProcessBatch(Map<String, Object> result) {
|
|
||||||
if ("U001".equals((String) result.get(EXCEL_HEAD_STYLE_ONE_NO.get(5)))) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将格式化后的结果集数据导出为Excel文件
|
|
||||||
*/
|
|
||||||
private String doExportExcel(List<List<String>> dataListList) throws Exception {
|
|
||||||
//创建XSSFWorkbook对象(excel的文档对象)
|
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
|
||||||
//建立新的sheet对象(excel的表单)
|
|
||||||
XSSFSheet sheet = workbook.createSheet("检验数据表");
|
|
||||||
for (int i = 0; i < dataListList.get(0).size(); i++) {
|
|
||||||
if (i <= 7) {
|
|
||||||
sheet.setColumnWidth(i, 22 * 256);
|
|
||||||
} else {
|
|
||||||
sheet.setColumnWidth(i, 14 * 256);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
XSSFCellStyle headCellStyle = workbook.createCellStyle();
|
|
||||||
headCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
||||||
headCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
||||||
XSSFFont headFont = workbook.createFont();
|
|
||||||
headFont.setColor(HSSFColor.BLACK.index);
|
|
||||||
headCellStyle.setFont(headFont);
|
|
||||||
headCellStyle.setFillForegroundColor(new XSSFColor(new Color(156, 195, 230)));//设置背景色
|
|
||||||
headCellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);//填充模式
|
|
||||||
|
|
||||||
XSSFCellStyle highCellStyle = workbook.createCellStyle();
|
|
||||||
highCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
||||||
highCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
||||||
XSSFFont highFont = workbook.createFont();
|
|
||||||
highFont.setColor(HSSFColor.RED.index);
|
|
||||||
highCellStyle.setFont(highFont);
|
|
||||||
|
|
||||||
XSSFCellStyle lowCellStyle = workbook.createCellStyle();
|
|
||||||
lowCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
||||||
lowCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
||||||
XSSFFont lowFont = workbook.createFont();
|
|
||||||
lowFont.setColor(HSSFColor.BLUE.index);
|
|
||||||
lowCellStyle.setFont(lowFont);
|
|
||||||
|
|
||||||
XSSFCellStyle normalCellStyle = workbook.createCellStyle();
|
|
||||||
normalCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
||||||
normalCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
||||||
XSSFFont normalFont = workbook.createFont();
|
|
||||||
normalFont.setColor(HSSFColor.BLACK.index);
|
|
||||||
normalCellStyle.setFont(normalFont);
|
|
||||||
|
|
||||||
//在sheet里创建第一行,参数为行索引(excel的行),可以是0~65535之间的任何一个
|
|
||||||
XSSFRow titleRow = sheet.createRow(0);
|
|
||||||
//创建单元格(excel的单元格,参数为列索引,可以是0~255之间的任何一个
|
|
||||||
XSSFCell titleCell = titleRow.createCell(0);
|
|
||||||
//设置单元格内容
|
|
||||||
titleCell.setCellValue("检验数据导出表");
|
|
||||||
titleCell.setCellStyle(normalCellStyle);
|
|
||||||
//合并单元格CellRangeAddress构造参数依次表示起始行,截至行,起始列, 截至列
|
|
||||||
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, dataListList.get(0).size() - 1));
|
|
||||||
int startRowNum = 1;
|
|
||||||
for (int i = 0; i < dataListList.size(); i++) {
|
|
||||||
List<String> dataList = dataListList.get(i);
|
|
||||||
if (dataList != null && dataList.size() > 0) {
|
|
||||||
XSSFRow row = sheet.createRow(i + startRowNum);
|
|
||||||
for (int j = 0; j < dataList.size(); j++) {
|
|
||||||
XSSFCell cell = row.createCell(j);
|
|
||||||
String sourceValue = dataList.get(j);
|
|
||||||
if (i == 0) {
|
|
||||||
cell.setCellValue(sourceValue);
|
|
||||||
cell.setCellStyle(headCellStyle);
|
|
||||||
} else if (j <= 5) {
|
|
||||||
cell.setCellValue(sourceValue);
|
|
||||||
cell.setCellStyle(normalCellStyle);
|
|
||||||
} else if (sourceValue.contains("##H")) {
|
|
||||||
cell.setCellValue(LocalDoubleUtils.keepThreeDecimal(sourceValue.split("##")[0]));
|
|
||||||
cell.setCellStyle(highCellStyle);
|
|
||||||
} else if (sourceValue.contains("##L")) {
|
|
||||||
cell.setCellValue(LocalDoubleUtils.keepThreeDecimal(sourceValue.split("##")[0]));
|
|
||||||
cell.setCellStyle(lowCellStyle);
|
|
||||||
} else {
|
|
||||||
XSSFCellDataBean cellDataBean = new XSSFCellDataBean(sourceValue);
|
|
||||||
if (XSSFCellDataBean.VALUE_TYPE_STRING == cellDataBean.getValueType()) {
|
|
||||||
cell.setCellValue(cellDataBean.getStringValue());
|
|
||||||
} else if (XSSFCellDataBean.VALUE_TYPE_DOUBLE == cellDataBean.getValueType()) {
|
|
||||||
cell.setCellValue(LocalDoubleUtils.keepThreeDecimal(cellDataBean.getDoubleValue()));
|
|
||||||
}
|
|
||||||
cell.setCellStyle(normalCellStyle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//输出Excel文件
|
|
||||||
File dirFile = new File("/home/sxy/server/industrial_measurement/excel/");
|
|
||||||
// File dirFile = new File("/Users/liuchengqian/Desktop/DaJiang/");
|
|
||||||
if (!dirFile.exists()) {
|
|
||||||
dirFile.mkdirs();
|
|
||||||
}
|
|
||||||
String excelFileName = System.currentTimeMillis() + ".xlsx";
|
|
||||||
FileOutputStream output = new FileOutputStream(new File(dirFile, excelFileName));
|
|
||||||
workbook.write(output);
|
|
||||||
output.flush();
|
|
||||||
return "excel/" + excelFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 格式化创建时间历史数据
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String formatCreateTime() {
|
|
||||||
System.out.println("开始格式化创建时间历史数据");
|
|
||||||
List<QcSourceEntity> sourceEntityList = qcSourceDao.findAll();
|
|
||||||
long startTimeMillis = System.currentTimeMillis();
|
|
||||||
int listSize = sourceEntityList.size();
|
|
||||||
for (int i = 0; i < listSize; i++) {
|
|
||||||
QcSourceEntity sourceEntity = sourceEntityList.get(i);
|
|
||||||
String createTime = sourceEntity.getCreateTime();
|
|
||||||
String formatCurrentSecond = LocalDateUtils.formatCurrentSecond(createTime);
|
|
||||||
qcSourceDao.formatCreateTime(sourceEntity.getId(), formatCurrentSecond);
|
|
||||||
if (i % 10 == 0) {
|
|
||||||
long spendTimeMillis = System.currentTimeMillis() - startTimeMillis;
|
|
||||||
double remainTimeMillis = (listSize - i) * spendTimeMillis * 1D / i;
|
|
||||||
System.out.println("已完成(" + i + "/" + listSize + "),用时" + formatDuring(spendTimeMillis) + ",剩余" + formatDuring((long) remainTimeMillis));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "格式化创建时间历史数据成功", locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String formatDuring(long mss) {
|
|
||||||
long days = mss / (1000 * 60 * 60 * 24);
|
|
||||||
long hours = (mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60);
|
|
||||||
long minutes = (mss % (1000 * 60 * 60)) / (1000 * 60);
|
|
||||||
long seconds = (mss % (1000 * 60)) / 1000;
|
|
||||||
if (days <= 0 && hours <= 0 && minutes <= 0) {
|
|
||||||
return seconds + " 秒 ";
|
|
||||||
}
|
|
||||||
if (days <= 0 && hours <= 0) {
|
|
||||||
return minutes + " 分钟 " + seconds + " 秒 ";
|
|
||||||
}
|
|
||||||
if (days <= 0) {
|
|
||||||
return hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ";
|
|
||||||
}
|
|
||||||
return days + " 天 " + hours + " 小时 " + minutes + " 分钟 " + seconds + " 秒 ";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,42 +1,25 @@
|
|||||||
package com.xkrs.service.impl;
|
package com.xkrs.service.impl;
|
||||||
|
|
||||||
import com.xkrs.dao.CraftItemDao;
|
|
||||||
import com.xkrs.dao.QcItemDao;
|
import com.xkrs.dao.QcItemDao;
|
||||||
import com.xkrs.dao.QcSpecDao;
|
import com.xkrs.dao.QcSpecDao;
|
||||||
import com.xkrs.encapsulation.PromptMessageEnum;
|
import com.xkrs.encapsulation.PromptMessageEnum;
|
||||||
import com.xkrs.model.bean.ReadSpecHeadBean;
|
|
||||||
import com.xkrs.model.bean.XSSFCellDataBean;
|
|
||||||
import com.xkrs.model.entity.CraftItemEntity;
|
|
||||||
import com.xkrs.model.entity.QcItemEntity;
|
import com.xkrs.model.entity.QcItemEntity;
|
||||||
import com.xkrs.model.entity.QcSpecEntity;
|
import com.xkrs.model.entity.QcSpecEntity;
|
||||||
import com.xkrs.model.qo.ExportSpecExcelQo;
|
|
||||||
import com.xkrs.model.qo.QcSpecQoDelete;
|
import com.xkrs.model.qo.QcSpecQoDelete;
|
||||||
import com.xkrs.model.qo.QcSpecQoInsert;
|
import com.xkrs.model.qo.QcSpecQoInsert;
|
||||||
import com.xkrs.model.qo.QcSpecQoUpdate;
|
import com.xkrs.model.qo.QcSpecQoUpdate;
|
||||||
import com.xkrs.service.QcSpecService;
|
import com.xkrs.service.QcSpecService;
|
||||||
import com.xkrs.util.LocalDateUtils;
|
import com.xkrs.util.LocalDateUtils;
|
||||||
import com.xkrs.util.LocalDoubleUtils;
|
|
||||||
import com.xkrs.util.LocalStringUtils;
|
import com.xkrs.util.LocalStringUtils;
|
||||||
import org.apache.http.util.TextUtils;
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
|
|
||||||
import org.apache.poi.hssf.util.HSSFColor;
|
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
|
||||||
import org.apache.poi.xssf.usermodel.*;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.data.domain.Sort;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import java.awt.*;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.*;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
@ -45,9 +28,6 @@ public class QcSpecServiceImpl implements QcSpecService {
|
|||||||
|
|
||||||
private Locale locale = LocaleContextHolder.getLocale();
|
private Locale locale = LocaleContextHolder.getLocale();
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CraftItemDao craftItemDao;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private QcItemDao qcItemDao;
|
private QcItemDao qcItemDao;
|
||||||
|
|
||||||
@ -61,7 +41,6 @@ public class QcSpecServiceImpl implements QcSpecService {
|
|||||||
public String insertQcSpec(QcSpecQoInsert insertQo) {
|
public String insertQcSpec(QcSpecQoInsert insertQo) {
|
||||||
|
|
||||||
String varietyNo = insertQo.getVarietyNo();
|
String varietyNo = insertQo.getVarietyNo();
|
||||||
String craftItemNo = insertQo.getCraftItemNo();
|
|
||||||
String qcItemNo = insertQo.getQcItemNo();
|
String qcItemNo = insertQo.getQcItemNo();
|
||||||
String max = insertQo.getMax();
|
String max = insertQo.getMax();
|
||||||
String mean = insertQo.getMean();
|
String mean = insertQo.getMean();
|
||||||
@ -71,23 +50,19 @@ public class QcSpecServiceImpl implements QcSpecService {
|
|||||||
String standard = insertQo.getStandard();
|
String standard = insertQo.getStandard();
|
||||||
String remark = insertQo.getRemark();
|
String remark = insertQo.getRemark();
|
||||||
|
|
||||||
Optional<CraftItemEntity> craftItemByNo = craftItemDao.findByCraftItemNo(craftItemNo);
|
Optional<QcItemEntity> entityByNo = qcItemDao.findByNo(qcItemNo);
|
||||||
if (craftItemByNo.isEmpty()) {
|
if (entityByNo.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该工艺项目,请先添加工艺项目!", locale);
|
|
||||||
}
|
|
||||||
Optional<QcItemEntity> qcItemByNo = qcItemDao.findByQcItemNo(qcItemNo);
|
|
||||||
if (qcItemByNo.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale);
|
||||||
}
|
}
|
||||||
Optional<QcSpecEntity> existsQcSpecOptional = qcSpecDao.findExistsQcSpec(varietyNo, craftItemNo, qcItemNo);
|
|
||||||
if (existsQcSpecOptional.isPresent()) {
|
Optional<QcSpecEntity> entityByVarietyNoAndQcItemNo = qcSpecDao.findByVarietyNoAndQcItemNo(varietyNo, qcItemNo);
|
||||||
|
if (entityByVarietyNoAndQcItemNo.isPresent()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该检验规格已存在,请勿重复添加!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该检验规格已存在,请勿重复添加!", locale);
|
||||||
}
|
}
|
||||||
QcSpecEntity entity = new QcSpecEntity();
|
QcSpecEntity entity = new QcSpecEntity();
|
||||||
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
|
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
|
||||||
entity.setUpdateTime("");
|
entity.setUpdateTime("");
|
||||||
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
|
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
|
||||||
entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(craftItemNo));
|
|
||||||
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
|
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
|
||||||
entity.setMax(LocalStringUtils.formatEmptyValue(max));
|
entity.setMax(LocalStringUtils.formatEmptyValue(max));
|
||||||
entity.setMean(LocalStringUtils.formatEmptyValue(mean));
|
entity.setMean(LocalStringUtils.formatEmptyValue(mean));
|
||||||
@ -119,6 +94,7 @@ public class QcSpecServiceImpl implements QcSpecService {
|
|||||||
/**
|
/**
|
||||||
* 更新检验规格
|
* 更新检验规格
|
||||||
*/
|
*/
|
||||||
|
@Transactional(rollbackOn = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public String updateQcSpec(QcSpecQoUpdate updateQo) {
|
public String updateQcSpec(QcSpecQoUpdate updateQo) {
|
||||||
|
|
||||||
@ -145,350 +121,11 @@ public class QcSpecServiceImpl implements QcSpecService {
|
|||||||
* 查询检验规格
|
* 查询检验规格
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String queryQcSpec(String varietyNo, String craftItemNo, String qcItemNo) {
|
public String queryQcSpec(String varietyNo, String qcItemNo) {
|
||||||
String finalVarietyNo = LocalStringUtils.formatEmptyValue(varietyNo).trim();
|
List<Map<String, Object>> resultList = qcSpecDao.queryQcSpec(LocalStringUtils.formatEmptyValue(varietyNo), LocalStringUtils.formatEmptyValue(qcItemNo));
|
||||||
String finalQcItemNo = LocalStringUtils.formatEmptyValue(qcItemNo).trim();
|
|
||||||
List<Map<String, Object>> resultList;
|
|
||||||
if (TextUtils.isEmpty(craftItemNo)) {
|
|
||||||
resultList = qcSpecDao.queryQcSpec(finalVarietyNo, finalQcItemNo);
|
|
||||||
} else {
|
|
||||||
resultList = qcSpecDao.queryQcSpec(finalVarietyNo, craftItemNo.trim(), finalQcItemNo);
|
|
||||||
}
|
|
||||||
if (resultList == null || resultList.isEmpty()) {
|
if (resultList == null || resultList.isEmpty()) {
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验规格的信息!", locale);
|
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验规格的信息!", locale);
|
||||||
}
|
}
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, resultList, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, resultList, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 导入检验规格
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String importSpecExcel(MultipartFile specExcel) {
|
|
||||||
try {
|
|
||||||
//1、读取检验规格数据表文件
|
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook(specExcel.getInputStream());
|
|
||||||
//2、获取工作表对象
|
|
||||||
XSSFSheet sheet = workbook.getSheetAt(0);
|
|
||||||
//3、获取行的迭代器
|
|
||||||
Iterator<Row> iterator = sheet.iterator();
|
|
||||||
long rowNum = 0;
|
|
||||||
long colNum = -1;
|
|
||||||
//4、表格数据容器
|
|
||||||
List<List<String>> sheetDataList = new ArrayList<>();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
Row row = iterator.next();
|
|
||||||
if (rowNum == 0) {
|
|
||||||
ReadSpecHeadBean readResult = readSpecHead(row);
|
|
||||||
if (readResult.isSuccess()) {
|
|
||||||
colNum = readResult.getHeadCount();
|
|
||||||
rowNum++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, readResult.getErrorMessage(), locale);
|
|
||||||
}
|
|
||||||
List<String> rowDataList = new ArrayList<>();
|
|
||||||
for (int i = 0; i < colNum; i++) {
|
|
||||||
String value = getValue(row.getCell(i));
|
|
||||||
if (i == 0) {//机种号数据直接添加
|
|
||||||
if (TextUtils.isEmpty(value)) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "第" + rowNum + "行机种号为空,请先编辑机种号!", locale);
|
|
||||||
}
|
|
||||||
rowDataList.add(value);
|
|
||||||
} else if (i == 1) {//工艺项目数据要添加对应的编号
|
|
||||||
Optional<CraftItemEntity> craftItemOptional = craftItemDao.findByCraftItemName(value);
|
|
||||||
if (craftItemOptional.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "第" + rowNum + "行工艺项目(" + value + ")不存在,请先添加工艺项目!", locale);
|
|
||||||
}
|
|
||||||
rowDataList.add(craftItemOptional.get().getCraftItemNo());
|
|
||||||
} else if (i == 2) {//检验项目数据要添加对应的编号
|
|
||||||
Optional<QcItemEntity> qcItemOptional = qcItemDao.findByQcItemName(value);
|
|
||||||
if (qcItemOptional.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "第" + rowNum + "行检验项目(" + value + ")不存在,请先添加检验项目!", locale);
|
|
||||||
}
|
|
||||||
rowDataList.add(qcItemOptional.get().getQcItemNo());
|
|
||||||
} else {//其他数据直接添加
|
|
||||||
rowDataList.add(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sheetDataList.add(rowDataList);
|
|
||||||
rowNum++;
|
|
||||||
}
|
|
||||||
//5、表格数据自重复检查
|
|
||||||
for (int i = 0; i < sheetDataList.size(); i++) {
|
|
||||||
List<String> rowDataList = sheetDataList.get(i);
|
|
||||||
List<Integer> appearIndexList = checkAppearIndex(sheetDataList, rowDataList.get(0), rowDataList.get(1), rowDataList.get(2));
|
|
||||||
if (appearIndexList.size() == 0) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "系统错误!", locale);
|
|
||||||
}
|
|
||||||
if (appearIndexList.size() > 1) {
|
|
||||||
StringBuilder response = new StringBuilder();
|
|
||||||
response.append("检验规格表中:机种号、工艺项目、检验项目三项存在全部相同项,行数:");
|
|
||||||
for (Integer appearIndex : appearIndexList) {
|
|
||||||
response.append("第").append(appearIndex + 2).append("行、");
|
|
||||||
}
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, response.toString(), locale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//6、表格的数据已经全部读取完成,并且自检通过,接下来遍历入库即可
|
|
||||||
int insertCount = 0;
|
|
||||||
int updateCount = 0;
|
|
||||||
for (List<String> rowDataList : sheetDataList) {
|
|
||||||
String varietyNo = rowDataList.get(0);
|
|
||||||
String craftItemNo = rowDataList.get(1);
|
|
||||||
String qcItemNo = rowDataList.get(2);
|
|
||||||
String max = rowDataList.get(3);
|
|
||||||
String min = rowDataList.get(4);
|
|
||||||
String method = rowDataList.get(5);
|
|
||||||
Optional<QcSpecEntity> existsQcSpecOptional = qcSpecDao.findExistsQcSpec(varietyNo, craftItemNo, qcItemNo);
|
|
||||||
if (existsQcSpecOptional.isPresent()) {
|
|
||||||
qcSpecDao.updateQcSpecByVCQ(LocalStringUtils.formatEmptyValue(varietyNo), LocalStringUtils.formatEmptyValue(craftItemNo), LocalStringUtils.formatEmptyValue(qcItemNo), LocalDateUtils.getCurrentSecond(), LocalStringUtils.formatEmptyValue(max), "", LocalStringUtils.formatEmptyValue(min), "", LocalStringUtils.formatEmptyValue(method), "", "");
|
|
||||||
updateCount++;
|
|
||||||
} else {
|
|
||||||
QcSpecEntity entity = new QcSpecEntity();
|
|
||||||
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
|
|
||||||
entity.setUpdateTime("");
|
|
||||||
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
|
|
||||||
entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(craftItemNo));
|
|
||||||
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
|
|
||||||
entity.setMax(LocalStringUtils.formatEmptyValue(max));
|
|
||||||
entity.setMean("");
|
|
||||||
entity.setMin(LocalStringUtils.formatEmptyValue(min));
|
|
||||||
entity.setUnit("");
|
|
||||||
entity.setMethod(LocalStringUtils.formatEmptyValue(method));
|
|
||||||
entity.setStandard("");
|
|
||||||
entity.setRemark("");
|
|
||||||
qcSpecDao.save(entity);
|
|
||||||
insertCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
StringBuilder response = new StringBuilder();
|
|
||||||
response.append("导入成功");
|
|
||||||
if (insertCount > 0) {
|
|
||||||
response.append(",新增").append(insertCount).append("条检验规格");
|
|
||||||
}
|
|
||||||
if (updateCount > 0) {
|
|
||||||
response.append(",更新").append(updateCount).append("条检验规格");
|
|
||||||
}
|
|
||||||
response.append("。");
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, response.toString(), locale);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "请上传正确的Microsoft Excel 2007/2010 Workbook(*.xlsx)文件!", locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Integer> checkAppearIndex(List<List<String>> sheetDataList, String varietyNo, String craftItemNo, String qcItemNo) {
|
|
||||||
List<Integer> appearIndexList = new ArrayList<>();
|
|
||||||
for (int i = 0; i < sheetDataList.size(); i++) {
|
|
||||||
List<String> rowDataList = sheetDataList.get(i);
|
|
||||||
if (rowDataList.get(0).equals(varietyNo) && rowDataList.get(1).equals(craftItemNo) && rowDataList.get(2).equals(qcItemNo)) {
|
|
||||||
appearIndexList.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return appearIndexList;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> QC_SPEC_HEAD = Arrays.asList("机种号", "工艺项目", "检验项目", "最大值", "最小值", "检验方法", "最大值(管理值)", "最小值(管理值)");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 读取表头数据
|
|
||||||
*/
|
|
||||||
private ReadSpecHeadBean readSpecHead(Row headRow) {
|
|
||||||
ReadSpecHeadBean readResult = new ReadSpecHeadBean();
|
|
||||||
for (int i = 0; i < 6; i++) {
|
|
||||||
if (!QC_SPEC_HEAD.get(i).equals(getValue(headRow.getCell(i)))) {
|
|
||||||
readResult.setSuccess(false);
|
|
||||||
readResult.setHeadCount(0);
|
|
||||||
readResult.setErrorMessage("表头第" + (i + 1) + "列应该是:" + QC_SPEC_HEAD.get(i));
|
|
||||||
return readResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
readResult.setSuccess(true);
|
|
||||||
readResult.setHeadCount(6);
|
|
||||||
readResult.setErrorMessage("");
|
|
||||||
return readResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取单元格内的数据,并进行格式转换
|
|
||||||
*/
|
|
||||||
private String getValue(Cell cell) {
|
|
||||||
if (cell == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (Cell.CELL_TYPE_STRING == cell.getCellType()) {
|
|
||||||
return cell.getStringCellValue();
|
|
||||||
}
|
|
||||||
if (Cell.CELL_TYPE_BOOLEAN == cell.getCellType()) {
|
|
||||||
return String.valueOf(cell.getBooleanCellValue());
|
|
||||||
}
|
|
||||||
if (Cell.CELL_TYPE_NUMERIC == cell.getCellType()) {//数值和日期均是此类型,需进一步判断
|
|
||||||
if (HSSFDateUtil.isCellDateFormatted(cell)) {
|
|
||||||
//是日期类型
|
|
||||||
return String.valueOf(cell.getDateCellValue().getTime());
|
|
||||||
} else {
|
|
||||||
//是数值类型
|
|
||||||
return String.valueOf(cell.getNumericCellValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出检验规格
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String exportSpecExcel(ExportSpecExcelQo exportSpecExcelQo) throws Exception {
|
|
||||||
|
|
||||||
List<QcSpecEntity> qcSpecList = qcSpecDao.findAll(Sort.by(Sort.Direction.ASC, "createTime"));
|
|
||||||
if (qcSpecList.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "无检验规格数据可导出,请先添加检验规格!", locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
List<List<String>> dataListList = new ArrayList<>();
|
|
||||||
dataListList.add(QC_SPEC_HEAD);
|
|
||||||
for (QcSpecEntity qcSpecEntity : qcSpecList) {
|
|
||||||
List<String> dataList = new ArrayList<>();
|
|
||||||
dataList.add(qcSpecEntity.getVarietyNo());
|
|
||||||
Optional<CraftItemEntity> craftItemOptional = craftItemDao.findByCraftItemNo(qcSpecEntity.getCraftItemNo());
|
|
||||||
if (craftItemOptional.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "检验规格数据导出失败(code=01)!", locale);
|
|
||||||
}
|
|
||||||
dataList.add(craftItemOptional.get().getCraftItemName());
|
|
||||||
Optional<QcItemEntity> qcItemOptional = qcItemDao.findByQcItemNo(qcSpecEntity.getQcItemNo());
|
|
||||||
if (qcItemOptional.isEmpty()) {
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "检验规格数据导出失败(code=02)!", locale);
|
|
||||||
}
|
|
||||||
dataList.add(qcItemOptional.get().getQcItemName());
|
|
||||||
dataList.add(qcSpecEntity.getMax());
|
|
||||||
dataList.add(qcSpecEntity.getMin());
|
|
||||||
dataList.add(qcSpecEntity.getMethod());
|
|
||||||
dataListList.add(dataList);
|
|
||||||
}
|
|
||||||
|
|
||||||
//创建XSSFWorkbook对象(excel的文档对象)
|
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
|
||||||
//建立新的sheet对象(excel的表单)
|
|
||||||
XSSFSheet sheet = workbook.createSheet("检验规格表");
|
|
||||||
for (int i = 0; i < dataListList.get(0).size(); i++) {
|
|
||||||
sheet.setColumnWidth(i, 24 * 256);
|
|
||||||
}
|
|
||||||
|
|
||||||
XSSFCellStyle headCellStyle = workbook.createCellStyle();
|
|
||||||
headCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
||||||
headCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
||||||
XSSFFont headFont = workbook.createFont();
|
|
||||||
headFont.setColor(HSSFColor.BLACK.index);
|
|
||||||
headCellStyle.setFont(headFont);
|
|
||||||
headCellStyle.setFillForegroundColor(new XSSFColor(new Color(156, 195, 230)));//设置背景色
|
|
||||||
headCellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);//填充模式
|
|
||||||
|
|
||||||
XSSFCellStyle normalCellStyle = workbook.createCellStyle();
|
|
||||||
normalCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
||||||
normalCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
||||||
XSSFFont normalFont = workbook.createFont();
|
|
||||||
normalFont.setColor(HSSFColor.BLACK.index);
|
|
||||||
normalCellStyle.setFont(normalFont);
|
|
||||||
|
|
||||||
int startRowNum = 0;
|
|
||||||
for (int i = 0; i < dataListList.size(); i++) {
|
|
||||||
List<String> dataList = dataListList.get(i);
|
|
||||||
if (dataList != null && dataList.size() > 0) {
|
|
||||||
XSSFRow row = sheet.createRow(i + startRowNum);
|
|
||||||
for (int j = 0; j < dataList.size(); j++) {
|
|
||||||
XSSFCell cell = row.createCell(j);
|
|
||||||
String sourceValue = dataList.get(j);
|
|
||||||
if (i == 0) {
|
|
||||||
cell.setCellValue(sourceValue);
|
|
||||||
cell.setCellStyle(headCellStyle);
|
|
||||||
} else if (j <= 2) {
|
|
||||||
cell.setCellValue(sourceValue);
|
|
||||||
cell.setCellStyle(normalCellStyle);
|
|
||||||
} else {
|
|
||||||
XSSFCellDataBean cellDataBean = new XSSFCellDataBean(sourceValue);
|
|
||||||
if (XSSFCellDataBean.VALUE_TYPE_STRING == cellDataBean.getValueType()) {
|
|
||||||
cell.setCellValue(cellDataBean.getStringValue());
|
|
||||||
} else if (XSSFCellDataBean.VALUE_TYPE_DOUBLE == cellDataBean.getValueType()) {
|
|
||||||
cell.setCellValue(LocalDoubleUtils.keepThreeDecimal(cellDataBean.getDoubleValue()));
|
|
||||||
}
|
|
||||||
cell.setCellStyle(normalCellStyle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//输出Excel文件
|
|
||||||
File dirFile = new File("/home/sxy/server/industrial_measurement/excel/");
|
|
||||||
// File dirFile = new File("/Users/liuchengqian/Desktop/DaJiang/");
|
|
||||||
if (!dirFile.exists()) {
|
|
||||||
dirFile.mkdirs();
|
|
||||||
}
|
|
||||||
String excelFileName = System.currentTimeMillis() + ".xlsx";
|
|
||||||
FileOutputStream output = new FileOutputStream(new File(dirFile, excelFileName));
|
|
||||||
workbook.write(output);
|
|
||||||
output.flush();
|
|
||||||
|
|
||||||
String host = exportSpecExcelQo.getHost();
|
|
||||||
String finalHost = host.endsWith("/") ? host : host + "/";
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, finalHost + "excel/" + excelFileName, locale);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean formatData(String data) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出空白检验规格
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String exportEmptySpecExcel(ExportSpecExcelQo exportSpecExcelQo) throws Exception {
|
|
||||||
|
|
||||||
List<List<String>> dataListList = new ArrayList<>();
|
|
||||||
dataListList.add(QC_SPEC_HEAD);
|
|
||||||
|
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
|
||||||
//建立新的sheet对象(excel的表单)
|
|
||||||
XSSFSheet sheet = workbook.createSheet("检验规格表");
|
|
||||||
for (int i = 0; i < dataListList.get(0).size(); i++) {
|
|
||||||
sheet.setColumnWidth(i, 24 * 256);
|
|
||||||
}
|
|
||||||
|
|
||||||
XSSFCellStyle headCellStyle = workbook.createCellStyle();
|
|
||||||
headCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
|
|
||||||
headCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
|
|
||||||
XSSFFont headFont = workbook.createFont();
|
|
||||||
headFont.setColor(HSSFColor.BLACK.index);
|
|
||||||
headCellStyle.setFont(headFont);
|
|
||||||
headCellStyle.setFillForegroundColor(new XSSFColor(new Color(156, 195, 230)));//设置背景色
|
|
||||||
headCellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);//填充模式
|
|
||||||
|
|
||||||
int startRowNum = 0;
|
|
||||||
List<String> dataList = dataListList.get(0);
|
|
||||||
if (dataList != null && dataList.size() > 0) {
|
|
||||||
XSSFRow row = sheet.createRow(startRowNum);
|
|
||||||
for (int j = 0; j < dataList.size(); j++) {
|
|
||||||
XSSFCell cell = row.createCell(j);
|
|
||||||
cell.setCellStyle(headCellStyle);
|
|
||||||
String data = dataList.get(j);
|
|
||||||
cell.setCellValue(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//输出Excel文件
|
|
||||||
File dirFile = new File("/home/sxy/server/industrial_measurement/excel/");
|
|
||||||
// File dirFile = new File("/Users/liuchengqian/Desktop/DaJiang/");
|
|
||||||
if (!dirFile.exists()) {
|
|
||||||
dirFile.mkdirs();
|
|
||||||
}
|
|
||||||
String excelFileName = System.currentTimeMillis() + ".xlsx";
|
|
||||||
FileOutputStream output = new FileOutputStream(new File(dirFile, excelFileName));
|
|
||||||
workbook.write(output);
|
|
||||||
output.flush();
|
|
||||||
|
|
||||||
String host = exportSpecExcelQo.getHost();
|
|
||||||
String finalHost = host.endsWith("/") ? host : host + "/";
|
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, finalHost + "excel/" + excelFileName, locale);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,4 @@ public interface Constant {
|
|||||||
* 检验项目类型:图片
|
* 检验项目类型:图片
|
||||||
*/
|
*/
|
||||||
String QC_ITEM_TYPE_PICTURE = "1";
|
String QC_ITEM_TYPE_PICTURE = "1";
|
||||||
|
|
||||||
/**
|
|
||||||
* 检验数据时间分组间隔
|
|
||||||
*/
|
|
||||||
long QC_TIME_INTERVAL = 3600;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,39 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class ExportExcel {
|
public class ExportExcel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最简单的填充
|
||||||
|
*
|
||||||
|
* @since 2.1.1
|
||||||
|
*/
|
||||||
|
/*public static String simpleFill(Map<String, String> map,String templateFileName) {
|
||||||
|
|
||||||
|
|
||||||
|
String s = System.currentTimeMillis() + ".xlsx";
|
||||||
|
// 方案2 根据Map填充
|
||||||
|
String fileName = "/usr/local/excel/" + s;
|
||||||
|
//String fileName = "E:\\shoptest\\" + s;
|
||||||
|
// 这里 会填充到第一个sheet, 然后文件流会自动关闭
|
||||||
|
|
||||||
|
ExcelWriterBuilder write = EasyExcel.write(fileName);
|
||||||
|
|
||||||
|
ExcelWriterBuilder excelWriterBuilder = write.withTemplate(templateFileName);
|
||||||
|
|
||||||
|
ExcelWriter build = excelWriterBuilder.build();
|
||||||
|
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
||||||
|
|
||||||
|
build.fill(map,writeSheet);
|
||||||
|
build.finish();
|
||||||
|
|
||||||
|
//EasyExcel.write(fileName).withTemplate(templateFileName).sheet().doFill(map);
|
||||||
|
return "http://118.24.27.47:2088/excel/"+s;
|
||||||
|
//return "http://192.168.2.139/"+s;
|
||||||
|
}*/
|
||||||
public static String exportToProveExcel(Map<String, String> dataMap, String srcFilePath) throws IOException, InvalidFormatException {
|
public static String exportToProveExcel(Map<String, String> dataMap, String srcFilePath) throws IOException, InvalidFormatException {
|
||||||
String s = System.currentTimeMillis() + ".xlsx";
|
String s = System.currentTimeMillis() + ".xlsx";
|
||||||
//String path = "E:/shop/"+s;
|
//String path = "E:/shop/"+s;
|
||||||
String path = "/home/sxy/server/industrial_measurement/excel/" + s;
|
String path = "/home/sxy/server/industrial_measurement/excel/" + s;
|
||||||
|
|
||||||
// 开始转换。利用 transformer 转到Excel
|
// 开始转换。利用 transformer 转到Excel
|
||||||
XLSTransformer transformer = new XLSTransformer();
|
XLSTransformer transformer = new XLSTransformer();
|
||||||
// 参数:srcFilePath:模板源文件 cMap:需要导出的数据 destFile.getAbsolutePath():下载的目标文件
|
// 参数:srcFilePath:模板源文件 cMap:需要导出的数据 destFile.getAbsolutePath():下载的目标文件
|
||||||
@ -24,4 +53,15 @@ public class ExportExcel {
|
|||||||
return "http://118.24.27.47:2088/excel/" + s;
|
return "http://118.24.27.47:2088/excel/" + s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*public static void main(String[] args) throws IOException, InvalidFormatException {
|
||||||
|
// 模板注意 用{} 来表示你要用的变量 如果本来就有"{","}" 特殊字符 用"\{","\}"代替
|
||||||
|
String templateFileName = TestFileUtil.getPath() + "templates" + File.separator + "test.xlsx";
|
||||||
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
map.put("name", "张三");
|
||||||
|
map.put("sex", "男");
|
||||||
|
//simpleFill(map,templateFileName);
|
||||||
|
HttpServletResponse response = null;
|
||||||
|
String s = exportToProveExcel(map);
|
||||||
|
System.out.println(s);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.xkrs.util;
|
package com.xkrs.util;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class LocalDateUtils {
|
public class LocalDateUtils {
|
||||||
@ -10,26 +8,9 @@ public class LocalDateUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getCurrentSecond() {
|
public static String getCurrentSecond() {
|
||||||
|
|
||||||
|
// return DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||||
return String.valueOf(new Date().getTime() / 1000L);
|
return String.valueOf(new Date().getTime() / 1000L);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回给前端用的日期格式化
|
|
||||||
*
|
|
||||||
* @param second 秒时间戳
|
|
||||||
*/
|
|
||||||
public static String formatCurrentSecond(String second) {
|
|
||||||
long timeMillis = Long.parseLong(second + "000");
|
|
||||||
return DateUtil.format(new Date(timeMillis), "yyyy-MM-dd HH:mm:ss");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出表格用的日期格式化
|
|
||||||
*
|
|
||||||
* @param second 秒时间戳
|
|
||||||
*/
|
|
||||||
public static String exportFormatCurrentSecond(String second) {
|
|
||||||
long timeMillis = Long.parseLong(second + "000");
|
|
||||||
return DateUtil.format(new Date(timeMillis), "yyyy-MM-dd HH");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
package com.xkrs.util;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
|
|
||||||
public class LocalDoubleUtils {
|
|
||||||
|
|
||||||
private static final DecimalFormat decimalFormat = new DecimalFormat("0.000");
|
|
||||||
|
|
||||||
private LocalDoubleUtils() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String keepThreeDecimal(String value) {
|
|
||||||
return keepThreeDecimal(Double.parseDouble(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String keepThreeDecimal(double value) {
|
|
||||||
return decimalFormat.format(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -6,7 +6,7 @@ server.port = 6810
|
|||||||
#spring.datasource.password = 123456
|
#spring.datasource.password = 123456
|
||||||
#spring.datasource.driverClassName = org.postgresql.Driver
|
#spring.datasource.driverClassName = org.postgresql.Driver
|
||||||
|
|
||||||
spring.datasource.url = jdbc:mysql://118.24.27.47:3306/data_model?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
|
spring.datasource.url = jdbc:mysql://118.24.27.47:3306/data_model?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||||
spring.datasource.userName = sxy
|
spring.datasource.userName = sxy
|
||||||
spring.datasource.password = sxy123
|
spring.datasource.password = sxy123
|
||||||
spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver
|
spring.datasource.driverClassName = com.mysql.cj.jdbc.Driver
|
||||||
|
Loading…
Reference in New Issue
Block a user