added euCanSHare wp

This commit is contained in:
2020-06-17 15:08:58 +02:00
parent bb558531df
commit ac49e03199
69 changed files with 1742 additions and 140 deletions

View File

@ -10,13 +10,17 @@ public class DailySummaryBean {
private final String moduleName;
private final String jobName;
private final String duration;
private final String wp;
private final Double durationHours;
public DailySummaryBean(String projectName, String moduleName, String jobName, String duration) {
public DailySummaryBean(String projectName, String moduleName, String jobName, String duration, String wp, Double durationHours) {
super();
this.projectName = projectName;
this.moduleName = moduleName;
this.jobName = jobName;
this.duration = duration;
this.wp = wp;
this.durationHours = durationHours;
}
public String getProjectName() {
@ -33,5 +37,19 @@ public class DailySummaryBean {
public String getDuration() {
return duration;
};
}
/**
* @return the wp
*/
public String getWp() {
return wp;
}
/**
* @return the durationHours
*/
public Double getDurationHours() {
return durationHours;
};
}

View File

@ -31,6 +31,7 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
private TProjectRecord project;
private TModuleRecord module;
private TJobRecord activity;
private String wp;
public DoneBean() {
}
@ -43,6 +44,7 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
this.project = projectMap.get(r.getFkProject());
this.module = moduleMap.get(r.getFkModule());
this.activity = jobMap.get(r.getFkJob());
this.wp = r.getWp();
}
/**
@ -119,6 +121,15 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
return ldt;
}
public String getProjectNameWithWP() {
StringBuilder buf = new StringBuilder();
buf.append(project == null ? "" : project.getName());
if (wp != null && !wp.isBlank()) {
buf.append(" (").append(wp).append(")");
}
return buf.toString();
}
public String getProjectName() {
return project == null ? "" : project.getName();
}
@ -196,4 +207,18 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
public void setActivity(TJobRecord activity) {
this.activity = activity;
}
/**
* @return the wp
*/
public String getWp() {
return wp;
}
/**
* @param wp the wp to set
*/
public void setWp(String wp) {
this.wp = wp;
}
}

View File

