Skip to content

Commit

Permalink
rename sth
Browse files Browse the repository at this point in the history
  • Loading branch information
hubin6 committed Oct 30, 2017
1 parent 19b22f1 commit abbc255
Show file tree
Hide file tree
Showing 49 changed files with 272 additions and 123 deletions.
7 changes: 4 additions & 3 deletions hydra-center-commons/pom.xml → dashboard-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hydra-center</artifactId>
<groupId>com.fresh.hydra</groupId>
<groupId>com.jd.logistics.cloud.data</groupId>
<artifactId>dashboard-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>hydra-center-commons</artifactId>
<artifactId>dashboard-commons</artifactId>
<name>dashboard-commons</name>


</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fresh.commons.data.page;
package com.jd.logistics.cloud.data.commons.page;

import java.io.Serializable;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fresh.commons.data.page;
package com.jd.logistics.cloud.data.commons.page;

import java.io.Serializable;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fresh.commons.data.validation;
package com.jd.logistics.cloud.data.commons.validation;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<groupId>com.fresh.hydra</groupId>
<artifactId>hydra-center</artifactId>
<groupId>com.jd.logistics.cloud.data</groupId>
<artifactId>dashboard-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<packaging>jar</packaging>

<groupId>com.fresh.hydra</groupId>
<artifactId>hydra-center-domain-service</artifactId>
<version>1.0-SNAPSHOT</version>
<name>hydra-center-domain-service</name>
<artifactId>dashboard-domain-service</artifactId>
<name>dashboard-domain-service</name>

<properties>
<java.version>1.8</java.version>
Expand Down Expand Up @@ -109,8 +107,8 @@
</dependency>

<dependency>
<groupId>com.fresh.hydra</groupId>
<artifactId>hydra-center-commons</artifactId>
<groupId>com.jd.logistics.cloud.data</groupId>
<artifactId>dashboard-commons</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.jd.logistics.cloud.data.domain;

import lombok.Data;

import java.io.Serializable;

