📄 deptmonthpoint.java
字号:
package com.selectpoint;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.login.DatabaseConn;
public class DeptMonthPoint {
public String deptNames[] = { "办公室", "党群工作部", "人事部", "市场经营部", "安全监察部",
"生产技术部", "科研开发部", "基建调试部", "综合部", "园区建管部", "电气所", "计量所", "自动化所",
"系统分析所", "热能动力所", "水能动力所", "化学环保所", "金属所" };
public String assesPersons1[] = { "办公室", "党群工作部", "人事部", "市场经营部", "安全监察部",
"生产技术部", "科研开发部", "基建调试部", "综合部", "园区建管部", "电气所", "计量所", "自动化所",
"系统分析所", "热能动力所", "水能动力所", "化学环保所", "金属所", "吴毅", "王良钢", "曹昆南",
"洪波", "申建华", "文华", "郭庆荣", "倪绍萍"};
public String assesPersons[] = { "1", "2", "3", "4", "5", "6", "7", "8",
"9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
"20", "21", "22", "23", "24", "25", "26" };
/**
*
public String assesPersons[] = { "办公室", "党群工作部", "人事部", "市场经营部", "安全监察部",
"生产技术部", "科研开发部", "基建调试部", "综合部", "园区建管部", "电气所", "计量所", "自动化所",
"系统分析所", "热能动力所", "水能动力所", "化学环保所", "金属所", "吴毅", "王良钢", "曹昆南",
"洪波", "申建华", "文华", "郭庆荣", "倪绍萍"};
*/
/* public String assesPersons[] = {"杨昆", "赵永强", "倪绍萍", "周年荣", "贺祥飞", "李贻博",
"杨晴", "赵明", "孙曙光", "满河清", "李明", "赵涓", "卢勇", "钱迎春", "严正波", "董鸿魁", "李仕林",
"吴章勤", "吴毅", "王良钢", "曹昆南", "洪波", "申建华", "文华", "郭庆荣","人事部"};*/
public DeptMonthPoint() {
}
public Collection getDeptMonthPoints(String year, String month)
throws Exception {
Collection ret = new ArrayList();
SelectPointDBOperation dbo = new SelectPointDBOperation();// DB
// OPERATION
List monthPoints = (List) dbo.getDeptMonthPoint(year, month);// 获得全月分数
if (monthPoints != null && monthPoints.size() > 0) {
for (int d = 0; d < deptNames.length; d++) {
DeptPointBean deptMonthPoints[] = new DeptPointBean[assesPersons.length];// point
// row
for (int a = 0; a < assesPersons.length; a++) {
for (int p = 0; p < monthPoints.size(); p++) {
DeptPointBean deptMonthPoint = (DeptPointBean) monthPoints
.get(p); // point cell
if (deptMonthPoint.dept_name.equals(deptNames[d])
&& deptMonthPoint.asses_person
.equals(assesPersons[a])) {
deptMonthPoints[a] = deptMonthPoint;
break;
} else {
deptMonthPoints[a] = null;
}
}// p
}// a
ret.add(deptMonthPoints);
}// d
return ret;
} else {
return null;
}
}
public String getAssesPoints(DeptPointBean deptMonthPoints[]) {
try {
int assespoint = 0;
double totalpiont = 0;
int size = 0;
if (deptMonthPoints != null) {
for (int d = 0; d < deptMonthPoints.length; d++) {
DeptPointBean deptMonthPoint = deptMonthPoints[d];
if (deptMonthPoint != null) {
if (!(deptMonthPoint.asses_point == null || ""
.equals(deptMonthPoint.asses_point))) {
totalpiont = totalpiont
+ Double
.parseDouble(deptMonthPoint.asses_point);
size = size + 1;
}
}
}
if (totalpiont == 0) {
return "0";
} else {
NumberFormat formatter = NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
return String.valueOf(formatter.format(totalpiont / size));
}
} else {
return "0";
}
} catch (Exception e) {
return "0";
}
}
public String getSsPoints(DeptPointBean deptMonthPoints[]) {
try {
int assespoint = 0;
double totalpiont = 0;
int size = 0;
if (deptMonthPoints != null) {
for (int d = 0; d < deptMonthPoints.length; d++) {
DeptPointBean deptMonthPoint = deptMonthPoints[d];
if (deptMonthPoint != null) {
if (!(deptMonthPoint.asses_point == null || ""
.equals(deptMonthPoint.ss_point))) {
totalpiont = totalpiont
+ Double
.parseDouble(deptMonthPoint.ss_point);
size = size + 1;
}
}
}
if (totalpiont == 0) {
return "0";
} else {
NumberFormat formatter = NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
return String.valueOf(formatter.format(totalpiont));
}
} else {
return "0";
}
} catch (Exception e) {
return "0";
}
}
public String getPoints(DeptPointBean deptMonthPoints[]) {
NumberFormat formatter = NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
return String.valueOf(formatter.format(Double.parseDouble(this
.getAssesPoints(deptMonthPoints))
+ Double.parseDouble(this.getSsPoints(deptMonthPoints))));
}
public String getPersonAssesPoints(String depts, List deptmonthpoints)throws Exception {
if(deptmonthpoints!=null){
double point=0;
int a=1;
for(int i=0;i<deptNames.length;i++){
if(depts.contains(deptNames[i])){
if(deptmonthpoints.get(i)!=null){
point=point+Double.valueOf(this.getAssesPoints((DeptPointBean[])deptmonthpoints.get(i)));
a=a+1;
}
}
}
NumberFormat formatter = NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
return String.valueOf(formatter.format(point/a));
}else{
return "0";
}
}
public String getPersonSsPoints(String depts, List deptmonthpoints)throws Exception {
if(deptmonthpoints!=null){
double point=0;
int a=1;
for(int i=0;i<deptNames.length;i++){
if(depts.contains(deptNames[i])){
if(deptmonthpoints.get(i)!=null){
point=point+Double.valueOf(this.getSsPoints((DeptPointBean[])deptmonthpoints.get(i)));
a=a+1;
}
}
}
NumberFormat formatter = NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
return String.valueOf(formatter.format(point/a));
}else{
return "0";
}
}
public String getPersonPoints(String depts, List deptmonthpoints)throws Exception {
if(deptmonthpoints!=null){
double point=0;
int a=1;
for(int i=0;i<deptNames.length;i++){
if(depts.contains(deptNames[i])){
if(deptmonthpoints.get(i)!=null){
point=point+Double.valueOf(this.getPoints((DeptPointBean[])deptmonthpoints.get(i)));
a=a+1;
}
}
}
NumberFormat formatter = NumberFormat.getNumberInstance();
formatter.setMinimumFractionDigits(2);
formatter.setMaximumFractionDigits(2);
return String.valueOf(formatter.format(point/a));
}else{
return "0";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -