diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index f159065..3937c10 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,56 @@ example: ```shell 11:54:15.901 [main] DEBUG c.c.t.tests.dao.ReservationTest - confirmation Number - [b73faf16-cdb3-4dde-91f2-c904c09cda33] -``` \ No newline at end of file +``` + +

+ + + +
提供 CWIKI.US 项目中使用的代码 +

+ +所有的 Java 代码使用的是 JDK 11。 + +你可以通过单击下面连接后访问我们网站,并且访问我们提供的最新有关 Java 的开发资料。 + +* [概述](https://www.cwiki.us/pages/viewpage.action?pageId=37492282) +* [社区和讨论](https://www.ossez.com/c/open-source/java/15) + +# 联系方式 + +请使用下面的联系方式和我们联系: + +| 联系方式名称 | 联系方式 | +|--------|-----------------------------------------------| +| 电子邮件 | [service@ossez.com](mailto:service@ossez.com) | +| QQ 或微信 | 103899765 | +| QQ 交流群 | 15186112 | +| 社区论坛 | https://www.ossez.com/c/open-source/java/15 | + +# 公众平台 + +我们建议您通过社区论坛来和我们进行沟通,请关注我们公众平台上的账号 + +## 微信公众号 + +![](https://cdn.ossez.com/img/cwikius/cwikius-qr-wechat-search-w400.png) + +## 头条号 + +我们也在头条号上创建了我们的公众号,请扫描下面的 QR 关注我们的头条号。 + +![](https://cdn.ossez.com/img/cwikius/cwikus-qr-toutiao.png) + +## 快速导航 + +在下面的表格中,我们列出了一些比较有用的 CWIKIUS 相关软件开发使用教程的导航,欢迎访问下面的链接获得更多的内容和参与讨论 + +| 网站名称 | URL | NOTE | +|----------------|--------------------------------------------------------|----------------------------| +| OSSEZ 社区 | [www.ossez.com](https://www.ossez.com/) | 开放社区,欢迎注册参与讨论 | +| WIKI 维基 | [www.cwiki.us](https://www.cwiki.us/) | 使用 Confluence 部署的 WIKI 知识库 | +| DOCS.OSSEZ.COM | [https://docs.ossez.com/#/](https://docs.ossez.com/#/) | 本手册的编译版本将会部署在这个链接上 | +| CN 博客 | [http://www.cwikius.cn/](http://www.cwikius.cn/) | CWIKIUS.CN 一个有独立思考和温度的清新站 | + +## \ No newline at end of file diff --git a/common/src/main/java/com/crd/demo/common/dao/DataObject.java b/common/src/main/java/com/crd/demo/common/dao/DataObject.java new file mode 100644 index 0000000..a9f6a46 --- /dev/null +++ b/common/src/main/java/com/crd/demo/common/dao/DataObject.java @@ -0,0 +1,103 @@ +package com.crd.demo.common.dao; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.hibernate.search.annotations.DateBridge; +import org.hibernate.search.annotations.DocumentId; +import org.hibernate.search.annotations.Resolution; + +import javax.persistence.*; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * DataObject + */ +@MappedSuperclass +public abstract class DataObject { + + @Id + @Column(name = "id") + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "cluSeqGen") + @SequenceGenerator(name = "cluSeqGen", sequenceName = "DBO.CLU_SEQ", allocationSize = 500) + private Long id; + + + @Column(name = "date_created") + private Date dateCreated; + + + @Column(name = "date_modified") + private Date dateModified; + + + @Column(name = "uuid") + private String uuid; + + @JsonProperty + @DocumentId + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + /** + * @return + */ + @JsonProperty + @DateBridge(resolution = Resolution.SECOND) + @Column(nullable = false, updatable = false) + public Date getDateCreated() { + return dateCreated; + } + + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + + public void setDateCreated(String dateCreated) throws ParseException { + this.dateCreated = new SimpleDateFormat("dd/MM/yy H:mm").parse(dateCreated); + } + + @JsonProperty + @DateBridge(resolution = Resolution.SECOND) + @Column(nullable = false) + public Date getDateModified() { + return dateModified; + } + + public void setDateModified(Date dateModified) { + this.dateModified = dateModified; + } + + public void setDateModified(String dateModified) throws ParseException { + this.dateModified = new SimpleDateFormat("dd/MM/yy H:mm").parse(dateModified); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + DataObject that = (DataObject) o; + + return id.equals(that.id); + } + + @Override + public int hashCode() { + var hashId = id == null ? 0 : id; + return (int) (hashId ^ (hashId >>> 32)); + } +} diff --git a/common/src/main/java/com/crd/demo/common/dao/repository/CarsRepository.java b/common/src/main/java/com/crd/demo/common/dao/repository/CarsRepository.java new file mode 100644 index 0000000..b5dd245 --- /dev/null +++ b/common/src/main/java/com/crd/demo/common/dao/repository/CarsRepository.java @@ -0,0 +1,11 @@ +package com.crd.demo.common.dao.repository; + + +import com.crd.demo.common.model.models.Cars; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface CarsRepository extends JpaRepository { + Cars findCommonManufacturerByUuid(String uuid); +} diff --git a/common/src/main/java/com/crd/demo/common/model/models/Cars.java b/common/src/main/java/com/crd/demo/common/model/models/Cars.java new file mode 100644 index 0000000..562bfef --- /dev/null +++ b/common/src/main/java/com/crd/demo/common/model/models/Cars.java @@ -0,0 +1,38 @@ +package com.crd.demo.common.model.models; + +import com.crd.demo.common.dao.DataObject; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; +import java.io.Serializable; +import java.util.Date; +import java.util.UUID; + +/** + * ORM For Table: CARS + */ +@Entity +@Table(name = "CARS", schema = "h2") +public class Cars extends DataObject implements Serializable { + + + @Column(name = "name") + private String manufacturerName; + + /** + * Constructor + */ + public Cars() { + this.setDateCreated(new Date()); + this.setDateModified(new Date()); + this.setUuid(UUID.randomUUID().toString()); + } + + public String getManufacturerName() { + return manufacturerName; + } + + public void setManufacturerName(String manufacturerName) { + this.manufacturerName = manufacturerName; + } +} diff --git a/common/src/main/java/com/crd/demo/common/model/request/TopicRequest.java b/common/src/main/java/com/crd/demo/common/model/request/TopicRequest.java new file mode 100644 index 0000000..d2fd8fc --- /dev/null +++ b/common/src/main/java/com/crd/demo/common/model/request/TopicRequest.java @@ -0,0 +1,84 @@ +package com.crd.demo.common.model.request; + +import java.io.Serializable; + + +/** + * SearchRequest Object, UI can send search String and related pagination + * + * @author YuCheng Hu + */ +public class TopicRequest implements Serializable { + private static final long serialVersionUID = 6474765081240948885L; + + + private String title; + private Integer topic_id; + private String raw; + private Integer category; + private String target_recipients; + private String archetype; + private String created_at; + + public static long getSerialVersionUID() { + return serialVersionUID; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getTopic_id() { + return topic_id; + } + + public void setTopic_id(Integer topic_id) { + this.topic_id = topic_id; + } + + public String getRaw() { + return raw; + } + + public void setRaw(String raw) { + this.raw = raw; + } + + public Integer getCategory() { + return category; + } + + public void setCategory(Integer category) { + this.category = category; + } + + public String getTarget_recipients() { + return target_recipients; + } + + public void setTarget_recipients(String target_recipients) { + this.target_recipients = target_recipients; + } + + public String getArchetype() { + return archetype; + } + + public void setArchetype(String archetype) { + this.archetype = archetype; + } + + public String getCreated_at() { + return created_at; + } + + public void setCreated_at(String created_at) { + this.created_at = created_at; + } + + +} diff --git a/common/src/main/java/com/crd/demo/common/model/response/MyFileResponse.java b/common/src/main/java/com/crd/demo/common/model/response/MyFileResponse.java new file mode 100644 index 0000000..efc751f --- /dev/null +++ b/common/src/main/java/com/crd/demo/common/model/response/MyFileResponse.java @@ -0,0 +1,130 @@ +package com.crd.demo.common.model.response; + +import java.io.Serializable; + +/** + * MyFileResponse for API my file response + * + * @author YuCheng Hu + */ +public class MyFileResponse implements Serializable { + private static final long serialVersionUID = -5103349220463423614L; + + private Long id; + private String azureInputFileUUID; + private String azureInputFileETag; + private String azureOutputFileUUID; + private String azureOutputFileETag; + private String customerName; + private String inputFileName; + private Integer fileCountRow; + private Integer fileCountAliasMatch; + private Integer fileCountDirectMatch; + private Integer fileCountNoMatch; + private String dateCreated; + private String uuid; + + public String getAzureInputFileUUID() { + return azureInputFileUUID; + } + + public void setAzureInputFileUUID(String azureInputFileUUID) { + this.azureInputFileUUID = azureInputFileUUID; + } + + public String getAzureInputFileETag() { + return azureInputFileETag; + } + + public void setAzureInputFileETag(String azureInputFileETag) { + this.azureInputFileETag = azureInputFileETag; + } + + public String getAzureOutputFileUUID() { + return azureOutputFileUUID; + } + + public void setAzureOutputFileUUID(String azureOutputFileUUID) { + this.azureOutputFileUUID = azureOutputFileUUID; + } + + public String getAzureOutputFileETag() { + return azureOutputFileETag; + } + + public void setAzureOutputFileETag(String azureOutputFileETag) { + this.azureOutputFileETag = azureOutputFileETag; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public String getInputFileName() { + return inputFileName; + } + + public void setInputFileName(String inputFileName) { + this.inputFileName = inputFileName; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Integer getFileCountRow() { + return fileCountRow; + } + + public void setFileCountRow(Integer fileCountRow) { + this.fileCountRow = fileCountRow; + } + + public Integer getFileCountAliasMatch() { + return fileCountAliasMatch; + } + + public void setFileCountAliasMatch(Integer fileCountAliasMatch) { + this.fileCountAliasMatch = fileCountAliasMatch; + } + + public Integer getFileCountDirectMatch() { + return fileCountDirectMatch; + } + + public void setFileCountDirectMatch(Integer fileCountDirectMatch) { + this.fileCountDirectMatch = fileCountDirectMatch; + } + + public Integer getFileCountNoMatch() { + return fileCountNoMatch; + } + + public void setFileCountNoMatch(Integer fileCountNoMatch) { + this.fileCountNoMatch = fileCountNoMatch; + } + + public String getDateCreated() { + return dateCreated; + } + + public void setDateCreated(String dateCreated) { + this.dateCreated = dateCreated; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } +} diff --git a/common/src/main/java/com/crd/demo/common/model/response/SearchResponse.java b/common/src/main/java/com/crd/demo/common/model/response/SearchResponse.java new file mode 100644 index 0000000..2510932 --- /dev/null +++ b/common/src/main/java/com/crd/demo/common/model/response/SearchResponse.java @@ -0,0 +1,37 @@ +package com.crd.demo.common.model.response; + +import java.io.Serializable; +import java.util.Date; + +/** + * SearchResponse from Remote Source + * + * @author YuCheng Hu + */ +public class SearchResponse implements Serializable { + private static final long serialVersionUID = -2014480627591149391L; + + + private String uuid; + private Date currentDate; + + public static long getSerialVersionUID() { + return serialVersionUID; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public Date getCurrentDate() { + return currentDate; + } + + public void setCurrentDate(Date currentDate) { + this.currentDate = currentDate; + } +} diff --git a/common/src/main/java/com/crd/demo/common/service/CarsService.java b/common/src/main/java/com/crd/demo/common/service/CarsService.java new file mode 100644 index 0000000..c45f358 --- /dev/null +++ b/common/src/main/java/com/crd/demo/common/service/CarsService.java @@ -0,0 +1,14 @@ +package com.crd.demo.common.service; + + +import com.crd.demo.common.model.models.Cars; + +import java.io.IOException; +import java.util.List; + +public interface CarsService { + + Cars saveCars(Cars cars); + + +} diff --git a/common/src/main/java/com/crd/demo/common/service/CarsServiceImpl.java b/common/src/main/java/com/crd/demo/common/service/CarsServiceImpl.java new file mode 100644 index 0000000..ff5c17d --- /dev/null +++ b/common/src/main/java/com/crd/demo/common/service/CarsServiceImpl.java @@ -0,0 +1,27 @@ +package com.crd.demo.common.service; + +import com.crd.demo.common.dao.repository.CarsRepository; +import com.crd.demo.common.model.models.Cars; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.List; + +/** + * CommonManufacturerService to Process data logic + */ +@Service +public class CarsServiceImpl implements CarsService { + + private final CarsRepository carsRepository; + + public CarsServiceImpl(CarsRepository carsRepository) { + this.carsRepository = carsRepository; + } + + + @Override + public Cars saveCars(Cars cars) { + return carsRepository.save(cars); + } +} diff --git a/common/src/test/java/com/crd/toolkits/tests/dao/DataTest.java b/common/src/test/java/com/crd/toolkits/tests/dao/DataTest.java new file mode 100644 index 0000000..a215119 --- /dev/null +++ b/common/src/test/java/com/crd/toolkits/tests/dao/DataTest.java @@ -0,0 +1,56 @@ +package com.crd.toolkits.tests.dao; + +//import com.crd.demo.common.dao.repository.CarsRepository; + +import com.crd.demo.common.model.models.Cars; +import com.crd.demo.common.service.CarsService; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + + +/** + * HeatMap data test case + * + * @author YuCheng + */ +@TestInstance(TestInstance.Lifecycle.PER_CLASS) + +public class DataTest { + private final static Logger logger = LoggerFactory.getLogger(DataTest.class); + + private CarsService carsService; + + private static List loopList = new ArrayList(); + + + + + @BeforeAll + public void setUp() throws IOException { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + + } + + @Test + public void testTestConnection() { + + logger.debug(">>>"); + Cars cars = new Cars(); + cars.setId(1L); + carsService.saveCars(cars); + +// Cars cars = new Cars(); +// cars.setId(1L); +// carsRepository.save(cars); + } + + +} + diff --git a/common/src/test/resources/data/azure_storage.json b/common/src/test/resources/data/azure_storage.json new file mode 100644 index 0000000..eb20d14 --- /dev/null +++ b/common/src/test/resources/data/azure_storage.json @@ -0,0 +1,15 @@ +{ + "id": 16, + "uuid": "35057495-bec8-4288-beec-568c552c88e4", + "dateModified": "2020-10-29T11:56:06.630+00:00", + "userId": "24548d05-5274-4ea0-82aa-f1693cb82045", + "userName": "Hu, Yucheng", + "userEmail": "Yucheng.Hu@insight.com", + "customerName": "license (1).txt", + "inputFileName": "license (1).txt", + "fileRowCount": null, + "fileMatchCount": null, + "fileStatus": null, + "fileSHA3": "069f7222e83cecec5663c47b0e2736709c425448b47962d1827ca958", + "createDate": "2020-10-29T11:56:06.630+00:00" +} \ No newline at end of file