/**
* @Author hubin
* @Description:
* @Date 2017/10/30 14:00
*/
@Data
public class BoxRes implements Serializable{
private static final long serialVersionUID = -4464992698082552989L;
private String funcName;
private String funcValue;
private String f1Name;
private double f1Value;
private String f2Name;
private double f2Value;

public BoxRes(String funcName, String funcValue, String f1Name, double f1Value, String f2Name, double f2Value) {
this.funcName = funcName;
this.funcValue = funcValue;
this.f1Name = f1Name;
this.f1Value = f1Value;
this.f2Name = f2Name;
this.f2Value = f2Value;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package com.jd.logistics.cloud.data.domain;

import java.io.Serializable;
import java.util.List;

/**
* @Author hubin
* @Description:
* @Date 2017/10/30 14:01
*/
public class ChartRes implements Serializable{
private static final long serialVersionUID = 2435137108243857196L;
private String funcName;
private String funcValue;
private String f1Name;
private double f1Value;
private String f2Name;
private double f2Value;
private List<String> periods;
private String c1Name;
private List<Double> c1Value;
private String c2Name;
private List<Double> c2Value;

public String getFuncName() {
return funcName;
}

public String getFuncValue() {
return funcValue;
}

public String getF1Name() {
return f1Name;
}

public double getF1Value() {
return f1Value;
}

public String getF2Name() {
return f2Name;
}

public double getF2Value() {
return f2Value;
}

public List<String> getPeriods() {
return periods;
}

public void setPeriods(List<String> periods) {
this.periods = periods;
}

public void setC1Value(List<Double> c1Value) {
this.c1Value = c1Value;
}

public void setC2Value(List<Double> c2Value) {
this.c2Value = c2Value;
}



public List<Double> getC1Value() {
return c1Value;
}



public List<Double> getC2Value() {
return c2Value;
}

public String getC1Name() {
return c1Name;
}

public String getC2Name() {
return c2Name;
}

public ChartRes(String funcName, String funcValue, String f1Name, double f1Value, String f2Name, double f2Value, String c1Name, String c2Name) {
this.funcName = funcName;
this.funcValue = funcValue;
this.f1Name = f1Name;
this.f1Value = f1Value;
this.f2Name = f2Name;
this.f2Value = f2Value;
this.c1Name = c1Name;
this.c2Name = c2Name;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fresh.hydra.center.biz.user.domain;
package com.jd.logistics.cloud.data.domain;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fresh.hydra.center.biz.user.domain;
package com.jd.logistics.cloud.data.domain;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fresh.hydra.center.biz.user.domain;
package com.jd.logistics.cloud.data.domain;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.fresh.hydra.center.biz.user.domain;
package com.jd.logistics.cloud.data.domain;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
Expand All @@ -13,10 +13,16 @@
public class User implements Serializable{
private static final long serialVersionUID = 3619539590826838447L;
@ApiModelProperty(value = "", required = true)
private long id;
@ApiModelProperty(value = "", required = true)
private String username;
@ApiModelProperty(value = "", required = true)
private String password;

public long getId() {
return id;
}

public String getUsername() {
return username;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fresh.hydra.center.biz.user.repository;
package com.jd.logistics.cloud.data.repository;

import com.fresh.hydra.center.biz.user.domain.User;
import com.jd.logistics.cloud.data.domain.User;
import org.apache.ibatis.annotations.*;

/**
Expand All @@ -16,12 +16,9 @@ public interface UserRepository {
@Select("SELECT * FROM T_USER WHERE id = #{id}")
User getById(@Param("id") Long id);



@Select("SELECT * FROM T_USER WHERE name = #{name}")
User getByName(@Param("name") String name);


@Update("UPDATE T_USER SET name=#{user.name}, age=#{user.age}, addr=#{user.addr} WHERE id=#{user.id}")
void update(@Param("user") User user);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fresh.hydra.center.biz.user.service;
package com.jd.logistics.cloud.data.service;

import com.fresh.hydra.center.biz.user.domain.Stat;
import com.jd.logistics.cloud.data.domain.Stat;

import java.text.SimpleDateFormat;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.fresh.hydra.center.biz.user.service;
package com.jd.logistics.cloud.data.service;

import com.fresh.commons.data.page.Page;
import com.fresh.commons.data.page.PageRequest;
import com.fresh.hydra.center.biz.user.domain.*;
import com.jd.logistics.cloud.data.commons.page.Page;
import com.jd.logistics.cloud.data.commons.page.PageRequest;
import com.jd.logistics.cloud.data.domain.*;

import java.util.List;

Expand All @@ -25,4 +25,10 @@ public interface StatService {
List<Double> getColumn(String c1);

List<List<Double>> getColumns();

User getUser(long id);

List<BoxRes> getBoxes();

List<ChartRes> getCharts();
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.fresh.hydra.center.biz.user.service;
package com.jd.logistics.cloud.data.service;


import com.fresh.commons.data.page.Page;
import com.fresh.commons.data.page.PageRequest;
import com.fresh.hydra.center.biz.user.domain.*;

import com.jd.logistics.cloud.data.commons.page.Page;
import com.jd.logistics.cloud.data.commons.page.PageRequest;
import com.jd.logistics.cloud.data.domain.*;
import com.jd.logistics.cloud.data.repository.UserRepository;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.lang.reflect.Field;
Expand All @@ -17,6 +20,8 @@
*/
@Service
public class StatServiceImpl implements StatService {
@Autowired
UserRepository userRepository;
@Override
public Page<Stat> findStats(StatQuery query, PageRequest pageRequest) {
List<Stat> statList = GenStatService.getStatList(pageRequest.getPageSize(), (int) pageRequest.getOffset());
Expand Down Expand Up @@ -110,11 +115,40 @@ public List<List<Double>> getColumns() {
return tmp;
}

@Override
public User getUser(long id) {
return userRepository.getById(id);
}

@Override
public List<BoxRes> getBoxes() {
List<BoxRes> tmp = new ArrayList<>();
BoxRes b1 = new BoxRes("接收订单量", "519,245", "日环比", 3.2, "周环比", 7.1);
BoxRes b2 = new BoxRes("SKU准确率", "58.21%", "日环比", 1.9, "周环比", -1.2);
BoxRes b3 = new BoxRes("调拨入库单数", "2,245", "日环比", 0.0, "周环比", 10.1);
tmp.add(b1);tmp.add(b2);tmp.add(b3);
return tmp;
}

@Override
public List<ChartRes> getCharts() {
List<ChartRes> tmp = new ArrayList<>();
ChartRes b1 = new ChartRes("人效-DO", "5234", "日环比", 8.2, "周环比", 17.1, "2017/10/11", "2017/11/11");
b1.setPeriods(getPeriods());
b1.setC1Value(getColumn("1"));
b1.setC2Value(getColumn("2"));
ChartRes b2 = new ChartRes("出库单数", "4,245", "日环比", 6.2, "周环比", -1.1,"2017/10/11","2017/11/11");
b2.setPeriods(getPeriods());
b2.setC1Value(getColumn("3"));
b2.setC2Value(getColumn("4"));
tmp.add(b1);tmp.add(b2);
return tmp;
}

public static void main(String[] args) {
StatServiceImpl ss = new StatServiceImpl();
System.out.println(ss.getPeriods());
System.out.println(ss.getColumn("c1"));
System.out.println(ss.getColumns());
System.out.println(ss.getCharts().get(0));
//System.out.println(GenStatService.statList);
}
}
10 changes: 10 additions & 0 deletions dashboard-domain-service/src/main/resources/schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE TABLE IF NOT EXISTS T_USER(
ID INT NOT NULL AUTO_INCREMENT,
USERNAME VARCHAR(100) NOT NULL,
PASSWORD VARCHAR(100) NOT NULL,
PRIMARY KEY ( ID )
);


INSERT INTO T_USER (USERNAME, PASSWORD) VALUES ('Jack', 'AAAAAAAA');
INSERT INTO T_USER (USERNAME, PASSWORD) VALUES ('Jones', 'BBBBBBBB');
File renamed without changes.
Loading

0 comments on commit abbc255

Please sign in to comment.