Commit 5dc5cf7c by xioa

月流量报表

parent cdd316b0
......@@ -19,6 +19,7 @@ public class TkioFlow {
private String contractCode;
private Long flow;
private Long costFlow;
private Integer contractCount;
public String getDs() {
return ds;
......@@ -67,4 +68,12 @@ public class TkioFlow {
public void setId(Long id) {
this.id = id;
}
public Integer getContractCount() {
return contractCount;
}
public void setContractCount(Integer contractCount) {
this.contractCount = contractCount;
}
}
......@@ -18,6 +18,24 @@ public class TkioFlowHistory {
private String contractCode;
private Long flow;
private Long costFlow;
private String yMonth;
private String yMonthNext;
private String nextCode;
public TkioFlowHistory() {
}
public TkioFlowHistory(TkioFlow flow) {
this.ds = flow.getDs();
this.email = flow.getEmail();
this.contractCode = flow.getContractCode();
this.flow = flow.getFlow();
this.costFlow = flow.getCostFlow();
}
public String getDs() {
return ds;
......@@ -66,4 +84,28 @@ public class TkioFlowHistory {
public void setId(Long id) {
this.id = id;
}
public String getyMonth() {
return yMonth;
}
public void setyMonth(String yMonth) {
this.yMonth = yMonth;
}
public String getyMonthNext() {
return yMonthNext;
}
public void setyMonthNext(String yMonthNext) {
this.yMonthNext = yMonthNext;
}
public String getNextCode() {
return nextCode;
}
public void setNextCode(String nextCode) {
this.nextCode = nextCode;
}
}
......@@ -10,8 +10,16 @@ import java.math.BigDecimal;
public interface TkioFlowHistoryRepository extends JpaRepository<TkioFlowHistory, Long> {
@Query(value = "select contract_code from tkio_flow_history where email = ?1 order by ds limit 1", nativeQuery = true)
String findLastRecodeContract(String email);
@Query(value = "select sum(flow) from tkio_flow_history where email = ?1 and contract_code = ?2", nativeQuery = true)
BigDecimal sumAllFowByEmailAndCode(String email, String contractCode);
@Transactional
@Modifying
@Query(value = " insert into tkio_flow_history select * from tkio_flow where email = ?1 and cost_flow > 0 ", nativeQuery = true)
BigDecimal backDatasByEmail(String email);
@Query(value = "delete from tkio_flow where email = ?1", nativeQuery = true)
void deleteByEmail(String email);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment