action的代码:
SiInformService siInformService = (SiInformService) getWebApplicationContext()
.getBean("siInformService");
List totalList = siInformService.getTotalByDepAndDate(strDepid, strFirstDayOfMonth, strLastDayOfMonth);
request.setAttribute("totalList", totalList);
request.setAttribute("rootOrgList", depList);
return actionMapping.findForward("total.init");SiInformService接口:
public abstract SiTotalVo getTotalByDepAndDate(String as_depid,String as_start,String as_end);
public abstract List getTotalByDepAndDate(String as_depid[],String as_start,String as_end);public SiTotalVo getTotalByDepAndDate(String asDepid, String asStart, String asEnd)
{
// TODO 自动生成方法体
String strStatus = "";
String strDepname = "";
//单个部门在给定时间段得通知单列表
List list1 = this.siSorInformDeptDao.getRecordsByDepidAndDate(asDepid,
InformSorType.RECIVE_INFORM, asStart, asEnd);
//本单位已经接访的记录列表即状态=4
strStatus = InformSorStatus.SIGNIN_INFORM_ALREADY;
List list2 = this.siSorInformDeptDao.getRecordsByDepidAndDateAndStatus(asDepid, InformSorType.RECIVE_INFORM, asStart, asEnd, strStatus);
//本单位未接访的记录列表即状态<>4
String strWhere = " and (model.sorDept=" + asDepid + " and model.sorType="
+ InformSorType.RECIVE_INFORM + ") and ("
+ " TO_CHAR(model.sendDate,'yyyy/MM/dd')>='" + asStart
+ "' and " + " TO_CHAR(model.sendDate,'yyyy/MM/dd')<='" + asEnd
+ "') and (model.sorStatus<>" + strStatus + ") order by model.id desc ";
List list3 = this.siSorInformDeptDao.getRecordsByAnyWhere(strWhere);
//本单位未按要求接访记录列表(签到状态为4的并且签到时间晚于要求接访时间) or (签到状态为4的且指定接访人未到原因字段不为空的。)
List list4 =this.siSorInformDeptDao.getNotAskRecievedByDepidAndDateAndStatus(asDepid, InformSorType.RECIVE_INFORM, asStart, asEnd, InformSorStatus.SIGNIN_INFORM_ALREADY);
int iSendNums = list1.size(), iRecievedS = list2.size(),
iNotRecievedS = list3.size(), iNotAskRecievedS = list4.size();
double dRecievedPersent = 0d;
double dNotRecievedPersent = 0d;
double dNotAskRecievedPersent = 0d;
if (iSendNums > 0) {
dRecievedPersent = (double) iRecievedS / (double) iSendNums;
dNotRecievedPersent = (double) iNotRecievedS / (double) iSendNums;
dNotAskRecievedPersent = (double) iNotAskRecievedS / (double) iSendNums;
}
SiTotalVo siTotalVo = new SiTotalVo();
siTotalVo.setStrDepid(asDepid);
IOrgManagerService orgService = this.getOrgManagerService();
strDepname = orgService.getOrgById(asDepid).getName();
siTotalVo.setStrDepname(strDepname);
siTotalVo.setIsendnums(iSendNums);
siTotalVo.setIrecievedS(iRecievedS);
siTotalVo.setInotRecievedS(iNotRecievedS);
siTotalVo.setInotAskRecievedS(iNotAskRecievedS);
siTotalVo.setDrecievedPersent(dRecievedPersent);
siTotalVo.setDnotRecievedPersent(dNotRecievedPersent);
siTotalVo.setDnotAskRecievedPersent(dNotAskRecievedPersent);
return siTotalVo;
}
public List getTotalByDepAndDate(String[] asDepid, String asStart, String asEnd)
{
List retList = new ArrayList();
String strDepid = "";
SiTotalVo siTotalVo;
int iDepArrSize = asDepid.length;
int iSendNumsTotal = 0; //通知数量
int iRecievedSTotal = 0; //接访数量
int iNotRecievedSTotal = 0; //未接访数量
int iNotAskRecievedSTotal = 0; //未按要求接访数量
double dRecievedPersentTotal = 0; //接访率
double dNotRecievedPersentTotal = 0; //未接访率
double dNotAskRecievedPersentTotal = 0; //未按要求接访率
try {
if (iDepArrSize < 1) {
logger.debug("部门数组长度为0,返回空值!");
return null;
} else {
for (int i = 0; i < iDepArrSize; i++) {
siTotalVo = new SiTotalVo();
strDepid = asDepid[i];
siTotalVo = getTotalByDepAndDate(strDepid, asStart, asEnd);
//以下计算汇总项目
iSendNumsTotal+=siTotalVo.getIsendnums();
iRecievedSTotal += siTotalVo.getIrecievedS();
iNotRecievedSTotal += siTotalVo.getInotRecievedS();
iNotAskRecievedSTotal += siTotalVo.getInotAskRecievedS();
retList.add(siTotalVo);
}
dRecievedPersentTotal= (double) iRecievedSTotal / (double) iSendNumsTotal;
dNotRecievedPersentTotal= (double) iNotRecievedSTotal / (double) iSendNumsTotal;
dNotAskRecievedPersentTotal = (double) iNotAskRecievedSTotal / (double) iSendNumsTotal;
//构造汇总对象
siTotalVo = new SiTotalVo();
siTotalVo.setStrDepid("0"); //0为全部单位汇总记录
siTotalVo.setStrDepname("总计");
siTotalVo.setIsendnums(iSendNumsTotal);
siTotalVo.setIrecievedS(iRecievedSTotal);
siTotalVo.setInotRecievedS(iNotRecievedSTotal);
siTotalVo.setInotAskRecievedS(iNotAskRecievedSTotal);
siTotalVo.setDrecievedPersent(dRecievedPersentTotal);
siTotalVo.setDnotRecievedPersent(dNotRecievedPersentTotal);
siTotalVo.setDnotAskRecievedPersent(dNotAskRecievedPersentTotal);
retList.add(siTotalVo);
}
return retList;
} catch (RuntimeException re) {
logger.error("获得统计数据失败!", re);
throw re;
}
}
SiInformService siInformService = (SiInformService) getWebApplicationContext()
.getBean("siInformService");
List totalList = siInformService.getTotalByDepAndDate(strDepid, strFirstDayOfMonth, strLastDayOfMonth);
request.setAttribute("totalList", totalList);
request.setAttribute("rootOrgList", depList);
return actionMapping.findForward("total.init");SiInformService接口:
public abstract SiTotalVo getTotalByDepAndDate(String as_depid,String as_start,String as_end);
public abstract List getTotalByDepAndDate(String as_depid[],String as_start,String as_end);public SiTotalVo getTotalByDepAndDate(String asDepid, String asStart, String asEnd)
{
// TODO 自动生成方法体
String strStatus = "";
String strDepname = "";
//单个部门在给定时间段得通知单列表
List list1 = this.siSorInformDeptDao.getRecordsByDepidAndDate(asDepid,
InformSorType.RECIVE_INFORM, asStart, asEnd);
//本单位已经接访的记录列表即状态=4
strStatus = InformSorStatus.SIGNIN_INFORM_ALREADY;
List list2 = this.siSorInformDeptDao.getRecordsByDepidAndDateAndStatus(asDepid, InformSorType.RECIVE_INFORM, asStart, asEnd, strStatus);
//本单位未接访的记录列表即状态<>4
String strWhere = " and (model.sorDept=" + asDepid + " and model.sorType="
+ InformSorType.RECIVE_INFORM + ") and ("
+ " TO_CHAR(model.sendDate,'yyyy/MM/dd')>='" + asStart
+ "' and " + " TO_CHAR(model.sendDate,'yyyy/MM/dd')<='" + asEnd
+ "') and (model.sorStatus<>" + strStatus + ") order by model.id desc ";
List list3 = this.siSorInformDeptDao.getRecordsByAnyWhere(strWhere);
//本单位未按要求接访记录列表(签到状态为4的并且签到时间晚于要求接访时间) or (签到状态为4的且指定接访人未到原因字段不为空的。)
List list4 =this.siSorInformDeptDao.getNotAskRecievedByDepidAndDateAndStatus(asDepid, InformSorType.RECIVE_INFORM, asStart, asEnd, InformSorStatus.SIGNIN_INFORM_ALREADY);
int iSendNums = list1.size(), iRecievedS = list2.size(),
iNotRecievedS = list3.size(), iNotAskRecievedS = list4.size();
double dRecievedPersent = 0d;
double dNotRecievedPersent = 0d;
double dNotAskRecievedPersent = 0d;
if (iSendNums > 0) {
dRecievedPersent = (double) iRecievedS / (double) iSendNums;
dNotRecievedPersent = (double) iNotRecievedS / (double) iSendNums;
dNotAskRecievedPersent = (double) iNotAskRecievedS / (double) iSendNums;
}
SiTotalVo siTotalVo = new SiTotalVo();
siTotalVo.setStrDepid(asDepid);
IOrgManagerService orgService = this.getOrgManagerService();
strDepname = orgService.getOrgById(asDepid).getName();
siTotalVo.setStrDepname(strDepname);
siTotalVo.setIsendnums(iSendNums);
siTotalVo.setIrecievedS(iRecievedS);
siTotalVo.setInotRecievedS(iNotRecievedS);
siTotalVo.setInotAskRecievedS(iNotAskRecievedS);
siTotalVo.setDrecievedPersent(dRecievedPersent);
siTotalVo.setDnotRecievedPersent(dNotRecievedPersent);
siTotalVo.setDnotAskRecievedPersent(dNotAskRecievedPersent);
return siTotalVo;
}
public List getTotalByDepAndDate(String[] asDepid, String asStart, String asEnd)
{
List retList = new ArrayList();
String strDepid = "";
SiTotalVo siTotalVo;
int iDepArrSize = asDepid.length;
int iSendNumsTotal = 0; //通知数量
int iRecievedSTotal = 0; //接访数量
int iNotRecievedSTotal = 0; //未接访数量
int iNotAskRecievedSTotal = 0; //未按要求接访数量
double dRecievedPersentTotal = 0; //接访率
double dNotRecievedPersentTotal = 0; //未接访率
double dNotAskRecievedPersentTotal = 0; //未按要求接访率
try {
if (iDepArrSize < 1) {
logger.debug("部门数组长度为0,返回空值!");
return null;
} else {
for (int i = 0; i < iDepArrSize; i++) {
siTotalVo = new SiTotalVo();
strDepid = asDepid[i];
siTotalVo = getTotalByDepAndDate(strDepid, asStart, asEnd);
//以下计算汇总项目
iSendNumsTotal+=siTotalVo.getIsendnums();
iRecievedSTotal += siTotalVo.getIrecievedS();
iNotRecievedSTotal += siTotalVo.getInotRecievedS();
iNotAskRecievedSTotal += siTotalVo.getInotAskRecievedS();
retList.add(siTotalVo);
}
dRecievedPersentTotal= (double) iRecievedSTotal / (double) iSendNumsTotal;
dNotRecievedPersentTotal= (double) iNotRecievedSTotal / (double) iSendNumsTotal;
dNotAskRecievedPersentTotal = (double) iNotAskRecievedSTotal / (double) iSendNumsTotal;
//构造汇总对象
siTotalVo = new SiTotalVo();
siTotalVo.setStrDepid("0"); //0为全部单位汇总记录
siTotalVo.setStrDepname("总计");
siTotalVo.setIsendnums(iSendNumsTotal);
siTotalVo.setIrecievedS(iRecievedSTotal);
siTotalVo.setInotRecievedS(iNotRecievedSTotal);
siTotalVo.setInotAskRecievedS(iNotAskRecievedSTotal);
siTotalVo.setDrecievedPersent(dRecievedPersentTotal);
siTotalVo.setDnotRecievedPersent(dNotRecievedPersentTotal);
siTotalVo.setDnotAskRecievedPersent(dNotAskRecievedPersentTotal);
retList.add(siTotalVo);
}
return retList;
} catch (RuntimeException re) {
logger.error("获得统计数据失败!", re);
throw re;
}
}
解决方案 »
- 如何通过一个超链接提交一个表单?
- tomcat的一个疑问。
- 100分只给一个人,Xfire调用.net的webservice抱服务器未能识别 HTTP 头 SOAPAction 的值
- struts2 如何在页面接收地址传参
- 取2位小数,如何做
- 请教:JSP+JavaBean
- 如何使表单的变量是数组,我想做批量输入的表单。(急,急,急)
- 各位web方面的应用,安全验证是怎么作的,难道就是通过用户名和密码来作的吗?是否用了JAAS?能否介绍一下?
- 紧急求救,这是什么错误?
- 有关nginx和swagger-ui的问题
- jsp中跨页面传数据问题,我就不相信没人会了!
- 新手问,我在jsp 中增加了一行代码,显示页面报错,代码如下,是什么原因?
public List getRecordsByDepidAndDate(String asDepid,String asType, String asStart, String asEnd) {
// TODO 自动生成方法体
String strDepid = asDepid;
String strType = asType;
String strStartDate = asStart;
String strEndDate = asEnd;
String strSql = "";
log.debug("该方法根据部门ID和日期期间获得记录集合");
try {
if (strDepid.equals("") || strDepid == null) {
log.debug("部门ID参数为空不能调用方法");
return null;
} else {
strSql = " from SiSorInformDept model where (model.sorDept=" + strDepid + " and model.sorType="
+ strType
+ ") and ( TO_CHAR(model.sendDate,'yyyy/MM/dd')>='" + strStartDate
+ "' and " + " TO_CHAR(model.sendDate,'yyyy/MM/dd')<='" + strEndDate
+ "') order by model.id desc ";
System.out.println("---" + strSql);
return getHibernateTemplate().find(strSql);
}
} catch (RuntimeException re) {
log.error("根据部门ID和日期期间获得记录集合失败!", re);
throw re;
}
} /**
* 该方法根据部门ID和日期期间和记录状态获得记录集合
*/
public List getRecordsByDepidAndDateAndStatus(String asDepid, String asType,
String asStart, String asEnd, String asStatus) {
// TODO 自动生成方法体
String strDepid = asDepid;
String strType = asType;
String strStatus = asStatus;
String strStartDate = asStart;
String strEndDate = asEnd;
String strSql = "";
log.debug("该方法根据部门ID和日期期间和记录状态获得记录集合");
try {
if (strDepid.equals("") || strDepid == null) {
log.debug("部门ID参数为空不能调用方法");
return null;
} else if(strStatus.equals("") || strStatus == null) {
log.debug("部门状态参数为空不能调用方法");
return null;
} else {
strSql = " from SiSorInformDept model where (model.sorDept=" + strDepid + " and model.sorType="
+ strType
+ ") and (TO_CHAR(model.sendDate,'yyyy/MM/dd')>='" + strStartDate
+ "' and " + " TO_CHAR(model.sendDate,'yyyy/MM/dd')<='" + strEndDate
+ "') and (model.sorStatus=" + strStatus + ") order by model.id desc ";
System.out.println("^^^^^^^^^^^^^^" + strSql);
return getHibernateTemplate().find(strSql);
}
} catch (RuntimeException re) {
log.error("根据部门ID和日期期间和记录状态获得记录集合失败!", re);
throw re;
}
} /**
*
*/
public List getNotAskRecievedByDepidAndDateAndStatus(String asDepid, String asType, String asStart, String asEnd, String asStatus) {
// TODO 自动生成方法体
String strDepid = asDepid;
String strType = asType;
String strStatus = asStatus;
String strSql = "";
log.debug("该方法根据部门ID和日期期间和记录状态获得未按要求接访记录集合");
try {
if(strDepid.equals("") || strDepid == null) {
log.debug("部门ID参数为空不能调用方法");
return null;
}else if(strStatus.equals("") || strStatus == null) {
log.debug("部门状态参数为空不能调用方法");
return null;
} else {
strSql = " from SiSorInformDept m1,SiInform m2 where (m1.siInform.id=m2.id and m1.sorDept=" + strDepid
+ " and m1.sorType=" + strType + " and m1.sorStatus=" + strStatus
+ ") and ((TO_CHAR(m1.signinDate,'yyyy/MM/dd')>TO_CHAR(m2.askForDate,'yyyy/MM/dd')) ";
strSql += "or (m1.notarrivelSource is not null and length(rtrim(ltrim(m1.notarrivelSource)))>0))";
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$" + strSql);
return getHibernateTemplate().find(strSql);
}
} catch (RuntimeException re) {
log.error("根据部门ID和日期期间和记录状态获得记录集合失败!", re);
throw re;
}
}