排班结果查询
parent
f30da38662
commit
cbf7df6cd2
Binary file not shown.
@ -0,0 +1,13 @@
|
|||||||
|
package com.api.attendance.persongroup.web;
|
||||||
|
|
||||||
|
import com.engine.attendance.persongroup.web.SchedulingResultsAction;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
|
||||||
|
@Path("/attendance/schedulingresults")
|
||||||
|
@Slf4j
|
||||||
|
public class SchedulingResultsActionApi extends SchedulingResultsAction {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,89 @@
|
|||||||
|
package com.engine.attendance.persongroup.cmd;
|
||||||
|
|
||||||
|
import com.engine.common.biz.AbstractCommonCommand;
|
||||||
|
import com.engine.common.entity.BizLogContext;
|
||||||
|
import com.engine.common.util.DbTools;
|
||||||
|
import com.engine.core.interceptor.CommandContext;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.icbc.api.internal.apache.http.M;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.Util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class GetDatatableCmd extends AbstractCommonCommand<Map<String,Object>> {
|
||||||
|
@Override
|
||||||
|
public BizLogContext getLogContext() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public GetDatatableCmd(Map<String,Object> params){
|
||||||
|
this.params=params;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> execute(CommandContext commandContext) {
|
||||||
|
String tableName = Util.null2String(params.get("tableName"));
|
||||||
|
String startDate = Util.null2String(params.get("startDate"));
|
||||||
|
String endDate = Util.null2String(params.get("endDate"));
|
||||||
|
String pblx = Util.null2String(params.get("pblx"));
|
||||||
|
String pbdx = Util.null2String(params.get("pbdx"));
|
||||||
|
int total = Integer.valueOf(Util.null2String(params.get("total")));
|
||||||
|
int current = Integer.valueOf(Util.null2String(params.get("current")));
|
||||||
|
int pageSize = Integer.valueOf(Util.null2String(params.get("pageSize")));
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
Map<String, Object> resultMap = Maps.newHashMap();
|
||||||
|
String sql = "select id from "+tableName +" where pbtj=0 ";
|
||||||
|
List<Object> param = Lists.newArrayList();
|
||||||
|
|
||||||
|
String conditions = "";
|
||||||
|
if (!"".equals(startDate) && !"".equals(endDate)){
|
||||||
|
conditions += " and bcrq >= ? and bcrq<= ?";
|
||||||
|
param.add(startDate);
|
||||||
|
param.add(endDate);
|
||||||
|
}
|
||||||
|
// if (!"".equals(pblx)){
|
||||||
|
// conditions += " and dxlx = ?";
|
||||||
|
// param.add(pblx);
|
||||||
|
// }
|
||||||
|
if (!"".equals(pbdx)){
|
||||||
|
conditions += " and dxlx = ?";
|
||||||
|
param.add(pblx);
|
||||||
|
if ("0".equals(pblx)){
|
||||||
|
//人员
|
||||||
|
conditions += " and pbdxry = ?";
|
||||||
|
|
||||||
|
}else if ("1".equals(pblx)){
|
||||||
|
//人员分组
|
||||||
|
conditions += " and pbdxryfz = ?";
|
||||||
|
|
||||||
|
}else if ("2".equals(pblx)){
|
||||||
|
//部门
|
||||||
|
conditions += " and pbdxbm = ?";
|
||||||
|
|
||||||
|
}else if ("3".equals(pblx)){
|
||||||
|
//分部
|
||||||
|
conditions += " and pbdxfb = ?";
|
||||||
|
}
|
||||||
|
param.add(pbdx);
|
||||||
|
}
|
||||||
|
int startindex = (current-1)*pageSize;
|
||||||
|
String dbType = rs.getDBType();
|
||||||
|
if ("oracle".equals(dbType)){
|
||||||
|
|
||||||
|
}else {
|
||||||
|
sql = sql + conditions +" limit "+startindex+",1";
|
||||||
|
String queryDatatablesql = "select a.id as `key`,b.lastname,a.* from "+tableName +" a left join hrmresource b on a.pbdxry=b.id where a.id>=("+sql+") "+conditions+" limit "+pageSize;
|
||||||
|
log.info("queryDatatablesql : {}",queryDatatablesql);
|
||||||
|
param.addAll(param);
|
||||||
|
log.info("param : {}",param);
|
||||||
|
List<Map<String,Object>> dataTable = DbTools.getSqlToList(queryDatatablesql,param.toArray());
|
||||||
|
resultMap.put("data",dataTable);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,75 @@
|
|||||||
|
package com.engine.attendance.persongroup.cmd;
|
||||||
|
|
||||||
|
import com.engine.common.biz.AbstractCommonCommand;
|
||||||
|
import com.engine.common.entity.BizLogContext;
|
||||||
|
import com.engine.common.util.DbTools;
|
||||||
|
import com.engine.core.interceptor.CommandContext;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class GetDatatableCountCmd extends AbstractCommonCommand<Map<String,Object>> {
|
||||||
|
@Override
|
||||||
|
public BizLogContext getLogContext() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public GetDatatableCountCmd(Map<String, Object> params){
|
||||||
|
this.params=params;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> execute(CommandContext commandContext) {
|
||||||
|
String tableName = Util.null2String(params.get("tableName"));
|
||||||
|
String startDate = Util.null2String(params.get("startDate"));
|
||||||
|
String endDate = Util.null2String(params.get("endDate"));
|
||||||
|
String pblx = Util.null2String(params.get("pblx"));
|
||||||
|
String pbdx = Util.null2String(params.get("pbdx"));
|
||||||
|
|
||||||
|
|
||||||
|
String sql = "select count(0) total from "+tableName +" where pbtj=0 ";
|
||||||
|
List<Object> params = Lists.newArrayList();
|
||||||
|
|
||||||
|
String conditions = "";
|
||||||
|
if (!"".equals(startDate) && !"".equals(endDate)){
|
||||||
|
conditions += " and bcrq >= ? and bcrq<= ?";
|
||||||
|
params.add(startDate);
|
||||||
|
params.add(endDate);
|
||||||
|
}
|
||||||
|
// if (!"".equals(pblx)){
|
||||||
|
// conditions += " and dxlx = ?";
|
||||||
|
// params.add(pblx);
|
||||||
|
// }
|
||||||
|
if (!"".equals(pbdx)){
|
||||||
|
conditions += " and dxlx = ?";
|
||||||
|
params.add(pblx);
|
||||||
|
if ("0".equals(pblx)){
|
||||||
|
//人员
|
||||||
|
conditions += " and pbdxry = ?";
|
||||||
|
|
||||||
|
}else if ("1".equals(pblx)){
|
||||||
|
//人员分组
|
||||||
|
conditions += " and pbdxryfz = ?";
|
||||||
|
|
||||||
|
}else if ("2".equals(pblx)){
|
||||||
|
//部门
|
||||||
|
conditions += " and pbdxbm = ?";
|
||||||
|
|
||||||
|
}else if ("3".equals(pblx)){
|
||||||
|
//分部
|
||||||
|
conditions += " and pbdxfb = ?";
|
||||||
|
}
|
||||||
|
params.add(pbdx);
|
||||||
|
}
|
||||||
|
|
||||||
|
sql = sql + conditions;
|
||||||
|
log.info("GetDatatableCountCmd sql :{}",sql);
|
||||||
|
log.info("params : [{}]",params);
|
||||||
|
Map<String,Object> dataMap = DbTools.getSqlToMap(sql,params.toArray());
|
||||||
|
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.engine.attendance.persongroup.service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface SchedulingResultsService {
|
||||||
|
Map<String,Object> queryDataTable(Map<String,Object> params);
|
||||||
|
}
|
@ -0,0 +1,116 @@
|
|||||||
|
package com.engine.attendance.persongroup.service.impl;
|
||||||
|
|
||||||
|
import com.engine.attendance.persongroup.cmd.GetDatatableCmd;
|
||||||
|
import com.engine.attendance.persongroup.cmd.GetDatatableCountCmd;
|
||||||
|
import com.engine.attendance.persongroup.cmd.GetDatatableRecurrenceCmd;
|
||||||
|
import com.engine.attendance.persongroup.commonutil.CommonUtil;
|
||||||
|
import com.engine.attendance.persongroup.service.SchedulingResultsService;
|
||||||
|
import com.engine.core.impl.Service;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import weaver.general.Util;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class SchedulingResultsServiceImpl extends Service implements SchedulingResultsService {
|
||||||
|
private Map<String,Object> personGroupMap = CommonUtil.getPersonGroup();
|
||||||
|
private Map<String,Object> departMentMap = CommonUtil.getDepartMent();
|
||||||
|
private Map<String,Object> subCompanyMap = CommonUtil.getSubCompany();
|
||||||
|
private Map<String,Object> classesInformationMap = CommonUtil.getClassesInformation();
|
||||||
|
private Map<String,Object> candidateTeamMap = CommonUtil.getCandidateTeam();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryDataTable(Map<String, Object> params) {
|
||||||
|
String recurrence = Util.null2String(params.get("recurrence"));
|
||||||
|
Map<String,Object> resultMap = Maps.newHashMap();
|
||||||
|
int current = Integer.valueOf(Util.null2String(params.get("current")));
|
||||||
|
int pageSize = Integer.valueOf(Util.null2String(params.get("pageSize")));
|
||||||
|
int startindex = (current-1)*pageSize;
|
||||||
|
int endindex = current*pageSize;
|
||||||
|
// Map<String,Object> personGroupMap = CommonUtil.getPersonGroup();
|
||||||
|
// Map<String,Object> departMentMap = CommonUtil.getDepartMent();
|
||||||
|
// Map<String,Object> subCompanyMap = CommonUtil.getSubCompany();
|
||||||
|
// Map<String,Object> classesInformationMap = CommonUtil.getClassesInformation();
|
||||||
|
// Map<String,Object> candidateTeamMap = CommonUtil.getCandidateTeam();
|
||||||
|
|
||||||
|
if ("1".equals(recurrence)){
|
||||||
|
//递归查询方式
|
||||||
|
Map<String,Object> result = commandExecutor.execute(new GetDatatableRecurrenceCmd(params));
|
||||||
|
List<Map<String, Object>> dataTableList = (List<Map<String, Object>>)result.get("dataTableList");
|
||||||
|
int total = dataTableList.size();
|
||||||
|
resultMap.put("total",total);
|
||||||
|
if (endindex > total){
|
||||||
|
endindex = total;
|
||||||
|
}
|
||||||
|
dataTableList = dataTableList.subList(startindex,endindex);
|
||||||
|
for (Map<String, Object> map:dataTableList){
|
||||||
|
SetBrowSerName(map);
|
||||||
|
}
|
||||||
|
log.info("dataTableList : {}",dataTableList);
|
||||||
|
resultMap.put("data",dataTableList);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
//非递归查询方式
|
||||||
|
Map<String,Object> result = commandExecutor.execute(new GetDatatableCountCmd(params));
|
||||||
|
int total = Integer.valueOf(result.get("total").toString());
|
||||||
|
params.put("total",total);
|
||||||
|
resultMap = commandExecutor.execute(new GetDatatableCmd(params));
|
||||||
|
List<Map<String,Object>> dataTable = (List<Map<String,Object>>)resultMap.get("data");
|
||||||
|
for (Map<String,Object> map :dataTable){
|
||||||
|
SetBrowSerName(map);
|
||||||
|
|
||||||
|
}
|
||||||
|
resultMap.put("total",total);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 塞入 人员、人员分组、部门、分部、班次信息、候选班组浏览按钮显示值
|
||||||
|
* @param map
|
||||||
|
*/
|
||||||
|
public void SetBrowSerName(Map<String,Object> map){
|
||||||
|
log.info("personGroupMap :{},departMentMap:{},subCompanyMap:{},classesInformationMap:{},candidateTeamMap:{}"
|
||||||
|
,personGroupMap.hashCode(),departMentMap.hashCode(),subCompanyMap.hashCode(),classesInformationMap.hashCode(),candidateTeamMap.hashCode());
|
||||||
|
String dxlx = Util.null2String(map.get("dxlx"));
|
||||||
|
if (dxlx.equals("0")){
|
||||||
|
//人员
|
||||||
|
String lastname = Util.null2String(map.get("lastname"));
|
||||||
|
String pbdxry = Util.null2String(map.get("pbdxry"));
|
||||||
|
pbdxry = pbdxry +"-"+lastname;
|
||||||
|
map.put("pbdxry",pbdxry);
|
||||||
|
|
||||||
|
}else if (dxlx.equals("1")){
|
||||||
|
//人员分组
|
||||||
|
String pbdxryfz = Util.null2String(map.get("pbdxryfz"));
|
||||||
|
pbdxryfz= pbdxryfz+"-"+personGroupMap.get(pbdxryfz);
|
||||||
|
map.put("pbdxryfz",pbdxryfz);
|
||||||
|
|
||||||
|
}else if (dxlx.equals("2")){
|
||||||
|
//部门
|
||||||
|
String pbdxbm = Util.null2String(map.get("pbdxbm"));
|
||||||
|
pbdxbm= pbdxbm+"-"+departMentMap.get(pbdxbm);
|
||||||
|
map.put("pbdxbm",pbdxbm);
|
||||||
|
|
||||||
|
}else if (dxlx.equals("3")){
|
||||||
|
//分部
|
||||||
|
String pbdxfb = Util.null2String(map.get("pbdxfb"));
|
||||||
|
pbdxfb= pbdxfb+"-"+subCompanyMap.get(pbdxfb);
|
||||||
|
map.put("pbdxfb",pbdxfb);
|
||||||
|
}
|
||||||
|
String bcxx = Util.null2String(map.get("bcxx"));
|
||||||
|
String hxbz = Util.null2String(map.get("hxbz"));
|
||||||
|
if (!"".equals(bcxx)){
|
||||||
|
bcxx = bcxx +"-"+classesInformationMap.get(bcxx);
|
||||||
|
map.put("bcxx",bcxx);
|
||||||
|
}
|
||||||
|
if (!"".equals(hxbz)){
|
||||||
|
hxbz = hxbz +"-"+candidateTeamMap.get(hxbz);
|
||||||
|
map.put("hxbz",hxbz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.engine.attendance.persongroup.web;
|
||||||
|
|
||||||
|
import com.engine.attendance.persongroup.service.SchedulingResultsService;
|
||||||
|
import com.engine.attendance.persongroup.service.impl.SchedulingResultsServiceImpl;
|
||||||
|
import com.engine.common.util.ApiReturnTools;
|
||||||
|
import com.engine.common.util.ParamUtil;
|
||||||
|
import com.engine.common.util.ServiceUtil;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class SchedulingResultsAction {
|
||||||
|
|
||||||
|
private SchedulingResultsService basicsetService = ServiceUtil.getService(SchedulingResultsServiceImpl.class);
|
||||||
|
/**
|
||||||
|
* 获得排班结果列表查询
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@POST
|
||||||
|
@Path("/getSchedulingData")
|
||||||
|
@Produces({"text/plain"})
|
||||||
|
public String getSchedulingData(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
|
Map<String,Object> paramMap = ParamUtil.request2Map(request);
|
||||||
|
Map<String,Object> dataMap = basicsetService.queryDataTable(paramMap);
|
||||||
|
return ApiReturnTools.success(dataMap);
|
||||||
|
}
|
||||||
|
}
|
@ -1,76 +0,0 @@
|
|||||||
package com.engine.common.util;
|
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import weaver.conn.RecordSet;
|
|
||||||
import weaver.general.BaseBean;
|
|
||||||
import weaver.general.Util;
|
|
||||||
|
|
||||||
public class PropBean {
|
|
||||||
|
|
||||||
public static BaseBean bb = new BaseBean();
|
|
||||||
public static String active = Util.null2String(bb.getPropValue("developProp","active")).toUpperCase();
|
|
||||||
|
|
||||||
/***
|
|
||||||
*
|
|
||||||
* @param pkey
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getUfPropValue(String pkey)
|
|
||||||
{
|
|
||||||
BaseBean baseBean = new BaseBean();
|
|
||||||
if(StringUtils.isEmpty(pkey)){
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(StringUtils.isEmpty(active)){
|
|
||||||
active = Util.null2String(baseBean.getPropValue("developProp","active")).toUpperCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
//baseBean.writeLog("propbeanactive:"+active+" pkey:"+pkey+" "+active+"VALUE");
|
|
||||||
String pvalue = "";
|
|
||||||
try{
|
|
||||||
RecordSet rs = new RecordSet();
|
|
||||||
String sql = " SELECT DEVVALUE,TESTVALUE,PRODVALUE FROM UF_PROP WHERE PKEY = ?";
|
|
||||||
rs.executeQuery(sql,new Object[]{pkey.trim()});
|
|
||||||
|
|
||||||
if(rs.next()){
|
|
||||||
pvalue = Util.null2String(rs.getString(active+"VALUE"));
|
|
||||||
}
|
|
||||||
// baseBean.writeLog("pvalue:"+pvalue);
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
bb.writeLog("propbean-e:"+e);
|
|
||||||
}
|
|
||||||
return pvalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
|
||||||
*
|
|
||||||
* @param pkey
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getUfPropValueStatic(String pkey)
|
|
||||||
{
|
|
||||||
BaseBean baseBean = new BaseBean();
|
|
||||||
if(StringUtils.isEmpty(pkey)){
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
String active = Util.null2String(baseBean.getPropValue("developProp","active")).toUpperCase();
|
|
||||||
String pvalue = "";
|
|
||||||
try{
|
|
||||||
RecordSet rs = new RecordSet();
|
|
||||||
String sql = " SELECT DEVVALUE,TESTVALUE,PRODVALUE FROM UF_PROP WHERE PKEY = ?";
|
|
||||||
rs.executeQuery(sql,new Object[]{pkey.trim()});
|
|
||||||
if(rs.next()){
|
|
||||||
pvalue = Util.null2String(rs.getString(active+"VALUE"));
|
|
||||||
}
|
|
||||||
baseBean.writeLog("pvalue:"+pvalue);
|
|
||||||
}catch (Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
bb.writeLog("propbean-e:"+e);
|
|
||||||
}
|
|
||||||
return pvalue;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue