attendanceManagement.zip
立即下载
资源介绍:
attendanceManagement.zip
package demo.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import demo.bean.ResultBean;
import demo.bean.SignInfo;
import demo.bean.Staff;
import demo.service.SignInfoService;
import demo.service.StaffService;
public class SignInfoAction extends ActionSupport {
/**
*
*/
private static final long serialVersionUID = 1L;
private Integer signId;
private Staff staff;
private String signDate;
private String signStatus;
private String appeal;
private String appealResult;
private String dataSources;
private String startDate;
private String endDate;
private String branch;
private List signInfos = new ArrayList();
private SignInfo signInfo;
private int staffId;
private String chooseBranch[];
private String startD;
private String endD;
private String type;
private String datasourceJudge;
private String operation;
public String getDatasourceJudge() {
return datasourceJudge;
}
public void setDatasourceJudge(String datasourceJudge) {
this.datasourceJudge = datasourceJudge;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getStartD() {
return startD;
}
public void setStartD(String startD) {
this.startD = startD;
}
public String getEndD() {
return endD;
}
public void setEndD(String endD) {
this.endD = endD;
}
public String[] getChooseBranch() {
return chooseBranch;
}
public void setChooseBranch(String[] chooseBranch) {
this.chooseBranch = chooseBranch;
}
private SignInfoService signInfoService;
private StaffService staffService;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public StaffService getStaffService() {
return staffService;
}
public void setStaffService(StaffService staffService) {
this.staffService = staffService;
}
public String getSignDate() {
return signDate;
}
public void setSignDate(String signDate) {
this.signDate = signDate;
}
public void setSignStatus(String signStatus) {
this.signStatus = signStatus;
}
public SignInfo getSignInfo() {
return signInfo;
}
public void setSignInfo(SignInfo signInfo) {
this.signInfo = signInfo;
}
public List getSignInfos() {
return signInfos;
}
public void setSignInfos(List signInfos) {
this.signInfos = signInfos;
}
public void setStaffId(int staffId) {
this.staffId = staffId;
}
public void setBranch(String branch) {
this.branch = branch;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public void setSignId(Integer signId) {
this.signId = signId;
}
public Staff getStaff() {
return staff;
}
public void setStaff(Staff staff) {
this.staff = staff;
}
public void setAppeal(String appeal) {
this.appeal = appeal;
}
public void setAppealResult(String appealResult) {
this.appealResult = appealResult;
}
public void setDataSources(String dataSources) {
this.dataSources = dataSources;
}
public void setSignInfoService(SignInfoService signInfoService) {
this.signInfoService = signInfoService;
}
public Integer getSignId() {
return signId;
}
public String getSignStatus() {
return signStatus;
}
public String getAppeal() {
return appeal;
}
public String getAppealResult() {
return appealResult;
}
public String getDataSources() {
return dataSources;
}
public String getStartDate() {
return startDate;
}
public String getEndDate() {
return endDate;
}
public String getBranch() {
return branch;
}
public int getStaffId() {
return staffId;
}
public SignInfoService getSignInfoService() {
return signInfoService;
}
@SuppressWarnings("unchecked")
public String findByBranchAndDate() {
Date start=Date.valueOf(startDate);
Date end=Date.valueOf(endDate);
this.signInfos=signInfoService.findByBranchDate(branch, start, end);
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String findByBranch(){
HttpServletRequest request = ServletActionContext.getRequest();
try {
request.setCharacterEncoding("utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//获取选中的值
this.branch = request.getParameter("duty1");
this.signInfos=signInfoService.findByBranch(branch);
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String findSignInfoByStaffId() {
this.signInfos=signInfoService.findByStaffId(staffId);
return SUCCESS;
}
public String findAllSignInfo(){
this.signInfos=signInfoService.findAll();
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String findByDateAndStaffId() {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date date = null;
try {
date = formatter.parse(signDate);
} catch (ParseException e) {
e.printStackTrace();
}
this.signInfos=signInfoService.findByDateAndStaffId(staffId, date);
return SUCCESS;
}
public String findByDateAndStaffIdFront() {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date date = null;
try {
date = formatter.parse(signDate);
} catch (ParseException e) {
e.printStackTrace();
}
this.signInfos=signInfoService.findByDateAndStaffId(staffId, date);
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String clearData(){
this.signInfos = signInfoService.findByStaffId(staffId);
for (SignInfo signInfo : signInfos) {
if(signInfo.getDataSources().equals("银河大厦")){
}else {
signInfo.setDataSources("无效");
signInfoService.updateSignInfo(signInfo);
}
}
return SUCCESS;
}
@SuppressWarnings("unchecked")
public String findByDateAndStaffIdShowChart(){
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
try {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
System.out.println("欢迎使用echartsAction");
Date start=Date.valueOf(startDate);
Date end=Date.valueOf(endDate);
List list = signInfoService.findBetweenDateById(staffId, start, end);
ResultBean rb = new ResultBean();
if(list.size()>0){
rb.setCode(200);
rb.setMessage("获取数据成功");
List dataX = new ArrayList();
List dataY = new ArrayList();
List dataY1 = new ArrayList();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for (SignInfo signInfo:list) {
dataX.add(sdf.format(signInfo.getSignDate()));
dataY1.add(signInfo.getSignStatus());
if(signInfo.getSignStatus().equals("满勤")){
dataY.add(10);
}else if(signInfo.getSignStatus().equals("迟到")){
dataY.add(7);
资源文件列表:
attendanceManagement.zip 大约有245个文件