维护常用信息文档,测试方法测试Builder类

main
youHong.ai 2022-11-27 20:49:32 +08:00
parent b45887564d
commit c02aea81be
6 changed files with 112 additions and 134 deletions

Binary file not shown.

View File

@ -1013,7 +1013,7 @@ public class HttpUtils {
/**
* <h2></h2>
*
* @param url
* @param url
* @param multipartFileList
* @param params
* @param headers
@ -1062,7 +1062,7 @@ public class HttpUtils {
/**
* <h2></h2>
*
* @param url
* @param url
* @param multipartFileList
* @param params
* @param headers

View File

@ -0,0 +1,68 @@
package ebu7common.youhong.ai.bean;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Supplier;
/**
* <h1></h1>
*
* <p>create: 2022-11-26 16:46</p>
*
* @author youHong.ai
*/
public class Builder<T> {
private Supplier<T> constructor;
private List<Consumer<T>> propertiesInjects = new ArrayList<>();
private Builder(Supplier<T> constructor) {
this.constructor = constructor;
}
/**
* <h2></h2>
*
* @param constructor
* @param <T>
* @return
*/
public static <T> Builder<T> builder(Supplier<T> constructor) {
return new Builder<T>(constructor);
}
/**
* <h2></h2>
*
* @param setFun set
* @param value
* @param <V>
* @return
*/
public <V> Builder<T> with(PropertiesInject<T, V> setFun, V value) {
Consumer<T> c = instance -> setFun.accept(instance, value);
propertiesInjects.add(c);
return this;
}
/**
* <h2></h2>
*
* @return
*/
public T build() {
T instance = this.constructor.get();
this.propertiesInjects.forEach(inject -> inject.accept(instance));
return instance;
}
@FunctionalInterface
public interface PropertiesInject<T, V> {
void accept(T setFun, V value);
}
}

View File

@ -1,128 +0,0 @@
package ebu7common.youhong.ai.csv.entity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <h1>csv</h1>
*
* <p>create: 2022-11-23 17:19</p>
*
* @author youHong.ai
*/
@Setter
@Getter
@ToString
public class CsvTable {
private List<CsvRow> csvRows = new ArrayList<>();
private CsvTableHeard csvTableHeard;
private int rowSize = 0;
public void setCsvTableHeard(CsvTableHeard csvTableHeard) {
this.csvTableHeard = csvTableHeard;
this.rowSize++;
}
public void addRow(CsvRow csvRow) {
csvRows.add(csvRow);
rowSize++;
}
/**
* <h1>csv</h1>
*
* <p>create: 2022-11-23 17:21</p>
*
* @author youHong.ai
*/
@Setter
@Getter
@ToString
static class CsvColumn {
}
/**
* <h1>csv</h1>
*
* <p>create: 2022-11-23 17:21</p>
*
* @author youHong.ai
*/
@Setter
@Getter
@ToString
static class CsvRow {
private List<CsvColumn> csvColumns = new ArrayList<>();
private int rowSize = 0;
public void add(CsvColumn csvColumn) {
csvColumns.add(csvColumn);
rowSize++;
}
}
/**
* <h1>csv</h1>
*
* <p>create: 2022-11-23 17:21</p>
*
* @author youHong.ai
*/
@ToString
static class CsvTableHeard {
private List<String> heard;
private Map<String, Integer> mapping;
private int heardSize = 0;
public void addHeard(String value) {
if (heard == null) {
this.heard = new ArrayList<>();
this.mapping = new HashMap<>();
}
mapping.put(value, heardSize++);
heard.add(value);
}
public int getHeardRow(String value) {
if (mapping != null) {
return mapping.get(value);
}
return -1;
}
public String getHeard(int columnIndex) {
if (heard != null) {
return this.heard.get(columnIndex);
}
return null;
}
}
}

View File

@ -2,6 +2,7 @@ package youhong.ai.pcn;
import basetest.BaseTest;
import com.alibaba.fastjson.JSON;
import ebu7common.youhong.ai.bean.Builder;
import ebu7common.youhong.ai.sftp.SftpConnectUtil;
import org.junit.Test;
import weaver.general.GCONST;
@ -65,6 +66,15 @@ public class TestOrganization extends BaseTest {
}
@Test
public void testBuilder() {
Position build = Builder.builder(Position::new)
.with(Position::setCompany_Code, "asdf")
.with(Position::setJOBCODE, "hahsdf")
.build();
System.out.println(build);
}
@Test
public void testReadCsv() {

View File

@ -11,14 +11,20 @@
### 前端
**获取用户信息**
**1.获取用户信息**
> 维护人员youhong.ai
```javascript
const userInfo = JSON.parse(localStorage.getItem("theme-account"))
```
**获取url参数**
**2.ecode访问上传的resource静态文件**
```javascript
let src = "/cloudstore/release/${appId}/resources/"
```
**3.获取url参数**
> 维护人员: youHong.ai
```javascript
@ -37,7 +43,7 @@ getQueryString = (name) => {
```
**ajax请求**
**4.ajax请求**
> 维护人员: youHong.ai
```javascript
@ -68,7 +74,7 @@ getQueryString = (name) => {
}
```
**通过js获取react组件操作组件内部数据**
**5.通过js获取react组件操作组件内部数据**
```javascript
function FindReact(dom, traverseUp = 0) {
@ -109,6 +115,28 @@ const myComp = FindReact(someElement);
myComp.setState({test1: test2});
```
**6.ecode集成iconfont**
```css
/*修改url字体文件上传到cloudstore/iconfont/xx/下,没有目录自己创建*/
/*修改font-family,命名为其他名称防止与系统自带的或与其他iconfont冲突*/
@font-face {
font-family: "cus_iconfont"; /* Project id 3789451 */
src: url('/cloudstore/iconfont/pcn/iconfont.woff2?t=1669223019749') format('woff2'),
url('/cloudstore/iconfont/pcn/iconfont.woff?t=1669223019749') format('woff'),
url('/cloudstore/iconfont/pcn/iconfont.ttf?t=1669223019749') format('truetype');
}
/*修改iconfont类名为font-family的名称*/
.cus_iconfont {
font-family: "cus_iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
```
### 数据库
**备份mysql数据库**