-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bilbauta
authored and
bilbauta
committed
Jan 18, 2016
0 parents
commit 8a52d43
Showing
57 changed files
with
48,384 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
target/** | ||
.settings | ||
.classpath | ||
.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" 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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<!-- encodage du projet --> | ||
<!-- <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> --> | ||
|
||
<!-- Description du Projet --> | ||
<groupId>com.nemeros.web</groupId> | ||
<artifactId>SupervisionAngular</artifactId> | ||
<version>1.0.0</version> | ||
<name>SupervisionAngular</name> | ||
<packaging>war</packaging> | ||
<!--<packaging>war</packaging>--> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<java.version>1.7</java.version> | ||
</properties> | ||
|
||
|
||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<!-- | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.2.5.RELEASE</version> | ||
</parent> | ||
--> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>1.3.0.RELEASE</version> | ||
</parent> | ||
|
||
|
||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-logging</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-log4j</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-jdbc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.oracle</groupId> | ||
<artifactId>ojdbc6</artifactId> | ||
<version>11.2.0.2.0</version> | ||
</dependency> | ||
<!-- | ||
<dependency> | ||
<groupId>org.springframework.data</groupId> | ||
<artifactId>spring-data-jdbc-core</artifactId> | ||
<version>1.1.0.RELEASE</version> | ||
</dependency>--> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.conf; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@EnableAutoConfiguration | ||
@Configuration | ||
@ComponentScan(basePackages="com") | ||
public class Application { | ||
|
||
public static void main(String[] args){ | ||
SpringApplication.run(Application.class, args); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/com/nemeros/api/rest/MediationController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.nemeros.api.rest; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
import javax.annotation.security.RolesAllowed; | ||
|
||
import org.apache.log4j.Logger; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.format.annotation.DateTimeFormat; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.nemeros.bean.MedBean; | ||
import com.nemeros.dao.SupervisionDao; | ||
|
||
@RestController | ||
@RequestMapping("/api/mediation") | ||
public class MediationController { | ||
|
||
private final static Logger log = Logger.getLogger(MediationController.class); | ||
|
||
@Autowired | ||
SupervisionDao supDao; | ||
|
||
|
||
@RequestMapping(method=RequestMethod.GET, produces="application/json") | ||
public List<MedBean> getDetail( | ||
@RequestParam(value="dateMin", required=false) @DateTimeFormat(pattern="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") Date dateMin) | ||
throws Exception{ | ||
log.info("DateMin : " + dateMin); | ||
List<MedBean> retour = null; | ||
|
||
retour = supDao.getListMediation(dateMin); | ||
|
||
return retour; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package com.nemeros.bean; | ||
|
||
public class MedBean { | ||
private int id; | ||
private String fluxDesc; | ||
private String medName; | ||
private int cnt_ok; | ||
private int cnt_enc; | ||
private int cnt_ko; | ||
private int cnt; | ||
|
||
public MedBean(){ | ||
|
||
} | ||
|
||
public MedBean(int id, String fluxDesc, String medName, int cnt_ok, int cnt_enc, int cnt_ko, int cnt) { | ||
super(); | ||
this.id = id; | ||
this.fluxDesc = fluxDesc; | ||
this.medName = medName; | ||
this.cnt_ok = cnt_ok; | ||
this.cnt_enc = cnt_enc; | ||
this.cnt_ko = cnt_ko; | ||
this.cnt = cnt; | ||
} | ||
|
||
public String getMedName() { | ||
return medName; | ||
} | ||
public void setMedName(String medName) { | ||
this.medName = medName; | ||
} | ||
public int getCnt_ok() { | ||
return cnt_ok; | ||
} | ||
public void setCnt_ok(int cnt_ok) { | ||
this.cnt_ok = cnt_ok; | ||
} | ||
public int getCnt_enc() { | ||
return cnt_enc; | ||
} | ||
public void setCnt_enc(int cnt_enc) { | ||
this.cnt_enc = cnt_enc; | ||
} | ||
public int getCnt_ko() { | ||
return cnt_ko; | ||
} | ||
public void setCnt_ko(int cnt_ko) { | ||
this.cnt_ko = cnt_ko; | ||
} | ||
public int getCnt() { | ||
return cnt; | ||
} | ||
public void setCnt(int cnt) { | ||
this.cnt = cnt; | ||
} | ||
|
||
public String getFluxDesc() { | ||
return fluxDesc; | ||
} | ||
|
||
public void setFluxDesc(String fluxDesc) { | ||
this.fluxDesc = fluxDesc; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.nemeros.dao; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
import javax.sql.DataSource; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
import org.springframework.jdbc.core.RowMapper; | ||
import org.springframework.stereotype.Component; | ||
|
||
import com.nemeros.bean.MedBean; | ||
|
||
@Component | ||
public class SupervisionDao { | ||
|
||
private JdbcTemplate template; | ||
|
||
@Autowired | ||
private void setTemplate(final DataSource datasource){ | ||
template = new JdbcTemplate(datasource); | ||
} | ||
|
||
|
||
public List<MedBean> getListMediation(Date dateMin){ | ||
StringBuilder query = new StringBuilder(300); | ||
|
||
query.append("with tmp as ( "); | ||
query.append("select MEDIDMED, styidsty, stt_ts_cre, row_number() over(partition by stt.msgidmsg order by stt_ts_cre desc) as rnk "); | ||
query.append("from T_WBI_EVT evt "); | ||
query.append("inner join T_MESSAGE msg on MSG.WBIIDWBI = EVT.WBIIDWBI "); | ||
query.append("inner join T_STATUT_MSG stt on MSG.MSGIDMSG = STT.MSGIDMSG "); | ||
query.append(" where (wbidte_entry > ? or ? is null) "); | ||
query.append(") "); | ||
query.append("select med.medidmed as id, flu_desc, med_name, "); | ||
query.append("sum(case when styidsty = 'EXI' then 1 else 0 end) as cnt_ok, "); | ||
query.append("sum(case when styidsty = 'ENT' then 1 else 0 end) as cnt_enc, "); | ||
query.append("sum(case when styidsty = 'FAI' then 1 else 0 end) as cnt_ko, "); | ||
query.append("count(*) as cnt "); | ||
query.append("from T_MEDIATION MED "); | ||
query.append("inner join T_FLUX_FCT fct on FCT.FLUIDFLU = MED.FLUIDFLU "); | ||
query.append("left outer join tmp on tmp.medidmed = med.medidmed and tmp.rnk = 1 "); | ||
query.append("group by med.medidmed, flu_desc, med_name "); | ||
query.append("order by 2, 3 "); | ||
|
||
List<MedBean> retour = this.template.query(query.toString(),new Object[]{dateMin, dateMin}, | ||
new RowMapper<MedBean>(){ | ||
|
||
@Override | ||
public MedBean mapRow(ResultSet rs, int arg1) throws SQLException { | ||
|
||
return new MedBean( | ||
rs.getInt("id"), | ||
rs.getString("flu_desc"), | ||
rs.getString("MED_NAME"), | ||
rs.getInt("cnt_ok"), | ||
rs.getInt("cnt_enc"), | ||
rs.getInt("cnt_ko"), | ||
rs.getInt("cnt")); | ||
} | ||
|
||
}); | ||
|
||
return retour; | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/nemeros/navigation/NavigationController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.nemeros.navigation; | ||
|
||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
@Controller | ||
public class NavigationController { | ||
|
||
//@RequestMapping(path={"/", "/index"}) | ||
public String getHome(){ | ||
return "index.html"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
server.port = 9090 | ||
|
||
spring.datasource.url=jdbc:oracle:thin:@//H_BPM_REC:1521/ROBPMB4_CLI | ||
spring.datasource.username=SUPERVISION_DEF | ||
spring.datasource.password=supdef | ||
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | ||
<log4j:configuration debug="true" xmlns:log4j='http://jakarta.apache.org/log4j/'> | ||
|
||
<appender name="console" class="org.apache.log4j.ConsoleAppender"> | ||
<layout class="org.apache.log4j.PatternLayout"> | ||
<param name="ConversionPattern" | ||
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" /> | ||
</layout> | ||
</appender> | ||
|
||
|
||
|
||
<root> | ||
<level value="info" /> | ||
<appender-ref ref="console" /> | ||
</root> | ||
|
||
</log4j:configuration> |
Oops, something went wrong.