@ -5,8 +5,8 @@ import static de.jottyfan.timetrack.db.done.Tables.T_JOB;
import static de.jottyfan.timetrack.db.done.Tables.T_MODULE;
import static de.jottyfan.timetrack.db.done.Tables.T_PROJECT;
import static de.jottyfan.timetrack.db.done.Tables.V_HAMSTERSUMMARY;
import static de.jottyfan.timetrack.db.done.Tables.V_TASKLIST;
import static de.jottyfan.timetrack.db.done.Tables.V_TOTALOFDAY;
import static de.jottyfan.timetrack.db.done.Tables.V_WORKTIME;
import static de.jottyfan.timetrack.db.profile.Tables.T_LOGIN;
import java.sql.Date;
@ -23,11 +23,12 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jooq.DSLContext;
import org.jooq.DeleteConditionStep;
import org.jooq.InsertValuesStep6;
import org.jooq.InsertValuesStep7;
import org.jooq.Record;
import org.jooq.Record3;
import org.jooq.Record4;
import org.jooq.Record5;
import org.jooq.Record6;
import org.jooq.SelectConditionStep;
import org.jooq.SelectJoinStep;
import org.jooq.SelectWhereStep;
@ -202,7 +203,7 @@ public class DoneGateway extends JooqGateway {
Integer fkLogin = getFkLogin();
try (DSLContext jooq = getJooq()) {
InsertValuesStep6<TDoneRecord, Timestamp, Timestamp, Integer, Integer, Integer, Integer> sql = jooq
InsertValuesStep7<TDoneRecord, Timestamp, Timestamp, Integer, Integer, Integer, String, Integer> sql = jooq
// @formatter:off
.insertInto(T_DONE,
T_DONE.TIME_FROM,
@ -210,8 +211,9 @@ public class DoneGateway extends JooqGateway {
T_DONE.FK_PROJECT,
T_DONE.FK_MODULE,
T_DONE.FK_JOB,
T_DONE.WP,
T_DONE.FK_LOGIN)
.values(bean.getTimeFrom(), bean.getTimeUntil(), fkProject, fkModule, fkJob, fkLogin);
.values(bean.getTimeFrom(), bean.getTimeUntil(), fkProject, fkModule, fkJob, bean.getWp(), fkLogin);
// @formatter:on
LOGGER.debug(sql.toString());
sql.execute();
@ -235,6 +237,7 @@ public class DoneGateway extends JooqGateway {
.set(T_DONE.FK_PROJECT, bean.getProject() == null ? null : bean.getProject().getPk())
.set(T_DONE.FK_JOB, bean.getActivity() == null ? null : bean.getActivity().getPk())
.set(T_DONE.FK_MODULE, bean.getModule() == null ? null : bean.getModule().getPk())
.set(T_DONE.WP, bean.getWp())
.where(T_DONE.PK.eq(bean.getPk()));
// @formatter:on
LOGGER.debug(sql.toString());
@ -304,24 +307,28 @@ public class DoneGateway extends JooqGateway {
*/
public List<DailySummaryBean> getAllJobs(java.util.Date day) throws DataAccessException, ClassNotFoundException, SQLException {
try (DSLContext jooq = getJooq()) {
SelectConditionStep<Record4<String, String, String, String>> sql = jooq
SelectConditionStep<Record6<String, Double, String, String, String, String>> sql = jooq
// @formatter:off
.select(V_TASKLIST.DURATION,
V_TASKLIST.PROJECT_NAME,
V_TASKLIST.MODULE_NAME,
V_TASKLIST.JOB_NAME)
.from(V_TASKLIST)
.where(V_TASKLIST.DAY.eq(new SimpleDateFormat("yyyy-MM-dd").format(day)))
.and(V_TASKLIST.FK_LOGIN.eq(getFkLogin()));
.select(V_WORKTIME.DURATION,
V_WORKTIME.DURATION_HOURS,
V_WORKTIME.PROJECT_NAME,
V_WORKTIME.MODULE_NAME,
V_WORKTIME.JOB_NAME,
V_WORKTIME.WP)
.from(V_WORKTIME)
.where(V_WORKTIME.DAY.eq(new SimpleDateFormat("yyyy-MM-dd").format(day)))
.and(V_WORKTIME.FK_LOGIN.eq(getFkLogin()));
// @formatter:on
LOGGER.debug(sql.toString());
List<DailySummaryBean> list = new ArrayList<>();
for (Record4<String, String, String, String> r : sql.fetch()) {
String duration = r.get(V_TASKLIST.DURATION);
String projectName = r.get(V_TASKLIST.PROJECT_NAME);
String moduleName = r.get(V_TASKLIST.MODULE_NAME);
String jobName = r.get(V_TASKLIST.JOB_NAME);
list.add(new DailySummaryBean(projectName, moduleName, jobName, duration));
for (Record6<String, Double, String, String, String, String> r : sql.fetch()) {
String duration = r.get(V_WORKTIME.DURATION);
Double durationHours = r.get(V_WORKTIME.DURATION_HOURS);
String projectName = r.get(V_WORKTIME.PROJECT_NAME);
String moduleName = r.get(V_WORKTIME.MODULE_NAME);
String jobName = r.get(V_WORKTIME.JOB_NAME);
String wp = r.get(V_WORKTIME.WP);
list.add(new DailySummaryBean(projectName, moduleName, jobName, duration, wp, durationHours));
}
return list;
}
@ -337,10 +344,11 @@ public class DoneGateway extends JooqGateway {
*/
public String getAllCalendarEvents() throws DataAccessException, ClassNotFoundException, SQLException {
try (DSLContext jooq = getJooq()) {
SelectConditionStep<Record5<Timestamp, Timestamp, String, String, String>> sql = jooq
SelectConditionStep<Record6<Timestamp, Timestamp, String, String, String, String>> sql = jooq
// @formatter:off
.select(T_DONE.TIME_FROM,
T_DONE.TIME_UNTIL,
T_DONE.WP,
T_PROJECT.NAME,
T_MODULE.NAME,
T_JOB.NAME)
@ -356,11 +364,15 @@ public class DoneGateway extends JooqGateway {
String projectName = r.get(T_PROJECT.NAME);
String moduleName = r.get(T_MODULE.NAME);
String jobName = r.get(T_JOB.NAME);
String wp = r.get(T_DONE.WP);
java.util.Date timeFrom = r.get(T_DONE.TIME_FROM);
java.util.Date timeUntil = r.get(T_DONE.TIME_UNTIL);
StringBuilder buf = new StringBuilder();
buf.append(projectName);
if (wp != null && !wp.isBlank()) {
buf.append(" (").append(wp).append(")");
}
buf.append(", ");
buf.append(moduleName);
buf.append(": ");

View File

@ -208,7 +208,11 @@ public class DoneModel implements Model, Serializable {
for (DailySummaryBean sdb : allJobs) {
buf.append(thatday).append("\t");
buf.append(sdb.getDuration()).append("\t");
buf.append(sdb.getProjectName()).append("\t");
buf.append(sdb.getProjectName());
if (sdb.getWp() != null && !sdb.getWp().isBlank()) {
buf.append(" (").append(sdb.getWp()).append(")");
}
buf.append("\t");
buf.append(sdb.getModuleName()).append("\t");
buf.append(sdb.getJobName()).append("\t");
buf.append("\n");