新增绩效统计
This commit is contained in:
+3
-3
@@ -6,12 +6,12 @@ import com.fangjia.script.statistics.TaskDetail
|
|||||||
import org.apache.commons.collections.CollectionUtils
|
import org.apache.commons.collections.CollectionUtils
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 绩效相关信息导出
|
* 项目导出
|
||||||
*
|
*
|
||||||
* @author shenjian
|
* @author shenjian
|
||||||
* @since 2021/5/8
|
* @since 2021/5/8
|
||||||
*/
|
*/
|
||||||
class Export {
|
class ProjectExport {
|
||||||
|
|
||||||
static final String time = "2021年4月1日-2021年4月30日";
|
static final String time = "2021年4月1日-2021年4月30日";
|
||||||
static final String startTime = "2021-04-01"
|
static final String startTime = "2021-04-01"
|
||||||
@@ -64,7 +64,7 @@ class Export {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\绩效\\统计.xlsx", sortedResult, "项目统计");
|
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\绩效\\项目统计.xlsx", sortedResult, "项目统计");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+113
@@ -0,0 +1,113 @@
|
|||||||
|
import com.fangjia.script.statistics.ApiUtil
|
||||||
|
import com.fangjia.script.statistics.Project
|
||||||
|
import com.fangjia.script.statistics.ProjectLabel
|
||||||
|
import com.fangjia.script.statistics.Task
|
||||||
|
import com.fangjia.script.statistics.TaskDetail
|
||||||
|
import org.apache.commons.collections.CollectionUtils
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绩效导出
|
||||||
|
*
|
||||||
|
* @author shenjian
|
||||||
|
* @since 2021/5/10
|
||||||
|
*/
|
||||||
|
class ScoreExport {
|
||||||
|
|
||||||
|
static final String time = "2021年4月1日-2021年4月30日";
|
||||||
|
static final String startTime = "2021-04-01"
|
||||||
|
static final String endTime = "2021-04-30"
|
||||||
|
|
||||||
|
static void main(String[] args) {
|
||||||
|
def sortedResult = []
|
||||||
|
sortedResult << ['项目类别', '工时', '所属项目', '项目经理']
|
||||||
|
def sort = ["建行项目", "基础建设", "非农行项目", "农行项目"];
|
||||||
|
def result = []
|
||||||
|
List<Project> projects = ApiUtil.listProject();
|
||||||
|
for (Project project : projects) {
|
||||||
|
def ret = []
|
||||||
|
List<ProjectLabel> labels = ApiUtil.listProjectLabel(project.getId())
|
||||||
|
ret[2] = project.getName()
|
||||||
|
for (ProjectLabel label : labels) {
|
||||||
|
if ("商务负责人" == label.getGroups().getName()) {
|
||||||
|
if (ret[3] == null) {
|
||||||
|
ret[3] = label.getName()
|
||||||
|
} else {
|
||||||
|
ret[3] = ret[3] + "、" + label.getName()
|
||||||
|
}
|
||||||
|
} else if ("项目类别" == label.getGroups().getName()) {
|
||||||
|
ret[0] = label.getName()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 获取项目下任务
|
||||||
|
List<Task> tasks = ApiUtil.listTaskByProject(project.getId(), startTime, endTime)
|
||||||
|
Double totalTime = 0D;
|
||||||
|
if (CollectionUtils.isNotEmpty(tasks)) {
|
||||||
|
for (Task task: tasks) {
|
||||||
|
TaskDetail taskDetail = ApiUtil.getTaskDetail(task.getId())
|
||||||
|
boolean find = false
|
||||||
|
for (int i = 4; i < sortedResult[0].size(); i++) {
|
||||||
|
// 找到该项目下该负责人,则加工时
|
||||||
|
if (sortedResult[0][i] == taskDetail.getResponse().getName()) {
|
||||||
|
if (ret[i] == null) {
|
||||||
|
ret[i] = Double.valueOf(taskDetail.getFlowConten())
|
||||||
|
} else {
|
||||||
|
ret[i] += Double.valueOf(taskDetail.getFlowConten())
|
||||||
|
}
|
||||||
|
find = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 未找到,新增姓名
|
||||||
|
if (!find) {
|
||||||
|
sortedResult[0][sortedResult[0].size()] = taskDetail.getResponse().getName()
|
||||||
|
ret[ret.size()] = Double.valueOf(taskDetail.getFlowConten())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result << ret
|
||||||
|
}
|
||||||
|
def allTotal = []
|
||||||
|
for (def label : sort) {
|
||||||
|
def total = []
|
||||||
|
for (def ret : result) {
|
||||||
|
if (ret[0] == label) {
|
||||||
|
sortedResult << ret
|
||||||
|
for (int i = 4; i < ret.size(); i++) {
|
||||||
|
if (total[i] == null) {
|
||||||
|
total[i] = ret[i] == null ? 0 : Double.valueOf(ret[i])
|
||||||
|
} else {
|
||||||
|
total[i] += (ret[i] == null ? 0 : Double.valueOf(ret[i]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
total[1] = 0
|
||||||
|
total[2] = "小计"
|
||||||
|
sortedResult << total
|
||||||
|
for (int i = 4; i < total.size(); i++) {
|
||||||
|
if (allTotal[i] == null) {
|
||||||
|
allTotal[i] = total[i] == null ? 0 : Double.valueOf(total[i])
|
||||||
|
} else {
|
||||||
|
allTotal[i] += total[i] == null ? 0 : Double.valueOf(total[i])
|
||||||
|
}
|
||||||
|
total[1] += total[i] == null ? 0 : Double.valueOf(total[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
allTotal[2] = "人员绩效总计"
|
||||||
|
sortedResult << allTotal
|
||||||
|
|
||||||
|
com.fangjia.script.util.ExcelUtils.write("F:\\数据\\绩效\\绩效统计.xlsx", sortedResult, "绩效统计");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user